pcre2test can now handle lists of conversion options.
This commit is contained in:
parent
b704c0828f
commit
62564c08fd
|
@ -423,7 +423,7 @@ enum { MOD_CTC, /* Applies to a compile context */
|
||||||
MOD_PND, /* As MOD_PD, but not for a default pattern */
|
MOD_PND, /* As MOD_PD, but not for a default pattern */
|
||||||
MOD_PNDP, /* As MOD_PND, OK for Perl test */
|
MOD_PNDP, /* As MOD_PND, OK for Perl test */
|
||||||
MOD_CHR, /* Is a single character */
|
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_CTL, /* Is a control bit */
|
||||||
MOD_BSR, /* Is a BSR value */
|
MOD_BSR, /* Is a BSR value */
|
||||||
MOD_IN2, /* Is one or two unsigned integers */
|
MOD_IN2, /* Is one or two unsigned integers */
|
||||||
|
@ -3679,20 +3679,26 @@ for (;;)
|
||||||
*((uint32_t *)field) = *pp++;
|
*((uint32_t *)field) = *pp++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MOD_CON: /* A convert type */
|
case MOD_CON: /* A convert type/options list */
|
||||||
for (i = 0; i < convertlistcount; i++)
|
for (;; pp++)
|
||||||
{
|
{
|
||||||
if (strncmpic(pp, (const uint8_t *)convertlist[i].name, len) == 0)
|
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)
|
if (strncmpic(pp, (const uint8_t *)convertlist[i].name, len) == 0)
|
||||||
*((uint32_t *)field) = convertlist[i].option;
|
{
|
||||||
else
|
if (*((uint32_t *)field) == CONVERT_UNSET)
|
||||||
*((uint32_t *)field) |= convertlist[i].option;
|
*((uint32_t *)field) = convertlist[i].option;
|
||||||
break;
|
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;
|
break;
|
||||||
|
|
||||||
case MOD_IN2: /* One or two unsigned integers */
|
case MOD_IN2: /* One or two unsigned integers */
|
||||||
|
|
|
@ -245,8 +245,7 @@
|
||||||
|
|
||||||
/abc\/**\/abc/
|
/abc\/**\/abc/
|
||||||
|
|
||||||
#pattern convert=unset
|
#pattern convert=unset:posix_extended
|
||||||
#pattern convert=posix_extended
|
|
||||||
|
|
||||||
/a[[:>:]z/
|
/a[[:>:]z/
|
||||||
|
|
||||||
|
@ -284,8 +283,7 @@
|
||||||
|
|
||||||
/a***b/
|
/a***b/
|
||||||
|
|
||||||
#pattern convert=unset
|
#pattern convert=unset:posix_basic
|
||||||
#pattern convert=posix_basic
|
|
||||||
|
|
||||||
/a*b+c\+[def](ab)\(cd\)/
|
/a*b+c\+[def](ab)\(cd\)/
|
||||||
|
|
||||||
|
|
|
@ -375,8 +375,7 @@ No match
|
||||||
/abc\/**\/abc/
|
/abc\/**\/abc/
|
||||||
(?s)\Aabc/(*COMMIT)(?:.*?/)??abc\z
|
(?s)\Aabc/(*COMMIT)(?:.*?/)??abc\z
|
||||||
|
|
||||||
#pattern convert=unset
|
#pattern convert=unset:posix_extended
|
||||||
#pattern convert=posix_extended
|
|
||||||
|
|
||||||
/a[[:>:]z/
|
/a[[:>:]z/
|
||||||
a[[:>:]z
|
a[[:>:]z
|
||||||
|
@ -441,8 +440,7 @@ No match
|
||||||
/a***b/
|
/a***b/
|
||||||
a*b
|
a*b
|
||||||
|
|
||||||
#pattern convert=unset
|
#pattern convert=unset:posix_basic
|
||||||
#pattern convert=posix_basic
|
|
||||||
|
|
||||||
/a*b+c\+[def](ab)\(cd\)/
|
/a*b+c\+[def](ab)\(cd\)/
|
||||||
a*b\+c+[def]\(ab\)(cd)
|
a*b\+c+[def]\(ab\)(cd)
|
||||||
|
|
Loading…
Reference in New Issue