making fgoto a no-op

Martin Pirker Martin.Pir... at
Tue Apr 22 12:19:39 UTC 2008


On Apr 21, 10:50 am, Adrian Thurston <thurs... at> wrote:
> In the -G2 machine cs isn't always kept up to date inside the execution
> loop.

I guessed that my approach is not portable across all backends,
thanks for confirming.

> You could init another variable using
> int targ_cs = ftargs;
> and then base the logic on that.

By expanding the logic in check_data action I can easily test for a
return value and then fgoto to error if needed. Unfortunately, this
require duplication of this logic in every similar action in the .rl
which I want to prevent (bloating, languages portability)

Instead of the cs hack I could pass ftargs or fcurs as another
to the native language side, return the desired target as return value
then always fgoto.
This approach does not work in case of something like:
... ("whatever" %check_data)*  %something "newinput" ...
In case of no error the fgoto omits %something and continues
at newinput (=next state), thus the fgoto is never a real no-op.
(As far as my experiments showed).

I guess I have to sleep over this once more... :-)


More information about the ragel-users mailing list