diff options
| author | Your Name <agrawalshagun07@gmail.com> | 2025-03-16 18:03:26 +0530 |
|---|---|---|
| committer | Your Name <agrawalshagun07@gmail.com> | 2025-03-16 18:03:26 +0530 |
| commit | 32499638cef3c49ff686b19b5708d6b08712c526 (patch) | |
| tree | 31f09287602d243b22660fe455e5174bdcc280b4 /cljcc-compiler/src/cljcc/core | |
| parent | 277319fa392f5ee9f21eedf2c4d224739f045690 (diff) | |
Refactor into cli and cljcc-compiler folders
Pass all tests.
Fix babashka tasks and build setup.
Repl is behaving in unexpected ways, otherwise working
as expected.
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 |
