From 31c9a1f9c6001656b5a9691fe64dba19cf701315 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Sat, 11 Nov 2000 12:08:55 +0000 Subject: [PATCH] regex: fixes for STLPort in debug mode. [SVN r8170] --- include/boost/cregex.hpp | 3 ++- include/boost/re_detail/regex_match.hpp | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/include/boost/cregex.hpp b/include/boost/cregex.hpp index a024245f..b0b54185 100644 --- a/include/boost/cregex.hpp +++ b/include/boost/cregex.hpp @@ -174,7 +174,8 @@ enum match_flags match_partial = match_continuous << 1, // find partial matches match_stop = match_partial << 1, // stop after first match (grep) - match_max = match_stop + match_all = match_stop << 1, // must find the whole of input even if match_any is set + match_max = match_all }; diff --git a/include/boost/re_detail/regex_match.hpp b/include/boost/re_detail/regex_match.hpp index 7ca0773c..02ef0824 100644 --- a/include/boost/re_detail/regex_match.hpp +++ b/include/boost/re_detail/regex_match.hpp @@ -326,7 +326,7 @@ bool query_match_aux(iterator first, temp_match.set_second(first); m.maybe_assign(temp_match); match_found = true; - if((flags & match_any) || ((first == last) && (need_push_match == false))) + if(((flags & match_any) && ((first == last) || !(flags & match_all))) || ((first == last) && (need_push_match == false))) { // either we don't care what we match or we've matched // the whole string and can't match anything longer. @@ -608,7 +608,7 @@ bool query_match_aux(iterator first, { cur_acc = ((re_repeat*)ptr)->id; accumulators[cur_acc] = 0; - start_loop[cur_acc] = iterator(); + start_loop[cur_acc] = first; } cur_acc = ((re_repeat*)ptr)->id; @@ -649,7 +649,7 @@ bool query_match_aux(iterator first, } } // move to next item in list: - if(first != start_loop[cur_acc]) + if((first != start_loop[cur_acc]) || !accumulators[cur_acc]) { ++accumulators[cur_acc]; ptr = ptr->next.p; @@ -704,7 +704,7 @@ bool query_match_aux(iterator first, // otherwise see if we can take the repeat: if(((unsigned int)accumulators[cur_acc] < ((re_repeat*)ptr)->max) && access::can_start(*first, ((re_repeat*)ptr)->_map, mask_take) && - (first != start_loop[cur_acc])) + ((first != start_loop[cur_acc]) || !accumulators[cur_acc])) { // move to next item in list: ++accumulators[cur_acc]; @@ -1539,6 +1539,7 @@ bool regex_match(iterator first, iterator last, match_results pd(m); iterator restart; bool result = re_detail::query_match_aux(first, last, m, e, flags, pd, &restart); @@ -1550,7 +1551,7 @@ template bool regex_match(iterator first, iterator last, const reg_expression& e, unsigned flags = match_default) { match_results m; - return regex_match(first, last, e, flags); + return regex_match(first, last, m, e, flags); } // // query_match convenience interfaces: