Discussion:
[ragel-users] Question on ragel
eric
2013-10-13 19:14:18 UTC
Permalink
An HTML attachment was scrubbed...
URL: <http://www.complang.org/pipermail/ragel-users/attachments/20131013/0dd2dd95/attachment.html>
Adrian Thurston
2013-11-24 17:59:11 UTC
Permalink
You're right it won't work because the fcall transfers control
immediately. The fbreak is unreachable.

Try saving the return point to a var using the scanner name, changing
the fcall to fnext and then use fgoto (return_point) in place of the fret.

Adrian
Hi -
main := |*
A { fcall m1; fbreak; }
*|;
m1 := |*
B { fcall m2; fbreak; }
*|;
m2 := |*
C { fret; fret; fbreak; }
*|;
Although ragel will compile this, the generated C-code looks
like it will not work like I intend. There are two problems.
One I would like machine C to return back to main, but I don't
want to use fgoto because in the general case it may be a different
scanner that needs to be returned to. The other problem
is that I don't think the fbreaks will work. I really want to
return a token, then perform the fcall, or fret. Is this
even possible?
Thanks,
Eric West
_______________________________________________
ragel-users mailing list
ragel-users at complang.org
http://www.complang.org/mailman/listinfo/ragel-users
Loading...