diff options
Diffstat (limited to 'test/eof')
-rw-r--r-- | test/eof/eof_01.i--eager-skip.c | 466 | ||||
-rw-r--r-- | test/eof/eof_01.i.c | 442 | ||||
-rw-r--r-- | test/eof/eof_yyfill_naked_1.i.c | 106 | ||||
-rw-r--r-- | test/eof/eof_yyfill_naked_1.i.re | 39 | ||||
-rw-r--r-- | test/eof/eof_yyfill_naked_2.if.c | 114 | ||||
-rw-r--r-- | test/eof/eof_yyfill_naked_2.if.re | 39 | ||||
-rw-r--r-- | test/eof/sentinel_01.i.c | 5 | ||||
-rw-r--r-- | test/eof/sentinel_01.i.re | 39 | ||||
-rw-r--r-- | test/eof/sentinel_02.i.c | 1 | ||||
-rw-r--r-- | test/eof/sentinel_02.i.re | 9 | ||||
-rw-r--r-- | test/eof/shadowrule_01.i.c | 89 | ||||
-rw-r--r-- | test/eof/shadowrule_01.i.re | 23 | ||||
-rw-r--r-- | test/eof/shadowrule_02_hoist.i--tags.c | 59 | ||||
-rw-r--r-- | test/eof/shadowrule_02_hoist.i--tags.re | 16 | ||||
-rw-r--r-- | test/eof/shadowrule_03_hoist.i--tags.c | 74 | ||||
-rw-r--r-- | test/eof/shadowrule_03_hoist.i--tags.re | 19 | ||||
-rw-r--r-- | test/eof/shadowrule_04_hoist.i--tags.c | 64 | ||||
-rw-r--r-- | test/eof/shadowrule_04_hoist.i--tags.re | 15 | ||||
-rw-r--r-- | test/eof/utf8_any.i.re | 1 |
19 files changed, 1193 insertions, 427 deletions
diff --git a/test/eof/eof_01.i--eager-skip.c b/test/eof/eof_01.i--eager-skip.c index 840fa3bc..2553b25d 100644 --- a/test/eof/eof_01.i--eager-skip.c +++ b/test/eof/eof_01.i--eager-skip.c @@ -54,11 +54,11 @@ yy1_: switch (yych) { case '\n': goto yy4; case '"': goto yy7; - case '\'': goto yy9; + case '\'': goto yy8; case '+': - case '-': goto yy11; - case '0': goto yy12; - case '1': goto yy14; + case '-': goto yy9; + case '0': goto yy10; + case '1': goto yy12; case '2': case '3': case '4': @@ -66,7 +66,7 @@ yy1_: case '6': case '7': case '8': - case '9': goto yy16; + case '9': goto yy14; case 'A': case 'B': case 'C': @@ -109,17 +109,17 @@ yy1_: case 'v': case 'x': case 'y': - case 'z': goto yy18; + case 'z': goto yy16; case 'F': - case 'f': goto yy21; + case 'f': goto yy19; case 'M': - case 'm': goto yy22; + case 'm': goto yy20; case 'S': - case 's': goto yy23; + case 's': goto yy21; case 'T': - case 't': goto yy24; + case 't': goto yy22; case 'W': - case 'w': goto yy25; + case 'w': goto yy23; default: if (in.lim <= in.cur) { if (in.fill () == 0) goto yy1_; @@ -147,37 +147,35 @@ yy6: { continue; } yy7: yy7_: - yych = *in.cur++; - switch (yych) { - case '"': goto yy26; - case '\\': goto yy28; - default: + yych = *in.cur; + if (yych <= 0x00) { if (in.lim <= in.cur) { if (in.fill () == 0) goto yy7_; goto yy3; } - goto yy7; + ++in.cur; + goto yy24; } -yy9: -yy9_: - yych = *in.cur++; - switch (yych) { - case '\'': goto yy29; - case '\\': goto yy31; - default: + goto yy25; +yy8: +yy8_: + yych = *in.cur; + if (yych <= 0x00) { if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy9_; + if (in.fill () == 0) goto yy8_; goto yy3; } - goto yy9; + ++in.cur; + goto yy29; } -yy11: -yy11_: + goto yy30; +yy9: +yy9_: yych = *in.cur; switch (yych) { case '0': ++in.cur; - goto yy12; + goto yy10; case '1': case '2': case '3': @@ -188,18 +186,18 @@ yy11_: case '8': case '9': ++in.cur; - goto yy16; + goto yy14; default: if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy11_; + if (in.fill () == 0) goto yy9_; } goto yy3; } -yy12: -yy13: +yy10: +yy11: { ++count; continue; } -yy14: -yy14_: +yy12: +yy12_: yych = *in.cur; switch (yych) { case '0': @@ -212,22 +210,22 @@ yy14_: case '8': case '9': ++in.cur; - goto yy16; + goto yy14; case '2': ++in.cur; - goto yy32; + goto yy34; default: if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy14_; + if (in.fill () == 0) goto yy12_; } - goto yy15; + goto yy13; } -yy15: +yy13: { ++count; continue; } -yy16: -yy16_: +yy14: +yy14_: yych = *in.cur; -yy17: +yy15: switch (yych) { case '0': case '1': @@ -240,17 +238,17 @@ yy17: case '8': case '9': ++in.cur; - goto yy16; + goto yy14; default: if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy16_; + if (in.fill () == 0) goto yy14_; } - goto yy13; + goto yy11; } -yy18: -yy18_: +yy16: +yy16_: yych = *in.cur; -yy19: +yy17: switch (yych) { case '0': case '1': @@ -316,97 +314,112 @@ yy19: case 'y': case 'z': ++in.cur; - goto yy18; + goto yy16; default: if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy18_; + if (in.fill () == 0) goto yy16_; } - goto yy20; + goto yy18; } -yy20: +yy18: { ++count; continue; } -yy21: -yy21_: +yy19: +yy19_: yych = *in.cur; switch (yych) { case 0x00: if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy21_; + if (in.fill () == 0) goto yy19_; } - goto yy20; + goto yy18; case 'R': case 'r': ++in.cur; - goto yy33; - default: goto yy19; + goto yy35; + default: goto yy17; } -yy22: -yy22_: +yy20: +yy20_: yych = *in.cur; switch (yych) { case 0x00: if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy22_; + if (in.fill () == 0) goto yy20_; } - goto yy20; + goto yy18; case 'O': case 'o': ++in.cur; - goto yy34; - default: goto yy19; + goto yy36; + default: goto yy17; } -yy23: -yy23_: +yy21: +yy21_: yych = *in.cur; switch (yych) { case 0x00: if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy23_; + if (in.fill () == 0) goto yy21_; } - goto yy20; + goto yy18; case 'A': case 'a': ++in.cur; - goto yy35; + goto yy37; case 'U': case 'u': ++in.cur; - goto yy34; - default: goto yy19; + goto yy36; + default: goto yy17; } -yy24: -yy24_: +yy22: +yy22_: yych = *in.cur; switch (yych) { case 0x00: if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy24_; + if (in.fill () == 0) goto yy22_; } - goto yy20; + goto yy18; case 'H': case 'h': ++in.cur; - goto yy36; + goto yy38; case 'U': case 'u': ++in.cur; - goto yy37; - default: goto yy19; + goto yy39; + default: goto yy17; } -yy25: -yy25_: +yy23: +yy23_: yych = *in.cur; switch (yych) { case 0x00: if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy25_; + if (in.fill () == 0) goto yy23_; } - goto yy20; + goto yy18; case 'E': case 'e': ++in.cur; - goto yy38; - default: goto yy19; + goto yy40; + default: goto yy17; + } +yy24: +yy24_: + yych = *in.cur; +yy25: + ++in.cur; + switch (yych) { + case '"': goto yy26; + case '\\': goto yy28; + default: + if (in.lim <= in.cur) { + if (in.fill () == 0) goto yy24_; + goto yy3; + } + goto yy24; } yy26: { ++count; continue; } @@ -418,24 +431,39 @@ yy28_: if (in.fill () == 0) goto yy28_; goto yy3; } - goto yy7; + goto yy24; } - goto yy7; + goto yy24; yy29: - { ++count; continue; } +yy29_: + yych = *in.cur; +yy30: + ++in.cur; + switch (yych) { + case '\'': goto yy31; + case '\\': goto yy33; + default: + if (in.lim <= in.cur) { + if (in.fill () == 0) goto yy29_; + goto yy3; + } + goto yy29; + } yy31: -yy31_: + { ++count; continue; } +yy33: +yy33_: yych = *in.cur++; if (yych <= 0x00) { if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy31_; + if (in.fill () == 0) goto yy33_; goto yy3; } - goto yy9; + goto yy29; } - goto yy9; -yy32: -yy32_: + goto yy29; +yy34: +yy34_: yych = *in.cur; switch (yych) { case '0': @@ -448,45 +476,15 @@ yy32_: case '8': case '9': ++in.cur; - goto yy16; + goto yy14; case '3': ++in.cur; - goto yy39; + goto yy41; default: if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy32_; - } - goto yy15; - } -yy33: -yy33_: - yych = *in.cur; - switch (yych) { - case 0x00: - if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy33_; - } - goto yy20; - case 'I': - case 'i': - ++in.cur; - goto yy40; - default: goto yy19; - } -yy34: -yy34_: - yych = *in.cur; - switch (yych) { - case 0x00: - if (in.lim <= in.cur) { if (in.fill () == 0) goto yy34_; } - goto yy20; - case 'N': - case 'n': - ++in.cur; - goto yy40; - default: goto yy19; + goto yy13; } yy35: yy35_: @@ -496,12 +494,12 @@ yy35_: if (in.lim <= in.cur) { if (in.fill () == 0) goto yy35_; } - goto yy20; - case 'T': - case 't': + goto yy18; + case 'I': + case 'i': ++in.cur; - goto yy41; - default: goto yy19; + goto yy42; + default: goto yy17; } yy36: yy36_: @@ -511,12 +509,12 @@ yy36_: if (in.lim <= in.cur) { if (in.fill () == 0) goto yy36_; } - goto yy20; - case 'U': - case 'u': + goto yy18; + case 'N': + case 'n': ++in.cur; goto yy42; - default: goto yy19; + default: goto yy17; } yy37: yy37_: @@ -526,12 +524,12 @@ yy37_: if (in.lim <= in.cur) { if (in.fill () == 0) goto yy37_; } - goto yy20; - case 'E': - case 'e': + goto yy18; + case 'T': + case 't': ++in.cur; goto yy43; - default: goto yy19; + default: goto yy17; } yy38: yy38_: @@ -541,12 +539,12 @@ yy38_: if (in.lim <= in.cur) { if (in.fill () == 0) goto yy38_; } - goto yy20; - case 'D': - case 'd': + goto yy18; + case 'U': + case 'u': ++in.cur; goto yy44; - default: goto yy19; + default: goto yy17; } yy39: yy39_: @@ -556,8 +554,9 @@ yy39_: if (in.lim <= in.cur) { if (in.fill () == 0) goto yy39_; } - goto yy13; - case '4': + goto yy18; + case 'E': + case 'e': ++in.cur; goto yy45; default: goto yy17; @@ -570,12 +569,12 @@ yy40_: if (in.lim <= in.cur) { if (in.fill () == 0) goto yy40_; } - goto yy20; + goto yy18; case 'D': case 'd': ++in.cur; goto yy46; - default: goto yy19; + default: goto yy17; } yy41: yy41_: @@ -585,12 +584,11 @@ yy41_: if (in.lim <= in.cur) { if (in.fill () == 0) goto yy41_; } - goto yy20; - case 'U': - case 'u': + goto yy11; + case '4': ++in.cur; goto yy47; - default: goto yy19; + default: goto yy15; } yy42: yy42_: @@ -600,12 +598,12 @@ yy42_: if (in.lim <= in.cur) { if (in.fill () == 0) goto yy42_; } - goto yy20; - case 'R': - case 'r': + goto yy18; + case 'D': + case 'd': ++in.cur; - goto yy43; - default: goto yy19; + goto yy48; + default: goto yy17; } yy43: yy43_: @@ -615,12 +613,12 @@ yy43_: if (in.lim <= in.cur) { if (in.fill () == 0) goto yy43_; } - goto yy20; - case 'S': - case 's': + goto yy18; + case 'U': + case 'u': ++in.cur; - goto yy40; - default: goto yy19; + goto yy49; + default: goto yy17; } yy44: yy44_: @@ -630,12 +628,12 @@ yy44_: if (in.lim <= in.cur) { if (in.fill () == 0) goto yy44_; } - goto yy20; - case 'N': - case 'n': + goto yy18; + case 'R': + case 'r': ++in.cur; - goto yy37; - default: goto yy19; + goto yy45; + default: goto yy17; } yy45: yy45_: @@ -645,10 +643,11 @@ yy45_: if (in.lim <= in.cur) { if (in.fill () == 0) goto yy45_; } - goto yy13; - case '5': + goto yy18; + case 'S': + case 's': ++in.cur; - goto yy48; + goto yy42; default: goto yy17; } yy46: @@ -659,12 +658,12 @@ yy46_: if (in.lim <= in.cur) { if (in.fill () == 0) goto yy46_; } - goto yy20; - case 'A': - case 'a': + goto yy18; + case 'N': + case 'n': ++in.cur; - goto yy49; - default: goto yy19; + goto yy39; + default: goto yy17; } yy47: yy47_: @@ -674,17 +673,46 @@ yy47_: if (in.lim <= in.cur) { if (in.fill () == 0) goto yy47_; } - goto yy20; - case 'R': - case 'r': + goto yy11; + case '5': ++in.cur; - goto yy40; - default: goto yy19; + goto yy50; + default: goto yy15; } yy48: yy48_: yych = *in.cur; switch (yych) { + case 0x00: + if (in.lim <= in.cur) { + if (in.fill () == 0) goto yy48_; + } + goto yy18; + case 'A': + case 'a': + ++in.cur; + goto yy51; + default: goto yy17; + } +yy49: +yy49_: + yych = *in.cur; + switch (yych) { + case 0x00: + if (in.lim <= in.cur) { + if (in.fill () == 0) goto yy49_; + } + goto yy18; + case 'R': + case 'r': + ++in.cur; + goto yy42; + default: goto yy17; + } +yy50: +yy50_: + yych = *in.cur; + switch (yych) { case '0': case '1': case '2': @@ -695,33 +723,33 @@ yy48_: case '8': case '9': ++in.cur; - goto yy16; + goto yy14; case '6': ++in.cur; - goto yy50; + goto yy52; default: if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy48_; + if (in.fill () == 0) goto yy50_; } - goto yy15; + goto yy13; } -yy49: -yy49_: +yy51: +yy51_: yych = *in.cur; switch (yych) { case 0x00: if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy49_; + if (in.fill () == 0) goto yy51_; } - goto yy20; + goto yy18; case 'Y': case 'y': ++in.cur; - goto yy51; - default: goto yy19; + goto yy53; + default: goto yy17; } -yy50: -yy50_: +yy52: +yy52_: yych = *in.cur; switch (yych) { case '0': @@ -734,18 +762,18 @@ yy50_: case '8': case '9': ++in.cur; - goto yy16; + goto yy14; case '7': ++in.cur; - goto yy53; + goto yy55; default: if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy50_; + if (in.fill () == 0) goto yy52_; } - goto yy15; + goto yy13; } -yy51: -yy51_: +yy53: +yy53_: yych = *in.cur; switch (yych) { case '0': @@ -812,17 +840,17 @@ yy51_: case 'y': case 'z': ++in.cur; - goto yy18; + goto yy16; default: if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy51_; + if (in.fill () == 0) goto yy53_; } - goto yy52; + goto yy54; } -yy52: +yy54: { ++count; continue; } -yy53: -yy53_: +yy55: +yy55_: yych = *in.cur; switch (yych) { case '0': @@ -835,18 +863,18 @@ yy53_: case '7': case '9': ++in.cur; - goto yy16; + goto yy14; case '8': ++in.cur; - goto yy54; + goto yy56; default: if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy53_; + if (in.fill () == 0) goto yy55_; } - goto yy15; + goto yy13; } -yy54: -yy54_: +yy56: +yy56_: yych = *in.cur; switch (yych) { case '0': @@ -859,18 +887,18 @@ yy54_: case '7': case '8': ++in.cur; - goto yy16; + goto yy14; case '9': ++in.cur; - goto yy55; + goto yy57; default: if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy54_; + if (in.fill () == 0) goto yy56_; } - goto yy15; + goto yy13; } -yy55: -yy55_: +yy57: +yy57_: yych = *in.cur; switch (yych) { case '0': @@ -884,12 +912,12 @@ yy55_: case '8': case '9': ++in.cur; - goto yy16; + goto yy14; default: if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy55_; + if (in.fill () == 0) goto yy57_; } - goto yy15; + goto yy13; } yyeof: { return true; } diff --git a/test/eof/eof_01.i.c b/test/eof/eof_01.i.c index 8f8d0be3..605c93de 100644 --- a/test/eof/eof_01.i.c +++ b/test/eof/eof_01.i.c @@ -54,11 +54,11 @@ yy1_: switch (yych) { case '\n': goto yy4; case '"': goto yy7; - case '\'': goto yy9; + case '\'': goto yy8; case '+': - case '-': goto yy11; - case '0': goto yy12; - case '1': goto yy14; + case '-': goto yy9; + case '0': goto yy10; + case '1': goto yy12; case '2': case '3': case '4': @@ -66,7 +66,7 @@ yy1_: case '6': case '7': case '8': - case '9': goto yy16; + case '9': goto yy14; case 'A': case 'B': case 'C': @@ -109,17 +109,17 @@ yy1_: case 'v': case 'x': case 'y': - case 'z': goto yy18; + case 'z': goto yy16; case 'F': - case 'f': goto yy21; + case 'f': goto yy19; case 'M': - case 'm': goto yy22; + case 'm': goto yy20; case 'S': - case 's': goto yy23; + case 's': goto yy21; case 'T': - case 't': goto yy24; + case 't': goto yy22; case 'W': - case 'w': goto yy25; + case 'w': goto yy23; default: if (in.lim <= in.cur) { if (in.fill () == 0) goto yy1_; @@ -149,36 +149,32 @@ yy7: ++in.cur; yy7_: yych = *in.cur; - switch (yych) { - case '"': goto yy26; - case '\\': goto yy28; - default: + if (yych <= 0x00) { if (in.lim <= in.cur) { if (in.fill () == 0) goto yy7_; goto yy3; } - goto yy7; + goto yy24; } -yy9: + goto yy25; +yy8: ++in.cur; -yy9_: +yy8_: yych = *in.cur; - switch (yych) { - case '\'': goto yy29; - case '\\': goto yy31; - default: + if (yych <= 0x00) { if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy9_; + if (in.fill () == 0) goto yy8_; goto yy3; } - goto yy9; + goto yy29; } -yy11: + goto yy30; +yy9: ++in.cur; -yy11_: +yy9_: yych = *in.cur; switch (yych) { - case '0': goto yy12; + case '0': goto yy10; case '1': case '2': case '3': @@ -187,20 +183,20 @@ yy11_: case '6': case '7': case '8': - case '9': goto yy16; + case '9': goto yy14; default: if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy11_; + if (in.fill () == 0) goto yy9_; } goto yy3; } -yy12: +yy10: ++in.cur; -yy13: +yy11: { ++count; continue; } -yy14: +yy12: ++in.cur; -yy14_: +yy12_: yych = *in.cur; switch (yych) { case '0': @@ -211,21 +207,21 @@ yy14_: case '6': case '7': case '8': - case '9': goto yy16; - case '2': goto yy32; + case '9': goto yy14; + case '2': goto yy34; default: if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy14_; + if (in.fill () == 0) goto yy12_; } - goto yy15; + goto yy13; } -yy15: +yy13: { ++count; continue; } -yy16: +yy14: ++in.cur; -yy16_: +yy14_: yych = *in.cur; -yy17: +yy15: switch (yych) { case '0': case '1': @@ -236,18 +232,18 @@ yy17: case '6': case '7': case '8': - case '9': goto yy16; + case '9': goto yy14; default: if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy16_; + if (in.fill () == 0) goto yy14_; } - goto yy13; + goto yy11; } -yy18: +yy16: ++in.cur; -yy18_: +yy16_: yych = *in.cur; -yy19: +yy17: switch (yych) { case '0': case '1': @@ -311,167 +307,169 @@ yy19: case 'w': case 'x': case 'y': - case 'z': goto yy18; + case 'z': goto yy16; default: if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy18_; + if (in.fill () == 0) goto yy16_; } - goto yy20; + goto yy18; } -yy20: +yy18: { ++count; continue; } -yy21: +yy19: ++in.cur; -yy21_: +yy19_: yych = *in.cur; switch (yych) { case 0x00: if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy21_; + if (in.fill () == 0) goto yy19_; } - goto yy20; + goto yy18; case 'R': - case 'r': goto yy33; - default: goto yy19; + case 'r': goto yy35; + default: goto yy17; } -yy22: +yy20: ++in.cur; -yy22_: +yy20_: yych = *in.cur; switch (yych) { case 0x00: if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy22_; + if (in.fill () == 0) goto yy20_; } - goto yy20; + goto yy18; case 'O': - case 'o': goto yy34; - default: goto yy19; + case 'o': goto yy36; + default: goto yy17; } -yy23: +yy21: ++in.cur; -yy23_: +yy21_: yych = *in.cur; switch (yych) { case 0x00: if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy23_; + if (in.fill () == 0) goto yy21_; } - goto yy20; + goto yy18; case 'A': - case 'a': goto yy35; + case 'a': goto yy37; case 'U': - case 'u': goto yy34; - default: goto yy19; + case 'u': goto yy36; + default: goto yy17; } -yy24: +yy22: ++in.cur; -yy24_: +yy22_: yych = *in.cur; switch (yych) { case 0x00: if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy24_; + if (in.fill () == 0) goto yy22_; } - goto yy20; + goto yy18; case 'H': - case 'h': goto yy36; + case 'h': goto yy38; case 'U': - case 'u': goto yy37; - default: goto yy19; + case 'u': goto yy39; + default: goto yy17; } -yy25: +yy23: ++in.cur; -yy25_: +yy23_: yych = *in.cur; switch (yych) { case 0x00: if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy25_; + if (in.fill () == 0) goto yy23_; } - goto yy20; + goto yy18; case 'E': - case 'e': goto yy38; - default: goto yy19; + case 'e': goto yy40; + default: goto yy17; } -yy26: - ++in.cur; - { ++count; continue; } -yy28: +yy24: ++in.cur; -yy28_: +yy24_: yych = *in.cur; - if (yych <= 0x00) { +yy25: + switch (yych) { + case '"': goto yy26; + case '\\': goto yy28; + default: if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy28_; + if (in.fill () == 0) goto yy24_; goto yy3; } - goto yy7; + goto yy24; } - goto yy7; -yy29: +yy26: ++in.cur; { ++count; continue; } -yy31: +yy28: ++in.cur; -yy31_: +yy28_: yych = *in.cur; if (yych <= 0x00) { if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy31_; + if (in.fill () == 0) goto yy28_; goto yy3; } - goto yy9; + goto yy24; } - goto yy9; -yy32: + goto yy24; +yy29: ++in.cur; -yy32_: +yy29_: yych = *in.cur; +yy30: switch (yych) { - case '0': - case '1': - case '2': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': goto yy16; - case '3': goto yy39; + case '\'': goto yy31; + case '\\': goto yy33; default: if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy32_; + if (in.fill () == 0) goto yy29_; + goto yy3; } - goto yy15; + goto yy29; } +yy31: + ++in.cur; + { ++count; continue; } yy33: ++in.cur; yy33_: yych = *in.cur; - switch (yych) { - case 0x00: + if (yych <= 0x00) { if (in.lim <= in.cur) { if (in.fill () == 0) goto yy33_; + goto yy3; } - goto yy20; - case 'I': - case 'i': goto yy40; - default: goto yy19; + goto yy29; } + goto yy29; yy34: ++in.cur; yy34_: yych = *in.cur; switch (yych) { - case 0x00: + case '0': + case '1': + case '2': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': goto yy14; + case '3': goto yy41; + default: if (in.lim <= in.cur) { if (in.fill () == 0) goto yy34_; } - goto yy20; - case 'N': - case 'n': goto yy40; - default: goto yy19; + goto yy13; } yy35: ++in.cur; @@ -482,10 +480,10 @@ yy35_: if (in.lim <= in.cur) { if (in.fill () == 0) goto yy35_; } - goto yy20; - case 'T': - case 't': goto yy41; - default: goto yy19; + goto yy18; + case 'I': + case 'i': goto yy42; + default: goto yy17; } yy36: ++in.cur; @@ -496,10 +494,10 @@ yy36_: if (in.lim <= in.cur) { if (in.fill () == 0) goto yy36_; } - goto yy20; - case 'U': - case 'u': goto yy42; - default: goto yy19; + goto yy18; + case 'N': + case 'n': goto yy42; + default: goto yy17; } yy37: ++in.cur; @@ -510,10 +508,10 @@ yy37_: if (in.lim <= in.cur) { if (in.fill () == 0) goto yy37_; } - goto yy20; - case 'E': - case 'e': goto yy43; - default: goto yy19; + goto yy18; + case 'T': + case 't': goto yy43; + default: goto yy17; } yy38: ++in.cur; @@ -524,10 +522,10 @@ yy38_: if (in.lim <= in.cur) { if (in.fill () == 0) goto yy38_; } - goto yy20; - case 'D': - case 'd': goto yy44; - default: goto yy19; + goto yy18; + case 'U': + case 'u': goto yy44; + default: goto yy17; } yy39: ++in.cur; @@ -538,8 +536,9 @@ yy39_: if (in.lim <= in.cur) { if (in.fill () == 0) goto yy39_; } - goto yy13; - case '4': goto yy45; + goto yy18; + case 'E': + case 'e': goto yy45; default: goto yy17; } yy40: @@ -551,10 +550,10 @@ yy40_: if (in.lim <= in.cur) { if (in.fill () == 0) goto yy40_; } - goto yy20; + goto yy18; case 'D': case 'd': goto yy46; - default: goto yy19; + default: goto yy17; } yy41: ++in.cur; @@ -565,10 +564,9 @@ yy41_: if (in.lim <= in.cur) { if (in.fill () == 0) goto yy41_; } - goto yy20; - case 'U': - case 'u': goto yy47; - default: goto yy19; + goto yy11; + case '4': goto yy47; + default: goto yy15; } yy42: ++in.cur; @@ -579,10 +577,10 @@ yy42_: if (in.lim <= in.cur) { if (in.fill () == 0) goto yy42_; } - goto yy20; - case 'R': - case 'r': goto yy43; - default: goto yy19; + goto yy18; + case 'D': + case 'd': goto yy48; + default: goto yy17; } yy43: ++in.cur; @@ -593,10 +591,10 @@ yy43_: if (in.lim <= in.cur) { if (in.fill () == 0) goto yy43_; } - goto yy20; - case 'S': - case 's': goto yy40; - default: goto yy19; + goto yy18; + case 'U': + case 'u': goto yy49; + default: goto yy17; } yy44: ++in.cur; @@ -607,10 +605,10 @@ yy44_: if (in.lim <= in.cur) { if (in.fill () == 0) goto yy44_; } - goto yy20; - case 'N': - case 'n': goto yy37; - default: goto yy19; + goto yy18; + case 'R': + case 'r': goto yy45; + default: goto yy17; } yy45: ++in.cur; @@ -621,8 +619,9 @@ yy45_: if (in.lim <= in.cur) { if (in.fill () == 0) goto yy45_; } - goto yy13; - case '5': goto yy48; + goto yy18; + case 'S': + case 's': goto yy42; default: goto yy17; } yy46: @@ -634,10 +633,10 @@ yy46_: if (in.lim <= in.cur) { if (in.fill () == 0) goto yy46_; } - goto yy20; - case 'A': - case 'a': goto yy49; - default: goto yy19; + goto yy18; + case 'N': + case 'n': goto yy39; + default: goto yy17; } yy47: ++in.cur; @@ -648,16 +647,43 @@ yy47_: if (in.lim <= in.cur) { if (in.fill () == 0) goto yy47_; } - goto yy20; - case 'R': - case 'r': goto yy40; - default: goto yy19; + goto yy11; + case '5': goto yy50; + default: goto yy15; } yy48: ++in.cur; yy48_: yych = *in.cur; switch (yych) { + case 0x00: + if (in.lim <= in.cur) { + if (in.fill () == 0) goto yy48_; + } + goto yy18; + case 'A': + case 'a': goto yy51; + default: goto yy17; + } +yy49: + ++in.cur; +yy49_: + yych = *in.cur; + switch (yych) { + case 0x00: + if (in.lim <= in.cur) { + if (in.fill () == 0) goto yy49_; + } + goto yy18; + case 'R': + case 'r': goto yy42; + default: goto yy17; + } +yy50: + ++in.cur; +yy50_: + yych = *in.cur; + switch (yych) { case '0': case '1': case '2': @@ -666,31 +692,31 @@ yy48_: case '5': case '7': case '8': - case '9': goto yy16; - case '6': goto yy50; + case '9': goto yy14; + case '6': goto yy52; default: if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy48_; + if (in.fill () == 0) goto yy50_; } - goto yy15; + goto yy13; } -yy49: +yy51: ++in.cur; -yy49_: +yy51_: yych = *in.cur; switch (yych) { case 0x00: if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy49_; + if (in.fill () == 0) goto yy51_; } - goto yy20; + goto yy18; case 'Y': - case 'y': goto yy51; - default: goto yy19; + case 'y': goto yy53; + default: goto yy17; } -yy50: +yy52: ++in.cur; -yy50_: +yy52_: yych = *in.cur; switch (yych) { case '0': @@ -701,17 +727,17 @@ yy50_: case '5': case '6': case '8': - case '9': goto yy16; - case '7': goto yy53; + case '9': goto yy14; + case '7': goto yy55; default: if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy50_; + if (in.fill () == 0) goto yy52_; } - goto yy15; + goto yy13; } -yy51: +yy53: ++in.cur; -yy51_: +yy53_: yych = *in.cur; switch (yych) { case '0': @@ -776,18 +802,18 @@ yy51_: case 'w': case 'x': case 'y': - case 'z': goto yy18; + case 'z': goto yy16; default: if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy51_; + if (in.fill () == 0) goto yy53_; } - goto yy52; + goto yy54; } -yy52: +yy54: { ++count; continue; } -yy53: +yy55: ++in.cur; -yy53_: +yy55_: yych = *in.cur; switch (yych) { case '0': @@ -798,17 +824,17 @@ yy53_: case '5': case '6': case '7': - case '9': goto yy16; - case '8': goto yy54; + case '9': goto yy14; + case '8': goto yy56; default: if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy53_; + if (in.fill () == 0) goto yy55_; } - goto yy15; + goto yy13; } -yy54: +yy56: ++in.cur; -yy54_: +yy56_: yych = *in.cur; switch (yych) { case '0': @@ -819,17 +845,17 @@ yy54_: case '5': case '6': case '7': - case '8': goto yy16; - case '9': goto yy55; + case '8': goto yy14; + case '9': goto yy57; default: if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy54_; + if (in.fill () == 0) goto yy56_; } - goto yy15; + goto yy13; } -yy55: +yy57: ++in.cur; -yy55_: +yy57_: yych = *in.cur; switch (yych) { case '0': @@ -841,12 +867,12 @@ yy55_: case '6': case '7': case '8': - case '9': goto yy16; + case '9': goto yy14; default: if (in.lim <= in.cur) { - if (in.fill () == 0) goto yy55_; + if (in.fill () == 0) goto yy57_; } - goto yy15; + goto yy13; } yyeof: { return true; } diff --git a/test/eof/eof_yyfill_naked_1.i.c b/test/eof/eof_yyfill_naked_1.i.c new file mode 100644 index 00000000..7f3a91c6 --- /dev/null +++ b/test/eof/eof_yyfill_naked_1.i.c @@ -0,0 +1,106 @@ +/* Generated by re2c */ + + + +{ + YYCTYPE yych; +yy1_: + yych = *YYCURSOR; + switch (yych) { + case 'a': goto yy4; + default: + if (YYLIMIT <= YYCURSOR) { + if (fill() == 0) goto yy1_; + goto yyeof; + } + goto yy2; + } +yy2: + ++YYCURSOR; +yy3: + { return FAIL; } +yy4: + ++YYCURSOR; + { return OK; } +yyeof: + { return EOF; } +} + + + +{ + YYCTYPE yych; +yy7_: + yych = *YYCURSOR; + switch (yych) { + case 'a': goto yy10; + default: + if (YYLIMIT <= YYCURSOR) { + if (fill() == 0) goto yy7_; + goto yyeof; + } + goto yy8; + } +yy8: + ++YYCURSOR; +yy9: + { return FAIL; } +yy10: + ++YYCURSOR; + { return OK; } +yyeof: + { return EOF; } +} + + + +{ + YYCTYPE yych; +yy13_: + yych = *YYCURSOR; + switch (yych) { + case 'a': goto yy16; + default: + if (YYLIMIT <= YYCURSOR) { + if (fill () == 0) goto yy13_; + goto yyeof; + } + goto yy14; + } +yy14: + ++YYCURSOR; +yy15: + { return FAIL; } +yy16: + ++YYCURSOR; + { return OK; } +yyeof: + { return EOF; } +} + + + +{ + YYCTYPE yych; +yy19_: + yych = *YYCURSOR; + switch (yych) { + case 'a': goto yy22; + default: + if (YYLIMIT <= YYCURSOR) { + if (fill() == 0) goto yy19_; + goto yyeof; + } + goto yy20; + } +yy20: + ++YYCURSOR; +yy21: + { return FAIL; } +yy22: + ++YYCURSOR; + { return OK; } +yyeof: + { return EOF; } +} + diff --git a/test/eof/eof_yyfill_naked_1.i.re b/test/eof/eof_yyfill_naked_1.i.re new file mode 100644 index 00000000..eaf9cde9 --- /dev/null +++ b/test/eof/eof_yyfill_naked_1.i.re @@ -0,0 +1,39 @@ +/*!re2c + re2c:eof = 0; +*/ + +/*!re2c + re2c:define:YYFILL = "fill() == 0"; + re2c:define:YYFILL:naked = 1; + re2c:yyfill:parameter = 1; + * { return FAIL; } + $ { return EOF; } + [a] { return OK; } +*/ + +/*!re2c + re2c:define:YYFILL = "fill() == 0"; + re2c:define:YYFILL:naked = 1; + re2c:yyfill:parameter = 0; + * { return FAIL; } + $ { return EOF; } + [a] { return OK; } +*/ + +/*!re2c + re2c:define:YYFILL = "fill"; + re2c:define:YYFILL:naked = 0; + re2c:yyfill:parameter = 1; + * { return FAIL; } + $ { return EOF; } + [a] { return OK; } +*/ + +/*!re2c + re2c:define:YYFILL = "fill()"; + re2c:define:YYFILL:naked = 0; + re2c:yyfill:parameter = 0; + * { return FAIL; } + $ { return EOF; } + [a] { return OK; } +*/ diff --git a/test/eof/eof_yyfill_naked_2.if.c b/test/eof/eof_yyfill_naked_2.if.c new file mode 100644 index 00000000..5f4bef75 --- /dev/null +++ b/test/eof/eof_yyfill_naked_2.if.c @@ -0,0 +1,114 @@ +/* Generated by re2c */ + + + + + switch (YYGETSTATE()) { + default: goto yy0; + case 0: if (YYLIMIT <= YYCURSOR) goto yyeof0; goto yyFillLabel0; + case 1: if (YYLIMIT <= YYCURSOR) goto yyeof1; goto yyFillLabel1; + case 2: if (YYLIMIT <= YYCURSOR) goto yyeof2; goto yyFillLabel2; + case 3: if (YYLIMIT <= YYCURSOR) goto yyeof3; goto yyFillLabel3; + } +yy0: +yyFillLabel0: + yych = *YYCURSOR; + switch (yych) { + case 'a': goto yy4; + default: + if (YYLIMIT <= YYCURSOR) { + YYSETSTATE(0); + fill(); + yyeof0:; + goto yyeof; + } + goto yy2; + } +yy2: + ++YYCURSOR; +yy3: + { return FAIL; } +yy4: + ++YYCURSOR; + { return OK; } +yyeof: + { return EOF; } + + + + +yyFillLabel1: + yych = *YYCURSOR; + switch (yych) { + case 'a': goto yy10; + default: + if (YYLIMIT <= YYCURSOR) { + YYSETSTATE(1); + fill(); + yyeof1:; + goto yyeof; + } + goto yy8; + } +yy8: + ++YYCURSOR; +yy9: + { return FAIL; } +yy10: + ++YYCURSOR; + { return OK; } +yyeof: + { return EOF; } + + + + +yyFillLabel2: + yych = *YYCURSOR; + switch (yych) { + case 'a': goto yy16; + default: + if (YYLIMIT <= YYCURSOR) { + YYSETSTATE(2); + fill(); + yyeof2:; + goto yyeof; + } + goto yy14; + } +yy14: + ++YYCURSOR; +yy15: + { return FAIL; } +yy16: + ++YYCURSOR; + { return OK; } +yyeof: + { return EOF; } + + + + +yyFillLabel3: + yych = *YYCURSOR; + switch (yych) { + case 'a': goto yy22; + default: + if (YYLIMIT <= YYCURSOR) { + YYSETSTATE(3); + fill(); + yyeof3:; + goto yyeof; + } + goto yy20; + } +yy20: + ++YYCURSOR; +yy21: + { return FAIL; } +yy22: + ++YYCURSOR; + { return OK; } +yyeof: + { return EOF; } + diff --git a/test/eof/eof_yyfill_naked_2.if.re b/test/eof/eof_yyfill_naked_2.if.re new file mode 100644 index 00000000..7e2a59d6 --- /dev/null +++ b/test/eof/eof_yyfill_naked_2.if.re @@ -0,0 +1,39 @@ +/*!re2c + re2c:eof = 0; +*/ + +/*!re2c + re2c:define:YYFILL = "fill();"; + re2c:define:YYFILL:naked = 1; + re2c:yyfill:parameter = 1; + * { return FAIL; } + $ { return EOF; } + [a] { return OK; } +*/ + +/*!re2c + re2c:define:YYFILL = "fill();"; + re2c:define:YYFILL:naked = 1; + re2c:yyfill:parameter = 0; + * { return FAIL; } + $ { return EOF; } + [a] { return OK; } +*/ + +/*!re2c + re2c:define:YYFILL = "fill"; + re2c:define:YYFILL:naked = 0; + re2c:yyfill:parameter = 1; + * { return FAIL; } + $ { return EOF; } + [a] { return OK; } +*/ + +/*!re2c + re2c:define:YYFILL = "fill()"; + re2c:define:YYFILL:naked = 0; + re2c:yyfill:parameter = 0; + * { return FAIL; } + $ { return EOF; } + [a] { return OK; } +*/ diff --git a/test/eof/sentinel_01.i.c b/test/eof/sentinel_01.i.c new file mode 100644 index 00000000..8b7f6d02 --- /dev/null +++ b/test/eof/sentinel_01.i.c @@ -0,0 +1,5 @@ +eof/sentinel_01.i.re:7:8: warning: sentinel symbol 0 occurs in the middle of the rule (note: if a different sentinel symbol is used, specify it with 're2c:sentinel' configuration) [-Wsentinel-in-midrule] +eof/sentinel_01.i.re:13:8: error: sentinel symbol 0 occurs in the middle of the rule [-Werror-sentinel-in-midrule] +eof/sentinel_01.i.re:19:8: warning: sentinel symbol 0 occurs in the middle of the rule (note: if a different sentinel symbol is used, specify it with 're2c:sentinel' configuration) [-Wsentinel-in-midrule] +eof/sentinel_01.i.re:25:8: error: sentinel symbol 39 occurs in the middle of the rule [-Werror-sentinel-in-midrule] +eof/sentinel_01.i.re:37:8: error: sentinel symbol 255 occurs in the middle of the rule [-Werror-sentinel-in-midrule] diff --git a/test/eof/sentinel_01.i.re b/test/eof/sentinel_01.i.re new file mode 100644 index 00000000..a45e6c03 --- /dev/null +++ b/test/eof/sentinel_01.i.re @@ -0,0 +1,39 @@ +/*!re2c + re2c:yyfill:enable = 0; + str = ['] [^'\xFE]* [']; +*/ + +/*!re2c + str {} + * {} +*/ + +/*!re2c + re2c:sentinel = 0; + str {} + * {} +*/ + +/*!re2c + re2c:sentinel = -1; + str {} + * {} +*/ + +/*!re2c + re2c:sentinel = 39; // single quote + str {} + * {} +*/ + +/*!re2c + re2c:sentinel = 254; // \xFE + str {} + * {} +*/ + +/*!re2c + re2c:sentinel = 255; + str {} + * {} +*/ diff --git a/test/eof/sentinel_02.i.c b/test/eof/sentinel_02.i.c new file mode 100644 index 00000000..0ba886b3 --- /dev/null +++ b/test/eof/sentinel_02.i.c @@ -0,0 +1 @@ +re2c: error: sentinel exceeds maximum code unit value for given encoding diff --git a/test/eof/sentinel_02.i.re b/test/eof/sentinel_02.i.re new file mode 100644 index 00000000..51e88b5e --- /dev/null +++ b/test/eof/sentinel_02.i.re @@ -0,0 +1,9 @@ +/*!re2c + re2c:yyfill:enable = 0; + re2c:sentinel = 256; + + str = ['] [^']* [']; + + str {} + * {} +*/ diff --git a/test/eof/shadowrule_01.i.c b/test/eof/shadowrule_01.i.c new file mode 100644 index 00000000..04b864b5 --- /dev/null +++ b/test/eof/shadowrule_01.i.c @@ -0,0 +1,89 @@ +/* Generated by re2c */ + + +// QUOTE rule is shadowed by the greedy STRING rule, which keeps +// consuming symbols until either it matches the final quote, or +// YYFILL fails and does not return (then it is a no-match). + +{ + YYCTYPE yych; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + switch (yych) { + case '\'': goto yy4; + default: goto yy2; + } +yy2: + ++YYCURSOR; + { /* DEFAULT */ } +yy4: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + switch (yych) { + case '\'': goto yy6; + default: goto yy4; + } +yy6: + ++YYCURSOR; + { /* STRING */ } +} + + +// The same situation, but with EOF rule: now when YYFILL fails +// in the middle of the STRING rule, it returns and it is posible +// to match the shorter QUOTE rule. + +{ + YYCTYPE yych; +yy9_: + yych = *YYCURSOR; + switch (yych) { + case '\'': goto yy12; + default: + if (YYLIMIT <= YYCURSOR) { + if (YYFILL () == 0) goto yy9_; + goto yyeof; + } + goto yy10; + } +yy10: + ++YYCURSOR; +yy11: + { /* DEFAULT */ } +yy12: + ++YYCURSOR; +yy12_: + yych = *YYCURSOR; + if (yych <= 0x00) { + if (YYLIMIT <= YYCURSOR) { + if (YYFILL () == 0) goto yy12_; + goto yy13; + } + goto yy14; + } + goto yy15; +yy13: + { /* QUOTE */ } +yy14: + ++YYCURSOR; +yy14_: + yych = *YYCURSOR; +yy15: + switch (yych) { + case '\'': goto yy16; + default: + if (YYLIMIT <= YYCURSOR) { + if (YYFILL () == 0) goto yy14_; + goto yy11; + } + goto yy14; + } +yy16: + ++YYCURSOR; + { /* STRING */ } +yyeof: + { /* EOF */ } +} + +eof/shadowrule_01.i.re:10:6: warning: unreachable rule (shadowed by rule at line 11) [-Wunreachable-rules] diff --git a/test/eof/shadowrule_01.i.re b/test/eof/shadowrule_01.i.re new file mode 100644 index 00000000..3de453e6 --- /dev/null +++ b/test/eof/shadowrule_01.i.re @@ -0,0 +1,23 @@ +/*!re2c +str = ['] [^']* [']; +*/ + +// QUOTE rule is shadowed by the greedy STRING rule, which keeps +// consuming symbols until either it matches the final quote, or +// YYFILL fails and does not return (then it is a no-match). +/*!re2c +* { /* DEFAULT */ } +['] { /* QUOTE */ } +str { /* STRING */ } +*/ + +// The same situation, but with EOF rule: now when YYFILL fails +// in the middle of the STRING rule, it returns and it is posible +// to match the shorter QUOTE rule. +/*!re2c +re2c:eof = 0; +* { /* DEFAULT */ } +$ { /* EOF */ } +['] { /* QUOTE */ } +str { /* STRING */ } +*/ diff --git a/test/eof/shadowrule_02_hoist.i--tags.c b/test/eof/shadowrule_02_hoist.i--tags.c new file mode 100644 index 00000000..04f293dd --- /dev/null +++ b/test/eof/shadowrule_02_hoist.i--tags.c @@ -0,0 +1,59 @@ +/* Generated by re2c */ +// R1 matches any single character => all transitions from the initial +// state have the same tags which can be hoisted + +{ + YYCTYPE yych; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + yyt1 = YYCURSOR; +yy2: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + switch (yych) { + case 'b': goto yy2; + default: goto yy4; + } +yy4: + x = yyt1; + { /* R1, x must be set */ } +} + + +// R1 matches any single character, but it is also possible to match zero +// characters with EOF rule => tags cannot be hoisted in the initial state +// because of the possible untagged transition to EOF rule + +{ + YYCTYPE yych; +yy6_: + yych = *YYCURSOR; + if (yych >= 0x01) { + yyt1 = YYCURSOR; + goto yy7; + } + if (YYLIMIT <= YYCURSOR) { + if (YYFILL () == 0) goto yy6_; + goto yyeof; + } + yyt1 = YYCURSOR; +yy7: + ++YYCURSOR; +yy7_: + yych = *YYCURSOR; + switch (yych) { + case 'b': goto yy7; + default: + if (YYLIMIT <= YYCURSOR) { + if (YYFILL () == 0) goto yy7_; + } + goto yy9; + } +yy9: + x = yyt1; + { /* R1, x must be set */ } +yyeof: + { /* EOF, x must not be set */ } +} + diff --git a/test/eof/shadowrule_02_hoist.i--tags.re b/test/eof/shadowrule_02_hoist.i--tags.re new file mode 100644 index 00000000..cb5be68e --- /dev/null +++ b/test/eof/shadowrule_02_hoist.i--tags.re @@ -0,0 +1,16 @@ +// R1 matches any single character => all transitions from the initial +// state have the same tags which can be hoisted +/*!re2c +@x [^] [b]* { /* R1, x must be set */ } +* { /* DEFAULT, x must not be set */ } +*/ + +// R1 matches any single character, but it is also possible to match zero +// characters with EOF rule => tags cannot be hoisted in the initial state +// because of the possible untagged transition to EOF rule +/*!re2c +re2c:eof = 0; +@x [^] [b]* { /* R1, x must be set */ } +$ { /* EOF, x must not be set */ } +* { /* DEFAULT, x must not be set */ } +*/ diff --git a/test/eof/shadowrule_03_hoist.i--tags.c b/test/eof/shadowrule_03_hoist.i--tags.c new file mode 100644 index 00000000..49b40549 --- /dev/null +++ b/test/eof/shadowrule_03_hoist.i--tags.c @@ -0,0 +1,74 @@ +/* Generated by re2c */ +// R1 matches any string of two characters (or more). Because of greediness +// ANY rule cannot match on a single-character string (it is shadowed and +// gets eliminated) => tags are hoisted + +{ + YYCTYPE yych; + if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + yych = *YYCURSOR++; + yych = *YYCURSOR; + yyt1 = YYCURSOR; +yy3: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + switch (yych) { + case 'a': goto yy3; + default: goto yy5; + } +yy5: + x = yyt1; + { /* R1, x must be set */ } +} + + +// R1 matches any string of two characters (or more). ANY rule is not shadowed +// because with EOF rule YYFILL returns and rolls back to ANY. Untagged +// fallback transition to ANY prevents tag hoisting. + +{ + YYCTYPE yych; +yy7_: + yych = *YYCURSOR; + if (yych >= 0x01) goto yy8; + if (YYLIMIT <= YYCURSOR) { + if (YYFILL () == 0) goto yy7_; + goto yyeof; + } +yy8: + ++YYCURSOR; +yy8_: + yych = *YYCURSOR; + if (yych <= 0x00) { + if (YYLIMIT <= YYCURSOR) { + if (YYFILL () == 0) goto yy8_; + goto yy9; + } + yyt1 = YYCURSOR; + goto yy10; + } + yyt1 = YYCURSOR; + goto yy10; +yy9: + { /* ANY, x must not be set */ } +yy10: + ++YYCURSOR; +yy10_: + yych = *YYCURSOR; + switch (yych) { + case 'a': goto yy10; + default: + if (YYLIMIT <= YYCURSOR) { + if (YYFILL () == 0) goto yy10_; + } + goto yy12; + } +yy12: + x = yyt1; + { /* R1, x must be set */ } +yyeof: + { /* EOF, x must not be set */ } +} + +eof/shadowrule_03_hoist.i--tags.re:6:16: warning: unreachable rule (shadowed by rule at line 5) [-Wunreachable-rules] diff --git a/test/eof/shadowrule_03_hoist.i--tags.re b/test/eof/shadowrule_03_hoist.i--tags.re new file mode 100644 index 00000000..80fe6ad1 --- /dev/null +++ b/test/eof/shadowrule_03_hoist.i--tags.re @@ -0,0 +1,19 @@ +// R1 matches any string of two characters (or more). Because of greediness +// ANY rule cannot match on a single-character string (it is shadowed and +// gets eliminated) => tags are hoisted +/*!re2c +[^] @x [^] [a]* { /* R1, x must be set */ } +[^] { /* ANY, x must not be set */ } +* { /* DEFAULT, x must not be set */ } +*/ + +// R1 matches any string of two characters (or more). ANY rule is not shadowed +// because with EOF rule YYFILL returns and rolls back to ANY. Untagged +// fallback transition to ANY prevents tag hoisting. +/*!re2c +re2c:eof = 0; +[^] @x [^] [a]* { /* R1, x must be set */ } +[^] { /* ANY, x must not be set */ } +$ { /* EOF, x must not be set */ } +* { /* DEFAULT, x must not be set */ } +*/ diff --git a/test/eof/shadowrule_04_hoist.i--tags.c b/test/eof/shadowrule_04_hoist.i--tags.c new file mode 100644 index 00000000..e62998e2 --- /dev/null +++ b/test/eof/shadowrule_04_hoist.i--tags.c @@ -0,0 +1,64 @@ +/* Generated by re2c */ +// EMPTY rule is shadowed and dead-code-eliminated. Empty string is a no-match. +// Tags are hoisted. + +{ + YYCTYPE yych; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + yyt1 = YYCURSOR; +yy2: + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = *YYCURSOR; + switch (yych) { + case 'a': goto yy2; + default: goto yy4; + } +yy4: + x = yyt1; + { /* R1 - here 'x' must be set */ } +} + + +// EMPTY rule is not shadowed and does match on empty input string. Tags are +// not hoisted because of the untagged fallback transition to EMPTY. + +{ + YYCTYPE yych; +yy6_: + yych = *YYCURSOR; + if (yych <= 0x00) { + if (YYLIMIT <= YYCURSOR) { + if (YYFILL () == 0) goto yy6_; + goto yy7; + } + yyt1 = YYCURSOR; + goto yy8; + } + yyt1 = YYCURSOR; + goto yy8; +yy7: + { /* EMPTY - here 'x' must not be set */ } +yy8: + ++YYCURSOR; +yy8_: + yych = *YYCURSOR; + switch (yych) { + case 'a': goto yy8; + default: + if (YYLIMIT <= YYCURSOR) { + if (YYFILL () == 0) goto yy8_; + } + goto yy10; + } +yy10: + x = yyt1; + { /* R1 - here 'x' must be set */ } +yyeof: + { /* EOF - here 'x' must not be set */ } +} + +eof/shadowrule_04_hoist.i--tags.re:5:12: warning: rule matches empty string [-Wmatch-empty-string] +eof/shadowrule_04_hoist.i--tags.re:5:12: warning: unreachable rule (shadowed by rule at line 4) [-Wunreachable-rules] +eof/shadowrule_04_hoist.i--tags.re:13:12: warning: rule matches empty string [-Wmatch-empty-string] diff --git a/test/eof/shadowrule_04_hoist.i--tags.re b/test/eof/shadowrule_04_hoist.i--tags.re new file mode 100644 index 00000000..a1d6d960 --- /dev/null +++ b/test/eof/shadowrule_04_hoist.i--tags.re @@ -0,0 +1,15 @@ +// EMPTY rule is shadowed and dead-code-eliminated. Empty string is a no-match. +// Tags are hoisted. +/*!re2c +@x [^] [a]* { /* R1 - here 'x' must be set */ } +"" { /* EMPTY - here 'x' must not be set */ } +*/ + +// EMPTY rule is not shadowed and does match on empty input string. Tags are +// not hoisted because of the untagged fallback transition to EMPTY. +/*!re2c +re2c:eof = 0; +@x [^] [a]* { /* R1 - here 'x' must be set */ } +"" { /* EMPTY - here 'x' must not be set */ } +$ { /* EOF - here 'x' must not be set */ } +*/ diff --git a/test/eof/utf8_any.i.re b/test/eof/utf8_any.i.re index 30c45fb7..192587e1 100644 --- a/test/eof/utf8_any.i.re +++ b/test/eof/utf8_any.i.re @@ -104,6 +104,7 @@ static Result lex1_simple(uint8_t *cur, uint8_t* end, uint8_t* /* unused */) uint8_t *YYMARKER, *tok = cur; /*!re2c re2c:yyfill:enable = 1; + re2c:define:YYFILL:naked = 0; re2c:define:YYFILL = fill; re2c:eof = 0; |