> ~/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             |
|                          [EMAIL PROTECTED]                         |
-----------------------------------------------------------------------------


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
[EMAIL PROTECTED] . 
Trouble?  e-mail to [EMAIL PROTECTED] .

Reply via email to