mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-19 17:23:02 +00:00
glr2.cc: move state_stack into the unnamed namespace
* data/skeletons/glr2.cc: here. Prefer `using` to `typedef`, this is C++11. Use the type alias we introduced.
This commit is contained in:
@@ -1660,12 +1660,15 @@ void glr_state::destroy (char const* yymsg, ]b4_namespace_ref[::]b4_parser_class
|
|||||||
#undef YYFILL
|
#undef YYFILL
|
||||||
#define YYFILL(N) yyfill (yyvsp, yylow, (N), yynormal)
|
#define YYFILL(N) yyfill (yyvsp, yylow, (N), yynormal)
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
class state_stack
|
class state_stack
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef ]b4_namespace_ref[::]b4_parser_class[::symbol_kind symbol_kind;
|
using parser_type = ]b4_namespace_ref[::]b4_parser_class[;
|
||||||
typedef ]b4_namespace_ref[::]b4_parser_class[::value_type value_type;]b4_locations_if([[
|
using symbol_kind = parser_type::symbol_kind;
|
||||||
typedef ]b4_namespace_ref[::]b4_parser_class[::location_type location_type;]])[
|
using value_type = parser_type::value_type;]b4_locations_if([[
|
||||||
|
using location_type = parser_type::location_type;]])[
|
||||||
|
|
||||||
/** Initialize to a single empty stack, with total maximum
|
/** Initialize to a single empty stack, with total maximum
|
||||||
* capacity for all stacks of YYSIZE. */
|
* capacity for all stacks of YYSIZE. */
|
||||||
@@ -1951,7 +1954,7 @@ public:
|
|||||||
|
|
||||||
void
|
void
|
||||||
yy_reduce_print (bool yynormal, glr_stack_item* yyvsp, state_set_index yyk,
|
yy_reduce_print (bool yynormal, glr_stack_item* yyvsp, state_set_index yyk,
|
||||||
rule_num yyrule, ]b4_namespace_ref[::]b4_parser_class[& yyparser)
|
rule_num yyrule, parser_type& yyparser)
|
||||||
{
|
{
|
||||||
int yynrhs = yyrhsLength (yyrule);]b4_locations_if([
|
int yynrhs = yyrhsLength (yyrule);]b4_locations_if([
|
||||||
int yylow = 1;])[
|
int yylow = 1;])[
|
||||||
@@ -2015,7 +2018,7 @@ public:
|
|||||||
|
|
||||||
YYRESULTTAG
|
YYRESULTTAG
|
||||||
yyreportAmbiguity (const semantic_option& yyx0,
|
yyreportAmbiguity (const semantic_option& yyx0,
|
||||||
const semantic_option& yyx1, ]b4_namespace_ref[::]b4_parser_class[& yyparser]b4_locations_if([, const location_type& yyloc])[)
|
const semantic_option& yyx1, parser_type& yyparser]b4_locations_if([, const location_type& yyloc])[)
|
||||||
{
|
{
|
||||||
YY_USE (yyx0);
|
YY_USE (yyx0);
|
||||||
YY_USE (yyx1);
|
YY_USE (yyx1);
|
||||||
@@ -2033,7 +2036,6 @@ public:
|
|||||||
return yyabort;
|
return yyabort;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* DEBUGGING ONLY */
|
|
||||||
#if ]b4_api_PREFIX[DEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
/* Print YYS (possibly NULL) and its predecessors. */
|
/* Print YYS (possibly NULL) and its predecessors. */
|
||||||
void
|
void
|
||||||
@@ -2067,12 +2069,12 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
std::vector<glr_stack_item> yyitems;
|
std::vector<glr_stack_item> yyitems;
|
||||||
// Where the stack splits. Anything below this address is deterministic.
|
// Where the stack splits. Anything below this address is deterministic.
|
||||||
const glr_state* yysplitPoint;
|
const glr_state* yysplitPoint;
|
||||||
glr_state_set yytops;
|
glr_state_set yytops;
|
||||||
};
|
}; // class state_stack
|
||||||
|
} // namespace
|
||||||
|
|
||||||
#undef YYFILL
|
#undef YYFILL
|
||||||
#define YYFILL(N) yystateStack.yyfill (yyvsp, yylow, (N), yynormal)
|
#define YYFILL(N) yystateStack.yyfill (yyvsp, yylow, (N), yynormal)
|
||||||
@@ -2095,7 +2097,7 @@ namespace ]b4_namespace_ref[
|
|||||||
friend context;
|
friend context;
|
||||||
]])[
|
]])[
|
||||||
|
|
||||||
glr_stack (size_t yysize, ]b4_namespace_ref[::]b4_parser_class[& yyparser_yyarg]m4_ifset([b4_parse_param], [, b4_parse_param_decl])[)
|
glr_stack (size_t yysize, parser_type& yyparser_yyarg]m4_ifset([b4_parse_param], [, b4_parse_param_decl])[)
|
||||||
: yyerrState (0)
|
: yyerrState (0)
|
||||||
, yystateStack (yysize)
|
, yystateStack (yysize)
|
||||||
, yyerrcnt (0)
|
, yyerrcnt (0)
|
||||||
@@ -2118,7 +2120,7 @@ namespace ]b4_namespace_ref[
|
|||||||
int yyerrcnt;
|
int yyerrcnt;
|
||||||
symbol_type yyla;
|
symbol_type yyla;
|
||||||
YYJMP_BUF yyexception_buffer;
|
YYJMP_BUF yyexception_buffer;
|
||||||
]b4_namespace_ref[::]b4_parser_class[& yyparser;
|
parser_type& yyparser;
|
||||||
|
|
||||||
#define YYCHK1(YYE) \
|
#define YYCHK1(YYE) \
|
||||||
do { \
|
do { \
|
||||||
@@ -2607,7 +2609,7 @@ namespace ]b4_namespace_ref[
|
|||||||
so pretend the stack is "normal". */
|
so pretend the stack is "normal". */
|
||||||
YY_REDUCE_PRINT ((yynormal || yyk == create_state_set_index (-1), yyvsp, yyk, yyrule, yyparser));
|
YY_REDUCE_PRINT ((yynormal || yyk == create_state_set_index (-1), yyvsp, yyk, yyrule, yyparser));
|
||||||
#if YY_EXCEPTIONS
|
#if YY_EXCEPTIONS
|
||||||
typedef ]b4_namespace_ref[::]b4_parser_class[::syntax_error syntax_error;
|
typedef parser_type::syntax_error syntax_error;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
#endif // YY_EXCEPTIONS
|
#endif // YY_EXCEPTIONS
|
||||||
@@ -3085,7 +3087,7 @@ namespace ]b4_namespace_ref[
|
|||||||
yyla.kind_ = yyparser.yytranslate_ (]b4_yylex[);]])[
|
yyla.kind_ = yyparser.yytranslate_ (]b4_yylex[);]])[
|
||||||
}
|
}
|
||||||
#if YY_EXCEPTIONS
|
#if YY_EXCEPTIONS
|
||||||
catch (const ]b4_namespace_ref[::]b4_parser_class[::syntax_error& yyexc)
|
catch (const parser_type::syntax_error& yyexc)
|
||||||
{
|
{
|
||||||
YYCDEBUG << "Caught exception: " << yyexc.what () << '\n';]b4_locations_if([
|
YYCDEBUG << "Caught exception: " << yyexc.what () << '\n';]b4_locations_if([
|
||||||
this->yyla.location = yyexc.location;])[
|
this->yyla.location = yyexc.location;])[
|
||||||
|
|||||||
Reference in New Issue
Block a user