Bison is an optional parameter for push and clean analyzer

How to pass one additional parameter (not a minor token of type YYSTYPE ) to the yypush_parse() function?

The parser is really reentrant, but this one additional variable is critical for the thread safety of the application that I need to integrate into my parser (this is a PHP extension, so we are talking about TSRM ).

I can’t just get rid of this parameter, because inside the action code I’m going to call the functions that will generate the AST in a user-accessible form.

I tried to hack YYPUSH_DECLS , and it works before the function declaration, but several thousand LOCs come to the yypush_parse implementation, and I see no way to rewrite where the yypush_parse implementation yypush_parse .

YYPARSE_PARAM used only when the parser is not pushing (as far as I can tell), but in my case I NEED it to be pushing because of what I have to do in the processing loop, after lexing and before adding a new token to the syntax stack analysis.

So I'm wondering if there is %directive or something that might help.

On the other hand, I really think that YYPARSE_PARAM should be used as far as it is defined, regardless of what type of parser it is. It is a pity that this is not so.

+6
source share
1 answer

%parse-param . YYPARSE_PARAM deprecated and should not be used.

0
source

Source: https://habr.com/ru/post/885982/


All Articles