31 namespace std _GLIBCXX_VISIBILITY(default)
35 _GLIBCXX_BEGIN_NAMESPACE_VERSION
41 typedef unsigned int _SizeT;
48 _M_sub_count()
const = 0;
63 _S_opcode_unknown = 0,
64 _S_opcode_alternative = 1,
65 _S_opcode_subexpr_begin = 4,
66 _S_opcode_subexpr_end = 5,
67 _S_opcode_match = 100,
68 _S_opcode_accept = 255
74 virtual void _M_set_pos(
int __i,
int __j,
const _PatternCursor& __p) = 0;
75 virtual void _M_set_matched(
int __i,
bool __is_matched) = 0;
79 typedef std::function<void (const _PatternCursor&, _Results&)> _Tagger;
81 template<
typename _FwdIterT,
typename _TraitsT>
90 operator()(
const _PatternCursor& __pc, _Results& __r)
91 { __r._M_set_pos(_M_index, 0, __pc); }
96 template<
typename _FwdIterT,
typename _TraitsT>
105 operator()(
const _PatternCursor& __pc, _Results& __r)
106 { __r._M_set_pos(_M_index, 1, __pc); }
112 typedef std::function<bool (const _PatternCursor&)> _Matcher;
116 _AnyMatcher(
const _PatternCursor&)
120 template<
typename _InIterT,
typename _TraitsT>
123 typedef typename _TraitsT::char_type char_type;
126 _CharMatcher(char_type __c,
const _TraitsT& __t = _TraitsT())
127 : _M_traits(__t), _M_c(_M_traits.translate(__c))
131 operator()(
const _PatternCursor& __pc)
const
133 typedef const _SpecializedCursor<_InIterT>& _CursorT;
134 _CursorT __c =
static_cast<_CursorT
>(__pc);
135 return _M_traits.translate(__c._M_current()) == _M_c;
138 const _TraitsT& _M_traits;
143 template<
typename _InIterT,
typename _TraitsT>
146 typedef typename _TraitsT::char_type _CharT;
150 _RangeMatcher(
bool __is_non_matching,
const _TraitsT& __t = _TraitsT())
151 : _M_traits(__t), _M_is_non_matching(__is_non_matching)
155 operator()(
const _PatternCursor& __pc)
const
157 typedef const _SpecializedCursor<_InIterT>& _CursorT;
158 _CursorT __c =
static_cast<_CursorT
>(__pc);
163 _M_add_char(_CharT __c)
167 _M_add_collating_element(
const _StringT& __s)
171 _M_add_equivalence_class(
const _StringT& __s)
175 _M_add_character_class(
const _StringT& __s)
182 const _TraitsT& _M_traits;
183 bool _M_is_non_matching;
187 typedef int _StateIdT;
190 static const _StateIdT _S_invalid_state_id = -1;
202 typedef int _OpcodeT;
207 unsigned int _M_subexpr;
211 explicit _State(_OpcodeT __opcode)
212 : _M_opcode(__opcode), _M_next(_S_invalid_state_id)
215 _State(
const _Matcher& __m)
216 : _M_opcode(_S_opcode_match), _M_next(_S_invalid_state_id), _M_matches(__m)
219 _State(_OpcodeT __opcode,
unsigned int __s,
const _Tagger& __t)
220 : _M_opcode(__opcode), _M_next(_S_invalid_state_id), _M_subexpr(__s),
224 _State(_StateIdT __next, _StateIdT __alt)
225 : _M_opcode(_S_opcode_alternative), _M_next(__next), _M_alt(__alt)
228 #ifdef _GLIBCXX_DEBUG
259 typedef _State _StateT;
260 typedef unsigned int _SizeT;
265 : _M_flags(__f), _M_start_state(0), _M_subexpr_count(0)
277 {
return _M_start_state; }
280 _M_final_states()
const
281 {
return _M_accepting_states; }
285 {
return _M_subexpr_count; }
290 this->
push_back(_StateT(_S_opcode_accept));
291 _M_accepting_states.insert(this->
size()-1);
292 return this->
size()-1;
296 _M_insert_alt(_StateIdT __next, _StateIdT __alt)
299 return this->
size()-1;
303 _M_insert_matcher(_Matcher __m)
306 return this->
size()-1;
310 _M_insert_subexpr_begin(
const _Tagger& __t)
312 this->
push_back(_StateT(_S_opcode_subexpr_begin, _M_subexpr_count++, __t));
313 return this->
size()-1;
317 _M_insert_subexpr_end(
unsigned int __i,
const _Tagger& __t)
319 this->
push_back(_StateT(_S_opcode_subexpr_end, __i, __t));
320 return this->
size()-1;
323 #ifdef _GLIBCXX_DEBUG
330 _StateIdT _M_start_state;
331 _StateSet _M_accepting_states;
332 _SizeT _M_subexpr_count;
342 _StateSeq(_Nfa& __ss, _StateIdT __s, _StateIdT __e = _S_invalid_state_id)
343 : _M_nfa(__ss), _M_start(__s), _M_end1(__s), _M_end2(__e)
346 _StateSeq(
const _StateSeq& __e1,
const _StateSeq& __e2)
347 : _M_nfa(__e1._M_nfa),
348 _M_start(_M_nfa._M_insert_alt(__e1._M_start, __e2._M_start)),
349 _M_end1(__e1._M_end1), _M_end2(__e2._M_end1)
353 _StateSeq(
const _StateSeq& __e, _StateIdT __id)
354 : _M_nfa(__e._M_nfa),
355 _M_start(_M_nfa._M_insert_alt(__id, __e._M_start)),
356 _M_end1(__id), _M_end2(__e._M_end1)
360 _StateSeq(
const _StateSeq& __rhs)
361 : _M_nfa(__rhs._M_nfa), _M_start(__rhs._M_start),
362 _M_end1(__rhs._M_end1), _M_end2(__rhs._M_end2)
366 _StateSeq& operator=(
const _StateSeq& __rhs);
374 _M_push_back(_StateIdT __id);
378 _M_append(_StateIdT __id);
381 _M_append(_StateSeq& __rhs);
395 _GLIBCXX_END_NAMESPACE_VERSION
void push_back(const value_type &__x)
Add data to the end of the vector.
constexpr size_t size() const
Returns the total number of bits.
A standard container which offers fixed time access to individual elements in any order...
unsigned int syntax_option_type
This is a bitmask type indicating how to interpret the regex.