From 8c87a62308a2b60adca823f10e3693cd9c221b90 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sun, 1 Dec 2019 10:00:42 +0100 Subject: [PATCH] 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. --- TODO | 4 +--- data/skeletons/c++.m4 | 20 +------------------- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/TODO b/TODO index 0b18573b..6d874425 100644 --- a/TODO +++ b/TODO @@ -135,9 +135,7 @@ $ ./tests/testsuite -l | grep errors | sed q * Short term ** Get rid of YYPRINT and b4_toknum - -** C++ a closer look at parser::by_type::token -It can certainly be simplified with we use api.token.raw. +Besides yytoknum is wrong when api.token.raw is defined. ** Stop indentation in diagnostics Before Bison 2.7, we printed "flatly" the dependencies in long diagnostics: diff --git a/data/skeletons/c++.m4 b/data/skeletons/c++.m4 index 6e825ff3..e49d8d24 100644 --- a/data/skeletons/c++.m4 +++ b/data/skeletons/c++.m4 @@ -367,9 +367,6 @@ m4_define([b4_symbol_type_define], /// \a empty when empty. symbol_number_type type_get () const YY_NOEXCEPT; - /// The token. - token_type token () const YY_NOEXCEPT; - /// The symbol type. /// \a empty_symbol when empty. /// 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; } -]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