Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Unexpected token SyntaxError doesn't trigger multi-line input anymore #8874

Closed
misterdjules opened this issue Dec 15, 2014 · 1 comment
Closed
Assignees

Comments

@misterdjules
Copy link

With node 0.10.x, it is possible to trigger multi-line input with an 'Unexpected token' syntax error:

$ node --version
v0.10.33
$ node
> var foo = 'foo \
... bar';
undefined
> foo
'foo bar'
> 

I'm not sure this is a desirable feature, since it also triggers multi-line input on 'Unexpected token' syntax errors from which it seems impossible to recover:

> % foo
...

However, the behavior is different with node 0.11.x. An 'Unexpected token' syntax error doesn't trigger multi-line input anymore, and instead the SyntaxError bubbles up:

$ ./node --version
v0.11.15-pre
$ ./node          
> var foo = 'foo \
SyntaxError: Unexpected token ILLEGAL
    at Object.exports.createScript (vm.js:44:10)
    at REPLServer.defaultEval (repl.js:117:23)
    at bound (domain.js:254:14)
    at REPLServer.runBound [as eval] (domain.js:267:12)
    at REPLServer.<anonymous> (repl.js:279:12)
    at REPLServer.emit (events.js:107:17)
    at REPLServer.Interface._onLine (readline.js:213:10)
    at REPLServer.Interface._line (readline.js:552:8)
    at REPLServer.Interface._ttyWrite (readline.js:829:14)
    at ReadStream.onkeypress (readline.js:108:10)
>

The original commit that broke this behavior is 9ef9a9d. It also seems that b517500 was an attempt to bring this back.

@misterdjules misterdjules self-assigned this Dec 15, 2014
@misterdjules misterdjules changed the title SyntaxError doesn't trigger multi-line input anymore Unexpected token SyntaxError doesn't trigger multi-line input anymore Dec 15, 2014
misterdjules pushed a commit to misterdjules/node that referenced this issue Dec 15, 2014
Fix the regexp used to detect 'Unexpected token' errors so that they can
be considered as recoverable. This fixes the following use case:

> var foo = 'bar \
... baz';
undefined
> foo
'bar baz'
>

Fixes nodejs#8874
misterdjules pushed a commit to misterdjules/node that referenced this issue May 11, 2015
Fix the regexp used to detect 'Unexpected token' errors so that they can
be considered as recoverable. This fixes the following use case:

> var foo = 'bar \
... baz';
undefined
> foo
'bar baz'
>

Fixes nodejs#8874
misterdjules pushed a commit that referenced this issue May 13, 2015
Fix the regexp used to detect 'Unexpected token' errors so that they can
be considered as recoverable. This fixes the following use case:

> var foo = 'bar \
... baz';
undefined
> foo
'bar baz'
>

Fixes #8874

Reviewed-By: Colin Ihrig <[email protected]>
PR-URL: #8875
@misterdjules
Copy link
Author

Fixed by 101e103.

misterdjules pushed a commit to nodejs/node that referenced this issue Jun 25, 2015
Fix the regexp used to detect 'Unexpected token' errors so that they can
be considered as recoverable. This fixes the following use case:

> var foo = 'bar \
... baz';
undefined
> foo
'bar baz'
>

Fixes: nodejs/node-v0.x-archive#8874
PR-URL: nodejs/node-v0.x-archive#8875
PR-URL: #2052
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
mscdex pushed a commit to mscdex/io.js that referenced this issue Jul 9, 2015
Fix the regexp used to detect 'Unexpected token' errors so that they can
be considered as recoverable. This fixes the following use case:

> var foo = 'bar \
... baz';
undefined
> foo
'bar baz'
>

Fixes: nodejs/node-v0.x-archive#8874
PR-URL: nodejs/node-v0.x-archive#8875
PR-URL: nodejs#2052
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants