summaryrefslogtreecommitdiff
path: root/tests/quotes.l
diff options
context:
space:
mode:
Diffstat (limited to 'tests/quotes.l')
-rw-r--r--tests/quotes.l38
1 files changed, 34 insertions, 4 deletions
diff --git a/tests/quotes.l b/tests/quotes.l
index c1386c3..d1b97eb 100644
--- a/tests/quotes.l
+++ b/tests/quotes.l
@@ -38,6 +38,7 @@
#include <stdio.h>
#include <stdlib.h>
#include "config.h"
+#include <assert.h>
/*#include "parser.h" */
/* sect 1 block [ 1 ] TEST_XXX */
@@ -61,6 +62,17 @@ static int foo (int i){
%%
+ /* indented code [ 1 ] */
+ /* indented code [[ 2 ]] */
+ /* indented code [[[ 3 ]]] */
+ /* indented code [[[[ 4 ]]]] */
+ /* indented code ]] unmatched [[ */
+%{
+// non-indented code [ 1 ]
+// non-indented code [[ 2 ]]
+// non-indented code [[[ 3 ]]]
+// non-indented code [[[[ 4 ]]]]
+%}
a /* action comment [ 1 ] */ ;
b /* action comment [[ 2 ]] */ ;
@@ -68,13 +80,27 @@ c /* action comment [[[ 3 ]]] */ ;
d /* action comment [[[[ 4 ]]]] */ ;
e /* action comment ]] unmatched [[ */ ;
f return 1+foo(a[b[c[0]]]);
-.|\n {
+.|\n {
+
+#if 0
+ action code [ 1 ] TEST_XXX
+ action code [[ 2 ]] TEST_XXX
+ action code [[[ 3 ]]] TEST_XXX
+ action code [[[[ 4 ]]]] TEST_XXX
+ action code ]] unmatched [[ TEST_XXX
+#endif
/* action block [ 1 ] TEST_XXX */
/* action block [[ 2 ]] TEST_XXX */
/* action block [[[ 3 ]]] TEST_XXX */
/* action block [[[[ 4 ]]]] TEST_XXX */
/* action block ]] unmatched [[ TEST_XXX */
- return 1+foo(a[b[c[0]]]); // TEST_XXX
+ assert(!strcmp("[[ 2 ]]", "[""[ 2 ]""]"));
+ assert(!strcmp("[[[ 3 ]]]", "[""[""[ 3 ]""]""]"));
+ assert(!strcmp("[[[[ 4 ]]]]", "[""[""[""[ 4 ]""]""]""]"));
+ assert(!strcmp("]] unmatched [[", "]""] unmatched [""["));
+ assert(!strcmp("]]m4_define(alpha, beta)[[",
+ "]""]m4_""define(alpha, beta)[""["));
+ return 1+foo(a[b[c[0]]]); /* TEST_XXX */
}
%%
@@ -88,13 +114,17 @@ static int bar (int i){
}
int main(void);
+#define CONCAT_IDENTS(a, b) a##b
int
-main ()
+main (void)
{
- yyin = stdin;
+ /* m4_m4exit(100) */
+ FILE *M4_YY_NOT_IN_HEADER = stdin;
+ yyin = CONCAT_IDENTS(M4_, YY_NOT_IN_HEADER);
yyout = stdout;
while (yylex())
;
+ assert(!strcmp("YY_G( alpha)", "Y""Y_G( alpha)"));
printf("TEST RETURNING OK.\n");
return bar(0);
}