mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
glr2.cc: get rid of the macros wrapping the lookahead
In glr.c, the macros yychar, yylval and yylloc allow to deal with api.pure: sometimes they point to global variables (impure), sometimes they point to the member variables (pure). There's no room for globals in glr2.cc. Besides, they map yychar to yyrawchar, yylval to yyval, etc. which obfuscates what is actually going on. * data/skeletons/glr2.cc (glr_stack::yyval, glr_stack::yyloc): Rename as... (glr_stack::yylval, glr_stack::yylloc): these, for clarity. (yynerrs, yychar, yylval, yylloc, yystackp): Remove these macros. (b4_yygetToken_call): Remove.
This commit is contained in:
@@ -37,7 +37,7 @@ m4_define([b4_parse_param_orig], m4_defn([b4_parse_param]))
|
|||||||
|
|
||||||
# Hijack the initial action to initialize the locations.
|
# Hijack the initial action to initialize the locations.
|
||||||
]b4_bison_locations_if([m4_define([b4_initial_action],
|
]b4_bison_locations_if([m4_define([b4_initial_action],
|
||||||
[yylloc.initialize ();]m4_ifdef([b4_initial_action], [
|
[yystackp->yylloc.initialize ();]m4_ifdef([b4_initial_action], [
|
||||||
m4_defn([b4_initial_action])]))])[
|
m4_defn([b4_initial_action])]))])[
|
||||||
|
|
||||||
]m4_define([b4_define_symbol_kind],
|
]m4_define([b4_define_symbol_kind],
|
||||||
@@ -130,8 +130,8 @@ m4_define([b4_lex],
|
|||||||
[b4_function_call([yylex],
|
[b4_function_call([yylex],
|
||||||
[symbol_type], m4_ifdef([b4_lex_param], b4_lex_param))],
|
[symbol_type], m4_ifdef([b4_lex_param], b4_lex_param))],
|
||||||
[b4_function_call([yylex], [int],
|
[b4_function_call([yylex], [int],
|
||||||
[b4_api_PREFIX[STYPE*], [&yylval]][]dnl
|
[b4_api_PREFIX[STYPE*], [&yystackp->yylval]][]dnl
|
||||||
b4_locations_if([, [[location*], [&yylloc]]])dnl
|
b4_locations_if([, [[location*], [&yystackp->yylloc]]])dnl
|
||||||
m4_ifdef([b4_lex_param], [, ]b4_lex_param))])])
|
m4_ifdef([b4_lex_param], [, ]b4_lex_param))])])
|
||||||
|
|
||||||
|
|
||||||
@@ -575,21 +575,6 @@ dnl We probably ought to introduce a type for confl.
|
|||||||
# define YYRHSLOC(Rhs, K) ((Rhs)[K].getState().yyloc)
|
# define YYRHSLOC(Rhs, K) ((Rhs)[K].getState().yyloc)
|
||||||
]])[
|
]])[
|
||||||
|
|
||||||
#undef yynerrs
|
|
||||||
#define yynerrs (yystackp->yyerrcnt)
|
|
||||||
#undef yychar
|
|
||||||
#define yychar (yystackp->yyrawchar)
|
|
||||||
#undef yylval
|
|
||||||
#define yylval (yystackp->yyval)
|
|
||||||
#undef yylloc
|
|
||||||
#define yylloc (yystackp->yyloc)
|
|
||||||
|
|
||||||
]m4_if(b4_prefix[], [yy], [],
|
|
||||||
[[#define ]b4_prefix[nerrs yynerrs
|
|
||||||
#define ]b4_prefix[char yychar
|
|
||||||
#define ]b4_prefix[lval yylval
|
|
||||||
#define ]b4_prefix[lloc yylloc]])[
|
|
||||||
|
|
||||||
enum YYRESULTTAG { yyok, yyaccept, yyabort, yyerr };
|
enum YYRESULTTAG { yyok, yyaccept, yyabort, yyerr };
|
||||||
|
|
||||||
#define YYCHK(YYE) \
|
#define YYCHK(YYE) \
|
||||||
@@ -683,9 +668,6 @@ state_set_index create_state_set_index(std::ptrdiff_t value) {
|
|||||||
#define yytable_value_is_error(Yytable_value) \
|
#define yytable_value_is_error(Yytable_value) \
|
||||||
]b4_table_value_equals([[table]], [[Yytable_value]], [b4_table_ninf], [YYTABLE_NINF])[
|
]b4_table_value_equals([[table]], [[Yytable_value]], [b4_table_ninf], [YYTABLE_NINF])[
|
||||||
|
|
||||||
]m4_define([b4_yygetToken_call],
|
|
||||||
[[yygetToken (yychar, yyparser, yystackp]b4_user_args[)]])[
|
|
||||||
|
|
||||||
static inline yysymbol_kind_t
|
static inline yysymbol_kind_t
|
||||||
yygetToken (int& yycharp, ]b4_namespace_ref[::]b4_parser_class[& yyparser, glr_stack* yystackp]b4_user_formals[);
|
yygetToken (int& yycharp, ]b4_namespace_ref[::]b4_parser_class[& yyparser, glr_stack* yystackp]b4_user_formals[);
|
||||||
|
|
||||||
@@ -1906,7 +1888,6 @@ public:
|
|||||||
#undef YYFILL
|
#undef YYFILL
|
||||||
#define YYFILL(N) yystateStack.yyfill (yyvsp, yylow, (N), yynormal)
|
#define YYFILL(N) yystateStack.yyfill (yyvsp, yylow, (N), yynormal)
|
||||||
|
|
||||||
#define yystackp this
|
|
||||||
class glr_stack
|
class glr_stack
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -1923,9 +1904,9 @@ public:
|
|||||||
|
|
||||||
~glr_stack ()
|
~glr_stack ()
|
||||||
{
|
{
|
||||||
if (yychar != ]b4_namespace_ref::b4_parser_class::token::b4_symbol(empty, id)[)
|
if (this->yyrawchar != ]b4_namespace_ref::b4_parser_class::token::b4_symbol(empty, id)[)
|
||||||
yyparser.yy_destroy_ ("Cleanup: discarding lookahead",
|
yyparser.yy_destroy_ ("Cleanup: discarding lookahead",
|
||||||
YYTRANSLATE (yychar), &yylval]b4_locations_if([, &yylloc])[);
|
YYTRANSLATE (this->yyrawchar), &this->yylval]b4_locations_if([, &this->yylloc])[);
|
||||||
popall_ ();
|
popall_ ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1935,8 +1916,8 @@ public:
|
|||||||
state_stack yystateStack;
|
state_stack yystateStack;
|
||||||
int yyerrcnt;
|
int yyerrcnt;
|
||||||
int yyrawchar;
|
int yyrawchar;
|
||||||
value_type yyval;]b4_locations_if([[
|
value_type yylval;]b4_locations_if([[
|
||||||
location_type yyloc;]])[
|
location_type yylloc;]])[
|
||||||
YYJMP_BUF yyexception_buffer;
|
YYJMP_BUF yyexception_buffer;
|
||||||
]b4_namespace_ref[::]b4_parser_class[& yyparser;
|
]b4_namespace_ref[::]b4_parser_class[& yyparser;
|
||||||
|
|
||||||
@@ -1976,9 +1957,9 @@ public:
|
|||||||
yynewOption.setNext(yystate->firstVal());
|
yynewOption.setNext(yystate->firstVal());
|
||||||
if (yystateStack.yytops.lookaheadNeeds(yyk))
|
if (yystateStack.yytops.lookaheadNeeds(yyk))
|
||||||
{
|
{
|
||||||
yynewOption.yyrawchar = yychar;
|
yynewOption.yyrawchar = this->yyrawchar;
|
||||||
yynewOption.yyval = yylval;]b4_locations_if([
|
yynewOption.yyval = this->yylval;]b4_locations_if([
|
||||||
yynewOption.yyloc = yylloc;])[
|
yynewOption.yyloc = this->yylloc;])[
|
||||||
}
|
}
|
||||||
yystate->setFirstVal(&yynewOption);
|
yystate->setFirstVal(&yynewOption);
|
||||||
|
|
||||||
@@ -1997,12 +1978,12 @@ public:
|
|||||||
return;
|
return;
|
||||||
]b4_parse_error_bmatch(
|
]b4_parse_error_bmatch(
|
||||||
[simple],
|
[simple],
|
||||||
[[ yyparser.error (]b4_locations_if([yylloc, ])[YY_("syntax error"));]],
|
[[ yyparser.error (]b4_locations_if([this->yylloc, ])[YY_("syntax error"));]],
|
||||||
[[ {
|
[[ {
|
||||||
yysymbol_kind_t yytoken
|
yysymbol_kind_t yytoken
|
||||||
= yychar == ]b4_namespace_ref::b4_parser_class::token::b4_symbol(empty, id)[
|
= this->yyrawchar == ]b4_namespace_ref::b4_parser_class::token::b4_symbol(empty, id)[
|
||||||
? ]b4_namespace_ref::b4_parser_class::b4_symbol(empty, kind)[
|
? ]b4_namespace_ref::b4_parser_class::b4_symbol(empty, kind)[
|
||||||
: YYTRANSLATE (yychar);
|
: YYTRANSLATE (this->yyrawchar);
|
||||||
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
||||||
/* Arguments of yyformat. */
|
/* Arguments of yyformat. */
|
||||||
yysymbol_kind_t yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]
|
yysymbol_kind_t yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]
|
||||||
@@ -2093,7 +2074,7 @@ public:
|
|||||||
yyparser.error (]b4_locations_if([[yylloc, ]])[yymsg);
|
yyparser.error (]b4_locations_if([[yylloc, ]])[yymsg);
|
||||||
}
|
}
|
||||||
]])[
|
]])[
|
||||||
yynerrs += 1;
|
yyerrcnt += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2108,25 +2089,23 @@ public:
|
|||||||
reductions. Skip tokens until we can proceed. */
|
reductions. Skip tokens until we can proceed. */
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
yysymbol_kind_t yytoken;
|
if (this->yyrawchar == ]b4_namespace_ref::b4_parser_class::token::b4_symbol(eof, id)[)
|
||||||
int yyj;
|
|
||||||
if (yychar == ]b4_namespace_ref::b4_parser_class::token::b4_symbol(eof, id)[)
|
|
||||||
yyFail (]b4_locations_if([yylocp, ])[YY_NULLPTR);
|
yyFail (]b4_locations_if([yylocp, ])[YY_NULLPTR);
|
||||||
if (yychar != ]b4_namespace_ref::b4_parser_class::token::b4_symbol(empty, id)[)
|
if (this->yyrawchar != ]b4_namespace_ref::b4_parser_class::token::b4_symbol(empty, id)[)
|
||||||
{]b4_locations_if([[
|
{]b4_locations_if([[
|
||||||
/* We throw away the lookahead, but the error range
|
/* We throw away the lookahead, but the error range
|
||||||
of the shifted error token must take it into account. */
|
of the shifted error token must take it into account. */
|
||||||
glr_state *yys = firstTopState();
|
glr_state *yys = firstTopState();
|
||||||
yyerror_range[1].getState().yyloc = yys->yyloc;
|
yyerror_range[1].getState().yyloc = yys->yyloc;
|
||||||
yyerror_range[2].getState().yyloc = yylloc;
|
yyerror_range[2].getState().yyloc = this->yylloc;
|
||||||
YYLLOC_DEFAULT ((yys->yyloc), yyerror_range, 2);]])[
|
YYLLOC_DEFAULT ((yys->yyloc), yyerror_range, 2);]])[
|
||||||
yytoken = YYTRANSLATE (yychar);
|
yysymbol_kind_t yytoken = YYTRANSLATE (this->yyrawchar);
|
||||||
yyparser.yy_destroy_ ("Error: discarding",
|
yyparser.yy_destroy_ ("Error: discarding",
|
||||||
yytoken, &yylval]b4_locations_if([, &yylloc])[);
|
yytoken, &yylval]b4_locations_if([, &yylloc])[);
|
||||||
yychar = ]b4_namespace_ref::b4_parser_class::token::b4_symbol(empty, id)[;
|
this->yyrawchar = ]b4_namespace_ref::b4_parser_class::token::b4_symbol(empty, id)[;
|
||||||
}
|
}
|
||||||
yytoken = ]b4_yygetToken_call[;
|
yysymbol_kind_t yytoken = yygetToken (this->yyrawchar, yyparser, this]b4_user_args[);
|
||||||
yyj = yypact[firstTopState()->yylrState];
|
int yyj = yypact[firstTopState()->yylrState];
|
||||||
if (yypact_value_is_default (yyj))
|
if (yypact_value_is_default (yyj))
|
||||||
return;
|
return;
|
||||||
yyj += yytoken;
|
yyj += yytoken;
|
||||||
@@ -2144,9 +2123,9 @@ public:
|
|||||||
|
|
||||||
/* Now pop stack until we find a state that shifts the error token. */
|
/* Now pop stack until we find a state that shifts the error token. */
|
||||||
yyerrState = 3;
|
yyerrState = 3;
|
||||||
while (firstTopState() != YY_NULLPTR)
|
while (firstTopState () != YY_NULLPTR)
|
||||||
{
|
{
|
||||||
glr_state *yys = firstTopState();
|
glr_state *yys = firstTopState ();
|
||||||
int yyj = yypact[yys->yylrState];
|
int yyj = yypact[yys->yylrState];
|
||||||
if (! yypact_value_is_default (yyj))
|
if (! yypact_value_is_default (yyj))
|
||||||
{
|
{
|
||||||
@@ -2157,7 +2136,7 @@ public:
|
|||||||
/* Shift the error token. */]b4_locations_if([[
|
/* Shift the error token. */]b4_locations_if([[
|
||||||
/* First adjust its location.*/
|
/* First adjust its location.*/
|
||||||
location_type yyerrloc;
|
location_type yyerrloc;
|
||||||
yyerror_range[2].getState().yyloc = yylloc;
|
yyerror_range[2].getState().yyloc = this->yylloc;
|
||||||
YYLLOC_DEFAULT (yyerrloc, (yyerror_range), 2);]])[
|
YYLLOC_DEFAULT (yyerrloc, (yyerror_range), 2);]])[
|
||||||
YY_SYMBOL_PRINT ("Shifting", yy_accessing_symbol(yytable[yyj]),
|
YY_SYMBOL_PRINT ("Shifting", yy_accessing_symbol(yytable[yyj]),
|
||||||
&yylval, &yyerrloc);
|
&yylval, &yyerrloc);
|
||||||
@@ -2213,7 +2192,7 @@ public:
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
yystateStack.yytops.setLookaheadNeeds(yyk, true);
|
yystateStack.yytops.setLookaheadNeeds(yyk, true);
|
||||||
const yysymbol_kind_t yytoken = ]b4_yygetToken_call[;
|
const yysymbol_kind_t yytoken = yygetToken (this->yyrawchar, yyparser, this]b4_user_args[);
|
||||||
const short* yyconflicts;
|
const short* yyconflicts;
|
||||||
const int yyaction = yygetLRActions (yystate, yytoken, yyconflicts);
|
const int yyaction = yygetLRActions (yystate, yytoken, yyconflicts);
|
||||||
|
|
||||||
@@ -2286,6 +2265,8 @@ public:
|
|||||||
# define YYERROR return yyerrok, yyerr
|
# define YYERROR return yyerrok, yyerr
|
||||||
# undef YYRECOVERING
|
# undef YYRECOVERING
|
||||||
# define YYRECOVERING() (yyerrState != 0)
|
# define YYRECOVERING() (yyerrState != 0)
|
||||||
|
# undef yychar
|
||||||
|
# define yychar this->yyrawchar
|
||||||
# undef yyclearin
|
# undef yyclearin
|
||||||
# define yyclearin (yychar = ]b4_namespace_ref::b4_parser_class::token::b4_symbol(empty, id)[)
|
# define yyclearin (yychar = ]b4_namespace_ref::b4_parser_class::token::b4_symbol(empty, id)[)
|
||||||
# undef YYBACKUP
|
# undef YYBACKUP
|
||||||
@@ -2329,6 +2310,7 @@ public:
|
|||||||
# undef YYACCEPT
|
# undef YYACCEPT
|
||||||
# undef YYERROR
|
# undef YYERROR
|
||||||
# undef YYBACKUP
|
# undef YYBACKUP
|
||||||
|
# undef yychar
|
||||||
# undef yyclearin
|
# undef yyclearin
|
||||||
# undef YYRECOVERING
|
# undef YYRECOVERING
|
||||||
}
|
}
|
||||||
@@ -2643,7 +2625,7 @@ private:
|
|||||||
{
|
{
|
||||||
yyparser.yy_destroy_ ("Cleanup: discarding incompletely merged value for",
|
yyparser.yy_destroy_ ("Cleanup: discarding incompletely merged value for",
|
||||||
yy_accessing_symbol(yys.yylrState),
|
yy_accessing_symbol(yys.yylrState),
|
||||||
&yyval]b4_locations_if([, yylocp])[);
|
&this->yylval]b4_locations_if([, yylocp])[);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
yyuserMerge (yymerger[yyp->yyrule], &val, &yyval_other);
|
yyuserMerge (yymerger[yyp->yyrule], &val, &yyval_other);
|
||||||
@@ -2690,17 +2672,17 @@ private:
|
|||||||
/* Set default location. */
|
/* Set default location. */
|
||||||
yyrhsVals[YYMAXRHS + YYMAXLEFT - 1].getState().yyloc = yyoptState->yyloc;]])[
|
yyrhsVals[YYMAXRHS + YYMAXLEFT - 1].getState().yyloc = yyoptState->yyloc;]])[
|
||||||
{
|
{
|
||||||
int yychar_current = yychar;
|
int yychar_current = this->yyrawchar;
|
||||||
value_type yylval_current = yylval;]b4_locations_if([
|
value_type yylval_current = this->yylval;]b4_locations_if([
|
||||||
location_type yylloc_current = yylloc;])[
|
location_type yylloc_current = this->yylloc;])[
|
||||||
yychar = yyopt.yyrawchar;
|
this->yyrawchar = yyopt.yyrawchar;
|
||||||
yylval = yyopt.yyval;]b4_locations_if([
|
this->yylval = yyopt.yyval;]b4_locations_if([
|
||||||
yylloc = yyopt.yyloc;])[
|
this->yylloc = yyopt.yyloc;])[
|
||||||
yyflag = yyuserAction (yyopt.yyrule, yynrhs,
|
yyflag = yyuserAction (yyopt.yyrule, yynrhs,
|
||||||
yyrhsVals + YYMAXRHS + YYMAXLEFT - 1, yyvalp]b4_locations_if([, yylocp])[);
|
yyrhsVals + YYMAXRHS + YYMAXLEFT - 1, yyvalp]b4_locations_if([, yylocp])[);
|
||||||
yychar = yychar_current;
|
this->yyrawchar = yychar_current;
|
||||||
yylval = yylval_current;]b4_locations_if([
|
this->yylval = yylval_current;]b4_locations_if([
|
||||||
yylloc = yylloc_current;])[
|
this->yylloc = yylloc_current;])[
|
||||||
}
|
}
|
||||||
return yyflag;
|
return yyflag;
|
||||||
}]b4_locations_if([[
|
}]b4_locations_if([[
|
||||||
@@ -2751,7 +2733,7 @@ private:
|
|||||||
]b4_parse_param_vars[
|
]b4_parse_param_vars[
|
||||||
|
|
||||||
};
|
};
|
||||||
#undef yystackp
|
|
||||||
#undef YYSTACKEXPANDABLE
|
#undef YYSTACKEXPANDABLE
|
||||||
|
|
||||||
|
|
||||||
@@ -2774,8 +2756,8 @@ yygetToken (int& yycharp, ]b4_namespace_ref[::]b4_parser_class[& yyparser, glr_s
|
|||||||
catch (const ]b4_namespace_ref[::]b4_parser_class[::syntax_error& yyexc)
|
catch (const ]b4_namespace_ref[::]b4_parser_class[::syntax_error& yyexc)
|
||||||
{
|
{
|
||||||
YYCDEBUG << "Caught exception: " << yyexc.what () << '\n';]b4_locations_if([
|
YYCDEBUG << "Caught exception: " << yyexc.what () << '\n';]b4_locations_if([
|
||||||
yylloc = yyexc.location;])[
|
yystackp->yylloc = yyexc.location;])[
|
||||||
yyparser.error (]b4_locations_if([yylloc, ])[yyexc.what ());
|
yyparser.error (]b4_locations_if([yystackp->yylloc, ])[yyexc.what ());
|
||||||
// Map errors caught in the scanner to the error token, so that error
|
// Map errors caught in the scanner to the error token, so that error
|
||||||
// handling is started.
|
// handling is started.
|
||||||
yycharp = ]b4_namespace_ref::b4_parser_class::token::b4_symbol(error, id)[;
|
yycharp = ]b4_namespace_ref::b4_parser_class::token::b4_symbol(error, id)[;
|
||||||
@@ -2791,7 +2773,7 @@ yygetToken (int& yycharp, ]b4_namespace_ref[::]b4_parser_class[& yyparser, glr_s
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
yytoken = YYTRANSLATE (yycharp);
|
yytoken = YYTRANSLATE (yycharp);
|
||||||
YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
|
YY_SYMBOL_PRINT ("Next token is", yytoken, &yystackp->yylval, &yystackp->yylloc);
|
||||||
}
|
}
|
||||||
return yytoken;
|
return yytoken;
|
||||||
}
|
}
|
||||||
@@ -2947,11 +2929,11 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
|||||||
|
|
||||||
YYCDEBUG << "Starting parse\n";
|
YYCDEBUG << "Starting parse\n";
|
||||||
|
|
||||||
yychar = ]b4_namespace_ref::b4_parser_class::token::b4_symbol(empty, id)[;
|
yystackp->yyrawchar = ]b4_namespace_ref::b4_parser_class::token::b4_symbol(empty, id)[;
|
||||||
yylval = yyval_default;]b4_locations_if([
|
yystackp->yylval = yyval_default;]b4_locations_if([
|
||||||
yylloc = yyloc_default;])[
|
yystackp->yylloc = yyloc_default;])[
|
||||||
]m4_ifdef([b4_initial_action], [
|
]m4_ifdef([b4_initial_action], [
|
||||||
b4_dollar_pushdef([yylval], [], [], [yylloc])dnl
|
b4_dollar_pushdef([yystackp->yylval], [], [], [yystackp->yylloc])dnl
|
||||||
b4_user_initial_action
|
b4_user_initial_action
|
||||||
b4_dollar_popdef])[]dnl
|
b4_dollar_popdef])[]dnl
|
||||||
[
|
[
|
||||||
@@ -2962,7 +2944,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
case 2: goto yyexhaustedlab;
|
case 2: goto yyexhaustedlab;
|
||||||
default: goto yybuglab;
|
default: goto yybuglab;
|
||||||
}
|
}
|
||||||
yystack.yyglrShift (create_state_set_index(0), 0, 0, yylval]b4_locations_if([, yylloc])[);
|
yystack.yyglrShift (create_state_set_index(0), 0, 0, yystackp->yylval]b4_locations_if([, yystackp->yylloc])[);
|
||||||
yyposn = 0;
|
yyposn = 0;
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
@@ -2982,7 +2964,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
const rule_num yyrule = yydefaultAction (yystate);
|
const rule_num yyrule = yydefaultAction (yystate);
|
||||||
if (yyrule == 0)
|
if (yyrule == 0)
|
||||||
{]b4_locations_if([[
|
{]b4_locations_if([[
|
||||||
yystack.yyerror_range[1].getState().yyloc = yylloc;]])[
|
yystack.yyerror_range[1].getState().yyloc = yystackp->yylloc;]])[
|
||||||
yystack.yyreportSyntaxError ();
|
yystack.yyreportSyntaxError ();
|
||||||
goto yyuser_error;
|
goto yyuser_error;
|
||||||
}
|
}
|
||||||
@@ -2990,26 +2972,26 @@ b4_dollar_popdef])[]dnl
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const yysymbol_kind_t yytoken = ]b4_yygetToken_call[;
|
const yysymbol_kind_t yytoken = yygetToken (yystackp->yyrawchar, yyparser, yystackp]b4_user_args[);
|
||||||
const short* yyconflicts;
|
const short* yyconflicts;
|
||||||
const int yyaction = yygetLRActions (yystate, yytoken, yyconflicts);
|
const int yyaction = yygetLRActions (yystate, yytoken, yyconflicts);
|
||||||
if (*yyconflicts != 0)
|
if (*yyconflicts != 0)
|
||||||
break;
|
break;
|
||||||
if (yyisShiftAction (yyaction))
|
if (yyisShiftAction (yyaction))
|
||||||
{
|
{
|
||||||
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
|
YY_SYMBOL_PRINT ("Shifting", yytoken, &yystackp->yylval, &yystackp->yylloc);
|
||||||
yychar = token::]b4_symbol(empty, id)[;
|
yystackp->yyrawchar = token::]b4_symbol(empty, id)[;
|
||||||
yyposn += 1;
|
yyposn += 1;
|
||||||
yystack.yyglrShift (create_state_set_index(0), yyaction, yyposn, yylval]b4_locations_if([, yylloc])[);
|
yystack.yyglrShift (create_state_set_index(0), yyaction, yyposn, yystackp->yylval]b4_locations_if([, yystackp->yylloc])[);
|
||||||
if (0 < yystack.yyerrState)
|
if (0 < yystack.yyerrState)
|
||||||
yystack.yyerrState -= 1;
|
yystack.yyerrState -= 1;
|
||||||
}
|
}
|
||||||
else if (yyisErrorAction (yyaction))
|
else if (yyisErrorAction (yyaction))
|
||||||
{]b4_locations_if([[
|
{]b4_locations_if([[
|
||||||
yystack.yyerror_range[1].getState().yyloc = yylloc;]])[
|
yystack.yyerror_range[1].getState().yyloc = yystackp->yylloc;]])[
|
||||||
/* Don't issue an error message again for exceptions
|
/* Don't issue an error message again for exceptions
|
||||||
thrown from the scanner. */
|
thrown from the scanner. */
|
||||||
if (yychar != token::]b4_symbol(error, id)[)
|
if (yystackp->yyrawchar != token::]b4_symbol(error, id)[)
|
||||||
yystack.yyreportSyntaxError ();
|
yystack.yyreportSyntaxError ();
|
||||||
goto yyuser_error;
|
goto yyuser_error;
|
||||||
}
|
}
|
||||||
@@ -3021,7 +3003,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
for (state_set_index yys = create_state_set_index(0); yys.uget() < yystack.yystateStack.numTops(); ++yys)
|
for (state_set_index yys = create_state_set_index(0); yys.uget() < yystack.yystateStack.numTops(); ++yys)
|
||||||
yystackp->yystateStack.yytops.setLookaheadNeeds(yys, yychar != token::]b4_symbol(empty, id)[);
|
yystackp->yystateStack.yytops.setLookaheadNeeds(yys, yystackp->yyrawchar != token::]b4_symbol(empty, id)[);
|
||||||
|
|
||||||
/* yyprocessOneStack returns one of three things:
|
/* yyprocessOneStack returns one of three things:
|
||||||
|
|
||||||
@@ -3043,16 +3025,16 @@ b4_dollar_popdef])[]dnl
|
|||||||
on yylval in the event of memory exhaustion. */
|
on yylval in the event of memory exhaustion. */
|
||||||
|
|
||||||
for (state_set_index yys = create_state_set_index(0); yys.uget() < yystack.yystateStack.numTops(); ++yys)
|
for (state_set_index yys = create_state_set_index(0); yys.uget() < yystack.yystateStack.numTops(); ++yys)
|
||||||
YYCHK1 (yystack.yyprocessOneStack (yys, yyposn]b4_locations_if([, &yylloc])[));
|
YYCHK1 (yystack.yyprocessOneStack (yys, yyposn]b4_locations_if([, &yystackp->yylloc])[));
|
||||||
yystack.yystateStack.yytops.yyremoveDeletes ();
|
yystack.yystateStack.yytops.yyremoveDeletes ();
|
||||||
if (yystack.yystateStack.yytops.size() == 0)
|
if (yystack.yystateStack.yytops.size() == 0)
|
||||||
{
|
{
|
||||||
yystack.yystateStack.yytops.yyundeleteLastStack ();
|
yystack.yystateStack.yytops.yyundeleteLastStack ();
|
||||||
if (yystack.yystateStack.yytops.size() == 0)
|
if (yystack.yystateStack.yytops.size() == 0)
|
||||||
yystack.yyFail (]b4_locations_if([&yylloc, ])[YY_("syntax error"));
|
yystack.yyFail (]b4_locations_if([&yystackp->yylloc, ])[YY_("syntax error"));
|
||||||
YYCHK1 (yystack.yyresolveStack ());
|
YYCHK1 (yystack.yyresolveStack ());
|
||||||
YYCDEBUG << "Returning to deterministic operation.\n";]b4_locations_if([[
|
YYCDEBUG << "Returning to deterministic operation.\n";]b4_locations_if([[
|
||||||
yystack.yyerror_range[1].getState().yyloc = yylloc;]])[
|
yystack.yyerror_range[1].getState().yyloc = yystackp->yylloc;]])[
|
||||||
yystack.yyreportSyntaxError ();
|
yystack.yyreportSyntaxError ();
|
||||||
goto yyuser_error;
|
goto yyuser_error;
|
||||||
}
|
}
|
||||||
@@ -3062,8 +3044,8 @@ b4_dollar_popdef])[]dnl
|
|||||||
failure in the following loop. Thus, yychar is set to ]b4_symbol(empty, id)[
|
failure in the following loop. Thus, yychar is set to ]b4_symbol(empty, id)[
|
||||||
before the loop to make sure the user destructor for yylval isn't
|
before the loop to make sure the user destructor for yylval isn't
|
||||||
called twice. */
|
called twice. */
|
||||||
yysymbol_kind_t yytoken_to_shift = YYTRANSLATE (yychar);
|
yysymbol_kind_t yytoken_to_shift = YYTRANSLATE (yystackp->yyrawchar);
|
||||||
yychar = token::]b4_symbol(empty, id)[;
|
yystackp->yyrawchar = token::]b4_symbol(empty, id)[;
|
||||||
yyposn += 1;
|
yyposn += 1;
|
||||||
for (state_set_index yys = create_state_set_index(0); yys.uget() < yystack.yystateStack.numTops(); ++yys)
|
for (state_set_index yys = create_state_set_index(0); yys.uget() < yystack.yystateStack.numTops(); ++yys)
|
||||||
{
|
{
|
||||||
@@ -3073,8 +3055,8 @@ b4_dollar_popdef])[]dnl
|
|||||||
yyconflicts);
|
yyconflicts);
|
||||||
/* Note that yyconflicts were handled by yyprocessOneStack. */
|
/* Note that yyconflicts were handled by yyprocessOneStack. */
|
||||||
YYCDEBUG << "On stack " << yys.get() << ", ";
|
YYCDEBUG << "On stack " << yys.get() << ", ";
|
||||||
YY_SYMBOL_PRINT ("shifting", yytoken_to_shift, &yylval, &yylloc);
|
YY_SYMBOL_PRINT ("shifting", yytoken_to_shift, &yystackp->yylval, &yystackp->yylloc);
|
||||||
yystack.yyglrShift (yys, yyaction, yyposn, yylval]b4_locations_if([, yylloc])[);
|
yystack.yyglrShift (yys, yyaction, yyposn, yystackp->yylval]b4_locations_if([, yystackp->yylloc])[);
|
||||||
YYCDEBUG << "Stack " << yys.get() << " now in state #"
|
YYCDEBUG << "Stack " << yys.get() << " now in state #"
|
||||||
<< yystack.topState(yys)->yylrState << '\n';
|
<< yystack.topState(yys)->yylrState << '\n';
|
||||||
}
|
}
|
||||||
@@ -3089,7 +3071,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
yyuser_error:
|
yyuser_error:
|
||||||
yystack.yyrecoverSyntaxError (]b4_locations_if([&yylloc])[);
|
yystack.yyrecoverSyntaxError (]b4_locations_if([&yystackp->yylloc])[);
|
||||||
yyposn = yystack.firstTopState()->yyposn;
|
yyposn = yystack.firstTopState()->yyposn;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3106,7 +3088,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
goto yyreturn;
|
goto yyreturn;
|
||||||
|
|
||||||
yyexhaustedlab:
|
yyexhaustedlab:
|
||||||
error (]b4_locations_if([yylloc, ])[YY_("memory exhausted"));
|
error (]b4_locations_if([yystackp->yylloc, ])[YY_("memory exhausted"));
|
||||||
yyresult = 2;
|
yyresult = 2;
|
||||||
goto yyreturn;
|
goto yyreturn;
|
||||||
|
|
||||||
@@ -3114,11 +3096,6 @@ b4_dollar_popdef])[]dnl
|
|||||||
return yyresult;
|
return yyresult;
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef yylval
|
|
||||||
#undef yychar
|
|
||||||
#undef yynerrs]b4_locations_if([
|
|
||||||
#undef yylloc])[
|
|
||||||
|
|
||||||
]b4_parse_error_bmatch([custom\|detailed],
|
]b4_parse_error_bmatch([custom\|detailed],
|
||||||
[[ const char *
|
[[ const char *
|
||||||
]b4_parser_class[::symbol_name (symbol_kind_type yysymbol)
|
]b4_parser_class[::symbol_name (symbol_kind_type yysymbol)
|
||||||
|
|||||||
Reference in New Issue
Block a user