33 namespace std _GLIBCXX_VISIBILITY(default)
51 __i != __s.
end(); ++__i)
57 if (__state._M_opcode == std::__detail::_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::__detail::_StateIdT __u,
93 if (__e.
count(__u) == 0)
104 _GLIBCXX_BEGIN_NAMESPACE_VERSION
106 inline _Grep_matcher::
107 _Grep_matcher(_PatternCursor& __p, _Results& __r,
110 : _M_nfa(static_pointer_cast<_Nfa>(__nfa)), _M_pattern(__p), _M_results(__r)
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));
128 return this->_M_e_closure(__stack, __s);
138 return this->_M_e_closure(__stack, __s);
142 _M_e_closure(_StateStack& __stack,
const _StateSet& __s)
145 while (!__stack.empty())
147 _StateIdT __t = __stack.top(); __stack.pop();
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
static const _StateIdT _S_invalid_state_id
The special case in which a state identifier is not an index.
std::pair< iterator, bool > insert(const value_type &__x)
Attempts to insert an element into the set.
std::bitset< _S_match_flag_last > match_flag_type
This is a bitmask type indicating regex matching rules.
std::shared_ptr< _Automaton > _AutomatonPtr
Generic shared pointer to an automaton.
std::stack< _StateIdT, std::vector< _StateIdT > > _StateStack
A stack of states used in evaluating the NFA.
std::set< _StateIdT > _StateSet
The Grep Matcher works on sets of states. Here are sets of states.
A standard container which offers fixed time access to individual elements in any order...
size_type size() const noexcept
Returns the size of the set.
iterator begin() const noexcept
iterator end() const noexcept
ABC for pattern matching.
int _StateIdT
Identifies a state in the NFA.
A standard container giving FILO behavior.
_Rep_type::const_iterator const_iterator
Iterator-related typedefs.
size_type count(const key_type &__x) const
Finds the number of elements.