[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Possible flex-2.5.4 bug



> ~/flexbug $ cat foo2.l
> %array
> 
> %%
> "<"  { int c;
>        while ( (c = input()) != '>' && c != EOF )
>          ;    /* eat up text of comment */
>        if ( c == EOF ) printf( "\n" "error: EOF in comment\n" );
>      }
> foo  printf("bar");
> %%

> ~/flexbug $ echo "*** Here comes the bug. ***" > /dev/null
> ~/flexbug $ ./a.out "foo<bleh"
> bar
> error: EOF in comment
> input in flex scanner failed
> ~/flexbug $ echo "Notice that it died inside the yylex() call." > /dev/null
> ----------------------------------------------------------------------

But, since you have already read EOF in the scanner, and you have not 
returned from it, yylex will try to get a new character to continue 
parsing. But EOF has already appaered, so there's nothing in the buffer 
anymore. I think it's normal that you get an error on this. You either 
have to unput(EOF), or to 'return' from the scanner after the 
'printf("error\n");"....

Maarten

_____________________________________________________________________________
|     Maarten Boekhold, Faculty of Electrical Engineering TU Delft,   NL    |
|           Computer Architecture and Digital Technique section             |
|                          M.Boekhold@et.tudelft.nl                         |
-----------------------------------------------------------------------------


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: