FLEX <<EOF>> with yymore() token

"Bill Fenlason" <BillFen@Ulster.Net>
3 Jun 2001 17:02:00 -0400

          From comp.compilers

Related articles
FLEX <<EOF>> with yymore() token BillFen@Ulster.Net (Bill Fenlason) (2001-06-03)
| List of all articles for this month |
From: "Bill Fenlason" <BillFen@Ulster.Net>
Newsgroups: comp.compilers
Date: 3 Jun 2001 17:02:00 -0400
Organization: BiznessOnline.com, Inc.
Keywords: lex, question
Posted-Date: 03 Jun 2001 17:02:00 EDT

In FLEX, the current buffer is flushed immediately when EOF is encountered,
even if it contains a token pushed by yymore(). That means that something
like:
        <start_cond><<EOF>>{If (yyleng > 0) return(A_TOKEN) .... }
fails, because yyleng may be non-zero but yytext is null. The token is
copied to the start of the buffer but then overwritten by the buffer flush.


Short of using the -S option with a modified skeleton, is there a way
around this? I don't know if this is a (possibly known) bug or a
"feecher", but it seems to me that delaying the buffer flush in this
case would be a reasonable thing to do. The code makes a point that a
repeated call at EOF returns null again and that yytext was set up.
Allowing the residual token to be returned would be useful in my case.


Is FLEX still being maintained/developed?


Thanks - Bill Fenlason - billfen@ulster.net


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.