From e8e7235e521937ed6a2257c08574d056b48b6cde Mon Sep 17 00:00:00 2001 From: Ulya Trofimovich Date: Sat, 29 Jul 2017 19:10:44 +0100 Subject: [PATCH] Explicitly pass line/column info in all error messages. Updated tests. Some error messages are more precise now, e.g. ill-formed character classes and escape sequences: column points to the beginning of the faulty lexeme rather than to the middle of it where the error occured. Other error messages are less precise (lack column info), but the column reported before was too inexact and didn't make much sense. --- re2c/bootstrap/src/ast/lex.cc | 529 +++++++++--------- re2c/bootstrap/src/ast/lex_conf.cc | 228 ++++---- re2c/bootstrap/src/ast/parser.cc | 19 +- re2c/src/adfa/prepare.cc | 6 +- re2c/src/ast/lex.re | 55 +- re2c/src/ast/lex_conf.re | 39 +- re2c/src/ast/parser.h | 1 + re2c/src/ast/parser.ypp | 9 +- re2c/src/ast/scanner.cc | 46 +- re2c/src/ast/scanner.h | 10 - re2c/src/ast/validate.cc | 55 +- re2c/src/conf/msg.cc | 28 +- re2c/src/conf/msg.h | 8 +- re2c/src/dfa/closure.cc | 1 + re2c/src/re/ast_to_re.cc | 25 +- re2c/src/skeleton/generate_data.cc | 6 +- re2c/src/skeleton/maxpath.cc | 3 +- re2c/test/bug1529351.c | 2 +- re2c/test/code_points_error_esc.c | 2 +- re2c/test/code_points_error_lf.c | 2 +- re2c/test/cond_error_01.c.c | 2 +- re2c/test/cond_error_03.c.c | 2 +- re2c/test/cond_error_07.c.c | 2 +- re2c/test/error1.c | 2 +- re2c/test/error11.c | 2 +- re2c/test/error12.c | 2 +- re2c/test/error2.c | 2 +- re2c/test/error3.c | 2 +- re2c/test/error4.c | 2 +- re2c/test/error5.c | 2 +- re2c/test/error6.c | 2 +- re2c/test/error7.c | 2 +- re2c/test/error8.c | 2 +- re2c/test/error9.c | 2 +- re2c/test/flex-01.i.c | 2 +- re2c/test/overflow-2.c | 2 +- re2c/test/overflow-3.c | 2 +- .../implicit_grouping1.i--posix-captures.c | 2 +- re2c/test/repeat-00.cgi.c | 2 +- re2c/test/repeat-04.cgir.c | 2 +- re2c/test/repeat-05.cgir.c | 2 +- re2c/test/repeater_overflow.c | 2 +- 42 files changed, 547 insertions(+), 571 deletions(-) diff --git a/re2c/bootstrap/src/ast/lex.cc b/re2c/bootstrap/src/ast/lex.cc index a8297551..d322d54d 100644 --- a/re2c/bootstrap/src/ast/lex.cc +++ b/re2c/bootstrap/src/ast/lex.cc @@ -1,4 +1,4 @@ -/* Generated by re2c 0.16 on Fri Jul 28 12:23:09 2017 */ +/* Generated by re2c 0.16 on Sat Jul 29 19:04:57 2017 */ #line 1 "../src/ast/lex.re" #include "src/util/c99_stdint.h" #include @@ -7,6 +7,7 @@ #include #include +#include "src/conf/msg.h" #include "src/code/output.h" #include "src/re/encoding/enc.h" #include "src/ast/input.h" @@ -33,10 +34,10 @@ namespace re2c // source code is in ASCII: pointers have type 'char *' // but re2c makes an implicit assumption that YYCTYPE is unsigned // when it generates comparisons -#line 36 "../src/ast/lex.re" +#line 37 "../src/ast/lex.re" -#line 57 "../src/ast/lex.re" +#line 58 "../src/ast/lex.re" Scanner::ParseMode Scanner::echo(OutputFile &out) @@ -51,7 +52,7 @@ echo: ptr = cur; -#line 55 "src/ast/lex.cc" +#line 56 "src/ast/lex.cc" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -109,19 +110,19 @@ echo: } } ++YYCURSOR; -#line 127 "../src/ast/lex.re" +#line 128 "../src/ast/lex.re" { if (cur != eof) goto echo; out.wraw(tok, ptr); return Stop; } -#line 119 "src/ast/lex.cc" +#line 120 "src/ast/lex.cc" yy4: ++YYCURSOR; yy5: -#line 144 "../src/ast/lex.re" +#line 145 "../src/ast/lex.re" { goto echo; } -#line 125 "src/ast/lex.cc" +#line 126 "src/ast/lex.cc" yy6: yyaccept = 0; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -130,13 +131,13 @@ yy6: } if (yych == '#') goto yy14; yy7: -#line 138 "../src/ast/lex.re" +#line 139 "../src/ast/lex.re" { cline++; pos = cur; goto echo; } -#line 140 "src/ast/lex.cc" +#line 141 "src/ast/lex.cc" yy8: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy6; @@ -179,12 +180,12 @@ yy14: } yy16: ++YYCURSOR; -#line 71 "../src/ast/lex.re" +#line 72 "../src/ast/lex.re" { out.wraw(tok, ptr); return Parse; } -#line 188 "src/ast/lex.cc" +#line 189 "src/ast/lex.cc" yy18: yych = (YYCTYPE)*++YYCURSOR; if (yych == '!') goto yy20; @@ -433,12 +434,12 @@ yy69: yy71: ++YYCURSOR; YYCURSOR = YYCTXMARKER; -#line 133 "../src/ast/lex.re" +#line 134 "../src/ast/lex.re" { set_sourceline(); goto echo; } -#line 442 "src/ast/lex.cc" +#line 443 "src/ast/lex.cc" yy73: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy71; @@ -538,14 +539,14 @@ yy95: goto yy13; yy96: ++YYCURSOR; -#line 92 "../src/ast/lex.re" +#line 93 "../src/ast/lex.re" { out.wraw(tok, ptr); out.wdelay_yymaxfill(); lex_end_of_comment(out); goto echo; } -#line 549 "src/ast/lex.cc" +#line 550 "src/ast/lex.cc" yy98: yych = (YYCTYPE)*++YYCURSOR; if (yych == '2') goto yy106; @@ -564,12 +565,12 @@ yy101: goto yy13; yy102: ++YYCURSOR; -#line 81 "../src/ast/lex.re" +#line 82 "../src/ast/lex.re" { out.wraw(tok, ptr); return Reuse; } -#line 573 "src/ast/lex.cc" +#line 574 "src/ast/lex.cc" yy104: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy110; @@ -604,33 +605,33 @@ yy111: goto yy13; yy112: ++YYCURSOR; -#line 121 "../src/ast/lex.re" +#line 122 "../src/ast/lex.re" { out.wraw(tok, ptr); lex_tags(out, true); goto echo; } -#line 614 "src/ast/lex.cc" +#line 615 "src/ast/lex.cc" yy114: ++YYCURSOR; -#line 76 "../src/ast/lex.re" +#line 77 "../src/ast/lex.re" { out.wraw(tok, ptr); return Rules; } -#line 622 "src/ast/lex.cc" +#line 623 "src/ast/lex.cc" yy116: ++YYCURSOR; -#line 115 "../src/ast/lex.re" +#line 116 "../src/ast/lex.re" { out.wraw(tok, ptr); lex_tags(out, false); goto echo; } -#line 631 "src/ast/lex.cc" +#line 632 "src/ast/lex.cc" yy118: ++YYCURSOR; -#line 106 "../src/ast/lex.re" +#line 107 "../src/ast/lex.re" { out.wraw(tok, ptr); out.wdelay_line_info(); @@ -639,34 +640,34 @@ yy118: lex_end_of_comment(out); goto echo; } -#line 643 "src/ast/lex.cc" +#line 644 "src/ast/lex.cc" yy120: yych = (YYCTYPE)*++YYCURSOR; if (yych == '2') goto yy123; goto yy13; yy121: ++YYCURSOR; -#line 86 "../src/ast/lex.re" +#line 87 "../src/ast/lex.re" { out.wraw(tok, ptr); lex_end_of_comment(out); goto echo; } -#line 656 "src/ast/lex.cc" +#line 657 "src/ast/lex.cc" yy123: yych = (YYCTYPE)*++YYCURSOR; if (yych != 'c') goto yy13; ++YYCURSOR; -#line 99 "../src/ast/lex.re" +#line 100 "../src/ast/lex.re" { out.wraw(tok, ptr); out.wdelay_state_goto(0); lex_end_of_comment(out); goto echo; } -#line 668 "src/ast/lex.cc" +#line 669 "src/ast/lex.cc" } -#line 145 "../src/ast/lex.re" +#line 146 "../src/ast/lex.re" } @@ -674,7 +675,7 @@ void Scanner::lex_end_of_comment(OutputFile &out) { uint32_t ignored = 0; for (;;) { -#line 678 "src/ast/lex.cc" +#line 679 "src/ast/lex.cc" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -690,20 +691,20 @@ void Scanner::lex_end_of_comment(OutputFile &out) } yy128: ++YYCURSOR; -#line 152 "../src/ast/lex.re" - { fatal("expected end of block"); } -#line 696 "src/ast/lex.cc" +#line 153 "../src/ast/lex.re" + { fatal_lc(get_cline(), get_column(), "expected end of block"); } +#line 697 "src/ast/lex.cc" yy130: ++YYCURSOR; yy131: -#line 154 "../src/ast/lex.re" +#line 155 "../src/ast/lex.re" { continue; } -#line 702 "src/ast/lex.cc" +#line 703 "src/ast/lex.cc" yy132: ++YYCURSOR; -#line 155 "../src/ast/lex.re" +#line 156 "../src/ast/lex.re" { ++ignored; continue; } -#line 707 "src/ast/lex.cc" +#line 708 "src/ast/lex.cc" yy134: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy132; @@ -712,7 +713,7 @@ yy135: yych = (YYCTYPE)*++YYCURSOR; if (yych != '/') goto yy131; ++YYCURSOR; -#line 156 "../src/ast/lex.re" +#line 157 "../src/ast/lex.re" { if (ignored > 0) { cline += ignored; @@ -721,9 +722,9 @@ yy135: tok = pos = cur; return; } -#line 725 "src/ast/lex.cc" +#line 726 "src/ast/lex.cc" } -#line 164 "../src/ast/lex.re" +#line 165 "../src/ast/lex.re" } } @@ -731,7 +732,7 @@ void Scanner::lex_tags(OutputFile &out, bool mtags) { std::string fmt, sep; for (;;) { -#line 735 "src/ast/lex.cc" +#line 736 "src/ast/lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -789,9 +790,9 @@ void Scanner::lex_tags(OutputFile &out, bool mtags) } ++YYCURSOR; yy141: -#line 171 "../src/ast/lex.re" - { fatal("unrecognized configuration"); } -#line 795 "src/ast/lex.cc" +#line 172 "../src/ast/lex.re" + { fatal_lc(get_cline(), get_column(), "unrecognized configuration"); } +#line 796 "src/ast/lex.cc" yy142: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -799,14 +800,14 @@ yy142: if (yybm[0+yych] & 128) { goto yy142; } -#line 176 "../src/ast/lex.re" +#line 177 "../src/ast/lex.re" { continue; } -#line 805 "src/ast/lex.cc" +#line 806 "src/ast/lex.cc" yy145: ++YYCURSOR; -#line 177 "../src/ast/lex.re" +#line 178 "../src/ast/lex.re" { ++cline; continue; } -#line 810 "src/ast/lex.cc" +#line 811 "src/ast/lex.cc" yy147: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy145; @@ -825,13 +826,13 @@ yy150: goto yy141; yy151: ++YYCURSOR; -#line 178 "../src/ast/lex.re" +#line 179 "../src/ast/lex.re" { out.wdelay_tags(new ConfTags(fmt, sep), mtags); tok = pos = cur; return; } -#line 835 "src/ast/lex.cc" +#line 836 "src/ast/lex.cc" yy153: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'r') goto yy156; @@ -868,9 +869,9 @@ yy161: goto yy154; yy162: ++YYCURSOR; -#line 173 "../src/ast/lex.re" +#line 174 "../src/ast/lex.re" { fmt = lex_conf_string(); continue; } -#line 874 "src/ast/lex.cc" +#line 875 "src/ast/lex.cc" yy164: yych = (YYCTYPE)*++YYCURSOR; if (yych != 't') goto yy154; @@ -879,11 +880,11 @@ yy164: yych = (YYCTYPE)*++YYCURSOR; if (yych != 'r') goto yy154; ++YYCURSOR; -#line 174 "../src/ast/lex.re" +#line 175 "../src/ast/lex.re" { sep = lex_conf_string(); continue; } -#line 885 "src/ast/lex.cc" +#line 886 "src/ast/lex.cc" } -#line 183 "../src/ast/lex.re" +#line 184 "../src/ast/lex.re" } } @@ -894,7 +895,7 @@ scan: tchar = cur - pos; tok = cur; -#line 898 "src/ast/lex.cc" +#line 899 "src/ast/lex.cc" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -994,12 +995,12 @@ scan: yy171: ++YYCURSOR; yy172: -#line 343 "../src/ast/lex.re" +#line 344 "../src/ast/lex.re" { - fatalf("unexpected character: '%c'", *tok); + fatal_lc(get_cline(), get_column(), "unexpected character: '%c'", *tok); goto scan; } -#line 1003 "src/ast/lex.cc" +#line 1004 "src/ast/lex.cc" yy173: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -1007,11 +1008,11 @@ yy173: if (yybm[0+yych] & 16) { goto yy173; } -#line 322 "../src/ast/lex.re" +#line 323 "../src/ast/lex.re" { goto scan; } -#line 1015 "src/ast/lex.cc" +#line 1016 "src/ast/lex.cc" yy176: yyaccept = 0; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -1022,7 +1023,7 @@ yy176: if (yych == '#') goto yy202; } yy177: -#line 331 "../src/ast/lex.re" +#line 332 "../src/ast/lex.re" { if (cur == eof) return 0; pos = cur; @@ -1034,7 +1035,7 @@ yy177: goto scan; } } -#line 1038 "src/ast/lex.cc" +#line 1039 "src/ast/lex.cc" yy178: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy176; @@ -1042,14 +1043,14 @@ yy178: yy179: ++YYCURSOR; yy180: -#line 235 "../src/ast/lex.re" +#line 236 "../src/ast/lex.re" { return *tok; } -#line 1048 "src/ast/lex.cc" +#line 1049 "src/ast/lex.cc" yy181: ++YYCURSOR; -#line 225 "../src/ast/lex.re" +#line 226 "../src/ast/lex.re" { yylval.regexp = lex_str('"'); return TOKEN_REGEXP; } -#line 1053 "src/ast/lex.cc" +#line 1054 "src/ast/lex.cc" yy183: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 'Z') { @@ -1073,21 +1074,21 @@ yy184: goto yy172; yy185: ++YYCURSOR; -#line 224 "../src/ast/lex.re" +#line 225 "../src/ast/lex.re" { yylval.regexp = lex_str('\''); return TOKEN_REGEXP; } -#line 1079 "src/ast/lex.cc" +#line 1080 "src/ast/lex.cc" yy187: yych = (YYCTYPE)*++YYCURSOR; if (yych == '/') goto yy207; goto yy180; yy188: ++YYCURSOR; -#line 317 "../src/ast/lex.re" +#line 318 "../src/ast/lex.re" { yylval.regexp = ast_dot(cline, get_column()); return TOKEN_REGEXP; } -#line 1091 "src/ast/lex.cc" +#line 1092 "src/ast/lex.cc" yy190: yych = (YYCTYPE)*++YYCURSOR; if (yych == '*') goto yy209; @@ -1130,9 +1131,9 @@ yy193: yy194: yych = (YYCTYPE)*++YYCURSOR; if (yych == '^') goto yy221; -#line 226 "../src/ast/lex.re" +#line 227 "../src/ast/lex.re" { yylval.regexp = lex_cls(false); return TOKEN_REGEXP; } -#line 1136 "src/ast/lex.cc" +#line 1137 "src/ast/lex.cc" yy196: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy223; @@ -1155,13 +1156,13 @@ yy197: } } yy198: -#line 193 "../src/ast/lex.re" +#line 194 "../src/ast/lex.re" { depth = 1; code_line = cline; goto code; } -#line 1165 "src/ast/lex.cc" +#line 1166 "src/ast/lex.cc" yy199: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -1212,40 +1213,40 @@ yy204: } } yy206: -#line 229 "../src/ast/lex.re" +#line 230 "../src/ast/lex.re" { const std::string *name = new std::string(tok + 1, tok_len() - 1); yylval.regexp = ast_tag(cline, get_column(), name, tok[0] == '#'); return TOKEN_REGEXP; } -#line 1222 "src/ast/lex.cc" +#line 1223 "src/ast/lex.cc" yy207: ++YYCURSOR; -#line 219 "../src/ast/lex.re" +#line 220 "../src/ast/lex.re" { tok = cur; return 0; } -#line 1230 "src/ast/lex.cc" +#line 1231 "src/ast/lex.cc" yy209: ++YYCURSOR; -#line 213 "../src/ast/lex.re" +#line 214 "../src/ast/lex.re" { depth = 1; goto comment; } -#line 1238 "src/ast/lex.cc" +#line 1239 "src/ast/lex.cc" yy211: ++YYCURSOR; -#line 210 "../src/ast/lex.re" +#line 211 "../src/ast/lex.re" { goto nextLine; } -#line 1245 "src/ast/lex.cc" +#line 1246 "src/ast/lex.cc" yy213: ++YYCURSOR; YYCURSOR -= 1; -#line 300 "../src/ast/lex.re" +#line 301 "../src/ast/lex.re" { if (!globopts->FFlag) { yylval.str = new std::string (tok, tok_len()); @@ -1262,7 +1263,7 @@ yy213: return TOKEN_REGEXP; } } -#line 1266 "src/ast/lex.cc" +#line 1267 "src/ast/lex.cc" yy215: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -1282,28 +1283,28 @@ yy215: yy217: ++YYCURSOR; YYCURSOR = YYCTXMARKER; -#line 295 "../src/ast/lex.re" +#line 296 "../src/ast/lex.re" { yylval.str = new std::string (tok, tok_len ()); return TOKEN_ID; } -#line 1291 "src/ast/lex.cc" +#line 1292 "src/ast/lex.cc" yy219: yych = (YYCTYPE)*++YYCURSOR; if (yych == '>') goto yy233; -#line 203 "../src/ast/lex.re" +#line 204 "../src/ast/lex.re" { tok += 2; /* skip ":=" */ depth = 0; code_line = cline; goto code; } -#line 1302 "src/ast/lex.cc" +#line 1303 "src/ast/lex.cc" yy221: ++YYCURSOR; -#line 227 "../src/ast/lex.re" +#line 228 "../src/ast/lex.re" { yylval.regexp = lex_cls(true); return TOKEN_REGEXP; } -#line 1307 "src/ast/lex.cc" +#line 1308 "src/ast/lex.cc" yy223: yych = (YYCTYPE)*++YYCURSOR; if (yych == '2') goto yy235; @@ -1311,11 +1312,11 @@ yy223: yy224: ++YYCURSOR; yy225: -#line 268 "../src/ast/lex.re" +#line 269 "../src/ast/lex.re" { - fatal("illegal closure form, use '{n}', '{n,}', '{n,m}' where n and m are numbers"); + fatal_lc(get_cline(), get_column(), "illegal closure form, use '{n}', '{n,}', '{n,m}' where n and m are numbers"); } -#line 1319 "src/ast/lex.cc" +#line 1320 "src/ast/lex.cc" yy226: ++YYCURSOR; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -1368,7 +1369,7 @@ yy230: yy231: ++YYCURSOR; YYCURSOR = YYCTXMARKER; -#line 282 "../src/ast/lex.re" +#line 283 "../src/ast/lex.re" { yylval.str = new std::string (tok, tok_len ()); if (globopts->FFlag) @@ -1381,15 +1382,15 @@ yy231: return TOKEN_ID; } } -#line 1385 "src/ast/lex.cc" +#line 1386 "src/ast/lex.cc" yy233: ++YYCURSOR; YYCURSOR -= 2; -#line 199 "../src/ast/lex.re" +#line 200 "../src/ast/lex.re" { return *tok; } -#line 1393 "src/ast/lex.cc" +#line 1394 "src/ast/lex.cc" yy235: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'c') goto yy242; @@ -1403,27 +1404,27 @@ yy236: goto yy225; yy237: ++YYCURSOR; -#line 237 "../src/ast/lex.re" +#line 238 "../src/ast/lex.re" { if (!s_to_u32_unsafe (tok + 1, cur - 1, yylval.bounds.min)) { - fatal ("repetition count overflow"); + fatal_lc(get_cline(), get_column(), "repetition count overflow"); } yylval.bounds.max = yylval.bounds.min; return TOKEN_CLOSESIZE; } -#line 1416 "src/ast/lex.cc" +#line 1417 "src/ast/lex.cc" yy239: ++YYCURSOR; -#line 272 "../src/ast/lex.re" +#line 273 "../src/ast/lex.re" { if (!globopts->FFlag) { - fatal("curly braces for names only allowed with -F switch"); + fatal_lc(get_cline(), get_column(), "curly braces for names only allowed with -F switch"); } yylval.str = new std::string (tok + 1, tok_len () - 2); // -2 to omit braces return TOKEN_ID; } -#line 1427 "src/ast/lex.cc" +#line 1428 "src/ast/lex.cc" yy241: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'n') goto yy247; @@ -1442,41 +1443,41 @@ yy243: goto yy201; yy245: ++YYCURSOR; -#line 259 "../src/ast/lex.re" +#line 260 "../src/ast/lex.re" { if (!s_to_u32_unsafe (tok + 1, cur - 2, yylval.bounds.min)) { - fatal ("repetition lower bound overflow"); + fatal_lc(get_cline(), get_column(), "repetition lower bound overflow"); } yylval.bounds.max = std::numeric_limits::max(); return TOKEN_CLOSESIZE; } -#line 1455 "src/ast/lex.cc" +#line 1456 "src/ast/lex.cc" yy247: yych = (YYCTYPE)*++YYCURSOR; if (yych == 'e') goto yy252; goto yy201; yy248: ++YYCURSOR; -#line 280 "../src/ast/lex.re" +#line 281 "../src/ast/lex.re" { return TOKEN_CONF; } -#line 1464 "src/ast/lex.cc" +#line 1465 "src/ast/lex.cc" yy250: ++YYCURSOR; -#line 246 "../src/ast/lex.re" +#line 247 "../src/ast/lex.re" { const char * p = strchr (tok, ','); if (!s_to_u32_unsafe (tok + 1, p, yylval.bounds.min)) { - fatal ("repetition lower bound overflow"); + fatal_lc(get_cline(), get_column(), "repetition lower bound overflow"); } if (!s_to_u32_unsafe (p + 1, cur - 1, yylval.bounds.max)) { - fatal ("repetition upper bound overflow"); + fatal_lc(get_cline(), get_column(), "repetition upper bound overflow"); } return TOKEN_CLOSESIZE; } -#line 1480 "src/ast/lex.cc" +#line 1481 "src/ast/lex.cc" yy252: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '0') goto yy254; @@ -1532,12 +1533,12 @@ yy257: yy259: ++YYCURSOR; YYCURSOR = YYCTXMARKER; -#line 326 "../src/ast/lex.re" +#line 327 "../src/ast/lex.re" { set_sourceline (); return TOKEN_LINE_INFO; } -#line 1541 "src/ast/lex.cc" +#line 1542 "src/ast/lex.cc" yy261: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy259; @@ -1562,12 +1563,12 @@ yy265: if (yych == '\n') goto yy201; goto yy262; } -#line 347 "../src/ast/lex.re" +#line 348 "../src/ast/lex.re" code: -#line 1571 "src/ast/lex.cc" +#line 1572 "src/ast/lex.cc" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -1628,27 +1629,27 @@ code: } yy268: ++YYCURSOR; -#line 410 "../src/ast/lex.re" +#line 411 "../src/ast/lex.re" { if (cur == eof) { if (depth) { - fatal("missing '}'"); + fatal_l(get_cline(), "missing '}'"); } return 0; } goto code; } -#line 1644 "src/ast/lex.cc" +#line 1645 "src/ast/lex.cc" yy270: ++YYCURSOR; yy271: -#line 424 "../src/ast/lex.re" +#line 425 "../src/ast/lex.re" { goto code; } -#line 1652 "src/ast/lex.cc" +#line 1653 "src/ast/lex.cc" yy272: yyaccept = 0; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -1667,7 +1668,7 @@ yy272: } } yy273: -#line 391 "../src/ast/lex.re" +#line 392 "../src/ast/lex.re" { if (depth == 0) { @@ -1681,13 +1682,13 @@ yy273: } else if (cur == eof) { - fatal("missing '}'"); + fatal_l(get_cline(), "missing '}'"); } pos = cur; cline++; goto code; } -#line 1691 "src/ast/lex.cc" +#line 1692 "src/ast/lex.cc" yy274: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -1700,11 +1701,11 @@ yy275: goto yy292; yy276: ++YYCURSOR; -#line 363 "../src/ast/lex.re" +#line 364 "../src/ast/lex.re" { if (depth == 0) { - fatal("Curly braces are not allowed after ':='"); + fatal_l(get_cline(), "Curly braces are not allowed after ':='"); } else { @@ -1712,14 +1713,14 @@ yy276: } goto code; } -#line 1716 "src/ast/lex.cc" +#line 1717 "src/ast/lex.cc" yy278: ++YYCURSOR; -#line 351 "../src/ast/lex.re" +#line 352 "../src/ast/lex.re" { if (depth == 0) { - fatal("Curly braces are not allowed after ':='"); + fatal_l(get_cline(), "Curly braces are not allowed after ':='"); } else if (--depth == 0) { @@ -1728,7 +1729,7 @@ yy278: } goto code; } -#line 1732 "src/ast/lex.cc" +#line 1733 "src/ast/lex.cc" yy280: yyaccept = 2; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -1740,7 +1741,7 @@ yy280: } yy281: YYCURSOR -= 1; -#line 378 "../src/ast/lex.re" +#line 379 "../src/ast/lex.re" { if (depth == 0) { @@ -1748,13 +1749,13 @@ yy281: } else if (cur == eof) { - fatal("missing '}'"); + fatal_l(get_cline(), "missing '}'"); } pos = cur; cline++; goto code; } -#line 1758 "src/ast/lex.cc" +#line 1759 "src/ast/lex.cc" yy282: ++YYCURSOR; goto yy281; @@ -1789,11 +1790,11 @@ yy287: if (yych >= '#') goto yy290; yy288: ++YYCURSOR; -#line 421 "../src/ast/lex.re" +#line 422 "../src/ast/lex.re" { goto code; } -#line 1797 "src/ast/lex.cc" +#line 1798 "src/ast/lex.cc" yy290: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -1883,12 +1884,12 @@ yy304: yy306: ++YYCURSOR; YYCURSOR = YYCTXMARKER; -#line 374 "../src/ast/lex.re" +#line 375 "../src/ast/lex.re" { set_sourceline (); goto code; } -#line 1892 "src/ast/lex.cc" +#line 1893 "src/ast/lex.cc" yy308: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy306; @@ -1917,12 +1918,12 @@ yy312: if (yych == '\n') goto yy285; goto yy309; } -#line 427 "../src/ast/lex.re" +#line 428 "../src/ast/lex.re" comment: -#line 1926 "src/ast/lex.cc" +#line 1927 "src/ast/lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -1969,7 +1970,7 @@ comment: } ++YYCURSOR; yy316: -#line 459 "../src/ast/lex.re" +#line 460 "../src/ast/lex.re" { if (cur == eof) { @@ -1977,7 +1978,7 @@ yy316: } goto comment; } -#line 1981 "src/ast/lex.cc" +#line 1982 "src/ast/lex.cc" yy317: yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yybm[0+yych] & 32) { @@ -1985,7 +1986,7 @@ yy317: } if (yych == '#') goto yy324; yy318: -#line 450 "../src/ast/lex.re" +#line 451 "../src/ast/lex.re" { if (cur == eof) { @@ -1995,7 +1996,7 @@ yy318: cline++; goto comment; } -#line 1999 "src/ast/lex.cc" +#line 2000 "src/ast/lex.cc" yy319: yych = (YYCTYPE)*++YYCURSOR; if (yych == '/') goto yy326; @@ -2029,7 +2030,7 @@ yy324: } yy326: ++YYCURSOR; -#line 431 "../src/ast/lex.re" +#line 432 "../src/ast/lex.re" { if (--depth == 0) { @@ -2040,16 +2041,16 @@ yy326: goto comment; } } -#line 2044 "src/ast/lex.cc" +#line 2045 "src/ast/lex.cc" yy328: ++YYCURSOR; -#line 441 "../src/ast/lex.re" +#line 442 "../src/ast/lex.re" { ++depth; - fatal("ambiguous /* found"); + fatal_lc(get_cline(), get_column(), "ambiguous /* found"); goto comment; } -#line 2053 "src/ast/lex.cc" +#line 2054 "src/ast/lex.cc" yy330: yych = (YYCTYPE)*++YYCURSOR; if (yych != 'i') goto yy323; @@ -2106,12 +2107,12 @@ yy338: yy340: ++YYCURSOR; YYCURSOR = YYCTXMARKER; -#line 446 "../src/ast/lex.re" +#line 447 "../src/ast/lex.re" { set_sourceline (); goto comment; } -#line 2115 "src/ast/lex.cc" +#line 2116 "src/ast/lex.cc" yy342: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy340; @@ -2136,28 +2137,28 @@ yy346: if (yych == '\n') goto yy323; goto yy343; } -#line 466 "../src/ast/lex.re" +#line 467 "../src/ast/lex.re" nextLine: -#line 2145 "src/ast/lex.cc" +#line 2146 "src/ast/lex.cc" { YYCTYPE yych; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yych == '\n') goto yy351; ++YYCURSOR; -#line 477 "../src/ast/lex.re" +#line 478 "../src/ast/lex.re" { if(cur == eof) { return 0; } goto nextLine; } -#line 2158 "src/ast/lex.cc" +#line 2159 "src/ast/lex.cc" yy351: ++YYCURSOR; -#line 470 "../src/ast/lex.re" +#line 471 "../src/ast/lex.re" { if(cur == eof) { return 0; } @@ -2165,9 +2166,9 @@ yy351: cline++; goto scan; } -#line 2169 "src/ast/lex.cc" +#line 2170 "src/ast/lex.cc" } -#line 482 "../src/ast/lex.re" +#line 483 "../src/ast/lex.re" } @@ -2193,35 +2194,35 @@ fst: tok = cur; c = get_column(); -#line 2197 "src/ast/lex.cc" +#line 2198 "src/ast/lex.cc" { YYCTYPE yych; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yych == ']') goto yy356; -#line 508 "../src/ast/lex.re" +#line 509 "../src/ast/lex.re" { l = lex_cls_chr(); goto snd; } -#line 2205 "src/ast/lex.cc" +#line 2206 "src/ast/lex.cc" yy356: ++YYCURSOR; -#line 507 "../src/ast/lex.re" +#line 508 "../src/ast/lex.re" { return ast_cls(cline, c0, cls, neg); } -#line 2210 "src/ast/lex.cc" +#line 2211 "src/ast/lex.cc" } -#line 509 "../src/ast/lex.re" +#line 510 "../src/ast/lex.re" snd: -#line 2216 "src/ast/lex.cc" +#line 2217 "src/ast/lex.cc" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = (YYCTYPE)*(YYMARKER = YYCURSOR); if (yych == '-') goto yy361; yy360: -#line 512 "../src/ast/lex.re" +#line 513 "../src/ast/lex.re" { u = l; goto add; } -#line 2225 "src/ast/lex.cc" +#line 2226 "src/ast/lex.cc" yy361: yych = (YYCTYPE)*++YYCURSOR; if (yych != ']') goto yy363; @@ -2230,7 +2231,7 @@ yy361: yy363: ++YYCURSOR; YYCURSOR -= 1; -#line 513 "../src/ast/lex.re" +#line 514 "../src/ast/lex.re" { u = lex_cls_chr(); if (l > u) { @@ -2239,9 +2240,9 @@ yy363: } goto add; } -#line 2243 "src/ast/lex.cc" +#line 2244 "src/ast/lex.cc" } -#line 521 "../src/ast/lex.re" +#line 522 "../src/ast/lex.re" add: cls->push_back(ASTRange(l, u, c)); @@ -2251,8 +2252,9 @@ add: uint32_t Scanner::lex_cls_chr() { tok = cur; + const uint32_t l = get_cline(), c = get_column(); -#line 2256 "src/ast/lex.cc" +#line 2258 "src/ast/lex.cc" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -2261,14 +2263,14 @@ uint32_t Scanner::lex_cls_chr() if (yych == '\n') goto yy369; if (yych == '\\') goto yy371; ++YYCURSOR; -#line 536 "../src/ast/lex.re" +#line 538 "../src/ast/lex.re" { return static_cast(tok[0]); } -#line 2267 "src/ast/lex.cc" +#line 2269 "src/ast/lex.cc" yy369: ++YYCURSOR; -#line 531 "../src/ast/lex.re" - { fatal (get_column() - tchar, "syntax error"); } -#line 2272 "src/ast/lex.cc" +#line 533 "../src/ast/lex.re" + { fatal_lc(l, c, "syntax error"); } +#line 2274 "src/ast/lex.cc" yy371: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '`') { @@ -2317,31 +2319,31 @@ yy371: } } } -#line 534 "../src/ast/lex.re" - { fatal (get_column() - tchar, "syntax error in escape sequence"); } -#line 2323 "src/ast/lex.cc" +#line 536 "../src/ast/lex.re" + { fatal_lc(l, c, "syntax error in escape sequence"); } +#line 2325 "src/ast/lex.cc" yy373: ++YYCURSOR; -#line 549 "../src/ast/lex.re" +#line 551 "../src/ast/lex.re" { warn.useless_escape(cline, get_column(), tok[1]); return static_cast(tok[1]); } -#line 2331 "src/ast/lex.cc" +#line 2333 "src/ast/lex.cc" yy375: ++YYCURSOR; -#line 547 "../src/ast/lex.re" +#line 549 "../src/ast/lex.re" { return static_cast('-'); } -#line 2336 "src/ast/lex.cc" +#line 2338 "src/ast/lex.cc" yy377: yyaccept = 0; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '/') goto yy378; if (yych <= '7') goto yy402; yy378: -#line 533 "../src/ast/lex.re" - { fatal (get_column() - tchar, "syntax error in octal escape sequence"); } -#line 2345 "src/ast/lex.cc" +#line 535 "../src/ast/lex.re" + { fatal_lc(l, c, "syntax error in octal escape sequence"); } +#line 2347 "src/ast/lex.cc" yy379: ++YYCURSOR; goto yy378; @@ -2357,9 +2359,9 @@ yy380: if (yych <= 'f') goto yy404; } yy381: -#line 532 "../src/ast/lex.re" - { fatal (get_column() - tchar, "syntax error in hexadecimal escape sequence"); } -#line 2363 "src/ast/lex.cc" +#line 534 "../src/ast/lex.re" + { fatal_lc(l, c, "syntax error in hexadecimal escape sequence"); } +#line 2365 "src/ast/lex.cc" yy382: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -2375,49 +2377,49 @@ yy382: } yy383: ++YYCURSOR; -#line 546 "../src/ast/lex.re" +#line 548 "../src/ast/lex.re" { return static_cast('\\'); } -#line 2381 "src/ast/lex.cc" +#line 2383 "src/ast/lex.cc" yy385: ++YYCURSOR; -#line 548 "../src/ast/lex.re" +#line 550 "../src/ast/lex.re" { return static_cast(']'); } -#line 2386 "src/ast/lex.cc" +#line 2388 "src/ast/lex.cc" yy387: ++YYCURSOR; -#line 539 "../src/ast/lex.re" +#line 541 "../src/ast/lex.re" { return static_cast('\a'); } -#line 2391 "src/ast/lex.cc" +#line 2393 "src/ast/lex.cc" yy389: ++YYCURSOR; -#line 540 "../src/ast/lex.re" +#line 542 "../src/ast/lex.re" { return static_cast('\b'); } -#line 2396 "src/ast/lex.cc" +#line 2398 "src/ast/lex.cc" yy391: ++YYCURSOR; -#line 541 "../src/ast/lex.re" +#line 543 "../src/ast/lex.re" { return static_cast('\f'); } -#line 2401 "src/ast/lex.cc" +#line 2403 "src/ast/lex.cc" yy393: ++YYCURSOR; -#line 542 "../src/ast/lex.re" +#line 544 "../src/ast/lex.re" { return static_cast('\n'); } -#line 2406 "src/ast/lex.cc" +#line 2408 "src/ast/lex.cc" yy395: ++YYCURSOR; -#line 543 "../src/ast/lex.re" +#line 545 "../src/ast/lex.re" { return static_cast('\r'); } -#line 2411 "src/ast/lex.cc" +#line 2413 "src/ast/lex.cc" yy397: ++YYCURSOR; -#line 544 "../src/ast/lex.re" +#line 546 "../src/ast/lex.re" { return static_cast('\t'); } -#line 2416 "src/ast/lex.cc" +#line 2418 "src/ast/lex.cc" yy399: ++YYCURSOR; -#line 545 "../src/ast/lex.re" +#line 547 "../src/ast/lex.re" { return static_cast('\v'); } -#line 2421 "src/ast/lex.cc" +#line 2423 "src/ast/lex.cc" yy401: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -2480,9 +2482,9 @@ yy406: } yy407: ++YYCURSOR; -#line 538 "../src/ast/lex.re" +#line 540 "../src/ast/lex.re" { return unesc_oct(tok, cur); } -#line 2486 "src/ast/lex.cc" +#line 2488 "src/ast/lex.cc" yy409: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { @@ -2509,9 +2511,9 @@ yy410: } yy411: ++YYCURSOR; -#line 537 "../src/ast/lex.re" +#line 539 "../src/ast/lex.re" { return unesc_hex(tok, cur); } -#line 2515 "src/ast/lex.cc" +#line 2517 "src/ast/lex.cc" yy413: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { @@ -2535,7 +2537,7 @@ yy414: goto yy403; } } -#line 553 "../src/ast/lex.re" +#line 555 "../src/ast/lex.re" } @@ -2543,8 +2545,9 @@ uint32_t Scanner::lex_str_chr(char quote, bool &end) { end = false; tok = cur; + const uint32_t l = get_cline(), c = get_column(); -#line 2548 "src/ast/lex.cc" +#line 2551 "src/ast/lex.cc" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -2553,17 +2556,17 @@ uint32_t Scanner::lex_str_chr(char quote, bool &end) if (yych == '\n') goto yy419; if (yych == '\\') goto yy421; ++YYCURSOR; -#line 566 "../src/ast/lex.re" +#line 569 "../src/ast/lex.re" { end = tok[0] == quote; return static_cast(tok[0]); } -#line 2562 "src/ast/lex.cc" +#line 2565 "src/ast/lex.cc" yy419: ++YYCURSOR; -#line 561 "../src/ast/lex.re" - { fatal (get_column() - tchar, "syntax error"); } -#line 2567 "src/ast/lex.cc" +#line 564 "../src/ast/lex.re" + { fatal_lc(l, c, "syntax error"); } +#line 2570 "src/ast/lex.cc" yy421: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 'a') { @@ -2609,28 +2612,28 @@ yy421: } } } -#line 564 "../src/ast/lex.re" - { fatal (get_column() - tchar, "syntax error in escape sequence"); } -#line 2615 "src/ast/lex.cc" +#line 567 "../src/ast/lex.re" + { fatal_lc(l, c, "syntax error in escape sequence"); } +#line 2618 "src/ast/lex.cc" yy423: ++YYCURSOR; -#line 580 "../src/ast/lex.re" +#line 583 "../src/ast/lex.re" { if (tok[1] != quote) { warn.useless_escape(cline, get_column(), tok[1]); } return static_cast(tok[1]); } -#line 2625 "src/ast/lex.cc" +#line 2628 "src/ast/lex.cc" yy425: yyaccept = 0; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych <= '/') goto yy426; if (yych <= '7') goto yy448; yy426: -#line 563 "../src/ast/lex.re" - { fatal (get_column() - tchar, "syntax error in octal escape sequence"); } -#line 2634 "src/ast/lex.cc" +#line 566 "../src/ast/lex.re" + { fatal_lc(l, c, "syntax error in octal escape sequence"); } +#line 2637 "src/ast/lex.cc" yy427: ++YYCURSOR; goto yy426; @@ -2646,9 +2649,9 @@ yy428: if (yych <= 'f') goto yy450; } yy429: -#line 562 "../src/ast/lex.re" - { fatal (get_column() - tchar, "syntax error in hexadecimal escape sequence"); } -#line 2652 "src/ast/lex.cc" +#line 565 "../src/ast/lex.re" + { fatal_lc(l, c, "syntax error in hexadecimal escape sequence"); } +#line 2655 "src/ast/lex.cc" yy430: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -2664,44 +2667,44 @@ yy430: } yy431: ++YYCURSOR; -#line 579 "../src/ast/lex.re" +#line 582 "../src/ast/lex.re" { return static_cast('\\'); } -#line 2670 "src/ast/lex.cc" +#line 2673 "src/ast/lex.cc" yy433: ++YYCURSOR; -#line 572 "../src/ast/lex.re" +#line 575 "../src/ast/lex.re" { return static_cast('\a'); } -#line 2675 "src/ast/lex.cc" +#line 2678 "src/ast/lex.cc" yy435: ++YYCURSOR; -#line 573 "../src/ast/lex.re" +#line 576 "../src/ast/lex.re" { return static_cast('\b'); } -#line 2680 "src/ast/lex.cc" +#line 2683 "src/ast/lex.cc" yy437: ++YYCURSOR; -#line 574 "../src/ast/lex.re" +#line 577 "../src/ast/lex.re" { return static_cast('\f'); } -#line 2685 "src/ast/lex.cc" +#line 2688 "src/ast/lex.cc" yy439: ++YYCURSOR; -#line 575 "../src/ast/lex.re" +#line 578 "../src/ast/lex.re" { return static_cast('\n'); } -#line 2690 "src/ast/lex.cc" +#line 2693 "src/ast/lex.cc" yy441: ++YYCURSOR; -#line 576 "../src/ast/lex.re" +#line 579 "../src/ast/lex.re" { return static_cast('\r'); } -#line 2695 "src/ast/lex.cc" +#line 2698 "src/ast/lex.cc" yy443: ++YYCURSOR; -#line 577 "../src/ast/lex.re" +#line 580 "../src/ast/lex.re" { return static_cast('\t'); } -#line 2700 "src/ast/lex.cc" +#line 2703 "src/ast/lex.cc" yy445: ++YYCURSOR; -#line 578 "../src/ast/lex.re" +#line 581 "../src/ast/lex.re" { return static_cast('\v'); } -#line 2705 "src/ast/lex.cc" +#line 2708 "src/ast/lex.cc" yy447: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -2764,9 +2767,9 @@ yy452: } yy453: ++YYCURSOR; -#line 571 "../src/ast/lex.re" +#line 574 "../src/ast/lex.re" { return unesc_oct(tok, cur); } -#line 2770 "src/ast/lex.cc" +#line 2773 "src/ast/lex.cc" yy455: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { @@ -2793,9 +2796,9 @@ yy456: } yy457: ++YYCURSOR; -#line 570 "../src/ast/lex.re" +#line 573 "../src/ast/lex.re" { return unesc_hex(tok, cur); } -#line 2799 "src/ast/lex.cc" +#line 2802 "src/ast/lex.cc" yy459: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '@') { @@ -2819,7 +2822,7 @@ yy460: goto yy449; } } -#line 586 "../src/ast/lex.re" +#line 589 "../src/ast/lex.re" } @@ -2839,7 +2842,7 @@ void Scanner::set_sourceline () sourceline: tok = cur; -#line 2843 "src/ast/lex.cc" +#line 2846 "src/ast/lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -2888,14 +2891,14 @@ sourceline: yy463: ++YYCURSOR; yy464: -#line 628 "../src/ast/lex.re" +#line 631 "../src/ast/lex.re" { goto sourceline; } -#line 2896 "src/ast/lex.cc" +#line 2899 "src/ast/lex.cc" yy465: ++YYCURSOR; -#line 616 "../src/ast/lex.re" +#line 619 "../src/ast/lex.re" { if (cur == eof) { @@ -2908,7 +2911,7 @@ yy465: tok = cur; return; } -#line 2912 "src/ast/lex.cc" +#line 2915 "src/ast/lex.cc" yy467: yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych == '\n') goto yy464; @@ -2920,15 +2923,15 @@ yy468: if (yybm[0+yych] & 64) { goto yy468; } -#line 605 "../src/ast/lex.re" +#line 608 "../src/ast/lex.re" { if (!s_to_u32_unsafe (tok, cur, cline)) { - fatal ("line number overflow"); + fatal_lc(get_cline(), get_column(), "line number overflow"); } goto sourceline; } -#line 2932 "src/ast/lex.cc" +#line 2935 "src/ast/lex.cc" yy471: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -2945,12 +2948,12 @@ yy473: goto yy464; yy474: ++YYCURSOR; -#line 612 "../src/ast/lex.re" +#line 615 "../src/ast/lex.re" { escape (in.file_name, std::string (tok + 1, tok_len () - 2)); // -2 to omit quotes goto sourceline; } -#line 2954 "src/ast/lex.cc" +#line 2957 "src/ast/lex.cc" yy476: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -2958,7 +2961,7 @@ yy476: if (yych == '\n') goto yy473; goto yy471; } -#line 631 "../src/ast/lex.re" +#line 634 "../src/ast/lex.re" } diff --git a/re2c/bootstrap/src/ast/lex_conf.cc b/re2c/bootstrap/src/ast/lex_conf.cc index 5e8db4b8..af93611a 100644 --- a/re2c/bootstrap/src/ast/lex_conf.cc +++ b/re2c/bootstrap/src/ast/lex_conf.cc @@ -1,4 +1,4 @@ -/* Generated by re2c 0.16 on Fri Jul 28 12:23:09 2017 */ +/* Generated by re2c 0.16 on Sat Jul 29 19:04:57 2017 */ #line 1 "../src/ast/lex_conf.re" #include "src/util/c99_stdint.h" #include @@ -19,8 +19,9 @@ namespace re2c void Scanner::lex_conf(Opt &opts) { tok = cur; + const uint32_t l = get_cline(), c = get_column(); -#line 24 "src/ast/lex_conf.cc" +#line 25 "src/ast/lex_conf.cc" { unsigned char yych; unsigned int yyaccept = 0; @@ -101,10 +102,9 @@ void Scanner::lex_conf(Opt &opts) } } yy2: -#line 160 "../src/ast/lex_conf.re" +#line 161 "../src/ast/lex_conf.re" { - fatal_error(cline, get_column(), - "unrecognized configuration '%.*s'", + fatal_lc(l, c, "unrecognized configuration '%.*s'", static_cast(cur - tok), tok); } #line 111 "src/ast/lex_conf.cc" @@ -495,7 +495,7 @@ yy89: if (yybm[0+yych] & 32) { goto yy3; } -#line 58 "../src/ast/lex_conf.re" +#line 59 "../src/ast/lex_conf.re" { lex_conf_enc(Enc::UTF8, opts); return; } #line 501 "src/ast/lex_conf.cc" yy91: @@ -503,7 +503,7 @@ yy91: if (yybm[0+yych] & 32) { goto yy3; } -#line 46 "../src/ast/lex_conf.re" +#line 47 "../src/ast/lex_conf.re" { opts.set_tags(lex_conf_bool()); return; } #line 509 "src/ast/lex_conf.cc" yy93: @@ -524,7 +524,7 @@ yy93: } } yy94: -#line 41 "../src/ast/lex_conf.re" +#line 42 "../src/ast/lex_conf.re" { opts.set_bFlag(lex_conf_bool()); return; } #line 530 "src/ast/lex_conf.cc" yy95: @@ -552,7 +552,7 @@ yy96: } } yy97: -#line 42 "../src/ast/lex_conf.re" +#line 43 "../src/ast/lex_conf.re" { opts.set_dFlag(lex_conf_bool()); return; } #line 558 "src/ast/lex_conf.cc" yy98: @@ -583,7 +583,7 @@ yy98: } } yy99: -#line 54 "../src/ast/lex_conf.re" +#line 55 "../src/ast/lex_conf.re" { lex_conf_enc(Enc::EBCDIC, opts); return; } #line 589 "src/ast/lex_conf.cc" yy100: @@ -591,7 +591,7 @@ yy100: if (yybm[0+yych] & 32) { goto yy3; } -#line 43 "../src/ast/lex_conf.re" +#line 44 "../src/ast/lex_conf.re" { opts.set_gFlag(lex_conf_bool()); return; } #line 597 "src/ast/lex_conf.cc" yy102: @@ -612,7 +612,7 @@ yy102: } } yy103: -#line 44 "../src/ast/lex_conf.re" +#line 45 "../src/ast/lex_conf.re" { opts.set_iFlag(lex_conf_bool()); return; } #line 618 "src/ast/lex_conf.cc" yy104: @@ -637,7 +637,7 @@ yy108: if (yybm[0+yych] & 32) { goto yy3; } -#line 45 "../src/ast/lex_conf.re" +#line 46 "../src/ast/lex_conf.re" { opts.set_sFlag(lex_conf_bool()); return; } #line 643 "src/ast/lex_conf.cc" yy110: @@ -665,7 +665,7 @@ yy111: } } yy112: -#line 55 "../src/ast/lex_conf.re" +#line 56 "../src/ast/lex_conf.re" { lex_conf_enc(Enc::UTF32, opts); return; } #line 671 "src/ast/lex_conf.cc" yy113: @@ -686,7 +686,7 @@ yy113: } } yy114: -#line 56 "../src/ast/lex_conf.re" +#line 57 "../src/ast/lex_conf.re" { lex_conf_enc(Enc::UCS2, opts); return; } #line 692 "src/ast/lex_conf.cc" yy115: @@ -694,7 +694,7 @@ yy115: if (yybm[0+yych] & 32) { goto yy3; } -#line 57 "../src/ast/lex_conf.re" +#line 58 "../src/ast/lex_conf.re" { lex_conf_enc(Enc::UTF16, opts); return; } #line 700 "src/ast/lex_conf.cc" yy117: @@ -903,7 +903,7 @@ yy165: if (yybm[0+yych] & 32) { goto yy3; } -#line 91 "../src/ast/lex_conf.re" +#line 92 "../src/ast/lex_conf.re" { opts.set_yybmHexTable (lex_conf_bool()); return; } #line 909 "src/ast/lex_conf.cc" yy167: @@ -942,7 +942,7 @@ yy174: } if (yych == '@') goto yy217; yy175: -#line 75 "../src/ast/lex_conf.re" +#line 76 "../src/ast/lex_conf.re" { opts.set_condGoto (lex_conf_string ()); return; } #line 948 "src/ast/lex_conf.cc" yy176: @@ -1099,7 +1099,7 @@ yy210: if (yybm[0+yych] & 32) { goto yy3; } -#line 142 "../src/ast/lex_conf.re" +#line 143 "../src/ast/lex_conf.re" { opts.set_bEmitYYCh (lex_conf_bool()); return; } #line 1105 "src/ast/lex_conf.cc" yy212: @@ -1157,7 +1157,7 @@ yy220: if (yybm[0+yych] & 32) { goto yy3; } -#line 71 "../src/ast/lex_conf.re" +#line 72 "../src/ast/lex_conf.re" { opts.set_condPrefix (lex_conf_string ()); return; } #line 1163 "src/ast/lex_conf.cc" yy222: @@ -1292,12 +1292,12 @@ yy250: if (yybm[0+yych] & 32) { goto yy3; } -#line 127 "../src/ast/lex_conf.re" +#line 128 "../src/ast/lex_conf.re" { const int32_t n = lex_conf_number (); if (n < 0) { - fatal ("configuration 'indent:top' must be nonnegative"); + fatal_lc(l, c, "configuration 'indent:top' must be nonnegative"); } opts.set_topIndent (static_cast (n)); return; @@ -1337,7 +1337,7 @@ yy255: } } yy256: -#line 155 "../src/ast/lex_conf.re" +#line 156 "../src/ast/lex_conf.re" { opts.set_startlabel (lex_conf_string()); return; } #line 1343 "src/ast/lex_conf.cc" yy257: @@ -1495,7 +1495,7 @@ yy294: if (yybm[0+yych] & 32) { goto yy3; } -#line 61 "../src/ast/lex_conf.re" +#line 62 "../src/ast/lex_conf.re" { lex_conf_input(opts); return; } #line 1501 "src/ast/lex_conf.cc" yy296: @@ -1547,7 +1547,7 @@ yy307: if (yybm[0+yych] & 32) { goto yy3; } -#line 151 "../src/ast/lex_conf.re" +#line 152 "../src/ast/lex_conf.re" { opts.set_labelPrefix (lex_conf_string ()); return; } #line 1553 "src/ast/lex_conf.cc" yy309: @@ -1585,7 +1585,7 @@ yy313: if (yybm[0+yych] & 32) { goto yy3; } -#line 86 "../src/ast/lex_conf.re" +#line 87 "../src/ast/lex_conf.re" { opts.set_bUseStateAbort (lex_conf_bool()); return; } #line 1591 "src/ast/lex_conf.cc" yy315: @@ -1601,7 +1601,7 @@ yy317: if (yybm[0+yych] & 32) { goto yy3; } -#line 122 "../src/ast/lex_conf.re" +#line 123 "../src/ast/lex_conf.re" { opts.set_tags_prefix (lex_conf_string ()); return; } #line 1607 "src/ast/lex_conf.cc" yy319: @@ -1645,7 +1645,7 @@ yy325: } if (yych == '@') goto yy383; yy326: -#line 73 "../src/ast/lex_conf.re" +#line 74 "../src/ast/lex_conf.re" { opts.set_condDivider (lex_conf_string ()); return; } #line 1651 "src/ast/lex_conf.cc" yy327: @@ -1799,7 +1799,7 @@ yy363: if (yybm[0+yych] & 32) { goto yy3; } -#line 85 "../src/ast/lex_conf.re" +#line 86 "../src/ast/lex_conf.re" { opts.set_yynext (lex_conf_string ()); return; } #line 1805 "src/ast/lex_conf.cc" yy365: @@ -1811,7 +1811,7 @@ yy366: ++cur; yy367: cur = ctx; -#line 154 "../src/ast/lex_conf.re" +#line 155 "../src/ast/lex_conf.re" { opts.set_startlabel_force (lex_conf_bool()); return; } #line 1817 "src/ast/lex_conf.cc" yy368: @@ -1860,7 +1860,7 @@ yy378: if (yybm[0+yych] & 32) { goto yy3; } -#line 149 "../src/ast/lex_conf.re" +#line 150 "../src/ast/lex_conf.re" { opts.set_fill_check (lex_conf_bool()); return; } #line 1866 "src/ast/lex_conf.cc" yy380: @@ -1931,7 +1931,7 @@ yy392: } } yy393: -#line 144 "../src/ast/lex_conf.re" +#line 145 "../src/ast/lex_conf.re" { opts.set_fill (lex_conf_string ()); return; } #line 1937 "src/ast/lex_conf.cc" yy394: @@ -1964,7 +1964,7 @@ yy400: if (yybm[0+yych] & 32) { goto yy3; } -#line 109 "../src/ast/lex_conf.re" +#line 110 "../src/ast/lex_conf.re" { opts.set_yypeek (lex_conf_string ()); return; } #line 1970 "src/ast/lex_conf.cc" yy402: @@ -1984,7 +1984,7 @@ yy405: if (yybm[0+yych] & 32) { goto yy3; } -#line 110 "../src/ast/lex_conf.re" +#line 111 "../src/ast/lex_conf.re" { opts.set_yyskip (lex_conf_string ()); return; } #line 1990 "src/ast/lex_conf.cc" yy407: @@ -2060,7 +2060,7 @@ yy423: if (yybm[0+yych] & 32) { goto yy3; } -#line 125 "../src/ast/lex_conf.re" +#line 126 "../src/ast/lex_conf.re" { opts.set_indString (lex_conf_string ()); return; } #line 2066 "src/ast/lex_conf.cc" yy425: @@ -2084,7 +2084,7 @@ yy429: if (yybm[0+yych] & 32) { goto yy3; } -#line 90 "../src/ast/lex_conf.re" +#line 91 "../src/ast/lex_conf.re" { opts.set_yybm (lex_conf_string ()); return; } #line 2090 "src/ast/lex_conf.cc" yy431: @@ -2092,7 +2092,7 @@ yy431: if (yybm[0+yych] & 32) { goto yy3; } -#line 140 "../src/ast/lex_conf.re" +#line 141 "../src/ast/lex_conf.re" { opts.set_yych (lex_conf_string ()); return; } #line 2098 "src/ast/lex_conf.cc" yy433: @@ -2116,7 +2116,7 @@ yy437: if (yybm[0+yych] & 32) { goto yy3; } -#line 145 "../src/ast/lex_conf.re" +#line 146 "../src/ast/lex_conf.re" { opts.set_fill_use (lex_conf_bool()); return; } #line 2122 "src/ast/lex_conf.cc" yy439: @@ -2133,7 +2133,7 @@ yy441: goto yy218; yy442: ++cur; -#line 76 "../src/ast/lex_conf.re" +#line 77 "../src/ast/lex_conf.re" { opts.set_condGotoParam (lex_conf_string ()); return; } #line 2139 "src/ast/lex_conf.cc" yy444: @@ -2141,7 +2141,7 @@ yy444: if (yybm[0+yych] & 32) { goto yy3; } -#line 72 "../src/ast/lex_conf.re" +#line 73 "../src/ast/lex_conf.re" { opts.set_condEnumPrefix (lex_conf_string ()); return; } #line 2147 "src/ast/lex_conf.cc" yy446: @@ -2161,7 +2161,7 @@ yy449: if (yybm[0+yych] & 32) { goto yy3; } -#line 139 "../src/ast/lex_conf.re" +#line 140 "../src/ast/lex_conf.re" { opts.set_yyctype (lex_conf_string ()); return; } #line 2167 "src/ast/lex_conf.cc" yy451: @@ -2173,7 +2173,7 @@ yy452: if (yybm[0+yych] & 32) { goto yy3; } -#line 137 "../src/ast/lex_conf.re" +#line 138 "../src/ast/lex_conf.re" { opts.set_yydebug (lex_conf_string ()); return; } #line 2179 "src/ast/lex_conf.cc" yy454: @@ -2201,7 +2201,7 @@ yy459: if (yybm[0+yych] & 32) { goto yy3; } -#line 107 "../src/ast/lex_conf.re" +#line 108 "../src/ast/lex_conf.re" { opts.set_yylimit (lex_conf_string ()); return; } #line 2207 "src/ast/lex_conf.cc" yy461: @@ -2213,7 +2213,7 @@ yy462: if (yybm[0+yych] & 32) { goto yy3; } -#line 119 "../src/ast/lex_conf.re" +#line 120 "../src/ast/lex_conf.re" { opts.set_yymtagn (lex_conf_string ()); return; } #line 2219 "src/ast/lex_conf.cc" yy464: @@ -2221,7 +2221,7 @@ yy464: if (yybm[0+yych] & 32) { goto yy3; } -#line 120 "../src/ast/lex_conf.re" +#line 121 "../src/ast/lex_conf.re" { opts.set_yymtagp (lex_conf_string ()); return; } #line 2227 "src/ast/lex_conf.cc" yy466: @@ -2241,7 +2241,7 @@ yy469: if (yybm[0+yych] & 32) { goto yy3; } -#line 117 "../src/ast/lex_conf.re" +#line 118 "../src/ast/lex_conf.re" { opts.set_yystagn (lex_conf_string ()); return; } #line 2247 "src/ast/lex_conf.cc" yy471: @@ -2249,7 +2249,7 @@ yy471: if (yybm[0+yych] & 32) { goto yy3; } -#line 118 "../src/ast/lex_conf.re" +#line 119 "../src/ast/lex_conf.re" { opts.set_yystagp (lex_conf_string ()); return; } #line 2255 "src/ast/lex_conf.cc" yy473: @@ -2353,12 +2353,12 @@ yy497: if (yybm[0+yych] & 32) { goto yy3; } -#line 93 "../src/ast/lex_conf.re" +#line 94 "../src/ast/lex_conf.re" { const int32_t n = lex_conf_number (); if (n < 0) { - fatal ("configuration 'cgoto:threshold' must be nonnegative"); + fatal_lc(l, c, "configuration 'cgoto:threshold' must be nonnegative"); } opts.set_cGotoThreshold (static_cast (n)); return; @@ -2387,7 +2387,7 @@ yy500: } } yy501: -#line 111 "../src/ast/lex_conf.re" +#line 112 "../src/ast/lex_conf.re" { opts.set_yybackup (lex_conf_string ()); return; } #line 2393 "src/ast/lex_conf.cc" yy502: @@ -2403,7 +2403,7 @@ yy504: if (yybm[0+yych] & 32) { goto yy3; } -#line 104 "../src/ast/lex_conf.re" +#line 105 "../src/ast/lex_conf.re" { opts.set_yycursor (lex_conf_string ()); return; } #line 2409 "src/ast/lex_conf.cc" yy506: @@ -2431,7 +2431,7 @@ yy511: if (yybm[0+yych] & 32) { goto yy3; } -#line 105 "../src/ast/lex_conf.re" +#line 106 "../src/ast/lex_conf.re" { opts.set_yymarker (lex_conf_string ()); return; } #line 2437 "src/ast/lex_conf.cc" yy513: @@ -2487,7 +2487,7 @@ yy525: if (yybm[0+yych] & 32) { goto yy3; } -#line 50 "../src/ast/lex_conf.re" +#line 51 "../src/ast/lex_conf.re" { opts.set_lookahead(lex_conf_bool()); return; } #line 2493 "src/ast/lex_conf.cc" yy527: @@ -2519,7 +2519,7 @@ yy533: if (yybm[0+yych] & 32) { goto yy3; } -#line 87 "../src/ast/lex_conf.re" +#line 88 "../src/ast/lex_conf.re" { opts.set_bUseStateNext (lex_conf_bool()); return; } #line 2525 "src/ast/lex_conf.cc" yy535: @@ -2527,7 +2527,7 @@ yy535: if (yybm[0+yych] & 32) { goto yy3; } -#line 123 "../src/ast/lex_conf.re" +#line 124 "../src/ast/lex_conf.re" { opts.set_tags_expression(lex_conf_string ()); return; } #line 2533 "src/ast/lex_conf.cc" yy537: @@ -2551,7 +2551,7 @@ yy541: if (yybm[0+yych] & 32) { goto yy3; } -#line 141 "../src/ast/lex_conf.re" +#line 142 "../src/ast/lex_conf.re" { opts.set_yychConversion (lex_conf_bool()); return; } #line 2557 "src/ast/lex_conf.cc" yy543: @@ -2615,7 +2615,7 @@ yy553: } } yy554: -#line 113 "../src/ast/lex_conf.re" +#line 114 "../src/ast/lex_conf.re" { opts.set_yyrestore (lex_conf_string ()); return; } #line 2621 "src/ast/lex_conf.cc" yy555: @@ -2655,7 +2655,7 @@ yy563: if (yybm[0+yych] & 32) { goto yy3; } -#line 52 "../src/ast/lex_conf.re" +#line 53 "../src/ast/lex_conf.re" { opts.set_eager_skip(lex_conf_bool()); return; } #line 2661 "src/ast/lex_conf.cc" yy565: @@ -2709,12 +2709,12 @@ yy576: if (yybm[0+yych] & 32) { goto yy3; } -#line 147 "../src/ast/lex_conf.re" +#line 148 "../src/ast/lex_conf.re" { opts.set_fill_arg_use (lex_conf_bool()); return; } #line 2715 "src/ast/lex_conf.cc" yy578: ++cur; -#line 74 "../src/ast/lex_conf.re" +#line 75 "../src/ast/lex_conf.re" { opts.set_condDividerParam (lex_conf_string ()); return; } #line 2720 "src/ast/lex_conf.cc" yy580: @@ -2726,7 +2726,7 @@ yy581: if (yybm[0+yych] & 32) { goto yy3; } -#line 65 "../src/ast/lex_conf.re" +#line 66 "../src/ast/lex_conf.re" { opts.set_yycondtype (lex_conf_string ()); return; } #line 2732 "src/ast/lex_conf.cc" yy583: @@ -2739,7 +2739,7 @@ yy584: goto yy4; yy585: ++cur; -#line 146 "../src/ast/lex_conf.re" +#line 147 "../src/ast/lex_conf.re" { opts.set_fill_arg (lex_conf_string ()); return; } #line 2745 "src/ast/lex_conf.cc" yy587: @@ -2765,7 +2765,7 @@ yy588: } } yy589: -#line 79 "../src/ast/lex_conf.re" +#line 80 "../src/ast/lex_conf.re" { opts.set_state_get (lex_conf_string ()); return; } #line 2771 "src/ast/lex_conf.cc" yy590: @@ -2773,7 +2773,7 @@ yy590: if (yybm[0+yych] & 32) { goto yy3; } -#line 116 "../src/ast/lex_conf.re" +#line 117 "../src/ast/lex_conf.re" { opts.set_yylessthan (lex_conf_string ()); return; } #line 2779 "src/ast/lex_conf.cc" yy592: @@ -2808,7 +2808,7 @@ yy595: } } yy596: -#line 81 "../src/ast/lex_conf.re" +#line 82 "../src/ast/lex_conf.re" { opts.set_state_set (lex_conf_string ()); return; } #line 2814 "src/ast/lex_conf.cc" yy597: @@ -2842,7 +2842,7 @@ yy603: if (yybm[0+yych] & 32) { goto yy3; } -#line 62 "../src/ast/lex_conf.re" +#line 63 "../src/ast/lex_conf.re" { lex_conf_empty_class(opts); return; } #line 2848 "src/ast/lex_conf.cc" yy605: @@ -2866,7 +2866,7 @@ yy609: if (yybm[0+yych] & 32) { goto yy3; } -#line 84 "../src/ast/lex_conf.re" +#line 85 "../src/ast/lex_conf.re" { opts.set_yyfilllabel (lex_conf_string ()); return; } #line 2872 "src/ast/lex_conf.cc" yy611: @@ -2874,7 +2874,7 @@ yy611: if (yybm[0+yych] & 32) { goto yy3; } -#line 88 "../src/ast/lex_conf.re" +#line 89 "../src/ast/lex_conf.re" { opts.set_yyaccept (lex_conf_string ()); return; } #line 2880 "src/ast/lex_conf.cc" yy613: @@ -2882,7 +2882,7 @@ yy613: if (yybm[0+yych] & 32) { goto yy3; } -#line 77 "../src/ast/lex_conf.re" +#line 78 "../src/ast/lex_conf.re" { opts.set_yyctable (lex_conf_string ()); return; } #line 2888 "src/ast/lex_conf.cc" yy615: @@ -2890,7 +2890,7 @@ yy615: if (yybm[0+yych] & 32) { goto yy3; } -#line 158 "../src/ast/lex_conf.re" +#line 159 "../src/ast/lex_conf.re" { lex_conf_string (); return; } #line 2896 "src/ast/lex_conf.cc" yy617: @@ -2898,7 +2898,7 @@ yy617: if (yybm[0+yych] & 32) { goto yy3; } -#line 102 "../src/ast/lex_conf.re" +#line 103 "../src/ast/lex_conf.re" { opts.set_yytarget (lex_conf_string ()); return; } #line 2904 "src/ast/lex_conf.cc" yy619: @@ -2906,7 +2906,7 @@ yy619: if (yybm[0+yych] & 32) { goto yy3; } -#line 112 "../src/ast/lex_conf.re" +#line 113 "../src/ast/lex_conf.re" { opts.set_yybackupctx (lex_conf_string ()); return; } #line 2912 "src/ast/lex_conf.cc" yy621: @@ -2914,7 +2914,7 @@ yy621: if (yybm[0+yych] & 32) { goto yy3; } -#line 106 "../src/ast/lex_conf.re" +#line 107 "../src/ast/lex_conf.re" { opts.set_yyctxmarker (lex_conf_string ()); return; } #line 2920 "src/ast/lex_conf.cc" yy623: @@ -2992,7 +2992,7 @@ yy640: if (yybm[0+yych] & 32) { goto yy3; } -#line 148 "../src/ast/lex_conf.re" +#line 149 "../src/ast/lex_conf.re" { opts.set_fill_naked (lex_conf_bool()); return; } #line 2998 "src/ast/lex_conf.cc" yy642: @@ -3008,7 +3008,7 @@ yy644: if (yybm[0+yych] & 32) { goto yy3; } -#line 114 "../src/ast/lex_conf.re" +#line 115 "../src/ast/lex_conf.re" { opts.set_yyrestorectx (lex_conf_string ()); return; } #line 3014 "src/ast/lex_conf.cc" yy646: @@ -3016,7 +3016,7 @@ yy646: if (yybm[0+yych] & 32) { goto yy3; } -#line 115 "../src/ast/lex_conf.re" +#line 116 "../src/ast/lex_conf.re" { opts.set_yyrestoretag (lex_conf_string ()); return; } #line 3022 "src/ast/lex_conf.cc" yy648: @@ -3040,7 +3040,7 @@ yy652: if (yybm[0+yych] & 32) { goto yy3; } -#line 49 "../src/ast/lex_conf.re" +#line 50 "../src/ast/lex_conf.re" { opts.set_bCaseInverted(lex_conf_bool()); return; } #line 3046 "src/ast/lex_conf.cc" yy654: @@ -3066,7 +3066,7 @@ yy658: if (yybm[0+yych] & 32) { goto yy3; } -#line 51 "../src/ast/lex_conf.re" +#line 52 "../src/ast/lex_conf.re" { opts.set_optimize_tags(lex_conf_bool()); return; } #line 3072 "src/ast/lex_conf.cc" yy660: @@ -3110,7 +3110,7 @@ yy669: if (yybm[0+yych] & 32) { goto yy3; } -#line 47 "../src/ast/lex_conf.re" +#line 48 "../src/ast/lex_conf.re" { opts.set_posix_captures(lex_conf_bool()); return; } #line 3116 "src/ast/lex_conf.cc" yy671: @@ -3132,7 +3132,7 @@ yy671: } } yy672: -#line 66 "../src/ast/lex_conf.re" +#line 67 "../src/ast/lex_conf.re" { opts.set_cond_get (lex_conf_string ()); return; } #line 3138 "src/ast/lex_conf.cc" yy673: @@ -3159,7 +3159,7 @@ yy674: } } yy675: -#line 68 "../src/ast/lex_conf.re" +#line 69 "../src/ast/lex_conf.re" { opts.set_cond_set (lex_conf_string ()); return; } #line 3165 "src/ast/lex_conf.cc" yy676: @@ -3183,7 +3183,7 @@ yy680: if (yybm[0+yych] & 32) { goto yy3; } -#line 60 "../src/ast/lex_conf.re" +#line 61 "../src/ast/lex_conf.re" { lex_conf_encoding_policy(opts); return; } #line 3189 "src/ast/lex_conf.cc" yy682: @@ -3215,7 +3215,7 @@ yy688: if (yybm[0+yych] & 32) { goto yy3; } -#line 48 "../src/ast/lex_conf.re" +#line 49 "../src/ast/lex_conf.re" { opts.set_bCaseInsensitive(lex_conf_bool()); return; } #line 3221 "src/ast/lex_conf.cc" yy690: @@ -3223,7 +3223,7 @@ yy690: if (yybm[0+yych] & 32) { goto yy3; } -#line 63 "../src/ast/lex_conf.re" +#line 64 "../src/ast/lex_conf.re" { lex_conf_dfa_minimization(opts); return; } #line 3229 "src/ast/lex_conf.cc" yy692: @@ -3235,7 +3235,7 @@ yy693: if (yybm[0+yych] & 32) { goto yy3; } -#line 80 "../src/ast/lex_conf.re" +#line 81 "../src/ast/lex_conf.re" { opts.set_state_get_naked (lex_conf_bool()); return; } #line 3241 "src/ast/lex_conf.cc" yy695: @@ -3251,12 +3251,12 @@ yy697: if (yybm[0+yych] & 32) { goto yy3; } -#line 82 "../src/ast/lex_conf.re" +#line 83 "../src/ast/lex_conf.re" { opts.set_state_set_naked (lex_conf_bool()); return; } #line 3257 "src/ast/lex_conf.cc" yy699: ++cur; -#line 83 "../src/ast/lex_conf.re" +#line 84 "../src/ast/lex_conf.re" { opts.set_state_set_arg (lex_conf_string ()); return; } #line 3262 "src/ast/lex_conf.cc" yy701: @@ -3293,7 +3293,7 @@ yy708: goto yy4; yy709: ++cur; -#line 69 "../src/ast/lex_conf.re" +#line 70 "../src/ast/lex_conf.re" { opts.set_cond_set_arg (lex_conf_string ()); return; } #line 3299 "src/ast/lex_conf.cc" yy711: @@ -3301,7 +3301,7 @@ yy711: if (yybm[0+yych] & 32) { goto yy3; } -#line 67 "../src/ast/lex_conf.re" +#line 68 "../src/ast/lex_conf.re" { opts.set_cond_get_naked (lex_conf_bool()); return; } #line 3307 "src/ast/lex_conf.cc" yy713: @@ -3309,7 +3309,7 @@ yy713: if (yybm[0+yych] & 32) { goto yy3; } -#line 70 "../src/ast/lex_conf.re" +#line 71 "../src/ast/lex_conf.re" { opts.set_cond_set_naked (lex_conf_bool()); return; } #line 3315 "src/ast/lex_conf.cc" } @@ -3335,8 +3335,8 @@ void Scanner::lex_conf_encoding_policy(Opt &opts) ++cur; yy718: #line 172 "../src/ast/lex_conf.re" - { fatal("bad configuration value" - " (expected: 'ignore', 'substitute', 'fail')"); } + { fatal_lc(get_cline(), get_column(), + "bad configuration value (expected: 'ignore', 'substitute', 'fail')"); } #line 3341 "src/ast/lex_conf.cc" yy719: yych = (unsigned char)*(mar = ++cur); @@ -3438,8 +3438,8 @@ yy745: ++cur; yy746: #line 186 "../src/ast/lex_conf.re" - { fatal("bad configuration value" - " (expected: 'default', 'custom')"); } + { fatal_lc(get_cline(), get_column(), + "bad configuration value (expected: 'default', 'custom')"); } #line 3444 "src/ast/lex_conf.cc" yy747: yych = (unsigned char)*(mar = ++cur); @@ -3516,8 +3516,8 @@ void Scanner::lex_conf_empty_class(Opt &opts) ++cur; yy766: #line 199 "../src/ast/lex_conf.re" - { fatal("bad configuration value" - " (expected: 'match-empty', 'match-none', 'error')"); } + { fatal_lc(get_cline(), get_column(), + "bad configuration value (expected: 'match-empty', 'match-none', 'error')"); } #line 3522 "src/ast/lex_conf.cc" yy767: yych = (unsigned char)*(mar = ++cur); @@ -3624,8 +3624,8 @@ void Scanner::lex_conf_dfa_minimization(Opt &opts) ++cur; yy794: #line 213 "../src/ast/lex_conf.re" - { fatal("bad configuration value" - " (expected: 'table', 'moore')"); } + { fatal_lc(get_cline(), get_column(), + "bad configuration value (expected: 'table', 'moore')"); } #line 3630 "src/ast/lex_conf.cc" yy795: yych = (unsigned char)*(mar = ++cur); @@ -3738,7 +3738,7 @@ void Scanner::lex_conf_assign () ++cur; yy811: #line 234 "../src/ast/lex_conf.re" - { fatal ("missing '=' in configuration"); } + { fatal_lc(get_cline(), get_column(), "missing '=' in configuration"); } #line 3743 "src/ast/lex_conf.cc" yy812: yych = (unsigned char)*(mar = ++cur); @@ -3827,7 +3827,7 @@ void Scanner::lex_conf_semicolon () ++cur; yy822: #line 242 "../src/ast/lex_conf.re" - { fatal ("missing ending ';' in configuration"); } + { fatal_lc(get_cline(), get_column(), "missing ending ';' in configuration"); } #line 3832 "src/ast/lex_conf.cc" yy823: yych = (unsigned char)*(mar = ++cur); @@ -3919,17 +3919,16 @@ yy832: yy833: ++cur; yy834: -#line 258 "../src/ast/lex_conf.re" +#line 257 "../src/ast/lex_conf.re" { int32_t n = 0; - if (!s_to_i32_unsafe (tok, cur, n)) - { - fatal ("configuration value overflow"); + if (!s_to_i32_unsafe (tok, cur, n)) { + fatal_lc(get_cline(), get_column(), "configuration value overflow"); } lex_conf_semicolon (); return n; } -#line 3933 "src/ast/lex_conf.cc" +#line 3932 "src/ast/lex_conf.cc" yy835: ++cur; if (lim <= cur) fill(1); @@ -3939,7 +3938,7 @@ yy835: } goto yy834; } -#line 267 "../src/ast/lex_conf.re" +#line 265 "../src/ast/lex_conf.re" } @@ -3949,7 +3948,7 @@ std::string Scanner::lex_conf_string () std::string s; tok = cur; -#line 3953 "src/ast/lex_conf.cc" +#line 3952 "src/ast/lex_conf.cc" { unsigned char yych; static const unsigned char yybm[] = { @@ -4003,9 +4002,9 @@ std::string Scanner::lex_conf_string () if (yych != ';') goto yy840; } } -#line 294 "../src/ast/lex_conf.re" +#line 293 "../src/ast/lex_conf.re" { goto end; } -#line 4009 "src/ast/lex_conf.cc" +#line 4008 "src/ast/lex_conf.cc" yy840: ++cur; if (lim <= cur) fill(1); @@ -4013,15 +4012,15 @@ yy840: if (yybm[0+yych] & 128) { goto yy840; } -#line 290 "../src/ast/lex_conf.re" +#line 289 "../src/ast/lex_conf.re" { s = std::string(tok, tok_len()); goto end; } -#line 4022 "src/ast/lex_conf.cc" +#line 4021 "src/ast/lex_conf.cc" yy843: ++cur; -#line 276 "../src/ast/lex_conf.re" +#line 274 "../src/ast/lex_conf.re" { const char quote = tok[0]; for (bool end;;) { @@ -4030,7 +4029,8 @@ yy843: goto end; } if (c > 0xFF) { - fatalf ("multibyte character in configuration string: 0x%X", c); + fatal_lc(get_cline(), get_column(), + "multibyte character in configuration string: 0x%X", c); } else { s += static_cast(c); } @@ -4038,7 +4038,7 @@ yy843: } #line 4040 "src/ast/lex_conf.cc" } -#line 295 "../src/ast/lex_conf.re" +#line 294 "../src/ast/lex_conf.re" end: lex_conf_semicolon (); diff --git a/re2c/bootstrap/src/ast/parser.cc b/re2c/bootstrap/src/ast/parser.cc index edb6cc7c..4ef1fe4f 100644 --- a/re2c/bootstrap/src/ast/parser.cc +++ b/re2c/bootstrap/src/ast/parser.cc @@ -471,11 +471,11 @@ static const yytype_uint8 yytranslate[] = /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 67, 67, 69, 70, 71, 72, 76, 83, 88, - 91, 95, 95, 98, 102, 106, 113, 120, 127, 133, - 135, 141, 148, 149, 155, 161, 168, 170, 176, 180, - 187, 191, 198, 202, 209, 210, 216, 221, 222, 226, - 227, 228, 232, 233, 243 + 0, 67, 67, 69, 70, 71, 72, 76, 83, 89, + 92, 96, 96, 99, 103, 107, 114, 121, 128, 134, + 136, 142, 149, 150, 156, 162, 169, 171, 177, 181, + 188, 192, 199, 203, 210, 211, 217, 222, 223, 227, + 228, 229, 233, 234, 244 }; #endif @@ -1304,7 +1304,7 @@ yyreduce: { if (!context.symtab.insert(std::make_pair(*(yyvsp[-2].str), (yyvsp[-1].regexp))).second) { - context.input.fatal("sym already defined"); + fatal_l(context.input.get_cline(), "sym already defined"); } delete (yyvsp[-2].str); } @@ -1314,7 +1314,8 @@ yyreduce: case 8: { - context.input.fatal("trailing contexts are not allowed in named definitions"); + fatal_l(context.input.get_cline(), + "trailing contexts are not allowed in named definitions"); } break; @@ -1556,7 +1557,7 @@ yyreduce: { symtab_t::iterator i = context.symtab.find(*(yyvsp[0].str)); if (i == context.symtab.end()) { - context.input.fatal("can't find symbol"); + fatal_l(context.input.get_cline(), "can't find symbol"); } (yyval.regexp) = i->second; if (ast_need_wrap((yyval.regexp))) { @@ -1811,7 +1812,7 @@ extern "C" { void yyerror(context_t &context, const char* s) { - context.input.fatal(s); + fatal_l(context.input.get_cline(), "%s", s); } int yylex(context_t &context) diff --git a/re2c/src/adfa/prepare.cc b/re2c/src/adfa/prepare.cc index 67cef7dd..0c7b0034 100644 --- a/re2c/src/adfa/prepare.cc +++ b/re2c/src/adfa/prepare.cc @@ -254,11 +254,9 @@ void DFA::calc_stats(uint32_t line, bool explicit_tags) // error if tags are not enabled, but we need them if (!explicit_tags && maxtagver > 1) { - error("line %u: overlapping trailing contexts need " + fatal_l(line, "overlapping trailing contexts need " "multiple context markers, use '-t, --tags' " - "option and '/*!stags:re2c ... */' directive", - line); - exit(1); + "option and '/*!stags:re2c ... */' directive"); } } diff --git a/re2c/src/ast/lex.re b/re2c/src/ast/lex.re index 47e50855..9220f2a3 100644 --- a/re2c/src/ast/lex.re +++ b/re2c/src/ast/lex.re @@ -5,6 +5,7 @@ #include #include +#include "src/conf/msg.h" #include "src/code/output.h" #include "src/re/encoding/enc.h" #include "src/ast/input.h" @@ -149,7 +150,7 @@ void Scanner::lex_end_of_comment(OutputFile &out) { uint32_t ignored = 0; for (;;) {/*!re2c - zero { fatal("expected end of block"); } + zero { fatal_lc(get_cline(), get_column(), "expected end of block"); } * { continue; } eol { ++ignored; continue; } @@ -168,7 +169,7 @@ void Scanner::lex_tags(OutputFile &out, bool mtags) { std::string fmt, sep; for (;;) {/*!re2c - * { fatal("unrecognized configuration"); } + * { fatal_lc(get_cline(), get_column(), "unrecognized configuration"); } "format" { fmt = lex_conf_string(); continue; } "separator" { sep = lex_conf_string(); continue; } @@ -237,7 +238,7 @@ scan: "{" [0-9]+ "}" { if (!s_to_u32_unsafe (tok + 1, cur - 1, yylval.bounds.min)) { - fatal ("repetition count overflow"); + fatal_lc(get_cline(), get_column(), "repetition count overflow"); } yylval.bounds.max = yylval.bounds.min; return TOKEN_CLOSESIZE; @@ -247,11 +248,11 @@ scan: const char * p = strchr (tok, ','); if (!s_to_u32_unsafe (tok + 1, p, yylval.bounds.min)) { - fatal ("repetition lower bound overflow"); + fatal_lc(get_cline(), get_column(), "repetition lower bound overflow"); } if (!s_to_u32_unsafe (p + 1, cur - 1, yylval.bounds.max)) { - fatal ("repetition upper bound overflow"); + fatal_lc(get_cline(), get_column(), "repetition upper bound overflow"); } return TOKEN_CLOSESIZE; } @@ -259,19 +260,19 @@ scan: "{" [0-9]+ ",}" { if (!s_to_u32_unsafe (tok + 1, cur - 2, yylval.bounds.min)) { - fatal ("repetition lower bound overflow"); + fatal_lc(get_cline(), get_column(), "repetition lower bound overflow"); } yylval.bounds.max = std::numeric_limits::max(); return TOKEN_CLOSESIZE; } "{" [0-9]* "," { - fatal("illegal closure form, use '{n}', '{n,}', '{n,m}' where n and m are numbers"); + fatal_lc(get_cline(), get_column(), "illegal closure form, use '{n}', '{n,}', '{n,m}' where n and m are numbers"); } "{" name "}" { if (!globopts->FFlag) { - fatal("curly braces for names only allowed with -F switch"); + fatal_lc(get_cline(), get_column(), "curly braces for names only allowed with -F switch"); } yylval.str = new std::string (tok + 1, tok_len () - 2); // -2 to omit braces return TOKEN_ID; @@ -341,7 +342,7 @@ scan: } * { - fatalf("unexpected character: '%c'", *tok); + fatal_lc(get_cline(), get_column(), "unexpected character: '%c'", *tok); goto scan; } */ @@ -351,7 +352,7 @@ code: "}" { if (depth == 0) { - fatal("Curly braces are not allowed after ':='"); + fatal_l(get_cline(), "Curly braces are not allowed after ':='"); } else if (--depth == 0) { @@ -363,7 +364,7 @@ code: "{" { if (depth == 0) { - fatal("Curly braces are not allowed after ':='"); + fatal_l(get_cline(), "Curly braces are not allowed after ':='"); } else { @@ -382,7 +383,7 @@ code: } else if (cur == eof) { - fatal("missing '}'"); + fatal_l(get_cline(), "missing '}'"); } pos = cur; cline++; @@ -401,7 +402,7 @@ code: } else if (cur == eof) { - fatal("missing '}'"); + fatal_l(get_cline(), "missing '}'"); } pos = cur; cline++; @@ -412,7 +413,7 @@ code: { if (depth) { - fatal("missing '}'"); + fatal_l(get_cline(), "missing '}'"); } return 0; } @@ -428,7 +429,7 @@ code: comment: /*!re2c - "*/" { + "*" "/" { if (--depth == 0) { goto scan; @@ -438,9 +439,9 @@ comment: goto comment; } } - "/*" { + "/" "*" { ++depth; - fatal("ambiguous /* found"); + fatal_lc(get_cline(), get_column(), "ambiguous /* found"); goto comment; } "\n" space* "#" space* "line" space+ / lineinf { @@ -527,11 +528,12 @@ add: uint32_t Scanner::lex_cls_chr() { tok = cur; + const uint32_t l = get_cline(), c = get_column(); /*!re2c - * { fatal (get_column() - tchar, "syntax error"); } - esc [xXuU] { fatal (get_column() - tchar, "syntax error in hexadecimal escape sequence"); } - esc [0-7] { fatal (get_column() - tchar, "syntax error in octal escape sequence"); } - esc { fatal (get_column() - tchar, "syntax error in escape sequence"); } + * { fatal_lc(l, c, "syntax error"); } + esc [xXuU] { fatal_lc(l, c, "syntax error in hexadecimal escape sequence"); } + esc [0-7] { fatal_lc(l, c, "syntax error in octal escape sequence"); } + esc { fatal_lc(l, c, "syntax error in escape sequence"); } . \ esc { return static_cast(tok[0]); } esc_hex { return unesc_hex(tok, cur); } @@ -557,11 +559,12 @@ uint32_t Scanner::lex_str_chr(char quote, bool &end) { end = false; tok = cur; + const uint32_t l = get_cline(), c = get_column(); /*!re2c - * { fatal (get_column() - tchar, "syntax error"); } - esc [xXuU] { fatal (get_column() - tchar, "syntax error in hexadecimal escape sequence"); } - esc [0-7] { fatal (get_column() - tchar, "syntax error in octal escape sequence"); } - esc { fatal (get_column() - tchar, "syntax error in escape sequence"); } + * { fatal_lc(l, c, "syntax error"); } + esc [xXuU] { fatal_lc(l, c, "syntax error in hexadecimal escape sequence"); } + esc [0-7] { fatal_lc(l, c, "syntax error in octal escape sequence"); } + esc { fatal_lc(l, c, "syntax error in escape sequence"); } . \ esc { end = tok[0] == quote; @@ -605,7 +608,7 @@ sourceline: lineno { if (!s_to_u32_unsafe (tok, cur, cline)) { - fatal ("line number overflow"); + fatal_lc(get_cline(), get_column(), "line number overflow"); } goto sourceline; } diff --git a/re2c/src/ast/lex_conf.re b/re2c/src/ast/lex_conf.re index b5081f0b..e71477a8 100644 --- a/re2c/src/ast/lex_conf.re +++ b/re2c/src/ast/lex_conf.re @@ -37,6 +37,7 @@ namespace re2c void Scanner::lex_conf(Opt &opts) { tok = cur; + const uint32_t l = get_cline(), c = get_column(); /*!re2c "flags:" ("b" | "bit-vectors") { opts.set_bFlag(lex_conf_bool()); return; } "flags:" ("d" | "debug-output") { opts.set_dFlag(lex_conf_bool()); return; } @@ -94,7 +95,7 @@ void Scanner::lex_conf(Opt &opts) const int32_t n = lex_conf_number (); if (n < 0) { - fatal ("configuration 'cgoto:threshold' must be nonnegative"); + fatal_lc(l, c, "configuration 'cgoto:threshold' must be nonnegative"); } opts.set_cGotoThreshold (static_cast (n)); return; @@ -128,7 +129,7 @@ void Scanner::lex_conf(Opt &opts) const int32_t n = lex_conf_number (); if (n < 0) { - fatal ("configuration 'indent:top' must be nonnegative"); + fatal_lc(l, c, "configuration 'indent:top' must be nonnegative"); } opts.set_topIndent (static_cast (n)); return; @@ -158,8 +159,7 @@ void Scanner::lex_conf(Opt &opts) "variable:yystable" { lex_conf_string (); return; } [a-zA-Z0-9_:-]* { - fatal_error(cline, get_column(), - "unrecognized configuration '%.*s'", + fatal_lc(l, c, "unrecognized configuration '%.*s'", static_cast(cur - tok), tok); } */ @@ -169,8 +169,8 @@ void Scanner::lex_conf_encoding_policy(Opt &opts) { lex_conf_assign (); /*!re2c - * { fatal("bad configuration value" - " (expected: 'ignore', 'substitute', 'fail')"); } + * { fatal_lc(get_cline(), get_column(), + "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; } "fail" { opts.set_encoding_policy(Enc::POLICY_FAIL); goto end; } @@ -183,8 +183,8 @@ void Scanner::lex_conf_input(Opt &opts) { lex_conf_assign (); /*!re2c - * { fatal("bad configuration value" - " (expected: 'default', 'custom')"); } + * { fatal_lc(get_cline(), get_column(), + "bad configuration value (expected: 'default', 'custom')"); } "default" { opts.set_input_api(INPUT_DEFAULT); goto end; } "custom" { opts.set_input_api(INPUT_CUSTOM); goto end; } */ @@ -196,8 +196,8 @@ void Scanner::lex_conf_empty_class(Opt &opts) { lex_conf_assign (); /*!re2c - * { fatal("bad configuration value" - " (expected: 'match-empty', 'match-none', 'error')"); } + * { fatal_lc(get_cline(), get_column(), + "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; } "error" { opts.set_empty_class_policy(EMPTY_CLASS_ERROR); goto end; } @@ -210,8 +210,8 @@ void Scanner::lex_conf_dfa_minimization(Opt &opts) { lex_conf_assign (); /*!re2c - * { fatal("bad configuration value" - " (expected: 'table', 'moore')"); } + * { fatal_lc(get_cline(), get_column(), + "bad configuration value (expected: 'table', 'moore')"); } "table" { opts.set_dfa_minimization(DFA_MINIMIZATION_TABLE); goto end; } "moore" { opts.set_dfa_minimization(DFA_MINIMIZATION_MOORE); goto end; } */ @@ -231,7 +231,7 @@ void Scanner::lex_conf_enc(Enc::type_t enc, Opt &opts) void Scanner::lex_conf_assign () { /*!re2c - * { fatal ("missing '=' in configuration"); } + * { fatal_lc(get_cline(), get_column(), "missing '=' in configuration"); } conf_assign { return; } */ } @@ -239,7 +239,7 @@ void Scanner::lex_conf_assign () void Scanner::lex_conf_semicolon () { /*!re2c - * { fatal ("missing ending ';' in configuration"); } + * { fatal_lc(get_cline(), get_column(), "missing ending ';' in configuration"); } space* ";" { return; } */ } @@ -254,12 +254,10 @@ int32_t Scanner::lex_conf_number () lex_conf_assign (); tok = cur; /*!re2c - number - { + number { int32_t n = 0; - if (!s_to_i32_unsafe (tok, cur, n)) - { - fatal ("configuration value overflow"); + if (!s_to_i32_unsafe (tok, cur, n)) { + fatal_lc(get_cline(), get_column(), "configuration value overflow"); } lex_conf_semicolon (); return n; @@ -281,7 +279,8 @@ std::string Scanner::lex_conf_string () goto end; } if (c > 0xFF) { - fatalf ("multibyte character in configuration string: 0x%X", c); + fatal_lc(get_cline(), get_column(), + "multibyte character in configuration string: 0x%X", c); } else { s += static_cast(c); } diff --git a/re2c/src/ast/parser.h b/re2c/src/ast/parser.h index d820fed1..52ab03de 100644 --- a/re2c/src/ast/parser.h +++ b/re2c/src/ast/parser.h @@ -4,6 +4,7 @@ #include #include +#include "src/conf/msg.h" #include "src/ast/ast.h" #include "src/conf/opt.h" #include "src/ast/scanner.h" diff --git a/re2c/src/ast/parser.ypp b/re2c/src/ast/parser.ypp index 36407982..2d78534e 100644 --- a/re2c/src/ast/parser.ypp +++ b/re2c/src/ast/parser.ypp @@ -75,13 +75,14 @@ spec def : name expr enddef { if (!context.symtab.insert(std::make_pair(*$1, $2)).second) { - context.input.fatal("sym already defined"); + fatal_l(context.input.get_cline(), "sym already defined"); } delete $1; } /* errors */ | name expr '/' { - context.input.fatal("trailing contexts are not allowed in named definitions"); + fatal_l(context.input.get_cline(), + "trailing contexts are not allowed in named definitions"); }; name @@ -233,7 +234,7 @@ primary | TOKEN_ID { symtab_t::iterator i = context.symtab.find(*$1); if (i == context.symtab.end()) { - context.input.fatal("can't find symbol"); + fatal_l(context.input.get_cline(), "can't find symbol"); } $$ = i->second; if (ast_need_wrap($$)) { @@ -250,7 +251,7 @@ extern "C" { void yyerror(context_t &context, const char* s) { - context.input.fatal(s); + fatal_l(context.input.get_cline(), "%s", s); } int yylex(context_t &context) diff --git a/re2c/src/ast/scanner.cc b/re2c/src/ast/scanner.cc index 3ce2b2aa..7ed9f874 100644 --- a/re2c/src/ast/scanner.cc +++ b/re2c/src/ast/scanner.cc @@ -1,10 +1,9 @@ -#include #include #include #include -#include #include +#include "src/conf/msg.h" #include "src/code/label.h" #include "src/code/output.h" #include "src/ast/scanner.h" @@ -92,49 +91,6 @@ void Scanner::fill (uint32_t need) } } -void Scanner::fatal_at(uint32_t line, ptrdiff_t ofs, const char *msg) const -{ - std::cerr << "re2c: error: " - << "line " << line << ", column " << (tchar + ofs + 1) << ": " - << msg << std::endl; - exit(1); -} - -void Scanner::fatal(ptrdiff_t ofs, const char *msg) const -{ - fatal_at(cline, ofs, msg); -} - -void Scanner::fatalf_at(uint32_t line, const char* fmt, ...) const -{ - char szBuf[4096]; - - va_list args; - - va_start(args, fmt); - vsnprintf(szBuf, sizeof(szBuf), fmt, args); - va_end(args); - - szBuf[sizeof(szBuf)-1] = '0'; - - fatal_at(line, 0, szBuf); -} - -void Scanner::fatalf(const char *fmt, ...) const -{ - char szBuf[4096]; - - va_list args; - - va_start(args, fmt); - vsnprintf(szBuf, sizeof(szBuf), fmt, args); - va_end(args); - - szBuf[sizeof(szBuf)-1] = '0'; - - fatal(szBuf); -} - Scanner::~Scanner() { delete [] bot; diff --git a/re2c/src/ast/scanner.h b/re2c/src/ast/scanner.h index 85ab9368..0d7d60df 100644 --- a/re2c/src/ast/scanner.h +++ b/re2c/src/ast/scanner.h @@ -86,11 +86,6 @@ public: uint32_t get_cline() const; uint32_t get_column() const; const std::string & get_fname () const; - void fatal_at(uint32_t line, ptrdiff_t ofs, const char *msg) const RE2C_GXX_ATTRIBUTE ((noreturn)); - void fatalf_at(uint32_t line, const char*, ...) const RE2C_GXX_ATTRIBUTE ((format (printf, 3, 4))) RE2C_GXX_ATTRIBUTE ((noreturn)); - void fatalf(const char*, ...) const RE2C_GXX_ATTRIBUTE ((format (printf, 2, 3))) RE2C_GXX_ATTRIBUTE ((noreturn)); - void fatal(const char*) const RE2C_GXX_ATTRIBUTE ((noreturn)); - void fatal(ptrdiff_t, const char*) const RE2C_GXX_ATTRIBUTE ((noreturn)); FORBID_COPY (Scanner); }; @@ -115,11 +110,6 @@ inline uint32_t Scanner::get_column() const return static_cast(tok - pos); } -inline void Scanner::fatal(const char *msg) const -{ - fatal(0, msg); -} - } // end namespace re2c #endif // _RE2C_AST_SCANNER_ diff --git a/re2c/src/ast/validate.cc b/re2c/src/ast/validate.cc index a770e4d5..238039f4 100644 --- a/re2c/src/ast/validate.cc +++ b/re2c/src/ast/validate.cc @@ -5,20 +5,21 @@ namespace re2c { void validate_mode(Scanner::ParseMode mode, bool rflag, bool rules, Scanner &input) { + const uint32_t l = input.get_cline(); if (mode == Scanner::Rules) { if (!rflag) { - input.fatal("found 'rules:re2c' block without -r flag"); + fatal_l(l, "found 'rules:re2c' block without -r flag"); } else if (rules) { - input.fatal("cannot have a second 'rules:re2c' block"); + fatal_l(l, "cannot have a second 'rules:re2c' block"); } } else if (mode == Scanner::Reuse) { if (!rflag) { - input.fatal("found 'use:re2c' block without -r flag"); + fatal_l(l, "found 'use:re2c' block without -r flag"); } else if (!rules) { - input.fatal("got 'use:re2c' without 'rules:re2c'"); + fatal_l(l, "got 'use:re2c' without 'rules:re2c'"); } } else if (rflag) { - input.fatal("found standard 're2c' block while using -r flag"); + fatal_l(l, "found standard 're2c' block while using -r flag"); } } @@ -30,44 +31,41 @@ void validate_ast(const specs_t &specs, bool cflag) for (i = b; i != e; ++i) { if (i->defs.size() > 1) { - error("line %u: code to default rule %sis already defined at line %u", - i->defs[1]->fline, incond(i->name).c_str(), i->defs[0]->fline); - exit(1); + fatal_l(i->defs[1]->fline, + "code to default rule %sis already defined at line %u", + incond(i->name).c_str(), i->defs[0]->fline); } } if (!cflag) { for (i = b; i != e; ++i) { if (i->name != "") { - error("line %u: conditions are only allowed" - " with '-c', '--conditions' option", - i->rules[0].code->fline); - exit(1); + fatal_l(i->rules[0].code->fline, + "conditions are only allowed with '-c', '--conditions' option"); } } } else { for (i = b; i != e; ++i) { if (i->name == "") { - error("line %u: non-conditional rules are not allowed" - " with '-c', '--conditions' option", - i->rules[0].code->fline); - exit(1); + fatal_l(i->rules[0].code->fline, + "non-conditional rules are not allowed" + " with '-c', '--conditions' option"); } } for (i = b; i != e; ++i) { if (i->setup.size() > 1) { - error("line %u: code to setup rule '%s' is already defined at line %u", - i->setup[1]->fline, i->name.c_str(), i->setup[0]->fline); - exit(1); + fatal_l(i->setup[1]->fline, + "code to setup rule '%s' is already defined at line %u", + i->name.c_str(), i->setup[0]->fline); } } for (i = b; i != e; ++i) { if (i->name != "*" && !i->setup.empty() && i->rules.empty()) { - error("line %u: setup for non existing condition '%s' found", - i->setup[0]->fline, i->name.c_str()); - exit(1); + fatal_l(i->setup[0]->fline, + "setup for non existing condition '%s' found", + i->name.c_str()); } } @@ -75,19 +73,18 @@ void validate_ast(const specs_t &specs, bool cflag) if (i == e) { for (i = b; i != e; ++i) { if (i->name == "*") { - error("line %u: setup for all conditions '' is illegal " - "if setup for each condition is defined explicitly", - i->setup[0]->fline); - exit(1); + fatal_l(i->setup[0]->fline, + "setup for all conditions '' is illegal " + "if setup for each condition is defined explicitly"); } } } for (i = b; i != e; ++i) { if (i->name == "0" && i->rules.size() > 1) { - error("line %u: startup code is already defined at line %u", - i->rules[1].code->fline, i->rules[0].code->fline); - exit(1); + fatal_l(i->rules[1].code->fline, + "startup code is already defined at line %u", + i->rules[0].code->fline); } } } diff --git a/re2c/src/conf/msg.cc b/re2c/src/conf/msg.cc index a0b046a5..7e8dad72 100644 --- a/re2c/src/conf/msg.cc +++ b/re2c/src/conf/msg.cc @@ -20,7 +20,33 @@ void error (const char * fmt, ...) fprintf (stderr, "\n"); } -void fatal_error(uint32_t line, uint32_t column, const char *fmt, ...) +void fatal(const char *fmt, ...) +{ + fprintf (stderr, "re2c: error: "); + + va_list args; + va_start (args, fmt); + vfprintf (stderr, fmt, args); + va_end (args); + + fprintf (stderr, "\n"); + exit(1); +} + +void fatal_l(uint32_t line, const char *fmt, ...) +{ + fprintf (stderr, "re2c: error: line %u: ", line); + + va_list args; + va_start (args, fmt); + vfprintf (stderr, fmt, args); + va_end (args); + + fprintf (stderr, "\n"); + exit(1); +} + +void fatal_lc(uint32_t line, uint32_t column, const char *fmt, ...) { fprintf (stderr, "re2c: error: line %u, column %u: ", line, column); diff --git a/re2c/src/conf/msg.h b/re2c/src/conf/msg.h index 3f9c1ada..5d6140f7 100644 --- a/re2c/src/conf/msg.h +++ b/re2c/src/conf/msg.h @@ -8,9 +8,11 @@ namespace re2c { -void error (const char * fmt, ...) RE2C_GXX_ATTRIBUTE ((format (printf, 1, 2))); -void fatal_error(uint32_t line, uint32_t column, const char *fmt, ...) RE2C_GXX_ATTRIBUTE ((format (printf, 3, 4))); -void error_arg (const char * option); +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_l(uint32_t line, const char *fmt, ...) RE2C_GXX_ATTRIBUTE ((format (printf, 2, 3), noreturn)); +void fatal_lc(uint32_t line, uint32_t column, const char *fmt, ...) RE2C_GXX_ATTRIBUTE ((format (printf, 3, 4), noreturn)); +void error_arg(const char *option); void warning_start (uint32_t line, bool error); void warning_end (const char * type, bool error); void warning (const char * type, uint32_t line, bool error, const char * fmt, ...) RE2C_GXX_ATTRIBUTE ((format (printf, 4, 5))); diff --git a/re2c/src/dfa/closure.cc b/re2c/src/dfa/closure.cc index a5a4b358..143338c7 100644 --- a/re2c/src/dfa/closure.cc +++ b/re2c/src/dfa/closure.cc @@ -57,6 +57,7 @@ bool cmpby_rule_state(const clos_t &x, const clos_t &y) if (sx < sy) return true; if (sx > sy) return false; assert(false); + return false; } // Skip non-orbit start tags: their position is fixed on some higher-priority diff --git a/re2c/src/re/ast_to_re.cc b/re2c/src/re/ast_to_re.cc index 3546e088..e3a56ff6 100644 --- a/re2c/src/re/ast_to_re.cc +++ b/re2c/src/re/ast_to_re.cc @@ -117,7 +117,7 @@ static RE *ast_to_re(RESpec &spec, const AST *ast, size_t &ncap) e = ast->cls.ranges->end(); for (; i != e; ++i) { Range *s = opts->encoding.encodeRange(i->lower, i->upper); - if (!s) fatal_error(ast->line, i->column, + if (!s) fatal_lc(ast->line, i->column, "bad code point range: '0x%X - 0x%X'", i->lower, i->upper); r = Range::add(r, s); } @@ -129,7 +129,7 @@ static RE *ast_to_re(RESpec &spec, const AST *ast, size_t &ncap) case AST::DOT: { uint32_t c = '\n'; if (!opts->encoding.encode(c)) { - fatal_error(ast->line, ast->column, "bad code point: '0x%X'", c); + fatal_lc(ast->line, ast->column, "bad code point: '0x%X'", c); } return re_class(alc, ast->line, ast->column, Range::sub(opts->encoding.fullRange(), Range::sym(c)), opts, warn); @@ -156,7 +156,7 @@ static RE *ast_to_re(RESpec &spec, const AST *ast, size_t &ncap) RE *x = ast_to_re(spec, ast->diff.ast1, ncap); RE *y = ast_to_re(spec, ast->diff.ast2, ncap); if (x->type != RE::SYM || y->type != RE::SYM) { - fatal_error(ast->line, ast->column, "can only difference char sets"); + fatal_lc(ast->line, ast->column, "can only difference char sets"); } return re_class(alc, ast->line, ast->column, Range::sub(x->sym, y->sym), opts, warn); } @@ -178,11 +178,11 @@ static RE *ast_to_re(RESpec &spec, const AST *ast, size_t &ncap) } case AST::TAG: { if (ast->tag.name && !opts->tags) { - fatal_error(ast->line, ast->column, + fatal_lc(ast->line, ast->column, "tags are only allowed with '-T, --tags' option"); } if (opts->posix_captures) { - fatal_error(ast->line, ast->column, + fatal_lc(ast->line, ast->column, "simple tags are not allowed with '--posix-captures' option"); } RE *t = re_tag(alc, tags.size(), false); @@ -209,10 +209,11 @@ static RE *ast_to_re(RESpec &spec, const AST *ast, size_t &ncap) if (!opts->posix_captures) { return ast_to_re(spec, ast->ref.ast, ncap); } - error("implicit grouping is forbidden with '--posix-captures'" + fatal_l(ast->line, + "implicit grouping is forbidden with '--posix-captures'" " option, please wrap '%s' in capturing parenthesis", ast->ref.name->c_str()); - exit(1); + return NULL; case AST::ITER: { const uint32_t n = ast->iter.min, @@ -257,7 +258,7 @@ static RE *ast_to_re(RESpec &spec, const AST *ast, size_t &ncap) RE *re_schar(RE::alc_t &alc, uint32_t line, uint32_t column, uint32_t c, const opt_t *opts) { if (!opts->encoding.encode(c)) { - fatal_error(line, column, "bad code point: '0x%X'", c); + fatal_lc(line, column, "bad code point: '0x%X'", c); } switch (opts->encoding.type ()) { case Enc::UTF16: return UTF16Symbol(alc, c); @@ -288,7 +289,7 @@ RE *re_class(RE::alc_t &alc, uint32_t line, uint32_t column, const Range *r, con warn.empty_class(line); break; case EMPTY_CLASS_ERROR: - fatal_error(line, column, "empty character class"); + fatal_lc(line, column, "empty character class"); break; } } @@ -307,9 +308,9 @@ static 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) { - error("line %u: tag '%s' is used multiple times in the same rule", - rule.code->fline, name->c_str()); - exit(1); + fatal_l(rule.code->fline, + "tag '%s' is used multiple times in the same rule", + name->c_str()); } } } diff --git a/re2c/src/skeleton/generate_data.cc b/re2c/src/skeleton/generate_data.cc index a9ac9ef9..9b690a49 100644 --- a/re2c/src/skeleton/generate_data.cc +++ b/re2c/src/skeleton/generate_data.cc @@ -386,14 +386,12 @@ void emit_data(const Skeleton &skel) const std::string input_name = fname + "." + skel.name + ".input"; FILE *input = fopen(input_name.c_str(), "wb"); if (!input) { - error("cannot open file: %s", input_name.c_str()); - exit(1); + fatal("cannot open file: %s", input_name.c_str()); } const std::string keys_name = std::string(fname) + "." + skel.name + ".keys"; FILE *keys = fopen (keys_name.c_str(), "wb"); if (!keys) { - error("cannot open file: %s", keys_name.c_str()); - exit(1); + fatal("cannot open file: %s", keys_name.c_str()); } cover_t cover(input, keys, skel.nodes_count); diff --git a/re2c/src/skeleton/maxpath.cc b/re2c/src/skeleton/maxpath.cc index 2a016e93..c609c215 100644 --- a/re2c/src/skeleton/maxpath.cc +++ b/re2c/src/skeleton/maxpath.cc @@ -58,8 +58,7 @@ uint32_t maxpath(const Skeleton &skel) calc_dist(skel, loops, dists, 0); const uint32_t maxlen = dists[0]; if (maxlen == DIST_MAX) { - error("DFA path %sis too long", incond(skel.cond).c_str()); - exit(1); + fatal("DFA path %sis too long", incond(skel.cond).c_str()); } return maxlen; } diff --git a/re2c/test/bug1529351.c b/re2c/test/bug1529351.c index b4038d2a..efbd10e8 100644 --- a/re2c/test/bug1529351.c +++ b/re2c/test/bug1529351.c @@ -1 +1 @@ -re2c: error: line 5, column 9: missing '}' +re2c: error: line 5: missing '}' diff --git a/re2c/test/code_points_error_esc.c b/re2c/test/code_points_error_esc.c index 84c9cfd7..3b13a536 100644 --- a/re2c/test/code_points_error_esc.c +++ b/re2c/test/code_points_error_esc.c @@ -1 +1 @@ -re2c: error: line 2, column 6: syntax error in escape sequence +re2c: error: line 2, column 5: syntax error in escape sequence diff --git a/re2c/test/code_points_error_lf.c b/re2c/test/code_points_error_lf.c index 5919bf6d..0723e535 100644 --- a/re2c/test/code_points_error_lf.c +++ b/re2c/test/code_points_error_lf.c @@ -1 +1 @@ -re2c: error: line 2, column 6: syntax error +re2c: error: line 2, column 5: syntax error diff --git a/re2c/test/cond_error_01.c.c b/re2c/test/cond_error_01.c.c index 24ec5355..90af544a 100644 --- a/re2c/test/cond_error_01.c.c +++ b/re2c/test/cond_error_01.c.c @@ -1 +1 @@ -re2c: error: line 3, column 4: syntax error +re2c: error: line 3: syntax error diff --git a/re2c/test/cond_error_03.c.c b/re2c/test/cond_error_03.c.c index ae6ce82a..90af544a 100644 --- a/re2c/test/cond_error_03.c.c +++ b/re2c/test/cond_error_03.c.c @@ -1 +1 @@ -re2c: error: line 3, column 5: syntax error +re2c: error: line 3: syntax error diff --git a/re2c/test/cond_error_07.c.c b/re2c/test/cond_error_07.c.c index 24ec5355..90af544a 100644 --- a/re2c/test/cond_error_07.c.c +++ b/re2c/test/cond_error_07.c.c @@ -1 +1 @@ -re2c: error: line 3, column 4: syntax error +re2c: error: line 3: syntax error diff --git a/re2c/test/error1.c b/re2c/test/error1.c index 2ae3624a..a6d6bbfa 100644 --- a/re2c/test/error1.c +++ b/re2c/test/error1.c @@ -1 +1 @@ -re2c: error: line 18, column 5: illegal closure form, use '{n}', '{n,}', '{n,m}' where n and m are numbers +re2c: error: line 18, column 4: illegal closure form, use '{n}', '{n,}', '{n,m}' where n and m are numbers diff --git a/re2c/test/error11.c b/re2c/test/error11.c index a510ff62..00e7f96c 100644 --- a/re2c/test/error11.c +++ b/re2c/test/error11.c @@ -1 +1 @@ -re2c: error: line 2, column 2: syntax error in hexadecimal escape sequence +re2c: error: line 2, column 1: syntax error in hexadecimal escape sequence diff --git a/re2c/test/error12.c b/re2c/test/error12.c index 3ddbb09b..905bbfd7 100644 --- a/re2c/test/error12.c +++ b/re2c/test/error12.c @@ -1 +1 @@ -re2c: error: line 3, column 17: trailing contexts are not allowed in named definitions +re2c: error: line 3: trailing contexts are not allowed in named definitions diff --git a/re2c/test/error2.c b/re2c/test/error2.c index 2ae3624a..a6d6bbfa 100644 --- a/re2c/test/error2.c +++ b/re2c/test/error2.c @@ -1 +1 @@ -re2c: error: line 18, column 5: illegal closure form, use '{n}', '{n,}', '{n,m}' where n and m are numbers +re2c: error: line 18, column 4: illegal closure form, use '{n}', '{n,}', '{n,m}' where n and m are numbers diff --git a/re2c/test/error3.c b/re2c/test/error3.c index 37a3fa2b..92bd3de6 100644 --- a/re2c/test/error3.c +++ b/re2c/test/error3.c @@ -1 +1 @@ -re2c: error: line 18, column 5: unexpected character: ']' +re2c: error: line 18, column 4: unexpected character: ']' diff --git a/re2c/test/error4.c b/re2c/test/error4.c index a510ff62..00e7f96c 100644 --- a/re2c/test/error4.c +++ b/re2c/test/error4.c @@ -1 +1 @@ -re2c: error: line 2, column 2: syntax error in hexadecimal escape sequence +re2c: error: line 2, column 1: syntax error in hexadecimal escape sequence diff --git a/re2c/test/error5.c b/re2c/test/error5.c index a510ff62..00e7f96c 100644 --- a/re2c/test/error5.c +++ b/re2c/test/error5.c @@ -1 +1 @@ -re2c: error: line 2, column 2: syntax error in hexadecimal escape sequence +re2c: error: line 2, column 1: syntax error in hexadecimal escape sequence diff --git a/re2c/test/error6.c b/re2c/test/error6.c index a510ff62..00e7f96c 100644 --- a/re2c/test/error6.c +++ b/re2c/test/error6.c @@ -1 +1 @@ -re2c: error: line 2, column 2: syntax error in hexadecimal escape sequence +re2c: error: line 2, column 1: syntax error in hexadecimal escape sequence diff --git a/re2c/test/error7.c b/re2c/test/error7.c index b3e23861..25f6e7d4 100644 --- a/re2c/test/error7.c +++ b/re2c/test/error7.c @@ -1 +1 @@ -re2c: error: line 2, column 2: syntax error in octal escape sequence +re2c: error: line 2, column 1: syntax error in octal escape sequence diff --git a/re2c/test/error8.c b/re2c/test/error8.c index b3e23861..25f6e7d4 100644 --- a/re2c/test/error8.c +++ b/re2c/test/error8.c @@ -1 +1 @@ -re2c: error: line 2, column 2: syntax error in octal escape sequence +re2c: error: line 2, column 1: syntax error in octal escape sequence diff --git a/re2c/test/error9.c b/re2c/test/error9.c index b3e23861..25f6e7d4 100644 --- a/re2c/test/error9.c +++ b/re2c/test/error9.c @@ -1 +1 @@ -re2c: error: line 2, column 2: syntax error in octal escape sequence +re2c: error: line 2, column 1: syntax error in octal escape sequence diff --git a/re2c/test/flex-01.i.c b/re2c/test/flex-01.i.c index 3c580016..ab1757be 100644 --- a/re2c/test/flex-01.i.c +++ b/re2c/test/flex-01.i.c @@ -1 +1 @@ -re2c: error: line 6, column 1: curly braces for names only allowed with -F switch +re2c: error: line 6, column 0: curly braces for names only allowed with -F switch diff --git a/re2c/test/overflow-2.c b/re2c/test/overflow-2.c index 6e170e14..959cd28b 100644 --- a/re2c/test/overflow-2.c +++ b/re2c/test/overflow-2.c @@ -1 +1 @@ -re2c: error: line 2, column 8219: can't find symbol +re2c: error: line 2: can't find symbol diff --git a/re2c/test/overflow-3.c b/re2c/test/overflow-3.c index 6e170e14..959cd28b 100644 --- a/re2c/test/overflow-3.c +++ b/re2c/test/overflow-3.c @@ -1 +1 @@ -re2c: error: line 2, column 8219: can't find symbol +re2c: error: line 2: can't find symbol diff --git a/re2c/test/posix_captures/implicit_grouping1.i--posix-captures.c b/re2c/test/posix_captures/implicit_grouping1.i--posix-captures.c index e136f1dd..3668cb0b 100644 --- a/re2c/test/posix_captures/implicit_grouping1.i--posix-captures.c +++ b/re2c/test/posix_captures/implicit_grouping1.i--posix-captures.c @@ -1 +1 @@ -re2c: error: implicit grouping is forbidden with '--posix-captures' option, please wrap 'x' in capturing parenthesis +re2c: error: line 2: implicit grouping is forbidden with '--posix-captures' option, please wrap 'x' in capturing parenthesis diff --git a/re2c/test/repeat-00.cgi.c b/re2c/test/repeat-00.cgi.c index eb94d5d3..2cfa3079 100644 --- a/re2c/test/repeat-00.cgi.c +++ b/re2c/test/repeat-00.cgi.c @@ -1 +1 @@ -re2c: error: line 5, column 1: found 'rules:re2c' block without -r flag +re2c: error: line 5: found 'rules:re2c' block without -r flag diff --git a/re2c/test/repeat-04.cgir.c b/re2c/test/repeat-04.cgir.c index 532e6b7a..1b3cef40 100644 --- a/re2c/test/repeat-04.cgir.c +++ b/re2c/test/repeat-04.cgir.c @@ -1,3 +1,3 @@ re2c: warning: line 18: control flow in condition 'r1' is undefined for strings that match '[\x0-\x30\x33-\x60\x63-\xFF]', use default rule '*' [-Wundefined-control-flow] re2c: warning: line 18: control flow in condition 'r2' is undefined for strings that match '[\x0-\x30\x33-\x61\x63-\xFF]', use default rule '*' [-Wundefined-control-flow] -re2c: error: line 20, column 1: cannot have a second 'rules:re2c' block +re2c: error: line 20: cannot have a second 'rules:re2c' block diff --git a/re2c/test/repeat-05.cgir.c b/re2c/test/repeat-05.cgir.c index 67f02944..06e97140 100644 --- a/re2c/test/repeat-05.cgir.c +++ b/re2c/test/repeat-05.cgir.c @@ -1 +1 @@ -re2c: error: line 7, column 1: found standard 're2c' block while using -r flag +re2c: error: line 7: found standard 're2c' block while using -r flag diff --git a/re2c/test/repeater_overflow.c b/re2c/test/repeater_overflow.c index 026ef268..f4d4d187 100644 --- a/re2c/test/repeater_overflow.c +++ b/re2c/test/repeater_overflow.c @@ -1 +1 @@ -re2c: error: line 2, column 5: repetition count overflow +re2c: error: line 2, column 4: repetition count overflow -- 2.40.0