diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-04-11 18:19:17 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-04-11 19:20:07 (GMT) |
commit | 857e44c156a1dbefcb49bb5792c4384cebd8762a (patch) | |
tree | 11947fb81ad9c502627f1b2bb8f090fb8d53c107 /3rdParty/Boost/src/boost/regex/v4/perl_matcher.hpp | |
parent | 77d4eb7588e113beaa03f3347523b26adefdeb06 (diff) | |
download | swift-857e44c156a1dbefcb49bb5792c4384cebd8762a.zip swift-857e44c156a1dbefcb49bb5792c4384cebd8762a.tar.bz2 |
Updated Boost to 1.42.
Diffstat (limited to '3rdParty/Boost/src/boost/regex/v4/perl_matcher.hpp')
-rw-r--r-- | 3rdParty/Boost/src/boost/regex/v4/perl_matcher.hpp | 43 |
1 files changed, 36 insertions, 7 deletions
diff --git a/3rdParty/Boost/src/boost/regex/v4/perl_matcher.hpp b/3rdParty/Boost/src/boost/regex/v4/perl_matcher.hpp index 33afe6e..52e0bce 100644 --- a/3rdParty/Boost/src/boost/regex/v4/perl_matcher.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/perl_matcher.hpp @@ -61,7 +61,7 @@ inline bool can_start(unsigned short c, const unsigned char* map, unsigned char { return ((c >= (1 << CHAR_BIT)) ? true : map[c] & mask); } -#if !defined(__hpux) // WCHAR_MIN not usable in pp-directives. +#if !defined(__hpux) && !defined(__WINSCW__)// WCHAR_MIN not usable in pp-directives. #if defined(WCHAR_MIN) && (WCHAR_MIN == 0) && !defined(BOOST_NO_INTRINSIC_WCHAR_T) inline bool can_start(wchar_t c, const unsigned char* map, unsigned char mask) { @@ -277,15 +277,21 @@ public: else { repeater_count* p = next; - while(p->state_id != state_id) + while(p && (p->state_id != state_id)) p = p->next; - count = p->count; - start_pos = p->start_pos; + if(p) + { + count = p->count; + start_pos = p->start_pos; + } + else + count = 0; } } ~repeater_count() { - *stack = next; + if(next) + *stack = next; } std::size_t get_count() { return count; } int get_id() { return state_id; } @@ -325,6 +331,17 @@ enum saved_state_type saved_state_count = 14 }; +template <class Results> +struct recursion_info +{ + typedef typename Results::value_type value_type; + typedef typename value_type::iterator iterator; + int id; + const re_syntax_base* preturn_address; + Results results; + repeater_count<iterator>* repeater_stack; +}; + #ifdef BOOST_MSVC #pragma warning(push) #pragma warning(disable : 4251 4231 4660) @@ -340,6 +357,7 @@ public: 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; + typedef match_results<BidiIterator, Allocator> results_type; perl_matcher(BidiIterator first, BidiIterator end, match_results<BidiIterator, Allocator>& what, @@ -348,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) + m_independent(false), next_count(&rep_obj), rep_obj(&next_count), recursion_stack_position(0) { construct_init(e, f); } @@ -403,12 +421,17 @@ private: bool match_char_repeat(); bool match_dot_repeat_fast(); bool match_dot_repeat_slow(); + bool match_dot_repeat_dispatch() + { + return ::boost::is_random_access_iterator<BidiIterator>::value ? match_dot_repeat_fast() : match_dot_repeat_slow(); + } bool match_backstep(); bool match_assert_backref(); bool match_toggle_case(); #ifdef BOOST_REGEX_RECURSIVE bool backtrack_till_match(std::size_t count); #endif + bool match_recursion(); // find procs stored in s_find_vtable: bool find_restart_any(); @@ -464,6 +487,9 @@ private: typename traits::char_class_type m_word_mask; // 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; #ifdef BOOST_REGEX_NON_RECURSIVE // @@ -487,6 +513,8 @@ private: bool unwind_short_set_repeat(bool); bool unwind_long_set_repeat(bool); bool unwind_non_greedy_repeat(bool); + bool unwind_recursion(bool); + bool unwind_recursion_pop(bool); void destroy_single_repeat(); void push_matched_paren(int index, const sub_match<BidiIterator>& sub); void push_recursion_stopper(); @@ -495,7 +523,8 @@ 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_pop(); // pointer to base of stack: saved_state* m_stack_base; |