-
-
Notifications
You must be signed in to change notification settings - Fork 412
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 doesn't take into account goal symbols #294
Comments
I'll work on fixing this. Ideally, this should be fixed before Boa 0.7. |
After some debugging the error seems to be coming form: 1 / a === 1 / b Checking the token stream:
It seems to be a lexer bug not a parser one. It lexes Hope that helps. :) |
Good find! |
Do we need to refactor the lexer now? 😂 |
I'm not exactly sure what the lexer is supposed to do in this situation, since |
we probably need a context aware lexer or something like that. any thoughts? |
hmmm interesting. We could maybe check what token can precede a regex? and see if the previous token is one of those? |
I also removed an unused function in the parser and added a test for #294, currently ignored.
I'm sure the Lexer is context aware in some places, so it shouldn't be too hard to see what's before it and work it out based on that. Basically what @Razican said |
There seems to be some information on context-aware lexical grammar in the spec. I will review this today and see if I can improve the lexer. |
https://v8.dev/blog/understanding-ecmascript-part-3 |
Reading this, it seems that the parser needs to call the lexer, and we cannot have a full list of tokens before calling the parser. So this clearly needs a rewrite in the way the parser/lexer work together. I would say we can release version 0.7 with this known limitation, and we can work on this later. I'm still working on the parser modularization, which I think it's a good point to start. I think that String interning would also help with this, as we could maybe have |
I also removed an unused function in the parser and added a test for #294, currently ignored.
Getting the code from the
harness/assert.js
file in the test262 suite, this fails to parse:With the error:
Interestingly, the error is given in column 24 (marked here):
But I'm guessing the issue is with the last
b
. I think this is a regression, since this particular file parsed fine before the rewrite, but it might have been something new in the file. Once fixed, we need to add a test for it.The text was updated successfully, but these errors were encountered: