Empty expressions, and empty alternatives are now

allowed when using the Perl regular expression syntax.  This change has
been added for Perl compatibility, when the new [syntax_option_type]
['no_empty_expressions] is set then the old behaviour is preserved and
empty expressions are prohibited.  This is issue
[@https://svn.boost.org/trac/boost/ticket/1081 #1081].

Fixes #1081.

[SVN r50374]
This commit is contained in:
John Maddock
2008-12-23 19:06:04 +00:00
parent b4152cd74d
commit e4b31ea37f
25 changed files with 147 additions and 81 deletions

View File

@ -29,11 +29,16 @@ void test_alt()
TEST_REGEX_SEARCH("a(b|c)", perl, "ad", match_default, make_array(-2, -2));
TEST_REGEX_SEARCH("(a|b|c)", perl, "c", match_default, make_array(0, 1, 0, 1, -2, -2));
TEST_REGEX_SEARCH("(a|(b)|.)", perl, "b", match_default, make_array(0, 1, 0, 1, 0, 1, -2, -2));
TEST_INVALID_REGEX("|c", perl);
TEST_INVALID_REGEX("c|", perl);
TEST_INVALID_REGEX("(|)", perl);
TEST_INVALID_REGEX("(a|)", perl);
TEST_INVALID_REGEX("(|a)", perl);
TEST_INVALID_REGEX("|c", perl|no_empty_expressions);
TEST_REGEX_SEARCH("|c", perl, " c", match_default, make_array(0, 0, -2, 1, 1, -2, 1, 2, -2, 2, 2, -2, -2));
TEST_INVALID_REGEX("c|", perl|no_empty_expressions);
TEST_REGEX_SEARCH("c|", perl, " c", match_default, make_array(0, 0, -2, 1, 2, -2, 2, 2, -2, -2));
TEST_INVALID_REGEX("(|)", perl|no_empty_expressions);
TEST_REGEX_SEARCH("(|)", perl, " c", match_default, make_array(0, 0, 0, 0, -2, 1, 1, 1, 1, -2, 2, 2, 2, 2, -2, -2));
TEST_INVALID_REGEX("(a|)", perl|no_empty_expressions);
TEST_REGEX_SEARCH("(a|)", perl, " a", match_default, make_array(0, 0, 0, 0, -2, 1, 2, 1, 2, -2, 2, 2, 2, 2, -2, -2));
TEST_INVALID_REGEX("(|a)", perl|no_empty_expressions);
TEST_REGEX_SEARCH("(|a)", perl, " a", match_default, make_array(0, 0, 0, 0, -2, 1, 1, 1, 1, -2, 1, 2, 1, 2, -2, 2, 2, 2, 2, -2, -2));
TEST_REGEX_SEARCH("a\\|", perl, "a|", match_default, make_array(0, 2, -2, -2));
TEST_REGEX_SEARCH("a|", basic, "a|", match_default, make_array(0, 2, -2, -2));