]> granicus.if.org Git - re2c/commitdiff
Small tweaks in lexer subroutines for semantic actions.
authorUlya Trofimovich <skvadrik@gmail.com>
Thu, 1 Nov 2018 00:01:25 +0000 (00:01 +0000)
committerUlya Trofimovich <skvadrik@gmail.com>
Thu, 1 Nov 2018 00:01:25 +0000 (00:01 +0000)
re2c/bootstrap/src/ast/lex.cc
re2c/src/ast/lex.re
re2c/src/ast/scanner.h

index 2a4b4cd704920288c27dbd233487eee34d7c4eb4..b1c4bf11ef1701ea376a454cb84c0177b0d754f5 100644 (file)
@@ -1,4 +1,4 @@
-/* Generated by re2c 1.1.1 on Wed Oct 31 22:58:25 2018 */
+/* Generated by re2c 1.1.1 on Wed Oct 31 23:59:37 2018 */
 #line 1 "../src/ast/lex.re"
 #include "src/util/c99_stdint.h"
 #include <stddef.h>
@@ -1202,7 +1202,7 @@ yy209:
        }
 yy210:
 #line 203 "../src/ast/lex.re"
-       { lex_code_multiline(); return TOKEN_CODE; }
+       { lex_code_in_braces(); return TOKEN_CODE; }
 #line 1207 "src/ast/lex.cc"
 yy211:
        ++YYCURSOR;
@@ -1280,7 +1280,7 @@ yy225:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '>') goto yy243;
 #line 204 "../src/ast/lex.re"
-       { tok += 2; lex_code_oneline(); return TOKEN_CODE; }
+       { lex_code_indented(); return TOKEN_CODE; }
 #line 1285 "src/ast/lex.cc"
 yy227:
        ++YYCURSOR;
@@ -1578,12 +1578,13 @@ yy277:
 
 }
 
-void Scanner::lex_code_oneline()
+void Scanner::lex_code_indented()
 {
     const uint32_t line = cline;
+    tok = cur;
 code:
 
-#line 1587 "src/ast/lex.cc"
+#line 1588 "src/ast/lex.cc"
 {
        YYCTYPE yych;
        if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
@@ -1611,15 +1612,15 @@ code:
        }
 yy280:
        ++YYCURSOR;
-#line 346 "../src/ast/lex.re"
+#line 347 "../src/ast/lex.re"
        { fail_if_eof(); goto code; }
-#line 1617 "src/ast/lex.cc"
+#line 1618 "src/ast/lex.cc"
 yy282:
        ++YYCURSOR;
 yy283:
-#line 351 "../src/ast/lex.re"
+#line 352 "../src/ast/lex.re"
        { goto code; }
-#line 1623 "src/ast/lex.cc"
+#line 1624 "src/ast/lex.cc"
 yy284:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych <= '\f') {
@@ -1630,23 +1631,23 @@ yy284:
                if (yych == ' ') goto yy292;
        }
 yy285:
-#line 339 "../src/ast/lex.re"
+#line 340 "../src/ast/lex.re"
        {
-        tok += strspn(tok, " \t\r\n");
-        while (cur > tok && strchr(" \t\r\n", cur[-1])) --cur;
+        while (isspace(tok[0])) ++tok;
+        while (cur > tok && isspace(cur[-1])) --cur;
         yylval.code = new Code(get_fname (), line, tok, tok_len ());
         return;
     }
-#line 1641 "src/ast/lex.cc"
+#line 1642 "src/ast/lex.cc"
 yy286:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '\n') goto yy284;
        goto yy283;
 yy287:
        ++YYCURSOR;
-#line 350 "../src/ast/lex.re"
+#line 351 "../src/ast/lex.re"
        { lex_string(cur[-1]); goto code; }
-#line 1650 "src/ast/lex.cc"
+#line 1651 "src/ast/lex.cc"
 yy289:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '*') goto yy294;
@@ -1654,37 +1655,37 @@ yy289:
        goto yy283;
 yy290:
        ++YYCURSOR;
-#line 347 "../src/ast/lex.re"
+#line 348 "../src/ast/lex.re"
        { fatal_l(get_cline(), "Curly braces are not allowed after ':='"); }
-#line 1660 "src/ast/lex.cc"
+#line 1661 "src/ast/lex.cc"
 yy292:
        ++YYCURSOR;
        YYCURSOR -= 1;
-#line 338 "../src/ast/lex.re"
+#line 339 "../src/ast/lex.re"
        { goto code; }
