]> granicus.if.org Git - re2c/commitdiff
- When ignoring more then a single line's content the we need to write a
authorhelly <helly@642ea486-5414-0410-9d7f-a0204ed87703>
Mon, 17 Apr 2006 00:18:46 +0000 (00:18 +0000)
committerhelly <helly@642ea486-5414-0410-9d7f-a0204ed87703>
Mon, 17 Apr 2006 00:18:46 +0000 (00:18 +0000)
  #line directive.

bootstrap/scanner.cc
lessons/001_upn_calculator/calc_001.c
lessons/001_upn_calculator/calc_002.c
lessons/001_upn_calculator/calc_003.c
lessons/001_upn_calculator/calc_004.c
lessons/001_upn_calculator/calc_005.c
lessons/001_upn_calculator/calc_006.s.c
lessons/001_upn_calculator/calc_007.b.c
scanner.re
test/config5.c
test/config5.re

index db242b72d0c6359043831c03cd3eb831fd213be5..8b9453502ee90a3456cd0abe6abcad0905c5ac3b 100644 (file)
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.10.2.dev on Sun Apr 16 18:19:25 2006 */
+/* Generated by re2c 0.10.2.dev on Sun Apr 16 20:12:14 2006 */
 #line 1 "scanner.re"
 /* $Id$ */
 #include <stdlib.h>
