]> granicus.if.org Git - re2c/commitdiff
Lexer: glued together two variables with almost identical functionality.
authorUlya Trofimovich <skvadrik@gmail.com>
Wed, 12 Aug 2015 16:39:21 +0000 (17:39 +0100)
committerUlya Trofimovich <skvadrik@gmail.com>
Wed, 12 Aug 2015 17:42:17 +0000 (18:42 +0100)
These two variables ('ScannerState' class member 'cur' and local variable
'cursor') both played the role of YYCURSOR: YYCURSOR was defined to
'cursor', but the code had to adjust 'cur' to 'cursor' on every return
and restore it when reentering lexing procedures.

There was only two obscure places in which they were not completely
syncronized. Both looked the same:

    cur = ptr > tok ? ptr - 1 : cursor;

However, 'ptr' is effectively YYMARKER and is never changed manually
by lexing procedures; 'tok' should point to the beginning of current
lexeme; this check doesn't make sense to me. This is an attempt to
resume lexing one character before YYMARKER, but what for? YYMARKER
isn't even used in Scanner::scan (look at the the generated code),
so 'ptr > tok' is always false.

This check is present since the initial commit, so I cannot trace back
it's origin.

As it doesn't break any tests I hereby simply remove it.

re2c/bootstrap/src/parse/scanner_lex.cc
re2c/src/parse/scanner.cc
re2c/src/parse/scanner.h
re2c/src/parse/scanner_lex.re

index 3fa7a10efe6cd6d21e17ca5a49d77d6ac6f8b766..82461e68df00b2f20afa3ee8444e7a0b022ebe9f 100644 (file)
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.14.3 on Tue Aug 11 14:37:44 2015 */
+/* Generated by re2c 0.14.3 on Wed Aug 12 17:25:10 2015 */
 #line 1 "../src/parse/scanner_lex.re"
 #include <stdlib.h>
 #include <string.h>
@@ -19,13 +19,13 @@ extern YYSTYPE yylval;
 #endif
 
 #define        YYCTYPE         unsigned char
-#define        YYCURSOR        cursor
+#define        YYCURSOR        cur
 #define        YYLIMIT         lim
 #define        YYMARKER        ptr
 #define        YYCTXMARKER ctx
-#define        YYFILL(n)       {cursor = fill(cursor, n);}
+#define        YYFILL(n)       { fill (n); }
 
-#define        RETURN(i)       {cur = cursor; return i;}
+#define        RETURN(i)       { return i; }
 
 namespace re2c
 {
@@ -41,19 +41,18 @@ namespace re2c
 
 Scanner::ParseMode Scanner::echo()
 {
-       char *cursor = cur;
        bool ignore_eoc = false;
        int  ignore_cnt = 0;
 
-       if (eof && cursor == eof) // Catch EOF
+       if (eof && cur == eof) // Catch EOF
        {
                return Stop;
        }
 
-       tok = cursor;
+       tok = cur;
 echo:
 
-#line 57 "src/parse/scanner_lex.cc"
+#line 56 "src/parse/scanner_lex.cc"
 {
        YYCTYPE yych;
        unsigned int yyaccept = 0;
@@ -112,27 +111,27 @@ echo:
                }
        }
        ++YYCURSOR;
-#line 198 "../src/parse/scanner_lex.re"
+#line 197 "../src/parse/scanner_lex.re"
        {
                                        if (!(ignore_eoc || DFlag || flag_skeleton))
                                        {
-                                               out.write((const char*)(tok), (const char*)(cursor) - (const char*)(tok) - 1);
+                                               out.write((const char*)(tok), (const char*)(cur) - (const char*)(tok) - 1);
                                                // -1 so we don't write out the \0
                                        }
-                                       if(cursor == eof)
+                                       if(cur == eof)
                                        {
                                                RETURN(Stop);
                                        }
                                }
-#line 128 "src/parse/scanner_lex.cc"
+#line 127 "src/parse/scanner_lex.cc"
 yy4:
        ++YYCURSOR;
 yy5:
-#line 209 "../src/parse/scanner_lex.re"
+#line 208 "../src/parse/scanner_lex.re"
        {
                                        goto echo;
                                }
-#line 136 "src/parse/scanner_lex.cc"
+#line 135 "src/parse/scanner_lex.cc"
 yy6:
        yyaccept = 0;
        yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR);
@@ -141,7 +140,7 @@ yy6:
        }
        if (yych == '#') goto yy91;
 yy7:
-#line 185 "../src/parse/scanner_lex.re"
+#line 184 "../src/parse/scanner_lex.re"
        {
                                        if (ignore_eoc)
                                        {
@@ -149,13 +148,13 @@ yy7:
                                        }
                                        else if (!(DFlag || flag_skeleton))
                                        {
-                                               out.write((const char*)(tok), (const char*)(cursor) - (const char*)(tok));
+                                               out.write((const char*)(tok), (const char*)(cur) - (const char*)(tok));
                                        }
-                                       tok = pos = cursor;
+                                       tok = pos = cur;
                                        cline++;
                                        goto echo;
                                }
-#line 159 "src/parse/scanner_lex.cc"
+#line 158 "src/parse/scanner_lex.cc"
 yy8:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '{') goto yy32;
@@ -239,7 +238,7 @@ yy21:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych != 'c') goto yy12;
        ++YYCURSOR;
-#line 87 "../src/parse/scanner_lex.re"
+#line 86 "../src/parse/scanner_lex.re"
        {
                                        if (rFlag)
                                        {
@@ -249,16 +248,16 @@ yy21:
                                        {
                                                fatal("found 'rules:re2c' block without -r flag");
                                        }
-                                       tok = cursor;
+                                       tok = cur;
                                        RETURN(Rules);
                                }
-#line 256 "src/parse/scanner_lex.cc"
+#line 255 "src/parse/scanner_lex.cc"
 yy31:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych != 'c') goto yy12;
 yy32:
        ++YYCURSOR;
-#line 75 "../src/parse/scanner_lex.re"
+#line 74 "../src/parse/scanner_lex.re"
        {
                                        if (rFlag)
                                        {
@@ -266,12 +265,12 @@ yy32:
                                        }
                                        if (!(DFlag || flag_skeleton))
                                        {
-                                               out.write((const char*)(tok), (const char*)(&cursor[-7]) - (const char*)(tok));
+                                               out.write((const char*)(tok), (const char*)(&cur[-7]) - (const char*)(tok));
                                        }
-                                       tok = cursor;
+                                       tok = cur;
                                        RETURN(Parse);
                                }
-#line 275 "src/parse/scanner_lex.cc"
+#line 274 "src/parse/scanner_lex.cc"
 yy34:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych != 'e') goto yy12;
@@ -286,7 +285,7 @@ yy34:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych != 'c') goto yy12;
        ++YYCURSOR;
-#line 99 "../src/parse/scanner_lex.re"
+#line 98 "../src/parse/scanner_lex.re"
        {
                                        if (!rFlag)
                                        {
@@ -295,12 +294,12 @@ yy34:
                                        reuse();
                                        if (!(DFlag || flag_skeleton))
                                        {
-                                               out.write((const char*)(tok), (const char*)(&cursor[-11]) - (const char*)(tok));
+                                               out.write((const char*)(tok), (const char*)(&cur[-11]) - (const char*)(tok));
                                        }
-                                       tok = cursor;
+                                       tok = cur;
                                        RETURN(Reuse);
                                }
-#line 304 "src/parse/scanner_lex.cc"
+#line 303 "src/parse/scanner_lex.cc"
 yy42:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych != 'x') goto yy12;
@@ -315,17 +314,17 @@ yy42:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych != 'c') goto yy12;
        ++YYCURSOR;
-#line 112 "../src/parse/scanner_lex.re"
+#line 111 "../src/parse/scanner_lex.re"
        {
                                        if (!DFlag)
                                        {
                                                out.insert_yymaxfill ();
                                        }
-                                       tok = pos = cursor;
+                                       tok = pos = cur;
                                        ignore_eoc = true;
                                        goto echo;
                                }
