regex: Fixed spurious matches when grepping with .*

[SVN r9686]
This commit is contained in:
John Maddock
2001-03-31 11:24:27 +00:00
parent fac0fa6653
commit 020cbe902e
3 changed files with 22 additions and 0 deletions

View File

@ -1,3 +1,7 @@
Version 305:
FIXED: SunPro 6.1 support
FIXED: Spurious extra matches at the end of input when grepping with .*
Version 304: Version 304:
FIXED: Missing this-> prefix to some symbols in cpp_regex_traits.cpp FIXED: Missing this-> prefix to some symbols in cpp_regex_traits.cpp
CHANGED: Error reporting for wide character tests. CHANGED: Error reporting for wide character tests.
@ -238,5 +242,6 @@ BUG: character sets don't function correctly when regbase::char_classes

View File

@ -762,6 +762,8 @@ a+ "...aaa,,," $0 aaa
a+ "...aaa,,," $1 "" a+ "...aaa,,," $1 ""
a+ "...aaa,,," $15 "" a+ "...aaa,,," $15 ""
(a+)b+ "...aaabbb,,," $1 aaa (a+)b+ "...aaabbb,,," $1 aaa
[[:digit:]]* 123ab <$0> <123><><><>
[[:digit:]]* 123ab1 <$0> <123><><><1>
; and now escapes: ; and now escapes:
a+ "...aaa,,," $x "$x" a+ "...aaa,,," $x "$x"
@ -868,3 +870,4 @@ a+(?#b+)b+ xaaabbba 1 7

View File

@ -1113,6 +1113,8 @@ unsigned int reg_grep2(Predicate foo, I first, I last, const reg_expression<char
++cmatches; ++cmatches;
if(foo(m) == false) if(foo(m) == false)
return cmatches; return cmatches;
if(m[0].second == last)
return cmatches;
// update to end of what matched // update to end of what matched
// trying to match again with match_not_null set if this // trying to match again with match_not_null set if this
// is a null match... // is a null match...
@ -1201,6 +1203,8 @@ unsigned int reg_grep2(Predicate foo, I first, I last, const reg_expression<char
pd.temp_match.init_fail(next_base, last); pd.temp_match.init_fail(next_base, last);
m.init_fail(next_base, last); m.init_fail(next_base, last);
j = 0; j = 0;
if(m[0].second == last)
return cmatches;
} }
else else
{ {
@ -1213,6 +1217,8 @@ unsigned int reg_grep2(Predicate foo, I first, I last, const reg_expression<char
++cmatches; ++cmatches;
if(foo(m) == false) if(foo(m) == false)
return cmatches; return cmatches;
if(m[0].second == last)
return cmatches;
// update to end of what matched // update to end of what matched
_skip_and_inc(clines, last_line, first, m[0].second); _skip_and_inc(clines, last_line, first, m[0].second);
next_base = m[0].second; next_base = m[0].second;
@ -1247,6 +1253,8 @@ unsigned int reg_grep2(Predicate foo, I first, I last, const reg_expression<char
++cmatches; ++cmatches;
if(foo(m) == false) if(foo(m) == false)
return cmatches; return cmatches;
if(m[0].second == last)
return cmatches;
// update to end of what matched // update to end of what matched
// trying to match again with match_not_null set if this // trying to match again with match_not_null set if this
// is a null match... // is a null match...
@ -1336,6 +1344,8 @@ unsigned int reg_grep2(Predicate foo, I first, I last, const reg_expression<char
++cmatches; ++cmatches;
if(foo(m) == false) if(foo(m) == false)
return cmatches; return cmatches;
if(m[0].second == last)
return cmatches;
// update to end of what matched // update to end of what matched
// trying to match again with match_not_null set if this // trying to match again with match_not_null set if this
// is a null match... // is a null match...
@ -1412,6 +1422,8 @@ unsigned int reg_grep2(Predicate foo, I first, I last, const reg_expression<char
++cmatches; ++cmatches;
if(foo(m) == false) if(foo(m) == false)
return cmatches; return cmatches;
if(m[0].second == last)
return cmatches;
// update to end of what matched // update to end of what matched
// trying to match again with match_not_null set if this // trying to match again with match_not_null set if this
// is a null match... // is a null match...
@ -1472,6 +1484,8 @@ unsigned int reg_grep2(Predicate foo, I first, I last, const reg_expression<char
++cmatches; ++cmatches;
if(foo(m) == false) if(foo(m) == false)
return cmatches; return cmatches;
if(m[0].second == last)
return cmatches;
// update to end of what matched // update to end of what matched
// trying to match again with match_not_null set if this // trying to match again with match_not_null set if this
// is a null match... // is a null match...