aboutsummaryrefslogtreecommitdiffstats
path: root/testcases-narg
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-04-07 22:07:39 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-04-07 22:07:39 -0700
commit768e1ae91c76af878dbbd93833ad49ae98da6260 (patch)
treea697790e2e263837e426a1b9310782358f1c0a3f /testcases-narg
parent3c3991533abf3d32606f11016cfaf94aa0a85235 (diff)
downloadcppawk-768e1ae91c76af878dbbd93833ad49ae98da6260.tar.gz
cppawk-768e1ae91c76af878dbbd93833ad49ae98da6260.tar.bz2
cppawk-768e1ae91c76af878dbbd93833ad49ae98da6260.zip
narg: new variexpand macro.
Diffstat (limited to 'testcases-narg')
-rw-r--r--testcases-narg13
1 files changed, 13 insertions, 0 deletions
diff --git a/testcases-narg b/testcases-narg
index 9f8f55c..97baac1 100644
--- a/testcases-narg
+++ b/testcases-narg
@@ -70,3 +70,16 @@ done
echo okay
:
okay
+--
+7:
+$cppawk '
+#include <narg.h>
+#define first(x, i) x ## i
+#define rest(prev, x, i) prev : x ## i
+#define colonize(...) [variexpand(first, rest, __VA_ARGS__)]
+#define str(x) #x
+#define xstr(x) str(x)
+#define scolonize(...) xstr(colonize(__VA_ARGS__))
+BEGIN { print scolonize(a), scolonize(a, b), scolonize(a, b, c) }'
+:
+[a1] [a1 : b2] [a1 : b2 : c3]