33 namespace std _GLIBCXX_VISIBILITY(default)
45 __move(
const std::__regex::_PatternCursor& __p,
46 const std::__regex::_Nfa& __nfa,
51 __i != __s.
end(); ++__i)
53 if (*__i == std::__regex::_S_invalid_state_id)
56 const std::__regex::_State& __state = __nfa[*__i];
57 if (__state._M_opcode == std::__regex::_S_opcode_match
58 && __state._M_matches(__p))
59 __m.
insert(__state._M_next);
69 if (__s.
size() > 0 && __t.
size() > 0)
73 while (__first != __s.
end() && __second != __t.
end())
75 if (*__first < *__second)
77 else if (*__second < *__first)
89 __add_visited_state(
const std::__regex::_StateIdT __u,
93 if (__e.
count(__u) == 0)
104 _GLIBCXX_BEGIN_NAMESPACE_VERSION
106 inline _Grep_matcher::
107 _Grep_matcher(_PatternCursor& __p, _Results& __r,
108 const _AutomatonPtr& __nfa,
110 : _M_nfa(static_pointer_cast<_Nfa>(__nfa)), _M_pattern(__p), _M_results(__r)
112 __regex::_StateSet __t = this->_M_e_closure(_M_nfa->_M_start());
113 for (; !_M_pattern._M_at_end(); _M_pattern._M_next())
114 __t = this->_M_e_closure(__move(_M_pattern, *_M_nfa, __t));
116 _M_results._M_set_matched(0,
117 __includes_some(_M_nfa->_M_final_states(), __t));
121 inline _StateSet _Grep_matcher::
122 _M_e_closure(_StateIdT __i)
128 return this->_M_e_closure(__stack, __s);
132 inline _StateSet _Grep_matcher::
133 _M_e_closure(
const _StateSet& __s)
136 for (_StateSet::const_iterator __i = __s.begin(); __i != __s.end(); ++__i)
138 return this->_M_e_closure(__stack, __s);
141 inline _StateSet _Grep_matcher::
142 _M_e_closure(_StateStack& __stack,
const _StateSet& __s)
145 while (!__stack.empty())
147 _StateIdT __t = __stack.top(); __stack.pop();
148 if (__t == _S_invalid_state_id)
151 const _State& __state = _M_nfa->operator[](__t);
152 switch (__state._M_opcode)
154 case _S_opcode_alternative:
155 __add_visited_state(__state._M_next, __stack, __e);
156 __add_visited_state(__state._M_alt, __stack, __e);
158 case _S_opcode_subexpr_begin:
159 __add_visited_state(__state._M_next, __stack, __e);
160 __state._M_tagger(_M_pattern, _M_results);
162 case _S_opcode_subexpr_end:
163 __add_visited_state(__state._M_next, __stack, __e);
164 __state._M_tagger(_M_pattern, _M_results);
165 _M_results._M_set_matched(__state._M_subexpr,
true);
167 case _S_opcode_accept:
168 __add_visited_state(__state._M_next, __stack, __e);
177 _GLIBCXX_END_NAMESPACE_VERSION