summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2012-04-20 11:49:13 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2012-04-20 11:49:13 +0000
commit7a2c66fafd71e7d5cd43ba0cc5648531d3696227 (patch)
tree3533e45308570bc8f66e14b2dea8f0a8250adde3
parentb45e17ad7d67d522e1d38780aeb74c31a83e8ac7 (diff)
downloadpcre-7a2c66fafd71e7d5cd43ba0cc5648531d3696227.tar.gz
Fix auto-possessify bugs for \s*\R and \S*R.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@961 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r--ChangeLog4
-rw-r--r--pcre_compile.c4
-rw-r--r--testdata/testinput218
-rw-r--r--testdata/testoutput267
4 files changed, 90 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 3540768..cc900d9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -86,6 +86,10 @@ Version 8.31
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
diff --git a/pcre_compile.c b/pcre_compile.c
index d4aa7c9..b267f31 100644
--- a/pcre_compile.c
+++ b/pcre_compile.c
@@ -3349,10 +3349,10 @@ switch(op_code)
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 ||
diff --git a/testdata/testinput2 b/testdata/testinput2
index 484ba8d..7a2182d 100644
--- a/testdata/testinput2
+++ b/testdata/testinput2
@@ -3102,6 +3102,24 @@ with \Y. ---/
/\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. --/
diff --git a/testdata/testoutput2 b/testdata/testoutput2
index 4acc35d..a595d6f 100644
--- a/testdata/testoutput2
+++ b/testdata/testoutput2
@@ -10755,11 +10755,76 @@ No match
/\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. --/