-#line 329 "src/parse/scanner_lex.cc"
+#line 328 "src/parse/scanner_lex.cc"
 yy50:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych != 't') goto yy12;
@@ -350,14 +349,14 @@ yy50:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych != 'c') goto yy12;
        ++YYCURSOR;
-#line 121 "../src/parse/scanner_lex.re"
+#line 120 "../src/parse/scanner_lex.re"
        {
-                                       tok = pos = cursor;
+                                       tok = pos = cur;
                                        out.insert_state_goto (topIndent);
                                        ignore_eoc = true;
                                        goto echo;
                                }
-#line 361 "src/parse/scanner_lex.cc"
+#line 360 "src/parse/scanner_lex.cc"
 yy63:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych != 'n') goto yy12;
@@ -378,13 +377,13 @@ yy63:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych != 'c') goto yy12;
        ++YYCURSOR;
-#line 127 "../src/parse/scanner_lex.re"
+#line 126 "../src/parse/scanner_lex.re"
        {
-                                       tok = pos = cursor;
+                                       tok = pos = cur;
                                        ignore_eoc = true;
                                        goto echo;
                                }
-#line 388 "src/parse/scanner_lex.cc"
+#line 387 "src/parse/scanner_lex.cc"
 yy74:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych != 'p') goto yy12;
@@ -403,9 +402,9 @@ yy74:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych != 'c') goto yy12;
        ++YYCURSOR;
-#line 132 "../src/parse/scanner_lex.re"
+#line 131 "../src/parse/scanner_lex.re"
        {
-                                       tok = pos = cursor;
+                                       tok = pos = cur;
                                        ignore_eoc = true;
                                        if (!DFlag)
                                        {
@@ -417,14 +416,14 @@ yy74:
                                        }
                                        goto echo;
                                }
-#line 421 "src/parse/scanner_lex.cc"
+#line 420 "src/parse/scanner_lex.cc"
 yy84:
        yyaccept = 2;
        yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR);
        if (yych == '\n') goto yy87;
        if (yych == '\r') goto yy86;
 yy85:
-#line 163 "../src/parse/scanner_lex.re"
+#line 162 "../src/parse/scanner_lex.re"
        {
                                        if (ignore_eoc)
                                        {
@@ -438,18 +437,18 @@ yy85:
                                        }
                                        else if (!(DFlag || flag_skeleton))
                                        {
-                                               out.write((const char*)(tok), (const char*)(cursor) - (const char*)(tok));
+                                               out.write((const char*)(tok), (const char*)(cur) - (const char*)(tok));
                                        }
-                                       tok = pos = cursor;
+                                       tok = pos = cur;
                                        goto echo;
                                }
-#line 447 "src/parse/scanner_lex.cc"
+#line 446 "src/parse/scanner_lex.cc"
 yy86:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych != '\n') goto yy12;
 yy87:
        ++YYCURSOR;
-#line 145 "../src/parse/scanner_lex.re"
+#line 144 "../src/parse/scanner_lex.re"
        {
                                        cline++;
                                        if (ignore_eoc)
@@ -463,12 +462,12 @@ yy87:
                                        }
                                        else if (!(DFlag || flag_skeleton))
                                        {
-                                               out.write((const char*)(tok), (const char*)(cursor) - (const char*)(tok));
+                                               out.write((const char*)(tok), (const char*)(cur) - (const char*)(tok));
                                        }
-                                       tok = pos = cursor;
+                                       tok = pos = cur;
                                        goto echo;
                                }
-#line 472 "src/parse/scanner_lex.cc"
+#line 471 "src/parse/scanner_lex.cc"
 yy89:
        ++YYCURSOR;
        if (YYLIMIT <= YYCURSOR) YYFILL(1);
@@ -543,12 +542,12 @@ yy101:
 yy103:
        ++YYCURSOR;
        YYCURSOR = YYCTXMARKER;
-#line 181 "../src/parse/scanner_lex.re"
+#line 180 "../src/parse/scanner_lex.re"
        {
-                                       set_sourceline(cursor);
+                                       set_sourceline ();
                                        goto echo;
                                }
-#line 552 "src/parse/scanner_lex.cc"
+#line 551 "src/parse/scanner_lex.cc"
 yy105:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '\n') goto yy103;
@@ -573,19 +572,18 @@ yy109:
        if (yych == '\r') goto yy105;
        goto yy12;
 }
-#line 212 "../src/parse/scanner_lex.re"
+#line 211 "../src/parse/scanner_lex.re"
 
 }
 
 int Scanner::scan()
 {
-       char *cursor = cur;
        uint32_t depth;
 
 scan:
-       tchar = cursor - pos;
+       tchar = cur - pos;
        tline = cline;
-       tok = cursor;
+       tok = cur;
        switch (lexer_state)
        {
                case LEX_NORMAL:       goto start;
@@ -596,7 +594,7 @@ scan:
 
 start:
 
-#line 600 "src/parse/scanner_lex.cc"
+#line 598 "src/parse/scanner_lex.cc"
 {
        YYCTYPE yych;
        unsigned int yyaccept = 0;
@@ -711,22 +709,22 @@ start:
 yy112:
        ++YYCURSOR;
 yy113:
-#line 443 "../src/parse/scanner_lex.re"
+#line 429 "../src/parse/scanner_lex.re"
        {
                                        fatalf("unexpected character: '%c'", *tok);
                                        goto scan;
                                }
-#line 720 "src/parse/scanner_lex.cc"
+#line 718 "src/parse/scanner_lex.cc"
 yy114:
        ++YYCURSOR;
        yych = (YYCTYPE)*YYCURSOR;
        goto yy248;
 yy115:
-#line 427 "../src/parse/scanner_lex.re"
+#line 413 "../src/parse/scanner_lex.re"
        {
                                        goto scan;
                                }
-#line 730 "src/parse/scanner_lex.cc"
+#line 728 "src/parse/scanner_lex.cc"
 yy116:
        yyaccept = 0;
        yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR);
@@ -737,14 +735,14 @@ yy116:
                if (yych == '#') goto yy228;
        }
 yy117:
-#line 436 "../src/parse/scanner_lex.re"
+#line 422 "../src/parse/scanner_lex.re"
        {
-                                       if (cursor == eof) RETURN(0);
-                                       pos = cursor;
+                                       if (cur == eof) RETURN(0);
+                                       pos = cur;
                                        cline++;
                                        goto scan;
                                }
-#line 748 "src/parse/scanner_lex.cc"
+#line 746 "src/parse/scanner_lex.cc"
 yy118:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '\n') goto yy225;
@@ -754,11 +752,11 @@ yy119:
        yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR);
        if (yych != '\n') goto yy221;
 yy120:
-#line 292 "../src/parse/scanner_lex.re"
+#line 287 "../src/parse/scanner_lex.re"
        {
                                        fatal("unterminated string constant (missing \")");
                                }
-#line 762 "src/parse/scanner_lex.cc"
+#line 760 "src/parse/scanner_lex.cc"
 yy121:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '}') goto yy213;
@@ -768,45 +766,44 @@ yy122:
        yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR);
        if (yych != '\n') goto yy216;
 yy123:
-#line 295 "../src/parse/scanner_lex.re"
+#line 290 "../src/parse/scanner_lex.re"
        {
                                        fatal("unterminated string constant (missing ')");
                                }
-#line 776 "src/parse/scanner_lex.cc"
+#line 774 "src/parse/scanner_lex.cc"
 yy124:
        ++YYCURSOR;
 yy125:
-#line 323 "../src/parse/scanner_lex.re"
+#line 316 "../src/parse/scanner_lex.re"
        {
                                        RETURN(*tok);
                                }
-#line 784 "src/parse/scanner_lex.cc"
+#line 782 "src/parse/scanner_lex.cc"
 yy126:
        ++YYCURSOR;
        if ((yych = (YYCTYPE)*YYCURSOR) == '/') goto yy213;
