summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/bits/regex_executor.h
AgeCommit message (Collapse)Author
2017-01-01 Update copyright years.jakub
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@243994 138bc75d-0d04-0410-961f-82ee72b054a4
2016-08-22 Split _M_dfs() into smaller functions.timshen
* regex_executor.h(_M_handle_repeat, _M_handle_subexpr_begin) (_M_handle_subexpr_end, _M_handle_line_begin_assertion) (_M_handle_line_end_assertion, _M_handle_word_boundary) (_M_handle_subexpr_lookahead, _M_handle_match) (_M_handle_backref, _M_handle_accept, _M_handle_alternative): Add separate function declarations. * regex_executor.tcc: Split _M_dfs() into multiple handler functions. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@239673 138bc75d-0d04-0410-961f-82ee72b054a4
2016-01-04 Update copyright years.jakub
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@232055 138bc75d-0d04-0410-961f-82ee72b054a4
2015-07-30 * include/bits/regex_automaton.h (_State_base, _State<>):timshen
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> git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226395 138bc75d-0d04-0410-961f-82ee72b054a4
2015-01-05 Update copyright years.jakub
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@219188 138bc75d-0d04-0410-961f-82ee72b054a4
2014-11-25 PR libstdc++/63920timshen
* include/bits/regex_executor.h: Make _M_begin non const. * include/bits/regex_executor.tcc (_Executor<>::_M_search): Increase _M_begin in search algorithm, so that _M_begin is treated as "current start position" for each search iteration. * testsuite/28_regex/algorithms/regex_search/ecma/flags.cc: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@218037 138bc75d-0d04-0410-961f-82ee72b054a4
2014-10-23 PR libstdc++/63497timshen
include/bits/regex_executor.h (_Executor::_M_word_boundary): Remove unused parameter. include/bits/regex_executor.tcc (_Executor::_M_dfs, _Executor::_M_word_boundary): Avoid dereferecing _M_current at _M_end or other invalid position. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@216572 138bc75d-0d04-0410-961f-82ee72b054a4
2014-09-25 PR libstdc++/63199timshen
* include/bits/regex.h (basic_regex::basic_regex, basic_regex::assign, basic_regex::imbue, basic_regex::getloc, basic_regex::swap): Add _M_loc for basic_regex. * include/bits/regex_automaton.h: Add _M_traits for _NFA. * include/bits/regex_compiler.h (_Compiler::_M_get_nfa, __compile_nfa): Make _Compiler::_M_nfa heap allocated. * include/bits/regex_compiler.tcc (_Compiler::_Compiler): Make _Compiler::_M_nfa heap allocated. * include/bits/regex_executor.h (_Executor::_M_is_word): Fix accessing _M_traits. * include/bits/regex_executor.tcc (_Executor::_M_dfs): Fix accessing _M_traits. * testsuite/28_regex/algorithms/regex_match/ecma/wchar_t/63199.cc: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@215578 138bc75d-0d04-0410-961f-82ee72b054a4
2014-09-11 PR libstdc++/63219redi
* include/bits/regex.h (match_results::format): Remove stray template parameter. * include/bits/regex_compiler.h (_RegexTranslator::_RegexTranslator): Remove parameter name to avoid -Wunused-parameter warning. * include/bits/regex_executor.h (_State_info::_State_info): Reorder mem-initializers to avoid -Wreorder warning. * include/bits/regex_executor.tcc (_Executor::_M_word_boundary): Remove parameter name to avoid -Wunused-parameter warning. * include/bits/regex_scanner.tcc (_Scanner::_M_advance): Add braces to avoid -Wempty-body warning when not in debug mode. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@215160 138bc75d-0d04-0410-961f-82ee72b054a4
2014-07-01 PR libstdc++/61424timshen
* include/bits/regex.tcc (__regex_algo_impl<>): Use DFS for ECMAScript, not just regex containing back-references. * include/bits/regex_compiler.tcc (_Compiler<>::_M_disjunction): exchange _M_next and _M_alt for alternative operator, making matching from left to right. * include/bits/regex_executor.h (_State_info<>::_M_get_sol_pos): Add position tracking fom DFS. * include/bits/regex_executor.tcc (_Executor<>::_M_main_dispatch, _Executor<>::_M_dfs): Likewise. * include/bits/regex_scanner.h: Remove unused enum entry. * testsuite/28_regex/algorithms/regex_search/61424.cc: New testcase from PR. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@212184 138bc75d-0d04-0410-961f-82ee72b054a4
2014-06-02 * include/bits/regex_compiler.h (__detail::_BracketMatcher): Reorderredi
members to avoid wasted space when not using a cache. (__detail::_BracketMatcher::_M_ready()): Sort and deduplicate set. * include/bits/regex_compiler.tcc (__detail::_BracketMatcher::_M_apply(_CharT, false_type)): Use binary search on set. * include/bits/regex_executor.h (__detail::_Executor::_Match_mode): New enumeration type to indicate match mode. (__detail::_Executor::_State_info): New type holding members only needed in BFS-mode. Replace unique_ptr<vector<bool>> with unique_ptr<bool[]>. (__detail::_Executor::_M_rep_once_more, __detail::_Executor::_M_dfs): Replace template parameter with run-time function parameter. (__detail::_Executor::_M_main): Likewise. Dispatch to ... (__detail::_Executor::_M_main_dispatch): New overloaded functions to implement DFS and BFS mode. * include/bits/regex_executor.tcc (__detail::_Executor::_M_main): Split implementation into ... (__detail::_Executor::_M_main_dispatch): New overloaded functions. (__detail::_Executor::_M_lookahead): Create nested executor on stack. (__detail::_Executor::_M_rep_once_more): Pass match mode as function argument instead of template argument. (__detail::_Executor::_M_dfs): Likewise. * include/bits/regex_scanner.tcc: Fix typos in comments. * testsuite/performance/28_regex/range.cc: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@211143 138bc75d-0d04-0410-961f-82ee72b054a4
2014-04-272014-04-27 Tim Shen <timshen91@gmail.com>timshen
* include/bits/regex_automaton.h (_NFA<>::_M_insert_repeat): Add _S_opcode_repeat support to distingush a loop from _S_opcode_alternative. * include/bits/regex_automaton.tcc (_State_base::_M_print, _State_base::_M_dot, _NFA<>::_M_eliminate_dummy, _StateSeq<>::_M_clone): Likewise. * include/bits/regex_compiler.tcc (_Compiler<>::_M_quantifier): Likewise. * include/bits/regex_executor.tcc (_Executor<>::_M_dfs): Likewise. * include/bits/regex_scanner.tcc (_Scanner<>::_M_eat_escape_ecma): Uglify local variable __i. * include/bits/regex_compiler.h (_BracketMatcher<>::_M_make_cache): Use size_t instead of int to compare with vector::size(). 2014-04-27 Tim Shen <timshen91@gmail.com> * include/bits/regex_executor.h: Add _M_rep_count to track how many times this repeat node are visited. * include/bits/regex_executor.tcc (_Executor<>::_M_rep_once_more, _Executor<>::_M_dfs): Use _M_rep_count to prevent entering infinite loop. 2014-04-27 Tim Shen <timshen91@gmail.com> * include/bits/regex.tcc (__regex_algo_impl<>): Remove _GLIBCXX_REGEX_DFS_QUANTIFIERS_LIMIT and use _GLIBCXX_REGEX_USE_THOMPSON_NFA instead. * include/bits/regex_automaton.h: Remove quantifier counting variable. * include/bits/regex_automaton.tcc (_State_base::_M_dot): Adjust debug NFA dump. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@209844 138bc75d-0d04-0410-961f-82ee72b054a4
2014-03-152014-03-15 Tim Shen <timshen91@gmail.com>timshen
* include/bits/regex.h: Add/modify comments. * include/bits/regex_compiler.h: Likewise. * include/bits/regex_executor.h: Likewise. * include/bits/regex_executor.tcc: Likewise. * include/bits/regex_scanner.h: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208593 138bc75d-0d04-0410-961f-82ee72b054a4
2014-01-162014-01-17 Tim Shen <timshen91@gmail.com>timshen
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206690 138bc75d-0d04-0410-961f-82ee72b054a4
2014-01-072014-01-07 Tim Shen <timshen91@gmail.com>timshen
* include/bits/regex_compiler.h (_AnyMatcher<>::_AnyMatcher(), _AnyMatcher<>::operator(), _AnyMatcher<>::_M_apply(), _CharMatcher<>::_CharMatcher(), _CharMatcher<>::_M_translate(), _BracketMatcher<>::_BracketMatcher(), _BracketMatcher<>::operator(), _BracketMatcher<>::_M_add_char(), _BracketMatcher<>::_M_add_collating_element(), _BracketMatcher<>::_M_add_equivalence_class(), _BracketMatcher<>::_M_add_character_class(), _BracketMatcher<>::_M_make_range(), _BracketMatcher<>::_M_ready(), _BracketMatcher<>::_M_apply(), _BracketMatcher<>::_M_make_cache()): Fix _AnyMatcher behavior of POSIX style and move _M_flags to template parameter; Add cache for _BracketMatcher. Adjust declarations from here... * include/bits/regex.h (basic_regex<>::imbue()): ...to here. Also, imbuing a regex will trigger a recompilation to rebuild the cache. * include/bits/regex_compiler.tcc (_Compiler<>::_M_atom(), _Compiler<>::_M_bracket_expression()): Adjust matchers' caller for different template bool parameters. * include/bits/regex_executor.h: Remove unnecessary declarations. * include/std/regex: Adjust including orders. * testsuite/28_regex/traits/char/user_defined.cc: New. * testsuite/28_regex/traits/wchar_t/user_defined.cc: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206400 138bc75d-0d04-0410-961f-82ee72b054a4
2014-01-02Update copyright years in libstdc++-v3/rsandifo
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206301 138bc75d-0d04-0410-961f-82ee72b054a4
2013-11-08 * include/bits/regex_automaton.h (__detail::_State, __detail::_NFA,redi
__detail::_StateSeq): Remove redundant _CharT template parameters. * include/bits/regex_automaton.tcc: Likewise. * include/bits/regex_compiler.h (__detail::_Compiler): Likewise. (__compile_nfa): Add object generator for _Compiler. * include/bits/regex_compiler.tcc: Remove _CharT template parameters. * include/bits/regex_executor.h: Likewise. * include/bits/regex_executor.tcc: Likewise. * include/bits/regex.h (basic_regex): Assert char_type matches. Use __compile_nfa object generator. Remove _CharT template parameter. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204572 138bc75d-0d04-0410-961f-82ee72b054a4
2013-11-08 * include/bits/regex_automaton.h (__detail::_State): Splitredi
non-dependent parts into new _State_base. (__detail::_NFA): Likewise for _NFA_base. Use std::move() to avoid copies when inserting _MatcherT and _StateT objects. * include/bits/regex_automaton.tcc: Move member definitions to base class. Qualify dependent names. * include/bits/regex_compiler.h (__detail::_Compiler::_M_get_nfa): Make non-const and use std::move to avoid copying. * include/bits/regex_compiler.tcc: Likewise. * include/bits/regex_executor.h (__detail::_Executor::_M_is_word): Use array, so past-the-end iterator is valid. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204571 138bc75d-0d04-0410-961f-82ee72b054a4
2013-11-06 * include/bits/regex_automaton.h (_S_opcode_word_boundry): Rename toredi
_S_opcode_word_boundary. * include/bits/regex_automaton.tcc: Likewise. * include/bits/regex_executor.h (__detail::_Executor::_M_word_boundry): Rename to _M_word_boundary. * include/bits/regex_executor.tcc: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204449 138bc75d-0d04-0410-961f-82ee72b054a4
2013-10-262013-10-26 Tim Shen <timshen91@gmail.com>timshen
* include/bits/regex.h: Remove unnecessary friends. * include/bits/regex.tcc (__regex_algo_impl<>): Move __get_executor to here. * include/bits/regex_executor.h: Remove _DFSExecutor and _BFSExecutor; they are merged into _Executor. Eliminate quantifier tracking part, so it's faster. * include/bits/regex_executor.tcc: Implement _Executor. * testsuite/28_regex/algorithms/regex_match/ecma/char/ungreedy.cc: New. * testsuite/28_regex/algorithms/regex_search/ecma/greedy.cc: Adjust duplicate testcases. * testsuite/performance/28_regex/split.h: New. * testsuite/performance/28_regex/split_bfs.cc: New. * testsuite/util/testsuite_regex.h: Adjust behavior of two-executors agreement judger: do not compare match_results when executor return false. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204093 138bc75d-0d04-0410-961f-82ee72b054a4
2013-10-202013-10-20 Tim Shen <timshen91@gmail.com>timshen
* include/bits/regex.h: Remove virtual class _Automaton. * include/bits/regex_automaton.h: Likewise. * include/bits/regex.tcc: Adjust comment for policy changing. * include/bits/regex_executor.h: Update comments of complexity. * include/bits/regex_executor.tcc: Adjust executor choosing policy. Now DFS executor is the default one. * testsuite/util/testsuite_regex.h (regex_match_debug, regex_search_debug): Adjust for policy changing. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@203875 138bc75d-0d04-0410-961f-82ee72b054a4
2013-10-172013-10-17 Tim Shen <timshen91@gmail.com>timshen
* include/bits/regex.h (regex_token_iterator<>::regex_token_iterator): Fix initialization orders in initialization list and add explicit braces for potentially ambiguous(actually not) `else` branch to eliminate warnings. * include/bits/regex_automaton.h (_NFA<>::_NFA): Likewise. * include/bits/regex_compiler.h (_CharMatcher<>::_CharMatcher, _BracketMatcher<>::_BracketMatcher): Likewise. * include/bits/regex_compiler.tcc (_Compiler<>::_Compiler, _Compiler<>::_M_atom): Likewise. * include/bits/regex_executor.h (_Executor<>::_Executor): Likewise. * include/bits/regex_executor.tcc (_DFSExecutor<>::_M_dfs, _Executor<>::_M_word_boundry): Likewise. * include/bits/regex_scanner.tcc (_Scanner<>::_Scanner, _Scanner<>::_M_eat_class): Likewise. * include/bits/regex.tcc (__regex_algo_impl<>, regex_iterator<>::operator++): Likewise, and remove unused typedef. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@203798 138bc75d-0d04-0410-961f-82ee72b054a4
2013-10-152013-10-15 Tim Shen <timshen91@gmail.com>timshen
PR libstdc++/58737 * include/bits/regex_automaton.h (_Automaton<>::~_Automaton): Fix memory leak by adding it. * include/bits/regex_executor.h (_Executor<>::~_Executor): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@203610 138bc75d-0d04-0410-961f-82ee72b054a4
2013-10-082013-10-08 Tim Shen <timshen91@gmail.com>timshen
* include/bits/regex_executor.h: Add _TodoList class. * include/bits/regex_executor.tcc (_BFSExecutor<>::_M_main): Add _M_match_stack and _M_stack to make everything faster. Break if _M_stack is empty, to reduce unnecessary idling. * testsuite/performance/28_regex/split.cc: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@203261 138bc75d-0d04-0410-961f-82ee72b054a4
2013-10-062013-10-06 Tim Shen <timshen91@gmail.com>timshen
* include/bits/regex.h: (regex_token_iterator<>::regex_token_iterator): Fix compile error. * include/bits/regex.tcc: (regex_replace<>): Remove default parameter. 2013-10-06 Tim Shen <timshen91@gmail.com> * include/bits/regex.h (__regex_algo_impl<>, regex_match<>, regex_search<>): New abstract function for regex_match and regex_search. * include/bits/regex.tcc (__regex_algo_impl<>): Implement. * include/bits/regex_executor.h (_Executor<>::_M_lookahead, _DFSExecutor<>::_M_clone, _BFSExecutor<>::_M_clone): Let _M_clone to choose which executor to use. * include/bits/regex_executor.tcc (__get_executor<>): Update the definition to support __policy. * testsuite/28_regex/algorithms/regex_match/awk/cstring_01.cc: Use *_debug. * testsuite/28_regex/algorithms/regex_match/basic/empty_range.cc: Same. * testsuite/28_regex/algorithms/regex_match/basic/string_01.cc: Same. * testsuite/28_regex/algorithms/regex_match/basic/string_range_00_03.cc: Same. * testsuite/28_regex/algorithms/regex_match/basic/string_range_01_03.cc: Same. * testsuite/28_regex/algorithms/regex_match/basic/string_range_02_03.cc: Same. * testsuite/28_regex/algorithms/regex_match/ecma/char/53622.cc: Same. * testsuite/28_regex/algorithms/regex_match/ecma/char/57173.cc: Same. * testsuite/28_regex/algorithms/regex_match/ecma/char/58576.cc: Same. * testsuite/28_regex/algorithms/regex_match/ecma/char/anymatcher.cc: Same. * testsuite/28_regex/algorithms/regex_match/ecma/char/backref.cc: Same. * testsuite/28_regex/algorithms/regex_match/ecma/char/empty_range.cc: Same. * testsuite/28_regex/algorithms/regex_match/ecma/char/emptygroup.cc: Same. * testsuite/28_regex/algorithms/regex_match/ecma/char/hex.cc: Same. * testsuite/28_regex/algorithms/regex_match/ecma/char/quoted_char.cc: Same. * testsuite/28_regex/algorithms/regex_match/ecma/wchar_t/anymatcher.cc: Same. * testsuite/28_regex/algorithms/regex_match/ecma/wchar_t/hex.cc: Same. * testsuite/28_regex/algorithms/regex_match/extended/ string_bracket_01.cc: Same. * testsuite/28_regex/algorithms/regex_match/extended/cstring_plus.cc: Same. * testsuite/28_regex/algorithms/regex_match/extended/ string_questionmark.cc: Same. * testsuite/28_regex/algorithms/regex_match/extended/cstring_range.cc: Same. * testsuite/28_regex/algorithms/regex_match/extended/string_any.cc: Same. * testsuite/28_regex/algorithms/regex_match/extended/ string_dispatch_01.cc: Same. * testsuite/28_regex/algorithms/regex_match/extended/ string_range_00_03.cc: Same. * testsuite/28_regex/algorithms/regex_match/extended/ string_range_01_03.cc: Same. * testsuite/28_regex/algorithms/regex_match/extended/ string_range_02_03.cc: Same. * testsuite/28_regex/algorithms/regex_match/extended/wstring_locale.cc: Same. * testsuite/28_regex/algorithms/regex_search/basic/string_01.cc: Same. * testsuite/28_regex/algorithms/regex_search/ecma/assertion.cc: Same. * testsuite/28_regex/algorithms/regex_search/ecma/flags.cc: Same. * testsuite/28_regex/algorithms/regex_search/ecma/greedy.cc: Same. * testsuite/28_regex/algorithms/regex_search/ecma/string_01.cc: Same. * testsuite/28_regex/match_results/format.cc: Same. * testsuite/util/testsuite_regex.h (regex_match_debug<>, regex_search_debug<>): Implement. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@203231 138bc75d-0d04-0410-961f-82ee72b054a4
2013-09-242013-09-24 Tim Shen <timshen91@gmail.com>timshen
* include/Makefile.am: Add regex.tcc. * include/Makefile.in: Regenerate. * include/bits/regex.h: Remove definitions to regex.tcc. * include/bits/regex.tcc: New. (match_results::format, regex_replace): Implement; * include/bits/regex_compiler.h: Move _M_flags to the top of class member list, because other members' initialization depend on it. * include/bits/regex_compiler.tcc (_Compiler<>::_Compiler): Adjust member initializations. (_Compiler<>::_M_quantifier): Fix ungreedy interval quantifier. * include/bits/regex_executor.h: Remove _RegexT from _*Executor classes. In the future, all regex classes may refactor to *Impl style. * include/bits/regex_executor.tcc (_Executor::_M_set_results): Merge identical code from _*Executor classes. * testsuite/28_regex/algorithms/regex_match/extended/ string_dispatch_01.cc (fake_match<>): Adjust the hacking-style testcase caller for new __get_executors interface. * testsuite/28_regex/algorithms/regex_replace/char/basic_replace.cc: New. * testsuite/28_regex/match_results/format.cc: New. * testsuite/28_regex/traits/char/lookup_collatename.cc: Remove digraph testcase. * testsuite/28_regex/traits/wchar_t/lookup_collatename.cc: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@202858 138bc75d-0d04-0410-961f-82ee72b054a4
2013-09-182013-09-18 Tim Shen <timshen91@gmail.com>timshen
* include/bits/regex.h: Add friend classes. (match_results<>::position, regex_iterator<>::operator++): Implement position specification in regex_iterator. (regex_match<>, regex_search<>): Move match_results initializations to these function. Remove `todo`. * include/bits/regex_compiler.tcc: (_Compiler<>::_M_quantifier): Fix greedy/ungreedy of interval matching. * include/bits/regex_constants.h: Fix indentation. Change match_flag_type to enum type. * include/bits/regex_executor.h: Merge identical code to the base class _Executor. Support flags in regex_constants. * include/bits/regex_executor.tcc: Likewise. * include/bits/regex_scanner.h: Add comments. * include/bits/regex_scanner.tcc: Same. * testsuite/28_regex/algorithms/regex_search/ecma/assertion.cc: Add a testcase. * testsuite/28_regex/algorithms/regex_search/ecma/flags.cc: New. * testsuite/28_regex/iterators/regex_iterator/char/ string_position_01.cc: Remove `xfail`. * testsuite/28_regex/iterators/regex_iterator/wchar_t/string_02.cc: Remove `xfail` and make the case really work. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@202706 138bc75d-0d04-0410-961f-82ee72b054a4
2013-09-142013-09-14 Tim Shen <timshen91@gmail.com>timshen
* include/bits/regex.h (regex_match<>, regex_search<>): Change regex_executor caller. Now use their return value instead of checking __m[0].matched to find out if it's successful. (regex_search<>): Move the search logic to regex_executor. * include/bits/regex_automaton.h: Add some new _Opcode. Refactor _NFA::_M_insert_*. * include/bits/regex_automaton.tcc: Add DEBUG dump for new _Opcode. Refactor _NFA::_M_insert_*. * include/bits/regex_compiler.h (_Compiler<>::_M_get_nfa): Use make_shared instead of construct by hand. * include/bits/regex_compiler.tcc: Implement _Compiler<>::_M_assertion. * include/bits/regex_constants.h: Fix indentation and line breaking. * include/bits/regex_executor.h: Add _ResultsEntry to support greedy/ungreedy mode. Move regex_search logic here. * include/bits/regex_executor.tcc: Implement assertions and greedy/ungreedy matching. * include/bits/regex_scanner.h: Add a new token _S_token_ungreedy. * include/bits/regex_scanner.tcc: Parse a new token _S_token_ungreedy. * testsuite/28_regex/algorithms/regex_search/ecma/assertion.cc: New. * testsuite/28_regex/algorithms/regex_search/ecma/greedy.cc: New. * testsuite/28_regex/algorithms/regex_search/ecma/string_01.cc: Fix comment. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@202591 138bc75d-0d04-0410-961f-82ee72b054a4
2013-08-292013-08-29 Tim Shen <timshen91@gmail.com>timshen
* include/bits/regex.h (basic_regex<>::assign): Don't lose _M_traits. (regex_iterator<>::regex_iterator): Return nullptr when regex_search failed. (regex_token_iterator<>::_M_end_of_seq): Should be defined true when _M_result is(not isn't) nullptr. * include/bits/regex_compiler.h: Store _Compiler::_M_traits by reference instead of by value. * include/bits/regex_executor.h (_DFSExecutor<>::_DFSExecutor): Add _M_traits to _DFSExecutor. * include/bits/regex_executor.tcc (__get_executor<>): Pass traits to _DFSExecutor too. * testsuite/28_regex/algorithms/regex_match/extended/wstring_locale.cc: New. * testsuite/28_regex/iterators/regex_token_iterator/wchar_t/ wstring_02.cc: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@202082 138bc75d-0d04-0410-961f-82ee72b054a4
2013-08-222013-08-22 Tim Shen <timshen91@gmail.com>timshen
* include/bits/regex.h: Replace 8 spaces in indentation with a tab. * include/bits/regex_automaton.h: Same. * include/bits/regex_automaton.tcc: Same. * include/bits/regex_compiler.h: Same. * include/bits/regex_compiler.tcc: Same. * include/bits/regex_constants.h: Same. * include/bits/regex_executor.h: Same. * include/bits/regex_executor.tcc: Same. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@201916 138bc75d-0d04-0410-961f-82ee72b054a4
2013-08-222013-08-22 Tim Shen <timshen91@gmail.com>timshen
* include/bits/regex.h: Executor caller. * include/bits/regex_executor.h: Fix empty grouping problem. * include/bits/regex_executor.tcc: Same. * testsuite/28_regex/algorithms/regex_match/ecma/cstring_emptygroup.cc: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@201914 138bc75d-0d04-0410-961f-82ee72b054a4
2013-08-182013-08-18 Tim Shen <timshen91@gmail.com>timshen
* include/bits/regex_automaton.h: _S_opcode_backref. * include/bits/regex_automaton.tcc: Backref automaton support. * include/bits/regex_compiler.tcc: Parsing support. * include/bits/regex_executor.h: Add _M_traits for _DFSExecutor. * include/bits/regex_executor.tcc: Add _S_opcode_backref support. * testsuite/28_regex/algorithms/regex_match/ecma/string_backref.cc: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@201825 138bc75d-0d04-0410-961f-82ee72b054a4
2013-08-072013-08-07 Tim Shen <timshen91@gmail.com>timshen
* include/Makefile.am: Adjust to new files. * include/Makefile.in: Regenerate. * include/bits/regex.h: Adjust to new interfaces. * include/bits/regex_automaton.h: New. * include/bits/regex_automaton.tcc: New. * include/bits/regex_compiler.h: Adjust to new files. * include/bits/regex_compiler.tcc: New. * include/bits/regex_constants.h: Tail spaces. * include/bits/regex_error.h: Likewise. * include/bits/regex_executor.h: New. * include/bits/regex_executor.tcc: New. * include/std/regex: Adjust to new files. * testsuite/28_regex/algorithms/regex_match/extended/ string_dispatch_01.cc: Adjust to new interfaces. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@201573 138bc75d-0d04-0410-961f-82ee72b054a4