-#line 1666 "src/ast/lex.cc"
+#line 1667 "src/ast/lex.cc"
 yy294:
        ++YYCURSOR;
-#line 348 "../src/ast/lex.re"
+#line 349 "../src/ast/lex.re"
        { lex_c_comment(); goto code; }
-#line 1671 "src/ast/lex.cc"
+#line 1672 "src/ast/lex.cc"
 yy296:
        ++YYCURSOR;
-#line 349 "../src/ast/lex.re"
+#line 350 "../src/ast/lex.re"
        { lex_cpp_comment(); goto code; }
-#line 1676 "src/ast/lex.cc"
+#line 1677 "src/ast/lex.cc"
 }
-#line 352 "../src/ast/lex.re"
+#line 353 "../src/ast/lex.re"
 
 }
 
-void Scanner::lex_code_multiline()
+void Scanner::lex_code_in_braces()
 {
     const uint32_t line = cline;
     uint32_t depth = 1;
 code:
 
-#line 1688 "src/ast/lex.cc"
+#line 1689 "src/ast/lex.cc"
 {
        YYCTYPE yych;
        static const unsigned char yybm[] = {
@@ -1746,15 +1747,15 @@ code:
        }
 yy300:
        ++YYCURSOR;
-#line 372 "../src/ast/lex.re"
+#line 373 "../src/ast/lex.re"
        { fail_if_eof(); goto code; }
-#line 1752 "src/ast/lex.cc"
+#line 1753 "src/ast/lex.cc"
 yy302:
        ++YYCURSOR;
 yy303:
-#line 376 "../src/ast/lex.re"
+#line 377 "../src/ast/lex.re"
        { goto code; }
-#line 1758 "src/ast/lex.cc"
+#line 1759 "src/ast/lex.cc"
 yy304:
        yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR);
        if (yybm[0+yych] & 32) {
@@ -1762,18 +1763,18 @@ yy304:
        }
        if (yych == '#') goto yy317;
 yy305:
-#line 371 "../src/ast/lex.re"
+#line 372 "../src/ast/lex.re"
        { pos = cur; cline++; goto code; }
-#line 1768 "src/ast/lex.cc"
+#line 1769 "src/ast/lex.cc"
 yy306:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '\n') goto yy304;
        goto yy303;
 yy307:
        ++YYCURSOR;
-#line 375 "../src/ast/lex.re"
+#line 376 "../src/ast/lex.re"
        { lex_string(cur[-1]); goto code; }
-#line 1777 "src/ast/lex.cc"
+#line 1778 "src/ast/lex.cc"
 yy309:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '*') goto yy319;
@@ -1781,12 +1782,12 @@ yy309:
        goto yy303;
 yy310:
        ++YYCURSOR;
-#line 369 "../src/ast/lex.re"
+#line 370 "../src/ast/lex.re"
        { ++depth; goto code; }
-#line 1787 "src/ast/lex.cc"
+#line 1788 "src/ast/lex.cc"
 yy312:
        ++YYCURSOR;
-#line 361 "../src/ast/lex.re"
+#line 362 "../src/ast/lex.re"
        {
         if (--depth == 0) {
             yylval.code = new Code(get_fname (), line, tok, tok_len ());
@@ -1794,7 +1795,7 @@ yy312:
         }
         goto code;
     }
-#line 1798 "src/ast/lex.cc"
+#line 1799 "src/ast/lex.cc"
 yy314:
        ++YYCURSOR;
        if (YYLIMIT <= YYCURSOR) YYFILL(1);
@@ -1820,14 +1821,14 @@ yy317:
        }
 yy319:
        ++YYCURSOR;
-#line 373 "../src/ast/lex.re"
+#line 374 "../src/ast/lex.re"
        { lex_c_comment(); goto code; }
-#line 1826 "src/ast/lex.cc"
+#line 1827 "src/ast/lex.cc"
 yy321:
        ++YYCURSOR;
-#line 374 "../src/ast/lex.re"
+#line 375 "../src/ast/lex.re"
        { lex_cpp_comment(); goto code; }
-#line 1831 "src/ast/lex.cc"
+#line 1832 "src/ast/lex.cc"
 yy323:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych != 'i') goto yy316;
@@ -1884,9 +1885,9 @@ yy331:
 yy333:
        ++YYCURSOR;
        YYCURSOR = YYCTXMARKER;
