[Pcre-svn] [1287] code/trunk: Document SKIP looks only for M…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [1287] code/trunk: Document SKIP looks only for MARK: add tests to confirm.
Revision: 1287
          http://vcs.pcre.org/viewvc?view=rev&revision=1287
Author:   ph10
Date:     2013-03-15 15:54:54 +0000 (Fri, 15 Mar 2013)


Log Message:
-----------
Document SKIP looks only for MARK: add tests to confirm.

Modified Paths:
--------------
    code/trunk/doc/pcrepattern.3
    code/trunk/testdata/testinput1
    code/trunk/testdata/testoutput1


Modified: code/trunk/doc/pcrepattern.3
===================================================================
--- code/trunk/doc/pcrepattern.3    2013-03-15 14:58:48 UTC (rev 1286)
+++ code/trunk/doc/pcrepattern.3    2013-03-15 15:54:54 UTC (rev 1287)
@@ -1,4 +1,4 @@
-.TH PCREPATTERN 3 "03 March 2013" "PCRE 8.33"
+.TH PCREPATTERN 3 "15 March 2013" "PCRE 8.33"
 .SH NAME
 PCRE - Perl-compatible regular expressions
 .SH "PCRE REGULAR EXPRESSION DETAILS"
@@ -2769,8 +2769,9 @@
 A name is always required with this verb. There may be as many instances of
 (*MARK) as you like in a pattern, and their names do not have to be unique.
 .P
-When a match succeeds, the name of the last-encountered (*MARK) on the matching
-path is passed back to the caller as described in the section entitled
+When a match succeeds, the name of the last-encountered (*MARK:NAME),
+(*PRUNE:NAME), or (*THEN:NAME) on the matching path is passed back to the
+caller as described in the section entitled
 .\" HTML <a href="pcreapi.html#extradata">
 .\" </a>
 "Extra data for \fBpcre_exec()\fP"
@@ -2795,12 +2796,12 @@
 of obtaining this information than putting each alternative in its own
 capturing parentheses.
 .P
-If (*MARK) is encountered in a positive assertion, its name is recorded and
-passed back if it is the last-encountered. This does not happen for negative
-assertions.
+If a verb with a name is encountered in a positive assertion, its name is
+recorded and passed back if it is the last-encountered. This does not happen
+for negative assertions.
 .P
-After a partial match or a failed match, the name of the last encountered
-(*MARK) in the entire match process is returned. For example:
+After a partial match or a failed match, the last encountered name in the
+entire match process is returned. For example:
 .sp
     re> /X(*MARK:A)Y|X(*MARK:B)Z/K
   data> XP
@@ -2876,8 +2877,11 @@
 the right, backtracking cannot cross (*PRUNE). In simple cases, the use of
 (*PRUNE) is just an alternative to an atomic group or possessive quantifier,
 but there are some uses of (*PRUNE) that cannot be expressed in any other way.
-The behaviour of (*PRUNE:NAME) is the same as (*MARK:NAME)(*PRUNE). In an
-anchored pattern (*PRUNE) has the same effect as (*COMMIT).
+In an anchored pattern (*PRUNE) has the same effect as (*COMMIT).
+.P
+The behaviour of (*PRUNE:NAME) is the not the same as (*MARK:NAME)(*PRUNE). 
+It is like (*MARK:NAME) in that the name is remembered for passing back to the
+caller. However, (*SKIP:NAME) searches only for names set with (*MARK).
 .sp
   (*SKIP)
 .sp
@@ -2904,6 +2908,9 @@
 the "bumpalong" advance is to the subject position that corresponds to that
 (*MARK) instead of to where (*SKIP) was encountered. If no (*MARK) with a
 matching name is found, the (*SKIP) is ignored.
+.P
+Note that (*SKIP:NAME) searches only for names set by (*MARK:NAME). It ignores 
+names that are set by (*PRUNE:NAME) or (*THEN:NAME).
 .sp
   (*THEN) or (*THEN:NAME)
 .sp
@@ -2916,10 +2923,13 @@
 .sp
 If the COND1 pattern matches, FOO is tried (and possibly further items after
 the end of the group if FOO succeeds); on failure, the matcher skips to the
-second alternative and tries COND2, without backtracking into COND1. The
-behaviour of (*THEN:NAME) is exactly the same as (*MARK:NAME)(*THEN).
+second alternative and tries COND2, without backtracking into COND1.
 If (*THEN) is not inside an alternation, it acts like (*PRUNE).
 .P
+The behaviour of (*THEN:NAME) is the not the same as (*MARK:NAME)(*THEN). 
+It is like (*MARK:NAME) in that the name is remembered for passing back to the
+caller. However, (*SKIP:NAME) searches only for names set with (*MARK).
+.P
 Note that a subpattern that does not contain a | character is just a part of
 the enclosing alternative; it is not a nested alternation with only one
 alternative. The effect of (*THEN) extends beyond such a subpattern to the
@@ -2996,6 +3006,6 @@
 .rs
 .sp
 .nf
-Last updated: 03 March 2013
+Last updated: 15 March 2013
 Copyright (c) 1997-2013 University of Cambridge.
 .fi


Modified: code/trunk/testdata/testinput1
===================================================================
--- code/trunk/testdata/testinput1    2013-03-15 14:58:48 UTC (rev 1286)
+++ code/trunk/testdata/testinput1    2013-03-15 15:54:54 UTC (rev 1287)
@@ -5412,6 +5412,8 @@


 /aaaaa(*COMMIT)(*THEN)b|a+c/
     aaaaaac
+    
+/-- End of "priority" tests --/ 


 /aaaaa(*:m)(*PRUNE:m)(*SKIP:m)m|a+/
     aaaaaa
@@ -5425,4 +5427,16 @@
 /aaaaa(*:n)(*MARK:m)(*PRUNE)(*SKIP:m)m|a+/
     aaaaaa


+/a(*MARK:A)aa(*PRUNE:A)a(*SKIP:A)b|a+c/
+    aaaac
+
+/a(*MARK:A)aa(*MARK:A)a(*SKIP:A)b|a+c/
+    aaaac
+
+/aaa(*PRUNE:A)a(*SKIP:A)b|a+c/
+    aaaac
+
+/aaa(*MARK:A)a(*SKIP:A)b|a+c/
+    aaaac
+
 /-- End of testinput1 --/


Modified: code/trunk/testdata/testoutput1
===================================================================
--- code/trunk/testdata/testoutput1    2013-03-15 14:58:48 UTC (rev 1286)
+++ code/trunk/testdata/testoutput1    2013-03-15 15:54:54 UTC (rev 1287)
@@ -8928,6 +8928,8 @@
 /aaaaa(*COMMIT)(*THEN)b|a+c/
     aaaaaac
  0: aaaaaac
+    
+/-- End of "priority" tests --/ 


 /aaaaa(*:m)(*PRUNE:m)(*SKIP:m)m|a+/
     aaaaaa
@@ -8945,4 +8947,20 @@
     aaaaaa
  0: a


+/a(*MARK:A)aa(*PRUNE:A)a(*SKIP:A)b|a+c/
+    aaaac
+ 0: aac
+
+/a(*MARK:A)aa(*MARK:A)a(*SKIP:A)b|a+c/
+    aaaac
+ 0: ac
+
+/aaa(*PRUNE:A)a(*SKIP:A)b|a+c/
+    aaaac
+ 0: aac
+
+/aaa(*MARK:A)a(*SKIP:A)b|a+c/
+    aaaac
+ 0: ac
+
 /-- End of testinput1 --/