forked from boostorg/regex
Patches for Codegear C++ Builder 2009
[SVN r48981]
This commit is contained in:
commit
35212a4063
203 files changed
+3904
-1789
No files matched your search
@@ -87,12 +87,12 @@ struct regex_traits_architype
|
||||
public:
|
||||
regex_traits_architype();
|
||||
typedef charT char_type;
|
||||
typedef std::size_t size_type;
|
||||
// typedef std::size_t size_type;
|
||||
typedef std::vector<char_type> string_type;
|
||||
typedef copy_constructible_archetype<assignable_archetype<> > locale_type;
|
||||
typedef bitmask_archetype char_class_type;
|
||||
|
||||
static size_type length(const char_type* ) { return 0; }
|
||||
static std::size_t length(const char_type* ) { return 0; }
|
||||
|
||||
charT translate(charT ) const { return charT(); }
|
||||
charT translate_nocase(charT ) const { return static_object<charT>::get(); }
|
||||
@@ -163,21 +163,21 @@ struct RegexTraitsConcept
|
||||
RegexTraitsConcept();
|
||||
// required typedefs:
|
||||
typedef typename traits::char_type char_type;
|
||||
typedef typename traits::size_type size_type;
|
||||
// typedef typename traits::size_type size_type;
|
||||
typedef typename traits::string_type string_type;
|
||||
typedef typename traits::locale_type locale_type;
|
||||
typedef typename traits::char_class_type char_class_type;
|
||||
|
||||
void constraints()
|
||||
{
|
||||
function_requires<UnsignedIntegerConcept<size_type> >();
|
||||
//function_requires<UnsignedIntegerConcept<size_type> >();
|
||||
function_requires<RandomAccessContainerConcept<string_type> >();
|
||||
function_requires<DefaultConstructibleConcept<locale_type> >();
|
||||
function_requires<CopyConstructibleConcept<locale_type> >();
|
||||
function_requires<AssignableConcept<locale_type> >();
|
||||
function_requires<BitmaskConcept<char_class_type> >();
|
||||
|
||||
size_type n = traits::length(m_pointer);
|
||||
std::size_t n = traits::length(m_pointer);
|
||||
ignore_unused_variable_warning(n);
|
||||
|
||||
char_type c = m_ctraits.translate(m_char);
|
||||
@@ -235,7 +235,7 @@ template <class Regex>
|
||||
struct BaseRegexConcept
|
||||
{
|
||||
typedef typename Regex::value_type value_type;
|
||||
typedef typename Regex::size_type size_type;
|
||||
//typedef typename Regex::size_type size_type;
|
||||
typedef typename Regex::flag_type flag_type;
|
||||
typedef typename Regex::locale_type locale_type;
|
||||
typedef input_iterator_archetype<value_type> input_iterator_type;
|
||||
@@ -368,9 +368,7 @@ struct BaseRegexConcept
|
||||
|
||||
// access:
|
||||
const Regex ce;
|
||||
bool b = ce.empty();
|
||||
ignore_unused_variable_warning(b);
|
||||
size_type i = ce.mark_count();
|
||||
unsigned i = ce.mark_count();
|
||||
ignore_unused_variable_warning(i);
|
||||
m_flags = ce.flags();
|
||||
e.imbue(ce.getloc());
|
||||
@@ -385,7 +383,7 @@ struct BaseRegexConcept
|
||||
typedef typename sub_match_type::iterator sub_iter_type;
|
||||
BOOST_STATIC_ASSERT((::boost::is_same<sub_value_type, value_type>::value));
|
||||
BOOST_STATIC_ASSERT((::boost::is_same<sub_iter_type, BidiIterator>::value));
|
||||
b = m_sub.matched;
|
||||
bool b = m_sub.matched;
|
||||
ignore_unused_variable_warning(b);
|
||||
BidiIterator bi = m_sub.first;
|
||||
ignore_unused_variable_warning(bi);
|
||||
@@ -533,7 +531,7 @@ struct BaseRegexConcept
|
||||
|
||||
pointer_type m_pointer;
|
||||
flag_type m_flags;
|
||||
size_type m_size;
|
||||
std::size_t m_size;
|
||||
input_iterator_type in1, in2;
|
||||
const sub_match_type m_sub;
|
||||
const value_type m_char;
|
||||
@@ -557,7 +555,7 @@ template <class Regex>
|
||||
struct RegexConcept
|
||||
{
|
||||
typedef typename Regex::value_type value_type;
|
||||
typedef typename Regex::size_type size_type;
|
||||
//typedef typename Regex::size_type size_type;
|
||||
typedef typename Regex::flag_type flag_type;
|
||||
typedef typename Regex::locale_type locale_type;
|
||||
|
||||
@@ -806,6 +804,8 @@ struct BoostRegexConcept
|
||||
ignore_unused_variable_warning(i2);
|
||||
bool b = ce == ce2;
|
||||
ignore_unused_variable_warning(b);
|
||||
b = ce.empty();
|
||||
ignore_unused_variable_warning(b);
|
||||
b = ce != ce2;
|
||||
ignore_unused_variable_warning(b);
|
||||
b = ce < ce2;
|
||||
|
||||
@@ -355,7 +355,7 @@ inline u32regex make_u32regex(const wchar_t* p, boost::regex_constants::syntax_o
|
||||
return re_detail::do_make_u32regex(p, p + std::wcslen(p), opt, static_cast<boost::mpl::int_<sizeof(wchar_t)> const*>(0));
|
||||
}
|
||||
#endif
|
||||
#ifndef U_WCHAR_IS_UTF16
|
||||
#if !defined(U_WCHAR_IS_UTF16) && (U_SIZEOF_WCHAR_T != 2)
|
||||
inline u32regex make_u32regex(const UChar* p, boost::regex_constants::syntax_option_type opt = boost::regex_constants::perl)
|
||||
{
|
||||
return re_detail::do_make_u32regex(p, p + u_strlen(p), opt, static_cast<boost::mpl::int_<2> const*>(0));
|
||||
@@ -455,7 +455,7 @@ inline bool u32regex_match(const UChar* p,
|
||||
{
|
||||
return re_detail::do_regex_match(p, p+u_strlen(p), m, e, flags, static_cast<mpl::int_<2> const*>(0));
|
||||
}
|
||||
#if !defined(U_WCHAR_IS_UTF16) && !defined(BOOST_NO_WREGEX)
|
||||
#if !defined(U_WCHAR_IS_UTF16) && (U_SIZEOF_WCHAR_T != 2) && !defined(BOOST_NO_WREGEX)
|
||||
inline bool u32regex_match(const wchar_t* p,
|
||||
match_results<const wchar_t*>& m,
|
||||
const u32regex& e,
|
||||
@@ -519,7 +519,7 @@ inline bool u32regex_match(const UChar* p,
|
||||
match_results<const UChar*> m;
|
||||
return re_detail::do_regex_match(p, p+u_strlen(p), m, e, flags, static_cast<mpl::int_<2> const*>(0));
|
||||
}
|
||||
#if !defined(U_WCHAR_IS_UTF16) && !defined(BOOST_NO_WREGEX)
|
||||
#if !defined(U_WCHAR_IS_UTF16) && (U_SIZEOF_WCHAR_T != 2) && !defined(BOOST_NO_WREGEX)
|
||||
inline bool u32regex_match(const wchar_t* p,
|
||||
const u32regex& e,
|
||||
match_flag_type flags = match_default)
|
||||
@@ -640,7 +640,7 @@ inline bool u32regex_search(const UChar* p,
|
||||
{
|
||||
return re_detail::do_regex_search(p, p+u_strlen(p), m, e, flags, p, static_cast<mpl::int_<2> const*>(0));
|
||||
}
|
||||
#if !defined(U_WCHAR_IS_UTF16) && !defined(BOOST_NO_WREGEX)
|
||||
#if !defined(U_WCHAR_IS_UTF16) && (U_SIZEOF_WCHAR_T != 2) && !defined(BOOST_NO_WREGEX)
|
||||
inline bool u32regex_search(const wchar_t* p,
|
||||
match_results<const wchar_t*>& m,
|
||||
const u32regex& e,
|
||||
@@ -701,7 +701,7 @@ inline bool u32regex_search(const UChar* p,
|
||||
match_results<const UChar*> m;
|
||||
return re_detail::do_regex_search(p, p+u_strlen(p), m, e, flags, p, static_cast<mpl::int_<2> const*>(0));
|
||||
}
|
||||
#if !defined(U_WCHAR_IS_UTF16) && !defined(BOOST_NO_WREGEX)
|
||||
#if !defined(U_WCHAR_IS_UTF16) && (U_SIZEOF_WCHAR_T != 2) && !defined(BOOST_NO_WREGEX)
|
||||
inline bool u32regex_search(const wchar_t* p,
|
||||
const u32regex& e,
|
||||
match_flag_type flags = match_default)
|
||||
|
||||
@@ -119,7 +119,7 @@ boost::shared_ptr<Object const> object_cache<Key, Object>::do_get(const Key& k,
|
||||
//
|
||||
// Add it to the list, and index it:
|
||||
//
|
||||
s_data.cont.push_back(value_type(result, 0));
|
||||
s_data.cont.push_back(value_type(result, static_cast<Key const*>(0)));
|
||||
s_data.index.insert(std::make_pair(k, --(s_data.cont.end())));
|
||||
s_data.cont.back().second = &(s_data.index.find(k)->first);
|
||||
map_size_type s = s_data.index.size();
|
||||
|
||||
@@ -127,8 +127,15 @@ inline bool scoped_static_mutex_lock::locked()const
|
||||
// down to the initialisation proceedure. In fact the initialisation routine
|
||||
// may need to be called more than once - but only once per instance.
|
||||
//
|
||||
#include <boost/thread/once.hpp>
|
||||
#include <boost/thread/recursive_mutex.hpp>
|
||||
// Since this preprocessor path is almost never taken, we hide these header
|
||||
// dependencies so that build tools don't find them.
|
||||
//
|
||||
#define B1 <boost/thread/once.hpp>
|
||||
#define B2 <boost/thread/recursive_mutex.hpp>
|
||||
#include B1
|
||||
#include B2
|
||||
#undef B1
|
||||
#undef B2
|
||||
|
||||
namespace boost{
|
||||
|
||||
|
||||
@@ -68,6 +68,7 @@ Accepts UTF-32 code points and forwards them on as UTF-16 code points.
|
||||
#include <stdexcept>
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
#include <sstream>
|
||||
#include <ios>
|
||||
#endif
|
||||
#include <limits.h> // CHAR_BIT
|
||||
|
||||
|
||||
@@ -191,7 +191,7 @@ class basic_regex : public regbase
|
||||
{
|
||||
public:
|
||||
// typedefs:
|
||||
typedef typename traits::size_type traits_size_type;
|
||||
typedef std::size_t traits_size_type;
|
||||
typedef typename traits::string_type traits_string_type;
|
||||
typedef charT char_type;
|
||||
typedef traits traits_type;
|
||||
@@ -261,7 +261,7 @@ public:
|
||||
{
|
||||
return do_assign(p1, p2, f);
|
||||
}
|
||||
#if !defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(__IBMCPP__)
|
||||
#if !defined(BOOST_NO_MEMBER_TEMPLATES)
|
||||
|
||||
template <class ST, class SA>
|
||||
unsigned int BOOST_REGEX_CALL set_expression(const std::basic_string<charT, ST, SA>& p, flag_type f = regex_constants::normal)
|
||||
@@ -597,7 +597,7 @@ public:
|
||||
return this->assign(that);
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(__IBMCPP__)
|
||||
#if !defined(BOOST_NO_MEMBER_TEMPLATES)
|
||||
template <class ST, class SA>
|
||||
explicit reg_expression(const std::basic_string<charT, ST, SA>& p, flag_type f = regex_constants::normal)
|
||||
: basic_regex<charT, traits>(p, f)
|
||||
|
||||
@@ -236,7 +236,7 @@ protected:
|
||||
m_traits; // convenience reference to traits class
|
||||
re_syntax_base* m_last_state; // the last state we added
|
||||
bool m_icase; // true for case insensitive matches
|
||||
unsigned m_repeater_id; // the id of the next repeater
|
||||
unsigned m_repeater_id; // the state_id of the next repeater
|
||||
bool m_has_backrefs; // true if there are actually any backrefs
|
||||
unsigned m_backrefs; // bitmask of permitted backrefs
|
||||
boost::uintmax_t m_bad_repeats; // bitmask of repeats we can't deduce a startmap for;
|
||||
@@ -718,8 +718,8 @@ void basic_regex_creator<charT, traits>::fixup_pointers(re_syntax_base* state)
|
||||
case syntax_element_char_rep:
|
||||
case syntax_element_short_set_rep:
|
||||
case syntax_element_long_set_rep:
|
||||
// set the id of this repeat:
|
||||
static_cast<re_repeat*>(state)->id = m_repeater_id++;
|
||||
// set the state_id of this repeat:
|
||||
static_cast<re_repeat*>(state)->state_id = m_repeater_id++;
|
||||
// fall through:
|
||||
case syntax_element_alt:
|
||||
std::memset(static_cast<re_alt*>(state)->_map, 0, sizeof(static_cast<re_alt*>(state)->_map));
|
||||
@@ -1194,11 +1194,11 @@ bool basic_regex_creator<charT, traits>::is_bad_repeat(re_syntax_base* pt)
|
||||
case syntax_element_short_set_rep:
|
||||
case syntax_element_long_set_rep:
|
||||
{
|
||||
unsigned id = static_cast<re_repeat*>(pt)->id;
|
||||
if(id > sizeof(m_bad_repeats) * CHAR_BIT)
|
||||
unsigned state_id = static_cast<re_repeat*>(pt)->state_id;
|
||||
if(state_id > sizeof(m_bad_repeats) * CHAR_BIT)
|
||||
return true; // run out of bits, assume we can't traverse this one.
|
||||
static const boost::uintmax_t one = 1uL;
|
||||
return m_bad_repeats & (one << id);
|
||||
return m_bad_repeats & (one << state_id);
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
@@ -1216,10 +1216,10 @@ void basic_regex_creator<charT, traits>::set_bad_repeat(re_syntax_base* pt)
|
||||
case syntax_element_short_set_rep:
|
||||
case syntax_element_long_set_rep:
|
||||
{
|
||||
unsigned id = static_cast<re_repeat*>(pt)->id;
|
||||
unsigned state_id = static_cast<re_repeat*>(pt)->state_id;
|
||||
static const boost::uintmax_t one = 1uL;
|
||||
if(id <= sizeof(m_bad_repeats) * CHAR_BIT)
|
||||
m_bad_repeats |= (one << id);
|
||||
if(state_id <= sizeof(m_bad_repeats) * CHAR_BIT)
|
||||
m_bad_repeats |= (one << state_id);
|
||||
}
|
||||
default:
|
||||
break;
|
||||
@@ -1270,6 +1270,19 @@ void basic_regex_creator<charT, traits>::probe_leading_repeat(re_syntax_base* st
|
||||
state = state->next.p;
|
||||
continue;
|
||||
}
|
||||
if((static_cast<re_brace*>(state)->index == -1)
|
||||
|| (static_cast<re_brace*>(state)->index == -2))
|
||||
{
|
||||
// skip past the zero width assertion:
|
||||
state = static_cast<const re_jump*>(state->next.p)->alt.p->next.p;
|
||||
continue;
|
||||
}
|
||||
if(static_cast<re_brace*>(state)->index == -3)
|
||||
{
|
||||
// Have to skip the leading jump state:
|
||||
state = state->next.p->next.p;
|
||||
continue;
|
||||
}
|
||||
return;
|
||||
case syntax_element_endmark:
|
||||
case syntax_element_start_line:
|
||||
|
||||
@@ -784,6 +784,7 @@ bool basic_regex_parser<charT, traits>::parse_repeat(std::size_t low, std::size_
|
||||
case syntax_element_restart_continue:
|
||||
case syntax_element_jump:
|
||||
case syntax_element_startmark:
|
||||
case syntax_element_backstep:
|
||||
// can't legally repeat any of the above:
|
||||
fail(regex_constants::error_badrepeat, m_position - m_base);
|
||||
return false;
|
||||
@@ -1869,6 +1870,7 @@ bool basic_regex_parser<charT, traits>::parse_perl_extension()
|
||||
if(markid == -4)
|
||||
{
|
||||
re_syntax_base* b = this->getaddress(expected_alt_point);
|
||||
// Make sure we have exactly one alternative following this state:
|
||||
if(b->type != syntax_element_alt)
|
||||
{
|
||||
re_alt* alt = static_cast<re_alt*>(this->insert_state(expected_alt_point, syntax_element_alt, sizeof(re_alt)));
|
||||
@@ -1879,6 +1881,15 @@ bool basic_regex_parser<charT, traits>::parse_perl_extension()
|
||||
fail(regex_constants::error_bad_pattern, m_position - m_base);
|
||||
return false;
|
||||
}
|
||||
// check for invalid repetition of next state:
|
||||
b = this->getaddress(expected_alt_point);
|
||||
b = this->getaddress(static_cast<re_alt*>(b)->next.i, b);
|
||||
if((b->type != syntax_element_assert_backref)
|
||||
&& (b->type != syntax_element_startmark))
|
||||
{
|
||||
fail(regex_constants::error_badrepeat, m_position - m_base);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//
|
||||
// append closing parenthesis state:
|
||||
|
||||
@@ -128,7 +128,7 @@ parser_buf<charT, traits>::seekoff(off_type off, ::std::ios_base::seekdir way, :
|
||||
break;
|
||||
case ::std::ios_base::cur:
|
||||
{
|
||||
std::ptrdiff_t newpos = pos + off;
|
||||
std::ptrdiff_t newpos = static_cast<std::ptrdiff_t>(pos + off);
|
||||
if((newpos < 0) || (newpos > size))
|
||||
return pos_type(off_type(-1));
|
||||
else
|
||||
@@ -293,7 +293,9 @@ void cpp_regex_traits_char_layer<charT>::init()
|
||||
//
|
||||
if((int)cat >= 0)
|
||||
{
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
try{
|
||||
#endif
|
||||
for(regex_constants::syntax_type i = 1; i < regex_constants::syntax_max; ++i)
|
||||
{
|
||||
string_type mss = this->m_pmessages->get(cat, 0, i, get_default_message(i));
|
||||
@@ -303,12 +305,14 @@ void cpp_regex_traits_char_layer<charT>::init()
|
||||
}
|
||||
}
|
||||
this->m_pmessages->close(cat);
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
this->m_pmessages->close(cat);
|
||||
throw;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -795,9 +799,9 @@ typename cpp_regex_traits_implementation<charT>::char_class_type
|
||||
if(pos != m_custom_class_names.end())
|
||||
return pos->second;
|
||||
}
|
||||
std::size_t id = 1 + re_detail::get_default_class_id(p1, p2);
|
||||
BOOST_ASSERT(id < sizeof(masks) / sizeof(masks[0]));
|
||||
return masks[id];
|
||||
std::size_t state_id = 1 + re_detail::get_default_class_id(p1, p2);
|
||||
BOOST_ASSERT(state_id < sizeof(masks) / sizeof(masks[0]));
|
||||
return masks[state_id];
|
||||
}
|
||||
|
||||
#ifdef BOOST_REGEX_BUGGY_CTYPE_FACET
|
||||
@@ -1055,3 +1059,4 @@ static_mutex& cpp_regex_traits<charT>::get_mutex_inst()
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -51,7 +51,11 @@
|
||||
namespace boost{
|
||||
namespace re_detail{
|
||||
|
||||
#ifndef BOOST_NO_ANSI_APIS
|
||||
typedef WIN32_FIND_DATAA _fi_find_data;
|
||||
#else
|
||||
typedef WIN32_FIND_DATAW _fi_find_data;
|
||||
#endif
|
||||
typedef HANDLE _fi_find_handle;
|
||||
|
||||
} // namespace re_detail
|
||||
|
||||
@@ -71,32 +71,39 @@ template class BOOST_REGEX_DECL ::boost::re_detail::perl_matcher<BOOST_REGEX_CHA
|
||||
# ifdef __GNUC__
|
||||
# define template __extension__ extern template
|
||||
# else
|
||||
# if BOOST_MSVC > 1310
|
||||
# define BOOST_REGEX_TEMPLATE_DECL
|
||||
# endif
|
||||
# define template extern template
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#ifndef BOOST_REGEX_TEMPLATE_DECL
|
||||
# define BOOST_REGEX_TEMPLATE_DECL BOOST_REGEX_DECL
|
||||
#endif
|
||||
|
||||
# ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4251 4231 4660)
|
||||
# endif
|
||||
|
||||
template class BOOST_REGEX_DECL basic_regex< BOOST_REGEX_CHAR_T BOOST_REGEX_TRAITS_T >;
|
||||
template class BOOST_REGEX_TEMPLATE_DECL basic_regex< BOOST_REGEX_CHAR_T BOOST_REGEX_TRAITS_T >;
|
||||
|
||||
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
template class BOOST_REGEX_DECL match_results< const BOOST_REGEX_CHAR_T* >;
|
||||
template class BOOST_REGEX_TEMPLATE_DECL match_results< const BOOST_REGEX_CHAR_T* >;
|
||||
#endif
|
||||
#ifndef BOOST_NO_STD_ALLOCATOR
|
||||
template class BOOST_REGEX_DECL ::boost::re_detail::perl_matcher<BOOST_REGEX_CHAR_T const *, match_results< const BOOST_REGEX_CHAR_T* >::allocator_type BOOST_REGEX_TRAITS_T >;
|
||||
template class BOOST_REGEX_TEMPLATE_DECL ::boost::re_detail::perl_matcher<BOOST_REGEX_CHAR_T const *, match_results< const BOOST_REGEX_CHAR_T* >::allocator_type BOOST_REGEX_TRAITS_T >;
|
||||
#endif
|
||||
#if !(defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_DINKUMWARE_STDLIB <= 1))\
|
||||
&& !(defined(BOOST_INTEL_CXX_VERSION) && (BOOST_INTEL_CXX_VERSION <= 800))\
|
||||
&& !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION))\
|
||||
&& !defined(BOOST_REGEX_ICU_INSTANCES)
|
||||
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
template class BOOST_REGEX_DECL match_results< std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator >;
|
||||
template class BOOST_REGEX_TEMPLATE_DECL match_results< std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator >;
|
||||
#endif
|
||||
#ifndef BOOST_NO_STD_ALLOCATOR
|
||||
template class BOOST_REGEX_DECL ::boost::re_detail::perl_matcher< std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator, match_results< std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator >::allocator_type, boost::regex_traits<BOOST_REGEX_CHAR_T > >;
|
||||
template class BOOST_REGEX_TEMPLATE_DECL ::boost::re_detail::perl_matcher< std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator, match_results< std::basic_string<BOOST_REGEX_CHAR_T>::const_iterator >::allocator_type, boost::regex_traits<BOOST_REGEX_CHAR_T > >;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -109,6 +116,8 @@ template class BOOST_REGEX_DECL ::boost::re_detail::perl_matcher< std::basic_str
|
||||
# undef template
|
||||
# endif
|
||||
|
||||
#undef BOOST_REGEX_TEMPLATE_DECL
|
||||
|
||||
#elif (defined(__GNUC__) && (__GNUC__ >= 3))
|
||||
|
||||
# ifndef BOOST_REGEX_INSTANTIATE
|
||||
|
||||
@@ -248,7 +248,7 @@ class repeater_count
|
||||
{
|
||||
repeater_count** stack;
|
||||
repeater_count* next;
|
||||
int id;
|
||||
int state_id;
|
||||
std::size_t count; // the number of iterations so far
|
||||
BidiIterator start_pos; // where the last repeat started
|
||||
public:
|
||||
@@ -256,22 +256,22 @@ public:
|
||||
{
|
||||
stack = s;
|
||||
next = 0;
|
||||
id = -1;
|
||||
state_id = -1;
|
||||
count = 0;
|
||||
}
|
||||
repeater_count(int i, repeater_count** s, BidiIterator start)
|
||||
: start_pos(start)
|
||||
{
|
||||
id = i;
|
||||
state_id = i;
|
||||
stack = s;
|
||||
next = *stack;
|
||||
*stack = this;
|
||||
if(id > next->id)
|
||||
if(state_id > next->state_id)
|
||||
count = 0;
|
||||
else
|
||||
{
|
||||
repeater_count* p = next;
|
||||
while(p->id != id)
|
||||
while(p->state_id != state_id)
|
||||
p = p->next;
|
||||
count = p->count;
|
||||
start_pos = p->start_pos;
|
||||
@@ -282,7 +282,7 @@ public:
|
||||
*stack = next;
|
||||
}
|
||||
std::size_t get_count() { return count; }
|
||||
int get_id() { return id; }
|
||||
int get_id() { return state_id; }
|
||||
std::size_t operator++() { return ++count; }
|
||||
bool check_null_repeat(const BidiIterator& pos, std::size_t max)
|
||||
{
|
||||
@@ -331,7 +331,7 @@ public:
|
||||
typedef typename traits::char_type char_type;
|
||||
typedef perl_matcher<BidiIterator, Allocator, traits> self_type;
|
||||
typedef bool (self_type::*matcher_proc_type)(void);
|
||||
typedef typename traits::size_type traits_size_type;
|
||||
typedef std::size_t traits_size_type;
|
||||
typedef typename is_byte<char_type>::width_type width_type;
|
||||
typedef typename regex_iterator_traits<BidiIterator>::difference_type difference_type;
|
||||
|
||||
@@ -487,7 +487,7 @@ private:
|
||||
void push_assertion(const re_syntax_base* ps, bool positive);
|
||||
void push_alt(const re_syntax_base* ps);
|
||||
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 id);
|
||||
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);
|
||||
|
||||
|
||||
|
||||
@@ -535,7 +535,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_within_word()
|
||||
if(position == last)
|
||||
return false;
|
||||
// both prev and this character must be m_word_mask:
|
||||
if(traits_inst.isctype(*position, m_word_mask))
|
||||
bool prev = traits_inst.isctype(*position, m_word_mask);
|
||||
{
|
||||
bool b;
|
||||
if((position == backstop) && ((m_match_flags & match_prev_avail) == 0))
|
||||
@@ -546,7 +546,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_within_word()
|
||||
b = traits_inst.isctype(*position, m_word_mask);
|
||||
++position;
|
||||
}
|
||||
if(b)
|
||||
if(b == prev)
|
||||
{
|
||||
pstate = pstate->next.p;
|
||||
return true;
|
||||
|
||||
@@ -50,13 +50,13 @@ inline void inplace_destroy(T* p)
|
||||
struct saved_state
|
||||
{
|
||||
union{
|
||||
unsigned int id;
|
||||
unsigned int state_id;
|
||||
// this padding ensures correct alignment on 64-bit platforms:
|
||||
std::size_t padding1;
|
||||
std::ptrdiff_t padding2;
|
||||
void* padding3;
|
||||
};
|
||||
saved_state(unsigned i) : id(i) {}
|
||||
saved_state(unsigned i) : state_id(i) {}
|
||||
};
|
||||
|
||||
template <class BidiIterator>
|
||||
@@ -298,7 +298,7 @@ inline void perl_matcher<BidiIterator, Allocator, traits>::push_repeater_count(i
|
||||
}
|
||||
|
||||
template <class BidiIterator, class Allocator, class traits>
|
||||
inline void perl_matcher<BidiIterator, Allocator, traits>::push_single_repeat(std::size_t c, const re_repeat* r, BidiIterator last_position, int id)
|
||||
inline void perl_matcher<BidiIterator, Allocator, traits>::push_single_repeat(std::size_t c, const re_repeat* r, BidiIterator last_position, int state_id)
|
||||
{
|
||||
saved_single_repeat<BidiIterator>* pmp = static_cast<saved_single_repeat<BidiIterator>*>(m_backup_state);
|
||||
--pmp;
|
||||
@@ -308,7 +308,7 @@ inline void perl_matcher<BidiIterator, Allocator, traits>::push_single_repeat(st
|
||||
pmp = static_cast<saved_single_repeat<BidiIterator>*>(m_backup_state);
|
||||
--pmp;
|
||||
}
|
||||
(void) new (pmp)saved_single_repeat<BidiIterator>(c, r, last_position, id);
|
||||
(void) new (pmp)saved_single_repeat<BidiIterator>(c, r, last_position, state_id);
|
||||
m_backup_state = pmp;
|
||||
}
|
||||
|
||||
@@ -477,11 +477,13 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_rep()
|
||||
take_second = can_start(*position, rep->_map, (unsigned char)mask_skip);
|
||||
}
|
||||
|
||||
if(take_first || (next_count->get_id() != rep->id))
|
||||
if((m_backup_state->state_id != saved_state_repeater_count)
|
||||
|| (static_cast<saved_repeater<BidiIterator>*>(m_backup_state)->count.get_id() != rep->state_id)
|
||||
|| (next_count->get_id() != rep->state_id))
|
||||
{
|
||||
// we're moving to a different repeat from the last
|
||||
// one, so set up a counter object:
|
||||
push_repeater_count(rep->id, &next_count);
|
||||
push_repeater_count(rep->state_id, &next_count);
|
||||
}
|
||||
//
|
||||
// If we've had at least one repeat already, and the last one
|
||||
@@ -882,7 +884,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind(bool have_match)
|
||||
//
|
||||
do
|
||||
{
|
||||
unwinder = s_unwind_table[m_backup_state->id];
|
||||
unwinder = s_unwind_table[m_backup_state->state_id];
|
||||
cont = (this->*unwinder)(m_recursive_result);
|
||||
}while(cont);
|
||||
//
|
||||
@@ -1193,6 +1195,9 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_char_repeat(bool r)
|
||||
pstate = rep->next.p;
|
||||
}while((count < rep->max) && (position != last) && !can_start(*position, rep->_map, mask_skip));
|
||||
}
|
||||
// remember where we got to if this is a leading repeat:
|
||||
if((rep->leading) && (count < rep->max))
|
||||
restart = position;
|
||||
if(position == last)
|
||||
{
|
||||
// can't repeat any more, remove the pushed state:
|
||||
@@ -1259,6 +1264,9 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_short_set_repeat(bool
|
||||
pstate = rep->next.p;
|
||||
}while((count < rep->max) && (position != last) && !can_start(*position, rep->_map, mask_skip));
|
||||
}
|
||||
// remember where we got to if this is a leading repeat:
|
||||
if((rep->leading) && (count < rep->max))
|
||||
restart = position;
|
||||
if(position == last)
|
||||
{
|
||||
// can't repeat any more, remove the pushed state:
|
||||
@@ -1326,6 +1334,9 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_long_set_repeat(bool
|
||||
pstate = rep->next.p;
|
||||
}while((count < rep->max) && (position != last) && !can_start(*position, rep->_map, mask_skip));
|
||||
}
|
||||
// remember where we got to if this is a leading repeat:
|
||||
if((rep->leading) && (count < rep->max))
|
||||
restart = position;
|
||||
if(position == last)
|
||||
{
|
||||
// can't repeat any more, remove the pushed state:
|
||||
|
||||
@@ -291,7 +291,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_rep()
|
||||
// Always copy the repeat count, so that the state is restored
|
||||
// when we exit this scope:
|
||||
//
|
||||
repeater_count<BidiIterator> r(rep->id, &next_count, position);
|
||||
repeater_count<BidiIterator> r(rep->state_id, &next_count, position);
|
||||
//
|
||||
// If we've had at least one repeat already, and the last one
|
||||
// matched the NULL string then set the repeat count to
|
||||
|
||||
@@ -319,7 +319,7 @@ inline regex_token_iterator<typename std::basic_string<charT, ST, SA>::const_ite
|
||||
return regex_token_iterator<typename std::basic_string<charT, ST, SA>::const_iterator, charT, traits>(p.begin(), p.end(), e, submatch, m);
|
||||
}
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, > 1300)
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
#ifdef BOOST_MSVC
|
||||
|
||||
@@ -134,8 +134,8 @@ inline bool is_separator<char>(char c)
|
||||
BOOST_REGEX_DECL std::string BOOST_REGEX_CALL lookup_default_collate_name(const std::string& name);
|
||||
|
||||
//
|
||||
// get the id of a character clasification, the individual
|
||||
// traits classes then transform that id into a bitmask:
|
||||
// get the state_id of a character clasification, the individual
|
||||
// traits classes then transform that state_id into a bitmask:
|
||||
//
|
||||
template <class charT>
|
||||
struct character_pointer_range
|
||||
|
||||
@@ -150,13 +150,16 @@ namespace boost{ namespace re_detail{
|
||||
return stdext::unchecked_equal(first, last, with);
|
||||
}
|
||||
|
||||
#else
|
||||
using std::copy;
|
||||
using std::equal;
|
||||
#endif
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC,>=1400) && defined(__STDC_WANT_SECURE_LIB__) && __STDC_WANT_SECURE_LIB__
|
||||
|
||||
// use safe versions of strcpy etc:
|
||||
using ::strcpy_s;
|
||||
using ::strcat_s;
|
||||
#else
|
||||
using std::copy;
|
||||
using std::equal;
|
||||
|
||||
inline std::size_t strcpy_s(
|
||||
char *strDestination,
|
||||
std::size_t sizeInBytes,
|
||||
|
||||
@@ -240,7 +240,7 @@ Repeat a section of the machine
|
||||
struct re_repeat : public re_alt
|
||||
{
|
||||
std::size_t min, max; // min and max allowable repeats
|
||||
int id; // Unique identifier for this repeat
|
||||
int state_id; // Unique identifier for this repeat
|
||||
bool leading; // True if this repeat is at the start of the machine (lets us optimize some searches)
|
||||
bool greedy; // True if this is a greedy repeat
|
||||
};
|
||||
|
||||
@@ -166,7 +166,7 @@ inline u32regex_iterator<const wchar_t*> make_u32regex_iterator(const wchar_t* p
|
||||
return u32regex_iterator<const wchar_t*>(p, p+std::wcslen(p), e, m);
|
||||
}
|
||||
#endif
|
||||
#ifndef U_WCHAR_IS_UTF16
|
||||
#if !defined(U_WCHAR_IS_UTF16) && (U_SIZEOF_WCHAR_T != 2)
|
||||
inline u32regex_iterator<const UChar*> make_u32regex_iterator(const UChar* p, const u32regex& e, regex_constants::match_flag_type m = regex_constants::match_default)
|
||||
{
|
||||
return u32regex_iterator<const UChar*>(p, p+u_strlen(p), e, m);
|
||||
|
||||
@@ -271,7 +271,7 @@ typedef u32regex_token_iterator<const char*> utf8regex_token_iterator;
|
||||
typedef u32regex_token_iterator<const UChar*> utf16regex_token_iterator;
|
||||
typedef u32regex_token_iterator<const UChar32*> utf32regex_token_iterator;
|
||||
|
||||
// construction from an integral sub_match id:
|
||||
// construction from an integral sub_match state_id:
|
||||
inline u32regex_token_iterator<const char*> make_u32regex_token_iterator(const char* p, const u32regex& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default)
|
||||
{
|
||||
return u32regex_token_iterator<const char*>(p, p+std::strlen(p), e, submatch, m);
|
||||
@@ -282,7 +282,7 @@ inline u32regex_token_iterator<const wchar_t*> make_u32regex_token_iterator(cons
|
||||
return u32regex_token_iterator<const wchar_t*>(p, p+std::wcslen(p), e, submatch, m);
|
||||
}
|
||||
#endif
|
||||
#ifndef U_WCHAR_IS_UTF16
|
||||
#if !defined(U_WCHAR_IS_UTF16) && (U_SIZEOF_WCHAR_T != 2)
|
||||
inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const UChar* p, const u32regex& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default)
|
||||
{
|
||||
return u32regex_token_iterator<const UChar*>(p, p+u_strlen(p), e, m);
|
||||
@@ -313,7 +313,7 @@ inline u32regex_token_iterator<const wchar_t*> make_u32regex_token_iterator(cons
|
||||
return u32regex_token_iterator<const wchar_t*>(p, p+std::wcslen(p), e, submatch, m);
|
||||
}
|
||||
#endif
|
||||
#ifndef U_WCHAR_IS_UTF16
|
||||
#if !defined(U_WCHAR_IS_UTF16) && (U_SIZEOF_WCHAR_T != 2)
|
||||
template <std::size_t N>
|
||||
inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const UChar* p, const u32regex& e, const int (&submatch)[N], regex_constants::match_flag_type m = regex_constants::match_default)
|
||||
{
|
||||
@@ -333,7 +333,7 @@ inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const
|
||||
}
|
||||
#endif // BOOST_MSVC < 1300
|
||||
|
||||
// construction from a vector of sub_match id's:
|
||||
// construction from a vector of sub_match state_id's:
|
||||
inline u32regex_token_iterator<const char*> make_u32regex_token_iterator(const char* p, const u32regex& e, const std::vector<int>& submatch, regex_constants::match_flag_type m = regex_constants::match_default)
|
||||
{
|
||||
return u32regex_token_iterator<const char*>(p, p+std::strlen(p), e, submatch, m);
|
||||
@@ -344,7 +344,7 @@ inline u32regex_token_iterator<const wchar_t*> make_u32regex_token_iterator(cons
|
||||
return u32regex_token_iterator<const wchar_t*>(p, p+std::wcslen(p), e, submatch, m);
|
||||
}
|
||||
#endif
|
||||
#ifndef U_WCHAR_IS_UTF16
|
||||
#if !defined(U_WCHAR_IS_UTF16) && (U_SIZEOF_WCHAR_T != 2)
|
||||
inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const UChar* p, const u32regex& e, const std::vector<int>& submatch, regex_constants::match_flag_type m = regex_constants::match_default)
|
||||
{
|
||||
return u32regex_token_iterator<const UChar*>(p, p+u_strlen(p), e, m);
|
||||
|
||||
@@ -76,36 +76,36 @@ BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_lower(char, lcid_type);
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_lower(wchar_t, lcid_type);
|
||||
#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
|
||||
BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_lower(unsigned short ca, lcid_type id);
|
||||
BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_lower(unsigned short ca, lcid_type state_id);
|
||||
#endif
|
||||
#endif
|
||||
BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_upper(char, lcid_type);
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_upper(wchar_t, lcid_type);
|
||||
#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
|
||||
BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_upper(unsigned short ca, lcid_type id);
|
||||
BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_upper(unsigned short ca, lcid_type state_id);
|
||||
#endif
|
||||
#endif
|
||||
BOOST_REGEX_DECL cat_type BOOST_REGEX_CALL w32_cat_open(const std::string& name);
|
||||
BOOST_REGEX_DECL std::string BOOST_REGEX_CALL w32_cat_get(const cat_type& cat, lcid_type id, int i, const std::string& def);
|
||||
BOOST_REGEX_DECL std::string BOOST_REGEX_CALL w32_cat_get(const cat_type& cat, lcid_type state_id, int i, const std::string& def);
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
BOOST_REGEX_DECL std::wstring BOOST_REGEX_CALL w32_cat_get(const cat_type& cat, lcid_type id, int i, const std::wstring& def);
|
||||
BOOST_REGEX_DECL std::wstring BOOST_REGEX_CALL w32_cat_get(const cat_type& cat, lcid_type state_id, int i, const std::wstring& def);
|
||||
#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
|
||||
BOOST_REGEX_DECL std::basic_string<unsigned short> BOOST_REGEX_CALL w32_cat_get(const cat_type& cat, lcid_type, int i, const std::basic_string<unsigned short>& def);
|
||||
#endif
|
||||
#endif
|
||||
BOOST_REGEX_DECL std::string BOOST_REGEX_CALL w32_transform(lcid_type id, const char* p1, const char* p2);
|
||||
BOOST_REGEX_DECL std::string BOOST_REGEX_CALL w32_transform(lcid_type state_id, const char* p1, const char* p2);
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
BOOST_REGEX_DECL std::wstring BOOST_REGEX_CALL w32_transform(lcid_type id, const wchar_t* p1, const wchar_t* p2);
|
||||
BOOST_REGEX_DECL std::wstring BOOST_REGEX_CALL w32_transform(lcid_type state_id, const wchar_t* p1, const wchar_t* p2);
|
||||
#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
|
||||
BOOST_REGEX_DECL std::basic_string<unsigned short> BOOST_REGEX_CALL w32_transform(lcid_type id, const unsigned short* p1, const unsigned short* p2);
|
||||
BOOST_REGEX_DECL std::basic_string<unsigned short> BOOST_REGEX_CALL w32_transform(lcid_type state_id, const unsigned short* p1, const unsigned short* p2);
|
||||
#endif
|
||||
#endif
|
||||
BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_tolower(char c, lcid_type);
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
BOOST_REGEX_DECL wchar_t BOOST_REGEX_CALL w32_tolower(wchar_t c, lcid_type);
|
||||
#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
|
||||
BOOST_REGEX_DECL unsigned short BOOST_REGEX_CALL w32_tolower(unsigned short c, lcid_type id);
|
||||
BOOST_REGEX_DECL unsigned short BOOST_REGEX_CALL w32_tolower(unsigned short c, lcid_type state_id);
|
||||
#endif
|
||||
#endif
|
||||
BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_toupper(char c, lcid_type);
|
||||
@@ -116,7 +116,7 @@ BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is(lcid_type, boost::uint32_t mask, c
|
||||
#ifndef BOOST_NO_WREGEX
|
||||
BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is(lcid_type, boost::uint32_t mask, wchar_t c);
|
||||
#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
|
||||
BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is(lcid_type id, boost::uint32_t m, unsigned short c);
|
||||
BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is(lcid_type state_id, boost::uint32_t m, unsigned short c);
|
||||
#endif
|
||||
#endif
|
||||
//
|
||||
@@ -540,9 +540,9 @@ typename w32_regex_traits_implementation<charT>::char_class_type
|
||||
if(pos != m_custom_class_names.end())
|
||||
return pos->second;
|
||||
}
|
||||
std::size_t id = 1 + re_detail::get_default_class_id(p1, p2);
|
||||
if(id < sizeof(masks) / sizeof(masks[0]))
|
||||
return masks[id];
|
||||
std::size_t state_id = 1 + re_detail::get_default_class_id(p1, p2);
|
||||
if(state_id < sizeof(masks) / sizeof(masks[0]))
|
||||
return masks[state_id];
|
||||
return masks[0];
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user