| 787 |
MRRETURN(MATCH_THEN); |
MRRETURN(MATCH_THEN); |
| 788 |
|
|
| 789 |
case OP_THEN_ARG: |
case OP_THEN_ARG: |
| 790 |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode] + ecode[1], offset_top, |
| 791 |
md, eptrb, RM58); |
md, eptrb, RM58); |
| 792 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 793 |
md->start_match_ptr = ecode; |
md->start_match_ptr = ecode; |
| 794 |
md->mark = ecode + 2; |
md->mark = ecode + 2; |
| 795 |
RRETURN(MATCH_THEN); |
RRETURN(MATCH_THEN); |
| 796 |
|
|
| 797 |
/* Handle an atomic group that does not contain any capturing parentheses. |
/* Handle an atomic group that does not contain any capturing parentheses. |
| 798 |
This can be handled like an assertion. Prior to 8.13, all atomic groups |
This can be handled like an assertion. Prior to 8.13, all atomic groups |
| 799 |
were handled this way. In 8.13, the code was changed as below for ONCE, so |
were handled this way. In 8.13, the code was changed as below for ONCE, so |
| 800 |
that backups pass through the group and thereby reset captured values. |
that backups pass through the group and thereby reset captured values. |
| 801 |
However, this uses a lot more stack, so in 8.20, atomic groups that do not |
However, this uses a lot more stack, so in 8.20, atomic groups that do not |
| 802 |
contain any captures generate OP_ONCE_NC, which can be handled in the old, |
contain any captures generate OP_ONCE_NC, which can be handled in the old, |
| 803 |
less stack intensive way. |
less stack intensive way. |
| 804 |
|
|
| 805 |
Check the alternative branches in turn - the matching won't pass the KET |
Check the alternative branches in turn - the matching won't pass the KET |
| 821 |
if (rrc == MATCH_THEN) |
if (rrc == MATCH_THEN) |
| 822 |
{ |
{ |
| 823 |
next = ecode + GET(ecode,1); |
next = ecode + GET(ecode,1); |
| 824 |
if (md->start_match_ptr < next && |
if (md->start_match_ptr < next && |
| 825 |
(*ecode == OP_ALT || *next == OP_ALT)) |
(*ecode == OP_ALT || *next == OP_ALT)) |
| 826 |
rrc = MATCH_NOMATCH; |
rrc = MATCH_NOMATCH; |
| 827 |
} |
} |
| 828 |
|
|
| 829 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 830 |
ecode += GET(ecode,1); |
ecode += GET(ecode,1); |
| 831 |
} |
} |
| 867 |
} |
} |
| 868 |
else /* OP_KETRMAX */ |
else /* OP_KETRMAX */ |
| 869 |
{ |
{ |
| 870 |
md->match_function_type = MATCH_CBEGROUP; |
md->match_function_type = MATCH_CBEGROUP; |
| 871 |
RMATCH(eptr, prev, offset_top, md, eptrb, RM66); |
RMATCH(eptr, prev, offset_top, md, eptrb, RM66); |
| 872 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 873 |
ecode += 1 + LINK_SIZE; |
ecode += 1 + LINK_SIZE; |
| 918 |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, |
| 919 |
eptrb, RM1); |
eptrb, RM1); |
| 920 |
if (rrc == MATCH_ONCE) break; /* Backing up through an atomic group */ |
if (rrc == MATCH_ONCE) break; /* Backing up through an atomic group */ |
| 921 |
|
|
| 922 |
/* If we backed up to a THEN, check whether it is within the current |
/* If we backed up to a THEN, check whether it is within the current |
| 923 |
branch by comparing the address of the THEN that is passed back with |
branch by comparing the address of the THEN that is passed back with |
| 924 |
the end of the branch. If it is within the current branch, and the |
the end of the branch. If it is within the current branch, and the |
| 925 |
branch is one of two or more alternatives (it either starts or ends |
branch is one of two or more alternatives (it either starts or ends |
| 926 |
with OP_ALT), we have reached the limit of THEN's action, so convert |
with OP_ALT), we have reached the limit of THEN's action, so convert |
| 927 |
the return code to NOMATCH, which will cause normal backtracking to |
the return code to NOMATCH, which will cause normal backtracking to |
| 928 |
happen from now on. Otherwise, THEN is passed back to an outer |
happen from now on. Otherwise, THEN is passed back to an outer |
| 929 |
alternative. This implements Perl's treatment of parenthesized groups, |
alternative. This implements Perl's treatment of parenthesized groups, |
| 930 |
where a group not containing | does not affect the current alternative, |
where a group not containing | does not affect the current alternative, |
| 931 |
that is, (X) is NOT the same as (X|(*F)). */ |
that is, (X) is NOT the same as (X|(*F)). */ |
| 932 |
|
|
| 933 |
if (rrc == MATCH_THEN) |
if (rrc == MATCH_THEN) |
| 934 |
{ |
{ |
| 935 |
next = ecode + GET(ecode,1); |
next = ecode + GET(ecode,1); |
| 936 |
if (md->start_match_ptr < next && |
if (md->start_match_ptr < next && |
| 937 |
(*ecode == OP_ALT || *next == OP_ALT)) |
(*ecode == OP_ALT || *next == OP_ALT)) |
| 938 |
rrc = MATCH_NOMATCH; |
rrc = MATCH_NOMATCH; |
| 939 |
} |
} |
| 940 |
|
|
| 941 |
/* Anything other than NOMATCH is passed back. */ |
/* Anything other than NOMATCH is passed back. */ |
| 942 |
|
|
| 943 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 1011 |
|
|
| 1012 |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, eptrb, |
RMATCH(eptr, ecode + _pcre_OP_lengths[*ecode], offset_top, md, eptrb, |
| 1013 |
RM2); |
RM2); |
| 1014 |
|
|
| 1015 |
/* See comment in the code for capturing groups above about handling |
/* See comment in the code for capturing groups above about handling |
| 1016 |
THEN. */ |
THEN. */ |
| 1017 |
|
|
| 1018 |
if (rrc == MATCH_THEN) |
if (rrc == MATCH_THEN) |
| 1019 |
{ |
{ |
| 1020 |
next = ecode + GET(ecode,1); |
next = ecode + GET(ecode,1); |
| 1021 |
if (md->start_match_ptr < next && |
if (md->start_match_ptr < next && |
| 1022 |
(*ecode == OP_ALT || *next == OP_ALT)) |
(*ecode == OP_ALT || *next == OP_ALT)) |
| 1023 |
rrc = MATCH_NOMATCH; |
rrc = MATCH_NOMATCH; |
| 1024 |
} |
} |
| 1025 |
|
|
| 1026 |
if (rrc != MATCH_NOMATCH) |
if (rrc != MATCH_NOMATCH) |
| 1027 |
{ |
{ |
| 1028 |
if (rrc == MATCH_ONCE) |
if (rrc == MATCH_ONCE) |
| 1029 |
{ |
{ |
| 1040 |
ecode += GET(ecode, 1); |
ecode += GET(ecode, 1); |
| 1041 |
if (*ecode != OP_ALT) break; |
if (*ecode != OP_ALT) break; |
| 1042 |
} |
} |
| 1043 |
|
|
| 1044 |
if (md->mark == NULL) md->mark = markptr; |
if (md->mark == NULL) md->mark = markptr; |
| 1045 |
RRETURN(MATCH_NOMATCH); |
RRETURN(MATCH_NOMATCH); |
| 1046 |
|
|
| 1104 |
matched_once = TRUE; |
matched_once = TRUE; |
| 1105 |
continue; |
continue; |
| 1106 |
} |
} |
| 1107 |
|
|
| 1108 |
/* See comment in the code for capturing groups above about handling |
/* See comment in the code for capturing groups above about handling |
| 1109 |
THEN. */ |
THEN. */ |
| 1110 |
|
|
| 1111 |
if (rrc == MATCH_THEN) |
if (rrc == MATCH_THEN) |
| 1112 |
{ |
{ |
| 1113 |
next = ecode + GET(ecode,1); |
next = ecode + GET(ecode,1); |
| 1114 |
if (md->start_match_ptr < next && |
if (md->start_match_ptr < next && |
| 1115 |
(*ecode == OP_ALT || *next == OP_ALT)) |
(*ecode == OP_ALT || *next == OP_ALT)) |
| 1116 |
rrc = MATCH_NOMATCH; |
rrc = MATCH_NOMATCH; |
| 1117 |
} |
} |
| 1118 |
|
|
| 1119 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 1120 |
md->capture_last = save_capture_last; |
md->capture_last = save_capture_last; |
| 1176 |
matched_once = TRUE; |
matched_once = TRUE; |
| 1177 |
continue; |
continue; |
| 1178 |
} |
} |
| 1179 |
|
|
| 1180 |
/* See comment in the code for capturing groups above about handling |
/* See comment in the code for capturing groups above about handling |
| 1181 |
THEN. */ |
THEN. */ |
| 1182 |
|
|
| 1183 |
if (rrc == MATCH_THEN) |
if (rrc == MATCH_THEN) |
| 1184 |
{ |
{ |
| 1185 |
next = ecode + GET(ecode,1); |
next = ecode + GET(ecode,1); |
| 1186 |
if (md->start_match_ptr < next && |
if (md->start_match_ptr < next && |
| 1187 |
(*ecode == OP_ALT || *next == OP_ALT)) |
(*ecode == OP_ALT || *next == OP_ALT)) |
| 1188 |
rrc = MATCH_NOMATCH; |
rrc = MATCH_NOMATCH; |
| 1189 |
} |
} |
| 1190 |
|
|
| 1191 |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH) RRETURN(rrc); |
| 1192 |
ecode += GET(ecode, 1); |
ecode += GET(ecode, 1); |
| 1400 |
ecode += 1 + LINK_SIZE + GET(ecode, LINK_SIZE + 2); |
ecode += 1 + LINK_SIZE + GET(ecode, LINK_SIZE + 2); |
| 1401 |
while (*ecode == OP_ALT) ecode += GET(ecode, 1); |
while (*ecode == OP_ALT) ecode += GET(ecode, 1); |
| 1402 |
} |
} |
| 1403 |
|
|
| 1404 |
/* PCRE doesn't allow the effect of (*THEN) to escape beyond an |
/* PCRE doesn't allow the effect of (*THEN) to escape beyond an |
| 1405 |
assertion; it is therefore treated as NOMATCH. */ |
assertion; it is therefore treated as NOMATCH. */ |
| 1406 |
|
|
| 1407 |
else if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) |
else if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) |
| 1408 |
{ |
{ |
| 1409 |
RRETURN(rrc); /* Need braces because of following else */ |
RRETURN(rrc); /* Need braces because of following else */ |
| 1410 |
} |
} |
| 1432 |
ecode += 1 + LINK_SIZE; |
ecode += 1 + LINK_SIZE; |
| 1433 |
goto TAIL_RECURSE; |
goto TAIL_RECURSE; |
| 1434 |
} |
} |
| 1435 |
|
|
| 1436 |
md->match_function_type = MATCH_CBEGROUP; |
md->match_function_type = MATCH_CBEGROUP; |
| 1437 |
RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, eptrb, RM49); |
RMATCH(eptr, ecode + 1 + LINK_SIZE, offset_top, md, eptrb, RM49); |
| 1438 |
RRETURN(rrc); |
RRETURN(rrc); |
| 1530 |
markptr = md->mark; |
markptr = md->mark; |
| 1531 |
break; |
break; |
| 1532 |
} |
} |
| 1533 |
|
|
| 1534 |
/* PCRE does not allow THEN to escape beyond an assertion; it is treated |
/* PCRE does not allow THEN to escape beyond an assertion; it is treated |
| 1535 |
as NOMATCH. */ |
as NOMATCH. */ |
| 1536 |
|
|
| 1537 |
if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc); |
| 1538 |
ecode += GET(ecode, 1); |
ecode += GET(ecode, 1); |
| 1539 |
} |
} |
| 1576 |
break; |
break; |
| 1577 |
} |
} |
| 1578 |
|
|
| 1579 |
/* PCRE does not allow THEN to escape beyond an assertion; it is treated |
/* PCRE does not allow THEN to escape beyond an assertion; it is treated |
| 1580 |
as NOMATCH. */ |
as NOMATCH. */ |
| 1581 |
|
|
| 1582 |
if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc); |
if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) RRETURN(rrc); |
| 1740 |
/* PCRE does not allow THEN to escape beyond a recursion; it is treated |
/* PCRE does not allow THEN to escape beyond a recursion; it is treated |
| 1741 |
as NOMATCH. */ |
as NOMATCH. */ |
| 1742 |
|
|
| 1743 |
else if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) |
else if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN) |
| 1744 |
{ |
{ |
| 1745 |
DPRINTF(("Recursion gave error %d\n", rrc)); |
DPRINTF(("Recursion gave error %d\n", rrc)); |
| 1746 |
if (new_recursive.offset_save != stacksave) |
if (new_recursive.offset_save != stacksave) |
| 1826 |
} |
} |
| 1827 |
else saved_eptr = NULL; |
else saved_eptr = NULL; |
| 1828 |
|
|
| 1829 |
/* If we are at the end of an assertion group or a non-capturing atomic |
/* If we are at the end of an assertion group or a non-capturing atomic |
| 1830 |
group, stop matching and return MATCH_MATCH, but record the current high |
group, stop matching and return MATCH_MATCH, but record the current high |
| 1831 |
water mark for use by positive assertions. We also need to record the match |
water mark for use by positive assertions. We also need to record the match |
| 1832 |
start in case it was changed by \K. */ |
start in case it was changed by \K. */ |
| 1833 |
|
|
| 1834 |
if ((*prev >= OP_ASSERT && *prev <= OP_ASSERTBACK_NOT) || |
if ((*prev >= OP_ASSERT && *prev <= OP_ASSERTBACK_NOT) || |
| 1835 |
*prev == OP_ONCE_NC) |
*prev == OP_ONCE_NC) |
| 1836 |
{ |
{ |
| 1837 |
md->end_match_ptr = eptr; /* For ONCE_NC */ |
md->end_match_ptr = eptr; /* For ONCE_NC */ |
| 1838 |
md->end_offset_top = offset_top; |
md->end_offset_top = offset_top; |
| 5828 |
LBL(19) LBL(24) LBL(25) LBL(26) LBL(27) LBL(29) LBL(31) LBL(33) |
LBL(19) LBL(24) LBL(25) LBL(26) LBL(27) LBL(29) LBL(31) LBL(33) |
| 5829 |
LBL(35) LBL(43) LBL(47) LBL(48) LBL(49) LBL(50) LBL(51) LBL(52) |
LBL(35) LBL(43) LBL(47) LBL(48) LBL(49) LBL(50) LBL(51) LBL(52) |
| 5830 |
LBL(53) LBL(54) LBL(55) LBL(56) LBL(57) LBL(58) LBL(63) LBL(64) |
LBL(53) LBL(54) LBL(55) LBL(56) LBL(57) LBL(58) LBL(63) LBL(64) |
| 5831 |
LBL(65) LBL(66) |
LBL(65) LBL(66) |
| 5832 |
#ifdef SUPPORT_UTF8 |
#ifdef SUPPORT_UTF8 |
| 5833 |
LBL(16) LBL(18) LBL(20) LBL(21) LBL(22) LBL(23) LBL(28) LBL(30) |
LBL(16) LBL(18) LBL(20) LBL(21) LBL(22) LBL(23) LBL(28) LBL(30) |
| 5834 |
LBL(32) LBL(34) LBL(42) LBL(46) |
LBL(32) LBL(34) LBL(42) LBL(46) |