[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] b4_symbol/type_foreach.
From: |
Akim Demaille |
Subject: |
[PATCH] b4_symbol/type_foreach. |
Date: |
Thu, 27 Nov 2008 22:20:11 +0100 |
* data/lalr1.cc (b4_symbol_foreach, b4_type_foreach): New.
Use them.
---
ChangeLog | 6 ++++++
data/lalr1.cc | 26 ++++++++++++++++++++------
2 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index bb18059..6f48b0e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2008-12-01 Akim Demaille <address@hidden>
+ b4_symbol/type_foreach.
+ * data/lalr1.cc (b4_symbol_foreach, b4_type_foreach): New.
+ Use them.
+
+2008-12-01 Akim Demaille <address@hidden>
+
Use the symbol properties to output the printer/destructor for lalr1.cc.
Instead of defining complex list of tuples to define various properties
of
the symbols, we now prefer to define symbols as "structs" in m4: using
the
diff --git a/data/lalr1.cc b/data/lalr1.cc
index 76a0bcf..667a464 100644
--- a/data/lalr1.cc
+++ b/data/lalr1.cc
@@ -189,6 +189,20 @@ m4_define([b4_symbol_case_],
])
+# b4_symbol_foreach(MACRO)
+# ------------------------
+# Invoke MACRO(SYMBOL-NUM) for each SYMBOL-NUM.
+m4_define([b4_symbol_foreach],
+ [m4_map([$1], m4_defn([b4_symbol_numbers]))])
+
+# b4_type_foreach(MACRO)
+# ----------------------
+# Invoke MACRO(SYMBOL-NUMS) for each set of SYMBOL-NUMS for each type set.
+m4_define([b4_type_foreach],
+ [m4_map([$1], m4_defn([b4_type_names]))])
+
+
+
# b4_type_action_(NUMS)
# ---------------------
# Run actions for the symbol NUMS that all have the same type-name.
@@ -227,7 +241,7 @@ b4_args(b4_symbol_if([$1], [has_type],
m4_define([b4_symbol_constructor_declarations],
[b4_variant_if([
// Symbol constructors declarations.
-m4_map([b4_symbol_constructor_declaration_], m4_defn([b4_symbol_numbers]))])])
+b4_symbol_foreach([b4_symbol_constructor_declaration_])])])
@@ -346,7 +360,7 @@ m4_define([b4_symbol_constructor_definitions],
]b4_variant_if(
[ // Implementation of make_symbol for each symbol type.
-m4_map([b4_symbol_constructor_definition_], m4_defn([b4_symbol_numbers]))])])
+b4_symbol_foreach([b4_symbol_constructor_definition_])])])
# b4_symbol_variant(YYTYPE, YYVAL, ACTION, [ARGS])
@@ -358,7 +372,7 @@ m4_define([b4_symbol_variant],
[$2.$3< $][3 >(m4_shift3($@))])dnl
switch ($1)
{
-m4_map([b4_type_action_], m4_defn([b4_type_names]))[]dnl
+b4_type_foreach([b4_type_action_])[]dnl
default:
break;
}
@@ -619,7 +633,7 @@ do {
\
]b4_variant_if(
[ /// An auxiliary type to compute the largest semantic type.
union union_type
- {]m4_map([b4_char_sizeof], m4_defn([b4_type_names]))[};
+ {]b4_type_foreach([b4_char_sizeof])[};
/// Symbol semantic values.
typedef variant<sizeof(union_type)> semantic_type;],
@@ -1037,7 +1051,7 @@ b4_percent_code_get[]dnl
// User destructor.
switch (yytype)
{
-]m4_map([b4_symbol_destructor], m4_defn([b4_symbol_numbers]))dnl
+]b4_symbol_foreach([b4_symbol_destructor])dnl
[ default:
break;
}]b4_variant_if([
@@ -1058,7 +1072,7 @@ b4_percent_code_get[]dnl
<< yysym.location << ": "])[;
switch (yytype)
{
-]m4_map([b4_symbol_printer], m4_defn([b4_symbol_numbers]))dnl
+]b4_symbol_foreach([b4_symbol_printer])dnl
[ default:
break;
}
--
1.6.0.4.790.gaa14a
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] b4_symbol/type_foreach.,
Akim Demaille <=