-/* 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>
#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;
// 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)
ptr = cur;
-#line 56 "src/ast/lex.cc"
+#line 57 "src/ast/lex.cc"
{
YYCTYPE yych;
unsigned int yyaccept = 0;
}
}
++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);
}
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;
}
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;
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;
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;
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;
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();
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;
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"
}
{
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);
}
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;
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;
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"
}
}
{
std::string fmt, sep;
for (;;) {
-#line 787 "src/ast/lex.cc"
+#line 788 "src/ast/lex.cc"
{
YYCTYPE yych;
static const unsigned char yybm[] = {
}
++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);
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;
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;
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;
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"
}
}
tchar = cur - pos;
tok = cur;
-#line 950 "src/ast/lex.cc"
+#line 951 "src/ast/lex.cc"
{
YYCTYPE yych;
unsigned int yyaccept = 0;
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);
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);
if (yych == '#') goto yy214;
}
yy189:
-#line 339 "../src/ast/lex.re"
+#line 340 "../src/ast/lex.re"
{
if (cur == eof) return 0;
pos = cur;
goto scan;
}
}
-#line 1090 "src/ast/lex.cc"
+#line 1091 "src/ast/lex.cc"
yy190:
yych = (YYCTYPE)*++YYCURSOR;
if (yych == '\n') goto yy188;
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 <= '^') {
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;
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;
}
}
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);
}
}
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());
return TOKEN_REGEXP;
}
}
-#line 1323 "src/ast/lex.cc"
+#line 1324 "src/ast/lex.cc"
yy229:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
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;
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);
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)
return TOKEN_ID;
}
}
-#line 1426 "src/ast/lex.cc"
+#line 1427 "src/ast/lex.cc"
yy247:
yych = (YYCTYPE)*++YYCURSOR;
if (yych == 'c') goto yy254;
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))
{
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");
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;
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))
{
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))
}
return TOKEN_CLOSESIZE;
}
-#line 1513 "src/ast/lex.cc"
+#line 1514 "src/ast/lex.cc"
yy264:
yych = (YYCTYPE)*++YYCURSOR;
if (yych <= '0') goto yy266;
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;
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;
}
yy280:
++YYCURSOR;
-#line 418 "../src/ast/lex.re"
+#line 419 "../src/ast/lex.re"
{
if (cur == eof)
{
}
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);
}
}
yy285:
-#line 399 "../src/ast/lex.re"
+#line 400 "../src/ast/lex.re"
{
if (depth == 0)
{
cline++;
goto code;
}
-#line 1724 "src/ast/lex.cc"
+#line 1725 "src/ast/lex.cc"
yy286:
yyaccept = 1;
yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR);
goto yy304;
yy288:
++YYCURSOR;
-#line 371 "../src/ast/lex.re"
+#line 372 "../src/ast/lex.re"
{
if (depth == 0)
{
}
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)
{
}
goto code;
}
-#line 1765 "src/ast/lex.cc"
+#line 1766 "src/ast/lex.cc"
yy292:
yyaccept = 2;
yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR);
}
yy293:
YYCURSOR -= 1;
-#line 386 "../src/ast/lex.re"
+#line 387 "../src/ast/lex.re"
{
if (depth == 0)
{
cline++;
goto code;
}
-#line 1791 "src/ast/lex.cc"
+#line 1792 "src/ast/lex.cc"
yy294:
++YYCURSOR;
goto yy293;
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);
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;
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[] = {
}
++YYCURSOR;
yy328:
-#line 467 "../src/ast/lex.re"
+#line 468 "../src/ast/lex.re"
{
if (cur == eof)
{
}
goto comment;
}
-#line 2014 "src/ast/lex.cc"
+#line 2015 "src/ast/lex.cc"
yy329:
yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR);
if (yybm[0+yych] & 32) {
}
if (yych == '#') goto yy336;
yy330:
-#line 458 "../src/ast/lex.re"
+#line 459 "../src/ast/lex.re"
{
if (cur == eof)
{
cline++;
goto comment;
}
-#line 2032 "src/ast/lex.cc"
+#line 2033 "src/ast/lex.cc"
yy331:
yych = (YYCTYPE)*++YYCURSOR;
if (yych == '/') goto yy338;
}
yy338:
++YYCURSOR;
-#line 439 "../src/ast/lex.re"
+#line 440 "../src/ast/lex.re"
{
if (--depth == 0)
{
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;
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;
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;
}
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>;
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;
yy375:
++YYCURSOR;
YYCURSOR -= 1;
-#line 521 "../src/ast/lex.re"
+#line 508 "../src/ast/lex.re"
{
u = lex_cls_chr();
if (l > u) {
}
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));
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;
}
++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;
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;
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);
}
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);
}
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 <= '@') {
}
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 <= '@') {
goto yy416;
}
}
-#line 563 "../src/ast/lex.re"
+#line 550 "../src/ast/lex.re"
}
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;
}
++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;
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;
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;
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);
}
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);
}
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 <= '@') {
}
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 <= '@') {
goto yy463;
}
}
-#line 598 "../src/ast/lex.re"
+#line 585 "../src/ast/lex.re"
}
sourceline:
tok = cur;
-#line 2892 "src/ast/lex.cc"
+#line 2879 "src/ast/lex.cc"
{
YYCTYPE yych;
static const unsigned char yybm[] = {
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;
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);
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);
if (yych == '\n') goto yy487;
goto yy485;
}
-#line 643 "../src/ast/lex.re"
+#line 628 "../src/ast/lex.re"
}