(*ACCEPT) at start of branch was not recording "may match empty string".

This commit is contained in:
Philip.Hazel 2019-07-23 16:58:57 +00:00
parent 82a4729e13
commit 24c62fc0d0
3 changed files with 8 additions and 2 deletions

View File

@ -110,6 +110,9 @@ within it, the nested lookbehind was not correctly processed. For example, if
(c) An empty string partial hard match can be returned for \z and \Z as it
is documented that they shouldn't match.
22. A branch that started with (*ACCEPT) was not being recognized as one that
could match an empty string.
Version 10.33 16-April-2019

View File

@ -5302,6 +5302,7 @@ PCRE2_UCHAR *tempcode;
PCRE2_UCHAR *previous = NULL;
PCRE2_UCHAR op_previous;
BOOL groupsetfirstcu = FALSE;
BOOL had_accept = FALSE;
BOOL matched_char = FALSE;
BOOL previous_matched_char = FALSE;
const uint8_t *cbits = cb->cbits;
@ -5436,7 +5437,7 @@ for (;; pptr++)
if (meta < META_ASTERISK || meta > META_MINMAX_QUERY)
{
previous = code;
if (matched_char) okreturn = 1;
if (matched_char && !had_accept) okreturn = 1;
}
previous_matched_char = matched_char;
@ -6075,7 +6076,7 @@ for (;; pptr++)
workspace overflow. Do not set firstcu after *ACCEPT. */
case META_ACCEPT:
cb->had_accept = TRUE;
cb->had_accept = had_accept = TRUE;
for (oc = cb->open_caps;
oc != NULL && oc->assert_depth >= cb->assert_depth;
oc = oc->next)

View File

@ -11241,6 +11241,7 @@ No match
/(*ACCEPT)a/I,aftertext
Capture group count = 0
May match empty string
Subject length lower bound = 0
bax
0:
@ -16911,6 +16912,7 @@ Subject length lower bound = 3
/(*ACCEPT:XX)^abc/I
Capture group count = 0
May match empty string
Subject length lower bound = 0
/abc/replace=xyz