[ragel-users] Consuming input

Adrian Thurston thurston at complang.org
Thu Apr 7 21:11:26 UTC 2011


See the attached code. Note the "| any*". This is a trick to make ragel 
accept any prefix of the machine. But it only works in this case because 
you want the machine to accept any string at all. What is really needed 
is an any-prefix operator (in the TODO for years).

If this is too cryptic, you may want to consider using state charts.

-Adrian

On 04/06/2011 06:47 AM, Wilson Barros wrote:
> main:='O'@init ((any-[CTRDH])*
> ('C'$ccaOn(any-'c')*'c'$ccaOff
> |'T'$txOn(any-'t')*'t'$txOff
> |'R'$rxOn(any-'r')*'r'$rxOff
> |'D'$dozeOn(any-'A')*'A'$dozeOff
> |'H'$hibOn(any-'A')*'A'$hibOff #)
> )*;

-- 
Adrian D. Thurston
http://www.complang.org/thurston/
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: modem.rl
URL: <http://www.colm.net/pipermail/ragel-users/attachments/20110407/81c2e0c9/attachment-0001.ksh>
-------------- 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