glr2.cc: move free-functions into glr_stack

* data/skeletons/glr2.cc (yypreference, yyLRgotoState): Move into...
(glr_stack): here.
This commit is contained in:
Akim Demaille
2021-01-15 07:32:18 +01:00
parent 42d5a16f8d
commit 19418cfc75

View File

@@ -699,9 +699,6 @@ yyisErrorAction (int yyaction)
return yyaction == 0; return yyaction == 0;
} }
static inline int
yygetLRActions (state_num yystate, yysymbol_kind_t yytoken, const short*& yyconflicts);
/** Accessing symbol of state YYSTATE. */ /** Accessing symbol of state YYSTATE. */
static inline yysymbol_kind_t static inline yysymbol_kind_t
yy_accessing_symbol (state_num yystate) yy_accessing_symbol (state_num yystate)
@@ -731,9 +728,12 @@ yylhsNonterm (rule_num yyrule)
return static_cast<yysymbol_kind_t>(yyr1[yyrule]); return static_cast<yysymbol_kind_t>(yyr1[yyrule]);
} }
/** Number of symbols composing the right hand side of rule #RULE. */
static inline int static inline int
yyrhsLength (rule_num yyrule); yyrhsLength (rule_num yyrule)
{
return yyr2[yyrule];
}
class glr_state class glr_state
{ {
@@ -1582,12 +1582,6 @@ void glr_state::destroy (char const* yymsg, ]b4_namespace_ref[::]b4_parser_class
} }
static int
yypreference (const semantic_option& y0, const semantic_option& y1);
static inline state_num
yyLRgotoState (state_num yystate, yysymbol_kind_t yysym);
#undef YYFILL #undef YYFILL
#define YYFILL(N) yyfill (yyvsp, yylow, (N), yynormal) #define YYFILL(N) yyfill (yyvsp, yylow, (N), yynormal)
@@ -3130,20 +3124,9 @@ private:
YY_SYMBOL_PRINT ("Next token is", this->yytoken, this->yylval, this->yylloc); YY_SYMBOL_PRINT ("Next token is", this->yytoken, this->yylval, this->yylloc);
} }
]b4_parse_param_vars[
};
/* Bison grammar-table manipulation. */ /* Bison grammar-table manipulation. */
/** Number of symbols composing the right hand side of rule #RULE. */
static inline int
yyrhsLength (rule_num yyrule)
{
return yyr2[yyrule];
}
/** The action to take in YYSTATE on seeing YYTOKEN. /** The action to take in YYSTATE on seeing YYTOKEN.
* Result R means * Result R means
* R < 0: Reduce on rule -R. * R < 0: Reduce on rule -R.
@@ -3152,7 +3135,7 @@ yyrhsLength (rule_num yyrule)
* Set *YYCONFLICTS to a pointer into yyconfl to a 0-terminated list * Set *YYCONFLICTS to a pointer into yyconfl to a 0-terminated list
* of conflicting reductions. * of conflicting reductions.
*/ */
static inline int static int
yygetLRActions (state_num yystate, yysymbol_kind_t yytoken, const short*& yyconflicts) yygetLRActions (state_num yystate, yysymbol_kind_t yytoken, const short*& yyconflicts)
{ {
int yyindex = yypact[yystate] + yytoken; int yyindex = yypact[yystate] + yytoken;
@@ -3184,7 +3167,7 @@ yygetLRActions (state_num yystate, yysymbol_kind_t yytoken, const short*& yyconf
* \param yystate the current state * \param yystate the current state
* \param yysym the nonterminal to push on the stack * \param yysym the nonterminal to push on the stack
*/ */
static inline state_num static state_num
yyLRgotoState (state_num yystate, yysymbol_kind_t yysym) yyLRgotoState (state_num yystate, yysymbol_kind_t yysym)
{ {
const int yyr = yypgoto[yysym - YYNTOKENS] + yystate; const int yyr = yypgoto[yysym - YYNTOKENS] + yystate;
@@ -3221,6 +3204,11 @@ yypreference (const semantic_option& y0, const semantic_option& y1)
return 0; return 0;
} }
]b4_parse_param_vars[
};
/* DEBUGGING ONLY */ /* DEBUGGING ONLY */
#if ]b4_api_PREFIX[DEBUG #if ]b4_api_PREFIX[DEBUG
static void static void
@@ -3430,4 +3418,3 @@ static void yypdumpstack (const glr_stack& yystack)
]b4_namespace_close[]dnl ]b4_namespace_close[]dnl
b4_epilogue[]dnl b4_epilogue[]dnl
b4_output_end b4_output_end