From a9e828cc6aeab1400217d2af9fa20c93b2183baa Mon Sep 17 00:00:00 2001 From: Shagun Agrawal Date: Sun, 3 Nov 2024 14:53:13 +0530 Subject: Add parsing for storage class specifiers Add parsing for extern and static keywords in declarations --- src/cljcc/exception.clj | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/cljcc/exception.clj') 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)))) -- cgit v1.2.3