]> git.saurik.com Git - bison.git/commitdiff
b4_public_types_declare.
authorAkim Demaille <demaille@gostai.com>
Wed, 31 Dec 2008 12:46:02 +0000 (13:46 +0100)
committerAkim Demaille <demaille@gostai.com>
Mon, 2 Mar 2009 15:12:11 +0000 (16:12 +0100)
* data/c++.m4 (b4_public_types_declare): New.
* data/glr.cc, data/lalr1.cc: Use it.

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

index bcf7128490bcba0fb8e74dd8cbe2ce0b8dc6b8f5..59757bca5a73195524630d19d2ef983cce3695df 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-03-02  Akim Demaille  <demaille@gostai.com>
+
+       b4_public_types_declare.
+       * data/c++.m4 (b4_public_types_declare): New.
+       * data/glr.cc, data/lalr1.cc: Use it.
+
 2009-03-02  Akim Demaille  <demaille@gostai.com>
 
        b4_semantic_type_declare.
index a64c740e9e655eaa396dd7eb2e54cad3dd92ff90..3f16d4ee8f7af0b59d5d4512b89b5493023fa4ce 100644 (file)
@@ -111,6 +111,27 @@ m4_ifdef([b4_stype],
 [[    typedef YYSTYPE semantic_type;]])])])
 
 
+# b4_public_types_declare
+# -----------------------
+# Define the public types: token, semantic value, location, and so forth.
+m4_define([b4_public_types_declare],
+[[#ifndef YYSTYPE
+]b4_semantic_type_declare[
+#else
+    typedef YYSTYPE semantic_type;
+#endif]b4_locations_if([
+    /// Symbol locations.
+    typedef b4_percent_define_get([[location_type]]) location_type;])[
+    /// Tokens.
+    struct token
+    {
+      ]b4_token_enums(b4_tokens)[
+    };
+    /// Token type.
+    typedef token::yytokentype token_type;
+]])
+
+
 # b4_variant_if([IF-VARIANT-ARE-USED], [IF-NOT])
 # ----------------------------------------------
 m4_define([b4_variant_if],
index 5cad0b169c60e5e3c0096a95ac561a2c433fc3ad..dada42c390933917c5cca9c04dde0ea1c940bf09 100644 (file)
@@ -266,20 +266,7 @@ b4_copyright([Skeleton interface for Bison GLR parsers in C++],
   class ]b4_parser_class_name[
   {
   public:
-#ifndef YYSTYPE
-]b4_semantic_type_declare[
-#else
-    typedef YYSTYPE semantic_type;
-#endif
-    /// Symbol locations.
-    typedef ]b4_percent_define_get([[location_type]])[ location_type;
-    /// Tokens.
-    struct token
-    {
-      ]b4_token_enums(b4_tokens)[
-    };
-    /// Token type.
-    typedef token::yytokentype token_type;
+]b4_public_types_declare[
 
     /// Build a parser object.
     ]b4_parser_class_name[ (]b4_parse_param_decl[);
index 2244108178564751d91e3456b45527554ccc1161..e3e0f9a6403b13fd557fdf8cabad26eba096e926 100644 (file)
@@ -388,21 +388,7 @@ do {                                                            \
   class ]b4_parser_class_name[
   {
   public:
-#ifndef YYSTYPE
-]b4_semantic_type_declare[
-#else
-    typedef YYSTYPE semantic_type;
-#endif]b4_locations_if([
-    /// Symbol locations.
-    typedef b4_percent_define_get([[location_type]]) location_type;])[
-    /// Tokens.
-    struct token
-    {
-      ]b4_token_enums(b4_tokens)[
-    };
-    /// Token type.
-    typedef token::yytokentype token_type;
-
+]b4_public_types_declare[
     /// Build a parser object.
     ]b4_parser_class_name[ (]b4_parse_param_decl[);
     virtual ~]b4_parser_class_name[ ();