Re: YYRECOVERING() in yylex function
r0ller <[email protected]> Wed, 12 Mar 2025 20:54:12 +0000 (GMT)
| Newsgroups | gmane.comp.parsers.bison.general |
|---|---|
| Message-ID | <[email protected]> |
Hi Nathanael,Unfortunately the project is quite big but I want to make a mi= nimal reproducible example for it. Before doing so though, I'd like to unde= rstand if it makes sense at all to use YYRECOVERING() in yylex. I have a ru= le for each token a validating action which triggers YYERROR if the token i= s invalid. The issue I noticed is that e.g. for the input A B C where token= B is invalid, YYERROR is triggered after which yylex is called by bison. T= hus yylex processes the input and returns the next token (C). Then the acti= on set up for error recovery takes place which checks if it's already the e= nd of input. The end of input check returns true since token C has been ret= urned by yylex in which case I raise YYABORT. That's why I thought, if I co= uld check in yylex that YYRECOVERING() is 1 then it could return the previo= us token not the next. However, as I reported, I get a compile time error s= ince YYRECOVERING() may have been designed to be used only in actions. I ho= pe I could sum up clearly what I'm doing. Nevertheless, I'll try to make a = minimal example.Best regards,r0ller-------- Eredeti lev=C3=A9l --------Fela= d=C3=B3: Nathanael Bracy <[email protected]>D=C3=A1tum: 2025 m=C3=A1rcius= 12 16:41:07T=C3=A1rgy: Re: YYRECOVERING() in yylex functionC=C3=ADmzett: r= 0ller <[email protected]>Hi r0llerxCould I see your code somewhere? Perhap= s you're forgetting to include a header or your linker isn't linking agains= t the right objects.On Wed, Mar 12, 2025 at 5:27=E2=80=AFAM r0ller <r0ller@= freemail.hu> wrote:Hi All,I tried to use the YYRECOVERING() macro in my imp= lementation of yylex but I get the following error: "error: use of undeclar= ed identifier 'yyerrstatus_'"I don't know if it's the intended behaviour ju= st wanted to ask (as I think I can work it around to detect recovering stat= us).Best regards,r0ller