regex: fixes for STLPort in debug mode.

[SVN r8170]
This commit is contained in:
John Maddock
2000-11-11 12:08:55 +00:00
parent 8700307cf5
commit 31c9a1f9c6
2 changed files with 8 additions and 6 deletions

View File

@ -174,7 +174,8 @@ enum match_flags
match_partial = match_continuous << 1, // find partial matches match_partial = match_continuous << 1, // find partial matches
match_stop = match_partial << 1, // stop after first match (grep) 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
}; };

View File

@ -326,7 +326,7 @@ bool query_match_aux(iterator first,
temp_match.set_second(first); temp_match.set_second(first);
m.maybe_assign(temp_match); m.maybe_assign(temp_match);
match_found = true; 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 // either we don't care what we match or we've matched
// the whole string and can't match anything longer. // 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; cur_acc = ((re_repeat*)ptr)->id;
accumulators[cur_acc] = 0; accumulators[cur_acc] = 0;
start_loop[cur_acc] = iterator(); start_loop[cur_acc] = first;
} }
cur_acc = ((re_repeat*)ptr)->id; cur_acc = ((re_repeat*)ptr)->id;
@ -649,7 +649,7 @@ bool query_match_aux(iterator first,
} }
} }
// move to next item in list: // move to next item in list:
if(first != start_loop[cur_acc]) if((first != start_loop[cur_acc]) || !accumulators[cur_acc])
{ {
++accumulators[cur_acc]; ++accumulators[cur_acc];
ptr = ptr->next.p; ptr = ptr->next.p;
@ -704,7 +704,7 @@ bool query_match_aux(iterator first,
// otherwise see if we can take the repeat: // otherwise see if we can take the repeat:
if(((unsigned int)accumulators[cur_acc] < ((re_repeat*)ptr)->max) if(((unsigned int)accumulators[cur_acc] < ((re_repeat*)ptr)->max)
&& access::can_start(*first, ((re_repeat*)ptr)->_map, mask_take) && && 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: // move to next item in list:
++accumulators[cur_acc]; ++accumulators[cur_acc];
@ -1539,6 +1539,7 @@ bool regex_match(iterator first, iterator last, match_results<iterator, Allocato
m.set_base(first); m.set_base(first);
m.set_line(1, first); m.set_line(1, first);
} }
flags |= match_all; // must match all of input.
re_detail::_priv_match_data<iterator, Allocator> pd(m); re_detail::_priv_match_data<iterator, Allocator> pd(m);
iterator restart; iterator restart;
bool result = re_detail::query_match_aux(first, last, m, e, flags, pd, &restart); bool result = re_detail::query_match_aux(first, last, m, e, flags, pd, &restart);
@ -1550,7 +1551,7 @@ template <class iterator, class charT, class traits, class Allocator2>
bool regex_match(iterator first, iterator last, const reg_expression<charT, traits, Allocator2>& e, unsigned flags = match_default) bool regex_match(iterator first, iterator last, const reg_expression<charT, traits, Allocator2>& e, unsigned flags = match_default)
{ {
match_results<iterator> m; match_results<iterator> m;
return regex_match(first, last, e, flags); return regex_match(first, last, m, e, flags);
} }
// //
// query_match convenience interfaces: // query_match convenience interfaces: