pcre2test can now handle lists of conversion options.

This commit is contained in:
Philip.Hazel 2017-05-20 11:40:12 +00:00
parent b704c0828f
commit 62564c08fd
3 changed files with 22 additions and 20 deletions

View File

@ -423,7 +423,7 @@ enum { MOD_CTC, /* Applies to a compile context */
MOD_PND, /* As MOD_PD, but not for a default pattern */
MOD_PNDP, /* As MOD_PND, OK for Perl test */
MOD_CHR, /* Is a single character */
MOD_CON, /* Is a "convert" type */
MOD_CON, /* Is a "convert" type/options list */
MOD_CTL, /* Is a control bit */
MOD_BSR, /* Is a BSR value */
MOD_IN2, /* Is one or two unsigned integers */
@ -3679,20 +3679,26 @@ for (;;)
*((uint32_t *)field) = *pp++;
break;
case MOD_CON: /* A convert type */
for (i = 0; i < convertlistcount; i++)
{
if (strncmpic(pp, (const uint8_t *)convertlist[i].name, len) == 0)
case MOD_CON: /* A convert type/options list */
for (;; pp++)
{
uint8_t *colon = (uint8_t *)strchr((const char *)pp, ':');
len = ((colon != NULL && colon < ep)? colon:ep) - pp;
for (i = 0; i < convertlistcount; i++)
{
if (*((uint32_t *)field) == CONVERT_UNSET)
*((uint32_t *)field) = convertlist[i].option;
else
*((uint32_t *)field) |= convertlist[i].option;
break;
if (strncmpic(pp, (const uint8_t *)convertlist[i].name, len) == 0)
{
if (*((uint32_t *)field) == CONVERT_UNSET)
*((uint32_t *)field) = convertlist[i].option;
else
*((uint32_t *)field) |= convertlist[i].option;
break;
}
}
if (i >= convertlistcount) goto INVALID_VALUE;
pp += len;
if (*pp != ':') break;
}
if (i >= convertlistcount) goto INVALID_VALUE;
pp = ep;
break;
case MOD_IN2: /* One or two unsigned integers */

View File

@ -245,8 +245,7 @@
/abc\/**\/abc/
#pattern convert=unset
#pattern convert=posix_extended
#pattern convert=unset:posix_extended
/a[[:>:]z/
@ -284,8 +283,7 @@
/a***b/
#pattern convert=unset
#pattern convert=posix_basic
#pattern convert=unset:posix_basic
/a*b+c\+[def](ab)\(cd\)/

View File

@ -375,8 +375,7 @@ No match
/abc\/**\/abc/
(?s)\Aabc/(*COMMIT)(?:.*?/)??abc\z
#pattern convert=unset
#pattern convert=posix_extended
#pattern convert=unset:posix_extended
/a[[:>:]z/
a[[:>:]z
@ -441,8 +440,7 @@ No match
/a***b/
a*b
#pattern convert=unset
#pattern convert=posix_basic
#pattern convert=unset:posix_basic
/a*b+c\+[def](ab)\(cd\)/
a*b\+c+[def]\(ab\)(cd)