From: Ulya Trofimovich Date: Wed, 21 Nov 2018 00:15:15 +0000 (+0000) Subject: Started using tags in re2c own lexer. X-Git-Tag: 1.2~297 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=41f67d75fff333f843ec9e229dda8e4f558d3c3a;p=re2c Started using tags in re2c own lexer. --- diff --git a/re2c/Makefile.am b/re2c/Makefile.am index 34673f71..1857a924 100644 --- a/re2c/Makefile.am +++ b/re2c/Makefile.am @@ -265,6 +265,7 @@ $(BOOTSTRAP_PARSER): $(CUSTOM_PARSER) cp $@ $(top_srcdir)/bootstrap/$@; \ else \ cp $(top_srcdir)/bootstrap/$@ $@; \ + cp $(top_srcdir)/bootstrap/$*.h $*.h; \ fi # rebuild all re2c sources using newly built re2c diff --git a/re2c/bootstrap/src/ast/lex.cc b/re2c/bootstrap/src/ast/lex.cc index 8384c361..d1607945 100644 --- a/re2c/bootstrap/src/ast/lex.cc +++ b/re2c/bootstrap/src/ast/lex.cc @@ -1,4 +1,4 @@ -/* Generated by re2c 1.1.1 on Mon Nov 19 23:37:12 2018 */ +/* Generated by re2c 1.1.1 on Wed Nov 21 00:09:57 2018 */ #line 1 "../src/ast/lex.re" #include "src/util/c99_stdint.h" #include @@ -26,13 +26,14 @@ extern YYSTYPE yylval; #define YYCURSOR cur #define YYLIMIT lim #define YYMARKER mar -#define YYCTXMARKER ctx #define YYFILL(n) { fill (n); } -namespace re2c -{ +namespace re2c { + +#line 55 "../src/ast/lex.re" + -#line 56 "../src/ast/lex.re" +#line 80 "../src/ast/lex.re" Scanner::ParseMode Scanner::echo(Output &out) @@ -47,7 +48,7 @@ echo: ptr = cur; -#line 51 "src/ast/lex.cc" +#line 52 "src/ast/lex.cc" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -105,19 +106,19 @@ echo: } } ++YYCURSOR; -#line 149 "../src/ast/lex.re" +#line 173 "../src/ast/lex.re" { if (cur != eof) goto echo; out.wraw(tok, ptr); return Stop; } -#line 115 "src/ast/lex.cc" +#line 116 "src/ast/lex.cc" yy4: ++YYCURSOR; yy5: -#line 167 "../src/ast/lex.re" +#line 191 "../src/ast/lex.re" { goto echo; } -#line 121 "src/ast/lex.cc" +#line 122 "src/ast/lex.cc" yy6: yyaccept = 0; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -126,13 +127,13 @@ yy6: } if (yych == '#') goto yy14; yy7: -#line 161 "../src/ast/lex.re" +#line 185 "../src/ast/lex.re" { cline++; pos = cur; goto echo; } -#line 136 "src/ast/lex.cc" +#line 137 "src/ast/lex.cc" yy8: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy6; @@ -175,12 +176,12 @@ yy14: } yy16: ++YYCURSOR; -#line 70 "../src/ast/lex.re" +#line 94 "../src/ast/lex.re" { out.wraw(tok, ptr); return Parse; } -#line 184 "src/ast/lex.cc" +#line 185 "src/ast/lex.cc" yy18: yych = (YYCTYPE)*++YYCURSOR; if (yych == '!') goto yy20; @@ -342,7 +343,7 @@ yy53: if (yych <= ' ') goto yy52; if (yych <= '0') goto yy13; if (yych <= '9') { - YYCTXMARKER = YYCURSOR; + yyt1 = YYCURSOR; goto yy64; } goto yy13; @@ -458,14 +459,14 @@ yy76: } yy78: ++YYCURSOR; - YYCURSOR = YYCTXMARKER; -#line 155 "../src/ast/lex.re" + YYCURSOR = yyt1; +#line 179 "../src/ast/lex.re" { out.wraw(tok, ptr + 1); set_sourceline(); goto echo; } -#line 469 "src/ast/lex.cc" +#line 470 "src/ast/lex.cc" yy80: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy78; @@ -586,14 +587,14 @@ yy107: goto yy13; yy108: ++YYCURSOR; -#line 91 "../src/ast/lex.re" +#line 115 "../src/ast/lex.re" { out.wraw(tok, ptr); out.wdelay_yymaxfill(); lex_end_of_comment(out); goto echo; } -#line 597 "src/ast/lex.cc" +#line 598 "src/ast/lex.cc" yy110: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'h') goto yy120; @@ -616,12 +617,12 @@ yy114: goto yy13; yy115: ++YYCURSOR; -#line 80 "../src/ast/lex.re" +#line 104 "../src/ast/lex.re" { out.wraw(tok, ptr); return Reuse; } -#line 625 "src/ast/lex.cc" +#line 626 "src/ast/lex.cc" yy117: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy125; @@ -672,33 +673,33 @@ yy128: goto yy13; yy129: ++YYCURSOR; -#line 127 "../src/ast/lex.re" +#line 151 "../src/ast/lex.re" { out.wraw(tok, ptr); lex_tags(out, true); goto echo; } -#line 682 "src/ast/lex.cc" +#line 683 "src/ast/lex.cc" yy131: ++YYCURSOR; -#line 75 "../src/ast/lex.re" +#line 99 "../src/ast/lex.re" { out.wraw(tok, ptr); return Rules; } -#line 690 "src/ast/lex.cc" +#line 691 "src/ast/lex.cc" yy133: ++YYCURSOR; -#line 121 "../src/ast/lex.re" +#line 145 "../src/ast/lex.re" { out.wraw(tok, ptr); lex_tags(out, false); goto echo; } -#line 699 "src/ast/lex.cc" +#line 700 "src/ast/lex.cc" yy135: ++YYCURSOR; -#line 112 "../src/ast/lex.re" +#line 136 "../src/ast/lex.re" { out.wraw(tok, ptr); out.wdelay_line_info_output(); @@ -707,7 +708,7 @@ yy135: lex_end_of_comment(out); goto echo; } -#line 711 "src/ast/lex.cc" +#line 712 "src/ast/lex.cc" yy137: yych = (YYCTYPE)*++YYCURSOR; if (yych == '2') goto yy142; @@ -718,13 +719,13 @@ yy138: goto yy13; yy139: ++YYCURSOR; -#line 85 "../src/ast/lex.re" +#line 109 "../src/ast/lex.re" { out.wraw(tok, ptr); lex_end_of_comment(out); goto echo; } -#line 728 "src/ast/lex.cc" +#line 729 "src/ast/lex.cc" yy141: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy144; @@ -743,14 +744,14 @@ yy144: goto yy13; yy145: ++YYCURSOR; -#line 105 "../src/ast/lex.re" +#line 129 "../src/ast/lex.re" { out.wraw(tok, ptr); out.wdelay_state_goto(0); lex_end_of_comment(out); goto echo; } -#line 754 "src/ast/lex.cc" +#line 755 "src/ast/lex.cc" yy147: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'f') goto yy149; @@ -766,7 +767,7 @@ yy149: goto yy13; yy150: ++YYCURSOR; -#line 133 "../src/ast/lex.re" +#line 157 "../src/ast/lex.re" { out.wraw(tok, ptr); out.header_mode(true); @@ -774,20 +775,20 @@ yy150: lex_end_of_comment(out); goto echo; } -#line 778 "src/ast/lex.cc" +#line 779 "src/ast/lex.cc" yy152: ++YYCURSOR; -#line 98 "../src/ast/lex.re" +#line 122 "../src/ast/lex.re" { out.wraw(tok, ptr); out.wdelay_yymaxnmatch(); lex_end_of_comment(out); goto echo; } -#line 788 "src/ast/lex.cc" +#line 789 "src/ast/lex.cc" yy154: ++YYCURSOR; -#line 141 "../src/ast/lex.re" +#line 165 "../src/ast/lex.re" { out.wraw(tok, ptr); out.header_mode(false); @@ -795,9 +796,9 @@ yy154: lex_end_of_comment(out); goto echo; } -#line 799 "src/ast/lex.cc" +#line 800 "src/ast/lex.cc" } -#line 168 "../src/ast/lex.re" +#line 192 "../src/ast/lex.re" } @@ -805,7 +806,7 @@ void Scanner::lex_end_of_comment(Output &out) { uint32_t ignored = 0; for (;;) { -#line 809 "src/ast/lex.cc" +#line 810 "src/ast/lex.cc" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -821,20 +822,20 @@ void Scanner::lex_end_of_comment(Output &out) } yy158: ++YYCURSOR; -#line 175 "../src/ast/lex.re" +#line 199 "../src/ast/lex.re" { fatal_lc(get_cline(), get_column(), "expected end of block"); } -#line 827 "src/ast/lex.cc" +#line 828 "src/ast/lex.cc" yy160: ++YYCURSOR; yy161: -#line 177 "../src/ast/lex.re" +#line 201 "../src/ast/lex.re" { continue; } -#line 833 "src/ast/lex.cc" +#line 834 "src/ast/lex.cc" yy162: ++YYCURSOR; -#line 178 "../src/ast/lex.re" +#line 202 "../src/ast/lex.re" { ++ignored; continue; } -#line 838 "src/ast/lex.cc" +#line 839 "src/ast/lex.cc" yy164: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy162; @@ -843,7 +844,7 @@ yy165: yych = (YYCTYPE)*++YYCURSOR; if (yych != '/') goto yy161; ++YYCURSOR; -#line 179 "../src/ast/lex.re" +#line 203 "../src/ast/lex.re" { if (ignored > 0) { cline += ignored; @@ -852,9 +853,9 @@ yy165: tok = pos = cur; return; } -#line 856 "src/ast/lex.cc" +#line 857 "src/ast/lex.cc" } -#line 187 "../src/ast/lex.re" +#line 211 "../src/ast/lex.re" } } @@ -862,7 +863,7 @@ void Scanner::lex_tags(Output &out, bool mtags) { std::string fmt, sep; for (;;) { -#line 866 "src/ast/lex.cc" +#line 867 "src/ast/lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -920,9 +921,9 @@ void Scanner::lex_tags(Output &out, bool mtags) } ++YYCURSOR; yy171: -#line 194 "../src/ast/lex.re" +#line 218 "../src/ast/lex.re" { fatal_lc(get_cline(), get_column(), "unrecognized configuration"); } -#line 926 "src/ast/lex.cc" +#line 927 "src/ast/lex.cc" yy172: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -930,14 +931,14 @@ yy172: if (yybm[0+yych] & 128) { goto yy172; } -#line 199 "../src/ast/lex.re" +#line 223 "../src/ast/lex.re" { continue; } -#line 936 "src/ast/lex.cc" +#line 937 "src/ast/lex.cc" yy175: ++YYCURSOR; -#line 200 "../src/ast/lex.re" +#line 224 "../src/ast/lex.re" { ++cline; continue; } -#line 941 "src/ast/lex.cc" +#line 942 "src/ast/lex.cc" yy177: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy175; @@ -956,13 +957,13 @@ yy180: goto yy171; yy181: ++YYCURSOR; -#line 201 "../src/ast/lex.re" +#line 225 "../src/ast/lex.re" { out.wdelay_tags(new ConfTags(fmt, sep), mtags); tok = pos = cur; return; } -#line 966 "src/ast/lex.cc" +#line 967 "src/ast/lex.cc" yy183: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy186; @@ -999,9 +1000,9 @@ yy191: goto yy184; yy192: ++YYCURSOR; -#line 196 "../src/ast/lex.re" +#line 220 "../src/ast/lex.re" { fmt = lex_conf_string(); continue; } -#line 1005 "src/ast/lex.cc" +#line 1006 "src/ast/lex.cc" yy194: yych = (YYCTYPE)*++YYCURSOR; if (yych != 't') goto yy184; @@ -1010,21 +1011,22 @@ yy194: yych = (YYCTYPE)*++YYCURSOR; if (yych != 'r') goto yy184; ++YYCURSOR; -#line 197 "../src/ast/lex.re" +#line 221 "../src/ast/lex.re" { sep = lex_conf_string(); continue; } -#line 1016 "src/ast/lex.cc" +#line 1017 "src/ast/lex.cc" } -#line 206 "../src/ast/lex.re" +#line 230 "../src/ast/lex.re" } } int Scanner::scan(const conopt_t *globopts) { + const char *p; scan: tchar = cur - pos; tok = cur; -#line 1028 "src/ast/lex.cc" +#line 1030 "src/ast/lex.cc" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -1133,12 +1135,12 @@ scan: yy201: ++YYCURSOR; yy202: -#line 330 "../src/ast/lex.re" +#line 354 "../src/ast/lex.re" { fatal_lc(get_cline(), get_column(), "unexpected character: '%c'", *tok); goto scan; } -#line 1142 "src/ast/lex.cc" +#line 1144 "src/ast/lex.cc" yy203: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -1146,9 +1148,9 @@ yy203: if (yybm[0+yych] & 16) { goto yy203; } -#line 311 "../src/ast/lex.re" +#line 335 "../src/ast/lex.re" { goto scan; } -#line 1152 "src/ast/lex.cc" +#line 1154 "src/ast/lex.cc" yy206: yyaccept = 0; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -1159,7 +1161,7 @@ yy206: if (yych == '#') goto yy236; } yy207: -#line 318 "../src/ast/lex.re" +#line 342 "../src/ast/lex.re" { pos = cur; cline++; @@ -1171,16 +1173,16 @@ yy207: goto scan; } } -#line 1175 "src/ast/lex.cc" +#line 1177 "src/ast/lex.cc" yy208: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy206; goto yy202; yy209: ++YYCURSOR; -#line 228 "../src/ast/lex.re" +#line 253 "../src/ast/lex.re" { yylval.regexp = lex_str('"'); return TOKEN_REGEXP; } -#line 1184 "src/ast/lex.cc" +#line 1186 "src/ast/lex.cc" yy211: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '^') { @@ -1198,27 +1200,27 @@ yy212: goto yy202; yy213: ++YYCURSOR; -#line 227 "../src/ast/lex.re" +#line 252 "../src/ast/lex.re" { yylval.regexp = lex_str('\''); return TOKEN_REGEXP; } -#line 1204 "src/ast/lex.cc" +#line 1206 "src/ast/lex.cc" yy215: ++YYCURSOR; yy216: -#line 238 "../src/ast/lex.re" +#line 263 "../src/ast/lex.re" { return *tok; } -#line 1210 "src/ast/lex.cc" +#line 1212 "src/ast/lex.cc" yy217: yych = (YYCTYPE)*++YYCURSOR; if (yych == '/') goto yy241; goto yy216; yy218: ++YYCURSOR; -#line 306 "../src/ast/lex.re" +#line 330 "../src/ast/lex.re" { yylval.regexp = ast_dot(cline, get_column()); return TOKEN_REGEXP; } -#line 1222 "src/ast/lex.cc" +#line 1224 "src/ast/lex.cc" yy220: yych = (YYCTYPE)*++YYCURSOR; if (yych == '*') goto yy243; @@ -1230,9 +1232,9 @@ yy221: goto yy202; yy222: ++YYCURSOR; -#line 220 "../src/ast/lex.re" +#line 245 "../src/ast/lex.re" { return lex_clist(); } -#line 1236 "src/ast/lex.cc" +#line 1238 "src/ast/lex.cc" yy224: yych = (YYCTYPE)*++YYCURSOR; if (yych == '>') goto yy249; @@ -1245,7 +1247,7 @@ yy226: if (yybm[0+yych] & 32) { goto yy225; } -#line 283 "../src/ast/lex.re" +#line 307 "../src/ast/lex.re" { if (!globopts->FFlag || lex_namedef_context_re2c()) { yylval.str = new std::string (tok, tok_len()); @@ -1268,13 +1270,13 @@ yy226: return TOKEN_REGEXP; } } -#line 1272 "src/ast/lex.cc" +#line 1274 "src/ast/lex.cc" yy228: yych = (YYCTYPE)*++YYCURSOR; if (yych == '^') goto yy251; -#line 229 "../src/ast/lex.re" +#line 254 "../src/ast/lex.re" { yylval.regexp = lex_cls(false); return TOKEN_REGEXP; } -#line 1278 "src/ast/lex.cc" +#line 1280 "src/ast/lex.cc" yy230: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy253; @@ -1297,9 +1299,9 @@ yy231: } } yy232: -#line 215 "../src/ast/lex.re" +#line 240 "../src/ast/lex.re" { lex_code_in_braces(); return TOKEN_CODE; } -#line 1303 "src/ast/lex.cc" +#line 1305 "src/ast/lex.cc" yy233: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -1350,44 +1352,44 @@ yy238: } } yy240: -#line 232 "../src/ast/lex.re" +#line 257 "../src/ast/lex.re" { const std::string *name = new std::string(tok + 1, tok_len() - 1); yylval.regexp = ast_tag(cline, get_column(), name, tok[0] == '#'); return TOKEN_REGEXP; } -#line 1360 "src/ast/lex.cc" +#line 1362 "src/ast/lex.cc" yy241: ++YYCURSOR; -#line 225 "../src/ast/lex.re" +#line 250 "../src/ast/lex.re" { tok = cur; return 0; } -#line 1365 "src/ast/lex.cc" +#line 1367 "src/ast/lex.cc" yy243: ++YYCURSOR; -#line 223 "../src/ast/lex.re" +#line 248 "../src/ast/lex.re" { lex_c_comment(); goto scan; } -#line 1370 "src/ast/lex.cc" +#line 1372 "src/ast/lex.cc" yy245: ++YYCURSOR; -#line 222 "../src/ast/lex.re" +#line 247 "../src/ast/lex.re" { lex_cpp_comment(); goto scan; } -#line 1375 "src/ast/lex.cc" +#line 1377 "src/ast/lex.cc" yy247: yych = (YYCTYPE)*++YYCURSOR; if (yych == '>') goto yy261; -#line 216 "../src/ast/lex.re" +#line 241 "../src/ast/lex.re" { lex_code_indented(); return TOKEN_CODE; } -#line 1381 "src/ast/lex.cc" +#line 1383 "src/ast/lex.cc" yy249: ++YYCURSOR; -#line 218 "../src/ast/lex.re" +#line 243 "../src/ast/lex.re" { lex_cgoto(); return TOKEN_CNEXT; } -#line 1386 "src/ast/lex.cc" +#line 1388 "src/ast/lex.cc" yy251: ++YYCURSOR; -#line 230 "../src/ast/lex.re" +#line 255 "../src/ast/lex.re" { yylval.regexp = lex_cls(true); return TOKEN_REGEXP; } -#line 1391 "src/ast/lex.cc" +#line 1393 "src/ast/lex.cc" yy253: yych = (YYCTYPE)*++YYCURSOR; if (yych == '2') goto yy263; @@ -1395,12 +1397,12 @@ yy253: yy254: ++YYCURSOR; yy255: -#line 267 "../src/ast/lex.re" +#line 291 "../src/ast/lex.re" { fatal_lc(get_cline(), get_column(), "illegal closure form, use '{n}', '{n,}', '{n,m}' where n and m are numbers"); } -#line 1404 "src/ast/lex.cc" +#line 1406 "src/ast/lex.cc" yy256: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -1408,7 +1410,10 @@ yy256: if (yybm[0+yych] & 64) { goto yy256; } - if (yych == ',') goto yy264; + if (yych == ',') { + yyt1 = YYCURSOR; + goto yy264; + } if (yych == '}') goto yy265; goto yy235; yy258: @@ -1439,9 +1444,9 @@ yy260: goto yy235; yy261: ++YYCURSOR; -#line 219 "../src/ast/lex.re" +#line 244 "../src/ast/lex.re" { lex_cgoto(); return TOKEN_CJUMP; } -#line 1445 "src/ast/lex.cc" +#line 1450 "src/ast/lex.cc" yy263: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'c') goto yy270; @@ -1455,7 +1460,7 @@ yy264: goto yy255; yy265: ++YYCURSOR; -#line 240 "../src/ast/lex.re" +#line 265 "../src/ast/lex.re" { if (!s_to_u32_unsafe (tok + 1, cur - 1, yylval.bounds.min)) { fatal_lc(get_cline(), get_column(), "repetition count overflow"); @@ -1463,10 +1468,10 @@ yy265: yylval.bounds.max = yylval.bounds.min; return TOKEN_CLOSESIZE; } -#line 1467 "src/ast/lex.cc" +#line 1472 "src/ast/lex.cc" yy267: ++YYCURSOR; -#line 272 "../src/ast/lex.re" +#line 296 "../src/ast/lex.re" { if (!globopts->FFlag) { fatal_lc(get_cline(), get_column(), @@ -1475,7 +1480,7 @@ yy267: yylval.str = new std::string (tok + 1, tok_len () - 2); // -2 to omit braces return TOKEN_ID; } -#line 1479 "src/ast/lex.cc" +#line 1484 "src/ast/lex.cc" yy269: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'n') goto yy275; @@ -1494,7 +1499,7 @@ yy271: goto yy235; yy273: ++YYCURSOR; -#line 259 "../src/ast/lex.re" +#line 283 "../src/ast/lex.re" { if (!s_to_u32_unsafe (tok + 1, cur - 2, yylval.bounds.min)) { fatal_lc(get_cline(), get_column(), "repetition lower bound overflow"); @@ -1502,21 +1507,21 @@ yy273: yylval.bounds.max = std::numeric_limits::max(); return TOKEN_CLOSESIZE; } -#line 1506 "src/ast/lex.cc" +#line 1511 "src/ast/lex.cc" yy275: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy280; goto yy235; yy276: ++YYCURSOR; -#line 281 "../src/ast/lex.re" +#line 305 "../src/ast/lex.re" { return TOKEN_CONF; } -#line 1515 "src/ast/lex.cc" +#line 1520 "src/ast/lex.cc" yy278: ++YYCURSOR; -#line 248 "../src/ast/lex.re" + p = yyt1; +#line 273 "../src/ast/lex.re" { - const char * p = strchr (tok, ','); if (!s_to_u32_unsafe (tok + 1, p, yylval.bounds.min)) { fatal_lc(get_cline(), get_column(), "repetition lower bound overflow"); } @@ -1525,7 +1530,7 @@ yy278: } return TOKEN_CLOSESIZE; } -#line 1529 "src/ast/lex.cc" +#line 1534 "src/ast/lex.cc" yy280: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '0') goto yy282; @@ -1543,7 +1548,7 @@ yy282: if (yych <= ' ') goto yy281; if (yych <= '0') goto yy235; if (yych >= ':') goto yy235; - YYCTXMARKER = YYCURSOR; + yyt1 = YYCURSOR; } yy283: ++YYCURSOR; @@ -1580,13 +1585,13 @@ yy285: } yy287: ++YYCURSOR; - YYCURSOR = YYCTXMARKER; -#line 313 "../src/ast/lex.re" + YYCURSOR = yyt1; +#line 337 "../src/ast/lex.re" { set_sourceline (); return TOKEN_LINE_INFO; } -#line 1590 "src/ast/lex.cc" +#line 1595 "src/ast/lex.cc" yy289: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy287; @@ -1612,14 +1617,14 @@ yy293: if (yych == '\n') goto yy235; goto yy290; } -#line 334 "../src/ast/lex.re" +#line 358 "../src/ast/lex.re" } bool Scanner::lex_namedef_context_re2c() { -#line 1623 "src/ast/lex.cc" +#line 1628 "src/ast/lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -1660,23 +1665,23 @@ bool Scanner::lex_namedef_context_re2c() yych = (YYCTYPE)*(YYMARKER = YYCURSOR); if (yych <= 0x1F) { if (yych == '\t') { - YYCTXMARKER = YYCURSOR; + yyt1 = YYCURSOR; goto yy297; } } else { if (yych <= ' ') { - YYCTXMARKER = YYCURSOR; + yyt1 = YYCURSOR; goto yy297; } if (yych == '=') { - YYCTXMARKER = YYCURSOR; + yyt1 = YYCURSOR; goto yy300; } } yy296: -#line 341 "../src/ast/lex.re" +#line 365 "../src/ast/lex.re" { return false; } -#line 1680 "src/ast/lex.cc" +#line 1685 "src/ast/lex.cc" yy297: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -1692,19 +1697,19 @@ yy300: yych = (YYCTYPE)*++YYCURSOR; if (yych == '>') goto yy299; ++YYCURSOR; - YYCURSOR = YYCTXMARKER; -#line 340 "../src/ast/lex.re" + YYCURSOR = yyt1; +#line 364 "../src/ast/lex.re" { return true; } -#line 1699 "src/ast/lex.cc" +#line 1704 "src/ast/lex.cc" } -#line 342 "../src/ast/lex.re" +#line 366 "../src/ast/lex.re" } bool Scanner::lex_namedef_context_flex() { -#line 1708 "src/ast/lex.cc" +#line 1713 "src/ast/lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -1744,16 +1749,16 @@ bool Scanner::lex_namedef_context_flex() if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yych == '\t') { - YYCTXMARKER = YYCURSOR; + yyt1 = YYCURSOR; goto yy306; } if (yych == ' ') { - YYCTXMARKER = YYCURSOR; + yyt1 = YYCURSOR; goto yy306; } -#line 350 "../src/ast/lex.re" +#line 374 "../src/ast/lex.re" { return false; } -#line 1757 "src/ast/lex.cc" +#line 1762 "src/ast/lex.cc" yy306: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -1767,18 +1772,18 @@ yy306: if (yych <= '=') goto yy309; if (yych == '{') goto yy309; } - YYCURSOR = YYCTXMARKER; -#line 349 "../src/ast/lex.re" + YYCURSOR = yyt1; +#line 373 "../src/ast/lex.re" { return true; } -#line 1774 "src/ast/lex.cc" +#line 1779 "src/ast/lex.cc" yy309: ++YYCURSOR; - YYCURSOR = YYCTXMARKER; -#line 348 "../src/ast/lex.re" + YYCURSOR = yyt1; +#line 372 "../src/ast/lex.re" { return false; } -#line 1780 "src/ast/lex.cc" +#line 1785 "src/ast/lex.cc" } -#line 351 "../src/ast/lex.re" +#line 375 "../src/ast/lex.re" } @@ -1787,7 +1792,7 @@ int Scanner::lex_clist() int kind = TOKEN_CLIST; CondList *cl = new CondList; -#line 1791 "src/ast/lex.cc" +#line 1796 "src/ast/lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -1837,30 +1842,30 @@ yy311: if (yych <= '!') goto yy315; if (yych == '>') goto yy318; yy314: -#line 361 "../src/ast/lex.re" +#line 385 "../src/ast/lex.re" { goto cond; } -#line 1843 "src/ast/lex.cc" +#line 1848 "src/ast/lex.cc" yy315: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yych == '\t') goto yy315; if (yych == ' ') goto yy315; -#line 359 "../src/ast/lex.re" +#line 383 "../src/ast/lex.re" { kind = TOKEN_CSETUP; goto cond; } -#line 1852 "src/ast/lex.cc" +#line 1857 "src/ast/lex.cc" yy318: ++YYCURSOR; -#line 360 "../src/ast/lex.re" +#line 384 "../src/ast/lex.re" { kind = TOKEN_CZERO; goto end; } -#line 1857 "src/ast/lex.cc" +#line 1862 "src/ast/lex.cc" } -#line 362 "../src/ast/lex.re" +#line 386 "../src/ast/lex.re" cond: tok = cur; -#line 1864 "src/ast/lex.cc" +#line 1869 "src/ast/lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -1912,14 +1917,14 @@ cond: } yy322: ++YYCURSOR; -#line 368 "../src/ast/lex.re" +#line 392 "../src/ast/lex.re" { goto error; } -#line 1918 "src/ast/lex.cc" +#line 1923 "src/ast/lex.cc" yy324: ++YYCURSOR; -#line 367 "../src/ast/lex.re" +#line 391 "../src/ast/lex.re" { if (!cl->empty()) goto error; cl->insert("*"); goto next; } -#line 1923 "src/ast/lex.cc" +#line 1928 "src/ast/lex.cc" yy326: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -1927,15 +1932,15 @@ yy326: if (yybm[0+yych] & 128) { goto yy326; } -#line 366 "../src/ast/lex.re" +#line 390 "../src/ast/lex.re" { cl->insert(std::string(tok, tok_len())); goto next; } -#line 1933 "src/ast/lex.cc" +#line 1938 "src/ast/lex.cc" } -#line 369 "../src/ast/lex.re" +#line 393 "../src/ast/lex.re" next: -#line 1939 "src/ast/lex.cc" +#line 1944 "src/ast/lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -1986,9 +1991,9 @@ next: } ++YYCURSOR; yy332: -#line 374 "../src/ast/lex.re" +#line 398 "../src/ast/lex.re" { goto error; } -#line 1992 "src/ast/lex.cc" +#line 1997 "src/ast/lex.cc" yy333: yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= ' ') { @@ -2010,14 +2015,14 @@ yy334: if (yybm[0+yych] & 128) { goto yy334; } -#line 372 "../src/ast/lex.re" +#line 396 "../src/ast/lex.re" { goto cond; } -#line 2016 "src/ast/lex.cc" +#line 2021 "src/ast/lex.cc" yy337: ++YYCURSOR; -#line 373 "../src/ast/lex.re" +#line 397 "../src/ast/lex.re" { goto end; } -#line 2021 "src/ast/lex.cc" +#line 2026 "src/ast/lex.cc" yy339: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -2035,7 +2040,7 @@ yy339: YYCURSOR = YYMARKER; goto yy332; } -#line 375 "../src/ast/lex.re" +#line 399 "../src/ast/lex.re" end: yylval.clist = cl; @@ -2048,7 +2053,7 @@ error: void Scanner::lex_cgoto() { -#line 2052 "src/ast/lex.cc" +#line 2057 "src/ast/lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -2094,16 +2099,16 @@ yy342: if (yybm[0+yych] & 128) { goto yy343; } -#line 387 "../src/ast/lex.re" +#line 411 "../src/ast/lex.re" { goto name; } -#line 2100 "src/ast/lex.cc" +#line 2105 "src/ast/lex.cc" } -#line 388 "../src/ast/lex.re" +#line 412 "../src/ast/lex.re" name: tok = cur; -#line 2107 "src/ast/lex.cc" +#line 2112 "src/ast/lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -2151,9 +2156,9 @@ name: } yy348: ++YYCURSOR; -#line 393 "../src/ast/lex.re" +#line 417 "../src/ast/lex.re" { fatal_l(get_cline(), "syntax error in condition goto"); } -#line 2157 "src/ast/lex.cc" +#line 2162 "src/ast/lex.cc" yy350: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -2161,11 +2166,11 @@ yy350: if (yybm[0+yych] & 128) { goto yy350; } -#line 392 "../src/ast/lex.re" +#line 416 "../src/ast/lex.re" { yylval.str = new std::string (tok, tok_len ()); return; } -#line 2167 "src/ast/lex.cc" +#line 2172 "src/ast/lex.cc" } -#line 394 "../src/ast/lex.re" +#line 418 "../src/ast/lex.re" } @@ -2175,7 +2180,7 @@ void Scanner::lex_code_indented() tok = cur; code: -#line 2179 "src/ast/lex.cc" +#line 2184 "src/ast/lex.cc" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3); @@ -2203,15 +2208,15 @@ code: } yy355: ++YYCURSOR; -#line 411 "../src/ast/lex.re" +#line 435 "../src/ast/lex.re" { fail_if_eof(); goto code; } -#line 2209 "src/ast/lex.cc" +#line 2214 "src/ast/lex.cc" yy357: ++YYCURSOR; yy358: -#line 416 "../src/ast/lex.re" +#line 440 "../src/ast/lex.re" { goto code; } -#line 2215 "src/ast/lex.cc" +#line 2220 "src/ast/lex.cc" yy359: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '\f') { @@ -2222,23 +2227,23 @@ yy359: if (yych == ' ') goto yy367; } yy360: -#line 404 "../src/ast/lex.re" +#line 428 "../src/ast/lex.re" { while (isspace(tok[0])) ++tok; while (cur > tok && isspace(cur[-1])) --cur; yylval.code = new Code(get_fname (), line, tok, tok_len ()); return; } -#line 2233 "src/ast/lex.cc" +#line 2238 "src/ast/lex.cc" yy361: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy359; goto yy358; yy362: ++YYCURSOR; -#line 415 "../src/ast/lex.re" +#line 439 "../src/ast/lex.re" { lex_string(cur[-1]); goto code; } -#line 2242 "src/ast/lex.cc" +#line 2247 "src/ast/lex.cc" yy364: yych = (YYCTYPE)*++YYCURSOR; if (yych == '*') goto yy369; @@ -2246,27 +2251,27 @@ yy364: goto yy358; yy365: ++YYCURSOR; -#line 412 "../src/ast/lex.re" +#line 436 "../src/ast/lex.re" { fatal_l(get_cline(), "Curly braces are not allowed after ':='"); } -#line 2252 "src/ast/lex.cc" +#line 2257 "src/ast/lex.cc" yy367: ++YYCURSOR; YYCURSOR -= 1; -#line 403 "../src/ast/lex.re" +#line 427 "../src/ast/lex.re" { goto code; } -#line 2258 "src/ast/lex.cc" +#line 2263 "src/ast/lex.cc" yy369: ++YYCURSOR; -#line 413 "../src/ast/lex.re" +#line 437 "../src/ast/lex.re" { lex_c_comment(); goto code; } -#line 2263 "src/ast/lex.cc" +#line 2268 "src/ast/lex.cc" yy371: ++YYCURSOR; -#line 414 "../src/ast/lex.re" +#line 438 "../src/ast/lex.re" { lex_cpp_comment(); goto code; } -#line 2268 "src/ast/lex.cc" +#line 2273 "src/ast/lex.cc" } -#line 417 "../src/ast/lex.re" +#line 441 "../src/ast/lex.re" } @@ -2276,7 +2281,7 @@ void Scanner::lex_code_in_braces() uint32_t depth = 1; code: -#line 2280 "src/ast/lex.cc" +#line 2285 "src/ast/lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -2338,15 +2343,15 @@ code: } yy375: ++YYCURSOR; -#line 437 "../src/ast/lex.re" +#line 461 "../src/ast/lex.re" { fail_if_eof(); goto code; } -#line 2344 "src/ast/lex.cc" +#line 2349 "src/ast/lex.cc" yy377: ++YYCURSOR; yy378: -#line 441 "../src/ast/lex.re" +#line 465 "../src/ast/lex.re" { goto code; } -#line 2350 "src/ast/lex.cc" +#line 2355 "src/ast/lex.cc" yy379: yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yybm[0+yych] & 32) { @@ -2354,18 +2359,18 @@ yy379: } if (yych == '#') goto yy392; yy380: -#line 436 "../src/ast/lex.re" +#line 460 "../src/ast/lex.re" { pos = cur; cline++; goto code; } -#line 2360 "src/ast/lex.cc" +#line 2365 "src/ast/lex.cc" yy381: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy379; goto yy378; yy382: ++YYCURSOR; -#line 440 "../src/ast/lex.re" +#line 464 "../src/ast/lex.re" { lex_string(cur[-1]); goto code; } -#line 2369 "src/ast/lex.cc" +#line 2374 "src/ast/lex.cc" yy384: yych = (YYCTYPE)*++YYCURSOR; if (yych == '*') goto yy394; @@ -2373,12 +2378,12 @@ yy384: goto yy378; yy385: ++YYCURSOR; -#line 434 "../src/ast/lex.re" +#line 458 "../src/ast/lex.re" { ++depth; goto code; } -#line 2379 "src/ast/lex.cc" +#line 2384 "src/ast/lex.cc" yy387: ++YYCURSOR; -#line 426 "../src/ast/lex.re" +#line 450 "../src/ast/lex.re" { if (--depth == 0) { yylval.code = new Code(get_fname (), line, tok, tok_len ()); @@ -2386,7 +2391,7 @@ yy387: } goto code; } -#line 2390 "src/ast/lex.cc" +#line 2395 "src/ast/lex.cc" yy389: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -2412,14 +2417,14 @@ yy392: } yy394: ++YYCURSOR; -#line 438 "../src/ast/lex.re" +#line 462 "../src/ast/lex.re" { lex_c_comment(); goto code; } -#line 2418 "src/ast/lex.cc" +#line 2423 "src/ast/lex.cc" yy396: ++YYCURSOR; -#line 439 "../src/ast/lex.re" +#line 463 "../src/ast/lex.re" { lex_cpp_comment(); goto code; } -#line 2423 "src/ast/lex.cc" +#line 2428 "src/ast/lex.cc" yy398: yych = (YYCTYPE)*++YYCURSOR; if (yych != 'i') goto yy391; @@ -2443,7 +2448,7 @@ yy403: if (yych <= ' ') goto yy402; if (yych <= '0') goto yy391; if (yych >= ':') goto yy391; - YYCTXMARKER = YYCURSOR; + yyt1 = YYCURSOR; } yy404: ++YYCURSOR; @@ -2475,10 +2480,10 @@ yy406: } yy408: ++YYCURSOR; - YYCURSOR = YYCTXMARKER; -#line 435 "../src/ast/lex.re" + YYCURSOR = yyt1; +#line 459 "../src/ast/lex.re" { set_sourceline (); goto code; } -#line 2482 "src/ast/lex.cc" +#line 2487 "src/ast/lex.cc" yy410: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy408; @@ -2504,7 +2509,7 @@ yy414: if (yych == '\n') goto yy391; goto yy411; } -#line 442 "../src/ast/lex.re" +#line 466 "../src/ast/lex.re" } @@ -2512,7 +2517,7 @@ void Scanner::lex_string(char delim) { loop: -#line 2516 "src/ast/lex.cc" +#line 2521 "src/ast/lex.cc" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -2538,29 +2543,29 @@ loop: } yy417: ++YYCURSOR; -#line 452 "../src/ast/lex.re" +#line 476 "../src/ast/lex.re" { fail_if_eof(); goto loop; } -#line 2544 "src/ast/lex.cc" +#line 2549 "src/ast/lex.cc" yy419: ++YYCURSOR; yy420: -#line 453 "../src/ast/lex.re" +#line 477 "../src/ast/lex.re" { goto loop; } -#line 2550 "src/ast/lex.cc" +#line 2555 "src/ast/lex.cc" yy421: ++YYCURSOR; -#line 451 "../src/ast/lex.re" +#line 475 "../src/ast/lex.re" { pos = cur; ++cline; goto loop; } -#line 2555 "src/ast/lex.cc" +#line 2560 "src/ast/lex.cc" yy423: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy421; goto yy420; yy424: ++YYCURSOR; -#line 449 "../src/ast/lex.re" +#line 473 "../src/ast/lex.re" { if (cur[-1] == delim) return; else goto loop; } -#line 2564 "src/ast/lex.cc" +#line 2569 "src/ast/lex.cc" yy426: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '&') { @@ -2571,11 +2576,11 @@ yy426: } yy427: ++YYCURSOR; -#line 450 "../src/ast/lex.re" +#line 474 "../src/ast/lex.re" { goto loop; } -#line 2577 "src/ast/lex.cc" +#line 2582 "src/ast/lex.cc" } -#line 454 "../src/ast/lex.re" +#line 478 "../src/ast/lex.re" } @@ -2583,7 +2588,7 @@ void Scanner::lex_c_comment() { loop: -#line 2587 "src/ast/lex.cc" +#line 2592 "src/ast/lex.cc" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -2599,20 +2604,20 @@ loop: } yy431: ++YYCURSOR; -#line 463 "../src/ast/lex.re" +#line 487 "../src/ast/lex.re" { fail_if_eof(); goto loop; } -#line 2605 "src/ast/lex.cc" +#line 2610 "src/ast/lex.cc" yy433: ++YYCURSOR; yy434: -#line 464 "../src/ast/lex.re" +#line 488 "../src/ast/lex.re" { goto loop; } -#line 2611 "src/ast/lex.cc" +#line 2616 "src/ast/lex.cc" yy435: ++YYCURSOR; -#line 462 "../src/ast/lex.re" +#line 486 "../src/ast/lex.re" { pos = cur; ++cline; goto loop; } -#line 2616 "src/ast/lex.cc" +#line 2621 "src/ast/lex.cc" yy437: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy435; @@ -2621,11 +2626,11 @@ yy438: yych = (YYCTYPE)*++YYCURSOR; if (yych != '/') goto yy434; ++YYCURSOR; -#line 461 "../src/ast/lex.re" +#line 485 "../src/ast/lex.re" { return; } -#line 2627 "src/ast/lex.cc" +#line 2632 "src/ast/lex.cc" } -#line 465 "../src/ast/lex.re" +#line 489 "../src/ast/lex.re" } @@ -2633,7 +2638,7 @@ void Scanner::lex_cpp_comment() { loop: -#line 2637 "src/ast/lex.cc" +#line 2642 "src/ast/lex.cc" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -2648,26 +2653,26 @@ loop: } yy443: ++YYCURSOR; -#line 473 "../src/ast/lex.re" +#line 497 "../src/ast/lex.re" { fail_if_eof(); goto loop; } -#line 2654 "src/ast/lex.cc" +#line 2659 "src/ast/lex.cc" yy445: ++YYCURSOR; yy446: -#line 474 "../src/ast/lex.re" +#line 498 "../src/ast/lex.re" { goto loop; } -#line 2660 "src/ast/lex.cc" +#line 2665 "src/ast/lex.cc" yy447: ++YYCURSOR; -#line 472 "../src/ast/lex.re" +#line 496 "../src/ast/lex.re" { pos = cur; ++cline; return; } -#line 2665 "src/ast/lex.cc" +#line 2670 "src/ast/lex.cc" yy449: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy447; goto yy446; } -#line 475 "../src/ast/lex.re" +#line 499 "../src/ast/lex.re" } @@ -2679,35 +2684,35 @@ fst: tok = cur; c = get_column(); -#line 2683 "src/ast/lex.cc" +#line 2688 "src/ast/lex.cc" { YYCTYPE yych; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yych == ']') goto yy453; -#line 487 "../src/ast/lex.re" +#line 511 "../src/ast/lex.re" { l = lex_cls_chr(); goto snd; } -#line 2691 "src/ast/lex.cc" +#line 2696 "src/ast/lex.cc" yy453: ++YYCURSOR; -#line 486 "../src/ast/lex.re" +#line 510 "../src/ast/lex.re" { return ast_cls(cline, c0, cls, neg); } -#line 2696 "src/ast/lex.cc" +#line 2701 "src/ast/lex.cc" } -#line 488 "../src/ast/lex.re" +#line 512 "../src/ast/lex.re" snd: -#line 2702 "src/ast/lex.cc" +#line 2707 "src/ast/lex.cc" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = (YYCTYPE)*(YYMARKER = YYCURSOR); if (yych == '-') goto yy458; yy457: -#line 491 "../src/ast/lex.re" +#line 515 "../src/ast/lex.re" { u = l; goto add; } -#line 2711 "src/ast/lex.cc" +#line 2716 "src/ast/lex.cc" yy458: yych = (YYCTYPE)*++YYCURSOR; if (yych != ']') goto yy460; @@ -2716,7 +2721,7 @@ yy458: yy460: ++YYCURSOR; YYCURSOR -= 1; -#line 492 "../src/ast/lex.re" +#line 516 "../src/ast/lex.re" { u = lex_cls_chr(); if (l > u) { @@ -2725,9 +2730,9 @@ yy460: } goto add; } -#line 2729 "src/ast/lex.cc" +#line 2734 "src/ast/lex.cc" } -#line 500 "../src/ast/lex.re" +#line 524 "../src/ast/lex.re" add: cls->push_back(ASTRange(l, u, c)); @@ -2739,7 +2744,7 @@ uint32_t Scanner::lex_cls_chr() tok = cur; const uint32_t l = get_cline(), c = get_column(); -#line 2743 "src/ast/lex.cc" +#line 2748 "src/ast/lex.cc" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -2756,20 +2761,20 @@ uint32_t Scanner::lex_cls_chr() } yy464: ++YYCURSOR; -#line 512 "../src/ast/lex.re" +#line 536 "../src/ast/lex.re" { fail_if_eof(); return 0; } -#line 2762 "src/ast/lex.cc" +#line 2767 "src/ast/lex.cc" yy466: ++YYCURSOR; yy467: -#line 518 "../src/ast/lex.re" +#line 542 "../src/ast/lex.re" { return static_cast(tok[0]); } -#line 2768 "src/ast/lex.cc" +#line 2773 "src/ast/lex.cc" yy468: ++YYCURSOR; -#line 513 "../src/ast/lex.re" +#line 537 "../src/ast/lex.re" { fatal_lc(l, c, "newline in character class"); } -#line 2773 "src/ast/lex.cc" +#line 2778 "src/ast/lex.cc" yy470: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy468; @@ -2828,36 +2833,36 @@ yy471: } } yy472: -#line 516 "../src/ast/lex.re" +#line 540 "../src/ast/lex.re" { fatal_lc(l, c, "syntax error in escape sequence"); } -#line 2834 "src/ast/lex.cc" +#line 2839 "src/ast/lex.cc" yy473: ++YYCURSOR; yy474: -#line 531 "../src/ast/lex.re" +#line 555 "../src/ast/lex.re" { warn.useless_escape(cline, get_column(), tok[1]); return static_cast(tok[1]); } -#line 2843 "src/ast/lex.cc" +#line 2848 "src/ast/lex.cc" yy475: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy468; goto yy474; yy476: ++YYCURSOR; -#line 529 "../src/ast/lex.re" +#line 553 "../src/ast/lex.re" { return static_cast('-'); } -#line 2852 "src/ast/lex.cc" +#line 2857 "src/ast/lex.cc" yy478: yyaccept = 0; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '/') goto yy479; if (yych <= '7') goto yy503; yy479: -#line 515 "../src/ast/lex.re" +#line 539 "../src/ast/lex.re" { fatal_lc(l, c, "syntax error in octal escape sequence"); } -#line 2861 "src/ast/lex.cc" +#line 2866 "src/ast/lex.cc" yy480: ++YYCURSOR; goto yy479; @@ -2873,9 +2878,9 @@ yy481: if (yych <= 'f') goto yy505; } yy482: -#line 514 "../src/ast/lex.re" +#line 538 "../src/ast/lex.re" { fatal_lc(l, c, "syntax error in hexadecimal escape sequence"); } -#line 2879 "src/ast/lex.cc" +#line 2884 "src/ast/lex.cc" yy483: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -2891,49 +2896,49 @@ yy483: } yy484: ++YYCURSOR; -#line 528 "../src/ast/lex.re" +#line 552 "../src/ast/lex.re" { return static_cast('\\'); } -#line 2897 "src/ast/lex.cc" +#line 2902 "src/ast/lex.cc" yy486: ++YYCURSOR; -#line 530 "../src/ast/lex.re" +#line 554 "../src/ast/lex.re" { return static_cast(']'); } -#line 2902 "src/ast/lex.cc" +#line 2907 "src/ast/lex.cc" yy488: ++YYCURSOR; -#line 521 "../src/ast/lex.re" +#line 545 "../src/ast/lex.re" { return static_cast('\a'); } -#line 2907 "src/ast/lex.cc" +#line 2912 "src/ast/lex.cc" yy490: ++YYCURSOR; -#line 522 "../src/ast/lex.re" +#line 546 "../src/ast/lex.re" { return static_cast('\b'); } -#line 2912 "src/ast/lex.cc" +#line 2917 "src/ast/lex.cc" yy492: ++YYCURSOR; -#line 523 "../src/ast/lex.re" +#line 547 "../src/ast/lex.re" { return static_cast('\f'); } -#line 2917 "src/ast/lex.cc" +#line 2922 "src/ast/lex.cc" yy494: ++YYCURSOR; -#line 524 "../src/ast/lex.re" +#line 548 "../src/ast/lex.re" { return static_cast('\n'); } -#line 2922 "src/ast/lex.cc" +#line 2927 "src/ast/lex.cc" yy496: ++YYCURSOR; -#line 525 "../src/ast/lex.re" +#line 549 "../src/ast/lex.re" { return static_cast('\r'); } -#line 2927 "src/ast/lex.cc" +#line 2932 "src/ast/lex.cc" yy498: ++YYCURSOR; -#line 526 "../src/ast/lex.re" +#line 550 "../src/ast/lex.re" { return static_cast('\t'); } -#line 2932 "src/ast/lex.cc" +#line 2937 "src/ast/lex.cc" yy500: ++YYCURSOR; -#line 527 "../src/ast/lex.re" +#line 551 "../src/ast/lex.re" { return static_cast('\v'); } -#line 2937 "src/ast/lex.cc" +#line 2942 "src/ast/lex.cc" yy502: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -2996,9 +3001,9 @@ yy507: } yy508: ++YYCURSOR; -#line 520 "../src/ast/lex.re" +#line 544 "../src/ast/lex.re" { return unesc_oct(tok, cur); } -#line 3002 "src/ast/lex.cc" +#line 3007 "src/ast/lex.cc" yy510: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { @@ -3025,9 +3030,9 @@ yy511: } yy512: ++YYCURSOR; -#line 519 "../src/ast/lex.re" +#line 543 "../src/ast/lex.re" { return unesc_hex(tok, cur); } -#line 3031 "src/ast/lex.cc" +#line 3036 "src/ast/lex.cc" yy514: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { @@ -3051,7 +3056,7 @@ yy515: goto yy504; } } -#line 535 "../src/ast/lex.re" +#line 559 "../src/ast/lex.re" } @@ -3061,7 +3066,7 @@ uint32_t Scanner::lex_str_chr(char quote, bool &end) tok = cur; const uint32_t l = get_cline(), c = get_column(); -#line 3065 "src/ast/lex.cc" +#line 3070 "src/ast/lex.cc" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -3078,23 +3083,23 @@ uint32_t Scanner::lex_str_chr(char quote, bool &end) } yy518: ++YYCURSOR; -#line 545 "../src/ast/lex.re" +#line 569 "../src/ast/lex.re" { fail_if_eof(); return 0; } -#line 3084 "src/ast/lex.cc" +#line 3089 "src/ast/lex.cc" yy520: ++YYCURSOR; yy521: -#line 551 "../src/ast/lex.re" +#line 575 "../src/ast/lex.re" { end = tok[0] == quote; return static_cast(tok[0]); } -#line 3093 "src/ast/lex.cc" +#line 3098 "src/ast/lex.cc" yy522: ++YYCURSOR; -#line 546 "../src/ast/lex.re" +#line 570 "../src/ast/lex.re" { fatal_lc(l, c, "newline in character string"); } -#line 3098 "src/ast/lex.cc" +#line 3103 "src/ast/lex.cc" yy524: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy522; @@ -3148,20 +3153,20 @@ yy525: } } yy526: -#line 549 "../src/ast/lex.re" +#line 573 "../src/ast/lex.re" { fatal_lc(l, c, "syntax error in escape sequence"); } -#line 3154 "src/ast/lex.cc" +#line 3159 "src/ast/lex.cc" yy527: ++YYCURSOR; yy528: -#line 565 "../src/ast/lex.re" +#line 589 "../src/ast/lex.re" { if (tok[1] != quote) { warn.useless_escape(cline, get_column(), tok[1]); } return static_cast(tok[1]); } -#line 3165 "src/ast/lex.cc" +#line 3170 "src/ast/lex.cc" yy529: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy522; @@ -3172,9 +3177,9 @@ yy530: if (yych <= '/') goto yy531; if (yych <= '7') goto yy553; yy531: -#line 548 "../src/ast/lex.re" +#line 572 "../src/ast/lex.re" { fatal_lc(l, c, "syntax error in octal escape sequence"); } -#line 3178 "src/ast/lex.cc" +#line 3183 "src/ast/lex.cc" yy532: ++YYCURSOR; goto yy531; @@ -3190,9 +3195,9 @@ yy533: if (yych <= 'f') goto yy555; } yy534: -#line 547 "../src/ast/lex.re" +#line 571 "../src/ast/lex.re" { fatal_lc(l, c, "syntax error in hexadecimal escape sequence"); } -#line 3196 "src/ast/lex.cc" +#line 3201 "src/ast/lex.cc" yy535: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -3208,44 +3213,44 @@ yy535: } yy536: ++YYCURSOR; -#line 564 "../src/ast/lex.re" +#line 588 "../src/ast/lex.re" { return static_cast('\\'); } -#line 3214 "src/ast/lex.cc" +#line 3219 "src/ast/lex.cc" yy538: ++YYCURSOR; -#line 557 "../src/ast/lex.re" +#line 581 "../src/ast/lex.re" { return static_cast('\a'); } -#line 3219 "src/ast/lex.cc" +#line 3224 "src/ast/lex.cc" yy540: ++YYCURSOR; -#line 558 "../src/ast/lex.re" +#line 582 "../src/ast/lex.re" { return static_cast('\b'); } -#line 3224 "src/ast/lex.cc" +#line 3229 "src/ast/lex.cc" yy542: ++YYCURSOR; -#line 559 "../src/ast/lex.re" +#line 583 "../src/ast/lex.re" { return static_cast('\f'); } -#line 3229 "src/ast/lex.cc" +#line 3234 "src/ast/lex.cc" yy544: ++YYCURSOR; -#line 560 "../src/ast/lex.re" +#line 584 "../src/ast/lex.re" { return static_cast('\n'); } -#line 3234 "src/ast/lex.cc" +#line 3239 "src/ast/lex.cc" yy546: ++YYCURSOR; -#line 561 "../src/ast/lex.re" +#line 585 "../src/ast/lex.re" { return static_cast('\r'); } -#line 3239 "src/ast/lex.cc" +#line 3244 "src/ast/lex.cc" yy548: ++YYCURSOR; -#line 562 "../src/ast/lex.re" +#line 586 "../src/ast/lex.re" { return static_cast('\t'); } -#line 3244 "src/ast/lex.cc" +#line 3249 "src/ast/lex.cc" yy550: ++YYCURSOR; -#line 563 "../src/ast/lex.re" +#line 587 "../src/ast/lex.re" { return static_cast('\v'); } -#line 3249 "src/ast/lex.cc" +#line 3254 "src/ast/lex.cc" yy552: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -3308,9 +3313,9 @@ yy557: } yy558: ++YYCURSOR; -#line 556 "../src/ast/lex.re" +#line 580 "../src/ast/lex.re" { return unesc_oct(tok, cur); } -#line 3314 "src/ast/lex.cc" +#line 3319 "src/ast/lex.cc" yy560: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { @@ -3337,9 +3342,9 @@ yy561: } yy562: ++YYCURSOR; -#line 555 "../src/ast/lex.re" +#line 579 "../src/ast/lex.re" { return unesc_hex(tok, cur); } -#line 3343 "src/ast/lex.cc" +#line 3348 "src/ast/lex.cc" yy564: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { @@ -3363,7 +3368,7 @@ yy565: goto yy554; } } -#line 571 "../src/ast/lex.re" +#line 595 "../src/ast/lex.re" } @@ -3383,7 +3388,7 @@ void Scanner::set_sourceline () sourceline: tok = cur; -#line 3387 "src/ast/lex.cc" +#line 3392 "src/ast/lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -3441,27 +3446,27 @@ sourceline: } } ++YYCURSOR; -#line 608 "../src/ast/lex.re" +#line 632 "../src/ast/lex.re" { --cur; tok = cur; return; } -#line 3451 "src/ast/lex.cc" +#line 3456 "src/ast/lex.cc" yy570: ++YYCURSOR; yy571: -#line 614 "../src/ast/lex.re" +#line 638 "../src/ast/lex.re" { goto sourceline; } -#line 3457 "src/ast/lex.cc" +#line 3462 "src/ast/lex.cc" yy572: ++YYCURSOR; -#line 603 "../src/ast/lex.re" +#line 627 "../src/ast/lex.re" { tok = cur; return; } -#line 3465 "src/ast/lex.cc" +#line 3470 "src/ast/lex.cc" yy574: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy572; @@ -3478,14 +3483,14 @@ yy576: if (yybm[0+yych] & 64) { goto yy576; } -#line 590 "../src/ast/lex.re" +#line 614 "../src/ast/lex.re" { if (!s_to_u32_unsafe (tok, cur, cline)) { fatal_lc(get_cline(), get_column(), "line number overflow"); } goto sourceline; } -#line 3489 "src/ast/lex.cc" +#line 3494 "src/ast/lex.cc" yy579: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -3502,13 +3507,13 @@ yy581: goto yy571; yy582: ++YYCURSOR; -#line 597 "../src/ast/lex.re" +#line 621 "../src/ast/lex.re" { in.escaped_file_name = std::string (tok + 1, tok_len () - 2); // strip quotes strrreplace (in.escaped_file_name, "\\", "\\\\"); goto sourceline; } -#line 3512 "src/ast/lex.cc" +#line 3517 "src/ast/lex.cc" yy584: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -3517,7 +3522,7 @@ yy584: if (yych == '\n') goto yy581; goto yy579; } -#line 615 "../src/ast/lex.re" +#line 639 "../src/ast/lex.re" } diff --git a/re2c/bootstrap/src/ast/lex.h b/re2c/bootstrap/src/ast/lex.h new file mode 100644 index 00000000..22e1a806 --- /dev/null +++ b/re2c/bootstrap/src/ast/lex.h @@ -0,0 +1,24 @@ +/* Generated by re2c 1.1.1 on Wed Nov 21 00:09:57 2018 */ + +namespace re2c { +struct ScannerState +{ + enum lexer_state_t {LEX_NORMAL, LEX_FLEX_NAME}; + lexer_state_t lexer_state; + + char *bot, *lim, *cur, *mar, *ctx, *eof, *tok, *top, *ptr, *pos; + char *yyt1; + + ptrdiff_t tchar; + uint32_t cline; + + inline ScannerState() + : lexer_state (LEX_NORMAL) + , bot(NULL), lim(NULL), cur(NULL), mar(NULL), ctx(NULL) + , eof(NULL), tok(NULL), top(NULL), ptr(NULL), pos(NULL) + , yyt1(NULL) + , tchar (0), cline (1) + {} + FORBID_COPY(ScannerState); +}; +} // namespace re2c diff --git a/re2c/src/ast/lex.re b/re2c/src/ast/lex.re index 74c3f727..af6068cf 100644 --- a/re2c/src/ast/lex.re +++ b/re2c/src/ast/lex.re @@ -24,16 +24,15 @@ extern YYSTYPE yylval; #define YYCURSOR cur #define YYLIMIT lim #define YYMARKER mar -#define YYCTXMARKER ctx #define YYFILL(n) { fill (n); } -namespace re2c -{ +namespace re2c { /*!re2c - // source code is in ASCII: pointers have type 'char *', but re2c makes - // assumes that YYCTYPE is unsigned when generating comparisons + // source code is in ASCII, but re2c assumes unsigned chars re2c:yych:conversion = 1; + re2c:flags:type-header = "src/ast/lex.h"; + re2c:flags:tags = 1; eof = "\000"; dstring = "\"" ([^\x00\n\\"] | "\\" [^\x00\n])* "\""; @@ -55,6 +54,31 @@ namespace re2c esc_simple = esc [abfnrtv\\]; */ +/*!header:re2c:on*/ +namespace re2c { +struct ScannerState +{ + enum lexer_state_t {LEX_NORMAL, LEX_FLEX_NAME}; + lexer_state_t lexer_state; + + char *bot, *lim, *cur, *mar, *ctx, *eof, *tok, *top, *ptr, *pos; + /*!stags:re2c format = "char *@@;"; */ + + ptrdiff_t tchar; + uint32_t cline; + + inline ScannerState() + : lexer_state (LEX_NORMAL) + , bot(NULL), lim(NULL), cur(NULL), mar(NULL), ctx(NULL) + , eof(NULL), tok(NULL), top(NULL), ptr(NULL), pos(NULL) + /*!stags:re2c format = ", @@(NULL)"; */ + , tchar (0), cline (1) + {} + FORBID_COPY(ScannerState); +}; +} // namespace re2c +/*!header:re2c:off*/ + Scanner::ParseMode Scanner::echo(Output &out) { if (eof && cur == eof) // Catch EOF @@ -208,6 +232,7 @@ void Scanner::lex_tags(Output &out, bool mtags) int Scanner::scan(const conopt_t *globopts) { + const char *p; scan: tchar = cur - pos; tok = cur; @@ -245,8 +270,7 @@ scan: return TOKEN_CLOSESIZE; } - "{" [0-9]+ "," [0-9]+ "}" { - const char * p = strchr (tok, ','); + "{" [0-9]+ @p "," [0-9]+ "}" { if (!s_to_u32_unsafe (tok + 1, p, yylval.bounds.min)) { fatal_lc(get_cline(), get_column(), "repetition lower bound overflow"); } diff --git a/re2c/src/ast/scanner.cc b/re2c/src/ast/scanner.cc index f643996a..0c1938da 100644 --- a/re2c/src/ast/scanner.cc +++ b/re2c/src/ast/scanner.cc @@ -15,22 +15,6 @@ class Warn; const uint32_t Scanner::BSIZE = 8192; -ScannerState::ScannerState () - : tok (NULL) - , ptr (NULL) - , cur (NULL) - , mar (NULL) - , pos (NULL) - , ctx (NULL) - , bot (NULL) - , lim (NULL) - , top (NULL) - , eof (NULL) - , tchar (0) - , cline (1) - , lexer_state (LEX_NORMAL) -{} - Scanner::Scanner(Input &i, Warn &w) : ScannerState(), in(i), warn(w) {} diff --git a/re2c/src/ast/scanner.h b/re2c/src/ast/scanner.h index 5fcbaa62..668f4e94 100644 --- a/re2c/src/ast/scanner.h +++ b/re2c/src/ast/scanner.h @@ -7,6 +7,7 @@ #include #include "src/ast/input.h" +#include "src/ast/lex.h" #include "src/conf/opt.h" #include "src/conf/warn.h" #include "src/re/encoding/enc.h" @@ -23,37 +24,6 @@ class Output; class Range; struct AST; -struct ScannerState -{ - enum lexer_state_t - { - LEX_NORMAL, - LEX_FLEX_NAME - }; - - // positioning - char * tok; - char * ptr; - char * cur; - char * mar; - char * pos; - char * ctx; - - // buffer - char * bot; - char * lim; - char * top; - char * eof; - - ptrdiff_t tchar; - uint32_t cline; - - lexer_state_t lexer_state; - - ScannerState(); - FORBID_COPY(ScannerState); -}; - class Scanner: private ScannerState { static const uint32_t BSIZE;