mirror of
https://github.com/boostorg/regex.git
synced 2025-07-14 04:46:36 +02:00
Compare commits
21 Commits
boost-1.76
...
boost-1.77
Author | SHA1 | Date | |
---|---|---|---|
86f82635d4 | |||
dfd700d858 | |||
d312a085b1 | |||
0c8158f6ce | |||
194ab4d646 | |||
1728f98485 | |||
5e42d51d49 | |||
151c144b75 | |||
f4c21ba011 | |||
e9cde852b3 | |||
d619d934f3 | |||
da20a5d1dc | |||
d604d1702e | |||
cd30a0560f | |||
d2a5ddd8a9 | |||
dc9c5c50be | |||
6064875bff | |||
a3f97b5bec | |||
13a13e58c9 | |||
7da62c1edb | |||
51d2661b76 |
@ -57,7 +57,7 @@ if ! $(disable-icu)
|
||||
|
||||
if $(ICU_ICUUC_NAME)
|
||||
{
|
||||
lib icuuc : : <name>$(ICU_ICUUC_NAME) ;
|
||||
lib icuuc : : <name>$(ICU_ICUUC_NAME) <conditional>@path_options ;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -71,7 +71,7 @@ if ! $(disable-icu)
|
||||
}
|
||||
if $(ICU_ICUDT_NAME)
|
||||
{
|
||||
lib icudt : : <name>$(ICU_ICUDT_NAME) ;
|
||||
lib icudt : : <name>$(ICU_ICUDT_NAME) <conditional>@path_options ;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -85,7 +85,7 @@ if ! $(disable-icu)
|
||||
}
|
||||
if $(ICU_ICUIN_NAME)
|
||||
{
|
||||
lib icuin : : <name>$(ICU_ICUIN_NAME) ;
|
||||
lib icuin : : <name>$(ICU_ICUIN_NAME) <conditional>@path_options ;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -110,10 +110,33 @@ if ! $(disable-icu)
|
||||
<runtime-link>static:<library>icuuc
|
||||
<runtime-link>static:<library>icudt
|
||||
<runtime-link>static:<library>icuin
|
||||
<target-os>windows,<toolset>clang:<linkflags>"advapi32.lib"
|
||||
<define>BOOST_HAS_ICU=1
|
||||
<runtime-link>static:<define>U_STATIC_IMPLEMENTATION=1
|
||||
;
|
||||
|
||||
if [ modules.peek : ICU_DATA_DIR ]
|
||||
{
|
||||
rule data-dir-options ( properties * )
|
||||
{
|
||||
local result ;
|
||||
local data_dir = [ modules.peek : ICU_DATA_DIR ] ;
|
||||
if <toolset>emscripten in $(properties)
|
||||
{
|
||||
result = <define>ICU_DATA_DIR=\\\"/$(data_dir:BS)\\\"
|
||||
"<linkflags>--embed-file $(data_dir)@/$(data_dir:BS)"
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = <define>ICU_DATA_DIR=\\\"$(data_dir)\\\" ;
|
||||
}
|
||||
return $(result) ;
|
||||
}
|
||||
|
||||
ICU_OPTS += <conditional>@data-dir-options ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exe has_icu : has_icu_test.cpp : $(ICU_OPTS) ;
|
||||
|
@ -28,6 +28,10 @@ void print_error(UErrorCode err, const char* func)
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifdef ICU_DATA_DIR
|
||||
::u_setDataDirectory(ICU_DATA_DIR);
|
||||
#endif
|
||||
|
||||
// To detect possible binary mismatches between the installed ICU build, and whatever
|
||||
// C++ std lib's we're using, we need to:
|
||||
// * Make sure we call ICU C++ API's
|
||||
|
@ -29,7 +29,7 @@
|
||||
#endif
|
||||
#include <bitset>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <ostream>
|
||||
|
||||
#ifdef BOOST_REGEX_CXX03
|
||||
#define RW_NS boost
|
||||
|
@ -1124,6 +1124,9 @@ bool basic_regex_parser<charT, traits>::parse_repeat(std::size_t low, std::size_
|
||||
}
|
||||
else
|
||||
contin = false;
|
||||
break;
|
||||
default:
|
||||
contin = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -62,7 +62,6 @@ Accepts UTF-32 code points and forwards them on as UTF-16 code points.
|
||||
#define BOOST_REGEX_V4_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>
|
||||
@ -145,10 +144,7 @@ inline void invalid_utf32_code_point(::boost::uint32_t val)
|
||||
|
||||
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;
|
||||
|
||||
@ -157,14 +153,19 @@ class u32_to_u16_iterator
|
||||
#endif
|
||||
|
||||
public:
|
||||
typename base_type::reference
|
||||
dereference()const
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef U16Type value_type;
|
||||
typedef value_type const* pointer;
|
||||
typedef value_type const reference;
|
||||
typedef std::bidirectional_iterator_tag iterator_category;
|
||||
|
||||
reference operator*()const
|
||||
{
|
||||
if(m_current == 2)
|
||||
extract_current();
|
||||
return m_values[m_current];
|
||||
}
|
||||
bool equal(const u32_to_u16_iterator& that)const
|
||||
bool operator==(const u32_to_u16_iterator& that)const
|
||||
{
|
||||
if(m_position == that.m_position)
|
||||
{
|
||||
@ -174,7 +175,11 @@ public:
|
||||
}
|
||||
return false;
|
||||
}
|
||||
void increment()
|
||||
bool operator!=(const u32_to_u16_iterator& that)const
|
||||
{
|
||||
return !(*this == that);
|
||||
}
|
||||
u32_to_u16_iterator& operator++()
|
||||
{
|
||||
// if we have a pending read then read now, so that we know whether
|
||||
// to skip a position, or move to a low-surrogate:
|
||||
@ -191,8 +196,15 @@ public:
|
||||
m_current = 2;
|
||||
++m_position;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
void decrement()
|
||||
u32_to_u16_iterator operator++(int)
|
||||
{
|
||||
u32_to_u16_iterator r(*this);
|
||||
++(*this);
|
||||
return r;
|
||||
}
|
||||
u32_to_u16_iterator& operator--()
|
||||
{
|
||||
if(m_current != 1)
|
||||
{
|
||||
@ -205,6 +217,13 @@ public:
|
||||
{
|
||||
m_current = 0;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
u32_to_u16_iterator operator--(int)
|
||||
{
|
||||
u32_to_u16_iterator r(*this);
|
||||
--(*this);
|
||||
return r;
|
||||
}
|
||||
BaseIterator base()const
|
||||
{
|
||||
@ -258,9 +277,7 @@ private:
|
||||
|
||||
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);
|
||||
|
||||
@ -272,31 +289,54 @@ class u16_to_u32_iterator
|
||||
#endif
|
||||
|
||||
public:
|
||||
typename base_type::reference
|
||||
dereference()const
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef U32Type value_type;
|
||||
typedef value_type const* pointer;
|
||||
typedef value_type const reference;
|
||||
typedef std::bidirectional_iterator_tag iterator_category;
|
||||
|
||||
reference operator*()const
|
||||
{
|
||||
if(m_value == pending_read)
|
||||
extract_current();
|
||||
return m_value;
|
||||
}
|
||||
bool equal(const u16_to_u32_iterator& that)const
|
||||
bool operator==(const u16_to_u32_iterator& that)const
|
||||
{
|
||||
return m_position == that.m_position;
|
||||
}
|
||||
void increment()
|
||||
bool operator!=(const u16_to_u32_iterator& that)const
|
||||
{
|
||||
return !(*this == that);
|
||||
}
|
||||
u16_to_u32_iterator& operator++()
|
||||
{
|
||||
// skip high surrogate first if there is one:
|
||||
if(detail::is_high_surrogate(*m_position)) ++m_position;
|
||||
++m_position;
|
||||
m_value = pending_read;
|
||||
return *this;
|
||||
}
|
||||
void decrement()
|
||||
u16_to_u32_iterator operator++(int)
|
||||
{
|
||||
u16_to_u32_iterator r(*this);
|
||||
++(*this);
|
||||
return r;
|
||||
}
|
||||
u16_to_u32_iterator& operator--()
|
||||
{
|
||||
--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;
|
||||
return *this;
|
||||
}
|
||||
u16_to_u32_iterator operator--(int)
|
||||
{
|
||||
u16_to_u32_iterator r(*this);
|
||||
--(*this);
|
||||
return r;
|
||||
}
|
||||
BaseIterator base()const
|
||||
{
|
||||
@ -375,10 +415,7 @@ private:
|
||||
|
||||
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;
|
||||
|
||||
@ -387,14 +424,19 @@ class u32_to_u8_iterator
|
||||
#endif
|
||||
|
||||
public:
|
||||
typename base_type::reference
|
||||
dereference()const
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef U8Type value_type;
|
||||
typedef value_type const* pointer;
|
||||
typedef value_type const reference;
|
||||
typedef std::bidirectional_iterator_tag iterator_category;
|
||||
|
||||
reference operator*()const
|
||||
{
|
||||
if(m_current == 4)
|
||||
extract_current();
|
||||
return m_values[m_current];
|
||||
}
|
||||
bool equal(const u32_to_u8_iterator& that)const
|
||||
bool operator==(const u32_to_u8_iterator& that)const
|
||||
{
|
||||
if(m_position == that.m_position)
|
||||
{
|
||||
@ -405,7 +447,11 @@ public:
|
||||
}
|
||||
return false;
|
||||
}
|
||||
void increment()
|
||||
bool operator!=(const u32_to_u8_iterator& that)const
|
||||
{
|
||||
return !(*this == that);
|
||||
}
|
||||
u32_to_u8_iterator& operator++()
|
||||
{
|
||||
// if we have a pending read then read now, so that we know whether
|
||||
// to skip a position, or move to a low-surrogate:
|
||||
@ -422,8 +468,15 @@ public:
|
||||
m_current = 4;
|
||||
++m_position;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
void decrement()
|
||||
u32_to_u8_iterator operator++(int)
|
||||
{
|
||||
u32_to_u8_iterator r(*this);
|
||||
++(*this);
|
||||
return r;
|
||||
}
|
||||
u32_to_u8_iterator& operator--()
|
||||
{
|
||||
if((m_current & 3) == 0)
|
||||
{
|
||||
@ -435,6 +488,13 @@ public:
|
||||
}
|
||||
else
|
||||
--m_current;
|
||||
return *this;
|
||||
}
|
||||
u32_to_u8_iterator operator--(int)
|
||||
{
|
||||
u32_to_u8_iterator r(*this);
|
||||
--(*this);
|
||||
return r;
|
||||
}
|
||||
BaseIterator base()const
|
||||
{
|
||||
@ -501,9 +561,7 @@ private:
|
||||
|
||||
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);
|
||||
|
||||
@ -515,18 +573,27 @@ class u8_to_u32_iterator
|
||||
#endif
|
||||
|
||||
public:
|
||||
typename base_type::reference
|
||||
dereference()const
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef U32Type value_type;
|
||||
typedef value_type const* pointer;
|
||||
typedef value_type const reference;
|
||||
typedef std::bidirectional_iterator_tag iterator_category;
|
||||
|
||||
reference operator*()const
|
||||
{
|
||||
if(m_value == pending_read)
|
||||
extract_current();
|
||||
return m_value;
|
||||
}
|
||||
bool equal(const u8_to_u32_iterator& that)const
|
||||
bool operator==(const u8_to_u32_iterator& that)const
|
||||
{
|
||||
return m_position == that.m_position;
|
||||
}
|
||||
void increment()
|
||||
bool operator!=(const u8_to_u32_iterator& that)const
|
||||
{
|
||||
return !(*this == that);
|
||||
}
|
||||
u8_to_u32_iterator& operator++()
|
||||
{
|
||||
// We must not start with a continuation character:
|
||||
if((static_cast<boost::uint8_t>(*m_position) & 0xC0) == 0x80)
|
||||
@ -549,8 +616,15 @@ public:
|
||||
std::advance(m_position, c);
|
||||
}
|
||||
m_value = pending_read;
|
||||
return *this;
|
||||
}
|
||||
void decrement()
|
||||
u8_to_u32_iterator operator++(int)
|
||||
{
|
||||
u8_to_u32_iterator r(*this);
|
||||
++(*this);
|
||||
return r;
|
||||
}
|
||||
u8_to_u32_iterator& operator--()
|
||||
{
|
||||
// Keep backtracking until we don't have a trailing character:
|
||||
unsigned count = 0;
|
||||
@ -559,6 +633,13 @@ public:
|
||||
if(count != detail::utf8_trailing_byte_count(*m_position))
|
||||
invalid_sequence();
|
||||
m_value = pending_read;
|
||||
return *this;
|
||||
}
|
||||
u8_to_u32_iterator operator--(int)
|
||||
{
|
||||
u8_to_u32_iterator r(*this);
|
||||
--(*this);
|
||||
return r;
|
||||
}
|
||||
BaseIterator base()const
|
||||
{
|
||||
|
@ -1098,6 +1098,9 @@ bool basic_regex_parser<charT, traits>::parse_repeat(std::size_t low, std::size_
|
||||
}
|
||||
else
|
||||
contin = false;
|
||||
break;
|
||||
default:
|
||||
contin = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -85,10 +85,10 @@ struct mem_block_node
|
||||
struct mem_block_cache
|
||||
{
|
||||
// this member has to be statically initialsed:
|
||||
mem_block_node* next;
|
||||
unsigned cached_blocks;
|
||||
mem_block_node* next { nullptr };
|
||||
unsigned cached_blocks { 0 };
|
||||
#ifdef BOOST_HAS_THREADS
|
||||
boost::static_mutex mut;
|
||||
std::mutex mut;
|
||||
#endif
|
||||
|
||||
~mem_block_cache()
|
||||
@ -133,11 +133,7 @@ struct mem_block_cache
|
||||
}
|
||||
static mem_block_cache& instance()
|
||||
{
|
||||
#ifdef BOOST_HAS_THREADS
|
||||
static mem_block_cache block_cache = { 0, 0, BOOST_STATIC_MUTEX_INIT, };
|
||||
#else
|
||||
static mem_block_cache block_cache = { 0, 0, };
|
||||
#endif
|
||||
static mem_block_cache block_cache;
|
||||
return block_cache;
|
||||
}
|
||||
};
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <cctype>
|
||||
#include <locale>
|
||||
#include <cwctype>
|
||||
#include <limits>
|
||||
|
||||
namespace boost{ namespace BOOST_REGEX_DETAIL_NS{
|
||||
|
||||
|
@ -67,8 +67,6 @@ Accepts UTF-32 code points and forwards them on as UTF-16 code points.
|
||||
#include <ios>
|
||||
#include <limits.h> // CHAR_BIT
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#ifndef BOOST_REGEX_STANDALONE
|
||||
#include <boost/throw_exception.hpp>
|
||||
#endif
|
||||
|
@ -29,8 +29,12 @@
|
||||
#include <boost/regex/v5/primary_transform.hpp>
|
||||
#include <boost/regex/v5/object_cache.hpp>
|
||||
|
||||
#define VC_EXTRALEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#ifndef VC_EXTRALEAN
|
||||
# define VC_EXTRALEAN
|
||||
#endif
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <windows.h>
|
||||
|
||||
#if defined(_MSC_VER) && !defined(_WIN32_WCE) && !defined(UNDER_CE)
|
||||
|
@ -58,6 +58,8 @@ void test_independent_subs()
|
||||
TEST_REGEX_SEARCH("word (?>[a-zA-Z0-9]+ ){0,30}otherword", perl, "word cat dog elephant mussel cow horse canary baboon snake shark the quick brown fox and the lazy dog and several other words getting close to thirty by now I really really hope otherword", match_default, make_array(-2, -2));
|
||||
TEST_REGEX_SEARCH("((?>Z)+|A)+", perl, "ZABCDEFG", match_default, make_array(0, 2, 1, 2, -2, -2));
|
||||
TEST_INVALID_REGEX("((?>)+|A)+", perl);
|
||||
// Bug https://github.com/boostorg/regex/issues/140:
|
||||
TEST_REGEX_SEARCH("1?+(?#)1", perl, "22113", match_default, make_array(2, 4, -2, -2));
|
||||
}
|
||||
|
||||
void test_conditionals()
|
||||
|
Reference in New Issue
Block a user