How to recover from parser error? #1792
Replies: 1 comment 4 replies
-
Hey @durianwaffle, without diving to deep into parsing theory: There are some kinds of parser errors that are hard to recover from, due to the way how recursive descent parsers work. You're encountering one because the parser fails to perform its lookahead function, which in turn prevents the parser from identifying which rule to parse. Usually, the parser then attempts to skip tokens to recover from this error, but this doesn't always work.
I don't think that's possible, at least not to my knowledge. I would assume that even if you were able to define such a rule, you would likely run into unexpected side effects. |
Beta Was this translation helpful? Give feedback.
-
In our grammar, if there is parser error such as a random string without semicolon, the validator will fail for the current document.
Any solution on that?
Can I define a rule to parse the random strings in the grammar? If so, how should define this rule?
Beta Was this translation helpful? Give feedback.
All reactions