33namespace std _GLIBCXX_VISIBILITY(default)
35_GLIBCXX_BEGIN_NAMESPACE_VERSION
50 template<
typename _BiIter,
typename _Alloc,
typename _TraitsT,
58 enum class _Match_mode :
unsigned char { _Exact, _Prefix };
63 typedef _GLIBCXX_STD_C::vector<sub_match<_BiIter>, _Alloc>
_ResultsVec;
65 typedef typename _TraitsT::char_class_type _ClassT;
66 typedef _NFA<_TraitsT> _NFAT;
78 _M_nfa(*__re._M_automaton),
79 _M_results(__results),
80 _M_rep_count(_M_nfa.size()),
81 _M_states(_M_nfa._M_start(), _M_nfa.size()),
84 using namespace regex_constants;
85 if (__flags & match_prev_avail)
86 _M_flags &= ~(match_not_bol | match_not_bow);
93 _M_current = _M_begin;
94 return _M_main(_Match_mode::_Exact);
99 _M_search_from_first()
101 _M_current = _M_begin;
102 return _M_main(_Match_mode::_Prefix);
110 _M_rep_once_more(_Match_mode __match_mode, _StateIdT);
113 _M_handle_repeat(_Match_mode, _StateIdT);
116 _M_handle_subexpr_begin(_Match_mode, _StateIdT);
119 _M_handle_subexpr_end(_Match_mode, _StateIdT);
122 _M_handle_line_begin_assertion(_Match_mode, _StateIdT);
125 _M_handle_line_end_assertion(_Match_mode, _StateIdT);
128 _M_handle_word_boundary(_Match_mode, _StateIdT);
131 _M_handle_subexpr_lookahead(_Match_mode, _StateIdT);
134 _M_handle_match(_Match_mode, _StateIdT);
137 _M_handle_backref(_Match_mode, _StateIdT);
140 _M_handle_accept(_Match_mode, _StateIdT);
143 _M_handle_alternative(_Match_mode, _StateIdT);
146 _M_dfs(_Match_mode __match_mode, _StateIdT __start);
149 _M_main(_Match_mode __match_mode)
153 _M_main_dispatch(_Match_mode __match_mode,
__dfs);
156 _M_main_dispatch(_Match_mode __match_mode,
__bfs);
159 _M_is_word(_CharT __ch)
const
161 static const _CharT __s[2] = {
'w' };
162 return _M_re._M_automaton->_M_traits.isctype
163 (__ch, _M_re._M_automaton->_M_traits.lookup_classname(__s, __s+1));
169 if (_M_current == _M_begin)
179 if (_M_match_multiline())
180 return _M_is_line_terminator(*std::prev(_M_current));
187 else if (_M_match_multiline())
188 return _M_is_line_terminator(*std::prev(_M_current));
196 if (_M_current == _M_end)
198 else if (_M_match_multiline())
199 return _M_is_line_terminator(*_M_current);
205 _M_word_boundary()
const;
208 _M_lookahead(_StateIdT __next);
211 _M_is_line_terminator(_CharT __c)
const
213 const auto& __traits = _M_re._M_automaton->_M_traits;
214 const auto& __ct = use_facet<ctype<_CharT>>(__traits.getloc());
215 const char __n{ __ct.narrow(__c,
' ') };
228 _M_match_multiline()
const noexcept
232 return (_M_re._M_automaton->_M_options() & __m) == __m;
236 template<
typename _SearchMode,
typename _ResultsVec>
239 template<
typename _ResultsVec>
243 _State_info(_StateIdT __start,
size_t __n)
244 : _M_visited_states(
new bool[__n]()), _M_start(__start)
247 ~_State_info() {
delete[] _M_visited_states; }
249 _State_info(
const _State_info&) =
delete;
250 _State_info& operator=(
const _State_info&) =
delete;
252 bool _M_visited(_StateIdT __i)
254 if (_M_visited_states[__i])
256 _M_visited_states[__i] =
true;
260 void _M_queue(_StateIdT __i,
const _ResultsVec& __res)
261 { _M_match_queue.emplace_back(__i, __res); }
264 _BiIter* _M_get_sol_pos() {
return nullptr; }
267 _GLIBCXX_STD_C::vector<pair<_StateIdT, _ResultsVec>> _M_match_queue;
269 bool* _M_visited_states;
274 template<
typename _ResultsVec>
278 _State_info(_StateIdT __start,
size_t) : _M_start(__start)
282 bool _M_visited(_StateIdT)
const {
return false; }
285 _BiIter* _M_get_sol_pos() {
return &_M_sol_pos; }
296 const _BiIter _M_end;
300 _GLIBCXX_STD_C::vector<pair<_BiIter, int>> _M_rep_count;
301 _State_info<__search_mode, _ResultsVec> _M_states;
309_GLIBCXX_END_NAMESPACE_VERSION
integral_constant< bool, true > true_type
The type used as a compile-time boolean with true value.
integral_constant< bool, false > false_type
The type used as a compile-time boolean with false value.
ISO C++ entities toplevel namespace is std.
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
Traits class for iterators.
Takes a regex and an input string and does the matching.
constexpr allocator_type get_allocator() const noexcept
Get a copy of the memory allocation object.