[ragel-users] EOF actions and buffering
thurston at complang.org
Sat Jan 22 18:10:25 UTC 2011
On 11-01-20 06:52 PM, Benjamin van der Veen wrote:
> 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?
That is correct.
> 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?
You can do it manually. The ts pointer is set with what is essentially
an entering action. See cppscan2.rl for an example.
ragel-users mailing list
ragel-users at complang.org
More information about the ragel-users