From 874bdcb1d4a63b97c4a48b285dccea39c326242b Mon Sep 17 00:00:00 2001 From: Ulya Trofimovich Date: Sun, 18 Dec 2016 12:02:05 +0000 Subject: [PATCH] Removed options from global scope. --- re2c/Makefile.am | 1 - re2c/bootstrap/src/parse/lex.cc | 1852 ++++++++++++------------- re2c/bootstrap/src/parse/lex_conf.cc | 514 ++++--- re2c/bootstrap/src/parse/parser.cc | 18 +- re2c/src/codegen/bitmap.cc | 2 +- re2c/src/codegen/emit.h | 13 +- re2c/src/codegen/emit_action.cc | 69 +- re2c/src/codegen/emit_dfa.cc | 41 +- re2c/src/codegen/go.h | 11 +- re2c/src/codegen/go_construct.cc | 26 +- re2c/src/codegen/go_emit.cc | 21 +- re2c/src/codegen/indent.h | 22 - re2c/src/codegen/input_api.cc | 49 +- re2c/src/codegen/input_api.h | 26 +- re2c/src/codegen/output.cc | 78 +- re2c/src/codegen/output.h | 20 +- re2c/src/codegen/print.cc | 164 +-- re2c/src/codegen/print.h | 11 +- re2c/src/conf/opt.cc | 2 - re2c/src/globals.h | 2 - re2c/src/ir/adfa/adfa.cc | 2 - re2c/src/ir/adfa/adfa.h | 6 +- re2c/src/ir/adfa/prepare.cc | 10 +- re2c/src/ir/compile.cc | 15 +- re2c/src/ir/dfa/dead_rules.cc | 1 - re2c/src/ir/dfa/determinization.cc | 9 +- re2c/src/ir/dfa/dfa.h | 4 +- re2c/src/ir/dfa/dump.cc | 6 +- re2c/src/ir/dfa/dump.h | 2 +- re2c/src/ir/dfa/find_state.cc | 10 +- re2c/src/ir/dfa/find_state.h | 4 +- re2c/src/ir/dfa/minimization.cc | 17 +- re2c/src/ir/nfa/nfa.cc | 4 +- re2c/src/ir/nfa/nfa.h | 5 +- re2c/src/ir/nfa/regexps2nfa.cc | 14 +- re2c/src/ir/regexp/nullable.cc | 1 - re2c/src/ir/regexp/regexp.cc | 1 - re2c/src/ir/skeleton/generate_code.cc | 9 +- re2c/src/ir/skeleton/generate_data.cc | 11 +- re2c/src/ir/skeleton/skeleton.h | 2 +- re2c/src/main.cc | 4 +- re2c/src/parse/lex.re | 1 - re2c/src/parse/lex_conf.re | 2 - re2c/src/parse/parser.ypp | 8 +- re2c/src/parse/scanner.cc | 2 +- re2c/src/parse/scanner.h | 2 + 46 files changed, 1507 insertions(+), 1587 deletions(-) delete mode 100644 re2c/src/codegen/indent.h diff --git a/re2c/Makefile.am b/re2c/Makefile.am index a5e5028d..08901ffa 100644 --- a/re2c/Makefile.am +++ b/re2c/Makefile.am @@ -12,7 +12,6 @@ SRC_HDR = \ src/codegen/bitmap.h \ src/codegen/emit.h \ src/codegen/go.h \ - src/codegen/indent.h \ src/codegen/input_api.h \ src/codegen/label.h \ src/codegen/output.h \ diff --git a/re2c/bootstrap/src/parse/lex.cc b/re2c/bootstrap/src/parse/lex.cc index d7b8e0cb..ec10a9d5 100644 --- a/re2c/bootstrap/src/parse/lex.cc +++ b/re2c/bootstrap/src/parse/lex.cc @@ -1,4 +1,4 @@ -/* Generated by re2c 0.16 on Tue Oct 11 14:06:51 2016 */ +/* Generated by re2c 0.16 on Sun Dec 18 11:56:11 2016 */ #line 1 "../src/parse/lex.re" #include "src/util/c99_stdint.h" #include @@ -8,7 +8,6 @@ #include #include "src/codegen/output.h" -#include "src/conf/opt.h" #include "src/conf/warn.h" #include "src/globals.h" #include "src/ir/regexp/encoding/enc.h" @@ -38,10 +37,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 41 "../src/parse/lex.re" +#line 40 "../src/parse/lex.re" -#line 62 "../src/parse/lex.re" +#line 61 "../src/parse/lex.re" Scanner::ParseMode Scanner::echo() @@ -56,7 +55,7 @@ echo: const char *start = cur; -#line 60 "src/parse/lex.cc" +#line 59 "src/parse/lex.cc" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -114,7 +113,7 @@ echo: } } ++YYCURSOR; -#line 153 "../src/parse/lex.re" +#line 152 "../src/parse/lex.re" { if (cur == eof) { if (opts->target == opt_t::CODE) { @@ -124,13 +123,13 @@ echo: } goto echo; } -#line 128 "src/parse/lex.cc" +#line 127 "src/parse/lex.cc" yy4: ++YYCURSOR; yy5: -#line 174 "../src/parse/lex.re" +#line 173 "../src/parse/lex.re" { goto echo; } -#line 134 "src/parse/lex.cc" +#line 133 "src/parse/lex.cc" yy6: yyaccept = 0; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -139,13 +138,13 @@ yy6: } if (yych == '#') goto yy14; yy7: -#line 168 "../src/parse/lex.re" +#line 167 "../src/parse/lex.re" { cline++; pos = cur; goto echo; } -#line 149 "src/parse/lex.cc" +#line 148 "src/parse/lex.cc" yy8: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy6; @@ -188,7 +187,7 @@ yy14: } yy16: ++YYCURSOR; -#line 76 "../src/parse/lex.re" +#line 75 "../src/parse/lex.re" { if (opts->rFlag) { fatal("found standard 're2c' block while using -r flag"); @@ -198,7 +197,7 @@ yy16: } return Parse; } -#line 202 "src/parse/lex.cc" +#line 201 "src/parse/lex.cc" yy18: yych = (YYCTYPE)*++YYCURSOR; if (yych == '!') goto yy20; @@ -426,12 +425,12 @@ yy64: yy66: ++YYCURSOR; YYCURSOR = YYCTXMARKER; -#line 163 "../src/parse/lex.re" +#line 162 "../src/parse/lex.re" { set_sourceline(); goto echo; } -#line 435 "src/parse/lex.cc" +#line 434 "src/parse/lex.cc" yy68: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy66; @@ -523,7 +522,7 @@ yy88: goto yy13; yy89: ++YYCURSOR; -#line 116 "../src/parse/lex.re" +#line 115 "../src/parse/lex.re" { if (opts->target == opt_t::CODE) { out.wraw(tok, start) @@ -532,7 +531,7 @@ yy89: lex_end_of_comment(); goto echo; } -#line 536 "src/parse/lex.cc" +#line 535 "src/parse/lex.cc" yy91: yych = (YYCTYPE)*++YYCURSOR; if (yych == '2') goto yy98; @@ -547,7 +546,7 @@ yy93: goto yy13; yy94: ++YYCURSOR; -#line 97 "../src/parse/lex.re" +#line 96 "../src/parse/lex.re" { if (!opts->rFlag) { fatal("found 'use:re2c' block without -r flag"); @@ -558,7 +557,7 @@ yy94: reuse(); return Reuse; } -#line 562 "src/parse/lex.cc" +#line 561 "src/parse/lex.cc" yy96: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy102; @@ -573,7 +572,7 @@ yy98: goto yy13; yy99: ++YYCURSOR; -#line 145 "../src/parse/lex.re" +#line 144 "../src/parse/lex.re" { if (opts->target == opt_t::CODE) { out.wraw(tok, start); @@ -581,7 +580,7 @@ yy99: lex_tags(); goto echo; } -#line 585 "src/parse/lex.cc" +#line 584 "src/parse/lex.cc" yy101: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'c') goto yy106; @@ -596,7 +595,7 @@ yy103: goto yy13; yy104: ++YYCURSOR; -#line 86 "../src/parse/lex.re" +#line 85 "../src/parse/lex.re" { if (!opts->rFlag) { fatal("found 'rules:re2c' block without -r flag"); @@ -607,10 +606,10 @@ yy104: opts.reset_mapCodeName (); return Rules; } -#line 611 "src/parse/lex.cc" +#line 610 "src/parse/lex.cc" yy106: ++YYCURSOR; -#line 134 "../src/parse/lex.re" +#line 133 "../src/parse/lex.re" { if (opts->target == opt_t::CODE) { out.wraw(tok, start) @@ -621,14 +620,14 @@ yy106: lex_end_of_comment(); goto echo; } -#line 625 "src/parse/lex.cc" +#line 624 "src/parse/lex.cc" yy108: yych = (YYCTYPE)*++YYCURSOR; if (yych == '2') goto yy111; goto yy13; yy109: ++YYCURSOR; -#line 108 "../src/parse/lex.re" +#line 107 "../src/parse/lex.re" { if (opts->target == opt_t::CODE) { out.wraw(tok, start); @@ -636,12 +635,12 @@ yy109: lex_end_of_comment(); goto echo; } -#line 640 "src/parse/lex.cc" +#line 639 "src/parse/lex.cc" yy111: yych = (YYCTYPE)*++YYCURSOR; if (yych != 'c') goto yy13; ++YYCURSOR; -#line 125 "../src/parse/lex.re" +#line 124 "../src/parse/lex.re" { if (opts->target == opt_t::CODE) { out.wraw(tok, start) @@ -650,9 +649,9 @@ yy111: lex_end_of_comment(); goto echo; } -#line 654 "src/parse/lex.cc" +#line 653 "src/parse/lex.cc" } -#line 175 "../src/parse/lex.re" +#line 174 "../src/parse/lex.re" } @@ -660,7 +659,7 @@ void Scanner::lex_end_of_comment() { uint32_t ignored = 0; for (;;) { -#line 664 "src/parse/lex.cc" +#line 663 "src/parse/lex.cc" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -676,20 +675,20 @@ void Scanner::lex_end_of_comment() } yy116: ++YYCURSOR; -#line 182 "../src/parse/lex.re" +#line 181 "../src/parse/lex.re" { fatal("expected end of block"); } -#line 682 "src/parse/lex.cc" +#line 681 "src/parse/lex.cc" yy118: ++YYCURSOR; yy119: -#line 184 "../src/parse/lex.re" +#line 183 "../src/parse/lex.re" { continue; } -#line 688 "src/parse/lex.cc" +#line 687 "src/parse/lex.cc" yy120: ++YYCURSOR; -#line 185 "../src/parse/lex.re" +#line 184 "../src/parse/lex.re" { ++ignored; continue; } -#line 693 "src/parse/lex.cc" +#line 692 "src/parse/lex.cc" yy122: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy120; @@ -698,7 +697,7 @@ yy123: yych = (YYCTYPE)*++YYCURSOR; if (yych != '/') goto yy119; ++YYCURSOR; -#line 186 "../src/parse/lex.re" +#line 185 "../src/parse/lex.re" { if (ignored > 0) { cline += ignored; @@ -707,9 +706,9 @@ yy123: tok = pos = cur; return; } -#line 711 "src/parse/lex.cc" +#line 710 "src/parse/lex.cc" } -#line 194 "../src/parse/lex.re" +#line 193 "../src/parse/lex.re" } } @@ -717,7 +716,7 @@ void Scanner::lex_tags() { std::string fmt, sep; for (;;) { -#line 721 "src/parse/lex.cc" +#line 720 "src/parse/lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -775,9 +774,9 @@ void Scanner::lex_tags() } ++YYCURSOR; yy129: -#line 201 "../src/parse/lex.re" +#line 200 "../src/parse/lex.re" { fatal("unrecognized configuration"); } -#line 781 "src/parse/lex.cc" +#line 780 "src/parse/lex.cc" yy130: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -785,14 +784,14 @@ yy130: if (yybm[0+yych] & 128) { goto yy130; } -#line 206 "../src/parse/lex.re" +#line 205 "../src/parse/lex.re" { continue; } -#line 791 "src/parse/lex.cc" +#line 790 "src/parse/lex.cc" yy133: ++YYCURSOR; -#line 207 "../src/parse/lex.re" +#line 206 "../src/parse/lex.re" { ++cline; continue; } -#line 796 "src/parse/lex.cc" +#line 795 "src/parse/lex.cc" yy135: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy133; @@ -811,7 +810,7 @@ yy138: goto yy129; yy139: ++YYCURSOR; -#line 208 "../src/parse/lex.re" +#line 207 "../src/parse/lex.re" { if (opts->target == opt_t::CODE) { out.wdelay_tags(opts->topIndent, @@ -820,7 +819,7 @@ yy139: tok = pos = cur; return; } -#line 824 "src/parse/lex.cc" +#line 823 "src/parse/lex.cc" yy141: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy144; @@ -857,9 +856,9 @@ yy149: goto yy142; yy150: ++YYCURSOR; -#line 203 "../src/parse/lex.re" +#line 202 "../src/parse/lex.re" { fmt = lex_conf_string(); continue; } -#line 863 "src/parse/lex.cc" +#line 862 "src/parse/lex.cc" yy152: yych = (YYCTYPE)*++YYCURSOR; if (yych != 't') goto yy142; @@ -868,11 +867,11 @@ yy152: yych = (YYCTYPE)*++YYCURSOR; if (yych != 'r') goto yy142; ++YYCURSOR; -#line 204 "../src/parse/lex.re" +#line 203 "../src/parse/lex.re" { sep = lex_conf_string(); continue; } -#line 874 "src/parse/lex.cc" +#line 873 "src/parse/lex.cc" } -#line 216 "../src/parse/lex.re" +#line 215 "../src/parse/lex.re" } } @@ -892,7 +891,7 @@ scan: start: -#line 896 "src/parse/lex.cc" +#line 895 "src/parse/lex.cc" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -930,7 +929,7 @@ start: 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, }; - if ((YYLIMIT - YYCURSOR) < 6) YYFILL(6); + if ((YYLIMIT - YYCURSOR) < 5) YYFILL(5); yych = (YYCTYPE)*YYCURSOR; if (yybm[0+yych] & 16) { goto yy161; @@ -967,16 +966,16 @@ start: } else { if (yych <= '\\') { if (yych <= '>') { - if (yych <= ':') goto yy182; - if (yych == '<') goto yy183; + if (yych <= ':') goto yy183; + if (yych == '<') goto yy184; goto yy172; } else { if (yych <= '@') { if (yych <= '?') goto yy176; - goto yy184; + goto yy185; } else { if (yych <= 'Z') goto yy181; - if (yych <= '[') goto yy185; + if (yych <= '[') goto yy186; goto yy172; } } @@ -986,10 +985,10 @@ start: if (yych >= 'a') goto yy181; } else { if (yych <= 'z') { - if (yych <= 'r') goto yy187; + if (yych <= 'r') goto yy188; goto yy181; } else { - if (yych <= '{') goto yy188; + if (yych <= '{') goto yy189; if (yych <= '|') goto yy172; } } @@ -998,12 +997,12 @@ start: yy159: ++YYCURSOR; yy160: -#line 398 "../src/parse/lex.re" +#line 397 "../src/parse/lex.re" { fatalf("unexpected character: '%c'", *tok); goto scan; } -#line 1007 "src/parse/lex.cc" +#line 1006 "src/parse/lex.cc" yy161: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -1011,99 +1010,126 @@ yy161: if (yybm[0+yych] & 16) { goto yy161; } -#line 382 "../src/parse/lex.re" +#line 381 "../src/parse/lex.re" { goto scan; } -#line 1019 "src/parse/lex.cc" +#line 1018 "src/parse/lex.cc" yy164: yyaccept = 0; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= 0x1F) { - if (yych == '\t') goto yy190; + if (yych == '\t') goto yy191; } else { - if (yych <= ' ') goto yy190; - if (yych == '#') goto yy193; + if (yych <= ' ') goto yy191; + if (yych == '#') goto yy194; } yy165: -#line 391 "../src/parse/lex.re" +#line 390 "../src/parse/lex.re" { if (cur == eof) return 0; pos = cur; cline++; goto scan; } -#line 1037 "src/parse/lex.cc" +#line 1036 "src/parse/lex.cc" yy166: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy164; goto yy160; yy167: ++YYCURSOR; -#line 265 "../src/parse/lex.re" +#line 264 "../src/parse/lex.re" { yylval.regexp = lex_str('"', opts->bCaseInsensitive || opts->bCaseInverted); return TOKEN_REGEXP; } -#line 1046 "src/parse/lex.cc" +#line 1045 "src/parse/lex.cc" yy169: yych = (YYCTYPE)*++YYCURSOR; - if (yych == '}') goto yy195; + if (yych == '}') goto yy196; goto yy160; yy170: ++YYCURSOR; -#line 264 "../src/parse/lex.re" +#line 263 "../src/parse/lex.re" { yylval.regexp = lex_str('\'', opts->bCaseInsensitive || !opts->bCaseInverted); return TOKEN_REGEXP; } -#line 1055 "src/parse/lex.cc" +#line 1054 "src/parse/lex.cc" yy172: ++YYCURSOR; yy173: -#line 285 "../src/parse/lex.re" +#line 284 "../src/parse/lex.re" { return *tok; } -#line 1063 "src/parse/lex.cc" +#line 1062 "src/parse/lex.cc" yy174: - ++YYCURSOR; - if ((yych = (YYCTYPE)*YYCURSOR) == '/') goto yy195; -#line 289 "../src/parse/lex.re" + yych = (YYCTYPE)*++YYCURSOR; + if (yych == '/') goto yy196; +#line 288 "../src/parse/lex.re" { yylval.op = *tok; return TOKEN_STAR; } -#line 1072 "src/parse/lex.cc" +#line 1071 "src/parse/lex.cc" yy176: ++YYCURSOR; -#line 293 "../src/parse/lex.re" +#line 292 "../src/parse/lex.re" { yylval.op = *tok; return TOKEN_CLOSE; } -#line 1080 "src/parse/lex.cc" +#line 1079 "src/parse/lex.cc" yy178: ++YYCURSOR; -#line 377 "../src/parse/lex.re" +#line 376 "../src/parse/lex.re" { yylval.regexp = mkDot(); return TOKEN_REGEXP; } -#line 1088 "src/parse/lex.cc" +#line 1087 "src/parse/lex.cc" yy180: yych = (YYCTYPE)*++YYCURSOR; - if (yych == '*') goto yy197; - if (yych == '/') goto yy199; + if (yych == '*') goto yy198; + if (yych == '/') goto yy200; goto yy173; yy181: - yych = (YYCTYPE)*++YYCURSOR; - goto yy207; + ++YYCURSOR; + if (YYLIMIT <= YYCURSOR) YYFILL(1); + yych = (YYCTYPE)*YYCURSOR; yy182: + if (yybm[0+yych] & 32) { + goto yy181; + } + if (yych <= ' ') { + if (yych == '\t') { + YYCTXMARKER = YYCURSOR; + goto yy204; + } + if (yych <= 0x1F) goto yy202; + YYCTXMARKER = YYCURSOR; + goto yy204; + } else { + if (yych <= ',') { + if (yych <= '+') goto yy202; + YYCTXMARKER = YYCURSOR; + goto yy206; + } else { + if (yych <= '<') goto yy202; + if (yych <= '>') { + YYCTXMARKER = YYCURSOR; + goto yy206; + } + goto yy202; + } + } +yy183: yych = (YYCTYPE)*++YYCURSOR; if (yych == '=') goto yy208; goto yy160; -yy183: +yy184: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych == '!') goto yy210; if (yych == '>') goto yy212; goto yy173; -yy184: +yy185: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 'Z') { if (yych <= '/') goto yy160; @@ -1120,17 +1146,17 @@ yy184: goto yy160; } } -yy185: - ++YYCURSOR; - if ((yych = (YYCTYPE)*YYCURSOR) == '^') goto yy216; -#line 266 "../src/parse/lex.re" +yy186: + yych = (YYCTYPE)*++YYCURSOR; + if (yych == '^') goto yy216; +#line 265 "../src/parse/lex.re" { yylval.regexp = lex_cls(false); return TOKEN_REGEXP; } -#line 1129 "src/parse/lex.cc" -yy187: +#line 1155 "src/parse/lex.cc" +yy188: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy218; - goto yy207; -yy188: + goto yy182; +yy189: yyaccept = 2; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yybm[0+yych] & 64) { @@ -1143,28 +1169,28 @@ yy188: if (yych <= '_') { if (yych >= '_') goto yy223; } else { - if (yych <= '`') goto yy189; + if (yych <= '`') goto yy190; if (yych <= 'z') goto yy223; } } -yy189: -#line 235 "../src/parse/lex.re" +yy190: +#line 234 "../src/parse/lex.re" { depth = 1; goto code; } -#line 1157 "src/parse/lex.cc" -yy190: +#line 1183 "src/parse/lex.cc" +yy191: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yych <= 0x1F) { - if (yych == '\t') goto yy190; + if (yych == '\t') goto yy191; } else { - if (yych <= ' ') goto yy190; - if (yych == '#') goto yy193; + if (yych <= ' ') goto yy191; + if (yych == '#') goto yy194; } -yy192: +yy193: YYCURSOR = YYMARKER; if (yyaccept <= 1) { if (yyaccept == 0) { @@ -1174,50 +1200,50 @@ yy192: } } else { if (yyaccept == 2) { - goto yy189; + goto yy190; } else { goto yy220; } } -yy193: +yy194: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 5) YYFILL(5); yych = (YYCTYPE)*YYCURSOR; if (yych <= 0x1F) { - if (yych == '\t') goto yy193; - goto yy192; + if (yych == '\t') goto yy194; + goto yy193; } else { - if (yych <= ' ') goto yy193; + if (yych <= ' ') goto yy194; if (yych == 'l') goto yy225; - goto yy192; + goto yy193; } -yy195: +yy196: ++YYCURSOR; -#line 259 "../src/parse/lex.re" +#line 258 "../src/parse/lex.re" { tok = cur; return 0; } -#line 1202 "src/parse/lex.cc" -yy197: +#line 1228 "src/parse/lex.cc" +yy198: ++YYCURSOR; -#line 253 "../src/parse/lex.re" +#line 252 "../src/parse/lex.re" { depth = 1; goto comment; } -#line 1210 "src/parse/lex.cc" -yy199: +#line 1236 "src/parse/lex.cc" +yy200: ++YYCURSOR; -#line 250 "../src/parse/lex.re" +#line 249 "../src/parse/lex.re" { goto nextLine; } -#line 1217 "src/parse/lex.cc" -yy201: +#line 1243 "src/parse/lex.cc" +yy202: ++YYCURSOR; YYCURSOR -= 1; -#line 361 "../src/parse/lex.re" +#line 360 "../src/parse/lex.re" { if (!opts->FFlag) { yylval.str = new std::string (tok, tok_len()); @@ -1233,95 +1259,78 @@ yy201: return TOKEN_REGEXP; } } -#line 1237 "src/parse/lex.cc" -yy203: - yych = (YYCTYPE)*++YYCURSOR; - goto yy229; +#line 1263 "src/parse/lex.cc" yy204: ++YYCURSOR; - YYCURSOR = YYCTXMARKER; -#line 356 "../src/parse/lex.re" - { - yylval.str = new std::string (tok, tok_len ()); - return TOKEN_ID; - } -#line 1249 "src/parse/lex.cc" -yy206: - ++YYCURSOR; - if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); + if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; -yy207: - if (yybm[0+yych] & 32) { - goto yy206; - } if (yych <= ' ') { - if (yych == '\t') { - YYCTXMARKER = YYCURSOR; - goto yy203; - } - if (yych <= 0x1F) goto yy201; - YYCTXMARKER = YYCURSOR; - goto yy203; + if (yych == '\t') goto yy204; + if (yych <= 0x1F) goto yy226; + goto yy204; } else { if (yych <= ',') { - if (yych <= '+') goto yy201; - YYCTXMARKER = YYCURSOR; - goto yy204; + if (yych <= '+') goto yy226; } else { - if (yych <= '<') goto yy201; - if (yych <= '>') { - YYCTXMARKER = YYCURSOR; - goto yy204; - } - goto yy201; + if (yych <= '<') goto yy226; + if (yych >= '?') goto yy226; } } -yy208: +yy206: ++YYCURSOR; - if ((yych = (YYCTYPE)*YYCURSOR) == '>') goto yy230; -#line 244 "../src/parse/lex.re" + YYCURSOR = YYCTXMARKER; +#line 355 "../src/parse/lex.re" + { + yylval.str = new std::string (tok, tok_len ()); + return TOKEN_ID; + } +#line 1288 "src/parse/lex.cc" +yy208: + yych = (YYCTYPE)*++YYCURSOR; + if (yych == '>') goto yy228; +#line 243 "../src/parse/lex.re" { tok += 2; /* skip ":=" */ depth = 0; goto code; } -#line 1289 "src/parse/lex.cc" +#line 1298 "src/parse/lex.cc" yy210: ++YYCURSOR; -#line 272 "../src/parse/lex.re" +#line 271 "../src/parse/lex.re" { return TOKEN_SETUP; } -#line 1296 "src/parse/lex.cc" +#line 1305 "src/parse/lex.cc" yy212: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '9') { if (yych <= '\t') { - if (yych <= 0x08) goto yy192; + if (yych <= 0x08) goto yy193; YYCTXMARKER = YYCURSOR; - goto yy232; + goto yy230; } else { if (yych == ' ') { YYCTXMARKER = YYCURSOR; - goto yy232; + goto yy230; } - goto yy192; + goto yy193; } } else { if (yych <= '=') { if (yych <= ':') { YYCTXMARKER = YYCURSOR; - goto yy234; + goto yy232; } - if (yych <= '<') goto yy192; + if (yych <= '<') goto yy193; YYCTXMARKER = YYCURSOR; - goto yy235; + goto yy233; } else { if (yych == '{') { YYCTXMARKER = YYCURSOR; - goto yy236; + goto yy234; } - goto yy192; + goto yy193; } } yy213: @@ -1341,7 +1350,7 @@ yy213: } } yy215: -#line 276 "../src/parse/lex.re" +#line 275 "../src/parse/lex.re" { if (!opts->tags) { fatal("tags are only allowed with '-T, --tags' option"); @@ -1350,24 +1359,24 @@ yy215: yylval.regexp = RegExp::make_tag(name); return TOKEN_REGEXP; } -#line 1354 "src/parse/lex.cc" +#line 1363 "src/parse/lex.cc" yy216: ++YYCURSOR; -#line 267 "../src/parse/lex.re" +#line 266 "../src/parse/lex.re" { yylval.regexp = lex_cls(true); return TOKEN_REGEXP; } -#line 1359 "src/parse/lex.cc" +#line 1368 "src/parse/lex.cc" yy218: yych = (YYCTYPE)*++YYCURSOR; - if (yych == '2') goto yy238; - goto yy207; + if (yych == '2') goto yy236; + goto yy182; yy219: ++YYCURSOR; yy220: -#line 329 "../src/parse/lex.re" +#line 328 "../src/parse/lex.re" { fatal("illegal closure form, use '{n}', '{n,}', '{n,m}' where n and m are numbers"); } -#line 1371 "src/parse/lex.cc" +#line 1380 "src/parse/lex.cc" yy221: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -1377,18 +1386,18 @@ yy221: } if (yych <= '^') { if (yych <= ',') { - if (yych <= '+') goto yy192; - goto yy239; + if (yych <= '+') goto yy193; + goto yy237; } else { - if (yych <= '@') goto yy192; - if (yych >= '[') goto yy192; + if (yych <= '@') goto yy193; + if (yych >= '[') goto yy193; } } else { if (yych <= 'z') { - if (yych == '`') goto yy192; + if (yych == '`') goto yy193; } else { - if (yych == '}') goto yy240; - goto yy192; + if (yych == '}') goto yy238; + goto yy193; } } yy223: @@ -1397,30 +1406,30 @@ yy223: yych = (YYCTYPE)*YYCURSOR; if (yych <= '^') { if (yych <= '9') { - if (yych <= '/') goto yy192; + if (yych <= '/') goto yy193; goto yy223; } else { - if (yych <= '@') goto yy192; + if (yych <= '@') goto yy193; if (yych <= 'Z') goto yy223; - goto yy192; + goto yy193; } } else { if (yych <= 'z') { - if (yych == '`') goto yy192; + if (yych == '`') goto yy193; goto yy223; } else { - if (yych == '}') goto yy242; - goto yy192; + if (yych == '}') goto yy240; + goto yy193; } } yy225: yych = (YYCTYPE)*++YYCURSOR; - if (yych == 'i') goto yy244; - goto yy192; + if (yych == 'i') goto yy242; + goto yy193; yy226: ++YYCURSOR; YYCURSOR = YYCTXMARKER; -#line 343 "../src/parse/lex.re" +#line 342 "../src/parse/lex.re" { yylval.str = new std::string (tok, tok_len ()); if (opts->FFlag) @@ -1433,85 +1442,66 @@ yy226: return TOKEN_ID; } } -#line 1437 "src/parse/lex.cc" +#line 1446 "src/parse/lex.cc" yy228: - ++YYCURSOR; - if (YYLIMIT <= YYCURSOR) YYFILL(1); - yych = (YYCTYPE)*YYCURSOR; -yy229: - if (yych <= ' ') { - if (yych == '\t') goto yy228; - if (yych <= 0x1F) goto yy226; - goto yy228; - } else { - if (yych <= ',') { - if (yych <= '+') goto yy226; - goto yy204; - } else { - if (yych <= '<') goto yy226; - if (yych <= '>') goto yy204; - goto yy226; - } - } -yy230: ++YYCURSOR; YYCURSOR -= 2; -#line 240 "../src/parse/lex.re" +#line 239 "../src/parse/lex.re" { return *tok; } -#line 1464 "src/parse/lex.cc" -yy232: +#line 1454 "src/parse/lex.cc" +yy230: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = (YYCTYPE)*YYCURSOR; if (yych <= '9') { if (yych <= '\t') { - if (yych <= 0x08) goto yy192; - goto yy232; + if (yych <= 0x08) goto yy193; + goto yy230; } else { - if (yych == ' ') goto yy232; - goto yy192; + if (yych == ' ') goto yy230; + goto yy193; } } else { if (yych <= '=') { - if (yych <= ':') goto yy234; - if (yych <= '<') goto yy192; - goto yy235; + if (yych <= ':') goto yy232; + if (yych <= '<') goto yy193; + goto yy233; } else { - if (yych == '{') goto yy236; - goto yy192; + if (yych == '{') goto yy234; + goto yy193; } } -yy234: +yy232: yych = (YYCTYPE)*++YYCURSOR; - if (yych == '=') goto yy236; - goto yy192; -yy235: + if (yych == '=') goto yy234; + goto yy193; +yy233: yych = (YYCTYPE)*++YYCURSOR; - if (yych != '>') goto yy192; -yy236: + if (yych != '>') goto yy193; +yy234: ++YYCURSOR; YYCURSOR = YYCTXMARKER; -#line 269 "../src/parse/lex.re" +#line 268 "../src/parse/lex.re" { return TOKEN_NOCOND; } -#line 1501 "src/parse/lex.cc" -yy238: +#line 1491 "src/parse/lex.cc" +yy236: yych = (YYCTYPE)*++YYCURSOR; - if (yych == 'c') goto yy245; - goto yy207; -yy239: + if (yych == 'c') goto yy243; + goto yy182; +yy237: yyaccept = 3; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '/') goto yy220; - if (yych <= '9') goto yy246; - if (yych == '}') goto yy248; + if (yych <= '9') goto yy244; + if (yych == '}') goto yy246; goto yy220; -yy240: +yy238: ++YYCURSOR; -#line 298 "../src/parse/lex.re" +#line 297 "../src/parse/lex.re" { if (!s_to_u32_unsafe (tok + 1, cur - 1, yylval.extop.min)) { @@ -1520,10 +1510,10 @@ yy240: yylval.extop.max = yylval.extop.min; return TOKEN_CLOSESIZE; } -#line 1524 "src/parse/lex.cc" -yy242: +#line 1514 "src/parse/lex.cc" +yy240: ++YYCURSOR; -#line 333 "../src/parse/lex.re" +#line 332 "../src/parse/lex.re" { if (!opts->FFlag) { fatal("curly braces for names only allowed with -F switch"); @@ -1531,26 +1521,26 @@ yy242: yylval.str = new std::string (tok + 1, tok_len () - 2); // -2 to omit braces return TOKEN_ID; } -#line 1535 "src/parse/lex.cc" -yy244: +#line 1525 "src/parse/lex.cc" +yy242: yych = (YYCTYPE)*++YYCURSOR; - if (yych == 'n') goto yy250; - goto yy192; -yy245: + if (yych == 'n') goto yy248; + goto yy193; +yy243: yych = (YYCTYPE)*++YYCURSOR; - if (yych == ':') goto yy251; - goto yy207; -yy246: + if (yych == ':') goto yy249; + goto yy182; +yy244: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; - if (yych <= '/') goto yy192; - if (yych <= '9') goto yy246; - if (yych == '}') goto yy253; - goto yy192; -yy248: + if (yych <= '/') goto yy193; + if (yych <= '9') goto yy244; + if (yych == '}') goto yy251; + goto yy193; +yy246: ++YYCURSOR; -#line 320 "../src/parse/lex.re" +#line 319 "../src/parse/lex.re" { if (!s_to_u32_unsafe (tok + 1, cur - 2, yylval.extop.min)) { @@ -1559,19 +1549,19 @@ yy248: yylval.extop.max = std::numeric_limits::max(); return TOKEN_CLOSESIZE; } -#line 1563 "src/parse/lex.cc" -yy250: +#line 1553 "src/parse/lex.cc" +yy248: yych = (YYCTYPE)*++YYCURSOR; - if (yych == 'e') goto yy255; - goto yy192; -yy251: + if (yych == 'e') goto yy253; + goto yy193; +yy249: ++YYCURSOR; -#line 341 "../src/parse/lex.re" +#line 340 "../src/parse/lex.re" { lex_conf (); return TOKEN_CONF; } -#line 1572 "src/parse/lex.cc" -yy253: +#line 1562 "src/parse/lex.cc" +yy251: ++YYCURSOR; -#line 307 "../src/parse/lex.re" +#line 306 "../src/parse/lex.re" { const char * p = strchr (tok, ','); if (!s_to_u32_unsafe (tok + 1, p, yylval.extop.min)) @@ -1584,132 +1574,132 @@ yy253: } return TOKEN_CLOSESIZE; } -#line 1588 "src/parse/lex.cc" -yy255: +#line 1578 "src/parse/lex.cc" +yy253: yych = (YYCTYPE)*++YYCURSOR; - if (yych <= '0') goto yy257; - if (yych <= '9') goto yy192; - goto yy257; -yy256: + if (yych <= '0') goto yy255; + if (yych <= '9') goto yy193; + goto yy255; +yy254: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; -yy257: +yy255: if (yych <= 0x1F) { - if (yych == '\t') goto yy256; - goto yy192; + if (yych == '\t') goto yy254; + goto yy193; } else { - if (yych <= ' ') goto yy256; - if (yych <= '0') goto yy192; - if (yych >= ':') goto yy192; + if (yych <= ' ') goto yy254; + if (yych <= '0') goto yy193; + if (yych >= ':') goto yy193; YYCTXMARKER = YYCURSOR; } -yy258: +yy256: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = (YYCTYPE)*YYCURSOR; if (yych <= '\r') { if (yych <= '\t') { - if (yych <= 0x08) goto yy192; + if (yych <= 0x08) goto yy193; } else { - if (yych <= '\n') goto yy262; - if (yych <= '\f') goto yy192; - goto yy264; + if (yych <= '\n') goto yy260; + if (yych <= '\f') goto yy193; + goto yy262; } } else { if (yych <= ' ') { - if (yych <= 0x1F) goto yy192; + if (yych <= 0x1F) goto yy193; } else { - if (yych <= '/') goto yy192; - if (yych <= '9') goto yy258; - goto yy192; + if (yych <= '/') goto yy193; + if (yych <= '9') goto yy256; + goto yy193; } } -yy260: +yy258: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yych <= 0x1F) { - if (yych == '\t') goto yy260; - goto yy192; + if (yych == '\t') goto yy258; + goto yy193; } else { - if (yych <= ' ') goto yy260; - if (yych == '"') goto yy265; - goto yy192; + if (yych <= ' ') goto yy258; + if (yych == '"') goto yy263; + goto yy193; } -yy262: +yy260: ++YYCURSOR; YYCURSOR = YYCTXMARKER; -#line 386 "../src/parse/lex.re" +#line 385 "../src/parse/lex.re" { set_sourceline (); goto scan; } -#line 1649 "src/parse/lex.cc" -yy264: +#line 1639 "src/parse/lex.cc" +yy262: yych = (YYCTYPE)*++YYCURSOR; - if (yych == '\n') goto yy262; - goto yy192; -yy265: + if (yych == '\n') goto yy260; + goto yy193; +yy263: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = (YYCTYPE)*YYCURSOR; if (yybm[0+yych] & 128) { - goto yy265; + goto yy263; } - if (yych <= '\n') goto yy192; - if (yych >= '#') goto yy268; + if (yych <= '\n') goto yy193; + if (yych >= '#') goto yy266; yych = (YYCTYPE)*++YYCURSOR; - if (yych == '\n') goto yy262; - if (yych == '\r') goto yy264; - goto yy192; -yy268: + if (yych == '\n') goto yy260; + if (yych == '\r') goto yy262; + goto yy193; +yy266: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; - if (yych == '\n') goto yy192; - goto yy265; + if (yych == '\n') goto yy193; + goto yy263; } -#line 402 "../src/parse/lex.re" +#line 401 "../src/parse/lex.re" flex_name: -#line 1679 "src/parse/lex.cc" +#line 1669 "src/parse/lex.cc" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = (YYCTYPE)*YYCURSOR; - if (yych == '\n') goto yy273; - if (yych == '\r') goto yy275; + if (yych == '\n') goto yy271; + if (yych == '\r') goto yy273; ++YYCURSOR; -yy272: -#line 413 "../src/parse/lex.re" +yy270: +#line 412 "../src/parse/lex.re" { YYCURSOR = tok; goto start; } -#line 1693 "src/parse/lex.cc" -yy273: +#line 1683 "src/parse/lex.cc" +yy271: ++YYCURSOR; -#line 407 "../src/parse/lex.re" +#line 406 "../src/parse/lex.re" { YYCURSOR = tok; lexer_state = LEX_NORMAL; return TOKEN_FID_END; } -#line 1702 "src/parse/lex.cc" -yy275: - ++YYCURSOR; - if ((yych = (YYCTYPE)*YYCURSOR) == '\n') goto yy273; - goto yy272; +#line 1692 "src/parse/lex.cc" +yy273: + yych = (YYCTYPE)*++YYCURSOR; + if (yych == '\n') goto yy271; + goto yy270; } -#line 417 "../src/parse/lex.re" +#line 416 "../src/parse/lex.re" code: -#line 1713 "src/parse/lex.cc" +#line 1703 "src/parse/lex.cc" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -1751,26 +1741,26 @@ code: yych = (YYCTYPE)*YYCURSOR; if (yych <= '&') { if (yych <= '\n') { - if (yych <= 0x00) goto yy278; - if (yych <= '\t') goto yy280; - goto yy282; - } else { - if (yych == '"') goto yy284; + if (yych <= 0x00) goto yy276; + if (yych <= '\t') goto yy278; goto yy280; + } else { + if (yych == '"') goto yy282; + goto yy278; } } else { if (yych <= '{') { - if (yych <= '\'') goto yy285; - if (yych <= 'z') goto yy280; - goto yy286; + if (yych <= '\'') goto yy283; + if (yych <= 'z') goto yy278; + goto yy284; } else { - if (yych == '}') goto yy288; - goto yy280; + if (yych == '}') goto yy286; + goto yy278; } } -yy278: +yy276: ++YYCURSOR; -#line 480 "../src/parse/lex.re" +#line 479 "../src/parse/lex.re" { if (cur == eof) { @@ -1782,34 +1772,34 @@ yy278: } goto code; } -#line 1786 "src/parse/lex.cc" -yy280: +#line 1776 "src/parse/lex.cc" +yy278: ++YYCURSOR; -yy281: -#line 494 "../src/parse/lex.re" +yy279: +#line 493 "../src/parse/lex.re" { goto code; } -#line 1794 "src/parse/lex.cc" -yy282: +#line 1784 "src/parse/lex.cc" +yy280: yyaccept = 0; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '\r') { if (yych <= '\t') { - if (yych >= '\t') goto yy290; + if (yych >= '\t') goto yy288; } else { - if (yych <= '\n') goto yy292; - if (yych >= '\r') goto yy292; + if (yych <= '\n') goto yy290; + if (yych >= '\r') goto yy290; } } else { if (yych <= ' ') { - if (yych >= ' ') goto yy290; + if (yych >= ' ') goto yy288; } else { - if (yych == '#') goto yy293; + if (yych == '#') goto yy291; } } -yy283: -#line 461 "../src/parse/lex.re" +yy281: +#line 460 "../src/parse/lex.re" { if (depth == 0) { @@ -1829,20 +1819,20 @@ yy283: cline++; goto code; } -#line 1833 "src/parse/lex.cc" -yy284: +#line 1823 "src/parse/lex.cc" +yy282: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); - if (yych == '\n') goto yy281; - goto yy297; -yy285: + if (yych == '\n') goto yy279; + goto yy295; +yy283: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); - if (yych == '\n') goto yy281; - goto yy302; -yy286: + if (yych == '\n') goto yy279; + goto yy300; +yy284: ++YYCURSOR; -#line 433 "../src/parse/lex.re" +#line 432 "../src/parse/lex.re" { if (depth == 0) { @@ -1854,10 +1844,10 @@ yy286: } goto code; } -#line 1858 "src/parse/lex.cc" -yy288: +#line 1848 "src/parse/lex.cc" +yy286: ++YYCURSOR; -#line 421 "../src/parse/lex.re" +#line 420 "../src/parse/lex.re" { if (depth == 0) { @@ -1870,19 +1860,19 @@ yy288: } goto code; } -#line 1874 "src/parse/lex.cc" -yy290: +#line 1864 "src/parse/lex.cc" +yy288: yyaccept = 2; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= 0x1F) { - if (yych == '\t') goto yy304; + if (yych == '\t') goto yy302; } else { - if (yych <= ' ') goto yy304; - if (yych == '#') goto yy293; + if (yych <= ' ') goto yy302; + if (yych == '#') goto yy291; } -yy291: +yy289: YYCURSOR -= 1; -#line 448 "../src/parse/lex.re" +#line 447 "../src/parse/lex.re" { if (depth == 0) { @@ -1896,175 +1886,175 @@ yy291: cline++; goto code; } -#line 1900 "src/parse/lex.cc" -yy292: - yych = (YYCTYPE)*++YYCURSOR; - goto yy291; -yy293: +#line 1890 "src/parse/lex.cc" +yy290: + ++YYCURSOR; + goto yy289; +yy291: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 5) YYFILL(5); yych = (YYCTYPE)*YYCURSOR; if (yybm[0+yych] & 16) { - goto yy293; + goto yy291; } - if (yych == 'l') goto yy306; -yy295: + if (yych == 'l') goto yy304; +yy293: YYCURSOR = YYMARKER; if (yyaccept <= 1) { if (yyaccept == 0) { - goto yy283; - } else { goto yy281; + } else { + goto yy279; } } else { - goto yy291; + goto yy289; } -yy296: +yy294: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; -yy297: +yy295: if (yybm[0+yych] & 32) { - goto yy296; + goto yy294; } - if (yych <= '\n') goto yy295; - if (yych >= '#') goto yy300; -yy298: + if (yych <= '\n') goto yy293; + if (yych >= '#') goto yy298; +yy296: ++YYCURSOR; -#line 491 "../src/parse/lex.re" +#line 490 "../src/parse/lex.re" { goto code; } -#line 1939 "src/parse/lex.cc" -yy300: +#line 1929 "src/parse/lex.cc" +yy298: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; - if (yych == '\n') goto yy295; - goto yy296; -yy301: + if (yych == '\n') goto yy293; + goto yy294; +yy299: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; -yy302: +yy300: if (yybm[0+yych] & 64) { - goto yy301; + goto yy299; } - if (yych <= '\n') goto yy295; - if (yych <= '\'') goto yy298; + if (yych <= '\n') goto yy293; + if (yych <= '\'') goto yy296; ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; - if (yych == '\n') goto yy295; - goto yy301; -yy304: + if (yych == '\n') goto yy293; + goto yy299; +yy302: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yych <= 0x1F) { - if (yych == '\t') goto yy304; - goto yy295; + if (yych == '\t') goto yy302; + goto yy293; } else { - if (yych <= ' ') goto yy304; - if (yych == '#') goto yy293; - goto yy295; + if (yych <= ' ') goto yy302; + if (yych == '#') goto yy291; + goto yy293; } -yy306: +yy304: yych = (YYCTYPE)*++YYCURSOR; - if (yych != 'i') goto yy295; + if (yych != 'i') goto yy293; yych = (YYCTYPE)*++YYCURSOR; - if (yych != 'n') goto yy295; + if (yych != 'n') goto yy293; yych = (YYCTYPE)*++YYCURSOR; - if (yych != 'e') goto yy295; + if (yych != 'e') goto yy293; yych = (YYCTYPE)*++YYCURSOR; - if (yych <= '0') goto yy311; - if (yych <= '9') goto yy295; - goto yy311; -yy310: + if (yych <= '0') goto yy309; + if (yych <= '9') goto yy293; + goto yy309; +yy308: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; -yy311: +yy309: if (yych <= 0x1F) { - if (yych == '\t') goto yy310; - goto yy295; + if (yych == '\t') goto yy308; + goto yy293; } else { - if (yych <= ' ') goto yy310; - if (yych <= '0') goto yy295; - if (yych >= ':') goto yy295; + if (yych <= ' ') goto yy308; + if (yych <= '0') goto yy293; + if (yych >= ':') goto yy293; YYCTXMARKER = YYCURSOR; } -yy312: +yy310: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = (YYCTYPE)*YYCURSOR; if (yybm[0+yych] & 128) { - goto yy312; + goto yy310; } if (yych <= '\f') { - if (yych <= 0x08) goto yy295; - if (yych <= '\t') goto yy314; - if (yych <= '\n') goto yy316; - goto yy295; + if (yych <= 0x08) goto yy293; + if (yych <= '\t') goto yy312; + if (yych <= '\n') goto yy314; + goto yy293; } else { - if (yych <= '\r') goto yy318; - if (yych != ' ') goto yy295; + if (yych <= '\r') goto yy316; + if (yych != ' ') goto yy293; } -yy314: +yy312: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yych <= 0x1F) { - if (yych == '\t') goto yy314; - goto yy295; + if (yych == '\t') goto yy312; + goto yy293; } else { - if (yych <= ' ') goto yy314; - if (yych == '"') goto yy319; - goto yy295; + if (yych <= ' ') goto yy312; + if (yych == '"') goto yy317; + goto yy293; } -yy316: +yy314: ++YYCURSOR; YYCURSOR = YYCTXMARKER; -#line 444 "../src/parse/lex.re" +#line 443 "../src/parse/lex.re" { set_sourceline (); goto code; } -#line 2034 "src/parse/lex.cc" -yy318: +#line 2024 "src/parse/lex.cc" +yy316: yych = (YYCTYPE)*++YYCURSOR; - if (yych == '\n') goto yy316; - goto yy295; -yy319: + if (yych == '\n') goto yy314; + goto yy293; +yy317: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = (YYCTYPE)*YYCURSOR; if (yych <= '!') { - if (yych == '\n') goto yy295; - goto yy319; + if (yych == '\n') goto yy293; + goto yy317; } else { - if (yych <= '"') goto yy321; - if (yych == '\\') goto yy322; - goto yy319; + if (yych <= '"') goto yy319; + if (yych == '\\') goto yy320; + goto yy317; } -yy321: +yy319: yych = (YYCTYPE)*++YYCURSOR; - if (yych == '\n') goto yy316; - if (yych == '\r') goto yy318; - goto yy295; -yy322: + if (yych == '\n') goto yy314; + if (yych == '\r') goto yy316; + goto yy293; +yy320: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; - if (yych == '\n') goto yy295; - goto yy319; + if (yych == '\n') goto yy293; + goto yy317; } -#line 497 "../src/parse/lex.re" +#line 496 "../src/parse/lex.re" comment: -#line 2068 "src/parse/lex.cc" +#line 2058 "src/parse/lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -2104,14 +2094,14 @@ comment: if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = (YYCTYPE)*YYCURSOR; if (yych <= ')') { - if (yych == '\n') goto yy327; + if (yych == '\n') goto yy325; } else { - if (yych <= '*') goto yy329; - if (yych == '/') goto yy330; + if (yych <= '*') goto yy327; + if (yych == '/') goto yy328; } ++YYCURSOR; -yy326: -#line 529 "../src/parse/lex.re" +yy324: +#line 528 "../src/parse/lex.re" { if (cur == eof) { @@ -2119,15 +2109,15 @@ yy326: } goto comment; } -#line 2123 "src/parse/lex.cc" -yy327: +#line 2113 "src/parse/lex.cc" +yy325: yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yybm[0+yych] & 32) { - goto yy331; + goto yy329; } - if (yych == '#') goto yy334; -yy328: -#line 520 "../src/parse/lex.re" + if (yych == '#') goto yy332; +yy326: +#line 519 "../src/parse/lex.re" { if (cur == eof) { @@ -2137,41 +2127,41 @@ yy328: cline++; goto comment; } -#line 2141 "src/parse/lex.cc" -yy329: +#line 2131 "src/parse/lex.cc" +yy327: yych = (YYCTYPE)*++YYCURSOR; - if (yych == '/') goto yy336; - goto yy326; -yy330: + if (yych == '/') goto yy334; + goto yy324; +yy328: yych = (YYCTYPE)*++YYCURSOR; - if (yych == '*') goto yy338; - goto yy326; -yy331: + if (yych == '*') goto yy336; + goto yy324; +yy329: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yybm[0+yych] & 32) { - goto yy331; + goto yy329; } - if (yych == '#') goto yy334; -yy333: + if (yych == '#') goto yy332; +yy331: YYCURSOR = YYMARKER; - goto yy328; -yy334: + goto yy326; +yy332: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 5) YYFILL(5); yych = (YYCTYPE)*YYCURSOR; if (yych <= 0x1F) { - if (yych == '\t') goto yy334; - goto yy333; + if (yych == '\t') goto yy332; + goto yy331; } else { - if (yych <= ' ') goto yy334; - if (yych == 'l') goto yy340; - goto yy333; + if (yych <= ' ') goto yy332; + if (yych == 'l') goto yy338; + goto yy331; } -yy336: +yy334: ++YYCURSOR; -#line 501 "../src/parse/lex.re" +#line 500 "../src/parse/lex.re" { if (--depth == 0) { @@ -2182,124 +2172,124 @@ yy336: goto comment; } } -#line 2186 "src/parse/lex.cc" -yy338: +#line 2176 "src/parse/lex.cc" +yy336: ++YYCURSOR; -#line 511 "../src/parse/lex.re" +#line 510 "../src/parse/lex.re" { ++depth; fatal("ambiguous /* found"); goto comment; } -#line 2195 "src/parse/lex.cc" -yy340: +#line 2185 "src/parse/lex.cc" +yy338: yych = (YYCTYPE)*++YYCURSOR; - if (yych != 'i') goto yy333; + if (yych != 'i') goto yy331; yych = (YYCTYPE)*++YYCURSOR; - if (yych != 'n') goto yy333; + if (yych != 'n') goto yy331; yych = (YYCTYPE)*++YYCURSOR; - if (yych != 'e') goto yy333; + if (yych != 'e') goto yy331; yych = (YYCTYPE)*++YYCURSOR; - if (yych <= '0') goto yy345; - if (yych <= '9') goto yy333; - goto yy345; -yy344: + if (yych <= '0') goto yy343; + if (yych <= '9') goto yy331; + goto yy343; +yy342: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; -yy345: +yy343: if (yych <= 0x1F) { - if (yych == '\t') goto yy344; - goto yy333; + if (yych == '\t') goto yy342; + goto yy331; } else { - if (yych <= ' ') goto yy344; - if (yych <= '0') goto yy333; - if (yych >= ':') goto yy333; + if (yych <= ' ') goto yy342; + if (yych <= '0') goto yy331; + if (yych >= ':') goto yy331; YYCTXMARKER = YYCURSOR; } -yy346: +yy344: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = (YYCTYPE)*YYCURSOR; if (yybm[0+yych] & 64) { - goto yy346; + goto yy344; } if (yych <= '\f') { - if (yych <= 0x08) goto yy333; - if (yych <= '\t') goto yy348; - if (yych <= '\n') goto yy350; - goto yy333; + if (yych <= 0x08) goto yy331; + if (yych <= '\t') goto yy346; + if (yych <= '\n') goto yy348; + goto yy331; } else { - if (yych <= '\r') goto yy352; - if (yych != ' ') goto yy333; + if (yych <= '\r') goto yy350; + if (yych != ' ') goto yy331; } -yy348: +yy346: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yych <= 0x1F) { - if (yych == '\t') goto yy348; - goto yy333; + if (yych == '\t') goto yy346; + goto yy331; } else { - if (yych <= ' ') goto yy348; - if (yych == '"') goto yy353; - goto yy333; + if (yych <= ' ') goto yy346; + if (yych == '"') goto yy351; + goto yy331; } -yy350: +yy348: ++YYCURSOR; YYCURSOR = YYCTXMARKER; -#line 516 "../src/parse/lex.re" +#line 515 "../src/parse/lex.re" { set_sourceline (); goto comment; } -#line 2257 "src/parse/lex.cc" -yy352: +#line 2247 "src/parse/lex.cc" +yy350: yych = (YYCTYPE)*++YYCURSOR; - if (yych == '\n') goto yy350; - goto yy333; -yy353: + if (yych == '\n') goto yy348; + goto yy331; +yy351: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = (YYCTYPE)*YYCURSOR; if (yybm[0+yych] & 128) { - goto yy353; + goto yy351; } - if (yych <= '\n') goto yy333; - if (yych >= '#') goto yy356; + if (yych <= '\n') goto yy331; + if (yych >= '#') goto yy354; yych = (YYCTYPE)*++YYCURSOR; - if (yych == '\n') goto yy350; - if (yych == '\r') goto yy352; - goto yy333; -yy356: + if (yych == '\n') goto yy348; + if (yych == '\r') goto yy350; + goto yy331; +yy354: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; - if (yych == '\n') goto yy333; - goto yy353; + if (yych == '\n') goto yy331; + goto yy351; } -#line 536 "../src/parse/lex.re" +#line 535 "../src/parse/lex.re" nextLine: -#line 2287 "src/parse/lex.cc" +#line 2277 "src/parse/lex.cc" { YYCTYPE yych; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; - if (yych == '\n') goto yy361; + if (yych == '\n') goto yy359; ++YYCURSOR; -#line 547 "../src/parse/lex.re" +#line 546 "../src/parse/lex.re" { if(cur == eof) { return 0; } goto nextLine; } -#line 2300 "src/parse/lex.cc" -yy361: +#line 2290 "src/parse/lex.cc" +yy359: ++YYCURSOR; -#line 540 "../src/parse/lex.re" +#line 539 "../src/parse/lex.re" { if(cur == eof) { return 0; } @@ -2307,9 +2297,9 @@ yy361: cline++; goto scan; } -#line 2311 "src/parse/lex.cc" +#line 2301 "src/parse/lex.cc" } -#line 552 "../src/parse/lex.re" +#line 551 "../src/parse/lex.re" } @@ -2333,44 +2323,44 @@ const RegExp *Scanner::lex_cls(bool neg) uint32_t u, l; fst: -#line 2337 "src/parse/lex.cc" +#line 2327 "src/parse/lex.cc" { YYCTYPE yych; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; - if (yych == ']') goto yy366; -#line 576 "../src/parse/lex.re" + if (yych == ']') goto yy364; +#line 575 "../src/parse/lex.re" { l = lex_cls_chr(); goto snd; } -#line 2345 "src/parse/lex.cc" -yy366: +#line 2335 "src/parse/lex.cc" +yy364: ++YYCURSOR; -#line 575 "../src/parse/lex.re" +#line 574 "../src/parse/lex.re" { goto end; } -#line 2350 "src/parse/lex.cc" +#line 2340 "src/parse/lex.cc" } -#line 577 "../src/parse/lex.re" +#line 576 "../src/parse/lex.re" snd: -#line 2356 "src/parse/lex.cc" +#line 2346 "src/parse/lex.cc" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = (YYCTYPE)*(YYMARKER = YYCURSOR); - if (yych == '-') goto yy371; -yy370: -#line 580 "../src/parse/lex.re" + if (yych == '-') goto yy369; +yy368: +#line 579 "../src/parse/lex.re" { u = l; goto add; } -#line 2365 "src/parse/lex.cc" -yy371: +#line 2355 "src/parse/lex.cc" +yy369: yych = (YYCTYPE)*++YYCURSOR; - if (yych != ']') goto yy373; + if (yych != ']') goto yy371; YYCURSOR = YYMARKER; - goto yy370; -yy373: + goto yy368; +yy371: ++YYCURSOR; YYCURSOR -= 1; -#line 581 "../src/parse/lex.re" +#line 580 "../src/parse/lex.re" { u = lex_cls_chr(); if (l > u) { @@ -2379,9 +2369,9 @@ yy373: } goto add; } -#line 2383 "src/parse/lex.cc" +#line 2373 "src/parse/lex.cc" } -#line 589 "../src/parse/lex.re" +#line 588 "../src/parse/lex.re" add: if (!(s = opts->encoding.encodeRange(l, u))) { @@ -2400,290 +2390,290 @@ uint32_t Scanner::lex_cls_chr() { tok = cur; -#line 2404 "src/parse/lex.cc" +#line 2394 "src/parse/lex.cc" { YYCTYPE yych; unsigned int yyaccept = 0; if ((YYLIMIT - YYCURSOR) < 10) YYFILL(10); yych = (YYCTYPE)*YYCURSOR; - if (yych == '\n') goto yy379; - if (yych == '\\') goto yy381; + if (yych == '\n') goto yy377; + if (yych == '\\') goto yy379; ++YYCURSOR; -#line 612 "../src/parse/lex.re" +#line 611 "../src/parse/lex.re" { return static_cast(tok[0]); } -#line 2415 "src/parse/lex.cc" -yy379: +#line 2405 "src/parse/lex.cc" +yy377: ++YYCURSOR; -#line 607 "../src/parse/lex.re" +#line 606 "../src/parse/lex.re" { fatal ((tok - pos) - tchar, "syntax error"); } -#line 2420 "src/parse/lex.cc" -yy381: - ++YYCURSOR; - if ((yych = (YYCTYPE)*YYCURSOR) <= '`') { +#line 2410 "src/parse/lex.cc" +yy379: + yych = (YYCTYPE)*++YYCURSOR; + if (yych <= '`') { if (yych <= '7') { if (yych <= ',') { - if (yych != '\n') goto yy383; + if (yych != '\n') goto yy381; } else { - if (yych <= '-') goto yy385; - if (yych <= '/') goto yy383; - if (yych <= '3') goto yy387; - goto yy389; + if (yych <= '-') goto yy383; + if (yych <= '/') goto yy381; + if (yych <= '3') goto yy385; + goto yy387; } } else { if (yych <= 'X') { - if (yych == 'U') goto yy390; - if (yych <= 'W') goto yy383; - goto yy392; + if (yych == 'U') goto yy388; + if (yych <= 'W') goto yy381; + goto yy390; } else { - if (yych <= '[') goto yy383; - if (yych <= '\\') goto yy393; - if (yych <= ']') goto yy395; - goto yy383; + if (yych <= '[') goto yy381; + if (yych <= '\\') goto yy391; + if (yych <= ']') goto yy393; + goto yy381; } } } else { if (yych <= 'q') { if (yych <= 'e') { - if (yych <= 'a') goto yy397; - if (yych <= 'b') goto yy399; - goto yy383; + if (yych <= 'a') goto yy395; + if (yych <= 'b') goto yy397; + goto yy381; } else { - if (yych <= 'f') goto yy401; - if (yych == 'n') goto yy403; - goto yy383; + if (yych <= 'f') goto yy399; + if (yych == 'n') goto yy401; + goto yy381; } } else { if (yych <= 'u') { - if (yych <= 'r') goto yy405; - if (yych <= 's') goto yy383; - if (yych <= 't') goto yy407; - goto yy392; + if (yych <= 'r') goto yy403; + if (yych <= 's') goto yy381; + if (yych <= 't') goto yy405; + goto yy390; } else { - if (yych <= 'v') goto yy409; - if (yych == 'x') goto yy411; - goto yy383; + if (yych <= 'v') goto yy407; + if (yych == 'x') goto yy409; + goto yy381; } } } -#line 610 "../src/parse/lex.re" +#line 609 "../src/parse/lex.re" { fatal ((tok - pos) - tchar, "syntax error in escape sequence"); } -#line 2471 "src/parse/lex.cc" -yy383: +#line 2461 "src/parse/lex.cc" +yy381: ++YYCURSOR; -#line 625 "../src/parse/lex.re" +#line 624 "../src/parse/lex.re" { warn.useless_escape(tline, tok - pos, tok[1]); return static_cast(tok[1]); } -#line 2479 "src/parse/lex.cc" -yy385: +#line 2469 "src/parse/lex.cc" +yy383: ++YYCURSOR; -#line 623 "../src/parse/lex.re" +#line 622 "../src/parse/lex.re" { return static_cast('-'); } -#line 2484 "src/parse/lex.cc" -yy387: +#line 2474 "src/parse/lex.cc" +yy385: yyaccept = 0; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); - if (yych <= '/') goto yy388; - if (yych <= '7') goto yy412; -yy388: -#line 609 "../src/parse/lex.re" + if (yych <= '/') goto yy386; + if (yych <= '7') goto yy410; +yy386: +#line 608 "../src/parse/lex.re" { fatal ((tok - pos) - tchar, "syntax error in octal escape sequence"); } -#line 2493 "src/parse/lex.cc" -yy389: - yych = (YYCTYPE)*++YYCURSOR; - goto yy388; -yy390: +#line 2483 "src/parse/lex.cc" +yy387: + ++YYCURSOR; + goto yy386; +yy388: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '@') { - if (yych <= '/') goto yy391; - if (yych <= '9') goto yy414; + if (yych <= '/') goto yy389; + if (yych <= '9') goto yy412; } else { - if (yych <= 'F') goto yy414; - if (yych <= '`') goto yy391; - if (yych <= 'f') goto yy414; + if (yych <= 'F') goto yy412; + if (yych <= '`') goto yy389; + if (yych <= 'f') goto yy412; } -yy391: -#line 608 "../src/parse/lex.re" +yy389: +#line 607 "../src/parse/lex.re" { fatal ((tok - pos) - tchar, "syntax error in hexadecimal escape sequence"); } -#line 2511 "src/parse/lex.cc" -yy392: +#line 2501 "src/parse/lex.cc" +yy390: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '@') { - if (yych <= '/') goto yy391; - if (yych <= '9') goto yy415; - goto yy391; + if (yych <= '/') goto yy389; + if (yych <= '9') goto yy413; + goto yy389; } else { - if (yych <= 'F') goto yy415; - if (yych <= '`') goto yy391; - if (yych <= 'f') goto yy415; - goto yy391; + if (yych <= 'F') goto yy413; + if (yych <= '`') goto yy389; + if (yych <= 'f') goto yy413; + goto yy389; } -yy393: +yy391: ++YYCURSOR; -#line 622 "../src/parse/lex.re" +#line 621 "../src/parse/lex.re" { return static_cast('\\'); } -#line 2529 "src/parse/lex.cc" -yy395: +#line 2519 "src/parse/lex.cc" +yy393: ++YYCURSOR; -#line 624 "../src/parse/lex.re" +#line 623 "../src/parse/lex.re" { return static_cast(']'); } -#line 2534 "src/parse/lex.cc" +#line 2524 "src/parse/lex.cc" +yy395: + ++YYCURSOR; +#line 614 "../src/parse/lex.re" + { return static_cast('\a'); } +#line 2529 "src/parse/lex.cc" yy397: ++YYCURSOR; #line 615 "../src/parse/lex.re" - { return static_cast('\a'); } -#line 2539 "src/parse/lex.cc" + { return static_cast('\b'); } +#line 2534 "src/parse/lex.cc" yy399: ++YYCURSOR; #line 616 "../src/parse/lex.re" - { return static_cast('\b'); } -#line 2544 "src/parse/lex.cc" + { return static_cast('\f'); } +#line 2539 "src/parse/lex.cc" yy401: ++YYCURSOR; #line 617 "../src/parse/lex.re" - { return static_cast('\f'); } -#line 2549 "src/parse/lex.cc" + { return static_cast('\n'); } +#line 2544 "src/parse/lex.cc" yy403: ++YYCURSOR; #line 618 "../src/parse/lex.re" - { return static_cast('\n'); } -#line 2554 "src/parse/lex.cc" + { return static_cast('\r'); } +#line 2549 "src/parse/lex.cc" yy405: ++YYCURSOR; #line 619 "../src/parse/lex.re" - { return static_cast('\r'); } -#line 2559 "src/parse/lex.cc" + { return static_cast('\t'); } +#line 2554 "src/parse/lex.cc" yy407: ++YYCURSOR; #line 620 "../src/parse/lex.re" - { return static_cast('\t'); } -#line 2564 "src/parse/lex.cc" -yy409: - ++YYCURSOR; -#line 621 "../src/parse/lex.re" { return static_cast('\v'); } -#line 2569 "src/parse/lex.cc" -yy411: +#line 2559 "src/parse/lex.cc" +yy409: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '@') { - if (yych <= '/') goto yy391; - if (yych <= '9') goto yy416; - goto yy391; + if (yych <= '/') goto yy389; + if (yych <= '9') goto yy414; + goto yy389; } else { - if (yych <= 'F') goto yy416; - if (yych <= '`') goto yy391; - if (yych <= 'f') goto yy416; - goto yy391; + if (yych <= 'F') goto yy414; + if (yych <= '`') goto yy389; + if (yych <= 'f') goto yy414; + goto yy389; } -yy412: +yy410: yych = (YYCTYPE)*++YYCURSOR; - if (yych <= '/') goto yy413; - if (yych <= '7') goto yy417; -yy413: + if (yych <= '/') goto yy411; + if (yych <= '7') goto yy415; +yy411: YYCURSOR = YYMARKER; if (yyaccept == 0) { - goto yy388; + goto yy386; } else { - goto yy391; + goto yy389; } -yy414: +yy412: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { - if (yych <= '/') goto yy413; - if (yych <= '9') goto yy419; - goto yy413; + if (yych <= '/') goto yy411; + if (yych <= '9') goto yy417; + goto yy411; } else { - if (yych <= 'F') goto yy419; - if (yych <= '`') goto yy413; - if (yych <= 'f') goto yy419; - goto yy413; + if (yych <= 'F') goto yy417; + if (yych <= '`') goto yy411; + if (yych <= 'f') goto yy417; + goto yy411; } -yy415: +yy413: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { - if (yych <= '/') goto yy413; - if (yych <= '9') goto yy420; - goto yy413; + if (yych <= '/') goto yy411; + if (yych <= '9') goto yy418; + goto yy411; } else { - if (yych <= 'F') goto yy420; - if (yych <= '`') goto yy413; - if (yych <= 'f') goto yy420; - goto yy413; + if (yych <= 'F') goto yy418; + if (yych <= '`') goto yy411; + if (yych <= 'f') goto yy418; + goto yy411; } -yy416: +yy414: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { - if (yych <= '/') goto yy413; - if (yych <= '9') goto yy421; - goto yy413; + if (yych <= '/') goto yy411; + if (yych <= '9') goto yy419; + goto yy411; } else { - if (yych <= 'F') goto yy421; - if (yych <= '`') goto yy413; - if (yych <= 'f') goto yy421; - goto yy413; + if (yych <= 'F') goto yy419; + if (yych <= '`') goto yy411; + if (yych <= 'f') goto yy419; + goto yy411; } -yy417: +yy415: ++YYCURSOR; -#line 614 "../src/parse/lex.re" +#line 613 "../src/parse/lex.re" { return unesc_oct(tok, cur); } -#line 2634 "src/parse/lex.cc" -yy419: +#line 2624 "src/parse/lex.cc" +yy417: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { - if (yych <= '/') goto yy413; - if (yych <= '9') goto yy423; - goto yy413; + if (yych <= '/') goto yy411; + if (yych <= '9') goto yy421; + goto yy411; } else { - if (yych <= 'F') goto yy423; - if (yych <= '`') goto yy413; - if (yych <= 'f') goto yy423; - goto yy413; + if (yych <= 'F') goto yy421; + if (yych <= '`') goto yy411; + if (yych <= 'f') goto yy421; + goto yy411; } -yy420: +yy418: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { - if (yych <= '/') goto yy413; - if (yych <= '9') goto yy416; - goto yy413; + if (yych <= '/') goto yy411; + if (yych <= '9') goto yy414; + goto yy411; } else { - if (yych <= 'F') goto yy416; - if (yych <= '`') goto yy413; - if (yych <= 'f') goto yy416; - goto yy413; + if (yych <= 'F') goto yy414; + if (yych <= '`') goto yy411; + if (yych <= 'f') goto yy414; + goto yy411; } -yy421: +yy419: ++YYCURSOR; -#line 613 "../src/parse/lex.re" +#line 612 "../src/parse/lex.re" { return unesc_hex(tok, cur); } -#line 2663 "src/parse/lex.cc" -yy423: +#line 2653 "src/parse/lex.cc" +yy421: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { - if (yych <= '/') goto yy413; - if (yych >= ':') goto yy413; + if (yych <= '/') goto yy411; + if (yych >= ':') goto yy411; } else { - if (yych <= 'F') goto yy424; - if (yych <= '`') goto yy413; - if (yych >= 'g') goto yy413; + if (yych <= 'F') goto yy422; + if (yych <= '`') goto yy411; + if (yych >= 'g') goto yy411; } -yy424: - ++YYCURSOR; - if ((yych = (YYCTYPE)*YYCURSOR) <= '@') { - if (yych <= '/') goto yy413; - if (yych <= '9') goto yy415; - goto yy413; +yy422: + yych = (YYCTYPE)*++YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy411; + if (yych <= '9') goto yy413; + goto yy411; } else { - if (yych <= 'F') goto yy415; - if (yych <= '`') goto yy413; - if (yych <= 'f') goto yy415; - goto yy413; + if (yych <= 'F') goto yy413; + if (yych <= '`') goto yy411; + if (yych <= 'f') goto yy413; + goto yy411; } } -#line 629 "../src/parse/lex.re" +#line 628 "../src/parse/lex.re" } @@ -2692,282 +2682,282 @@ uint32_t Scanner::lex_str_chr(char quote, bool &end) end = false; tok = cur; -#line 2696 "src/parse/lex.cc" +#line 2686 "src/parse/lex.cc" { YYCTYPE yych; unsigned int yyaccept = 0; if ((YYLIMIT - YYCURSOR) < 10) YYFILL(10); yych = (YYCTYPE)*YYCURSOR; - if (yych == '\n') goto yy429; - if (yych == '\\') goto yy431; + if (yych == '\n') goto yy427; + if (yych == '\\') goto yy429; ++YYCURSOR; -#line 642 "../src/parse/lex.re" +#line 641 "../src/parse/lex.re" { end = tok[0] == quote; return static_cast(tok[0]); } -#line 2710 "src/parse/lex.cc" -yy429: +#line 2700 "src/parse/lex.cc" +yy427: ++YYCURSOR; -#line 637 "../src/parse/lex.re" +#line 636 "../src/parse/lex.re" { fatal ((tok - pos) - tchar, "syntax error"); } -#line 2715 "src/parse/lex.cc" -yy431: - ++YYCURSOR; - if ((yych = (YYCTYPE)*YYCURSOR) <= 'a') { +#line 2705 "src/parse/lex.cc" +yy429: + yych = (YYCTYPE)*++YYCURSOR; + if (yych <= 'a') { if (yych <= 'T') { if (yych <= '/') { - if (yych != '\n') goto yy433; + if (yych != '\n') goto yy431; } else { - if (yych <= '3') goto yy435; - if (yych <= '7') goto yy437; - goto yy433; + if (yych <= '3') goto yy433; + if (yych <= '7') goto yy435; + goto yy431; } } else { if (yych <= 'X') { - if (yych <= 'U') goto yy438; - if (yych <= 'W') goto yy433; - goto yy440; + if (yych <= 'U') goto yy436; + if (yych <= 'W') goto yy431; + goto yy438; } else { - if (yych == '\\') goto yy441; - if (yych <= '`') goto yy433; - goto yy443; + if (yych == '\\') goto yy439; + if (yych <= '`') goto yy431; + goto yy441; } } } else { if (yych <= 'r') { if (yych <= 'f') { - if (yych <= 'b') goto yy445; - if (yych <= 'e') goto yy433; - goto yy447; + if (yych <= 'b') goto yy443; + if (yych <= 'e') goto yy431; + goto yy445; } else { - if (yych == 'n') goto yy449; - if (yych <= 'q') goto yy433; - goto yy451; + if (yych == 'n') goto yy447; + if (yych <= 'q') goto yy431; + goto yy449; } } else { if (yych <= 'u') { - if (yych <= 's') goto yy433; - if (yych <= 't') goto yy453; - goto yy440; + if (yych <= 's') goto yy431; + if (yych <= 't') goto yy451; + goto yy438; } else { - if (yych <= 'v') goto yy455; - if (yych == 'x') goto yy457; - goto yy433; + if (yych <= 'v') goto yy453; + if (yych == 'x') goto yy455; + goto yy431; } } } -#line 640 "../src/parse/lex.re" +#line 639 "../src/parse/lex.re" { fatal ((tok - pos) - tchar, "syntax error in escape sequence"); } -#line 2763 "src/parse/lex.cc" -yy433: +#line 2753 "src/parse/lex.cc" +yy431: ++YYCURSOR; -#line 656 "../src/parse/lex.re" +#line 655 "../src/parse/lex.re" { if (tok[1] != quote) { warn.useless_escape(tline, tok - pos, tok[1]); } return static_cast(tok[1]); } -#line 2773 "src/parse/lex.cc" -yy435: +#line 2763 "src/parse/lex.cc" +yy433: yyaccept = 0; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); - if (yych <= '/') goto yy436; - if (yych <= '7') goto yy458; -yy436: -#line 639 "../src/parse/lex.re" + if (yych <= '/') goto yy434; + if (yych <= '7') goto yy456; +yy434: +#line 638 "../src/parse/lex.re" { fatal ((tok - pos) - tchar, "syntax error in octal escape sequence"); } -#line 2782 "src/parse/lex.cc" -yy437: - yych = (YYCTYPE)*++YYCURSOR; - goto yy436; -yy438: +#line 2772 "src/parse/lex.cc" +yy435: + ++YYCURSOR; + goto yy434; +yy436: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '@') { - if (yych <= '/') goto yy439; - if (yych <= '9') goto yy460; + if (yych <= '/') goto yy437; + if (yych <= '9') goto yy458; } else { - if (yych <= 'F') goto yy460; - if (yych <= '`') goto yy439; - if (yych <= 'f') goto yy460; + if (yych <= 'F') goto yy458; + if (yych <= '`') goto yy437; + if (yych <= 'f') goto yy458; } -yy439: -#line 638 "../src/parse/lex.re" +yy437: +#line 637 "../src/parse/lex.re" { fatal ((tok - pos) - tchar, "syntax error in hexadecimal escape sequence"); } -#line 2800 "src/parse/lex.cc" -yy440: +#line 2790 "src/parse/lex.cc" +yy438: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '@') { - if (yych <= '/') goto yy439; - if (yych <= '9') goto yy461; - goto yy439; + if (yych <= '/') goto yy437; + if (yych <= '9') goto yy459; + goto yy437; } else { - if (yych <= 'F') goto yy461; - if (yych <= '`') goto yy439; - if (yych <= 'f') goto yy461; - goto yy439; + if (yych <= 'F') goto yy459; + if (yych <= '`') goto yy437; + if (yych <= 'f') goto yy459; + goto yy437; } -yy441: +yy439: ++YYCURSOR; -#line 655 "../src/parse/lex.re" +#line 654 "../src/parse/lex.re" { return static_cast('\\'); } -#line 2818 "src/parse/lex.cc" +#line 2808 "src/parse/lex.cc" +yy441: + ++YYCURSOR; +#line 647 "../src/parse/lex.re" + { return static_cast('\a'); } +#line 2813 "src/parse/lex.cc" yy443: ++YYCURSOR; #line 648 "../src/parse/lex.re" - { return static_cast('\a'); } -#line 2823 "src/parse/lex.cc" + { return static_cast('\b'); } +#line 2818 "src/parse/lex.cc" yy445: ++YYCURSOR; #line 649 "../src/parse/lex.re" - { return static_cast('\b'); } -#line 2828 "src/parse/lex.cc" + { return static_cast('\f'); } +#line 2823 "src/parse/lex.cc" yy447: ++YYCURSOR; #line 650 "../src/parse/lex.re" - { return static_cast('\f'); } -#line 2833 "src/parse/lex.cc" + { return static_cast('\n'); } +#line 2828 "src/parse/lex.cc" yy449: ++YYCURSOR; #line 651 "../src/parse/lex.re" - { return static_cast('\n'); } -#line 2838 "src/parse/lex.cc" + { return static_cast('\r'); } +#line 2833 "src/parse/lex.cc" yy451: ++YYCURSOR; #line 652 "../src/parse/lex.re" - { return static_cast('\r'); } -#line 2843 "src/parse/lex.cc" + { return static_cast('\t'); } +#line 2838 "src/parse/lex.cc" yy453: ++YYCURSOR; #line 653 "../src/parse/lex.re" - { return static_cast('\t'); } -#line 2848 "src/parse/lex.cc" -yy455: - ++YYCURSOR; -#line 654 "../src/parse/lex.re" { return static_cast('\v'); } -#line 2853 "src/parse/lex.cc" -yy457: +#line 2843 "src/parse/lex.cc" +yy455: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '@') { - if (yych <= '/') goto yy439; - if (yych <= '9') goto yy462; - goto yy439; + if (yych <= '/') goto yy437; + if (yych <= '9') goto yy460; + goto yy437; } else { - if (yych <= 'F') goto yy462; - if (yych <= '`') goto yy439; - if (yych <= 'f') goto yy462; - goto yy439; + if (yych <= 'F') goto yy460; + if (yych <= '`') goto yy437; + if (yych <= 'f') goto yy460; + goto yy437; } -yy458: +yy456: yych = (YYCTYPE)*++YYCURSOR; - if (yych <= '/') goto yy459; - if (yych <= '7') goto yy463; -yy459: + if (yych <= '/') goto yy457; + if (yych <= '7') goto yy461; +yy457: YYCURSOR = YYMARKER; if (yyaccept == 0) { - goto yy436; + goto yy434; } else { - goto yy439; + goto yy437; } -yy460: +yy458: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { - if (yych <= '/') goto yy459; - if (yych <= '9') goto yy465; - goto yy459; + if (yych <= '/') goto yy457; + if (yych <= '9') goto yy463; + goto yy457; } else { - if (yych <= 'F') goto yy465; - if (yych <= '`') goto yy459; - if (yych <= 'f') goto yy465; - goto yy459; + if (yych <= 'F') goto yy463; + if (yych <= '`') goto yy457; + if (yych <= 'f') goto yy463; + goto yy457; } -yy461: +yy459: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { - if (yych <= '/') goto yy459; - if (yych <= '9') goto yy466; - goto yy459; + if (yych <= '/') goto yy457; + if (yych <= '9') goto yy464; + goto yy457; } else { - if (yych <= 'F') goto yy466; - if (yych <= '`') goto yy459; - if (yych <= 'f') goto yy466; - goto yy459; + if (yych <= 'F') goto yy464; + if (yych <= '`') goto yy457; + if (yych <= 'f') goto yy464; + goto yy457; } -yy462: +yy460: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { - if (yych <= '/') goto yy459; - if (yych <= '9') goto yy467; - goto yy459; + if (yych <= '/') goto yy457; + if (yych <= '9') goto yy465; + goto yy457; } else { - if (yych <= 'F') goto yy467; - if (yych <= '`') goto yy459; - if (yych <= 'f') goto yy467; - goto yy459; + if (yych <= 'F') goto yy465; + if (yych <= '`') goto yy457; + if (yych <= 'f') goto yy465; + goto yy457; } -yy463: +yy461: ++YYCURSOR; -#line 647 "../src/parse/lex.re" +#line 646 "../src/parse/lex.re" { return unesc_oct(tok, cur); } -#line 2918 "src/parse/lex.cc" -yy465: +#line 2908 "src/parse/lex.cc" +yy463: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { - if (yych <= '/') goto yy459; - if (yych <= '9') goto yy469; - goto yy459; + if (yych <= '/') goto yy457; + if (yych <= '9') goto yy467; + goto yy457; } else { - if (yych <= 'F') goto yy469; - if (yych <= '`') goto yy459; - if (yych <= 'f') goto yy469; - goto yy459; + if (yych <= 'F') goto yy467; + if (yych <= '`') goto yy457; + if (yych <= 'f') goto yy467; + goto yy457; } -yy466: +yy464: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { - if (yych <= '/') goto yy459; - if (yych <= '9') goto yy462; - goto yy459; + if (yych <= '/') goto yy457; + if (yych <= '9') goto yy460; + goto yy457; } else { - if (yych <= 'F') goto yy462; - if (yych <= '`') goto yy459; - if (yych <= 'f') goto yy462; - goto yy459; + if (yych <= 'F') goto yy460; + if (yych <= '`') goto yy457; + if (yych <= 'f') goto yy460; + goto yy457; } -yy467: +yy465: ++YYCURSOR; -#line 646 "../src/parse/lex.re" +#line 645 "../src/parse/lex.re" { return unesc_hex(tok, cur); } -#line 2947 "src/parse/lex.cc" -yy469: +#line 2937 "src/parse/lex.cc" +yy467: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { - if (yych <= '/') goto yy459; - if (yych >= ':') goto yy459; + if (yych <= '/') goto yy457; + if (yych >= ':') goto yy457; } else { - if (yych <= 'F') goto yy470; - if (yych <= '`') goto yy459; - if (yych >= 'g') goto yy459; + if (yych <= 'F') goto yy468; + if (yych <= '`') goto yy457; + if (yych >= 'g') goto yy457; } -yy470: - ++YYCURSOR; - if ((yych = (YYCTYPE)*YYCURSOR) <= '@') { - if (yych <= '/') goto yy459; - if (yych <= '9') goto yy461; - goto yy459; +yy468: + yych = (YYCTYPE)*++YYCURSOR; + if (yych <= '@') { + if (yych <= '/') goto yy457; + if (yych <= '9') goto yy459; + goto yy457; } else { - if (yych <= 'F') goto yy461; - if (yych <= '`') goto yy459; - if (yych <= 'f') goto yy461; - goto yy459; + if (yych <= 'F') goto yy459; + if (yych <= '`') goto yy457; + if (yych <= 'f') goto yy459; + goto yy457; } } -#line 662 "../src/parse/lex.re" +#line 661 "../src/parse/lex.re" } @@ -2988,7 +2978,7 @@ void Scanner::set_sourceline () sourceline: tok = cur; -#line 2992 "src/parse/lex.cc" +#line 2982 "src/parse/lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -3028,23 +3018,23 @@ sourceline: if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = (YYCTYPE)*YYCURSOR; if (yych <= '!') { - if (yych == '\n') goto yy475; + if (yych == '\n') goto yy473; } else { - if (yych <= '"') goto yy477; - if (yych <= '0') goto yy473; - if (yych <= '9') goto yy478; + if (yych <= '"') goto yy475; + if (yych <= '0') goto yy471; + if (yych <= '9') goto yy476; } -yy473: +yy471: ++YYCURSOR; -yy474: -#line 705 "../src/parse/lex.re" +yy472: +#line 704 "../src/parse/lex.re" { goto sourceline; } -#line 3045 "src/parse/lex.cc" -yy475: +#line 3035 "src/parse/lex.cc" +yy473: ++YYCURSOR; -#line 693 "../src/parse/lex.re" +#line 692 "../src/parse/lex.re" { if (cur == eof) { @@ -3057,19 +3047,19 @@ yy475: tok = cur; return; } -#line 3061 "src/parse/lex.cc" -yy477: +#line 3051 "src/parse/lex.cc" +yy475: yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); - if (yych == '\n') goto yy474; - goto yy482; -yy478: + if (yych == '\n') goto yy472; + goto yy480; +yy476: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yybm[0+yych] & 64) { - goto yy478; + goto yy476; } -#line 682 "../src/parse/lex.re" +#line 681 "../src/parse/lex.re" { if (!s_to_u32_unsafe (tok, cur, cline)) { @@ -3077,37 +3067,37 @@ yy478: } goto sourceline; } -#line 3081 "src/parse/lex.cc" -yy481: +#line 3071 "src/parse/lex.cc" +yy479: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; -yy482: +yy480: if (yybm[0+yych] & 128) { - goto yy481; + goto yy479; } - if (yych <= '\n') goto yy483; - if (yych <= '"') goto yy484; - goto yy486; -yy483: + if (yych <= '\n') goto yy481; + if (yych <= '"') goto yy482; + goto yy484; +yy481: YYCURSOR = YYMARKER; - goto yy474; -yy484: + goto yy472; +yy482: ++YYCURSOR; -#line 689 "../src/parse/lex.re" +#line 688 "../src/parse/lex.re" { escape (in.file_name, std::string (tok + 1, tok_len () - 2)); // -2 to omit quotes goto sourceline; } -#line 3103 "src/parse/lex.cc" -yy486: +#line 3093 "src/parse/lex.cc" +yy484: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; - if (yych == '\n') goto yy483; - goto yy481; + if (yych == '\n') goto yy481; + goto yy479; } -#line 708 "../src/parse/lex.re" +#line 707 "../src/parse/lex.re" } diff --git a/re2c/bootstrap/src/parse/lex_conf.cc b/re2c/bootstrap/src/parse/lex_conf.cc index 60fe2393..f35deb2e 100644 --- a/re2c/bootstrap/src/parse/lex_conf.cc +++ b/re2c/bootstrap/src/parse/lex_conf.cc @@ -1,11 +1,9 @@ -/* Generated by re2c 0.16 on Mon Dec 12 13:39:55 2016 */ +/* Generated by re2c 0.16 on Sun Dec 18 11:55:22 2016 */ #line 1 "../src/parse/lex_conf.re" #include "src/util/c99_stdint.h" #include #include "src/codegen/output.h" -#include "src/conf/opt.h" -#include "src/globals.h" #include "src/ir/regexp/encoding/enc.h" #include "src/parse/scanner.h" #include "src/util/s_to_n32_unsafe.h" @@ -14,14 +12,14 @@ namespace re2c { // global re2c config (affects the whole file) -#line 36 "../src/parse/lex_conf.re" +#line 34 "../src/parse/lex_conf.re" void Scanner::lex_conf () { tok = cur; -#line 25 "src/parse/lex_conf.cc" +#line 23 "src/parse/lex_conf.cc" { unsigned char yych; unsigned int yyaccept = 0; @@ -76,9 +74,9 @@ void Scanner::lex_conf () yy2: ++cur; yy3: -#line 42 "../src/parse/lex_conf.re" +#line 40 "../src/parse/lex_conf.re" { fatal ((tok - pos) - tchar, "unrecognized configuration"); } -#line 82 "src/parse/lex_conf.cc" +#line 80 "src/parse/lex_conf.cc" yy4: yyaccept = 0; yych = (unsigned char)*(ptr = ++cur); @@ -565,46 +563,46 @@ yy89: goto yy14; yy90: ++cur; -#line 67 "../src/parse/lex_conf.re" +#line 65 "../src/parse/lex_conf.re" { lex_conf_enc(Enc::UTF8); return; } -#line 571 "src/parse/lex_conf.cc" +#line 569 "src/parse/lex_conf.cc" yy92: ++cur; -#line 44 "../src/parse/lex_conf.re" +#line 42 "../src/parse/lex_conf.re" { opts.set_target(opt_t::DOT); lex_conf_semicolon(); return; } -#line 576 "src/parse/lex_conf.cc" +#line 574 "src/parse/lex_conf.cc" yy94: ++cur; -#line 51 "../src/parse/lex_conf.re" +#line 49 "../src/parse/lex_conf.re" { opts.set_FFlag(lex_conf_bool()); return; } -#line 581 "src/parse/lex_conf.cc" +#line 579 "src/parse/lex_conf.cc" yy96: ++cur; -#line 45 "../src/parse/lex_conf.re" +#line 43 "../src/parse/lex_conf.re" { opts.set_target(opt_t::SKELETON); lex_conf_semicolon(); return; } -#line 586 "src/parse/lex_conf.cc" +#line 584 "src/parse/lex_conf.cc" yy98: ++cur; -#line 56 "../src/parse/lex_conf.re" +#line 54 "../src/parse/lex_conf.re" { opts.set_tags(lex_conf_bool()); return; } -#line 591 "src/parse/lex_conf.cc" +#line 589 "src/parse/lex_conf.cc" yy100: yyaccept = 1; yych = (unsigned char)*(ptr = ++cur); if (yych == 'i') goto yy149; yy101: -#line 47 "../src/parse/lex_conf.re" +#line 45 "../src/parse/lex_conf.re" { opts.set_bFlag(lex_conf_bool()); return; } -#line 599 "src/parse/lex_conf.cc" +#line 597 "src/parse/lex_conf.cc" yy102: yyaccept = 2; yych = (unsigned char)*(ptr = ++cur); if (yych == 'a') goto yy150; if (yych == 'o') goto yy151; yy103: -#line 48 "../src/parse/lex_conf.re" +#line 46 "../src/parse/lex_conf.re" { opts.set_cFlag(lex_conf_bool()); return; } -#line 608 "src/parse/lex_conf.cc" +#line 606 "src/parse/lex_conf.cc" yy104: yyaccept = 3; yych = (unsigned char)*(ptr = ++cur); @@ -612,9 +610,9 @@ yy104: if (yych <= 'e') goto yy152; if (yych <= 'f') goto yy153; yy105: -#line 49 "../src/parse/lex_conf.re" +#line 47 "../src/parse/lex_conf.re" { opts.set_dFlag(lex_conf_bool()); return; } -#line 618 "src/parse/lex_conf.cc" +#line 616 "src/parse/lex_conf.cc" yy106: yyaccept = 4; yych = (unsigned char)*(ptr = ++cur); @@ -625,30 +623,30 @@ yy106: if (yych <= 'n') goto yy156; } yy107: -#line 63 "../src/parse/lex_conf.re" +#line 61 "../src/parse/lex_conf.re" { lex_conf_enc(Enc::EBCDIC); return; } -#line 631 "src/parse/lex_conf.cc" +#line 629 "src/parse/lex_conf.cc" yy108: yyaccept = 5; yych = (unsigned char)*(ptr = ++cur); if (yych == 'l') goto yy157; yy109: -#line 50 "../src/parse/lex_conf.re" +#line 48 "../src/parse/lex_conf.re" { opts.set_fFlag(lex_conf_bool()); return; } -#line 639 "src/parse/lex_conf.cc" +#line 637 "src/parse/lex_conf.cc" yy110: ++cur; -#line 52 "../src/parse/lex_conf.re" +#line 50 "../src/parse/lex_conf.re" { opts.set_gFlag(lex_conf_bool()); return; } -#line 644 "src/parse/lex_conf.cc" +#line 642 "src/parse/lex_conf.cc" yy112: yyaccept = 6; yych = (unsigned char)*(ptr = ++cur); if (yych == 'n') goto yy158; yy113: -#line 53 "../src/parse/lex_conf.re" +#line 51 "../src/parse/lex_conf.re" { opts.set_iFlag(lex_conf_bool()); return; } -#line 652 "src/parse/lex_conf.cc" +#line 650 "src/parse/lex_conf.cc" yy114: yych = (unsigned char)*++cur; if (yych == 'e') goto yy159; @@ -659,57 +657,57 @@ yy115: yych = (unsigned char)*(ptr = ++cur); if (yych == 'u') goto yy161; yy116: -#line 69 "../src/parse/lex_conf.re" +#line 67 "../src/parse/lex_conf.re" { opts.set_output_file(lex_conf_string()); return; } -#line 665 "src/parse/lex_conf.cc" +#line 663 "src/parse/lex_conf.cc" yy117: yyaccept = 8; yych = (unsigned char)*(ptr = ++cur); if (yych == 'e') goto yy162; yy118: -#line 54 "../src/parse/lex_conf.re" +#line 52 "../src/parse/lex_conf.re" { opts.set_rFlag(lex_conf_bool()); return; } -#line 673 "src/parse/lex_conf.cc" +#line 671 "src/parse/lex_conf.cc" yy119: yyaccept = 9; yych = (unsigned char)*(ptr = ++cur); if (yych == 'k') goto yy163; if (yych == 't') goto yy164; yy120: -#line 55 "../src/parse/lex_conf.re" +#line 53 "../src/parse/lex_conf.re" { opts.set_sFlag(lex_conf_bool()); return; } -#line 682 "src/parse/lex_conf.cc" +#line 680 "src/parse/lex_conf.cc" yy121: yyaccept = 10; yych = (unsigned char)*(ptr = ++cur); if (yych == 'a') goto yy165; if (yych == 'y') goto yy166; yy122: -#line 70 "../src/parse/lex_conf.re" +#line 68 "../src/parse/lex_conf.re" { opts.set_header_file(lex_conf_string()); return; } -#line 691 "src/parse/lex_conf.cc" +#line 689 "src/parse/lex_conf.cc" yy123: yyaccept = 11; yych = (unsigned char)*(ptr = ++cur); if (yych == 'n') goto yy167; if (yych == 't') goto yy168; yy124: -#line 64 "../src/parse/lex_conf.re" +#line 62 "../src/parse/lex_conf.re" { lex_conf_enc(Enc::UTF32); return; } -#line 700 "src/parse/lex_conf.cc" +#line 698 "src/parse/lex_conf.cc" yy125: yyaccept = 12; yych = (unsigned char)*(ptr = ++cur); if (yych == 'i') goto yy169; yy126: -#line 65 "../src/parse/lex_conf.re" +#line 63 "../src/parse/lex_conf.re" { lex_conf_enc(Enc::UCS2); return; } -#line 708 "src/parse/lex_conf.cc" +#line 706 "src/parse/lex_conf.cc" yy127: ++cur; -#line 66 "../src/parse/lex_conf.re" +#line 64 "../src/parse/lex_conf.re" { lex_conf_enc(Enc::UTF16); return; } -#line 713 "src/parse/lex_conf.cc" +#line 711 "src/parse/lex_conf.cc" yy129: yych = (unsigned char)*++cur; if (yych <= 'r') goto yy14; @@ -932,9 +930,9 @@ yy180: goto yy14; yy181: ++cur; -#line 103 "../src/parse/lex_conf.re" +#line 101 "../src/parse/lex_conf.re" { opts.set_yybmHexTable (lex_conf_bool()); return; } -#line 938 "src/parse/lex_conf.cc" +#line 936 "src/parse/lex_conf.cc" yy183: yych = (unsigned char)*++cur; if (yych == 'v') goto yy231; @@ -968,9 +966,9 @@ yy190: yych = (unsigned char)*(ptr = ++cur); if (yych == '@') goto yy239; yy191: -#line 87 "../src/parse/lex_conf.re" +#line 85 "../src/parse/lex_conf.re" { opts.set_condGoto (lex_conf_string ()); return; } -#line 974 "src/parse/lex_conf.cc" +#line 972 "src/parse/lex_conf.cc" yy192: yych = (unsigned char)*++cur; if (yych == 'r') goto yy240; @@ -1015,7 +1013,7 @@ yy199: if (yych == '-') goto yy257; goto yy14; yy200: - yych = (unsigned char)*++cur; + ++cur; goto yy107; yy201: yych = (unsigned char)*++cur; @@ -1149,9 +1147,9 @@ yy231: goto yy14; yy232: ++cur; -#line 153 "../src/parse/lex_conf.re" +#line 151 "../src/parse/lex_conf.re" { opts.set_bEmitYYCh (lex_conf_bool()); return; } -#line 1155 "src/parse/lex_conf.cc" +#line 1153 "src/parse/lex_conf.cc" yy234: yych = (unsigned char)*++cur; if (yych == 'e') goto yy292; @@ -1182,9 +1180,9 @@ yy240: goto yy14; yy241: ++cur; -#line 83 "../src/parse/lex_conf.re" +#line 81 "../src/parse/lex_conf.re" { opts.set_condPrefix (lex_conf_string ()); return; } -#line 1188 "src/parse/lex_conf.cc" +#line 1186 "src/parse/lex_conf.cc" yy243: yych = (unsigned char)*++cur; if (yych == 'A') goto yy299; @@ -1336,7 +1334,7 @@ yy277: goto yy14; yy278: ++cur; -#line 138 "../src/parse/lex_conf.re" +#line 136 "../src/parse/lex_conf.re" { const int32_t n = lex_conf_number (); if (n < 0) @@ -1346,7 +1344,7 @@ yy278: opts.set_topIndent (static_cast (n)); return; } -#line 1350 "src/parse/lex_conf.cc" +#line 1348 "src/parse/lex_conf.cc" yy280: yych = (unsigned char)*++cur; if (yych == 'l') goto yy339; @@ -1378,9 +1376,9 @@ yy283: } } yy284: -#line 166 "../src/parse/lex_conf.re" +#line 164 "../src/parse/lex_conf.re" { out.block().user_start_label = lex_conf_string(); return; } -#line 1384 "src/parse/lex_conf.cc" +#line 1382 "src/parse/lex_conf.cc" yy285: yych = (unsigned char)*++cur; if (yych == 't') goto yy347; @@ -1534,9 +1532,9 @@ yy321: goto yy14; yy322: ++cur; -#line 73 "../src/parse/lex_conf.re" +#line 71 "../src/parse/lex_conf.re" { lex_conf_input(); return; } -#line 1540 "src/parse/lex_conf.cc" +#line 1538 "src/parse/lex_conf.cc" yy324: yych = (unsigned char)*++cur; if (yych == 'd') goto yy389; @@ -1607,9 +1605,9 @@ yy340: goto yy14; yy341: ++cur; -#line 162 "../src/parse/lex_conf.re" +#line 160 "../src/parse/lex_conf.re" { opts.set_labelPrefix (lex_conf_string ()); return; } -#line 1613 "src/parse/lex_conf.cc" +#line 1611 "src/parse/lex_conf.cc" yy343: ++cur; if (lim <= cur) fill(1); @@ -1642,9 +1640,9 @@ yy345: } yy347: ++cur; -#line 98 "../src/parse/lex_conf.re" +#line 96 "../src/parse/lex_conf.re" { opts.set_bUseStateAbort (lex_conf_bool()); return; } -#line 1648 "src/parse/lex_conf.cc" +#line 1646 "src/parse/lex_conf.cc" yy349: yych = (unsigned char)*++cur; if (yych == 'a') goto yy411; @@ -1659,9 +1657,9 @@ yy351: goto yy14; yy352: ++cur; -#line 133 "../src/parse/lex_conf.re" +#line 131 "../src/parse/lex_conf.re" { opts.set_tags_prefix (lex_conf_string ()); return; } -#line 1665 "src/parse/lex_conf.cc" +#line 1663 "src/parse/lex_conf.cc" yy354: yych = (unsigned char)*++cur; if (yych <= 'c') { @@ -1700,9 +1698,9 @@ yy360: yych = (unsigned char)*(ptr = ++cur); if (yych == '@') goto yy426; yy361: -#line 85 "../src/parse/lex_conf.re" +#line 83 "../src/parse/lex_conf.re" { opts.set_condDivider (lex_conf_string ()); return; } -#line 1706 "src/parse/lex_conf.cc" +#line 1704 "src/parse/lex_conf.cc" yy362: yych = (unsigned char)*++cur; if (yych == 'n') goto yy427; @@ -1834,7 +1832,7 @@ yy393: if (yych == 'j') goto yy463; goto yy14; yy394: - yych = (unsigned char)*++cur; + ++cur; goto yy116; yy395: yych = (unsigned char)*++cur; @@ -1874,9 +1872,9 @@ yy403: goto yy14; yy404: ++cur; -#line 97 "../src/parse/lex_conf.re" +#line 95 "../src/parse/lex_conf.re" { opts.set_yynext (lex_conf_string ()); return; } -#line 1880 "src/parse/lex_conf.cc" +#line 1878 "src/parse/lex_conf.cc" yy406: yych = (unsigned char)*++cur; if (yych <= '0') goto yy14; @@ -1886,9 +1884,9 @@ yy407: ++cur; yy408: cur = ctx; -#line 165 "../src/parse/lex_conf.re" +#line 163 "../src/parse/lex_conf.re" { out.block().force_start_label = lex_conf_bool(); return; } -#line 1892 "src/parse/lex_conf.cc" +#line 1890 "src/parse/lex_conf.cc" yy409: ++cur; if (lim <= cur) fill(1); @@ -1903,9 +1901,9 @@ yy411: goto yy14; yy412: ++cur; -#line 132 "../src/parse/lex_conf.re" +#line 130 "../src/parse/lex_conf.re" { opts.set_tags_default (lex_conf_string ()); return; } -#line 1909 "src/parse/lex_conf.cc" +#line 1907 "src/parse/lex_conf.cc" yy414: yych = (unsigned char)*++cur; if (yych == 'i') goto yy475; @@ -1937,9 +1935,9 @@ yy420: goto yy14; yy421: ++cur; -#line 160 "../src/parse/lex_conf.re" +#line 158 "../src/parse/lex_conf.re" { opts.set_fill_check (lex_conf_bool()); return; } -#line 1943 "src/parse/lex_conf.cc" +#line 1941 "src/parse/lex_conf.cc" yy423: yych = (unsigned char)*++cur; if (yych == 'e') goto yy485; @@ -1998,9 +1996,9 @@ yy436: if (yych == ':') goto yy503; if (yych == '@') goto yy504; yy437: -#line 155 "../src/parse/lex_conf.re" +#line 153 "../src/parse/lex_conf.re" { opts.set_fill (lex_conf_string ()); return; } -#line 2004 "src/parse/lex_conf.cc" +#line 2002 "src/parse/lex_conf.cc" yy438: yych = (unsigned char)*++cur; if (yych == 'O') goto yy505; @@ -2023,9 +2021,9 @@ yy442: goto yy14; yy443: ++cur; -#line 121 "../src/parse/lex_conf.re" +#line 119 "../src/parse/lex_conf.re" { opts.set_yypeek (lex_conf_string ()); return; } -#line 2029 "src/parse/lex_conf.cc" +#line 2027 "src/parse/lex_conf.cc" yy445: yych = (unsigned char)*++cur; if (yych == 'O') goto yy511; @@ -2040,9 +2038,9 @@ yy447: goto yy14; yy448: ++cur; -#line 122 "../src/parse/lex_conf.re" +#line 120 "../src/parse/lex_conf.re" { opts.set_yyskip (lex_conf_string ()); return; } -#line 2046 "src/parse/lex_conf.cc" +#line 2044 "src/parse/lex_conf.cc" yy450: yych = (unsigned char)*++cur; if (yych == 't') goto yy514; @@ -2121,7 +2119,7 @@ yy468: if (yych == 'a') goto yy531; goto yy14; yy469: - yych = (unsigned char)*++cur; + ++cur; goto yy124; yy470: yych = (unsigned char)*++cur; @@ -2129,9 +2127,9 @@ yy470: goto yy14; yy471: ++cur; -#line 136 "../src/parse/lex_conf.re" +#line 134 "../src/parse/lex_conf.re" { opts.set_indString (lex_conf_string ()); return; } -#line 2135 "src/parse/lex_conf.cc" +#line 2133 "src/parse/lex_conf.cc" yy473: yych = (unsigned char)*++cur; if (yych == 'a') goto yy533; @@ -2150,14 +2148,14 @@ yy476: goto yy14; yy477: ++cur; -#line 102 "../src/parse/lex_conf.re" +#line 100 "../src/parse/lex_conf.re" { opts.set_yybm (lex_conf_string ()); return; } -#line 2156 "src/parse/lex_conf.cc" +#line 2154 "src/parse/lex_conf.cc" yy479: ++cur; -#line 151 "../src/parse/lex_conf.re" +#line 149 "../src/parse/lex_conf.re" { opts.set_yych (lex_conf_string ()); return; } -#line 2161 "src/parse/lex_conf.cc" +#line 2159 "src/parse/lex_conf.cc" yy481: yych = (unsigned char)*++cur; if (yych == 'a') goto yy537; @@ -2176,9 +2174,9 @@ yy484: goto yy14; yy485: ++cur; -#line 156 "../src/parse/lex_conf.re" +#line 154 "../src/parse/lex_conf.re" { opts.set_fill_use (lex_conf_bool()); return; } -#line 2182 "src/parse/lex_conf.cc" +#line 2180 "src/parse/lex_conf.cc" yy487: yych = (unsigned char)*++cur; if (yych == 't') goto yy541; @@ -2193,14 +2191,14 @@ yy489: goto yy14; yy490: ++cur; -#line 88 "../src/parse/lex_conf.re" +#line 86 "../src/parse/lex_conf.re" { opts.set_condGotoParam (lex_conf_string ()); return; } -#line 2199 "src/parse/lex_conf.cc" +#line 2197 "src/parse/lex_conf.cc" yy492: ++cur; -#line 84 "../src/parse/lex_conf.re" +#line 82 "../src/parse/lex_conf.re" { opts.set_condEnumPrefix (lex_conf_string ()); return; } -#line 2204 "src/parse/lex_conf.cc" +#line 2202 "src/parse/lex_conf.cc" yy494: yych = (unsigned char)*++cur; if (yych == 'P') goto yy545; @@ -2219,18 +2217,18 @@ yy497: goto yy14; yy498: ++cur; -#line 150 "../src/parse/lex_conf.re" +#line 148 "../src/parse/lex_conf.re" { opts.set_yyctype (lex_conf_string ()); return; } -#line 2225 "src/parse/lex_conf.cc" +#line 2223 "src/parse/lex_conf.cc" yy500: yych = (unsigned char)*++cur; if (yych == 'R') goto yy550; goto yy14; yy501: ++cur; -#line 148 "../src/parse/lex_conf.re" +#line 146 "../src/parse/lex_conf.re" { opts.set_yydebug (lex_conf_string ()); return; } -#line 2234 "src/parse/lex_conf.cc" +#line 2232 "src/parse/lex_conf.cc" yy503: yych = (unsigned char)*++cur; if (yych == 'n') goto yy552; @@ -2253,9 +2251,9 @@ yy507: goto yy14; yy508: ++cur; -#line 119 "../src/parse/lex_conf.re" +#line 117 "../src/parse/lex_conf.re" { opts.set_yylimit (lex_conf_string ()); return; } -#line 2259 "src/parse/lex_conf.cc" +#line 2257 "src/parse/lex_conf.cc" yy510: yych = (unsigned char)*++cur; if (yych == 'R') goto yy557; @@ -2329,7 +2327,7 @@ yy527: if (yych == 'c') goto yy575; goto yy14; yy528: - yych = (unsigned char)*++cur; + ++cur; goto yy118; yy529: yych = (unsigned char)*++cur; @@ -2385,7 +2383,7 @@ yy541: goto yy14; yy542: ++cur; -#line 105 "../src/parse/lex_conf.re" +#line 103 "../src/parse/lex_conf.re" { const int32_t n = lex_conf_number (); if (n < 0) @@ -2395,7 +2393,7 @@ yy542: opts.set_cGotoThreshold (static_cast (n)); return; } -#line 2399 "src/parse/lex_conf.cc" +#line 2397 "src/parse/lex_conf.cc" yy544: yych = (unsigned char)*++cur; if (yych == 'n') goto yy592; @@ -2406,9 +2404,9 @@ yy545: if (yych == 'C') goto yy593; if (yych == 'T') goto yy594; yy546: -#line 123 "../src/parse/lex_conf.re" +#line 121 "../src/parse/lex_conf.re" { opts.set_yybackup (lex_conf_string ()); return; } -#line 2412 "src/parse/lex_conf.cc" +#line 2410 "src/parse/lex_conf.cc" yy547: yych = (unsigned char)*++cur; if (yych == 'P') goto yy595; @@ -2423,9 +2421,9 @@ yy549: goto yy14; yy550: ++cur; -#line 116 "../src/parse/lex_conf.re" +#line 114 "../src/parse/lex_conf.re" { opts.set_yycursor (lex_conf_string ()); return; } -#line 2429 "src/parse/lex_conf.cc" +#line 2427 "src/parse/lex_conf.cc" yy552: yych = (unsigned char)*++cur; if (yych == 'a') goto yy599; @@ -2448,9 +2446,9 @@ yy556: goto yy14; yy557: ++cur; -#line 117 "../src/parse/lex_conf.re" +#line 115 "../src/parse/lex_conf.re" { opts.set_yymarker (lex_conf_string ()); return; } -#line 2454 "src/parse/lex_conf.cc" +#line 2452 "src/parse/lex_conf.cc" yy559: yych = (unsigned char)*++cur; if (yych == 'E') goto yy604; @@ -2541,14 +2539,14 @@ yy580: goto yy14; yy581: ++cur; -#line 99 "../src/parse/lex_conf.re" +#line 97 "../src/parse/lex_conf.re" { opts.set_bUseStateNext (lex_conf_bool()); return; } -#line 2547 "src/parse/lex_conf.cc" +#line 2545 "src/parse/lex_conf.cc" yy583: ++cur; -#line 134 "../src/parse/lex_conf.re" +#line 132 "../src/parse/lex_conf.re" { opts.set_tags_expression(lex_conf_string ()); return; } -#line 2552 "src/parse/lex_conf.cc" +#line 2550 "src/parse/lex_conf.cc" yy585: yych = (unsigned char)*++cur; if (yych == 'p') goto yy628; @@ -2567,9 +2565,9 @@ yy588: goto yy14; yy589: ++cur; -#line 152 "../src/parse/lex_conf.re" +#line 150 "../src/parse/lex_conf.re" { opts.set_yychConversion (lex_conf_bool()); return; } -#line 2573 "src/parse/lex_conf.cc" +#line 2571 "src/parse/lex_conf.cc" yy591: yych = (unsigned char)*++cur; if (yych == 'r') goto yy632; @@ -2592,9 +2590,9 @@ yy595: goto yy14; yy596: ++cur; -#line 129 "../src/parse/lex_conf.re" +#line 127 "../src/parse/lex_conf.re" { opts.set_yycopytag (lex_conf_string ()); return; } -#line 2598 "src/parse/lex_conf.cc" +#line 2596 "src/parse/lex_conf.cc" yy598: yych = (unsigned char)*++cur; if (yych == 'E') goto yy640; @@ -2625,9 +2623,9 @@ yy604: if (yych == 'C') goto yy649; if (yych == 'T') goto yy650; yy605: -#line 126 "../src/parse/lex_conf.re" +#line 124 "../src/parse/lex_conf.re" { opts.set_yyrestore (lex_conf_string ()); return; } -#line 2631 "src/parse/lex_conf.cc" +#line 2629 "src/parse/lex_conf.cc" yy606: yych = (unsigned char)*++cur; if (yych == 'I') goto yy651; @@ -2673,7 +2671,7 @@ yy616: if (yych == 'x') goto yy94; goto yy14; yy617: - yych = (unsigned char)*++cur; + ++cur; goto yy120; yy618: yych = (unsigned char)*++cur; @@ -2685,9 +2683,9 @@ yy619: goto yy14; yy620: ++cur; -#line 58 "../src/parse/lex_conf.re" +#line 56 "../src/parse/lex_conf.re" { opts.set_version(!lex_conf_bool()); return; } -#line 2691 "src/parse/lex_conf.cc" +#line 2689 "src/parse/lex_conf.cc" yy622: yych = (unsigned char)*++cur; if (yych == 'i') goto yy665; @@ -2705,7 +2703,7 @@ yy625: if (yych == 'r') goto yy668; goto yy14; yy626: - yych = (unsigned char)*++cur; + ++cur; goto yy126; yy627: yych = (unsigned char)*++cur; @@ -2729,14 +2727,14 @@ yy631: goto yy14; yy632: ++cur; -#line 158 "../src/parse/lex_conf.re" +#line 156 "../src/parse/lex_conf.re" { opts.set_fill_arg_use (lex_conf_bool()); return; } -#line 2735 "src/parse/lex_conf.cc" +#line 2733 "src/parse/lex_conf.cc" yy634: ++cur; -#line 86 "../src/parse/lex_conf.re" +#line 84 "../src/parse/lex_conf.re" { opts.set_condDividerParam (lex_conf_string ()); return; } -#line 2740 "src/parse/lex_conf.cc" +#line 2738 "src/parse/lex_conf.cc" yy636: yych = (unsigned char)*++cur; if (yych == 'X') goto yy679; @@ -2747,9 +2745,9 @@ yy637: goto yy14; yy638: ++cur; -#line 77 "../src/parse/lex_conf.re" +#line 75 "../src/parse/lex_conf.re" { opts.set_yycondtype (lex_conf_string ()); return; } -#line 2753 "src/parse/lex_conf.cc" +#line 2751 "src/parse/lex_conf.cc" yy640: yych = (unsigned char)*++cur; if (yych == 'R') goto yy683; @@ -2760,9 +2758,9 @@ yy641: goto yy14; yy642: ++cur; -#line 157 "../src/parse/lex_conf.re" +#line 155 "../src/parse/lex_conf.re" { opts.set_fill_arg (lex_conf_string ()); return; } -#line 2766 "src/parse/lex_conf.cc" +#line 2764 "src/parse/lex_conf.cc" yy644: yych = (unsigned char)*++cur; if (yych == 'T') goto yy686; @@ -2772,14 +2770,14 @@ yy645: yych = (unsigned char)*(ptr = ++cur); if (yych == ':') goto yy687; yy646: -#line 91 "../src/parse/lex_conf.re" +#line 89 "../src/parse/lex_conf.re" { opts.set_state_get (lex_conf_string ()); return; } -#line 2778 "src/parse/lex_conf.cc" +#line 2776 "src/parse/lex_conf.cc" yy647: ++cur; -#line 130 "../src/parse/lex_conf.re" +#line 128 "../src/parse/lex_conf.re" { opts.set_yylessthan (lex_conf_string ()); return; } -#line 2783 "src/parse/lex_conf.cc" +#line 2781 "src/parse/lex_conf.cc" yy649: yych = (unsigned char)*++cur; if (yych == 'T') goto yy688; @@ -2798,11 +2796,11 @@ yy652: if (yych == ':') goto yy691; if (yych == '@') goto yy692; yy653: -#line 93 "../src/parse/lex_conf.re" +#line 91 "../src/parse/lex_conf.re" { opts.set_state_set (lex_conf_string ()); return; } -#line 2804 "src/parse/lex_conf.cc" +#line 2802 "src/parse/lex_conf.cc" yy654: - yych = (unsigned char)*++cur; + ++cur; goto yy101; yy655: yych = (unsigned char)*++cur; @@ -2826,9 +2824,9 @@ yy659: goto yy14; yy660: ++cur; -#line 74 "../src/parse/lex_conf.re" +#line 72 "../src/parse/lex_conf.re" { lex_conf_empty_class(); return; } -#line 2832 "src/parse/lex_conf.cc" +#line 2830 "src/parse/lex_conf.cc" yy662: yych = (unsigned char)*++cur; if (yych == 'l') goto yy698; @@ -2854,48 +2852,48 @@ yy667: if (yych == 'a') goto yy703; goto yy14; yy668: - yych = (unsigned char)*++cur; + ++cur; goto yy122; yy669: ++cur; -#line 96 "../src/parse/lex_conf.re" +#line 94 "../src/parse/lex_conf.re" { opts.set_yyfilllabel (lex_conf_string ()); return; } -#line 2864 "src/parse/lex_conf.cc" +#line 2862 "src/parse/lex_conf.cc" yy671: ++cur; -#line 100 "../src/parse/lex_conf.re" +#line 98 "../src/parse/lex_conf.re" { opts.set_yyaccept (lex_conf_string ()); return; } -#line 2869 "src/parse/lex_conf.cc" +#line 2867 "src/parse/lex_conf.cc" yy673: ++cur; -#line 89 "../src/parse/lex_conf.re" +#line 87 "../src/parse/lex_conf.re" { opts.set_yyctable (lex_conf_string ()); return; } -#line 2874 "src/parse/lex_conf.cc" +#line 2872 "src/parse/lex_conf.cc" yy675: ++cur; -#line 169 "../src/parse/lex_conf.re" +#line 167 "../src/parse/lex_conf.re" { lex_conf_string (); return; } -#line 2879 "src/parse/lex_conf.cc" +#line 2877 "src/parse/lex_conf.cc" yy677: ++cur; -#line 114 "../src/parse/lex_conf.re" +#line 112 "../src/parse/lex_conf.re" { opts.set_yytarget (lex_conf_string ()); return; } -#line 2884 "src/parse/lex_conf.cc" +#line 2882 "src/parse/lex_conf.cc" yy679: ++cur; -#line 124 "../src/parse/lex_conf.re" +#line 122 "../src/parse/lex_conf.re" { opts.set_yybackupctx (lex_conf_string ()); return; } -#line 2889 "src/parse/lex_conf.cc" +#line 2887 "src/parse/lex_conf.cc" yy681: ++cur; -#line 125 "../src/parse/lex_conf.re" +#line 123 "../src/parse/lex_conf.re" { opts.set_yybackuptag (lex_conf_string ()); return; } -#line 2894 "src/parse/lex_conf.cc" +#line 2892 "src/parse/lex_conf.cc" yy683: ++cur; -#line 118 "../src/parse/lex_conf.re" +#line 116 "../src/parse/lex_conf.re" { opts.set_yyctxmarker (lex_conf_string ()); return; } -#line 2899 "src/parse/lex_conf.cc" +#line 2897 "src/parse/lex_conf.cc" yy685: yych = (unsigned char)*++cur; if (yych == 'd') goto yy704; @@ -2941,7 +2939,7 @@ yy695: if (yych == 'o') goto yy718; goto yy14; yy696: - yych = (unsigned char)*++cur; + ++cur; goto yy105; yy697: yych = (unsigned char)*++cur; @@ -2973,9 +2971,9 @@ yy703: goto yy14; yy704: ++cur; -#line 159 "../src/parse/lex_conf.re" +#line 157 "../src/parse/lex_conf.re" { opts.set_fill_naked (lex_conf_bool()); return; } -#line 2979 "src/parse/lex_conf.cc" +#line 2977 "src/parse/lex_conf.cc" yy706: yych = (unsigned char)*++cur; if (yych == 'O') goto yy726; @@ -2986,14 +2984,14 @@ yy707: goto yy14; yy708: ++cur; -#line 127 "../src/parse/lex_conf.re" +#line 125 "../src/parse/lex_conf.re" { opts.set_yyrestorectx (lex_conf_string ()); return; } -#line 2992 "src/parse/lex_conf.cc" +#line 2990 "src/parse/lex_conf.cc" yy710: ++cur; -#line 128 "../src/parse/lex_conf.re" +#line 126 "../src/parse/lex_conf.re" { opts.set_yyrestoretag (lex_conf_string ()); return; } -#line 2997 "src/parse/lex_conf.cc" +#line 2995 "src/parse/lex_conf.cc" yy712: yych = (unsigned char)*++cur; if (yych == 'O') goto yy728; @@ -3012,9 +3010,9 @@ yy715: goto yy14; yy716: ++cur; -#line 60 "../src/parse/lex_conf.re" +#line 58 "../src/parse/lex_conf.re" { opts.set_bCaseInverted(lex_conf_bool()); return; } -#line 3018 "src/parse/lex_conf.cc" +#line 3016 "src/parse/lex_conf.cc" yy718: yych = (unsigned char)*++cur; if (yych == 's') goto yy110; @@ -3028,7 +3026,7 @@ yy720: if (yych == 'c') goto yy733; goto yy14; yy721: - yych = (unsigned char)*++cur; + ++cur; goto yy113; yy722: yych = (unsigned char)*++cur; @@ -3091,16 +3089,16 @@ yy736: if (yych == 'n') goto yy751; goto yy14; yy737: - yych = (unsigned char)*++cur; + ++cur; goto yy109; yy738: yyaccept = 21; yych = (unsigned char)*(ptr = ++cur); if (yych == ':') goto yy752; yy739: -#line 78 "../src/parse/lex_conf.re" +#line 76 "../src/parse/lex_conf.re" { opts.set_cond_get (lex_conf_string ()); return; } -#line 3104 "src/parse/lex_conf.cc" +#line 3102 "src/parse/lex_conf.cc" yy740: yych = (unsigned char)*++cur; if (yych == 'e') goto yy753; @@ -3111,9 +3109,9 @@ yy741: if (yych == ':') goto yy754; if (yych == '@') goto yy755; yy742: -#line 80 "../src/parse/lex_conf.re" +#line 78 "../src/parse/lex_conf.re" { opts.set_cond_set (lex_conf_string ()); return; } -#line 3117 "src/parse/lex_conf.cc" +#line 3115 "src/parse/lex_conf.cc" yy743: yych = (unsigned char)*++cur; if (yych == 'e') goto yy756; @@ -3132,9 +3130,9 @@ yy746: goto yy14; yy747: ++cur; -#line 72 "../src/parse/lex_conf.re" +#line 70 "../src/parse/lex_conf.re" { lex_conf_encoding_policy(); return; } -#line 3138 "src/parse/lex_conf.cc" +#line 3136 "src/parse/lex_conf.cc" yy749: yych = (unsigned char)*++cur; if (yych == 'a') goto yy762; @@ -3173,14 +3171,14 @@ yy757: goto yy14; yy758: ++cur; -#line 59 "../src/parse/lex_conf.re" +#line 57 "../src/parse/lex_conf.re" { opts.set_bCaseInsensitive(lex_conf_bool()); return; } -#line 3179 "src/parse/lex_conf.cc" +#line 3177 "src/parse/lex_conf.cc" yy760: ++cur; -#line 75 "../src/parse/lex_conf.re" +#line 73 "../src/parse/lex_conf.re" { lex_conf_dfa_minimization(); return; } -#line 3184 "src/parse/lex_conf.cc" +#line 3182 "src/parse/lex_conf.cc" yy762: yych = (unsigned char)*++cur; if (yych == 't') goto yy774; @@ -3190,7 +3188,7 @@ yy763: if (yych == 'p') goto yy775; goto yy14; yy764: - yych = (unsigned char)*++cur; + ++cur; goto yy103; yy765: yych = (unsigned char)*++cur; @@ -3198,9 +3196,9 @@ yy765: goto yy14; yy766: ++cur; -#line 92 "../src/parse/lex_conf.re" +#line 90 "../src/parse/lex_conf.re" { opts.set_state_get_naked (lex_conf_bool()); return; } -#line 3204 "src/parse/lex_conf.cc" +#line 3202 "src/parse/lex_conf.cc" yy768: yych = (unsigned char)*++cur; if (yych == 'a') goto yy777; @@ -3211,14 +3209,14 @@ yy769: goto yy14; yy770: ++cur; -#line 94 "../src/parse/lex_conf.re" +#line 92 "../src/parse/lex_conf.re" { opts.set_state_set_naked (lex_conf_bool()); return; } -#line 3217 "src/parse/lex_conf.cc" +#line 3215 "src/parse/lex_conf.cc" yy772: ++cur; -#line 95 "../src/parse/lex_conf.re" +#line 93 "../src/parse/lex_conf.re" { opts.set_state_set_arg (lex_conf_string ()); return; } -#line 3222 "src/parse/lex_conf.cc" +#line 3220 "src/parse/lex_conf.cc" yy774: yych = (unsigned char)*++cur; if (yych == 'e') goto yy779; @@ -3241,9 +3239,9 @@ yy778: goto yy14; yy779: ++cur; -#line 57 "../src/parse/lex_conf.re" +#line 55 "../src/parse/lex_conf.re" { opts.set_bNoGenerationDate(lex_conf_bool()); return; } -#line 3247 "src/parse/lex_conf.cc" +#line 3245 "src/parse/lex_conf.cc" yy781: yych = (unsigned char)*++cur; if (yych == 'i') goto yy785; @@ -3274,30 +3272,30 @@ yy787: goto yy14; yy788: ++cur; -#line 81 "../src/parse/lex_conf.re" +#line 79 "../src/parse/lex_conf.re" { opts.set_cond_set_arg (lex_conf_string ()); return; } -#line 3280 "src/parse/lex_conf.cc" +#line 3278 "src/parse/lex_conf.cc" yy790: yych = (unsigned char)*++cur; if (yych == 'g') goto yy795; goto yy14; yy791: ++cur; -#line 79 "../src/parse/lex_conf.re" +#line 77 "../src/parse/lex_conf.re" { opts.set_cond_get_naked (lex_conf_bool()); return; } -#line 3289 "src/parse/lex_conf.cc" +#line 3287 "src/parse/lex_conf.cc" yy793: ++cur; -#line 82 "../src/parse/lex_conf.re" +#line 80 "../src/parse/lex_conf.re" { opts.set_cond_set_naked (lex_conf_bool()); return; } -#line 3294 "src/parse/lex_conf.cc" +#line 3292 "src/parse/lex_conf.cc" yy795: ++cur; -#line 61 "../src/parse/lex_conf.re" +#line 59 "../src/parse/lex_conf.re" { opts.set_bijective_mapping(!lex_conf_bool()); return; } -#line 3299 "src/parse/lex_conf.cc" +#line 3297 "src/parse/lex_conf.cc" } -#line 170 "../src/parse/lex_conf.re" +#line 168 "../src/parse/lex_conf.re" } @@ -3305,7 +3303,7 @@ void Scanner::lex_conf_encoding_policy() { lex_conf_assign (); -#line 3309 "src/parse/lex_conf.cc" +#line 3307 "src/parse/lex_conf.cc" { unsigned char yych; if ((lim - cur) < 10) fill(10); @@ -3318,10 +3316,10 @@ void Scanner::lex_conf_encoding_policy() } ++cur; yy800: -#line 177 "../src/parse/lex_conf.re" +#line 175 "../src/parse/lex_conf.re" { fatal("bad configuration value" " (expected: 'ignore', 'substitute', 'fail')"); } -#line 3325 "src/parse/lex_conf.cc" +#line 3323 "src/parse/lex_conf.cc" yy801: yych = (unsigned char)*(ptr = ++cur); if (yych == 'a') goto yy804; @@ -3362,9 +3360,9 @@ yy810: goto yy805; yy811: ++cur; -#line 181 "../src/parse/lex_conf.re" +#line 179 "../src/parse/lex_conf.re" { opts.set_encoding_policy(Enc::POLICY_FAIL); goto end; } -#line 3368 "src/parse/lex_conf.cc" +#line 3366 "src/parse/lex_conf.cc" yy813: yych = (unsigned char)*++cur; if (yych == 'r') goto yy815; @@ -3383,9 +3381,9 @@ yy816: goto yy805; yy817: ++cur; -#line 179 "../src/parse/lex_conf.re" +#line 177 "../src/parse/lex_conf.re" { opts.set_encoding_policy(Enc::POLICY_IGNORE); goto end; } -#line 3389 "src/parse/lex_conf.cc" +#line 3387 "src/parse/lex_conf.cc" yy819: yych = (unsigned char)*++cur; if (yych != 't') goto yy805; @@ -3396,11 +3394,11 @@ yy819: yych = (unsigned char)*++cur; if (yych != 'e') goto yy805; ++cur; -#line 180 "../src/parse/lex_conf.re" +#line 178 "../src/parse/lex_conf.re" { opts.set_encoding_policy(Enc::POLICY_SUBSTITUTE); goto end; } -#line 3402 "src/parse/lex_conf.cc" +#line 3400 "src/parse/lex_conf.cc" } -#line 182 "../src/parse/lex_conf.re" +#line 180 "../src/parse/lex_conf.re" end: lex_conf_semicolon(); @@ -3410,7 +3408,7 @@ void Scanner::lex_conf_input() { lex_conf_assign (); -#line 3414 "src/parse/lex_conf.cc" +#line 3412 "src/parse/lex_conf.cc" { unsigned char yych; if ((lim - cur) < 7) fill(7); @@ -3421,10 +3419,10 @@ void Scanner::lex_conf_input() yy827: ++cur; yy828: -#line 191 "../src/parse/lex_conf.re" +#line 189 "../src/parse/lex_conf.re" { fatal("bad configuration value" " (expected: 'default', 'custom')"); } -#line 3428 "src/parse/lex_conf.cc" +#line 3426 "src/parse/lex_conf.cc" yy829: yych = (unsigned char)*(ptr = ++cur); if (yych == 'u') goto yy831; @@ -3469,18 +3467,18 @@ yy839: goto yy832; yy840: ++cur; -#line 194 "../src/parse/lex_conf.re" +#line 192 "../src/parse/lex_conf.re" { opts.set_input_api(InputAPI::CUSTOM); goto end; } -#line 3475 "src/parse/lex_conf.cc" +#line 3473 "src/parse/lex_conf.cc" yy842: yych = (unsigned char)*++cur; if (yych != 't') goto yy832; ++cur; -#line 193 "../src/parse/lex_conf.re" +#line 191 "../src/parse/lex_conf.re" { opts.set_input_api(InputAPI::DEFAULT); goto end; } -#line 3482 "src/parse/lex_conf.cc" +#line 3480 "src/parse/lex_conf.cc" } -#line 195 "../src/parse/lex_conf.re" +#line 193 "../src/parse/lex_conf.re" end: lex_conf_semicolon(); @@ -3490,7 +3488,7 @@ void Scanner::lex_conf_empty_class() { lex_conf_assign (); -#line 3494 "src/parse/lex_conf.cc" +#line 3492 "src/parse/lex_conf.cc" { unsigned char yych; if ((lim - cur) < 11) fill(11); @@ -3499,10 +3497,10 @@ void Scanner::lex_conf_empty_class() if (yych == 'm') goto yy850; ++cur; yy848: -#line 204 "../src/parse/lex_conf.re" +#line 202 "../src/parse/lex_conf.re" { fatal("bad configuration value" " (expected: 'match-empty', 'match-none', 'error')"); } -#line 3506 "src/parse/lex_conf.cc" +#line 3504 "src/parse/lex_conf.cc" yy849: yych = (unsigned char)*(ptr = ++cur); if (yych == 'r') goto yy851; @@ -3539,9 +3537,9 @@ yy857: goto yy852; yy858: ++cur; -#line 208 "../src/parse/lex_conf.re" +#line 206 "../src/parse/lex_conf.re" { opts.set_empty_class_policy(EMPTY_CLASS_ERROR); goto end; } -#line 3545 "src/parse/lex_conf.cc" +#line 3543 "src/parse/lex_conf.cc" yy860: yych = (unsigned char)*++cur; if (yych != '-') goto yy852; @@ -3579,16 +3577,16 @@ yy868: goto yy852; yy869: ++cur; -#line 207 "../src/parse/lex_conf.re" +#line 205 "../src/parse/lex_conf.re" { opts.set_empty_class_policy(EMPTY_CLASS_MATCH_NONE); goto end; } -#line 3585 "src/parse/lex_conf.cc" +#line 3583 "src/parse/lex_conf.cc" yy871: ++cur; -#line 206 "../src/parse/lex_conf.re" +#line 204 "../src/parse/lex_conf.re" { opts.set_empty_class_policy(EMPTY_CLASS_MATCH_EMPTY); goto end; } -#line 3590 "src/parse/lex_conf.cc" +#line 3588 "src/parse/lex_conf.cc" } -#line 209 "../src/parse/lex_conf.re" +#line 207 "../src/parse/lex_conf.re" end: lex_conf_semicolon(); @@ -3598,7 +3596,7 @@ void Scanner::lex_conf_dfa_minimization() { lex_conf_assign (); -#line 3602 "src/parse/lex_conf.cc" +#line 3600 "src/parse/lex_conf.cc" { unsigned char yych; if ((lim - cur) < 5) fill(5); @@ -3607,10 +3605,10 @@ void Scanner::lex_conf_dfa_minimization() if (yych == 't') goto yy878; ++cur; yy876: -#line 218 "../src/parse/lex_conf.re" +#line 216 "../src/parse/lex_conf.re" { fatal("bad configuration value" " (expected: 'table', 'moore')"); } -#line 3614 "src/parse/lex_conf.cc" +#line 3612 "src/parse/lex_conf.cc" yy877: yych = (unsigned char)*(ptr = ++cur); if (yych == 'o') goto yy879; @@ -3647,16 +3645,16 @@ yy885: goto yy880; yy886: ++cur; -#line 221 "../src/parse/lex_conf.re" +#line 219 "../src/parse/lex_conf.re" { opts.set_dfa_minimization(DFA_MINIMIZATION_MOORE); goto end; } -#line 3653 "src/parse/lex_conf.cc" +#line 3651 "src/parse/lex_conf.cc" yy888: ++cur; -#line 220 "../src/parse/lex_conf.re" +#line 218 "../src/parse/lex_conf.re" { opts.set_dfa_minimization(DFA_MINIMIZATION_TABLE); goto end; } -#line 3658 "src/parse/lex_conf.cc" +#line 3656 "src/parse/lex_conf.cc" } -#line 222 "../src/parse/lex_conf.re" +#line 220 "../src/parse/lex_conf.re" end: lex_conf_semicolon(); @@ -3677,7 +3675,7 @@ void Scanner::lex_conf_enc(Enc::type_t enc) void Scanner::lex_conf_assign () { -#line 3681 "src/parse/lex_conf.cc" +#line 3679 "src/parse/lex_conf.cc" { unsigned char yych; static const unsigned char yybm[] = { @@ -3724,9 +3722,9 @@ void Scanner::lex_conf_assign () } ++cur; yy893: -#line 242 "../src/parse/lex_conf.re" +#line 240 "../src/parse/lex_conf.re" { fatal ("missing '=' in configuration"); } -#line 3730 "src/parse/lex_conf.cc" +#line 3728 "src/parse/lex_conf.cc" yy894: yych = (unsigned char)*(ptr = ++cur); if (yych <= 0x1F) { @@ -3743,9 +3741,9 @@ yy895: if (yybm[0+yych] & 128) { goto yy895; } -#line 243 "../src/parse/lex_conf.re" +#line 241 "../src/parse/lex_conf.re" { return; } -#line 3749 "src/parse/lex_conf.cc" +#line 3747 "src/parse/lex_conf.cc" yy898: ++cur; if (lim <= cur) fill(1); @@ -3759,14 +3757,14 @@ yy898: cur = ptr; goto yy893; } -#line 244 "../src/parse/lex_conf.re" +#line 242 "../src/parse/lex_conf.re" } void Scanner::lex_conf_semicolon () { -#line 3770 "src/parse/lex_conf.cc" +#line 3768 "src/parse/lex_conf.cc" { unsigned char yych; static const unsigned char yybm[] = { @@ -3813,9 +3811,9 @@ void Scanner::lex_conf_semicolon () } ++cur; yy904: -#line 250 "../src/parse/lex_conf.re" +#line 248 "../src/parse/lex_conf.re" { fatal ("missing ending ';' in configuration"); } -#line 3819 "src/parse/lex_conf.cc" +#line 3817 "src/parse/lex_conf.cc" yy905: yych = (unsigned char)*(ptr = ++cur); if (yybm[0+yych] & 128) { @@ -3824,9 +3822,9 @@ yy905: if (yych != ';') goto yy904; yy906: ++cur; -#line 251 "../src/parse/lex_conf.re" +#line 249 "../src/parse/lex_conf.re" { return; } -#line 3830 "src/parse/lex_conf.cc" +#line 3828 "src/parse/lex_conf.cc" yy908: ++cur; if (lim <= cur) fill(1); @@ -3838,7 +3836,7 @@ yy908: cur = ptr; goto yy904; } -#line 252 "../src/parse/lex_conf.re" +#line 250 "../src/parse/lex_conf.re" } @@ -3852,7 +3850,7 @@ int32_t Scanner::lex_conf_number () lex_conf_assign (); tok = cur; -#line 3856 "src/parse/lex_conf.cc" +#line 3854 "src/parse/lex_conf.cc" { unsigned char yych; static const unsigned char yybm[] = { @@ -3906,7 +3904,7 @@ yy914: yy915: ++cur; yy916: -#line 266 "../src/parse/lex_conf.re" +#line 264 "../src/parse/lex_conf.re" { int32_t n = 0; if (!s_to_i32_unsafe (tok, cur, n)) @@ -3916,7 +3914,7 @@ yy916: lex_conf_semicolon (); return n; } -#line 3920 "src/parse/lex_conf.cc" +#line 3918 "src/parse/lex_conf.cc" yy917: ++cur; if (lim <= cur) fill(1); @@ -3926,7 +3924,7 @@ yy917: } goto yy916; } -#line 275 "../src/parse/lex_conf.re" +#line 273 "../src/parse/lex_conf.re" } @@ -3936,7 +3934,7 @@ std::string Scanner::lex_conf_string () std::string s; tok = cur; -#line 3940 "src/parse/lex_conf.cc" +#line 3938 "src/parse/lex_conf.cc" { unsigned char yych; static const unsigned char yybm[] = { @@ -3990,9 +3988,9 @@ std::string Scanner::lex_conf_string () if (yych != ';') goto yy922; } } -#line 302 "../src/parse/lex_conf.re" +#line 300 "../src/parse/lex_conf.re" { goto end; } -#line 3996 "src/parse/lex_conf.cc" +#line 3994 "src/parse/lex_conf.cc" yy922: ++cur; if (lim <= cur) fill(1); @@ -4000,15 +3998,15 @@ yy922: if (yybm[0+yych] & 128) { goto yy922; } -#line 298 "../src/parse/lex_conf.re" +#line 296 "../src/parse/lex_conf.re" { s = std::string(tok, tok_len()); goto end; } -#line 4009 "src/parse/lex_conf.cc" +#line 4007 "src/parse/lex_conf.cc" yy925: ++cur; -#line 284 "../src/parse/lex_conf.re" +#line 282 "../src/parse/lex_conf.re" { const char quote = tok[0]; for (bool end;;) { @@ -4023,9 +4021,9 @@ yy925: } } } -#line 4027 "src/parse/lex_conf.cc" +#line 4025 "src/parse/lex_conf.cc" } -#line 303 "../src/parse/lex_conf.re" +#line 301 "../src/parse/lex_conf.re" end: lex_conf_semicolon (); diff --git a/re2c/bootstrap/src/parse/parser.cc b/re2c/bootstrap/src/parse/parser.cc index 40f1de55..1f7dad77 100644 --- a/re2c/bootstrap/src/parse/parser.cc +++ b/re2c/bootstrap/src/parse/parser.cc @@ -81,7 +81,6 @@ #include #include "src/codegen/output.h" -#include "src/conf/opt.h" #include "src/globals.h" #include "src/ir/compile.h" #include "src/ir/adfa/adfa.h" @@ -130,7 +129,7 @@ static symbol_table_t symbol_table; void context_check(CondList *clist) { - if (!opts->cFlag) + if (!in->opts->cFlag) { delete clist; in->fatal("conditions are only allowed when using -c switch"); @@ -555,11 +554,11 @@ static const yytype_int8 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 157, 157, 159, 160, 161, 166, 173, 178, 181, - 185, 185, 188, 197, 208, 212, 218, 224, 231, 240, - 248, 258, 269, 275, 281, 284, 291, 297, 307, 310, - 317, 321, 327, 331, 338, 342, 349, 353, 360, 364, - 381, 400, 404, 408, 412, 419, 429, 433 + 0, 156, 156, 158, 159, 160, 165, 172, 177, 180, + 184, 184, 187, 196, 207, 211, 217, 223, 230, 239, + 247, 257, 268, 274, 280, 283, 290, 296, 306, 309, + 316, 320, 326, 330, 337, 341, 348, 352, 359, 363, + 380, 399, 403, 407, 411, 418, 428, 432 }; #endif @@ -1556,7 +1555,7 @@ yyreduce: case 12: { - if (opts->cFlag) { + if (in->opts->cFlag) { in->fatal("condition or '<*>' required when using -c switch"); } (yyvsp[(1) - (2)].rule)->info = new RuleInfo((yyvsp[(2) - (2)].code)->loc, (yyvsp[(2) - (2)].code), NULL); @@ -1567,7 +1566,7 @@ yyreduce: case 13: { - if (opts->cFlag) { + if (in->opts->cFlag) { in->fatal("condition or '<*>' required when using -c switch"); } RegExpRule *def = new RegExpRule(in->mkDefault()); @@ -2113,6 +2112,7 @@ void parse(Scanner& i, Output & o) { std::map > dfa_map; ScannerState rules_state; + Opt &opts = i.opts; in = &i; diff --git a/re2c/src/codegen/bitmap.cc b/re2c/src/codegen/bitmap.cc index 84c26e27..16a0668b 100644 --- a/re2c/src/codegen/bitmap.cc +++ b/re2c/src/codegen/bitmap.cc @@ -4,7 +4,6 @@ #include "src/codegen/bitmap.h" #include "src/codegen/go.h" #include "src/codegen/output.h" -#include "src/conf/opt.h" #include "src/globals.h" namespace re2c @@ -74,6 +73,7 @@ static void doGen(const Go *g, const State *s, uint32_t *bm, uint32_t f, uint32_ void BitMap::gen(OutputFile & o, uint32_t ind, uint32_t lb, uint32_t ub) { + Opt &opts = o.opts; if (first && bUsedYYBitmap) { o.wind(ind).ws("static const unsigned char ").wstring(opts->yybm).ws("[] = {"); diff --git a/re2c/src/codegen/emit.h b/re2c/src/codegen/emit.h index 382856d7..171460c1 100644 --- a/re2c/src/codegen/emit.h +++ b/re2c/src/codegen/emit.h @@ -12,9 +12,16 @@ void emit_action(OutputFile &o, uint32_t ind, const DFA &dfa, const State *s, co void gen_goto_plain(OutputFile &o, uint32_t ind, const State *to, const DFA &dfa, tcid_t tcid); void gen_goto_case(OutputFile &o, uint32_t ind, const State *to, const DFA &dfa, tcid_t tcid); void gen_goto_if(OutputFile &o, uint32_t ind, const State *to, const DFA &dfa, tcid_t tcid); -void gen_settags(code_lines_t &code, const DFA &dfa, tcid_t tcid); -std::string vartag_name(tagver_t ver); -std::string vartag_expr(tagver_t ver); +void gen_settags(code_lines_t &code, const DFA &dfa, tcid_t tcid, Opt &opts); +std::string vartag_name(tagver_t ver, const std::string &prefix); +std::string vartag_expr(tagver_t ver, const std::string &prefix, const std::string &expression); + +inline std::string indent(uint32_t n, const std::string s) +{ + std::string ind; + for (; n --> 0; ind += s); + return ind; +} } // namespace re2c diff --git a/re2c/src/codegen/emit_action.cc b/re2c/src/codegen/emit_action.cc index 2facbad0..993ad1b1 100644 --- a/re2c/src/codegen/emit_action.cc +++ b/re2c/src/codegen/emit_action.cc @@ -6,7 +6,6 @@ #include "src/codegen/emit.h" #include "src/codegen/input_api.h" #include "src/codegen/output.h" -#include "src/conf/opt.h" #include "src/globals.h" #include "src/ir/adfa/action.h" #include "src/ir/adfa/adfa.h" @@ -28,7 +27,7 @@ static void emit_save(OutputFile &o, uint32_t ind, const State *s, bool save_yya static void emit_accept_binary(OutputFile &o, uint32_t ind, const DFA &dfa, const State *s, size_t l, size_t r); static void emit_accept(OutputFile &o, uint32_t ind, const DFA &dfa, const State *s); static void emit_rule(OutputFile &o, uint32_t ind, const DFA &dfa, size_t rule_idx); -static void gen_goto(code_lines_t &code, const State *to, const DFA &dfa, tcid_t tcid); +static void gen_goto(code_lines_t &code, const State *to, const DFA &dfa, tcid_t tcid, Opt &opts); static void gen_fintags(OutputFile &o, uint32_t ind, const DFA &dfa, const Rule &rule); static bool endstate(const State *s); @@ -59,20 +58,22 @@ void emit_action(OutputFile &o, uint32_t ind, const DFA &dfa, void emit_match(OutputFile &o, uint32_t ind, const State *s) { + Opt &opts = o.opts; if (s->fill != 0) { - o.wstring(opts->input_api.stmt_skip(ind)); + o.wstring(opts->input_api.stmt_skip(ind, opts)); need(o, ind, s->fill); - o.wstring(opts->input_api.stmt_peek(ind)); + o.wstring(opts->input_api.stmt_peek(ind, opts)); } else if (endstate(s)) { - o.wstring(opts->input_api.stmt_skip(ind)); + o.wstring(opts->input_api.stmt_skip(ind, opts)); } else { - o.wstring(opts->input_api.stmt_skip_peek(ind)); + o.wstring(opts->input_api.stmt_skip_peek(ind, opts)); } } void emit_initial(OutputFile &o, uint32_t ind, const State *s, const std::set &used_labels, bool save_yyaccept) { + Opt &opts = o.opts; const Initial &init = *s->action.info.initial; const label_t label = init.label; const size_t save = init.save; @@ -83,7 +84,7 @@ void emit_initial(OutputFile &o, uint32_t ind, const State *s, o.wind(ind).wstring(opts->yyaccept).ws(" = ") .wu64(save).ws(";\n"); } - o.wstring(opts->input_api.stmt_skip(ind)); + o.wstring(opts->input_api.stmt_skip(ind, opts)); } if (used_labels.count(label)) { @@ -100,32 +101,35 @@ void emit_initial(OutputFile &o, uint32_t ind, const State *s, need(o, ind, s->fill); if (backup) { - o.wstring(opts->input_api.stmt_backup_peek(ind)); + o.wstring(opts->input_api.stmt_backup_peek(ind, opts)); } else { - o.wstring(opts->input_api.stmt_peek(ind)); + o.wstring(opts->input_api.stmt_peek(ind, opts)); } } void emit_save(OutputFile &o, uint32_t ind, const State *const s, bool save_yyaccept) { + Opt &opts = o.opts; + if (save_yyaccept) { o.wind(ind).wstring(opts->yyaccept).ws(" = ") .wu64(s->action.info.save).ws(";\n"); } if (s->fill != 0) { - o.wstring(opts->input_api.stmt_skip_backup(ind)); + o.wstring(opts->input_api.stmt_skip_backup(ind, opts)); need(o, ind, s->fill); - o.wstring(opts->input_api.stmt_peek(ind)); + o.wstring(opts->input_api.stmt_peek(ind, opts)); } else { - o.wstring(opts->input_api.stmt_skip_backup_peek(ind)); + o.wstring(opts->input_api.stmt_skip_backup_peek(ind, opts)); } } void emit_accept_binary(OutputFile &o, uint32_t ind, const DFA &dfa, const State *s, size_t l, size_t r) { + Opt &opts = o.opts; if (l < r) { const size_t m = (l + r) >> 1; o.wind(ind).ws("if (").wstring(opts->yyaccept) @@ -142,6 +146,7 @@ void emit_accept_binary(OutputFile &o, uint32_t ind, const DFA &dfa, void emit_accept(OutputFile &o, uint32_t ind, const DFA &dfa, const State *s) { + Opt &opts = o.opts; const accept_t &acc = *s->action.info.accepts; const size_t nacc = acc.size(); @@ -149,7 +154,7 @@ void emit_accept(OutputFile &o, uint32_t ind, const DFA &dfa, const State *s) return; } - o.wstring(opts->input_api.stmt_restore(ind)); + o.wstring(opts->input_api.stmt_restore(ind, opts)); // only one possible 'yyaccept' value: unconditional jump if (nacc == 1) { @@ -202,6 +207,7 @@ void emit_accept(OutputFile &o, uint32_t ind, const DFA &dfa, const State *s) void emit_rule(OutputFile &o, uint32_t ind, const DFA &dfa, size_t rule_idx) { + Opt &opts = o.opts; const Rule &rule = dfa.rules[rule_idx]; const std::string &cond = rule.info->newcond; const Code *code = rule.info->code; @@ -239,6 +245,7 @@ void need(OutputFile &o, uint32_t ind, size_t some) { assert(some > 0); + Opt &opts = o.opts; std::string s; if (opts->fFlag) { @@ -253,7 +260,7 @@ void need(OutputFile &o, uint32_t ind, size_t some) if (opts->fill_use) { o.wind(ind); if (opts->fill_check) { - o.ws("if (").wstring(opts->input_api.expr_lessthan(some)).ws(") "); + o.ws("if (").wstring(opts->input_api.expr_lessthan(some, opts)).ws(") "); } strrreplace(s = opts->fill, opts->fill_arg, some); o.wstring(s); @@ -276,7 +283,7 @@ void gen_goto_case(OutputFile &o, uint32_t ind, const State *to, const DFA &dfa, tcid_t tcid) { code_lines_t code; - gen_goto(code, to, dfa, tcid); + gen_goto(code, to, dfa, tcid, o.opts); const size_t lines = code.size(); if (lines == 1) { @@ -293,7 +300,7 @@ void gen_goto_if(OutputFile &o, uint32_t ind, const State *to, const DFA &dfa, tcid_t tcid) { code_lines_t code; - gen_goto(code, to, dfa, tcid); + gen_goto(code, to, dfa, tcid, o.opts); const size_t lines = code.size(); if (lines == 1) { @@ -311,7 +318,7 @@ void gen_goto_plain(OutputFile &o, uint32_t ind, const State *to, const DFA &dfa, tcid_t tcid) { code_lines_t code; - gen_goto(code, to, dfa, tcid); + gen_goto(code, to, dfa, tcid, o.opts); const size_t lines = code.size(); for (size_t i = 0; i < lines; ++i) { @@ -320,18 +327,21 @@ void gen_goto_plain(OutputFile &o, uint32_t ind, const State *to, } void gen_goto(code_lines_t &code, const State *to, const DFA &dfa, - tcid_t tcid) + tcid_t tcid, Opt &opts) { - gen_settags(code, dfa, tcid); + gen_settags(code, dfa, tcid, opts); if (to) { code.push_back("goto " + opts->labelPrefix + to_string(to->label) + ";\n"); } } -void gen_settags(code_lines_t &code, const DFA &dfa, tcid_t tcid) +void gen_settags(code_lines_t &code, const DFA &dfa, tcid_t tcid, Opt &opts) { const bool generic = opts->input_api.type() == InputAPI::CUSTOM; + const std::string + &prefix = opts->tags_prefix, + &expression = opts->tags_expression; const tccmd_t &cmd = dfa.tcpool[tcid]; const tagsave_t *tsave = cmd.save; const tagcopy_t *tcopy = cmd.copy; @@ -349,8 +359,8 @@ void gen_settags(code_lines_t &code, const DFA &dfa, tcid_t tcid) // copy commands for (const tagcopy_t *p = tcopy; p; p = p->next) { const std::string - l = vartag_expr(p->lhs), - r = vartag_expr(p->rhs), + l = vartag_expr(p->lhs, prefix, expression), + r = vartag_expr(p->rhs, prefix, expression), s = generic ? opts->yycopytag + " (" + l + ", " + r + ");\n" : l + " = " + r + ";\n"; @@ -361,7 +371,7 @@ void gen_settags(code_lines_t &code, const DFA &dfa, tcid_t tcid) if (generic) { for (const tagsave_t *p = tsave; p; p = p->next) { const std::string - v = vartag_expr(p->ver), + v = vartag_expr(p->ver, prefix, expression), s = p->bottom ? opts->yycopytag + " (" + v + ", " + opts->tags_default + ");\n" : opts->yybackuptag + " (" + v + ");\n"; @@ -370,7 +380,7 @@ void gen_settags(code_lines_t &code, const DFA &dfa, tcid_t tcid) } else if (tsave) { std::string s1 = "", s2 = ""; for (const tagsave_t *p = tsave; p; p = p->next) { - const std::string v = vartag_expr(p->ver); + const std::string v = vartag_expr(p->ver, prefix, expression); if (p->bottom) { s1 += v + " = "; } else { @@ -390,7 +400,11 @@ void gen_settags(code_lines_t &code, const DFA &dfa, tcid_t tcid) void gen_fintags(OutputFile &o, uint32_t ind, const DFA &dfa, const Rule &rule) { + Opt &opts = o.opts; const bool generic = opts->input_api.type() == InputAPI::CUSTOM; + const std::string + &prefix = opts->tags_prefix, + &expression = opts->tags_expression; const std::vector &vartags = dfa.vartags; const std::vector &fixtags = dfa.fixtags; const tagver_t *fins = dfa.finvers; @@ -402,7 +416,7 @@ void gen_fintags(OutputFile &o, uint32_t ind, const DFA &dfa, const Rule &rule) if (tag.name) { const std::string name = *tag.name, - expr = vartag_expr(fins[t]); + expr = vartag_expr(fins[t], prefix, expression); if (generic) { o.wstring(opts->yycopytag).ws(" (").wstring(name) .ws(", ").wstring(expr).ws(")"); @@ -416,7 +430,7 @@ void gen_fintags(OutputFile &o, uint32_t ind, const DFA &dfa, const Rule &rule) o.wstring(opts->yycursor).ws(" = ").wstring(opts->yyctxmarker); } } else { - const std::string expr = vartag_expr(fins[t]); + const std::string expr = vartag_expr(fins[t], prefix, expression); if (generic) { o.wstring(opts->yyrestoretag).ws(" (").wstring(expr).ws(")"); } else { @@ -438,7 +452,8 @@ void gen_fintags(OutputFile &o, uint32_t ind, const DFA &dfa, const Rule &rule) // to '(YYCURSOR - tag)' o.wstring(opts->yycursor).ws(" - ").wu64(tag.dist); } else { - o.wstring(vartag_expr(fins[tag.base])).ws(" - ").wu64(tag.dist); + o.wstring(vartag_expr(fins[tag.base], prefix, expression)) + .ws(" - ").wu64(tag.dist); } } else { o.wstring(opts->yycursor).ws(" -= ").wu64(tag.dist); diff --git a/re2c/src/codegen/emit_dfa.cc b/re2c/src/codegen/emit_dfa.cc index b144fdea..8350a7ae 100644 --- a/re2c/src/codegen/emit_dfa.cc +++ b/re2c/src/codegen/emit_dfa.cc @@ -11,7 +11,6 @@ #include "src/codegen/input_api.h" #include "src/codegen/label.h" #include "src/codegen/output.h" -#include "src/conf/opt.h" #include "src/globals.h" #include "src/ir/adfa/action.h" #include "src/ir/adfa/adfa.h" @@ -22,13 +21,13 @@ namespace re2c { -static std::string genGetCondition (); +static std::string genGetCondition (Opt &opts); static void genCondGotoSub (OutputFile & o, uint32_t ind, const std::vector & condnames, uint32_t cMin, uint32_t cMax); static void genCondTable (OutputFile & o, uint32_t ind, const std::vector & condnames); static void genCondGoto (OutputFile & o, uint32_t ind, const std::vector & condnames); static void emit_state (OutputFile & o, uint32_t ind, const State * s, bool used_label); -std::string genGetCondition() +std::string genGetCondition(Opt &opts) { return opts->cond_get_naked ? opts->cond_get @@ -37,20 +36,22 @@ std::string genGetCondition() void emit_state (OutputFile & o, uint32_t ind, const State * s, bool used_label) { + Opt &opts = o.opts; if (used_label) { o.wstring(opts->labelPrefix).wlabel(s->label).ws(":\n"); } if (opts->dFlag && (s->action.type != Action::INITIAL)) { - o.wind(ind).wstring(opts->yydebug).ws("(").wlabel(s->label).ws(", ").wstring(opts->input_api.expr_peek ()).ws(");\n"); + o.wind(ind).wstring(opts->yydebug).ws("(").wlabel(s->label).ws(", ").wstring(opts->input_api.expr_peek(opts)).ws(");\n"); } } -void DFA::count_used_labels (std::set & used, label_t start, label_t initial, bool force_start) const +void DFA::count_used_labels (std::set & used, label_t start, + label_t initial, bool force_start, bool fFlag) const { // In '-f' mode, default state is always state 0 - if (opts->fFlag) + if (fFlag) { used.insert (label_t::first ()); } @@ -80,7 +81,7 @@ void DFA::emit_body(OutputFile &o, uint32_t& ind, // has a piece of code that advances input position. Wee must // skip it when entering DFA. if (used_labels.count(head->label)) { - o.wind(ind).ws("goto ").wstring(opts->labelPrefix) + o.wind(ind).ws("goto ").wstring(o.opts->labelPrefix) .wlabel(initial).ws(";\n"); } @@ -96,6 +97,7 @@ void DFA::emit_dot( bool last_cond, const std::vector &conds) const { + Opt &opts = o.opts; if (!opts->cFlag || !bWroteCondCheck) { o.ws("digraph re2c {\n"); } @@ -140,7 +142,7 @@ void DFA::emit(Output & output, uint32_t& ind, bool isLastCond, bool& bPrologBra { OutputFile &o = output.source; OutputBlock &ob = o.block(); - + Opt &opts = o.opts; std::set tagnames, tagvars; if (!oldstyle_ctxmarker) { for (size_t i = 0; i < vartags.size(); ++i) { @@ -156,7 +158,7 @@ void DFA::emit(Output & output, uint32_t& ind, bool isLastCond, bool& bPrologBra } } for (tagver_t v = 1; v <= maxtagver; ++v) { - tagnames.insert(vartag_name(v)); + tagnames.insert(vartag_name(v, opts->tags_prefix)); } ob.tags.insert(tagnames.begin(), tagnames.end()); } @@ -177,7 +179,7 @@ void DFA::emit(Output & output, uint32_t& ind, bool isLastCond, bool& bPrologBra s->label = o.label_counter.next (); } std::set used_labels; - count_used_labels (used_labels, start_label, initial_label, ob.force_start_label); + count_used_labels (used_labels, start_label, initial_label, ob.force_start_label, opts->fFlag); head->action.set_initial(initial_label); @@ -286,6 +288,7 @@ void DFA::emit(Output & output, uint32_t& ind, bool isLastCond, bool& bPrologBra void genCondTable(OutputFile & o, uint32_t ind, const std::vector & condnames) { + Opt &opts = o.opts; const size_t conds = condnames.size (); o.wind(ind++).ws("static void *").wstring(opts->yyctable).ws("[").wu64(conds).ws("] = {\n"); for (size_t i = 0; i < conds; ++i) @@ -297,6 +300,7 @@ void genCondTable(OutputFile & o, uint32_t ind, const std::vector & void genCondGotoSub(OutputFile & o, uint32_t ind, const std::vector & condnames, uint32_t cMin, uint32_t cMax) { + Opt &opts = o.opts; if (cMin == cMax) { o.wind(ind).ws("goto ").wstring(opts->condPrefix).wstring(condnames[cMin]).ws(";\n"); @@ -305,7 +309,7 @@ void genCondGotoSub(OutputFile & o, uint32_t ind, const std::vector { uint32_t cMid = cMin + ((cMax - cMin + 1) / 2); - o.wind(ind).ws("if (").wstring(genGetCondition()).ws(" < ").wu32(cMid).ws(") {\n"); + o.wind(ind).ws("if (").wstring(genGetCondition(opts)).ws(" < ").wu32(cMid).ws(") {\n"); genCondGotoSub(o, ind + 1, condnames, cMin, cMid - 1); o.wind(ind).ws("} else {\n"); genCondGotoSub(o, ind + 1, condnames, cMid, cMax); @@ -338,10 +342,11 @@ void genCondGotoSub(OutputFile & o, uint32_t ind, const std::vector */ void genCondGoto(OutputFile & o, uint32_t ind, const std::vector & condnames) { + Opt &opts = o.opts; const size_t conds = condnames.size (); if (opts->gFlag) { - o.wind(ind).ws("goto *").wstring(opts->yyctable).ws("[").wstring(genGetCondition()).ws("];\n"); + o.wind(ind).ws("goto *").wstring(opts->yyctable).ws("[").wstring(genGetCondition(opts)).ws("];\n"); } else if (opts->sFlag) { @@ -354,7 +359,7 @@ void genCondGoto(OutputFile & o, uint32_t ind, const std::vector & else { o.warn_condition_order = false; // see note [condition order] - o.wind(ind).ws("switch (").wstring(genGetCondition()).ws(") {\n"); + o.wind(ind).ws("switch (").wstring(genGetCondition(opts)).ws(") {\n"); for (size_t i = 0; i < conds; ++i) { const std::string & cond = condnames[i]; @@ -366,17 +371,17 @@ void genCondGoto(OutputFile & o, uint32_t ind, const std::vector & bWroteCondCheck = true; } -std::string vartag_name(tagver_t ver) +std::string vartag_name(tagver_t ver, const std::string &prefix) { std::ostringstream s; - s << opts->tags_prefix << ver; + s << prefix << ver; return s.str(); } -std::string vartag_expr(tagver_t ver) +std::string vartag_expr(tagver_t ver, const std::string &prefix, const std::string &expression) { - const std::string s = vartag_name(ver); - std::string e = opts->tags_expression; + const std::string s = vartag_name(ver, prefix); + std::string e = expression; strrreplace(e, "@@", s); return e; } diff --git a/re2c/src/codegen/go.h b/re2c/src/codegen/go.h index e00fa056..b0d5fbec 100644 --- a/re2c/src/codegen/go.h +++ b/re2c/src/codegen/go.h @@ -129,7 +129,7 @@ struct SwitchIf Cases * cases; If * ifs; } info; - SwitchIf (const Span * sp, uint32_t nsp, const State * next); + SwitchIf (const Span * sp, uint32_t nsp, const State * next, bool sflag); ~SwitchIf (); void emit (OutputFile & o, uint32_t ind, const DFA &dfa); void used_labels (std::set & used); @@ -141,7 +141,9 @@ struct GoBitmap const State * bitmap_state; SwitchIf * hgo; SwitchIf * lgo; - GoBitmap (const Span * span, uint32_t nSpans, const Span * hspan, uint32_t hSpans, const BitMap * bm, const State * bm_state, const State * next); + GoBitmap (const Span * span, uint32_t nSpans, const Span * hspan, + uint32_t hSpans, const BitMap * bm, const State * bm_state, + const State * next, bool sflag); ~GoBitmap (); void emit (OutputFile & o, uint32_t ind, const DFA &dfa); void used_labels (std::set & used); @@ -168,7 +170,8 @@ struct Cpgoto { SwitchIf * hgo; CpgotoTable * table; - Cpgoto (const Span * span, uint32_t nSpans, const Span * hspan, uint32_t hSpans, const State * next); + Cpgoto (const Span * span, uint32_t nSpans, const Span * hspan, + uint32_t hSpans, const State * next, bool sflag); ~Cpgoto (); void emit (OutputFile & o, uint32_t ind, const DFA &dfa); void used_labels (std::set & used); @@ -210,7 +213,7 @@ struct Go Go (); ~Go (); - void init (const State * from); + void init (const State * from, Opt &opts); void emit (OutputFile & o, uint32_t ind, const DFA &dfa); void used_labels (std::set & used); diff --git a/re2c/src/codegen/go_construct.cc b/re2c/src/codegen/go_construct.cc index 680f5cb1..47fd4a76 100644 --- a/re2c/src/codegen/go_construct.cc +++ b/re2c/src/codegen/go_construct.cc @@ -6,7 +6,6 @@ #include "src/codegen/bitmap.h" #include "src/codegen/go.h" -#include "src/conf/opt.h" #include "src/globals.h" #include "src/ir/adfa/adfa.h" #include "src/util/allocate.h" @@ -120,11 +119,11 @@ If::If (type_t t, const Span * sp, uint32_t nsp, const State * next) } } -SwitchIf::SwitchIf (const Span * sp, uint32_t nsp, const State * next) +SwitchIf::SwitchIf (const Span * sp, uint32_t nsp, const State * next, bool sflag) : type (IF) , info () { - if ((!opts->sFlag && nsp > 2) || (nsp > 8 && (sp[nsp - 2].ub - sp[0].ub <= 3 * (nsp - 2)))) + if ((!sflag && nsp > 2) || (nsp > 8 && (sp[nsp - 2].ub - sp[0].ub <= 3 * (nsp - 2)))) { type = SWITCH; info.cases = new Cases (sp, nsp); @@ -139,7 +138,9 @@ SwitchIf::SwitchIf (const Span * sp, uint32_t nsp, const State * next) } } -GoBitmap::GoBitmap (const Span * span, uint32_t nSpans, const Span * hspan, uint32_t hSpans, const BitMap * bm, const State * bm_state, const State * next) +GoBitmap::GoBitmap (const Span * span, uint32_t nSpans, const Span * hspan, + uint32_t hSpans, const BitMap * bm, const State * bm_state, + const State * next, bool sflag) : bitmap (bm) , bitmap_state (bm_state) , hgo (NULL) @@ -149,12 +150,12 @@ GoBitmap::GoBitmap (const Span * span, uint32_t nSpans, const Span * hspan, uint uint32_t bSpans = unmap (bspan, span, nSpans, bm_state); lgo = bSpans == 0 ? NULL - : new SwitchIf (bspan, bSpans, next); + : new SwitchIf (bspan, bSpans, next, sflag); // if there are any low spans, then next state for high spans // must be NULL to trigger explicit goto generation in linear 'if' hgo = hSpans == 0 ? NULL - : new SwitchIf (hspan, hSpans, lgo ? NULL : next); + : new SwitchIf (hspan, hSpans, lgo ? NULL : next, sflag); operator delete (bspan); } @@ -173,8 +174,9 @@ CpgotoTable::CpgotoTable (const Span * span, uint32_t nSpans) } } -Cpgoto::Cpgoto (const Span * span, uint32_t nSpans, const Span * hspan, uint32_t hSpans, const State * next) - : hgo (hSpans == 0 ? NULL : new SwitchIf (hspan, hSpans, next)) +Cpgoto::Cpgoto (const Span * span, uint32_t nSpans, const Span * hspan, + uint32_t hSpans, const State * next, bool sflag) + : hgo (hSpans == 0 ? NULL : new SwitchIf (hspan, hSpans, next, sflag)) , table (new CpgotoTable (span, nSpans)) {} @@ -191,7 +193,7 @@ Go::Go () , info () {} -void Go::init (const State * from) +void Go::init (const State * from, Opt &opts) { if (nSpans == 0) { @@ -249,18 +251,18 @@ void Go::init (const State * from) else if (opts->gFlag && (dSpans >= opts->cGotoThreshold) && !low_spans_have_tags) { type = CPGOTO; - info.cpgoto = new Cpgoto (span, nSpans, hspan, hSpans, from->next); + info.cpgoto = new Cpgoto (span, nSpans, hspan, hSpans, from->next, opts->sFlag); } else if (opts->bFlag && (nBitmaps > 0)) { type = BITMAP; - info.bitmap = new GoBitmap (span, nSpans, hspan, hSpans, bitmap, bitmap_state, from->next); + info.bitmap = new GoBitmap (span, nSpans, hspan, hSpans, bitmap, bitmap_state, from->next, opts->sFlag); bUsedYYBitmap = true; } else { type = SWITCH_IF; - info.switchif = new SwitchIf (span, nSpans, from->next); + info.switchif = new SwitchIf (span, nSpans, from->next, opts->sFlag); } } diff --git a/re2c/src/codegen/go_emit.cc b/re2c/src/codegen/go_emit.cc index 9cc17c1b..6a0d9729 100644 --- a/re2c/src/codegen/go_emit.cc +++ b/re2c/src/codegen/go_emit.cc @@ -11,8 +11,6 @@ #include "src/codegen/label.h" #include "src/codegen/output.h" #include "src/codegen/print.h" -#include "src/conf/opt.h" -#include "src/globals.h" #include "src/ir/adfa/adfa.h" #include "src/ir/regexp/encoding/enc.h" @@ -24,11 +22,12 @@ static std::string output_hgo (OutputFile & o, uint32_t ind, const DFA &dfa, Swi void output_if (OutputFile & o, uint32_t ind, const std::string & compare, uint32_t value) { - o.wind(ind).ws("if (").wstring(opts->yych).ws(" ").wstring(compare).ws(" ").wc_hex (value).ws(") "); + o.wind(ind).ws("if (").wstring(o.opts->yych).ws(" ").wstring(compare).ws(" ").wc_hex (value).ws(") "); } std::string output_hgo (OutputFile & o, uint32_t ind, const DFA &dfa, SwitchIf * hgo) { + Opt &opts = o.opts; std::string yych = opts->yych; if (hgo != NULL) { @@ -46,6 +45,7 @@ std::string output_hgo (OutputFile & o, uint32_t ind, const DFA &dfa, SwitchIf * void Case::emit (OutputFile & o, uint32_t ind) const { + Opt &opts = o.opts; for (uint32_t i = 0; i < ranges.size (); ++i) { for (uint32_t b = ranges[i].first; b < ranges[i].second; ++b) @@ -68,7 +68,7 @@ void Case::emit (OutputFile & o, uint32_t ind) const void Cases::emit(OutputFile &o, uint32_t ind, const DFA &dfa) const { - o.wind(ind).ws("switch (").wstring(opts->yych).ws(") {\n"); + o.wind(ind).ws("switch (").wstring(o.opts->yych).ws(") {\n"); for (uint32_t i = 1; i < cases_size; ++i) { const Case &c = cases[i]; @@ -126,6 +126,7 @@ void SwitchIf::emit(OutputFile &o, uint32_t ind, const DFA &dfa) void GoBitmap::emit (OutputFile & o, uint32_t ind, const DFA &dfa) { + Opt &opts = o.opts; std::string yych = output_hgo (o, ind, dfa, hgo); o.ws("if (").wstring(opts->yybm).ws("[").wu32(bitmap->i).ws("+").wstring(yych).ws("] & "); if (opts->yybmHexTable) @@ -160,6 +161,7 @@ label_t CpgotoTable::max_label () const void CpgotoTable::emit (OutputFile & o, uint32_t ind) { + Opt &opts = o.opts; o.wind(ind).ws("static void *").wstring(opts->yytarget).ws("[256] = {\n"); o.wind(++ind); const uint32_t max_digits = max_label ().width (); @@ -188,12 +190,13 @@ void Cpgoto::emit (OutputFile & o, uint32_t ind, const DFA &dfa) std::string yych = output_hgo (o, ind, dfa, hgo); o.ws("{\n"); table->emit (o, ++ind); - o.wind(ind).ws("goto *").wstring(opts->yytarget).ws("[").wstring(yych).ws("];\n"); + o.wind(ind).ws("goto *").wstring(o.opts->yytarget).ws("[").wstring(yych).ws("];\n"); o.wind(--ind).ws("}\n"); } void Dot::emit(OutputFile &o, const DFA &dfa) { + const std::string &prefix = o.opts->tags_prefix; const uint32_t n = cases->cases_size; if (n == 1) { o.wlabel(from->label).ws(" -> ").wlabel(cases->cases[0].to->label).ws("\n"); @@ -206,11 +209,11 @@ void Dot::emit(OutputFile &o, const DFA &dfa) } const tccmd_t &cmd = dfa.tcpool[c.tags]; for (const tagsave_t *p = cmd.save; p; p = p->next) { - o.ws("<").wstring(vartag_name(p->ver)).ws(">"); + o.ws("<").wstring(vartag_name(p->ver, prefix)).ws(">"); } for (const tagcopy_t *p = cmd.copy; p; p = p->next) { - o.ws("<").wstring(vartag_name(p->lhs)).ws("~") - .wstring(vartag_name(p->rhs)).ws(">"); + o.ws("<").wstring(vartag_name(p->lhs, prefix)).ws("~") + .wstring(vartag_name(p->rhs, prefix)).ws(">"); } o.ws("\"]\n"); } @@ -220,7 +223,7 @@ void Dot::emit(OutputFile &o, const DFA &dfa) void Go::emit (OutputFile & o, uint32_t ind, const DFA &dfa) { code_lines_t code; - gen_settags(code, dfa, tags); + gen_settags(code, dfa, tags, o.opts); for (size_t i = 0; i < code.size(); ++i) { o.wind(ind).wstring(code[i]); } diff --git a/re2c/src/codegen/indent.h b/re2c/src/codegen/indent.h deleted file mode 100644 index d00e46f0..00000000 --- a/re2c/src/codegen/indent.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef _RE2C_CODEGEN_INDENT_ -#define _RE2C_CODEGEN_INDENT_ - -#include - -#include "src/globals.h" - -namespace re2c -{ - -inline std::string indent(uint32_t ind) -{ - std::string str; - while (ind-- > 0) { - str += opts->indString; - } - return str; -} - -} // end namespace re2c - -#endif // _RE2C_CODEGEN_INDENT_ diff --git a/re2c/src/codegen/input_api.cc b/re2c/src/codegen/input_api.cc index 3f6e1ce7..beeffa97 100644 --- a/re2c/src/codegen/input_api.cc +++ b/re2c/src/codegen/input_api.cc @@ -3,9 +3,6 @@ #include "src/codegen/emit.h" #include "src/codegen/input_api.h" -#include "src/codegen/indent.h" -#include "src/conf/opt.h" -#include "src/globals.h" namespace re2c { @@ -24,7 +21,7 @@ void InputAPI::set (type_t t) type_ = t; } -std::string InputAPI::expr_peek () const +std::string InputAPI::expr_peek(Opt &opts) const { std::string s; switch (type_) @@ -39,13 +36,13 @@ std::string InputAPI::expr_peek () const return s; } -std::string InputAPI::stmt_peek (uint32_t ind) const +std::string InputAPI::stmt_peek(uint32_t ind, Opt &opts) const { - return indent(ind) + opts->yych + " = " + opts.yychConversion() - + expr_peek() + ";\n"; + return indent(ind, opts->indString) + opts->yych + " = " + opts.yychConversion() + + expr_peek(opts) + ";\n"; } -std::string InputAPI::stmt_skip (uint32_t ind) const +std::string InputAPI::stmt_skip(uint32_t ind, Opt &opts) const { std::string s; switch (type_) @@ -57,10 +54,10 @@ std::string InputAPI::stmt_skip (uint32_t ind) const s = opts->yyskip + " ()"; break; } - return indent (ind) + s + ";\n"; + return indent(ind, opts->indString) + s + ";\n"; } -std::string InputAPI::stmt_backup (uint32_t ind) const +std::string InputAPI::stmt_backup(uint32_t ind, Opt &opts) const { std::string s; switch (type_) @@ -72,10 +69,10 @@ std::string InputAPI::stmt_backup (uint32_t ind) const s = opts->yybackup + " ()"; break; } - return indent (ind) + s + ";\n"; + return indent(ind, opts->indString) + s + ";\n"; } -std::string InputAPI::stmt_restore (uint32_t ind) const +std::string InputAPI::stmt_restore(uint32_t ind, Opt &opts) const { std::string s; switch (type_) @@ -87,38 +84,38 @@ std::string InputAPI::stmt_restore (uint32_t ind) const s = opts->yyrestore + " ()"; break; } - return indent (ind) + s + ";\n"; + return indent(ind, opts->indString) + s + ";\n"; } -std::string InputAPI::stmt_skip_peek (uint32_t ind) const +std::string InputAPI::stmt_skip_peek(uint32_t ind, Opt &opts) const { return type_ == DEFAULT - ? indent (ind) + opts->yych + " = " + opts.yychConversion () + "*++" + opts->yycursor + ";\n" - : stmt_skip (ind) + stmt_peek (ind); + ? indent(ind, opts->indString) + opts->yych + " = " + opts.yychConversion() + "*++" + opts->yycursor + ";\n" + : stmt_skip(ind, opts) + stmt_peek(ind, opts); } -std::string InputAPI::stmt_skip_backup (uint32_t ind) const +std::string InputAPI::stmt_skip_backup(uint32_t ind, Opt &opts) const { return type_ == DEFAULT - ? indent (ind) + opts->yymarker + " = ++" + opts->yycursor + ";\n" - : stmt_skip (ind) + stmt_backup (ind); + ? indent(ind, opts->indString) + opts->yymarker + " = ++" + opts->yycursor + ";\n" + : stmt_skip(ind, opts) + stmt_backup(ind, opts); } -std::string InputAPI::stmt_backup_peek (uint32_t ind) const +std::string InputAPI::stmt_backup_peek(uint32_t ind, Opt &opts) const { return type_ == DEFAULT - ? indent (ind) + opts->yych + " = " + opts.yychConversion () + "*(" + opts->yymarker + " = " + opts->yycursor + ");\n" - : stmt_backup (ind) + stmt_peek (ind); + ? indent(ind, opts->indString) + opts->yych + " = " + opts.yychConversion() + "*(" + opts->yymarker + " = " + opts->yycursor + ");\n" + : stmt_backup(ind, opts) + stmt_peek(ind, opts); } -std::string InputAPI::stmt_skip_backup_peek (uint32_t ind) const +std::string InputAPI::stmt_skip_backup_peek(uint32_t ind, Opt &opts) const { return type_ == DEFAULT - ? indent (ind) + opts->yych + " = " + opts.yychConversion () + "*(" + opts->yymarker + " = ++" + opts->yycursor + ");\n" - : stmt_skip (ind) + stmt_backup (ind) + stmt_peek (ind); + ? indent(ind, opts->indString) + opts->yych + " = " + opts.yychConversion() + "*(" + opts->yymarker + " = ++" + opts->yycursor + ");\n" + : stmt_skip(ind, opts) + stmt_backup(ind, opts) + stmt_peek(ind, opts); } -std::string InputAPI::expr_lessthan(size_t n) const +std::string InputAPI::expr_lessthan(size_t n, Opt &opts) const { std::ostringstream s; if (type_ == CUSTOM) { diff --git a/re2c/src/codegen/input_api.h b/re2c/src/codegen/input_api.h index 5af4a124..1a895504 100644 --- a/re2c/src/codegen/input_api.h +++ b/re2c/src/codegen/input_api.h @@ -2,15 +2,13 @@ #define _RE2C_CODEGEN_INPUT_API_ #include "src/util/c99_stdint.h" -#include #include -#include - -#include "src/ir/tag.h" namespace re2c { +struct Opt; + class InputAPI { public: @@ -26,16 +24,16 @@ public: InputAPI (); type_t type () const; void set (type_t t); - std::string expr_peek () const; - std::string stmt_peek (uint32_t ind) const; - std::string stmt_skip (uint32_t ind) const; - std::string stmt_backup (uint32_t ind) const; - std::string stmt_restore (uint32_t ind) const; - std::string stmt_skip_peek (uint32_t ind) const; - std::string stmt_skip_backup (uint32_t ind) const; - std::string stmt_backup_peek (uint32_t ind) const; - std::string stmt_skip_backup_peek (uint32_t ind) const; - std::string expr_lessthan (size_t n) const; + std::string expr_peek (Opt &opts) const; + std::string stmt_peek (uint32_t ind, Opt &opts) const; + std::string stmt_skip (uint32_t ind, Opt &opts) const; + std::string stmt_backup (uint32_t ind, Opt &opts) const; + std::string stmt_restore (uint32_t ind, Opt &opts) const; + std::string stmt_skip_peek (uint32_t ind, Opt &opts) const; + std::string stmt_skip_backup (uint32_t ind, Opt &opts) const; + std::string stmt_backup_peek (uint32_t ind, Opt &opts) const; + std::string stmt_skip_backup_peek (uint32_t ind, Opt &opts) const; + std::string expr_lessthan (size_t n, Opt &opts) const; }; } // end namespace re2c diff --git a/re2c/src/codegen/output.cc b/re2c/src/codegen/output.cc index 8150b946..a4b86774 100644 --- a/re2c/src/codegen/output.cc +++ b/re2c/src/codegen/output.cc @@ -2,11 +2,10 @@ #include #include -#include "src/codegen/indent.h" +#include "src/codegen/emit.h" #include "src/codegen/output.h" #include "src/codegen/print.h" #include "src/conf/msg.h" -#include "src/conf/opt.h" #include "src/conf/warn.h" #include "src/util/string_utils.h" #include "src/globals.h" @@ -62,10 +61,11 @@ OutputBlock::~OutputBlock () } } -OutputFile::OutputFile() +OutputFile::OutputFile(Opt &o) : blocks () , label_counter () - , warn_condition_order (!opts->tFlag) // see note [condition order] + , warn_condition_order (!o->tFlag) // see note [condition order] + , opts(o) { new_block (); } @@ -95,19 +95,21 @@ OutputFile &OutputFile::wraw(const char *s, const char *e) OutputFile & OutputFile::wu32_hex (uint32_t n) { - prtHex (stream (), n); + prtHex(stream(), n, opts->encoding.szCodeUnit()); return *this; } OutputFile & OutputFile::wc_hex (uint32_t n) { - prtChOrHex (stream (), n); + const Enc &e = opts->encoding; + prtChOrHex(stream(), n, e.szCodeUnit(), e.type() == Enc::EBCDIC, opts->target == opt_t::DOT); return *this; } OutputFile & OutputFile::wrange (uint32_t l, uint32_t u) { - printSpan (stream (), l, u); + const Enc &e = opts->encoding; + printSpan(stream(), l, u, e.szCodeUnit(), e.type() == Enc::EBCDIC, opts->target == opt_t::DOT); return *this; } @@ -120,13 +122,13 @@ OutputFile & OutputFile::wu32_width (uint32_t n, int w) OutputFile & OutputFile::wline_info (uint32_t l, const char * fn) { - output_line_info (stream (), l, fn); + output_line_info (stream (), l, fn, opts); return *this; } OutputFile & OutputFile::wversion_time () { - output_version_time (stream ()); + output_version_time (stream (), opts); return *this; } @@ -178,7 +180,7 @@ OutputFile & OutputFile::wlabel (label_t l) OutputFile & OutputFile::wind (uint32_t ind) { - stream () << indent(ind); + stream () << indent(ind, opts->indString); return *this; } @@ -290,16 +292,16 @@ bool OutputFile::emit(const uniq_vector_t &global_types, switch (f.type) { case OutputFragment::CODE: break; case OutputFragment::LINE_INFO: - output_line_info(f.stream, line_count + 1, filename); + output_line_info(f.stream, line_count + 1, filename, opts); break; case OutputFragment::STATE_GOTO: - output_state_goto(f.stream, f.indent, 0); + output_state_goto(f.stream, f.indent, 0, opts); break; case OutputFragment::TAGS: output_tags(f.stream, *f.tags, global_tags); break; case OutputFragment::TYPES: - output_types(f.stream, f.indent, global_types); + output_types(f.stream, f.indent, global_types, opts); break; case OutputFragment::WARN_CONDITION_ORDER: if (warn_condition_order) {// see note [condition order] @@ -307,7 +309,7 @@ bool OutputFile::emit(const uniq_vector_t &global_types, } break; case OutputFragment::YYACCEPT_INIT: - output_yyaccept_init(f.stream, f.indent, b.used_yyaccept); + output_yyaccept_init(f.stream, f.indent, b.used_yyaccept, opts); break; case OutputFragment::YYMAXFILL: output_yymaxfill(f.stream, max_fill); @@ -323,7 +325,7 @@ bool OutputFile::emit(const uniq_vector_t &global_types, return true; } -bool HeaderFile::emit(const uniq_vector_t &types) +bool HeaderFile::emit(const uniq_vector_t &types, Opt &opts) { if (!opts->tFlag) { return true; @@ -342,10 +344,10 @@ bool HeaderFile::emit(const uniq_vector_t &types) } } - output_version_time(stream); - output_line_info(stream, 3, filename); + output_version_time(stream, opts); + output_line_info(stream, 3, filename, opts); stream << "\n"; - output_types(stream, 0, types); + output_types(stream, 0, types, opts); std::string content = stream.str(); fwrite(content.c_str(), 1, content.size(), file); @@ -354,8 +356,8 @@ bool HeaderFile::emit(const uniq_vector_t &types) return true; } -Output::Output() - : source() +Output::Output(Opt &o) + : source(o) , header() , skeletons() , max_fill(1) @@ -372,7 +374,7 @@ bool Output::emit() source.global_lists(types, tags); return source.emit(types, tags, max_fill) - && header.emit(types); + && header.emit(types, source.opts); } void output_tags(std::ostream &o, const ConfTags &conf, @@ -392,34 +394,35 @@ void output_tags(std::ostream &o, const ConfTags &conf, } } -void output_state_goto (std::ostream & o, uint32_t ind, uint32_t start_label) +void output_state_goto (std::ostream & o, uint32_t ind, uint32_t start_label, Opt &opts) { - o << indent(ind) << "switch (" << output_get_state() << ") {\n"; + const std::string indstr = indent(ind, opts->indString); + o << indstr << "switch (" << output_get_state(opts) << ") {\n"; if (opts->bUseStateAbort) { - o << indent(ind) << "default: abort();\n"; - o << indent(ind) << "case -1: goto " << opts->labelPrefix << start_label << ";\n"; + o << indstr << "default: abort();\n"; + o << indstr << "case -1: goto " << opts->labelPrefix << start_label << ";\n"; } else { - o << indent(ind) << "default: goto " << opts->labelPrefix << start_label << ";\n"; + o << indstr << "default: goto " << opts->labelPrefix << start_label << ";\n"; } for (uint32_t i = 0; i < last_fill_index; ++i) { - o << indent(ind) << "case " << i << ": goto " << opts->yyfilllabel << i << ";\n"; + o << indstr << "case " << i << ": goto " << opts->yyfilllabel << i << ";\n"; } - o << indent(ind) << "}\n"; + o << indstr << "}\n"; if (opts->bUseStateNext) { o << opts->yynext << ":\n"; } } -void output_yyaccept_init (std::ostream & o, uint32_t ind, bool used_yyaccept) +void output_yyaccept_init (std::ostream & o, uint32_t ind, bool used_yyaccept, Opt &opts) { if (used_yyaccept) { - o << indent (ind) << "unsigned int " << opts->yyaccept << " = 0;\n"; + o << indent(ind, opts->indString) << "unsigned int " << opts->yyaccept << " = 0;\n"; } } @@ -428,7 +431,7 @@ void output_yymaxfill (std::ostream & o, size_t max_fill) o << "#define YYMAXFILL " << max_fill << "\n"; } -void output_line_info (std::ostream & o, uint32_t line_number, const std::string &file_name) +void output_line_info (std::ostream & o, uint32_t line_number, const std::string &file_name, Opt &opts) { if (!opts->iFlag) { @@ -439,16 +442,17 @@ void output_line_info (std::ostream & o, uint32_t line_number, const std::string void output_types( std::ostream &o, uint32_t ind, - const uniq_vector_t &types) + const uniq_vector_t &types, Opt &opts) { - o << indent(ind++) << "enum " << opts->yycondtype << " {\n"; + const std::string indstr = opts->indString; + o << indent(ind++, indstr) << "enum " << opts->yycondtype << " {\n"; for (size_t i = 0; i < types.size(); ++i) { - o << indent(ind) << opts->condEnumPrefix << types[i] << ",\n"; + o << indent(ind, indstr) << opts->condEnumPrefix << types[i] << ",\n"; } - o << indent(--ind) << "};\n"; + o << indent(--ind, indstr) << "};\n"; } -void output_version_time (std::ostream & o) +void output_version_time (std::ostream & o, Opt &opts) { o << "/* Generated by re2c"; if (opts->version) @@ -464,7 +468,7 @@ void output_version_time (std::ostream & o) o << " */" << "\n"; } -std::string output_get_state () +std::string output_get_state (Opt &opts) { return opts->state_get_naked ? opts->state_get diff --git a/re2c/src/codegen/output.h b/re2c/src/codegen/output.h index 70e301ad..898ce585 100644 --- a/re2c/src/codegen/output.h +++ b/re2c/src/codegen/output.h @@ -11,6 +11,7 @@ #include #include "src/codegen/label.h" +#include "src/conf/opt.h" #include "src/util/counter.h" #include "src/util/forbid_copy.h" #include "src/util/uniq_vector.h" @@ -75,8 +76,9 @@ class OutputFile public: counter_t label_counter; bool warn_condition_order; + Opt &opts; - OutputFile(); + explicit OutputFile(Opt &o); ~OutputFile(); std::ostream & stream (); @@ -126,7 +128,7 @@ class HeaderFile public: HeaderFile(): stream() {} - bool emit(const uniq_vector_t &types); + bool emit(const uniq_vector_t &types, Opt &opts); FORBID_COPY (HeaderFile); }; @@ -137,20 +139,20 @@ struct Output std::set skeletons; size_t max_fill; - Output(); + explicit Output(Opt &o); bool emit(); }; void output_tags(std::ostream &o, const ConfTags &conf, const std::set &tags); -void output_line_info (std::ostream &, uint32_t, const std::string&); -void output_state_goto (std::ostream &, uint32_t, uint32_t); -void output_types(std::ostream &o, uint32_t, const uniq_vector_t &types); -void output_version_time (std::ostream &); -void output_yyaccept_init (std::ostream &, uint32_t, bool); +void output_line_info (std::ostream &, uint32_t, const std::string&, Opt &opts); +void output_state_goto (std::ostream &, uint32_t, uint32_t, Opt &opts); +void output_types(std::ostream &o, uint32_t, const uniq_vector_t &types, Opt &opts); +void output_version_time (std::ostream &, Opt &opts); +void output_yyaccept_init (std::ostream &, uint32_t, bool, Opt &opts); void output_yymaxfill (std::ostream &, size_t); // helpers -std::string output_get_state (); +std::string output_get_state (Opt &opts); } // namespace re2c diff --git a/re2c/src/codegen/print.cc b/re2c/src/codegen/print.cc index 2303e847..854ba93e 100644 --- a/re2c/src/codegen/print.cc +++ b/re2c/src/codegen/print.cc @@ -1,153 +1,93 @@ #include #include "src/codegen/print.h" -#include "src/conf/opt.h" -#include "src/globals.h" -#include "src/ir/regexp/encoding/enc.h" namespace re2c { -bool is_print (uint32_t c) +static bool is_space(uint32_t c) { - return c >= 0x20 && c < 0x7F; -} - -bool is_space (uint32_t c) -{ - switch (c) - { - case '\t': - case '\f': - case '\v': - case '\n': - case '\r': - case ' ': - return true; - default: - return false; + switch (c) { + case '\t': + case '\f': + case '\v': + case '\n': + case '\r': + case ' ': return true; + default: return false; } } -char hexCh(uint32_t c) +static inline char hex(uint32_t c) { static const char * sHex = "0123456789ABCDEF"; return sHex[c & 0x0F]; } -void prtChOrHex(std::ostream& o, uint32_t c) +static void prtCh(std::ostream& o, uint32_t c, bool dot) { - if (opts->encoding.type () != Enc::EBCDIC - && (is_print (c) || is_space (c))) - { - o << '\''; - prtCh(o, c); - o << '\''; - } - else - { - prtHex(o, c); + switch (c) { + case '\'': o << (dot ? "'" : "\\'"); break; + case '"': o << (dot ? "\\\"" : "\""); break; + case '\n': o << (dot ? "\\\\n" : "\\n"); break; + case '\t': o << (dot ? "\\\\t" : "\\t"); break; + case '\v': o << (dot ? "\\\\v" : "\\v"); break; + case '\b': o << (dot ? "\\\\b" : "\\b"); break; + case '\r': o << (dot ? "\\\\r" : "\\r"); break; + case '\f': o << (dot ? "\\\\f" : "\\f"); break; + case '\a': o << (dot ? "\\\\a" : "\\a"); break; + case '\\': o << "\\\\"; break; // both .dot and C/C++ code expect "\\" + default: o << static_cast (c); break; } } -void prtHex(std::ostream& o, uint32_t c) +bool is_print(uint32_t c) { - o << "0x"; - const uint32_t cunit_size = opts->encoding.szCodeUnit (); - if (cunit_size >= 4) - { - o << hexCh (c >> 28u) - << hexCh (c >> 24u) - << hexCh (c >> 20u) - << hexCh (c >> 16u); - } - if (cunit_size >= 2) - { - o << hexCh (c >> 12u) - << hexCh (c >> 8u); - } - o << hexCh (c >> 4u) - << hexCh (c); + return c >= 0x20 && c < 0x7F; } -void prtCh(std::ostream& o, uint32_t c) +void prtHex(std::ostream& o, uint32_t c, uint32_t szcunit) { - const bool dot = opts->target == opt_t::DOT; - - switch (c) - { - case '\'': - o << (dot ? "'" : "\\'"); - break; - - case '"': - o << (dot ? "\\\"" : "\""); - break; - - case '\n': - o << (dot ? "\\\\n" : "\\n"); - break; - - case '\t': - o << (dot ? "\\\\t" : "\\t"); - break; - - case '\v': - o << (dot ? "\\\\v" : "\\v"); - break; - - case '\b': - o << (dot ? "\\\\b" : "\\b"); - break; - - case '\r': - o << (dot ? "\\\\r" : "\\r"); - break; + o << "0x"; - case '\f': - o << (dot ? "\\\\f" : "\\f"); - break; + if (szcunit >= 4) { + o << hex(c >> 28u) << hex(c >> 24u) << hex(c >> 20u) << hex(c >> 16u); + } - case '\a': - o << (dot ? "\\\\a" :"\\a"); - break; + if (szcunit >= 2) { + o << hex(c >> 12u) << hex(c >> 8u); + } - case '\\': - o << "\\\\"; // both .dot and C/C++ code expect "\\" - break; + o << hex(c >> 4u) << hex(c); +} - default: - o << static_cast (c); - break; +void prtChOrHex(std::ostream& o, uint32_t c, uint32_t szcunit, bool ebcdic, bool dot) +{ + if (!ebcdic && (is_print(c) || is_space(c))) { + o << '\''; + prtCh(o, c, dot); + o << '\''; + } else { + prtHex(o, c, szcunit); } } -void prtChOrHexForSpan(std::ostream& o, uint32_t c) +void prtChOrHexForSpan(std::ostream& o, uint32_t c, uint32_t szcunit, bool ebcdic, bool dot) { - if (opts->encoding.type () != Enc::EBCDIC - && is_print (c) - && (c != ']')) - { - prtCh(o, c); - } - else - { - prtHex(o, c); + if (!ebcdic && c != ']' && is_print(c)) { + prtCh(o, c, dot); + } else { + prtHex(o, c, szcunit); } } -void printSpan(std::ostream& o, uint32_t lb, uint32_t ub) +void printSpan(std::ostream& o, uint32_t lb, uint32_t ub, uint32_t szcunit, bool ebcdic, bool dot) { o << "["; - if ((ub - lb) == 1) - { - prtChOrHexForSpan(o, lb); - } - else - { - prtChOrHexForSpan(o, lb); + prtChOrHexForSpan(o, lb, szcunit, ebcdic, dot); + if (ub - lb > 1) { o << "-"; - prtChOrHexForSpan(o, ub - 1); + prtChOrHexForSpan(o, ub - 1, szcunit, ebcdic, dot); } o << "]"; } diff --git a/re2c/src/codegen/print.h b/re2c/src/codegen/print.h index 978d13e5..7e2adddc 100644 --- a/re2c/src/codegen/print.h +++ b/re2c/src/codegen/print.h @@ -7,13 +7,10 @@ namespace re2c { -bool is_print (uint32_t c); -bool is_space (uint32_t c); -char hexCh(uint32_t c); -void prtCh(std::ostream&, uint32_t); -void prtHex(std::ostream&, uint32_t); -void prtChOrHex(std::ostream&, uint32_t); -void printSpan(std::ostream&, uint32_t, uint32_t); +bool is_print (uint32_t c); +void prtHex (std::ostream &o, uint32_t c, uint32_t szcunit); +void prtChOrHex (std::ostream &o, uint32_t c, uint32_t szcunit, bool ebcdic, bool dot); +void printSpan (std::ostream &o, uint32_t l, uint32_t u, uint32_t szcunit, bool ebcdic, bool dot); } // end namespace re2c diff --git a/re2c/src/conf/opt.cc b/re2c/src/conf/opt.cc index f8c515d2..f13ed385 100644 --- a/re2c/src/conf/opt.cc +++ b/re2c/src/conf/opt.cc @@ -5,8 +5,6 @@ namespace re2c { -Opt opts; - opt_t::opt_t () #define OPT1(type, name, value) : name (value) #define OPT(type, name, value) , name (value) diff --git a/re2c/src/globals.h b/re2c/src/globals.h index b2ea67ae..7ab3cac7 100644 --- a/re2c/src/globals.h +++ b/re2c/src/globals.h @@ -3,7 +3,6 @@ #include -#include "src/conf/opt.h" #include "src/conf/warn.h" #include "src/util/c99_stdint.h" @@ -16,7 +15,6 @@ extern bool bWroteCondCheck; extern uint32_t last_fill_index; extern std::string yySetupRule; -extern Opt opts; extern Warn warn; } // end namespace re2c diff --git a/re2c/src/ir/adfa/adfa.cc b/re2c/src/ir/adfa/adfa.cc index afd24de2..af7d4878 100644 --- a/re2c/src/ir/adfa/adfa.cc +++ b/re2c/src/ir/adfa/adfa.cc @@ -4,13 +4,11 @@ #include #include -#include "src/conf/opt.h" #include "src/codegen/go.h" #include "src/ir/adfa/adfa.h" #include "src/ir/dfa/dfa.h" #include "src/ir/skeleton/skeleton.h" #include "src/util/allocate.h" -#include "src/globals.h" namespace re2c { diff --git a/re2c/src/ir/adfa/adfa.h b/re2c/src/ir/adfa/adfa.h index 5d2eb639..1bc1f3d8 100644 --- a/re2c/src/ir/adfa/adfa.h +++ b/re2c/src/ir/adfa/adfa.h @@ -90,8 +90,8 @@ struct DFA ); ~DFA (); void reorder(); - void prepare(); - void calc_stats(uint32_t line); + void prepare(Opt &opts); + void calc_stats(uint32_t line, bool explicit_tags); void emit (Output &, uint32_t &, bool, bool &); private: @@ -99,7 +99,7 @@ private: void split (State *); void findBaseState (); void hoist_tags(); - void count_used_labels (std::set & used, label_t prolog, label_t start, bool force_start) const; + void count_used_labels (std::set & used, label_t prolog, label_t start, bool force_start, bool fFlag) const; void emit_body (OutputFile &, uint32_t &, const std::set & used_labels, label_t initial) const; void emit_dot(OutputFile &o, bool last_cond, const std::vector &conds) const; diff --git a/re2c/src/ir/adfa/prepare.cc b/re2c/src/ir/adfa/prepare.cc index 6804b8af..0de6dd97 100644 --- a/re2c/src/ir/adfa/prepare.cc +++ b/re2c/src/ir/adfa/prepare.cc @@ -100,7 +100,7 @@ void DFA::findBaseState() operator delete (span); } -void DFA::prepare () +void DFA::prepare (Opt &opts) { bUsedYYBitmap = false; @@ -186,11 +186,11 @@ void DFA::prepare () for (State * s = head; s; s = s->next) { - s->go.init (s); + s->go.init (s, opts); } } -void DFA::calc_stats(uint32_t line) +void DFA::calc_stats(uint32_t line, bool explicit_tags) { // calculate 'YYMAXFILL' max_fill = 0; @@ -214,10 +214,10 @@ void DFA::calc_stats(uint32_t line) // re2c should use old-style YYCTXMARKER for backwards compatibility. // Note that with generic API fixed-length contexts are forbidden, // which may cause additional overlaps. - oldstyle_ctxmarker = maxtagver == 1 && !opts->tags; + oldstyle_ctxmarker = !explicit_tags && maxtagver == 1; // error if tags are not enabled, but we need them - if (!opts->tags && maxtagver > 1) { + if (!explicit_tags && maxtagver > 1) { error("line %u: overlapping trailing contexts need " "multiple context markers, use '-t, --tags' " "option and '/*!tags:re2c ... */' directive", diff --git a/re2c/src/ir/compile.cc b/re2c/src/ir/compile.cc index cb33e5ec..930a88cd 100644 --- a/re2c/src/ir/compile.cc +++ b/re2c/src/ir/compile.cc @@ -3,7 +3,6 @@ #include #include "src/codegen/output.h" -#include "src/conf/opt.h" #include "src/ir/compile.h" #include "src/ir/adfa/adfa.h" #include "src/ir/adfa/dump.h" @@ -13,7 +12,6 @@ #include "src/ir/regexp/regexp.h" #include "src/ir/skeleton/skeleton.h" #include "src/parse/spec.h" -#include "src/globals.h" namespace re2c { @@ -39,6 +37,7 @@ static smart_ptr compile_rules( { const uint32_t line = output.source.block().line; const std::string name = make_name(cond, line); + Opt &opts = output.source.opts; warn_nullable(rules, cond); @@ -58,9 +57,9 @@ static smart_ptr compile_rules( cs.push_back(*i); } - nfa_t nfa(rules); + nfa_t nfa(rules, opts->input_api.type()); - dfa_t dfa(nfa, cs, cond); + dfa_t dfa(nfa, cs, cond, opts->bijective_mapping, opts->dump_dfa_raw); if (opts->dump_dfa_det) dump_dfa(dfa); // skeleton must be constructed after DFA construction @@ -68,7 +67,7 @@ static smart_ptr compile_rules( Skeleton skeleton(dfa, cs, defrule, name, cond, line); warn_undefined_control_flow(skeleton); if (opts->target == opt_t::SKELETON) { - emit_data(skeleton); + emit_data(skeleton, opts->output_file, opts->encoding.szCodeUnit()); } cutoff_dead_rules(dfa, defrule, cond); @@ -79,7 +78,7 @@ static smart_ptr compile_rules( optimize_tags(dfa); if (opts->dump_dfa_tagopt) dump_dfa(dfa); - minimization(dfa); + minimization(dfa, opts->dfa_minimization); if (opts->dump_dfa_min) dump_dfa(dfa); // find YYFILL states and calculate argument to YYFILL @@ -93,11 +92,11 @@ static smart_ptr compile_rules( adfa->reorder(); // skeleton is constructed, do further DFA transformations - adfa->prepare(); + adfa->prepare(opts); if (opts->dump_adfa) dump_adfa(*adfa); // finally gather overall DFA statistics - adfa->calc_stats(line); + adfa->calc_stats(line, opts->tags); // accumulate global statistics from this particular DFA output.max_fill = std::max (output.max_fill, adfa->max_fill); diff --git a/re2c/src/ir/dfa/dead_rules.cc b/re2c/src/ir/dfa/dead_rules.cc index 76041f34..2be44084 100644 --- a/re2c/src/ir/dfa/dead_rules.cc +++ b/re2c/src/ir/dfa/dead_rules.cc @@ -1,6 +1,5 @@ #include -#include "src/conf/opt.h" #include "src/ir/dfa/dfa.h" #include "src/util/forbid_copy.h" #include "src/globals.h" diff --git a/re2c/src/ir/dfa/determinization.cc b/re2c/src/ir/dfa/determinization.cc index 5f93da51..0e1297ab 100644 --- a/re2c/src/ir/dfa/determinization.cc +++ b/re2c/src/ir/dfa/determinization.cc @@ -49,9 +49,8 @@ void reach(const kernel_t *kernel, closure_t &clos, uint32_t symbol) } } -dfa_t::dfa_t(const nfa_t &nfa, - const charset_t &charset, - const std::string &cond) +dfa_t::dfa_t(const nfa_t &nfa, const charset_t &charset, + const std::string &cond, bool bijection, bool debug) : states() , nchars(charset.size() - 1) // (n + 1) bounds for n ranges , rules(nfa.rules) @@ -63,9 +62,9 @@ dfa_t::dfa_t(const nfa_t &nfa, { const size_t ntag = vartags.size(); Tagpool tagpool(ntag); - kernels_t kernels(tagpool); + kernels_t kernels(tagpool, bijection); closure_t clos1, clos2; - dump_dfa_t dump(*this, tagpool, nfa); + dump_dfa_t dump(*this, tagpool, nfa, debug); // all-zero tag configuration must have static number zero assert(ZERO_TAGS == tagpool.insert_const(TAGVER_ZERO)); diff --git a/re2c/src/ir/dfa/dfa.h b/re2c/src/ir/dfa/dfa.h index e6492b40..20a3c765 100644 --- a/re2c/src/ir/dfa/dfa.h +++ b/re2c/src/ir/dfa/dfa.h @@ -58,7 +58,7 @@ struct dfa_t tagver_t maxtagver; dfa_t(const nfa_t &nfa, const charset_t &charset, - const std::string &cond); + const std::string &cond, bool bijection, bool debug); ~dfa_t(); FORBID_COPY(dfa_t); @@ -70,7 +70,7 @@ enum dfa_minimization_t DFA_MINIMIZATION_MOORE }; -void minimization(dfa_t &dfa); +void minimization(dfa_t &dfa, dfa_minimization_t type); void fillpoints(const dfa_t &dfa, std::vector &fill); void cutoff_dead_rules(dfa_t &dfa, size_t defrule, const std::string &cond); void insert_fallback_tags(dfa_t &dfa); diff --git a/re2c/src/ir/dfa/dump.cc b/re2c/src/ir/dfa/dump.cc index 3e838669..157ddb65 100644 --- a/re2c/src/ir/dfa/dump.cc +++ b/re2c/src/ir/dfa/dump.cc @@ -1,8 +1,6 @@ #include -#include "src/conf/opt.h" #include "src/ir/dfa/dump.h" -#include "src/globals.h" namespace re2c { @@ -12,8 +10,8 @@ static void dump_tcmd(const tagsave_t *s, const tagcopy_t *c); static const char *tagname(const VarTag &t); static void dump_tags(const Tagpool &tagpool, size_t ttran, size_t tvers); -dump_dfa_t::dump_dfa_t(const dfa_t &d, const Tagpool &pool, const nfa_t &n) - : debug(opts->dump_dfa_raw) +dump_dfa_t::dump_dfa_t(const dfa_t &d, const Tagpool &pool, const nfa_t &n, bool dbg) + : debug(dbg) , dfa(d) , tagpool(pool) , uniqidx(0) diff --git a/re2c/src/ir/dfa/dump.h b/re2c/src/ir/dfa/dump.h index 3bb2f2e8..8fb397fd 100644 --- a/re2c/src/ir/dfa/dump.h +++ b/re2c/src/ir/dfa/dump.h @@ -15,7 +15,7 @@ struct dump_dfa_t uint32_t uniqidx; const nfa_state_t *base; - dump_dfa_t(const dfa_t &d, const Tagpool &pool, const nfa_t &n); + dump_dfa_t(const dfa_t &d, const Tagpool &pool, const nfa_t &n, bool dbg); ~dump_dfa_t(); void closure(const closure_t &clos, uint32_t state, bool isnew); void state0(const closure_t &clos); diff --git a/re2c/src/ir/dfa/find_state.cc b/re2c/src/ir/dfa/find_state.cc index 8cacd1a2..6062f2c7 100644 --- a/re2c/src/ir/dfa/find_state.cc +++ b/re2c/src/ir/dfa/find_state.cc @@ -1,9 +1,7 @@ #include -#include "src/conf/opt.h" #include "src/ir/dfa/find_state.h" #include "src/util/hash32.h" -#include "src/globals.h" namespace re2c { @@ -43,14 +41,14 @@ struct kernel_eq_t } }; -mapping_t::mapping_t(Tagpool &pool) +mapping_t::mapping_t(Tagpool &pool, bool bijection) : tagpool(pool) , cap(0) , mem(NULL) , x2t(NULL) , x2y(NULL) , y2x(NULL) - , bijective(opts->bijective_mapping) + , bijective(bijection) , max(0) , x2t_backup(NULL) , x2y_backup(NULL) @@ -195,9 +193,9 @@ bool mapping_t::operator()(const kernel_t *k1, const kernel_t *k2) return true; } -kernels_t::kernels_t(Tagpool &tagpool) +kernels_t::kernels_t(Tagpool &tagpool, bool bijection) : lookup() - , mapping(tagpool) + , mapping(tagpool, bijection) , maxsize(256) // usually ranges from one to some twenty , buffer(new kernel_t(maxsize)) {} diff --git a/re2c/src/ir/dfa/find_state.h b/re2c/src/ir/dfa/find_state.h index d9fb5098..d05ad6a4 100644 --- a/re2c/src/ir/dfa/find_state.h +++ b/re2c/src/ir/dfa/find_state.h @@ -39,7 +39,7 @@ public: tagver_t *x2y_backup; uint32_t *indeg; - explicit mapping_t(Tagpool &pool); + mapping_t(Tagpool &pool, bool bijection); ~mapping_t(); void init(tagver_t v); bool better() const; @@ -72,7 +72,7 @@ private: kernel_t *buffer; public: - explicit kernels_t(Tagpool &tagpool); + kernels_t(Tagpool &tagpool, bool bijection); ~kernels_t(); size_t size() const; const kernel_t* operator[](size_t idx) const; diff --git a/re2c/src/ir/dfa/minimization.cc b/re2c/src/ir/dfa/minimization.cc index 53b52835..21c42c94 100644 --- a/re2c/src/ir/dfa/minimization.cc +++ b/re2c/src/ir/dfa/minimization.cc @@ -3,9 +3,7 @@ #include #include -#include "src/conf/opt.h" #include "src/ir/dfa/dfa.h" -#include "src/globals.h" namespace re2c { @@ -226,20 +224,17 @@ static void minimization_moore( * Tail "c" can be deduplicated in the 1st case, but not in the 2nd. */ -void minimization(dfa_t &dfa) +void minimization(dfa_t &dfa, dfa_minimization_t type) { const size_t count = dfa.states.size(); size_t *part = new size_t[count]; - switch (opts->dfa_minimization) - { - case DFA_MINIMIZATION_TABLE: - minimization_table(part, dfa.states, dfa.nchars); - break; - case DFA_MINIMIZATION_MOORE: - minimization_moore(part, dfa.states, dfa.nchars); - break; + switch (type) { + case DFA_MINIMIZATION_TABLE: + minimization_table(part, dfa.states, dfa.nchars); break; + case DFA_MINIMIZATION_MOORE: + minimization_moore(part, dfa.states, dfa.nchars); break; } size_t *compact = new size_t[count]; diff --git a/re2c/src/ir/nfa/nfa.cc b/re2c/src/ir/nfa/nfa.cc index 048a663e..f3a08643 100644 --- a/re2c/src/ir/nfa/nfa.cc +++ b/re2c/src/ir/nfa/nfa.cc @@ -2,7 +2,7 @@ namespace re2c { -nfa_t::nfa_t(const std::vector ®exps) +nfa_t::nfa_t(const std::vector ®exps, InputAPI::type_t input) : max_size(0) , size(0) , states(NULL) @@ -15,7 +15,7 @@ nfa_t::nfa_t(const std::vector ®exps) max_size = counters(regexps, ntags); states = new nfa_state_t[max_size]; - regexps2nfa(regexps, *this); + regexps2nfa(regexps, *this, input); init_rules(regexps, rules, vartags, fixtags); } diff --git a/re2c/src/ir/nfa/nfa.h b/re2c/src/ir/nfa/nfa.h index 372ab215..3cf21e41 100644 --- a/re2c/src/ir/nfa/nfa.h +++ b/re2c/src/ir/nfa/nfa.h @@ -6,6 +6,7 @@ #include #include +#include "src/codegen/input_api.h" #include "src/ir/regexp/regexp.h" #include "src/ir/rule.h" #include "src/ir/tag.h" @@ -93,14 +94,14 @@ struct nfa_t std::vector &fixtags; nfa_state_t *root; - nfa_t(const std::vector &rs); + nfa_t(const std::vector &rs, InputAPI::type_t input); ~nfa_t(); FORBID_COPY(nfa_t); }; size_t counters(const std::vector ®exps, size_t &ntags); -void regexps2nfa(const std::vector ®exps, nfa_t &nfa); +void regexps2nfa(const std::vector ®exps, nfa_t &nfa, InputAPI::type_t input); bool nullable_rule(const RegExpRule *rule); void init_rules(const std::vector ®exps, std::valarray &rules, const std::vector &vartags, const std::vector &fixtags); diff --git a/re2c/src/ir/nfa/regexps2nfa.cc b/re2c/src/ir/nfa/regexps2nfa.cc index 3ca3d357..3b30db4b 100644 --- a/re2c/src/ir/nfa/regexps2nfa.cc +++ b/re2c/src/ir/nfa/regexps2nfa.cc @@ -1,3 +1,5 @@ +#include + #include "src/ir/nfa/nfa.h" #include "src/globals.h" @@ -104,9 +106,10 @@ static nfa_state_t *regexp2nfa(nfa_t &nfa, size_t nrule, size_t &dist, return s; } -static nfa_state_t *regexp2nfa_rule(nfa_t &nfa, size_t nrule, const RegExpRule *rule) +static nfa_state_t *regexp2nfa_rule(nfa_t &nfa, size_t nrule, + const RegExpRule *rule, InputAPI::type_t input) { - const bool generic = opts->input_api.type() == InputAPI::CUSTOM; + const bool generic = input == InputAPI::CUSTOM; size_t base = FixTag::RIGHTMOST, dist = 0; nfa_state_t *s = &nfa.states[nfa.size++]; @@ -115,7 +118,8 @@ static nfa_state_t *regexp2nfa_rule(nfa_t &nfa, size_t nrule, const RegExpRule * return regexp2nfa(nfa, nrule, dist, base, !generic, rule->re, s); } -void regexps2nfa(const std::vector ®exps, nfa_t &nfa) +void regexps2nfa(const std::vector ®exps, + nfa_t &nfa, InputAPI::type_t input) { const size_t nregexps = regexps.size(); @@ -123,10 +127,10 @@ void regexps2nfa(const std::vector ®exps, nfa_t &nfa) return; } - nfa_state_t *s = regexp2nfa_rule(nfa, 0, regexps[0]); + nfa_state_t *s = regexp2nfa_rule(nfa, 0, regexps[0], input); for (size_t i = 1; i < nregexps; ++i) { nfa_state_t *t = &nfa.states[nfa.size++]; - t->make_alt(i, s, regexp2nfa_rule(nfa, i, regexps[i])); + t->make_alt(i, s, regexp2nfa_rule(nfa, i, regexps[i], input)); s = t; } nfa.root = s; diff --git a/re2c/src/ir/regexp/nullable.cc b/re2c/src/ir/regexp/nullable.cc index 286652e3..296b7a2d 100644 --- a/re2c/src/ir/regexp/nullable.cc +++ b/re2c/src/ir/regexp/nullable.cc @@ -1,4 +1,3 @@ -#include "src/conf/opt.h" #include "src/ir/regexp/regexp.h" #include "src/globals.h" diff --git a/re2c/src/ir/regexp/regexp.cc b/re2c/src/ir/regexp/regexp.cc index ca13ec3b..5357e4b6 100644 --- a/re2c/src/ir/regexp/regexp.cc +++ b/re2c/src/ir/regexp/regexp.cc @@ -1,7 +1,6 @@ #include #include -#include "src/conf/opt.h" #include "src/conf/warn.h" #include "src/globals.h" #include "src/ir/regexp/empty_class_policy.h" diff --git a/re2c/src/ir/skeleton/generate_code.cc b/re2c/src/ir/skeleton/generate_code.cc index cbadee02..406b4535 100644 --- a/re2c/src/ir/skeleton/generate_code.cc +++ b/re2c/src/ir/skeleton/generate_code.cc @@ -5,10 +5,8 @@ #include #include "src/codegen/bitmap.h" -#include "src/codegen/indent.h" +#include "src/codegen/emit.h" #include "src/codegen/output.h" -#include "src/conf/opt.h" -#include "src/globals.h" #include "src/ir/regexp/encoding/enc.h" #include "src/ir/adfa/adfa.h" #include "src/ir/skeleton/skeleton.h" @@ -98,6 +96,7 @@ void emit_start(OutputFile &o, size_t maxfill, const std::string &name, size_t sizeof_key, size_t def, bool backup, bool accept, bool oldstyle_ctxmarker, const std::set &tagnames, const std::set &tagvars) { + Opt &opts = o.opts; const size_t sizeof_cunit = opts->encoding.szCodeUnit(); const size_t norule = rule2key(Rule::NONE, sizeof_key, def); std::string filename = opts->output_file; @@ -269,7 +268,7 @@ void emit_start(OutputFile &o, size_t maxfill, const std::string &name, } // autogenerated tag variables - ConfTags conf("\n" + indent(2) + "const YYCTYPE *@@ = NULL;", ""); + ConfTags conf("\n" + indent(2, opts->indString) + "const YYCTYPE *@@ = NULL;", ""); output_tags(o.stream(), conf, tagnames); // user-defined tag variables @@ -325,7 +324,7 @@ void emit_end(OutputFile &o, const std::string &name, bool backup, bool oldstyle o.ws("\n#undef YYBACKUPCTX"); o.ws("\n#undef YYRESTORECTX"); } - if (opts->tags) { + if (o.opts->tags) { o.ws("\n#undef YYBACKUPTAG"); o.ws("\n#undef YYRESTORETAG"); o.ws("\n#undef YYCOPYTAG"); diff --git a/re2c/src/ir/skeleton/generate_data.cc b/re2c/src/ir/skeleton/generate_data.cc index 103b98e4..6dbd5697 100644 --- a/re2c/src/ir/skeleton/generate_data.cc +++ b/re2c/src/ir/skeleton/generate_data.cc @@ -10,8 +10,6 @@ #include #include "src/conf/msg.h" -#include "src/conf/opt.h" -#include "src/globals.h" #include "src/ir/regexp/encoding/enc.h" #include "src/ir/skeleton/path.h" #include "src/ir/skeleton/skeleton.h" @@ -326,18 +324,17 @@ template } } -static void generate_paths(const Skeleton &skel, cover_t &cover) +static void generate_paths(const Skeleton &skel, cover_t &cover, size_t cunit_size) { - switch (opts->encoding.szCodeUnit()) { + switch (cunit_size) { case 4: generate_paths_cunit(skel, cover); break; case 2: generate_paths_cunit(skel, cover); break; case 1: generate_paths_cunit(skel, cover); break; } } -void emit_data(const Skeleton &skel) +void emit_data(const Skeleton &skel, std::string fname, size_t cunit_size) { - std::string fname = opts->output_file; if (fname.empty()) { fname = ""; } @@ -356,7 +353,7 @@ void emit_data(const Skeleton &skel) } cover_t cover(input, keys, skel.nodes_count); - generate_paths(skel, cover); + generate_paths(skel, cover, cunit_size); fclose(input); fclose(keys); diff --git a/re2c/src/ir/skeleton/skeleton.h b/re2c/src/ir/skeleton/skeleton.h index c8c7c7dc..86c0e7b4 100644 --- a/re2c/src/ir/skeleton/skeleton.h +++ b/re2c/src/ir/skeleton/skeleton.h @@ -98,7 +98,7 @@ size_t rule2key(size_t rule, size_t key, size_t def); uint32_t maxpath(const Skeleton &skel); void warn_undefined_control_flow(const Skeleton &skel); void fprint_default_path(FILE *f, const Skeleton &skel, const path_t &p); -void emit_data(const Skeleton &skel); +void emit_data(const Skeleton &skel, std::string fname, size_t cunit_size); void emit_prolog(OutputFile & o); void emit_start(OutputFile &o, size_t maxfill, const std::string &name, size_t sizeof_key, size_t def, bool backup, bool accept, bool oldstyle_ctxmarker, diff --git a/re2c/src/main.cc b/re2c/src/main.cc index d69e708a..09338d6d 100644 --- a/re2c/src/main.cc +++ b/re2c/src/main.cc @@ -25,6 +25,8 @@ using namespace re2c; int main(int, char *argv[]) { + Opt opts; + switch (parse_opts (argv, opts)) { case OK: break; @@ -41,7 +43,7 @@ int main(int, char *argv[]) } // set up the output streams - re2c::Output output; + re2c::Output output(opts); Scanner scanner (input, output.source); parse (scanner, output); diff --git a/re2c/src/parse/lex.re b/re2c/src/parse/lex.re index 58e29e1e..8dd3a6bd 100644 --- a/re2c/src/parse/lex.re +++ b/re2c/src/parse/lex.re @@ -6,7 +6,6 @@ #include #include "src/codegen/output.h" -#include "src/conf/opt.h" #include "src/conf/warn.h" #include "src/globals.h" #include "src/ir/regexp/encoding/enc.h" diff --git a/re2c/src/parse/lex_conf.re b/re2c/src/parse/lex_conf.re index d80cd25d..b926240c 100644 --- a/re2c/src/parse/lex_conf.re +++ b/re2c/src/parse/lex_conf.re @@ -2,8 +2,6 @@ #include #include "src/codegen/output.h" -#include "src/conf/opt.h" -#include "src/globals.h" #include "src/ir/regexp/encoding/enc.h" #include "src/parse/scanner.h" #include "src/util/s_to_n32_unsafe.h" diff --git a/re2c/src/parse/parser.ypp b/re2c/src/parse/parser.ypp index d02b777f..7710ccf2 100644 --- a/re2c/src/parse/parser.ypp +++ b/re2c/src/parse/parser.ypp @@ -13,7 +13,6 @@ #include #include "src/codegen/output.h" -#include "src/conf/opt.h" #include "src/globals.h" #include "src/ir/compile.h" #include "src/ir/adfa/adfa.h" @@ -62,7 +61,7 @@ static symbol_table_t symbol_table; void context_check(CondList *clist) { - if (!opts->cFlag) + if (!in->opts->cFlag) { delete clist; in->fatal("conditions are only allowed when using -c switch"); @@ -186,7 +185,7 @@ enddef: ';' | TOKEN_FID_END; rule : trailexpr TOKEN_CODE { - if (opts->cFlag) { + if (in->opts->cFlag) { in->fatal("condition or '<*>' required when using -c switch"); } $1->info = new RuleInfo($2->loc, $2, NULL); @@ -195,7 +194,7 @@ rule /* default rule */ | TOKEN_STAR TOKEN_CODE { - if (opts->cFlag) { + if (in->opts->cFlag) { in->fatal("condition or '<*>' required when using -c switch"); } RegExpRule *def = new RegExpRule(in->mkDefault()); @@ -456,6 +455,7 @@ void parse(Scanner& i, Output & o) { std::map > dfa_map; ScannerState rules_state; + Opt &opts = i.opts; in = &i; diff --git a/re2c/src/parse/scanner.cc b/re2c/src/parse/scanner.cc index 09dd2bda..b243cc4e 100644 --- a/re2c/src/parse/scanner.cc +++ b/re2c/src/parse/scanner.cc @@ -7,7 +7,6 @@ #include "src/codegen/label.h" #include "src/codegen/output.h" -#include "src/conf/opt.h" #include "src/globals.h" #include "src/parse/scanner.h" #include "src/util/counter.h" @@ -66,6 +65,7 @@ Scanner::Scanner (Input & i, OutputFile & o) : ScannerState () , in (i) , out (o) + , opts (o.opts) {} void Scanner::fill (uint32_t need) diff --git a/re2c/src/parse/scanner.h b/re2c/src/parse/scanner.h index b2f9506c..f285ec9b 100644 --- a/re2c/src/parse/scanner.h +++ b/re2c/src/parse/scanner.h @@ -5,6 +5,7 @@ #include #include +#include "src/conf/opt.h" #include "src/parse/input.h" #include "src/util/attribute.h" #include "src/util/forbid_copy.h" @@ -56,6 +57,7 @@ class Scanner: private ScannerState Input & in; public: OutputFile & out; + Opt &opts; private: void fill (uint32_t); -- 2.40.0