Flex and EOF

Matteo Corti <matteo.corti@gmail.com>
8 Apr 2006 16:45:27 -0400

          From comp.compilers

Related articles
Flex and EOF matteo.corti@gmail.com (Matteo Corti) (2006-04-08)
Re: Flex and EOF cdodd@acm.org (Chris Dodd) (2006-04-09)
Re: Flex and EOF rsc@swtch.com (Russ Cox) (2006-04-09)
Re: Flex and EOF tmk@netvision.net.il (Michael Tiomkin) (2006-04-09)
Re: Flex and EOF DrDiettrich@compuserve.de (Hans-Peter Diettrich) (2006-04-10)
Re: Flex and EOF matteo.corti@gmail.com (Matteo Corti) (2006-04-12)
Re: Flex and EOF idbaxter@semdesigns.com (Ira Baxter) (2006-04-12)
| List of all articles for this month |

From: Matteo Corti <matteo.corti@gmail.com>
Newsgroups: comp.compilers
Date: 8 Apr 2006 16:45:27 -0400
Organization: ETH Zurich
Keywords: lex, question
Posted-Date: 08 Apr 2006 16:45:27 EDT


I have a rule in my lexer to skip shell-like comments:

#.*$ /* skip comments */

which works just fine if there is \n at the end of the line.
If the comment is in the last line wich is terminated by EOF the rule
obviously fails.

I tried something like:


but flex complains about an "unrecognized rule". Any hint?

Many thanks,
Matteo Corti
ETH Zurich
[I don't know of a clean way to handle it. Maybe fiddle with the input
reading code to stuff in a \n at the end of the file. -John]

Post a followup to this message

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