Use PCRE2_MATCH_EMPTY flag to detect empty matches in JIT.

This commit is contained in:
Zoltán Herczeg 2019-11-28 11:35:08 +00:00
parent add4db4c87
commit f5286d8f56
3 changed files with 8 additions and 2 deletions

View File

@ -1,6 +1,11 @@
Change Log for PCRE2
--------------------
Version 10.35
-------------
1. Use PCRE2_MATCH_EMPTY flag to detect empty matches in JIT.
Version 10.34 21-November-2019
------------------------------

View File

@ -13122,8 +13122,8 @@ common->read_only_data_head = NULL;
common->fcc = tables + fcc_offset;
common->lcc = (sljit_sw)(tables + lcc_offset);
common->mode = mode;
common->might_be_empty = re->minlength == 0;
common->allow_empty_partial = (re->max_lookbehind > 0) || (re->flags & PCRE2_MATCH_EMPTY) != 0;
common->might_be_empty = (re->minlength == 0) || (re->flags & PCRE2_MATCH_EMPTY);
common->allow_empty_partial = (re->max_lookbehind > 0) || (re->flags & PCRE2_MATCH_EMPTY);
common->nltype = NLTYPE_FIXED;
switch(re->newline_convention)
{

View File

@ -638,6 +638,7 @@ static struct regression_test_case regression_test_cases[] = {
{ MU, A, 0, 0, "(?=(?:x|ab(*ACCEPT)b))", "ab" },
{ MU, A, 0, 0, "(?=(a(b(*ACCEPT)b)))a", "ab" },
{ MU, A, PCRE2_NOTEMPTY, 0, "(?=a*(*ACCEPT))c", "c" },
{ MU, A, PCRE2_NOTEMPTY, 0 | F_NOMATCH, "(?=A)", "AB" },
/* Conditional blocks. */
{ MU, A, 0, 0, "(?(?=(a))a|b)+k", "ababbalbbadabak" },