
Hi Christopher, On 9/15/05, Christopher Kohlhoff <chris@kohlhoff.com> wrote: [snip]
From my reading of the documentation, if I get a partial match and I want to continue to try for a full match I must buffer the entire data from the beginning of the partial match. This means that in the partial_regex_grep example it cannot find a substring match that is greater then 4096 characters long, because that is all the data it will buffer.
the same for spirit (If I'm wrong then I'm using it very inefficiently)
Furthermore, each time I want to retest the input against the expression it must process the whole input string again. This is not ideal from an efficiency point of view, since I could potentially receive input data one byte at a time.
indeed
What I want is a stateful regular expression-based decoder object (since in theory it's just a state machine and can remember its current state). I can feed it more input which will cause more state transitions, and it will tell me when it reaches a terminal state. I never have to buffer more input than the block just read because earlier input will have been fully consumed by the decoder.
IMO, it would be needed the possibility to have more than one grammar, one for success and another for failure(Would be interesting to have the possibility for more than two), until no-one has a match continue to wait for more data...
As I said, this is an area I am very interested in exploring further when time permits (and not just in relation to regular expressions, but also things like Boost.Serialization), but that definitely belongs in its own thread.
IMO, it should be another library that should be able to interact with AIO, spirit and xpressive. I already own some helper classes for something like this, when they're called from the AIO components, they forward to the grammars and verify success or failure, but they re-do all the grammar processing again. I would be willing to volunteer to help in a library like this, since I use it a lot for processing protocols with AIO(sockets) and spirit and already have some code writed. However, I dont have enough time to create such a library all by myself.
Cheers, Chris
best regards, -- Felipe Magno de Almeida Developer from synergy and Computer Science student from State University of Campinas(UNICAMP). Unicamp: http://www.ic.unicamp.br Synergy: http://www.synergy.com.br "There is no dark side of the moon really. Matter of fact it's all dark."