Commit d4e12601 by Tim Shen Committed by Tim Shen

regex_error.h: Remove _S_error_last to follow the standard.

2013-09-26  Tim Shen  <timshen91@gmail.com>

	* 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.

From-SVN: r202958
parent 13b670ac
2013-09-26 Tim Shen <timshen91@gmail.com>
* 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 <marc.glisse@inria.fr> 2013-09-25 Marc Glisse <marc.glisse@inria.fr>
PR libstdc++/58338 PR libstdc++/58338
......
...@@ -61,7 +61,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -61,7 +61,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_S_error_badrepeat, _S_error_badrepeat,
_S_error_complexity, _S_error_complexity,
_S_error_stack, _S_error_stack,
_S_error_last
}; };
/** The expression contained an invalid collating element name. */ /** The expression contained an invalid collating element name. */
......
...@@ -345,7 +345,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -345,7 +345,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
++_M_current; ++_M_current;
} }
else else
__throw_regex_error(regex_constants::error_brace); __throw_regex_error(regex_constants::error_badbrace);
} }
else if (__c == '}') else if (__c == '}')
{ {
...@@ -353,7 +353,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -353,7 +353,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_token = _S_token_interval_end; _M_token = _S_token_interval_end;
} }
else else
__throw_regex_error(regex_constants::error_brace); __throw_regex_error(regex_constants::error_badbrace);
} }
template<typename _FwdIter> template<typename _FwdIter>
...@@ -428,6 +428,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -428,6 +428,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
} }
} }
// Differences between styles:
// 1) Extended doesn't support backref, but basic does.
template<typename _FwdIter> template<typename _FwdIter>
void void
_Scanner<_FwdIter>:: _Scanner<_FwdIter>::
...@@ -449,7 +451,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -449,7 +451,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_eat_escape_awk(); _M_eat_escape_awk();
return; 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_token = _S_token_backref;
_M_value.assign(1, __c); _M_value.assign(1, __c);
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
// 28.11.2 regex_match // 28.11.2 regex_match
// Tests Extended grouping against a std::string target.
#include <regex> #include <regex>
#include <testsuite_hooks.h> #include <testsuite_hooks.h>
...@@ -33,7 +32,7 @@ test01() ...@@ -33,7 +32,7 @@ test01()
bool test __attribute__((unused)) = true; 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::string target("zxcv/onetwoabc");
std::smatch m; std::smatch m;
...@@ -46,7 +45,7 @@ test01() ...@@ -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::string target("zxcv/onetwoabc");
std::smatch m; std::smatch m;
......
...@@ -20,8 +20,7 @@ ...@@ -20,8 +20,7 @@
// with this library; see the file COPYING3. If not see // with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
// 28.11.3 regex_search // 28.11.2 regex_match
// Tests Extended against a std::string target.
#include <regex> #include <regex>
#include <testsuite_hooks.h> #include <testsuite_hooks.h>
...@@ -34,7 +33,7 @@ test01() ...@@ -34,7 +33,7 @@ test01()
bool test __attribute__((unused)) = true; 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::string target("/asdf/qwerty");
std::smatch m; std::smatch m;
...@@ -43,7 +42,7 @@ test01() ...@@ -43,7 +42,7 @@ test01()
VERIFY( std::string(m[1].first, m[1].second) == "/qwerty"); 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::string target("/asdf/qwerty");
std::smatch m; std::smatch m;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment