]> granicus.if.org Git - re2c/commitdiff
Escape backslashes in file names (see #201).
authorUlya Trofimovich <skvadrik@gmail.com>
Fri, 13 Apr 2018 23:23:35 +0000 (00:23 +0100)
committerUlya Trofimovich <skvadrik@gmail.com>
Fri, 13 Apr 2018 23:23:35 +0000 (00:23 +0100)
re2c/bootstrap/src/ast/lex.cc
re2c/bootstrap/src/conf/parse_opts.cc
re2c/src/ast/input.cc
re2c/src/ast/input.h
re2c/src/ast/lex.re
re2c/src/ast/scanner.h
re2c/src/util/string_utils.h

index 083a4b33bc69fbf891572fa4085131ddfafe7c0b..fac2b2f1dd5f3d2d30f5e767b32589564678bd39 100644 (file)
@@ -1,4 +1,4 @@
-/* Generated by re2c 1.0.3 on Wed Nov  8 20:39:40 2017 */
+/* Generated by re2c 1.0.3 on Sat Apr 14 00:20:54 2018 */
 #line 1 "../src/ast/lex.re"
 #include "src/util/c99_stdint.h"
 #include <stddef.h>
@@ -17,6 +17,7 @@
 #include "src/ast/unescape.h"
 #include "src/util/range.h"
 #include "src/util/s_to_n32_unsafe.h"
+#include "src/util/string_utils.h"
 #include "y.tab.h"
 
 extern YYSTYPE yylval;
@@ -34,10 +35,10 @@ namespace re2c
 // source code is in ASCII: pointers have type 'char *'
 // but re2c makes an implicit assumption that YYCTYPE is unsigned
 // when it generates comparisons
-#line 37 "../src/ast/lex.re"
+#line 38 "../src/ast/lex.re"
 
 
-#line 58 "../src/ast/lex.re"
+#line 59 "../src/ast/lex.re"
 
 
 Scanner::ParseMode Scanner::echo(OutputFile &out)
@@ -52,7 +53,7 @@ echo:
        ptr = cur;
 
 
-#line 56 "src/ast/lex.cc"
+#line 57 "src/ast/lex.cc"
 {
        YYCTYPE yych;
        unsigned int yyaccept = 0;
@@ -110,19 +111,19 @@ echo:
                }
        }
        ++YYCURSOR;
-#line 135 "../src/ast/lex.re"
+#line 136 "../src/ast/lex.re"
        {
                if (cur != eof) goto echo;
                out.wraw(tok, ptr);
                return Stop;
        }
-#line 120 "src/ast/lex.cc"
+#line 121 "src/ast/lex.cc"
 yy4:
        ++YYCURSOR;
 yy5:
-#line 152 "../src/ast/lex.re"
+#line 153 "../src/ast/lex.re"
        { goto echo; }
-#line 126 "src/ast/lex.cc"
+#line 127 "src/ast/lex.cc"
 yy6:
        yyaccept = 0;
        yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR);
@@ -131,13 +132,13 @@ yy6:
        }
        if (yych == '#') goto yy14;
 yy7:
-#line 146 "../src/ast/lex.re"
+#line 147 "../src/ast/lex.re"
        {
                cline++;
                pos = cur;
                goto echo;
        }
-#line 141 "src/ast/lex.cc"
+#line 142 "src/ast/lex.cc"
 yy8:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '\n') goto yy6;
@@ -180,12 +181,12 @@ yy14:
        }
 yy16:
        ++YYCURSOR;
-#line 72 "../src/ast/lex.re"
+#line 73 "../src/ast/lex.re"
        {
                out.wraw(tok, ptr);
                return Parse;
        }
-#line 189 "src/ast/lex.cc"
+#line 190 "src/ast/lex.cc"
 yy18:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '!') goto yy20;
@@ -443,12 +444,12 @@ yy71:
 yy73:
        ++YYCURSOR;
        YYCURSOR = YYCTXMARKER;
-#line 141 "../src/ast/lex.re"
+#line 142 "../src/ast/lex.re"
        {
                set_sourceline();
                goto echo;
        }
-#line 452 "src/ast/lex.cc"
+#line 453 "src/ast/lex.cc"
 yy75:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '\n') goto yy73;
@@ -556,14 +557,14 @@ yy99:
        goto yy13;
 yy100:
        ++YYCURSOR;
-#line 93 "../src/ast/lex.re"
+#line 94 "../src/ast/lex.re"
        {
                out.wraw(tok, ptr);
                out.wdelay_yymaxfill();
                lex_end_of_comment(out);
                goto echo;
        }
-#line 567 "src/ast/lex.cc"
+#line 568 "src/ast/lex.cc"
 yy102:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == 'h') goto yy111;
@@ -586,12 +587,12 @@ yy106:
        goto yy13;
 yy107:
        ++YYCURSOR;
-#line 82 "../src/ast/lex.re"
+#line 83 "../src/ast/lex.re"
        {
                out.wraw(tok, ptr);
                return Reuse;
        }
-#line 595 "src/ast/lex.cc"
+#line 596 "src/ast/lex.cc"
 yy109:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == 'r') goto yy116;
@@ -634,33 +635,33 @@ yy118:
        goto yy13;
 yy119:
        ++YYCURSOR;
-#line 129 "../src/ast/lex.re"
+#line 130 "../src/ast/lex.re"
        {
                out.wraw(tok, ptr);
                lex_tags(out, true);
                goto echo;
        }
-#line 644 "src/ast/lex.cc"
+#line 645 "src/ast/lex.cc"
 yy121:
        ++YYCURSOR;
-#line 77 "../src/ast/lex.re"
+#line 78 "../src/ast/lex.re"
        {
                out.wraw(tok, ptr);
                return Rules;
        }
-#line 652 "src/ast/lex.cc"
+#line 653 "src/ast/lex.cc"
 yy123:
        ++YYCURSOR;
-#line 123 "../src/ast/lex.re"
+#line 124 "../src/ast/lex.re"
        {
                out.wraw(tok, ptr);
                lex_tags(out, false);
                goto echo;
        }
-#line 661 "src/ast/lex.cc"
+#line 662 "src/ast/lex.cc"
 yy125:
        ++YYCURSOR;
-#line 114 "../src/ast/lex.re"
+#line 115 "../src/ast/lex.re"
        {
                out.wraw(tok, ptr);
                out.wdelay_line_info();
@@ -669,20 +670,20 @@ yy125:
                lex_end_of_comment(out);
                goto echo;
        }
-#line 673 "src/ast/lex.cc"
+#line 674 "src/ast/lex.cc"
 yy127:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '2') goto yy131;
        goto yy13;
 yy128:
        ++YYCURSOR;
-#line 87 "../src/ast/lex.re"
+#line 88 "../src/ast/lex.re"
        {
                out.wraw(tok, ptr);
                lex_end_of_comment(out);
                goto echo;
        }
-#line 686 "src/ast/lex.cc"
+#line 687 "src/ast/lex.cc"
 yy130:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == 'e') goto yy132;
@@ -697,28 +698,28 @@ yy132:
        goto yy13;
 yy133:
        ++YYCURSOR;
