Implement comment lines in subject strings in pcre2test (and perltest.sh) input files.

This commit is contained in:
Philip.Hazel 2015-09-14 15:10:19 +00:00
parent 6aa0f3e56f
commit 36db5a4d5f
4 changed files with 18 additions and 6 deletions

View File

@ -184,6 +184,9 @@ is specified, a valgrind suppressions file is set up to ignore "Invalid read of
size 16" errors because these are false positives when the hardware supports size 16" errors because these are false positives when the hardware supports
the SSE2 instruction set. the SSE2 instruction set.
52. It is now possible to have comment lines amid the subject strings in
pcre2test (and perltest.sh) input.
Version 10.20 30-June-2015 Version 10.20 30-June-2015
-------------------------- --------------------------

View File

@ -1,4 +1,4 @@
.TH PCRE2TEST 1 "12 September 2015" "PCRE 10.21" .TH PCRE2TEST 1 "14 September 2015" "PCRE 10.21"
.SH NAME .SH NAME
pcre2test - a program for testing Perl-compatible regular expressions. pcre2test - a program for testing Perl-compatible regular expressions.
.SH SYNOPSIS .SH SYNOPSIS
@ -443,6 +443,12 @@ the start of a modifier list. For example:
.sp .sp
abc\e=notbol,notempty abc\e=notbol,notempty
.sp .sp
If the subject string is empty and \e= is followed by whitespace, the line is
treated as a comment line, and is not used for matching. For example:
.sp
\e= This is a comment.
abc\e= This is an invalid modifier list.
.sp
A backslash followed by any other non-alphanumeric character just escapes that A backslash followed by any other non-alphanumeric character just escapes that
character. A backslash followed by anything else causes an error. However, if character. A backslash followed by anything else causes an error. However, if
the very last character in the line is a backslash (and there is no modifier the very last character in the line is a backslash (and there is no modifier
@ -654,9 +660,9 @@ If no number is given, 7 is assumed. The phrase "partial matching" means a call
to \fBpcre2_match()\fP with either the PCRE2_PARTIAL_SOFT or the to \fBpcre2_match()\fP with either the PCRE2_PARTIAL_SOFT or the
PCRE2_PARTIAL_HARD option set. Note that such a call may return a complete PCRE2_PARTIAL_HARD option set. Note that such a call may return a complete
match; the options enable the possibility of a partial match, but do not match; the options enable the possibility of a partial match, but do not
require it. Note also that if you request JIT compilation only for partial require it. Note also that if you request JIT compilation only for partial
matching (for example, /jit=2) but do not set the \fBpartial\fP modifier on a matching (for example, /jit=2) but do not set the \fBpartial\fP modifier on a
subject line, that match will not use JIT code because none was compiled for subject line, that match will not use JIT code because none was compiled for
non-partial matching. non-partial matching.
.P .P
If JIT compilation is successful, the compiled JIT code will automatically be If JIT compilation is successful, the compiled JIT code will automatically be
@ -1519,6 +1525,6 @@ Cambridge, England.
.rs .rs
.sp .sp
.nf .nf
Last updated: 12 September 2015 Last updated: 14 September 2015
Copyright (c) 1997-2015 University of Cambridge. Copyright (c) 1997-2015 University of Cambridge.
.fi .fi

View File

@ -210,6 +210,8 @@ for (;;)
s/^\s+//; # Remove leading space s/^\s+//; # Remove leading space
last if ($_ eq ""); last if ($_ eq "");
next if $_ =~ /^\\=(?:\s|$)/; # Comment line
$x = eval "\"$_\""; # To get escapes processed $x = eval "\"$_\""; # To get escapes processed
# Empty array for holding results, ensure $REGERROR and $REGMARK are # Empty array for holding results, ensure $REGERROR and $REGMARK are

View File

@ -6975,7 +6975,8 @@ while (notdone)
skipping = FALSE; skipping = FALSE;
setlocale(LC_CTYPE, "C"); setlocale(LC_CTYPE, "C");
} }
else if (!skipping) rc = process_data(); else if (!skipping && !(p[0] == '\\' && p[1] == '=' && isspace(p[2])))
rc = process_data();
} }
/* We do not have a pattern set up for testing. Lines starting with # are /* We do not have a pattern set up for testing. Lines starting with # are