-
Notifications
You must be signed in to change notification settings - Fork 201
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
Recovery Re-Sync logic ignores Token Categories #1055
Comments
Edit: Nevermind, I think the problem was something else and also maybe I misunderstood how the recovery is supposed to work*, but, I got things working again and recovering how I wanted. The following workaround works but is very wordy since DEF must be written twice. // $.MANY_SEP({ SEP: OPERATOR_AND, DEF })
$.OR([
{
GATE: () => $.LA(2).tokenType === SYM_AND,
ALT: () => $.MANY_SEP({ SEP: SYM_AND, DEF }),
},
{
GATE: () => $.LA(2).tokenType !== SYM_AND,
ALT: () => $.MANY_SEP2({ SEP: WORD_AND, DEF2 })
},
]) Is there any danger in just using js control flows like this if it seems to work? if ($.LA(2).tokenType === SYM_AND) {
$.MANY_SEP({ SEP: SYM_AND, DEF })
} else {
$.MANY_SEP({ SEP: WORD_AND, DEF })
} |
I am writing an XML-like parser where I need some recovery for something like |
Priorities / not affecting my use cases so much / leaving some easy to fix items for contributors / ...
Yeah, that sounds like an improvement for one of the big (and somewhat unique) features of fault tolerance. |
Chevrotain is really a nice project and makes my life so much easier as I create a quite complex medical template language (planned to be released later this year under an Open Source license). I also create the complete tooling around it (language service with Monaco and VS Code integration). So along the way, I will see where I can contribute. |
Awesome 👍 |
It seems the
tokenMatcher
function is not used which meansthe token categories are not handled properly.
Example:
Possibly also affects this:
This may cause the Parser to re-sync (throw out) more input than needed to recover.
The text was updated successfully, but these errors were encountered: