31 namespace std _GLIBCXX_VISIBILITY(default)
35 _GLIBCXX_BEGIN_NAMESPACE_VERSION
46 typedef unsigned int _SizeT;
53 _M_sub_count()
const = 0;
68 _S_opcode_unknown = 0,
69 _S_opcode_alternative = 1,
70 _S_opcode_subexpr_begin = 4,
71 _S_opcode_subexpr_end = 5,
72 _S_opcode_match = 100,
73 _S_opcode_accept = 255
79 virtual void _M_set_pos(
int __i,
int __j,
const _PatternCursor& __p) = 0;
80 virtual void _M_set_matched(
int __i,
bool __is_matched) = 0;
84 typedef std::function<void (const _PatternCursor&, _Results&)>
_Tagger;
87 template<
typename _FwdIterT,
typename _TraitsT>
97 { __r._M_set_pos(_M_index, 0, __pc); }
103 template<
typename _FwdIterT,
typename _TraitsT>
113 { __r._M_set_pos(_M_index, 1, __pc); }
120 typedef std::function<bool (const _PatternCursor&)>
_Matcher;
128 template<
typename _InIterT,
typename _TraitsT>
131 typedef typename _TraitsT::char_type char_type;
134 _CharMatcher(char_type __c,
const _TraitsT& __t = _TraitsT())
135 : _M_traits(__t), _M_c(_M_traits.translate(__c))
142 _CursorT __c =
static_cast<_CursorT
>(__pc);
143 return _M_traits.translate(__c._M_current()) == _M_c;
146 const _TraitsT& _M_traits;
151 template<
typename _InIterT,
typename _TraitsT>
154 typedef typename _TraitsT::char_type _CharT;
158 _RangeMatcher(
bool __is_non_matching,
const _TraitsT& __t = _TraitsT())
159 : _M_traits(__t), _M_is_non_matching(__is_non_matching)
166 _CursorT __c =
static_cast<_CursorT
>(__pc);
171 _M_add_char(_CharT __c)
175 _M_add_collating_element(
const _StringT& __s)
179 _M_add_equivalence_class(
const _StringT& __s)
183 _M_add_character_class(
const _StringT& __s)
190 const _TraitsT& _M_traits;
191 bool _M_is_non_matching;
213 typedef int _OpcodeT;
218 unsigned int _M_subexpr;
222 explicit _State(_OpcodeT __opcode)
230 _State(_OpcodeT __opcode,
unsigned int __s,
const _Tagger& __t)
236 : _M_opcode(_S_opcode_alternative), _M_next(__next), _M_alt(__alt)
239 #ifdef _GLIBCXX_DEBUG
274 typedef unsigned int _SizeT;
278 : _M_flags(__f), _M_start_state(0), _M_subexpr_count(0)
290 {
return _M_start_state; }
293 _M_final_states()
const
294 {
return _M_accepting_states; }
298 {
return _M_subexpr_count; }
305 return this->
size()-1;
312 return this->
size()-1;
319 return this->
size()-1;
323 _M_insert_subexpr_begin(
const _Tagger& __t)
327 return this->
size()-1;
331 _M_insert_subexpr_end(
unsigned int __i,
const _Tagger& __t)
334 return this->
size()-1;
337 #ifdef _GLIBCXX_DEBUG
346 _SizeT _M_subexpr_count;
357 : _M_nfa(__ss), _M_start(__s), _M_end1(__s), _M_end2(__e)
361 : _M_nfa(__e1._M_nfa),
362 _M_start(_M_nfa._M_insert_alt(__e1._M_start, __e2._M_start)),
363 _M_end1(__e1._M_end1), _M_end2(__e2._M_end1)
368 : _M_nfa(__e._M_nfa),
369 _M_start(_M_nfa._M_insert_alt(__id, __e._M_start)),
370 _M_end1(__id), _M_end2(__e._M_end1)
375 : _M_nfa(__rhs._M_nfa), _M_start(__rhs._M_start),
376 _M_end1(__rhs._M_end1), _M_end2(__rhs._M_end2)
410 _GLIBCXX_END_NAMESPACE_VERSION