|
Boost Users : |
Subject: [Boost-users] [xpressive] Using it with input iterators or how far the backtracing will go back
From: Alex Dubov (oakad_at_[hidden])
Date: 2010-11-05 04:31:31
Greetings.
There exists a fairly common need to apply regexp matching to streams, rather
than to blocks of data. Streams are represented by input iterators, which have
no ability to decrement their value. On the other hand, xpressive requires a
bidirectional iterator, to go back and forth as required by backtracking (if I
understand correctly).
One approach to work around this limitation is to create an iterator adapter,
which will store a copy of every character delivered by input iterator and
provide expressive with bidi iterator to work with.
So the question is, how can one establish the size for this iterator adapter's
internal storage so as to avoid match failures due to incomplete storage and
avoid storing too much unnecessary data? I suppose, the storage can be reset
when the match is reported. This, however, still leaves an open problem for
situations where matches are separated by, possibly, gigabytes of non-matching
data.
Alternatively, may there be a way to relax the iterator requirements of the
xpressive library itself? If xpressive could be made to store partial match
data within its data structures, bidi iterators would not be strictly
necessary.
Thanks.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net