           0))
       0)))
 
-(defn- current-alias-map []
-  (let [cur-ns @current-ns]
-    (into {} (remove (fn [[k v]] (= k v)))
-      (merge (get-in @st [::ana/namespaces cur-ns :requires])
-        (get-in @st [::ana/namespaces cur-ns :require-macros])))))
-
-(defn- reader-eof? [msg]
-  (or
-    (= "EOF while reading" msg)
-    (= "EOF while reading string" msg)))
-
-(defn- read-chars
-  [reader]
-  (let [sb (StringBuffer.)]
-    (loop [c (rt/read-char reader)]
-      (if-not (nil? c)
-        (do
-          (.append sb c)
-          (recur (rt/read-char reader)))
-        (str sb)))))
-
-(defn- repl-read-string
-  "Returns a vector of the first read form, and any balance text."
-  [source]
-  (let [reader (rt/string-push-back-reader source)
-        cur-ns @current-ns]
-    (binding [ana/*cljs-ns* cur-ns
-              *ns* (create-ns cur-ns)
-              env/*compiler* st
-              r/*data-readers* tags/*cljs-data-readers*
-              r/resolve-symbol ana/resolve-symbol
-              r/*alias-map* (current-alias-map)]
-      [(r/read {:read-cond :allow :features #{:cljs}} reader) (read-chars reader)])))
+;; --------------------
+;; Brace highlighting
+
+(declare repl-read-string)
 
 (defn- is-completely-readable?
   [source]

           (restore-compiler-state! backup)
           (throw e)))))))

(declare execute execute-source)

(defn- execute-path [filename opts]
  (load {:file filename}
    (fn [{:keys [lang source cache]}]
      (if source
        (execute-source source (merge opts
                                 {:type "text"
                                  :filename filename
                                  :expression? false}))
        (handle-repl-error (ex-info (str "Could not load file " filename) {}))))))

(defn- root-resource
  "Returns the root directory path for a lib"
  [lib]

;; =============================================================================
;; REPL plumbing

;; --------------------
;; Parinfer indentation

(defn- calc-parinfer-opts [text pos]
  (let [x (.lastIndexOf text "\n")]
    #js {:cursorX    (- pos (inc x))
