[ragel-users] more or less solved -- Overfrequent/premature call of 'on-exit-transition' action
Adrian Thurston
thurston at complang.org
Sat Sep 12 03:20:27 UTC 2009
Hey Bernie,
You could do it like this. You'll have to remember to decrement
dataRemaining by two bytes first.
dataBlock =
0 Word16b @storeSamplesPerBlock
(Word16b @storeData when dataRemaining)*
(Word16b @storeData when !dataRemaining)
@processCompleteMessage;
One problem with this is that it assumes you've got at least one 2-byte
sample in each block. Is that an acceptable assumption?
-Adrian
Bernie Pallek wrote:
> Bernie Pallek wrote:
>> <cid:part1.03050701.01060104 at brytech.com>Hello,
>>
>> We are working on a parser for data blocks, and we've encountered some
>> confusion. An action is being taken more frequently than expected (or
>> prematurely). We've attached a few files that should be helpful (in
>> addition to the original Ragel script). The PNG has been painted on to
>> show where the unexpected action (circled in red) is expected to
>> appear on the graph (end of red arrow).
>> ...
> Well, it looks like we've overcome our various problems. In the end, the
> most significant consideration was using '%' instead of '@' to trigger
> the "processCompleteMessage" action. It's not ideal, because I'd prefer
> to call the action after having received the expected number of samples,
> as opposed to on transition to the start of the next block. In other
> words, if we receive exactly one block's worth of data, we won't process
> that block until at least one more byte enters the parser. Any
> recommendations on implementing a scheme like that would be appreciated.
> (If you hadn't guessed, I've been only been working with Ragel for about
> 24 hours so far, so I apologize if I'm clogging the list with stupid
> questions).
>
> Cheers,
>
> - bernie
>
>
> _______________________________________________
> 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