bug-bison
[Top][All Lists]
Advanced

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

Re: symbol_type::token () removed?


From: Akim Demaille
Subject: Re: symbol_type::token () removed?
Date: Mon, 4 May 2020 05:28:56 +0200


> Le 3 mai 2020 à 15:01, Akim Demaille <address@hidden> a écrit :
> 
> Hi!
> 
>> Le 3 mai 2020 à 13:51, pramod kumbhar <address@hidden> a écrit :
>> 
>> Hello Akim,
>> 
>> I am trying with 3.5.92 and I see now:
>> 
>> /Users/kumbhar/nmodl/src/parser/diffeq_context.cpp:81:75: error: no member
>> named
>>     'type_get' in 'nmodl::parser::DiffeqParser::by_kind'
>>       if (token_type ==
>> DiffeqParser::by_type(DiffeqParser::token::END).type_get()) {
>>                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
>> 
>> The full example is here
>> <https://github.com/BlueBrain/nmodl/blob/584af62be9cd6f9017f63e2d9cb732e1da58d420/src/parser/diffeq_context.cpp#L81>.
>> Did* I* miss to point this out in my last email?
>> 
>> Next time if you push the fix to the git repo, I can build bison from there
>> and try it.
> 
> Sorry Pramod.  Try the appended patch please.

FTR, here's what was installed.  Pramod confirmed it fixed the issue.

commit eea56d70d90d952ab04177f6995755ba8cf2908d
Author: Akim Demaille <address@hidden>
Date:   Sun May 3 15:00:00 2020 +0200

    c++: be compatible with the pre-3.6 way to get a symbol's kind
    
    Reported by Pramod Kumbhar.
    https://lists.gnu.org/r/bug-bison/2020-05/msg00025.html
    
    * data/skeletons/c++.m4: here.

diff --git a/data/skeletons/c++.m4 b/data/skeletons/c++.m4
index 59c94ce0..7ce45078 100644
--- a/data/skeletons/c++.m4
+++ b/data/skeletons/c++.m4
@@ -259,14 +259,14 @@ m4_define([b4_public_types_declare],
     struct token
     {
       ]b4_token_enums[
-      /// Backward compatibility alias.
+      /// Backward compatibility alias (Bison 3.6).
       typedef token_kind_type yytokentype;
     };
 
     /// Token kind, as returned by yylex.
     typedef token::yytokentype token_kind_type;
 
-    /// Backward compatibility alias.
+    /// Backward compatibility alias (Bison 3.6).
     typedef token_kind_type token_type;
 
     /// Symbol kinds.
@@ -357,7 +357,7 @@ m4_define([b4_symbol_type_define],
         Base::clear ();
       }
 
-      /// Backward compatibility.
+      /// Backward compatibility (Bison 3.6).
       symbol_kind_type type_get () const YY_NOEXCEPT;
 
       /// Whether empty.
@@ -409,12 +409,15 @@ m4_define([b4_symbol_type_define],
       /// \a empty when empty.
       symbol_kind_type kind () const YY_NOEXCEPT;
 
+      /// Backward compatibility (Bison 3.6).
+      symbol_kind_type type_get () const YY_NOEXCEPT;
+
       /// The symbol kind.
       /// \a ]b4_symbol_prefix[YYEMPTY when empty.
       symbol_kind_type kind_;
     };
 
-    /// Backward compatibility for a private implementation detail.
+    /// Backward compatibility for a private implementation detail (Bison 3.6).
     typedef by_kind by_type;
 
     /// "External" symbols: returned by the scanner.
@@ -534,6 +537,12 @@ m4_define([b4_public_types_define],
   {
     return kind_;
   }
+
+  ]b4_inline([$1])[]b4_parser_class[::symbol_kind_type
+  ]b4_parser_class[::by_kind::type_get () const YY_NOEXCEPT
+  {
+    return this->kind ();
+  }
 ]])
 
 




reply via email to

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