]> granicus.if.org Git - re2c/commitdiff
Added tests that fail if mapping of TDFA states ignores version order.
authorUlya Trofimovich <skvadrik@gmail.com>
Thu, 9 Feb 2017 13:01:26 +0000 (13:01 +0000)
committerUlya Trofimovich <skvadrik@gmail.com>
Thu, 9 Feb 2017 13:01:26 +0000 (13:01 +0000)
These tests result in incorrect automaton unless mapping preserves
relative order of versions in TDFA states (respects version priority).

re2c/test/tags/map_ord1.i--tags--no-lookahead.c [new file with mode: 0644]
re2c/test/tags/map_ord1.i--tags--no-lookahead.re [new file with mode: 0644]
re2c/test/tags/map_ord1.i--tags.c [new file with mode: 0644]
re2c/test/tags/map_ord1.i--tags.re [new file with mode: 0644]
re2c/test/tags/map_ord2.i--tags--no-lookahead.c [new file with mode: 0644]
re2c/test/tags/map_ord2.i--tags--no-lookahead.re [new file with mode: 0644]
re2c/test/tags/map_ord2.i--tags.c [new file with mode: 0644]
re2c/test/tags/map_ord2.i--tags.re [new file with mode: 0644]

diff --git a/re2c/test/tags/map_ord1.i--tags--no-lookahead.c b/re2c/test/tags/map_ord1.i--tags--no-lookahead.c
new file mode 100644 (file)
index 0000000..cf67853
--- /dev/null
@@ -0,0 +1,51 @@
+/* Generated by re2c */
+// incorrect automaton if mapping of TDFA states ignores version order
+
+{
+       YYCTYPE yych;
+       yyt2 = NULL;
+       yyt1 = YYCURSOR;
+       if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
+       yych = *YYCURSOR;
+       switch (yych) {
+       case 'a':
+               ++YYCURSOR;
+               goto yy3;
+       default:        goto yy2;
+       }
+yy2:
+       t = yyt2;
+       {}
+yy3:
+       yych = *YYCURSOR;
+       switch (yych) {
+       case 'a':
+               ++YYCURSOR;
+               goto yy4;
+       default:
+               yyt2 = yyt1;
+               goto yy2;
+       }
+yy4:
+       yych = *YYCURSOR;
+       switch (yych) {
+       case 'a':
+               ++YYCURSOR;
+               goto yy5;
+       default:        goto yy2;
+       }
+yy5:
+       if (YYLIMIT <= YYCURSOR) YYFILL(1);
+       yych = *YYCURSOR;
+       switch (yych) {
+       case 'a':
+               ++YYCURSOR;
+               goto yy5;
+       default:
+               yyt2 = yyt1;
+               goto yy2;
+       }
+}
+
+re2c: warning: line 4: rule matches empty string [-Wmatch-empty-string]
+re2c: warning: line 4: tag 't' is non-deterministic and induces 2 parallel instances [-Wnondeterministic-tags]
diff --git a/re2c/test/tags/map_ord1.i--tags--no-lookahead.re b/re2c/test/tags/map_ord1.i--tags--no-lookahead.re
new file mode 100644 (file)
index 0000000..fc42a33
--- /dev/null
@@ -0,0 +1,6 @@
+// incorrect automaton if mapping of TDFA states ignores version order
+/*!re2c
+
+(@t "a")? ("aa""a"?)* {}
+
+*/
diff --git a/re2c/test/tags/map_ord1.i--tags.c b/re2c/test/tags/map_ord1.i--tags.c
new file mode 100644 (file)
index 0000000..bcd17eb
--- /dev/null
@@ -0,0 +1,45 @@
+/* Generated by re2c */
+// incorrect automaton if mapping of TDFA states ignores version order
+
+{
+       YYCTYPE yych;
+       if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
+       yych = *YYCURSOR;
+       switch (yych) {
+       case 'a':
+               yyt2 = NULL;
+               yyt1 = YYCURSOR;
+               goto yy3;
+       default:
+               yyt1 = NULL;
+               goto yy2;
+       }
+yy2:
+       t = yyt1;
+       {}
+yy3:
+       yych = *++YYCURSOR;
+       switch (yych) {
+       case 'a':       goto yy4;
+       default:        goto yy2;
+       }
+yy4:
+       yych = *++YYCURSOR;
+       switch (yych) {
+       case 'a':       goto yy5;
+       default:
+               yyt1 = yyt2;
+               goto yy2;
+       }
+yy5:
+       ++YYCURSOR;
+       if (YYLIMIT <= YYCURSOR) YYFILL(1);
+       yych = *YYCURSOR;
+       switch (yych) {
+       case 'a':       goto yy5;
+       default:        goto yy2;
+       }
+}
+
+re2c: warning: line 4: rule matches empty string [-Wmatch-empty-string]
+re2c: warning: line 4: tag 't' is non-deterministic and induces 2 parallel instances [-Wnondeterministic-tags]
diff --git a/re2c/test/tags/map_ord1.i--tags.re b/re2c/test/tags/map_ord1.i--tags.re
new file mode 100644 (file)
index 0000000..fc42a33
--- /dev/null
@@ -0,0 +1,6 @@
+// incorrect automaton if mapping of TDFA states ignores version order
+/*!re2c
+
+(@t "a")? ("aa""a"?)* {}
+
+*/
diff --git a/re2c/test/tags/map_ord2.i--tags--no-lookahead.c b/re2c/test/tags/map_ord2.i--tags--no-lookahead.c
new file mode 100644 (file)
index 0000000..91a0ce7
--- /dev/null
@@ -0,0 +1,98 @@
+/* Generated by re2c */
+// incorrect automaton if mapping of TDFA states ignores version order
+
+{
+       YYCTYPE yych;
+       yyt2 = NULL;
+       yyt1 = YYCURSOR;
+       if ((YYLIMIT - YYCURSOR) < 8) YYFILL(8);
+       yych = *(YYMARKER = YYCURSOR);
+       switch (yych) {
+       case 'a':
+               ++YYCURSOR;
+               goto yy3;
+       default:        goto yy2;
+       }
+yy2:
+       t = yyt2;
+       {}
+yy3:
+       yych = *YYCURSOR;
+       switch (yych) {
+       case 'a':
+               ++YYCURSOR;
+               goto yy5;
+       default:        goto yy4;
+       }
+yy4:
+       YYCURSOR = YYMARKER;
+       goto yy2;
+yy5:
+       yych = *YYCURSOR;
+       switch (yych) {
+       case 'a':
+               ++YYCURSOR;
+               goto yy6;
+       default:
+               yyt2 = yyt1;
+               goto yy2;
+       }
+yy6:
+       yych = *YYCURSOR;
+       switch (yych) {
+       case 'a':
+               ++YYCURSOR;
+               goto yy7;
+       default:        goto yy2;
+       }
+yy7:
+       yych = *YYCURSOR;
+       switch (yych) {
+       case 'a':
+               ++YYCURSOR;
+               goto yy8;
+       default:        goto yy2;
+       }
+yy8:
+       yych = *YYCURSOR;
+       switch (yych) {
+       case 'a':
+               ++YYCURSOR;
+               goto yy9;
+       default:
+               yyt2 = yyt1;
+               goto yy2;
+       }
+yy9:
+       yych = *YYCURSOR;
+       switch (yych) {
+       case 'a':
+               ++YYCURSOR;
+               goto yy10;
+       default:
+               yyt2 = yyt1;
+               goto yy2;
+       }
+yy10:
+       yych = *YYCURSOR;
+       switch (yych) {
+       case 'a':
+               ++YYCURSOR;
+               goto yy11;
+       default:        goto yy2;
+       }
+yy11:
+       if (YYLIMIT <= YYCURSOR) YYFILL(1);
+       yych = *YYCURSOR;
+       switch (yych) {
+       case 'a':
+               ++YYCURSOR;
+               goto yy11;
+       default:
+               yyt2 = yyt1;
+               goto yy2;
+       }
+}
+
+re2c: warning: line 4: rule matches empty string [-Wmatch-empty-string]
+re2c: warning: line 4: tag 't' is non-deterministic and induces 2 parallel instances [-Wnondeterministic-tags]
diff --git a/re2c/test/tags/map_ord2.i--tags--no-lookahead.re b/re2c/test/tags/map_ord2.i--tags--no-lookahead.re
new file mode 100644 (file)
index 0000000..e108451
--- /dev/null
@@ -0,0 +1,6 @@
+// incorrect automaton if mapping of TDFA states ignores version order
+/*!re2c
+
+(@t "aa")? ("a"?"aaa")* {}
+
+*/
diff --git a/re2c/test/tags/map_ord2.i--tags.c b/re2c/test/tags/map_ord2.i--tags.c
new file mode 100644 (file)
index 0000000..4354280
--- /dev/null
@@ -0,0 +1,83 @@
+/* Generated by re2c */
+// incorrect automaton if mapping of TDFA states ignores version order
+
+{
+       YYCTYPE yych;
+       if ((YYLIMIT - YYCURSOR) < 8) YYFILL(8);
+       yych = *(YYMARKER = YYCURSOR);
+       switch (yych) {
+       case 'a':
+               yyt2 = NULL;
+               yyt1 = YYCURSOR;
+               goto yy3;
+       default:
+               yyt1 = NULL;
+               goto yy2;
+       }
+yy2:
+       t = yyt1;
+       {}
+yy3:
+       yych = *++YYCURSOR;
+       switch (yych) {
+       case 'a':       goto yy5;
+       default:        goto yy4;
+       }
+yy4:
+       YYCURSOR = YYMARKER;
+       yyt1 = NULL;
+       goto yy2;
+yy5:
+       yych = *++YYCURSOR;
+       switch (yych) {
+       case 'a':       goto yy6;
+       default:        goto yy2;
+       }
+yy6:
+       yych = *++YYCURSOR;
+       switch (yych) {
+       case 'a':       goto yy7;
+       default:
+               yyt1 = yyt2;
+               goto yy2;
+       }
+yy7:
+       yych = *++YYCURSOR;
+       switch (yych) {
+       case 'a':       goto yy8;
+       default:
+               yyt1 = yyt2;
+               goto yy2;
+       }
+yy8:
+       yych = *++YYCURSOR;
+       switch (yych) {
+       case 'a':       goto yy9;
+       default:        goto yy2;
+       }
+yy9:
+       yych = *++YYCURSOR;
+       switch (yych) {
+       case 'a':       goto yy10;
+       default:        goto yy2;
+       }
+yy10:
+       yych = *++YYCURSOR;
+       switch (yych) {
+       case 'a':       goto yy11;
+       default:
+               yyt1 = yyt2;
+               goto yy2;
+       }
+yy11:
+       ++YYCURSOR;
+       if (YYLIMIT <= YYCURSOR) YYFILL(1);
+       yych = *YYCURSOR;
+       switch (yych) {
+       case 'a':       goto yy11;
+       default:        goto yy2;
+       }
+}
+
+re2c: warning: line 4: rule matches empty string [-Wmatch-empty-string]
+re2c: warning: line 4: tag 't' is non-deterministic and induces 2 parallel instances [-Wnondeterministic-tags]
diff --git a/re2c/test/tags/map_ord2.i--tags.re b/re2c/test/tags/map_ord2.i--tags.re
new file mode 100644 (file)
index 0000000..e108451
--- /dev/null
@@ -0,0 +1,6 @@
+// incorrect automaton if mapping of TDFA states ignores version order
+/*!re2c
+
+(@t "aa")? ("a"?"aaa")* {}
+
+*/