Skip to content
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

Error recovery only works on "syntax" rules. #2158

Open
PieterOlivier opened this issue Feb 26, 2025 · 0 comments
Open

Error recovery only works on "syntax" rules. #2158

PieterOlivier opened this issue Feb 26, 2025 · 0 comments

Comments

@PieterOlivier
Copy link
Contributor

PieterOlivier commented Feb 26, 2025

The current error recovery implementation can only recover rules at the
context-free (syntax) level. Lexical rules are never recovered.

So for instance given the following syntax:

syntax A = "a" B "a";
syntax B = "b" C "b";
syntax C = "c";

A string like "abXba" can be parsed using error recovery. But if we change the syntax to:

lexical A = "a" B "a";
lexical B = "b" C "b";
lexical C = "c";

Now the same string "abXba" will result in a parse error as error recovery will fail.

Suppose someone creates a grammar with only lexical rules (for instance to have complete control over which layout can occur where), error recovery will not work at all.

Solution
Error recovery should also be able to recover lexical rules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant