Documentation update

This commit is contained in:
Philip.Hazel 2017-04-03 18:01:07 +00:00
parent 7be3fef0ea
commit 7c32d955a1
1 changed files with 346 additions and 333 deletions

View File

@ -4112,8 +4112,8 @@ DIFFERENCES BETWEEN PCRE2 AND PERL
3. Capturing subpatterns that occur inside negative lookaround asser-
tions are counted, but their entries in the offsets vector are set only
if the assertion is a condition. Perl has changed its behaviour in this
regard from time to time.
when a negative assertion is a condition that has a matching branch
(that is, the condition is false).
4. The following Perl escape sequences are not supported: \l, \u, \L,
\U, and \N when followed by a character name or Unicode value. (\N on
@ -4266,7 +4266,7 @@ AUTHOR
REVISION
Last updated: 29 March 2017
Last updated: 03 April 2017
Copyright (c) 1997-2017 University of Cambridge.
------------------------------------------------------------------------------
@ -7319,16 +7319,26 @@ ASSERTIONS
More complicated assertions are coded as subpatterns. There are two
kinds: those that look ahead of the current position in the subject
string, and those that look behind it. An assertion subpattern is
matched in the normal way, except that it does not cause the current
matching position to be changed.
string, and those that look behind it, and in each case an assertion
may be positive (must succeed for matching to continue) or negative
(must not succeed for matching to continue). An assertion subpattern is
matched in the normal way, except that, when matching continues after-
wards, the matching position in the subject string is as it was at the
start of the assertion.
Assertion subpatterns are not capturing subpatterns. If such an asser-
tion contains capturing subpatterns within it, these are counted for
the purposes of numbering the capturing subpatterns in the whole pat-
tern. However, substring capturing is normally carried out only for
positive assertions (but see the discussion of conditional subpatterns
below).
Assertion subpatterns are not capturing subpatterns. If an assertion
contains capturing subpatterns within it, these are counted for the
purposes of numbering the capturing subpatterns in the whole pattern.
However, substring capturing is carried out only for positive asser-
tions that succeed, that is, one of their branches matches, so matching
continues after the assertion. If all branches of a positive assertion
fail to match, nothing is captured, and control is passed to the previ-
ous backtracking point.
No capturing is done for a negative assertion unless it is being used
as a condition in a conditional subpattern (see the discussion below).
Matching continues after a non-conditional negative assertion only if
all its branches fail to match.
For compatibility with Perl, most assertion subpatterns may be
repeated; though it makes no sense to assert the same thing several
@ -7677,11 +7687,12 @@ CONDITIONAL SUBPATTERNS
strings in one of the two forms dd-aaa-dd or dd-dd-dd, where aaa are
letters and dd are digits.
For Perl compatibility, if an assertion that is a condition contains
capturing subpatterns, any capturing that occurs is retained after-
wards, for both positive and negative assertions. (Compare non-condi-
tional assertions, when captures are retained only for positive asser-
tions.)
When an assertion that is a condition contains capturing subpatterns,
any capturing that occurs in a matching branch is retained afterwards,
for both positive and negative assertions, because matching always con-
tinues after the assertion, whether it succeeds or fails. (Compare non-
conditional assertions, when captures are retained only for positive
assertions that succeed.)
COMMENTS
@ -8393,26 +8404,31 @@ BACKTRACKING CONTROL
Backtracking verbs in assertions
(*FAIL) in an assertion has its normal effect: it forces an immediate
backtrack.
(*FAIL) in any assertion has its normal effect: it forces an immediate
backtrack. The behaviour of the other backtracking verbs depends on
whether or not the assertion is standalone or acting as the condition
in a conditional subpattern.
(*ACCEPT) in a positive assertion causes the assertion to succeed with-
out any further processing. In a negative assertion, (*ACCEPT) causes
the assertion to fail without any further processing.
(*ACCEPT) in a standalone positive assertion causes the assertion to
succeed without any further processing; captured strings are retained.
In a standalone negative assertion, (*ACCEPT) causes the assertion to
fail without any further processing; captured substrings are discarded.
If the assertion is a condition, (*ACCEPT) causes the condition to be
true for a positive assertion and false for a negative one; captured
substrings are retained in both cases.
The effect of (*THEN) is not allowed to escape beyond an assertion. If
there are no more branches to try, (*THEN) causes a positive assertion
to be false, and a negative assertion to be true.
The other backtracking verbs are not treated specially if they appear
in a positive assertion. In particular, (*THEN) skips to the next
alternative in the innermost enclosing group that has alternations,
whether or not this is within the assertion.
Negative assertions are, however, different, in order to ensure that
changing a positive assertion into a negative assertion changes its
result. Backtracking into (*COMMIT), (*SKIP), or (*PRUNE) causes a neg-
ative assertion to be true, without considering any further alternative
branches in the assertion. Backtracking into (*THEN) causes it to skip
to the next enclosing alternative within the assertion (the normal be-
haviour), but if the assertion does not have such an alternative,
(*THEN) behaves like (*PRUNE).
in a standalone positive assertion. In a conditional positive asser-
tion, backtracking into (*COMMIT), (*SKIP), or (*PRUNE) causes the con-
dition to be false. However, for both standalone and conditional nega-
tive assertions, backtracking into (*COMMIT), (*SKIP), or (*PRUNE)
causes the assertion to be true, without considering any further alter-
native branches.
Backtracking verbs in subroutines
@ -8449,7 +8465,7 @@ AUTHOR
REVISION
Last updated: 18 March 2017
Last updated: 03 April 2017
Copyright (c) 1997-2017 University of Cambridge.
------------------------------------------------------------------------------
@ -9225,9 +9241,6 @@ REVISION
------------------------------------------------------------------------------
------------------------------------------------------------------------------
PCRE2SYNTAX(3) Library Functions Manual PCRE2SYNTAX(3)