-#line 327 "../src/parse/scanner_lex.re"
+#line 320 "../src/parse/scanner_lex.re"
        {
                                        yylval.op = *tok;
                                        RETURN(STAR);
                                }
-#line 793 "src/parse/scanner_lex.cc"
+#line 791 "src/parse/scanner_lex.cc"
 yy128:
        ++YYCURSOR;
-#line 331 "../src/parse/scanner_lex.re"
+#line 324 "../src/parse/scanner_lex.re"
        {
                                        yylval.op = *tok;
                                        RETURN(CLOSE);
                                }
-#line 801 "src/parse/scanner_lex.cc"
+#line 799 "src/parse/scanner_lex.cc"
 yy130:
        ++YYCURSOR;
-#line 421 "../src/parse/scanner_lex.re"
+#line 408 "../src/parse/scanner_lex.re"
        {
-                                       cur = cursor;
                                        yylval.regexp = mkDot();
                                        return RANGE;
                                }
-#line 810 "src/parse/scanner_lex.cc"
+#line 807 "src/parse/scanner_lex.cc"
 yy132:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '*') goto yy209;
@@ -834,11 +831,11 @@ yy136:
        if (yych == '^') goto yy188;
        goto yy187;
 yy137:
-#line 313 "../src/parse/scanner_lex.re"
+#line 306 "../src/parse/scanner_lex.re"
        {
                                        fatal("unterminated range (missing ])");
                                }
-#line 842 "src/parse/scanner_lex.cc"
+#line 839 "src/parse/scanner_lex.cc"
 yy138:
        YYCTXMARKER = YYCURSOR + 1;
        yych = (YYCTYPE)*++YYCURSOR;
@@ -864,12 +861,12 @@ yy139:
                }
        }
 yy140:
-#line 234 "../src/parse/scanner_lex.re"
+#line 232 "../src/parse/scanner_lex.re"
        {
                                        depth = 1;
                                        goto code;
                                }
-#line 873 "src/parse/scanner_lex.cc"
+#line 870 "src/parse/scanner_lex.cc"
 yy141:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == ',') goto yy160;
@@ -941,32 +938,31 @@ yy145:
 yy147:
        ++YYCURSOR;
 yy148:
-#line 359 "../src/parse/scanner_lex.re"
+#line 352 "../src/parse/scanner_lex.re"
        {
                                        fatal("illegal closure form, use '{n}', '{n,}', '{n,m}' where n and m are numbers");
                                }
-#line 949 "src/parse/scanner_lex.cc"
+#line 946 "src/parse/scanner_lex.cc"
 yy149:
        ++YYCURSOR;
-#line 363 "../src/parse/scanner_lex.re"
+#line 356 "../src/parse/scanner_lex.re"
        {
                                        if (!FFlag) {
                                                fatal("curly braces for names only allowed with -F switch");
                                        }
-                                       cur = cursor;
                                        yylval.str = new std::string (tok + 1, cur - tok - 2);
                                        return ID;
                                }
-#line 961 "src/parse/scanner_lex.cc"
+#line 957 "src/parse/scanner_lex.cc"
 yy151:
        ++YYCURSOR;
-#line 341 "../src/parse/scanner_lex.re"
+#line 334 "../src/parse/scanner_lex.re"
        {
                                        yylval.extop.minsize = atoi((char *)tok+1);
                                        yylval.extop.maxsize = atoi((char *)tok+1);
                                        RETURN(CLOSESIZE);
                                }
-#line 970 "src/parse/scanner_lex.cc"
+#line 966 "src/parse/scanner_lex.cc"
 yy153:
        yyaccept = 6;
        yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR);
@@ -974,13 +970,13 @@ yy153:
        if (yych <= '9') goto yy156;
        if (yych != '}') goto yy148;
        ++YYCURSOR;
-#line 353 "../src/parse/scanner_lex.re"
+#line 346 "../src/parse/scanner_lex.re"
        {
                                        yylval.extop.minsize = atoi((char *)tok+1);
                                        yylval.extop.maxsize = -1;
                                        RETURN(CLOSESIZE);
                                }
-#line 984 "src/parse/scanner_lex.cc"
+#line 980 "src/parse/scanner_lex.cc"
 yy156:
        ++YYCURSOR;
        if (YYLIMIT <= YYCURSOR) YYFILL(1);
@@ -989,13 +985,13 @@ yy156:
        if (yych <= '9') goto yy156;
        if (yych != '}') goto yy142;
        ++YYCURSOR;
-#line 347 "../src/parse/scanner_lex.re"
+#line 340 "../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);
                                }
-#line 999 "src/parse/scanner_lex.cc"
+#line 995 "src/parse/scanner_lex.cc"
 yy160:
        yyaccept = 6;
        yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR);
@@ -1003,25 +999,23 @@ yy160:
        if (yych <= '9') goto yy156;
        if (yych != '}') goto yy148;
        ++YYCURSOR;
-#line 336 "../src/parse/scanner_lex.re"
+#line 329 "../src/parse/scanner_lex.re"
        {
                                        yylval.op = '*';
                                        RETURN(CLOSE);
                                }
-#line 1012 "src/parse/scanner_lex.cc"
+#line 1008 "src/parse/scanner_lex.cc"
 yy163:
        ++YYCURSOR;
 yy164:
        YYCURSOR = YYCTXMARKER;
-#line 400 "../src/parse/scanner_lex.re"
+#line 389 "../src/parse/scanner_lex.re"
        {
                                        if (!FFlag) {
-                                               cur = cursor;
                                                yylval.str = new std::string (tok, cur - tok);
                                                return ID;
                                        } else {
                                                /* Add one char in front and one behind instead of 's or "s */
-                                               cur = cursor;
                                                SubStr s (tok, cur - tok);
                                                if (bCaseInsensitive || bCaseInverted)
                                                {
@@ -1034,7 +1028,7 @@ yy164:
                                                return STRING;
                                        }
                                }
-#line 1038 "src/parse/scanner_lex.cc"
+#line 1032 "src/parse/scanner_lex.cc"
 yy165:
        yych = (YYCTYPE)*++YYCURSOR;
        goto yy184;
@@ -1042,13 +1036,12 @@ yy166:
        ++YYCURSOR;
 yy167:
        YYCURSOR = YYCTXMARKER;
-#line 394 "../src/parse/scanner_lex.re"
+#line 384 "../src/parse/scanner_lex.re"
        {
-                                       cur = ptr > tok ? ptr - 1 : cursor;
                                        yylval.str = new std::string (tok, cur - tok);
                                        return ID;
                                }
-#line 1052 "src/parse/scanner_lex.cc"
+#line 1045 "src/parse/scanner_lex.cc"
 yy168:
        YYCTXMARKER = YYCURSOR + 1;
        ++YYCURSOR;
@@ -1127,15 +1120,14 @@ yy174:
                }
        }
 yy176:
-#line 372 "../src/parse/scanner_lex.re"
+#line 364 "../src/parse/scanner_lex.re"
        {
-                                       cur = cursor;
                                        tok += 5; /* skip "re2c:" */
                                        lexer_state = LEX_CONFIG;
                                        yylval.str = new std::string (tok, cur - tok);
                                        return CONFIG;
                                }
