Fix recursive expressions where the recursion appears more than once.

Fixes https://github.com/boostorg/regex/issues/87.
Also fix some more msvc warnings.
This commit is contained in:
jzmaddock
2020-01-23 19:24:33 +00:00
parent bc160a58f0
commit afc4229234
5 changed files with 18 additions and 5 deletions

View File

@ -935,6 +935,7 @@ void test_recursion()
TEST_REGEX_SEARCH("namespace\\s+(\\w+)\\s+(\\{(?:[^{}]*(?:(?2)[^{}]*)*)?\\})", perl, "namespace one { namespace two { int foo(){} } { {{{ } } } } {}}", match_default, make_array(0, 64, 10, 13, 14, 64, -2, -2));
TEST_INVALID_REGEX("((?1)|a)", perl);
TEST_REGEX_SEARCH("a(?0)?", perl, "aaaaa", match_default, make_array(0, 5, -2, -2));
TEST_REGEX_SEARCH("((?(DEFINE)(?'a'A)(?'b'(?&a)?(?&a)))(?&b)?)", perl, "AA", match_default, make_array(0, 2, 0, 2, -1, -1, -2, 2, 2, 2, 2, -1, -1, -2, -2));
// Recursion to a named sub with a name that is used multiple times:
TEST_REGEX_SEARCH("(?:(?<A>a+)|(?<A>b+))\\.(?&A)", perl, "aaaa.aa", match_default, make_array(0, 7, 0, 4, -1, -1, -2, -2));