[cfe-commits] [libcxx] r106187 - in /libcxx/trunk: include/ src/ test/re/ test/re/re.badexp/ test/re/re.const/ test/re/re.const/re.err/ test/re/re.const/re.matchflag/ test/re/re.const/re.synopt/ test/re/re.def/ test/re/re.def/defns.regex.collating.element/ test/re/re.def/defns.regex.finite.state.machine/ test/re/re.def/defns.regex.format.specifier/ test/re/re.def/defns.regex.matched/ test/re/re.def/defns.regex.primary.equivalence.class/ test/re/re.def/defns.regex.regular.expression/ test/re/re.def/defns.regex.subexpre...
Howard Hinnant
hhinnant at apple.com
Wed Jun 16 17:34:59 PDT 2010
Author: hhinnant
Date: Wed Jun 16 19:34:59 2010
New Revision: 106187
URL: http://llvm.org/viewvc/llvm-project?rev=106187&view=rev
Log:
Just getting our toes wet on <regex>
Added:
libcxx/trunk/include/regex
libcxx/trunk/src/regex.cpp
libcxx/trunk/test/re/nothing_to_do.pass.cpp
libcxx/trunk/test/re/re.badexp/regex_error.pass.cpp
libcxx/trunk/test/re/re.const/nothing_to_do.pass.cpp
libcxx/trunk/test/re/re.const/re.err/error_type.pass.cpp
libcxx/trunk/test/re/re.const/re.matchflag/match_flag_type.pass.cpp
libcxx/trunk/test/re/re.const/re.synopt/syntax_option_type.pass.cpp
libcxx/trunk/test/re/re.def/defns.regex.collating.element/nothing_to_do.pass.cpp
libcxx/trunk/test/re/re.def/defns.regex.finite.state.machine/nothing_to_do.pass.cpp
libcxx/trunk/test/re/re.def/defns.regex.format.specifier/nothing_to_do.pass.cpp
libcxx/trunk/test/re/re.def/defns.regex.matched/nothing_to_do.pass.cpp
libcxx/trunk/test/re/re.def/defns.regex.primary.equivalence.class/nothing_to_do.pass.cpp
libcxx/trunk/test/re/re.def/defns.regex.regular.expression/nothing_to_do.pass.cpp
libcxx/trunk/test/re/re.def/defns.regex.subexpression/nothing_to_do.pass.cpp
libcxx/trunk/test/re/re.def/nothing_to_do.pass.cpp
libcxx/trunk/test/re/re.general/nothing_to_do.pass.cpp
libcxx/trunk/test/re/re.req/nothing_to_do.pass.cpp
libcxx/trunk/test/re/re.traits/default.pass.cpp
libcxx/trunk/test/re/re.traits/getloc.pass.cpp
libcxx/trunk/test/re/re.traits/imbue.pass.cpp
libcxx/trunk/test/re/re.traits/isctype.pass.cpp
libcxx/trunk/test/re/re.traits/iterators.h
libcxx/trunk/test/re/re.traits/length.pass.cpp
libcxx/trunk/test/re/re.traits/lookup_classname.pass.cpp
libcxx/trunk/test/re/re.traits/lookup_collatename.pass.cpp
libcxx/trunk/test/re/re.traits/transform.pass.cpp
libcxx/trunk/test/re/re.traits/transform_primary.pass.cpp
libcxx/trunk/test/re/re.traits/translate.pass.cpp
libcxx/trunk/test/re/re.traits/translate_nocase.pass.cpp
libcxx/trunk/test/re/re.traits/types.pass.cpp
libcxx/trunk/test/re/re.traits/value.pass.cpp
Added: libcxx/trunk/include/regex
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/regex?rev=106187&view=auto
==============================================================================
--- libcxx/trunk/include/regex (added)
+++ libcxx/trunk/include/regex Wed Jun 16 19:34:59 2010
@@ -0,0 +1,1121 @@
+// -*- C++ -*-
+//===--------------------------- regex ------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_REGEX
+#define _LIBCPP_REGEX
+
+/*
+ regex synopsis
+
+#include <initializer_list>
+
+namespace std
+{
+
+namespace regex_constants
+{
+
+emum syntax_option_type
+{
+ icase = unspecified,
+ nosubs = unspecified,
+ optimize = unspecified,
+ collate = unspecified,
+ ECMAScript = unspecified,
+ basic = unspecified,
+ extended = unspecified,
+ awk = unspecified,
+ grep = unspecified,
+ egrep = unspecified
+};
+
+constexpr syntax_option_type operator~(syntax_option_type f);
+constexpr syntax_option_type operator&(syntax_option_type lhs, syntax_option_type rhs);
+constexpr syntax_option_type operator|(syntax_option_type lhs, syntax_option_type rhs);
+
+enum match_flag_type
+{
+ match_default = 0,
+ match_not_bol = unspecified,
+ match_not_eol = unspecified,
+ match_not_bow = unspecified,
+ match_not_eow = unspecified,
+ match_any = unspecified,
+ match_not_null = unspecified,
+ match_continuous = unspecified,
+ match_prev_avail = unspecified,
+ format_default = 0,
+ format_sed = unspecified,
+ format_no_copy = unspecified,
+ format_first_only = unspecified
+};
+
+constexpr match_flag_type operator~(match_flag_type f);
+constexpr match_flag_type operator&(match_flag_type lhs, match_flag_type rhs);
+constexpr match_flag_type operator|(match_flag_type lhs, match_flag_type rhs);
+
+enum error_type
+{
+ error_collate = unspecified,
+ error_ctype = unspecified,
+ error_escape = unspecified,
+ error_backref = unspecified,
+ error_brack = unspecified,
+ error_paren = unspecified,
+ error_brace = unspecified,
+ error_badbrace = unspecified,
+ error_range = unspecified,
+ error_space = unspecified,
+ error_badrepeat = unspecified,
+ error_complexity = unspecified,
+ error_stack = unspecified
+};
+
+} // regex_constants
+
+class regex_error
+ : public runtime_error
+{
+public:
+ explicit regex_error(regex_constants::error_type ecode);
+ regex_constants::error_type code() const;
+};
+
+template <class charT>
+struct regex_traits
+{
+public:
+ typedef charT char_type;
+ typedef basic_string<char_type> string_type;
+ typedef locale locale_type;
+ typedef /bitmask_type/ char_class_type;
+
+ regex_traits();
+
+ static size_t length(const char_type* p);
+ charT translate(charT c) const;
+ charT translate_nocase(charT c) const;
+ template <class ForwardIterator>
+ string_type
+ transform(ForwardIterator first, ForwardIterator last) const;
+ template <class ForwardIterator>
+ string_type
+ transform_primary( ForwardIterator first, ForwardIterator last) const;
+ template <class ForwardIterator>
+ string_type
+ lookup_collatename(ForwardIterator first, ForwardIterator last) const;
+ template <class ForwardIterator>
+ char_class_type
+ lookup_classname(ForwardIterator first, ForwardIterator last,
+ bool icase = false) const;
+ bool isctype(charT c, char_class_type f) const;
+ int value(charT ch, int radix) const;
+ locale_type imbue(locale_type l);
+ locale_type getloc()const;
+};
+
+template <class charT, class traits = regex_traits<charT>>
+class basic_regex
+{
+public:
+ // types:
+ typedef charT value_type;
+ typedef regex_constants::syntax_option_type flag_type;
+ typedef typename traits::locale_type locale_type;
+
+ // constants:
+ static constexpr regex_constants::syntax_option_type icase = regex_constants::icase;
+ static constexpr regex_constants::syntax_option_type nosubs = regex_constants::nosubs;
+ static constexpr regex_constants::syntax_option_type optimize = regex_constants::optimize;
+ static constexpr regex_constants::syntax_option_type collate = regex_constants::collate;
+ static constexpr regex_constants::syntax_option_type ECMAScript = regex_constants::ECMAScript;
+ static constexpr regex_constants::syntax_option_type basic = regex_constants::basic;
+ static constexpr regex_constants::syntax_option_type extended = regex_constants::extended;
+ static constexpr regex_constants::syntax_option_type awk = regex_constants::awk;
+ static constexpr regex_constants::syntax_option_type grep = regex_constants::grep;
+ static constexpr regex_constants::syntax_option_type egrep = regex_constants::egrep;
+
+ // construct/copy/destroy:
+ basic_regex();
+ 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&&);
+ template <class ST, class SA>
+ explicit basic_regex(const basic_string<charT, ST, SA>& p,
+ flag_type f = regex_constants::ECMAScript);
+ template <class ForwardIterator>
+ basic_regex(ForwardIterator first, ForwardIterator last,
+ flag_type f = regex_constants::ECMAScript);
+ basic_regex(initializer_list<charT>, flag_type = regex_constants::ECMAScript);
+
+ ~basic_regex();
+
+ basic_regex& operator=(const basic_regex&);
+ basic_regex& operator=(basic_regex&&);
+ basic_regex& operator=(const charT* ptr);
+ basic_regex& operator=(initializer_list<charT> il);
+ template <class ST, class SA>
+ basic_regex& operator=(const basic_string<charT, ST, SA>& p);
+
+ // assign:
+ basic_regex& assign(const basic_regex& that);
+ basic_regex& assign(basic_regex&& that);
+ 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>
+ basic_regex& assign(const basic_string<charT, string_traits, A>& s,
+ flag_type f = regex_constants::ECMAScript);
+ template <class InputIterator>
+ basic_regex& assign(InputIterator first, InputIterator last,
+ flag_type f = regex_constants::ECMAScript);
+ basic_regex& assign(initializer_list<charT>, flag_type = regex_constants::ECMAScript);
+
+ // const operations:
+ unsigned mark_count() const;
+ flag_type flags() const;
+
+ // locale:
+ locale_type imbue(locale_type loc);
+ locale_type getloc() const;
+
+ // swap:
+ void swap(basic_regex&);
+};
+
+typedef basic_regex<char> regex;
+typedef basic_regex<wchar_t> wregex;
+
+template <class charT, class traits>
+ void swap(basic_regex<charT, traits>& e1, basic_regex<charT, traits>& e2);
+
+template <class BidirectionalIterator>
+class sub_match
+ : public pair<BidirectionalIterator, BidirectionalIterator>
+{
+public:
+ typedef typename iterator_traits<BidirectionalIterator>::value_type value_type;
+ typedef typename iterator_traits<BidirectionalIterator>::difference_type difference_type;
+ typedef BidirectionalIterator iterator;
+ typedef basic_string<value_type> string_type;
+
+ bool matched;
+
+ difference_type length() const;
+ operator string_type() const;
+ string_type str() const;
+
+ int compare(const sub_match& s) const;
+ int compare(const string_type& s) const;
+ int compare(const value_type* s) const;
+};
+
+typedef sub_match<const char*> csub_match;
+typedef sub_match<const wchar_t*> wcsub_match;
+typedef sub_match<string::const_iterator> ssub_match;
+typedef sub_match<wstring::const_iterator> wssub_match;
+
+template <class BiIter>
+ bool
+ operator==(const sub_match<BiIter>& lhs, const sub_match<BiIter>& rhs);
+
+template <class BiIter>
+ bool
+ operator!=(const sub_match<BiIter>& lhs, const sub_match<BiIter>& rhs);
+
+template <class BiIter>
+ bool
+ operator<(const sub_match<BiIter>& lhs, const sub_match<BiIter>& rhs);
+
+template <class BiIter>
+ bool
+ operator<=(const sub_match<BiIter>& lhs, const sub_match<BiIter>& rhs);
+
+template <class BiIter>
+ bool
+ operator>=(const sub_match<BiIter>& lhs, const sub_match<BiIter>& rhs);
+
+template <class BiIter>
+ bool
+ operator>(const sub_match<BiIter>& lhs, const sub_match<BiIter>& rhs);
+
+template <class BiIter, class ST, class SA>
+ bool
+ operator==(const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& lhs,
+ const sub_match<BiIter>& rhs);
+
+template <class BiIter, class ST, class SA>
+ bool
+ operator!=(const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& lhs,
+ const sub_match<BiIter>& rhs);
+
+template <class BiIter, class ST, class SA>
+ bool
+ operator<(const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& lhs,
+ const sub_match<BiIter>& rhs);
+
+template <class BiIter, class ST, class SA>
+ bool
+ operator>(const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& lhs,
+ const sub_match<BiIter>& rhs);
+
+template <class BiIter, class ST, class SA>
+ bool operator>=(const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& lhs,
+ const sub_match<BiIter>& rhs);
+
+template <class BiIter, class ST, class SA>
+ bool
+ operator<=(const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& lhs,
+ const sub_match<BiIter>& rhs);
+
+template <class BiIter, class ST, class SA>
+ bool
+ operator==(const sub_match<BiIter>& lhs,
+ const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& rhs);
+
+template <class BiIter, class ST, class SA>
+ bool
+ operator!=(const sub_match<BiIter>& lhs,
+ const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& rhs);
+
+template <class BiIter, class ST, class SA>
+ bool
+ operator<(const sub_match<BiIter>& lhs,
+ const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& rhs);
+
+template <class BiIter, class ST, class SA>
+ bool operator>(const sub_match<BiIter>& lhs,
+ const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& rhs);
+
+template <class BiIter, class ST, class SA>
+ bool
+ operator>=(const sub_match<BiIter>& lhs,
+ const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& rhs);
+
+template <class BiIter, class ST, class SA>
+ bool
+ operator<=(const sub_match<BiIter>& lhs,
+ const basic_string<typename iterator_traits<BiIter>::value_type, ST, SA>& rhs);
+
+template <class BiIter>
+ bool
+ operator==(typename iterator_traits<BiIter>::value_type const* lhs,
+ const sub_match<BiIter>& rhs);
+
+template <class BiIter>
+ bool
+ operator!=(typename iterator_traits<BiIter>::value_type const* lhs,
+ const sub_match<BiIter>& rhs);
+
+template <class BiIter>
+ bool
+ operator<(typename iterator_traits<BiIter>::value_type const* lhs,
+ const sub_match<BiIter>& rhs);
+
+template <class BiIter>
+ bool
+ operator>(typename iterator_traits<BiIter>::value_type const* lhs,
+ const sub_match<BiIter>& rhs);
+
+template <class BiIter>
+ bool
+ operator>=(typename iterator_traits<BiIter>::value_type const* lhs,
+ const sub_match<BiIter>& rhs);
+
+template <class BiIter>
+ bool
+ operator<=(typename iterator_traits<BiIter>::value_type const* lhs,
+ const sub_match<BiIter>& rhs);
+
+template <class BiIter>
+ bool
+ operator==(const sub_match<BiIter>& lhs,
+ typename iterator_traits<BiIter>::value_type const* rhs);
+
+template <class BiIter>
+ bool
+ operator!=(const sub_match<BiIter>& lhs,
+ typename iterator_traits<BiIter>::value_type const* rhs);
+
+template <class BiIter>
+ bool
+ operator<(const sub_match<BiIter>& lhs,
+ typename iterator_traits<BiIter>::value_type const* rhs);
+
+template <class BiIter>
+ bool
+ operator>(const sub_match<BiIter>& lhs,
+ typename iterator_traits<BiIter>::value_type const* rhs);
+
+template <class BiIter>
+ bool
+ operator>=(const sub_match<BiIter>& lhs,
+ typename iterator_traits<BiIter>::value_type const* rhs);
+
+template <class BiIter>
+ bool
+ operator<=(const sub_match<BiIter>& lhs,
+ typename iterator_traits<BiIter>::value_type const* rhs);
+
+template <class BiIter>
+ bool
+ operator==(typename iterator_traits<BiIter>::value_type const& lhs,
+ const sub_match<BiIter>& rhs);
+
+template <class BiIter>
+ bool
+ operator!=(typename iterator_traits<BiIter>::value_type const& lhs,
+ const sub_match<BiIter>& rhs);
+
+template <class BiIter>
+ bool
+ operator<(typename iterator_traits<BiIter>::value_type const& lhs,
+ const sub_match<BiIter>& rhs);
+
+template <class BiIter>
+ bool
+ operator>(typename iterator_traits<BiIter>::value_type const& lhs,
+ const sub_match<BiIter>& rhs);
+
+template <class BiIter>
+ bool
+ operator>=(typename iterator_traits<BiIter>::value_type const& lhs,
+ const sub_match<BiIter>& rhs);
+
+template <class BiIter>
+ bool
+ operator<=(typename iterator_traits<BiIter>::value_type const& lhs,
+ const sub_match<BiIter>& rhs);
+
+template <class BiIter>
+ bool
+ operator==(const sub_match<BiIter>& lhs,
+ typename iterator_traits<BiIter>::value_type const& rhs);
+
+template <class BiIter>
+ bool
+ operator!=(const sub_match<BiIter>& lhs,
+ typename iterator_traits<BiIter>::value_type const& rhs);
+
+template <class BiIter>
+ bool
+ operator<(const sub_match<BiIter>& lhs,
+ typename iterator_traits<BiIter>::value_type const& rhs);
+
+template <class BiIter>
+ bool
+ operator>(const sub_match<BiIter>& lhs,
+ typename iterator_traits<BiIter>::value_type const& rhs);
+
+template <class BiIter>
+ bool
+ operator>=(const sub_match<BiIter>& lhs,
+ typename iterator_traits<BiIter>::value_type const& rhs);
+
+template <class BiIter>
+ bool
+ operator<=(const sub_match<BiIter>& lhs,
+ typename iterator_traits<BiIter>::value_type const& rhs);
+
+template <class charT, class ST, class BiIter>
+ basic_ostream<charT, ST>&
+ operator<<(basic_ostream<charT, ST>& os, const sub_match<BiIter>& m);
+
+template <class BidirectionalIterator,
+ class Allocator = allocator<sub_match<BidirectionalIterator>>>
+class match_results
+{
+public:
+ typedef sub_match<BidirectionalIterator> value_type;
+ typedef const value_type& const_reference;
+ typedef const_reference reference;
+ typedef /implementation-defined/ const_iterator;
+ typedef const_iterator iterator;
+ typedef typename iterator_traits<BidirectionalIterator>::difference_type difference_type;
+ typedef typename allocator_traits<Allocator>::size_type size_type;
+ typedef Allocator allocator_type;
+ typedef typename iterator_traits<BidirectionalIterator>::value_type char_type;
+ typedef basic_string<char_type> string_type;
+
+ // construct/copy/destroy:
+ explicit match_results(const Allocator& a = Allocator());
+ match_results(const match_results& m);
+ match_results(match_results&& m);
+ match_results& operator=(const match_results& m);
+ match_results& operator=(match_results&& m);
+ ~match_results();
+
+ // size:
+ size_type size() const;
+ size_type max_size() const;
+ bool empty() const;
+
+ // element access:
+ difference_type length(size_type sub = 0) const;
+ difference_type position(size_type sub = 0) const;
+ string_type str(size_type sub = 0) const;
+ const_reference operator[](size_type n) const;
+
+ const_reference prefix() const;
+ const_reference suffix() const;
+
+ const_iterator begin() const;
+ const_iterator end() const;
+ const_iterator cbegin() const;
+ const_iterator cend() const;
+
+ // format:
+ template <class OutputIter>
+ OutputIter
+ format(OutputIter out, const char_type* fmt_first,
+ const char_type* fmt_last,
+ regex_constants::match_flag_type flags = regex_constants::format_default) const;
+ template <class OutputIter, class ST, class SA>
+ OutputIter
+ format(OutputIter out, const basic_string<char_type, ST, SA>& fmt,
+ regex_constants::match_flag_type flags = regex_constants::format_default) const;
+ template <class ST, class SA>
+ basic_string<char_type, ST, SA>
+ format(const basic_string<char_type, ST, SA>& fmt,
+ regex_constants::match_flag_type flags = regex_constants::format_default) const;
+ string_type
+ format(const char_type* fmt,
+ regex_constants::match_flag_type flags = regex_constants::format_default) const;
+
+ // allocator:
+ allocator_type get_allocator() const;
+
+ // swap:
+ void swap(match_results& that);
+};
+
+typedef match_results<const char*> cmatch;
+typedef match_results<const wchar_t*> wcmatch;
+typedef match_results<string::const_iterator> smatch;
+typedef match_results<wstring::const_iterator> wsmatch;
+
+template <class BidirectionalIterator, class Allocator>
+ bool
+ operator==(const match_results<BidirectionalIterator, Allocator>& m1,
+ const match_results<BidirectionalIterator, Allocator>& m2);
+
+template <class BidirectionalIterator, class Allocator>
+ bool
+ operator!=(const match_results<BidirectionalIterator, Allocator>& m1,
+ const match_results<BidirectionalIterator, Allocator>& m2);
+
+template <class BidirectionalIterator, class Allocator>
+ void
+ swap(match_results<BidirectionalIterator, Allocator>& m1,
+ match_results<BidirectionalIterator, Allocator>& m2);
+
+template <class BidirectionalIterator, class Allocator, class charT, class traits>
+ bool
+ regex_match(BidirectionalIterator first, BidirectionalIterator last,
+ match_results<BidirectionalIterator, Allocator>& m,
+ const basic_regex<charT, traits>& e,
+ regex_constants::match_flag_type flags = regex_constants::match_default);
+
+template <class BidirectionalIterator, class charT, class traits>
+ bool
+ regex_match(BidirectionalIterator first, BidirectionalIterator last,
+ const basic_regex<charT, traits>& e,
+ regex_constants::match_flag_type flags = regex_constants::match_default);
+
+template <class charT, class Allocator, class traits>
+ bool
+ regex_match(const charT* str, match_results<const charT*, Allocator>& m,
+ const basic_regex<charT, traits>& e,
+ regex_constants::match_flag_type flags = regex_constants::match_default);
+
+template <class ST, class SA, class Allocator, class charT, class traits>
+ bool
+ regex_match(const basic_string<charT, ST, SA>& s,
+ match_results<typename basic_string<charT, ST, SA>::const_iterator, Allocator>& m,
+ const basic_regex<charT, traits>& e,
+ regex_constants::match_flag_type flags = regex_constants::match_default);
+
+template <class charT, class traits>
+ bool
+ regex_match(const charT* str, const basic_regex<charT, traits>& e,
+ regex_constants::match_flag_type flags = regex_constants::match_default);
+
+template <class ST, class SA, class charT, class traits>
+ bool
+ regex_match(const basic_string<charT, ST, SA>& s,
+ const basic_regex<charT, traits>& e,
+ regex_constants::match_flag_type flags = regex_constants::match_default);
+
+template <class BidirectionalIterator, class Allocator, class charT, class traits>
+ bool
+ regex_search(BidirectionalIterator first, BidirectionalIterator last,
+ match_results<BidirectionalIterator, Allocator>& m,
+ const basic_regex<charT, traits>& e,
+ regex_constants::match_flag_type flags = regex_constants::match_default);
+
+template <class BidirectionalIterator, class charT, class traits>
+ bool
+ regex_search(BidirectionalIterator first, BidirectionalIterator last,
+ const basic_regex<charT, traits>& e,
+ regex_constants::match_flag_type flags = regex_constants::match_default);
+
+template <class charT, class Allocator, class traits>
+ bool
+ regex_search(const charT* str, match_results<const charT*, Allocator>& m,
+ const basic_regex<charT, traits>& e,
+ regex_constants::match_flag_type flags = regex_constants::match_default);
+
+template <class charT, class traits>
+ bool
+ regex_search(const charT* str, const basic_regex<charT, traits>& e,
+ regex_constants::match_flag_type flags = regex_constants::match_default);
+
+template <class ST, class SA, class charT, class traits>
+ bool
+ regex_search(const basic_string<charT, ST, SA>& s,
+ const basic_regex<charT, traits>& e,
+ regex_constants::match_flag_type flags = regex_constants::match_default);
+
+template <class ST, class SA, class Allocator, class charT, class traits>
+ bool
+ regex_search(const basic_string<charT, ST, SA>& s,
+ match_results<typename basic_string<charT, ST, SA>::const_iterator, Allocator>& m,
+ const basic_regex<charT, traits>& e,
+ regex_constants::match_flag_type flags = regex_constants::match_default);
+
+template <class OutputIterator, class BidirectionalIterator,
+ class traits, class charT, class ST, class SA>
+ OutputIterator
+ regex_replace(OutputIterator out,
+ BidirectionalIterator first, BidirectionalIterator last,
+ const basic_regex<charT, traits>& e,
+ const basic_string<charT, ST, SA>& fmt,
+ regex_constants::match_flag_type flags = regex_constants::match_default);
+
+template <class OutputIterator, class BidirectionalIterator,
+ class traits, class charT>
+ OutputIterator
+ regex_replace(OutputIterator out,
+ BidirectionalIterator first, BidirectionalIterator last,
+ const basic_regex<charT, traits>& e, const charT* fmt,
+ regex_constants::match_flag_type flags = regex_constants::match_default);
+
+template <class traits, class charT, class ST, class SA, class FST, class FSA>>
+ basic_string<charT, ST, SA>
+ regex_replace(const basic_string<charT, ST, SA>& s,
+ const basic_regex<charT, traits>& e,
+ const basic_string<charT, FST, FSA>& fmt,
+ regex_constants::match_flag_type flags = regex_constants::match_default);
+
+template <class traits, class charT, class ST, class SA>
+ basic_string<charT, ST, SA>
+ regex_replace(const basic_string<charT, ST, SA>& s,
+ const basic_regex<charT, traits>& e, const charT* fmt,
+ regex_constants::match_flag_type flags = regex_constants::match_default);
+
+template <class traits, class charT, class ST, class SA>
+ basic_string<charT>
+ regex_replace(const charT* s,
+ const basic_regex<charT, traits>& e,
+ const basic_string<charT, ST, SA>& fmt,
+ regex_constants::match_flag_type flags = regex_constants::match_default);
+
+template <class traits, class charT>
+ basic_string<charT>
+ regex_replace(const charT* s,
+ const basic_regex<charT, traits>& e,
+ const charT* fmt,
+ regex_constants::match_flag_type flags = regex_constants::match_default);
+
+template <class BidirectionalIterator,
+ class charT = typename iterator_traits< BidirectionalIterator>::value_type,
+ class traits = regex_traits<charT>>
+class regex_iterator
+{
+public:
+ typedef basic_regex<charT, traits> regex_type;
+ typedef match_results<BidirectionalIterator> value_type;
+ typedef ptrdiff_t difference_type;
+ typedef const value_type* pointer;
+ typedef const value_type& reference;
+ typedef forward_iterator_tag iterator_category;
+
+ regex_iterator();
+ regex_iterator(BidirectionalIterator a, BidirectionalIterator b,
+ const regex_type& re,
+ regex_constants::match_flag_type m = regex_constants::match_default);
+ regex_iterator(const regex_iterator&);
+ regex_iterator& operator=(const regex_iterator&);
+
+ bool operator==(const regex_iterator&) const;
+ bool operator!=(const regex_iterator&) const;
+
+ const value_type& operator*() const;
+ const value_type* operator->() const;
+
+ regex_iterator& operator++();
+ regex_iterator operator++(int);
+};
+
+typedef regex_iterator<const char*> cregex_iterator;
+typedef regex_iterator<const wchar_t*> wcregex_iterator;
+typedef regex_iterator<string::const_iterator> sregex_iterator;
+typedef regex_iterator<wstring::const_iterator> wsregex_iterator;
+
+template <class BidirectionalIterator,
+ class charT = typename iterator_traits< BidirectionalIterator>::value_type,
+ class traits = regex_traits<charT>>
+class regex_token_iterator
+{
+public:
+ typedef basic_regex<charT, traits> regex_type;
+ typedef sub_match<BidirectionalIterator> value_type;
+ typedef ptrdiff_t difference_type;
+ typedef const value_type* pointer;
+ typedef const value_type& reference;
+ typedef forward_iterator_tag iterator_category;
+
+ regex_token_iterator();
+ regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
+ const regex_type& re, int submatch = 0,
+ regex_constants::match_flag_type m = regex_constants::match_default);
+ regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
+ const regex_type& re, const vector<int>& submatches,
+ regex_constants::match_flag_type m = regex_constants::match_default);
+ regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
+ const regex_type& re, initializer_list<int> submatches,
+ regex_constants::match_flag_type m = regex_constants::match_default);
+ template <size_t N>
+ regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
+ const regex_type& re, const int (&submatches)[N],
+ regex_constants::match_flag_type m = regex_constants::match_default);
+ regex_token_iterator(const regex_token_iterator&);
+ regex_token_iterator& operator=(const regex_token_iterator&);
+
+ bool operator==(const regex_token_iterator&) const;
+ bool operator!=(const regex_token_iterator&) const;
+
+ const value_type& operator*() const;
+ const value_type* operator->() const;
+
+ regex_token_iterator& operator++();
+ regex_token_iterator operator++(int);
+};
+
+typedef regex_token_iterator<const char*> cregex_token_iterator;
+typedef regex_token_iterator<const wchar_t*> wcregex_token_iterator;
+typedef regex_token_iterator<string::const_iterator> sregex_token_iterator;
+typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
+
+} // std
+*/
+
+#include <__config>
+#include <stdexcept>
+#include <__locale>
+
+#pragma GCC system_header
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace regex_constants
+{
+
+// syntax_option_type
+
+enum syntax_option_type
+{
+ icase = 1 << 0,
+ nosubs = 1 << 1,
+ optimize = 1 << 2,
+ collate = 1 << 3,
+ ECMAScript = 1 << 4,
+ basic = 1 << 5,
+ extended = 1 << 6,
+ awk = 1 << 7,
+ grep = 1 << 8,
+ egrep = 1 << 9
+};
+
+inline
+/*constexpr*/
+syntax_option_type
+operator~(syntax_option_type __x)
+{
+ return syntax_option_type(~int(__x));
+}
+
+inline
+/*constexpr*/
+syntax_option_type
+operator&(syntax_option_type __x, syntax_option_type __y)
+{
+ return syntax_option_type(int(__x) & int(__y));
+}
+
+inline
+/*constexpr*/
+syntax_option_type
+operator|(syntax_option_type __x, syntax_option_type __y)
+{
+ return syntax_option_type(int(__x) | int(__y));
+}
+
+inline
+/*constexpr*/
+syntax_option_type
+operator^(syntax_option_type __x, syntax_option_type __y)
+{
+ return syntax_option_type(int(__x) ^ int(__y));
+}
+
+inline
+/*constexpr*/
+syntax_option_type&
+operator&=(syntax_option_type& __x, syntax_option_type __y)
+{
+ __x = __x & __y;
+ return __x;
+}
+
+inline
+/*constexpr*/
+syntax_option_type&
+operator|=(syntax_option_type& __x, syntax_option_type __y)
+{
+ __x = __x | __y;
+ return __x;
+}
+
+inline
+/*constexpr*/
+syntax_option_type&
+operator^=(syntax_option_type& __x, syntax_option_type __y)
+{
+ __x = __x ^ __y;
+ return __x;
+}
+
+// match_flag_type
+
+enum match_flag_type
+{
+ match_default = 0,
+ match_not_bol = 1 << 0,
+ match_not_eol = 1 << 1,
+ match_not_bow = 1 << 2,
+ match_not_eow = 1 << 3,
+ match_any = 1 << 4,
+ match_not_null = 1 << 5,
+ match_continuous = 1 << 6,
+ match_prev_avail = 1 << 7,
+ format_default = 0,
+ format_sed = 1 << 8,
+ format_no_copy = 1 << 9,
+ format_first_only = 1 << 10
+};
+
+inline
+/*constexpr*/
+match_flag_type
+operator~(match_flag_type __x)
+{
+ return match_flag_type(~int(__x));
+}
+
+inline
+/*constexpr*/
+match_flag_type
+operator&(match_flag_type __x, match_flag_type __y)
+{
+ return match_flag_type(int(__x) & int(__y));
+}
+
+inline
+/*constexpr*/
+match_flag_type
+operator|(match_flag_type __x, match_flag_type __y)
+{
+ return match_flag_type(int(__x) | int(__y));
+}
+
+inline
+/*constexpr*/
+match_flag_type
+operator^(match_flag_type __x, match_flag_type __y)
+{
+ return match_flag_type(int(__x) ^ int(__y));
+}
+
+inline
+/*constexpr*/
+match_flag_type&
+operator&=(match_flag_type& __x, match_flag_type __y)
+{
+ __x = __x & __y;
+ return __x;
+}
+
+inline
+/*constexpr*/
+match_flag_type&
+operator|=(match_flag_type& __x, match_flag_type __y)
+{
+ __x = __x | __y;
+ return __x;
+}
+
+inline
+/*constexpr*/
+match_flag_type&
+operator^=(match_flag_type& __x, match_flag_type __y)
+{
+ __x = __x ^ __y;
+ return __x;
+}
+
+enum error_type
+{
+ error_collate = 1,
+ error_ctype,
+ error_escape,
+ error_backref,
+ error_brack,
+ error_paren,
+ error_brace,
+ error_badbrace,
+ error_range,
+ error_space,
+ error_badrepeat,
+ error_complexity,
+ error_stack
+};
+
+} // regex_constants
+
+class _LIBCPP_EXCEPTION_ABI regex_error
+ : public runtime_error
+{
+ regex_constants::error_type __code_;
+public:
+ explicit regex_error(regex_constants::error_type __ecode);
+ virtual ~regex_error() throw();
+ regex_constants::error_type code() const {return __code_;}
+};
+
+template <class _CharT>
+struct regex_traits
+{
+public:
+ typedef _CharT char_type;
+ typedef basic_string<char_type> string_type;
+ typedef locale locale_type;
+ typedef unsigned char_class_type;
+
+private:
+ locale __loc_;
+ const ctype<char_type>* __ct_;
+ const collate<char_type>* __col_;
+
+public:
+ regex_traits();
+
+ static size_t length(const char_type* __p)
+ {return char_traits<char_type>::length(__p);}
+ char_type translate(char_type __c) const {return __c;}
+ char_type translate_nocase(char_type __c) const;
+ template <class _ForwardIterator>
+ string_type
+ transform(_ForwardIterator __f, _ForwardIterator __l) const;
+ template <class _ForwardIterator>
+ string_type
+ transform_primary( _ForwardIterator __f, _ForwardIterator __l) const
+ {return __transform_primary(__f, __l, char_type());}
+ template <class _ForwardIterator>
+ string_type
+ lookup_collatename(_ForwardIterator __f, _ForwardIterator __l) const
+ {return __lookup_collatename(__f, __l, char_type());}
+ template <class _ForwardIterator>
+ char_class_type
+ lookup_classname(_ForwardIterator __f, _ForwardIterator __l,
+ bool __icase = false) const;
+ bool isctype(char_type __c, char_class_type __f) const;
+ int value(char_type __ch, int __radix) const;
+ locale_type imbue(locale_type __l);
+ locale_type getloc()const {return __loc_;}
+
+private:
+ void __init();
+
+ template <class _ForwardIterator>
+ string_type
+ __transform_primary(_ForwardIterator __f, _ForwardIterator __l, char) const;
+ template <class _ForwardIterator>
+ string_type
+ __transform_primary(_ForwardIterator __f, _ForwardIterator __l, wchar_t) const;
+
+ template <class _ForwardIterator>
+ string_type
+ __lookup_collatename(_ForwardIterator __f, _ForwardIterator __l, char) const;
+ template <class _ForwardIterator>
+ string_type
+ __lookup_collatename(_ForwardIterator __f, _ForwardIterator __l, wchar_t) const;
+};
+
+template <class _CharT>
+regex_traits<_CharT>::regex_traits()
+{
+ __init();
+}
+
+template <class _CharT>
+typename regex_traits<_CharT>::char_type
+regex_traits<_CharT>::translate_nocase(char_type __c) const
+{
+ return __ct_->tolower(__c);
+}
+
+template <class _CharT>
+template <class _ForwardIterator>
+typename regex_traits<_CharT>::string_type
+regex_traits<_CharT>::transform(_ForwardIterator __f, _ForwardIterator __l) const
+{
+ string_type __s(__f, __l);
+ return __col_->transform(__s.data(), __s.data() + __s.size());
+}
+
+template <class _CharT>
+void
+regex_traits<_CharT>::__init()
+{
+ __ct_ = &use_facet<ctype<char_type> >(__loc_);
+ __col_ = &use_facet<collate<char_type> >(__loc_);
+}
+
+template <class _CharT>
+typename regex_traits<_CharT>::locale_type
+regex_traits<_CharT>::imbue(locale_type __l)
+{
+ locale __r = __loc_;
+ __loc_ = __l;
+ __init();
+ return __r;
+}
+
+// transform_primary is very FreeBSD-specific
+
+template <class _CharT>
+template <class _ForwardIterator>
+typename regex_traits<_CharT>::string_type
+regex_traits<_CharT>::__transform_primary(_ForwardIterator __f,
+ _ForwardIterator __l, char) const
+{
+ const string_type __s(__f, __l);
+ string_type __d = __col_->transform(__s.data(), __s.data() + __s.size());
+ switch (__d.size())
+ {
+ case 1:
+ break;
+ case 12:
+ __d[11] = __d[3];
+ break;
+ default:
+ __d.clear();
+ break;
+ }
+ return __d;
+}
+
+template <class _CharT>
+template <class _ForwardIterator>
+typename regex_traits<_CharT>::string_type
+regex_traits<_CharT>::__transform_primary(_ForwardIterator __f,
+ _ForwardIterator __l, wchar_t) const
+{
+ const string_type __s(__f, __l);
+ string_type __d = __col_->transform(__s.data(), __s.data() + __s.size());
+ switch (__d.size())
+ {
+ case 1:
+ break;
+ case 3:
+ __d[2] = __d[0];
+ break;
+ default:
+ __d.clear();
+ break;
+ }
+ return __d;
+}
+
+// lookup_collatename is very FreeBSD-specific
+
+string __get_collation_name(const char* s);
+
+template <class _CharT>
+template <class _ForwardIterator>
+typename regex_traits<_CharT>::string_type
+regex_traits<_CharT>::__lookup_collatename(_ForwardIterator __f,
+ _ForwardIterator __l, char) const
+{
+ string_type __s(__f, __l);
+ string_type __r;
+ if (!__s.empty())
+ {
+ __r = __get_collation_name(__s.c_str());
+ if (__r.empty() && __s.size() <= 2)
+ {
+ __r = __col_->transform(__s.data(), __s.data() + __s.size());
+ if (__r.size() == 1 || __r.size() == 12)
+ __r = __s;
+ else
+ __r.clear();
+ }
+ }
+ return __r;
+}
+
+template <class _CharT>
+template <class _ForwardIterator>
+typename regex_traits<_CharT>::string_type
+regex_traits<_CharT>::__lookup_collatename(_ForwardIterator __f,
+ _ForwardIterator __l, wchar_t) const
+{
+ string_type __s(__f, __l);
+ string __n;
+ __n.reserve(__s.size());
+ for (typename string_type::const_iterator __i = __s.begin(), __e = __s.end();
+ __i != __e; ++__i)
+ {
+ if (static_cast<unsigned>(*__i) >= 127)
+ return string_type();
+ __n.push_back(char(*__i));
+ }
+ string_type __r;
+ if (!__s.empty())
+ {
+ __n = __get_collation_name(__n.c_str());
+ if (!__n.empty())
+ __r.assign(__n.begin(), __n.end());
+ else if (__s.size() <= 2)
+ {
+ __r = __col_->transform(__s.data(), __s.data() + __s.size());
+ if (__r.size() == 1 || __r.size() == 3)
+ __r = __s;
+ else
+ __r.clear();
+ }
+ }
+ return __r;
+}
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_REGEX
Added: libcxx/trunk/src/regex.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/regex.cpp?rev=106187&view=auto
==============================================================================
--- libcxx/trunk/src/regex.cpp (added)
+++ libcxx/trunk/src/regex.cpp Wed Jun 16 19:34:59 2010
@@ -0,0 +1,203 @@
+//===-------------------------- regex.cpp ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "regex"
+#include "algorithm"
+#include "iterator"
+
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+static
+const char*
+make_error_type_string(regex_constants::error_type ecode)
+{
+ switch (ecode)
+ {
+ case regex_constants::error_collate:
+ return "error_collate";
+ case regex_constants::error_ctype:
+ return "error_ctype";
+ case regex_constants::error_escape:
+ return "error_escape";
+ case regex_constants::error_backref:
+ return "error_backref";
+ case regex_constants::error_brack:
+ return "error_brack";
+ case regex_constants::error_paren:
+ return "error_paren";
+ case regex_constants::error_brace:
+ return "error_brace";
+ case regex_constants::error_badbrace:
+ return "error_badbrace";
+ case regex_constants::error_range:
+ return "error_range";
+ case regex_constants::error_space:
+ return "error_space";
+ case regex_constants::error_badrepeat:
+ return "error_badrepeat";
+ case regex_constants::error_complexity:
+ return "error_complexity";
+ case regex_constants::error_stack:
+ return "error_stack";
+ }
+ return "unknown error_type";
+}
+
+regex_error::regex_error(regex_constants::error_type ecode)
+ : runtime_error(make_error_type_string(ecode)),
+ __code_(ecode)
+{}
+
+regex_error::~regex_error() throw() {}
+
+namespace {
+
+struct collationnames
+{
+ const char* elem_;
+ char char_;
+};
+
+const collationnames collatenames[] =
+{
+ {"A", 0x41},
+ {"B", 0x42},
+ {"C", 0x43},
+ {"D", 0x44},
+ {"E", 0x45},
+ {"F", 0x46},
+ {"G", 0x47},
+ {"H", 0x48},
+ {"I", 0x49},
+ {"J", 0x4a},
+ {"K", 0x4b},
+ {"L", 0x4c},
+ {"M", 0x4d},
+ {"N", 0x4e},
+ {"NUL", 0x00},
+ {"O", 0x4f},
+ {"P", 0x50},
+ {"Q", 0x51},
+ {"R", 0x52},
+ {"S", 0x53},
+ {"T", 0x54},
+ {"U", 0x55},
+ {"V", 0x56},
+ {"W", 0x57},
+ {"X", 0x58},
+ {"Y", 0x59},
+ {"Z", 0x5a},
+ {"a", 0x61},
+ {"alert", 0x07},
+ {"ampersand", 0x26},
+ {"apostrophe", 0x27},
+ {"asterisk", 0x2a},
+ {"b", 0x62},
+ {"backslash", 0x5c},
+ {"backspace", 0x08},
+ {"c", 0x63},
+ {"carriage-return", 0x0d},
+ {"circumflex", 0x5e},
+ {"circumflex-accent", 0x5e},
+ {"colon", 0x3a},
+ {"comma", 0x2c},
+ {"commercial-at", 0x40},
+ {"d", 0x64},
+ {"dollar-sign", 0x24},
+ {"e", 0x65},
+ {"eight", 0x38},
+ {"equals-sign", 0x3d},
+ {"exclamation-mark", 0x21},
+ {"f", 0x66},
+ {"five", 0x35},
+ {"form-feed", 0x0c},
+ {"four", 0x34},
+ {"full-stop", 0x2e},
+ {"g", 0x67},
+ {"grave-accent", 0x60},
+ {"greater-than-sign", 0x3e},
+ {"h", 0x68},
+ {"hyphen", 0x2d},
+ {"hyphen-minus", 0x2d},
+ {"i", 0x69},
+ {"j", 0x6a},
+ {"k", 0x6b},
+ {"l", 0x6c},
+ {"left-brace", 0x7b},
+ {"left-curly-bracket", 0x7b},
+ {"left-parenthesis", 0x28},
+ {"left-square-bracket", 0x5b},
+ {"less-than-sign", 0x3c},
+ {"low-line", 0x5f},
+ {"m", 0x6d},
+ {"n", 0x6e},
+ {"newline", 0x0a},
+ {"nine", 0x39},
+ {"number-sign", 0x23},
+ {"o", 0x6f},
+ {"one", 0x31},
+ {"p", 0x70},
+ {"percent-sign", 0x25},
+ {"period", 0x2e},
+ {"plus-sign", 0x2b},
+ {"q", 0x71},
+ {"question-mark", 0x3f},
+ {"quotation-mark", 0x22},
+ {"r", 0x72},
+ {"reverse-solidus", 0x5c},
+ {"right-brace", 0x7d},
+ {"right-curly-bracket", 0x7d},
+ {"right-parenthesis", 0x29},
+ {"right-square-bracket", 0x5d},
+ {"s", 0x73},
+ {"semicolon", 0x3b},
+ {"seven", 0x37},
+ {"six", 0x36},
+ {"slash", 0x2f},
+ {"solidus", 0x2f},
+ {"space", 0x20},
+ {"t", 0x74},
+ {"tab", 0x09},
+ {"three", 0x33},
+ {"tilde", 0x7e},
+ {"two", 0x32},
+ {"u", 0x75},
+ {"underscore", 0x5f},
+ {"v", 0x76},
+ {"vertical-line", 0x7c},
+ {"vertical-tab", 0x0b},
+ {"w", 0x77},
+ {"x", 0x78},
+ {"y", 0x79},
+ {"z", 0x7a},
+ {"zero", 0x30}
+};
+
+struct use_strcmp
+{
+ bool operator()(const collationnames& x, const char* y)
+ {return strcmp(x.elem_, y) < 0;}
+};
+
+}
+
+string
+__get_collation_name(const char* s)
+{
+ typedef std::pair<collationnames*, collationnames*> P;
+ const collationnames* i =
+ lower_bound(begin(collatenames), end(collatenames), s, use_strcmp());
+ string r;
+ if (i != end(collatenames) && strcmp(s, i->elem_) == 0)
+ r = char(i->char_);
+ return r;
+}
+
+_LIBCPP_END_NAMESPACE_STD
Added: libcxx/trunk/test/re/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/nothing_to_do.pass.cpp?rev=106187&view=auto
==============================================================================
--- libcxx/trunk/test/re/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/re/nothing_to_do.pass.cpp Wed Jun 16 19:34:59 2010
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
Added: libcxx/trunk/test/re/re.badexp/regex_error.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.badexp/regex_error.pass.cpp?rev=106187&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.badexp/regex_error.pass.cpp (added)
+++ libcxx/trunk/test/re/re.badexp/regex_error.pass.cpp Wed Jun 16 19:34:59 2010
@@ -0,0 +1,91 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// class regex_error
+// : public runtime_error
+// {
+// public:
+// explicit regex_error(regex_constants::error_type ecode);
+// regex_constants::error_type code() const;
+// };
+
+#include <regex>
+#include <cassert>
+
+int main()
+{
+ {
+ std::regex_error e(std::regex_constants::error_collate);
+ assert(e.code() == std::regex_constants::error_collate);
+ assert(e.what() == std::string("error_collate"));
+ }
+ {
+ std::regex_error e(std::regex_constants::error_ctype);
+ assert(e.code() == std::regex_constants::error_ctype);
+ assert(e.what() == std::string("error_ctype"));
+ }
+ {
+ std::regex_error e(std::regex_constants::error_escape);
+ assert(e.code() == std::regex_constants::error_escape);
+ assert(e.what() == std::string("error_escape"));
+ }
+ {
+ std::regex_error e(std::regex_constants::error_backref);
+ assert(e.code() == std::regex_constants::error_backref);
+ assert(e.what() == std::string("error_backref"));
+ }
+ {
+ std::regex_error e(std::regex_constants::error_brack);
+ assert(e.code() == std::regex_constants::error_brack);
+ assert(e.what() == std::string("error_brack"));
+ }
+ {
+ std::regex_error e(std::regex_constants::error_paren);
+ assert(e.code() == std::regex_constants::error_paren);
+ assert(e.what() == std::string("error_paren"));
+ }
+ {
+ std::regex_error e(std::regex_constants::error_brace);
+ assert(e.code() == std::regex_constants::error_brace);
+ assert(e.what() == std::string("error_brace"));
+ }
+ {
+ std::regex_error e(std::regex_constants::error_badbrace);
+ assert(e.code() == std::regex_constants::error_badbrace);
+ assert(e.what() == std::string("error_badbrace"));
+ }
+ {
+ std::regex_error e(std::regex_constants::error_range);
+ assert(e.code() == std::regex_constants::error_range);
+ assert(e.what() == std::string("error_range"));
+ }
+ {
+ std::regex_error e(std::regex_constants::error_space);
+ assert(e.code() == std::regex_constants::error_space);
+ assert(e.what() == std::string("error_space"));
+ }
+ {
+ std::regex_error e(std::regex_constants::error_badrepeat);
+ assert(e.code() == std::regex_constants::error_badrepeat);
+ assert(e.what() == std::string("error_badrepeat"));
+ }
+ {
+ std::regex_error e(std::regex_constants::error_complexity);
+ assert(e.code() == std::regex_constants::error_complexity);
+ assert(e.what() == std::string("error_complexity"));
+ }
+ {
+ std::regex_error e(std::regex_constants::error_stack);
+ assert(e.code() == std::regex_constants::error_stack);
+ assert(e.what() == std::string("error_stack"));
+ }
+}
Added: libcxx/trunk/test/re/re.const/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.const/nothing_to_do.pass.cpp?rev=106187&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.const/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/re/re.const/nothing_to_do.pass.cpp Wed Jun 16 19:34:59 2010
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
Added: libcxx/trunk/test/re/re.const/re.err/error_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.const/re.err/error_type.pass.cpp?rev=106187&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.const/re.err/error_type.pass.cpp (added)
+++ libcxx/trunk/test/re/re.const/re.err/error_type.pass.cpp Wed Jun 16 19:34:59 2010
@@ -0,0 +1,143 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// namespace regex_constants
+// {
+//
+// enum error_type
+// {
+// error_collate = unspecified,
+// error_ctype = unspecified,
+// error_escape = unspecified,
+// error_backref = unspecified,
+// error_brack = unspecified,
+// error_paren = unspecified,
+// error_brace = unspecified,
+// error_badbrace = unspecified,
+// error_range = unspecified,
+// error_space = unspecified,
+// error_badrepeat = unspecified,
+// error_complexity = unspecified,
+// error_stack = unspecified
+// };
+//
+// }
+
+#include <regex>
+#include <cassert>
+
+int main()
+{
+ assert(std::regex_constants::error_collate != 0);
+ assert(std::regex_constants::error_ctype != 0);
+ assert(std::regex_constants::error_escape != 0);
+ assert(std::regex_constants::error_backref != 0);
+ assert(std::regex_constants::error_brack != 0);
+ assert(std::regex_constants::error_paren != 0);
+ assert(std::regex_constants::error_brace != 0);
+ assert(std::regex_constants::error_badbrace != 0);
+ assert(std::regex_constants::error_range != 0);
+ assert(std::regex_constants::error_space != 0);
+ assert(std::regex_constants::error_badrepeat != 0);
+ assert(std::regex_constants::error_complexity != 0);
+ assert(std::regex_constants::error_stack != 0);
+
+ assert(std::regex_constants::error_collate != std::regex_constants::error_ctype);
+ assert(std::regex_constants::error_collate != std::regex_constants::error_escape);
+ assert(std::regex_constants::error_collate != std::regex_constants::error_backref);
+ assert(std::regex_constants::error_collate != std::regex_constants::error_brack);
+ assert(std::regex_constants::error_collate != std::regex_constants::error_paren);
+ assert(std::regex_constants::error_collate != std::regex_constants::error_brace);
+ assert(std::regex_constants::error_collate != std::regex_constants::error_badbrace);
+ assert(std::regex_constants::error_collate != std::regex_constants::error_range);
+ assert(std::regex_constants::error_collate != std::regex_constants::error_space);
+ assert(std::regex_constants::error_collate != std::regex_constants::error_badrepeat);
+ assert(std::regex_constants::error_collate != std::regex_constants::error_complexity);
+ assert(std::regex_constants::error_collate != std::regex_constants::error_stack);
+
+ assert(std::regex_constants::error_ctype != std::regex_constants::error_escape);
+ assert(std::regex_constants::error_ctype != std::regex_constants::error_backref);
+ assert(std::regex_constants::error_ctype != std::regex_constants::error_brack);
+ assert(std::regex_constants::error_ctype != std::regex_constants::error_paren);
+ assert(std::regex_constants::error_ctype != std::regex_constants::error_brace);
+ assert(std::regex_constants::error_ctype != std::regex_constants::error_badbrace);
+ assert(std::regex_constants::error_ctype != std::regex_constants::error_range);
+ assert(std::regex_constants::error_ctype != std::regex_constants::error_space);
+ assert(std::regex_constants::error_ctype != std::regex_constants::error_badrepeat);
+ assert(std::regex_constants::error_ctype != std::regex_constants::error_complexity);
+ assert(std::regex_constants::error_ctype != std::regex_constants::error_stack);
+
+ assert(std::regex_constants::error_escape != std::regex_constants::error_backref);
+ assert(std::regex_constants::error_escape != std::regex_constants::error_brack);
+ assert(std::regex_constants::error_escape != std::regex_constants::error_paren);
+ assert(std::regex_constants::error_escape != std::regex_constants::error_brace);
+ assert(std::regex_constants::error_escape != std::regex_constants::error_badbrace);
+ assert(std::regex_constants::error_escape != std::regex_constants::error_range);
+ assert(std::regex_constants::error_escape != std::regex_constants::error_space);
+ assert(std::regex_constants::error_escape != std::regex_constants::error_badrepeat);
+ assert(std::regex_constants::error_escape != std::regex_constants::error_complexity);
+ assert(std::regex_constants::error_escape != std::regex_constants::error_stack);
+
+ assert(std::regex_constants::error_backref != std::regex_constants::error_brack);
+ assert(std::regex_constants::error_backref != std::regex_constants::error_paren);
+ assert(std::regex_constants::error_backref != std::regex_constants::error_brace);
+ assert(std::regex_constants::error_backref != std::regex_constants::error_badbrace);
+ assert(std::regex_constants::error_backref != std::regex_constants::error_range);
+ assert(std::regex_constants::error_backref != std::regex_constants::error_space);
+ assert(std::regex_constants::error_backref != std::regex_constants::error_badrepeat);
+ assert(std::regex_constants::error_backref != std::regex_constants::error_complexity);
+ assert(std::regex_constants::error_backref != std::regex_constants::error_stack);
+
+ assert(std::regex_constants::error_brack != std::regex_constants::error_paren);
+ assert(std::regex_constants::error_brack != std::regex_constants::error_brace);
+ assert(std::regex_constants::error_brack != std::regex_constants::error_badbrace);
+ assert(std::regex_constants::error_brack != std::regex_constants::error_range);
+ assert(std::regex_constants::error_brack != std::regex_constants::error_space);
+ assert(std::regex_constants::error_brack != std::regex_constants::error_badrepeat);
+ assert(std::regex_constants::error_brack != std::regex_constants::error_complexity);
+ assert(std::regex_constants::error_brack != std::regex_constants::error_stack);
+
+ assert(std::regex_constants::error_paren != std::regex_constants::error_brace);
+ assert(std::regex_constants::error_paren != std::regex_constants::error_badbrace);
+ assert(std::regex_constants::error_paren != std::regex_constants::error_range);
+ assert(std::regex_constants::error_paren != std::regex_constants::error_space);
+ assert(std::regex_constants::error_paren != std::regex_constants::error_badrepeat);
+ assert(std::regex_constants::error_paren != std::regex_constants::error_complexity);
+ assert(std::regex_constants::error_paren != std::regex_constants::error_stack);
+
+ assert(std::regex_constants::error_brace != std::regex_constants::error_badbrace);
+ assert(std::regex_constants::error_brace != std::regex_constants::error_range);
+ assert(std::regex_constants::error_brace != std::regex_constants::error_space);
+ assert(std::regex_constants::error_brace != std::regex_constants::error_badrepeat);
+ assert(std::regex_constants::error_brace != std::regex_constants::error_complexity);
+ assert(std::regex_constants::error_brace != std::regex_constants::error_stack);
+
+ assert(std::regex_constants::error_badbrace != std::regex_constants::error_range);
+ assert(std::regex_constants::error_badbrace != std::regex_constants::error_space);
+ assert(std::regex_constants::error_badbrace != std::regex_constants::error_badrepeat);
+ assert(std::regex_constants::error_badbrace != std::regex_constants::error_complexity);
+ assert(std::regex_constants::error_badbrace != std::regex_constants::error_stack);
+
+ assert(std::regex_constants::error_range != std::regex_constants::error_space);
+ assert(std::regex_constants::error_range != std::regex_constants::error_badrepeat);
+ assert(std::regex_constants::error_range != std::regex_constants::error_complexity);
+ assert(std::regex_constants::error_range != std::regex_constants::error_stack);
+
+ assert(std::regex_constants::error_space != std::regex_constants::error_badrepeat);
+ assert(std::regex_constants::error_space != std::regex_constants::error_complexity);
+ assert(std::regex_constants::error_space != std::regex_constants::error_stack);
+
+ assert(std::regex_constants::error_badrepeat != std::regex_constants::error_complexity);
+ assert(std::regex_constants::error_badrepeat != std::regex_constants::error_stack);
+
+ assert(std::regex_constants::error_complexity != std::regex_constants::error_stack);
+}
Added: libcxx/trunk/test/re/re.const/re.matchflag/match_flag_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.const/re.matchflag/match_flag_type.pass.cpp?rev=106187&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.const/re.matchflag/match_flag_type.pass.cpp (added)
+++ libcxx/trunk/test/re/re.const/re.matchflag/match_flag_type.pass.cpp Wed Jun 16 19:34:59 2010
@@ -0,0 +1,128 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// namespace regex_constants
+// {
+//
+// emum match_flag_type // bitmask type
+// {
+// match_default = 0,
+// match_not_bol = unspecified,
+// match_not_eol = unspecified,
+// match_not_bow = unspecified,
+// match_not_eow = unspecified,
+// match_any = unspecified,
+// match_not_null = unspecified,
+// match_continuous = unspecified,
+// match_prev_avail = unspecified,
+// format_default = 0,
+// format_sed = unspecified,
+// format_no_copy = unspecified,
+// format_first_only = unspecified
+// };
+//
+// }
+
+#include <regex>
+#include <cassert>
+
+int main()
+{
+ assert(std::regex_constants::match_default == 0);
+ assert(std::regex_constants::match_not_bol != 0);
+ assert(std::regex_constants::match_not_eol != 0);
+ assert(std::regex_constants::match_not_bow != 0);
+ assert(std::regex_constants::match_not_eow != 0);
+ assert(std::regex_constants::match_any != 0);
+ assert(std::regex_constants::match_not_null != 0);
+ assert(std::regex_constants::match_continuous != 0);
+ assert(std::regex_constants::match_prev_avail != 0);
+ assert(std::regex_constants::format_default == 0);
+ assert(std::regex_constants::format_sed != 0);
+ assert(std::regex_constants::format_no_copy != 0);
+ assert(std::regex_constants::format_first_only != 0);
+
+ assert((std::regex_constants::match_not_bol & std::regex_constants::match_not_eol) == 0);
+ assert((std::regex_constants::match_not_bol & std::regex_constants::match_not_bow) == 0);
+ assert((std::regex_constants::match_not_bol & std::regex_constants::match_not_eow) == 0);
+ assert((std::regex_constants::match_not_bol & std::regex_constants::match_any) == 0);
+ assert((std::regex_constants::match_not_bol & std::regex_constants::match_not_null) == 0);
+ assert((std::regex_constants::match_not_bol & std::regex_constants::match_continuous) == 0);
+ assert((std::regex_constants::match_not_bol & std::regex_constants::match_prev_avail) == 0);
+ assert((std::regex_constants::match_not_bol & std::regex_constants::format_sed) == 0);
+ assert((std::regex_constants::match_not_bol & std::regex_constants::format_no_copy) == 0);
+ assert((std::regex_constants::match_not_bol & std::regex_constants::format_first_only) == 0);
+
+ assert((std::regex_constants::match_not_eol & std::regex_constants::match_not_bow) == 0);
+ assert((std::regex_constants::match_not_eol & std::regex_constants::match_not_eow) == 0);
+ assert((std::regex_constants::match_not_eol & std::regex_constants::match_any) == 0);
+ assert((std::regex_constants::match_not_eol & std::regex_constants::match_not_null) == 0);
+ assert((std::regex_constants::match_not_eol & std::regex_constants::match_continuous) == 0);
+ assert((std::regex_constants::match_not_eol & std::regex_constants::match_prev_avail) == 0);
+ assert((std::regex_constants::match_not_eol & std::regex_constants::format_sed) == 0);
+ assert((std::regex_constants::match_not_eol & std::regex_constants::format_no_copy) == 0);
+ assert((std::regex_constants::match_not_eol & std::regex_constants::format_first_only) == 0);
+
+ assert((std::regex_constants::match_not_bow & std::regex_constants::match_not_eow) == 0);
+ assert((std::regex_constants::match_not_bow & std::regex_constants::match_any) == 0);
+ assert((std::regex_constants::match_not_bow & std::regex_constants::match_not_null) == 0);
+ assert((std::regex_constants::match_not_bow & std::regex_constants::match_continuous) == 0);
+ assert((std::regex_constants::match_not_bow & std::regex_constants::match_prev_avail) == 0);
+ assert((std::regex_constants::match_not_bow & std::regex_constants::format_sed) == 0);
+ assert((std::regex_constants::match_not_bow & std::regex_constants::format_no_copy) == 0);
+ assert((std::regex_constants::match_not_bow & std::regex_constants::format_first_only) == 0);
+
+ assert((std::regex_constants::match_not_eow & std::regex_constants::match_any) == 0);
+ assert((std::regex_constants::match_not_eow & std::regex_constants::match_not_null) == 0);
+ assert((std::regex_constants::match_not_eow & std::regex_constants::match_continuous) == 0);
+ assert((std::regex_constants::match_not_eow & std::regex_constants::match_prev_avail) == 0);
+ assert((std::regex_constants::match_not_eow & std::regex_constants::format_sed) == 0);
+ assert((std::regex_constants::match_not_eow & std::regex_constants::format_no_copy) == 0);
+ assert((std::regex_constants::match_not_eow & std::regex_constants::format_first_only) == 0);
+
+ assert((std::regex_constants::match_any & std::regex_constants::match_not_null) == 0);
+ assert((std::regex_constants::match_any & std::regex_constants::match_continuous) == 0);
+ assert((std::regex_constants::match_any & std::regex_constants::match_prev_avail) == 0);
+ assert((std::regex_constants::match_any & std::regex_constants::format_sed) == 0);
+ assert((std::regex_constants::match_any & std::regex_constants::format_no_copy) == 0);
+ assert((std::regex_constants::match_any & std::regex_constants::format_first_only) == 0);
+
+ assert((std::regex_constants::match_not_null & std::regex_constants::match_continuous) == 0);
+ assert((std::regex_constants::match_not_null & std::regex_constants::match_prev_avail) == 0);
+ assert((std::regex_constants::match_not_null & std::regex_constants::format_sed) == 0);
+ assert((std::regex_constants::match_not_null & std::regex_constants::format_no_copy) == 0);
+ assert((std::regex_constants::match_not_null & std::regex_constants::format_first_only) == 0);
+
+ assert((std::regex_constants::match_continuous & std::regex_constants::match_prev_avail) == 0);
+ assert((std::regex_constants::match_continuous & std::regex_constants::format_sed) == 0);
+ assert((std::regex_constants::match_continuous & std::regex_constants::format_no_copy) == 0);
+ assert((std::regex_constants::match_continuous & std::regex_constants::format_first_only) == 0);
+
+ assert((std::regex_constants::match_prev_avail & std::regex_constants::format_sed) == 0);
+ assert((std::regex_constants::match_prev_avail & std::regex_constants::format_no_copy) == 0);
+ assert((std::regex_constants::match_prev_avail & std::regex_constants::format_first_only) == 0);
+
+ assert((std::regex_constants::format_sed & std::regex_constants::format_no_copy) == 0);
+ assert((std::regex_constants::format_sed & std::regex_constants::format_first_only) == 0);
+
+ assert((std::regex_constants::format_no_copy & std::regex_constants::format_first_only) == 0);
+
+ std::regex_constants::match_flag_type e1 = std::regex_constants::match_not_bol;
+ std::regex_constants::match_flag_type e2 = std::regex_constants::match_not_eol;
+ e1 = ~e1;
+ e1 = e1 & e2;
+ e1 = e1 | e2;
+ e1 = e1 ^ e2;
+ e1 &= e2;
+ e1 |= e2;
+ e1 ^= e2;
+}
Added: libcxx/trunk/test/re/re.const/re.synopt/syntax_option_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.const/re.synopt/syntax_option_type.pass.cpp?rev=106187&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.const/re.synopt/syntax_option_type.pass.cpp (added)
+++ libcxx/trunk/test/re/re.const/re.synopt/syntax_option_type.pass.cpp Wed Jun 16 19:34:59 2010
@@ -0,0 +1,114 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// namespace regex_constants
+// {
+//
+// emum syntax_option_type // bitmask type
+// {
+// icase = unspecified,
+// nosubs = unspecified,
+// optimize = unspecified,
+// collate = unspecified,
+// ECMAScript = unspecified,
+// basic = unspecified,
+// extended = unspecified,
+// awk = unspecified,
+// grep = unspecified,
+// egrep = unspecified
+// };
+//
+// }
+
+#include <regex>
+#include <cassert>
+
+int main()
+{
+ assert(std::regex_constants::icase != 0);
+ assert(std::regex_constants::nosubs != 0);
+ assert(std::regex_constants::optimize != 0);
+ assert(std::regex_constants::collate != 0);
+ assert(std::regex_constants::ECMAScript != 0);
+ assert(std::regex_constants::basic != 0);
+ assert(std::regex_constants::extended != 0);
+ assert(std::regex_constants::awk != 0);
+ assert(std::regex_constants::grep != 0);
+ assert(std::regex_constants::egrep != 0);
+
+ assert((std::regex_constants::icase & std::regex_constants::nosubs) == 0);
+ assert((std::regex_constants::icase & std::regex_constants::optimize) == 0);
+ assert((std::regex_constants::icase & std::regex_constants::collate) == 0);
+ assert((std::regex_constants::icase & std::regex_constants::ECMAScript) == 0);
+ assert((std::regex_constants::icase & std::regex_constants::basic) == 0);
+ assert((std::regex_constants::icase & std::regex_constants::extended) == 0);
+ assert((std::regex_constants::icase & std::regex_constants::awk) == 0);
+ assert((std::regex_constants::icase & std::regex_constants::grep) == 0);
+ assert((std::regex_constants::icase & std::regex_constants::egrep) == 0);
+
+ assert((std::regex_constants::nosubs & std::regex_constants::optimize) == 0);
+ assert((std::regex_constants::nosubs & std::regex_constants::collate) == 0);
+ assert((std::regex_constants::nosubs & std::regex_constants::ECMAScript) == 0);
+ assert((std::regex_constants::nosubs & std::regex_constants::basic) == 0);
+ assert((std::regex_constants::nosubs & std::regex_constants::extended) == 0);
+ assert((std::regex_constants::nosubs & std::regex_constants::awk) == 0);
+ assert((std::regex_constants::nosubs & std::regex_constants::grep) == 0);
+ assert((std::regex_constants::nosubs & std::regex_constants::egrep) == 0);
+
+ assert((std::regex_constants::optimize & std::regex_constants::collate) == 0);
+ assert((std::regex_constants::optimize & std::regex_constants::ECMAScript) == 0);
+ assert((std::regex_constants::optimize & std::regex_constants::basic) == 0);
+ assert((std::regex_constants::optimize & std::regex_constants::extended) == 0);
+ assert((std::regex_constants::optimize & std::regex_constants::awk) == 0);
+ assert((std::regex_constants::optimize & std::regex_constants::grep) == 0);
+ assert((std::regex_constants::optimize & std::regex_constants::egrep) == 0);
+
+ assert((std::regex_constants::collate & std::regex_constants::ECMAScript) == 0);
+ assert((std::regex_constants::collate & std::regex_constants::basic) == 0);
+ assert((std::regex_constants::collate & std::regex_constants::extended) == 0);
+ assert((std::regex_constants::collate & std::regex_constants::awk) == 0);
+ assert((std::regex_constants::collate & std::regex_constants::grep) == 0);
+ assert((std::regex_constants::collate & std::regex_constants::egrep) == 0);
+
+ assert((std::regex_constants::ECMAScript & std::regex_constants::basic) == 0);
+ assert((std::regex_constants::ECMAScript & std::regex_constants::extended) == 0);
+ assert((std::regex_constants::ECMAScript & std::regex_constants::awk) == 0);
+ assert((std::regex_constants::ECMAScript & std::regex_constants::grep) == 0);
+ assert((std::regex_constants::ECMAScript & std::regex_constants::egrep) == 0);
+
+ assert((std::regex_constants::basic & std::regex_constants::extended) == 0);
+ assert((std::regex_constants::basic & std::regex_constants::awk) == 0);
+ assert((std::regex_constants::basic & std::regex_constants::grep) == 0);
+ assert((std::regex_constants::basic & std::regex_constants::egrep) == 0);
+
+ assert((std::regex_constants::extended & std::regex_constants::awk) == 0);
+ assert((std::regex_constants::extended & std::regex_constants::grep) == 0);
+ assert((std::regex_constants::extended & std::regex_constants::egrep) == 0);
+
+ assert((std::regex_constants::awk & std::regex_constants::grep) == 0);
+ assert((std::regex_constants::awk & std::regex_constants::egrep) == 0);
+
+ assert((std::regex_constants::grep & std::regex_constants::egrep) == 0);
+
+ assert((std::regex_constants::icase | std::regex_constants::nosubs) != 0);
+ assert((std::regex_constants::icase ^ std::regex_constants::nosubs) != 0);
+
+ std::regex_constants::syntax_option_type e1 = std::regex_constants::icase;
+ std::regex_constants::syntax_option_type e2 = std::regex_constants::nosubs;
+ e1 = ~e1;
+ e1 = e1 & e2;
+ e1 = e1 | e2;
+ e1 = e1 ^ e2;
+ e1 &= e2;
+ e1 |= e2;
+ e1 ^= e2;
+}
Added: libcxx/trunk/test/re/re.def/defns.regex.collating.element/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.def/defns.regex.collating.element/nothing_to_do.pass.cpp?rev=106187&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.def/defns.regex.collating.element/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/re/re.def/defns.regex.collating.element/nothing_to_do.pass.cpp Wed Jun 16 19:34:59 2010
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
Added: libcxx/trunk/test/re/re.def/defns.regex.finite.state.machine/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.def/defns.regex.finite.state.machine/nothing_to_do.pass.cpp?rev=106187&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.def/defns.regex.finite.state.machine/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/re/re.def/defns.regex.finite.state.machine/nothing_to_do.pass.cpp Wed Jun 16 19:34:59 2010
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
Added: libcxx/trunk/test/re/re.def/defns.regex.format.specifier/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.def/defns.regex.format.specifier/nothing_to_do.pass.cpp?rev=106187&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.def/defns.regex.format.specifier/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/re/re.def/defns.regex.format.specifier/nothing_to_do.pass.cpp Wed Jun 16 19:34:59 2010
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
Added: libcxx/trunk/test/re/re.def/defns.regex.matched/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.def/defns.regex.matched/nothing_to_do.pass.cpp?rev=106187&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.def/defns.regex.matched/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/re/re.def/defns.regex.matched/nothing_to_do.pass.cpp Wed Jun 16 19:34:59 2010
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
Added: libcxx/trunk/test/re/re.def/defns.regex.primary.equivalence.class/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.def/defns.regex.primary.equivalence.class/nothing_to_do.pass.cpp?rev=106187&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.def/defns.regex.primary.equivalence.class/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/re/re.def/defns.regex.primary.equivalence.class/nothing_to_do.pass.cpp Wed Jun 16 19:34:59 2010
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
Added: libcxx/trunk/test/re/re.def/defns.regex.regular.expression/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.def/defns.regex.regular.expression/nothing_to_do.pass.cpp?rev=106187&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.def/defns.regex.regular.expression/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/re/re.def/defns.regex.regular.expression/nothing_to_do.pass.cpp Wed Jun 16 19:34:59 2010
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
Added: libcxx/trunk/test/re/re.def/defns.regex.subexpression/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.def/defns.regex.subexpression/nothing_to_do.pass.cpp?rev=106187&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.def/defns.regex.subexpression/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/re/re.def/defns.regex.subexpression/nothing_to_do.pass.cpp Wed Jun 16 19:34:59 2010
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
Added: libcxx/trunk/test/re/re.def/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.def/nothing_to_do.pass.cpp?rev=106187&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.def/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/re/re.def/nothing_to_do.pass.cpp Wed Jun 16 19:34:59 2010
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
Added: libcxx/trunk/test/re/re.general/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.general/nothing_to_do.pass.cpp?rev=106187&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.general/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/re/re.general/nothing_to_do.pass.cpp Wed Jun 16 19:34:59 2010
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
Added: libcxx/trunk/test/re/re.req/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.req/nothing_to_do.pass.cpp?rev=106187&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.req/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/re/re.req/nothing_to_do.pass.cpp Wed Jun 16 19:34:59 2010
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
Added: libcxx/trunk/test/re/re.traits/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.traits/default.pass.cpp?rev=106187&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.traits/default.pass.cpp (added)
+++ libcxx/trunk/test/re/re.traits/default.pass.cpp Wed Jun 16 19:34:59 2010
@@ -0,0 +1,23 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// template <class charT> struct regex_traits;
+
+// regex_traits();
+
+#include <regex>
+
+int main()
+{
+ std::regex_traits<char> t1();
+ std::regex_traits<wchar_t> t2();
+}
Added: libcxx/trunk/test/re/re.traits/getloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.traits/getloc.pass.cpp?rev=106187&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.traits/getloc.pass.cpp (added)
+++ libcxx/trunk/test/re/re.traits/getloc.pass.cpp Wed Jun 16 19:34:59 2010
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// template <class charT> struct regex_traits;
+
+// locale_type getloc()const;
+
+#include <regex>
+
+int main()
+{
+#error getloc not implemented
+}
Added: libcxx/trunk/test/re/re.traits/imbue.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.traits/imbue.pass.cpp?rev=106187&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.traits/imbue.pass.cpp (added)
+++ libcxx/trunk/test/re/re.traits/imbue.pass.cpp Wed Jun 16 19:34:59 2010
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// template <class charT> struct regex_traits;
+
+// locale_type imbue(locale_type l);
+
+#include <regex>
+
+int main()
+{
+#error imbue not implemented
+}
Added: libcxx/trunk/test/re/re.traits/isctype.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.traits/isctype.pass.cpp?rev=106187&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.traits/isctype.pass.cpp (added)
+++ libcxx/trunk/test/re/re.traits/isctype.pass.cpp Wed Jun 16 19:34:59 2010
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// template <class charT> struct regex_traits;
+
+// bool isctype(charT c, char_class_type f) const;
+
+#include <regex>
+
+int main()
+{
+#error isctype not implemented
+}
Added: libcxx/trunk/test/re/re.traits/iterators.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.traits/iterators.h?rev=106187&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.traits/iterators.h (added)
+++ libcxx/trunk/test/re/re.traits/iterators.h Wed Jun 16 19:34:59 2010
@@ -0,0 +1,251 @@
+#ifndef ITERATORS_H
+#define ITERATORS_H
+
+#include <iterator>
+
+template <class It>
+class input_iterator
+{
+ It it_;
+
+ template <class U> friend class input_iterator;
+public:
+ typedef std::input_iterator_tag iterator_category;
+ typedef typename std::iterator_traits<It>::value_type value_type;
+ typedef typename std::iterator_traits<It>::difference_type difference_type;
+ typedef It pointer;
+ typedef typename std::iterator_traits<It>::reference reference;
+
+ It base() const {return it_;}
+
+ input_iterator() : it_() {}
+ explicit input_iterator(It it) : it_(it) {}
+ template <class U>
+ input_iterator(const input_iterator<U>& u) :it_(u.it_) {}
+
+ reference operator*() const {return *it_;}
+ pointer operator->() const {return it_;}
+
+ input_iterator& operator++() {++it_; return *this;}
+ input_iterator operator++(int)
+ {input_iterator tmp(*this); ++(*this); return tmp;}
+
+ friend bool operator==(const input_iterator& x, const input_iterator& y)
+ {return x.it_ == y.it_;}
+ friend bool operator!=(const input_iterator& x, const input_iterator& y)
+ {return !(x == y);}
+};
+
+template <class T, class U>
+inline
+bool
+operator==(const input_iterator<T>& x, const input_iterator<U>& y)
+{
+ return x.base() == y.base();
+}
+
+template <class T, class U>
+inline
+bool
+operator!=(const input_iterator<T>& x, const input_iterator<U>& y)
+{
+ return !(x == y);
+}
+
+template <class It>
+class forward_iterator
+{
+ It it_;
+
+ template <class U> friend class forward_iterator;
+public:
+ typedef std::forward_iterator_tag iterator_category;
+ typedef typename std::iterator_traits<It>::value_type value_type;
+ typedef typename std::iterator_traits<It>::difference_type difference_type;
+ typedef It pointer;
+ typedef typename std::iterator_traits<It>::reference reference;
+
+ It base() const {return it_;}
+
+ forward_iterator() : it_() {}
+ explicit forward_iterator(It it) : it_(it) {}
+ template <class U>
+ forward_iterator(const forward_iterator<U>& u) :it_(u.it_) {}
+
+ reference operator*() const {return *it_;}
+ pointer operator->() const {return it_;}
+
+ forward_iterator& operator++() {++it_; return *this;}
+ forward_iterator operator++(int)
+ {forward_iterator tmp(*this); ++(*this); return tmp;}
+
+ friend bool operator==(const forward_iterator& x, const forward_iterator& y)
+ {return x.it_ == y.it_;}
+ friend bool operator!=(const forward_iterator& x, const forward_iterator& y)
+ {return !(x == y);}
+};
+
+template <class T, class U>
+inline
+bool
+operator==(const forward_iterator<T>& x, const forward_iterator<U>& y)
+{
+ return x.base() == y.base();
+}
+
+template <class T, class U>
+inline
+bool
+operator!=(const forward_iterator<T>& x, const forward_iterator<U>& y)
+{
+ return !(x == y);
+}
+
+template <class It>
+class bidirectional_iterator
+{
+ It it_;
+
+ template <class U> friend class bidirectional_iterator;
+public:
+ typedef std::bidirectional_iterator_tag iterator_category;
+ typedef typename std::iterator_traits<It>::value_type value_type;
+ typedef typename std::iterator_traits<It>::difference_type difference_type;
+ typedef It pointer;
+ typedef typename std::iterator_traits<It>::reference reference;
+
+ It base() const {return it_;}
+
+ bidirectional_iterator() : it_() {}
+ explicit bidirectional_iterator(It it) : it_(it) {}
+ template <class U>
+ bidirectional_iterator(const bidirectional_iterator<U>& u) :it_(u.it_) {}
+
+ reference operator*() const {return *it_;}
+ pointer operator->() const {return it_;}
+
+ bidirectional_iterator& operator++() {++it_; return *this;}
+ bidirectional_iterator operator++(int)
+ {bidirectional_iterator tmp(*this); ++(*this); return tmp;}
+
+ bidirectional_iterator& operator--() {--it_; return *this;}
+ bidirectional_iterator operator--(int)
+ {bidirectional_iterator tmp(*this); --(*this); return tmp;}
+};
+
+template <class T, class U>
+inline
+bool
+operator==(const bidirectional_iterator<T>& x, const bidirectional_iterator<U>& y)
+{
+ return x.base() == y.base();
+}
+
+template <class T, class U>
+inline
+bool
+operator!=(const bidirectional_iterator<T>& x, const bidirectional_iterator<U>& y)
+{
+ return !(x == y);
+}
+
+template <class It>
+class random_access_iterator
+{
+ It it_;
+
+ template <class U> friend class random_access_iterator;
+public:
+ typedef std::random_access_iterator_tag iterator_category;
+ typedef typename std::iterator_traits<It>::value_type value_type;
+ typedef typename std::iterator_traits<It>::difference_type difference_type;
+ typedef It pointer;
+ typedef typename std::iterator_traits<It>::reference reference;
+
+ It base() const {return it_;}
+
+ random_access_iterator() : it_() {}
+ explicit random_access_iterator(It it) : it_(it) {}
+ template <class U>
+ random_access_iterator(const random_access_iterator<U>& u) :it_(u.it_) {}
+
+ reference operator*() const {return *it_;}
+ pointer operator->() const {return it_;}
+
+ random_access_iterator& operator++() {++it_; return *this;}
+ random_access_iterator operator++(int)
+ {random_access_iterator tmp(*this); ++(*this); return tmp;}
+
+ random_access_iterator& operator--() {--it_; return *this;}
+ random_access_iterator operator--(int)
+ {random_access_iterator tmp(*this); --(*this); return tmp;}
+
+ random_access_iterator& operator+=(difference_type n) {it_ += n; return *this;}
+ random_access_iterator operator+(difference_type n) const
+ {random_access_iterator tmp(*this); tmp += n; return tmp;}
+ friend random_access_iterator operator+(difference_type n, random_access_iterator x)
+ {x += n; return x;}
+ random_access_iterator& operator-=(difference_type n) {return *this += -n;}
+ random_access_iterator operator-(difference_type n) const
+ {random_access_iterator tmp(*this); tmp -= n; return tmp;}
+
+ reference operator[](difference_type n) const {return it_[n];}
+};
+
+template <class T, class U>
+inline
+bool
+operator==(const random_access_iterator<T>& x, const random_access_iterator<U>& y)
+{
+ return x.base() == y.base();
+}
+
+template <class T, class U>
+inline
+bool
+operator!=(const random_access_iterator<T>& x, const random_access_iterator<U>& y)
+{
+ return !(x == y);
+}
+
+template <class T, class U>
+inline
+bool
+operator<(const random_access_iterator<T>& x, const random_access_iterator<U>& y)
+{
+ return x.base() < y.base();
+}
+
+template <class T, class U>
+inline
+bool
+operator<=(const random_access_iterator<T>& x, const random_access_iterator<U>& y)
+{
+ return !(y < x);
+}
+
+template <class T, class U>
+inline
+bool
+operator>(const random_access_iterator<T>& x, const random_access_iterator<U>& y)
+{
+ return y < x;
+}
+
+template <class T, class U>
+inline
+bool
+operator>=(const random_access_iterator<T>& x, const random_access_iterator<U>& y)
+{
+ return !(x < y);
+}
+
+template <class T, class U>
+inline
+typename std::iterator_traits<T>::difference_type
+operator-(const random_access_iterator<T>& x, const random_access_iterator<U>& y)
+{
+ return x.base() - y.base();
+}
+
+#endif
Added: libcxx/trunk/test/re/re.traits/length.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.traits/length.pass.cpp?rev=106187&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.traits/length.pass.cpp (added)
+++ libcxx/trunk/test/re/re.traits/length.pass.cpp Wed Jun 16 19:34:59 2010
@@ -0,0 +1,31 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// template <class charT> struct regex_traits;
+
+// static std::size_t length(const char_type* p);
+
+#include <regex>
+#include <cassert>
+
+int main()
+{
+ assert(std::regex_traits<char>::length("") == 0);
+ assert(std::regex_traits<char>::length("1") == 1);
+ assert(std::regex_traits<char>::length("12") == 2);
+ assert(std::regex_traits<char>::length("123") == 3);
+
+ assert(std::regex_traits<wchar_t>::length(L"") == 0);
+ assert(std::regex_traits<wchar_t>::length(L"1") == 1);
+ assert(std::regex_traits<wchar_t>::length(L"12") == 2);
+ assert(std::regex_traits<wchar_t>::length(L"123") == 3);
+}
Added: libcxx/trunk/test/re/re.traits/lookup_classname.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.traits/lookup_classname.pass.cpp?rev=106187&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.traits/lookup_classname.pass.cpp (added)
+++ libcxx/trunk/test/re/re.traits/lookup_classname.pass.cpp Wed Jun 16 19:34:59 2010
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// template <class charT> struct regex_traits;
+
+// template <class ForwardIterator>
+// char_class_type
+// lookup_classname(ForwardIterator first, ForwardIterator last,
+// bool icase = false) const;
+
+#include <regex>
+
+int main()
+{
+#error lookup_classname not implemented
+}
Added: libcxx/trunk/test/re/re.traits/lookup_collatename.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.traits/lookup_collatename.pass.cpp?rev=106187&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.traits/lookup_collatename.pass.cpp (added)
+++ libcxx/trunk/test/re/re.traits/lookup_collatename.pass.cpp Wed Jun 16 19:34:59 2010
@@ -0,0 +1,187 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// template <class charT> struct regex_traits;
+
+// template <class ForwardIterator>
+// string_type
+// lookup_collatename(ForwardIterator first, ForwardIterator last) const;
+
+#include <iostream>
+
+#include <regex>
+#include <iterator>
+#include <cassert>
+#include "iterators.h"
+
+template <class char_type>
+void
+test(const char_type* A, const char_type* expected)
+{
+ std::regex_traits<char_type> t;
+ typedef forward_iterator<const char_type*> F;
+ assert(t.lookup_collatename(F(A), F(A + t.length(A))) == expected);
+}
+
+int main()
+{
+ test("NUL", "\x00");
+ test("alert", "\x07");
+ test("backspace", "\x08");
+ test("tab", "\x09");
+ test("carriage-return", "\x0D");
+ test("newline", "\x0A");
+ test("vertical-tab", "\x0B");
+ test("form-feed", "\x0C");
+ test("space", " ");
+ test("exclamation-mark", "!");
+ test("quotation-mark", "\"");
+ test("number-sign", "#");
+ test("dollar-sign", "$");
+ test("percent-sign", "%");
+ test("ampersand", "&");
+ test("apostrophe", "\'");
+ test("left-parenthesis", "(");
+ test("right-parenthesis", ")");
+ test("asterisk", "*");
+ test("plus-sign", "+");
+ test("comma", ",");
+ test("hyphen-minus", "-");
+ test("hyphen", "-");
+ test("full-stop", ".");
+ test("period", ".");
+ test("slash", "/");
+ test("solidus", "/");
+ test("zero", "0");
+ test("one", "1");
+ test("two", "2");
+ test("three", "3");
+ test("four", "4");
+ test("five", "5");
+ test("six", "6");
+ test("seven", "7");
+ test("eight", "8");
+ test("nine", "9");
+ test("colon", ":");
+ test("semicolon", ";");
+ test("less-than-sign", "<");
+ test("equals-sign", "=");
+ test("greater-than-sign", ">");
+ test("question-mark", "?");
+ test("commercial-at", "@");
+ for (char c = 'A'; c <= 'Z'; ++c)
+ {
+ const char a[2] = {c};
+ test(a, a);
+ }
+ test("left-square-bracket", "[");
+ test("backslash", "\\");
+ test("reverse-solidus", "\\");
+ test("right-square-bracket", "]");
+ test("circumflex-accent", "^");
+ test("circumflex", "^");
+ test("low-line", "_");
+ test("underscore", "_");
+ test("grave-accent", "`");
+ for (char c = 'a'; c <= 'z'; ++c)
+ {
+ const char a[2] = {c};
+ test(a, a);
+ }
+ test("left-brace", "{");
+ test("left-curly-bracket", "{");
+ test("vertical-line", "|");
+ test("right-brace", "}");
+ test("right-curly-bracket", "}");
+ test("tilde", "~");
+
+ test("tild", "");
+ test("ch", "");
+ std::locale::global(std::locale("cs_CZ.ISO8859-2"));
+ test("ch", "ch");
+ std::locale::global(std::locale("C"));
+
+ test(L"NUL", L"\x00");
+ test(L"alert", L"\x07");
+ test(L"backspace", L"\x08");
+ test(L"tab", L"\x09");
+ test(L"carriage-return", L"\x0D");
+ test(L"newline", L"\x0A");
+ test(L"vertical-tab", L"\x0B");
+ test(L"form-feed", L"\x0C");
+ test(L"space", L" ");
+ test(L"exclamation-mark", L"!");
+ test(L"quotation-mark", L"\"");
+ test(L"number-sign", L"#");
+ test(L"dollar-sign", L"$");
+ test(L"percent-sign", L"%");
+ test(L"ampersand", L"&");
+ test(L"apostrophe", L"\'");
+ test(L"left-parenthesis", L"(");
+ test(L"right-parenthesis", L")");
+ test(L"asterisk", L"*");
+ test(L"plus-sign", L"+");
+ test(L"comma", L",");
+ test(L"hyphen-minus", L"-");
+ test(L"hyphen", L"-");
+ test(L"full-stop", L".");
+ test(L"period", L".");
+ test(L"slash", L"/");
+ test(L"solidus", L"/");
+ test(L"zero", L"0");
+ test(L"one", L"1");
+ test(L"two", L"2");
+ test(L"three", L"3");
+ test(L"four", L"4");
+ test(L"five", L"5");
+ test(L"six", L"6");
+ test(L"seven", L"7");
+ test(L"eight", L"8");
+ test(L"nine", L"9");
+ test(L"colon", L":");
+ test(L"semicolon", L";");
+ test(L"less-than-sign", L"<");
+ test(L"equals-sign", L"=");
+ test(L"greater-than-sign", L">");
+ test(L"question-mark", L"?");
+ test(L"commercial-at", L"@");
+ for (wchar_t c = L'A'; c <= L'Z'; ++c)
+ {
+ const wchar_t a[2] = {c};
+ test(a, a);
+ }
+ test(L"left-square-bracket", L"[");
+ test(L"backslash", L"\\");
+ test(L"reverse-solidus", L"\\");
+ test(L"right-square-bracket", L"]");
+ test(L"circumflex-accent", L"^");
+ test(L"circumflex", L"^");
+ test(L"low-line", L"_");
+ test(L"underscore", L"_");
+ test(L"grave-accent", L"`");
+ for (wchar_t c = L'a'; c <= L'z'; ++c)
+ {
+ const wchar_t a[2] = {c};
+ test(a, a);
+ }
+ test(L"left-brace", L"{");
+ test(L"left-curly-bracket", L"{");
+ test(L"vertical-line", L"|");
+ test(L"right-brace", L"}");
+ test(L"right-curly-bracket", L"}");
+ test(L"tilde", L"~");
+
+ test(L"tild", L"");
+ test(L"ch", L"");
+ std::locale::global(std::locale("cs_CZ.ISO8859-2"));
+ test(L"ch", L"ch");
+ std::locale::global(std::locale("C"));
+}
Added: libcxx/trunk/test/re/re.traits/transform.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.traits/transform.pass.cpp?rev=106187&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.traits/transform.pass.cpp (added)
+++ libcxx/trunk/test/re/re.traits/transform.pass.cpp Wed Jun 16 19:34:59 2010
@@ -0,0 +1,42 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// template <class charT> struct regex_traits;
+
+// template <class ForwardIterator>
+// string_type transform(ForwardIterator first, ForwardIterator last) const;
+
+#include <regex>
+#include <cassert>
+#include "iterators.h"
+
+int main()
+{
+ {
+ std::regex_traits<char> t;
+ const char a[] = "a";
+ const char B[] = "B";
+ typedef forward_iterator<const char*> F;
+ assert(t.transform(F(a), F(a+1)) > t.transform(F(B), F(B+1)));
+ t.imbue(std::locale("cs_CZ.ISO8859-2"));
+ assert(t.transform(F(a), F(a+1)) < t.transform(F(B), F(B+1)));
+ }
+ {
+ std::regex_traits<wchar_t> t;
+ const wchar_t a[] = L"a";
+ const wchar_t B[] = L"B";
+ typedef forward_iterator<const wchar_t*> F;
+ assert(t.transform(F(a), F(a+1)) > t.transform(F(B), F(B+1)));
+ t.imbue(std::locale("cs_CZ.ISO8859-2"));
+ assert(t.transform(F(a), F(a+1)) < t.transform(F(B), F(B+1)));
+ }
+}
Added: libcxx/trunk/test/re/re.traits/transform_primary.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.traits/transform_primary.pass.cpp?rev=106187&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.traits/transform_primary.pass.cpp (added)
+++ libcxx/trunk/test/re/re.traits/transform_primary.pass.cpp Wed Jun 16 19:34:59 2010
@@ -0,0 +1,49 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// template <class charT> struct regex_traits;
+
+// template <class ForwardIterator>
+// string_type
+// transform_primary(ForwardIterator first, ForwardIterator last) const;
+
+#include <iostream>
+
+#include <regex>
+#include <cassert>
+#include "iterators.h"
+
+int main()
+{
+ {
+ std::regex_traits<char> t;
+ const char A[] = "A";
+ const char Aacute[] = "\xC1";
+ typedef forward_iterator<const char*> F;
+ assert(t.transform_primary(F(A), F(A+1)) !=
+ t.transform_primary(F(Aacute), F(Aacute+1)));
+ t.imbue(std::locale("cs_CZ.ISO8859-2"));
+ assert(t.transform_primary(F(A), F(A+1)) ==
+ t.transform_primary(F(Aacute), F(Aacute+1)));
+ }
+ {
+ std::regex_traits<wchar_t> t;
+ const wchar_t A[] = L"A";
+ const wchar_t Aacute[] = L"\xC1";
+ typedef forward_iterator<const wchar_t*> F;
+ assert(t.transform_primary(F(A), F(A+1)) !=
+ t.transform_primary(F(Aacute), F(Aacute+1)));
+ t.imbue(std::locale("cs_CZ.ISO8859-2"));
+ assert(t.transform_primary(F(A), F(A+1)) ==
+ t.transform_primary(F(Aacute), F(Aacute+1)));
+ }
+}
Added: libcxx/trunk/test/re/re.traits/translate.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.traits/translate.pass.cpp?rev=106187&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.traits/translate.pass.cpp (added)
+++ libcxx/trunk/test/re/re.traits/translate.pass.cpp Wed Jun 16 19:34:59 2010
@@ -0,0 +1,34 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// template <class charT> struct regex_traits;
+
+// charT translate(charT c) const;
+
+#include <regex>
+#include <cassert>
+
+int main()
+{
+ {
+ std::regex_traits<char> t;
+ assert(t.translate('a') == 'a');
+ assert(t.translate('B') == 'B');
+ assert(t.translate('c') == 'c');
+ }
+ {
+ std::regex_traits<wchar_t> t;
+ assert(t.translate(L'a') == L'a');
+ assert(t.translate(L'B') == L'B');
+ assert(t.translate(L'c') == L'c');
+ }
+}
Added: libcxx/trunk/test/re/re.traits/translate_nocase.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.traits/translate_nocase.pass.cpp?rev=106187&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.traits/translate_nocase.pass.cpp (added)
+++ libcxx/trunk/test/re/re.traits/translate_nocase.pass.cpp Wed Jun 16 19:34:59 2010
@@ -0,0 +1,62 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// template <class charT> struct regex_traits;
+
+// charT translate_nocase(charT c) const;
+
+#include <regex>
+#include <cassert>
+
+int main()
+{
+ {
+ std::regex_traits<char> t;
+ assert(t.translate_nocase(' ') == ' ');
+ assert(t.translate_nocase('A') == 'a');
+ assert(t.translate_nocase('\x07') == '\x07');
+ assert(t.translate_nocase('.') == '.');
+ assert(t.translate_nocase('a') == 'a');
+ assert(t.translate_nocase('1') == '1');
+ assert(t.translate_nocase('\xDA') == '\xDA');
+ assert(t.translate_nocase('\xFA') == '\xFA');
+ t.imbue(std::locale("en_US"));
+ assert(t.translate_nocase(' ') == ' ');
+ assert(t.translate_nocase('A') == 'a');
+ assert(t.translate_nocase('\x07') == '\x07');
+ assert(t.translate_nocase('.') == '.');
+ assert(t.translate_nocase('a') == 'a');
+ assert(t.translate_nocase('1') == '1');
+ assert(t.translate_nocase('\xDA') == '\xDA');
+ assert(t.translate_nocase('\xFA') == '\xFA');
+ }
+ {
+ std::regex_traits<wchar_t> t;
+ assert(t.translate_nocase(L' ') == L' ');
+ assert(t.translate_nocase(L'A') == L'a');
+ assert(t.translate_nocase(L'\x07') == L'\x07');
+ assert(t.translate_nocase(L'.') == L'.');
+ assert(t.translate_nocase(L'a') == L'a');
+ assert(t.translate_nocase(L'1') == L'1');
+ assert(t.translate_nocase(L'\xDA') == L'\xDA');
+ assert(t.translate_nocase(L'\xFA') == L'\xFA');
+ t.imbue(std::locale("en_US"));
+ assert(t.translate_nocase(L' ') == L' ');
+ assert(t.translate_nocase(L'A') == L'a');
+ assert(t.translate_nocase(L'\x07') == L'\x07');
+ assert(t.translate_nocase(L'.') == L'.');
+ assert(t.translate_nocase(L'a') == L'a');
+ assert(t.translate_nocase(L'1') == L'1');
+ assert(t.translate_nocase(L'\xDA') == L'\xFA');
+ assert(t.translate_nocase(L'\xFA') == L'\xFA');
+ }
+}
Added: libcxx/trunk/test/re/re.traits/types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.traits/types.pass.cpp?rev=106187&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.traits/types.pass.cpp (added)
+++ libcxx/trunk/test/re/re.traits/types.pass.cpp Wed Jun 16 19:34:59 2010
@@ -0,0 +1,32 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// template <class charT>
+// struct regex_traits
+// {
+// public:
+// typedef charT char_type;
+// typedef basic_string<char_type> string_type;
+// typedef locale locale_type;
+
+#include <regex>
+#include <type_traits>
+
+int main()
+{
+ static_assert((std::is_same<std::regex_traits<char>::char_type, char>::value), "");
+ static_assert((std::is_same<std::regex_traits<char>::string_type, std::string>::value), "");
+ static_assert((std::is_same<std::regex_traits<char>::locale_type, std::locale>::value), "");
+ static_assert((std::is_same<std::regex_traits<wchar_t>::char_type, wchar_t>::value), "");
+ static_assert((std::is_same<std::regex_traits<wchar_t>::string_type, std::wstring>::value), "");
+ static_assert((std::is_same<std::regex_traits<wchar_t>::locale_type, std::locale>::value), "");
+}
Added: libcxx/trunk/test/re/re.traits/value.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/re/re.traits/value.pass.cpp?rev=106187&view=auto
==============================================================================
--- libcxx/trunk/test/re/re.traits/value.pass.cpp (added)
+++ libcxx/trunk/test/re/re.traits/value.pass.cpp Wed Jun 16 19:34:59 2010
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// template <class charT> struct regex_traits;
+
+// int value(charT ch, int radix) const;
+
+#include <regex>
+
+int main()
+{
+#error value not implemented
+}
More information about the cfe-commits
mailing list