@@ -83,6 +83,7 @@ int Scanner::echo()
 {
     char *cursor = cur;
     bool ignore_eoc = false;
+    int  ignore_cnt = 0;
 
     if (eof && cursor == eof) // Catch EOF
        {
@@ -92,7 +93,7 @@ int Scanner::echo()
     tok = cursor;
 echo:
 
-#line 96 "scanner.cc"
+#line 97 "scanner.cc"
 {
        YYCTYPE yych;
        unsigned int yyaccept = 0;
@@ -111,29 +112,31 @@ echo:
        yych = *(YYMARKER = ++YYCURSOR);
        if(yych == '*') goto yy16;
 yy3:
-#line 172 "scanner.re"
+#line 184 "scanner.re"
        {
                                        goto echo;
                                }
-#line 119 "scanner.cc"
+#line 120 "scanner.cc"
 yy4:
        yych = *++YYCURSOR;
        if(yych == '/') goto yy10;
        goto yy3;
 yy5:
        ++YYCURSOR;
-#line 157 "scanner.re"
+#line 167 "scanner.re"
        {
-                                       if (!ignore_eoc) {
+                                       if (ignore_eoc) {
+                                               ignore_cnt++;
+                                       } else {
                                                out.write((const char*)(tok), (const char*)(cursor) - (const char*)(tok));
                                        }
                                        tok = pos = cursor; cline++;
                                        goto echo;
                                }
-#line 134 "scanner.cc"
+#line 137 "scanner.cc"
 yy7:
        ++YYCURSOR;
-#line 164 "scanner.re"
+#line 176 "scanner.re"
        {
                                        if (!ignore_eoc) {
                                                out.write((const char*)(tok), (const char*)(cursor) - (const char*)(tok) - 1); // -1 so we don't write out the \0
@@ -142,7 +145,7 @@ yy7:
                                                RETURN(0);
                                        }
                                }
-#line 146 "scanner.cc"
+#line 149 "scanner.cc"
 yy9:
        yych = *++YYCURSOR;
        goto yy3;
@@ -152,17 +155,21 @@ yy10:
        if(yych == 0x0A) goto yy14;
        if(yych == 0x0D) goto yy12;
 yy11:
-#line 148 "scanner.re"
+#line 154 "scanner.re"
        {
                                        if (ignore_eoc) {
+                                               if (ignore_cnt) {
+                                                       out << "\n" << sourceFileInfo;
+                                               }
                                                ignore_eoc = false;
+                                               ignore_cnt = 0;
                                        } else {
                                                out.write((const char*)(tok), (const char*)(cursor) - (const char*)(tok));
                                        }
                                        tok = pos = cursor;
                                        goto echo;
                                }
-#line 166 "scanner.cc"
+#line 173 "scanner.cc"
 yy12:
        yych = *++YYCURSOR;
        if(yych == 0x0A) goto yy14;
@@ -174,17 +181,22 @@ yy13:
        }
 yy14:
        ++YYCURSOR;
-#line 139 "scanner.re"
+#line 140 "scanner.re"
        {
+                                       cline++;
                                        if (ignore_eoc) {
+                                               if (ignore_cnt) {
+                                                       out << sourceFileInfo;
+                                               }
                                                ignore_eoc = false;
+                                               ignore_cnt = 0;
                                        } else {
                                                out.write((const char*)(tok), (const char*)(cursor) - (const char*)(tok));
                                        }
-                                       tok = pos = cursor; cline++;
+                                       tok = pos = cursor;
                                        goto echo;
                                }
-#line 188 "scanner.cc"
+#line 200 "scanner.cc"
 yy16:
        yych = *++YYCURSOR;
        if(yych != '!') goto yy13;
@@ -216,7 +228,7 @@ yy21:
        yych = *++YYCURSOR;
        if(yych != 'c') goto yy13;
        ++YYCURSOR;
-#line 110 "scanner.re"
+#line 111 "scanner.re"
        {
                                        if (bUsedYYMaxFill && bSinglePass) {
                                                fatal("found scanner block after YYMAXFILL declaration");
@@ -225,7 +237,7 @@ yy21:
                                        tok = cursor;
                                        RETURN(1);
                                }
-#line 229 "scanner.cc"
+#line 241 "scanner.cc"
 yy26:
        yych = *++YYCURSOR;
        if(yych != 'x') goto yy13;
@@ -240,7 +252,7 @@ yy26:
        yych = *++YYCURSOR;
        if(yych != 'c') goto yy13;
        ++YYCURSOR;
-#line 118 "scanner.re"
+#line 119 "scanner.re"
        {
                                        if (bUsedYYMaxFill) {
                                                fatal("cannot generate YYMAXFILL twice");
@@ -251,7 +263,7 @@ yy26:
                                        bUsedYYMaxFill = true;
                                        goto echo;
                                }
-#line 255 "scanner.cc"
+#line 267 "scanner.cc"
 yy34:
        yych = *++YYCURSOR;
        if(yych != 't') goto yy13;
@@ -276,14 +288,14 @@ yy34:
        yych = *++YYCURSOR;
        if(yych != 'c') goto yy13;
        ++YYCURSOR;
-#line 128 "scanner.re"
+#line 129 "scanner.re"
        {
                                        tok = pos = cursor;
                                        genGetState(out, topIndent, 0);
                                        ignore_eoc = true;
                                        goto echo;
                                }
-#line 287 "scanner.cc"
+#line 299 "scanner.cc"
 yy47:
        yych = *++YYCURSOR;
        if(yych != 'n') goto yy13;
@@ -304,15 +316,15 @@ yy47:
        yych = *++YYCURSOR;
        if(yych != 'c') goto yy13;
        ++YYCURSOR;
-#line 134 "scanner.re"
+#line 135 "scanner.re"
        {
                                        tok = pos = cursor;
                                        ignore_eoc = true;
                                        goto echo;
                                }
-#line 314 "scanner.cc"
+#line 326 "scanner.cc"
 }
-#line 175 "scanner.re"
+#line 187 "scanner.re"
 
 }
 
@@ -335,7 +347,7 @@ scan:
                goto value;
     }
 
-#line 339 "scanner.cc"
+#line 351 "scanner.cc"
 {
        YYCTYPE yych;
        unsigned int yyaccept = 0;
@@ -409,42 +421,42 @@ yy60:
                if(yych <= '9') goto yy124;
        }
 yy61:
-#line 197 "scanner.re"
+#line 209 "scanner.re"
        { depth = 1;
                                  goto code;
                                }
-#line 417 "scanner.cc"
+#line 429 "scanner.cc"
 yy62:
        ++YYCURSOR;
        if((yych = *YYCURSOR) == '*') goto yy121;
 yy63:
-#line 227 "scanner.re"
+#line 239 "scanner.re"
        { RETURN(*tok); }
-#line 424 "scanner.cc"
+#line 436 "scanner.cc"
 yy64:
        ++YYCURSOR;
        if((yych = *YYCURSOR) == '/') goto yy119;
 yy65:
-#line 229 "scanner.re"
+#line 241 "scanner.re"
        { yylval.op = *tok;
                                  RETURN(CLOSE); }
-#line 432 "scanner.cc"
+#line 444 "scanner.cc"
 yy66:
        yyaccept = 1;
        yych = *(YYMARKER = ++YYCURSOR);
        if(yych != 0x0A) goto yy115;
 yy67:
-#line 214 "scanner.re"
+#line 226 "scanner.re"
        { fatal("unterminated string constant (missing \")"); }
-#line 440 "scanner.cc"
+#line 452 "scanner.cc"
 yy68:
        yyaccept = 2;
        yych = *(YYMARKER = ++YYCURSOR);
        if(yych != 0x0A) goto yy110;
 yy69:
-#line 215 "scanner.re"
+#line 227 "scanner.re"
        { fatal("unterminated string constant (missing ')"); }
-#line 448 "scanner.cc"
+#line 460 "scanner.cc"
 yy70:
        yyaccept = 3;
        yych = *(YYMARKER = ++YYCURSOR);
@@ -452,9 +464,9 @@ yy70:
        if(yych == '^') goto yy101;
        goto yy100;
 yy71:
-#line 225 "scanner.re"
+#line 237 "scanner.re"
        { fatal("unterminated range (missing ])"); }
-#line 458 "scanner.cc"
+#line 470 "scanner.cc"
 yy72:
        yych = *++YYCURSOR;
        goto yy63;
@@ -466,51 +478,51 @@ yy74:
        if((yych = *YYCURSOR) == 'e') goto yy91;
        goto yy90;
 yy75:
-#line 256 "scanner.re"
+#line 268 "scanner.re"
        { cur = cursor;
                                  yylval.symbol = Symbol::find(token());
                                  return ID; }
-#line 474 "scanner.cc"
+#line 486 "scanner.cc"
 yy76:
        yych = *++YYCURSOR;
        goto yy90;
 yy77:
        ++YYCURSOR;
-#line 260 "scanner.re"
+#line 272 "scanner.re"
        { cur = cursor;
                                  yylval.regexp = mkDot();
                                  return RANGE;
                                }
-#line 485 "scanner.cc"
+#line 497 "scanner.cc"
 yy79:
        ++YYCURSOR;
        yych = *YYCURSOR;
        goto yy88;
 yy80:
-#line 265 "scanner.re"
+#line 277 "scanner.re"
        { goto scan; }
-#line 493 "scanner.cc"
+#line 505 "scanner.cc"
 yy81:
        ++YYCURSOR;
 yy82:
-#line 267 "scanner.re"
+#line 279 "scanner.re"
        { if(cursor == eof) RETURN(0);
                                  pos = cursor; cline++;
                                  goto scan;
                                }
-#line 502 "scanner.cc"
+#line 514 "scanner.cc"
 yy83:
        ++YYCURSOR;
        if((yych = *YYCURSOR) == 0x0A) goto yy86;
 yy84:
-#line 272 "scanner.re"
+#line 284 "scanner.re"
        { std::ostringstream msg;
                                  msg << "unexpected character: ";
                                  prtChOrHex(msg, *tok);
                                  fatal(msg.str().c_str());
                                  goto scan;
                                }
-#line 514 "scanner.cc"
+#line 526 "scanner.cc"
 yy85:
        yych = *++YYCURSOR;
        goto yy84;
@@ -588,14 +600,14 @@ yy96:
                }
        }
 yy98:
