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:
Akim Demaille
2021-09-12 12:43:26 +02:00
parent 28152fc10a
commit c09524cf8f

View File

@@ -1660,419 +1660,421 @@ 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)
class state_stack namespace
{ {
public: class state_stack
typedef ]b4_namespace_ref[::]b4_parser_class[::symbol_kind symbol_kind;
typedef ]b4_namespace_ref[::]b4_parser_class[::value_type value_type;]b4_locations_if([[
typedef ]b4_namespace_ref[::]b4_parser_class[::location_type location_type;]])[
/** Initialize to a single empty stack, with total maximum
* capacity for all stacks of YYSIZE. */
state_stack (size_t yysize)
: yysplitPoint (YY_NULLPTR)
{ {
yyitems.reserve (yysize); public:
} using parser_type = ]b4_namespace_ref[::]b4_parser_class[;
using symbol_kind = parser_type::symbol_kind;
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
* capacity for all stacks of YYSIZE. */
state_stack (size_t yysize)
: yysplitPoint (YY_NULLPTR)
{
yyitems.reserve (yysize);
}
#if YYSTACKEXPANDABLE #if YYSTACKEXPANDABLE
/** Returns false if it tried to expand but could not. */ /** Returns false if it tried to expand but could not. */
bool bool
yyexpandGLRStackIfNeeded () yyexpandGLRStackIfNeeded ()
{ {
return YYHEADROOM <= spaceLeft () || yyexpandGLRStack (); return YYHEADROOM <= spaceLeft () || yyexpandGLRStack ();
} }
private: private:
/** If *this is expandable, extend it. WARNING: Pointers into the /** If *this is expandable, extend it. WARNING: Pointers into the
stack from outside should be considered invalid after this call. stack from outside should be considered invalid after this call.
We always expand when there are 1 or fewer items left AFTER an We always expand when there are 1 or fewer items left AFTER an
allocation, so that we can avoid having external pointers exist allocation, so that we can avoid having external pointers exist
across an allocation. */ across an allocation. */
bool bool
yyexpandGLRStack () yyexpandGLRStack ()
{ {
const size_t oldsize = yyitems.size(); const size_t oldsize = yyitems.size();
if (YYMAXDEPTH - YYHEADROOM < oldsize) if (YYMAXDEPTH - YYHEADROOM < oldsize)
return false; return false;
const size_t yynewSize = YYMAXDEPTH < 2 * oldsize ? YYMAXDEPTH : 2 * oldsize; const size_t yynewSize = YYMAXDEPTH < 2 * oldsize ? YYMAXDEPTH : 2 * oldsize;
const glr_stack_item *oldbase = &yyitems[0]; const glr_stack_item *oldbase = &yyitems[0];
yyitems.reserve (yynewSize); yyitems.reserve (yynewSize);
const glr_stack_item *newbase = &yyitems[0]; const glr_stack_item *newbase = &yyitems[0];
// Adjust the pointers. Perform raw pointer arithmetic, as there // Adjust the pointers. Perform raw pointer arithmetic, as there
// is no reason for objects to be aligned on their size. // is no reason for objects to be aligned on their size.
const ptrdiff_t disp const ptrdiff_t disp
= reinterpret_cast<const char*> (newbase) - reinterpret_cast<const char*> (oldbase); = reinterpret_cast<const char*> (newbase) - reinterpret_cast<const char*> (oldbase);
if (yysplitPoint) if (yysplitPoint)
const_cast<glr_state*&> (yysplitPoint) const_cast<glr_state*&> (yysplitPoint)
= reinterpret_cast<glr_state*> (reinterpret_cast<char*> (const_cast<glr_state*> (yysplitPoint)) + disp); = reinterpret_cast<glr_state*> (reinterpret_cast<char*> (const_cast<glr_state*> (yysplitPoint)) + disp);
for (std::vector<glr_state*>::iterator for (std::vector<glr_state*>::iterator
i = yytops.begin (), i = yytops.begin (),
yyend = yytops.end (); yyend = yytops.end ();
i != yyend; ++i) i != yyend; ++i)
if (glr_state_not_null (*i)) if (glr_state_not_null (*i))
*i = reinterpret_cast<glr_state*>(reinterpret_cast<char*>(*i) + disp); *i = reinterpret_cast<glr_state*>(reinterpret_cast<char*>(*i) + disp);
return true; return true;
} }
public: public:
#else #else
bool yyexpandGLRStackIfNeeded () bool yyexpandGLRStackIfNeeded ()
{ {
return YYHEADROOM <= spaceLeft (); return YYHEADROOM <= spaceLeft ();
} }
#endif #endif
#undef YYSTACKEXPANDABLE #undef YYSTACKEXPANDABLE
static bool glr_state_not_null (glr_state* s) static bool glr_state_not_null (glr_state* s)
{ {
return s != YY_NULLPTR; return s != YY_NULLPTR;
} }
bool bool
reduceToOneStack () reduceToOneStack ()
{ {
typedef std::vector<glr_state*>::iterator iterator; typedef std::vector<glr_state*>::iterator iterator;
const iterator yybegin = yytops.begin(); const iterator yybegin = yytops.begin();
const iterator yyend = yytops.end(); const iterator yyend = yytops.end();
const iterator yyit = std::find_if(yybegin, yyend, glr_state_not_null); const iterator yyit = std::find_if(yybegin, yyend, glr_state_not_null);
if (yyit == yyend) if (yyit == yyend)
return false; return false;
for (state_set_index yyk = create_state_set_index(yyit + 1 - yybegin); for (state_set_index yyk = create_state_set_index(yyit + 1 - yybegin);
yyk.uget() != numTops(); ++yyk) yyk.uget() != numTops(); ++yyk)
yytops.yymarkStackDeleted (yyk); yytops.yymarkStackDeleted (yyk);
yytops.yyremoveDeletes (); yytops.yyremoveDeletes ();
yycompressStack (); yycompressStack ();
return true; return true;
} }
/** Called when returning to deterministic operation to clean up the extra /** Called when returning to deterministic operation to clean up the extra
* stacks. */ * stacks. */
void void
yycompressStack () yycompressStack ()
{ {
if (yytops.size() != 1 || !isSplit()) if (yytops.size() != 1 || !isSplit())
return; return;
// yyr is the state after the split point. // yyr is the state after the split point.
glr_state* yyr = YY_NULLPTR; glr_state* yyr = YY_NULLPTR;
for (glr_state *yyp = firstTop(), *yyq = yyp->pred(); for (glr_state *yyp = firstTop(), *yyq = yyp->pred();
yyp != yysplitPoint; yyp != yysplitPoint;
yyr = yyp, yyp = yyq, yyq = yyp->pred()) yyr = yyp, yyp = yyq, yyq = yyp->pred())
yyp->setPred(yyr); yyp->setPred(yyr);
// This const_cast is okay, since anyway we have access to the mutable // This const_cast is okay, since anyway we have access to the mutable
// yyitems into which yysplitPoint points. // yyitems into which yysplitPoint points.
glr_stack_item* nextFreeItem glr_stack_item* nextFreeItem
= const_cast<glr_state*> (yysplitPoint)->asItem () + 1; = const_cast<glr_state*> (yysplitPoint)->asItem () + 1;
yysplitPoint = YY_NULLPTR; yysplitPoint = YY_NULLPTR;
yytops.clearLastDeleted (); yytops.clearLastDeleted ();
while (yyr != YY_NULLPTR) while (yyr != YY_NULLPTR)
{ {
nextFreeItem->setState (*yyr); nextFreeItem->setState (*yyr);
glr_state& nextFreeState = nextFreeItem->getState(); glr_state& nextFreeState = nextFreeItem->getState();
yyr = yyr->pred(); yyr = yyr->pred();
nextFreeState.setPred(&(nextFreeItem - 1)->getState()); nextFreeState.setPred(&(nextFreeItem - 1)->getState());
setFirstTop (&nextFreeState); setFirstTop (&nextFreeState);
++nextFreeItem; ++nextFreeItem;
} }
yyitems.resize(static_cast<size_t>(nextFreeItem - yyitems.data())); yyitems.resize(static_cast<size_t>(nextFreeItem - yyitems.data()));
} }
bool isSplit() const { bool isSplit() const {
return yysplitPoint != YY_NULLPTR; return yysplitPoint != YY_NULLPTR;
} }
// Present the interface of a vector of glr_stack_item. // Present the interface of a vector of glr_stack_item.
std::vector<glr_stack_item>::const_iterator begin () const std::vector<glr_stack_item>::const_iterator begin () const
{ {
return yyitems.begin (); return yyitems.begin ();
} }
std::vector<glr_stack_item>::const_iterator end () const std::vector<glr_stack_item>::const_iterator end () const
{ {
return yyitems.end (); return yyitems.end ();
} }
size_t size() const size_t size() const
{ {
return yyitems.size (); return yyitems.size ();
} }
glr_stack_item& operator[] (size_t i) glr_stack_item& operator[] (size_t i)
{ {
return yyitems[i]; return yyitems[i];
} }
glr_stack_item& stackItemAt (size_t index) glr_stack_item& stackItemAt (size_t index)
{ {
return yyitems[index]; return yyitems[index];
} }
size_t numTops () const size_t numTops () const
{ {
return yytops.size (); return yytops.size ();
} }
glr_state* firstTop () const glr_state* firstTop () const
{ {
return yytops[create_state_set_index (0)]; return yytops[create_state_set_index (0)];
} }
glr_state* topAt (state_set_index i) const glr_state* topAt (state_set_index i) const
{ {
return yytops[i]; return yytops[i];
} }
void setFirstTop (glr_state* value) void setFirstTop (glr_state* value)
{ {
yytops[create_state_set_index (0)] = value; yytops[create_state_set_index (0)] = value;
} }
void setTopAt (state_set_index i, glr_state* value) void setTopAt (state_set_index i, glr_state* value)
{ {
yytops[i] = value; yytops[i] = value;
} }
void pop_back () void pop_back ()
{ {
yyitems.pop_back (); yyitems.pop_back ();
} }
void pop_back (size_t n) void pop_back (size_t n)
{ {
yyitems.resize (yyitems.size () - n); yyitems.resize (yyitems.size () - n);
} }
state_set_index state_set_index
yysplitStack (state_set_index yyk) yysplitStack (state_set_index yyk)
{ {
if (!isSplit ()) if (!isSplit ())
{ {
YYASSERT (yyk.get () == 0); YYASSERT (yyk.get () == 0);
yysplitPoint = topAt (yyk); yysplitPoint = topAt (yyk);
} }
return yytops.yysplitStack (yyk); return yytops.yysplitStack (yyk);
} }
/** Assuming that YYS is a GLRState somewhere on *this, update the /** Assuming that YYS is a GLRState somewhere on *this, update the
* splitpoint of *this, if needed, so that it is at least as deep as * splitpoint of *this, if needed, so that it is at least as deep as
* YYS. */ * YYS. */
void void
yyupdateSplit (glr_state& yys) yyupdateSplit (glr_state& yys)
{ {
if (isSplit() && &yys < yysplitPoint) if (isSplit() && &yys < yysplitPoint)
yysplitPoint = &yys; yysplitPoint = &yys;
} }
/** Return a fresh GLRState. /** Return a fresh GLRState.
* Callers should call yyreserveStack afterwards to make sure there is * Callers should call yyreserveStack afterwards to make sure there is
* sufficient headroom. */ * sufficient headroom. */
glr_state& yynewGLRState (const glr_state& newState) glr_state& yynewGLRState (const glr_state& newState)
{ {
glr_state& state = yyitems[yynewGLRStackItem (true)].getState (); glr_state& state = yyitems[yynewGLRStackItem (true)].getState ();
#if false && 201103L <= YY_CPLUSPLUS #if false && 201103L <= YY_CPLUSPLUS
state = std::move (newState); state = std::move (newState);
#else #else
state = newState; state = newState;
#endif #endif
return state; return state;
} }
/** Return a fresh SemanticOption. /** Return a fresh SemanticOption.
* Callers should call yyreserveStack afterwards to make sure there is * Callers should call yyreserveStack afterwards to make sure there is
* sufficient headroom. */ * sufficient headroom. */
semantic_option& yynewSemanticOption (semantic_option newOption) semantic_option& yynewSemanticOption (semantic_option newOption)
{ {
semantic_option& option = yyitems[yynewGLRStackItem (false)].getOption (); semantic_option& option = yyitems[yynewGLRStackItem (false)].getOption ();
#if 201103L <= YY_CPLUSPLUS #if 201103L <= YY_CPLUSPLUS
option = std::move (newOption); option = std::move (newOption);
#else #else
option = newOption; option = newOption;
#endif #endif
return option; return option;
} }
/* Do nothing if YYNORMAL or if *YYLOW <= YYLOW1. Otherwise, fill in /* Do nothing if YYNORMAL or if *YYLOW <= YYLOW1. Otherwise, fill in
* YYVSP[YYLOW1 .. *YYLOW-1] as in yyfillin and set *YYLOW = YYLOW1. * YYVSP[YYLOW1 .. *YYLOW-1] as in yyfillin and set *YYLOW = YYLOW1.
* For convenience, always return YYLOW1. */ * For convenience, always return YYLOW1. */
int int
yyfill (glr_stack_item *yyvsp, int &yylow, int yylow1, bool yynormal) yyfill (glr_stack_item *yyvsp, int &yylow, int yylow1, bool yynormal)
{ {
if (!yynormal && yylow1 < yylow) if (!yynormal && yylow1 < yylow)
{ {
yyfillin (yyvsp, yylow, yylow1); yyfillin (yyvsp, yylow, yylow1);
yylow = yylow1; yylow = yylow1;
} }
return yylow1; return yylow1;
} }
/** Fill in YYVSP[YYLOW1 .. YYLOW0-1] from the chain of states starting /** Fill in YYVSP[YYLOW1 .. YYLOW0-1] from the chain of states starting
* at YYVSP[YYLOW0].getState().pred(). Leaves YYVSP[YYLOW1].getState().pred() * at YYVSP[YYLOW0].getState().pred(). Leaves YYVSP[YYLOW1].getState().pred()
* containing the pointer to the next state in the chain. */ * containing the pointer to the next state in the chain. */
void void
yyfillin (glr_stack_item *yyvsp, int yylow0, int yylow1) yyfillin (glr_stack_item *yyvsp, int yylow0, int yylow1)
{ {
glr_state* s = yyvsp[yylow0].getState().pred(); glr_state* s = yyvsp[yylow0].getState().pred();
YYASSERT(s != YY_NULLPTR); YYASSERT(s != YY_NULLPTR);
for (int i = yylow0-1; i >= yylow1; i -= 1, s = s->pred()) for (int i = yylow0-1; i >= yylow1; i -= 1, s = s->pred())
{ {
glr_state& yys = yyvsp[i].getState(); glr_state& yys = yyvsp[i].getState();
#if ]b4_api_PREFIX[DEBUG #if ]b4_api_PREFIX[DEBUG
yys.yylrState = s->yylrState; yys.yylrState = s->yylrState;
#endif #endif
yys.yyresolved = s->yyresolved; yys.yyresolved = s->yyresolved;
if (s->yyresolved) if (s->yyresolved)
{]b4_variant_if([[ {]b4_variant_if([[
new (&yys.value ()) value_type (); new (&yys.value ()) value_type ();
]b4_symbol_variant([yy_accessing_symbol (s->yylrState)], ]b4_symbol_variant([yy_accessing_symbol (s->yylrState)],
[yys.value ()], [copy], [s->value ()])], [[ [yys.value ()], [copy], [s->value ()])], [[
new (&yys.value ()) value_type (s->value ());]])[ new (&yys.value ()) value_type (s->value ());]])[
} }
else else
/* The effect of using yyval or yyloc (in an immediate /* The effect of using yyval or yyloc (in an immediate
* rule) is undefined. */ * rule) is undefined. */
yys.setFirstVal (YY_NULLPTR);]b4_locations_if([[ yys.setFirstVal (YY_NULLPTR);]b4_locations_if([[
yys.yyloc = s->yyloc;]])[ yys.yyloc = s->yyloc;]])[
yys.setPred(s->pred()); yys.setPred(s->pred());
} }
} }
#if ]b4_api_PREFIX[DEBUG #if ]b4_api_PREFIX[DEBUG
/*----------------------------------------------------------------------. /*----------------------------------------------------------------------.
| Report that stack #YYK of *YYSTACKP is going to be reduced by YYRULE. | | Report that stack #YYK of *YYSTACKP is going to be reduced by YYRULE. |
`----------------------------------------------------------------------*/ `----------------------------------------------------------------------*/
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;])[
int yyi; int yyi;
std::cerr << "Reducing stack " << yyk.get() << " by rule " << yyrule - 1 std::cerr << "Reducing stack " << yyk.get() << " by rule " << yyrule - 1
<< " (line " << int (yyrline[yyrule]) << "):\n"; << " (line " << int (yyrline[yyrule]) << "):\n";
if (! yynormal) if (! yynormal)
yyfillin (yyvsp, 1, -yynrhs); yyfillin (yyvsp, 1, -yynrhs);
/* The symbols being reduced. */ /* The symbols being reduced. */
for (yyi = 0; yyi < yynrhs; yyi++) for (yyi = 0; yyi < yynrhs; yyi++)
{ {
std::cerr << " $" << yyi + 1 << " = "; std::cerr << " $" << yyi + 1 << " = ";
yyparser.yy_symbol_print_ yyparser.yy_symbol_print_
(yy_accessing_symbol (yyvsp[yyi - yynrhs + 1].getState().yylrState), (yy_accessing_symbol (yyvsp[yyi - yynrhs + 1].getState().yylrState),
yyvsp[yyi - yynrhs + 1].getState().value ()]b4_locations_if([[, yyvsp[yyi - yynrhs + 1].getState().value ()]b4_locations_if([[,
]b4_rhs_location(yynrhs, yyi + 1)])[); ]b4_rhs_location(yynrhs, yyi + 1)])[);
if (!yyvsp[yyi - yynrhs + 1].getState().yyresolved) if (!yyvsp[yyi - yynrhs + 1].getState().yyresolved)
std::cerr << " (unresolved)"; std::cerr << " (unresolved)";
std::cerr << '\n'; std::cerr << '\n';
} }
} }
#define YYINDEX(YYX) \ #define YYINDEX(YYX) \
((YYX) == YY_NULLPTR ? -1 : (YYX)->indexIn (yyitems.data ())) ((YYX) == YY_NULLPTR ? -1 : (YYX)->indexIn (yyitems.data ()))
void void
dumpStack () const dumpStack () const
{ {
for (size_t yyi = 0; yyi < size(); ++yyi) for (size_t yyi = 0; yyi < size(); ++yyi)
{ {
const glr_stack_item& item = yyitems[yyi]; const glr_stack_item& item = yyitems[yyi];
std::cerr << std::setw(3) << yyi << ". "; std::cerr << std::setw(3) << yyi << ". ";
if (item.is_state()) if (item.is_state())
{ {
std::cerr << "Res: " << item.getState().yyresolved std::cerr << "Res: " << item.getState().yyresolved
<< ", LR State: " << item.getState().yylrState << ", LR State: " << item.getState().yylrState
<< ", posn: " << item.getState().yyposn << ", posn: " << item.getState().yyposn
<< ", pred: " << YYINDEX(item.getState().pred()); << ", pred: " << YYINDEX(item.getState().pred());
if (! item.getState().yyresolved) if (! item.getState().yyresolved)
std::cerr << ", firstVal: " std::cerr << ", firstVal: "
<< YYINDEX(item.getState().firstVal()); << YYINDEX(item.getState().firstVal());
} }
else else
{ {
std::cerr << "Option. rule: " << item.getOption().yyrule - 1 std::cerr << "Option. rule: " << item.getOption().yyrule - 1
<< ", state: " << YYINDEX(item.getOption().state()) << ", state: " << YYINDEX(item.getOption().state())
<< ", next: " << YYINDEX(item.getOption().next()); << ", next: " << YYINDEX(item.getOption().next());
} }
std::cerr << '\n'; std::cerr << '\n';
}
std::cerr << "Tops:";
for (state_set_index yyi = create_state_set_index(0); yyi.uget() < numTops(); ++yyi) {
std::cerr << yyi.get() << ": " << YYINDEX(topAt(yyi)) << "; ";
} }
std::cerr << "Tops:"; std::cerr << '\n';
for (state_set_index yyi = create_state_set_index(0); yyi.uget() < numTops(); ++yyi) {
std::cerr << yyi.get() << ": " << YYINDEX(topAt(yyi)) << "; ";
} }
std::cerr << '\n';
}
#undef YYINDEX #undef YYINDEX
#endif #endif
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);
#if ]b4_api_PREFIX[DEBUG #if ]b4_api_PREFIX[DEBUG
std::cerr << "Ambiguity detected.\n" std::cerr << "Ambiguity detected.\n"
"Option 1,\n"; "Option 1,\n";
yyx0.yyreportTree (); yyx0.yyreportTree ();
std::cerr << "\nOption 2,\n"; std::cerr << "\nOption 2,\n";
yyx1.yyreportTree (); yyx1.yyreportTree ();
std::cerr << '\n'; std::cerr << '\n';
#endif #endif
yyparser.error (]b4_locations_if([yyloc, ])[YY_("syntax is ambiguous")); yyparser.error (]b4_locations_if([yyloc, ])[YY_("syntax is ambiguous"));
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
yypstates (const glr_state* yys) const yypstates (const glr_state* yys) const
{ {
if (yys != YY_NULLPTR) if (yys != YY_NULLPTR)
yys->yy_yypstack(); yys->yy_yypstack();
else else
std::cerr << "<null>"; std::cerr << "<null>";
std::cerr << '\n'; std::cerr << '\n';
} }
#endif #endif
private: private:
size_t spaceLeft() const size_t spaceLeft() const
{ {
return yyitems.capacity() - yyitems.size(); return yyitems.capacity() - yyitems.size();
} }
/** Return a fresh GLRStackItem in this. The item is an LR state /** Return a fresh GLRStackItem in this. The item is an LR state
* if YYIS_STATE, and otherwise a semantic option. Callers should call * if YYIS_STATE, and otherwise a semantic option. Callers should call
* yyreserveStack afterwards to make sure there is sufficient * yyreserveStack afterwards to make sure there is sufficient
* headroom. */ * headroom. */
size_t size_t
yynewGLRStackItem (bool yyis_state) yynewGLRStackItem (bool yyis_state)
{ {
YYDASSERT(yyitems.size() < yyitems.capacity()); YYDASSERT(yyitems.size() < yyitems.capacity());
yyitems.push_back(glr_stack_item(yyis_state)); yyitems.push_back(glr_stack_item(yyis_state));
return yyitems.size() - 1; return yyitems.size() - 1;
} }
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;])[