From: helly Date: Sat, 8 Apr 2006 17:04:45 +0000 (+0000) Subject: - Do not generate yyaccept code unless needed X-Git-Tag: 0.13.6~428 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b1ecd49493add8d9703e2f701c1a50d0aa4d6f5b;p=re2c - Do not generate yyaccept code unless needed # The code block after the yyaccept blocks might now become dead blocks. # A real optimzing compiler would have found out anyway. So this only # increases readability. --- diff --git a/code.cc b/code.cc index 09ac04d0..fb38a711 100644 --- a/code.cc +++ b/code.cc @@ -440,6 +440,7 @@ void Accept::emit(std::ostream &o, uint ind, bool &readCh) const if (saves[i] != ~0u) { cases++; + bUsedYYAccept |= saves[i] != 0; } } @@ -450,9 +451,8 @@ void Accept::emit(std::ostream &o, uint ind, bool &readCh) const if (first) { first = false; - bUsedYYAccept = true; o << indent(ind) << "YYCURSOR = YYMARKER;\n"; - if (cases > 1) + if (bUsedYYAccept && cases > 1) { o << indent(ind) << "switch(yyaccept) {\n"; } @@ -465,13 +465,15 @@ void Accept::emit(std::ostream &o, uint ind, bool &readCh) const } else { - o << indent(ind) << "if (yyaccept == " << saves[i] << ") {\n"; - genGoTo(o, ++ind, state, rules[i], readCh); + if (bUsedYYAccept) { + o << indent(ind++) << "if (yyaccept == " << saves[i] << ") {\n"; + } + genGoTo(o, ind, state, rules[i], readCh); } } } - if (!first) + if (!first && bUsedYYAccept) { if (cases == 1) { diff --git a/test/bug1163046.c b/test/bug1163046.c index 658417f8..728d792b 100755 --- a/test/bug1163046.c +++ b/test/bug1163046.c @@ -19,7 +19,6 @@ next: #line 20 "" { YYCTYPE yych; - unsigned int yyaccept = 0; if((YYLIMIT - YYCURSOR) < 45) YYFILL(45); yych = *YYCURSOR; @@ -29,7 +28,6 @@ next: default: goto yy4; } yy2: - yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); switch(yych){ case 'T': @@ -39,7 +37,7 @@ yy2: yy3: #line 23 "bug1163046.re" { goto next; } -#line 43 "" +#line 41 "" yy4: yych = *++YYCURSOR; goto yy3; @@ -47,7 +45,7 @@ yy5: ++YYCURSOR; #line 25 "bug1163046.re" { return false; } -#line 51 "" +#line 49 "" yy7: yych = *++YYCURSOR; switch(yych){ @@ -57,9 +55,7 @@ yy7: } yy8: YYCURSOR = YYMARKER; - if (yyaccept == 0) { - goto yy3; - } + goto yy3; yy9: yych = *++YYCURSOR; switch(yych){ @@ -350,7 +346,7 @@ yy51: if (token == start || *(token - 1) == '\n') return true; else goto next; } -#line 354 "" +#line 350 "" } #line 26 "bug1163046.re" diff --git a/test/bug1187785.c b/test/bug1187785.c index 6c9377c2..6f98c17e 100755 --- a/test/bug1187785.c +++ b/test/bug1187785.c @@ -23,7 +23,6 @@ cont: #line 24 "" { YYCTYPE yych; - unsigned int yyaccept = 0; if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; @@ -32,7 +31,6 @@ cont: default: goto yy4; } yy2: - yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); switch(yych){ case 0x00: @@ -294,7 +292,7 @@ yy2: yy3: #line 23 "bug1187785.re" { goto cont; } -#line 298 "" +#line 296 "" yy4: yych = *++YYCURSOR; goto yy3; @@ -562,14 +560,12 @@ yy5: } yy7: YYCURSOR = YYMARKER; - if (yyaccept == 0) { - goto yy3; - } + goto yy3; yy8: ++YYCURSOR; #line 22 "bug1187785.re" { RET(1); } -#line 573 "" +#line 569 "" } #line 24 "bug1187785.re" diff --git a/test/bug1297658.c b/test/bug1297658.c index 3da905e8..b2a0cba8 100644 --- a/test/bug1297658.c +++ b/test/bug1297658.c @@ -60,7 +60,6 @@ std: #line 61 "" { YYCTYPE yych; - unsigned int yyaccept = 0; if((YYLIMIT - YYCURSOR) < 4) YYFILL(4); yych = *YYCURSOR; @@ -71,7 +70,6 @@ std: default: goto yy8; } yy2: - yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); switch(yych){ case '.': goto yy11; @@ -83,7 +81,7 @@ yy3: { RET(UNEXPECTED); } -#line 87 "" +#line 85 "" yy4: ++YYCURSOR; switch((yych = *YYCURSOR)) { @@ -96,7 +94,7 @@ yy5: { RET(FCON); } -#line 100 "" +#line 98 "" yy6: ++YYCURSOR; #line 66 "bug1297658.re" @@ -105,7 +103,7 @@ yy6: if(1||s.cur == s.eof) RET(EOI); goto std; } -#line 109 "" +#line 107 "" yy8: yych = *++YYCURSOR; goto yy3; @@ -136,9 +134,7 @@ yy12: } yy14: YYCURSOR = YYMARKER; - if (yyaccept == 0) { - goto yy3; - } + goto yy3; yy15: ++YYCURSOR; switch((yych = *YYCURSOR)) { diff --git a/test/bug1390174.c b/test/bug1390174.c index 121a7830..af80f0fa 100755 --- a/test/bug1390174.c +++ b/test/bug1390174.c @@ -18,7 +18,6 @@ const char *q; #line 19 "" { YYCTYPE yych; - unsigned int yyaccept = 0; if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; @@ -29,7 +28,6 @@ const char *q; default: goto yy6; } yy2: - yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); switch(yych){ case 0x0A: goto yy7; @@ -40,13 +38,13 @@ yy2: yy3: #line 19 "bug1390174.re" {RET(0);} -#line 44 "" +#line 42 "" yy4: ++YYCURSOR; yy5: #line 18 "bug1390174.re" {RET(1);} -#line 50 "" +#line 48 "" yy6: yych = *++YYCURSOR; goto yy3; @@ -65,9 +63,7 @@ yy8: } yy10: YYCURSOR = YYMARKER; - if (yyaccept == 0) { - goto yy3; - } + goto yy3; } #line 20 "bug1390174.re" diff --git a/test/cvsignore.b.c b/test/cvsignore.b.c index 2754312d..f5dd5916 100755 --- a/test/cvsignore.b.c +++ b/test/cvsignore.b.c @@ -77,12 +77,10 @@ loop: #line 78 "" { YYCTYPE yych; - unsigned int yyaccept = 0; if((YYLIMIT - YYCURSOR) < 11) YYFILL(11); yych = *YYCURSOR; if(yych != '$') goto yy4; - yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); switch(yych){ case 'D': goto yy10; @@ -95,7 +93,7 @@ loop: yy3: #line 53 "cvsignore.b.re" { output[outsize++] = cursor[-1]; if (cursor >= limit) break; goto loop; } -#line 99 "" +#line 97 "" yy4: yych = *++YYCURSOR; goto yy3; @@ -104,9 +102,7 @@ yy5: if(yych == 'o') goto yy44; yy6: YYCURSOR = YYMARKER; - if (yyaccept == 0) { - goto yy3; - } + goto yy3; yy7: yych = *++YYCURSOR; if(yych == 'e') goto yy32; @@ -136,7 +132,7 @@ yy15: ++YYCURSOR; #line 48 "cvsignore.b.re" { APPEND(L"$" L"Date$"); goto loop; } -#line 140 "" +#line 136 "" yy17: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -158,7 +154,7 @@ yy21: ++YYCURSOR; #line 49 "cvsignore.b.re" { APPEND(L"$" L"Id$"); goto loop; } -#line 162 "" +#line 158 "" yy23: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -180,7 +176,7 @@ yy28: ++YYCURSOR; #line 50 "cvsignore.b.re" { APPEND(L"$" L"Log$"); goto loop; } -#line 184 "" +#line 180 "" yy30: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -212,7 +208,7 @@ yy40: ++YYCURSOR; #line 51 "cvsignore.b.re" { APPEND(L"$" L"Revision$"); goto loop; } -#line 216 "" +#line 212 "" yy42: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -240,7 +236,7 @@ yy50: ++YYCURSOR; #line 52 "cvsignore.b.re" { APPEND(L"$" L"Source$"); goto loop; } -#line 244 "" +#line 240 "" yy52: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); diff --git a/test/cvsignore.c b/test/cvsignore.c index fd4309bd..a88f35a2 100755 --- a/test/cvsignore.c +++ b/test/cvsignore.c @@ -42,7 +42,6 @@ loop: #line 43 "" { YYCTYPE yych; - unsigned int yyaccept = 0; if((YYLIMIT - YYCURSOR) < 11) YYFILL(11); yych = *YYCURSOR; @@ -51,7 +50,6 @@ loop: default: goto yy4; } yy2: - yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); switch(yych){ case 'D': goto yy10; @@ -64,7 +62,7 @@ yy2: yy3: #line 53 "cvsignore.re" { output[outsize++] = cursor[-1]; if (cursor >= limit) break; goto loop; } -#line 68 "" +#line 66 "" yy4: yych = *++YYCURSOR; goto yy3; @@ -76,9 +74,7 @@ yy5: } yy6: YYCURSOR = YYMARKER; - if (yyaccept == 0) { - goto yy3; - } + goto yy3; yy7: yych = *++YYCURSOR; switch(yych){ @@ -132,7 +128,7 @@ yy15: ++YYCURSOR; #line 48 "cvsignore.re" { APPEND(L"$" L"Date$"); goto loop; } -#line 136 "" +#line 132 "" yy17: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -160,7 +156,7 @@ yy21: ++YYCURSOR; #line 49 "cvsignore.re" { APPEND(L"$" L"Id$"); goto loop; } -#line 164 "" +#line 160 "" yy23: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -194,7 +190,7 @@ yy28: ++YYCURSOR; #line 50 "cvsignore.re" { APPEND(L"$" L"Log$"); goto loop; } -#line 198 "" +#line 194 "" yy30: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -258,7 +254,7 @@ yy40: ++YYCURSOR; #line 51 "cvsignore.re" { APPEND(L"$" L"Revision$"); goto loop; } -#line 262 "" +#line 258 "" yy42: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -310,7 +306,7 @@ yy50: ++YYCURSOR; #line 52 "cvsignore.re" { APPEND(L"$" L"Source$"); goto loop; } -#line 314 "" +#line 310 "" yy52: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); diff --git a/test/cvsignore.s.c b/test/cvsignore.s.c index 85b69699..bdf25798 100755 --- a/test/cvsignore.s.c +++ b/test/cvsignore.s.c @@ -42,12 +42,10 @@ loop: #line 43 "" { YYCTYPE yych; - unsigned int yyaccept = 0; if((YYLIMIT - YYCURSOR) < 11) YYFILL(11); yych = *YYCURSOR; if(yych != '$') goto yy4; - yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); switch(yych){ case 'D': goto yy10; @@ -60,7 +58,7 @@ loop: yy3: #line 53 "cvsignore.s.re" { output[outsize++] = cursor[-1]; if (cursor >= limit) break; goto loop; } -#line 64 "" +#line 62 "" yy4: yych = *++YYCURSOR; goto yy3; @@ -69,9 +67,7 @@ yy5: if(yych == 'o') goto yy44; yy6: YYCURSOR = YYMARKER; - if (yyaccept == 0) { - goto yy3; - } + goto yy3; yy7: yych = *++YYCURSOR; if(yych == 'e') goto yy32; @@ -101,7 +97,7 @@ yy15: ++YYCURSOR; #line 48 "cvsignore.s.re" { APPEND(L"$" L"Date$"); goto loop; } -#line 105 "" +#line 101 "" yy17: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -121,7 +117,7 @@ yy21: ++YYCURSOR; #line 49 "cvsignore.s.re" { APPEND(L"$" L"Id$"); goto loop; } -#line 125 "" +#line 121 "" yy23: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -143,7 +139,7 @@ yy28: ++YYCURSOR; #line 50 "cvsignore.s.re" { APPEND(L"$" L"Log$"); goto loop; } -#line 147 "" +#line 143 "" yy30: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -175,7 +171,7 @@ yy40: ++YYCURSOR; #line 51 "cvsignore.s.re" { APPEND(L"$" L"Revision$"); goto loop; } -#line 179 "" +#line 175 "" yy42: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -203,7 +199,7 @@ yy50: ++YYCURSOR; #line 52 "cvsignore.s.re" { APPEND(L"$" L"Source$"); goto loop; } -#line 207 "" +#line 203 "" yy52: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); diff --git a/test/cvsignore.w.c b/test/cvsignore.w.c index e61e60e0..1d72889a 100755 --- a/test/cvsignore.w.c +++ b/test/cvsignore.w.c @@ -42,12 +42,10 @@ loop: #line 43 "" { YYCTYPE yych; - unsigned int yyaccept = 0; if((YYLIMIT - YYCURSOR) < 11) YYFILL(11); yych = *YYCURSOR; if(yych != '$') goto yy4; - yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); switch(yych){ case 'D': goto yy10; @@ -60,7 +58,7 @@ loop: yy3: #line 53 "cvsignore.w.re" { output[outsize++] = cursor[-1]; if (cursor >= limit) break; goto loop; } -#line 64 "" +#line 62 "" yy4: yych = *++YYCURSOR; goto yy3; @@ -69,9 +67,7 @@ yy5: if(yych == 'o') goto yy44; yy6: YYCURSOR = YYMARKER; - if (yyaccept == 0) { - goto yy3; - } + goto yy3; yy7: yych = *++YYCURSOR; if(yych == 'e') goto yy32; @@ -101,7 +97,7 @@ yy15: ++YYCURSOR; #line 48 "cvsignore.w.re" { APPEND(L"$" L"Date$"); goto loop; } -#line 105 "" +#line 101 "" yy17: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -121,7 +117,7 @@ yy21: ++YYCURSOR; #line 49 "cvsignore.w.re" { APPEND(L"$" L"Id$"); goto loop; } -#line 125 "" +#line 121 "" yy23: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -143,7 +139,7 @@ yy28: ++YYCURSOR; #line 50 "cvsignore.w.re" { APPEND(L"$" L"Log$"); goto loop; } -#line 147 "" +#line 143 "" yy30: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -175,7 +171,7 @@ yy40: ++YYCURSOR; #line 51 "cvsignore.w.re" { APPEND(L"$" L"Revision$"); goto loop; } -#line 179 "" +#line 175 "" yy42: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -203,7 +199,7 @@ yy50: ++YYCURSOR; #line 52 "cvsignore.w.re" { APPEND(L"$" L"Source$"); goto loop; } -#line 207 "" +#line 203 "" yy52: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); diff --git a/test/cvsignore.wb.c b/test/cvsignore.wb.c index 557f83b0..bc9822d5 100755 --- a/test/cvsignore.wb.c +++ b/test/cvsignore.wb.c @@ -77,12 +77,10 @@ loop: #line 78 "" { YYCTYPE yych; - unsigned int yyaccept = 0; if((YYLIMIT - YYCURSOR) < 11) YYFILL(11); yych = *YYCURSOR; if(yych != '$') goto yy4; - yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); switch(yych){ case 'D': goto yy10; @@ -95,7 +93,7 @@ loop: yy3: #line 53 "cvsignore.wb.re" { output[outsize++] = cursor[-1]; if (cursor >= limit) break; goto loop; } -#line 99 "" +#line 97 "" yy4: yych = *++YYCURSOR; goto yy3; @@ -104,9 +102,7 @@ yy5: if(yych == 'o') goto yy44; yy6: YYCURSOR = YYMARKER; - if (yyaccept == 0) { - goto yy3; - } + goto yy3; yy7: yych = *++YYCURSOR; if(yych == 'e') goto yy32; @@ -136,7 +132,7 @@ yy15: ++YYCURSOR; #line 48 "cvsignore.wb.re" { APPEND(L"$" L"Date$"); goto loop; } -#line 140 "" +#line 136 "" yy17: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -160,7 +156,7 @@ yy21: ++YYCURSOR; #line 49 "cvsignore.wb.re" { APPEND(L"$" L"Id$"); goto loop; } -#line 164 "" +#line 160 "" yy23: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -182,7 +178,7 @@ yy28: ++YYCURSOR; #line 50 "cvsignore.wb.re" { APPEND(L"$" L"Log$"); goto loop; } -#line 186 "" +#line 182 "" yy30: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -214,7 +210,7 @@ yy40: ++YYCURSOR; #line 51 "cvsignore.wb.re" { APPEND(L"$" L"Revision$"); goto loop; } -#line 218 "" +#line 214 "" yy42: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -242,7 +238,7 @@ yy50: ++YYCURSOR; #line 52 "cvsignore.wb.re" { APPEND(L"$" L"Source$"); goto loop; } -#line 246 "" +#line 242 "" yy52: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); diff --git a/test/input1.c b/test/input1.c index f43b3fb9..4c565e6e 100644 --- a/test/input1.c +++ b/test/input1.c @@ -4,7 +4,6 @@ #line 5 "" { YYCTYPE yych; - unsigned int yyaccept = 0; if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; @@ -13,7 +12,6 @@ default: goto yy4; } yy2: - yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); switch(yych){ case 'b': goto yy5; @@ -22,7 +20,7 @@ yy2: yy3: #line 4 "input1.re" { return 0; } -#line 26 "" +#line 24 "" yy4: yych = *++YYCURSOR; goto yy3; @@ -37,9 +35,7 @@ yy5: } yy7: YYCURSOR = YYMARKER; - if (yyaccept == 0) { - goto yy3; - } + goto yy3; yy8: yych = *++YYCURSOR; switch(yych){ @@ -50,7 +46,7 @@ yy9: ++YYCURSOR; #line 3 "input1.re" { return 1; } -#line 54 "" +#line 50 "" } #line 6 "input1.re" diff --git a/test/input11.b.c b/test/input11.b.c index be68053a..a92a82ec 100755 --- a/test/input11.b.c +++ b/test/input11.b.c @@ -39,7 +39,6 @@ #line 40 "" { YYCTYPE yych; - unsigned int yyaccept = 0; if((YYLIMIT - YYCURSOR) < 6) YYFILL(6); yych = *YYCURSOR; @@ -70,7 +69,7 @@ yy2: yy3: #line 12 "input11.b.re" { return 1; } -#line 74 "" +#line 73 "" yy4: yych = *++YYCURSOR; goto yy14; @@ -79,7 +78,7 @@ yy5: yy6: #line 13 "input11.b.re" { return 2; } -#line 83 "" +#line 82 "" yy7: ++YYCURSOR; if((yych = *YYCURSOR) <= '0') goto yy8; @@ -87,7 +86,7 @@ yy7: yy8: #line 15 "input11.b.re" { return -1; } -#line 91 "" +#line 90 "" yy9: yych = *++YYCURSOR; goto yy12; @@ -117,7 +116,6 @@ yy15: if(yych != '2') goto yy14; yych = *++YYCURSOR; if(yych != 'c') goto yy14; - yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); if(yych != ':') goto yy14; yych = *++YYCURSOR; @@ -130,9 +128,7 @@ yy15: } yy19: YYCURSOR = YYMARKER; - if (yyaccept == 0) { - goto yy3; - } + goto yy3; yy20: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -142,7 +138,7 @@ yy20: } #line 11 "input11.b.re" { return 0; } -#line 146 "" +#line 142 "" } } #line 17 "input11.b.re" diff --git a/test/input11.c b/test/input11.c index 3058942e..8a5f885f 100755 --- a/test/input11.c +++ b/test/input11.c @@ -4,7 +4,6 @@ #line 5 "" { YYCTYPE yych; - unsigned int yyaccept = 0; if((YYLIMIT - YYCURSOR) < 6) YYFILL(6); yych = *YYCURSOR; @@ -83,7 +82,7 @@ yy2: yy3: #line 10 "input11.re" { return 1; } -#line 87 "" +#line 86 "" yy4: yych = *++YYCURSOR; goto yy14; @@ -92,7 +91,7 @@ yy5: yy6: #line 11 "input11.re" { return 2; } -#line 96 "" +#line 95 "" yy7: ++YYCURSOR; switch((yych = *YYCURSOR)) { @@ -110,7 +109,7 @@ yy7: yy8: #line 13 "input11.re" { return -1; } -#line 114 "" +#line 113 "" yy9: yych = *++YYCURSOR; goto yy12; @@ -218,7 +217,6 @@ yy16: default: goto yy14; } yy17: - yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); switch(yych){ case ':': goto yy18; @@ -284,9 +282,7 @@ yy18: } yy19: YYCURSOR = YYMARKER; - if (yyaccept == 0) { - goto yy3; - } + goto yy3; yy20: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -361,7 +357,7 @@ yy20: yy22: #line 9 "input11.re" { return 0; } -#line 365 "" +#line 361 "" } #line 15 "input11.re" diff --git a/test/input11.s.c b/test/input11.s.c index b51ba88b..a1f25da1 100755 --- a/test/input11.s.c +++ b/test/input11.s.c @@ -4,7 +4,6 @@ #line 5 "" { YYCTYPE yych; - unsigned int yyaccept = 0; if((YYLIMIT - YYCURSOR) < 6) YYFILL(6); yych = *YYCURSOR; @@ -35,7 +34,7 @@ yy2: yy3: #line 10 "input11.s.re" { return 1; } -#line 39 "" +#line 38 "" yy4: yych = *++YYCURSOR; goto yy14; @@ -44,7 +43,7 @@ yy5: yy6: #line 11 "input11.s.re" { return 2; } -#line 48 "" +#line 47 "" yy7: ++YYCURSOR; if((yych = *YYCURSOR) <= '0') goto yy8; @@ -52,7 +51,7 @@ yy7: yy8: #line 13 "input11.s.re" { return -1; } -#line 56 "" +#line 55 "" yy9: yych = *++YYCURSOR; goto yy12; @@ -87,7 +86,6 @@ yy15: if(yych != '2') goto yy14; yych = *++YYCURSOR; if(yych != 'c') goto yy14; - yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); if(yych != ':') goto yy14; yych = *++YYCURSOR; @@ -100,9 +98,7 @@ yy15: } yy19: YYCURSOR = YYMARKER; - if (yyaccept == 0) { - goto yy3; - } + goto yy3; yy20: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -122,7 +118,7 @@ yy20: yy22: #line 9 "input11.s.re" { return 0; } -#line 126 "" +#line 122 "" } #line 15 "input11.s.re" diff --git a/test/sample.c b/test/sample.c index 63038392..5c0533b4 100644 --- a/test/sample.c +++ b/test/sample.c @@ -4,7 +4,6 @@ #line 5 "" { YYCTYPE yych; - unsigned int yyaccept = 0; if((YYLIMIT - YYCURSOR) < 6) YYFILL(6); yych = *YYCURSOR; @@ -56,12 +55,11 @@ yy2: yy3: #line 3 "sample.re" {return ID;} -#line 60 "" +#line 59 "" yy4: yych = *++YYCURSOR; goto yy18; yy5: - yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); switch(yych){ case 'x': goto yy12; @@ -70,7 +68,7 @@ yy5: yy6: #line 4 "sample.re" {return DEC;} -#line 74 "" +#line 72 "" yy7: yych = *++YYCURSOR; goto yy11; @@ -78,7 +76,7 @@ yy8: ++YYCURSOR; #line 6 "sample.re" {return ERR;} -#line 82 "" +#line 80 "" yy10: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -120,9 +118,7 @@ yy12: } yy13: YYCURSOR = YYMARKER; - if (yyaccept == 0) { - goto yy6; - } + goto yy6; yy14: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -149,7 +145,7 @@ yy14: yy16: #line 5 "sample.re" {return HEX;} -#line 153 "" +#line 149 "" yy17: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -236,7 +232,7 @@ yy22: yy23: #line 2 "sample.re" {return PRINT;} -#line 240 "" +#line 236 "" } #line 7 "sample.re" diff --git a/test/scanner.c b/test/scanner.c index 663c04b1..790bf2ae 100644 --- a/test/scanner.c +++ b/test/scanner.c @@ -78,7 +78,6 @@ echo: #line 79 "" { YYCTYPE yych; - unsigned int yyaccept = 0; if((YYLIMIT - YYCURSOR) < 7) YYFILL(7); yych = *YYCURSOR; @@ -88,7 +87,6 @@ echo: default: goto yy6; } yy2: - yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); switch(yych){ case '*': goto yy7; @@ -97,7 +95,7 @@ yy2: yy3: #line 91 "scanner.re" { goto echo; } -#line 101 "" +#line 99 "" yy4: ++YYCURSOR; #line 87 "scanner.re" @@ -105,7 +103,7 @@ yy4: out.write((const char*)(tok), (const char*)(cursor) - (const char*)(tok)); tok = pos = cursor; cline++; goto echo; } -#line 109 "" +#line 107 "" yy6: yych = *++YYCURSOR; goto yy3; @@ -117,9 +115,7 @@ yy7: } yy8: YYCURSOR = YYMARKER; - if (yyaccept == 0) { - goto yy3; - } + goto yy3; yy9: yych = *++YYCURSOR; switch(yych){ @@ -150,7 +146,7 @@ yy13: { out.write((const char*)(tok), (const char*)(&cursor[-7]) - (const char*)(tok)); tok = cursor; RETURN(1); } -#line 154 "" +#line 150 "" } #line 92 "scanner.re" @@ -166,7 +162,7 @@ scan: tline = cline; tok = cursor; -#line 170 "" +#line 166 "" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -265,7 +261,7 @@ yy18: { depth = 1; goto code; } -#line 269 "" +#line 265 "" yy19: ++YYCURSOR; switch((yych = *YYCURSOR)) { @@ -275,7 +271,7 @@ yy19: yy20: #line 131 "scanner.re" { RETURN(*tok); } -#line 279 "" +#line 275 "" yy21: ++YYCURSOR; switch((yych = *YYCURSOR)) { @@ -286,7 +282,7 @@ yy22: #line 133 "scanner.re" { yylval.op = *tok; RETURN(CLOSE); } -#line 290 "" +#line 286 "" yy23: yyaccept = 1; yych = *(YYMARKER = ++YYCURSOR); @@ -297,7 +293,7 @@ yy23: yy24: #line 122 "scanner.re" { fatal("unterminated string constant (missing \")"); } -#line 301 "" +#line 297 "" yy25: yyaccept = 2; yych = *(YYMARKER = ++YYCURSOR); @@ -308,7 +304,7 @@ yy25: yy26: #line 123 "scanner.re" { fatal("unterminated string constant (missing ')"); } -#line 312 "" +#line 308 "" yy27: yyaccept = 3; yych = *(YYMARKER = ++YYCURSOR); @@ -319,7 +315,7 @@ yy27: yy28: #line 129 "scanner.re" { fatal("unterminated range (missing ])"); } -#line 323 "" +#line 319 "" yy29: yych = *++YYCURSOR; goto yy20; @@ -335,7 +331,7 @@ yy32: { cur = cursor; yylval.symbol = Symbol::find(token()); return ID; } -#line 339 "" +#line 335 "" yy33: ++YYCURSOR; yych = *YYCURSOR; @@ -343,7 +339,7 @@ yy33: yy34: #line 152 "scanner.re" { goto scan; } -#line 347 "" +#line 343 "" yy35: ++YYCURSOR; #line 154 "scanner.re" @@ -351,14 +347,14 @@ yy35: pos = cursor; cline++; goto scan; } -#line 355 "" +#line 351 "" yy37: ++YYCURSOR; #line 159 "scanner.re" { std::cerr << "unexpected character: " << *tok << std::endl; goto scan; } -#line 362 "" +#line 358 "" yy39: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -472,7 +468,7 @@ yy47: { cur = cursor; yylval.regexp = ranToRE(token()); return RANGE; } -#line 476 "" +#line 472 "" yy49: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -498,7 +494,7 @@ yy52: { cur = cursor; yylval.regexp = strToCaseInsensitiveRE(token()); return STRING; } -#line 502 "" +#line 498 "" yy54: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -524,19 +520,19 @@ yy57: { cur = cursor; yylval.regexp = strToRE(token()); return STRING; } -#line 528 "" +#line 524 "" yy59: ++YYCURSOR; #line 111 "scanner.re" { tok = cursor; RETURN(0); } -#line 534 "" +#line 530 "" yy61: ++YYCURSOR; #line 108 "scanner.re" { depth = 1; goto comment; } -#line 540 "" +#line 536 "" yy63: ++YYCURSOR; if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -562,7 +558,7 @@ yy65: { yylval.extop.minsize = atoi((char *)tok+1); yylval.extop.maxsize = atoi((char *)tok+1); RETURN(CLOSESIZE); } -#line 566 "" +#line 562 "" yy67: yych = *++YYCURSOR; switch(yych){ @@ -575,7 +571,7 @@ yy68: { yylval.extop.minsize = atoi((char *)tok+1); yylval.extop.maxsize = -1; RETURN(CLOSESIZE); } -#line 579 "" +#line 575 "" yy70: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -601,17 +597,16 @@ yy72: { yylval.extop.minsize = atoi((char *)tok+1); yylval.extop.maxsize = MAX(yylval.extop.minsize,atoi(strchr((char *)tok, ',')+1)); RETURN(CLOSESIZE); } -#line 605 "" +#line 601 "" } #line 162 "scanner.re" code: -#line 612 "" +#line 608 "" { YYCTYPE yych; - unsigned int yyaccept = 0; if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; switch(yych){ @@ -631,13 +626,13 @@ yy76: return CODE; } goto code; } -#line 635 "" +#line 630 "" yy78: ++YYCURSOR; #line 172 "scanner.re" { ++depth; goto code; } -#line 641 "" +#line 636 "" yy80: ++YYCURSOR; #line 174 "scanner.re" @@ -645,22 +640,20 @@ yy80: pos = cursor; cline++; goto code; } -#line 649 "" +#line 644 "" yy82: ++YYCURSOR; yy83: #line 178 "scanner.re" { goto code; } -#line 655 "" +#line 650 "" yy84: - yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); switch(yych){ case 0x0A: goto yy83; default: goto yy91; } yy85: - yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); switch(yych){ case 0x0A: goto yy83; @@ -679,9 +672,7 @@ yy87: } yy88: YYCURSOR = YYMARKER; - if (yyaccept == 0) { - goto yy83; - } + goto yy83; yy89: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -715,7 +706,7 @@ yy92: comment: -#line 719 "" +#line 710 "" { YYCTYPE yych; if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -735,7 +726,7 @@ yy95: yy96: #line 193 "scanner.re" { goto comment; } -#line 739 "" +#line 730 "" yy97: yych = *++YYCURSOR; switch(yych){ @@ -749,7 +740,7 @@ yy98: tok = pos = cursor; cline++; goto comment; } -#line 753 "" +#line 744 "" yy100: yych = *++YYCURSOR; goto yy96; @@ -758,7 +749,7 @@ yy101: #line 187 "scanner.re" { ++depth; goto comment; } -#line 762 "" +#line 753 "" yy103: ++YYCURSOR; #line 183 "scanner.re" @@ -766,7 +757,7 @@ yy103: goto scan; else goto comment; } -#line 770 "" +#line 761 "" } #line 194 "scanner.re"