forked from boostorg/regex
Remove more old code and enable standalone mode.
This commit is contained in:
@ -118,12 +118,20 @@
|
||||
#define UNICODE
|
||||
#endif
|
||||
|
||||
#define BOOST_REGEX_JOIN(x, y) x##y
|
||||
|
||||
#ifdef BOOST_FALLTHROUGH
|
||||
# define BOOST_REGEX_FALLTHROUGH BOOST_FALLTHROUGH
|
||||
#else
|
||||
# define BOOST_REGEX_FALLTHROUGH
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Define a macro for the namespace that details are placed in, this includes the Boost
|
||||
* version number to avoid mismatched header and library versions:
|
||||
*/
|
||||
#define BOOST_REGEX_DETAIL_NS BOOST_JOIN(re_detail_, BOOST_RE_VERSION)
|
||||
#define BOOST_REGEX_DETAIL_NS BOOST_REGEX_JOIN(re_detail_, BOOST_RE_VERSION)
|
||||
|
||||
/*
|
||||
* Fix for gcc prior to 3.4: std::ctype<wchar_t> doesn't allow
|
||||
@ -153,7 +161,7 @@
|
||||
# define _STLP_CWCTYPE
|
||||
# endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if defined(__cplusplus) && defined(BOOST_REGEX_CXX03)
|
||||
# include <boost/regex/config/cwchar.hpp>
|
||||
#endif
|
||||
|
||||
@ -200,15 +208,15 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef BOOST_SYMBOL_EXPORT
|
||||
#if !defined(BOOST_SYMBOL_EXPORT)
|
||||
# define BOOST_SYMBOL_EXPORT
|
||||
# define BOOST_SYMBOL_IMPORT
|
||||
#endif
|
||||
|
||||
#if (defined(BOOST_REGEX_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)) && !defined(BOOST_REGEX_STATIC_LINK)
|
||||
# if defined(BOOST_REGEX_SOURCE)
|
||||
# define BOOST_REGEX_DECL BOOST_SYMBOL_EXPORT
|
||||
# define BOOST_REGEX_BUILD_DLL
|
||||
# define BOOST_REGEX_DECL BOOST_SYMBOL_EXPORT
|
||||
# else
|
||||
# define BOOST_REGEX_DECL BOOST_SYMBOL_IMPORT
|
||||
# endif
|
||||
@ -216,6 +224,7 @@
|
||||
# define BOOST_REGEX_DECL
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_REGEX_CXX03
|
||||
#if !defined(BOOST_REGEX_NO_LIB) && !defined(BOOST_REGEX_SOURCE) && !defined(BOOST_ALL_NO_LIB) && defined(__cplusplus)
|
||||
# define BOOST_LIB_NAME boost_regex
|
||||
# if defined(BOOST_REGEX_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)
|
||||
@ -226,6 +235,7 @@
|
||||
# endif
|
||||
# include <boost/config/auto_link.hpp>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -23,110 +23,10 @@
|
||||
#include <boost/regex/config.hpp>
|
||||
#endif
|
||||
|
||||
#include <cstddef>
|
||||
#include <stdexcept>
|
||||
#ifdef BOOST_REGEX_CXX03
|
||||
#include <boost/regex/v4/error_type.hpp>
|
||||
#include <boost/regex/v4/regex_traits_defaults.hpp>
|
||||
#include <boost/regex/v4/pattern_except.hpp>
|
||||
#else
|
||||
#include <boost/regex/v5/error_type.hpp>
|
||||
#include <boost/regex/v5/regex_traits_defaults.hpp>
|
||||
#include <boost/regex/v5/pattern_except.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4103)
|
||||
#endif
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_PREFIX
|
||||
#endif
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4275)
|
||||
#if BOOST_MSVC >= 1800
|
||||
#pragma warning(disable : 26812)
|
||||
#endif
|
||||
#endif
|
||||
class regex_error : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
explicit regex_error(const std::string& s, regex_constants::error_type err = regex_constants::error_unknown, std::ptrdiff_t pos = 0)
|
||||
: std::runtime_error(s)
|
||||
, m_error_code(err)
|
||||
, m_position(pos)
|
||||
{
|
||||
}
|
||||
explicit regex_error(regex_constants::error_type err)
|
||||
: std::runtime_error(::boost::BOOST_REGEX_DETAIL_NS::get_default_error_string(err))
|
||||
, m_error_code(err)
|
||||
, m_position(0)
|
||||
{
|
||||
}
|
||||
~regex_error() BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE {}
|
||||
regex_constants::error_type code()const
|
||||
{ return m_error_code; }
|
||||
std::ptrdiff_t position()const
|
||||
{ return m_position; }
|
||||
void raise()const
|
||||
{
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
#ifndef BOOST_REGEX_STANDALONE
|
||||
::boost::throw_exception(*this);
|
||||
#else
|
||||
throw* this;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
private:
|
||||
regex_constants::error_type m_error_code;
|
||||
std::ptrdiff_t m_position;
|
||||
};
|
||||
|
||||
typedef regex_error bad_pattern;
|
||||
typedef regex_error bad_expression;
|
||||
|
||||
namespace BOOST_REGEX_DETAIL_NS{
|
||||
|
||||
inline void BOOST_REGEX_CALL raise_runtime_error(const std::runtime_error& ex)
|
||||
{
|
||||
#ifndef BOOST_REGEX_STANDALONE
|
||||
::boost::throw_exception(ex);
|
||||
#else
|
||||
throw ex;
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class traits>
|
||||
void raise_error(const traits& t, regex_constants::error_type code)
|
||||
{
|
||||
(void)t; // warning suppression
|
||||
std::runtime_error e(t.error_string(code));
|
||||
::boost::BOOST_REGEX_DETAIL_NS::raise_runtime_error(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4103)
|
||||
#endif
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_SUFFIX
|
||||
#endif
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
|
@ -1,790 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2004
|
||||
* John Maddock
|
||||
*
|
||||
* Use, modification and distribution are subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying file
|
||||
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* LOCATION: see http://www.boost.org for most recent version.
|
||||
* FILE unicode_iterator.hpp
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Iterator adapters for converting between different Unicode encodings.
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
Contents:
|
||||
~~~~~~~~~
|
||||
|
||||
1) Read Only, Input Adapters:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
template <class BaseIterator, class U8Type = ::boost::uint8_t>
|
||||
class u32_to_u8_iterator;
|
||||
|
||||
Adapts sequence of UTF-32 code points to "look like" a sequence of UTF-8.
|
||||
|
||||
template <class BaseIterator, class U32Type = ::boost::uint32_t>
|
||||
class u8_to_u32_iterator;
|
||||
|
||||
Adapts sequence of UTF-8 code points to "look like" a sequence of UTF-32.
|
||||
|
||||
template <class BaseIterator, class U16Type = ::boost::uint16_t>
|
||||
class u32_to_u16_iterator;
|
||||
|
||||
Adapts sequence of UTF-32 code points to "look like" a sequence of UTF-16.
|
||||
|
||||
template <class BaseIterator, class U32Type = ::boost::uint32_t>
|
||||
class u16_to_u32_iterator;
|
||||
|
||||
Adapts sequence of UTF-16 code points to "look like" a sequence of UTF-32.
|
||||
|
||||
2) Single pass output iterator adapters:
|
||||
|
||||
template <class BaseIterator>
|
||||
class utf8_output_iterator;
|
||||
|
||||
Accepts UTF-32 code points and forwards them on as UTF-8 code points.
|
||||
|
||||
template <class BaseIterator>
|
||||
class utf16_output_iterator;
|
||||
|
||||
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/regex/config.hpp>
|
||||
#include <boost/iterator/iterator_facade.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <stdexcept>
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
#include <sstream>
|
||||
#include <ios>
|
||||
#endif
|
||||
#include <limits.h> // CHAR_BIT
|
||||
|
||||
#ifdef BOOST_REGEX_CXX03
|
||||
|
||||
#else
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
|
||||
namespace detail{
|
||||
|
||||
static const ::boost::uint16_t high_surrogate_base = 0xD7C0u;
|
||||
static const ::boost::uint16_t low_surrogate_base = 0xDC00u;
|
||||
static const ::boost::uint32_t ten_bit_mask = 0x3FFu;
|
||||
|
||||
inline bool is_high_surrogate(::boost::uint16_t v)
|
||||
{
|
||||
return (v & 0xFFFFFC00u) == 0xd800u;
|
||||
}
|
||||
inline bool is_low_surrogate(::boost::uint16_t v)
|
||||
{
|
||||
return (v & 0xFFFFFC00u) == 0xdc00u;
|
||||
}
|
||||
template <class T>
|
||||
inline bool is_surrogate(T v)
|
||||
{
|
||||
return (v & 0xFFFFF800u) == 0xd800;
|
||||
}
|
||||
|
||||
inline unsigned utf8_byte_count(boost::uint8_t c)
|
||||
{
|
||||
// if the most significant bit with a zero in it is in position
|
||||
// 8-N then there are N bytes in this UTF-8 sequence:
|
||||
boost::uint8_t mask = 0x80u;
|
||||
unsigned result = 0;
|
||||
while(c & mask)
|
||||
{
|
||||
++result;
|
||||
mask >>= 1;
|
||||
}
|
||||
return (result == 0) ? 1 : ((result > 4) ? 4 : result);
|
||||
}
|
||||
|
||||
inline unsigned utf8_trailing_byte_count(boost::uint8_t c)
|
||||
{
|
||||
return utf8_byte_count(c) - 1;
|
||||
}
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4100)
|
||||
#endif
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
BOOST_NORETURN
|
||||
#endif
|
||||
inline void invalid_utf32_code_point(::boost::uint32_t val)
|
||||
{
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
std::stringstream ss;
|
||||
ss << "Invalid UTF-32 code point U+" << std::showbase << std::hex << val << " encountered while trying to encode UTF-16 sequence";
|
||||
std::out_of_range e(ss.str());
|
||||
#else
|
||||
std::out_of_range e("Invalid UTF-32 code point encountered while trying to encode UTF-16 sequence");
|
||||
#endif
|
||||
boost::throw_exception(e);
|
||||
}
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <class BaseIterator, class U16Type = ::boost::uint16_t>
|
||||
class u32_to_u16_iterator
|
||||
: public boost::iterator_facade<u32_to_u16_iterator<BaseIterator, U16Type>, U16Type, std::bidirectional_iterator_tag, const U16Type>
|
||||
{
|
||||
typedef boost::iterator_facade<u32_to_u16_iterator<BaseIterator, U16Type>, U16Type, std::bidirectional_iterator_tag, const U16Type> base_type;
|
||||
|
||||
#if !defined(BOOST_NO_STD_ITERATOR_TRAITS)
|
||||
typedef typename std::iterator_traits<BaseIterator>::value_type base_value_type;
|
||||
|
||||
BOOST_STATIC_ASSERT(sizeof(base_value_type)*CHAR_BIT == 32);
|
||||
BOOST_STATIC_ASSERT(sizeof(U16Type)*CHAR_BIT == 16);
|
||||
#endif
|
||||
|
||||
public:
|
||||
typename base_type::reference
|
||||
dereference()const
|
||||
{
|
||||
if(m_current == 2)
|
||||
extract_current();
|
||||
return m_values[m_current];
|
||||
}
|
||||
bool equal(const u32_to_u16_iterator& that)const
|
||||
{
|
||||
if(m_position == that.m_position)
|
||||
{
|
||||
// Both m_currents must be equal, or both even
|
||||
// this is the same as saying their sum must be even:
|
||||
return (m_current + that.m_current) & 1u ? false : true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
void increment()
|
||||
{
|
||||
// if we have a pending read then read now, so that we know whether
|
||||
// to skip a position, or move to a low-surrogate:
|
||||
if(m_current == 2)
|
||||
{
|
||||
// pending read:
|
||||
extract_current();
|
||||
}
|
||||
// move to the next surrogate position:
|
||||
++m_current;
|
||||
// if we've reached the end skip a position:
|
||||
if(m_values[m_current] == 0)
|
||||
{
|
||||
m_current = 2;
|
||||
++m_position;
|
||||
}
|
||||
}
|
||||
void decrement()
|
||||
{
|
||||
if(m_current != 1)
|
||||
{
|
||||
// decrementing an iterator always leads to a valid position:
|
||||
--m_position;
|
||||
extract_current();
|
||||
m_current = m_values[1] ? 1 : 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_current = 0;
|
||||
}
|
||||
}
|
||||
BaseIterator base()const
|
||||
{
|
||||
return m_position;
|
||||
}
|
||||
// construct:
|
||||
u32_to_u16_iterator() : m_position(), m_current(0)
|
||||
{
|
||||
m_values[0] = 0;
|
||||
m_values[1] = 0;
|
||||
m_values[2] = 0;
|
||||
}
|
||||
u32_to_u16_iterator(BaseIterator b) : m_position(b), m_current(2)
|
||||
{
|
||||
m_values[0] = 0;
|
||||
m_values[1] = 0;
|
||||
m_values[2] = 0;
|
||||
}
|
||||
private:
|
||||
|
||||
void extract_current()const
|
||||
{
|
||||
// begin by checking for a code point out of range:
|
||||
::boost::uint32_t v = *m_position;
|
||||
if(v >= 0x10000u)
|
||||
{
|
||||
if(v > 0x10FFFFu)
|
||||
detail::invalid_utf32_code_point(*m_position);
|
||||
// split into two surrogates:
|
||||
m_values[0] = static_cast<U16Type>(v >> 10) + detail::high_surrogate_base;
|
||||
m_values[1] = static_cast<U16Type>(v & detail::ten_bit_mask) + detail::low_surrogate_base;
|
||||
m_current = 0;
|
||||
BOOST_REGEX_ASSERT(detail::is_high_surrogate(m_values[0]));
|
||||
BOOST_REGEX_ASSERT(detail::is_low_surrogate(m_values[1]));
|
||||
}
|
||||
else
|
||||
{
|
||||
// 16-bit code point:
|
||||
m_values[0] = static_cast<U16Type>(*m_position);
|
||||
m_values[1] = 0;
|
||||
m_current = 0;
|
||||
// value must not be a surrogate:
|
||||
if(detail::is_surrogate(m_values[0]))
|
||||
detail::invalid_utf32_code_point(*m_position);
|
||||
}
|
||||
}
|
||||
BaseIterator m_position;
|
||||
mutable U16Type m_values[3];
|
||||
mutable unsigned m_current;
|
||||
};
|
||||
|
||||
template <class BaseIterator, class U32Type = ::boost::uint32_t>
|
||||
class u16_to_u32_iterator
|
||||
: public boost::iterator_facade<u16_to_u32_iterator<BaseIterator, U32Type>, U32Type, std::bidirectional_iterator_tag, const U32Type>
|
||||
{
|
||||
typedef boost::iterator_facade<u16_to_u32_iterator<BaseIterator, U32Type>, U32Type, std::bidirectional_iterator_tag, const U32Type> base_type;
|
||||
// special values for pending iterator reads:
|
||||
BOOST_STATIC_CONSTANT(U32Type, pending_read = 0xffffffffu);
|
||||
|
||||
#if !defined(BOOST_NO_STD_ITERATOR_TRAITS)
|
||||
typedef typename std::iterator_traits<BaseIterator>::value_type base_value_type;
|
||||
|
||||
BOOST_STATIC_ASSERT(sizeof(base_value_type)*CHAR_BIT == 16);
|
||||
BOOST_STATIC_ASSERT(sizeof(U32Type)*CHAR_BIT == 32);
|
||||
#endif
|
||||
|
||||
public:
|
||||
typename base_type::reference
|
||||
dereference()const
|
||||
{
|
||||
if(m_value == pending_read)
|
||||
extract_current();
|
||||
return m_value;
|
||||
}
|
||||
bool equal(const u16_to_u32_iterator& that)const
|
||||
{
|
||||
return m_position == that.m_position;
|
||||
}
|
||||
void increment()
|
||||
{
|
||||
// skip high surrogate first if there is one:
|
||||
if(detail::is_high_surrogate(*m_position)) ++m_position;
|
||||
++m_position;
|
||||
m_value = pending_read;
|
||||
}
|
||||
void decrement()
|
||||
{
|
||||
--m_position;
|
||||
// if we have a low surrogate then go back one more:
|
||||
if(detail::is_low_surrogate(*m_position))
|
||||
--m_position;
|
||||
m_value = pending_read;
|
||||
}
|
||||
BaseIterator base()const
|
||||
{
|
||||
return m_position;
|
||||
}
|
||||
// construct:
|
||||
u16_to_u32_iterator() : m_position()
|
||||
{
|
||||
m_value = pending_read;
|
||||
}
|
||||
u16_to_u32_iterator(BaseIterator b) : m_position(b)
|
||||
{
|
||||
m_value = pending_read;
|
||||
}
|
||||
//
|
||||
// Range checked version:
|
||||
//
|
||||
u16_to_u32_iterator(BaseIterator b, BaseIterator start, BaseIterator end) : m_position(b)
|
||||
{
|
||||
m_value = pending_read;
|
||||
//
|
||||
// The range must not start with a low surrogate, or end in a high surrogate,
|
||||
// otherwise we run the risk of running outside the underlying input range.
|
||||
// Likewise b must not be located at a low surrogate.
|
||||
//
|
||||
boost::uint16_t val;
|
||||
if(start != end)
|
||||
{
|
||||
if((b != start) && (b != end))
|
||||
{
|
||||
val = *b;
|
||||
if(detail::is_surrogate(val) && ((val & 0xFC00u) == 0xDC00u))
|
||||
invalid_code_point(val);
|
||||
}
|
||||
val = *start;
|
||||
if(detail::is_surrogate(val) && ((val & 0xFC00u) == 0xDC00u))
|
||||
invalid_code_point(val);
|
||||
val = *--end;
|
||||
if(detail::is_high_surrogate(val))
|
||||
invalid_code_point(val);
|
||||
}
|
||||
}
|
||||
private:
|
||||
static void invalid_code_point(::boost::uint16_t val)
|
||||
{
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
std::stringstream ss;
|
||||
ss << "Misplaced UTF-16 surrogate U+" << std::showbase << std::hex << val << " encountered while trying to encode UTF-32 sequence";
|
||||
std::out_of_range e(ss.str());
|
||||
#else
|
||||
std::out_of_range e("Misplaced UTF-16 surrogate encountered while trying to encode UTF-32 sequence");
|
||||
#endif
|
||||
boost::throw_exception(e);
|
||||
}
|
||||
void extract_current()const
|
||||
{
|
||||
m_value = static_cast<U32Type>(static_cast< ::boost::uint16_t>(*m_position));
|
||||
// if the last value is a high surrogate then adjust m_position and m_value as needed:
|
||||
if(detail::is_high_surrogate(*m_position))
|
||||
{
|
||||
// precondition; next value must have be a low-surrogate:
|
||||
BaseIterator next(m_position);
|
||||
::boost::uint16_t t = *++next;
|
||||
if((t & 0xFC00u) != 0xDC00u)
|
||||
invalid_code_point(t);
|
||||
m_value = (m_value - detail::high_surrogate_base) << 10;
|
||||
m_value |= (static_cast<U32Type>(static_cast< ::boost::uint16_t>(t)) & detail::ten_bit_mask);
|
||||
}
|
||||
// postcondition; result must not be a surrogate:
|
||||
if(detail::is_surrogate(m_value))
|
||||
invalid_code_point(static_cast< ::boost::uint16_t>(m_value));
|
||||
}
|
||||
BaseIterator m_position;
|
||||
mutable U32Type m_value;
|
||||
};
|
||||
|
||||
template <class BaseIterator, class U8Type = ::boost::uint8_t>
|
||||
class u32_to_u8_iterator
|
||||
: public boost::iterator_facade<u32_to_u8_iterator<BaseIterator, U8Type>, U8Type, std::bidirectional_iterator_tag, const U8Type>
|
||||
{
|
||||
typedef boost::iterator_facade<u32_to_u8_iterator<BaseIterator, U8Type>, U8Type, std::bidirectional_iterator_tag, const U8Type> base_type;
|
||||
|
||||
#if !defined(BOOST_NO_STD_ITERATOR_TRAITS)
|
||||
typedef typename std::iterator_traits<BaseIterator>::value_type base_value_type;
|
||||
|
||||
BOOST_STATIC_ASSERT(sizeof(base_value_type)*CHAR_BIT == 32);
|
||||
BOOST_STATIC_ASSERT(sizeof(U8Type)*CHAR_BIT == 8);
|
||||
#endif
|
||||
|
||||
public:
|
||||
typename base_type::reference
|
||||
dereference()const
|
||||
{
|
||||
if(m_current == 4)
|
||||
extract_current();
|
||||
return m_values[m_current];
|
||||
}
|
||||
bool equal(const u32_to_u8_iterator& that)const
|
||||
{
|
||||
if(m_position == that.m_position)
|
||||
{
|
||||
// either the m_current's must be equal, or one must be 0 and
|
||||
// the other 4: which means neither must have bits 1 or 2 set:
|
||||
return (m_current == that.m_current)
|
||||
|| (((m_current | that.m_current) & 3) == 0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
void increment()
|
||||
{
|
||||
// if we have a pending read then read now, so that we know whether
|
||||
// to skip a position, or move to a low-surrogate:
|
||||
if(m_current == 4)
|
||||
{
|
||||
// pending read:
|
||||
extract_current();
|
||||
}
|
||||
// move to the next surrogate position:
|
||||
++m_current;
|
||||
// if we've reached the end skip a position:
|
||||
if(m_values[m_current] == 0)
|
||||
{
|
||||
m_current = 4;
|
||||
++m_position;
|
||||
}
|
||||
}
|
||||
void decrement()
|
||||
{
|
||||
if((m_current & 3) == 0)
|
||||
{
|
||||
--m_position;
|
||||
extract_current();
|
||||
m_current = 3;
|
||||
while(m_current && (m_values[m_current] == 0))
|
||||
--m_current;
|
||||
}
|
||||
else
|
||||
--m_current;
|
||||
}
|
||||
BaseIterator base()const
|
||||
{
|
||||
return m_position;
|
||||
}
|
||||
// construct:
|
||||
u32_to_u8_iterator() : m_position(), m_current(0)
|
||||
{
|
||||
m_values[0] = 0;
|
||||
m_values[1] = 0;
|
||||
m_values[2] = 0;
|
||||
m_values[3] = 0;
|
||||
m_values[4] = 0;
|
||||
}
|
||||
u32_to_u8_iterator(BaseIterator b) : m_position(b), m_current(4)
|
||||
{
|
||||
m_values[0] = 0;
|
||||
m_values[1] = 0;
|
||||
m_values[2] = 0;
|
||||
m_values[3] = 0;
|
||||
m_values[4] = 0;
|
||||
}
|
||||
private:
|
||||
|
||||
void extract_current()const
|
||||
{
|
||||
boost::uint32_t c = *m_position;
|
||||
if(c > 0x10FFFFu)
|
||||
detail::invalid_utf32_code_point(c);
|
||||
if(c < 0x80u)
|
||||
{
|
||||
m_values[0] = static_cast<unsigned char>(c);
|
||||
m_values[1] = static_cast<unsigned char>(0u);
|
||||
m_values[2] = static_cast<unsigned char>(0u);
|
||||
m_values[3] = static_cast<unsigned char>(0u);
|
||||
}
|
||||
else if(c < 0x800u)
|
||||
{
|
||||
m_values[0] = static_cast<unsigned char>(0xC0u + (c >> 6));
|
||||
m_values[1] = static_cast<unsigned char>(0x80u + (c & 0x3Fu));
|
||||
m_values[2] = static_cast<unsigned char>(0u);
|
||||
m_values[3] = static_cast<unsigned char>(0u);
|
||||
}
|
||||
else if(c < 0x10000u)
|
||||
{
|
||||
m_values[0] = static_cast<unsigned char>(0xE0u + (c >> 12));
|
||||
m_values[1] = static_cast<unsigned char>(0x80u + ((c >> 6) & 0x3Fu));
|
||||
m_values[2] = static_cast<unsigned char>(0x80u + (c & 0x3Fu));
|
||||
m_values[3] = static_cast<unsigned char>(0u);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_values[0] = static_cast<unsigned char>(0xF0u + (c >> 18));
|
||||
m_values[1] = static_cast<unsigned char>(0x80u + ((c >> 12) & 0x3Fu));
|
||||
m_values[2] = static_cast<unsigned char>(0x80u + ((c >> 6) & 0x3Fu));
|
||||
m_values[3] = static_cast<unsigned char>(0x80u + (c & 0x3Fu));
|
||||
}
|
||||
m_current= 0;
|
||||
}
|
||||
BaseIterator m_position;
|
||||
mutable U8Type m_values[5];
|
||||
mutable unsigned m_current;
|
||||
};
|
||||
|
||||
template <class BaseIterator, class U32Type = ::boost::uint32_t>
|
||||
class u8_to_u32_iterator
|
||||
: public boost::iterator_facade<u8_to_u32_iterator<BaseIterator, U32Type>, U32Type, std::bidirectional_iterator_tag, const U32Type>
|
||||
{
|
||||
typedef boost::iterator_facade<u8_to_u32_iterator<BaseIterator, U32Type>, U32Type, std::bidirectional_iterator_tag, const U32Type> base_type;
|
||||
// special values for pending iterator reads:
|
||||
BOOST_STATIC_CONSTANT(U32Type, pending_read = 0xffffffffu);
|
||||
|
||||
#if !defined(BOOST_NO_STD_ITERATOR_TRAITS)
|
||||
typedef typename std::iterator_traits<BaseIterator>::value_type base_value_type;
|
||||
|
||||
BOOST_STATIC_ASSERT(sizeof(base_value_type)*CHAR_BIT == 8);
|
||||
BOOST_STATIC_ASSERT(sizeof(U32Type)*CHAR_BIT == 32);
|
||||
#endif
|
||||
|
||||
public:
|
||||
typename base_type::reference
|
||||
dereference()const
|
||||
{
|
||||
if(m_value == pending_read)
|
||||
extract_current();
|
||||
return m_value;
|
||||
}
|
||||
bool equal(const u8_to_u32_iterator& that)const
|
||||
{
|
||||
return m_position == that.m_position;
|
||||
}
|
||||
void increment()
|
||||
{
|
||||
// We must not start with a continuation character:
|
||||
if((static_cast<boost::uint8_t>(*m_position) & 0xC0) == 0x80)
|
||||
invalid_sequence();
|
||||
// skip high surrogate first if there is one:
|
||||
unsigned c = detail::utf8_byte_count(*m_position);
|
||||
if(m_value == pending_read)
|
||||
{
|
||||
// Since we haven't read in a value, we need to validate the code points:
|
||||
for(unsigned i = 0; i < c; ++i)
|
||||
{
|
||||
++m_position;
|
||||
// We must have a continuation byte:
|
||||
if((i != c - 1) && ((static_cast<boost::uint8_t>(*m_position) & 0xC0) != 0x80))
|
||||
invalid_sequence();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::advance(m_position, c);
|
||||
}
|
||||
m_value = pending_read;
|
||||
}
|
||||
void decrement()
|
||||
{
|
||||
// Keep backtracking until we don't have a trailing character:
|
||||
unsigned count = 0;
|
||||
while((*--m_position & 0xC0u) == 0x80u) ++count;
|
||||
// now check that the sequence was valid:
|
||||
if(count != detail::utf8_trailing_byte_count(*m_position))
|
||||
invalid_sequence();
|
||||
m_value = pending_read;
|
||||
}
|
||||
BaseIterator base()const
|
||||
{
|
||||
return m_position;
|
||||
}
|
||||
// construct:
|
||||
u8_to_u32_iterator() : m_position()
|
||||
{
|
||||
m_value = pending_read;
|
||||
}
|
||||
u8_to_u32_iterator(BaseIterator b) : m_position(b)
|
||||
{
|
||||
m_value = pending_read;
|
||||
}
|
||||
//
|
||||
// Checked constructor:
|
||||
//
|
||||
u8_to_u32_iterator(BaseIterator b, BaseIterator start, BaseIterator end) : m_position(b)
|
||||
{
|
||||
m_value = pending_read;
|
||||
//
|
||||
// We must not start with a continuation character, or end with a
|
||||
// truncated UTF-8 sequence otherwise we run the risk of going past
|
||||
// the start/end of the underlying sequence:
|
||||
//
|
||||
if(start != end)
|
||||
{
|
||||
unsigned char v = *start;
|
||||
if((v & 0xC0u) == 0x80u)
|
||||
invalid_sequence();
|
||||
if((b != start) && (b != end) && ((*b & 0xC0u) == 0x80u))
|
||||
invalid_sequence();
|
||||
BaseIterator pos = end;
|
||||
do
|
||||
{
|
||||
v = *--pos;
|
||||
}
|
||||
while((start != pos) && ((v & 0xC0u) == 0x80u));
|
||||
std::ptrdiff_t extra = detail::utf8_byte_count(v);
|
||||
if(std::distance(pos, end) < extra)
|
||||
invalid_sequence();
|
||||
}
|
||||
}
|
||||
private:
|
||||
static void invalid_sequence()
|
||||
{
|
||||
std::out_of_range e("Invalid UTF-8 sequence encountered while trying to encode UTF-32 character");
|
||||
boost::throw_exception(e);
|
||||
}
|
||||
void extract_current()const
|
||||
{
|
||||
m_value = static_cast<U32Type>(static_cast< ::boost::uint8_t>(*m_position));
|
||||
// we must not have a continuation character:
|
||||
if((m_value & 0xC0u) == 0x80u)
|
||||
invalid_sequence();
|
||||
// see how many extra bytes we have:
|
||||
unsigned extra = detail::utf8_trailing_byte_count(*m_position);
|
||||
// extract the extra bits, 6 from each extra byte:
|
||||
BaseIterator next(m_position);
|
||||
for(unsigned c = 0; c < extra; ++c)
|
||||
{
|
||||
++next;
|
||||
m_value <<= 6;
|
||||
// We must have a continuation byte:
|
||||
if((static_cast<boost::uint8_t>(*next) & 0xC0) != 0x80)
|
||||
invalid_sequence();
|
||||
m_value += static_cast<boost::uint8_t>(*next) & 0x3Fu;
|
||||
}
|
||||
// we now need to remove a few of the leftmost bits, but how many depends
|
||||
// upon how many extra bytes we've extracted:
|
||||
static const boost::uint32_t masks[4] =
|
||||
{
|
||||
0x7Fu,
|
||||
0x7FFu,
|
||||
0xFFFFu,
|
||||
0x1FFFFFu,
|
||||
};
|
||||
m_value &= masks[extra];
|
||||
// check the result is in range:
|
||||
if(m_value > static_cast<U32Type>(0x10FFFFu))
|
||||
invalid_sequence();
|
||||
// The result must not be a surrogate:
|
||||
if((m_value >= static_cast<U32Type>(0xD800)) && (m_value <= static_cast<U32Type>(0xDFFF)))
|
||||
invalid_sequence();
|
||||
// We should not have had an invalidly encoded UTF8 sequence:
|
||||
if((extra > 0) && (m_value <= static_cast<U32Type>(masks[extra - 1])))
|
||||
invalid_sequence();
|
||||
}
|
||||
BaseIterator m_position;
|
||||
mutable U32Type m_value;
|
||||
};
|
||||
|
||||
template <class BaseIterator>
|
||||
class utf16_output_iterator
|
||||
{
|
||||
public:
|
||||
typedef void difference_type;
|
||||
typedef void value_type;
|
||||
typedef boost::uint32_t* pointer;
|
||||
typedef boost::uint32_t& reference;
|
||||
typedef std::output_iterator_tag iterator_category;
|
||||
|
||||
utf16_output_iterator(const BaseIterator& b)
|
||||
: m_position(b){}
|
||||
utf16_output_iterator(const utf16_output_iterator& that)
|
||||
: m_position(that.m_position){}
|
||||
utf16_output_iterator& operator=(const utf16_output_iterator& that)
|
||||
{
|
||||
m_position = that.m_position;
|
||||
return *this;
|
||||
}
|
||||
const utf16_output_iterator& operator*()const
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
void operator=(boost::uint32_t val)const
|
||||
{
|
||||
push(val);
|
||||
}
|
||||
utf16_output_iterator& operator++()
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
utf16_output_iterator& operator++(int)
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
BaseIterator base()const
|
||||
{
|
||||
return m_position;
|
||||
}
|
||||
private:
|
||||
void push(boost::uint32_t v)const
|
||||
{
|
||||
if(v >= 0x10000u)
|
||||
{
|
||||
// begin by checking for a code point out of range:
|
||||
if(v > 0x10FFFFu)
|
||||
detail::invalid_utf32_code_point(v);
|
||||
// split into two surrogates:
|
||||
*m_position++ = static_cast<boost::uint16_t>(v >> 10) + detail::high_surrogate_base;
|
||||
*m_position++ = static_cast<boost::uint16_t>(v & detail::ten_bit_mask) + detail::low_surrogate_base;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 16-bit code point:
|
||||
// value must not be a surrogate:
|
||||
if(detail::is_surrogate(v))
|
||||
detail::invalid_utf32_code_point(v);
|
||||
*m_position++ = static_cast<boost::uint16_t>(v);
|
||||
}
|
||||
}
|
||||
mutable BaseIterator m_position;
|
||||
};
|
||||
|
||||
template <class BaseIterator>
|
||||
class utf8_output_iterator
|
||||
{
|
||||
public:
|
||||
typedef void difference_type;
|
||||
typedef void value_type;
|
||||
typedef boost::uint32_t* pointer;
|
||||
typedef boost::uint32_t& reference;
|
||||
typedef std::output_iterator_tag iterator_category;
|
||||
|
||||
utf8_output_iterator(const BaseIterator& b)
|
||||
: m_position(b){}
|
||||
utf8_output_iterator(const utf8_output_iterator& that)
|
||||
: m_position(that.m_position){}
|
||||
utf8_output_iterator& operator=(const utf8_output_iterator& that)
|
||||
{
|
||||
m_position = that.m_position;
|
||||
return *this;
|
||||
}
|
||||
const utf8_output_iterator& operator*()const
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
void operator=(boost::uint32_t val)const
|
||||
{
|
||||
push(val);
|
||||
}
|
||||
utf8_output_iterator& operator++()
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
utf8_output_iterator& operator++(int)
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
BaseIterator base()const
|
||||
{
|
||||
return m_position;
|
||||
}
|
||||
private:
|
||||
void push(boost::uint32_t c)const
|
||||
{
|
||||
if(c > 0x10FFFFu)
|
||||
detail::invalid_utf32_code_point(c);
|
||||
if(c < 0x80u)
|
||||
{
|
||||
*m_position++ = static_cast<unsigned char>(c);
|
||||
}
|
||||
else if(c < 0x800u)
|
||||
{
|
||||
*m_position++ = static_cast<unsigned char>(0xC0u + (c >> 6));
|
||||
*m_position++ = static_cast<unsigned char>(0x80u + (c & 0x3Fu));
|
||||
}
|
||||
else if(c < 0x10000u)
|
||||
{
|
||||
*m_position++ = static_cast<unsigned char>(0xE0u + (c >> 12));
|
||||
*m_position++ = static_cast<unsigned char>(0x80u + ((c >> 6) & 0x3Fu));
|
||||
*m_position++ = static_cast<unsigned char>(0x80u + (c & 0x3Fu));
|
||||
}
|
||||
else
|
||||
{
|
||||
*m_position++ = static_cast<unsigned char>(0xF0u + (c >> 18));
|
||||
*m_position++ = static_cast<unsigned char>(0x80u + ((c >> 12) & 0x3Fu));
|
||||
*m_position++ = static_cast<unsigned char>(0x80u + ((c >> 6) & 0x3Fu));
|
||||
*m_position++ = static_cast<unsigned char>(0x80u + (c & 0x3Fu));
|
||||
}
|
||||
}
|
||||
mutable BaseIterator m_position;
|
||||
};
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_REGEX_UNICODE_ITERATOR_HPP
|
||||
|
@ -736,14 +736,14 @@ void basic_regex_creator<charT, traits>::fixup_pointers(re_syntax_base* state)
|
||||
case syntax_element_long_set_rep:
|
||||
// set the state_id of this repeat:
|
||||
static_cast<re_repeat*>(state)->state_id = m_repeater_id++;
|
||||
BOOST_FALLTHROUGH;
|
||||
BOOST_REGEX_FALLTHROUGH;
|
||||
case syntax_element_alt:
|
||||
std::memset(static_cast<re_alt*>(state)->_map, 0, sizeof(static_cast<re_alt*>(state)->_map));
|
||||
static_cast<re_alt*>(state)->can_be_null = 0;
|
||||
BOOST_FALLTHROUGH;
|
||||
BOOST_REGEX_FALLTHROUGH;
|
||||
case syntax_element_jump:
|
||||
static_cast<re_jump*>(state)->alt.p = getaddress(static_cast<re_jump*>(state)->alt.i, state);
|
||||
BOOST_FALLTHROUGH;
|
||||
BOOST_REGEX_FALLTHROUGH;
|
||||
default:
|
||||
if(state->next.i)
|
||||
state->next.p = getaddress(state->next.i, state);
|
||||
@ -947,7 +947,7 @@ void basic_regex_creator<charT, traits>::create_startmaps(re_syntax_base* state)
|
||||
e.raise();
|
||||
}
|
||||
}
|
||||
BOOST_FALLTHROUGH;
|
||||
BOOST_REGEX_FALLTHROUGH;
|
||||
default:
|
||||
state = state->next.p;
|
||||
}
|
||||
@ -1170,13 +1170,13 @@ void basic_regex_creator<charT, traits>::create_startmap(re_syntax_base* state,
|
||||
}
|
||||
m_recursion_checks[recursion_sub] |= 1u;
|
||||
// can't handle nested recursion here...
|
||||
BOOST_FALLTHROUGH;
|
||||
BOOST_REGEX_FALLTHROUGH;
|
||||
}
|
||||
case syntax_element_backref:
|
||||
// can be null, and any character can match:
|
||||
if(pnull)
|
||||
*pnull |= mask;
|
||||
BOOST_FALLTHROUGH;
|
||||
BOOST_REGEX_FALLTHROUGH;
|
||||
case syntax_element_wild:
|
||||
{
|
||||
// can't be null, any character can match:
|
||||
@ -1383,7 +1383,7 @@ void basic_regex_creator<charT, traits>::create_startmap(re_syntax_base* state,
|
||||
state = state->next.p->next.p;
|
||||
break;
|
||||
}
|
||||
BOOST_FALLTHROUGH;
|
||||
BOOST_REGEX_FALLTHROUGH;
|
||||
default:
|
||||
state = state->next.p;
|
||||
}
|
||||
@ -1569,7 +1569,7 @@ void basic_regex_creator<charT, traits>::probe_leading_repeat(re_syntax_base* st
|
||||
case syntax_element_long_set_rep:
|
||||
if(this->m_has_backrefs == 0)
|
||||
static_cast<re_repeat*>(state)->leading = true;
|
||||
BOOST_FALLTHROUGH;
|
||||
BOOST_REGEX_FALLTHROUGH;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
@ -411,7 +411,7 @@ bool basic_regex_parser<charT, traits>::parse_extended()
|
||||
while((m_position != m_end) && !is_separator(*m_position++)){}
|
||||
return true;
|
||||
}
|
||||
BOOST_FALLTHROUGH;
|
||||
BOOST_REGEX_FALLTHROUGH;
|
||||
default:
|
||||
result = parse_literal();
|
||||
break;
|
||||
@ -675,7 +675,7 @@ bool basic_regex_parser<charT, traits>::parse_basic_escape()
|
||||
{
|
||||
case 'w':
|
||||
negate = false;
|
||||
BOOST_FALLTHROUGH;
|
||||
BOOST_REGEX_FALLTHROUGH;
|
||||
case 'W':
|
||||
{
|
||||
basic_char_set<charT, traits> char_set;
|
||||
@ -692,7 +692,7 @@ bool basic_regex_parser<charT, traits>::parse_basic_escape()
|
||||
}
|
||||
case 's':
|
||||
negate = false;
|
||||
BOOST_FALLTHROUGH;
|
||||
BOOST_REGEX_FALLTHROUGH;
|
||||
case 'S':
|
||||
return add_emacs_code(negate);
|
||||
case 'c':
|
||||
@ -724,7 +724,7 @@ bool basic_regex_parser<charT, traits>::parse_extended_escape()
|
||||
{
|
||||
case regex_constants::escape_type_not_class:
|
||||
negate = true;
|
||||
BOOST_FALLTHROUGH;
|
||||
BOOST_REGEX_FALLTHROUGH;
|
||||
case regex_constants::escape_type_class:
|
||||
{
|
||||
escape_type_class_jump:
|
||||
@ -794,7 +794,7 @@ escape_type_class_jump:
|
||||
break;
|
||||
case regex_constants::escape_type_not_property:
|
||||
negate = true;
|
||||
BOOST_FALLTHROUGH;
|
||||
BOOST_REGEX_FALLTHROUGH;
|
||||
case regex_constants::escape_type_property:
|
||||
{
|
||||
++m_position;
|
||||
@ -953,7 +953,7 @@ escape_type_class_jump:
|
||||
case regex_constants::escape_type_control_v:
|
||||
if(0 == (this->flags() & (regbase::main_option_type | regbase::no_perl_ex)))
|
||||
goto escape_type_class_jump;
|
||||
BOOST_FALLTHROUGH;
|
||||
BOOST_REGEX_FALLTHROUGH;
|
||||
default:
|
||||
this->append_literal(unescape_character());
|
||||
break;
|
||||
@ -2080,7 +2080,7 @@ bool basic_regex_parser<charT, traits>::parse_perl_extension()
|
||||
{
|
||||
case regex_constants::syntax_or:
|
||||
m_mark_reset = m_mark_count;
|
||||
BOOST_FALLTHROUGH;
|
||||
BOOST_REGEX_FALLTHROUGH;
|
||||
case regex_constants::syntax_colon:
|
||||
//
|
||||
// a non-capturing mark:
|
||||
|
@ -90,9 +90,9 @@ public:
|
||||
parser_buf() : base_type() { setbuf(0, 0); }
|
||||
const charT* getnext() { return this->gptr(); }
|
||||
protected:
|
||||
std::basic_streambuf<charT, traits>* setbuf(char_type* s, streamsize n) BOOST_OVERRIDE;
|
||||
typename parser_buf<charT, traits>::pos_type seekpos(pos_type sp, ::std::ios_base::openmode which) BOOST_OVERRIDE;
|
||||
typename parser_buf<charT, traits>::pos_type seekoff(off_type off, ::std::ios_base::seekdir way, ::std::ios_base::openmode which) BOOST_OVERRIDE;
|
||||
std::basic_streambuf<charT, traits>* setbuf(char_type* s, streamsize n) override;
|
||||
typename parser_buf<charT, traits>::pos_type seekpos(pos_type sp, ::std::ios_base::openmode which) override;
|
||||
typename parser_buf<charT, traits>::pos_type seekoff(off_type off, ::std::ios_base::seekdir way, ::std::ios_base::openmode which) override;
|
||||
private:
|
||||
parser_buf& operator=(const parser_buf&);
|
||||
parser_buf(const parser_buf&);
|
||||
@ -214,11 +214,11 @@ std::locale cpp_regex_traits_base<charT>::imbue(const std::locale& l)
|
||||
{
|
||||
std::locale result(m_locale);
|
||||
m_locale = l;
|
||||
m_pctype = &BOOST_USE_FACET(std::ctype<charT>, l);
|
||||
m_pctype = &std::use_facet<std::ctype<charT>>(l);
|
||||
#ifndef BOOST_NO_STD_MESSAGES
|
||||
m_pmessages = BOOST_HAS_FACET(std::messages<charT>, l) ? &BOOST_USE_FACET(std::messages<charT>, l) : 0;
|
||||
m_pmessages = std::has_facet<std::messages<charT> >(l) ? &std::use_facet<std::messages<charT> >(l) : 0;
|
||||
#endif
|
||||
m_pcollate = &BOOST_USE_FACET(std::collate<charT>, l);
|
||||
m_pcollate = &std::use_facet<std::collate<charT> >(l);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -394,11 +394,11 @@ public:
|
||||
typedef typename cpp_regex_traits<charT>::char_class_type char_class_type;
|
||||
typedef typename std::ctype<charT>::mask native_mask_type;
|
||||
typedef typename std::make_unsigned<native_mask_type>::type unsigned_native_mask_type;
|
||||
BOOST_STATIC_CONSTANT(char_class_type, mask_blank = 1u << 24);
|
||||
BOOST_STATIC_CONSTANT(char_class_type, mask_word = 1u << 25);
|
||||
BOOST_STATIC_CONSTANT(char_class_type, mask_unicode = 1u << 26);
|
||||
BOOST_STATIC_CONSTANT(char_class_type, mask_horizontal = 1u << 27);
|
||||
BOOST_STATIC_CONSTANT(char_class_type, mask_vertical = 1u << 28);
|
||||
static const char_class_type mask_blank = 1u << 24;
|
||||
static const char_class_type mask_word = 1u << 25;
|
||||
static const char_class_type mask_unicode = 1u << 26;
|
||||
static const char_class_type mask_horizontal = 1u << 27;
|
||||
static const char_class_type mask_vertical = 1u << 28;
|
||||
|
||||
typedef std::basic_string<charT> string_type;
|
||||
typedef charT char_type;
|
||||
@ -928,7 +928,7 @@ std::intmax_t cpp_regex_traits<charT>::toi(const charT*& first, const charT* las
|
||||
std::basic_istream<charT> is(&sbuf); // stream for parsing numbers.
|
||||
|
||||
// we do NOT want to parse any thousands separators inside the stream:
|
||||
last = std::find(first, last, BOOST_USE_FACET(std::numpunct<charT>, is.getloc()).thousands_sep());
|
||||
last = std::find(first, last, std::use_facet<std::numpunct<charT>>(is.getloc()).thousands_sep());
|
||||
|
||||
sbuf.pubsetbuf(const_cast<charT*>(static_cast<const charT*>(first)), static_cast<std::streamsize>(last-first));
|
||||
is.clear();
|
||||
|
@ -26,6 +26,19 @@
|
||||
#include <boost/regex/v5/match_flags.hpp>
|
||||
#include <boost/regex/v5/error_type.hpp>
|
||||
|
||||
#ifndef BOOST_REGEX_STANDALONE
|
||||
#if !defined(BOOST_REGEX_NO_LIB) && !defined(BOOST_REGEX_SOURCE) && !defined(BOOST_ALL_NO_LIB) && defined(__cplusplus)
|
||||
# define BOOST_LIB_NAME boost_regex
|
||||
# if defined(BOOST_REGEX_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)
|
||||
# define BOOST_DYN_LINK
|
||||
# endif
|
||||
# ifdef BOOST_REGEX_DIAG
|
||||
# define BOOST_LIB_DIAGNOSTIC
|
||||
# endif
|
||||
# include <boost/config/auto_link.hpp>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <cstddef>
|
||||
#else
|
||||
|
@ -30,20 +30,16 @@ namespace detail{
|
||||
template <class I>
|
||||
struct is_random_imp
|
||||
{
|
||||
#ifndef BOOST_NO_STD_ITERATOR_TRAITS
|
||||
private:
|
||||
typedef typename std::iterator_traits<I>::iterator_category cat;
|
||||
public:
|
||||
BOOST_STATIC_CONSTANT(bool, value = (std::is_convertible<cat*, std::random_access_iterator_tag*>::value));
|
||||
#else
|
||||
BOOST_STATIC_CONSTANT(bool, value = false);
|
||||
#endif
|
||||
static const bool value = (std::is_convertible<cat*, std::random_access_iterator_tag*>::value);
|
||||
};
|
||||
|
||||
template <class I>
|
||||
struct is_random_pointer_imp
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = true);
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
template <bool is_pointer_type>
|
||||
@ -76,7 +72,7 @@ private:
|
||||
typedef typename selector::template rebind<I> bound_type;
|
||||
typedef typename bound_type::type answer;
|
||||
public:
|
||||
BOOST_STATIC_CONSTANT(bool, value = answer::value);
|
||||
static const bool value = answer::value;
|
||||
};
|
||||
|
||||
#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
|
||||
|
@ -35,7 +35,7 @@ namespace boost{
|
||||
// class regbase
|
||||
// handles error codes and flags
|
||||
//
|
||||
class BOOST_REGEX_DECL regbase
|
||||
class regbase
|
||||
{
|
||||
public:
|
||||
enum flag_type_
|
||||
|
@ -279,7 +279,7 @@ void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format
|
||||
break;
|
||||
}
|
||||
// not a special character:
|
||||
BOOST_FALLTHROUGH;
|
||||
BOOST_REGEX_FALLTHROUGH;
|
||||
default:
|
||||
put(*m_position);
|
||||
++m_position;
|
||||
@ -350,7 +350,7 @@ void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format
|
||||
case '{':
|
||||
have_brace = true;
|
||||
++m_position;
|
||||
BOOST_FALLTHROUGH;
|
||||
BOOST_REGEX_FALLTHROUGH;
|
||||
default:
|
||||
// see if we have a number:
|
||||
{
|
||||
@ -938,7 +938,7 @@ private:
|
||||
static O out;
|
||||
static boost::regex_constants::match_flag_type flags;
|
||||
public:
|
||||
BOOST_STATIC_CONSTANT(int, value = sizeof(check_is_formatter(f(m), f(m, out), f(m, out, flags))));
|
||||
static const int value = sizeof(check_is_formatter(f(m), f(m, out), f(m, out, flags)));
|
||||
};
|
||||
|
||||
template <class F, class M, class O>
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include <type_traits>
|
||||
#include <cstdint>
|
||||
#include <cctype>
|
||||
#include <cwctype>
|
||||
|
||||
#ifdef BOOST_NO_STDC_NAMESPACE
|
||||
namespace std{
|
||||
|
@ -277,11 +277,11 @@ class w32_regex_traits_implementation : public w32_regex_traits_char_layer<charT
|
||||
{
|
||||
public:
|
||||
typedef typename w32_regex_traits<charT>::char_class_type char_class_type;
|
||||
BOOST_STATIC_CONSTANT(char_class_type, mask_word = 0x0400); // must be C1_DEFINED << 1
|
||||
BOOST_STATIC_CONSTANT(char_class_type, mask_unicode = 0x0800); // must be C1_DEFINED << 2
|
||||
BOOST_STATIC_CONSTANT(char_class_type, mask_horizontal = 0x1000); // must be C1_DEFINED << 3
|
||||
BOOST_STATIC_CONSTANT(char_class_type, mask_vertical = 0x2000); // must be C1_DEFINED << 4
|
||||
BOOST_STATIC_CONSTANT(char_class_type, mask_base = 0x3ff); // all the masks used by the CT_CTYPE1 group
|
||||
static const char_class_type mask_word = 0x0400; // must be C1_DEFINED << 1
|
||||
static const char_class_type mask_unicode = 0x0800; // must be C1_DEFINED << 2
|
||||
static const char_class_type mask_horizontal = 0x1000; // must be C1_DEFINED << 3
|
||||
static const char_class_type mask_vertical = 0x2000; // must be C1_DEFINED << 4
|
||||
static const char_class_type mask_base = 0x3ff; // all the masks used by the CT_CTYPE1 group
|
||||
|
||||
typedef std::basic_string<charT> string_type;
|
||||
typedef charT char_type;
|
||||
|
@ -17,7 +17,10 @@
|
||||
*/
|
||||
|
||||
#define BOOST_REGEX_SOURCE
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/regex/config.hpp>
|
||||
|
||||
#if defined(BOOST_REGEX_CXX03)
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_THREADS
|
||||
@ -183,3 +186,4 @@ void scoped_static_mutex_lock::unlock()
|
||||
}
|
||||
|
||||
#endif // BOOST_HAS_THREADS
|
||||
#endif
|
@ -152,7 +152,10 @@ test-suite regex
|
||||
<define>BOOST_REGEX_STANDALONE [ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ] : standalone_concept_check
|
||||
]
|
||||
[ link concepts/icu_concept_check.cpp :
|
||||
[ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ]
|
||||
<define>BOOST_REGEX_STANDALONE [ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ]
|
||||
]
|
||||
[ link concepts/icu_concept_check.cpp :
|
||||
[ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ] : standalone_icu_concept_check
|
||||
]
|
||||
[ link concepts/range_concept_check.cpp :
|
||||
[ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ]
|
||||
|
@ -23,6 +23,7 @@
|
||||
#if defined(BOOST_HAS_ICU) && !defined(BOOST_NO_STD_WSTRING)
|
||||
|
||||
#include <boost/regex/icu.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include "test.hpp"
|
||||
|
||||
namespace unnecessary_fix{
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
|
||||
#ifdef BOOST_REGEX_CXX03
|
||||
//
|
||||
// we cannot use the regular Boost.Test in here: it is not thread safe
|
||||
// and calls to BOOST_CHECK will eventually crash on some compilers
|
||||
@ -205,3 +206,6 @@ int main()
|
||||
|
||||
return total_failures;
|
||||
}
|
||||
#else
|
||||
int main() {}
|
||||
#endif
|
||||
|
@ -16,7 +16,12 @@
|
||||
* DESCRIPTION: Simple test suite for Unicode interconversions.
|
||||
*/
|
||||
|
||||
#include <boost/regex/pending/unicode_iterator.hpp>
|
||||
#include <boost/regex/config.hpp>
|
||||
#ifdef BOOST_REGEX_CXX03
|
||||
#include <boost/regex/v4/unicode_iterator.hpp>
|
||||
#else
|
||||
#include <boost/regex/v5/unicode_iterator.hpp>
|
||||
#endif
|
||||
#include <boost/detail/lightweight_main.hpp>
|
||||
#include "../test_macros.hpp"
|
||||
#include <vector>
|
||||
@ -317,6 +322,6 @@ int cpp_main( int, char* [] )
|
||||
for(unsigned i = 0xDFFF + 1; i < 0x10FFFF; ++i)
|
||||
v.push_back(i);
|
||||
test(v);
|
||||
return 0;
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user