-#line 107 "../src/ast/lex.re"
+#line 108 "../src/ast/lex.re"
        {
                out.wraw(tok, ptr);
                out.wdelay_state_goto(0);
                lex_end_of_comment(out);
                goto echo;
        }
-#line 708 "src/ast/lex.cc"
+#line 709 "src/ast/lex.cc"
 yy135:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych != 'c') goto yy13;
        ++YYCURSOR;
-#line 100 "../src/ast/lex.re"
+#line 101 "../src/ast/lex.re"
        {
                out.wraw(tok, ptr);
                out.wdelay_yymaxnmatch();
                lex_end_of_comment(out);
                goto echo;
        }
-#line 720 "src/ast/lex.cc"
+#line 721 "src/ast/lex.cc"
 }
-#line 153 "../src/ast/lex.re"
+#line 154 "../src/ast/lex.re"
 
 }
 
@@ -726,7 +727,7 @@ void Scanner::lex_end_of_comment(OutputFile &out)
 {
        uint32_t ignored = 0;
        for (;;) {
-#line 730 "src/ast/lex.cc"
+#line 731 "src/ast/lex.cc"
 {
        YYCTYPE yych;
        if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
@@ -742,20 +743,20 @@ void Scanner::lex_end_of_comment(OutputFile &out)
        }
 yy140:
        ++YYCURSOR;
-#line 160 "../src/ast/lex.re"
+#line 161 "../src/ast/lex.re"
        { fatal_lc(get_cline(), get_column(), "expected end of block"); }
-#line 748 "src/ast/lex.cc"
+#line 749 "src/ast/lex.cc"
 yy142:
        ++YYCURSOR;
 yy143:
-#line 162 "../src/ast/lex.re"
+#line 163 "../src/ast/lex.re"
        { continue; }
-#line 754 "src/ast/lex.cc"
+#line 755 "src/ast/lex.cc"
 yy144:
        ++YYCURSOR;
-#line 163 "../src/ast/lex.re"
+#line 164 "../src/ast/lex.re"
        { ++ignored; continue; }
-#line 759 "src/ast/lex.cc"
+#line 760 "src/ast/lex.cc"
 yy146:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '\n') goto yy144;
@@ -764,7 +765,7 @@ yy147:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych != '/') goto yy143;
        ++YYCURSOR;
-#line 164 "../src/ast/lex.re"
+#line 165 "../src/ast/lex.re"
        {
                        if (ignored > 0) {
                                cline += ignored;
@@ -773,9 +774,9 @@ yy147:
                        tok = pos = cur;
                        return;
                }
-#line 777 "src/ast/lex.cc"
+#line 778 "src/ast/lex.cc"
 }
-#line 172 "../src/ast/lex.re"
+#line 173 "../src/ast/lex.re"
 }
 }
 
@@ -783,7 +784,7 @@ void Scanner::lex_tags(OutputFile &out, bool mtags)
 {
        std::string fmt, sep;
        for (;;) {
-#line 787 "src/ast/lex.cc"
+#line 788 "src/ast/lex.cc"
 {
        YYCTYPE yych;
        static const unsigned char yybm[] = {
@@ -841,9 +842,9 @@ void Scanner::lex_tags(OutputFile &out, bool mtags)
        }
        ++YYCURSOR;
 yy153:
-#line 179 "../src/ast/lex.re"
+#line 180 "../src/ast/lex.re"
        { fatal_lc(get_cline(), get_column(), "unrecognized configuration"); }
-#line 847 "src/ast/lex.cc"
+#line 848 "src/ast/lex.cc"
 yy154:
        ++YYCURSOR;
        if (YYLIMIT <= YYCURSOR) YYFILL(1);
@@ -851,14 +852,14 @@ yy154:
        if (yybm[0+yych] & 128) {
                goto yy154;
        }
-#line 184 "../src/ast/lex.re"
+#line 185 "../src/ast/lex.re"
        { continue; }
-#line 857 "src/ast/lex.cc"
+#line 858 "src/ast/lex.cc"
 yy157:
        ++YYCURSOR;
-#line 185 "../src/ast/lex.re"
+#line 186 "../src/ast/lex.re"
        { ++cline; continue; }
-#line 862 "src/ast/lex.cc"
+#line 863 "src/ast/lex.cc"
 yy159:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '\n') goto yy157;
@@ -877,13 +878,13 @@ yy162:
        goto yy153;
 yy163:
        ++YYCURSOR;
-#line 186 "../src/ast/lex.re"
+#line 187 "../src/ast/lex.re"
        {
                        out.wdelay_tags(new ConfTags(fmt, sep), mtags);
                        tok = pos = cur;
                        return;
                }
-#line 887 "src/ast/lex.cc"
+#line 888 "src/ast/lex.cc"
 yy165:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == 'r') goto yy168;
@@ -920,9 +921,9 @@ yy173:
        goto yy166;
 yy174:
        ++YYCURSOR;
-#line 181 "../src/ast/lex.re"
+#line 182 "../src/ast/lex.re"
        { fmt = lex_conf_string(); continue; }
-#line 926 "src/ast/lex.cc"
+#line 927 "src/ast/lex.cc"
 yy176:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych != 't') goto yy166;
@@ -931,11 +932,11 @@ yy176:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych != 'r') goto yy166;
        ++YYCURSOR;
-#line 182 "../src/ast/lex.re"
+#line 183 "../src/ast/lex.re"
        { sep = lex_conf_string(); continue; }
-#line 937 "src/ast/lex.cc"
+#line 938 "src/ast/lex.cc"
 }
-#line 191 "../src/ast/lex.re"
+#line 192 "../src/ast/lex.re"
 }
 }
 
@@ -946,7 +947,7 @@ scan:
        tchar = cur - pos;
        tok = cur;
 
-#line 950 "src/ast/lex.cc"
+#line 951 "src/ast/lex.cc"
 {
        YYCTYPE yych;
        unsigned int yyaccept = 0;
@@ -1046,12 +1047,12 @@ scan:
 yy183:
        ++YYCURSOR;
 yy184:
-#line 351 "../src/ast/lex.re"
+#line 352 "../src/ast/lex.re"
        {
                                        fatal_lc(get_cline(), get_column(), "unexpected character: '%c'", *tok);
                                        goto scan;
                                }
-#line 1055 "src/ast/lex.cc"
+#line 1056 "src/ast/lex.cc"
 yy185:
        ++YYCURSOR;
        if (YYLIMIT <= YYCURSOR) YYFILL(1);
@@ -1059,11 +1060,11 @@ yy185:
        if (yybm[0+yych] & 16) {
                goto yy185;
        }
-#line 330 "../src/ast/lex.re"
+#line 331 "../src/ast/lex.re"
        {
                                        goto scan;
                                }
-#line 1067 "src/ast/lex.cc"
+#line 1068 "src/ast/lex.cc"
 yy188:
        yyaccept = 0;
        yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR);
@@ -1074,7 +1075,7 @@ yy188:
                if (yych == '#') goto yy214;
        }
 yy189:
