[ragel-users] Re: State Chart Finishing Actions?

Bob Paddock graceindustries at gmail.com
Wed Feb 25 15:05:41 UTC 2009


On Mon, Apr 28, 2008 at 7:53 PM, Adrian Thurston <thurston at cs.queensu.ca> wrote:
>
> Hi Bob, you can use priorities to do this.
>
> (
>   'a' |
>   'b' |
>   'c' |
>   ...
> ) @1 |
> (
>   any @0
> )
>
> Though there really should be a guarded union operator that does this.

I'm not getting that to work.  Here is a simplified example,
(with several non-working tries commented out):

   blinks = (
       start: (
               SM2008_MODEL_EVENT -> SM2008_MODEL |
               SM2009_MODEL_EVENT -> SM2009_MODEL
              )@1 |
              (
#               any @(blink, 0)
               any $(blink, 0)
#               any @0
              )
#              )@blink


If I get any character besides 2008 or 2009 events I want to call the
action 'blink'.

I am never seeing blink called.  Machine always returns -1 on
non-2008/2009 events (blink never returns).

What is the correct syntax here?

>>     I think what you want instead of any* is [^>].
>>
>>
>> [^>] worked fine when I have a few states.
>> Is there a better way to do it if you have say
>> forty states that would be valid?




More information about the ragel-users mailing list