diff options
Diffstat (limited to 'cljcc-compiler/src/cljcc/core')
| -rw-r--r-- | cljcc-compiler/src/cljcc/core/exception.clj (renamed from cljcc-compiler/src/cljcc/core/exception.cljc) | 17 | ||||
| -rw-r--r-- | cljcc-compiler/src/cljcc/core/format.clj | 1 | ||||
| -rw-r--r-- | cljcc-compiler/src/cljcc/core/format.cljc | 10 | ||||
| -rw-r--r-- | cljcc-compiler/src/cljcc/core/log.clj (renamed from cljcc-compiler/src/cljcc/core/log.cljc) | 0 |
4 files changed, 3 insertions, 25 deletions
diff --git a/cljcc-compiler/src/cljcc/core/exception.cljc b/cljcc-compiler/src/cljcc/core/exception.clj index 19245aa..412dfff 100644 --- a/cljcc-compiler/src/cljcc/core/exception.cljc +++ b/cljcc-compiler/src/cljcc/core/exception.clj @@ -1,21 +1,8 @@ -(ns cljcc.core.exception - (:require [cljcc.core.format :refer [safe-format]])) - -(defn try-catch-ex - ([f] - (try - (f) - (catch #?(:clj Throwable :cljs :default) e - [:error e]))) - ([f default] - (try - (f) - (catch #?(:clj Throwable :cljs :default) e - default)))) +(ns cljcc.core.exception) (defn lex-error [{line :line col :col :as data}] (throw (ex-info - (safe-format "Invalid token at line: %s, col: %s." line col) + (format "Invalid token at line: %s, col: %s." line col) (merge {:error/type :lexer} data)))) (defn parser-error [msg data] diff --git a/cljcc-compiler/src/cljcc/core/format.clj b/cljcc-compiler/src/cljcc/core/format.clj new file mode 100644 index 0000000..7b3fc48 --- /dev/null +++ b/cljcc-compiler/src/cljcc/core/format.clj @@ -0,0 +1 @@ +(ns cljcc.core.format) diff --git a/cljcc-compiler/src/cljcc/core/format.cljc b/cljcc-compiler/src/cljcc/core/format.cljc deleted file mode 100644 index 851b6a1..0000000 --- a/cljcc-compiler/src/cljcc/core/format.cljc +++ /dev/null @@ -1,10 +0,0 @@ -(ns cljcc.core.format - #?(:clj (:require [clojure.core :refer [format]]) - :cljs (:require [goog.string :as gstring] - [goog.string.format]))) - -(defn safe-format - "Cross platform format." - [fmt & args] - #?(:clj (apply format fmt args) - :cljs (apply gstring/format fmt args))) diff --git a/cljcc-compiler/src/cljcc/core/log.cljc b/cljcc-compiler/src/cljcc/core/log.clj index bb92b02..bb92b02 100644 --- a/cljcc-compiler/src/cljcc/core/log.cljc +++ b/cljcc-compiler/src/cljcc/core/log.clj |
