bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Akim Demaille
Subject: c++: get rid of symbol_type::token ()
Date: Sun, 1 Dec 2019 13:34:16 +0100

More stuff prompted by Frank's report.

commit 8c87a62308a2b60adca823f10e3693cd9c221b90
Author: Akim Demaille <address@hidden>
Date:   Sun Dec 1 10:00:42 2019 +0100

    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.

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]