bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] b4_args is more general than only C++.


From: Akim Demaille
Subject: [PATCH] b4_args is more general than only C++.
Date: Fri, 21 Nov 2008 21:41:47 +0100

        * data/lalr1.cc (b4_args, _b4_args): Move to...
        * data/bison.m4: here.
---
 ChangeLog     |    6 ++++++
 data/bison.m4 |   23 +++++++++++++++++++++++
 data/lalr1.cc |   21 ---------------------
 3 files changed, 29 insertions(+), 21 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7b3358c..31560f1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-11-25  Akim Demaille  <address@hidden>
+
+       b4_args is more general than only C++.
+       * data/lalr1.cc (b4_args, _b4_args): Move to...
+       * data/bison.m4: here.
+
 2008-11-21  Di-an Jan  <address@hidden>
 
        Implement no-XXX arguments for --warnings, --report, --trace.
diff --git a/data/bison.m4 b/data/bison.m4
index c7392b3..e7376c6 100644
--- a/data/bison.m4
+++ b/data/bison.m4
@@ -221,6 +221,29 @@ m4_define([b4_subtract],
            [m4_eval([$1 - $2])],
            [($1) - ($2)])])
 
+# b4_args(ARG1, ...)
+# _b4_args(ARG1, ...)
+# -------------------
+# Join with comma, skipping empty arguments.
+# b4_args calls itself recursively until it sees the first non-empty
+# argument, then calls _b4_args which prepends each non-empty argument
+# with a comma.
+m4_define([b4_args],
+[m4_if([$#$1],
+       [1], [],
+       [m4_ifval([$1],
+                 [$1[]_$0(m4_shift($@))],
+                 [$0(m4_shift($@))])])])
+
+# _b4_args(ARGS1, ...)
+# --------------------
+m4_define([_b4_args],
+[m4_if([$#$1],
+       [1], [],
+       [m4_ifval([$1], [, $1])[]$0(m4_shift($@))])])
+
+
+
 
 ## ------------------ ##
 ## Decoding options.  ##
diff --git a/data/lalr1.cc b/data/lalr1.cc
index 58ebe94..4043090 100644
--- a/data/lalr1.cc
+++ b/data/lalr1.cc
@@ -18,27 +18,6 @@
 
 m4_include(b4_pkgdatadir/[c++.m4])
 
-# b4_args(ARG1, ...)
-# _b4_args(ARG1, ...)
-# -------------------
-# Join with comma, skipping empty arguments.
-# b4_args calls itself recursively until it sees the first non-empty
-# argument, then calls _b4_args which prepends each non-empty argument
-# with a comma.
-m4_define([b4_args],
-[m4_if([$#$1],
-       [1], [],
-       [m4_ifval([$1],
-                 [$1[]_$0(m4_shift($@))],
-                 [$0(m4_shift($@))])])])
-
-# _b4_args(ARGS1, ...)
-# --------------------
-m4_define([_b4_args],
-[m4_if([$#$1],
-       [1], [],
-       [m4_ifval([$1], [, $1])[]$0(m4_shift($@))])])
-
 
 # b4_table_define(TABLE-NAME, CONTENT)
 # ------------------------------------
-- 
1.6.0.2.588.g3102





reply via email to

[Prev in Thread] Current Thread [Next in Thread]