From: Akim Demaille Date: Fri, 3 May 2002 08:26:55 +0000 (+0000) Subject: * data/m4sugar/m4sugar.m4: Update from CVS Autoconf. X-Git-Tag: BISON-1_49b~254 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/1f41899519dcf9dd525b68035baf5bc5ed74efc6?ds=sidebyside * data/m4sugar/m4sugar.m4: Update from CVS Autoconf. --- diff --git a/ChangeLog b/ChangeLog index 25d8956d..147125c2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2002-05-03 Akim Demaille + + * data/m4sugar/m4sugar.m4: Update from CVS Autoconf. + 2002-05-02 Robert Anisko * data/bison.c++: Adapt expansion of $s and @s to the C++ parser. diff --git a/data/m4sugar/m4sugar.m4 b/data/m4sugar/m4sugar.m4 index bc965229..c2d3f7a8 100644 --- a/data/m4sugar/m4sugar.m4 +++ b/data/m4sugar/m4sugar.m4 @@ -422,8 +422,8 @@ m4_define([m4_bmatch], [m4_if([$#], 0, [], [$#], 1, [], [$#], 2, [$2], - m4_bregexp([$1], [$2]), -1, [$0([$1], m4_shiftn(3, $@))], - [$3])]) + [m4_if(m4_bregexp([$1], [$2]), -1, [$0([$1], m4_shiftn(3, $@))], + [$3])])]) # m4_map(MACRO, LIST) @@ -437,6 +437,20 @@ m4_define([m4_map], m4_map([$1], m4_cdr($2))])]) +# m4_map_sep(MACRO, SEPARATOR, LIST) +# ---------------------------------- +# Invoke MACRO($1), SEPARATOR, MACRO($2), ..., MACRO($N) where $1, $2... $N +# are the elements of LIST (which can be lists themselves, for multiple +# arguments MACROs). +m4_define([m4_map_sep], +[m4_if([$3], [[]], [], + [$1(m4_fst($3))[]dnl +m4_if(m4_cdr($3), + [[]], [], + [$2])[]dnl +m4_map_sep([$1], [$2], m4_cdr($3))])]) + + ## ---------------------------------------- ## ## 6. Enhanced version of some primitives. ## ## ---------------------------------------- ## @@ -469,7 +483,7 @@ m4_define([m4_bpatsubsts], # ------------------ # This macro invokes all its arguments (in sequence, of course). It is # useful for making your macros more structured and readable by dropping -# unecessary dnl's and have the macros indented properly. +# unnecessary dnl's and have the macros indented properly. m4_define([m4_do], [m4_if($#, 0, [], $#, 1, [$1], @@ -615,7 +629,7 @@ m4_if($1, [$2], [], # Implementing `foreach' loops in m4 is much more tricky than it may # seem. Actually, the example of a `foreach' loop in the m4 # documentation is wrong: it does not quote the arguments properly, -# which leads to undesired expansions. +# which leads to undesirable expansions. # # The example in the documentation is: # @@ -1484,7 +1498,7 @@ m4_define([m4_flatten], # of brackets around $1 (don't forget that the result must be quoted # too, hence one more quoting than applications). # -# Then notice the 2 last pattens: they are in charge of removing the +# Then notice the 2 last patterns: they are in charge of removing the # leading/trailing spaces. Why not just `[^ ]'? Because they are # applied to doubly quoted strings, i.e. more or less [[STRING]]. So # if there is a leading space in STRING, then it is the *third*