forked from boostorg/regex
Remove a lot of boost dependencies and workarounds.
This commit is contained in:
@ -31,6 +31,12 @@
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
|
||||
#ifdef BOOST_REGEX_CXX03
|
||||
#define RW_NS boost
|
||||
#else
|
||||
#define RW_NS std
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
|
||||
//
|
||||
@ -996,37 +1002,36 @@ struct BoostRegexConcept
|
||||
out = regex_format(out, m_cresults, func2b);
|
||||
out = regex_format(out, m_cresults, func1b, f);
|
||||
out = regex_format(out, m_cresults, func1b);
|
||||
out = regex_format(out, m_cresults, boost::ref(func3b), f);
|
||||
out = regex_format(out, m_cresults, boost::ref(func3b));
|
||||
out = regex_format(out, m_cresults, boost::ref(func2b), f);
|
||||
out = regex_format(out, m_cresults, boost::ref(func2b));
|
||||
out = regex_format(out, m_cresults, boost::ref(func1b), f);
|
||||
out = regex_format(out, m_cresults, boost::ref(func1b));
|
||||
out = regex_format(out, m_cresults, boost::cref(func3b), f);
|
||||
out = regex_format(out, m_cresults, boost::cref(func3b));
|
||||
out = regex_format(out, m_cresults, boost::cref(func2b), f);
|
||||
out = regex_format(out, m_cresults, boost::cref(func2b));
|
||||
out = regex_format(out, m_cresults, boost::cref(func1b), f);
|
||||
out = regex_format(out, m_cresults, boost::cref(func1b));
|
||||
|
||||
out = regex_format(out, m_cresults, RW_NS::ref(func3b), f);
|
||||
out = regex_format(out, m_cresults, RW_NS::ref(func3b));
|
||||
out = regex_format(out, m_cresults, RW_NS::ref(func2b), f);
|
||||
out = regex_format(out, m_cresults, RW_NS::ref(func2b));
|
||||
out = regex_format(out, m_cresults, RW_NS::ref(func1b), f);
|
||||
out = regex_format(out, m_cresults, RW_NS::ref(func1b));
|
||||
out = regex_format(out, m_cresults, RW_NS::cref(func3b), f);
|
||||
out = regex_format(out, m_cresults, RW_NS::cref(func3b));
|
||||
out = regex_format(out, m_cresults, RW_NS::cref(func2b), f);
|
||||
out = regex_format(out, m_cresults, RW_NS::cref(func2b));
|
||||
out = regex_format(out, m_cresults, RW_NS::cref(func1b), f);
|
||||
out = regex_format(out, m_cresults, RW_NS::cref(func1b));
|
||||
m_string += regex_format(m_cresults, func3b, f);
|
||||
m_string += regex_format(m_cresults, func3b);
|
||||
m_string += regex_format(m_cresults, func2b, f);
|
||||
m_string += regex_format(m_cresults, func2b);
|
||||
m_string += regex_format(m_cresults, func1b, f);
|
||||
m_string += regex_format(m_cresults, func1b);
|
||||
m_string += regex_format(m_cresults, boost::ref(func3b), f);
|
||||
m_string += regex_format(m_cresults, boost::ref(func3b));
|
||||
m_string += regex_format(m_cresults, boost::ref(func2b), f);
|
||||
m_string += regex_format(m_cresults, boost::ref(func2b));
|
||||
m_string += regex_format(m_cresults, boost::ref(func1b), f);
|
||||
m_string += regex_format(m_cresults, boost::ref(func1b));
|
||||
m_string += regex_format(m_cresults, boost::cref(func3b), f);
|
||||
m_string += regex_format(m_cresults, boost::cref(func3b));
|
||||
m_string += regex_format(m_cresults, boost::cref(func2b), f);
|
||||
m_string += regex_format(m_cresults, boost::cref(func2b));
|
||||
m_string += regex_format(m_cresults, boost::cref(func1b), f);
|
||||
m_string += regex_format(m_cresults, boost::cref(func1b));
|
||||
m_string += regex_format(m_cresults, RW_NS::ref(func3b), f);
|
||||
m_string += regex_format(m_cresults, RW_NS::ref(func3b));
|
||||
m_string += regex_format(m_cresults, RW_NS::ref(func2b), f);
|
||||
m_string += regex_format(m_cresults, RW_NS::ref(func2b));
|
||||
m_string += regex_format(m_cresults, RW_NS::ref(func1b), f);
|
||||
m_string += regex_format(m_cresults, RW_NS::ref(func1b));
|
||||
m_string += regex_format(m_cresults, RW_NS::cref(func3b), f);
|
||||
m_string += regex_format(m_cresults, RW_NS::cref(func3b));
|
||||
m_string += regex_format(m_cresults, RW_NS::cref(func2b), f);
|
||||
m_string += regex_format(m_cresults, RW_NS::cref(func2b));
|
||||
m_string += regex_format(m_cresults, RW_NS::cref(func1b), f);
|
||||
m_string += regex_format(m_cresults, RW_NS::cref(func1b));
|
||||
|
||||
out = m_cresults.format(out, func3b, f);
|
||||
out = m_cresults.format(out, func3b);
|
||||
@ -1034,18 +1039,18 @@ struct BoostRegexConcept
|
||||
out = m_cresults.format(out, func2b);
|
||||
out = m_cresults.format(out, func1b, f);
|
||||
out = m_cresults.format(out, func1b);
|
||||
out = m_cresults.format(out, boost::ref(func3b), f);
|
||||
out = m_cresults.format(out, boost::ref(func3b));
|
||||
out = m_cresults.format(out, boost::ref(func2b), f);
|
||||
out = m_cresults.format(out, boost::ref(func2b));
|
||||
out = m_cresults.format(out, boost::ref(func1b), f);
|
||||
out = m_cresults.format(out, boost::ref(func1b));
|
||||
out = m_cresults.format(out, boost::cref(func3b), f);
|
||||
out = m_cresults.format(out, boost::cref(func3b));
|
||||
out = m_cresults.format(out, boost::cref(func2b), f);
|
||||
out = m_cresults.format(out, boost::cref(func2b));
|
||||
out = m_cresults.format(out, boost::cref(func1b), f);
|
||||
out = m_cresults.format(out, boost::cref(func1b));
|
||||
out = m_cresults.format(out, RW_NS::ref(func3b), f);
|
||||
out = m_cresults.format(out, RW_NS::ref(func3b));
|
||||
out = m_cresults.format(out, RW_NS::ref(func2b), f);
|
||||
out = m_cresults.format(out, RW_NS::ref(func2b));
|
||||
out = m_cresults.format(out, RW_NS::ref(func1b), f);
|
||||
out = m_cresults.format(out, RW_NS::ref(func1b));
|
||||
out = m_cresults.format(out, RW_NS::cref(func3b), f);
|
||||
out = m_cresults.format(out, RW_NS::cref(func3b));
|
||||
out = m_cresults.format(out, RW_NS::cref(func2b), f);
|
||||
out = m_cresults.format(out, RW_NS::cref(func2b));
|
||||
out = m_cresults.format(out, RW_NS::cref(func1b), f);
|
||||
out = m_cresults.format(out, RW_NS::cref(func1b));
|
||||
|
||||
m_string += m_cresults.format(func3b, f);
|
||||
m_string += m_cresults.format(func3b);
|
||||
@ -1053,18 +1058,18 @@ struct BoostRegexConcept
|
||||
m_string += m_cresults.format(func2b);
|
||||
m_string += m_cresults.format(func1b, f);
|
||||
m_string += m_cresults.format(func1b);
|
||||
m_string += m_cresults.format(boost::ref(func3b), f);
|
||||
m_string += m_cresults.format(boost::ref(func3b));
|
||||
m_string += m_cresults.format(boost::ref(func2b), f);
|
||||
m_string += m_cresults.format(boost::ref(func2b));
|
||||
m_string += m_cresults.format(boost::ref(func1b), f);
|
||||
m_string += m_cresults.format(boost::ref(func1b));
|
||||
m_string += m_cresults.format(boost::cref(func3b), f);
|
||||
m_string += m_cresults.format(boost::cref(func3b));
|
||||
m_string += m_cresults.format(boost::cref(func2b), f);
|
||||
m_string += m_cresults.format(boost::cref(func2b));
|
||||
m_string += m_cresults.format(boost::cref(func1b), f);
|
||||
m_string += m_cresults.format(boost::cref(func1b));
|
||||
m_string += m_cresults.format(RW_NS::ref(func3b), f);
|
||||
m_string += m_cresults.format(RW_NS::ref(func3b));
|
||||
m_string += m_cresults.format(RW_NS::ref(func2b), f);
|
||||
m_string += m_cresults.format(RW_NS::ref(func2b));
|
||||
m_string += m_cresults.format(RW_NS::ref(func1b), f);
|
||||
m_string += m_cresults.format(RW_NS::ref(func1b));
|
||||
m_string += m_cresults.format(RW_NS::cref(func3b), f);
|
||||
m_string += m_cresults.format(RW_NS::cref(func3b));
|
||||
m_string += m_cresults.format(RW_NS::cref(func2b), f);
|
||||
m_string += m_cresults.format(RW_NS::cref(func2b));
|
||||
m_string += m_cresults.format(RW_NS::cref(func1b), f);
|
||||
m_string += m_cresults.format(RW_NS::cref(func1b));
|
||||
|
||||
out = regex_replace(out, m_in, m_in, ce, func3, f);
|
||||
out = regex_replace(out, m_in, m_in, ce, func3);
|
||||
@ -1072,18 +1077,18 @@ struct BoostRegexConcept
|
||||
out = regex_replace(out, m_in, m_in, ce, func2);
|
||||
out = regex_replace(out, m_in, m_in, ce, func1, f);
|
||||
out = regex_replace(out, m_in, m_in, ce, func1);
|
||||
out = regex_replace(out, m_in, m_in, ce, boost::ref(func3), f);
|
||||
out = regex_replace(out, m_in, m_in, ce, boost::ref(func3));
|
||||
out = regex_replace(out, m_in, m_in, ce, boost::ref(func2), f);
|
||||
out = regex_replace(out, m_in, m_in, ce, boost::ref(func2));
|
||||
out = regex_replace(out, m_in, m_in, ce, boost::ref(func1), f);
|
||||
out = regex_replace(out, m_in, m_in, ce, boost::ref(func1));
|
||||
out = regex_replace(out, m_in, m_in, ce, boost::cref(func3), f);
|
||||
out = regex_replace(out, m_in, m_in, ce, boost::cref(func3));
|
||||
out = regex_replace(out, m_in, m_in, ce, boost::cref(func2), f);
|
||||
out = regex_replace(out, m_in, m_in, ce, boost::cref(func2));
|
||||
out = regex_replace(out, m_in, m_in, ce, boost::cref(func1), f);
|
||||
out = regex_replace(out, m_in, m_in, ce, boost::cref(func1));
|
||||
out = regex_replace(out, m_in, m_in, ce, RW_NS::ref(func3), f);
|
||||
out = regex_replace(out, m_in, m_in, ce, RW_NS::ref(func3));
|
||||
out = regex_replace(out, m_in, m_in, ce, RW_NS::ref(func2), f);
|
||||
out = regex_replace(out, m_in, m_in, ce, RW_NS::ref(func2));
|
||||
out = regex_replace(out, m_in, m_in, ce, RW_NS::ref(func1), f);
|
||||
out = regex_replace(out, m_in, m_in, ce, RW_NS::ref(func1));
|
||||
out = regex_replace(out, m_in, m_in, ce, RW_NS::cref(func3), f);
|
||||
out = regex_replace(out, m_in, m_in, ce, RW_NS::cref(func3));
|
||||
out = regex_replace(out, m_in, m_in, ce, RW_NS::cref(func2), f);
|
||||
out = regex_replace(out, m_in, m_in, ce, RW_NS::cref(func2));
|
||||
out = regex_replace(out, m_in, m_in, ce, RW_NS::cref(func1), f);
|
||||
out = regex_replace(out, m_in, m_in, ce, RW_NS::cref(func1));
|
||||
|
||||
functor3<match_results<typename string_type::const_iterator> > func3s;
|
||||
functor2<match_results<typename string_type::const_iterator> > func2s;
|
||||
@ -1094,18 +1099,18 @@ struct BoostRegexConcept
|
||||
m_string += regex_replace(m_string, ce, func2s);
|
||||
m_string += regex_replace(m_string, ce, func1s, f);
|
||||
m_string += regex_replace(m_string, ce, func1s);
|
||||
m_string += regex_replace(m_string, ce, boost::ref(func3s), f);
|
||||
m_string += regex_replace(m_string, ce, boost::ref(func3s));
|
||||
m_string += regex_replace(m_string, ce, boost::ref(func2s), f);
|
||||
m_string += regex_replace(m_string, ce, boost::ref(func2s));
|
||||
m_string += regex_replace(m_string, ce, boost::ref(func1s), f);
|
||||
m_string += regex_replace(m_string, ce, boost::ref(func1s));
|
||||
m_string += regex_replace(m_string, ce, boost::cref(func3s), f);
|
||||
m_string += regex_replace(m_string, ce, boost::cref(func3s));
|
||||
m_string += regex_replace(m_string, ce, boost::cref(func2s), f);
|
||||
m_string += regex_replace(m_string, ce, boost::cref(func2s));
|
||||
m_string += regex_replace(m_string, ce, boost::cref(func1s), f);
|
||||
m_string += regex_replace(m_string, ce, boost::cref(func1s));
|
||||
m_string += regex_replace(m_string, ce, RW_NS::ref(func3s), f);
|
||||
m_string += regex_replace(m_string, ce, RW_NS::ref(func3s));
|
||||
m_string += regex_replace(m_string, ce, RW_NS::ref(func2s), f);
|
||||
m_string += regex_replace(m_string, ce, RW_NS::ref(func2s));
|
||||
m_string += regex_replace(m_string, ce, RW_NS::ref(func1s), f);
|
||||
m_string += regex_replace(m_string, ce, RW_NS::ref(func1s));
|
||||
m_string += regex_replace(m_string, ce, RW_NS::cref(func3s), f);
|
||||
m_string += regex_replace(m_string, ce, RW_NS::cref(func3s));
|
||||
m_string += regex_replace(m_string, ce, RW_NS::cref(func2s), f);
|
||||
m_string += regex_replace(m_string, ce, RW_NS::cref(func2s));
|
||||
m_string += regex_replace(m_string, ce, RW_NS::cref(func1s), f);
|
||||
m_string += regex_replace(m_string, ce, RW_NS::cref(func1s));
|
||||
}
|
||||
|
||||
std::basic_ostream<value_type> m_stream;
|
||||
|
@ -44,6 +44,20 @@
|
||||
#include <boost/version.hpp>
|
||||
#endif
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
* Asserts:
|
||||
*
|
||||
*************************************************************************/
|
||||
|
||||
#ifdef BOOST_REGEX_STANDALONE
|
||||
#include <cassert>
|
||||
# define BOOST_REGEX_ASSERT(x) assert(x)
|
||||
#else
|
||||
#include <boost/assert.hpp>
|
||||
# define BOOST_REGEX_ASSERT(x) BOOST_ASSERT(x)
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Include all the headers we need here:
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <boost/regex/pending/unicode_iterator.hpp>
|
||||
#include <boost/mpl/int_fwd.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <bitset>
|
||||
#include <functional>
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning (push)
|
||||
@ -73,19 +73,19 @@ public:
|
||||
typedef u32_to_u16_iterator<const char_type*, ::UChar> itt;
|
||||
itt i(p1), j(p2);
|
||||
std::vector< ::UChar> t(i, j);
|
||||
::uint8_t result[100];
|
||||
::int32_t len;
|
||||
std::uint8_t result[100];
|
||||
std::int32_t len;
|
||||
if (!t.empty())
|
||||
len = pcoll->getSortKey(&*t.begin(), static_cast<::int32_t>(t.size()), result, sizeof(result));
|
||||
len = pcoll->getSortKey(&*t.begin(), static_cast<std::int32_t>(t.size()), result, sizeof(result));
|
||||
else
|
||||
len = pcoll->getSortKey(static_cast<UChar const*>(0), static_cast<::int32_t>(0), result, sizeof(result));
|
||||
len = pcoll->getSortKey(static_cast<UChar const*>(0), static_cast<std::int32_t>(0), result, sizeof(result));
|
||||
if (std::size_t(len) > sizeof(result))
|
||||
{
|
||||
scoped_array< ::uint8_t> presult(new ::uint8_t[len + 1]);
|
||||
std::unique_ptr< std::uint8_t[]> presult(new ::uint8_t[len + 1]);
|
||||
if (!t.empty())
|
||||
len = pcoll->getSortKey(&*t.begin(), static_cast<::int32_t>(t.size()), presult.get(), len + 1);
|
||||
len = pcoll->getSortKey(&*t.begin(), static_cast<std::int32_t>(t.size()), presult.get(), len + 1);
|
||||
else
|
||||
len = pcoll->getSortKey(static_cast<UChar const*>(0), static_cast<::int32_t>(0), presult.get(), len + 1);
|
||||
len = pcoll->getSortKey(static_cast<UChar const*>(0), static_cast<std::int32_t>(0), presult.get(), len + 1);
|
||||
if ((0 == presult[len - 1]) && (len > 1))
|
||||
--len;
|
||||
return string_type(presult.get(), presult.get() + len);
|
||||
@ -109,14 +109,20 @@ private:
|
||||
boost::throw_exception(e);
|
||||
}
|
||||
U_NAMESPACE_QUALIFIER Locale m_locale; // The ICU locale that we're using
|
||||
boost::scoped_ptr< U_NAMESPACE_QUALIFIER Collator> m_collator; // The full collation object
|
||||
boost::scoped_ptr< U_NAMESPACE_QUALIFIER Collator> m_primary_collator; // The primary collation object
|
||||
std::unique_ptr< U_NAMESPACE_QUALIFIER Collator> m_collator; // The full collation object
|
||||
std::unique_ptr< U_NAMESPACE_QUALIFIER Collator> m_primary_collator; // The primary collation object
|
||||
};
|
||||
|
||||
#ifdef BOOST_REGEX_CXX03
|
||||
inline boost::shared_ptr<icu_regex_traits_implementation> get_icu_regex_traits_implementation(const U_NAMESPACE_QUALIFIER Locale& loc)
|
||||
{
|
||||
return boost::shared_ptr<icu_regex_traits_implementation>(new icu_regex_traits_implementation(loc));
|
||||
}
|
||||
#else
|
||||
inline std::shared_ptr<icu_regex_traits_implementation> get_icu_regex_traits_implementation(const U_NAMESPACE_QUALIFIER Locale& loc)
|
||||
{
|
||||
return std::shared_ptr<icu_regex_traits_implementation>(new icu_regex_traits_implementation(loc));
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@ -251,17 +257,13 @@ public:
|
||||
if (result != 0)
|
||||
return result;
|
||||
}
|
||||
BOOST_ASSERT(std::size_t(idx + 1) < sizeof(masks) / sizeof(masks[0]));
|
||||
BOOST_REGEX_ASSERT(std::size_t(idx + 1) < sizeof(masks) / sizeof(masks[0]));
|
||||
return masks[idx + 1];
|
||||
}
|
||||
string_type lookup_collatename(const char_type* p1, const char_type* p2) const
|
||||
{
|
||||
string_type result;
|
||||
#ifdef BOOST_NO_CXX98_BINDERS
|
||||
if (std::find_if(p1, p2, std::bind(std::greater< ::UChar32>(), std::placeholders::_1, 0x7f)) == p2)
|
||||
#else
|
||||
if (std::find_if(p1, p2, std::bind2nd(std::greater< ::UChar32>(), 0x7f)) == p2)
|
||||
#endif
|
||||
{
|
||||
std::string s(p1, p2);
|
||||
// Try Unicode name:
|
||||
@ -331,7 +333,7 @@ public:
|
||||
}
|
||||
int value(char_type c, int radix)const
|
||||
{
|
||||
return u_digit(c, static_cast< ::int8_t>(radix));
|
||||
return u_digit(c, static_cast< std::int8_t>(radix));
|
||||
}
|
||||
locale_type imbue(locale_type l)
|
||||
{
|
||||
@ -631,8 +633,11 @@ private:
|
||||
return icu_class_map[p - ranges_begin];
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef BOOST_REGEX_CXX03
|
||||
boost::shared_ptr< ::boost::BOOST_REGEX_DETAIL_NS::icu_regex_traits_implementation> m_pimpl;
|
||||
#else
|
||||
std::shared_ptr< ::boost::BOOST_REGEX_DETAIL_NS::icu_regex_traits_implementation> m_pimpl;
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace boost
|
||||
@ -653,7 +658,7 @@ template <class InputIterator>
|
||||
inline u32regex do_make_u32regex(InputIterator i,
|
||||
InputIterator j,
|
||||
boost::regex_constants::syntax_option_type opt,
|
||||
const boost::mpl::int_<1>*)
|
||||
const std::integral_constant<int, 1>*)
|
||||
{
|
||||
typedef boost::u8_to_u32_iterator<InputIterator, UChar32> conv_type;
|
||||
return u32regex(conv_type(i, i, j), conv_type(j, i, j), opt);
|
||||
@ -663,7 +668,7 @@ template <class InputIterator>
|
||||
inline u32regex do_make_u32regex(InputIterator i,
|
||||
InputIterator j,
|
||||
boost::regex_constants::syntax_option_type opt,
|
||||
const boost::mpl::int_<2>*)
|
||||
const std::integral_constant<int, 2>*)
|
||||
{
|
||||
typedef boost::u16_to_u32_iterator<InputIterator, UChar32> conv_type;
|
||||
return u32regex(conv_type(i, i, j), conv_type(j, i, j), opt);
|
||||
@ -673,7 +678,7 @@ template <class InputIterator>
|
||||
inline u32regex do_make_u32regex(InputIterator i,
|
||||
InputIterator j,
|
||||
boost::regex_constants::syntax_option_type opt,
|
||||
const boost::mpl::int_<4>*)
|
||||
const std::integral_constant<int, 4>*)
|
||||
{
|
||||
return u32regex(i, j, opt);
|
||||
}
|
||||
@ -715,18 +720,18 @@ inline u32regex make_u32regex(InputIterator i,
|
||||
InputIterator j,
|
||||
boost::regex_constants::syntax_option_type opt)
|
||||
{
|
||||
return BOOST_REGEX_DETAIL_NS::do_make_u32regex(i, j, opt, static_cast<boost::mpl::int_<sizeof(*i)> const*>(0));
|
||||
return BOOST_REGEX_DETAIL_NS::do_make_u32regex(i, j, opt, static_cast<std::integral_constant<int, sizeof(*i)> const*>(0));
|
||||
}
|
||||
//
|
||||
// construction from UTF-8 nul-terminated strings:
|
||||
//
|
||||
inline u32regex make_u32regex(const char* p, boost::regex_constants::syntax_option_type opt = boost::regex_constants::perl)
|
||||
{
|
||||
return BOOST_REGEX_DETAIL_NS::do_make_u32regex(p, p + std::strlen(p), opt, static_cast<boost::mpl::int_<1> const*>(0));
|
||||
return BOOST_REGEX_DETAIL_NS::do_make_u32regex(p, p + std::strlen(p), opt, static_cast<std::integral_constant<int, 1> const*>(0));
|
||||
}
|
||||
inline u32regex make_u32regex(const unsigned char* p, boost::regex_constants::syntax_option_type opt = boost::regex_constants::perl)
|
||||
{
|
||||
return BOOST_REGEX_DETAIL_NS::do_make_u32regex(p, p + std::strlen(reinterpret_cast<const char*>(p)), opt, static_cast<boost::mpl::int_<1> const*>(0));
|
||||
return BOOST_REGEX_DETAIL_NS::do_make_u32regex(p, p + std::strlen(reinterpret_cast<const char*>(p)), opt, static_cast<std::integral_constant<int, 1> const*>(0));
|
||||
}
|
||||
//
|
||||
// construction from UTF-16 nul-terminated strings:
|
||||
@ -734,13 +739,13 @@ inline u32regex make_u32regex(const unsigned char* p, boost::regex_constants::sy
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
inline u32regex make_u32regex(const wchar_t* p, boost::regex_constants::syntax_option_type opt = boost::regex_constants::perl)
|
||||
{
|
||||
return BOOST_REGEX_DETAIL_NS::do_make_u32regex(p, p + std::wcslen(p), opt, static_cast<boost::mpl::int_<sizeof(wchar_t)> const*>(0));
|
||||
return BOOST_REGEX_DETAIL_NS::do_make_u32regex(p, p + std::wcslen(p), opt, static_cast<std::integral_constant<int, sizeof(wchar_t)> const*>(0));
|
||||
}
|
||||
#endif
|
||||
#if !BOOST_REGEX_UCHAR_IS_WCHAR_T
|
||||
inline u32regex make_u32regex(const UChar* p, boost::regex_constants::syntax_option_type opt = boost::regex_constants::perl)
|
||||
{
|
||||
return BOOST_REGEX_DETAIL_NS::do_make_u32regex(p, p + u_strlen(p), opt, static_cast<boost::mpl::int_<2> const*>(0));
|
||||
return BOOST_REGEX_DETAIL_NS::do_make_u32regex(p, p + u_strlen(p), opt, static_cast<std::integral_constant<int, 2> const*>(0));
|
||||
}
|
||||
#endif
|
||||
//
|
||||
@ -749,14 +754,14 @@ inline u32regex make_u32regex(const UChar* p, boost::regex_constants::syntax_opt
|
||||
template<class C, class T, class A>
|
||||
inline u32regex make_u32regex(const std::basic_string<C, T, A>& s, boost::regex_constants::syntax_option_type opt = boost::regex_constants::perl)
|
||||
{
|
||||
return BOOST_REGEX_DETAIL_NS::do_make_u32regex(s.begin(), s.end(), opt, static_cast<boost::mpl::int_<sizeof(C)> const*>(0));
|
||||
return BOOST_REGEX_DETAIL_NS::do_make_u32regex(s.begin(), s.end(), opt, static_cast<std::integral_constant<int, sizeof(C)> const*>(0));
|
||||
}
|
||||
//
|
||||
// Construction from ICU string type:
|
||||
//
|
||||
inline u32regex make_u32regex(const U_NAMESPACE_QUALIFIER UnicodeString& s, boost::regex_constants::syntax_option_type opt = boost::regex_constants::perl)
|
||||
{
|
||||
return BOOST_REGEX_DETAIL_NS::do_make_u32regex(s.getBuffer(), s.getBuffer() + s.length(), opt, static_cast<boost::mpl::int_<2> const*>(0));
|
||||
return BOOST_REGEX_DETAIL_NS::do_make_u32regex(s.getBuffer(), s.getBuffer() + s.length(), opt, static_cast<std::integral_constant<int, 2> const*>(0));
|
||||
}
|
||||
|
||||
//
|
||||
@ -1222,7 +1227,7 @@ OutputIterator do_regex_replace(OutputIterator out,
|
||||
if(i == j)
|
||||
{
|
||||
if(!(flags & regex_constants::format_no_copy))
|
||||
out = BOOST_REGEX_DETAIL_NS::copy(in.first, in.second, out);
|
||||
out = std::copy(in.first, in.second, out);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1230,7 +1235,7 @@ OutputIterator do_regex_replace(OutputIterator out,
|
||||
while(i != j)
|
||||
{
|
||||
if(!(flags & regex_constants::format_no_copy))
|
||||
out = BOOST_REGEX_DETAIL_NS::copy(i->prefix().first, i->prefix().second, out);
|
||||
out = std::copy(i->prefix().first, i->prefix().second, out);
|
||||
if(!f.empty())
|
||||
out = ::boost::BOOST_REGEX_DETAIL_NS::regex_format_imp(out, *i, &*f.begin(), &*f.begin() + f.size(), flags, e.get_traits());
|
||||
else
|
||||
@ -1241,7 +1246,7 @@ OutputIterator do_regex_replace(OutputIterator out,
|
||||
++i;
|
||||
}
|
||||
if(!(flags & regex_constants::format_no_copy))
|
||||
out = BOOST_REGEX_DETAIL_NS::copy(last_m, in.second, out);
|
||||
out = std::copy(last_m, in.second, out);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
@ -19,14 +19,24 @@
|
||||
#ifndef BOOST_REGEX_OBJECT_CACHE_HPP
|
||||
#define BOOST_REGEX_OBJECT_CACHE_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/regex/config.hpp>
|
||||
#ifdef BOOST_REGEX_CXX03
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#define BOOST_REGEX_SHARED_PTR_NS boost
|
||||
#else
|
||||
#include <memory>
|
||||
#define BOOST_REGEX_SHARED_PTR_NS std
|
||||
#endif
|
||||
#include <map>
|
||||
#include <list>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#ifdef BOOST_HAS_THREADS
|
||||
#ifdef BOOST_REGEX_CXX03
|
||||
#include <boost/regex/pending/static_mutex.hpp>
|
||||
#else
|
||||
#include <mutex>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
@ -35,16 +45,16 @@ template <class Key, class Object>
|
||||
class object_cache
|
||||
{
|
||||
public:
|
||||
typedef std::pair< ::boost::shared_ptr<Object const>, Key const*> value_type;
|
||||
typedef std::pair< BOOST_REGEX_SHARED_PTR_NS::shared_ptr<Object const>, Key const*> value_type;
|
||||
typedef std::list<value_type> list_type;
|
||||
typedef typename list_type::iterator list_iterator;
|
||||
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 l_max_cache_size);
|
||||
static BOOST_REGEX_SHARED_PTR_NS::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 l_max_cache_size);
|
||||
static BOOST_REGEX_SHARED_PTR_NS::shared_ptr<Object const> do_get(const Key& k, size_type l_max_cache_size);
|
||||
|
||||
struct data
|
||||
{
|
||||
@ -62,13 +72,13 @@ private:
|
||||
#pragma warning(disable: 4702)
|
||||
#endif
|
||||
template <class Key, class Object>
|
||||
boost::shared_ptr<Object const> object_cache<Key, Object>::get(const Key& k, size_type l_max_cache_size)
|
||||
BOOST_REGEX_SHARED_PTR_NS::shared_ptr<Object const> object_cache<Key, Object>::get(const Key& k, size_type l_max_cache_size)
|
||||
{
|
||||
#ifdef BOOST_HAS_THREADS
|
||||
#ifdef BOOST_REGEX_CXX03
|
||||
static boost::static_mutex mut = BOOST_STATIC_MUTEX_INIT;
|
||||
|
||||
boost::static_mutex::scoped_lock l(mut);
|
||||
if(l)
|
||||
if (l)
|
||||
{
|
||||
return do_get(k, l_max_cache_size);
|
||||
}
|
||||
@ -78,7 +88,12 @@ boost::shared_ptr<Object const> object_cache<Key, Object>::get(const Key& k, siz
|
||||
//
|
||||
::boost::throw_exception(std::runtime_error("Error in thread safety code: could not acquire a lock"));
|
||||
#if defined(BOOST_NO_UNREACHABLE_RETURN_DETECTION) || defined(BOOST_NO_EXCEPTIONS)
|
||||
return boost::shared_ptr<Object>();
|
||||
return BOOST_REGEX_SHARED_PTR_NS::shared_ptr<Object>();
|
||||
#endif
|
||||
#else
|
||||
static std::mutex mut;
|
||||
std::lock_guard<std::mutex> l(mut);
|
||||
return do_get(k, l_max_cache_size);
|
||||
#endif
|
||||
#else
|
||||
return do_get(k, l_max_cache_size);
|
||||
@ -89,7 +104,7 @@ boost::shared_ptr<Object const> object_cache<Key, Object>::get(const Key& k, siz
|
||||
#endif
|
||||
|
||||
template <class Key, class Object>
|
||||
boost::shared_ptr<Object const> object_cache<Key, Object>::do_get(const Key& k, size_type l_max_cache_size)
|
||||
BOOST_REGEX_SHARED_PTR_NS::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;
|
||||
@ -112,11 +127,11 @@ boost::shared_ptr<Object const> object_cache<Key, Object>::do_get(const Key& k,
|
||||
temp.splice(temp.end(), s_data.cont, mpos->second);
|
||||
// and now place it at the end of the list:
|
||||
s_data.cont.splice(s_data.cont.end(), temp, temp.begin());
|
||||
BOOST_ASSERT(*(s_data.cont.back().second) == k);
|
||||
BOOST_REGEX_ASSERT(*(s_data.cont.back().second) == k);
|
||||
// update index with new position:
|
||||
mpos->second = --(s_data.cont.end());
|
||||
BOOST_ASSERT(&(mpos->first) == mpos->second->second);
|
||||
BOOST_ASSERT(&(mpos->first) == s_data.cont.back().second);
|
||||
BOOST_REGEX_ASSERT(&(mpos->first) == mpos->second->second);
|
||||
BOOST_REGEX_ASSERT(&(mpos->first) == s_data.cont.back().second);
|
||||
}
|
||||
return s_data.cont.back().first;
|
||||
}
|
||||
@ -124,7 +139,7 @@ boost::shared_ptr<Object const> object_cache<Key, Object>::do_get(const Key& k,
|
||||
// if we get here then the item is not in the cache,
|
||||
// so create it:
|
||||
//
|
||||
boost::shared_ptr<Object const> result(new Object(k));
|
||||
BOOST_REGEX_SHARED_PTR_NS::shared_ptr<Object const> result(new Object(k));
|
||||
//
|
||||
// Add it to the list, and index it:
|
||||
//
|
||||
@ -132,9 +147,9 @@ boost::shared_ptr<Object const> object_cache<Key, Object>::do_get(const Key& k,
|
||||
s_data.index.insert(std::make_pair(k, --(s_data.cont.end())));
|
||||
s_data.cont.back().second = &(s_data.index.find(k)->first);
|
||||
map_size_type s = s_data.index.size();
|
||||
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);
|
||||
BOOST_REGEX_ASSERT(s_data.index[k]->first.get() == result.get());
|
||||
BOOST_REGEX_ASSERT(&(s_data.index.find(k)->first) == s_data.cont.back().second);
|
||||
BOOST_REGEX_ASSERT(s_data.index.find(k)->first == k);
|
||||
if(s > l_max_cache_size)
|
||||
{
|
||||
//
|
||||
@ -152,7 +167,7 @@ boost::shared_ptr<Object const> object_cache<Key, Object>::do_get(const Key& k,
|
||||
++pos;
|
||||
// now remove the items from our containers,
|
||||
// then order has to be as follows:
|
||||
BOOST_ASSERT(s_data.index.find(*(condemmed->second)) != s_data.index.end());
|
||||
BOOST_REGEX_ASSERT(s_data.index.find(*(condemmed->second)) != s_data.index.end());
|
||||
s_data.index.erase(*(condemmed->second));
|
||||
s_data.cont.erase(condemmed);
|
||||
--s;
|
||||
@ -160,13 +175,13 @@ boost::shared_ptr<Object const> object_cache<Key, Object>::do_get(const Key& k,
|
||||
else
|
||||
++pos;
|
||||
}
|
||||
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);
|
||||
BOOST_REGEX_ASSERT(s_data.index[k]->first.get() == result.get());
|
||||
BOOST_REGEX_ASSERT(&(s_data.index.find(k)->first) == s_data.cont.back().second);
|
||||
BOOST_REGEX_ASSERT(s_data.index.find(k)->first == k);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
#undef BOOST_REGEX_SHARED_PTR_NS
|
||||
|
||||
#endif
|
||||
|
@ -61,7 +61,7 @@ Accepts UTF-32 code points and forwards them on as UTF-16 code points.
|
||||
#ifndef BOOST_REGEX_UNICODE_ITERATOR_HPP
|
||||
#define BOOST_REGEX_UNICODE_ITERATOR_HPP
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/regex/config.hpp>
|
||||
#include <boost/iterator/iterator_facade.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
@ -232,8 +232,8 @@ private:
|
||||
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]));
|
||||
BOOST_REGEX_ASSERT(detail::is_high_surrogate(m_values[0]));
|
||||
BOOST_REGEX_ASSERT(detail::is_low_surrogate(m_values[1]));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -617,32 +617,32 @@ public:
|
||||
//
|
||||
const BOOST_REGEX_DETAIL_NS::re_syntax_base* get_first_state()const
|
||||
{
|
||||
BOOST_ASSERT(0 != m_pimpl.get());
|
||||
BOOST_REGEX_ASSERT(0 != m_pimpl.get());
|
||||
return m_pimpl->get_first_state();
|
||||
}
|
||||
unsigned get_restart_type()const
|
||||
{
|
||||
BOOST_ASSERT(0 != m_pimpl.get());
|
||||
BOOST_REGEX_ASSERT(0 != m_pimpl.get());
|
||||
return m_pimpl->get_restart_type();
|
||||
}
|
||||
const unsigned char* get_map()const
|
||||
{
|
||||
BOOST_ASSERT(0 != m_pimpl.get());
|
||||
BOOST_REGEX_ASSERT(0 != m_pimpl.get());
|
||||
return m_pimpl->get_map();
|
||||
}
|
||||
const ::boost::regex_traits_wrapper<traits>& get_traits()const
|
||||
{
|
||||
BOOST_ASSERT(0 != m_pimpl.get());
|
||||
BOOST_REGEX_ASSERT(0 != m_pimpl.get());
|
||||
return m_pimpl->get_traits();
|
||||
}
|
||||
bool can_be_null()const
|
||||
{
|
||||
BOOST_ASSERT(0 != m_pimpl.get());
|
||||
BOOST_REGEX_ASSERT(0 != m_pimpl.get());
|
||||
return m_pimpl->can_be_null();
|
||||
}
|
||||
const BOOST_REGEX_DETAIL_NS::regex_data<charT, traits>& get_data()const
|
||||
{
|
||||
BOOST_ASSERT(0 != m_pimpl.get());
|
||||
BOOST_REGEX_ASSERT(0 != m_pimpl.get());
|
||||
return m_pimpl->get_data();
|
||||
}
|
||||
boost::shared_ptr<BOOST_REGEX_DETAIL_NS::named_subexpressions > get_named_subs()const
|
||||
|
@ -58,8 +58,8 @@ struct digraph : public std::pair<charT, charT>
|
||||
template <class Seq>
|
||||
digraph(const Seq& s) : std::pair<charT, charT>()
|
||||
{
|
||||
BOOST_ASSERT(s.size() <= 2);
|
||||
BOOST_ASSERT(s.size());
|
||||
BOOST_REGEX_ASSERT(s.size() <= 2);
|
||||
BOOST_REGEX_ASSERT(s.size());
|
||||
this->first = s[0];
|
||||
this->second = (s.size() > 1) ? s[1] : 0;
|
||||
}
|
||||
@ -288,11 +288,11 @@ basic_regex_creator<charT, traits>::basic_regex_creator(regex_data<charT, traits
|
||||
m_upper_mask = m_traits.lookup_classname(u, u + 5);
|
||||
m_alpha_mask = m_traits.lookup_classname(a, a + 5);
|
||||
m_pdata->m_word_mask = m_word_mask;
|
||||
BOOST_ASSERT(m_word_mask != 0);
|
||||
BOOST_ASSERT(m_mask_space != 0);
|
||||
BOOST_ASSERT(m_lower_mask != 0);
|
||||
BOOST_ASSERT(m_upper_mask != 0);
|
||||
BOOST_ASSERT(m_alpha_mask != 0);
|
||||
BOOST_REGEX_ASSERT(m_word_mask != 0);
|
||||
BOOST_REGEX_ASSERT(m_mask_space != 0);
|
||||
BOOST_REGEX_ASSERT(m_lower_mask != 0);
|
||||
BOOST_REGEX_ASSERT(m_upper_mask != 0);
|
||||
BOOST_REGEX_ASSERT(m_alpha_mask != 0);
|
||||
}
|
||||
|
||||
template <class charT, class traits>
|
||||
@ -580,7 +580,7 @@ re_syntax_base* basic_regex_creator<charT, traits>::append_set(
|
||||
// Oops error:
|
||||
return 0;
|
||||
}
|
||||
BOOST_ASSERT(c3[1] == charT(0));
|
||||
BOOST_REGEX_ASSERT(c3[1] == charT(0));
|
||||
for(unsigned i = 0; i < (1u << CHAR_BIT); ++i)
|
||||
{
|
||||
c3[0] = static_cast<charT>(i);
|
||||
@ -645,7 +645,7 @@ re_syntax_base* basic_regex_creator<charT, traits>::append_set(
|
||||
while(sfirst != slast)
|
||||
{
|
||||
string_type s;
|
||||
BOOST_ASSERT(static_cast<charT>(0) == sfirst->second);
|
||||
BOOST_REGEX_ASSERT(static_cast<charT>(0) == sfirst->second);
|
||||
s = m_traits.transform_primary(&sfirst->first, &sfirst->first+1);
|
||||
if(s.empty())
|
||||
return 0; // invalid or unsupported equivalence class
|
||||
@ -1038,7 +1038,7 @@ int basic_regex_creator<charT, traits>::calculate_backstep(re_syntax_base* state
|
||||
}
|
||||
else if(state->type == syntax_element_long_set_rep)
|
||||
{
|
||||
BOOST_ASSERT(rep->next.p->type == syntax_element_long_set);
|
||||
BOOST_REGEX_ASSERT(rep->next.p->type == syntax_element_long_set);
|
||||
if(static_cast<re_set_long<m_type>*>(rep->next.p)->singleton == 0)
|
||||
return -1;
|
||||
if(rep->max != rep->min)
|
||||
@ -1138,7 +1138,7 @@ void basic_regex_creator<charT, traits>::create_startmap(re_syntax_base* state,
|
||||
}
|
||||
case syntax_element_recurse:
|
||||
{
|
||||
BOOST_ASSERT(static_cast<const re_jump*>(state)->alt.p->type == syntax_element_startmark);
|
||||
BOOST_REGEX_ASSERT(static_cast<const re_jump*>(state)->alt.p->type == syntax_element_startmark);
|
||||
recursion_sub = static_cast<re_brace*>(static_cast<const re_jump*>(state)->alt.p)->index;
|
||||
if(m_recursion_checks[recursion_sub] & 1u)
|
||||
{
|
||||
|
@ -1948,7 +1948,7 @@ charT basic_regex_parser<charT, traits>::unescape_character()
|
||||
template <class charT, class traits>
|
||||
bool basic_regex_parser<charT, traits>::parse_backref()
|
||||
{
|
||||
BOOST_ASSERT(m_position != m_end);
|
||||
BOOST_REGEX_ASSERT(m_position != m_end);
|
||||
const charT* pc = m_position;
|
||||
boost::intmax_t i = this->m_traits.toi(pc, pc + 1, 10);
|
||||
if((i == 0) || (((this->flags() & regbase::main_option_type) == regbase::perl_syntax_group) && (this->flags() & regbase::no_bk_refs)))
|
||||
@ -2609,7 +2609,7 @@ option_group_jump:
|
||||
this->fail(regex_constants::error_paren, ::boost::BOOST_REGEX_DETAIL_NS::distance(m_base, m_end));
|
||||
return false;
|
||||
}
|
||||
BOOST_ASSERT(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_close_mark);
|
||||
BOOST_REGEX_ASSERT(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_close_mark);
|
||||
++m_position;
|
||||
//
|
||||
// restore the flags:
|
||||
@ -3137,7 +3137,7 @@ bool basic_regex_parser<charT, traits>::unwind_alts(std::ptrdiff_t last_paren_st
|
||||
m_alt_jumps.pop_back();
|
||||
this->m_pdata->m_data.align();
|
||||
re_jump* jmp = static_cast<re_jump*>(this->getaddress(jump_offset));
|
||||
BOOST_ASSERT(jmp->type == syntax_element_jump);
|
||||
BOOST_REGEX_ASSERT(jmp->type == syntax_element_jump);
|
||||
jmp->alt.i = this->m_pdata->m_data.size() - jump_offset;
|
||||
}
|
||||
return true;
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <boost/regex/config.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_WORKAROUND_HPP
|
||||
#include <boost/regex/v5/regex_workaround.hpp>
|
||||
#include <boost/regex/v4/regex_workaround.hpp>
|
||||
#endif
|
||||
|
||||
#include <cctype>
|
||||
@ -277,7 +277,7 @@ inline c_regex_traits<char>::char_class_type BOOST_REGEX_CALL c_regex_traits<cha
|
||||
s[i] = static_cast<char>((std::tolower)(static_cast<unsigned char>(s[i])));
|
||||
idx = ::boost::BOOST_REGEX_DETAIL_NS::get_default_class_id(&*s.begin(), &*s.begin() + s.size());
|
||||
}
|
||||
BOOST_ASSERT(std::size_t(idx) + 1u < sizeof(masks) / sizeof(masks[0]));
|
||||
BOOST_REGEX_ASSERT(std::size_t(idx) + 1u < sizeof(masks) / sizeof(masks[0]));
|
||||
return masks[idx + 1];
|
||||
}
|
||||
|
||||
@ -433,7 +433,7 @@ inline c_regex_traits<wchar_t>::char_class_type BOOST_REGEX_CALL c_regex_traits<
|
||||
s[i] = (std::towlower)(s[i]);
|
||||
idx = ::boost::BOOST_REGEX_DETAIL_NS::get_default_class_id(&*s.begin(), &*s.begin() + s.size());
|
||||
}
|
||||
BOOST_ASSERT(idx + 1 < static_cast<int>(sizeof(masks) / sizeof(masks[0])));
|
||||
BOOST_REGEX_ASSERT(idx + 1 < static_cast<int>(sizeof(masks) / sizeof(masks[0])));
|
||||
return masks[idx + 1];
|
||||
}
|
||||
|
||||
|
@ -29,16 +29,16 @@
|
||||
#include <boost/regex/pattern_except.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_TRAITS_DEFAULTS_HPP_INCLUDED
|
||||
#include <boost/regex/v5/regex_traits_defaults.hpp>
|
||||
#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/v5/primary_transform.hpp>
|
||||
#include <boost/regex/v4/primary_transform.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_OBJECT_CACHE_HPP
|
||||
#include <boost/regex/pending/object_cache.hpp>
|
||||
#include <boost/regex/v4/object_cache.hpp>
|
||||
#endif
|
||||
|
||||
#include <climits>
|
||||
@ -508,7 +508,7 @@ typename cpp_regex_traits_implementation<charT>::string_type
|
||||
// we work around this elsewhere, but just assert here that
|
||||
// we adhere to gcc's (buggy) preconditions...
|
||||
//
|
||||
BOOST_ASSERT(*p2 == 0);
|
||||
BOOST_REGEX_ASSERT(*p2 == 0);
|
||||
string_type result;
|
||||
#if defined(_CPPLIB_VER)
|
||||
//
|
||||
@ -588,7 +588,7 @@ typename cpp_regex_traits_implementation<charT>::string_type
|
||||
// we work around this elsewhere, but just assert here that
|
||||
// we adhere to gcc's (buggy) preconditions...
|
||||
//
|
||||
BOOST_ASSERT(*p2 == 0);
|
||||
BOOST_REGEX_ASSERT(*p2 == 0);
|
||||
//
|
||||
// swallowing all exceptions here is a bad idea
|
||||
// however at least one std lib will always throw
|
||||
@ -646,7 +646,7 @@ typename cpp_regex_traits_implementation<charT>::string_type
|
||||
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());
|
||||
BOOST_REGEX_ASSERT(std::find(result2.begin(), result2.end(), charT(0)) == result2.end());
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
}
|
||||
catch(...)
|
||||
@ -872,7 +872,7 @@ typename cpp_regex_traits_implementation<charT>::char_class_type
|
||||
return pos->second;
|
||||
}
|
||||
std::size_t state_id = 1 + BOOST_REGEX_DETAIL_NS::get_default_class_id(p1, p2);
|
||||
BOOST_ASSERT(state_id < sizeof(masks) / sizeof(masks[0]));
|
||||
BOOST_REGEX_ASSERT(state_id < sizeof(masks) / sizeof(masks[0]));
|
||||
return masks[state_id];
|
||||
}
|
||||
|
||||
|
@ -474,7 +474,7 @@ public:
|
||||
// private access functions:
|
||||
void BOOST_REGEX_CALL set_second(BidiIterator i)
|
||||
{
|
||||
BOOST_ASSERT(m_subs.size() > 2);
|
||||
BOOST_REGEX_ASSERT(m_subs.size() > 2);
|
||||
m_subs[2].second = i;
|
||||
m_subs[2].matched = true;
|
||||
m_subs[0].first = i;
|
||||
@ -490,7 +490,7 @@ public:
|
||||
if(pos)
|
||||
m_last_closed_paren = static_cast<int>(pos);
|
||||
pos += 2;
|
||||
BOOST_ASSERT(m_subs.size() > pos);
|
||||
BOOST_REGEX_ASSERT(m_subs.size() > pos);
|
||||
m_subs[pos].second = i;
|
||||
m_subs[pos].matched = m;
|
||||
if((pos == 2) && !escape_k)
|
||||
@ -531,7 +531,7 @@ public:
|
||||
}
|
||||
void BOOST_REGEX_CALL set_first(BidiIterator i)
|
||||
{
|
||||
BOOST_ASSERT(m_subs.size() > 2);
|
||||
BOOST_REGEX_ASSERT(m_subs.size() > 2);
|
||||
// set up prefix:
|
||||
m_subs[1].second = i;
|
||||
m_subs[1].matched = (m_subs[1].first != i);
|
||||
@ -546,7 +546,7 @@ public:
|
||||
}
|
||||
void BOOST_REGEX_CALL set_first(BidiIterator i, size_type pos, bool escape_k = false)
|
||||
{
|
||||
BOOST_ASSERT(pos+2 < m_subs.size());
|
||||
BOOST_REGEX_ASSERT(pos+2 < m_subs.size());
|
||||
if(pos || escape_k)
|
||||
{
|
||||
m_subs[pos+2].first = i;
|
||||
@ -650,15 +650,15 @@ void BOOST_REGEX_CALL match_results<BidiIterator, Allocator>::maybe_assign(const
|
||||
}
|
||||
base1 = ::boost::BOOST_REGEX_DETAIL_NS::distance(l_base, p1->first);
|
||||
base2 = ::boost::BOOST_REGEX_DETAIL_NS::distance(l_base, p2->first);
|
||||
BOOST_ASSERT(base1 >= 0);
|
||||
BOOST_ASSERT(base2 >= 0);
|
||||
BOOST_REGEX_ASSERT(base1 >= 0);
|
||||
BOOST_REGEX_ASSERT(base2 >= 0);
|
||||
if(base1 < base2) return;
|
||||
if(base2 < base1) break;
|
||||
|
||||
len1 = ::boost::BOOST_REGEX_DETAIL_NS::distance((BidiIterator)p1->first, (BidiIterator)p1->second);
|
||||
len2 = ::boost::BOOST_REGEX_DETAIL_NS::distance((BidiIterator)p2->first, (BidiIterator)p2->second);
|
||||
BOOST_ASSERT(len1 >= 0);
|
||||
BOOST_ASSERT(len2 >= 0);
|
||||
BOOST_REGEX_ASSERT(len1 >= 0);
|
||||
BOOST_REGEX_ASSERT(len2 >= 0);
|
||||
if((len1 != len2) || ((p1->matched == false) && (p2->matched == true)))
|
||||
break;
|
||||
if((p1->matched == true) && (p2->matched == false))
|
||||
|
@ -622,7 +622,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_backref()
|
||||
if(index >= hash_value_mask)
|
||||
{
|
||||
named_subexpressions::range_type r = re.get_data().equal_range(index);
|
||||
BOOST_ASSERT(r.first != r.second);
|
||||
BOOST_REGEX_ASSERT(r.first != r.second);
|
||||
do
|
||||
{
|
||||
index = r.first->index;
|
||||
|
@ -111,7 +111,7 @@ struct save_state_init
|
||||
*end = reinterpret_cast<saved_state*>(reinterpret_cast<char*>(*base)+BOOST_REGEX_BLOCKSIZE);
|
||||
--(*end);
|
||||
(void) new (*end)saved_state(0);
|
||||
BOOST_ASSERT(*end > *base);
|
||||
BOOST_REGEX_ASSERT(*end > *base);
|
||||
}
|
||||
~save_state_init()
|
||||
{
|
||||
@ -248,7 +248,7 @@ void perl_matcher<BidiIterator, Allocator, traits>::extend_stack()
|
||||
template <class BidiIterator, class Allocator, class traits>
|
||||
inline void perl_matcher<BidiIterator, Allocator, traits>::push_matched_paren(int index, const sub_match<BidiIterator>& sub)
|
||||
{
|
||||
//BOOST_ASSERT(index);
|
||||
//BOOST_REGEX_ASSERT(index);
|
||||
saved_matched_paren<BidiIterator>* pmp = static_cast<saved_matched_paren<BidiIterator>*>(m_backup_state);
|
||||
--pmp;
|
||||
if(pmp < m_stack_base)
|
||||
@ -264,7 +264,7 @@ inline void perl_matcher<BidiIterator, Allocator, traits>::push_matched_paren(in
|
||||
template <class BidiIterator, class Allocator, class traits>
|
||||
inline void perl_matcher<BidiIterator, Allocator, traits>::push_case_change(bool c)
|
||||
{
|
||||
//BOOST_ASSERT(index);
|
||||
//BOOST_REGEX_ASSERT(index);
|
||||
saved_change_case* pmp = static_cast<saved_change_case*>(m_backup_state);
|
||||
--pmp;
|
||||
if(pmp < m_stack_base)
|
||||
@ -492,7 +492,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_startmark()
|
||||
{
|
||||
// conditional expression:
|
||||
const re_alt* alt = static_cast<const re_alt*>(pstate->next.p);
|
||||
BOOST_ASSERT(alt->type == syntax_element_alt);
|
||||
BOOST_REGEX_ASSERT(alt->type == syntax_element_alt);
|
||||
pstate = alt->next.p;
|
||||
if(pstate->type == syntax_element_assert_backref)
|
||||
{
|
||||
@ -503,7 +503,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_startmark()
|
||||
else
|
||||
{
|
||||
// zero width assertion, have to match this recursively:
|
||||
BOOST_ASSERT(pstate->type == syntax_element_startmark);
|
||||
BOOST_REGEX_ASSERT(pstate->type == syntax_element_startmark);
|
||||
bool negated = static_cast<const re_brace*>(pstate)->index == -2;
|
||||
BidiIterator saved_position = position;
|
||||
const re_syntax_base* next_pstate = static_cast<const re_jump*>(pstate->next.p)->alt.p->next.p;
|
||||
@ -543,7 +543,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_startmark()
|
||||
}
|
||||
default:
|
||||
{
|
||||
BOOST_ASSERT(index > 0);
|
||||
BOOST_REGEX_ASSERT(index > 0);
|
||||
if((m_match_flags & match_nosubs) == 0)
|
||||
{
|
||||
push_matched_paren(index, (*m_presult)[index]);
|
||||
@ -794,7 +794,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_char_repeat()
|
||||
#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);
|
||||
BOOST_REGEX_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;
|
||||
//
|
||||
@ -1010,7 +1010,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_long_set_repeat()
|
||||
template <class BidiIterator, class Allocator, class traits>
|
||||
bool perl_matcher<BidiIterator, Allocator, traits>::match_recursion()
|
||||
{
|
||||
BOOST_ASSERT(pstate->type == syntax_element_recurse);
|
||||
BOOST_REGEX_ASSERT(pstate->type == syntax_element_recurse);
|
||||
//
|
||||
// See if we've seen this recursion before at this location, if we have then
|
||||
// we need to prevent infinite recursion:
|
||||
@ -1087,7 +1087,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_match()
|
||||
{
|
||||
if(!recursion_stack.empty())
|
||||
{
|
||||
BOOST_ASSERT(0 == recursion_stack.back().idx);
|
||||
BOOST_REGEX_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;
|
||||
@ -1394,15 +1394,15 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_greedy_single_repeat(
|
||||
|
||||
const re_repeat* rep = pmp->rep;
|
||||
std::size_t count = pmp->count;
|
||||
BOOST_ASSERT(rep->next.p != 0);
|
||||
BOOST_ASSERT(rep->alt.p != 0);
|
||||
BOOST_REGEX_ASSERT(rep->next.p != 0);
|
||||
BOOST_REGEX_ASSERT(rep->alt.p != 0);
|
||||
|
||||
count -= rep->min;
|
||||
|
||||
if((m_match_flags & match_partial) && (position == last))
|
||||
m_has_partial_match = true;
|
||||
|
||||
BOOST_ASSERT(count);
|
||||
BOOST_REGEX_ASSERT(count);
|
||||
position = pmp->last_position;
|
||||
|
||||
// backtrack till we can skip out:
|
||||
@ -1443,12 +1443,12 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_slow_dot_repeat(bool
|
||||
|
||||
const re_repeat* rep = pmp->rep;
|
||||
std::size_t count = pmp->count;
|
||||
BOOST_ASSERT(rep->type == syntax_element_dot_rep);
|
||||
BOOST_ASSERT(rep->next.p != 0);
|
||||
BOOST_ASSERT(rep->alt.p != 0);
|
||||
BOOST_ASSERT(rep->next.p->type == syntax_element_wild);
|
||||
BOOST_REGEX_ASSERT(rep->type == syntax_element_dot_rep);
|
||||
BOOST_REGEX_ASSERT(rep->next.p != 0);
|
||||
BOOST_REGEX_ASSERT(rep->alt.p != 0);
|
||||
BOOST_REGEX_ASSERT(rep->next.p->type == syntax_element_wild);
|
||||
|
||||
BOOST_ASSERT(count < rep->max);
|
||||
BOOST_REGEX_ASSERT(count < rep->max);
|
||||
pstate = rep->next.p;
|
||||
position = pmp->last_position;
|
||||
|
||||
@ -1508,7 +1508,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_fast_dot_repeat(bool
|
||||
const re_repeat* rep = pmp->rep;
|
||||
std::size_t count = pmp->count;
|
||||
|
||||
BOOST_ASSERT(count < rep->max);
|
||||
BOOST_REGEX_ASSERT(count < rep->max);
|
||||
position = pmp->last_position;
|
||||
if(position != last)
|
||||
{
|
||||
@ -1568,11 +1568,11 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_char_repeat(bool r)
|
||||
const char_type what = *reinterpret_cast<const char_type*>(static_cast<const re_literal*>(pstate) + 1);
|
||||
position = pmp->last_position;
|
||||
|
||||
BOOST_ASSERT(rep->type == syntax_element_char_rep);
|
||||
BOOST_ASSERT(rep->next.p != 0);
|
||||
BOOST_ASSERT(rep->alt.p != 0);
|
||||
BOOST_ASSERT(rep->next.p->type == syntax_element_literal);
|
||||
BOOST_ASSERT(count < rep->max);
|
||||
BOOST_REGEX_ASSERT(rep->type == syntax_element_char_rep);
|
||||
BOOST_REGEX_ASSERT(rep->next.p != 0);
|
||||
BOOST_REGEX_ASSERT(rep->alt.p != 0);
|
||||
BOOST_REGEX_ASSERT(rep->next.p->type == syntax_element_literal);
|
||||
BOOST_REGEX_ASSERT(count < rep->max);
|
||||
|
||||
if(position != last)
|
||||
{
|
||||
@ -1637,11 +1637,11 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_short_set_repeat(bool
|
||||
const unsigned char* map = static_cast<const re_set*>(rep->next.p)->_map;
|
||||
position = pmp->last_position;
|
||||
|
||||
BOOST_ASSERT(rep->type == syntax_element_short_set_rep);
|
||||
BOOST_ASSERT(rep->next.p != 0);
|
||||
BOOST_ASSERT(rep->alt.p != 0);
|
||||
BOOST_ASSERT(rep->next.p->type == syntax_element_set);
|
||||
BOOST_ASSERT(count < rep->max);
|
||||
BOOST_REGEX_ASSERT(rep->type == syntax_element_short_set_rep);
|
||||
BOOST_REGEX_ASSERT(rep->next.p != 0);
|
||||
BOOST_REGEX_ASSERT(rep->alt.p != 0);
|
||||
BOOST_REGEX_ASSERT(rep->next.p->type == syntax_element_set);
|
||||
BOOST_REGEX_ASSERT(count < rep->max);
|
||||
|
||||
if(position != last)
|
||||
{
|
||||
@ -1707,11 +1707,11 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_long_set_repeat(bool
|
||||
const re_set_long<m_type>* set = static_cast<const re_set_long<m_type>*>(pstate);
|
||||
position = pmp->last_position;
|
||||
|
||||
BOOST_ASSERT(rep->type == syntax_element_long_set_rep);
|
||||
BOOST_ASSERT(rep->next.p != 0);
|
||||
BOOST_ASSERT(rep->alt.p != 0);
|
||||
BOOST_ASSERT(rep->next.p->type == syntax_element_long_set);
|
||||
BOOST_ASSERT(count < rep->max);
|
||||
BOOST_REGEX_ASSERT(rep->type == syntax_element_long_set_rep);
|
||||
BOOST_REGEX_ASSERT(rep->next.p != 0);
|
||||
BOOST_REGEX_ASSERT(rep->alt.p != 0);
|
||||
BOOST_REGEX_ASSERT(rep->next.p->type == syntax_element_long_set);
|
||||
BOOST_REGEX_ASSERT(count < rep->max);
|
||||
|
||||
if(position != last)
|
||||
{
|
||||
|
@ -195,7 +195,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_startmark()
|
||||
{
|
||||
// conditional expression:
|
||||
const re_alt* alt = static_cast<const re_alt*>(pstate->next.p);
|
||||
BOOST_ASSERT(alt->type == syntax_element_alt);
|
||||
BOOST_REGEX_ASSERT(alt->type == syntax_element_alt);
|
||||
pstate = alt->next.p;
|
||||
if(pstate->type == syntax_element_assert_backref)
|
||||
{
|
||||
@ -206,7 +206,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_startmark()
|
||||
else
|
||||
{
|
||||
// zero width assertion, have to match this recursively:
|
||||
BOOST_ASSERT(pstate->type == syntax_element_startmark);
|
||||
BOOST_REGEX_ASSERT(pstate->type == syntax_element_startmark);
|
||||
bool negated = static_cast<const re_brace*>(pstate)->index == -2;
|
||||
BidiIterator saved_position = position;
|
||||
const re_syntax_base* next_pstate = static_cast<const re_jump*>(pstate->next.p)->alt.p->next.p;
|
||||
@ -235,7 +235,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_startmark()
|
||||
}
|
||||
default:
|
||||
{
|
||||
BOOST_ASSERT(index > 0);
|
||||
BOOST_REGEX_ASSERT(index > 0);
|
||||
if((m_match_flags & match_nosubs) == 0)
|
||||
{
|
||||
backup_subex<BidiIterator> sub(*m_presult, index);
|
||||
@ -552,7 +552,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_char_repeat()
|
||||
#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);
|
||||
BOOST_REGEX_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);
|
||||
//
|
||||
// start by working out how much we can skip:
|
||||
@ -892,7 +892,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::backtrack_till_match(std::si
|
||||
template <class BidiIterator, class Allocator, class traits>
|
||||
bool perl_matcher<BidiIterator, Allocator, traits>::match_recursion()
|
||||
{
|
||||
BOOST_ASSERT(pstate->type == syntax_element_recurse);
|
||||
BOOST_REGEX_ASSERT(pstate->type == syntax_element_recurse);
|
||||
//
|
||||
// Set new call stack:
|
||||
//
|
||||
@ -987,7 +987,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_match()
|
||||
{
|
||||
if(!recursion_stack.empty())
|
||||
{
|
||||
BOOST_ASSERT(0 == recursion_stack.back().idx);
|
||||
BOOST_REGEX_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();
|
||||
|
@ -251,7 +251,7 @@ void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format
|
||||
m_have_conditional = have_conditional;
|
||||
if(m_position == m_end)
|
||||
return;
|
||||
BOOST_ASSERT(*m_position == static_cast<char_type>(')'));
|
||||
BOOST_REGEX_ASSERT(*m_position == static_cast<char_type>(')'));
|
||||
++m_position; // skip the closing ')'
|
||||
break;
|
||||
}
|
||||
@ -307,7 +307,7 @@ void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format
|
||||
// On entry *m_position points to a '$' character
|
||||
// output the information that goes with it:
|
||||
//
|
||||
BOOST_ASSERT(*m_position == '$');
|
||||
BOOST_REGEX_ASSERT(*m_position == '$');
|
||||
//
|
||||
// see if this is a trailing '$':
|
||||
//
|
||||
@ -656,7 +656,7 @@ void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format
|
||||
len = ::boost::BOOST_REGEX_DETAIL_NS::distance(m_position, m_end);
|
||||
len = (std::min)(static_cast<std::ptrdiff_t>(4), len);
|
||||
v = this->toi(m_position, m_position + len, 8);
|
||||
BOOST_ASSERT(v >= 0);
|
||||
BOOST_REGEX_ASSERT(v >= 0);
|
||||
put(static_cast<char_type>(v));
|
||||
break;
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ public:
|
||||
|
||||
void* BOOST_REGEX_CALL insert(size_type pos, size_type n)
|
||||
{
|
||||
BOOST_ASSERT(pos <= size_type(end - start));
|
||||
BOOST_REGEX_ASSERT(pos <= size_type(end - start));
|
||||
if (size_type(last - end) < n)
|
||||
resize(n + (end - start));
|
||||
void* result = start + pos;
|
||||
|
@ -34,12 +34,12 @@
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
#ifndef BOOST_REGEX_SYNTAX_TYPE_HPP
|
||||
#include <boost/regex/v5/syntax_type.hpp>
|
||||
#include <boost/regex/v4/syntax_type.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_ERROR_TYPE_HPP
|
||||
#include <boost/regex/v5/error_type.hpp>
|
||||
#include <boost/regex/v4/error_type.hpp>
|
||||
#endif
|
||||
#include <boost/regex/v5/regex_workaround.hpp>
|
||||
#include <boost/regex/v4/regex_workaround.hpp>
|
||||
#include <boost/type_traits/make_unsigned.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
|
||||
|
@ -25,16 +25,16 @@
|
||||
#include <boost/regex/pattern_except.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_TRAITS_DEFAULTS_HPP_INCLUDED
|
||||
#include <boost/regex/v5/regex_traits_defaults.hpp>
|
||||
#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/v5/primary_transform.hpp>
|
||||
#include <boost/regex/v4/primary_transform.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_OBJECT_CACHE_HPP
|
||||
#include <boost/regex/pending/object_cache.hpp>
|
||||
#include <boost/regex/v4/object_cache.hpp>
|
||||
#endif
|
||||
|
||||
#define VC_EXTRALEAN
|
||||
@ -794,21 +794,21 @@ namespace BOOST_REGEX_DETAIL_NS {
|
||||
char_map[ii] = static_cast<char>(ii);
|
||||
#ifndef BOOST_NO_ANSI_APIS
|
||||
int r = ::LCMapStringA(this->m_locale, LCMAP_LOWERCASE, char_map, 1 << CHAR_BIT, this->m_lower_map, 1 << CHAR_BIT);
|
||||
BOOST_ASSERT(r != 0);
|
||||
BOOST_REGEX_ASSERT(r != 0);
|
||||
#else
|
||||
UINT code_page = get_code_page_for_locale_id(this->m_locale);
|
||||
BOOST_ASSERT(code_page != 0);
|
||||
BOOST_REGEX_ASSERT(code_page != 0);
|
||||
|
||||
WCHAR wide_char_map[1 << CHAR_BIT];
|
||||
int conv_r = ::MultiByteToWideChar(code_page, 0, char_map, 1 << CHAR_BIT, wide_char_map, 1 << CHAR_BIT);
|
||||
BOOST_ASSERT(conv_r != 0);
|
||||
BOOST_REGEX_ASSERT(conv_r != 0);
|
||||
|
||||
WCHAR wide_lower_map[1 << CHAR_BIT];
|
||||
int r = ::LCMapStringW(this->m_locale, LCMAP_LOWERCASE, wide_char_map, 1 << CHAR_BIT, wide_lower_map, 1 << CHAR_BIT);
|
||||
BOOST_ASSERT(r != 0);
|
||||
BOOST_REGEX_ASSERT(r != 0);
|
||||
|
||||
conv_r = ::WideCharToMultiByte(code_page, 0, wide_lower_map, r, this->m_lower_map, 1 << CHAR_BIT, NULL, NULL);
|
||||
BOOST_ASSERT(conv_r != 0);
|
||||
BOOST_REGEX_ASSERT(conv_r != 0);
|
||||
#endif
|
||||
if (r < (1 << CHAR_BIT))
|
||||
{
|
||||
@ -823,7 +823,7 @@ namespace BOOST_REGEX_DETAIL_NS {
|
||||
#else
|
||||
r = ::GetStringTypeExW(this->m_locale, CT_CTYPE1, wide_char_map, 1 << CHAR_BIT, this->m_type_map);
|
||||
#endif
|
||||
BOOST_ASSERT(0 != r);
|
||||
BOOST_REGEX_ASSERT(0 != r);
|
||||
}
|
||||
|
||||
inline lcid_type BOOST_REGEX_CALL w32_get_default_locale()
|
||||
|
@ -19,9 +19,6 @@
|
||||
#ifndef BOOST_REGEX_V5_BASIC_REGEX_HPP
|
||||
#define BOOST_REGEX_V5_BASIC_REGEX_HPP
|
||||
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/container_hash/hash.hpp>
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4103)
|
||||
@ -33,6 +30,8 @@
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace boost{
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(push)
|
||||
@ -75,7 +74,12 @@ static const int hash_value_mask = 1 << (std::numeric_limits<int>::digits - 1);
|
||||
template <class Iterator>
|
||||
inline int hash_value_from_capture_name(Iterator i, Iterator j)
|
||||
{
|
||||
std::size_t r = boost::hash_range(i, j);
|
||||
std::size_t r = 0;
|
||||
while (i != j)
|
||||
{
|
||||
r ^= *i + 0x9e3779b9 + (r << 6) + (r >> 2);
|
||||
++i;
|
||||
}
|
||||
r %= ((std::numeric_limits<int>::max)());
|
||||
return static_cast<int>(r) | hash_value_mask;
|
||||
}
|
||||
@ -169,7 +173,7 @@ struct regex_data : public named_subexpressions
|
||||
typedef regex_constants::syntax_option_type flag_type;
|
||||
typedef std::size_t size_type;
|
||||
|
||||
regex_data(const ::boost::shared_ptr<
|
||||
regex_data(const ::std::shared_ptr<
|
||||
::boost::regex_traits_wrapper<traits> >& t)
|
||||
: m_ptraits(t), m_flags(0), m_status(0), m_expression(0), m_expression_len(0),
|
||||
m_mark_count(0), m_first_state(0), m_restart_type(0),
|
||||
@ -185,7 +189,7 @@ struct regex_data : public named_subexpressions
|
||||
#endif
|
||||
m_can_be_null(0), m_word_mask(0), m_has_recursions(false), m_disable_match_any(false) {}
|
||||
|
||||
::boost::shared_ptr<
|
||||
::std::shared_ptr<
|
||||
::boost::regex_traits_wrapper<traits>
|
||||
> m_ptraits; // traits class instance
|
||||
flag_type m_flags; // flags with which we were compiled
|
||||
@ -221,7 +225,7 @@ public:
|
||||
typedef const charT* const_iterator;
|
||||
|
||||
basic_regex_implementation(){}
|
||||
basic_regex_implementation(const ::boost::shared_ptr<
|
||||
basic_regex_implementation(const ::std::shared_ptr<
|
||||
::boost::regex_traits_wrapper<traits> >& t)
|
||||
: regex_data<charT, traits>(t) {}
|
||||
void assign(const charT* arg_first,
|
||||
@ -617,41 +621,41 @@ public:
|
||||
//
|
||||
const BOOST_REGEX_DETAIL_NS::re_syntax_base* get_first_state()const
|
||||
{
|
||||
BOOST_ASSERT(0 != m_pimpl.get());
|
||||
BOOST_REGEX_ASSERT(0 != m_pimpl.get());
|
||||
return m_pimpl->get_first_state();
|
||||
}
|
||||
unsigned get_restart_type()const
|
||||
{
|
||||
BOOST_ASSERT(0 != m_pimpl.get());
|
||||
BOOST_REGEX_ASSERT(0 != m_pimpl.get());
|
||||
return m_pimpl->get_restart_type();
|
||||
}
|
||||
const unsigned char* get_map()const
|
||||
{
|
||||
BOOST_ASSERT(0 != m_pimpl.get());
|
||||
BOOST_REGEX_ASSERT(0 != m_pimpl.get());
|
||||
return m_pimpl->get_map();
|
||||
}
|
||||
const ::boost::regex_traits_wrapper<traits>& get_traits()const
|
||||
{
|
||||
BOOST_ASSERT(0 != m_pimpl.get());
|
||||
BOOST_REGEX_ASSERT(0 != m_pimpl.get());
|
||||
return m_pimpl->get_traits();
|
||||
}
|
||||
bool can_be_null()const
|
||||
{
|
||||
BOOST_ASSERT(0 != m_pimpl.get());
|
||||
BOOST_REGEX_ASSERT(0 != m_pimpl.get());
|
||||
return m_pimpl->can_be_null();
|
||||
}
|
||||
const BOOST_REGEX_DETAIL_NS::regex_data<charT, traits>& get_data()const
|
||||
{
|
||||
BOOST_ASSERT(0 != m_pimpl.get());
|
||||
BOOST_REGEX_ASSERT(0 != m_pimpl.get());
|
||||
return m_pimpl->get_data();
|
||||
}
|
||||
boost::shared_ptr<BOOST_REGEX_DETAIL_NS::named_subexpressions > get_named_subs()const
|
||||
std::shared_ptr<BOOST_REGEX_DETAIL_NS::named_subexpressions > get_named_subs()const
|
||||
{
|
||||
return m_pimpl;
|
||||
}
|
||||
|
||||
private:
|
||||
shared_ptr<BOOST_REGEX_DETAIL_NS::basic_regex_implementation<charT, traits> > m_pimpl;
|
||||
std::shared_ptr<BOOST_REGEX_DETAIL_NS::basic_regex_implementation<charT, traits> > m_pimpl;
|
||||
};
|
||||
|
||||
//
|
||||
@ -665,14 +669,14 @@ basic_regex<charT, traits>& basic_regex<charT, traits>::do_assign(const charT* p
|
||||
const charT* p2,
|
||||
flag_type f)
|
||||
{
|
||||
shared_ptr<BOOST_REGEX_DETAIL_NS::basic_regex_implementation<charT, traits> > temp;
|
||||
std::shared_ptr<BOOST_REGEX_DETAIL_NS::basic_regex_implementation<charT, traits> > temp;
|
||||
if(!m_pimpl.get())
|
||||
{
|
||||
temp = shared_ptr<BOOST_REGEX_DETAIL_NS::basic_regex_implementation<charT, traits> >(new BOOST_REGEX_DETAIL_NS::basic_regex_implementation<charT, traits>());
|
||||
temp = std::shared_ptr<BOOST_REGEX_DETAIL_NS::basic_regex_implementation<charT, traits> >(new BOOST_REGEX_DETAIL_NS::basic_regex_implementation<charT, traits>());
|
||||
}
|
||||
else
|
||||
{
|
||||
temp = shared_ptr<BOOST_REGEX_DETAIL_NS::basic_regex_implementation<charT, traits> >(new BOOST_REGEX_DETAIL_NS::basic_regex_implementation<charT, traits>(m_pimpl->m_ptraits));
|
||||
temp = std::shared_ptr<BOOST_REGEX_DETAIL_NS::basic_regex_implementation<charT, traits> >(new BOOST_REGEX_DETAIL_NS::basic_regex_implementation<charT, traits>(m_pimpl->m_ptraits));
|
||||
}
|
||||
temp->assign(p1, p2, f);
|
||||
temp.swap(m_pimpl);
|
||||
@ -682,7 +686,7 @@ basic_regex<charT, traits>& basic_regex<charT, traits>::do_assign(const charT* p
|
||||
template <class charT, class traits>
|
||||
typename basic_regex<charT, traits>::locale_type BOOST_REGEX_CALL basic_regex<charT, traits>::imbue(locale_type l)
|
||||
{
|
||||
shared_ptr<BOOST_REGEX_DETAIL_NS::basic_regex_implementation<charT, traits> > temp(new BOOST_REGEX_DETAIL_NS::basic_regex_implementation<charT, traits>());
|
||||
std::shared_ptr<BOOST_REGEX_DETAIL_NS::basic_regex_implementation<charT, traits> > temp(new BOOST_REGEX_DETAIL_NS::basic_regex_implementation<charT, traits>());
|
||||
locale_type result = temp->imbue(l);
|
||||
temp.swap(m_pimpl);
|
||||
return result;
|
||||
|
@ -58,8 +58,8 @@ struct digraph : public std::pair<charT, charT>
|
||||
template <class Seq>
|
||||
digraph(const Seq& s) : std::pair<charT, charT>()
|
||||
{
|
||||
BOOST_ASSERT(s.size() <= 2);
|
||||
BOOST_ASSERT(s.size());
|
||||
BOOST_REGEX_ASSERT(s.size() <= 2);
|
||||
BOOST_REGEX_ASSERT(s.size());
|
||||
this->first = s[0];
|
||||
this->second = (s.size() > 1) ? s[1] : 0;
|
||||
}
|
||||
@ -233,8 +233,8 @@ public:
|
||||
re_syntax_base* insert_state(std::ptrdiff_t pos, syntax_element_type t, std::size_t s = sizeof(re_syntax_base));
|
||||
re_literal* append_literal(charT c);
|
||||
re_syntax_base* append_set(const basic_char_set<charT, traits>& char_set);
|
||||
re_syntax_base* append_set(const basic_char_set<charT, traits>& char_set, mpl::false_*);
|
||||
re_syntax_base* append_set(const basic_char_set<charT, traits>& char_set, mpl::true_*);
|
||||
re_syntax_base* append_set(const basic_char_set<charT, traits>& char_set, std::integral_constant<bool, false>*);
|
||||
re_syntax_base* append_set(const basic_char_set<charT, traits>& char_set, std::integral_constant<bool, true>*);
|
||||
void finalize(const charT* p1, const charT* p2);
|
||||
protected:
|
||||
regex_data<charT, traits>* m_pdata; // pointer to the basic_regex_data struct we are filling in
|
||||
@ -288,11 +288,11 @@ basic_regex_creator<charT, traits>::basic_regex_creator(regex_data<charT, traits
|
||||
m_upper_mask = m_traits.lookup_classname(u, u + 5);
|
||||
m_alpha_mask = m_traits.lookup_classname(a, a + 5);
|
||||
m_pdata->m_word_mask = m_word_mask;
|
||||
BOOST_ASSERT(m_word_mask != 0);
|
||||
BOOST_ASSERT(m_mask_space != 0);
|
||||
BOOST_ASSERT(m_lower_mask != 0);
|
||||
BOOST_ASSERT(m_upper_mask != 0);
|
||||
BOOST_ASSERT(m_alpha_mask != 0);
|
||||
BOOST_REGEX_ASSERT(m_word_mask != 0);
|
||||
BOOST_REGEX_ASSERT(m_mask_space != 0);
|
||||
BOOST_REGEX_ASSERT(m_lower_mask != 0);
|
||||
BOOST_REGEX_ASSERT(m_upper_mask != 0);
|
||||
BOOST_REGEX_ASSERT(m_alpha_mask != 0);
|
||||
}
|
||||
|
||||
template <class charT, class traits>
|
||||
@ -362,15 +362,15 @@ 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;
|
||||
typedef std::integral_constant<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<std::integral_constant<bool, 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_*)
|
||||
const basic_char_set<charT, traits>& char_set, std::integral_constant<bool, false>*)
|
||||
{
|
||||
typedef typename traits::string_type string_type;
|
||||
typedef typename basic_char_set<charT, traits>::list_iterator item_iterator;
|
||||
@ -381,9 +381,9 @@ re_syntax_base* basic_regex_creator<charT, traits>::append_set(
|
||||
//
|
||||
// fill in the basics:
|
||||
//
|
||||
result->csingles = static_cast<unsigned int>(::boost::BOOST_REGEX_DETAIL_NS::distance(char_set.singles_begin(), char_set.singles_end()));
|
||||
result->cranges = static_cast<unsigned int>(::boost::BOOST_REGEX_DETAIL_NS::distance(char_set.ranges_begin(), char_set.ranges_end())) / 2;
|
||||
result->cequivalents = static_cast<unsigned int>(::boost::BOOST_REGEX_DETAIL_NS::distance(char_set.equivalents_begin(), char_set.equivalents_end()));
|
||||
result->csingles = static_cast<unsigned int>(std::distance(char_set.singles_begin(), char_set.singles_end()));
|
||||
result->cranges = static_cast<unsigned int>(std::distance(char_set.ranges_begin(), char_set.ranges_end())) / 2;
|
||||
result->cequivalents = static_cast<unsigned int>(std::distance(char_set.equivalents_begin(), char_set.equivalents_end()));
|
||||
result->cclasses = char_set.classes();
|
||||
result->cnclasses = char_set.negated_classes();
|
||||
if(flags() & regbase::icase)
|
||||
@ -478,10 +478,10 @@ re_syntax_base* basic_regex_creator<charT, traits>::append_set(
|
||||
return 0;
|
||||
}
|
||||
charT* p = static_cast<charT*>(this->m_pdata->m_data.extend(sizeof(charT) * (s1.size() + s2.size() + 2) ) );
|
||||
BOOST_REGEX_DETAIL_NS::copy(s1.begin(), s1.end(), p);
|
||||
std::copy(s1.begin(), s1.end(), p);
|
||||
p[s1.size()] = charT(0);
|
||||
p += s1.size() + 1;
|
||||
BOOST_REGEX_DETAIL_NS::copy(s2.begin(), s2.end(), p);
|
||||
std::copy(s2.begin(), s2.end(), p);
|
||||
p[s2.size()] = charT(0);
|
||||
}
|
||||
//
|
||||
@ -502,7 +502,7 @@ re_syntax_base* basic_regex_creator<charT, traits>::append_set(
|
||||
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) ) );
|
||||
BOOST_REGEX_DETAIL_NS::copy(s.begin(), s.end(), p);
|
||||
std::copy(s.begin(), s.end(), p);
|
||||
p[s.size()] = charT(0);
|
||||
++sfirst;
|
||||
}
|
||||
@ -529,7 +529,7 @@ inline bool char_less(signed char t1, signed 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_*)
|
||||
const basic_char_set<charT, traits>& char_set, std::integral_constant<bool, true>*)
|
||||
{
|
||||
typedef typename traits::string_type string_type;
|
||||
typedef typename basic_char_set<charT, traits>::list_iterator item_iterator;
|
||||
@ -580,7 +580,7 @@ re_syntax_base* basic_regex_creator<charT, traits>::append_set(
|
||||
// Oops error:
|
||||
return 0;
|
||||
}
|
||||
BOOST_ASSERT(c3[1] == charT(0));
|
||||
BOOST_REGEX_ASSERT(c3[1] == charT(0));
|
||||
for(unsigned i = 0; i < (1u << CHAR_BIT); ++i)
|
||||
{
|
||||
c3[0] = static_cast<charT>(i);
|
||||
@ -645,7 +645,7 @@ re_syntax_base* basic_regex_creator<charT, traits>::append_set(
|
||||
while(sfirst != slast)
|
||||
{
|
||||
string_type s;
|
||||
BOOST_ASSERT(static_cast<charT>(0) == sfirst->second);
|
||||
BOOST_REGEX_ASSERT(static_cast<charT>(0) == sfirst->second);
|
||||
s = m_traits.transform_primary(&sfirst->first, &sfirst->first+1);
|
||||
if(s.empty())
|
||||
return 0; // invalid or unsupported equivalence class
|
||||
@ -681,7 +681,7 @@ void basic_regex_creator<charT, traits>::finalize(const charT* p1, const charT*
|
||||
m_pdata->m_expression_len = len;
|
||||
charT* ps = static_cast<charT*>(m_pdata->m_data.extend(sizeof(charT) * (1 + (p2 - p1))));
|
||||
m_pdata->m_expression = ps;
|
||||
BOOST_REGEX_DETAIL_NS::copy(p1, p2, ps);
|
||||
std::copy(p1, p2, ps);
|
||||
ps[p2 - p1] = 0;
|
||||
// fill in our other data...
|
||||
// successful parsing implies a zero status:
|
||||
@ -1038,7 +1038,7 @@ int basic_regex_creator<charT, traits>::calculate_backstep(re_syntax_base* state
|
||||
}
|
||||
else if(state->type == syntax_element_long_set_rep)
|
||||
{
|
||||
BOOST_ASSERT(rep->next.p->type == syntax_element_long_set);
|
||||
BOOST_REGEX_ASSERT(rep->next.p->type == syntax_element_long_set);
|
||||
if(static_cast<re_set_long<m_type>*>(rep->next.p)->singleton == 0)
|
||||
return -1;
|
||||
if(rep->max != rep->min)
|
||||
@ -1138,7 +1138,7 @@ void basic_regex_creator<charT, traits>::create_startmap(re_syntax_base* state,
|
||||
}
|
||||
case syntax_element_recurse:
|
||||
{
|
||||
BOOST_ASSERT(static_cast<const re_jump*>(state)->alt.p->type == syntax_element_startmark);
|
||||
BOOST_REGEX_ASSERT(static_cast<const re_jump*>(state)->alt.p->type == syntax_element_startmark);
|
||||
recursion_sub = static_cast<re_brace*>(static_cast<const re_jump*>(state)->alt.p)->index;
|
||||
if(m_recursion_checks[recursion_sub] & 1u)
|
||||
{
|
||||
|
@ -44,19 +44,19 @@ namespace BOOST_REGEX_DETAIL_NS{
|
||||
#endif
|
||||
#endif
|
||||
|
||||
inline boost::intmax_t umax(mpl::false_ const&)
|
||||
inline boost::intmax_t umax(std::integral_constant<bool, false> const&)
|
||||
{
|
||||
// Get out clause here, just in case numeric_limits is unspecialized:
|
||||
return std::numeric_limits<boost::intmax_t>::is_specialized ? (std::numeric_limits<boost::intmax_t>::max)() : INT_MAX;
|
||||
}
|
||||
inline boost::intmax_t umax(mpl::true_ const&)
|
||||
inline boost::intmax_t umax(std::integral_constant<bool, true> const&)
|
||||
{
|
||||
return (std::numeric_limits<std::size_t>::max)();
|
||||
}
|
||||
|
||||
inline boost::intmax_t umax()
|
||||
{
|
||||
return umax(mpl::bool_<std::numeric_limits<boost::intmax_t>::digits >= std::numeric_limits<std::size_t>::digits>());
|
||||
return umax(std::integral_constant<bool, std::numeric_limits<boost::intmax_t>::digits >= std::numeric_limits<std::size_t>::digits>());
|
||||
}
|
||||
|
||||
template <class charT, class traits>
|
||||
@ -190,7 +190,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 opening parenthesis.");
|
||||
fail(regex_constants::error_paren, std::distance(m_base, m_position), "Found a closing ) with no corresponding opening parenthesis.");
|
||||
return;
|
||||
}
|
||||
// if an error has been set then give up now:
|
||||
@ -531,7 +531,7 @@ bool basic_regex_parser<charT, traits>::parse_open_paren()
|
||||
//
|
||||
if(m_position == m_end)
|
||||
{
|
||||
this->fail(regex_constants::error_paren, ::boost::BOOST_REGEX_DETAIL_NS::distance(m_base, m_end));
|
||||
this->fail(regex_constants::error_paren, std::distance(m_base, m_end));
|
||||
return false;
|
||||
}
|
||||
if(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_close_mark)
|
||||
@ -1016,7 +1016,7 @@ bool basic_regex_parser<charT, traits>::parse_repeat(std::size_t low, std::size_
|
||||
}
|
||||
if(0 == this->m_last_state)
|
||||
{
|
||||
fail(regex_constants::error_badrepeat, ::boost::BOOST_REGEX_DETAIL_NS::distance(m_base, m_position), "Nothing to repeat.");
|
||||
fail(regex_constants::error_badrepeat, std::distance(m_base, m_position), "Nothing to repeat.");
|
||||
return false;
|
||||
}
|
||||
if(this->m_last_state->type == syntax_element_endmark)
|
||||
@ -1741,19 +1741,19 @@ digraph<charT> basic_regex_parser<charT, traits>::get_next_set_literal(basic_cha
|
||||
// does a value fit in the specified charT type?
|
||||
//
|
||||
template <class charT>
|
||||
bool valid_value(charT, boost::intmax_t v, const mpl::true_&)
|
||||
bool valid_value(charT, boost::intmax_t v, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
return (v >> (sizeof(charT) * CHAR_BIT)) == 0;
|
||||
}
|
||||
template <class charT>
|
||||
bool valid_value(charT, boost::intmax_t, const mpl::false_&)
|
||||
bool valid_value(charT, boost::intmax_t, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
return true; // v will alsways fit in a charT
|
||||
}
|
||||
template <class charT>
|
||||
bool valid_value(charT c, boost::intmax_t v)
|
||||
{
|
||||
return valid_value(c, v, mpl::bool_<(sizeof(charT) < sizeof(boost::intmax_t))>());
|
||||
return valid_value(c, v, std::integral_constant<bool, (sizeof(charT) < sizeof(boost::intmax_t))>());
|
||||
}
|
||||
|
||||
template <class charT, class traits>
|
||||
@ -1864,7 +1864,7 @@ charT basic_regex_parser<charT, traits>::unescape_character()
|
||||
{
|
||||
// an octal escape sequence, the first character must be a zero
|
||||
// followed by up to 3 octal digits:
|
||||
std::ptrdiff_t len = (std::min)(::boost::BOOST_REGEX_DETAIL_NS::distance(m_position, m_end), static_cast<std::ptrdiff_t>(4));
|
||||
std::ptrdiff_t len = (std::min)(std::distance(m_position, m_end), static_cast<std::ptrdiff_t>(4));
|
||||
const charT* bp = m_position;
|
||||
boost::intmax_t val = this->m_traits.toi(bp, bp + 1, 8);
|
||||
if(val != 0)
|
||||
@ -1948,7 +1948,7 @@ charT basic_regex_parser<charT, traits>::unescape_character()
|
||||
template <class charT, class traits>
|
||||
bool basic_regex_parser<charT, traits>::parse_backref()
|
||||
{
|
||||
BOOST_ASSERT(m_position != m_end);
|
||||
BOOST_REGEX_ASSERT(m_position != m_end);
|
||||
const charT* pc = m_position;
|
||||
boost::intmax_t i = this->m_traits.toi(pc, pc + 1, 10);
|
||||
if((i == 0) || (((this->flags() & regbase::main_option_type) == regbase::perl_syntax_group) && (this->flags() & regbase::no_bk_refs)))
|
||||
@ -2606,10 +2606,10 @@ option_group_jump:
|
||||
// Rewind to start of (? sequence:
|
||||
--m_position;
|
||||
while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position;
|
||||
this->fail(regex_constants::error_paren, ::boost::BOOST_REGEX_DETAIL_NS::distance(m_base, m_end));
|
||||
this->fail(regex_constants::error_paren, std::distance(m_base, m_end));
|
||||
return false;
|
||||
}
|
||||
BOOST_ASSERT(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_close_mark);
|
||||
BOOST_REGEX_ASSERT(this->m_traits.syntax_type(*m_position) == regex_constants::syntax_close_mark);
|
||||
++m_position;
|
||||
//
|
||||
// restore the flags:
|
||||
@ -3137,7 +3137,7 @@ bool basic_regex_parser<charT, traits>::unwind_alts(std::ptrdiff_t last_paren_st
|
||||
m_alt_jumps.pop_back();
|
||||
this->m_pdata->m_data.align();
|
||||
re_jump* jmp = static_cast<re_jump*>(this->getaddress(jump_offset));
|
||||
BOOST_ASSERT(jmp->type == syntax_element_jump);
|
||||
BOOST_REGEX_ASSERT(jmp->type == syntax_element_jump);
|
||||
jmp->alt.i = this->m_pdata->m_data.size() - jump_offset;
|
||||
}
|
||||
return true;
|
||||
|
@ -277,7 +277,7 @@ inline c_regex_traits<char>::char_class_type BOOST_REGEX_CALL c_regex_traits<cha
|
||||
s[i] = static_cast<char>((std::tolower)(static_cast<unsigned char>(s[i])));
|
||||
idx = ::boost::BOOST_REGEX_DETAIL_NS::get_default_class_id(&*s.begin(), &*s.begin() + s.size());
|
||||
}
|
||||
BOOST_ASSERT(std::size_t(idx) + 1u < sizeof(masks) / sizeof(masks[0]));
|
||||
BOOST_REGEX_ASSERT(std::size_t(idx) + 1u < sizeof(masks) / sizeof(masks[0]));
|
||||
return masks[idx + 1];
|
||||
}
|
||||
|
||||
@ -433,7 +433,7 @@ inline c_regex_traits<wchar_t>::char_class_type BOOST_REGEX_CALL c_regex_traits<
|
||||
s[i] = (std::towlower)(s[i]);
|
||||
idx = ::boost::BOOST_REGEX_DETAIL_NS::get_default_class_id(&*s.begin(), &*s.begin() + s.size());
|
||||
}
|
||||
BOOST_ASSERT(idx + 1 < static_cast<int>(sizeof(masks) / sizeof(masks[0])));
|
||||
BOOST_REGEX_ASSERT(idx + 1 < static_cast<int>(sizeof(masks) / sizeof(masks[0])));
|
||||
return masks[idx + 1];
|
||||
}
|
||||
|
||||
|
@ -19,9 +19,10 @@
|
||||
#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>
|
||||
#include <boost/regex/config.hpp>
|
||||
#include <cstdint>
|
||||
#include <locale>
|
||||
#include <type_traits>
|
||||
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
|
||||
@ -32,13 +33,13 @@
|
||||
#include <boost/regex/v5/regex_traits_defaults.hpp>
|
||||
#endif
|
||||
#ifdef BOOST_HAS_THREADS
|
||||
#include <boost/regex/pending/static_mutex.hpp>
|
||||
#include <mutex>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_PRIMARY_TRANSFORM
|
||||
#include <boost/regex/v5/primary_transform.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_OBJECT_CACHE_HPP
|
||||
#include <boost/regex/pending/object_cache.hpp>
|
||||
#include <boost/regex/v5/object_cache.hpp>
|
||||
#endif
|
||||
|
||||
#include <climits>
|
||||
@ -109,14 +110,12 @@ 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(static_cast<cast_type>(way))
|
||||
switch(static_cast<std::intmax_t>(way))
|
||||
{
|
||||
case ::std::ios_base::beg:
|
||||
if((off < 0) || (off > size))
|
||||
@ -417,7 +416,7 @@ class cpp_regex_traits_implementation : public cpp_regex_traits_char_layer<charT
|
||||
public:
|
||||
typedef typename cpp_regex_traits<charT>::char_class_type char_class_type;
|
||||
typedef typename std::ctype<charT>::mask native_mask_type;
|
||||
typedef typename boost::make_unsigned<native_mask_type>::type unsigned_native_mask_type;
|
||||
typedef typename std::make_unsigned<native_mask_type>::type unsigned_native_mask_type;
|
||||
#ifndef BOOST_REGEX_BUGGY_CTYPE_FACET
|
||||
BOOST_STATIC_CONSTANT(char_class_type, mask_blank = 1u << 24);
|
||||
BOOST_STATIC_CONSTANT(char_class_type, mask_word = 1u << 25);
|
||||
@ -508,7 +507,7 @@ typename cpp_regex_traits_implementation<charT>::string_type
|
||||
// we work around this elsewhere, but just assert here that
|
||||
// we adhere to gcc's (buggy) preconditions...
|
||||
//
|
||||
BOOST_ASSERT(*p2 == 0);
|
||||
BOOST_REGEX_ASSERT(*p2 == 0);
|
||||
string_type result;
|
||||
#if defined(_CPPLIB_VER)
|
||||
//
|
||||
@ -588,7 +587,7 @@ typename cpp_regex_traits_implementation<charT>::string_type
|
||||
// we work around this elsewhere, but just assert here that
|
||||
// we adhere to gcc's (buggy) preconditions...
|
||||
//
|
||||
BOOST_ASSERT(*p2 == 0);
|
||||
BOOST_REGEX_ASSERT(*p2 == 0);
|
||||
//
|
||||
// swallowing all exceptions here is a bad idea
|
||||
// however at least one std lib will always throw
|
||||
@ -646,7 +645,7 @@ typename cpp_regex_traits_implementation<charT>::string_type
|
||||
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());
|
||||
BOOST_REGEX_ASSERT(std::find(result2.begin(), result2.end(), charT(0)) == result2.end());
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
}
|
||||
catch(...)
|
||||
@ -872,7 +871,7 @@ typename cpp_regex_traits_implementation<charT>::char_class_type
|
||||
return pos->second;
|
||||
}
|
||||
std::size_t state_id = 1 + BOOST_REGEX_DETAIL_NS::get_default_class_id(p1, p2);
|
||||
BOOST_ASSERT(state_id < sizeof(masks) / sizeof(masks[0]));
|
||||
BOOST_REGEX_ASSERT(state_id < sizeof(masks) / sizeof(masks[0]));
|
||||
return masks[state_id];
|
||||
}
|
||||
|
||||
@ -900,7 +899,7 @@ bool cpp_regex_traits_implementation<charT>::isctype(const charT c, char_class_t
|
||||
|
||||
|
||||
template <class charT>
|
||||
inline boost::shared_ptr<const cpp_regex_traits_implementation<charT> > create_cpp_regex_traits(const std::locale& l)
|
||||
inline std::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);
|
||||
@ -918,7 +917,7 @@ public:
|
||||
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;
|
||||
typedef std::uint_least32_t char_class_type;
|
||||
|
||||
struct boost_extensions_tag{};
|
||||
|
||||
@ -1027,7 +1026,7 @@ public:
|
||||
return m_pimpl->isctype(c, f);
|
||||
#endif
|
||||
}
|
||||
boost::intmax_t toi(const charT*& p1, const charT* p2, int radix)const;
|
||||
std::intmax_t toi(const charT*& p1, const charT* p2, int radix)const;
|
||||
int value(charT c, int radix)const
|
||||
{
|
||||
const charT* pc = &c;
|
||||
@ -1056,20 +1055,20 @@ public:
|
||||
static std::string get_catalog_name();
|
||||
|
||||
private:
|
||||
boost::shared_ptr<const BOOST_REGEX_DETAIL_NS::cpp_regex_traits_implementation<charT> > m_pimpl;
|
||||
std::shared_ptr<const BOOST_REGEX_DETAIL_NS::cpp_regex_traits_implementation<charT> > m_pimpl;
|
||||
//
|
||||
// catalog name handler:
|
||||
//
|
||||
static std::string& get_catalog_name_inst();
|
||||
|
||||
#ifdef BOOST_HAS_THREADS
|
||||
static static_mutex& get_mutex_inst();
|
||||
static std::mutex& get_mutex_inst();
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
template <class charT>
|
||||
boost::intmax_t cpp_regex_traits<charT>::toi(const charT*& first, const charT* last, int radix)const
|
||||
std::intmax_t cpp_regex_traits<charT>::toi(const charT*& first, const charT* last, int radix)const
|
||||
{
|
||||
BOOST_REGEX_DETAIL_NS::parser_buf<charT> sbuf; // buffer for parsing numbers.
|
||||
std::basic_istream<charT> is(&sbuf); // stream for parsing numbers.
|
||||
@ -1082,7 +1081,7 @@ boost::intmax_t cpp_regex_traits<charT>::toi(const charT*& first, const charT* l
|
||||
if(std::abs(radix) == 16) is >> std::hex;
|
||||
else if(std::abs(radix) == 8) is >> std::oct;
|
||||
else is >> std::dec;
|
||||
boost::intmax_t val;
|
||||
std::intmax_t val;
|
||||
if(is >> val)
|
||||
{
|
||||
first = first + ((last - first) - sbuf.in_avail());
|
||||
@ -1096,7 +1095,7 @@ template <class charT>
|
||||
std::string cpp_regex_traits<charT>::catalog_name(const std::string& name)
|
||||
{
|
||||
#ifdef BOOST_HAS_THREADS
|
||||
static_mutex::scoped_lock lk(get_mutex_inst());
|
||||
std::lock_guard<std::mutex> lk(get_mutex_inst());
|
||||
#endif
|
||||
std::string result(get_catalog_name_inst());
|
||||
get_catalog_name_inst() = name;
|
||||
@ -1114,7 +1113,7 @@ template <class charT>
|
||||
std::string cpp_regex_traits<charT>::get_catalog_name()
|
||||
{
|
||||
#ifdef BOOST_HAS_THREADS
|
||||
static_mutex::scoped_lock lk(get_mutex_inst());
|
||||
std::lock_guard<std::mutex> lk(get_mutex_inst());
|
||||
#endif
|
||||
std::string result(get_catalog_name_inst());
|
||||
return result;
|
||||
@ -1122,9 +1121,9 @@ std::string cpp_regex_traits<charT>::get_catalog_name()
|
||||
|
||||
#ifdef BOOST_HAS_THREADS
|
||||
template <class charT>
|
||||
static_mutex& cpp_regex_traits<charT>::get_mutex_inst()
|
||||
std::mutex& cpp_regex_traits<charT>::get_mutex_inst()
|
||||
{
|
||||
static static_mutex s_mutex = BOOST_STATIC_MUTEX_INIT;
|
||||
static std::mutex s_mutex;
|
||||
return s_mutex;
|
||||
}
|
||||
#endif
|
||||
|
@ -22,8 +22,7 @@
|
||||
#define BOOST_REGEX_ITERATOR_CATEGORY_HPP
|
||||
|
||||
#include <iterator>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <boost/type_traits/is_pointer.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost{
|
||||
namespace detail{
|
||||
@ -35,7 +34,7 @@ struct is_random_imp
|
||||
private:
|
||||
typedef typename std::iterator_traits<I>::iterator_category cat;
|
||||
public:
|
||||
BOOST_STATIC_CONSTANT(bool, value = (::boost::is_convertible<cat*, std::random_access_iterator_tag*>::value));
|
||||
BOOST_STATIC_CONSTANT(bool, value = (std::is_convertible<cat*, std::random_access_iterator_tag*>::value));
|
||||
#else
|
||||
BOOST_STATIC_CONSTANT(bool, value = false);
|
||||
#endif
|
||||
@ -73,7 +72,7 @@ template <class I>
|
||||
struct is_random_access_iterator
|
||||
{
|
||||
private:
|
||||
typedef detail::is_random_imp_selector< ::boost::is_pointer<I>::value> selector;
|
||||
typedef detail::is_random_imp_selector< std::is_pointer<I>::value> selector;
|
||||
typedef typename selector::template rebind<I> bound_type;
|
||||
typedef typename bound_type::type answer;
|
||||
public:
|
||||
|
@ -20,7 +20,7 @@
|
||||
#define BOOST_REGEX_V5_MATCH_FLAGS
|
||||
|
||||
#ifdef __cplusplus
|
||||
# include <boost/cstdint.hpp>
|
||||
# include <cstdint>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -97,13 +97,13 @@ 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)); }
|
||||
{ return static_cast<match_flags>(static_cast<std::int32_t>(m1) & static_cast<std::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)); }
|
||||
{ return static_cast<match_flags>(static_cast<std::int32_t>(m1) | static_cast<std::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)); }
|
||||
{ return static_cast<match_flags>(static_cast<std::int32_t>(m1) ^ static_cast<std::int32_t>(m2)); }
|
||||
inline match_flags operator~(match_flags m1)
|
||||
{ return static_cast<match_flags>(~static_cast<boost::int32_t>(m1)); }
|
||||
{ return static_cast<match_flags>(~static_cast<std::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)
|
||||
|
@ -167,7 +167,7 @@ public:
|
||||
const sub_match<BidiIterator>& s = m_subs[sub];
|
||||
if(s.matched || (sub == 2))
|
||||
{
|
||||
return ::boost::BOOST_REGEX_DETAIL_NS::distance((BidiIterator)(m_base), (BidiIterator)(s.first));
|
||||
return std::distance((BidiIterator)(m_base), (BidiIterator)(s.first));
|
||||
}
|
||||
}
|
||||
return ~static_cast<difference_type>(0);
|
||||
@ -474,7 +474,7 @@ public:
|
||||
// private access functions:
|
||||
void BOOST_REGEX_CALL set_second(BidiIterator i)
|
||||
{
|
||||
BOOST_ASSERT(m_subs.size() > 2);
|
||||
BOOST_REGEX_ASSERT(m_subs.size() > 2);
|
||||
m_subs[2].second = i;
|
||||
m_subs[2].matched = true;
|
||||
m_subs[0].first = i;
|
||||
@ -490,7 +490,7 @@ public:
|
||||
if(pos)
|
||||
m_last_closed_paren = static_cast<int>(pos);
|
||||
pos += 2;
|
||||
BOOST_ASSERT(m_subs.size() > pos);
|
||||
BOOST_REGEX_ASSERT(m_subs.size() > pos);
|
||||
m_subs[pos].second = i;
|
||||
m_subs[pos].matched = m;
|
||||
if((pos == 2) && !escape_k)
|
||||
@ -531,7 +531,7 @@ public:
|
||||
}
|
||||
void BOOST_REGEX_CALL set_first(BidiIterator i)
|
||||
{
|
||||
BOOST_ASSERT(m_subs.size() > 2);
|
||||
BOOST_REGEX_ASSERT(m_subs.size() > 2);
|
||||
// set up prefix:
|
||||
m_subs[1].second = i;
|
||||
m_subs[1].matched = (m_subs[1].first != i);
|
||||
@ -546,7 +546,7 @@ public:
|
||||
}
|
||||
void BOOST_REGEX_CALL set_first(BidiIterator i, size_type pos, bool escape_k = false)
|
||||
{
|
||||
BOOST_ASSERT(pos+2 < m_subs.size());
|
||||
BOOST_REGEX_ASSERT(pos+2 < m_subs.size());
|
||||
if(pos || escape_k)
|
||||
{
|
||||
m_subs[pos+2].first = i;
|
||||
@ -561,7 +561,7 @@ public:
|
||||
}
|
||||
void BOOST_REGEX_CALL maybe_assign(const match_results<BidiIterator, Allocator>& m);
|
||||
|
||||
void BOOST_REGEX_CALL set_named_subs(boost::shared_ptr<named_sub_type> subs)
|
||||
void BOOST_REGEX_CALL set_named_subs(std::shared_ptr<named_sub_type> subs)
|
||||
{
|
||||
m_named_subs = subs;
|
||||
}
|
||||
@ -580,7 +580,7 @@ private:
|
||||
vector_type m_subs; // subexpressions
|
||||
BidiIterator m_base; // where the search started from
|
||||
sub_match<BidiIterator> m_null; // a null match
|
||||
boost::shared_ptr<named_sub_type> m_named_subs; // Shared copy of named subs in the regex object
|
||||
std::shared_ptr<named_sub_type> m_named_subs; // Shared copy of named subs in the regex object
|
||||
int m_last_closed_paren; // Last ) to be seen - used for formatting
|
||||
bool m_is_singular; // True if our stored iterators are singular
|
||||
};
|
||||
@ -648,17 +648,17 @@ void BOOST_REGEX_CALL match_results<BidiIterator, Allocator>::maybe_assign(const
|
||||
// p1 better than p2, and no need to calculate distances:
|
||||
return;
|
||||
}
|
||||
base1 = ::boost::BOOST_REGEX_DETAIL_NS::distance(l_base, p1->first);
|
||||
base2 = ::boost::BOOST_REGEX_DETAIL_NS::distance(l_base, p2->first);
|
||||
BOOST_ASSERT(base1 >= 0);
|
||||
BOOST_ASSERT(base2 >= 0);
|
||||
base1 = std::distance(l_base, p1->first);
|
||||
base2 = std::distance(l_base, p2->first);
|
||||
BOOST_REGEX_ASSERT(base1 >= 0);
|
||||
BOOST_REGEX_ASSERT(base2 >= 0);
|
||||
if(base1 < base2) return;
|
||||
if(base2 < base1) break;
|
||||
|
||||
len1 = ::boost::BOOST_REGEX_DETAIL_NS::distance((BidiIterator)p1->first, (BidiIterator)p1->second);
|
||||
len2 = ::boost::BOOST_REGEX_DETAIL_NS::distance((BidiIterator)p2->first, (BidiIterator)p2->second);
|
||||
BOOST_ASSERT(len1 >= 0);
|
||||
BOOST_ASSERT(len2 >= 0);
|
||||
len1 = std::distance((BidiIterator)p1->first, (BidiIterator)p1->second);
|
||||
len2 = std::distance((BidiIterator)p2->first, (BidiIterator)p2->second);
|
||||
BOOST_REGEX_ASSERT(len1 >= 0);
|
||||
BOOST_REGEX_ASSERT(len2 >= 0);
|
||||
if((len1 != len2) || ((p1->matched == false) && (p2->matched == true)))
|
||||
break;
|
||||
if((p1->matched == true) && (p2->matched == false))
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include <new>
|
||||
#ifdef BOOST_HAS_THREADS
|
||||
#include <boost/regex/pending/static_mutex.hpp>
|
||||
#include <mutex>
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
@ -107,7 +107,7 @@ struct mem_block_cache
|
||||
void* get()
|
||||
{
|
||||
#ifdef BOOST_HAS_THREADS
|
||||
boost::static_mutex::scoped_lock g(mut);
|
||||
std::lock_guard<std::mutex> g(mut);
|
||||
#endif
|
||||
if(next)
|
||||
{
|
||||
@ -121,7 +121,7 @@ struct mem_block_cache
|
||||
void put(void* p)
|
||||
{
|
||||
#ifdef BOOST_HAS_THREADS
|
||||
boost::static_mutex::scoped_lock g(mut);
|
||||
std::lock_guard<std::mutex> g(mut);
|
||||
#endif
|
||||
if(cached_blocks >= BOOST_REGEX_MAX_CACHE_BLOCKS)
|
||||
{
|
||||
|
@ -475,7 +475,7 @@ private:
|
||||
// final result structure to be filled in:
|
||||
match_results<BidiIterator, Allocator>& m_result;
|
||||
// temporary result for POSIX matches:
|
||||
scoped_ptr<match_results<BidiIterator, Allocator> > m_temp_match;
|
||||
std::unique_ptr<match_results<BidiIterator, Allocator> > m_temp_match;
|
||||
// pointer to actual result structure to fill in:
|
||||
match_results<BidiIterator, Allocator>* m_presult;
|
||||
// start of sequence being searched:
|
||||
|
@ -114,7 +114,7 @@ void perl_matcher<BidiIterator, Allocator, traits>::estimate_max_state_count(std
|
||||
// Calculate NS^2 first:
|
||||
//
|
||||
static const std::ptrdiff_t k = 100000;
|
||||
std::ptrdiff_t dist = boost::BOOST_REGEX_DETAIL_NS::distance(base, last);
|
||||
std::ptrdiff_t dist = std::distance(base, last);
|
||||
if(dist == 0)
|
||||
dist = 1;
|
||||
std::ptrdiff_t states = re.size();
|
||||
@ -589,7 +589,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_backref()
|
||||
if(index >= hash_value_mask)
|
||||
{
|
||||
named_subexpressions::range_type r = re.get_data().equal_range(index);
|
||||
BOOST_ASSERT(r.first != r.second);
|
||||
BOOST_REGEX_ASSERT(r.first != r.second);
|
||||
do
|
||||
{
|
||||
index = r.first->index;
|
||||
@ -698,7 +698,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_backstep()
|
||||
#endif
|
||||
if( ::boost::is_random_access_iterator<BidiIterator>::value)
|
||||
{
|
||||
std::ptrdiff_t maxlen = ::boost::BOOST_REGEX_DETAIL_NS::distance(backstop, position);
|
||||
std::ptrdiff_t maxlen = std::distance(backstop, position);
|
||||
if(maxlen < static_cast<const re_brace*>(pstate)->index)
|
||||
return false;
|
||||
std::advance(position, -static_cast<const re_brace*>(pstate)->index);
|
||||
|
@ -111,7 +111,7 @@ struct save_state_init
|
||||
*end = reinterpret_cast<saved_state*>(reinterpret_cast<char*>(*base)+BOOST_REGEX_BLOCKSIZE);
|
||||
--(*end);
|
||||
(void) new (*end)saved_state(0);
|
||||
BOOST_ASSERT(*end > *base);
|
||||
BOOST_REGEX_ASSERT(*end > *base);
|
||||
}
|
||||
~save_state_init()
|
||||
{
|
||||
@ -248,7 +248,7 @@ void perl_matcher<BidiIterator, Allocator, traits>::extend_stack()
|
||||
template <class BidiIterator, class Allocator, class traits>
|
||||
inline void perl_matcher<BidiIterator, Allocator, traits>::push_matched_paren(int index, const sub_match<BidiIterator>& sub)
|
||||
{
|
||||
//BOOST_ASSERT(index);
|
||||
//BOOST_REGEX_ASSERT(index);
|
||||
saved_matched_paren<BidiIterator>* pmp = static_cast<saved_matched_paren<BidiIterator>*>(m_backup_state);
|
||||
--pmp;
|
||||
if(pmp < m_stack_base)
|
||||
@ -264,7 +264,7 @@ inline void perl_matcher<BidiIterator, Allocator, traits>::push_matched_paren(in
|
||||
template <class BidiIterator, class Allocator, class traits>
|
||||
inline void perl_matcher<BidiIterator, Allocator, traits>::push_case_change(bool c)
|
||||
{
|
||||
//BOOST_ASSERT(index);
|
||||
//BOOST_REGEX_ASSERT(index);
|
||||
saved_change_case* pmp = static_cast<saved_change_case*>(m_backup_state);
|
||||
--pmp;
|
||||
if(pmp < m_stack_base)
|
||||
@ -492,7 +492,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_startmark()
|
||||
{
|
||||
// conditional expression:
|
||||
const re_alt* alt = static_cast<const re_alt*>(pstate->next.p);
|
||||
BOOST_ASSERT(alt->type == syntax_element_alt);
|
||||
BOOST_REGEX_ASSERT(alt->type == syntax_element_alt);
|
||||
pstate = alt->next.p;
|
||||
if(pstate->type == syntax_element_assert_backref)
|
||||
{
|
||||
@ -503,7 +503,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_startmark()
|
||||
else
|
||||
{
|
||||
// zero width assertion, have to match this recursively:
|
||||
BOOST_ASSERT(pstate->type == syntax_element_startmark);
|
||||
BOOST_REGEX_ASSERT(pstate->type == syntax_element_startmark);
|
||||
bool negated = static_cast<const re_brace*>(pstate)->index == -2;
|
||||
BidiIterator saved_position = position;
|
||||
const re_syntax_base* next_pstate = static_cast<const re_jump*>(pstate->next.p)->alt.p->next.p;
|
||||
@ -543,7 +543,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_startmark()
|
||||
}
|
||||
default:
|
||||
{
|
||||
BOOST_ASSERT(index > 0);
|
||||
BOOST_REGEX_ASSERT(index > 0);
|
||||
if((m_match_flags & match_nosubs) == 0)
|
||||
{
|
||||
push_matched_paren(index, (*m_presult)[index]);
|
||||
@ -754,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);
|
||||
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));
|
||||
std::size_t count = static_cast<std::size_t>((std::min)(static_cast<std::size_t>(std::distance(position, last)), greedy ? rep->max : rep->min));
|
||||
if(rep->min > count)
|
||||
{
|
||||
position = last;
|
||||
@ -794,7 +794,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_char_repeat()
|
||||
#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);
|
||||
BOOST_REGEX_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;
|
||||
//
|
||||
@ -807,7 +807,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_char_repeat()
|
||||
BidiIterator end = position;
|
||||
// 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::BOOST_REGEX_DETAIL_NS::distance(position, last);
|
||||
std::size_t len = (desired == (std::numeric_limits<std::size_t>::max)()) ? 0u : std::distance(position, last);
|
||||
if(desired >= len)
|
||||
end = last;
|
||||
else
|
||||
@ -817,7 +817,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_char_repeat()
|
||||
{
|
||||
++position;
|
||||
}
|
||||
count = (unsigned)::boost::BOOST_REGEX_DETAIL_NS::distance(origin, position);
|
||||
count = (unsigned)std::distance(origin, position);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -881,7 +881,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_set_repeat()
|
||||
BidiIterator end = position;
|
||||
// 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::BOOST_REGEX_DETAIL_NS::distance(position, last);
|
||||
std::size_t len = (desired == (std::numeric_limits<std::size_t>::max)()) ? 0u : std::distance(position, last);
|
||||
if(desired >= len)
|
||||
end = last;
|
||||
else
|
||||
@ -891,7 +891,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_set_repeat()
|
||||
{
|
||||
++position;
|
||||
}
|
||||
count = (unsigned)::boost::BOOST_REGEX_DETAIL_NS::distance(origin, position);
|
||||
count = (unsigned)std::distance(origin, position);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -956,7 +956,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_long_set_repeat()
|
||||
BidiIterator end = position;
|
||||
// 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::BOOST_REGEX_DETAIL_NS::distance(position, last);
|
||||
std::size_t len = (desired == (std::numeric_limits<std::size_t>::max)()) ? 0u : std::distance(position, last);
|
||||
if(desired >= len)
|
||||
end = last;
|
||||
else
|
||||
@ -966,7 +966,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_long_set_repeat()
|
||||
{
|
||||
++position;
|
||||
}
|
||||
count = (unsigned)::boost::BOOST_REGEX_DETAIL_NS::distance(origin, position);
|
||||
count = (unsigned)std::distance(origin, position);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1010,7 +1010,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_long_set_repeat()
|
||||
template <class BidiIterator, class Allocator, class traits>
|
||||
bool perl_matcher<BidiIterator, Allocator, traits>::match_recursion()
|
||||
{
|
||||
BOOST_ASSERT(pstate->type == syntax_element_recurse);
|
||||
BOOST_REGEX_ASSERT(pstate->type == syntax_element_recurse);
|
||||
//
|
||||
// See if we've seen this recursion before at this location, if we have then
|
||||
// we need to prevent infinite recursion:
|
||||
@ -1087,7 +1087,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_match()
|
||||
{
|
||||
if(!recursion_stack.empty())
|
||||
{
|
||||
BOOST_ASSERT(0 == recursion_stack.back().idx);
|
||||
BOOST_REGEX_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;
|
||||
@ -1394,15 +1394,15 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_greedy_single_repeat(
|
||||
|
||||
const re_repeat* rep = pmp->rep;
|
||||
std::size_t count = pmp->count;
|
||||
BOOST_ASSERT(rep->next.p != 0);
|
||||
BOOST_ASSERT(rep->alt.p != 0);
|
||||
BOOST_REGEX_ASSERT(rep->next.p != 0);
|
||||
BOOST_REGEX_ASSERT(rep->alt.p != 0);
|
||||
|
||||
count -= rep->min;
|
||||
|
||||
if((m_match_flags & match_partial) && (position == last))
|
||||
m_has_partial_match = true;
|
||||
|
||||
BOOST_ASSERT(count);
|
||||
BOOST_REGEX_ASSERT(count);
|
||||
position = pmp->last_position;
|
||||
|
||||
// backtrack till we can skip out:
|
||||
@ -1443,12 +1443,12 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_slow_dot_repeat(bool
|
||||
|
||||
const re_repeat* rep = pmp->rep;
|
||||
std::size_t count = pmp->count;
|
||||
BOOST_ASSERT(rep->type == syntax_element_dot_rep);
|
||||
BOOST_ASSERT(rep->next.p != 0);
|
||||
BOOST_ASSERT(rep->alt.p != 0);
|
||||
BOOST_ASSERT(rep->next.p->type == syntax_element_wild);
|
||||
BOOST_REGEX_ASSERT(rep->type == syntax_element_dot_rep);
|
||||
BOOST_REGEX_ASSERT(rep->next.p != 0);
|
||||
BOOST_REGEX_ASSERT(rep->alt.p != 0);
|
||||
BOOST_REGEX_ASSERT(rep->next.p->type == syntax_element_wild);
|
||||
|
||||
BOOST_ASSERT(count < rep->max);
|
||||
BOOST_REGEX_ASSERT(count < rep->max);
|
||||
pstate = rep->next.p;
|
||||
position = pmp->last_position;
|
||||
|
||||
@ -1508,7 +1508,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_fast_dot_repeat(bool
|
||||
const re_repeat* rep = pmp->rep;
|
||||
std::size_t count = pmp->count;
|
||||
|
||||
BOOST_ASSERT(count < rep->max);
|
||||
BOOST_REGEX_ASSERT(count < rep->max);
|
||||
position = pmp->last_position;
|
||||
if(position != last)
|
||||
{
|
||||
@ -1568,11 +1568,11 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_char_repeat(bool r)
|
||||
const char_type what = *reinterpret_cast<const char_type*>(static_cast<const re_literal*>(pstate) + 1);
|
||||
position = pmp->last_position;
|
||||
|
||||
BOOST_ASSERT(rep->type == syntax_element_char_rep);
|
||||
BOOST_ASSERT(rep->next.p != 0);
|
||||
BOOST_ASSERT(rep->alt.p != 0);
|
||||
BOOST_ASSERT(rep->next.p->type == syntax_element_literal);
|
||||
BOOST_ASSERT(count < rep->max);
|
||||
BOOST_REGEX_ASSERT(rep->type == syntax_element_char_rep);
|
||||
BOOST_REGEX_ASSERT(rep->next.p != 0);
|
||||
BOOST_REGEX_ASSERT(rep->alt.p != 0);
|
||||
BOOST_REGEX_ASSERT(rep->next.p->type == syntax_element_literal);
|
||||
BOOST_REGEX_ASSERT(count < rep->max);
|
||||
|
||||
if(position != last)
|
||||
{
|
||||
@ -1637,11 +1637,11 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_short_set_repeat(bool
|
||||
const unsigned char* map = static_cast<const re_set*>(rep->next.p)->_map;
|
||||
position = pmp->last_position;
|
||||
|
||||
BOOST_ASSERT(rep->type == syntax_element_short_set_rep);
|
||||
BOOST_ASSERT(rep->next.p != 0);
|
||||
BOOST_ASSERT(rep->alt.p != 0);
|
||||
BOOST_ASSERT(rep->next.p->type == syntax_element_set);
|
||||
BOOST_ASSERT(count < rep->max);
|
||||
BOOST_REGEX_ASSERT(rep->type == syntax_element_short_set_rep);
|
||||
BOOST_REGEX_ASSERT(rep->next.p != 0);
|
||||
BOOST_REGEX_ASSERT(rep->alt.p != 0);
|
||||
BOOST_REGEX_ASSERT(rep->next.p->type == syntax_element_set);
|
||||
BOOST_REGEX_ASSERT(count < rep->max);
|
||||
|
||||
if(position != last)
|
||||
{
|
||||
@ -1707,11 +1707,11 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_long_set_repeat(bool
|
||||
const re_set_long<m_type>* set = static_cast<const re_set_long<m_type>*>(pstate);
|
||||
position = pmp->last_position;
|
||||
|
||||
BOOST_ASSERT(rep->type == syntax_element_long_set_rep);
|
||||
BOOST_ASSERT(rep->next.p != 0);
|
||||
BOOST_ASSERT(rep->alt.p != 0);
|
||||
BOOST_ASSERT(rep->next.p->type == syntax_element_long_set);
|
||||
BOOST_ASSERT(count < rep->max);
|
||||
BOOST_REGEX_ASSERT(rep->type == syntax_element_long_set_rep);
|
||||
BOOST_REGEX_ASSERT(rep->next.p != 0);
|
||||
BOOST_REGEX_ASSERT(rep->alt.p != 0);
|
||||
BOOST_REGEX_ASSERT(rep->next.p->type == syntax_element_long_set);
|
||||
BOOST_REGEX_ASSERT(count < rep->max);
|
||||
|
||||
if(position != last)
|
||||
{
|
||||
|
@ -21,20 +21,8 @@
|
||||
#ifndef BOOST_REGEX_FORMAT_HPP
|
||||
#define BOOST_REGEX_FORMAT_HPP
|
||||
|
||||
#include <boost/type_traits/is_pointer.hpp>
|
||||
#include <boost/type_traits/is_function.hpp>
|
||||
#include <boost/type_traits/is_class.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <boost/type_traits/remove_pointer.hpp>
|
||||
#include <boost/type_traits/remove_cv.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/not.hpp>
|
||||
#ifndef BOOST_NO_SFINAE
|
||||
#include <boost/mpl/has_xxx.hpp>
|
||||
#endif
|
||||
#include <boost/ref.hpp>
|
||||
#include <type_traits>
|
||||
#include <functional>
|
||||
|
||||
namespace boost{
|
||||
|
||||
@ -127,34 +115,34 @@ private:
|
||||
void format_until_scope_end();
|
||||
bool handle_perl_verb(bool have_brace);
|
||||
|
||||
inline typename Results::value_type const& get_named_sub(ForwardIter i, ForwardIter j, const mpl::false_&)
|
||||
inline typename Results::value_type const& get_named_sub(ForwardIter i, ForwardIter j, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
std::vector<char_type> v(i, j);
|
||||
return (i != j) ? this->m_results.named_subexpression(&v[0], &v[0] + v.size())
|
||||
: this->m_results.named_subexpression(static_cast<const char_type*>(0), static_cast<const char_type*>(0));
|
||||
}
|
||||
inline typename Results::value_type const& get_named_sub(ForwardIter i, ForwardIter j, const mpl::true_&)
|
||||
inline typename Results::value_type const& get_named_sub(ForwardIter i, ForwardIter j, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
return this->m_results.named_subexpression(i, j);
|
||||
}
|
||||
inline typename Results::value_type const& get_named_sub(ForwardIter i, ForwardIter j)
|
||||
{
|
||||
typedef typename boost::is_convertible<ForwardIter, const char_type*>::type tag_type;
|
||||
typedef typename std::is_convertible<ForwardIter, const char_type*>::type tag_type;
|
||||
return get_named_sub(i, j, tag_type());
|
||||
}
|
||||
inline int get_named_sub_index(ForwardIter i, ForwardIter j, const mpl::false_&)
|
||||
inline int get_named_sub_index(ForwardIter i, ForwardIter j, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
std::vector<char_type> v(i, j);
|
||||
return (i != j) ? this->m_results.named_subexpression_index(&v[0], &v[0] + v.size())
|
||||
: this->m_results.named_subexpression_index(static_cast<const char_type*>(0), static_cast<const char_type*>(0));
|
||||
}
|
||||
inline int get_named_sub_index(ForwardIter i, ForwardIter j, const mpl::true_&)
|
||||
inline int get_named_sub_index(ForwardIter i, ForwardIter j, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
return this->m_results.named_subexpression_index(i, j);
|
||||
}
|
||||
inline int get_named_sub_index(ForwardIter i, ForwardIter j)
|
||||
{
|
||||
typedef typename boost::is_convertible<ForwardIter, const char_type*>::type tag_type;
|
||||
typedef typename std::is_convertible<ForwardIter, const char_type*>::type tag_type;
|
||||
return get_named_sub_index(i, j, tag_type());
|
||||
}
|
||||
#ifdef BOOST_MSVC
|
||||
@ -162,7 +150,7 @@ private:
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4244)
|
||||
#endif
|
||||
inline int toi(ForwardIter& i, ForwardIter j, int base, const boost::mpl::false_&)
|
||||
inline int toi(ForwardIter& i, ForwardIter j, int base, const std::integral_constant<bool, false>&)
|
||||
{
|
||||
if(i != j)
|
||||
{
|
||||
@ -178,7 +166,7 @@ private:
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
inline int toi(ForwardIter& i, ForwardIter j, int base, const boost::mpl::true_&)
|
||||
inline int toi(ForwardIter& i, ForwardIter j, int base, const std::integral_constant<bool, true>&)
|
||||
{
|
||||
return m_traits.toi(i, j, base);
|
||||
}
|
||||
@ -187,9 +175,9 @@ private:
|
||||
#if defined(_MSC_VER) && defined(__INTEL_COMPILER) && ((__INTEL_COMPILER == 9999) || (__INTEL_COMPILER == 1210))
|
||||
// Workaround for Intel support issue #656654.
|
||||
// See also https://svn.boost.org/trac/boost/ticket/6359
|
||||
return toi(i, j, base, mpl::false_());
|
||||
return toi(i, j, base, std::integral_constant<bool, false>());
|
||||
#else
|
||||
typedef typename boost::is_convertible<ForwardIter, const char_type*&>::type tag_type;
|
||||
typedef typename std::is_convertible<ForwardIter, const char_type*&>::type tag_type;
|
||||
return toi(i, j, base, tag_type());
|
||||
#endif
|
||||
}
|
||||
@ -251,7 +239,7 @@ void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format
|
||||
m_have_conditional = have_conditional;
|
||||
if(m_position == m_end)
|
||||
return;
|
||||
BOOST_ASSERT(*m_position == static_cast<char_type>(')'));
|
||||
BOOST_REGEX_ASSERT(*m_position == static_cast<char_type>(')'));
|
||||
++m_position; // skip the closing ')'
|
||||
break;
|
||||
}
|
||||
@ -307,7 +295,7 @@ void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format
|
||||
// On entry *m_position points to a '$' character
|
||||
// output the information that goes with it:
|
||||
//
|
||||
BOOST_ASSERT(*m_position == '$');
|
||||
BOOST_REGEX_ASSERT(*m_position == '$');
|
||||
//
|
||||
// see if this is a trailing '$':
|
||||
//
|
||||
@ -366,7 +354,7 @@ void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format
|
||||
default:
|
||||
// see if we have a number:
|
||||
{
|
||||
std::ptrdiff_t len = ::boost::BOOST_REGEX_DETAIL_NS::distance(m_position, m_end);
|
||||
std::ptrdiff_t len = std::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 != '}'))))
|
||||
@ -577,7 +565,7 @@ void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format
|
||||
}
|
||||
else
|
||||
{
|
||||
std::ptrdiff_t len = ::boost::BOOST_REGEX_DETAIL_NS::distance(m_position, m_end);
|
||||
std::ptrdiff_t len = std::distance(m_position, m_end);
|
||||
len = (std::min)(static_cast<std::ptrdiff_t>(2), len);
|
||||
int val = this->toi(m_position, m_position + len, 16);
|
||||
if(val < 0)
|
||||
@ -641,7 +629,7 @@ void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format
|
||||
break;
|
||||
}
|
||||
// see if we have a \n sed style backreference:
|
||||
std::ptrdiff_t len = ::boost::BOOST_REGEX_DETAIL_NS::distance(m_position, m_end);
|
||||
std::ptrdiff_t len = std::distance(m_position, m_end);
|
||||
len = (std::min)(static_cast<std::ptrdiff_t>(1), len);
|
||||
int v = this->toi(m_position, m_position+len, 10);
|
||||
if((v > 0) || ((v == 0) && (m_flags & ::boost::regex_constants::format_sed)))
|
||||
@ -653,10 +641,10 @@ void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format
|
||||
{
|
||||
// octal ecape sequence:
|
||||
--m_position;
|
||||
len = ::boost::BOOST_REGEX_DETAIL_NS::distance(m_position, m_end);
|
||||
len = std::distance(m_position, m_end);
|
||||
len = (std::min)(static_cast<std::ptrdiff_t>(4), len);
|
||||
v = this->toi(m_position, m_position + len, 8);
|
||||
BOOST_ASSERT(v >= 0);
|
||||
BOOST_REGEX_ASSERT(v >= 0);
|
||||
put(static_cast<char_type>(v));
|
||||
break;
|
||||
}
|
||||
@ -700,7 +688,7 @@ void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format
|
||||
}
|
||||
else
|
||||
{
|
||||
std::ptrdiff_t len = ::boost::BOOST_REGEX_DETAIL_NS::distance(m_position, m_end);
|
||||
std::ptrdiff_t len = std::distance(m_position, m_end);
|
||||
len = (std::min)(static_cast<std::ptrdiff_t>(2), len);
|
||||
v = this->toi(m_position, m_position + len, 10);
|
||||
}
|
||||
@ -837,7 +825,7 @@ OutputIterator regex_format_imp(OutputIterator out,
|
||||
{
|
||||
if(flags & regex_constants::format_literal)
|
||||
{
|
||||
return BOOST_REGEX_DETAIL_NS::copy(p1, p2, out);
|
||||
return std::copy(p1, p2, out);
|
||||
}
|
||||
|
||||
BOOST_REGEX_DETAIL_NS::basic_regex_formatter<
|
||||
@ -847,9 +835,17 @@ OutputIterator regex_format_imp(OutputIterator out,
|
||||
return f.format(p1, p2, flags);
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_SFINAE
|
||||
template <class T>
|
||||
struct has_const_iterator
|
||||
{
|
||||
template <class U>
|
||||
static typename U::const_iterator tester(U*);
|
||||
static char tester(...);
|
||||
|
||||
BOOST_MPL_HAS_XXX_TRAIT_DEF(const_iterator)
|
||||
static T* get();
|
||||
|
||||
static const bool value = sizeof(tester(get())) != sizeof(char);
|
||||
};
|
||||
|
||||
struct any_type
|
||||
{
|
||||
@ -891,7 +887,7 @@ struct unary_binary_ternary
|
||||
operator ternary_fun();
|
||||
};
|
||||
|
||||
template<typename Formatter, bool IsFunction = boost::is_function<Formatter>::value>
|
||||
template<typename Formatter, bool IsFunction = std::is_function<Formatter>::value>
|
||||
struct formatter_wrapper
|
||||
: Formatter
|
||||
, unary_binary_ternary
|
||||
@ -913,6 +909,22 @@ struct formatter_wrapper<Formatter *, false>
|
||||
operator Formatter *();
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct do_unwrap_reference
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
template <class T>
|
||||
struct do_unwrap_reference<std::reference_wrapper<T> >
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
T& do_unwrap_ref(T& r) { return r; }
|
||||
template <class T>
|
||||
T& do_unwrap_ref(std::reference_wrapper<T> const& r) { return r.get(); }
|
||||
|
||||
template <class F, class M, class O>
|
||||
struct format_traits_imp
|
||||
{
|
||||
@ -920,8 +932,8 @@ 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<typename unwrap_reference<F>::type> f;
|
||||
BOOST_STATIC_ASSERT((::std::is_pointer<F>::value || ::std::is_function<F>::value || ::std::is_class<F>::value));
|
||||
static formatter_wrapper<typename do_unwrap_reference<F>::type> f;
|
||||
static M m;
|
||||
static O out;
|
||||
static boost::regex_constants::match_flag_type flags;
|
||||
@ -934,7 +946,7 @@ struct format_traits
|
||||
{
|
||||
public:
|
||||
//
|
||||
// Type is mpl::int_<N> where N is one of:
|
||||
// Type is std::integral_constant<int, N> where N is one of:
|
||||
//
|
||||
// 0 : F is a pointer to a presumably null-terminated string.
|
||||
// 1 : F is a character-container such as a std::string.
|
||||
@ -942,46 +954,22 @@ public:
|
||||
// 3 : F is a Binary Functor.
|
||||
// 4 : F is a Ternary Functor.
|
||||
//
|
||||
typedef typename boost::mpl::if_<
|
||||
boost::mpl::and_<boost::is_pointer<F>, boost::mpl::not_<boost::is_function<typename boost::remove_pointer<F>::type> > >,
|
||||
boost::mpl::int_<0>,
|
||||
typename boost::mpl::if_<
|
||||
has_const_iterator<F>,
|
||||
boost::mpl::int_<1>,
|
||||
boost::mpl::int_<format_traits_imp<F, M, O>::value>
|
||||
typedef typename std::conditional<
|
||||
std::is_pointer<F>::value && !std::is_function<typename std::remove_pointer<F>::type>::value,
|
||||
std::integral_constant<int, 0>,
|
||||
typename std::conditional<
|
||||
has_const_iterator<F>::value,
|
||||
std::integral_constant<int, 1>,
|
||||
std::integral_constant<int, format_traits_imp<F, M, O>::value>
|
||||
>::type
|
||||
>::type type;
|
||||
//
|
||||
// This static assertion will fail if the functor passed does not accept
|
||||
// the same type of arguments passed.
|
||||
//
|
||||
BOOST_STATIC_ASSERT( boost::is_class<F>::value && !has_const_iterator<F>::value ? (type::value > 1) : true);
|
||||
BOOST_STATIC_ASSERT( std::is_class<F>::value && !has_const_iterator<F>::value ? (type::value > 1) : true);
|
||||
};
|
||||
|
||||
#else // BOOST_NO_SFINAE
|
||||
|
||||
template <class F, class M, class O>
|
||||
struct format_traits
|
||||
{
|
||||
public:
|
||||
//
|
||||
// Type is mpl::int_<N> where N is one of:
|
||||
//
|
||||
// 0 : F is a pointer to a presumably null-terminated string.
|
||||
// 1 : F is a character-container such as a std::string.
|
||||
//
|
||||
// Other options such as F being a Functor are not supported without
|
||||
// SFINAE support.
|
||||
//
|
||||
typedef typename boost::mpl::if_<
|
||||
boost::is_pointer<F>,
|
||||
boost::mpl::int_<0>,
|
||||
boost::mpl::int_<1>
|
||||
>::type type;
|
||||
};
|
||||
|
||||
#endif // BOOST_NO_SFINAE
|
||||
|
||||
template <class Base, class Match>
|
||||
struct format_functor3
|
||||
{
|
||||
@ -989,7 +977,7 @@ struct format_functor3
|
||||
template <class OutputIter>
|
||||
OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type f)
|
||||
{
|
||||
return boost::unwrap_ref(func)(m, i, f);
|
||||
return do_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&)
|
||||
@ -1009,7 +997,7 @@ struct format_functor2
|
||||
template <class OutputIter>
|
||||
OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type /*f*/)
|
||||
{
|
||||
return boost::unwrap_ref(func)(m, i);
|
||||
return do_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&)
|
||||
@ -1030,7 +1018,7 @@ struct format_functor1
|
||||
template <class S, class OutputIter>
|
||||
OutputIter do_format_string(const S& s, OutputIter i)
|
||||
{
|
||||
return BOOST_REGEX_DETAIL_NS::copy(s.begin(), s.end(), i);
|
||||
return std::copy(s.begin(), s.end(), i);
|
||||
}
|
||||
template <class S, class OutputIter>
|
||||
inline OutputIter do_format_string(const S* s, OutputIter i)
|
||||
@ -1046,7 +1034,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(boost::unwrap_ref(func)(m), i);
|
||||
return do_format_string(do_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&)
|
||||
@ -1099,16 +1087,16 @@ template <class Func, class Match, class OutputIterator, class Traits = BOOST_RE
|
||||
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 std::remove_cv< typename std::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>,
|
||||
typedef typename std::conditional<
|
||||
tag::value == 0, format_functor_c_string<maybe_char_type, Match, Traits>,
|
||||
typename std::conditional<
|
||||
tag::value == 1, format_functor_container<Func, Match, Traits>,
|
||||
typename std::conditional<
|
||||
tag::value == 2, format_functor1<Func, Match>,
|
||||
typename std::conditional<
|
||||
tag::value == 3, format_functor2<Func, Match>,
|
||||
format_functor3<Func, Match>
|
||||
>::type
|
||||
>::type
|
||||
|
@ -19,7 +19,7 @@
|
||||
#ifndef BOOST_REGEX_V5_REGEX_ITERATOR_HPP
|
||||
#define BOOST_REGEX_V5_REGEX_ITERATOR_HPP
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <memory>
|
||||
|
||||
namespace boost{
|
||||
|
||||
@ -90,7 +90,7 @@ class regex_iterator
|
||||
{
|
||||
private:
|
||||
typedef regex_iterator_implementation<BidirectionalIterator, charT, traits> impl;
|
||||
typedef shared_ptr<impl> pimpl;
|
||||
typedef std::shared_ptr<impl> pimpl;
|
||||
public:
|
||||
typedef basic_regex<charT, traits> regex_type;
|
||||
typedef match_results<BidirectionalIterator> value_type;
|
||||
|
@ -158,7 +158,7 @@ public:
|
||||
|
||||
void* BOOST_REGEX_CALL insert(size_type pos, size_type n)
|
||||
{
|
||||
BOOST_ASSERT(pos <= size_type(end - start));
|
||||
BOOST_REGEX_ASSERT(pos <= size_type(end - start));
|
||||
if (size_type(last - end) < n)
|
||||
resize(n + (end - start));
|
||||
void* result = start + pos;
|
||||
|
@ -48,7 +48,7 @@ OutputIterator regex_replace(OutputIterator out,
|
||||
if(i == j)
|
||||
{
|
||||
if(!(flags & regex_constants::format_no_copy))
|
||||
out = BOOST_REGEX_DETAIL_NS::copy(first, last, out);
|
||||
out = std::copy(first, last, out);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -56,7 +56,7 @@ OutputIterator regex_replace(OutputIterator out,
|
||||
while(i != j)
|
||||
{
|
||||
if(!(flags & regex_constants::format_no_copy))
|
||||
out = BOOST_REGEX_DETAIL_NS::copy(i->prefix().first, i->prefix().second, out);
|
||||
out = std::copy(i->prefix().first, i->prefix().second, out);
|
||||
out = i->format(out, fmt, flags, e);
|
||||
last_m = (*i)[0].second;
|
||||
if(flags & regex_constants::format_first_only)
|
||||
@ -64,7 +64,7 @@ OutputIterator regex_replace(OutputIterator out,
|
||||
++i;
|
||||
}
|
||||
if(!(flags & regex_constants::format_no_copy))
|
||||
out = BOOST_REGEX_DETAIL_NS::copy(last_m, last, out);
|
||||
out = std::copy(last_m, last, out);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
@ -19,19 +19,7 @@
|
||||
#ifndef BOOST_REGEX_V5_REGEX_TOKEN_ITERATOR_HPP
|
||||
#define BOOST_REGEX_V5_REGEX_TOKEN_ITERATOR_HPP
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#if (BOOST_WORKAROUND(BOOST_BORLANDC, >= 0x560) && BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x570)))\
|
||||
|| 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
|
||||
#include <memory>
|
||||
|
||||
namespace boost{
|
||||
|
||||
@ -170,7 +158,7 @@ class regex_token_iterator
|
||||
{
|
||||
private:
|
||||
typedef regex_token_iterator_implementation<BidirectionalIterator, charT, traits> impl;
|
||||
typedef shared_ptr<impl> pimpl;
|
||||
typedef std::shared_ptr<impl> pimpl;
|
||||
public:
|
||||
typedef basic_regex<charT, traits> regex_type;
|
||||
typedef sub_match<BidirectionalIterator> value_type;
|
||||
|
@ -53,9 +53,6 @@
|
||||
#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)
|
||||
@ -83,15 +80,18 @@ struct regex_traits : public implementationT
|
||||
// required "standard" ones:
|
||||
//
|
||||
namespace BOOST_REGEX_DETAIL_NS{
|
||||
#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 T>
|
||||
struct has_boost_extensions_tag
|
||||
{
|
||||
template <class U>
|
||||
static double checker(U*, typename U::boost_extensions_tag* = nullptr);
|
||||
static char checker(...);
|
||||
static T* get();
|
||||
|
||||
static const bool value = sizeof(checker(get())) > 1;
|
||||
};
|
||||
|
||||
|
||||
template <class BaseT>
|
||||
struct default_wrapper : public BaseT
|
||||
|
@ -40,8 +40,9 @@
|
||||
#endif
|
||||
#include <boost/regex/v5/regex_workaround.hpp>
|
||||
#include <boost/type_traits/make_unsigned.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <type_traits>
|
||||
#include <cstdint>
|
||||
#include <cctype>
|
||||
|
||||
#ifdef BOOST_NO_STDC_NAMESPACE
|
||||
namespace std{
|
||||
@ -558,9 +559,9 @@ inline regex_constants::escape_syntax_type BOOST_REGEX_CALL get_default_escape_s
|
||||
}
|
||||
|
||||
// is charT c a combining character?
|
||||
inline bool BOOST_REGEX_CALL is_combining_implementation(boost::uint_least16_t c)
|
||||
inline bool BOOST_REGEX_CALL is_combining_implementation(std::uint_least16_t c)
|
||||
{
|
||||
const boost::uint_least16_t combining_ranges[] = { 0x0300, 0x0361,
|
||||
const std::uint_least16_t combining_ranges[] = { 0x0300, 0x0361,
|
||||
0x0483, 0x0486,
|
||||
0x0903, 0x0903,
|
||||
0x093E, 0x0940,
|
||||
@ -599,7 +600,7 @@ inline bool BOOST_REGEX_CALL is_combining_implementation(boost::uint_least16_t c
|
||||
0xFE20, 0xFE23,
|
||||
0xffff, 0xffff, };
|
||||
|
||||
const boost::uint_least16_t* p = combining_ranges + 1;
|
||||
const std::uint_least16_t* p = combining_ranges + 1;
|
||||
while (*p < c) p += 2;
|
||||
--p;
|
||||
if ((c >= *p) && (c <= *(p + 1)))
|
||||
@ -661,9 +662,9 @@ inline bool is_separator(charT c)
|
||||
(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));
|
||||
|| (static_cast<std::uint16_t>(c) == 0x2028u)
|
||||
|| (static_cast<std::uint16_t>(c) == 0x2029u)
|
||||
|| (static_cast<std::uint16_t>(c) == 0x85u));
|
||||
}
|
||||
template <>
|
||||
inline bool is_separator<char>(char c)
|
||||
@ -766,7 +767,7 @@ struct character_pointer_range
|
||||
// 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)) && BOOST_REGEX_DETAIL_NS::equal(p1, p2, r.p1);
|
||||
return ((p2 - p1) == (r.p2 - r.p1)) && std::equal(p1, p2, r.p1);
|
||||
}
|
||||
};
|
||||
template <class charT>
|
||||
@ -917,14 +918,14 @@ int global_value(charT c)
|
||||
return -1;
|
||||
}
|
||||
template <class charT, class traits>
|
||||
boost::intmax_t global_toi(const charT*& p1, const charT* p2, int radix, const traits& t)
|
||||
std::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);
|
||||
std::intmax_t limit = (std::numeric_limits<std::intmax_t>::max)() / radix;
|
||||
std::intmax_t next_value = t.value(*p1, radix);
|
||||
if((p1 == p2) || (next_value < 0) || (next_value >= radix))
|
||||
return -1;
|
||||
boost::intmax_t result = 0;
|
||||
std::intmax_t result = 0;
|
||||
while(p1 != p2)
|
||||
{
|
||||
next_value = t.value(*p1, radix);
|
||||
@ -940,7 +941,7 @@ boost::intmax_t global_toi(const charT*& p1, const charT* p2, int radix, const t
|
||||
}
|
||||
|
||||
template <class charT>
|
||||
inline typename boost::enable_if_c<(sizeof(charT) > 1), const charT*>::type get_escape_R_string()
|
||||
inline typename std::enable_if<(sizeof(charT) > 1), const charT*>::type get_escape_R_string()
|
||||
{
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
@ -962,7 +963,7 @@ inline typename boost::enable_if_c<(sizeof(charT) > 1), const charT*>::type get_
|
||||
}
|
||||
|
||||
template <class charT>
|
||||
inline typename boost::disable_if_c<(sizeof(charT) > 1), const charT*>::type get_escape_R_string()
|
||||
inline typename std::enable_if<(sizeof(charT) == 1), const charT*>::type get_escape_R_string()
|
||||
{
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
|
@ -19,76 +19,22 @@
|
||||
#ifndef BOOST_REGEX_WORKAROUND_HPP
|
||||
#define BOOST_REGEX_WORKAROUND_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <new>
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
#include <cstddef>
|
||||
#include <cassert>
|
||||
#include <cstdio>
|
||||
#include <climits>
|
||||
#include <string>
|
||||
#include <stdexcept>
|
||||
#include <iterator>
|
||||
#include <algorithm>
|
||||
#include <iosfwd>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <map>
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/scoped_array.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/mpl/bool_fwd.hpp>
|
||||
#include <boost/regex/config.hpp>
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
# include <locale>
|
||||
#endif
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
#include <cstring>
|
||||
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::sprintf; using ::strcpy; using ::strcat; using ::strlen;
|
||||
}
|
||||
#ifndef BOOST_REGEX_STANDALONE
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost{ namespace BOOST_REGEX_DETAIL_NS{
|
||||
#ifdef BOOST_NO_STD_DISTANCE
|
||||
template <class T>
|
||||
std::ptrdiff_t distance(const T& x, const T& y)
|
||||
{ return y - x; }
|
||||
#else
|
||||
using std::distance;
|
||||
#endif
|
||||
}}
|
||||
|
||||
|
||||
#ifdef BOOST_REGEX_NO_BOOL
|
||||
# define BOOST_REGEX_MAKE_BOOL(x) static_cast<bool>((x) ? true : false)
|
||||
#else
|
||||
# define BOOST_REGEX_MAKE_BOOL(x) static_cast<bool>(x)
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Fix broken namespace support:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE) && defined(__cplusplus)
|
||||
|
||||
namespace std{
|
||||
using ::ptrdiff_t;
|
||||
using ::size_t;
|
||||
using ::abs;
|
||||
using ::memset;
|
||||
using ::memcpy;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* helper functions pointer_construct/pointer_destroy:
|
||||
@ -126,67 +72,7 @@ inline void pointer_construct(T* p, const T& t)
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace boost{ namespace BOOST_REGEX_DETAIL_NS{
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC,>=1400) && BOOST_WORKAROUND(BOOST_MSVC, <1600) && defined(_CPPLIB_VER) && defined(BOOST_DINKUMWARE_STDLIB) && !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION))
|
||||
//
|
||||
// MSVC 8 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"). This code works around that:
|
||||
//
|
||||
template<class InputIterator, class OutputIterator>
|
||||
inline OutputIterator copy(
|
||||
InputIterator first,
|
||||
InputIterator last,
|
||||
OutputIterator dest
|
||||
)
|
||||
{
|
||||
return stdext::unchecked_copy(first, last, dest);
|
||||
}
|
||||
template<class InputIterator1, class InputIterator2>
|
||||
inline bool equal(
|
||||
InputIterator1 first,
|
||||
InputIterator1 last,
|
||||
InputIterator2 with
|
||||
)
|
||||
{
|
||||
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;
|
||||
#endif
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC,>=1400) && defined(__STDC_WANT_SECURE_LIB__) && __STDC_WANT_SECURE_LIB__
|
||||
#if defined(BOOST_WORKAROUND) && BOOST_WORKAROUND(BOOST_MSVC,>=1400) && defined(__STDC_WANT_SECURE_LIB__) && __STDC_WANT_SECURE_LIB__
|
||||
|
||||
// use safe versions of strcpy etc:
|
||||
using ::strcpy_s;
|
||||
@ -225,7 +111,11 @@ namespace boost{ namespace BOOST_REGEX_DETAIL_NS{
|
||||
if(i)
|
||||
{
|
||||
std::overflow_error e("String buffer too small");
|
||||
#ifndef BOOST_REGEX_STANDALONE
|
||||
boost::throw_exception(e);
|
||||
#else
|
||||
throw e;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ struct sub_match : public std::pair<BidiIterator, BidiIterator>
|
||||
#endif
|
||||
difference_type BOOST_REGEX_CALL length()const
|
||||
{
|
||||
difference_type n = matched ? ::boost::BOOST_REGEX_DETAIL_NS::distance((BidiIterator)this->first, (BidiIterator)this->second) : 0;
|
||||
difference_type n = matched ? std::distance((BidiIterator)this->first, (BidiIterator)this->second) : 0;
|
||||
return n;
|
||||
}
|
||||
std::basic_string<value_type> str()const
|
||||
@ -73,7 +73,7 @@ struct sub_match : public std::pair<BidiIterator, BidiIterator>
|
||||
std::basic_string<value_type> result;
|
||||
if(matched)
|
||||
{
|
||||
std::size_t len = ::boost::BOOST_REGEX_DETAIL_NS::distance((BidiIterator)this->first, (BidiIterator)this->second);
|
||||
std::size_t len = std::distance((BidiIterator)this->first, (BidiIterator)this->second);
|
||||
result.reserve(len);
|
||||
BidiIterator i = this->first;
|
||||
while(i != this->second)
|
||||
@ -132,7 +132,7 @@ struct sub_match : public std::pair<BidiIterator, BidiIterator>
|
||||
}
|
||||
|
||||
private:
|
||||
mutable boost::scoped_ptr<capture_sequence_type> m_captures;
|
||||
mutable std::unique_ptr<capture_sequence_type> m_captures;
|
||||
public:
|
||||
|
||||
#endif
|
||||
|
@ -75,7 +75,7 @@ class u32regex_iterator
|
||||
{
|
||||
private:
|
||||
typedef u32regex_iterator_implementation<BidirectionalIterator> impl;
|
||||
typedef shared_ptr<impl> pimpl;
|
||||
typedef std::shared_ptr<impl> pimpl;
|
||||
public:
|
||||
typedef u32regex regex_type;
|
||||
typedef match_results<BidirectionalIterator> value_type;
|
||||
|
@ -19,18 +19,6 @@
|
||||
#ifndef BOOST_REGEX_V5_U32REGEX_TOKEN_ITERATOR_HPP
|
||||
#define BOOST_REGEX_V5_U32REGEX_TOKEN_ITERATOR_HPP
|
||||
|
||||
#if (BOOST_WORKAROUND(BOOST_BORLANDC, >= 0x560) && BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x570)))\
|
||||
|| 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
|
||||
@ -158,7 +146,7 @@ class u32regex_token_iterator
|
||||
{
|
||||
private:
|
||||
typedef u32regex_token_iterator_implementation<BidirectionalIterator> impl;
|
||||
typedef shared_ptr<impl> pimpl;
|
||||
typedef std::shared_ptr<impl> pimpl;
|
||||
public:
|
||||
typedef u32regex regex_type;
|
||||
typedef sub_match<BidirectionalIterator> value_type;
|
||||
|
@ -28,13 +28,13 @@
|
||||
#include <boost/regex/v5/regex_traits_defaults.hpp>
|
||||
#endif
|
||||
#ifdef BOOST_HAS_THREADS
|
||||
#include <boost/regex/pending/static_mutex.hpp>
|
||||
#include <mutex>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_PRIMARY_TRANSFORM
|
||||
#include <boost/regex/v5/primary_transform.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_REGEX_OBJECT_CACHE_HPP
|
||||
#include <boost/regex/pending/object_cache.hpp>
|
||||
#include <boost/regex/v5/object_cache.hpp>
|
||||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
@ -76,7 +76,7 @@ namespace BOOST_REGEX_DETAIL_NS{
|
||||
// start by typedeffing the types we'll need:
|
||||
//
|
||||
typedef ::boost::uint32_t lcid_type; // placeholder for LCID.
|
||||
typedef ::boost::shared_ptr<void> cat_type; // placeholder for dll HANDLE.
|
||||
typedef ::std::shared_ptr<void> cat_type; // placeholder for dll HANDLE.
|
||||
|
||||
//
|
||||
// then add wrappers around the actual Win32 API's (ie implementation hiding):
|
||||
@ -543,7 +543,7 @@ typename w32_regex_traits_implementation<charT>::char_class_type
|
||||
|
||||
|
||||
template <class charT>
|
||||
boost::shared_ptr<const w32_regex_traits_implementation<charT> > create_w32_regex_traits(::boost::BOOST_REGEX_DETAIL_NS::lcid_type l)
|
||||
std::shared_ptr<const w32_regex_traits_implementation<charT> > create_w32_regex_traits(::boost::BOOST_REGEX_DETAIL_NS::lcid_type l)
|
||||
{
|
||||
// TODO: create a cache for previously constructed objects.
|
||||
return boost::object_cache< ::boost::BOOST_REGEX_DETAIL_NS::lcid_type, w32_regex_traits_implementation<charT> >::get(l, 5);
|
||||
@ -663,14 +663,14 @@ public:
|
||||
static std::string get_catalog_name();
|
||||
|
||||
private:
|
||||
boost::shared_ptr<const BOOST_REGEX_DETAIL_NS::w32_regex_traits_implementation<charT> > m_pimpl;
|
||||
std::shared_ptr<const BOOST_REGEX_DETAIL_NS::w32_regex_traits_implementation<charT> > m_pimpl;
|
||||
//
|
||||
// catalog name handler:
|
||||
//
|
||||
static std::string& get_catalog_name_inst();
|
||||
|
||||
#ifdef BOOST_HAS_THREADS
|
||||
static static_mutex& get_mutex_inst();
|
||||
static std::mutex& get_mutex_inst();
|
||||
#endif
|
||||
};
|
||||
|
||||
@ -678,7 +678,7 @@ template <class charT>
|
||||
std::string w32_regex_traits<charT>::catalog_name(const std::string& name)
|
||||
{
|
||||
#ifdef BOOST_HAS_THREADS
|
||||
static_mutex::scoped_lock lk(get_mutex_inst());
|
||||
std::lock_guard<std::mutex> lk(get_mutex_inst());
|
||||
#endif
|
||||
std::string result(get_catalog_name_inst());
|
||||
get_catalog_name_inst() = name;
|
||||
@ -696,7 +696,7 @@ template <class charT>
|
||||
std::string w32_regex_traits<charT>::get_catalog_name()
|
||||
{
|
||||
#ifdef BOOST_HAS_THREADS
|
||||
static_mutex::scoped_lock lk(get_mutex_inst());
|
||||
std::lock_guard<std::mutex> lk(get_mutex_inst());
|
||||
#endif
|
||||
std::string result(get_catalog_name_inst());
|
||||
return result;
|
||||
@ -704,9 +704,9 @@ std::string w32_regex_traits<charT>::get_catalog_name()
|
||||
|
||||
#ifdef BOOST_HAS_THREADS
|
||||
template <class charT>
|
||||
static_mutex& w32_regex_traits<charT>::get_mutex_inst()
|
||||
std::mutex& w32_regex_traits<charT>::get_mutex_inst()
|
||||
{
|
||||
static static_mutex s_mutex = BOOST_STATIC_MUTEX_INIT;
|
||||
static std::mutex s_mutex;
|
||||
return s_mutex;
|
||||
}
|
||||
#endif
|
||||
@ -791,21 +791,21 @@ namespace BOOST_REGEX_DETAIL_NS {
|
||||
char_map[ii] = static_cast<char>(ii);
|
||||
#ifndef BOOST_NO_ANSI_APIS
|
||||
int r = ::LCMapStringA(this->m_locale, LCMAP_LOWERCASE, char_map, 1 << CHAR_BIT, this->m_lower_map, 1 << CHAR_BIT);
|
||||
BOOST_ASSERT(r != 0);
|
||||
BOOST_REGEX_ASSERT(r != 0);
|
||||
#else
|
||||
UINT code_page = get_code_page_for_locale_id(this->m_locale);
|
||||
BOOST_ASSERT(code_page != 0);
|
||||
BOOST_REGEX_ASSERT(code_page != 0);
|
||||
|
||||
WCHAR wide_char_map[1 << CHAR_BIT];
|
||||
int conv_r = ::MultiByteToWideChar(code_page, 0, char_map, 1 << CHAR_BIT, wide_char_map, 1 << CHAR_BIT);
|
||||
BOOST_ASSERT(conv_r != 0);
|
||||
BOOST_REGEX_ASSERT(conv_r != 0);
|
||||
|
||||
WCHAR wide_lower_map[1 << CHAR_BIT];
|
||||
int r = ::LCMapStringW(this->m_locale, LCMAP_LOWERCASE, wide_char_map, 1 << CHAR_BIT, wide_lower_map, 1 << CHAR_BIT);
|
||||
BOOST_ASSERT(r != 0);
|
||||
BOOST_REGEX_ASSERT(r != 0);
|
||||
|
||||
conv_r = ::WideCharToMultiByte(code_page, 0, wide_lower_map, r, this->m_lower_map, 1 << CHAR_BIT, NULL, NULL);
|
||||
BOOST_ASSERT(conv_r != 0);
|
||||
BOOST_REGEX_ASSERT(conv_r != 0);
|
||||
#endif
|
||||
if (r < (1 << CHAR_BIT))
|
||||
{
|
||||
@ -820,7 +820,7 @@ namespace BOOST_REGEX_DETAIL_NS {
|
||||
#else
|
||||
r = ::GetStringTypeExW(this->m_locale, CT_CTYPE1, wide_char_map, 1 << CHAR_BIT, this->m_type_map);
|
||||
#endif
|
||||
BOOST_ASSERT(0 != r);
|
||||
BOOST_REGEX_ASSERT(0 != r);
|
||||
}
|
||||
|
||||
inline lcid_type BOOST_REGEX_CALL w32_get_default_locale()
|
||||
|
Reference in New Issue
Block a user