Re: Problem with GIF file scanner (flex)

vern@daffy.ee.lbl.gov (Vern Paxson)
29 Jan 1997 11:53:32 -0500

          From comp.compilers

Related articles
Problem with GIF file scanner (flex) kxn@dcs.ed.ac.uk (1997-01-25)
Re: Problem with GIF file scanner (flex) WStreett@shell.monmouth.com (1997-01-26)
Re: Problem with GIF file scanner (flex) vern@daffy.ee.lbl.gov (1997-01-29)
| List of all articles for this month |

From: vern@daffy.ee.lbl.gov (Vern Paxson)
Newsgroups: comp.compilers
Date: 29 Jan 1997 11:53:32 -0500
Organization: Lawrence Berkeley National Laboratory, Berkeley CA
References: 97-01-197
Summary: not a flex bug
Keywords: flex

Kristian Nilssen <kxn@dcs.ed.ac.uk> wrote:
> For some
> unknown reason, flex will not enter the Logical_Screen_Descriptor
> ...
> %%
> %{
> BEGIN Header;
> %}


By putting the "BEGIN Header" as indented code at the beginning of the
rules, it's executed every time you call yylex. Since the rule used
to enter Logical_Screen_Descriptor ends with a return statement,
you're for sure reexecuting "BEGIN Header" before scanning the next
token, so you lose the Logical_Screen_Descriptor state and instead
wind up in "Header" again.


Either get rid of the return in the <Header> rule, or get rid of <Header>
entirely, along with the "BEGIN Header". With %x, you don't need to worry
about any conflicts between Header and Logical_Screen_Descriptor, anyway,
so there's no pressing need to have the header scanning be it's own start
condition.


                                Vern
[Oh. right. Oops. -John]


--


Post a followup to this message

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