[Pcre-svn] [961] code/trunk: Fix auto-possessify bugs for \s…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [961] code/trunk: Fix auto-possessify bugs for \s*\R and \S*R.
Revision: 961
          http://vcs.pcre.org/viewvc?view=rev&revision=961
Author:   ph10
Date:     2012-04-20 12:49:13 +0100 (Fri, 20 Apr 2012)


Log Message:
-----------
Fix auto-possessify bugs for \s*\R and \S*R.

Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/pcre_compile.c
    code/trunk/testdata/testinput2
    code/trunk/testdata/testoutput2


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2012-04-19 17:30:38 UTC (rev 960)
+++ code/trunk/ChangeLog    2012-04-20 11:49:13 UTC (rev 961)
@@ -86,6 +86,10 @@
     matches in certain environments (the workspace was not being correctly
     retained). Also added to pcre_dfa_exec() a simple plausibility check on
     some of the workspace data at the beginning of a restart.
+    
+25. \s*\R was auto-possessifying the \s* when it should not, whereas \S*\R
+    was not doing so when it should - probably a typo introduced by SVN 528
+    (change 8.10/14). 



Version 8.30 04-February-2012

Modified: code/trunk/pcre_compile.c
===================================================================
--- code/trunk/pcre_compile.c    2012-04-19 17:30:38 UTC (rev 960)
+++ code/trunk/pcre_compile.c    2012-04-20 11:49:13 UTC (rev 961)
@@ -3349,10 +3349,10 @@
   return next == -ESC_d;


case OP_WHITESPACE:
- return next == -ESC_S || next == -ESC_d || next == -ESC_w || next == -ESC_R;
+ return next == -ESC_S || next == -ESC_d || next == -ESC_w;

case OP_NOT_WHITESPACE:
- return next == -ESC_s || next == -ESC_h || next == -ESC_v;
+ return next == -ESC_s || next == -ESC_h || next == -ESC_v || next == -ESC_R;

case OP_HSPACE:
return next == -ESC_S || next == -ESC_H || next == -ESC_d ||

Modified: code/trunk/testdata/testinput2
===================================================================
--- code/trunk/testdata/testinput2    2012-04-19 17:30:38 UTC (rev 960)
+++ code/trunk/testdata/testinput2    2012-04-20 11:49:13 UTC (rev 961)
@@ -3102,7 +3102,25 @@
 /\d*\R/BZ


 /\s*\R/BZ
+    \x20\x0a
+    \x20\x0d
+    \x20\x0d\x0a


+/\S*\R/BZ
+    a\x0a
+
+/X\h*\R/BZ
+    X\x20\x0a
+
+/X\H*\R/BZ
+    X\x0d\x0a
+
+/X\H+\R/BZ
+    X\x0d\x0a
+
+/X\H++\R/BZ
+    X\x0d\x0a
+
 /-- Perl treats this one differently, not failing the second string. I believe
     that is a bug in Perl. --/



Modified: code/trunk/testdata/testoutput2
===================================================================
--- code/trunk/testdata/testoutput2    2012-04-19 17:30:38 UTC (rev 960)
+++ code/trunk/testdata/testoutput2    2012-04-20 11:49:13 UTC (rev 961)
@@ -10755,12 +10755,77 @@
 /\s*\R/BZ
 ------------------------------------------------------------------
         Bra
-        \s*+
+        \s*
         \R
         Ket
         End
 ------------------------------------------------------------------
+    \x20\x0a
+ 0:  \x0a
+    \x20\x0d
+ 0:  \x0d
+    \x20\x0d\x0a
+ 0:  \x0d\x0a


+/\S*\R/BZ
+------------------------------------------------------------------
+        Bra
+        \S*+
+        \R
+        Ket
+        End
+------------------------------------------------------------------
+    a\x0a
+ 0: a\x0a
+
+/X\h*\R/BZ
+------------------------------------------------------------------
+        Bra
+        X
+        \h*+
+        \R
+        Ket
+        End
+------------------------------------------------------------------
+    X\x20\x0a
+ 0: X \x0a
+
+/X\H*\R/BZ
+------------------------------------------------------------------
+        Bra
+        X
+        \H*
+        \R
+        Ket
+        End
+------------------------------------------------------------------
+    X\x0d\x0a
+ 0: X\x0d\x0a
+
+/X\H+\R/BZ
+------------------------------------------------------------------
+        Bra
+        X
+        \H+
+        \R
+        Ket
+        End
+------------------------------------------------------------------
+    X\x0d\x0a
+ 0: X\x0d\x0a
+
+/X\H++\R/BZ
+------------------------------------------------------------------
+        Bra
+        X
+        \H++
+        \R
+        Ket
+        End
+------------------------------------------------------------------
+    X\x0d\x0a
+No match
+
 /-- Perl treats this one differently, not failing the second string. I believe
     that is a bug in Perl. --/