From: Ulya Trofimovich Date: Thu, 9 Feb 2017 13:01:26 +0000 (+0000) Subject: Added tests that fail if mapping of TDFA states ignores version order. X-Git-Tag: 1.0~39^2~134 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b87a3683f6265422b8912ffa4f14fac86445d42c;p=re2c Added tests that fail if mapping of TDFA states ignores version order. These tests result in incorrect automaton unless mapping preserves relative order of versions in TDFA states (respects version priority). --- 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 index 00000000..cf67853c --- /dev/null +++ b/re2c/test/tags/map_ord1.i--tags--no-lookahead.c @@ -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 index 00000000..fc42a33e --- /dev/null +++ b/re2c/test/tags/map_ord1.i--tags--no-lookahead.re @@ -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 index 00000000..bcd17eb5 --- /dev/null +++ b/re2c/test/tags/map_ord1.i--tags.c @@ -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 index 00000000..fc42a33e --- /dev/null +++ b/re2c/test/tags/map_ord1.i--tags.re @@ -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 index 00000000..91a0ce72 --- /dev/null +++ b/re2c/test/tags/map_ord2.i--tags--no-lookahead.c @@ -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 index 00000000..e1084512 --- /dev/null +++ b/re2c/test/tags/map_ord2.i--tags--no-lookahead.re @@ -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 index 00000000..43542802 --- /dev/null +++ b/re2c/test/tags/map_ord2.i--tags.c @@ -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 index 00000000..e1084512 --- /dev/null +++ b/re2c/test/tags/map_ord2.i--tags.re @@ -0,0 +1,6 @@ +// incorrect automaton if mapping of TDFA states ignores version order +/*!re2c + +(@t "aa")? ("a"?"aaa")* {} + +*/