Grammar-Kit icon indicating copy to clipboard operation
Grammar-Kit copied to clipboard

Consider implementing recoverWhile=auto|custom key

Open hurricup opened this issue 9 years ago • 3 comments

Grammar-Kit context help shows section "Followed by" with list of tokens and rules that can be after particular rule according to the grammar. You could use these tokens for auto-generating base recovery rule with possible custom tokens (rule), like:

// user puts
some_rule ::= ....  {recoverWhile=auto|custom_recovery_appendix}

// and parser using following rule (not generating it in bnf)
auto_generated_recover_rule ::= !(auto_calculated_tokens|custom_recovery_appendix)

or make a macro for it, like:

recovery_rule ::= !({AUTO_TOKENS}|..whatever user puts..)

and expand this macro on compilation phase.

Currently we can use context help to generate recovery sets, but each time grammar changes - all rules should be updated.

hurricup avatar Oct 25 '16 14:10 hurricup

seems 'followed by' tokens calculated incorrectly. Or in strange way.

hurricup avatar Oct 26 '16 07:10 hurricup

"seems 'followed by' tokens calculated incorrectly. Or in strange way."

How so? Do you have any examples of what you are expecting and what you are getting?

calexHG avatar Oct 26 '16 11:10 calexHG

This comment suggests that you can already write recoverWhile="#auto". However, I haven't tested it, and maybe it is outdated.

JojOatXGME avatar Feb 06 '21 13:02 JojOatXGME