diff options
Diffstat (limited to '3rdParty/Boost/src/boost/regex')
18 files changed, 363 insertions, 249 deletions
diff --git a/3rdParty/Boost/src/boost/regex/config.hpp b/3rdParty/Boost/src/boost/regex/config.hpp index e4b2138..a88a785 100644 --- a/3rdParty/Boost/src/boost/regex/config.hpp +++ b/3rdParty/Boost/src/boost/regex/config.hpp @@ -186,16 +186,19 @@ * ****************************************************************************/ -#if defined(BOOST_HAS_DECLSPEC) && (defined(BOOST_REGEX_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)) && !defined(BOOST_REGEX_STATIC_LINK) +#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 __declspec(dllexport) +# define BOOST_REGEX_DECL BOOST_SYMBOL_EXPORT # define BOOST_REGEX_BUILD_DLL # else -# define BOOST_REGEX_DECL __declspec(dllimport) +# define BOOST_REGEX_DECL BOOST_SYMBOL_IMPORT # endif -#endif - -#ifndef BOOST_REGEX_DECL +#else # define BOOST_REGEX_DECL #endif @@ -252,6 +255,10 @@ # define BOOST_REGEX_USE_CPP_LOCALE #endif +#if defined(__CYGWIN__) +# define BOOST_REGEX_USE_C_LOCALE +#endif + /* Win32 defaults to native Win32 locale: */ #if defined(_WIN32) && !defined(BOOST_REGEX_USE_WIN32_LOCALE) && !defined(BOOST_REGEX_USE_C_LOCALE) && !defined(BOOST_REGEX_USE_CPP_LOCALE) && !defined(BOOST_REGEX_NO_W32) # define BOOST_REGEX_USE_WIN32_LOCALE diff --git a/3rdParty/Boost/src/boost/regex/icu.hpp b/3rdParty/Boost/src/boost/regex/icu.hpp index c8770c6..e9a55c0 100644 --- a/3rdParty/Boost/src/boost/regex/icu.hpp +++ b/3rdParty/Boost/src/boost/regex/icu.hpp @@ -27,6 +27,10 @@ #include <boost/mpl/int_fwd.hpp> #include <bitset> +#ifdef BOOST_MSVC +#pragma warning (push) +#pragma warning (disable: 4251) +#endif namespace boost{ @@ -1015,6 +1019,10 @@ inline U_NAMESPACE_QUALIFIER UnicodeString u32regex_replace(const U_NAMESPACE_QU } // namespace boost. +#ifdef BOOST_MSVC +#pragma warning (pop) +#endif + #include <boost/regex/v4/u32regex_iterator.hpp> #include <boost/regex/v4/u32regex_token_iterator.hpp> diff --git a/3rdParty/Boost/src/boost/regex/pending/object_cache.hpp b/3rdParty/Boost/src/boost/regex/pending/object_cache.hpp index e1aa191..db60e28 100644 --- a/3rdParty/Boost/src/boost/regex/pending/object_cache.hpp +++ b/3rdParty/Boost/src/boost/regex/pending/object_cache.hpp @@ -41,10 +41,10 @@ public: typedef std::map<Key, list_iterator> map_type; typedef typename map_type::iterator map_iterator; typedef typename list_type::size_type size_type; - static boost::shared_ptr<Object const> get(const Key& k, size_type max_cache_size); + static boost::shared_ptr<Object const> get(const Key& k, size_type l_max_cache_size); private: - static boost::shared_ptr<Object const> do_get(const Key& k, size_type max_cache_size); + static boost::shared_ptr<Object const> do_get(const Key& k, size_type l_max_cache_size); struct data { @@ -58,7 +58,7 @@ private: }; template <class Key, class Object> -boost::shared_ptr<Object const> object_cache<Key, Object>::get(const Key& k, size_type max_cache_size) +boost::shared_ptr<Object const> object_cache<Key, Object>::get(const Key& k, size_type l_max_cache_size) { #ifdef BOOST_HAS_THREADS static boost::static_mutex mut = BOOST_STATIC_MUTEX_INIT; @@ -66,7 +66,7 @@ boost::shared_ptr<Object const> object_cache<Key, Object>::get(const Key& k, siz boost::static_mutex::scoped_lock l(mut); if(l) { - return do_get(k, max_cache_size); + return do_get(k, l_max_cache_size); } // // what do we do if the lock fails? @@ -77,12 +77,12 @@ boost::shared_ptr<Object const> object_cache<Key, Object>::get(const Key& k, siz return boost::shared_ptr<Object>(); #endif #else - return do_get(k, max_cache_size); + return do_get(k, l_max_cache_size); #endif } template <class Key, class Object> -boost::shared_ptr<Object const> object_cache<Key, Object>::do_get(const Key& k, size_type max_cache_size) +boost::shared_ptr<Object const> object_cache<Key, Object>::do_get(const Key& k, size_type l_max_cache_size) { typedef typename object_cache<Key, Object>::data object_data; typedef typename map_type::size_type map_size_type; @@ -128,7 +128,7 @@ boost::shared_ptr<Object const> object_cache<Key, Object>::do_get(const Key& k, BOOST_ASSERT(s_data.index[k]->first.get() == result.get()); BOOST_ASSERT(&(s_data.index.find(k)->first) == s_data.cont.back().second); BOOST_ASSERT(s_data.index.find(k)->first == k); - if(s > max_cache_size) + if(s > l_max_cache_size) { // // We have too many items in the list, so we need to start @@ -137,7 +137,7 @@ boost::shared_ptr<Object const> object_cache<Key, Object>::do_get(const Key& k, // list_iterator pos = s_data.cont.begin(); list_iterator last = s_data.cont.end(); - while((pos != last) && (s > max_cache_size)) + while((pos != last) && (s > l_max_cache_size)) { if(pos->first.unique()) { diff --git a/3rdParty/Boost/src/boost/regex/pending/static_mutex.hpp b/3rdParty/Boost/src/boost/regex/pending/static_mutex.hpp index 334ef27..9c10050 100644 --- a/3rdParty/Boost/src/boost/regex/pending/static_mutex.hpp +++ b/3rdParty/Boost/src/boost/regex/pending/static_mutex.hpp @@ -96,8 +96,14 @@ 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; + operator void const*()const + { + return locked() ? this : 0; + } + bool locked()const + { + return m_have_lock; + } void lock(); void unlock(); private: @@ -107,16 +113,6 @@ private: scoped_static_mutex_lock& operator=(const scoped_static_mutex_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 #else diff --git a/3rdParty/Boost/src/boost/regex/v4/basic_regex.hpp b/3rdParty/Boost/src/boost/regex/v4/basic_regex.hpp index 09b0467..04c7bb3 100644 --- a/3rdParty/Boost/src/boost/regex/v4/basic_regex.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/basic_regex.hpp @@ -53,7 +53,7 @@ void bubble_down_one(I first, I last) if(first != last) { I next = last - 1; - while((next != first) && !(*(next-1) < *next)) + while((next != first) && (*next < *(next-1))) { (next-1)->swap(*next); --next; @@ -61,70 +61,59 @@ void bubble_down_one(I first, I last) } } -// -// Class named_subexpressions -// Contains information about named subexpressions within the regex. -// -template <class charT> -class named_subexpressions_base -{ -public: - virtual int get_id(const charT* i, const charT* j)const = 0; - virtual int get_id(std::size_t hash)const = 0; -#ifdef __GNUC__ - // warning supression: - virtual ~named_subexpressions_base(){} -#endif -}; - template <class Iterator> -inline std::size_t hash_value_from_capture_name(Iterator i, Iterator j) +inline int hash_value_from_capture_name(Iterator i, Iterator j) { std::size_t r = boost::hash_range(i, j); r %= ((std::numeric_limits<int>::max)() - 10001); r += 10000; - return r; + return static_cast<int>(r); } -template <class charT> -class named_subexpressions : public named_subexpressions_base<charT> +class named_subexpressions { +public: struct name { + template <class charT> name(const charT* i, const charT* j, int idx) - : /*n(i, j), */ index(idx) + : index(idx) { hash = hash_value_from_capture_name(i, j); } - name(std::size_t h, int idx) + name(int h, int idx) : index(idx), hash(h) { } - //std::vector<charT> n; int index; - std::size_t hash; + int hash; bool operator < (const name& other)const { - return hash < other.hash; //std::lexicographical_compare(n.begin(), n.end(), other.n.begin(), other.n.end()); + return hash < other.hash; } bool operator == (const name& other)const { - return hash == other.hash; //n == other.n; + return hash == other.hash; } void swap(name& other) { - //n.swap(other.n); std::swap(index, other.index); std::swap(hash, other.hash); } }; -public: + + typedef std::vector<name>::const_iterator const_iterator; + typedef std::pair<const_iterator, const_iterator> range_type; + named_subexpressions(){} + + template <class charT> void set_name(const charT* i, const charT* j, int index) { m_sub_names.push_back(name(i, j, index)); bubble_down_one(m_sub_names.begin(), m_sub_names.end()); } + template <class charT> int get_id(const charT* i, const charT* j)const { name t(i, j, 0); @@ -135,72 +124,37 @@ public: } return -1; } - int get_id(std::size_t h)const + template <class charT> + range_type equal_range(const charT* i, const charT* j)const + { + name t(i, j, 0); + return std::equal_range(m_sub_names.begin(), m_sub_names.end(), t); + } + int get_id(int h)const { name t(h, 0); - typename std::vector<name>::const_iterator pos = std::lower_bound(m_sub_names.begin(), m_sub_names.end(), t); + std::vector<name>::const_iterator pos = std::lower_bound(m_sub_names.begin(), m_sub_names.end(), t); if((pos != m_sub_names.end()) && (*pos == t)) { return pos->index; } return -1; } -private: - std::vector<name> m_sub_names; -}; - -template <class charT, class Other> -class named_subexpressions_converter : public named_subexpressions_base<charT> -{ - boost::shared_ptr<named_subexpressions<Other> > m_converter; -public: - named_subexpressions_converter(boost::shared_ptr<named_subexpressions<Other> > s) - : m_converter(s) {} - int get_id(const charT* i, const charT* j)const - { - if(i == j) - return -1; - std::vector<Other> v; - while(i != j) - { - v.push_back(*i); - ++i; - } - return m_converter->get_id(&v[0], &v[0] + v.size()); - } - int get_id(std::size_t h)const + range_type equal_range(int h)const { - return m_converter->get_id(h); + name t(h, 0); + return std::equal_range(m_sub_names.begin(), m_sub_names.end(), t); } +private: + std::vector<name> m_sub_names; }; -template <class To> -inline boost::shared_ptr<named_subexpressions_base<To> > convert_to_named_subs_imp( - boost::shared_ptr<named_subexpressions<To> > s, - boost::integral_constant<bool,true> const&) -{ - return s; -} -template <class To, class From> -inline boost::shared_ptr<named_subexpressions_base<To> > convert_to_named_subs_imp( - boost::shared_ptr<named_subexpressions<From> > s, - boost::integral_constant<bool,false> const&) -{ - return boost::shared_ptr<named_subexpressions_converter<To, From> >(new named_subexpressions_converter<To, From>(s)); -} -template <class To, class From> -inline boost::shared_ptr<named_subexpressions_base<To> > convert_to_named_subs( - boost::shared_ptr<named_subexpressions<From> > s) -{ - typedef typename boost::is_same<To, From>::type tag_type; - return convert_to_named_subs_imp<To>(s, tag_type()); -} // // class regex_data: // represents the data we wish to expose to the matching algorithms. // template <class charT, class traits> -struct regex_data : public named_subexpressions<charT> +struct regex_data : public named_subexpressions { typedef regex_constants::syntax_option_type flag_type; typedef std::size_t size_type; @@ -672,7 +626,7 @@ public: BOOST_ASSERT(0 != m_pimpl.get()); return m_pimpl->get_data(); } - boost::shared_ptr<re_detail::named_subexpressions<charT> > get_named_subs()const + boost::shared_ptr<re_detail::named_subexpressions > get_named_subs()const { return m_pimpl; } 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 883ecf1..efa9f7d 100644 --- a/3rdParty/Boost/src/boost/regex/v4/basic_regex_creator.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/basic_regex_creator.hpp @@ -769,14 +769,14 @@ void basic_regex_creator<charT, traits>::fixup_recursions(re_syntax_base* state) case syntax_element_assert_backref: { // just check that the index is valid: - int idVar = static_cast<const re_brace*>(state)->index; - if(idVar < 0) + int idx = static_cast<const re_brace*>(state)->index; + if(idx < 0) { - idVar = -idVar-1; - if(idVar >= 10000) + idx = -idx-1; + if(idx >= 10000) { - idVar = m_pdata->get_id(idVar); - if(idVar <= 0) + 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 @@ -804,12 +804,18 @@ void basic_regex_creator<charT, traits>::fixup_recursions(re_syntax_base* state) { bool ok = false; re_syntax_base* p = base; - int idVar = static_cast<re_jump*>(state)->alt.i; - if(idVar > 10000) - idVar = m_pdata->get_id(idVar); + std::ptrdiff_t idx = static_cast<re_jump*>(state)->alt.i; + if(idx > 10000) + { + // + // There may be more than one capture group with this hash, just do what Perl + // does and recurse to the leftmost: + // + idx = m_pdata->get_id(static_cast<int>(idx)); + } while(p) { - if((p->type == syntax_element_startmark) && (static_cast<re_brace*>(p)->index == idVar)) + if((p->type == syntax_element_startmark) && (static_cast<re_brace*>(p)->index == idx)) { // // We've found the target of the recursion, set the jump target: @@ -833,7 +839,7 @@ void basic_regex_creator<charT, traits>::fixup_recursions(re_syntax_base* state) next_rep_id = static_cast<re_repeat*>(p)->state_id; break; case syntax_element_endmark: - if(static_cast<const re_brace*>(p)->index == idVar) + if(static_cast<const re_brace*>(p)->index == idx) next_rep_id = -1; break; default: @@ -1039,6 +1045,14 @@ int basic_regex_creator<charT, traits>::calculate_backstep(re_syntax_base* state case syntax_element_jump: state = static_cast<re_jump*>(state)->alt.p; continue; + case syntax_element_alt: + { + int r1 = calculate_backstep(state->next.p); + int r2 = calculate_backstep(static_cast<re_alt*>(state)->alt.p); + if((r1 < 0) || (r1 != r2)) + return -1; + return result + r1; + } default: break; } @@ -1543,3 +1557,4 @@ void basic_regex_creator<charT, traits>::probe_leading_repeat(re_syntax_base* st #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 3ea4d64..4dacfc6 100644 --- a/3rdParty/Boost/src/boost/regex/v4/basic_regex_parser.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/basic_regex_parser.hpp @@ -820,7 +820,11 @@ escape_type_class_jump: return false; } // maybe have \g{ddd} - if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_open_brace) + regex_constants::syntax_type syn = this->m_traits.syntax_type(*m_position); + regex_constants::syntax_type syn_end = 0; + if((syn == regex_constants::syntax_open_brace) + || (syn == regex_constants::escape_type_left_word) + || (syn == regex_constants::escape_type_end_buffer)) { if(++m_position == m_end) { @@ -828,6 +832,18 @@ escape_type_class_jump: return false; } have_brace = true; + switch(syn) + { + case regex_constants::syntax_open_brace: + syn_end = regex_constants::syntax_close_brace; + break; + case regex_constants::escape_type_left_word: + syn_end = regex_constants::escape_type_right_word; + break; + default: + syn_end = regex_constants::escape_type_end_buffer; + break; + } } negative = (*m_position == static_cast<charT>('-')); if((negative) && (++m_position == m_end)) @@ -837,18 +853,20 @@ escape_type_class_jump: } const charT* pc = m_position; int i = this->m_traits.toi(pc, m_end, 10); - if(i < 0) + if((i < 0) && syn_end) { - // Check for a named capture: + // Check for a named capture, get the leftmost one if there is more than one: const charT* base = m_position; - while((m_position != m_end) && (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_brace)) + while((m_position != m_end) && (this->m_traits.syntax_type(*m_position) != syn_end)) + { ++m_position; - i = this->m_pdata->get_id(base, 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)))) + 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))); @@ -863,7 +881,7 @@ escape_type_class_jump: m_position = pc; if(have_brace) { - if((m_position == m_end) || (this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_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; @@ -1003,6 +1021,21 @@ bool basic_regex_parser<charT, traits>::parse_repeat(std::size_t low, std::size_ // if(pocessive) { + if(m_position != m_end) + { + // + // Check for illegal following quantifier, we have to do this here, because + // the extra states we insert below circumvents are usual error checking :-( + // + switch(this->m_traits.syntax_type(*m_position)) + { + case regex_constants::syntax_star: + case regex_constants::syntax_plus: + case regex_constants::syntax_question: + 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; @@ -1906,7 +1939,9 @@ bool basic_regex_parser<charT, traits>::parse_perl_extension() 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: @@ -2536,6 +2571,7 @@ option_group_jump: m_mark_count = m_max_mark; } m_mark_reset = mark_reset; + m_max_mark = max_mark; if(markid > 0) 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 bb40aa1..cd22bd8 100644 --- a/3rdParty/Boost/src/boost/regex/v4/cpp_regex_traits.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/cpp_regex_traits.hpp @@ -56,7 +56,7 @@ #ifdef BOOST_MSVC #pragma warning(push) -#pragma warning(disable:4786) +#pragma warning(disable:4786 4251) #endif namespace boost{ @@ -827,20 +827,20 @@ 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) && (m_pctype->is(std::ctype<charT>::space, c))) - || ((mask & ::boost::re_detail::char_class_print) && (m_pctype->is(std::ctype<charT>::print, c))) - || ((mask & ::boost::re_detail::char_class_cntrl) && (m_pctype->is(std::ctype<charT>::cntrl, c))) - || ((mask & ::boost::re_detail::char_class_upper) && (m_pctype->is(std::ctype<charT>::upper, c))) - || ((mask & ::boost::re_detail::char_class_lower) && (m_pctype->is(std::ctype<charT>::lower, c))) - || ((mask & ::boost::re_detail::char_class_alpha) && (m_pctype->is(std::ctype<charT>::alpha, c))) - || ((mask & ::boost::re_detail::char_class_digit) && (m_pctype->is(std::ctype<charT>::digit, c))) - || ((mask & ::boost::re_detail::char_class_punct) && (m_pctype->is(std::ctype<charT>::punct, c))) - || ((mask & ::boost::re_detail::char_class_xdigit) && (m_pctype->is(std::ctype<charT>::xdigit, c))) - || ((mask & ::boost::re_detail::char_class_blank) && (m_pctype->is(std::ctype<charT>::space, c)) && !::boost::re_detail::is_separator(c)) + ((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) && m_pctype->is(std::ctype<charT>::space, c) && !(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 diff --git a/3rdParty/Boost/src/boost/regex/v4/instances.hpp b/3rdParty/Boost/src/boost/regex/v4/instances.hpp index d12dc6b..c62d136 100644 --- a/3rdParty/Boost/src/boost/regex/v4/instances.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/instances.hpp @@ -118,10 +118,14 @@ template class BOOST_REGEX_TEMPLATE_DECL ::boost::re_detail::perl_matcher< std:: #undef BOOST_REGEX_TEMPLATE_DECL -#elif (defined(__GNUC__) && (__GNUC__ >= 3)) +#elif (defined(__GNUC__) && (__GNUC__ >= 3)) || !defined(BOOST_NO_EXTERN_TEMPLATE) # ifndef BOOST_REGEX_INSTANTIATE -# define template __extension__ extern template +# 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) diff --git a/3rdParty/Boost/src/boost/regex/v4/match_results.hpp b/3rdParty/Boost/src/boost/regex/v4/match_results.hpp index cd6b9eb..ca9898f 100644 --- a/3rdParty/Boost/src/boost/regex/v4/match_results.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/match_results.hpp @@ -38,7 +38,6 @@ namespace boost{ namespace re_detail{ -template <class charT> class named_subexpressions; } @@ -69,7 +68,7 @@ public: typedef typename re_detail::regex_iterator_traits< BidiIterator>::value_type char_type; typedef std::basic_string<char_type> string_type; - typedef re_detail::named_subexpressions_base<char_type> named_sub_type; + typedef re_detail::named_subexpressions named_sub_type; // construct/copy/destroy: explicit match_results(const Allocator& a = Allocator()) @@ -225,10 +224,15 @@ public: // const_reference named_subexpression(const char_type* i, const char_type* j) const { + // + // Scan for the leftmost *matched* subexpression with the specified named: + // if(m_is_singular) raise_logic_error(); - int index = m_named_subs->get_id(i, j); - return index > 0 ? (*this)[index] : m_null; + re_detail::named_subexpressions::range_type r = m_named_subs->equal_range(i, j); + while((r.first != r.second) && ((*this)[r.first->index].matched == false)) + ++r.first; + return r.first != r.second ? (*this)[r.first->index] : m_null; } template <class charT> const_reference named_subexpression(const charT* i, const charT* j) const @@ -243,10 +247,20 @@ public: } int named_subexpression_index(const char_type* i, const char_type* j) const { + // + // Scan for the leftmost *matched* subexpression with the specified named. + // If none found then return the leftmost expression with that name, + // otherwise an invalid index: + // if(m_is_singular) raise_logic_error(); - int index = m_named_subs->get_id(i, j); - return index > 0 ? index : -20; + re_detail::named_subexpressions::range_type s, r; + s = r = m_named_subs->equal_range(i, j); + while((r.first != r.second) && ((*this)[r.first->index].matched == false)) + ++r.first; + if(r.first == r.second) + r = s; + return r.first != r.second ? r.first->index : -20; } template <class charT> int named_subexpression_index(const charT* i, const charT* j) const @@ -393,7 +407,6 @@ public: std::swap(m_subs, that.m_subs); std::swap(m_named_subs, that.m_named_subs); std::swap(m_last_closed_paren, that.m_last_closed_paren); - std::swap(m_is_singular, that.m_is_singular); if(m_is_singular) { if(!that.m_is_singular) @@ -412,6 +425,7 @@ public: std::swap(m_base, that.m_base); std::swap(m_null, that.m_null); } + std::swap(m_is_singular, that.m_is_singular); } bool operator==(const match_results& that)const { @@ -457,7 +471,7 @@ public: void BOOST_REGEX_CALL set_second(BidiIterator i, size_type pos, bool m = true, bool escape_k = false) { if(pos) - m_last_closed_paren = pos; + m_last_closed_paren = static_cast<int>(pos); pos += 2; BOOST_ASSERT(m_subs.size() > pos); m_subs[pos].second = i; diff --git a/3rdParty/Boost/src/boost/regex/v4/perl_matcher.hpp b/3rdParty/Boost/src/boost/regex/v4/perl_matcher.hpp index 52e0bce..52cc55c 100644 --- a/3rdParty/Boost/src/boost/regex/v4/perl_matcher.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/perl_matcher.hpp @@ -336,7 +336,7 @@ struct recursion_info { typedef typename Results::value_type value_type; typedef typename value_type::iterator iterator; - int id; + int idx; const re_syntax_base* preturn_address; Results results; repeater_count<iterator>* repeater_stack; @@ -366,7 +366,7 @@ public: BidiIterator l_base) : m_result(what), base(first), last(end), position(first), backstop(l_base), re(e), traits_inst(e.get_traits()), - m_independent(false), next_count(&rep_obj), rep_obj(&next_count), recursion_stack_position(0) + m_independent(false), next_count(&rep_obj), rep_obj(&next_count) { construct_init(e, f); } @@ -468,9 +468,9 @@ private: // matching flags in use: match_flag_type m_match_flags; // how many states we have examined so far: - boost::uintmax_t state_count; + std::ptrdiff_t state_count; // max number of states to examine before giving up: - boost::uintmax_t max_state_count; + std::ptrdiff_t max_state_count; // whether we should ignore case or not: bool icase; // set to true when (position == last), indicates that we may have a partial match: @@ -488,8 +488,7 @@ private: // the bitmask to use when determining whether a match_any matches a newline or not: unsigned char match_any_mask; // recursion information: - recursion_info<results_type> recursion_stack[50]; - unsigned recursion_stack_position; + std::vector<recursion_info<results_type> > recursion_stack; #ifdef BOOST_REGEX_NON_RECURSIVE // @@ -523,7 +522,7 @@ private: void push_repeater_count(int i, repeater_count<BidiIterator>** s); void push_single_repeat(std::size_t c, const re_repeat* r, BidiIterator last_position, int state_id); void push_non_greedy_repeat(const re_syntax_base* ps); - void push_recursion(int id, const re_syntax_base* p, results_type* presults); + void push_recursion(int idx, const re_syntax_base* p, results_type* presults); void push_recursion_pop(); // pointer to base of stack: 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 5da53c5..b8c4e96 100644 --- a/3rdParty/Boost/src/boost/regex/v4/perl_matcher_common.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/perl_matcher_common.hpp @@ -98,23 +98,23 @@ void perl_matcher<BidiIterator, Allocator, traits>::estimate_max_state_count(std // // Calculate NS^2 first: // - static const boost::uintmax_t k = 100000; - boost::uintmax_t dist = boost::re_detail::distance(base, last); + static const std::ptrdiff_t k = 100000; + std::ptrdiff_t dist = boost::re_detail::distance(base, last); if(dist == 0) dist = 1; - boost::uintmax_t states = re.size(); + std::ptrdiff_t states = re.size(); if(states == 0) states = 1; states *= states; - if((std::numeric_limits<boost::uintmax_t>::max)() / dist < states) + if((std::numeric_limits<std::ptrdiff_t>::max)() / dist < states) { - max_state_count = (std::numeric_limits<boost::uintmax_t>::max)() - 2; + max_state_count = (std::min)((std::ptrdiff_t)BOOST_REGEX_MAX_STATE_COUNT, (std::numeric_limits<std::ptrdiff_t>::max)() - 2); return; } states *= dist; - if((std::numeric_limits<boost::uintmax_t>::max)() - k < states) + if((std::numeric_limits<std::ptrdiff_t>::max)() - k < states) { - max_state_count = (std::numeric_limits<boost::uintmax_t>::max)() - 2; + max_state_count = (std::min)((std::ptrdiff_t)BOOST_REGEX_MAX_STATE_COUNT, (std::numeric_limits<std::ptrdiff_t>::max)() - 2); return; } states += k; @@ -125,15 +125,15 @@ void perl_matcher<BidiIterator, Allocator, traits>::estimate_max_state_count(std // Now calculate N^2: // states = dist; - if((std::numeric_limits<boost::uintmax_t>::max)() / dist < states) + if((std::numeric_limits<std::ptrdiff_t>::max)() / dist < states) { - max_state_count = (std::numeric_limits<boost::uintmax_t>::max)() - 2; + max_state_count = (std::min)((std::ptrdiff_t)BOOST_REGEX_MAX_STATE_COUNT, (std::numeric_limits<std::ptrdiff_t>::max)() - 2); return; } states *= dist; - if((std::numeric_limits<boost::uintmax_t>::max)() - k < states) + if((std::numeric_limits<std::ptrdiff_t>::max)() - k < states) { - max_state_count = (std::numeric_limits<boost::uintmax_t>::max)() - 2; + max_state_count = (std::min)((std::ptrdiff_t)BOOST_REGEX_MAX_STATE_COUNT, (std::numeric_limits<std::ptrdiff_t>::max)() - 2); return; } states += k; @@ -200,7 +200,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_imp() 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_base(base); - m_presult->set_named_subs(re_detail::convert_to_named_subs<typename match_results<BidiIterator>::char_type>(this->re.get_named_subs())); + 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); @@ -262,7 +262,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::find_imp() pstate = re.get_first_state(); m_presult->set_size((m_match_flags & match_nosubs) ? 1 : re.mark_count(), base, last); m_presult->set_base(base); - m_presult->set_named_subs(re_detail::convert_to_named_subs<typename match_results<BidiIterator>::char_type>(this->re.get_named_subs())); + m_presult->set_named_subs(this->re.get_named_subs()); m_match_flags |= regex_constants::match_init; } else @@ -588,8 +588,23 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_backref() // in the match, this is in line with ECMAScript, but not Perl // or PCRE. // - BidiIterator i = (*m_presult)[static_cast<const re_brace*>(pstate)->index].first; - BidiIterator j = (*m_presult)[static_cast<const re_brace*>(pstate)->index].second; + int index = static_cast<const re_brace*>(pstate)->index; + if(index >= 10000) + { + named_subexpressions::range_type r = re.get_data().equal_range(index); + BOOST_ASSERT(r.first != r.second); + do + { + index = r.first->index; + ++r.first; + }while((r.first != r.second) && ((*m_presult)[index].matched != true)); + } + + if((m_match_flags & match_perl) && !(*m_presult)[index].matched) + return false; + + BidiIterator i = (*m_presult)[index].first; + BidiIterator j = (*m_presult)[index].second; while(i != j) { if((position == last) || (traits_inst.translate(*position, icase) != traits_inst.translate(*i, icase))) @@ -713,7 +728,7 @@ inline bool perl_matcher<BidiIterator, Allocator, traits>::match_assert_backref( { // return true if marked sub-expression N has been matched: int index = static_cast<const re_brace*>(pstate)->index; - bool result; + bool result = false; if(index == 9999) { // Magic value for a (DEFINE) block: @@ -721,21 +736,47 @@ inline bool perl_matcher<BidiIterator, Allocator, traits>::match_assert_backref( } else if(index > 0) { + // Have we matched subexpression "index"? // Check if index is a hash value: if(index >= 10000) - index = re.get_data().get_id(index); - // Have we matched subexpression "index"? - result = (*m_presult)[index].matched; + { + named_subexpressions::range_type r = re.get_data().equal_range(index); + while(r.first != r.second) + { + if((*m_presult)[r.first->index].matched) + { + result = true; + break; + } + ++r.first; + } + } + else + { + result = (*m_presult)[index].matched; + } pstate = pstate->next.p; } else { // Have we recursed into subexpression "index"? // If index == 0 then check for any recursion at all, otherwise for recursion to -index-1. - int idVar = -index-1; - if(idVar >= 10000) - idVar = re.get_data().get_id(idVar); - result = recursion_stack_position && ((recursion_stack[recursion_stack_position-1].id == idVar) || (index == 0)); + int idx = -index-1; + if(idx >= 10000) + { + named_subexpressions::range_type r = re.get_data().equal_range(idx); + int stack_index = recursion_stack.empty() ? -1 : recursion_stack.back().idx; + while(r.first != r.second) + { + result |= (stack_index == r.first->index); + if(result)break; + ++r.first; + } + } + else + { + result = !recursion_stack.empty() && ((recursion_stack.back().idx == idx) || (index == 0)); + } pstate = pstate->next.p; } return result; 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 0fcd454..7ab6781 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 @@ -130,8 +130,8 @@ struct saved_single_repeat : public saved_state template <class Results> struct saved_recursion : public saved_state { - saved_recursion(int id, const re_syntax_base* p, Results* pr) - : saved_state(14), recursion_id(id), preturn_address(p), results(*pr) + saved_recursion(int idx, const re_syntax_base* p, Results* pr) + : saved_state(14), recursion_id(idx), preturn_address(p), results(*pr) {} int recursion_id; const re_syntax_base* preturn_address; @@ -329,7 +329,7 @@ inline void perl_matcher<BidiIterator, Allocator, traits>::push_single_repeat(st } template <class BidiIterator, class Allocator, class traits> -inline void perl_matcher<BidiIterator, Allocator, traits>::push_recursion(int id, const re_syntax_base* p, results_type* presults) +inline void perl_matcher<BidiIterator, Allocator, traits>::push_recursion(int idx, const re_syntax_base* p, results_type* presults) { saved_recursion<results_type>* pmp = static_cast<saved_recursion<results_type>*>(m_backup_state); --pmp; @@ -339,7 +339,7 @@ inline void perl_matcher<BidiIterator, Allocator, traits>::push_recursion(int id pmp = static_cast<saved_recursion<results_type>*>(m_backup_state); --pmp; } - (void) new (pmp)saved_recursion<results_type>(id, p, presults); + (void) new (pmp)saved_recursion<results_type>(idx, p, presults); m_backup_state = pmp; } @@ -898,20 +898,19 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_recursion() // // Set new call stack: // - if(recursion_stack_position >= static_cast<int>(sizeof(recursion_stack)/sizeof(recursion_stack[0]))) + if(recursion_stack.capacity() == 0) { - return false; + recursion_stack.reserve(50); } - recursion_stack[recursion_stack_position].preturn_address = pstate->next.p; - recursion_stack[recursion_stack_position].results = *m_presult; + recursion_stack.push_back(recursion_info<results_type>()); + recursion_stack.back().preturn_address = pstate->next.p; + recursion_stack.back().results = *m_presult; if(static_cast<const re_recurse*>(pstate)->state_id > 0) { push_repeater_count(static_cast<const re_recurse*>(pstate)->state_id, &next_count); } pstate = static_cast<const re_jump*>(pstate)->alt.p; - recursion_stack[recursion_stack_position].id = static_cast<const re_brace*>(pstate)->index; - ++recursion_stack_position; - //BOOST_ASSERT(recursion_stack[recursion_stack_position-1].id); + recursion_stack.back().idx = static_cast<const re_brace*>(pstate)->index; return true; } @@ -927,14 +926,14 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_endmark() { m_presult->set_second(position, index); } - if(recursion_stack_position) + if(!recursion_stack.empty()) { - if(index == recursion_stack[recursion_stack_position-1].id) + if(index == recursion_stack.back().idx) { - --recursion_stack_position; - pstate = recursion_stack[recursion_stack_position].preturn_address; - *m_presult = recursion_stack[recursion_stack_position].results; - push_recursion(recursion_stack[recursion_stack_position].id, recursion_stack[recursion_stack_position].preturn_address, &recursion_stack[recursion_stack_position].results); + pstate = recursion_stack.back().preturn_address; + *m_presult = recursion_stack.back().results; + push_recursion(recursion_stack.back().idx, recursion_stack.back().preturn_address, &recursion_stack.back().results); + recursion_stack.pop_back(); } } } @@ -951,13 +950,13 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_endmark() template <class BidiIterator, class Allocator, class traits> bool perl_matcher<BidiIterator, Allocator, traits>::match_match() { - if(recursion_stack_position) + if(!recursion_stack.empty()) { - BOOST_ASSERT(0 == recursion_stack[recursion_stack_position-1].id); - --recursion_stack_position; - pstate = recursion_stack[recursion_stack_position].preturn_address; - *m_presult = recursion_stack[recursion_stack_position].results; - push_recursion(recursion_stack[recursion_stack_position].id, recursion_stack[recursion_stack_position].preturn_address, &recursion_stack[recursion_stack_position].results); + BOOST_ASSERT(0 == recursion_stack.back().idx); + pstate = recursion_stack.back().preturn_address; + *m_presult = recursion_stack.back().results; + push_recursion(recursion_stack.back().idx, recursion_stack.back().preturn_address, &recursion_stack.back().results); + recursion_stack.pop_back(); return true; } if((m_match_flags & match_not_null) && (position == (*m_presult)[0].first)) @@ -1523,10 +1522,10 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_recursion(bool r) saved_recursion<results_type>* pmp = static_cast<saved_recursion<results_type>*>(m_backup_state); if(!r) { - recursion_stack[recursion_stack_position].id = pmp->recursion_id; - recursion_stack[recursion_stack_position].preturn_address = pmp->preturn_address; - recursion_stack[recursion_stack_position].results = pmp->results; - ++recursion_stack_position; + recursion_stack.push_back(recursion_info<results_type>()); + recursion_stack.back().idx = pmp->recursion_id; + recursion_stack.back().preturn_address = pmp->preturn_address; + recursion_stack.back().results = pmp->results; } boost::re_detail::inplace_destroy(pmp++); m_backup_state = pmp; @@ -1539,7 +1538,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_recursion_pop(bool r) saved_state* pmp = static_cast<saved_state*>(m_backup_state); if(!r) { - --recursion_stack_position; + recursion_stack.pop_back(); } boost::re_detail::inplace_destroy(pmp++); m_backup_state = pmp; 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 d0de802..07a1c20 100644 --- a/3rdParty/Boost/src/boost/regex/v4/perl_matcher_recursive.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/perl_matcher_recursive.hpp @@ -200,11 +200,11 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_startmark() BidiIterator saved_position = position; const re_syntax_base* next_pstate = static_cast<const re_jump*>(pstate->next.p)->alt.p->next.p; pstate = pstate->next.p->next.p; - bool r = match_all_states(); + bool res = match_all_states(); position = saved_position; if(negated) - r = !r; - if(r) + res = !res; + if(res) pstate = next_pstate; else pstate = alt->alt.p; @@ -857,16 +857,16 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_recursion() // // Set new call stack: // - if(recursion_stack_position >= static_cast<int>(sizeof(recursion_stack)/sizeof(recursion_stack[0]))) + if(recursion_stack.capacity() == 0) { - return false; + recursion_stack.reserve(50); } - recursion_stack[recursion_stack_position].preturn_address = pstate->next.p; - recursion_stack[recursion_stack_position].results = *m_presult; - recursion_stack[recursion_stack_position].repeater_stack = next_count; + recursion_stack.push_back(recursion_info<results_type>()); + recursion_stack.back().preturn_address = pstate->next.p; + recursion_stack.back().results = *m_presult; + recursion_stack.back().repeater_stack = next_count; pstate = static_cast<const re_jump*>(pstate)->alt.p; - recursion_stack[recursion_stack_position].id = static_cast<const re_brace*>(pstate)->index; - ++recursion_stack_position; + recursion_stack.back().idx = static_cast<const re_brace*>(pstate)->index; repeater_count<BidiIterator>* saved = next_count; repeater_count<BidiIterator> r(&next_count); // resets all repeat counts since we're recursing and starting fresh on those @@ -876,9 +876,9 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_recursion() if(!result) { - --recursion_stack_position; - next_count = recursion_stack[recursion_stack_position].repeater_stack; - *m_presult = recursion_stack[recursion_stack_position].results; + next_count = recursion_stack.back().repeater_stack; + *m_presult = recursion_stack.back().results; + recursion_stack.pop_back(); return false; } return true; @@ -895,20 +895,19 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_endmark() { m_presult->set_second(position, index); } - if(recursion_stack_position) + if(!recursion_stack.empty()) { - if(index == recursion_stack[recursion_stack_position-1].id) + if(index == recursion_stack.back().idx) { - --recursion_stack_position; - recursion_info<results_type> saved = recursion_stack[recursion_stack_position]; - const re_syntax_base* saved_state = pstate = saved.preturn_address; + recursion_info<results_type> saved = recursion_stack.back(); + recursion_stack.pop_back(); + pstate = saved.preturn_address; repeater_count<BidiIterator>* saved_count = next_count; next_count = saved.repeater_stack; *m_presult = saved.results; if(!match_all_states()) { - recursion_stack[recursion_stack_position] = saved; - ++recursion_stack_position; + recursion_stack.push_back(saved); next_count = saved_count; return false; } @@ -928,17 +927,17 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_endmark() template <class BidiIterator, class Allocator, class traits> bool perl_matcher<BidiIterator, Allocator, traits>::match_match() { - if(recursion_stack_position) + if(!recursion_stack.empty()) { - BOOST_ASSERT(0 == recursion_stack[recursion_stack_position-1].id); - --recursion_stack_position; - const re_syntax_base* saved_state = pstate = recursion_stack[recursion_stack_position].preturn_address; - *m_presult = recursion_stack[recursion_stack_position].results; + BOOST_ASSERT(0 == recursion_stack.back().idx); + const re_syntax_base* saved_state = pstate = recursion_stack.back().preturn_address; + *m_presult = recursion_stack.back().results; + recursion_stack.pop_back(); if(!match_all_states()) { - recursion_stack[recursion_stack_position].preturn_address = saved_state; - recursion_stack[recursion_stack_position].results = *m_presult; - ++recursion_stack_position; + recursion_stack.push_back(recursion_info<results_type>()); + recursion_stack.back().preturn_address = saved_state; + recursion_stack.back().results = *m_presult; return false; } return true; diff --git a/3rdParty/Boost/src/boost/regex/v4/regex_format.hpp b/3rdParty/Boost/src/boost/regex/v4/regex_format.hpp index 0ca9baa..4406839 100644 --- a/3rdParty/Boost/src/boost/regex/v4/regex_format.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/regex_format.hpp @@ -34,6 +34,7 @@ #ifndef BOOST_NO_SFINAE #include <boost/mpl/has_xxx.hpp> #endif +#include <boost/ref.hpp> namespace boost{ @@ -152,6 +153,11 @@ private: typedef typename boost::is_convertible<ForwardIter, const char_type*>::type tag_type; return get_named_sub_index(i, j, tag_type()); } +#ifdef BOOST_MSVC + // msvc-8.0 issues a spurious warning on the call to std::advance here: +#pragma warning(push) +#pragma warning(disable:4244) +#endif inline int toi(ForwardIter& i, ForwardIter j, int base, const boost::mpl::false_&) { if(i != j) @@ -165,6 +171,9 @@ private: } return -1; } +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif inline int toi(ForwardIter& i, ForwardIter j, int base, const boost::mpl::true_&) { return m_traits.toi(i, j, base); @@ -334,7 +343,7 @@ void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format m_position = --base; } } - put((this->m_results)[this->m_results.size() > 1 ? this->m_results.size() - 1 : 1]); + put((this->m_results)[this->m_results.size() > 1 ? static_cast<int>(this->m_results.size() - 1) : 1]); break; case '{': have_brace = true; @@ -384,7 +393,7 @@ bool basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::handle if(have_brace && (*m_position == '^')) ++m_position; - int max_len = m_end - m_position; + std::ptrdiff_t max_len = m_end - m_position; if((max_len >= 5) && std::equal(m_position, m_position + 5, MATCH)) { @@ -447,7 +456,7 @@ bool basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::handle return false; } } - put((this->m_results)[this->m_results.size() > 1 ? this->m_results.size() - 1 : 1]); + put((this->m_results)[this->m_results.size() > 1 ? static_cast<int>(this->m_results.size() - 1) : 1]); return true; } if((max_len >= 20) && std::equal(m_position, m_position + 20, LAST_SUBMATCH_RESULT)) @@ -895,7 +904,7 @@ private: // F must be a pointer, a function, or a class with a function call operator: // BOOST_STATIC_ASSERT((::boost::is_pointer<F>::value || ::boost::is_function<F>::value || ::boost::is_class<F>::value)); - static formatter_wrapper<F> f; + static formatter_wrapper<typename unwrap_reference<F>::type> f; static M m; static O out; static boost::regex_constants::match_flag_type flags; @@ -963,7 +972,7 @@ struct format_functor3 template <class OutputIter> OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type f) { - return func(m, i, f); + return boost::unwrap_ref(func)(m, i, f); } template <class OutputIter, class Traits> OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type f, const Traits&) @@ -983,7 +992,7 @@ struct format_functor2 template <class OutputIter> OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type /*f*/) { - return func(m, i); + return 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&) @@ -1020,7 +1029,7 @@ struct format_functor1 template <class OutputIter> OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type /*f*/) { - return do_format_string(func(m), i); + 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&) diff --git a/3rdParty/Boost/src/boost/regex/v4/regex_workaround.hpp b/3rdParty/Boost/src/boost/regex/v4/regex_workaround.hpp index 06527f1..46a8a8d 100644 --- a/3rdParty/Boost/src/boost/regex/v4/regex_workaround.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/regex_workaround.hpp @@ -149,7 +149,37 @@ namespace boost{ namespace re_detail{ { return stdext::unchecked_equal(first, last, with); } - +#elif BOOST_WORKAROUND(BOOST_MSVC, > 1500) + // + // MSVC 10 will either emit warnings or else refuse to compile + // code that makes perfectly legitimate use of std::copy, when + // the OutputIterator type is a user-defined class (apparently all user + // defined iterators are "unsafe"). What's more Microsoft have removed their + // non-standard "unchecked" versions, even though their still in the MS + // documentation!! Work around this as best we can: + // + template<class InputIterator, class OutputIterator> + inline OutputIterator copy( + InputIterator first, + InputIterator last, + OutputIterator dest + ) + { + while(first != last) + *dest++ = *first++; + return dest; + } + template<class InputIterator1, class InputIterator2> + inline bool equal( + InputIterator1 first, + InputIterator1 last, + InputIterator2 with + ) + { + while(first != last) + if(*first++ != *with++) return false; + return true; + } #else using std::copy; using std::equal; diff --git a/3rdParty/Boost/src/boost/regex/v4/sub_match.hpp b/3rdParty/Boost/src/boost/regex/v4/sub_match.hpp index 1c79e39..34a8684 100644 --- a/3rdParty/Boost/src/boost/regex/v4/sub_match.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/sub_match.hpp @@ -56,7 +56,7 @@ struct sub_match : public std::pair<BidiIterator, BidiIterator> template <class T, class A> operator std::basic_string<value_type, T, A> ()const { - return std::basic_string<value_type, T, A>(this->first, this->second); + 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 @@ -66,19 +66,22 @@ struct sub_match : public std::pair<BidiIterator, BidiIterator> #endif difference_type BOOST_REGEX_CALL length()const { - difference_type n = ::boost::re_detail::distance((BidiIterator)this->first, (BidiIterator)this->second); + 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; - 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) + if(matched) { - result.append(1, *i); - ++i; + 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; } 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 c47a219..4b0ac92 100644 --- a/3rdParty/Boost/src/boost/regex/v4/u32regex_token_iterator.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/u32regex_token_iterator.hpp @@ -292,7 +292,7 @@ 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, m); + 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) { @@ -361,7 +361,7 @@ inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const return u32regex_token_iterator<const UChar*>(s.getBuffer(), s.getBuffer() + s.length(), e, submatch, m); } -#if BOOST_WORKAROUND(BOOST_MSVC, == 1310) +#if BOOST_WORKAROUND(BOOST_MSVC, > 1300) # pragma warning(pop) #endif #ifdef BOOST_HAS_ABI_HEADERS |