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:
Akim Demaille
2020-06-16 08:01:48 +02:00
parent e077bf1ebc
commit efb65daa36
6 changed files with 4 additions and 28 deletions

View File

@@ -252,14 +252,9 @@ m4_define([b4_undef_symbol_kind],
# -----------------
# Remove redirections for glr.c.
m4_define([b4_glr_cc_cleanup],
[b4_percent_define_flag_if([[global_tokens_and_yystype]], [],
[[#undef ]b4_symbol(-2, [id])[
#undef ]b4_symbol(0, [id])[
#undef ]b4_symbol(1, [id])[
]])[
#undef ]b4_api_PREFIX[STYPE
#undef ]b4_api_PREFIX[LTYPE
]b4_undef_symbol_kind(-2)dnl
b4_symbol_foreach([b4_undef_symbol_kind])dnl
@@ -377,10 +372,6 @@ b4_percent_code_get([[requires]])[
]b4_parse_param_vars[
};
]dnl Redirections for glr.c.
b4_percent_define_flag_if([[global_tokens_and_yystype]],
[b4_token_defines
])[
]b4_namespace_close[
]b4_percent_code_get([[provides]])[

View File

@@ -493,14 +493,6 @@ m4_define([b4_shared_declarations],
]b4_public_types_define([$1])])[
]b4_namespace_close[
]b4_percent_define_flag_if([[global_tokens_and_yystype]],
[b4_token_defines
#ifndef ]b4_api_PREFIX[STYPE
// Redirection for backward compatibility.
# define ]b4_api_PREFIX[STYPE b4_namespace_ref::b4_parser_class::semantic_type
#endif
])[
]b4_percent_code_get([[provides]])[
]])