diff --git a/src/pcre2test.c b/src/pcre2test.c index e4b4083..4d6eec8 100644 --- a/src/pcre2test.c +++ b/src/pcre2test.c @@ -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 */ diff --git a/testdata/testinput24 b/testdata/testinput24 index 2c20e66..ffc092c 100644 --- a/testdata/testinput24 +++ b/testdata/testinput24 @@ -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\)/ diff --git a/testdata/testoutput24 b/testdata/testoutput24 index 9dbfd0d..d6d1c87 100644 --- a/testdata/testoutput24 +++ b/testdata/testoutput24 @@ -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)