             [cljs.closure :as cljsc]
             [cljs.source-map :as sm])
   (:import [java.io File PushbackReader]
+           [java.net URL]
            [javax.xml.bind DatatypeConverter]))
 
 (def ^:dynamic *cljs-verbose* false)

    (println (:value ret))
    (when-let [st (:stacktrace ret)]
      (if (and (true? (:source-map opts))
               (vector? st))
        (print-mapped-stacktrace st opts)
        (println st))
      (flush))))


;; CLJS Specifics

(defprotocol IReplEnvOptions
  (-repl-options [repl-env] "Return default REPL options for a REPL Env"))

(defprotocol IJavaScriptEnv
  (-setup [repl-env opts] "initialize the environment")
  (-evaluate [repl-env filename line js] "evaluate a javascript string")
  (-load [repl-env provides url] "load code at url into the environment")
  (-tear-down [repl-env] "dispose of the environment"))

(extend-type
  Object
  IReplEnvOptions
  (-repl-options [_] nil))

(defprotocol IParseStacktrace
  (-parse-stacktrace [repl-env stacktrace build-options]
    "Given the original JavaScript stacktrace string and current compiler build
     options, parse the stacktrace into the canonical form:

     [{:file <string>
       :function <string>
       :line <integer>
       :column <integer>}*]

     :file must be a URL path (without protocol) relative to :output-dir."))

(defn- env->opts
  "Returns a hash-map containing all of the entries in [repl-env], translating
