Re: [Flex-devel] [PATCH] Continued Actions and <<EOF>>
flex is a tool for generating scanners
Brought to you by:
wlestes
From: Will E. <wl...@us...> - 2008-02-17 15:56:40
|
Thanks for your report. Looks like a good catch. I've got to get a release out to address some serious problems with 2.5.34, so I'm going to fully investigate this after that work is done. ("Fully investigate" will include adding a test to catch this particular bug.) On Sunday, 17 February 2008, 5:35 am -0500, Michael Witten <mfw...@MI...> wrote: > Hello, > > Consider the following, in which the special continued action > symbol '|' refers to the action of an <<EOF>>: > > pattern | > <<EOF>> { /* some action */ } > > Unfortunately, this produces a buggy scanner, because an <<EOF>> > action's case block doesn't begin with a "YY_RULE_SETUP", so that > any regular rule that drops into that case block will not be properly > initialized. > > I have provided a patch that simply modifies build_eof_action() in parse.y > to check whether a YY_RULE_SETUP should be emitted for the previous rule > (before the <<EOF>> case statement). > > The patch can be accessed in 2 ways: > > (1) The attachment > (3) > https://sourceforge.net/tracker/download.php?group_id=97492&atid=618179&file_id=266698&aid=1895336 > > There is also an inlined version below, but the mailer renders it useless > unless you fill in the removed whitespace-only lines by hand. > > Please give your comments. > > Sincerely, > Michael Witten > > Index: parse.y > =================================================================== > RCS file: /cvsroot/flex/flex/parse.y,v > retrieving revision 2.50 > diff -u -8 -p -r2.50 parse.y > --- parse.y 15 Feb 2008 12:37:35 -0000 2.50 > +++ parse.y 17 Feb 2008 10:06:16 -0000 > @@ -963,16 +963,20 @@ void build_eof_action() > if ( sceof[scon_stk[i]] ) > format_pinpoint_message( > "multiple <<EOF>> rules for start condition %s", > scname[scon_stk[i]] ); > > else > { > sceof[scon_stk[i]] = true; > + > + if (previous_continued_action /* && previous action was regular */) > + add_action("YY_RULE_SETUP\n"); > + > snprintf( action_text, sizeof(action_text), "case YY_STATE_EOF(%s):\n", > scname[scon_stk[i]] ); > add_action( action_text ); > } > } > > line_directive_out( (FILE *) 0, 1 ); > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Flex-devel mailing list > Fle...@li... > https://lists.sourceforge.net/lists/listinfo/flex-devel -- Will Estes Flex Project Maintainer http://flex.sourceforge.net/ |