Replies: 1 comment 1 reply
-
It would be helpful to see your grammar code, because it's not clear to me what the parse error in the first block is, and given that error, what part of the rule is accepting the Your description sounds like the |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there any way to control backtracking in
rust-peg
? Some parsers start with prefixes that disambiguate the following tokens, and I'd like to forcerust-peg
to commit: if the parser fails, don't attempt another parse, but fail upwards. Since it currently fallback to trying another parser, this can cause parse errors to be misleading.As a concrete issue, I have the following failing code:
the error initially tells me to look at the start of the
else
block, but removing the contents of the first branch allows the parser to pass successfully. I feel like I would have gotten a better error if the first{
had committed the parser to successfully parsing a "block" .I've fixed this problem since then, but for reference here was the prior error message:
where
35:3
points to exactly the start of theelse
block.Beta Was this translation helpful? Give feedback.
All reactions