-#line 249 "scanner.re"
+#line 261 "scanner.re"
        { cur = cursor;
                                  tok+= 5; /* skip "re2c:" */
                                  iscfg = 1;
                                  yylval.str = new Str(token());
                                  return CONFIG;
                                }
-#line 599 "scanner.cc"
+#line 611 "scanner.cc"
 yy99:
        ++YYCURSOR;
        if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -629,11 +641,11 @@ yy103:
        goto yy99;
 yy104:
        ++YYCURSOR;
-#line 221 "scanner.re"
+#line 233 "scanner.re"
        { cur = cursor;
                                  yylval.regexp = ranToRE(token());
                                  return RANGE; }
-#line 637 "scanner.cc"
+#line 649 "scanner.cc"
 yy106:
        ++YYCURSOR;
        if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -642,11 +654,11 @@ yy106:
        goto yy101;
 yy107:
        ++YYCURSOR;
-#line 217 "scanner.re"
+#line 229 "scanner.re"
        { cur = cursor;
                                  yylval.regexp = invToRE(token());
                                  return RANGE; }
-#line 650 "scanner.cc"
+#line 662 "scanner.cc"
 yy109:
        ++YYCURSOR;
        if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -666,11 +678,11 @@ yy110:
        goto yy109;
 yy112:
        ++YYCURSOR;
-#line 210 "scanner.re"
+#line 222 "scanner.re"
        { cur = cursor;
                                  yylval.regexp = strToCaseInsensitiveRE(token());
                                  return STRING; }
-#line 674 "scanner.cc"
+#line 686 "scanner.cc"
 yy114:
        ++YYCURSOR;
        if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -690,23 +702,23 @@ yy115:
        goto yy114;
 yy117:
        ++YYCURSOR;
-#line 206 "scanner.re"
+#line 218 "scanner.re"
        { cur = cursor;
                                  yylval.regexp = strToRE(token());
                                  return STRING; }
-#line 698 "scanner.cc"
+#line 710 "scanner.cc"
 yy119:
        ++YYCURSOR;
-#line 203 "scanner.re"
+#line 215 "scanner.re"
        { tok = cursor;
                                  RETURN(0); }
-#line 704 "scanner.cc"
+#line 716 "scanner.cc"
 yy121:
        ++YYCURSOR;
-#line 200 "scanner.re"
+#line 212 "scanner.re"
        { depth = 1;
                                  goto comment; }
-#line 710 "scanner.cc"
+#line 722 "scanner.cc"
 yy123:
        yych = *++YYCURSOR;
        if(yych == ',') goto yy137;
@@ -727,16 +739,16 @@ yy125:
 yy126:
        ++YYCURSOR;
 yy127:
-#line 247 "scanner.re"
+#line 259 "scanner.re"
        { fatal("illegal closure form, use '{n}', '{n,}', '{n,m}' where n and m are numbers"); }
-#line 733 "scanner.cc"
+#line 745 "scanner.cc"
 yy128:
        ++YYCURSOR;
-#line 235 "scanner.re"
+#line 247 "scanner.re"
        { yylval.extop.minsize = atoi((char *)tok+1);
                                  yylval.extop.maxsize = atoi((char *)tok+1);
                                  RETURN(CLOSESIZE); }
-#line 740 "scanner.cc"
+#line 752 "scanner.cc"
 yy130:
        yyaccept = 6;
        yych = *(YYMARKER = ++YYCURSOR);
@@ -744,11 +756,11 @@ yy130:
        if(yych <= '9') goto yy133;
        if(yych != '}') goto yy127;
        ++YYCURSOR;
-#line 243 "scanner.re"
+#line 255 "scanner.re"
        { yylval.extop.minsize = atoi((char *)tok+1);
                                  yylval.extop.maxsize = -1;
                                  RETURN(CLOSESIZE); }
-#line 752 "scanner.cc"
+#line 764 "scanner.cc"
 yy133:
        ++YYCURSOR;
        if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -757,11 +769,11 @@ yy133:
        if(yych <= '9') goto yy133;
        if(yych != '}') goto yy95;
        ++YYCURSOR;