-#line 370 "../src/ast/lex.re"
+#line 371 "../src/ast/lex.re"
        { set_sourceline (); goto code; }
-#line 1890 "src/ast/lex.cc"
+#line 1891 "src/ast/lex.cc"
 yy335:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '\n') goto yy333;
@@ -1912,7 +1913,7 @@ yy339:
        if (yych == '\n') goto yy316;
        goto yy336;
 }
-#line 377 "../src/ast/lex.re"
+#line 378 "../src/ast/lex.re"
 
 }
 
@@ -1920,7 +1921,7 @@ void Scanner::lex_string(char delim)
 {
 loop:
 
-#line 1924 "src/ast/lex.cc"
+#line 1925 "src/ast/lex.cc"
 {
        YYCTYPE yych;
        if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
@@ -1946,29 +1947,29 @@ loop:
        }
 yy342:
        ++YYCURSOR;
-#line 387 "../src/ast/lex.re"
+#line 388 "../src/ast/lex.re"
        { fail_if_eof(); goto loop; }
-#line 1952 "src/ast/lex.cc"
+#line 1953 "src/ast/lex.cc"
 yy344:
        ++YYCURSOR;
 yy345:
-#line 388 "../src/ast/lex.re"
+#line 389 "../src/ast/lex.re"
        { goto loop; }
-#line 1958 "src/ast/lex.cc"
+#line 1959 "src/ast/lex.cc"
 yy346:
        ++YYCURSOR;
-#line 386 "../src/ast/lex.re"
+#line 387 "../src/ast/lex.re"
        { pos = cur; ++cline; goto loop; }
-#line 1963 "src/ast/lex.cc"
+#line 1964 "src/ast/lex.cc"
 yy348:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '\n') goto yy346;
        goto yy345;
 yy349:
        ++YYCURSOR;
-#line 384 "../src/ast/lex.re"
+#line 385 "../src/ast/lex.re"
        { if (cur[-1] == delim) return; else goto loop; }
-#line 1972 "src/ast/lex.cc"
+#line 1973 "src/ast/lex.cc"
 yy351:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych <= '&') {
@@ -1979,11 +1980,11 @@ yy351:
        }
 yy352:
        ++YYCURSOR;
-#line 385 "../src/ast/lex.re"
+#line 386 "../src/ast/lex.re"
        { goto loop; }
-#line 1985 "src/ast/lex.cc"
+#line 1986 "src/ast/lex.cc"
 }
-#line 389 "../src/ast/lex.re"
+#line 390 "../src/ast/lex.re"
 
 }
 
@@ -1991,7 +1992,7 @@ void Scanner::lex_c_comment()
 {
 loop:
 
-#line 1995 "src/ast/lex.cc"
+#line 1996 "src/ast/lex.cc"
 {
        YYCTYPE yych;
        if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
@@ -2007,20 +2008,20 @@ loop:
        }
 yy356:
        ++YYCURSOR;
-#line 398 "../src/ast/lex.re"
+#line 399 "../src/ast/lex.re"
        { fail_if_eof(); goto loop; }
-#line 2013 "src/ast/lex.cc"
+#line 2014 "src/ast/lex.cc"
 yy358:
        ++YYCURSOR;
 yy359:
-#line 399 "../src/ast/lex.re"
+#line 400 "../src/ast/lex.re"
        { goto loop; }
-#line 2019 "src/ast/lex.cc"
+#line 2020 "src/ast/lex.cc"
 yy360:
        ++YYCURSOR;
-#line 397 "../src/ast/lex.re"
+#line 398 "../src/ast/lex.re"
        { pos = cur; ++cline; goto loop; }
-#line 2024 "src/ast/lex.cc"
+#line 2025 "src/ast/lex.cc"
 yy362:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '\n') goto yy360;
@@ -2029,11 +2030,11 @@ yy363:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych != '/') goto yy359;
        ++YYCURSOR;
-#line 396 "../src/ast/lex.re"
+#line 397 "../src/ast/lex.re"
        { return; }
-#line 2035 "src/ast/lex.cc"
+#line 2036 "src/ast/lex.cc"
 }
-#line 400 "../src/ast/lex.re"
+#line 401 "../src/ast/lex.re"
 
 }
 