-#line 339 "../src/ast/lex.re"
+#line 340 "../src/ast/lex.re"
        {
                if (cur == eof) return 0;
                pos = cur;
@@ -1086,7 +1087,7 @@ yy189:
                        goto scan;
                }
        }
-#line 1090 "src/ast/lex.cc"
+#line 1091 "src/ast/lex.cc"
 yy190:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '\n') goto yy188;
@@ -1094,14 +1095,14 @@ yy190:
 yy191:
        ++YYCURSOR;
 yy192:
-#line 243 "../src/ast/lex.re"
+#line 244 "../src/ast/lex.re"
        { return *tok; }
-#line 1100 "src/ast/lex.cc"
+#line 1101 "src/ast/lex.cc"
 yy193:
        ++YYCURSOR;
-#line 233 "../src/ast/lex.re"
+#line 234 "../src/ast/lex.re"
        { yylval.regexp = lex_str('"'); return TOKEN_REGEXP; }
-#line 1105 "src/ast/lex.cc"
+#line 1106 "src/ast/lex.cc"
 yy195:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych <= '^') {
@@ -1119,21 +1120,21 @@ yy196:
        goto yy184;
 yy197:
        ++YYCURSOR;
-#line 232 "../src/ast/lex.re"
+#line 233 "../src/ast/lex.re"
        { yylval.regexp = lex_str('\''); return TOKEN_REGEXP; }
-#line 1125 "src/ast/lex.cc"
+#line 1126 "src/ast/lex.cc"
 yy199:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '/') goto yy219;
        goto yy192;
 yy200:
        ++YYCURSOR;
-#line 325 "../src/ast/lex.re"
+#line 326 "../src/ast/lex.re"
        {
                                        yylval.regexp = ast_dot(cline, get_column());
                                        return TOKEN_REGEXP;
                                }
-#line 1137 "src/ast/lex.cc"
+#line 1138 "src/ast/lex.cc"
 yy202:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '*') goto yy221;
@@ -1176,9 +1177,9 @@ yy205:
 yy206:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '^') goto yy233;
-#line 234 "../src/ast/lex.re"
+#line 235 "../src/ast/lex.re"
        { yylval.regexp = lex_cls(false); return TOKEN_REGEXP; }
-#line 1182 "src/ast/lex.cc"
+#line 1183 "src/ast/lex.cc"
 yy208:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == 'e') goto yy235;
@@ -1201,13 +1202,13 @@ yy209:
                }
        }
 yy210:
-#line 201 "../src/ast/lex.re"
+#line 202 "../src/ast/lex.re"
        {
                                        depth = 1;
                                        code_line = cline;
                                        goto code;
                                }
-#line 1211 "src/ast/lex.cc"
+#line 1212 "src/ast/lex.cc"
 yy211:
        ++YYCURSOR;
        if (YYLIMIT <= YYCURSOR) YYFILL(1);
@@ -1258,51 +1259,51 @@ yy216:
                }
        }
 yy218:
-#line 237 "../src/ast/lex.re"
+#line 238 "../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 1268 "src/ast/lex.cc"
+#line 1269 "src/ast/lex.cc"
 yy219:
        ++YYCURSOR;
-#line 227 "../src/ast/lex.re"
+#line 228 "../src/ast/lex.re"
        {
                                        tok = cur;
                                        return 0;
                                }
-#line 1276 "src/ast/lex.cc"
+#line 1277 "src/ast/lex.cc"
 yy221:
        ++YYCURSOR;
-#line 221 "../src/ast/lex.re"
+#line 222 "../src/ast/lex.re"
        {
                                        depth = 1;
                                        goto comment;
                                }
-#line 1284 "src/ast/lex.cc"
+#line 1285 "src/ast/lex.cc"
 yy223:
        ++YYCURSOR;
-#line 218 "../src/ast/lex.re"
+#line 219 "../src/ast/lex.re"
        {
                                goto nextLine;
                        }
-#line 1291 "src/ast/lex.cc"
+#line 1292 "src/ast/lex.cc"
 yy225:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '>') goto yy243;
-#line 211 "../src/ast/lex.re"
+#line 212 "../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"
 yy227:
        ++YYCURSOR;
        YYCURSOR -= 1;
-#line 308 "../src/ast/lex.re"
+#line 309 "../src/ast/lex.re"
        {
                                        if (!globopts->FFlag) {
                                                yylval.str = new std::string (tok, tok_len());
@@ -1319,7 +1320,7 @@ yy227:
                                                return TOKEN_REGEXP;
                                        }
                                }
-#line 1323 "src/ast/lex.cc"
+#line 1324 "src/ast/lex.cc"
 yy229:
        ++YYCURSOR;
        if (YYLIMIT <= YYCURSOR) YYFILL(1);
@@ -1339,17 +1340,17 @@ yy229:
 yy231:
        ++YYCURSOR;
        YYCURSOR = YYCTXMARKER;
-#line 303 "../src/ast/lex.re"
+#line 304 "../src/ast/lex.re"
        {
                                        yylval.str = new std::string (tok, tok_len ());
                                        return TOKEN_ID;
                                }
-#line 1348 "src/ast/lex.cc"
+#line 1349 "src/ast/lex.cc"
 yy233:
        ++YYCURSOR;
-#line 235 "../src/ast/lex.re"
+#line 236 "../src/ast/lex.re"
        { yylval.regexp = lex_cls(true);  return TOKEN_REGEXP; }
-#line 1353 "src/ast/lex.cc"
+#line 1354 "src/ast/lex.cc"
 yy235:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '2') goto yy247;
@@ -1357,11 +1358,11 @@ yy235:
 yy236:
        ++YYCURSOR;
 yy237:
-#line 276 "../src/ast/lex.re"
+#line 277 "../src/ast/lex.re"
        {
                                        fatal_lc(get_cline(), get_column(), "illegal closure form, use '{n}', '{n,}', '{n,m}' where n and m are numbers");
                                }
-#line 1365 "src/ast/lex.cc"
+#line 1366 "src/ast/lex.cc"
 yy238:
        ++YYCURSOR;
        if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
@@ -1401,15 +1402,15 @@ yy242:
 yy243:
        ++YYCURSOR;
        YYCURSOR -= 2;
-#line 207 "../src/ast/lex.re"
+#line 208 "../src/ast/lex.re"
        {
                                        return *tok;
                                }
-#line 1409 "src/ast/lex.cc"
+#line 1410 "src/ast/lex.cc"
 yy245:
        ++YYCURSOR;
        YYCURSOR = YYCTXMARKER;
-#line 290 "../src/ast/lex.re"
+#line 291 "../src/ast/lex.re"
        {
                                        yylval.str = new std::string (tok, tok_len ());
                                        if (globopts->FFlag)
@@ -1422,7 +1423,7 @@ yy245:
                                                return TOKEN_ID;
                                        }
                                }
-#line 1426 "src/ast/lex.cc"
+#line 1427 "src/ast/lex.cc"
 yy247:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == 'c') goto yy254;
@@ -1436,7 +1437,7 @@ yy248:
        goto yy237;
 yy249:
        ++YYCURSOR;
