-
-
Notifications
You must be signed in to change notification settings - Fork 399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The lexer might create invalid spans #771
Comments
I can take a look at this. |
Simpler repro:
|
Problematic code is Interestingly, node 14.5.0 appears to treat $ echo "1invalid" | node
[stdin]:1
1invalid
^
SyntaxError: Invalid or unexpected token
$ echo "1\rinvalid" | node
[stdin]:2
invalid
^
ReferenceError: invalid is not defined
at [stdin]:2:1
$ echo "1\r\ninvalid" | node
[stdin]:2
invalid
^
ReferenceError: invalid is not defined
at [stdin]:2:1
$ echo "1\n\rinvalid" | node
[stdin]:3
invalid
^
ReferenceError: invalid is not defined
at [stdin]:3:1
Might be trying to recognize (very) old Mac OS 9 line endings, which only used CR (https://en.wikipedia.org/wiki/Newline#Unicode). Seems reasonable to follow that -- we can peek ahead in |
Describe the bug
Expected an Error, not a panic.
To Reproduce
Can be reproduced with this program
Expected behavior
An Error, not a panic
Build environment (please complete the following information):
Additional context
Full stacktrace:
The text was updated successfully, but these errors were encountered: