From: helly Date: Fri, 20 Jan 2006 20:50:22 +0000 (+0000) Subject: - Detect eof in comment X-Git-Tag: 0.13.6~494 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3a12ce6fdde7d50ea4d4ae9bb27a4f53e7ef4e80;p=re2c - Detect eof in comment --- diff --git a/bootstrap/scanner.cc b/bootstrap/scanner.cc index d4a87c02..515e38e9 100644 --- a/bootstrap/scanner.cc +++ b/bootstrap/scanner.cc @@ -1,4 +1,4 @@ -/* Generated by re2c 0.10.0.dev on Fri Jan 20 21:17:47 2006 */ +/* Generated by re2c 0.10.0.dev on Fri Jan 20 21:46:02 2006 */ #line 1 "scanner.re" /* $Id$ */ #include @@ -805,8 +805,9 @@ yy132: if((yych = *YYCURSOR) == '/') goto yy140; yy133: #line 281 "scanner.re" - { goto comment; } -#line 810 "scanner.cc" + { if(cursor == eof) RETURN(0); + goto comment; } +#line 811 "scanner.cc" yy134: yych = *++YYCURSOR; if(yych == '*') goto yy138; @@ -818,7 +819,7 @@ yy135: tok = pos = cursor; cline++; goto comment; } -#line 822 "scanner.cc" +#line 823 "scanner.cc" yy137: yych = *++YYCURSOR; goto yy133; @@ -828,7 +829,7 @@ yy138: { ++depth; fatal("ambiguous /* found"); goto comment; } -#line 832 "scanner.cc" +#line 833 "scanner.cc" yy140: ++YYCURSOR; #line 270 "scanner.re" @@ -836,14 +837,14 @@ yy140: goto scan; else goto comment; } -#line 840 "scanner.cc" +#line 841 "scanner.cc" } -#line 282 "scanner.re" +#line 283 "scanner.re" config: -#line 847 "scanner.cc" +#line 848 "scanner.cc" { YYCTYPE yych; if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); @@ -860,25 +861,25 @@ yy144: yych = *YYCURSOR; goto yy153; yy145: -#line 286 "scanner.re" +#line 287 "scanner.re" { goto config; } -#line 866 "scanner.cc" +#line 867 "scanner.cc" yy146: ++YYCURSOR; yych = *YYCURSOR; goto yy151; yy147: -#line 287 "scanner.re" +#line 288 "scanner.re" { iscfg = 2; cur = cursor; RETURN('='); } -#line 877 "scanner.cc" +#line 878 "scanner.cc" yy148: ++YYCURSOR; -#line 291 "scanner.re" +#line 292 "scanner.re" { fatal("missing '='"); } -#line 882 "scanner.cc" +#line 883 "scanner.cc" yy150: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); @@ -896,12 +897,12 @@ yy153: if(yych == ' ') goto yy152; goto yy145; } -#line 292 "scanner.re" +#line 293 "scanner.re" value: -#line 905 "scanner.cc" +#line 906 "scanner.cc" { YYCTYPE yych; unsigned int yyaccept = 0; @@ -935,13 +936,13 @@ value: } } yy156: -#line 301 "scanner.re" +#line 302 "scanner.re" { cur = cursor; yylval.str = new Str(token()); iscfg = 0; return VALUE; } -#line 945 "scanner.cc" +#line 946 "scanner.cc" yy157: ++YYCURSOR; if((yych = *YYCURSOR) <= 0x0D) { @@ -956,13 +957,13 @@ yy157: } } yy158: -#line 296 "scanner.re" +#line 297 "scanner.re" { cur = cursor; yylval.number = atoi(token().to_string().c_str()); iscfg = 0; return NUMBER; } -#line 966 "scanner.cc" +#line 967 "scanner.cc" yy159: yych = *++YYCURSOR; if(yych <= '0') goto yy163; @@ -1142,7 +1143,7 @@ yy177: if(yych == 0x0A) goto yy170; goto yy174; } -#line 306 "scanner.re" +#line 307 "scanner.re" } diff --git a/scanner.re b/scanner.re index b6fd6b10..16e957b5 100644 --- a/scanner.re +++ b/scanner.re @@ -278,7 +278,8 @@ comment: tok = pos = cursor; cline++; goto comment; } - any { goto comment; } + any { if(cursor == eof) RETURN(0); + goto comment; } */ config: