forked from boostorg/regex
Remove recursive option for v5.
This commit is contained in:
@ -339,12 +339,13 @@ BOOST_REGEX_DECL void BOOST_REGEX_CALL reset_stack_guard_page();
|
|||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
*
|
*
|
||||||
* Algorithm selection and configuration:
|
* Algorithm selection and configuration.
|
||||||
|
* These options are now obsolete for C++11 and later (regex v5).
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if !defined(BOOST_REGEX_RECURSIVE) && !defined(BOOST_REGEX_NON_RECURSIVE)
|
#if !defined(BOOST_REGEX_RECURSIVE) && !defined(BOOST_REGEX_NON_RECURSIVE)
|
||||||
# if defined(BOOST_REGEX_HAS_MS_STACK_GUARD) && !defined(_STLP_DEBUG) && !defined(__STL_DEBUG) && !(defined(_MSC_VER) && (_MSC_VER >= 1400))
|
# if defined(BOOST_REGEX_HAS_MS_STACK_GUARD) && !defined(_STLP_DEBUG) && !defined(__STL_DEBUG) && !(defined(_MSC_VER) && (_MSC_VER >= 1400)) && defined(BOOST_REGEX_CXX03)
|
||||||
# define BOOST_REGEX_RECURSIVE
|
# define BOOST_REGEX_RECURSIVE
|
||||||
# else
|
# else
|
||||||
# define BOOST_REGEX_NON_RECURSIVE
|
# define BOOST_REGEX_NON_RECURSIVE
|
||||||
|
@ -61,10 +61,12 @@
|
|||||||
|
|
||||||
// define this if you want to use the recursive algorithm
|
// define this if you want to use the recursive algorithm
|
||||||
// even if BOOST_REGEX_HAS_MS_STACK_GUARD is not defined.
|
// even if BOOST_REGEX_HAS_MS_STACK_GUARD is not defined.
|
||||||
|
// NOTE: OBSOLETE!!
|
||||||
// #define BOOST_REGEX_RECURSIVE
|
// #define BOOST_REGEX_RECURSIVE
|
||||||
|
|
||||||
// define this if you want to use the non-recursive
|
// define this if you want to use the non-recursive
|
||||||
// algorithm, even if the recursive version would be the default.
|
// algorithm, even if the recursive version would be the default.
|
||||||
|
// NOTE: OBSOLETE!!
|
||||||
// #define BOOST_REGEX_NON_RECURSIVE
|
// #define BOOST_REGEX_NON_RECURSIVE
|
||||||
|
|
||||||
// define this if you want to set the size of the memory blocks
|
// define this if you want to set the size of the memory blocks
|
||||||
|
@ -389,9 +389,7 @@ public:
|
|||||||
: m_result(what), base(first), last(end),
|
: m_result(what), base(first), last(end),
|
||||||
position(first), backstop(l_base), re(e), traits_inst(e.get_traits()),
|
position(first), backstop(l_base), re(e), traits_inst(e.get_traits()),
|
||||||
m_independent(false), next_count(&rep_obj), rep_obj(&next_count)
|
m_independent(false), next_count(&rep_obj), rep_obj(&next_count)
|
||||||
#ifdef BOOST_REGEX_NON_RECURSIVE
|
|
||||||
, m_recursions(0)
|
, m_recursions(0)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
construct_init(e, f);
|
construct_init(e, f);
|
||||||
}
|
}
|
||||||
@ -453,9 +451,6 @@ private:
|
|||||||
bool match_backstep();
|
bool match_backstep();
|
||||||
bool match_assert_backref();
|
bool match_assert_backref();
|
||||||
bool match_toggle_case();
|
bool match_toggle_case();
|
||||||
#ifdef BOOST_REGEX_RECURSIVE
|
|
||||||
bool backtrack_till_match(std::size_t count);
|
|
||||||
#endif
|
|
||||||
bool match_recursion();
|
bool match_recursion();
|
||||||
bool match_fail();
|
bool match_fail();
|
||||||
bool match_accept();
|
bool match_accept();
|
||||||
@ -519,13 +514,6 @@ private:
|
|||||||
unsigned char match_any_mask;
|
unsigned char match_any_mask;
|
||||||
// recursion information:
|
// recursion information:
|
||||||
std::vector<recursion_info<results_type> > recursion_stack;
|
std::vector<recursion_info<results_type> > recursion_stack;
|
||||||
#ifdef BOOST_REGEX_RECURSIVE
|
|
||||||
// Set to false by a (*COMMIT):
|
|
||||||
bool m_can_backtrack;
|
|
||||||
bool m_have_accept;
|
|
||||||
bool m_have_then;
|
|
||||||
#endif
|
|
||||||
#ifdef BOOST_REGEX_NON_RECURSIVE
|
|
||||||
//
|
//
|
||||||
// additional members for non-recursive version:
|
// additional members for non-recursive version:
|
||||||
//
|
//
|
||||||
@ -581,7 +569,6 @@ private:
|
|||||||
//bool m_unwind_commit;
|
//bool m_unwind_commit;
|
||||||
// Recursion limit:
|
// Recursion limit:
|
||||||
unsigned m_recursions;
|
unsigned m_recursions;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef BOOST_MSVC
|
#ifdef BOOST_MSVC
|
||||||
# pragma warning(push)
|
# pragma warning(push)
|
||||||
@ -624,11 +611,7 @@ private:
|
|||||||
//
|
//
|
||||||
// include the implementation of perl_matcher:
|
// include the implementation of perl_matcher:
|
||||||
//
|
//
|
||||||
#ifdef BOOST_REGEX_RECURSIVE
|
|
||||||
#include <boost/regex/v5/perl_matcher_recursive.hpp>
|
|
||||||
#else
|
|
||||||
#include <boost/regex/v5/perl_matcher_non_recursive.hpp>
|
#include <boost/regex/v5/perl_matcher_non_recursive.hpp>
|
||||||
#endif
|
|
||||||
// this one has to be last:
|
// this one has to be last:
|
||||||
#include <boost/regex/v5/perl_matcher_common.hpp>
|
#include <boost/regex/v5/perl_matcher_common.hpp>
|
||||||
|
|
||||||
|
@ -86,13 +86,8 @@ void perl_matcher<BidiIterator, Allocator, traits>::construct_init(const basic_r
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_presult = &m_result;
|
m_presult = &m_result;
|
||||||
#ifdef BOOST_REGEX_NON_RECURSIVE
|
|
||||||
m_stack_base = 0;
|
m_stack_base = 0;
|
||||||
m_backup_state = 0;
|
m_backup_state = 0;
|
||||||
#elif defined(BOOST_REGEX_RECURSIVE)
|
|
||||||
m_can_backtrack = true;
|
|
||||||
m_have_accept = false;
|
|
||||||
#endif
|
|
||||||
// find the value to use for matching word boundaries:
|
// find the value to use for matching word boundaries:
|
||||||
m_word_mask = re.get_data().m_word_mask;
|
m_word_mask = re.get_data().m_word_mask;
|
||||||
// find bitmask to use for matching '.':
|
// find bitmask to use for matching '.':
|
||||||
@ -210,12 +205,10 @@ template <class BidiIterator, class Allocator, class traits>
|
|||||||
bool perl_matcher<BidiIterator, Allocator, traits>::match_imp()
|
bool perl_matcher<BidiIterator, Allocator, traits>::match_imp()
|
||||||
{
|
{
|
||||||
// initialise our stack if we are non-recursive:
|
// initialise our stack if we are non-recursive:
|
||||||
#ifdef BOOST_REGEX_NON_RECURSIVE
|
|
||||||
save_state_init init(&m_stack_base, &m_backup_state);
|
save_state_init init(&m_stack_base, &m_backup_state);
|
||||||
used_block_count = BOOST_REGEX_MAX_BLOCKS;
|
used_block_count = BOOST_REGEX_MAX_BLOCKS;
|
||||||
#if !defined(BOOST_NO_EXCEPTIONS)
|
#if !defined(BOOST_NO_EXCEPTIONS)
|
||||||
try{
|
try{
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// reset our state machine:
|
// reset our state machine:
|
||||||
@ -233,7 +226,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_imp()
|
|||||||
return false;
|
return false;
|
||||||
return (m_result[0].second == last) && (m_result[0].first == base);
|
return (m_result[0].second == last) && (m_result[0].first == base);
|
||||||
|
|
||||||
#if defined(BOOST_REGEX_NON_RECURSIVE) && !defined(BOOST_NO_EXCEPTIONS)
|
#if !defined(BOOST_NO_EXCEPTIONS)
|
||||||
}
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
@ -271,12 +264,10 @@ bool perl_matcher<BidiIterator, Allocator, traits>::find_imp()
|
|||||||
};
|
};
|
||||||
|
|
||||||
// initialise our stack if we are non-recursive:
|
// initialise our stack if we are non-recursive:
|
||||||
#ifdef BOOST_REGEX_NON_RECURSIVE
|
|
||||||
save_state_init init(&m_stack_base, &m_backup_state);
|
save_state_init init(&m_stack_base, &m_backup_state);
|
||||||
used_block_count = BOOST_REGEX_MAX_BLOCKS;
|
used_block_count = BOOST_REGEX_MAX_BLOCKS;
|
||||||
#if !defined(BOOST_NO_EXCEPTIONS)
|
#if !defined(BOOST_NO_EXCEPTIONS)
|
||||||
try{
|
try{
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
state_count = 0;
|
state_count = 0;
|
||||||
@ -324,7 +315,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::find_imp()
|
|||||||
matcher_proc_type proc = s_find_vtable[type];
|
matcher_proc_type proc = s_find_vtable[type];
|
||||||
return (this->*proc)();
|
return (this->*proc)();
|
||||||
|
|
||||||
#if defined(BOOST_REGEX_NON_RECURSIVE) && !defined(BOOST_NO_EXCEPTIONS)
|
#if !defined(BOOST_NO_EXCEPTIONS)
|
||||||
}
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
@ -371,9 +362,6 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_prefix()
|
|||||||
#endif
|
#endif
|
||||||
if(!m_has_found_match)
|
if(!m_has_found_match)
|
||||||
position = restart; // reset search postion
|
position = restart; // reset search postion
|
||||||
#ifdef BOOST_REGEX_RECURSIVE
|
|
||||||
m_can_backtrack = true; // reset for further searches
|
|
||||||
#endif
|
|
||||||
return m_has_found_match;
|
return m_has_found_match;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user