Is it possible to declare variable in a re-entrant parser ?

Normally this is not an issue with non recursive parser; one can add global
variable into the
code with %{ .. %} ; initialization of variable can be added by
%initial-action { .. }

but adding new non global variables can't be done with for recursive parser.
%initial-action can't be used for that purpose.

Meanwhile I managed to work around by means of magic sed; the re-entrant
parser has the comment
/* The lookahead symbol */ at the start of the parser function.

sed -e "s/\/\* The lookahead symbol\.  \*\//$CODE/" pars.c >pars.txt.temp
mv -f pars.txt.temp pars.c

This solution is ugly and also adds dependency on the template used.

Is is possible to add a directive similar to initial-action that adds
declaration as is to the start of the parser function ?
_______________________________________________
help-bison@gnu.org https://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to