]> git.saurik.com Git - bison.git/blobdiff - data/c++.m4
build: restore C90 compatibility
[bison.git] / data / c++.m4
index 87bc5e0dcf184ab5fc3bea00154c8ac8bbe36bab..b034a4a629e66bb33f5d980e26d982b5917544c0 100644 (file)
@@ -117,10 +117,10 @@ m4_define([b4_token_enums],
 # Declare semantic_type.
 m4_define([b4_semantic_type_declare],
 [    /// Symbol semantic values.
-m4_ifdef([b4_stype],
+m4_ifdef([b4_union_members],
 [    union semantic_type
     {
-b4_user_stype
+b4_user_union_members
     };],
 [m4_if(b4_tag_seen_flag, 0,
 [[    typedef int semantic_type;]],
@@ -180,10 +180,12 @@ m4_define([b4_public_types_declare],
 
       /// Copy constructor.
       basic_symbol (const basic_symbol& other);
-
+]b4_variant_if([[
+      /// Constructor for valueless symbols, and symbols from each type.
+]b4_type_foreach([b4_basic_symbol_constructor_declare])], [[
       /// Constructor for valueless symbols.
       basic_symbol (typename Base::kind_type t]b4_locations_if([,
-                    const location_type& l])[);
+                    const location_type& l])[);]])[
 
       /// Constructor for symbols with semantic value.
       basic_symbol (typename Base::kind_type t,
@@ -234,7 +236,6 @@ m4_define([b4_public_types_declare],
       enum { empty = 0 };
 
       /// The symbol type.
-      ///
       /// -1 when this symbol is empty.
       token_number_type type;
     };
@@ -288,6 +289,10 @@ m4_define([b4_public_types_define],
     (void) v;
     ]b4_symbol_variant([this->type_get ()], [value], [copy], [v])])[}
 
+]b4_variant_if([[
+  // Implementation of basic_symbol constructor for each type.
+]b4_type_foreach([b4_basic_symbol_constructor_define])], [[
+  /// Constructor for valueless symbols.
   template <typename Base>
   inline
   ]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join(
@@ -296,7 +301,7 @@ m4_define([b4_public_types_define],
     : Base (t)
     , value ()]b4_locations_if([
     , location (l)])[
-  {}
+  {}]])[
 
   template <typename Base>
   inline