[Pcre-svn] [359] code/trunk: Fix pcre2test splitting modifie…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [359] code/trunk: Fix pcre2test splitting modifier lists at white space.
Revision: 359
          http://www.exim.org/viewvc/pcre2?view=rev&revision=359
Author:   ph10
Date:     2015-08-30 15:11:15 +0100 (Sun, 30 Aug 2015)
Log Message:
-----------
Fix pcre2test splitting modifier lists at white space.


Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/doc/pcre2test.1
    code/trunk/src/pcre2test.c
    code/trunk/testdata/testinput2
    code/trunk/testdata/testoutput2


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2015-08-30 05:30:43 UTC (rev 358)
+++ code/trunk/ChangeLog    2015-08-30 14:11:15 UTC (rev 359)
@@ -164,7 +164,10 @@


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
--------------------------


Modified: code/trunk/doc/pcre2test.1
===================================================================
--- code/trunk/doc/pcre2test.1    2015-08-30 05:30:43 UTC (rev 358)
+++ code/trunk/doc/pcre2test.1    2015-08-30 14:11:15 UTC (rev 359)
@@ -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 @@
 .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 @@
 .rs
 .sp
 .nf
-Last updated: 20 May 2015
+Last updated: 30 August 2015
 Copyright (c) 1997-2015 University of Cambridge.
 .fi


Modified: code/trunk/src/pcre2test.c
===================================================================
--- code/trunk/src/pcre2test.c    2015-08-30 05:30:43 UTC (rev 358)
+++ code/trunk/src/pcre2test.c    2015-08-30 14:11:15 UTC (rev 359)
@@ -3071,9 +3071,10 @@
   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 '-'. */


Modified: code/trunk/testdata/testinput2
===================================================================
--- code/trunk/testdata/testinput2    2015-08-30 05:30:43 UTC (rev 358)
+++ code/trunk/testdata/testinput2    2015-08-30 14:11:15 UTC (rev 359)
@@ -4079,7 +4079,7 @@
     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>

Modified: code/trunk/testdata/testoutput2
===================================================================
--- code/trunk/testdata/testoutput2    2015-08-30 05:30:43 UTC (rev 358)
+++ code/trunk/testdata/testoutput2    2015-08-30 14:11:15 UTC (rev 359)
@@ -13740,9 +13740,9 @@
     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