@@ -2041,7 +2042,7 @@ void Scanner::lex_cpp_comment()
 {
 loop:
 
-#line 2045 "src/ast/lex.cc"
+#line 2046 "src/ast/lex.cc"
 {
        YYCTYPE yych;
        if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
@@ -2056,26 +2057,26 @@ loop:
        }
 yy368:
        ++YYCURSOR;
-#line 408 "../src/ast/lex.re"
+#line 409 "../src/ast/lex.re"
        { fail_if_eof(); goto loop; }
-#line 2062 "src/ast/lex.cc"
+#line 2063 "src/ast/lex.cc"
 yy370:
        ++YYCURSOR;
 yy371:
-#line 409 "../src/ast/lex.re"
+#line 410 "../src/ast/lex.re"
        { goto loop; }
-#line 2068 "src/ast/lex.cc"
+#line 2069 "src/ast/lex.cc"
 yy372:
        ++YYCURSOR;
-#line 407 "../src/ast/lex.re"
+#line 408 "../src/ast/lex.re"
        { pos = cur; ++cline; return; }
-#line 2073 "src/ast/lex.cc"
+#line 2074 "src/ast/lex.cc"
 yy374:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '\n') goto yy372;
        goto yy371;
 }
-#line 410 "../src/ast/lex.re"
+#line 411 "../src/ast/lex.re"
 
 }
 
@@ -2087,35 +2088,35 @@ fst:
     tok = cur;
     c = get_column();
     
-#line 2091 "src/ast/lex.cc"
+#line 2092 "src/ast/lex.cc"
 {
        YYCTYPE yych;
        if (YYLIMIT <= YYCURSOR) YYFILL(1);
        yych = (YYCTYPE)*YYCURSOR;
        if (yych == ']') goto yy378;
-#line 422 "../src/ast/lex.re"
+#line 423 "../src/ast/lex.re"
        { l = lex_cls_chr(); goto snd; }
-#line 2099 "src/ast/lex.cc"
+#line 2100 "src/ast/lex.cc"
 yy378:
        ++YYCURSOR;
-#line 421 "../src/ast/lex.re"
+#line 422 "../src/ast/lex.re"
        { return ast_cls(cline, c0, cls, neg); }
-#line 2104 "src/ast/lex.cc"
+#line 2105 "src/ast/lex.cc"
 }
-#line 423 "../src/ast/lex.re"
+#line 424 "../src/ast/lex.re"
 
 snd:
     
-#line 2110 "src/ast/lex.cc"
+#line 2111 "src/ast/lex.cc"
 {
        YYCTYPE yych;
        if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
        yych = (YYCTYPE)*(YYMARKER = YYCURSOR);
        if (yych == '-') goto yy383;
 yy382:
-#line 426 "../src/ast/lex.re"
+#line 427 "../src/ast/lex.re"
        { u = l; goto add; }
-#line 2119 "src/ast/lex.cc"
+#line 2120 "src/ast/lex.cc"
 yy383:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych != ']') goto yy385;
@@ -2124,7 +2125,7 @@ yy383:
 yy385:
        ++YYCURSOR;
        YYCURSOR -= 1;
-#line 427 "../src/ast/lex.re"
+#line 428 "../src/ast/lex.re"
        {
             u = lex_cls_chr();
             if (l > u) {
@@ -2133,9 +2134,9 @@ yy385:
             }
             goto add;
         }
-#line 2137 "src/ast/lex.cc"
+#line 2138 "src/ast/lex.cc"
 }
-#line 435 "../src/ast/lex.re"
+#line 436 "../src/ast/lex.re"
 
 add:
     cls->push_back(ASTRange(l, u, c));
@@ -2147,7 +2148,7 @@ uint32_t Scanner::lex_cls_chr()
     tok = cur;
     const uint32_t l = get_cline(), c = get_column();
     
-#line 2151 "src/ast/lex.cc"
+#line 2152 "src/ast/lex.cc"
 {
        YYCTYPE yych;
        unsigned int yyaccept = 0;
@@ -2164,20 +2165,20 @@ uint32_t Scanner::lex_cls_chr()
        }
 yy389:
        ++YYCURSOR;
-#line 447 "../src/ast/lex.re"
+#line 448 "../src/ast/lex.re"
        { fail_if_eof(); return 0; }
-#line 2170 "src/ast/lex.cc"
+#line 2171 "src/ast/lex.cc"
 yy391:
        ++YYCURSOR;
 yy392:
-#line 453 "../src/ast/lex.re"
+#line 454 "../src/ast/lex.re"
        { return static_cast<uint8_t>(tok[0]); }
-#line 2176 "src/ast/lex.cc"
+#line 2177 "src/ast/lex.cc"
 yy393:
        ++YYCURSOR;
