b4_args is more general than only C++.

* data/lalr1.cc (b4_args, _b4_args): Move to...
	* data/bison.m4: here.
This commit is contained in:
Akim Demaille
2008-11-21 21:41:47 +01:00
parent 4182a0a186
commit e0c653e7e6
3 changed files with 29 additions and 21 deletions

View File

@@ -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. ##