33namespace std _GLIBCXX_VISIBILITY(default)
35_GLIBCXX_BEGIN_NAMESPACE_VERSION
44 template<typename _BiIter, bool _Trivial = is_trivially_copyable<_BiIter>::value>
45 struct _ExecutorFrame;
47_GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(_V2)
56 template<
typename _BiIter,
typename _Alloc,
typename _TraitsT>
59 enum class _Match_mode :
unsigned char { _Exact, _Prefix };
62 typedef typename iterator_traits<_BiIter>::value_type _CharT;
63 typedef basic_regex<_CharT, _TraitsT> _RegexT;
64 typedef _GLIBCXX_STD_C::vector<sub_match<_BiIter>, _Alloc> _ResultsVec;
66 typedef typename _TraitsT::char_class_type _ClassT;
67 typedef _NFA<_TraitsT> _NFAT;
70 _Executor(_BiIter __begin,
72 _ResultsVec& __results,
76 : _M_cur_results(__results.get_allocator()),
80 _M_nfa(*__re._M_automaton),
81 _M_results(__results),
82 _M_rep_count(_M_nfa.
size()),
83 _M_start(_M_nfa._M_start()),
84 _M_visited_states(nullptr),
88 using namespace regex_constants;
89 if (__flags & match_prev_avail)
90 _M_flags &= ~(match_not_bol | match_not_bow);
91 if (_M_search_mode == _Search_mode::_Bfs)
92 _M_visited_states =
new bool[_M_nfa.
size()];
96 {
delete[] _M_visited_states; }
102 _M_current = _M_begin;
103 return _M_main(_Match_mode::_Exact);
108 _M_search_from_first()
110 _M_current = _M_begin;
128 if (_M_search_mode == _Search_mode::_Dfs
129 && !_M_nfa._M_has_backref
130 && _M_current != _M_end
131 && !_M_maybe_start_match(_M_start, 0))
133 return _M_main(_Match_mode::_Prefix);
141 _M_rep_once_more(_Match_mode __match_mode, _StateIdT);
144 _M_match_simple_repeat_body(_StateIdT, _StateIdT);
146 template<_Search_mode __search_mode>
148 _M_handle_repeat(_Match_mode, _StateIdT);
150 template<_Search_mode __search_mode>
152 _M_handle_subexpr_begin(_Match_mode, _StateIdT);
154 template<_Search_mode __search_mode>
156 _M_handle_subexpr_end(_Match_mode, _StateIdT);
159 _M_handle_line_begin_assertion(_Match_mode, _StateIdT);
162 _M_handle_line_end_assertion(_Match_mode, _StateIdT);
165 _M_handle_word_boundary(_Match_mode, _StateIdT);
168 _M_handle_subexpr_lookahead(_Match_mode, _StateIdT);
170 template<_Search_mode __search_mode>
172 _M_handle_match(_Match_mode, _StateIdT);
175 _M_handle_backref(_Match_mode, _StateIdT);
177 template<_Search_mode __search_mode>
179 _M_handle_accept(_Match_mode, _StateIdT);
182 _M_handle_alternative(_Match_mode, _StateIdT);
184 template<_Search_mode __search_mode>
186 _M_node(_Match_mode, _StateIdT);
188 template<_Search_mode __search_mode>
190 _M_dfs(_Match_mode __match_mode, _StateIdT __start);
193 _M_main(_Match_mode __match_mode)
195 if (_M_search_mode == _Search_mode::_Dfs)
196 return _M_main_dfs(__match_mode);
198 return _M_main_bfs(__match_mode);
202 _M_main_dfs(_Match_mode __match_mode);
205 _M_maybe_start_match(_StateIdT,
size_t);
208 _M_main_bfs(_Match_mode __match_mode);
211 _M_is_word(_CharT __ch)
const
213 static const _CharT __s[2] = {
'w' };
214 return _M_re._M_automaton->_M_traits.isctype
215 (__ch, _M_re._M_automaton->_M_traits.lookup_classname(__s, __s+1));
221 if (_M_current == _M_begin)
231 if (_M_match_multiline())
232 return _M_is_line_terminator(*std::prev(_M_current));
239 else if (_M_match_multiline())
240 return _M_is_line_terminator(*std::prev(_M_current));
248 if (_M_current == _M_end)
250 else if (_M_match_multiline())
251 return _M_is_line_terminator(*_M_current);
257 _M_word_boundary()
const;
260 _M_lookahead(_StateIdT __next);
263 _M_is_line_terminator(_CharT __c)
const
265 const auto& __traits = _M_re._M_automaton->_M_traits;
267 const char __n{ __ct.narrow(__c,
' ') };
280 _M_match_multiline() const noexcept
284 return (_M_re._M_automaton->_M_options() & __m) == __m;
288 _M_visited(_StateIdT __i)
290 if (_M_visited_states)
292 if (_M_visited_states[__i])
294 _M_visited_states[__i] =
true;
299 _BiIter* _M_get_sol_pos() {
return &_M_sol_pos; }
302 _GLIBCXX_STD_C::vector<_ExecutorFrame<_BiIter>> _M_frames;
303 _ResultsVec _M_cur_results;
306 const _BiIter _M_end;
307 const _RegexT& _M_re;
309 _ResultsVec& _M_results;
310 _GLIBCXX_STD_C::vector<pair<_BiIter, int>> _M_rep_count;
315 _GLIBCXX_STD_C::vector<pair<_StateIdT, _ResultsVec>> _M_match_queue;
317 bool* _M_visited_states;
323_GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
327_GLIBCXX_END_NAMESPACE_VERSION
const _Facet & use_facet(const locale &__loc)
Return a facet.
_Search_mode
Takes a regex and an input string and does the matching.
ISO C++ entities toplevel namespace is std.
constexpr auto size(const _Container &__cont) noexcept(noexcept(__cont.size())) -> decltype(__cont.size())
Return the size of a container.
Implementation details not part of the namespace std interface.
constexpr match_flag_type match_not_bol
constexpr syntax_option_type ECMAScript
constexpr syntax_option_type __multiline
Extension: Equivalent to regex_constants::multiline for C++11 and C++14.
constexpr match_flag_type match_not_eol
match_flag_type
This is a bitmask type indicating regex matching rules.
constexpr match_flag_type match_prev_avail
constexpr size_type size() const noexcept