diff options
author | theraven <theraven@FreeBSD.org> | 2013-07-10 16:28:24 +0000 |
---|---|---|
committer | theraven <theraven@FreeBSD.org> | 2013-07-10 16:28:24 +0000 |
commit | 214e4f8fe625ad54aac3b215909e0b994a5768ec (patch) | |
tree | f757844d307e5ebbf92ab857f2376cceb7807147 /contrib/libc++/include/regex | |
parent | c660176671bf640bee3fd09dbfa32ad187a9b942 (diff) | |
download | FreeBSD-src-214e4f8fe625ad54aac3b215909e0b994a5768ec.zip FreeBSD-src-214e4f8fe625ad54aac3b215909e0b994a5768ec.tar.gz |
Import new libcxxrt / libc++. This brings some bug fixes, including a potential race condition for static initialisers.
Diffstat (limited to 'contrib/libc++/include/regex')
-rw-r--r-- | contrib/libc++/include/regex | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/contrib/libc++/include/regex b/contrib/libc++/include/regex index d1afa54..312ca11 100644 --- a/contrib/libc++/include/regex +++ b/contrib/libc++/include/regex @@ -2843,6 +2843,15 @@ private: const basic_regex<_Cp, _Tp>& __e, regex_constants::match_flag_type __flags); + template <class _Iter, class _Ap, class _Cp, class _Tp> + friend + bool + regex_search(__wrap_iter<_Iter> __first, + __wrap_iter<_Iter> __last, + match_results<__wrap_iter<_Iter>, _Ap>& __m, + const basic_regex<_Cp, _Tp>& __e, + regex_constants::match_flag_type __flags); + template <class, class> friend class __lookahead; }; @@ -2921,7 +2930,7 @@ __lookahead<_CharT, _Traits>::__exec(__state& __s) const bool __matched = __exp_.__match_at_start_ecma(__s.__current_, __s.__last_, __m, __s.__flags_ | regex_constants::match_continuous, - true); + __s.__at_first_ && __s.__current_ == __s.__first_); if (__matched != __invert_) { __s.__do_ = __state::__accept_but_not_consume; @@ -3420,6 +3429,7 @@ basic_regex<_CharT, _Traits>::__parse_QUOTED_CHAR_ERE(_ForwardIterator __first, case '+': case '?': case '{': + case '}': __push_char(*__temp); __first = ++__temp; break; @@ -3903,7 +3913,7 @@ basic_regex<_CharT, _Traits>::__parse_awk_escape(_ForwardIterator __first, { __val = 8 * __val + *__first - '0'; if (++__first != __last && ('0' <= *__first && *__first <= '7')) - __val = 8 * __val + *__first - '0'; + __val = 8 * __val + *__first++ - '0'; } if (__str) *__str = _CharT(__val); @@ -4481,7 +4491,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first, ++__first; } #ifndef _LIBCPP_NO_EXCEPTIONS - else if (__str) + else throw regex_error(regex_constants::error_escape); #endif // _LIBCPP_NO_EXCEPTIONS break; @@ -5807,6 +5817,21 @@ regex_search(_BidirectionalIterator __first, _BidirectionalIterator __last, return __r; } +template <class _Iter, class _Allocator, class _CharT, class _Traits> +inline _LIBCPP_INLINE_VISIBILITY +bool +regex_search(__wrap_iter<_Iter> __first, + __wrap_iter<_Iter> __last, + match_results<__wrap_iter<_Iter>, _Allocator>& __m, + const basic_regex<_CharT, _Traits>& __e, + regex_constants::match_flag_type __flags = regex_constants::match_default) +{ + match_results<const _CharT*> __mc; + bool __r = __e.__search(__first.base(), __last.base(), __mc, __flags); + __m.__assign(__first, __last, __mc, __flags & regex_constants::__no_update_pos); + return __r; +} + template <class _Allocator, class _CharT, class _Traits> inline _LIBCPP_INLINE_VISIBILITY bool @@ -6044,7 +6069,7 @@ regex_iterator<_BidirectionalIterator, _CharT, _Traits>::operator++() { __flags_ |= regex_constants::__no_update_pos; _BidirectionalIterator __start = __match_[0].second; - if (__match_.length() == 0) + if (__match_.empty()) { if (__start == __end_) { |