aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/bits/regex.h
diff options
context:
space:
mode:
authorTim Shen <timshen91@gmail.com>2013-07-31 00:20:06 +0000
committerTim Shen <timshen@gcc.gnu.org>2013-07-31 00:20:06 +0000
commitabf1719efeb6782e8a596ecbc36557890c688582 (patch)
tree6f28f5904f81a6e7ffe2c420956997e9b71741ff /libstdc++-v3/include/bits/regex.h
parentdaaf92f822d175ccebb66ae96caa193b1801a503 (diff)
downloadgcc-abf1719efeb6782e8a596ecbc36557890c688582.zip
gcc-abf1719efeb6782e8a596ecbc36557890c688582.tar.gz
gcc-abf1719efeb6782e8a596ecbc36557890c688582.tar.bz2
Thompson matcher refactored.
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
Diffstat (limited to 'libstdc++-v3/include/bits/regex.h')
-rw-r--r--libstdc++-v3/include/bits/regex.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/libstdc++-v3/include/bits/regex.h b/libstdc++-v3/include/bits/regex.h
index 5692848..c1f6533 100644
--- a/libstdc++-v3/include/bits/regex.h
+++ b/libstdc++-v3/include/bits/regex.h
@@ -2175,7 +2175,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
bool
regex_match(_Bi_iter __s,
_Bi_iter __e,
- match_results<_Bi_iter, _Alloc>& __m,
+ match_results<_Bi_iter, _Alloc>& __m,
const basic_regex<_Ch_type, _Rx_traits>& __re,
regex_constants::match_flag_type __flags
= regex_constants::match_default)
@@ -2184,8 +2184,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__detail::_Automaton::_SizeT __sz = __a->_M_sub_count();
__detail::_SpecializedCursor<_Bi_iter> __cs(__s, __e);
__detail::_SpecializedResults<_Bi_iter, _Alloc> __r(__sz, __cs, __m);
- __detail::_Grep_matcher __matcher(__cs, __r, __a, __flags);
- return __matcher._M_dfs_match();
+ return __a->_M_get_matcher(__cs, __r, __a, __flags)->_M_match();
}
/**
@@ -2336,8 +2335,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
for (auto __cur = __first; __cur != __last; ++__cur) // Any KMP-like algo?
{
__detail::_SpecializedCursor<_Bi_iter> __curs(__cur, __last);
- __detail::_Grep_matcher __matcher(__curs, __r, __a, __flags);
- if (__matcher._M_dfs_search_from_first())
+ auto __matcher = __a->_M_get_matcher(__curs, __r, __a, __flags);
+ if (__matcher->_M_search_from_first())
{
__r._M_set_range(__m.size(),
__detail::_SpecializedCursor<_Bi_iter>