-#line 245 "../src/ast/lex.re"
+#line 246 "../src/ast/lex.re"
        {
                                        if (!s_to_u32_unsafe (tok + 1, cur - 1, yylval.bounds.min))
                                        {
@@ -1445,10 +1446,10 @@ yy249:
                                        yylval.bounds.max = yylval.bounds.min;
                                        return TOKEN_CLOSESIZE;
                                }
-#line 1449 "src/ast/lex.cc"
+#line 1450 "src/ast/lex.cc"
 yy251:
        ++YYCURSOR;
-#line 280 "../src/ast/lex.re"
+#line 281 "../src/ast/lex.re"
        {
                                        if (!globopts->FFlag) {
                                                fatal_lc(get_cline(), get_column(), "curly braces for names only allowed with -F switch");
@@ -1456,7 +1457,7 @@ yy251:
                                        yylval.str = new std::string (tok + 1, tok_len () - 2); // -2 to omit braces
                                        return TOKEN_ID;
                                }
-#line 1460 "src/ast/lex.cc"
+#line 1461 "src/ast/lex.cc"
 yy253:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == 'n') goto yy259;
@@ -1475,7 +1476,7 @@ yy255:
        goto yy213;
 yy257:
        ++YYCURSOR;
-#line 267 "../src/ast/lex.re"
+#line 268 "../src/ast/lex.re"
        {
                                        if (!s_to_u32_unsafe (tok + 1, cur - 2, yylval.bounds.min))
                                        {
@@ -1484,19 +1485,19 @@ yy257:
                                        yylval.bounds.max = std::numeric_limits<uint32_t>::max();
                                        return TOKEN_CLOSESIZE;
                                }
-#line 1488 "src/ast/lex.cc"
+#line 1489 "src/ast/lex.cc"
 yy259:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == 'e') goto yy264;
        goto yy213;
 yy260:
        ++YYCURSOR;
-#line 288 "../src/ast/lex.re"
+#line 289 "../src/ast/lex.re"
        { return TOKEN_CONF; }
-#line 1497 "src/ast/lex.cc"
+#line 1498 "src/ast/lex.cc"
 yy262:
        ++YYCURSOR;
-#line 254 "../src/ast/lex.re"
+#line 255 "../src/ast/lex.re"
        {
                                        const char * p = strchr (tok, ',');
                                        if (!s_to_u32_unsafe (tok + 1, p, yylval.bounds.min))
@@ -1509,7 +1510,7 @@ yy262:
                                        }
                                        return TOKEN_CLOSESIZE;
                                }
-#line 1513 "src/ast/lex.cc"
+#line 1514 "src/ast/lex.cc"
 yy264:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych <= '0') goto yy266;
@@ -1565,12 +1566,12 @@ yy269:
 yy271:
        ++YYCURSOR;
        YYCURSOR = YYCTXMARKER;
-#line 334 "../src/ast/lex.re"
+#line 335 "../src/ast/lex.re"
        {
                set_sourceline ();
                return TOKEN_LINE_INFO;
        }
-#line 1574 "src/ast/lex.cc"
+#line 1575 "src/ast/lex.cc"
 yy273:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '\n') goto yy271;
@@ -1595,12 +1596,12 @@ yy277:
        if (yych == '\n') goto yy213;
        goto yy274;
 }
-#line 355 "../src/ast/lex.re"
+#line 356 "../src/ast/lex.re"
 
 
 code:
 
-#line 1604 "src/ast/lex.cc"
+#line 1605 "src/ast/lex.cc"
 {
        YYCTYPE yych;
        unsigned int yyaccept = 0;
@@ -1661,7 +1662,7 @@ code:
        }
 yy280:
        ++YYCURSOR;
-#line 418 "../src/ast/lex.re"
+#line 419 "../src/ast/lex.re"
        {
                                        if (cur == eof)
                                        {
@@ -1673,15 +1674,15 @@ yy280:
                                        }
                                        goto code;
                                }
-#line 1677 "src/ast/lex.cc"
+#line 1678 "src/ast/lex.cc"
 yy282:
        ++YYCURSOR;
 yy283:
-#line 432 "../src/ast/lex.re"
+#line 433 "../src/ast/lex.re"
        {
                                        goto code;
                                }
-#line 1685 "src/ast/lex.cc"
+#line 1686 "src/ast/lex.cc"
 yy284:
        yyaccept = 0;
        yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR);
@@ -1700,7 +1701,7 @@ yy284:
                }
        }
 yy285:
-#line 399 "../src/ast/lex.re"
+#line 400 "../src/ast/lex.re"
        {
                                        if (depth == 0)
                                        {
@@ -1720,7 +1721,7 @@ yy285:
                                        cline++;
                                        goto code;
                                }
-#line 1724 "src/ast/lex.cc"
+#line 1725 "src/ast/lex.cc"
 yy286:
        yyaccept = 1;
        yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR);
@@ -1733,7 +1734,7 @@ yy287:
        goto yy304;
 yy288:
        ++YYCURSOR;
-#line 371 "../src/ast/lex.re"
+#line 372 "../src/ast/lex.re"
        {
                                        if (depth == 0)
                                        {
@@ -1745,10 +1746,10 @@ yy288:
                                        }
                                        goto code;
                                }
-#line 1749 "src/ast/lex.cc"
+#line 1750 "src/ast/lex.cc"
 yy290:
        ++YYCURSOR;
-#line 359 "../src/ast/lex.re"
+#line 360 "../src/ast/lex.re"
        {
                                        if (depth == 0)
                                        {
@@ -1761,7 +1762,7 @@ yy290:
                                        }
                                        goto code;
                                }
-#line 1765 "src/ast/lex.cc"
+#line 1766 "src/ast/lex.cc"
 yy292:
        yyaccept = 2;
        yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR);
@@ -1773,7 +1774,7 @@ yy292:
        }
 yy293:
        YYCURSOR -= 1;
-#line 386 "../src/ast/lex.re"
+#line 387 "../src/ast/lex.re"
        {
                                        if (depth == 0)
                                        {
@@ -1787,7 +1788,7 @@ yy293:
                                        cline++;
                                        goto code;
                                }
-#line 1791 "src/ast/lex.cc"
+#line 1792 "src/ast/lex.cc"
 yy294:
        ++YYCURSOR;
        goto yy293;
@@ -1822,11 +1823,11 @@ yy299:
        if (yych >= '#') goto yy302;
 yy300:
        ++YYCURSOR;
-#line 429 "../src/ast/lex.re"
+#line 430 "../src/ast/lex.re"
        {
                                        goto code;
                                }
-#line 1830 "src/ast/lex.cc"
+#line 1831 "src/ast/lex.cc"
 yy302:
        ++YYCURSOR;
        if (YYLIMIT <= YYCURSOR) YYFILL(1);
@@ -1916,12 +1917,12 @@ yy316:
 yy318:
        ++YYCURSOR;
        YYCURSOR = YYCTXMARKER;
-#line 382 "../src/ast/lex.re"
+#line 383 "../src/ast/lex.re"
        {
                                        set_sourceline ();
                                        goto code;
                                }
-#line 1925 "src/ast/lex.cc"
+#line 1926 "src/ast/lex.cc"
 yy320:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '\n') goto yy318;
