[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] b4_public_types_declare.
From: |
Akim Demaille |
Subject: |
[PATCH] b4_public_types_declare. |
Date: |
Mon, 02 Mar 2009 15:15:31 -0000 |
* data/c++.m4 (b4_public_types_declare): New.
* data/glr.cc, data/lalr1.cc: Use it.
---
ChangeLog | 6 ++++++
data/c++.m4 | 21 +++++++++++++++++++++
data/glr.cc | 15 +--------------
data/lalr1.cc | 16 +---------------
4 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index bcf7128..59757bc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2009-03-02 Akim Demaille <address@hidden>
+ 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 <address@hidden>
+
b4_semantic_type_declare.
* data/c++.m4 (b4_semantic_type_declare): New.
Factors and generalizes what was in glr.cc and lalr1.cc.
diff --git a/data/c++.m4 b/data/c++.m4
index a64c740..3f16d4e 100644
--- a/data/c++.m4
+++ b/data/c++.m4
@@ -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],
diff --git a/data/glr.cc b/data/glr.cc
index 5cad0b1..dada42c 100644
--- a/data/glr.cc
+++ b/data/glr.cc
@@ -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[);
diff --git a/data/lalr1.cc b/data/lalr1.cc
index 2244108..e3e0f9a 100644
--- a/data/lalr1.cc
+++ b/data/lalr1.cc
@@ -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[ ();
--
1.6.2.rc0.35.g1b53
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] b4_public_types_declare.,
Akim Demaille <=