1 /* Generated by re2c */ 2 // re2c $INPUT -o $OUTPUT -i 3 // In this example initial state coincides with fallback state 4 // which must update 'yyaccept'. There is a loop through initial 5 // state that changes 'yyaccept' value, so if the initial state 6 // forgets to update 'yyaccept', the wrong rule will match. 7 8 9 { 10 YYCTYPE yych; 11 unsigned int yyaccept = 0; 12 goto yy0; 13 yy1: 14 yyaccept = 0; 15 ++YYCURSOR; 16 yy0: 17 if (YYLIMIT <= YYCURSOR) YYFILL(1); 18 yych = *(YYMARKER = YYCURSOR); 19 switch (yych) { 20 case 'a': goto yy3; 21 default: goto yy2; 22 } 23 yy2: 24 { 1 } 25 yy3: 26 ++YYCURSOR; 27 if (YYLIMIT <= YYCURSOR) YYFILL(1); 28 yych = *YYCURSOR; 29 switch (yych) { 30 case 'b': goto yy5; 31 default: goto yy4; 32 } 33 yy4: 34 YYCURSOR = YYMARKER; 35 if (yyaccept == 0) { 36 goto yy2; 37 } else { 38 goto yy6; 39 } 40 yy5: 41 yyaccept = 1; 42 YYMARKER = ++YYCURSOR; 43 if (YYLIMIT <= YYCURSOR) YYFILL(1); 44 yych = *YYCURSOR; 45 switch (yych) { 46 case 'a': goto yy7; 47 default: goto yy6; 48 } 49 yy6: 50 { 2 } 51 yy7: 52 ++YYCURSOR; 53 if (YYLIMIT <= YYCURSOR) YYFILL(1); 54 yych = *YYCURSOR; 55 switch (yych) { 56 case 'b': goto yy1; 57 default: goto yy4; 58 } 59 } 60 61 yyaccept_initial.re:9:12: warning: rule matches empty string [-Wmatch-empty-string] 62 yyaccept_initial.re:10:12: warning: rule matches empty string [-Wmatch-empty-string] 63