summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>2016-07-06 15:02:24 +0000
committerph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>2016-07-06 15:02:24 +0000
commit7429ab333258072f415da7c9ddd3a342779d00f6 (patch)
tree5e97ea0822c8616b1506d1b717999eb28b232ebb
parente028e5213bc5aba9f835eb702aa9beafc3838176 (diff)
downloadpcre2-7429ab333258072f415da7c9ddd3a342779d00f6.tar.gz
Ignore "allcaptures" after DFA matching.
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@545 6239d852-aaf2-0410-a92c-79f79f948069
-rw-r--r--ChangeLog2
-rw-r--r--doc/pcre2test.17
-rw-r--r--src/pcre2test.c18
-rw-r--r--testdata/testinput64
-rw-r--r--testdata/testoutput610
5 files changed, 33 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index ffe84b0..8faf636 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -170,6 +170,8 @@ large stack size when testing with clang.
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
-----------------------------
diff --git a/doc/pcre2test.1 b/doc/pcre2test.1
index d73f817..f639ec2 100644
--- a/doc/pcre2test.1
+++ b/doc/pcre2test.1
@@ -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 @@ The \fBallcaptures\fP modifier requests that the values of all potential
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 @@ Cambridge, England.
.rs
.sp
.nf
-Last updated: 17 June 2016
+Last updated: 06 July 2016
Copyright (c) 1997-2016 University of Cambridge.
.fi
diff --git a/src/pcre2test.c b/src/pcre2test.c
index 9ce37a5..1e24f7d 100644
--- a/src/pcre2test.c
+++ b/src/pcre2test.c
@@ -6436,15 +6436,23 @@ else for (gmatched = 0;; gmatched++)
/* "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,
diff --git a/testdata/testinput6 b/testdata/testinput6
index a19bff3..de9227e 100644
--- a/testdata/testinput6
+++ b/testdata/testinput6
@@ -4878,4 +4878,8 @@
/abcd/null_context
abcd\=null_context
+/()()a+/no_auto_possess
+ aaa\=dfa,allcaptures
+ a\=dfa,allcaptures
+
# End of testinput6
diff --git a/testdata/testoutput6 b/testdata/testoutput6
index e4074cd..17616c8 100644
--- a/testdata/testoutput6
+++ b/testdata/testoutput6
@@ -7672,4 +7672,14 @@ No match
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