(forms-seq* rdr)
(forms-seq* rdr filename)
Seq of Clojure/ClojureScript forms from rdr, a java.io.Reader. Optionally
accepts a filename argument which will be used in any emitted errors.
Source
(defn forms-seq*
"Seq of Clojure/ClojureScript forms from rdr, a java.io.Reader. Optionally
accepts a filename argument which will be used in any emitted errors."
([^Reader rdr] (forms-seq* rdr nil))
([^Reader rdr filename]
{:pre [(instance? Reader rdr)]}
(let [eof-sentinel (Object.)
opts (merge
{:eof eof-sentinel}
(if (and filename (= (util/ext filename) "cljc"))
{:read-cond :allow :features #{:cljs}}))
pbr (readers/indexing-push-back-reader
(PushbackReader. rdr) 1 filename)
data-readers tags/*cljs-data-readers*
forms-seq_
(fn forms-seq_ []
(lazy-seq
(let [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/resolve-symbol resolve-symbol]
(reader/read opts pbr))]
(if (identical? form eof-sentinel)
(.close rdr)
(cons form (forms-seq_))))))]
(forms-seq_))))