[ragel-users] Re: Fixing an edge case

Adrian Thurston thurs... at cs.queensu.ca
Wed Jan 17 01:47:55 UTC 2007

Matt Mower wrote:
>> diff2 = (
>>         diffHeader %empty_diff %/empty_diff |
>>         diffHeader ( binaryDiff | textDiff )
>> );
> Interesting, so it can track that the leaving action should only
> happen when neither of the non-empty diff paths is taken after
> reduction? My gut feeling would have been that it would end up
> executing them every time. I shall have to graph it and take a look.

Leaving actions initially go into final states. They stay there, inactive,
until transitions are made which leave the machine from those final states.
This leaving is either by concatenation or by kleene star. So the
%empty_diff is left alone by the union, but when kleene star is applied to
diff2 it is transferred to the transition which wraps around and starts
diff2 over again.

If you were to use the @ action embedding operator then it would be executed
on the final character of diffHeader in both cases because it goes right
into transitions. It is not 'pending' as is the % operator.


More information about the ragel-users mailing list