aboutsummaryrefslogtreecommitdiff
path: root/src/cljcc/exception.clj
diff options
context:
space:
mode:
authorShagun Agrawal <agrawalshagun07@gmail.com>2024-08-16 23:26:10 +0530
committerShagun Agrawal <agrawalshagun07@gmail.com>2024-08-16 23:26:10 +0530
commit05611820413a6f691da269e631f4359185416155 (patch)
treea9dda185ad32cf192866a83befe6843856ae63ad /src/cljcc/exception.clj
parentca4892ea62cfaca99f9174f58500457ea4a87354 (diff)
Switch to hand made parser, refactor asts to adjust change
Switch to hand made recursive descent parser. Remove instaparse from dependencies.
Diffstat (limited to 'src/cljcc/exception.clj')
-rw-r--r--src/cljcc/exception.clj7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/cljcc/exception.clj b/src/cljcc/exception.clj
new file mode 100644
index 0000000..20d936b
--- /dev/null
+++ b/src/cljcc/exception.clj
@@ -0,0 +1,7 @@
+(ns cljcc.exception)
+
+(defn lex-error [{line :line col :col msg :msg}]
+ (let [err-msg (if (empty? msg)
+ (format "Lexer error. Invalid token at line: %s, col: %s." line col)
+ (format "Lexer error. Invalid token at line: %s, col: %s. %s" line col msg))]
+ (throw (ex-info err-msg {}))))