-#line 1139 "src/parse/scanner_lex.cc"
+#line 1131 "src/parse/scanner_lex.cc"
 yy177:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych <= 'Z') {
@@ -1194,9 +1186,8 @@ yy179:
 yy181:
        ++YYCURSOR;
        YYCURSOR = YYCTXMARKER;
-#line 380 "../src/parse/scanner_lex.re"
+#line 371 "../src/parse/scanner_lex.re"
        {
-                                       cur = ptr > tok ? ptr - 1 : cursor;
                                        yylval.str = new std::string (tok, cur - tok);
                                        if (FFlag)
                                        {
@@ -1208,7 +1199,7 @@ yy181:
                                                return ID;
                                        }
                                }
-#line 1212 "src/parse/scanner_lex.cc"
+#line 1203 "src/parse/scanner_lex.cc"
 yy183:
        ++YYCURSOR;
        if (YYLIMIT <= YYCURSOR) YYFILL(1);
@@ -1254,14 +1245,13 @@ yy190:
        goto yy186;
 yy191:
        ++YYCURSOR;
-#line 306 "../src/parse/scanner_lex.re"
+#line 300 "../src/parse/scanner_lex.re"
        {
-                                       cur = cursor;
                                        SubStr s (tok, cur - tok);
                                        yylval.regexp = ranToRE (s);
                                        return RANGE;
                                }
-#line 1265 "src/parse/scanner_lex.cc"
+#line 1255 "src/parse/scanner_lex.cc"
 yy193:
        ++YYCURSOR;
        if (YYLIMIT <= YYCURSOR) YYFILL(1);
@@ -1270,21 +1260,20 @@ yy193:
        goto yy188;
 yy194:
        ++YYCURSOR;
-#line 299 "../src/parse/scanner_lex.re"
+#line 294 "../src/parse/scanner_lex.re"
        {
-                                       cur = cursor;
                                        SubStr s (tok, cur - tok);
                                        yylval.regexp = invToRE (s);
                                        return RANGE;
                                }
-#line 1281 "src/parse/scanner_lex.cc"
+#line 1270 "src/parse/scanner_lex.cc"
 yy196:
        ++YYCURSOR;
-#line 320 "../src/parse/scanner_lex.re"
+#line 313 "../src/parse/scanner_lex.re"
        {
                                        RETURN(SETUP);
                                }
-#line 1288 "src/parse/scanner_lex.cc"
+#line 1277 "src/parse/scanner_lex.cc"
 yy198:
        YYCTXMARKER = YYCURSOR + 1;
        yych = (YYCTYPE)*++YYCURSOR;
@@ -1314,11 +1303,11 @@ yy200:
 yy201:
        ++YYCURSOR;
        YYCURSOR = YYCTXMARKER;
-#line 317 "../src/parse/scanner_lex.re"
+#line 310 "../src/parse/scanner_lex.re"
        {
                                        RETURN(NOCOND);
                                }
-#line 1322 "src/parse/scanner_lex.cc"
+#line 1311 "src/parse/scanner_lex.cc"
 yy203:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '>') goto yy201;
@@ -1330,45 +1319,44 @@ yy204:
 yy205:
        ++YYCURSOR;
        if ((yych = (YYCTYPE)*YYCURSOR) == '>') goto yy207;
-#line 243 "../src/parse/scanner_lex.re"
+#line 241 "../src/parse/scanner_lex.re"
        {
-                                       cur = cursor;
                                        tok += 2; /* skip ":=" */
                                        depth = 0;
                                        goto code;
                                }
-#line 1341 "src/parse/scanner_lex.cc"
+#line 1329 "src/parse/scanner_lex.cc"
 yy207:
        ++YYCURSOR;
        YYCURSOR = YYCTXMARKER;
-#line 239 "../src/parse/scanner_lex.re"
+#line 237 "../src/parse/scanner_lex.re"
        {
                                        RETURN(*tok);
                                }
-#line 1349 "src/parse/scanner_lex.cc"
+#line 1337 "src/parse/scanner_lex.cc"
 yy209:
        ++YYCURSOR;
-#line 253 "../src/parse/scanner_lex.re"
+#line 250 "../src/parse/scanner_lex.re"
        {
                                        depth = 1;
                                        goto comment;
                                }
-#line 1357 "src/parse/scanner_lex.cc"
+#line 1345 "src/parse/scanner_lex.cc"
 yy211:
        ++YYCURSOR;
-#line 250 "../src/parse/scanner_lex.re"
+#line 247 "../src/parse/scanner_lex.re"
        {
                                goto nextLine;
                        }
-#line 1364 "src/parse/scanner_lex.cc"
+#line 1352 "src/parse/scanner_lex.cc"
 yy213:
        ++YYCURSOR;
-#line 259 "../src/parse/scanner_lex.re"
+#line 256 "../src/parse/scanner_lex.re"
        {
-                                       tok = cursor;
+                                       tok = cur;
                                        RETURN(0);
                                }
-#line 1372 "src/parse/scanner_lex.cc"
+#line 1360 "src/parse/scanner_lex.cc"
 yy215:
        ++YYCURSOR;
        if (YYLIMIT <= YYCURSOR) YYFILL(1);
@@ -1386,9 +1374,8 @@ yy216:
        goto yy215;
 yy218:
        ++YYCURSOR;
-#line 278 "../src/parse/scanner_lex.re"
+#line 274 "../src/parse/scanner_lex.re"
        {
-                                       cur = cursor;
                                        SubStr s (tok + 1, cur - tok - 2);
                                        if (bCaseInverted)
                                        {
@@ -1400,7 +1387,7 @@ yy218:
                                        }
                                        return STRING;
                                }
-#line 1404 "src/parse/scanner_lex.cc"
+#line 1391 "src/parse/scanner_lex.cc"
 yy220:
        ++YYCURSOR;
        if (YYLIMIT <= YYCURSOR) YYFILL(1);
@@ -1418,9 +1405,8 @@ yy221:
        goto yy220;
 yy223:
        ++YYCURSOR;
-#line 264 "../src/parse/scanner_lex.re"
+#line 261 "../src/parse/scanner_lex.re"
        {
-                                       cur = cursor;
                                        SubStr s (tok + 1, cur - tok - 2);
                                        if (bCaseInsensitive || bCaseInverted)
                                        {
@@ -1432,7 +1418,7 @@ yy223:
                                        }
                                        return STRING;
                                }
-#line 1436 "src/parse/scanner_lex.cc"
+#line 1422 "src/parse/scanner_lex.cc"
 yy225:
        yyaccept = 0;
        yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR);
@@ -1525,12 +1511,12 @@ yy238:
 yy240:
        ++YYCURSOR;
        YYCURSOR = YYCTXMARKER;
-#line 431 "../src/parse/scanner_lex.re"
+#line 417 "../src/parse/scanner_lex.re"
        {
-                                       set_sourceline(cursor);
+                                       set_sourceline ();
                                        goto scan;
                                }
-#line 1534 "src/parse/scanner_lex.cc"
+#line 1520 "src/parse/scanner_lex.cc"
 yy242:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '\n') goto yy240;
@@ -1565,12 +1551,12 @@ yy248:
        if (yych == ' ') goto yy247;
        goto yy115;
 }
-#line 447 "../src/parse/scanner_lex.re"
+#line 433 "../src/parse/scanner_lex.re"
 
 
 flex_name:
 
-#line 1574 "src/parse/scanner_lex.cc"
+#line 1560 "src/parse/scanner_lex.cc"
 {
        YYCTYPE yych;
        if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
@@ -1579,22 +1565,22 @@ flex_name:
        if (yych == '\r') goto yy255;
        ++YYCURSOR;
 yy252:
-#line 458 "../src/parse/scanner_lex.re"
+#line 444 "../src/parse/scanner_lex.re"
        {
                YYCURSOR = tok;
                goto start;
        }
-#line 1588 "src/parse/scanner_lex.cc"
+#line 1574 "src/parse/scanner_lex.cc"
 yy253:
        ++YYCURSOR;
 yy254:
-#line 452 "../src/parse/scanner_lex.re"
+#line 438 "../src/parse/scanner_lex.re"
        {
                YYCURSOR = tok;
                lexer_state = LEX_NORMAL;
                return FID_END;
        }
-#line 1598 "src/parse/scanner_lex.cc"
+#line 1584 "src/parse/scanner_lex.cc"
 yy255:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych != '\n') goto yy252;
@@ -1602,12 +1588,12 @@ yy255:
        yych = (YYCTYPE)*YYCURSOR;
        goto yy254;
 }
-#line 462 "../src/parse/scanner_lex.re"
+#line 448 "../src/parse/scanner_lex.re"
 
 
 code:
 
