mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 04:13:03 +00:00
The previous fix does not suffice, and actually managed to make things worse by defining yyscan_t twice in parse.y... Reported by kencu. https://trac.macports.org/ticket/59927#comment:29 * examples/c/reccalc/parse.y (yyscan_t): Define it with the same guards as used by Flex.
reccalc - recursive calculator with Flex and Bison
In this example the generated parser is pure and reentrant: it can be used concurrently in different threads, or recursively. As a proof of this reentrancy, expressions in parenthesis are tokenized as strings, and then recursively parsed from the parser:
exp: STR
{
result r = parse_string ($1);
free ($1);
if (r.nerrs)
{
res->nerrs += r.nerrs;
YYERROR;
}
else
$$ = r.value;
}