|
Boost : |
From: Eric Niebler (eric_at_[hidden])
Date: 2005-09-15 00:59:47
Christopher Kohlhoff wrote:
> Hi Eric, Scott,
>
> Sorry if this is getting a bit off-topic for the xpressive review...
>
Mmm, drifting a bit, perhaps, but it's worth clearing this up.
> I'm not totally familiar with the xpressive API, but as far as I
> understand the regex APIs (even with iterators) are not sufficient for
> clean integration with async I/O.
>
> What you need is a stateful decoder that you can feed data to as you
> receive it off the wire, and it tells you when it is done, or when it
> needs you to feed it more data.
>
What you are describing, at least in regex terms, is a partial match.
Ordinarily, a regex match will give you a "yes" or a "no" answer. With a
partial match, you can get a "maybe" if the input sequence is exhausted
before the regex state machine has reached its final state. Boost.Regex
and xpressive both support partial matches via the match_partial switch,
which is documented (for Boost.Regex) here:
http://boost.org/libs/regex/doc/partial_matches.html
Note that TR1 regex does not support partial matches, for the simple
reason that we weren't able to come up with satisfactory standardese in
time.
-- Eric Niebler Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk