[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Additional Parameter to a Push and Pure Parser
From: |
Flavius Aspra |
Subject: |
Additional Parameter to a Push and Pure Parser |
Date: |
Sat, 16 Apr 2011 10:56:24 +0200 |
User-agent: |
I am harmful. Fear me please :-) Mnenhy/0.7.6.666 |
Hi
How can I pass one aditional parameter (not the token minor of type
YYSTYPE) to the yypush_parse() function?
The parser is indeed reentrant, but this one aditional variable is
crucial for the thread-safety of the application I need to integrate my
parser in (it's a PHP extension, so we're talking about TSRM [1] - it
allows me to create userland-attached variables in the action code).
I cannot just get rid of that parameter because inside the action code
I'm going to call functions which will generate an AST in a
userland-accessible form.
I've tried to hack around YYPUSH_DECLS and it works as far as declaring
the function is concerned, BUT a few thousand LOCs down comes the
implementation of yypush_parse, and I can't see any way to overwrite the
function signature where the implementation of yypush_parse starts.
YYPARSE_PARAM is only used when the parser is not a push one (as far as
I can tell), but in my case I NEED it be push because of the things I
have to do in the processing loop, after lexing and prior to adding a
new token to the parsing stack.
So I am wondering if there's a %directive or something that may help.
On the other side, I really think YYPARSE_PARAM should be used as far as
it's defined, no matter what type of parser it is. It's a pity it's not.
Semantically speaking, the name YYPARSER_PARAM itself suggests that.
Thank you in advance,
Flavius
[1] http://devzone.zend.com/article/1021
--
Flavius Aspra
Student of Informatics | TU Graz
- Additional Parameter to a Push and Pure Parser,
Flavius Aspra <=