[ragel-users] EOF actions and buffering

Benjamin van der Veen b at bvanderveen.com
Fri Jan 21 02:52:09 UTC 2011


Thanks for the tips, Adrian.

I've poked through the material you referenced and gleaned a bit. Please check my understanding and let me know if something is missing.

On Jan 20, 2011, at 3:43 PM, Adrian Thurston wrote:
> http://svn.complang.org/choicesocial/trunk/dsnpd/parser.rl

The parser impl referenced above uses an intermediary buffer; it clears the intermediary buffer on the "enter" action of a token to be extracted, copies each character of the token into a buffer on the "any" action, and when the "leaving" action is executed, the contents of that intermediary buffer are then copied into the destination string. Will this approach will work regardless of buffer boundaries?

> There are other approaches though. See the Ragel manual (5.9) for a short discussion.

This approach requires the user to make sure the ts pointer remains valid in the buffer provided each time the machine is executed (which depending on how you're handing IO may mean some memory copying). It allows an action to have access to the a contiguous block of memory (given by ts and fpc) which defines the matched token. Does this approach only work with the state chart syntax?






_______________________________________________
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