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

On 13-10-13 03:14 PM, e...@makechip.com wrote:

Hi -

I would like to construct a scanner like the following:

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@complang.org
http://www.complang.org/mailman/listinfo/ragel-users


_______________________________________________
ragel-users mailing list
ragel-users@complang.org
http://www.complang.org/mailman/listinfo/ragel-users

Reply via email to