-#line 448 "../src/ast/lex.re"
+#line 449 "../src/ast/lex.re"
        { fatal_lc(l, c, "newline in character class"); }
-#line 2181 "src/ast/lex.cc"
+#line 2182 "src/ast/lex.cc"
 yy395:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '\n') goto yy393;
@@ -2236,36 +2237,36 @@ yy396:
                }
        }
 yy397:
-#line 451 "../src/ast/lex.re"
+#line 452 "../src/ast/lex.re"
        { fatal_lc(l, c, "syntax error in escape sequence"); }
-#line 2242 "src/ast/lex.cc"
+#line 2243 "src/ast/lex.cc"
 yy398:
        ++YYCURSOR;
 yy399:
-#line 466 "../src/ast/lex.re"
+#line 467 "../src/ast/lex.re"
        {
             warn.useless_escape(cline, get_column(), tok[1]);
             return static_cast<uint8_t>(tok[1]);
         }
-#line 2251 "src/ast/lex.cc"
+#line 2252 "src/ast/lex.cc"
 yy400:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '\n') goto yy393;
        goto yy399;
 yy401:
        ++YYCURSOR;
-#line 464 "../src/ast/lex.re"
+#line 465 "../src/ast/lex.re"
        { return static_cast<uint8_t>('-'); }
-#line 2260 "src/ast/lex.cc"
+#line 2261 "src/ast/lex.cc"
 yy403:
        yyaccept = 0;
        yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR);
        if (yych <= '/') goto yy404;
        if (yych <= '7') goto yy428;
 yy404:
-#line 450 "../src/ast/lex.re"
+#line 451 "../src/ast/lex.re"
        { fatal_lc(l, c, "syntax error in octal escape sequence"); }
-#line 2269 "src/ast/lex.cc"
+#line 2270 "src/ast/lex.cc"
 yy405:
        ++YYCURSOR;
        goto yy404;
@@ -2281,9 +2282,9 @@ yy406:
                if (yych <= 'f') goto yy430;
        }
 yy407:
-#line 449 "../src/ast/lex.re"
+#line 450 "../src/ast/lex.re"
        { fatal_lc(l, c, "syntax error in hexadecimal escape sequence"); }
-#line 2287 "src/ast/lex.cc"
+#line 2288 "src/ast/lex.cc"
 yy408:
        yyaccept = 1;
        yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR);
@@ -2299,49 +2300,49 @@ yy408:
        }
 yy409:
        ++YYCURSOR;
-#line 463 "../src/ast/lex.re"
+#line 464 "../src/ast/lex.re"
        { return static_cast<uint8_t>('\\'); }
-#line 2305 "src/ast/lex.cc"
+#line 2306 "src/ast/lex.cc"
 yy411:
        ++YYCURSOR;
-#line 465 "../src/ast/lex.re"
+#line 466 "../src/ast/lex.re"
        { return static_cast<uint8_t>(']'); }
-#line 2310 "src/ast/lex.cc"
+#line 2311 "src/ast/lex.cc"
 yy413:
        ++YYCURSOR;
-#line 456 "../src/ast/lex.re"
+#line 457 "../src/ast/lex.re"
        { return static_cast<uint8_t>('\a'); }
-#line 2315 "src/ast/lex.cc"
+#line 2316 "src/ast/lex.cc"
 yy415:
        ++YYCURSOR;
-#line 457 "../src/ast/lex.re"
+#line 458 "../src/ast/lex.re"
        { return static_cast<uint8_t>('\b'); }
-#line 2320 "src/ast/lex.cc"
+#line 2321 "src/ast/lex.cc"
 yy417:
        ++YYCURSOR;
-#line 458 "../src/ast/lex.re"
+#line 459 "../src/ast/lex.re"
        { return static_cast<uint8_t>('\f'); }
-#line 2325 "src/ast/lex.cc"
+#line 2326 "src/ast/lex.cc"
 yy419:
        ++YYCURSOR;
-#line 459 "../src/ast/lex.re"
+#line 460 "../src/ast/lex.re"
        { return static_cast<uint8_t>('\n'); }
-#line 2330 "src/ast/lex.cc"
+#line 2331 "src/ast/lex.cc"
 yy421:
        ++YYCURSOR;
-#line 460 "../src/ast/lex.re"
+#line 461 "../src/ast/lex.re"
        { return static_cast<uint8_t>('\r'); }
