[ragel-users] How to call an 'action' from other 'action' ?
Eric Brown
yogieric at mac.com
Wed Feb 18 22:22:15 UTC 2009
Hi Iñaki,
On Feb 18, 2009, at 11:59 AM, Iñaki Baz Castillo wrote:
<snip>
> Ops, I've found a workaround:
>
> action _start { start = p }
> action _stop { stop = p-1 ; value = data[start..stop].pack('c*') ; }
> action set_user { user = value ; puts "---user=#{user}---" }
>
> user = ( unreserved | escaped | user_unreserved )+ >_start %stop
> %set_user ;
>
> As you see I use two leaving actions (%) in "user". It works but
> I've no idea
> about if it *should* really work. Any problem with it?
That is specifically supposed to work according to the ragel 6.3 PDF
manual.
About your original question -- calling one action from another -- I
don't think there is a way. Would be interesting if there was. Of
course actions can call other methods and if you use the "access" and
"variable" directives to put cs, p, pe, etc. in your object, you can
put your comment code in a method.
Cheers,
Eric
More information about the ragel-users
mailing list