From: Ulya Trofimovich Date: Mon, 6 Mar 2017 17:31:22 +0000 (+0000) Subject: Check precondition inside of the function rather than at every call site. X-Git-Tag: 1.0~39^2~101 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f8ebfc977d837b6d4d7b0b1c56b0e5ea7108e724;p=re2c Check precondition inside of the function rather than at every call site. Changes in tests are caused by the lack of newline after '/*!ignore:re2c*/' directive. There's no particular reason why it should be emitted and RE2C code is simpler without it. --- diff --git a/re2c/bootstrap/src/ast/lex.cc b/re2c/bootstrap/src/ast/lex.cc index 22b11f29..1349b44d 100644 --- a/re2c/bootstrap/src/ast/lex.cc +++ b/re2c/bootstrap/src/ast/lex.cc @@ -1,4 +1,4 @@ -/* Generated by re2c 0.16 on Mon Mar 6 11:22:46 2017 */ +/* Generated by re2c 0.16 on Mon Mar 6 17:22:49 2017 */ #line 1 "../src/ast/lex.re" #include "src/util/c99_stdint.h" #include @@ -23,7 +23,7 @@ extern YYSTYPE yylval; #define YYCTYPE unsigned char #define YYCURSOR cur #define YYLIMIT lim -#define YYMARKER ptr +#define YYMARKER mar #define YYCTXMARKER ctx #define YYFILL(n) { fill (n); } @@ -48,7 +48,7 @@ Scanner::ParseMode Scanner::echo() tok = cur; echo: - const char *start = cur; + ptr = cur; #line 55 "src/ast/lex.cc" @@ -109,23 +109,19 @@ echo: } } ++YYCURSOR; -#line 137 "../src/ast/lex.re" +#line 121 "../src/ast/lex.re" { - if (cur == eof) { - if (opts->target == opt_t::CODE) { - out.wraw(tok, start); - } - return Stop; - } - goto echo; + if (cur != eof) goto echo; + out.wraw(tok, ptr); + return Stop; } -#line 123 "src/ast/lex.cc" +#line 119 "src/ast/lex.cc" yy4: ++YYCURSOR; yy5: -#line 158 "../src/ast/lex.re" +#line 138 "../src/ast/lex.re" { goto echo; } -#line 129 "src/ast/lex.cc" +#line 125 "src/ast/lex.cc" yy6: yyaccept = 0; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -134,13 +130,13 @@ yy6: } if (yych == '#') goto yy14; yy7: -#line 152 "../src/ast/lex.re" +#line 132 "../src/ast/lex.re" { cline++; pos = cur; goto echo; } -#line 144 "src/ast/lex.cc" +#line 140 "src/ast/lex.cc" yy8: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy6; @@ -185,12 +181,10 @@ yy16: ++YYCURSOR; #line 71 "../src/ast/lex.re" { - if (opts->target == opt_t::CODE) { - out.wraw(tok, start); - } + out.wraw(tok, ptr); return Parse; } -#line 194 "src/ast/lex.cc" +#line 188 "src/ast/lex.cc" yy18: yych = (YYCTYPE)*++YYCURSOR; if (yych == '!') goto yy20; @@ -418,12 +412,12 @@ yy64: yy66: ++YYCURSOR; YYCURSOR = YYCTXMARKER; -#line 147 "../src/ast/lex.re" +#line 127 "../src/ast/lex.re" { set_sourceline(); goto echo; } -#line 427 "src/ast/lex.cc" +#line 421 "src/ast/lex.cc" yy68: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy66; @@ -515,16 +509,14 @@ yy88: goto yy13; yy89: ++YYCURSOR; -#line 100 "../src/ast/lex.re" +#line 92 "../src/ast/lex.re" { - if (opts->target == opt_t::CODE) { - out.wraw(tok, start) - .wdelay_yymaxfill(); - } + out.wraw(tok, ptr); + out.wdelay_yymaxfill(); lex_end_of_comment(); goto echo; } -#line 528 "src/ast/lex.cc" +#line 520 "src/ast/lex.cc" yy91: yych = (YYCTYPE)*++YYCURSOR; if (yych == '2') goto yy98; @@ -539,14 +531,12 @@ yy93: goto yy13; yy94: ++YYCURSOR; -#line 85 "../src/ast/lex.re" +#line 81 "../src/ast/lex.re" { - if (opts->target == opt_t::CODE) { - out.wraw(tok, start); - } + out.wraw(tok, ptr); return Reuse; } -#line 550 "src/ast/lex.cc" +#line 540 "src/ast/lex.cc" yy96: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy102; @@ -561,15 +551,13 @@ yy98: goto yy13; yy99: ++YYCURSOR; -#line 129 "../src/ast/lex.re" +#line 115 "../src/ast/lex.re" { - if (opts->target == opt_t::CODE) { - out.wraw(tok, start); - } + out.wraw(tok, ptr); lex_tags(); goto echo; } -#line 573 "src/ast/lex.cc" +#line 561 "src/ast/lex.cc" yy101: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'c') goto yy106; @@ -584,59 +572,51 @@ yy103: goto yy13; yy104: ++YYCURSOR; -#line 78 "../src/ast/lex.re" +#line 76 "../src/ast/lex.re" { - if (opts->target == opt_t::CODE) { - out.wraw(tok, start); - } + out.wraw(tok, ptr); return Rules; } -#line 595 "src/ast/lex.cc" +#line 581 "src/ast/lex.cc" yy106: ++YYCURSOR; -#line 118 "../src/ast/lex.re" +#line 106 "../src/ast/lex.re" { - if (opts->target == opt_t::CODE) { - out.wraw(tok, start) - .wdelay_line_info() - .wdelay_types() - .wline_info(cline, get_fname().c_str()); - } + out.wraw(tok, ptr); + out.wdelay_line_info(); + out.wdelay_types(); + out.wline_info(cline, get_fname().c_str()); lex_end_of_comment(); goto echo; } -#line 609 "src/ast/lex.cc" +#line 593 "src/ast/lex.cc" yy108: yych = (YYCTYPE)*++YYCURSOR; if (yych == '2') goto yy111; goto yy13; yy109: ++YYCURSOR; -#line 92 "../src/ast/lex.re" +#line 86 "../src/ast/lex.re" { - if (opts->target == opt_t::CODE) { - out.wraw(tok, start); - } + out.wraw(tok, ptr); lex_end_of_comment(); goto echo; } -#line 624 "src/ast/lex.cc" +#line 606 "src/ast/lex.cc" yy111: yych = (YYCTYPE)*++YYCURSOR; if (yych != 'c') goto yy13; ++YYCURSOR; -#line 109 "../src/ast/lex.re" +#line 99 "../src/ast/lex.re" { - if (opts->target == opt_t::CODE) { - out.wraw(tok, start) - .wdelay_state_goto(opts->topIndent); - } + out.wraw(tok, ptr); + out.wdelay_state_goto(0); lex_end_of_comment(); goto echo; } -#line 638 "src/ast/lex.cc" +#line 618 "src/ast/lex.cc" } -#line 159 "../src/ast/lex.re" +#line 139 "../src/ast/lex.re" } @@ -644,7 +624,7 @@ void Scanner::lex_end_of_comment() { uint32_t ignored = 0; for (;;) { -#line 648 "src/ast/lex.cc" +#line 628 "src/ast/lex.cc" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -660,20 +640,20 @@ void Scanner::lex_end_of_comment() } yy116: ++YYCURSOR; -#line 166 "../src/ast/lex.re" +#line 146 "../src/ast/lex.re" { fatal("expected end of block"); } -#line 666 "src/ast/lex.cc" +#line 646 "src/ast/lex.cc" yy118: ++YYCURSOR; yy119: -#line 168 "../src/ast/lex.re" +#line 148 "../src/ast/lex.re" { continue; } -#line 672 "src/ast/lex.cc" +#line 652 "src/ast/lex.cc" yy120: ++YYCURSOR; -#line 169 "../src/ast/lex.re" +#line 149 "../src/ast/lex.re" { ++ignored; continue; } -#line 677 "src/ast/lex.cc" +#line 657 "src/ast/lex.cc" yy122: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy120; @@ -682,18 +662,18 @@ yy123: yych = (YYCTYPE)*++YYCURSOR; if (yych != '/') goto yy119; ++YYCURSOR; -#line 170 "../src/ast/lex.re" +#line 150 "../src/ast/lex.re" { if (ignored > 0) { cline += ignored; - out.ws("\n").wline_info(cline, get_fname().c_str()); + out.wline_info(cline, get_fname().c_str()); } tok = pos = cur; return; } -#line 695 "src/ast/lex.cc" +#line 675 "src/ast/lex.cc" } -#line 178 "../src/ast/lex.re" +#line 158 "../src/ast/lex.re" } } @@ -701,7 +681,7 @@ void Scanner::lex_tags() { std::string fmt, sep; for (;;) { -#line 705 "src/ast/lex.cc" +#line 685 "src/ast/lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -759,9 +739,9 @@ void Scanner::lex_tags() } ++YYCURSOR; yy129: -#line 185 "../src/ast/lex.re" +#line 165 "../src/ast/lex.re" { fatal("unrecognized configuration"); } -#line 765 "src/ast/lex.cc" +#line 745 "src/ast/lex.cc" yy130: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -769,14 +749,14 @@ yy130: if (yybm[0+yych] & 128) { goto yy130; } -#line 190 "../src/ast/lex.re" +#line 170 "../src/ast/lex.re" { continue; } -#line 775 "src/ast/lex.cc" +#line 755 "src/ast/lex.cc" yy133: ++YYCURSOR; -#line 191 "../src/ast/lex.re" +#line 171 "../src/ast/lex.re" { ++cline; continue; } -#line 780 "src/ast/lex.cc" +#line 760 "src/ast/lex.cc" yy135: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy133; @@ -795,16 +775,13 @@ yy138: goto yy129; yy139: ++YYCURSOR; -#line 192 "../src/ast/lex.re" +#line 172 "../src/ast/lex.re" { - if (opts->target == opt_t::CODE) { - out.wdelay_tags(opts->topIndent, - new ConfTags(fmt, sep)); - } + out.wdelay_tags(new ConfTags(fmt, sep)); tok = pos = cur; return; } -#line 808 "src/ast/lex.cc" +#line 785 "src/ast/lex.cc" yy141: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy144; @@ -841,9 +818,9 @@ yy149: goto yy142; yy150: ++YYCURSOR; -#line 187 "../src/ast/lex.re" +#line 167 "../src/ast/lex.re" { fmt = lex_conf_string(); continue; } -#line 847 "src/ast/lex.cc" +#line 824 "src/ast/lex.cc" yy152: yych = (YYCTYPE)*++YYCURSOR; if (yych != 't') goto yy142; @@ -852,11 +829,11 @@ yy152: yych = (YYCTYPE)*++YYCURSOR; if (yych != 'r') goto yy142; ++YYCURSOR; -#line 188 "../src/ast/lex.re" +#line 168 "../src/ast/lex.re" { sep = lex_conf_string(); continue; } -#line 858 "src/ast/lex.cc" +#line 835 "src/ast/lex.cc" } -#line 200 "../src/ast/lex.re" +#line 177 "../src/ast/lex.re" } } @@ -874,7 +851,7 @@ scan: start: -#line 878 "src/ast/lex.cc" +#line 855 "src/ast/lex.cc" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -971,12 +948,12 @@ start: yy159: ++YYCURSOR; yy160: -#line 365 "../src/ast/lex.re" +#line 342 "../src/ast/lex.re" { fatalf("unexpected character: '%c'", *tok); goto scan; } -#line 980 "src/ast/lex.cc" +#line 957 "src/ast/lex.cc" yy161: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -984,11 +961,11 @@ yy161: if (yybm[0+yych] & 16) { goto yy161; } -#line 349 "../src/ast/lex.re" +#line 326 "../src/ast/lex.re" { goto scan; } -#line 992 "src/ast/lex.cc" +#line 969 "src/ast/lex.cc" yy164: yyaccept = 0; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -999,14 +976,14 @@ yy164: if (yych == '#') goto yy190; } yy165: -#line 358 "../src/ast/lex.re" +#line 335 "../src/ast/lex.re" { if (cur == eof) return 0; pos = cur; cline++; goto scan; } -#line 1010 "src/ast/lex.cc" +#line 987 "src/ast/lex.cc" yy166: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy164; @@ -1014,35 +991,35 @@ yy166: yy167: ++YYCURSOR; yy168: -#line 262 "../src/ast/lex.re" +#line 239 "../src/ast/lex.re" { return *tok; } -#line 1020 "src/ast/lex.cc" +#line 997 "src/ast/lex.cc" yy169: ++YYCURSOR; -#line 249 "../src/ast/lex.re" +#line 226 "../src/ast/lex.re" { yylval.regexp = lex_str('"'); return TOKEN_REGEXP; } -#line 1025 "src/ast/lex.cc" +#line 1002 "src/ast/lex.cc" yy171: yych = (YYCTYPE)*++YYCURSOR; if (yych == '}') goto yy192; goto yy160; yy172: ++YYCURSOR; -#line 248 "../src/ast/lex.re" +#line 225 "../src/ast/lex.re" { yylval.regexp = lex_str('\''); return TOKEN_REGEXP; } -#line 1034 "src/ast/lex.cc" +#line 1011 "src/ast/lex.cc" yy174: yych = (YYCTYPE)*++YYCURSOR; if (yych == '/') goto yy192; goto yy168; yy175: ++YYCURSOR; -#line 344 "../src/ast/lex.re" +#line 321 "../src/ast/lex.re" { yylval.regexp = ast_dot(cline, get_column()); return TOKEN_REGEXP; } -#line 1046 "src/ast/lex.cc" +#line 1023 "src/ast/lex.cc" yy177: yych = (YYCTYPE)*++YYCURSOR; if (yych == '*') goto yy194; @@ -1102,9 +1079,9 @@ yy181: yy182: yych = (YYCTYPE)*++YYCURSOR; if (yych == '^') goto yy209; -#line 250 "../src/ast/lex.re" +#line 227 "../src/ast/lex.re" { yylval.regexp = lex_cls(false); return TOKEN_REGEXP; } -#line 1108 "src/ast/lex.cc" +#line 1085 "src/ast/lex.cc" yy184: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy211; @@ -1127,13 +1104,13 @@ yy185: } } yy186: -#line 217 "../src/ast/lex.re" +#line 194 "../src/ast/lex.re" { depth = 1; code_line = cline; goto code; } -#line 1137 "src/ast/lex.cc" +#line 1114 "src/ast/lex.cc" yy187: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -1169,31 +1146,31 @@ yy190: } yy192: ++YYCURSOR; -#line 243 "../src/ast/lex.re" +#line 220 "../src/ast/lex.re" { tok = cur; return 0; } -#line 1178 "src/ast/lex.cc" +#line 1155 "src/ast/lex.cc" yy194: ++YYCURSOR; -#line 237 "../src/ast/lex.re" +#line 214 "../src/ast/lex.re" { depth = 1; goto comment; } -#line 1186 "src/ast/lex.cc" +#line 1163 "src/ast/lex.cc" yy196: ++YYCURSOR; -#line 234 "../src/ast/lex.re" +#line 211 "../src/ast/lex.re" { goto nextLine; } -#line 1193 "src/ast/lex.cc" +#line 1170 "src/ast/lex.cc" yy198: ++YYCURSOR; YYCURSOR -= 1; -#line 327 "../src/ast/lex.re" +#line 304 "../src/ast/lex.re" { if (!opts->FFlag) { yylval.str = new std::string (tok, tok_len()); @@ -1203,14 +1180,14 @@ yy198: for (char *s = tok; s < cur; ++s) { const uint32_t chr = static_cast(*s), - col = static_cast(s - ptr); + col = static_cast(s - tok); str->push_back(ASTChar(chr, col)); } yylval.regexp = ast_str(cline, get_column(), str, false); return TOKEN_REGEXP; } } -#line 1214 "src/ast/lex.cc" +#line 1191 "src/ast/lex.cc" yy200: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -1230,23 +1207,23 @@ yy200: yy202: ++YYCURSOR; YYCURSOR = YYCTXMARKER; -#line 322 "../src/ast/lex.re" +#line 299 "../src/ast/lex.re" { yylval.str = new std::string (tok, tok_len ()); return TOKEN_ID; } -#line 1239 "src/ast/lex.cc" +#line 1216 "src/ast/lex.cc" yy204: yych = (YYCTYPE)*++YYCURSOR; if (yych == '>') goto yy221; -#line 227 "../src/ast/lex.re" +#line 204 "../src/ast/lex.re" { tok += 2; /* skip ":=" */ depth = 0; code_line = cline; goto code; } -#line 1250 "src/ast/lex.cc" +#line 1227 "src/ast/lex.cc" yy206: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -1264,7 +1241,7 @@ yy206: } } yy208: -#line 253 "../src/ast/lex.re" +#line 230 "../src/ast/lex.re" { if (!opts->tags) { fatal("tags are only allowed with '-T, --tags' option"); @@ -1273,12 +1250,12 @@ yy208: yylval.regexp = ast_tag(cline, get_column(), name); return TOKEN_REGEXP; } -#line 1277 "src/ast/lex.cc" +#line 1254 "src/ast/lex.cc" yy209: ++YYCURSOR; -#line 251 "../src/ast/lex.re" +#line 228 "../src/ast/lex.re" { yylval.regexp = lex_cls(true); return TOKEN_REGEXP; } -#line 1282 "src/ast/lex.cc" +#line 1259 "src/ast/lex.cc" yy211: yych = (YYCTYPE)*++YYCURSOR; if (yych == '2') goto yy223; @@ -1286,11 +1263,11 @@ yy211: yy212: ++YYCURSOR; yy213: -#line 295 "../src/ast/lex.re" +#line 272 "../src/ast/lex.re" { fatal("illegal closure form, use '{n}', '{n,}', '{n,m}' where n and m are numbers"); } -#line 1294 "src/ast/lex.cc" +#line 1271 "src/ast/lex.cc" yy214: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -1343,7 +1320,7 @@ yy218: yy219: ++YYCURSOR; YYCURSOR = YYCTXMARKER; -#line 309 "../src/ast/lex.re" +#line 286 "../src/ast/lex.re" { yylval.str = new std::string (tok, tok_len ()); if (opts->FFlag) @@ -1356,15 +1333,15 @@ yy219: return TOKEN_ID; } } -#line 1360 "src/ast/lex.cc" +#line 1337 "src/ast/lex.cc" yy221: ++YYCURSOR; YYCURSOR -= 2; -#line 223 "../src/ast/lex.re" +#line 200 "../src/ast/lex.re" { return *tok; } -#line 1368 "src/ast/lex.cc" +#line 1345 "src/ast/lex.cc" yy223: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'c') goto yy230; @@ -1378,7 +1355,7 @@ yy224: goto yy213; yy225: ++YYCURSOR; -#line 264 "../src/ast/lex.re" +#line 241 "../src/ast/lex.re" { if (!s_to_u32_unsafe (tok + 1, cur - 1, yylval.bounds.min)) { @@ -1387,10 +1364,10 @@ yy225: yylval.bounds.max = yylval.bounds.min; return TOKEN_CLOSESIZE; } -#line 1391 "src/ast/lex.cc" +#line 1368 "src/ast/lex.cc" yy227: ++YYCURSOR; -#line 299 "../src/ast/lex.re" +#line 276 "../src/ast/lex.re" { if (!opts->FFlag) { fatal("curly braces for names only allowed with -F switch"); @@ -1398,7 +1375,7 @@ yy227: yylval.str = new std::string (tok + 1, tok_len () - 2); // -2 to omit braces return TOKEN_ID; } -#line 1402 "src/ast/lex.cc" +#line 1379 "src/ast/lex.cc" yy229: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'n') goto yy235; @@ -1417,7 +1394,7 @@ yy231: goto yy189; yy233: ++YYCURSOR; -#line 286 "../src/ast/lex.re" +#line 263 "../src/ast/lex.re" { if (!s_to_u32_unsafe (tok + 1, cur - 2, yylval.bounds.min)) { @@ -1426,19 +1403,19 @@ yy233: yylval.bounds.max = std::numeric_limits::max(); return TOKEN_CLOSESIZE; } -#line 1430 "src/ast/lex.cc" +#line 1407 "src/ast/lex.cc" yy235: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy240; goto yy189; yy236: ++YYCURSOR; -#line 307 "../src/ast/lex.re" +#line 284 "../src/ast/lex.re" { lex_conf (); return TOKEN_CONF; } -#line 1439 "src/ast/lex.cc" +#line 1416 "src/ast/lex.cc" yy238: ++YYCURSOR; -#line 273 "../src/ast/lex.re" +#line 250 "../src/ast/lex.re" { const char * p = strchr (tok, ','); if (!s_to_u32_unsafe (tok + 1, p, yylval.bounds.min)) @@ -1451,7 +1428,7 @@ yy238: } return TOKEN_CLOSESIZE; } -#line 1455 "src/ast/lex.cc" +#line 1432 "src/ast/lex.cc" yy240: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '0') goto yy242; @@ -1507,12 +1484,12 @@ yy245: yy247: ++YYCURSOR; YYCURSOR = YYCTXMARKER; -#line 353 "../src/ast/lex.re" +#line 330 "../src/ast/lex.re" { set_sourceline (); goto scan; } -#line 1516 "src/ast/lex.cc" +#line 1493 "src/ast/lex.cc" yy249: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy247; @@ -1537,12 +1514,12 @@ yy253: if (yych == '\n') goto yy189; goto yy250; } -#line 369 "../src/ast/lex.re" +#line 346 "../src/ast/lex.re" flex_name: -#line 1546 "src/ast/lex.cc" +#line 1523 "src/ast/lex.cc" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -1551,32 +1528,32 @@ flex_name: if (yych == '\r') goto yy260; ++YYCURSOR; yy257: -#line 380 "../src/ast/lex.re" +#line 357 "../src/ast/lex.re" { YYCURSOR = tok; goto start; } -#line 1560 "src/ast/lex.cc" +#line 1537 "src/ast/lex.cc" yy258: ++YYCURSOR; -#line 374 "../src/ast/lex.re" +#line 351 "../src/ast/lex.re" { YYCURSOR = tok; lexer_state = LEX_NORMAL; return TOKEN_FID_END; } -#line 1569 "src/ast/lex.cc" +#line 1546 "src/ast/lex.cc" yy260: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy258; goto yy257; } -#line 384 "../src/ast/lex.re" +#line 361 "../src/ast/lex.re" code: -#line 1580 "src/ast/lex.cc" +#line 1557 "src/ast/lex.cc" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -1637,7 +1614,7 @@ code: } yy263: ++YYCURSOR; -#line 447 "../src/ast/lex.re" +#line 424 "../src/ast/lex.re" { if (cur == eof) { @@ -1649,15 +1626,15 @@ yy263: } goto code; } -#line 1653 "src/ast/lex.cc" +#line 1630 "src/ast/lex.cc" yy265: ++YYCURSOR; yy266: -#line 461 "../src/ast/lex.re" +#line 438 "../src/ast/lex.re" { goto code; } -#line 1661 "src/ast/lex.cc" +#line 1638 "src/ast/lex.cc" yy267: yyaccept = 0; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -1676,7 +1653,7 @@ yy267: } } yy268: -#line 428 "../src/ast/lex.re" +#line 405 "../src/ast/lex.re" { if (depth == 0) { @@ -1696,7 +1673,7 @@ yy268: cline++; goto code; } -#line 1700 "src/ast/lex.cc" +#line 1677 "src/ast/lex.cc" yy269: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -1709,7 +1686,7 @@ yy270: goto yy287; yy271: ++YYCURSOR; -#line 400 "../src/ast/lex.re" +#line 377 "../src/ast/lex.re" { if (depth == 0) { @@ -1721,10 +1698,10 @@ yy271: } goto code; } -#line 1725 "src/ast/lex.cc" +#line 1702 "src/ast/lex.cc" yy273: ++YYCURSOR; -#line 388 "../src/ast/lex.re" +#line 365 "../src/ast/lex.re" { if (depth == 0) { @@ -1737,7 +1714,7 @@ yy273: } goto code; } -#line 1741 "src/ast/lex.cc" +#line 1718 "src/ast/lex.cc" yy275: yyaccept = 2; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -1749,7 +1726,7 @@ yy275: } yy276: YYCURSOR -= 1; -#line 415 "../src/ast/lex.re" +#line 392 "../src/ast/lex.re" { if (depth == 0) { @@ -1763,7 +1740,7 @@ yy276: cline++; goto code; } -#line 1767 "src/ast/lex.cc" +#line 1744 "src/ast/lex.cc" yy277: ++YYCURSOR; goto yy276; @@ -1798,11 +1775,11 @@ yy282: if (yych >= '#') goto yy285; yy283: ++YYCURSOR; -#line 458 "../src/ast/lex.re" +#line 435 "../src/ast/lex.re" { goto code; } -#line 1806 "src/ast/lex.cc" +#line 1783 "src/ast/lex.cc" yy285: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -1892,12 +1869,12 @@ yy299: yy301: ++YYCURSOR; YYCURSOR = YYCTXMARKER; -#line 411 "../src/ast/lex.re" +#line 388 "../src/ast/lex.re" { set_sourceline (); goto code; } -#line 1901 "src/ast/lex.cc" +#line 1878 "src/ast/lex.cc" yy303: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy301; @@ -1926,12 +1903,12 @@ yy307: if (yych == '\n') goto yy280; goto yy304; } -#line 464 "../src/ast/lex.re" +#line 441 "../src/ast/lex.re" comment: -#line 1935 "src/ast/lex.cc" +#line 1912 "src/ast/lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -1978,7 +1955,7 @@ comment: } ++YYCURSOR; yy311: -#line 496 "../src/ast/lex.re" +#line 473 "../src/ast/lex.re" { if (cur == eof) { @@ -1986,7 +1963,7 @@ yy311: } goto comment; } -#line 1990 "src/ast/lex.cc" +#line 1967 "src/ast/lex.cc" yy312: yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yybm[0+yych] & 32) { @@ -1994,7 +1971,7 @@ yy312: } if (yych == '#') goto yy319; yy313: -#line 487 "../src/ast/lex.re" +#line 464 "../src/ast/lex.re" { if (cur == eof) { @@ -2004,7 +1981,7 @@ yy313: cline++; goto comment; } -#line 2008 "src/ast/lex.cc" +#line 1985 "src/ast/lex.cc" yy314: yych = (YYCTYPE)*++YYCURSOR; if (yych == '/') goto yy321; @@ -2038,7 +2015,7 @@ yy319: } yy321: ++YYCURSOR; -#line 468 "../src/ast/lex.re" +#line 445 "../src/ast/lex.re" { if (--depth == 0) { @@ -2049,16 +2026,16 @@ yy321: goto comment; } } -#line 2053 "src/ast/lex.cc" +#line 2030 "src/ast/lex.cc" yy323: ++YYCURSOR; -#line 478 "../src/ast/lex.re" +#line 455 "../src/ast/lex.re" { ++depth; fatal("ambiguous /* found"); goto comment; } -#line 2062 "src/ast/lex.cc" +#line 2039 "src/ast/lex.cc" yy325: yych = (YYCTYPE)*++YYCURSOR; if (yych != 'i') goto yy318; @@ -2115,12 +2092,12 @@ yy333: yy335: ++YYCURSOR; YYCURSOR = YYCTXMARKER; -#line 483 "../src/ast/lex.re" +#line 460 "../src/ast/lex.re" { set_sourceline (); goto comment; } -#line 2124 "src/ast/lex.cc" +#line 2101 "src/ast/lex.cc" yy337: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy335; @@ -2145,28 +2122,28 @@ yy341: if (yych == '\n') goto yy318; goto yy338; } -#line 503 "../src/ast/lex.re" +#line 480 "../src/ast/lex.re" nextLine: -#line 2154 "src/ast/lex.cc" +#line 2131 "src/ast/lex.cc" { YYCTYPE yych; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yych == '\n') goto yy346; ++YYCURSOR; -#line 514 "../src/ast/lex.re" +#line 491 "../src/ast/lex.re" { if(cur == eof) { return 0; } goto nextLine; } -#line 2167 "src/ast/lex.cc" +#line 2144 "src/ast/lex.cc" yy346: ++YYCURSOR; -#line 507 "../src/ast/lex.re" +#line 484 "../src/ast/lex.re" { if(cur == eof) { return 0; } @@ -2174,9 +2151,9 @@ yy346: cline++; goto scan; } -#line 2178 "src/ast/lex.cc" +#line 2155 "src/ast/lex.cc" } -#line 519 "../src/ast/lex.re" +#line 496 "../src/ast/lex.re" } @@ -2202,35 +2179,35 @@ fst: tok = cur; c = get_column(); -#line 2206 "src/ast/lex.cc" +#line 2183 "src/ast/lex.cc" { YYCTYPE yych; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yych == ']') goto yy351; -#line 545 "../src/ast/lex.re" +#line 522 "../src/ast/lex.re" { l = lex_cls_chr(); goto snd; } -#line 2214 "src/ast/lex.cc" +#line 2191 "src/ast/lex.cc" yy351: ++YYCURSOR; -#line 544 "../src/ast/lex.re" +#line 521 "../src/ast/lex.re" { return ast_cls(cline, c0, cls, neg); } -#line 2219 "src/ast/lex.cc" +#line 2196 "src/ast/lex.cc" } -#line 546 "../src/ast/lex.re" +#line 523 "../src/ast/lex.re" snd: -#line 2225 "src/ast/lex.cc" +#line 2202 "src/ast/lex.cc" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = (YYCTYPE)*(YYMARKER = YYCURSOR); if (yych == '-') goto yy356; yy355: -#line 549 "../src/ast/lex.re" +#line 526 "../src/ast/lex.re" { u = l; goto add; } -#line 2234 "src/ast/lex.cc" +#line 2211 "src/ast/lex.cc" yy356: yych = (YYCTYPE)*++YYCURSOR; if (yych != ']') goto yy358; @@ -2239,7 +2216,7 @@ yy356: yy358: ++YYCURSOR; YYCURSOR -= 1; -#line 550 "../src/ast/lex.re" +#line 527 "../src/ast/lex.re" { u = lex_cls_chr(); if (l > u) { @@ -2248,9 +2225,9 @@ yy358: } goto add; } -#line 2252 "src/ast/lex.cc" +#line 2229 "src/ast/lex.cc" } -#line 558 "../src/ast/lex.re" +#line 535 "../src/ast/lex.re" add: cls->push_back(ASTRange(l, u, c)); @@ -2261,7 +2238,7 @@ uint32_t Scanner::lex_cls_chr() { tok = cur; -#line 2265 "src/ast/lex.cc" +#line 2242 "src/ast/lex.cc" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -2270,14 +2247,14 @@ uint32_t Scanner::lex_cls_chr() if (yych == '\n') goto yy364; if (yych == '\\') goto yy366; ++YYCURSOR; -#line 573 "../src/ast/lex.re" +#line 550 "../src/ast/lex.re" { return static_cast(tok[0]); } -#line 2276 "src/ast/lex.cc" +#line 2253 "src/ast/lex.cc" yy364: ++YYCURSOR; -#line 568 "../src/ast/lex.re" +#line 545 "../src/ast/lex.re" { fatal (get_column() - tchar, "syntax error"); } -#line 2281 "src/ast/lex.cc" +#line 2258 "src/ast/lex.cc" yy366: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '`') { @@ -2326,31 +2303,31 @@ yy366: } } } -#line 571 "../src/ast/lex.re" +#line 548 "../src/ast/lex.re" { fatal (get_column() - tchar, "syntax error in escape sequence"); } -#line 2332 "src/ast/lex.cc" +#line 2309 "src/ast/lex.cc" yy368: ++YYCURSOR; -#line 586 "../src/ast/lex.re" +#line 563 "../src/ast/lex.re" { warn.useless_escape(cline, get_column(), tok[1]); return static_cast(tok[1]); } -#line 2340 "src/ast/lex.cc" +#line 2317 "src/ast/lex.cc" yy370: ++YYCURSOR; -#line 584 "../src/ast/lex.re" +#line 561 "../src/ast/lex.re" { return static_cast('-'); } -#line 2345 "src/ast/lex.cc" +#line 2322 "src/ast/lex.cc" yy372: yyaccept = 0; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '/') goto yy373; if (yych <= '7') goto yy397; yy373: -#line 570 "../src/ast/lex.re" +#line 547 "../src/ast/lex.re" { fatal (get_column() - tchar, "syntax error in octal escape sequence"); } -#line 2354 "src/ast/lex.cc" +#line 2331 "src/ast/lex.cc" yy374: ++YYCURSOR; goto yy373; @@ -2366,9 +2343,9 @@ yy375: if (yych <= 'f') goto yy399; } yy376: -#line 569 "../src/ast/lex.re" +#line 546 "../src/ast/lex.re" { fatal (get_column() - tchar, "syntax error in hexadecimal escape sequence"); } -#line 2372 "src/ast/lex.cc" +#line 2349 "src/ast/lex.cc" yy377: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -2384,49 +2361,49 @@ yy377: } yy378: ++YYCURSOR; -#line 583 "../src/ast/lex.re" +#line 560 "../src/ast/lex.re" { return static_cast('\\'); } -#line 2390 "src/ast/lex.cc" +#line 2367 "src/ast/lex.cc" yy380: ++YYCURSOR; -#line 585 "../src/ast/lex.re" +#line 562 "../src/ast/lex.re" { return static_cast(']'); } -#line 2395 "src/ast/lex.cc" +#line 2372 "src/ast/lex.cc" yy382: ++YYCURSOR; -#line 576 "../src/ast/lex.re" +#line 553 "../src/ast/lex.re" { return static_cast('\a'); } -#line 2400 "src/ast/lex.cc" +#line 2377 "src/ast/lex.cc" yy384: ++YYCURSOR; -#line 577 "../src/ast/lex.re" +#line 554 "../src/ast/lex.re" { return static_cast('\b'); } -#line 2405 "src/ast/lex.cc" +#line 2382 "src/ast/lex.cc" yy386: ++YYCURSOR; -#line 578 "../src/ast/lex.re" +#line 555 "../src/ast/lex.re" { return static_cast('\f'); } -#line 2410 "src/ast/lex.cc" +#line 2387 "src/ast/lex.cc" yy388: ++YYCURSOR; -#line 579 "../src/ast/lex.re" +#line 556 "../src/ast/lex.re" { return static_cast('\n'); } -#line 2415 "src/ast/lex.cc" +#line 2392 "src/ast/lex.cc" yy390: ++YYCURSOR; -#line 580 "../src/ast/lex.re" +#line 557 "../src/ast/lex.re" { return static_cast('\r'); } -#line 2420 "src/ast/lex.cc" +#line 2397 "src/ast/lex.cc" yy392: ++YYCURSOR; -#line 581 "../src/ast/lex.re" +#line 558 "../src/ast/lex.re" { return static_cast('\t'); } -#line 2425 "src/ast/lex.cc" +#line 2402 "src/ast/lex.cc" yy394: ++YYCURSOR; -#line 582 "../src/ast/lex.re" +#line 559 "../src/ast/lex.re" { return static_cast('\v'); } -#line 2430 "src/ast/lex.cc" +#line 2407 "src/ast/lex.cc" yy396: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -2489,9 +2466,9 @@ yy401: } yy402: ++YYCURSOR; -#line 575 "../src/ast/lex.re" +#line 552 "../src/ast/lex.re" { return unesc_oct(tok, cur); } -#line 2495 "src/ast/lex.cc" +#line 2472 "src/ast/lex.cc" yy404: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { @@ -2518,9 +2495,9 @@ yy405: } yy406: ++YYCURSOR; -#line 574 "../src/ast/lex.re" +#line 551 "../src/ast/lex.re" { return unesc_hex(tok, cur); } -#line 2524 "src/ast/lex.cc" +#line 2501 "src/ast/lex.cc" yy408: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { @@ -2544,7 +2521,7 @@ yy409: goto yy398; } } -#line 590 "../src/ast/lex.re" +#line 567 "../src/ast/lex.re" } @@ -2553,7 +2530,7 @@ uint32_t Scanner::lex_str_chr(char quote, bool &end) end = false; tok = cur; -#line 2557 "src/ast/lex.cc" +#line 2534 "src/ast/lex.cc" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -2562,17 +2539,17 @@ uint32_t Scanner::lex_str_chr(char quote, bool &end) if (yych == '\n') goto yy414; if (yych == '\\') goto yy416; ++YYCURSOR; -#line 603 "../src/ast/lex.re" +#line 580 "../src/ast/lex.re" { end = tok[0] == quote; return static_cast(tok[0]); } -#line 2571 "src/ast/lex.cc" +#line 2548 "src/ast/lex.cc" yy414: ++YYCURSOR; -#line 598 "../src/ast/lex.re" +#line 575 "../src/ast/lex.re" { fatal (get_column() - tchar, "syntax error"); } -#line 2576 "src/ast/lex.cc" +#line 2553 "src/ast/lex.cc" yy416: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 'a') { @@ -2618,28 +2595,28 @@ yy416: } } } -#line 601 "../src/ast/lex.re" +#line 578 "../src/ast/lex.re" { fatal (get_column() - tchar, "syntax error in escape sequence"); } -#line 2624 "src/ast/lex.cc" +#line 2601 "src/ast/lex.cc" yy418: ++YYCURSOR; -#line 617 "../src/ast/lex.re" +#line 594 "../src/ast/lex.re" { if (tok[1] != quote) { warn.useless_escape(cline, get_column(), tok[1]); } return static_cast(tok[1]); } -#line 2634 "src/ast/lex.cc" +#line 2611 "src/ast/lex.cc" yy420: yyaccept = 0; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '/') goto yy421; if (yych <= '7') goto yy443; yy421: -#line 600 "../src/ast/lex.re" +#line 577 "../src/ast/lex.re" { fatal (get_column() - tchar, "syntax error in octal escape sequence"); } -#line 2643 "src/ast/lex.cc" +#line 2620 "src/ast/lex.cc" yy422: ++YYCURSOR; goto yy421; @@ -2655,9 +2632,9 @@ yy423: if (yych <= 'f') goto yy445; } yy424: -#line 599 "../src/ast/lex.re" +#line 576 "../src/ast/lex.re" { fatal (get_column() - tchar, "syntax error in hexadecimal escape sequence"); } -#line 2661 "src/ast/lex.cc" +#line 2638 "src/ast/lex.cc" yy425: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -2673,44 +2650,44 @@ yy425: } yy426: ++YYCURSOR; -#line 616 "../src/ast/lex.re" +#line 593 "../src/ast/lex.re" { return static_cast('\\'); } -#line 2679 "src/ast/lex.cc" +#line 2656 "src/ast/lex.cc" yy428: ++YYCURSOR; -#line 609 "../src/ast/lex.re" +#line 586 "../src/ast/lex.re" { return static_cast('\a'); } -#line 2684 "src/ast/lex.cc" +#line 2661 "src/ast/lex.cc" yy430: ++YYCURSOR; -#line 610 "../src/ast/lex.re" +#line 587 "../src/ast/lex.re" { return static_cast('\b'); } -#line 2689 "src/ast/lex.cc" +#line 2666 "src/ast/lex.cc" yy432: ++YYCURSOR; -#line 611 "../src/ast/lex.re" +#line 588 "../src/ast/lex.re" { return static_cast('\f'); } -#line 2694 "src/ast/lex.cc" +#line 2671 "src/ast/lex.cc" yy434: ++YYCURSOR; -#line 612 "../src/ast/lex.re" +#line 589 "../src/ast/lex.re" { return static_cast('\n'); } -#line 2699 "src/ast/lex.cc" +#line 2676 "src/ast/lex.cc" yy436: ++YYCURSOR; -#line 613 "../src/ast/lex.re" +#line 590 "../src/ast/lex.re" { return static_cast('\r'); } -#line 2704 "src/ast/lex.cc" +#line 2681 "src/ast/lex.cc" yy438: ++YYCURSOR; -#line 614 "../src/ast/lex.re" +#line 591 "../src/ast/lex.re" { return static_cast('\t'); } -#line 2709 "src/ast/lex.cc" +#line 2686 "src/ast/lex.cc" yy440: ++YYCURSOR; -#line 615 "../src/ast/lex.re" +#line 592 "../src/ast/lex.re" { return static_cast('\v'); } -#line 2714 "src/ast/lex.cc" +#line 2691 "src/ast/lex.cc" yy442: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -2773,9 +2750,9 @@ yy447: } yy448: ++YYCURSOR; -#line 608 "../src/ast/lex.re" +#line 585 "../src/ast/lex.re" { return unesc_oct(tok, cur); } -#line 2779 "src/ast/lex.cc" +#line 2756 "src/ast/lex.cc" yy450: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { @@ -2802,9 +2779,9 @@ yy451: } yy452: ++YYCURSOR; -#line 607 "../src/ast/lex.re" +#line 584 "../src/ast/lex.re" { return unesc_hex(tok, cur); } -#line 2808 "src/ast/lex.cc" +#line 2785 "src/ast/lex.cc" yy454: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { @@ -2828,7 +2805,7 @@ yy455: goto yy444; } } -#line 623 "../src/ast/lex.re" +#line 600 "../src/ast/lex.re" } @@ -2848,7 +2825,7 @@ void Scanner::set_sourceline () sourceline: tok = cur; -#line 2852 "src/ast/lex.cc" +#line 2829 "src/ast/lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -2897,14 +2874,14 @@ sourceline: yy458: ++YYCURSOR; yy459: -#line 665 "../src/ast/lex.re" +#line 642 "../src/ast/lex.re" { goto sourceline; } -#line 2905 "src/ast/lex.cc" +#line 2882 "src/ast/lex.cc" yy460: ++YYCURSOR; -#line 653 "../src/ast/lex.re" +#line 630 "../src/ast/lex.re" { if (cur == eof) { @@ -2917,7 +2894,7 @@ yy460: tok = cur; return; } -#line 2921 "src/ast/lex.cc" +#line 2898 "src/ast/lex.cc" yy462: yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych == '\n') goto yy459; @@ -2929,7 +2906,7 @@ yy463: if (yybm[0+yych] & 64) { goto yy463; } -#line 642 "../src/ast/lex.re" +#line 619 "../src/ast/lex.re" { if (!s_to_u32_unsafe (tok, cur, cline)) { @@ -2937,7 +2914,7 @@ yy463: } goto sourceline; } -#line 2941 "src/ast/lex.cc" +#line 2918 "src/ast/lex.cc" yy466: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -2954,12 +2931,12 @@ yy468: goto yy459; yy469: ++YYCURSOR; -#line 649 "../src/ast/lex.re" +#line 626 "../src/ast/lex.re" { escape (in.file_name, std::string (tok + 1, tok_len () - 2)); // -2 to omit quotes goto sourceline; } -#line 2963 "src/ast/lex.cc" +#line 2940 "src/ast/lex.cc" yy471: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -2967,7 +2944,7 @@ yy471: if (yych == '\n') goto yy468; goto yy466; } -#line 668 "../src/ast/lex.re" +#line 645 "../src/ast/lex.re" } diff --git a/re2c/bootstrap/src/ast/lex_conf.cc b/re2c/bootstrap/src/ast/lex_conf.cc index 94376334..6816144c 100644 --- a/re2c/bootstrap/src/ast/lex_conf.cc +++ b/re2c/bootstrap/src/ast/lex_conf.cc @@ -1,4 +1,4 @@ -/* Generated by re2c 0.16 on Sat Mar 4 23:19:21 2017 */ +/* Generated by re2c 0.16 on Mon Mar 6 16:33:58 2017 */ #line 1 "../src/ast/lex_conf.re" #include "src/util/c99_stdint.h" #include @@ -79,55 +79,55 @@ yy3: #line 80 "src/ast/lex_conf.cc" yy4: yyaccept = 0; - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych == 'g') goto yy13; if (yych == 'o') goto yy15; goto yy3; yy5: yyaccept = 0; - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych == 'e') goto yy16; goto yy3; yy6: yyaccept = 0; - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych == 'l') goto yy17; goto yy3; yy7: yyaccept = 0; - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych == 'n') goto yy18; goto yy3; yy8: yyaccept = 0; - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych == 'a') goto yy19; goto yy3; yy9: yyaccept = 0; - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych == 't') goto yy20; goto yy3; yy10: yyaccept = 0; - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych == 'a') goto yy21; goto yy3; yy11: yyaccept = 0; - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych == 'a') goto yy22; goto yy3; yy12: yyaccept = 0; - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych == 'y') goto yy23; goto yy3; yy13: yych = (unsigned char)*++cur; if (yych == 'o') goto yy24; yy14: - cur = ptr; + cur = mar; if (yyaccept <= 11) { if (yyaccept <= 5) { if (yyaccept <= 2) { @@ -589,7 +589,7 @@ yy98: #line 590 "src/ast/lex_conf.cc" yy100: yyaccept = 1; - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych == 'i') goto yy150; yy101: #line 45 "../src/ast/lex_conf.re" @@ -597,7 +597,7 @@ yy101: #line 598 "src/ast/lex_conf.cc" yy102: yyaccept = 2; - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych == 'a') goto yy151; if (yych == 'o') goto yy152; yy103: @@ -606,7 +606,7 @@ yy103: #line 607 "src/ast/lex_conf.cc" yy104: yyaccept = 3; - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych <= 'd') goto yy105; if (yych <= 'e') goto yy153; if (yych <= 'f') goto yy154; @@ -616,7 +616,7 @@ yy105: #line 617 "src/ast/lex_conf.cc" yy106: yyaccept = 4; - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych <= 'c') { if (yych == 'a') goto yy155; if (yych >= 'c') goto yy156; @@ -631,7 +631,7 @@ yy107: #line 632 "src/ast/lex_conf.cc" yy108: yyaccept = 5; - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych == 'l') goto yy159; yy109: #line 48 "../src/ast/lex_conf.re" @@ -644,7 +644,7 @@ yy110: #line 645 "src/ast/lex_conf.cc" yy112: yyaccept = 6; - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych == 'n') goto yy160; yy113: #line 51 "../src/ast/lex_conf.re" @@ -657,7 +657,7 @@ yy114: goto yy14; yy115: yyaccept = 7; - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych == 'u') goto yy163; yy116: #line 69 "../src/ast/lex_conf.re" @@ -669,7 +669,7 @@ yy117: goto yy14; yy118: yyaccept = 8; - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych == 'e') goto yy165; yy119: #line 52 "../src/ast/lex_conf.re" @@ -677,7 +677,7 @@ yy119: #line 678 "src/ast/lex_conf.cc" yy120: yyaccept = 9; - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych == 'k') goto yy166; if (yych == 't') goto yy167; yy121: @@ -686,7 +686,7 @@ yy121: #line 687 "src/ast/lex_conf.cc" yy122: yyaccept = 10; - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych == 'a') goto yy168; if (yych == 'y') goto yy169; yy123: @@ -695,7 +695,7 @@ yy123: #line 696 "src/ast/lex_conf.cc" yy124: yyaccept = 11; - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych == 'n') goto yy170; if (yych == 't') goto yy171; yy125: @@ -704,7 +704,7 @@ yy125: #line 705 "src/ast/lex_conf.cc" yy126: yyaccept = 12; - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych == 'i') goto yy172; yy127: #line 65 "../src/ast/lex_conf.re" @@ -977,7 +977,7 @@ yy192: goto yy14; yy193: yyaccept = 13; - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych == '@') goto yy243; yy194: #line 87 "../src/ast/lex_conf.re" @@ -1384,7 +1384,7 @@ yy288: goto yy14; yy289: yyaccept = 14; - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych <= 0x1F) { if (yych == '\t') { ctx = cur; @@ -1728,7 +1728,7 @@ yy367: goto yy14; yy368: yyaccept = 15; - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych == '@') goto yy436; yy369: #line 85 "../src/ast/lex_conf.re" @@ -2033,7 +2033,7 @@ yy445: goto yy14; yy446: yyaccept = 16; - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych == ':') goto yy515; if (yych == '@') goto yy516; yy447: @@ -2457,7 +2457,7 @@ yy558: goto yy14; yy559: yyaccept = 17; - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych == 'C') goto yy609; if (yych == 'T') goto yy610; yy560: @@ -2684,7 +2684,7 @@ yy619: goto yy14; yy620: yyaccept = 18; - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych == 'C') goto yy668; if (yych == 'T') goto yy669; yy621: @@ -2841,7 +2841,7 @@ yy663: goto yy14; yy664: yyaccept = 19; - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych == ':') goto yy707; yy665: #line 91 "../src/ast/lex_conf.re" @@ -2866,7 +2866,7 @@ yy670: goto yy14; yy671: yyaccept = 20; - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych == ':') goto yy711; if (yych == '@') goto yy712; yy672: @@ -3177,7 +3177,7 @@ yy760: goto yy109; yy761: yyaccept = 21; - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych == ':') goto yy774; yy762: #line 78 "../src/ast/lex_conf.re" @@ -3189,7 +3189,7 @@ yy763: goto yy14; yy764: yyaccept = 22; - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych == ':') goto yy776; if (yych == '@') goto yy777; yy765: @@ -3376,22 +3376,22 @@ yy815: " (expected: 'ignore', 'substitute', 'fail')"); } #line 3378 "src/ast/lex_conf.cc" yy816: - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych == 'a') goto yy819; goto yy815; yy817: - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych == 'g') goto yy821; goto yy815; yy818: - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych == 'u') goto yy822; goto yy815; yy819: yych = (unsigned char)*++cur; if (yych == 'i') goto yy823; yy820: - cur = ptr; + cur = mar; goto yy815; yy821: yych = (unsigned char)*++cur; @@ -3479,18 +3479,18 @@ yy843: " (expected: 'default', 'custom')"); } #line 3481 "src/ast/lex_conf.cc" yy844: - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych == 'u') goto yy846; goto yy843; yy845: - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych == 'e') goto yy848; goto yy843; yy846: yych = (unsigned char)*++cur; if (yych == 's') goto yy849; yy847: - cur = ptr; + cur = mar; goto yy843; yy848: yych = (unsigned char)*++cur; @@ -3557,18 +3557,18 @@ yy863: " (expected: 'match-empty', 'match-none', 'error')"); } #line 3559 "src/ast/lex_conf.cc" yy864: - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych == 'r') goto yy866; goto yy863; yy865: - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych == 'a') goto yy868; goto yy863; yy866: yych = (unsigned char)*++cur; if (yych == 'r') goto yy869; yy867: - cur = ptr; + cur = mar; goto yy863; yy868: yych = (unsigned char)*++cur; @@ -3665,18 +3665,18 @@ yy891: " (expected: 'table', 'moore')"); } #line 3667 "src/ast/lex_conf.cc" yy892: - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych == 'o') goto yy894; goto yy891; yy893: - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych == 'a') goto yy896; goto yy891; yy894: yych = (unsigned char)*++cur; if (yych == 'o') goto yy897; yy895: - cur = ptr; + cur = mar; goto yy891; yy896: yych = (unsigned char)*++cur; @@ -3781,7 +3781,7 @@ yy908: { fatal ("missing '=' in configuration"); } #line 3783 "src/ast/lex_conf.cc" yy909: - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yych <= 0x1F) { if (yych == '\t') goto yy913; goto yy908; @@ -3809,7 +3809,7 @@ yy913: if (yych <= ' ') goto yy913; if (yych == '=') goto yy910; } - cur = ptr; + cur = mar; goto yy908; } #line 244 "../src/ast/lex_conf.re" @@ -3870,7 +3870,7 @@ yy919: { fatal ("missing ending ';' in configuration"); } #line 3872 "src/ast/lex_conf.cc" yy920: - yych = (unsigned char)*(ptr = ++cur); + yych = (unsigned char)*(mar = ++cur); if (yybm[0+yych] & 128) { goto yy923; } @@ -3888,7 +3888,7 @@ yy923: goto yy923; } if (yych == ';') goto yy921; - cur = ptr; + cur = mar; goto yy919; } #line 252 "../src/ast/lex_conf.re" diff --git a/re2c/src/ast/lex.re b/re2c/src/ast/lex.re index b41a3ba1..89cdfb80 100644 --- a/re2c/src/ast/lex.re +++ b/re2c/src/ast/lex.re @@ -21,7 +21,7 @@ extern YYSTYPE yylval; #define YYCTYPE unsigned char #define YYCURSOR cur #define YYLIMIT lim -#define YYMARKER ptr +#define YYMARKER mar #define YYCTXMARKER ctx #define YYFILL(n) { fill (n); } @@ -65,83 +65,63 @@ Scanner::ParseMode Scanner::echo() tok = cur; echo: - const char *start = cur; + ptr = cur; /*!re2c "%{" | "/*!re2c" { - if (opts->target == opt_t::CODE) { - out.wraw(tok, start); - } + out.wraw(tok, ptr); return Parse; } "/*!rules:re2c" { - if (opts->target == opt_t::CODE) { - out.wraw(tok, start); - } + out.wraw(tok, ptr); return Rules; } "/*!use:re2c" { - if (opts->target == opt_t::CODE) { - out.wraw(tok, start); - } + out.wraw(tok, ptr); return Reuse; } "/*!ignore:re2c" { - if (opts->target == opt_t::CODE) { - out.wraw(tok, start); - } + out.wraw(tok, ptr); lex_end_of_comment(); goto echo; } "/*!max:re2c" { - if (opts->target == opt_t::CODE) { - out.wraw(tok, start) - .wdelay_yymaxfill(); - } + out.wraw(tok, ptr); + out.wdelay_yymaxfill(); lex_end_of_comment(); goto echo; } "/*!getstate:re2c" { - if (opts->target == opt_t::CODE) { - out.wraw(tok, start) - .wdelay_state_goto(opts->topIndent); - } + out.wraw(tok, ptr); + out.wdelay_state_goto(0); lex_end_of_comment(); goto echo; } "/*!types:re2c" { - if (opts->target == opt_t::CODE) { - out.wraw(tok, start) - .wdelay_line_info() - .wdelay_types() - .wline_info(cline, get_fname().c_str()); - } + out.wraw(tok, ptr); + out.wdelay_line_info(); + out.wdelay_types(); + out.wline_info(cline, get_fname().c_str()); lex_end_of_comment(); goto echo; } "/*!tags:re2c" { - if (opts->target == opt_t::CODE) { - out.wraw(tok, start); - } + out.wraw(tok, ptr); lex_tags(); goto echo; } zero { - if (cur == eof) { - if (opts->target == opt_t::CODE) { - out.wraw(tok, start); - } - return Stop; - } - goto echo; + if (cur != eof) goto echo; + out.wraw(tok, ptr); + return Stop; } eol space* "#" space* "line" space+ / lineinf { @@ -170,7 +150,7 @@ void Scanner::lex_end_of_comment() eoc { if (ignored > 0) { cline += ignored; - out.ws("\n").wline_info(cline, get_fname().c_str()); + out.wline_info(cline, get_fname().c_str()); } tok = pos = cur; return; @@ -190,10 +170,7 @@ void Scanner::lex_tags() space+ { continue; } eol { ++cline; continue; } eoc { - if (opts->target == opt_t::CODE) { - out.wdelay_tags(opts->topIndent, - new ConfTags(fmt, sep)); - } + out.wdelay_tags(new ConfTags(fmt, sep)); tok = pos = cur; return; } @@ -333,7 +310,7 @@ start: for (char *s = tok; s < cur; ++s) { const uint32_t chr = static_cast(*s), - col = static_cast(s - ptr); + col = static_cast(s - tok); str->push_back(ASTChar(chr, col)); } yylval.regexp = ast_str(cline, get_column(), str, false); diff --git a/re2c/src/ast/lex_conf.re b/re2c/src/ast/lex_conf.re index 7f079a74..ab35658e 100644 --- a/re2c/src/ast/lex_conf.re +++ b/re2c/src/ast/lex_conf.re @@ -14,7 +14,7 @@ namespace re2c re2c:define:YYCTYPE = "unsigned char"; re2c:define:YYCURSOR = cur; re2c:define:YYLIMIT = lim; - re2c:define:YYMARKER = ptr; + re2c:define:YYMARKER = mar; re2c:define:YYCTXMARKER = ctx; re2c:define:YYFILL = fill; diff --git a/re2c/src/ast/scanner.cc b/re2c/src/ast/scanner.cc index 88d2dfd3..0c5a75ae 100644 --- a/re2c/src/ast/scanner.cc +++ b/re2c/src/ast/scanner.cc @@ -23,6 +23,7 @@ ScannerState::ScannerState () : tok (NULL) , ptr (NULL) , cur (NULL) + , mar (NULL) , pos (NULL) , ctx (NULL) , bot (NULL) @@ -56,6 +57,7 @@ void Scanner::fill (uint32_t need) const size_t move = static_cast (top - tok); memmove (bot, tok, move); tok -= diff; + mar -= diff; ptr -= diff; cur -= diff; pos -= diff; @@ -78,6 +80,7 @@ void Scanner::fill (uint32_t need) } memcpy (buf, bot, copy); tok = &buf[tok - bot]; + mar = &buf[mar - bot]; ptr = &buf[ptr - bot]; cur = &buf[cur - bot]; pos = &buf[pos - bot]; diff --git a/re2c/src/ast/scanner.h b/re2c/src/ast/scanner.h index 0630cd2a..ef0fe2e2 100644 --- a/re2c/src/ast/scanner.h +++ b/re2c/src/ast/scanner.h @@ -30,6 +30,7 @@ struct ScannerState char * tok; char * ptr; char * cur; + char * mar; char * pos; char * ctx; diff --git a/re2c/src/code/output.cc b/re2c/src/code/output.cc index 63a8fe35..7494bc7d 100644 --- a/re2c/src/code/output.cc +++ b/re2c/src/code/output.cc @@ -88,8 +88,10 @@ std::ostream & OutputFile::stream () OutputFile &OutputFile::wraw(const char *s, const char *e) { - insert_code(); - stream().write(s, static_cast(e - s)); + if (block().opts->target == opt_t::CODE) { + insert_code(); + stream().write(s, static_cast(e - s)); + } return *this; } @@ -207,11 +209,13 @@ void OutputFile::insert_code () } } -OutputFile &OutputFile::wdelay_tags(uint32_t ind, const ConfTags *cf) +OutputFile &OutputFile::wdelay_tags(const ConfTags *cf) { - OutputFragment *frag = new OutputFragment(OutputFragment::TAGS, ind); - frag->tags = cf; - blocks.back()->fragments.push_back(frag); + if (block().opts->target == opt_t::CODE) { + OutputFragment *frag = new OutputFragment(OutputFragment::TAGS, 0); + frag->tags = cf; + blocks.back()->fragments.push_back(frag); + } return *this; } @@ -240,7 +244,8 @@ OutputFile & OutputFile::wdelay_cond_table(uint32_t ind) OutputFile & OutputFile::wdelay_state_goto (uint32_t ind) { - if (block().opts->fFlag && !state_goto) { + if (block().opts->target == opt_t::CODE + && block().opts->fFlag && !state_goto) { block().fragments.push_back (new OutputFragment (OutputFragment::STATE_GOTO, ind)); state_goto = true; } @@ -249,8 +254,10 @@ OutputFile & OutputFile::wdelay_state_goto (uint32_t ind) OutputFile & OutputFile::wdelay_types () { - warn_condition_order = false; // see note [condition order] - block().fragments.push_back (new OutputFragment (OutputFragment::TYPES, 0)); + if (block().opts->target == opt_t::CODE) { + warn_condition_order = false; // see note [condition order] + block().fragments.push_back (new OutputFragment (OutputFragment::TYPES, 0)); + } return *this; } @@ -262,7 +269,9 @@ OutputFile & OutputFile::wdelay_yyaccept_init (uint32_t ind) OutputFile & OutputFile::wdelay_yymaxfill () { - block().fragments.push_back (new OutputFragment (OutputFragment::YYMAXFILL, 0)); + if (block().opts->target == opt_t::CODE) { + block().fragments.push_back (new OutputFragment (OutputFragment::YYMAXFILL, 0)); + } return *this; } @@ -409,7 +418,7 @@ bool OutputFile::emit(const uniq_vector_t &global_types, for (size_t i = 0; i < n; ++i) { OutputFragment & f = * b.fragments[i]; std::ostringstream &o = f.stream; - const uint32_t ind = f.indent; + const uint32_t ind = f.indent ? f.indent : bopt->topIndent; switch (f.type) { case OutputFragment::EMPTY: @@ -428,7 +437,7 @@ bool OutputFile::emit(const uniq_vector_t &global_types, output_state_goto(o, ind, 0, fill_index, bopt); break; case OutputFragment::TAGS: - output_tags(o, *f.tags, global_tags); + output_tags(o, ind, *f.tags, global_tags, bopt); break; case OutputFragment::TYPES: output_types(o, ind, block().opts, global_types); @@ -437,7 +446,7 @@ bool OutputFile::emit(const uniq_vector_t &global_types, output_yyaccept_init(o, ind, b.used_yyaccept, bopt); break; case OutputFragment::YYMAXFILL: - output_yymaxfill(o, max_fill); + output_yymaxfill(o, ind, max_fill, bopt); break; case OutputFragment::SKIP: output_skip(o, ind, bopt); @@ -536,12 +545,13 @@ bool Output::emit() && header.emit(opts, types); } -void output_tags(std::ostream &o, const ConfTags &conf, - const std::set &tags) +void output_tags(std::ostream &o, uint32_t ind, const ConfTags &conf, + const std::set &tags, const opt_t *opts) { std::set::const_iterator tag = tags.begin(), end = tags.end(); + o << indent(ind, opts->indString); for (;tag != end;) { std::string fmt = conf.format; strrreplace(fmt, "@@", *tag); @@ -591,9 +601,10 @@ void output_yyaccept_init (std::ostream & o, uint32_t ind, bool used_yyaccept, c } } -void output_yymaxfill (std::ostream & o, size_t max_fill) +void output_yymaxfill(std::ostream &o, uint32_t ind, + size_t max_fill, const opt_t *opts) { - o << "#define YYMAXFILL " << max_fill << "\n"; + o << indent(ind, opts->indString) << "#define YYMAXFILL " << max_fill << "\n"; } void output_line_info(std::ostream &o, uint32_t line, diff --git a/re2c/src/code/output.h b/re2c/src/code/output.h index cafa5106..56621c37 100644 --- a/re2c/src/code/output.h +++ b/re2c/src/code/output.h @@ -121,7 +121,7 @@ public: OutputFile & wind (uint32_t ind); // delayed output - OutputFile & wdelay_tags(uint32_t ind, const ConfTags *cf); + OutputFile & wdelay_tags(const ConfTags *cf); OutputFile & wdelay_line_info (); OutputFile & wdelay_cond_goto(uint32_t ind); OutputFile & wdelay_cond_table(uint32_t ind); @@ -163,7 +163,7 @@ struct Output bool emit(); }; -void output_tags (std::ostream &o, const ConfTags &conf, const std::set &tags); +void output_tags (std::ostream &o, uint32_t ind, const ConfTags &conf, const std::set &tags, const opt_t *opts); void output_line_info (std::ostream &o, uint32_t line, const std::string &fname, bool iflag); void output_cond_goto (std::ostream &o, uint32_t ind, const std::vector &conds, const opt_t *opts, Warn &warn, bool warn_cond_order, uint32_t line); void output_cond_table (std::ostream &o, uint32_t ind, const std::vector &conds, const opt_t *opts); @@ -171,7 +171,7 @@ void output_state_goto (std::ostream &o, uint32_t ind, uint32_t start_label, void output_types (std::ostream &o, uint32_t ind, const opt_t *opts, const uniq_vector_t &types); void output_version_time (std::ostream &o, bool version, bool date); void output_yyaccept_init (std::ostream &o, uint32_t ind, bool, const opt_t *opts); -void output_yymaxfill (std::ostream &o, size_t max_fill); +void output_yymaxfill (std::ostream &o, uint32_t ind, size_t max_fill, const opt_t *opts); } // namespace re2c diff --git a/re2c/src/skeleton/generate_code.cc b/re2c/src/skeleton/generate_code.cc index badf5947..23402db5 100644 --- a/re2c/src/skeleton/generate_code.cc +++ b/re2c/src/skeleton/generate_code.cc @@ -270,7 +270,7 @@ void emit_start(OutputFile &o, size_t maxfill, const std::string &name, // autogenerated tag variables ConfTags conf("\n" + indent(2, opts->indString) + "const YYCTYPE *@@ = NULL;", ""); - output_tags(o.stream(), conf, tagnames); + output_tags(o.stream(), 0, conf, tagnames, opts); // user-defined tag variables std::set::const_iterator diff --git a/re2c/test/calc_001.c b/re2c/test/calc_001.c index 64c77e0f..42826f07 100644 --- a/re2c/test/calc_001.c +++ b/re2c/test/calc_001.c @@ -1,7 +1,6 @@ /* Generated by re2c */ #line 1 "calc_001.re" /* re2c lesson 001_upn_calculator, calc_001, (c) M. Boerger 2006 - 2007 */ - #line 42 "calc_001.re" @@ -22,7 +21,7 @@ int scan(char *s, int l) for(;;) { -#line 26 "calc_001.c" +#line 25 "calc_001.c" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -47,22 +46,22 @@ yy2: ++YYCURSOR; #line 67 "calc_001.re" { printf("EOF\n"); return 0; } -#line 51 "calc_001.c" +#line 50 "calc_001.c" yy4: ++YYCURSOR; #line 68 "calc_001.re" { printf("ERR\n"); return 1; } -#line 56 "calc_001.c" +#line 55 "calc_001.c" yy6: ++YYCURSOR; #line 65 "calc_001.re" { printf("+\n"); continue; } -#line 61 "calc_001.c" +#line 60 "calc_001.c" yy8: ++YYCURSOR; #line 66 "calc_001.re" { printf("-\n"); continue; } -#line 66 "calc_001.c" +#line 65 "calc_001.c" yy10: yych = *++YYCURSOR; switch (yych) { @@ -81,7 +80,7 @@ yy10: yy11: #line 64 "calc_001.re" { printf("Num\n"); continue; } -#line 85 "calc_001.c" +#line 84 "calc_001.c" yy12: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -102,7 +101,7 @@ yy12: yy14: #line 63 "calc_001.re" { printf("Num\n"); continue; } -#line 106 "calc_001.c" +#line 105 "calc_001.c" yy15: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -123,7 +122,7 @@ yy15: yy17: #line 62 "calc_001.re" { printf("Oct\n"); continue; } -#line 127 "calc_001.c" +#line 126 "calc_001.c" } #line 69 "calc_001.re" diff --git a/re2c/test/calc_001.dei.c b/re2c/test/calc_001.dei.c index 9626822e..980211cf 100644 --- a/re2c/test/calc_001.dei.c +++ b/re2c/test/calc_001.dei.c @@ -2,7 +2,6 @@ /* re2c lesson 001_upn_calculator, calc_001, (c) M. Boerger 2006 - 2007 */ - #include #include #include diff --git a/re2c/test/calc_001.ei.c b/re2c/test/calc_001.ei.c index 516a1682..34533c5e 100644 --- a/re2c/test/calc_001.ei.c +++ b/re2c/test/calc_001.ei.c @@ -2,7 +2,6 @@ /* re2c lesson 001_upn_calculator, calc_001, (c) M. Boerger 2006 - 2007 */ - #include #include #include diff --git a/re2c/test/calc_002.c b/re2c/test/calc_002.c index f764521e..9f54f3d4 100644 --- a/re2c/test/calc_002.c +++ b/re2c/test/calc_002.c @@ -1,7 +1,6 @@ /* Generated by re2c */ #line 1 "calc_002.re" /* re2c lesson 001_upn_calculator, calc_002, (c) M. Boerger 2006 - 2007 */ - #line 18 "calc_002.re" @@ -30,7 +29,7 @@ int scan(char *s) for(;;) { -#line 34 "calc_002.c" +#line 33 "calc_002.c" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -55,22 +54,22 @@ yy2: ++YYCURSOR; #line 51 "calc_002.re" { printf("EOF\n"); return 0; } -#line 59 "calc_002.c" +#line 58 "calc_002.c" yy4: ++YYCURSOR; #line 52 "calc_002.re" { printf("ERR\n"); return 1; } -#line 64 "calc_002.c" +#line 63 "calc_002.c" yy6: ++YYCURSOR; #line 49 "calc_002.re" { printf("+\n"); continue; } -#line 69 "calc_002.c" +#line 68 "calc_002.c" yy8: ++YYCURSOR; #line 50 "calc_002.re" { printf("+\n"); continue; } -#line 74 "calc_002.c" +#line 73 "calc_002.c" yy10: yych = *++YYCURSOR; switch (yych) { @@ -89,7 +88,7 @@ yy10: yy11: #line 48 "calc_002.re" { printf("Num\n"); continue; } -#line 93 "calc_002.c" +#line 92 "calc_002.c" yy12: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -110,7 +109,7 @@ yy12: yy14: #line 47 "calc_002.re" { printf("Num\n"); continue; } -#line 114 "calc_002.c" +#line 113 "calc_002.c" yy15: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -131,7 +130,7 @@ yy15: yy17: #line 46 "calc_002.re" { printf("Oct\n"); continue; } -#line 135 "calc_002.c" +#line 134 "calc_002.c" } #line 53 "calc_002.re" diff --git a/re2c/test/calc_003.c b/re2c/test/calc_003.c index 66e79b53..603015a3 100644 --- a/re2c/test/calc_003.c +++ b/re2c/test/calc_003.c @@ -1,7 +1,6 @@ /* Generated by re2c */ #line 1 "calc_003.re" /* re2c lesson 001_upn_calculator, calc_003, (c) M. Boerger 2006 - 2007 */ - #line 18 "calc_003.re" @@ -22,7 +21,7 @@ int scan(char *s, int l) for(;;) { -#line 26 "calc_003.c" +#line 25 "calc_003.c" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -47,22 +46,22 @@ yy2: ++YYCURSOR; #line 43 "calc_003.re" { printf("EOF\n"); return 0; } -#line 51 "calc_003.c" +#line 50 "calc_003.c" yy4: ++YYCURSOR; #line 44 "calc_003.re" { printf("ERR\n"); return 1; } -#line 56 "calc_003.c" +#line 55 "calc_003.c" yy6: ++YYCURSOR; #line 41 "calc_003.re" { printf("+\n"); continue; } -#line 61 "calc_003.c" +#line 60 "calc_003.c" yy8: ++YYCURSOR; #line 42 "calc_003.re" { printf("+\n"); continue; } -#line 66 "calc_003.c" +#line 65 "calc_003.c" yy10: yych = *++YYCURSOR; switch (yych) { @@ -81,7 +80,7 @@ yy10: yy11: #line 40 "calc_003.re" { printf("Num\n"); continue; } -#line 85 "calc_003.c" +#line 84 "calc_003.c" yy12: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -102,7 +101,7 @@ yy12: yy14: #line 39 "calc_003.re" { printf("Num\n"); continue; } -#line 106 "calc_003.c" +#line 105 "calc_003.c" yy15: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -123,7 +122,7 @@ yy15: yy17: #line 38 "calc_003.re" { printf("Oct\n"); continue; } -#line 127 "calc_003.c" +#line 126 "calc_003.c" } #line 45 "calc_003.re" diff --git a/re2c/test/calc_004.c b/re2c/test/calc_004.c index 1597220b..bcd53bcb 100644 --- a/re2c/test/calc_004.c +++ b/re2c/test/calc_004.c @@ -1,7 +1,6 @@ /* Generated by re2c */ #line 1 "calc_004.re" /* re2c lesson 001_upn_calculator, calc_004, (c) M. Boerger 2006 - 2007 */ - #line 19 "calc_004.re" @@ -34,7 +33,7 @@ int scan(char *s, int l) { t = p; -#line 38 "calc_004.c" +#line 37 "calc_004.c" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -59,22 +58,22 @@ yy2: ++YYCURSOR; #line 60 "calc_004.re" { printf("EOF\n"); return 0; } -#line 63 "calc_004.c" +#line 62 "calc_004.c" yy4: ++YYCURSOR; #line 61 "calc_004.re" { printf("ERR\n"); return 1; } -#line 68 "calc_004.c" +#line 67 "calc_004.c" yy6: ++YYCURSOR; #line 58 "calc_004.re" { printf("+\n"); continue; } -#line 73 "calc_004.c" +#line 72 "calc_004.c" yy8: ++YYCURSOR; #line 59 "calc_004.re" { printf("+\n"); continue; } -#line 78 "calc_004.c" +#line 77 "calc_004.c" yy10: yych = *++YYCURSOR; switch (yych) { @@ -93,7 +92,7 @@ yy10: yy11: #line 57 "calc_004.re" { t = tokendup(t, p); printf("Num: %s\n", t); free(t); continue; } -#line 97 "calc_004.c" +#line 96 "calc_004.c" yy12: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -131,7 +130,7 @@ yy14: yy16: #line 56 "calc_004.re" { t = tokendup(t, p); printf("Oct: %s\n", t); free(t); continue; } -#line 135 "calc_004.c" +#line 134 "calc_004.c" } #line 62 "calc_004.re" diff --git a/re2c/test/calc_005.c b/re2c/test/calc_005.c index 08e4fa47..72d8d654 100644 --- a/re2c/test/calc_005.c +++ b/re2c/test/calc_005.c @@ -1,7 +1,6 @@ /* Generated by re2c */ #line 1 "calc_005.re" /* re2c lesson 001_upn_calculator, calc_005, (c) M. Boerger 2006 - 2007 */ - #line 18 "calc_005.re" @@ -69,7 +68,7 @@ int scan(char *s, int l) { t = p; -#line 73 "calc_005.c" +#line 72 "calc_005.c" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -95,7 +94,7 @@ yy2: ++YYCURSOR; #line 96 "calc_005.re" { res = 1; continue; } -#line 99 "calc_005.c" +#line 98 "calc_005.c" yy4: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -108,17 +107,17 @@ yy4: yy6: #line 91 "calc_005.re" { continue; } -#line 112 "calc_005.c" +#line 111 "calc_005.c" yy7: ++YYCURSOR; #line 94 "calc_005.re" { res = stack_add(); continue; } -#line 117 "calc_005.c" +#line 116 "calc_005.c" yy9: ++YYCURSOR; #line 95 "calc_005.re" { res = stack_sub(); continue; } -#line 122 "calc_005.c" +#line 121 "calc_005.c" yy11: yych = *++YYCURSOR; switch (yych) { @@ -137,7 +136,7 @@ yy11: yy12: #line 93 "calc_005.re" { res = push_num(t, p, 10); continue; } -#line 141 "calc_005.c" +#line 140 "calc_005.c" yy13: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -175,7 +174,7 @@ yy15: yy17: #line 92 "calc_005.re" { res = push_num(t, p, 8); continue; } -#line 179 "calc_005.c" +#line 178 "calc_005.c" } #line 97 "calc_005.re" diff --git a/re2c/test/calc_006.s.c b/re2c/test/calc_006.s.c index 3485c40a..c0707d11 100644 --- a/re2c/test/calc_006.s.c +++ b/re2c/test/calc_006.s.c @@ -1,7 +1,6 @@ /* Generated by re2c */ #line 1 "calc_006.s.re" /* re2c lesson 001_upn_calculator, calc_006, (c) M. Boerger 2006 - 2007 */ - #line 35 "calc_006.s.re" @@ -67,7 +66,7 @@ int scan(char *s) { t = p; -#line 71 "calc_006.s.c" +#line 70 "calc_006.s.c" { YYCTYPE yych; yych = *YYCURSOR; @@ -96,29 +95,29 @@ yy2: ++YYCURSOR; #line 112 "calc_006.s.re" { res = depth == 1 ? 0 : 2; break; } -#line 100 "calc_006.s.c" +#line 99 "calc_006.s.c" yy4: ++YYCURSOR; #line 113 "calc_006.s.re" { res = 1; continue; } -#line 105 "calc_006.s.c" +#line 104 "calc_006.s.c" yy6: yych = *++YYCURSOR; if (yych == '\t') goto yy6; if (yych == ' ') goto yy6; #line 107 "calc_006.s.re" { continue; } -#line 112 "calc_006.s.c" +#line 111 "calc_006.s.c" yy9: ++YYCURSOR; #line 110 "calc_006.s.re" { res = stack_add(); continue; } -#line 117 "calc_006.s.c" +#line 116 "calc_006.s.c" yy11: ++YYCURSOR; #line 111 "calc_006.s.re" { res = stack_sub(); continue; } -#line 122 "calc_006.s.c" +#line 121 "calc_006.s.c" yy13: yych = *++YYCURSOR; if (yych <= '/') goto yy14; @@ -126,7 +125,7 @@ yy13: yy14: #line 109 "calc_006.s.re" { res = push_num(t, p, 10); continue; } -#line 130 "calc_006.s.c" +#line 129 "calc_006.s.c" yy15: yych = *++YYCURSOR; if (yych <= '/') goto yy14; @@ -139,7 +138,7 @@ yy17: yy19: #line 108 "calc_006.s.re" { res = push_num(t, p, 8); continue; } -#line 143 "calc_006.s.c" +#line 142 "calc_006.s.c" } #line 114 "calc_006.s.re" diff --git a/re2c/test/calc_007.b.c b/re2c/test/calc_007.b.c index 153a46a5..25530a87 100644 --- a/re2c/test/calc_007.b.c +++ b/re2c/test/calc_007.b.c @@ -1,7 +1,6 @@ /* Generated by re2c */ #line 1 "calc_007.b.re" /* re2c lesson 001_upn_calculator, calc_007, (c) M. Boerger 2006 - 2007 */ - #line 8 "calc_007.b.re" @@ -67,7 +66,7 @@ int scan(char *s) { t = p; -#line 71 "calc_007.b.c" +#line 70 "calc_007.b.c" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -126,12 +125,12 @@ yy2: ++YYCURSOR; #line 85 "calc_007.b.re" { res = depth == 1 ? 0 : 2; break; } -#line 130 "calc_007.b.c" +#line 129 "calc_007.b.c" yy4: ++YYCURSOR; #line 86 "calc_007.b.re" { res = 1; continue; } -#line 135 "calc_007.b.c" +#line 134 "calc_007.b.c" yy6: yych = *++YYCURSOR; if (yybm[0+yych] & 64) { @@ -139,17 +138,17 @@ yy6: } #line 80 "calc_007.b.re" { continue; } -#line 143 "calc_007.b.c" +#line 142 "calc_007.b.c" yy9: ++YYCURSOR; #line 83 "calc_007.b.re" { res = stack_add(); continue; } -#line 148 "calc_007.b.c" +#line 147 "calc_007.b.c" yy11: ++YYCURSOR; #line 84 "calc_007.b.re" { res = stack_sub(); continue; } -#line 153 "calc_007.b.c" +#line 152 "calc_007.b.c" yy13: yych = *++YYCURSOR; if (yych <= '/') goto yy14; @@ -157,7 +156,7 @@ yy13: yy14: #line 82 "calc_007.b.re" { res = push_num(t, p, 10); continue; } -#line 161 "calc_007.b.c" +#line 160 "calc_007.b.c" yy15: yych = *++YYCURSOR; if (yybm[0+yych] & 128) { @@ -171,7 +170,7 @@ yy17: yy19: #line 81 "calc_007.b.re" { res = push_num(t, p, 8); continue; } -#line 175 "calc_007.b.c" +#line 174 "calc_007.b.c" } #line 87 "calc_007.b.re" diff --git a/re2c/test/calc_008.b--skeleton.c b/re2c/test/calc_008.b--skeleton.c index 68a9e4a3..1fc1f373 100644 --- a/re2c/test/calc_008.b--skeleton.c +++ b/re2c/test/calc_008.b--skeleton.c @@ -48,7 +48,6 @@ error: return NULL; } - #define YYCTYPE unsigned char #define YYKEYTYPE unsigned char #define YYPEEK() *cursor diff --git a/re2c/test/calc_008.b.c b/re2c/test/calc_008.b.c index 356e1bd3..e2c1652b 100644 --- a/re2c/test/calc_008.b.c +++ b/re2c/test/calc_008.b.c @@ -1,7 +1,6 @@ /* Generated by re2c */ #line 1 "calc_008.b.re" /* re2c lesson 001_upn_calculator, calc_008, (c) M. Boerger 2006 - 2007 */ - #line 30 "calc_008.b.re" @@ -63,7 +62,7 @@ int scan(char *p) { t = p; -#line 67 "calc_008.b.c" +#line 66 "calc_008.b.c" { unsigned char curr; static const unsigned char yybm[] = { @@ -122,12 +121,12 @@ scan2: ++p; #line 108 "calc_008.b.re" { res = depth == 1 ? 0 : 2; break; } -#line 126 "calc_008.b.c" +#line 125 "calc_008.b.c" scan4: ++p; #line 109 "calc_008.b.re" { res = 1; continue; } -#line 131 "calc_008.b.c" +#line 130 "calc_008.b.c" scan6: curr = (unsigned char)*++p; if (yybm[0+curr] & 64) { @@ -135,17 +134,17 @@ scan6: } #line 103 "calc_008.b.re" { continue; } -#line 139 "calc_008.b.c" +#line 138 "calc_008.b.c" scan9: ++p; #line 106 "calc_008.b.re" { res = stack_add(); continue; } -#line 144 "calc_008.b.c" +#line 143 "calc_008.b.c" scan11: ++p; #line 107 "calc_008.b.re" { res = stack_sub(); continue; } -#line 149 "calc_008.b.c" +#line 148 "calc_008.b.c" scan13: curr = (unsigned char)*++p; if (curr <= '/') goto scan14; @@ -153,7 +152,7 @@ scan13: scan14: #line 105 "calc_008.b.re" { res = push_num(t, p, 10); continue; } -#line 157 "calc_008.b.c" +#line 156 "calc_008.b.c" scan15: curr = (unsigned char)*++p; if (yybm[0+curr] & 128) { @@ -167,7 +166,7 @@ scan17: scan19: #line 104 "calc_008.b.re" { res = push_num(t, p, 8); continue; } -#line 171 "calc_008.b.c" +#line 170 "calc_008.b.c" } #line 110 "calc_008.b.re" diff --git a/re2c/test/config5.c b/re2c/test/config5.c index 57acbcbc..f1c347d9 100644 --- a/re2c/test/config5.c +++ b/re2c/test/config5.c @@ -1,12 +1,11 @@ /* Generated by re2c */ #line 1 "config5.re" // ignored - #line 6 "config5.re" // code -#line 10 "config5.c" +#line 9 "config5.c" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -20,7 +19,7 @@ yy2: yy3: #line 11 "config5.re" { return 0; } -#line 24 "config5.c" +#line 23 "config5.c" yy4: yych = *(YYMARKER = ++YYCURSOR); switch (yych) { @@ -55,17 +54,15 @@ yy10: ++YYCURSOR; #line 10 "config5.re" { return 1; } -#line 59 "config5.c" +#line 58 "config5.c" } #line 13 "config5.re" // ignored - #line 19 "config5.re" // max #define YYMAXFILL 3 - #line 25 "config5.re" // eof diff --git a/re2c/test/main.b.c b/re2c/test/main.b.c index 22758cef..d737f705 100644 --- a/re2c/test/main.b.c +++ b/re2c/test/main.b.c @@ -1,7 +1,6 @@ /* Generated by re2c */ #line 1 "main.b.re" /* re2c lesson 001_upn_calculator, main.b.re, (c) M. Boerger, L. Allan 2006 */ - #line 42 "main.b.re" @@ -53,7 +52,7 @@ int ScanFullSpeed(char *pzStrToScan, size_t lenStrToScan) for(;;) { -#line 57 "main.b.c" +#line 56 "main.b.c" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -110,23 +109,23 @@ yy2: ++YYCURSOR; #line 97 "main.b.re" { return 0; } -#line 114 "main.b.c" +#line 113 "main.b.c" yy4: ++YYCURSOR; yy5: #line 98 "main.b.re" { return 1; } -#line 120 "main.b.c" +#line 119 "main.b.c" yy6: ++YYCURSOR; #line 95 "main.b.re" { continue; } -#line 125 "main.b.c" +#line 124 "main.b.c" yy8: ++YYCURSOR; #line 96 "main.b.re" { continue; } -#line 130 "main.b.c" +#line 129 "main.b.c" yy10: yych = *++YYCURSOR; if (yych <= '/') goto yy5; @@ -141,7 +140,7 @@ yy11: } #line 93 "main.b.re" { continue; } -#line 145 "main.b.c" +#line 144 "main.b.c" yy14: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -151,7 +150,7 @@ yy14: yy16: #line 94 "main.b.re" { continue; } -#line 155 "main.b.c" +#line 154 "main.b.c" } #line 99 "main.b.re" @@ -174,7 +173,7 @@ int scan(char *pzStrToScan, size_t lenStrToScan) for(;;) { -#line 178 "main.b.c" +#line 177 "main.b.c" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -231,23 +230,23 @@ yy19: ++YYCURSOR; #line 124 "main.b.re" { printf("EOF\n"); return 0; } -#line 235 "main.b.c" +#line 234 "main.b.c" yy21: ++YYCURSOR; yy22: #line 125 "main.b.re" { printf("ERR\n"); strcat(gTestBuf, "ERR "); return 1; } -#line 241 "main.b.c" +#line 240 "main.b.c" yy23: ++YYCURSOR; #line 122 "main.b.re" { printf("+\n"); strcat(gTestBuf, "+ "); continue; } -#line 246 "main.b.c" +#line 245 "main.b.c" yy25: ++YYCURSOR; #line 123 "main.b.re" { printf("-\n"); strcat(gTestBuf, "- "); continue; } -#line 251 "main.b.c" +#line 250 "main.b.c" yy27: yych = *++YYCURSOR; if (yych <= '/') goto yy22; @@ -262,7 +261,7 @@ yy28: } #line 120 "main.b.re" { printf("Num\n"); strcat(gTestBuf, "Num "); continue; } -#line 266 "main.b.c" +#line 265 "main.b.c" yy31: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -272,7 +271,7 @@ yy31: yy33: #line 121 "main.b.re" { printf("Oct\n"); strcat(gTestBuf, "Oct "); continue; } -#line 276 "main.b.c" +#line 275 "main.b.c" } #line 126 "main.b.re" diff --git a/re2c/test/strip_001.s.c b/re2c/test/strip_001.s.c index d77257a6..6b24f9d1 100644 --- a/re2c/test/strip_001.s.c +++ b/re2c/test/strip_001.s.c @@ -1,7 +1,6 @@ /* Generated by re2c */ #line 1 "strip_001.s.re" /* re2c lesson 002_strip_comments, strip_001.s, (c) M. Boerger 2006 - 2007 */ - #line 31 "strip_001.s.re" @@ -79,7 +78,7 @@ int scan(FILE *fp) { s.tok = s.cur; -#line 83 "strip_001.s.c" +#line 82 "strip_001.s.c" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -89,7 +88,7 @@ int scan(FILE *fp) yy3: #line 113 "strip_001.s.re" { fputc(*s.tok, stdout); continue; } -#line 93 "strip_001.s.c" +#line 92 "strip_001.s.c" yy4: yych = *++YYCURSOR; if (yych == '*') goto yy5; @@ -99,19 +98,19 @@ yy5: ++YYCURSOR; #line 112 "strip_001.s.re" { goto comment; } -#line 103 "strip_001.s.c" +#line 102 "strip_001.s.c" yy7: ++YYCURSOR; #line 111 "strip_001.s.re" { goto cppcomment; } -#line 108 "strip_001.s.c" +#line 107 "strip_001.s.c" } #line 114 "strip_001.s.re" comment: s.tok = s.cur; -#line 115 "strip_001.s.c" +#line 114 "strip_001.s.c" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -121,21 +120,21 @@ comment: yy12: #line 119 "strip_001.s.re" { goto comment; } -#line 125 "strip_001.s.c" +#line 124 "strip_001.s.c" yy13: yych = *++YYCURSOR; if (yych != '/') goto yy12; ++YYCURSOR; #line 118 "strip_001.s.re" { continue; } -#line 132 "strip_001.s.c" +#line 131 "strip_001.s.c" } #line 120 "strip_001.s.re" cppcomment: s.tok = s.cur; -#line 139 "strip_001.s.c" +#line 138 "strip_001.s.c" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -146,12 +145,12 @@ cppcomment: yy19: #line 125 "strip_001.s.re" { goto cppcomment; } -#line 150 "strip_001.s.c" +#line 149 "strip_001.s.c" yy20: ++YYCURSOR; #line 124 "strip_001.s.re" { fwrite(s.tok, 1, s.cur - s.tok, stdout); continue; } -#line 155 "strip_001.s.c" +#line 154 "strip_001.s.c" yy22: yych = *++YYCURSOR; if (yych == '\n') goto yy20; diff --git a/re2c/test/strip_002.s.c b/re2c/test/strip_002.s.c index 0b076cba..6c3993cb 100644 --- a/re2c/test/strip_002.s.c +++ b/re2c/test/strip_002.s.c @@ -1,7 +1,6 @@ /* Generated by re2c */ #line 1 "strip_002.s.re" /* re2c lesson 002_strip_comments, strip_002.s, (c) M. Boerger 2006 - 2007 */ - #line 31 "strip_002.s.re" @@ -86,7 +85,7 @@ int scan(FILE *fp) { s.tok = s.cur; -#line 90 "strip_002.s.c" +#line 89 "strip_002.s.c" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -96,7 +95,7 @@ int scan(FILE *fp) yy3: #line 121 "strip_002.s.re" { fputc(*s.tok, stdout); continue; } -#line 100 "strip_002.s.c" +#line 99 "strip_002.s.c" yy4: yych = *++YYCURSOR; if (yych == '*') goto yy5; @@ -106,19 +105,19 @@ yy5: ++YYCURSOR; #line 120 "strip_002.s.re" { goto comment; } -#line 110 "strip_002.s.c" +#line 109 "strip_002.s.c" yy7: ++YYCURSOR; #line 119 "strip_002.s.re" { goto cppcomment; } -#line 115 "strip_002.s.c" +#line 114 "strip_002.s.c" } #line 122 "strip_002.s.re" comment: s.tok = s.cur; -#line 122 "strip_002.s.c" +#line 121 "strip_002.s.c" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -128,21 +127,21 @@ comment: yy12: #line 127 "strip_002.s.re" { goto comment; } -#line 132 "strip_002.s.c" +#line 131 "strip_002.s.c" yy13: yych = *++YYCURSOR; if (yych != '/') goto yy12; ++YYCURSOR; #line 126 "strip_002.s.re" { goto commentws; } -#line 139 "strip_002.s.c" +#line 138 "strip_002.s.c" } #line 128 "strip_002.s.re" commentws: s.tok = s.cur; -#line 146 "strip_002.s.c" +#line 145 "strip_002.s.c" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -159,18 +158,18 @@ yy18: ++YYCURSOR; #line 134 "strip_002.s.re" { echo(&s); continue; } -#line 163 "strip_002.s.c" +#line 162 "strip_002.s.c" yy20: ++YYCURSOR; yy21: #line 133 "strip_002.s.re" { goto commentws; } -#line 169 "strip_002.s.c" +#line 168 "strip_002.s.c" yy22: ++YYCURSOR; #line 132 "strip_002.s.re" { echo(&s); continue; } -#line 174 "strip_002.s.c" +#line 173 "strip_002.s.c" yy24: yych = *++YYCURSOR; if (yych == '\n') goto yy22; @@ -181,7 +180,7 @@ yy24: cppcomment: s.tok = s.cur; -#line 185 "strip_002.s.c" +#line 184 "strip_002.s.c" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -192,12 +191,12 @@ cppcomment: yy28: #line 140 "strip_002.s.re" { goto cppcomment; } -#line 196 "strip_002.s.c" +#line 195 "strip_002.s.c" yy29: ++YYCURSOR; #line 139 "strip_002.s.re" { echo(&s); continue; } -#line 201 "strip_002.s.c" +#line 200 "strip_002.s.c" yy31: yych = *++YYCURSOR; if (yych == '\n') goto yy29; diff --git a/re2c/test/strip_003.b--skeleton.c b/re2c/test/strip_003.b--skeleton.c index d3d11202..03528dca 100644 --- a/re2c/test/strip_003.b--skeleton.c +++ b/re2c/test/strip_003.b--skeleton.c @@ -48,7 +48,6 @@ error: return NULL; } - #define YYCTYPE unsigned char #define YYKEYTYPE unsigned char #define YYPEEK() *cursor diff --git a/re2c/test/strip_003.b.c b/re2c/test/strip_003.b.c index b8820258..8e990db5 100644 --- a/re2c/test/strip_003.b.c +++ b/re2c/test/strip_003.b.c @@ -1,7 +1,6 @@ /* Generated by re2c */ #line 1 "strip_003.b.re" /* re2c lesson 002_strip_comments, strip_003.b, (c) M. Boerger 2006 - 2007 */ - #line 36 "strip_003.b.re" @@ -89,7 +88,7 @@ int scan(FILE *fp) { s.tok = s.cur; -#line 93 "strip_003.b.c" +#line 92 "strip_003.b.c" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 4) YYFILL(4); @@ -104,7 +103,7 @@ int scan(FILE *fp) yy3: #line 130 "strip_003.b.re" { fputc(*s.tok, stdout); continue; } -#line 108 "strip_003.b.c" +#line 107 "strip_003.b.c" yy4: yych = *(YYMARKER = ++YYCURSOR); if (yych == '/') goto yy7; @@ -132,25 +131,25 @@ yy10: ++YYCURSOR; #line 129 "strip_003.b.re" { goto comment; } -#line 136 "strip_003.b.c" +#line 135 "strip_003.b.c" yy12: ++YYCURSOR; #line 127 "strip_003.b.re" { goto cppcomment; } -#line 141 "strip_003.b.c" +#line 140 "strip_003.b.c" yy14: ++YYCURSOR; YYCURSOR -= 2; #line 128 "strip_003.b.re" { echo(&s); nlcomment = 1; continue; } -#line 147 "strip_003.b.c" +#line 146 "strip_003.b.c" } #line 131 "strip_003.b.re" comment: s.tok = s.cur; -#line 154 "strip_003.b.c" +#line 153 "strip_003.b.c" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -160,21 +159,21 @@ comment: yy19: #line 136 "strip_003.b.re" { goto comment; } -#line 164 "strip_003.b.c" +#line 163 "strip_003.b.c" yy20: yych = *++YYCURSOR; if (yych != '/') goto yy19; ++YYCURSOR; #line 135 "strip_003.b.re" { goto commentws; } -#line 171 "strip_003.b.c" +#line 170 "strip_003.b.c" } #line 137 "strip_003.b.re" commentws: s.tok = s.cur; -#line 178 "strip_003.b.c" +#line 177 "strip_003.b.c" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 4) YYFILL(4); @@ -197,13 +196,13 @@ commentws: yy26: #line 151 "strip_003.b.re" { echo(&s); nlcomment = 0; continue; } -#line 201 "strip_003.b.c" +#line 200 "strip_003.b.c" yy27: ++YYCURSOR; yy28: #line 150 "strip_003.b.re" { goto commentws; } -#line 207 "strip_003.b.c" +#line 206 "strip_003.b.c" yy29: yych = *(YYMARKER = ++YYCURSOR); if (yych == '/') goto yy33; @@ -217,7 +216,7 @@ yy30: nlcomment = 0; continue; } -#line 221 "strip_003.b.c" +#line 220 "strip_003.b.c" yy31: yych = *++YYCURSOR; if (yych == '\n') goto yy29; @@ -235,14 +234,14 @@ yy35: ++YYCURSOR; #line 141 "strip_003.b.re" { goto comment; } -#line 239 "strip_003.b.c" +#line 238 "strip_003.b.c" } #line 152 "strip_003.b.re" cppcomment: s.tok = s.cur; -#line 246 "strip_003.b.c" +#line 245 "strip_003.b.c" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -253,12 +252,12 @@ cppcomment: yy40: #line 157 "strip_003.b.re" { goto cppcomment; } -#line 257 "strip_003.b.c" +#line 256 "strip_003.b.c" yy41: ++YYCURSOR; #line 156 "strip_003.b.re" { echo(&s); continue; } -#line 262 "strip_003.b.c" +#line 261 "strip_003.b.c" yy43: yych = *++YYCURSOR; if (yych == '\n') goto yy41;