Revision: 545
http://www.exim.org/viewvc/pcre2?view=rev&revision=545
Author: ph10
Date: 2016-07-06 16:02:24 +0100 (Wed, 06 Jul 2016)
Log Message:
-----------
Ignore "allcaptures" after DFA matching.
Modified Paths:
--------------
code/trunk/ChangeLog
code/trunk/doc/pcre2test.1
code/trunk/src/pcre2test.c
code/trunk/testdata/testinput6
code/trunk/testdata/testoutput6
Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog 2016-07-06 08:42:50 UTC (rev 544)
+++ code/trunk/ChangeLog 2016-07-06 15:02:24 UTC (rev 545)
@@ -170,7 +170,9 @@
43. Detect integer overflow in pcre2test pattern and data repetition counts.
+44. In pcre2test, ignore "allcaptures" after DFA matching.
+
Version 10.21 12-January-2016
-----------------------------
Modified: code/trunk/doc/pcre2test.1
===================================================================
--- code/trunk/doc/pcre2test.1 2016-07-06 08:42:50 UTC (rev 544)
+++ code/trunk/doc/pcre2test.1 2016-07-06 15:02:24 UTC (rev 545)
@@ -1,4 +1,4 @@
-.TH PCRE2TEST 1 "17 June 2016" "PCRE 10.22"
+.TH PCRE2TEST 1 "06 July 2016" "PCRE 10.22"
.SH NAME
pcre2test - a program for testing Perl-compatible regular expressions.
.SH SYNOPSIS
@@ -1055,7 +1055,8 @@
captured parentheses be output after a match. By default, only those up to the
highest one actually used in the match are output (corresponding to the return
code from \fBpcre2_match()\fP). Groups that did not take part in the match
-are output as "<unset>".
+are output as "<unset>". This modifier is not relevant for DFA matching (which
+does no capturing); it is ignored, with a warning message, if present.
.
.
.SS "Testing callouts"
@@ -1681,6 +1682,6 @@
.rs
.sp
.nf
-Last updated: 17 June 2016
+Last updated: 06 July 2016
Copyright (c) 1997-2016 University of Cambridge.
.fi
Modified: code/trunk/src/pcre2test.c
===================================================================
--- code/trunk/src/pcre2test.c 2016-07-06 08:42:50 UTC (rev 544)
+++ code/trunk/src/pcre2test.c 2016-07-06 15:02:24 UTC (rev 545)
@@ -6436,15 +6436,23 @@
/* "allcaptures" requests showing of all captures in the pattern, to check
unset ones at the end. It may be set on the pattern or the data. Implement
- by setting capcount to the maximum. */
+ by setting capcount to the maximum. This is not relevant for DFA matching,
+ so ignore it. */
if ((dat_datctl.control & CTL_ALLCAPTURES) != 0)
{
uint32_t maxcapcount;
- if (pattern_info(PCRE2_INFO_CAPTURECOUNT, &maxcapcount, FALSE) < 0)
- return PR_SKIP;
- capcount = maxcapcount + 1; /* Allow for full match */
- if (capcount > (int)oveccount) capcount = oveccount;
+ if ((dat_datctl.control & CTL_DFA) != 0)
+ {
+ fprintf(outfile, "** Ignored after DFA matching: allcaptures\n");
+ }
+ else
+ {
+ if (pattern_info(PCRE2_INFO_CAPTURECOUNT, &maxcapcount, FALSE) < 0)
+ return PR_SKIP;
+ capcount = maxcapcount + 1; /* Allow for full match */
+ if (capcount > (int)oveccount) capcount = oveccount;
+ }
}
/* Output the captured substrings. Note that, for the matched string,
Modified: code/trunk/testdata/testinput6
===================================================================
--- code/trunk/testdata/testinput6 2016-07-06 08:42:50 UTC (rev 544)
+++ code/trunk/testdata/testinput6 2016-07-06 15:02:24 UTC (rev 545)
@@ -4878,4 +4878,8 @@
/abcd/null_context
abcd\=null_context
+/()()a+/no_auto_possess
+ aaa\=dfa,allcaptures
+ a\=dfa,allcaptures
+
# End of testinput6
Modified: code/trunk/testdata/testoutput6
===================================================================
--- code/trunk/testdata/testoutput6 2016-07-06 08:42:50 UTC (rev 544)
+++ code/trunk/testdata/testoutput6 2016-07-06 15:02:24 UTC (rev 545)
@@ -7672,4 +7672,14 @@
abcd\=null_context
0: abcd
+/()()a+/no_auto_possess
+ aaa\=dfa,allcaptures
+** Ignored after DFA matching: allcaptures
+ 0: aaa
+ 1: aa
+ 2: a
+ a\=dfa,allcaptures
+** Ignored after DFA matching: allcaptures
+ 0: a
+
# End of testinput6