-
Notifications
You must be signed in to change notification settings - Fork 49
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
Need to process win32 line break correctly #146
Comments
It seems our code didn't handle LineContinuation inside string literal at all, the successful pass on |
I did not see you handle LineContinuation in that escaya code either. |
A LineContinuation is |
Thx, so it's not an accident. Just a missing case on BTW, it seems test262-parser-tests are being maintained poorly, many unanswered issues. |
The LineContinuation supports http://www.ecma-international.org/ecma-262/11.0/index.html#prod-LineTerminatorSequence |
test262-parser-tests is no good. Either try the real test suite or look into https://github.com/v8/v8/blob/master/test/cctest/test-parsing.cc for some edge cases etc LS and PS are now allowed in string literals, but If you read what I wrote in my last comment on how to grab the empty code point, it can be done the same for the sequence
The tricky part is for this cases |
@3cp I made it just now. https://gist.github.com/KFlash/a8452b70d3596e0f79a2b8d9b3288047 |
I'm trying to give some "super powers" to the gist I linked too so this can be solved once for all. Give me 30 min. |
Done! https://gist.github.com/KFlash/a8452b70d3596e0f79a2b8d9b3288047 Taken from the top of my head, so didn't run any tests against this, but it should work |
@3cp In my gist the cases should be ordered 0, 1, 2 , and you can |
Updated the gist and added escape char scanning. I tweaked it, but you still need to "adjust". I think this should solve this issue |
Any reason you write these? export function scanString(parser: ParserState, cp: number): Token {
parser.pos++;
let quote = cp; Instead of keeping existing param name quote? export function scanString(parser: ParserState, quote: number): Token {
parser.pos++;
let cp = quote; |
No reason. I just tried to avoid assigning of the variable inside the loop. Costs memory. It was all done fast and without too much thinking. |
It turns out a very small bug in existing code, it was sitting there because of missing test coverage. |
I noticed we skipped lots of test files in test262-parser-tests, I tried to unblock them to see what happens.
For example the first skipped file:
meriyah/test/test262-parser-tests/parser-tests.ts
Line 9 in 756d990
The 110fa1efdd0868b8.js file contents is
But the file is using
win32
line break\r\n
which causes issue in meriyah.The text was updated successfully, but these errors were encountered: