mirror of
https://github.com/boostorg/regex.git
synced 2025-07-24 01:27:36 +02:00
Merged accumulated patches from Trunk.
[SVN r62831]
This commit is contained in:
@ -76,6 +76,49 @@ namespace std{
|
||||
typedef boost::char_architype char_type;
|
||||
};
|
||||
}
|
||||
//
|
||||
// Allocator architype:
|
||||
//
|
||||
template <class T>
|
||||
class allocator_architype
|
||||
{
|
||||
public:
|
||||
typedef T* pointer;
|
||||
typedef const T* const_pointer;
|
||||
typedef T& reference;
|
||||
typedef const T& const_reference;
|
||||
typedef T value_type;
|
||||
typedef unsigned size_type;
|
||||
typedef int difference_type;
|
||||
|
||||
template <class U>
|
||||
struct rebind
|
||||
{
|
||||
typedef allocator_architype<U> other;
|
||||
};
|
||||
|
||||
pointer address(reference r);
|
||||
const_pointer address(const_reference r);
|
||||
pointer allocate(size_type);
|
||||
pointer allocate(size_type, pointer);
|
||||
void deallocate(pointer, size_type);
|
||||
size_type max_size()const;
|
||||
|
||||
allocator_architype();
|
||||
allocator_architype(const allocator_architype&);
|
||||
|
||||
template <class Other>
|
||||
allocator_architype(const allocator_architype<Other>&);
|
||||
|
||||
void construct(pointer, const_reference);
|
||||
void destroy(pointer);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
bool operator == (const allocator_architype<T>&, const allocator_architype<T>&);
|
||||
template <class T>
|
||||
bool operator != (const allocator_architype<T>&, const allocator_architype<T>&);
|
||||
|
||||
namespace boost{
|
||||
//
|
||||
// regex_traits_architype:
|
||||
@ -244,7 +287,8 @@ struct BaseRegexConcept
|
||||
typedef const value_type* pointer_type;
|
||||
typedef bidirectional_iterator_archetype<value_type> BidiIterator;
|
||||
typedef global_regex_namespace::sub_match<BidiIterator> sub_match_type;
|
||||
typedef global_regex_namespace::match_results<BidiIterator> match_results_type;
|
||||
typedef global_regex_namespace::match_results<BidiIterator, allocator_architype<sub_match_type> > match_results_type;
|
||||
typedef global_regex_namespace::match_results<BidiIterator> match_results_default_type;
|
||||
typedef output_iterator_archetype<value_type> OutIterator;
|
||||
typedef typename regex_traits_computer<Regex>::type traits_type;
|
||||
typedef global_regex_namespace::regex_iterator<BidiIterator, value_type, traits_type> regex_iterator_type;
|
||||
@ -318,7 +362,7 @@ struct BaseRegexConcept
|
||||
const global_regex_namespace::regex_error except(e1);
|
||||
e1 = except.code();
|
||||
|
||||
typedef typename Regex::value_type value_type;
|
||||
typedef typename Regex::value_type regex_value_type;
|
||||
function_requires< RegexTraitsConcept<global_regex_namespace::regex_traits<char> > >();
|
||||
function_requires< BaseRegexConcept<global_regex_namespace::basic_regex<char> > >();
|
||||
}
|
||||
@ -484,10 +528,10 @@ struct BaseRegexConcept
|
||||
typedef typename regex_iterator_type::reference rit_reference;
|
||||
typedef typename regex_iterator_type::iterator_category rit_iterator_category;
|
||||
BOOST_STATIC_ASSERT((::boost::is_same<rit_regex_type, Regex>::value));
|
||||
BOOST_STATIC_ASSERT((::boost::is_same<rit_value_type, match_results_type>::value));
|
||||
BOOST_STATIC_ASSERT((::boost::is_same<rit_value_type, match_results_default_type>::value));
|
||||
BOOST_STATIC_ASSERT((::boost::is_same<rit_difference_type, std::ptrdiff_t>::value));
|
||||
BOOST_STATIC_ASSERT((::boost::is_same<rit_pointer, const match_results_type*>::value));
|
||||
BOOST_STATIC_ASSERT((::boost::is_same<rit_reference, const match_results_type&>::value));
|
||||
BOOST_STATIC_ASSERT((::boost::is_same<rit_pointer, const match_results_default_type*>::value));
|
||||
BOOST_STATIC_ASSERT((::boost::is_same<rit_reference, const match_results_default_type&>::value));
|
||||
BOOST_STATIC_ASSERT((::boost::is_convertible<rit_iterator_category*, std::forward_iterator_tag*>::value));
|
||||
// this takes care of most of the checks needed:
|
||||
function_requires<ForwardIteratorConcept<regex_iterator_type> >();
|
||||
@ -540,7 +584,10 @@ struct BaseRegexConcept
|
||||
OutIterator m_out;
|
||||
BidiIterator m_in;
|
||||
global_regex_namespace::regex_constants::match_flag_type m_mft;
|
||||
global_regex_namespace::match_results<pointer_type> m_pmatch;
|
||||
global_regex_namespace::match_results<
|
||||
pointer_type,
|
||||
allocator_architype<global_regex_namespace::sub_match<pointer_type> > >
|
||||
m_pmatch;
|
||||
|
||||
BaseRegexConcept();
|
||||
BaseRegexConcept(const BaseRegexConcept&);
|
||||
@ -564,7 +611,7 @@ struct RegexConcept
|
||||
typedef std::basic_string<value_type> string_type;
|
||||
typedef boost::bidirectional_iterator_archetype<value_type> BidiIterator;
|
||||
typedef global_regex_namespace::sub_match<BidiIterator> sub_match_type;
|
||||
typedef global_regex_namespace::match_results<BidiIterator> match_results_type;
|
||||
typedef global_regex_namespace::match_results<BidiIterator, allocator_architype<sub_match_type> > match_results_type;
|
||||
typedef output_iterator_archetype<value_type> OutIterator;
|
||||
|
||||
|
||||
@ -739,7 +786,7 @@ struct RegexConcept
|
||||
OutIterator m_out;
|
||||
BidiIterator m_in;
|
||||
global_regex_namespace::regex_constants::match_flag_type m_mft;
|
||||
global_regex_namespace::match_results<typename string_type::const_iterator> m_smatch;
|
||||
global_regex_namespace::match_results<typename string_type::const_iterator, allocator_architype<global_regex_namespace::sub_match<typename string_type::const_iterator> > > m_smatch;
|
||||
|
||||
RegexConcept();
|
||||
RegexConcept(const RegexConcept&);
|
||||
@ -752,7 +799,7 @@ template <class M>
|
||||
struct functor1
|
||||
{
|
||||
typedef typename M::char_type char_type;
|
||||
const char_type* operator()(const M&)
|
||||
const char_type* operator()(const M&)const
|
||||
{
|
||||
static const char_type c = static_cast<char_type>(0);
|
||||
return &c;
|
||||
@ -762,7 +809,7 @@ template <class M>
|
||||
struct functor1b
|
||||
{
|
||||
typedef typename M::char_type char_type;
|
||||
std::vector<char_type> operator()(const M&)
|
||||
std::vector<char_type> operator()(const M&)const
|
||||
{
|
||||
static const std::vector<char_type> c;
|
||||
return c;
|
||||
@ -772,7 +819,7 @@ template <class M>
|
||||
struct functor2
|
||||
{
|
||||
template <class O>
|
||||
O operator()(const M& /*m*/, O i)
|
||||
O operator()(const M& /*m*/, O i)const
|
||||
{
|
||||
return i;
|
||||
}
|
||||
@ -781,7 +828,7 @@ template <class M>
|
||||
struct functor3
|
||||
{
|
||||
template <class O>
|
||||
O operator()(const M& /*m*/, O i, regex_constants::match_flag_type)
|
||||
O operator()(const M& /*m*/, O i, regex_constants::match_flag_type)const
|
||||
{
|
||||
return i;
|
||||
}
|
||||
@ -806,7 +853,8 @@ struct BoostRegexConcept
|
||||
typedef bidirectional_iterator_archetype<value_type> BidiIterator;
|
||||
typedef output_iterator_archetype<value_type> OutputIterator;
|
||||
typedef global_regex_namespace::sub_match<BidiIterator> sub_match_type;
|
||||
typedef global_regex_namespace::match_results<BidiIterator> match_results_type;
|
||||
typedef global_regex_namespace::match_results<BidiIterator, allocator_architype<sub_match_type> > match_results_type;
|
||||
typedef global_regex_namespace::match_results<BidiIterator> match_results_default_type;
|
||||
|
||||
void constraints()
|
||||
{
|
||||
@ -930,36 +978,90 @@ struct BoostRegexConcept
|
||||
//
|
||||
regex_constants::match_flag_type f = regex_constants::match_default;
|
||||
OutputIterator out = static_object<OutputIterator>::get();
|
||||
functor3<match_results_type> func3;
|
||||
out = regex_format(out, m_cresults, func3, f);
|
||||
out = regex_format(out, m_cresults, func3);
|
||||
functor2<match_results_type> func2;
|
||||
out = regex_format(out, m_cresults, func2, f);
|
||||
out = regex_format(out, m_cresults, func2);
|
||||
functor1<match_results_type> func1;
|
||||
out = regex_format(out, m_cresults, func1, f);
|
||||
out = regex_format(out, m_cresults, func1);
|
||||
|
||||
functor3<match_results_default_type> func3;
|
||||
functor2<match_results_default_type> func2;
|
||||
functor1<match_results_default_type> func1;
|
||||
|
||||
functor3<match_results_type> func3b;
|
||||
functor2<match_results_type> func2b;
|
||||
functor1<match_results_type> func1b;
|
||||
|
||||
m_string += regex_format(m_cresults, func3, f);
|
||||
m_string += regex_format(m_cresults, func3);
|
||||
m_string += regex_format(m_cresults, func2, f);
|
||||
m_string += regex_format(m_cresults, func2);
|
||||
m_string += regex_format(m_cresults, func1, f);
|
||||
m_string += regex_format(m_cresults, func1);
|
||||
out = regex_format(out, m_cresults, func3b, f);
|
||||
out = regex_format(out, m_cresults, func3b);
|
||||
out = regex_format(out, m_cresults, func2b, f);
|
||||
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 = m_cresults.format(out, func3, f);
|
||||
out = m_cresults.format(out, func3);
|
||||
out = m_cresults.format(out, func2, f);
|
||||
out = m_cresults.format(out, func2);
|
||||
out = m_cresults.format(out, func1, f);
|
||||
out = m_cresults.format(out, func1);
|
||||
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 += m_cresults.format(func3, f);
|
||||
m_string += m_cresults.format(func3);
|
||||
m_string += m_cresults.format(func2, f);
|
||||
m_string += m_cresults.format(func2);
|
||||
m_string += m_cresults.format(func1, f);
|
||||
m_string += m_cresults.format(func1);
|
||||
out = m_cresults.format(out, func3b, f);
|
||||
out = m_cresults.format(out, func3b);
|
||||
out = m_cresults.format(out, func2b, f);
|
||||
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));
|
||||
|
||||
m_string += m_cresults.format(func3b, f);
|
||||
m_string += m_cresults.format(func3b);
|
||||
m_string += m_cresults.format(func2b, f);
|
||||
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));
|
||||
|
||||
out = regex_replace(out, m_in, m_in, ce, func3, f);
|
||||
out = regex_replace(out, m_in, m_in, ce, func3);
|
||||
@ -967,6 +1069,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));
|
||||
|
||||
functor3<match_results<typename string_type::const_iterator> > func3s;
|
||||
functor2<match_results<typename string_type::const_iterator> > func2s;
|
||||
@ -977,6 +1091,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));
|
||||
}
|
||||
|
||||
std::basic_ostream<value_type> m_stream;
|
||||
|
@ -186,16 +186,19 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(BOOST_HAS_DECLSPEC) && (defined(BOOST_REGEX_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)) && !defined(BOOST_REGEX_STATIC_LINK)
|
||||
# if defined(BOOST_REGEX_SOURCE)
|
||||
# define BOOST_REGEX_DECL __declspec(dllexport)
|
||||
# define BOOST_REGEX_BUILD_DLL
|
||||
# else
|
||||
# define BOOST_REGEX_DECL __declspec(dllimport)
|
||||
# endif
|
||||
#ifndef BOOST_SYMBOL_EXPORT
|
||||
# define BOOST_SYMBOL_EXPORT
|
||||
# define BOOST_SYMBOL_IMPORT
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_REGEX_DECL
|
||||
#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
|
||||
# else
|
||||
# define BOOST_REGEX_DECL BOOST_SYMBOL_IMPORT
|
||||
# endif
|
||||
#else
|
||||
# define BOOST_REGEX_DECL
|
||||
#endif
|
||||
|
||||
|
@ -27,6 +27,10 @@
|
||||
#include <boost/mpl/int_fwd.hpp>
|
||||
#include <bitset>
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning (push)
|
||||
#pragma warning (disable: 4251)
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
|
||||
@ -1015,6 +1019,10 @@ inline U_NAMESPACE_QUALIFIER UnicodeString u32regex_replace(const U_NAMESPACE_QU
|
||||
|
||||
} // namespace boost.
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning (pop)
|
||||
#endif
|
||||
|
||||
#include <boost/regex/v4/u32regex_iterator.hpp>
|
||||
#include <boost/regex/v4/u32regex_token_iterator.hpp>
|
||||
|
||||
|
@ -769,14 +769,14 @@ void basic_regex_creator<charT, traits>::fixup_recursions(re_syntax_base* state)
|
||||
case syntax_element_assert_backref:
|
||||
{
|
||||
// just check that the index is valid:
|
||||
int id = static_cast<const re_brace*>(state)->index;
|
||||
if(id < 0)
|
||||
int idx = static_cast<const re_brace*>(state)->index;
|
||||
if(idx < 0)
|
||||
{
|
||||
id = -id-1;
|
||||
if(id >= 10000)
|
||||
idx = -idx-1;
|
||||
if(idx >= 10000)
|
||||
{
|
||||
id = m_pdata->get_id(id);
|
||||
if(id <= 0)
|
||||
idx = m_pdata->get_id(idx);
|
||||
if(idx <= 0)
|
||||
{
|
||||
// check of sub-expression that doesn't exist:
|
||||
if(0 == this->m_pdata->m_status) // update the error code if not already set
|
||||
@ -804,12 +804,12 @@ void basic_regex_creator<charT, traits>::fixup_recursions(re_syntax_base* state)
|
||||
{
|
||||
bool ok = false;
|
||||
re_syntax_base* p = base;
|
||||
int id = static_cast<re_jump*>(state)->alt.i;
|
||||
if(id > 10000)
|
||||
id = m_pdata->get_id(id);
|
||||
std::ptrdiff_t idx = static_cast<re_jump*>(state)->alt.i;
|
||||
if(idx > 10000)
|
||||
idx = m_pdata->get_id(idx);
|
||||
while(p)
|
||||
{
|
||||
if((p->type == syntax_element_startmark) && (static_cast<re_brace*>(p)->index == id))
|
||||
if((p->type == syntax_element_startmark) && (static_cast<re_brace*>(p)->index == idx))
|
||||
{
|
||||
//
|
||||
// We've found the target of the recursion, set the jump target:
|
||||
@ -833,7 +833,7 @@ void basic_regex_creator<charT, traits>::fixup_recursions(re_syntax_base* state)
|
||||
next_rep_id = static_cast<re_repeat*>(p)->state_id;
|
||||
break;
|
||||
case syntax_element_endmark:
|
||||
if(static_cast<const re_brace*>(p)->index == id)
|
||||
if(static_cast<const re_brace*>(p)->index == idx)
|
||||
next_rep_id = -1;
|
||||
break;
|
||||
default:
|
||||
@ -1039,6 +1039,14 @@ int basic_regex_creator<charT, traits>::calculate_backstep(re_syntax_base* state
|
||||
case syntax_element_jump:
|
||||
state = static_cast<re_jump*>(state)->alt.p;
|
||||
continue;
|
||||
case syntax_element_alt:
|
||||
{
|
||||
int r1 = calculate_backstep(state->next.p);
|
||||
int r2 = calculate_backstep(static_cast<re_alt*>(state)->alt.p);
|
||||
if((r1 < 0) || (r1 != r2))
|
||||
return -1;
|
||||
return result + r1;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -1543,3 +1551,4 @@ void basic_regex_creator<charT, traits>::probe_leading_repeat(re_syntax_base* st
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -1906,7 +1906,9 @@ bool basic_regex_parser<charT, traits>::parse_perl_extension()
|
||||
m_has_case_change = false;
|
||||
charT name_delim;
|
||||
int mark_reset = m_mark_reset;
|
||||
int max_mark = m_max_mark;
|
||||
m_mark_reset = -1;
|
||||
m_max_mark = m_mark_count;
|
||||
int v;
|
||||
//
|
||||
// select the actual extension used:
|
||||
@ -2536,6 +2538,7 @@ option_group_jump:
|
||||
m_mark_count = m_max_mark;
|
||||
}
|
||||
m_mark_reset = mark_reset;
|
||||
m_max_mark = max_mark;
|
||||
|
||||
|
||||
if(markid > 0)
|
||||
|
@ -56,7 +56,7 @@
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4786)
|
||||
#pragma warning(disable:4786 4251)
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
|
@ -118,10 +118,14 @@ template class BOOST_REGEX_TEMPLATE_DECL ::boost::re_detail::perl_matcher< std::
|
||||
|
||||
#undef BOOST_REGEX_TEMPLATE_DECL
|
||||
|
||||
#elif (defined(__GNUC__) && (__GNUC__ >= 3))
|
||||
#elif (defined(__GNUC__) && (__GNUC__ >= 3)) || !defined(BOOST_NO_EXTERN_TEMPLATE)
|
||||
|
||||
# ifndef BOOST_REGEX_INSTANTIATE
|
||||
# define template __extension__ extern template
|
||||
# ifdef __GNUC__
|
||||
# define template __extension__ extern template
|
||||
# else
|
||||
# define template extern template
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#if !defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_REGEX_ICU_INSTANCES)
|
||||
|
@ -393,7 +393,6 @@ public:
|
||||
std::swap(m_subs, that.m_subs);
|
||||
std::swap(m_named_subs, that.m_named_subs);
|
||||
std::swap(m_last_closed_paren, that.m_last_closed_paren);
|
||||
std::swap(m_is_singular, that.m_is_singular);
|
||||
if(m_is_singular)
|
||||
{
|
||||
if(!that.m_is_singular)
|
||||
@ -412,6 +411,7 @@ public:
|
||||
std::swap(m_base, that.m_base);
|
||||
std::swap(m_null, that.m_null);
|
||||
}
|
||||
std::swap(m_is_singular, that.m_is_singular);
|
||||
}
|
||||
bool operator==(const match_results& that)const
|
||||
{
|
||||
@ -457,7 +457,7 @@ public:
|
||||
void BOOST_REGEX_CALL set_second(BidiIterator i, size_type pos, bool m = true, bool escape_k = false)
|
||||
{
|
||||
if(pos)
|
||||
m_last_closed_paren = pos;
|
||||
m_last_closed_paren = static_cast<int>(pos);
|
||||
pos += 2;
|
||||
BOOST_ASSERT(m_subs.size() > pos);
|
||||
m_subs[pos].second = i;
|
||||
|
@ -336,7 +336,7 @@ struct recursion_info
|
||||
{
|
||||
typedef typename Results::value_type value_type;
|
||||
typedef typename value_type::iterator iterator;
|
||||
int id;
|
||||
int idx;
|
||||
const re_syntax_base* preturn_address;
|
||||
Results results;
|
||||
repeater_count<iterator>* repeater_stack;
|
||||
@ -366,7 +366,7 @@ public:
|
||||
BidiIterator l_base)
|
||||
: m_result(what), base(first), last(end),
|
||||
position(first), backstop(l_base), re(e), traits_inst(e.get_traits()),
|
||||
m_independent(false), next_count(&rep_obj), rep_obj(&next_count), recursion_stack_position(0)
|
||||
m_independent(false), next_count(&rep_obj), rep_obj(&next_count)
|
||||
{
|
||||
construct_init(e, f);
|
||||
}
|
||||
@ -468,9 +468,9 @@ private:
|
||||
// matching flags in use:
|
||||
match_flag_type m_match_flags;
|
||||
// how many states we have examined so far:
|
||||
boost::uintmax_t state_count;
|
||||
std::ptrdiff_t state_count;
|
||||
// max number of states to examine before giving up:
|
||||
boost::uintmax_t max_state_count;
|
||||
std::ptrdiff_t max_state_count;
|
||||
// whether we should ignore case or not:
|
||||
bool icase;
|
||||
// set to true when (position == last), indicates that we may have a partial match:
|
||||
@ -488,8 +488,7 @@ private:
|
||||
// the bitmask to use when determining whether a match_any matches a newline or not:
|
||||
unsigned char match_any_mask;
|
||||
// recursion information:
|
||||
recursion_info<results_type> recursion_stack[50];
|
||||
unsigned recursion_stack_position;
|
||||
std::vector<recursion_info<results_type> > recursion_stack;
|
||||
|
||||
#ifdef BOOST_REGEX_NON_RECURSIVE
|
||||
//
|
||||
@ -523,7 +522,7 @@ private:
|
||||
void push_repeater_count(int i, repeater_count<BidiIterator>** s);
|
||||
void push_single_repeat(std::size_t c, const re_repeat* r, BidiIterator last_position, int state_id);
|
||||
void push_non_greedy_repeat(const re_syntax_base* ps);
|
||||
void push_recursion(int id, const re_syntax_base* p, results_type* presults);
|
||||
void push_recursion(int idx, const re_syntax_base* p, results_type* presults);
|
||||
void push_recursion_pop();
|
||||
|
||||
// pointer to base of stack:
|
||||
|
@ -98,23 +98,23 @@ void perl_matcher<BidiIterator, Allocator, traits>::estimate_max_state_count(std
|
||||
//
|
||||
// Calculate NS^2 first:
|
||||
//
|
||||
static const boost::uintmax_t k = 100000;
|
||||
boost::uintmax_t dist = boost::re_detail::distance(base, last);
|
||||
static const std::ptrdiff_t k = 100000;
|
||||
std::ptrdiff_t dist = boost::re_detail::distance(base, last);
|
||||
if(dist == 0)
|
||||
dist = 1;
|
||||
boost::uintmax_t states = re.size();
|
||||
std::ptrdiff_t states = re.size();
|
||||
if(states == 0)
|
||||
states = 1;
|
||||
states *= states;
|
||||
if((std::numeric_limits<boost::uintmax_t>::max)() / dist < states)
|
||||
if((std::numeric_limits<std::ptrdiff_t>::max)() / dist < states)
|
||||
{
|
||||
max_state_count = (std::numeric_limits<boost::uintmax_t>::max)() - 2;
|
||||
max_state_count = (std::min)((std::ptrdiff_t)BOOST_REGEX_MAX_STATE_COUNT, (std::numeric_limits<std::ptrdiff_t>::max)() - 2);
|
||||
return;
|
||||
}
|
||||
states *= dist;
|
||||
if((std::numeric_limits<boost::uintmax_t>::max)() - k < states)
|
||||
if((std::numeric_limits<std::ptrdiff_t>::max)() - k < states)
|
||||
{
|
||||
max_state_count = (std::numeric_limits<boost::uintmax_t>::max)() - 2;
|
||||
max_state_count = (std::min)((std::ptrdiff_t)BOOST_REGEX_MAX_STATE_COUNT, (std::numeric_limits<std::ptrdiff_t>::max)() - 2);
|
||||
return;
|
||||
}
|
||||
states += k;
|
||||
@ -125,15 +125,15 @@ void perl_matcher<BidiIterator, Allocator, traits>::estimate_max_state_count(std
|
||||
// Now calculate N^2:
|
||||
//
|
||||
states = dist;
|
||||
if((std::numeric_limits<boost::uintmax_t>::max)() / dist < states)
|
||||
if((std::numeric_limits<std::ptrdiff_t>::max)() / dist < states)
|
||||
{
|
||||
max_state_count = (std::numeric_limits<boost::uintmax_t>::max)() - 2;
|
||||
max_state_count = (std::min)((std::ptrdiff_t)BOOST_REGEX_MAX_STATE_COUNT, (std::numeric_limits<std::ptrdiff_t>::max)() - 2);
|
||||
return;
|
||||
}
|
||||
states *= dist;
|
||||
if((std::numeric_limits<boost::uintmax_t>::max)() - k < states)
|
||||
if((std::numeric_limits<std::ptrdiff_t>::max)() - k < states)
|
||||
{
|
||||
max_state_count = (std::numeric_limits<boost::uintmax_t>::max)() - 2;
|
||||
max_state_count = (std::min)((std::ptrdiff_t)BOOST_REGEX_MAX_STATE_COUNT, (std::numeric_limits<std::ptrdiff_t>::max)() - 2);
|
||||
return;
|
||||
}
|
||||
states += k;
|
||||
@ -732,10 +732,10 @@ inline bool perl_matcher<BidiIterator, Allocator, traits>::match_assert_backref(
|
||||
{
|
||||
// Have we recursed into subexpression "index"?
|
||||
// If index == 0 then check for any recursion at all, otherwise for recursion to -index-1.
|
||||
int id = -index-1;
|
||||
if(id >= 10000)
|
||||
id = re.get_data().get_id(id);
|
||||
result = recursion_stack_position && ((recursion_stack[recursion_stack_position-1].id == id) || (index == 0));
|
||||
int idx = -index-1;
|
||||
if(idx >= 10000)
|
||||
idx = re.get_data().get_id(idx);
|
||||
result = !recursion_stack.empty() && ((recursion_stack.back().idx == idx) || (index == 0));
|
||||
pstate = pstate->next.p;
|
||||
}
|
||||
return result;
|
||||
|
@ -130,8 +130,8 @@ struct saved_single_repeat : public saved_state
|
||||
template <class Results>
|
||||
struct saved_recursion : public saved_state
|
||||
{
|
||||
saved_recursion(int id, const re_syntax_base* p, Results* pr)
|
||||
: saved_state(14), recursion_id(id), preturn_address(p), results(*pr)
|
||||
saved_recursion(int idx, const re_syntax_base* p, Results* pr)
|
||||
: saved_state(14), recursion_id(idx), preturn_address(p), results(*pr)
|
||||
{}
|
||||
int recursion_id;
|
||||
const re_syntax_base* preturn_address;
|
||||
@ -329,7 +329,7 @@ inline void perl_matcher<BidiIterator, Allocator, traits>::push_single_repeat(st
|
||||
}
|
||||
|
||||
template <class BidiIterator, class Allocator, class traits>
|
||||
inline void perl_matcher<BidiIterator, Allocator, traits>::push_recursion(int id, const re_syntax_base* p, results_type* presults)
|
||||
inline void perl_matcher<BidiIterator, Allocator, traits>::push_recursion(int idx, const re_syntax_base* p, results_type* presults)
|
||||
{
|
||||
saved_recursion<results_type>* pmp = static_cast<saved_recursion<results_type>*>(m_backup_state);
|
||||
--pmp;
|
||||
@ -339,7 +339,7 @@ inline void perl_matcher<BidiIterator, Allocator, traits>::push_recursion(int id
|
||||
pmp = static_cast<saved_recursion<results_type>*>(m_backup_state);
|
||||
--pmp;
|
||||
}
|
||||
(void) new (pmp)saved_recursion<results_type>(id, p, presults);
|
||||
(void) new (pmp)saved_recursion<results_type>(idx, p, presults);
|
||||
m_backup_state = pmp;
|
||||
}
|
||||
|
||||
@ -898,20 +898,19 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_recursion()
|
||||
//
|
||||
// Set new call stack:
|
||||
//
|
||||
if(recursion_stack_position >= static_cast<int>(sizeof(recursion_stack)/sizeof(recursion_stack[0])))
|
||||
if(recursion_stack.capacity() == 0)
|
||||
{
|
||||
return false;
|
||||
recursion_stack.reserve(50);
|
||||
}
|
||||
recursion_stack[recursion_stack_position].preturn_address = pstate->next.p;
|
||||
recursion_stack[recursion_stack_position].results = *m_presult;
|
||||
recursion_stack.push_back(recursion_info<results_type>());
|
||||
recursion_stack.back().preturn_address = pstate->next.p;
|
||||
recursion_stack.back().results = *m_presult;
|
||||
if(static_cast<const re_recurse*>(pstate)->state_id > 0)
|
||||
{
|
||||
push_repeater_count(static_cast<const re_recurse*>(pstate)->state_id, &next_count);
|
||||
}
|
||||
pstate = static_cast<const re_jump*>(pstate)->alt.p;
|
||||
recursion_stack[recursion_stack_position].id = static_cast<const re_brace*>(pstate)->index;
|
||||
++recursion_stack_position;
|
||||
//BOOST_ASSERT(recursion_stack[recursion_stack_position-1].id);
|
||||
recursion_stack.back().idx = static_cast<const re_brace*>(pstate)->index;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -927,14 +926,14 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_endmark()
|
||||
{
|
||||
m_presult->set_second(position, index);
|
||||
}
|
||||
if(recursion_stack_position)
|
||||
if(!recursion_stack.empty())
|
||||
{
|
||||
if(index == recursion_stack[recursion_stack_position-1].id)
|
||||
if(index == recursion_stack.back().idx)
|
||||
{
|
||||
--recursion_stack_position;
|
||||
pstate = recursion_stack[recursion_stack_position].preturn_address;
|
||||
*m_presult = recursion_stack[recursion_stack_position].results;
|
||||
push_recursion(recursion_stack[recursion_stack_position].id, recursion_stack[recursion_stack_position].preturn_address, &recursion_stack[recursion_stack_position].results);
|
||||
pstate = recursion_stack.back().preturn_address;
|
||||
*m_presult = recursion_stack.back().results;
|
||||
push_recursion(recursion_stack.back().idx, recursion_stack.back().preturn_address, &recursion_stack.back().results);
|
||||
recursion_stack.pop_back();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -951,13 +950,13 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_endmark()
|
||||
template <class BidiIterator, class Allocator, class traits>
|
||||
bool perl_matcher<BidiIterator, Allocator, traits>::match_match()
|
||||
{
|
||||
if(recursion_stack_position)
|
||||
if(!recursion_stack.empty())
|
||||
{
|
||||
BOOST_ASSERT(0 == recursion_stack[recursion_stack_position-1].id);
|
||||
--recursion_stack_position;
|
||||
pstate = recursion_stack[recursion_stack_position].preturn_address;
|
||||
*m_presult = recursion_stack[recursion_stack_position].results;
|
||||
push_recursion(recursion_stack[recursion_stack_position].id, recursion_stack[recursion_stack_position].preturn_address, &recursion_stack[recursion_stack_position].results);
|
||||
BOOST_ASSERT(0 == recursion_stack.back().idx);
|
||||
pstate = recursion_stack.back().preturn_address;
|
||||
*m_presult = recursion_stack.back().results;
|
||||
push_recursion(recursion_stack.back().idx, recursion_stack.back().preturn_address, &recursion_stack.back().results);
|
||||
recursion_stack.pop_back();
|
||||
return true;
|
||||
}
|
||||
if((m_match_flags & match_not_null) && (position == (*m_presult)[0].first))
|
||||
@ -1523,10 +1522,10 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_recursion(bool r)
|
||||
saved_recursion<results_type>* pmp = static_cast<saved_recursion<results_type>*>(m_backup_state);
|
||||
if(!r)
|
||||
{
|
||||
recursion_stack[recursion_stack_position].id = pmp->recursion_id;
|
||||
recursion_stack[recursion_stack_position].preturn_address = pmp->preturn_address;
|
||||
recursion_stack[recursion_stack_position].results = pmp->results;
|
||||
++recursion_stack_position;
|
||||
recursion_stack.push_back(recursion_info<results_type>());
|
||||
recursion_stack.back().idx = pmp->recursion_id;
|
||||
recursion_stack.back().preturn_address = pmp->preturn_address;
|
||||
recursion_stack.back().results = pmp->results;
|
||||
}
|
||||
boost::re_detail::inplace_destroy(pmp++);
|
||||
m_backup_state = pmp;
|
||||
@ -1539,7 +1538,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_recursion_pop(bool r)
|
||||
saved_state* pmp = static_cast<saved_state*>(m_backup_state);
|
||||
if(!r)
|
||||
{
|
||||
--recursion_stack_position;
|
||||
recursion_stack.pop_back();
|
||||
}
|
||||
boost::re_detail::inplace_destroy(pmp++);
|
||||
m_backup_state = pmp;
|
||||
|
@ -857,16 +857,16 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_recursion()
|
||||
//
|
||||
// Set new call stack:
|
||||
//
|
||||
if(recursion_stack_position >= static_cast<int>(sizeof(recursion_stack)/sizeof(recursion_stack[0])))
|
||||
if(recursion_stack.capacity() == 0)
|
||||
{
|
||||
return false;
|
||||
recursion_stack.reserve(50);
|
||||
}
|
||||
recursion_stack[recursion_stack_position].preturn_address = pstate->next.p;
|
||||
recursion_stack[recursion_stack_position].results = *m_presult;
|
||||
recursion_stack[recursion_stack_position].repeater_stack = next_count;
|
||||
recursion_stack.push_back(recursion_info<results_type>());
|
||||
recursion_stack.back().preturn_address = pstate->next.p;
|
||||
recursion_stack.back().results = *m_presult;
|
||||
recursion_stack.back().repeater_stack = next_count;
|
||||
pstate = static_cast<const re_jump*>(pstate)->alt.p;
|
||||
recursion_stack[recursion_stack_position].id = static_cast<const re_brace*>(pstate)->index;
|
||||
++recursion_stack_position;
|
||||
recursion_stack.back().idx = static_cast<const re_brace*>(pstate)->index;
|
||||
|
||||
repeater_count<BidiIterator>* saved = next_count;
|
||||
repeater_count<BidiIterator> r(&next_count); // resets all repeat counts since we're recursing and starting fresh on those
|
||||
@ -876,9 +876,9 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_recursion()
|
||||
|
||||
if(!result)
|
||||
{
|
||||
--recursion_stack_position;
|
||||
next_count = recursion_stack[recursion_stack_position].repeater_stack;
|
||||
*m_presult = recursion_stack[recursion_stack_position].results;
|
||||
next_count = recursion_stack.back().repeater_stack;
|
||||
*m_presult = recursion_stack.back().results;
|
||||
recursion_stack.pop_back();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -895,20 +895,19 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_endmark()
|
||||
{
|
||||
m_presult->set_second(position, index);
|
||||
}
|
||||
if(recursion_stack_position)
|
||||
if(!recursion_stack.empty())
|
||||
{
|
||||
if(index == recursion_stack[recursion_stack_position-1].id)
|
||||
if(index == recursion_stack.back().idx)
|
||||
{
|
||||
--recursion_stack_position;
|
||||
recursion_info<results_type> saved = recursion_stack[recursion_stack_position];
|
||||
recursion_info<results_type> saved = recursion_stack.back();
|
||||
recursion_stack.pop_back();
|
||||
const re_syntax_base* saved_state = pstate = saved.preturn_address;
|
||||
repeater_count<BidiIterator>* saved_count = next_count;
|
||||
next_count = saved.repeater_stack;
|
||||
*m_presult = saved.results;
|
||||
if(!match_all_states())
|
||||
{
|
||||
recursion_stack[recursion_stack_position] = saved;
|
||||
++recursion_stack_position;
|
||||
recursion_stack.push_back(saved);
|
||||
next_count = saved_count;
|
||||
return false;
|
||||
}
|
||||
@ -928,17 +927,17 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_endmark()
|
||||
template <class BidiIterator, class Allocator, class traits>
|
||||
bool perl_matcher<BidiIterator, Allocator, traits>::match_match()
|
||||
{
|
||||
if(recursion_stack_position)
|
||||
if(!recursion_stack.empty())
|
||||
{
|
||||
BOOST_ASSERT(0 == recursion_stack[recursion_stack_position-1].id);
|
||||
--recursion_stack_position;
|
||||
const re_syntax_base* saved_state = pstate = recursion_stack[recursion_stack_position].preturn_address;
|
||||
*m_presult = recursion_stack[recursion_stack_position].results;
|
||||
BOOST_ASSERT(0 == recursion_stack.back().idx);
|
||||
const re_syntax_base* saved_state = pstate = recursion_stack.back().preturn_address;
|
||||
*m_presult = recursion_stack.back().results;
|
||||
recursion_stack.pop_back();
|
||||
if(!match_all_states())
|
||||
{
|
||||
recursion_stack[recursion_stack_position].preturn_address = saved_state;
|
||||
recursion_stack[recursion_stack_position].results = *m_presult;
|
||||
++recursion_stack_position;
|
||||
recursion_stack.push_back(recursion_info<results_type>());
|
||||
recursion_stack.back().preturn_address = saved_state;
|
||||
recursion_stack.back().results = *m_presult;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -34,6 +34,7 @@
|
||||
#ifndef BOOST_NO_SFINAE
|
||||
#include <boost/mpl/has_xxx.hpp>
|
||||
#endif
|
||||
#include <boost/ref.hpp>
|
||||
|
||||
namespace boost{
|
||||
|
||||
@ -334,7 +335,7 @@ void basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::format
|
||||
m_position = --base;
|
||||
}
|
||||
}
|
||||
put((this->m_results)[this->m_results.size() > 1 ? this->m_results.size() - 1 : 1]);
|
||||
put((this->m_results)[this->m_results.size() > 1 ? static_cast<int>(this->m_results.size() - 1) : 1]);
|
||||
break;
|
||||
case '{':
|
||||
have_brace = true;
|
||||
@ -384,7 +385,7 @@ bool basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::handle
|
||||
if(have_brace && (*m_position == '^'))
|
||||
++m_position;
|
||||
|
||||
int max_len = m_end - m_position;
|
||||
std::ptrdiff_t max_len = m_end - m_position;
|
||||
|
||||
if((max_len >= 5) && std::equal(m_position, m_position + 5, MATCH))
|
||||
{
|
||||
@ -447,7 +448,7 @@ bool basic_regex_formatter<OutputIterator, Results, traits, ForwardIter>::handle
|
||||
return false;
|
||||
}
|
||||
}
|
||||
put((this->m_results)[this->m_results.size() > 1 ? this->m_results.size() - 1 : 1]);
|
||||
put((this->m_results)[this->m_results.size() > 1 ? static_cast<int>(this->m_results.size() - 1) : 1]);
|
||||
return true;
|
||||
}
|
||||
if((max_len >= 20) && std::equal(m_position, m_position + 20, LAST_SUBMATCH_RESULT))
|
||||
@ -895,7 +896,7 @@ private:
|
||||
// F must be a pointer, a function, or a class with a function call operator:
|
||||
//
|
||||
BOOST_STATIC_ASSERT((::boost::is_pointer<F>::value || ::boost::is_function<F>::value || ::boost::is_class<F>::value));
|
||||
static formatter_wrapper<F> f;
|
||||
static formatter_wrapper<typename unwrap_reference<F>::type> f;
|
||||
static M m;
|
||||
static O out;
|
||||
static boost::regex_constants::match_flag_type flags;
|
||||
@ -963,7 +964,7 @@ struct format_functor3
|
||||
template <class OutputIter>
|
||||
OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type f)
|
||||
{
|
||||
return func(m, i, f);
|
||||
return boost::unwrap_ref(func)(m, i, f);
|
||||
}
|
||||
template <class OutputIter, class Traits>
|
||||
OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type f, const Traits&)
|
||||
@ -983,7 +984,7 @@ struct format_functor2
|
||||
template <class OutputIter>
|
||||
OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type /*f*/)
|
||||
{
|
||||
return func(m, i);
|
||||
return boost::unwrap_ref(func)(m, i);
|
||||
}
|
||||
template <class OutputIter, class Traits>
|
||||
OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type f, const Traits&)
|
||||
@ -1020,7 +1021,7 @@ struct format_functor1
|
||||
template <class OutputIter>
|
||||
OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type /*f*/)
|
||||
{
|
||||
return do_format_string(func(m), i);
|
||||
return do_format_string(boost::unwrap_ref(func)(m), i);
|
||||
}
|
||||
template <class OutputIter, class Traits>
|
||||
OutputIter operator()(const Match& m, OutputIter i, boost::regex_constants::match_flag_type f, const Traits&)
|
||||
|
@ -149,7 +149,37 @@ namespace boost{ namespace re_detail{
|
||||
{
|
||||
return stdext::unchecked_equal(first, last, with);
|
||||
}
|
||||
|
||||
#elif BOOST_WORKAROUND(BOOST_MSVC, > 1500)
|
||||
//
|
||||
// MSVC 10 will either emit warnings or else refuse to compile
|
||||
// code that makes perfectly legitimate use of std::copy, when
|
||||
// the OutputIterator type is a user-defined class (apparently all user
|
||||
// defined iterators are "unsafe"). What's more Microsoft have removed their
|
||||
// non-standard "unchecked" versions, even though their still in the MS
|
||||
// documentation!! Work around this as best we can:
|
||||
//
|
||||
template<class InputIterator, class OutputIterator>
|
||||
inline OutputIterator copy(
|
||||
InputIterator first,
|
||||
InputIterator last,
|
||||
OutputIterator dest
|
||||
)
|
||||
{
|
||||
while(first != last)
|
||||
*dest++ = *first++;
|
||||
return dest;
|
||||
}
|
||||
template<class InputIterator1, class InputIterator2>
|
||||
inline bool equal(
|
||||
InputIterator1 first,
|
||||
InputIterator1 last,
|
||||
InputIterator2 with
|
||||
)
|
||||
{
|
||||
while(first != last)
|
||||
if(*first++ != *with++) return false;
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
using std::copy;
|
||||
using std::equal;
|
||||
|
@ -292,7 +292,7 @@ template <class charT, class Traits, class Alloc>
|
||||
inline u32regex_token_iterator<typename std::basic_string<charT, Traits, Alloc>::const_iterator> make_u32regex_token_iterator(const std::basic_string<charT, Traits, Alloc>& p, const u32regex& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default)
|
||||
{
|
||||
typedef typename std::basic_string<charT, Traits, Alloc>::const_iterator iter_type;
|
||||
return u32regex_token_iterator<iter_type>(p.begin(), p.end(), e, m);
|
||||
return u32regex_token_iterator<iter_type>(p.begin(), p.end(), e, submatch, m);
|
||||
}
|
||||
inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const U_NAMESPACE_QUALIFIER UnicodeString& s, const u32regex& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default)
|
||||
{
|
||||
|
Reference in New Issue
Block a user