-#line 239 "scanner.re"
+#line 251 "scanner.re"
        { yylval.extop.minsize = atoi((char *)tok+1);
                                  yylval.extop.maxsize = MAX(yylval.extop.minsize,atoi(strchr((char *)tok, ',')+1));
                                  RETURN(CLOSESIZE); }
-#line 765 "scanner.cc"
+#line 777 "scanner.cc"
 yy137:
        yyaccept = 6;
        yych = *(YYMARKER = ++YYCURSOR);
@@ -769,17 +781,17 @@ yy137:
        if(yych <= '9') goto yy133;
        if(yych != '}') goto yy127;
        ++YYCURSOR;
-#line 232 "scanner.re"
+#line 244 "scanner.re"
        { yylval.op = '*';
                                  RETURN(CLOSE); }
-#line 776 "scanner.cc"
+#line 788 "scanner.cc"
 }
-#line 278 "scanner.re"
+#line 290 "scanner.re"
 
 
 code:
 
-#line 783 "scanner.cc"
+#line 795 "scanner.cc"
 {
        YYCTYPE yych;
        if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
@@ -802,34 +814,34 @@ code:
                }
        }
        ++YYCURSOR;
-#line 282 "scanner.re"
+#line 294 "scanner.re"
        { if(--depth == 0){
                                        cur = cursor;
                                        yylval.token = new Token(token(), tline);
                                        return CODE;
                                  }
                                  goto code; }
-#line 813 "scanner.cc"
+#line 825 "scanner.cc"
 yy144:
        ++YYCURSOR;
-#line 288 "scanner.re"
+#line 300 "scanner.re"
        { ++depth;
                                  goto code; }
-#line 819 "scanner.cc"
+#line 831 "scanner.cc"
 yy146:
        ++YYCURSOR;
-#line 290 "scanner.re"
+#line 302 "scanner.re"
        { if(cursor == eof) fatal("missing '}'");
                                  pos = cursor; cline++;
                                  goto code;
                                }
-#line 827 "scanner.cc"
+#line 839 "scanner.cc"
 yy148:
        ++YYCURSOR;
 yy149:
-#line 294 "scanner.re"
+#line 306 "scanner.re"
        { goto code; }
-#line 833 "scanner.cc"
+#line 845 "scanner.cc"
 yy150:
        yych = *(YYMARKER = ++YYCURSOR);
        if(yych == 0x0A) goto yy149;
@@ -877,12 +889,12 @@ yy157:
        if(yych == 0x0A) goto yy154;
        goto yy156;
 }
-#line 295 "scanner.re"
+#line 307 "scanner.re"
 
 
 comment:
 
-#line 886 "scanner.cc"
+#line 898 "scanner.cc"
 {
        YYCTYPE yych;
        if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
@@ -899,47 +911,47 @@ yy161:
        ++YYCURSOR;
        if((yych = *YYCURSOR) == '/') goto yy169;
 yy162:
-#line 310 "scanner.re"
+#line 322 "scanner.re"
        { if(cursor == eof) RETURN(0);
                                  goto comment; }
-#line 906 "scanner.cc"
+#line 918 "scanner.cc"
 yy163:
        yych = *++YYCURSOR;
        if(yych == '*') goto yy167;
        goto yy162;
 yy164:
        ++YYCURSOR;
-#line 306 "scanner.re"
+#line 318 "scanner.re"
        { if(cursor == eof) RETURN(0);
                                  tok = pos = cursor; cline++;
                                  goto comment;
                                }
-#line 918 "scanner.cc"
+#line 930 "scanner.cc"
 yy166:
        yych = *++YYCURSOR;
        goto yy162;
 yy167:
        ++YYCURSOR;
-#line 303 "scanner.re"
+#line 315 "scanner.re"
        { ++depth;
                                  fatal("ambiguous /* found");
                                  goto comment; }
-#line 928 "scanner.cc"
+#line 940 "scanner.cc"
 yy169:
        ++YYCURSOR;
-#line 299 "scanner.re"
+#line 311 "scanner.re"
        { if(--depth == 0)
                                        goto scan;
                                    else
                                        goto comment; }
-#line 936 "scanner.cc"
+#line 948 "scanner.cc"
 }
-#line 312 "scanner.re"
+#line 324 "scanner.re"
 
 
 config:
 
-#line 943 "scanner.cc"
+#line 955 "scanner.cc"
 {
        YYCTYPE yych;
        if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
@@ -956,25 +968,25 @@ yy173:
        yych = *YYCURSOR;
        goto yy182;
 yy174:
-#line 316 "scanner.re"
+#line 328 "scanner.re"
        { goto config; }
-#line 962 "scanner.cc"
+#line 974 "scanner.cc"
 yy175:
        ++YYCURSOR;
        yych = *YYCURSOR;
        goto yy180;
 yy176:
-#line 317 "scanner.re"
+#line 329 "scanner.re"
        { iscfg = 2;
                                  cur = cursor;
                                  RETURN('='); 
                                }
-#line 973 "scanner.cc"
+#line 985 "scanner.cc"
 yy177:
        ++YYCURSOR;
-#line 321 "scanner.re"
+#line 333 "scanner.re"
        { fatal("missing '='"); }
-#line 978 "scanner.cc"
+#line 990 "scanner.cc"
 yy179:
        ++YYCURSOR;
        if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -992,12 +1004,12 @@ yy182:
        if(yych == ' ') goto yy181;
        goto yy174;
 }
-#line 322 "scanner.re"
+#line 334 "scanner.re"
 
 
 value:
 
-#line 1001 "scanner.cc"
+#line 1013 "scanner.cc"
 {
        YYCTYPE yych;
        if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
@@ -1030,13 +1042,13 @@ value:
                }
        }
 yy185:
-#line 331 "scanner.re"
+#line 343 "scanner.re"
        { cur = cursor;
                                  yylval.str = new Str(token());
                                  iscfg = 0;
                                  return VALUE;
                                }
-#line 1040 "scanner.cc"
+#line 1052 "scanner.cc"
 yy186:
        ++YYCURSOR;
        if((yych = *YYCURSOR) <= 0x0D) {
@@ -1051,13 +1063,13 @@ yy186:
                }
        }
 yy187:
-#line 326 "scanner.re"
+#line 338 "scanner.re"
        { cur = cursor;
                                  yylval.number = atoi(token().to_string().c_str());
                                  iscfg = 0;
                                  return NUMBER;
                                }
-#line 1061 "scanner.cc"
+#line 1073 "scanner.cc"
 yy188:
        yych = *++YYCURSOR;
        if(yych <= '0') goto yy192;
@@ -1231,7 +1243,7 @@ yy206:
        if(yych == 0x0A) goto yy199;
        goto yy203;
 }
-#line 336 "scanner.re"
+#line 348 "scanner.re"
 
 }
 
index d565c5d613cd821f311e26f6ffbc08ee62a5a58a..8a9c2e936917dc3df4cc8a6a14b1ae1bfe168e2a 100755 (executable)
@@ -1,6 +1,7 @@
 /* Generated by re2c */
 #line 1 "calc_001.re"
 /* re2c lesson_001, calc_001, (c) M. Boerger 2006 */
+#line 43 "calc_001.re"
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -19,7 +20,7 @@ int scan(char *s, int l)
        for(;;)
        {
 
-#line 23 "<stdout>"
+#line 24 "<stdout>"
                {
                        YYCTYPE yych;
 
@@ -59,7 +60,7 @@ yy2:
 yy3:
 #line 64 "calc_001.re"
                        { printf("Num\n");      continue; }
-#line 63 "<stdout>"
+#line 64 "<stdout>"
 yy4:
                        ++YYCURSOR;
                        yych = *YYCURSOR;
@@ -67,27 +68,27 @@ yy4:
 yy5:
 #line 63 "calc_001.re"
                        { printf("Num\n");      continue; }
-#line 71 "<stdout>"
+#line 72 "<stdout>"
 yy6:
                        ++YYCURSOR;
 #line 65 "calc_001.re"
                        { printf("+\n");        continue; }
-#line 76 "<stdout>"
+#line 77 "<stdout>"
 yy8:
                        ++YYCURSOR;
 #line 66 "calc_001.re"
                        { printf("-\n");        continue; }
-#line 81 "<stdout>"
+#line 82 "<stdout>"
 yy10:
                        ++YYCURSOR;
 #line 67 "calc_001.re"
                        { printf("EOF\n");      return 0; }
-#line 86 "<stdout>"
+#line 87 "<stdout>"
 yy12:
                        ++YYCURSOR;
 #line 68 "calc_001.re"
                        { printf("ERR\n");      return 1; }
-#line 91 "<stdout>"
+#line 92 "<stdout>"
 yy14:
                        ++YYCURSOR;
                        if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -126,7 +127,7 @@ yy16:
 yy18:
 #line 62 "calc_001.re"
                        { printf("Oct\n");      continue; }
-#line 130 "<stdout>"
+#line 131 "<stdout>"
                }
 #line 69 "calc_001.re"
 
index 4ecca471e8e2668d430a422e4576418bf2e46b9b..c1810aee98062b2c12dd03ffb51fc54a1501ae59 100755 (executable)
@@ -1,6 +1,7 @@
 /* Generated by re2c */
 #line 1 "calc_002.re"
 /* re2c lesson_001, calc_002, (c) M. Boerger 2006 */
+#line 19 "calc_002.re"
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -27,7 +28,7 @@ int scan(char *s)
        for(;;)
        {
 
-#line 31 "<stdout>"
+#line 32 "<stdout>"
                {
                        YYCTYPE yych;
 
@@ -67,7 +68,7 @@ yy2:
 yy3:
 #line 48 "calc_002.re"
                        { printf("Num\n");      continue; }
-#line 71 "<stdout>"
+#line 72 "<stdout>"
 yy4:
                        ++YYCURSOR;
                        yych = *YYCURSOR;
@@ -75,27 +76,27 @@ yy4:
 yy5:
 #line 47 "calc_002.re"
                        { printf("Num\n");      continue; }
-#line 79 "<stdout>"
+#line 80 "<stdout>"
 yy6:
                        ++YYCURSOR;
 #line 49 "calc_002.re"
                        { printf("+\n");        continue; }
-#line 84 "<stdout>"
+#line 85 "<stdout>"
 yy8:
                        ++YYCURSOR;
 #line 50 "calc_002.re"
                        { printf("+\n");        continue; }
-#line 89 "<stdout>"
+#line 90 "<stdout>"
 yy10:
                        ++YYCURSOR;
 #line 51 "calc_002.re"
                        { printf("EOF\n");      return 0; }
-#line 94 "<stdout>"
+#line 95 "<stdout>"
 yy12:
                        ++YYCURSOR;
 #line 52 "calc_002.re"
                        { printf("ERR\n");      return 1; }
-#line 99 "<stdout>"
+#line 100 "<stdout>"
 yy14:
                        ++YYCURSOR;
                        if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -134,7 +135,7 @@ yy16:
 yy18:
 #line 46 "calc_002.re"
                        { printf("Oct\n");      continue; }
-#line 138 "<stdout>"
+#line 139 "<stdout>"
                }
 #line 53 "calc_002.re"
 
index 64f3f2e2a6016fafd08f303e086e19135ea52982..763e5eb3d190ccea91773a5ab0147552951a7aec 100755 (executable)
@@ -1,6 +1,7 @@
 /* Generated by re2c */
 #line 1 "calc_003.re"
 /* re2c lesson_001, calc_003, (c) M. Boerger 2006 */
+#line 19 "calc_003.re"
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -19,7 +20,7 @@ int scan(char *s, int l)
        for(;;)
        {
 
-#line 23 "<stdout>"
+#line 24 "<stdout>"
                {
                        YYCTYPE yych;
 
@@ -59,7 +60,7 @@ yy2:
 yy3:
 #line 40 "calc_003.re"
                        { printf("Num\n");      continue; }
-#line 63 "<stdout>"
+#line 64 "<stdout>"
 yy4:
                        ++YYCURSOR;
                        yych = *YYCURSOR;
@@ -67,27 +68,27 @@ yy4:
 yy5:
 #line 39 "calc_003.re"
                        { printf("Num\n");      continue; }
-#line 71 "<stdout>"
+#line 72 "<stdout>"
 yy6:
                        ++YYCURSOR;
 #line 41 "calc_003.re"
                        { printf("+\n");        continue; }
-#line 76 "<stdout>"
+#line 77 "<stdout>"
 yy8:
                        ++YYCURSOR;
 #line 42 "calc_003.re"
                        { printf("+\n");        continue; }
-#line 81 "<stdout>"
+#line 82 "<stdout>"
 yy10:
                        ++YYCURSOR;
 #line 43 "calc_003.re"
                        { printf("EOF\n");      return 0; }
-#line 86 "<stdout>"
+#line 87 "<stdout>"
 yy12:
                        ++YYCURSOR;
 #line 44 "calc_003.re"
                        { printf("ERR\n");      return 1; }
-#line 91 "<stdout>"
+#line 92 "<stdout>"
 yy14:
                        ++YYCURSOR;
                        if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -126,7 +127,7 @@ yy16:
 yy18:
 #line 38 "calc_003.re"
                        { printf("Oct\n");      continue; }
-#line 130 "<stdout>"
+#line 131 "<stdout>"
                }
 #line 45 "calc_003.re"
 
index 994c534aa8b1717c3929da78e997ba943f6278ce..d830ef2123872b2463c840f84542f4ea517810fc 100755 (executable)
@@ -1,6 +1,7 @@
 /* Generated by re2c */
 #line 1 "calc_004.re"
 /* re2c lesson_001, calc_004, (c) M. Boerger 2006 */
+#line 20 "calc_004.re"
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -31,7 +32,7 @@ int scan(char *s, int l)
        {
                t = p;
 
-#line 35 "<stdout>"
+#line 36 "<stdout>"
                {
                        YYCTYPE yych;
 
@@ -71,7 +72,7 @@ yy2:
 yy3:
 #line 57 "calc_004.re"
                        { t = tokendup(t, p); printf("Num: %s\n", t); free(t); continue; }
-#line 75 "<stdout>"
+#line 76 "<stdout>"
 yy4:
                        yych = *++YYCURSOR;
                        goto yy14;
@@ -79,22 +80,22 @@ yy5:
                        ++YYCURSOR;
 #line 58 "calc_004.re"
                        { printf("+\n");        continue; }
-#line 83 "<stdout>"
+#line 84 "<stdout>"
 yy7:
                        ++YYCURSOR;
 #line 59 "calc_004.re"
                        { printf("+\n");        continue; }
-#line 88 "<stdout>"
+#line 89 "<stdout>"
 yy9:
                        ++YYCURSOR;
 #line 60 "calc_004.re"
                        { printf("EOF\n");      return 0; }
-#line 93 "<stdout>"
+#line 94 "<stdout>"
 yy11:
                        ++YYCURSOR;
 #line 61 "calc_004.re"
                        { printf("ERR\n");      return 1; }
-#line 98 "<stdout>"
+#line 99 "<stdout>"
 yy13:
                        ++YYCURSOR;
                        if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -133,7 +134,7 @@ yy15:
 yy17:
 #line 56 "calc_004.re"
                        { t = tokendup(t, p); printf("Oct: %s\n", t); free(t); continue; }
-#line 137 "<stdout>"
+#line 138 "<stdout>"
                }
 #line 62 "calc_004.re"
 
index 9c4f624e7732534506a0a01212f6cb3e4a45aedd..6babb6348fb7fceaf4c6a2f4e71045058ff543f3 100755 (executable)
@@ -1,6 +1,7 @@
 /* Generated by re2c */
 #line 1 "calc_005.re"
 /* re2c lesson_001, calc_005, (c) M. Boerger 2006 */
+#line 19 "calc_005.re"
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -66,7 +67,7 @@ int scan(char *s, int l)
        {
                t = p;
 
-#line 70 "<stdout>"
+#line 71 "<stdout>"
                {
                        YYCTYPE yych;
 
@@ -96,7 +97,7 @@ yy2:
 yy3:
 #line 91 "calc_005.re"
                        { continue; }
-#line 100 "<stdout>"
+#line 101 "<stdout>"
 yy4:
                        ++YYCURSOR;
                        switch((yych = *YYCURSOR)) {
@@ -115,7 +116,7 @@ yy4:
 yy5:
 #line 93 "calc_005.re"
                        { res = push_num(t, p, 10); continue; }
-#line 119 "<stdout>"
+#line 120 "<stdout>"
 yy6:
                        yych = *++YYCURSOR;
                        goto yy14;
@@ -123,17 +124,17 @@ yy7:
                        ++YYCURSOR;
 #line 94 "calc_005.re"
                        { res = stack_add();            continue; }
-#line 127 "<stdout>"
+#line 128 "<stdout>"
 yy9:
                        ++YYCURSOR;
 #line 95 "calc_005.re"
                        { res = stack_sub();            continue; }
-#line 132 "<stdout>"
+#line 133 "<stdout>"
 yy11:
                        ++YYCURSOR;
 #line 96 "calc_005.re"
                        { res = 1;                                      continue; }
-#line 137 "<stdout>"
+#line 138 "<stdout>"
 yy13:
                        ++YYCURSOR;
                        if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -172,7 +173,7 @@ yy15:
 yy17:
 #line 92 "calc_005.re"
                        { res = push_num(t, p, 8);      continue; }
-#line 176 "<stdout>"
+#line 177 "<stdout>"
 yy18:
                        ++YYCURSOR;
                        if(YYLIMIT == YYCURSOR) YYFILL(1);
index f383e3e2f3f029fe6404e485c3c083e19d4a2cb9..66b4e292c7dff59ea74515c61e88bc40fde860fc 100755 (executable)
@@ -1,6 +1,7 @@
 /* Generated by re2c */
 #line 1 "calc_006.s.re"
 /* re2c lesson_001, calc_006, (c) M. Boerger 2006 */
+#line 34 "calc_006.s.re"
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -64,7 +65,7 @@ int scan(char *s)
        {
                t = p;
 
-#line 68 "<stdout>"
+#line 69 "<stdout>"
                {
                        YYCTYPE yych;
 
@@ -94,7 +95,7 @@ int scan(char *s)
 yy3:
 #line 105 "calc_006.s.re"
                        { continue; }
-#line 98 "<stdout>"
+#line 99 "<stdout>"
 yy4:
                        ++YYCURSOR;
                        if((yych = *YYCURSOR) <= '/') goto yy5;
@@ -102,7 +103,7 @@ yy4:
 yy5:
 #line 107 "calc_006.s.re"
                        { res = push_num(t, p, 10); continue; }
-#line 106 "<stdout>"
+#line 107 "<stdout>"
 yy6:
                        yych = *++YYCURSOR;
                        goto yy16;
@@ -110,22 +111,22 @@ yy7:
                        ++YYCURSOR;
 #line 108 "calc_006.s.re"
                        { res = stack_add();            continue; }
-#line 114 "<stdout>"
+#line 115 "<stdout>"
 yy9:
                        ++YYCURSOR;
 #line 109 "calc_006.s.re"
                        { res = stack_sub();            continue; }
-#line 119 "<stdout>"
+#line 120 "<stdout>"
 yy11:
                        ++YYCURSOR;
 #line 110 "calc_006.s.re"
                        { res = depth == 1 ? 0 : 2;     continue; }
-#line 124 "<stdout>"
+#line 125 "<stdout>"
 yy13:
                        ++YYCURSOR;
 #line 111 "calc_006.s.re"
                        { res = 1;                                      continue; }
-#line 129 "<stdout>"
+#line 130 "<stdout>"
 yy15:
                        ++YYCURSOR;
                        yych = *YYCURSOR;
@@ -141,7 +142,7 @@ yy17:
 yy19:
 #line 106 "calc_006.s.re"
                        { res = push_num(t, p, 8);      continue; }
-#line 145 "<stdout>"
+#line 146 "<stdout>"
 yy20:
                        ++YYCURSOR;
                        yych = *YYCURSOR;
index 3e47b8601d45c03b0a3d20db0d72c05960391a5d..66d5b368c86e5eeb79d3b1915c72a67035bfdc89 100755 (executable)
@@ -1,6 +1,7 @@
 /* Generated by re2c */
 #line 1 "calc_007.b.re"
 /* re2c lesson_001, calc_007, (c) M. Boerger 2006 */
+#line 8 "calc_007.b.re"
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -99,7 +100,7 @@ int scan(char *s)
                                  0,   0,   0,   0,   0,   0,   0,   0, 
                        };
 
-#line 103 "<stdout>"
+#line 104 "<stdout>"
                        {
                                YYCTYPE yych;
 
@@ -129,7 +130,7 @@ int scan(char *s)
 yy3:
 #line 79 "calc_007.b.re"
                                { continue; }
-#line 133 "<stdout>"
+#line 134 "<stdout>"
 yy4:
                                ++YYCURSOR;
                                if((yych = *YYCURSOR) <= '/') goto yy5;
@@ -137,7 +138,7 @@ yy4:
 yy5:
 #line 81 "calc_007.b.re"
                                { res = push_num(t, p, 10); continue; }
-#line 141 "<stdout>"
+#line 142 "<stdout>"
 yy6:
                                yych = *++YYCURSOR;
                                goto yy16;
@@ -145,22 +146,22 @@ yy7:
                                ++YYCURSOR;
 #line 82 "calc_007.b.re"
                                { res = stack_add();            continue; }
-#line 149 "<stdout>"
+#line 150 "<stdout>"
 yy9:
                                ++YYCURSOR;
 #line 83 "calc_007.b.re"
                                { res = stack_sub();            continue; }
-#line 154 "<stdout>"
+#line 155 "<stdout>"
 yy11:
                                ++YYCURSOR;
 #line 84 "calc_007.b.re"
                                { res = depth == 1 ? 0 : 2;     continue; }
-#line 159 "<stdout>"
+#line 160 "<stdout>"
 yy13:
                                ++YYCURSOR;
 #line 85 "calc_007.b.re"
                                { res = 1;                                      continue; }
-#line 164 "<stdout>"
+#line 165 "<stdout>"
 yy15:
                                ++YYCURSOR;
                                yych = *YYCURSOR;
@@ -177,7 +178,7 @@ yy17:
 yy19:
 #line 80 "calc_007.b.re"
                                { res = push_num(t, p, 8);      continue; }
-#line 181 "<stdout>"
+#line 182 "<stdout>"
 yy20:
                                ++YYCURSOR;
                                yych = *YYCURSOR;
index 28071b64d59dbfaaa7e6c4a53f264aaa1e43497f..3f0cc30b128187694b8beab270e9d7548eb5f8c3 100644 (file)
@@ -98,6 +98,7 @@ int Scanner::echo()
 {
     char *cursor = cur;
     bool ignore_eoc = false;
+    int  ignore_cnt = 0;
 
     if (eof && cursor == eof) // Catch EOF
        {
@@ -137,17 +138,26 @@ echo:
                                        goto echo;
                                }
        "*" "/" "\r"? "\n"      {
+                                       cline++;
                                        if (ignore_eoc) {
+                                               if (ignore_cnt) {
+                                                       out << sourceFileInfo;
+                                               }
                                                ignore_eoc = false;
+                                               ignore_cnt = 0;
                                        } else {
                                                out.write((const char*)(tok), (const char*)(cursor) - (const char*)(tok));
                                        }
-                                       tok = pos = cursor; cline++;
+                                       tok = pos = cursor;
                                        goto echo;
                                }
        "*" "/"         {
                                        if (ignore_eoc) {
+                                               if (ignore_cnt) {
+                                                       out << "\n" << sourceFileInfo;
+                                               }
                                                ignore_eoc = false;
+                                               ignore_cnt = 0;
                                        } else {
                                                out.write((const char*)(tok), (const char*)(cursor) - (const char*)(tok));
                                        }
@@ -155,7 +165,9 @@ echo:
                                        goto echo;
                                }
        "\n"            {
-                                       if (!ignore_eoc) {
+                                       if (ignore_eoc) {
+                                               ignore_cnt++;
+                                       } else {
                                                out.write((const char*)(tok), (const char*)(cursor) - (const char*)(tok));
                                        }
                                        tok = pos = cursor; cline++;
index 6305bde7ea7a33733cfcf95b9b04e0c57736c581..42d0a6e52e58e07ec528f150dc7c8322c4fd2b55 100755 (executable)
@@ -1,9 +1,10 @@
 /* Generated by re2c */
 #line 1 "config5.re"
 // ignored
+#line 7 "config5.re"
 // code
 
-#line 7 "<stdout>"
+#line 8 "<stdout>"
 {
        YYCTYPE yych;
 
@@ -22,7 +23,7 @@ yy2:
 yy3:
 #line 11 "config5.re"
        { return 0; }
-#line 26 "<stdout>"
+#line 27 "<stdout>"
 yy4:
        yych = *++YYCURSOR;
        goto yy3;
@@ -54,11 +55,13 @@ yy10:
        ++YYCURSOR;
 #line 10 "config5.re"
        { return 1; }
-#line 58 "<stdout>"
+#line 59 "<stdout>"
 }
 #line 13 "config5.re"
 
 // ignored
+#line 20 "config5.re"
 // max
 #define YYMAXFILL 3
-// eof
\ No newline at end of file
+#line 26 "config5.re"
+// eof
index 7d8c7d02605c58a02673ff2f3f0f2fe9f14c0d88..a6cfc5ffa898d54ca09c77b7c6208fc208e4ee69 100755 (executable)
@@ -23,4 +23,4 @@
   Ignored...
  
  */
-// eof
\ No newline at end of file
+// eof