[ragel-users] Actions embedded into unexpected transitions?

Dmitry Marakasov amdmi3 at amdmi3.ru
Fri Jan 23 22:02:20 UTC 2009


Hi!

I have a question about transition action embedding. It behaves
not the way I expect, so I'm obviously missing something. Here's
a simple example:

%%{
    machine foo;
    write data nofinal;

    a = 'a'+
        > { printf("> a\n"); }
        % { printf("< a\n"); }
    ;

    b = a 'b'+
        > { printf("> b\n"); }
        % { printf("< b\n"); }
    ;

    main := b+;
}%%

When I run it on a string 'aabbaabb', it prints

> a
< a
> b
< b
> a
< a
> b

While I obviously expect

> b
> a
< a
< b
> b
> a
< a
< b

because you can't enter 'a' rules not entering 'b' rule. Missing
last transition is not a huge problem, but the order is essential.

Is there a trick to make it behave the way I want, or I do I not
understand something fundamental?

-- 
Dmitry Marakasov   .   55B5 0596 FF1E 8D84 5F56  9510 D35A 80DD F9D2 F77D
amdmi3 at amdmi3.ru  ..:  jabber: amdmi3 at jabber.ru    http://www.amdmi3.ru




More information about the ragel-users mailing list