-#line 1611 "src/parse/scanner_lex.cc"
+#line 1597 "src/parse/scanner_lex.cc"
 {
        YYCTYPE yych;
        unsigned int yyaccept = 0;
@@ -1668,9 +1654,9 @@ code:
        }
 yy259:
        ++YYCURSOR;
-#line 527 "../src/parse/scanner_lex.re"
+#line 511 "../src/parse/scanner_lex.re"
        {
-                                       if (cursor == eof)
+                                       if (cur == eof)
                                        {
                                                if (depth)
                                                {
@@ -1680,15 +1666,15 @@ yy259:
                                        }
                                        goto code;
                                }
-#line 1684 "src/parse/scanner_lex.cc"
+#line 1670 "src/parse/scanner_lex.cc"
 yy261:
        ++YYCURSOR;
 yy262:
-#line 541 "../src/parse/scanner_lex.re"
+#line 525 "../src/parse/scanner_lex.re"
        {
                                        goto code;
                                }
-#line 1692 "src/parse/scanner_lex.cc"
+#line 1678 "src/parse/scanner_lex.cc"
 yy263:
        YYCTXMARKER = YYCURSOR + 1;
        yyaccept = 0;
@@ -1708,11 +1694,10 @@ yy263:
                }
        }
 yy264:
-#line 507 "../src/parse/scanner_lex.re"
+#line 492 "../src/parse/scanner_lex.re"
        {
                                        if (depth == 0)
                                        {
-                                               cur = cursor;
                                                tok += strspn(tok, " \t\r\n");
                                                while (cur > tok && strchr(" \t\r\n", cur[-1]))
                                                {
@@ -1721,15 +1706,15 @@ yy264:
                                                yylval.code = new Code (tok, cur - tok, get_fname (), tline);
                                                return CODE;
                                        }
-                                       else if (cursor == eof)
+                                       else if (cur == eof)
                                        {
                                                fatal("missing '}'");
                                        }
-                                       pos = cursor;
+                                       pos = cur;
                                        cline++;
                                        goto code;
                                }
-#line 1733 "src/parse/scanner_lex.cc"
+#line 1718 "src/parse/scanner_lex.cc"
 yy265:
        yyaccept = 1;
        yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR);
@@ -1742,7 +1727,7 @@ yy266:
        goto yy272;
 yy267:
        ++YYCURSOR;
-#line 479 "../src/parse/scanner_lex.re"
+#line 464 "../src/parse/scanner_lex.re"
        {
                                        if (depth == 0)
                                        {
@@ -1754,10 +1739,10 @@ yy267:
                                        }
                                        goto code;
                                }
-#line 1758 "src/parse/scanner_lex.cc"
+#line 1743 "src/parse/scanner_lex.cc"
 yy269:
        ++YYCURSOR;
-#line 466 "../src/parse/scanner_lex.re"
+#line 452 "../src/parse/scanner_lex.re"
        {
                                        if (depth == 0)
                                        {
@@ -1765,13 +1750,12 @@ yy269:
                                        }
                                        else if (--depth == 0)
                                        {
-                                               cur = cursor;
                                                yylval.code = new Code (tok, cur - tok, get_fname (), tline);
                                                return CODE;
                                        }
                                        goto code;
                                }
-#line 1775 "src/parse/scanner_lex.cc"
+#line 1759 "src/parse/scanner_lex.cc"
 yy271:
        ++YYCURSOR;
        if (YYLIMIT <= YYCURSOR) YYFILL(1);
@@ -1802,11 +1786,11 @@ yy274:
        goto yy271;
 yy275:
        ++YYCURSOR;
-#line 538 "../src/parse/scanner_lex.re"
+#line 522 "../src/parse/scanner_lex.re"
        {
                                        goto code;
                                }
-#line 1810 "src/parse/scanner_lex.cc"
+#line 1794 "src/parse/scanner_lex.cc"
 yy277:
        ++YYCURSOR;
        if (YYLIMIT <= YYCURSOR) YYFILL(1);
@@ -1833,21 +1817,21 @@ yy280:
        }
 yy281:
        YYCURSOR = YYCTXMARKER;
-#line 494 "../src/parse/scanner_lex.re"
+#line 479 "../src/parse/scanner_lex.re"
        {
                                        if (depth == 0)
                                        {
                                                goto code;
                                        }
-                                       else if (cursor == eof)
+                                       else if (cur == eof)
                                        {
                                                fatal("missing '}'");
                                        }
-                                       pos = cursor;
+                                       pos = cur;
                                        cline++;
                                        goto code;
                                }
-#line 1851 "src/parse/scanner_lex.cc"
+#line 1835 "src/parse/scanner_lex.cc"
 yy282:
        yych = (YYCTYPE)*++YYCURSOR;
        goto yy281;
@@ -1914,12 +1898,12 @@ yy293:
 yy295:
        ++YYCURSOR;
        YYCURSOR = YYCTXMARKER;
-#line 490 "../src/parse/scanner_lex.re"
+#line 475 "../src/parse/scanner_lex.re"
        {
-                                       set_sourceline(cursor);
+                                       set_sourceline ();
                                        goto code;
                                }
-#line 1923 "src/parse/scanner_lex.cc"
+#line 1907 "src/parse/scanner_lex.cc"
 yy297:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '\n') goto yy295;
@@ -1958,12 +1942,12 @@ yy302:
                goto yy273;
        }
 }
-#line 544 "../src/parse/scanner_lex.re"
+#line 528 "../src/parse/scanner_lex.re"
 
 
 comment:
 
-#line 1967 "src/parse/scanner_lex.cc"
+#line 1951 "src/parse/scanner_lex.cc"
 {
        YYCTYPE yych;
        static const unsigned char yybm[] = {
@@ -2010,15 +1994,15 @@ comment:
        }
        ++YYCURSOR;
 yy307:
-#line 576 "../src/parse/scanner_lex.re"
+#line 560 "../src/parse/scanner_lex.re"
        {
-                                       if (cursor == eof)
+                                       if (cur == eof)
                                        {
                                                RETURN(0);
                                        }
                                        goto comment;
                                }
-#line 2022 "src/parse/scanner_lex.cc"
+#line 2006 "src/parse/scanner_lex.cc"
 yy308:
        yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR);
        if (yybm[0+yych] & 32) {
@@ -2026,17 +2010,17 @@ yy308:
        }
        if (yych == '#') goto yy319;
 yy309:
-#line 567 "../src/parse/scanner_lex.re"
+#line 551 "../src/parse/scanner_lex.re"
        {
-                                       if (cursor == eof)
+                                       if (cur == eof)
                                        {
                                                RETURN(0);
                                        }
-                                       tok = pos = cursor;
+                                       tok = pos = cur;
                                        cline++;
                                        goto comment;
                                }
-#line 2040 "src/parse/scanner_lex.cc"
+#line 2024 "src/parse/scanner_lex.cc"
 yy310:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '/') goto yy314;
@@ -2045,16 +2029,16 @@ yy311:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych != '*') goto yy307;
        ++YYCURSOR;
-#line 558 "../src/parse/scanner_lex.re"
+#line 542 "../src/parse/scanner_lex.re"
        {
                                        ++depth;
                                        fatal("ambiguous /* found");
                                        goto comment;
                                }
-#line 2055 "src/parse/scanner_lex.cc"
+#line 2039 "src/parse/scanner_lex.cc"
 yy314:
        ++YYCURSOR;
-#line 548 "../src/parse/scanner_lex.re"
+#line 532 "../src/parse/scanner_lex.re"
        {
                                        if (--depth == 0)
                                        {
@@ -2065,7 +2049,7 @@ yy314:
                                                goto comment;
                                        }
                                }
-#line 2069 "src/parse/scanner_lex.cc"
+#line 2053 "src/parse/scanner_lex.cc"
 yy316:
        ++YYCURSOR;
        if (YYLIMIT <= YYCURSOR) YYFILL(1);
