reader: #?@ empty splice fix (nil→@[]), #? nil→:jolt/skip, map reader handles #_/#?@ in K/V evaluator: unwrap-meta-name helper, deftype interns ->Name too, dot-suffix fix core: comment/prefer-method stubs, *unchecked-math*/*clojure-version* dynamic vars
21 lines
658 B
Text
21 lines
658 B
Text
# Preprocess a cljc file: resolve #?(:clj ...) and #?@(:clj ...) reader conditionals
|
|
# at read time. Output a plain .clj file that Jolt can parse without reader conditionals.
|
|
|
|
(use ./src/jolt/reader)
|
|
|
|
(defn preprocess [filepath]
|
|
(def src (slurp filepath))
|
|
(var s src)
|
|
(var out @[])
|
|
(var count 0)
|
|
(while (> (length (string/trim s)) 0)
|
|
(def [form rest] (parse-next s))
|
|
(set s rest)
|
|
(++ count)
|
|
(if (nil? form)
|
|
nil
|
|
(array/push out (string form))))
|
|
(string/join out "\n"))
|
|
|
|
(def filepath (if (> (length (dyn :args @[])) 0) (in (dyn :args) 0) "/Users/yogthos/src/sci/src/sci/impl/utils.cljc"))
|
|
(print (preprocess filepath))
|