mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
glr2.cc: simplify
* data/skeletons/glr2.cc (glr_state_set::yyremoveDeletes): Use
vector::resize rather than vector::erase.
(glr_state::copyFrom): Merge into...
(glr_state::operator=): here.
Valentin wanted each assignment to be explicit, hence copyFrom rather
that operator=. But in 0a82316e54
(glr2.cc: example: use objects (not pointers) to represent the AST),
in order to get real objects to be processed correctly, we had to
introduce the assignment operator. Afterward, we also introduced a
full implementation of the copy-ctor, independent of copyFrom. As a
result, today the only invocation of copyFrom is from the assignment
operator. Simplify this.
This commit is contained in:
@@ -822,12 +822,6 @@ public:
|
||||
}
|
||||
|
||||
glr_state& operator= (const glr_state& other)
|
||||
{
|
||||
copyFrom (other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void copyFrom (const glr_state& other)
|
||||
{]b4_parse_assert_if([[
|
||||
check_ ();
|
||||
other.check_ ();]])[
|
||||
@@ -842,6 +836,7 @@ public:
|
||||
else
|
||||
setFirstVal (other.firstVal ());]b4_locations_if([[
|
||||
yyloc = other.yyloc;]])[
|
||||
return *this;
|
||||
}
|
||||
|
||||
/** Type tag for the semantic value. If true, yysval applies, otherwise
|
||||
@@ -1060,9 +1055,8 @@ class glr_state_set
|
||||
j += 1;
|
||||
}
|
||||
}
|
||||
yystates.erase (yystates.begin () + static_cast<std::ptrdiff_t> (newsize), yystates.end ());
|
||||
yylookaheadNeeds.erase (yylookaheadNeeds.begin () + static_cast<std::ptrdiff_t> (newsize),
|
||||
yylookaheadNeeds.end ());
|
||||
yystates.resize (newsize);
|
||||
yylookaheadNeeds.resize (newsize);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user