]> git.saurik.com Git - bison.git/commitdiff
lalr1.cc: factor the yytranslate_ invocation in make_SYMBOLS.
authorAkim Demaille <demaille@gostai.com>
Wed, 9 Sep 2009 21:09:22 +0000 (23:09 +0200)
committerAkim Demaille <demaille@gostai.com>
Wed, 16 Sep 2009 15:45:22 +0000 (17:45 +0200)
* data/c++.m4, data/lalr1.cc (parser::symbol_type): Change the
constructor to take a token_type instead of the (internal) symbol
number.
Call yytranslate_.
* data/variant.hh (b4_symbol_constructor_define_): Therefore,
don't call yytranslate_ here.

ChangeLog
data/c++.m4
data/lalr1.cc
data/variant.hh

index 70e89b7790e2d16b53716b71ae2c931777f4e461..1182da7bcedef5184f0f1e99db37940ad0063e04 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2009-09-16  Akim Demaille  <demaille@gostai.com>
+
+       lalr1.cc: factor the yytranslate_ invocation in make_SYMBOLS.
+       * data/c++.m4, data/lalr1.cc (parser::symbol_type): Change the
+       constructor to take a token_type instead of the (internal) symbol
+       number.
+       Call yytranslate_.
+       * data/variant.hh (b4_symbol_constructor_define_): Therefore,
+       don't call yytranslate_ here.
+
 2009-09-16  Akim Demaille  <demaille@gostai.com>
 
        TODO: statistics.
index 3157e47b8ee830671eceb626a9f067410baecda5..22b3375abac79c9bb76d7e8bcdf4b37bdc7f7505 100644 (file)
@@ -178,21 +178,22 @@ m4_define([b4_public_types_declare],
       /// Default constructor.
       inline symbol_type ();
 
-      /// Constructor.
-      inline symbol_type (]b4_args([int t],
+      /// Constructor for tokens with semantic value.
+      inline symbol_type (]b4_args([token_type t],
                                    [const semantic_type& v],
                                    b4_locations_if([const location_type& l]))[);
 
-      inline symbol_type (]b4_args([int t],
+      /// Constructor for valueless tokens.
+      inline symbol_type (]b4_args([token_type t],
                                    b4_locations_if([const location_type& l]))[);
 
       /// The symbol type.
       int type;
 
-      /// Return the type corresponding to this state.
+      /// The symbol type.
       inline int type_get_ () const;
 
-      /// Its token.
+      /// The token.
       inline token_type token () const;
     };
 ]b4_symbol_constructor_declare])
@@ -269,20 +270,20 @@ m4_define([b4_public_types_define],
 
   inline
   ]b4_parser_class_name[::symbol_type::symbol_type (]b4_args(
-                [int t],
+                [token_type t],
                 b4_locations_if([const location_type& l]))[)
     : super_type (]b4_locations_if([l])[)
-    , type (t)
+    , type (yytranslate_ (t))
   {
   }
 
   inline
   ]b4_parser_class_name[::symbol_type::symbol_type (]b4_args(
-                 [int t],
+                 [token_type t],
                  [const semantic_type& v],
                  b4_locations_if([const location_type& l]))[)
     : super_type (v]b4_locations_if([, l])[)
-    , type (t)
+    , type (yytranslate_ (t))
   {
   }
 
index ac2fa35bc6e294d3778511b053d65a0ce8b4caee..1a2777e9ce9eaccd5fadbdf69a102f061271a5b4 100644 (file)
@@ -29,7 +29,7 @@ m4_define([b4_integral_parser_table_declare],
 ])
 
 # b4_integral_parser_table_define(TABLE-NAME, CONTENT, COMMENT)
-# ---------------------------------------------
+# -------------------------------------------------------------
 # Define "parser::yy<TABLE-NAME>_" which contents is CONTENT.
 m4_define([b4_integral_parser_table_define],
 [  const b4_int_type_for([$2])
@@ -321,7 +321,7 @@ do {                                                            \
       /// The state.
       state_type state;
 
-      /// Return the type corresponding to this state.
+      /// The type (corresponding to \a state).
       inline int type_get_ () const;
     };
 
index ae26f5b86d77998d7ae51d580940ceee719a176a..31af62b3ab7fbde1581d08643dfcfb7fd24e14e2 100644 (file)
@@ -262,7 +262,7 @@ b4_args(b4_symbol_if([$1], [has_type],
                      [const b4_symbol([$1], [type])& v]),
         b4_locations_if([const location_type& l])))
   {
-    return symbol_type (b4_args([yytranslate_ (token::b4_symbol([$1], [id]))],
+    return symbol_type (b4_args([token::b4_symbol([$1], [id])],
                                 b4_symbol_if([$1], [has_type], [v]),
                                 b4_locations_if([l])));
   }