More cleanups

[SVN r31860]
This commit is contained in:
Douglas Gregor
2005-12-01 15:00:34 +00:00
parent 0b1b4c1fbc
commit e153234e10
2 changed files with 212 additions and 212 deletions

View File

@ -3,8 +3,8 @@
* Copyright (c) 2004 * Copyright (c) 2004
* John Maddock * John Maddock
* *
* Use, modification and distribution are subject to the * Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file * Boost Software License, Version 1.0. (See accompanying file
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
* *
*/ */
@ -32,7 +32,7 @@ namespace boost{
namespace re_detail{ namespace re_detail{
// //
// Implementation details: // Implementation details:
// //
class BOOST_REGEX_DECL icu_regex_traits_implementation class BOOST_REGEX_DECL icu_regex_traits_implementation
@ -237,9 +237,9 @@ namespace re_detail{
#if !defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(__IBMCPP__) #if !defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(__IBMCPP__)
template <class InputIterator> template <class InputIterator>
inline u32regex do_make_u32regex(InputIterator i, inline u32regex do_make_u32regex(InputIterator i,
InputIterator j, InputIterator j,
boost::regex_constants::syntax_option_type opt, boost::regex_constants::syntax_option_type opt,
const boost::mpl::int_<1>*) const boost::mpl::int_<1>*)
{ {
typedef boost::u8_to_u32_iterator<InputIterator, UChar32> conv_type; typedef boost::u8_to_u32_iterator<InputIterator, UChar32> conv_type;
@ -247,9 +247,9 @@ inline u32regex do_make_u32regex(InputIterator i,
} }
template <class InputIterator> template <class InputIterator>
inline u32regex do_make_u32regex(InputIterator i, inline u32regex do_make_u32regex(InputIterator i,
InputIterator j, InputIterator j,
boost::regex_constants::syntax_option_type opt, boost::regex_constants::syntax_option_type opt,
const boost::mpl::int_<2>*) const boost::mpl::int_<2>*)
{ {
typedef boost::u16_to_u32_iterator<InputIterator, UChar32> conv_type; typedef boost::u16_to_u32_iterator<InputIterator, UChar32> conv_type;
@ -257,18 +257,18 @@ inline u32regex do_make_u32regex(InputIterator i,
} }
template <class InputIterator> template <class InputIterator>
inline u32regex do_make_u32regex(InputIterator i, inline u32regex do_make_u32regex(InputIterator i,
InputIterator j, InputIterator j,
boost::regex_constants::syntax_option_type opt, boost::regex_constants::syntax_option_type opt,
const boost::mpl::int_<4>*) const boost::mpl::int_<4>*)
{ {
return u32regex(i, j, opt); return u32regex(i, j, opt);
} }
#else #else
template <class InputIterator> template <class InputIterator>
inline u32regex do_make_u32regex(InputIterator i, inline u32regex do_make_u32regex(InputIterator i,
InputIterator j, InputIterator j,
boost::regex_constants::syntax_option_type opt, boost::regex_constants::syntax_option_type opt,
const boost::mpl::int_<1>*) const boost::mpl::int_<1>*)
{ {
typedef boost::u8_to_u32_iterator<InputIterator, UChar32> conv_type; typedef boost::u8_to_u32_iterator<InputIterator, UChar32> conv_type;
@ -277,8 +277,8 @@ inline u32regex do_make_u32regex(InputIterator i,
conv_type a(i), b(j); conv_type a(i), b(j);
while(a != b) while(a != b)
{ {
v.push_back(*a); v.push_back(*a);
++a; ++a;
} }
if(v.size()) if(v.size())
return u32regex(&*v.begin(), v.size(), opt); return u32regex(&*v.begin(), v.size(), opt);
@ -286,9 +286,9 @@ inline u32regex do_make_u32regex(InputIterator i,
} }
template <class InputIterator> template <class InputIterator>
inline u32regex do_make_u32regex(InputIterator i, inline u32regex do_make_u32regex(InputIterator i,
InputIterator j, InputIterator j,
boost::regex_constants::syntax_option_type opt, boost::regex_constants::syntax_option_type opt,
const boost::mpl::int_<2>*) const boost::mpl::int_<2>*)
{ {
typedef boost::u16_to_u32_iterator<InputIterator, UChar32> conv_type; typedef boost::u16_to_u32_iterator<InputIterator, UChar32> conv_type;
@ -297,8 +297,8 @@ inline u32regex do_make_u32regex(InputIterator i,
conv_type a(i), b(j); conv_type a(i), b(j);
while(a != b) while(a != b)
{ {
v.push_back(*a); v.push_back(*a);
++a; ++a;
} }
if(v.size()) if(v.size())
return u32regex(&*v.begin(), v.size(), opt); return u32regex(&*v.begin(), v.size(), opt);
@ -306,17 +306,17 @@ inline u32regex do_make_u32regex(InputIterator i,
} }
template <class InputIterator> template <class InputIterator>
inline u32regex do_make_u32regex(InputIterator i, inline u32regex do_make_u32regex(InputIterator i,
InputIterator j, InputIterator j,
boost::regex_constants::syntax_option_type opt, boost::regex_constants::syntax_option_type opt,
const boost::mpl::int_<4>*) const boost::mpl::int_<4>*)
{ {
typedef std::vector<UCHAR32> vector_type; typedef std::vector<UCHAR32> vector_type;
vector_type v; vector_type v;
while(i != j) while(i != j)
{ {
v.push_back((UCHAR32)(*i)); v.push_back((UCHAR32)(*i));
++a; ++a;
} }
if(v.size()) if(v.size())
return u32regex(&*v.begin(), v.size(), opt); return u32regex(&*v.begin(), v.size(), opt);
@ -329,8 +329,8 @@ inline u32regex do_make_u32regex(InputIterator i,
// Construction from an iterator pair: // Construction from an iterator pair:
// //
template <class InputIterator> template <class InputIterator>
inline u32regex make_u32regex(InputIterator i, inline u32regex make_u32regex(InputIterator i,
InputIterator j, InputIterator j,
boost::regex_constants::syntax_option_type opt) boost::regex_constants::syntax_option_type opt)
{ {
return re_detail::do_make_u32regex(i, j, opt, static_cast<boost::mpl::int_<sizeof(*i)> const*>(0)); return re_detail::do_make_u32regex(i, j, opt, static_cast<boost::mpl::int_<sizeof(*i)> const*>(0));
@ -398,18 +398,18 @@ void copy_results(MR1& out, MR2 const& in)
} }
template <class BidiIterator, class Allocator> template <class BidiIterator, class Allocator>
inline bool do_regex_match(BidiIterator first, BidiIterator last, inline bool do_regex_match(BidiIterator first, BidiIterator last,
match_results<BidiIterator, Allocator>& m, match_results<BidiIterator, Allocator>& m,
const u32regex& e, const u32regex& e,
match_flag_type flags, match_flag_type flags,
boost::mpl::int_<4> const*) boost::mpl::int_<4> const*)
{ {
return ::boost::regex_match(first, last, m, e, flags); return ::boost::regex_match(first, last, m, e, flags);
} }
template <class BidiIterator, class Allocator> template <class BidiIterator, class Allocator>
bool do_regex_match(BidiIterator first, BidiIterator last, bool do_regex_match(BidiIterator first, BidiIterator last,
match_results<BidiIterator, Allocator>& m, match_results<BidiIterator, Allocator>& m,
const u32regex& e, const u32regex& e,
match_flag_type flags, match_flag_type flags,
boost::mpl::int_<2> const*) boost::mpl::int_<2> const*)
{ {
@ -423,9 +423,9 @@ bool do_regex_match(BidiIterator first, BidiIterator last,
return result; return result;
} }
template <class BidiIterator, class Allocator> template <class BidiIterator, class Allocator>
bool do_regex_match(BidiIterator first, BidiIterator last, bool do_regex_match(BidiIterator first, BidiIterator last,
match_results<BidiIterator, Allocator>& m, match_results<BidiIterator, Allocator>& m,
const u32regex& e, const u32regex& e,
match_flag_type flags, match_flag_type flags,
boost::mpl::int_<1> const*) boost::mpl::int_<1> const*)
{ {
@ -441,62 +441,62 @@ bool do_regex_match(BidiIterator first, BidiIterator last,
} // namespace re_detail } // namespace re_detail
template <class BidiIterator, class Allocator> template <class BidiIterator, class Allocator>
inline bool u32regex_match(BidiIterator first, BidiIterator last, inline bool u32regex_match(BidiIterator first, BidiIterator last,
match_results<BidiIterator, Allocator>& m, match_results<BidiIterator, Allocator>& m,
const u32regex& e, const u32regex& e,
match_flag_type flags = match_default) match_flag_type flags = match_default)
{ {
return re_detail::do_regex_match(first, last, m, e, flags, static_cast<mpl::int_<sizeof(*first)> const*>(0)); return re_detail::do_regex_match(first, last, m, e, flags, static_cast<mpl::int_<sizeof(*first)> const*>(0));
} }
inline bool u32regex_match(const UChar* p, inline bool u32regex_match(const UChar* p,
match_results<const UChar*>& m, match_results<const UChar*>& m,
const u32regex& e, const u32regex& e,
match_flag_type flags = match_default) match_flag_type flags = match_default)
{ {
return re_detail::do_regex_match(p, p+u_strlen(p), m, e, flags, static_cast<mpl::int_<2> const*>(0)); return re_detail::do_regex_match(p, p+u_strlen(p), m, e, flags, static_cast<mpl::int_<2> const*>(0));
} }
#if !defined(U_WCHAR_IS_UTF16) && !defined(BOOST_NO_WREGEX) #if !defined(U_WCHAR_IS_UTF16) && !defined(BOOST_NO_WREGEX)
inline bool u32regex_match(const wchar_t* p, inline bool u32regex_match(const wchar_t* p,
match_results<const wchar_t*>& m, match_results<const wchar_t*>& m,
const u32regex& e, const u32regex& e,
match_flag_type flags = match_default) match_flag_type flags = match_default)
{ {
return re_detail::do_regex_match(p, p+std::wcslen(p), m, e, flags, static_cast<mpl::int_<sizeof(wchar_t)> const*>(0)); return re_detail::do_regex_match(p, p+std::wcslen(p), m, e, flags, static_cast<mpl::int_<sizeof(wchar_t)> const*>(0));
} }
#endif #endif
inline bool u32regex_match(const char* p, inline bool u32regex_match(const char* p,
match_results<const char*>& m, match_results<const char*>& m,
const u32regex& e, const u32regex& e,
match_flag_type flags = match_default) match_flag_type flags = match_default)
{ {
return re_detail::do_regex_match(p, p+std::strlen(p), m, e, flags, static_cast<mpl::int_<1> const*>(0)); return re_detail::do_regex_match(p, p+std::strlen(p), m, e, flags, static_cast<mpl::int_<1> const*>(0));
} }
inline bool u32regex_match(const unsigned char* p, inline bool u32regex_match(const unsigned char* p,
match_results<const unsigned char*>& m, match_results<const unsigned char*>& m,
const u32regex& e, const u32regex& e,
match_flag_type flags = match_default) match_flag_type flags = match_default)
{ {
return re_detail::do_regex_match(p, p+std::strlen((const char*)p), m, e, flags, static_cast<mpl::int_<1> const*>(0)); return re_detail::do_regex_match(p, p+std::strlen((const char*)p), m, e, flags, static_cast<mpl::int_<1> const*>(0));
} }
inline bool u32regex_match(const std::string& s, inline bool u32regex_match(const std::string& s,
match_results<std::string::const_iterator>& m, match_results<std::string::const_iterator>& m,
const u32regex& e, const u32regex& e,
match_flag_type flags = match_default) match_flag_type flags = match_default)
{ {
return re_detail::do_regex_match(s.begin(), s.end(), m, e, flags, static_cast<mpl::int_<1> const*>(0)); return re_detail::do_regex_match(s.begin(), s.end(), m, e, flags, static_cast<mpl::int_<1> const*>(0));
} }
#ifndef BOOST_NO_STD_WSTRING #ifndef BOOST_NO_STD_WSTRING
inline bool u32regex_match(const std::wstring& s, inline bool u32regex_match(const std::wstring& s,
match_results<std::wstring::const_iterator>& m, match_results<std::wstring::const_iterator>& m,
const u32regex& e, const u32regex& e,
match_flag_type flags = match_default) match_flag_type flags = match_default)
{ {
return re_detail::do_regex_match(s.begin(), s.end(), m, e, flags, static_cast<mpl::int_<sizeof(wchar_t)> const*>(0)); return re_detail::do_regex_match(s.begin(), s.end(), m, e, flags, static_cast<mpl::int_<sizeof(wchar_t)> const*>(0));
} }
#endif #endif
inline bool u32regex_match(const UnicodeString& s, inline bool u32regex_match(const UnicodeString& s,
match_results<const UChar*>& m, match_results<const UChar*>& m,
const u32regex& e, const u32regex& e,
match_flag_type flags = match_default) match_flag_type flags = match_default)
{ {
return re_detail::do_regex_match(s.getBuffer(), s.getBuffer() + s.length(), m, e, flags, static_cast<mpl::int_<sizeof(wchar_t)> const*>(0)); return re_detail::do_regex_match(s.getBuffer(), s.getBuffer() + s.length(), m, e, flags, static_cast<mpl::int_<sizeof(wchar_t)> const*>(0));
@ -505,61 +505,61 @@ inline bool u32regex_match(const UnicodeString& s,
// regex_match overloads that do not return what matched: // regex_match overloads that do not return what matched:
// //
template <class BidiIterator> template <class BidiIterator>
inline bool u32regex_match(BidiIterator first, BidiIterator last, inline bool u32regex_match(BidiIterator first, BidiIterator last,
const u32regex& e, const u32regex& e,
match_flag_type flags = match_default) match_flag_type flags = match_default)
{ {
match_results<BidiIterator> m; match_results<BidiIterator> m;
return re_detail::do_regex_match(first, last, m, e, flags, static_cast<mpl::int_<sizeof(*first)> const*>(0)); return re_detail::do_regex_match(first, last, m, e, flags, static_cast<mpl::int_<sizeof(*first)> const*>(0));
} }
inline bool u32regex_match(const UChar* p, inline bool u32regex_match(const UChar* p,
const u32regex& e, const u32regex& e,
match_flag_type flags = match_default) match_flag_type flags = match_default)
{ {
match_results<const UChar*> m; match_results<const UChar*> m;
return re_detail::do_regex_match(p, p+u_strlen(p), m, e, flags, static_cast<mpl::int_<2> const*>(0)); return re_detail::do_regex_match(p, p+u_strlen(p), m, e, flags, static_cast<mpl::int_<2> const*>(0));
} }
#if !defined(U_WCHAR_IS_UTF16) && !defined(BOOST_NO_WREGEX) #if !defined(U_WCHAR_IS_UTF16) && !defined(BOOST_NO_WREGEX)
inline bool u32regex_match(const wchar_t* p, inline bool u32regex_match(const wchar_t* p,
const u32regex& e, const u32regex& e,
match_flag_type flags = match_default) match_flag_type flags = match_default)
{ {
match_results<const wchar_t*> m; match_results<const wchar_t*> m;
return re_detail::do_regex_match(p, p+std::wcslen(p), m, e, flags, static_cast<mpl::int_<sizeof(wchar_t)> const*>(0)); return re_detail::do_regex_match(p, p+std::wcslen(p), m, e, flags, static_cast<mpl::int_<sizeof(wchar_t)> const*>(0));
} }
#endif #endif
inline bool u32regex_match(const char* p, inline bool u32regex_match(const char* p,
const u32regex& e, const u32regex& e,
match_flag_type flags = match_default) match_flag_type flags = match_default)
{ {
match_results<const char*> m; match_results<const char*> m;
return re_detail::do_regex_match(p, p+std::strlen(p), m, e, flags, static_cast<mpl::int_<1> const*>(0)); return re_detail::do_regex_match(p, p+std::strlen(p), m, e, flags, static_cast<mpl::int_<1> const*>(0));
} }
inline bool u32regex_match(const unsigned char* p, inline bool u32regex_match(const unsigned char* p,
const u32regex& e, const u32regex& e,
match_flag_type flags = match_default) match_flag_type flags = match_default)
{ {
match_results<const unsigned char*> m; match_results<const unsigned char*> m;
return re_detail::do_regex_match(p, p+std::strlen((const char*)p), m, e, flags, static_cast<mpl::int_<1> const*>(0)); return re_detail::do_regex_match(p, p+std::strlen((const char*)p), m, e, flags, static_cast<mpl::int_<1> const*>(0));
} }
inline bool u32regex_match(const std::string& s, inline bool u32regex_match(const std::string& s,
const u32regex& e, const u32regex& e,
match_flag_type flags = match_default) match_flag_type flags = match_default)
{ {
match_results<std::string::const_iterator> m; match_results<std::string::const_iterator> m;
return re_detail::do_regex_match(s.begin(), s.end(), m, e, flags, static_cast<mpl::int_<1> const*>(0)); return re_detail::do_regex_match(s.begin(), s.end(), m, e, flags, static_cast<mpl::int_<1> const*>(0));
} }
#ifndef BOOST_NO_STD_WSTRING #ifndef BOOST_NO_STD_WSTRING
inline bool u32regex_match(const std::wstring& s, inline bool u32regex_match(const std::wstring& s,
const u32regex& e, const u32regex& e,
match_flag_type flags = match_default) match_flag_type flags = match_default)
{ {
match_results<std::wstring::const_iterator> m; match_results<std::wstring::const_iterator> m;
return re_detail::do_regex_match(s.begin(), s.end(), m, e, flags, static_cast<mpl::int_<sizeof(wchar_t)> const*>(0)); return re_detail::do_regex_match(s.begin(), s.end(), m, e, flags, static_cast<mpl::int_<sizeof(wchar_t)> const*>(0));
} }
#endif #endif
inline bool u32regex_match(const UnicodeString& s, inline bool u32regex_match(const UnicodeString& s,
const u32regex& e, const u32regex& e,
match_flag_type flags = match_default) match_flag_type flags = match_default)
{ {
match_results<const UChar*> m; match_results<const UChar*> m;
@ -571,9 +571,9 @@ inline bool u32regex_match(const UnicodeString& s,
// //
namespace re_detail{ namespace re_detail{
template <class BidiIterator, class Allocator> template <class BidiIterator, class Allocator>
inline bool do_regex_search(BidiIterator first, BidiIterator last, inline bool do_regex_search(BidiIterator first, BidiIterator last,
match_results<BidiIterator, Allocator>& m, match_results<BidiIterator, Allocator>& m,
const u32regex& e, const u32regex& e,
match_flag_type flags, match_flag_type flags,
BidiIterator base, BidiIterator base,
boost::mpl::int_<4> const*) boost::mpl::int_<4> const*)
@ -581,9 +581,9 @@ inline bool do_regex_search(BidiIterator first, BidiIterator last,
return ::boost::regex_search(first, last, m, e, flags, base); return ::boost::regex_search(first, last, m, e, flags, base);
} }
template <class BidiIterator, class Allocator> template <class BidiIterator, class Allocator>
bool do_regex_search(BidiIterator first, BidiIterator last, bool do_regex_search(BidiIterator first, BidiIterator last,
match_results<BidiIterator, Allocator>& m, match_results<BidiIterator, Allocator>& m,
const u32regex& e, const u32regex& e,
match_flag_type flags, match_flag_type flags,
BidiIterator base, BidiIterator base,
boost::mpl::int_<2> const*) boost::mpl::int_<2> const*)
@ -598,9 +598,9 @@ bool do_regex_search(BidiIterator first, BidiIterator last,
return result; return result;
} }
template <class BidiIterator, class Allocator> template <class BidiIterator, class Allocator>
bool do_regex_search(BidiIterator first, BidiIterator last, bool do_regex_search(BidiIterator first, BidiIterator last,
match_results<BidiIterator, Allocator>& m, match_results<BidiIterator, Allocator>& m,
const u32regex& e, const u32regex& e,
match_flag_type flags, match_flag_type flags,
BidiIterator base, BidiIterator base,
boost::mpl::int_<1> const*) boost::mpl::int_<1> const*)
@ -617,131 +617,131 @@ bool do_regex_search(BidiIterator first, BidiIterator last,
} }
template <class BidiIterator, class Allocator> template <class BidiIterator, class Allocator>
inline bool u32regex_search(BidiIterator first, BidiIterator last, inline bool u32regex_search(BidiIterator first, BidiIterator last,
match_results<BidiIterator, Allocator>& m, match_results<BidiIterator, Allocator>& m,
const u32regex& e, const u32regex& e,
match_flag_type flags = match_default) match_flag_type flags = match_default)
{ {
return re_detail::do_regex_search(first, last, m, e, flags, first, static_cast<mpl::int_<sizeof(*first)> const*>(0)); return re_detail::do_regex_search(first, last, m, e, flags, first, static_cast<mpl::int_<sizeof(*first)> const*>(0));
} }
template <class BidiIterator, class Allocator> template <class BidiIterator, class Allocator>
inline bool u32regex_search(BidiIterator first, BidiIterator last, inline bool u32regex_search(BidiIterator first, BidiIterator last,
match_results<BidiIterator, Allocator>& m, match_results<BidiIterator, Allocator>& m,
const u32regex& e, const u32regex& e,
match_flag_type flags, match_flag_type flags,
BidiIterator base) BidiIterator base)
{ {
return re_detail::do_regex_search(first, last, m, e, flags, base, static_cast<mpl::int_<sizeof(*first)> const*>(0)); return re_detail::do_regex_search(first, last, m, e, flags, base, static_cast<mpl::int_<sizeof(*first)> const*>(0));
} }
inline bool u32regex_search(const UChar* p, inline bool u32regex_search(const UChar* p,
match_results<const UChar*>& m, match_results<const UChar*>& m,
const u32regex& e, const u32regex& e,
match_flag_type flags = match_default) match_flag_type flags = match_default)
{ {
return re_detail::do_regex_search(p, p+u_strlen(p), m, e, flags, p, static_cast<mpl::int_<2> const*>(0)); return re_detail::do_regex_search(p, p+u_strlen(p), m, e, flags, p, static_cast<mpl::int_<2> const*>(0));
} }
#if !defined(U_WCHAR_IS_UTF16) && !defined(BOOST_NO_WREGEX) #if !defined(U_WCHAR_IS_UTF16) && !defined(BOOST_NO_WREGEX)
inline bool u32regex_search(const wchar_t* p, inline bool u32regex_search(const wchar_t* p,
match_results<const wchar_t*>& m, match_results<const wchar_t*>& m,
const u32regex& e, const u32regex& e,
match_flag_type flags = match_default) match_flag_type flags = match_default)
{ {
return re_detail::do_regex_search(p, p+std::wcslen(p), m, e, flags, p, static_cast<mpl::int_<sizeof(wchar_t)> const*>(0)); return re_detail::do_regex_search(p, p+std::wcslen(p), m, e, flags, p, static_cast<mpl::int_<sizeof(wchar_t)> const*>(0));
} }
#endif #endif
inline bool u32regex_search(const char* p, inline bool u32regex_search(const char* p,
match_results<const char*>& m, match_results<const char*>& m,
const u32regex& e, const u32regex& e,
match_flag_type flags = match_default) match_flag_type flags = match_default)
{ {
return re_detail::do_regex_search(p, p+std::strlen(p), m, e, flags, p, static_cast<mpl::int_<1> const*>(0)); return re_detail::do_regex_search(p, p+std::strlen(p), m, e, flags, p, static_cast<mpl::int_<1> const*>(0));
} }
inline bool u32regex_search(const unsigned char* p, inline bool u32regex_search(const unsigned char* p,
match_results<const unsigned char*>& m, match_results<const unsigned char*>& m,
const u32regex& e, const u32regex& e,
match_flag_type flags = match_default) match_flag_type flags = match_default)
{ {
return re_detail::do_regex_search(p, p+std::strlen((const char*)p), m, e, flags, p, static_cast<mpl::int_<1> const*>(0)); return re_detail::do_regex_search(p, p+std::strlen((const char*)p), m, e, flags, p, static_cast<mpl::int_<1> const*>(0));
} }
inline bool u32regex_search(const std::string& s, inline bool u32regex_search(const std::string& s,
match_results<std::string::const_iterator>& m, match_results<std::string::const_iterator>& m,
const u32regex& e, const u32regex& e,
match_flag_type flags = match_default) match_flag_type flags = match_default)
{ {
return re_detail::do_regex_search(s.begin(), s.end(), m, e, flags, s.begin(), static_cast<mpl::int_<1> const*>(0)); return re_detail::do_regex_search(s.begin(), s.end(), m, e, flags, s.begin(), static_cast<mpl::int_<1> const*>(0));
} }
#ifndef BOOST_NO_STD_WSTRING #ifndef BOOST_NO_STD_WSTRING
inline bool u32regex_search(const std::wstring& s, inline bool u32regex_search(const std::wstring& s,
match_results<std::wstring::const_iterator>& m, match_results<std::wstring::const_iterator>& m,
const u32regex& e, const u32regex& e,
match_flag_type flags = match_default) match_flag_type flags = match_default)
{ {
return re_detail::do_regex_search(s.begin(), s.end(), m, e, flags, s.begin(), static_cast<mpl::int_<sizeof(wchar_t)> const*>(0)); return re_detail::do_regex_search(s.begin(), s.end(), m, e, flags, s.begin(), static_cast<mpl::int_<sizeof(wchar_t)> const*>(0));
} }
#endif #endif
inline bool u32regex_search(const UnicodeString& s, inline bool u32regex_search(const UnicodeString& s,
match_results<const UChar*>& m, match_results<const UChar*>& m,
const u32regex& e, const u32regex& e,
match_flag_type flags = match_default) match_flag_type flags = match_default)
{ {
return re_detail::do_regex_search(s.getBuffer(), s.getBuffer() + s.length(), m, e, flags, s.getBuffer(), static_cast<mpl::int_<sizeof(wchar_t)> const*>(0)); return re_detail::do_regex_search(s.getBuffer(), s.getBuffer() + s.length(), m, e, flags, s.getBuffer(), static_cast<mpl::int_<sizeof(wchar_t)> const*>(0));
} }
template <class BidiIterator> template <class BidiIterator>
inline bool u32regex_search(BidiIterator first, BidiIterator last, inline bool u32regex_search(BidiIterator first, BidiIterator last,
const u32regex& e, const u32regex& e,
match_flag_type flags = match_default) match_flag_type flags = match_default)
{ {
match_results<BidiIterator> m; match_results<BidiIterator> m;
return re_detail::do_regex_search(first, last, m, e, flags, first, static_cast<mpl::int_<sizeof(*first)> const*>(0)); return re_detail::do_regex_search(first, last, m, e, flags, first, static_cast<mpl::int_<sizeof(*first)> const*>(0));
} }
inline bool u32regex_search(const UChar* p, inline bool u32regex_search(const UChar* p,
const u32regex& e, const u32regex& e,
match_flag_type flags = match_default) match_flag_type flags = match_default)
{ {
match_results<const UChar*> m; match_results<const UChar*> m;
return re_detail::do_regex_search(p, p+u_strlen(p), m, e, flags, p, static_cast<mpl::int_<2> const*>(0)); return re_detail::do_regex_search(p, p+u_strlen(p), m, e, flags, p, static_cast<mpl::int_<2> const*>(0));
} }
#if !defined(U_WCHAR_IS_UTF16) && !defined(BOOST_NO_WREGEX) #if !defined(U_WCHAR_IS_UTF16) && !defined(BOOST_NO_WREGEX)
inline bool u32regex_search(const wchar_t* p, inline bool u32regex_search(const wchar_t* p,
const u32regex& e, const u32regex& e,
match_flag_type flags = match_default) match_flag_type flags = match_default)
{ {
match_results<const wchar_t*> m; match_results<const wchar_t*> m;
return re_detail::do_regex_search(p, p+std::wcslen(p), m, e, flags, p, static_cast<mpl::int_<sizeof(wchar_t)> const*>(0)); return re_detail::do_regex_search(p, p+std::wcslen(p), m, e, flags, p, static_cast<mpl::int_<sizeof(wchar_t)> const*>(0));
} }
#endif #endif
inline bool u32regex_search(const char* p, inline bool u32regex_search(const char* p,
const u32regex& e, const u32regex& e,
match_flag_type flags = match_default) match_flag_type flags = match_default)
{ {
match_results<const char*> m; match_results<const char*> m;
return re_detail::do_regex_search(p, p+std::strlen(p), m, e, flags, p, static_cast<mpl::int_<1> const*>(0)); return re_detail::do_regex_search(p, p+std::strlen(p), m, e, flags, p, static_cast<mpl::int_<1> const*>(0));
} }
inline bool u32regex_search(const unsigned char* p, inline bool u32regex_search(const unsigned char* p,
const u32regex& e, const u32regex& e,
match_flag_type flags = match_default) match_flag_type flags = match_default)
{ {
match_results<const unsigned char*> m; match_results<const unsigned char*> m;
return re_detail::do_regex_search(p, p+std::strlen((const char*)p), m, e, flags, p, static_cast<mpl::int_<1> const*>(0)); return re_detail::do_regex_search(p, p+std::strlen((const char*)p), m, e, flags, p, static_cast<mpl::int_<1> const*>(0));
} }
inline bool u32regex_search(const std::string& s, inline bool u32regex_search(const std::string& s,
const u32regex& e, const u32regex& e,
match_flag_type flags = match_default) match_flag_type flags = match_default)
{ {
match_results<std::string::const_iterator> m; match_results<std::string::const_iterator> m;
return re_detail::do_regex_search(s.begin(), s.end(), m, e, flags, s.begin(), static_cast<mpl::int_<1> const*>(0)); return re_detail::do_regex_search(s.begin(), s.end(), m, e, flags, s.begin(), static_cast<mpl::int_<1> const*>(0));
} }
#ifndef BOOST_NO_STD_WSTRING #ifndef BOOST_NO_STD_WSTRING
inline bool u32regex_search(const std::wstring& s, inline bool u32regex_search(const std::wstring& s,
const u32regex& e, const u32regex& e,
match_flag_type flags = match_default) match_flag_type flags = match_default)
{ {
match_results<std::wstring::const_iterator> m; match_results<std::wstring::const_iterator> m;
return re_detail::do_regex_search(s.begin(), s.end(), m, e, flags, s.begin(), static_cast<mpl::int_<sizeof(wchar_t)> const*>(0)); return re_detail::do_regex_search(s.begin(), s.end(), m, e, flags, s.begin(), static_cast<mpl::int_<sizeof(wchar_t)> const*>(0));
} }
#endif #endif
inline bool u32regex_search(const UnicodeString& s, inline bool u32regex_search(const UnicodeString& s,
const u32regex& e, const u32regex& e,
match_flag_type flags = match_default) match_flag_type flags = match_default)
{ {
match_results<const UChar*> m; match_results<const UChar*> m;
@ -807,8 +807,8 @@ inline utf8_output_iterator<OutputIterator> make_utf32_out(OutputIterator o, mpl
template <class OutputIterator, class I1, class I2> template <class OutputIterator, class I1, class I2>
OutputIterator do_regex_replace(OutputIterator out, OutputIterator do_regex_replace(OutputIterator out,
std::pair<I1, I1> const& in, std::pair<I1, I1> const& in,
const u32regex& e, const u32regex& e,
const std::pair<I2, I2>& fmt, const std::pair<I2, I2>& fmt,
match_flag_type flags match_flag_type flags
) )
{ {
@ -822,7 +822,7 @@ OutputIterator do_regex_replace(OutputIterator out,
while(pos != fmt.second) while(pos != fmt.second)
f.push_back(*pos++); f.push_back(*pos++);
#endif #endif
regex_iterator<I1, UChar32, icu_regex_traits> i(in.first, in.second, e, flags); regex_iterator<I1, UChar32, icu_regex_traits> i(in.first, in.second, e, flags);
regex_iterator<I1, UChar32, icu_regex_traits> j; regex_iterator<I1, UChar32, icu_regex_traits> j;
if(i == j) if(i == j)
@ -836,7 +836,7 @@ OutputIterator do_regex_replace(OutputIterator out,
while(i != j) while(i != j)
{ {
if(!(flags & regex_constants::format_no_copy)) if(!(flags & regex_constants::format_no_copy))
out = re_detail::copy(i->prefix().first, i->prefix().second, out); out = re_detail::copy(i->prefix().first, i->prefix().second, out);
if(f.size()) if(f.size())
out = ::boost::re_detail::regex_format_imp(out, *i, &*f.begin(), &*f.begin() + f.size(), flags, e.get_traits()); out = ::boost::re_detail::regex_format_imp(out, *i, &*f.begin(), &*f.begin() + f.size(), flags, e.get_traits());
else else
@ -872,15 +872,15 @@ template <class OutputIterator, class BidirectionalIterator, class charT>
inline OutputIterator u32regex_replace(OutputIterator out, inline OutputIterator u32regex_replace(OutputIterator out,
BidirectionalIterator first, BidirectionalIterator first,
BidirectionalIterator last, BidirectionalIterator last,
const u32regex& e, const u32regex& e,
const charT* fmt, const charT* fmt,
match_flag_type flags = match_default) match_flag_type flags = match_default)
{ {
return re_detail::extract_output_base return re_detail::extract_output_base
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
<OutputIterator> <OutputIterator>
#endif #endif
( (
re_detail::do_regex_replace( re_detail::do_regex_replace(
re_detail::make_utf32_out(out, static_cast<mpl::int_<sizeof(*first)> const*>(0)), re_detail::make_utf32_out(out, static_cast<mpl::int_<sizeof(*first)> const*>(0)),
re_detail::make_utf32_seq(first, last, static_cast<mpl::int_<sizeof(*first)> const*>(0)), re_detail::make_utf32_seq(first, last, static_cast<mpl::int_<sizeof(*first)> const*>(0)),
@ -894,7 +894,7 @@ template <class OutputIterator, class Iterator, class charT>
inline OutputIterator u32regex_replace(OutputIterator out, inline OutputIterator u32regex_replace(OutputIterator out,
Iterator first, Iterator first,
Iterator last, Iterator last,
const u32regex& e, const u32regex& e,
const std::basic_string<charT>& fmt, const std::basic_string<charT>& fmt,
match_flag_type flags = match_default) match_flag_type flags = match_default)
{ {
@ -902,7 +902,7 @@ inline OutputIterator u32regex_replace(OutputIterator out,
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
<OutputIterator> <OutputIterator>
#endif #endif
( (
re_detail::do_regex_replace( re_detail::do_regex_replace(
re_detail::make_utf32_out(out, static_cast<mpl::int_<sizeof(*first)> const*>(0)), re_detail::make_utf32_out(out, static_cast<mpl::int_<sizeof(*first)> const*>(0)),
re_detail::make_utf32_seq(first, last, static_cast<mpl::int_<sizeof(*first)> const*>(0)), re_detail::make_utf32_seq(first, last, static_cast<mpl::int_<sizeof(*first)> const*>(0)),
@ -916,7 +916,7 @@ template <class OutputIterator, class Iterator>
inline OutputIterator u32regex_replace(OutputIterator out, inline OutputIterator u32regex_replace(OutputIterator out,
Iterator first, Iterator first,
Iterator last, Iterator last,
const u32regex& e, const u32regex& e,
const UnicodeString& fmt, const UnicodeString& fmt,
match_flag_type flags = match_default) match_flag_type flags = match_default)
{ {
@ -924,7 +924,7 @@ inline OutputIterator u32regex_replace(OutputIterator out,
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
<OutputIterator> <OutputIterator>
#endif #endif
( (
re_detail::do_regex_replace( re_detail::do_regex_replace(
re_detail::make_utf32_out(out, static_cast<mpl::int_<sizeof(*first)> const*>(0)), re_detail::make_utf32_out(out, static_cast<mpl::int_<sizeof(*first)> const*>(0)),
re_detail::make_utf32_seq(first, last, static_cast<mpl::int_<sizeof(*first)> const*>(0)), re_detail::make_utf32_seq(first, last, static_cast<mpl::int_<sizeof(*first)> const*>(0)),
@ -936,7 +936,7 @@ inline OutputIterator u32regex_replace(OutputIterator out,
template <class charT> template <class charT>
std::basic_string<charT> u32regex_replace(const std::basic_string<charT>& s, std::basic_string<charT> u32regex_replace(const std::basic_string<charT>& s,
const u32regex& e, const u32regex& e,
const charT* fmt, const charT* fmt,
match_flag_type flags = match_default) match_flag_type flags = match_default)
{ {
@ -948,7 +948,7 @@ std::basic_string<charT> u32regex_replace(const std::basic_string<charT>& s,
template <class charT> template <class charT>
std::basic_string<charT> u32regex_replace(const std::basic_string<charT>& s, std::basic_string<charT> u32regex_replace(const std::basic_string<charT>& s,
const u32regex& e, const u32regex& e,
const std::basic_string<charT>& fmt, const std::basic_string<charT>& fmt,
match_flag_type flags = match_default) match_flag_type flags = match_default)
{ {
@ -968,10 +968,10 @@ public:
unicode_string_out_iterator& operator++() { return *this; } unicode_string_out_iterator& operator++() { return *this; }
unicode_string_out_iterator& operator++(int) { return *this; } unicode_string_out_iterator& operator++(int) { return *this; }
unicode_string_out_iterator& operator*() { return *this; } unicode_string_out_iterator& operator*() { return *this; }
unicode_string_out_iterator& operator=(UChar v) unicode_string_out_iterator& operator=(UChar v)
{ {
*out += v; *out += v;
return *this; return *this;
} }
typedef std::ptrdiff_t difference_type; typedef std::ptrdiff_t difference_type;
typedef UChar value_type; typedef UChar value_type;
@ -983,7 +983,7 @@ public:
} }
inline UnicodeString u32regex_replace(const UnicodeString& s, inline UnicodeString u32regex_replace(const UnicodeString& s,
const u32regex& e, const u32regex& e,
const UChar* fmt, const UChar* fmt,
match_flag_type flags = match_default) match_flag_type flags = match_default)
{ {
@ -994,7 +994,7 @@ inline UnicodeString u32regex_replace(const UnicodeString& s,
} }
inline UnicodeString u32regex_replace(const UnicodeString& s, inline UnicodeString u32regex_replace(const UnicodeString& s,
const u32regex& e, const u32regex& e,
const UnicodeString& fmt, const UnicodeString& fmt,
match_flag_type flags = match_default) match_flag_type flags = match_default)
{ {

View File

@ -3,8 +3,8 @@
* Copyright (c) 2004 * Copyright (c) 2004
* John Maddock * John Maddock
* *
* Use, modification and distribution are subject to the * Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file * Boost Software License, Version 1.0. (See accompanying file
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
* *
*/ */
@ -291,7 +291,7 @@ bool basic_regex_parser<charT, traits>::parse_extended()
// If we have a mod_x flag set, then skip until // If we have a mod_x flag set, then skip until
// we get to a newline character: // we get to a newline character:
// //
if((this->flags() if((this->flags()
& (regbase::no_perl_ex|regbase::mod_x)) & (regbase::no_perl_ex|regbase::mod_x))
== regbase::mod_x) == regbase::mod_x)
{ {
@ -315,8 +315,8 @@ bool basic_regex_parser<charT, traits>::parse_literal()
// append this as a literal provided it's not a space character // append this as a literal provided it's not a space character
// or the perl option regbase::mod_x is not set: // or the perl option regbase::mod_x is not set:
if( if(
((this->flags() ((this->flags()
& (regbase::main_option_type|regbase::mod_x|regbase::no_perl_ex)) & (regbase::main_option_type|regbase::mod_x|regbase::no_perl_ex))
!= regbase::mod_x) != regbase::mod_x)
|| !this->m_traits.isctype(*m_position, this->m_mask_space)) || !this->m_traits.isctype(*m_position, this->m_mask_space))
this->append_literal(*m_position); this->append_literal(*m_position);
@ -698,8 +698,8 @@ bool basic_regex_parser<charT, traits>::parse_match_any()
++m_position; ++m_position;
static_cast<re_dot*>( static_cast<re_dot*>(
this->append_state(syntax_element_wild, sizeof(re_dot)) this->append_state(syntax_element_wild, sizeof(re_dot))
)->mask = static_cast<unsigned char>(this->flags() & regbase::no_mod_s )->mask = static_cast<unsigned char>(this->flags() & regbase::no_mod_s
? re_detail::force_not_newline ? re_detail::force_not_newline
: this->flags() & regbase::mod_s ? : this->flags() & regbase::mod_s ?
re_detail::force_newline : re_detail::dont_care); re_detail::force_newline : re_detail::dont_care);
return true; return true;
@ -710,10 +710,10 @@ bool basic_regex_parser<charT, traits>::parse_repeat(std::size_t low, std::size_
{ {
bool greedy = true; bool greedy = true;
std::size_t insert_point; std::size_t insert_point;
// //
// when we get to here we may have a non-greedy ? mark still to come: // when we get to here we may have a non-greedy ? mark still to come:
// //
if((m_position != m_end) if((m_position != m_end)
&& ( && (
(0 == (this->flags() & (regbase::main_option_type | regbase::no_perl_ex))) (0 == (this->flags() & (regbase::main_option_type | regbase::no_perl_ex)))
|| ((regbase::basic_syntax_group|regbase::emacs_ex) == (this->flags() & (regbase::main_option_type | regbase::emacs_ex))) || ((regbase::basic_syntax_group|regbase::emacs_ex) == (this->flags() & (regbase::main_option_type | regbase::emacs_ex)))
@ -909,7 +909,7 @@ bool basic_regex_parser<charT, traits>::parse_alt()
} }
++m_position; ++m_position;
// //
// we need to append a trailing jump: // we need to append a trailing jump:
// //
re_syntax_base* pj = this->append_state(re_detail::syntax_element_jump, sizeof(re_jump)); re_syntax_base* pj = this->append_state(re_detail::syntax_element_jump, sizeof(re_jump));
std::ptrdiff_t jump_offset = this->getoffset(pj); std::ptrdiff_t jump_offset = this->getoffset(pj);
@ -995,7 +995,7 @@ bool basic_regex_parser<charT, traits>::parse_set()
return true; return true;
case regex_constants::syntax_escape: case regex_constants::syntax_escape:
{ {
// //
// look ahead and see if this is a character class shortcut // look ahead and see if this is a character class shortcut
// \d \w \s etc... // \d \w \s etc...
// //
@ -1061,7 +1061,7 @@ bool basic_regex_parser<charT, traits>::parse_inner_set(basic_char_set<charT, tr
case regex_constants::syntax_colon: case regex_constants::syntax_colon:
{ {
// check that character classes are actually enabled: // check that character classes are actually enabled:
if((this->flags() & (regbase::main_option_type | regbase::no_char_classes)) if((this->flags() & (regbase::main_option_type | regbase::no_char_classes))
== (regbase::basic_syntax_group | regbase::no_char_classes)) == (regbase::basic_syntax_group | regbase::no_char_classes))
{ {
--m_position; --m_position;
@ -1081,8 +1081,8 @@ bool basic_regex_parser<charT, traits>::parse_inner_set(basic_char_set<charT, tr
fail(regex_constants::error_brack, m_position - m_base); fail(regex_constants::error_brack, m_position - m_base);
return false; return false;
} }
while((m_position != m_end) while((m_position != m_end)
&& (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_colon)) && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_colon))
++m_position; ++m_position;
const charT* name_last = m_position; const charT* name_last = m_position;
if(m_end == m_position) if(m_end == m_position)
@ -1090,7 +1090,7 @@ bool basic_regex_parser<charT, traits>::parse_inner_set(basic_char_set<charT, tr
fail(regex_constants::error_brack, m_position - m_base); fail(regex_constants::error_brack, m_position - m_base);
return false; return false;
} }
if((m_end == ++m_position) if((m_end == ++m_position)
|| (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_set)) || (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_set))
{ {
fail(regex_constants::error_brack, m_position - m_base); fail(regex_constants::error_brack, m_position - m_base);
@ -1113,18 +1113,18 @@ bool basic_regex_parser<charT, traits>::parse_inner_set(basic_char_set<charT, tr
{ {
// maybe a special case: // maybe a special case:
++m_position; ++m_position;
if( (m_position != m_end) if( (m_position != m_end)
&& (this->m_traits.syntax_type(*m_position) && (this->m_traits.syntax_type(*m_position)
== regex_constants::syntax_close_set)) == regex_constants::syntax_close_set))
{ {
if(this->m_traits.escape_syntax_type(*name_first) if(this->m_traits.escape_syntax_type(*name_first)
== regex_constants::escape_type_left_word) == regex_constants::escape_type_left_word)
{ {
++m_position; ++m_position;
this->append_state(syntax_element_word_start); this->append_state(syntax_element_word_start);
return false; return false;
} }
if(this->m_traits.escape_syntax_type(*name_first) if(this->m_traits.escape_syntax_type(*name_first)
== regex_constants::escape_type_right_word) == regex_constants::escape_type_right_word)
{ {
++m_position; ++m_position;
@ -1158,8 +1158,8 @@ bool basic_regex_parser<charT, traits>::parse_inner_set(basic_char_set<charT, tr
fail(regex_constants::error_brack, m_position - m_base); fail(regex_constants::error_brack, m_position - m_base);
return false; return false;
} }
while((m_position != m_end) while((m_position != m_end)
&& (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_equal)) && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_equal))
++m_position; ++m_position;
const charT* name_last = m_position; const charT* name_last = m_position;
if(m_end == m_position) if(m_end == m_position)
@ -1167,7 +1167,7 @@ bool basic_regex_parser<charT, traits>::parse_inner_set(basic_char_set<charT, tr
fail(regex_constants::error_brack, m_position - m_base); fail(regex_constants::error_brack, m_position - m_base);
return false; return false;
} }
if((m_end == ++m_position) if((m_end == ++m_position)
|| (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_set)) || (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_set))
{ {
fail(regex_constants::error_brack, m_position - m_base); fail(regex_constants::error_brack, m_position - m_base);
@ -1220,17 +1220,17 @@ void basic_regex_parser<charT, traits>::parse_set_literal(basic_char_set<charT,
char_set.add_range(start_range, end_range); char_set.add_range(start_range, end_range);
if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_dash) if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_dash)
{ {
if(m_end == ++m_position) if(m_end == ++m_position)
{ {
fail(regex_constants::error_brack, m_position - m_base); fail(regex_constants::error_brack, m_position - m_base);
return; return;
} }
if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_close_set) if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_close_set)
{ {
// trailing - : // trailing - :
--m_position; --m_position;
return; return;
} }
fail(regex_constants::error_range, m_position - m_base); fail(regex_constants::error_range, m_position - m_base);
return; return;
} }
@ -1297,8 +1297,8 @@ digraph<charT> basic_regex_parser<charT, traits>::get_next_set_literal(basic_cha
fail(regex_constants::error_collate, name_first - m_base); fail(regex_constants::error_collate, name_first - m_base);
return result; return result;
} }
while((m_position != m_end) while((m_position != m_end)
&& (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_dot)) && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_dot))
++m_position; ++m_position;
const charT* name_last = m_position; const charT* name_last = m_position;
if(m_end == m_position) if(m_end == m_position)
@ -1306,7 +1306,7 @@ digraph<charT> basic_regex_parser<charT, traits>::get_next_set_literal(basic_cha
fail(regex_constants::error_collate, name_first - m_base); fail(regex_constants::error_collate, name_first - m_base);
return result; return result;
} }
if((m_end == ++m_position) if((m_end == ++m_position)
|| (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_set)) || (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_set))
{ {
fail(regex_constants::error_collate, name_first - m_base); fail(regex_constants::error_collate, name_first - m_base);
@ -1462,7 +1462,7 @@ charT basic_regex_parser<charT, traits>::unescape_character()
return result; return result;
} }
val = this->m_traits.toi(m_position, m_position + len, 8); val = this->m_traits.toi(m_position, m_position + len, 8);
if(val < 0) if(val < 0)
{ {
fail(regex_constants::error_escape, m_position - m_base); fail(regex_constants::error_escape, m_position - m_base);
return result; return result;
@ -1556,14 +1556,14 @@ bool basic_regex_parser<charT, traits>::parse_QE()
const charT* end; const charT* end;
do do
{ {
while((m_position != m_end) while((m_position != m_end)
&& (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape)) && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_escape))
++m_position; ++m_position;
if(m_position == m_end) if(m_position == m_end)
{ {
// a \Q...\E sequence may terminate with the end of the expression: // a \Q...\E sequence may terminate with the end of the expression:
end = m_position; end = m_position;
break; break;
} }
if(++m_position == m_end) // skip the escape if(++m_position == m_end) // skip the escape
{ {
@ -1608,9 +1608,9 @@ bool basic_regex_parser<charT, traits>::parse_perl_extension()
// //
if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_hash) if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_hash)
{ {
while((m_position != m_end) while((m_position != m_end)
&& (this->m_traits.syntax_type(*m_position++) != regex_constants::syntax_close_mark)) && (this->m_traits.syntax_type(*m_position++) != regex_constants::syntax_close_mark))
{} {}
return true; return true;
} }
// //
@ -1908,44 +1908,44 @@ bool basic_regex_parser<charT, traits>::add_emacs_code(bool negate)
char_set.add_class(this->m_word_mask); char_set.add_class(this->m_word_mask);
break; break;
case '_': case '_':
char_set.add_single(digraph<charT>(charT('$'))); char_set.add_single(digraph<charT>(charT('$')));
char_set.add_single(digraph<charT>(charT('&'))); char_set.add_single(digraph<charT>(charT('&')));
char_set.add_single(digraph<charT>(charT('*'))); char_set.add_single(digraph<charT>(charT('*')));
char_set.add_single(digraph<charT>(charT('+'))); char_set.add_single(digraph<charT>(charT('+')));
char_set.add_single(digraph<charT>(charT('-'))); char_set.add_single(digraph<charT>(charT('-')));
char_set.add_single(digraph<charT>(charT('_'))); char_set.add_single(digraph<charT>(charT('_')));
char_set.add_single(digraph<charT>(charT('<'))); char_set.add_single(digraph<charT>(charT('<')));
char_set.add_single(digraph<charT>(charT('>'))); char_set.add_single(digraph<charT>(charT('>')));
break; break;
case '.': case '.':
char_set.add_class(this->m_traits.lookup_classname(s_punct, s_punct+5)); char_set.add_class(this->m_traits.lookup_classname(s_punct, s_punct+5));
break; break;
case '(': case '(':
char_set.add_single(digraph<charT>(charT('('))); char_set.add_single(digraph<charT>(charT('(')));
char_set.add_single(digraph<charT>(charT('['))); char_set.add_single(digraph<charT>(charT('[')));
char_set.add_single(digraph<charT>(charT('{'))); char_set.add_single(digraph<charT>(charT('{')));
break; break;
case ')': case ')':
char_set.add_single(digraph<charT>(charT(')'))); char_set.add_single(digraph<charT>(charT(')')));
char_set.add_single(digraph<charT>(charT(']'))); char_set.add_single(digraph<charT>(charT(']')));
char_set.add_single(digraph<charT>(charT('}'))); char_set.add_single(digraph<charT>(charT('}')));
break; break;
case '"': case '"':
char_set.add_single(digraph<charT>(charT('"'))); char_set.add_single(digraph<charT>(charT('"')));
char_set.add_single(digraph<charT>(charT('\''))); char_set.add_single(digraph<charT>(charT('\'')));
char_set.add_single(digraph<charT>(charT('`'))); char_set.add_single(digraph<charT>(charT('`')));
break; break;
case '\'': case '\'':
char_set.add_single(digraph<charT>(charT('\''))); char_set.add_single(digraph<charT>(charT('\'')));
char_set.add_single(digraph<charT>(charT(','))); char_set.add_single(digraph<charT>(charT(',')));
char_set.add_single(digraph<charT>(charT('#'))); char_set.add_single(digraph<charT>(charT('#')));
break; break;
case '<': case '<':
char_set.add_single(digraph<charT>(charT(';'))); char_set.add_single(digraph<charT>(charT(';')));
break; break;
case '>': case '>':
char_set.add_single(digraph<charT>(charT('\n'))); char_set.add_single(digraph<charT>(charT('\n')));
char_set.add_single(digraph<charT>(charT('\f'))); char_set.add_single(digraph<charT>(charT('\f')));
break; break;
default: default:
fail(regex_constants::error_ctype, m_position - m_base); fail(regex_constants::error_ctype, m_position - m_base);
@ -2038,7 +2038,7 @@ template <class charT, class traits>
bool basic_regex_parser<charT, traits>::unwind_alts(std::ptrdiff_t last_paren_start) bool basic_regex_parser<charT, traits>::unwind_alts(std::ptrdiff_t last_paren_start)
{ {
// //
// If we didn't actually add any states after the last // If we didn't actually add any states after the last
// alternative then that's an error: // alternative then that's an error:
// //
if((this->m_alt_insert_point == static_cast<std::ptrdiff_t>(this->m_pdata->m_data.size())) if((this->m_alt_insert_point == static_cast<std::ptrdiff_t>(this->m_pdata->m_data.size()))
@ -2047,7 +2047,7 @@ bool basic_regex_parser<charT, traits>::unwind_alts(std::ptrdiff_t last_paren_st
fail(regex_constants::error_empty, this->m_position - this->m_base); fail(regex_constants::error_empty, this->m_position - this->m_base);
return false; return false;
} }
// //
// Fix up our alternatives: // Fix up our alternatives:
// //
while(m_alt_jumps.size() && (m_alt_jumps.back() > last_paren_start)) while(m_alt_jumps.size() && (m_alt_jumps.back() > last_paren_start))