aboutsummaryrefslogtreecommitdiff
path: root/src/cljcc/exception.clj
diff options
context:
space:
mode:
authorShagun Agrawal <agrawalshagun07@gmail.com>2024-11-03 14:53:13 +0530
committerShagun Agrawal <agrawalshagun07@gmail.com>2024-11-03 14:53:13 +0530
commita9e828cc6aeab1400217d2af9fa20c93b2183baa (patch)
tree1983b863952bee098c0934a4b943601b9a12b954 /src/cljcc/exception.clj
parent817731f53df634b1a7e6c5b69c8c0064d2b1c91c (diff)
Add parsing for storage class specifiers
Add parsing for extern and static keywords in declarations
Diffstat (limited to 'src/cljcc/exception.clj')
-rw-r--r--src/cljcc/exception.clj12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/cljcc/exception.clj b/src/cljcc/exception.clj
index 20d936b..6eec308 100644
--- a/src/cljcc/exception.clj
+++ b/src/cljcc/exception.clj
@@ -1,7 +1,9 @@
(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 {}))))
+(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))))