diff options
Diffstat (limited to 'system/include/libcxx/regex')
-rw-r--r-- | system/include/libcxx/regex | 172 |
1 files changed, 97 insertions, 75 deletions
diff --git a/system/include/libcxx/regex b/system/include/libcxx/regex index 5e195696..982500f3 100644 --- a/system/include/libcxx/regex +++ b/system/include/libcxx/regex @@ -147,7 +147,7 @@ public: explicit basic_regex(const charT* p, flag_type f = regex_constants::ECMAScript); basic_regex(const charT* p, size_t len, flag_type f); basic_regex(const basic_regex&); - basic_regex(basic_regex&&); + basic_regex(basic_regex&&) noexcept; template <class ST, class SA> explicit basic_regex(const basic_string<charT, ST, SA>& p, flag_type f = regex_constants::ECMAScript); @@ -159,7 +159,7 @@ public: ~basic_regex(); basic_regex& operator=(const basic_regex&); - basic_regex& operator=(basic_regex&&); + basic_regex& operator=(basic_regex&&) noexcept; basic_regex& operator=(const charT* ptr); basic_regex& operator=(initializer_list<charT> il); template <class ST, class SA> @@ -167,7 +167,7 @@ public: // assign: basic_regex& assign(const basic_regex& that); - basic_regex& assign(basic_regex&& that); + basic_regex& assign(basic_regex&& that) noexcept; basic_regex& assign(const charT* ptr, flag_type f = regex_constants::ECMAScript); basic_regex& assign(const charT* p, size_t len, flag_type f); template <class string_traits, class A> @@ -449,7 +449,7 @@ public: // construct/copy/destroy: explicit match_results(const Allocator& a = Allocator()); match_results(const match_results& m); - match_results(match_results&& m); + match_results(match_results&& m) noexcept; match_results& operator=(const match_results& m); match_results& operator=(match_results&& m); ~match_results(); @@ -732,7 +732,11 @@ typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator; #include <vector> #include <deque> +#include <__undef_min_max> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header +#endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -756,7 +760,7 @@ enum syntax_option_type }; inline _LIBCPP_INLINE_VISIBILITY -/*constexpr*/ +_LIBCPP_CONSTEXPR syntax_option_type operator~(syntax_option_type __x) { @@ -764,7 +768,7 @@ operator~(syntax_option_type __x) } inline _LIBCPP_INLINE_VISIBILITY -/*constexpr*/ +_LIBCPP_CONSTEXPR syntax_option_type operator&(syntax_option_type __x, syntax_option_type __y) { @@ -772,7 +776,7 @@ operator&(syntax_option_type __x, syntax_option_type __y) } inline _LIBCPP_INLINE_VISIBILITY -/*constexpr*/ +_LIBCPP_CONSTEXPR syntax_option_type operator|(syntax_option_type __x, syntax_option_type __y) { @@ -780,7 +784,7 @@ operator|(syntax_option_type __x, syntax_option_type __y) } inline _LIBCPP_INLINE_VISIBILITY -/*constexpr*/ +_LIBCPP_CONSTEXPR syntax_option_type operator^(syntax_option_type __x, syntax_option_type __y) { @@ -788,7 +792,6 @@ operator^(syntax_option_type __x, syntax_option_type __y) } inline _LIBCPP_INLINE_VISIBILITY -/*constexpr*/ syntax_option_type& operator&=(syntax_option_type& __x, syntax_option_type __y) { @@ -797,7 +800,6 @@ operator&=(syntax_option_type& __x, syntax_option_type __y) } inline _LIBCPP_INLINE_VISIBILITY -/*constexpr*/ syntax_option_type& operator|=(syntax_option_type& __x, syntax_option_type __y) { @@ -806,7 +808,6 @@ operator|=(syntax_option_type& __x, syntax_option_type __y) } inline _LIBCPP_INLINE_VISIBILITY -/*constexpr*/ syntax_option_type& operator^=(syntax_option_type& __x, syntax_option_type __y) { @@ -835,7 +836,7 @@ enum match_flag_type }; inline _LIBCPP_INLINE_VISIBILITY -/*constexpr*/ +_LIBCPP_CONSTEXPR match_flag_type operator~(match_flag_type __x) { @@ -843,7 +844,7 @@ operator~(match_flag_type __x) } inline _LIBCPP_INLINE_VISIBILITY -/*constexpr*/ +_LIBCPP_CONSTEXPR match_flag_type operator&(match_flag_type __x, match_flag_type __y) { @@ -851,7 +852,7 @@ operator&(match_flag_type __x, match_flag_type __y) } inline _LIBCPP_INLINE_VISIBILITY -/*constexpr*/ +_LIBCPP_CONSTEXPR match_flag_type operator|(match_flag_type __x, match_flag_type __y) { @@ -859,7 +860,7 @@ operator|(match_flag_type __x, match_flag_type __y) } inline _LIBCPP_INLINE_VISIBILITY -/*constexpr*/ +_LIBCPP_CONSTEXPR match_flag_type operator^(match_flag_type __x, match_flag_type __y) { @@ -867,7 +868,6 @@ operator^(match_flag_type __x, match_flag_type __y) } inline _LIBCPP_INLINE_VISIBILITY -/*constexpr*/ match_flag_type& operator&=(match_flag_type& __x, match_flag_type __y) { @@ -876,7 +876,6 @@ operator&=(match_flag_type& __x, match_flag_type __y) } inline _LIBCPP_INLINE_VISIBILITY -/*constexpr*/ match_flag_type& operator|=(match_flag_type& __x, match_flag_type __y) { @@ -885,7 +884,6 @@ operator|=(match_flag_type& __x, match_flag_type __y) } inline _LIBCPP_INLINE_VISIBILITY -/*constexpr*/ match_flag_type& operator^=(match_flag_type& __x, match_flag_type __y) { @@ -1233,11 +1231,11 @@ regex_traits<_CharT>::__value(wchar_t __ch, int __radix) const template <class _CharT> class __node; -template <class _BidirectionalIterator> class sub_match; +template <class _BidirectionalIterator> class _LIBCPP_VISIBLE sub_match; template <class _BidirectionalIterator, class _Allocator = allocator<sub_match<_BidirectionalIterator> > > -class match_results; +class _LIBCPP_VISIBLE match_results; template <class _CharT> struct __state @@ -2435,16 +2433,16 @@ private: public: // constants: - static const/*expr*/ regex_constants::syntax_option_type icase = regex_constants::icase; - static const/*expr*/ regex_constants::syntax_option_type nosubs = regex_constants::nosubs; - static const/*expr*/ regex_constants::syntax_option_type optimize = regex_constants::optimize; - static const/*expr*/ regex_constants::syntax_option_type collate = regex_constants::collate; - static const/*expr*/ regex_constants::syntax_option_type ECMAScript = regex_constants::ECMAScript; - static const/*expr*/ regex_constants::syntax_option_type basic = regex_constants::basic; - static const/*expr*/ regex_constants::syntax_option_type extended = regex_constants::extended; - static const/*expr*/ regex_constants::syntax_option_type awk = regex_constants::awk; - static const/*expr*/ regex_constants::syntax_option_type grep = regex_constants::grep; - static const/*expr*/ regex_constants::syntax_option_type egrep = regex_constants::egrep; + static const regex_constants::syntax_option_type icase = regex_constants::icase; + static const regex_constants::syntax_option_type nosubs = regex_constants::nosubs; + static const regex_constants::syntax_option_type optimize = regex_constants::optimize; + static const regex_constants::syntax_option_type collate = regex_constants::collate; + static const regex_constants::syntax_option_type ECMAScript = regex_constants::ECMAScript; + static const regex_constants::syntax_option_type basic = regex_constants::basic; + static const regex_constants::syntax_option_type extended = regex_constants::extended; + static const regex_constants::syntax_option_type awk = regex_constants::awk; + static const regex_constants::syntax_option_type grep = regex_constants::grep; + static const regex_constants::syntax_option_type egrep = regex_constants::egrep; // construct/copy/destroy: _LIBCPP_INLINE_VISIBILITY @@ -2508,6 +2506,11 @@ public: _LIBCPP_INLINE_VISIBILITY basic_regex& assign(const basic_regex& __that) {return *this = __that;} +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + _LIBCPP_INLINE_VISIBILITY + basic_regex& assign(basic_regex&& __that) _NOEXCEPT + {return *this = _VSTD::move(__that);} +#endif _LIBCPP_INLINE_VISIBILITY basic_regex& assign(const value_type* __p, flag_type __f = regex_constants::ECMAScript) {return assign(__p, __p + __traits_.length(__p), __f);} @@ -2559,6 +2562,7 @@ public: { __member_init(__f); __parse(__first, __last); + return *this; } #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS @@ -2790,55 +2794,76 @@ private: match_results<const _CharT*, _Allocator>& __m, regex_constants::match_flag_type __flags, bool) const; - template <class _B, class _A, class _C, class _T> + template <class _Bp, class _Ap, class _Cp, class _Tp> friend bool - regex_search(_B, _B, match_results<_B, _A>&, const basic_regex<_C, _T>&, + regex_search(_Bp, _Bp, match_results<_Bp, _Ap>&, const basic_regex<_Cp, _Tp>&, regex_constants::match_flag_type); - template <class _A, class _C, class _T> + template <class _Ap, class _Cp, class _Tp> friend bool - regex_search(const _C*, const _C*, match_results<const _C*, _A>&, - const basic_regex<_C, _T>&, regex_constants::match_flag_type); + regex_search(const _Cp*, const _Cp*, match_results<const _Cp*, _Ap>&, + const basic_regex<_Cp, _Tp>&, regex_constants::match_flag_type); - template <class _B, class _C, class _T> + template <class _Bp, class _Cp, class _Tp> friend bool - regex_search(_B, _B, const basic_regex<_C, _T>&, + regex_search(_Bp, _Bp, const basic_regex<_Cp, _Tp>&, regex_constants::match_flag_type); - template <class _C, class _T> + template <class _Cp, class _Tp> friend bool - regex_search(const _C*, const _C*, - const basic_regex<_C, _T>&, regex_constants::match_flag_type); + regex_search(const _Cp*, const _Cp*, + const basic_regex<_Cp, _Tp>&, regex_constants::match_flag_type); - template <class _C, class _A, class _T> + template <class _Cp, class _Ap, class _Tp> friend bool - regex_search(const _C*, match_results<const _C*, _A>&, const basic_regex<_C, _T>&, + regex_search(const _Cp*, match_results<const _Cp*, _Ap>&, const basic_regex<_Cp, _Tp>&, regex_constants::match_flag_type); - template <class _ST, class _SA, class _C, class _T> + template <class _ST, class _SA, class _Cp, class _Tp> friend bool - regex_search(const basic_string<_C, _ST, _SA>& __s, - const basic_regex<_C, _T>& __e, + regex_search(const basic_string<_Cp, _ST, _SA>& __s, + const basic_regex<_Cp, _Tp>& __e, regex_constants::match_flag_type __flags); - template <class _ST, class _SA, class _A, class _C, class _T> + template <class _ST, class _SA, class _Ap, class _Cp, class _Tp> friend bool - regex_search(const basic_string<_C, _ST, _SA>& __s, - match_results<typename basic_string<_C, _ST, _SA>::const_iterator, _A>&, - const basic_regex<_C, _T>& __e, + regex_search(const basic_string<_Cp, _ST, _SA>& __s, + match_results<typename basic_string<_Cp, _ST, _SA>::const_iterator, _Ap>&, + const basic_regex<_Cp, _Tp>& __e, regex_constants::match_flag_type __flags); template <class, class> friend class __lookahead; }; template <class _CharT, class _Traits> + const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::icase; +template <class _CharT, class _Traits> + const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::nosubs; +template <class _CharT, class _Traits> + const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::optimize; +template <class _CharT, class _Traits> + const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::collate; +template <class _CharT, class _Traits> + const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::ECMAScript; +template <class _CharT, class _Traits> + const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::basic; +template <class _CharT, class _Traits> + const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::extended; +template <class _CharT, class _Traits> + const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::awk; +template <class _CharT, class _Traits> + const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::grep; +template <class _CharT, class _Traits> + const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::egrep; + +template <class _CharT, class _Traits> void basic_regex<_CharT, _Traits>::swap(basic_regex& __r) { @@ -4400,7 +4425,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first, if (__hd == -1) throw regex_error(regex_constants::error_escape); #endif // _LIBCPP_NO_EXCEPTIONS - __sum = 16 * __sum + __hd; + __sum = 16 * __sum + static_cast<unsigned>(__hd); ++__first; #ifndef _LIBCPP_NO_EXCEPTIONS if (__first == __last) @@ -4411,7 +4436,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first, if (__hd == -1) throw regex_error(regex_constants::error_escape); #endif // _LIBCPP_NO_EXCEPTIONS - __sum = 16 * __sum + __hd; + __sum = 16 * __sum + static_cast<unsigned>(__hd); // drop through case 'x': ++__first; @@ -4424,7 +4449,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first, if (__hd == -1) throw regex_error(regex_constants::error_escape); #endif // _LIBCPP_NO_EXCEPTIONS - __sum = 16 * __sum + __hd; + __sum = 16 * __sum + static_cast<unsigned>(__hd); ++__first; #ifndef _LIBCPP_NO_EXCEPTIONS if (__first == __last) @@ -4435,7 +4460,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first, if (__hd == -1) throw regex_error(regex_constants::error_escape); #endif // _LIBCPP_NO_EXCEPTIONS - __sum = 16 * __sum + __hd; + __sum = 16 * __sum + static_cast<unsigned>(__hd); if (__str) *__str = _CharT(__sum); else @@ -4736,7 +4761,7 @@ public: bool matched; _LIBCPP_INLINE_VISIBILITY - /*constexpr*/ sub_match() : matched() {} + _LIBCPP_CONSTEXPR sub_match() : matched() {} _LIBCPP_INLINE_VISIBILITY difference_type length() const @@ -5210,11 +5235,11 @@ public: const_reference suffix() const {return __suffix_;} _LIBCPP_INLINE_VISIBILITY - const_iterator begin() const {return empty() ? __matches_.end() : __matches_.begin() + 1;} + const_iterator begin() const {return empty() ? __matches_.end() : __matches_.begin();} _LIBCPP_INLINE_VISIBILITY const_iterator end() const {return __matches_.end();} _LIBCPP_INLINE_VISIBILITY - const_iterator cbegin() const {return empty() ? __matches_.end() : __matches_.begin() + 1;} + const_iterator cbegin() const {return empty() ? __matches_.end() : __matches_.begin();} _LIBCPP_INLINE_VISIBILITY const_iterator cend() const {return __matches_.end();} @@ -5259,12 +5284,12 @@ public: // swap: void swap(match_results& __m); - template <class _B, class _A> + template <class _Bp, class _Ap> _LIBCPP_INLINE_VISIBILITY void __assign(_BidirectionalIterator __f, _BidirectionalIterator __l, - const match_results<_B, _A>& __m, bool __no_update_pos) + const match_results<_Bp, _Ap>& __m, bool __no_update_pos) { - _B __mf = __m.prefix().first; + _Bp __mf = __m.prefix().first; __matches_.resize(__m.size()); for (size_type __i = 0; __i < __matches_.size(); ++__i) { @@ -5293,16 +5318,16 @@ private: template <class, class> friend class basic_regex; - template <class _B, class _A, class _C, class _T> + template <class _Bp, class _Ap, class _Cp, class _Tp> friend bool - regex_match(_B, _B, match_results<_B, _A>&, const basic_regex<_C, _T>&, + regex_match(_Bp, _Bp, match_results<_Bp, _Ap>&, const basic_regex<_Cp, _Tp>&, regex_constants::match_flag_type); - template <class _B, class _A> + template <class _Bp, class _Ap> friend bool - operator==(const match_results<_B, _A>&, const match_results<_B, _A>&); + operator==(const match_results<_Bp, _Ap>&, const match_results<_Bp, _Ap>&); template <class, class> friend class __lookahead; }; @@ -5492,8 +5517,6 @@ basic_regex<_CharT, _Traits>::__match_at_start_ecma( regex_constants::match_flag_type __flags, bool __at_first) const { vector<__state> __states; - ptrdiff_t __j = 0; - ptrdiff_t _N = _VSTD::distance(__first, __last); __node* __st = __start_.get(); if (__st) { @@ -5507,7 +5530,6 @@ basic_regex<_CharT, _Traits>::__match_at_start_ecma( __states.back().__node_ = __st; __states.back().__flags_ = __flags; __states.back().__at_first_ = __at_first; - bool __matched = false; do { __state& __s = __states.back(); @@ -5559,7 +5581,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_nosubs( { deque<__state> __states; ptrdiff_t __highest_j = 0; - ptrdiff_t _N = _VSTD::distance(__first, __last); + ptrdiff_t _Np = _VSTD::distance(__first, __last); __node* __st = __start_.get(); if (__st) { @@ -5584,7 +5606,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_nosubs( if (!__matched || __highest_j < __s.__current_ - __s.__first_) __highest_j = __s.__current_ - __s.__first_; __matched = true; - if (__highest_j == _N) + if (__highest_j == _Np) __states.clear(); else __states.pop_back(); @@ -5639,7 +5661,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_subs( __state __best_state; ptrdiff_t __j = 0; ptrdiff_t __highest_j = 0; - ptrdiff_t _N = _VSTD::distance(__first, __last); + ptrdiff_t _Np = _VSTD::distance(__first, __last); __node* __st = __start_.get(); if (__st) { @@ -5669,7 +5691,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_subs( __best_state = __s; } __matched = true; - if (__highest_j == _N) + if (__highest_j == _Np) __states.clear(); else __states.pop_back(); @@ -6084,11 +6106,11 @@ public: regex_constants::match_flag_type __m = regex_constants::match_default); #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - template <size_t _N> + template <size_t _Np> regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b, const regex_type& __re, - const int (&__submatches)[_N], + const int (&__submatches)[_Np], regex_constants::match_flag_type __m = regex_constants::match_default); regex_token_iterator(const regex_token_iterator&); @@ -6190,15 +6212,15 @@ regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>:: #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template <class _BidirectionalIterator, class _CharT, class _Traits> -template <size_t _N> +template <size_t _Np> regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>:: regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b, const regex_type& __re, - const int (&__submatches)[_N], + const int (&__submatches)[_Np], regex_constants::match_flag_type __m) : __position_(__a, __b, __re, __m), _N_(0), - __subs_(__submatches, __submatches + _N) + __subs_(__submatches, __submatches + _Np) { __init(__a, __b); } |