mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-11 13:23:04 +00:00
Let the initial-action act on the look-ahead, and use it for the
"initial push" (corresponding to an hypothetical beginning-of-file). And let lalr1.cc honor %initial-action. * doc/bison.texinfo (Initial Action Decl): Clarify, and add an example. * data/lalr1.cc (Parser::initlocation_): Remove, bad experiment. (Parser::Parser): Remove the ctor that used to initialize it. (Parser::parse): Like in the other skeletons, issue the "starting parse" message before any action. Honor %initial-action. Initialize the stacks with the lookahead. * data/yacc.c: Let $$ and @$ in %initial-action designate the look-ahead. Push them in the stacks. * tests/actions.at, tests/calc.at: Adjust the C++ ctor invocations.
This commit is contained in:
@@ -327,7 +327,7 @@ static bool yydebug;
|
||||
int
|
||||
yyparse ()
|
||||
{
|
||||
yy::Parser parser (yydebug, yy::Location ());
|
||||
yy::Parser parser (yydebug);
|
||||
return parser.parse ();
|
||||
}
|
||||
],
|
||||
|
||||
@@ -144,7 +144,7 @@ yy::Parser::error_ ()
|
||||
int
|
||||
yyparse (AT_PARAM_IF([semantic_value *result, int *count]))
|
||||
{
|
||||
yy::Parser parser (!!YYDEBUG[]AT_LOCATION_IF([, yy::Location ()])AT_PARAM_IF([, result, count]));
|
||||
yy::Parser parser (!!YYDEBUG[]AT_PARAM_IF([, result, count]));
|
||||
return parser.parse ();
|
||||
}
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user