glr2.cc: introduce the yytranslate_ member function

* data/skeletons/c++.m4 (b4_yytranslate_define): Use static_cast
rather than the YY_CAST macro.
Avoids the need to define YY_CAST in the header.
* data/skeletons/glr2.cc: Fix calls to b4_shared_declarations: pass
the type of file we are in.
Don't define YYTRANSLATE.
(parser::yytranslate_): New, as in lalr1.cc.
Adjust to use it.

* tests/glr-regression.at: Adjust.
This commit is contained in:
Akim Demaille
2021-01-10 13:38:35 +01:00
parent 3ad6d862b7
commit 4aa731d110
3 changed files with 30 additions and 31 deletions

View File

@@ -602,7 +602,7 @@ m4_define([b4_yytranslate_define],
if (t <= 0)
return symbol_kind::]b4_symbol_prefix[YYEOF;
else if (t <= code_max)
return YY_CAST (symbol_kind_type, translate_table[t]);
return static_cast <symbol_kind_type> (translate_table[t]);
else
return symbol_kind::]b4_symbol_prefix[YYUNDEF;]])[
}