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
Parse actions skipped inside delimited_list #345
Comments
|
Try using the pyparsing debugging decorator
|
Nice, thanks! I'm sure the
|
Great! Lastly, could you post the output from before the bug occurred? So I can see the expected results and how they differ. |
Sure, this is from the
Note the trace actions for
and how the literal values are wrapped in |
Yes, the culprit is the embedded call to streamline(), which can modify the contents of an And expression. I will fix this in 3.0.7. In the meantime, you can workaround this bug by moving the |
We ran into the following pyparsing bug: pyparsing/pyparsing#345 After some bisecting it turned out it's only present in pyparsing 3.0.5-6, and the pyparsing folks were quick to fix it for 3.0.7. Exclude the broken versions from install_requires.
Thanks for the quick resolution! |
Hello,
I'm not sure if this is a bona-fide bug, or if I'm misusing pyparsing :-)
I have a huge pyparsing grammar for ASN.1 syntax over in https://github.com/kimgr/asn1ate/blob/master/asn1ate/parser.py. The repro below is not minimal. but uses some techniques from asn1ate's parser to demonstrate what I'm trying to do:
The concrete problem I'm seeing downstream is that a parse action intended to decorate the parse result with a type name is never called, and so later stages can't use the annotation to identify what kind of element it is.
I think the issue is that
delimited_list
now mutates the expression by calling itsstreamline
method: 9987004#diff-daba53cec7bed1be7b180ee5e8378c772408d07afe6f2cad6d62e966993b9e45L38.I haven't fully gotten my head around what
streamline
is supposed to do, but it seems to reduce the result to a literal value, skipping over any interim rules and parse actions.Is that a bug? Or is there a way to phrase the grammar in a way that it works with both old and new pyparsing?
Thanks!
The text was updated successfully, but these errors were encountered: