Hi All,It turned out in the end that it is my fault as I don't generate any 
header files by bison which may then contain the necessary macro definition. 
Nevertheless, I also realized that it's better to return YYUNDEF from yylex 
than triggering YYERROR from an action. This made using YYRECOVERING in yylex 
superfluous. So issue solved :)Best regards,r0ller-------- Eredeti levél 
--------Feladó: r0ller <r0l...@freemail.hu>Dátum: 2025 március 12 
21:54:11Tárgy: Re: YYRECOVERING() in yylex functionCímzett: Nathanael Bracy 
<njbrac...@gmail.com>Hi Nathanael,Unfortunately the project is quite big but I 
want to make a minimal reproducible example for it. Before doing so though, I'd 
like to understand if it makes sense at all to use YYRECOVERING() in yylex. I 
have a rule for each token a validating action which triggers YYERROR if the 
token is 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. 
Thus yylex processes the input and returns the next token (C). Then the action 
set up for error recovery takes place which checks if it's already the end of 
input. The end of input check returns true since token C has been returned by 
yylex in which case I raise YYABORT. That's why I thought, if I could check in 
yylex that YYRECOVERING() is 1 then it could return the previous token not the 
next. However, as I reported, I get a compile time error since YYRECOVERING() 
may have been designed to be used only in actions. I hope I could sum up 
clearly what I'm doing. Nevertheless, I'll try to make a minimal example.Best 
regards,r0ller-------- Eredeti levél --------Feladó: Nathanael Bracy 
<njbrac...@gmail.com>Dátum: 2025 március 12 16:41:07Tárgy: Re: YYRECOVERING() 
in yylex functionCímzett: r0ller <r0l...@freemail.hu>Hi r0llerxCould I see your 
code somewhere? Perhaps you're forgetting to include a header or your linker 
isn't linking against the right objects.On Wed, Mar 12, 2025 at 5:27 AM r0ller 
<r0l...@freemail.hu> wrote:Hi All,I tried to use the YYRECOVERING() macro in my 
implementation of yylex but I get the following error: "error: use of 
undeclared identifier 'yyerrstatus_'"I don't know if it's the intended 
behaviour just wanted to ask (as I think I can work it around to detect 
recovering status).Best regards,r0ller

Reply via email to