[ragel-users] Figuring out/referring to FSM states (cs values) outside of action{} blox
Adrian Thurston
adrian.thurston at esentire.com
Wed Nov 18 16:38:01 UTC 2009
The problem with doing this in Ragel is that any particular named
machine definition may correspond to more than one state in the compiled
output. Therefore, a variable to be used outside of the machine would
actually have to be a set of states.
For this reason, Ragel does not automate the process. Instead, what you
should do is use actions to maintain a state variable that has meaning
outside the FSM.
-Adrian
Rashid Karimov wrote:
> Folx,
>
> Say I have a machine defined with a number of states in it:
>
> S1 (
>
> Event1 -> S2 ),
>
> S2 (
>
> Event2 -> S3),
>
> ..... and so on .
>
> I access cs as blah->cs .
>
>
> If I want to figure out and/or modify , outside of FMS action{} code
> blocks, if the current state is S2 or S3,
> how do I find out what S2 and S3 translate to, in terms of context->cs
> value ?
>
> Outside of exporting FSM as an XML and then going over it, is there a
> way to ask Ragel to "export" the state
> mappings ? Similar to the way one can import event definitions like so:
>
> #define Event1 'a'
> #define Event2 'b'
>
> can Ragel export state cs values like so:
>
> #define S1 1
> #define S2 2
>
> Again, one could use Ragel's dot or XML output to figure out what
> different states translate to in terms of cs values
> and then map them manually, but I was hoping there's a different, more
> automated way to go about it.
>
> When/if the FSM definition is modified - new states included, existing
> states deleted, etc, such manual definitions
> would clearly get out of sync and this is what I am trying to avoid.
>
>
> TY
> Rashid
>
>
>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ragel-users mailing list
> ragel-users at complang.org
> http://www.complang.org/mailman/listinfo/ragel-users
More information about the ragel-users
mailing list