(forms-seq f)
(forms-seq f filename)
(forms-seq f filename return-reader?)
DEPRECATED: Seq of Clojure/ClojureScript forms from [f], which can be anything
for which `clojure.java.io/reader` can produce a `java.io.Reader`. Optionally
accepts a [filename] argument, which the reader will use in any emitted errors.
Source
(defn forms-seq
"DEPRECATED: Seq of Clojure/ClojureScript forms from [f], which can be anything
for which `clojure.java.io/reader` can produce a `java.io.Reader`. Optionally
accepts a [filename] argument, which the reader will use in any emitted errors."
([f] (forms-seq f (source-path f)))
([f filename] (forms-seq f filename false))
([f filename return-reader?]
(let [rdr (io/reader f)
pbr (readers/indexing-push-back-reader
(PushbackReader. rdr) 1 filename)
data-readers tags/*cljs-data-readers*
forms-seq*
(fn forms-seq* []
(lazy-seq
(let [eof-sentinel (Object.)
form (binding [*ns* (create-ns *cljs-ns*)
reader/*data-readers* data-readers
reader/*alias-map*
(apply merge
((juxt :requires :require-macros)
(get-namespace *cljs-ns*)))]
(reader/read pbr nil eof-sentinel))]
(if (identical? form eof-sentinel)
(.close rdr)
(cons form (forms-seq*))))))]
(if (true? return-reader?)
[(forms-seq*) rdr]
(forms-seq*)))))