|Flex and EOF email@example.com (Matteo Corti) (2006-04-08)|
|Re: Flex and EOF firstname.lastname@example.org (Chris Dodd) (2006-04-09)|
|Re: Flex and EOF email@example.com (Russ Cox) (2006-04-09)|
|Re: Flex and EOF firstname.lastname@example.org (Michael Tiomkin) (2006-04-09)|
|Re: Flex and EOF DrDiettrich@compuserve.de (Hans-Peter Diettrich) (2006-04-10)|
|Re: Flex and EOF email@example.com (Matteo Corti) (2006-04-12)|
|Re: Flex and EOF firstname.lastname@example.org (Ira Baxter) (2006-04-12)|
|From:||Chris Dodd <email@example.com>|
|Date:||9 Apr 2006 16:59:21 -0400|
|Posted-Date:||09 Apr 2006 16:59:21 EDT|
Matteo Corti <firstname.lastname@example.org> wrote in news:email@example.com:
> 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.
What's wrong with just doing
#.* /* skip comments */
The only difference between this rule and the rule above is that it will
match a comment at the end of the input without a following newline. The
longest match rule means you'll always get the entire comment up to the
end of the line or file.
Return to the
Search the comp.compilers archives again.