summaryrefslogtreecommitdiff
path: root/src/pcre2_dfa_match.c
diff options
context:
space:
mode:
authorph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>2019-07-21 16:48:13 +0000
committerph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>2019-07-21 16:48:13 +0000
commitecfcb91119a8c10bd0f4a790ccff1075538760c8 (patch)
tree9a31747e4fdaa64c485247b1651052733d982370 /src/pcre2_dfa_match.c
parent361e123dd630523e542dfca697ca84f23dc148f8 (diff)
downloadpcre2-ecfcb91119a8c10bd0f4a790ccff1075538760c8.tar.gz
Update definition of partial match and fix \z and \Z (as documented).
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@1140 6239d852-aaf2-0410-a92c-79f79f948069
Diffstat (limited to 'src/pcre2_dfa_match.c')
-rw-r--r--src/pcre2_dfa_match.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/pcre2_dfa_match.c b/src/pcre2_dfa_match.c
index 580dbe7..a526344 100644
--- a/src/pcre2_dfa_match.c
+++ b/src/pcre2_dfa_match.c
@@ -174,7 +174,7 @@ static const uint8_t coptable[] = {
0, /* Assert behind */
0, /* Assert behind not */
0, /* NA assert */
- 0, /* NA assert behind */
+ 0, /* NA assert behind */
0, /* ONCE */
0, /* SCRIPT_RUN */
0, 0, 0, 0, 0, /* BRA, BRAPOS, CBRA, CBRAPOS, COND */
@@ -251,7 +251,7 @@ static const uint8_t poptable[] = {
0, /* Assert behind */
0, /* Assert behind not */
0, /* NA assert */
- 0, /* NA assert behind */
+ 0, /* NA assert behind */
0, /* ONCE */
0, /* SCRIPT_RUN */
0, 0, 0, 0, 0, /* BRA, BRAPOS, CBRA, CBRAPOS, COND */
@@ -966,7 +966,7 @@ for (;;)
if (ptr >= end_subject)
{
if ((mb->moptions & PCRE2_PARTIAL_HARD) != 0)
- could_continue = TRUE;
+ return PCRE2_ERROR_PARTIAL;
else { ADD_ACTIVE(state_offset + 1, 0); }
}
break;
@@ -1015,10 +1015,12 @@ for (;;)
/*-----------------------------------------------------------------*/
case OP_EODN:
- if (clen == 0 && (mb->moptions & PCRE2_PARTIAL_HARD) != 0)
- could_continue = TRUE;
- else if (clen == 0 || (IS_NEWLINE(ptr) && ptr == end_subject - mb->nllen))
- { ADD_ACTIVE(state_offset + 1, 0); }
+ if (clen == 0 || (IS_NEWLINE(ptr) && ptr == end_subject - mb->nllen))
+ {
+ if ((mb->moptions & PCRE2_PARTIAL_HARD) != 0)
+ return PCRE2_ERROR_PARTIAL;
+ ADD_ACTIVE(state_offset + 1, 0);
+ }
break;
/*-----------------------------------------------------------------*/
@@ -3175,15 +3177,18 @@ for (;;)
(mb->moptions & PCRE2_PARTIAL_HARD) != 0 /* Hard partial */
|| /* or... */
((mb->moptions & PCRE2_PARTIAL_SOFT) != 0 && /* Soft partial and */
- match_count < 0) /* no matches */
+ match_count < 0) /* no matches */
) && /* And... */
(
- partial_newline || /* Either partial NL */
- ( /* or ... */
- ptr >= end_subject && /* End of subject and */
- ptr > mb->start_used_ptr) /* Inspected non-empty string */
+ partial_newline || /* Either partial NL */
+ ( /* or ... */
+ ptr >= end_subject && /* End of subject and */
+ ( /* either */
+ ptr > mb->start_used_ptr || /* Inspected non-empty string */
+ mb->haslookbehind /* or pattern has lookbehind */
+ )
)
- )
+ ))
match_count = PCRE2_ERROR_PARTIAL;
break; /* Exit from loop along the subject string */
}
@@ -3412,6 +3417,7 @@ mb->tables = re->tables;
mb->start_subject = subject;
mb->end_subject = end_subject;
mb->start_offset = start_offset;
+mb->haslookbehind = (re->max_lookbehind > 0);
mb->moptions = options;
mb->poptions = re->overall_options;
mb->match_call_count = 0;