-
Notifications
You must be signed in to change notification settings - Fork 55
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
incorrect behavior when parsing unordered group in clean PEG #43
Comments
Here's a unit test that shows the problem and how to fix it for a single line by re-ordering the grammar. I hope that fix helps to identify the problem. Just rename back to python extension. |
Thanks for reporting. I've verified it. It is a bug that seems to affect only cleanpeg notation. |
Backward incompatible change. Line comments changed from `# ...` to `//...`.
The problem was a conflict between unordered group operator symbol |
or group operator can be double # like ## or any other operator not used yet..like ~, ^ etc '#' is good operator for comment ..my thought :) |
Yeah, we could change it but that would be backward incompatible change that is harder to trace down in complex grammars, and it would make cleanpeg syntax more different from regular peg which is a bad thing IMHO. This change in comment makes cleanpeg actually more similar to regular peg while not reducing readability of cleanpeg. textX also uses Anyway, Arpeggio makes it relatively easy to make your own grammar language notation by following how it is done for peg/cleanpeg :) |
Okay, Yea agreed! |
That fix passes my unit test and in my project. (FYI - the version is still at 1.7.1) Thanks! |
The unordered group will not be parsed correctly in a multi-line grammar unless a backslash is the last character on the line in the grammar.
This is how you would expect to write the grammar (no backslash):
This incorrectly throws an exception: arpeggio.NoMatch: Expected 'a' at position (1, 4) => ' { *b a } '.
This example adds a backslash as the last char in the line fixes the parsing:
This correctly prints: { | b | a | }
I'm using Arpeggio 1.7.1 installed from pip under Python 2.7 in Windows.
The text was updated successfully, but these errors were encountered: