help-flex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strange behavior of PUSH / REJECT


From: john43
Subject: Re: Strange behavior of PUSH / REJECT
Date: Thu, 10 Jul 2003 11:51:01 -0400

>I think there is problem with flex version another but 
2.5.31
>
>I have the following
>
><Y>{
>.     {
>              YY_POP_STATE();
>              YY_PUSH_STATE(xxx)
>              REJECT;
>}
>}
>
><xxx>{
>.             {
>                      return T_SOmeToken;
>}
>
>.             {
>                      return T_Catchall;
>}
> 
>This is an excerpt.
>
>The parser is in a certain state, say Y, in which rule 
1 applies
>
>If the input is a character, say 'o',  it matches the 
rule 1 (compiled using 
>debug output of parser).  So The new state is pushed, 
after the old one (Y) 
>is popped.  I would expect the token T_SomeToken to 
be returned.
>
>However I notice that the CatchAll rule is matched ???
>
>the next character on the stream DOES match the xxx 
rule (because the state 
>seems indeed to be xxx.
>
>Is there a reason I miss why the xxx state pushing is 
only activated AFTER the 
>current character is parsed ?


REJECT doesn't work across across start condition 
boundaries. Solution: yyless(0). See the FAQ "How can I 
make REJECT cascade across start condition boundaries?
"

-John




reply via email to

[Prev in Thread] Current Thread [Next in Thread]