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().
47. Modifier lists in pcre2test were splitting at spaces without the required
commas.
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
pcre2test - a program for testing Perl-compatible regular expressions.
.SH SYNOPSIS
@ -303,12 +303,13 @@ subject lines. Modifiers on a subject line can change these settings.
.rs
.sp
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
for both patterns and subject lines, whereas others are valid for one or the
other only. Each modifier has a long name, for example "anchored", and some of
them must be followed by an equals sign and a value, for example, "offset=12".
Modifiers that do not take values may be preceded by a minus sign to turn off a
previous setting.
are separated by commas followed by optional white space. Trailing whitespace
in a modifier list is ignored. Some modifiers may be given for both patterns
and subject lines, whereas others are valid only for one or the other. Each
modifier has a long name, for example "anchored", and some of them must be
followed by an equals sign and a value, for example, "offset=12". Values cannot
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
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,
@ -1451,6 +1452,6 @@ Cambridge, England.
.rs
.sp
.nf
Last updated: 20 May 2015
Last updated: 30 August 2015
Copyright (c) 1997-2015 University of Cambridge.
.fi

View File

@ -3071,9 +3071,10 @@ for (;;)
while (isspace(*p) || *p == ',') p++;
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 '-'. */

2
testdata/testinput2 vendored
View File

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

View File

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