]> git.saurik.com Git - bison.git/commitdiff
Share b4_yytranslate_define.
authorAkim Demaille <demaille@gostai.com>
Wed, 31 Dec 2008 16:21:56 +0000 (17:21 +0100)
committerAkim Demaille <demaille@gostai.com>
Mon, 2 Mar 2009 15:34:09 +0000 (16:34 +0100)
* data/lalr1.cc (b4_yytranslate_define): Move to...
* data/c++.m4: here.

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

index 6f8df1a9e6653cbc317bf21624a489bead8ce1fe..f858adaee329aad338a06994318b64d6d3160c4e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-03-02  Akim Demaille  <demaille@gostai.com>
+
+       Share b4_yytranslate_define.
+       * data/lalr1.cc (b4_yytranslate_define): Move to...
+       * data/c++.m4: here.
+
 2009-03-02  Akim Demaille  <demaille@gostai.com>
 
        Use locations in the variant example.
index 9ec967ad115b21895d3fcfaaf778d5f28ea579c5..c43a4df25d7de5e5447ba2a2e35f652829c19ae1 100644 (file)
@@ -294,6 +294,34 @@ m4_define([b4_symbol_constructor_declare], [])
 m4_define([b4_symbol_constructor_define], [])
 
 
+# b4_yytranslate_define
+# ---------------------
+# Define yytranslate_.  Sometimes used in the header file,
+# sometimes in the cc file.
+m4_define([b4_yytranslate_define],
+[[  // Symbol number corresponding to token number t.
+  ]b4_parser_class_name[::token_number_type
+  ]b4_parser_class_name[::yytranslate_ (]b4_lex_symbol_if([token_type],
+                                                          [int])[ t)
+  {
+    static
+    const token_number_type
+    translate_table[] =
+    {
+]b4_translate[
+    };
+    const unsigned int user_token_number_max_ = ]b4_user_token_number_max[;
+    const token_number_type undef_token_ = ]b4_undef_token_number[;
+
+    if (static_cast<int>(t) <= yyeof_)
+      return yyeof_;
+    else if (static_cast<unsigned int> (t) <= user_token_number_max_)
+      return translate_table[t];
+    else
+      return undef_token_;
+  }
+]])
+
 
 # b4_lhs_value([TYPE])
 # --------------------
index 642fd4e04403f6edf20f7b365537f20c1ef8d3be..81c2d20717c55145b5a41c03dadbc8fcb0dad77d 100644 (file)
@@ -115,35 +115,6 @@ m4_popdef([b4_dollar_dollar])dnl
 ])])
 
 
-# b4_yytranslate_define
-# ---------------------
-# Define yytranslate_.  Sometimes we want it in the header file,
-# sometimes the cc file suffices.
-m4_define([b4_yytranslate_define],
-[[  // Symbol number corresponding to token number t.
-  ]b4_parser_class_name[::token_number_type
-  ]b4_parser_class_name[::yytranslate_ (]b4_lex_symbol_if([token_type],
-                                                          [int])[ t)
-  {
-    static
-    const token_number_type
-    translate_table[] =
-    {
-]b4_translate[
-    };
-    const unsigned int user_token_number_max_ = ]b4_user_token_number_max[;
-    const token_number_type undef_token_ = ]b4_undef_token_number[;
-
-    if (static_cast<int>(t) <= yyeof_)
-      return yyeof_;
-    else if (static_cast<unsigned int> (t) <= user_token_number_max_)
-      return translate_table[t];
-    else
-      return undef_token_;
-  }
-]])
-
-
 m4_pushdef([b4_copyright_years],
            [2002, 2003, 2004, 2005, 2006, 2007, 2008])