@@ -2143,12 +2127,12 @@ yy329:
 yy331:
        ++YYCURSOR;
        YYCURSOR = YYCTXMARKER;
-#line 563 "../src/parse/scanner_lex.re"
+#line 547 "../src/parse/scanner_lex.re"
        {
-                                       set_sourceline(cursor);
+                                       set_sourceline ();
                                        goto comment;
                                }
-#line 2152 "src/parse/scanner_lex.cc"
+#line 2136 "src/parse/scanner_lex.cc"
 yy333:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych == '\n') goto yy331;
@@ -2173,43 +2157,43 @@ yy337:
        if (yych == '\r') goto yy333;
        goto yy318;
 }
-#line 583 "../src/parse/scanner_lex.re"
+#line 567 "../src/parse/scanner_lex.re"
 
 
 nextLine:
 
-#line 2182 "src/parse/scanner_lex.cc"
+#line 2166 "src/parse/scanner_lex.cc"
 {
        YYCTYPE yych;
        if (YYLIMIT <= YYCURSOR) YYFILL(1);
        yych = (YYCTYPE)*YYCURSOR;
        if (yych == '\n') goto yy342;
        ++YYCURSOR;
-#line 594 "../src/parse/scanner_lex.re"
-       {  if(cursor == eof) {
+#line 578 "../src/parse/scanner_lex.re"
+       {  if(cur == eof) {
                   RETURN(0);
                }
                goto nextLine;
             }
-#line 2195 "src/parse/scanner_lex.cc"
+#line 2179 "src/parse/scanner_lex.cc"
 yy342:
        ++YYCURSOR;
-#line 587 "../src/parse/scanner_lex.re"
-       { if(cursor == eof) {
+#line 571 "../src/parse/scanner_lex.re"
+       { if(cur == eof) {
                   RETURN(0);
                }
-               tok = pos = cursor;
+               tok = pos = cur;
                cline++;
                goto scan;
             }
-#line 2206 "src/parse/scanner_lex.cc"
+#line 2190 "src/parse/scanner_lex.cc"
 }
-#line 599 "../src/parse/scanner_lex.re"
+#line 583 "../src/parse/scanner_lex.re"
 
 
 config:
 
-#line 2213 "src/parse/scanner_lex.cc"
+#line 2197 "src/parse/scanner_lex.cc"
 {
        YYCTYPE yych;
        static const unsigned char yybm[] = {
@@ -2255,33 +2239,32 @@ config:
                if (yych == '=') goto yy350;
        }
        ++YYCURSOR;
-#line 611 "../src/parse/scanner_lex.re"
+#line 594 "../src/parse/scanner_lex.re"
        {
                                        fatal("missing '='");
                                }
-#line 2263 "src/parse/scanner_lex.cc"
+#line 2247 "src/parse/scanner_lex.cc"
 yy348:
        ++YYCURSOR;
        yych = (YYCTYPE)*YYCURSOR;
        goto yy355;
 yy349:
-#line 603 "../src/parse/scanner_lex.re"
+#line 587 "../src/parse/scanner_lex.re"
        {
                                        goto config;
                                }
-#line 2273 "src/parse/scanner_lex.cc"
+#line 2257 "src/parse/scanner_lex.cc"
 yy350:
        ++YYCURSOR;
        yych = (YYCTYPE)*YYCURSOR;
        goto yy353;
 yy351:
-#line 606 "../src/parse/scanner_lex.re"
+#line 590 "../src/parse/scanner_lex.re"
        {
                                        lexer_state = LEX_CONFIG_VALUE;
-                                       cur = cursor;
                                        RETURN('=');
                                }
-#line 2285 "src/parse/scanner_lex.cc"
+#line 2268 "src/parse/scanner_lex.cc"
 yy352:
        ++YYCURSOR;
        if (YYLIMIT <= YYCURSOR) YYFILL(1);
@@ -2300,12 +2283,12 @@ yy355:
        if (yych == ' ') goto yy354;
        goto yy349;
 }
-#line 614 "../src/parse/scanner_lex.re"
+#line 597 "../src/parse/scanner_lex.re"
 
 
 value:
 
-#line 2309 "src/parse/scanner_lex.cc"
+#line 2292 "src/parse/scanner_lex.cc"
 {
        YYCTYPE yych;
        static const unsigned char yybm[] = {
@@ -2372,28 +2355,26 @@ value:
                }
        }
 yy358:
-#line 624 "../src/parse/scanner_lex.re"
+#line 606 "../src/parse/scanner_lex.re"
        {
-                                       cur = cursor;
                                        yylval.str = new std::string (tok, cur - tok);
                                        lexer_state = LEX_NORMAL;
                                        return VALUE;
                                }
-#line 2383 "src/parse/scanner_lex.cc"
+#line 2365 "src/parse/scanner_lex.cc"
 yy359:
        ++YYCURSOR;
        if (yybm[0+(yych = (YYCTYPE)*YYCURSOR)] & 8) {
                goto yy364;
        }
 yy360:
-#line 618 "../src/parse/scanner_lex.re"
+#line 601 "../src/parse/scanner_lex.re"
        {
-                                       cur = cursor;
                                        yylval.number = atoi(std::string (tok, cur - tok).c_str());
                                        lexer_state = LEX_NORMAL;
                                        return NUMBER;
                                }
-#line 2397 "src/parse/scanner_lex.cc"
+#line 2378 "src/parse/scanner_lex.cc"
 yy361:
        yych = (YYCTYPE)*++YYCURSOR;
        if (yych <= '0') goto yy365;
@@ -2536,7 +2517,7 @@ yy379:
        if (yych == '\n') goto yy372;
        goto yy376;
 }
-#line 630 "../src/parse/scanner_lex.re"
+#line 611 "../src/parse/scanner_lex.re"
 
 }
 
@@ -2554,12 +2535,12 @@ static void escape (std::string & dest, const std::string & src)
        }
 }
 
-void Scanner::set_sourceline(char *& cursor) 
+void Scanner::set_sourceline ()
 {
 sourceline:
-       tok = cursor;
+       tok = cur;
 
-#line 2563 "src/parse/scanner_lex.cc"
+#line 2544 "src/parse/scanner_lex.cc"
 {
        YYCTYPE yych;
        static const unsigned char yybm[] = {
@@ -2608,27 +2589,27 @@ sourceline:
 yy382:
        ++YYCURSOR;
 yy383:
-#line 674 "../src/parse/scanner_lex.re"
+#line 653 "../src/parse/scanner_lex.re"
        {
                                        goto sourceline;
                                }
-#line 2616 "src/parse/scanner_lex.cc"
+#line 2597 "src/parse/scanner_lex.cc"
 yy384:
        ++YYCURSOR;
-#line 662 "../src/parse/scanner_lex.re"
+#line 641 "../src/parse/scanner_lex.re"
        {
-                                       if (cursor == eof)
+                                       if (cur == eof)
                                        {
-                                               --cursor
+                                               --cur; 
                                        }
                                        else
                                        {
-                                               pos = cursor
+                                               pos = cur; 
                                        }
-                                       tok = cursor;
+                                       tok = cur;
                                        return; 
                                }
-#line 2632 "src/parse/scanner_lex.cc"
+#line 2613 "src/parse/scanner_lex.cc"
 yy386:
        yych = (YYCTYPE)*(YYMARKER = ++YYCURSOR);
        if (yych == '\n') goto yy383;
@@ -2638,13 +2619,12 @@ yy387:
        yych = (YYCTYPE)*YYCURSOR;
        goto yy390;
 yy388:
-#line 652 "../src/parse/scanner_lex.re"
+#line 633 "../src/parse/scanner_lex.re"
        {
-                                       cur = cursor;
                                        cline = atoi(std::string (tok, cur - tok).c_str());
                                        goto sourceline; 
                                }
-#line 2648 "src/parse/scanner_lex.cc"
+#line 2628 "src/parse/scanner_lex.cc"
 yy389:
        ++YYCURSOR;
        if (YYLIMIT <= YYCURSOR) YYFILL(1);
@@ -2676,15 +2656,14 @@ yy394:
        goto yy391;
 yy395:
        ++YYCURSOR;
-#line 657 "../src/parse/scanner_lex.re"
+#line 637 "../src/parse/scanner_lex.re"
        {
-                                       cur = cursor;
                                        escape (in.file_name, std::string (tok + 1, cur - tok - 2));
                                        goto sourceline; 
                                }
-#line 2686 "src/parse/scanner_lex.cc"
+#line 2665 "src/parse/scanner_lex.cc"
 }
-#line 677 "../src/parse/scanner_lex.re"
+#line 656 "../src/parse/scanner_lex.re"
 
 }
 
index 1f2774b1af5a8e9fa3ca634d2f839f1e662e7678..ec67476b3f3cfd7676ef24ff17aa54f9d54e36fa 100644 (file)
@@ -321,7 +321,7 @@ Scanner::Scanner (Input & i, OutputFile & o)
        , out (o)
 {}
 
-char *Scanner::fill(char *cursor, uint32_t need)
+void Scanner::fill (uint32_t need)
 {
        if(!eof)
        {
@@ -340,7 +340,6 @@ char *Scanner::fill(char *cursor, uint32_t need)
                                pos -= cnt;
                                lim -= cnt;
                                ctx -= cnt;
-                               cursor -= cnt;
                        }
                }
                /* In crease buffer size. */
@@ -363,7 +362,6 @@ char *Scanner::fill(char *cursor, uint32_t need)
                        lim = &buf[lim - bot];
                        top = &lim[need];
                        ctx = &buf[ctx - bot];
-                       cursor = &buf[cursor - bot];
                        delete [] bot;
                        bot = buf;
                }
