-
Notifications
You must be signed in to change notification settings - Fork 202
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
unexpected token kDO #447
Comments
@iliabylich I think you broke it, can you take a look? |
@whitequark Sure, I'll check it today |
@whitequark The code
It does MRI handles it by doing a lookahead here. It shuffles 1 and 0 in this case. So the question is: how can we make the same lookahead from the parser? I see two solutions (and I don't like both of them):
What do you think? EDIT: ignore it, next tokens are already processed by lookahead. |
Is there a way to get a lookahead char like |
Sure, use |
@whitequark In the parser, not in the lexer. racc does lookahead, is it possible to get that token? |
Not sure, maybe |
There's no such ivar (and no ivars with tokens at all). I've implemented a naive approach in #448, but I expected racc to have something similar to |
Ah, that's only present in the pure-Ruby racc runtime, then. |
I pulled in newest version and this is still an issue. Looking at the commit it seems like it only dealt with ruby 2.4 and 2.5. 2.2 and 2.3 wasn't fixed, I think. |
@whitequark old parsers still use lexpop and all of them have a bug with wrong cmdarg value on command args handling ( |
Sorry, I was a bit wrong in my previous comment, cmdarg is (sometimes) invalid for 18..23, but it's fine. Lexer always does
But I guess backporting proper cmdarg handling to parsers < 24 and removing lexpop is better, isn't it? (less branching and the logic becomes simpler) |
You've already introduced 2 (or more, I didn't count) bugs in the latest parser related to this, what's to guarantee that this simplification wouldn't introduce more? Non-latest-version parsers don't get as much user testing and clearly this isn't covered by our test suite so I am not convinced this should be backported. |
With 2.5 release there seems to be a bug:
The text was updated successfully, but these errors were encountered: