* include/bits/regex_automaton.h (_State_base, _State<>):
Remove _TraitsT dependency from _State<>; Make matcher member
into the union to reduce struct size.
* include/bits/regex_automaton.tcc (_State_base<>::_M_print,
_State_base<>::_M_dot, _StateSeq<>::_M_clone):
Adjust to fit the interface. Factor out common parts in
_M_clone as _State<>::_M_has_alt.
* include/bits/regex_executor.h (_Executer<>::_M_lookahead):
Only pass state id instead of the whole state.
* include/bits/regex_executor.tcc (_Executer<>::_M_dfs,
_Executer<>::_M_lookahead): Adjust to fit the interface.
* include/std/regex: Include <ext/aligned_buffer.h>
From-SVN: r226395
PR libstdc++/64584
PR libstdc++/64585
* include/bits/regex.h (basic_regex<>::basic_regex,
basic_regex<>::assign, basic_regex<>::imbue,
basic_regex<>::swap, basic_regex<>::mark_count): Drop NFA after
imbuing basic_regex; Make assign() transactional against exception.
* include/bits/regex_compiler.h (__compile_nfa<>): Add back
__compile_nfa SFINAE.
* include/std/regex: Adjust include order to avoid __compile_nfa
forward declaration.
* testsuite/28_regex/basic_regex/assign/char/string.cc: New testcase.
* testsuite/28_regex/basic_regex/imbue/string.cc: New testcase.
From-SVN: r219865
PR libstdc++/61061
PR libstdc++/61582
* include/bits/regex_automaton.h (_NFA<>::_M_insert_state): Add
a NFA state limit. If it's exceeded, regex_constants::error_space
will be throwed.
* include/bits/regex_automaton.tcc (_StateSeq<>::_M_clone): Use
map (which is sparse) instead of vector. This reduce n times clones'
cost from O(n^2) to O(n).
* include/std/regex: Add map dependency.
* testsuite/28_regex/algorithms/regex_match/ecma/char/61601.cc: New
testcase.
From-SVN: r212185
2014-01-17 Tim Shen <timshen91@gmail.com>
* include/bits/regex_automaton.tcc (_StateSeq<>::_M_clone()): Do not
use std::map.
* include/bits/regex_automaton.h: Do not use std::set.
* include/bits/regex_compiler.h (_BracketMatcher<>::_M_add_char(),
_BracketMatcher<>::_M_add_collating_element(),
_BracketMatcher<>::_M_add_equivalence_class(),
_BracketMatcher<>::_M_make_range()): Likewise.
* include/bits/regex_compiler.tcc (_BracketMatcher<>::_M_apply()):
Likewise.
* include/bits/regex_executor.h: Do not use std::queue.
* include/bits/regex_executor.tcc (_Executor<>::_M_main(),
_Executor<>::_M_dfs()): Likewise.
* include/std/regex: Remove <map>, <set> and <queue>.
2014-01-17 Tim Shen <timshen91@gmail.com>
* include/bits/regex.h (__compile_nfa<>(), basic_regex<>::basic_regex(),
basic_regex<>::assign()): Change __compile_nfa to accept
const _CharT* only.
* include/bits/regex_compiler.h: Change _Compiler's template
argument from <_FwdIter, _TraitsT> to <_TraitsT>.
* include/bits/regex_compiler.tcc: Likewise.
2014-01-17 Tim Shen <timshen91@gmail.com>
* include/bits/regex_compiler.h: Change _ScannerT into char-type
templated.
* include/bits/regex_scanner.h (_Scanner<>::_Scanner()): Separate
_ScannerBase from _Scanner; Change _Scanner's template argument from
_FwdIter to _CharT. Avoid use of std::map and std::set by using arrays
instead.
* include/bits/regex_scanner.tcc (_Scanner<>::_Scanner(),
_Scanner<>::_M_scan_normal(), _Scanner<>::_M_eat_escape_ecma(),
_Scanner<>::_M_eat_escape_posix(), _Scanner<>::_M_eat_escape_awk()):
Likewise.
* include/std/regex: Add <cstring> for using strchr.
2014-01-17 Tim Shen <timshen91@gmail.com>
* bits/regex_automaton.tcc: Indentation fix.
* bits/regex_compiler.h (__compile_nfa<>(), _Compiler<>,
_RegexTranslator<> _AnyMatcher<>, _CharMatcher<>,
_BracketMatcher<>): Add bool option template parameters and
specializations to make matching more efficient and space saving.
* bits/regex_compiler.tcc: Likewise.
From-SVN: r206690
2013-07-31 Tim Shen <timshen91@gmail.com>
Thompson matcher refactored. Fix grouping problem.
* include/bits/regex.h: Use a dispatcher _M_get_matcher().
* include/bits/regex_compiler.h: Tweak for auto switching.
* include/bits/regex_grep_matcher.h: Class structure.
* include/bits/regex_grep_matcher.tcc: _BFSMatcher(Thompson
matcher) refactoring.
* include/bits/regex_nfa.h: Change _Results's interfaces.
* include/std/regex: Includes <map> and <queue>.
* testsuite/28_regex/algorithms/regex_match/extended/53622.cc:
For both matchers.
* testsuite/28_regex/algorithms/regex_match/extended/57173.cc:
For both matchers.
* testsuite/28_regex/algorithms/regex_match/extended/
string_dispatch_01.cc: New.
From-SVN: r201391
2013-07-31 Tim Shen <timshen91@gmail.com>
Thompson matcher refactored. Fix grouping problem.
* include/bits/regex.h: Use a dispatcher _M_get_matcher().
* include/bits/regex_compiler.h: Tweak for auto switching.
* include/bits/regex_grep_matcher.h: Class structure.
* include/bits/regex_grep_matcher.tcc: _BFSMatcher(Thompson
matcher) refactoring.
* include/bits/regex_nfa.h: Change _Results's interfaces.
* include/std/regex: Includes <map> and <queue>.
* testsuite/28_regex/algorithms/regex_match/extended/53622.cc:
For both matchers.
* testsuite/28_regex/algorithms/regex_match/extended/57173.cc:
For both matchers.
* testsuite/28_regex/algorithms/regex_match/extended/
string_dispatch_01.cc: New.
From-SVN: r201358
2013-07-30 Tim Shen <timshen91@gmail.com>
Thompson matcher refactored. Fix grouping problem.
* include/bits/regex.h: Use a dispatcher _M_get_matcher().
* include/bits/regex_compiler.h: Tweak for auto switching.
* include/bits/regex_grep_matcher.h: Class structure.
* include/bits/regex_grep_matcher.tcc: _BFSMatcher(Thompson
matcher) refactoring.
* include/bits/regex_nfa.h: Change _Results's interfaces.
* include/std/regex: Includes <map> and <queue>.
* testsuite/28_regex/algorithms/regex_match/extended/53622.cc:
For both matchers.
* testsuite/28_regex/algorithms/regex_match/extended/57173.cc:
For both matchers.
* testsuite/28_regex/algorithms/regex_match/extended/string_dispatch_01.cc:
New.
From-SVN: r201334
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