@@ -376,7 +374,6 @@ char *Scanner::fill(char *cursor, uint32_t need)
                }
                lim += cnt;
        }
-       return cursor;
 }
 
 void Scanner::set_in_parse(bool new_in_parse)
index 2138fc55bfe635e657aa23cc41cc3ad43e29c957..379b8df7a49f541e0b7ecf11f46f98cea1e7f74e 100644 (file)
@@ -57,8 +57,8 @@ private:
        OutputFile & out;
 
 private:
-       char *fill(char*, uint32_t);
-       void set_sourceline(char *& cursor);
+       void fill (uint32_t);
+       void set_sourceline ();
 
 public:
        Scanner(Input &, OutputFile &);
index ddc97c151765b9b34d256f66714ac16ba42d9a28..9aef01085012e58dbf3c2fb246de7d3287f4438a 100644 (file)
@@ -17,13 +17,13 @@ extern YYSTYPE yylval;
 #endif
 
 #define        YYCTYPE         unsigned char
-#define        YYCURSOR        cursor
+#define        YYCURSOR        cur
 #define        YYLIMIT         lim
 #define        YYMARKER        ptr
 #define        YYCTXMARKER ctx
-#define        YYFILL(n)       {cursor = fill(cursor, n);}
+#define        YYFILL(n)       { fill (n); }
 
