-
-
Notifications
You must be signed in to change notification settings - Fork 265
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
Bug: Non-matching rule changes parsing result #338
Comments
Looking into this right now. There is a debugger PR #277, but it would need to be rebased in order to work with your branch of pest. |
Also, really nice minimal example! 👍 |
The difference is the content of the stack. In
while in
Haven't yet figured out why this happens, though. On it. |
I have one non-related bug: restoration doesn't take The issue here seems to be cause by the stack being restored to an earlier state than it should be. |
OK! If you’re on it, that’s great. Unrelatedly: Do you have comment to the PEEK[..] PR? I wrote some things here but never got an answer |
I read your comments but was a bit caught up the last few days. I'll get right to that once we figure out what the issue here is! |
OK, great! Sorry for being pushy 😅 |
No worries! Really excited to see rST grammar ready. Your project seems to be the most comprehensive use of pest grammars until now! |
This bug is pretty hard to figure out. When you wrap it up in an extra Update: It seems like actually
Redefining |
Found the bug. Damn, this was quite hard to debug, but the issue is pretty clear. Will write a PR once I know for sure that the fix is correct. |
Great news, thank you very much! Maybe you should also mention what made debugging hard while the memory is fresh. It might help to improve the debugging story down the line. |
Due to a probably a premature optimization, pest's Stack snapshotting was trying to optimize pushing to a Vec only when the Stack had been optimized. This led to a bug caused by nested snapshot-restores without Stack changes in between them. Fixes #338.
The issue was simply the complexity of the grammar and the fact that Rust debugging is very immature. I it was really hard to read bracktraces provided by |
I created a test repo: https://github.com/flying-sheep/pest-bug
It contains two almost identical grammars and a test for each that checks if the parse tree matches my expectations. One of them doesn’t, while it really should. Check out the two grammars: They only differ in that one I use
title = {a|b}; block = {title|…}
and in the other I useblock = {a|b|…}
. The two grammars should function exactly equal!It may be a problem with stack checkpoints but I’m not sure… pest grammars aren’t very debuggable.
If none of you can find out what’s wrong: How can I debug this?
This is the difference between the grammars:
This is the document I parse:
this is the parse tree I expect:
The text was updated successfully, but these errors were encountered: