Merge minor fixes from Trunk.

[SVN r83498]
This commit is contained in:
John Maddock
2013-03-19 18:48:24 +00:00
parent e70d3b6b4e
commit f6870ad64a
7 changed files with 47 additions and 28 deletions

View File

@ -405,7 +405,8 @@
characters</a>
</h6>
<p>
For example =[abc]=, will match any of the characters 'a', 'b', or 'c'.
For example <code class="literal">[abc]</code>, will match any of the characters 'a',
'b', or 'c'.
</p>
<h6>
<a name="boost_regex.syntax.perl_syntax.h13"></a>
@ -413,10 +414,11 @@
ranges</a>
</h6>
<p>
For example =[a-c]= will match any single character in the range 'a' to 'c'.
By default, for Perl regular expressions, a character x is within the range
y to z, if the code point of the character lies within the codepoints of
the endpoints of the range. Alternatively, if you set the <a class="link" href="../ref/syntax_option_type/syntax_option_type_perl.html" title="Options for Perl Regular Expressions"><code class="literal">collate</code>
For example <code class="literal">[a-c]</code> will match any single character in the
range 'a' to 'c'. By default, for Perl regular expressions, a character x
is within the range y to z, if the code point of the character lies within
the codepoints of the endpoints of the range. Alternatively, if you set the
<a class="link" href="../ref/syntax_option_type/syntax_option_type_perl.html" title="Options for Perl Regular Expressions"><code class="literal">collate</code>
flag</a> when constructing the regular expression, then ranges are locale
sensitive.
</p>
@ -426,7 +428,7 @@
</h6>
<p>
If the bracket-expression begins with the ^ character, then it matches the
complement of the characters it contains, for example =<code class="literal">a-c</code>=
complement of the characters it contains, for example <code class="literal">[^a-c]</code>
matches any character that is not in the range <code class="literal">a-c</code>.
</p>
<h6>

View File

@ -198,7 +198,7 @@
</p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"><p><small>Last revised: November 29, 2012 at 10:43:51 GMT</small></p></td>
<td align="left"><p><small>Last revised: January 31, 2013 at 17:33:20 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<hr>

View File

@ -218,11 +218,11 @@ A bracket expression may contain any combination of the following:
[h5 Single characters]
For example =[abc]=, will match any of the characters 'a', 'b', or 'c'.
For example [^\[abc\]], will match any of the characters 'a', 'b', or 'c'.
[h5 Character ranges]
For example =[a-c]= will match any single character in the range 'a' to 'c'.
For example [^\[a-c\]] will match any single character in the range 'a' to 'c'.
By default, for Perl regular expressions, a character x is within the
range y to z, if the code point of the character lies within the codepoints of
the endpoints of the range. Alternatively, if you set the
@ -232,7 +232,7 @@ when constructing the regular expression, then ranges are locale sensitive.
[h5 Negation]
If the bracket-expression begins with the ^ character, then it matches the
complement of the characters it contains, for example =[^a-c]= matches
complement of the characters it contains, for example [^\[^a-c\]] matches
any character that is not in the range =a-c=.
[h5 Character classes]

View File

@ -1107,7 +1107,7 @@ bool basic_regex_parser<charT, traits>::parse_repeat_range(bool isbasic)
}
// get the value if any:
v = this->m_traits.toi(m_position, m_end, 10);
max = (v >= 0) ? v : (std::numeric_limits<std::size_t>::max)();
max = (v >= 0) ? (std::size_t)v : (std::numeric_limits<std::size_t>::max)();
}
else
{

View File

@ -65,6 +65,8 @@ void perl_matcher<BidiIterator, Allocator, traits>::construct_init(const basic_r
m_match_flags |= match_perl;
else if((re_f & (regbase::main_option_type|regbase::emacs_ex)) == (regbase::basic_syntax_group|regbase::emacs_ex))
m_match_flags |= match_perl;
else if((re_f & (regbase::main_option_type|regbase::literal)) == (regbase::literal))
m_match_flags |= match_perl;
else
m_match_flags |= match_posix;
}
@ -326,6 +328,10 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_prefix()
m_has_found_match = true;
m_presult->set_second(last, 0, false);
position = last;
if((m_match_flags & match_posix) == match_posix)
{
m_result.maybe_assign(*m_presult);
}
}
#ifdef BOOST_REGEX_MATCH_EXTRA
if(m_has_found_match && (match_extra & m_match_flags))

View File

@ -325,10 +325,10 @@ inline const charT* get_escape_R_string()
# pragma warning(disable:4309 4245)
#endif
static const charT e1[] = { '(', '?', '>', '\x0D', '\x0A', '?',
'|', '[', '\x0A', '\x0B', '\x0C', '\x85', '\\', 'x', '{', '2', '0', '2', '8', '}',
'|', '[', '\x0A', '\x0B', '\x0C', static_cast<unsigned char>('\x85'), '\\', 'x', '{', '2', '0', '2', '8', '}',
'\\', 'x', '{', '2', '0', '2', '9', '}', ']', ')', '\0' };
static const charT e2[] = { '(', '?', '>', '\x0D', '\x0A', '?',
'|', '[', '\x0A', '\x0B', '\x0C', '\x85', ']', ')', '\0' };
'|', '[', '\x0A', '\x0B', '\x0C', static_cast<unsigned char>('\x85'), ']', ')', '\0' };
charT c = static_cast<charT>(0x2029u);
bool b = (static_cast<unsigned>(c) == 0x2029u);

View File

@ -134,6 +134,17 @@ void test_partial_match()
TEST_REGEX_SEARCH("a*?<tag>", perl, "aaa", match_default|match_partial, make_array(0, 3, -2, -2));
TEST_REGEX_SEARCH("\\w*?<tag>", perl, "aaa", match_default|match_partial, make_array(0, 3, -2, -2));
TEST_REGEX_SEARCH("(\\w)*?<tag>", perl, "aaa", match_default|match_partial, make_array(0, 3, -2, -2));
TEST_REGEX_SEARCH("(xyz)(.*)abc", extended, "xyzaaab", match_default|match_partial, make_array(0, 7, -2, -2));
TEST_REGEX_SEARCH("(xyz)(.*)abc", extended, "xyz", match_default|match_partial, make_array(0, 3, -2, -2));
TEST_REGEX_SEARCH("(xyz)(.*)abc", extended, "xy", match_default|match_partial, make_array(0, 2, -2, -2));
TEST_REGEX_SEARCH("(xyz)(.*)abc", extended, "x", match_default|match_partial, make_array(0, 1, -2, -2));
TEST_REGEX_SEARCH("(xyz)(.*)abc", extended, "", match_default|match_partial, make_array(-2, -2));
TEST_REGEX_SEARCH("(xyz)(.*)abc", extended, "aaaa", match_default|match_partial, make_array(-2, -2));
TEST_REGEX_SEARCH(".abc", extended, "aaab", match_default|match_partial, make_array(1, 4, -2, -2));
TEST_REGEX_SEARCH("a[_]", extended, "xxa", match_default|match_partial, make_array(2, 3, -2, -2));
TEST_REGEX_SEARCH(".{4,}", extended, "xxa", match_default|match_partial, make_array(0, 3, -2, -2));
TEST_REGEX_SEARCH(".{4,}", extended, "xxa", match_default|match_partial|match_not_dot_null, make_array(0, 3, -2, -2));
}
void test_nosubs()