1 | Index: state.hpp
|
---|
2 | ===================================================================
|
---|
3 | RCS file: /cvsroot/boost/boost/boost/xpressive/detail/core/state.hpp,v
|
---|
4 | retrieving revision 1.6
|
---|
5 | diff -b -d -u -r1.6 state.hpp
|
---|
6 | --- state.hpp 13 Feb 2006 01:05:37 -0000 1.6
|
---|
7 | +++ state.hpp 2 Jun 2007 02:19:24 -0000
|
---|
8 | @@ -107,7 +107,7 @@
|
---|
9 | bool found_partial_match_;
|
---|
10 |
|
---|
11 | match_context context_;
|
---|
12 | - results_extras &extras_;
|
---|
13 | + results_extras *extras_;
|
---|
14 | action_state action_state_;
|
---|
15 |
|
---|
16 | ///////////////////////////////////////////////////////////////////////////////
|
---|
17 | @@ -128,17 +128,17 @@
|
---|
18 | , flags_(flags)
|
---|
19 | , found_partial_match_(false)
|
---|
20 | , context_() // zero-initializes the fields of context_
|
---|
21 | - , extras_(core_access<BidiIter>::get_extras(what))
|
---|
22 | + , extras_(&core_access<BidiIter>::get_extras(what))
|
---|
23 | , action_state_(core_access<BidiIter>::get_action_state(what))
|
---|
24 | {
|
---|
25 | // reclaim any cached memory in the match_results struct
|
---|
26 | - this->extras_.sub_match_stack_.unwind();
|
---|
27 | + this->extras_->sub_match_stack_.unwind();
|
---|
28 |
|
---|
29 | // initialize the context_ struct
|
---|
30 | this->init_(impl, what);
|
---|
31 |
|
---|
32 | // move all the nested match_results structs into the match_results cache
|
---|
33 | - this->extras_.results_cache_.reclaim_all(access::get_nested_results(what));
|
---|
34 | + this->extras_->results_cache_.reclaim_all(access::get_nested_results(what));
|
---|
35 | }
|
---|
36 |
|
---|
37 | ///////////////////////////////////////////////////////////////////////////////
|
---|
38 | @@ -146,11 +146,12 @@
|
---|
39 | //void reset(match_results &what, basic_regex const &rex)
|
---|
40 | void reset(match_results &what, regex_impl const &impl)
|
---|
41 | {
|
---|
42 | + this->extras_ = &core_access<BidiIter>::get_extras(what);
|
---|
43 | this->context_.prev_context_ = 0;
|
---|
44 | this->found_partial_match_ = false;
|
---|
45 | - this->extras_.sub_match_stack_.unwind();
|
---|
46 | + this->extras_->sub_match_stack_.unwind();
|
---|
47 | this->init_(impl, what);
|
---|
48 | - this->extras_.results_cache_.reclaim_all(access::get_nested_results(what));
|
---|
49 | + this->extras_->results_cache_.reclaim_all(access::get_nested_results(what));
|
---|
50 | }
|
---|
51 |
|
---|
52 | ///////////////////////////////////////////////////////////////////////////////
|
---|
53 | @@ -163,7 +164,7 @@
|
---|
54 |
|
---|
55 | // create a new nested match_results for this regex
|
---|
56 | nested_results<BidiIter> &nested = access::get_nested_results(*context.results_ptr_);
|
---|
57 | - match_results &what = this->extras_.results_cache_.append_new(nested);
|
---|
58 | + match_results &what = this->extras_->results_cache_.append_new(nested);
|
---|
59 |
|
---|
60 | // (re)initialize the match context
|
---|
61 | this->init_(impl, what);
|
---|
62 | @@ -191,7 +192,7 @@
|
---|
63 |
|
---|
64 | // send the match_results struct back to the cache
|
---|
65 | nested_results<BidiIter> &nested = access::get_nested_results(what);
|
---|
66 | - this->extras_.results_cache_.reclaim_last(nested);
|
---|
67 | + this->extras_->results_cache_.reclaim_last(nested);
|
---|
68 | }
|
---|
69 |
|
---|
70 | // restore the state
|
---|
71 | @@ -255,7 +256,7 @@
|
---|
72 | this->context_.results_ptr_ = &what;
|
---|
73 | this->context_.traits_ = impl.traits_.get();
|
---|
74 | this->mark_count_ = impl.mark_count_ + 1;
|
---|
75 | - this->sub_matches_ = this->extras_.sub_match_stack_.push_sequence(total_mark_count);
|
---|
76 | + this->sub_matches_ = this->extras_->sub_match_stack_.push_sequence(total_mark_count);
|
---|
77 | this->sub_matches_ += impl.hidden_mark_count_;
|
---|
78 |
|
---|
79 | // initialize the match_results struct
|
---|
80 | @@ -264,7 +265,7 @@
|
---|
81 |
|
---|
82 | void uninit_(regex_impl const &impl, match_results &)
|
---|
83 | {
|
---|
84 | - extras_.sub_match_stack_.unwind_to(this->sub_matches_ - impl.hidden_mark_count_);
|
---|
85 | + extras_->sub_match_stack_.unwind_to(this->sub_matches_ - impl.hidden_mark_count_);
|
---|
86 | }
|
---|
87 |
|
---|
88 | bool found_partial_match()
|
---|
89 | @@ -292,7 +293,7 @@
|
---|
90 | {
|
---|
91 | memento<BidiIter> mem =
|
---|
92 | {
|
---|
93 | - state.extras_.sub_match_stack_.push_sequence(state.mark_count_, no_fill)
|
---|
94 | + state.extras_->sub_match_stack_.push_sequence(state.mark_count_, no_fill)
|
---|
95 | , state.context_.results_ptr_->nested_results().size()
|
---|
96 | };
|
---|
97 | std::copy(state.sub_matches_, state.sub_matches_ + state.mark_count_, mem.old_sub_matches_);
|
---|
98 | @@ -308,9 +309,9 @@
|
---|
99 | typedef core_access<BidiIter> access;
|
---|
100 | nested_results<BidiIter> &nested = access::get_nested_results(*state.context_.results_ptr_);
|
---|
101 | std::size_t count = state.context_.results_ptr_->nested_results().size() - mem.nested_results_count_;
|
---|
102 | - state.extras_.results_cache_.reclaim_last_n(nested, count);
|
---|
103 | + state.extras_->results_cache_.reclaim_last_n(nested, count);
|
---|
104 | std::copy(mem.old_sub_matches_, mem.old_sub_matches_ + state.mark_count_, state.sub_matches_);
|
---|
105 | - state.extras_.sub_match_stack_.unwind_to(mem.old_sub_matches_);
|
---|
106 | + state.extras_->sub_match_stack_.unwind_to(mem.old_sub_matches_);
|
---|
107 | }
|
---|
108 |
|
---|
109 | ///////////////////////////////////////////////////////////////////////////////
|
---|
110 | @@ -322,7 +323,7 @@
|
---|
111 | std::size_t count = state.context_.results_ptr_->nested_results().size() - mem.nested_results_count_;
|
---|
112 | if(count == 0)
|
---|
113 | {
|
---|
114 | - state.extras_.sub_match_stack_.unwind_to(mem.old_sub_matches_);
|
---|
115 | + state.extras_->sub_match_stack_.unwind_to(mem.old_sub_matches_);
|
---|
116 | }
|
---|
117 | // else we have we must orphan this block of backrefs because we are using the stack
|
---|
118 | // space above it.
|
---|