summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornigel <nigel@2f5784b3-3f2a-0410-8824-cb99058d5e15>2007-02-24 21:39:37 +0000
committernigel <nigel@2f5784b3-3f2a-0410-8824-cb99058d5e15>2007-02-24 21:39:37 +0000
commite87cad160ebb5eefbd74344fc0c78318432ae433 (patch)
tree2f2cefcd2d102f14b817b82e66650ad0a94507fa
parent722283cf906c849b43a73af9527627e0fd2a3e8d (diff)
downloadpcre-e87cad160ebb5eefbd74344fc0c78318432ae433.tar.gz
Load pcre-3.4 into code/trunk.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@51 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r--ChangeLog8
-rwxr-xr-xconfigure4
-rw-r--r--configure.in4
-rw-r--r--doc/pcre.39
-rw-r--r--doc/pcre.html11
-rw-r--r--doc/pcre.txt18
-rw-r--r--internal.h1
-rw-r--r--pcre.c9
-rw-r--r--pcreposix.c3
-rw-r--r--testdata/testinput22
-rw-r--r--testdata/testoutput12
-rw-r--r--testdata/testoutput25
-rw-r--r--testdata/testoutput32
-rw-r--r--testdata/testoutput42
-rw-r--r--testdata/testoutput52
-rw-r--r--testdata/testoutput62
16 files changed, 54 insertions, 30 deletions
diff --git a/ChangeLog b/ChangeLog
index 47bbbe5..2133dd7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,14 @@ ChangeLog for PCRE
------------------
+Version 3.4 22-Aug-00
+---------------------
+
+1. Fixed typo in pcre.h: unsigned const char * changed to const unsigned char *.
+
+2. Diagnose condition (?(0) as an error instead of crashing on matching.
+
+
Version 3.3 01-Aug-00
---------------------
diff --git a/configure b/configure
index 1fc9c59..fbd3831 100755
--- a/configure
+++ b/configure
@@ -513,8 +513,8 @@ fi
PCRE_MAJOR=3
-PCRE_MINOR=3
-PCRE_DATE=01-Aug-2000
+PCRE_MINOR=4
+PCRE_DATE=22-Aug-2000
PCRE_VERSION=${PCRE_MAJOR}.${PCRE_MINOR}
diff --git a/configure.in b/configure.in
index ff51f48..c98387d 100644
--- a/configure.in
+++ b/configure.in
@@ -17,8 +17,8 @@ dnl digits for minor numbers less than 10. There are unlikely to be
dnl that many releases anyway.
PCRE_MAJOR=3
-PCRE_MINOR=3
-PCRE_DATE=01-Aug-2000
+PCRE_MINOR=4
+PCRE_DATE=22-Aug-2000
PCRE_VERSION=${PCRE_MAJOR}.${PCRE_MINOR}
dnl Provide versioning information for libtool shared libraries that
diff --git a/doc/pcre.3 b/doc/pcre.3
index 748417b..fc20445 100644
--- a/doc/pcre.3
+++ b/doc/pcre.3
@@ -1245,7 +1245,7 @@ to the string
/* first command */ not comment /* second comment */
-fails, because it matches the entire string due to the greediness of the .*
+fails, because it matches the entire string owing to the greediness of the .*
item.
However, if a quantifier is followed by a question mark, it ceases to be
@@ -1564,9 +1564,10 @@ subpattern, a compile-time error occurs.
There are two kinds of condition. If the text between the parentheses consists
of a sequence of digits, the condition is satisfied if the capturing subpattern
-of that number has previously matched. Consider the following pattern, which
-contains non-significant white space to make it more readable (assume the
-PCRE_EXTENDED option) and to divide it into three parts for ease of discussion:
+of that number has previously matched. The number must be greater than zero.
+Consider the following pattern, which contains non-significant white space to
+make it more readable (assume the PCRE_EXTENDED option) and to divide it into
+three parts for ease of discussion:
( \\( )? [^()]+ (?(1) \\) )
diff --git a/doc/pcre.html b/doc/pcre.html
index 4598698..0177097 100644
--- a/doc/pcre.html
+++ b/doc/pcre.html
@@ -1621,7 +1621,7 @@ to the string
</PRE>
</P>
<P>
-fails, because it matches the entire string due to the greediness of the .*
+fails, because it matches the entire string owing to the greediness of the .*
item.
</P>
<P>
@@ -2078,9 +2078,10 @@ subpattern, a compile-time error occurs.
<P>
There are two kinds of condition. If the text between the parentheses consists
of a sequence of digits, the condition is satisfied if the capturing subpattern
-of that number has previously matched. Consider the following pattern, which
-contains non-significant white space to make it more readable (assume the
-PCRE_EXTENDED option) and to divide it into three parts for ease of discussion:
+of that number has previously matched. The number must be greater than zero.
+Consider the following pattern, which contains non-significant white space to
+make it more readable (assume the PCRE_EXTENDED option) and to divide it into
+three parts for ease of discussion:
</P>
<P>
<PRE>
@@ -2389,6 +2390,8 @@ Phone: +44 1223 334714
<P>
Last updated: 28 August 2000,
<BR>
+<PRE>
the 250th anniversary of the death of J.S. Bach.
<BR>
+</PRE>
Copyright (c) 1997-2000 University of Cambridge.
diff --git a/doc/pcre.txt b/doc/pcre.txt
index 29cc490..1db4b53 100644
--- a/doc/pcre.txt
+++ b/doc/pcre.txt
@@ -1462,7 +1462,7 @@ REPETITION
/* first command */ not comment /* second comment */
- fails, because it matches the entire string due to the
+ fails, because it matches the entire string owing to the
greediness of the .* item.
However, if a quantifier is followed by a question mark, it
@@ -1838,10 +1838,11 @@ CONDITIONAL SUBPATTERNS
There are two kinds of condition. If the text between the
parentheses consists of a sequence of digits, the condition
is satisfied if the capturing subpattern of that number has
- previously matched. Consider the following pattern, which
- contains non-significant white space to make it more read-
- able (assume the PCRE_EXTENDED option) and to divide it into
- three parts for ease of discussion:
+ previously matched. The number must be greater than zero.
+ Consider the following pattern, which contains non-
+ significant white space to make it more readable (assume the
+ PCRE_EXTENDED option) and to divide it into three parts for
+ ease of discussion:
( \( )? [^()]+ (?(1) \) )
@@ -2001,9 +2002,9 @@ PERFORMANCE
repeat can match 0, 1, 2, 3, or 4 times, and for each of
those cases other than 0, the + repeats can match different
numbers of times.) When the remainder of the pattern is such
- that the entire match is going to fail, PCRE has in
- principle to try every possible variation, and this can take
- an extremely long time.
+ that the entire match is going to fail, PCRE has in princi-
+ ple to try every possible variation, and this can take an
+ extremely long time.
An optimization catches some of the more simple cases such
as
@@ -2105,7 +2106,6 @@ UTF-8 SUPPORT
The following UTF-8 features of Perl 5.6 are not imple-
mented:
-
1. The escape sequence \C to match a single byte.
2. The use of Unicode tables and properties and escapes \p,
diff --git a/internal.h b/internal.h
index ea0d905..25bb7f8 100644
--- a/internal.h
+++ b/internal.h
@@ -277,6 +277,7 @@ just to accommodate the POSIX wrapper. */
#define ERR32 "this version of PCRE is not compiled with PCRE_UTF8 support"
#define ERR33 "characters with values > 255 are not yet supported in classes"
#define ERR34 "character value in \\x{...} sequence is too large"
+#define ERR35 "invalid condition (?(0)"
/* All character handling must be done as unsigned characters. Otherwise there
are problems with top-bit-set characters and functions such as isspace().
diff --git a/pcre.c b/pcre.c
index e428eda..5149f8d 100644
--- a/pcre.c
+++ b/pcre.c
@@ -1754,6 +1754,11 @@ for (;; ptr++)
{
condref = *ptr - '0';
while (*(++ptr) != ')') condref = condref*10 + *ptr - '0';
+ if (condref == 0)
+ {
+ *errorptr = ERR35;
+ goto FAILED;
+ }
ptr++;
}
else ptr--;
@@ -2095,7 +2100,7 @@ Argument:
ptrptr -> the address of the current pattern pointer
errorptr -> pointer to error message
lookbehind TRUE if this is a lookbehind assertion
- condref > 0 for OPT_CREF setting at start of conditional group
+ condref >= 0 for OPT_CREF setting at start of conditional group
reqchar -> place to put the last required character, or a negative number
countlits -> place to put the shortest literal count of any branch
cd points to the data block with tables pointers
@@ -2123,7 +2128,7 @@ code += 3;
/* At the start of a reference-based conditional group, insert the reference
number as an OP_CREF item. */
-if (condref > 0)
+if (condref >= 0)
{
*code++ = OP_CREF;
*code++ = condref;
diff --git a/pcreposix.c b/pcreposix.c
index 71d02ef..6aeb882 100644
--- a/pcreposix.c
+++ b/pcreposix.c
@@ -83,7 +83,8 @@ static int eint[] = {
REG_BADPAT, /* "POSIX collating elements are not supported" */
REG_INVARG, /* "this version of PCRE is not compiled with PCRE_UTF8 support" */
REG_BADPAT, /* "characters with values > 255 are not yet supported in classes" */
- REG_BADPAT /* "character value in \x{...} sequence is too large" */
+ REG_BADPAT, /* "character value in \x{...} sequence is too large" */
+ REG_BADPAT /* "invalid condition (?(0)" */
};
/* Table of texts corresponding to POSIX error codes */
diff --git a/testdata/testinput2 b/testdata/testinput2
index db9cd02..ad116ef 100644
--- a/testdata/testinput2
+++ b/testdata/testinput2
@@ -707,4 +707,6 @@
/[\200-\410]/
+/^(?(0)f|b)oo/
+
/ End of testinput2 /
diff --git a/testdata/testoutput1 b/testdata/testoutput1
index 145487d..e0059d3 100644
--- a/testdata/testoutput1
+++ b/testdata/testoutput1
@@ -1,4 +1,4 @@
-PCRE version 3.3 01-Aug-2000
+PCRE version 3.4 22-Aug-2000
/the quick brown fox/
the quick brown fox
diff --git a/testdata/testoutput2 b/testdata/testoutput2
index a34394c..5de4a6e 100644
--- a/testdata/testoutput2
+++ b/testdata/testoutput2
@@ -1,4 +1,4 @@
-PCRE version 3.3 01-Aug-2000
+PCRE version 3.4 22-Aug-2000
/(a)b|/
Capturing subpattern count = 1
@@ -2064,6 +2064,9 @@ No match
/[\200-\410]/
Failed: range out of order in character class at offset 9
+/^(?(0)f|b)oo/
+Failed: invalid condition (?(0) at offset 5
+
/ End of testinput2 /
Capturing subpattern count = 0
No options
diff --git a/testdata/testoutput3 b/testdata/testoutput3
index 784cf09..1568e4d 100644
--- a/testdata/testoutput3
+++ b/testdata/testoutput3
@@ -1,4 +1,4 @@
-PCRE version 3.3 01-Aug-2000
+PCRE version 3.4 22-Aug-2000
/(?<!bar)foo/
foo
diff --git a/testdata/testoutput4 b/testdata/testoutput4
index b6d2be2..f1fbb56 100644
--- a/testdata/testoutput4
+++ b/testdata/testoutput4
@@ -1,4 +1,4 @@
-PCRE version 3.3 01-Aug-2000
+PCRE version 3.4 22-Aug-2000
/^[\w]+/
*** Failers
diff --git a/testdata/testoutput5 b/testdata/testoutput5
index 83bf1d8..4b81ae3 100644
--- a/testdata/testoutput5
+++ b/testdata/testoutput5
@@ -1,4 +1,4 @@
-PCRE version 3.3 01-Aug-2000
+PCRE version 3.4 22-Aug-2000
/-- Because of problems with Perl 5.6 in handling UTF-8 vs non UTF-8 --/
/-- strings automatically, do not use the \x{} construct except with --/
diff --git a/testdata/testoutput6 b/testdata/testoutput6
index 0fae289..a805609 100644
--- a/testdata/testoutput6
+++ b/testdata/testoutput6
@@ -1,4 +1,4 @@
-PCRE version 3.3 01-Aug-2000
+PCRE version 3.4 22-Aug-2000
/\x{100}/8DM
Memory allocation (code space): 11