Revision: 647
http://vcs.pcre.org/viewvc?view=rev&revision=647
Author: ph10
Date: 2011-08-01 11:22:59 +0100 (Mon, 01 Aug 2011)
Log Message:
-----------
Add tests for *MARK in callouts, and update pcretest documentation.
Modified Paths:
--------------
code/trunk/doc/pcretest.1
code/trunk/testdata/testinput2
code/trunk/testdata/testoutput2
Modified: code/trunk/doc/pcretest.1
===================================================================
--- code/trunk/doc/pcretest.1 2011-08-01 09:54:26 UTC (rev 646)
+++ code/trunk/doc/pcretest.1 2011-08-01 10:22:59 UTC (rev 647)
@@ -714,9 +714,27 @@
+10 ^ ^
0: E*
.sp
+If a pattern contains (*MARK) items, an additional line is output whenever
+a change of latest mark is passed to the callout function. For example:
+.sp
+ re> /a(*MARK:X)bc/C
+ data> abc
+ --->abc
+ +0 ^ a
+ +1 ^^ (*MARK:X)
+ +10 ^^ b
+ Latest Mark: X
+ +11 ^ ^ c
+ +12 ^ ^
+ 0: abc
+.sp
+The mark changes between matching "a" and "b", but stays the same for the rest
+of the match, so nothing more is output. If, as a result of backtracking, the
+mark reverts to being unset, the text "<unset>" is output.
+.P
The callout function in \fBpcretest\fP returns zero (carry on matching) by
default, but you can use a \eC item in a data line (as described above) to
-change this.
+change this and other parameters of the callout.
.P
Inserting callouts can be helpful when using \fBpcretest\fP to check
complicated regular expressions. For further information about callouts, see
@@ -823,6 +841,6 @@
.rs
.sp
.nf
-Last updated: 20 July 2011
+Last updated: 01 August 2011
Copyright (c) 1997-2011 University of Cambridge.
.fi
Modified: code/trunk/testdata/testinput2
===================================================================
--- code/trunk/testdata/testinput2 2011-08-01 09:54:26 UTC (rev 646)
+++ code/trunk/testdata/testinput2 2011-08-01 10:22:59 UTC (rev 647)
@@ -3829,4 +3829,9 @@
/(a+|(?R)b)/
+/^(a(*:A)(d|e(*:B))z|aeq)/C
+ adz
+ aez
+ aeqwerty
+
/-- End of testinput2 --/
Modified: code/trunk/testdata/testoutput2
===================================================================
--- code/trunk/testdata/testoutput2 2011-08-01 09:54:26 UTC (rev 646)
+++ code/trunk/testdata/testoutput2 2011-08-01 10:22:59 UTC (rev 647)
@@ -12154,4 +12154,63 @@
/(a+|(?R)b)/
Failed: recursive call could loop indefinitely at offset 7
+/^(a(*:A)(d|e(*:B))z|aeq)/C
+ adz
+--->adz
+ +0 ^ ^
+ +1 ^ (a(*:A)(d|e(*:B))z|aeq)
+ +2 ^ a
+ +3 ^^ (*:A)
+ +8 ^^ (d|e(*:B))
+Latest Mark: A
+ +9 ^^ d
++10 ^ ^ |
++18 ^ ^ z
++19 ^ ^ |
++24 ^ ^
+ 0: adz
+ 1: adz
+ 2: d
+ aez
+--->aez
+ +0 ^ ^
+ +1 ^ (a(*:A)(d|e(*:B))z|aeq)
+ +2 ^ a
+ +3 ^^ (*:A)
+ +8 ^^ (d|e(*:B))
+Latest Mark: A
+ +9 ^^ d
++11 ^^ e
++12 ^ ^ (*:B)
++17 ^ ^ )
+Latest Mark: B
++18 ^ ^ z
++19 ^ ^ |
++24 ^ ^
+ 0: aez
+ 1: aez
+ 2: e
+ aeqwerty
+--->aeqwerty
+ +0 ^ ^
+ +1 ^ (a(*:A)(d|e(*:B))z|aeq)
+ +2 ^ a
+ +3 ^^ (*:A)
+ +8 ^^ (d|e(*:B))
+Latest Mark: A
+ +9 ^^ d
++11 ^^ e
++12 ^ ^ (*:B)
++17 ^ ^ )
+Latest Mark: B
++18 ^ ^ z
++20 ^ a
+Latest Mark: <unset>
++21 ^^ e
++22 ^ ^ q
++23 ^ ^ )
++24 ^ ^
+ 0: aeq
+ 1: aeq
+
/-- End of testinput2 --/