@@ -1950,12 +1951,12 @@ yy324:
        if (yych == '\n') goto yy297;
        goto yy321;
 }
-#line 435 "../src/ast/lex.re"
+#line 436 "../src/ast/lex.re"
 
 
 comment:
 
-#line 1959 "src/ast/lex.cc"
+#line 1960 "src/ast/lex.cc"
 {
        YYCTYPE yych;
        static const unsigned char yybm[] = {
@@ -2002,7 +2003,7 @@ comment:
        }
        ++YYCURSOR;
 yy328:
-#line 467 "../src/ast/lex.re"
+#line 468 "../src/ast/lex.re"
        {
                                        if (cur == eof)
                                        {
@@ -2010,7 +2011,7 @@ yy328:
                                        }
                                        goto comment;
                                }
-#line 2014 "src/ast/lex.cc"
+#line 2015 "src/ast/lex.cc"
 yy329:
        yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR);
        if (yybm[0+yych] & 32) {
@@ -2018,7 +2019,7 @@ yy329:
        }
        if (yych == '#') goto yy336;
 yy330:
-#line 458 "../src/ast/lex.re"
+#line 459 "../src/ast/lex.re"
        {
                                        if (cur == eof)
                                        {
@@ -2028,7 +2029,7 @@ yy330:
                                        cline++;
                                        goto comment;
                                }
-#line 2032 "src/ast/lex.cc"
+#line 2033 "src/ast/lex.cc"
 yy331:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '/') goto yy338;
@@ -2062,7 +2063,7 @@ yy336:
        }
 yy338:
        ++YYCURSOR;
-#line 439 "../src/ast/lex.re"
+#line 440 "../src/ast/lex.re"
        {
                                        if (--depth == 0)
                                        {
@@ -2073,16 +2074,16 @@ yy338:
                                                goto comment;
                                        }
                                }
-#line 2077 "src/ast/lex.cc"
+#line 2078 "src/ast/lex.cc"
 yy340:
        ++YYCURSOR;
-#line 449 "../src/ast/lex.re"
+#line 450 "../src/ast/lex.re"
        {
                                        ++depth;
                                        fatal_lc(get_cline(), get_column(), "ambiguous /* found");
                                        goto comment;
                                }
-#line 2086 "src/ast/lex.cc"
+#line 2087 "src/ast/lex.cc"
 yy342:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych != 'i') goto yy335;
@@ -2139,12 +2140,12 @@ yy350:
 yy352:
        ++YYCURSOR;
        YYCURSOR = YYCTXMARKER;
-#line 454 "../src/ast/lex.re"
+#line 455 "../src/ast/lex.re"
        {
                                        set_sourceline ();
                                        goto comment;
                                }
-#line 2148 "src/ast/lex.cc"
+#line 2149 "src/ast/lex.cc"
 yy354:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '\n') goto yy352;
@@ -2169,28 +2170,28 @@ yy358:
        if (yych == '\n') goto yy335;
        goto yy355;
 }
-#line 474 "../src/ast/lex.re"
+#line 475 "../src/ast/lex.re"
 
 
 nextLine:
 
-#line 2178 "src/ast/lex.cc"
+#line 2179 "src/ast/lex.cc"
 {
        YYCTYPE yych;
        if (YYLIMIT <= YYCURSOR) YYFILL(1);
        yych = (YYCTYPE)*YYCURSOR;
        if (yych == '\n') goto yy363;
        ++YYCURSOR;
-#line 485 "../src/ast/lex.re"
+#line 486 "../src/ast/lex.re"
        {  if(cur == eof) {
                   return 0;
                }
                goto nextLine;
             }
-#line 2191 "src/ast/lex.cc"
+#line 2192 "src/ast/lex.cc"
 yy363:
        ++YYCURSOR;
-#line 478 "../src/ast/lex.re"
+#line 479 "../src/ast/lex.re"
        { if(cur == eof) {
                   return 0;
                }
@@ -2198,26 +2199,12 @@ yy363:
                cline++;
                goto scan;
             }
-#line 2202 "src/ast/lex.cc"
+#line 2203 "src/ast/lex.cc"
 }
-#line 490 "../src/ast/lex.re"
+#line 491 "../src/ast/lex.re"
 
 }
 
-static void escape (std::string & dest, const std::string & src)
-{
-       dest = src;
-       size_t l = dest.length();
-       for (size_t p = 0; p < l; ++p)
-       {
-               if (dest[p] == '\\')
-               {
-                       dest.insert(++p, "\\");
-                       ++l;
-               }
-       }
-}
-
 const AST *Scanner::lex_cls(bool neg)
 {
        std::vector<ASTRange> *cls = new std::vector<ASTRange>;
@@ -2226,35 +2213,35 @@ fst:
        tok = cur;
        c = get_column();
        
-#line 2230 "src/ast/lex.cc"
+#line 2217 "src/ast/lex.cc"
 {
        YYCTYPE yych;
        if (YYLIMIT <= YYCURSOR) YYFILL(1);
        yych = (YYCTYPE)*YYCURSOR;
        if (yych == ']') goto yy368;
-#line 516 "../src/ast/lex.re"
+#line 503 "../src/ast/lex.re"
        { l = lex_cls_chr(); goto snd; }
-#line 2238 "src/ast/lex.cc"
+#line 2225 "src/ast/lex.cc"
 yy368:
        ++YYCURSOR;
-#line 515 "../src/ast/lex.re"
+#line 502 "../src/ast/lex.re"
        { return ast_cls(cline, c0, cls, neg); }
-#line 2243 "src/ast/lex.cc"
+#line 2230 "src/ast/lex.cc"
 }
-#line 517 "../src/ast/lex.re"
+#line 504 "../src/ast/lex.re"
 
 snd:
        
-#line 2249 "src/ast/lex.cc"
+#line 2236 "src/ast/lex.cc"
 {
        YYCTYPE yych;
        if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
        yych = (YYCTYPE)*(YYMARKER = YYCURSOR);
        if (yych == '-') goto yy373;
 yy372:
-#line 520 "../src/ast/lex.re"
+#line 507 "../src/ast/lex.re"
        { u = l; goto add; }
-#line 2258 "src/ast/lex.cc"
+#line 2245 "src/ast/lex.cc"
 yy373:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych != ']') goto yy375;
@@ -2263,7 +2250,7 @@ yy373:
 yy375:
        ++YYCURSOR;
        YYCURSOR -= 1;
-#line 521 "../src/ast/lex.re"
+#line 508 "../src/ast/lex.re"
        {
                        u = lex_cls_chr();
                        if (l > u) {
@@ -2272,9 +2259,9 @@ yy375:
                        }
                        goto add;
                }
-#line 2276 "src/ast/lex.cc"
+#line 2263 "src/ast/lex.cc"
 }
-#line 529 "../src/ast/lex.re"
+#line 516 "../src/ast/lex.re"
 
 add:
        cls->push_back(ASTRange(l, u, c));
