[ragel-users] Re: fexec bug in v5.15?

Adrian Thurston thurs... at cs.queensu.ca
Wed Nov 8 18:55:59 UTC 2006

As separate statements it doable but it would require control flow analysis 
of the host language in order to determine if one statement comes after the 
other. Control flow analysis is a huge undertaking, one that I would have to 
say is too much for Ragel.

But combination statements that hold and return would work.


Carlos Antunes wrote:
> On 11/6/06, Adrian Thurston <thurs... at cs.queensu.ca> wrote:
>> As it turns out, it's not safe to manipulate the current pointer in
>> pattern actions. I had realized this recently and in 5.15 an error is
>> emitted if you use fhold in a pattern action. It didn't occur to me that
>> I have to do the same for fexec. I should also put a warning in the docs
>> about directly manipulating p in pattern actions.
>> The reason is that as a part of restarting the scanner, it's sometimes
>> necessary to manipulate p. Sometimes you need to shift it back one.
>> Other times you need to set it to tokend. Other times you don't need to
>> do anything at all. This all depends on the contents of the patterns. So
>> if you change p first, you mess the scanner up in ways that are hard to
>> predict.
> Ok, I see. Maybe fhold and fexec could be allowed in those cases where
> the scanner doesn't need to restart? For example { fret; fhold; } or {
> fnext whatever; fexec tokstart; }? Basically, fhold and fexec could be
> specified in all situations where the scanner knows it wouldn't be
> restarted. Is this doable? Obviously, it would also be nice to specify
> as an example { fhold; fret } and get the same behavior as { fret;
> fhold; }.
> Carlos

More information about the ragel-users mailing list