   [f m]
   (reduce-kv (fn [r k v] (assoc r (f k) v)) {} m))
 
-(defn repl-read-string
-  "Try to read a string binding all the standard data readers. This
-  function throws if a valid form cannot be found."
-  [line]
+(defn read
+  "Reading forms from a reader (see clojure.tools.reader.reader-types
+  for reader implementations). This function throws if a valid form
+  cannot be found."
+  [opts rdr]
   (binding [ana/*cljs-ns* (:current-ns @app-env)
             env/*compiler* st
             r/*data-readers* tags/*cljs-data-readers*
             r/resolve-symbol ana/resolve-symbol]
-    (r/read-string {:read-cond :allow :features #{:cljs}} line)))
+    (r/read opts rdr)))
+
+(defn read-string
+  "Reading forms from a string. This function throws if a valid one
+  cannot be found."
+  [opts s]
+  (binding [ana/*cljs-ns* (:current-ns @app-env)
+            env/*compiler* st
+            r/*data-readers* tags/*cljs-data-readers*
+            r/resolve-symbol ana/resolve-symbol]
+    (r/read-string opts s)))
 
 (defn ns-form?
   [form]

  cljs.analyzer/resolve-macro-var) a macro?"
  [var]
  (:macro var))

(defn extract-namespace
  [source]
  (let [first-form (repl-read-string source)]
    (when (ns-form? first-form)
      (second first-form))))

(defn resolve
  "From cljs.analyzer.api.clj. Given an analysis environment resolve a

                                                 r/resolve-symbol ana/resolve-symbol]
                                         (let [source (:source result)
                                               rdr (rt/source-logging-push-back-reader source)]
                                           ;; AR - Skip lines using cljs.tools.reader.impl.commons
                                           ;; not a public API so it might change in the future
                                           (dotimes [_ (dec (:line var))] (rc/skip-line rdr))
                                           (-> (read {:read-cond :allow :features #{:cljs}} rdr)
                                               meta
                                               :source
                                               common/wrap-success
