   supporting .unread and collapsing all of CR, LF, and CRLF to a single
   \\newline."
   [s]
-  (loop [c (.read s)]
+  (loop [c (readers/read-char s)]
     (case c
       \newline :line-start
       nil :stream-end
-      \; (do (.readLine s) :line-start)
+      \; (do (readers/read-line s) :line-start)
       (if (or (Character/isWhitespace c) (identical? c \,))
-        (recur (.read s))
-        (do (.unread s c) :body)))))
+        (recur (readers/read-char s))
+        (do (readers/unread s c) :body)))))
 
 (defn repl-read
   "Default :read hook for repl. Reads from *in* which must either be an

(defn repl-prompt []
  (print (str "ClojureScript:" ana/*cljs-ns* "> ")))

(defn repl-caught [e]
  )

(defn repl*
  [repl-env {:keys [init need-prompt prompt flush read eval print print-no-newline caught]
             :or {init        #()
                  need-prompt (if (instance? LineNumberingPushbackReader *in*)
                                #(.atLineStart ^LineNumberingPushbackReader *in*)
                                #(identity true))
                  prompt      repl-prompt
                  flush       flush
                  read        repl-read
                  eval        eval-cljs
                  print       println
                  caught      repl-caught
                  print-no-newline print}
             :as opts}]
  (print "To quit, type: " :cljs/quit)
  (let [ups-deps (cljsc/get-upstream-deps)
        {:keys [analyze-path repl-verbose warn-on-undeclared special-fns static-fns] :as opts
         :or   {warn-on-undeclared true}}
        (assoc (merge (-repl-options repl-env) opts)
          :print print
          :print-no-newline print-no-newline
          :flush flush
          :ups-libs (:libs ups-deps)
          :ups-foreign-libs (:foreign-libs ups-deps))]
    (env/with-compiler-env
     (or (::env/compiler repl-env) (env/default-compiler-env opts))
     (binding [ana/*cljs-ns* 'cljs.user
               *cljs-verbose* repl-verbose
               ana/*cljs-warnings* (assoc ana/*cljs-warnings*
                                     :unprovided warn-on-undeclared
                                     :undeclared-var warn-on-undeclared
                                     :undeclared-ns warn-on-undeclared
                                     :undeclared-ns-form warn-on-undeclared)
               ana/*cljs-static-fns* static-fns
               *repl-opts* opts]
       ;; TODO: the follow should become dead code when the REPL is

  (:import [java.io File PushbackReader FileWriter]
           [java.net URL]
           [javax.xml.bind DatatypeConverter]
           [clojure.lang IExceptionInfo]))

(def ^:dynamic *cljs-verbose* false)
(def ^:dynamic *repl-opts* nil)
