mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-14 23:03:04 +00:00
c++: get rid of global_tokens_and_yystype
This was a hack to make it easier for people to migrate from yacc.c to lalr1.cc and from glr.c to glr.cc: when set, YYSTYPE and YYLTYPE were `#defined`. It was never documented (just mentioned in NEWS for Bison 2.2, 2006-05-19), but was used to simplify the test suite. Stop that: adjust the test suite to the skeletons, not the converse. In C++ use yy::parser::semantic_type, yy::parser::location_type, and yy::parser::token::MY_TOKEN, instead of YYSTYPE, YYLTYPE and MY_TOKEN. * data/skeletons/glr.cc, data/skeletons/lalr1.cc: Remove its support. * tests/actions.at, tests/c++.at, tests/calc.at: Adjust.
This commit is contained in:
@@ -213,12 +213,12 @@ read_integer (]AT_YYLEX_FORMALS[)
|
||||
{
|
||||
unget_char (]AT_YYLEX_PRE_ARGS[ c);
|
||||
]AT_VAL[.ival = read_integer (]AT_YYLEX_ARGS[);
|
||||
return ]AT_TOKEN_PREFIX[NUM;
|
||||
return ]AT_CXX_IF([AT_NAMESPACE::parser::token::])[]AT_TOKEN_PREFIX[NUM;
|
||||
}
|
||||
|
||||
/* Return end-of-file. */
|
||||
if (c == EOF)
|
||||
return ]AT_TOKEN_PREFIX[CALC_EOF;
|
||||
return ]AT_CXX_IF([AT_NAMESPACE::parser::token::])[]AT_TOKEN_PREFIX[CALC_EOF;
|
||||
|
||||
/* An explicit error raised by the scanner. */
|
||||
if (c == '#')
|
||||
@@ -226,7 +226,7 @@ read_integer (]AT_YYLEX_FORMALS[)
|
||||
fprintf (stderr, "%d.%d: ",
|
||||
AT_LOC_FIRST_LINE, AT_LOC_FIRST_COLUMN);])[
|
||||
fputs ("syntax error: invalid character: '#'\n", stderr);
|
||||
return ]AT_TOKEN_PREFIX[]AT_API_PREFIX[error;
|
||||
return ]AT_CXX_IF([AT_NAMESPACE::parser::token::])[]AT_TOKEN_PREFIX[]AT_API_PREFIX[error;
|
||||
}
|
||||
|
||||
/* Return single chars. */
|
||||
@@ -444,7 +444,6 @@ m4_define([_AT_DATA_CALC_Y(c)],
|
||||
[AT_DATA_GRAMMAR([calc.y],
|
||||
[[/* Infix notation calculator--calc */
|
||||
]$4[
|
||||
]AT_CXX_IF([%define global_tokens_and_yystype])[
|
||||
]AT_LANG_MATCH(
|
||||
[d], [[
|
||||
%code imports {
|
||||
|
||||
Reference in New Issue
Block a user