pcre/pcre-8.30-possesify_sr.patch
2012-04-20 14:42:51 +02:00

139 lines
3.2 KiB
Diff

Possesify \s*\R
This is back-ported of upstream commit for pcre-8.30:
r961 | ph10 | 2012-04-20 13:49:13 +0200 (Pá, 20 dub 2012) | 2 lines
Fix auto-possessify bugs for \s*\R and \S*R.
Petr Pisar: Remove changelog entry
Index: testdata/testinput2
===================================================================
--- testdata/testinput2 (revision 960)
+++ testdata/testinput2 (revision 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. --/
Index: testdata/testoutput2
===================================================================
--- testdata/testoutput2 (revision 960)
+++ testdata/testoutput2 (revision 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. --/
Index: pcre_compile.c
===================================================================
--- pcre_compile.c (revision 960)
+++ pcre_compile.c (revision 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 ||