|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r62563 - in trunk: boost/regex/v4 libs/regex/test/regress
From: john_at_[hidden]
Date: 2010-06-08 08:41:42
Author: johnmaddock
Date: 2010-06-08 08:41:41 EDT (Tue, 08 Jun 2010)
New Revision: 62563
URL: http://svn.boost.org/trac/boost/changeset/62563
Log:
Some lookbehind assertions were accepted when they should not have been.
Fixes #4309.
Text files modified:
trunk/boost/regex/v4/basic_regex_creator.hpp | 8 ++++++++
trunk/libs/regex/test/regress/test_perl_ex.cpp | 6 ++++--
2 files changed, 12 insertions(+), 2 deletions(-)
Modified: trunk/boost/regex/v4/basic_regex_creator.hpp
==============================================================================
--- trunk/boost/regex/v4/basic_regex_creator.hpp (original)
+++ trunk/boost/regex/v4/basic_regex_creator.hpp 2010-06-08 08:41:41 EDT (Tue, 08 Jun 2010)
@@ -1039,6 +1039,14 @@
case syntax_element_jump:
state = static_cast<re_jump*>(state)->alt.p;
continue;
+ case syntax_element_alt:
+ {
+ int r1 = calculate_backstep(state->next.p);
+ int r2 = calculate_backstep(static_cast<re_alt*>(state)->alt.p);
+ if((r1 < 0) || (r1 != r2))
+ return -1;
+ return result + r1;
+ }
default:
break;
}
Modified: trunk/libs/regex/test/regress/test_perl_ex.cpp
==============================================================================
--- trunk/libs/regex/test/regress/test_perl_ex.cpp (original)
+++ trunk/libs/regex/test/regress/test_perl_ex.cpp 2010-06-08 08:41:41 EDT (Tue, 08 Jun 2010)
@@ -132,6 +132,8 @@
TEST_INVALID_REGEX("(?<!*|A)", perl);
TEST_INVALID_REGEX("(?<=?|A)", perl);
TEST_INVALID_REGEX("(?<=*|\\B)", perl);
+ TEST_INVALID_REGEX("(?<!a|bc)de", perl);
+ TEST_INVALID_REGEX("(?<=a|bc)de", perl);
}
void test_options()
@@ -278,8 +280,8 @@
TEST_REGEX_SEARCH("(?<=^[[:alpha:]]{4})(?:bar|cat)", perl, "aaaacat", match_default, make_array(4, 7, -2, -2));
TEST_REGEX_SEARCH("(?<=^[[:alpha:]]{4})(?:bar|cat)", perl, "aaacat", match_default, make_array(-2, -2));
- TEST_REGEX_SEARCH("(?<=ab(?i)x(?-i)y|(?i)z|b)ZZ", perl, "abxyZZ", match_default, make_array(4, 6, -2, -2));
- TEST_REGEX_SEARCH("(?<=ab(?i)x(?-i)y|(?i)z|b)ZZ", perl, "abXyZZ", match_default, make_array(4, 6, -2, -2));
+ //TEST_REGEX_SEARCH("(?<=ab(?i)x(?-i)y|(?i)z|b)ZZ", perl, "abxyZZ", match_default, make_array(4, 6, -2, -2));
+ //TEST_REGEX_SEARCH("(?<=ab(?i)x(?-i)y|(?i)z|b)ZZ", perl, "abXyZZ", match_default, make_array(4, 6, -2, -2));
TEST_REGEX_SEARCH("(?:ab(?i)x(?-i)y|(?i)z|b)ZZ", perl, "ZZZ", match_default, make_array(0, 3, -2, -2));
TEST_REGEX_SEARCH("(?:ab(?i)x(?-i)y|(?i)z|b)ZZ", perl, "zZZ", match_default, make_array(0, 3, -2, -2));
TEST_REGEX_SEARCH("(?:ab(?i)x(?-i)y|(?i)z|b)ZZ", perl, "bZZ", match_default, make_array(0, 3, -2, -2));
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk