diff options
author | Tobias Markmann <tm@ayena.de> | 2014-10-19 20:22:58 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2014-10-20 13:49:33 (GMT) |
commit | 6b22dfcf59474dd016a0355a3102a1dd3692d92c (patch) | |
tree | 2b1fd33be433a91e81fee84fdc2bf1b52575d934 /3rdParty/Boost/src/boost/regex | |
parent | 38b0cb785fea8eae5e48fae56440695fdfd10ee1 (diff) | |
download | swift-contrib-6b22dfcf59474dd016a0355a3102a1dd3692d92c.zip swift-contrib-6b22dfcf59474dd016a0355a3102a1dd3692d92c.tar.bz2 |
Update Boost in 3rdParty to version 1.56.0.
This updates Boost in our 3rdParty directory to version 1.56.0.
Updated our update.sh script to stop on error.
Changed error reporting in SwiftTools/CrashReporter.cpp to SWIFT_LOG due to
missing include of <iostream> with newer Boost.
Change-Id: I4b35c77de951333979a524097f35f5f83d325edc
Diffstat (limited to '3rdParty/Boost/src/boost/regex')
24 files changed, 270 insertions, 181 deletions
diff --git a/3rdParty/Boost/src/boost/regex/config.hpp b/3rdParty/Boost/src/boost/regex/config.hpp index e8cec5b..7e6cc51 100644 --- a/3rdParty/Boost/src/boost/regex/config.hpp +++ b/3rdParty/Boost/src/boost/regex/config.hpp @@ -192,71 +192,71 @@ ****************************************************************************/ #ifndef BOOST_SYMBOL_EXPORT # define BOOST_SYMBOL_EXPORT # define BOOST_SYMBOL_IMPORT #endif #if (defined(BOOST_REGEX_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)) && !defined(BOOST_REGEX_STATIC_LINK) # if defined(BOOST_REGEX_SOURCE) # define BOOST_REGEX_DECL BOOST_SYMBOL_EXPORT # define BOOST_REGEX_BUILD_DLL # else # define BOOST_REGEX_DECL BOOST_SYMBOL_IMPORT # endif #else # define BOOST_REGEX_DECL #endif #if !defined(BOOST_REGEX_NO_LIB) && !defined(BOOST_REGEX_SOURCE) && !defined(BOOST_ALL_NO_LIB) && defined(__cplusplus) # define BOOST_LIB_NAME boost_regex # if defined(BOOST_REGEX_DYN_LINK) || defined(BOOST_ALL_DYN_LINK) # define BOOST_DYN_LINK # endif # ifdef BOOST_REGEX_DIAG # define BOOST_LIB_DIAGNOSTIC # endif # include <boost/config/auto_link.hpp> #endif /***************************************************************************** * * Set up function call type: * ****************************************************************************/ -#if defined(BOOST_MSVC) && (BOOST_MSVC >= 1200) && defined(_MSC_EXTENSIONS) +#if defined(BOOST_MSVC) && defined(_MSC_EXTENSIONS) #if defined(_DEBUG) || defined(__MSVC_RUNTIME_CHECKS) || defined(_MANAGED) || defined(BOOST_REGEX_NO_FASTCALL) # define BOOST_REGEX_CALL __cdecl #else # define BOOST_REGEX_CALL __fastcall #endif # define BOOST_REGEX_CCALL __cdecl #endif #if defined(__BORLANDC__) && !defined(BOOST_DISABLE_WIN32) # define BOOST_REGEX_CALL __fastcall # define BOOST_REGEX_CCALL __stdcall #endif #ifndef BOOST_REGEX_CALL # define BOOST_REGEX_CALL #endif #ifndef BOOST_REGEX_CCALL #define BOOST_REGEX_CCALL #endif /***************************************************************************** * * Set up localisation model: * ****************************************************************************/ /* backwards compatibility: */ #ifdef BOOST_RE_LOCALE_C # define BOOST_REGEX_USE_C_LOCALE #endif #ifdef BOOST_RE_LOCALE_CPP # define BOOST_REGEX_USE_CPP_LOCALE #endif diff --git a/3rdParty/Boost/src/boost/regex/icu.hpp b/3rdParty/Boost/src/boost/regex/icu.hpp index 772806e..37fec2a 100644 --- a/3rdParty/Boost/src/boost/regex/icu.hpp +++ b/3rdParty/Boost/src/boost/regex/icu.hpp @@ -391,87 +391,87 @@ inline u32regex make_u32regex(const U_NAMESPACE_QUALIFIER UnicodeString& s, boos namespace re_detail{ template<class MR1, class MR2> void copy_results(MR1& out, MR2 const& in) { // copy results from an adapted MR2 match_results: out.set_size(in.size(), in.prefix().first.base(), in.suffix().second.base()); out.set_base(in.base().base()); for(int i = 0; i < (int)in.size(); ++i) { if(in[i].matched) { out.set_first(in[i].first.base(), i); out.set_second(in[i].second.base(), i); } } } template <class BidiIterator, class Allocator> inline bool do_regex_match(BidiIterator first, BidiIterator last, match_results<BidiIterator, Allocator>& m, const u32regex& e, match_flag_type flags, boost::mpl::int_<4> const*) { return ::boost::regex_match(first, last, m, e, flags); } template <class BidiIterator, class Allocator> bool do_regex_match(BidiIterator first, BidiIterator last, match_results<BidiIterator, Allocator>& m, const u32regex& e, match_flag_type flags, boost::mpl::int_<2> const*) { typedef u16_to_u32_iterator<BidiIterator, UChar32> conv_type; typedef match_results<conv_type> match_type; - typedef typename match_type::allocator_type alloc_type; + //typedef typename match_type::allocator_type alloc_type; match_type what; bool result = ::boost::regex_match(conv_type(first, first, last), conv_type(last, first, last), what, e, flags); // copy results across to m: if(result) copy_results(m, what); return result; } template <class BidiIterator, class Allocator> bool do_regex_match(BidiIterator first, BidiIterator last, match_results<BidiIterator, Allocator>& m, const u32regex& e, match_flag_type flags, boost::mpl::int_<1> const*) { typedef u8_to_u32_iterator<BidiIterator, UChar32> conv_type; typedef match_results<conv_type> match_type; - typedef typename match_type::allocator_type alloc_type; + //typedef typename match_type::allocator_type alloc_type; match_type what; bool result = ::boost::regex_match(conv_type(first, first, last), conv_type(last, first, last), what, e, flags); // copy results across to m: if(result) copy_results(m, what); return result; } } // namespace re_detail template <class BidiIterator, class Allocator> inline bool u32regex_match(BidiIterator first, BidiIterator last, match_results<BidiIterator, Allocator>& m, const u32regex& e, 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)); } inline bool u32regex_match(const UChar* p, match_results<const UChar*>& m, const u32regex& e, 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)); } #if !defined(U_WCHAR_IS_UTF16) && (U_SIZEOF_WCHAR_T != 2) && !defined(BOOST_NO_WREGEX) inline bool u32regex_match(const wchar_t* p, match_results<const wchar_t*>& m, const u32regex& e, 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)); } #endif inline bool u32regex_match(const char* p, match_results<const char*>& m, const u32regex& e, @@ -566,88 +566,88 @@ inline bool u32regex_match(const std::wstring& s, return re_detail::do_regex_match(s.begin(), s.end(), m, e, flags, static_cast<mpl::int_<sizeof(wchar_t)> const*>(0)); } #endif inline bool u32regex_match(const U_NAMESPACE_QUALIFIER UnicodeString& s, const u32regex& e, match_flag_type flags = match_default) { match_results<const UChar*> m; return re_detail::do_regex_match(s.getBuffer(), s.getBuffer() + s.length(), m, e, flags, static_cast<mpl::int_<sizeof(wchar_t)> const*>(0)); } // // regex_search overloads that widen the character type as appropriate: // namespace re_detail{ template <class BidiIterator, class Allocator> inline bool do_regex_search(BidiIterator first, BidiIterator last, match_results<BidiIterator, Allocator>& m, const u32regex& e, match_flag_type flags, BidiIterator base, boost::mpl::int_<4> const*) { return ::boost::regex_search(first, last, m, e, flags, base); } template <class BidiIterator, class Allocator> bool do_regex_search(BidiIterator first, BidiIterator last, match_results<BidiIterator, Allocator>& m, const u32regex& e, match_flag_type flags, BidiIterator base, boost::mpl::int_<2> const*) { typedef u16_to_u32_iterator<BidiIterator, UChar32> conv_type; typedef match_results<conv_type> match_type; - typedef typename match_type::allocator_type alloc_type; + //typedef typename match_type::allocator_type alloc_type; match_type what; bool result = ::boost::regex_search(conv_type(first, first, last), conv_type(last, first, last), what, e, flags, conv_type(base)); // copy results across to m: if(result) copy_results(m, what); return result; } template <class BidiIterator, class Allocator> bool do_regex_search(BidiIterator first, BidiIterator last, match_results<BidiIterator, Allocator>& m, const u32regex& e, match_flag_type flags, BidiIterator base, boost::mpl::int_<1> const*) { typedef u8_to_u32_iterator<BidiIterator, UChar32> conv_type; typedef match_results<conv_type> match_type; - typedef typename match_type::allocator_type alloc_type; + //typedef typename match_type::allocator_type alloc_type; match_type what; bool result = ::boost::regex_search(conv_type(first, first, last), conv_type(last, first, last), what, e, flags, conv_type(base)); // copy results across to m: if(result) copy_results(m, what); return result; } } template <class BidiIterator, class Allocator> inline bool u32regex_search(BidiIterator first, BidiIterator last, match_results<BidiIterator, Allocator>& m, const u32regex& e, 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)); } template <class BidiIterator, class Allocator> inline bool u32regex_search(BidiIterator first, BidiIterator last, match_results<BidiIterator, Allocator>& m, const u32regex& e, match_flag_type flags, BidiIterator base) { 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, match_results<const UChar*>& m, const u32regex& e, 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)); } #if !defined(U_WCHAR_IS_UTF16) && (U_SIZEOF_WCHAR_T != 2) && !defined(BOOST_NO_WREGEX) inline bool u32regex_search(const wchar_t* p, match_results<const wchar_t*>& m, @@ -855,117 +855,108 @@ OutputIterator do_regex_replace(OutputIterator out, if(flags & regex_constants::format_first_only) break; ++i; } if(!(flags & regex_constants::format_no_copy)) out = re_detail::copy(last_m, in.second, out); } return out; } template <class BaseIterator> inline const BaseIterator& extract_output_base(const BaseIterator& b) { return b; } template <class BaseIterator> inline BaseIterator extract_output_base(const utf8_output_iterator<BaseIterator>& b) { return b.base(); } template <class BaseIterator> inline BaseIterator extract_output_base(const utf16_output_iterator<BaseIterator>& b) { return b.base(); } } // re_detail template <class OutputIterator, class BidirectionalIterator, class charT> inline OutputIterator u32regex_replace(OutputIterator out, BidirectionalIterator first, BidirectionalIterator last, const u32regex& e, const charT* fmt, match_flag_type flags = match_default) { return re_detail::extract_output_base -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) - <OutputIterator> -#endif ( re_detail::do_regex_replace( 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)), e, re_detail::make_utf32_seq(fmt, static_cast<mpl::int_<sizeof(*fmt)> const*>(0)), flags) ); } template <class OutputIterator, class Iterator, class charT> inline OutputIterator u32regex_replace(OutputIterator out, Iterator first, Iterator last, const u32regex& e, const std::basic_string<charT>& fmt, match_flag_type flags = match_default) { return re_detail::extract_output_base -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) - <OutputIterator> -#endif ( re_detail::do_regex_replace( 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)), e, re_detail::make_utf32_seq(fmt.begin(), fmt.end(), static_cast<mpl::int_<sizeof(charT)> const*>(0)), flags) ); } template <class OutputIterator, class Iterator> inline OutputIterator u32regex_replace(OutputIterator out, Iterator first, Iterator last, const u32regex& e, const U_NAMESPACE_QUALIFIER UnicodeString& fmt, match_flag_type flags = match_default) { return re_detail::extract_output_base -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) - <OutputIterator> -#endif ( re_detail::do_regex_replace( 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)), e, re_detail::make_utf32_seq(fmt.getBuffer(), fmt.getBuffer() + fmt.length(), static_cast<mpl::int_<2> const*>(0)), flags) ); } template <class charT> std::basic_string<charT> u32regex_replace(const std::basic_string<charT>& s, const u32regex& e, const charT* fmt, match_flag_type flags = match_default) { std::basic_string<charT> result; re_detail::string_out_iterator<std::basic_string<charT> > i(result); u32regex_replace(i, s.begin(), s.end(), e, fmt, flags); return result; } template <class charT> std::basic_string<charT> u32regex_replace(const std::basic_string<charT>& s, const u32regex& e, const std::basic_string<charT>& fmt, match_flag_type flags = match_default) { std::basic_string<charT> result; re_detail::string_out_iterator<std::basic_string<charT> > i(result); u32regex_replace(i, s.begin(), s.end(), e, fmt.c_str(), flags); return result; } namespace re_detail{ diff --git a/3rdParty/Boost/src/boost/regex/pending/static_mutex.hpp b/3rdParty/Boost/src/boost/regex/pending/static_mutex.hpp index 9c10050..344926f 100644 --- a/3rdParty/Boost/src/boost/regex/pending/static_mutex.hpp +++ b/3rdParty/Boost/src/boost/regex/pending/static_mutex.hpp @@ -4,177 +4,179 @@ * John Maddock * * Use, modification and distribution are subject to the * Boost Software License, Version 1.0. (See accompanying file * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) * */ /* * LOCATION: see http://www.boost.org for most recent version. * FILE static_mutex.hpp * VERSION see <boost/version.hpp> * DESCRIPTION: Declares static_mutex lock type, there are three different * implementations: POSIX pthreads, WIN32 threads, and portable, * these are described in more detail below. */ #ifndef BOOST_REGEX_STATIC_MUTEX_HPP #define BOOST_REGEX_STATIC_MUTEX_HPP #include <boost/config.hpp> #include <boost/regex/config.hpp> // dll import/export options. #ifdef BOOST_HAS_PTHREADS #include <pthread.h> #endif #if defined(BOOST_HAS_PTHREADS) && defined(PTHREAD_MUTEX_INITIALIZER) // // pthreads version: // simple wrap around a pthread_mutex_t initialized with // PTHREAD_MUTEX_INITIALIZER. // namespace boost{ -class BOOST_REGEX_DECL scoped_static_mutex_lock; - -class static_mutex -{ -public: - typedef scoped_static_mutex_lock scoped_lock; - pthread_mutex_t m_mutex; -}; +class static_mutex; #define BOOST_STATIC_MUTEX_INIT { PTHREAD_MUTEX_INITIALIZER, } class BOOST_REGEX_DECL scoped_static_mutex_lock { public: scoped_static_mutex_lock(static_mutex& mut, bool lk = true); ~scoped_static_mutex_lock(); inline bool locked()const { return m_have_lock; } inline operator void const*()const { return locked() ? this : 0; } void lock(); void unlock(); private: static_mutex& m_mutex; bool m_have_lock; }; +class static_mutex +{ +public: + typedef scoped_static_mutex_lock scoped_lock; + pthread_mutex_t m_mutex; +}; } // namespace boost #elif defined(BOOST_HAS_WINTHREADS) // // Win32 version: // Use a 32-bit int as a lock, along with a test-and-set // implementation using InterlockedCompareExchange. // #include <boost/cstdint.hpp> namespace boost{ class BOOST_REGEX_DECL scoped_static_mutex_lock; class static_mutex { public: typedef scoped_static_mutex_lock scoped_lock; boost::int32_t m_mutex; }; #define BOOST_STATIC_MUTEX_INIT { 0, } class BOOST_REGEX_DECL scoped_static_mutex_lock { public: scoped_static_mutex_lock(static_mutex& mut, bool lk = true); ~scoped_static_mutex_lock(); operator void const*()const { return locked() ? this : 0; } bool locked()const { return m_have_lock; } void lock(); void unlock(); private: static_mutex& m_mutex; bool m_have_lock; scoped_static_mutex_lock(const scoped_static_mutex_lock&); scoped_static_mutex_lock& operator=(const scoped_static_mutex_lock&); }; } // namespace #else // // Portable version of a static mutex based on Boost.Thread library: // This has to use a single mutex shared by all instances of static_mutex // because boost::call_once doesn't alow us to pass instance information // down to the initialisation proceedure. In fact the initialisation routine // may need to be called more than once - but only once per instance. // // Since this preprocessor path is almost never taken, we hide these header // dependencies so that build tools don't find them. // -#define B1 <boost/thread/once.hpp> -#define B2 <boost/thread/recursive_mutex.hpp> -#include B1 -#include B2 -#undef B1 -#undef B2 +#define BOOST_REGEX_H1 <boost/thread/once.hpp> +#define BOOST_REGEX_H2 <boost/thread/recursive_mutex.hpp> +#define BOOST_REGEX_H3 <boost/thread/lock_types.hpp> +#include BOOST_REGEX_H1 +#include BOOST_REGEX_H2 +#include BOOST_REGEX_H3 +#undef BOOST_REGEX_H1 +#undef BOOST_REGEX_H2 +#undef BOOST_REGEX_H3 namespace boost{ class BOOST_REGEX_DECL scoped_static_mutex_lock; extern "C" BOOST_REGEX_DECL void boost_regex_free_static_mutex(); class BOOST_REGEX_DECL static_mutex { public: typedef scoped_static_mutex_lock scoped_lock; static void init(); static boost::recursive_mutex* m_pmutex; static boost::once_flag m_once; }; #define BOOST_STATIC_MUTEX_INIT { } class BOOST_REGEX_DECL scoped_static_mutex_lock { public: scoped_static_mutex_lock(static_mutex& mut, bool lk = true); ~scoped_static_mutex_lock(); operator void const*()const; bool locked()const; void lock(); void unlock(); private: - boost::recursive_mutex::scoped_lock* m_plock; + boost::unique_lock<boost::recursive_mutex>* m_plock; bool m_have_lock; }; inline scoped_static_mutex_lock::operator void const*()const { return locked() ? this : 0; } inline bool scoped_static_mutex_lock::locked()const { return m_have_lock; } } // namespace #endif #endif diff --git a/3rdParty/Boost/src/boost/regex/pending/unicode_iterator.hpp b/3rdParty/Boost/src/boost/regex/pending/unicode_iterator.hpp index e6399b5..b84cfa0 100644 --- a/3rdParty/Boost/src/boost/regex/pending/unicode_iterator.hpp +++ b/3rdParty/Boost/src/boost/regex/pending/unicode_iterator.hpp @@ -109,71 +109,71 @@ inline unsigned utf8_byte_count(boost::uint8_t c) } inline unsigned utf8_trailing_byte_count(boost::uint8_t c) { return utf8_byte_count(c) - 1; } #ifdef BOOST_MSVC #pragma warning(push) #pragma warning(disable:4100) #endif inline void invalid_utf32_code_point(::boost::uint32_t val) { #ifndef BOOST_NO_STD_LOCALE std::stringstream ss; ss << "Invalid UTF-32 code point U+" << std::showbase << std::hex << val << " encountered while trying to encode UTF-16 sequence"; std::out_of_range e(ss.str()); #else std::out_of_range e("Invalid UTF-32 code point encountered while trying to encode UTF-16 sequence"); #endif boost::throw_exception(e); } #ifdef BOOST_MSVC #pragma warning(pop) #endif } // namespace detail template <class BaseIterator, class U16Type = ::boost::uint16_t> class u32_to_u16_iterator : public boost::iterator_facade<u32_to_u16_iterator<BaseIterator, U16Type>, U16Type, std::bidirectional_iterator_tag, const U16Type> { typedef boost::iterator_facade<u32_to_u16_iterator<BaseIterator, U16Type>, U16Type, std::bidirectional_iterator_tag, const U16Type> base_type; -#if !defined(BOOST_NO_STD_ITERATOR_TRAITS) && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +#if !defined(BOOST_NO_STD_ITERATOR_TRAITS) typedef typename std::iterator_traits<BaseIterator>::value_type base_value_type; BOOST_STATIC_ASSERT(sizeof(base_value_type)*CHAR_BIT == 32); BOOST_STATIC_ASSERT(sizeof(U16Type)*CHAR_BIT == 16); #endif public: typename base_type::reference dereference()const { if(m_current == 2) extract_current(); return m_values[m_current]; } bool equal(const u32_to_u16_iterator& that)const { if(m_position == that.m_position) { // Both m_currents must be equal, or both even // this is the same as saying their sum must be even: return (m_current + that.m_current) & 1u ? false : true; } return false; } void increment() { // if we have a pending read then read now, so that we know whether // to skip a position, or move to a low-surrogate: if(m_current == 2) { // pending read: extract_current(); } // move to the next surrogate position: ++m_current; @@ -224,71 +224,71 @@ private: if(v >= 0x10000u) { if(v > 0x10FFFFu) detail::invalid_utf32_code_point(*m_position); // split into two surrogates: m_values[0] = static_cast<U16Type>(v >> 10) + detail::high_surrogate_base; m_values[1] = static_cast<U16Type>(v & detail::ten_bit_mask) + detail::low_surrogate_base; m_current = 0; BOOST_ASSERT(detail::is_high_surrogate(m_values[0])); BOOST_ASSERT(detail::is_low_surrogate(m_values[1])); } else { // 16-bit code point: m_values[0] = static_cast<U16Type>(*m_position); m_values[1] = 0; m_current = 0; // value must not be a surrogate: if(detail::is_surrogate(m_values[0])) detail::invalid_utf32_code_point(*m_position); } } BaseIterator m_position; mutable U16Type m_values[3]; mutable unsigned m_current; }; template <class BaseIterator, class U32Type = ::boost::uint32_t> class u16_to_u32_iterator : public boost::iterator_facade<u16_to_u32_iterator<BaseIterator, U32Type>, U32Type, std::bidirectional_iterator_tag, const U32Type> { typedef boost::iterator_facade<u16_to_u32_iterator<BaseIterator, U32Type>, U32Type, std::bidirectional_iterator_tag, const U32Type> base_type; // special values for pending iterator reads: BOOST_STATIC_CONSTANT(U32Type, pending_read = 0xffffffffu); -#if !defined(BOOST_NO_STD_ITERATOR_TRAITS) && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +#if !defined(BOOST_NO_STD_ITERATOR_TRAITS) typedef typename std::iterator_traits<BaseIterator>::value_type base_value_type; BOOST_STATIC_ASSERT(sizeof(base_value_type)*CHAR_BIT == 16); BOOST_STATIC_ASSERT(sizeof(U32Type)*CHAR_BIT == 32); #endif public: typename base_type::reference dereference()const { if(m_value == pending_read) extract_current(); return m_value; } bool equal(const u16_to_u32_iterator& that)const { return m_position == that.m_position; } void increment() { // skip high surrogate first if there is one: if(detail::is_high_surrogate(*m_position)) ++m_position; ++m_position; m_value = pending_read; } void decrement() { --m_position; // if we have a low surrogate then go back one more: if(detail::is_low_surrogate(*m_position)) --m_position; m_value = pending_read; } BaseIterator base()const { @@ -339,71 +339,71 @@ private: ss << "Misplaced UTF-16 surrogate U+" << std::showbase << std::hex << val << " encountered while trying to encode UTF-32 sequence"; std::out_of_range e(ss.str()); #else std::out_of_range e("Misplaced UTF-16 surrogate encountered while trying to encode UTF-32 sequence"); #endif boost::throw_exception(e); } void extract_current()const { m_value = static_cast<U32Type>(static_cast< ::boost::uint16_t>(*m_position)); // if the last value is a high surrogate then adjust m_position and m_value as needed: if(detail::is_high_surrogate(*m_position)) { // precondition; next value must have be a low-surrogate: BaseIterator next(m_position); ::boost::uint16_t t = *++next; if((t & 0xFC00u) != 0xDC00u) invalid_code_point(t); m_value = (m_value - detail::high_surrogate_base) << 10; m_value |= (static_cast<U32Type>(static_cast< ::boost::uint16_t>(t)) & detail::ten_bit_mask); } // postcondition; result must not be a surrogate: if(detail::is_surrogate(m_value)) invalid_code_point(static_cast< ::boost::uint16_t>(m_value)); } BaseIterator m_position; mutable U32Type m_value; }; template <class BaseIterator, class U8Type = ::boost::uint8_t> class u32_to_u8_iterator : public boost::iterator_facade<u32_to_u8_iterator<BaseIterator, U8Type>, U8Type, std::bidirectional_iterator_tag, const U8Type> { typedef boost::iterator_facade<u32_to_u8_iterator<BaseIterator, U8Type>, U8Type, std::bidirectional_iterator_tag, const U8Type> base_type; -#if !defined(BOOST_NO_STD_ITERATOR_TRAITS) && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +#if !defined(BOOST_NO_STD_ITERATOR_TRAITS) typedef typename std::iterator_traits<BaseIterator>::value_type base_value_type; BOOST_STATIC_ASSERT(sizeof(base_value_type)*CHAR_BIT == 32); BOOST_STATIC_ASSERT(sizeof(U8Type)*CHAR_BIT == 8); #endif public: typename base_type::reference dereference()const { if(m_current == 4) extract_current(); return m_values[m_current]; } bool equal(const u32_to_u8_iterator& that)const { if(m_position == that.m_position) { // either the m_current's must be equal, or one must be 0 and // the other 4: which means neither must have bits 1 or 2 set: return (m_current == that.m_current) || (((m_current | that.m_current) & 3) == 0); } return false; } void increment() { // if we have a pending read then read now, so that we know whether // to skip a position, or move to a low-surrogate: if(m_current == 4) { // pending read: extract_current(); } // move to the next surrogate position: @@ -467,183 +467,209 @@ private: { m_values[0] = static_cast<unsigned char>(0xC0u + (c >> 6)); m_values[1] = static_cast<unsigned char>(0x80u + (c & 0x3Fu)); m_values[2] = static_cast<unsigned char>(0u); m_values[3] = static_cast<unsigned char>(0u); } else if(c < 0x10000u) { m_values[0] = static_cast<unsigned char>(0xE0u + (c >> 12)); m_values[1] = static_cast<unsigned char>(0x80u + ((c >> 6) & 0x3Fu)); m_values[2] = static_cast<unsigned char>(0x80u + (c & 0x3Fu)); m_values[3] = static_cast<unsigned char>(0u); } else { m_values[0] = static_cast<unsigned char>(0xF0u + (c >> 18)); m_values[1] = static_cast<unsigned char>(0x80u + ((c >> 12) & 0x3Fu)); m_values[2] = static_cast<unsigned char>(0x80u + ((c >> 6) & 0x3Fu)); m_values[3] = static_cast<unsigned char>(0x80u + (c & 0x3Fu)); } m_current= 0; } BaseIterator m_position; mutable U8Type m_values[5]; mutable unsigned m_current; }; template <class BaseIterator, class U32Type = ::boost::uint32_t> class u8_to_u32_iterator : public boost::iterator_facade<u8_to_u32_iterator<BaseIterator, U32Type>, U32Type, std::bidirectional_iterator_tag, const U32Type> { typedef boost::iterator_facade<u8_to_u32_iterator<BaseIterator, U32Type>, U32Type, std::bidirectional_iterator_tag, const U32Type> base_type; // special values for pending iterator reads: BOOST_STATIC_CONSTANT(U32Type, pending_read = 0xffffffffu); -#if !defined(BOOST_NO_STD_ITERATOR_TRAITS) && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +#if !defined(BOOST_NO_STD_ITERATOR_TRAITS) typedef typename std::iterator_traits<BaseIterator>::value_type base_value_type; BOOST_STATIC_ASSERT(sizeof(base_value_type)*CHAR_BIT == 8); BOOST_STATIC_ASSERT(sizeof(U32Type)*CHAR_BIT == 32); #endif public: typename base_type::reference dereference()const { if(m_value == pending_read) extract_current(); return m_value; } bool equal(const u8_to_u32_iterator& that)const { return m_position == that.m_position; } void increment() { + // We must not start with a continuation character: + if((static_cast<boost::uint8_t>(*m_position) & 0xC0) == 0x80) + invalid_sequence(); // skip high surrogate first if there is one: unsigned c = detail::utf8_byte_count(*m_position); - std::advance(m_position, c); + if(m_value == pending_read) + { + // Since we haven't read in a value, we need to validate the code points: + for(unsigned i = 0; i < c; ++i) + { + ++m_position; + // We must have a continuation byte: + if((i != c - 1) && ((static_cast<boost::uint8_t>(*m_position) & 0xC0) != 0x80)) + invalid_sequence(); + } + } + else + { + std::advance(m_position, c); + } m_value = pending_read; } void decrement() { // Keep backtracking until we don't have a trailing character: unsigned count = 0; while((*--m_position & 0xC0u) == 0x80u) ++count; // now check that the sequence was valid: if(count != detail::utf8_trailing_byte_count(*m_position)) invalid_sequence(); m_value = pending_read; } BaseIterator base()const { return m_position; } // construct: u8_to_u32_iterator() : m_position() { m_value = pending_read; } u8_to_u32_iterator(BaseIterator b) : m_position(b) { m_value = pending_read; } // // Checked constructor: // u8_to_u32_iterator(BaseIterator b, BaseIterator start, BaseIterator end) : m_position(b) { m_value = pending_read; // // We must not start with a continuation character, or end with a // truncated UTF-8 sequence otherwise we run the risk of going past // the start/end of the underlying sequence: // if(start != end) { unsigned char v = *start; if((v & 0xC0u) == 0x80u) invalid_sequence(); if((b != start) && (b != end) && ((*b & 0xC0u) == 0x80u)) invalid_sequence(); BaseIterator pos = end; do { v = *--pos; } while((start != pos) && ((v & 0xC0u) == 0x80u)); std::ptrdiff_t extra = detail::utf8_byte_count(v); if(std::distance(pos, end) < extra) invalid_sequence(); } } private: static void invalid_sequence() { std::out_of_range e("Invalid UTF-8 sequence encountered while trying to encode UTF-32 character"); boost::throw_exception(e); } void extract_current()const { m_value = static_cast<U32Type>(static_cast< ::boost::uint8_t>(*m_position)); // we must not have a continuation character: if((m_value & 0xC0u) == 0x80u) invalid_sequence(); - // see how many extra byts we have: + // see how many extra bytes we have: unsigned extra = detail::utf8_trailing_byte_count(*m_position); // extract the extra bits, 6 from each extra byte: BaseIterator next(m_position); for(unsigned c = 0; c < extra; ++c) { ++next; m_value <<= 6; + // We must have a continuation byte: + if((static_cast<boost::uint8_t>(*next) & 0xC0) != 0x80) + invalid_sequence(); m_value += static_cast<boost::uint8_t>(*next) & 0x3Fu; } // we now need to remove a few of the leftmost bits, but how many depends // upon how many extra bytes we've extracted: static const boost::uint32_t masks[4] = { 0x7Fu, 0x7FFu, 0xFFFFu, 0x1FFFFFu, }; m_value &= masks[extra]; - // check the result: + // check the result is in range: if(m_value > static_cast<U32Type>(0x10FFFFu)) invalid_sequence(); + // The result must not be a surrogate: + if((m_value >= static_cast<U32Type>(0xD800)) && (m_value <= static_cast<U32Type>(0xDFFF))) + invalid_sequence(); + // We should not have had an invalidly encoded UTF8 sequence: + if((extra > 0) && (m_value <= static_cast<U32Type>(masks[extra - 1]))) + invalid_sequence(); } BaseIterator m_position; mutable U32Type m_value; }; template <class BaseIterator> class utf16_output_iterator { public: typedef void difference_type; typedef void value_type; typedef boost::uint32_t* pointer; typedef boost::uint32_t& reference; typedef std::output_iterator_tag iterator_category; utf16_output_iterator(const BaseIterator& b) : m_position(b){} utf16_output_iterator(const utf16_output_iterator& that) : m_position(that.m_position){} utf16_output_iterator& operator=(const utf16_output_iterator& that) { m_position = that.m_position; return *this; } const utf16_output_iterator& operator*()const { return *this; } void operator=(boost::uint32_t val)const { push(val); } utf16_output_iterator& operator++() { return *this; diff --git a/3rdParty/Boost/src/boost/regex/v4/basic_regex.hpp b/3rdParty/Boost/src/boost/regex/v4/basic_regex.hpp index 0b63e3a..ae86152 100644 --- a/3rdParty/Boost/src/boost/regex/v4/basic_regex.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/basic_regex.hpp @@ -204,101 +204,99 @@ public: basic_regex_implementation(){} basic_regex_implementation(const ::boost::shared_ptr< ::boost::regex_traits_wrapper<traits> >& t) : regex_data<charT, traits>(t) {} void assign(const charT* arg_first, const charT* arg_last, flag_type f) { regex_data<charT, traits>* pdat = this; basic_regex_parser<charT, traits> parser(pdat); parser.parse(arg_first, arg_last, f); } locale_type BOOST_REGEX_CALL imbue(locale_type l) { return this->m_ptraits->imbue(l); } locale_type BOOST_REGEX_CALL getloc()const { return this->m_ptraits->getloc(); } std::basic_string<charT> BOOST_REGEX_CALL str()const { std::basic_string<charT> result; if(this->m_status == 0) result = std::basic_string<charT>(this->m_expression, this->m_expression_len); return result; } const_iterator BOOST_REGEX_CALL expression()const { return this->m_expression; } std::pair<const_iterator, const_iterator> BOOST_REGEX_CALL subexpression(std::size_t n)const { - if(n == 0) - boost::throw_exception(std::out_of_range("0 is not a valid subexpression index.")); - const std::pair<std::size_t, std::size_t>& pi = this->m_subs.at(n - 1); + const std::pair<std::size_t, std::size_t>& pi = this->m_subs.at(n); std::pair<const_iterator, const_iterator> p(expression() + pi.first, expression() + pi.second); return p; } // // begin, end: const_iterator BOOST_REGEX_CALL begin()const { return (this->m_status ? 0 : this->m_expression); } const_iterator BOOST_REGEX_CALL end()const { return (this->m_status ? 0 : this->m_expression + this->m_expression_len); } flag_type BOOST_REGEX_CALL flags()const { return this->m_flags; } size_type BOOST_REGEX_CALL size()const { return this->m_expression_len; } int BOOST_REGEX_CALL status()const { return this->m_status; } size_type BOOST_REGEX_CALL mark_count()const { - return this->m_mark_count; + return this->m_mark_count - 1; } const re_detail::re_syntax_base* get_first_state()const { return this->m_first_state; } unsigned get_restart_type()const { return this->m_restart_type; } const unsigned char* get_map()const { return this->m_startmap; } const ::boost::regex_traits_wrapper<traits>& get_traits()const { return *(this->m_ptraits); } bool can_be_null()const { return this->m_can_be_null; } const regex_data<charT, traits>& get_data()const { basic_regex_implementation<charT, traits> const* p = this; return *static_cast<const regex_data<charT, traits>*>(p); } }; } // namespace re_detail // // class basic_regex: // represents the compiled // regular expression: // diff --git a/3rdParty/Boost/src/boost/regex/v4/basic_regex_creator.hpp b/3rdParty/Boost/src/boost/regex/v4/basic_regex_creator.hpp index efb649c..821fb82 100644 --- a/3rdParty/Boost/src/boost/regex/v4/basic_regex_creator.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/basic_regex_creator.hpp @@ -15,73 +15,71 @@ * VERSION see <boost/version.hpp> * DESCRIPTION: Declares template class basic_regex_creator which fills in * the data members of a regex_data object. */ #ifndef BOOST_REGEX_V4_BASIC_REGEX_CREATOR_HPP #define BOOST_REGEX_V4_BASIC_REGEX_CREATOR_HPP #ifdef BOOST_MSVC #pragma warning(push) #pragma warning(disable: 4103) #endif #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX #endif #ifdef BOOST_MSVC #pragma warning(pop) #endif #ifdef BOOST_MSVC # pragma warning(push) # pragma warning(disable: 4800) #endif namespace boost{ namespace re_detail{ template <class charT> struct digraph : public std::pair<charT, charT> { digraph() : std::pair<charT, charT>(0, 0){} digraph(charT c1) : std::pair<charT, charT>(c1, 0){} digraph(charT c1, charT c2) : std::pair<charT, charT>(c1, c2) {} -#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) digraph(const digraph<charT>& d) : std::pair<charT, charT>(d.first, d.second){} -#endif template <class Seq> digraph(const Seq& s) : std::pair<charT, charT>() { BOOST_ASSERT(s.size() <= 2); BOOST_ASSERT(s.size()); this->first = s[0]; this->second = (s.size() > 1) ? s[1] : 0; } }; template <class charT, class traits> class basic_char_set { public: typedef digraph<charT> digraph_type; typedef typename traits::string_type string_type; typedef typename traits::char_class_type m_type; basic_char_set() { m_negate = false; m_has_digraphs = false; m_classes = 0; m_negated_classes = 0; m_empty = true; } void add_single(const digraph_type& s) { m_singles.insert(m_singles.end(), s); if(s.second) m_has_digraphs = true; m_empty = false; } void add_range(const digraph_type& first, const digraph_type& end) @@ -314,71 +312,71 @@ re_syntax_base* basic_regex_creator<charT, traits>::insert_state(std::ptrdiff_t m_pdata->m_data.align(); // set the offset to the next state in our last one: if(m_last_state) m_last_state->next.i = m_pdata->m_data.size() - getoffset(m_last_state); // remember the last state position: std::ptrdiff_t off = getoffset(m_last_state) + s; // now actually insert our data: re_syntax_base* new_state = static_cast<re_syntax_base*>(m_pdata->m_data.insert(pos, s)); // fill in boilerplate options in the new state: new_state->next.i = s; new_state->type = t; m_last_state = getaddress(off); return new_state; } template <class charT, class traits> re_literal* basic_regex_creator<charT, traits>::append_literal(charT c) { re_literal* result; // start by seeing if we have an existing re_literal we can extend: if((0 == m_last_state) || (m_last_state->type != syntax_element_literal)) { // no existing re_literal, create a new one: result = static_cast<re_literal*>(append_state(syntax_element_literal, sizeof(re_literal) + sizeof(charT))); result->length = 1; *static_cast<charT*>(static_cast<void*>(result+1)) = m_traits.translate(c, m_icase); } else { // we have an existing re_literal, extend it: std::ptrdiff_t off = getoffset(m_last_state); m_pdata->m_data.extend(sizeof(charT)); m_last_state = result = static_cast<re_literal*>(getaddress(off)); charT* characters = static_cast<charT*>(static_cast<void*>(result+1)); characters[result->length] = m_traits.translate(c, m_icase); - ++(result->length); + result->length += 1; } return result; } template <class charT, class traits> inline re_syntax_base* basic_regex_creator<charT, traits>::append_set( const basic_char_set<charT, traits>& char_set) { typedef mpl::bool_< (sizeof(charT) == 1) > truth_type; return char_set.has_digraphs() ? append_set(char_set, static_cast<mpl::false_*>(0)) : append_set(char_set, static_cast<truth_type*>(0)); } template <class charT, class traits> re_syntax_base* basic_regex_creator<charT, traits>::append_set( const basic_char_set<charT, traits>& char_set, mpl::false_*) { typedef typename traits::string_type string_type; typedef typename basic_char_set<charT, traits>::list_iterator item_iterator; typedef typename traits::char_class_type m_type; re_set_long<m_type>* result = static_cast<re_set_long<m_type>*>(append_state(syntax_element_long_set, sizeof(re_set_long<m_type>))); // // fill in the basics: // result->csingles = static_cast<unsigned int>(::boost::re_detail::distance(char_set.singles_begin(), char_set.singles_end())); result->cranges = static_cast<unsigned int>(::boost::re_detail::distance(char_set.ranges_begin(), char_set.ranges_end())) / 2; result->cequivalents = static_cast<unsigned int>(::boost::re_detail::distance(char_set.equivalents_begin(), char_set.equivalents_end())); result->cclasses = char_set.classes(); result->cnclasses = char_set.negated_classes(); if(flags() & regbase::icase) { // adjust classes as needed: if(((result->cclasses & m_lower_mask) == m_lower_mask) || ((result->cclasses & m_upper_mask) == m_upper_mask)) @@ -401,137 +399,120 @@ re_syntax_base* basic_regex_creator<charT, traits>::append_set( last = char_set.singles_end(); while(first != last) { charT* p = static_cast<charT*>(this->m_pdata->m_data.extend(sizeof(charT) * (first->second ? 3 : 2))); p[0] = m_traits.translate(first->first, m_icase); if(first->second) { p[1] = m_traits.translate(first->second, m_icase); p[2] = 0; } else p[1] = 0; ++first; } // // now extend with all the ranges: // first = char_set.ranges_begin(); last = char_set.ranges_end(); while(first != last) { // first grab the endpoints of the range: digraph<charT> c1 = *first; c1.first = this->m_traits.translate(c1.first, this->m_icase); c1.second = this->m_traits.translate(c1.second, this->m_icase); ++first; digraph<charT> c2 = *first; c2.first = this->m_traits.translate(c2.first, this->m_icase); c2.second = this->m_traits.translate(c2.second, this->m_icase); ++first; string_type s1, s2; // different actions now depending upon whether collation is turned on: if(flags() & regex_constants::collate) { // we need to transform our range into sort keys: -#if BOOST_WORKAROUND(__GNUC__, < 3) - string_type in(3, charT(0)); - in[0] = c1.first; - in[1] = c1.second; - s1 = this->m_traits.transform(in.c_str(), (in[1] ? in.c_str()+2 : in.c_str()+1)); - in[0] = c2.first; - in[1] = c2.second; - s2 = this->m_traits.transform(in.c_str(), (in[1] ? in.c_str()+2 : in.c_str()+1)); -#else charT a1[3] = { c1.first, c1.second, charT(0), }; charT a2[3] = { c2.first, c2.second, charT(0), }; s1 = this->m_traits.transform(a1, (a1[1] ? a1+2 : a1+1)); s2 = this->m_traits.transform(a2, (a2[1] ? a2+2 : a2+1)); -#endif if(s1.size() == 0) s1 = string_type(1, charT(0)); if(s2.size() == 0) s2 = string_type(1, charT(0)); } else { if(c1.second) { s1.insert(s1.end(), c1.first); s1.insert(s1.end(), c1.second); } else s1 = string_type(1, c1.first); if(c2.second) { s2.insert(s2.end(), c2.first); s2.insert(s2.end(), c2.second); } else s2.insert(s2.end(), c2.first); } if(s1 > s2) { // Oops error: return 0; } charT* p = static_cast<charT*>(this->m_pdata->m_data.extend(sizeof(charT) * (s1.size() + s2.size() + 2) ) ); re_detail::copy(s1.begin(), s1.end(), p); p[s1.size()] = charT(0); p += s1.size() + 1; re_detail::copy(s2.begin(), s2.end(), p); p[s2.size()] = charT(0); } // // now process the equivalence classes: // first = char_set.equivalents_begin(); last = char_set.equivalents_end(); while(first != last) { string_type s; if(first->second) { -#if BOOST_WORKAROUND(__GNUC__, < 3) - string_type in(3, charT(0)); - in[0] = first->first; - in[1] = first->second; - s = m_traits.transform_primary(in.c_str(), in.c_str()+2); -#else charT cs[3] = { first->first, first->second, charT(0), }; s = m_traits.transform_primary(cs, cs+2); -#endif } else s = m_traits.transform_primary(&first->first, &first->first+1); if(s.empty()) return 0; // invalid or unsupported equivalence class charT* p = static_cast<charT*>(this->m_pdata->m_data.extend(sizeof(charT) * (s.size()+1) ) ); re_detail::copy(s.begin(), s.end(), p); p[s.size()] = charT(0); ++first; } // // finally reset the address of our last state: // m_last_state = result = static_cast<re_set_long<m_type>*>(getaddress(offset)); return result; } template<class T> inline bool char_less(T t1, T t2) { return t1 < t2; } inline bool char_less(char t1, char t2) { return static_cast<unsigned char>(t1) < static_cast<unsigned char>(t2); } inline bool char_less(signed char t1, signed char t2) { return static_cast<unsigned char>(t1) < static_cast<unsigned char>(t2); } template <class charT, class traits> re_syntax_base* basic_regex_creator<charT, traits>::append_set( const basic_char_set<charT, traits>& char_set, mpl::true_*) { @@ -706,78 +687,78 @@ void basic_regex_creator<charT, traits>::finalize(const charT* p1, const charT* // create main startmap: std::memset(m_pdata->m_startmap, 0, sizeof(m_pdata->m_startmap)); m_pdata->m_can_be_null = 0; m_bad_repeats = 0; if(m_has_recursions) m_recursion_checks.assign(1 + m_pdata->m_mark_count, false); create_startmap(m_pdata->m_first_state, m_pdata->m_startmap, &(m_pdata->m_can_be_null), mask_all); // get the restart type: m_pdata->m_restart_type = get_restart_type(m_pdata->m_first_state); // optimise a leading repeat if there is one: probe_leading_repeat(m_pdata->m_first_state); } template <class charT, class traits> void basic_regex_creator<charT, traits>::fixup_pointers(re_syntax_base* state) { while(state) { switch(state->type) { case syntax_element_recurse: m_has_recursions = true; if(state->next.i) state->next.p = getaddress(state->next.i, state); else state->next.p = 0; break; case syntax_element_rep: case syntax_element_dot_rep: case syntax_element_char_rep: case syntax_element_short_set_rep: case syntax_element_long_set_rep: // set the state_id of this repeat: static_cast<re_repeat*>(state)->state_id = m_repeater_id++; - // fall through: + BOOST_FALLTHROUGH; case syntax_element_alt: std::memset(static_cast<re_alt*>(state)->_map, 0, sizeof(static_cast<re_alt*>(state)->_map)); static_cast<re_alt*>(state)->can_be_null = 0; - // fall through: + BOOST_FALLTHROUGH; case syntax_element_jump: static_cast<re_jump*>(state)->alt.p = getaddress(static_cast<re_jump*>(state)->alt.i, state); - // fall through again: + BOOST_FALLTHROUGH; default: if(state->next.i) state->next.p = getaddress(state->next.i, state); else state->next.p = 0; } state = state->next.p; } } template <class charT, class traits> void basic_regex_creator<charT, traits>::fixup_recursions(re_syntax_base* state) { re_syntax_base* base = state; while(state) { switch(state->type) { case syntax_element_assert_backref: { // just check that the index is valid: int idx = static_cast<const re_brace*>(state)->index; if(idx < 0) { idx = -idx-1; if(idx >= 10000) { idx = m_pdata->get_id(idx); if(idx <= 0) { // check of sub-expression that doesn't exist: if(0 == this->m_pdata->m_status) // update the error code if not already set this->m_pdata->m_status = boost::regex_constants::error_bad_pattern; // // clear the expression, we should be empty: @@ -845,135 +826,136 @@ void basic_regex_creator<charT, traits>::fixup_recursions(re_syntax_base* state) } if(next_rep_id) break; p = p->next.p; } if(next_rep_id > 0) { static_cast<re_recurse*>(state)->state_id = next_rep_id - 1; } break; } p = p->next.p; } if(!ok) { // recursion to sub-expression that doesn't exist: if(0 == this->m_pdata->m_status) // update the error code if not already set this->m_pdata->m_status = boost::regex_constants::error_bad_pattern; // // clear the expression, we should be empty: // this->m_pdata->m_expression = 0; this->m_pdata->m_expression_len = 0; // // and throw if required: // if(0 == (this->flags() & regex_constants::no_except)) { std::string message = "Encountered a forward reference to a recursive sub-expression that does not exist."; boost::regex_error e(message, boost::regex_constants::error_bad_pattern, 0); e.raise(); } } } + break; default: break; } state = state->next.p; } } template <class charT, class traits> void basic_regex_creator<charT, traits>::create_startmaps(re_syntax_base* state) { // non-recursive implementation: // create the last map in the machine first, so that earlier maps // can make use of the result... // // This was originally a recursive implementation, but that caused stack // overflows with complex expressions on small stacks (think COM+). // start by saving the case setting: bool l_icase = m_icase; std::vector<std::pair<bool, re_syntax_base*> > v; while(state) { switch(state->type) { case syntax_element_toggle_case: // we need to track case changes here: m_icase = static_cast<re_case*>(state)->icase; state = state->next.p; continue; case syntax_element_alt: case syntax_element_rep: case syntax_element_dot_rep: case syntax_element_char_rep: case syntax_element_short_set_rep: case syntax_element_long_set_rep: // just push the state onto our stack for now: v.push_back(std::pair<bool, re_syntax_base*>(m_icase, state)); state = state->next.p; break; case syntax_element_backstep: // we need to calculate how big the backstep is: static_cast<re_brace*>(state)->index = this->calculate_backstep(state->next.p); if(static_cast<re_brace*>(state)->index < 0) { // Oops error: if(0 == this->m_pdata->m_status) // update the error code if not already set this->m_pdata->m_status = boost::regex_constants::error_bad_pattern; // // clear the expression, we should be empty: // this->m_pdata->m_expression = 0; this->m_pdata->m_expression_len = 0; // // and throw if required: // if(0 == (this->flags() & regex_constants::no_except)) { std::string message = "Invalid lookbehind assertion encountered in the regular expression."; boost::regex_error e(message, boost::regex_constants::error_bad_pattern, 0); e.raise(); } } - // fall through: + BOOST_FALLTHROUGH; default: state = state->next.p; } } // now work through our list, building all the maps as we go: while(v.size()) { // Initialize m_recursion_checks if we need it: if(m_has_recursions) m_recursion_checks.assign(1 + m_pdata->m_mark_count, false); const std::pair<bool, re_syntax_base*>& p = v.back(); m_icase = p.first; state = p.second; v.pop_back(); // Build maps: m_bad_repeats = 0; create_startmap(state->next.p, static_cast<re_alt*>(state)->_map, &static_cast<re_alt*>(state)->can_be_null, mask_take); m_bad_repeats = 0; if(m_has_recursions) m_recursion_checks.assign(1 + m_pdata->m_mark_count, false); create_startmap(static_cast<re_alt*>(state)->alt.p, static_cast<re_alt*>(state)->_map, &static_cast<re_alt*>(state)->can_be_null, mask_skip); // adjust the type of the state to allow for faster matching: state->type = this->get_repeat_type(state); } // restore case sensitivity: m_icase = l_icase; } template <class charT, class traits> int basic_regex_creator<charT, traits>::calculate_backstep(re_syntax_base* state) { @@ -1121,77 +1103,78 @@ void basic_regex_creator<charT, traits>::create_startmap(re_syntax_base* state, case syntax_element_recurse: { if(state->type == syntax_element_startmark) recursion_sub = static_cast<re_brace*>(state)->index; else recursion_sub = 0; if(m_recursion_checks[recursion_sub]) { // Infinite recursion!! if(0 == this->m_pdata->m_status) // update the error code if not already set this->m_pdata->m_status = boost::regex_constants::error_bad_pattern; // // clear the expression, we should be empty: // this->m_pdata->m_expression = 0; this->m_pdata->m_expression_len = 0; // // and throw if required: // if(0 == (this->flags() & regex_constants::no_except)) { std::string message = "Encountered an infinite recursion."; boost::regex_error e(message, boost::regex_constants::error_bad_pattern, 0); e.raise(); } } else if(recursion_start == 0) { recursion_start = state; recursion_restart = state->next.p; state = static_cast<re_jump*>(state)->alt.p; m_recursion_checks[recursion_sub] = true; break; } m_recursion_checks[recursion_sub] = true; - // fall through, can't handle nested recursion here... + // can't handle nested recursion here... + BOOST_FALLTHROUGH; } case syntax_element_backref: // can be null, and any character can match: if(pnull) *pnull |= mask; - // fall through: + BOOST_FALLTHROUGH; case syntax_element_wild: { // can't be null, any character can match: set_all_masks(l_map, mask); return; } case syntax_element_match: { // must be null, any character can match: set_all_masks(l_map, mask); if(pnull) *pnull |= mask; return; } case syntax_element_word_start: { // recurse, then AND with all the word characters: create_startmap(state->next.p, l_map, pnull, mask); if(l_map) { l_map[0] |= mask_init; for(unsigned int i = 0; i < (1u << CHAR_BIT); ++i) { if(!m_traits.isctype(static_cast<charT>(i), m_word_mask)) l_map[i] &= static_cast<unsigned char>(~mask); } } return; } case syntax_element_word_end: { // recurse, then AND with all the word characters: create_startmap(state->next.p, l_map, pnull, mask); if(l_map) { @@ -1327,71 +1310,71 @@ void basic_regex_creator<charT, traits>::create_startmap(re_syntax_base* state, // case we should check whatever follows that recursion, as well as whatever // follows this state: // if(m_pdata->m_has_recursions && static_cast<re_brace*>(state)->index) { bool ok = false; re_syntax_base* p = m_pdata->m_first_state; while(p) { if(p->type == syntax_element_recurse) { re_brace* p2 = static_cast<re_brace*>(static_cast<re_jump*>(p)->alt.p); if((p2->type == syntax_element_startmark) && (p2->index == static_cast<re_brace*>(state)->index)) { ok = true; break; } } p = p->next.p; } if(ok) { create_startmap(p->next.p, l_map, pnull, mask); } } state = state->next.p; break; case syntax_element_startmark: // need to handle independent subs as a special case: if(static_cast<re_brace*>(state)->index == -3) { state = state->next.p->next.p; break; } - // otherwise fall through: + BOOST_FALLTHROUGH; default: state = state->next.p; } ++not_last_jump; } } template <class charT, class traits> unsigned basic_regex_creator<charT, traits>::get_restart_type(re_syntax_base* state) { // // find out how the machine starts, so we can optimise the search: // while(state) { switch(state->type) { case syntax_element_startmark: case syntax_element_endmark: state = state->next.p; continue; case syntax_element_start_line: return regbase::restart_line; case syntax_element_word_start: return regbase::restart_word; case syntax_element_buffer_start: return regbase::restart_buf; case syntax_element_restart_continue: return regbase::restart_continue; default: state = 0; continue; } } return regbase::restart_any; @@ -1424,70 +1407,71 @@ bool basic_regex_creator<charT, traits>::is_bad_repeat(re_syntax_base* pt) switch(pt->type) { case syntax_element_rep: case syntax_element_dot_rep: case syntax_element_char_rep: case syntax_element_short_set_rep: case syntax_element_long_set_rep: { unsigned state_id = static_cast<re_repeat*>(pt)->state_id; if(state_id > sizeof(m_bad_repeats) * CHAR_BIT) return true; // run out of bits, assume we can't traverse this one. static const boost::uintmax_t one = 1uL; return m_bad_repeats & (one << state_id); } default: return false; } } template <class charT, class traits> void basic_regex_creator<charT, traits>::set_bad_repeat(re_syntax_base* pt) { switch(pt->type) { case syntax_element_rep: case syntax_element_dot_rep: case syntax_element_char_rep: case syntax_element_short_set_rep: case syntax_element_long_set_rep: { unsigned state_id = static_cast<re_repeat*>(pt)->state_id; static const boost::uintmax_t one = 1uL; if(state_id <= sizeof(m_bad_repeats) * CHAR_BIT) m_bad_repeats |= (one << state_id); } + break; default: break; } } template <class charT, class traits> syntax_element_type basic_regex_creator<charT, traits>::get_repeat_type(re_syntax_base* state) { typedef typename traits::char_class_type m_type; if(state->type == syntax_element_rep) { // check to see if we are repeating a single state: if(state->next.p->next.p->next.p == static_cast<re_alt*>(state)->alt.p) { switch(state->next.p->type) { case re_detail::syntax_element_wild: return re_detail::syntax_element_dot_rep; case re_detail::syntax_element_literal: return re_detail::syntax_element_char_rep; case re_detail::syntax_element_set: return re_detail::syntax_element_short_set_rep; case re_detail::syntax_element_long_set: if(static_cast<re_detail::re_set_long<m_type>*>(state->next.p)->singleton) return re_detail::syntax_element_long_set_rep; break; default: break; } } } return state->type; } template <class charT, class traits> @@ -1505,64 +1489,64 @@ void basic_regex_creator<charT, traits>::probe_leading_repeat(re_syntax_base* st state = state->next.p; continue; } if((static_cast<re_brace*>(state)->index == -1) || (static_cast<re_brace*>(state)->index == -2)) { // skip past the zero width assertion: state = static_cast<const re_jump*>(state->next.p)->alt.p->next.p; continue; } if(static_cast<re_brace*>(state)->index == -3) { // Have to skip the leading jump state: state = state->next.p->next.p; continue; } return; case syntax_element_endmark: case syntax_element_start_line: case syntax_element_end_line: case syntax_element_word_boundary: case syntax_element_within_word: case syntax_element_word_start: case syntax_element_word_end: case syntax_element_buffer_start: case syntax_element_buffer_end: case syntax_element_restart_continue: state = state->next.p; break; case syntax_element_dot_rep: case syntax_element_char_rep: case syntax_element_short_set_rep: case syntax_element_long_set_rep: if(this->m_has_backrefs == 0) static_cast<re_repeat*>(state)->leading = true; - // fall through: + BOOST_FALLTHROUGH; default: return; } }while(state); } } // namespace re_detail } // namespace boost #ifdef BOOST_MSVC # pragma warning(pop) #endif #ifdef BOOST_MSVC #pragma warning(push) #pragma warning(disable: 4103) #endif #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_SUFFIX #endif #ifdef BOOST_MSVC #pragma warning(pop) #endif #endif diff --git a/3rdParty/Boost/src/boost/regex/v4/basic_regex_parser.hpp b/3rdParty/Boost/src/boost/regex/v4/basic_regex_parser.hpp index 72dc4ee..2757898 100644 --- a/3rdParty/Boost/src/boost/regex/v4/basic_regex_parser.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/basic_regex_parser.hpp @@ -337,71 +337,71 @@ bool basic_regex_parser<charT, traits>::parse_extended() case regex_constants::syntax_plus: if(m_position == this->m_base) { fail(regex_constants::error_badrepeat, 0, "The repeat operator \"+\" cannot start a regular expression."); return false; } ++m_position; return parse_repeat(1); case regex_constants::syntax_open_brace: ++m_position; return parse_repeat_range(false); case regex_constants::syntax_close_brace: fail(regex_constants::error_brace, this->m_position - this->m_base, "Found a closing repetition operator } with no corresponding {."); return false; case regex_constants::syntax_or: return parse_alt(); case regex_constants::syntax_open_set: return parse_set(); case regex_constants::syntax_newline: if(this->flags() & regbase::newline_alt) return parse_alt(); else return parse_literal(); case regex_constants::syntax_hash: // // If we have a mod_x flag set, then skip until // we get to a newline character: // if((this->flags() & (regbase::no_perl_ex|regbase::mod_x)) == regbase::mod_x) { while((m_position != m_end) && !is_separator(*m_position++)){} return true; } - // Otherwise fall through: + BOOST_FALLTHROUGH; default: result = parse_literal(); break; } return result; } #ifdef BOOST_MSVC #pragma warning(pop) #endif template <class charT, class traits> bool basic_regex_parser<charT, traits>::parse_literal() { // append this as a literal provided it's not a space character // or the perl option regbase::mod_x is not set: if( ((this->flags() & (regbase::main_option_type|regbase::mod_x|regbase::no_perl_ex)) != regbase::mod_x) || !this->m_traits.isctype(*m_position, this->m_mask_space)) this->append_literal(*m_position); ++m_position; return true; } template <class charT, class traits> bool basic_regex_parser<charT, traits>::parse_open_paren() { // // skip the '(' and error check: // if(++m_position == m_end) { fail(regex_constants::error_paren, m_position - m_base); return false; @@ -591,190 +591,190 @@ bool basic_regex_parser<charT, traits>::parse_basic_escape() case regex_constants::escape_type_not_word_assert: if(this->flags() & regbase::emacs_ex) { ++m_position; this->append_state(syntax_element_within_word); } else result = parse_literal(); break; case regex_constants::escape_type_left_word: if(this->flags() & regbase::emacs_ex) { ++m_position; this->append_state(syntax_element_word_start); } else result = parse_literal(); break; case regex_constants::escape_type_right_word: if(this->flags() & regbase::emacs_ex) { ++m_position; this->append_state(syntax_element_word_end); } else result = parse_literal(); break; default: if(this->flags() & regbase::emacs_ex) { bool negate = true; switch(*m_position) { case 'w': negate = false; - // fall through: + BOOST_FALLTHROUGH; case 'W': { basic_char_set<charT, traits> char_set; if(negate) char_set.negate(); char_set.add_class(this->m_word_mask); if(0 == this->append_set(char_set)) { fail(regex_constants::error_ctype, m_position - m_base); return false; } ++m_position; return true; } case 's': negate = false; - // fall through: + BOOST_FALLTHROUGH; case 'S': return add_emacs_code(negate); case 'c': case 'C': // not supported yet: fail(regex_constants::error_escape, m_position - m_base, "The \\c and \\C escape sequences are not supported by POSIX basic regular expressions: try the Perl syntax instead."); return false; default: break; } } result = parse_literal(); break; } return result; } template <class charT, class traits> bool basic_regex_parser<charT, traits>::parse_extended_escape() { ++m_position; if(m_position == m_end) { fail(regex_constants::error_escape, m_position - m_base, "Incomplete escape sequence found."); return false; } bool negate = false; // in case this is a character class escape: \w \d etc switch(this->m_traits.escape_syntax_type(*m_position)) { case regex_constants::escape_type_not_class: negate = true; - // fall through: + BOOST_FALLTHROUGH; case regex_constants::escape_type_class: { escape_type_class_jump: typedef typename traits::char_class_type m_type; m_type m = this->m_traits.lookup_classname(m_position, m_position+1); if(m != 0) { basic_char_set<charT, traits> char_set; if(negate) char_set.negate(); char_set.add_class(m); if(0 == this->append_set(char_set)) { fail(regex_constants::error_ctype, m_position - m_base); return false; } ++m_position; return true; } // // not a class, just a regular unknown escape: // this->append_literal(unescape_character()); break; } case regex_constants::syntax_digit: return parse_backref(); case regex_constants::escape_type_left_word: ++m_position; this->append_state(syntax_element_word_start); break; case regex_constants::escape_type_right_word: ++m_position; this->append_state(syntax_element_word_end); break; case regex_constants::escape_type_start_buffer: ++m_position; this->append_state(syntax_element_buffer_start); break; case regex_constants::escape_type_end_buffer: ++m_position; this->append_state(syntax_element_buffer_end); break; case regex_constants::escape_type_word_assert: ++m_position; this->append_state(syntax_element_word_boundary); break; case regex_constants::escape_type_not_word_assert: ++m_position; this->append_state(syntax_element_within_word); break; case regex_constants::escape_type_Z: ++m_position; this->append_state(syntax_element_soft_buffer_end); break; case regex_constants::escape_type_Q: return parse_QE(); case regex_constants::escape_type_C: return parse_match_any(); case regex_constants::escape_type_X: ++m_position; this->append_state(syntax_element_combining); break; case regex_constants::escape_type_G: ++m_position; this->append_state(syntax_element_restart_continue); break; case regex_constants::escape_type_not_property: negate = true; - // fall through: + BOOST_FALLTHROUGH; case regex_constants::escape_type_property: { ++m_position; char_class_type m; if(m_position == m_end) { fail(regex_constants::error_escape, m_position - m_base, "Incomplete property escape found."); return false; } // maybe have \p{ddd} if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_open_brace) { const charT* base = m_position; // skip forward until we find enclosing brace: while((m_position != m_end) && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_brace)) ++m_position; if(m_position == m_end) { fail(regex_constants::error_escape, m_position - m_base, "Closing } missing from property escape sequence."); return false; } m = this->m_traits.lookup_classname(++base, m_position++); } else { m = this->m_traits.lookup_classname(m_position, m_position+1); ++m_position; } if(m != 0) { basic_char_set<charT, traits> char_set; if(negate) char_set.negate(); char_set.add_class(m); if(0 == this->append_set(char_set)) @@ -869,141 +869,141 @@ escape_type_class_jump: ++m_position; } i = hash_value_from_capture_name(base, m_position); pc = m_position; } if(negative) i = 1 + m_mark_count - i; if(((i > 0) && (this->m_backrefs & (1u << (i-1)))) || ((i > 10000) && (this->m_pdata->get_id(i) > 0) && (this->m_backrefs & (1u << (this->m_pdata->get_id(i)-1))))) { m_position = pc; re_brace* pb = static_cast<re_brace*>(this->append_state(syntax_element_backref, sizeof(re_brace))); pb->index = i; pb->icase = this->flags() & regbase::icase; } else { fail(regex_constants::error_backref, m_position - m_base); return false; } m_position = pc; if(have_brace) { if((m_position == m_end) || (this->m_traits.syntax_type(*m_position) != syn_end)) { fail(regex_constants::error_escape, m_position - m_base, incomplete_message); return false; } ++m_position; } return true; } goto escape_type_class_jump; case regex_constants::escape_type_control_v: if(0 == (this->flags() & (regbase::main_option_type | regbase::no_perl_ex))) goto escape_type_class_jump; - // fallthrough: + BOOST_FALLTHROUGH; default: this->append_literal(unescape_character()); break; } return true; } template <class charT, class traits> bool basic_regex_parser<charT, traits>::parse_match_any() { // // we have a '.' that can match any character: // ++m_position; static_cast<re_dot*>( this->append_state(syntax_element_wild, sizeof(re_dot)) )->mask = static_cast<unsigned char>(this->flags() & regbase::no_mod_s ? re_detail::force_not_newline : this->flags() & regbase::mod_s ? re_detail::force_newline : re_detail::dont_care); return true; } template <class charT, class traits> bool basic_regex_parser<charT, traits>::parse_repeat(std::size_t low, std::size_t high) { bool greedy = true; bool pocessive = false; std::size_t insert_point; // // when we get to here we may have a non-greedy ? mark still to come: // if((m_position != m_end) && ( (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))) ) ) { // OK we have a perl or emacs regex, check for a '?': if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_question) { greedy = false; ++m_position; } // for perl regexes only check for pocessive ++ repeats. if((m_position != m_end) && (0 == (this->flags() & regbase::main_option_type)) && (this->m_traits.syntax_type(*m_position) == regex_constants::syntax_plus)) { pocessive = true; ++m_position; } } if(0 == this->m_last_state) { fail(regex_constants::error_badrepeat, ::boost::re_detail::distance(m_base, m_position), "Nothing to repeat."); return false; } if(this->m_last_state->type == syntax_element_endmark) { // insert a repeat before the '(' matching the last ')': insert_point = this->m_paren_start; } else if((this->m_last_state->type == syntax_element_literal) && (static_cast<re_literal*>(this->m_last_state)->length > 1)) { // the last state was a literal with more than one character, split it in two: re_literal* lit = static_cast<re_literal*>(this->m_last_state); charT c = (static_cast<charT*>(static_cast<void*>(lit+1)))[lit->length - 1]; - --(lit->length); + lit->length -= 1; // now append new state: lit = static_cast<re_literal*>(this->append_state(syntax_element_literal, sizeof(re_literal) + sizeof(charT))); lit->length = 1; (static_cast<charT*>(static_cast<void*>(lit+1)))[0] = c; insert_point = this->getoffset(this->m_last_state); } else { // repeat the last state whatever it was, need to add some error checking here: switch(this->m_last_state->type) { case syntax_element_start_line: case syntax_element_end_line: case syntax_element_word_boundary: case syntax_element_within_word: case syntax_element_word_start: case syntax_element_word_end: case syntax_element_buffer_start: case syntax_element_buffer_end: case syntax_element_alt: case syntax_element_soft_buffer_end: case syntax_element_restart_continue: case syntax_element_jump: case syntax_element_startmark: case syntax_element_backstep: // can't legally repeat any of the above: fail(regex_constants::error_badrepeat, m_position - m_base); return false; default: // do nothing... break; } insert_point = this->getoffset(this->m_last_state); } // @@ -1038,146 +1038,182 @@ bool basic_regex_parser<charT, traits>::parse_repeat(std::size_t low, std::size_ switch(this->m_traits.syntax_type(*m_position)) { case regex_constants::syntax_star: case regex_constants::syntax_plus: case regex_constants::syntax_question: case regex_constants::syntax_open_brace: fail(regex_constants::error_badrepeat, m_position - m_base); return false; } } re_brace* pb = static_cast<re_brace*>(this->insert_state(insert_point, syntax_element_startmark, sizeof(re_brace))); pb->index = -3; pb->icase = this->flags() & regbase::icase; jmp = static_cast<re_jump*>(this->insert_state(insert_point + sizeof(re_brace), syntax_element_jump, sizeof(re_jump))); this->m_pdata->m_data.align(); jmp->alt.i = this->m_pdata->m_data.size() - this->getoffset(jmp); pb = static_cast<re_brace*>(this->append_state(syntax_element_endmark, sizeof(re_brace))); pb->index = -3; pb->icase = this->flags() & regbase::icase; } return true; } template <class charT, class traits> bool basic_regex_parser<charT, traits>::parse_repeat_range(bool isbasic) { static const char* incomplete_message = "Missing } in quantified repetition."; // // parse a repeat-range: // std::size_t min, max; int v; // skip whitespace: while((m_position != m_end) && this->m_traits.isctype(*m_position, this->m_mask_space)) ++m_position; - // fail if at end: if(this->m_position == this->m_end) { - fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message); - return false; + if(this->flags() & (regbase::main_option_type | regbase::no_perl_ex)) + { + fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message); + return false; + } + // Treat the opening '{' as a literal character, rewind to start of error: + --m_position; + while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_brace) --m_position; + return parse_literal(); } // get min: v = this->m_traits.toi(m_position, m_end, 10); // skip whitespace: - while((m_position != m_end) && this->m_traits.isctype(*m_position, this->m_mask_space)) - ++m_position; if(v < 0) { - fail(regex_constants::error_badbrace, this->m_position - this->m_base); - return false; + if(this->flags() & (regbase::main_option_type | regbase::no_perl_ex)) + { + fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message); + return false; + } + // Treat the opening '{' as a literal character, rewind to start of error: + --m_position; + while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_brace) --m_position; + return parse_literal(); } - else if(this->m_position == this->m_end) + while((m_position != m_end) && this->m_traits.isctype(*m_position, this->m_mask_space)) + ++m_position; + if(this->m_position == this->m_end) { - fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message); - return false; + if(this->flags() & (regbase::main_option_type | regbase::no_perl_ex)) + { + fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message); + return false; + } + // Treat the opening '{' as a literal character, rewind to start of error: + --m_position; + while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_brace) --m_position; + return parse_literal(); } min = v; // see if we have a comma: if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_comma) { // move on and error check: ++m_position; // skip whitespace: while((m_position != m_end) && this->m_traits.isctype(*m_position, this->m_mask_space)) ++m_position; if(this->m_position == this->m_end) { - fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message); - return false; + if(this->flags() & (regbase::main_option_type | regbase::no_perl_ex)) + { + fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message); + return false; + } + // Treat the opening '{' as a literal character, rewind to start of error: + --m_position; + while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_brace) --m_position; + return parse_literal(); } // 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 { // no comma, max = min: max = min; } // skip whitespace: while((m_position != m_end) && this->m_traits.isctype(*m_position, this->m_mask_space)) ++m_position; // OK now check trailing }: if(this->m_position == this->m_end) { - fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message); - return false; + if(this->flags() & (regbase::main_option_type | regbase::no_perl_ex)) + { + fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message); + return false; + } + // Treat the opening '{' as a literal character, rewind to start of error: + --m_position; + while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_brace) --m_position; + return parse_literal(); } if(isbasic) { if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_escape) { ++m_position; if(this->m_position == this->m_end) { fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message); return false; } } else { fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message); return false; } } if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_close_brace) ++m_position; else { - fail(regex_constants::error_brace, this->m_position - this->m_base, incomplete_message); - return false; + // Treat the opening '{' as a literal character, rewind to start of error: + --m_position; + while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_brace) --m_position; + return parse_literal(); } // // finally go and add the repeat, unless error: // if(min > max) { // Backtrack to error location: m_position -= 2; while(this->m_traits.isctype(*m_position, this->m_word_mask)) --m_position; ++m_position; fail(regex_constants::error_badbrace, m_position - m_base); return false; } return parse_repeat(min, max); } template <class charT, class traits> bool basic_regex_parser<charT, traits>::parse_alt() { // // error check: if there have been no previous states, // or if the last state was a '(' then error: // if( ((this->m_last_state == 0) || (this->m_last_state->type == syntax_element_startmark)) && !( ((this->flags() & regbase::main_option_type) == regbase::perl_syntax_group) && ((this->flags() & regbase::no_empty_expressions) == 0) ) ) { fail(regex_constants::error_empty, this->m_position - this->m_base, "A regular expression can start with the alternation operator |."); return false; @@ -1927,71 +1963,71 @@ bool basic_regex_parser<charT, traits>::parse_perl_extension() while((m_position != m_end) && (this->m_traits.syntax_type(*m_position++) != regex_constants::syntax_close_mark)) {} return true; } // // backup some state, and prepare the way: // int markid = 0; std::ptrdiff_t jump_offset = 0; re_brace* pb = static_cast<re_brace*>(this->append_state(syntax_element_startmark, sizeof(re_brace))); pb->icase = this->flags() & regbase::icase; std::ptrdiff_t last_paren_start = this->getoffset(pb); // back up insertion point for alternations, and set new point: std::ptrdiff_t last_alt_point = m_alt_insert_point; this->m_pdata->m_data.align(); m_alt_insert_point = this->m_pdata->m_data.size(); std::ptrdiff_t expected_alt_point = m_alt_insert_point; bool restore_flags = true; regex_constants::syntax_option_type old_flags = this->flags(); bool old_case_change = m_has_case_change; m_has_case_change = false; charT name_delim; int mark_reset = m_mark_reset; int max_mark = m_max_mark; m_mark_reset = -1; m_max_mark = m_mark_count; int v; // // select the actual extension used: // switch(this->m_traits.syntax_type(*m_position)) { case regex_constants::syntax_or: m_mark_reset = m_mark_count; - // fall through: + BOOST_FALLTHROUGH; case regex_constants::syntax_colon: // // a non-capturing mark: // pb->index = markid = 0; ++m_position; break; case regex_constants::syntax_digit: { // // a recursive subexpression: // v = this->m_traits.toi(m_position, m_end, 10); if((v < 0) || (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark)) { // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; fail(regex_constants::error_perl_extension, m_position - m_base, "The recursive sub-expression refers to an invalid marking group, or is unterminated."); return false; } insert_recursion: pb->index = markid = 0; re_recurse* pr = static_cast<re_recurse*>(this->append_state(syntax_element_recurse, sizeof(re_recurse))); pr->alt.i = v; pr->state_id = 0; static_cast<re_case*>( this->append_state(syntax_element_toggle_case, sizeof(re_case)) )->icase = this->flags() & regbase::icase; break; } case regex_constants::syntax_plus: // // A forward-relative recursive subexpression: // diff --git a/3rdParty/Boost/src/boost/regex/v4/cpp_regex_traits.hpp b/3rdParty/Boost/src/boost/regex/v4/cpp_regex_traits.hpp index bcae455..106ffcb 100644 --- a/3rdParty/Boost/src/boost/regex/v4/cpp_regex_traits.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/cpp_regex_traits.hpp @@ -1,57 +1,59 @@ /* * * Copyright (c) 2004 John Maddock * Copyright 2011 Garmin Ltd. or its subsidiaries * * Use, modification and distribution are subject to the * Boost Software License, Version 1.0. (See accompanying file * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) * */ /* * LOCATION: see http://www.boost.org for most recent version. * FILE cpp_regex_traits.hpp * VERSION see <boost/version.hpp> * DESCRIPTION: Declares regular expression traits class cpp_regex_traits. */ #ifndef BOOST_CPP_REGEX_TRAITS_HPP_INCLUDED #define BOOST_CPP_REGEX_TRAITS_HPP_INCLUDED #include <boost/config.hpp> +#include <boost/integer.hpp> +#include <boost/type_traits/make_unsigned.hpp> #ifndef BOOST_NO_STD_LOCALE #ifndef BOOST_RE_PAT_EXCEPT_HPP #include <boost/regex/pattern_except.hpp> #endif #ifndef BOOST_REGEX_TRAITS_DEFAULTS_HPP_INCLUDED #include <boost/regex/v4/regex_traits_defaults.hpp> #endif #ifdef BOOST_HAS_THREADS #include <boost/regex/pending/static_mutex.hpp> #endif #ifndef BOOST_REGEX_PRIMARY_TRANSFORM #include <boost/regex/v4/primary_transform.hpp> #endif #ifndef BOOST_REGEX_OBJECT_CACHE_HPP #include <boost/regex/pending/object_cache.hpp> #endif #include <istream> #include <ios> #include <climits> #ifdef BOOST_MSVC #pragma warning(push) #pragma warning(disable: 4103) #endif #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX #endif #ifdef BOOST_MSVC #pragma warning(pop) #endif #ifdef BOOST_MSVC @@ -75,76 +77,78 @@ namespace re_detail{ // template <class charT, class traits = ::std::char_traits<charT> > class parser_buf : public ::std::basic_streambuf<charT, traits> { typedef ::std::basic_streambuf<charT, traits> base_type; typedef typename base_type::int_type int_type; typedef typename base_type::char_type char_type; typedef typename base_type::pos_type pos_type; typedef ::std::streamsize streamsize; typedef typename base_type::off_type off_type; public: parser_buf() : base_type() { setbuf(0, 0); } const charT* getnext() { return this->gptr(); } protected: std::basic_streambuf<charT, traits>* setbuf(char_type* s, streamsize n); typename parser_buf<charT, traits>::pos_type seekpos(pos_type sp, ::std::ios_base::openmode which); typename parser_buf<charT, traits>::pos_type seekoff(off_type off, ::std::ios_base::seekdir way, ::std::ios_base::openmode which); private: parser_buf& operator=(const parser_buf&); parser_buf(const parser_buf&); }; template<class charT, class traits> std::basic_streambuf<charT, traits>* parser_buf<charT, traits>::setbuf(char_type* s, streamsize n) { this->setg(s, s, s + n); return this; } template<class charT, class traits> typename parser_buf<charT, traits>::pos_type parser_buf<charT, traits>::seekoff(off_type off, ::std::ios_base::seekdir way, ::std::ios_base::openmode which) { + typedef typename boost::int_t<sizeof(way) * CHAR_BIT>::least cast_type; + if(which & ::std::ios_base::out) return pos_type(off_type(-1)); std::ptrdiff_t size = this->egptr() - this->eback(); std::ptrdiff_t pos = this->gptr() - this->eback(); charT* g = this->eback(); - switch(way) + switch(static_cast<cast_type>(way)) { case ::std::ios_base::beg: if((off < 0) || (off > size)) return pos_type(off_type(-1)); else this->setg(g, g + off, g + size); break; case ::std::ios_base::end: if((off < 0) || (off > size)) return pos_type(off_type(-1)); else this->setg(g, g + size - off, g + size); break; case ::std::ios_base::cur: { std::ptrdiff_t newpos = static_cast<std::ptrdiff_t>(pos + off); if((newpos < 0) || (newpos > size)) return pos_type(off_type(-1)); else this->setg(g, g + newpos, g + size); break; } default: ; } #ifdef BOOST_MSVC #pragma warning(push) #pragma warning(disable:4244) #endif return static_cast<pos_type>(this->gptr() - this->eback()); #ifdef BOOST_MSVC #pragma warning(pop) #endif } template<class charT, class traits> @@ -472,72 +476,82 @@ private: public: bool isctype(charT c, char_class_type m)const; #endif }; #ifndef BOOST_REGEX_BUGGY_CTYPE_FACET #if !defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION) template <class charT> typename cpp_regex_traits_implementation<charT>::char_class_type const cpp_regex_traits_implementation<charT>::mask_blank; template <class charT> typename cpp_regex_traits_implementation<charT>::char_class_type const cpp_regex_traits_implementation<charT>::mask_word; template <class charT> typename cpp_regex_traits_implementation<charT>::char_class_type const cpp_regex_traits_implementation<charT>::mask_unicode; template <class charT> typename cpp_regex_traits_implementation<charT>::char_class_type const cpp_regex_traits_implementation<charT>::mask_vertical; template <class charT> typename cpp_regex_traits_implementation<charT>::char_class_type const cpp_regex_traits_implementation<charT>::mask_horizontal; #endif #endif template <class charT> typename cpp_regex_traits_implementation<charT>::string_type cpp_regex_traits_implementation<charT>::transform_primary(const charT* p1, const charT* p2) const { // // PRECONDITIONS: // // A bug in gcc 3.2 (and maybe other versions as well) treats // p1 as a null terminated string, for efficiency reasons // we work around this elsewhere, but just assert here that // we adhere to gcc's (buggy) preconditions... // BOOST_ASSERT(*p2 == 0); - string_type result; +#if defined(_CPPLIB_VER) + // + // A bug in VC11 and 12 causes the program to hang if we pass a null-string + // to std::collate::transform, but only for certain locales :-( + // Probably effects Intel and Clang or any compiler using the VC std library (Dinkumware). + // + if(*p1 == 0) + { + return string_type(1, charT(0)); + } +#endif // // swallowing all exceptions here is a bad idea // however at least one std lib will always throw // std::bad_alloc for certain arguments... // #ifndef BOOST_NO_EXCEPTIONS try{ #endif // // What we do here depends upon the format of the sort key returned by // sort key returned by this->transform: // switch(m_collate_type) { case sort_C: case sort_unknown: // the best we can do is translate to lower case, then get a regular sort key: { result.assign(p1, p2); this->m_pctype->tolower(&*result.begin(), &*result.begin() + result.size()); result = this->m_pcollate->transform(&*result.begin(), &*result.begin() + result.size()); break; } case sort_fixed: { // get a regular sort key, and then truncate it: result.assign(this->m_pcollate->transform(p1, p2)); result.erase(this->m_collate_delim); break; } case sort_delim: // get a regular sort key, and then truncate everything after the delim: result.assign(this->m_pcollate->transform(p1, p2)); std::size_t i; for(i = 0; i < result.size(); ++i) @@ -547,124 +561,155 @@ typename cpp_regex_traits_implementation<charT>::string_type } result.erase(i); break; } #ifndef BOOST_NO_EXCEPTIONS }catch(...){} #endif while(result.size() && (charT(0) == *result.rbegin())) result.erase(result.size() - 1); if(result.empty()) { // character is ignorable at the primary level: result = string_type(1, charT(0)); } return result; } template <class charT> typename cpp_regex_traits_implementation<charT>::string_type cpp_regex_traits_implementation<charT>::transform(const charT* p1, const charT* p2) const { // // PRECONDITIONS: // // A bug in gcc 3.2 (and maybe other versions as well) treats // p1 as a null terminated string, for efficiency reasons // we work around this elsewhere, but just assert here that // we adhere to gcc's (buggy) preconditions... // BOOST_ASSERT(*p2 == 0); // // swallowing all exceptions here is a bad idea // however at least one std lib will always throw // std::bad_alloc for certain arguments... // - string_type result; + string_type result, result2; +#if defined(_CPPLIB_VER) + // + // A bug in VC11 and 12 causes the program to hang if we pass a null-string + // to std::collate::transform, but only for certain locales :-( + // Probably effects Intel and Clang or any compiler using the VC std library (Dinkumware). + // + if(*p1 == 0) + { + return result; + } +#endif #ifndef BOOST_NO_EXCEPTIONS try{ #endif result = this->m_pcollate->transform(p1, p2); // // Borland's STLPort version returns a NULL-terminated // string that has garbage at the end - each call to // std::collate<wchar_t>::transform returns a different string! // So as a workaround, we'll truncate the string at the first NULL // which _seems_ to work.... #if BOOST_WORKAROUND(__BORLANDC__, < 0x580) result.erase(result.find(charT(0))); #else // // some implementations (Dinkumware) append unnecessary trailing \0's: while(result.size() && (charT(0) == *result.rbegin())) result.erase(result.size() - 1); #endif - BOOST_ASSERT(std::find(result.begin(), result.end(), charT(0)) == result.end()); + // + // We may have NULL's used as separators between sections of the collate string, + // an example would be Boost.Locale. We have no way to detect this case via + // #defines since this can be used with any compiler/platform combination. + // Unfortunately our state machine (which was devised when all implementations + // used underlying C language API's) can't cope with that case. One workaround + // is to replace each character with 2, fortunately this code isn't used that + // much as this is now slower than before :-( + // + typedef typename make_unsigned<charT>::type uchar_type; + result2.reserve(result.size() * 2 + 2); + for(unsigned i = 0; i < result.size(); ++i) + { + if(static_cast<uchar_type>(result[i]) == (std::numeric_limits<uchar_type>::max)()) + { + result2.append(1, charT((std::numeric_limits<uchar_type>::max)())).append(1, charT('b')); + } + else + { + result2.append(1, static_cast<charT>(1 + static_cast<uchar_type>(result[i]))).append(1, charT('b') - 1); + } + } + BOOST_ASSERT(std::find(result2.begin(), result2.end(), charT(0)) == result2.end()); #ifndef BOOST_NO_EXCEPTIONS } catch(...) { } #endif - return result; + return result2; } template <class charT> typename cpp_regex_traits_implementation<charT>::string_type cpp_regex_traits_implementation<charT>::lookup_collatename(const charT* p1, const charT* p2) const { typedef typename std::map<string_type, string_type>::const_iterator iter_type; if(m_custom_collate_names.size()) { iter_type pos = m_custom_collate_names.find(string_type(p1, p2)); if(pos != m_custom_collate_names.end()) return pos->second; } #if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)\ - && !BOOST_WORKAROUND(BOOST_MSVC, < 1300)\ && !BOOST_WORKAROUND(__BORLANDC__, <= 0x0551) std::string name(p1, p2); #else std::string name; const charT* p0 = p1; while(p0 != p2) name.append(1, char(*p0++)); #endif name = lookup_default_collate_name(name); #if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)\ - && !BOOST_WORKAROUND(BOOST_MSVC, < 1300)\ && !BOOST_WORKAROUND(__BORLANDC__, <= 0x0551) if(name.size()) return string_type(name.begin(), name.end()); #else if(name.size()) { string_type result; typedef std::string::const_iterator iter; iter b = name.begin(); iter e = name.end(); while(b != e) result.append(1, charT(*b++)); return result; } #endif if(p2 - p1 == 1) return string_type(1, *p1); return string_type(); } template <class charT> void cpp_regex_traits_implementation<charT>::init() { #ifndef BOOST_NO_STD_MESSAGES #ifndef __IBMCPP__ typename std::messages<charT>::catalog cat = static_cast<std::messages<char>::catalog>(-1); #else typename std::messages<charT>::catalog cat = reinterpret_cast<std::messages<char>::catalog>(-1); #endif std::string cat_name(cpp_regex_traits<charT>::get_catalog_name()); if(cat_name.size() && (this->m_pmessages != 0)) { cat = this->m_pmessages->open( cat_name, this->m_locale); @@ -822,71 +867,71 @@ typename cpp_regex_traits_implementation<charT>::char_class_type { typedef typename std::map<std::basic_string<charT>, char_class_type>::const_iterator map_iter; map_iter pos = m_custom_class_names.find(string_type(p1, p2)); if(pos != m_custom_class_names.end()) return pos->second; } std::size_t state_id = 1 + re_detail::get_default_class_id(p1, p2); BOOST_ASSERT(state_id < sizeof(masks) / sizeof(masks[0])); return masks[state_id]; } #ifdef BOOST_REGEX_BUGGY_CTYPE_FACET template <class charT> bool cpp_regex_traits_implementation<charT>::isctype(const charT c, char_class_type mask) const { return ((mask & ::boost::re_detail::char_class_space) && (this->m_pctype->is(std::ctype<charT>::space, c))) || ((mask & ::boost::re_detail::char_class_print) && (this->m_pctype->is(std::ctype<charT>::print, c))) || ((mask & ::boost::re_detail::char_class_cntrl) && (this->m_pctype->is(std::ctype<charT>::cntrl, c))) || ((mask & ::boost::re_detail::char_class_upper) && (this->m_pctype->is(std::ctype<charT>::upper, c))) || ((mask & ::boost::re_detail::char_class_lower) && (this->m_pctype->is(std::ctype<charT>::lower, c))) || ((mask & ::boost::re_detail::char_class_alpha) && (this->m_pctype->is(std::ctype<charT>::alpha, c))) || ((mask & ::boost::re_detail::char_class_digit) && (this->m_pctype->is(std::ctype<charT>::digit, c))) || ((mask & ::boost::re_detail::char_class_punct) && (this->m_pctype->is(std::ctype<charT>::punct, c))) || ((mask & ::boost::re_detail::char_class_xdigit) && (this->m_pctype->is(std::ctype<charT>::xdigit, c))) || ((mask & ::boost::re_detail::char_class_blank) && (this->m_pctype->is(std::ctype<charT>::space, c)) && !::boost::re_detail::is_separator(c)) || ((mask & ::boost::re_detail::char_class_word) && (c == '_')) || ((mask & ::boost::re_detail::char_class_unicode) && ::boost::re_detail::is_extended(c)) || ((mask & ::boost::re_detail::char_class_vertical_space) && (is_separator(c) || (c == '\v'))) || ((mask & ::boost::re_detail::char_class_horizontal_space) && this->m_pctype->is(std::ctype<charT>::space, c) && !(is_separator(c) || (c == '\v'))); } #endif template <class charT> -inline boost::shared_ptr<const cpp_regex_traits_implementation<charT> > create_cpp_regex_traits(const std::locale& l BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(charT)) +inline boost::shared_ptr<const cpp_regex_traits_implementation<charT> > create_cpp_regex_traits(const std::locale& l) { cpp_regex_traits_base<charT> key(l); return ::boost::object_cache<cpp_regex_traits_base<charT>, cpp_regex_traits_implementation<charT> >::get(key, 5); } } // re_detail template <class charT> class cpp_regex_traits { private: typedef std::ctype<charT> ctype_type; public: typedef charT char_type; typedef std::size_t size_type; typedef std::basic_string<char_type> string_type; typedef std::locale locale_type; typedef boost::uint_least32_t char_class_type; struct boost_extensions_tag{}; cpp_regex_traits() : m_pimpl(re_detail::create_cpp_regex_traits<charT>(std::locale())) { } static size_type length(const char_type* p) { return std::char_traits<charT>::length(p); } regex_constants::syntax_type syntax_type(charT c)const { return m_pimpl->syntax_type(c); } regex_constants::escape_syntax_type escape_syntax_type(charT c) const { return m_pimpl->escape_syntax_type(c); diff --git a/3rdParty/Boost/src/boost/regex/v4/instances.hpp b/3rdParty/Boost/src/boost/regex/v4/instances.hpp index 2839c0b..6fa811d 100644 --- a/3rdParty/Boost/src/boost/regex/v4/instances.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/instances.hpp @@ -60,100 +60,96 @@ template class BOOST_REGEX_DECL ::boost::re_detail::perl_matcher<BOOST_REGEX_CHA # ifndef BOOST_REGEX_INSTANTIATE # pragma option pop # endif #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_SUFFIX #endif #elif defined(BOOST_MSVC) || defined(__ICL) # ifndef BOOST_REGEX_INSTANTIATE # ifdef __GNUC__ # define template __extension__ extern template # else # if BOOST_MSVC > 1310 # define BOOST_REGEX_TEMPLATE_DECL # endif # define template extern template # endif # endif #ifndef BOOST_REGEX_TEMPLATE_DECL # define BOOST_REGEX_TEMPLATE_DECL BOOST_REGEX_DECL #endif # ifdef BOOST_MSVC # pragma warning(push) # pragma warning(disable : 4251 4231) # if BOOST_MSVC < 1600 # pragma warning(disable : 4660) # endif # endif template class BOOST_REGEX_TEMPLATE_DECL basic_regex< BOOST_REGEX_CHAR_T BOOST_REGEX_TRAITS_T >; -#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) template class BOOST_REGEX_TEMPLATE_DECL match_results< const BOOST_REGEX_CHAR_T* >; -#endif #ifndef BOOST_NO_STD_ALLOCATOR template class BOOST_REGEX_TEMPLATE_DECL ::boost::re_detail::perl_matcher<BOOST_REGEX_CHAR_T const *, match_results< const BOOST_REGEX_CHAR_T* >::allocator_type BOOST_REGEX_TRAITS_T >; #endif #if !(defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_DINKUMWARE_STDLIB <= 1))\ && !(defined(BOOST_INTEL_CXX_VERSION) && (BOOST_INTEL_CXX_VERSION <= 800))\ && !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION))\ && !defined(BOOST_REGEX_ICU_INSTANCES) -#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) template class BOOST_REGEX_TEMPLATE_DECL match_results< std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator >; -#endif #ifndef BOOST_NO_STD_ALLOCATOR template class BOOST_REGEX_TEMPLATE_DECL ::boost::re_detail::perl_matcher< std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator, match_results< std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator >::allocator_type, boost::regex_traits<BOOST_REGEX_CHAR_T > >; #endif #endif # ifdef BOOST_MSVC # pragma warning(pop) # endif # ifdef template # undef template # endif #undef BOOST_REGEX_TEMPLATE_DECL -#elif (defined(__GNUC__) && (__GNUC__ >= 3)) || !defined(BOOST_NO_EXTERN_TEMPLATE) +#elif (defined(__GNUC__) && (__GNUC__ >= 3)) || !defined(BOOST_NO_CXX11_EXTERN_TEMPLATE) # ifndef BOOST_REGEX_INSTANTIATE # ifdef __GNUC__ # define template __extension__ extern template # else # define template extern template # endif # endif #if !defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_REGEX_ICU_INSTANCES) namespace re_detail{ template BOOST_REGEX_DECL std::locale cpp_regex_traits_base<BOOST_REGEX_CHAR_T>::imbue(const std::locale& l); template BOOST_REGEX_DECL cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::string_type cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::transform_primary(const BOOST_REGEX_CHAR_T* p1, const BOOST_REGEX_CHAR_T* p2) const; template BOOST_REGEX_DECL cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::string_type cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::transform(const BOOST_REGEX_CHAR_T* p1, const BOOST_REGEX_CHAR_T* p2) const; template BOOST_REGEX_DECL cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::string_type cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::lookup_collatename(const BOOST_REGEX_CHAR_T* p1, const BOOST_REGEX_CHAR_T* p2) const; template BOOST_REGEX_DECL void cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::init(); template BOOST_REGEX_DECL cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::char_class_type cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::lookup_classname_imp(const BOOST_REGEX_CHAR_T* p1, const BOOST_REGEX_CHAR_T* p2) const; #ifdef BOOST_REGEX_BUGGY_CTYPE_FACET template BOOST_REGEX_DECL bool cpp_regex_traits_implementation<BOOST_REGEX_CHAR_T>::isctype(const BOOST_REGEX_CHAR_T c, char_class_type mask) const; #endif } // namespace template BOOST_REGEX_DECL int cpp_regex_traits<BOOST_REGEX_CHAR_T>::toi(const BOOST_REGEX_CHAR_T*& first, const BOOST_REGEX_CHAR_T* last, int radix)const; diff --git a/3rdParty/Boost/src/boost/regex/v4/iterator_traits.hpp b/3rdParty/Boost/src/boost/regex/v4/iterator_traits.hpp index f7afacb..53e1376 100644 --- a/3rdParty/Boost/src/boost/regex/v4/iterator_traits.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/iterator_traits.hpp @@ -1,71 +1,71 @@ /* * * Copyright (c) 1998-2002 * John Maddock * * Use, modification and distribution are subject to the * Boost Software License, Version 1.0. (See accompanying file * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) * */ /* * LOCATION: see http://www.boost.org for most recent version. * FILE iterator_traits.cpp * VERSION see <boost/version.hpp> * DESCRIPTION: Declares iterator traits workarounds. */ #ifndef BOOST_REGEX_V4_ITERATOR_TRAITS_HPP #define BOOST_REGEX_V4_ITERATOR_TRAITS_HPP #ifdef BOOST_MSVC #pragma warning(push) #pragma warning(disable: 4103) #endif #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX #endif #ifdef BOOST_MSVC #pragma warning(pop) #endif namespace boost{ namespace re_detail{ -#if defined(BOOST_NO_STD_ITERATOR_TRAITS) || defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +#if defined(BOOST_NO_STD_ITERATOR_TRAITS) template <class T> struct regex_iterator_traits { typedef typename T::iterator_category iterator_category; typedef typename T::value_type value_type; #if !defined(BOOST_NO_STD_ITERATOR) typedef typename T::difference_type difference_type; typedef typename T::pointer pointer; typedef typename T::reference reference; #else typedef std::ptrdiff_t difference_type; typedef value_type* pointer; typedef value_type& reference; #endif }; template <class T> struct pointer_iterator_traits { typedef std::ptrdiff_t difference_type; typedef T value_type; typedef T* pointer; typedef T& reference; typedef std::random_access_iterator_tag iterator_category; }; template <class T> struct const_pointer_iterator_traits { typedef std::ptrdiff_t difference_type; typedef T value_type; typedef const T* pointer; typedef const T& reference; typedef std::random_access_iterator_tag iterator_category; }; diff --git a/3rdParty/Boost/src/boost/regex/v4/match_flags.hpp b/3rdParty/Boost/src/boost/regex/v4/match_flags.hpp index 26bde9a..e21de6c 100644 --- a/3rdParty/Boost/src/boost/regex/v4/match_flags.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/match_flags.hpp @@ -39,71 +39,71 @@ typedef enum _match_flags match_not_eow = match_not_bow << 1, /* last is not end of word */ match_not_dot_newline = match_not_eow << 1, /* \n is not matched by '.' */ match_not_dot_null = match_not_dot_newline << 1, /* '\0' is not matched by '.' */ match_prev_avail = match_not_dot_null << 1, /* *--first is a valid expression */ match_init = match_prev_avail << 1, /* internal use */ match_any = match_init << 1, /* don't care what we match */ match_not_null = match_any << 1, /* string can't be null */ match_continuous = match_not_null << 1, /* each grep match must continue from */ /* uninterupted from the previous one */ match_partial = match_continuous << 1, /* find partial matches */ match_stop = match_partial << 1, /* stop after first match (grep) V3 only */ match_not_initial_null = match_stop, /* don't match initial null, V4 only */ match_all = match_stop << 1, /* must find the whole of input even if match_any is set */ match_perl = match_all << 1, /* Use perl matching rules */ match_posix = match_perl << 1, /* Use POSIX matching rules */ match_nosubs = match_posix << 1, /* don't trap marked subs */ match_extra = match_nosubs << 1, /* include full capture information for repeated captures */ match_single_line = match_extra << 1, /* treat text as single line and ignor any \n's when matching ^ and $. */ match_unused1 = match_single_line << 1, /* unused */ match_unused2 = match_unused1 << 1, /* unused */ match_unused3 = match_unused2 << 1, /* unused */ match_max = match_unused3, format_perl = 0, /* perl style replacement */ format_default = 0, /* ditto. */ format_sed = match_max << 1, /* sed style replacement. */ format_all = format_sed << 1, /* enable all extentions to sytax. */ format_no_copy = format_all << 1, /* don't copy non-matching segments. */ format_first_only = format_no_copy << 1, /* Only replace first occurance. */ format_is_if = format_first_only << 1, /* internal use only. */ format_literal = format_is_if << 1 /* treat string as a literal */ } match_flags; -#if (defined(_MSC_VER) && (_MSC_VER < 1300)) || defined(__BORLANDC__) +#if defined(__BORLANDC__) typedef unsigned long match_flag_type; #else typedef match_flags match_flag_type; #ifdef __cplusplus inline match_flags operator&(match_flags m1, match_flags m2) { return static_cast<match_flags>(static_cast<boost::int32_t>(m1) & static_cast<boost::int32_t>(m2)); } inline match_flags operator|(match_flags m1, match_flags m2) { return static_cast<match_flags>(static_cast<boost::int32_t>(m1) | static_cast<boost::int32_t>(m2)); } inline match_flags operator^(match_flags m1, match_flags m2) { return static_cast<match_flags>(static_cast<boost::int32_t>(m1) ^ static_cast<boost::int32_t>(m2)); } inline match_flags operator~(match_flags m1) { return static_cast<match_flags>(~static_cast<boost::int32_t>(m1)); } inline match_flags& operator&=(match_flags& m1, match_flags m2) { m1 = m1&m2; return m1; } inline match_flags& operator|=(match_flags& m1, match_flags m2) { m1 = m1|m2; return m1; } inline match_flags& operator^=(match_flags& m1, match_flags m2) { m1 = m1^m2; return m1; } #endif #endif #ifdef __cplusplus } /* namespace regex_constants */ /* * import names into boost for backwards compatiblity: */ using regex_constants::match_flag_type; using regex_constants::match_default; using regex_constants::match_not_bol; using regex_constants::match_not_eol; using regex_constants::match_not_bob; using regex_constants::match_not_eob; using regex_constants::match_not_bow; diff --git a/3rdParty/Boost/src/boost/regex/v4/perl_matcher.hpp b/3rdParty/Boost/src/boost/regex/v4/perl_matcher.hpp index ddaafbd..0a37a84 100644 --- a/3rdParty/Boost/src/boost/regex/v4/perl_matcher.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/perl_matcher.hpp @@ -54,95 +54,91 @@ inline bool can_start(signed char c, const unsigned char* map, unsigned char mas return map[(unsigned char)c] & mask; } inline bool can_start(unsigned char c, const unsigned char* map, unsigned char mask) { return map[c] & mask; } inline bool can_start(unsigned short c, const unsigned char* map, unsigned char mask) { return ((c >= (1 << CHAR_BIT)) ? true : map[c] & mask); } #if !defined(__hpux) && !defined(__WINSCW__)// WCHAR_MIN not usable in pp-directives. #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) { return ((c >= static_cast<wchar_t>(1u << CHAR_BIT)) ? true : map[c] & mask); } #endif #endif #if !defined(BOOST_NO_INTRINSIC_WCHAR_T) inline bool can_start(unsigned int c, const unsigned char* map, unsigned char mask) { return (((c >= static_cast<unsigned int>(1u << CHAR_BIT)) ? true : map[c] & mask)); } #endif // // Unfortunately Rogue Waves standard library appears to have a bug // in std::basic_string::compare that results in eroneous answers // in some cases (tested with Borland C++ 5.1, Rogue Wave lib version // 0x020101) the test case was: // {39135,0} < {0xff,0} // which succeeds when it should not. // #ifndef _RWSTD_VER -#if !BOOST_WORKAROUND(BOOST_MSVC, < 1310) template <class C, class T, class A> inline int string_compare(const std::basic_string<C,T,A>& s, const C* p) { if(0 == *p) { if(s.empty() || ((s.size() == 1) && (s[0] == 0))) return 0; } return s.compare(p); } -#endif #else -#if !BOOST_WORKAROUND(BOOST_MSVC, < 1310) template <class C, class T, class A> inline int string_compare(const std::basic_string<C,T,A>& s, const C* p) { if(0 == *p) { if(s.empty() || ((s.size() == 1) && (s[0] == 0))) return 0; } return s.compare(p); } -#endif inline int string_compare(const std::string& s, const char* p) { return std::strcmp(s.c_str(), p); } # ifndef BOOST_NO_WREGEX inline int string_compare(const std::wstring& s, const wchar_t* p) { return std::wcscmp(s.c_str(), p); } #endif #endif template <class Seq, class C> inline int string_compare(const Seq& s, const C* p) { std::size_t i = 0; while((i < s.size()) && (p[i] == s[i])) { ++i; } return (i == s.size()) ? -p[i] : s[i] - p[i]; } # define STR_COMP(s,p) string_compare(s,p) template<class charT> inline const charT* re_skip_past_null(const charT* p) { while (*p != static_cast<charT>(0)) ++p; return ++p; } template <class iterator, class charT, class traits_type, class char_classT> iterator BOOST_REGEX_CALL re_is_set_member(iterator next, iterator last, const re_set_long<char_classT>* set_, const regex_data<charT, traits_type>& e, bool icase) { const charT* p = reinterpret_cast<const charT*>(set_+1); iterator ptr; unsigned int i; diff --git a/3rdParty/Boost/src/boost/regex/v4/perl_matcher_common.hpp b/3rdParty/Boost/src/boost/regex/v4/perl_matcher_common.hpp index b8c4e96..480d8f1 100644 --- a/3rdParty/Boost/src/boost/regex/v4/perl_matcher_common.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/perl_matcher_common.hpp @@ -33,70 +33,72 @@ #ifdef __BORLANDC__ # pragma option push -w-8008 -w-8066 #endif #ifdef BOOST_MSVC # pragma warning(push) # pragma warning(disable: 4800) #endif namespace boost{ namespace re_detail{ template <class BidiIterator, class Allocator, class traits> void perl_matcher<BidiIterator, Allocator, traits>::construct_init(const basic_regex<char_type, traits>& e, match_flag_type f) { typedef typename regex_iterator_traits<BidiIterator>::iterator_category category; typedef typename basic_regex<char_type, traits>::flag_type expression_flag_type; if(e.empty()) { // precondition failure: e is not a valid regex. std::invalid_argument ex("Invalid regular expression object"); boost::throw_exception(ex); } pstate = 0; m_match_flags = f; estimate_max_state_count(static_cast<category*>(0)); expression_flag_type re_f = re.flags(); icase = re_f & regex_constants::icase; if(!(m_match_flags & (match_perl|match_posix))) { if((re_f & (regbase::main_option_type|regbase::no_perl_ex)) == 0) 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; } if(m_match_flags & match_posix) { m_temp_match.reset(new match_results<BidiIterator, Allocator>()); m_presult = m_temp_match.get(); } else m_presult = &m_result; #ifdef BOOST_REGEX_NON_RECURSIVE m_stack_base = 0; m_backup_state = 0; #endif // find the value to use for matching word boundaries: m_word_mask = re.get_data().m_word_mask; // find bitmask to use for matching '.': match_any_mask = static_cast<unsigned char>((f & match_not_dot_newline) ? re_detail::test_not_newline : re_detail::test_newline); } template <class BidiIterator, class Allocator, class traits> void perl_matcher<BidiIterator, Allocator, traits>::estimate_max_state_count(std::random_access_iterator_tag*) { // // How many states should we allow our machine to visit before giving up? // This is a heuristic: it takes the greater of O(N^2) and O(NS^2) // where N is the length of the string, and S is the number of states // in the machine. It's tempting to up this to O(N^2S) or even O(N^2S^2) // but these take unreasonably amounts of time to bale out in pathological // cases. // // Calculate NS^2 first: // static const std::ptrdiff_t k = 100000; std::ptrdiff_t dist = boost::re_detail::distance(base, last); @@ -166,198 +168,202 @@ inline bool perl_matcher<BidiIterator, Allocator, traits>::protected_call( ::boost::re_detail::concrete_protected_call <perl_matcher<BidiIterator, Allocator, traits> > obj(this, proc); return obj.execute(); } #endif template <class BidiIterator, class Allocator, class traits> inline bool perl_matcher<BidiIterator, Allocator, traits>::match() { #ifdef BOOST_REGEX_HAS_MS_STACK_GUARD return protected_call(&perl_matcher<BidiIterator, Allocator, traits>::match_imp); #else return match_imp(); #endif } template <class BidiIterator, class Allocator, class traits> bool perl_matcher<BidiIterator, Allocator, traits>::match_imp() { // initialise our stack if we are non-recursive: #ifdef BOOST_REGEX_NON_RECURSIVE save_state_init init(&m_stack_base, &m_backup_state); used_block_count = BOOST_REGEX_MAX_BLOCKS; #if !defined(BOOST_NO_EXCEPTIONS) try{ #endif #endif // reset our state machine: position = base; search_base = base; state_count = 0; m_match_flags |= regex_constants::match_all; - m_presult->set_size((m_match_flags & match_nosubs) ? 1 : re.mark_count(), search_base, last); + m_presult->set_size((m_match_flags & match_nosubs) ? 1 : 1 + re.mark_count(), search_base, last); m_presult->set_base(base); m_presult->set_named_subs(this->re.get_named_subs()); if(m_match_flags & match_posix) m_result = *m_presult; verify_options(re.flags(), m_match_flags); if(0 == match_prefix()) return false; return (m_result[0].second == last) && (m_result[0].first == base); #if defined(BOOST_REGEX_NON_RECURSIVE) && !defined(BOOST_NO_EXCEPTIONS) } catch(...) { // unwind all pushed states, apart from anything else this // ensures that all the states are correctly destructed // not just the memory freed. while(unwind(true)){} throw; } #endif } template <class BidiIterator, class Allocator, class traits> inline bool perl_matcher<BidiIterator, Allocator, traits>::find() { #ifdef BOOST_REGEX_HAS_MS_STACK_GUARD return protected_call(&perl_matcher<BidiIterator, Allocator, traits>::find_imp); #else return find_imp(); #endif } template <class BidiIterator, class Allocator, class traits> bool perl_matcher<BidiIterator, Allocator, traits>::find_imp() { static matcher_proc_type const s_find_vtable[7] = { &perl_matcher<BidiIterator, Allocator, traits>::find_restart_any, &perl_matcher<BidiIterator, Allocator, traits>::find_restart_word, &perl_matcher<BidiIterator, Allocator, traits>::find_restart_line, &perl_matcher<BidiIterator, Allocator, traits>::find_restart_buf, &perl_matcher<BidiIterator, Allocator, traits>::match_prefix, &perl_matcher<BidiIterator, Allocator, traits>::find_restart_lit, &perl_matcher<BidiIterator, Allocator, traits>::find_restart_lit, }; // initialise our stack if we are non-recursive: #ifdef BOOST_REGEX_NON_RECURSIVE save_state_init init(&m_stack_base, &m_backup_state); used_block_count = BOOST_REGEX_MAX_BLOCKS; #if !defined(BOOST_NO_EXCEPTIONS) try{ #endif #endif state_count = 0; if((m_match_flags & regex_constants::match_init) == 0) { // reset our state machine: search_base = position = base; pstate = re.get_first_state(); - m_presult->set_size((m_match_flags & match_nosubs) ? 1 : re.mark_count(), base, last); + m_presult->set_size((m_match_flags & match_nosubs) ? 1 : 1 + re.mark_count(), base, last); m_presult->set_base(base); m_presult->set_named_subs(this->re.get_named_subs()); m_match_flags |= regex_constants::match_init; } else { // start again: search_base = position = m_result[0].second; // If last match was null and match_not_null was not set then increment // our start position, otherwise we go into an infinite loop: if(((m_match_flags & match_not_null) == 0) && (m_result.length() == 0)) { if(position == last) return false; else ++position; } // reset $` start: - m_presult->set_size((m_match_flags & match_nosubs) ? 1 : re.mark_count(), search_base, last); + m_presult->set_size((m_match_flags & match_nosubs) ? 1 : 1 + re.mark_count(), search_base, last); //if((base != search_base) && (base == backstop)) // m_match_flags |= match_prev_avail; } if(m_match_flags & match_posix) { - m_result.set_size(re.mark_count(), base, last); + m_result.set_size(1 + re.mark_count(), base, last); m_result.set_base(base); } verify_options(re.flags(), m_match_flags); // find out what kind of expression we have: unsigned type = (m_match_flags & match_continuous) ? static_cast<unsigned int>(regbase::restart_continue) : static_cast<unsigned int>(re.get_restart_type()); // call the appropriate search routine: matcher_proc_type proc = s_find_vtable[type]; return (this->*proc)(); #if defined(BOOST_REGEX_NON_RECURSIVE) && !defined(BOOST_NO_EXCEPTIONS) } catch(...) { // unwind all pushed states, apart from anything else this // ensures that all the states are correctly destructed // not just the memory freed. while(unwind(true)){} throw; } #endif } template <class BidiIterator, class Allocator, class traits> bool perl_matcher<BidiIterator, Allocator, traits>::match_prefix() { m_has_partial_match = false; m_has_found_match = false; pstate = re.get_first_state(); m_presult->set_first(position); restart = position; match_all_states(); if(!m_has_found_match && m_has_partial_match && (m_match_flags & match_partial)) { 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)) { // // we have a match, reverse the capture information: // for(unsigned i = 0; i < m_presult->size(); ++i) { typename sub_match<BidiIterator>::capture_sequence_type & seq = ((*m_presult)[i]).get_captures(); std::reverse(seq.begin(), seq.end()); } } #endif if(!m_has_found_match) position = restart; // reset search postion return m_has_found_match; } template <class BidiIterator, class Allocator, class traits> bool perl_matcher<BidiIterator, Allocator, traits>::match_literal() { unsigned int len = static_cast<const re_literal*>(pstate)->length; const char_type* what = reinterpret_cast<const char_type*>(static_cast<const re_literal*>(pstate) + 1); // // compare string with what we stored in // our records: for(unsigned int i = 0; i < len; ++i, ++position) { if((position == last) || (traits_inst.translate(*position, icase) != what[i])) return false; } pstate = pstate->next.p; return true; } @@ -420,75 +426,71 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_end_line() } } pstate = pstate->next.p; return true; } } else if((m_match_flags & match_not_eol) == 0) { pstate = pstate->next.p; return true; } return false; } template <class BidiIterator, class Allocator, class traits> bool perl_matcher<BidiIterator, Allocator, traits>::match_wild() { if(position == last) return false; if(is_separator(*position) && ((match_any_mask & static_cast<const re_dot*>(pstate)->mask) == 0)) return false; if((*position == char_type(0)) && (m_match_flags & match_not_dot_null)) return false; pstate = pstate->next.p; ++position; return true; } template <class BidiIterator, class Allocator, class traits> bool perl_matcher<BidiIterator, Allocator, traits>::match_word_boundary() { bool b; // indcates whether next character is a word character if(position != last) { // prev and this character must be opposites: - #if defined(BOOST_REGEX_USE_C_LOCALE) && defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ < 95) - b = traits::isctype(*position, m_word_mask); - #else b = traits_inst.isctype(*position, m_word_mask); - #endif } else { b = (m_match_flags & match_not_eow) ? true : false; } if((position == backstop) && ((m_match_flags & match_prev_avail) == 0)) { if(m_match_flags & match_not_bow) b ^= true; else b ^= false; } else { --position; b ^= traits_inst.isctype(*position, m_word_mask); ++position; } if(b) { pstate = pstate->next.p; return true; } return false; // no match if we get to here... } template <class BidiIterator, class Allocator, class traits> bool perl_matcher<BidiIterator, Allocator, traits>::match_within_word() { if(position == last) return false; // both prev and this character must be m_word_mask: bool prev = traits_inst.isctype(*position, m_word_mask); { bool b; diff --git a/3rdParty/Boost/src/boost/regex/v4/perl_matcher_non_recursive.hpp b/3rdParty/Boost/src/boost/regex/v4/perl_matcher_non_recursive.hpp index 0da43e3..5c1f7a9 100644 --- a/3rdParty/Boost/src/boost/regex/v4/perl_matcher_non_recursive.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/perl_matcher_non_recursive.hpp @@ -671,208 +671,226 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_dot_repeat_fast() pstate = rep->alt.p; return true; } else { // non-greedy, push state and return true if we can skip: if(count < rep->max) push_single_repeat(count, rep, position, saved_state_rep_fast_dot); pstate = rep->alt.p; return (position == last) ? (rep->can_be_null & mask_skip) : can_start(*position, rep->_map, mask_skip); } } template <class BidiIterator, class Allocator, class traits> bool perl_matcher<BidiIterator, Allocator, traits>::match_char_repeat() { #ifdef BOOST_MSVC #pragma warning(push) #pragma warning(disable:4127) #endif #ifdef __BORLANDC__ #pragma option push -w-8008 -w-8066 -w-8004 #endif const re_repeat* rep = static_cast<const re_repeat*>(pstate); BOOST_ASSERT(1 == static_cast<const re_literal*>(rep->next.p)->length); const char_type what = *reinterpret_cast<const char_type*>(static_cast<const re_literal*>(rep->next.p) + 1); std::size_t count = 0; // // start by working out how much we can skip: // bool greedy = (rep->greedy) && (!(m_match_flags & regex_constants::match_any) || m_independent); std::size_t desired = greedy ? rep->max : rep->min; if(::boost::is_random_access_iterator<BidiIterator>::value) { BidiIterator end = position; - std::advance(end, (std::min)((std::size_t)::boost::re_detail::distance(position, last), desired)); + // Move end forward by "desired", preferably without using distance or advance if we can + // as these can be slow for some iterator types. + std::size_t len = (desired == (std::numeric_limits<std::size_t>::max)()) ? 0u : ::boost::re_detail::distance(position, last); + if(desired >= len) + end = last; + else + std::advance(end, desired); BidiIterator origin(position); while((position != end) && (traits_inst.translate(*position, icase) == what)) { ++position; } count = (unsigned)::boost::re_detail::distance(origin, position); } else { while((count < desired) && (position != last) && (traits_inst.translate(*position, icase) == what)) { ++position; ++count; } } if(count < rep->min) return false; if(greedy) { if((rep->leading) && (count < rep->max)) restart = position; // push backtrack info if available: if(count - rep->min) push_single_repeat(count, rep, position, saved_state_greedy_single_repeat); // jump to next state: pstate = rep->alt.p; return true; } else { // non-greedy, push state and return true if we can skip: if(count < rep->max) push_single_repeat(count, rep, position, saved_state_rep_char); pstate = rep->alt.p; return (position == last) ? (rep->can_be_null & mask_skip) : can_start(*position, rep->_map, mask_skip); } #ifdef __BORLANDC__ #pragma option pop #endif #ifdef BOOST_MSVC #pragma warning(pop) #endif } template <class BidiIterator, class Allocator, class traits> bool perl_matcher<BidiIterator, Allocator, traits>::match_set_repeat() { #ifdef BOOST_MSVC #pragma warning(push) #pragma warning(disable:4127) #endif #ifdef __BORLANDC__ #pragma option push -w-8008 -w-8066 -w-8004 #endif const re_repeat* rep = static_cast<const re_repeat*>(pstate); const unsigned char* map = static_cast<const re_set*>(rep->next.p)->_map; std::size_t count = 0; // // start by working out how much we can skip: // bool greedy = (rep->greedy) && (!(m_match_flags & regex_constants::match_any) || m_independent); std::size_t desired = greedy ? rep->max : rep->min; if(::boost::is_random_access_iterator<BidiIterator>::value) { BidiIterator end = position; - std::advance(end, (std::min)((std::size_t)::boost::re_detail::distance(position, last), desired)); + // Move end forward by "desired", preferably without using distance or advance if we can + // as these can be slow for some iterator types. + std::size_t len = (desired == (std::numeric_limits<std::size_t>::max)()) ? 0u : ::boost::re_detail::distance(position, last); + if(desired >= len) + end = last; + else + std::advance(end, desired); BidiIterator origin(position); while((position != end) && map[static_cast<unsigned char>(traits_inst.translate(*position, icase))]) { ++position; } count = (unsigned)::boost::re_detail::distance(origin, position); } else { while((count < desired) && (position != last) && map[static_cast<unsigned char>(traits_inst.translate(*position, icase))]) { ++position; ++count; } } if(count < rep->min) return false; if(greedy) { if((rep->leading) && (count < rep->max)) restart = position; // push backtrack info if available: if(count - rep->min) push_single_repeat(count, rep, position, saved_state_greedy_single_repeat); // jump to next state: pstate = rep->alt.p; return true; } else { // non-greedy, push state and return true if we can skip: if(count < rep->max) push_single_repeat(count, rep, position, saved_state_rep_short_set); pstate = rep->alt.p; return (position == last) ? (rep->can_be_null & mask_skip) : can_start(*position, rep->_map, mask_skip); } #ifdef __BORLANDC__ #pragma option pop #endif #ifdef BOOST_MSVC #pragma warning(pop) #endif } template <class BidiIterator, class Allocator, class traits> bool perl_matcher<BidiIterator, Allocator, traits>::match_long_set_repeat() { #ifdef BOOST_MSVC #pragma warning(push) #pragma warning(disable:4127) #endif #ifdef __BORLANDC__ #pragma option push -w-8008 -w-8066 -w-8004 #endif typedef typename traits::char_class_type m_type; const re_repeat* rep = static_cast<const re_repeat*>(pstate); const re_set_long<m_type>* set = static_cast<const re_set_long<m_type>*>(pstate->next.p); std::size_t count = 0; // // start by working out how much we can skip: // bool greedy = (rep->greedy) && (!(m_match_flags & regex_constants::match_any) || m_independent); std::size_t desired = greedy ? rep->max : rep->min; if(::boost::is_random_access_iterator<BidiIterator>::value) { BidiIterator end = position; - std::advance(end, (std::min)((std::size_t)::boost::re_detail::distance(position, last), desired)); + // Move end forward by "desired", preferably without using distance or advance if we can + // as these can be slow for some iterator types. + std::size_t len = (desired == (std::numeric_limits<std::size_t>::max)()) ? 0u : ::boost::re_detail::distance(position, last); + if(desired >= len) + end = last; + else + std::advance(end, desired); BidiIterator origin(position); while((position != end) && (position != re_is_set_member(position, last, set, re.get_data(), icase))) { ++position; } count = (unsigned)::boost::re_detail::distance(origin, position); } else { while((count < desired) && (position != last) && (position != re_is_set_member(position, last, set, re.get_data(), icase))) { ++position; ++count; } } if(count < rep->min) return false; if(greedy) { if((rep->leading) && (count < rep->max)) restart = position; // push backtrack info if available: if(count - rep->min) push_single_repeat(count, rep, position, saved_state_greedy_single_repeat); // jump to next state: pstate = rep->alt.p; return true; } else { // non-greedy, push state and return true if we can skip: if(count < rep->max) push_single_repeat(count, rep, position, saved_state_rep_long_set); @@ -1236,70 +1254,73 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_slow_dot_repeat(bool pmp->last_position = position; } pstate = rep->alt.p; return false; } template <class BidiIterator, class Allocator, class traits> bool perl_matcher<BidiIterator, Allocator, traits>::unwind_fast_dot_repeat(bool r) { saved_single_repeat<BidiIterator>* pmp = static_cast<saved_single_repeat<BidiIterator>*>(m_backup_state); // if we have a match, just discard this state: if(r) { destroy_single_repeat(); return true; } const re_repeat* rep = pmp->rep; std::size_t count = pmp->count; BOOST_ASSERT(count < rep->max); position = pmp->last_position; if(position != last) { // wind forward until we can skip out of the repeat: do { ++position; ++count; ++state_count; }while((count < rep->max) && (position != last) && !can_start(*position, rep->_map, mask_skip)); } + // remember where we got to if this is a leading repeat: + if((rep->leading) && (count < rep->max)) + restart = position; if(position == last) { // can't repeat any more, remove the pushed state: destroy_single_repeat(); if((m_match_flags & match_partial) && (position == last) && (position != search_base)) m_has_partial_match = true; if(0 == (rep->can_be_null & mask_skip)) return true; } else if(count == rep->max) { // can't repeat any more, remove the pushed state: destroy_single_repeat(); if(!can_start(*position, rep->_map, mask_skip)) return true; } else { pmp->count = count; pmp->last_position = position; } pstate = rep->alt.p; return false; } template <class BidiIterator, class Allocator, class traits> bool perl_matcher<BidiIterator, Allocator, traits>::unwind_char_repeat(bool r) { saved_single_repeat<BidiIterator>* pmp = static_cast<saved_single_repeat<BidiIterator>*>(m_backup_state); // if we have a match, just discard this state: if(r) { destroy_single_repeat(); return true; diff --git a/3rdParty/Boost/src/boost/regex/v4/perl_matcher_recursive.hpp b/3rdParty/Boost/src/boost/regex/v4/perl_matcher_recursive.hpp index 07a1c20..8e0e182 100644 --- a/3rdParty/Boost/src/boost/regex/v4/perl_matcher_recursive.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/perl_matcher_recursive.hpp @@ -609,71 +609,77 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_char_repeat() } else { return false; } }while(true); #ifdef __BORLANDC__ #pragma option pop #endif #ifdef BOOST_MSVC #pragma warning(pop) #endif } template <class BidiIterator, class Allocator, class traits> bool perl_matcher<BidiIterator, Allocator, traits>::match_set_repeat() { #ifdef BOOST_MSVC #pragma warning(push) #pragma warning(disable:4127) #endif #ifdef __BORLANDC__ #pragma option push -w-8008 -w-8066 -w-8004 #endif const re_repeat* rep = static_cast<const re_repeat*>(pstate); const unsigned char* map = static_cast<const re_set*>(rep->next.p)->_map; unsigned count = 0; // // start by working out how much we can skip: // bool greedy = (rep->greedy) && (!(m_match_flags & regex_constants::match_any) || m_independent); std::size_t desired = greedy ? rep->max : rep->min; if(::boost::is_random_access_iterator<BidiIterator>::value) { BidiIterator end = position; - std::advance(end, (std::min)((std::size_t)::boost::re_detail::distance(position, last), desired)); + // Move end forward by "desired", preferably without using distance or advance if we can + // as these can be slow for some iterator types. + std::size_t len = (desired == (std::numeric_limits<std::size_t>::max)()) ? 0u : ::boost::re_detail::distance(position, last); + if(desired >= len) + end = last; + else + std::advance(end, desired); BidiIterator origin(position); while((position != end) && map[static_cast<unsigned char>(traits_inst.translate(*position, icase))]) { ++position; } count = (unsigned)::boost::re_detail::distance(origin, position); } else { while((count < desired) && (position != last) && map[static_cast<unsigned char>(traits_inst.translate(*position, icase))]) { ++position; ++count; } } if((rep->leading) && (count < rep->max) && greedy) restart = position; if(count < rep->min) return false; if(greedy) return backtrack_till_match(count - rep->min); // non-greedy, keep trying till we get a match: BidiIterator save_pos; do { while((position != last) && (count < rep->max) && !can_start(*position, rep->_map, mask_skip)) { if(map[static_cast<unsigned char>(traits_inst.translate(*position, icase))]) { ++position; ++count; } else @@ -699,71 +705,77 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_set_repeat() else { return false; } }while(true); #ifdef __BORLANDC__ #pragma option pop #endif #ifdef BOOST_MSVC #pragma warning(pop) #endif } template <class BidiIterator, class Allocator, class traits> bool perl_matcher<BidiIterator, Allocator, traits>::match_long_set_repeat() { #ifdef BOOST_MSVC #pragma warning(push) #pragma warning(disable:4127) #endif #ifdef __BORLANDC__ #pragma option push -w-8008 -w-8066 -w-8004 #endif typedef typename traits::char_class_type char_class_type; const re_repeat* rep = static_cast<const re_repeat*>(pstate); const re_set_long<char_class_type>* set = static_cast<const re_set_long<char_class_type>*>(pstate->next.p); unsigned count = 0; // // start by working out how much we can skip: // bool greedy = (rep->greedy) && (!(m_match_flags & regex_constants::match_any) || m_independent); std::size_t desired = greedy ? rep->max : rep->min; if(::boost::is_random_access_iterator<BidiIterator>::value) { BidiIterator end = position; - std::advance(end, (std::min)((std::size_t)::boost::re_detail::distance(position, last), desired)); + // Move end forward by "desired", preferably without using distance or advance if we can + // as these can be slow for some iterator types. + std::size_t len = (desired == (std::numeric_limits<std::size_t>::max)()) ? 0u : ::boost::re_detail::distance(position, last); + if(desired >= len) + end = last; + else + std::advance(end, desired); BidiIterator origin(position); while((position != end) && (position != re_is_set_member(position, last, set, re.get_data(), icase))) { ++position; } count = (unsigned)::boost::re_detail::distance(origin, position); } else { while((count < desired) && (position != last) && (position != re_is_set_member(position, last, set, re.get_data(), icase))) { ++position; ++count; } } if((rep->leading) && (count < rep->max) && greedy) restart = position; if(count < rep->min) return false; if(greedy) return backtrack_till_match(count - rep->min); // non-greedy, keep trying till we get a match: BidiIterator save_pos; do { while((position != last) && (count < rep->max) && !can_start(*position, rep->_map, mask_skip)) { if(position != re_is_set_member(position, last, set, re.get_data(), icase)) { ++position; ++count; } else diff --git a/3rdParty/Boost/src/boost/regex/v4/regex_format.hpp b/3rdParty/Boost/src/boost/regex/v4/regex_format.hpp index 3b1d19d..80c654e 100644 --- a/3rdParty/Boost/src/boost/regex/v4/regex_format.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/regex_format.hpp @@ -251,142 +251,143 @@ void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format put(*m_position); ++m_position; break; case ')': if(m_flags & boost::regex_constants::format_all) { return; } put(*m_position); ++m_position; break; case ':': if((m_flags & boost::regex_constants::format_all) && m_have_conditional) { return; } put(*m_position); ++m_position; break; case '?': if(m_flags & boost::regex_constants::format_all) { ++m_position; format_conditional(); break; } put(*m_position); ++m_position; break; case '$': if((m_flags & format_sed) == 0) { format_perl(); break; } - // fall through, not a special character: + // not a special character: + BOOST_FALLTHROUGH; default: put(*m_position); ++m_position; break; } } } template <class OutputIterator, class Results, class traits, class ForwardIter> void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format_perl() { // // On entry *m_position points to a '$' character // output the information that goes with it: // BOOST_ASSERT(*m_position == '$'); // // see if this is a trailing '$': // if(++m_position == m_end) { --m_position; put(*m_position); ++m_position; return; } // // OK find out what kind it is: // bool have_brace = false; ForwardIter save_position = m_position; switch(*m_position) { case '&': ++m_position; put(this->m_results[0]); break; case '`': ++m_position; put(this->m_results.prefix()); break; case '\'': ++m_position; put(this->m_results.suffix()); break; case '$': put(*m_position++); break; case '+': if((++m_position != m_end) && (*m_position == '{')) { ForwardIter base = ++m_position; while((m_position != m_end) && (*m_position != '}')) ++m_position; if(m_position != m_end) { // Named sub-expression: put(get_named_sub(base, m_position)); ++m_position; break; } else { m_position = --base; } } put((this->m_results)[this->m_results.size() > 1 ? static_cast<int>(this->m_results.size() - 1) : 1]); break; case '{': have_brace = true; ++m_position; - // fall through.... + BOOST_FALLTHROUGH; default: // see if we have a number: { std::ptrdiff_t len = ::boost::re_detail::distance(m_position, m_end); //len = (std::min)(static_cast<std::ptrdiff_t>(2), len); int v = this->toi(m_position, m_position + len, 10); if((v < 0) || (have_brace && ((m_position == m_end) || (*m_position != '}')))) { // Look for a Perl-5.10 verb: if(!handle_perl_verb(have_brace)) { // leave the $ as is, and carry on: m_position = --save_position; put(*m_position); ++m_position; } break; } // otherwise output sub v: put(this->m_results[v]); if(have_brace) ++m_position; } } } template <class OutputIterator, class Results, class traits, class ForwardIter> bool basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::handle_perl_verb(bool have_brace) { // // We may have a capitalised string containing a Perl action: // static const char_type MATCH[] = { 'M', 'A', 'T', 'C', 'H' }; static const char_type PREMATCH[] = { 'P', 'R', 'E', 'M', 'A', 'T', 'C', 'H' }; static const char_type POSTMATCH[] = { 'P', 'O', 'S', 'T', 'M', 'A', 'T', 'C', 'H' }; @@ -1032,90 +1033,90 @@ struct format_functor1 template <class S, class OutputIter> inline OutputIter do_format_string(const S* s, OutputIter i) { while(s && *s) { *i = *s; ++i; ++s; } return i; } template <class OutputIter> OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type /*f*/) { return do_format_string(boost::unwrap_ref(func)(m), i); } template <class OutputIter, class Traits> OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type f, const Traits&) { return (*this)(m, i, f); } private: Base func; format_functor1(const format_functor1&); format_functor1& operator=(const format_functor1&); }; template <class charT, class Match, class Traits> struct format_functor_c_string { format_functor_c_string(const charT* ps) : func(ps) {} template <class OutputIter> OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type f, const Traits& t = Traits()) { - typedef typename Match::char_type char_type; + //typedef typename Match::char_type char_type; const charT* end = func; while(*end) ++end; return regex_format_imp(i, m, func, end, f, t); } private: const charT* func; format_functor_c_string(const format_functor_c_string&); format_functor_c_string& operator=(const format_functor_c_string&); }; template <class Container, class Match, class Traits> struct format_functor_container { format_functor_container(const Container& c) : func(c) {} template <class OutputIter> OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type f, const Traits& t = Traits()) { - typedef typename Match::char_type char_type; + //typedef typename Match::char_type char_type; return re_detail::regex_format_imp(i, m, func.begin(), func.end(), f, t); } private: const Container& func; format_functor_container(const format_functor_container&); format_functor_container& operator=(const format_functor_container&); }; template <class Func, class Match, class OutputIterator, class Traits = re_detail::trivial_format_traits<typename Match::char_type> > struct compute_functor_type { typedef typename format_traits<Func, Match, OutputIterator>::type tag; typedef typename boost::remove_cv< typename boost::remove_pointer<Func>::type>::type maybe_char_type; typedef typename mpl::if_< ::boost::is_same<tag, mpl::int_<0> >, format_functor_c_string<maybe_char_type, Match, Traits>, typename mpl::if_< ::boost::is_same<tag, mpl::int_<1> >, format_functor_container<Func, Match, Traits>, typename mpl::if_< ::boost::is_same<tag, mpl::int_<2> >, format_functor1<Func, Match>, typename mpl::if_< ::boost::is_same<tag, mpl::int_<3> >, format_functor2<Func, Match>, format_functor3<Func, Match> >::type >::type >::type >::type type; }; } // namespace re_detail template <class OutputIterator, class Iterator, class Allocator, class Functor> inline OutputIterator regex_format(OutputIterator out, const match_results<Iterator, Allocator>& m, Functor fmt, diff --git a/3rdParty/Boost/src/boost/regex/v4/regex_raw_buffer.hpp b/3rdParty/Boost/src/boost/regex/v4/regex_raw_buffer.hpp index 52d45a2..c7792e3 100644 --- a/3rdParty/Boost/src/boost/regex/v4/regex_raw_buffer.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/regex_raw_buffer.hpp @@ -97,71 +97,71 @@ struct padding3<16> enum{ padding_size = padding3<sizeof(padding)>::padding_size, padding_mask = padding3<sizeof(padding)>::padding_mask }; // // class raw_storage // basically this is a simplified vector<unsigned char> // this is used by basic_regex for expression storage // class BOOST_REGEX_DECL raw_storage { public: typedef std::size_t size_type; typedef unsigned char* pointer; private: pointer last, start, end; public: raw_storage(); raw_storage(size_type n); ~raw_storage() { ::operator delete(start); } void BOOST_REGEX_CALL resize(size_type n); void* BOOST_REGEX_CALL extend(size_type n) { if(size_type(last - end) < n) resize(n + (end - start)); - register pointer result = end; + pointer result = end; end += n; return result; } void* BOOST_REGEX_CALL insert(size_type pos, size_type n); size_type BOOST_REGEX_CALL size() { return end - start; } size_type BOOST_REGEX_CALL capacity() { return last - start; } void* BOOST_REGEX_CALL data()const { return start; } size_type BOOST_REGEX_CALL index(void* ptr) { return static_cast<pointer>(ptr) - static_cast<pointer>(data()); } void BOOST_REGEX_CALL clear() { end = start; } void BOOST_REGEX_CALL align() { // move end up to a boundary: end = start + (((end - start) + padding_mask) & ~padding_mask); diff --git a/3rdParty/Boost/src/boost/regex/v4/regex_split.hpp b/3rdParty/Boost/src/boost/regex/v4/regex_split.hpp index a7ae350..c12d7ba 100644 --- a/3rdParty/Boost/src/boost/regex/v4/regex_split.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/regex_split.hpp @@ -75,83 +75,83 @@ bool split_pred<OutputIterator, charT, Traits1, Alloc1>::operator() // output sub-expressions only: for(unsigned i = 1; i < what.size(); ++i) { *(*p_out) = what.str(i); ++(*p_out); if(0 == --*p_max) return false; } return *p_max != 0; } else { // output $` only if it's not-null or not at the start of the input: const sub_match<iterator_type>& sub = what[-1]; if((sub.first != sub.second) || (*p_max != initial_max)) { *(*p_out) = sub.str(); ++(*p_out); return --*p_max; } } // // initial null, do nothing: return true; } } // namespace re_detail template <class OutputIterator, class charT, class Traits1, class Alloc1, class Traits2> std::size_t regex_split(OutputIterator out, std::basic_string<charT, Traits1, Alloc1>& s, const basic_regex<charT, Traits2>& e, match_flag_type flags, std::size_t max_split) { typedef typename std::basic_string<charT, Traits1, Alloc1>::const_iterator ci_t; - typedef typename match_results<ci_t>::allocator_type match_allocator; + //typedef typename match_results<ci_t>::allocator_type match_allocator; ci_t last = s.begin(); std::size_t init_size = max_split; re_detail::split_pred<OutputIterator, charT, Traits1, Alloc1> pred(&last, &out, &max_split); ci_t i, j; i = s.begin(); j = s.end(); regex_grep(pred, i, j, e, flags); // // if there is still input left, do a final push as long as max_split // is not exhausted, and we're not splitting sub-expressions rather // than whitespace: - if(max_split && (last != s.end()) && (e.mark_count() == 1)) + if(max_split && (last != s.end()) && (e.mark_count() == 0)) { *out = std::basic_string<charT, Traits1, Alloc1>((ci_t)last, (ci_t)s.end()); ++out; last = s.end(); --max_split; } // // delete from the string everything that has been processed so far: s.erase(0, last - s.begin()); // // return the number of new records pushed: return init_size - max_split; } template <class OutputIterator, class charT, class Traits1, class Alloc1, class Traits2> inline std::size_t regex_split(OutputIterator out, std::basic_string<charT, Traits1, Alloc1>& s, const basic_regex<charT, Traits2>& e, match_flag_type flags = match_default) { return regex_split(out, s, e, flags, UINT_MAX); } template <class OutputIterator, class charT, class Traits1, class Alloc1> inline std::size_t regex_split(OutputIterator out, std::basic_string<charT, Traits1, Alloc1>& s) { return regex_split(out, s, re_detail::get_default_expression(charT(0)), match_default, UINT_MAX); } #ifdef BOOST_MSVC # pragma warning(pop) #endif #ifdef BOOST_MSVC diff --git a/3rdParty/Boost/src/boost/regex/v4/regex_token_iterator.hpp b/3rdParty/Boost/src/boost/regex/v4/regex_token_iterator.hpp index 4e8bc36..dbb0803 100644 --- a/3rdParty/Boost/src/boost/regex/v4/regex_token_iterator.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/regex_token_iterator.hpp @@ -1,113 +1,109 @@ /* * * Copyright (c) 2003 * John Maddock * * Use, modification and distribution are subject to the * Boost Software License, Version 1.0. (See accompanying file * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) * */ /* * LOCATION: see http://www.boost.org for most recent version. * FILE regex_token_iterator.hpp * VERSION see <boost/version.hpp> * DESCRIPTION: Provides regex_token_iterator implementation. */ #ifndef BOOST_REGEX_V4_REGEX_TOKEN_ITERATOR_HPP #define BOOST_REGEX_V4_REGEX_TOKEN_ITERATOR_HPP #include <boost/shared_ptr.hpp> #include <boost/detail/workaround.hpp> #if (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\ - || BOOST_WORKAROUND(BOOST_MSVC, < 1300) \ || BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) // // Borland C++ Builder 6, and Visual C++ 6, // can't cope with the array template constructor // so we have a template member that will accept any type as // argument, and then assert that is really is an array: // #include <boost/static_assert.hpp> #include <boost/type_traits/is_array.hpp> #endif namespace boost{ #ifdef BOOST_MSVC #pragma warning(push) #pragma warning(disable: 4103) #endif #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX #endif #ifdef BOOST_MSVC #pragma warning(pop) -#endif -#if BOOST_WORKAROUND(BOOST_MSVC, > 1300) -# pragma warning(push) -# pragma warning(disable:4700) +#pragma warning(push) +#pragma warning(disable:4700) #endif template <class BidirectionalIterator, class charT, class traits> class regex_token_iterator_implementation { typedef basic_regex<charT, traits> regex_type; typedef sub_match<BidirectionalIterator> value_type; match_results<BidirectionalIterator> what; // current match BidirectionalIterator base; // start of search area BidirectionalIterator end; // end of search area const regex_type re; // the expression match_flag_type flags; // match flags value_type result; // the current string result int N; // the current sub-expression being enumerated std::vector<int> subs; // the sub-expressions to enumerate public: regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, int sub, match_flag_type f) : end(last), re(*p), flags(f){ subs.push_back(sub); } regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const std::vector<int>& v, match_flag_type f) : end(last), re(*p), flags(f), subs(v){} #if !BOOST_WORKAROUND(__HP_aCC, < 60700) #if (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\ - || BOOST_WORKAROUND(BOOST_MSVC, < 1300) \ || BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) \ || BOOST_WORKAROUND(__HP_aCC, < 60700) template <class T> regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const T& submatches, match_flag_type f) : end(last), re(*p), flags(f) { // assert that T really is an array: BOOST_STATIC_ASSERT(::boost::is_array<T>::value); const std::size_t array_size = sizeof(T) / sizeof(submatches[0]); for(std::size_t i = 0; i < array_size; ++i) { subs.push_back(submatches[i]); } } #else template <std::size_t CN> regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const int (&submatches)[CN], match_flag_type f) : end(last), re(*p), flags(f) { for(std::size_t i = 0; i < CN; ++i) { subs.push_back(submatches[i]); } } #endif #endif bool init(BidirectionalIterator first) { N = 0; base = first; if(regex_search(first, end, what, re, flags, base) == true) { N = 0; result = ((subs[N] == -1) ? what.prefix() : what[(int)subs[N]]); return true; @@ -177,71 +173,70 @@ class regex_token_iterator sub_match<BidirectionalIterator>, typename re_detail::regex_iterator_traits<BidirectionalIterator>::difference_type, const sub_match<BidirectionalIterator>*, const sub_match<BidirectionalIterator>& > #endif { private: typedef regex_token_iterator_implementation<BidirectionalIterator, charT, traits> impl; typedef shared_ptr<impl> pimpl; public: typedef basic_regex<charT, traits> regex_type; typedef sub_match<BidirectionalIterator> value_type; typedef typename re_detail::regex_iterator_traits<BidirectionalIterator>::difference_type difference_type; typedef const value_type* pointer; typedef const value_type& reference; typedef std::forward_iterator_tag iterator_category; regex_token_iterator(){} regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, int submatch = 0, match_flag_type m = match_default) : pdata(new impl(&re, b, submatch, m)) { if(!pdata->init(a)) pdata.reset(); } regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, const std::vector<int>& submatches, match_flag_type m = match_default) : pdata(new impl(&re, b, submatches, m)) { if(!pdata->init(a)) pdata.reset(); } #if !BOOST_WORKAROUND(__HP_aCC, < 60700) #if (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\ - || BOOST_WORKAROUND(BOOST_MSVC, < 1300) \ || BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) \ || BOOST_WORKAROUND(__HP_aCC, < 60700) template <class T> regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, const T& submatches, match_flag_type m = match_default) : pdata(new impl(&re, b, submatches, m)) { if(!pdata->init(a)) pdata.reset(); } #else template <std::size_t N> regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, const int (&submatches)[N], match_flag_type m = match_default) : pdata(new impl(&re, b, submatches, m)) { if(!pdata->init(a)) pdata.reset(); } #endif #endif regex_token_iterator(const regex_token_iterator& that) : pdata(that.pdata) {} regex_token_iterator& operator=(const regex_token_iterator& that) { pdata = that.pdata; return *this; } bool operator==(const regex_token_iterator& that)const { if((pdata.get() == 0) || (that.pdata.get() == 0)) return pdata.get() == that.pdata.get(); return pdata->compare(*(that.pdata.get())); } bool operator!=(const regex_token_iterator& that)const @@ -264,79 +259,75 @@ public: regex_token_iterator result(*this); ++(*this); return result; } private: pimpl pdata; void cow() { // copy-on-write if(pdata.get() && !pdata.unique()) { pdata.reset(new impl(*(pdata.get()))); } } }; typedef regex_token_iterator<const char*> cregex_token_iterator; typedef regex_token_iterator<std::string::const_iterator> sregex_token_iterator; #ifndef BOOST_NO_WREGEX typedef regex_token_iterator<const wchar_t*> wcregex_token_iterator; typedef regex_token_iterator<std::wstring::const_iterator> wsregex_token_iterator; #endif template <class charT, class traits> inline regex_token_iterator<const charT*, charT, traits> make_regex_token_iterator(const charT* p, const basic_regex<charT, traits>& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default) { return regex_token_iterator<const charT*, charT, traits>(p, p+traits::length(p), e, submatch, m); } template <class charT, class traits, class ST, class SA> inline regex_token_iterator<typename std::basic_string<charT, ST, SA>::const_iterator, charT, traits> make_regex_token_iterator(const std::basic_string<charT, ST, SA>& p, const basic_regex<charT, traits>& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default) { return regex_token_iterator<typename std::basic_string<charT, ST, SA>::const_iterator, charT, traits>(p.begin(), p.end(), e, submatch, m); } -#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) template <class charT, class traits, std::size_t N> inline regex_token_iterator<const charT*, charT, traits> make_regex_token_iterator(const charT* p, const basic_regex<charT, traits>& e, const int (&submatch)[N], regex_constants::match_flag_type m = regex_constants::match_default) { return regex_token_iterator<const charT*, charT, traits>(p, p+traits::length(p), e, submatch, m); } template <class charT, class traits, class ST, class SA, std::size_t N> inline regex_token_iterator<typename std::basic_string<charT, ST, SA>::const_iterator, charT, traits> make_regex_token_iterator(const std::basic_string<charT, ST, SA>& p, const basic_regex<charT, traits>& e, const int (&submatch)[N], regex_constants::match_flag_type m = regex_constants::match_default) { return regex_token_iterator<typename std::basic_string<charT, ST, SA>::const_iterator, charT, traits>(p.begin(), p.end(), e, submatch, m); } -#endif template <class charT, class traits> inline regex_token_iterator<const charT*, charT, traits> make_regex_token_iterator(const charT* p, const basic_regex<charT, traits>& e, const std::vector<int>& submatch, regex_constants::match_flag_type m = regex_constants::match_default) { return regex_token_iterator<const charT*, charT, traits>(p, p+traits::length(p), e, submatch, m); } template <class charT, class traits, class ST, class SA> inline regex_token_iterator<typename std::basic_string<charT, ST, SA>::const_iterator, charT, traits> make_regex_token_iterator(const std::basic_string<charT, ST, SA>& p, const basic_regex<charT, traits>& e, const std::vector<int>& submatch, regex_constants::match_flag_type m = regex_constants::match_default) { return regex_token_iterator<typename std::basic_string<charT, ST, SA>::const_iterator, charT, traits>(p.begin(), p.end(), e, submatch, m); } -#if BOOST_WORKAROUND(BOOST_MSVC, > 1300) -# pragma warning(pop) -#endif #ifdef BOOST_MSVC +#pragma warning(pop) #pragma warning(push) #pragma warning(disable: 4103) #endif #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_SUFFIX #endif #ifdef BOOST_MSVC #pragma warning(pop) #endif } // namespace boost #endif // BOOST_REGEX_V4_REGEX_TOKEN_ITERATOR_HPP diff --git a/3rdParty/Boost/src/boost/regex/v4/regex_traits.hpp b/3rdParty/Boost/src/boost/regex/v4/regex_traits.hpp index f5f0402..8b1cb6f 100644 --- a/3rdParty/Boost/src/boost/regex/v4/regex_traits.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/regex_traits.hpp @@ -51,124 +51,124 @@ #endif #ifndef BOOST_REGEX_FWD_HPP_INCLUDED #include <boost/regex_fwd.hpp> #endif #include "boost/mpl/has_xxx.hpp" #include <boost/static_assert.hpp> #ifdef BOOST_MSVC #pragma warning(push) #pragma warning(disable: 4103) #endif #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX #endif #ifdef BOOST_MSVC #pragma warning(pop) #endif namespace boost{ template <class charT, class implementationT > struct regex_traits : public implementationT { regex_traits() : implementationT() {} }; // // class regex_traits_wrapper. // this is what our implementation will actually store; // it provides default implementations of the "optional" // interfaces that we support, in addition to the // required "standard" ones: // namespace re_detail{ -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !BOOST_WORKAROUND(__HP_aCC, < 60000) +#if !BOOST_WORKAROUND(__HP_aCC, < 60000) BOOST_MPL_HAS_XXX_TRAIT_DEF(boost_extensions_tag) #else template<class T> struct has_boost_extensions_tag { BOOST_STATIC_CONSTANT(bool, value = false); }; #endif template <class BaseT> struct default_wrapper : public BaseT { typedef typename BaseT::char_type char_type; std::string error_string(::boost::regex_constants::error_type e)const { return ::boost::re_detail::get_default_error_string(e); } ::boost::regex_constants::syntax_type syntax_type(char_type c)const { return ((c & 0x7f) == c) ? get_default_syntax_type(static_cast<char>(c)) : ::boost::regex_constants::syntax_char; } ::boost::regex_constants::escape_syntax_type escape_syntax_type(char_type c)const { return ((c & 0x7f) == c) ? get_default_escape_syntax_type(static_cast<char>(c)) : ::boost::regex_constants::escape_type_identity; } int toi(const char_type*& p1, const char_type* p2, int radix)const { return ::boost::re_detail::global_toi(p1, p2, radix, *this); } char_type translate(char_type c, bool icase)const { return (icase ? this->translate_nocase(c) : this->translate(c)); } char_type translate(char_type c)const { return BaseT::translate(c); } char_type tolower(char_type c)const { return ::boost::re_detail::global_lower(c); } char_type toupper(char_type c)const { return ::boost::re_detail::global_upper(c); } }; template <class BaseT, bool has_extensions> struct compute_wrapper_base { typedef BaseT type; }; -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !BOOST_WORKAROUND(__HP_aCC, < 60000) +#if !BOOST_WORKAROUND(__HP_aCC, < 60000) template <class BaseT> struct compute_wrapper_base<BaseT, false> { typedef default_wrapper<BaseT> type; }; #else template <> struct compute_wrapper_base<c_regex_traits<char>, false> { typedef default_wrapper<c_regex_traits<char> > type; }; #ifndef BOOST_NO_WREGEX template <> struct compute_wrapper_base<c_regex_traits<wchar_t>, false> { typedef default_wrapper<c_regex_traits<wchar_t> > type; }; #endif #endif } // namespace re_detail template <class BaseT> struct regex_traits_wrapper : public ::boost::re_detail::compute_wrapper_base< BaseT, ::boost::re_detail::has_boost_extensions_tag<BaseT>::value >::type { regex_traits_wrapper(){} private: regex_traits_wrapper(const regex_traits_wrapper&); regex_traits_wrapper& operator=(const regex_traits_wrapper&); }; diff --git a/3rdParty/Boost/src/boost/regex/v4/regex_traits_defaults.hpp b/3rdParty/Boost/src/boost/regex/v4/regex_traits_defaults.hpp index ca13f19..a087d78 100644 --- a/3rdParty/Boost/src/boost/regex/v4/regex_traits_defaults.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/regex_traits_defaults.hpp @@ -1,46 +1,46 @@ /* * * Copyright (c) 2004 * John Maddock * - * Use, modification and distribution are subject to the - * Boost Software License, Version 1.0. (See accompanying file + * Use, modification and distribution are subject to the + * Boost Software License, Version 1.0. (See accompanying file * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) * */ - + /* * LOCATION: see http://www.boost.org for most recent version. * FILE regex_traits_defaults.hpp * VERSION see <boost/version.hpp> * DESCRIPTION: Declares API's for access to regex_traits default properties. */ #ifndef BOOST_REGEX_TRAITS_DEFAULTS_HPP_INCLUDED #define BOOST_REGEX_TRAITS_DEFAULTS_HPP_INCLUDED #ifdef BOOST_MSVC #pragma warning(push) #pragma warning(disable: 4103) #endif #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX #endif #ifdef BOOST_MSVC #pragma warning(pop) #endif #ifndef BOOST_REGEX_SYNTAX_TYPE_HPP #include <boost/regex/v4/syntax_type.hpp> #endif #ifndef BOOST_REGEX_ERROR_TYPE_HPP #include <boost/regex/v4/error_type.hpp> #endif #ifdef BOOST_NO_STDC_NAMESPACE namespace std{ using ::strlen; } #endif namespace boost{ namespace re_detail{ @@ -53,189 +53,189 @@ template <class charT> inline bool is_extended(charT c) { return c > 256; } inline bool is_extended(char) { return false; } BOOST_REGEX_DECL const char* BOOST_REGEX_CALL get_default_syntax(regex_constants::syntax_type n); BOOST_REGEX_DECL const char* BOOST_REGEX_CALL get_default_error_string(regex_constants::error_type n); BOOST_REGEX_DECL regex_constants::syntax_type BOOST_REGEX_CALL get_default_syntax_type(char c); BOOST_REGEX_DECL regex_constants::escape_syntax_type BOOST_REGEX_CALL get_default_escape_syntax_type(char c); // is charT c a combining character? BOOST_REGEX_DECL bool BOOST_REGEX_CALL is_combining_implementation(uint_least16_t s); template <class charT> inline bool is_combining(charT c) { return (c <= static_cast<charT>(0)) ? false : ((c >= static_cast<charT>((std::numeric_limits<uint_least16_t>::max)())) ? false : is_combining_implementation(static_cast<unsigned short>(c))); } template <> inline bool is_combining<char>(char) { return false; } template <> inline bool is_combining<signed char>(signed char) { return false; } template <> inline bool is_combining<unsigned char>(unsigned char) { return false; } #if !defined(__hpux) && !defined(__WINSCW__) // can't use WCHAR_MAX/MIN in pp-directives -#ifdef _MSC_VER +#ifdef _MSC_VER template<> inline bool is_combining<wchar_t>(wchar_t c) { return is_combining_implementation(static_cast<unsigned short>(c)); } #elif !defined(__DECCXX) && !defined(__osf__) && !defined(__OSF__) && defined(WCHAR_MIN) && (WCHAR_MIN == 0) && !defined(BOOST_NO_INTRINSIC_WCHAR_T) #if defined(WCHAR_MAX) && (WCHAR_MAX <= USHRT_MAX) template<> inline bool is_combining<wchar_t>(wchar_t c) { return is_combining_implementation(static_cast<unsigned short>(c)); } #else template<> inline bool is_combining<wchar_t>(wchar_t c) { return (c >= (std::numeric_limits<uint_least16_t>::max)()) ? false : is_combining_implementation(static_cast<unsigned short>(c)); } #endif #endif #endif // // is a charT c a line separator? // template <class charT> inline bool is_separator(charT c) { return BOOST_REGEX_MAKE_BOOL( - (c == static_cast<charT>('\n')) - || (c == static_cast<charT>('\r')) - || (c == static_cast<charT>('\f')) - || (static_cast<boost::uint16_t>(c) == 0x2028u) - || (static_cast<boost::uint16_t>(c) == 0x2029u) + (c == static_cast<charT>('\n')) + || (c == static_cast<charT>('\r')) + || (c == static_cast<charT>('\f')) + || (static_cast<boost::uint16_t>(c) == 0x2028u) + || (static_cast<boost::uint16_t>(c) == 0x2029u) || (static_cast<boost::uint16_t>(c) == 0x85u)); } template <> inline bool is_separator<char>(char c) { return BOOST_REGEX_MAKE_BOOL((c == '\n') || (c == '\r') || (c == '\f')); } // // get a default collating element: // BOOST_REGEX_DECL std::string BOOST_REGEX_CALL lookup_default_collate_name(const std::string& name); // // get the state_id of a character clasification, the individual // traits classes then transform that state_id into a bitmask: // template <class charT> struct character_pointer_range { const charT* p1; const charT* p2; bool operator < (const character_pointer_range& r)const { return std::lexicographical_compare(p1, p2, r.p1, r.p2); } bool operator == (const character_pointer_range& r)const { // Not only do we check that the ranges are of equal size before // calling std::equal, but there is no other algorithm available: // not even a non-standard MS one. So forward to unchecked_equal // in the MS case. return ((p2 - p1) == (r.p2 - r.p1)) && re_detail::equal(p1, p2, r.p1); } }; template <class charT> int get_default_class_id(const charT* p1, const charT* p2) { static const charT data[73] = { 'a', 'l', 'n', 'u', 'm', 'a', 'l', 'p', 'h', 'a', 'b', 'l', 'a', 'n', 'k', 'c', 'n', 't', 'r', 'l', 'd', 'i', 'g', 'i', 't', 'g', 'r', 'a', 'p', 'h', 'l', 'o', 'w', 'e', 'r', 'p', 'r', 'i', 'n', 't', 'p', 'u', 'n', 'c', 't', 's', 'p', 'a', 'c', 'e', 'u', 'n', 'i', 'c', 'o', 'd', 'e', 'u', 'p', 'p', 'e', 'r', 'v', 'w', 'o', 'r', 'd', 'x', 'd', 'i', 'g', 'i', 't', }; - static const character_pointer_range<charT> ranges[21] = + static const character_pointer_range<charT> ranges[21] = { {data+0, data+5,}, // alnum {data+5, data+10,}, // alpha {data+10, data+15,}, // blank {data+15, data+20,}, // cntrl {data+20, data+21,}, // d {data+20, data+25,}, // digit {data+25, data+30,}, // graph {data+29, data+30,}, // h {data+30, data+31,}, // l {data+30, data+35,}, // lower {data+35, data+40,}, // print {data+40, data+45,}, // punct {data+45, data+46,}, // s {data+45, data+50,}, // space {data+57, data+58,}, // u {data+50, data+57,}, // unicode {data+57, data+62,}, // upper {data+62, data+63,}, // v {data+63, data+64,}, // w {data+63, data+67,}, // word {data+67, data+73,}, // xdigit }; static const character_pointer_range<charT>* ranges_begin = ranges; static const character_pointer_range<charT>* ranges_end = ranges + (sizeof(ranges)/sizeof(ranges[0])); - + character_pointer_range<charT> t = { p1, p2, }; const character_pointer_range<charT>* p = std::lower_bound(ranges_begin, ranges_end, t); if((p != ranges_end) && (t == *p)) return static_cast<int>(p - ranges); return -1; } // // helper functions: // template <class charT> std::ptrdiff_t global_length(const charT* p) { std::ptrdiff_t n = 0; while(*p) { ++p; ++n; } return n; } template<> inline std::ptrdiff_t global_length<char>(const char* p) { return (std::strlen)(p); } #ifndef BOOST_NO_WREGEX template<> inline std::ptrdiff_t global_length<wchar_t>(const wchar_t* p) { return (std::wcslen)(p); } #endif template <class charT> inline charT BOOST_REGEX_CALL global_lower(charT c) @@ -292,80 +292,80 @@ int global_value(charT c) if(c > f) return -1; if(c >= a) return 10 + (c - a); if(c > F) return -1; if(c >= A) return 10 + (c - A); if(c > nine) return -1; if(c >= zero) return c - zero; return -1; } template <class charT, class traits> int global_toi(const charT*& p1, const charT* p2, int radix, const traits& t) { (void)t; // warning suppression int next_value = t.value(*p1, radix); if((p1 == p2) || (next_value < 0) || (next_value >= radix)) return -1; int result = 0; while(p1 != p2) { next_value = t.value(*p1, radix); if((next_value < 0) || (next_value >= radix)) break; result *= radix; result += next_value; ++p1; } return result; } template <class charT> inline const charT* get_escape_R_string() { #ifdef BOOST_MSVC # pragma warning(push) # pragma warning(disable:4309 4245) #endif - static const charT e1[] = { '(', '?', '>', '\x0D', '\x0A', '?', - '|', '[', '\x0A', '\x0B', '\x0C', '\x85', '\\', 'x', '{', '2', '0', '2', '8', '}', + static const charT e1[] = { '(', '?', '>', '\x0D', '\x0A', '?', + '|', '[', '\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' }; + static const charT e2[] = { '(', '?', '>', '\x0D', '\x0A', '?', + '|', '[', '\x0A', '\x0B', '\x0C', static_cast<unsigned char>('\x85'), ']', ')', '\0' }; charT c = static_cast<charT>(0x2029u); bool b = (static_cast<unsigned>(c) == 0x2029u); - + return (b ? e1 : e2); #ifdef BOOST_MSVC # pragma warning(pop) #endif } template <> inline const char* get_escape_R_string<char>() { #ifdef BOOST_MSVC # pragma warning(push) # pragma warning(disable:4309) #endif - static const char e2[] = { '(', '?', '>', '\x0D', '\x0A', '?', + static const char e2[] = { '(', '?', '>', '\x0D', '\x0A', '?', '|', '[', '\x0A', '\x0B', '\x0C', '\x85', ']', ')', '\0' }; return e2; #ifdef BOOST_MSVC # pragma warning(pop) #endif } } // re_detail } // boost #ifdef BOOST_MSVC #pragma warning(push) #pragma warning(disable: 4103) #endif #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_SUFFIX #endif #ifdef BOOST_MSVC #pragma warning(pop) #endif #endif diff --git a/3rdParty/Boost/src/boost/regex/v4/sub_match.hpp b/3rdParty/Boost/src/boost/regex/v4/sub_match.hpp index 34a8684..7ce8d53 100644 --- a/3rdParty/Boost/src/boost/regex/v4/sub_match.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/sub_match.hpp @@ -4,85 +4,84 @@ * John Maddock * * Use, modification and distribution are subject to the * Boost Software License, Version 1.0. (See accompanying file * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) * */ /* * LOCATION: see http://www.boost.org for most recent version. * FILE sub_match.cpp * VERSION see <boost/version.hpp> * DESCRIPTION: Declares template class sub_match. */ #ifndef BOOST_REGEX_V4_SUB_MATCH_HPP #define BOOST_REGEX_V4_SUB_MATCH_HPP #ifdef BOOST_MSVC #pragma warning(push) #pragma warning(disable: 4103) #endif #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX #endif #ifdef BOOST_MSVC #pragma warning(pop) #endif namespace boost{ template <class BidiIterator> struct sub_match : public std::pair<BidiIterator, BidiIterator> { typedef typename re_detail::regex_iterator_traits<BidiIterator>::value_type value_type; -#if defined(BOOST_NO_STD_ITERATOR_TRAITS) || defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +#if defined(BOOST_NO_STD_ITERATOR_TRAITS) typedef std::ptrdiff_t difference_type; #else typedef typename re_detail::regex_iterator_traits<BidiIterator>::difference_type difference_type; #endif typedef BidiIterator iterator_type; typedef BidiIterator iterator; typedef BidiIterator const_iterator; bool matched; sub_match() : std::pair<BidiIterator, BidiIterator>(), matched(false) {} sub_match(BidiIterator i) : std::pair<BidiIterator, BidiIterator>(i, i), matched(false) {} #if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)\ - && !BOOST_WORKAROUND(BOOST_MSVC, < 1310)\ && !BOOST_WORKAROUND(__BORLANDC__, <= 0x0551)\ && !BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042)) template <class T, class A> operator std::basic_string<value_type, T, A> ()const { return matched ? std::basic_string<value_type, T, A>(this->first, this->second) : std::basic_string<value_type, T, A>(); } #else operator std::basic_string<value_type> ()const { return str(); } #endif difference_type BOOST_REGEX_CALL length()const { difference_type n = matched ? ::boost::re_detail::distance((BidiIterator)this->first, (BidiIterator)this->second) : 0; return n; } std::basic_string<value_type> str()const { std::basic_string<value_type> result; if(matched) { std::size_t len = ::boost::re_detail::distance((BidiIterator)this->first, (BidiIterator)this->second); result.reserve(len); BidiIterator i = this->first; while(i != this->second) { result.append(1, *i); ++i; } } return result; } int compare(const sub_match& s)const diff --git a/3rdParty/Boost/src/boost/regex/v4/u32regex_token_iterator.hpp b/3rdParty/Boost/src/boost/regex/v4/u32regex_token_iterator.hpp index de16771..e8649f3 100644 --- a/3rdParty/Boost/src/boost/regex/v4/u32regex_token_iterator.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/u32regex_token_iterator.hpp @@ -1,103 +1,99 @@ /* * * Copyright (c) 2003 * John Maddock * * Use, modification and distribution are subject to the * Boost Software License, Version 1.0. (See accompanying file * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) * */ /* * LOCATION: see http://www.boost.org for most recent version. * FILE u32regex_token_iterator.hpp * VERSION see <boost/version.hpp> * DESCRIPTION: Provides u32regex_token_iterator implementation. */ #ifndef BOOST_REGEX_V4_U32REGEX_TOKEN_ITERATOR_HPP #define BOOST_REGEX_V4_U32REGEX_TOKEN_ITERATOR_HPP #if (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\ - || BOOST_WORKAROUND(BOOST_MSVC, < 1300) \ || BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) // // Borland C++ Builder 6, and Visual C++ 6, // can't cope with the array template constructor // so we have a template member that will accept any type as // argument, and then assert that is really is an array: // #include <boost/static_assert.hpp> #include <boost/type_traits/is_array.hpp> #endif namespace boost{ #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX #endif -#if BOOST_WORKAROUND(BOOST_MSVC, > 1300) +#ifdef BOOST_MSVC # pragma warning(push) # pragma warning(disable:4700) #endif template <class BidirectionalIterator> class u32regex_token_iterator_implementation { typedef u32regex regex_type; typedef sub_match<BidirectionalIterator> value_type; match_results<BidirectionalIterator> what; // current match BidirectionalIterator end; // end of search area BidirectionalIterator base; // start of search area const regex_type re; // the expression match_flag_type flags; // match flags value_type result; // the current string result int N; // the current sub-expression being enumerated std::vector<int> subs; // the sub-expressions to enumerate public: u32regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, int sub, match_flag_type f) : end(last), re(*p), flags(f){ subs.push_back(sub); } u32regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const std::vector<int>& v, match_flag_type f) : end(last), re(*p), flags(f), subs(v){} -#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) - // can't reliably get this to work.... -#elif (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\ - || BOOST_WORKAROUND(BOOST_MSVC, < 1300) \ +#if (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\ || BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) \ || BOOST_WORKAROUND(__HP_aCC, < 60700) template <class T> u32regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const T& submatches, match_flag_type f) : end(last), re(*p), flags(f) { // assert that T really is an array: BOOST_STATIC_ASSERT(::boost::is_array<T>::value); const std::size_t array_size = sizeof(T) / sizeof(submatches[0]); for(std::size_t i = 0; i < array_size; ++i) { subs.push_back(submatches[i]); } } #else template <std::size_t CN> u32regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const int (&submatches)[CN], match_flag_type f) : end(last), re(*p), flags(f) { for(std::size_t i = 0; i < CN; ++i) { subs.push_back(submatches[i]); } } #endif bool init(BidirectionalIterator first) { base = first; N = 0; if(u32regex_search(first, end, what, re, flags, base) == true) { N = 0; result = ((subs[N] == -1) ? what.prefix() : what[(int)subs[N]]); return true; @@ -163,74 +159,71 @@ class u32regex_token_iterator : public std::iterator< std::forward_iterator_tag, sub_match<BidirectionalIterator>, typename re_detail::regex_iterator_traits<BidirectionalIterator>::difference_type, const sub_match<BidirectionalIterator>*, const sub_match<BidirectionalIterator>& > #endif { private: typedef u32regex_token_iterator_implementation<BidirectionalIterator> impl; typedef shared_ptr<impl> pimpl; public: typedef u32regex regex_type; typedef sub_match<BidirectionalIterator> value_type; typedef typename re_detail::regex_iterator_traits<BidirectionalIterator>::difference_type difference_type; typedef const value_type* pointer; typedef const value_type& reference; typedef std::forward_iterator_tag iterator_category; u32regex_token_iterator(){} u32regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, int submatch = 0, match_flag_type m = match_default) : pdata(new impl(&re, b, submatch, m)) { if(!pdata->init(a)) pdata.reset(); } u32regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, const std::vector<int>& submatches, match_flag_type m = match_default) : pdata(new impl(&re, b, submatches, m)) { if(!pdata->init(a)) pdata.reset(); } -#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) - // can't reliably get this to work.... -#elif (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\ - || BOOST_WORKAROUND(BOOST_MSVC, < 1300) \ +#if (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\ || BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) \ || BOOST_WORKAROUND(__HP_aCC, < 60700) template <class T> u32regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, const T& submatches, match_flag_type m = match_default) : pdata(new impl(&re, b, submatches, m)) { if(!pdata->init(a)) pdata.reset(); } #else template <std::size_t N> u32regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, const int (&submatches)[N], match_flag_type m = match_default) : pdata(new impl(&re, b, submatches, m)) { if(!pdata->init(a)) pdata.reset(); } #endif u32regex_token_iterator(const u32regex_token_iterator& that) : pdata(that.pdata) {} u32regex_token_iterator& operator=(const u32regex_token_iterator& that) { pdata = that.pdata; return *this; } bool operator==(const u32regex_token_iterator& that)const { if((pdata.get() == 0) || (that.pdata.get() == 0)) return pdata.get() == that.pdata.get(); return pdata->compare(*(that.pdata.get())); } bool operator!=(const u32regex_token_iterator& that)const { return !(*this == that); } @@ -267,111 +260,109 @@ private: } }; typedef u32regex_token_iterator<const char*> utf8regex_token_iterator; typedef u32regex_token_iterator<const UChar*> utf16regex_token_iterator; typedef u32regex_token_iterator<const UChar32*> utf32regex_token_iterator; // construction from an integral sub_match state_id: inline u32regex_token_iterator<const char*> make_u32regex_token_iterator(const char* p, const u32regex& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default) { return u32regex_token_iterator<const char*>(p, p+std::strlen(p), e, submatch, m); } #ifndef BOOST_NO_WREGEX inline u32regex_token_iterator<const wchar_t*> make_u32regex_token_iterator(const wchar_t* p, const u32regex& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default) { return u32regex_token_iterator<const wchar_t*>(p, p+std::wcslen(p), e, submatch, m); } #endif #if !defined(U_WCHAR_IS_UTF16) && (U_SIZEOF_WCHAR_T != 2) inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const UChar* p, const u32regex& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default) { return u32regex_token_iterator<const UChar*>(p, p+u_strlen(p), e, submatch, m); } #endif template <class charT, class Traits, class Alloc> inline u32regex_token_iterator<typename std::basic_string<charT, Traits, Alloc>::const_iterator> make_u32regex_token_iterator(const std::basic_string<charT, Traits, Alloc>& p, const u32regex& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default) { typedef typename std::basic_string<charT, Traits, Alloc>::const_iterator iter_type; return u32regex_token_iterator<iter_type>(p.begin(), p.end(), e, submatch, m); } inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const U_NAMESPACE_QUALIFIER UnicodeString& s, const u32regex& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default) { return u32regex_token_iterator<const UChar*>(s.getBuffer(), s.getBuffer() + s.length(), e, submatch, m); } -#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) // construction from a reference to an array: template <std::size_t N> inline u32regex_token_iterator<const char*> make_u32regex_token_iterator(const char* p, const u32regex& e, const int (&submatch)[N], regex_constants::match_flag_type m = regex_constants::match_default) { return u32regex_token_iterator<const char*>(p, p+std::strlen(p), e, submatch, m); } #ifndef BOOST_NO_WREGEX template <std::size_t N> inline u32regex_token_iterator<const wchar_t*> make_u32regex_token_iterator(const wchar_t* p, const u32regex& e, const int (&submatch)[N], regex_constants::match_flag_type m = regex_constants::match_default) { return u32regex_token_iterator<const wchar_t*>(p, p+std::wcslen(p), e, submatch, m); } #endif #if !defined(U_WCHAR_IS_UTF16) && (U_SIZEOF_WCHAR_T != 2) template <std::size_t N> inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const UChar* p, const u32regex& e, const int (&submatch)[N], regex_constants::match_flag_type m = regex_constants::match_default) { return u32regex_token_iterator<const UChar*>(p, p+u_strlen(p), e, submatch, m); } #endif template <class charT, class Traits, class Alloc, std::size_t N> inline u32regex_token_iterator<typename std::basic_string<charT, Traits, Alloc>::const_iterator> make_u32regex_token_iterator(const std::basic_string<charT, Traits, Alloc>& p, const u32regex& e, const int (&submatch)[N], regex_constants::match_flag_type m = regex_constants::match_default) { typedef typename std::basic_string<charT, Traits, Alloc>::const_iterator iter_type; return u32regex_token_iterator<iter_type>(p.begin(), p.end(), e, submatch, m); } template <std::size_t N> inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const U_NAMESPACE_QUALIFIER UnicodeString& s, const u32regex& e, const int (&submatch)[N], regex_constants::match_flag_type m = regex_constants::match_default) { return u32regex_token_iterator<const UChar*>(s.getBuffer(), s.getBuffer() + s.length(), e, submatch, m); } -#endif // BOOST_MSVC < 1300 // construction from a vector of sub_match state_id's: inline u32regex_token_iterator<const char*> make_u32regex_token_iterator(const char* p, const u32regex& e, const std::vector<int>& submatch, regex_constants::match_flag_type m = regex_constants::match_default) { return u32regex_token_iterator<const char*>(p, p+std::strlen(p), e, submatch, m); } #ifndef BOOST_NO_WREGEX inline u32regex_token_iterator<const wchar_t*> make_u32regex_token_iterator(const wchar_t* p, const u32regex& e, const std::vector<int>& submatch, regex_constants::match_flag_type m = regex_constants::match_default) { return u32regex_token_iterator<const wchar_t*>(p, p+std::wcslen(p), e, submatch, m); } #endif #if !defined(U_WCHAR_IS_UTF16) && (U_SIZEOF_WCHAR_T != 2) inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const UChar* p, const u32regex& e, const std::vector<int>& submatch, regex_constants::match_flag_type m = regex_constants::match_default) { return u32regex_token_iterator<const UChar*>(p, p+u_strlen(p), e, submatch, m); } #endif template <class charT, class Traits, class Alloc> inline u32regex_token_iterator<typename std::basic_string<charT, Traits, Alloc>::const_iterator> make_u32regex_token_iterator(const std::basic_string<charT, Traits, Alloc>& p, const u32regex& e, const std::vector<int>& submatch, regex_constants::match_flag_type m = regex_constants::match_default) { typedef typename std::basic_string<charT, Traits, Alloc>::const_iterator iter_type; return u32regex_token_iterator<iter_type>(p.begin(), p.end(), e, submatch, m); } inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const U_NAMESPACE_QUALIFIER UnicodeString& s, const u32regex& e, const std::vector<int>& submatch, regex_constants::match_flag_type m = regex_constants::match_default) { return u32regex_token_iterator<const UChar*>(s.getBuffer(), s.getBuffer() + s.length(), e, submatch, m); } -#if BOOST_WORKAROUND(BOOST_MSVC, > 1300) +#ifdef BOOST_MSVC # pragma warning(pop) #endif #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_SUFFIX #endif } // namespace boost #endif // BOOST_REGEX_V4_REGEX_TOKEN_ITERATOR_HPP diff --git a/3rdParty/Boost/src/boost/regex/v4/w32_regex_traits.hpp b/3rdParty/Boost/src/boost/regex/v4/w32_regex_traits.hpp index d556207..ef934b7 100644 --- a/3rdParty/Boost/src/boost/regex/v4/w32_regex_traits.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/w32_regex_traits.hpp @@ -367,82 +367,80 @@ typename w32_regex_traits_implementation<charT>::string_type { // get a regular sort key, and then truncate it: result.assign(this->transform(p1, p2)); result.erase(this->m_collate_delim); break; } case sort_delim: // get a regular sort key, and then truncate everything after the delim: result.assign(this->transform(p1, p2)); std::size_t i; for(i = 0; i < result.size(); ++i) { if(result[i] == m_collate_delim) break; } result.erase(i); break; } if(result.empty()) result = string_type(1, charT(0)); return result; } template <class charT> typename w32_regex_traits_implementation<charT>::string_type w32_regex_traits_implementation<charT>::lookup_collatename(const charT* p1, const charT* p2) const { typedef typename std::map<string_type, string_type>::const_iterator iter_type; if(m_custom_collate_names.size()) { iter_type pos = m_custom_collate_names.find(string_type(p1, p2)); if(pos != m_custom_collate_names.end()) return pos->second; } #if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)\ - && !BOOST_WORKAROUND(BOOST_MSVC, < 1300)\ && !BOOST_WORKAROUND(__BORLANDC__, <= 0x0551) std::string name(p1, p2); #else std::string name; const charT* p0 = p1; while(p0 != p2) name.append(1, char(*p0++)); #endif name = lookup_default_collate_name(name); #if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)\ - && !BOOST_WORKAROUND(BOOST_MSVC, < 1300)\ && !BOOST_WORKAROUND(__BORLANDC__, <= 0x0551) if(name.size()) return string_type(name.begin(), name.end()); #else if(name.size()) { string_type result; typedef std::string::const_iterator iter; iter b = name.begin(); iter e = name.end(); while(b != e) result.append(1, charT(*b++)); return result; } #endif if(p2 - p1 == 1) return string_type(1, *p1); return string_type(); } template <class charT> w32_regex_traits_implementation<charT>::w32_regex_traits_implementation(::boost::re_detail::lcid_type l) : w32_regex_traits_char_layer<charT>(l) { cat_type cat; std::string cat_name(w32_regex_traits<charT>::get_catalog_name()); if(cat_name.size()) { cat = ::boost::re_detail::w32_cat_open(cat_name); if(!cat) { std::string m("Unable to open message catalog: "); std::runtime_error err(m + cat_name); boost::re_detail::raise_runtime_error(err); } @@ -520,71 +518,71 @@ typename w32_regex_traits_implementation<charT>::char_class_type 0x0040u, // C1_BLANK 0x0020u, // C1_CNTRL 0x0004u, // C1_DIGIT 0x0004u, // C1_DIGIT (~(0x0020u|0x0008u|0x0040) & 0x01ffu) | 0x0400u, // not C1_CNTRL or C1_SPACE or C1_BLANK w32_regex_traits_implementation<charT>::mask_horizontal, 0x0002u, // C1_LOWER 0x0002u, // C1_LOWER (~0x0020u & 0x01ffu) | 0x0400, // not C1_CNTRL 0x0010u, // C1_PUNCT 0x0008u, // C1_SPACE 0x0008u, // C1_SPACE 0x0001u, // C1_UPPER w32_regex_traits_implementation<charT>::mask_unicode, 0x0001u, // C1_UPPER w32_regex_traits_implementation<charT>::mask_vertical, 0x0104u | w32_regex_traits_implementation<charT>::mask_word, 0x0104u | w32_regex_traits_implementation<charT>::mask_word, 0x0080u, // C1_XDIGIT }; if(m_custom_class_names.size()) { typedef typename std::map<std::basic_string<charT>, char_class_type>::const_iterator map_iter; map_iter pos = m_custom_class_names.find(string_type(p1, p2)); if(pos != m_custom_class_names.end()) return pos->second; } std::size_t state_id = 1 + re_detail::get_default_class_id(p1, p2); if(state_id < sizeof(masks) / sizeof(masks[0])) return masks[state_id]; return masks[0]; } template <class charT> -boost::shared_ptr<const w32_regex_traits_implementation<charT> > create_w32_regex_traits(::boost::re_detail::lcid_type l BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(charT)) +boost::shared_ptr<const w32_regex_traits_implementation<charT> > create_w32_regex_traits(::boost::re_detail::lcid_type l) { // TODO: create a cache for previously constructed objects. return boost::object_cache< ::boost::re_detail::lcid_type, w32_regex_traits_implementation<charT> >::get(l, 5); } } // re_detail template <class charT> class w32_regex_traits { public: typedef charT char_type; typedef std::size_t size_type; typedef std::basic_string<char_type> string_type; typedef ::boost::re_detail::lcid_type locale_type; typedef boost::uint_least32_t char_class_type; struct boost_extensions_tag{}; w32_regex_traits() : m_pimpl(re_detail::create_w32_regex_traits<charT>(::boost::re_detail::w32_get_default_locale())) { } static size_type length(const char_type* p) { return std::char_traits<charT>::length(p); } regex_constants::syntax_type syntax_type(charT c)const { return m_pimpl->syntax_type(c); } regex_constants::escape_syntax_type escape_syntax_type(charT c) const { return m_pimpl->escape_syntax_type(c); } charT translate(charT c) const |