From: Ulya Trofimovich Date: Sun, 5 Mar 2017 11:51:30 +0000 (+0000) Subject: Merged small header with part of AST into big header with the whole AST. X-Git-Tag: 1.0~39^2~104 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=73f87e144e5a10ed5a447859cc0e9aa7065ad0b6;p=re2c Merged small header with part of AST into big header with the whole AST. --- diff --git a/re2c/Makefile.am b/re2c/Makefile.am index b9860b8b..3b491be8 100644 --- a/re2c/Makefile.am +++ b/re2c/Makefile.am @@ -48,7 +48,6 @@ SRC_HDR = \ src/skeleton/path.h \ src/skeleton/skeleton.h \ src/ast/ast.h \ - src/ast/extop.h \ src/ast/input.h \ src/ast/parser.h \ src/ast/rules.h \ diff --git a/re2c/bootstrap/src/ast/lex.cc b/re2c/bootstrap/src/ast/lex.cc index 9807588f..74192249 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 Sun Mar 5 11:37:40 2017 */ +/* Generated by re2c 0.16 on Sun Mar 5 11:49:42 2017 */ #line 1 "../src/ast/lex.re" #include "src/util/c99_stdint.h" #include @@ -9,7 +9,6 @@ #include "src/code/output.h" #include "src/re/encoding/enc.h" -#include "src/ast/extop.h" #include "src/ast/input.h" #include "src/ast/ast.h" #include "src/ast/scanner.h" @@ -34,10 +33,10 @@ namespace re2c // source code is in ASCII: pointers have type 'char *' // but re2c makes an implicit assumption that YYCTYPE is unsigned // when it generates comparisons -#line 37 "../src/ast/lex.re" +#line 36 "../src/ast/lex.re" -#line 58 "../src/ast/lex.re" +#line 57 "../src/ast/lex.re" Scanner::ParseMode Scanner::echo() @@ -52,7 +51,7 @@ echo: const char *start = cur; -#line 56 "src/ast/lex.cc" +#line 55 "src/ast/lex.cc" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -110,7 +109,7 @@ echo: } } ++YYCURSOR; -#line 148 "../src/ast/lex.re" +#line 147 "../src/ast/lex.re" { if (cur == eof) { if (opts->target == opt_t::CODE) { @@ -120,13 +119,13 @@ echo: } goto echo; } -#line 124 "src/ast/lex.cc" +#line 123 "src/ast/lex.cc" yy4: ++YYCURSOR; yy5: -#line 169 "../src/ast/lex.re" +#line 168 "../src/ast/lex.re" { goto echo; } -#line 130 "src/ast/lex.cc" +#line 129 "src/ast/lex.cc" yy6: yyaccept = 0; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -135,13 +134,13 @@ yy6: } if (yych == '#') goto yy14; yy7: -#line 163 "../src/ast/lex.re" +#line 162 "../src/ast/lex.re" { cline++; pos = cur; goto echo; } -#line 145 "src/ast/lex.cc" +#line 144 "src/ast/lex.cc" yy8: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy6; @@ -184,7 +183,7 @@ yy14: } yy16: ++YYCURSOR; -#line 72 "../src/ast/lex.re" +#line 71 "../src/ast/lex.re" { if (opts->rFlag) { fatal("found standard 're2c' block while using -r flag"); @@ -194,7 +193,7 @@ yy16: } return Parse; } -#line 198 "src/ast/lex.cc" +#line 197 "src/ast/lex.cc" yy18: yych = (YYCTYPE)*++YYCURSOR; if (yych == '!') goto yy20; @@ -422,12 +421,12 @@ yy64: yy66: ++YYCURSOR; YYCURSOR = YYCTXMARKER; -#line 158 "../src/ast/lex.re" +#line 157 "../src/ast/lex.re" { set_sourceline(); goto echo; } -#line 431 "src/ast/lex.cc" +#line 430 "src/ast/lex.cc" yy68: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy66; @@ -519,7 +518,7 @@ yy88: goto yy13; yy89: ++YYCURSOR; -#line 111 "../src/ast/lex.re" +#line 110 "../src/ast/lex.re" { if (opts->target == opt_t::CODE) { out.wraw(tok, start) @@ -528,7 +527,7 @@ yy89: lex_end_of_comment(); goto echo; } -#line 532 "src/ast/lex.cc" +#line 531 "src/ast/lex.cc" yy91: yych = (YYCTYPE)*++YYCURSOR; if (yych == '2') goto yy98; @@ -543,7 +542,7 @@ yy93: goto yy13; yy94: ++YYCURSOR; -#line 93 "../src/ast/lex.re" +#line 92 "../src/ast/lex.re" { if (!opts->rFlag) { fatal("found 'use:re2c' block without -r flag"); @@ -553,7 +552,7 @@ yy94: } return Reuse; } -#line 557 "src/ast/lex.cc" +#line 556 "src/ast/lex.cc" yy96: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy102; @@ -568,7 +567,7 @@ yy98: goto yy13; yy99: ++YYCURSOR; -#line 140 "../src/ast/lex.re" +#line 139 "../src/ast/lex.re" { if (opts->target == opt_t::CODE) { out.wraw(tok, start); @@ -576,7 +575,7 @@ yy99: lex_tags(); goto echo; } -#line 580 "src/ast/lex.cc" +#line 579 "src/ast/lex.cc" yy101: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'c') goto yy106; @@ -591,7 +590,7 @@ yy103: goto yy13; yy104: ++YYCURSOR; -#line 82 "../src/ast/lex.re" +#line 81 "../src/ast/lex.re" { if (!opts->rFlag) { fatal("found 'rules:re2c' block without -r flag"); @@ -602,10 +601,10 @@ yy104: opts.reset_mapCodeName (); return Rules; } -#line 606 "src/ast/lex.cc" +#line 605 "src/ast/lex.cc" yy106: ++YYCURSOR; -#line 129 "../src/ast/lex.re" +#line 128 "../src/ast/lex.re" { if (opts->target == opt_t::CODE) { out.wraw(tok, start) @@ -616,14 +615,14 @@ yy106: lex_end_of_comment(); goto echo; } -#line 620 "src/ast/lex.cc" +#line 619 "src/ast/lex.cc" yy108: yych = (YYCTYPE)*++YYCURSOR; if (yych == '2') goto yy111; goto yy13; yy109: ++YYCURSOR; -#line 103 "../src/ast/lex.re" +#line 102 "../src/ast/lex.re" { if (opts->target == opt_t::CODE) { out.wraw(tok, start); @@ -631,12 +630,12 @@ yy109: lex_end_of_comment(); goto echo; } -#line 635 "src/ast/lex.cc" +#line 634 "src/ast/lex.cc" yy111: yych = (YYCTYPE)*++YYCURSOR; if (yych != 'c') goto yy13; ++YYCURSOR; -#line 120 "../src/ast/lex.re" +#line 119 "../src/ast/lex.re" { if (opts->target == opt_t::CODE) { out.wraw(tok, start) @@ -645,9 +644,9 @@ yy111: lex_end_of_comment(); goto echo; } -#line 649 "src/ast/lex.cc" +#line 648 "src/ast/lex.cc" } -#line 170 "../src/ast/lex.re" +#line 169 "../src/ast/lex.re" } @@ -655,7 +654,7 @@ void Scanner::lex_end_of_comment() { uint32_t ignored = 0; for (;;) { -#line 659 "src/ast/lex.cc" +#line 658 "src/ast/lex.cc" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -671,20 +670,20 @@ void Scanner::lex_end_of_comment() } yy116: ++YYCURSOR; -#line 177 "../src/ast/lex.re" +#line 176 "../src/ast/lex.re" { fatal("expected end of block"); } -#line 677 "src/ast/lex.cc" +#line 676 "src/ast/lex.cc" yy118: ++YYCURSOR; yy119: -#line 179 "../src/ast/lex.re" +#line 178 "../src/ast/lex.re" { continue; } -#line 683 "src/ast/lex.cc" +#line 682 "src/ast/lex.cc" yy120: ++YYCURSOR; -#line 180 "../src/ast/lex.re" +#line 179 "../src/ast/lex.re" { ++ignored; continue; } -#line 688 "src/ast/lex.cc" +#line 687 "src/ast/lex.cc" yy122: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy120; @@ -693,7 +692,7 @@ yy123: yych = (YYCTYPE)*++YYCURSOR; if (yych != '/') goto yy119; ++YYCURSOR; -#line 181 "../src/ast/lex.re" +#line 180 "../src/ast/lex.re" { if (ignored > 0) { cline += ignored; @@ -702,9 +701,9 @@ yy123: tok = pos = cur; return; } -#line 706 "src/ast/lex.cc" +#line 705 "src/ast/lex.cc" } -#line 189 "../src/ast/lex.re" +#line 188 "../src/ast/lex.re" } } @@ -712,7 +711,7 @@ void Scanner::lex_tags() { std::string fmt, sep; for (;;) { -#line 716 "src/ast/lex.cc" +#line 715 "src/ast/lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -770,9 +769,9 @@ void Scanner::lex_tags() } ++YYCURSOR; yy129: -#line 196 "../src/ast/lex.re" +#line 195 "../src/ast/lex.re" { fatal("unrecognized configuration"); } -#line 776 "src/ast/lex.cc" +#line 775 "src/ast/lex.cc" yy130: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -780,14 +779,14 @@ yy130: if (yybm[0+yych] & 128) { goto yy130; } -#line 201 "../src/ast/lex.re" +#line 200 "../src/ast/lex.re" { continue; } -#line 786 "src/ast/lex.cc" +#line 785 "src/ast/lex.cc" yy133: ++YYCURSOR; -#line 202 "../src/ast/lex.re" +#line 201 "../src/ast/lex.re" { ++cline; continue; } -#line 791 "src/ast/lex.cc" +#line 790 "src/ast/lex.cc" yy135: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy133; @@ -806,7 +805,7 @@ yy138: goto yy129; yy139: ++YYCURSOR; -#line 203 "../src/ast/lex.re" +#line 202 "../src/ast/lex.re" { if (opts->target == opt_t::CODE) { out.wdelay_tags(opts->topIndent, @@ -815,7 +814,7 @@ yy139: tok = pos = cur; return; } -#line 819 "src/ast/lex.cc" +#line 818 "src/ast/lex.cc" yy141: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy144; @@ -852,9 +851,9 @@ yy149: goto yy142; yy150: ++YYCURSOR; -#line 198 "../src/ast/lex.re" +#line 197 "../src/ast/lex.re" { fmt = lex_conf_string(); continue; } -#line 858 "src/ast/lex.cc" +#line 857 "src/ast/lex.cc" yy152: yych = (YYCTYPE)*++YYCURSOR; if (yych != 't') goto yy142; @@ -863,11 +862,11 @@ yy152: yych = (YYCTYPE)*++YYCURSOR; if (yych != 'r') goto yy142; ++YYCURSOR; -#line 199 "../src/ast/lex.re" +#line 198 "../src/ast/lex.re" { sep = lex_conf_string(); continue; } -#line 869 "src/ast/lex.cc" +#line 868 "src/ast/lex.cc" } -#line 211 "../src/ast/lex.re" +#line 210 "../src/ast/lex.re" } } @@ -885,7 +884,7 @@ scan: start: -#line 889 "src/ast/lex.cc" +#line 888 "src/ast/lex.cc" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -982,12 +981,12 @@ start: yy159: ++YYCURSOR; yy160: -#line 379 "../src/ast/lex.re" +#line 378 "../src/ast/lex.re" { fatalf("unexpected character: '%c'", *tok); goto scan; } -#line 991 "src/ast/lex.cc" +#line 990 "src/ast/lex.cc" yy161: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -995,11 +994,11 @@ yy161: if (yybm[0+yych] & 16) { goto yy161; } -#line 363 "../src/ast/lex.re" +#line 362 "../src/ast/lex.re" { goto scan; } -#line 1003 "src/ast/lex.cc" +#line 1002 "src/ast/lex.cc" yy164: yyaccept = 0; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -1010,14 +1009,14 @@ yy164: if (yych == '#') goto yy190; } yy165: -#line 372 "../src/ast/lex.re" +#line 371 "../src/ast/lex.re" { if (cur == eof) return 0; pos = cur; cline++; goto scan; } -#line 1021 "src/ast/lex.cc" +#line 1020 "src/ast/lex.cc" yy166: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy164; @@ -1025,35 +1024,35 @@ yy166: yy167: ++YYCURSOR; yy168: -#line 273 "../src/ast/lex.re" +#line 272 "../src/ast/lex.re" { return *tok; } -#line 1031 "src/ast/lex.cc" +#line 1030 "src/ast/lex.cc" yy169: ++YYCURSOR; -#line 260 "../src/ast/lex.re" +#line 259 "../src/ast/lex.re" { yylval.regexp = lex_str('"', opts->bCaseInsensitive || opts->bCaseInverted); return TOKEN_REGEXP; } -#line 1036 "src/ast/lex.cc" +#line 1035 "src/ast/lex.cc" yy171: yych = (YYCTYPE)*++YYCURSOR; if (yych == '}') goto yy192; goto yy160; yy172: ++YYCURSOR; -#line 259 "../src/ast/lex.re" +#line 258 "../src/ast/lex.re" { yylval.regexp = lex_str('\'', opts->bCaseInsensitive || !opts->bCaseInverted); return TOKEN_REGEXP; } -#line 1045 "src/ast/lex.cc" +#line 1044 "src/ast/lex.cc" yy174: yych = (YYCTYPE)*++YYCURSOR; if (yych == '/') goto yy192; goto yy168; yy175: ++YYCURSOR; -#line 358 "../src/ast/lex.re" +#line 357 "../src/ast/lex.re" { yylval.regexp = ast_dot(cline, get_column()); return TOKEN_REGEXP; } -#line 1057 "src/ast/lex.cc" +#line 1056 "src/ast/lex.cc" yy177: yych = (YYCTYPE)*++YYCURSOR; if (yych == '*') goto yy194; @@ -1113,9 +1112,9 @@ yy181: yy182: yych = (YYCTYPE)*++YYCURSOR; if (yych == '^') goto yy209; -#line 261 "../src/ast/lex.re" +#line 260 "../src/ast/lex.re" { yylval.regexp = lex_cls(false); return TOKEN_REGEXP; } -#line 1119 "src/ast/lex.cc" +#line 1118 "src/ast/lex.cc" yy184: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy211; @@ -1138,13 +1137,13 @@ yy185: } } yy186: -#line 228 "../src/ast/lex.re" +#line 227 "../src/ast/lex.re" { depth = 1; code_line = cline; goto code; } -#line 1148 "src/ast/lex.cc" +#line 1147 "src/ast/lex.cc" yy187: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -1180,31 +1179,31 @@ yy190: } yy192: ++YYCURSOR; -#line 254 "../src/ast/lex.re" +#line 253 "../src/ast/lex.re" { tok = cur; return 0; } -#line 1189 "src/ast/lex.cc" +#line 1188 "src/ast/lex.cc" yy194: ++YYCURSOR; -#line 248 "../src/ast/lex.re" +#line 247 "../src/ast/lex.re" { depth = 1; goto comment; } -#line 1197 "src/ast/lex.cc" +#line 1196 "src/ast/lex.cc" yy196: ++YYCURSOR; -#line 245 "../src/ast/lex.re" +#line 244 "../src/ast/lex.re" { goto nextLine; } -#line 1204 "src/ast/lex.cc" +#line 1203 "src/ast/lex.cc" yy198: ++YYCURSOR; YYCURSOR -= 1; -#line 338 "../src/ast/lex.re" +#line 337 "../src/ast/lex.re" { if (!opts->FFlag) { yylval.str = new std::string (tok, tok_len()); @@ -1224,7 +1223,7 @@ yy198: return TOKEN_REGEXP; } } -#line 1228 "src/ast/lex.cc" +#line 1227 "src/ast/lex.cc" yy200: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -1244,23 +1243,23 @@ yy200: yy202: ++YYCURSOR; YYCURSOR = YYCTXMARKER; -#line 333 "../src/ast/lex.re" +#line 332 "../src/ast/lex.re" { yylval.str = new std::string (tok, tok_len ()); return TOKEN_ID; } -#line 1253 "src/ast/lex.cc" +#line 1252 "src/ast/lex.cc" yy204: yych = (YYCTYPE)*++YYCURSOR; if (yych == '>') goto yy221; -#line 238 "../src/ast/lex.re" +#line 237 "../src/ast/lex.re" { tok += 2; /* skip ":=" */ depth = 0; code_line = cline; goto code; } -#line 1264 "src/ast/lex.cc" +#line 1263 "src/ast/lex.cc" yy206: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -1278,7 +1277,7 @@ yy206: } } yy208: -#line 264 "../src/ast/lex.re" +#line 263 "../src/ast/lex.re" { if (!opts->tags) { fatal("tags are only allowed with '-T, --tags' option"); @@ -1287,12 +1286,12 @@ yy208: yylval.regexp = ast_tag(cline, get_column(), name); return TOKEN_REGEXP; } -#line 1291 "src/ast/lex.cc" +#line 1290 "src/ast/lex.cc" yy209: ++YYCURSOR; -#line 262 "../src/ast/lex.re" +#line 261 "../src/ast/lex.re" { yylval.regexp = lex_cls(true); return TOKEN_REGEXP; } -#line 1296 "src/ast/lex.cc" +#line 1295 "src/ast/lex.cc" yy211: yych = (YYCTYPE)*++YYCURSOR; if (yych == '2') goto yy223; @@ -1300,11 +1299,11 @@ yy211: yy212: ++YYCURSOR; yy213: -#line 306 "../src/ast/lex.re" +#line 305 "../src/ast/lex.re" { fatal("illegal closure form, use '{n}', '{n,}', '{n,m}' where n and m are numbers"); } -#line 1308 "src/ast/lex.cc" +#line 1307 "src/ast/lex.cc" yy214: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -1357,7 +1356,7 @@ yy218: yy219: ++YYCURSOR; YYCURSOR = YYCTXMARKER; -#line 320 "../src/ast/lex.re" +#line 319 "../src/ast/lex.re" { yylval.str = new std::string (tok, tok_len ()); if (opts->FFlag) @@ -1370,15 +1369,15 @@ yy219: return TOKEN_ID; } } -#line 1374 "src/ast/lex.cc" +#line 1373 "src/ast/lex.cc" yy221: ++YYCURSOR; YYCURSOR -= 2; -#line 234 "../src/ast/lex.re" +#line 233 "../src/ast/lex.re" { return *tok; } -#line 1382 "src/ast/lex.cc" +#line 1381 "src/ast/lex.cc" yy223: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'c') goto yy230; @@ -1392,19 +1391,19 @@ yy224: goto yy213; yy225: ++YYCURSOR; -#line 275 "../src/ast/lex.re" +#line 274 "../src/ast/lex.re" { - if (!s_to_u32_unsafe (tok + 1, cur - 1, yylval.extop.min)) + if (!s_to_u32_unsafe (tok + 1, cur - 1, yylval.bounds.min)) { fatal ("repetition count overflow"); } - yylval.extop.max = yylval.extop.min; + yylval.bounds.max = yylval.bounds.min; return TOKEN_CLOSESIZE; } -#line 1405 "src/ast/lex.cc" +#line 1404 "src/ast/lex.cc" yy227: ++YYCURSOR; -#line 310 "../src/ast/lex.re" +#line 309 "../src/ast/lex.re" { if (!opts->FFlag) { fatal("curly braces for names only allowed with -F switch"); @@ -1412,7 +1411,7 @@ yy227: yylval.str = new std::string (tok + 1, tok_len () - 2); // -2 to omit braces return TOKEN_ID; } -#line 1416 "src/ast/lex.cc" +#line 1415 "src/ast/lex.cc" yy229: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'n') goto yy235; @@ -1431,41 +1430,41 @@ yy231: goto yy189; yy233: ++YYCURSOR; -#line 297 "../src/ast/lex.re" +#line 296 "../src/ast/lex.re" { - if (!s_to_u32_unsafe (tok + 1, cur - 2, yylval.extop.min)) + if (!s_to_u32_unsafe (tok + 1, cur - 2, yylval.bounds.min)) { fatal ("repetition lower bound overflow"); } - yylval.extop.max = std::numeric_limits::max(); + yylval.bounds.max = std::numeric_limits::max(); return TOKEN_CLOSESIZE; } -#line 1444 "src/ast/lex.cc" +#line 1443 "src/ast/lex.cc" yy235: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy240; goto yy189; yy236: ++YYCURSOR; -#line 318 "../src/ast/lex.re" +#line 317 "../src/ast/lex.re" { lex_conf (); return TOKEN_CONF; } -#line 1453 "src/ast/lex.cc" +#line 1452 "src/ast/lex.cc" yy238: ++YYCURSOR; -#line 284 "../src/ast/lex.re" +#line 283 "../src/ast/lex.re" { const char * p = strchr (tok, ','); - if (!s_to_u32_unsafe (tok + 1, p, yylval.extop.min)) + if (!s_to_u32_unsafe (tok + 1, p, yylval.bounds.min)) { fatal ("repetition lower bound overflow"); } - if (!s_to_u32_unsafe (p + 1, cur - 1, yylval.extop.max)) + if (!s_to_u32_unsafe (p + 1, cur - 1, yylval.bounds.max)) { fatal ("repetition upper bound overflow"); } return TOKEN_CLOSESIZE; } -#line 1469 "src/ast/lex.cc" +#line 1468 "src/ast/lex.cc" yy240: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '0') goto yy242; @@ -1521,12 +1520,12 @@ yy245: yy247: ++YYCURSOR; YYCURSOR = YYCTXMARKER; -#line 367 "../src/ast/lex.re" +#line 366 "../src/ast/lex.re" { set_sourceline (); goto scan; } -#line 1530 "src/ast/lex.cc" +#line 1529 "src/ast/lex.cc" yy249: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy247; @@ -1551,12 +1550,12 @@ yy253: if (yych == '\n') goto yy189; goto yy250; } -#line 383 "../src/ast/lex.re" +#line 382 "../src/ast/lex.re" flex_name: -#line 1560 "src/ast/lex.cc" +#line 1559 "src/ast/lex.cc" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -1565,32 +1564,32 @@ flex_name: if (yych == '\r') goto yy260; ++YYCURSOR; yy257: -#line 394 "../src/ast/lex.re" +#line 393 "../src/ast/lex.re" { YYCURSOR = tok; goto start; } -#line 1574 "src/ast/lex.cc" +#line 1573 "src/ast/lex.cc" yy258: ++YYCURSOR; -#line 388 "../src/ast/lex.re" +#line 387 "../src/ast/lex.re" { YYCURSOR = tok; lexer_state = LEX_NORMAL; return TOKEN_FID_END; } -#line 1583 "src/ast/lex.cc" +#line 1582 "src/ast/lex.cc" yy260: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy258; goto yy257; } -#line 398 "../src/ast/lex.re" +#line 397 "../src/ast/lex.re" code: -#line 1594 "src/ast/lex.cc" +#line 1593 "src/ast/lex.cc" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -1651,7 +1650,7 @@ code: } yy263: ++YYCURSOR; -#line 461 "../src/ast/lex.re" +#line 460 "../src/ast/lex.re" { if (cur == eof) { @@ -1663,15 +1662,15 @@ yy263: } goto code; } -#line 1667 "src/ast/lex.cc" +#line 1666 "src/ast/lex.cc" yy265: ++YYCURSOR; yy266: -#line 475 "../src/ast/lex.re" +#line 474 "../src/ast/lex.re" { goto code; } -#line 1675 "src/ast/lex.cc" +#line 1674 "src/ast/lex.cc" yy267: yyaccept = 0; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -1690,7 +1689,7 @@ yy267: } } yy268: -#line 442 "../src/ast/lex.re" +#line 441 "../src/ast/lex.re" { if (depth == 0) { @@ -1710,7 +1709,7 @@ yy268: cline++; goto code; } -#line 1714 "src/ast/lex.cc" +#line 1713 "src/ast/lex.cc" yy269: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -1723,7 +1722,7 @@ yy270: goto yy287; yy271: ++YYCURSOR; -#line 414 "../src/ast/lex.re" +#line 413 "../src/ast/lex.re" { if (depth == 0) { @@ -1735,10 +1734,10 @@ yy271: } goto code; } -#line 1739 "src/ast/lex.cc" +#line 1738 "src/ast/lex.cc" yy273: ++YYCURSOR; -#line 402 "../src/ast/lex.re" +#line 401 "../src/ast/lex.re" { if (depth == 0) { @@ -1751,7 +1750,7 @@ yy273: } goto code; } -#line 1755 "src/ast/lex.cc" +#line 1754 "src/ast/lex.cc" yy275: yyaccept = 2; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -1763,7 +1762,7 @@ yy275: } yy276: YYCURSOR -= 1; -#line 429 "../src/ast/lex.re" +#line 428 "../src/ast/lex.re" { if (depth == 0) { @@ -1777,7 +1776,7 @@ yy276: cline++; goto code; } -#line 1781 "src/ast/lex.cc" +#line 1780 "src/ast/lex.cc" yy277: ++YYCURSOR; goto yy276; @@ -1812,11 +1811,11 @@ yy282: if (yych >= '#') goto yy285; yy283: ++YYCURSOR; -#line 472 "../src/ast/lex.re" +#line 471 "../src/ast/lex.re" { goto code; } -#line 1820 "src/ast/lex.cc" +#line 1819 "src/ast/lex.cc" yy285: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -1906,12 +1905,12 @@ yy299: yy301: ++YYCURSOR; YYCURSOR = YYCTXMARKER; -#line 425 "../src/ast/lex.re" +#line 424 "../src/ast/lex.re" { set_sourceline (); goto code; } -#line 1915 "src/ast/lex.cc" +#line 1914 "src/ast/lex.cc" yy303: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy301; @@ -1940,12 +1939,12 @@ yy307: if (yych == '\n') goto yy280; goto yy304; } -#line 478 "../src/ast/lex.re" +#line 477 "../src/ast/lex.re" comment: -#line 1949 "src/ast/lex.cc" +#line 1948 "src/ast/lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -1992,7 +1991,7 @@ comment: } ++YYCURSOR; yy311: -#line 510 "../src/ast/lex.re" +#line 509 "../src/ast/lex.re" { if (cur == eof) { @@ -2000,7 +1999,7 @@ yy311: } goto comment; } -#line 2004 "src/ast/lex.cc" +#line 2003 "src/ast/lex.cc" yy312: yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yybm[0+yych] & 32) { @@ -2008,7 +2007,7 @@ yy312: } if (yych == '#') goto yy319; yy313: -#line 501 "../src/ast/lex.re" +#line 500 "../src/ast/lex.re" { if (cur == eof) { @@ -2018,7 +2017,7 @@ yy313: cline++; goto comment; } -#line 2022 "src/ast/lex.cc" +#line 2021 "src/ast/lex.cc" yy314: yych = (YYCTYPE)*++YYCURSOR; if (yych == '/') goto yy321; @@ -2052,7 +2051,7 @@ yy319: } yy321: ++YYCURSOR; -#line 482 "../src/ast/lex.re" +#line 481 "../src/ast/lex.re" { if (--depth == 0) { @@ -2063,16 +2062,16 @@ yy321: goto comment; } } -#line 2067 "src/ast/lex.cc" +#line 2066 "src/ast/lex.cc" yy323: ++YYCURSOR; -#line 492 "../src/ast/lex.re" +#line 491 "../src/ast/lex.re" { ++depth; fatal("ambiguous /* found"); goto comment; } -#line 2076 "src/ast/lex.cc" +#line 2075 "src/ast/lex.cc" yy325: yych = (YYCTYPE)*++YYCURSOR; if (yych != 'i') goto yy318; @@ -2129,12 +2128,12 @@ yy333: yy335: ++YYCURSOR; YYCURSOR = YYCTXMARKER; -#line 497 "../src/ast/lex.re" +#line 496 "../src/ast/lex.re" { set_sourceline (); goto comment; } -#line 2138 "src/ast/lex.cc" +#line 2137 "src/ast/lex.cc" yy337: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy335; @@ -2159,28 +2158,28 @@ yy341: if (yych == '\n') goto yy318; goto yy338; } -#line 517 "../src/ast/lex.re" +#line 516 "../src/ast/lex.re" nextLine: -#line 2168 "src/ast/lex.cc" +#line 2167 "src/ast/lex.cc" { YYCTYPE yych; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yych == '\n') goto yy346; ++YYCURSOR; -#line 528 "../src/ast/lex.re" +#line 527 "../src/ast/lex.re" { if(cur == eof) { return 0; } goto nextLine; } -#line 2181 "src/ast/lex.cc" +#line 2180 "src/ast/lex.cc" yy346: ++YYCURSOR; -#line 521 "../src/ast/lex.re" +#line 520 "../src/ast/lex.re" { if(cur == eof) { return 0; } @@ -2188,9 +2187,9 @@ yy346: cline++; goto scan; } -#line 2192 "src/ast/lex.cc" +#line 2191 "src/ast/lex.cc" } -#line 533 "../src/ast/lex.re" +#line 532 "../src/ast/lex.re" } @@ -2215,35 +2214,35 @@ const AST *Scanner::lex_cls(bool neg) uint32_t u, l; fst: -#line 2219 "src/ast/lex.cc" +#line 2218 "src/ast/lex.cc" { YYCTYPE yych; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yych == ']') goto yy351; -#line 558 "../src/ast/lex.re" +#line 557 "../src/ast/lex.re" { l = lex_cls_chr(); goto snd; } -#line 2227 "src/ast/lex.cc" +#line 2226 "src/ast/lex.cc" yy351: ++YYCURSOR; -#line 557 "../src/ast/lex.re" +#line 556 "../src/ast/lex.re" { goto end; } -#line 2232 "src/ast/lex.cc" +#line 2231 "src/ast/lex.cc" } -#line 559 "../src/ast/lex.re" +#line 558 "../src/ast/lex.re" snd: -#line 2238 "src/ast/lex.cc" +#line 2237 "src/ast/lex.cc" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = (YYCTYPE)*(YYMARKER = YYCURSOR); if (yych == '-') goto yy356; yy355: -#line 562 "../src/ast/lex.re" +#line 561 "../src/ast/lex.re" { u = l; goto add; } -#line 2247 "src/ast/lex.cc" +#line 2246 "src/ast/lex.cc" yy356: yych = (YYCTYPE)*++YYCURSOR; if (yych != ']') goto yy358; @@ -2252,7 +2251,7 @@ yy356: yy358: ++YYCURSOR; YYCURSOR -= 1; -#line 563 "../src/ast/lex.re" +#line 562 "../src/ast/lex.re" { u = lex_cls_chr(); if (l > u) { @@ -2261,9 +2260,9 @@ yy358: } goto add; } -#line 2265 "src/ast/lex.cc" +#line 2264 "src/ast/lex.cc" } -#line 571 "../src/ast/lex.re" +#line 570 "../src/ast/lex.re" add: if (!(s = opts->encoding.encodeRange(l, u))) { @@ -2282,7 +2281,7 @@ uint32_t Scanner::lex_cls_chr() { tok = cur; -#line 2286 "src/ast/lex.cc" +#line 2285 "src/ast/lex.cc" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -2291,14 +2290,14 @@ uint32_t Scanner::lex_cls_chr() if (yych == '\n') goto yy364; if (yych == '\\') goto yy366; ++YYCURSOR; -#line 594 "../src/ast/lex.re" +#line 593 "../src/ast/lex.re" { return static_cast(tok[0]); } -#line 2297 "src/ast/lex.cc" +#line 2296 "src/ast/lex.cc" yy364: ++YYCURSOR; -#line 589 "../src/ast/lex.re" +#line 588 "../src/ast/lex.re" { fatal (get_column() - tchar, "syntax error"); } -#line 2302 "src/ast/lex.cc" +#line 2301 "src/ast/lex.cc" yy366: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '`') { @@ -2347,31 +2346,31 @@ yy366: } } } -#line 592 "../src/ast/lex.re" +#line 591 "../src/ast/lex.re" { fatal (get_column() - tchar, "syntax error in escape sequence"); } -#line 2353 "src/ast/lex.cc" +#line 2352 "src/ast/lex.cc" yy368: ++YYCURSOR; -#line 607 "../src/ast/lex.re" +#line 606 "../src/ast/lex.re" { warn.useless_escape(cline, get_column(), tok[1]); return static_cast(tok[1]); } -#line 2361 "src/ast/lex.cc" +#line 2360 "src/ast/lex.cc" yy370: ++YYCURSOR; -#line 605 "../src/ast/lex.re" +#line 604 "../src/ast/lex.re" { return static_cast('-'); } -#line 2366 "src/ast/lex.cc" +#line 2365 "src/ast/lex.cc" yy372: yyaccept = 0; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '/') goto yy373; if (yych <= '7') goto yy397; yy373: -#line 591 "../src/ast/lex.re" +#line 590 "../src/ast/lex.re" { fatal (get_column() - tchar, "syntax error in octal escape sequence"); } -#line 2375 "src/ast/lex.cc" +#line 2374 "src/ast/lex.cc" yy374: ++YYCURSOR; goto yy373; @@ -2387,9 +2386,9 @@ yy375: if (yych <= 'f') goto yy399; } yy376: -#line 590 "../src/ast/lex.re" +#line 589 "../src/ast/lex.re" { fatal (get_column() - tchar, "syntax error in hexadecimal escape sequence"); } -#line 2393 "src/ast/lex.cc" +#line 2392 "src/ast/lex.cc" yy377: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -2405,49 +2404,49 @@ yy377: } yy378: ++YYCURSOR; -#line 604 "../src/ast/lex.re" +#line 603 "../src/ast/lex.re" { return static_cast('\\'); } -#line 2411 "src/ast/lex.cc" +#line 2410 "src/ast/lex.cc" yy380: ++YYCURSOR; -#line 606 "../src/ast/lex.re" +#line 605 "../src/ast/lex.re" { return static_cast(']'); } -#line 2416 "src/ast/lex.cc" +#line 2415 "src/ast/lex.cc" yy382: ++YYCURSOR; -#line 597 "../src/ast/lex.re" +#line 596 "../src/ast/lex.re" { return static_cast('\a'); } -#line 2421 "src/ast/lex.cc" +#line 2420 "src/ast/lex.cc" yy384: ++YYCURSOR; -#line 598 "../src/ast/lex.re" +#line 597 "../src/ast/lex.re" { return static_cast('\b'); } -#line 2426 "src/ast/lex.cc" +#line 2425 "src/ast/lex.cc" yy386: ++YYCURSOR; -#line 599 "../src/ast/lex.re" +#line 598 "../src/ast/lex.re" { return static_cast('\f'); } -#line 2431 "src/ast/lex.cc" +#line 2430 "src/ast/lex.cc" yy388: ++YYCURSOR; -#line 600 "../src/ast/lex.re" +#line 599 "../src/ast/lex.re" { return static_cast('\n'); } -#line 2436 "src/ast/lex.cc" +#line 2435 "src/ast/lex.cc" yy390: ++YYCURSOR; -#line 601 "../src/ast/lex.re" +#line 600 "../src/ast/lex.re" { return static_cast('\r'); } -#line 2441 "src/ast/lex.cc" +#line 2440 "src/ast/lex.cc" yy392: ++YYCURSOR; -#line 602 "../src/ast/lex.re" +#line 601 "../src/ast/lex.re" { return static_cast('\t'); } -#line 2446 "src/ast/lex.cc" +#line 2445 "src/ast/lex.cc" yy394: ++YYCURSOR; -#line 603 "../src/ast/lex.re" +#line 602 "../src/ast/lex.re" { return static_cast('\v'); } -#line 2451 "src/ast/lex.cc" +#line 2450 "src/ast/lex.cc" yy396: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -2510,9 +2509,9 @@ yy401: } yy402: ++YYCURSOR; -#line 596 "../src/ast/lex.re" +#line 595 "../src/ast/lex.re" { return unesc_oct(tok, cur); } -#line 2516 "src/ast/lex.cc" +#line 2515 "src/ast/lex.cc" yy404: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { @@ -2539,9 +2538,9 @@ yy405: } yy406: ++YYCURSOR; -#line 595 "../src/ast/lex.re" +#line 594 "../src/ast/lex.re" { return unesc_hex(tok, cur); } -#line 2545 "src/ast/lex.cc" +#line 2544 "src/ast/lex.cc" yy408: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { @@ -2565,7 +2564,7 @@ yy409: goto yy398; } } -#line 611 "../src/ast/lex.re" +#line 610 "../src/ast/lex.re" } @@ -2574,7 +2573,7 @@ uint32_t Scanner::lex_str_chr(char quote, bool &end) end = false; tok = cur; -#line 2578 "src/ast/lex.cc" +#line 2577 "src/ast/lex.cc" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -2583,17 +2582,17 @@ uint32_t Scanner::lex_str_chr(char quote, bool &end) if (yych == '\n') goto yy414; if (yych == '\\') goto yy416; ++YYCURSOR; -#line 624 "../src/ast/lex.re" +#line 623 "../src/ast/lex.re" { end = tok[0] == quote; return static_cast(tok[0]); } -#line 2592 "src/ast/lex.cc" +#line 2591 "src/ast/lex.cc" yy414: ++YYCURSOR; -#line 619 "../src/ast/lex.re" +#line 618 "../src/ast/lex.re" { fatal (get_column() - tchar, "syntax error"); } -#line 2597 "src/ast/lex.cc" +#line 2596 "src/ast/lex.cc" yy416: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 'a') { @@ -2639,28 +2638,28 @@ yy416: } } } -#line 622 "../src/ast/lex.re" +#line 621 "../src/ast/lex.re" { fatal (get_column() - tchar, "syntax error in escape sequence"); } -#line 2645 "src/ast/lex.cc" +#line 2644 "src/ast/lex.cc" yy418: ++YYCURSOR; -#line 638 "../src/ast/lex.re" +#line 637 "../src/ast/lex.re" { if (tok[1] != quote) { warn.useless_escape(cline, get_column(), tok[1]); } return static_cast(tok[1]); } -#line 2655 "src/ast/lex.cc" +#line 2654 "src/ast/lex.cc" yy420: yyaccept = 0; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '/') goto yy421; if (yych <= '7') goto yy443; yy421: -#line 621 "../src/ast/lex.re" +#line 620 "../src/ast/lex.re" { fatal (get_column() - tchar, "syntax error in octal escape sequence"); } -#line 2664 "src/ast/lex.cc" +#line 2663 "src/ast/lex.cc" yy422: ++YYCURSOR; goto yy421; @@ -2676,9 +2675,9 @@ yy423: if (yych <= 'f') goto yy445; } yy424: -#line 620 "../src/ast/lex.re" +#line 619 "../src/ast/lex.re" { fatal (get_column() - tchar, "syntax error in hexadecimal escape sequence"); } -#line 2682 "src/ast/lex.cc" +#line 2681 "src/ast/lex.cc" yy425: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -2694,44 +2693,44 @@ yy425: } yy426: ++YYCURSOR; -#line 637 "../src/ast/lex.re" +#line 636 "../src/ast/lex.re" { return static_cast('\\'); } -#line 2700 "src/ast/lex.cc" +#line 2699 "src/ast/lex.cc" yy428: ++YYCURSOR; -#line 630 "../src/ast/lex.re" +#line 629 "../src/ast/lex.re" { return static_cast('\a'); } -#line 2705 "src/ast/lex.cc" +#line 2704 "src/ast/lex.cc" yy430: ++YYCURSOR; -#line 631 "../src/ast/lex.re" +#line 630 "../src/ast/lex.re" { return static_cast('\b'); } -#line 2710 "src/ast/lex.cc" +#line 2709 "src/ast/lex.cc" yy432: ++YYCURSOR; -#line 632 "../src/ast/lex.re" +#line 631 "../src/ast/lex.re" { return static_cast('\f'); } -#line 2715 "src/ast/lex.cc" +#line 2714 "src/ast/lex.cc" yy434: ++YYCURSOR; -#line 633 "../src/ast/lex.re" +#line 632 "../src/ast/lex.re" { return static_cast('\n'); } -#line 2720 "src/ast/lex.cc" +#line 2719 "src/ast/lex.cc" yy436: ++YYCURSOR; -#line 634 "../src/ast/lex.re" +#line 633 "../src/ast/lex.re" { return static_cast('\r'); } -#line 2725 "src/ast/lex.cc" +#line 2724 "src/ast/lex.cc" yy438: ++YYCURSOR; -#line 635 "../src/ast/lex.re" +#line 634 "../src/ast/lex.re" { return static_cast('\t'); } -#line 2730 "src/ast/lex.cc" +#line 2729 "src/ast/lex.cc" yy440: ++YYCURSOR; -#line 636 "../src/ast/lex.re" +#line 635 "../src/ast/lex.re" { return static_cast('\v'); } -#line 2735 "src/ast/lex.cc" +#line 2734 "src/ast/lex.cc" yy442: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -2794,9 +2793,9 @@ yy447: } yy448: ++YYCURSOR; -#line 629 "../src/ast/lex.re" +#line 628 "../src/ast/lex.re" { return unesc_oct(tok, cur); } -#line 2800 "src/ast/lex.cc" +#line 2799 "src/ast/lex.cc" yy450: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { @@ -2823,9 +2822,9 @@ yy451: } yy452: ++YYCURSOR; -#line 628 "../src/ast/lex.re" +#line 627 "../src/ast/lex.re" { return unesc_hex(tok, cur); } -#line 2829 "src/ast/lex.cc" +#line 2828 "src/ast/lex.cc" yy454: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { @@ -2849,7 +2848,7 @@ yy455: goto yy444; } } -#line 644 "../src/ast/lex.re" +#line 643 "../src/ast/lex.re" } @@ -2872,7 +2871,7 @@ void Scanner::set_sourceline () sourceline: tok = cur; -#line 2876 "src/ast/lex.cc" +#line 2875 "src/ast/lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -2921,14 +2920,14 @@ sourceline: yy458: ++YYCURSOR; yy459: -#line 689 "../src/ast/lex.re" +#line 688 "../src/ast/lex.re" { goto sourceline; } -#line 2929 "src/ast/lex.cc" +#line 2928 "src/ast/lex.cc" yy460: ++YYCURSOR; -#line 677 "../src/ast/lex.re" +#line 676 "../src/ast/lex.re" { if (cur == eof) { @@ -2941,7 +2940,7 @@ yy460: tok = cur; return; } -#line 2945 "src/ast/lex.cc" +#line 2944 "src/ast/lex.cc" yy462: yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych == '\n') goto yy459; @@ -2953,7 +2952,7 @@ yy463: if (yybm[0+yych] & 64) { goto yy463; } -#line 666 "../src/ast/lex.re" +#line 665 "../src/ast/lex.re" { if (!s_to_u32_unsafe (tok, cur, cline)) { @@ -2961,7 +2960,7 @@ yy463: } goto sourceline; } -#line 2965 "src/ast/lex.cc" +#line 2964 "src/ast/lex.cc" yy466: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -2978,12 +2977,12 @@ yy468: goto yy459; yy469: ++YYCURSOR; -#line 673 "../src/ast/lex.re" +#line 672 "../src/ast/lex.re" { escape (in.file_name, std::string (tok + 1, tok_len () - 2)); // -2 to omit quotes goto sourceline; } -#line 2987 "src/ast/lex.cc" +#line 2986 "src/ast/lex.cc" yy471: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -2991,7 +2990,7 @@ yy471: if (yych == '\n') goto yy468; goto yy466; } -#line 692 "../src/ast/lex.re" +#line 691 "../src/ast/lex.re" } diff --git a/re2c/bootstrap/src/ast/parser.cc b/re2c/bootstrap/src/ast/parser.cc index 4e80ea59..bfe57412 100644 --- a/re2c/bootstrap/src/ast/parser.cc +++ b/re2c/bootstrap/src/ast/parser.cc @@ -84,7 +84,6 @@ #include "src/re/encoding/enc.h" #include "src/re/encoding/range_suffix.h" #include "src/skeleton/skeleton.h" -#include "src/ast/extop.h" #include "src/ast/parser.h" #include "src/ast/ast.h" #include "src/ast/scanner.h" @@ -286,7 +285,7 @@ union YYSTYPE const re2c::AST * regexp; re2c::Code * code; char op; - re2c::ExtOp extop; + re2c::ASTBounds bounds; std::string * str; re2c::CondList * clist; @@ -605,11 +604,11 @@ static const yytype_uint8 yytranslate[] = /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 201, 201, 203, 204, 205, 209, 216, 221, 224, - 228, 228, 231, 235, 239, 246, 253, 260, 266, 268, - 274, 281, 282, 288, 294, 301, 302, 307, 315, 319, - 326, 330, 337, 341, 348, 349, 355, 360, 361, 365, - 366, 367, 371, 372, 382 + 0, 200, 200, 202, 203, 204, 208, 215, 220, 223, + 227, 227, 230, 234, 238, 245, 252, 259, 265, 267, + 273, 280, 281, 287, 293, 300, 301, 306, 314, 318, + 325, 329, 336, 340, 347, 348, 354, 359, 360, 364, + 365, 366, 370, 371, 381 }; #endif @@ -1649,7 +1648,7 @@ yyreduce: case 36: { - (yyval.regexp) = ast_iter((yyvsp[-1].regexp), (yyvsp[0].extop).min, (yyvsp[0].extop).max); + (yyval.regexp) = ast_iter((yyvsp[-1].regexp), (yyvsp[0].bounds).min, (yyvsp[0].bounds).max); } break; diff --git a/re2c/bootstrap/src/ast/y.tab.h b/re2c/bootstrap/src/ast/y.tab.h index 318b8a28..b6f23ff8 100644 --- a/re2c/bootstrap/src/ast/y.tab.h +++ b/re2c/bootstrap/src/ast/y.tab.h @@ -65,7 +65,7 @@ union YYSTYPE const re2c::AST * regexp; re2c::Code * code; char op; - re2c::ExtOp extop; + re2c::ASTBounds bounds; std::string * str; re2c::CondList * clist; diff --git a/re2c/src/ast/ast.h b/re2c/src/ast/ast.h index 42c32e89..e63d6bcb 100644 --- a/re2c/src/ast/ast.h +++ b/re2c/src/ast/ast.h @@ -68,6 +68,12 @@ struct ASTRule {} }; +struct ASTBounds +{ + uint32_t min; + uint32_t max; +}; + const AST *ast_nil(uint32_t l, uint32_t c); const AST *ast_schar(uint32_t l, uint32_t c, uint32_t x); const AST *ast_ichar(uint32_t l, uint32_t c, uint32_t x); diff --git a/re2c/src/ast/extop.h b/re2c/src/ast/extop.h deleted file mode 100644 index 970ffebc..00000000 --- a/re2c/src/ast/extop.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef _RE2C_AST_EXTOP_ -#define _RE2C_AST_EXTOP_ - -#include "src/util/c99_stdint.h" - -namespace re2c -{ - -struct ExtOp -{ - uint32_t min; - uint32_t max; -}; - -} // end namespace re2c - -#endif // _RE2C_AST_EXTOP_ diff --git a/re2c/src/ast/lex.re b/re2c/src/ast/lex.re index f74c8bfe..18549bb9 100644 --- a/re2c/src/ast/lex.re +++ b/re2c/src/ast/lex.re @@ -7,7 +7,6 @@ #include "src/code/output.h" #include "src/re/encoding/enc.h" -#include "src/ast/extop.h" #include "src/ast/input.h" #include "src/ast/ast.h" #include "src/ast/scanner.h" @@ -273,21 +272,21 @@ start: [*+?<>!,()|=;/\\] { return *tok; } "{" [0-9]+ "}" { - if (!s_to_u32_unsafe (tok + 1, cur - 1, yylval.extop.min)) + if (!s_to_u32_unsafe (tok + 1, cur - 1, yylval.bounds.min)) { fatal ("repetition count overflow"); } - yylval.extop.max = yylval.extop.min; + yylval.bounds.max = yylval.bounds.min; return TOKEN_CLOSESIZE; } "{" [0-9]+ "," [0-9]+ "}" { const char * p = strchr (tok, ','); - if (!s_to_u32_unsafe (tok + 1, p, yylval.extop.min)) + if (!s_to_u32_unsafe (tok + 1, p, yylval.bounds.min)) { fatal ("repetition lower bound overflow"); } - if (!s_to_u32_unsafe (p + 1, cur - 1, yylval.extop.max)) + if (!s_to_u32_unsafe (p + 1, cur - 1, yylval.bounds.max)) { fatal ("repetition upper bound overflow"); } @@ -295,11 +294,11 @@ start: } "{" [0-9]+ ",}" { - if (!s_to_u32_unsafe (tok + 1, cur - 2, yylval.extop.min)) + if (!s_to_u32_unsafe (tok + 1, cur - 2, yylval.bounds.min)) { fatal ("repetition lower bound overflow"); } - yylval.extop.max = std::numeric_limits::max(); + yylval.bounds.max = std::numeric_limits::max(); return TOKEN_CLOSESIZE; } diff --git a/re2c/src/ast/parser.ypp b/re2c/src/ast/parser.ypp index 1d313198..ce7a985c 100644 --- a/re2c/src/ast/parser.ypp +++ b/re2c/src/ast/parser.ypp @@ -19,7 +19,6 @@ #include "src/re/encoding/enc.h" #include "src/re/encoding/range_suffix.h" #include "src/skeleton/skeleton.h" -#include "src/ast/extop.h" #include "src/ast/parser.h" #include "src/ast/ast.h" #include "src/ast/scanner.h" @@ -176,7 +175,7 @@ static spec_t &find(specs_t &specs, const std::string &name) const re2c::AST * regexp; re2c::Code * code; char op; - re2c::ExtOp extop; + re2c::ASTBounds bounds; std::string * str; re2c::CondList * clist; }; @@ -190,7 +189,7 @@ static spec_t &find(specs_t &specs, const std::string &name) %token TOKEN_REGEXP %type close closes -%type TOKEN_CLOSESIZE +%type TOKEN_CLOSESIZE %type TOKEN_CODE ccode %type TOKEN_REGEXP trailexpr capexpr rule expr diff term factor primary %type TOKEN_ID TOKEN_FID name