mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-12 05:43:03 +00:00
c++: also use symbol_type_type
Because of the insane current implementation of glr.cc, things are a bit nasty. We will rename symbol_number_type as symbol_type_type later, to keep this commit small. * data/skeletons/c++.m4 (b4_declare_symbol_enum): New. Also define YYNTOKENS to avoid type clashes when yyntokens_ was actually defined in another enum. Use it. (symbol_number_type): Be an alias of symbol_type_type. Use YYSYMBOL_YYEMPTY and the like. Use symbol_number_type where appropriate. (empty_symbol): Remove. (yytranslate_): Use symbol_number_type, not token_number_type. * data/skeletons/lalr1.cc: Use symbol_number_type where appropriate. Adjust to the replacement of empty_symbol by YYSYMBOL_YYEMPTY. (yy_error_token_, yy_undef_token_, yyeof_, yyntokens_): Remove. Adjust dependencies. * data/skeletons/glr.cc: Use symbol_number_type where appropriate. Forward definitions of YYSYMBOL_YYEMPTY, etc. to glr.c. * tests/headers.at: Accept YYNTOKENS and other YYSYMBOL_*. * tests/local.at (AT_YYERROR_DEFINE(c++)): Use symbol_number_type.
This commit is contained in:
@@ -319,7 +319,9 @@ AT_PERL_CHECK([[-n -0777 -e '
|
||||
s{//.*}{}g;
|
||||
s{\b((defined|if)\ YYDEBUG
|
||||
|YYChar
|
||||
|YYNTOKENS # This is actual scoped in a C++ class.
|
||||
|YYPUSH_MORE(?:_DEFINED)?
|
||||
|YYSYMBOL_(\w+) # These guys are scoped.
|
||||
|YYUSE
|
||||
|YY_ATTRIBUTE(?:_PURE|_UNUSED)
|
||||
|YY(?:_REINTERPRET)?_CAST
|
||||
|
||||
@@ -749,13 +749,13 @@ void
|
||||
std::cerr << ctx.location () << ": ";]])[
|
||||
std::cerr << "syntax error";
|
||||
{
|
||||
int la = ctx.token ();
|
||||
if (la != empty_symbol)
|
||||
symbol_type_type la = ctx.token ();
|
||||
if (la != YYSYMBOL_YYEMPTY)
|
||||
fprintf (stderr, " on token [%s]", yysymbol_name (la));
|
||||
}
|
||||
{
|
||||
enum { TOKENMAX = 10 };
|
||||
int expected[TOKENMAX];
|
||||
symbol_type_type expected[TOKENMAX];
|
||||
int n = ctx.yyexpected_tokens (expected, TOKENMAX);
|
||||
if (0 < n)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user