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

Carlos Antunes cmantu... at gmail.com
Mon Nov 6 07:42:43 UTC 2006

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; }.


"We hold [...] that all men are created equal; that they are
endowed [...] with certain inalienable rights; that among
these are life, liberty, and the pursuit of happiness"
        -- Thomas Jefferson

More information about the ragel-users mailing list