Possesify \s*\R

This commit is contained in:
Petr Písař 2012-04-20 14:42:51 +02:00
parent 949ac43e59
commit 13b47acdad
2 changed files with 145 additions and 1 deletions

View File

@ -0,0 +1,138 @@
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 ||

View File

@ -2,7 +2,7 @@
#%%global rcversion RC1
Name: pcre
Version: 8.30
Release: %{?rcversion:0.}3%{?rcversion:.%rcversion}%{?dist}
Release: %{?rcversion:0.}4%{?rcversion:.%rcversion}%{?dist}
%global myversion %{version}%{?rcversion:-%rcversion}
Summary: Perl-compatible regular expression library
Group: System Environment/Libraries
@ -15,6 +15,8 @@ Patch0: pcre-8.21-multilib.patch
Patch1: pcre-8.30-refused_spelling_terminated.patch
# Bug #810314, fixed in upstream after 8.30
Patch2: pcre-8.30-Fix-look-behind-assertion-in-UTF-8-JIT-mode.patch
# Bug #813237, fixed in upstream after 8.30
Patch3: pcre-8.30-possesify_sr.patch
BuildRequires: readline-devel
# New libtool to get rid of rpath
BuildRequires: autoconf, automake, libtool
@ -55,6 +57,7 @@ Utilities demonstrating PCRE capabilities like pcregrep or pcretest.
%patch0 -p1 -b .multilib
%patch1 -p1 -b .terminated_typos
%patch2 -p1 -b .lookbehind_assertion
%patch3 -p0 -b .possesify_sr
# Because of rpath patch
libtoolize --copy --force && autoreconf
# One contributor's name is non-UTF-8
@ -118,6 +121,9 @@ make check
%{_mandir}/man1/pcretest.*
%changelog
* Fri Apr 20 2012 Petr Pisar <ppisar@redhat.com> - 8.30-4
- Possesify \s*\R (bug #813237)
* Thu Apr 05 2012 Petr Pisar <ppisar@redhat.com> - 8.30-3
- Fix look-behind assertion in UTF-8 JIT mode (bug #810314)