c++: get rid of symbol_type::token ()

It is not used.  And its implementation was wrong when api.token.raw
was defined, as it was still mapping to the external token numbers,
instead of the internal ones.  Besides it was provided only when
api.token.constructor is defined, yet always declared.

* data/skeletons/c++.m4 (by_type::token): Remove, useless.
This commit is contained in:
Akim Demaille
2019-12-01 10:00:42 +01:00
parent 478cb5cf12
commit 8c87a62308
2 changed files with 2 additions and 22 deletions

4
TODO
View File

@@ -135,9 +135,7 @@ $ ./tests/testsuite -l | grep errors | sed q
* Short term * Short term
** Get rid of YYPRINT and b4_toknum ** Get rid of YYPRINT and b4_toknum
Besides yytoknum is wrong when api.token.raw is defined.
** C++ a closer look at parser::by_type::token
It can certainly be simplified with we use api.token.raw.
** Stop indentation in diagnostics ** Stop indentation in diagnostics
Before Bison 2.7, we printed "flatly" the dependencies in long diagnostics: Before Bison 2.7, we printed "flatly" the dependencies in long diagnostics:

View File

@@ -367,9 +367,6 @@ m4_define([b4_symbol_type_define],
/// \a empty when empty. /// \a empty when empty.
symbol_number_type type_get () const YY_NOEXCEPT; symbol_number_type type_get () const YY_NOEXCEPT;
/// The token.
token_type token () const YY_NOEXCEPT;
/// The symbol type. /// The symbol type.
/// \a empty_symbol when empty. /// \a empty_symbol when empty.
/// An int, not token_number_type, to be able to store empty_symbol. /// An int, not token_number_type, to be able to store empty_symbol.
@@ -498,22 +495,7 @@ m4_define([b4_public_types_define],
{ {
return type; return type;
} }
]b4_token_ctor_if([[ ]])
]b4_inline([$1])b4_parser_class[::token_type
]b4_parser_class[::by_type::token () const YY_NOEXCEPT
{
// YYTOKNUM[NUM] -- (External) token number corresponding to the
// (internal) symbol number NUM (which must be that of a token). */
static
const ]b4_int_type_for([b4_toknum])[
yytoken_number_[] =
{
]b4_toknum[
};
return token_type (yytoken_number_[type]);
}
]])[]dnl
])
# b4_token_constructor_define # b4_token_constructor_define