Remove and update aCC/HPUX fixes.

Fix regex bug report: some repeats match when they should not.
Added test case.


[SVN r35262]
This commit is contained in:
John Maddock
2006-09-21 18:30:27 +00:00
parent 9fc486658f
commit 67128fa65f
5 changed files with 13 additions and 11 deletions

View File

@ -49,7 +49,7 @@ inline bool can_start(unsigned short c, const unsigned char* map, unsigned char
{ {
return ((c >= (1 << CHAR_BIT)) ? true : map[c] & mask); return ((c >= (1 << CHAR_BIT)) ? true : map[c] & mask);
} }
#if !defined(__HP_aCC) #if !defined(__hpux) // can't use WCHAR_MIN in pp-directive
#if defined(WCHAR_MIN) && (WCHAR_MIN == 0) && !defined(BOOST_NO_INTRINSIC_WCHAR_T) #if defined(WCHAR_MIN) && (WCHAR_MIN == 0) && !defined(BOOST_NO_INTRINSIC_WCHAR_T)
inline bool can_start(wchar_t c, const unsigned char* map, unsigned char mask) inline bool can_start(wchar_t c, const unsigned char* map, unsigned char mask)
{ {

View File

@ -275,13 +275,11 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_rep()
#pragma warning(disable:4127 4244) #pragma warning(disable:4127 4244)
#endif #endif
const re_repeat* rep = static_cast<const re_repeat*>(pstate); const re_repeat* rep = static_cast<const re_repeat*>(pstate);
if(next_count->get_id() != rep->id) //
{ // Always copy the repeat count, so that the state is restored
// we're moving to a different repeat from the last // when we exit this scope:
// one, so set up a counter object and recurse: //
repeater_count<BidiIterator> r(rep->id, &next_count, position); repeater_count<BidiIterator> r(rep->id, &next_count, position);
return match_rep();
}
// //
// If we've had at least one repeat already, and the last one // If we've had at least one repeat already, and the last one
// matched the NULL string then set the repeat count to // matched the NULL string then set the repeat count to

View File

@ -77,7 +77,7 @@ inline bool is_combining<unsigned char>(unsigned char)
{ {
return false; return false;
} }
#ifndef __HP_aCC #ifndef __hpux // can't use WCHAR_MIN/MAX in pp-directives.
#ifdef _MSC_VER #ifdef _MSC_VER
template<> template<>
inline bool is_combining<wchar_t>(wchar_t c) inline bool is_combining<wchar_t>(wchar_t c)

View File

@ -67,7 +67,7 @@ public:
#elif (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\ #elif (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\
|| BOOST_WORKAROUND(BOOST_MSVC, < 1300) \ || BOOST_WORKAROUND(BOOST_MSVC, < 1300) \
|| BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) \ || BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) \
|| BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(55500)) || BOOST_WORKAROUND(__HP_aCC, < 60700)
template <class T> template <class T>
u32regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const T& submatches, match_flag_type f) u32regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const T& submatches, match_flag_type f)
: end(last), re(*p), flags(f) : end(last), re(*p), flags(f)
@ -200,7 +200,7 @@ public:
#elif (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\ #elif (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\
|| BOOST_WORKAROUND(BOOST_MSVC, < 1300) \ || BOOST_WORKAROUND(BOOST_MSVC, < 1300) \
|| BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) \ || BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) \
|| BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(55500)) || BOOST_WORKAROUND(__HP_aCC, < 60700)
template <class T> template <class T>
u32regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, u32regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
const T& submatches, match_flag_type m = match_default) const T& submatches, match_flag_type m = match_default)

View File

@ -373,6 +373,10 @@ void test_tricky_cases3()
TEST_REGEX_SEARCH("\\l+", perl|icase, "abcXYZ", match_default, make_array(0, 6, -2, -2)); TEST_REGEX_SEARCH("\\l+", perl|icase, "abcXYZ", match_default, make_array(0, 6, -2, -2));
TEST_REGEX_SEARCH("\\u+", perl|icase, "abcXYZ", match_default, make_array(0, 6, -2, -2)); TEST_REGEX_SEARCH("\\u+", perl|icase, "abcXYZ", match_default, make_array(0, 6, -2, -2));
TEST_REGEX_SEARCH("(a)(?:b)", perl|nosubs, "ab", match_default, make_array(0, 2, -2, -2)); TEST_REGEX_SEARCH("(a)(?:b)", perl|nosubs, "ab", match_default, make_array(0, 2, -2, -2));
// bug reported 2006-09-20:
TEST_REGEX_SEARCH("(?:\\d{9}.*){2}", perl, "123456789dfsdfsdfsfsdfds123456789b", match_default, make_array(0, 34, -2, -2));
TEST_REGEX_SEARCH("(?:\\d{9}.*){2}", perl, "123456789dfsdfsdfsfsdfds12345678", match_default, make_array(-2, -2));
TEST_REGEX_SEARCH("(?:\\d{9}.*){2}", perl, "123456789dfsdfsdfsfsdfds", match_default, make_array(-2, -2));
// //