diff options
author | redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-06-03 17:26:24 +0000 |
---|---|---|
committer | redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-06-03 17:26:24 +0000 |
commit | 5e470c4344f67e0e54274c992ef2cfffa5ba7c42 (patch) | |
tree | 3b04ec13f207ca07dab2d3ca516e06d1fe7ee7fb /libstdc++-v3/include/bits/regex_compiler.tcc | |
parent | ca6601d19f8e03b9b2feaa20fc979b5a6d8d06bd (diff) | |
download | ppe42-gcc-5e470c4344f67e0e54274c992ef2cfffa5ba7c42.tar.gz ppe42-gcc-5e470c4344f67e0e54274c992ef2cfffa5ba7c42.zip |
Backport from mainline
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_9-branch@211192 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/bits/regex_compiler.tcc')
-rw-r--r-- | libstdc++-v3/include/bits/regex_compiler.tcc | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/libstdc++-v3/include/bits/regex_compiler.tcc b/libstdc++-v3/include/bits/regex_compiler.tcc index 128dac12bd7..14e40c0cd19 100644 --- a/libstdc++-v3/include/bits/regex_compiler.tcc +++ b/libstdc++-v3/include/bits/regex_compiler.tcc @@ -397,7 +397,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_DEBUG_ASSERT(_M_value.size() == 1); _BracketMatcher<_TraitsT, __icase, __collate> __matcher (_M_ctype.is(_CtypeT::upper, _M_value[0]), _M_traits); - __matcher._M_add_character_class(_M_value); + __matcher._M_add_character_class(_M_value, false); __matcher._M_ready(); _M_stack.push(_StateSeqT(_M_nfa, _M_nfa._M_insert_matcher(std::move(__matcher)))); @@ -428,7 +428,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION else if (_M_match_token(_ScannerT::_S_token_equiv_class_name)) __matcher._M_add_equivalence_class(_M_value); else if (_M_match_token(_ScannerT::_S_token_char_class_name)) - __matcher._M_add_character_class(_M_value); + __matcher._M_add_character_class(_M_value, false); else if (_M_try_char()) // [a { auto __ch = _M_value[0]; @@ -451,6 +451,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } __matcher._M_add_char(__ch); } + else if (_M_match_token(_ScannerT::_S_token_quoted_class)) + __matcher._M_add_character_class(_M_value, + _M_ctype.is(_CtypeT::upper, + _M_value[0])); else __throw_regex_error(regex_constants::error_brack); } @@ -527,6 +531,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_traits.transform_primary(&__ch, &__ch+1)) != _M_equiv_set.end()) __ret = true; + else + { + for (auto& __it : _M_neg_class_set) + if (!_M_traits.isctype(__ch, __it)) + { + __ret = true; + break; + } + } } if (_M_is_non_matching) return !__ret; |