@@ -2286,7 +2273,7 @@ uint32_t Scanner::lex_cls_chr()
        tok = cur;
        const uint32_t l = get_cline(), c = get_column();
        
-#line 2290 "src/ast/lex.cc"
+#line 2277 "src/ast/lex.cc"
 {
        YYCTYPE yych;
        unsigned int yyaccept = 0;
@@ -2300,14 +2287,14 @@ uint32_t Scanner::lex_cls_chr()
        }
        ++YYCURSOR;
 yy380:
-#line 546 "../src/ast/lex.re"
+#line 533 "../src/ast/lex.re"
        { return static_cast<uint8_t>(tok[0]); }
-#line 2306 "src/ast/lex.cc"
+#line 2293 "src/ast/lex.cc"
 yy381:
        ++YYCURSOR;
-#line 541 "../src/ast/lex.re"
+#line 528 "../src/ast/lex.re"
        { fatal_lc(l, c, "newline in character class"); }
-#line 2311 "src/ast/lex.cc"
+#line 2298 "src/ast/lex.cc"
 yy383:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '\n') goto yy381;
@@ -2359,30 +2346,30 @@ yy384:
 yy385:
        ++YYCURSOR;
 yy386:
-#line 559 "../src/ast/lex.re"
+#line 546 "../src/ast/lex.re"
        {
                        warn.useless_escape(cline, get_column(), tok[1]);
                        return static_cast<uint8_t>(tok[1]);
                }
-#line 2368 "src/ast/lex.cc"
+#line 2355 "src/ast/lex.cc"
 yy387:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '\n') goto yy381;
        goto yy386;
 yy388:
        ++YYCURSOR;
-#line 557 "../src/ast/lex.re"
+#line 544 "../src/ast/lex.re"
        { return static_cast<uint8_t>('-'); }
-#line 2377 "src/ast/lex.cc"
+#line 2364 "src/ast/lex.cc"
 yy390:
        yyaccept = 0;
        yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR);
        if (yych <= '/') goto yy391;
        if (yych <= '7') goto yy415;
 yy391:
-#line 543 "../src/ast/lex.re"
+#line 530 "../src/ast/lex.re"
        { fatal_lc(l, c, "syntax error in octal escape sequence"); }
-#line 2386 "src/ast/lex.cc"
+#line 2373 "src/ast/lex.cc"
 yy392:
        ++YYCURSOR;
        goto yy391;
@@ -2398,9 +2385,9 @@ yy393:
                if (yych <= 'f') goto yy417;
        }
 yy394:
-#line 542 "../src/ast/lex.re"
+#line 529 "../src/ast/lex.re"
        { fatal_lc(l, c, "syntax error in hexadecimal escape sequence"); }
-#line 2404 "src/ast/lex.cc"
+#line 2391 "src/ast/lex.cc"
 yy395:
        yyaccept = 1;
        yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR);
@@ -2416,49 +2403,49 @@ yy395:
        }
 yy396:
        ++YYCURSOR;
-#line 556 "../src/ast/lex.re"
+#line 543 "../src/ast/lex.re"
        { return static_cast<uint8_t>('\\'); }
-#line 2422 "src/ast/lex.cc"
+#line 2409 "src/ast/lex.cc"
 yy398:
        ++YYCURSOR;
-#line 558 "../src/ast/lex.re"
+#line 545 "../src/ast/lex.re"
        { return static_cast<uint8_t>(']'); }
-#line 2427 "src/ast/lex.cc"
+#line 2414 "src/ast/lex.cc"
 yy400:
        ++YYCURSOR;
-#line 549 "../src/ast/lex.re"
+#line 536 "../src/ast/lex.re"
        { return static_cast<uint8_t>('\a'); }
-#line 2432 "src/ast/lex.cc"
+#line 2419 "src/ast/lex.cc"
 yy402:
        ++YYCURSOR;
-#line 550 "../src/ast/lex.re"
+#line 537 "../src/ast/lex.re"
        { return static_cast<uint8_t>('\b'); }
-#line 2437 "src/ast/lex.cc"
+#line 2424 "src/ast/lex.cc"
 yy404:
        ++YYCURSOR;
-#line 551 "../src/ast/lex.re"
+#line 538 "../src/ast/lex.re"
        { return static_cast<uint8_t>('\f'); }
-#line 2442 "src/ast/lex.cc"
+#line 2429 "src/ast/lex.cc"
 yy406:
        ++YYCURSOR;
-#line 552 "../src/ast/lex.re"
+#line 539 "../src/ast/lex.re"
        { return static_cast<uint8_t>('\n'); }
-#line 2447 "src/ast/lex.cc"
+#line 2434 "src/ast/lex.cc"
 yy408:
        ++YYCURSOR;
-#line 553 "../src/ast/lex.re"
+#line 540 "../src/ast/lex.re"
        { return static_cast<uint8_t>('\r'); }
-#line 2452 "src/ast/lex.cc"
+#line 2439 "src/ast/lex.cc"
 yy410:
        ++YYCURSOR;
-#line 554 "../src/ast/lex.re"
+#line 541 "../src/ast/lex.re"
        { return static_cast<uint8_t>('\t'); }
-#line 2457 "src/ast/lex.cc"
+#line 2444 "src/ast/lex.cc"
 yy412:
        ++YYCURSOR;
-#line 555 "../src/ast/lex.re"
+#line 542 "../src/ast/lex.re"
        { return static_cast<uint8_t>('\v'); }
-#line 2462 "src/ast/lex.cc"
+#line 2449 "src/ast/lex.cc"
 yy414:
        yyaccept = 1;
        yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR);
@@ -2521,9 +2508,9 @@ yy419:
        }
 yy420:
        ++YYCURSOR;
-#line 548 "../src/ast/lex.re"
+#line 535 "../src/ast/lex.re"
        { return unesc_oct(tok, cur); }
-#line 2527 "src/ast/lex.cc"
+#line 2514 "src/ast/lex.cc"
 yy422:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych <= '@') {
@@ -2550,9 +2537,9 @@ yy423:
        }
 yy424:
        ++YYCURSOR;
-#line 547 "../src/ast/lex.re"
+#line 534 "../src/ast/lex.re"
        { return unesc_hex(tok, cur); }
-#line 2556 "src/ast/lex.cc"
+#line 2543 "src/ast/lex.cc"
 yy426:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych <= '@') {
@@ -2576,7 +2563,7 @@ yy427:
                goto yy416;
        }
 }
-#line 563 "../src/ast/lex.re"
+#line 550 "../src/ast/lex.re"
 
 }
 
@@ -2586,7 +2573,7 @@ uint32_t Scanner::lex_str_chr(char quote, bool &end)
        tok = cur;
        const uint32_t l = get_cline(), c = get_column();
        
-#line 2590 "src/ast/lex.cc"
+#line 2577 "src/ast/lex.cc"
 {
        YYCTYPE yych;
        unsigned int yyaccept = 0;
@@ -2600,17 +2587,17 @@ uint32_t Scanner::lex_str_chr(char quote, bool &end)
        }
        ++YYCURSOR;
 yy431:
