Re: yypcontext_expected_tokens does not list optional components in grammar
Jan Kończak <[email protected]> Thu, 04 Dec 2025 21:28:43 +0100
| Newsgroups | gmane.comp.parsers.bison.general |
|---|---|
| Organization | Institute of Computing Science, Poznań University of Technology |
| Message-ID | <3922443.kQq0lBPeGt@imladris> |
> It could be that using a parser based on IELR or LR fixes it. The default > is LALR, which does not always see the error tokens immediately, but may > perform some reductions first. Thanks for the pointers, it really did help me to find the right solution. While switching to LR parser indeed yielded expected results in the example, I believe the thing that I was missing was enabling 'Lookahead Correction' by the '%define parse.lac full' directive, which is in the manual section that you mentioned. Having that, yypcontext_expected_tokens provides me with complete list of expected tokens regardless of 'lr.type'. Regards, Jan