From: Ulya Trofimovich Date: Tue, 12 Feb 2019 22:53:54 +0000 (+0000) Subject: Deduplicated filename strings in locations by interning them in a table and using... X-Git-Tag: 1.2~181 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dc9bdf960f42ae73bbeccb4e1394894fbcaafe29;p=re2c Deduplicated filename strings in locations by interning them in a table and using indices. --- diff --git a/re2c/Makefile.am b/re2c/Makefile.am index 85b1c70d..96dc58ef 100644 --- a/re2c/Makefile.am +++ b/re2c/Makefile.am @@ -19,7 +19,6 @@ re2c_HDR = \ src/codegen/label.h \ src/codegen/output.h \ src/codegen/print.h \ - src/options/msg.h \ src/options/opt.h \ src/options/ver_to_vernum.h \ src/options/warn.h \ @@ -42,6 +41,7 @@ re2c_HDR = \ src/encoding/utf16/utf16_regexp.h \ src/encoding/utf16/utf16.h \ src/msg/location.h \ + src/msg/msg.h \ src/regexp/empty_class_policy.h \ src/regexp/re.h \ src/regexp/rule.h \ @@ -87,7 +87,6 @@ re2c_SRC = \ src/codegen/input_api.cc \ src/codegen/output.cc \ src/codegen/print.cc \ - src/options/msg.cc \ src/options/opt.cc \ src/options/warn.cc \ src/nfa/estimate_size.cc \ @@ -128,6 +127,7 @@ re2c_SRC = \ src/encoding/utf8/utf8.cc \ src/encoding/utf16/utf16_regexp.cc \ src/encoding/utf16/utf16.cc \ + src/msg/msg.cc \ src/regexp/ast_to_re.cc \ src/regexp/default_tags.cc \ src/regexp/fixed_tags.cc \ diff --git a/re2c/Makefile.lib.am b/re2c/Makefile.lib.am index c3eac9f5..3d0da840 100644 --- a/re2c/Makefile.lib.am +++ b/re2c/Makefile.lib.am @@ -16,7 +16,6 @@ libre2c_la_HDR = \ src/codegen/label.h \ src/codegen/output.h \ src/codegen/print.h \ - src/options/msg.h \ src/options/opt.h \ src/options/ver_to_vernum.h \ src/options/warn.h \ @@ -39,6 +38,7 @@ libre2c_la_HDR = \ src/encoding/utf16/utf16_regexp.h \ src/encoding/utf16/utf16.h \ src/msg/location.h \ + src/msg/msg.h \ src/regexp/empty_class_policy.h \ src/regexp/re.h \ src/regexp/rule.h \ @@ -81,7 +81,6 @@ libre2c_la_SRC = \ lib/regfree.cc \ lib/stubs.cc \ src/parse/ast.cc \ - src/options/msg.cc \ src/options/opt.cc \ src/options/warn.cc \ src/cfg/cfg.cc \ @@ -120,6 +119,7 @@ libre2c_la_SRC = \ src/encoding/utf16/utf16_regexp.cc \ src/encoding/utf8/utf8.cc \ src/encoding/utf8/utf8_regexp.cc \ + src/msg/msg.cc \ src/regexp/ast_to_re.cc \ src/regexp/default_tags.cc \ src/regexp/fixed_tags.cc \ diff --git a/re2c/bootstrap/lib/lex.cc b/re2c/bootstrap/lib/lex.cc index de650ccd..b0ec2bf6 100644 --- a/re2c/bootstrap/lib/lex.cc +++ b/re2c/bootstrap/lib/lex.cc @@ -1,4 +1,4 @@ -/* Generated by re2c 1.1.1 on Tue Feb 12 16:51:04 2019 */ +/* Generated by re2c 1.1.1 on Tue Feb 12 22:51:09 2019 */ #line 1 "../lib/lex.re" #include @@ -6,7 +6,6 @@ #include "src/encoding/enc.h" #include "src/parse/ast.h" -#include "src/options/msg.h" #include "src/util/range.h" #include "src/util/s_to_n32_unsafe.h" #include "parse.h" @@ -19,7 +18,7 @@ namespace re2c { static int32_t lex_cls_chr(const char *&, uint32_t &); -#line 29 "../lib/lex.re" +#line 28 "../lib/lex.re" int lex(const char *&cur) @@ -29,10 +28,9 @@ int lex(const char *&cur) std::vector cls; bool neg = false; uint32_t l, u; - const loc_t nowhere(0, 0, "void"); -#line 36 "lib/lex.cc" +#line 34 "lib/lex.cc" { char yych; static const unsigned char yybm[] = { @@ -98,48 +96,48 @@ int lex(const char *&cur) } yy2: ++cur; -#line 43 "../lib/lex.re" +#line 41 "../lib/lex.re" { return 0; } -#line 104 "lib/lex.cc" +#line 102 "lib/lex.cc" yy4: ++cur; yy5: -#line 78 "../lib/lex.re" +#line 76 "../lib/lex.re" { - ASTChar c(static_cast(cur[-1]), nowhere); + ASTChar c = {static_cast(cur[-1]), NOWHERE}; std::vector *str = new std::vector; str->push_back(c); - yylval.regexp = ast_str(nowhere, str, false); + yylval.regexp = ast_str(NOWHERE, str, false); return REGEXP; } -#line 116 "lib/lex.cc" +#line 114 "lib/lex.cc" yy6: ++cur; -#line 47 "../lib/lex.re" +#line 45 "../lib/lex.re" { error("anchors are not supported"); return ERROR; } -#line 124 "lib/lex.cc" +#line 122 "lib/lex.cc" yy8: ++cur; -#line 45 "../lib/lex.re" +#line 43 "../lib/lex.re" { return cur[-1]; } -#line 129 "lib/lex.cc" +#line 127 "lib/lex.cc" yy10: ++cur; -#line 73 "../lib/lex.re" +#line 71 "../lib/lex.re" { - yylval.regexp = ast_dot(nowhere); + yylval.regexp = ast_dot(NOWHERE); return REGEXP; } -#line 137 "lib/lex.cc" +#line 135 "lib/lex.cc" yy12: yych = *++cur; if (yych == '^') goto yy15; -#line 53 "../lib/lex.re" +#line 51 "../lib/lex.re" { goto cls; } -#line 143 "lib/lex.cc" +#line 141 "lib/lex.cc" yy14: yych = *(mar = ++cur); if (yych <= '/') goto yy5; @@ -150,9 +148,9 @@ yy14: goto yy5; yy15: ++cur; -#line 52 "../lib/lex.re" +#line 50 "../lib/lex.re" { neg = true; goto cls; } -#line 156 "lib/lex.cc" +#line 154 "lib/lex.cc" yy17: yych = *++cur; if (yybm[0+yych] & 128) { @@ -175,13 +173,13 @@ yy20: yy21: ++cur; x = yyt1; -#line 55 "../lib/lex.re" +#line 53 "../lib/lex.re" { if (!s_to_u32_unsafe(x, cur - 1, yylval.bounds.min)) goto err_cnt; yylval.bounds.max = yylval.bounds.min; return COUNT; } -#line 185 "lib/lex.cc" +#line 183 "lib/lex.cc" yy23: yych = *++cur; if (yych <= '/') goto yy19; @@ -191,40 +189,40 @@ yy23: yy25: ++cur; x = yyt1; -#line 67 "../lib/lex.re" +#line 65 "../lib/lex.re" { if (!s_to_u32_unsafe(x, cur - 2, yylval.bounds.min)) goto err_cnt; yylval.bounds.max = AST::MANY; return COUNT; } -#line 201 "lib/lex.cc" +#line 199 "lib/lex.cc" yy27: ++cur; x = yyt1; y = yyt2; -#line 61 "../lib/lex.re" +#line 59 "../lib/lex.re" { if (!s_to_u32_unsafe(x, y - 1, yylval.bounds.min) || !s_to_u32_unsafe(y, cur - 1, yylval.bounds.max)) goto err_cnt; return COUNT; } -#line 212 "lib/lex.cc" +#line 210 "lib/lex.cc" } -#line 85 "../lib/lex.re" +#line 83 "../lib/lex.re" cls: if (lex_cls_chr(cur, l) != 0) goto err; -#line 220 "lib/lex.cc" +#line 218 "lib/lex.cc" { char yych; yych = *(mar = cur); if (yych == '-') goto yy32; yy31: -#line 90 "../lib/lex.re" +#line 88 "../lib/lex.re" { u = l; goto add; } -#line 228 "lib/lex.cc" +#line 226 "lib/lex.cc" yy32: yych = *++cur; if (yych != ']') goto yy34; @@ -233,36 +231,36 @@ yy32: yy34: ++cur; cur -= 1; -#line 91 "../lib/lex.re" +#line 89 "../lib/lex.re" { if (lex_cls_chr(cur, u) != 0) goto err; goto add; } -#line 239 "lib/lex.cc" +#line 237 "lib/lex.cc" } -#line 92 "../lib/lex.re" +#line 90 "../lib/lex.re" add: if (l > u) goto err; - cls.push_back(ASTRange(l, u, nowhere)); + cls.push_back(ASTRange(l, u, NOWHERE)); -#line 247 "lib/lex.cc" +#line 245 "lib/lex.cc" { char yych; yych = *cur; if (yych == ']') goto yy39; -#line 97 "../lib/lex.re" +#line 95 "../lib/lex.re" { goto cls; } -#line 254 "lib/lex.cc" +#line 252 "lib/lex.cc" yy39: ++cur; -#line 98 "../lib/lex.re" +#line 96 "../lib/lex.re" { std::vector *p = new std::vector; p->swap(cls); - yylval.regexp = ast_cls(nowhere, p, neg); + yylval.regexp = ast_cls(NOWHERE, p, neg); return REGEXP; } -#line 264 "lib/lex.cc" +#line 262 "lib/lex.cc" } -#line 104 "../lib/lex.re" +#line 102 "../lib/lex.re" err: @@ -277,7 +275,7 @@ err_cnt: int32_t lex_cls_chr(const char *&cur, uint32_t &c) { -#line 281 "lib/lex.cc" +#line 279 "lib/lex.cc" { char yych; yych = *cur; @@ -286,15 +284,15 @@ int32_t lex_cls_chr(const char *&cur, uint32_t &c) goto yy45; yy43: ++cur; -#line 118 "../lib/lex.re" +#line 116 "../lib/lex.re" { return 1; } -#line 292 "lib/lex.cc" +#line 290 "lib/lex.cc" yy45: ++cur; yy46: -#line 123 "../lib/lex.re" +#line 121 "../lib/lex.re" { c = static_cast(cur[-1]); return 0; } -#line 298 "lib/lex.cc" +#line 296 "lib/lex.cc" yy47: yych = *++cur; if (yych <= '9') { @@ -305,21 +303,21 @@ yy47: goto yy46; } ++cur; -#line 119 "../lib/lex.re" +#line 117 "../lib/lex.re" { error("collating characters not supported"); return 1; } -#line 311 "lib/lex.cc" +#line 309 "lib/lex.cc" yy50: ++cur; -#line 120 "../lib/lex.re" +#line 118 "../lib/lex.re" { error("character classes not supported"); return 1; } -#line 316 "lib/lex.cc" +#line 314 "lib/lex.cc" yy52: ++cur; -#line 121 "../lib/lex.re" +#line 119 "../lib/lex.re" { error("equivalence classes not supported"); return 1; } -#line 321 "lib/lex.cc" +#line 319 "lib/lex.cc" } -#line 124 "../lib/lex.re" +#line 122 "../lib/lex.re" } diff --git a/re2c/bootstrap/lib/parse.cc b/re2c/bootstrap/lib/parse.cc index 7195bab3..e31732ae 100644 --- a/re2c/bootstrap/lib/parse.cc +++ b/re2c/bootstrap/lib/parse.cc @@ -1268,7 +1268,7 @@ yyreduce: case 13: #line 61 "../lib/parse.ypp" /* yacc.c:1646 */ - { (yyval.regexp) = ast_cap(ast_nil(loc_t(0, 0, "void"))); } + { (yyval.regexp) = ast_cap(ast_nil(NOWHERE)); } #line 1273 "lib/parse.cc" /* yacc.c:1646 */ break; diff --git a/re2c/bootstrap/src/options/parse_opts.cc b/re2c/bootstrap/src/options/parse_opts.cc index 2076aec3..d28f4354 100644 --- a/re2c/bootstrap/src/options/parse_opts.cc +++ b/re2c/bootstrap/src/options/parse_opts.cc @@ -1,7 +1,6 @@ -/* Generated by re2c 1.1.1 on Tue Feb 5 11:51:11 2019 */ +/* Generated by re2c 1.1.1 on Tue Feb 12 22:50:47 2019 */ #line 1 "../src/options/parse_opts.re" #include "src/codegen/input_api.h" -#include "src/options/msg.h" #include "src/options/opt.h" #include "src/regexp/empty_class_policy.h" #include "src/encoding/enc.h" @@ -16,7 +15,7 @@ static inline bool next (char * & arg, char ** & argv) return arg != NULL; } -parse_opts_t parse_opts(char **argv, conopt_t &globopts, Opt &opts, Warn &warn) +parse_opts_t parse_opts(char **argv, conopt_t &globopts, Opt &opts, Msg &msg) { #define YYCTYPE unsigned char @@ -32,13 +31,13 @@ parse_opts_t parse_opts(char **argv, conopt_t &globopts, Opt &opts, Warn &warn) char *YYCURSOR, *YYMARKER; Warn::option_t option; -#line 39 "../src/options/parse_opts.re" +#line 38 "../src/options/parse_opts.re" opt: if (!next (YYCURSOR, argv)) goto end; -#line 42 "src/options/parse_opts.cc" +#line 41 "src/options/parse_opts.cc" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -82,9 +81,9 @@ opt: goto yy4; yy2: ++YYCURSOR; -#line 44 "../src/options/parse_opts.re" +#line 43 "../src/options/parse_opts.re" { ERROR("bad option: %s", *argv); } -#line 88 "src/options/parse_opts.cc" +#line 87 "src/options/parse_opts.cc" yy4: yych = (YYCTYPE)*++YYCURSOR; if (yybm[0+yych] & 128) { @@ -99,25 +98,25 @@ yy6: } else { if (yych == 'W') goto yy14; } -#line 58 "../src/options/parse_opts.re" +#line 57 "../src/options/parse_opts.re" { goto opt_short; } -#line 105 "src/options/parse_opts.cc" +#line 104 "src/options/parse_opts.cc" yy8: ++YYCURSOR; -#line 56 "../src/options/parse_opts.re" +#line 55 "../src/options/parse_opts.re" { if (!opts.source (*argv)) return EXIT_FAIL; goto opt; } -#line 110 "src/options/parse_opts.cc" +#line 109 "src/options/parse_opts.cc" yy10: ++YYCURSOR; -#line 55 "../src/options/parse_opts.re" +#line 54 "../src/options/parse_opts.re" { if (!opts.source ("")) return EXIT_FAIL; goto opt; } -#line 115 "src/options/parse_opts.cc" +#line 114 "src/options/parse_opts.cc" yy12: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x00) goto yy16; -#line 59 "../src/options/parse_opts.re" +#line 58 "../src/options/parse_opts.re" { goto opt_long; } -#line 121 "src/options/parse_opts.cc" +#line 120 "src/options/parse_opts.cc" yy14: yyaccept = 0; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -128,12 +127,12 @@ yy14: if (yych == 'n') goto yy22; } yy15: -#line 63 "../src/options/parse_opts.re" +#line 62 "../src/options/parse_opts.re" { option = Warn::W; goto opt_warn; } -#line 134 "src/options/parse_opts.cc" +#line 133 "src/options/parse_opts.cc" yy16: ++YYCURSOR; -#line 46 "../src/options/parse_opts.re" +#line 45 "../src/options/parse_opts.re" { // remaining args are non-options, so they must be input files // re2c expects exactly one input file @@ -142,12 +141,12 @@ yy16: } goto end; } -#line 146 "src/options/parse_opts.cc" +#line 145 "src/options/parse_opts.cc" yy18: ++YYCURSOR; -#line 61 "../src/options/parse_opts.re" - { warn.set_all (); goto opt; } -#line 151 "src/options/parse_opts.cc" +#line 60 "../src/options/parse_opts.re" + { msg.warn.set_all (); goto opt; } +#line 150 "src/options/parse_opts.cc" yy20: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy23; @@ -179,9 +178,9 @@ yy26: yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych == 'e') goto yy29; yy27: -#line 64 "../src/options/parse_opts.re" +#line 63 "../src/options/parse_opts.re" { option = Warn::WNO; goto opt_warn; } -#line 185 "src/options/parse_opts.cc" +#line 184 "src/options/parse_opts.cc" yy28: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy30; @@ -201,14 +200,14 @@ yy31: goto yy21; yy32: ++YYCURSOR; -#line 62 "../src/options/parse_opts.re" - { warn.set_all_error (); goto opt; } -#line 207 "src/options/parse_opts.cc" +#line 61 "../src/options/parse_opts.re" + { msg.warn.set_all_error (); goto opt; } +#line 206 "src/options/parse_opts.cc" yy34: ++YYCURSOR; -#line 65 "../src/options/parse_opts.re" +#line 64 "../src/options/parse_opts.re" { option = Warn::WERROR; goto opt_warn; } -#line 212 "src/options/parse_opts.cc" +#line 211 "src/options/parse_opts.cc" yy36: yych = (YYCTYPE)*++YYCURSOR; if (yych != 'o') goto yy21; @@ -217,16 +216,16 @@ yy36: yych = (YYCTYPE)*++YYCURSOR; if (yych != '-') goto yy21; ++YYCURSOR; -#line 66 "../src/options/parse_opts.re" +#line 65 "../src/options/parse_opts.re" { option = Warn::WNOERROR; goto opt_warn; } -#line 223 "src/options/parse_opts.cc" +#line 222 "src/options/parse_opts.cc" } -#line 67 "../src/options/parse_opts.re" +#line 66 "../src/options/parse_opts.re" opt_warn: -#line 230 "src/options/parse_opts.cc" +#line 229 "src/options/parse_opts.cc" { YYCTYPE yych; yych = (YYCTYPE)*YYCURSOR; @@ -242,9 +241,9 @@ opt_warn: yy43: ++YYCURSOR; yy44: -#line 71 "../src/options/parse_opts.re" +#line 70 "../src/options/parse_opts.re" { ERROR("bad warning: %s", *argv); } -#line 248 "src/options/parse_opts.cc" +#line 247 "src/options/parse_opts.cc" yy45: yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych == 'o') goto yy51; @@ -671,9 +670,9 @@ yy150: goto yy52; yy151: ++YYCURSOR; -#line 77 "../src/options/parse_opts.re" - { warn.set (Warn::SWAPPED_RANGE, option); goto opt; } -#line 677 "src/options/parse_opts.cc" +#line 76 "../src/options/parse_opts.re" + { msg.warn.set (Warn::SWAPPED_RANGE, option); goto opt; } +#line 676 "src/options/parse_opts.cc" yy153: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy160; @@ -712,14 +711,14 @@ yy161: goto yy52; yy162: ++YYCURSOR; -#line 80 "../src/options/parse_opts.re" - { warn.set (Warn::USELESS_ESCAPE, option); goto opt; } -#line 718 "src/options/parse_opts.cc" +#line 79 "../src/options/parse_opts.re" + { msg.warn.set (Warn::USELESS_ESCAPE, option); goto opt; } +#line 717 "src/options/parse_opts.cc" yy164: ++YYCURSOR; -#line 73 "../src/options/parse_opts.re" - { warn.set (Warn::CONDITION_ORDER, option); goto opt; } -#line 723 "src/options/parse_opts.cc" +#line 72 "../src/options/parse_opts.re" + { msg.warn.set (Warn::CONDITION_ORDER, option); goto opt; } +#line 722 "src/options/parse_opts.cc" yy166: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'c') goto yy171; @@ -778,18 +777,18 @@ yy179: goto yy52; yy180: ++YYCURSOR; -#line 79 "../src/options/parse_opts.re" - { warn.set (Warn::UNREACHABLE_RULES, option); goto opt; } -#line 784 "src/options/parse_opts.cc" +#line 78 "../src/options/parse_opts.re" + { msg.warn.set (Warn::UNREACHABLE_RULES, option); goto opt; } +#line 783 "src/options/parse_opts.cc" yy182: yych = (YYCTYPE)*++YYCURSOR; if (yych == 's') goto yy187; goto yy52; yy183: ++YYCURSOR; -#line 75 "../src/options/parse_opts.re" - { warn.set (Warn::MATCH_EMPTY_STRING, option); goto opt; } -#line 793 "src/options/parse_opts.cc" +#line 74 "../src/options/parse_opts.re" + { msg.warn.set (Warn::MATCH_EMPTY_STRING, option); goto opt; } +#line 792 "src/options/parse_opts.cc" yy185: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'g') goto yy188; @@ -824,28 +823,28 @@ yy192: goto yy52; yy193: ++YYCURSOR; -#line 74 "../src/options/parse_opts.re" - { warn.set (Warn::EMPTY_CHARACTER_CLASS, option); goto opt; } -#line 830 "src/options/parse_opts.cc" +#line 73 "../src/options/parse_opts.re" + { msg.warn.set (Warn::EMPTY_CHARACTER_CLASS, option); goto opt; } +#line 829 "src/options/parse_opts.cc" yy195: ++YYCURSOR; -#line 76 "../src/options/parse_opts.re" - { warn.set (Warn::NONDETERMINISTIC_TAGS, option); goto opt; } -#line 835 "src/options/parse_opts.cc" +#line 75 "../src/options/parse_opts.re" + { msg.warn.set (Warn::NONDETERMINISTIC_TAGS, option); goto opt; } +#line 834 "src/options/parse_opts.cc" yy197: yych = (YYCTYPE)*++YYCURSOR; if (yych >= 0x01) goto yy52; ++YYCURSOR; -#line 78 "../src/options/parse_opts.re" - { warn.set (Warn::UNDEFINED_CONTROL_FLOW, option); goto opt; } -#line 842 "src/options/parse_opts.cc" +#line 77 "../src/options/parse_opts.re" + { msg.warn.set (Warn::UNDEFINED_CONTROL_FLOW, option); goto opt; } +#line 841 "src/options/parse_opts.cc" } -#line 81 "../src/options/parse_opts.re" +#line 80 "../src/options/parse_opts.re" opt_short: -#line 849 "src/options/parse_opts.cc" +#line 848 "src/options/parse_opts.cc" { YYCTYPE yych; yych = (YYCTYPE)*YYCURSOR; @@ -933,168 +932,168 @@ opt_short: } } ++YYCURSOR; -#line 87 "../src/options/parse_opts.re" +#line 86 "../src/options/parse_opts.re" { goto opt; } -#line 939 "src/options/parse_opts.cc" +#line 938 "src/options/parse_opts.cc" yy204: ++YYCURSOR; -#line 85 "../src/options/parse_opts.re" +#line 84 "../src/options/parse_opts.re" { ERROR("bad short option: %s", *argv); } -#line 944 "src/options/parse_opts.cc" +#line 943 "src/options/parse_opts.cc" yy206: ++YYCURSOR; -#line 126 "../src/options/parse_opts.re" +#line 125 "../src/options/parse_opts.re" { goto opt_short; } -#line 949 "src/options/parse_opts.cc" +#line 948 "src/options/parse_opts.cc" yy208: ++YYCURSOR; -#line 109 "../src/options/parse_opts.re" +#line 108 "../src/options/parse_opts.re" { opts.set_encoding(Enc::UTF8); goto opt_short; } -#line 954 "src/options/parse_opts.cc" +#line 953 "src/options/parse_opts.cc" yy210: ++YYCURSOR; -#line 88 "../src/options/parse_opts.re" +#line 87 "../src/options/parse_opts.re" { usage (); return EXIT_OK; } -#line 959 "src/options/parse_opts.cc" +#line 958 "src/options/parse_opts.cc" yy212: ++YYCURSOR; -#line 93 "../src/options/parse_opts.re" +#line 92 "../src/options/parse_opts.re" { globopts.target = TARGET_DOT; goto opt_short; } -#line 964 "src/options/parse_opts.cc" +#line 963 "src/options/parse_opts.cc" yy214: ++YYCURSOR; -#line 95 "../src/options/parse_opts.re" +#line 94 "../src/options/parse_opts.re" { globopts.FFlag = true; goto opt_short; } -#line 969 "src/options/parse_opts.cc" +#line 968 "src/options/parse_opts.cc" yy216: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x00) goto yy256; -#line 118 "../src/options/parse_opts.re" +#line 117 "../src/options/parse_opts.re" { *argv = YYCURSOR; goto opt_incpath; } -#line 975 "src/options/parse_opts.cc" +#line 974 "src/options/parse_opts.cc" yy218: ++YYCURSOR; -#line 111 "../src/options/parse_opts.re" +#line 110 "../src/options/parse_opts.re" { opts.set_posix_syntax(true); opts.set_posix_semantics(true); goto opt_short; } -#line 984 "src/options/parse_opts.cc" +#line 983 "src/options/parse_opts.cc" yy220: ++YYCURSOR; -#line 97 "../src/options/parse_opts.re" +#line 96 "../src/options/parse_opts.re" { globopts.target = TARGET_SKELETON; goto opt_short; } -#line 989 "src/options/parse_opts.cc" +#line 988 "src/options/parse_opts.cc" yy222: ++YYCURSOR; -#line 104 "../src/options/parse_opts.re" +#line 103 "../src/options/parse_opts.re" { opts.set_tags(true); goto opt_short; } -#line 994 "src/options/parse_opts.cc" +#line 993 "src/options/parse_opts.cc" yy224: ++YYCURSOR; -#line 90 "../src/options/parse_opts.re" +#line 89 "../src/options/parse_opts.re" { vernum (); return EXIT_OK; } -#line 999 "src/options/parse_opts.cc" +#line 998 "src/options/parse_opts.cc" yy226: ++YYCURSOR; -#line 99 "../src/options/parse_opts.re" +#line 98 "../src/options/parse_opts.re" { opts.set_bFlag(true); goto opt_short; } -#line 1004 "src/options/parse_opts.cc" +#line 1003 "src/options/parse_opts.cc" yy228: ++YYCURSOR; -#line 92 "../src/options/parse_opts.re" +#line 91 "../src/options/parse_opts.re" { globopts.cFlag = true; goto opt_short; } -#line 1009 "src/options/parse_opts.cc" +#line 1008 "src/options/parse_opts.cc" yy230: ++YYCURSOR; -#line 100 "../src/options/parse_opts.re" +#line 99 "../src/options/parse_opts.re" { opts.set_dFlag(true); goto opt_short; } -#line 1014 "src/options/parse_opts.cc" +#line 1013 "src/options/parse_opts.cc" yy232: ++YYCURSOR; -#line 105 "../src/options/parse_opts.re" +#line 104 "../src/options/parse_opts.re" { opts.set_encoding(Enc::EBCDIC); goto opt_short; } -#line 1019 "src/options/parse_opts.cc" +#line 1018 "src/options/parse_opts.cc" yy234: ++YYCURSOR; -#line 94 "../src/options/parse_opts.re" +#line 93 "../src/options/parse_opts.re" { globopts.fFlag = true; goto opt_short; } -#line 1024 "src/options/parse_opts.cc" +#line 1023 "src/options/parse_opts.cc" yy236: ++YYCURSOR; -#line 101 "../src/options/parse_opts.re" +#line 100 "../src/options/parse_opts.re" { opts.set_gFlag(true); goto opt_short; } -#line 1029 "src/options/parse_opts.cc" +#line 1028 "src/options/parse_opts.cc" yy238: ++YYCURSOR; -#line 102 "../src/options/parse_opts.re" +#line 101 "../src/options/parse_opts.re" { opts.set_iFlag(true); goto opt_short; } -#line 1034 "src/options/parse_opts.cc" +#line 1033 "src/options/parse_opts.cc" yy240: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x00) goto yy258; -#line 121 "../src/options/parse_opts.re" +#line 120 "../src/options/parse_opts.re" { *argv = YYCURSOR; goto opt_output; } -#line 1040 "src/options/parse_opts.cc" +#line 1039 "src/options/parse_opts.cc" yy242: ++YYCURSOR; -#line 96 "../src/options/parse_opts.re" +#line 95 "../src/options/parse_opts.re" { globopts.rFlag = true; goto opt_short; } -#line 1045 "src/options/parse_opts.cc" +#line 1044 "src/options/parse_opts.cc" yy244: ++YYCURSOR; -#line 103 "../src/options/parse_opts.re" +#line 102 "../src/options/parse_opts.re" { opts.set_sFlag(true); goto opt_short; } -#line 1050 "src/options/parse_opts.cc" +#line 1049 "src/options/parse_opts.cc" yy246: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x00) goto yy260; -#line 124 "../src/options/parse_opts.re" +#line 123 "../src/options/parse_opts.re" { *argv = YYCURSOR; goto opt_header; } -#line 1056 "src/options/parse_opts.cc" +#line 1055 "src/options/parse_opts.cc" yy248: ++YYCURSOR; -#line 106 "../src/options/parse_opts.re" +#line 105 "../src/options/parse_opts.re" { opts.set_encoding(Enc::UTF32); goto opt_short; } -#line 1061 "src/options/parse_opts.cc" +#line 1060 "src/options/parse_opts.cc" yy250: ++YYCURSOR; -#line 89 "../src/options/parse_opts.re" +#line 88 "../src/options/parse_opts.re" { version (); return EXIT_OK; } -#line 1066 "src/options/parse_opts.cc" +#line 1065 "src/options/parse_opts.cc" yy252: ++YYCURSOR; -#line 107 "../src/options/parse_opts.re" +#line 106 "../src/options/parse_opts.re" { opts.set_encoding(Enc::UCS2); goto opt_short; } -#line 1071 "src/options/parse_opts.cc" +#line 1070 "src/options/parse_opts.cc" yy254: ++YYCURSOR; -#line 108 "../src/options/parse_opts.re" +#line 107 "../src/options/parse_opts.re" { opts.set_encoding(Enc::UTF16); goto opt_short; } -#line 1076 "src/options/parse_opts.cc" +#line 1075 "src/options/parse_opts.cc" yy256: ++YYCURSOR; -#line 117 "../src/options/parse_opts.re" +#line 116 "../src/options/parse_opts.re" { NEXT_ARG("-I", opt_incpath); } -#line 1081 "src/options/parse_opts.cc" +#line 1080 "src/options/parse_opts.cc" yy258: ++YYCURSOR; -#line 120 "../src/options/parse_opts.re" +#line 119 "../src/options/parse_opts.re" { NEXT_ARG("-o, --output", opt_output); } -#line 1086 "src/options/parse_opts.cc" +#line 1085 "src/options/parse_opts.cc" yy260: ++YYCURSOR; -#line 123 "../src/options/parse_opts.re" +#line 122 "../src/options/parse_opts.re" { NEXT_ARG("-t, --type-header", opt_header); } -#line 1091 "src/options/parse_opts.cc" +#line 1090 "src/options/parse_opts.cc" } -#line 127 "../src/options/parse_opts.re" +#line 126 "../src/options/parse_opts.re" opt_long: -#line 1098 "src/options/parse_opts.cc" +#line 1097 "src/options/parse_opts.cc" { YYCTYPE yych; yych = (YYCTYPE)*YYCURSOR; @@ -1120,9 +1119,9 @@ opt_long: yy264: ++YYCURSOR; yy265: -#line 131 "../src/options/parse_opts.re" +#line 130 "../src/options/parse_opts.re" { ERROR("bad long option: %s", *argv); } -#line 1126 "src/options/parse_opts.cc" +#line 1125 "src/options/parse_opts.cc" yy266: yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych == 'i') goto yy282; @@ -1486,9 +1485,9 @@ yy347: goto yy283; yy348: ++YYCURSOR; -#line 154 "../src/options/parse_opts.re" +#line 153 "../src/options/parse_opts.re" { opts.set_encoding(Enc::EBCDIC); goto opt; } -#line 1492 "src/options/parse_opts.cc" +#line 1491 "src/options/parse_opts.cc" yy350: yych = (YYCTYPE)*++YYCURSOR; if (yych == '-') goto yy384; @@ -1650,9 +1649,9 @@ yy387: goto yy283; yy388: ++YYCURSOR; -#line 133 "../src/options/parse_opts.re" +#line 132 "../src/options/parse_opts.re" { usage (); return EXIT_OK; } -#line 1656 "src/options/parse_opts.cc" +#line 1655 "src/options/parse_opts.cc" yy390: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x00) goto yy429; @@ -1711,9 +1710,9 @@ yy403: goto yy283; yy404: ++YYCURSOR; -#line 153 "../src/options/parse_opts.re" +#line 152 "../src/options/parse_opts.re" { opts.set_tags (true); goto opt; } -#line 1717 "src/options/parse_opts.cc" +#line 1716 "src/options/parse_opts.cc" yy406: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'h') goto yy444; @@ -1809,9 +1808,9 @@ yy428: goto yy283; yy429: ++YYCURSOR; -#line 169 "../src/options/parse_opts.re" +#line 168 "../src/options/parse_opts.re" { NEXT_ARG("--input", opt_input); } -#line 1815 "src/options/parse_opts.cc" +#line 1814 "src/options/parse_opts.cc" yy431: yych = (YYCTYPE)*++YYCURSOR; if (yych == '-') goto yy469; @@ -1878,9 +1877,9 @@ yy446: goto yy283; yy447: ++YYCURSOR; -#line 158 "../src/options/parse_opts.re" +#line 157 "../src/options/parse_opts.re" { opts.set_encoding(Enc::UTF8); goto opt; } -#line 1884 "src/options/parse_opts.cc" +#line 1883 "src/options/parse_opts.cc" yy449: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x00) goto yy487; @@ -1988,9 +1987,9 @@ yy474: goto yy283; yy475: ++YYCURSOR; -#line 166 "../src/options/parse_opts.re" +#line 165 "../src/options/parse_opts.re" { NEXT_ARG("-o, --output", opt_output); } -#line 1994 "src/options/parse_opts.cc" +#line 1993 "src/options/parse_opts.cc" yy477: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'a') goto yy515; @@ -2026,14 +2025,14 @@ yy484: goto yy283; yy485: ++YYCURSOR; -#line 157 "../src/options/parse_opts.re" +#line 156 "../src/options/parse_opts.re" { opts.set_encoding(Enc::UTF16); goto opt; } -#line 2032 "src/options/parse_opts.cc" +#line 2031 "src/options/parse_opts.cc" yy487: ++YYCURSOR; -#line 135 "../src/options/parse_opts.re" +#line 134 "../src/options/parse_opts.re" { vernum (); return EXIT_OK; } -#line 2037 "src/options/parse_opts.cc" +#line 2036 "src/options/parse_opts.cc" yy489: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x00) goto yy525; @@ -2172,14 +2171,14 @@ yy522: goto yy283; yy523: ++YYCURSOR; -#line 155 "../src/options/parse_opts.re" +#line 154 "../src/options/parse_opts.re" { opts.set_encoding(Enc::UTF32); goto opt; } -#line 2178 "src/options/parse_opts.cc" +#line 2177 "src/options/parse_opts.cc" yy525: ++YYCURSOR; -#line 134 "../src/options/parse_opts.re" +#line 133 "../src/options/parse_opts.re" { version (); return EXIT_OK; } -#line 2183 "src/options/parse_opts.cc" +#line 2182 "src/options/parse_opts.cc" yy527: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy564; @@ -2218,9 +2217,9 @@ yy535: goto yy283; yy536: ++YYCURSOR; -#line 188 "../src/options/parse_opts.re" +#line 187 "../src/options/parse_opts.re" { globopts.dump_cfg = true; goto opt; } -#line 2224 "src/options/parse_opts.cc" +#line 2223 "src/options/parse_opts.cc" yy538: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'u') goto yy574; @@ -2240,18 +2239,18 @@ yy540: goto yy283; yy541: ++YYCURSOR; -#line 182 "../src/options/parse_opts.re" +#line 181 "../src/options/parse_opts.re" { globopts.dump_nfa = true; goto opt; } -#line 2246 "src/options/parse_opts.cc" +#line 2245 "src/options/parse_opts.cc" yy543: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'p') goto yy580; goto yy283; yy544: ++YYCURSOR; -#line 138 "../src/options/parse_opts.re" +#line 137 "../src/options/parse_opts.re" { globopts.target = TARGET_DOT; goto opt; } -#line 2255 "src/options/parse_opts.cc" +#line 2254 "src/options/parse_opts.cc" yy546: yych = (YYCTYPE)*++YYCURSOR; if (yych == 's') goto yy581; @@ -2298,18 +2297,18 @@ yy556: goto yy283; yy557: ++YYCURSOR; -#line 141 "../src/options/parse_opts.re" +#line 140 "../src/options/parse_opts.re" { globopts.rFlag = true; goto opt; } -#line 2304 "src/options/parse_opts.cc" +#line 2303 "src/options/parse_opts.cc" yy559: yych = (YYCTYPE)*++YYCURSOR; if (yych == 's') goto yy592; goto yy283; yy560: ++YYCURSOR; -#line 144 "../src/options/parse_opts.re" +#line 143 "../src/options/parse_opts.re" { globopts.target = TARGET_SKELETON; goto opt; } -#line 2313 "src/options/parse_opts.cc" +#line 2312 "src/options/parse_opts.cc" yy562: yych = (YYCTYPE)*++YYCURSOR; if (yych == 's') goto yy593; @@ -2352,9 +2351,9 @@ yy571: goto yy283; yy572: ++YYCURSOR; -#line 187 "../src/options/parse_opts.re" +#line 186 "../src/options/parse_opts.re" { globopts.dump_adfa = true; goto opt; } -#line 2358 "src/options/parse_opts.cc" +#line 2357 "src/options/parse_opts.cc" yy574: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy604; @@ -2461,9 +2460,9 @@ yy599: goto yy283; yy600: ++YYCURSOR; -#line 137 "../src/options/parse_opts.re" +#line 136 "../src/options/parse_opts.re" { globopts.cFlag = true; goto opt; } -#line 2467 "src/options/parse_opts.cc" +#line 2466 "src/options/parse_opts.cc" yy602: yych = (YYCTYPE)*++YYCURSOR; if (yych == 't') goto yy635; @@ -2498,9 +2497,9 @@ yy609: goto yy283; yy610: ++YYCURSOR; -#line 179 "../src/options/parse_opts.re" +#line 178 "../src/options/parse_opts.re" { globopts.eager_skip = true; goto opt; } -#line 2504 "src/options/parse_opts.cc" +#line 2503 "src/options/parse_opts.cc" yy612: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x00) goto yy644; @@ -2515,9 +2514,9 @@ yy614: goto yy283; yy615: ++YYCURSOR; -#line 150 "../src/options/parse_opts.re" +#line 149 "../src/options/parse_opts.re" { opts.set_sFlag (true); goto opt; } -#line 2521 "src/options/parse_opts.cc" +#line 2520 "src/options/parse_opts.cc" yy617: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'f') goto yy649; @@ -2536,9 +2535,9 @@ yy620: goto yy283; yy621: ++YYCURSOR; -#line 143 "../src/options/parse_opts.re" +#line 142 "../src/options/parse_opts.re" { globopts.version = false; goto opt; } -#line 2542 "src/options/parse_opts.cc" +#line 2541 "src/options/parse_opts.cc" yy623: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy653; @@ -2561,14 +2560,14 @@ yy627: goto yy283; yy628: ++YYCURSOR; -#line 156 "../src/options/parse_opts.re" +#line 155 "../src/options/parse_opts.re" { opts.set_encoding(Enc::UCS2); goto opt; } -#line 2567 "src/options/parse_opts.cc" +#line 2566 "src/options/parse_opts.cc" yy630: ++YYCURSOR; -#line 146 "../src/options/parse_opts.re" +#line 145 "../src/options/parse_opts.re" { opts.set_bFlag (true); goto opt; } -#line 2572 "src/options/parse_opts.cc" +#line 2571 "src/options/parse_opts.cc" yy632: yych = (YYCTYPE)*++YYCURSOR; if (yych == 't') goto yy660; @@ -2611,23 +2610,23 @@ yy641: goto yy283; yy642: ++YYCURSOR; -#line 189 "../src/options/parse_opts.re" +#line 188 "../src/options/parse_opts.re" { globopts.dump_interf = true; goto opt; } -#line 2617 "src/options/parse_opts.cc" +#line 2616 "src/options/parse_opts.cc" yy644: ++YYCURSOR; -#line 170 "../src/options/parse_opts.re" +#line 169 "../src/options/parse_opts.re" { NEXT_ARG("--empty-class", opt_empty_class); } -#line 2622 "src/options/parse_opts.cc" +#line 2621 "src/options/parse_opts.cc" yy646: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'i') goto yy674; goto yy283; yy647: ++YYCURSOR; -#line 140 "../src/options/parse_opts.re" +#line 139 "../src/options/parse_opts.re" { globopts.FFlag = true; goto opt; } -#line 2631 "src/options/parse_opts.cc" +#line 2630 "src/options/parse_opts.cc" yy649: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'o') goto yy675; @@ -2654,18 +2653,18 @@ yy654: goto yy283; yy655: ++YYCURSOR; -#line 172 "../src/options/parse_opts.re" +#line 171 "../src/options/parse_opts.re" { goto opt; } -#line 2660 "src/options/parse_opts.cc" +#line 2659 "src/options/parse_opts.cc" yy657: yych = (YYCTYPE)*++YYCURSOR; if (yych == 't') goto yy682; goto yy283; yy658: ++YYCURSOR; -#line 167 "../src/options/parse_opts.re" +#line 166 "../src/options/parse_opts.re" { NEXT_ARG("-t, --type-header", opt_header); } -#line 2669 "src/options/parse_opts.cc" +#line 2668 "src/options/parse_opts.cc" yy660: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'i') goto yy683; @@ -2680,9 +2679,9 @@ yy662: goto yy283; yy663: ++YYCURSOR; -#line 147 "../src/options/parse_opts.re" +#line 146 "../src/options/parse_opts.re" { opts.set_dFlag (true); goto opt; } -#line 2686 "src/options/parse_opts.cc" +#line 2685 "src/options/parse_opts.cc" yy665: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'i') goto yy687; @@ -2693,19 +2692,19 @@ yy666: goto yy283; yy667: ++YYCURSOR; -#line 184 "../src/options/parse_opts.re" +#line 183 "../src/options/parse_opts.re" { globopts.dump_dfa_det = true; goto opt; } -#line 2699 "src/options/parse_opts.cc" +#line 2698 "src/options/parse_opts.cc" yy669: ++YYCURSOR; -#line 186 "../src/options/parse_opts.re" +#line 185 "../src/options/parse_opts.re" { globopts.dump_dfa_min = true; goto opt; } -#line 2704 "src/options/parse_opts.cc" +#line 2703 "src/options/parse_opts.cc" yy671: ++YYCURSOR; -#line 183 "../src/options/parse_opts.re" +#line 182 "../src/options/parse_opts.re" { globopts.dump_dfa_raw = true; goto opt; } -#line 2709 "src/options/parse_opts.cc" +#line 2708 "src/options/parse_opts.cc" yy673: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'p') goto yy689; @@ -2724,9 +2723,9 @@ yy676: goto yy283; yy677: ++YYCURSOR; -#line 177 "../src/options/parse_opts.re" +#line 176 "../src/options/parse_opts.re" { globopts.lookahead = false; goto opt; } -#line 2730 "src/options/parse_opts.cc" +#line 2729 "src/options/parse_opts.cc" yy679: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'a') goto yy694; @@ -2749,9 +2748,9 @@ yy683: goto yy283; yy684: ++YYCURSOR; -#line 152 "../src/options/parse_opts.re" +#line 151 "../src/options/parse_opts.re" { opts.set_bCaseInverted (true); goto opt; } -#line 2755 "src/options/parse_opts.cc" +#line 2754 "src/options/parse_opts.cc" yy686: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x00) goto yy700; @@ -2774,9 +2773,9 @@ yy690: goto yy283; yy691: ++YYCURSOR; -#line 149 "../src/options/parse_opts.re" +#line 148 "../src/options/parse_opts.re" { opts.set_iFlag (true); goto opt; } -#line 2780 "src/options/parse_opts.cc" +#line 2779 "src/options/parse_opts.cc" yy693: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'd') goto yy706; @@ -2791,9 +2790,9 @@ yy695: goto yy283; yy696: ++YYCURSOR; -#line 176 "../src/options/parse_opts.re" +#line 175 "../src/options/parse_opts.re" { NEXT_ARG("--posix-closure", opt_posix_closure); } -#line 2797 "src/options/parse_opts.cc" +#line 2796 "src/options/parse_opts.cc" yy698: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x00) goto yy710; @@ -2804,9 +2803,9 @@ yy699: goto yy283; yy700: ++YYCURSOR; -#line 148 "../src/options/parse_opts.re" +#line 147 "../src/options/parse_opts.re" { opts.set_gFlag (true); goto opt; } -#line 2810 "src/options/parse_opts.cc" +#line 2809 "src/options/parse_opts.cc" yy702: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'n') goto yy713; @@ -2833,18 +2832,18 @@ yy707: goto yy283; yy708: ++YYCURSOR; -#line 160 "../src/options/parse_opts.re" +#line 159 "../src/options/parse_opts.re" { opts.set_posix_syntax(true); opts.set_posix_semantics(true); goto opt; } -#line 2843 "src/options/parse_opts.cc" +#line 2842 "src/options/parse_opts.cc" yy710: ++YYCURSOR; -#line 139 "../src/options/parse_opts.re" +#line 138 "../src/options/parse_opts.re" { globopts.fFlag = true; goto opt; } -#line 2848 "src/options/parse_opts.cc" +#line 2847 "src/options/parse_opts.cc" yy712: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x00) goto yy721; @@ -2859,14 +2858,14 @@ yy714: goto yy283; yy715: ++YYCURSOR; -#line 185 "../src/options/parse_opts.re" +#line 184 "../src/options/parse_opts.re" { globopts.dump_dfa_tagopt = true; goto opt; } -#line 2865 "src/options/parse_opts.cc" +#line 2864 "src/options/parse_opts.cc" yy717: ++YYCURSOR; -#line 168 "../src/options/parse_opts.re" +#line 167 "../src/options/parse_opts.re" { NEXT_ARG("--encoding-policy", opt_encoding_policy); } -#line 2870 "src/options/parse_opts.cc" +#line 2869 "src/options/parse_opts.cc" yy719: yych = (YYCTYPE)*++YYCURSOR; if (yych == 't') goto yy726; @@ -2877,14 +2876,14 @@ yy720: goto yy283; yy721: ++YYCURSOR; -#line 151 "../src/options/parse_opts.re" +#line 150 "../src/options/parse_opts.re" { opts.set_bCaseInsensitive (true); goto opt; } -#line 2883 "src/options/parse_opts.cc" +#line 2882 "src/options/parse_opts.cc" yy723: ++YYCURSOR; -#line 175 "../src/options/parse_opts.re" +#line 174 "../src/options/parse_opts.re" { NEXT_ARG("--dfa-minimization", opt_dfa_minimization); } -#line 2888 "src/options/parse_opts.cc" +#line 2887 "src/options/parse_opts.cc" yy725: yych = (YYCTYPE)*++YYCURSOR; if (yych == 's') goto yy729; @@ -2895,9 +2894,9 @@ yy726: goto yy283; yy727: ++YYCURSOR; -#line 178 "../src/options/parse_opts.re" +#line 177 "../src/options/parse_opts.re" { globopts.optimize_tags = false; goto opt; } -#line 2901 "src/options/parse_opts.cc" +#line 2900 "src/options/parse_opts.cc" yy729: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x00) goto yy731; @@ -2908,21 +2907,21 @@ yy730: goto yy283; yy731: ++YYCURSOR; -#line 190 "../src/options/parse_opts.re" +#line 189 "../src/options/parse_opts.re" { globopts.dump_closure_stats = true; goto opt; } -#line 2914 "src/options/parse_opts.cc" +#line 2913 "src/options/parse_opts.cc" yy733: ++YYCURSOR; -#line 142 "../src/options/parse_opts.re" +#line 141 "../src/options/parse_opts.re" { globopts.bNoGenerationDate = true; goto opt; } -#line 2919 "src/options/parse_opts.cc" +#line 2918 "src/options/parse_opts.cc" } -#line 191 "../src/options/parse_opts.re" +#line 190 "../src/options/parse_opts.re" opt_output: -#line 2926 "src/options/parse_opts.cc" +#line 2925 "src/options/parse_opts.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -2964,25 +2963,25 @@ opt_output: if (yych != '-') goto yy739; yy737: ++YYCURSOR; -#line 195 "../src/options/parse_opts.re" +#line 194 "../src/options/parse_opts.re" { ERROR("bad argument to option -o, --output: %s", *argv); } -#line 2970 "src/options/parse_opts.cc" +#line 2969 "src/options/parse_opts.cc" yy739: yych = (YYCTYPE)*++YYCURSOR; if (yybm[0+yych] & 128) { goto yy739; } ++YYCURSOR; -#line 196 "../src/options/parse_opts.re" +#line 195 "../src/options/parse_opts.re" { opts.set_output_file (*argv); goto opt; } -#line 2979 "src/options/parse_opts.cc" +#line 2978 "src/options/parse_opts.cc" } -#line 197 "../src/options/parse_opts.re" +#line 196 "../src/options/parse_opts.re" opt_header: -#line 2986 "src/options/parse_opts.cc" +#line 2985 "src/options/parse_opts.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -3024,25 +3023,25 @@ opt_header: if (yych != '-') goto yy747; yy745: ++YYCURSOR; -#line 201 "../src/options/parse_opts.re" +#line 200 "../src/options/parse_opts.re" { ERROR("bad argument to option -t, --type-header: %s", *argv); } -#line 3030 "src/options/parse_opts.cc" +#line 3029 "src/options/parse_opts.cc" yy747: yych = (YYCTYPE)*++YYCURSOR; if (yybm[0+yych] & 128) { goto yy747; } ++YYCURSOR; -#line 202 "../src/options/parse_opts.re" +#line 201 "../src/options/parse_opts.re" { opts.set_header_file (*argv); goto opt; } -#line 3039 "src/options/parse_opts.cc" +#line 3038 "src/options/parse_opts.cc" } -#line 203 "../src/options/parse_opts.re" +#line 202 "../src/options/parse_opts.re" opt_incpath: -#line 3046 "src/options/parse_opts.cc" +#line 3045 "src/options/parse_opts.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -3084,25 +3083,25 @@ opt_incpath: if (yych != '-') goto yy755; yy753: ++YYCURSOR; -#line 207 "../src/options/parse_opts.re" +#line 206 "../src/options/parse_opts.re" { ERROR("bad argument to option -I: %s", *argv); } -#line 3090 "src/options/parse_opts.cc" +#line 3089 "src/options/parse_opts.cc" yy755: yych = (YYCTYPE)*++YYCURSOR; if (yybm[0+yych] & 128) { goto yy755; } ++YYCURSOR; -#line 208 "../src/options/parse_opts.re" +#line 207 "../src/options/parse_opts.re" { globopts.incpaths.push_back(*argv); goto opt; } -#line 3099 "src/options/parse_opts.cc" +#line 3098 "src/options/parse_opts.cc" } -#line 209 "../src/options/parse_opts.re" +#line 208 "../src/options/parse_opts.re" opt_encoding_policy: -#line 3106 "src/options/parse_opts.cc" +#line 3105 "src/options/parse_opts.cc" { YYCTYPE yych; yych = (YYCTYPE)*YYCURSOR; @@ -3114,12 +3113,12 @@ opt_encoding_policy: } ++YYCURSOR; yy762: -#line 213 "../src/options/parse_opts.re" +#line 212 "../src/options/parse_opts.re" { ERROR("bad argument to option --encoding-policy " "(expected: ignore | substitute | fail): %s", *argv); } -#line 3123 "src/options/parse_opts.cc" +#line 3122 "src/options/parse_opts.cc" yy763: yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych == 'a') goto yy766; @@ -3172,9 +3171,9 @@ yy775: goto yy767; yy776: ++YYCURSOR; -#line 219 "../src/options/parse_opts.re" +#line 218 "../src/options/parse_opts.re" { opts.set_encoding_policy (Enc::POLICY_FAIL); goto opt; } -#line 3178 "src/options/parse_opts.cc" +#line 3177 "src/options/parse_opts.cc" yy778: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy780; @@ -3193,9 +3192,9 @@ yy781: goto yy767; yy782: ++YYCURSOR; -#line 217 "../src/options/parse_opts.re" +#line 216 "../src/options/parse_opts.re" { opts.set_encoding_policy (Enc::POLICY_IGNORE); goto opt; } -#line 3199 "src/options/parse_opts.cc" +#line 3198 "src/options/parse_opts.cc" yy784: yych = (YYCTYPE)*++YYCURSOR; if (yych != 'u') goto yy767; @@ -3206,16 +3205,16 @@ yy784: yych = (YYCTYPE)*++YYCURSOR; if (yych >= 0x01) goto yy767; ++YYCURSOR; -#line 218 "../src/options/parse_opts.re" +#line 217 "../src/options/parse_opts.re" { opts.set_encoding_policy (Enc::POLICY_SUBSTITUTE); goto opt; } -#line 3212 "src/options/parse_opts.cc" +#line 3211 "src/options/parse_opts.cc" } -#line 220 "../src/options/parse_opts.re" +#line 219 "../src/options/parse_opts.re" opt_input: -#line 3219 "src/options/parse_opts.cc" +#line 3218 "src/options/parse_opts.cc" { YYCTYPE yych; yych = (YYCTYPE)*YYCURSOR; @@ -3225,12 +3224,12 @@ opt_input: yy792: ++YYCURSOR; yy793: -#line 224 "../src/options/parse_opts.re" +#line 223 "../src/options/parse_opts.re" { ERROR("bad argument to option --input " "(expected: default | custom): %s", *argv); } -#line 3234 "src/options/parse_opts.cc" +#line 3233 "src/options/parse_opts.cc" yy794: yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych == 'u') goto yy796; @@ -3283,23 +3282,23 @@ yy806: goto yy797; yy807: ++YYCURSOR; -#line 229 "../src/options/parse_opts.re" +#line 228 "../src/options/parse_opts.re" { opts.set_input_api(INPUT_CUSTOM); goto opt; } -#line 3289 "src/options/parse_opts.cc" +#line 3288 "src/options/parse_opts.cc" yy809: yych = (YYCTYPE)*++YYCURSOR; if (yych >= 0x01) goto yy797; ++YYCURSOR; -#line 228 "../src/options/parse_opts.re" +#line 227 "../src/options/parse_opts.re" { opts.set_input_api(INPUT_DEFAULT); goto opt; } -#line 3296 "src/options/parse_opts.cc" +#line 3295 "src/options/parse_opts.cc" } -#line 230 "../src/options/parse_opts.re" +#line 229 "../src/options/parse_opts.re" opt_empty_class: -#line 3303 "src/options/parse_opts.cc" +#line 3302 "src/options/parse_opts.cc" { YYCTYPE yych; yych = (YYCTYPE)*YYCURSOR; @@ -3307,12 +3306,12 @@ opt_empty_class: if (yych == 'm') goto yy817; ++YYCURSOR; yy815: -#line 234 "../src/options/parse_opts.re" +#line 233 "../src/options/parse_opts.re" { ERROR("bad argument to option --empty-class " "(expected: match-empty | match-none | error): %s", *argv); } -#line 3316 "src/options/parse_opts.cc" +#line 3315 "src/options/parse_opts.cc" yy816: yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych == 'r') goto yy818; @@ -3357,9 +3356,9 @@ yy826: goto yy819; yy827: ++YYCURSOR; -#line 240 "../src/options/parse_opts.re" +#line 239 "../src/options/parse_opts.re" { opts.set_empty_class_policy (EMPTY_CLASS_ERROR); goto opt; } -#line 3363 "src/options/parse_opts.cc" +#line 3362 "src/options/parse_opts.cc" yy829: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy830; @@ -3403,21 +3402,21 @@ yy838: goto yy819; yy839: ++YYCURSOR; -#line 239 "../src/options/parse_opts.re" +#line 238 "../src/options/parse_opts.re" { opts.set_empty_class_policy (EMPTY_CLASS_MATCH_NONE); goto opt; } -#line 3409 "src/options/parse_opts.cc" +#line 3408 "src/options/parse_opts.cc" yy841: ++YYCURSOR; -#line 238 "../src/options/parse_opts.re" +#line 237 "../src/options/parse_opts.re" { opts.set_empty_class_policy (EMPTY_CLASS_MATCH_EMPTY); goto opt; } -#line 3414 "src/options/parse_opts.cc" +#line 3413 "src/options/parse_opts.cc" } -#line 241 "../src/options/parse_opts.re" +#line 240 "../src/options/parse_opts.re" opt_dfa_minimization: -#line 3421 "src/options/parse_opts.cc" +#line 3420 "src/options/parse_opts.cc" { YYCTYPE yych; yych = (YYCTYPE)*YYCURSOR; @@ -3425,12 +3424,12 @@ opt_dfa_minimization: if (yych == 't') goto yy848; ++YYCURSOR; yy846: -#line 245 "../src/options/parse_opts.re" +#line 244 "../src/options/parse_opts.re" { ERROR("bad argument to option --dfa-minimization " "(expected: table | moore): %s", *argv); } -#line 3434 "src/options/parse_opts.cc" +#line 3433 "src/options/parse_opts.cc" yy847: yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych == 'o') goto yy849; @@ -3475,33 +3474,33 @@ yy857: goto yy850; yy858: ++YYCURSOR; -#line 250 "../src/options/parse_opts.re" +#line 249 "../src/options/parse_opts.re" { globopts.dfa_minimization = DFA_MINIMIZATION_MOORE; goto opt; } -#line 3481 "src/options/parse_opts.cc" +#line 3480 "src/options/parse_opts.cc" yy860: ++YYCURSOR; -#line 249 "../src/options/parse_opts.re" +#line 248 "../src/options/parse_opts.re" { globopts.dfa_minimization = DFA_MINIMIZATION_TABLE; goto opt; } -#line 3486 "src/options/parse_opts.cc" +#line 3485 "src/options/parse_opts.cc" } -#line 251 "../src/options/parse_opts.re" +#line 250 "../src/options/parse_opts.re" opt_posix_closure: -#line 3493 "src/options/parse_opts.cc" +#line 3492 "src/options/parse_opts.cc" { YYCTYPE yych; yych = (YYCTYPE)*YYCURSOR; if (yych == 'g') goto yy866; ++YYCURSOR; yy865: -#line 255 "../src/options/parse_opts.re" +#line 254 "../src/options/parse_opts.re" { ERROR("bad argument to option --posix_closure " "(expected: gor1 | gtop): %s", *argv); } -#line 3505 "src/options/parse_opts.cc" +#line 3504 "src/options/parse_opts.cc" yy866: yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych == 'o') goto yy867; @@ -3535,16 +3534,16 @@ yy873: goto yy868; yy874: ++YYCURSOR; -#line 259 "../src/options/parse_opts.re" +#line 258 "../src/options/parse_opts.re" { globopts.posix_closure = POSIX_CLOSURE_GOR1; goto opt; } -#line 3541 "src/options/parse_opts.cc" +#line 3540 "src/options/parse_opts.cc" yy876: ++YYCURSOR; -#line 260 "../src/options/parse_opts.re" +#line 259 "../src/options/parse_opts.re" { globopts.posix_closure = POSIX_CLOSURE_GTOP; goto opt; } -#line 3546 "src/options/parse_opts.cc" +#line 3545 "src/options/parse_opts.cc" } -#line 261 "../src/options/parse_opts.re" +#line 260 "../src/options/parse_opts.re" end: diff --git a/re2c/bootstrap/src/parse/lex.cc b/re2c/bootstrap/src/parse/lex.cc index 75ac6003..ce767035 100644 --- a/re2c/bootstrap/src/parse/lex.cc +++ b/re2c/bootstrap/src/parse/lex.cc @@ -1,4 +1,4 @@ -/* Generated by re2c 1.1.1 on Tue Feb 12 17:26:39 2019 */ +/* Generated by re2c 1.1.1 on Tue Feb 12 22:50:47 2019 */ #line 1 "../src/parse/lex.re" #include "src/util/c99_stdint.h" #include @@ -7,7 +7,6 @@ #include #include -#include "src/options/msg.h" #include "src/codegen/output.h" #include "src/encoding/enc.h" #include "src/parse/input.h" @@ -30,10 +29,10 @@ namespace re2c { #define YYMARKER mar #define YYFILL(n) { if (!fill (n)) fatal("unexpected end of input"); } -#line 55 "../src/parse/lex.re" +#line 54 "../src/parse/lex.re" -#line 108 "../src/parse/lex.re" +#line 107 "../src/parse/lex.re" Scanner::ParseMode Scanner::echo(Output &out) @@ -47,7 +46,7 @@ loop: loc = cur_loc(); ptr = cur; -#line 51 "src/parse/lex.cc" +#line 50 "src/parse/lex.cc" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -105,7 +104,7 @@ loop: } } ++YYCURSOR; -#line 206 "../src/parse/lex.re" +#line 205 "../src/parse/lex.re" { if (is_eof()) { out.wraw(tok, ptr); @@ -113,13 +112,13 @@ loop: } goto loop; } -#line 117 "src/parse/lex.cc" +#line 116 "src/parse/lex.cc" yy4: ++YYCURSOR; yy5: -#line 225 "../src/parse/lex.re" +#line 224 "../src/parse/lex.re" { goto loop; } -#line 123 "src/parse/lex.cc" +#line 122 "src/parse/lex.cc" yy6: yyaccept = 0; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -128,12 +127,12 @@ yy6: } if (yych == '#') goto yy14; yy7: -#line 220 "../src/parse/lex.re" +#line 219 "../src/parse/lex.re" { next_line(); goto loop; } -#line 137 "src/parse/lex.cc" +#line 136 "src/parse/lex.cc" yy8: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy6; @@ -176,12 +175,12 @@ yy14: } yy16: ++YYCURSOR; -#line 121 "../src/parse/lex.re" +#line 120 "../src/parse/lex.re" { out.wraw(tok, ptr); return Parse; } -#line 185 "src/parse/lex.cc" +#line 184 "src/parse/lex.cc" yy18: yych = (YYCTYPE)*++YYCURSOR; if (yych == '!') goto yy20; @@ -477,13 +476,13 @@ yy80: yy82: ++YYCURSOR; YYCURSOR = yyt1; -#line 214 "../src/parse/lex.re" +#line 213 "../src/parse/lex.re" { out.wraw(tok, ptr + 1); set_sourceline(); goto next; } -#line 487 "src/parse/lex.cc" +#line 486 "src/parse/lex.cc" yy84: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy82; @@ -616,14 +615,14 @@ yy114: goto yy13; yy115: ++YYCURSOR; -#line 142 "../src/parse/lex.re" +#line 141 "../src/parse/lex.re" { out.wraw(tok, ptr); out.wdelay_yymaxfill(); lex_end_of_comment(out); goto next; } -#line 627 "src/parse/lex.cc" +#line 626 "src/parse/lex.cc" yy117: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'h') goto yy128; @@ -646,12 +645,12 @@ yy121: goto yy13; yy122: ++YYCURSOR; -#line 131 "../src/parse/lex.re" +#line 130 "../src/parse/lex.re" { out.wraw(tok, ptr); return Reuse; } -#line 655 "src/parse/lex.cc" +#line 654 "src/parse/lex.cc" yy124: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy133; @@ -710,33 +709,33 @@ yy137: goto yy13; yy138: ++YYCURSOR; -#line 178 "../src/parse/lex.re" +#line 177 "../src/parse/lex.re" { out.wraw(tok, ptr); lex_tags(out, true); goto next; } -#line 720 "src/parse/lex.cc" +#line 719 "src/parse/lex.cc" yy140: ++YYCURSOR; -#line 126 "../src/parse/lex.re" +#line 125 "../src/parse/lex.re" { out.wraw(tok, ptr); return Rules; } -#line 728 "src/parse/lex.cc" +#line 727 "src/parse/lex.cc" yy142: ++YYCURSOR; -#line 172 "../src/parse/lex.re" +#line 171 "../src/parse/lex.re" { out.wraw(tok, ptr); lex_tags(out, false); goto next; } -#line 737 "src/parse/lex.cc" +#line 736 "src/parse/lex.cc" yy144: ++YYCURSOR; -#line 163 "../src/parse/lex.re" +#line 162 "../src/parse/lex.re" { out.wraw(tok, ptr); out.wdelay_line_info_output(); @@ -745,7 +744,7 @@ yy144: lex_end_of_comment(out); goto next; } -#line 749 "src/parse/lex.cc" +#line 748 "src/parse/lex.cc" yy146: yych = (YYCTYPE)*++YYCURSOR; if (yych == '2') goto yy152; @@ -756,13 +755,13 @@ yy147: goto yy13; yy148: ++YYCURSOR; -#line 136 "../src/parse/lex.re" +#line 135 "../src/parse/lex.re" { out.wraw(tok, ptr); lex_end_of_comment(out); goto next; } -#line 766 "src/parse/lex.cc" +#line 765 "src/parse/lex.cc" yy150: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'c') goto yy154; @@ -789,14 +788,14 @@ yy155: goto yy13; yy156: ++YYCURSOR; -#line 156 "../src/parse/lex.re" +#line 155 "../src/parse/lex.re" { out.wraw(tok, ptr); out.wdelay_state_goto(0); lex_end_of_comment(out); goto next; } -#line 800 "src/parse/lex.cc" +#line 799 "src/parse/lex.cc" yy158: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'f') goto yy162; @@ -828,7 +827,7 @@ yy162: goto yy13; yy163: ++YYCURSOR; -#line 184 "../src/parse/lex.re" +#line 183 "../src/parse/lex.re" { out.wraw(tok, ptr); out.header_mode(true); @@ -836,7 +835,7 @@ yy163: lex_end_of_comment(out); goto next; } -#line 840 "src/parse/lex.cc" +#line 839 "src/parse/lex.cc" yy165: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3); @@ -852,17 +851,17 @@ yy165: } yy167: ++YYCURSOR; -#line 149 "../src/parse/lex.re" +#line 148 "../src/parse/lex.re" { out.wraw(tok, ptr); out.wdelay_yymaxnmatch(); lex_end_of_comment(out); goto next; } -#line 863 "src/parse/lex.cc" +#line 862 "src/parse/lex.cc" yy169: ++YYCURSOR; -#line 192 "../src/parse/lex.re" +#line 191 "../src/parse/lex.re" { out.wraw(tok, ptr); out.header_mode(false); @@ -870,7 +869,7 @@ yy169: lex_end_of_comment(out); goto next; } -#line 874 "src/parse/lex.cc" +#line 873 "src/parse/lex.cc" yy171: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 0x1F) { @@ -914,15 +913,15 @@ yy175: ++YYCURSOR; x = yyt1; y = yyt2; -#line 200 "../src/parse/lex.re" +#line 199 "../src/parse/lex.re" { out.wraw(tok, ptr); include(getstr(x + 1, y - 1)); goto next; } -#line 924 "src/parse/lex.cc" +#line 923 "src/parse/lex.cc" } -#line 226 "../src/parse/lex.re" +#line 225 "../src/parse/lex.re" } @@ -931,7 +930,7 @@ void Scanner::lex_end_of_comment(Output &out) bool multiline = false; loop: -#line 935 "src/parse/lex.cc" +#line 934 "src/parse/lex.cc" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -947,26 +946,26 @@ loop: } yy180: ++YYCURSOR; -#line 235 "../src/parse/lex.re" +#line 234 "../src/parse/lex.re" { - fatal(cur_loc(), "expected end of block"); + msg.fatal(cur_loc(), "expected end of block"); } -#line 955 "src/parse/lex.cc" +#line 954 "src/parse/lex.cc" yy182: ++YYCURSOR; yy183: -#line 234 "../src/parse/lex.re" +#line 233 "../src/parse/lex.re" { goto loop; } -#line 961 "src/parse/lex.cc" +#line 960 "src/parse/lex.cc" yy184: ++YYCURSOR; -#line 238 "../src/parse/lex.re" +#line 237 "../src/parse/lex.re" { next_line(); multiline = true; goto loop; } -#line 970 "src/parse/lex.cc" +#line 969 "src/parse/lex.cc" yy186: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy184; @@ -975,16 +974,16 @@ yy187: yych = (YYCTYPE)*++YYCURSOR; if (yych != '/') goto yy183; ++YYCURSOR; -#line 243 "../src/parse/lex.re" +#line 242 "../src/parse/lex.re" { if (multiline) { out.wdelay_line_info_input(cur_loc()); } return; } -#line 986 "src/parse/lex.cc" +#line 985 "src/parse/lex.cc" } -#line 249 "../src/parse/lex.re" +#line 248 "../src/parse/lex.re" } @@ -993,7 +992,7 @@ void Scanner::lex_tags(Output &out, bool mtags) std::string fmt, sep; loop: -#line 997 "src/parse/lex.cc" +#line 996 "src/parse/lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -1051,11 +1050,11 @@ loop: } ++YYCURSOR; yy193: -#line 257 "../src/parse/lex.re" +#line 256 "../src/parse/lex.re" { - fatal(cur_loc(), "unrecognized configuration"); + msg.fatal(cur_loc(), "unrecognized configuration"); } -#line 1059 "src/parse/lex.cc" +#line 1058 "src/parse/lex.cc" yy194: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -1063,19 +1062,19 @@ yy194: if (yybm[0+yych] & 128) { goto yy194; } -#line 268 "../src/parse/lex.re" +#line 267 "../src/parse/lex.re" { goto loop; } -#line 1071 "src/parse/lex.cc" +#line 1070 "src/parse/lex.cc" yy197: ++YYCURSOR; -#line 271 "../src/parse/lex.re" +#line 270 "../src/parse/lex.re" { next_line(); goto loop; } -#line 1079 "src/parse/lex.cc" +#line 1078 "src/parse/lex.cc" yy199: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy197; @@ -1094,12 +1093,12 @@ yy202: goto yy193; yy203: ++YYCURSOR; -#line 275 "../src/parse/lex.re" +#line 274 "../src/parse/lex.re" { out.wdelay_tags(new ConfTags(fmt, sep), mtags); return; } -#line 1103 "src/parse/lex.cc" +#line 1102 "src/parse/lex.cc" yy205: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy208; @@ -1136,12 +1135,12 @@ yy213: goto yy206; yy214: ++YYCURSOR; -#line 260 "../src/parse/lex.re" +#line 259 "../src/parse/lex.re" { fmt = lex_conf_string(); goto loop; } -#line 1145 "src/parse/lex.cc" +#line 1144 "src/parse/lex.cc" yy216: yych = (YYCTYPE)*++YYCURSOR; if (yych != 't') goto yy206; @@ -1150,14 +1149,14 @@ yy216: yych = (YYCTYPE)*++YYCURSOR; if (yych != 'r') goto yy206; ++YYCURSOR; -#line 264 "../src/parse/lex.re" +#line 263 "../src/parse/lex.re" { sep = lex_conf_string(); goto loop; } -#line 1159 "src/parse/lex.cc" +#line 1158 "src/parse/lex.cc" } -#line 279 "../src/parse/lex.re" +#line 278 "../src/parse/lex.re" } @@ -1168,7 +1167,7 @@ scan: tok = cur; loc = cur_loc(); -#line 1172 "src/parse/lex.cc" +#line 1171 "src/parse/lex.cc" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -1278,12 +1277,12 @@ scan: yy223: ++YYCURSOR; yy224: -#line 403 "../src/parse/lex.re" +#line 402 "../src/parse/lex.re" { - fatal(tok_loc(), "unexpected character: '%c'", *tok); + msg.fatal(tok_loc(), "unexpected character: '%c'", *tok); goto scan; } -#line 1287 "src/parse/lex.cc" +#line 1286 "src/parse/lex.cc" yy225: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -1291,9 +1290,9 @@ yy225: if (yybm[0+yych] & 16) { goto yy225; } -#line 385 "../src/parse/lex.re" +#line 384 "../src/parse/lex.re" { goto scan; } -#line 1297 "src/parse/lex.cc" +#line 1296 "src/parse/lex.cc" yy228: yyaccept = 0; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -1304,7 +1303,7 @@ yy228: if (yych == '#') goto yy258; } yy229: -#line 392 "../src/parse/lex.re" +#line 391 "../src/parse/lex.re" { next_line(); if (lexer_state == LEX_FLEX_NAME) { @@ -1315,16 +1314,16 @@ yy229: goto scan; } } -#line 1319 "src/parse/lex.cc" +#line 1318 "src/parse/lex.cc" yy230: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy228; goto yy224; yy231: ++YYCURSOR; -#line 305 "../src/parse/lex.re" +#line 304 "../src/parse/lex.re" { yylval.regexp = lex_str('"'); return TOKEN_REGEXP; } -#line 1328 "src/parse/lex.cc" +#line 1327 "src/parse/lex.cc" yy233: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '^') { @@ -1339,30 +1338,30 @@ yy233: yy234: ++YYCURSOR; yy235: -#line 314 "../src/parse/lex.re" +#line 313 "../src/parse/lex.re" { return *tok; } -#line 1345 "src/parse/lex.cc" +#line 1344 "src/parse/lex.cc" yy236: yych = (YYCTYPE)*++YYCURSOR; if (yych == '}') goto yy263; goto yy224; yy237: ++YYCURSOR; -#line 304 "../src/parse/lex.re" +#line 303 "../src/parse/lex.re" { yylval.regexp = lex_str('\''); return TOKEN_REGEXP; } -#line 1354 "src/parse/lex.cc" +#line 1353 "src/parse/lex.cc" yy239: yych = (YYCTYPE)*++YYCURSOR; if (yych == '/') goto yy263; goto yy235; yy240: ++YYCURSOR; -#line 380 "../src/parse/lex.re" +#line 379 "../src/parse/lex.re" { yylval.regexp = ast_dot(tok_loc()); return TOKEN_REGEXP; } -#line 1366 "src/parse/lex.cc" +#line 1365 "src/parse/lex.cc" yy242: yych = (YYCTYPE)*++YYCURSOR; if (yych == '*') goto yy265; @@ -1374,9 +1373,9 @@ yy243: goto yy224; yy244: ++YYCURSOR; -#line 297 "../src/parse/lex.re" +#line 296 "../src/parse/lex.re" { return lex_clist(); } -#line 1380 "src/parse/lex.cc" +#line 1379 "src/parse/lex.cc" yy246: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -1390,7 +1389,7 @@ yy248: if (yybm[0+yych] & 32) { goto yy247; } -#line 357 "../src/parse/lex.re" +#line 356 "../src/parse/lex.re" { if (!globopts->FFlag || lex_namedef_context_re2c()) { yylval.str = newstr(tok, cur); @@ -1406,20 +1405,20 @@ yy248: // precedence in cases like ab*: it should be a(b)*, not (ab)* cur = tok + 1; - ASTChar c(static_cast(tok[0]), tok_loc()); + ASTChar c = {static_cast(tok[0]), tok_loc()}; std::vector *str = new std::vector; str->push_back(c); yylval.regexp = ast_str(tok_loc(), str, false); return TOKEN_REGEXP; } } -#line 1417 "src/parse/lex.cc" +#line 1416 "src/parse/lex.cc" yy250: yych = (YYCTYPE)*++YYCURSOR; if (yych == '^') goto yy273; -#line 306 "../src/parse/lex.re" +#line 305 "../src/parse/lex.re" { yylval.regexp = lex_cls(false); return TOKEN_REGEXP; } -#line 1423 "src/parse/lex.cc" +#line 1422 "src/parse/lex.cc" yy252: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy275; @@ -1442,9 +1441,9 @@ yy253: } } yy254: -#line 289 "../src/parse/lex.re" +#line 288 "../src/parse/lex.re" { lex_code_in_braces(); return TOKEN_CODE; } -#line 1448 "src/parse/lex.cc" +#line 1447 "src/parse/lex.cc" yy255: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -1503,35 +1502,35 @@ yy260: } } yy262: -#line 309 "../src/parse/lex.re" +#line 308 "../src/parse/lex.re" { yylval.regexp = ast_tag(tok_loc(), newstr(tok + 1, cur), tok[0] == '#'); return TOKEN_REGEXP; } -#line 1512 "src/parse/lex.cc" +#line 1511 "src/parse/lex.cc" yy263: ++YYCURSOR; -#line 302 "../src/parse/lex.re" +#line 301 "../src/parse/lex.re" { tok = cur; return 0; } -#line 1517 "src/parse/lex.cc" +#line 1516 "src/parse/lex.cc" yy265: ++YYCURSOR; -#line 300 "../src/parse/lex.re" +#line 299 "../src/parse/lex.re" { lex_c_comment(); goto scan; } -#line 1522 "src/parse/lex.cc" +#line 1521 "src/parse/lex.cc" yy267: ++YYCURSOR; -#line 299 "../src/parse/lex.re" +#line 298 "../src/parse/lex.re" { lex_cpp_comment(); goto scan; } -#line 1527 "src/parse/lex.cc" +#line 1526 "src/parse/lex.cc" yy269: yyaccept = 3; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych == '>') goto yy271; yy270: -#line 290 "../src/parse/lex.re" +#line 289 "../src/parse/lex.re" { lex_code_indented(); return TOKEN_CODE; } -#line 1535 "src/parse/lex.cc" +#line 1534 "src/parse/lex.cc" yy271: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -1564,9 +1563,9 @@ yy271: } yy273: ++YYCURSOR; -#line 307 "../src/parse/lex.re" +#line 306 "../src/parse/lex.re" { yylval.regexp = lex_cls(true); return TOKEN_REGEXP; } -#line 1570 "src/parse/lex.cc" +#line 1569 "src/parse/lex.cc" yy275: yych = (YYCTYPE)*++YYCURSOR; if (yych == '2') goto yy286; @@ -1574,12 +1573,12 @@ yy275: yy276: ++YYCURSOR; yy277: -#line 342 "../src/parse/lex.re" +#line 341 "../src/parse/lex.re" { - fatal(tok_loc(), "illegal closure form, use '{n}', '{n,}', '{n,m}' " + msg.fatal(tok_loc(), "illegal closure form, use '{n}', '{n,}', '{n,m}' " "where n and m are numbers"); } -#line 1583 "src/parse/lex.cc" +#line 1582 "src/parse/lex.cc" yy278: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -1637,12 +1636,12 @@ yy283: } yy285: p = yyt1; -#line 292 "../src/parse/lex.re" +#line 291 "../src/parse/lex.re" { yylval.str = newstr(p, cur); return tok[0] == ':' ? TOKEN_CJUMP : TOKEN_CNEXT; } -#line 1646 "src/parse/lex.cc" +#line 1645 "src/parse/lex.cc" yy286: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'c') goto yy293; @@ -1656,26 +1655,26 @@ yy287: goto yy277; yy288: ++YYCURSOR; -#line 316 "../src/parse/lex.re" +#line 315 "../src/parse/lex.re" { if (!s_to_u32_unsafe (tok + 1, cur - 1, yylval.bounds.min)) { - fatal(tok_loc(), "repetition count overflow"); + msg.fatal(tok_loc(), "repetition count overflow"); } yylval.bounds.max = yylval.bounds.min; return TOKEN_CLOSESIZE; } -#line 1668 "src/parse/lex.cc" +#line 1667 "src/parse/lex.cc" yy290: ++YYCURSOR; -#line 347 "../src/parse/lex.re" +#line 346 "../src/parse/lex.re" { if (!globopts->FFlag) { - fatal(tok_loc(), "curly braces for names only allowed with -F switch"); + msg.fatal(tok_loc(), "curly braces for names only allowed with -F switch"); } yylval.str = newstr(tok + 1, cur - 1); return TOKEN_ID; } -#line 1679 "src/parse/lex.cc" +#line 1678 "src/parse/lex.cc" yy292: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'n') goto yy298; @@ -1694,38 +1693,38 @@ yy294: goto yy257; yy296: ++YYCURSOR; -#line 334 "../src/parse/lex.re" +#line 333 "../src/parse/lex.re" { if (!s_to_u32_unsafe (tok + 1, cur - 2, yylval.bounds.min)) { - fatal(tok_loc(), "repetition lower bound overflow"); + msg.fatal(tok_loc(), "repetition lower bound overflow"); } yylval.bounds.max = std::numeric_limits::max(); return TOKEN_CLOSESIZE; } -#line 1706 "src/parse/lex.cc" +#line 1705 "src/parse/lex.cc" yy298: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy303; goto yy257; yy299: ++YYCURSOR; -#line 355 "../src/parse/lex.re" +#line 354 "../src/parse/lex.re" { return TOKEN_CONF; } -#line 1715 "src/parse/lex.cc" +#line 1714 "src/parse/lex.cc" yy301: ++YYCURSOR; p = yyt1; -#line 324 "../src/parse/lex.re" +#line 323 "../src/parse/lex.re" { if (!s_to_u32_unsafe (tok + 1, p, yylval.bounds.min)) { - fatal(tok_loc(), "repetition lower bound overflow"); + msg.fatal(tok_loc(), "repetition lower bound overflow"); } if (!s_to_u32_unsafe (p + 1, cur - 1, yylval.bounds.max)) { - fatal(tok_loc(), "repetition upper bound overflow"); + msg.fatal(tok_loc(), "repetition upper bound overflow"); } return TOKEN_CLOSESIZE; } -#line 1729 "src/parse/lex.cc" +#line 1728 "src/parse/lex.cc" yy303: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '0') goto yy305; @@ -1781,12 +1780,12 @@ yy308: yy310: ++YYCURSOR; YYCURSOR = yyt1; -#line 387 "../src/parse/lex.re" +#line 386 "../src/parse/lex.re" { set_sourceline (); return TOKEN_LINE_INFO; } -#line 1790 "src/parse/lex.cc" +#line 1789 "src/parse/lex.cc" yy312: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy310; @@ -1812,14 +1811,14 @@ yy316: if (yych == '\n') goto yy257; goto yy313; } -#line 407 "../src/parse/lex.re" +#line 406 "../src/parse/lex.re" } bool Scanner::lex_namedef_context_re2c() { -#line 1823 "src/parse/lex.cc" +#line 1822 "src/parse/lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -1874,9 +1873,9 @@ bool Scanner::lex_namedef_context_re2c() } } yy319: -#line 414 "../src/parse/lex.re" +#line 413 "../src/parse/lex.re" { return false; } -#line 1880 "src/parse/lex.cc" +#line 1879 "src/parse/lex.cc" yy320: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -1893,18 +1892,18 @@ yy323: if (yych == '>') goto yy322; ++YYCURSOR; YYCURSOR = yyt1; -#line 413 "../src/parse/lex.re" +#line 412 "../src/parse/lex.re" { return true; } -#line 1899 "src/parse/lex.cc" +#line 1898 "src/parse/lex.cc" } -#line 415 "../src/parse/lex.re" +#line 414 "../src/parse/lex.re" } bool Scanner::lex_namedef_context_flex() { -#line 1908 "src/parse/lex.cc" +#line 1907 "src/parse/lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -1951,9 +1950,9 @@ bool Scanner::lex_namedef_context_flex() yyt1 = YYCURSOR; goto yy329; } -#line 423 "../src/parse/lex.re" +#line 422 "../src/parse/lex.re" { return false; } -#line 1957 "src/parse/lex.cc" +#line 1956 "src/parse/lex.cc" yy329: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -1968,17 +1967,17 @@ yy329: if (yych == '{') goto yy332; } YYCURSOR = yyt1; -#line 422 "../src/parse/lex.re" +#line 421 "../src/parse/lex.re" { return true; } -#line 1974 "src/parse/lex.cc" +#line 1973 "src/parse/lex.cc" yy332: ++YYCURSOR; YYCURSOR = yyt1; -#line 421 "../src/parse/lex.re" +#line 420 "../src/parse/lex.re" { return false; } -#line 1980 "src/parse/lex.cc" +#line 1979 "src/parse/lex.cc" } -#line 424 "../src/parse/lex.re" +#line 423 "../src/parse/lex.re" } @@ -1987,7 +1986,7 @@ int Scanner::lex_clist() int kind = TOKEN_CLIST; CondList *cl = new CondList; -#line 1991 "src/parse/lex.cc" +#line 1990 "src/parse/lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -2037,30 +2036,30 @@ yy334: if (yych <= '!') goto yy338; if (yych == '>') goto yy341; yy337: -#line 434 "../src/parse/lex.re" +#line 433 "../src/parse/lex.re" { goto cond; } -#line 2043 "src/parse/lex.cc" +#line 2042 "src/parse/lex.cc" yy338: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yych == '\t') goto yy338; if (yych == ' ') goto yy338; -#line 432 "../src/parse/lex.re" +#line 431 "../src/parse/lex.re" { kind = TOKEN_CSETUP; goto cond; } -#line 2052 "src/parse/lex.cc" +#line 2051 "src/parse/lex.cc" yy341: ++YYCURSOR; -#line 433 "../src/parse/lex.re" +#line 432 "../src/parse/lex.re" { kind = TOKEN_CZERO; goto end; } -#line 2057 "src/parse/lex.cc" +#line 2056 "src/parse/lex.cc" } -#line 435 "../src/parse/lex.re" +#line 434 "../src/parse/lex.re" cond: tok = cur; -#line 2064 "src/parse/lex.cc" +#line 2063 "src/parse/lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -2112,14 +2111,14 @@ cond: } yy345: ++YYCURSOR; -#line 441 "../src/parse/lex.re" +#line 440 "../src/parse/lex.re" { goto error; } -#line 2118 "src/parse/lex.cc" +#line 2117 "src/parse/lex.cc" yy347: ++YYCURSOR; -#line 440 "../src/parse/lex.re" +#line 439 "../src/parse/lex.re" { if (!cl->empty()) goto error; cl->insert("*"); goto next; } -#line 2123 "src/parse/lex.cc" +#line 2122 "src/parse/lex.cc" yy349: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -2127,15 +2126,15 @@ yy349: if (yybm[0+yych] & 128) { goto yy349; } -#line 439 "../src/parse/lex.re" +#line 438 "../src/parse/lex.re" { cl->insert(getstr(tok, cur)); goto next; } -#line 2133 "src/parse/lex.cc" +#line 2132 "src/parse/lex.cc" } -#line 442 "../src/parse/lex.re" +#line 441 "../src/parse/lex.re" next: -#line 2139 "src/parse/lex.cc" +#line 2138 "src/parse/lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -2186,9 +2185,9 @@ next: } ++YYCURSOR; yy355: -#line 447 "../src/parse/lex.re" +#line 446 "../src/parse/lex.re" { goto error; } -#line 2192 "src/parse/lex.cc" +#line 2191 "src/parse/lex.cc" yy356: yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= ' ') { @@ -2210,14 +2209,14 @@ yy357: if (yybm[0+yych] & 128) { goto yy357; } -#line 445 "../src/parse/lex.re" +#line 444 "../src/parse/lex.re" { goto cond; } -#line 2216 "src/parse/lex.cc" +#line 2215 "src/parse/lex.cc" yy360: ++YYCURSOR; -#line 446 "../src/parse/lex.re" +#line 445 "../src/parse/lex.re" { goto end; } -#line 2221 "src/parse/lex.cc" +#line 2220 "src/parse/lex.cc" yy362: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -2235,14 +2234,14 @@ yy362: YYCURSOR = YYMARKER; goto yy355; } -#line 448 "../src/parse/lex.re" +#line 447 "../src/parse/lex.re" end: yylval.clist = cl; return kind; error: delete cl; - fatal(cur_loc(), "syntax error in condition list"); + msg.fatal(cur_loc(), "syntax error in condition list"); } void Scanner::lex_code_indented() @@ -2251,7 +2250,7 @@ void Scanner::lex_code_indented() tok = cur; code: -#line 2255 "src/parse/lex.cc" +#line 2254 "src/parse/lex.cc" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3); @@ -2279,15 +2278,15 @@ code: } yy367: ++YYCURSOR; -#line 473 "../src/parse/lex.re" +#line 472 "../src/parse/lex.re" { fail_if_eof(); goto code; } -#line 2285 "src/parse/lex.cc" +#line 2284 "src/parse/lex.cc" yy369: ++YYCURSOR; yy370: -#line 478 "../src/parse/lex.re" +#line 477 "../src/parse/lex.re" { goto code; } -#line 2291 "src/parse/lex.cc" +#line 2290 "src/parse/lex.cc" yy371: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '\f') { @@ -2298,7 +2297,7 @@ yy371: if (yych == ' ') goto yy379; } yy372: -#line 464 "../src/parse/lex.re" +#line 463 "../src/parse/lex.re" { next_line(); while (isspace(tok[0])) ++tok; @@ -2307,16 +2306,16 @@ yy372: yylval.code = new Code(loc, getstr(tok, p)); return; } -#line 2311 "src/parse/lex.cc" +#line 2310 "src/parse/lex.cc" yy373: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy371; goto yy370; yy374: ++YYCURSOR; -#line 477 "../src/parse/lex.re" +#line 476 "../src/parse/lex.re" { lex_string(cur[-1]); goto code; } -#line 2320 "src/parse/lex.cc" +#line 2319 "src/parse/lex.cc" yy376: yych = (YYCTYPE)*++YYCURSOR; if (yych == '*') goto yy381; @@ -2324,27 +2323,27 @@ yy376: goto yy370; yy377: ++YYCURSOR; -#line 474 "../src/parse/lex.re" - { fatal(cur_loc(), "Curly braces are not allowed after ':='"); } -#line 2330 "src/parse/lex.cc" +#line 473 "../src/parse/lex.re" + { msg.fatal(cur_loc(), "Curly braces are not allowed after ':='"); } +#line 2329 "src/parse/lex.cc" yy379: ++YYCURSOR; YYCURSOR -= 1; -#line 463 "../src/parse/lex.re" +#line 462 "../src/parse/lex.re" { next_line(); goto code; } -#line 2336 "src/parse/lex.cc" +#line 2335 "src/parse/lex.cc" yy381: ++YYCURSOR; -#line 475 "../src/parse/lex.re" +#line 474 "../src/parse/lex.re" { lex_c_comment(); goto code; } -#line 2341 "src/parse/lex.cc" +#line 2340 "src/parse/lex.cc" yy383: ++YYCURSOR; -#line 476 "../src/parse/lex.re" +#line 475 "../src/parse/lex.re" { lex_cpp_comment(); goto code; } -#line 2346 "src/parse/lex.cc" +#line 2345 "src/parse/lex.cc" } -#line 479 "../src/parse/lex.re" +#line 478 "../src/parse/lex.re" } @@ -2354,7 +2353,7 @@ void Scanner::lex_code_in_braces() uint32_t depth = 1; code: -#line 2358 "src/parse/lex.cc" +#line 2357 "src/parse/lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -2416,15 +2415,15 @@ code: } yy387: ++YYCURSOR; -#line 499 "../src/parse/lex.re" +#line 498 "../src/parse/lex.re" { fail_if_eof(); goto code; } -#line 2422 "src/parse/lex.cc" +#line 2421 "src/parse/lex.cc" yy389: ++YYCURSOR; yy390: -#line 503 "../src/parse/lex.re" +#line 502 "../src/parse/lex.re" { goto code; } -#line 2428 "src/parse/lex.cc" +#line 2427 "src/parse/lex.cc" yy391: yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yybm[0+yych] & 32) { @@ -2432,18 +2431,18 @@ yy391: } if (yych == '#') goto yy404; yy392: -#line 498 "../src/parse/lex.re" +#line 497 "../src/parse/lex.re" { next_line(); goto code; } -#line 2438 "src/parse/lex.cc" +#line 2437 "src/parse/lex.cc" yy393: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy391; goto yy390; yy394: ++YYCURSOR; -#line 502 "../src/parse/lex.re" +#line 501 "../src/parse/lex.re" { lex_string(cur[-1]); goto code; } -#line 2447 "src/parse/lex.cc" +#line 2446 "src/parse/lex.cc" yy396: yych = (YYCTYPE)*++YYCURSOR; if (yych == '*') goto yy406; @@ -2451,12 +2450,12 @@ yy396: goto yy390; yy397: ++YYCURSOR; -#line 496 "../src/parse/lex.re" +#line 495 "../src/parse/lex.re" { ++depth; goto code; } -#line 2457 "src/parse/lex.cc" +#line 2456 "src/parse/lex.cc" yy399: ++YYCURSOR; -#line 488 "../src/parse/lex.re" +#line 487 "../src/parse/lex.re" { if (--depth == 0) { yylval.code = new Code(loc, getstr(tok, cur)); @@ -2464,7 +2463,7 @@ yy399: } goto code; } -#line 2468 "src/parse/lex.cc" +#line 2467 "src/parse/lex.cc" yy401: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -2490,14 +2489,14 @@ yy404: } yy406: ++YYCURSOR; -#line 500 "../src/parse/lex.re" +#line 499 "../src/parse/lex.re" { lex_c_comment(); goto code; } -#line 2496 "src/parse/lex.cc" +#line 2495 "src/parse/lex.cc" yy408: ++YYCURSOR; -#line 501 "../src/parse/lex.re" +#line 500 "../src/parse/lex.re" { lex_cpp_comment(); goto code; } -#line 2501 "src/parse/lex.cc" +#line 2500 "src/parse/lex.cc" yy410: yych = (YYCTYPE)*++YYCURSOR; if (yych != 'i') goto yy403; @@ -2554,9 +2553,9 @@ yy418: yy420: ++YYCURSOR; YYCURSOR = yyt1; -#line 497 "../src/parse/lex.re" +#line 496 "../src/parse/lex.re" { set_sourceline (); goto code; } -#line 2560 "src/parse/lex.cc" +#line 2559 "src/parse/lex.cc" yy422: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy420; @@ -2582,7 +2581,7 @@ yy426: if (yych == '\n') goto yy403; goto yy423; } -#line 504 "../src/parse/lex.re" +#line 503 "../src/parse/lex.re" } @@ -2590,7 +2589,7 @@ void Scanner::lex_string(char delim) { loop: -#line 2594 "src/parse/lex.cc" +#line 2593 "src/parse/lex.cc" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -2616,29 +2615,29 @@ loop: } yy429: ++YYCURSOR; -#line 514 "../src/parse/lex.re" +#line 513 "../src/parse/lex.re" { fail_if_eof(); goto loop; } -#line 2622 "src/parse/lex.cc" +#line 2621 "src/parse/lex.cc" yy431: ++YYCURSOR; yy432: -#line 515 "../src/parse/lex.re" +#line 514 "../src/parse/lex.re" { goto loop; } -#line 2628 "src/parse/lex.cc" +#line 2627 "src/parse/lex.cc" yy433: ++YYCURSOR; -#line 513 "../src/parse/lex.re" +#line 512 "../src/parse/lex.re" { next_line(); goto loop; } -#line 2633 "src/parse/lex.cc" +#line 2632 "src/parse/lex.cc" yy435: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy433; goto yy432; yy436: ++YYCURSOR; -#line 511 "../src/parse/lex.re" +#line 510 "../src/parse/lex.re" { if (cur[-1] == delim) return; else goto loop; } -#line 2642 "src/parse/lex.cc" +#line 2641 "src/parse/lex.cc" yy438: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '&') { @@ -2649,11 +2648,11 @@ yy438: } yy439: ++YYCURSOR; -#line 512 "../src/parse/lex.re" +#line 511 "../src/parse/lex.re" { goto loop; } -#line 2655 "src/parse/lex.cc" +#line 2654 "src/parse/lex.cc" } -#line 516 "../src/parse/lex.re" +#line 515 "../src/parse/lex.re" } @@ -2661,7 +2660,7 @@ void Scanner::lex_c_comment() { loop: -#line 2665 "src/parse/lex.cc" +#line 2664 "src/parse/lex.cc" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -2677,20 +2676,20 @@ loop: } yy443: ++YYCURSOR; -#line 525 "../src/parse/lex.re" +#line 524 "../src/parse/lex.re" { fail_if_eof(); goto loop; } -#line 2683 "src/parse/lex.cc" +#line 2682 "src/parse/lex.cc" yy445: ++YYCURSOR; yy446: -#line 526 "../src/parse/lex.re" +#line 525 "../src/parse/lex.re" { goto loop; } -#line 2689 "src/parse/lex.cc" +#line 2688 "src/parse/lex.cc" yy447: ++YYCURSOR; -#line 524 "../src/parse/lex.re" +#line 523 "../src/parse/lex.re" { next_line(); goto loop; } -#line 2694 "src/parse/lex.cc" +#line 2693 "src/parse/lex.cc" yy449: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy447; @@ -2699,11 +2698,11 @@ yy450: yych = (YYCTYPE)*++YYCURSOR; if (yych != '/') goto yy446; ++YYCURSOR; -#line 523 "../src/parse/lex.re" +#line 522 "../src/parse/lex.re" { return; } -#line 2705 "src/parse/lex.cc" +#line 2704 "src/parse/lex.cc" } -#line 527 "../src/parse/lex.re" +#line 526 "../src/parse/lex.re" } @@ -2711,7 +2710,7 @@ void Scanner::lex_cpp_comment() { loop: -#line 2715 "src/parse/lex.cc" +#line 2714 "src/parse/lex.cc" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -2726,26 +2725,26 @@ loop: } yy455: ++YYCURSOR; -#line 535 "../src/parse/lex.re" +#line 534 "../src/parse/lex.re" { fail_if_eof(); goto loop; } -#line 2732 "src/parse/lex.cc" +#line 2731 "src/parse/lex.cc" yy457: ++YYCURSOR; yy458: -#line 536 "../src/parse/lex.re" +#line 535 "../src/parse/lex.re" { goto loop; } -#line 2738 "src/parse/lex.cc" +#line 2737 "src/parse/lex.cc" yy459: ++YYCURSOR; -#line 534 "../src/parse/lex.re" +#line 533 "../src/parse/lex.re" { next_line(); return; } -#line 2743 "src/parse/lex.cc" +#line 2742 "src/parse/lex.cc" yy461: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy459; goto yy458; } -#line 537 "../src/parse/lex.re" +#line 536 "../src/parse/lex.re" } @@ -2758,35 +2757,35 @@ const AST *Scanner::lex_cls(bool neg) fst: tok = cur; -#line 2762 "src/parse/lex.cc" +#line 2761 "src/parse/lex.cc" { YYCTYPE yych; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yych == ']') goto yy465; -#line 550 "../src/parse/lex.re" +#line 549 "../src/parse/lex.re" { l = lex_cls_chr(); goto snd; } -#line 2770 "src/parse/lex.cc" +#line 2769 "src/parse/lex.cc" yy465: ++YYCURSOR; -#line 549 "../src/parse/lex.re" +#line 548 "../src/parse/lex.re" { return ast_cls(loc0, cls, neg); } -#line 2775 "src/parse/lex.cc" +#line 2774 "src/parse/lex.cc" } -#line 551 "../src/parse/lex.re" +#line 550 "../src/parse/lex.re" snd: -#line 2781 "src/parse/lex.cc" +#line 2780 "src/parse/lex.cc" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = (YYCTYPE)*(YYMARKER = YYCURSOR); if (yych == '-') goto yy470; yy469: -#line 554 "../src/parse/lex.re" +#line 553 "../src/parse/lex.re" { u = l; goto add; } -#line 2790 "src/parse/lex.cc" +#line 2789 "src/parse/lex.cc" yy470: yych = (YYCTYPE)*++YYCURSOR; if (yych != ']') goto yy472; @@ -2795,18 +2794,18 @@ yy470: yy472: ++YYCURSOR; YYCURSOR -= 1; -#line 555 "../src/parse/lex.re" +#line 554 "../src/parse/lex.re" { u = lex_cls_chr(); if (l > u) { - warn.swapped_range(loc, l, u); + msg.warn.swapped_range(loc, l, u); std::swap(l, u); } goto add; } -#line 2808 "src/parse/lex.cc" +#line 2807 "src/parse/lex.cc" } -#line 563 "../src/parse/lex.re" +#line 562 "../src/parse/lex.re" add: cls->push_back(ASTRange(l, u, loc)); @@ -2819,7 +2818,7 @@ uint32_t Scanner::lex_cls_chr() tok = cur; const loc_t &loc = cur_loc(); -#line 2823 "src/parse/lex.cc" +#line 2822 "src/parse/lex.cc" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -2836,20 +2835,20 @@ uint32_t Scanner::lex_cls_chr() } yy476: ++YYCURSOR; -#line 576 "../src/parse/lex.re" +#line 575 "../src/parse/lex.re" { fail_if_eof(); return 0; } -#line 2842 "src/parse/lex.cc" +#line 2841 "src/parse/lex.cc" yy478: ++YYCURSOR; yy479: -#line 582 "../src/parse/lex.re" +#line 581 "../src/parse/lex.re" { return static_cast(tok[0]); } -#line 2848 "src/parse/lex.cc" +#line 2847 "src/parse/lex.cc" yy480: ++YYCURSOR; -#line 577 "../src/parse/lex.re" - { fatal(loc, "newline in character class"); } -#line 2853 "src/parse/lex.cc" +#line 576 "../src/parse/lex.re" + { msg.fatal(loc, "newline in character class"); } +#line 2852 "src/parse/lex.cc" yy482: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy480; @@ -2908,36 +2907,36 @@ yy483: } } yy484: -#line 580 "../src/parse/lex.re" - { fatal(loc, "syntax error in escape sequence"); } -#line 2914 "src/parse/lex.cc" +#line 579 "../src/parse/lex.re" + { msg.fatal(loc, "syntax error in escape sequence"); } +#line 2913 "src/parse/lex.cc" yy485: ++YYCURSOR; yy486: -#line 595 "../src/parse/lex.re" +#line 594 "../src/parse/lex.re" { - warn.useless_escape(loc, tok[1]); + msg.warn.useless_escape(loc, tok[1]); return static_cast(tok[1]); } -#line 2923 "src/parse/lex.cc" +#line 2922 "src/parse/lex.cc" yy487: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy480; goto yy486; yy488: ++YYCURSOR; -#line 593 "../src/parse/lex.re" +#line 592 "../src/parse/lex.re" { return static_cast('-'); } -#line 2932 "src/parse/lex.cc" +#line 2931 "src/parse/lex.cc" yy490: yyaccept = 0; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '/') goto yy491; if (yych <= '7') goto yy515; yy491: -#line 579 "../src/parse/lex.re" - { fatal(loc, "syntax error in octal escape sequence"); } -#line 2941 "src/parse/lex.cc" +#line 578 "../src/parse/lex.re" + { msg.fatal(loc, "syntax error in octal escape sequence"); } +#line 2940 "src/parse/lex.cc" yy492: ++YYCURSOR; goto yy491; @@ -2953,9 +2952,9 @@ yy493: if (yych <= 'f') goto yy517; } yy494: -#line 578 "../src/parse/lex.re" - { fatal(loc, "syntax error in hexadecimal escape sequence"); } -#line 2959 "src/parse/lex.cc" +#line 577 "../src/parse/lex.re" + { msg.fatal(loc, "syntax error in hexadecimal escape sequence"); } +#line 2958 "src/parse/lex.cc" yy495: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -2971,49 +2970,49 @@ yy495: } yy496: ++YYCURSOR; -#line 592 "../src/parse/lex.re" +#line 591 "../src/parse/lex.re" { return static_cast('\\'); } -#line 2977 "src/parse/lex.cc" +#line 2976 "src/parse/lex.cc" yy498: ++YYCURSOR; -#line 594 "../src/parse/lex.re" +#line 593 "../src/parse/lex.re" { return static_cast(']'); } -#line 2982 "src/parse/lex.cc" +#line 2981 "src/parse/lex.cc" yy500: ++YYCURSOR; -#line 585 "../src/parse/lex.re" +#line 584 "../src/parse/lex.re" { return static_cast('\a'); } -#line 2987 "src/parse/lex.cc" +#line 2986 "src/parse/lex.cc" yy502: ++YYCURSOR; -#line 586 "../src/parse/lex.re" +#line 585 "../src/parse/lex.re" { return static_cast('\b'); } -#line 2992 "src/parse/lex.cc" +#line 2991 "src/parse/lex.cc" yy504: ++YYCURSOR; -#line 587 "../src/parse/lex.re" +#line 586 "../src/parse/lex.re" { return static_cast('\f'); } -#line 2997 "src/parse/lex.cc" +#line 2996 "src/parse/lex.cc" yy506: ++YYCURSOR; -#line 588 "../src/parse/lex.re" +#line 587 "../src/parse/lex.re" { return static_cast('\n'); } -#line 3002 "src/parse/lex.cc" +#line 3001 "src/parse/lex.cc" yy508: ++YYCURSOR; -#line 589 "../src/parse/lex.re" +#line 588 "../src/parse/lex.re" { return static_cast('\r'); } -#line 3007 "src/parse/lex.cc" +#line 3006 "src/parse/lex.cc" yy510: ++YYCURSOR; -#line 590 "../src/parse/lex.re" +#line 589 "../src/parse/lex.re" { return static_cast('\t'); } -#line 3012 "src/parse/lex.cc" +#line 3011 "src/parse/lex.cc" yy512: ++YYCURSOR; -#line 591 "../src/parse/lex.re" +#line 590 "../src/parse/lex.re" { return static_cast('\v'); } -#line 3017 "src/parse/lex.cc" +#line 3016 "src/parse/lex.cc" yy514: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -3076,9 +3075,9 @@ yy519: } yy520: ++YYCURSOR; -#line 584 "../src/parse/lex.re" +#line 583 "../src/parse/lex.re" { return unesc_oct(tok, cur); } -#line 3082 "src/parse/lex.cc" +#line 3081 "src/parse/lex.cc" yy522: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { @@ -3105,9 +3104,9 @@ yy523: } yy524: ++YYCURSOR; -#line 583 "../src/parse/lex.re" +#line 582 "../src/parse/lex.re" { return unesc_hex(tok, cur); } -#line 3111 "src/parse/lex.cc" +#line 3110 "src/parse/lex.cc" yy526: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { @@ -3131,7 +3130,7 @@ yy527: goto yy516; } } -#line 599 "../src/parse/lex.re" +#line 598 "../src/parse/lex.re" } @@ -3142,7 +3141,7 @@ bool Scanner::lex_str_chr(char quote, ASTChar &ast) const loc_t &loc = ast.loc; bool ok = true; -#line 3146 "src/parse/lex.cc" +#line 3145 "src/parse/lex.cc" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -3159,20 +3158,20 @@ bool Scanner::lex_str_chr(char quote, ASTChar &ast) } yy530: ++YYCURSOR; -#line 615 "../src/parse/lex.re" +#line 614 "../src/parse/lex.re" { fail_if_eof(); ast.chr = 0; goto end; } -#line 3165 "src/parse/lex.cc" +#line 3164 "src/parse/lex.cc" yy532: ++YYCURSOR; yy533: -#line 617 "../src/parse/lex.re" +#line 616 "../src/parse/lex.re" { ok = tok[0] != quote; ast.chr = static_cast(tok[0]); goto end; } -#line 3171 "src/parse/lex.cc" +#line 3170 "src/parse/lex.cc" yy534: ++YYCURSOR; -#line 610 "../src/parse/lex.re" - { fatal(loc, "newline in character string"); } -#line 3176 "src/parse/lex.cc" +#line 609 "../src/parse/lex.re" + { msg.fatal(loc, "newline in character string"); } +#line 3175 "src/parse/lex.cc" yy536: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy534; @@ -3226,22 +3225,22 @@ yy537: } } yy538: -#line 613 "../src/parse/lex.re" - { fatal(loc, "syntax error in escape sequence"); } -#line 3232 "src/parse/lex.cc" +#line 612 "../src/parse/lex.re" + { msg.fatal(loc, "syntax error in escape sequence"); } +#line 3231 "src/parse/lex.cc" yy539: ++YYCURSOR; yy540: -#line 628 "../src/parse/lex.re" +#line 627 "../src/parse/lex.re" { const char c = tok[1]; ast.chr = static_cast(c); if (tok[1] != quote) { - warn.useless_escape(loc, c); + msg.warn.useless_escape(loc, c); } goto end; } -#line 3245 "src/parse/lex.cc" +#line 3244 "src/parse/lex.cc" yy541: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy534; @@ -3252,9 +3251,9 @@ yy542: if (yych <= '/') goto yy543; if (yych <= '7') goto yy565; yy543: -#line 612 "../src/parse/lex.re" - { fatal(loc, "syntax error in octal escape sequence"); } -#line 3258 "src/parse/lex.cc" +#line 611 "../src/parse/lex.re" + { msg.fatal(loc, "syntax error in octal escape sequence"); } +#line 3257 "src/parse/lex.cc" yy544: ++YYCURSOR; goto yy543; @@ -3270,9 +3269,9 @@ yy545: if (yych <= 'f') goto yy567; } yy546: -#line 611 "../src/parse/lex.re" - { fatal(loc, "syntax error in hexadecimal escape sequence"); } -#line 3276 "src/parse/lex.cc" +#line 610 "../src/parse/lex.re" + { msg.fatal(loc, "syntax error in hexadecimal escape sequence"); } +#line 3275 "src/parse/lex.cc" yy547: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -3288,44 +3287,44 @@ yy547: } yy548: ++YYCURSOR; -#line 627 "../src/parse/lex.re" +#line 626 "../src/parse/lex.re" { ast.chr = static_cast('\\'); goto end; } -#line 3294 "src/parse/lex.cc" +#line 3293 "src/parse/lex.cc" yy550: ++YYCURSOR; -#line 620 "../src/parse/lex.re" +#line 619 "../src/parse/lex.re" { ast.chr = static_cast('\a'); goto end; } -#line 3299 "src/parse/lex.cc" +#line 3298 "src/parse/lex.cc" yy552: ++YYCURSOR; -#line 621 "../src/parse/lex.re" +#line 620 "../src/parse/lex.re" { ast.chr = static_cast('\b'); goto end; } -#line 3304 "src/parse/lex.cc" +#line 3303 "src/parse/lex.cc" yy554: ++YYCURSOR; -#line 622 "../src/parse/lex.re" +#line 621 "../src/parse/lex.re" { ast.chr = static_cast('\f'); goto end; } -#line 3309 "src/parse/lex.cc" +#line 3308 "src/parse/lex.cc" yy556: ++YYCURSOR; -#line 623 "../src/parse/lex.re" +#line 622 "../src/parse/lex.re" { ast.chr = static_cast('\n'); goto end; } -#line 3314 "src/parse/lex.cc" +#line 3313 "src/parse/lex.cc" yy558: ++YYCURSOR; -#line 624 "../src/parse/lex.re" +#line 623 "../src/parse/lex.re" { ast.chr = static_cast('\r'); goto end; } -#line 3319 "src/parse/lex.cc" +#line 3318 "src/parse/lex.cc" yy560: ++YYCURSOR; -#line 625 "../src/parse/lex.re" +#line 624 "../src/parse/lex.re" { ast.chr = static_cast('\t'); goto end; } -#line 3324 "src/parse/lex.cc" +#line 3323 "src/parse/lex.cc" yy562: ++YYCURSOR; -#line 626 "../src/parse/lex.re" +#line 625 "../src/parse/lex.re" { ast.chr = static_cast('\v'); goto end; } -#line 3329 "src/parse/lex.cc" +#line 3328 "src/parse/lex.cc" yy564: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -3388,9 +3387,9 @@ yy569: } yy570: ++YYCURSOR; -#line 619 "../src/parse/lex.re" +#line 618 "../src/parse/lex.re" { ast.chr = unesc_oct(tok, cur); goto end; } -#line 3394 "src/parse/lex.cc" +#line 3393 "src/parse/lex.cc" yy572: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { @@ -3417,9 +3416,9 @@ yy573: } yy574: ++YYCURSOR; -#line 618 "../src/parse/lex.re" +#line 617 "../src/parse/lex.re" { ast.chr = unesc_hex(tok, cur); goto end; } -#line 3423 "src/parse/lex.cc" +#line 3422 "src/parse/lex.cc" yy576: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { @@ -3443,7 +3442,7 @@ yy577: goto yy566; } } -#line 636 "../src/parse/lex.re" +#line 635 "../src/parse/lex.re" end: return ok; @@ -3467,7 +3466,7 @@ void Scanner::set_sourceline () sourceline: tok = cur; -#line 3471 "src/parse/lex.cc" +#line 3470 "src/parse/lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -3525,20 +3524,20 @@ sourceline: } } ++YYCURSOR; -#line 676 "../src/parse/lex.re" +#line 678 "../src/parse/lex.re" { --cur; return; } -#line 3531 "src/parse/lex.cc" +#line 3530 "src/parse/lex.cc" yy582: ++YYCURSOR; yy583: -#line 677 "../src/parse/lex.re" +#line 679 "../src/parse/lex.re" { goto sourceline; } -#line 3537 "src/parse/lex.cc" +#line 3536 "src/parse/lex.cc" yy584: ++YYCURSOR; -#line 675 "../src/parse/lex.re" +#line 677 "../src/parse/lex.re" { pos = tok = cur; return; } -#line 3542 "src/parse/lex.cc" +#line 3541 "src/parse/lex.cc" yy586: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy584; @@ -3555,16 +3554,16 @@ yy588: if (yybm[0+yych] & 64) { goto yy588; } -#line 659 "../src/parse/lex.re" +#line 658 "../src/parse/lex.re" { uint32_t l; if (!s_to_u32_unsafe(tok, cur, l)) { - fatal(tok_loc(), "line number overflow"); + msg.fatal(tok_loc(), "line number overflow"); } set_line(l); goto sourceline; } -#line 3568 "src/parse/lex.cc" +#line 3567 "src/parse/lex.cc" yy591: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -3581,14 +3580,17 @@ yy593: goto yy583; yy594: ++YYCURSOR; -#line 668 "../src/parse/lex.re" +#line 667 "../src/parse/lex.re" { - std::string &name = get_input().escaped_name; + Input &in = get_input(); + std::string &name = in.escaped_name; name = getstr(tok + 1, cur - 1); strrreplace(name, "\\", "\\\\"); + in.fidx = static_cast(msg.filenames.size()); + msg.filenames.push_back(name); goto sourceline; } -#line 3592 "src/parse/lex.cc" +#line 3594 "src/parse/lex.cc" yy596: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -3597,14 +3599,14 @@ yy596: if (yych == '\n') goto yy593; goto yy591; } -#line 678 "../src/parse/lex.re" +#line 680 "../src/parse/lex.re" } void Scanner::fail_if_eof() const { if (is_eof()) { - fatal(cur_loc(), "unexpected end of input"); + msg.fatal(cur_loc(), "unexpected end of input"); } } diff --git a/re2c/bootstrap/src/parse/lex.h b/re2c/bootstrap/src/parse/lex.h index 6157ff19..fdbb2929 100644 --- a/re2c/bootstrap/src/parse/lex.h +++ b/re2c/bootstrap/src/parse/lex.h @@ -1,4 +1,4 @@ -/* Generated by re2c 1.1.1 on Tue Feb 12 17:26:39 2019 */ +/* Generated by re2c 1.1.1 on Tue Feb 12 22:50:47 2019 */ #include #include "src/util/forbid_copy.h" diff --git a/re2c/bootstrap/src/parse/lex_conf.cc b/re2c/bootstrap/src/parse/lex_conf.cc index 0ab7669d..6ce54f6d 100644 --- a/re2c/bootstrap/src/parse/lex_conf.cc +++ b/re2c/bootstrap/src/parse/lex_conf.cc @@ -1,10 +1,9 @@ -/* Generated by re2c 1.1.1 on Tue Feb 12 17:07:55 2019 */ +/* Generated by re2c 1.1.1 on Tue Feb 12 22:50:47 2019 */ #line 1 "../src/parse/lex_conf.re" #include "src/util/c99_stdint.h" #include #include "src/codegen/output.h" -#include "src/options/msg.h" #include "src/encoding/enc.h" #include "src/parse/ast.h" #include "src/parse/scanner.h" @@ -17,14 +16,14 @@ namespace re2c #define YYFILL(n) { if (!fill (n)) fatal("unexpected end of input"); } // global re2c config (affects the whole file) -#line 38 "../src/parse/lex_conf.re" +#line 37 "../src/parse/lex_conf.re" void Scanner::lex_conf(Opt &opts) { tok = cur; -#line 28 "src/parse/lex_conf.cc" +#line 27 "src/parse/lex_conf.cc" { unsigned char yych; unsigned int yyaccept = 0; @@ -105,12 +104,12 @@ void Scanner::lex_conf(Opt &opts) } } yy2: -#line 174 "../src/parse/lex_conf.re" +#line 173 "../src/parse/lex_conf.re" { - fatal(tok_loc(), "unrecognized configuration '%.*s'", + msg.fatal(tok_loc(), "unrecognized configuration '%.*s'", static_cast(cur - tok), tok); } -#line 114 "src/parse/lex_conf.cc" +#line 113 "src/parse/lex_conf.cc" yy3: ++cur; if (lim <= cur) YYFILL(1); @@ -228,16 +227,16 @@ yy29: if (yybm[0+yych] & 32) { goto yy3; } -#line 72 "../src/parse/lex_conf.re" +#line 71 "../src/parse/lex_conf.re" { const int32_t eof = lex_conf_number(); if (eof < 0) { - fatal(cur_loc(), "eof cannot have negative value"); + msg.fatal(cur_loc(), "eof cannot have negative value"); } opts.set_eof(static_cast(eof)); return; } -#line 241 "src/parse/lex_conf.cc" +#line 240 "src/parse/lex_conf.cc" yy31: yych = (unsigned char)*++cur; if (yych == 'g') goto yy43; @@ -521,30 +520,30 @@ yy93: if (yybm[0+yych] & 32) { goto yy3; } -#line 66 "../src/parse/lex_conf.re" +#line 65 "../src/parse/lex_conf.re" { lex_conf_enc(Enc::UTF8, opts); return; } -#line 527 "src/parse/lex_conf.cc" +#line 526 "src/parse/lex_conf.cc" yy95: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 55 "../src/parse/lex_conf.re" +#line 54 "../src/parse/lex_conf.re" { bool b = lex_conf_bool(); opts.set_posix_syntax(b); opts.set_posix_semantics(b); return; } -#line 540 "src/parse/lex_conf.cc" +#line 539 "src/parse/lex_conf.cc" yy97: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 49 "../src/parse/lex_conf.re" +#line 48 "../src/parse/lex_conf.re" { opts.set_tags (lex_conf_bool()); return; } -#line 548 "src/parse/lex_conf.cc" +#line 547 "src/parse/lex_conf.cc" yy99: yych = (unsigned char)*++cur; if (yych <= 'Z') { @@ -563,9 +562,9 @@ yy99: } } yy100: -#line 44 "../src/parse/lex_conf.re" +#line 43 "../src/parse/lex_conf.re" { opts.set_bFlag (lex_conf_bool()); return; } -#line 569 "src/parse/lex_conf.cc" +#line 568 "src/parse/lex_conf.cc" yy101: yych = (unsigned char)*++cur; if (yych == 'a') goto yy144; @@ -589,9 +588,9 @@ yy102: } } yy103: -#line 45 "../src/parse/lex_conf.re" +#line 44 "../src/parse/lex_conf.re" { opts.set_dFlag (lex_conf_bool()); return; } -#line 595 "src/parse/lex_conf.cc" +#line 594 "src/parse/lex_conf.cc" yy104: yych = (unsigned char)*++cur; if (yych <= '_') { @@ -615,17 +614,17 @@ yy104: } } yy105: -#line 62 "../src/parse/lex_conf.re" +#line 61 "../src/parse/lex_conf.re" { lex_conf_enc(Enc::EBCDIC, opts); return; } -#line 621 "src/parse/lex_conf.cc" +#line 620 "src/parse/lex_conf.cc" yy106: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 46 "../src/parse/lex_conf.re" +#line 45 "../src/parse/lex_conf.re" { opts.set_gFlag (lex_conf_bool()); return; } -#line 629 "src/parse/lex_conf.cc" +#line 628 "src/parse/lex_conf.cc" yy108: yych = (unsigned char)*++cur; if (yych <= 'Z') { @@ -644,9 +643,9 @@ yy108: } } yy109: -#line 47 "../src/parse/lex_conf.re" +#line 46 "../src/parse/lex_conf.re" { opts.set_iFlag (lex_conf_bool()); return; } -#line 650 "src/parse/lex_conf.cc" +#line 649 "src/parse/lex_conf.cc" yy110: yych = (unsigned char)*++cur; if (yych == 'e') goto yy151; @@ -670,9 +669,9 @@ yy111: } } yy112: -#line 52 "../src/parse/lex_conf.re" +#line 51 "../src/parse/lex_conf.re" { opts.set_output_file (lex_conf_string()); return; } -#line 676 "src/parse/lex_conf.cc" +#line 675 "src/parse/lex_conf.cc" yy113: yych = (unsigned char)*++cur; if (yych == 'o') goto yy154; @@ -682,9 +681,9 @@ yy114: if (yybm[0+yych] & 32) { goto yy3; } -#line 48 "../src/parse/lex_conf.re" +#line 47 "../src/parse/lex_conf.re" { opts.set_sFlag (lex_conf_bool()); return; } -#line 688 "src/parse/lex_conf.cc" +#line 687 "src/parse/lex_conf.cc" yy116: yych = (unsigned char)*++cur; if (yych <= '^') { @@ -705,9 +704,9 @@ yy116: } } yy117: -#line 53 "../src/parse/lex_conf.re" +#line 52 "../src/parse/lex_conf.re" { opts.set_header_file (lex_conf_string()); return; } -#line 711 "src/parse/lex_conf.cc" +#line 710 "src/parse/lex_conf.cc" yy118: yych = (unsigned char)*++cur; if (yych <= '^') { @@ -729,9 +728,9 @@ yy118: } } yy119: -#line 63 "../src/parse/lex_conf.re" +#line 62 "../src/parse/lex_conf.re" { lex_conf_enc(Enc::UTF32, opts); return; } -#line 735 "src/parse/lex_conf.cc" +#line 734 "src/parse/lex_conf.cc" yy120: yych = (unsigned char)*++cur; if (yych <= 'Z') { @@ -750,17 +749,17 @@ yy120: } } yy121: -#line 64 "../src/parse/lex_conf.re" +#line 63 "../src/parse/lex_conf.re" { lex_conf_enc(Enc::UCS2, opts); return; } -#line 756 "src/parse/lex_conf.cc" +#line 755 "src/parse/lex_conf.cc" yy122: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 65 "../src/parse/lex_conf.re" +#line 64 "../src/parse/lex_conf.re" { lex_conf_enc(Enc::UTF16, opts); return; } -#line 764 "src/parse/lex_conf.cc" +#line 763 "src/parse/lex_conf.cc" yy124: yych = (unsigned char)*++cur; if (yych <= 'r') goto yy4; @@ -959,9 +958,9 @@ yy170: if (yybm[0+yych] & 32) { goto yy3; } -#line 109 "../src/parse/lex_conf.re" +#line 108 "../src/parse/lex_conf.re" { opts.set_yybmHexTable (lex_conf_bool()); return; } -#line 965 "src/parse/lex_conf.cc" +#line 964 "src/parse/lex_conf.cc" yy172: yych = (unsigned char)*++cur; if (yych == 'v') goto yy212; @@ -998,9 +997,9 @@ yy179: } if (yych == '@') goto yy220; yy180: -#line 93 "../src/parse/lex_conf.re" +#line 92 "../src/parse/lex_conf.re" { opts.set_condGoto (lex_conf_string ()); return; } -#line 1004 "src/parse/lex_conf.cc" +#line 1003 "src/parse/lex_conf.cc" yy181: yych = (unsigned char)*++cur; if (yych == 'r') goto yy222; @@ -1147,9 +1146,9 @@ yy213: if (yybm[0+yych] & 32) { goto yy3; } -#line 156 "../src/parse/lex_conf.re" +#line 155 "../src/parse/lex_conf.re" { opts.set_bEmitYYCh (lex_conf_bool()); return; } -#line 1153 "src/parse/lex_conf.cc" +#line 1152 "src/parse/lex_conf.cc" yy215: yych = (unsigned char)*++cur; if (yych == 'e') goto yy264; @@ -1205,9 +1204,9 @@ yy223: if (yybm[0+yych] & 32) { goto yy3; } -#line 89 "../src/parse/lex_conf.re" +#line 88 "../src/parse/lex_conf.re" { opts.set_condPrefix (lex_conf_string ()); return; } -#line 1211 "src/parse/lex_conf.cc" +#line 1210 "src/parse/lex_conf.cc" yy225: yych = (unsigned char)*++cur; if (yych == 'A') goto yy271; @@ -1332,16 +1331,16 @@ yy251: if (yybm[0+yych] & 32) { goto yy3; } -#line 142 "../src/parse/lex_conf.re" +#line 141 "../src/parse/lex_conf.re" { const int32_t n = lex_conf_number (); if (n < 0) { - fatal(cur_loc(), "configuration 'indent:top' must be nonnegative"); + msg.fatal(cur_loc(), "configuration 'indent:top' must be nonnegative"); } opts.set_topIndent (static_cast (n)); return; } -#line 1345 "src/parse/lex_conf.cc" +#line 1344 "src/parse/lex_conf.cc" yy253: yych = (unsigned char)*++cur; if (yych == 'l') goto yy304; @@ -1376,9 +1375,9 @@ yy256: } } yy257: -#line 169 "../src/parse/lex_conf.re" +#line 168 "../src/parse/lex_conf.re" { opts.set_startlabel (lex_conf_string()); return; } -#line 1382 "src/parse/lex_conf.cc" +#line 1381 "src/parse/lex_conf.cc" yy258: yych = (unsigned char)*++cur; if (yych == 't') goto yy312; @@ -1526,9 +1525,9 @@ yy293: if (yybm[0+yych] & 32) { goto yy3; } -#line 69 "../src/parse/lex_conf.re" +#line 68 "../src/parse/lex_conf.re" { lex_conf_input(opts); return; } -#line 1532 "src/parse/lex_conf.cc" +#line 1531 "src/parse/lex_conf.cc" yy295: yych = (unsigned char)*++cur; if (yych == 'd') goto yy351; @@ -1578,9 +1577,9 @@ yy306: if (yybm[0+yych] & 32) { goto yy3; } -#line 165 "../src/parse/lex_conf.re" +#line 164 "../src/parse/lex_conf.re" { opts.set_labelPrefix (lex_conf_string ()); return; } -#line 1584 "src/parse/lex_conf.cc" +#line 1583 "src/parse/lex_conf.cc" yy308: ++cur; if (lim <= cur) YYFILL(1); @@ -1616,9 +1615,9 @@ yy312: if (yybm[0+yych] & 32) { goto yy3; } -#line 104 "../src/parse/lex_conf.re" +#line 103 "../src/parse/lex_conf.re" { opts.set_bUseStateAbort (lex_conf_bool()); return; } -#line 1622 "src/parse/lex_conf.cc" +#line 1621 "src/parse/lex_conf.cc" yy314: yych = (unsigned char)*++cur; if (yych == 'a') goto yy367; @@ -1632,9 +1631,9 @@ yy316: if (yybm[0+yych] & 32) { goto yy3; } -#line 138 "../src/parse/lex_conf.re" +#line 137 "../src/parse/lex_conf.re" { opts.set_tags_prefix (lex_conf_string ()); return; } -#line 1638 "src/parse/lex_conf.cc" +#line 1637 "src/parse/lex_conf.cc" yy318: yych = (unsigned char)*++cur; if (yych <= 'c') { @@ -1676,9 +1675,9 @@ yy324: } if (yych == '@') goto yy380; yy325: -#line 91 "../src/parse/lex_conf.re" +#line 90 "../src/parse/lex_conf.re" { opts.set_condDivider (lex_conf_string ()); return; } -#line 1682 "src/parse/lex_conf.cc" +#line 1681 "src/parse/lex_conf.cc" yy326: yych = (unsigned char)*++cur; if (yych == 'n') goto yy381; @@ -1824,9 +1823,9 @@ yy360: if (yybm[0+yych] & 32) { goto yy3; } -#line 103 "../src/parse/lex_conf.re" +#line 102 "../src/parse/lex_conf.re" { opts.set_yynext (lex_conf_string ()); return; } -#line 1830 "src/parse/lex_conf.cc" +#line 1829 "src/parse/lex_conf.cc" yy362: yych = (unsigned char)*++cur; if (yych <= '0') goto yy221; @@ -1836,9 +1835,9 @@ yy363: ++cur; yy364: cur = ctx; -#line 168 "../src/parse/lex_conf.re" +#line 167 "../src/parse/lex_conf.re" { opts.set_startlabel_force (lex_conf_bool()); return; } -#line 1842 "src/parse/lex_conf.cc" +#line 1841 "src/parse/lex_conf.cc" yy365: ++cur; if (lim <= cur) YYFILL(1); @@ -1885,9 +1884,9 @@ yy375: if (yybm[0+yych] & 32) { goto yy3; } -#line 163 "../src/parse/lex_conf.re" +#line 162 "../src/parse/lex_conf.re" { opts.set_fill_check (lex_conf_bool()); return; } -#line 1891 "src/parse/lex_conf.cc" +#line 1890 "src/parse/lex_conf.cc" yy377: yych = (unsigned char)*++cur; if (yych == 'e') goto yy431; @@ -1956,9 +1955,9 @@ yy389: } } yy390: -#line 158 "../src/parse/lex_conf.re" +#line 157 "../src/parse/lex_conf.re" { opts.set_fill (lex_conf_string ()); return; } -#line 1962 "src/parse/lex_conf.cc" +#line 1961 "src/parse/lex_conf.cc" yy391: yych = (unsigned char)*++cur; if (yych == 'O') goto yy450; @@ -1989,9 +1988,9 @@ yy397: if (yybm[0+yych] & 32) { goto yy3; } -#line 125 "../src/parse/lex_conf.re" +#line 124 "../src/parse/lex_conf.re" { opts.set_yypeek (lex_conf_string ()); return; } -#line 1995 "src/parse/lex_conf.cc" +#line 1994 "src/parse/lex_conf.cc" yy399: yych = (unsigned char)*++cur; if (yych == 'O') goto yy460; @@ -2009,9 +2008,9 @@ yy402: if (yybm[0+yych] & 32) { goto yy3; } -#line 126 "../src/parse/lex_conf.re" +#line 125 "../src/parse/lex_conf.re" { opts.set_yyskip (lex_conf_string ()); return; } -#line 2015 "src/parse/lex_conf.cc" +#line 2014 "src/parse/lex_conf.cc" yy404: yych = (unsigned char)*++cur; if (yych == 'N') goto yy463; @@ -2073,9 +2072,9 @@ yy417: if (yybm[0+yych] & 32) { goto yy3; } -#line 141 "../src/parse/lex_conf.re" +#line 140 "../src/parse/lex_conf.re" { opts.set_indString (lex_conf_string ()); return; } -#line 2079 "src/parse/lex_conf.cc" +#line 2078 "src/parse/lex_conf.cc" yy419: yych = (unsigned char)*++cur; if (yych == 'a') goto yy479; @@ -2097,17 +2096,17 @@ yy423: if (yybm[0+yych] & 32) { goto yy3; } -#line 108 "../src/parse/lex_conf.re" +#line 107 "../src/parse/lex_conf.re" { opts.set_yybm (lex_conf_string ()); return; } -#line 2103 "src/parse/lex_conf.cc" +#line 2102 "src/parse/lex_conf.cc" yy425: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 154 "../src/parse/lex_conf.re" +#line 153 "../src/parse/lex_conf.re" { opts.set_yych (lex_conf_string ()); return; } -#line 2111 "src/parse/lex_conf.cc" +#line 2110 "src/parse/lex_conf.cc" yy427: yych = (unsigned char)*++cur; if (yych == 'a') goto yy483; @@ -2129,9 +2128,9 @@ yy431: if (yybm[0+yych] & 32) { goto yy3; } -#line 159 "../src/parse/lex_conf.re" +#line 158 "../src/parse/lex_conf.re" { opts.set_fill_use (lex_conf_bool()); return; } -#line 2135 "src/parse/lex_conf.cc" +#line 2134 "src/parse/lex_conf.cc" yy433: yych = (unsigned char)*++cur; if (yych == 't') goto yy487; @@ -2146,17 +2145,17 @@ yy435: goto yy221; yy436: ++cur; -#line 94 "../src/parse/lex_conf.re" +#line 93 "../src/parse/lex_conf.re" { opts.set_condGotoParam (lex_conf_string ()); return; } -#line 2152 "src/parse/lex_conf.cc" +#line 2151 "src/parse/lex_conf.cc" yy438: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 90 "../src/parse/lex_conf.re" +#line 89 "../src/parse/lex_conf.re" { opts.set_condEnumPrefix (lex_conf_string ()); return; } -#line 2160 "src/parse/lex_conf.cc" +#line 2159 "src/parse/lex_conf.cc" yy440: yych = (unsigned char)*++cur; if (yych == 'P') goto yy491; @@ -2174,9 +2173,9 @@ yy443: if (yybm[0+yych] & 32) { goto yy3; } -#line 153 "../src/parse/lex_conf.re" +#line 152 "../src/parse/lex_conf.re" { opts.set_yyctype (lex_conf_string ()); return; } -#line 2180 "src/parse/lex_conf.cc" +#line 2179 "src/parse/lex_conf.cc" yy445: yych = (unsigned char)*++cur; if (yych == 'R') goto yy495; @@ -2186,9 +2185,9 @@ yy446: if (yybm[0+yych] & 32) { goto yy3; } -#line 151 "../src/parse/lex_conf.re" +#line 150 "../src/parse/lex_conf.re" { opts.set_yydebug (lex_conf_string ()); return; } -#line 2192 "src/parse/lex_conf.cc" +#line 2191 "src/parse/lex_conf.cc" yy448: yych = (unsigned char)*++cur; if (yych == 'n') goto yy497; @@ -2214,9 +2213,9 @@ yy453: if (yybm[0+yych] & 32) { goto yy3; } -#line 123 "../src/parse/lex_conf.re" +#line 122 "../src/parse/lex_conf.re" { opts.set_yylimit (lex_conf_string ()); return; } -#line 2220 "src/parse/lex_conf.cc" +#line 2219 "src/parse/lex_conf.cc" yy455: yych = (unsigned char)*++cur; if (yych == 'R') goto yy502; @@ -2226,17 +2225,17 @@ yy456: if (yybm[0+yych] & 32) { goto yy3; } -#line 135 "../src/parse/lex_conf.re" +#line 134 "../src/parse/lex_conf.re" { opts.set_yymtagn (lex_conf_string ()); return; } -#line 2232 "src/parse/lex_conf.cc" +#line 2231 "src/parse/lex_conf.cc" yy458: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 136 "../src/parse/lex_conf.re" +#line 135 "../src/parse/lex_conf.re" { opts.set_yymtagp (lex_conf_string ()); return; } -#line 2240 "src/parse/lex_conf.cc" +#line 2239 "src/parse/lex_conf.cc" yy460: yych = (unsigned char)*++cur; if (yych == 'R') goto yy504; @@ -2254,17 +2253,17 @@ yy463: if (yybm[0+yych] & 32) { goto yy3; } -#line 133 "../src/parse/lex_conf.re" +#line 132 "../src/parse/lex_conf.re" { opts.set_yystagn (lex_conf_string ()); return; } -#line 2260 "src/parse/lex_conf.cc" +#line 2259 "src/parse/lex_conf.cc" yy465: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 134 "../src/parse/lex_conf.re" +#line 133 "../src/parse/lex_conf.re" { opts.set_yystagp (lex_conf_string ()); return; } -#line 2268 "src/parse/lex_conf.cc" +#line 2267 "src/parse/lex_conf.cc" yy467: yych = (unsigned char)*++cur; if (yych == 'o') goto yy507; @@ -2354,16 +2353,16 @@ yy488: if (yybm[0+yych] & 32) { goto yy3; } -#line 110 "../src/parse/lex_conf.re" +#line 109 "../src/parse/lex_conf.re" { const int32_t n = lex_conf_number (); if (n < 0) { - fatal(cur_loc(), "configuration 'cgoto:threshold' must be nonnegative"); + msg.fatal(cur_loc(), "configuration 'cgoto:threshold' must be nonnegative"); } opts.set_cGotoThreshold (static_cast (n)); return; } -#line 2367 "src/parse/lex_conf.cc" +#line 2366 "src/parse/lex_conf.cc" yy490: yych = (unsigned char)*++cur; if (yych == 'n') goto yy531; @@ -2387,9 +2386,9 @@ yy491: } } yy492: -#line 127 "../src/parse/lex_conf.re" +#line 126 "../src/parse/lex_conf.re" { opts.set_yybackup (lex_conf_string ()); return; } -#line 2393 "src/parse/lex_conf.cc" +#line 2392 "src/parse/lex_conf.cc" yy493: yych = (unsigned char)*++cur; if (yych == 'P') goto yy533; @@ -2403,9 +2402,9 @@ yy495: if (yybm[0+yych] & 32) { goto yy3; } -#line 120 "../src/parse/lex_conf.re" +#line 119 "../src/parse/lex_conf.re" { opts.set_yycursor (lex_conf_string ()); return; } -#line 2409 "src/parse/lex_conf.cc" +#line 2408 "src/parse/lex_conf.cc" yy497: yych = (unsigned char)*++cur; if (yych == 'a') goto yy535; @@ -2431,9 +2430,9 @@ yy502: if (yybm[0+yych] & 32) { goto yy3; } -#line 121 "../src/parse/lex_conf.re" +#line 120 "../src/parse/lex_conf.re" { opts.set_yymarker (lex_conf_string ()); return; } -#line 2437 "src/parse/lex_conf.cc" +#line 2436 "src/parse/lex_conf.cc" yy504: yych = (unsigned char)*++cur; if (yych == 'E') goto yy540; @@ -2503,17 +2502,17 @@ yy520: if (yybm[0+yych] & 32) { goto yy3; } -#line 105 "../src/parse/lex_conf.re" +#line 104 "../src/parse/lex_conf.re" { opts.set_bUseStateNext (lex_conf_bool()); return; } -#line 2509 "src/parse/lex_conf.cc" +#line 2508 "src/parse/lex_conf.cc" yy522: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 139 "../src/parse/lex_conf.re" +#line 138 "../src/parse/lex_conf.re" { opts.set_tags_expression(lex_conf_string ()); return; } -#line 2517 "src/parse/lex_conf.cc" +#line 2516 "src/parse/lex_conf.cc" yy524: yych = (unsigned char)*++cur; if (yych == 'p') goto yy556; @@ -2535,9 +2534,9 @@ yy528: if (yybm[0+yych] & 32) { goto yy3; } -#line 155 "../src/parse/lex_conf.re" +#line 154 "../src/parse/lex_conf.re" { opts.set_yychConversion (lex_conf_bool()); return; } -#line 2541 "src/parse/lex_conf.cc" +#line 2540 "src/parse/lex_conf.cc" yy530: yych = (unsigned char)*++cur; if (yych == 'r') goto yy560; @@ -2599,9 +2598,9 @@ yy540: } } yy541: -#line 129 "../src/parse/lex_conf.re" +#line 128 "../src/parse/lex_conf.re" { opts.set_yyrestore (lex_conf_string ()); return; } -#line 2605 "src/parse/lex_conf.cc" +#line 2604 "src/parse/lex_conf.cc" yy542: yych = (unsigned char)*++cur; if (yych == 'I') goto yy578; @@ -2681,14 +2680,14 @@ yy560: if (yybm[0+yych] & 32) { goto yy3; } -#line 161 "../src/parse/lex_conf.re" +#line 160 "../src/parse/lex_conf.re" { opts.set_fill_arg_use (lex_conf_bool()); return; } -#line 2687 "src/parse/lex_conf.cc" +#line 2686 "src/parse/lex_conf.cc" yy562: ++cur; -#line 92 "../src/parse/lex_conf.re" +#line 91 "../src/parse/lex_conf.re" { opts.set_condDividerParam (lex_conf_string ()); return; } -#line 2692 "src/parse/lex_conf.cc" +#line 2691 "src/parse/lex_conf.cc" yy564: yych = (unsigned char)*++cur; if (yych == 'X') goto yy602; @@ -2698,9 +2697,9 @@ yy565: if (yybm[0+yych] & 32) { goto yy3; } -#line 83 "../src/parse/lex_conf.re" +#line 82 "../src/parse/lex_conf.re" { opts.set_yycondtype (lex_conf_string ()); return; } -#line 2704 "src/parse/lex_conf.cc" +#line 2703 "src/parse/lex_conf.cc" yy567: yych = (unsigned char)*++cur; if (yych == 'R') goto yy604; @@ -2711,9 +2710,9 @@ yy568: goto yy4; yy569: ++cur; -#line 160 "../src/parse/lex_conf.re" +#line 159 "../src/parse/lex_conf.re" { opts.set_fill_arg (lex_conf_string ()); return; } -#line 2717 "src/parse/lex_conf.cc" +#line 2716 "src/parse/lex_conf.cc" yy571: yych = (unsigned char)*++cur; if (yych == 'T') goto yy607; @@ -2737,17 +2736,17 @@ yy572: } } yy573: -#line 97 "../src/parse/lex_conf.re" +#line 96 "../src/parse/lex_conf.re" { opts.set_state_get (lex_conf_string ()); return; } -#line 2743 "src/parse/lex_conf.cc" +#line 2742 "src/parse/lex_conf.cc" yy574: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 132 "../src/parse/lex_conf.re" +#line 131 "../src/parse/lex_conf.re" { opts.set_yylessthan (lex_conf_string ()); return; } -#line 2751 "src/parse/lex_conf.cc" +#line 2750 "src/parse/lex_conf.cc" yy576: yych = (unsigned char)*++cur; if (yych == 'T') goto yy609; @@ -2780,9 +2779,9 @@ yy579: } } yy580: -#line 99 "../src/parse/lex_conf.re" +#line 98 "../src/parse/lex_conf.re" { opts.set_state_set (lex_conf_string ()); return; } -#line 2786 "src/parse/lex_conf.cc" +#line 2785 "src/parse/lex_conf.cc" yy581: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { @@ -2810,9 +2809,9 @@ yy586: if (yybm[0+yych] & 32) { goto yy3; } -#line 70 "../src/parse/lex_conf.re" +#line 69 "../src/parse/lex_conf.re" { lex_conf_empty_class(opts); return; } -#line 2816 "src/parse/lex_conf.cc" +#line 2815 "src/parse/lex_conf.cc" yy588: yych = (unsigned char)*++cur; if (yych == 'l') goto yy618; @@ -2836,57 +2835,57 @@ yy592: if (yybm[0+yych] & 32) { goto yy3; } -#line 102 "../src/parse/lex_conf.re" +#line 101 "../src/parse/lex_conf.re" { opts.set_yyfilllabel (lex_conf_string ()); return; } -#line 2842 "src/parse/lex_conf.cc" +#line 2841 "src/parse/lex_conf.cc" yy594: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 106 "../src/parse/lex_conf.re" +#line 105 "../src/parse/lex_conf.re" { opts.set_yyaccept (lex_conf_string ()); return; } -#line 2850 "src/parse/lex_conf.cc" +#line 2849 "src/parse/lex_conf.cc" yy596: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 95 "../src/parse/lex_conf.re" +#line 94 "../src/parse/lex_conf.re" { opts.set_yyctable (lex_conf_string ()); return; } -#line 2858 "src/parse/lex_conf.cc" +#line 2857 "src/parse/lex_conf.cc" yy598: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 172 "../src/parse/lex_conf.re" +#line 171 "../src/parse/lex_conf.re" { lex_conf_string (); return; } -#line 2866 "src/parse/lex_conf.cc" +#line 2865 "src/parse/lex_conf.cc" yy600: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 118 "../src/parse/lex_conf.re" +#line 117 "../src/parse/lex_conf.re" { opts.set_yytarget (lex_conf_string ()); return; } -#line 2874 "src/parse/lex_conf.cc" +#line 2873 "src/parse/lex_conf.cc" yy602: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 128 "../src/parse/lex_conf.re" +#line 127 "../src/parse/lex_conf.re" { opts.set_yybackupctx (lex_conf_string ()); return; } -#line 2882 "src/parse/lex_conf.cc" +#line 2881 "src/parse/lex_conf.cc" yy604: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 122 "../src/parse/lex_conf.re" +#line 121 "../src/parse/lex_conf.re" { opts.set_yyctxmarker (lex_conf_string ()); return; } -#line 2890 "src/parse/lex_conf.cc" +#line 2889 "src/parse/lex_conf.cc" yy606: yych = (unsigned char)*++cur; if (yych == 'd') goto yy621; @@ -2954,9 +2953,9 @@ yy621: if (yybm[0+yych] & 32) { goto yy3; } -#line 162 "../src/parse/lex_conf.re" +#line 161 "../src/parse/lex_conf.re" { opts.set_fill_naked (lex_conf_bool()); return; } -#line 2960 "src/parse/lex_conf.cc" +#line 2959 "src/parse/lex_conf.cc" yy623: yych = (unsigned char)*++cur; if (yych == 'O') goto yy639; @@ -2970,17 +2969,17 @@ yy625: if (yybm[0+yych] & 32) { goto yy3; } -#line 130 "../src/parse/lex_conf.re" +#line 129 "../src/parse/lex_conf.re" { opts.set_yyrestorectx (lex_conf_string ()); return; } -#line 2976 "src/parse/lex_conf.cc" +#line 2975 "src/parse/lex_conf.cc" yy627: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 131 "../src/parse/lex_conf.re" +#line 130 "../src/parse/lex_conf.re" { opts.set_yyrestoretag (lex_conf_string ()); return; } -#line 2984 "src/parse/lex_conf.cc" +#line 2983 "src/parse/lex_conf.cc" yy629: yych = (unsigned char)*++cur; if (yych == 'O') goto yy641; @@ -3002,9 +3001,9 @@ yy633: if (yybm[0+yych] & 32) { goto yy3; } -#line 51 "../src/parse/lex_conf.re" +#line 50 "../src/parse/lex_conf.re" { opts.set_bCaseInverted (lex_conf_bool()); return; } -#line 3008 "src/parse/lex_conf.cc" +#line 3007 "src/parse/lex_conf.cc" yy635: yych = (unsigned char)*++cur; if (yych == 's') goto yy106; @@ -3070,9 +3069,9 @@ yy646: } } yy647: -#line 84 "../src/parse/lex_conf.re" +#line 83 "../src/parse/lex_conf.re" { opts.set_cond_get (lex_conf_string ()); return; } -#line 3076 "src/parse/lex_conf.cc" +#line 3075 "src/parse/lex_conf.cc" yy648: yych = (unsigned char)*++cur; if (yych == 'e') goto yy657; @@ -3097,9 +3096,9 @@ yy649: } } yy650: -#line 86 "../src/parse/lex_conf.re" +#line 85 "../src/parse/lex_conf.re" { opts.set_cond_set (lex_conf_string ()); return; } -#line 3103 "src/parse/lex_conf.cc" +#line 3102 "src/parse/lex_conf.cc" yy651: yych = (unsigned char)*++cur; if (yych == 'e') goto yy660; @@ -3117,9 +3116,9 @@ yy654: if (yybm[0+yych] & 32) { goto yy3; } -#line 68 "../src/parse/lex_conf.re" +#line 67 "../src/parse/lex_conf.re" { lex_conf_encoding_policy(opts); return; } -#line 3123 "src/parse/lex_conf.cc" +#line 3122 "src/parse/lex_conf.cc" yy656: yych = (unsigned char)*++cur; if (yych == 'n') goto yy664; @@ -3149,9 +3148,9 @@ yy662: if (yybm[0+yych] & 32) { goto yy3; } -#line 50 "../src/parse/lex_conf.re" +#line 49 "../src/parse/lex_conf.re" { opts.set_bCaseInsensitive (lex_conf_bool()); return; } -#line 3155 "src/parse/lex_conf.cc" +#line 3154 "src/parse/lex_conf.cc" yy664: yych = (unsigned char)*++cur; if (yych == 'a') goto yy673; @@ -3161,9 +3160,9 @@ yy665: if (yybm[0+yych] & 32) { goto yy3; } -#line 98 "../src/parse/lex_conf.re" +#line 97 "../src/parse/lex_conf.re" { opts.set_state_get_naked (lex_conf_bool()); return; } -#line 3167 "src/parse/lex_conf.cc" +#line 3166 "src/parse/lex_conf.cc" yy667: yych = (unsigned char)*++cur; if (yych == 'a') goto yy674; @@ -3177,14 +3176,14 @@ yy669: if (yybm[0+yych] & 32) { goto yy3; } -#line 100 "../src/parse/lex_conf.re" +#line 99 "../src/parse/lex_conf.re" { opts.set_state_set_naked (lex_conf_bool()); return; } -#line 3183 "src/parse/lex_conf.cc" +#line 3182 "src/parse/lex_conf.cc" yy671: ++cur; -#line 101 "../src/parse/lex_conf.re" +#line 100 "../src/parse/lex_conf.re" { opts.set_state_set_arg (lex_conf_string ()); return; } -#line 3188 "src/parse/lex_conf.cc" +#line 3187 "src/parse/lex_conf.cc" yy673: yych = (unsigned char)*++cur; if (yych == 'k') goto yy676; @@ -3219,27 +3218,27 @@ yy680: goto yy4; yy681: ++cur; -#line 87 "../src/parse/lex_conf.re" +#line 86 "../src/parse/lex_conf.re" { opts.set_cond_set_arg (lex_conf_string ()); return; } -#line 3225 "src/parse/lex_conf.cc" +#line 3224 "src/parse/lex_conf.cc" yy683: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 85 "../src/parse/lex_conf.re" +#line 84 "../src/parse/lex_conf.re" { opts.set_cond_get_naked (lex_conf_bool()); return; } -#line 3233 "src/parse/lex_conf.cc" +#line 3232 "src/parse/lex_conf.cc" yy685: yych = (unsigned char)*++cur; if (yybm[0+yych] & 32) { goto yy3; } -#line 88 "../src/parse/lex_conf.re" +#line 87 "../src/parse/lex_conf.re" { opts.set_cond_set_naked (lex_conf_bool()); return; } -#line 3241 "src/parse/lex_conf.cc" +#line 3240 "src/parse/lex_conf.cc" } -#line 178 "../src/parse/lex_conf.re" +#line 177 "../src/parse/lex_conf.re" } @@ -3247,7 +3246,7 @@ void Scanner::lex_conf_encoding_policy(Opt &opts) { lex_conf_assign (); -#line 3251 "src/parse/lex_conf.cc" +#line 3250 "src/parse/lex_conf.cc" { unsigned char yych; if ((lim - cur) < 10) YYFILL(10); @@ -3260,10 +3259,10 @@ void Scanner::lex_conf_encoding_policy(Opt &opts) } ++cur; yy690: -#line 185 "../src/parse/lex_conf.re" - { fatal(cur_loc(), +#line 184 "../src/parse/lex_conf.re" + { msg.fatal(cur_loc(), "bad configuration value (expected: 'ignore', 'substitute', 'fail')"); } -#line 3267 "src/parse/lex_conf.cc" +#line 3266 "src/parse/lex_conf.cc" yy691: yych = (unsigned char)*(mar = ++cur); if (yych == 'a') goto yy694; @@ -3304,9 +3303,9 @@ yy700: goto yy695; yy701: ++cur; -#line 189 "../src/parse/lex_conf.re" +#line 188 "../src/parse/lex_conf.re" { opts.set_encoding_policy(Enc::POLICY_FAIL); goto end; } -#line 3310 "src/parse/lex_conf.cc" +#line 3309 "src/parse/lex_conf.cc" yy703: yych = (unsigned char)*++cur; if (yych == 'r') goto yy705; @@ -3325,9 +3324,9 @@ yy706: goto yy695; yy707: ++cur; -#line 187 "../src/parse/lex_conf.re" +#line 186 "../src/parse/lex_conf.re" { opts.set_encoding_policy(Enc::POLICY_IGNORE); goto end; } -#line 3331 "src/parse/lex_conf.cc" +#line 3330 "src/parse/lex_conf.cc" yy709: yych = (unsigned char)*++cur; if (yych != 't') goto yy695; @@ -3338,11 +3337,11 @@ yy709: yych = (unsigned char)*++cur; if (yych != 'e') goto yy695; ++cur; -#line 188 "../src/parse/lex_conf.re" +#line 187 "../src/parse/lex_conf.re" { opts.set_encoding_policy(Enc::POLICY_SUBSTITUTE); goto end; } -#line 3344 "src/parse/lex_conf.cc" +#line 3343 "src/parse/lex_conf.cc" } -#line 190 "../src/parse/lex_conf.re" +#line 189 "../src/parse/lex_conf.re" end: lex_conf_semicolon(); @@ -3352,7 +3351,7 @@ void Scanner::lex_conf_input(Opt &opts) { lex_conf_assign (); -#line 3356 "src/parse/lex_conf.cc" +#line 3355 "src/parse/lex_conf.cc" { unsigned char yych; if ((lim - cur) < 7) YYFILL(7); @@ -3363,9 +3362,9 @@ void Scanner::lex_conf_input(Opt &opts) yy717: ++cur; yy718: -#line 199 "../src/parse/lex_conf.re" - { fatal(cur_loc(), "bad configuration value (expected: 'default', 'custom')"); } -#line 3369 "src/parse/lex_conf.cc" +#line 198 "../src/parse/lex_conf.re" + { msg.fatal(cur_loc(), "bad configuration value (expected: 'default', 'custom')"); } +#line 3368 "src/parse/lex_conf.cc" yy719: yych = (unsigned char)*(mar = ++cur); if (yych == 'u') goto yy721; @@ -3410,18 +3409,18 @@ yy729: goto yy722; yy730: ++cur; -#line 201 "../src/parse/lex_conf.re" +#line 200 "../src/parse/lex_conf.re" { opts.set_input_api(INPUT_CUSTOM); goto end; } -#line 3416 "src/parse/lex_conf.cc" +#line 3415 "src/parse/lex_conf.cc" yy732: yych = (unsigned char)*++cur; if (yych != 't') goto yy722; ++cur; -#line 200 "../src/parse/lex_conf.re" +#line 199 "../src/parse/lex_conf.re" { opts.set_input_api(INPUT_DEFAULT); goto end; } -#line 3423 "src/parse/lex_conf.cc" +#line 3422 "src/parse/lex_conf.cc" } -#line 202 "../src/parse/lex_conf.re" +#line 201 "../src/parse/lex_conf.re" end: lex_conf_semicolon(); @@ -3431,7 +3430,7 @@ void Scanner::lex_conf_empty_class(Opt &opts) { lex_conf_assign (); -#line 3435 "src/parse/lex_conf.cc" +#line 3434 "src/parse/lex_conf.cc" { unsigned char yych; if ((lim - cur) < 11) YYFILL(11); @@ -3440,10 +3439,10 @@ void Scanner::lex_conf_empty_class(Opt &opts) if (yych == 'm') goto yy740; ++cur; yy738: -#line 211 "../src/parse/lex_conf.re" - { fatal(cur_loc(), +#line 210 "../src/parse/lex_conf.re" + { msg.fatal(cur_loc(), "bad configuration value (expected: 'match-empty', 'match-none', 'error')"); } -#line 3447 "src/parse/lex_conf.cc" +#line 3446 "src/parse/lex_conf.cc" yy739: yych = (unsigned char)*(mar = ++cur); if (yych == 'r') goto yy741; @@ -3480,9 +3479,9 @@ yy747: goto yy742; yy748: ++cur; -#line 215 "../src/parse/lex_conf.re" +#line 214 "../src/parse/lex_conf.re" { opts.set_empty_class_policy(EMPTY_CLASS_ERROR); goto end; } -#line 3486 "src/parse/lex_conf.cc" +#line 3485 "src/parse/lex_conf.cc" yy750: yych = (unsigned char)*++cur; if (yych != '-') goto yy742; @@ -3520,16 +3519,16 @@ yy758: goto yy742; yy759: ++cur; -#line 214 "../src/parse/lex_conf.re" +#line 213 "../src/parse/lex_conf.re" { opts.set_empty_class_policy(EMPTY_CLASS_MATCH_NONE); goto end; } -#line 3526 "src/parse/lex_conf.cc" +#line 3525 "src/parse/lex_conf.cc" yy761: ++cur; -#line 213 "../src/parse/lex_conf.re" +#line 212 "../src/parse/lex_conf.re" { opts.set_empty_class_policy(EMPTY_CLASS_MATCH_EMPTY); goto end; } -#line 3531 "src/parse/lex_conf.cc" +#line 3530 "src/parse/lex_conf.cc" } -#line 216 "../src/parse/lex_conf.re" +#line 215 "../src/parse/lex_conf.re" end: lex_conf_semicolon(); @@ -3547,7 +3546,7 @@ void Scanner::lex_conf_enc(Enc::type_t enc, Opt &opts) void Scanner::lex_conf_assign () { -#line 3551 "src/parse/lex_conf.cc" +#line 3550 "src/parse/lex_conf.cc" { unsigned char yych; static const unsigned char yybm[] = { @@ -3594,9 +3593,9 @@ void Scanner::lex_conf_assign () } ++cur; yy766: -#line 233 "../src/parse/lex_conf.re" - { fatal(cur_loc(), "missing '=' in configuration"); } -#line 3600 "src/parse/lex_conf.cc" +#line 232 "../src/parse/lex_conf.re" + { msg.fatal(cur_loc(), "missing '=' in configuration"); } +#line 3599 "src/parse/lex_conf.cc" yy767: yych = (unsigned char)*(mar = ++cur); if (yych <= 0x1F) { @@ -3613,9 +3612,9 @@ yy768: if (yybm[0+yych] & 128) { goto yy768; } -#line 234 "../src/parse/lex_conf.re" +#line 233 "../src/parse/lex_conf.re" { return; } -#line 3619 "src/parse/lex_conf.cc" +#line 3618 "src/parse/lex_conf.cc" yy771: ++cur; if (lim <= cur) YYFILL(1); @@ -3629,14 +3628,14 @@ yy771: cur = mar; goto yy766; } -#line 235 "../src/parse/lex_conf.re" +#line 234 "../src/parse/lex_conf.re" } void Scanner::lex_conf_semicolon () { -#line 3640 "src/parse/lex_conf.cc" +#line 3639 "src/parse/lex_conf.cc" { unsigned char yych; static const unsigned char yybm[] = { @@ -3683,9 +3682,9 @@ void Scanner::lex_conf_semicolon () } ++cur; yy777: -#line 241 "../src/parse/lex_conf.re" - { fatal(cur_loc(), "missing ending ';' in configuration"); } -#line 3689 "src/parse/lex_conf.cc" +#line 240 "../src/parse/lex_conf.re" + { msg.fatal(cur_loc(), "missing ending ';' in configuration"); } +#line 3688 "src/parse/lex_conf.cc" yy778: yych = (unsigned char)*(mar = ++cur); if (yybm[0+yych] & 128) { @@ -3694,9 +3693,9 @@ yy778: if (yych != ';') goto yy777; yy779: ++cur; -#line 242 "../src/parse/lex_conf.re" +#line 241 "../src/parse/lex_conf.re" { return; } -#line 3700 "src/parse/lex_conf.cc" +#line 3699 "src/parse/lex_conf.cc" yy781: ++cur; if (lim <= cur) YYFILL(1); @@ -3708,7 +3707,7 @@ yy781: cur = mar; goto yy777; } -#line 243 "../src/parse/lex_conf.re" +#line 242 "../src/parse/lex_conf.re" } @@ -3722,7 +3721,7 @@ int32_t Scanner::lex_conf_number () lex_conf_assign (); tok = cur; -#line 3726 "src/parse/lex_conf.cc" +#line 3725 "src/parse/lex_conf.cc" { unsigned char yych; static const unsigned char yybm[] = { @@ -3769,9 +3768,9 @@ int32_t Scanner::lex_conf_number () } ++cur; yy787: -#line 256 "../src/parse/lex_conf.re" - { fatal(cur_loc(), "bad configuration value (expected number)"); } -#line 3775 "src/parse/lex_conf.cc" +#line 255 "../src/parse/lex_conf.re" + { msg.fatal(cur_loc(), "bad configuration value (expected number)"); } +#line 3774 "src/parse/lex_conf.cc" yy788: yych = (unsigned char)*++cur; if (yych <= '0') goto yy787; @@ -3780,16 +3779,16 @@ yy788: yy789: ++cur; yy790: -#line 257 "../src/parse/lex_conf.re" +#line 256 "../src/parse/lex_conf.re" { int32_t n = 0; if (!s_to_i32_unsafe (tok, cur, n)) { - fatal(cur_loc(), "configuration value overflow"); + msg.fatal(cur_loc(), "configuration value overflow"); } lex_conf_semicolon (); return n; } -#line 3793 "src/parse/lex_conf.cc" +#line 3792 "src/parse/lex_conf.cc" yy791: ++cur; if (lim <= cur) YYFILL(1); @@ -3799,7 +3798,7 @@ yy791: } goto yy790; } -#line 265 "../src/parse/lex_conf.re" +#line 264 "../src/parse/lex_conf.re" } @@ -3809,7 +3808,7 @@ std::string Scanner::lex_conf_string () std::string s; tok = cur; -#line 3813 "src/parse/lex_conf.cc" +#line 3812 "src/parse/lex_conf.cc" { unsigned char yych; static const unsigned char yybm[] = { @@ -3865,9 +3864,9 @@ std::string Scanner::lex_conf_string () } } yy795: -#line 292 "../src/parse/lex_conf.re" +#line 293 "../src/parse/lex_conf.re" { goto end; } -#line 3871 "src/parse/lex_conf.cc" +#line 3870 "src/parse/lex_conf.cc" yy796: ++cur; if (lim <= cur) YYFILL(1); @@ -3875,15 +3874,15 @@ yy796: if (yybm[0+yych] & 128) { goto yy796; } -#line 288 "../src/parse/lex_conf.re" +#line 289 "../src/parse/lex_conf.re" { s = getstr(tok, cur); goto end; } -#line 3884 "src/parse/lex_conf.cc" +#line 3883 "src/parse/lex_conf.cc" yy799: ++cur; -#line 274 "../src/parse/lex_conf.re" +#line 273 "../src/parse/lex_conf.re" { const char quote = tok[0]; for (;;) { @@ -3892,15 +3891,17 @@ yy799: goto end; } if (c.chr > 0xFF) { - fatal(c.loc, "multibyte character in configuration string: 0x%X", c.chr); + msg.fatal(c.loc + , "multibyte character in configuration string: 0x%X" + , c.chr); } else { s += static_cast(c.chr); } } } -#line 3902 "src/parse/lex_conf.cc" +#line 3903 "src/parse/lex_conf.cc" } -#line 293 "../src/parse/lex_conf.re" +#line 294 "../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 be4f6d15..b6d023ec 100644 --- a/re2c/bootstrap/src/parse/parser.cc +++ b/re2c/bootstrap/src/parse/parser.cc @@ -467,11 +467,11 @@ static const yytype_uint8 yytranslate[] = /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 62, 62, 64, 65, 66, 67, 71, 78, 84, - 85, 88, 88, 91, 94, 97, 100, 106, 112, 118, - 124, 131, 132, 137, 144, 145, 151, 152, 156, 157, - 161, 163, 167, 168, 175, 181, 182, 186, 187, 188, - 192, 193, 204 + 0, 62, 62, 64, 65, 66, 67, 71, 79, 85, + 86, 89, 89, 92, 95, 98, 101, 107, 113, 119, + 125, 132, 133, 138, 145, 146, 152, 153, 157, 158, + 162, 164, 168, 169, 176, 182, 183, 187, 188, 189, + 193, 194, 206 }; #endif @@ -1293,161 +1293,162 @@ yyreduce: #line 71 "../src/parse/parser.ypp" /* yacc.c:1646 */ { if (!context.symtab.insert(std::make_pair(*(yyvsp[-2].str), (yyvsp[-1].regexp))).second) { - fatal(context.input.tok_loc(), "sym already defined"); + context.input.msg.fatal(context.input.tok_loc() + , "sym already defined"); } delete (yyvsp[-2].str); } -#line 1301 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1302 "src/parse/parser.cc" /* yacc.c:1646 */ break; case 8: -#line 78 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 79 "../src/parse/parser.ypp" /* yacc.c:1646 */ { - fatal(context.input.tok_loc() + context.input.msg.fatal(context.input.tok_loc() , "trailing contexts are not allowed in named definitions"); } -#line 1310 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1311 "src/parse/parser.cc" /* yacc.c:1646 */ break; case 9: -#line 84 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 85 "../src/parse/parser.ypp" /* yacc.c:1646 */ { (yyval.str) = (yyvsp[-1].str); } -#line 1316 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1317 "src/parse/parser.cc" /* yacc.c:1646 */ break; case 13: -#line 91 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 92 "../src/parse/parser.ypp" /* yacc.c:1646 */ { find(context.specs, "").rules.push_back(ASTRule((yyvsp[-1].regexp), (yyvsp[0].code))); } -#line 1324 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1325 "src/parse/parser.cc" /* yacc.c:1646 */ break; case 14: -#line 94 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 95 "../src/parse/parser.ypp" /* yacc.c:1646 */ { find(context.specs, "").defs.push_back((yyvsp[0].code)); } -#line 1332 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1333 "src/parse/parser.cc" /* yacc.c:1646 */ break; case 15: -#line 97 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 98 "../src/parse/parser.ypp" /* yacc.c:1646 */ { find(context.specs, "").eofs.push_back((yyvsp[0].code)); } -#line 1340 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1341 "src/parse/parser.cc" /* yacc.c:1646 */ break; case 16: -#line 100 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 101 "../src/parse/parser.ypp" /* yacc.c:1646 */ { for(CondList::const_iterator i = (yyvsp[-2].clist)->begin(); i != (yyvsp[-2].clist)->end(); ++i) { find(context.specs, *i).rules.push_back(ASTRule((yyvsp[-1].regexp), (yyvsp[0].code))); } delete (yyvsp[-2].clist); } -#line 1351 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1352 "src/parse/parser.cc" /* yacc.c:1646 */ break; case 17: -#line 106 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 107 "../src/parse/parser.ypp" /* yacc.c:1646 */ { for(CondList::const_iterator i = (yyvsp[-2].clist)->begin(); i != (yyvsp[-2].clist)->end(); ++i) { find(context.specs, *i).defs.push_back((yyvsp[0].code)); } delete (yyvsp[-2].clist); } -#line 1362 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1363 "src/parse/parser.cc" /* yacc.c:1646 */ break; case 18: -#line 112 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 113 "../src/parse/parser.ypp" /* yacc.c:1646 */ { for(CondList::const_iterator i = (yyvsp[-2].clist)->begin(); i != (yyvsp[-2].clist)->end(); ++i) { find(context.specs, *i).eofs.push_back((yyvsp[0].code)); } delete (yyvsp[-2].clist); } -#line 1373 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1374 "src/parse/parser.cc" /* yacc.c:1646 */ break; case 19: -#line 118 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 119 "../src/parse/parser.ypp" /* yacc.c:1646 */ { for (CondList::const_iterator i = (yyvsp[-1].clist)->begin(); i != (yyvsp[-1].clist)->end(); ++i) { find(context.specs, *i).setup.push_back((yyvsp[0].code)); } delete (yyvsp[-1].clist); } -#line 1384 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1385 "src/parse/parser.cc" /* yacc.c:1646 */ break; case 20: -#line 124 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 125 "../src/parse/parser.ypp" /* yacc.c:1646 */ { const AST *r = ast_nil(context.input.tok_loc()); find(context.specs, "0").rules.push_back(ASTRule(r, (yyvsp[0].code))); delete (yyvsp[-1].clist); } -#line 1394 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1395 "src/parse/parser.cc" /* yacc.c:1646 */ break; case 22: -#line 132 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 133 "../src/parse/parser.ypp" /* yacc.c:1646 */ { (yyval.code) = (yyvsp[0].code); (yyval.code)->cond = *(yyvsp[-1].str); delete (yyvsp[-1].str); } -#line 1404 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1405 "src/parse/parser.cc" /* yacc.c:1646 */ break; case 23: -#line 137 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 138 "../src/parse/parser.ypp" /* yacc.c:1646 */ { (yyval.code) = new Code(context.input.tok_loc()); (yyval.code)->cond = *(yyvsp[0].str); delete (yyvsp[0].str); } -#line 1414 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1415 "src/parse/parser.cc" /* yacc.c:1646 */ break; case 24: -#line 144 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 145 "../src/parse/parser.ypp" /* yacc.c:1646 */ { (yyval.regexp) = ast_cap((yyvsp[0].regexp)); } -#line 1420 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1421 "src/parse/parser.cc" /* yacc.c:1646 */ break; case 25: -#line 145 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 146 "../src/parse/parser.ypp" /* yacc.c:1646 */ { (yyval.regexp) = ast_cat(ast_cap((yyvsp[-2].regexp)), ast_cat(ast_tag(context.input.tok_loc(), NULL, false), (yyvsp[0].regexp))); } -#line 1429 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1430 "src/parse/parser.cc" /* yacc.c:1646 */ break; case 27: -#line 152 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 153 "../src/parse/parser.ypp" /* yacc.c:1646 */ { (yyval.regexp) = ast_alt((yyvsp[-2].regexp), (yyvsp[0].regexp)); } -#line 1435 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1436 "src/parse/parser.cc" /* yacc.c:1646 */ break; case 29: -#line 157 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 158 "../src/parse/parser.ypp" /* yacc.c:1646 */ { (yyval.regexp) = ast_diff((yyvsp[-2].regexp), (yyvsp[0].regexp)); } -#line 1441 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1442 "src/parse/parser.cc" /* yacc.c:1646 */ break; case 31: -#line 163 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 164 "../src/parse/parser.ypp" /* yacc.c:1646 */ { (yyval.regexp) = ast_cat((yyvsp[-1].regexp), (yyvsp[0].regexp)); } -#line 1447 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1448 "src/parse/parser.cc" /* yacc.c:1646 */ break; case 33: -#line 168 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 169 "../src/parse/parser.ypp" /* yacc.c:1646 */ { switch((yyvsp[0].op)) { case '*': (yyval.regexp) = ast_iter((yyvsp[-1].regexp), 0, AST::MANY); break; @@ -1455,47 +1456,48 @@ yyreduce: case '?': (yyval.regexp) = ast_iter((yyvsp[-1].regexp), 0, 1); break; } } -#line 1459 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1460 "src/parse/parser.cc" /* yacc.c:1646 */ break; case 34: -#line 175 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 176 "../src/parse/parser.ypp" /* yacc.c:1646 */ { (yyval.regexp) = ast_iter((yyvsp[-1].regexp), (yyvsp[0].bounds).min, (yyvsp[0].bounds).max); } -#line 1467 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1468 "src/parse/parser.cc" /* yacc.c:1646 */ break; case 36: -#line 182 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 183 "../src/parse/parser.ypp" /* yacc.c:1646 */ { (yyval.op) = ((yyvsp[-1].op) == (yyvsp[0].op)) ? (yyvsp[-1].op) : '*'; } -#line 1473 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1474 "src/parse/parser.cc" /* yacc.c:1646 */ break; case 37: -#line 186 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 187 "../src/parse/parser.ypp" /* yacc.c:1646 */ { (yyval.op) = '*'; } -#line 1479 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1480 "src/parse/parser.cc" /* yacc.c:1646 */ break; case 38: -#line 187 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 188 "../src/parse/parser.ypp" /* yacc.c:1646 */ { (yyval.op) = '+'; } -#line 1485 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1486 "src/parse/parser.cc" /* yacc.c:1646 */ break; case 39: -#line 188 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 189 "../src/parse/parser.ypp" /* yacc.c:1646 */ { (yyval.op) = '?'; } -#line 1491 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1492 "src/parse/parser.cc" /* yacc.c:1646 */ break; case 41: -#line 193 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 194 "../src/parse/parser.ypp" /* yacc.c:1646 */ { symtab_t::iterator i = context.symtab.find(*(yyvsp[0].str)); if (i == context.symtab.end()) { - fatal(context.input.tok_loc(), "undefined symbol '%s'", (yyvsp[0].str)->c_str()); + context.input.msg.fatal(context.input.tok_loc() + , "undefined symbol '%s'", (yyvsp[0].str)->c_str()); } (yyval.regexp) = i->second; if (ast_need_wrap((yyval.regexp))) { @@ -1503,17 +1505,17 @@ yyreduce: } delete (yyvsp[0].str); } -#line 1507 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1509 "src/parse/parser.cc" /* yacc.c:1646 */ break; case 42: -#line 204 "../src/parse/parser.ypp" /* yacc.c:1646 */ +#line 206 "../src/parse/parser.ypp" /* yacc.c:1646 */ { (yyval.regexp) = ast_cap((yyvsp[-1].regexp)); } -#line 1513 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1515 "src/parse/parser.cc" /* yacc.c:1646 */ break; -#line 1517 "src/parse/parser.cc" /* yacc.c:1646 */ +#line 1519 "src/parse/parser.cc" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1741,14 +1743,14 @@ yyreturn: #endif return yyresult; } -#line 207 "../src/parse/parser.ypp" /* yacc.c:1906 */ +#line 209 "../src/parse/parser.ypp" /* yacc.c:1906 */ extern "C" { void yyerror(context_t &context, const char* s) { - fatal(context.input.tok_loc(), "%s", s); + context.input.msg.fatal(context.input.tok_loc(), "%s", s); } int yylex(context_t &context) diff --git a/re2c/lib/lex.h b/re2c/lib/lex.h index 1e47656f..a9ec531f 100644 --- a/re2c/lib/lex.h +++ b/re2c/lib/lex.h @@ -1,6 +1,7 @@ #ifndef _RE2C_LIB_LEX_ #define _RE2C_LIB_LEX_ +#include "src/msg/location.h" #include "src/regexp/re.h" #include "src/parse/ast.h" diff --git a/re2c/lib/lex.re b/re2c/lib/lex.re index 086794ff..28c927b3 100644 --- a/re2c/lib/lex.re +++ b/re2c/lib/lex.re @@ -4,7 +4,6 @@ #include "src/encoding/enc.h" #include "src/parse/ast.h" -#include "src/options/msg.h" #include "src/util/range.h" #include "src/util/s_to_n32_unsafe.h" #include "parse.h" @@ -35,7 +34,6 @@ int lex(const char *&cur) std::vector cls; bool neg = false; uint32_t l, u; - const loc_t nowhere(0, 0, "void"); /*!re2c * { goto err; } @@ -71,15 +69,15 @@ int lex(const char *&cur) } "." { - yylval.regexp = ast_dot(nowhere); + yylval.regexp = ast_dot(NOWHERE); return REGEXP; } [^] \ nil { - ASTChar c(static_cast(cur[-1]), nowhere); + ASTChar c = {static_cast(cur[-1]), NOWHERE}; std::vector *str = new std::vector; str->push_back(c); - yylval.regexp = ast_str(nowhere, str, false); + yylval.regexp = ast_str(NOWHERE, str, false); return REGEXP; } */ @@ -92,13 +90,13 @@ cls: */ add: if (l > u) goto err; - cls.push_back(ASTRange(l, u, nowhere)); + cls.push_back(ASTRange(l, u, NOWHERE)); /*!re2c "" { goto cls; } "]" { std::vector *p = new std::vector; p->swap(cls); - yylval.regexp = ast_cls(nowhere, p, neg); + yylval.regexp = ast_cls(NOWHERE, p, neg); return REGEXP; } */ diff --git a/re2c/lib/parse.ypp b/re2c/lib/parse.ypp index d057929d..373273ba 100644 --- a/re2c/lib/parse.ypp +++ b/re2c/lib/parse.ypp @@ -58,7 +58,7 @@ factor primary : REGEXP -| '(' ')' { $$ = ast_cap(ast_nil(loc_t(0, 0, "void"))); } +| '(' ')' { $$ = ast_cap(ast_nil(NOWHERE)); } | '(' expr ')' { $$ = ast_cap($2); } ; diff --git a/re2c/lib/regcomp.cc b/re2c/lib/regcomp.cc index 594a2281..db491487 100644 --- a/re2c/lib/regcomp.cc +++ b/re2c/lib/regcomp.cc @@ -20,23 +20,20 @@ int regcomp(regex_t *preg, const char *pattern, int cflags) conopt_t globopts; globopts.FFlag = true; Opt opts(globopts); + Msg msg; opts.set_posix_syntax(true); opts.set_posix_semantics((cflags & REG_LEFTMOST) == 0); const opt_t *opt = opts.snapshot(); - const loc_t loc(0, 0, "void"); - - Warn warn; - preg->flags = cflags; const AST *a = parse(pattern); preg->rmgr = new RangeMgr; - ASTRule ar(a, new Code(loc)); + ASTRule ar(a, new Code(NOWHERE)); std::vector arv; arv.push_back(ar); - RESpec re(arv, opt, warn, *preg->rmgr); + RESpec re(arv, opt, msg, *preg->rmgr); find_fixed_tags(re); @@ -63,7 +60,7 @@ int regcomp(regex_t *preg, const char *pattern, int cflags) } } - dfa = new dfa_t(*nfa, opt, "", warn); + dfa = new dfa_t(*nfa, opt, "", msg); compact_and_optimize_tags(opt, *dfa); diff --git a/re2c/src/adfa/adfa.cc b/re2c/src/adfa/adfa.cc index bad76fb3..02429589 100644 --- a/re2c/src/adfa/adfa.cc +++ b/re2c/src/adfa/adfa.cc @@ -32,6 +32,7 @@ DFA::DFA , const std::string &su , const Code *eof , const opt_t *opts + , Msg &msg ) : accepts () , loc (loc) @@ -61,6 +62,7 @@ DFA::DFA , bitmaps (std::min(ubChar, 256u)) , setup(su) , eof_action(eof) + , msg(msg) { const size_t nstates = dfa.states.size(); const size_t nchars = dfa.nchars; diff --git a/re2c/src/adfa/adfa.h b/re2c/src/adfa/adfa.h index 519641b4..c4421d4a 100644 --- a/re2c/src/adfa/adfa.h +++ b/re2c/src/adfa/adfa.h @@ -91,6 +91,7 @@ struct DFA bitmaps_t bitmaps; std::string setup; const Code *eof_action; + Msg &msg; DFA ( const dfa_t &dfa , const std::vector &fill @@ -102,6 +103,7 @@ struct DFA , const std::string &su , const Code *eof , const opt_t *opts + , Msg &msg ); ~DFA (); void reorder(); diff --git a/re2c/src/adfa/prepare.cc b/re2c/src/adfa/prepare.cc index bd324639..1ec4d9e0 100644 --- a/re2c/src/adfa/prepare.cc +++ b/re2c/src/adfa/prepare.cc @@ -9,7 +9,6 @@ #include "src/adfa/adfa.h" #include "src/codegen/bitmap.h" #include "src/codegen/go.h" -#include "src/options/msg.h" #include "src/options/opt.h" #include "src/debug/debug.h" #include "src/dfa/tcmd.h" @@ -280,7 +279,7 @@ void DFA::calc_stats(bool explicit_tags) // error if tags are not enabled, but we need them if (!explicit_tags && maxtagver > 1) { - fatal(loc, "overlapping trailing contexts need " + msg.fatal(loc, "overlapping trailing contexts need " "multiple context markers, use '-t, --tags' " "option and '/*!stags:re2c ... */' directive"); } diff --git a/re2c/src/codegen/emit_dfa.cc b/re2c/src/codegen/emit_dfa.cc index 1e10c670..17101147 100644 --- a/re2c/src/codegen/emit_dfa.cc +++ b/re2c/src/codegen/emit_dfa.cc @@ -134,7 +134,7 @@ void DFA::emit_dot(Output &o, bool last_cond) const const Code *code = rules[s->action.info.rule].code; if (!code->autogen) { o.wlabel(s->label).ws(" [label=\"") - .wstring(code->loc.fname) + .wstring(msg.filenames[code->loc.file]) .ws(":").wu32(code->loc.line) .ws("\"]").ws("\n"); } diff --git a/re2c/src/codegen/output.cc b/re2c/src/codegen/output.cc index 169e1188..df9df84c 100644 --- a/re2c/src/codegen/output.cc +++ b/re2c/src/codegen/output.cc @@ -7,9 +7,8 @@ #include "src/codegen/input_api.h" #include "src/codegen/output.h" #include "src/codegen/print.h" -#include "src/options/msg.h" +#include "src/msg/msg.h" #include "src/options/opt.h" -#include "src/options/warn.h" #include "src/encoding/enc.h" #include "src/util/string_utils.h" #include "src/util/uniq_vector.h" @@ -69,7 +68,7 @@ OutputBlock::~OutputBlock () delete opts; } -Output::Output(Warn &w) +Output::Output(Msg &msg) : cblocks() , hblocks() , blocks(&cblocks) @@ -79,7 +78,7 @@ Output::Output(Warn &w) , cond_goto(false) , warn_condition_order(true) , need_header(false) - , warn(w) + , msg(msg) , skeletons() , max_fill(1) , max_nmatch(1) @@ -475,13 +474,14 @@ bool Output::emit_blocks(const std::string &fname, blocks_t &blocks, case OutputFragment::EMPTY: case OutputFragment::CODE: break; case OutputFragment::LINE_INFO_INPUT: - output_line_info(o, f.loc->line, f.loc->fname, bopt->iFlag); + output_line_info(o, f.loc->line, msg.filenames[f.loc->file] + , bopt->iFlag); break; case OutputFragment::LINE_INFO_OUTPUT: output_line_info(o, line_count + 1, filename, bopt->iFlag); break; case OutputFragment::COND_GOTO: - output_cond_goto(o, ind, b.types, bopt, warn + output_cond_goto(o, ind, b.types, bopt, msg , warn_condition_order, b.loc); break; case OutputFragment::COND_TABLE: @@ -580,7 +580,7 @@ static void add_symbols(const OutputBlock &block, bool Output::emit() { - if (warn.error()) return false; + if (msg.warn.error()) return false; // gather global lists of conditions and tags uniq_vector_t conds; @@ -763,7 +763,7 @@ static void output_cond_goto_binary(std::ostream &o, uint32_t ind, } void output_cond_goto(std::ostream &o, uint32_t ind - , const std::vector &conds, const opt_t *opts, Warn &warn + , const std::vector &conds, const opt_t *opts, Msg &msg , bool warn_cond_order, const loc_t &loc) { const size_t ncond = conds.size(); @@ -797,7 +797,7 @@ void output_cond_goto(std::ostream &o, uint32_t ind warn_cond_order &= opts->header_file.empty(); // see note [condition order] - if (warn_cond_order) warn.condition_order(loc); + if (warn_cond_order) msg.warn.condition_order(loc); } void output_cond_table(std::ostream &o, uint32_t ind, diff --git a/re2c/src/codegen/output.h b/re2c/src/codegen/output.h index fc00aff9..54935762 100644 --- a/re2c/src/codegen/output.h +++ b/re2c/src/codegen/output.h @@ -12,7 +12,6 @@ #include "src/codegen/label.h" #include "src/options/opt.h" -#include "src/options/warn.h" #include "src/util/counter.h" #include "src/util/forbid_copy.h" #include "src/util/uniq_vector.h" @@ -20,7 +19,7 @@ namespace re2c { -class Warn; +class Msg; struct Opt; struct opt_t; template class uniq_vector_t; @@ -114,12 +113,12 @@ public: bool cond_goto; bool warn_condition_order; bool need_header; - Warn &warn; + Msg &msg; std::set skeletons; size_t max_fill; size_t max_nmatch; - explicit Output(Warn &w); + explicit Output(Msg &msg); ~Output(); std::ostream & stream (); @@ -171,7 +170,7 @@ public: void output_tags (std::ostream &o, uint32_t ind, const ConfTags &conf, const std::set &tags, const opt_t *opts); void output_line_info (std::ostream &o, uint32_t line, const std::string &fname, bool iflag); -void output_cond_goto (std::ostream &o, uint32_t ind, const std::vector &conds, const opt_t *opts, Warn &warn, bool warn_cond_order, const loc_t &loc); +void output_cond_goto (std::ostream &o, uint32_t ind, const std::vector &conds, const opt_t *opts, Msg &msg, bool warn_cond_order, const loc_t &loc); void output_cond_table (std::ostream &o, uint32_t ind, const std::vector &conds, const opt_t *opts); void output_state_goto (std::ostream &o, uint32_t ind, uint32_t start_label, uint32_t fill_index, const opt_t *opts); void output_types (std::ostream &o, uint32_t ind, const opt_t *opts, const uniq_vector_t &types); diff --git a/re2c/src/compile.cc b/re2c/src/compile.cc index 854c4fc5..0059485f 100644 --- a/re2c/src/compile.cc +++ b/re2c/src/compile.cc @@ -27,7 +27,7 @@ namespace re2c { -class Warn; +class Msg; static std::string make_name(const std::string &cond, uint32_t line) { @@ -46,7 +46,7 @@ static smart_ptr ast_to_dfa(const spec_t &spec, Output &output) { const opt_t *opts = output.block().opts; const loc_t &loc = output.block().loc; - Warn &warn = output.warn; + Msg &msg = output.msg; const std::vector &rules = spec.rules; const size_t defrule = spec.defs.empty() ? Rule::NONE : rules.size() - 1; const Code *eof = spec.eofs.empty() ? NULL : spec.eofs.front(); @@ -57,7 +57,7 @@ static smart_ptr ast_to_dfa(const spec_t &spec, Output &output) RangeMgr rangemgr; - RESpec re(rules, opts, warn, rangemgr); + RESpec re(rules, opts, msg, rangemgr); split_charset(re); find_fixed_tags(re); insert_default_tags(re); @@ -66,20 +66,20 @@ static smart_ptr ast_to_dfa(const spec_t &spec, Output &output) nfa_t nfa(re); DDUMP_NFA(opts, nfa); - dfa_t dfa(nfa, opts, cond, warn); + dfa_t dfa(nfa, opts, cond, msg); DDUMP_DFA_DET(opts, dfa); rangemgr.clear(); // skeleton must be constructed after DFA construction // but prior to any other DFA transformations - Skeleton skeleton(dfa, opts, defrule, name, cond, loc); - warn_undefined_control_flow(skeleton, warn); + Skeleton skeleton(dfa, opts, defrule, name, cond, loc, msg); + warn_undefined_control_flow(skeleton); if (opts->target == TARGET_SKELETON) { emit_data(skeleton); } - cutoff_dead_rules(dfa, defrule, cond, warn); + cutoff_dead_rules(dfa, defrule, cond, msg); insert_fallback_tags(dfa); @@ -98,7 +98,7 @@ static smart_ptr ast_to_dfa(const spec_t &spec, Output &output) // ADFA stands for 'DFA with actions' DFA *adfa = new DFA(dfa, fill, defrule, skeleton.sizeof_key, - loc, name, cond, setup, eof, opts); + loc, name, cond, setup, eof, opts, msg); // see note [reordering DFA states] adfa->reorder(); @@ -171,7 +171,7 @@ void compile(Scanner &input, Output &output, Opt &opts) rspecs = specs; ropts = output.block().opts; } else { - validate_ast(specs, output.block().opts); + validate_ast(specs, output.block().opts, output.msg); normalize_ast(specs); // compile AST to DFA diff --git a/re2c/src/dfa/dead_rules.cc b/re2c/src/dfa/dead_rules.cc index e3a517d6..d7f5e971 100644 --- a/re2c/src/dfa/dead_rules.cc +++ b/re2c/src/dfa/dead_rules.cc @@ -4,7 +4,7 @@ #include #include -#include "src/options/warn.h" +#include "src/msg/msg.h" #include "src/dfa/dfa.h" #include "src/regexp/rule.h" #include "src/util/forbid_copy.h" @@ -160,7 +160,7 @@ static void liveness_analyses(const rdfa_t &rdfa, bool *live) static void warn_dead_rules(const dfa_t &dfa, size_t defrule, - const std::string &cond, const bool *live, Warn &warn) + const std::string &cond, const bool *live, Msg &msg) { const size_t nstates = dfa.states.size(); const size_t nrules = dfa.rules.size(); @@ -180,7 +180,7 @@ static void warn_dead_rules(const dfa_t &dfa, size_t defrule, for (size_t i = 0; i < nrules; ++i) { // default rule '*' should not be reported if (i != defrule && !live[i * nstates]) { - warn.unreachable_rule(cond, dfa.rules[i]); + msg.warn.unreachable_rule(cond, dfa.rules[i]); } } } @@ -239,7 +239,8 @@ static void find_fallback_states(dfa_t &dfa, const bool *fallthru) } -void cutoff_dead_rules(dfa_t &dfa, size_t defrule, const std::string &cond, Warn &warn) +void cutoff_dead_rules(dfa_t &dfa, size_t defrule, const std::string &cond + , Msg &msg) { const rdfa_t rdfa(dfa); const size_t @@ -250,7 +251,7 @@ void cutoff_dead_rules(dfa_t &dfa, size_t defrule, const std::string &cond, Warn memset(live, 0, nl * sizeof(bool)); liveness_analyses(rdfa, live); - warn_dead_rules(dfa, defrule, cond, live, warn); + warn_dead_rules(dfa, defrule, cond, live, msg); remove_dead_final_states(dfa, fallthru); find_fallback_states(dfa, fallthru); diff --git a/re2c/src/dfa/determinization.cc b/re2c/src/dfa/determinization.cc index 1b3383d9..aeb01ed2 100644 --- a/re2c/src/dfa/determinization.cc +++ b/re2c/src/dfa/determinization.cc @@ -8,11 +8,11 @@ #include #include "src/options/opt.h" -#include "src/options/warn.h" #include "src/debug/debug.h" #include "src/dfa/dfa.h" #include "src/dfa/determinization.h" #include "src/dfa/tcmd.h" +#include "src/msg/msg.h" #include "src/nfa/nfa.h" #include "src/regexp/rule.h" #include "src/regexp/tag.h" @@ -33,7 +33,7 @@ const uint32_t dfa_t::NIL = ~0u; dfa_t::dfa_t(const nfa_t &nfa, const opt_t *opts, const std::string &cond - , Warn &warn) + , Msg &msg) : states() , nchars(nfa.charset.size() - 1) // (n + 1) bounds for n ranges , charset(nfa.charset) @@ -46,7 +46,7 @@ dfa_t::dfa_t(const nfa_t &nfa, const opt_t *opts, const std::string &cond , tcmd0(NULL) , tcid0(TCID0) { - determ_context_t ctx(opts, warn, cond, nfa, *this); + determ_context_t ctx(opts, msg, cond, nfa, *this); const uint32_t INITIAL_TAGS = init_tag_versions(ctx); @@ -162,7 +162,7 @@ void warn_nondeterministic_tags(const determ_context_t &ctx) { if (ctx.dc_opts->posix_syntax) return; - Warn &warn = ctx.dc_warn; + Warn &warn = ctx.dc_msg.warn; const kernels_t &kernels = ctx.dc_kernels; const std::vector &tags = ctx.dc_dfa.tags; const std::valarray &rules = ctx.dc_dfa.rules; @@ -209,10 +209,10 @@ void warn_nondeterministic_tags(const determ_context_t &ctx) } -determ_context_t::determ_context_t(const opt_t *opts, Warn &warn +determ_context_t::determ_context_t(const opt_t *opts, Msg &msg , const std::string &condname, const nfa_t &nfa, dfa_t &dfa) : dc_opts(opts) - , dc_warn(warn) + , dc_msg(msg) , dc_condname(condname) , dc_nfa(nfa) , dc_dfa(dfa) diff --git a/re2c/src/dfa/determinization.h b/re2c/src/dfa/determinization.h index 6a3cd12b..0d80012b 100644 --- a/re2c/src/dfa/determinization.h +++ b/re2c/src/dfa/determinization.h @@ -22,7 +22,7 @@ namespace re2c // fwd struct opt_t; -struct Warn; +struct Msg; struct dfa_t; struct tcmd_t; @@ -109,7 +109,7 @@ struct determ_context_t { // determinization input const opt_t *dc_opts; // options - Warn &dc_warn; // warnings + Msg &dc_msg; // error messages and warnings const std::string &dc_condname; // the name of current condition (with -c) const nfa_t &dc_nfa; // TNFA @@ -143,7 +143,7 @@ struct determ_context_t dump_dfa_t dc_dump; closure_stats_t dc_clstats; - determ_context_t(const opt_t *, Warn &, const std::string &, const nfa_t &, dfa_t &); + determ_context_t(const opt_t *, Msg &, const std::string &, const nfa_t &, dfa_t &); FORBID_COPY(determ_context_t); }; diff --git a/re2c/src/dfa/dfa.h b/re2c/src/dfa/dfa.h index 874cbd24..66dcc9f9 100644 --- a/re2c/src/dfa/dfa.h +++ b/re2c/src/dfa/dfa.h @@ -7,7 +7,7 @@ #include #include -#include "src/options/warn.h" +#include "src/msg/msg.h" #include "src/dfa/tcmd.h" #include "src/regexp/rule.h" #include "src/regexp/tag.h" @@ -66,7 +66,7 @@ struct dfa_t tcid_t tcid0; dfa_t(const nfa_t &nfa, const opt_t *opts, const std::string &cond - , Warn &warn); + , Msg &msg); ~dfa_t(); FORBID_COPY(dfa_t); @@ -86,7 +86,7 @@ enum posix_closure_t 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, Warn &warn); +void cutoff_dead_rules(dfa_t &dfa, size_t defrule, const std::string &cond, Msg &msg); void insert_fallback_tags(dfa_t &dfa); void compact_and_optimize_tags(const opt_t *opts, dfa_t &dfa); void freeze_tags(dfa_t &dfa); diff --git a/re2c/src/main.cc b/re2c/src/main.cc index c0bc8b49..dbd716d0 100644 --- a/re2c/src/main.cc +++ b/re2c/src/main.cc @@ -2,8 +2,8 @@ #include "src/parse/scanner.h" #include "src/codegen/output.h" #include "src/compile.h" +#include "src/msg/msg.h" #include "src/options/opt.h" -#include "src/options/warn.h" using namespace re2c; @@ -11,21 +11,26 @@ int main(int, char *argv[]) { conopt_t globopts; Opt opts(globopts); - Warn warn; + Msg msg; - switch (parse_opts(argv, globopts, opts, warn)) { + switch (parse_opts(argv, globopts, opts, msg)) { case OK: break; case EXIT_OK: return 0; case EXIT_FAIL: return 1; } - Scanner scanner(&globopts, warn, opts.source_file); - if (!scanner.init(opts.source_file)) return 1; + Scanner scanner(&globopts, msg); + if (!scanner.open(opts.source_file, NULL)) { + return 1; + } - Output output(warn); + Output output(msg); compile(scanner, output, opts); - if (!output.emit()) return 1; - return warn.error() ? 1 : 0; + if (!output.emit()) { + return 1; + } + + return msg.warn.error() ? 1 : 0; } diff --git a/re2c/src/msg/location.h b/re2c/src/msg/location.h index 64429188..5c0d91af 100644 --- a/re2c/src/msg/location.h +++ b/re2c/src/msg/location.h @@ -2,7 +2,6 @@ #define _RE2C_MSG_LOCATION_ #include "src/util/c99_stdint.h" -#include namespace re2c { @@ -11,12 +10,12 @@ struct loc_t { uint32_t line; uint32_t coln; - std::string fname; - - loc_t(uint32_t l, uint32_t c, const std::string &f) - : line(l), coln(c), fname(f) {} + uint32_t file; }; +static const loc_t ATSTART = {1, 0, 0}; +static const loc_t NOWHERE = {~0u, ~0u, ~0u}; + } // namespace re2c #endif // _RE2C_MSG_LOCATION_ diff --git a/re2c/src/options/msg.cc b/re2c/src/msg/msg.cc similarity index 80% rename from re2c/src/options/msg.cc rename to re2c/src/msg/msg.cc index 505c5879..27838768 100644 --- a/re2c/src/options/msg.cc +++ b/re2c/src/msg/msg.cc @@ -4,7 +4,7 @@ #include #include "config.h" -#include "src/options/msg.h" +#include "src/msg/msg.h" #include "src/options/ver_to_vernum.h" extern const char *help; // autogenerated @@ -36,9 +36,10 @@ void fatal(const char *fmt, ...) exit(1); } -void fatal(const loc_t &loc, const char *fmt, ...) +void Msg::fatal(const loc_t &loc, const char *fmt, ...) { - fprintf(stderr, "%s:%u:%u: error: ", loc.fname.c_str(), loc.line, loc.coln); + fprintf(stderr, "%s:%u:%u: error: " + , filenames[loc.file].c_str(), loc.line, loc.coln); va_list args; va_start(args, fmt); @@ -54,13 +55,14 @@ void error_arg(const char *option) error("expected argument to option %s", option); } -void warning_start(const loc_t &loc, bool error) +void Msg::warning_start(const loc_t &loc, bool error) { const char *msg = error ? "error" : "warning"; - fprintf(stderr, "%s:%u:%u: %s: ", loc.fname.c_str(), loc.line, loc.coln, msg); + fprintf(stderr, "%s:%u:%u: %s: " + , filenames[loc.file].c_str(), loc.line, loc.coln, msg); } -void warning_end(const char *type, bool error) +void Msg::warning_end(const char *type, bool error) { if (type != NULL) { const char *prefix = error ? "error-" : ""; @@ -69,7 +71,7 @@ void warning_end(const char *type, bool error) fprintf(stderr, "\n"); } -void warning(const char *type, const loc_t &loc, bool error +void Msg::warning(const char *type, const loc_t &loc, bool error , const char *fmt, ...) { warning_start(loc, error); diff --git a/re2c/src/msg/msg.h b/re2c/src/msg/msg.h new file mode 100644 index 00000000..58e4f755 --- /dev/null +++ b/re2c/src/msg/msg.h @@ -0,0 +1,46 @@ +#ifndef _RE2C_MSG_MSG_ +#define _RE2C_MSG_MSG_ + +#include "src/util/c99_stdint.h" +#include +#include + +#include "src/msg/location.h" +#include "src/options/warn.h" +#include "src/util/attribute.h" + + +namespace re2c { + +class Msg +{ +public: + std::vector filenames; + Warn warn; + +public: + inline Msg(): filenames(), warn(*this) {} + + size_t register_filename(const std::string &filename); + void fatal(const loc_t &loc, const char *fmt, ...) RE2C_GXX_ATTRIBUTE ((format (printf, 3, 4), noreturn)); + void warning(const char *type, const loc_t &loc, bool error, const char *fmt, ...) RE2C_GXX_ATTRIBUTE ((format (printf, 5, 6))); + + friend class Warn; + +private: + void warning_start(const loc_t &loc, bool error); + void warning_end(const char *type, bool error); +}; + +void error(const char *fmt, ...) RE2C_GXX_ATTRIBUTE ((format (printf, 1, 2))); +void fatal(const char *fmt, ...) RE2C_GXX_ATTRIBUTE ((format (printf, 1, 2), noreturn)); +void error_arg(const char *option); +void usage (); +void vernum (); +void version (); +std::string incond (const std::string & cond); + +} // namespace re2c + +#endif // _RE2C_MSG_MSG_ + diff --git a/re2c/src/options/msg.h b/re2c/src/options/msg.h deleted file mode 100644 index fb9410f4..00000000 --- a/re2c/src/options/msg.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef _RE2C_CONF_MSG_ -#define _RE2C_CONF_MSG_ - -#include "src/util/c99_stdint.h" -#include - -#include "src/msg/location.h" -#include "src/util/attribute.h" - -namespace re2c { - -void error(const char *fmt, ...) RE2C_GXX_ATTRIBUTE ((format (printf, 1, 2))); -void fatal(const char *fmt, ...) RE2C_GXX_ATTRIBUTE ((format (printf, 1, 2), noreturn)); -void fatal(const loc_t &loc, const char *fmt, ...) RE2C_GXX_ATTRIBUTE ((format (printf, 2, 3), noreturn)); -void error_arg(const char *option); -void warning_start(const loc_t &loc, bool error); -void warning_end(const char *type, bool error); -void warning(const char *type, const loc_t &loc, bool error, const char *fmt, ...) RE2C_GXX_ATTRIBUTE ((format (printf, 4, 5))); -void usage (); -void vernum (); -void version (); -std::string incond (const std::string & cond); - -} // namespace re2c - -#endif // _RE2C_CONF_MSG_ diff --git a/re2c/src/options/opt.cc b/re2c/src/options/opt.cc index de6c4427..7dea858a 100644 --- a/re2c/src/options/opt.cc +++ b/re2c/src/options/opt.cc @@ -1,4 +1,3 @@ -#include "src/options/msg.h" #include "src/options/opt.h" namespace re2c diff --git a/re2c/src/options/opt.h b/re2c/src/options/opt.h index 9f2d2e49..43bbe968 100644 --- a/re2c/src/options/opt.h +++ b/re2c/src/options/opt.h @@ -15,7 +15,7 @@ namespace re2c { -class Warn; +class Msg; enum target_t { @@ -311,7 +311,7 @@ enum parse_opts_t EXIT_FAIL }; -parse_opts_t parse_opts(char **argv, conopt_t &globopts, Opt &opts, Warn &warn); +parse_opts_t parse_opts(char **argv, conopt_t &globopts, Opt &opts, Msg &msg); } // namespace re2c diff --git a/re2c/src/options/parse_opts.re b/re2c/src/options/parse_opts.re index 8b15daff..236cab8d 100644 --- a/re2c/src/options/parse_opts.re +++ b/re2c/src/options/parse_opts.re @@ -1,5 +1,4 @@ #include "src/codegen/input_api.h" -#include "src/options/msg.h" #include "src/options/opt.h" #include "src/regexp/empty_class_policy.h" #include "src/encoding/enc.h" @@ -14,7 +13,7 @@ static inline bool next (char * & arg, char ** & argv) return arg != NULL; } -parse_opts_t parse_opts(char **argv, conopt_t &globopts, Opt &opts, Warn &warn) +parse_opts_t parse_opts(char **argv, conopt_t &globopts, Opt &opts, Msg &msg) { #define YYCTYPE unsigned char @@ -58,8 +57,8 @@ opt: "-" { goto opt_short; } "--" { goto opt_long; } - "-W" end { warn.set_all (); goto opt; } - "-Werror" end { warn.set_all_error (); goto opt; } + "-W" end { msg.warn.set_all (); goto opt; } + "-Werror" end { msg.warn.set_all_error (); goto opt; } "-W" { option = Warn::W; goto opt_warn; } "-Wno-" { option = Warn::WNO; goto opt_warn; } "-Werror-" { option = Warn::WERROR; goto opt_warn; } @@ -70,14 +69,14 @@ opt_warn: /*!re2c * { ERROR("bad warning: %s", *argv); } - "condition-order" end { warn.set (Warn::CONDITION_ORDER, option); goto opt; } - "empty-character-class" end { warn.set (Warn::EMPTY_CHARACTER_CLASS, option); goto opt; } - "match-empty-string" end { warn.set (Warn::MATCH_EMPTY_STRING, option); goto opt; } - "nondeterministic-tags" end { warn.set (Warn::NONDETERMINISTIC_TAGS, option); goto opt; } - "swapped-range" end { warn.set (Warn::SWAPPED_RANGE, option); goto opt; } - "undefined-control-flow" end { warn.set (Warn::UNDEFINED_CONTROL_FLOW, option); goto opt; } - "unreachable-rules" end { warn.set (Warn::UNREACHABLE_RULES, option); goto opt; } - "useless-escape" end { warn.set (Warn::USELESS_ESCAPE, option); goto opt; } + "condition-order" end { msg.warn.set (Warn::CONDITION_ORDER, option); goto opt; } + "empty-character-class" end { msg.warn.set (Warn::EMPTY_CHARACTER_CLASS, option); goto opt; } + "match-empty-string" end { msg.warn.set (Warn::MATCH_EMPTY_STRING, option); goto opt; } + "nondeterministic-tags" end { msg.warn.set (Warn::NONDETERMINISTIC_TAGS, option); goto opt; } + "swapped-range" end { msg.warn.set (Warn::SWAPPED_RANGE, option); goto opt; } + "undefined-control-flow" end { msg.warn.set (Warn::UNDEFINED_CONTROL_FLOW, option); goto opt; } + "unreachable-rules" end { msg.warn.set (Warn::UNREACHABLE_RULES, option); goto opt; } + "useless-escape" end { msg.warn.set (Warn::USELESS_ESCAPE, option); goto opt; } */ opt_short: diff --git a/re2c/src/options/warn.cc b/re2c/src/options/warn.cc index f3a46e04..6a3b82d1 100644 --- a/re2c/src/options/warn.cc +++ b/re2c/src/options/warn.cc @@ -3,7 +3,6 @@ #include #include -#include "src/options/msg.h" #include "src/options/warn.h" #include "src/skeleton/path.h" #include "src/regexp/rule.h" @@ -22,9 +21,10 @@ const char * Warn::names [TYPES] = #undef W }; -Warn::Warn () +Warn::Warn (Msg &msg) : mask () , error_accuml (false) + , msg (msg) { for (uint32_t i = 0; i < TYPES; ++i) { @@ -79,7 +79,7 @@ void Warn::fail(type_t t, const loc_t &loc, const char *s) const { if (mask[t] & WARNING) { // -Werror has no effect - warning(names[t], loc, false, "%s", s); + msg.warning(names[t], loc, false, "%s", s); } } @@ -88,7 +88,7 @@ void Warn::condition_order(const loc_t &loc) if (mask[CONDITION_ORDER] & WARNING) { const bool e = mask[CONDITION_ORDER] & ERROR; error_accuml |= e; - warning (names[CONDITION_ORDER], loc, e, + msg.warning (names[CONDITION_ORDER], loc, e, "looks like you use hardcoded numbers instead of autogenerated " "condition names: better add '/*!types:re2c*/' directive or " "'-t, --type-header' option and don't rely on fixed condition order."); @@ -100,7 +100,7 @@ void Warn::empty_class(const loc_t &loc) if (mask[EMPTY_CHARACTER_CLASS] & WARNING) { const bool e = mask[EMPTY_CHARACTER_CLASS] & ERROR; error_accuml |= e; - warning (names[EMPTY_CHARACTER_CLASS], loc, e + msg.warning (names[EMPTY_CHARACTER_CLASS], loc, e , "empty character class"); } } @@ -110,7 +110,7 @@ void Warn::match_empty_string(const loc_t &loc, const std::string &cond) if (mask[MATCH_EMPTY_STRING] & WARNING) { const bool e = mask[MATCH_EMPTY_STRING] & ERROR; error_accuml |= e; - warning (names[MATCH_EMPTY_STRING], loc, e, + msg.warning (names[MATCH_EMPTY_STRING], loc, e, "rule %smatches empty string", incond(cond).c_str()); } } @@ -122,7 +122,7 @@ void Warn::nondeterministic_tags(const loc_t &loc, const std::string &cond bool e = mask[NONDETERMINISTIC_TAGS] & ERROR; error_accuml |= e; - warning_start(loc, e); + msg.warning_start(loc, e); if (tagname == NULL) { fprintf(stderr, "trailing context"); } @@ -133,7 +133,7 @@ void Warn::nondeterministic_tags(const loc_t &loc, const std::string &cond " %shas %u%s degree of nondeterminism", incond(cond).c_str(), static_cast(nver), nver == 2 ? "nd" : nver == 3 ? "rd" : "th"); - warning_end(names[NONDETERMINISTIC_TAGS], e); + msg.warning_end(names[NONDETERMINISTIC_TAGS], e); } } @@ -142,7 +142,7 @@ void Warn::swapped_range(const loc_t &loc, uint32_t l, uint32_t u) if (mask[SWAPPED_RANGE] & WARNING) { const bool e = mask[SWAPPED_RANGE] & ERROR; error_accuml |= e; - warning(names[SWAPPED_RANGE], loc, e + msg.warning(names[SWAPPED_RANGE], loc, e , "range lower bound (0x%X) is greater than upper bound (0x%X), swapping", l, u); } } @@ -157,7 +157,7 @@ void Warn::undefined_control_flow(const Skeleton &skel // report shorter patterns first std::sort(paths.begin(), paths.end()); - warning_start(skel.loc, e); + msg.warning_start(skel.loc, e); fprintf(stderr, "control flow %sis undefined for strings that match " , incond(skel.cond).c_str()); const size_t count = paths.size(); @@ -175,7 +175,7 @@ void Warn::undefined_control_flow(const Skeleton &skel fprintf(stderr, " ... and a few more"); } fprintf(stderr, ", use default rule '*'"); - warning_end(names[UNDEFINED_CONTROL_FLOW], e); + msg.warning_end(names[UNDEFINED_CONTROL_FLOW], e); } } @@ -185,7 +185,7 @@ void Warn::unreachable_rule(const std::string &cond, const Rule &rule) const bool e = mask[UNREACHABLE_RULES] & ERROR; error_accuml |= e; - warning_start(rule.code->loc, e); + msg.warning_start(rule.code->loc, e); fprintf(stderr, "unreachable rule %s", incond(cond).c_str()); const size_t shadows = rule.shadow.size(); if (shadows > 0) { @@ -199,7 +199,7 @@ void Warn::unreachable_rule(const std::string &cond, const Rule &rule) } fprintf(stderr, ")"); } - warning_end(names[UNREACHABLE_RULES], e); + msg.warning_end(names[UNREACHABLE_RULES], e); } } @@ -208,7 +208,7 @@ void Warn::useless_escape(const loc_t &loc, char c) if (mask[USELESS_ESCAPE] & WARNING) { const bool e = mask[USELESS_ESCAPE] & ERROR; error_accuml |= e; - warning(names[USELESS_ESCAPE], loc, e + msg.warning(names[USELESS_ESCAPE], loc, e , "escape has no effect: '\\%c'", c); } } diff --git a/re2c/src/options/warn.h b/re2c/src/options/warn.h index 886a6348..74e91308 100644 --- a/re2c/src/options/warn.h +++ b/re2c/src/options/warn.h @@ -11,6 +11,7 @@ namespace re2c { +class Msg; class path_t; struct Rule; struct Skeleton; @@ -50,9 +51,10 @@ private: static const char * names [TYPES]; uint32_t mask[TYPES]; bool error_accuml; + Msg &msg; public: - Warn (); + explicit Warn (Msg &msg); bool error () const; void set (type_t t, option_t o); void set_all (); diff --git a/re2c/src/parse/ast.h b/re2c/src/parse/ast.h index cbaddc14..36b979bc 100644 --- a/re2c/src/parse/ast.h +++ b/re2c/src/parse/ast.h @@ -21,9 +21,6 @@ struct ASTChar { uint32_t chr; loc_t loc; - - ASTChar(): chr(0), loc(0, 0, "") {} - ASTChar(uint32_t c, const loc_t &l): chr(c), loc(l) {} }; struct ASTRange diff --git a/re2c/src/parse/input.cc b/re2c/src/parse/input.cc index b2cc17fa..60fb70c7 100644 --- a/re2c/src/parse/input.cc +++ b/re2c/src/parse/input.cc @@ -1,18 +1,18 @@ #include "src/parse/input.h" #include "src/parse/scanner.h" -#include "src/options/msg.h" #include "src/util/get_dir.h" #include "src/util/string_utils.h" namespace re2c { -Input::Input() +Input::Input(size_t fidx) : file(NULL) , name() , escaped_name() , so(Scanner::ENDPOS) , eo(Scanner::ENDPOS) , line(1) + , fidx(static_cast(fidx)) {} bool Input::open(const std::string &filename, const std::string *parent diff --git a/re2c/src/parse/input.h b/re2c/src/parse/input.h index 25df02f7..f8d63fbc 100644 --- a/re2c/src/parse/input.h +++ b/re2c/src/parse/input.h @@ -17,8 +17,9 @@ struct Input const char *so; // start offset in buffer const char *eo; // end offset in buffer uint32_t line; + uint32_t fidx; - Input(); + explicit Input(size_t fidx); ~Input(); bool open(const std::string &filename, const std::string *parent , const std::vector &incpaths); diff --git a/re2c/src/parse/lex.re b/re2c/src/parse/lex.re index 0eca1ad3..9b4dd3e5 100644 --- a/re2c/src/parse/lex.re +++ b/re2c/src/parse/lex.re @@ -5,7 +5,6 @@ #include #include -#include "src/options/msg.h" #include "src/codegen/output.h" #include "src/encoding/enc.h" #include "src/parse/input.h" @@ -233,7 +232,7 @@ loop: /*!re2c * { goto loop; } eof { - fatal(cur_loc(), "expected end of block"); + msg.fatal(cur_loc(), "expected end of block"); } eol { next_line(); @@ -255,7 +254,7 @@ void Scanner::lex_tags(Output &out, bool mtags) loop: /*!re2c * { - fatal(cur_loc(), "unrecognized configuration"); + msg.fatal(cur_loc(), "unrecognized configuration"); } "format" { fmt = lex_conf_string(); @@ -315,7 +314,7 @@ scan: "{" [0-9]+ "}" { if (!s_to_u32_unsafe (tok + 1, cur - 1, yylval.bounds.min)) { - fatal(tok_loc(), "repetition count overflow"); + msg.fatal(tok_loc(), "repetition count overflow"); } yylval.bounds.max = yylval.bounds.min; return TOKEN_CLOSESIZE; @@ -323,30 +322,30 @@ scan: "{" [0-9]+ @p "," [0-9]+ "}" { if (!s_to_u32_unsafe (tok + 1, p, yylval.bounds.min)) { - fatal(tok_loc(), "repetition lower bound overflow"); + msg.fatal(tok_loc(), "repetition lower bound overflow"); } if (!s_to_u32_unsafe (p + 1, cur - 1, yylval.bounds.max)) { - fatal(tok_loc(), "repetition upper bound overflow"); + msg.fatal(tok_loc(), "repetition upper bound overflow"); } return TOKEN_CLOSESIZE; } "{" [0-9]+ ",}" { if (!s_to_u32_unsafe (tok + 1, cur - 2, yylval.bounds.min)) { - fatal(tok_loc(), "repetition lower bound overflow"); + msg.fatal(tok_loc(), "repetition lower bound overflow"); } yylval.bounds.max = std::numeric_limits::max(); return TOKEN_CLOSESIZE; } "{" [0-9]* "," { - fatal(tok_loc(), "illegal closure form, use '{n}', '{n,}', '{n,m}' " + msg.fatal(tok_loc(), "illegal closure form, use '{n}', '{n,}', '{n,m}' " "where n and m are numbers"); } "{" name "}" { if (!globopts->FFlag) { - fatal(tok_loc(), "curly braces for names only allowed with -F switch"); + msg.fatal(tok_loc(), "curly braces for names only allowed with -F switch"); } yylval.str = newstr(tok + 1, cur - 1); return TOKEN_ID; @@ -369,7 +368,7 @@ scan: // precedence in cases like ab*: it should be a(b)*, not (ab)* cur = tok + 1; - ASTChar c(static_cast(tok[0]), tok_loc()); + ASTChar c = {static_cast(tok[0]), tok_loc()}; std::vector *str = new std::vector; str->push_back(c); yylval.regexp = ast_str(tok_loc(), str, false); @@ -401,7 +400,7 @@ scan: } * { - fatal(tok_loc(), "unexpected character: '%c'", *tok); + msg.fatal(tok_loc(), "unexpected character: '%c'", *tok); goto scan; } */ @@ -451,7 +450,7 @@ end: return kind; error: delete cl; - fatal(cur_loc(), "syntax error in condition list"); + msg.fatal(cur_loc(), "syntax error in condition list"); } void Scanner::lex_code_indented() @@ -471,7 +470,7 @@ code: } eof { fail_if_eof(); goto code; } - [{}] { fatal(cur_loc(), "Curly braces are not allowed after ':='"); } + [{}] { msg.fatal(cur_loc(), "Curly braces are not allowed after ':='"); } "/*" { lex_c_comment(); goto code; } "//" { lex_cpp_comment(); goto code; } ["'] { lex_string(cur[-1]); goto code; } @@ -555,7 +554,7 @@ snd: "-" / [^\]] { u = lex_cls_chr(); if (l > u) { - warn.swapped_range(loc, l, u); + msg.warn.swapped_range(loc, l, u); std::swap(l, u); } goto add; @@ -572,12 +571,12 @@ uint32_t Scanner::lex_cls_chr() tok = cur; const loc_t &loc = cur_loc(); /*!re2c - * { fatal(loc, "syntax error"); } + * { msg.fatal(loc, "syntax error"); } eof { fail_if_eof(); return 0; } - esc? eol { fatal(loc, "newline in character class"); } - esc [xXuU] { fatal(loc, "syntax error in hexadecimal escape sequence"); } - esc [0-7] { fatal(loc, "syntax error in octal escape sequence"); } - esc { fatal(loc, "syntax error in escape sequence"); } + esc? eol { msg.fatal(loc, "newline in character class"); } + esc [xXuU] { msg.fatal(loc, "syntax error in hexadecimal escape sequence"); } + esc [0-7] { msg.fatal(loc, "syntax error in octal escape sequence"); } + esc { msg.fatal(loc, "syntax error in escape sequence"); } . \ esc { return static_cast(tok[0]); } esc_hex { return unesc_hex(tok, cur); } @@ -593,7 +592,7 @@ uint32_t Scanner::lex_cls_chr() esc "-" { return static_cast('-'); } esc "]" { return static_cast(']'); } esc (.\eof){ - warn.useless_escape(loc, tok[1]); + msg.warn.useless_escape(loc, tok[1]); return static_cast(tok[1]); } */ @@ -606,11 +605,11 @@ bool Scanner::lex_str_chr(char quote, ASTChar &ast) const loc_t &loc = ast.loc; bool ok = true; /*!re2c - * { fatal(loc, "syntax error"); } - esc? eol { fatal(loc, "newline in character string"); } - esc [xXuU] { fatal(loc, "syntax error in hexadecimal escape sequence"); } - esc [0-7] { fatal(loc, "syntax error in octal escape sequence"); } - esc { fatal(loc, "syntax error in escape sequence"); } + * { msg.fatal(loc, "syntax error"); } + esc? eol { msg.fatal(loc, "newline in character string"); } + esc [xXuU] { msg.fatal(loc, "syntax error in hexadecimal escape sequence"); } + esc [0-7] { msg.fatal(loc, "syntax error in octal escape sequence"); } + esc { msg.fatal(loc, "syntax error in escape sequence"); } eof { fail_if_eof(); ast.chr = 0; goto end; } @@ -629,7 +628,7 @@ bool Scanner::lex_str_chr(char quote, ASTChar &ast) const char c = tok[1]; ast.chr = static_cast(c); if (tok[1] != quote) { - warn.useless_escape(loc, c); + msg.warn.useless_escape(loc, c); } goto end; } @@ -659,16 +658,19 @@ sourceline: lineno { uint32_t l; if (!s_to_u32_unsafe(tok, cur, l)) { - fatal(tok_loc(), "line number overflow"); + msg.fatal(tok_loc(), "line number overflow"); } set_line(l); goto sourceline; } dstring { - std::string &name = get_input().escaped_name; + Input &in = get_input(); + std::string &name = in.escaped_name; name = getstr(tok + 1, cur - 1); strrreplace(name, "\\", "\\\\"); + in.fidx = static_cast(msg.filenames.size()); + msg.filenames.push_back(name); goto sourceline; } @@ -681,7 +683,7 @@ sourceline: void Scanner::fail_if_eof() const { if (is_eof()) { - fatal(cur_loc(), "unexpected end of input"); + msg.fatal(cur_loc(), "unexpected end of input"); } } diff --git a/re2c/src/parse/lex_conf.re b/re2c/src/parse/lex_conf.re index a5d275cc..39a2fa08 100644 --- a/re2c/src/parse/lex_conf.re +++ b/re2c/src/parse/lex_conf.re @@ -2,7 +2,6 @@ #include #include "src/codegen/output.h" -#include "src/options/msg.h" #include "src/encoding/enc.h" #include "src/parse/ast.h" #include "src/parse/scanner.h" @@ -72,7 +71,7 @@ void Scanner::lex_conf(Opt &opts) "eof" { const int32_t eof = lex_conf_number(); if (eof < 0) { - fatal(cur_loc(), "eof cannot have negative value"); + msg.fatal(cur_loc(), "eof cannot have negative value"); } opts.set_eof(static_cast(eof)); return; @@ -110,7 +109,7 @@ void Scanner::lex_conf(Opt &opts) "cgoto:threshold" { const int32_t n = lex_conf_number (); if (n < 0) { - fatal(cur_loc(), "configuration 'cgoto:threshold' must be nonnegative"); + msg.fatal(cur_loc(), "configuration 'cgoto:threshold' must be nonnegative"); } opts.set_cGotoThreshold (static_cast (n)); return; @@ -142,7 +141,7 @@ void Scanner::lex_conf(Opt &opts) "indent:top" { const int32_t n = lex_conf_number (); if (n < 0) { - fatal(cur_loc(), "configuration 'indent:top' must be nonnegative"); + msg.fatal(cur_loc(), "configuration 'indent:top' must be nonnegative"); } opts.set_topIndent (static_cast (n)); return; @@ -172,7 +171,7 @@ void Scanner::lex_conf(Opt &opts) "variable:yystable" { lex_conf_string (); return; } [a-zA-Z0-9_:-]* { - fatal(tok_loc(), "unrecognized configuration '%.*s'", + msg.fatal(tok_loc(), "unrecognized configuration '%.*s'", static_cast(cur - tok), tok); } */ @@ -182,7 +181,7 @@ void Scanner::lex_conf_encoding_policy(Opt &opts) { lex_conf_assign (); /*!re2c - * { fatal(cur_loc(), + * { msg.fatal(cur_loc(), "bad configuration value (expected: 'ignore', 'substitute', 'fail')"); } "ignore" { opts.set_encoding_policy(Enc::POLICY_IGNORE); goto end; } "substitute" { opts.set_encoding_policy(Enc::POLICY_SUBSTITUTE); goto end; } @@ -196,7 +195,7 @@ void Scanner::lex_conf_input(Opt &opts) { lex_conf_assign (); /*!re2c - * { fatal(cur_loc(), "bad configuration value (expected: 'default', 'custom')"); } + * { msg.fatal(cur_loc(), "bad configuration value (expected: 'default', 'custom')"); } "default" { opts.set_input_api(INPUT_DEFAULT); goto end; } "custom" { opts.set_input_api(INPUT_CUSTOM); goto end; } */ @@ -208,7 +207,7 @@ void Scanner::lex_conf_empty_class(Opt &opts) { lex_conf_assign (); /*!re2c - * { fatal(cur_loc(), + * { msg.fatal(cur_loc(), "bad configuration value (expected: 'match-empty', 'match-none', 'error')"); } "match-empty" { opts.set_empty_class_policy(EMPTY_CLASS_MATCH_EMPTY); goto end; } "match-none" { opts.set_empty_class_policy(EMPTY_CLASS_MATCH_NONE); goto end; } @@ -230,7 +229,7 @@ void Scanner::lex_conf_enc(Enc::type_t enc, Opt &opts) void Scanner::lex_conf_assign () { /*!re2c - * { fatal(cur_loc(), "missing '=' in configuration"); } + * { msg.fatal(cur_loc(), "missing '=' in configuration"); } conf_assign { return; } */ } @@ -238,7 +237,7 @@ void Scanner::lex_conf_assign () void Scanner::lex_conf_semicolon () { /*!re2c - * { fatal(cur_loc(), "missing ending ';' in configuration"); } + * { msg.fatal(cur_loc(), "missing ending ';' in configuration"); } space* ";" { return; } */ } @@ -253,11 +252,11 @@ int32_t Scanner::lex_conf_number () lex_conf_assign (); tok = cur; /*!re2c - * { fatal(cur_loc(), "bad configuration value (expected number)"); } + * { msg.fatal(cur_loc(), "bad configuration value (expected number)"); } number { int32_t n = 0; if (!s_to_i32_unsafe (tok, cur, n)) { - fatal(cur_loc(), "configuration value overflow"); + msg.fatal(cur_loc(), "configuration value overflow"); } lex_conf_semicolon (); return n; @@ -279,7 +278,9 @@ std::string Scanner::lex_conf_string () goto end; } if (c.chr > 0xFF) { - fatal(c.loc, "multibyte character in configuration string: 0x%X", c.chr); + msg.fatal(c.loc + , "multibyte character in configuration string: 0x%X" + , c.chr); } else { s += static_cast(c.chr); } diff --git a/re2c/src/parse/parse.h b/re2c/src/parse/parse.h index 7e09d551..d6e2b40d 100644 --- a/re2c/src/parse/parse.h +++ b/re2c/src/parse/parse.h @@ -6,7 +6,6 @@ #include "src/parse/ast.h" #include "src/parse/scanner.h" -#include "src/options/msg.h" #include "src/options/opt.h" namespace re2c @@ -27,7 +26,7 @@ struct context_t void parse(Scanner &input, specs_t &specs, symtab_t &symtab, Opt &opts); void validate_mode(Scanner::ParseMode mode, bool rflag, bool rules, Scanner &input); -void validate_ast(const specs_t &specs, const opt_t *opts); +void validate_ast(const specs_t &specs, const opt_t *opts, Msg &msg); void normalize_ast(specs_t &specs); } // namespace re2c diff --git a/re2c/src/parse/parser.ypp b/re2c/src/parse/parser.ypp index 348847c4..54e6ca58 100644 --- a/re2c/src/parse/parser.ypp +++ b/re2c/src/parse/parser.ypp @@ -70,13 +70,14 @@ spec def : name expr enddef { if (!context.symtab.insert(std::make_pair(*$1, $2)).second) { - fatal(context.input.tok_loc(), "sym already defined"); + context.input.msg.fatal(context.input.tok_loc() + , "sym already defined"); } delete $1; } /* errors */ | name expr '/' { - fatal(context.input.tok_loc() + context.input.msg.fatal(context.input.tok_loc() , "trailing contexts are not allowed in named definitions"); }; @@ -193,7 +194,8 @@ primary | TOKEN_ID { symtab_t::iterator i = context.symtab.find(*$1); if (i == context.symtab.end()) { - fatal(context.input.tok_loc(), "undefined symbol '%s'", $1->c_str()); + context.input.msg.fatal(context.input.tok_loc() + , "undefined symbol '%s'", $1->c_str()); } $$ = i->second; if (ast_need_wrap($$)) { @@ -210,7 +212,7 @@ extern "C" { void yyerror(context_t &context, const char* s) { - fatal(context.input.tok_loc(), "%s", s); + context.input.msg.fatal(context.input.tok_loc(), "%s", s); } int yylex(context_t &context) diff --git a/re2c/src/parse/scanner.cc b/re2c/src/parse/scanner.cc index 35232020..9194005d 100644 --- a/re2c/src/parse/scanner.cc +++ b/re2c/src/parse/scanner.cc @@ -1,14 +1,11 @@ #include #include "src/parse/scanner.h" -#include "src/options/msg.h" #include "src/debug/debug.h" namespace re2c { -class Warn; - const char *const Scanner::ENDPOS = (const char*) ~0LU; Scanner::~Scanner() @@ -32,11 +29,15 @@ size_t Scanner::get_input_index() const return i; } -bool Scanner::init(const std::string &filename) +bool Scanner::open(const std::string &filename, const std::string *parent) { - Input *in = new Input; + Input *in = new Input(msg.filenames.size()); files.push_back(in); - return in->open(filename, NULL, globopts->incpaths); + if (!in->open(filename, parent, globopts->incpaths)) { + return false; + } + msg.filenames.push_back(in->escaped_name); + return true; } bool Scanner::include(const std::string &filename) @@ -70,9 +71,9 @@ bool Scanner::include(const std::string &filename) } // open new file and place place at the top of stack - Input *in = new Input; - files.push_back(in); - if (!in->open(filename, &parent, globopts->incpaths)) return false; + if (!open(filename, &parent)) { + return false; + } // refill buffer (discard everything up to cursor, clear EOF) lim = cur = mar = ctx = tok = ptr = pos = bot + BSIZE; diff --git a/re2c/src/parse/scanner.h b/re2c/src/parse/scanner.h index 639bfc2b..edd455c3 100644 --- a/re2c/src/parse/scanner.h +++ b/re2c/src/parse/scanner.h @@ -8,10 +8,10 @@ #include #include "src/msg/location.h" +#include "src/msg/msg.h" #include "src/parse/input.h" #include "src/parse/lex.h" #include "src/options/opt.h" -#include "src/options/warn.h" #include "src/encoding/enc.h" #include "src/util/attribute.h" #include "src/util/forbid_copy.h" @@ -19,7 +19,7 @@ namespace re2c { -class Warn; +class Msg; struct Opt; struct conopt_t; class Output; @@ -33,16 +33,17 @@ public: enum ParseMode {Stop, Parse, Reuse, Rules}; static const char *const ENDPOS; + Msg &msg; + private: std::vector files; const conopt_t *globopts; - Warn &warn; loc_t loc; public: - Scanner(const conopt_t *o, Warn &w, const char *f); + Scanner(const conopt_t *o, Msg &m); ~Scanner(); - bool init(const std::string &filename); + bool open(const std::string &filename, const std::string *parent); bool include(const std::string &filename); const loc_t &tok_loc() const; loc_t cur_loc() const; @@ -90,24 +91,24 @@ private: FORBID_COPY (Scanner); }; -inline Scanner::Scanner(const conopt_t *o, Warn &w, const char *f) +inline Scanner::Scanner(const conopt_t *o, Msg &m) : ScannerState() + , msg(m) , files() , globopts(o) - , warn(w) - , loc(1, 0, f) + , loc(ATSTART) {} inline loc_t Scanner::cur_loc() const { - const std::string &f = get_cinput().escaped_name; - const uint32_t l = get_cinput().line; + const Input &in = get_cinput(); uint32_t c = static_cast(cur - pos); if (is_eof()) { DASSERT(c > 0); --c; } - return loc_t(l, c, f); + const loc_t loc = {in.line, c, in.fidx}; + return loc; } inline const loc_t &Scanner::tok_loc() const diff --git a/re2c/src/parse/validate.cc b/re2c/src/parse/validate.cc index 084c5414..56a541b3 100644 --- a/re2c/src/parse/validate.cc +++ b/re2c/src/parse/validate.cc @@ -4,49 +4,49 @@ #include "src/parse/ast.h" #include "src/parse/scanner.h" -#include "src/options/msg.h" #include "src/regexp/rule.h" namespace re2c { -void validate_mode(Scanner::ParseMode mode, bool rflag, bool rules, Scanner &input) +void validate_mode(Scanner::ParseMode mode, bool rflag, bool rules + , Scanner &input) { + Msg &msg = input.msg; const loc_t &l = input.tok_loc(); if (mode == Scanner::Rules) { if (!rflag) { - fatal(l, "found 'rules:re2c' block without -r flag"); + msg.fatal(l, "found 'rules:re2c' block without -r flag"); } else if (rules) { - fatal(l, "cannot have a second 'rules:re2c' block"); + msg.fatal(l, "cannot have a second 'rules:re2c' block"); } } else if (mode == Scanner::Reuse) { if (!rflag) { - fatal(l, "found 'use:re2c' block without -r flag"); + msg.fatal(l, "found 'use:re2c' block without -r flag"); } else if (!rules) { - fatal(l, "got 'use:re2c' without 'rules:re2c'"); + msg.fatal(l, "got 'use:re2c' without 'rules:re2c'"); } } else if (rflag) { - fatal(l, "found standard 're2c' block while using -r flag"); + msg.fatal(l, "found standard 're2c' block while using -r flag"); } } -void validate_ast(const specs_t &specs, const opt_t *opts) +void validate_ast(const specs_t &specs, const opt_t *opts, Msg &msg) { - static const uint32_t NONE = ~0u; specs_t::const_iterator i, b = specs.begin(), e = specs.end(); if (b == e) return; for (i = b; i != e; ++i) { if (i->defs.size() > 1) { - fatal(i->defs[1]->loc, + msg.fatal(i->defs[1]->loc, "code to default rule %sis already defined at line %u", incond(i->name).c_str(), i->defs[0]->loc.line); } if (!i->eofs.empty() && opts->eof == NOEOF) { - fatal(i->eofs[0]->loc, + msg.fatal(i->eofs[0]->loc, "%sEOF rule found, but 're2c:eof' configuration is not set", incond(i->name).c_str()); } @@ -55,28 +55,26 @@ void validate_ast(const specs_t &specs, const opt_t *opts) incond(i->name).c_str()); } else if (!i->eofs.empty() && opts->fFlag) { - fatal(i->eofs[0]->loc, + msg.fatal(i->eofs[0]->loc, "%sEOF rule is unreachable in push-model lexers", incond(i->name).c_str()); } else if (i->eofs.size() > 1) { - fatal(i->eofs[1]->loc, + msg.fatal(i->eofs[1]->loc, "EOF rule %sis already defined at line %u", incond(i->name).c_str(), i->eofs[0]->loc.line); } } - static const loc_t nowhere(NONE, NONE, ""); - if (!opts->cFlag) { for (i = b; i != e; ++i) { if (!i->name.empty()) { const loc_t &l = !i->rules.empty() ? i->rules[0].code->loc : !i->defs.empty() - ? i->defs[0]->loc : nowhere; - if (l.line != NONE) { - fatal(l, "conditions are only allowed with '-c', " - "'--conditions' option"); + ? i->defs[0]->loc : NOWHERE; + if (l.line != NOWHERE.line) { + msg.fatal(l, "conditions are only allowed with " + "'-c', '--conditions' option"); } } } @@ -86,9 +84,9 @@ void validate_ast(const specs_t &specs, const opt_t *opts) if (i->name.empty()) { const loc_t &l = !i->rules.empty() ? i->rules[0].code->loc : !i->defs.empty() - ? i->defs[0]->loc : nowhere; - if (l.line != NONE) { - fatal(l, "non-conditional rules are not allowed with " + ? i->defs[0]->loc : NOWHERE; + if (l.line != NOWHERE.line) { + msg.fatal(l, "non-conditional rules are not allowed with " "'-c', '--conditions' option"); } } @@ -96,7 +94,7 @@ void validate_ast(const specs_t &specs, const opt_t *opts) for (i = b; i != e; ++i) { if (i->setup.size() > 1) { - fatal(i->setup[1]->loc, + msg.fatal(i->setup[1]->loc, "code to setup rule '%s' is already defined at line %u", i->name.c_str(), i->setup[0]->loc.line); } @@ -104,7 +102,7 @@ void validate_ast(const specs_t &specs, const opt_t *opts) for (i = b; i != e; ++i) { if (i->name != "*" && !i->setup.empty() && i->rules.empty()) { - fatal(i->setup[0]->loc, + msg.fatal(i->setup[0]->loc, "setup for non existing condition '%s' found", i->name.c_str()); } @@ -114,7 +112,7 @@ void validate_ast(const specs_t &specs, const opt_t *opts) if (i == e) { for (i = b; i != e; ++i) { if (i->name == "*") { - fatal(i->setup[0]->loc, + msg.fatal(i->setup[0]->loc, "setup for all conditions '' is illegal " "if setup for each condition is defined explicitly"); } @@ -123,7 +121,7 @@ void validate_ast(const specs_t &specs, const opt_t *opts) for (i = b; i != e; ++i) { if (i->name == "0" && i->rules.size() > 1) { - fatal(i->rules[1].code->loc, + msg.fatal(i->rules[1].code->loc, "startup code is already defined at line %u", i->rules[0].code->loc.line); } diff --git a/re2c/src/regexp/ast_to_re.cc b/re2c/src/regexp/ast_to_re.cc index 17ff1d3a..b7566945 100644 --- a/re2c/src/regexp/ast_to_re.cc +++ b/re2c/src/regexp/ast_to_re.cc @@ -8,15 +8,14 @@ #include #include "src/parse/ast.h" -#include "src/options/msg.h" #include "src/options/opt.h" -#include "src/options/warn.h" -#include "src/regexp/empty_class_policy.h" #include "src/encoding/case.h" #include "src/encoding/enc.h" #include "src/encoding/ebcdic/ebcdic_regexp.h" #include "src/encoding/utf16/utf16_regexp.h" #include "src/encoding/utf8/utf8_regexp.h" +#include "src/msg/msg.h" +#include "src/regexp/empty_class_policy.h" #include "src/regexp/re.h" #include "src/regexp/rule.h" #include "src/regexp/tag.h" @@ -57,12 +56,12 @@ static Range *diff_to_range(RESpec &, const AST *); static Range *dot_to_range(RESpec &, const AST *); static Range *cls_to_range(RESpec &, const AST *); static bool misuse_of_named_def(RESpec &, const AST *); -static void assert_tags_used_once(const Rule &, const std::vector &); -static void init_rule(Rule &, const Code *, const std::vector &, size_t, size_t); +static void assert_tags_used_once(RESpec &, const Rule &, const std::vector &); +static void init_rule(RESpec &, Rule &, const Code *, const std::vector &, size_t, size_t); static bool is_icase(const opt_t *, bool); -RESpec::RESpec(const std::vector &ast, const opt_t *o, Warn &w +RESpec::RESpec(const std::vector &ast, const opt_t *o, Msg &msg , RangeMgr &rm) : alc() , rangemgr(rm) @@ -71,12 +70,12 @@ RESpec::RESpec(const std::vector &ast, const opt_t *o, Warn &w , tags(*new std::vector) , rules(*new std::valarray(ast.size())) , opts(o) - , warn(w) + , msg(msg) { for (size_t i = 0; i < ast.size(); ++i) { size_t ltag = tags.size(), ncap = 0; res.push_back(ast_to_re(*this, ast[i].ast, ncap, 0)); - init_rule(rules[i], ast[i].code, tags, ltag, ncap); + init_rule(*this, rules[i], ast[i].code, tags, ltag, ncap); } } @@ -176,10 +175,12 @@ RE *ast_to_re(RESpec &spec, const AST *ast, size_t &ncap, int32_t height) } case AST::TAG: { if (ast->tag.name && !opts->tags) { - fatal(ast->loc, "tags are only allowed with '-T, --tags' option"); + spec.msg.fatal(ast->loc + , "tags are only allowed with '-T, --tags' option"); } if (opts->posix_syntax) { - fatal(ast->loc, "simple tags are not allowed with '--posix-captures' option"); + spec.msg.fatal(ast->loc + , "simple tags are not allowed with '--posix-captures' option"); } RE *t = re_tag(spec, tags.size(), false); tags.push_back(Tag(ast->tag.name, ast->tag.history, height)); @@ -253,7 +254,7 @@ Range *char_to_range(RESpec &spec, const ASTChar &chr, bool icase) uint32_t c = chr.chr; if (!spec.opts->encoding.validateChar(c)) { - fatal(chr.loc, "bad code point: '0x%X'", c); + spec.msg.fatal(chr.loc, "bad code point: '0x%X'", c); } return icase && is_alpha(c) @@ -274,7 +275,7 @@ Range *cls_to_range(RESpec &spec, const AST *ast) for (; i != e; ++i) { Range *s = spec.opts->encoding.validateRange(rm, i->lower, i->upper); if (!s) { - fatal(i->loc, "bad code point range: '0x%X - 0x%X'" + spec.msg.fatal(i->loc, "bad code point range: '0x%X - 0x%X'" , i->lower, i->upper); } r = rm.add(r, s); @@ -294,7 +295,7 @@ Range *dot_to_range(RESpec &spec, const AST *ast) RangeMgr &rm = spec.rangemgr; uint32_t c = '\n'; if (!spec.opts->encoding.validateChar(c)) { - fatal(ast->loc, "bad code point: '0x%X'", c); + spec.msg.fatal(ast->loc, "bad code point: '0x%X'", c); } return rm.sub(spec.opts->encoding.fullRange(rm), rm.sym(c)); } @@ -338,7 +339,7 @@ Range *ast_to_range(RESpec &spec, const AST *ast) return spec.rangemgr.add(x, y); } } - fatal(ast->loc, "can only difference char sets"); + spec.msg.fatal(ast->loc, "can only difference char sets"); return NULL; } @@ -364,16 +365,15 @@ RE *re_string(RESpec &spec, const AST *ast) RE *re_class(RESpec &spec, const loc_t &loc, const Range *r) { if (!r) { - Warn &w = spec.warn; switch (spec.opts->empty_class_policy) { case EMPTY_CLASS_MATCH_EMPTY: - w.empty_class(loc); + spec.msg.warn.empty_class(loc); return re_nil(spec); case EMPTY_CLASS_MATCH_NONE: - w.empty_class(loc); + spec.msg.warn.empty_class(loc); break; case EMPTY_CLASS_ERROR: - fatal(loc, "empty character class"); + spec.msg.fatal(loc, "empty character class"); } } @@ -399,14 +399,15 @@ bool misuse_of_named_def(RESpec &spec, const AST *ast) if (!spec.opts->posix_syntax) return false; - fatal(ast->loc + spec.msg.fatal(ast->loc , "implicit grouping is forbidden with '--posix-captures'" " option, please wrap '%s' in capturing parenthesis" , ast->ref.name->c_str()); return true; } -void assert_tags_used_once(const Rule &rule, const std::vector &tags) +void assert_tags_used_once(RESpec &spec, const Rule &rule + , const std::vector &tags) { std::set names; const std::string *name = NULL; @@ -414,22 +415,22 @@ void assert_tags_used_once(const Rule &rule, const std::vector &tags) for (size_t t = rule.ltag; t < rule.htag; ++t) { name = tags[t].name; if (name && !names.insert(*name).second) { - fatal(rule.code->loc + spec.msg.fatal(rule.code->loc , "tag '%s' is used multiple times in the same rule" , name->c_str()); } } } -void init_rule(Rule &rule, const Code *code, const std::vector &tags - , size_t ltag, size_t ncap) +void init_rule(RESpec &spec, Rule &rule, const Code *code + , const std::vector &tags, size_t ltag, size_t ncap) { rule.code = code; rule.ltag = ltag; rule.htag = tags.size(); for (rule.ttag = ltag; rule.ttag < rule.htag && !trailing(tags[rule.ttag]); ++rule.ttag); rule.ncap = ncap; - assert_tags_used_once(rule, tags); + assert_tags_used_once(spec, rule, tags); } bool is_icase(const opt_t *opts, bool icase) diff --git a/re2c/src/regexp/nullable.cc b/re2c/src/regexp/nullable.cc index efab9267..31a099b2 100644 --- a/re2c/src/regexp/nullable.cc +++ b/re2c/src/regexp/nullable.cc @@ -3,7 +3,7 @@ #include #include -#include "src/options/warn.h" +#include "src/msg/msg.h" #include "src/regexp/re.h" #include "src/regexp/rule.h" #include "src/regexp/tag.h" @@ -46,7 +46,7 @@ void warn_nullable(const RESpec &spec, const std::string &cond) for (size_t i = 0; i < nre; ++i) { bool trail = false; if (nullable(spec, spec.res[i], trail)) { - spec.warn.match_empty_string(spec.rules[i].code->loc, cond); + spec.msg.warn.match_empty_string(spec.rules[i].code->loc, cond); } } } diff --git a/re2c/src/regexp/re.h b/re2c/src/regexp/re.h index 23f69c68..2c87b63a 100644 --- a/re2c/src/regexp/re.h +++ b/re2c/src/regexp/re.h @@ -45,9 +45,9 @@ struct RESpec std::vector &tags; std::valarray &rules; const opt_t *opts; - Warn &warn; + Msg &msg; - RESpec(const std::vector &ast, const opt_t *o, Warn &w + RESpec(const std::vector &ast, const opt_t *o, Msg &msg , RangeMgr &rm); FORBID_COPY(RESpec); }; diff --git a/re2c/src/regexp/split_charset.cc b/re2c/src/regexp/split_charset.cc index a50ecb11..3cfb31ee 100644 --- a/re2c/src/regexp/split_charset.cc +++ b/re2c/src/regexp/split_charset.cc @@ -3,7 +3,6 @@ #include #include -#include "src/options/msg.h" #include "src/options/opt.h" #include "src/encoding/enc.h" #include "src/regexp/re.h" diff --git a/re2c/src/skeleton/control_flow.cc b/re2c/src/skeleton/control_flow.cc index 1d172e0d..d23cc6b4 100644 --- a/re2c/src/skeleton/control_flow.cc +++ b/re2c/src/skeleton/control_flow.cc @@ -5,7 +5,7 @@ #include #include -#include "src/options/warn.h" +#include "src/msg/msg.h" #include "src/regexp/rule.h" #include "src/skeleton/path.h" #include "src/skeleton/skeleton.h" @@ -64,14 +64,14 @@ static void naked_paths( } } -void warn_undefined_control_flow(const Skeleton &skel, Warn &warn) +void warn_undefined_control_flow(const Skeleton &skel) { ucf_t ucf(skel.nodes_count); naked_paths(skel, ucf, 0); if (!ucf.paths.empty()) { - warn.undefined_control_flow(skel, ucf.paths, ucf.size.overflow()); + skel.msg.warn.undefined_control_flow(skel, ucf.paths, ucf.size.overflow()); } else if (ucf.size.overflow()) { - warn.fail(Warn::UNDEFINED_CONTROL_FLOW, skel.loc, + skel.msg.warn.fail(Warn::UNDEFINED_CONTROL_FLOW, skel.loc, "DFA is too large to check undefined control flow"); } } diff --git a/re2c/src/skeleton/generate_data.cc b/re2c/src/skeleton/generate_data.cc index d5fa4e67..0333ea55 100644 --- a/re2c/src/skeleton/generate_data.cc +++ b/re2c/src/skeleton/generate_data.cc @@ -8,7 +8,6 @@ #include #include -#include "src/options/msg.h" #include "src/options/opt.h" #include "src/debug/debug.h" #include "src/dfa/tcmd.h" @@ -372,7 +371,7 @@ template { gencover(skel, cover, 0); if (cover.size.overflow()) { - warning(NULL, skel.loc, false, + skel.msg.warning(NULL, skel.loc, false, "DFA %sis too large: can only generate partial path cover", incond(skel.cond).c_str()); } diff --git a/re2c/src/skeleton/maxpath.cc b/re2c/src/skeleton/maxpath.cc index a0685235..f0e42a87 100644 --- a/re2c/src/skeleton/maxpath.cc +++ b/re2c/src/skeleton/maxpath.cc @@ -7,7 +7,6 @@ #include #include -#include "src/options/msg.h" #include "src/debug/debug.h" #include "src/skeleton/skeleton.h" diff --git a/re2c/src/skeleton/skeleton.cc b/re2c/src/skeleton/skeleton.cc index b2ee06f8..e7a6a123 100644 --- a/re2c/src/skeleton/skeleton.cc +++ b/re2c/src/skeleton/skeleton.cc @@ -49,11 +49,12 @@ const size_t Skeleton::DEFTAG = std::numeric_limits::max(); Skeleton::Skeleton(const dfa_t &dfa, const opt_t *op, size_t def , const std::string &dfa_name, const std::string &dfa_cond - , const loc_t &loc) + , const loc_t &loc, Msg &msg) : opts(op) , name(dfa_name) , cond(dfa_cond) , loc(loc) + , msg(msg) , nodes_count(dfa.states.size() + 1) // +1 for default state , nodes(new Node[nodes_count]) , cmd0(dfa.tcmd0) diff --git a/re2c/src/skeleton/skeleton.h b/re2c/src/skeleton/skeleton.h index 5890ef27..d723ba01 100644 --- a/re2c/src/skeleton/skeleton.h +++ b/re2c/src/skeleton/skeleton.h @@ -28,7 +28,7 @@ class path_t; struct DFA; struct dfa_state_t; struct dfa_t; -class Warn; +class Msg; class bitmaps_t; struct opt_t; struct tcmd_t; @@ -72,6 +72,7 @@ struct Skeleton const std::string name; const std::string cond; const loc_t loc; + Msg &msg; const size_t nodes_count; Node *nodes; @@ -87,7 +88,7 @@ struct Skeleton Skeleton(const dfa_t &dfa, const opt_t *op, size_t def , const std::string &dfa_name, const std::string &dfa_cond - , const loc_t &loc); + , const loc_t &loc, Msg &msg); ~Skeleton (); FORBID_COPY(Skeleton); }; @@ -106,7 +107,7 @@ template key_t rule2key(size_t r, size_t def) uint64_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, Warn &warn); +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_prolog(Output & o);