-#line 2335 "src/ast/lex.cc"
+#line 2336 "src/ast/lex.cc"
 yy423:
        ++YYCURSOR;
-#line 461 "../src/ast/lex.re"
+#line 462 "../src/ast/lex.re"
        { return static_cast<uint8_t>('\t'); }
-#line 2340 "src/ast/lex.cc"
+#line 2341 "src/ast/lex.cc"
 yy425:
        ++YYCURSOR;
-#line 462 "../src/ast/lex.re"
+#line 463 "../src/ast/lex.re"
        { return static_cast<uint8_t>('\v'); }
-#line 2345 "src/ast/lex.cc"
+#line 2346 "src/ast/lex.cc"
 yy427:
        yyaccept = 1;
        yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR);
@@ -2404,9 +2405,9 @@ yy432:
        }
 yy433:
        ++YYCURSOR;
-#line 455 "../src/ast/lex.re"
+#line 456 "../src/ast/lex.re"
        { return unesc_oct(tok, cur); }
-#line 2410 "src/ast/lex.cc"
+#line 2411 "src/ast/lex.cc"
 yy435:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych <= '@') {
@@ -2433,9 +2434,9 @@ yy436:
        }
 yy437:
        ++YYCURSOR;
-#line 454 "../src/ast/lex.re"
+#line 455 "../src/ast/lex.re"
        { return unesc_hex(tok, cur); }
-#line 2439 "src/ast/lex.cc"
+#line 2440 "src/ast/lex.cc"
 yy439:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych <= '@') {
@@ -2459,7 +2460,7 @@ yy440:
                goto yy429;
        }
 }
-#line 470 "../src/ast/lex.re"
+#line 471 "../src/ast/lex.re"
 
 }
 
@@ -2469,7 +2470,7 @@ uint32_t Scanner::lex_str_chr(char quote, bool &end)
     tok = cur;
     const uint32_t l = get_cline(), c = get_column();
     
-#line 2473 "src/ast/lex.cc"
+#line 2474 "src/ast/lex.cc"
 {
        YYCTYPE yych;
        unsigned int yyaccept = 0;
@@ -2486,23 +2487,23 @@ uint32_t Scanner::lex_str_chr(char quote, bool &end)
        }
 yy443:
        ++YYCURSOR;
-#line 480 "../src/ast/lex.re"
+#line 481 "../src/ast/lex.re"
        { fail_if_eof(); return 0; }
-#line 2492 "src/ast/lex.cc"
+#line 2493 "src/ast/lex.cc"
 yy445:
        ++YYCURSOR;
 yy446:
-#line 486 "../src/ast/lex.re"
+#line 487 "../src/ast/lex.re"
        {
             end = tok[0] == quote;
             return static_cast<uint8_t>(tok[0]);
         }
-#line 2501 "src/ast/lex.cc"
+#line 2502 "src/ast/lex.cc"
 yy447:
        ++YYCURSOR;
-#line 481 "../src/ast/lex.re"
+#line 482 "../src/ast/lex.re"
        { fatal_lc(l, c, "newline in character string"); }
-#line 2506 "src/ast/lex.cc"
+#line 2507 "src/ast/lex.cc"
 yy449:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '\n') goto yy447;
@@ -2556,20 +2557,20 @@ yy450:
                }
        }
 yy451:
-#line 484 "../src/ast/lex.re"
+#line 485 "../src/ast/lex.re"
        { fatal_lc(l, c, "syntax error in escape sequence"); }
-#line 2562 "src/ast/lex.cc"
+#line 2563 "src/ast/lex.cc"
 yy452:
        ++YYCURSOR;
 yy453:
-#line 500 "../src/ast/lex.re"
+#line 501 "../src/ast/lex.re"
        {
             if (tok[1] != quote) {
                 warn.useless_escape(cline, get_column(), tok[1]);
             }
             return static_cast<uint8_t>(tok[1]);
         }
-#line 2573 "src/ast/lex.cc"
+#line 2574 "src/ast/lex.cc"
 yy454:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '\n') goto yy447;
@@ -2580,9 +2581,9 @@ yy455:
        if (yych <= '/') goto yy456;
        if (yych <= '7') goto yy478;
 yy456:
-#line 483 "../src/ast/lex.re"
+#line 484 "../src/ast/lex.re"
        { fatal_lc(l, c, "syntax error in octal escape sequence"); }
-#line 2586 "src/ast/lex.cc"
+#line 2587 "src/ast/lex.cc"
 yy457:
        ++YYCURSOR;
        goto yy456;
