c++: provide a means to clear symbols

The symbol destructor is currently the only means to clear a symbol.
Unfortunately during error recovery we might have to clear the
lookahead, which is a local variable (yyla) that has not yet reached
its end of scope.

Rather that duplicating the code to destroy a symbol, or rather than
destroying and recreating yyla, let's provide a means to clear a
symbol.

Reported by Antonio Silva Correia, with an analysis from Michel d'Hooge.
<http://savannah.gnu.org/support/?108481>

* data/c++.m4, data/lalr1.cc (basis_symbol::clear, by_state::clear)
(by_type::clear): New.
(basic_symbol::~basic_symbol): Use clear.
This commit is contained in:
Akim Demaille
2015-01-08 16:07:59 +01:00
parent 5422471cbb
commit ee2f433512
3 changed files with 36 additions and 2 deletions
+2
View File
@@ -12,6 +12,7 @@ Andreas Schwab [email protected]
Andrew Suffield [email protected]
Angelo Borsotti [email protected]
Anthony Heading [email protected]
Antonio Silva Correia [email protected]
Arnold Robbins [email protected]
Art Haas [email protected]
Baron Schwartz [email protected]
@@ -85,6 +86,7 @@ Matt Rosing [email protected]
Michael Felt [email protected]
Michael Hayes [email protected]
Michael Raskin [email protected]
Michel d'Hooge [email protected]
Michiel De Wilde [email protected]
Mickael Labau [email protected]
Mike Castle [email protected]