34 #ifndef _GLIBCXX_REGEX_DFS_QUANTIFIERS_LIMIT 
   35 #define _GLIBCXX_REGEX_DFS_QUANTIFIERS_LIMIT 1 
   38 namespace std _GLIBCXX_VISIBILITY(default)
 
   42 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   50   template<
typename _BiIter, 
typename _Alloc,
 
   51        typename _CharT, 
typename _TraitsT,
 
   52        _RegexExecutorPolicy __policy,
 
   55     __regex_algo_impl(_BiIter                              __s,
 
   57               match_results<_BiIter, _Alloc>&      __m,
 
   58               const basic_regex<_CharT, _TraitsT>& __re,
 
   61       if (__re._M_automaton == 
nullptr)
 
   64       typename match_results<_BiIter, _Alloc>::_Base_type& __res = __m;
 
   65       __res.resize(__re._M_automaton->_M_sub_count() + 2);
 
   66       for (
auto& __it : __res)
 
   83       if (!__re._M_automaton->_M_has_backref
 
   84       && (__policy == _RegexExecutorPolicy::_S_alternate
 
   85           || __re._M_automaton->_M_quant_count
 
   86         > _GLIBCXX_REGEX_DFS_QUANTIFIERS_LIMIT))
 
   88       _Executor<_BiIter, _Alloc, _TraitsT, false>
 
   89         __executor(__s, __e, __m, __re, __flags);
 
   91         __ret = __executor._M_match();
 
   93         __ret = __executor._M_search();
 
   97       _Executor<_BiIter, _Alloc, _TraitsT, true>
 
   98         __executor(__s, __e, __m, __re, __flags);
 
  100         __ret = __executor._M_match();
 
  102         __ret = __executor._M_search();
 
  106       for (
auto __it : __res)
 
  108           __it.first = __it.second = __e;
 
  109       auto& __pre = __res[__res.size()-2];
 
  110       auto& __suf = __res[__res.size()-1];
 
  113           __pre.matched = 
false;
 
  116           __suf.matched = 
false;
 
  123           __pre.second = __res[0].first;
 
  124           __pre.matched = (__pre.first != __pre.second);
 
  125           __suf.first = __res[0].second;
 
  127           __suf.matched = (__suf.first != __suf.second);
 
  135 _GLIBCXX_END_NAMESPACE_VERSION
 
  138 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
  140   template<
typename _Ch_type>
 
  141   template<
typename _Fwd_iter>
 
  142     typename regex_traits<_Ch_type>::string_type
 
  147       const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale));
 
  149       static const char* __collatenames[] =
 
  242       "left-square-bracket",
 
  244       "right-square-bracket",
 
  274       "left-curly-bracket",
 
  276       "right-curly-bracket",
 
  310       __fctyp.narrow(__first, __last, 
'?', &*__s.begin());
 
  312       for (
unsigned int __i = 0; *__collatenames[__i]; __i++)
 
  313     if (__s == __collatenames[__i])
 
  314       return string_type(1, __fctyp.widen(static_cast<char>(__i)));
 
  326       return string_type();
 
  329   template<
typename _Ch_type>
 
  330   template<
typename _Fwd_iter>
 
  331     typename regex_traits<_Ch_type>::char_class_type
 
  337       typedef const pair<const char*, char_class_type> _ClassnameEntry;
 
  338       const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale));
 
  339       const __cctype_type& __cctyp(use_facet<__cctype_type>(_M_locale));
 
  341       static _ClassnameEntry __classnames[] =
 
  343     {
"d", ctype_base::digit},
 
  344     {
"w", {ctype_base::alnum, _RegexMask::_S_under}},
 
  345     {
"s", ctype_base::space},
 
  346     {
"alnum", ctype_base::alnum},
 
  347     {
"alpha", ctype_base::alpha},
 
  348     {
"blank", {0, _RegexMask::_S_blank}},
 
  349     {
"cntrl", ctype_base::cntrl},
 
  350     {
"digit", ctype_base::digit},
 
  351     {
"graph", ctype_base::graph},
 
  352     {
"lower", ctype_base::lower},
 
  353     {
"print", ctype_base::print},
 
  354     {
"punct", ctype_base::punct},
 
  355     {
"space", ctype_base::space},
 
  356     {
"upper", ctype_base::upper},
 
  357     {
"xdigit", ctype_base::xdigit},
 
  361       __fctyp.narrow(__first, __last, 
'?', &__s[0]);
 
  362       __cctyp.tolower(&*__s.begin(), &*__s.begin() + __s.size());
 
  363       for (_ClassnameEntry* __it = __classnames;
 
  364        __it < *(&__classnames + 1);
 
  367       if (__s == __it->first)
 
  371                & (ctype_base::lower | ctype_base::upper)) != 0))
 
  372         return ctype_base::alpha;
 
  379   template<
typename _Ch_type>
 
  382     isctype(_Ch_type __c, char_class_type __f)
 const 
  385       const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale));
 
  387       return __fctyp.is(__f._M_base, __c)
 
  389     || ((__f._M_extended & _RegexMask::_S_under)
 
  390         && __c == __fctyp.widen(
'_'))
 
  392     || ((__f._M_extended & _RegexMask::_S_blank)
 
  393         && (__c == __fctyp.widen(
' ')
 
  394         || __c == __fctyp.widen(
'\t')));
 
  397   template<
typename _Ch_type>
 
  400     value(_Ch_type __ch, 
int __radix)
 const 
  406       else if (__radix == 16)
 
  409       return __is.
fail() ? -1 : __v;
 
  412   template<
typename _Bi_iter, 
typename _Alloc>
 
  413   template<
typename _Out_iter>
 
  416        const match_results<_Bi_iter, _Alloc>::char_type* __fmt_first,
 
  417        const match_results<_Bi_iter, _Alloc>::char_type* __fmt_last,
 
  420       _GLIBCXX_DEBUG_ASSERT( ready() );
 
  424     __fctyp(use_facet<__ctype_type>(__traits.
getloc()));
 
  426       auto __output = [&](
size_t __idx)
 
  430         std::copy(__sub.first, __sub.second, __out);
 
  435       for (; __fmt_first != __fmt_last;)
 
  436         if (*__fmt_first == 
'&')
 
  441         else if (*__fmt_first == 
'\\')
 
  443         if (++__fmt_first != __fmt_last
 
  444             && __fctyp.is(__ctype_type::digit, *__fmt_first))
 
  445           __output(__traits.
value(*__fmt_first++, 10));
 
  450           *__out++ = *__fmt_first++;
 
  456           auto __next = std::find(__fmt_first, __fmt_last, 
'$');
 
  457           if (__next == __fmt_last)
 
  460           std::copy(__fmt_first, __next, __out);
 
  462           auto __eat = [&](
char __ch) -> 
bool 
  472           if (++__next == __fmt_last)
 
  480           else if (__eat(
'\''))
 
  482           else if (__fctyp.is(__ctype_type::digit, *__next))
 
  484           long __num = __traits.
value(*__next, 10);
 
  485           if (++__next != __fmt_last
 
  486               && __fctyp.is(__ctype_type::digit, *__next))
 
  489               __num += __traits.
value(*__next++, 10);
 
  491           if (0 <= __num && __num < this->
size())
 
  496           __fmt_first = __next;
 
  498       std::copy(__fmt_first, __fmt_last, __out);
 
  503   template<
typename _Out_iter, 
typename _Bi_iter,
 
  504        typename _Rx_traits, 
typename _Ch_type>
 
  508           const _Ch_type* __fmt,
 
  512       _IterT __i(__first, __last, __e, __flags);
 
  517         std::copy(__first, __last, __out);
 
  523       for (; __i != __end; ++__i)
 
  526         std::copy(__i->prefix().first, __i->prefix().second, __out);
 
  527           __out = __i->format(__out, __fmt, __fmt + __len, __flags);
 
  528           __last = __i->suffix();
 
  538   template<
typename _Bi_iter,
 
  545       return (_M_match.empty() && __rhs._M_match.
empty())
 
  546     || (_M_begin == __rhs._M_begin
 
  547         && _M_end == __rhs._M_end
 
  548         && _M_pregex == __rhs._M_pregex
 
  549         && _M_flags == __rhs._M_flags
 
  550         && _M_match[0] == __rhs._M_match[0]);
 
  553   template<
typename _Bi_iter,
 
  566       if (_M_match[0].matched)
 
  568       auto __start = _M_match[0].second;
 
  569       auto __prefix_first = _M_match[0].second;
 
  570       if (_M_match[0].first == _M_match[0].second)
 
  572           if (__start == _M_end)
 
  584               _GLIBCXX_DEBUG_ASSERT(_M_match[0].matched);
 
  585               _M_match.at(_M_match.size()).first = __prefix_first;
 
  586               _M_match._M_in_iterator = 
true;
 
  587               _M_match._M_begin = _M_begin;
 
  595       if (
regex_search(__start, _M_end, _M_match, *_M_pregex, _M_flags))
 
  597           _GLIBCXX_DEBUG_ASSERT(_M_match[0].matched);
 
  598           _M_match.at(_M_match.size()).first = __prefix_first;
 
  599           _M_match._M_in_iterator = 
true;
 
  600           _M_match._M_begin = _M_begin;
 
  608   template<
typename _Bi_iter,
 
  615       _M_position = __rhs._M_position;
 
  616       _M_subs = __rhs._M_subs;
 
  618       _M_result = __rhs._M_result;
 
  619       _M_suffix = __rhs._M_suffix;
 
  620       _M_has_m1 = __rhs._M_has_m1;
 
  621       if (__rhs._M_result == &__rhs._M_suffix)
 
  622     _M_result = &_M_suffix;
 
  626   template<
typename _Bi_iter,
 
  633       if (_M_end_of_seq() && __rhs._M_end_of_seq())
 
  635       if (_M_suffix.matched && __rhs._M_suffix.matched
 
  636       && _M_suffix == __rhs._M_suffix)
 
  638       if (_M_end_of_seq() || _M_suffix.matched
 
  639       || __rhs._M_end_of_seq() || __rhs._M_suffix.matched)
 
  641       return _M_position == __rhs._M_position
 
  642     && _M_n == __rhs._M_n
 
  643     && _M_subs == __rhs._M_subs;
 
  646   template<
typename _Bi_iter,
 
  653       _Position __prev = _M_position;
 
  654       if (_M_suffix.matched)
 
  656       else if (_M_n + 1 < _M_subs.size())
 
  659       _M_result = &_M_current_match();
 
  665       if (_M_position != _Position())
 
  666         _M_result = &_M_current_match();
 
  667       else if (_M_has_m1 && __prev->suffix().length() != 0)
 
  669           _M_suffix.matched = 
true;
 
  670           _M_suffix.first = __prev->suffix().first;
 
  671           _M_suffix.second = __prev->suffix().second;
 
  672           _M_result = &_M_suffix;
 
  680   template<
typename _Bi_iter,
 
  685     _M_init(_Bi_iter __a, _Bi_iter __b)
 
  688       for (
auto __it : _M_subs)
 
  694       if (_M_position != _Position())
 
  695     _M_result = &_M_current_match();
 
  698       _M_suffix.matched = 
true;
 
  699       _M_suffix.first = __a;
 
  700       _M_suffix.second = __b;
 
  701       _M_result = &_M_suffix;
 
  707 _GLIBCXX_END_NAMESPACE_VERSION
 
_Out_iter regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last, const basic_regex< _Ch_type, _Rx_traits > &__e, const basic_string< _Ch_type, _St, _Sa > &__fmt, regex_constants::match_flag_type __flags=regex_constants::match_default)
Search for a regular expression within a range for multiple times, and replace the matched parts thro...
 
_T2 second
first is a copy of the first object 
 
regex_token_iterator & operator=(const regex_token_iterator &__rhs)
Assigns a regex_token_iterator to another. 
 
match_flag_type
This is a bitmask type indicating regex matching rules. 
 
ios_base & oct(ios_base &__base)
Calls base.setf(ios_base::oct, ios_base::basefield). 
 
bool regex_search(_Bi_iter __s, _Bi_iter __e, match_results< _Bi_iter, _Alloc > &__m, const basic_regex< _Ch_type, _Rx_traits > &__re, regex_constants::match_flag_type __flags=regex_constants::match_default)
 
bool fail() const 
Fast error checking. 
 
_T1 first
second_type is the second bound type 
 
constexpr size_t size() const noexcept
Returns the total number of bits. 
 
regex_token_iterator & operator++()
Increments a regex_token_iterator. 
 
bool isctype(_Ch_type __c, char_class_type __f) const 
Determines if c is a member of an identified class. 
 
bool operator==(const regex_token_iterator &__rhs) const 
Compares a regex_token_iterator to another for equality. 
 
bool empty() const 
Indicates if the match_results contains no results. 
 
char_class_type lookup_classname(_Fwd_iter __first, _Fwd_iter __last, bool __icase=false) const 
Maps one or more characters to a named character classification. 
 
Class regex_traits. Describes aspects of a regular expression. 
 
string_type lookup_collatename(_Fwd_iter __first, _Fwd_iter __last) const 
Gets a collation element by name. 
 
The ctype<char> specialization.This class defines classification and conversion functions for the cha...
 
Basis for explicit traits specializations. 
 
locale_type getloc() const 
Gets a copy of the current locale in use by the regex_traits object. 
 
ios_base & hex(ios_base &__base)
Calls base.setf(ios_base::hex, ios_base::basefield). 
 
_Out_iter format(_Out_iter __out, const char_type *__fmt_first, const char_type *__fmt_last, match_flag_type __flags=regex_constants::format_default) const 
 
regex_iterator & operator++()
Increments a regex_iterator. 
 
int value(_Ch_type __ch, int __radix) const 
Converts a digit to an int. 
 
Controlling input for std::string. 
 
bool operator==(const regex_iterator &__rhs) const 
Tests the equivalence of two regex iterators. 
 
reference operator[](size_t __position)
Array-indexing support.