Please sign in to comment.
CLJS-1572: REPL doesn't give error for expressions with too many righ…
…t parentheses. Take extra care to preserve the state of *in* so that anything beyond the first form remains for reading. This fundamentally makes the ClojureScript REPL behave like the Clojure REPL. In particular, it allows entering multiple forms on a single line (which will be evaluated serially). It also means that if malformed input lies beyond the initial form, it will be read and will cause an exception (just like in the Clojure REPL). The bulk of the complexity in this commit has to do with the case where a new line-numbering reader is established, so that errors in forms can be associated with line numbers, starting with line 1 being the first line of the form. This requires a little extra handling because the source-logging-push-back-reader introduces an extra 1-character buffer which must be transferred back to the original (pre-bound) *in*, otherwise things like an unmatched extra paren right after a well-formed form won't be detected (as the paren would be in the 1-char buffer and discarded.) Also, a Java PushbackReader needs to be eliminated, as it causes things to fail to behave like the Clojure REPL.
- Loading branch information...