From cbf768d67d5540681df5e6ea41fe1fb270c95eec Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sat, 16 Feb 2008 16:41:25 -0800 Subject: Implement %iftoken, test for a single token Implement %iftoken, a test for a single token. This is useful in cases using %+ to splice a macro-provided token. --- test/iftoken.pl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 test/iftoken.pl (limited to 'test/iftoken.pl') diff --git a/test/iftoken.pl b/test/iftoken.pl new file mode 100755 index 0000000..bbbb5bc --- /dev/null +++ b/test/iftoken.pl @@ -0,0 +1,19 @@ +#!/usr/bin/perl + +@list = ('1', '+1', '1 2', '1,2', 'foo', 'foo bar', '%', '+foo', '<<'); + +foreach $t (@list) { + print "\tdb 'N \"$t\": '\n"; + print "%iftoken $t\n"; + print "\tdb 'Yes', 10\n"; + print "%else\n"; + print "\tdb 'No', 10\n"; + print "%endif\n"; + + print "\tdb 'C \"$t\": '\n"; + print "%iftoken $t ; With a comment!\n"; + print "\tdb 'Yes', 10\n"; + print "%else\n"; + print "\tdb 'No', 10\n"; + print "%endif\n"; +} -- cgit v1.2.3