@@ -2598,9 +2599,9 @@ yy458:
                if (yych <= 'f') goto yy480;
        }
 yy459:
-#line 482 "../src/ast/lex.re"
+#line 483 "../src/ast/lex.re"
        { fatal_lc(l, c, "syntax error in hexadecimal escape sequence"); }
-#line 2604 "src/ast/lex.cc"
+#line 2605 "src/ast/lex.cc"
 yy460:
        yyaccept = 1;
        yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR);
@@ -2616,44 +2617,44 @@ yy460:
        }
 yy461:
        ++YYCURSOR;
-#line 499 "../src/ast/lex.re"
+#line 500 "../src/ast/lex.re"
        { return static_cast<uint8_t>('\\'); }
-#line 2622 "src/ast/lex.cc"
+#line 2623 "src/ast/lex.cc"
 yy463:
        ++YYCURSOR;
-#line 492 "../src/ast/lex.re"
+#line 493 "../src/ast/lex.re"
        { return static_cast<uint8_t>('\a'); }
-#line 2627 "src/ast/lex.cc"
+#line 2628 "src/ast/lex.cc"
 yy465:
        ++YYCURSOR;
-#line 493 "../src/ast/lex.re"
+#line 494 "../src/ast/lex.re"
        { return static_cast<uint8_t>('\b'); }
-#line 2632 "src/ast/lex.cc"
+#line 2633 "src/ast/lex.cc"
 yy467:
        ++YYCURSOR;
-#line 494 "../src/ast/lex.re"
+#line 495 "../src/ast/lex.re"
        { return static_cast<uint8_t>('\f'); }
-#line 2637 "src/ast/lex.cc"
+#line 2638 "src/ast/lex.cc"
 yy469:
        ++YYCURSOR;
-#line 495 "../src/ast/lex.re"
+#line 496 "../src/ast/lex.re"
        { return static_cast<uint8_t>('\n'); }
-#line 2642 "src/ast/lex.cc"
+#line 2643 "src/ast/lex.cc"
 yy471:
        ++YYCURSOR;
-#line 496 "../src/ast/lex.re"
+#line 497 "../src/ast/lex.re"
        { return static_cast<uint8_t>('\r'); }
-#line 2647 "src/ast/lex.cc"
+#line 2648 "src/ast/lex.cc"
 yy473:
        ++YYCURSOR;
-#line 497 "../src/ast/lex.re"
+#line 498 "../src/ast/lex.re"
        { return static_cast<uint8_t>('\t'); }
-#line 2652 "src/ast/lex.cc"
+#line 2653 "src/ast/lex.cc"
 yy475:
        ++YYCURSOR;
-#line 498 "../src/ast/lex.re"
+#line 499 "../src/ast/lex.re"
        { return static_cast<uint8_t>('\v'); }
-#line 2657 "src/ast/lex.cc"
+#line 2658 "src/ast/lex.cc"
 yy477:
        yyaccept = 1;
        yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR);
@@ -2716,9 +2717,9 @@ yy482:
        }
 yy483:
        ++YYCURSOR;
-#line 491 "../src/ast/lex.re"
+#line 492 "../src/ast/lex.re"
        { return unesc_oct(tok, cur); }
-#line 2722 "src/ast/lex.cc"
+#line 2723 "src/ast/lex.cc"
 yy485:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych <= '@') {
@@ -2745,9 +2746,9 @@ yy486:
        }
 yy487:
        ++YYCURSOR;
-#line 490 "../src/ast/lex.re"
+#line 491 "../src/ast/lex.re"
        { return unesc_hex(tok, cur); }
-#line 2751 "src/ast/lex.cc"
+#line 2752 "src/ast/lex.cc"
 yy489:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych <= '@') {
@@ -2771,7 +2772,7 @@ yy490:
                goto yy479;
        }
 }
-#line 506 "../src/ast/lex.re"
+#line 507 "../src/ast/lex.re"
 
 }
 
@@ -2791,7 +2792,7 @@ void Scanner::set_sourceline ()
 sourceline:
     tok = cur;
 
-#line 2795 "src/ast/lex.cc"
+#line 2796 "src/ast/lex.cc"
 {
        YYCTYPE yych;
        static const unsigned char yybm[] = {
@@ -2849,27 +2850,27 @@ sourceline:
                }
        }
        ++YYCURSOR;
