From 662eb41b278cd381d4d2cc8f7afd91cea433cf4b Mon Sep 17 00:00:00 2001 From: Ulya Trofimovich Date: Sun, 30 Dec 2018 10:59:28 +0000 Subject: [PATCH] Use a couple of helper functions to make string construction easier. --- re2c/bootstrap/src/ast/lex.cc | 24 +- re2c/bootstrap/src/ast/lex.h | 2 +- re2c/bootstrap/src/ast/lex_conf.cc | 483 +++++++++++++------------- re2c/bootstrap/src/conf/parse_opts.cc | 428 +++++++++++------------ re2c/src/ast/lex.re | 22 +- re2c/src/ast/lex_conf.re | 3 +- re2c/src/ast/scanner.h | 6 - re2c/src/conf/parse_opts.re | 4 +- re2c/src/re/rule.h | 4 +- re2c/src/util/string_utils.h | 12 + 10 files changed, 498 insertions(+), 490 deletions(-) diff --git a/re2c/bootstrap/src/ast/lex.cc b/re2c/bootstrap/src/ast/lex.cc index 38198add..95eff78c 100644 --- a/re2c/bootstrap/src/ast/lex.cc +++ b/re2c/bootstrap/src/ast/lex.cc @@ -1,4 +1,4 @@ -/* Generated by re2c 1.1.1 on Thu Dec 27 22:47:12 2018 */ +/* Generated by re2c 1.1.1 on Sun Dec 30 10:57:46 2018 */ #line 1 "../src/ast/lex.re" #include "src/util/c99_stdint.h" #include @@ -916,7 +916,7 @@ yy175: #line 199 "../src/ast/lex.re" { out.wraw(tok, ptr); - include(std::string(x + 1, static_cast(y - x) - 2)); + include(getstr(x + 1, y - 1)); goto next; } #line 923 "src/ast/lex.cc" @@ -1391,11 +1391,11 @@ yy248: #line 357 "../src/ast/lex.re" { if (!globopts->FFlag || lex_namedef_context_re2c()) { - yylval.str = new std::string (tok, tok_len()); + yylval.str = newstr(tok, cur); return TOKEN_ID; } else if (lex_namedef_context_flex()) { - yylval.str = new std::string (tok, tok_len()); + yylval.str = newstr(tok, cur); lexer_state = LEX_FLEX_NAME; return TOKEN_FID; } @@ -1503,8 +1503,8 @@ yy260: yy262: #line 307 "../src/ast/lex.re" { - const std::string *name = new std::string(tok + 1, tok_len() - 1); - yylval.regexp = ast_tag(get_line(), get_column(), name, tok[0] == '#'); + yylval.regexp = ast_tag(get_line(), get_column() + , newstr(tok + 1, cur), tok[0] == '#'); return TOKEN_REGEXP; } #line 1511 "src/ast/lex.cc" @@ -1638,7 +1638,7 @@ yy285: p = yyt1; #line 290 "../src/ast/lex.re" { - yylval.str = new std::string(p, static_cast(cur - p)); + yylval.str = newstr(p, cur); return tok[0] == ':' ? TOKEN_CJUMP : TOKEN_CNEXT; } #line 1645 "src/ast/lex.cc" @@ -1672,7 +1672,7 @@ yy290: fatal_lc(get_line(), get_column(), "curly braces for names only allowed with -F switch"); } - yylval.str = new std::string (tok + 1, tok_len () - 2); // -2 to omit braces + yylval.str = newstr(tok + 1, cur - 1); return TOKEN_ID; } #line 1679 "src/ast/lex.cc" @@ -2128,7 +2128,7 @@ yy349: goto yy349; } #line 439 "../src/ast/lex.re" - { cl->insert(std::string(tok, tok_len())); goto next; } + { cl->insert(getstr(tok, cur)); goto next; } #line 2133 "src/ast/lex.cc" } #line 442 "../src/ast/lex.re" @@ -2302,7 +2302,7 @@ yy372: { while (isspace(tok[0])) ++tok; while (cur > tok && isspace(cur[-1])) --cur; - yylval.code = new Code(get_fname (), line, tok, tok_len ()); + yylval.code = new Code(get_fname (), line, getstr(tok, cur)); return; } #line 2309 "src/ast/lex.cc" @@ -2457,7 +2457,7 @@ yy399: #line 486 "../src/ast/lex.re" { if (--depth == 0) { - yylval.code = new Code(get_fname (), line, tok, tok_len ()); + yylval.code = new Code(get_fname (), line, getstr(tok, cur)); return; } goto code; @@ -3576,7 +3576,7 @@ yy594: #line 659 "../src/ast/lex.re" { std::string &name = get_input().escaped_name; - name = std::string(tok + 1, tok_len () - 2); // strip quotes + name = getstr(tok + 1, cur - 1); strrreplace(name, "\\", "\\\\"); goto sourceline; } diff --git a/re2c/bootstrap/src/ast/lex.h b/re2c/bootstrap/src/ast/lex.h index 4b11a6f4..ec86a010 100644 --- a/re2c/bootstrap/src/ast/lex.h +++ b/re2c/bootstrap/src/ast/lex.h @@ -1,4 +1,4 @@ -/* Generated by re2c 1.1.1 on Thu Dec 27 22:47:12 2018 */ +/* Generated by re2c 1.1.1 on Sun Dec 30 10:57:46 2018 */ #include #include "src/util/forbid_copy.h" diff --git a/re2c/bootstrap/src/ast/lex_conf.cc b/re2c/bootstrap/src/ast/lex_conf.cc index 05db59cf..e460d4f9 100644 --- a/re2c/bootstrap/src/ast/lex_conf.cc +++ b/re2c/bootstrap/src/ast/lex_conf.cc @@ -1,4 +1,4 @@ -/* Generated by re2c 1.1.1 on Wed Dec 26 20:02:53 2018 */ +/* Generated by re2c 1.1.1 on Sun Dec 30 10:58:27 2018 */ #line 1 "../src/ast/lex_conf.re" #include "src/util/c99_stdint.h" #include @@ -8,6 +8,7 @@ #include "src/re/encoding/enc.h" #include "src/ast/scanner.h" #include "src/util/s_to_n32_unsafe.h" +#include "src/util/string_utils.h" namespace re2c { @@ -15,7 +16,7 @@ namespace re2c #define YYFILL(n) { if (!fill (n)) fatal("unexpected end of input"); } // global re2c config (affects the whole file) -#line 36 "../src/ast/lex_conf.re" +#line 37 "../src/ast/lex_conf.re" void Scanner::lex_conf(Opt &opts) @@ -23,7 +24,7 @@ void Scanner::lex_conf(Opt &opts) tok = cur; const uint32_t l = get_line(), c = get_column(); -#line 27 "src/ast/lex_conf.cc" +#line 28 "src/ast/lex_conf.cc" { unsigned char yych; unsigned int yyaccept = 0; @@ -104,12 +105,12 @@ void Scanner::lex_conf(Opt &opts) } } yy2: -#line 171 "../src/ast/lex_conf.re" +#line 172 "../src/ast/lex_conf.re" { fatal_lc(l, c, "unrecognized configuration '%.*s'", static_cast(cur - tok), tok); } -#line 113 "src/ast/lex_conf.cc" +#line 114 "src/ast/lex_conf.cc" yy3: ++cur; if (lim <= cur) YYFILL(1); @@ -227,14 +228,14 @@ yy29: if (yybm[0+yych] & 32) { goto yy3; } -#line 69 "../src/ast/lex_conf.re" +#line 70 "../src/ast/lex_conf.re" { const int32_t eof = lex_conf_number(); if (eof < 0) fatal_lc(l, c, "eof cannot have negative value"); opts.set_eof(static_cast(eof)); return; } -#line 238 "src/ast/lex_conf.cc" +#line 239 "src/ast/lex_conf.cc" yy31: yych = (unsigned char)*++cur; if (yych == 'g') goto yy43; @@ -519,25 +520,25 @@ yy93: if (yybm[0+yych] & 32) { goto yy3; } -#line 62 "../src/ast/lex_conf.re" +#line 63 "../src/ast/lex_conf.re" { lex_conf_enc(Enc::UTF8, opts); return; } -#line 525 "src/ast/lex_conf.cc" +#line 526 "src/ast/lex_conf.cc" yy95: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 49 "../src/ast/lex_conf.re" +#line 50 "../src/ast/lex_conf.re" { opts.set_posix_captures (lex_conf_bool()); return; } -#line 533 "src/ast/lex_conf.cc" +#line 534 "src/ast/lex_conf.cc" yy97: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 48 "../src/ast/lex_conf.re" +#line 49 "../src/ast/lex_conf.re" { opts.set_tags (lex_conf_bool()); return; } -#line 541 "src/ast/lex_conf.cc" +#line 542 "src/ast/lex_conf.cc" yy99: yych = (unsigned char)*++cur; if (yych <= 'Z') { @@ -556,9 +557,9 @@ yy99: } } yy100: -#line 43 "../src/ast/lex_conf.re" +#line 44 "../src/ast/lex_conf.re" { opts.set_bFlag (lex_conf_bool()); return; } -#line 562 "src/ast/lex_conf.cc" +#line 563 "src/ast/lex_conf.cc" yy101: yych = (unsigned char)*++cur; if (yych == 'a') goto yy145; @@ -584,9 +585,9 @@ yy102: } } yy103: -#line 44 "../src/ast/lex_conf.re" +#line 45 "../src/ast/lex_conf.re" { opts.set_dFlag (lex_conf_bool()); return; } -#line 590 "src/ast/lex_conf.cc" +#line 591 "src/ast/lex_conf.cc" yy104: yych = (unsigned char)*++cur; if (yych <= '_') { @@ -615,17 +616,17 @@ yy104: } } yy105: -#line 58 "../src/ast/lex_conf.re" +#line 59 "../src/ast/lex_conf.re" { lex_conf_enc(Enc::EBCDIC, opts); return; } -#line 621 "src/ast/lex_conf.cc" +#line 622 "src/ast/lex_conf.cc" yy106: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 45 "../src/ast/lex_conf.re" +#line 46 "../src/ast/lex_conf.re" { opts.set_gFlag (lex_conf_bool()); return; } -#line 629 "src/ast/lex_conf.cc" +#line 630 "src/ast/lex_conf.cc" yy108: yych = (unsigned char)*++cur; if (yych <= 'Z') { @@ -644,9 +645,9 @@ yy108: } } yy109: -#line 46 "../src/ast/lex_conf.re" +#line 47 "../src/ast/lex_conf.re" { opts.set_iFlag (lex_conf_bool()); return; } -#line 650 "src/ast/lex_conf.cc" +#line 651 "src/ast/lex_conf.cc" yy110: yych = (unsigned char)*++cur; if (yych == 'o') goto yy154; @@ -677,9 +678,9 @@ yy112: } } yy113: -#line 55 "../src/ast/lex_conf.re" +#line 56 "../src/ast/lex_conf.re" { opts.set_output_file (lex_conf_string()); return; } -#line 683 "src/ast/lex_conf.cc" +#line 684 "src/ast/lex_conf.cc" yy114: yych = (unsigned char)*++cur; if (yych == 'o') goto yy159; @@ -689,9 +690,9 @@ yy115: if (yybm[0+yych] & 32) { goto yy3; } -#line 47 "../src/ast/lex_conf.re" +#line 48 "../src/ast/lex_conf.re" { opts.set_sFlag (lex_conf_bool()); return; } -#line 695 "src/ast/lex_conf.cc" +#line 696 "src/ast/lex_conf.cc" yy117: yych = (unsigned char)*++cur; if (yych <= '^') { @@ -712,9 +713,9 @@ yy117: } } yy118: -#line 56 "../src/ast/lex_conf.re" +#line 57 "../src/ast/lex_conf.re" { opts.set_header_file (lex_conf_string()); return; } -#line 718 "src/ast/lex_conf.cc" +#line 719 "src/ast/lex_conf.cc" yy119: yych = (unsigned char)*++cur; if (yych <= '^') { @@ -736,9 +737,9 @@ yy119: } } yy120: -#line 59 "../src/ast/lex_conf.re" +#line 60 "../src/ast/lex_conf.re" { lex_conf_enc(Enc::UTF32, opts); return; } -#line 742 "src/ast/lex_conf.cc" +#line 743 "src/ast/lex_conf.cc" yy121: yych = (unsigned char)*++cur; if (yych <= 'Z') { @@ -757,17 +758,17 @@ yy121: } } yy122: -#line 60 "../src/ast/lex_conf.re" +#line 61 "../src/ast/lex_conf.re" { lex_conf_enc(Enc::UCS2, opts); return; } -#line 763 "src/ast/lex_conf.cc" +#line 764 "src/ast/lex_conf.cc" yy123: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 61 "../src/ast/lex_conf.re" +#line 62 "../src/ast/lex_conf.re" { lex_conf_enc(Enc::UTF16, opts); return; } -#line 771 "src/ast/lex_conf.cc" +#line 772 "src/ast/lex_conf.cc" yy125: yych = (unsigned char)*++cur; if (yych <= 'r') goto yy4; @@ -982,9 +983,9 @@ yy175: if (yybm[0+yych] & 32) { goto yy3; } -#line 102 "../src/ast/lex_conf.re" +#line 103 "../src/ast/lex_conf.re" { opts.set_yybmHexTable (lex_conf_bool()); return; } -#line 988 "src/ast/lex_conf.cc" +#line 989 "src/ast/lex_conf.cc" yy177: yych = (unsigned char)*++cur; if (yych == 'v') goto yy221; @@ -1021,9 +1022,9 @@ yy184: } if (yych == '@') goto yy229; yy185: -#line 86 "../src/ast/lex_conf.re" +#line 87 "../src/ast/lex_conf.re" { opts.set_condGoto (lex_conf_string ()); return; } -#line 1027 "src/ast/lex_conf.cc" +#line 1028 "src/ast/lex_conf.cc" yy186: yych = (unsigned char)*++cur; if (yych == 'r') goto yy231; @@ -1186,9 +1187,9 @@ yy222: if (yybm[0+yych] & 32) { goto yy3; } -#line 153 "../src/ast/lex_conf.re" +#line 154 "../src/ast/lex_conf.re" { opts.set_bEmitYYCh (lex_conf_bool()); return; } -#line 1192 "src/ast/lex_conf.cc" +#line 1193 "src/ast/lex_conf.cc" yy224: yych = (unsigned char)*++cur; if (yych == 'e') goto yy277; @@ -1244,9 +1245,9 @@ yy232: if (yybm[0+yych] & 32) { goto yy3; } -#line 82 "../src/ast/lex_conf.re" +#line 83 "../src/ast/lex_conf.re" { opts.set_condPrefix (lex_conf_string ()); return; } -#line 1250 "src/ast/lex_conf.cc" +#line 1251 "src/ast/lex_conf.cc" yy234: yych = (unsigned char)*++cur; if (yych == 'A') goto yy284; @@ -1387,7 +1388,7 @@ yy264: if (yybm[0+yych] & 32) { goto yy3; } -#line 138 "../src/ast/lex_conf.re" +#line 139 "../src/ast/lex_conf.re" { const int32_t n = lex_conf_number (); if (n < 0) @@ -1397,7 +1398,7 @@ yy264: opts.set_topIndent (static_cast (n)); return; } -#line 1401 "src/ast/lex_conf.cc" +#line 1402 "src/ast/lex_conf.cc" yy266: yych = (unsigned char)*++cur; if (yych == 'l') goto yy321; @@ -1432,9 +1433,9 @@ yy269: } } yy270: -#line 166 "../src/ast/lex_conf.re" +#line 167 "../src/ast/lex_conf.re" { opts.set_startlabel (lex_conf_string()); return; } -#line 1438 "src/ast/lex_conf.cc" +#line 1439 "src/ast/lex_conf.cc" yy271: yych = (unsigned char)*++cur; if (yych == 't') goto yy329; @@ -1590,9 +1591,9 @@ yy308: if (yybm[0+yych] & 32) { goto yy3; } -#line 65 "../src/ast/lex_conf.re" +#line 66 "../src/ast/lex_conf.re" { lex_conf_input(opts); return; } -#line 1596 "src/ast/lex_conf.cc" +#line 1597 "src/ast/lex_conf.cc" yy310: yych = (unsigned char)*++cur; if (yych == 'h') goto yy370; @@ -1650,9 +1651,9 @@ yy323: if (yybm[0+yych] & 32) { goto yy3; } -#line 162 "../src/ast/lex_conf.re" +#line 163 "../src/ast/lex_conf.re" { opts.set_labelPrefix (lex_conf_string ()); return; } -#line 1656 "src/ast/lex_conf.cc" +#line 1657 "src/ast/lex_conf.cc" yy325: ++cur; if (lim <= cur) YYFILL(1); @@ -1688,9 +1689,9 @@ yy329: if (yybm[0+yych] & 32) { goto yy3; } -#line 97 "../src/ast/lex_conf.re" +#line 98 "../src/ast/lex_conf.re" { opts.set_bUseStateAbort (lex_conf_bool()); return; } -#line 1694 "src/ast/lex_conf.cc" +#line 1695 "src/ast/lex_conf.cc" yy331: yych = (unsigned char)*++cur; if (yych == 'a') goto yy388; @@ -1704,9 +1705,9 @@ yy333: if (yybm[0+yych] & 32) { goto yy3; } -#line 133 "../src/ast/lex_conf.re" +#line 134 "../src/ast/lex_conf.re" { opts.set_tags_prefix (lex_conf_string ()); return; } -#line 1710 "src/ast/lex_conf.cc" +#line 1711 "src/ast/lex_conf.cc" yy335: yych = (unsigned char)*++cur; if (yych <= 'c') { @@ -1748,9 +1749,9 @@ yy341: } if (yych == '@') goto yy401; yy342: -#line 84 "../src/ast/lex_conf.re" +#line 85 "../src/ast/lex_conf.re" { opts.set_condDivider (lex_conf_string ()); return; } -#line 1754 "src/ast/lex_conf.cc" +#line 1755 "src/ast/lex_conf.cc" yy343: yych = (unsigned char)*++cur; if (yych == 'n') goto yy402; @@ -1912,9 +1913,9 @@ yy381: if (yybm[0+yych] & 32) { goto yy3; } -#line 96 "../src/ast/lex_conf.re" +#line 97 "../src/ast/lex_conf.re" { opts.set_yynext (lex_conf_string ()); return; } -#line 1918 "src/ast/lex_conf.cc" +#line 1919 "src/ast/lex_conf.cc" yy383: yych = (unsigned char)*++cur; if (yych <= '0') goto yy230; @@ -1924,9 +1925,9 @@ yy384: ++cur; yy385: cur = ctx; -#line 165 "../src/ast/lex_conf.re" +#line 166 "../src/ast/lex_conf.re" { opts.set_startlabel_force (lex_conf_bool()); return; } -#line 1930 "src/ast/lex_conf.cc" +#line 1931 "src/ast/lex_conf.cc" yy386: ++cur; if (lim <= cur) YYFILL(1); @@ -1973,9 +1974,9 @@ yy396: if (yybm[0+yych] & 32) { goto yy3; } -#line 160 "../src/ast/lex_conf.re" +#line 161 "../src/ast/lex_conf.re" { opts.set_fill_check (lex_conf_bool()); return; } -#line 1979 "src/ast/lex_conf.cc" +#line 1980 "src/ast/lex_conf.cc" yy398: yych = (unsigned char)*++cur; if (yych == 'e') goto yy456; @@ -2044,9 +2045,9 @@ yy410: } } yy411: -#line 155 "../src/ast/lex_conf.re" +#line 156 "../src/ast/lex_conf.re" { opts.set_fill (lex_conf_string ()); return; } -#line 2050 "src/ast/lex_conf.cc" +#line 2051 "src/ast/lex_conf.cc" yy412: yych = (unsigned char)*++cur; if (yych == 'O') goto yy475; @@ -2077,9 +2078,9 @@ yy418: if (yybm[0+yych] & 32) { goto yy3; } -#line 120 "../src/ast/lex_conf.re" +#line 121 "../src/ast/lex_conf.re" { opts.set_yypeek (lex_conf_string ()); return; } -#line 2083 "src/ast/lex_conf.cc" +#line 2084 "src/ast/lex_conf.cc" yy420: yych = (unsigned char)*++cur; if (yych == 'O') goto yy485; @@ -2097,9 +2098,9 @@ yy423: if (yybm[0+yych] & 32) { goto yy3; } -#line 121 "../src/ast/lex_conf.re" +#line 122 "../src/ast/lex_conf.re" { opts.set_yyskip (lex_conf_string ()); return; } -#line 2103 "src/ast/lex_conf.cc" +#line 2104 "src/ast/lex_conf.cc" yy425: yych = (unsigned char)*++cur; if (yych == 'N') goto yy488; @@ -2177,9 +2178,9 @@ yy442: if (yybm[0+yych] & 32) { goto yy3; } -#line 136 "../src/ast/lex_conf.re" +#line 137 "../src/ast/lex_conf.re" { opts.set_indString (lex_conf_string ()); return; } -#line 2183 "src/ast/lex_conf.cc" +#line 2184 "src/ast/lex_conf.cc" yy444: yych = (unsigned char)*++cur; if (yych == 'a') goto yy508; @@ -2201,17 +2202,17 @@ yy448: if (yybm[0+yych] & 32) { goto yy3; } -#line 101 "../src/ast/lex_conf.re" +#line 102 "../src/ast/lex_conf.re" { opts.set_yybm (lex_conf_string ()); return; } -#line 2207 "src/ast/lex_conf.cc" +#line 2208 "src/ast/lex_conf.cc" yy450: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 151 "../src/ast/lex_conf.re" +#line 152 "../src/ast/lex_conf.re" { opts.set_yych (lex_conf_string ()); return; } -#line 2215 "src/ast/lex_conf.cc" +#line 2216 "src/ast/lex_conf.cc" yy452: yych = (unsigned char)*++cur; if (yych == 'a') goto yy512; @@ -2233,9 +2234,9 @@ yy456: if (yybm[0+yych] & 32) { goto yy3; } -#line 156 "../src/ast/lex_conf.re" +#line 157 "../src/ast/lex_conf.re" { opts.set_fill_use (lex_conf_bool()); return; } -#line 2239 "src/ast/lex_conf.cc" +#line 2240 "src/ast/lex_conf.cc" yy458: yych = (unsigned char)*++cur; if (yych == 't') goto yy516; @@ -2250,17 +2251,17 @@ yy460: goto yy230; yy461: ++cur; -#line 87 "../src/ast/lex_conf.re" +#line 88 "../src/ast/lex_conf.re" { opts.set_condGotoParam (lex_conf_string ()); return; } -#line 2256 "src/ast/lex_conf.cc" +#line 2257 "src/ast/lex_conf.cc" yy463: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 83 "../src/ast/lex_conf.re" +#line 84 "../src/ast/lex_conf.re" { opts.set_condEnumPrefix (lex_conf_string ()); return; } -#line 2264 "src/ast/lex_conf.cc" +#line 2265 "src/ast/lex_conf.cc" yy465: yych = (unsigned char)*++cur; if (yych == 'P') goto yy520; @@ -2278,9 +2279,9 @@ yy468: if (yybm[0+yych] & 32) { goto yy3; } -#line 150 "../src/ast/lex_conf.re" +#line 151 "../src/ast/lex_conf.re" { opts.set_yyctype (lex_conf_string ()); return; } -#line 2284 "src/ast/lex_conf.cc" +#line 2285 "src/ast/lex_conf.cc" yy470: yych = (unsigned char)*++cur; if (yych == 'R') goto yy524; @@ -2290,9 +2291,9 @@ yy471: if (yybm[0+yych] & 32) { goto yy3; } -#line 148 "../src/ast/lex_conf.re" +#line 149 "../src/ast/lex_conf.re" { opts.set_yydebug (lex_conf_string ()); return; } -#line 2296 "src/ast/lex_conf.cc" +#line 2297 "src/ast/lex_conf.cc" yy473: yych = (unsigned char)*++cur; if (yych == 'n') goto yy526; @@ -2318,9 +2319,9 @@ yy478: if (yybm[0+yych] & 32) { goto yy3; } -#line 118 "../src/ast/lex_conf.re" +#line 119 "../src/ast/lex_conf.re" { opts.set_yylimit (lex_conf_string ()); return; } -#line 2324 "src/ast/lex_conf.cc" +#line 2325 "src/ast/lex_conf.cc" yy480: yych = (unsigned char)*++cur; if (yych == 'R') goto yy531; @@ -2330,17 +2331,17 @@ yy481: if (yybm[0+yych] & 32) { goto yy3; } -#line 130 "../src/ast/lex_conf.re" +#line 131 "../src/ast/lex_conf.re" { opts.set_yymtagn (lex_conf_string ()); return; } -#line 2336 "src/ast/lex_conf.cc" +#line 2337 "src/ast/lex_conf.cc" yy483: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 131 "../src/ast/lex_conf.re" +#line 132 "../src/ast/lex_conf.re" { opts.set_yymtagp (lex_conf_string ()); return; } -#line 2344 "src/ast/lex_conf.cc" +#line 2345 "src/ast/lex_conf.cc" yy485: yych = (unsigned char)*++cur; if (yych == 'R') goto yy533; @@ -2358,17 +2359,17 @@ yy488: if (yybm[0+yych] & 32) { goto yy3; } -#line 128 "../src/ast/lex_conf.re" +#line 129 "../src/ast/lex_conf.re" { opts.set_yystagn (lex_conf_string ()); return; } -#line 2364 "src/ast/lex_conf.cc" +#line 2365 "src/ast/lex_conf.cc" yy490: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 129 "../src/ast/lex_conf.re" +#line 130 "../src/ast/lex_conf.re" { opts.set_yystagp (lex_conf_string ()); return; } -#line 2372 "src/ast/lex_conf.cc" +#line 2373 "src/ast/lex_conf.cc" yy492: yych = (unsigned char)*++cur; if (yych == 'o') goto yy536; @@ -2474,7 +2475,7 @@ yy517: if (yybm[0+yych] & 32) { goto yy3; } -#line 104 "../src/ast/lex_conf.re" +#line 105 "../src/ast/lex_conf.re" { const int32_t n = lex_conf_number (); if (n < 0) @@ -2484,7 +2485,7 @@ yy517: opts.set_cGotoThreshold (static_cast (n)); return; } -#line 2488 "src/ast/lex_conf.cc" +#line 2489 "src/ast/lex_conf.cc" yy519: yych = (unsigned char)*++cur; if (yych == 'n') goto yy565; @@ -2508,9 +2509,9 @@ yy520: } } yy521: -#line 122 "../src/ast/lex_conf.re" +#line 123 "../src/ast/lex_conf.re" { opts.set_yybackup (lex_conf_string ()); return; } -#line 2514 "src/ast/lex_conf.cc" +#line 2515 "src/ast/lex_conf.cc" yy522: yych = (unsigned char)*++cur; if (yych == 'P') goto yy567; @@ -2524,9 +2525,9 @@ yy524: if (yybm[0+yych] & 32) { goto yy3; } -#line 115 "../src/ast/lex_conf.re" +#line 116 "../src/ast/lex_conf.re" { opts.set_yycursor (lex_conf_string ()); return; } -#line 2530 "src/ast/lex_conf.cc" +#line 2531 "src/ast/lex_conf.cc" yy526: yych = (unsigned char)*++cur; if (yych == 'a') goto yy569; @@ -2552,9 +2553,9 @@ yy531: if (yybm[0+yych] & 32) { goto yy3; } -#line 116 "../src/ast/lex_conf.re" +#line 117 "../src/ast/lex_conf.re" { opts.set_yymarker (lex_conf_string ()); return; } -#line 2558 "src/ast/lex_conf.cc" +#line 2559 "src/ast/lex_conf.cc" yy533: yych = (unsigned char)*++cur; if (yych == 'E') goto yy574; @@ -2608,9 +2609,9 @@ yy545: if (yybm[0+yych] & 32) { goto yy3; } -#line 52 "../src/ast/lex_conf.re" +#line 53 "../src/ast/lex_conf.re" { opts.set_lookahead (lex_conf_bool()); return; } -#line 2614 "src/ast/lex_conf.cc" +#line 2615 "src/ast/lex_conf.cc" yy547: yych = (unsigned char)*++cur; if (yych == 's') goto yy115; @@ -2644,17 +2645,17 @@ yy554: if (yybm[0+yych] & 32) { goto yy3; } -#line 98 "../src/ast/lex_conf.re" +#line 99 "../src/ast/lex_conf.re" { opts.set_bUseStateNext (lex_conf_bool()); return; } -#line 2650 "src/ast/lex_conf.cc" +#line 2651 "src/ast/lex_conf.cc" yy556: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 134 "../src/ast/lex_conf.re" +#line 135 "../src/ast/lex_conf.re" { opts.set_tags_expression(lex_conf_string ()); return; } -#line 2658 "src/ast/lex_conf.cc" +#line 2659 "src/ast/lex_conf.cc" yy558: yych = (unsigned char)*++cur; if (yych == 'p') goto yy594; @@ -2676,9 +2677,9 @@ yy562: if (yybm[0+yych] & 32) { goto yy3; } -#line 152 "../src/ast/lex_conf.re" +#line 153 "../src/ast/lex_conf.re" { opts.set_yychConversion (lex_conf_bool()); return; } -#line 2682 "src/ast/lex_conf.cc" +#line 2683 "src/ast/lex_conf.cc" yy564: yych = (unsigned char)*++cur; if (yych == 'r') goto yy598; @@ -2740,9 +2741,9 @@ yy574: } } yy575: -#line 124 "../src/ast/lex_conf.re" +#line 125 "../src/ast/lex_conf.re" { opts.set_yyrestore (lex_conf_string ()); return; } -#line 2746 "src/ast/lex_conf.cc" +#line 2747 "src/ast/lex_conf.cc" yy576: yych = (unsigned char)*++cur; if (yych == 'I') goto yy616; @@ -2780,9 +2781,9 @@ yy584: if (yybm[0+yych] & 32) { goto yy3; } -#line 54 "../src/ast/lex_conf.re" +#line 55 "../src/ast/lex_conf.re" { opts.set_eager_skip (lex_conf_bool()); return; } -#line 2786 "src/ast/lex_conf.cc" +#line 2787 "src/ast/lex_conf.cc" yy586: yych = (unsigned char)*++cur; if (yych == 's') goto yy625; @@ -2838,14 +2839,14 @@ yy598: if (yybm[0+yych] & 32) { goto yy3; } -#line 158 "../src/ast/lex_conf.re" +#line 159 "../src/ast/lex_conf.re" { opts.set_fill_arg_use (lex_conf_bool()); return; } -#line 2844 "src/ast/lex_conf.cc" +#line 2845 "src/ast/lex_conf.cc" yy600: ++cur; -#line 85 "../src/ast/lex_conf.re" +#line 86 "../src/ast/lex_conf.re" { opts.set_condDividerParam (lex_conf_string ()); return; } -#line 2849 "src/ast/lex_conf.cc" +#line 2850 "src/ast/lex_conf.cc" yy602: yych = (unsigned char)*++cur; if (yych == 'X') goto yy642; @@ -2855,9 +2856,9 @@ yy603: if (yybm[0+yych] & 32) { goto yy3; } -#line 76 "../src/ast/lex_conf.re" +#line 77 "../src/ast/lex_conf.re" { opts.set_yycondtype (lex_conf_string ()); return; } -#line 2861 "src/ast/lex_conf.cc" +#line 2862 "src/ast/lex_conf.cc" yy605: yych = (unsigned char)*++cur; if (yych == 'R') goto yy644; @@ -2868,9 +2869,9 @@ yy606: goto yy4; yy607: ++cur; -#line 157 "../src/ast/lex_conf.re" +#line 158 "../src/ast/lex_conf.re" { opts.set_fill_arg (lex_conf_string ()); return; } -#line 2874 "src/ast/lex_conf.cc" +#line 2875 "src/ast/lex_conf.cc" yy609: yych = (unsigned char)*++cur; if (yych == 'T') goto yy647; @@ -2894,17 +2895,17 @@ yy610: } } yy611: -#line 90 "../src/ast/lex_conf.re" +#line 91 "../src/ast/lex_conf.re" { opts.set_state_get (lex_conf_string ()); return; } -#line 2900 "src/ast/lex_conf.cc" +#line 2901 "src/ast/lex_conf.cc" yy612: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 127 "../src/ast/lex_conf.re" +#line 128 "../src/ast/lex_conf.re" { opts.set_yylessthan (lex_conf_string ()); return; } -#line 2908 "src/ast/lex_conf.cc" +#line 2909 "src/ast/lex_conf.cc" yy614: yych = (unsigned char)*++cur; if (yych == 'T') goto yy649; @@ -2937,9 +2938,9 @@ yy617: } } yy618: -#line 92 "../src/ast/lex_conf.re" +#line 93 "../src/ast/lex_conf.re" { opts.set_state_set (lex_conf_string ()); return; } -#line 2943 "src/ast/lex_conf.cc" +#line 2944 "src/ast/lex_conf.cc" yy619: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { @@ -2971,9 +2972,9 @@ yy625: if (yybm[0+yych] & 32) { goto yy3; } -#line 66 "../src/ast/lex_conf.re" +#line 67 "../src/ast/lex_conf.re" { lex_conf_empty_class(opts); return; } -#line 2977 "src/ast/lex_conf.cc" +#line 2978 "src/ast/lex_conf.cc" yy627: yych = (unsigned char)*++cur; if (yych == 'l') goto yy659; @@ -3001,57 +3002,57 @@ yy632: if (yybm[0+yych] & 32) { goto yy3; } -#line 95 "../src/ast/lex_conf.re" +#line 96 "../src/ast/lex_conf.re" { opts.set_yyfilllabel (lex_conf_string ()); return; } -#line 3007 "src/ast/lex_conf.cc" +#line 3008 "src/ast/lex_conf.cc" yy634: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 99 "../src/ast/lex_conf.re" +#line 100 "../src/ast/lex_conf.re" { opts.set_yyaccept (lex_conf_string ()); return; } -#line 3015 "src/ast/lex_conf.cc" +#line 3016 "src/ast/lex_conf.cc" yy636: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 88 "../src/ast/lex_conf.re" +#line 89 "../src/ast/lex_conf.re" { opts.set_yyctable (lex_conf_string ()); return; } -#line 3023 "src/ast/lex_conf.cc" +#line 3024 "src/ast/lex_conf.cc" yy638: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 169 "../src/ast/lex_conf.re" +#line 170 "../src/ast/lex_conf.re" { lex_conf_string (); return; } -#line 3031 "src/ast/lex_conf.cc" +#line 3032 "src/ast/lex_conf.cc" yy640: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 113 "../src/ast/lex_conf.re" +#line 114 "../src/ast/lex_conf.re" { opts.set_yytarget (lex_conf_string ()); return; } -#line 3039 "src/ast/lex_conf.cc" +#line 3040 "src/ast/lex_conf.cc" yy642: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 123 "../src/ast/lex_conf.re" +#line 124 "../src/ast/lex_conf.re" { opts.set_yybackupctx (lex_conf_string ()); return; } -#line 3047 "src/ast/lex_conf.cc" +#line 3048 "src/ast/lex_conf.cc" yy644: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 117 "../src/ast/lex_conf.re" +#line 118 "../src/ast/lex_conf.re" { opts.set_yyctxmarker (lex_conf_string ()); return; } -#line 3055 "src/ast/lex_conf.cc" +#line 3056 "src/ast/lex_conf.cc" yy646: yych = (unsigned char)*++cur; if (yych == 'd') goto yy663; @@ -3127,9 +3128,9 @@ yy663: if (yybm[0+yych] & 32) { goto yy3; } -#line 159 "../src/ast/lex_conf.re" +#line 160 "../src/ast/lex_conf.re" { opts.set_fill_naked (lex_conf_bool()); return; } -#line 3133 "src/ast/lex_conf.cc" +#line 3134 "src/ast/lex_conf.cc" yy665: yych = (unsigned char)*++cur; if (yych == 'O') goto yy684; @@ -3143,17 +3144,17 @@ yy667: if (yybm[0+yych] & 32) { goto yy3; } -#line 125 "../src/ast/lex_conf.re" +#line 126 "../src/ast/lex_conf.re" { opts.set_yyrestorectx (lex_conf_string ()); return; } -#line 3149 "src/ast/lex_conf.cc" +#line 3150 "src/ast/lex_conf.cc" yy669: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 126 "../src/ast/lex_conf.re" +#line 127 "../src/ast/lex_conf.re" { opts.set_yyrestoretag (lex_conf_string ()); return; } -#line 3157 "src/ast/lex_conf.cc" +#line 3158 "src/ast/lex_conf.cc" yy671: yych = (unsigned char)*++cur; if (yych == 'O') goto yy686; @@ -3175,9 +3176,9 @@ yy675: if (yybm[0+yych] & 32) { goto yy3; } -#line 51 "../src/ast/lex_conf.re" +#line 52 "../src/ast/lex_conf.re" { opts.set_bCaseInverted (lex_conf_bool()); return; } -#line 3181 "src/ast/lex_conf.cc" +#line 3182 "src/ast/lex_conf.cc" yy677: yych = (unsigned char)*++cur; if (yych == 's') goto yy106; @@ -3201,9 +3202,9 @@ yy681: if (yybm[0+yych] & 32) { goto yy3; } -#line 53 "../src/ast/lex_conf.re" +#line 54 "../src/ast/lex_conf.re" { opts.set_optimize_tags (lex_conf_bool()); return; } -#line 3207 "src/ast/lex_conf.cc" +#line 3208 "src/ast/lex_conf.cc" yy683: yych = (unsigned char)*++cur; if (yych == 's') goto yy95; @@ -3259,9 +3260,9 @@ yy692: } } yy693: -#line 77 "../src/ast/lex_conf.re" +#line 78 "../src/ast/lex_conf.re" { opts.set_cond_get (lex_conf_string ()); return; } -#line 3265 "src/ast/lex_conf.cc" +#line 3266 "src/ast/lex_conf.cc" yy694: yych = (unsigned char)*++cur; if (yych == 'e') goto yy704; @@ -3286,9 +3287,9 @@ yy695: } } yy696: -#line 79 "../src/ast/lex_conf.re" +#line 80 "../src/ast/lex_conf.re" { opts.set_cond_set (lex_conf_string ()); return; } -#line 3292 "src/ast/lex_conf.cc" +#line 3293 "src/ast/lex_conf.cc" yy697: yych = (unsigned char)*++cur; if (yych == 'e') goto yy707; @@ -3310,9 +3311,9 @@ yy701: if (yybm[0+yych] & 32) { goto yy3; } -#line 64 "../src/ast/lex_conf.re" +#line 65 "../src/ast/lex_conf.re" { lex_conf_encoding_policy(opts); return; } -#line 3316 "src/ast/lex_conf.cc" +#line 3317 "src/ast/lex_conf.cc" yy703: yych = (unsigned char)*++cur; if (yych == 'n') goto yy713; @@ -3342,17 +3343,17 @@ yy709: if (yybm[0+yych] & 32) { goto yy3; } -#line 50 "../src/ast/lex_conf.re" +#line 51 "../src/ast/lex_conf.re" { opts.set_bCaseInsensitive (lex_conf_bool()); return; } -#line 3348 "src/ast/lex_conf.cc" +#line 3349 "src/ast/lex_conf.cc" yy711: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 67 "../src/ast/lex_conf.re" +#line 68 "../src/ast/lex_conf.re" { lex_conf_dfa_minimization(opts); return; } -#line 3356 "src/ast/lex_conf.cc" +#line 3357 "src/ast/lex_conf.cc" yy713: yych = (unsigned char)*++cur; if (yych == 'a') goto yy722; @@ -3362,9 +3363,9 @@ yy714: if (yybm[0+yych] & 32) { goto yy3; } -#line 91 "../src/ast/lex_conf.re" +#line 92 "../src/ast/lex_conf.re" { opts.set_state_get_naked (lex_conf_bool()); return; } -#line 3368 "src/ast/lex_conf.cc" +#line 3369 "src/ast/lex_conf.cc" yy716: yych = (unsigned char)*++cur; if (yych == 'a') goto yy723; @@ -3378,14 +3379,14 @@ yy718: if (yybm[0+yych] & 32) { goto yy3; } -#line 93 "../src/ast/lex_conf.re" +#line 94 "../src/ast/lex_conf.re" { opts.set_state_set_naked (lex_conf_bool()); return; } -#line 3384 "src/ast/lex_conf.cc" +#line 3385 "src/ast/lex_conf.cc" yy720: ++cur; -#line 94 "../src/ast/lex_conf.re" +#line 95 "../src/ast/lex_conf.re" { opts.set_state_set_arg (lex_conf_string ()); return; } -#line 3389 "src/ast/lex_conf.cc" +#line 3390 "src/ast/lex_conf.cc" yy722: yych = (unsigned char)*++cur; if (yych == 'k') goto yy725; @@ -3420,27 +3421,27 @@ yy729: goto yy4; yy730: ++cur; -#line 80 "../src/ast/lex_conf.re" +#line 81 "../src/ast/lex_conf.re" { opts.set_cond_set_arg (lex_conf_string ()); return; } -#line 3426 "src/ast/lex_conf.cc" +#line 3427 "src/ast/lex_conf.cc" yy732: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 78 "../src/ast/lex_conf.re" +#line 79 "../src/ast/lex_conf.re" { opts.set_cond_get_naked (lex_conf_bool()); return; } -#line 3434 "src/ast/lex_conf.cc" +#line 3435 "src/ast/lex_conf.cc" yy734: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 81 "../src/ast/lex_conf.re" +#line 82 "../src/ast/lex_conf.re" { opts.set_cond_set_naked (lex_conf_bool()); return; } -#line 3442 "src/ast/lex_conf.cc" +#line 3443 "src/ast/lex_conf.cc" } -#line 175 "../src/ast/lex_conf.re" +#line 176 "../src/ast/lex_conf.re" } @@ -3448,7 +3449,7 @@ void Scanner::lex_conf_encoding_policy(Opt &opts) { lex_conf_assign (); -#line 3452 "src/ast/lex_conf.cc" +#line 3453 "src/ast/lex_conf.cc" { unsigned char yych; if ((lim - cur) < 10) YYFILL(10); @@ -3461,10 +3462,10 @@ void Scanner::lex_conf_encoding_policy(Opt &opts) } ++cur; yy739: -#line 182 "../src/ast/lex_conf.re" +#line 183 "../src/ast/lex_conf.re" { fatal_lc(get_line(), get_column(), "bad configuration value (expected: 'ignore', 'substitute', 'fail')"); } -#line 3468 "src/ast/lex_conf.cc" +#line 3469 "src/ast/lex_conf.cc" yy740: yych = (unsigned char)*(mar = ++cur); if (yych == 'a') goto yy743; @@ -3505,9 +3506,9 @@ yy749: goto yy744; yy750: ++cur; -#line 186 "../src/ast/lex_conf.re" +#line 187 "../src/ast/lex_conf.re" { opts.set_encoding_policy(Enc::POLICY_FAIL); goto end; } -#line 3511 "src/ast/lex_conf.cc" +#line 3512 "src/ast/lex_conf.cc" yy752: yych = (unsigned char)*++cur; if (yych == 'r') goto yy754; @@ -3526,9 +3527,9 @@ yy755: goto yy744; yy756: ++cur; -#line 184 "../src/ast/lex_conf.re" +#line 185 "../src/ast/lex_conf.re" { opts.set_encoding_policy(Enc::POLICY_IGNORE); goto end; } -#line 3532 "src/ast/lex_conf.cc" +#line 3533 "src/ast/lex_conf.cc" yy758: yych = (unsigned char)*++cur; if (yych != 't') goto yy744; @@ -3539,11 +3540,11 @@ yy758: yych = (unsigned char)*++cur; if (yych != 'e') goto yy744; ++cur; -#line 185 "../src/ast/lex_conf.re" +#line 186 "../src/ast/lex_conf.re" { opts.set_encoding_policy(Enc::POLICY_SUBSTITUTE); goto end; } -#line 3545 "src/ast/lex_conf.cc" +#line 3546 "src/ast/lex_conf.cc" } -#line 187 "../src/ast/lex_conf.re" +#line 188 "../src/ast/lex_conf.re" end: lex_conf_semicolon(); @@ -3553,7 +3554,7 @@ void Scanner::lex_conf_input(Opt &opts) { lex_conf_assign (); -#line 3557 "src/ast/lex_conf.cc" +#line 3558 "src/ast/lex_conf.cc" { unsigned char yych; if ((lim - cur) < 7) YYFILL(7); @@ -3564,10 +3565,10 @@ void Scanner::lex_conf_input(Opt &opts) yy766: ++cur; yy767: -#line 196 "../src/ast/lex_conf.re" +#line 197 "../src/ast/lex_conf.re" { fatal_lc(get_line(), get_column(), "bad configuration value (expected: 'default', 'custom')"); } -#line 3571 "src/ast/lex_conf.cc" +#line 3572 "src/ast/lex_conf.cc" yy768: yych = (unsigned char)*(mar = ++cur); if (yych == 'u') goto yy770; @@ -3612,18 +3613,18 @@ yy778: goto yy771; yy779: ++cur; -#line 199 "../src/ast/lex_conf.re" +#line 200 "../src/ast/lex_conf.re" { opts.set_input_api(INPUT_CUSTOM); goto end; } -#line 3618 "src/ast/lex_conf.cc" +#line 3619 "src/ast/lex_conf.cc" yy781: yych = (unsigned char)*++cur; if (yych != 't') goto yy771; ++cur; -#line 198 "../src/ast/lex_conf.re" +#line 199 "../src/ast/lex_conf.re" { opts.set_input_api(INPUT_DEFAULT); goto end; } -#line 3625 "src/ast/lex_conf.cc" +#line 3626 "src/ast/lex_conf.cc" } -#line 200 "../src/ast/lex_conf.re" +#line 201 "../src/ast/lex_conf.re" end: lex_conf_semicolon(); @@ -3633,7 +3634,7 @@ void Scanner::lex_conf_empty_class(Opt &opts) { lex_conf_assign (); -#line 3637 "src/ast/lex_conf.cc" +#line 3638 "src/ast/lex_conf.cc" { unsigned char yych; if ((lim - cur) < 11) YYFILL(11); @@ -3642,10 +3643,10 @@ void Scanner::lex_conf_empty_class(Opt &opts) if (yych == 'm') goto yy789; ++cur; yy787: -#line 209 "../src/ast/lex_conf.re" +#line 210 "../src/ast/lex_conf.re" { fatal_lc(get_line(), get_column(), "bad configuration value (expected: 'match-empty', 'match-none', 'error')"); } -#line 3649 "src/ast/lex_conf.cc" +#line 3650 "src/ast/lex_conf.cc" yy788: yych = (unsigned char)*(mar = ++cur); if (yych == 'r') goto yy790; @@ -3682,9 +3683,9 @@ yy796: goto yy791; yy797: ++cur; -#line 213 "../src/ast/lex_conf.re" +#line 214 "../src/ast/lex_conf.re" { opts.set_empty_class_policy(EMPTY_CLASS_ERROR); goto end; } -#line 3688 "src/ast/lex_conf.cc" +#line 3689 "src/ast/lex_conf.cc" yy799: yych = (unsigned char)*++cur; if (yych != '-') goto yy791; @@ -3722,16 +3723,16 @@ yy807: goto yy791; yy808: ++cur; -#line 212 "../src/ast/lex_conf.re" +#line 213 "../src/ast/lex_conf.re" { opts.set_empty_class_policy(EMPTY_CLASS_MATCH_NONE); goto end; } -#line 3728 "src/ast/lex_conf.cc" +#line 3729 "src/ast/lex_conf.cc" yy810: ++cur; -#line 211 "../src/ast/lex_conf.re" +#line 212 "../src/ast/lex_conf.re" { opts.set_empty_class_policy(EMPTY_CLASS_MATCH_EMPTY); goto end; } -#line 3733 "src/ast/lex_conf.cc" +#line 3734 "src/ast/lex_conf.cc" } -#line 214 "../src/ast/lex_conf.re" +#line 215 "../src/ast/lex_conf.re" end: lex_conf_semicolon(); @@ -3741,7 +3742,7 @@ void Scanner::lex_conf_dfa_minimization(Opt &opts) { lex_conf_assign (); -#line 3745 "src/ast/lex_conf.cc" +#line 3746 "src/ast/lex_conf.cc" { unsigned char yych; if ((lim - cur) < 5) YYFILL(5); @@ -3750,10 +3751,10 @@ void Scanner::lex_conf_dfa_minimization(Opt &opts) if (yych == 't') goto yy817; ++cur; yy815: -#line 223 "../src/ast/lex_conf.re" +#line 224 "../src/ast/lex_conf.re" { fatal_lc(get_line(), get_column(), "bad configuration value (expected: 'table', 'moore')"); } -#line 3757 "src/ast/lex_conf.cc" +#line 3758 "src/ast/lex_conf.cc" yy816: yych = (unsigned char)*(mar = ++cur); if (yych == 'o') goto yy818; @@ -3790,16 +3791,16 @@ yy824: goto yy819; yy825: ++cur; -#line 226 "../src/ast/lex_conf.re" +#line 227 "../src/ast/lex_conf.re" { opts.set_dfa_minimization(DFA_MINIMIZATION_MOORE); goto end; } -#line 3796 "src/ast/lex_conf.cc" +#line 3797 "src/ast/lex_conf.cc" yy827: ++cur; -#line 225 "../src/ast/lex_conf.re" +#line 226 "../src/ast/lex_conf.re" { opts.set_dfa_minimization(DFA_MINIMIZATION_TABLE); goto end; } -#line 3801 "src/ast/lex_conf.cc" +#line 3802 "src/ast/lex_conf.cc" } -#line 227 "../src/ast/lex_conf.re" +#line 228 "../src/ast/lex_conf.re" end: lex_conf_semicolon(); @@ -3817,7 +3818,7 @@ void Scanner::lex_conf_enc(Enc::type_t enc, Opt &opts) void Scanner::lex_conf_assign () { -#line 3821 "src/ast/lex_conf.cc" +#line 3822 "src/ast/lex_conf.cc" { unsigned char yych; static const unsigned char yybm[] = { @@ -3864,9 +3865,9 @@ void Scanner::lex_conf_assign () } ++cur; yy832: -#line 244 "../src/ast/lex_conf.re" +#line 245 "../src/ast/lex_conf.re" { fatal_lc(get_line(), get_column(), "missing '=' in configuration"); } -#line 3870 "src/ast/lex_conf.cc" +#line 3871 "src/ast/lex_conf.cc" yy833: yych = (unsigned char)*(mar = ++cur); if (yych <= 0x1F) { @@ -3883,9 +3884,9 @@ yy834: if (yybm[0+yych] & 128) { goto yy834; } -#line 245 "../src/ast/lex_conf.re" +#line 246 "../src/ast/lex_conf.re" { return; } -#line 3889 "src/ast/lex_conf.cc" +#line 3890 "src/ast/lex_conf.cc" yy837: ++cur; if (lim <= cur) YYFILL(1); @@ -3899,14 +3900,14 @@ yy837: cur = mar; goto yy832; } -#line 246 "../src/ast/lex_conf.re" +#line 247 "../src/ast/lex_conf.re" } void Scanner::lex_conf_semicolon () { -#line 3910 "src/ast/lex_conf.cc" +#line 3911 "src/ast/lex_conf.cc" { unsigned char yych; static const unsigned char yybm[] = { @@ -3953,9 +3954,9 @@ void Scanner::lex_conf_semicolon () } ++cur; yy843: -#line 252 "../src/ast/lex_conf.re" +#line 253 "../src/ast/lex_conf.re" { fatal_lc(get_line(), get_column(), "missing ending ';' in configuration"); } -#line 3959 "src/ast/lex_conf.cc" +#line 3960 "src/ast/lex_conf.cc" yy844: yych = (unsigned char)*(mar = ++cur); if (yybm[0+yych] & 128) { @@ -3964,9 +3965,9 @@ yy844: if (yych != ';') goto yy843; yy845: ++cur; -#line 253 "../src/ast/lex_conf.re" +#line 254 "../src/ast/lex_conf.re" { return; } -#line 3970 "src/ast/lex_conf.cc" +#line 3971 "src/ast/lex_conf.cc" yy847: ++cur; if (lim <= cur) YYFILL(1); @@ -3978,7 +3979,7 @@ yy847: cur = mar; goto yy843; } -#line 254 "../src/ast/lex_conf.re" +#line 255 "../src/ast/lex_conf.re" } @@ -3992,7 +3993,7 @@ int32_t Scanner::lex_conf_number () lex_conf_assign (); tok = cur; -#line 3996 "src/ast/lex_conf.cc" +#line 3997 "src/ast/lex_conf.cc" { unsigned char yych; static const unsigned char yybm[] = { @@ -4039,10 +4040,10 @@ int32_t Scanner::lex_conf_number () } ++cur; yy853: -#line 267 "../src/ast/lex_conf.re" +#line 268 "../src/ast/lex_conf.re" { fatal_lc(get_line(), get_column(), "bad configuration value (expected number)"); } -#line 4046 "src/ast/lex_conf.cc" +#line 4047 "src/ast/lex_conf.cc" yy854: yych = (unsigned char)*++cur; if (yych <= '0') goto yy853; @@ -4051,7 +4052,7 @@ yy854: yy855: ++cur; yy856: -#line 269 "../src/ast/lex_conf.re" +#line 270 "../src/ast/lex_conf.re" { int32_t n = 0; if (!s_to_i32_unsafe (tok, cur, n)) { @@ -4060,7 +4061,7 @@ yy856: lex_conf_semicolon (); return n; } -#line 4064 "src/ast/lex_conf.cc" +#line 4065 "src/ast/lex_conf.cc" yy857: ++cur; if (lim <= cur) YYFILL(1); @@ -4070,7 +4071,7 @@ yy857: } goto yy856; } -#line 277 "../src/ast/lex_conf.re" +#line 278 "../src/ast/lex_conf.re" } @@ -4080,7 +4081,7 @@ std::string Scanner::lex_conf_string () std::string s; tok = cur; -#line 4084 "src/ast/lex_conf.cc" +#line 4085 "src/ast/lex_conf.cc" { unsigned char yych; static const unsigned char yybm[] = { @@ -4136,9 +4137,9 @@ std::string Scanner::lex_conf_string () } } yy861: -#line 305 "../src/ast/lex_conf.re" +#line 306 "../src/ast/lex_conf.re" { goto end; } -#line 4142 "src/ast/lex_conf.cc" +#line 4143 "src/ast/lex_conf.cc" yy862: ++cur; if (lim <= cur) YYFILL(1); @@ -4146,15 +4147,15 @@ yy862: if (yybm[0+yych] & 128) { goto yy862; } -#line 301 "../src/ast/lex_conf.re" +#line 302 "../src/ast/lex_conf.re" { - s = std::string(tok, tok_len()); + s = getstr(tok, cur); goto end; } -#line 4155 "src/ast/lex_conf.cc" +#line 4156 "src/ast/lex_conf.cc" yy865: ++cur; -#line 286 "../src/ast/lex_conf.re" +#line 287 "../src/ast/lex_conf.re" { const char quote = tok[0]; for (bool end;;) { @@ -4170,9 +4171,9 @@ yy865: } } } -#line 4174 "src/ast/lex_conf.cc" +#line 4175 "src/ast/lex_conf.cc" } -#line 306 "../src/ast/lex_conf.re" +#line 307 "../src/ast/lex_conf.re" end: lex_conf_semicolon (); diff --git a/re2c/bootstrap/src/conf/parse_opts.cc b/re2c/bootstrap/src/conf/parse_opts.cc index 56f65380..3d685afb 100644 --- a/re2c/bootstrap/src/conf/parse_opts.cc +++ b/re2c/bootstrap/src/conf/parse_opts.cc @@ -1,10 +1,11 @@ -/* Generated by re2c 1.1.1 on Sun Dec 30 10:30:10 2018 */ +/* Generated by re2c 1.1.1 on Sun Dec 30 10:57:46 2018 */ #line 1 "../src/conf/parse_opts.re" #include "src/code/input_api.h" #include "src/conf/msg.h" #include "src/conf/opt.h" #include "src/re/empty_class_policy.h" #include "src/re/encoding/enc.h" +#include "src/util/string_utils.h" namespace re2c { @@ -21,7 +22,7 @@ parse_opts_t parse_opts(char **argv, conopt_t &globopts, Opt &opts, Warn &warn) char *YYCURSOR, *YYMARKER, *p; Warn::option_t option; -#line 28 "../src/conf/parse_opts.re" +#line 29 "../src/conf/parse_opts.re" opt: @@ -30,7 +31,7 @@ opt: goto end; } -#line 34 "src/conf/parse_opts.cc" +#line 35 "src/conf/parse_opts.cc" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -74,12 +75,12 @@ opt: goto yy4; yy2: ++YYCURSOR; -#line 37 "../src/conf/parse_opts.re" +#line 38 "../src/conf/parse_opts.re" { error ("bad option: %s", *argv); return EXIT_FAIL; } -#line 83 "src/conf/parse_opts.cc" +#line 84 "src/conf/parse_opts.cc" yy4: yych = (YYCTYPE)*++YYCURSOR; if (yybm[0+yych] & 128) { @@ -94,25 +95,25 @@ yy6: } else { if (yych == 'W') goto yy14; } -#line 60 "../src/conf/parse_opts.re" +#line 61 "../src/conf/parse_opts.re" { goto opt_short; } -#line 100 "src/conf/parse_opts.cc" +#line 101 "src/conf/parse_opts.cc" yy8: ++YYCURSOR; -#line 58 "../src/conf/parse_opts.re" +#line 59 "../src/conf/parse_opts.re" { if (!opts.source (*argv)) return EXIT_FAIL; goto opt; } -#line 105 "src/conf/parse_opts.cc" +#line 106 "src/conf/parse_opts.cc" yy10: ++YYCURSOR; -#line 57 "../src/conf/parse_opts.re" +#line 58 "../src/conf/parse_opts.re" { if (!opts.source ("")) return EXIT_FAIL; goto opt; } -#line 110 "src/conf/parse_opts.cc" +#line 111 "src/conf/parse_opts.cc" yy12: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x00) goto yy16; -#line 61 "../src/conf/parse_opts.re" +#line 62 "../src/conf/parse_opts.re" { goto opt_long; } -#line 116 "src/conf/parse_opts.cc" +#line 117 "src/conf/parse_opts.cc" yy14: yyaccept = 0; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -123,12 +124,12 @@ yy14: if (yych == 'n') goto yy22; } yy15: -#line 65 "../src/conf/parse_opts.re" +#line 66 "../src/conf/parse_opts.re" { option = Warn::W; goto opt_warn; } -#line 129 "src/conf/parse_opts.cc" +#line 130 "src/conf/parse_opts.cc" yy16: ++YYCURSOR; -#line 43 "../src/conf/parse_opts.re" +#line 44 "../src/conf/parse_opts.re" { // all remaining arguments are non-options // so they must be input files @@ -142,12 +143,12 @@ yy16: } goto end; } -#line 146 "src/conf/parse_opts.cc" +#line 147 "src/conf/parse_opts.cc" yy18: ++YYCURSOR; -#line 63 "../src/conf/parse_opts.re" +#line 64 "../src/conf/parse_opts.re" { warn.set_all (); goto opt; } -#line 151 "src/conf/parse_opts.cc" +#line 152 "src/conf/parse_opts.cc" yy20: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy23; @@ -179,9 +180,9 @@ yy26: yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych == 'e') goto yy29; yy27: -#line 66 "../src/conf/parse_opts.re" +#line 67 "../src/conf/parse_opts.re" { option = Warn::WNO; goto opt_warn; } -#line 185 "src/conf/parse_opts.cc" +#line 186 "src/conf/parse_opts.cc" yy28: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy30; @@ -201,14 +202,14 @@ yy31: goto yy21; yy32: ++YYCURSOR; -#line 64 "../src/conf/parse_opts.re" +#line 65 "../src/conf/parse_opts.re" { warn.set_all_error (); goto opt; } -#line 207 "src/conf/parse_opts.cc" +#line 208 "src/conf/parse_opts.cc" yy34: ++YYCURSOR; -#line 67 "../src/conf/parse_opts.re" +#line 68 "../src/conf/parse_opts.re" { option = Warn::WERROR; goto opt_warn; } -#line 212 "src/conf/parse_opts.cc" +#line 213 "src/conf/parse_opts.cc" yy36: yych = (YYCTYPE)*++YYCURSOR; if (yych != 'o') goto yy21; @@ -217,16 +218,16 @@ yy36: yych = (YYCTYPE)*++YYCURSOR; if (yych != '-') goto yy21; ++YYCURSOR; -#line 68 "../src/conf/parse_opts.re" +#line 69 "../src/conf/parse_opts.re" { option = Warn::WNOERROR; goto opt_warn; } -#line 223 "src/conf/parse_opts.cc" +#line 224 "src/conf/parse_opts.cc" } -#line 69 "../src/conf/parse_opts.re" +#line 70 "../src/conf/parse_opts.re" opt_warn: -#line 230 "src/conf/parse_opts.cc" +#line 231 "src/conf/parse_opts.cc" { YYCTYPE yych; yych = (YYCTYPE)*YYCURSOR; @@ -242,12 +243,12 @@ opt_warn: yy43: ++YYCURSOR; yy44: -#line 74 "../src/conf/parse_opts.re" +#line 75 "../src/conf/parse_opts.re" { error ("bad warning: %s", *argv); return EXIT_FAIL; } -#line 251 "src/conf/parse_opts.cc" +#line 252 "src/conf/parse_opts.cc" yy45: yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych == 'o') goto yy51; @@ -674,9 +675,9 @@ yy150: goto yy52; yy151: ++YYCURSOR; -#line 82 "../src/conf/parse_opts.re" +#line 83 "../src/conf/parse_opts.re" { warn.set (Warn::SWAPPED_RANGE, option); goto opt; } -#line 680 "src/conf/parse_opts.cc" +#line 681 "src/conf/parse_opts.cc" yy153: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy160; @@ -715,14 +716,14 @@ yy161: goto yy52; yy162: ++YYCURSOR; -#line 85 "../src/conf/parse_opts.re" +#line 86 "../src/conf/parse_opts.re" { warn.set (Warn::USELESS_ESCAPE, option); goto opt; } -#line 721 "src/conf/parse_opts.cc" +#line 722 "src/conf/parse_opts.cc" yy164: ++YYCURSOR; -#line 78 "../src/conf/parse_opts.re" +#line 79 "../src/conf/parse_opts.re" { warn.set (Warn::CONDITION_ORDER, option); goto opt; } -#line 726 "src/conf/parse_opts.cc" +#line 727 "src/conf/parse_opts.cc" yy166: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'c') goto yy171; @@ -781,18 +782,18 @@ yy179: goto yy52; yy180: ++YYCURSOR; -#line 84 "../src/conf/parse_opts.re" +#line 85 "../src/conf/parse_opts.re" { warn.set (Warn::UNREACHABLE_RULES, option); goto opt; } -#line 787 "src/conf/parse_opts.cc" +#line 788 "src/conf/parse_opts.cc" yy182: yych = (YYCTYPE)*++YYCURSOR; if (yych == 's') goto yy187; goto yy52; yy183: ++YYCURSOR; -#line 80 "../src/conf/parse_opts.re" +#line 81 "../src/conf/parse_opts.re" { warn.set (Warn::MATCH_EMPTY_STRING, option); goto opt; } -#line 796 "src/conf/parse_opts.cc" +#line 797 "src/conf/parse_opts.cc" yy185: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'g') goto yy188; @@ -827,28 +828,28 @@ yy192: goto yy52; yy193: ++YYCURSOR; -#line 79 "../src/conf/parse_opts.re" +#line 80 "../src/conf/parse_opts.re" { warn.set (Warn::EMPTY_CHARACTER_CLASS, option); goto opt; } -#line 833 "src/conf/parse_opts.cc" +#line 834 "src/conf/parse_opts.cc" yy195: ++YYCURSOR; -#line 81 "../src/conf/parse_opts.re" +#line 82 "../src/conf/parse_opts.re" { warn.set (Warn::NONDETERMINISTIC_TAGS, option); goto opt; } -#line 838 "src/conf/parse_opts.cc" +#line 839 "src/conf/parse_opts.cc" yy197: yych = (YYCTYPE)*++YYCURSOR; if (yych >= 0x01) goto yy52; ++YYCURSOR; -#line 83 "../src/conf/parse_opts.re" +#line 84 "../src/conf/parse_opts.re" { warn.set (Warn::UNDEFINED_CONTROL_FLOW, option); goto opt; } -#line 845 "src/conf/parse_opts.cc" +#line 846 "src/conf/parse_opts.cc" } -#line 86 "../src/conf/parse_opts.re" +#line 87 "../src/conf/parse_opts.re" opt_short: -#line 852 "src/conf/parse_opts.cc" +#line 853 "src/conf/parse_opts.cc" { YYCTYPE yych; yych = (YYCTYPE)*YYCURSOR; @@ -936,167 +937,167 @@ opt_short: } } ++YYCURSOR; -#line 95 "../src/conf/parse_opts.re" +#line 96 "../src/conf/parse_opts.re" { goto opt; } -#line 942 "src/conf/parse_opts.cc" +#line 943 "src/conf/parse_opts.cc" yy204: ++YYCURSOR; -#line 91 "../src/conf/parse_opts.re" +#line 92 "../src/conf/parse_opts.re" { error ("bad short option: %s", *argv); return EXIT_FAIL; } -#line 950 "src/conf/parse_opts.cc" +#line 951 "src/conf/parse_opts.cc" yy206: ++YYCURSOR; -#line 126 "../src/conf/parse_opts.re" +#line 127 "../src/conf/parse_opts.re" { goto opt_short; } -#line 955 "src/conf/parse_opts.cc" +#line 956 "src/conf/parse_opts.cc" yy208: ++YYCURSOR; -#line 121 "../src/conf/parse_opts.re" +#line 122 "../src/conf/parse_opts.re" { opts.set_encoding(Enc::UTF8); goto opt_short; } -#line 960 "src/conf/parse_opts.cc" +#line 961 "src/conf/parse_opts.cc" yy210: ++YYCURSOR; -#line 96 "../src/conf/parse_opts.re" +#line 97 "../src/conf/parse_opts.re" { usage (); return EXIT_OK; } -#line 965 "src/conf/parse_opts.cc" +#line 966 "src/conf/parse_opts.cc" yy212: ++YYCURSOR; -#line 101 "../src/conf/parse_opts.re" +#line 102 "../src/conf/parse_opts.re" { globopts.target = TARGET_DOT; goto opt_short; } -#line 970 "src/conf/parse_opts.cc" +#line 971 "src/conf/parse_opts.cc" yy214: ++YYCURSOR; -#line 103 "../src/conf/parse_opts.re" +#line 104 "../src/conf/parse_opts.re" { globopts.FFlag = true; goto opt_short; } -#line 975 "src/conf/parse_opts.cc" +#line 976 "src/conf/parse_opts.cc" yy216: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x00) goto yy256; -#line 108 "../src/conf/parse_opts.re" +#line 109 "../src/conf/parse_opts.re" { goto opt_incpath; } -#line 981 "src/conf/parse_opts.cc" +#line 982 "src/conf/parse_opts.cc" yy218: ++YYCURSOR; -#line 116 "../src/conf/parse_opts.re" +#line 117 "../src/conf/parse_opts.re" { opts.set_posix_captures(true); goto opt_short; } -#line 986 "src/conf/parse_opts.cc" +#line 987 "src/conf/parse_opts.cc" yy220: ++YYCURSOR; -#line 105 "../src/conf/parse_opts.re" +#line 106 "../src/conf/parse_opts.re" { globopts.target = TARGET_SKELETON; goto opt_short; } -#line 991 "src/conf/parse_opts.cc" +#line 992 "src/conf/parse_opts.cc" yy222: ++YYCURSOR; -#line 115 "../src/conf/parse_opts.re" +#line 116 "../src/conf/parse_opts.re" { opts.set_tags(true); goto opt_short; } -#line 996 "src/conf/parse_opts.cc" +#line 997 "src/conf/parse_opts.cc" yy224: ++YYCURSOR; -#line 98 "../src/conf/parse_opts.re" +#line 99 "../src/conf/parse_opts.re" { vernum (); return EXIT_OK; } -#line 1001 "src/conf/parse_opts.cc" +#line 1002 "src/conf/parse_opts.cc" yy226: ++YYCURSOR; -#line 110 "../src/conf/parse_opts.re" +#line 111 "../src/conf/parse_opts.re" { opts.set_bFlag(true); goto opt_short; } -#line 1006 "src/conf/parse_opts.cc" +#line 1007 "src/conf/parse_opts.cc" yy228: ++YYCURSOR; -#line 100 "../src/conf/parse_opts.re" +#line 101 "../src/conf/parse_opts.re" { globopts.cFlag = true; goto opt_short; } -#line 1011 "src/conf/parse_opts.cc" +#line 1012 "src/conf/parse_opts.cc" yy230: ++YYCURSOR; -#line 111 "../src/conf/parse_opts.re" +#line 112 "../src/conf/parse_opts.re" { opts.set_dFlag(true); goto opt_short; } -#line 1016 "src/conf/parse_opts.cc" +#line 1017 "src/conf/parse_opts.cc" yy232: ++YYCURSOR; -#line 117 "../src/conf/parse_opts.re" +#line 118 "../src/conf/parse_opts.re" { opts.set_encoding(Enc::EBCDIC); goto opt_short; } -#line 1021 "src/conf/parse_opts.cc" +#line 1022 "src/conf/parse_opts.cc" yy234: ++YYCURSOR; -#line 102 "../src/conf/parse_opts.re" +#line 103 "../src/conf/parse_opts.re" { globopts.fFlag = true; goto opt_short; } -#line 1026 "src/conf/parse_opts.cc" +#line 1027 "src/conf/parse_opts.cc" yy236: ++YYCURSOR; -#line 112 "../src/conf/parse_opts.re" +#line 113 "../src/conf/parse_opts.re" { opts.set_gFlag(true); goto opt_short; } -#line 1031 "src/conf/parse_opts.cc" +#line 1032 "src/conf/parse_opts.cc" yy238: ++YYCURSOR; -#line 113 "../src/conf/parse_opts.re" +#line 114 "../src/conf/parse_opts.re" { opts.set_iFlag(true); goto opt_short; } -#line 1036 "src/conf/parse_opts.cc" +#line 1037 "src/conf/parse_opts.cc" yy240: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x00) goto yy258; -#line 123 "../src/conf/parse_opts.re" +#line 124 "../src/conf/parse_opts.re" { *argv = YYCURSOR; goto opt_output; } -#line 1042 "src/conf/parse_opts.cc" +#line 1043 "src/conf/parse_opts.cc" yy242: ++YYCURSOR; -#line 104 "../src/conf/parse_opts.re" +#line 105 "../src/conf/parse_opts.re" { globopts.rFlag = true; goto opt_short; } -#line 1047 "src/conf/parse_opts.cc" +#line 1048 "src/conf/parse_opts.cc" yy244: ++YYCURSOR; -#line 114 "../src/conf/parse_opts.re" +#line 115 "../src/conf/parse_opts.re" { opts.set_sFlag(true); goto opt_short; } -#line 1052 "src/conf/parse_opts.cc" +#line 1053 "src/conf/parse_opts.cc" yy246: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x00) goto yy260; -#line 125 "../src/conf/parse_opts.re" +#line 126 "../src/conf/parse_opts.re" { *argv = YYCURSOR; goto opt_header; } -#line 1058 "src/conf/parse_opts.cc" +#line 1059 "src/conf/parse_opts.cc" yy248: ++YYCURSOR; -#line 118 "../src/conf/parse_opts.re" +#line 119 "../src/conf/parse_opts.re" { opts.set_encoding(Enc::UTF32); goto opt_short; } -#line 1063 "src/conf/parse_opts.cc" +#line 1064 "src/conf/parse_opts.cc" yy250: ++YYCURSOR; -#line 97 "../src/conf/parse_opts.re" +#line 98 "../src/conf/parse_opts.re" { version (); return EXIT_OK; } -#line 1068 "src/conf/parse_opts.cc" +#line 1069 "src/conf/parse_opts.cc" yy252: ++YYCURSOR; -#line 119 "../src/conf/parse_opts.re" +#line 120 "../src/conf/parse_opts.re" { opts.set_encoding(Enc::UCS2); goto opt_short; } -#line 1073 "src/conf/parse_opts.cc" +#line 1074 "src/conf/parse_opts.cc" yy254: ++YYCURSOR; -#line 120 "../src/conf/parse_opts.re" +#line 121 "../src/conf/parse_opts.re" { opts.set_encoding(Enc::UTF16); goto opt_short; } -#line 1078 "src/conf/parse_opts.cc" +#line 1079 "src/conf/parse_opts.cc" yy256: ++YYCURSOR; -#line 107 "../src/conf/parse_opts.re" +#line 108 "../src/conf/parse_opts.re" { if (!next (YYCURSOR, argv)) { error_arg ("-I"); return EXIT_FAIL; } goto opt_incpath; } -#line 1083 "src/conf/parse_opts.cc" +#line 1084 "src/conf/parse_opts.cc" yy258: ++YYCURSOR; -#line 122 "../src/conf/parse_opts.re" +#line 123 "../src/conf/parse_opts.re" { if (!next (YYCURSOR, argv)) { error_arg ("-o, --output"); return EXIT_FAIL; } goto opt_output; } -#line 1088 "src/conf/parse_opts.cc" +#line 1089 "src/conf/parse_opts.cc" yy260: ++YYCURSOR; -#line 124 "../src/conf/parse_opts.re" +#line 125 "../src/conf/parse_opts.re" { if (!next (YYCURSOR, argv)) { error_arg ("-t, --type-header"); return EXIT_FAIL; } goto opt_header; } -#line 1093 "src/conf/parse_opts.cc" +#line 1094 "src/conf/parse_opts.cc" } -#line 127 "../src/conf/parse_opts.re" +#line 128 "../src/conf/parse_opts.re" opt_long: -#line 1100 "src/conf/parse_opts.cc" +#line 1101 "src/conf/parse_opts.cc" { YYCTYPE yych; yych = (YYCTYPE)*YYCURSOR; @@ -1122,12 +1123,12 @@ opt_long: yy264: ++YYCURSOR; yy265: -#line 132 "../src/conf/parse_opts.re" +#line 133 "../src/conf/parse_opts.re" { error ("bad long option: %s", *argv); return EXIT_FAIL; } -#line 1131 "src/conf/parse_opts.cc" +#line 1132 "src/conf/parse_opts.cc" yy266: yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych == 'i') goto yy282; @@ -1491,9 +1492,9 @@ yy347: goto yy283; yy348: ++YYCURSOR; -#line 161 "../src/conf/parse_opts.re" +#line 162 "../src/conf/parse_opts.re" { opts.set_encoding(Enc::EBCDIC); goto opt; } -#line 1497 "src/conf/parse_opts.cc" +#line 1498 "src/conf/parse_opts.cc" yy350: yych = (YYCTYPE)*++YYCURSOR; if (yych == '-') goto yy384; @@ -1655,9 +1656,9 @@ yy387: goto yy283; yy388: ++YYCURSOR; -#line 136 "../src/conf/parse_opts.re" +#line 137 "../src/conf/parse_opts.re" { usage (); return EXIT_OK; } -#line 1661 "src/conf/parse_opts.cc" +#line 1662 "src/conf/parse_opts.cc" yy390: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x00) goto yy427; @@ -1716,9 +1717,9 @@ yy403: goto yy283; yy404: ++YYCURSOR; -#line 156 "../src/conf/parse_opts.re" +#line 157 "../src/conf/parse_opts.re" { opts.set_tags (true); goto opt; } -#line 1722 "src/conf/parse_opts.cc" +#line 1723 "src/conf/parse_opts.cc" yy406: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'h') goto yy442; @@ -1805,9 +1806,9 @@ yy426: goto yy283; yy427: ++YYCURSOR; -#line 169 "../src/conf/parse_opts.re" +#line 170 "../src/conf/parse_opts.re" { goto opt_input; } -#line 1811 "src/conf/parse_opts.cc" +#line 1812 "src/conf/parse_opts.cc" yy429: yych = (YYCTYPE)*++YYCURSOR; if (yych == '-') goto yy464; @@ -1874,9 +1875,9 @@ yy444: goto yy283; yy445: ++YYCURSOR; -#line 165 "../src/conf/parse_opts.re" +#line 166 "../src/conf/parse_opts.re" { opts.set_encoding(Enc::UTF8); goto opt; } -#line 1880 "src/conf/parse_opts.cc" +#line 1881 "src/conf/parse_opts.cc" yy447: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x00) goto yy482; @@ -1972,9 +1973,9 @@ yy469: goto yy283; yy470: ++YYCURSOR; -#line 166 "../src/conf/parse_opts.re" +#line 167 "../src/conf/parse_opts.re" { if (!next (YYCURSOR, argv)) { error_arg ("-o, --output"); return EXIT_FAIL; } goto opt_output; } -#line 1978 "src/conf/parse_opts.cc" +#line 1979 "src/conf/parse_opts.cc" yy472: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'a') goto yy507; @@ -2009,14 +2010,14 @@ yy479: goto yy283; yy480: ++YYCURSOR; -#line 164 "../src/conf/parse_opts.re" +#line 165 "../src/conf/parse_opts.re" { opts.set_encoding(Enc::UTF16); goto opt; } -#line 2015 "src/conf/parse_opts.cc" +#line 2016 "src/conf/parse_opts.cc" yy482: ++YYCURSOR; -#line 138 "../src/conf/parse_opts.re" +#line 139 "../src/conf/parse_opts.re" { vernum (); return EXIT_OK; } -#line 2020 "src/conf/parse_opts.cc" +#line 2021 "src/conf/parse_opts.cc" yy484: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x00) goto yy516; @@ -2139,14 +2140,14 @@ yy513: goto yy283; yy514: ++YYCURSOR; -#line 162 "../src/conf/parse_opts.re" +#line 163 "../src/conf/parse_opts.re" { opts.set_encoding(Enc::UTF32); goto opt; } -#line 2145 "src/conf/parse_opts.cc" +#line 2146 "src/conf/parse_opts.cc" yy516: ++YYCURSOR; -#line 137 "../src/conf/parse_opts.re" +#line 138 "../src/conf/parse_opts.re" { version (); return EXIT_OK; } -#line 2150 "src/conf/parse_opts.cc" +#line 2151 "src/conf/parse_opts.cc" yy518: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy550; @@ -2194,18 +2195,18 @@ yy527: } yy528: ++YYCURSOR; -#line 174 "../src/conf/parse_opts.re" +#line 175 "../src/conf/parse_opts.re" { globopts.dump_nfa = true; goto opt; } -#line 2200 "src/conf/parse_opts.cc" +#line 2201 "src/conf/parse_opts.cc" yy530: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'p') goto yy564; goto yy283; yy531: ++YYCURSOR; -#line 141 "../src/conf/parse_opts.re" +#line 142 "../src/conf/parse_opts.re" { globopts.target = TARGET_DOT; goto opt; } -#line 2209 "src/conf/parse_opts.cc" +#line 2210 "src/conf/parse_opts.cc" yy533: yych = (YYCTYPE)*++YYCURSOR; if (yych == 's') goto yy565; @@ -2248,18 +2249,18 @@ yy542: goto yy283; yy543: ++YYCURSOR; -#line 144 "../src/conf/parse_opts.re" +#line 145 "../src/conf/parse_opts.re" { globopts.rFlag = true; goto opt; } -#line 2254 "src/conf/parse_opts.cc" +#line 2255 "src/conf/parse_opts.cc" yy545: yych = (YYCTYPE)*++YYCURSOR; if (yych == 's') goto yy575; goto yy283; yy546: ++YYCURSOR; -#line 147 "../src/conf/parse_opts.re" +#line 148 "../src/conf/parse_opts.re" { globopts.target = TARGET_SKELETON; goto opt; } -#line 2263 "src/conf/parse_opts.cc" +#line 2264 "src/conf/parse_opts.cc" yy548: yych = (YYCTYPE)*++YYCURSOR; if (yych == 's') goto yy576; @@ -2302,9 +2303,9 @@ yy557: goto yy283; yy558: ++YYCURSOR; -#line 179 "../src/conf/parse_opts.re" +#line 180 "../src/conf/parse_opts.re" { globopts.dump_adfa = true; goto opt; } -#line 2308 "src/conf/parse_opts.cc" +#line 2309 "src/conf/parse_opts.cc" yy560: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy587; @@ -2399,9 +2400,9 @@ yy582: goto yy283; yy583: ++YYCURSOR; -#line 140 "../src/conf/parse_opts.re" +#line 141 "../src/conf/parse_opts.re" { globopts.cFlag = true; goto opt; } -#line 2405 "src/conf/parse_opts.cc" +#line 2406 "src/conf/parse_opts.cc" yy585: yych = (YYCTYPE)*++YYCURSOR; if (yych == 't') goto yy615; @@ -2428,9 +2429,9 @@ yy590: goto yy283; yy591: ++YYCURSOR; -#line 160 "../src/conf/parse_opts.re" +#line 161 "../src/conf/parse_opts.re" { opts.set_eager_skip(true); goto opt; } -#line 2434 "src/conf/parse_opts.cc" +#line 2435 "src/conf/parse_opts.cc" yy593: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x00) goto yy621; @@ -2445,9 +2446,9 @@ yy595: goto yy283; yy596: ++YYCURSOR; -#line 153 "../src/conf/parse_opts.re" +#line 154 "../src/conf/parse_opts.re" { opts.set_sFlag (true); goto opt; } -#line 2451 "src/conf/parse_opts.cc" +#line 2452 "src/conf/parse_opts.cc" yy598: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'f') goto yy626; @@ -2466,9 +2467,9 @@ yy601: goto yy283; yy602: ++YYCURSOR; -#line 146 "../src/conf/parse_opts.re" +#line 147 "../src/conf/parse_opts.re" { globopts.version = false; goto opt; } -#line 2472 "src/conf/parse_opts.cc" +#line 2473 "src/conf/parse_opts.cc" yy604: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy630; @@ -2487,14 +2488,14 @@ yy607: goto yy283; yy608: ++YYCURSOR; -#line 163 "../src/conf/parse_opts.re" +#line 164 "../src/conf/parse_opts.re" { opts.set_encoding(Enc::UCS2); goto opt; } -#line 2493 "src/conf/parse_opts.cc" +#line 2494 "src/conf/parse_opts.cc" yy610: ++YYCURSOR; -#line 149 "../src/conf/parse_opts.re" +#line 150 "../src/conf/parse_opts.re" { opts.set_bFlag (true); goto opt; } -#line 2498 "src/conf/parse_opts.cc" +#line 2499 "src/conf/parse_opts.cc" yy612: yych = (YYCTYPE)*++YYCURSOR; if (yych == 't') goto yy636; @@ -2533,18 +2534,18 @@ yy620: goto yy283; yy621: ++YYCURSOR; -#line 170 "../src/conf/parse_opts.re" +#line 171 "../src/conf/parse_opts.re" { goto opt_empty_class; } -#line 2539 "src/conf/parse_opts.cc" +#line 2540 "src/conf/parse_opts.cc" yy623: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'i') goto yy649; goto yy283; yy624: ++YYCURSOR; -#line 143 "../src/conf/parse_opts.re" +#line 144 "../src/conf/parse_opts.re" { globopts.FFlag = true; goto opt; } -#line 2548 "src/conf/parse_opts.cc" +#line 2549 "src/conf/parse_opts.cc" yy626: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'o') goto yy650; @@ -2567,18 +2568,18 @@ yy630: goto yy283; yy631: ++YYCURSOR; -#line 172 "../src/conf/parse_opts.re" +#line 173 "../src/conf/parse_opts.re" { goto opt; } -#line 2573 "src/conf/parse_opts.cc" +#line 2574 "src/conf/parse_opts.cc" yy633: yych = (YYCTYPE)*++YYCURSOR; if (yych == 't') goto yy656; goto yy283; yy634: ++YYCURSOR; -#line 167 "../src/conf/parse_opts.re" +#line 168 "../src/conf/parse_opts.re" { if (!next (YYCURSOR, argv)) { error_arg ("-t, --type-header"); return EXIT_FAIL; } goto opt_header; } -#line 2582 "src/conf/parse_opts.cc" +#line 2583 "src/conf/parse_opts.cc" yy636: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'i') goto yy657; @@ -2593,28 +2594,28 @@ yy638: goto yy283; yy639: ++YYCURSOR; -#line 150 "../src/conf/parse_opts.re" +#line 151 "../src/conf/parse_opts.re" { opts.set_dFlag (true); goto opt; } -#line 2599 "src/conf/parse_opts.cc" +#line 2600 "src/conf/parse_opts.cc" yy641: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'i') goto yy661; goto yy283; yy642: ++YYCURSOR; -#line 176 "../src/conf/parse_opts.re" +#line 177 "../src/conf/parse_opts.re" { globopts.dump_dfa_det = true; goto opt; } -#line 2608 "src/conf/parse_opts.cc" +#line 2609 "src/conf/parse_opts.cc" yy644: ++YYCURSOR; -#line 178 "../src/conf/parse_opts.re" +#line 179 "../src/conf/parse_opts.re" { globopts.dump_dfa_min = true; goto opt; } -#line 2613 "src/conf/parse_opts.cc" +#line 2614 "src/conf/parse_opts.cc" yy646: ++YYCURSOR; -#line 175 "../src/conf/parse_opts.re" +#line 176 "../src/conf/parse_opts.re" { globopts.dump_dfa_raw = true; goto opt; } -#line 2618 "src/conf/parse_opts.cc" +#line 2619 "src/conf/parse_opts.cc" yy648: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'p') goto yy662; @@ -2633,9 +2634,9 @@ yy651: goto yy283; yy652: ++YYCURSOR; -#line 158 "../src/conf/parse_opts.re" +#line 159 "../src/conf/parse_opts.re" { opts.set_lookahead(false); goto opt; } -#line 2639 "src/conf/parse_opts.cc" +#line 2640 "src/conf/parse_opts.cc" yy654: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'a') goto yy667; @@ -2654,9 +2655,9 @@ yy657: goto yy283; yy658: ++YYCURSOR; -#line 155 "../src/conf/parse_opts.re" +#line 156 "../src/conf/parse_opts.re" { opts.set_bCaseInverted (true); goto opt; } -#line 2660 "src/conf/parse_opts.cc" +#line 2661 "src/conf/parse_opts.cc" yy660: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x00) goto yy671; @@ -2675,9 +2676,9 @@ yy663: goto yy283; yy664: ++YYCURSOR; -#line 152 "../src/conf/parse_opts.re" +#line 153 "../src/conf/parse_opts.re" { opts.set_iFlag (true); goto opt; } -#line 2681 "src/conf/parse_opts.cc" +#line 2682 "src/conf/parse_opts.cc" yy666: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'd') goto yy676; @@ -2700,9 +2701,9 @@ yy670: goto yy283; yy671: ++YYCURSOR; -#line 151 "../src/conf/parse_opts.re" +#line 152 "../src/conf/parse_opts.re" { opts.set_gFlag (true); goto opt; } -#line 2706 "src/conf/parse_opts.cc" +#line 2707 "src/conf/parse_opts.cc" yy673: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'n') goto yy683; @@ -2725,14 +2726,14 @@ yy677: goto yy283; yy678: ++YYCURSOR; -#line 157 "../src/conf/parse_opts.re" +#line 158 "../src/conf/parse_opts.re" { opts.set_posix_captures(true); goto opt; } -#line 2731 "src/conf/parse_opts.cc" +#line 2732 "src/conf/parse_opts.cc" yy680: ++YYCURSOR; -#line 142 "../src/conf/parse_opts.re" +#line 143 "../src/conf/parse_opts.re" { globopts.fFlag = true; goto opt; } -#line 2736 "src/conf/parse_opts.cc" +#line 2737 "src/conf/parse_opts.cc" yy682: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x00) goto yy690; @@ -2743,14 +2744,14 @@ yy683: goto yy283; yy684: ++YYCURSOR; -#line 177 "../src/conf/parse_opts.re" +#line 178 "../src/conf/parse_opts.re" { globopts.dump_dfa_tagopt = true; goto opt; } -#line 2749 "src/conf/parse_opts.cc" +#line 2750 "src/conf/parse_opts.cc" yy686: ++YYCURSOR; -#line 168 "../src/conf/parse_opts.re" +#line 169 "../src/conf/parse_opts.re" { goto opt_encoding_policy; } -#line 2754 "src/conf/parse_opts.cc" +#line 2755 "src/conf/parse_opts.cc" yy688: yych = (YYCTYPE)*++YYCURSOR; if (yych == 't') goto yy694; @@ -2761,37 +2762,37 @@ yy689: goto yy283; yy690: ++YYCURSOR; -#line 154 "../src/conf/parse_opts.re" +#line 155 "../src/conf/parse_opts.re" { opts.set_bCaseInsensitive (true); goto opt; } -#line 2767 "src/conf/parse_opts.cc" +#line 2768 "src/conf/parse_opts.cc" yy692: ++YYCURSOR; -#line 171 "../src/conf/parse_opts.re" +#line 172 "../src/conf/parse_opts.re" { goto opt_dfa_minimization; } -#line 2772 "src/conf/parse_opts.cc" +#line 2773 "src/conf/parse_opts.cc" yy694: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy697; goto yy283; yy695: ++YYCURSOR; -#line 159 "../src/conf/parse_opts.re" +#line 160 "../src/conf/parse_opts.re" { opts.set_optimize_tags(false); goto opt; } -#line 2781 "src/conf/parse_opts.cc" +#line 2782 "src/conf/parse_opts.cc" yy697: yych = (YYCTYPE)*++YYCURSOR; if (yych >= 0x01) goto yy283; ++YYCURSOR; -#line 145 "../src/conf/parse_opts.re" +#line 146 "../src/conf/parse_opts.re" { globopts.bNoGenerationDate = true; goto opt; } -#line 2788 "src/conf/parse_opts.cc" +#line 2789 "src/conf/parse_opts.cc" } -#line 180 "../src/conf/parse_opts.re" +#line 181 "../src/conf/parse_opts.re" opt_output: -#line 2795 "src/conf/parse_opts.cc" +#line 2796 "src/conf/parse_opts.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -2833,28 +2834,28 @@ opt_output: if (yych != '-') goto yy704; yy702: ++YYCURSOR; -#line 185 "../src/conf/parse_opts.re" +#line 186 "../src/conf/parse_opts.re" { error ("bad argument to option -o, --output: %s", *argv); return EXIT_FAIL; } -#line 2842 "src/conf/parse_opts.cc" +#line 2843 "src/conf/parse_opts.cc" yy704: yych = (YYCTYPE)*++YYCURSOR; if (yybm[0+yych] & 128) { goto yy704; } ++YYCURSOR; -#line 189 "../src/conf/parse_opts.re" +#line 190 "../src/conf/parse_opts.re" { opts.set_output_file (*argv); goto opt; } -#line 2851 "src/conf/parse_opts.cc" +#line 2852 "src/conf/parse_opts.cc" } -#line 190 "../src/conf/parse_opts.re" +#line 191 "../src/conf/parse_opts.re" opt_header: -#line 2858 "src/conf/parse_opts.cc" +#line 2859 "src/conf/parse_opts.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -2896,29 +2897,29 @@ opt_header: if (yych != '-') goto yy712; yy710: ++YYCURSOR; -#line 195 "../src/conf/parse_opts.re" +#line 196 "../src/conf/parse_opts.re" { error ("bad argument to option -t, --type-header: %s", *argv); return EXIT_FAIL; } -#line 2905 "src/conf/parse_opts.cc" +#line 2906 "src/conf/parse_opts.cc" yy712: yych = (YYCTYPE)*++YYCURSOR; if (yybm[0+yych] & 128) { goto yy712; } ++YYCURSOR; -#line 199 "../src/conf/parse_opts.re" +#line 200 "../src/conf/parse_opts.re" { opts.set_header_file (*argv); goto opt; } -#line 2914 "src/conf/parse_opts.cc" +#line 2915 "src/conf/parse_opts.cc" } -#line 200 "../src/conf/parse_opts.re" +#line 201 "../src/conf/parse_opts.re" opt_incpath: p = YYCURSOR; -#line 2922 "src/conf/parse_opts.cc" +#line 2923 "src/conf/parse_opts.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -2960,22 +2961,21 @@ opt_incpath: if (yych != '-') goto yy720; yy718: ++YYCURSOR; -#line 205 "../src/conf/parse_opts.re" +#line 206 "../src/conf/parse_opts.re" { error ("bad argument to option -I: %s", *argv); return EXIT_FAIL; } -#line 2969 "src/conf/parse_opts.cc" +#line 2970 "src/conf/parse_opts.cc" yy720: yych = (YYCTYPE)*++YYCURSOR; if (yybm[0+yych] & 128) { goto yy720; } ++YYCURSOR; -#line 209 "../src/conf/parse_opts.re" +#line 210 "../src/conf/parse_opts.re" { - std::string name(p, static_cast(YYCURSOR - p - 1)); - globopts.incpaths.push_back(name); + globopts.incpaths.push_back(getstr(p, YYCURSOR - 1)); goto opt; } #line 2982 "src/conf/parse_opts.cc" diff --git a/re2c/src/ast/lex.re b/re2c/src/ast/lex.re index 89d7b00e..726cea49 100644 --- a/re2c/src/ast/lex.re +++ b/re2c/src/ast/lex.re @@ -198,7 +198,7 @@ loop: "/*!include:re2c" space+ @x dstring @y space* eoc { out.wraw(tok, ptr); - include(std::string(x + 1, static_cast(y - x) - 2)); + include(getstr(x + 1, y - 1)); goto next; } @@ -288,7 +288,7 @@ scan: ":=" { lex_code_indented(); return TOKEN_CODE; } ":"? "=>" space* @p name { - yylval.str = new std::string(p, static_cast(cur - p)); + yylval.str = newstr(p, cur); return tok[0] == ':' ? TOKEN_CJUMP : TOKEN_CNEXT; } @@ -305,8 +305,8 @@ scan: "[^" { yylval.regexp = lex_cls(true); return TOKEN_REGEXP; } [@#] name { - const std::string *name = new std::string(tok + 1, tok_len() - 1); - yylval.regexp = ast_tag(get_line(), get_column(), name, tok[0] == '#'); + yylval.regexp = ast_tag(get_line(), get_column() + , newstr(tok + 1, cur), tok[0] == '#'); return TOKEN_REGEXP; } @@ -348,7 +348,7 @@ scan: fatal_lc(get_line(), get_column(), "curly braces for names only allowed with -F switch"); } - yylval.str = new std::string (tok + 1, tok_len () - 2); // -2 to omit braces + yylval.str = newstr(tok + 1, cur - 1); return TOKEN_ID; } @@ -356,11 +356,11 @@ scan: name { if (!globopts->FFlag || lex_namedef_context_re2c()) { - yylval.str = new std::string (tok, tok_len()); + yylval.str = newstr(tok, cur); return TOKEN_ID; } else if (lex_namedef_context_flex()) { - yylval.str = new std::string (tok, tok_len()); + yylval.str = newstr(tok, cur); lexer_state = LEX_FLEX_NAME; return TOKEN_FID; } @@ -436,7 +436,7 @@ int Scanner::lex_clist() cond: tok = cur; /*!re2c - name { cl->insert(std::string(tok, tok_len())); goto next; } + name { cl->insert(getstr(tok, cur)); goto next; } "*" { if (!cl->empty()) goto error; cl->insert("*"); goto next; } * { goto error; } */ @@ -464,7 +464,7 @@ code: eol { while (isspace(tok[0])) ++tok; while (cur > tok && isspace(cur[-1])) --cur; - yylval.code = new Code(get_fname (), line, tok, tok_len ()); + yylval.code = new Code(get_fname (), line, getstr(tok, cur)); return; } @@ -485,7 +485,7 @@ code: /*!re2c "}" { if (--depth == 0) { - yylval.code = new Code(get_fname (), line, tok, tok_len ()); + yylval.code = new Code(get_fname (), line, getstr(tok, cur)); return; } goto code; @@ -658,7 +658,7 @@ sourceline: dstring { std::string &name = get_input().escaped_name; - name = std::string(tok + 1, tok_len () - 2); // strip quotes + name = getstr(tok + 1, cur - 1); strrreplace(name, "\\", "\\\\"); goto sourceline; } diff --git a/re2c/src/ast/lex_conf.re b/re2c/src/ast/lex_conf.re index 72d7cfb4..d3765db8 100644 --- a/re2c/src/ast/lex_conf.re +++ b/re2c/src/ast/lex_conf.re @@ -6,6 +6,7 @@ #include "src/re/encoding/enc.h" #include "src/ast/scanner.h" #include "src/util/s_to_n32_unsafe.h" +#include "src/util/string_utils.h" namespace re2c { @@ -299,7 +300,7 @@ std::string Scanner::lex_conf_string () } } naked { - s = std::string(tok, tok_len()); + s = getstr(tok, cur); goto end; } "" { goto end; } diff --git a/re2c/src/ast/scanner.h b/re2c/src/ast/scanner.h index 0f2d7aea..455b11fc 100644 --- a/re2c/src/ast/scanner.h +++ b/re2c/src/ast/scanner.h @@ -58,7 +58,6 @@ private: const Input& get_cinput() const; inline void set_line(uint32_t l); inline void next_line(); - size_t tok_len() const; void set_sourceline (); void lex_end_of_comment(Output &out); void lex_code_indented(); @@ -97,11 +96,6 @@ inline Scanner::Scanner(const conopt_t *o, Warn &w) , warn(w) {} -inline size_t Scanner::tok_len() const -{ - return static_cast(cur - tok); -} - inline const std::string & Scanner::get_fname() const { return get_cinput().escaped_name; diff --git a/re2c/src/conf/parse_opts.re b/re2c/src/conf/parse_opts.re index ff3e85fd..f1b20e7e 100644 --- a/re2c/src/conf/parse_opts.re +++ b/re2c/src/conf/parse_opts.re @@ -3,6 +3,7 @@ #include "src/conf/opt.h" #include "src/re/empty_class_policy.h" #include "src/re/encoding/enc.h" +#include "src/util/string_utils.h" namespace re2c { @@ -207,8 +208,7 @@ opt_incpath: return EXIT_FAIL; } filename end { - std::string name(p, static_cast(YYCURSOR - p - 1)); - globopts.incpaths.push_back(name); + globopts.incpaths.push_back(getstr(p, YYCURSOR - 1)); goto opt; } */ diff --git a/re2c/src/re/rule.h b/re2c/src/re/rule.h index e53f2d84..20be9218 100644 --- a/re2c/src/re/rule.h +++ b/re2c/src/re/rule.h @@ -31,11 +31,11 @@ struct Code { flist.insert(this); } - Code(const std::string &file, uint32_t line, const char *s, size_t slen) + Code(const std::string &file, uint32_t line, const std::string &t) : fname(file) , fline(line) , autogen(false) - , text(s, slen) + , text(t) , cond("") { flist.insert(this); diff --git a/re2c/src/util/string_utils.h b/re2c/src/util/string_utils.h index 53eceea6..8d8bff00 100644 --- a/re2c/src/util/string_utils.h +++ b/re2c/src/util/string_utils.h @@ -33,6 +33,18 @@ static std::string to_string(const T &v) return s.str(); } +// Yet another constructor of std::string, useful when the strings +// are constructed from fragments in buffer. A separate function is +// needed mainly to avoid static_cast's everywhere. +inline std::string getstr(const char *s, const char *e) +{ + return std::string(s, static_cast(e - s)); +} +inline std::string *newstr(const char *s, const char *e) +{ + return new std::string(s, static_cast(e - s)); +} + } // namespace re2c #endif // _RE2C_UTIL_STRING_UTILS_ -- 2.40.0