summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2010-06-16 10:51:15 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2010-06-16 10:51:15 +0000
commit0e465ff65a67b48a0a62a8807b67a79ea52ba534 (patch)
tree3ac3ae3515cbcfc64181c82d78b2d4271764c7c0
parent0b7e881ffab59316d7fdef968feea28718f94d71 (diff)
downloadpcre-0e465ff65a67b48a0a62a8807b67a79ea52ba534.tar.gz
Tidyup for 8.10-RC2 test release.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@545 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r--ChangeLog34
-rw-r--r--NEWS4
-rw-r--r--configure.ac2
-rw-r--r--doc/html/pcreapi.html26
-rw-r--r--doc/html/pcretest.html20
-rw-r--r--doc/pcre.txt428
-rw-r--r--doc/pcreapi.32
-rw-r--r--doc/pcretest.110
-rw-r--r--doc/pcretest.txt20
-rw-r--r--pcre_compile.c10
-rw-r--r--pcre_dfa_exec.c6
-rw-r--r--pcre_exec.c14
-rw-r--r--pcre_study.c42
-rw-r--r--pcreposix.c4
-rw-r--r--pcretest.c42
15 files changed, 351 insertions, 313 deletions
diff --git a/ChangeLog b/ChangeLog
index fb1b313..a890363 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,7 @@
ChangeLog for PCRE
------------------
-Version 8.10 03-Jun-2010
+Version 8.10 16-Jun-2010
------------------------
1. Added support for (*MARK:ARG) and for ARG additions to PRUNE, SKIP, and
@@ -42,7 +42,7 @@ Version 8.10 03-Jun-2010
11. In UTF-8 mode, if a pattern that was compiled with PCRE_CASELESS was
studied, and the match started with a letter with a code point greater than
127 whose first byte was different to the first byte of the other case of
- the letter, the other case of this starting letter was not recognized
+ the letter, the other case of this starting letter was not recognized
(#976).
12. If a pattern that was studied started with a repeated Unicode property
@@ -68,31 +68,31 @@ Version 8.10 03-Jun-2010
17. Added a check for running out of memory when PCRE is compiled with
--disable-stack-for-recursion (#990).
-
+
18. If the last data line in a file for pcretest does not have a newline on
- the end, a newline was missing in the output.
-
-19. The default pcre_chartables.c file recognizes only ASCII characters (values
- less than 128) in its various bitmaps. However, there is a facility for
- generating tables according to the current locale when PCRE is compiled. It
- turns out that in some environments, 0x85 and 0xa0, which are Unicode space
- characters, are recognized by isspace() and therefore were getting set in
+ the end, a newline was missing in the output.
+
+19. The default pcre_chartables.c file recognizes only ASCII characters (values
+ less than 128) in its various bitmaps. However, there is a facility for
+ generating tables according to the current locale when PCRE is compiled. It
+ turns out that in some environments, 0x85 and 0xa0, which are Unicode space
+ characters, are recognized by isspace() and therefore were getting set in
these tables, and indeed these tables seem to approximate to ISO 8859. This
caused a problem in UTF-8 mode when pcre_study() was used to create a list
of bytes that can start a match. For \s, it was including 0x85 and 0xa0,
which of course cannot start UTF-8 characters. I have changed the code so
that only real ASCII characters (less than 128) and the correct starting
- bytes for UTF-8 encodings are set for characters greater than 127 when in
+ bytes for UTF-8 encodings are set for characters greater than 127 when in
UTF-8 mode. (When PCRE_UCP is set - see 9 above - the code is different
altogether.)
-
+
20. Added the /T option to pcretest so as to be able to run tests with non-
standard character tables, thus making it possible to include the tests
- used for 19 above in the standard set of tests.
-
-21. A pattern such as (?&t)(?#()(?(DEFINE)(?<t>a)) which has a forward
- reference to a subpattern the other side of a comment that contains an
- opening parenthesis caused either an internal compiling error, or a
+ used for 19 above in the standard set of tests.
+
+21. A pattern such as (?&t)(?#()(?(DEFINE)(?<t>a)) which has a forward
+ reference to a subpattern the other side of a comment that contains an
+ opening parenthesis caused either an internal compiling error, or a
reference to the wrong subpattern.
diff --git a/NEWS b/NEWS
index d18f465..b6fd081 100644
--- a/NEWS
+++ b/NEWS
@@ -1,10 +1,10 @@
News about PCRE releases
------------------------
-Release 8.10 03-Jun-2010
+Release 8.10 16-Jun-2010
------------------------
-There are two major additions: support for (*MAKR) and friends, and the option
+There are two major additions: support for (*MARK) and friends, and the option
PCRE_UCP, which changes the behaviour of \b, \d, \s, and \w (and their
opposites) so that they make use of Unicode properties. There are also a number
of lesser new features, and several bugs have been fixed. A new option,
diff --git a/configure.ac b/configure.ac
index f88ad39..708b75e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -11,7 +11,7 @@ dnl be defined as -RC2, for example. For real releases, it should be empty.
m4_define(pcre_major, [8])
m4_define(pcre_minor, [10])
m4_define(pcre_prerelease, [-RC2])
-m4_define(pcre_date, [2010-06-11])
+m4_define(pcre_date, [2010-06-16])
# Libtool shared library interface versions (current:revision:age)
m4_define(libpcre_version, [0:1:0])
diff --git a/doc/html/pcreapi.html b/doc/html/pcreapi.html
index d14224c..c73a482 100644
--- a/doc/html/pcreapi.html
+++ b/doc/html/pcreapi.html
@@ -1438,12 +1438,17 @@ sample program.
PCRE_NO_START_OPTIMIZE
</pre>
There are a number of optimizations that <b>pcre_exec()</b> uses at the start of
-a match, in order to speed up the process. For example, if it is known that a
-match must start with a specific character, it searches the subject for that
-character, and fails immediately if it cannot find it, without actually running
-the main matching function. When callouts are in use, these optimizations can
-cause them to be skipped. This option disables the "start-up" optimizations,
-causing performance to suffer, but ensuring that the callouts do occur.
+a match, in order to speed up the process. For example, if it is known that an
+unanchored match must start with a specific character, it searches the subject
+for that character, and fails immediately if it cannot find it, without
+actually running the main matching function. This means that a special item
+such as (*COMMIT) at the start of a pattern is not considered until after a
+suitable starting point for the match has been found. When callouts are in use,
+these "start-up" optimizations can cause them to be skipped if the pattern is
+never actually used. The PCRE_NO_START_OPTIMIZE option disables the start-up
+optimizations, causing performance to suffer, but ensuring that the callouts do
+occur, and that items such as (*COMMIT) are considered at every possible
+starting position in the subject string.
<pre>
PCRE_NO_UTF8_CHECK
</pre>
@@ -1987,9 +1992,10 @@ Option bits for <b>pcre_dfa_exec()</b>
The unused bits of the <i>options</i> argument for <b>pcre_dfa_exec()</b> must be
zero. The only bits that may be set are PCRE_ANCHORED, PCRE_NEWLINE_<i>xxx</i>,
PCRE_NOTBOL, PCRE_NOTEOL, PCRE_NOTEMPTY, PCRE_NOTEMPTY_ATSTART,
-PCRE_NO_UTF8_CHECK, PCRE_PARTIAL_HARD, PCRE_PARTIAL_SOFT, PCRE_DFA_SHORTEST,
-and PCRE_DFA_RESTART. All but the last four of these are exactly the same as
-for <b>pcre_exec()</b>, so their description is not repeated here.
+PCRE_NO_UTF8_CHECK, PCRE_BSR_ANYCRLF, PCRE_BSR_UNICODE, PCRE_NO_START_OPTIMIZE,
+PCRE_PARTIAL_HARD, PCRE_PARTIAL_SOFT, PCRE_DFA_SHORTEST, and PCRE_DFA_RESTART.
+All but the last four of these are exactly the same as for <b>pcre_exec()</b>,
+so their description is not repeated here.
<pre>
PCRE_PARTIAL_HARD
PCRE_PARTIAL_SOFT
@@ -2115,7 +2121,7 @@ Cambridge CB2 3QH, England.
</P>
<br><a name="SEC22" href="#TOC1">REVISION</a><br>
<P>
-Last updated: 01 June 2010
+Last updated: 15 June 2010
<br>
Copyright &copy; 1997-2010 University of Cambridge.
<br>
diff --git a/doc/html/pcretest.html b/doc/html/pcretest.html
index 35acb9c..ce16d22 100644
--- a/doc/html/pcretest.html
+++ b/doc/html/pcretest.html
@@ -318,8 +318,9 @@ example,
For this reason, it must be the last modifier. The given locale is set,
<b>pcre_maketables()</b> is called to build a set of character tables for the
locale, and this is then passed to <b>pcre_compile()</b> when compiling the
-regular expression. Without an <b>/L</b> modifier, NULL is passed as the tables
-pointer; that is, <b>/L</b> applies only to the expression on which it appears.
+regular expression. Without an <b>/L</b> (or <b>/T</b>) modifier, NULL is passed
+as the tables pointer; that is, <b>/L</b> applies only to the expression on
+which it appears.
</P>
<P>
The <b>/M</b> modifier causes the size of memory block used to hold the compiled
@@ -330,6 +331,19 @@ The <b>/S</b> modifier causes <b>pcre_study()</b> to be called after the
expression has been compiled, and the results used when the expression is
matched.
</P>
+<P>
+The <b>/T</b> modifier must be followed by a single digit. It causes a specific
+set of built-in character tables to be passed to <b>pcre_compile()</b>. It is
+used in the standard PCRE tests to check behaviour with different character
+tables. The digit specifies the tables as follows:
+<pre>
+ 0 the default ASCII tables, as distributed in
+ pcre_chartables.c.dist
+ 1 a set of tables defining ISO 8859 characters
+</pre>
+In table 1, some characters whose codes are greater than 128 are identified as
+letters, digits, spaces, etc.
+</P>
<br><b>
Using the POSIX wrapper API
</b><br>
@@ -726,7 +740,7 @@ Cambridge CB2 3QH, England.
</P>
<br><a name="SEC15" href="#TOC1">REVISION</a><br>
<P>
-Last updated: 16 May 2010
+Last updated: 14 June 2010
<br>
Copyright &copy; 1997-2010 University of Cambridge.
<br>
diff --git a/doc/pcre.txt b/doc/pcre.txt
index 863fec1..022205c 100644
--- a/doc/pcre.txt
+++ b/doc/pcre.txt
@@ -2122,161 +2122,166 @@ MATCHING A PATTERN: THE TRADITIONAL FUNCTION
There are a number of optimizations that pcre_exec() uses at the start
of a match, in order to speed up the process. For example, if it is
- known that a match must start with a specific character, it searches
- the subject for that character, and fails immediately if it cannot find
- it, without actually running the main matching function. When callouts
- are in use, these optimizations can cause them to be skipped. This
- option disables the "start-up" optimizations, causing performance to
- suffer, but ensuring that the callouts do occur.
+ known that an unanchored match must start with a specific character, it
+ searches the subject for that character, and fails immediately if it
+ cannot find it, without actually running the main matching function.
+ This means that a special item such as (*COMMIT) at the start of a pat-
+ tern is not considered until after a suitable starting point for the
+ match has been found. When callouts are in use, these "start-up" opti-
+ mizations can cause them to be skipped if the pattern is never actually
+ used. The PCRE_NO_START_OPTIMIZE option disables the start-up optimiza-
+ tions, causing performance to suffer, but ensuring that the callouts do
+ occur, and that items such as (*COMMIT) are considered at every possi-
+ ble starting position in the subject string.
PCRE_NO_UTF8_CHECK
When PCRE_UTF8 is set at compile time, the validity of the subject as a
- UTF-8 string is automatically checked when pcre_exec() is subsequently
- called. The value of startoffset is also checked to ensure that it
- points to the start of a UTF-8 character. There is a discussion about
- the validity of UTF-8 strings in the section on UTF-8 support in the
- main pcre page. If an invalid UTF-8 sequence of bytes is found,
- pcre_exec() returns the error PCRE_ERROR_BADUTF8. If startoffset con-
+ UTF-8 string is automatically checked when pcre_exec() is subsequently
+ called. The value of startoffset is also checked to ensure that it
+ points to the start of a UTF-8 character. There is a discussion about
+ the validity of UTF-8 strings in the section on UTF-8 support in the
+ main pcre page. If an invalid UTF-8 sequence of bytes is found,
+ pcre_exec() returns the error PCRE_ERROR_BADUTF8. If startoffset con-
tains an invalid value, PCRE_ERROR_BADUTF8_OFFSET is returned.
- If you already know that your subject is valid, and you want to skip
- these checks for performance reasons, you can set the
- PCRE_NO_UTF8_CHECK option when calling pcre_exec(). You might want to
- do this for the second and subsequent calls to pcre_exec() if you are
- making repeated calls to find all the matches in a single subject
- string. However, you should be sure that the value of startoffset
- points to the start of a UTF-8 character. When PCRE_NO_UTF8_CHECK is
- set, the effect of passing an invalid UTF-8 string as a subject, or a
- value of startoffset that does not point to the start of a UTF-8 char-
+ If you already know that your subject is valid, and you want to skip
+ these checks for performance reasons, you can set the
+ PCRE_NO_UTF8_CHECK option when calling pcre_exec(). You might want to
+ do this for the second and subsequent calls to pcre_exec() if you are
+ making repeated calls to find all the matches in a single subject
+ string. However, you should be sure that the value of startoffset
+ points to the start of a UTF-8 character. When PCRE_NO_UTF8_CHECK is
+ set, the effect of passing an invalid UTF-8 string as a subject, or a
+ value of startoffset that does not point to the start of a UTF-8 char-
acter, is undefined. Your program may crash.
PCRE_PARTIAL_HARD
PCRE_PARTIAL_SOFT
- These options turn on the partial matching feature. For backwards com-
- patibility, PCRE_PARTIAL is a synonym for PCRE_PARTIAL_SOFT. A partial
- match occurs if the end of the subject string is reached successfully,
- but there are not enough subject characters to complete the match. If
- this happens when PCRE_PARTIAL_HARD is set, pcre_exec() immediately
- returns PCRE_ERROR_PARTIAL. Otherwise, if PCRE_PARTIAL_SOFT is set,
- matching continues by testing any other alternatives. Only if they all
- fail is PCRE_ERROR_PARTIAL returned (instead of PCRE_ERROR_NOMATCH).
+ These options turn on the partial matching feature. For backwards com-
+ patibility, PCRE_PARTIAL is a synonym for PCRE_PARTIAL_SOFT. A partial
+ match occurs if the end of the subject string is reached successfully,
+ but there are not enough subject characters to complete the match. If
+ this happens when PCRE_PARTIAL_HARD is set, pcre_exec() immediately
+ returns PCRE_ERROR_PARTIAL. Otherwise, if PCRE_PARTIAL_SOFT is set,
+ matching continues by testing any other alternatives. Only if they all
+ fail is PCRE_ERROR_PARTIAL returned (instead of PCRE_ERROR_NOMATCH).
The portion of the string that was inspected when the partial match was
- found is set as the first matching string. There is a more detailed
+ found is set as the first matching string. There is a more detailed
discussion in the pcrepartial documentation.
The string to be matched by pcre_exec()
- The subject string is passed to pcre_exec() as a pointer in subject, a
+ The subject string is passed to pcre_exec() as a pointer in subject, a
length (in bytes) in length, and a starting byte offset in startoffset.
In UTF-8 mode, the byte offset must point to the start of a UTF-8 char-
- acter. Unlike the pattern string, the subject may contain binary zero
- bytes. When the starting offset is zero, the search for a match starts
- at the beginning of the subject, and this is by far the most common
+ acter. Unlike the pattern string, the subject may contain binary zero
+ bytes. When the starting offset is zero, the search for a match starts
+ at the beginning of the subject, and this is by far the most common
case.
- A non-zero starting offset is useful when searching for another match
- in the same subject by calling pcre_exec() again after a previous suc-
- cess. Setting startoffset differs from just passing over a shortened
- string and setting PCRE_NOTBOL in the case of a pattern that begins
+ A non-zero starting offset is useful when searching for another match
+ in the same subject by calling pcre_exec() again after a previous suc-
+ cess. Setting startoffset differs from just passing over a shortened
+ string and setting PCRE_NOTBOL in the case of a pattern that begins
with any kind of lookbehind. For example, consider the pattern
\Biss\B
- which finds occurrences of "iss" in the middle of words. (\B matches
- only if the current position in the subject is not a word boundary.)
- When applied to the string "Mississipi" the first call to pcre_exec()
- finds the first occurrence. If pcre_exec() is called again with just
- the remainder of the subject, namely "issipi", it does not match,
+ which finds occurrences of "iss" in the middle of words. (\B matches
+ only if the current position in the subject is not a word boundary.)
+ When applied to the string "Mississipi" the first call to pcre_exec()
+ finds the first occurrence. If pcre_exec() is called again with just
+ the remainder of the subject, namely "issipi", it does not match,
because \B is always false at the start of the subject, which is deemed
- to be a word boundary. However, if pcre_exec() is passed the entire
+ to be a word boundary. However, if pcre_exec() is passed the entire
string again, but with startoffset set to 4, it finds the second occur-
- rence of "iss" because it is able to look behind the starting point to
+ rence of "iss" because it is able to look behind the starting point to
discover that it is preceded by a letter.
- If a non-zero starting offset is passed when the pattern is anchored,
+ If a non-zero starting offset is passed when the pattern is anchored,
one attempt to match at the given offset is made. This can only succeed
- if the pattern does not require the match to be at the start of the
+ if the pattern does not require the match to be at the start of the
subject.
How pcre_exec() returns captured substrings
- In general, a pattern matches a certain portion of the subject, and in
- addition, further substrings from the subject may be picked out by
- parts of the pattern. Following the usage in Jeffrey Friedl's book,
- this is called "capturing" in what follows, and the phrase "capturing
- subpattern" is used for a fragment of a pattern that picks out a sub-
- string. PCRE supports several other kinds of parenthesized subpattern
+ In general, a pattern matches a certain portion of the subject, and in
+ addition, further substrings from the subject may be picked out by
+ parts of the pattern. Following the usage in Jeffrey Friedl's book,
+ this is called "capturing" in what follows, and the phrase "capturing
+ subpattern" is used for a fragment of a pattern that picks out a sub-
+ string. PCRE supports several other kinds of parenthesized subpattern
that do not cause substrings to be captured.
Captured substrings are returned to the caller via a vector of integers
- whose address is passed in ovector. The number of elements in the vec-
- tor is passed in ovecsize, which must be a non-negative number. Note:
+ whose address is passed in ovector. The number of elements in the vec-
+ tor is passed in ovecsize, which must be a non-negative number. Note:
this argument is NOT the size of ovector in bytes.
- The first two-thirds of the vector is used to pass back captured sub-
- strings, each substring using a pair of integers. The remaining third
- of the vector is used as workspace by pcre_exec() while matching cap-
- turing subpatterns, and is not available for passing back information.
- The number passed in ovecsize should always be a multiple of three. If
+ The first two-thirds of the vector is used to pass back captured sub-
+ strings, each substring using a pair of integers. The remaining third
+ of the vector is used as workspace by pcre_exec() while matching cap-
+ turing subpatterns, and is not available for passing back information.
+ The number passed in ovecsize should always be a multiple of three. If
it is not, it is rounded down.
- When a match is successful, information about captured substrings is
- returned in pairs of integers, starting at the beginning of ovector,
- and continuing up to two-thirds of its length at the most. The first
- element of each pair is set to the byte offset of the first character
- in a substring, and the second is set to the byte offset of the first
- character after the end of a substring. Note: these values are always
+ When a match is successful, information about captured substrings is
+ returned in pairs of integers, starting at the beginning of ovector,
+ and continuing up to two-thirds of its length at the most. The first
+ element of each pair is set to the byte offset of the first character
+ in a substring, and the second is set to the byte offset of the first
+ character after the end of a substring. Note: these values are always
byte offsets, even in UTF-8 mode. They are not character counts.
- The first pair of integers, ovector[0] and ovector[1], identify the
- portion of the subject string matched by the entire pattern. The next
- pair is used for the first capturing subpattern, and so on. The value
+ The first pair of integers, ovector[0] and ovector[1], identify the
+ portion of the subject string matched by the entire pattern. The next
+ pair is used for the first capturing subpattern, and so on. The value
returned by pcre_exec() is one more than the highest numbered pair that
- has been set. For example, if two substrings have been captured, the
- returned value is 3. If there are no capturing subpatterns, the return
+ has been set. For example, if two substrings have been captured, the
+ returned value is 3. If there are no capturing subpatterns, the return
value from a successful match is 1, indicating that just the first pair
of offsets has been set.
If a capturing subpattern is matched repeatedly, it is the last portion
of the string that it matched that is returned.
- If the vector is too small to hold all the captured substring offsets,
+ If the vector is too small to hold all the captured substring offsets,
it is used as far as possible (up to two-thirds of its length), and the
- function returns a value of zero. If the substring offsets are not of
- interest, pcre_exec() may be called with ovector passed as NULL and
- ovecsize as zero. However, if the pattern contains back references and
- the ovector is not big enough to remember the related substrings, PCRE
- has to get additional memory for use during matching. Thus it is usu-
+ function returns a value of zero. If the substring offsets are not of
+ interest, pcre_exec() may be called with ovector passed as NULL and
+ ovecsize as zero. However, if the pattern contains back references and
+ the ovector is not big enough to remember the related substrings, PCRE
+ has to get additional memory for use during matching. Thus it is usu-
ally advisable to supply an ovector.
The pcre_fullinfo() function can be used to find out how many capturing
- subpatterns there are in a compiled pattern. The smallest size for
- ovector that will allow for n captured substrings, in addition to the
+ subpatterns there are in a compiled pattern. The smallest size for
+ ovector that will allow for n captured substrings, in addition to the
offsets of the substring matched by the whole pattern, is (n+1)*3.
- It is possible for capturing subpattern number n+1 to match some part
+ It is possible for capturing subpattern number n+1 to match some part
of the subject when subpattern n has not been used at all. For example,
- if the string "abc" is matched against the pattern (a|(z))(bc) the
+ if the string "abc" is matched against the pattern (a|(z))(bc) the
return from the function is 4, and subpatterns 1 and 3 are matched, but
- 2 is not. When this happens, both values in the offset pairs corre-
+ 2 is not. When this happens, both values in the offset pairs corre-
sponding to unused subpatterns are set to -1.
- Offset values that correspond to unused subpatterns at the end of the
- expression are also set to -1. For example, if the string "abc" is
- matched against the pattern (abc)(x(yz)?)? subpatterns 2 and 3 are not
- matched. The return from the function is 2, because the highest used
+ Offset values that correspond to unused subpatterns at the end of the
+ expression are also set to -1. For example, if the string "abc" is
+ matched against the pattern (abc)(x(yz)?)? subpatterns 2 and 3 are not
+ matched. The return from the function is 2, because the highest used
capturing subpattern number is 1. However, you can refer to the offsets
- for the second and third capturing subpatterns if you wish (assuming
+ for the second and third capturing subpatterns if you wish (assuming
the vector is large enough, of course).
- Some convenience functions are provided for extracting the captured
+ Some convenience functions are provided for extracting the captured
substrings as separate strings. These are described below.
Error return values from pcre_exec()
- If pcre_exec() fails, it returns a negative number. The following are
+ If pcre_exec() fails, it returns a negative number. The following are
defined in the header file:
PCRE_ERROR_NOMATCH (-1)
@@ -2285,7 +2290,7 @@ MATCHING A PATTERN: THE TRADITIONAL FUNCTION
PCRE_ERROR_NULL (-2)
- Either code or subject was passed as NULL, or ovector was NULL and
+ Either code or subject was passed as NULL, or ovector was NULL and
ovecsize was not zero.
PCRE_ERROR_BADOPTION (-3)
@@ -2294,74 +2299,74 @@ MATCHING A PATTERN: THE TRADITIONAL FUNCTION
PCRE_ERROR_BADMAGIC (-4)
- PCRE stores a 4-byte "magic number" at the start of the compiled code,
+ PCRE stores a 4-byte "magic number" at the start of the compiled code,
to catch the case when it is passed a junk pointer and to detect when a
pattern that was compiled in an environment of one endianness is run in
- an environment with the other endianness. This is the error that PCRE
+ an environment with the other endianness. This is the error that PCRE
gives when the magic number is not present.
PCRE_ERROR_UNKNOWN_OPCODE (-5)
While running the pattern match, an unknown item was encountered in the
- compiled pattern. This error could be caused by a bug in PCRE or by
+ compiled pattern. This error could be caused by a bug in PCRE or by
overwriting of the compiled pattern.
PCRE_ERROR_NOMEMORY (-6)
- If a pattern contains back references, but the ovector that is passed
+ If a pattern contains back references, but the ovector that is passed
to pcre_exec() is not big enough to remember the referenced substrings,
- PCRE gets a block of memory at the start of matching to use for this
- purpose. If the call via pcre_malloc() fails, this error is given. The
+ PCRE gets a block of memory at the start of matching to use for this
+ purpose. If the call via pcre_malloc() fails, this error is given. The
memory is automatically freed at the end of matching.
- This error is also given if pcre_stack_malloc() fails in pcre_exec().
- This can happen only when PCRE has been compiled with --disable-stack-
+ This error is also given if pcre_stack_malloc() fails in pcre_exec().
+ This can happen only when PCRE has been compiled with --disable-stack-
for-recursion.
PCRE_ERROR_NOSUBSTRING (-7)
- This error is used by the pcre_copy_substring(), pcre_get_substring(),
+ This error is used by the pcre_copy_substring(), pcre_get_substring(),
and pcre_get_substring_list() functions (see below). It is never
returned by pcre_exec().
PCRE_ERROR_MATCHLIMIT (-8)
- The backtracking limit, as specified by the match_limit field in a
- pcre_extra structure (or defaulted) was reached. See the description
+ The backtracking limit, as specified by the match_limit field in a
+ pcre_extra structure (or defaulted) was reached. See the description
above.
PCRE_ERROR_CALLOUT (-9)
This error is never generated by pcre_exec() itself. It is provided for
- use by callout functions that want to yield a distinctive error code.
+ use by callout functions that want to yield a distinctive error code.
See the pcrecallout documentation for details.
PCRE_ERROR_BADUTF8 (-10)
- A string that contains an invalid UTF-8 byte sequence was passed as a
+ A string that contains an invalid UTF-8 byte sequence was passed as a
subject.
PCRE_ERROR_BADUTF8_OFFSET (-11)
The UTF-8 byte sequence that was passed as a subject was valid, but the
- value of startoffset did not point to the beginning of a UTF-8 charac-
+ value of startoffset did not point to the beginning of a UTF-8 charac-
ter.
PCRE_ERROR_PARTIAL (-12)
- The subject string did not match, but it did match partially. See the
+ The subject string did not match, but it did match partially. See the
pcrepartial documentation for details of partial matching.
PCRE_ERROR_BADPARTIAL (-13)
- This code is no longer in use. It was formerly returned when the
- PCRE_PARTIAL option was used with a compiled pattern containing items
- that were not supported for partial matching. From release 8.00
+ This code is no longer in use. It was formerly returned when the
+ PCRE_PARTIAL option was used with a compiled pattern containing items
+ that were not supported for partial matching. From release 8.00
onwards, there are no restrictions on partial matching.
PCRE_ERROR_INTERNAL (-14)
- An unexpected internal error has occurred. This error could be caused
+ An unexpected internal error has occurred. This error could be caused
by a bug in PCRE or by overwriting of the compiled pattern.
PCRE_ERROR_BADCOUNT (-15)
@@ -2371,7 +2376,7 @@ MATCHING A PATTERN: THE TRADITIONAL FUNCTION
PCRE_ERROR_RECURSIONLIMIT (-21)
The internal recursion limit, as specified by the match_limit_recursion
- field in a pcre_extra structure (or defaulted) was reached. See the
+ field in a pcre_extra structure (or defaulted) was reached. See the
description above.
PCRE_ERROR_BADNEWLINE (-23)
@@ -2394,78 +2399,78 @@ EXTRACTING CAPTURED SUBSTRINGS BY NUMBER
int pcre_get_substring_list(const char *subject,
int *ovector, int stringcount, const char ***listptr);
- Captured substrings can be accessed directly by using the offsets
- returned by pcre_exec() in ovector. For convenience, the functions
+ Captured substrings can be accessed directly by using the offsets
+ returned by pcre_exec() in ovector. For convenience, the functions
pcre_copy_substring(), pcre_get_substring(), and pcre_get_sub-
- string_list() are provided for extracting captured substrings as new,
- separate, zero-terminated strings. These functions identify substrings
- by number. The next section describes functions for extracting named
+ string_list() are provided for extracting captured substrings as new,
+ separate, zero-terminated strings. These functions identify substrings
+ by number. The next section describes functions for extracting named
substrings.
- A substring that contains a binary zero is correctly extracted and has
- a further zero added on the end, but the result is not, of course, a C
- string. However, you can process such a string by referring to the
- length that is returned by pcre_copy_substring() and pcre_get_sub-
+ A substring that contains a binary zero is correctly extracted and has
+ a further zero added on the end, but the result is not, of course, a C
+ string. However, you can process such a string by referring to the
+ length that is returned by pcre_copy_substring() and pcre_get_sub-
string(). Unfortunately, the interface to pcre_get_substring_list() is
- not adequate for handling strings containing binary zeros, because the
+ not adequate for handling strings containing binary zeros, because the
end of the final string is not independently indicated.
- The first three arguments are the same for all three of these func-
- tions: subject is the subject string that has just been successfully
+ The first three arguments are the same for all three of these func-
+ tions: subject is the subject string that has just been successfully
matched, ovector is a pointer to the vector of integer offsets that was
passed to pcre_exec(), and stringcount is the number of substrings that
- were captured by the match, including the substring that matched the
+ were captured by the match, including the substring that matched the
entire regular expression. This is the value returned by pcre_exec() if
- it is greater than zero. If pcre_exec() returned zero, indicating that
- it ran out of space in ovector, the value passed as stringcount should
+ it is greater than zero. If pcre_exec() returned zero, indicating that
+ it ran out of space in ovector, the value passed as stringcount should
be the number of elements in the vector divided by three.
- The functions pcre_copy_substring() and pcre_get_substring() extract a
- single substring, whose number is given as stringnumber. A value of
- zero extracts the substring that matched the entire pattern, whereas
- higher values extract the captured substrings. For pcre_copy_sub-
- string(), the string is placed in buffer, whose length is given by
- buffersize, while for pcre_get_substring() a new block of memory is
- obtained via pcre_malloc, and its address is returned via stringptr.
- The yield of the function is the length of the string, not including
+ The functions pcre_copy_substring() and pcre_get_substring() extract a
+ single substring, whose number is given as stringnumber. A value of
+ zero extracts the substring that matched the entire pattern, whereas
+ higher values extract the captured substrings. For pcre_copy_sub-
+ string(), the string is placed in buffer, whose length is given by
+ buffersize, while for pcre_get_substring() a new block of memory is
+ obtained via pcre_malloc, and its address is returned via stringptr.
+ The yield of the function is the length of the string, not including
the terminating zero, or one of these error codes:
PCRE_ERROR_NOMEMORY (-6)
- The buffer was too small for pcre_copy_substring(), or the attempt to
+ The buffer was too small for pcre_copy_substring(), or the attempt to
get memory failed for pcre_get_substring().
PCRE_ERROR_NOSUBSTRING (-7)
There is no substring whose number is stringnumber.
- The pcre_get_substring_list() function extracts all available sub-
- strings and builds a list of pointers to them. All this is done in a
+ The pcre_get_substring_list() function extracts all available sub-
+ strings and builds a list of pointers to them. All this is done in a
single block of memory that is obtained via pcre_malloc. The address of
- the memory block is returned via listptr, which is also the start of
- the list of string pointers. The end of the list is marked by a NULL
- pointer. The yield of the function is zero if all went well, or the
+ the memory block is returned via listptr, which is also the start of
+ the list of string pointers. The end of the list is marked by a NULL
+ pointer. The yield of the function is zero if all went well, or the
error code
PCRE_ERROR_NOMEMORY (-6)
if the attempt to get the memory block failed.
- When any of these functions encounter a substring that is unset, which
- can happen when capturing subpattern number n+1 matches some part of
- the subject, but subpattern n has not been used at all, they return an
+ When any of these functions encounter a substring that is unset, which
+ can happen when capturing subpattern number n+1 matches some part of
+ the subject, but subpattern n has not been used at all, they return an
empty string. This can be distinguished from a genuine zero-length sub-
- string by inspecting the appropriate offset in ovector, which is nega-
+ string by inspecting the appropriate offset in ovector, which is nega-
tive for unset substrings.
- The two convenience functions pcre_free_substring() and pcre_free_sub-
- string_list() can be used to free the memory returned by a previous
+ The two convenience functions pcre_free_substring() and pcre_free_sub-
+ string_list() can be used to free the memory returned by a previous
call of pcre_get_substring() or pcre_get_substring_list(), respec-
- tively. They do nothing more than call the function pointed to by
- pcre_free, which of course could be called directly from a C program.
- However, PCRE is used in some situations where it is linked via a spe-
- cial interface to another programming language that cannot use
- pcre_free directly; it is for these cases that the functions are pro-
+ tively. They do nothing more than call the function pointed to by
+ pcre_free, which of course could be called directly from a C program.
+ However, PCRE is used in some situations where it is linked via a spe-
+ cial interface to another programming language that cannot use
+ pcre_free directly; it is for these cases that the functions are pro-
vided.
@@ -2484,7 +2489,7 @@ EXTRACTING CAPTURED SUBSTRINGS BY NAME
int stringcount, const char *stringname,
const char **stringptr);
- To extract a substring by name, you first have to find associated num-
+ To extract a substring by name, you first have to find associated num-
ber. For example, for this pattern
(a+)b(?<xxx>\d+)...
@@ -2493,35 +2498,35 @@ EXTRACTING CAPTURED SUBSTRINGS BY NAME
be unique (PCRE_DUPNAMES was not set), you can find the number from the
name by calling pcre_get_stringnumber(). The first argument is the com-
piled pattern, and the second is the name. The yield of the function is
- the subpattern number, or PCRE_ERROR_NOSUBSTRING (-7) if there is no
+ the subpattern number, or PCRE_ERROR_NOSUBSTRING (-7) if there is no
subpattern of that name.
Given the number, you can extract the substring directly, or use one of
the functions described in the previous section. For convenience, there
are also two functions that do the whole job.
- Most of the arguments of pcre_copy_named_substring() and
- pcre_get_named_substring() are the same as those for the similarly
- named functions that extract by number. As these are described in the
- previous section, they are not re-described here. There are just two
+ Most of the arguments of pcre_copy_named_substring() and
+ pcre_get_named_substring() are the same as those for the similarly
+ named functions that extract by number. As these are described in the
+ previous section, they are not re-described here. There are just two
differences:
- First, instead of a substring number, a substring name is given. Sec-
+ First, instead of a substring number, a substring name is given. Sec-
ond, there is an extra argument, given at the start, which is a pointer
- to the compiled pattern. This is needed in order to gain access to the
+ to the compiled pattern. This is needed in order to gain access to the
name-to-number translation table.
- These functions call pcre_get_stringnumber(), and if it succeeds, they
- then call pcre_copy_substring() or pcre_get_substring(), as appropri-
- ate. NOTE: If PCRE_DUPNAMES is set and there are duplicate names, the
+ These functions call pcre_get_stringnumber(), and if it succeeds, they
+ then call pcre_copy_substring() or pcre_get_substring(), as appropri-
+ ate. NOTE: If PCRE_DUPNAMES is set and there are duplicate names, the
behaviour may not be what you want (see the next section).
Warning: If the pattern uses the (?| feature to set up multiple subpat-
- terns with the same number, as described in the section on duplicate
- subpattern numbers in the pcrepattern page, you cannot use names to
- distinguish the different subpatterns, because names are not included
- in the compiled code. The matching process uses only numbers. For this
- reason, the use of different names for subpatterns of the same number
+ terns with the same number, as described in the section on duplicate
+ subpattern numbers in the pcrepattern page, you cannot use names to
+ distinguish the different subpatterns, because names are not included
+ in the compiled code. The matching process uses only numbers. For this
+ reason, the use of different names for subpatterns of the same number
causes an error at compile time.
@@ -2530,51 +2535,51 @@ DUPLICATE SUBPATTERN NAMES
int pcre_get_stringtable_entries(const pcre *code,
const char *name, char **first, char **last);
- When a pattern is compiled with the PCRE_DUPNAMES option, names for
- subpatterns are not required to be unique. (Duplicate names are always
- allowed for subpatterns with the same number, created by using the (?|
- feature. Indeed, if such subpatterns are named, they are required to
+ When a pattern is compiled with the PCRE_DUPNAMES option, names for
+ subpatterns are not required to be unique. (Duplicate names are always
+ allowed for subpatterns with the same number, created by using the (?|
+ feature. Indeed, if such subpatterns are named, they are required to
use the same names.)
Normally, patterns with duplicate names are such that in any one match,
- only one of the named subpatterns participates. An example is shown in
+ only one of the named subpatterns participates. An example is shown in
the pcrepattern documentation.
- When duplicates are present, pcre_copy_named_substring() and
- pcre_get_named_substring() return the first substring corresponding to
- the given name that is set. If none are set, PCRE_ERROR_NOSUBSTRING
- (-7) is returned; no data is returned. The pcre_get_stringnumber()
- function returns one of the numbers that are associated with the name,
+ When duplicates are present, pcre_copy_named_substring() and
+ pcre_get_named_substring() return the first substring corresponding to
+ the given name that is set. If none are set, PCRE_ERROR_NOSUBSTRING
+ (-7) is returned; no data is returned. The pcre_get_stringnumber()
+ function returns one of the numbers that are associated with the name,
but it is not defined which it is.
- If you want to get full details of all captured substrings for a given
- name, you must use the pcre_get_stringtable_entries() function. The
+ If you want to get full details of all captured substrings for a given
+ name, you must use the pcre_get_stringtable_entries() function. The
first argument is the compiled pattern, and the second is the name. The
- third and fourth are pointers to variables which are updated by the
+ third and fourth are pointers to variables which are updated by the
function. After it has run, they point to the first and last entries in
- the name-to-number table for the given name. The function itself
- returns the length of each entry, or PCRE_ERROR_NOSUBSTRING (-7) if
- there are none. The format of the table is described above in the sec-
- tion entitled Information about a pattern. Given all the relevant
- entries for the name, you can extract each of their numbers, and hence
+ the name-to-number table for the given name. The function itself
+ returns the length of each entry, or PCRE_ERROR_NOSUBSTRING (-7) if
+ there are none. The format of the table is described above in the sec-
+ tion entitled Information about a pattern. Given all the relevant
+ entries for the name, you can extract each of their numbers, and hence
the captured data, if any.
FINDING ALL POSSIBLE MATCHES
- The traditional matching function uses a similar algorithm to Perl,
+ The traditional matching function uses a similar algorithm to Perl,
which stops when it finds the first match, starting at a given point in
- the subject. If you want to find all possible matches, or the longest
- possible match, consider using the alternative matching function (see
- below) instead. If you cannot use the alternative function, but still
- need to find all possible matches, you can kludge it up by making use
+ the subject. If you want to find all possible matches, or the longest
+ possible match, consider using the alternative matching function (see
+ below) instead. If you cannot use the alternative function, but still
+ need to find all possible matches, you can kludge it up by making use
of the callout facility, which is described in the pcrecallout documen-
tation.
What you have to do is to insert a callout right at the end of the pat-
- tern. When your callout function is called, extract and save the cur-
- rent matched substring. Then return 1, which forces pcre_exec() to
- backtrack and try other alternatives. Ultimately, when it runs out of
+ tern. When your callout function is called, extract and save the cur-
+ rent matched substring. Then return 1, which forces pcre_exec() to
+ backtrack and try other alternatives. Ultimately, when it runs out of
matches, pcre_exec() will yield PCRE_ERROR_NOMATCH.
@@ -2585,26 +2590,26 @@ MATCHING A PATTERN: THE ALTERNATIVE FUNCTION
int options, int *ovector, int ovecsize,
int *workspace, int wscount);
- The function pcre_dfa_exec() is called to match a subject string
- against a compiled pattern, using a matching algorithm that scans the
- subject string just once, and does not backtrack. This has different
- characteristics to the normal algorithm, and is not compatible with
- Perl. Some of the features of PCRE patterns are not supported. Never-
- theless, there are times when this kind of matching can be useful. For
- a discussion of the two matching algorithms, and a list of features
- that pcre_dfa_exec() does not support, see the pcrematching documenta-
+ The function pcre_dfa_exec() is called to match a subject string
+ against a compiled pattern, using a matching algorithm that scans the
+ subject string just once, and does not backtrack. This has different
+ characteristics to the normal algorithm, and is not compatible with
+ Perl. Some of the features of PCRE patterns are not supported. Never-
+ theless, there are times when this kind of matching can be useful. For
+ a discussion of the two matching algorithms, and a list of features
+ that pcre_dfa_exec() does not support, see the pcrematching documenta-
tion.
- The arguments for the pcre_dfa_exec() function are the same as for
+ The arguments for the pcre_dfa_exec() function are the same as for
pcre_exec(), plus two extras. The ovector argument is used in a differ-
- ent way, and this is described below. The other common arguments are
- used in the same way as for pcre_exec(), so their description is not
+ ent way, and this is described below. The other common arguments are
+ used in the same way as for pcre_exec(), so their description is not
repeated here.
- The two additional arguments provide workspace for the function. The
- workspace vector should contain at least 20 elements. It is used for
+ The two additional arguments provide workspace for the function. The
+ workspace vector should contain at least 20 elements. It is used for
keeping track of multiple paths through the pattern tree. More
- workspace will be needed for patterns and subjects where there are a
+ workspace will be needed for patterns and subjects where there are a
lot of potential matches.
Here is an example of a simple call to pcre_dfa_exec():
@@ -2626,11 +2631,12 @@ MATCHING A PATTERN: THE ALTERNATIVE FUNCTION
Option bits for pcre_dfa_exec()
- The unused bits of the options argument for pcre_dfa_exec() must be
- zero. The only bits that may be set are PCRE_ANCHORED, PCRE_NEW-
+ The unused bits of the options argument for pcre_dfa_exec() must be
+ zero. The only bits that may be set are PCRE_ANCHORED, PCRE_NEW-
LINE_xxx, PCRE_NOTBOL, PCRE_NOTEOL, PCRE_NOTEMPTY,
- PCRE_NOTEMPTY_ATSTART, PCRE_NO_UTF8_CHECK, PCRE_PARTIAL_HARD, PCRE_PAR-
- TIAL_SOFT, PCRE_DFA_SHORTEST, and PCRE_DFA_RESTART. All but the last
+ PCRE_NOTEMPTY_ATSTART, PCRE_NO_UTF8_CHECK, PCRE_BSR_ANYCRLF,
+ PCRE_BSR_UNICODE, PCRE_NO_START_OPTIMIZE, PCRE_PARTIAL_HARD, PCRE_PAR-
+ TIAL_SOFT, PCRE_DFA_SHORTEST, and PCRE_DFA_RESTART. All but the last
four of these are exactly the same as for pcre_exec(), so their
description is not repeated here.
@@ -2753,7 +2759,7 @@ AUTHOR
REVISION
- Last updated: 01 June 2010
+ Last updated: 15 June 2010
Copyright (c) 1997-2010 University of Cambridge.
------------------------------------------------------------------------------
diff --git a/doc/pcreapi.3 b/doc/pcreapi.3
index 487f299..766a74f 100644
--- a/doc/pcreapi.3
+++ b/doc/pcreapi.3
@@ -1446,7 +1446,7 @@ There are a number of optimizations that \fBpcre_exec()\fP uses at the start of
a match, in order to speed up the process. For example, if it is known that an
unanchored match must start with a specific character, it searches the subject
for that character, and fails immediately if it cannot find it, without
-actually running the main matching function. This means that a special item
+actually running the main matching function. This means that a special item
such as (*COMMIT) at the start of a pattern is not considered until after a
suitable starting point for the match has been found. When callouts are in use,
these "start-up" optimizations can cause them to be skipped if the pattern is
diff --git a/doc/pcretest.1 b/doc/pcretest.1
index 94df0b9..7e91394 100644
--- a/doc/pcretest.1
+++ b/doc/pcretest.1
@@ -287,16 +287,16 @@ The \fB/S\fP modifier causes \fBpcre_study()\fP to be called after the
expression has been compiled, and the results used when the expression is
matched.
.P
-The \fB/T\fP modifier must be followed by a single digit. It causes a specific
-set of built-in character tables to be passed to \fBpcre_compile()\fP. It is
-used in the standard PCRE tests to check behaviour with different character
+The \fB/T\fP modifier must be followed by a single digit. It causes a specific
+set of built-in character tables to be passed to \fBpcre_compile()\fP. It is
+used in the standard PCRE tests to check behaviour with different character
tables. The digit specifies the tables as follows:
.sp
- 0 the default ASCII tables, as distributed in
+ 0 the default ASCII tables, as distributed in
pcre_chartables.c.dist
1 a set of tables defining ISO 8859 characters
.sp
-In table 1, some characters whose codes are greater than 128 are identified as
+In table 1, some characters whose codes are greater than 128 are identified as
letters, digits, spaces, etc.
.
.
diff --git a/doc/pcretest.txt b/doc/pcretest.txt
index 3fdf7c5..ad362cb 100644
--- a/doc/pcretest.txt
+++ b/doc/pcretest.txt
@@ -260,9 +260,9 @@ PATTERN MODIFIERS
For this reason, it must be the last modifier. The given locale is set,
pcre_maketables() is called to build a set of character tables for the
locale, and this is then passed to pcre_compile() when compiling the
- regular expression. Without an /L modifier, NULL is passed as the
- tables pointer; that is, /L applies only to the expression on which it
- appears.
+ regular expression. Without an /L (or /T) modifier, NULL is passed as
+ the tables pointer; that is, /L applies only to the expression on which
+ it appears.
The /M modifier causes the size of memory block used to hold the com-
piled pattern to be output.
@@ -270,6 +270,18 @@ PATTERN MODIFIERS
The /S modifier causes pcre_study() to be called after the expression
has been compiled, and the results used when the expression is matched.
+ The /T modifier must be followed by a single digit. It causes a spe-
+ cific set of built-in character tables to be passed to pcre_compile().
+ It is used in the standard PCRE tests to check behaviour with different
+ character tables. The digit specifies the tables as follows:
+
+ 0 the default ASCII tables, as distributed in
+ pcre_chartables.c.dist
+ 1 a set of tables defining ISO 8859 characters
+
+ In table 1, some characters whose codes are greater than 128 are iden-
+ tified as letters, digits, spaces, etc.
+
Using the POSIX wrapper API
The /P modifier causes pcretest to call PCRE via the POSIX wrapper API
@@ -680,5 +692,5 @@ AUTHOR
REVISION
- Last updated: 16 May 2010
+ Last updated: 14 June 2010
Copyright (c) 1997-2010 University of Cambridge.
diff --git a/pcre_compile.c b/pcre_compile.c
index eab5991..f1dc714 100644
--- a/pcre_compile.c
+++ b/pcre_compile.c
@@ -1130,9 +1130,9 @@ dealing with. The very first call may not start with a parenthesis. */
if (ptr[0] == CHAR_LEFT_PARENTHESIS)
{
/* Handle specials such as (*SKIP) or (*UTF8) etc. */
-
+
if (ptr[1] == CHAR_ASTERISK) ptr += 2;
-
+
/* Handle a normal, unnamed capturing parenthesis. */
else if (ptr[1] != CHAR_QUESTION_MARK)
@@ -1150,14 +1150,14 @@ if (ptr[0] == CHAR_LEFT_PARENTHESIS)
ptr += 3;
dup_parens = TRUE;
}
-
+
/* Handle comments; all characters are allowed until a ket is reached. */
else if (ptr[2] == CHAR_NUMBER_SIGN)
{
for (ptr += 3; *ptr != 0; ptr++) if (*ptr == CHAR_RIGHT_PARENTHESIS) break;
goto FAIL_EXIT;
- }
+ }
/* Handle a condition. If it is an assertion, just carry on so that it
is processed as normal. If not, skip to the closing parenthesis of the
@@ -1295,7 +1295,7 @@ for (; *ptr != 0; ptr++)
else if (*ptr == CHAR_RIGHT_PARENTHESIS)
{
if (dup_parens && *count < hwm_count) *count = hwm_count;
- goto FAIL_EXIT;
+ goto FAIL_EXIT;
}
else if (*ptr == CHAR_VERTICAL_LINE && dup_parens)
diff --git a/pcre_dfa_exec.c b/pcre_dfa_exec.c
index 09677aa..e55d968 100644
--- a/pcre_dfa_exec.c
+++ b/pcre_dfa_exec.c
@@ -3109,14 +3109,14 @@ for (;;)
while (current_subject < end_subject)
{
register unsigned int c = *current_subject;
- if ((start_bits[c/8] & (1 << (c&7))) == 0)
+ if ((start_bits[c/8] & (1 << (c&7))) == 0)
{
current_subject++;
#ifdef SUPPORT_UTF8
if (utf8)
- while(current_subject < end_subject &&
+ while(current_subject < end_subject &&
(*current_subject & 0xc0) == 0x80) current_subject++;
-#endif
+#endif
}
else break;
}
diff --git a/pcre_exec.c b/pcre_exec.c
index 8b5bae2..8029bef 100644
--- a/pcre_exec.c
+++ b/pcre_exec.c
@@ -5959,14 +5959,14 @@ for(;;)
while (start_match < end_subject)
{
register unsigned int c = *start_match;
- if ((start_bits[c/8] & (1 << (c&7))) == 0)
+ if ((start_bits[c/8] & (1 << (c&7))) == 0)
{
start_match++;
#ifdef SUPPORT_UTF8
if (utf8)
while(start_match < end_subject && (*start_match & 0xc0) == 0x80)
start_match++;
-#endif
+#endif
}
else break;
}
@@ -6069,22 +6069,22 @@ for(;;)
switch(rc)
{
- /* SKIP passes back the next starting point explicitly, but if it is the
+ /* SKIP passes back the next starting point explicitly, but if it is the
same as the match we have just done, treat it as NOMATCH. */
case MATCH_SKIP:
if (md->start_match_ptr != start_match)
- {
+ {
new_start_match = md->start_match_ptr;
break;
}
/* Fall through */
-
+
/* If MATCH_SKIP_ARG reaches this level it means that a MARK that matched
the SKIP's arg was not found. We also treat this as NOMATCH. */
-
+
case MATCH_SKIP_ARG:
- /* Fall through */
+ /* Fall through */
/* NOMATCH and PRUNE advance by one character. THEN at this level acts
exactly like PRUNE. */
diff --git a/pcre_study.c b/pcre_study.c
index 71d2526..f5e0c3a 100644
--- a/pcre_study.c
+++ b/pcre_study.c
@@ -504,7 +504,7 @@ Arguments:
start_bits the starting bitmap
cbit type the type of character wanted
table_limit 32 for non-UTF-8; 16 for UTF-8
- cd the block with char table pointers
+ cd the block with char table pointers
Returns: nothing
*/
@@ -513,7 +513,7 @@ static void
set_type_bits(uschar *start_bits, int cbit_type, int table_limit,
compile_data *cd)
{
-register int c;
+register int c;
for (c = 0; c < table_limit; c++) start_bits[c] |= cd->cbits[c+cbit_type];
if (table_limit == 32) return;
for (c = 128; c < 256; c++)
@@ -522,9 +522,9 @@ for (c = 128; c < 256; c++)
{
uschar buff[8];
(void)_pcre_ord2utf8(c, buff);
- SET_BIT(buff[0]);
- }
- }
+ SET_BIT(buff[0]);
+ }
+ }
}
@@ -535,16 +535,16 @@ for (c = 128; c < 256; c++)
/* This function sets starting bits for a negative character type such as \D.
In UTF-8 mode, we can only do a direct setting for bytes less than 128, as
otherwise there can be confusion with bytes in the middle of UTF-8 characters.
-Unlike in the positive case, where we can set appropriate starting bits for
+Unlike in the positive case, where we can set appropriate starting bits for
specific high-valued UTF-8 characters, in this case we have to set the bits for
-all high-valued characters. The lowest is 0xc2, but we overkill by starting at
+all high-valued characters. The lowest is 0xc2, but we overkill by starting at
0xc0 (192) for simplicity.
Arguments:
start_bits the starting bitmap
cbit type the type of character wanted
table_limit 32 for non-UTF-8; 16 for UTF-8
- cd the block with char table pointers
+ cd the block with char table pointers
Returns: nothing
*/
@@ -553,7 +553,7 @@ static void
set_nottype_bits(uschar *start_bits, int cbit_type, int table_limit,
compile_data *cd)
{
-register int c;
+register int c;
for (c = 0; c < table_limit; c++) start_bits[c] |= ~cd->cbits[c+cbit_type];
if (table_limit != 32) for (c = 24; c < 32; c++) start_bits[c] = 0xff;
}
@@ -750,7 +750,7 @@ do
SET_BIT(0x20);
if (utf8)
{
- SET_BIT(0xC2); /* For U+00A0 */
+ SET_BIT(0xC2); /* For U+00A0 */
SET_BIT(0xE1); /* For U+1680, U+180E */
SET_BIT(0xE2); /* For U+2000 - U+200A, U+202F, U+205F */
SET_BIT(0xE3); /* For U+3000 */
@@ -765,18 +765,18 @@ do
SET_BIT(0x0B);
SET_BIT(0x0C);
SET_BIT(0x0D);
- if (utf8)
- {
- SET_BIT(0xC2); /* For U+0085 */
+ if (utf8)
+ {
+ SET_BIT(0xC2); /* For U+0085 */
SET_BIT(0xE2); /* For U+2028, U+2029 */
- }
+ }
else SET_BIT(0x85);
try_next = FALSE;
break;
/* Single character types set the bits and stop. Note that if PCRE_UCP
is set, we do not see these op codes because \d etc are converted to
- properties. Therefore, these apply in the case when only characters less
+ properties. Therefore, these apply in the case when only characters less
than 256 are recognized to match the types. */
case OP_NOT_DIGIT:
@@ -817,7 +817,7 @@ do
set_type_bits(start_bits, cbit_word, table_limit, cd);
try_next = FALSE;
break;
-
+
/* One or more character type fudges the pointer and restarts, knowing
it will hit a single character type and stop there. */
@@ -857,7 +857,7 @@ do
SET_BIT(0x20);
if (utf8)
{
- SET_BIT(0xC2); /* For U+00A0 */
+ SET_BIT(0xC2); /* For U+00A0 */
SET_BIT(0xE1); /* For U+1680, U+180E */
SET_BIT(0xE2); /* For U+2000 - U+200A, U+202F, U+205F */
SET_BIT(0xE3); /* For U+3000 */
@@ -871,11 +871,11 @@ do
SET_BIT(0x0B);
SET_BIT(0x0C);
SET_BIT(0x0D);
- if (utf8)
+ if (utf8)
{
- SET_BIT(0xC2); /* For U+0085 */
+ SET_BIT(0xC2); /* For U+0085 */
SET_BIT(0xE2); /* For U+2028, U+2029 */
- }
+ }
else SET_BIT(0x85);
break;
@@ -892,7 +892,7 @@ do
case OP_NOT_WHITESPACE:
set_nottype_bits(start_bits, cbit_space, table_limit, cd);
- start_bits[1] |= 0x08;
+ start_bits[1] |= 0x08;
break;
/* The cbit_space table has vertical tab as whitespace; we have to
diff --git a/pcreposix.c b/pcreposix.c
index 090e6c8..c5f3d71 100644
--- a/pcreposix.c
+++ b/pcreposix.c
@@ -57,9 +57,9 @@ previously been set. */
# define PCREPOSIX_EXP_DEFN __declspec(dllexport)
#endif
-/* We include pcre.h before pcre_internal.h so that the PCRE library functions
+/* We include pcre.h before pcre_internal.h so that the PCRE library functions
are declared as "import" for Windows by defining PCRE_EXP_DECL as "import".
-This is needed even though pcre_internal.h itself includes pcre.h, because it
+This is needed even though pcre_internal.h itself includes pcre.h, because it
does so after it has set PCRE_EXP_DECL to "export" if it is not already set. */
#include "pcre.h"
diff --git a/pcretest.c b/pcretest.c
index 4d3b000..ffd963f 100644
--- a/pcretest.c
+++ b/pcretest.c
@@ -194,12 +194,12 @@ static uschar *pbuffer = NULL;
* Alternate character tables *
*************************************************/
-/* By default, the "tables" pointer when calling PCRE is set to NULL, thereby
-using the default tables of the library. However, the T option can be used to
-select alternate sets of tables, for different kinds of testing. Note also that
+/* By default, the "tables" pointer when calling PCRE is set to NULL, thereby
+using the default tables of the library. However, the T option can be used to
+select alternate sets of tables, for different kinds of testing. Note also that
the L (locale) option also adjusts the tables. */
-/* This is the set of tables distributed as default with PCRE. It recognizes
+/* This is the set of tables distributed as default with PCRE. It recognizes
only ASCII characters. */
static const unsigned char tables0[] = {
@@ -371,8 +371,8 @@ graph, print, punct, and cntrl. Other classes are built from combinations. */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 240-247 */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};/* 248-255 */
-/* This is a set of tables that came orginally from a Windows user. It seems to
-be at least an approximation of ISO 8859. In particular, there are characters
+/* This is a set of tables that came orginally from a Windows user. It seems to
+be at least an approximation of ISO 8859. In particular, there are characters
greater than 128 that are marked as spaces, letters, etc. */
static const unsigned char tables1[] = {
@@ -1567,25 +1567,25 @@ while (!done)
case 'Z': debug_lengths = 0; break;
case '8': options |= PCRE_UTF8; use_utf8 = 1; break;
case '?': options |= PCRE_NO_UTF8_CHECK; break;
-
+
case 'T':
switch (*pp++)
{
case '0': tables = tables0; break;
case '1': tables = tables1; break;
-
+
case '\r':
case '\n':
- case ' ':
- case 0:
+ case ' ':
+ case 0:
fprintf(outfile, "** Missing table number after /T\n");
- goto SKIP_DATA;
-
- default:
+ goto SKIP_DATA;
+
+ default:
fprintf(outfile, "** Bad table number \"%c\" after /T\n", pp[-1]);
- goto SKIP_DATA;
+ goto SKIP_DATA;
}
- break;
+ break;
case 'L':
ppp = pp;
@@ -2081,12 +2081,12 @@ while (!done)
new_free(re);
if (extra != NULL) new_free(extra);
- if (locale_set)
+ if (locale_set)
{
new_free((void *)tables);
setlocale(LC_CTYPE, "C");
- locale_set = 0;
- }
+ locale_set = 0;
+ }
continue; /* With next regex */
}
} /* End of non-POSIX compile */
@@ -2137,9 +2137,9 @@ while (!done)
{
if (len > 0) /* Reached EOF without hitting a newline */
{
- fprintf(outfile, "\n");
+ fprintf(outfile, "\n");
break;
- }
+ }
done = 1;
goto CONTINUE;
}
@@ -2434,7 +2434,7 @@ while (!done)
}
*q = 0;
len = (int)(q - dbuffer);
-
+
/* Move the data to the end of the buffer so that a read over the end of
the buffer will be seen by valgrind, even if it doesn't cause a crash. If
we are using the POSIX interface, we must include the terminating zero. */