Just getting our toes wet on <regex>
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@106187 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4b3a0887d0
commit
3257c9853f
1121
include/regex
Normal file
1121
include/regex
Normal file
File diff suppressed because it is too large
Load Diff
203
src/regex.cpp
Normal file
203
src/regex.cpp
Normal file
@ -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
|
13
test/re/nothing_to_do.pass.cpp
Normal file
13
test/re/nothing_to_do.pass.cpp
Normal file
@ -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()
|
||||
{
|
||||
}
|
91
test/re/re.badexp/regex_error.pass.cpp
Normal file
91
test/re/re.badexp/regex_error.pass.cpp
Normal file
@ -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"));
|
||||
}
|
||||
}
|
13
test/re/re.const/nothing_to_do.pass.cpp
Normal file
13
test/re/re.const/nothing_to_do.pass.cpp
Normal file
@ -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()
|
||||
{
|
||||
}
|
143
test/re/re.const/re.err/error_type.pass.cpp
Normal file
143
test/re/re.const/re.err/error_type.pass.cpp
Normal file
@ -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);
|
||||
}
|
128
test/re/re.const/re.matchflag/match_flag_type.pass.cpp
Normal file
128
test/re/re.const/re.matchflag/match_flag_type.pass.cpp
Normal file
@ -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;
|
||||
}
|
114
test/re/re.const/re.synopt/syntax_option_type.pass.cpp
Normal file
114
test/re/re.const/re.synopt/syntax_option_type.pass.cpp
Normal file
@ -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;
|
||||
}
|
@ -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()
|
||||
{
|
||||
}
|
@ -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()
|
||||
{
|
||||
}
|
@ -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()
|
||||
{
|
||||
}
|
13
test/re/re.def/defns.regex.matched/nothing_to_do.pass.cpp
Normal file
13
test/re/re.def/defns.regex.matched/nothing_to_do.pass.cpp
Normal file
@ -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()
|
||||
{
|
||||
}
|
@ -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()
|
||||
{
|
||||
}
|
@ -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()
|
||||
{
|
||||
}
|
@ -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()
|
||||
{
|
||||
}
|
13
test/re/re.def/nothing_to_do.pass.cpp
Normal file
13
test/re/re.def/nothing_to_do.pass.cpp
Normal file
@ -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()
|
||||
{
|
||||
}
|
13
test/re/re.general/nothing_to_do.pass.cpp
Normal file
13
test/re/re.general/nothing_to_do.pass.cpp
Normal file
@ -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()
|
||||
{
|
||||
}
|
13
test/re/re.req/nothing_to_do.pass.cpp
Normal file
13
test/re/re.req/nothing_to_do.pass.cpp
Normal file
@ -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()
|
||||
{
|
||||
}
|
23
test/re/re.traits/default.pass.cpp
Normal file
23
test/re/re.traits/default.pass.cpp
Normal file
@ -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();
|
||||
}
|
21
test/re/re.traits/getloc.pass.cpp
Normal file
21
test/re/re.traits/getloc.pass.cpp
Normal file
@ -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
|
||||
}
|
21
test/re/re.traits/imbue.pass.cpp
Normal file
21
test/re/re.traits/imbue.pass.cpp
Normal file
@ -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
|
||||
}
|
21
test/re/re.traits/isctype.pass.cpp
Normal file
21
test/re/re.traits/isctype.pass.cpp
Normal file
@ -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
|
||||
}
|
251
test/re/re.traits/iterators.h
Normal file
251
test/re/re.traits/iterators.h
Normal file
@ -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
|
31
test/re/re.traits/length.pass.cpp
Normal file
31
test/re/re.traits/length.pass.cpp
Normal file
@ -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);
|
||||
}
|
24
test/re/re.traits/lookup_classname.pass.cpp
Normal file
24
test/re/re.traits/lookup_classname.pass.cpp
Normal file
@ -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
|
||||
}
|
187
test/re/re.traits/lookup_collatename.pass.cpp
Normal file
187
test/re/re.traits/lookup_collatename.pass.cpp
Normal file
@ -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"));
|
||||
}
|
42
test/re/re.traits/transform.pass.cpp
Normal file
42
test/re/re.traits/transform.pass.cpp
Normal file
@ -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)));
|
||||
}
|
||||
}
|
49
test/re/re.traits/transform_primary.pass.cpp
Normal file
49
test/re/re.traits/transform_primary.pass.cpp
Normal file
@ -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)));
|
||||
}
|
||||
}
|
34
test/re/re.traits/translate.pass.cpp
Normal file
34
test/re/re.traits/translate.pass.cpp
Normal file
@ -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');
|
||||
}
|
||||
}
|
62
test/re/re.traits/translate_nocase.pass.cpp
Normal file
62
test/re/re.traits/translate_nocase.pass.cpp
Normal file
@ -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');
|
||||
}
|
||||
}
|
32
test/re/re.traits/types.pass.cpp
Normal file
32
test/re/re.traits/types.pass.cpp
Normal file
@ -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), "");
|
||||
}
|
21
test/re/re.traits/value.pass.cpp
Normal file
21
test/re/re.traits/value.pass.cpp
Normal file
@ -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
|
||||
}
|
Loading…
Reference in New Issue
Block a user