-#define        RETURN(i)       {cur = cursor; return i;}
+#define        RETURN(i)       { return i; }
 
 namespace re2c
 {
@@ -59,16 +59,15 @@ lineinf = lineno (space+ dstring)? eol;
 
 Scanner::ParseMode Scanner::echo()
 {
-       char *cursor = cur;
        bool ignore_eoc = false;
        int  ignore_cnt = 0;
 
-       if (eof && cursor == eof) // Catch EOF
+       if (eof && cur == eof) // Catch EOF
        {
                return Stop;
        }
 
-       tok = cursor;
+       tok = cur;
 echo:
 /*!re2c
    beginRE     =  "%{" | "/*!re2c";
@@ -79,9 +78,9 @@ echo:
                                        }
                                        if (!(DFlag || flag_skeleton))
                                        {
-                                               out.write((const char*)(tok), (const char*)(&cursor[-7]) - (const char*)(tok));
+                                               out.write((const char*)(tok), (const char*)(&cur[-7]) - (const char*)(tok));
                                        }
-                                       tok = cursor;
+                                       tok = cur;
                                        RETURN(Parse);
                                }
        "/*!rules:re2c" {
@@ -93,7 +92,7 @@ echo:
                                        {
                                                fatal("found 'rules:re2c' block without -r flag");
                                        }
-                                       tok = cursor;
+                                       tok = cur;
                                        RETURN(Rules);
                                }
        "/*!use:re2c"   {
@@ -104,9 +103,9 @@ echo:
                                        reuse();
                                        if (!(DFlag || flag_skeleton))
                                        {
-                                               out.write((const char*)(tok), (const char*)(&cursor[-11]) - (const char*)(tok));
+                                               out.write((const char*)(tok), (const char*)(&cur[-11]) - (const char*)(tok));
                                        }
-                                       tok = cursor;
+                                       tok = cur;
                                        RETURN(Reuse);
                                }
        "/*!max:re2c" {
@@ -114,23 +113,23 @@ echo:
                                        {
                                                out.insert_yymaxfill ();
                                        }
-                                       tok = pos = cursor;
+                                       tok = pos = cur;
                                        ignore_eoc = true;
                                        goto echo;
                                }
        "/*!getstate:re2c" {
-                                       tok = pos = cursor;
+                                       tok = pos = cur;
                                        out.insert_state_goto (topIndent);
                                        ignore_eoc = true;
                                        goto echo;
                                }
        "/*!ignore:re2c" {
-                                       tok = pos = cursor;
+                                       tok = pos = cur;
                                        ignore_eoc = true;
                                        goto echo;
                                }
        "/*!types:re2c" {
-                                       tok = pos = cursor;
+                                       tok = pos = cur;
                                        ignore_eoc = true;
                                        if (!DFlag)
                                        {
@@ -155,9 +154,9 @@ echo:
                                        }
                                        else if (!(DFlag || flag_skeleton))
                                        {
-                                               out.write((const char*)(tok), (const char*)(cursor) - (const char*)(tok));
+                                               out.write((const char*)(tok), (const char*)(cur) - (const char*)(tok));
                                        }
-                                       tok = pos = cursor;
+                                       tok = pos = cur;
                                        goto echo;
                                }
        "*" "/"         {
@@ -173,13 +172,13 @@ echo:
                                        }
                                        else if (!(DFlag || flag_skeleton))
                                        {
-                                               out.write((const char*)(tok), (const char*)(cursor) - (const char*)(tok));
+                                               out.write((const char*)(tok), (const char*)(cur) - (const char*)(tok));
                                        }
-                                       tok = pos = cursor;
+                                       tok = pos = cur;
                                        goto echo;
                                }
        "\n" space* "#" space* "line" space+ / lineinf {
-                                       set_sourceline(cursor);
+                                       set_sourceline ();
                                        goto echo;
                                }
        "\n"            {
@@ -189,19 +188,19 @@ echo:
                                        }
                                        else if (!(DFlag || flag_skeleton))
                                        {
-                                               out.write((const char*)(tok), (const char*)(cursor) - (const char*)(tok));
+                                               out.write((const char*)(tok), (const char*)(cur) - (const char*)(tok));
                                        }
-                                       tok = pos = cursor;
+                                       tok = pos = cur;
                                        cline++;
                                        goto echo;
                                }
        zero            {
                                        if (!(ignore_eoc || DFlag || flag_skeleton))
                                        {
-                                               out.write((const char*)(tok), (const char*)(cursor) - (const char*)(tok) - 1);
+                                               out.write((const char*)(tok), (const char*)(cur) - (const char*)(tok) - 1);
                                                // -1 so we don't write out the \0
                                        }
-                                       if(cursor == eof)
+                                       if(cur == eof)
                                        {
                                                RETURN(Stop);
                                        }
@@ -214,13 +213,12 @@ echo:
 
 int Scanner::scan()
 {
-       char *cursor = cur;
        uint32_t depth;
 
 scan:
-       tchar = cursor - pos;
+       tchar = cur - pos;
        tline = cline;
-       tok = cursor;
+       tok = cur;
        switch (lexer_state)
        {
                case LEX_NORMAL:       goto start;
@@ -241,7 +239,6 @@ start:
                                }
 
        ":="            {
-                                       cur = cursor;
                                        tok += 2; /* skip ":=" */
                                        depth = 0;
                                        goto code;
@@ -257,12 +254,11 @@ start:
 
    endRE    =  "%}" | "*/";
    endRE    {
-                                       tok = cursor;
+                                       tok = cur;
                                        RETURN(0);
                                }
 
        dstring         {
-                                       cur = cursor;
                                        SubStr s (tok + 1, cur - tok - 2);
                                        if (bCaseInsensitive || bCaseInverted)
                                        {
@@ -276,7 +272,6 @@ start:
                                }
 
        sstring         {
-                                       cur = cursor;
                                        SubStr s (tok + 1, cur - tok - 2);
                                        if (bCaseInverted)
                                        {
@@ -297,14 +292,12 @@ start:
                                }
 
        istring         {
-                                       cur = cursor;
                                        SubStr s (tok, cur - tok);
                                        yylval.regexp = invToRE (s);
                                        return RANGE;
                                }
 
        cstring         {
-                                       cur = cursor;
                                        SubStr s (tok, cur - tok);
                                        yylval.regexp = ranToRE (s);
                                        return RANGE;
@@ -364,13 +357,11 @@ start:
                                        if (!FFlag) {
                                                fatal("curly braces for names only allowed with -F switch");
                                        }
-                                       cur = cursor;
                                        yylval.str = new std::string (tok + 1, cur - tok - 2);
                                        return ID;
                                }
 
        config          {
-                                       cur = cursor;
                                        tok += 5; /* skip "re2c:" */
                                        lexer_state = LEX_CONFIG;
                                        yylval.str = new std::string (tok, cur - tok);
@@ -378,7 +369,6 @@ start:
                                }
 
        name / (space+ [^=>,])  {
-                                       cur = ptr > tok ? ptr - 1 : cursor;
                                        yylval.str = new std::string (tok, cur - tok);
                                        if (FFlag)
                                        {
@@ -392,19 +382,16 @@ start:
                                }
 
        name / (space* [=>,])   {
-                                       cur = ptr > tok ? ptr - 1 : cursor;
                                        yylval.str = new std::string (tok, cur - tok);
                                        return ID;
                                }
 
        name / [^]      {
                                        if (!FFlag) {
-                                               cur = cursor;
                                                yylval.str = new std::string (tok, cur - tok);
                                                return ID;
                                        } else {
                                                /* Add one char in front and one behind instead of 's or "s */
-                                               cur = cursor;
                                                SubStr s (tok, cur - tok);
                                                if (bCaseInsensitive || bCaseInverted)
                                                {
@@ -419,7 +406,6 @@ start:
                                }
 
        "."                     {
-                                       cur = cursor;
                                        yylval.regexp = mkDot();
                                        return RANGE;
                                }
@@ -429,13 +415,13 @@ start:
                                }
 
        eol space* "#" space* "line" space+ / lineinf {
-                                       set_sourceline(cursor);
+                                       set_sourceline ();
                                        goto scan;
                                }
 
        eol                     {
-                                       if (cursor == eof) RETURN(0);
-                                       pos = cursor;
+                                       if (cur == eof) RETURN(0);
+                                       pos = cur;
                                        cline++;
                                        goto scan;
                                }
@@ -470,7 +456,6 @@ code:
                                        }
                                        else if (--depth == 0)
                                        {
-                                               cur = cursor;
                                                yylval.code = new Code (tok, cur - tok, get_fname (), tline);
                                                return CODE;
                                        }
@@ -488,7 +473,7 @@ code:
                                        goto code;
                                }
        "\n" space* "#" space* "line" space+ / lineinf {
-                                       set_sourceline(cursor);
+                                       set_sourceline ();
                                        goto code;
                                }
        "\n" /  ws      {
@@ -496,18 +481,17 @@ code:
                                        {
                                                goto code;
                                        }
-                                       else if (cursor == eof)
+                                       else if (cur == eof)
                                        {
                                                fatal("missing '}'");
                                        }
-                                       pos = cursor;
+                                       pos = cur;
                                        cline++;
                                        goto code;
                                }
        "\n"            {
                                        if (depth == 0)
                                        {
-                                               cur = cursor;
                                                tok += strspn(tok, " \t\r\n");
                                                while (cur > tok && strchr(" \t\r\n", cur[-1]))
                                                {
@@ -516,16 +500,16 @@ code:
                                                yylval.code = new Code (tok, cur - tok, get_fname (), tline);
                                                return CODE;
                                        }
-                                       else if (cursor == eof)
+                                       else if (cur == eof)
                                        {
                                                fatal("missing '}'");
                                        }
-                                       pos = cursor;
+                                       pos = cur;
                                        cline++;
                                        goto code;
                                }
        zero            {
-                                       if (cursor == eof)
+                                       if (cur == eof)
                                        {
                                                if (depth)
                                                {
@@ -561,20 +545,20 @@ comment:
                                        goto comment;
                                }
        "\n" space* "#" space* "line" space+ / lineinf {
-                                       set_sourceline(cursor);
+                                       set_sourceline ();
                                        goto comment;
                                }
        "\n"            {
-                                       if (cursor == eof)
+                                       if (cur == eof)
                                        {
                                                RETURN(0);
                                        }
-                                       tok = pos = cursor;
+                                       tok = pos = cur;
                                        cline++;
                                        goto comment;
                                }
        *                       {
-                                       if (cursor == eof)
+                                       if (cur == eof)
                                        {
                                                RETURN(0);
                                        }
@@ -584,14 +568,14 @@ comment:
 
 nextLine:
 /*!re2c                                  /* resync emacs */
-   "\n"     { if(cursor == eof) {
+   "\n"     { if(cur == eof) {
                   RETURN(0);
                }
-               tok = pos = cursor;
+               tok = pos = cur;
                cline++;
                goto scan;
             }
-   *        {  if(cursor == eof) {
+   *        {  if(cur == eof) {
                   RETURN(0);
                }
                goto nextLine;
@@ -605,7 +589,6 @@ config:
                                }
        "=" space*      {
                                        lexer_state = LEX_CONFIG_VALUE;
-                                       cur = cursor;
                                        RETURN('=');
                                }
        *                       {
@@ -616,13 +599,11 @@ config:
 value:
 /*!re2c
        number          {
-                                       cur = cursor;
                                        yylval.number = atoi(std::string (tok, cur - tok).c_str());
                                        lexer_state = LEX_NORMAL;
                                        return NUMBER;
                                }
        value           {
-                                       cur = cursor;
                                        yylval.str = new std::string (tok, cur - tok);
                                        lexer_state = LEX_NORMAL;
                                        return VALUE;
@@ -644,31 +625,29 @@ static void escape (std::string & dest, const std::string & src)
        }
 }
 
-void Scanner::set_sourceline(char *& cursor) 
+void Scanner::set_sourceline ()
 {
 sourceline:
-       tok = cursor;
+       tok = cur;
 /*!re2c        
        lineno          {
-                                       cur = cursor;
                                        cline = atoi(std::string (tok, cur - tok).c_str());
                                        goto sourceline; 
                                }
        dstring         {
-                                       cur = cursor;
                                        escape (in.file_name, std::string (tok + 1, cur - tok - 2));
                                        goto sourceline; 
                                }
        "\n"                    {
-                                       if (cursor == eof)
+                                       if (cur == eof)
                                        {
-                                               --cursor
+                                               --cur; 
                                        }
                                        else
                                        {
-                                               pos = cursor
+                                               pos = cur; 
                                        }
-                                       tok = cursor;
+                                       tok = cur;
                                        return; 
                                }
        *                       {