[ragel-users] How to process a block of random sized data

Ming Fu Ming.Fu at esentire.com
Thu Nov 1 09:27:28 UTC 2018

Hi Adrian,

I was worried about the case when the input is not in contiguous memory. I will need to call the finish when the input is at the end of a block and restart class at the beginning of next block. Is there a way to know the current *p is the last byte of a block?


From: Adrian Thurston <thurston at colm.net>
Sent: November 1, 2018 7:53 AM
To: ragel-users at colm.net
Cc: Ming Fu <Ming.Fu at esentire.com>
Subject: Re: [ragel-users] How to process a block of random sized data

Hi Ming,

Ragel has no support for this built in. I use a class for this that tracks the start of the interesting input and flushes it out when necessary. The start and finish functions are called from ragel actions. The preExec and postExec functions are called before and after the ragel write exec. See attached example.

In my uses I expand it to include start and finish functions on the expensive thing (also a stream processor), and I can also pause it to skip over some data that shouldn't go to expensive thing.

I've often thought about building this support into ragel, but once you've got the class made it's super easy to reuse it in many different cases.



On 2018-10-31 16:48, Ming Fu wrote:

I have the following ragel rule:

any* $(

However, I do not necessary have to make the some_expensive_call per input char, I can call some_less_expensive_call(*p, len) to be more efficient.
How do I figure out the len and adjust pe. Consider the input may not be in contiguous memory block.



ragel-users mailing list

ragel-users at colm.net<mailto:ragel-users at colm.net>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.colm.net/pipermail/ragel-users/attachments/20181101/a061a47e/attachment-0001.html>

More information about the ragel-users mailing list