[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: flex 2.5.4a -- Bug?
From: |
John W. Millaway |
Subject: |
Re: flex 2.5.4a -- Bug? |
Date: |
Sat, 1 Dec 2001 21:52:21 -0800 (PST) |
--- Nikos Balkanas <address@hidden> wrote:
> Specs: Linux Suse 6.2, kernel 2.2.10, flex 2.5.4 distribution, or 2.5.4a
> compliled from source, egcs-2.91.66.
>
> Code:
>
> %{
> #include <stdio.h>
> #include <ctype.h>
> #include <string.h>
>
> int lineno = 1;
> %}
>
> space [ \t]
> sp {space}+
> ws {space}*
> newline \n
>
> %option nounput
> %option noyymore
> %%
>
> {newline} { printf("Hello!\n"); }
> \n { printf("Wrong-->\n"); }
> . { ECHO; }
>
> %%
>
> Caveat: {newline} never expands correctly. Name of pattern doesn't matter.
> Output consists of echoed text + "Wrong->" in place of newlines. I traced it
> to the yy_accept array, which seems to be wrong. If I change the particular
> entry (from 2 to 1) and compile, I get lots of "Hello!"'s.
Flex issues a warning for the second rule, "\n", since it can never be matched.
The first rule, "{newline}" is the same as the second rule! Nevertheless, I
compiled flex version 2.5.4a and compiled the above input file, ignoring the
warning from flex. I saw the correct output, "Hello!", at the end of each line.
-John
__________________________________________________
Do You Yahoo!?
Buy the perfect holiday gifts at Yahoo! Shopping.
http://shopping.yahoo.com