-#line 578 "../src/ast/lex.re"
+#line 565 "../src/ast/lex.re"
        {
                        end = tok[0] == quote;
                        return static_cast<uint8_t>(tok[0]);
                }
-#line 2609 "src/ast/lex.cc"
+#line 2596 "src/ast/lex.cc"
 yy432:
        ++YYCURSOR;
-#line 573 "../src/ast/lex.re"
+#line 560 "../src/ast/lex.re"
        { fatal_lc(l, c, "newline in character string"); }
-#line 2614 "src/ast/lex.cc"
+#line 2601 "src/ast/lex.cc"
 yy434:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '\n') goto yy432;
@@ -2659,14 +2646,14 @@ yy435:
 yy436:
        ++YYCURSOR;
 yy437:
-#line 592 "../src/ast/lex.re"
+#line 579 "../src/ast/lex.re"
        {
                        if (tok[1] != quote) {
                                warn.useless_escape(cline, get_column(), tok[1]);
                        }
                        return static_cast<uint8_t>(tok[1]);
                }
-#line 2670 "src/ast/lex.cc"
+#line 2657 "src/ast/lex.cc"
 yy438:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '\n') goto yy432;
@@ -2677,9 +2664,9 @@ yy439:
        if (yych <= '/') goto yy440;
        if (yych <= '7') goto yy462;
 yy440:
-#line 575 "../src/ast/lex.re"
+#line 562 "../src/ast/lex.re"
        { fatal_lc(l, c, "syntax error in octal escape sequence"); }
-#line 2683 "src/ast/lex.cc"
+#line 2670 "src/ast/lex.cc"
 yy441:
        ++YYCURSOR;
        goto yy440;
@@ -2695,9 +2682,9 @@ yy442:
                if (yych <= 'f') goto yy464;
        }
 yy443:
-#line 574 "../src/ast/lex.re"
+#line 561 "../src/ast/lex.re"
        { fatal_lc(l, c, "syntax error in hexadecimal escape sequence"); }
-#line 2701 "src/ast/lex.cc"
+#line 2688 "src/ast/lex.cc"
 yy444:
        yyaccept = 1;
        yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR);
@@ -2713,44 +2700,44 @@ yy444:
        }
 yy445:
        ++YYCURSOR;
-#line 591 "../src/ast/lex.re"
+#line 578 "../src/ast/lex.re"
        { return static_cast<uint8_t>('\\'); }
-#line 2719 "src/ast/lex.cc"
+#line 2706 "src/ast/lex.cc"
 yy447:
        ++YYCURSOR;
-#line 584 "../src/ast/lex.re"
+#line 571 "../src/ast/lex.re"
        { return static_cast<uint8_t>('\a'); }
-#line 2724 "src/ast/lex.cc"
+#line 2711 "src/ast/lex.cc"
 yy449:
        ++YYCURSOR;
-#line 585 "../src/ast/lex.re"
+#line 572 "../src/ast/lex.re"
        { return static_cast<uint8_t>('\b'); }
-#line 2729 "src/ast/lex.cc"
+#line 2716 "src/ast/lex.cc"
 yy451:
        ++YYCURSOR;
-#line 586 "../src/ast/lex.re"
+#line 573 "../src/ast/lex.re"
        { return static_cast<uint8_t>('\f'); }
-#line 2734 "src/ast/lex.cc"
+#line 2721 "src/ast/lex.cc"
 yy453:
        ++YYCURSOR;
-#line 587 "../src/ast/lex.re"
+#line 574 "../src/ast/lex.re"
        { return static_cast<uint8_t>('\n'); }
-#line 2739 "src/ast/lex.cc"
+#line 2726 "src/ast/lex.cc"
 yy455:
        ++YYCURSOR;
-#line 588 "../src/ast/lex.re"
+#line 575 "../src/ast/lex.re"
        { return static_cast<uint8_t>('\r'); }
-#line 2744 "src/ast/lex.cc"
+#line 2731 "src/ast/lex.cc"
 yy457:
        ++YYCURSOR;
-#line 589 "../src/ast/lex.re"
+#line 576 "../src/ast/lex.re"
        { return static_cast<uint8_t>('\t'); }
-#line 2749 "src/ast/lex.cc"
+#line 2736 "src/ast/lex.cc"
 yy459:
        ++YYCURSOR;
-#line 590 "../src/ast/lex.re"
+#line 577 "../src/ast/lex.re"
        { return static_cast<uint8_t>('\v'); }
-#line 2754 "src/ast/lex.cc"
+#line 2741 "src/ast/lex.cc"
 yy461:
        yyaccept = 1;
        yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR);
@@ -2813,9 +2800,9 @@ yy466:
        }
 yy467:
        ++YYCURSOR;
-#line 583 "../src/ast/lex.re"
+#line 570 "../src/ast/lex.re"
        { return unesc_oct(tok, cur); }
-#line 2819 "src/ast/lex.cc"
+#line 2806 "src/ast/lex.cc"
 yy469:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych <= '@') {
@@ -2842,9 +2829,9 @@ yy470:
        }
 yy471:
        ++YYCURSOR;
-#line 582 "../src/ast/lex.re"
+#line 569 "../src/ast/lex.re"
        { return unesc_hex(tok, cur); }
-#line 2848 "src/ast/lex.cc"
+#line 2835 "src/ast/lex.cc"
 yy473:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych <= '@') {
@@ -2868,7 +2855,7 @@ yy474:
                goto yy463;
        }
 }
-#line 598 "../src/ast/lex.re"
+#line 585 "../src/ast/lex.re"
 
 }
 
@@ -2888,7 +2875,7 @@ void Scanner::set_sourceline ()
 sourceline:
        tok = cur;
 
-#line 2892 "src/ast/lex.cc"
+#line 2879 "src/ast/lex.cc"
 {
        YYCTYPE yych;
        static const unsigned char yybm[] = {
@@ -2937,27 +2924,22 @@ sourceline:
 yy477:
        ++YYCURSOR;
 yy478:
-#line 640 "../src/ast/lex.re"
-       {
-                                       goto sourceline;
-                               }
-#line 2945 "src/ast/lex.cc"
+#line 627 "../src/ast/lex.re"
+       { goto sourceline; }
+#line 2930 "src/ast/lex.cc"
 yy479:
        ++YYCURSOR;
-#line 628 "../src/ast/lex.re"
+#line 617 "../src/ast/lex.re"
        {
-                                       if (cur == eof)
-                                       {
-                                               --cur; 
-                                       }
-                                       else
-                                       {
-                                               pos = cur; 
-                                       }
-                                       tok = cur;
-                                       return; 
-                               }
-#line 2961 "src/ast/lex.cc"
+               if (cur == eof) {
+                       --cur;
+               } else {
+                       pos = cur;
+               }
+               tok = cur;
+               return;
+       }
+#line 2943 "src/ast/lex.cc"
 yy481:
        yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR);
        if (yych == '\n') goto yy478;
