REPL should raise Exception immediately when it gets naturally invalid multi-line.
I'm using v5.0.0 on Windows.
Of course this is invalid as javascript:
a = 3.5e
-5;
console.log(a);
But REPL enters multi-line editting mode:
> a = 3.5e
...
...
... .break
We have no way to exit from the mode except .break (or Ctrl-C), and .break will make nothing.
confirmed the bug is present in all versions
This particular case is not trivial to fix. REPL goes in multi-line mode because the first line generates a "Unexpected token ILLEGAL" error, which can happen in recoverable cases. See https://github.com/nodejs/node-v0.x-archive/pull/8875.
I think it should be fixable, we should just do extra checks for ; which I feel most people will try to use as a line-ending break-out in this case. Either that or make two enter's break out. Or both.
Fwiw, you can also break out by:
- Typing a
'or", which will trigger a syntax error. - Typing just
., which will register as an invalid repl command.
I think it should be fixable
Good news.
;which I feel most people will try to use as a line-ending break-out in this case
I think so. I tried it actually.
Either that or make two enter's break out.
I hope this solution if we have no valid two enters.
Typing a ' or ", which will trigger a syntax error. Typing just ., which will register as an invalid repl command.
Ah, thatβs true. And I noticed typing backslash will trigger a syntax error also.
Proposed fix: https://github.com/nodejs/node/pull/7104
#7104 landed so this should be fixed in the next 6.x release (which will be either 6.2.2 or 6.3.0).