--- /dev/null
+/* Generated by re2c */
+// Rules are the same except for the tag in the 2nd case.
+// In the 1st case common tail "a" is deduplicated after DFA minimization.
+// In the 2nd case tag prevents minimization.
+
+
+{
+ YYCTYPE yych;
+ if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
+ yych = *YYCURSOR;
+ switch (yych) {
+ case 'b':
+ case 'c': goto yy4;
+ default: goto yy2;
+ }
+yy2:
+ ++YYCURSOR;
+yy3:
+ {}
+yy4:
+ yych = *++YYCURSOR;
+ switch (yych) {
+ case 'a': goto yy5;
+ default: goto yy3;
+ }
+yy5:
+ ++YYCURSOR;
+ {}
+}
+
+
+
+{
+ YYCTYPE yych;
+ long yytag0p;
+ YYCTXMARKER = YYCURSOR;
+ if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
+ yych = *YYCURSOR;
+ switch (yych) {
+ case 'b': goto yy11;
+ case 'c': goto yy12;
+ default: goto yy9;
+ }
+yy9:
+ ++YYCURSOR;
+yy10:
+ {}
+yy11:
+ yych = *++YYCURSOR;
+ switch (yych) {
+ case 'a':
+ yytag0p = (YYCURSOR - YYCTXMARKER);
+ goto yy13;
+ default: goto yy10;
+ }
+yy12:
+ yych = *++YYCURSOR;
+ switch (yych) {
+ case 'a': goto yy13;
+ default: goto yy10;
+ }
+yy13:
+ ++YYCURSOR;
+ { (YYCTXMARKER + yytag0p) }
+}
+
--- /dev/null
+// Rules are the same except for the tag in the 2nd case.
+// In the 1st case common tail "a" is deduplicated after DFA minimization.
+// In the 2nd case tag prevents minimization.
+
+/*!re2c
+ "ba" | "ca" {}
+ * {}
+*/
+
+/*!re2c
+ re2c:flags:tags = 1;
+ "b" @p "a" | "ca" { @p }
+ * {}
+*/
--- /dev/null
+re2c: error: line 2: tag 'p' is nondeterministic [-Werror-nondeterministic-tags]
--- /dev/null
+/*!re2c
+ "a" @p | "a" { @p }
+ * {}
+*/
--- /dev/null
+re2c: error: line 2: tag 'p' is nondeterministic [-Werror-nondeterministic-tags]
--- /dev/null
+/*!re2c
+ @p "a" | "a" { @p }
+ * {}
+*/
--- /dev/null
+re2c: error: line 2: tag 'p' is nondeterministic [-Werror-nondeterministic-tags]
--- /dev/null
+/*!re2c
+ "a"+ @p "a"+ { @p }
+ * {}
+*/
--- /dev/null
+re2c: error: line 7: trailing context is nondeterministic [-Werror-nondeterministic-tags]
+re2c: warning: line 13: trailing context is nondeterministic [-Wnondeterministic-tags]
--- /dev/null
+// The same rules, nondeterministic trailing context, with different configurations:
+// 1. tags: error
+// 2. no tags: warning
+
+/*!re2c
+ re2c:flags:tags = 1;
+ "a"+ / "a"+ {}
+ * {}
+*/
+
+/*!re2c
+ re2c:flags:tags = 0;
+ "a"+ / "a"+ {}
+ * {}
+*/
--- /dev/null
+/* Generated by re2c */
+// The same rules, fixed length trailing context, with different configurations:
+// 1. default input API, no tags: no warning (no variable, static offset)
+// 2. default input API, tags: no warning (no variable, static offset)
+// 3. generic input API, no tags: warning (need variable: lack API to to make use of fixed length)
+// 4. generic input API, tags: no warning (no variable, static offset)
+
+
+{
+ YYCTYPE yych;
+ if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
+ yych = *YYCURSOR;
+ switch (yych) {
+ case 'a': goto yy4;
+ default: goto yy2;
+ }
+yy2:
+ ++YYCURSOR;
+yy3:
+ {}
+yy4:
+ yych = *++YYCURSOR;
+ switch (yych) {
+ case 'a': goto yy5;
+ default: goto yy3;
+ }
+yy5:
+ ++YYCURSOR;
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ switch (yych) {
+ case 'a': goto yy5;
+ default: goto yy7;
+ }
+yy7:
+ YYCURSOR -= 1;
+ {}
+}
+
+
+
+{
+ YYCTYPE yych;
+ YYCTXMARKER = YYCURSOR;
+ if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
+ yych = *YYCURSOR;
+ switch (yych) {
+ case 'a': goto yy12;
+ default: goto yy10;
+ }
+yy10:
+ ++YYCURSOR;
+yy11:
+ {}
+yy12:
+ yych = *++YYCURSOR;
+ switch (yych) {
+ case 'a': goto yy13;
+ default: goto yy11;
+ }
+yy13:
+ ++YYCURSOR;
+ if (YYLIMIT <= YYCURSOR) YYFILL(1);
+ yych = *YYCURSOR;
+ switch (yych) {
+ case 'a': goto yy13;
+ default: goto yy15;
+ }
+yy15:
+ YYCURSOR -= 1;
+ {}
+}
+
+
+
+{
+ YYCTYPE yych;
+ if (YYLESSTHAN (2)) YYFILL(2);
+ yych = YYPEEK ();
+ switch (yych) {
+ case 'a': goto yy20;
+ default: goto yy18;
+ }
+yy18:
+ YYSKIP ();
+yy19:
+ {}
+yy20:
+ YYSKIP ();
+ yych = YYPEEK ();
+ switch (yych) {
+ case 'a':
+ YYBACKUPCTX ();
+ goto yy21;
+ default: goto yy19;
+ }
+yy21:
+ YYSKIP ();
+ if (YYLESSTHAN (1)) YYFILL(1);
+ yych = YYPEEK ();
+ switch (yych) {
+ case 'a':
+ YYBACKUPCTX ();
+ goto yy21;
+ default: goto yy23;
+ }
+yy23:
+ YYRESTORECTX ();
+ {}
+}
+
+
+
+{
+ YYCTYPE yych;
+ YYBACKUPCTX ();
+ if (YYLESSTHAN (2)) YYFILL(2);
+ yych = YYPEEK ();
+ switch (yych) {
+ case 'a': goto yy28;
+ default: goto yy26;
+ }
+yy26:
+ YYSKIP ();
+yy27:
+ {}
+yy28:
+ YYSKIP ();
+ yych = YYPEEK ();
+ switch (yych) {
+ case 'a': goto yy29;
+ default: goto yy27;
+ }
+yy29:
+ YYSKIP ();
+ if (YYLESSTHAN (1)) YYFILL(1);
+ yych = YYPEEK ();
+ switch (yych) {
+ case 'a': goto yy29;
+ default: goto yy31;
+ }
+yy31:
+ YYRESTORECTX (YYDIST() - 1);
+ {}
+}
+
+re2c: warning: line 24: trailing context is nondeterministic [-Wnondeterministic-tags]
--- /dev/null
+// The same rules, fixed length trailing context, with different configurations:
+// 1. default input API, no tags: no warning (no variable, static offset)
+// 2. default input API, tags: no warning (no variable, static offset)
+// 3. generic input API, no tags: warning (need variable: lack API to to make use of fixed length)
+// 4. generic input API, tags: no warning (no variable, static offset)
+
+/*!re2c
+ re2c:flags:input = default;
+ re2c:flags:tags = 0;
+ "a"+ / "a" {}
+ * {}
+*/
+
+/*!re2c
+ re2c:flags:input = default;
+ re2c:flags:tags = 1;
+ "a"+ / "a" {}
+ * {}
+*/
+
+/*!re2c
+ re2c:flags:input = custom;
+ re2c:flags:tags = 0;
+ "a"+ / "a" {}
+ * {}
+*/
+
+/*!re2c
+ re2c:flags:input = custom;
+ re2c:flags:tags = 1;
+ "a"+ / "a" {}
+ * {}
+*/
--- /dev/null
+re2c: error: line 4: tag 'p' is nondeterministic [-Werror-nondeterministic-tags]
--- /dev/null
+// Tag is nondeterministic: fixed length helps only in top-level
+
+/*!re2c
+ "a"+ @p "a" | "b" { @p }
+ * {}
+*/
+++ /dev/null
-re2c: error: line 13: tag 'p1' is nondeterministic [-Werror-nondeterministic-tags]
+++ /dev/null
-#include <stddef.h>
-#include <stdio.h>
-
-static void lex(const char *YYCURSOR)
-{
- const char *YYMARKER;
- const char *YYCTXMARKER;
- /*!re2c
- re2c:define:YYCTYPE = char;
- re2c:yyfill:enable = 0;
-
- * { printf("error\n"); return; }
- "a"+ @p1 "a"+ {
- printf("'%.*s', '%.*s'\n",
- @p1 - YYCTXMARKER, YYCTXMARKER,
- YYCURSOR - @p1, @p1);
- return;
- }
- */
-}
-
-int main(int argc, char **argv)
-{
- for (int i = 1; i < argc; ++i) {
- lex(argv[i]);
- }
- return 0;
-}
+++ /dev/null
-re2c: error: line 13: trailing context is nondeterministic [-Werror-nondeterministic-tags]
+++ /dev/null
-#include <stddef.h>
-#include <stdio.h>
-
-static void lex(const char *YYCURSOR)
-{
- const char *YYMARKER;
- const char *YYCTXMARKER;
- /*!re2c
- re2c:define:YYCTYPE = char;
- re2c:yyfill:enable = 0;
-
- * { printf("error\n"); return; }
- "" @p0 "a"+ / "a"+ {
- printf("'%.*s', '%s'\n",
- YYCURSOR - @p0, @p0,
- YYCURSOR);
- return;
- }
- */
-}
-
-int main(int argc, char **argv)
-{
- for (int i = 1; i < argc; ++i) {
- lex(argv[i]);
- }
- return 0;
-}
+++ /dev/null
-/* Generated by re2c */
-#include <stddef.h>
-#include <stdio.h>
-
-static void lex(const char *YYCURSOR)
-{
- const char *YYCTXMARKER;
- const char *token = YYCURSOR;
-
-{
- char yych;
- yych = *YYCURSOR;
- switch (yych) {
- case 'a': goto yy4;
- default: goto yy2;
- }
-yy2:
- ++YYCURSOR;
-yy3:
- { printf("error\n"); return; }
-yy4:
- yych = *++YYCURSOR;
- switch (yych) {
- case 'a':
- YYCTXMARKER = YYCURSOR;
- goto yy5;
- default: goto yy3;
- }
-yy5:
- ++YYCURSOR;
- yych = *YYCURSOR;
- switch (yych) {
- case 'a':
- YYCTXMARKER = YYCURSOR;
- goto yy5;
- default: goto yy7;
- }
-yy7:
- YYCURSOR = YYCTXMARKER;
- {
- printf("'%.*s', '%s'\n",
- YYCURSOR - token, token,
- YYCURSOR);
- return;
- }
-}
-
-}
-
-int main(int argc, char **argv)
-{
- for (int i = 1; i < argc; ++i) {
- lex(argv[i]);
- }
- return 0;
-}
-re2c: warning: line 13: trailing context is nondeterministic [-Wnondeterministic-tags]
+++ /dev/null
-#include <stddef.h>
-#include <stdio.h>
-
-static void lex(const char *YYCURSOR)
-{
- const char *YYCTXMARKER;
- const char *token = YYCURSOR;
- /*!re2c
- re2c:define:YYCTYPE = char;
- re2c:yyfill:enable = 0;
-
- * { printf("error\n"); return; }
- "a"+ / "a"+ {
- printf("'%.*s', '%s'\n",
- YYCURSOR - token, token,
- YYCURSOR);
- return;
- }
- */
-}
-
-int main(int argc, char **argv)
-{
- for (int i = 1; i < argc; ++i) {
- lex(argv[i]);
- }
- return 0;
-}