@@ -2969,15 +2951,14 @@ yy482:
        if (yybm[0+yych] & 64) {
                goto yy482;
        }
-#line 617 "../src/ast/lex.re"
+#line 604 "../src/ast/lex.re"
        {
-                                       if (!s_to_u32_unsafe (tok, cur, cline))
-                                       {
-                                               fatal_lc(get_cline(), get_column(), "line number overflow");
-                                       }
-                                       goto sourceline; 
-                               }
-#line 2981 "src/ast/lex.cc"
+               if (!s_to_u32_unsafe (tok, cur, cline)) {
+                       fatal_lc(get_cline(), get_column(), "line number overflow");
+               }
+               goto sourceline;
+       }
+#line 2962 "src/ast/lex.cc"
 yy485:
        ++YYCURSOR;
        if (YYLIMIT <= YYCURSOR) YYFILL(1);
@@ -2994,12 +2975,13 @@ yy487:
        goto yy478;
 yy488:
        ++YYCURSOR;
-#line 624 "../src/ast/lex.re"
+#line 611 "../src/ast/lex.re"
        {
-                                       escape (in.file_name, std::string (tok + 1, tok_len () - 2)); // -2 to omit quotes
-                                       goto sourceline; 
-                               }
-#line 3003 "src/ast/lex.cc"
+               in.escaped_file_name = std::string (tok + 1, tok_len () - 2); // -2 to omit quotes
+               strrreplace (in.escaped_file_name, "\\", "\\\\");
+               goto sourceline;
+       }
+#line 2985 "src/ast/lex.cc"
 yy490:
        ++YYCURSOR;
        if (YYLIMIT <= YYCURSOR) YYFILL(1);
@@ -3007,7 +2989,7 @@ yy490:
        if (yych == '\n') goto yy487;
        goto yy485;
 }
-#line 643 "../src/ast/lex.re"
+#line 628 "../src/ast/lex.re"
 
 }
 
index f386b99b6403a9b4beb91d659c5bee2e498d5ad6..3d59fe821ab1f41792468fc13afff7b26ff7da81 100644 (file)
@@ -1,4 +1,4 @@
-/* Generated by re2c 1.0.3 on Wed Nov  8 20:39:40 2017 */
+/* Generated by re2c 1.0.3 on Fri Apr 13 23:56:00 2018 */
 #line 1 "../src/conf/parse_opts.re"
 #include "src/code/input_api.h"
 #include "src/conf/msg.h"
index b06c1bd2761e784c7d6478a3a7d6e2bfe13e57df..e12b41981fc414f2c8636165687ebd3f6848f07d 100644 (file)
@@ -1,11 +1,15 @@
 #include "src/ast/input.h"
+#include "src/util/string_utils.h"
 
 namespace re2c {
 
 Input::Input (const char * fn)
        : file (NULL)
        , file_name (fn)
-{}
+       , escaped_file_name (fn)
+{
+       strrreplace (escaped_file_name, "\\", "\\\\");
+}
 
 bool Input::open ()
 {
index faee2f9431aa7da6e71e5ffeed1c30db56e731a3..f4fb8f8b0323dc6695ff153a4e4ce626b7550747 100644 (file)
@@ -11,7 +11,8 @@ namespace re2c {
 struct Input
 {
        FILE * file;
-       std::string file_name;
+       const std::string file_name;
+       std::string escaped_file_name;
 
        explicit Input (const char * fn);
        ~Input ();
index 6e6887cb46c92e8a4b7116315c051f8c804b84b4..c3885f98e50788335e7731df63e20e9bbeda951f 100644 (file)
@@ -15,6 +15,7 @@
 #include "src/ast/unescape.h"
 #include "src/util/range.h"
 #include "src/util/s_to_n32_unsafe.h"
+#include "src/util/string_utils.h"
 #include "y.tab.h"
 
 extern YYSTYPE yylval;
@@ -490,20 +491,6 @@ nextLine:
 */
 }
 
-static void escape (std::string & dest, const std::string & src)
-{
-       dest = src;
-       size_t l = dest.length();
-       for (size_t p = 0; p < l; ++p)
-       {
-               if (dest[p] == '\\')
-               {
-                       dest.insert(++p, "\\");
-                       ++l;
-               }
-       }
-}
-
 const AST *Scanner::lex_cls(bool neg)
 {
        std::vector<ASTRange> *cls = new std::vector<ASTRange>;
@@ -614,32 +601,30 @@ void Scanner::set_sourceline ()
 sourceline:
        tok = cur;
 /*!re2c        
-       lineno          {
-                                       if (!s_to_u32_unsafe (tok, cur, cline))
-                                       {
-                                               fatal_lc(get_cline(), get_column(), "line number overflow");
-                                       }
-                                       goto sourceline; 
-                               }
-       dstring         {
-                                       escape (in.file_name, std::string (tok + 1, tok_len () - 2)); // -2 to omit quotes
-                                       goto sourceline; 
-                               }
-       "\n"                    {
-                                       if (cur == eof)
-                                       {
-                                               --cur; 
-                                       }
-                                       else
-                                       {
-                                               pos = cur; 
-                                       }
-                                       tok = cur;
-                                       return; 
-                               }
-       *                       {
-                                       goto sourceline;
-                               }
+       lineno {
+               if (!s_to_u32_unsafe (tok, cur, cline)) {
+                       fatal_lc(get_cline(), get_column(), "line number overflow");
+               }
+               goto sourceline;
+       }
+
+       dstring {
+               in.escaped_file_name = std::string (tok + 1, tok_len () - 2); // -2 to omit quotes
+               strrreplace (in.escaped_file_name, "\\", "\\\\");
+               goto sourceline;
+       }
+
+       "\n" {
+               if (cur == eof) {
+                       --cur;
+               } else {
+                       pos = cur;
+               }
+               tok = cur;
+               return;
+       }
+
+       * { goto sourceline; }
 */
 }
 
index 78c47374adab202e0299053b2792d30ee5d9b01b..45ed38cae1ede148cdb7eeff7028f2c5c4bf625f 100644 (file)
@@ -102,7 +102,7 @@ inline size_t Scanner::tok_len () const
 
 inline const std::string & Scanner::get_fname () const
 {
-       return in.file_name;
+       return in.escaped_file_name;
 }
 
 inline uint32_t Scanner::get_cline() const
index 65f6b85cabb91e6d82ac04003b1af19f360ef08c..bb7c0a810f9d9507f151a96dc0a559b003aea203 100644 (file)
@@ -15,11 +15,12 @@ template<typename type_t> void strrreplace(
        std::ostringstream sv;
        sv << v;
        const std::string &s2 = sv.str();
-       const size_t l = s1.length();
-       if (l != 0) {
-               std::string::size_type pos;
-               while ((pos = s.find(s1)) != std::string::npos) {
-                       s.replace(pos, l, s2);
+       const size_t l1 = s1.length(), l2 = s2.length();
+       if (l1 != 0) {
+               std::string::size_type pos = s.find(s1);
+               while (pos != std::string::npos) {
+                       s.replace(pos, l1, s2);
+                       pos = s.find(s1, pos + l2);
                }
        }
 }