#endif
namespace boost{
-namespace re_detail{
+namespace BOOST_REGEX_DETAIL_NS{
//
// error checking API:
int state_id;
std::size_t count; // the number of iterations so far
BidiIterator start_pos; // where the last repeat started
+
+ repeater_count* unwind_until(int n, repeater_count* p, int current_recursion_id)
+ {
+ while(p && (p->state_id != n))
+ {
+ if(-2 - current_recursion_id == p->state_id)
+ return 0;
+ p = p->next;
+ if(p && (p->state_id < 0))
+ {
+ p = unwind_until(p->state_id, p, current_recursion_id);
+ if(!p)
+ return p;
+ p = p->next;
+ }
+ }
+ return p;
+ }
public:
repeater_count(repeater_count** s) : stack(s), next(0), state_id(-1), count(0), start_pos() {}
-
- repeater_count(int i, repeater_count** s, BidiIterator start)
+
+ repeater_count(int i, repeater_count** s, BidiIterator start, int current_recursion_id)
: start_pos(start)
{
state_id = i;
stack = s;
next = *stack;
*stack = this;
- if(state_id > next->state_id)
+ if((state_id > next->state_id) && (next->state_id >= 0))
count = 0;
else
{
repeater_count* p = next;
- while(p && (p->state_id != state_id))
- p = p->next;
+ p = unwind_until(state_id, p, current_recursion_id);
if(p)
{
count = p->count;
bool backtrack_till_match(std::size_t count);
#endif
bool match_recursion();
+ bool match_fail();
+ bool match_accept();
+ bool match_commit();
+ bool match_then();
+ bool skip_until_paren(int index, bool match = true);
// find procs stored in s_find_vtable:
bool find_restart_any();
unsigned char match_any_mask;
// recursion information:
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:
bool unwind_non_greedy_repeat(bool);
bool unwind_recursion(bool);
bool unwind_recursion_pop(bool);
+ bool unwind_commit(bool);
+ bool unwind_then(bool);
void destroy_single_repeat();
void push_matched_paren(int index, const sub_match<BidiIterator>& sub);
void push_recursion_stopper();
saved_state* m_stack_base;
// pointer to current stack position:
saved_state* m_backup_state;
+ // how many memory blocks have we used up?:
+ unsigned used_block_count;
// determines what value to return when unwinding from recursion,
// allows for mixed recursive/non-recursive algorithm:
bool m_recursive_result;
- // how many memory blocks have we used up?:
- unsigned used_block_count;
+ // We have unwound to a lookahead/lookbehind, used by COMMIT/PRUNE/SKIP:
+ bool m_unwound_lookahead;
+ // We have unwound to an alternative, used by THEN:
+ bool m_unwound_alt;
+ // We are unwinding a commit - used by independent subs to determine whether to stop there or carry on unwinding:
+ //bool m_unwind_commit;
#endif
// these operations aren't allowed, so are declared private,
#pragma warning(pop)
#endif
-} // namespace re_detail
+} // namespace BOOST_REGEX_DETAIL_NS
#ifdef BOOST_MSVC
#pragma warning(push)