Add recursive implementation of THEN.

This commit is contained in:
jzmaddock
2015-10-05 18:27:37 +01:00
parent 7a4e883675
commit 201d3a424e
3 changed files with 24 additions and 61 deletions

View File

@ -1000,63 +1000,4 @@ void test_verbs()
TEST_REGEX_SEARCH("(?:a+(*THEN)\\w{6}|x\\w{3})", perl, "aaaxxxxx", match_default, make_array(3, 7, -2, -2));
TEST_REGEX_SEARCH("(?>(*COMMIT)(?>yes|no)(*THEN)(*F))?", perl, "yes", match_default, make_array(-2, -2));
TEST_REGEX_SEARCH("(?>(*COMMIT)(yes|no)(*THEN)(*F))?", perl, "yes", match_default, make_array(-2, -2));
#if 0
# Check the use of names for failure
/^(A(*PRUNE:A)B|C(*PRUNE:B)D)/mark
** Failers
AC
CB
/(*MARK:A)(*SKIP:B)(C|X)/mark
C
D
/^(A(*THEN:A)B|C(*THEN:B)D)/mark
** Failers
CB
/^(?:A(*THEN:A)B|C(*THEN:B)D)/mark
CB
/^(?>A(*THEN:A)B|C(*THEN:B)D)/mark
CB
# This should succeed, as the skip causes bump to offset 1 (the mark). Note
# that we have to have something complicated such as (B|Z) at the end because,
# for Perl, a simple character somehow causes an unwanted optimization to mess
# with the handling of backtracking verbs.
/A(*MARK:A)A+(*SKIP:A)(B|Z) | AC/x,mark
AAAC
# Test skipping over a non-matching mark.
/A(*MARK:A)A+(*MARK:B)(*SKIP:A)(B|Z) | AC/x,mark
AAAC
# Check shorthand for MARK.
/A(*:A)A+(*SKIP:A)(B|Z) | AC/x,mark
AAAC
/(*:A)A+(*SKIP:A)(B|Z)/mark
AAAC
# This should succeed, as a non-existent skip name disables the skip.
/A(*MARK:A)A+(*SKIP:B)(B|Z) | AC/x,mark
AAAC
/A(*MARK:A)A+(*SKIP:B)(B|Z) | AC(*:B)/x,mark
AAAC
#endif
}