Fix pcre2test splitting modifier lists at white space.

This commit is contained in:
Philip.Hazel 2015-08-30 14:11:15 +00:00
parent ccda7d218f
commit fd08e11c1e
5 changed files with 18 additions and 13 deletions

View File

@ -164,6 +164,9 @@ test (there are now 20 in total).
46. Add the ${*MARK} facility to pcre2_substitute(). 46. Add the ${*MARK} facility to pcre2_substitute().
47. Modifier lists in pcre2test were splitting at spaces without the required
commas.
Version 10.20 30-June-2015 Version 10.20 30-June-2015
-------------------------- --------------------------

View File

@ -1,4 +1,4 @@
.TH PCRE2TEST 1 "20 May 2015" "PCRE 10.20" .TH PCRE2TEST 1 "30 August 2015" "PCRE 10.21"
.SH NAME .SH NAME
pcre2test - a program for testing Perl-compatible regular expressions. pcre2test - a program for testing Perl-compatible regular expressions.
.SH SYNOPSIS .SH SYNOPSIS
@ -303,12 +303,13 @@ subject lines. Modifiers on a subject line can change these settings.
.rs .rs
.sp .sp
Modifier lists are used with both pattern and subject lines. Items in a list Modifier lists are used with both pattern and subject lines. Items in a list
are separated by commas and optional white space. Some modifiers may be given are separated by commas followed by optional white space. Trailing whitespace
for both patterns and subject lines, whereas others are valid for one or the in a modifier list is ignored. Some modifiers may be given for both patterns
other only. Each modifier has a long name, for example "anchored", and some of and subject lines, whereas others are valid only for one or the other. Each
them must be followed by an equals sign and a value, for example, "offset=12". modifier has a long name, for example "anchored", and some of them must be
Modifiers that do not take values may be preceded by a minus sign to turn off a followed by an equals sign and a value, for example, "offset=12". Values cannot
previous setting. contain comma characters, but may contain spaces. Modifiers that do not take
values may be preceded by a minus sign to turn off a previous setting.
.P .P
A few of the more common modifiers can also be specified as single letters, for A few of the more common modifiers can also be specified as single letters, for
example "i" for "caseless". In documentation, following the Perl convention, example "i" for "caseless". In documentation, following the Perl convention,
@ -1451,6 +1452,6 @@ Cambridge, England.
.rs .rs
.sp .sp
.nf .nf
Last updated: 20 May 2015 Last updated: 30 August 2015
Copyright (c) 1997-2015 University of Cambridge. Copyright (c) 1997-2015 University of Cambridge.
.fi .fi

View File

@ -3071,9 +3071,10 @@ for (;;)
while (isspace(*p) || *p == ',') p++; while (isspace(*p) || *p == ',') p++;
if (*p == 0) break; if (*p == 0) break;
/* Find the end of the item. */ /* Find the end of the item; lose trailing whitespace at end of line. */
for (ep = p; *ep != 0 && *ep != ',' && !isspace(*ep); ep++); for (ep = p; *ep != 0 && *ep != ','; ep++);
if (*ep == 0) while (ep > p && isspace(ep[-1])) ep--;
/* Remember if the first character is '-'. */ /* Remember if the first character is '-'. */

2
testdata/testinput2 vendored
View File

@ -4079,7 +4079,7 @@ a random value. /Ix
apple strudel apple strudel
fruitless fruitless
/(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/replace=${*MARK} /(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/replace=${*MARK} sauce,
apple lemon blackberry apple lemon blackberry
/(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/g,replace=<$*MARK> /(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/g,replace=<$*MARK>

View File

@ -13740,9 +13740,9 @@ Failed: error -34: bad option value
fruitless fruitless
0: fruitless 0: fruitless
/(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/replace=${*MARK} /(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/replace=${*MARK} sauce,
apple lemon blackberry apple lemon blackberry
1: pear lemon blackberry 1: pear sauce lemon blackberry
/(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/g,replace=<$*MARK> /(*:pear)apple|(*:orange)lemon|(*:strawberry)blackberry/g,replace=<$*MARK>
apple lemon blackberry apple lemon blackberry