(defn
read-regex
[rdr ch opts pending-forms]
(let
[sb (StringBuffer.)]
(loop
[ch (read-char rdr)]
(if
(identical? \" ch)
(re-pattern (str sb))
(if
(nil? ch)
(err/throw-eof-reading rdr :regex sb)
(do
(.append sb ch)
(when
(identical? \\ ch)
(let
[ch (read-char rdr)]
(if (nil? ch) (err/throw-eof-reading rdr :regex sb))
(.append sb ch)))
(recur (read-char rdr))))))))