summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/bits/regex_compiler.h
AgeCommit message (Collapse)Author
2020-01-01Update copyright years.Jakub Jelinek
From-SVN: r279813
2019-01-01Update copyright years.Jakub Jelinek
From-SVN: r267494
2018-07-02Optimize std::sub_match comparisons using string_view-like typeJonathan Wakely
Avoid creation of unnecessary basic_string objects by using a simplified string_view type and performing comparisons on that type instead. A temporary basic_string object is still used when the sub_match's iterators are not contiguous, in order to get an object that the __string_view can reference. * include/bits/regex.h (sub_match::operator string_type): Call str(). (sub_match::compare): Use _M_str() instead of str(). (sub_match::_M_compare): New public function. (sub_match::__string_view): New helper type. (sub_match::_M_str): New overloaded functions to avoid creating a string_type object when not needed. (operator==, operator!=, operator<, operator>, operator<=, operator>=): Use sub_match::_M_compare instead of creating string_type objects. Fix Doxygen comments. * include/bits/regex_compiler.h (__has_contiguous_iter): Remove. (__is_contiguous_normal_iter): Rename to __is_contiguous_iter and simplify. (__enable_if_contiguous_iter, __disable_if_contiguous_iter): Use __enable_if_t. * include/std/type_traits (__enable_if_t): Define for C++11. * testsuite/28_regex/sub_match/compare.cc: New. * testsuite/util/testsuite_iterators.h (remove_cv): Add transformation trait. (input_iterator_wrapper): Use remove_cv for value_type argument of std::iterator base class. From-SVN: r262318
2018-05-10regex_compiler.h (_S_cache_size): Change from function to variable.Jason Merrill
* include/bits/regex_compiler.h (_S_cache_size): Change from function to variable. From-SVN: r260128
2018-01-03Update copyright years.Jakub Jelinek
From-SVN: r256169
2017-07-23re PR libstdc++/81064 (Inline namespace regression)François Dumont
2017-07-23 François Dumont <fdumont@gcc.gnu.org> PR libstdc++/81064 * include/bits/algorithmfwd.h: Reorganize versioned namespace. * include/bits/basic_string.h: Likewise. * include/bits/c++config: Likewise. * include/bits/deque.tcc: Likewise. * include/bits/forward_list.h: Likewise. * include/bits/forward_list.tcc: Likewise. * include/bits/hashtable_policy.h: Likewise. * include/bits/list.tcc: Likewise. * include/bits/move.h: Likewise. * include/bits/quoted_string.h: Likewise. * include/bits/random.h: Likewise. * include/bits/random.tcc: Likewise. * include/bits/regex.h: Likewise. * include/bits/regex.tcc: Likewise. * include/bits/regex_automaton.h: Likewise. * include/bits/regex_automaton.tcc: Likewise. * include/bits/regex_compiler.h: Likewise. * include/bits/regex_compiler.tcc: Likewise. * include/bits/regex_constants.h: Likewise. * include/bits/regex_error.h: Likewise. * include/bits/regex_executor.h: Likewise. * include/bits/regex_executor.tcc: Likewise. * include/bits/regex_scanner.h: Likewise. * include/bits/regex_scanner.tcc: Likewise. * include/bits/specfun.h: Likewise. * include/bits/stl_algo.h: Likewise. * include/bits/stl_algobase.h: Likewise. * include/bits/stl_bvector.h: Likewise. * include/bits/stl_deque.h: Likewise. * include/bits/stl_iterator.h: Likewise. * include/bits/stl_iterator_base_funcs.h: Likewise. * include/bits/stl_list.h: Likewise. * include/bits/stl_map.h: Likewise. * include/bits/stl_multimap.h: Likewise. * include/bits/stl_multiset.h: Likewise. * include/bits/stl_relops.h: Likewise. * include/bits/stl_set.h: Likewise. * include/bits/stl_vector.h: Likewise. * include/bits/uniform_int_dist.h: Likewise. * include/bits/unordered_map.h: Likewise. * include/bits/unordered_set.h: Likewise. * include/bits/vector.tcc: Likewise. * include/c_global/cmath: Likewise. * include/c_std/cmath: Likewise. * include/decimal/decimal: Likewise. * include/decimal/decimal.h: Likewise. * include/experimental/algorithm: Likewise. * include/experimental/any: Likewise. * include/experimental/array: Likewise. * include/experimental/bits/erase_if.h: Likewise. * include/experimental/bits/fs_dir.h: Likewise. * include/experimental/bits/fs_fwd.h: Likewise. * include/experimental/bits/fs_ops.h: Likewise. * include/experimental/bits/fs_path.h: Likewise. * include/experimental/bits/lfts_config.h: Likewise. * include/experimental/bits/shared_ptr.h: Likewise. * include/experimental/bits/string_view.tcc: Likewise. * include/experimental/chrono: Likewise. * include/experimental/deque: Likewise. * include/experimental/filesystem: Likewise. * include/experimental/forward_list: Likewise. * include/experimental/functional: Likewise. * include/experimental/iterator: Likewise. * include/experimental/list: Likewise. * include/experimental/map: Likewise. * include/experimental/memory: Likewise. * include/experimental/memory_resource: Likewise. * include/experimental/numeric: Likewise. * include/experimental/optional: Likewise. * include/experimental/propagate_const: Likewise. * include/experimental/random: Likewise. * include/experimental/ratio: Likewise. * include/experimental/regex: Likewise. * include/experimental/set: Likewise. * include/experimental/source_location: Likewise. * include/experimental/string: Likewise. * include/experimental/string_view: Likewise. * include/experimental/system_error: Likewise. * include/experimental/tuple: Likewise. * include/experimental/type_traits: Likewise. * include/experimental/unordered_map: Likewise. * include/experimental/unordered_set: Likewise. * include/experimental/utility: Likewise. * include/experimental/vector: Likewise. * include/ext/bitmap_allocator.h: Likewise. * include/ext/codecvt_specializations.h: Likewise. * include/ext/rope: Likewise. * include/ext/typelist.h: Likewise. * include/std/chrono: Likewise. * include/std/complex: Likewise. * include/std/functional: Likewise. * include/std/numeric: Likewise. * include/std/string_view: Likewise. * include/std/thread: Likewise. * include/std/variant: Likewise. * include/tr1/array: Likewise. * include/tr1/bessel_function.tcc: Likewise. * include/tr1/beta_function.tcc: Likewise. * include/tr1/cmath: Likewise. * include/tr1/complex: Likewise. * include/tr1/ell_integral.tcc: Likewise. * include/tr1/exp_integral.tcc: Likewise. * include/tr1/functional: Likewise. * include/tr1/functional_hash.h: Likewise. * include/tr1/gamma.tcc: Likewise. * include/tr1/hashtable.h: Likewise. * include/tr1/hashtable_policy.h: Likewise. * include/tr1/hypergeometric.tcc: Likewise. * include/tr1/legendre_function.tcc: Likewise. * include/tr1/modified_bessel_func.tcc: Likewise. * include/tr1/poly_hermite.tcc: Likewise. * include/tr1/poly_laguerre.tcc: Likewise. * include/tr1/random.h: Likewise. * include/tr1/random.tcc: Likewise. * include/tr1/regex: Likewise. * include/tr1/riemann_zeta.tcc: Likewise. * include/tr1/shared_ptr.h: Likewise. * include/tr1/special_function_util.h: Likewise. * include/tr1/tuple: Likewise. * include/tr1/type_traits: Likewise. * include/tr1/unordered_map.h: Likewise. * include/tr1/unordered_set.h: Likewise. * include/tr1/utility: Likewise. * include/tr2/bool_set: Likewise. * include/tr2/bool_set.tcc: Likewise. * include/tr2/dynamic_bitset: Likewise. * include/tr2/dynamic_bitset.tcc: Likewise. * include/tr2/ratio: Likewise. * include/tr2/type_traits: Likewise. * src/c++11/chrono.cc: Likewise. * src/c++11/compatibility-c++0x.cc: Likewise. * src/c++11/compatibility-chrono.cc: Likewise. * src/c++11/cxx11-shim_facets.cc: Likewise. * src/c++11/hashtable_c++0x.cc: Likewise. * src/c++11/placeholders.cc: Likewise. * src/c++11/thread.cc: Likewise. * src/c++98/bitmap_allocator.cc: Likewise. * src/c++98/hashtable_tr1.cc: Likewise. * src/c++98/list.cc: Likewise. * src/shared/hashtable-aux.cc: Likewise. * testsuite/20_util/duration/literals/range.cc: Adapt line number. * testsuite/20_util/duration/requirements/typedefs_neg1.cc: Likewise. * testsuite/20_util/duration/requirements/typedefs_neg2.cc: Likewise. * testsuite/20_util/duration/requirements/typedefs_neg3.cc: Likewise. * testsuite/20_util/forward/c_neg.cc: Likewise. * testsuite/20_util/forward/f_neg.cc: Likewise. * testsuite/26_numerics/gcd/gcd_neg.cc: Likewise. * testsuite/26_numerics/lcm/lcm_neg.cc: Likewise. * testsuite/26_numerics/random/pr60037-neg.cc: Likewise. * python/libstdcxx/v6/printers.py: Adapt. From-SVN: r250458
2017-06-07PR libstdc++/81002 fix std::basic_regex range constructorJonathan Wakely
PR libstdc++/81002 * include/bits/regex.h (basic_regex): Adjust call to __compile_nfa so iterator type is deduced. * include/bits/regex_compiler.h (__compile_nfa): Reorder template parameters to allow iterator type to be deduced. * testsuite/28_regex/basic_regex/ctors/basic/iter.cc: New. From-SVN: r248989
2017-01-01Update copyright years.Jakub Jelinek
From-SVN: r243994
2016-12-01re PR libstdc++/71500 (regex::icase only works on first character in a range)Tim Shen
PR libstdc++/71500 * include/bits/regex.h (basic_regex::basic_regex): Use ECMAScript when the syntax is not specified. * include/bits/regex_compiler.h (_RegexTranslator, _RegexTranslatorBase): Partially support icase in ranges. * include/bits/regex_compiler.tcc (_BracketMatcher::_M_apply): Refactor _M_apply to make the control flow easier to follow, and call _M_translator._M_match_range as added previously. * testsuite/28_regex/traits/char/icase.cc: Add new tests. * testsuite/28_regex/traits/char/user_defined.cc: Add new tests. From-SVN: r243093
2016-01-04Update copyright years.Jakub Jelinek
From-SVN: r232055
2015-09-19re PR libstdc++/67361 (std::regex_error::what() should say something about ↵Tim Shen
the error_code) PR libstdc++/67361 * include/bits/regex_error.h: Add __throw_regex_error that supports string. * include/bits/regex_automaton.h: Add more specific exception messages. * include/bits/regex_automaton.tcc: Likewise. * include/bits/regex_compiler.h: Likewise. * include/bits/regex_compiler.tcc: Likewise. * include/bits/regex_scanner.h: Likewise. * include/bits/regex_scanner.tcc: Likewise. From-SVN: r227936
2015-09-07Avoid #ifdef _GLIBCXX_DEBUG in regex_compiler.hJonathan Wakely
* include/bits/regex_compiler.h (_BracketMatcher::_M_is_ready): Initialize using NSDMI and set using _GLIBCXX_DEBUG_ONLY. From-SVN: r227521
2015-07-29re PR libstdc++/67015 ("^[a-z0-9][a-z0-9-]*$", std::regex::extended is ↵Tim Shen
miscompiled) PR libstdc++/67015 * include/bits/regex_compiler.h (_Compiler<>::_M_expression_term, _BracketMatcher<>::_M_add_collating_element): Change signature to make checking the and of bracket expression easier. * include/bits/regex_compiler.tcc (_Compiler<>::_M_expression_term): Treat '-' as a valid literal if it's at the end of bracket expression. * testsuite/28_regex/algorithms/regex_match/cstring_bracket_01.cc: New testcases. From-SVN: r226336
2015-01-19re PR libstdc++/64584 (basic_regex::assign breaks *this if it throws ↵Tim Shen
regex_error) 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
2015-01-05Update copyright years.Jakub Jelinek
From-SVN: r219188
2014-12-03regex_compiler.h (_S_cache_size): Multiply the RHS of the shift-expression ↵Marek Polacek
by _UseCache::value. * include/bits/regex_compiler.h (_S_cache_size): Multiply the RHS of the shift-expression by _UseCache::value. From-SVN: r218322
2014-11-13re PR libstdc++/63775 ([C++11] Regex range with leading dash (-) not working)Tim Shen
PR libstdc++/63775 * include/bits/regex_compiler.h (_Compiler<>::_M_expression_term, _BracketMatcher<>::_M_make_range): Throw regex_erorr on invalid range like [z-a]. Change _M_expression_term interface. * include/bits/regex_compiler.tcc ( _Compiler<>::_M_insert_bracket_matcher, _Compiler<>::_M_expression_term): Rewrite bracket expression parsing. * testsuite/28_regex/algorithms/regex_match/cstring_bracket_01.cc: Add testcases and move file out of extended. From-SVN: r217461
2014-09-25re PR libstdc++/63199 (Inserting std::wregex to std::vector loses some ↵Tim Shen
std::wregex values) PR libstdc++/63199 * 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. From-SVN: r215578
2014-09-11re PR libstdc++/63219 (Superfluous template parameter in ↵Jonathan Wakely
match_result::format overload) PR libstdc++/63219 * 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. From-SVN: r215160
2014-06-02regex_compiler.h (__detail::_BracketMatcher): Reorder members to avoid ↵Jonathan Wakely
wasted space when not using a cache. * include/bits/regex_compiler.h (__detail::_BracketMatcher): Reorder 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. From-SVN: r211143
2014-05-20re PR libstdc++/61227 ([C++11] Regex [\w] does not work)Tim Shen
2014-05-20 Tim Shen <timshen91@gmail.com> PR libstdc++/61227 * include/bits/regex_compiler.h (_BracketMatcher<>::_M_add_character_class): Add negative character class support. * include/bits/regex_compiler.tcc (_BracketMatcher<>::_M_apply): Likewise. * testsuite/28_regex/algorithms/regex_match/ecma/char/quoted_char.cc: Add more testcases. From-SVN: r210630
2014-04-27regex_automaton.h (_NFA<>::_M_insert_repeat): Add _S_opcode_repeat support ↵Tim Shen
to distingush a loop from _S_opcode_alternative. 2014-04-27 Tim Shen <timshen91@gmail.com> * 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. From-SVN: r209844
2014-03-15regex.h: Add/modify comments.Tim Shen
2014-03-15 Tim Shen <timshen91@gmail.com> * 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. From-SVN: r208593
2014-01-19regex_compiler.h (_Comipler<>::_M_quantifier()): Fix parse error of multiple ↵Tim Shen
consecutive quantifiers like "a**". 2014-01-19 Tim Shen <timshen91@gmail.com> * include/bits/regex_compiler.h (_Comipler<>::_M_quantifier()): Fix parse error of multiple consecutive quantifiers like "a**". * include/bits/regex_compiler.tcc (_Comipler<>::_M_quantifier()): Likewise. * testsuite/28_regex/basic_regex/multiple_quantifiers.cc: New. From-SVN: r206783
2014-01-16regex_automaton.tcc (_StateSeq<>::_M_clone()): Do not use std::map.Tim Shen
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
2014-01-07regex_compiler.h (_AnyMatcher<>::_AnyMatcher(), [...]): Fix _AnyMatcher ↵Tim Shen
behavior of POSIX style and move _M_flags to template parameter... 2014-01-07 Tim Shen <timshen91@gmail.com> * 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. From-SVN: r206400
2014-01-02Update copyright years in libstdc++-v3/Richard Sandiford
From-SVN: r206301
2013-12-03regex_compiler.h: Add todo comment.Tim Shen
2013-12-03 Tim Shen <timshen91@gmail.com> * regex_compiler.h: Add todo comment. * regex_executor.tcc: Likewise. From-SVN: r205624
2013-11-08regex_compiler.h (__detail::__has_contiguous_iter): vector<bool> storage is ↵Jonathan Wakely
not contiguous. * include/bits/regex_compiler.h (__detail::__has_contiguous_iter): vector<bool> storage is not contiguous. From-SVN: r204582
2013-11-08regex_compiler.h (__detail::__compile_nfa): Overload so that ↵Jonathan Wakely
std::basic_string<C> and std::vector<C> iterators dispatch to... * include/bits/regex_compiler.h (__detail::__compile_nfa): Overload so that std::basic_string<C> and std::vector<C> iterators dispatch to the const C* compiler. From-SVN: r204574
2013-11-08regex_compiler.h (__detail::_AnyMatcher, [...]): Remove redundant _CharT ↵Jonathan Wakely
template parameters. * include/bits/regex_compiler.h (__detail::_AnyMatcher, __detail::_CharMatcher, __detail::_BracketMatcher): Remove redundant _CharT template parameters. * include/bits/regex_compiler.tcc: Likewise. From-SVN: r204573
2013-11-08regex_automaton.h (__detail::_State, [...]): Remove redundant _CharT ↵Jonathan Wakely
template parameters. * include/bits/regex_automaton.h (__detail::_State, __detail::_NFA, __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. From-SVN: r204572
2013-11-08regex_automaton.h (__detail::_State): Split non-dependent parts into new ↵Jonathan Wakely
_State_base. * include/bits/regex_automaton.h (__detail::_State): Split 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. From-SVN: r204571
2013-10-17regex.h (regex_token_iterator<>::regex_token_iterator): Fix initialization ↵Tim Shen
orders in initialization list and add explicit braces for... 2013-10-17 Tim Shen <timshen91@gmail.com> * 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. From-SVN: r203798
2013-10-022013-10-02 Tim Shen <timshen91@gmail.com>Tim Shen
* include/bits/regex_compiler.h (_BracketMatcher<>::_M_add_equivalence_class): Implement it correctly. * include/bits/regex_compiler.tcc (_BracketMatcher<>::operator()): Add _M_equiv_set support. * testsuite/28_regex/algorithms/regex_match/extended/ cstring_bracket_01.cc: Add new "[[=a=]]" testcase. From-SVN: r203117
2013-09-24Makefile.am: Add regex.tcc.Tim Shen
2013-09-24 Tim Shen <timshen91@gmail.com> * 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. From-SVN: r202858
2013-09-14regex.h (regex_match<>, [...]): Change regex_executor caller.Tim Shen
2013-09-14 Tim Shen <timshen91@gmail.com> * 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. From-SVN: r202591
2013-09-05regex_automaton.h: Add dummy node type.Tim Shen
2013-09-05 Tim Shen <timshen91@gmail.com> * include/bits/regex_automaton.h: Add dummy node type. Rewrite _StateSeq. * include/bits/regex_automaton.tcc: Implement them. * include/bits/regex_compiler.h: Rewrite _Compiler to use new _StateSeq interfaces. * include/bits/regex_compiler.tcc: Implement them. * include/bits/regex_scanner.h: Add word boundry assertion token. * include/bits/regex_scanner.tcc (_Scanner<>::_M_eat_escape_ecma): Support word boundry. * testsuite/28_regex/algorithms/regex_match/basic/ string_range_02_03.cc: Remove "xfail". * testsuite/28_regex/algorithms/regex_match/extended/cstring_plus.cc: Likewise. * testsuite/28_regex/algorithms/regex_match/extended/ string_range_02_03.cc: Likewise. * testsuite/28_regex/algorithms/regex_match/extended/ cstring_questionmark.cc: Remove xfail and get correct length of c-string. * testsuite/28_regex/algorithms/regex_match/extended/ string_range_00_03.cc: Likewise. * testsuite/28_regex/algorithms/regex_match/ecma/char/quoted_char.cc: New. * testsuite/28_regex/algorithms/regex_match/extended/cstring_range.cc: New. * testsuite/28_regex/iterators/regex_iterator/wchar_t/string_02.cc: New. From-SVN: r202290
2013-09-02regex_automaton.h: Rearrange _NFA's layout.Tim Shen
2013-09-02 Tim Shen <timshen91@gmail.com> * regex_automaton.h: Rearrange _NFA's layout. * include/bits/regex_compiler.h: Add _AnyMatcher and _CharMatcher. Rearrange _BracketMatcher's layout. (_BracketMatcher<>::_M_add_char): Use set instead of vector for _M_char_set. (_BracketMatcher<>::_M_add_collating_element): Likewise. (_BracketMatcher<>::_M_make_range): Likewise. * include/bits/regex_compiler.tcc (_Compiler<>::_M_atom): Use apropriate constructors of matchers above. * testsuite/28_regex/algorithms/regex_match/ecma/char/anymatcher.cc: New. * testsuite/28_regex/algorithms/regex_match/ecma/char/backref.cc: New. * testsuite/28_regex/algorithms/regex_match/ecma/char/empty_range.cc: New. * testsuite/28_regex/algorithms/regex_match/ecma/char/emptygroup.cc: New. * testsuite/28_regex/algorithms/regex_match/ecma/char/hex.cc: New. * testsuite/28_regex/algorithms/regex_match/ecma/wchar_t/anymatcher.cc: New. * testsuite/28_regex/algorithms/regex_match/ecma/wchar_t/hex.cc: New. From-SVN: r202189
2013-08-29regex.h (basic_regex<>::assign): Don't lose _M_traits.Tim Shen
2013-08-29 Tim Shen <timshen91@gmail.com> * 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. From-SVN: r202082
2013-08-27Makefile.am: Add regex_scanner.{h,tcc}.Tim Shen
2013-08-26 Tim Shen <timshen91@gmail.com> * include/Makefile.am: Add regex_scanner.{h,tcc}. * include/Makefile.in: Regenerate. * include/bits/regex.h (match_search): Handle the `__first == __last` situation correctly. * include/bits/regex_compiler.h: Move _Scanner... * include/bits/regex_scanner.h: ...to here. New. * include/bits/regex_compiler.tcc: Move _Scanner... * include/bits/regex_scanner.tcc: ...to here, too. New. * include/bits/regex_executor.tcc: Use value instead of reference for submatch. * include/std/regex: Add regex_scanner.h * testsuite/28_regex/algorithms/regex_match/awk/cstring_01.cc: New. * testsuite/28_regex/algorithms/regex_match/basic/empty_range.cc: New. * testsuite/28_regex/algorithms/regex_match/ecma/cstring_hex.cc: New. * testsuite/28_regex/algorithms/regex_match/ecma/empty_range.cc: New. * testsuite/28_regex/algorithms/regex_search/ecma/string_01.cc: New. From-SVN: r202015
2013-08-22regex.h: Replace 8 spaces in indentation with a tab.Tim Shen
2013-08-22 Tim Shen <timshen91@gmail.com> * 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. From-SVN: r201916
2013-08-07Makefile.am: Adjust to new files.Tim Shen
2013-08-07 Tim Shen <timshen91@gmail.com> * 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. From-SVN: r201573
2013-08-03Implement bracket expression.Tim Shen
2013-08-03 Tim Shen <timshen91@gmail.com> Implement bracket expression. * include/bits/regex.h: Remove constexpr from "|=", etc. * include/bits/regex_compiler.h: Parse bracket expression. * include/bits/regex_nfa.h: _Comparator and _BracketMatcher(old _RangeMatcher). * include/bits/regex_nfa.tcc: Implement them. * testsuite/28_regex/algorithms/regex_match/extended/53622.cc: from regex_search to regex_match. * testsuite/28_regex/algorithms/regex_match/extended/ cstring_bracket_01.cc: New. From-SVN: r201465
2013-07-31Thompson matcher refactored.Tim Shen
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-31Revert last commit.Tim Shen
From-SVN: r201360
2013-07-31Thompson matcher refactored.Tim Shen
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-302013-07-30 Paolo Carlini <paolo.carlini@oracle.com>Paolo Carlini
Revert last commit. From-SVN: r201348
2013-07-30Thompson matcher refactored.Tim Shen
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
2013-02-03Update copyright in libstdc++-v3.Richard Sandiford
From-SVN: r195701