jolt/preprocess.janet
Yogthos b20536d1e3 bootstrap: SCI core deps loading with 284/304 forms passing
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
2026-06-01 23:24:13 -04:00

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))