mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
Agregate yylval and yylloc.
* data/lalr1.cc (parser::yylval, parser::yylloc): Replace by... (parser::yyla): this.
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
2008-11-09 Akim Demaille <demaille@gostai.com>
|
||||||
|
|
||||||
|
Agregate yylval and yylloc.
|
||||||
|
* data/lalr1.cc (parser::yylval, parser::yylloc): Replace by...
|
||||||
|
(parser::yyla): this.
|
||||||
|
|
||||||
2008-11-09 Akim Demaille <demaille@gostai.com>
|
2008-11-09 Akim Demaille <demaille@gostai.com>
|
||||||
|
|
||||||
Rely on the state stack to display reduction traces.
|
Rely on the state stack to display reduction traces.
|
||||||
|
|||||||
@@ -817,10 +817,9 @@ b4_percent_code_get[]dnl
|
|||||||
int yynerrs_ = 0;
|
int yynerrs_ = 0;
|
||||||
int yyerrstatus_ = 0;
|
int yyerrstatus_ = 0;
|
||||||
|
|
||||||
/// Semantic value of the lookahead.
|
/// The lookahead symbol.
|
||||||
semantic_type yylval;
|
data_type yyla;
|
||||||
/// Location of the lookahead.
|
|
||||||
location_type yylloc;
|
|
||||||
/// The locations where the error started and ended.
|
/// The locations where the error started and ended.
|
||||||
data_type yyerror_range[2];
|
data_type yyerror_range[2];
|
||||||
|
|
||||||
@@ -833,8 +832,8 @@ b4_percent_code_get[]dnl
|
|||||||
YYCDEBUG << "Starting parse" << std::endl;
|
YYCDEBUG << "Starting parse" << std::endl;
|
||||||
|
|
||||||
]m4_ifdef([b4_initial_action], [
|
]m4_ifdef([b4_initial_action], [
|
||||||
m4_pushdef([b4_at_dollar], [yylloc])dnl
|
m4_pushdef([b4_at_dollar], [yyla.location])dnl
|
||||||
m4_pushdef([b4_dollar_dollar], [yylval])dnl
|
m4_pushdef([b4_dollar_dollar], [yyla.value])dnl
|
||||||
/* User initialization code. */
|
/* User initialization code. */
|
||||||
b4_user_initial_action
|
b4_user_initial_action
|
||||||
m4_popdef([b4_dollar_dollar])dnl
|
m4_popdef([b4_dollar_dollar])dnl
|
||||||
@@ -845,7 +844,7 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
location values to have been already stored, initialize these
|
location values to have been already stored, initialize these
|
||||||
stacks with a primary value. */
|
stacks with a primary value. */
|
||||||
yystack_ = stack_type (0);
|
yystack_ = stack_type (0);
|
||||||
yypush_ (0, yystate, yylval, yylloc);
|
yypush_ (0, yyla.state, yyla.value, yyla.location);
|
||||||
|
|
||||||
// A new state was pushed on the stack.
|
// A new state was pushed on the stack.
|
||||||
// Invariant: yystate == yystack_[0].state, i.e.,
|
// Invariant: yystate == yystack_[0].state, i.e.,
|
||||||
@@ -872,8 +871,8 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
{
|
{
|
||||||
YYCDEBUG << "Reading a token: ";
|
YYCDEBUG << "Reading a token: ";
|
||||||
yychar = ]b4_c_function_call([yylex], [int],
|
yychar = ]b4_c_function_call([yylex], [int],
|
||||||
[[YYSTYPE*], [&yylval]][]dnl
|
[[YYSTYPE*], [&yyla.value]][]dnl
|
||||||
b4_locations_if([, [[location*], [&yylloc]]])dnl
|
b4_locations_if([, [[location*], [&yyla.location]]])dnl
|
||||||
m4_ifdef([b4_lex_param], [, ]b4_lex_param))[;
|
m4_ifdef([b4_lex_param], [, ]b4_lex_param))[;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -887,7 +886,7 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))[;
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
yytoken = yytranslate_ (yychar);
|
yytoken = yytranslate_ (yychar);
|
||||||
YY_SYMBOL_PRINT ("Next token is", yytoken, yylval, yylloc);
|
YY_SYMBOL_PRINT ("Next token is", yytoken, yyla.value, yyla.location);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the proper action on seeing token YYTOKEN is to reduce or to
|
/* If the proper action on seeing token YYTOKEN is to reduce or to
|
||||||
@@ -901,7 +900,7 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))[;
|
|||||||
if (yyn <= 0)
|
if (yyn <= 0)
|
||||||
{
|
{
|
||||||
if (yyn == 0 || yyn == yytable_ninf_)
|
if (yyn == 0 || yyn == yytable_ninf_)
|
||||||
goto yyerrlab;
|
goto yyerrlab;
|
||||||
yyn = -yyn;
|
yyn = -yyn;
|
||||||
goto yyreduce;
|
goto yyreduce;
|
||||||
}
|
}
|
||||||
@@ -915,8 +914,8 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))[;
|
|||||||
--yyerrstatus_;
|
--yyerrstatus_;
|
||||||
|
|
||||||
/* Shift the lookahead token. */
|
/* Shift the lookahead token. */
|
||||||
yystate = yyn;
|
yyla.state = yystate = yyn;
|
||||||
yypush_ ("Shifting", yystate, yylval, yylloc);
|
yypush_ ("Shifting", yyla.state, yyla.value, yyla.location);
|
||||||
goto yynewstate;
|
goto yynewstate;
|
||||||
|
|
||||||
/*-----------------------------------------------------------.
|
/*-----------------------------------------------------------.
|
||||||
@@ -1003,10 +1002,10 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))[;
|
|||||||
if (!yyerrstatus_)
|
if (!yyerrstatus_)
|
||||||
{
|
{
|
||||||
++yynerrs_;
|
++yynerrs_;
|
||||||
error (yylloc, yysyntax_error_ (yystate, yytoken));
|
error (yyla.location, yysyntax_error_ (yystate, yytoken));
|
||||||
}
|
}
|
||||||
|
|
||||||
yyerror_range[0].location = yylloc;
|
yyerror_range[0].location = yyla.location;
|
||||||
if (yyerrstatus_ == 3)
|
if (yyerrstatus_ == 3)
|
||||||
{
|
{
|
||||||
/* If just tried and failed to reuse lookahead token after an
|
/* If just tried and failed to reuse lookahead token after an
|
||||||
@@ -1020,7 +1019,8 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))[;
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
yydestruct_ ("Error: discarding", yytoken, yylval, yylloc);
|
yydestruct_ ("Error: discarding",
|
||||||
|
yytoken, yyla.value, yyla.location);
|
||||||
yychar = yyempty_;
|
yychar = yyempty_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1083,7 +1083,7 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))[;
|
|||||||
YY_STACK_PRINT ();
|
YY_STACK_PRINT ();
|
||||||
}
|
}
|
||||||
|
|
||||||
yyerror_range[1].location = yylloc;
|
yyerror_range[1].location = yyla.location;
|
||||||
YYLLOC_DEFAULT (error_token.location, (yyerror_range - 1), 2);
|
YYLLOC_DEFAULT (error_token.location, (yyerror_range - 1), 2);
|
||||||
|
|
||||||
/* Shift the error token. */
|
/* Shift the error token. */
|
||||||
@@ -1104,7 +1104,8 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))[;
|
|||||||
|
|
||||||
yyreturn:
|
yyreturn:
|
||||||
if (yychar != yyempty_)
|
if (yychar != yyempty_)
|
||||||
yydestruct_ ("Cleanup: discarding lookahead", yytoken, yylval, yylloc);
|
yydestruct_ ("Cleanup: discarding lookahead",
|
||||||
|
yytoken, yyla.value, yyla.location);
|
||||||
|
|
||||||
/* Do not reclaim the symbols of the rule which action triggered
|
/* Do not reclaim the symbols of the rule which action triggered
|
||||||
this YYABORT or YYACCEPT. */
|
this YYABORT or YYACCEPT. */
|
||||||
|
|||||||
Reference in New Issue
Block a user