glr2.cc: start the transition to using symbol_type
commit7c47598d4f7c290b7127e329c09750dab0975eab
authorAkim Demaille <akim.demaille@gmail.com>
Tue, 7 Sep 2021 05:07:31 +0000 (7 07:07 +0200)
committerAkim Demaille <akim.demaille@gmail.com>
Sun, 12 Sep 2021 10:03:58 +0000 (12 12:03 +0200)
tree435c3855e746e589087a33b29d01da81fec36975
parentfdaedc780af0dd678a4f4fa3175a201a553be20a
glr2.cc: start the transition to using symbol_type

Currently glr2.cc uses three variables/struct members to denote the
symbols' kind (or state), value and location.  lalr1.cc has two types
for "complete" symbols: symbol_type and stack_symbol_type.  Let's use
that model in glr2.cc too.

For a start use yyla (a symbol_type) to denote the lookahead, instead
of the triple yytoken, yylval and yylloc.  This will make easier the
introduction of the "context" subclass, used in parse.error=custom.

It simplifies the code in several places.  For instance from:

    symbol_kind_type yytoken_current = this->yytoken;]b4_variant_if([[
    value_type yylval_current;
    ]b4_symbol_variant([this->yytoken],
                       [yylval_current], [move], [this->yylval])], [[
    value_type yylval_current = this->yylval;]])[]b4_locations_if([
    location_type yylloc_current = this->yylloc;])[

to:

    symbol_type yyla_current = std::move (this->yyla);

* data/skeletons/glr2.cc (yytoken, yylval, yylloc): Replace by...
(yyla): this.
Adjust all dependencies.
(yyloc_default): Remove, unused.
* tests/c++.at, tests/glr-regression.at, tests/types.at: C++11 is
required for glr2.cc.
Adjust to changes in glr2.cc.
data/skeletons/glr2.cc
tests/c++.at
tests/glr-regression.at
tests/types.at