From dc62246d951f7317b9d3229508b1fac728179224 Mon Sep 17 00:00:00 2001 From: timshen Date: Thu, 26 Sep 2013 21:48:04 +0000 Subject: [PATCH] 2013-09-26 Tim Shen * regex_error.h: Remove _S_error_last to follow the standard. * regex_scanner.tcc: (_Scanner<_FwdIter>::_M_scan_in_brace): Change error_brace to error_badbrace. (_Scanner<>::_M_eat_escape_posix): Extended doesn't support back-reference. * testsuite/28_regex/algorithms/regex_match/ecma/char/53622.cc: Move here from ../../extended. * testsuite/28_regex/algorithms/regex_match/ecma/char/57173.cc: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@202958 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 13 +++++++++++++ libstdc++-v3/include/bits/regex_error.h | 1 - libstdc++-v3/include/bits/regex_scanner.tcc | 8 +++++--- .../algorithms/regex_match/{extended => ecma/char}/53622.cc | 5 ++--- .../algorithms/regex_match/{extended => ecma/char}/57173.cc | 7 +++---- 5 files changed, 23 insertions(+), 11 deletions(-) rename libstdc++-v3/testsuite/28_regex/algorithms/regex_match/{extended => ecma/char}/53622.cc (90%) rename libstdc++-v3/testsuite/28_regex/algorithms/regex_match/{extended => ecma/char}/57173.cc (88%) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index ae914b9..fe15508 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,16 @@ +2013-09-26 Tim Shen + + * regex_error.h: Remove _S_error_last to follow the standard. + * regex_scanner.tcc: + (_Scanner<_FwdIter>::_M_scan_in_brace): Change error_brace to + error_badbrace. + (_Scanner<>::_M_eat_escape_posix): Extended doesn't support + back-reference. + * testsuite/28_regex/algorithms/regex_match/ecma/char/53622.cc: + Move here from ../../extended. + * testsuite/28_regex/algorithms/regex_match/ecma/char/57173.cc: + Likewise. + 2013-09-25 Marc Glisse PR libstdc++/58338 diff --git a/libstdc++-v3/include/bits/regex_error.h b/libstdc++-v3/include/bits/regex_error.h index 7f06727..a39a8ea 100644 --- a/libstdc++-v3/include/bits/regex_error.h +++ b/libstdc++-v3/include/bits/regex_error.h @@ -61,7 +61,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _S_error_badrepeat, _S_error_complexity, _S_error_stack, - _S_error_last }; /** The expression contained an invalid collating element name. */ diff --git a/libstdc++-v3/include/bits/regex_scanner.tcc b/libstdc++-v3/include/bits/regex_scanner.tcc index abdbcc6..e0dff90 100644 --- a/libstdc++-v3/include/bits/regex_scanner.tcc +++ b/libstdc++-v3/include/bits/regex_scanner.tcc @@ -345,7 +345,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ++_M_current; } else - __throw_regex_error(regex_constants::error_brace); + __throw_regex_error(regex_constants::error_badbrace); } else if (__c == '}') { @@ -353,7 +353,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_token = _S_token_interval_end; } else - __throw_regex_error(regex_constants::error_brace); + __throw_regex_error(regex_constants::error_badbrace); } template @@ -428,6 +428,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } } + // Differences between styles: + // 1) Extended doesn't support backref, but basic does. template void _Scanner<_FwdIter>:: @@ -449,7 +451,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_eat_escape_awk(); return; } - else if (_M_ctype.is(_CtypeT::digit, __c) && __c != '0') + else if (_M_is_basic() && _M_ctype.is(_CtypeT::digit, __c) && __c != '0') { _M_token = _S_token_backref; _M_value.assign(1, __c); diff --git a/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/extended/53622.cc b/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/char/53622.cc similarity index 90% rename from libstdc++-v3/testsuite/28_regex/algorithms/regex_match/extended/53622.cc rename to libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/char/53622.cc index aee1dbe..5f4b1d1 100644 --- a/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/extended/53622.cc +++ b/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/char/53622.cc @@ -21,7 +21,6 @@ // . // 28.11.2 regex_match -// Tests Extended grouping against a std::string target. #include #include @@ -33,7 +32,7 @@ test01() bool test __attribute__((unused)) = true; { - std::regex re("zxcv/(one.*)abc", std::regex::extended); + std::regex re("zxcv/(one.*)abc", std::regex::ECMAScript); std::string target("zxcv/onetwoabc"); std::smatch m; @@ -46,7 +45,7 @@ test01() } { - std::regex re("zxcv/(one.*)abc()\\2", std::regex::extended); + std::regex re("zxcv/(one.*)abc()\\2", std::regex::ECMAScript); std::string target("zxcv/onetwoabc"); std::smatch m; diff --git a/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/extended/57173.cc b/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/char/57173.cc similarity index 88% rename from libstdc++-v3/testsuite/28_regex/algorithms/regex_match/extended/57173.cc rename to libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/char/57173.cc index cb3a54f..b9a72c9 100644 --- a/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/extended/57173.cc +++ b/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/char/57173.cc @@ -20,8 +20,7 @@ // with this library; see the file COPYING3. If not see // . -// 28.11.3 regex_search -// Tests Extended against a std::string target. +// 28.11.2 regex_match #include #include @@ -34,7 +33,7 @@ test01() bool test __attribute__((unused)) = true; { - std::regex re("/asdf(/.*)", std::regex::extended); + std::regex re("/asdf(/.*)", std::regex::ECMAScript); std::string target("/asdf/qwerty"); std::smatch m; @@ -43,7 +42,7 @@ test01() VERIFY( std::string(m[1].first, m[1].second) == "/qwerty"); } { - std::regex re("/asdf(/.*)()\\2", std::regex::extended); + std::regex re("/asdf(/.*)()\\2", std::regex::ECMAScript); std::string target("/asdf/qwerty"); std::smatch m; -- 2.7.4