From 0321df3708cfa4d1440faf3f407611df85484b4b Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 16 Mar 2025 02:00:40 +0530 Subject: Refactor files to cljcc-compiler and cli tool. --- cljcc-compiler/src/cljcc/exception.clj | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 cljcc-compiler/src/cljcc/exception.clj (limited to 'cljcc-compiler/src/cljcc/exception.clj') diff --git a/cljcc-compiler/src/cljcc/exception.clj b/cljcc-compiler/src/cljcc/exception.clj new file mode 100644 index 0000000..40ea930 --- /dev/null +++ b/cljcc-compiler/src/cljcc/exception.clj @@ -0,0 +1,21 @@ +(ns cljcc.exception) + +(defn lex-error [{line :line col :col :as data}] + (throw (ex-info + (format "Invalid token at line: %s, col: %s." line col) + (merge {:error/type :lexer} data)))) + +(defn parser-error [msg data] + (throw (ex-info msg (merge {:error/type :parser} data)))) + +(defn analyzer-error [msg data] + (throw (ex-info msg (merge {:error/type :analyzer} data)))) + +(defn tacky-error [msg data] + (throw (ex-info msg (merge {:error/type :tacky} data)))) + +(defn compiler-error [msg data] + (throw (ex-info msg (merge {:error/type :compiler} data)))) + +(defn emit-error [msg data] + (throw (ex-info msg (merge {:error/type :emit} data)))) -- cgit v1.2.3