From 172803accd855a98e8f4f2491fbc7b10b6a89e8c Mon Sep 17 00:00:00 2001 From: Ulya Trofimovich Date: Wed, 12 Aug 2015 18:50:38 +0100 Subject: [PATCH] Lexer: reduced unnecessary macro. --- re2c/bootstrap/src/parse/scanner_lex.cc | 376 ++++++++++++------------ re2c/src/parse/scanner_lex.re | 46 ++- 2 files changed, 209 insertions(+), 213 deletions(-) diff --git a/re2c/bootstrap/src/parse/scanner_lex.cc b/re2c/bootstrap/src/parse/scanner_lex.cc index 82461e68..49b03500 100644 --- a/re2c/bootstrap/src/parse/scanner_lex.cc +++ b/re2c/bootstrap/src/parse/scanner_lex.cc @@ -1,4 +1,4 @@ -/* Generated by re2c 0.14.3 on Wed Aug 12 17:25:10 2015 */ +/* Generated by re2c 0.14.3 on Wed Aug 12 18:50:00 2015 */ #line 1 "../src/parse/scanner_lex.re" #include #include @@ -25,18 +25,16 @@ extern YYSTYPE yylval; #define YYCTXMARKER ctx #define YYFILL(n) { fill (n); } -#define RETURN(i) { return i; } - 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/parse/scanner_lex.re" +#line 34 "../src/parse/scanner_lex.re" -#line 58 "../src/parse/scanner_lex.re" +#line 56 "../src/parse/scanner_lex.re" Scanner::ParseMode Scanner::echo() @@ -52,7 +50,7 @@ Scanner::ParseMode Scanner::echo() tok = cur; echo: -#line 56 "src/parse/scanner_lex.cc" +#line 54 "src/parse/scanner_lex.cc" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -111,7 +109,7 @@ echo: } } ++YYCURSOR; -#line 197 "../src/parse/scanner_lex.re" +#line 195 "../src/parse/scanner_lex.re" { if (!(ignore_eoc || DFlag || flag_skeleton)) { @@ -120,18 +118,18 @@ echo: } if(cur == eof) { - RETURN(Stop); + return Stop; } } -#line 127 "src/parse/scanner_lex.cc" +#line 125 "src/parse/scanner_lex.cc" yy4: ++YYCURSOR; yy5: -#line 208 "../src/parse/scanner_lex.re" +#line 206 "../src/parse/scanner_lex.re" { goto echo; } -#line 135 "src/parse/scanner_lex.cc" +#line 133 "src/parse/scanner_lex.cc" yy6: yyaccept = 0; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -140,7 +138,7 @@ yy6: } if (yych == '#') goto yy91; yy7: -#line 184 "../src/parse/scanner_lex.re" +#line 182 "../src/parse/scanner_lex.re" { if (ignore_eoc) { @@ -154,7 +152,7 @@ yy7: cline++; goto echo; } -#line 158 "src/parse/scanner_lex.cc" +#line 156 "src/parse/scanner_lex.cc" yy8: yych = (YYCTYPE)*++YYCURSOR; if (yych == '{') goto yy32; @@ -238,7 +236,7 @@ yy21: yych = (YYCTYPE)*++YYCURSOR; if (yych != 'c') goto yy12; ++YYCURSOR; -#line 86 "../src/parse/scanner_lex.re" +#line 84 "../src/parse/scanner_lex.re" { if (rFlag) { @@ -249,15 +247,15 @@ yy21: fatal("found 'rules:re2c' block without -r flag"); } tok = cur; - RETURN(Rules); + return Rules; } -#line 255 "src/parse/scanner_lex.cc" +#line 253 "src/parse/scanner_lex.cc" yy31: yych = (YYCTYPE)*++YYCURSOR; if (yych != 'c') goto yy12; yy32: ++YYCURSOR; -#line 74 "../src/parse/scanner_lex.re" +#line 72 "../src/parse/scanner_lex.re" { if (rFlag) { @@ -268,9 +266,9 @@ yy32: out.write((const char*)(tok), (const char*)(&cur[-7]) - (const char*)(tok)); } tok = cur; - RETURN(Parse); + return Parse; } -#line 274 "src/parse/scanner_lex.cc" +#line 272 "src/parse/scanner_lex.cc" yy34: yych = (YYCTYPE)*++YYCURSOR; if (yych != 'e') goto yy12; @@ -285,7 +283,7 @@ yy34: yych = (YYCTYPE)*++YYCURSOR; if (yych != 'c') goto yy12; ++YYCURSOR; -#line 98 "../src/parse/scanner_lex.re" +#line 96 "../src/parse/scanner_lex.re" { if (!rFlag) { @@ -297,9 +295,9 @@ yy34: out.write((const char*)(tok), (const char*)(&cur[-11]) - (const char*)(tok)); } tok = cur; - RETURN(Reuse); + return Reuse; } -#line 303 "src/parse/scanner_lex.cc" +#line 301 "src/parse/scanner_lex.cc" yy42: yych = (YYCTYPE)*++YYCURSOR; if (yych != 'x') goto yy12; @@ -314,7 +312,7 @@ yy42: yych = (YYCTYPE)*++YYCURSOR; if (yych != 'c') goto yy12; ++YYCURSOR; -#line 111 "../src/parse/scanner_lex.re" +#line 109 "../src/parse/scanner_lex.re" { if (!DFlag) { @@ -324,7 +322,7 @@ yy42: ignore_eoc = true; goto echo; } -#line 328 "src/parse/scanner_lex.cc" +#line 326 "src/parse/scanner_lex.cc" yy50: yych = (YYCTYPE)*++YYCURSOR; if (yych != 't') goto yy12; @@ -349,14 +347,14 @@ yy50: yych = (YYCTYPE)*++YYCURSOR; if (yych != 'c') goto yy12; ++YYCURSOR; -#line 120 "../src/parse/scanner_lex.re" +#line 118 "../src/parse/scanner_lex.re" { tok = pos = cur; out.insert_state_goto (topIndent); ignore_eoc = true; goto echo; } -#line 360 "src/parse/scanner_lex.cc" +#line 358 "src/parse/scanner_lex.cc" yy63: yych = (YYCTYPE)*++YYCURSOR; if (yych != 'n') goto yy12; @@ -377,13 +375,13 @@ yy63: yych = (YYCTYPE)*++YYCURSOR; if (yych != 'c') goto yy12; ++YYCURSOR; -#line 126 "../src/parse/scanner_lex.re" +#line 124 "../src/parse/scanner_lex.re" { tok = pos = cur; ignore_eoc = true; goto echo; } -#line 387 "src/parse/scanner_lex.cc" +#line 385 "src/parse/scanner_lex.cc" yy74: yych = (YYCTYPE)*++YYCURSOR; if (yych != 'p') goto yy12; @@ -402,7 +400,7 @@ yy74: yych = (YYCTYPE)*++YYCURSOR; if (yych != 'c') goto yy12; ++YYCURSOR; -#line 131 "../src/parse/scanner_lex.re" +#line 129 "../src/parse/scanner_lex.re" { tok = pos = cur; ignore_eoc = true; @@ -416,14 +414,14 @@ yy74: } goto echo; } -#line 420 "src/parse/scanner_lex.cc" +#line 418 "src/parse/scanner_lex.cc" yy84: yyaccept = 2; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych == '\n') goto yy87; if (yych == '\r') goto yy86; yy85: -#line 162 "../src/parse/scanner_lex.re" +#line 160 "../src/parse/scanner_lex.re" { if (ignore_eoc) { @@ -442,13 +440,13 @@ yy85: tok = pos = cur; goto echo; } -#line 446 "src/parse/scanner_lex.cc" +#line 444 "src/parse/scanner_lex.cc" yy86: yych = (YYCTYPE)*++YYCURSOR; if (yych != '\n') goto yy12; yy87: ++YYCURSOR; -#line 144 "../src/parse/scanner_lex.re" +#line 142 "../src/parse/scanner_lex.re" { cline++; if (ignore_eoc) @@ -467,7 +465,7 @@ yy87: tok = pos = cur; goto echo; } -#line 471 "src/parse/scanner_lex.cc" +#line 469 "src/parse/scanner_lex.cc" yy89: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -542,12 +540,12 @@ yy101: yy103: ++YYCURSOR; YYCURSOR = YYCTXMARKER; -#line 180 "../src/parse/scanner_lex.re" +#line 178 "../src/parse/scanner_lex.re" { set_sourceline (); goto echo; } -#line 551 "src/parse/scanner_lex.cc" +#line 549 "src/parse/scanner_lex.cc" yy105: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy103; @@ -572,7 +570,7 @@ yy109: if (yych == '\r') goto yy105; goto yy12; } -#line 211 "../src/parse/scanner_lex.re" +#line 209 "../src/parse/scanner_lex.re" } @@ -594,7 +592,7 @@ scan: start: -#line 598 "src/parse/scanner_lex.cc" +#line 596 "src/parse/scanner_lex.cc" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -709,22 +707,22 @@ start: yy112: ++YYCURSOR; yy113: -#line 429 "../src/parse/scanner_lex.re" +#line 427 "../src/parse/scanner_lex.re" { fatalf("unexpected character: '%c'", *tok); goto scan; } -#line 718 "src/parse/scanner_lex.cc" +#line 716 "src/parse/scanner_lex.cc" yy114: ++YYCURSOR; yych = (YYCTYPE)*YYCURSOR; goto yy248; yy115: -#line 413 "../src/parse/scanner_lex.re" +#line 411 "../src/parse/scanner_lex.re" { goto scan; } -#line 728 "src/parse/scanner_lex.cc" +#line 726 "src/parse/scanner_lex.cc" yy116: yyaccept = 0; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -735,14 +733,14 @@ yy116: if (yych == '#') goto yy228; } yy117: -#line 422 "../src/parse/scanner_lex.re" +#line 420 "../src/parse/scanner_lex.re" { - if (cur == eof) RETURN(0); + if (cur == eof) return 0; pos = cur; cline++; goto scan; } -#line 746 "src/parse/scanner_lex.cc" +#line 744 "src/parse/scanner_lex.cc" yy118: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy225; @@ -752,11 +750,11 @@ yy119: yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych != '\n') goto yy221; yy120: -#line 287 "../src/parse/scanner_lex.re" +#line 285 "../src/parse/scanner_lex.re" { fatal("unterminated string constant (missing \")"); } -#line 760 "src/parse/scanner_lex.cc" +#line 758 "src/parse/scanner_lex.cc" yy121: yych = (YYCTYPE)*++YYCURSOR; if (yych == '}') goto yy213; @@ -766,44 +764,44 @@ yy122: yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych != '\n') goto yy216; yy123: -#line 290 "../src/parse/scanner_lex.re" +#line 288 "../src/parse/scanner_lex.re" { fatal("unterminated string constant (missing ')"); } -#line 774 "src/parse/scanner_lex.cc" +#line 772 "src/parse/scanner_lex.cc" yy124: ++YYCURSOR; yy125: -#line 316 "../src/parse/scanner_lex.re" +#line 314 "../src/parse/scanner_lex.re" { - RETURN(*tok); + return *tok; } -#line 782 "src/parse/scanner_lex.cc" +#line 780 "src/parse/scanner_lex.cc" yy126: ++YYCURSOR; if ((yych = (YYCTYPE)*YYCURSOR) == '/') goto yy213; -#line 320 "../src/parse/scanner_lex.re" +#line 318 "../src/parse/scanner_lex.re" { yylval.op = *tok; - RETURN(STAR); + return STAR; } -#line 791 "src/parse/scanner_lex.cc" +#line 789 "src/parse/scanner_lex.cc" yy128: ++YYCURSOR; -#line 324 "../src/parse/scanner_lex.re" +#line 322 "../src/parse/scanner_lex.re" { yylval.op = *tok; - RETURN(CLOSE); + return CLOSE; } -#line 799 "src/parse/scanner_lex.cc" +#line 797 "src/parse/scanner_lex.cc" yy130: ++YYCURSOR; -#line 408 "../src/parse/scanner_lex.re" +#line 406 "../src/parse/scanner_lex.re" { yylval.regexp = mkDot(); return RANGE; } -#line 807 "src/parse/scanner_lex.cc" +#line 805 "src/parse/scanner_lex.cc" yy132: yych = (YYCTYPE)*++YYCURSOR; if (yych == '*') goto yy209; @@ -831,11 +829,11 @@ yy136: if (yych == '^') goto yy188; goto yy187; yy137: -#line 306 "../src/parse/scanner_lex.re" +#line 304 "../src/parse/scanner_lex.re" { fatal("unterminated range (missing ])"); } -#line 839 "src/parse/scanner_lex.cc" +#line 837 "src/parse/scanner_lex.cc" yy138: YYCTXMARKER = YYCURSOR + 1; yych = (YYCTYPE)*++YYCURSOR; @@ -861,12 +859,12 @@ yy139: } } yy140: -#line 232 "../src/parse/scanner_lex.re" +#line 230 "../src/parse/scanner_lex.re" { depth = 1; goto code; } -#line 870 "src/parse/scanner_lex.cc" +#line 868 "src/parse/scanner_lex.cc" yy141: yych = (YYCTYPE)*++YYCURSOR; if (yych == ',') goto yy160; @@ -938,14 +936,14 @@ yy145: yy147: ++YYCURSOR; yy148: -#line 352 "../src/parse/scanner_lex.re" +#line 350 "../src/parse/scanner_lex.re" { fatal("illegal closure form, use '{n}', '{n,}', '{n,m}' where n and m are numbers"); } -#line 946 "src/parse/scanner_lex.cc" +#line 944 "src/parse/scanner_lex.cc" yy149: ++YYCURSOR; -#line 356 "../src/parse/scanner_lex.re" +#line 354 "../src/parse/scanner_lex.re" { if (!FFlag) { fatal("curly braces for names only allowed with -F switch"); @@ -953,16 +951,16 @@ yy149: yylval.str = new std::string (tok + 1, cur - tok - 2); return ID; } -#line 957 "src/parse/scanner_lex.cc" +#line 955 "src/parse/scanner_lex.cc" yy151: ++YYCURSOR; -#line 334 "../src/parse/scanner_lex.re" +#line 332 "../src/parse/scanner_lex.re" { yylval.extop.minsize = atoi((char *)tok+1); yylval.extop.maxsize = atoi((char *)tok+1); - RETURN(CLOSESIZE); + return CLOSESIZE; } -#line 966 "src/parse/scanner_lex.cc" +#line 964 "src/parse/scanner_lex.cc" yy153: yyaccept = 6; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -970,13 +968,13 @@ yy153: if (yych <= '9') goto yy156; if (yych != '}') goto yy148; ++YYCURSOR; -#line 346 "../src/parse/scanner_lex.re" +#line 344 "../src/parse/scanner_lex.re" { yylval.extop.minsize = atoi((char *)tok+1); yylval.extop.maxsize = -1; - RETURN(CLOSESIZE); + return CLOSESIZE; } -#line 980 "src/parse/scanner_lex.cc" +#line 978 "src/parse/scanner_lex.cc" yy156: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -985,13 +983,13 @@ yy156: if (yych <= '9') goto yy156; if (yych != '}') goto yy142; ++YYCURSOR; -#line 340 "../src/parse/scanner_lex.re" +#line 338 "../src/parse/scanner_lex.re" { yylval.extop.minsize = atoi((char *)tok+1); yylval.extop.maxsize = MAX(yylval.extop.minsize,atoi(strchr((char *)tok, ',')+1)); - RETURN(CLOSESIZE); + return CLOSESIZE; } -#line 995 "src/parse/scanner_lex.cc" +#line 993 "src/parse/scanner_lex.cc" yy160: yyaccept = 6; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -999,17 +997,17 @@ yy160: if (yych <= '9') goto yy156; if (yych != '}') goto yy148; ++YYCURSOR; -#line 329 "../src/parse/scanner_lex.re" +#line 327 "../src/parse/scanner_lex.re" { yylval.op = '*'; - RETURN(CLOSE); + return CLOSE; } -#line 1008 "src/parse/scanner_lex.cc" +#line 1006 "src/parse/scanner_lex.cc" yy163: ++YYCURSOR; yy164: YYCURSOR = YYCTXMARKER; -#line 389 "../src/parse/scanner_lex.re" +#line 387 "../src/parse/scanner_lex.re" { if (!FFlag) { yylval.str = new std::string (tok, cur - tok); @@ -1028,7 +1026,7 @@ yy164: return STRING; } } -#line 1032 "src/parse/scanner_lex.cc" +#line 1030 "src/parse/scanner_lex.cc" yy165: yych = (YYCTYPE)*++YYCURSOR; goto yy184; @@ -1036,12 +1034,12 @@ yy166: ++YYCURSOR; yy167: YYCURSOR = YYCTXMARKER; -#line 384 "../src/parse/scanner_lex.re" +#line 382 "../src/parse/scanner_lex.re" { yylval.str = new std::string (tok, cur - tok); return ID; } -#line 1045 "src/parse/scanner_lex.cc" +#line 1043 "src/parse/scanner_lex.cc" yy168: YYCTXMARKER = YYCURSOR + 1; ++YYCURSOR; @@ -1120,14 +1118,14 @@ yy174: } } yy176: -#line 364 "../src/parse/scanner_lex.re" +#line 362 "../src/parse/scanner_lex.re" { tok += 5; /* skip "re2c:" */ lexer_state = LEX_CONFIG; yylval.str = new std::string (tok, cur - tok); return CONFIG; } -#line 1131 "src/parse/scanner_lex.cc" +#line 1129 "src/parse/scanner_lex.cc" yy177: yych = (YYCTYPE)*++YYCURSOR; if (yych <= 'Z') { @@ -1186,7 +1184,7 @@ yy179: yy181: ++YYCURSOR; YYCURSOR = YYCTXMARKER; -#line 371 "../src/parse/scanner_lex.re" +#line 369 "../src/parse/scanner_lex.re" { yylval.str = new std::string (tok, cur - tok); if (FFlag) @@ -1199,7 +1197,7 @@ yy181: return ID; } } -#line 1203 "src/parse/scanner_lex.cc" +#line 1201 "src/parse/scanner_lex.cc" yy183: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -1245,13 +1243,13 @@ yy190: goto yy186; yy191: ++YYCURSOR; -#line 300 "../src/parse/scanner_lex.re" +#line 298 "../src/parse/scanner_lex.re" { SubStr s (tok, cur - tok); yylval.regexp = ranToRE (s); return RANGE; } -#line 1255 "src/parse/scanner_lex.cc" +#line 1253 "src/parse/scanner_lex.cc" yy193: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -1260,20 +1258,20 @@ yy193: goto yy188; yy194: ++YYCURSOR; -#line 294 "../src/parse/scanner_lex.re" +#line 292 "../src/parse/scanner_lex.re" { SubStr s (tok, cur - tok); yylval.regexp = invToRE (s); return RANGE; } -#line 1270 "src/parse/scanner_lex.cc" +#line 1268 "src/parse/scanner_lex.cc" yy196: ++YYCURSOR; -#line 313 "../src/parse/scanner_lex.re" +#line 311 "../src/parse/scanner_lex.re" { - RETURN(SETUP); + return SETUP; } -#line 1277 "src/parse/scanner_lex.cc" +#line 1275 "src/parse/scanner_lex.cc" yy198: YYCTXMARKER = YYCURSOR + 1; yych = (YYCTYPE)*++YYCURSOR; @@ -1303,11 +1301,11 @@ yy200: yy201: ++YYCURSOR; YYCURSOR = YYCTXMARKER; -#line 310 "../src/parse/scanner_lex.re" +#line 308 "../src/parse/scanner_lex.re" { - RETURN(NOCOND); + return NOCOND; } -#line 1311 "src/parse/scanner_lex.cc" +#line 1309 "src/parse/scanner_lex.cc" yy203: yych = (YYCTYPE)*++YYCURSOR; if (yych == '>') goto yy201; @@ -1319,44 +1317,44 @@ yy204: yy205: ++YYCURSOR; if ((yych = (YYCTYPE)*YYCURSOR) == '>') goto yy207; -#line 241 "../src/parse/scanner_lex.re" +#line 239 "../src/parse/scanner_lex.re" { tok += 2; /* skip ":=" */ depth = 0; goto code; } -#line 1329 "src/parse/scanner_lex.cc" +#line 1327 "src/parse/scanner_lex.cc" yy207: ++YYCURSOR; YYCURSOR = YYCTXMARKER; -#line 237 "../src/parse/scanner_lex.re" +#line 235 "../src/parse/scanner_lex.re" { - RETURN(*tok); + return *tok; } -#line 1337 "src/parse/scanner_lex.cc" +#line 1335 "src/parse/scanner_lex.cc" yy209: ++YYCURSOR; -#line 250 "../src/parse/scanner_lex.re" +#line 248 "../src/parse/scanner_lex.re" { depth = 1; goto comment; } -#line 1345 "src/parse/scanner_lex.cc" +#line 1343 "src/parse/scanner_lex.cc" yy211: ++YYCURSOR; -#line 247 "../src/parse/scanner_lex.re" +#line 245 "../src/parse/scanner_lex.re" { goto nextLine; } -#line 1352 "src/parse/scanner_lex.cc" +#line 1350 "src/parse/scanner_lex.cc" yy213: ++YYCURSOR; -#line 256 "../src/parse/scanner_lex.re" +#line 254 "../src/parse/scanner_lex.re" { tok = cur; - RETURN(0); + return 0; } -#line 1360 "src/parse/scanner_lex.cc" +#line 1358 "src/parse/scanner_lex.cc" yy215: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -1374,7 +1372,7 @@ yy216: goto yy215; yy218: ++YYCURSOR; -#line 274 "../src/parse/scanner_lex.re" +#line 272 "../src/parse/scanner_lex.re" { SubStr s (tok + 1, cur - tok - 2); if (bCaseInverted) @@ -1387,7 +1385,7 @@ yy218: } return STRING; } -#line 1391 "src/parse/scanner_lex.cc" +#line 1389 "src/parse/scanner_lex.cc" yy220: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -1405,7 +1403,7 @@ yy221: goto yy220; yy223: ++YYCURSOR; -#line 261 "../src/parse/scanner_lex.re" +#line 259 "../src/parse/scanner_lex.re" { SubStr s (tok + 1, cur - tok - 2); if (bCaseInsensitive || bCaseInverted) @@ -1418,7 +1416,7 @@ yy223: } return STRING; } -#line 1422 "src/parse/scanner_lex.cc" +#line 1420 "src/parse/scanner_lex.cc" yy225: yyaccept = 0; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -1511,12 +1509,12 @@ yy238: yy240: ++YYCURSOR; YYCURSOR = YYCTXMARKER; -#line 417 "../src/parse/scanner_lex.re" +#line 415 "../src/parse/scanner_lex.re" { set_sourceline (); goto scan; } -#line 1520 "src/parse/scanner_lex.cc" +#line 1518 "src/parse/scanner_lex.cc" yy242: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy240; @@ -1551,12 +1549,12 @@ yy248: if (yych == ' ') goto yy247; goto yy115; } -#line 433 "../src/parse/scanner_lex.re" +#line 431 "../src/parse/scanner_lex.re" flex_name: -#line 1560 "src/parse/scanner_lex.cc" +#line 1558 "src/parse/scanner_lex.cc" { YYCTYPE yych; if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -1565,22 +1563,22 @@ flex_name: if (yych == '\r') goto yy255; ++YYCURSOR; yy252: -#line 444 "../src/parse/scanner_lex.re" +#line 442 "../src/parse/scanner_lex.re" { YYCURSOR = tok; goto start; } -#line 1574 "src/parse/scanner_lex.cc" +#line 1572 "src/parse/scanner_lex.cc" yy253: ++YYCURSOR; yy254: -#line 438 "../src/parse/scanner_lex.re" +#line 436 "../src/parse/scanner_lex.re" { YYCURSOR = tok; lexer_state = LEX_NORMAL; return FID_END; } -#line 1584 "src/parse/scanner_lex.cc" +#line 1582 "src/parse/scanner_lex.cc" yy255: yych = (YYCTYPE)*++YYCURSOR; if (yych != '\n') goto yy252; @@ -1588,12 +1586,12 @@ yy255: yych = (YYCTYPE)*YYCURSOR; goto yy254; } -#line 448 "../src/parse/scanner_lex.re" +#line 446 "../src/parse/scanner_lex.re" code: -#line 1597 "src/parse/scanner_lex.cc" +#line 1595 "src/parse/scanner_lex.cc" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -1654,7 +1652,7 @@ code: } yy259: ++YYCURSOR; -#line 511 "../src/parse/scanner_lex.re" +#line 509 "../src/parse/scanner_lex.re" { if (cur == eof) { @@ -1662,19 +1660,19 @@ yy259: { fatal("missing '}'"); } - RETURN(0); + return 0; } goto code; } -#line 1670 "src/parse/scanner_lex.cc" +#line 1668 "src/parse/scanner_lex.cc" yy261: ++YYCURSOR; yy262: -#line 525 "../src/parse/scanner_lex.re" +#line 523 "../src/parse/scanner_lex.re" { goto code; } -#line 1678 "src/parse/scanner_lex.cc" +#line 1676 "src/parse/scanner_lex.cc" yy263: YYCTXMARKER = YYCURSOR + 1; yyaccept = 0; @@ -1694,7 +1692,7 @@ yy263: } } yy264: -#line 492 "../src/parse/scanner_lex.re" +#line 490 "../src/parse/scanner_lex.re" { if (depth == 0) { @@ -1714,7 +1712,7 @@ yy264: cline++; goto code; } -#line 1718 "src/parse/scanner_lex.cc" +#line 1716 "src/parse/scanner_lex.cc" yy265: yyaccept = 1; yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); @@ -1727,7 +1725,7 @@ yy266: goto yy272; yy267: ++YYCURSOR; -#line 464 "../src/parse/scanner_lex.re" +#line 462 "../src/parse/scanner_lex.re" { if (depth == 0) { @@ -1739,10 +1737,10 @@ yy267: } goto code; } -#line 1743 "src/parse/scanner_lex.cc" +#line 1741 "src/parse/scanner_lex.cc" yy269: ++YYCURSOR; -#line 452 "../src/parse/scanner_lex.re" +#line 450 "../src/parse/scanner_lex.re" { if (depth == 0) { @@ -1755,7 +1753,7 @@ yy269: } goto code; } -#line 1759 "src/parse/scanner_lex.cc" +#line 1757 "src/parse/scanner_lex.cc" yy271: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -1786,11 +1784,11 @@ yy274: goto yy271; yy275: ++YYCURSOR; -#line 522 "../src/parse/scanner_lex.re" +#line 520 "../src/parse/scanner_lex.re" { goto code; } -#line 1794 "src/parse/scanner_lex.cc" +#line 1792 "src/parse/scanner_lex.cc" yy277: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -1817,7 +1815,7 @@ yy280: } yy281: YYCURSOR = YYCTXMARKER; -#line 479 "../src/parse/scanner_lex.re" +#line 477 "../src/parse/scanner_lex.re" { if (depth == 0) { @@ -1831,7 +1829,7 @@ yy281: cline++; goto code; } -#line 1835 "src/parse/scanner_lex.cc" +#line 1833 "src/parse/scanner_lex.cc" yy282: yych = (YYCTYPE)*++YYCURSOR; goto yy281; @@ -1898,12 +1896,12 @@ yy293: yy295: ++YYCURSOR; YYCURSOR = YYCTXMARKER; -#line 475 "../src/parse/scanner_lex.re" +#line 473 "../src/parse/scanner_lex.re" { set_sourceline (); goto code; } -#line 1907 "src/parse/scanner_lex.cc" +#line 1905 "src/parse/scanner_lex.cc" yy297: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy295; @@ -1942,12 +1940,12 @@ yy302: goto yy273; } } -#line 528 "../src/parse/scanner_lex.re" +#line 526 "../src/parse/scanner_lex.re" comment: -#line 1951 "src/parse/scanner_lex.cc" +#line 1949 "src/parse/scanner_lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -1994,15 +1992,15 @@ comment: } ++YYCURSOR; yy307: -#line 560 "../src/parse/scanner_lex.re" +#line 558 "../src/parse/scanner_lex.re" { if (cur == eof) { - RETURN(0); + return 0; } goto comment; } -#line 2006 "src/parse/scanner_lex.cc" +#line 2004 "src/parse/scanner_lex.cc" yy308: yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yybm[0+yych] & 32) { @@ -2010,17 +2008,17 @@ yy308: } if (yych == '#') goto yy319; yy309: -#line 551 "../src/parse/scanner_lex.re" +#line 549 "../src/parse/scanner_lex.re" { if (cur == eof) { - RETURN(0); + return 0; } tok = pos = cur; cline++; goto comment; } -#line 2024 "src/parse/scanner_lex.cc" +#line 2022 "src/parse/scanner_lex.cc" yy310: yych = (YYCTYPE)*++YYCURSOR; if (yych == '/') goto yy314; @@ -2029,16 +2027,16 @@ yy311: yych = (YYCTYPE)*++YYCURSOR; if (yych != '*') goto yy307; ++YYCURSOR; -#line 542 "../src/parse/scanner_lex.re" +#line 540 "../src/parse/scanner_lex.re" { ++depth; fatal("ambiguous /* found"); goto comment; } -#line 2039 "src/parse/scanner_lex.cc" +#line 2037 "src/parse/scanner_lex.cc" yy314: ++YYCURSOR; -#line 532 "../src/parse/scanner_lex.re" +#line 530 "../src/parse/scanner_lex.re" { if (--depth == 0) { @@ -2049,7 +2047,7 @@ yy314: goto comment; } } -#line 2053 "src/parse/scanner_lex.cc" +#line 2051 "src/parse/scanner_lex.cc" yy316: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -2127,12 +2125,12 @@ yy329: yy331: ++YYCURSOR; YYCURSOR = YYCTXMARKER; -#line 547 "../src/parse/scanner_lex.re" +#line 545 "../src/parse/scanner_lex.re" { set_sourceline (); goto comment; } -#line 2136 "src/parse/scanner_lex.cc" +#line 2134 "src/parse/scanner_lex.cc" yy333: yych = (YYCTYPE)*++YYCURSOR; if (yych == '\n') goto yy331; @@ -2157,43 +2155,43 @@ yy337: if (yych == '\r') goto yy333; goto yy318; } -#line 567 "../src/parse/scanner_lex.re" +#line 565 "../src/parse/scanner_lex.re" nextLine: -#line 2166 "src/parse/scanner_lex.cc" +#line 2164 "src/parse/scanner_lex.cc" { YYCTYPE yych; if (YYLIMIT <= YYCURSOR) YYFILL(1); yych = (YYCTYPE)*YYCURSOR; if (yych == '\n') goto yy342; ++YYCURSOR; -#line 578 "../src/parse/scanner_lex.re" +#line 576 "../src/parse/scanner_lex.re" { if(cur == eof) { - RETURN(0); + return 0; } goto nextLine; } -#line 2179 "src/parse/scanner_lex.cc" +#line 2177 "src/parse/scanner_lex.cc" yy342: ++YYCURSOR; -#line 571 "../src/parse/scanner_lex.re" +#line 569 "../src/parse/scanner_lex.re" { if(cur == eof) { - RETURN(0); + return 0; } tok = pos = cur; cline++; goto scan; } -#line 2190 "src/parse/scanner_lex.cc" +#line 2188 "src/parse/scanner_lex.cc" } -#line 583 "../src/parse/scanner_lex.re" +#line 581 "../src/parse/scanner_lex.re" config: -#line 2197 "src/parse/scanner_lex.cc" +#line 2195 "src/parse/scanner_lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -2239,32 +2237,32 @@ config: if (yych == '=') goto yy350; } ++YYCURSOR; -#line 594 "../src/parse/scanner_lex.re" +#line 592 "../src/parse/scanner_lex.re" { fatal("missing '='"); } -#line 2247 "src/parse/scanner_lex.cc" +#line 2245 "src/parse/scanner_lex.cc" yy348: ++YYCURSOR; yych = (YYCTYPE)*YYCURSOR; goto yy355; yy349: -#line 587 "../src/parse/scanner_lex.re" +#line 585 "../src/parse/scanner_lex.re" { goto config; } -#line 2257 "src/parse/scanner_lex.cc" +#line 2255 "src/parse/scanner_lex.cc" yy350: ++YYCURSOR; yych = (YYCTYPE)*YYCURSOR; goto yy353; yy351: -#line 590 "../src/parse/scanner_lex.re" +#line 588 "../src/parse/scanner_lex.re" { lexer_state = LEX_CONFIG_VALUE; - RETURN('='); + return '='; } -#line 2268 "src/parse/scanner_lex.cc" +#line 2266 "src/parse/scanner_lex.cc" yy352: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -2283,12 +2281,12 @@ yy355: if (yych == ' ') goto yy354; goto yy349; } -#line 597 "../src/parse/scanner_lex.re" +#line 595 "../src/parse/scanner_lex.re" value: -#line 2292 "src/parse/scanner_lex.cc" +#line 2290 "src/parse/scanner_lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -2355,26 +2353,26 @@ value: } } yy358: -#line 606 "../src/parse/scanner_lex.re" +#line 604 "../src/parse/scanner_lex.re" { yylval.str = new std::string (tok, cur - tok); lexer_state = LEX_NORMAL; return VALUE; } -#line 2365 "src/parse/scanner_lex.cc" +#line 2363 "src/parse/scanner_lex.cc" yy359: ++YYCURSOR; if (yybm[0+(yych = (YYCTYPE)*YYCURSOR)] & 8) { goto yy364; } yy360: -#line 601 "../src/parse/scanner_lex.re" +#line 599 "../src/parse/scanner_lex.re" { yylval.number = atoi(std::string (tok, cur - tok).c_str()); lexer_state = LEX_NORMAL; return NUMBER; } -#line 2378 "src/parse/scanner_lex.cc" +#line 2376 "src/parse/scanner_lex.cc" yy361: yych = (YYCTYPE)*++YYCURSOR; if (yych <= '0') goto yy365; @@ -2517,7 +2515,7 @@ yy379: if (yych == '\n') goto yy372; goto yy376; } -#line 611 "../src/parse/scanner_lex.re" +#line 609 "../src/parse/scanner_lex.re" } @@ -2540,7 +2538,7 @@ void Scanner::set_sourceline () sourceline: tok = cur; -#line 2544 "src/parse/scanner_lex.cc" +#line 2542 "src/parse/scanner_lex.cc" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -2589,14 +2587,14 @@ sourceline: yy382: ++YYCURSOR; yy383: -#line 653 "../src/parse/scanner_lex.re" +#line 651 "../src/parse/scanner_lex.re" { goto sourceline; } -#line 2597 "src/parse/scanner_lex.cc" +#line 2595 "src/parse/scanner_lex.cc" yy384: ++YYCURSOR; -#line 641 "../src/parse/scanner_lex.re" +#line 639 "../src/parse/scanner_lex.re" { if (cur == eof) { @@ -2609,7 +2607,7 @@ yy384: tok = cur; return; } -#line 2613 "src/parse/scanner_lex.cc" +#line 2611 "src/parse/scanner_lex.cc" yy386: yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR); if (yych == '\n') goto yy383; @@ -2619,12 +2617,12 @@ yy387: yych = (YYCTYPE)*YYCURSOR; goto yy390; yy388: -#line 633 "../src/parse/scanner_lex.re" +#line 631 "../src/parse/scanner_lex.re" { cline = atoi(std::string (tok, cur - tok).c_str()); goto sourceline; } -#line 2628 "src/parse/scanner_lex.cc" +#line 2626 "src/parse/scanner_lex.cc" yy389: ++YYCURSOR; if (YYLIMIT <= YYCURSOR) YYFILL(1); @@ -2656,14 +2654,14 @@ yy394: goto yy391; yy395: ++YYCURSOR; -#line 637 "../src/parse/scanner_lex.re" +#line 635 "../src/parse/scanner_lex.re" { escape (in.file_name, std::string (tok + 1, cur - tok - 2)); goto sourceline; } -#line 2665 "src/parse/scanner_lex.cc" +#line 2663 "src/parse/scanner_lex.cc" } -#line 656 "../src/parse/scanner_lex.re" +#line 654 "../src/parse/scanner_lex.re" } diff --git a/re2c/src/parse/scanner_lex.re b/re2c/src/parse/scanner_lex.re index 9aef0108..342eccce 100644 --- a/re2c/src/parse/scanner_lex.re +++ b/re2c/src/parse/scanner_lex.re @@ -23,8 +23,6 @@ extern YYSTYPE yylval; #define YYCTXMARKER ctx #define YYFILL(n) { fill (n); } -#define RETURN(i) { return i; } - namespace re2c { @@ -81,7 +79,7 @@ echo: out.write((const char*)(tok), (const char*)(&cur[-7]) - (const char*)(tok)); } tok = cur; - RETURN(Parse); + return Parse; } "/*!rules:re2c" { if (rFlag) @@ -93,7 +91,7 @@ echo: fatal("found 'rules:re2c' block without -r flag"); } tok = cur; - RETURN(Rules); + return Rules; } "/*!use:re2c" { if (!rFlag) @@ -106,7 +104,7 @@ echo: out.write((const char*)(tok), (const char*)(&cur[-11]) - (const char*)(tok)); } tok = cur; - RETURN(Reuse); + return Reuse; } "/*!max:re2c" { if (!DFlag) @@ -202,7 +200,7 @@ echo: } if(cur == eof) { - RETURN(Stop); + return Stop; } } * { @@ -235,7 +233,7 @@ start: } ":" / "=>" { - RETURN(*tok); + return *tok; } ":=" { @@ -255,7 +253,7 @@ start: endRE = "%}" | "*/"; endRE { tok = cur; - RETURN(0); + return 0; } dstring { @@ -308,45 +306,45 @@ start: } "<>" / (space* ("{" | "=>" | ":=")) { - RETURN(NOCOND); + return NOCOND; } ",()|=;/\\] { - RETURN(*tok); + return *tok; } "*" { yylval.op = *tok; - RETURN(STAR); + return STAR; } [+?] { yylval.op = *tok; - RETURN(CLOSE); + return CLOSE; } "{0,}" { yylval.op = '*'; - RETURN(CLOSE); + return CLOSE; } "{" [0-9]+ "}" { yylval.extop.minsize = atoi((char *)tok+1); yylval.extop.maxsize = atoi((char *)tok+1); - RETURN(CLOSESIZE); + return CLOSESIZE; } "{" [0-9]+ "," [0-9]+ "}" { yylval.extop.minsize = atoi((char *)tok+1); yylval.extop.maxsize = MAX(yylval.extop.minsize,atoi(strchr((char *)tok, ',')+1)); - RETURN(CLOSESIZE); + return CLOSESIZE; } "{" [0-9]+ ",}" { yylval.extop.minsize = atoi((char *)tok+1); yylval.extop.maxsize = -1; - RETURN(CLOSESIZE); + return CLOSESIZE; } "{" [0-9]* "," { @@ -420,7 +418,7 @@ start: } eol { - if (cur == eof) RETURN(0); + if (cur == eof) return 0; pos = cur; cline++; goto scan; @@ -515,7 +513,7 @@ code: { fatal("missing '}'"); } - RETURN(0); + return 0; } goto code; } @@ -551,7 +549,7 @@ comment: "\n" { if (cur == eof) { - RETURN(0); + return 0; } tok = pos = cur; cline++; @@ -560,7 +558,7 @@ comment: * { if (cur == eof) { - RETURN(0); + return 0; } goto comment; } @@ -569,14 +567,14 @@ comment: nextLine: /*!re2c /* resync emacs */ "\n" { if(cur == eof) { - RETURN(0); + return 0; } tok = pos = cur; cline++; goto scan; } * { if(cur == eof) { - RETURN(0); + return 0; } goto nextLine; } @@ -589,7 +587,7 @@ config: } "=" space* { lexer_state = LEX_CONFIG_VALUE; - RETURN('='); + return '='; } * { fatal("missing '='"); -- 2.40.0