[ragel-users] foreach character?

Gordon Smith spider.karma+ragel-users at gmail.com
Thu Jun 11 16:56:12 UTC 2009


On Thu, Jun 11, 2009 at 8:41 AM, Adrian Thurston <
adrian.thurston at esentire.com> wrote:

> Like so:
>
> a_packet = 'a:' Part1 ':' Part2 ':' Part3 '\r' ${crcUpdate(*p);};
>
> -Adrian
>

Thanks. It's surprising how far such a straightforward statement on your
part can go, even if I've read the user guide.

For any other newbies, I think my difficulty was/is understanding operator
boundaries. For example:

    asub_packet = 'cde';
    a_packet = 'a:' asub_packet ':b' ${ std::cout << "crc(" << ( * p) <<
")\n"; };

with input "a:cde:b" provides only
    crc(:)
    crc(b)
( the "all transition operator" '$' operating only on the prior basic
machine ':b'?)

while operating on a group provides all characters:
    asub_packet = 'cde';
    a_packet = ( 'a:' asub_packet ':b' ) ${ std::cout << "crc(" << ( * p) <<
")\n"; };


>
> Gordon Smith wrote:
> > Hello -
> >
> > I have a functioning machine, a portion of which is below.
> >
> > %%{
> >     a_packet = 'a:' Part1 ':' Part2 ':' Part3 '\r';
> >
> >     main := ( a_packet | b_packet | c_packet )+;
> > }%%
> >
> > Out of curiosity, is there a way to easily examine every input character
> > in order to calculate a running CRC value for "a_packet", for example?
> > Perhaps something like an action prior to the p++ operation?
> >
> > Thanks,
> > Gordon
> >
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > ragel-users mailing list
> > ragel-users at complang.org
> > http://www.complang.org/mailman/listinfo/ragel-users
>
> _______________________________________________
> ragel-users mailing list
> ragel-users at complang.org
> http://www.complang.org/mailman/listinfo/ragel-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.colm.net/pipermail/ragel-users/attachments/20090611/d400116b/attachment-0001.html>


More information about the ragel-users mailing list