|
Boost-Commit : |
From: eric_at_[hidden]
Date: 2008-03-04 18:01:18
Author: eric_niebler
Date: 2008-03-04 18:01:17 EST (Tue, 04 Mar 2008)
New Revision: 43506
URL: http://svn.boost.org/trac/boost/changeset/43506
Log:
fix bad interaction between boyer-moore optimization and partial match feature, fixes #1564
Text files modified:
trunk/boost/xpressive/detail/core/finder.hpp | 5 +++++
trunk/boost/xpressive/detail/core/regex_impl.hpp | 1 +
trunk/boost/xpressive/proto/matches.hpp | 2 +-
trunk/boost/xpressive/regex_algorithms.hpp | 5 +++--
4 files changed, 10 insertions(+), 3 deletions(-)
Modified: trunk/boost/xpressive/detail/core/finder.hpp
==============================================================================
--- trunk/boost/xpressive/detail/core/finder.hpp (original)
+++ trunk/boost/xpressive/detail/core/finder.hpp 2008-03-04 18:01:17 EST (Tue, 04 Mar 2008)
@@ -36,6 +36,11 @@
{
}
+ bool ok_for_partial_matches() const
+ {
+ return false;
+ }
+
bool operator ()(match_state<BidiIter> &state) const
{
Traits const &traits = traits_cast<Traits>(state);
Modified: trunk/boost/xpressive/detail/core/regex_impl.hpp
==============================================================================
--- trunk/boost/xpressive/detail/core/regex_impl.hpp (original)
+++ trunk/boost/xpressive/detail/core/regex_impl.hpp 2008-03-04 18:01:17 EST (Tue, 04 Mar 2008)
@@ -31,6 +31,7 @@
: counted_base<finder<BidiIter> >
{
virtual ~finder() {}
+ virtual bool ok_for_partial_matches() const { return true; }
virtual bool operator ()(match_state<BidiIter> &state) const = 0;
};
Modified: trunk/boost/xpressive/proto/matches.hpp
==============================================================================
--- trunk/boost/xpressive/proto/matches.hpp (original)
+++ trunk/boost/xpressive/proto/matches.hpp 2008-03-04 18:01:17 EST (Tue, 04 Mar 2008)
@@ -422,7 +422,7 @@
/// is \c true and \c E matches \c U; or, if
/// <tt>when\<_,T\>::::result\<void(E,int,int)\>::::type::value</tt>
/// is \c false and \c E matches \c V. (Note: \c U defaults to \c _
- /// and \c V defaults to \c not\<_\>.)
+ /// and \c V defaults to \c not_\<_\>.)
/// \li An expression \c E matches <tt>not_\<T\></tt> if \c E does
/// not match \c T.
/// \li An expression \c E matches <tt>switch_\<C\></tt> if
Modified: trunk/boost/xpressive/regex_algorithms.hpp
==============================================================================
--- trunk/boost/xpressive/regex_algorithms.hpp (original)
+++ trunk/boost/xpressive/regex_algorithms.hpp 2008-03-04 18:01:17 EST (Tue, 04 Mar 2008)
@@ -81,7 +81,8 @@
// handle partial matches
else if(state.found_partial_match_ && 0 != (flags & regex_constants::match_partial))
{
- return state.set_partial_match(), true;
+ state.set_partial_match();
+ return true;
}
}
@@ -256,7 +257,7 @@
}
// If we have a finder, use it to find where a potential match can start
- else if(impl.finder_)
+ else if(impl.finder_ && (!partial_ok || impl.finder_->ok_for_partial_matches()))
{
finder<BidiIter> const &find = *impl.finder_;
if(find(state))
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk