-
Notifications
You must be signed in to change notification settings - Fork 34
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
Strange syntax error only with zero '0' converted to int #88
Comments
I suspect it is the same problem of testing the boolean value of the result and not actually checking if the node was matched. The other issue caused by this behavior is #81 #82 and #84 are trying to fix this issue, but the maintainers are busy right now and unable to review/merge In the meantime you can use values that don't evaluate to @dataclass
class NumberNode:
value: int | float And then create it like |
Also, personally I want to ask you to check if #82 fixes this issue and report about it if possible |
@pablogsal if you have time, it would be nice of you to take a look at the PRs |
For the moment, I edited the loop accepting num:
Fix _loop1_1 by adding is not None :
|
Making a global "fix" in src/pegen/python_generator.py sadly results in 94 newly failing tests. Essentially, my action coercing the strings to integers or floats is the fundamental cause if PEGEN requires that actions always result in a value that is semantically True. My apologies if this is documented somewhere. If not, I would suggest adding it. Thanks |
With this extremely simple grammar "1" succeeds but "0" fails. Can anyone shed light on this issue? Thanks
zero-fails.py
Output
The text was updated successfully, but these errors were encountered: