updated boost on windows
This commit is contained in:
@@ -36,10 +36,16 @@
|
||||
namespace boost{
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4251 4231 4800)
|
||||
#pragma warning(disable : 4251)
|
||||
#if BOOST_MSVC < 1700
|
||||
# pragma warning(disable : 4231)
|
||||
#endif
|
||||
#if BOOST_MSVC < 1600
|
||||
#pragma warning(disable : 4660)
|
||||
#endif
|
||||
#if BOOST_MSVC < 1910
|
||||
#pragma warning(disable:4800)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace BOOST_REGEX_DETAIL_NS{
|
||||
|
||||
@@ -33,7 +33,9 @@
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable: 4800)
|
||||
#if BOOST_MSVC < 1910
|
||||
#pragma warning(disable:4800)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
@@ -43,8 +45,8 @@ namespace BOOST_REGEX_DETAIL_NS{
|
||||
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() : std::pair<charT, charT>(charT(0), charT(0)){}
|
||||
digraph(charT c1) : std::pair<charT, charT>(c1, charT(0)){}
|
||||
digraph(charT c1, charT c2) : std::pair<charT, charT>(c1, c2)
|
||||
{}
|
||||
digraph(const digraph<charT>& d) : std::pair<charT, charT>(d.first, d.second){}
|
||||
|
||||
@@ -35,7 +35,10 @@ namespace BOOST_REGEX_DETAIL_NS{
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4244 4800)
|
||||
#pragma warning(disable:4244)
|
||||
#if BOOST_MSVC < 1910
|
||||
#pragma warning(disable:4800)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
inline boost::intmax_t umax(mpl::false_ const&)
|
||||
@@ -105,6 +108,7 @@ private:
|
||||
std::ptrdiff_t m_paren_start; // where the last seen ')' began (where repeats are inserted).
|
||||
std::ptrdiff_t m_alt_insert_point; // where to insert the next alternative
|
||||
bool m_has_case_change; // true if somewhere in the current block the case has changed
|
||||
unsigned m_recursion_count; // How many times we've called parse_all.
|
||||
#if defined(BOOST_MSVC) && defined(_M_IX86)
|
||||
// This is an ugly warning suppression workaround (for warnings *inside* std::vector
|
||||
// that can not otherwise be suppressed)...
|
||||
@@ -120,7 +124,7 @@ private:
|
||||
|
||||
template <class charT, class traits>
|
||||
basic_regex_parser<charT, traits>::basic_regex_parser(regex_data<charT, traits>* data)
|
||||
: basic_regex_creator<charT, traits>(data), m_mark_count(0), m_mark_reset(-1), m_max_mark(0), m_paren_start(0), m_alt_insert_point(0), m_has_case_change(false)
|
||||
: basic_regex_creator<charT, traits>(data), m_mark_count(0), m_mark_reset(-1), m_max_mark(0), m_paren_start(0), m_alt_insert_point(0), m_has_case_change(false), m_recursion_count(0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -182,7 +186,7 @@ void basic_regex_parser<charT, traits>::parse(const charT* p1, const charT* p2,
|
||||
// have had an unexpected ')' :
|
||||
if(!result)
|
||||
{
|
||||
fail(regex_constants::error_paren, ::boost::BOOST_REGEX_DETAIL_NS::distance(m_base, m_position), "Found a closing ) with no corresponding openening parenthesis.");
|
||||
fail(regex_constants::error_paren, ::boost::BOOST_REGEX_DETAIL_NS::distance(m_base, m_position), "Found a closing ) with no corresponding opening parenthesis.");
|
||||
return;
|
||||
}
|
||||
// if an error has been set then give up now:
|
||||
@@ -245,11 +249,17 @@ void basic_regex_parser<charT, traits>::fail(regex_constants::error_type error_c
|
||||
template <class charT, class traits>
|
||||
bool basic_regex_parser<charT, traits>::parse_all()
|
||||
{
|
||||
if (++m_recursion_count > 400)
|
||||
{
|
||||
// exceeded internal limits
|
||||
fail(boost::regex_constants::error_complexity, m_position - m_base, "Exceeded nested brace limit.");
|
||||
}
|
||||
bool result = true;
|
||||
while(result && (m_position != m_end))
|
||||
{
|
||||
result = (this->*m_parser_proc)();
|
||||
}
|
||||
--m_recursion_count;
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -971,7 +981,13 @@ bool basic_regex_parser<charT, traits>::parse_repeat(std::size_t low, std::size_
|
||||
)
|
||||
{
|
||||
// OK we have a perl or emacs regex, check for a '?':
|
||||
if(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_question)
|
||||
if ((this->flags() & (regbase::main_option_type | regbase::mod_x | regbase::no_perl_ex)) == regbase::mod_x)
|
||||
{
|
||||
// whitespace skip:
|
||||
while ((m_position != m_end) && this->m_traits.isctype(*m_position, this->m_mask_space))
|
||||
++m_position;
|
||||
}
|
||||
if((m_position != m_end) && (this->m_traits.syntax_type(*m_position) == regex_constants::syntax_question))
|
||||
{
|
||||
greedy = false;
|
||||
++m_position;
|
||||
@@ -1064,15 +1080,42 @@ bool basic_regex_parser<charT, traits>::parse_repeat(std::size_t low, std::size_
|
||||
// Check for illegal following quantifier, we have to do this here, because
|
||||
// the extra states we insert below circumvents our usual error checking :-(
|
||||
//
|
||||
switch(this->m_traits.syntax_type(*m_position))
|
||||
bool contin = false;
|
||||
do
|
||||
{
|
||||
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;
|
||||
}
|
||||
if ((this->flags() & (regbase::main_option_type | regbase::mod_x | regbase::no_perl_ex)) == regbase::mod_x)
|
||||
{
|
||||
// whitespace skip:
|
||||
while ((m_position != m_end) && this->m_traits.isctype(*m_position, this->m_mask_space))
|
||||
++m_position;
|
||||
}
|
||||
if (m_position != m_end)
|
||||
{
|
||||
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;
|
||||
case regex_constants::syntax_open_mark:
|
||||
// Do we have a comment? If so we need to skip it here...
|
||||
if ((m_position + 2 < m_end) && this->m_traits.syntax_type(*(m_position + 1)) == regex_constants::syntax_question
|
||||
&& this->m_traits.syntax_type(*(m_position + 2)) == regex_constants::syntax_hash)
|
||||
{
|
||||
while ((m_position != m_end)
|
||||
&& (this->m_traits.syntax_type(*m_position++) != regex_constants::syntax_close_mark)) {
|
||||
}
|
||||
contin = true;
|
||||
}
|
||||
else
|
||||
contin = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
contin = false;
|
||||
} while (contin);
|
||||
}
|
||||
re_brace* pb = static_cast<re_brace*>(this->insert_state(insert_point, syntax_element_startmark, sizeof(re_brace)));
|
||||
pb->index = -3;
|
||||
@@ -1991,7 +2034,7 @@ 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;
|
||||
}
|
||||
//
|
||||
@@ -2070,6 +2113,11 @@ insert_recursion:
|
||||
fail(regex_constants::error_perl_extension, m_position - m_base, "An invalid or unterminated recursive sub-expression.");
|
||||
return false;
|
||||
}
|
||||
if ((std::numeric_limits<boost::intmax_t>::max)() - m_mark_count < v)
|
||||
{
|
||||
fail(regex_constants::error_perl_extension, m_position - m_base, "An invalid or unterminated recursive sub-expression.");
|
||||
return false;
|
||||
}
|
||||
v += m_mark_count;
|
||||
goto insert_recursion;
|
||||
case regex_constants::syntax_dash:
|
||||
|
||||
@@ -195,9 +195,6 @@ public:
|
||||
};
|
||||
|
||||
class BOOST_REGEX_DECL mapfile_iterator
|
||||
#if !defined(BOOST_NO_STD_ITERATOR) || defined(BOOST_MSVC_STD_ITERATOR)
|
||||
: public std::iterator<std::random_access_iterator_tag, char>
|
||||
#endif
|
||||
{
|
||||
typedef mapfile::pointer internal_pointer;
|
||||
internal_pointer* node;
|
||||
|
||||
@@ -84,7 +84,10 @@ template class BOOST_REGEX_DECL ::boost::BOOST_REGEX_DETAIL_NS::perl_matcher<BOO
|
||||
|
||||
# ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4251 4231)
|
||||
# pragma warning(disable : 4251)
|
||||
#if BOOST_MSVC < 1700
|
||||
# pragma warning(disable : 4231)
|
||||
#endif
|
||||
# if BOOST_MSVC < 1600
|
||||
# pragma warning(disable : 4660)
|
||||
# endif
|
||||
@@ -119,9 +122,17 @@ template class BOOST_REGEX_TEMPLATE_DECL ::boost::BOOST_REGEX_DETAIL_NS::perl_ma
|
||||
|
||||
#elif (defined(__GNUC__) && (__GNUC__ >= 3)) || !defined(BOOST_NO_CXX11_EXTERN_TEMPLATE)
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wkeyword-macro"
|
||||
#if defined(__clang__)
|
||||
# pragma clang diagnostic push
|
||||
# if defined(__APPLE_CC__)
|
||||
# if (__clang_major__ > 6)
|
||||
# pragma clang diagnostic ignored "-Wkeyword-macro"
|
||||
# endif
|
||||
# else
|
||||
# if (__clang_major__ > 3) || ((__clang_major__ == 3) && (__clang_minor__ > 5))
|
||||
# pragma clang diagnostic ignored "-Wkeyword-macro"
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
# ifndef BOOST_REGEX_INSTANTIATE
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#ifdef __cplusplus
|
||||
# include <boost/cstdint.hpp>
|
||||
#endif
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace boost{
|
||||
@@ -83,7 +82,7 @@ typedef enum _match_flags
|
||||
|
||||
} match_flags;
|
||||
|
||||
#if defined(__BORLANDC__) || BOOST_WORKAROUND(BOOST_MSVC, <= 1310)
|
||||
#if defined(__BORLANDC__) || (defined(_MSC_VER) && (_MSC_VER <= 1310))
|
||||
typedef unsigned long match_flag_type;
|
||||
#else
|
||||
typedef match_flags match_flag_type;
|
||||
|
||||
@@ -33,7 +33,10 @@
|
||||
namespace boost{
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4251 4231)
|
||||
#pragma warning(disable : 4251)
|
||||
#if BOOST_MSVC < 1700
|
||||
# pragma warning(disable : 4231)
|
||||
#endif
|
||||
# if BOOST_MSVC < 1600
|
||||
# pragma warning(disable : 4660)
|
||||
# endif
|
||||
@@ -56,7 +59,9 @@ private:
|
||||
#endif
|
||||
public:
|
||||
typedef sub_match<BidiIterator> value_type;
|
||||
#if !defined(BOOST_NO_STD_ALLOCATOR) && !(defined(BOOST_MSVC) && defined(_STLPORT_VERSION))
|
||||
#ifndef BOOST_NO_CXX11_ALLOCATOR
|
||||
typedef typename std::allocator_traits<Allocator>::value_type const & const_reference;
|
||||
#elif !defined(BOOST_NO_STD_ALLOCATOR) && !(defined(BOOST_MSVC) && defined(_STLPORT_VERSION))
|
||||
typedef typename Allocator::const_reference const_reference;
|
||||
#else
|
||||
typedef const value_type& const_reference;
|
||||
@@ -66,7 +71,11 @@ public:
|
||||
typedef const_iterator iterator;
|
||||
typedef typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits<
|
||||
BidiIterator>::difference_type difference_type;
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
typedef typename Allocator::size_type size_type;
|
||||
#else
|
||||
typedef typename std::allocator_traits<Allocator>::size_type size_type;
|
||||
#endif
|
||||
typedef Allocator allocator_type;
|
||||
typedef typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits<
|
||||
BidiIterator>::value_type char_type;
|
||||
@@ -563,7 +572,7 @@ private:
|
||||
//
|
||||
static void raise_logic_error()
|
||||
{
|
||||
std::logic_error e("Attempt to access an uninitialzed boost::match_results<> class.");
|
||||
std::logic_error e("Attempt to access an uninitialized boost::match_results<> class.");
|
||||
boost::throw_exception(e);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,9 @@
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable: 4800)
|
||||
#if BOOST_MSVC < 1910
|
||||
#pragma warning(disable:4800)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
@@ -122,7 +124,7 @@ inline int string_compare(const Seq& s, const C* p)
|
||||
{
|
||||
++i;
|
||||
}
|
||||
return (i == s.size()) ? -p[i] : s[i] - p[i];
|
||||
return (i == s.size()) ? -(int)p[i] : (int)s[i] - (int)p[i];
|
||||
}
|
||||
# define STR_COMP(s,p) string_compare(s,p)
|
||||
|
||||
@@ -353,7 +355,10 @@ struct recursion_info
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4251 4231)
|
||||
#pragma warning(disable : 4251)
|
||||
#if BOOST_MSVC < 1700
|
||||
# pragma warning(disable : 4231)
|
||||
#endif
|
||||
# if BOOST_MSVC < 1600
|
||||
# pragma warning(disable : 4660)
|
||||
# endif
|
||||
@@ -379,6 +384,9 @@ public:
|
||||
: 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)
|
||||
#ifdef BOOST_REGEX_NON_RECURSIVE
|
||||
, m_recursions(0)
|
||||
#endif
|
||||
{
|
||||
construct_init(e, f);
|
||||
}
|
||||
@@ -547,7 +555,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 idx, const re_syntax_base* p, results_type* presults);
|
||||
void push_recursion(int idx, const re_syntax_base* p, results_type* presults, results_type* presults2);
|
||||
void push_recursion_pop();
|
||||
void push_case_change(bool);
|
||||
|
||||
@@ -566,6 +574,8 @@ private:
|
||||
bool m_unwound_alt;
|
||||
// We are unwinding a commit - used by independent subs to determine whether to stop there or carry on unwinding:
|
||||
//bool m_unwind_commit;
|
||||
// Recursion limit:
|
||||
unsigned m_recursions;
|
||||
#endif
|
||||
|
||||
// these operations aren't allowed, so are declared private,
|
||||
|
||||
@@ -36,7 +36,9 @@
|
||||
#endif
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable: 4800)
|
||||
#if BOOST_MSVC < 1910
|
||||
#pragma warning(disable:4800)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
@@ -113,6 +115,11 @@ void perl_matcher<BidiIterator, Allocator, traits>::estimate_max_state_count(std
|
||||
std::ptrdiff_t states = re.size();
|
||||
if(states == 0)
|
||||
states = 1;
|
||||
if ((std::numeric_limits<std::ptrdiff_t>::max)() / states < states)
|
||||
{
|
||||
max_state_count = (std::min)((std::ptrdiff_t)BOOST_REGEX_MAX_STATE_COUNT, (std::numeric_limits<std::ptrdiff_t>::max)() - 2);
|
||||
return;
|
||||
}
|
||||
states *= states;
|
||||
if((std::numeric_limits<std::ptrdiff_t>::max)() / dist < states)
|
||||
{
|
||||
@@ -471,12 +478,14 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_word_boundary()
|
||||
}
|
||||
else
|
||||
{
|
||||
b = (m_match_flags & match_not_eow) ? true : false;
|
||||
if (m_match_flags & match_not_eow)
|
||||
return false;
|
||||
b = false;
|
||||
}
|
||||
if((position == backstop) && ((m_match_flags & match_prev_avail) == 0))
|
||||
{
|
||||
if(m_match_flags & match_not_bow)
|
||||
b ^= true;
|
||||
return false;
|
||||
else
|
||||
b ^= false;
|
||||
}
|
||||
@@ -772,7 +781,7 @@ inline bool perl_matcher<BidiIterator, Allocator, traits>::match_assert_backref(
|
||||
{
|
||||
// Have we recursed into subexpression "index"?
|
||||
// If index == 0 then check for any recursion at all, otherwise for recursion to -index-1.
|
||||
int idx = -index-1;
|
||||
int idx = -(index+1);
|
||||
if(idx >= 10000)
|
||||
{
|
||||
named_subexpressions::range_type r = re.get_data().equal_range(idx);
|
||||
|
||||
@@ -34,7 +34,10 @@
|
||||
#endif
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable: 4800 4706)
|
||||
# pragma warning(disable: 4706)
|
||||
#if BOOST_MSVC < 1910
|
||||
#pragma warning(disable:4800)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
@@ -130,11 +133,11 @@ struct saved_single_repeat : public saved_state
|
||||
template <class Results>
|
||||
struct saved_recursion : public saved_state
|
||||
{
|
||||
saved_recursion(int idx, const re_syntax_base* p, Results* pr)
|
||||
: saved_state(14), recursion_id(idx), preturn_address(p), results(*pr) {}
|
||||
saved_recursion(int idx, const re_syntax_base* p, Results* pr, Results* pr2)
|
||||
: saved_state(14), recursion_id(idx), preturn_address(p), internal_results(*pr), prior_results(*pr2) {}
|
||||
int recursion_id;
|
||||
const re_syntax_base* preturn_address;
|
||||
Results results;
|
||||
Results internal_results, prior_results;
|
||||
};
|
||||
|
||||
struct saved_change_case : public saved_state
|
||||
@@ -143,6 +146,15 @@ struct saved_change_case : public saved_state
|
||||
saved_change_case(bool c) : saved_state(18), icase(c) {}
|
||||
};
|
||||
|
||||
struct incrementer
|
||||
{
|
||||
incrementer(unsigned* pu) : m_pu(pu) { ++*m_pu; }
|
||||
~incrementer() { --*m_pu; }
|
||||
bool operator > (unsigned i) { return *m_pu > i; }
|
||||
private:
|
||||
unsigned* m_pu;
|
||||
};
|
||||
|
||||
template <class BidiIterator, class Allocator, class traits>
|
||||
bool perl_matcher<BidiIterator, Allocator, traits>::match_all_states()
|
||||
{
|
||||
@@ -187,7 +199,9 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_all_states()
|
||||
&perl_matcher<BidiIterator, Allocator, traits>::match_commit,
|
||||
&perl_matcher<BidiIterator, Allocator, traits>::match_then,
|
||||
};
|
||||
|
||||
incrementer inc(&m_recursions);
|
||||
if(inc > 80)
|
||||
raise_error(traits_inst, regex_constants::error_complexity);
|
||||
push_recursion_stopper();
|
||||
do{
|
||||
while(pstate)
|
||||
@@ -354,7 +368,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 idx, 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, results_type* presults2)
|
||||
{
|
||||
saved_recursion<results_type>* pmp = static_cast<saved_recursion<results_type>*>(m_backup_state);
|
||||
--pmp;
|
||||
@@ -364,7 +378,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>(idx, p, presults);
|
||||
(void) new (pmp)saved_recursion<results_type>(idx, p, presults, presults2);
|
||||
m_backup_state = pmp;
|
||||
}
|
||||
|
||||
@@ -688,7 +702,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_rep()
|
||||
template <class BidiIterator, class Allocator, class traits>
|
||||
bool perl_matcher<BidiIterator, Allocator, traits>::match_dot_repeat_slow()
|
||||
{
|
||||
unsigned count = 0;
|
||||
std::size_t count = 0;
|
||||
const re_repeat* rep = static_cast<const re_repeat*>(pstate);
|
||||
re_syntax_base* psingle = rep->next.p;
|
||||
// match compulsary repeats first:
|
||||
@@ -740,7 +754,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_dot_repeat_fast()
|
||||
|
||||
const re_repeat* rep = static_cast<const re_repeat*>(pstate);
|
||||
bool greedy = (rep->greedy) && (!(m_match_flags & regex_constants::match_any) || m_independent);
|
||||
unsigned count = static_cast<unsigned>((std::min)(static_cast<unsigned>(::boost::BOOST_REGEX_DETAIL_NS::distance(position, last)), static_cast<unsigned>(greedy ? rep->max : rep->min)));
|
||||
std::size_t count = static_cast<std::size_t>((std::min)(static_cast<std::size_t>(::boost::BOOST_REGEX_DETAIL_NS::distance(position, last)), greedy ? rep->max : rep->min));
|
||||
if(rep->min > count)
|
||||
{
|
||||
position = last;
|
||||
@@ -1052,7 +1066,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_endmark()
|
||||
{
|
||||
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);
|
||||
push_recursion(recursion_stack.back().idx, recursion_stack.back().preturn_address, m_presult, &recursion_stack.back().results);
|
||||
recursion_stack.pop_back();
|
||||
push_repeater_count(-(2 + index), &next_count);
|
||||
}
|
||||
@@ -1075,8 +1089,8 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_match()
|
||||
{
|
||||
BOOST_ASSERT(0 == recursion_stack.back().idx);
|
||||
pstate = recursion_stack.back().preturn_address;
|
||||
push_recursion(recursion_stack.back().idx, recursion_stack.back().preturn_address, m_presult, &recursion_stack.back().results);
|
||||
*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;
|
||||
}
|
||||
@@ -1181,10 +1195,15 @@ bool perl_matcher<BidiIterator, Allocator, traits>::skip_until_paren(int index,
|
||||
{
|
||||
// Unenclosed closing ), occurs when (*ACCEPT) is inside some other
|
||||
// parenthesis which may or may not have other side effects associated with it.
|
||||
const re_syntax_base* sp = pstate;
|
||||
match_endmark();
|
||||
if(!pstate)
|
||||
{
|
||||
unwind(true);
|
||||
// unwind may leave pstate NULL if we've unwound a forward lookahead, in which
|
||||
// case just move to the next state and keep looking...
|
||||
if (!pstate)
|
||||
pstate = sp->next.p;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
@@ -1757,14 +1776,18 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_non_greedy_repeat(boo
|
||||
template <class BidiIterator, class Allocator, class traits>
|
||||
bool perl_matcher<BidiIterator, Allocator, traits>::unwind_recursion(bool r)
|
||||
{
|
||||
// We are backtracking back inside a recursion, need to push the info
|
||||
// back onto the recursion stack, and do so unconditionally, otherwise
|
||||
// we can get mismatched pushes and pops...
|
||||
saved_recursion<results_type>* pmp = static_cast<saved_recursion<results_type>*>(m_backup_state);
|
||||
if(!r)
|
||||
if (!r)
|
||||
{
|
||||
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;
|
||||
recursion_stack.back().results = pmp->prior_results;
|
||||
recursion_stack.back().location_of_start = position;
|
||||
*m_presult = pmp->internal_results;
|
||||
}
|
||||
boost::BOOST_REGEX_DETAIL_NS::inplace_destroy(pmp++);
|
||||
m_backup_state = pmp;
|
||||
@@ -1774,9 +1797,13 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_recursion(bool r)
|
||||
template <class BidiIterator, class Allocator, class traits>
|
||||
bool perl_matcher<BidiIterator, Allocator, traits>::unwind_recursion_pop(bool r)
|
||||
{
|
||||
// Backtracking out of a recursion, we must pop state off the recursion
|
||||
// stack unconditionally to ensure matched pushes and pops:
|
||||
saved_state* pmp = static_cast<saved_state*>(m_backup_state);
|
||||
if(!r)
|
||||
if (!r && !recursion_stack.empty())
|
||||
{
|
||||
*m_presult = recursion_stack.back().results;
|
||||
position = recursion_stack.back().location_of_start;
|
||||
recursion_stack.pop_back();
|
||||
}
|
||||
boost::BOOST_REGEX_DETAIL_NS::inplace_destroy(pmp++);
|
||||
@@ -1810,6 +1837,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_commit(bool b)
|
||||
// If we stop because we just unwound an assertion, put the
|
||||
// commit state back on the stack again:
|
||||
//
|
||||
m_unwound_lookahead = false;
|
||||
saved_state* pmp = m_backup_state;
|
||||
--pmp;
|
||||
if(pmp < m_stack_base)
|
||||
|
||||
@@ -423,7 +423,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_dot_repeat_slow()
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4127)
|
||||
#endif
|
||||
unsigned count = 0;
|
||||
std::size_t count = 0;
|
||||
const re_repeat* rep = static_cast<const re_repeat*>(pstate);
|
||||
re_syntax_base* psingle = rep->next.p;
|
||||
// match compulsary repeats first:
|
||||
@@ -497,7 +497,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_dot_repeat_fast()
|
||||
#pragma warning(disable:4267)
|
||||
#endif
|
||||
bool greedy = (rep->greedy) && (!(m_match_flags & regex_constants::match_any) || m_independent);
|
||||
std::size_t count = (std::min)(static_cast<std::size_t>(::boost::BOOST_REGEX_DETAIL_NS::distance(position, last)), static_cast<std::size_t>(greedy ? rep->max : rep->min));
|
||||
std::size_t count = (std::min)(static_cast<std::size_t>(::boost::BOOST_REGEX_DETAIL_NS::distance(position, last)), greedy ? rep->max : rep->min);
|
||||
if(rep->min > count)
|
||||
{
|
||||
position = last;
|
||||
@@ -657,7 +657,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_set_repeat()
|
||||
#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;
|
||||
std::size_t count = 0;
|
||||
//
|
||||
// start by working out how much we can skip:
|
||||
//
|
||||
@@ -753,7 +753,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_long_set_repeat()
|
||||
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;
|
||||
std::size_t count = 0;
|
||||
//
|
||||
// start by working out how much we can skip:
|
||||
//
|
||||
|
||||
@@ -800,9 +800,6 @@ void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::put(co
|
||||
|
||||
template <class S>
|
||||
class string_out_iterator
|
||||
#ifndef BOOST_NO_STD_ITERATOR
|
||||
: public std::iterator<std::output_iterator_tag, typename S::value_type>
|
||||
#endif
|
||||
{
|
||||
S* out;
|
||||
public:
|
||||
@@ -816,13 +813,11 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifdef BOOST_NO_STD_ITERATOR
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef typename S::value_type value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef value_type& reference;
|
||||
typedef std::output_iterator_tag iterator_category;
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class OutputIterator, class Iterator, class Alloc, class ForwardIter, class traits>
|
||||
|
||||
@@ -85,14 +85,6 @@ template <class BidirectionalIterator,
|
||||
class charT = BOOST_DEDUCED_TYPENAME BOOST_REGEX_DETAIL_NS::regex_iterator_traits<BidirectionalIterator>::value_type,
|
||||
class traits = regex_traits<charT> >
|
||||
class regex_iterator
|
||||
#ifndef BOOST_NO_STD_ITERATOR
|
||||
: public std::iterator<
|
||||
std::forward_iterator_tag,
|
||||
match_results<BidirectionalIterator>,
|
||||
typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits<BidirectionalIterator>::difference_type,
|
||||
const match_results<BidirectionalIterator>*,
|
||||
const match_results<BidirectionalIterator>& >
|
||||
#endif
|
||||
{
|
||||
private:
|
||||
typedef regex_iterator_implementation<BidirectionalIterator, charT, traits> impl;
|
||||
|
||||
@@ -138,12 +138,12 @@ public:
|
||||
|
||||
size_type BOOST_REGEX_CALL size()
|
||||
{
|
||||
return end - start;
|
||||
return size_type(end - start);
|
||||
}
|
||||
|
||||
size_type BOOST_REGEX_CALL capacity()
|
||||
{
|
||||
return last - start;
|
||||
return size_type(last - start);
|
||||
}
|
||||
|
||||
void* BOOST_REGEX_CALL data()const
|
||||
@@ -153,7 +153,7 @@ public:
|
||||
|
||||
size_type BOOST_REGEX_CALL index(void* ptr)
|
||||
{
|
||||
return static_cast<pointer>(ptr) - static_cast<pointer>(data());
|
||||
return size_type(static_cast<pointer>(ptr) - static_cast<pointer>(data()));
|
||||
}
|
||||
|
||||
void BOOST_REGEX_CALL clear()
|
||||
|
||||
@@ -36,7 +36,9 @@ namespace boost{
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable: 4800)
|
||||
#if BOOST_MSVC < 1910
|
||||
#pragma warning(disable:4800)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace BOOST_REGEX_DETAIL_NS{
|
||||
|
||||
@@ -167,14 +167,6 @@ template <class BidirectionalIterator,
|
||||
class charT = BOOST_DEDUCED_TYPENAME BOOST_REGEX_DETAIL_NS::regex_iterator_traits<BidirectionalIterator>::value_type,
|
||||
class traits = regex_traits<charT> >
|
||||
class regex_token_iterator
|
||||
#ifndef BOOST_NO_STD_ITERATOR
|
||||
: public std::iterator<
|
||||
std::forward_iterator_tag,
|
||||
sub_match<BidirectionalIterator>,
|
||||
typename BOOST_REGEX_DETAIL_NS::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;
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <boost/regex/v4/error_type.hpp>
|
||||
#endif
|
||||
#include <boost/type_traits/make_unsigned.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
|
||||
#ifdef BOOST_NO_STDC_NAMESPACE
|
||||
namespace std{
|
||||
@@ -240,7 +241,7 @@ inline std::ptrdiff_t global_length<char>(const char* p)
|
||||
template<>
|
||||
inline std::ptrdiff_t global_length<wchar_t>(const wchar_t* p)
|
||||
{
|
||||
return (std::wcslen)(p);
|
||||
return (std::ptrdiff_t)(std::wcslen)(p);
|
||||
}
|
||||
#endif
|
||||
template <class charT>
|
||||
@@ -307,6 +308,7 @@ template <class charT, class traits>
|
||||
boost::intmax_t global_toi(const charT*& p1, const charT* p2, int radix, const traits& t)
|
||||
{
|
||||
(void)t; // warning suppression
|
||||
boost::intmax_t limit = (std::numeric_limits<boost::intmax_t>::max)() / radix;
|
||||
boost::intmax_t next_value = t.value(*p1, radix);
|
||||
if((p1 == p2) || (next_value < 0) || (next_value >= radix))
|
||||
return -1;
|
||||
@@ -319,22 +321,24 @@ boost::intmax_t global_toi(const charT*& p1, const charT* p2, int radix, const t
|
||||
result *= radix;
|
||||
result += next_value;
|
||||
++p1;
|
||||
if (result > limit)
|
||||
return -1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
template <class charT>
|
||||
inline const charT* get_escape_R_string()
|
||||
inline typename boost::enable_if_c<(sizeof(charT) > 1), const charT*>::type 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', 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', static_cast<unsigned char>('\x85'), ']', ')', '\0' };
|
||||
static const charT e1[] = { '(', '?', '-', 'x', ':', '(', '?', '>', '\x0D', '\x0A', '?',
|
||||
'|', '[', '\x0A', '\x0B', '\x0C', static_cast<charT>(0x85), static_cast<charT>(0x2028),
|
||||
static_cast<charT>(0x2029), ']', ')', ')', '\0' };
|
||||
static const charT e2[] = { '(', '?', '-', 'x', ':', '(', '?', '>', '\x0D', '\x0A', '?',
|
||||
'|', '[', '\x0A', '\x0B', '\x0C', static_cast<charT>(0x85), ']', ')', ')', '\0' };
|
||||
|
||||
charT c = static_cast<charT>(0x2029u);
|
||||
bool b = (static_cast<unsigned>(c) == 0x2029u);
|
||||
@@ -345,15 +349,15 @@ inline const charT* get_escape_R_string()
|
||||
#endif
|
||||
}
|
||||
|
||||
template <>
|
||||
inline const char* get_escape_R_string<char>()
|
||||
template <class charT>
|
||||
inline typename boost::disable_if_c<(sizeof(charT) > 1), const charT*>::type get_escape_R_string()
|
||||
{
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable:4309)
|
||||
#endif
|
||||
static const char e2[] = { '(', '?', '>', '\x0D', '\x0A', '?',
|
||||
'|', '[', '\x0A', '\x0B', '\x0C', '\x85', ']', ')', '\0' };
|
||||
static const charT e2[] = { '(', '?', '-', 'x', ':', '(', '?', '>', '\x0D', '\x0A', '?',
|
||||
'|', '[', '\x0A', '\x0B', '\x0C', '\x85', ']', ')', ')', '\0' };
|
||||
return e2;
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(pop)
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#ifndef BOOST_REGEX_WORKAROUND_HPP
|
||||
#define BOOST_REGEX_WORKAROUND_HPP
|
||||
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <new>
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
@@ -198,9 +198,10 @@ namespace boost{ namespace BOOST_REGEX_DETAIL_NS{
|
||||
const char *strSource
|
||||
)
|
||||
{
|
||||
if(std::strlen(strSource)+1 > sizeInBytes)
|
||||
std::size_t lenSourceWithNull = std::strlen(strSource) + 1;
|
||||
if (lenSourceWithNull > sizeInBytes)
|
||||
return 1;
|
||||
std::strcpy(strDestination, strSource);
|
||||
std::memcpy(strDestination, strSource, lenSourceWithNull);
|
||||
return 0;
|
||||
}
|
||||
inline std::size_t strcat_s(
|
||||
@@ -209,9 +210,11 @@ namespace boost{ namespace BOOST_REGEX_DETAIL_NS{
|
||||
const char *strSource
|
||||
)
|
||||
{
|
||||
if(std::strlen(strSource) + std::strlen(strDestination) + 1 > sizeInBytes)
|
||||
std::size_t lenSourceWithNull = std::strlen(strSource) + 1;
|
||||
std::size_t lenDestination = std::strlen(strDestination);
|
||||
if (lenSourceWithNull + lenDestination > sizeInBytes)
|
||||
return 1;
|
||||
std::strcat(strDestination, strSource);
|
||||
std::memcpy(strDestination + lenDestination, strSource, lenSourceWithNull);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,14 +72,6 @@ private:
|
||||
|
||||
template <class BidirectionalIterator>
|
||||
class u32regex_iterator
|
||||
#ifndef BOOST_NO_STD_ITERATOR
|
||||
: public std::iterator<
|
||||
std::forward_iterator_tag,
|
||||
match_results<BidirectionalIterator>,
|
||||
typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits<BidirectionalIterator>::difference_type,
|
||||
const match_results<BidirectionalIterator>*,
|
||||
const match_results<BidirectionalIterator>& >
|
||||
#endif
|
||||
{
|
||||
private:
|
||||
typedef u32regex_iterator_implementation<BidirectionalIterator> impl;
|
||||
@@ -166,7 +158,7 @@ inline u32regex_iterator<const wchar_t*> make_u32regex_iterator(const wchar_t* p
|
||||
return u32regex_iterator<const wchar_t*>(p, p+std::wcslen(p), e, m);
|
||||
}
|
||||
#endif
|
||||
#if !defined(U_WCHAR_IS_UTF16) && (U_SIZEOF_WCHAR_T != 2)
|
||||
#if !defined(BOOST_REGEX_UCHAR_IS_WCHAR_T)
|
||||
inline u32regex_iterator<const UChar*> make_u32regex_iterator(const UChar* p, const u32regex& e, regex_constants::match_flag_type m = regex_constants::match_default)
|
||||
{
|
||||
return u32regex_iterator<const UChar*>(p, p+u_strlen(p), e, m);
|
||||
|
||||
@@ -155,14 +155,6 @@ private:
|
||||
|
||||
template <class BidirectionalIterator>
|
||||
class u32regex_token_iterator
|
||||
#ifndef BOOST_NO_STD_ITERATOR
|
||||
: public std::iterator<
|
||||
std::forward_iterator_tag,
|
||||
sub_match<BidirectionalIterator>,
|
||||
typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits<BidirectionalIterator>::difference_type,
|
||||
const sub_match<BidirectionalIterator>*,
|
||||
const sub_match<BidirectionalIterator>& >
|
||||
#endif
|
||||
{
|
||||
private:
|
||||
typedef u32regex_token_iterator_implementation<BidirectionalIterator> impl;
|
||||
@@ -275,7 +267,7 @@ inline u32regex_token_iterator<const wchar_t*> make_u32regex_token_iterator(cons
|
||||
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)
|
||||
#if !defined(BOOST_REGEX_UCHAR_IS_WCHAR_T)
|
||||
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);
|
||||
@@ -305,7 +297,7 @@ inline u32regex_token_iterator<const wchar_t*> make_u32regex_token_iterator(cons
|
||||
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)
|
||||
#if !defined(BOOST_REGEX_UCHAR_IS_WCHAR_T)
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -51,8 +51,10 @@
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4786)
|
||||
#if BOOST_MSVC < 1910
|
||||
#pragma warning(disable:4800)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user