aboutsummaryrefslogtreecommitdiff
path: root/src/cljcc/exception.clj
blob: b8b8256a4f9d9d8411db0db6e451a611f49e636d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
(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))))