Re: yypcontext_expected_tokens does not list optional components in grammar
Hans Ã…berg <[email protected]> Thu, 4 Dec 2025 09:50:42 +0100
| Newsgroups | gmane.comp.parsers.bison.general |
|---|---|
| Message-ID | <[email protected]> |
> On 3 Dec 2025, at 22:31, Jan K. <[email protected]> wrote: >=20 > I'm trying to use the yyreport_syntax_error function to report syntax > errors in a grammar that has some optional components. In such case > the yypcontext_expected_tokens does not list the optional components > among the expected. How can I make it do that? 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. See the section 5.8 =E2=80=9CTuning LR=E2=80=9D in the Bison manual. The = command is %define lr.type type where type is one of lalr, ielr, canonical-lr, the first is the default.