-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Unable to parse parenthesized context managers #4145
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
Comments
I tried to change
But LALRPOP is not happy:
|
How about adding optional parenthesis to WithItem? |
This was actually one of the issues that motivated CPython 3.9’s switch from an LL(1) parser to a PEG parser (python/cpython#56991 (comment), PEP 617). See also #2759. |
Woah, good find. |
andersk
added a commit
to andersk/RustPython
that referenced
this issue
Dec 12, 2022
Since the upstream grammar for this is not LALR(1), we abuse LALRPOP macros and the Into/TryInto traits to build a cover grammar that converts to either tuples or `with` items after additional validation. It’s annoying and ugly, but something like this is basically our only option short of switching to a more powerful parser algorithm. Fixes RustPython#4145. Signed-off-by: Anders Kaseorg <andersk@mit.edu>
andersk
added a commit
to andersk/RustPython
that referenced
this issue
Dec 12, 2022
Since the upstream grammar for this is not LR(1), we abuse LALRPOP macros and the Into/TryInto traits to build a cover grammar that converts to either tuples or `with` items after additional validation. It’s annoying and ugly, but something like this is basically our only option short of switching to a more powerful parser algorithm. Fixes RustPython#4145. Signed-off-by: Anders Kaseorg <andersk@mit.edu>
andersk
added a commit
to andersk/RustPython
that referenced
this issue
Dec 12, 2022
Since the upstream grammar for this is not LR(1), we abuse LALRPOP macros and the Into/TryInto traits to build a cover grammar that converts to either tuples or `with` items after additional validation. It’s annoying and ugly, but something like this is basically our only option short of switching to a more powerful parser algorithm. Fixes RustPython#4145. Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
In RustPython, this fails to parse:
...with:
The text was updated successfully, but these errors were encountered: