function
boot.janet on line 2806, column 1
(dofile path &named exit env source expander evaluator read parser)
Evaluate a file, file path, or stream and return the resulting
environment. :env, :expander, :source, :evaluator, :read, and
:parser are passed through to the underlying `run-context` call. If
`exit` is true, any top level errors will trigger a call to
`(os/exit 1)` after printing the error.
# Gathers all of the calls of "declare-" into a table from the project.janet file at path
(defn capture-declares [path]
(def *capture* @{})
(defn append-capture [name & arg]
(update *capture* name (fn [val] (array/push (or val @[]) ;arg))))
(defn only-captures [form]
(when (string/has-prefix? "declare-" (string (form 0)))
(append-capture (form 0) (slice form 1))
form)
nil)
(dofile path :expander only-captures)
*capture*)