-#line 543 "../src/ast/lex.re"
+#line 544 "../src/ast/lex.re"
        {
         --cur;
         tok = cur;
         return;
     }
-#line 2859 "src/ast/lex.cc"
+#line 2860 "src/ast/lex.cc"
 yy495:
        ++YYCURSOR;
 yy496:
-#line 549 "../src/ast/lex.re"
+#line 550 "../src/ast/lex.re"
        { goto sourceline; }
-#line 2865 "src/ast/lex.cc"
+#line 2866 "src/ast/lex.cc"
 yy497:
        ++YYCURSOR;
-#line 538 "../src/ast/lex.re"
+#line 539 "../src/ast/lex.re"
        {
         tok = cur;
         return;
     }
-#line 2873 "src/ast/lex.cc"
+#line 2874 "src/ast/lex.cc"
 yy499:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '\n') goto yy497;
@@ -2886,14 +2887,14 @@ yy501:
        if (yybm[0+yych] & 64) {
                goto yy501;
        }
-#line 525 "../src/ast/lex.re"
+#line 526 "../src/ast/lex.re"
        {
         if (!s_to_u32_unsafe (tok, cur, cline)) {
             fatal_lc(get_cline(), get_column(), "line number overflow");
         }
         goto sourceline;
     }
-#line 2897 "src/ast/lex.cc"
+#line 2898 "src/ast/lex.cc"
 yy504:
        ++YYCURSOR;
        if (YYLIMIT <= YYCURSOR) YYFILL(1);
@@ -2910,13 +2911,13 @@ yy506:
        goto yy496;
 yy507:
        ++YYCURSOR;
-#line 532 "../src/ast/lex.re"
+#line 533 "../src/ast/lex.re"
        {
         in.escaped_file_name = std::string (tok + 1, tok_len () - 2); // strip quotes
         strrreplace (in.escaped_file_name, "\\", "\\\\");
         goto sourceline;
     }
-#line 2920 "src/ast/lex.cc"
+#line 2921 "src/ast/lex.cc"
 yy509:
        ++YYCURSOR;
        if (YYLIMIT <= YYCURSOR) YYFILL(1);
@@ -2925,7 +2926,7 @@ yy509:
        if (yych == '\n') goto yy506;
        goto yy504;
 }
-#line 550 "../src/ast/lex.re"
+#line 551 "../src/ast/lex.re"
 
 }
 
index de9b5c88da67a8a256c287a133b3cacf1b60df01..7dea1db0cd18a1e4e913ca8a095975cb147ef1b7 100644 (file)
@@ -200,8 +200,8 @@ scan:
     tchar = cur - pos;
     tok = cur;
 /*!re2c
-    "{"        { lex_code_multiline(); return TOKEN_CODE; }
-    ":="       { tok += 2; lex_code_oneline(); return TOKEN_CODE; }
+    "{"        { lex_code_in_braces(); return TOKEN_CODE; }
+    ":="       { lex_code_indented(); return TOKEN_CODE; }
     ":" / "=>" { return *tok; }
 
     "//" { lex_cpp_comment(); goto scan; }
@@ -330,15 +330,16 @@ scan:
 */
 }
 
-void Scanner::lex_code_oneline()
+void Scanner::lex_code_indented()
 {
     const uint32_t line = cline;
+    tok = cur;
 code:
 /*!re2c
     eol / ws { goto code; }
     eol {
-        tok += strspn(tok, " \t\r\n");
-        while (cur > tok && strchr(" \t\r\n", cur[-1])) --cur;
+        while (isspace(tok[0])) ++tok;
+        while (cur > tok && isspace(cur[-1])) --cur;
         yylval.code = new Code(get_fname (), line, tok, tok_len ());
         return;
     }
@@ -352,7 +353,7 @@ code:
 */
 }
 
-void Scanner::lex_code_multiline()
+void Scanner::lex_code_in_braces()
 {
     const uint32_t line = cline;
     uint32_t depth = 1;
index 1b30c0c9c6666c7821b9de0a4a12e0a9d68b14b4..3e81f8e8ca365853bdafb50174b075901e7334fb 100644 (file)
@@ -62,8 +62,8 @@ class Scanner: private ScannerState
 
     void fill(uint32_t need);
     void lex_end_of_comment(OutputFile &out);
-    void lex_code_oneline();
-    void lex_code_multiline();
+    void lex_code_indented();
+    void lex_code_in_braces();
     void lex_c_comment();
     void lex_cpp_comment();
     void lex_string(char delim);