[ragel-users] State chart style and entering actions

Shawn Hoover shawn at bighugh.com
Wed Jul 27 15:00:05 UTC 2011


Hello,

I'm using the state chart style for processing application logic. So far
I've gotten by with finishing actions attached to specific events, but now
I'd like to use an entering action for an entire labeled expression. Here's
an example:

machine := (
start: START -> A,
A: (IDLE -> A |
   POLL @poll OPEN -> A |
   POLL @poll CLOSED -> B), >~a_entry,
B: (IDLE -> B |
   EXIT -> final)
);

I would like to execute a_entry once and only once when the A "loop" is
entered. It does execute on entrance, but then it also executes every time I
get IDLE or POLL OPEN.

Is there a way to make a_entry execute only once while still using state
charts and the union operator in the same structure? I suppose the following
would work:

A: (IDLE | POLL @poll OPEN)* POLL @poll CLOSED -> B >~a_entry;

But I'd like to retain the original structure if there's a better way to
attach the action.

Thanks,
Shawn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.colm.net/pipermail/ragel-users/attachments/20110727/204b538d/attachment-0001.html>
-------------- next part --------------
_______________________________________________
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