Initial regex implementation.
2010-06-25 Stephen M. Webb <stephen.webb@bregmasoft.ca> Initial regex implementation. * include/std/regex: Modified to use bits/regex_* headers. * include/bits/regex_compiler.h: New file. * include/bits/regex_constants.h: New file. * include/bits/regex_cursor.h: New file. * include/bits/regex_error.h: New file. * include/bits/regex_grep_matcher.h: New file. * include/bits/regex_grep_matcher.tcc: New file. * include/bits/regex.h: New file. * include/bits/regex_nfa.h: New file. * include/bits/regex_nfa.tcc: New file. * include/Makefile.am: Added above new files. * include/Makefile.in: Regenerated. * testsuite/28_regex/02_definitions: New file. * testsuite/28_regex/03_requirements: New file. * testsuite/28_regex/03_requirements/typedefs.cc: New file. * testsuite/28_regex/04_header: New file. * testsuite/28_regex/04_header/regex: New file. * testsuite/28_regex/04_header/regex/std_c++0x_neg.cc: New file. * testsuite/28_regex/05_constants: New file. * testsuite/28_regex/05_constants/error_type.cc: New file. * testsuite/28_regex/05_constants/match_flag_type.cc: New file. * testsuite/28_regex/05_constants/syntax_option_type.cc: New file. * testsuite/28_regex/06_exception_type: New file. * testsuite/28_regex/06_exception_type/regex_error.cc: New file. * testsuite/28_regex/07_traits: New file. * testsuite/28_regex/07_traits/char: New file. * testsuite/28_regex/07_traits/char/ctor.cc: New file. * testsuite/28_regex/07_traits/char/isctype.cc: New file. * testsuite/28_regex/07_traits/char/length.cc: New file. * testsuite/28_regex/07_traits/char/lookup_classname.cc: New file. * testsuite/28_regex/07_traits/char/lookup_collatename.cc: New file. * testsuite/28_regex/07_traits/char/transform.cc: New file. * testsuite/28_regex/07_traits/char/transform_primary.cc: New file. * testsuite/28_regex/07_traits/char/translate.cc: New file. * testsuite/28_regex/07_traits/char/translate_nocase.cc: New file. * testsuite/28_regex/07_traits/char/value.cc: New file. * testsuite/28_regex/07_traits/wchar_t: New file. * testsuite/28_regex/07_traits/wchar_t/ctor.cc: New file. * testsuite/28_regex/07_traits/wchar_t/length.cc: New file. * testsuite/28_regex/07_traits/wchar_t/transform.cc: New file. * testsuite/28_regex/07_traits/wchar_t/translate.cc: New file. * testsuite/28_regex/07_traits/wchar_t/translate_nocase.cc: New file. * testsuite/28_regex/07_traits/wchar_t/value.cc: New file. * testsuite/28_regex/08_basic_regex: New file. * testsuite/28_regex/08_basic_regex/assign: New file. * testsuite/28_regex/08_basic_regex/assign/char: New file. * testsuite/28_regex/08_basic_regex/assign/char/cstring.cc: New file. * testsuite/28_regex/08_basic_regex/assign/char/cstring_op.cc: New file. * testsuite/28_regex/08_basic_regex/assign/char/moveable.cc: New file. * testsuite/28_regex/08_basic_regex/assign/char/pstring.cc: New file. * testsuite/28_regex/08_basic_regex/assign/char/range.cc: New file. * testsuite/28_regex/08_basic_regex/assign/char/string.cc: New file. * testsuite/28_regex/08_basic_regex/assign/char/string_op.cc: New file. * testsuite/28_regex/08_basic_regex/assign/wchar_t: New file. * testsuite/28_regex/08_basic_regex/assign/wchar_t/cstring.cc: New file. * testsuite/28_regex/08_basic_regex/assign/wchar_t/cstring_op.cc: New file. * testsuite/28_regex/08_basic_regex/assign/wchar_t/pstring.cc: New file. * testsuite/28_regex/08_basic_regex/assign/wchar_t/range.cc: New file. * testsuite/28_regex/08_basic_regex/assign/wchar_t/string.cc: New file. * testsuite/28_regex/08_basic_regex/assign/wchar_t/string_op.cc: New file. * testsuite/28_regex/08_basic_regex/ctors: New file. * testsuite/28_regex/08_basic_regex/ctors/basic: New file. * testsuite/28_regex/08_basic_regex/ctors/basic/cstring.cc: New file. * testsuite/28_regex/08_basic_regex/ctors/basic/pstring_char.cc: New file. * testsuite/28_regex/08_basic_regex/ctors/basic/pstring_wchar_t.cc: New file. * testsuite/28_regex/08_basic_regex/ctors/basic/string_range_01_02_03.cc: New file. * testsuite/28_regex/08_basic_regex/ctors/char: New file. * testsuite/28_regex/08_basic_regex/ctors/char/cstring_awk.cc: New file. * testsuite/28_regex/08_basic_regex/ctors/char/cstring.cc: New file. * testsuite/28_regex/08_basic_regex/ctors/char/cstring_ecma.cc: New file. * testsuite/28_regex/08_basic_regex/ctors/char/cstring_egrep.cc: New file. * testsuite/28_regex/08_basic_regex/ctors/char/cstring_grep.cc: New file. * testsuite/28_regex/08_basic_regex/ctors/char/default.cc: New file. * testsuite/28_regex/08_basic_regex/ctors/char/range.cc: New file. * testsuite/28_regex/08_basic_regex/ctors/copy_char.cc: New file. * testsuite/28_regex/08_basic_regex/ctors/extended: New file. * testsuite/28_regex/08_basic_regex/ctors/extended/cstring.cc: New file. * testsuite/28_regex/08_basic_regex/ctors/extended/string_range_01_02_03.cc: New file. * testsuite/28_regex/08_basic_regex/ctors/move_char.cc: New file. * testsuite/28_regex/08_basic_regex/ctors/string_char.cc: New file. * testsuite/28_regex/08_basic_regex/ctors/string_wchar_t.cc: New file. * testsuite/28_regex/08_basic_regex/ctors/wchar_t: New file. * testsuite/28_regex/08_basic_regex/ctors/wchar_t/cstring.cc: New file. * testsuite/28_regex/08_basic_regex/ctors/wchar_t/default.cc: New file. * testsuite/28_regex/08_basic_regex/ctors/wchar_t/range.cc: New file. * testsuite/28_regex/08_basic_regex/regex.cc: New file. * testsuite/28_regex/09_sub_match: New file. * testsuite/28_regex/09_sub_match/cast_char.cc: New file. * testsuite/28_regex/09_sub_match/cast_wchar_t.cc: New file. * testsuite/28_regex/09_sub_match/length.cc: New file. * testsuite/28_regex/09_sub_match/typedefs.cc: New file. * testsuite/28_regex/10_match_results: New file. * testsuite/28_regex/10_match_results/ctors: New file. * testsuite/28_regex/10_match_results/ctors/char: New file. * testsuite/28_regex/10_match_results/ctors/char/default.cc: New file. * testsuite/28_regex/10_match_results/ctors/wchar_t: New file. * testsuite/28_regex/10_match_results/ctors/wchar_t/default.cc: New file. * testsuite/28_regex/10_match_results/typedefs.cc: New file. * testsuite/28_regex/11_algorithms: New file. * testsuite/28_regex/11_algorithms/02_match: New file. * testsuite/28_regex/11_algorithms/02_match/basic: New file. * testsuite/28_regex/11_algorithms/02_match/basic/string_01.cc: New file. * testsuite/28_regex/11_algorithms/02_match/basic/string_range_00_03.cc: New file. * testsuite/28_regex/11_algorithms/02_match/basic/string_range_01_03.cc: New file. * testsuite/28_regex/11_algorithms/02_match/basic/string_range_02_03.cc: New file. * testsuite/28_regex/11_algorithms/02_match/extended: New file. * testsuite/28_regex/11_algorithms/02_match/extended/cstring_plus.cc: New file. * testsuite/28_regex/11_algorithms/02_match/extended/cstring_questionmark.cc: New file. * testsuite/28_regex/11_algorithms/02_match/extended/string_any.cc: New file. * testsuite/28_regex/11_algorithms/02_match/extended/string_range_00_03.cc: New file. * testsuite/28_regex/11_algorithms/02_match/extended/string_range_01_03.cc: New file. * testsuite/28_regex/11_algorithms/02_match/extended/string_range_02_03.cc: New file. * testsuite/28_regex/12_iterators: New file. * testsuite/28_regex/12_iterators/regex_iterator: New file. * testsuite/28_regex/12_iterators/regex_iterator/ctors: New file. * testsuite/28_regex/12_iterators/regex_iterator/ctors/char: New file. * testsuite/28_regex/12_iterators/regex_iterator/ctors/char/default.cc: New file. * testsuite/28_regex/12_iterators/regex_iterator/ctors/wchar_t: New file. * testsuite/28_regex/12_iterators/regex_iterator/ctors/wchar_t/default.cc: New file. * testsuite/28_regex/12_iterators/regex_iterator/typedefs.cc: New file. * testsuite/28_regex/12_iterators/regex_token_iterator: New file. * testsuite/28_regex/12_iterators/regex_token_iterator/ctors: New file. * testsuite/28_regex/12_iterators/regex_token_iterator/ctors/char: New file. * testsuite/28_regex/12_iterators/regex_token_iterator/ctors/char/default.cc: New file. * testsuite/28_regex/12_iterators/regex_token_iterator/ctors/wchar_t: New file. * testsuite/28_regex/12_iterators/regex_token_iterator/ctors/wchar_t/default.cc: New file. * testsuite/28_regex/12_iterators/regex_token_iterator/typedefs.cc: New file. * testsuite/28_regex/13_ecmascript: New file. From-SVN: r161410
This commit is contained in:
parent
58fc89f6b9
commit
849cab7b75
@ -1,3 +1,149 @@
|
||||
2010-06-25 Stephen M. Webb <stephen.webb@bregmasoft.ca>
|
||||
|
||||
Initial regex implementation.
|
||||
|
||||
* include/std/regex: Modified to use bits/regex_* headers.
|
||||
* include/bits/regex_compiler.h: New file.
|
||||
* include/bits/regex_constants.h: New file.
|
||||
* include/bits/regex_cursor.h: New file.
|
||||
* include/bits/regex_error.h: New file.
|
||||
* include/bits/regex_grep_matcher.h: New file.
|
||||
* include/bits/regex_grep_matcher.tcc: New file.
|
||||
* include/bits/regex.h: New file.
|
||||
* include/bits/regex_nfa.h: New file.
|
||||
* include/bits/regex_nfa.tcc: New file.
|
||||
* include/Makefile.am: Added above new files.
|
||||
* include/Makefile.in: Regenerated.
|
||||
* testsuite/28_regex/02_definitions: New file.
|
||||
* testsuite/28_regex/03_requirements: New file.
|
||||
* testsuite/28_regex/03_requirements/typedefs.cc: New file.
|
||||
* testsuite/28_regex/04_header: New file.
|
||||
* testsuite/28_regex/04_header/regex: New file.
|
||||
* testsuite/28_regex/04_header/regex/std_c++0x_neg.cc: New file.
|
||||
* testsuite/28_regex/05_constants: New file.
|
||||
* testsuite/28_regex/05_constants/error_type.cc: New file.
|
||||
* testsuite/28_regex/05_constants/match_flag_type.cc: New file.
|
||||
* testsuite/28_regex/05_constants/syntax_option_type.cc: New file.
|
||||
* testsuite/28_regex/06_exception_type: New file.
|
||||
* testsuite/28_regex/06_exception_type/regex_error.cc: New file.
|
||||
* testsuite/28_regex/07_traits: New file.
|
||||
* testsuite/28_regex/07_traits/char: New file.
|
||||
* testsuite/28_regex/07_traits/char/ctor.cc: New file.
|
||||
* testsuite/28_regex/07_traits/char/isctype.cc: New file.
|
||||
* testsuite/28_regex/07_traits/char/length.cc: New file.
|
||||
* testsuite/28_regex/07_traits/char/lookup_classname.cc: New file.
|
||||
* testsuite/28_regex/07_traits/char/lookup_collatename.cc: New file.
|
||||
* testsuite/28_regex/07_traits/char/transform.cc: New file.
|
||||
* testsuite/28_regex/07_traits/char/transform_primary.cc: New file.
|
||||
* testsuite/28_regex/07_traits/char/translate.cc: New file.
|
||||
* testsuite/28_regex/07_traits/char/translate_nocase.cc: New file.
|
||||
* testsuite/28_regex/07_traits/char/value.cc: New file.
|
||||
* testsuite/28_regex/07_traits/wchar_t: New file.
|
||||
* testsuite/28_regex/07_traits/wchar_t/ctor.cc: New file.
|
||||
* testsuite/28_regex/07_traits/wchar_t/length.cc: New file.
|
||||
* testsuite/28_regex/07_traits/wchar_t/transform.cc: New file.
|
||||
* testsuite/28_regex/07_traits/wchar_t/translate.cc: New file.
|
||||
* testsuite/28_regex/07_traits/wchar_t/translate_nocase.cc: New file.
|
||||
* testsuite/28_regex/07_traits/wchar_t/value.cc: New file.
|
||||
* testsuite/28_regex/08_basic_regex: New file.
|
||||
* testsuite/28_regex/08_basic_regex/assign: New file.
|
||||
* testsuite/28_regex/08_basic_regex/assign/char: New file.
|
||||
* testsuite/28_regex/08_basic_regex/assign/char/cstring.cc: New file.
|
||||
* testsuite/28_regex/08_basic_regex/assign/char/cstring_op.cc: New file.
|
||||
* testsuite/28_regex/08_basic_regex/assign/char/moveable.cc: New file.
|
||||
* testsuite/28_regex/08_basic_regex/assign/char/pstring.cc: New file.
|
||||
* testsuite/28_regex/08_basic_regex/assign/char/range.cc: New file.
|
||||
* testsuite/28_regex/08_basic_regex/assign/char/string.cc: New file.
|
||||
* testsuite/28_regex/08_basic_regex/assign/char/string_op.cc: New file.
|
||||
* testsuite/28_regex/08_basic_regex/assign/wchar_t: New file.
|
||||
* testsuite/28_regex/08_basic_regex/assign/wchar_t/cstring.cc: New file.
|
||||
* testsuite/28_regex/08_basic_regex/assign/wchar_t/cstring_op.cc: New file.
|
||||
* testsuite/28_regex/08_basic_regex/assign/wchar_t/pstring.cc: New file.
|
||||
* testsuite/28_regex/08_basic_regex/assign/wchar_t/range.cc: New file.
|
||||
* testsuite/28_regex/08_basic_regex/assign/wchar_t/string.cc: New file.
|
||||
* testsuite/28_regex/08_basic_regex/assign/wchar_t/string_op.cc: New file.
|
||||
* testsuite/28_regex/08_basic_regex/ctors: New file.
|
||||
* testsuite/28_regex/08_basic_regex/ctors/basic: New file.
|
||||
* testsuite/28_regex/08_basic_regex/ctors/basic/cstring.cc: New file.
|
||||
* testsuite/28_regex/08_basic_regex/ctors/basic/pstring_char.cc: New file.
|
||||
* testsuite/28_regex/08_basic_regex/ctors/basic/pstring_wchar_t.cc: New file.
|
||||
* testsuite/28_regex/08_basic_regex/ctors/basic/string_range_01_02_03.cc:
|
||||
New file.
|
||||
* testsuite/28_regex/08_basic_regex/ctors/char: New file.
|
||||
* testsuite/28_regex/08_basic_regex/ctors/char/cstring_awk.cc: New file.
|
||||
* testsuite/28_regex/08_basic_regex/ctors/char/cstring.cc: New file.
|
||||
* testsuite/28_regex/08_basic_regex/ctors/char/cstring_ecma.cc: New file.
|
||||
* testsuite/28_regex/08_basic_regex/ctors/char/cstring_egrep.cc: New file.
|
||||
* testsuite/28_regex/08_basic_regex/ctors/char/cstring_grep.cc: New file.
|
||||
* testsuite/28_regex/08_basic_regex/ctors/char/default.cc: New file.
|
||||
* testsuite/28_regex/08_basic_regex/ctors/char/range.cc: New file.
|
||||
* testsuite/28_regex/08_basic_regex/ctors/copy_char.cc: New file.
|
||||
* testsuite/28_regex/08_basic_regex/ctors/extended: New file.
|
||||
* testsuite/28_regex/08_basic_regex/ctors/extended/cstring.cc: New file.
|
||||
* testsuite/28_regex/08_basic_regex/ctors/extended/string_range_01_02_03.cc:
|
||||
New file.
|
||||
* testsuite/28_regex/08_basic_regex/ctors/move_char.cc: New file.
|
||||
* testsuite/28_regex/08_basic_regex/ctors/string_char.cc: New file.
|
||||
* testsuite/28_regex/08_basic_regex/ctors/string_wchar_t.cc: New file.
|
||||
* testsuite/28_regex/08_basic_regex/ctors/wchar_t: New file.
|
||||
* testsuite/28_regex/08_basic_regex/ctors/wchar_t/cstring.cc: New file.
|
||||
* testsuite/28_regex/08_basic_regex/ctors/wchar_t/default.cc: New file.
|
||||
* testsuite/28_regex/08_basic_regex/ctors/wchar_t/range.cc: New file.
|
||||
* testsuite/28_regex/08_basic_regex/regex.cc: New file.
|
||||
* testsuite/28_regex/09_sub_match: New file.
|
||||
* testsuite/28_regex/09_sub_match/cast_char.cc: New file.
|
||||
* testsuite/28_regex/09_sub_match/cast_wchar_t.cc: New file.
|
||||
* testsuite/28_regex/09_sub_match/length.cc: New file.
|
||||
* testsuite/28_regex/09_sub_match/typedefs.cc: New file.
|
||||
* testsuite/28_regex/10_match_results: New file.
|
||||
* testsuite/28_regex/10_match_results/ctors: New file.
|
||||
* testsuite/28_regex/10_match_results/ctors/char: New file.
|
||||
* testsuite/28_regex/10_match_results/ctors/char/default.cc: New file.
|
||||
* testsuite/28_regex/10_match_results/ctors/wchar_t: New file.
|
||||
* testsuite/28_regex/10_match_results/ctors/wchar_t/default.cc: New file.
|
||||
* testsuite/28_regex/10_match_results/typedefs.cc: New file.
|
||||
* testsuite/28_regex/11_algorithms: New file.
|
||||
* testsuite/28_regex/11_algorithms/02_match: New file.
|
||||
* testsuite/28_regex/11_algorithms/02_match/basic: New file.
|
||||
* testsuite/28_regex/11_algorithms/02_match/basic/string_01.cc: New file.
|
||||
* testsuite/28_regex/11_algorithms/02_match/basic/string_range_00_03.cc:
|
||||
New file.
|
||||
* testsuite/28_regex/11_algorithms/02_match/basic/string_range_01_03.cc:
|
||||
New file.
|
||||
* testsuite/28_regex/11_algorithms/02_match/basic/string_range_02_03.cc:
|
||||
New file.
|
||||
* testsuite/28_regex/11_algorithms/02_match/extended: New file.
|
||||
* testsuite/28_regex/11_algorithms/02_match/extended/cstring_plus.cc: New file.
|
||||
* testsuite/28_regex/11_algorithms/02_match/extended/cstring_questionmark.cc:
|
||||
New file.
|
||||
* testsuite/28_regex/11_algorithms/02_match/extended/string_any.cc: New file.
|
||||
* testsuite/28_regex/11_algorithms/02_match/extended/string_range_00_03.cc:
|
||||
New file.
|
||||
* testsuite/28_regex/11_algorithms/02_match/extended/string_range_01_03.cc:
|
||||
New file.
|
||||
* testsuite/28_regex/11_algorithms/02_match/extended/string_range_02_03.cc:
|
||||
New file.
|
||||
* testsuite/28_regex/12_iterators: New file.
|
||||
* testsuite/28_regex/12_iterators/regex_iterator: New file.
|
||||
* testsuite/28_regex/12_iterators/regex_iterator/ctors: New file.
|
||||
* testsuite/28_regex/12_iterators/regex_iterator/ctors/char: New file.
|
||||
* testsuite/28_regex/12_iterators/regex_iterator/ctors/char/default.cc: New
|
||||
file.
|
||||
* testsuite/28_regex/12_iterators/regex_iterator/ctors/wchar_t: New file.
|
||||
* testsuite/28_regex/12_iterators/regex_iterator/ctors/wchar_t/default.cc: New
|
||||
file.
|
||||
* testsuite/28_regex/12_iterators/regex_iterator/typedefs.cc: New file.
|
||||
* testsuite/28_regex/12_iterators/regex_token_iterator: New file.
|
||||
* testsuite/28_regex/12_iterators/regex_token_iterator/ctors: New file.
|
||||
* testsuite/28_regex/12_iterators/regex_token_iterator/ctors/char: New file.
|
||||
* testsuite/28_regex/12_iterators/regex_token_iterator/ctors/char/default.cc:
|
||||
New file.
|
||||
* testsuite/28_regex/12_iterators/regex_token_iterator/ctors/wchar_t: New file.
|
||||
* testsuite/28_regex/12_iterators/regex_token_iterator/ctors/wchar_t/default.cc:
|
||||
New file.
|
||||
* testsuite/28_regex/12_iterators/regex_token_iterator/typedefs.cc: New file.
|
||||
* testsuite/28_regex/13_ecmascript: New file.
|
||||
|
||||
2010-06-25 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
* include/profile/impl/profiler_list_to_slist.h: Remove spurious
|
||||
|
@ -121,6 +121,15 @@ bits_headers = \
|
||||
${bits_srcdir}/postypes.h \
|
||||
${bits_srcdir}/random.h \
|
||||
${bits_srcdir}/random.tcc \
|
||||
${bits_srcdir}/regex.h \
|
||||
${bits_srcdir}/regex_compiler.h \
|
||||
${bits_srcdir}/regex_constants.h \
|
||||
${bits_srcdir}/regex_cursor.h \
|
||||
${bits_srcdir}/regex_error.h \
|
||||
${bits_srcdir}/regex_grep_matcher.h \
|
||||
${bits_srcdir}/regex_grep_matcher.tcc \
|
||||
${bits_srcdir}/regex_nfa.h \
|
||||
${bits_srcdir}/regex_nfa.tcc \
|
||||
${bits_srcdir}/stream_iterator.h \
|
||||
${bits_srcdir}/streambuf_iterator.h \
|
||||
${bits_srcdir}/shared_ptr.h \
|
||||
|
@ -361,6 +361,15 @@ bits_headers = \
|
||||
${bits_srcdir}/postypes.h \
|
||||
${bits_srcdir}/random.h \
|
||||
${bits_srcdir}/random.tcc \
|
||||
${bits_srcdir}/regex.h \
|
||||
${bits_srcdir}/regex_compiler.h \
|
||||
${bits_srcdir}/regex_constants.h \
|
||||
${bits_srcdir}/regex_cursor.h \
|
||||
${bits_srcdir}/regex_error.h \
|
||||
${bits_srcdir}/regex_grep_matcher.h \
|
||||
${bits_srcdir}/regex_grep_matcher.tcc \
|
||||
${bits_srcdir}/regex_nfa.h \
|
||||
${bits_srcdir}/regex_nfa.tcc \
|
||||
${bits_srcdir}/stream_iterator.h \
|
||||
${bits_srcdir}/streambuf_iterator.h \
|
||||
${bits_srcdir}/shared_ptr.h \
|
||||
|
2427
libstdc++-v3/include/bits/regex.h
Normal file
2427
libstdc++-v3/include/bits/regex.h
Normal file
File diff suppressed because it is too large
Load Diff
1111
libstdc++-v3/include/bits/regex_compiler.h
Normal file
1111
libstdc++-v3/include/bits/regex_compiler.h
Normal file
File diff suppressed because it is too large
Load Diff
299
libstdc++-v3/include/bits/regex_constants.h
Normal file
299
libstdc++-v3/include/bits/regex_constants.h
Normal file
@ -0,0 +1,299 @@
|
||||
// class template regex -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* @file bits/regex_constants
|
||||
* @brief Constant definitions for the std regex library.
|
||||
*
|
||||
* This is an internal header file, included by other library headers.
|
||||
* You should not attempt to use it directly.
|
||||
*/
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
/**
|
||||
* @namespace std::regex_constants
|
||||
* @brief ISO C++-0x entities sub namespace for regex.
|
||||
*/
|
||||
namespace regex_constants
|
||||
{
|
||||
/**
|
||||
* @name 5.1 Regular Expression Syntax Options
|
||||
*/
|
||||
//@{
|
||||
enum __syntax_option
|
||||
{
|
||||
_S_icase,
|
||||
_S_nosubs,
|
||||
_S_optimize,
|
||||
_S_collate,
|
||||
_S_ECMAScript,
|
||||
_S_basic,
|
||||
_S_extended,
|
||||
_S_awk,
|
||||
_S_grep,
|
||||
_S_egrep,
|
||||
_S_syntax_last
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This is a bitmask type indicating how to interpret the regex.
|
||||
*
|
||||
* The @c syntax_option_type is implementation defined but it is valid to
|
||||
* perform bitwise operations on these values and expect the right thing to
|
||||
* happen.
|
||||
*
|
||||
* A valid value of type syntax_option_type shall have exactly one of the
|
||||
* elements @c ECMAScript, @c basic, @c extended, @c awk, @c grep, @c egrep
|
||||
* %set.
|
||||
*/
|
||||
typedef unsigned int syntax_option_type;
|
||||
|
||||
/**
|
||||
* Specifies that the matching of regular expressions against a character
|
||||
* sequence shall be performed without regard to case.
|
||||
*/
|
||||
static const syntax_option_type icase = 1 << _S_icase;
|
||||
|
||||
/**
|
||||
* Specifies that when a regular expression is matched against a character
|
||||
* container sequence, no sub-expression matches are to be stored in the
|
||||
* supplied match_results structure.
|
||||
*/
|
||||
static const syntax_option_type nosubs = 1 << _S_nosubs;
|
||||
|
||||
/**
|
||||
* Specifies that the regular expression engine should pay more attention to
|
||||
* the speed with which regular expressions are matched, and less to the
|
||||
* speed with which regular expression objects are constructed. Otherwise
|
||||
* it has no detectable effect on the program output.
|
||||
*/
|
||||
static const syntax_option_type optimize = 1 << _S_optimize;
|
||||
|
||||
/**
|
||||
* Specifies that character ranges of the form [a-b] should be locale
|
||||
* sensitive.
|
||||
*/
|
||||
static const syntax_option_type collate = 1 << _S_collate;
|
||||
|
||||
/**
|
||||
* Specifies that the grammar recognized by the regular expression engine is
|
||||
* that used by ECMAScript in ECMA-262 [Ecma International, ECMAScript
|
||||
* Language Specification, Standard Ecma-262, third edition, 1999], as
|
||||
* modified in section [28.13]. This grammar is similar to that defined
|
||||
* in the PERL scripting language but extended with elements found in the
|
||||
* POSIX regular expression grammar.
|
||||
*/
|
||||
static const syntax_option_type ECMAScript = 1 << _S_ECMAScript;
|
||||
|
||||
/**
|
||||
* Specifies that the grammar recognized by the regular expression engine is
|
||||
* that used by POSIX basic regular expressions in IEEE Std 1003.1-2001,
|
||||
* Portable Operating System Interface (POSIX), Base Definitions and
|
||||
* Headers, Section 9, Regular Expressions [IEEE, Information Technology --
|
||||
* Portable Operating System Interface (POSIX), IEEE Standard 1003.1-2001].
|
||||
*/
|
||||
static const syntax_option_type basic = 1 << _S_basic;
|
||||
|
||||
/**
|
||||
* Specifies that the grammar recognized by the regular expression engine is
|
||||
* that used by POSIX extended regular expressions in IEEE Std 1003.1-2001,
|
||||
* Portable Operating System Interface (POSIX), Base Definitions and Headers,
|
||||
* Section 9, Regular Expressions.
|
||||
*/
|
||||
static const syntax_option_type extended = 1 << _S_extended;
|
||||
|
||||
/**
|
||||
* Specifies that the grammar recognized by the regular expression engine is
|
||||
* that used by POSIX utility awk in IEEE Std 1003.1-2001. This option is
|
||||
* identical to syntax_option_type extended, except that C-style escape
|
||||
* sequences are supported. These sequences are:
|
||||
* \\\\, \\a, \\b, \\f, \\n, \\r, \\t , \\v, \\', ',
|
||||
* and \\ddd (where ddd is one, two, or three octal digits).
|
||||
*/
|
||||
static const syntax_option_type awk = 1 << _S_awk;
|
||||
|
||||
/**
|
||||
* Specifies that the grammar recognized by the regular expression engine is
|
||||
* that used by POSIX utility grep in IEEE Std 1003.1-2001. This option is
|
||||
* identical to syntax_option_type basic, except that newlines are treated
|
||||
* as whitespace.
|
||||
*/
|
||||
static const syntax_option_type grep = 1 << _S_grep;
|
||||
|
||||
/**
|
||||
* Specifies that the grammar recognized by the regular expression engine is
|
||||
* that used by POSIX utility grep when given the -E option in
|
||||
* IEEE Std 1003.1-2001. This option is identical to syntax_option_type
|
||||
* extended, except that newlines are treated as whitespace.
|
||||
*/
|
||||
static const syntax_option_type egrep = 1 << _S_egrep;
|
||||
|
||||
//@}
|
||||
|
||||
/**
|
||||
* @name 5.2 Matching Rules
|
||||
*
|
||||
* Matching a regular expression against a sequence of characters [first,
|
||||
* last) proceeds according to the rules of the grammar specified for the
|
||||
* regular expression object, modified according to the effects listed
|
||||
* below for any bitmask elements set.
|
||||
*
|
||||
*/
|
||||
//@{
|
||||
|
||||
enum __match_flag
|
||||
{
|
||||
_S_not_bol,
|
||||
_S_not_eol,
|
||||
_S_not_bow,
|
||||
_S_not_eow,
|
||||
_S_any,
|
||||
_S_not_null,
|
||||
_S_continuous,
|
||||
_S_prev_avail,
|
||||
_S_sed,
|
||||
_S_no_copy,
|
||||
_S_first_only,
|
||||
_S_match_flag_last
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief This is a bitmask type indicating regex matching rules.
|
||||
*
|
||||
* The @c match_flag_type is implementation defined but it is valid to
|
||||
* perform bitwise operations on these values and expect the right thing to
|
||||
* happen.
|
||||
*/
|
||||
typedef std::bitset<_S_match_flag_last> match_flag_type;
|
||||
|
||||
/**
|
||||
* The default matching rules.
|
||||
*/
|
||||
static const match_flag_type match_default = 0;
|
||||
|
||||
/**
|
||||
* The first character in the sequence [first, last) is treated as though it
|
||||
* is not at the beginning of a line, so the character (^) in the regular
|
||||
* expression shall not match [first, first).
|
||||
*/
|
||||
static const match_flag_type match_not_bol = 1 << _S_not_bol;
|
||||
|
||||
/**
|
||||
* The last character in the sequence [first, last) is treated as though it
|
||||
* is not at the end of a line, so the character ($) in the regular
|
||||
* expression shall not match [last, last).
|
||||
*/
|
||||
static const match_flag_type match_not_eol = 1 << _S_not_eol;
|
||||
|
||||
/**
|
||||
* The expression \\b is not matched against the sub-sequence
|
||||
* [first,first).
|
||||
*/
|
||||
static const match_flag_type match_not_bow = 1 << _S_not_bow;
|
||||
|
||||
/**
|
||||
* The expression \\b should not be matched against the sub-sequence
|
||||
* [last,last).
|
||||
*/
|
||||
static const match_flag_type match_not_eow = 1 << _S_not_eow;
|
||||
|
||||
/**
|
||||
* If more than one match is possible then any match is an acceptable
|
||||
* result.
|
||||
*/
|
||||
static const match_flag_type match_any = 1 << _S_any;
|
||||
|
||||
/**
|
||||
* The expression does not match an empty sequence.
|
||||
*/
|
||||
static const match_flag_type match_not_null = 1 << _S_not_null;
|
||||
|
||||
/**
|
||||
* The expression only matches a sub-sequence that begins at first .
|
||||
*/
|
||||
static const match_flag_type match_continuous = 1 << _S_continuous;
|
||||
|
||||
/**
|
||||
* --first is a valid iterator position. When this flag is set then the
|
||||
* flags match_not_bol and match_not_bow are ignored by the regular
|
||||
* expression algorithms 7.11 and iterators 7.12.
|
||||
*/
|
||||
static const match_flag_type match_prev_avail = 1 << _S_prev_avail;
|
||||
|
||||
/**
|
||||
* When a regular expression match is to be replaced by a new string, the
|
||||
* new string is constructed using the rules used by the ECMAScript replace
|
||||
* function in ECMA- 262 [Ecma International, ECMAScript Language
|
||||
* Specification, Standard Ecma-262, third edition, 1999], part 15.5.4.11
|
||||
* String.prototype.replace. In addition, during search and replace
|
||||
* operations all non-overlapping occurrences of the regular expression
|
||||
* are located and replaced, and sections of the input that did not match
|
||||
* the expression are copied unchanged to the output string.
|
||||
*
|
||||
* Format strings (from ECMA-262 [15.5.4.11]):
|
||||
* @li $$ The dollar-sign itself ($)
|
||||
* @li $& The matched substring.
|
||||
* @li $` The portion of @a string that precedes the matched substring.
|
||||
* This would be match_results::prefix().
|
||||
* @li $' The portion of @a string that follows the matched substring.
|
||||
* This would be match_results::suffix().
|
||||
* @li $n The nth capture, where n is in [1,9] and $n is not followed by a
|
||||
* decimal digit. If n <= match_results::size() and the nth capture
|
||||
* is undefined, use the empty string instead. If n >
|
||||
* match_results::size(), the result is implementation-defined.
|
||||
* @li $nn The nnth capture, where nn is a two-digit decimal number on
|
||||
* [01, 99]. If nn <= match_results::size() and the nth capture is
|
||||
* undefined, use the empty string instead. If
|
||||
* nn > match_results::size(), the result is implementation-defined.
|
||||
*/
|
||||
static const match_flag_type format_default = 0;
|
||||
|
||||
/**
|
||||
* When a regular expression match is to be replaced by a new string, the
|
||||
* new string is constructed using the rules used by the POSIX sed utility
|
||||
* in IEEE Std 1003.1- 2001 [IEEE, Information Technology -- Portable
|
||||
* Operating System Interface (POSIX), IEEE Standard 1003.1-2001].
|
||||
*/
|
||||
static const match_flag_type format_sed = 1 << _S_sed;
|
||||
|
||||
/**
|
||||
* During a search and replace operation, sections of the character
|
||||
* container sequence being searched that do not match the regular
|
||||
* expression shall not be copied to the output string.
|
||||
*/
|
||||
static const match_flag_type format_no_copy = 1 << _S_no_copy;
|
||||
|
||||
/**
|
||||
* When specified during a search and replace operation, only the first
|
||||
* occurrence of the regular expression shall be replaced.
|
||||
*/
|
||||
static const match_flag_type format_first_only = 1 << _S_first_only;
|
||||
|
||||
//@}
|
||||
|
||||
} // namespace regex_constants
|
||||
} // namespace std
|
||||
|
92
libstdc++-v3/include/bits/regex_cursor.h
Normal file
92
libstdc++-v3/include/bits/regex_cursor.h
Normal file
@ -0,0 +1,92 @@
|
||||
// class template regex -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* @file bits/regex_cursor.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* You should not attempt to use it directly.
|
||||
*/
|
||||
|
||||
namespace std
|
||||
{
|
||||
namespace __regex
|
||||
{
|
||||
// ABC for pattern matching
|
||||
struct _PatternCursor
|
||||
{
|
||||
virtual ~_PatternCursor() { };
|
||||
virtual void _M_next() = 0;
|
||||
virtual bool _M_at_end() const = 0;
|
||||
};
|
||||
|
||||
// Provides a cursor into the specific target string.
|
||||
template<typename _FwdIterT>
|
||||
class _SpecializedCursor
|
||||
: public _PatternCursor
|
||||
{
|
||||
public:
|
||||
_SpecializedCursor(const _FwdIterT& __b, const _FwdIterT __e)
|
||||
: _M_b(__b), _M_c(__b), _M_e(__e)
|
||||
{ }
|
||||
|
||||
typename std::iterator_traits<_FwdIterT>::value_type
|
||||
_M_current() const
|
||||
{ return *_M_c; }
|
||||
|
||||
void
|
||||
_M_next()
|
||||
{ ++_M_c; }
|
||||
|
||||
_FwdIterT
|
||||
_M_pos() const
|
||||
{ return _M_c; }
|
||||
|
||||
const _FwdIterT&
|
||||
_M_begin() const
|
||||
{ return _M_b; }
|
||||
|
||||
const _FwdIterT&
|
||||
_M_end() const
|
||||
{ return _M_e; }
|
||||
|
||||
bool
|
||||
_M_at_end() const
|
||||
{ return _M_c == _M_e; }
|
||||
|
||||
private:
|
||||
_FwdIterT _M_b;
|
||||
_FwdIterT _M_c;
|
||||
_FwdIterT _M_e;
|
||||
};
|
||||
|
||||
// Helper funxtion to create a cursor specialized for an iterator class.
|
||||
template<typename _FwdIterT>
|
||||
_SpecializedCursor<_FwdIterT>
|
||||
__cursor(const _FwdIterT& __b, const _FwdIterT __e)
|
||||
{ return _SpecializedCursor<_FwdIterT>(__b, __e); }
|
||||
|
||||
} // namespace __regex
|
||||
} // namespace std
|
||||
|
||||
/* vim: set ts=8 sw=2 sts=2: */
|
160
libstdc++-v3/include/bits/regex_error.h
Normal file
160
libstdc++-v3/include/bits/regex_error.h
Normal file
@ -0,0 +1,160 @@
|
||||
// class template regex -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* @file bits/regex_error
|
||||
* @brief Error and exception objects for the std regex library.
|
||||
*
|
||||
* This is an internal header file, included by other library headers.
|
||||
* You should not attempt to use it directly.
|
||||
*/
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
namespace regex_constants
|
||||
{
|
||||
/**
|
||||
* @name 5.3 Error Types
|
||||
*/
|
||||
//@{
|
||||
|
||||
enum error_type
|
||||
{
|
||||
_S_error_collate,
|
||||
_S_error_ctype,
|
||||
_S_error_escape,
|
||||
_S_error_backref,
|
||||
_S_error_brack,
|
||||
_S_error_paren,
|
||||
_S_error_brace,
|
||||
_S_error_badbrace,
|
||||
_S_error_range,
|
||||
_S_error_space,
|
||||
_S_error_badrepeat,
|
||||
_S_error_complexity,
|
||||
_S_error_stack,
|
||||
_S_error_last
|
||||
};
|
||||
|
||||
/** The expression contained an invalid collating element name. */
|
||||
static const error_type error_collate(_S_error_collate);
|
||||
|
||||
/** The expression contained an invalid character class name. */
|
||||
static const error_type error_ctype(_S_error_ctype);
|
||||
|
||||
/**
|
||||
* The expression contained an invalid escaped character, or a trailing
|
||||
* escape.
|
||||
*/
|
||||
static const error_type error_escape(_S_error_escape);
|
||||
|
||||
/** The expression contained an invalid back reference. */
|
||||
static const error_type error_backref(_S_error_backref);
|
||||
|
||||
/** The expression contained mismatched [ and ]. */
|
||||
static const error_type error_brack(_S_error_brack);
|
||||
|
||||
/** The expression contained mismatched ( and ). */
|
||||
static const error_type error_paren(_S_error_paren);
|
||||
|
||||
/** The expression contained mismatched { and } */
|
||||
static const error_type error_brace(_S_error_brace);
|
||||
|
||||
/** The expression contained an invalid range in a {} expression. */
|
||||
static const error_type error_badbrace(_S_error_badbrace);
|
||||
|
||||
/**
|
||||
* The expression contained an invalid character range,
|
||||
* such as [b-a] in most encodings.
|
||||
*/
|
||||
static const error_type error_range(_S_error_range);
|
||||
|
||||
/**
|
||||
* There was insufficient memory to convert the expression into a
|
||||
* finite state machine.
|
||||
*/
|
||||
static const error_type error_space(_S_error_space);
|
||||
|
||||
/**
|
||||
* One of <em>*?+{<em> was not preceded by a valid regular expression.
|
||||
*/
|
||||
static const error_type error_badrepeat(_S_error_badrepeat);
|
||||
|
||||
/**
|
||||
* The complexity of an attempted match against a regular expression
|
||||
* exceeded a pre-set level.
|
||||
*/
|
||||
static const error_type error_complexity(_S_error_complexity);
|
||||
|
||||
/**
|
||||
* There was insufficient memory to determine whether the
|
||||
* regular expression could match the specified character sequence.
|
||||
*/
|
||||
static const error_type error_stack(_S_error_stack);
|
||||
|
||||
//@}
|
||||
}
|
||||
|
||||
// [7.8] Class regex_error
|
||||
/**
|
||||
* @brief A regular expression exception class.
|
||||
* @ingroup exceptions
|
||||
*
|
||||
* The regular expression library throws objects of this class on error.
|
||||
*/
|
||||
class regex_error
|
||||
: public std::runtime_error
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief Constructs a regex_error object.
|
||||
*
|
||||
* @param ecode the regex error code.
|
||||
*/
|
||||
explicit
|
||||
regex_error(regex_constants::error_type __ecode)
|
||||
: std::runtime_error("regex_error"), _M_code(__ecode)
|
||||
{ }
|
||||
|
||||
/**
|
||||
* @brief Gets the regex error code.
|
||||
*
|
||||
* @returns the regex error code.
|
||||
*/
|
||||
regex_constants::error_type
|
||||
code() const
|
||||
{ return _M_code; }
|
||||
|
||||
protected:
|
||||
regex_constants::error_type _M_code;
|
||||
};
|
||||
|
||||
|
||||
inline void
|
||||
__throw_regex_error(regex_constants::error_type __ecode)
|
||||
{ throw regex_error(__ecode); }
|
||||
|
||||
} // namespace std
|
||||
|
131
libstdc++-v3/include/bits/regex_grep_matcher.h
Normal file
131
libstdc++-v3/include/bits/regex_grep_matcher.h
Normal file
@ -0,0 +1,131 @@
|
||||
// class template regex -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* @file bits/regex_executor.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* You should not attempt to use it directly.
|
||||
*/
|
||||
|
||||
|
||||
namespace std
|
||||
{
|
||||
template<typename _BiIter>
|
||||
class sub_match;
|
||||
|
||||
template<typename _Bi_iter, typename _Allocator>
|
||||
class match_results;
|
||||
|
||||
namespace __regex
|
||||
{
|
||||
// A _Results facade specialized for wrapping a templated sub_match.
|
||||
template<typename _FwdIterT, typename _Alloc>
|
||||
class _SpecializedResults
|
||||
: public _Results
|
||||
{
|
||||
public:
|
||||
_SpecializedResults(const _Automaton::_SizeT __size,
|
||||
const _SpecializedCursor<_FwdIterT>& __cursor,
|
||||
match_results<_FwdIterT, _Alloc>& __m);
|
||||
|
||||
void
|
||||
_M_set_pos(int __i, int __j, const _PatternCursor& __pc);
|
||||
|
||||
void
|
||||
_M_set_matched(int __i, bool __is_matched)
|
||||
{ _M_results.at(__i).matched = __is_matched; }
|
||||
|
||||
private:
|
||||
match_results<_FwdIterT, _Alloc>& _M_results;
|
||||
};
|
||||
|
||||
template<typename _FwdIterT, typename _Alloc>
|
||||
_SpecializedResults<_FwdIterT, _Alloc>::
|
||||
_SpecializedResults(const _Automaton::_SizeT __size,
|
||||
const _SpecializedCursor<_FwdIterT>& __cursor,
|
||||
match_results<_FwdIterT, _Alloc>& __m)
|
||||
: _M_results(__m)
|
||||
{
|
||||
typedef typename match_results<_FwdIterT, _Alloc>::size_type size_type;
|
||||
_M_results.clear();
|
||||
std::sub_match<_FwdIterT> __sm;
|
||||
__sm.matched = false;
|
||||
size_type __result_count = __size + 2;
|
||||
for (size_type __i = 0; __i < __result_count; ++__i)
|
||||
_M_results.push_back(__sm);
|
||||
_M_results.at(__size+0).first = __cursor._M_begin();
|
||||
_M_results.at(__size+0).second = __cursor._M_begin();
|
||||
_M_results.at(__size+1).first = __cursor._M_end();
|
||||
_M_results.at(__size+1).second = __cursor._M_end();
|
||||
}
|
||||
|
||||
template<typename _FwdIterT, typename _Alloc>
|
||||
void
|
||||
_SpecializedResults<_FwdIterT, _Alloc>::
|
||||
_M_set_pos(int __i, int __j, const _PatternCursor& __pc)
|
||||
{
|
||||
typedef const _SpecializedCursor<_FwdIterT>& _CursorT;
|
||||
_CursorT __c = static_cast<_CursorT>(__pc);
|
||||
if (__j == 0)
|
||||
_M_results.at(__i).first = __c._M_pos();
|
||||
else
|
||||
_M_results.at(__i).second = __c._M_pos()+1;
|
||||
}
|
||||
|
||||
// A stack of states used in evaluating the NFA.
|
||||
typedef std::stack<_StateIdT, std::vector<_StateIdT> > _StateStack;
|
||||
|
||||
// Executes a regular expression NFA/DFA over a range using a variant of
|
||||
// the parallel execution algorithm featured in the grep utility, modified
|
||||
// to use Laurikari tags.
|
||||
class _Grep_matcher
|
||||
{
|
||||
public:
|
||||
_Grep_matcher(_PatternCursor& __p,
|
||||
_Results& __r,
|
||||
const _AutomatonPtr& __automaton,
|
||||
regex_constants::match_flag_type __flags);
|
||||
|
||||
private:
|
||||
_StateSet
|
||||
_M_e_closure(_StateIdT __i);
|
||||
|
||||
_StateSet
|
||||
_M_e_closure(const _StateSet& __s);
|
||||
|
||||
_StateSet
|
||||
_M_e_closure(_StateStack& __stack, const _StateSet& __s);
|
||||
|
||||
private:
|
||||
const std::shared_ptr<_Nfa> _M_nfa;
|
||||
_PatternCursor& _M_pattern;
|
||||
_Results& _M_results;
|
||||
};
|
||||
|
||||
} // namespace __regex
|
||||
} // namespace std
|
||||
|
||||
#include <bits/regex_grep_matcher.tcc>
|
||||
|
||||
/* vim: set ts=8 sw=2 sts=2: */
|
179
libstdc++-v3/include/bits/regex_grep_matcher.tcc
Normal file
179
libstdc++-v3/include/bits/regex_grep_matcher.tcc
Normal file
@ -0,0 +1,179 @@
|
||||
// class template regex -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* @file regex_grep_matcher.cc
|
||||
*/
|
||||
#include <regex>
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
// A stack of states used in evaluating the NFA.
|
||||
typedef std::stack<
|
||||
std::__regex::_StateIdT,
|
||||
std::vector<std::__regex::_StateIdT>
|
||||
> _StateStack;
|
||||
|
||||
// Obtains the next state set given the current state set __s and the current
|
||||
// input character.
|
||||
inline std::__regex::_StateSet
|
||||
__move(const std::__regex::_PatternCursor& __p,
|
||||
const std::__regex::_Nfa& __nfa,
|
||||
const std::__regex::_StateSet& __s)
|
||||
{
|
||||
std::__regex::_StateSet __m;
|
||||
for (std::__regex::_StateSet::const_iterator __i = __s.begin();
|
||||
__i != __s.end(); ++__i)
|
||||
{
|
||||
if (*__i == std::__regex::_S_invalid_state_id)
|
||||
continue;
|
||||
|
||||
const std::__regex::_State& __state = __nfa[*__i];
|
||||
if (__state._M_opcode == std::__regex::_S_opcode_match
|
||||
&& __state._M_matches(__p))
|
||||
__m.insert(__state._M_next);
|
||||
}
|
||||
return __m;
|
||||
}
|
||||
|
||||
// returns true if (__s intersect __t) is not empty
|
||||
inline bool
|
||||
__includes_some(const std::__regex::_StateSet& __s,
|
||||
const std::__regex::_StateSet& __t)
|
||||
{
|
||||
if (__s.size() > 0 && __t.size() > 0)
|
||||
{
|
||||
std::__regex::_StateSet::const_iterator __first = __s.begin();
|
||||
std::__regex::_StateSet::const_iterator __second = __t.begin();
|
||||
while (__first != __s.end() && __second != __t.end())
|
||||
{
|
||||
if (*__first < *__second)
|
||||
++__first;
|
||||
else if (*__second < *__first)
|
||||
++__second;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// If an identified state __u is not already in the current state set __e,
|
||||
// insert it and push it on the current state stack __s.
|
||||
inline void
|
||||
__add_visited_state(const std::__regex::_StateIdT __u,
|
||||
_StateStack& __s,
|
||||
std::__regex::_StateSet& __e)
|
||||
{
|
||||
if (__e.count(__u) == 0)
|
||||
{
|
||||
__e.insert(__u);
|
||||
__s.push(__u);
|
||||
}
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
namespace __regex
|
||||
{
|
||||
inline _Grep_matcher::
|
||||
_Grep_matcher(_PatternCursor& __p,
|
||||
_Results& __r,
|
||||
const _AutomatonPtr& __nfa,
|
||||
regex_constants::match_flag_type __flags)
|
||||
: _M_nfa(static_pointer_cast<_Nfa>(__nfa)), _M_pattern(__p), _M_results(__r)
|
||||
{
|
||||
__regex::_StateSet __t = this->_M_e_closure(_M_nfa->_M_start());
|
||||
for (; !_M_pattern._M_at_end(); _M_pattern._M_next())
|
||||
__t = this->_M_e_closure(__move(_M_pattern, *_M_nfa, __t));
|
||||
|
||||
_M_results._M_set_matched(0,
|
||||
__includes_some(_M_nfa->_M_final_states(), __t));
|
||||
}
|
||||
|
||||
// Creates the e-closure set for the initial state __i.
|
||||
inline _StateSet _Grep_matcher::
|
||||
_M_e_closure(_StateIdT __i)
|
||||
{
|
||||
_StateSet __s;
|
||||
__s.insert(__i);
|
||||
_StateStack __stack;
|
||||
__stack.push(__i);
|
||||
return this->_M_e_closure(__stack, __s);
|
||||
}
|
||||
|
||||
// Creates the e-closure set for an arbitrary state set __s.
|
||||
inline _StateSet _Grep_matcher::
|
||||
_M_e_closure(const _StateSet& __s)
|
||||
{
|
||||
_StateStack __stack;
|
||||
for (_StateSet::const_iterator __i = __s.begin(); __i != __s.end(); ++__i)
|
||||
__stack.push(*__i);
|
||||
return this->_M_e_closure(__stack, __s);
|
||||
}
|
||||
|
||||
inline _StateSet _Grep_matcher::
|
||||
_M_e_closure(_StateStack& __stack, const _StateSet& __s)
|
||||
{
|
||||
_StateSet __e = __s;
|
||||
while (!__stack.empty())
|
||||
{
|
||||
_StateIdT __t = __stack.top(); __stack.pop();
|
||||
if (__t == _S_invalid_state_id)
|
||||
continue;
|
||||
// for each __u with edge from __t to __u labeled e do ...
|
||||
const _State& __state = _M_nfa->operator[](__t);
|
||||
switch (__state._M_opcode)
|
||||
{
|
||||
case _S_opcode_alternative:
|
||||
__add_visited_state(__state._M_next, __stack, __e);
|
||||
__add_visited_state(__state._M_alt, __stack, __e);
|
||||
break;
|
||||
case _S_opcode_subexpr_begin:
|
||||
__add_visited_state(__state._M_next, __stack, __e);
|
||||
__state._M_tagger(_M_pattern, _M_results);
|
||||
break;
|
||||
case _S_opcode_subexpr_end:
|
||||
__add_visited_state(__state._M_next, __stack, __e);
|
||||
__state._M_tagger(_M_pattern, _M_results);
|
||||
_M_results._M_set_matched(__state._M_subexpr, true);
|
||||
break;
|
||||
case _S_opcode_accept:
|
||||
__add_visited_state(__state._M_next, __stack, __e);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return __e;
|
||||
}
|
||||
|
||||
} // namespace __regex
|
||||
} // namespace std
|
||||
|
||||
/* vim: set ts=8 sw=2 sts=2: */
|
403
libstdc++-v3/include/bits/regex_nfa.h
Normal file
403
libstdc++-v3/include/bits/regex_nfa.h
Normal file
@ -0,0 +1,403 @@
|
||||
// class template regex -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* @file bits/regex_nfa.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* You should not attempt to use it directly.
|
||||
*/
|
||||
|
||||
namespace std
|
||||
{
|
||||
namespace __regex
|
||||
{
|
||||
|
||||
// Base class for, um, automata. Could be an NFA or a DFA. Your choice.
|
||||
class _Automaton
|
||||
{
|
||||
public:
|
||||
typedef unsigned int _SizeT;
|
||||
|
||||
public:
|
||||
virtual
|
||||
~_Automaton()
|
||||
{ }
|
||||
|
||||
virtual _SizeT
|
||||
_M_sub_count() const = 0;
|
||||
|
||||
#ifdef _GLIBCXX_DEBUG
|
||||
virtual std::ostream&
|
||||
_M_dot(std::ostream& __ostr) const = 0;
|
||||
#endif
|
||||
};
|
||||
|
||||
// Generic shred pointer to an automaton.
|
||||
typedef std::shared_ptr<_Automaton> _AutomatonPtr;
|
||||
|
||||
// Operation codes that define the type of transitions within the base NFA
|
||||
// that represents the regular expression.
|
||||
enum _Opcode
|
||||
{
|
||||
_S_opcode_unknown = 0,
|
||||
_S_opcode_alternative = 1,
|
||||
_S_opcode_subexpr_begin = 4,
|
||||
_S_opcode_subexpr_end = 5,
|
||||
_S_opcode_match = 100,
|
||||
_S_opcode_accept = 255
|
||||
};
|
||||
|
||||
// Provides a generic facade for a templated match_results.
|
||||
struct _Results
|
||||
{
|
||||
virtual void _M_set_pos(int __i, int __j, const _PatternCursor& __p) = 0;
|
||||
virtual void _M_set_matched(int __i, bool __is_matched) = 0;
|
||||
};
|
||||
|
||||
// Tags current state (for subexpr begin/end).
|
||||
typedef std::function<void (const _PatternCursor&, _Results&)> _Tagger;
|
||||
|
||||
template<typename _FwdIterT, typename _TraitsT>
|
||||
struct _StartTagger
|
||||
: public _Tagger
|
||||
{
|
||||
explicit
|
||||
_StartTagger(int __i)
|
||||
: _M_index(__i)
|
||||
{ }
|
||||
|
||||
void
|
||||
operator()(const _PatternCursor& __pc, _Results& __r)
|
||||
{ __r._M_set_pos(_M_index, 0, __pc); }
|
||||
|
||||
int _M_index;
|
||||
};
|
||||
|
||||
template<typename _FwdIterT, typename _TraitsT>
|
||||
struct _EndTagger
|
||||
: public _Tagger
|
||||
{
|
||||
explicit
|
||||
_EndTagger(int __i)
|
||||
: _M_index(__i)
|
||||
{ }
|
||||
|
||||
void
|
||||
operator()(const _PatternCursor& __pc, _Results& __r)
|
||||
{ __r._M_set_pos(_M_index, 1, __pc); }
|
||||
|
||||
int _M_index;
|
||||
_FwdIterT _M_pos;
|
||||
};
|
||||
// Indicates if current state matches cursor current.
|
||||
typedef std::function<bool (const _PatternCursor&)> _Matcher;
|
||||
|
||||
// Matches any character
|
||||
inline bool
|
||||
_AnyMatcher(const _PatternCursor&)
|
||||
{ return true; }
|
||||
|
||||
// Matches a single character
|
||||
template<typename _InIterT, typename _TraitsT>
|
||||
struct _CharMatcher
|
||||
: public _Matcher
|
||||
{
|
||||
typedef typename _TraitsT::char_type char_type;
|
||||
|
||||
explicit
|
||||
_CharMatcher(char_type __c, const _TraitsT& __t = _TraitsT())
|
||||
: _M_traits(__t), _M_c(_M_traits.translate(__c))
|
||||
{ }
|
||||
|
||||
bool
|
||||
operator()(const _PatternCursor& __pc) const
|
||||
{
|
||||
typedef const _SpecializedCursor<_InIterT>& _CursorT;
|
||||
_CursorT __c = static_cast<_CursorT>(__pc);
|
||||
return _M_traits.translate(__c._M_current()) == _M_c;
|
||||
}
|
||||
|
||||
const _TraitsT& _M_traits;
|
||||
char_type _M_c;
|
||||
};
|
||||
|
||||
// Matches a character range (bracket expression)
|
||||
template<typename _InIterT, typename _TraitsT>
|
||||
struct _RangeMatcher
|
||||
: public _Matcher
|
||||
{
|
||||
typedef typename _TraitsT::char_type _CharT;
|
||||
typedef std::basic_string<_CharT> _StringT;
|
||||
|
||||
explicit
|
||||
_RangeMatcher(bool __is_non_matching, const _TraitsT& __t = _TraitsT())
|
||||
: _M_traits(__t), _M_is_non_matching(__is_non_matching)
|
||||
{ }
|
||||
|
||||
bool
|
||||
operator()(const _PatternCursor& __pc) const
|
||||
{
|
||||
typedef const _SpecializedCursor<_InIterT>& _CursorT;
|
||||
_CursorT __c = static_cast<_CursorT>(__pc);
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
_M_add_char(_CharT __c)
|
||||
{ }
|
||||
|
||||
void
|
||||
_M_add_collating_element(const _StringT& __s)
|
||||
{ }
|
||||
|
||||
void
|
||||
_M_add_equivalence_class(const _StringT& __s)
|
||||
{ }
|
||||
|
||||
void
|
||||
_M_add_character_class(const _StringT& __s)
|
||||
{ }
|
||||
|
||||
void
|
||||
_M_make_range()
|
||||
{ }
|
||||
|
||||
const _TraitsT& _M_traits;
|
||||
bool _M_is_non_matching;
|
||||
};
|
||||
|
||||
// Identifies a state in the NFA.
|
||||
typedef int _StateIdT;
|
||||
|
||||
// The special case in which a state identifier is not an index.
|
||||
static const _StateIdT _S_invalid_state_id = -1;
|
||||
|
||||
|
||||
// An individual state in an NFA
|
||||
//
|
||||
// In this case a "state" is an entry in the NFA definition coupled with its
|
||||
// outgoing transition(s). All states have a single outgoing transition,
|
||||
// except for accepting states (which have no outgoing transitions) and alt
|
||||
// states, which have two outgoing transitions.
|
||||
//
|
||||
struct _State
|
||||
{
|
||||
typedef int _OpcodeT;
|
||||
|
||||
_OpcodeT _M_opcode; // type of outgoing transition
|
||||
_StateIdT _M_next; // outgoing tranition
|
||||
_StateIdT _M_alt; // for _S_opcode_alternative
|
||||
unsigned int _M_subexpr; // for _S_opcode_subexpr_*
|
||||
_Tagger _M_tagger; // for _S_opcode_subexpr_*
|
||||
_Matcher _M_matches; // for _S_opcode_match
|
||||
|
||||
explicit _State(_OpcodeT __opcode)
|
||||
: _M_opcode(__opcode), _M_next(_S_invalid_state_id)
|
||||
{ }
|
||||
|
||||
_State(const _Matcher& __m)
|
||||
: _M_opcode(_S_opcode_match), _M_next(_S_invalid_state_id), _M_matches(__m)
|
||||
{ }
|
||||
|
||||
_State(_OpcodeT __opcode, unsigned int __s, const _Tagger& __t)
|
||||
: _M_opcode(__opcode), _M_next(_S_invalid_state_id), _M_subexpr(__s),
|
||||
_M_tagger(__t)
|
||||
{ }
|
||||
|
||||
_State(_StateIdT __next, _StateIdT __alt)
|
||||
: _M_opcode(_S_opcode_alternative), _M_next(__next), _M_alt(__alt)
|
||||
{ }
|
||||
|
||||
#ifdef _GLIBCXX_DEBUG
|
||||
std::ostream&
|
||||
_M_print(std::ostream& ostr) const;
|
||||
|
||||
// Prints graphviz dot commands for state.
|
||||
std::ostream&
|
||||
_M_dot(std::ostream& __ostr, _StateIdT __id) const;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
// The Grep Matcher works on sets of states. Here are sets of states.
|
||||
typedef std::set<_StateIdT> _StateSet;
|
||||
|
||||
// A collection of all states making up an NFA
|
||||
//
|
||||
// An NFA is a 4-tuple M = (K, S, s, F), where
|
||||
// K is a finite set of states,
|
||||
// S is the alphabet of the NFA,
|
||||
// s is the initial state,
|
||||
// F is a set of final (accepting) states.
|
||||
//
|
||||
// This NFA class is templated on S, a type that will hold values of the
|
||||
// underlying alphabet (without regard to semantics of that alphabet). The
|
||||
// other elements of the tuple are generated during construction of the NFA
|
||||
// and are available through accessor member functions.
|
||||
//
|
||||
class _Nfa
|
||||
: public _Automaton, public std::vector<_State>
|
||||
{
|
||||
public:
|
||||
typedef _State _StateT;
|
||||
typedef unsigned int _SizeT;
|
||||
typedef regex_constants::syntax_option_type _FlagT;
|
||||
|
||||
public:
|
||||
_Nfa(_FlagT __f)
|
||||
: _M_flags(__f), _M_start_state(0), _M_subexpr_count(0)
|
||||
{ }
|
||||
|
||||
~_Nfa()
|
||||
{ }
|
||||
|
||||
_FlagT
|
||||
_M_options() const
|
||||
{ return _M_flags; }
|
||||
|
||||
_StateIdT
|
||||
_M_start() const
|
||||
{ return _M_start_state; }
|
||||
|
||||
const _StateSet&
|
||||
_M_final_states() const
|
||||
{ return _M_accepting_states; }
|
||||
|
||||
_SizeT
|
||||
_M_sub_count() const
|
||||
{ return _M_subexpr_count; }
|
||||
|
||||
_StateIdT
|
||||
_M_insert_accept()
|
||||
{
|
||||
this->push_back(_StateT(_S_opcode_accept));
|
||||
_M_accepting_states.insert(this->size()-1);
|
||||
return this->size()-1;
|
||||
}
|
||||
|
||||
_StateIdT
|
||||
_M_insert_alt(_StateIdT __next, _StateIdT __alt)
|
||||
{
|
||||
this->push_back(_StateT(__next, __alt));
|
||||
return this->size()-1;
|
||||
}
|
||||
|
||||
_StateIdT
|
||||
_M_insert_matcher(_Matcher __m)
|
||||
{
|
||||
this->push_back(_StateT(__m));
|
||||
return this->size()-1;
|
||||
}
|
||||
|
||||
_StateIdT
|
||||
_M_insert_subexpr_begin(const _Tagger& __t)
|
||||
{
|
||||
this->push_back(_StateT(_S_opcode_subexpr_begin, _M_subexpr_count++, __t));
|
||||
return this->size()-1;
|
||||
}
|
||||
|
||||
_StateIdT
|
||||
_M_insert_subexpr_end(unsigned int __i, const _Tagger& __t)
|
||||
{
|
||||
this->push_back(_StateT(_S_opcode_subexpr_end, __i, __t));
|
||||
return this->size()-1;
|
||||
}
|
||||
|
||||
#ifdef _GLIBCXX_DEBUG
|
||||
std::ostream&
|
||||
_M_dot(std::ostream& __ostr) const;
|
||||
#endif
|
||||
|
||||
private:
|
||||
_FlagT _M_flags;
|
||||
_StateIdT _M_start_state;
|
||||
_StateSet _M_accepting_states;
|
||||
_SizeT _M_subexpr_count;
|
||||
};
|
||||
|
||||
// Describes a sequence of one or more %_State, its current start and end(s).
|
||||
//
|
||||
// This structure contains fragments of an NFA during construction.
|
||||
class _StateSeq
|
||||
{
|
||||
public:
|
||||
// Constructs a single-node sequence
|
||||
_StateSeq(_Nfa& __ss, _StateIdT __s, _StateIdT __e = _S_invalid_state_id)
|
||||
: _M_nfa(__ss), _M_start(__s), _M_end1(__s), _M_end2(__e)
|
||||
{ }
|
||||
// Constructs a split sequence from two other sequencces
|
||||
_StateSeq(const _StateSeq& __e1, const _StateSeq& __e2)
|
||||
: _M_nfa(__e1._M_nfa),
|
||||
_M_start(_M_nfa._M_insert_alt(__e1._M_start, __e2._M_start)),
|
||||
_M_end1(__e1._M_end1), _M_end2(__e2._M_end1)
|
||||
{ }
|
||||
|
||||
// Constructs a split sequence from a single sequence
|
||||
_StateSeq(const _StateSeq& __e, _StateIdT __id)
|
||||
: _M_nfa(__e._M_nfa),
|
||||
_M_start(_M_nfa._M_insert_alt(__id, __e._M_start)),
|
||||
_M_end1(__id), _M_end2(__e._M_end1)
|
||||
{ }
|
||||
|
||||
// Constructs a copy of a %_StateSeq
|
||||
_StateSeq(const _StateSeq& __rhs)
|
||||
: _M_nfa(__rhs._M_nfa), _M_start(__rhs._M_start),
|
||||
_M_end1(__rhs._M_end1), _M_end2(__rhs._M_end2)
|
||||
{ }
|
||||
|
||||
|
||||
_StateSeq& operator=(const _StateSeq& __rhs);
|
||||
|
||||
_StateIdT
|
||||
_M_front() const
|
||||
{ return _M_start; }
|
||||
|
||||
// Extends a sequence by one.
|
||||
void
|
||||
_M_push_back(_StateIdT __id);
|
||||
|
||||
// Extends and maybe joins a sequence.
|
||||
void
|
||||
_M_append(_StateIdT __id);
|
||||
|
||||
void
|
||||
_M_append(_StateSeq& __rhs);
|
||||
|
||||
// Clones an entire sequence.
|
||||
_StateIdT
|
||||
_M_clone();
|
||||
|
||||
private:
|
||||
_Nfa& _M_nfa;
|
||||
_StateIdT _M_start;
|
||||
_StateIdT _M_end1;
|
||||
_StateIdT _M_end2;
|
||||
|
||||
};
|
||||
|
||||
} // namespace __regex
|
||||
} // namespace std
|
||||
|
||||
#include <bits/regex_nfa.tcc>
|
||||
|
170
libstdc++-v3/include/bits/regex_nfa.tcc
Normal file
170
libstdc++-v3/include/bits/regex_nfa.tcc
Normal file
@ -0,0 +1,170 @@
|
||||
// class template regex -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* @file regex_nfa.cc
|
||||
*/
|
||||
#include <regex>
|
||||
|
||||
namespace std
|
||||
{
|
||||
namespace __regex
|
||||
{
|
||||
#ifdef _GLIBCXX_DEBUG
|
||||
inline std::ostream& _State::
|
||||
_M_print(std::ostream& ostr) const
|
||||
{
|
||||
switch (_M_opcode)
|
||||
{
|
||||
case _S_opcode_alternative:
|
||||
ostr << "alt next=" << _M_next << " alt=" << _M_alt;
|
||||
break;
|
||||
case _S_opcode_subexpr_begin:
|
||||
ostr << "subexpr begin next=" << _M_next << " index=" << _M_subexpr;
|
||||
break;
|
||||
case _S_opcode_subexpr_end:
|
||||
ostr << "subexpr end next=" << _M_next << " index=" << _M_subexpr;
|
||||
break;
|
||||
case _S_opcode_match:
|
||||
ostr << "match next=" << _M_next;
|
||||
break;
|
||||
case _S_opcode_accept:
|
||||
ostr << "accept next=" << _M_next;
|
||||
break;
|
||||
default:
|
||||
ostr << "unknown next=" << _M_next;
|
||||
break;
|
||||
}
|
||||
return ostr;
|
||||
}
|
||||
|
||||
// Prints graphviz dot commands for state.
|
||||
inline std::ostream& _State::
|
||||
_M_dot(std::ostream& __ostr, _StateIdT __id) const
|
||||
{
|
||||
switch (_M_opcode)
|
||||
{
|
||||
case _S_opcode_alternative:
|
||||
__ostr << __id << " [label=\"" << __id << "\\nALT\"];\n"
|
||||
<< __id << " -> " << _M_next
|
||||
<< " [label=\"epsilon\", tailport=\"s\"];\n"
|
||||
<< __id << " -> " << _M_alt
|
||||
<< " [label=\"epsilon\", tailport=\"n\"];\n";
|
||||
break;
|
||||
case _S_opcode_subexpr_begin:
|
||||
__ostr << __id << " [label=\"" << __id << "\\nSBEGIN "
|
||||
<< _M_subexpr << "\"];\n"
|
||||
<< __id << " -> " << _M_next << " [label=\"epsilon\"];\n";
|
||||
break;
|
||||
case _S_opcode_subexpr_end:
|
||||
__ostr << __id << " [label=\"" << __id << "\\nSEND "
|
||||
<< _M_subexpr << "\"];\n"
|
||||
<< __id << " -> " << _M_next << " [label=\"epsilon\"];\n";
|
||||
break;
|
||||
case _S_opcode_match:
|
||||
__ostr << __id << " [label=\"" << __id << "\\nMATCH\"];\n"
|
||||
<< __id << " -> " << _M_next << " [label=\"<match>\"];\n";
|
||||
break;
|
||||
case _S_opcode_accept:
|
||||
__ostr << __id << " [label=\"" << __id << "\\nACC\"];\n" ;
|
||||
break;
|
||||
default:
|
||||
__ostr << __id << " [label=\"" << __id << "\\nUNK\"];\n"
|
||||
<< __id << " -> " << _M_next << " [label=\"?\"];\n";
|
||||
break;
|
||||
}
|
||||
return __ostr;
|
||||
}
|
||||
|
||||
inline std::ostream& _Nfa::
|
||||
_M_dot(std::ostream& __ostr) const
|
||||
{
|
||||
__ostr << "digraph _Nfa {\n"
|
||||
<< " rankdir=LR;\n";
|
||||
for (unsigned int __i = 0; __i < this->size(); ++__i)
|
||||
{ this->at(__i)._M_dot(__ostr, __i); }
|
||||
__ostr << "}\n";
|
||||
return __ostr;
|
||||
}
|
||||
#endif
|
||||
|
||||
inline _StateSeq& _StateSeq::
|
||||
operator=(const _StateSeq& __rhs)
|
||||
{
|
||||
_M_start = __rhs._M_start;
|
||||
_M_end1 = __rhs._M_end1;
|
||||
_M_end2 = __rhs._M_end2;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline void _StateSeq::
|
||||
_M_push_back(_StateIdT __id)
|
||||
{
|
||||
if (_M_end1 != _S_invalid_state_id)
|
||||
_M_nfa[_M_end1]._M_next = __id;
|
||||
_M_end1 = __id;
|
||||
}
|
||||
|
||||
inline void _StateSeq::
|
||||
_M_append(_StateIdT __id)
|
||||
{
|
||||
if (_M_end2 != _S_invalid_state_id)
|
||||
{
|
||||
if (_M_end2 == _M_end1)
|
||||
_M_nfa[_M_end2]._M_alt = __id;
|
||||
else
|
||||
_M_nfa[_M_end2]._M_next = __id;
|
||||
_M_end2 = _S_invalid_state_id;
|
||||
}
|
||||
if (_M_end1 != _S_invalid_state_id)
|
||||
_M_nfa[_M_end1]._M_next = __id;
|
||||
_M_end1 = __id;
|
||||
}
|
||||
|
||||
inline void _StateSeq::
|
||||
_M_append(_StateSeq& __rhs)
|
||||
{
|
||||
if (_M_end2 != _S_invalid_state_id)
|
||||
{
|
||||
if (_M_end2 == _M_end1)
|
||||
_M_nfa[_M_end2]._M_alt = __rhs._M_start;
|
||||
else
|
||||
_M_nfa[_M_end2]._M_next = __rhs._M_start;
|
||||
_M_end2 = _S_invalid_state_id;
|
||||
}
|
||||
if (__rhs._M_end2 != _S_invalid_state_id)
|
||||
_M_end2 = __rhs._M_end2;
|
||||
if (_M_end1 != _S_invalid_state_id)
|
||||
_M_nfa[_M_end1]._M_next = __rhs._M_start;
|
||||
_M_end1 = __rhs._M_end1;
|
||||
}
|
||||
|
||||
// @todo implement this function.
|
||||
inline _StateIdT _StateSeq::
|
||||
_M_clone()
|
||||
{ return 0; }
|
||||
|
||||
} // namespace __regex
|
||||
} // namespace std
|
||||
|
@ -35,33 +35,30 @@
|
||||
# include <bits/c++0x_warning.h>
|
||||
#else
|
||||
|
||||
#if defined(_GLIBCXX_INCLUDE_AS_TR1)
|
||||
# error C++0x header cannot be included from TR1 header
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
#include <bitset>
|
||||
#include <functional>
|
||||
#ifdef _GLIBCXX_DEBUG
|
||||
# include <iosfwd>
|
||||
#endif
|
||||
#include <iterator>
|
||||
#include <locale>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
#include <stack>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
#if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
|
||||
# include <tr1_impl/regex>
|
||||
#else
|
||||
# define _GLIBCXX_INCLUDE_AS_CXX0X
|
||||
# define _GLIBCXX_BEGIN_NAMESPACE_TR1
|
||||
# define _GLIBCXX_END_NAMESPACE_TR1
|
||||
# define _GLIBCXX_TR1
|
||||
# include <tr1_impl/regex>
|
||||
# undef _GLIBCXX_TR1
|
||||
# undef _GLIBCXX_END_NAMESPACE_TR1
|
||||
# undef _GLIBCXX_BEGIN_NAMESPACE_TR1
|
||||
# undef _GLIBCXX_INCLUDE_AS_CXX0X
|
||||
#endif
|
||||
#include <bits/regex_constants.h>
|
||||
#include <bits/regex_error.h>
|
||||
#include <bits/regex_cursor.h>
|
||||
#include <bits/regex_nfa.h>
|
||||
#include <bits/regex_compiler.h>
|
||||
#include <bits/regex_grep_matcher.h>
|
||||
#include <bits/regex.h>
|
||||
|
||||
#endif // __GXX_EXPERIMENTAL_CXX0X__
|
||||
|
||||
|
38
libstdc++-v3/testsuite/28_regex/03_requirements/typedefs.cc
Normal file
38
libstdc++-v3/testsuite/28_regex/03_requirements/typedefs.cc
Normal file
@ -0,0 +1,38 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
//
|
||||
// 2010-02-17 Stephen M. Webb <stephen.webb@bregmasoft.ca>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 28.3 Requirements [re.req]
|
||||
// 28.2 (4) Table 127 - Regular expression traits class requirements
|
||||
|
||||
#include <regex>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
typedef std::regex_traits<char> traits;
|
||||
|
||||
typedef traits::char_type char_type;
|
||||
typedef traits::string_type string_type;
|
||||
typedef traits::locale_type locale_type;
|
||||
typedef traits::char_class_type char_class_type;
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=gnu++98" }
|
||||
|
||||
// Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <regex> // { dg-excess-errors "In file included from" }
|
||||
|
||||
|
54
libstdc++-v3/testsuite/28_regex/05_constants/error_type.cc
Normal file
54
libstdc++-v3/testsuite/28_regex/05_constants/error_type.cc
Normal file
@ -0,0 +1,54 @@
|
||||
// { dg-options "-std=c++0x" }
|
||||
// { dg-do compile }
|
||||
//
|
||||
// 2009-06-17 Stephen M. Webb <stephen.webb@xandros.com>
|
||||
//
|
||||
// Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 28.5.3
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
std::regex_constants::error_type err __attribute__((unused));
|
||||
|
||||
err = std::regex_constants::error_collate;
|
||||
err = std::regex_constants::error_ctype;
|
||||
err = std::regex_constants::error_escape;
|
||||
err = std::regex_constants::error_backref;
|
||||
err = std::regex_constants::error_brack;
|
||||
err = std::regex_constants::error_paren;
|
||||
err = std::regex_constants::error_brace;
|
||||
err = std::regex_constants::error_badbrace;
|
||||
err = std::regex_constants::error_range;
|
||||
err = std::regex_constants::error_space;
|
||||
err = std::regex_constants::error_badrepeat;
|
||||
err = std::regex_constants::error_complexity;
|
||||
err = std::regex_constants::error_stack;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
// { dg-options "-std=c++0x" }
|
||||
// { dg-do compile }
|
||||
//
|
||||
// 2009-06-17 Stephen M. Webb <stephen.webb@xandros.com>
|
||||
//
|
||||
// Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 28.5.1
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
std::regex_constants::match_flag_type flag = std::regex_constants::match_default;
|
||||
|
||||
flag |= std::regex_constants::match_not_bol;
|
||||
flag |= std::regex_constants::match_not_eol;
|
||||
flag |= std::regex_constants::match_not_bow;
|
||||
flag |= std::regex_constants::match_not_eow;
|
||||
flag |= std::regex_constants::match_any;
|
||||
flag |= std::regex_constants::match_not_null;
|
||||
flag |= std::regex_constants::match_continuous;
|
||||
flag |= std::regex_constants::match_prev_avail;
|
||||
flag |= std::regex_constants::format_default;
|
||||
flag |= std::regex_constants::format_sed;
|
||||
flag |= std::regex_constants::format_no_copy;
|
||||
flag |= std::regex_constants::format_first_only;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
// { dg-options "-std=c++0x" }
|
||||
// { dg-do compile }
|
||||
//
|
||||
// 2009-06-17 Stephen M. Webb <stephen.webb@xandros.com>
|
||||
//
|
||||
// Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 28.5.1
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
std::regex_constants::syntax_option_type option = 0;
|
||||
|
||||
option |= std::regex_constants::icase;
|
||||
option |= std::regex_constants::nosubs;
|
||||
option |= std::regex_constants::optimize;
|
||||
option |= std::regex_constants::collate;
|
||||
option |= std::regex_constants::ECMAScript;
|
||||
option |= std::regex_constants::basic;
|
||||
option |= std::regex_constants::extended;
|
||||
option |= std::regex_constants::awk;
|
||||
option |= std::regex_constants::grep;
|
||||
option |= std::regex_constants::egrep;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
// { dg-options "-std=c++0x" }
|
||||
// { dg-do compile }
|
||||
//
|
||||
// 2009-06-17 Stephen M. Webb <stephen.webb@xandros.com>
|
||||
//
|
||||
// Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 28.6 [re.badexp]
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
std::regex_error error(std::regex_constants::error_collate);
|
||||
VERIFY(error.code() == std::regex_constants::error_collate);
|
||||
|
||||
try
|
||||
{
|
||||
throw error;
|
||||
}
|
||||
catch (std::runtime_error& ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
50
libstdc++-v3/testsuite/28_regex/07_traits/char/ctor.cc
Normal file
50
libstdc++-v3/testsuite/28_regex/07_traits/char/ctor.cc
Normal file
@ -0,0 +1,50 @@
|
||||
// { dg-do link }
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// [28.7] class template regex_traits
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
// Tests default constructor of the regex_traits class. There is only the
|
||||
// default constructor.
|
||||
void test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
typedef std::regex_traits<char> test_type;
|
||||
|
||||
// required default constructor
|
||||
test_type t;
|
||||
|
||||
// Check for required typedefs
|
||||
typedef test_type::char_type char_type;
|
||||
typedef test_type::string_type string_type;
|
||||
typedef test_type::locale_type locale_type;
|
||||
typedef test_type::char_class_type char_class_type;
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
};
|
48
libstdc++-v3/testsuite/28_regex/07_traits/char/isctype.cc
Normal file
48
libstdc++-v3/testsuite/28_regex/07_traits/char/isctype.cc
Normal file
@ -0,0 +1,48 @@
|
||||
// { dg-do run { xfail *-*-* } }
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
//
|
||||
// 2010-06-23 Stephen M. Webb <stephen.webb@bregmasoft.ca>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 28.3 Requirements [re.req]
|
||||
// 28.2(4) Table 127 - Regular expression traits class requirements
|
||||
// 28.7(11) Class template regex_traits [re.traits]
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
typedef char CharT;
|
||||
typedef std::regex_traits<CharT> traits;
|
||||
|
||||
char name[] = "lower";
|
||||
traits t;
|
||||
|
||||
VERIFY( t.isctype('e', t.lookup_classname(name, name+sizeof(name)-1)) );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
49
libstdc++-v3/testsuite/28_regex/07_traits/char/length.cc
Normal file
49
libstdc++-v3/testsuite/28_regex/07_traits/char/length.cc
Normal file
@ -0,0 +1,49 @@
|
||||
// { dg-do run }
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
//
|
||||
// 2010-02-17 Stephen M. Webb <stephen.webb@bregmasoft.ca>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 28.3 Requirements [re.req]
|
||||
// 28.2 (4) Table 127 - Regular expression traits class requirements
|
||||
// 28.7 Class template regex_traits [re.traits]
|
||||
// 28.7 (3) static std::size_t length(const char_type* p);
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
typedef char CharT;
|
||||
typedef std::regex_traits<CharT> traits;
|
||||
bool test __attribute__((unused)) = true;
|
||||
const CharT* p = "";
|
||||
|
||||
std::size_t i = traits::length(p);
|
||||
|
||||
VERIFY( i == 0 );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
// { dg-do run { xfail *-*-* } }
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
//
|
||||
// 2010-06-23 Stephen M. Webb <stephen.webb@bregmasoft.ca>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 28.3 Requirements [re.req]
|
||||
// 28.2(4) Table 127 - Regular expression traits class requirements
|
||||
// 28.7(9) Class template regex_traits [re.traits]
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
typedef char CharT;
|
||||
typedef std::regex_traits<CharT> traits;
|
||||
|
||||
char n1[] = "lower";
|
||||
char n2[] = "alpha";
|
||||
traits t;
|
||||
|
||||
traits::char_class_type c1 = t.lookup_classname(n1, n1+sizeof(n1)-1);
|
||||
VERIFY( c1 != 0 );
|
||||
|
||||
traits::char_class_type c2 = t.lookup_classname(n1, n1+sizeof(n1)-1, true);
|
||||
traits::char_class_type c3 = t.lookup_classname(n2, n2+sizeof(n2)-1, true);
|
||||
VERIFY( c2 == c3 );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
// { dg-do run { xfail *-*-* } }
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
//
|
||||
// 2010-06-23 Stephen M. Webb <stephen.webb@bregmasoft.ca>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 28.3 Requirements [re.req]
|
||||
// 28.2 (4) Table 127 - Regular expression traits class requirements
|
||||
// 28.7 (8) Class template regex_traits [re.traits]
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
typedef char CharT;
|
||||
typedef std::regex_traits<CharT> traits;
|
||||
|
||||
char name[] = "ll";
|
||||
traits t;
|
||||
|
||||
traits::string_type sname = t.lookup_collatename(name, name+sizeof(name)-1);
|
||||
|
||||
VERIFY( !sname.empty() );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
51
libstdc++-v3/testsuite/28_regex/07_traits/char/transform.cc
Normal file
51
libstdc++-v3/testsuite/28_regex/07_traits/char/transform.cc
Normal file
@ -0,0 +1,51 @@
|
||||
// { dg-do run }
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
//
|
||||
// 2010-02-17 Stephen M. Webb <stephen.webb@bregmasoft.ca>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 28.3 Requirements [re.req]
|
||||
// 28.2 (4) Table 127 - Regular expression traits class requirements
|
||||
// 28.7 Class template regex_traits [re.traits]
|
||||
|
||||
#include <regex>
|
||||
#include <string>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
typedef char CharT;
|
||||
typedef std::regex_traits<CharT> traits;
|
||||
|
||||
traits t;
|
||||
traits::string_type G = "abc";
|
||||
traits::string_type H = "def";
|
||||
|
||||
VERIFY( G < H );
|
||||
VERIFY( t.transform(G.begin(), G.end()) < t.transform(H.begin(), H.end()) );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
// { dg-options "-std=c++0x" }
|
||||
// { dg-do run { xfail *-*-* } }
|
||||
|
||||
//
|
||||
// 2010-02-17 Stephen M. Webb <stephen.webb@bregmasoft.ca>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 28.3 Requirements [re.req]
|
||||
// 28.2 (4) Table 127 - Regular expression traits class requirements
|
||||
// 28.7 Class template regex_traits [re.traits]
|
||||
|
||||
#include <regex>
|
||||
#include <string>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
typedef char CharT;
|
||||
typedef std::regex_traits<CharT> traits;
|
||||
|
||||
traits t;
|
||||
traits::string_type G = "abc";
|
||||
traits::string_type H = "def";
|
||||
traits::string_type J = "ABC";
|
||||
|
||||
VERIFY( G < H );
|
||||
VERIFY( t.transform_primary(G.begin(), G.end()) < t.transform_primary(H.begin(), H.end()) );
|
||||
|
||||
VERIFY( G == H );
|
||||
VERIFY( t.transform_primary(G.begin(), G.end()) == t.transform_primary(J.begin(), J.end()) );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
49
libstdc++-v3/testsuite/28_regex/07_traits/char/translate.cc
Normal file
49
libstdc++-v3/testsuite/28_regex/07_traits/char/translate.cc
Normal file
@ -0,0 +1,49 @@
|
||||
// { dg_do run }
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
//
|
||||
// 2010-02-17 Stephen M. Webb <stephen.webb@bregmasoft.ca>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 28.3 Requirements [re.req]
|
||||
// 28.2 (4) Table 127 - Regular expression traits class requirements
|
||||
// 28.7 Class template regex_traits [re.traits]
|
||||
// 28.7 (3) static std::size_t length(const char_type* p);
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
typedef char CharT;
|
||||
|
||||
std::regex_traits<CharT> t;
|
||||
CharT c = 'a';
|
||||
CharT d = 'a';
|
||||
|
||||
VERIFY( t.translate(c) == t.translate(d) );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
// { dg-do run }
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// [28.7] class template regex_traits (5) translate_nocase
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
// Verifies the workings of the regex_traits translate_nocase function.
|
||||
void test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
typedef char CharT;
|
||||
|
||||
std::regex_traits<CharT> t;
|
||||
CharT c = 'a';
|
||||
CharT C = 'A';
|
||||
|
||||
VERIFY( t.translate_nocase(c) == t.translate_nocase(C) );
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
};
|
49
libstdc++-v3/testsuite/28_regex/07_traits/char/value.cc
Normal file
49
libstdc++-v3/testsuite/28_regex/07_traits/char/value.cc
Normal file
@ -0,0 +1,49 @@
|
||||
// { dg-do run }
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
// 2008-08-11 Stephen M. Webb <stephen.webb@bregmasoft.com>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// [28.7] class template regex_traits value() function
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
// Tests the value() function of the regex_traits<char> class.
|
||||
void test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
std::regex_traits<char> t;
|
||||
VERIFY( t.value('7', 8) == 7 );
|
||||
VERIFY( t.value('7', 10) == 7 );
|
||||
VERIFY( t.value('7', 16) == 7 );
|
||||
VERIFY( t.value('9', 8) == -1 );
|
||||
VERIFY( t.value('9', 10) == 9 );
|
||||
VERIFY( t.value('9', 16) == 9 );
|
||||
VERIFY( t.value('d', 8) == -1 );
|
||||
VERIFY( t.value('d', 10) == -1 );
|
||||
VERIFY( t.value('d', 16) == 13 );
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
};
|
49
libstdc++-v3/testsuite/28_regex/07_traits/wchar_t/ctor.cc
Normal file
49
libstdc++-v3/testsuite/28_regex/07_traits/wchar_t/ctor.cc
Normal file
@ -0,0 +1,49 @@
|
||||
// { dg-do link }
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// [28.7] class template regex_traits
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
// Tests default constructor of the regex_traits class. There is only the
|
||||
// default constructor.
|
||||
void test01()
|
||||
{
|
||||
typedef std::regex_traits<wchar_t> test_type;
|
||||
|
||||
// required default constructor
|
||||
test_type t;
|
||||
|
||||
// Check for required typedefs
|
||||
typedef test_type::char_type char_type;
|
||||
typedef test_type::string_type string_type;
|
||||
typedef test_type::locale_type locale_type;
|
||||
typedef test_type::char_class_type char_class_type;
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
};
|
49
libstdc++-v3/testsuite/28_regex/07_traits/wchar_t/length.cc
Normal file
49
libstdc++-v3/testsuite/28_regex/07_traits/wchar_t/length.cc
Normal file
@ -0,0 +1,49 @@
|
||||
// { dg-do run }
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
//
|
||||
// 2010-02-17 Stephen M. Webb <stephen.webb@bregmasoft.ca>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 28.3 Requirements [re.req]
|
||||
// 28.2 (4) Table 127 - Regular expression traits class requirements
|
||||
// 28.7 Class template regex_traits [re.traits]
|
||||
// 28.7 (3) static std::size_t length(const char_type* p);
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
typedef wchar_t CharT;
|
||||
typedef std::regex_traits<CharT> traits;
|
||||
bool test __attribute__((unused)) = true;
|
||||
const CharT* p = L"";
|
||||
|
||||
std::size_t i = traits::length(p);
|
||||
|
||||
VERIFY( i == 0 );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
// { dg-do run }
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
//
|
||||
// 2010-02-17 Stephen M. Webb <stephen.webb@bregmasoft.ca>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 28.3 Requirements [re.req]
|
||||
// 28.2 (4) Table 127 - Regular expression traits class requirements
|
||||
// 28.7 Class template regex_traits [re.traits]
|
||||
|
||||
#include <regex>
|
||||
#include <string>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
typedef wchar_t CharT;
|
||||
typedef std::regex_traits<CharT> traits;
|
||||
|
||||
traits t;
|
||||
traits::string_type G = L"abc";
|
||||
traits::string_type H = L"def";
|
||||
|
||||
VERIFY( G < H );
|
||||
VERIFY( t.transform(G.begin(), G.end()) < t.transform(H.begin(), H.end()) );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
// { dg-do run }
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
//
|
||||
// 2010-02-17 Stephen M. Webb <stephen.webb@bregmasoft.ca>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 28.3 Requirements [re.req]
|
||||
// 28.2 (4) Table 127 - Regular expression traits class requirements
|
||||
// 28.7 Class template regex_traits [re.traits]
|
||||
// 28.7 (3) static std::size_t length(const char_type* p);
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
typedef wchar_t CharT;
|
||||
|
||||
std::regex_traits<CharT> t;
|
||||
CharT c = L'a';
|
||||
CharT d = L'a';
|
||||
|
||||
VERIFY( t.translate(c) == t.translate(d) );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
// { dg-do run }
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// [28.7] class template regex_traits (5) translate_nocase
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
// Verifies the workings of the regex_traits translate_nocase function.
|
||||
void test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
typedef wchar_t CharT;
|
||||
|
||||
std::regex_traits<CharT> t;
|
||||
CharT c = L'a';
|
||||
CharT C = L'A';
|
||||
|
||||
VERIFY( t.translate_nocase(c) == t.translate_nocase(C) );
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
};
|
49
libstdc++-v3/testsuite/28_regex/07_traits/wchar_t/value.cc
Normal file
49
libstdc++-v3/testsuite/28_regex/07_traits/wchar_t/value.cc
Normal file
@ -0,0 +1,49 @@
|
||||
// { dg-do run }
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
// 2008-08-11 Stephen M. Webb <stephen.webb@bregmasoft.com>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// [28.7] class template regex_traits value() function
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
// Tests the value() function of the regex_traits<char> class.
|
||||
void test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
std::regex_traits<char> t;
|
||||
VERIFY( t.value('7', 8) == 7 );
|
||||
VERIFY( t.value('7', 10) == 7 );
|
||||
VERIFY( t.value('7', 16) == 7 );
|
||||
VERIFY( t.value('9', 8) == -1 );
|
||||
VERIFY( t.value('9', 10) == 9 );
|
||||
VERIFY( t.value('9', 16) == 9 );
|
||||
VERIFY( t.value('d', 8) == -1 );
|
||||
VERIFY( t.value('d', 10) == -1 );
|
||||
VERIFY( t.value('d', 16) == 13 );
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
};
|
@ -0,0 +1,44 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
// 2009-06-05 Stephen M. Webb <stephen.webb@bregmasoft.ca>
|
||||
//
|
||||
// Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// C++0X [28.8.3] class template basic_regex assign()
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
// Tests assign operation from a C-style null-terminated-string.
|
||||
void test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
std::basic_regex<char> re;
|
||||
|
||||
const char* cs = "aab";
|
||||
re.assign(cs);
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
};
|
@ -0,0 +1,43 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// [28.8.3] class template basic_regex assign()
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
// Tests basic_regex assign operator from a C-style null-terminated-string.
|
||||
void test01()
|
||||
{
|
||||
typedef std::basic_regex<char> test_type;
|
||||
|
||||
const char* cs = "aab";
|
||||
test_type re;
|
||||
re = cs;
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
};
|
@ -0,0 +1,50 @@
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
// 2010-07-07 Stephen M. Webb <stephen.webb@bregmasoft.com>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// [28.8.3](9-11) class template basic_regex assign
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
#include <utility>
|
||||
|
||||
// Tests assign operator of the basic_regex class for moveable rvalues.
|
||||
void test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
std::regex src_re("aaba");
|
||||
const unsigned mark_count = src_re.mark_count();
|
||||
const std::regex::flag_type flags = src_re.flags();
|
||||
|
||||
std::regex target_re;
|
||||
|
||||
target_re.assign(std::move(src_re));
|
||||
|
||||
VERIFY( target_re.flags() == flags );
|
||||
VERIFY( target_re.mark_count() == mark_count );
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
};
|
@ -0,0 +1,43 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// [28.8.3] class template basic_regex assign()
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
// Tests assign operation from a Pascal-style counted-string.
|
||||
void test01()
|
||||
{
|
||||
typedef std::basic_regex<char> test_type;
|
||||
|
||||
const char cs[] = "aab";
|
||||
test_type re;
|
||||
re.assign(cs, sizeof(cs)-1, std::regex_constants::basic);
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
};
|
@ -0,0 +1,43 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// [28.8.3] class template basic_regex assign()
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
// Tests range assign of the basic_regex class.
|
||||
void test01()
|
||||
{
|
||||
typedef std::basic_regex<char> test_type;
|
||||
|
||||
char s[] = "a+b|c";
|
||||
test_type re;
|
||||
re.assign(s, s + 5);
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
};
|
@ -0,0 +1,44 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// [28.8.3] class template basic_regex assign()
|
||||
|
||||
#include <string>
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
// Tests C++ string assignment of the basic_regex class.
|
||||
void test01()
|
||||
{
|
||||
typedef std::basic_regex<char> test_type;
|
||||
|
||||
std::string s("a*b");
|
||||
test_type re;
|
||||
re.assign(s);
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
};
|
@ -0,0 +1,44 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// [28.8.3] class template basic_regex assign()
|
||||
|
||||
#include <string>
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
// Tests basic_regex assignment operator from a C++ string;
|
||||
void test01()
|
||||
{
|
||||
typedef std::basic_regex<char> test_type;
|
||||
|
||||
std::string s("a*b");
|
||||
test_type re;
|
||||
re = s;
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
};
|
@ -0,0 +1,44 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// [28.8.3] class template basic_regex assign()
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
// Tests assign operation from a C-style null-terminated-string.
|
||||
void test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
typedef std::basic_regex<wchar_t> test_type;
|
||||
|
||||
const wchar_t* cs = L"aab";
|
||||
test_type re;
|
||||
re.assign(cs);
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
};
|
@ -0,0 +1,44 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// [28.8.3] class template basic_regex assign()
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
// Tests basic_regex assign operator from a C-style null-terminated-string.
|
||||
void test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
typedef std::basic_regex<wchar_t> test_type;
|
||||
|
||||
const wchar_t* cs = L"aab";
|
||||
test_type re;
|
||||
re = cs;
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
};
|
@ -0,0 +1,43 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// [28.8.3] class template basic_regex assign()
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
// Tests assign operation from a Pascal-style counted-string.
|
||||
void test01()
|
||||
{
|
||||
typedef std::basic_regex<wchar_t> test_type;
|
||||
|
||||
const wchar_t cs[] = L"aab";
|
||||
test_type re;
|
||||
re.assign(cs, sizeof(cs)-1, std::regex_constants::basic);
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
};
|
@ -0,0 +1,44 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// [28.8.3] class template basic_regex assign()
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
// Tests range assign of the basic_regex class.
|
||||
void test01()
|
||||
{
|
||||
typedef std::basic_regex<wchar_t> test_type;
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
wchar_t s[] = L"a+b|c";
|
||||
test_type re;
|
||||
re.assign(s, s + 5);
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
};
|
@ -0,0 +1,45 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// [28.8.3] class template basic_regex assign()
|
||||
|
||||
#include <string>
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
// Tests C++ string assignment of the basic_regex class.
|
||||
void test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
typedef std::basic_regex<wchar_t> test_type;
|
||||
|
||||
std::wstring s(L"a*b");
|
||||
test_type re;
|
||||
re.assign(s);
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
};
|
@ -0,0 +1,45 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// [28.8.3] class template basic_regex assign()
|
||||
|
||||
#include <string>
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
// Tests basic_regex assignment operator from a C++ string;
|
||||
void test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
typedef std::basic_regex<wchar_t> test_type;
|
||||
|
||||
std::wstring s(L"a*b");
|
||||
test_type re;
|
||||
re = s;
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
};
|
@ -0,0 +1,37 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
|
||||
//
|
||||
// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 7.8.2 basic_regex constructors
|
||||
|
||||
#include <regex>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
std::regex re("(a|b)*abb", std::regex::basic);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
// { dg-do run }
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// [28.8.2] class template basic_regex constructor
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
// Tests Pascal-style counted-string constructor of the basic_regex class.
|
||||
void test01()
|
||||
{
|
||||
const char* cs = "aab";
|
||||
std::regex re(cs, 3, std::regex::basic);
|
||||
|
||||
VERIFY( re.flags() & std::regex_constants::basic );
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
};
|
@ -0,0 +1,44 @@
|
||||
// { dg-do run }
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// [28.8.2] class template basic_regex constructor
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
// Tests Pascal-style counted-string constructor of the basic_regex class.
|
||||
void test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
const wchar_t* cs = L"aab";
|
||||
std::wregex re(cs, 3, std::wregex::basic);
|
||||
|
||||
VERIFY( re.flags() & std::regex_constants::basic );
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
};
|
@ -0,0 +1,52 @@
|
||||
// { dg-options "-std=c++0x" }
|
||||
// { dg-do run { xfail *-*-* } }
|
||||
|
||||
//
|
||||
// 2010-06-16 Stephen M. Webb <stephen.webb@bregmasoft.ca>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 28.8.2 basic_regex ctor
|
||||
// Tests for invalid range expression
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
try
|
||||
{
|
||||
std::regex re("a\\{1,2,3\\}", std::regex::basic);
|
||||
}
|
||||
catch (std::regex_error& ex)
|
||||
{
|
||||
VERIFY( ex.code() == std::regex_constants::error_badbrace );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
||||
|
@ -0,0 +1,42 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// [28.8.2] class template basic_regex constructor
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
// Tests C-style null-terminated-string constructor of the basic_regex class.
|
||||
void test01()
|
||||
{
|
||||
typedef std::basic_regex<char> test_type;
|
||||
|
||||
const char* cs = "aab";
|
||||
test_type re(cs);
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
};
|
@ -0,0 +1,37 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
|
||||
//
|
||||
// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 7.8.2 basic_regex constructors
|
||||
|
||||
#include <regex>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
std::regex re("(a|b)*abb", std::regex::awk);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
|
||||
//
|
||||
// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 7.8.2 basic_regex constructors
|
||||
|
||||
#include <regex>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
std::regex re("(a|b)*abb");
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
|
||||
//
|
||||
// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 7.8.2 basic_regex constructors
|
||||
|
||||
#include <regex>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
std::regex re("(a|b)*abb", std::regex::egrep);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
|
||||
//
|
||||
// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 7.8.2 basic_regex constructors
|
||||
|
||||
#include <regex>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
using std::regex;
|
||||
|
||||
regex re("(a|b)*abb", regex::grep);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// [28.8.2] class template basic_regex constructor
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
// Tests default constructor of the basic_regex class.
|
||||
void test01()
|
||||
{
|
||||
typedef std::basic_regex<char> test_type;
|
||||
|
||||
// default constructor
|
||||
test_type re;
|
||||
|
||||
// Check for required typedefs
|
||||
typedef test_type::value_type value_type;
|
||||
typedef test_type::flag_type flag_type;
|
||||
typedef test_type::locale_type locale_type;
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
};
|
@ -0,0 +1,42 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// [28.8.2] class template basic_regex constructor
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
// Tests range constructor of the basic_regex class.
|
||||
void test01()
|
||||
{
|
||||
typedef std::basic_regex<char> test_type;
|
||||
|
||||
char s[] = "a+b|c";
|
||||
test_type re(s, s + 5);
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
};
|
@ -0,0 +1,45 @@
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
// 2010-07-07 Stephen M. Webb <stephen.webb@bregmasoft.com>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// [28.8.2](11) class template basic_regex constructors
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
// Tests copy constructor of the basic_regex class.
|
||||
void test01()
|
||||
{
|
||||
typedef std::basic_regex<char> test_type;
|
||||
|
||||
test_type src_re("aaba");
|
||||
|
||||
test_type target_re(src_re);
|
||||
|
||||
VERIFY( target_re.flags() == src_re.flags() );
|
||||
VERIFY( target_re.mark_count() == src_re.mark_count() );
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
};
|
@ -0,0 +1,43 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
|
||||
//
|
||||
// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 7.8.2 basic_regex constructors
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
std::regex re("(wee|week)(knights|night)", std::regex::extended);
|
||||
|
||||
VERIFY( re.flags() == std::regex::extended );
|
||||
VERIFY( re.mark_count() == 0 );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
// { dg-options "-std=c++0x" }
|
||||
// { dg-do run { xfail *-*-* } }
|
||||
|
||||
//
|
||||
// 2010-06-16 Stephen M. Webb <stephen.webb@bregmasoft.ca>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 28.8.2 basic_regex ctor
|
||||
// Tests for invalid range expression
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
try
|
||||
{
|
||||
std::regex re("a{1,2,3}", std::regex::extended);
|
||||
}
|
||||
catch (std::regex_error& ex)
|
||||
{
|
||||
VERIFY( ex.code() == std::regex_constants::error_badbrace );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
||||
|
@ -0,0 +1,49 @@
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
// 2010-07-07 Stephen M. Webb <stephen.webb@bregmasoft.com>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// [28.8.2](12-14) class template basic_regex constructors
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
#include <utility>
|
||||
|
||||
// Tests move constructor of the basic_regex class.
|
||||
void test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
typedef std::basic_regex<char> test_type;
|
||||
|
||||
test_type src_re("aaba");
|
||||
const unsigned mark_count = src_re.mark_count();
|
||||
const test_type::flag_type flags = src_re.flags();
|
||||
|
||||
test_type target_re = std::move(src_re);
|
||||
|
||||
VERIFY( target_re.flags() == flags );
|
||||
VERIFY( target_re.mark_count() == mark_count );
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
};
|
@ -0,0 +1,54 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// [28.8.2] class template basic_regex constructor
|
||||
|
||||
#include <string>
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
#include <testsuite_allocator.h>
|
||||
|
||||
// Tests C++ string constructor of the basic_regex class.
|
||||
void test01()
|
||||
{
|
||||
typedef std::basic_regex<char> test_type;
|
||||
|
||||
std::string s("a*b");
|
||||
test_type re(s);
|
||||
}
|
||||
|
||||
void test02()
|
||||
{
|
||||
typedef std::basic_regex<char> test_type;
|
||||
typedef __gnu_test::tracker_allocator<char> alloc_type;
|
||||
|
||||
std::basic_string<char, std::char_traits<char>, alloc_type> s("a*b");
|
||||
test_type re(s);
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
test02();
|
||||
return 0;
|
||||
};
|
@ -0,0 +1,56 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// [28.8.2] class template basic_regex constructor
|
||||
|
||||
#include <string>
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
#include <testsuite_allocator.h>
|
||||
|
||||
// Tests C++ string constructor of the basic_regex class.
|
||||
void test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
typedef std::basic_regex<wchar_t> test_type;
|
||||
|
||||
std::wstring s(L"a*b");
|
||||
test_type re(s);
|
||||
}
|
||||
|
||||
void test02()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
typedef std::basic_regex<wchar_t> test_type;
|
||||
typedef __gnu_test::tracker_allocator<wchar_t> alloc_type;
|
||||
|
||||
std::basic_string<wchar_t, std::char_traits<wchar_t>, alloc_type> s(L"a*b");
|
||||
test_type re(s);
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
test02();
|
||||
return 0;
|
||||
};
|
@ -0,0 +1,43 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// [28.8.2] class template basic_regex constructor
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
// Tests C-style null-terminated-string constructor of the basic_regex class.
|
||||
void test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
typedef std::basic_regex<wchar_t> test_type;
|
||||
|
||||
const wchar_t* cs = L"aab";
|
||||
test_type re(cs);
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
};
|
@ -0,0 +1,48 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// [28.8.2] class template basic_regex constructor
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
// Tests default constructor of the basic_regex class.
|
||||
void test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
typedef std::basic_regex<wchar_t> test_type;
|
||||
|
||||
// default constructor
|
||||
test_type re;
|
||||
|
||||
// Check for required typedefs
|
||||
typedef test_type::value_type value_type;
|
||||
typedef test_type::flag_type flag_type;
|
||||
typedef test_type::locale_type locale_type;
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
};
|
@ -0,0 +1,43 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// [28.8.2] class template basic_regex constructor
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
// Tests range constructor of the basic_regex class.
|
||||
void test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
typedef std::basic_regex<wchar_t> test_type;
|
||||
|
||||
wchar_t s[] = L"a+b|c";
|
||||
test_type re(s, s + 5);
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
};
|
37
libstdc++-v3/testsuite/28_regex/08_basic_regex/regex.cc
Normal file
37
libstdc++-v3/testsuite/28_regex/08_basic_regex/regex.cc
Normal file
@ -0,0 +1,37 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
// 2007-03-12 Stephen M. Webb <stephen.webb@bregmasoft.com>
|
||||
//
|
||||
// Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 7.4 typedef std::regex
|
||||
|
||||
#include <regex>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
std::regex re;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
49
libstdc++-v3/testsuite/28_regex/09_sub_match/cast_char.cc
Normal file
49
libstdc++-v3/testsuite/28_regex/09_sub_match/cast_char.cc
Normal file
@ -0,0 +1,49 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
//
|
||||
// 2010-06-09 Stephen M. Webb <stephen.webb@bregmasoft.ca>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 28.9.1 [re.submatch.members] sub_match members
|
||||
|
||||
#include <regex>
|
||||
#include <string>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
typedef char value_type;
|
||||
typedef std::basic_string<value_type> string_type;
|
||||
typedef std::sub_match<value_type*> sub_match_type;
|
||||
value_type test_data[] = "cabbage";
|
||||
|
||||
sub_match_type sm;
|
||||
sm.first = test_data + 0;
|
||||
sm.second = test_data + sizeof(test_data)/sizeof(value_type);
|
||||
sm.matched = true;
|
||||
|
||||
string_type sm_string = sm;
|
||||
|
||||
VERIFY( sm_string == string_type(test_data) );
|
||||
}
|
49
libstdc++-v3/testsuite/28_regex/09_sub_match/cast_wchar_t.cc
Normal file
49
libstdc++-v3/testsuite/28_regex/09_sub_match/cast_wchar_t.cc
Normal file
@ -0,0 +1,49 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
//
|
||||
// 2010-06-09 Stephen M. Webb <stephen.webb@bregmasoft.ca>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 28.9.1 [re.submatch.members] sub_match members
|
||||
|
||||
#include <regex>
|
||||
#include <string>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
typedef wchar_t value_type;
|
||||
typedef std::basic_string<value_type> string_type;
|
||||
typedef std::sub_match<value_type*> sub_match_type;
|
||||
value_type test_data[] = L"cabbage";
|
||||
|
||||
sub_match_type sm;
|
||||
sm.first = test_data + 0;
|
||||
sm.second = test_data + sizeof(test_data)/sizeof(value_type);
|
||||
sm.matched = true;
|
||||
|
||||
string_type sm_string = sm;
|
||||
|
||||
VERIFY( sm_string == string_type(test_data) );
|
||||
}
|
49
libstdc++-v3/testsuite/28_regex/09_sub_match/length.cc
Normal file
49
libstdc++-v3/testsuite/28_regex/09_sub_match/length.cc
Normal file
@ -0,0 +1,49 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
//
|
||||
// 2010-06-09 Stephen M. Webb <stephen.webb@bregmasoft.ca>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 28.9.1 [re.submatch.members] sub_match members
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
typedef std::sub_match<const char*> sm_t;
|
||||
const char* test_data = "cabbage";
|
||||
sm_t::difference_type test_len = 3;
|
||||
|
||||
sm_t sm1;
|
||||
sm1.first = test_data + 0;
|
||||
sm1.second = test_data + test_len;
|
||||
sm1.matched = true;
|
||||
|
||||
sm_t sm2;
|
||||
sm2.matched = false;
|
||||
|
||||
VERIFY( sm1.length() == test_len );
|
||||
VERIFY( sm2.length() == 0 );
|
||||
}
|
38
libstdc++-v3/testsuite/28_regex/09_sub_match/typedefs.cc
Normal file
38
libstdc++-v3/testsuite/28_regex/09_sub_match/typedefs.cc
Normal file
@ -0,0 +1,38 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
//
|
||||
// 2010-06-07 Stephen M. Webb <stephen.webb@bregmasoft.ca>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 28.9 Class template sub_match
|
||||
|
||||
#include <regex>
|
||||
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
typedef std::sub_match<char*> sm;
|
||||
|
||||
typedef sm::value_type value_type;
|
||||
typedef sm::difference_type difference_type;
|
||||
typedef sm::iterator iterator;
|
||||
typedef sm::string_type string_type;
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
// 2009-06-10 Stephen M. Webb <stephen.webb@bregmasoft.com>
|
||||
//
|
||||
// Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// C++0X [28.10.1] class template match_results constructor
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
// Tests default constructor of the match_result class.
|
||||
void test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
std::cmatch cm;
|
||||
VERIFY( cm.size() == 0 );
|
||||
VERIFY( cm.str() == std::cmatch::string_type() );
|
||||
}
|
||||
|
||||
void test02()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
std::smatch sm;
|
||||
VERIFY( sm.size() == 0 );
|
||||
VERIFY( sm.str() == std::smatch::string_type() );
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
test02();
|
||||
return 0;
|
||||
};
|
@ -0,0 +1,52 @@
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
// 2009-06-05 Stephen M. Webb <stephen.webb@bregmasoft.com>
|
||||
//
|
||||
// Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// C++0X [28.10.1] class template match_results constructor
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
// Tests default constructor of the match_result class.
|
||||
void test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
std::wcmatch cm;
|
||||
VERIFY( cm.size() == 0 );
|
||||
VERIFY( cm.str() == std::wcmatch::string_type() );
|
||||
}
|
||||
|
||||
void test02()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
std::wsmatch sm;
|
||||
VERIFY( sm.size() == 0 );
|
||||
VERIFY( sm.str() == std::wsmatch::string_type() );
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
test02();
|
||||
return 0;
|
||||
};
|
44
libstdc++-v3/testsuite/28_regex/10_match_results/typedefs.cc
Normal file
44
libstdc++-v3/testsuite/28_regex/10_match_results/typedefs.cc
Normal file
@ -0,0 +1,44 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
//
|
||||
// 2010-06-10 Stephen M. Webb <stephen.webb@bregmasoft.ca>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 28.10 Class template sub_match
|
||||
|
||||
#include <regex>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
typedef std::match_results<char*> mr;
|
||||
|
||||
typedef mr::value_type value_type;
|
||||
typedef mr::const_reference const_reference;
|
||||
typedef mr::reference reference;
|
||||
typedef mr::const_iterator const_iterator;
|
||||
typedef mr::iterator iterator;
|
||||
typedef mr::difference_type difference_type;
|
||||
typedef mr::size_type size_type;
|
||||
typedef mr::allocator_type allocator_type;
|
||||
typedef mr::char_type char_type;
|
||||
typedef mr::string_type string_type;
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
//
|
||||
// 2010-06-11 Stephen M. Webb <stephen.webb@bregmasoft.ca>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 28.11.2 regex_match
|
||||
// Tests BRE against a std::string target.
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
std::regex re("\\(a\\).*", std::regex::basic);
|
||||
std::string target("aaba");
|
||||
std::smatch m;
|
||||
|
||||
VERIFY( std::regex_match(target, m, re) );
|
||||
|
||||
VERIFY( m.size() == re.mark_count()+1 );
|
||||
VERIFY( m.empty() == false );
|
||||
VERIFY( m.prefix().first == target.begin() );
|
||||
VERIFY( m.prefix().second == target.begin() );
|
||||
VERIFY( m.prefix().matched == false );
|
||||
VERIFY( m.suffix().first == target.end() );
|
||||
VERIFY( m.suffix().second == target.end() );
|
||||
VERIFY( m.suffix().matched == false );
|
||||
VERIFY( m[0].first == target.begin() );
|
||||
VERIFY( m[0].second == target.end() );
|
||||
VERIFY( m[0].matched == true );
|
||||
VERIFY( m[1].first == target.begin() );
|
||||
VERIFY( m[1].second == target.begin()+1 );
|
||||
VERIFY( m[1].matched == true );
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
||||
|
@ -0,0 +1,60 @@
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
//
|
||||
// 2010-06-16 Stephen M. Webb <stephen.webb@bregmasoft.ca>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 28.11.2 regex_match
|
||||
// Tests BRE against a std::string target, exercising range {0,3}
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
std::regex re("a\\{0,3\\}", std::regex::basic);
|
||||
std::string target("aa");
|
||||
std::smatch m;
|
||||
|
||||
VERIFY( std::regex_match(target, m, re) );
|
||||
|
||||
VERIFY( m.size() == re.mark_count()+1 );
|
||||
VERIFY( m.empty() == false );
|
||||
VERIFY( m.prefix().first == target.begin() );
|
||||
VERIFY( m.prefix().second == target.begin() );
|
||||
VERIFY( m.prefix().matched == false );
|
||||
VERIFY( m.suffix().first == target.end() );
|
||||
VERIFY( m.suffix().second == target.end() );
|
||||
VERIFY( m.suffix().matched == false );
|
||||
VERIFY( m[0].first == target.begin() );
|
||||
VERIFY( m[0].second == target.end() );
|
||||
VERIFY( m[0].matched == true );
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
||||
|
@ -0,0 +1,60 @@
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
//
|
||||
// 2010-06-16 Stephen M. Webb <stephen.webb@bregmasoft.ca>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 28.11.2 regex_match
|
||||
// Tests BRE against a std::string target, exercising range {1,3}
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
std::regex re("a\\{1,3\\}", std::regex::basic);
|
||||
std::string target("aa");
|
||||
std::smatch m;
|
||||
|
||||
VERIFY( std::regex_match(target, m, re) );
|
||||
|
||||
VERIFY( m.size() == re.mark_count()+1 );
|
||||
VERIFY( m.empty() == false );
|
||||
VERIFY( m.prefix().first == target.begin() );
|
||||
VERIFY( m.prefix().second == target.begin() );
|
||||
VERIFY( m.prefix().matched == false );
|
||||
VERIFY( m.suffix().first == target.end() );
|
||||
VERIFY( m.suffix().second == target.end() );
|
||||
VERIFY( m.suffix().matched == false );
|
||||
VERIFY( m[0].first == target.begin() );
|
||||
VERIFY( m[0].second == target.end() );
|
||||
VERIFY( m[0].matched == true );
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
||||
|
@ -0,0 +1,61 @@
|
||||
// { dg-options "-std=c++0x" }
|
||||
// { dg-do run { xfail *-*-* } }
|
||||
|
||||
//
|
||||
// 2010-06-16 Stephen M. Webb <stephen.webb@bregmasoft.ca>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 28.11.2 regex_match
|
||||
// Tests BRE against a std::string target, exercising range {2,3}
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
std::regex re("a\\{2,3\\}", std::regex::basic);
|
||||
std::string target("aa");
|
||||
std::smatch m;
|
||||
|
||||
VERIFY( std::regex_match(target, m, re) );
|
||||
|
||||
VERIFY( m.size() == re.mark_count()+1 );
|
||||
VERIFY( m.empty() == false );
|
||||
VERIFY( m.prefix().first == target.begin() );
|
||||
VERIFY( m.prefix().second == target.begin() );
|
||||
VERIFY( m.prefix().matched == false );
|
||||
VERIFY( m.suffix().first == target.end() );
|
||||
VERIFY( m.suffix().second == target.end() );
|
||||
VERIFY( m.suffix().matched == false );
|
||||
VERIFY( m[0].first == target.begin() );
|
||||
VERIFY( m[0].second == target.end() );
|
||||
VERIFY( m[0].matched == true );
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
||||
|
@ -0,0 +1,65 @@
|
||||
// { dg-options "-std=c++0x" }
|
||||
// { dg-do run { xfail *-*-* } }
|
||||
|
||||
//
|
||||
// 2010-06-21 Stephen M. Webb <stephen.webb@bregmasoft.ca>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 28.11.2 regex_match
|
||||
// Tests ERE against a C-string target, plus-sign match.
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
std::regex re("(a+)", std::regex::extended);
|
||||
const char target[] = "aa";
|
||||
std::cmatch m;
|
||||
|
||||
VERIFY( std::regex_match(target, m, re) );
|
||||
|
||||
VERIFY( re.mark_count() == 1 );
|
||||
VERIFY( m.size() == re.mark_count()+1 );
|
||||
VERIFY( m.empty() == false );
|
||||
VERIFY( m.prefix().first == target );
|
||||
VERIFY( m.prefix().second == target );
|
||||
VERIFY( m.prefix().matched == false );
|
||||
VERIFY( m.suffix().first == target+sizeof(target) );
|
||||
VERIFY( m.suffix().second == target+sizeof(target) );
|
||||
VERIFY( m.suffix().matched == false );
|
||||
VERIFY( m[0].first == target );
|
||||
VERIFY( m[0].second == target+sizeof(target) );
|
||||
VERIFY( m[0].matched == true );
|
||||
VERIFY( m[1].first == target );
|
||||
VERIFY( m[1].second == target+sizeof(target) );
|
||||
VERIFY( m[1].matched == true );
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
||||
|
@ -0,0 +1,65 @@
|
||||
// { dg-options "-std=c++0x" }
|
||||
// { dg-do run { xfail *-*-* } }
|
||||
|
||||
//
|
||||
// 2010-06-21 Stephen M. Webb <stephen.webb@bregmasoft.ca>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 28.11.2 regex_match
|
||||
// Tests ERE against a C-string target, question-mark match.
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
std::regex re("(aa?)", std::regex::extended);
|
||||
char target[] = "a";
|
||||
std::cmatch m;
|
||||
|
||||
VERIFY( std::regex_match(target, m, re) );
|
||||
|
||||
VERIFY( re.mark_count() == 1 );
|
||||
VERIFY( m.size() == re.mark_count()+1 );
|
||||
VERIFY( m.empty() == false );
|
||||
VERIFY( m.prefix().first == target );
|
||||
VERIFY( m.prefix().second == target );
|
||||
VERIFY( m.prefix().matched == false );
|
||||
VERIFY( m.suffix().first == target+sizeof(target) );
|
||||
VERIFY( m.suffix().second == target+sizeof(target) );
|
||||
VERIFY( m.suffix().matched == false );
|
||||
VERIFY( m[0].first == target );
|
||||
VERIFY( m[0].second == target+sizeof(target) );
|
||||
VERIFY( m[0].matched == true );
|
||||
VERIFY( m[1].first == target );
|
||||
VERIFY( m[1].second == target+sizeof(target) );
|
||||
VERIFY( m[1].matched == true );
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
||||
|
@ -0,0 +1,60 @@
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
//
|
||||
// 2010-06-11 Stephen M. Webb <stephen.webb@bregmasoft.ca>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 28.11.2 regex_match
|
||||
// Tests ERE against a std::string target.
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
std::regex re(".*", std::regex::extended);
|
||||
std::string target("aaba");
|
||||
std::smatch m;
|
||||
|
||||
VERIFY( std::regex_match(target, m, re) );
|
||||
|
||||
VERIFY( m.size() == re.mark_count()+1 );
|
||||
VERIFY( m.empty() == false );
|
||||
VERIFY( m.prefix().first == target.begin() );
|
||||
VERIFY( m.prefix().second == target.begin() );
|
||||
VERIFY( m.prefix().matched == false );
|
||||
VERIFY( m.suffix().first == target.end() );
|
||||
VERIFY( m.suffix().second == target.end() );
|
||||
VERIFY( m.suffix().matched == false );
|
||||
VERIFY( m[0].first == target.begin() );
|
||||
VERIFY( m[0].second == target.end() );
|
||||
VERIFY( m[0].matched == true );
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
||||
|
@ -0,0 +1,60 @@
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
//
|
||||
// 2010-06-16 Stephen M. Webb <stephen.webb@bregmasoft.ca>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 28.11.2 regex_match
|
||||
// Tests ERE against a std::string target, exercising range {0,3}
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
std::regex re("a{0,3}", std::regex::extended);
|
||||
std::string target("aa");
|
||||
std::smatch m;
|
||||
|
||||
VERIFY( std::regex_match(target, m, re) );
|
||||
|
||||
VERIFY( m.size() == re.mark_count()+1 );
|
||||
VERIFY( m.empty() == false );
|
||||
VERIFY( m.prefix().first == target.begin() );
|
||||
VERIFY( m.prefix().second == target.begin() );
|
||||
VERIFY( m.prefix().matched == false );
|
||||
VERIFY( m.suffix().first == target.end() );
|
||||
VERIFY( m.suffix().second == target.end() );
|
||||
VERIFY( m.suffix().matched == false );
|
||||
VERIFY( m[0].first == target.begin() );
|
||||
VERIFY( m[0].second == target.end() );
|
||||
VERIFY( m[0].matched == true );
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
||||
|
@ -0,0 +1,60 @@
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
//
|
||||
// 2010-06-16 Stephen M. Webb <stephen.webb@bregmasoft.ca>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 28.11.2 regex_match
|
||||
// Tests ERE against a std::string target, exercising range {1,3}
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
std::regex re("a{1,3}", std::regex::extended);
|
||||
std::string target("aa");
|
||||
std::smatch m;
|
||||
|
||||
VERIFY( std::regex_match(target, m, re) );
|
||||
|
||||
VERIFY( m.size() == re.mark_count()+1 );
|
||||
VERIFY( m.empty() == false );
|
||||
VERIFY( m.prefix().first == target.begin() );
|
||||
VERIFY( m.prefix().second == target.begin() );
|
||||
VERIFY( m.prefix().matched == false );
|
||||
VERIFY( m.suffix().first == target.end() );
|
||||
VERIFY( m.suffix().second == target.end() );
|
||||
VERIFY( m.suffix().matched == false );
|
||||
VERIFY( m[0].first == target.begin() );
|
||||
VERIFY( m[0].second == target.end() );
|
||||
VERIFY( m[0].matched == true );
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
||||
|
@ -0,0 +1,61 @@
|
||||
// { dg-options "-std=c++0x" }
|
||||
// { dg-do run { xfail *-*-* } }
|
||||
|
||||
//
|
||||
// 2010-06-16 Stephen M. Webb <stephen.webb@bregmasoft.ca>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 28.11.2 regex_match
|
||||
// Tests ERE against a std::string target, exercising range {2,3}
|
||||
|
||||
#include <regex>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
std::regex re("a{2,3}", std::regex::extended);
|
||||
std::string target("aa");
|
||||
std::smatch m;
|
||||
|
||||
VERIFY( std::regex_match(target, m, re) );
|
||||
|
||||
VERIFY( m.size() == re.mark_count()+1 );
|
||||
VERIFY( m.empty() == false );
|
||||
VERIFY( m.prefix().first == target.begin() );
|
||||
VERIFY( m.prefix().second == target.begin() );
|
||||
VERIFY( m.prefix().matched == false );
|
||||
VERIFY( m.suffix().first == target.end() );
|
||||
VERIFY( m.suffix().second == target.end() );
|
||||
VERIFY( m.suffix().matched == false );
|
||||
VERIFY( m[0].first == target.begin() );
|
||||
VERIFY( m[0].second == target.end() );
|
||||
VERIFY( m[0].matched == true );
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
||||
|
@ -0,0 +1,35 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
//
|
||||
// 2010-06-10 Stephen M. Webb <stephen.webb@bregmasoft.ca>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 28.12.1 Class template regex_iterator
|
||||
|
||||
#include <regex>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
std::regex_iterator<char*> it;
|
||||
std::cregex_iterator cit;
|
||||
std::sregex_iterator sit;
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
//
|
||||
// 2010-06-10 Stephen M. Webb <stephen.webb@bregmasoft.ca>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 28.12.1 Class template regex_iterator
|
||||
|
||||
#include <regex>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
std::regex_iterator<wchar_t*> it;
|
||||
std::wcregex_iterator cit;
|
||||
std::wsregex_iterator sit;
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
//
|
||||
// 2010-06-10 Stephen M. Webb <stephen.webb@bregmasoft.ca>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 28.12.1 Class template regex_iterator
|
||||
|
||||
#include <regex>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
typedef std::regex_iterator<char*> it;
|
||||
|
||||
typedef it::regex_type regex_type;
|
||||
typedef it::value_type value_type;
|
||||
typedef it::difference_type difference_type;
|
||||
typedef it::pointer pointer;
|
||||
typedef it::reference reference;
|
||||
typedef it::iterator_category iterator_category;
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
//
|
||||
// 2010-06-10 Stephen M. Webb <stephen.webb@bregmasoft.ca>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 28.12.2 Class template regex_token_iterator
|
||||
|
||||
#include <regex>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
std::regex_token_iterator<char*> it;
|
||||
std::cregex_token_iterator cit;
|
||||
std::sregex_token_iterator sit;
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
//
|
||||
// 2010-06-10 Stephen M. Webb <stephen.webb@bregmasoft.ca>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 28.12.2 Class template regex_token_iterator
|
||||
|
||||
#include <regex>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
std::regex_token_iterator<wchar_t*> it;
|
||||
std::wcregex_token_iterator cit;
|
||||
std::wsregex_token_iterator sit;
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
// { dg-do compile }
|
||||
// { dg-options "-std=c++0x" }
|
||||
|
||||
//
|
||||
// 2010-06-10 Stephen M. Webb <stephen.webb@bregmasoft.ca>
|
||||
//
|
||||
// Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 28.12.2 Class template regex_token_iterator
|
||||
|
||||
#include <regex>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
typedef std::regex_token_iterator<char*> it;
|
||||
|
||||
typedef it::regex_type regex_type;
|
||||
typedef it::value_type value_type;
|
||||
typedef it::difference_type difference_type;
|
||||
typedef it::pointer pointer;
|
||||
typedef it::reference reference;
|
||||
typedef it::iterator_category iterator_category;
|
||||
}
|
Loading…
Reference in New Issue
Block a user