Improve test coverage; minor typo in JIT test and other minor buglets fixed.
This commit is contained in:
parent
959bf278ea
commit
8aa511a98b
|
@ -587,11 +587,12 @@ EXTRA_DIST += \
|
||||||
testdata/testoutput18 \
|
testdata/testoutput18 \
|
||||||
testdata/testoutputEBC \
|
testdata/testoutputEBC \
|
||||||
perltest.sh
|
perltest.sh
|
||||||
|
|
||||||
# RunTest and RunGrepTest should clean up after themselves, but just in case
|
# RunTest and RunGrepTest should clean up after themselves, but just in case
|
||||||
# they don't, add their working files to CLEANFILES.
|
# they don't, add their working files to CLEANFILES.
|
||||||
|
|
||||||
CLEANFILES += \
|
CLEANFILES += \
|
||||||
|
testSinput \
|
||||||
test3input \
|
test3input \
|
||||||
test3output \
|
test3output \
|
||||||
test3outputA \
|
test3outputA \
|
||||||
|
|
24
RunGrepTest
24
RunGrepTest
|
@ -72,6 +72,19 @@ fi
|
||||||
./pcre2test -C unicode >/dev/null
|
./pcre2test -C unicode >/dev/null
|
||||||
utf8=$?
|
utf8=$?
|
||||||
|
|
||||||
|
# ------ Function to run and check a special pcre2grep arguments test -------
|
||||||
|
|
||||||
|
checkspecial()
|
||||||
|
{
|
||||||
|
$valgrind ./pcre2grep $1 >>testtrygrep 2>&1
|
||||||
|
if [ $? -ne $2 ] ; then
|
||||||
|
echo "** pcre2grep $1 failed - check testtrygrep"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# ------ Normal tests ------
|
||||||
|
|
||||||
echo "Testing pcre2grep main features"
|
echo "Testing pcre2grep main features"
|
||||||
|
|
||||||
echo "---------------------------- Test 1 ------------------------------" >testtrygrep
|
echo "---------------------------- Test 1 ------------------------------" >testtrygrep
|
||||||
|
@ -571,6 +584,17 @@ $valgrind $pcre2grep -n --newline=anycrlf "^(abc|def|ghi|jkl)" testNinputgrep >>
|
||||||
$cf $srcdir/testdata/grepoutputN testtrygrep
|
$cf $srcdir/testdata/grepoutputN testtrygrep
|
||||||
if [ $? != 0 ] ; then exit 1; fi
|
if [ $? != 0 ] ; then exit 1; fi
|
||||||
|
|
||||||
|
|
||||||
|
# Finally, some tests to exercise code that is not tested above, just to be
|
||||||
|
# sure that it runs OK. Doing this improves the coverage statistics. The output
|
||||||
|
# is not checked.
|
||||||
|
|
||||||
|
echo "Testing miscellaneous pcre2grep arguments (unchecked)"
|
||||||
|
echo '' >testtrygrep
|
||||||
|
checkspecial '-xxxxx' 2
|
||||||
|
checkspecial '--help' 0
|
||||||
|
checkspecial '--line-buffered --colour=auto abc /dev/null' 1
|
||||||
|
|
||||||
# Clean up local working files
|
# Clean up local working files
|
||||||
rm -f testNinputgrep teststderrgrep testtrygrep testtemp1grep testtemp2grep
|
rm -f testNinputgrep teststderrgrep testtrygrep testtemp1grep testtemp2grep
|
||||||
|
|
||||||
|
|
572
RunTest
572
RunTest
|
@ -20,14 +20,9 @@
|
||||||
# except test 10. Whatever order the arguments are in, the tests are always run
|
# except test 10. Whatever order the arguments are in, the tests are always run
|
||||||
# in numerical order.
|
# in numerical order.
|
||||||
#
|
#
|
||||||
# The special argument "3S" runs test 3, stopping if it fails. Test 3 is the
|
# Inappropriate tests are automatically skipped (with a comment to say so). For
|
||||||
# locale test, and failure usually means there's an issue with the locale
|
# example, if JIT support is not compiled, test 16 is skipped, whereas if JIT
|
||||||
# rather than a bug in PCRE2, so normally subsequent tests are run. "3S" is
|
# support is compiled, test 15 is skipped.
|
||||||
# useful when you want to debug or update the test.
|
|
||||||
#
|
|
||||||
# Inappropriate tests are automatically skipped (with a comment to say so): for
|
|
||||||
# example, if JIT support is not compiled, test 12 is skipped, whereas if JIT
|
|
||||||
# support is compiled, test 13 is skipped.
|
|
||||||
#
|
#
|
||||||
# Other arguments can be one of the words "valgrind", "valgrind-log", or "sim"
|
# Other arguments can be one of the words "valgrind", "valgrind-log", or "sim"
|
||||||
# followed by an argument to run cross-compiled executables under a simulator,
|
# followed by an argument to run cross-compiled executables under a simulator,
|
||||||
|
@ -48,6 +43,7 @@
|
||||||
# Define test titles in variables so that they can be output as a list. Some
|
# Define test titles in variables so that they can be output as a list. Some
|
||||||
# of them are modified (e.g. with -8 or -16) when used in the actual tests.
|
# of them are modified (e.g. with -8 or -16) when used in the actual tests.
|
||||||
|
|
||||||
|
title0="Test 0: Unchecked pcre2test argument tests (to improve coverage)"
|
||||||
title1="Test 1: Main non-UTF, non-UCP functionality (compatible with Perl >= 5.10)"
|
title1="Test 1: Main non-UTF, non-UCP functionality (compatible with Perl >= 5.10)"
|
||||||
title2="Test 2: API, errors, internals, and non-Perl stuff"
|
title2="Test 2: API, errors, internals, and non-Perl stuff"
|
||||||
title3="Test 3: Locale-specific features"
|
title3="Test 3: Locale-specific features"
|
||||||
|
@ -69,10 +65,10 @@ title15="Test 15: JIT-specific features when JIT is not available"
|
||||||
title16="Test 16: JIT-specific features when JIT is available"
|
title16="Test 16: JIT-specific features when JIT is available"
|
||||||
title17="Test 17: Tests of the POSIX interface, excluding UTF/UCP"
|
title17="Test 17: Tests of the POSIX interface, excluding UTF/UCP"
|
||||||
title18="Test 18: Tests of the POSIX interface with UTF/UCP"
|
title18="Test 18: Tests of the POSIX interface with UTF/UCP"
|
||||||
|
|
||||||
maxtest=18
|
maxtest=18
|
||||||
|
|
||||||
if [ $# -eq 1 -a "$1" = "list" ]; then
|
if [ $# -eq 1 -a "$1" = "list" ]; then
|
||||||
|
echo $title0
|
||||||
echo $title1
|
echo $title1
|
||||||
echo $title2 "(not UTF or UCP)"
|
echo $title2 "(not UTF or UCP)"
|
||||||
echo $title3
|
echo $title3
|
||||||
|
@ -145,10 +141,22 @@ checkresult()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# ------ Function to run and check a special pcre2test arguments test -------
|
||||||
|
|
||||||
|
checkspecial()
|
||||||
|
{
|
||||||
|
$valgrind ./pcre2test $1 >>testtry
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
echo "** pcre2test $1 failed - check testtry"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# ------ Special EBCDIC Test -------
|
# ------ Special EBCDIC Test -------
|
||||||
|
|
||||||
if [ $# -eq 1 -a "$1" = "ebcdic" ]; then
|
if [ $# -eq 1 -a "$1" = "ebcdic" ]; then
|
||||||
./pcre2test -C ebcdic >/dev/null
|
$valgrind ./pcre2test -C ebcdic >/dev/null
|
||||||
ebcdic=$?
|
ebcdic=$?
|
||||||
if [ $ebcdic -ne 1 ] ; then
|
if [ $ebcdic -ne 1 ] ; then
|
||||||
echo "Cannot run EBCDIC tests: EBCDIC support not compiled"
|
echo "Cannot run EBCDIC tests: EBCDIC support not compiled"
|
||||||
|
@ -180,6 +188,7 @@ unset cp ls mv rm
|
||||||
# Process options and select which tests to run; for those that are explicitly
|
# Process options and select which tests to run; for those that are explicitly
|
||||||
# requested, check that the necessary optional facilities are available.
|
# requested, check that the necessary optional facilities are available.
|
||||||
|
|
||||||
|
do0=no
|
||||||
do1=no
|
do1=no
|
||||||
do2=no
|
do2=no
|
||||||
do3=no
|
do3=no
|
||||||
|
@ -201,6 +210,7 @@ do18=no
|
||||||
|
|
||||||
while [ $# -gt 0 ] ; do
|
while [ $# -gt 0 ] ; do
|
||||||
case $1 in
|
case $1 in
|
||||||
|
0) do0=yes;;
|
||||||
1) do1=yes;;
|
1) do1=yes;;
|
||||||
2) do2=yes;;
|
2) do2=yes;;
|
||||||
3) do3=yes;;
|
3) do3=yes;;
|
||||||
|
@ -238,7 +248,7 @@ while [ $# -gt 0 ] ; do
|
||||||
tf=`expr "$1" : '\([0-9]*\)'`
|
tf=`expr "$1" : '\([0-9]*\)'`
|
||||||
tt=`expr "$1" : '.*-\([0-9]*\)'`
|
tt=`expr "$1" : '.*-\([0-9]*\)'`
|
||||||
if [ "$tt" = "" ] ; then tt=$maxtest; fi
|
if [ "$tt" = "" ] ; then tt=$maxtest; fi
|
||||||
if expr \( "$tf" "<" 1 \) \| \( "$tt" ">" "$maxtest" \) >/dev/null; then
|
if expr \( "$tt" ">" "$maxtest" \) >/dev/null; then
|
||||||
echo "Invalid test range '$1'"; exit 1
|
echo "Invalid test range '$1'"; exit 1
|
||||||
fi
|
fi
|
||||||
while expr "$tf" "<=" "$tt" >/dev/null; do
|
while expr "$tf" "<=" "$tt" >/dev/null; do
|
||||||
|
@ -287,7 +297,7 @@ test32=skip
|
||||||
|
|
||||||
if [ "$arg8$arg16$arg32" = "" ] ; then
|
if [ "$arg8$arg16$arg32" = "" ] ; then
|
||||||
if [ $support8 -ne 0 ] ; then
|
if [ $support8 -ne 0 ] ; then
|
||||||
test8=
|
test8=-8
|
||||||
fi
|
fi
|
||||||
if [ $support16 -ne 0 ] ; then
|
if [ $support16 -ne 0 ] ; then
|
||||||
test16=-16
|
test16=-16
|
||||||
|
@ -296,7 +306,7 @@ if [ "$arg8$arg16$arg32" = "" ] ; then
|
||||||
test32=-32
|
test32=-32
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Select requested bit sizes
|
# Otherwise, select requested bit sizes
|
||||||
|
|
||||||
else
|
else
|
||||||
if [ "$arg8" = yes ] ; then
|
if [ "$arg8" = yes ] ; then
|
||||||
|
@ -304,7 +314,7 @@ else
|
||||||
echo "Cannot run 8-bit library tests: 8-bit library not compiled"
|
echo "Cannot run 8-bit library tests: 8-bit library not compiled"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
test8=
|
test8=-8
|
||||||
fi
|
fi
|
||||||
if [ "$arg16" = yes ] ; then
|
if [ "$arg16" = yes ] ; then
|
||||||
if [ $support16 -eq 0 ] ; then
|
if [ $support16 -eq 0 ] ; then
|
||||||
|
@ -339,12 +349,13 @@ fi
|
||||||
# If no specific tests were requested, select all. Those that are not
|
# If no specific tests were requested, select all. Those that are not
|
||||||
# relevant will be automatically skipped.
|
# relevant will be automatically skipped.
|
||||||
|
|
||||||
if [ $do1 = no -a $do2 = no -a $do3 = no -a $do4 = no -a \
|
if [ $do0 = no -a $do1 = no -a $do2 = no -a $do3 = no -a \
|
||||||
$do5 = no -a $do6 = no -a $do7 = no -a $do8 = no -a \
|
$do4 = no -a $do5 = no -a $do6 = no -a $do7 = no -a \
|
||||||
$do9 = no -a $do10 = no -a $do11 = no -a $do12 = no -a \
|
$do8 = no -a $do9 = no -a $do10 = no -a $do11 = no -a \
|
||||||
$do13 = no -a $do14 = no -a $do15 = no -a $do16 = no -a \
|
$do12 = no -a $do13 = no -a $do14 = no -a $do15 = no -a \
|
||||||
$do17 = no -a $do18 = no \
|
$do16 = no -a $do17 = no -a $do18 = no \
|
||||||
]; then
|
]; then
|
||||||
|
do0=yes
|
||||||
do1=yes
|
do1=yes
|
||||||
do2=yes
|
do2=yes
|
||||||
do3=yes
|
do3=yes
|
||||||
|
@ -384,310 +395,325 @@ for bmode in "$test8" "$test16" "$test32"; do
|
||||||
bits=16; echo "---- Testing 16-bit library ----"; echo "";;
|
bits=16; echo "---- Testing 16-bit library ----"; echo "";;
|
||||||
-32) if [ "$test8$test16" != "skipskip" ] ; then echo ""; fi
|
-32) if [ "$test8$test16" != "skipskip" ] ; then echo ""; fi
|
||||||
bits=32; echo "---- Testing 32-bit library ----"; echo "";;
|
bits=32; echo "---- Testing 32-bit library ----"; echo "";;
|
||||||
*) bits=8; echo "---- Testing 8-bit library ----"; echo "";;
|
-8) bits=8; echo "---- Testing 8-bit library ----"; echo "";;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Primary non-UTF test, compatible with JIT and all versions of Perl >= 5.8
|
# Test 0 is a special test. Its output is not checked, because it will
|
||||||
|
# be different on different hardware and with different configurations.
|
||||||
|
# Running this test just exercises the code.
|
||||||
|
|
||||||
if [ $do1 = yes ] ; then
|
if [ $do0 = yes ] ; then
|
||||||
echo $title1
|
echo $title0
|
||||||
for opt in "" $jitopt; do
|
echo '/abc/jit,memory' >testSinput
|
||||||
$sim $valgrind ./pcre2test -q $bmode $opt $testdata/testinput1 testtry
|
echo ' abc' >>testSinput
|
||||||
checkresult $? 1 "$opt"
|
echo '' >testtry
|
||||||
done
|
checkspecial '-C'
|
||||||
fi
|
checkspecial '--help'
|
||||||
|
checkspecial '-S 1 -t 10 testSinput'
|
||||||
# PCRE2 tests that are not JIT or Perl-compatible: API, errors, internals
|
echo " OK"
|
||||||
|
|
||||||
if [ $do2 = yes ] ; then
|
|
||||||
echo $title2 "(excluding UTF-$bits)"
|
|
||||||
for opt in "" $jitopt; do
|
|
||||||
$sim $valgrind ./pcre2test -q $bmode $opt $testdata/testinput2 testtry
|
|
||||||
if [ $? = 0 ] ; then
|
|
||||||
checkresult $? 2 "$opt"
|
|
||||||
else
|
|
||||||
echo " "
|
|
||||||
echo "** Test 2 requires a lot of stack. If it has crashed with a"
|
|
||||||
echo "** segmentation fault, it may be that you do not have enough"
|
|
||||||
echo "** stack available by default. Please see the 'pcre2stack' man"
|
|
||||||
echo "** page for a discussion of PCRE2's stack usage."
|
|
||||||
echo " "
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Locale-specific tests, provided that either the "fr_FR" or the "french"
|
|
||||||
# locale is available. The former is the Unix-like standard; the latter is
|
|
||||||
# for Windows. Another possibility is "fr". Unfortunately, different versions
|
|
||||||
# of the French locale give different outputs for some items. This test passes
|
|
||||||
# if the output matches any one of the alternative output files.
|
|
||||||
|
|
||||||
if [ $do3 = yes ] ; then
|
|
||||||
locale -a | grep '^fr_FR$' >/dev/null
|
|
||||||
if [ $? -eq 0 ] ; then
|
|
||||||
locale=fr_FR
|
|
||||||
infile=$testdata/testinput3
|
|
||||||
outfile=$testdata/testoutput3
|
|
||||||
outfile2=$testdata/testoutput3A
|
|
||||||
outfile3=$testdata/testoutput3B
|
|
||||||
else
|
|
||||||
infile=test3input
|
|
||||||
outfile=test3output
|
|
||||||
outfile2=test3outputA
|
|
||||||
outfile3=test3outputB
|
|
||||||
locale -a | grep '^french$' >/dev/null
|
|
||||||
if [ $? -eq 0 ] ; then
|
|
||||||
locale=french
|
|
||||||
sed 's/fr_FR/french/' $testdata/testinput3 >test3input
|
|
||||||
sed 's/fr_FR/french/' $testdata/testoutput3 >test3output
|
|
||||||
sed 's/fr_FR/french/' $testdata/testoutput3A >test3outputA
|
|
||||||
sed 's/fr_FR/french/' $testdata/testoutput3B >test3outputB
|
|
||||||
else
|
|
||||||
locale -a | grep '^fr$' >/dev/null
|
|
||||||
if [ $? -eq 0 ] ; then
|
|
||||||
locale=fr
|
|
||||||
sed 's/fr_FR/fr/' $testdata/intestinput3 >test3input
|
|
||||||
sed 's/fr_FR/fr/' $testdata/intestoutput3 >test3output
|
|
||||||
sed 's/fr_FR/fr/' $testdata/intestoutput3A >test3outputA
|
|
||||||
sed 's/fr_FR/fr/' $testdata/intestoutput3B >test3outputB
|
|
||||||
else
|
|
||||||
locale=
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$locale" != "" ] ; then
|
# Primary non-UTF test, compatible with JIT and all versions of Perl >= 5.8
|
||||||
echo $title3 "(using '$locale' locale)"
|
|
||||||
|
if [ $do1 = yes ] ; then
|
||||||
|
echo $title1
|
||||||
for opt in "" $jitopt; do
|
for opt in "" $jitopt; do
|
||||||
$sim $valgrind ./pcre2test -q $bmode $opt $infile testtry
|
$sim $valgrind ./pcre2test -q $bmode $opt $testdata/testinput1 testtry
|
||||||
|
checkresult $? 1 "$opt"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# PCRE2 tests that are not JIT or Perl-compatible: API, errors, internals
|
||||||
|
|
||||||
|
if [ $do2 = yes ] ; then
|
||||||
|
echo $title2 "(excluding UTF-$bits)"
|
||||||
|
for opt in "" $jitopt; do
|
||||||
|
$sim $valgrind ./pcre2test -q $bmode $opt $testdata/testinput2 testtry
|
||||||
if [ $? = 0 ] ; then
|
if [ $? = 0 ] ; then
|
||||||
case "$opt" in
|
checkresult $? 2 "$opt"
|
||||||
-jit) with=" with JIT";;
|
else
|
||||||
*) with="";;
|
echo " "
|
||||||
esac
|
echo "** Test 2 requires a lot of stack. If it has crashed with a"
|
||||||
if $cf $outfile testtry >teststdout || \
|
echo "** segmentation fault, it may be that you do not have enough"
|
||||||
$cf $outfile2 testtry >teststdout || \
|
echo "** stack available by default. Please see the 'pcre2stack' man"
|
||||||
$cf $outfile3 testtry >teststdout
|
echo "** page for a discussion of PCRE2's stack usage."
|
||||||
then
|
echo " "
|
||||||
echo " OK$with"
|
exit 1
|
||||||
else
|
|
||||||
echo "** Locale test did not run successfully$with. The output did not match"
|
|
||||||
echo " $outfile, $outfile2 or $outfile3."
|
|
||||||
echo " This may mean that there is a problem with the locale settings rather"
|
|
||||||
echo " than a bug in PCRE2."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else exit 1
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
else
|
|
||||||
echo "Cannot test locale-specific features - none of the 'fr_FR', 'fr' or"
|
|
||||||
echo "'french' locales exist, or the \"locale\" command is not available"
|
|
||||||
echo "to check for them."
|
|
||||||
echo " "
|
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# Tests for UTF and Unicode property support
|
# Locale-specific tests, provided that either the "fr_FR" or the "french"
|
||||||
|
# locale is available. The former is the Unix-like standard; the latter is
|
||||||
|
# for Windows. Another possibility is "fr". Unfortunately, different versions
|
||||||
|
# of the French locale give different outputs for some items. This test passes
|
||||||
|
# if the output matches any one of the alternative output files.
|
||||||
|
|
||||||
if [ $do4 = yes ] ; then
|
if [ $do3 = yes ] ; then
|
||||||
echo ${title4A}-${bits}${title4B}
|
locale -a | grep '^fr_FR$' >/dev/null
|
||||||
if [ $utf -eq 0 ] ; then
|
if [ $? -eq 0 ] ; then
|
||||||
echo " Skipped because UTF-$bits support is not available"
|
locale=fr_FR
|
||||||
else
|
infile=$testdata/testinput3
|
||||||
for opt in "" $jitopt; do
|
outfile=$testdata/testoutput3
|
||||||
$sim $valgrind ./pcre2test -q $bmode $opt $testdata/testinput4 testtry
|
outfile2=$testdata/testoutput3A
|
||||||
checkresult $? 4 "$opt"
|
outfile3=$testdata/testoutput3B
|
||||||
done
|
else
|
||||||
|
infile=test3input
|
||||||
|
outfile=test3output
|
||||||
|
outfile2=test3outputA
|
||||||
|
outfile3=test3outputB
|
||||||
|
locale -a | grep '^french$' >/dev/null
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
locale=french
|
||||||
|
sed 's/fr_FR/french/' $testdata/testinput3 >test3input
|
||||||
|
sed 's/fr_FR/french/' $testdata/testoutput3 >test3output
|
||||||
|
sed 's/fr_FR/french/' $testdata/testoutput3A >test3outputA
|
||||||
|
sed 's/fr_FR/french/' $testdata/testoutput3B >test3outputB
|
||||||
|
else
|
||||||
|
locale -a | grep '^fr$' >/dev/null
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
locale=fr
|
||||||
|
sed 's/fr_FR/fr/' $testdata/intestinput3 >test3input
|
||||||
|
sed 's/fr_FR/fr/' $testdata/intestoutput3 >test3output
|
||||||
|
sed 's/fr_FR/fr/' $testdata/intestoutput3A >test3outputA
|
||||||
|
sed 's/fr_FR/fr/' $testdata/intestoutput3B >test3outputB
|
||||||
|
else
|
||||||
|
locale=
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$locale" != "" ] ; then
|
||||||
|
echo $title3 "(using '$locale' locale)"
|
||||||
|
for opt in "" $jitopt; do
|
||||||
|
$sim $valgrind ./pcre2test -q $bmode $opt $infile testtry
|
||||||
|
if [ $? = 0 ] ; then
|
||||||
|
case "$opt" in
|
||||||
|
-jit) with=" with JIT";;
|
||||||
|
*) with="";;
|
||||||
|
esac
|
||||||
|
if $cf $outfile testtry >teststdout || \
|
||||||
|
$cf $outfile2 testtry >teststdout || \
|
||||||
|
$cf $outfile3 testtry >teststdout
|
||||||
|
then
|
||||||
|
echo " OK$with"
|
||||||
|
else
|
||||||
|
echo "** Locale test did not run successfully$with. The output did not match"
|
||||||
|
echo " $outfile, $outfile2 or $outfile3."
|
||||||
|
echo " This may mean that there is a problem with the locale settings rather"
|
||||||
|
echo " than a bug in PCRE2."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "Cannot test locale-specific features - none of the 'fr_FR', 'fr' or"
|
||||||
|
echo "'french' locales exist, or the \"locale\" command is not available"
|
||||||
|
echo "to check for them."
|
||||||
|
echo " "
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $do5 = yes ] ; then
|
# Tests for UTF and Unicode property support
|
||||||
echo ${title5A}-${bits}$title5B
|
|
||||||
if [ $utf -eq 0 ] ; then
|
if [ $do4 = yes ] ; then
|
||||||
echo " Skipped because UTF-$bits support is not available"
|
echo ${title4A}-${bits}${title4B}
|
||||||
else
|
if [ $utf -eq 0 ] ; then
|
||||||
for opt in "" $jitopt; do
|
echo " Skipped because UTF-$bits support is not available"
|
||||||
$sim $valgrind ./pcre2test -q $bmode $opt $testdata/testinput5 testtry
|
else
|
||||||
checkresult $? 5 "$opt"
|
for opt in "" $jitopt; do
|
||||||
done
|
$sim $valgrind ./pcre2test -q $bmode $opt $testdata/testinput4 testtry
|
||||||
|
checkresult $? 4 "$opt"
|
||||||
|
done
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# Tests for DFA matching support
|
if [ $do5 = yes ] ; then
|
||||||
|
echo ${title5A}-${bits}$title5B
|
||||||
if [ $do6 = yes ] ; then
|
if [ $utf -eq 0 ] ; then
|
||||||
echo $title6
|
echo " Skipped because UTF-$bits support is not available"
|
||||||
$sim $valgrind ./pcre2test -q $bmode $testdata/testinput6 testtry
|
else
|
||||||
checkresult $? 6 ""
|
for opt in "" $jitopt; do
|
||||||
fi
|
$sim $valgrind ./pcre2test -q $bmode $opt $testdata/testinput5 testtry
|
||||||
|
checkresult $? 5 "$opt"
|
||||||
if [ $do7 = yes ] ; then
|
done
|
||||||
echo ${title7A}-${bits}$title7B
|
fi
|
||||||
if [ $utf -eq 0 ] ; then
|
|
||||||
echo " Skipped because UTF-$bits support is not available"
|
|
||||||
else
|
|
||||||
$sim $valgrind ./pcre2test -q $bmode $opt $testdata/testinput7 testtry
|
|
||||||
checkresult $? 7 ""
|
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# Test of internal offsets and code sizes. This test is run only when there
|
# Tests for DFA matching support
|
||||||
# is UTF/UCP support and the link size is 2. The actual tests are
|
|
||||||
# mostly the same as in some of the above, but in this test we inspect some
|
|
||||||
# offsets and sizes that require a known link size. This is a doublecheck for
|
|
||||||
# the maintainer, just in case something changes unexpectely. The output from
|
|
||||||
# this test is different in 8-bit, 16-bit, and 32-bit modes, so there are
|
|
||||||
# mode-specific output files.
|
|
||||||
|
|
||||||
if [ $do8 = yes ] ; then
|
if [ $do6 = yes ] ; then
|
||||||
echo $title8
|
echo $title6
|
||||||
if [ $link_size -ne 2 ] ; then
|
$sim $valgrind ./pcre2test -q $bmode $testdata/testinput6 testtry
|
||||||
echo " Skipped because link size is not 2"
|
checkresult $? 6 ""
|
||||||
elif [ $utf -eq 0 ] ; then
|
|
||||||
echo " Skipped because UTF-$bits support is not available"
|
|
||||||
else
|
|
||||||
$sim $valgrind ./pcre2test -q $bmode $testdata/testinput8 testtry
|
|
||||||
checkresult $? 8-$bits ""
|
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# Tests for 8-bit-specific features
|
if [ $do7 = yes ] ; then
|
||||||
|
echo ${title7A}-${bits}$title7B
|
||||||
if [ "$do9" = yes ] ; then
|
if [ $utf -eq 0 ] ; then
|
||||||
echo $title9
|
echo " Skipped because UTF-$bits support is not available"
|
||||||
if [ "$bits" = "16" -o "$bits" = "32" ] ; then
|
else
|
||||||
echo " Skipped when running 16/32-bit tests"
|
$sim $valgrind ./pcre2test -q $bmode $opt $testdata/testinput7 testtry
|
||||||
else
|
checkresult $? 7 ""
|
||||||
for opt in "" $jitopt; do
|
fi
|
||||||
$sim $valgrind ./pcre2test -q $bmode $opt $testdata/testinput9 testtry
|
|
||||||
checkresult $? 9 "$opt"
|
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# Tests for UTF-8 and UCP 8-bit-specific features
|
# Test of internal offsets and code sizes. This test is run only when there
|
||||||
|
# is UTF/UCP support and the link size is 2. The actual tests are
|
||||||
|
# mostly the same as in some of the above, but in this test we inspect some
|
||||||
|
# offsets and sizes that require a known link size. This is a doublecheck for
|
||||||
|
# the maintainer, just in case something changes unexpectely. The output from
|
||||||
|
# this test is different in 8-bit, 16-bit, and 32-bit modes, so there are
|
||||||
|
# mode-specific output files.
|
||||||
|
|
||||||
if [ "$do10" = yes ] ; then
|
if [ $do8 = yes ] ; then
|
||||||
echo $title10
|
echo $title8
|
||||||
if [ "$bits" = "16" -o "$bits" = "32" ] ; then
|
if [ $link_size -ne 2 ] ; then
|
||||||
echo " Skipped when running 16/32-bit tests"
|
echo " Skipped because link size is not 2"
|
||||||
elif [ $utf -eq 0 ] ; then
|
elif [ $utf -eq 0 ] ; then
|
||||||
echo " Skipped because UTF-$bits support is not available"
|
echo " Skipped because UTF-$bits support is not available"
|
||||||
else
|
else
|
||||||
for opt in "" $jitopt; do
|
$sim $valgrind ./pcre2test -q $bmode $testdata/testinput8 testtry
|
||||||
$sim $valgrind ./pcre2test -q $bmode $opt $testdata/testinput10 testtry
|
checkresult $? 8-$bits ""
|
||||||
checkresult $? 10 "$opt"
|
fi
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# Tests for 16-bit and 32-bit features. Output is different for the two widths.
|
# Tests for 8-bit-specific features
|
||||||
|
|
||||||
if [ $do11 = yes ] ; then
|
if [ "$do9" = yes ] ; then
|
||||||
echo $title11
|
echo $title9
|
||||||
if [ "$bits" = "8" ] ; then
|
if [ "$bits" = "16" -o "$bits" = "32" ] ; then
|
||||||
echo " Skipped when running 8-bit tests"
|
echo " Skipped when running 16/32-bit tests"
|
||||||
else
|
else
|
||||||
for opt in "" $jitopt; do
|
for opt in "" $jitopt; do
|
||||||
$sim $valgrind ./pcre2test -q $bmode $opt $testdata/testinput11 testtry
|
$sim $valgrind ./pcre2test -q $bmode $opt $testdata/testinput9 testtry
|
||||||
checkresult $? 11-$bits "$opt"
|
checkresult $? 9 "$opt"
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# Tests for 16-bit and 32-bit features with UTF-16/32 and UCP support. Output
|
# Tests for UTF-8 and UCP 8-bit-specific features
|
||||||
# is different for the two widths.
|
|
||||||
|
|
||||||
if [ $do12 = yes ] ; then
|
if [ "$do10" = yes ] ; then
|
||||||
echo $title12
|
echo $title10
|
||||||
if [ "$bits" = "8" ] ; then
|
if [ "$bits" = "16" -o "$bits" = "32" ] ; then
|
||||||
echo " Skipped when running 8-bit tests"
|
echo " Skipped when running 16/32-bit tests"
|
||||||
elif [ $utf -eq 0 ] ; then
|
elif [ $utf -eq 0 ] ; then
|
||||||
echo " Skipped because UTF-$bits support is not available"
|
echo " Skipped because UTF-$bits support is not available"
|
||||||
else
|
else
|
||||||
for opt in "" $jitopt; do
|
for opt in "" $jitopt; do
|
||||||
$sim $valgrind ./pcre2test -q $bmode $opt $testdata/testinput12 testtry
|
$sim $valgrind ./pcre2test -q $bmode $opt $testdata/testinput10 testtry
|
||||||
checkresult $? 12-$bits "$opt"
|
checkresult $? 10 "$opt"
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# Tests for 16/32-bit-specific features in DFA non-UTF modes
|
# Tests for 16-bit and 32-bit features. Output is different for the two widths.
|
||||||
|
|
||||||
if [ $do13 = yes ] ; then
|
if [ $do11 = yes ] ; then
|
||||||
echo $title13
|
echo $title11
|
||||||
if [ "$bits" = "8" ] ; then
|
if [ "$bits" = "8" ] ; then
|
||||||
echo " Skipped when running 8-bit tests"
|
echo " Skipped when running 8-bit tests"
|
||||||
else
|
else
|
||||||
$sim $valgrind ./pcre2test -q $bmode $testdata/testinput13 testtry
|
for opt in "" $jitopt; do
|
||||||
checkresult $? 13 ""
|
$sim $valgrind ./pcre2test -q $bmode $opt $testdata/testinput11 testtry
|
||||||
|
checkresult $? 11-$bits "$opt"
|
||||||
|
done
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# Test non-JIT match and recursion limits
|
# Tests for 16-bit and 32-bit features with UTF-16/32 and UCP support. Output
|
||||||
|
# is different for the two widths.
|
||||||
|
|
||||||
if [ $do14 = yes ] ; then
|
if [ $do12 = yes ] ; then
|
||||||
echo $title14
|
echo $title12
|
||||||
$sim $valgrind ./pcre2test -q $bmode $testdata/testinput14 testtry
|
if [ "$bits" = "8" ] ; then
|
||||||
checkresult $? 14 ""
|
echo " Skipped when running 8-bit tests"
|
||||||
fi
|
elif [ $utf -eq 0 ] ; then
|
||||||
|
echo " Skipped because UTF-$bits support is not available"
|
||||||
# Test JIT-specific features when JIT is not available
|
else
|
||||||
|
for opt in "" $jitopt; do
|
||||||
if [ $do15 = yes ] ; then
|
$sim $valgrind ./pcre2test -q $bmode $opt $testdata/testinput12 testtry
|
||||||
echo $title15
|
checkresult $? 12-$bits "$opt"
|
||||||
if [ $jit -ne 0 ] ; then
|
done
|
||||||
echo " Skipped because JIT is available"
|
fi
|
||||||
else
|
|
||||||
$sim $valgrind ./pcre2test -q $bmode $testdata/testinput15 testtry
|
|
||||||
checkresult $? 15 ""
|
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# Test JIT-specific features when JIT is available
|
# Tests for 16/32-bit-specific features in DFA non-UTF modes
|
||||||
|
|
||||||
if [ $do16 = yes ] ; then
|
if [ $do13 = yes ] ; then
|
||||||
echo $title16
|
echo $title13
|
||||||
if [ $jit -eq 0 -o "$nojit" = "yes" ] ; then
|
if [ "$bits" = "8" ] ; then
|
||||||
echo " Skipped because JIT is not available or not usable"
|
echo " Skipped when running 8-bit tests"
|
||||||
else
|
else
|
||||||
$sim $valgrind ./pcre2test -q $bmode $testdata/testinput16 testtry
|
$sim $valgrind ./pcre2test -q $bmode $testdata/testinput13 testtry
|
||||||
checkresult $? 16 ""
|
checkresult $? 13 ""
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# Tests for the POSIX interface without UTF/UCP (8-bit only)
|
# Test non-JIT match and recursion limits
|
||||||
|
|
||||||
if [ $do17 = yes ] ; then
|
if [ $do14 = yes ] ; then
|
||||||
echo $title17
|
echo $title14
|
||||||
if [ "$bits" = "16" -o "$bits" = "32" ] ; then
|
$sim $valgrind ./pcre2test -q $bmode $testdata/testinput14 testtry
|
||||||
echo " Skipped when running 16/32-bit tests"
|
checkresult $? 14 ""
|
||||||
else
|
|
||||||
$sim $valgrind ./pcre2test -q $bmode $testdata/testinput17 testtry
|
|
||||||
checkresult $? 17 ""
|
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# Tests for the POSIX interface with UTF/UCP (8-bit only)
|
# Test JIT-specific features when JIT is not available
|
||||||
|
|
||||||
if [ $do18 = yes ] ; then
|
if [ $do15 = yes ] ; then
|
||||||
echo $title18
|
echo $title15
|
||||||
if [ "$bits" = "16" -o "$bits" = "32" ] ; then
|
if [ $jit -ne 0 ] ; then
|
||||||
echo " Skipped when running 16/32-bit tests"
|
echo " Skipped because JIT is available"
|
||||||
elif [ $utf -eq 0 ] ; then
|
else
|
||||||
echo " Skipped because UTF-$bits support is not available"
|
$sim $valgrind ./pcre2test -q $bmode $testdata/testinput15 testtry
|
||||||
else
|
checkresult $? 15 ""
|
||||||
$sim $valgrind ./pcre2test -q $bmode $testdata/testinput18 testtry
|
fi
|
||||||
checkresult $? 18 ""
|
fi
|
||||||
|
|
||||||
|
# Test JIT-specific features when JIT is available
|
||||||
|
|
||||||
|
if [ $do16 = yes ] ; then
|
||||||
|
echo $title16
|
||||||
|
if [ $jit -eq 0 -o "$nojit" = "yes" ] ; then
|
||||||
|
echo " Skipped because JIT is not available or not usable"
|
||||||
|
else
|
||||||
|
$sim $valgrind ./pcre2test -q $bmode $testdata/testinput16 testtry
|
||||||
|
checkresult $? 16 ""
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Tests for the POSIX interface without UTF/UCP (8-bit only)
|
||||||
|
|
||||||
|
if [ $do17 = yes ] ; then
|
||||||
|
echo $title17
|
||||||
|
if [ "$bits" = "16" -o "$bits" = "32" ] ; then
|
||||||
|
echo " Skipped when running 16/32-bit tests"
|
||||||
|
else
|
||||||
|
$sim $valgrind ./pcre2test -q $bmode $testdata/testinput17 testtry
|
||||||
|
checkresult $? 17 ""
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Tests for the POSIX interface with UTF/UCP (8-bit only)
|
||||||
|
|
||||||
|
if [ $do18 = yes ] ; then
|
||||||
|
echo $title18
|
||||||
|
if [ "$bits" = "16" -o "$bits" = "32" ] ; then
|
||||||
|
echo " Skipped when running 16/32-bit tests"
|
||||||
|
elif [ $utf -eq 0 ] ; then
|
||||||
|
echo " Skipped because UTF-$bits support is not available"
|
||||||
|
else
|
||||||
|
$sim $valgrind ./pcre2test -q $bmode $testdata/testinput18 testtry
|
||||||
|
checkresult $? 18 ""
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# End of loop for 8/16/32-bit tests
|
# End of loop for 8/16/32-bit tests
|
||||||
done
|
done
|
||||||
|
|
||||||
# Clean up local working files
|
# Clean up local working files
|
||||||
rm -f test3input test3output test3outputA test3outputB teststdout testtry
|
rm -f testSinput test3input test3output test3outputA test3outputB teststdout testtry
|
||||||
|
|
||||||
# End
|
# End
|
||||||
|
|
|
@ -15,16 +15,17 @@ PCRE2 - Perl-compatible regular expressions (revised API)
|
||||||
.rs
|
.rs
|
||||||
.sp
|
.sp
|
||||||
This convenience function finds the number of a named substring capturing
|
This convenience function finds the number of a named substring capturing
|
||||||
parenthesis in a compiled pattern. Its arguments are:
|
parenthesis in a compiled pattern, provided that it is a unique name. The
|
||||||
|
function arguments are:
|
||||||
.sp
|
.sp
|
||||||
\fIcode\fP Compiled regular expression
|
\fIcode\fP Compiled regular expression
|
||||||
\fIname\fP Name whose number is required
|
\fIname\fP Name whose number is required
|
||||||
.sp
|
.sp
|
||||||
The yield of the function is the number of the parenthesis if the name is
|
The yield of the function is the number of the parenthesis if the name is
|
||||||
found, or PCRE2_ERROR_NOSUBSTRING otherwise. When duplicate names are allowed
|
found, or PCRE2_ERROR_NOSUBSTRING if it is not found. When duplicate names are
|
||||||
(PCRE2_DUPNAMES is set), it is not defined which of the numbers is returned.
|
allowed (PCRE2_DUPNAMES is set), if the name is not unique,
|
||||||
You can obtain the complete list by calling
|
PCRE2_ERROR_NOUNIQUESUBSTRING is returned. You can obtain the list of numbers
|
||||||
\fBpcre2_substring_nametable_scan()\fP.
|
with the same name by calling \fBpcre2_substring_nametable_scan()\fP.
|
||||||
.P
|
.P
|
||||||
There is a complete description of the PCRE2 native API in the
|
There is a complete description of the PCRE2 native API in the
|
||||||
.\" HREF
|
.\" HREF
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.TH PCRE2API 3 "25 October 2014" "PCRE2 10.00"
|
.TH PCRE2API 3 "29 October 2014" "PCRE2 10.00"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
PCRE2 - Perl-compatible regular expressions (revised API)
|
PCRE2 - Perl-compatible regular expressions (revised API)
|
||||||
.sp
|
.sp
|
||||||
|
@ -2332,8 +2332,9 @@ the number of the subpattern called "xxx" is 2. If the name is known to be
|
||||||
unique (PCRE2_DUPNAMES was not set), you can find the number from the name by
|
unique (PCRE2_DUPNAMES was not set), you can find the number from the name by
|
||||||
calling \fBpcre2_substring_number_from_name()\fP. The first argument is the
|
calling \fBpcre2_substring_number_from_name()\fP. The first argument is the
|
||||||
compiled pattern, and the second is the name. The yield of the function is the
|
compiled pattern, and the second is the name. The yield of the function is the
|
||||||
subpattern number, or PCRE2_ERROR_NOSUBSTRING if there is no subpattern of that
|
subpattern number, PCRE2_ERROR_NOSUBSTRING if there is no subpattern of that
|
||||||
name.
|
name, or PCRE2_ERROR_NOUNIQUESUBSTRING if there is more than one subpattern of
|
||||||
|
that name.
|
||||||
.P
|
.P
|
||||||
Given the number, you can extract the substring directly, or use one of the
|
Given the number, you can extract the substring directly, or use one of the
|
||||||
functions described in the previous section. For convenience, there are also
|
functions described in the previous section. For convenience, there are also
|
||||||
|
@ -2630,6 +2631,6 @@ Cambridge CB2 3QH, England.
|
||||||
.rs
|
.rs
|
||||||
.sp
|
.sp
|
||||||
.nf
|
.nf
|
||||||
Last updated: 25 October 2014
|
Last updated: 29 October 2014
|
||||||
Copyright (c) 1997-2014 University of Cambridge.
|
Copyright (c) 1997-2014 University of Cambridge.
|
||||||
.fi
|
.fi
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.TH PCRE2TEST 1 "11 October 2014" "PCRE 10.00"
|
.TH PCRE2TEST 1 "31 October 2014" "PCRE 10.00"
|
||||||
.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
|
||||||
|
@ -383,6 +383,7 @@ which may also be used in a \fB#pattern\fP command. A pattern's modifier list
|
||||||
can add to or override default modifiers that were set by a previous
|
can add to or override default modifiers that were set by a previous
|
||||||
\fB#pattern\fP command.
|
\fB#pattern\fP command.
|
||||||
.
|
.
|
||||||
|
.
|
||||||
.SS "Setting compilation options"
|
.SS "Setting compilation options"
|
||||||
.rs
|
.rs
|
||||||
.sp
|
.sp
|
||||||
|
@ -420,6 +421,7 @@ non-printing characters in output strings to be printed using the \ex{hh...}
|
||||||
notation. Otherwise, those less than 0x100 are output in hex without the curly
|
notation. Otherwise, those less than 0x100 are output in hex without the curly
|
||||||
brackets.
|
brackets.
|
||||||
.
|
.
|
||||||
|
.
|
||||||
.SS "Setting compilation controls"
|
.SS "Setting compilation controls"
|
||||||
.rs
|
.rs
|
||||||
.sp
|
.sp
|
||||||
|
@ -566,6 +568,9 @@ also output.
|
||||||
.sp
|
.sp
|
||||||
The \fBparens_nest_limit\fP modifier sets a limit on the depth of nested
|
The \fBparens_nest_limit\fP modifier sets a limit on the depth of nested
|
||||||
parentheses in a pattern. Breaching the limit causes a compilation error.
|
parentheses in a pattern. Breaching the limit causes a compilation error.
|
||||||
|
The default for the library is set when PCRE2 is built, but \fBpcre2test\fP
|
||||||
|
sets its own default of 220, which is required for running the standard test
|
||||||
|
suite.
|
||||||
.
|
.
|
||||||
.
|
.
|
||||||
.SS "Using the POSIX wrapper API"
|
.SS "Using the POSIX wrapper API"
|
||||||
|
@ -631,12 +636,13 @@ However, they may be included in a pattern's modifier list, in which case they
|
||||||
are applied to every subject line that is processed with that pattern. They do
|
are applied to every subject line that is processed with that pattern. They do
|
||||||
not affect the compilation process.
|
not affect the compilation process.
|
||||||
.sp
|
.sp
|
||||||
aftertext show text after match
|
aftertext show text after match
|
||||||
allaftertext show text after captures
|
allaftertext show text after captures
|
||||||
allcaptures show all captures
|
allcaptures show all captures
|
||||||
allusedtext show all consulted text
|
allusedtext show all consulted text
|
||||||
/g global global matching
|
/g global global matching
|
||||||
mark show mark values
|
mark show mark values
|
||||||
|
startchar show starting character when relevant
|
||||||
.sp
|
.sp
|
||||||
These modifiers may not appear in a \fB#pattern\fP command. If you want them as
|
These modifiers may not appear in a \fB#pattern\fP command. If you want them as
|
||||||
defaults, set them in a \fB#subject\fP command.
|
defaults, set them in a \fB#subject\fP command.
|
||||||
|
@ -710,6 +716,7 @@ pattern.
|
||||||
offset=<n> set starting offset
|
offset=<n> set starting offset
|
||||||
ovector=<n> set size of output vector
|
ovector=<n> set size of output vector
|
||||||
recursion_limit=<n> set a recursion limit
|
recursion_limit=<n> set a recursion limit
|
||||||
|
startchar show startchar when relevant
|
||||||
.sp
|
.sp
|
||||||
The effects of these modifiers are described in the following sections.
|
The effects of these modifiers are described in the following sections.
|
||||||
FIXME: Give more examples.
|
FIXME: Give more examples.
|
||||||
|
@ -735,13 +742,28 @@ there is a lookbehind at the start of a match, or a lookahead at the end, or if
|
||||||
of the actual match are indicated in the output by '<' or '>' characters
|
of the actual match are indicated in the output by '<' or '>' characters
|
||||||
underneath them. Here is an example:
|
underneath them. Here is an example:
|
||||||
.sp
|
.sp
|
||||||
/(?<=pqr)abc(?=xyz)/
|
re> /(?<=pqr)abc(?=xyz)/
|
||||||
123pqrabcxyz456\e=allusedtext
|
data> 123pqrabcxyz456\e=allusedtext
|
||||||
0: pqrabcxyz
|
0: pqrabcxyz
|
||||||
<<< >>>
|
<<< >>>
|
||||||
.sp
|
.sp
|
||||||
This shows that the matched string is "abc", with the preceding and following
|
This shows that the matched string is "abc", with the preceding and following
|
||||||
strings "pqr" and "xyz" also consulted during the match.
|
strings "pqr" and "xyz" also consulted during the match.
|
||||||
|
.P
|
||||||
|
The \fBstartchar\fP modifier requests that the starting character for the match
|
||||||
|
be indicated, if it is different to the start of the matched string. The only
|
||||||
|
time when this occurs is when \eK has been processed as part of the match. In
|
||||||
|
this situation, the output for the matched string is displayed from the
|
||||||
|
starting character instead of from the match point, with circumflex characters
|
||||||
|
under the earlier characters. For example:
|
||||||
|
.sp
|
||||||
|
re> /abc\eKxyz/
|
||||||
|
data> abcxyz\e=startchar
|
||||||
|
0: abcxyz
|
||||||
|
^^^
|
||||||
|
.sp
|
||||||
|
Unlike \fBallusedtext\fP, the \fBstartchar\fP modifier can be used with JIT.
|
||||||
|
However, these two modifiers are mutually exclusive.
|
||||||
.
|
.
|
||||||
.
|
.
|
||||||
.SS "Showing the value of all capture groups"
|
.SS "Showing the value of all capture groups"
|
||||||
|
@ -890,11 +912,13 @@ appears, though of course it can also be used to set a default in a
|
||||||
\fB#subject\fP command. It specifies the number of pairs of offsets that are
|
\fB#subject\fP command. It specifies the number of pairs of offsets that are
|
||||||
available for storing matching information. The default is 15.
|
available for storing matching information. The default is 15.
|
||||||
.P
|
.P
|
||||||
At least one pair of offsets is always created by
|
A value of zero is useful when testing the POSIX API because it causes
|
||||||
\fBpcre2_match_data_create()\fP, for matching with PCRE2's native API, so a
|
\fBregexec()\fP to be called with a NULL capture vector. When not testing the
|
||||||
value of 0 is the same as 1. However a value of 0 is useful when testing the
|
POSIX API, a value of zero is used to cause
|
||||||
POSIX API because it causes \fBregexec()\fP to be called with a NULL capture
|
\fBpcre2_match_data_create_from_pattern\fP to be called, in order to create a
|
||||||
vector.
|
match block of exactly the right size for the pattern. (It is not possible to
|
||||||
|
create a match block with a zero-length ovector; there is always one pair of
|
||||||
|
offsets.)
|
||||||
.
|
.
|
||||||
.
|
.
|
||||||
.SH "THE ALTERNATIVE MATCHING FUNCTION"
|
.SH "THE ALTERNATIVE MATCHING FUNCTION"
|
||||||
|
@ -1159,6 +1183,6 @@ Cambridge CB2 3QH, England.
|
||||||
.rs
|
.rs
|
||||||
.sp
|
.sp
|
||||||
.nf
|
.nf
|
||||||
Last updated: 11 October 2014
|
Last updated: 31 October 2014
|
||||||
Copyright (c) 1997-2014 University of Cambridge.
|
Copyright (c) 1997-2014 University of Cambridge.
|
||||||
.fi
|
.fi
|
||||||
|
|
|
@ -196,29 +196,30 @@ greater than zero. */
|
||||||
/* Error codes for pcre2[_dfa]_match(), substring extraction functions, and
|
/* Error codes for pcre2[_dfa]_match(), substring extraction functions, and
|
||||||
context functions. */
|
context functions. */
|
||||||
|
|
||||||
#define PCRE2_ERROR_BADDATA (-29)
|
#define PCRE2_ERROR_BADDATA (-29)
|
||||||
#define PCRE2_ERROR_BADLENGTH (-30)
|
#define PCRE2_ERROR_BADLENGTH (-30)
|
||||||
#define PCRE2_ERROR_BADMAGIC (-31)
|
#define PCRE2_ERROR_BADMAGIC (-31)
|
||||||
#define PCRE2_ERROR_BADMODE (-32)
|
#define PCRE2_ERROR_BADMODE (-32)
|
||||||
#define PCRE2_ERROR_BADOFFSET (-33)
|
#define PCRE2_ERROR_BADOFFSET (-33)
|
||||||
#define PCRE2_ERROR_BADOPTION (-34)
|
#define PCRE2_ERROR_BADOPTION (-34)
|
||||||
#define PCRE2_ERROR_BADUTFOFFSET (-35)
|
#define PCRE2_ERROR_BADUTFOFFSET (-35)
|
||||||
#define PCRE2_ERROR_CALLOUT (-36) /* Never used by PCRE2 itself */
|
#define PCRE2_ERROR_CALLOUT (-36) /* Never used by PCRE2 itself */
|
||||||
#define PCRE2_ERROR_DFA_BADRESTART (-37)
|
#define PCRE2_ERROR_DFA_BADRESTART (-37)
|
||||||
#define PCRE2_ERROR_DFA_RECURSE (-38)
|
#define PCRE2_ERROR_DFA_RECURSE (-38)
|
||||||
#define PCRE2_ERROR_DFA_UCOND (-39)
|
#define PCRE2_ERROR_DFA_UCOND (-39)
|
||||||
#define PCRE2_ERROR_DFA_UITEM (-40)
|
#define PCRE2_ERROR_DFA_UITEM (-40)
|
||||||
#define PCRE2_ERROR_DFA_WSSIZE (-41)
|
#define PCRE2_ERROR_DFA_WSSIZE (-41)
|
||||||
#define PCRE2_ERROR_INTERNAL (-42)
|
#define PCRE2_ERROR_INTERNAL (-42)
|
||||||
#define PCRE2_ERROR_JIT_BADOPTION (-43)
|
#define PCRE2_ERROR_JIT_BADOPTION (-43)
|
||||||
#define PCRE2_ERROR_JIT_STACKLIMIT (-44)
|
#define PCRE2_ERROR_JIT_STACKLIMIT (-44)
|
||||||
#define PCRE2_ERROR_MATCHLIMIT (-45)
|
#define PCRE2_ERROR_MATCHLIMIT (-45)
|
||||||
#define PCRE2_ERROR_NOMEMORY (-46)
|
#define PCRE2_ERROR_NOMEMORY (-46)
|
||||||
#define PCRE2_ERROR_NOSUBSTRING (-47)
|
#define PCRE2_ERROR_NOSUBSTRING (-47)
|
||||||
#define PCRE2_ERROR_NULL (-48)
|
#define PCRE2_ERROR_NOUNIQUESUBSTRING (-48)
|
||||||
#define PCRE2_ERROR_RECURSELOOP (-49)
|
#define PCRE2_ERROR_NULL (-49)
|
||||||
#define PCRE2_ERROR_RECURSIONLIMIT (-50)
|
#define PCRE2_ERROR_RECURSELOOP (-50)
|
||||||
#define PCRE2_ERROR_UNSET (-51)
|
#define PCRE2_ERROR_RECURSIONLIMIT (-51)
|
||||||
|
#define PCRE2_ERROR_UNSET (-52)
|
||||||
|
|
||||||
/* Request types for pcre2_pattern_info() */
|
/* Request types for pcre2_pattern_info() */
|
||||||
|
|
||||||
|
|
|
@ -6068,7 +6068,7 @@ for (;; ptr++)
|
||||||
/* Process nested bracketed regex. First check for parentheses nested too
|
/* Process nested bracketed regex. First check for parentheses nested too
|
||||||
deeply. */
|
deeply. */
|
||||||
|
|
||||||
if ((cb->parens_depth += 1) > PARENS_NEST_LIMIT)
|
if ((cb->parens_depth += 1) > (int)(cb->cx->parens_nest_limit))
|
||||||
{
|
{
|
||||||
*errorcodeptr = ERR19;
|
*errorcodeptr = ERR19;
|
||||||
goto FAILED;
|
goto FAILED;
|
||||||
|
@ -7786,7 +7786,7 @@ if (cb.hwm > cb.start_workspace)
|
||||||
NULL to indicate that forward references have been filled in. */
|
NULL to indicate that forward references have been filled in. */
|
||||||
|
|
||||||
if (cb.workspace_size > COMPILE_WORK_SIZE)
|
if (cb.workspace_size > COMPILE_WORK_SIZE)
|
||||||
ccontext->memctl.free((void *)cb.start_workspace,
|
ccontext->memctl.free((void *)cb.start_workspace,
|
||||||
ccontext->memctl.memory_data);
|
ccontext->memctl.memory_data);
|
||||||
cb.start_workspace = NULL;
|
cb.start_workspace = NULL;
|
||||||
|
|
||||||
|
|
|
@ -221,9 +221,10 @@ static const char match_error_texts[] =
|
||||||
"match limit exceeded\0"
|
"match limit exceeded\0"
|
||||||
"no more memory\0"
|
"no more memory\0"
|
||||||
"unknown or unset substring\0"
|
"unknown or unset substring\0"
|
||||||
|
"non-unique substring name\0"
|
||||||
"NULL argument passed\0"
|
"NULL argument passed\0"
|
||||||
"nested recursion at the same subject position\0"
|
|
||||||
/* 50 */
|
/* 50 */
|
||||||
|
"nested recursion at the same subject position\0"
|
||||||
"recursion limit exceeded\0"
|
"recursion limit exceeded\0"
|
||||||
"requested value is not set\0"
|
"requested value is not set\0"
|
||||||
;
|
;
|
||||||
|
|
|
@ -1127,7 +1127,7 @@ static int regression_tests(void)
|
||||||
#elif defined SUPPORT_PCRE2_16
|
#elif defined SUPPORT_PCRE2_16
|
||||||
pcre2_config_16(PCRE2_CONFIG_JITTARGET, &cpu_info);
|
pcre2_config_16(PCRE2_CONFIG_JITTARGET, &cpu_info);
|
||||||
#elif defined SUPPORT_PCRE2_32
|
#elif defined SUPPORT_PCRE2_32
|
||||||
pcre2_config_32(PCRE2_CONFIG_JITTARGET, &cpu_info));
|
pcre2_config_32(PCRE2_CONFIG_JITTARGET, &cpu_info);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
printf("Running JIT regression tests\n");
|
printf("Running JIT regression tests\n");
|
||||||
|
|
|
@ -409,7 +409,8 @@ Arguments:
|
||||||
firstptr where to put the pointer to the first entry
|
firstptr where to put the pointer to the first entry
|
||||||
lastptr where to put the pointer to the last entry
|
lastptr where to put the pointer to the last entry
|
||||||
|
|
||||||
Returns: if firstptr and lastptr are NULL, a group number;
|
Returns: if firstptr and lastptr are NULL, a group number for a
|
||||||
|
unique substring, or PCRE2_ERROR_NOUNIQUESUBSTRING
|
||||||
otherwise, the length of each entry, or a negative number
|
otherwise, the length of each entry, or a negative number
|
||||||
(PCRE2_ERROR_NOSUBSTRING) if not found
|
(PCRE2_ERROR_NOSUBSTRING) if not found
|
||||||
*/
|
*/
|
||||||
|
@ -433,7 +434,6 @@ while (top > bot)
|
||||||
PCRE2_SPTR first;
|
PCRE2_SPTR first;
|
||||||
PCRE2_SPTR last;
|
PCRE2_SPTR last;
|
||||||
PCRE2_SPTR lastentry;
|
PCRE2_SPTR lastentry;
|
||||||
if (firstptr == NULL) return GET2(entry, 0);
|
|
||||||
lastentry = nametable + entrysize * (code->name_count - 1);
|
lastentry = nametable + entrysize * (code->name_count - 1);
|
||||||
first = last = entry;
|
first = last = entry;
|
||||||
while (first > nametable)
|
while (first > nametable)
|
||||||
|
@ -446,6 +446,8 @@ while (top > bot)
|
||||||
if (PRIV(strcmp)(stringname, (last + entrysize + IMM2_SIZE)) != 0) break;
|
if (PRIV(strcmp)(stringname, (last + entrysize + IMM2_SIZE)) != 0) break;
|
||||||
last += entrysize;
|
last += entrysize;
|
||||||
}
|
}
|
||||||
|
if (firstptr == NULL)
|
||||||
|
return (first == last)? (int)GET2(entry, 0) : PCRE2_ERROR_NOUNIQUESUBSTRING;
|
||||||
*firstptr = first;
|
*firstptr = first;
|
||||||
*lastptr = last;
|
*lastptr = last;
|
||||||
return entrysize;
|
return entrysize;
|
||||||
|
|
511
src/pcre2test.c
511
src/pcre2test.c
|
@ -319,29 +319,30 @@ enum { MOD_CTC, /* Applies to a compile context */
|
||||||
/* Control bits. Some apply to compiling, some to matching, but some can be set
|
/* Control bits. Some apply to compiling, some to matching, but some can be set
|
||||||
either on a pattern or a data line, so they must all be distinct. */
|
either on a pattern or a data line, so they must all be distinct. */
|
||||||
|
|
||||||
#define CTL_AFTERTEXT 0x00000001u
|
#define CTL_AFTERTEXT 0x00000001u
|
||||||
#define CTL_ALLAFTERTEXT 0x00000002u
|
#define CTL_ALLAFTERTEXT 0x00000002u
|
||||||
#define CTL_ALLCAPTURES 0x00000004u
|
#define CTL_ALLCAPTURES 0x00000004u
|
||||||
#define CTL_ALLUSEDTEXT 0x00000008u
|
#define CTL_ALLUSEDTEXT 0x00000008u
|
||||||
#define CTL_ALTGLOBAL 0x00000010u
|
#define CTL_ALTGLOBAL 0x00000010u
|
||||||
#define CTL_BINCODE 0x00000020u
|
#define CTL_BINCODE 0x00000020u
|
||||||
#define CTL_CALLOUT_CAPTURE 0x00000040u
|
#define CTL_CALLOUT_CAPTURE 0x00000040u
|
||||||
#define CTL_CALLOUT_NONE 0x00000080u
|
#define CTL_CALLOUT_NONE 0x00000080u
|
||||||
#define CTL_DFA 0x00000100u
|
#define CTL_DFA 0x00000100u
|
||||||
#define CTL_FINDLIMITS 0x00000200u
|
#define CTL_FINDLIMITS 0x00000200u
|
||||||
#define CTL_FULLBINCODE 0x00000400u
|
#define CTL_FULLBINCODE 0x00000400u
|
||||||
#define CTL_GETALL 0x00000800u
|
#define CTL_GETALL 0x00000800u
|
||||||
#define CTL_GLOBAL 0x00001000u
|
#define CTL_GLOBAL 0x00001000u
|
||||||
#define CTL_HEXPAT 0x00002000u
|
#define CTL_HEXPAT 0x00002000u
|
||||||
#define CTL_INFO 0x00004000u
|
#define CTL_INFO 0x00004000u
|
||||||
#define CTL_JITVERIFY 0x00008000u
|
#define CTL_JITVERIFY 0x00008000u
|
||||||
#define CTL_MARK 0x00010000u
|
#define CTL_MARK 0x00010000u
|
||||||
#define CTL_MEMORY 0x00020000u
|
#define CTL_MEMORY 0x00020000u
|
||||||
#define CTL_PATLEN 0x00040000u
|
#define CTL_PATLEN 0x00040000u
|
||||||
#define CTL_POSIX 0x00080000u
|
#define CTL_POSIX 0x00080000u
|
||||||
|
#define CTL_STARTCHAR 0x00100000u
|
||||||
|
|
||||||
#define CTL_BSR_SET 0x00100000u /* This is informational */
|
#define CTL_BSR_SET 0x80000000u /* This is informational */
|
||||||
#define CTL_NL_SET 0x00200000u /* This is informational */
|
#define CTL_NL_SET 0x40000000u /* This is informational */
|
||||||
|
|
||||||
#define CTL_DEBUG (CTL_FULLBINCODE|CTL_INFO) /* For setting */
|
#define CTL_DEBUG (CTL_FULLBINCODE|CTL_INFO) /* For setting */
|
||||||
#define CTL_ANYINFO (CTL_DEBUG|CTL_BINCODE) /* For testing */
|
#define CTL_ANYINFO (CTL_DEBUG|CTL_BINCODE) /* For testing */
|
||||||
|
@ -358,7 +359,8 @@ data line. */
|
||||||
CTL_GLOBAL|\
|
CTL_GLOBAL|\
|
||||||
CTL_JITVERIFY|\
|
CTL_JITVERIFY|\
|
||||||
CTL_MARK|\
|
CTL_MARK|\
|
||||||
CTL_MEMORY)
|
CTL_MEMORY|\
|
||||||
|
CTL_STARTCHAR)
|
||||||
|
|
||||||
typedef struct patctl { /* Structure for pattern modifiers. */
|
typedef struct patctl { /* Structure for pattern modifiers. */
|
||||||
uint32_t options; /* Must be in same position as datctl */
|
uint32_t options; /* Must be in same position as datctl */
|
||||||
|
@ -476,6 +478,7 @@ static modstruct modlist[] = {
|
||||||
{ "ps", MOD_DAT, MOD_OPT, PCRE2_PARTIAL_SOFT, DO(options) },
|
{ "ps", MOD_DAT, MOD_OPT, PCRE2_PARTIAL_SOFT, DO(options) },
|
||||||
{ "recursion_limit", MOD_CTM, MOD_INT, 0, MO(recursion_limit) },
|
{ "recursion_limit", MOD_CTM, MOD_INT, 0, MO(recursion_limit) },
|
||||||
{ "stackguard", MOD_PAT, MOD_INT, 0, PO(stackguard_test) },
|
{ "stackguard", MOD_PAT, MOD_INT, 0, PO(stackguard_test) },
|
||||||
|
{ "startchar", MOD_PND, MOD_CTL, CTL_STARTCHAR, PO(control) },
|
||||||
{ "tables", MOD_PAT, MOD_INT, 0, PO(tables_id) },
|
{ "tables", MOD_PAT, MOD_INT, 0, PO(tables_id) },
|
||||||
{ "ucp", MOD_PATP, MOD_OPT, PCRE2_UCP, PO(options) },
|
{ "ucp", MOD_PATP, MOD_OPT, PCRE2_UCP, PO(options) },
|
||||||
{ "ungreedy", MOD_PAT, MOD_OPT, PCRE2_UNGREEDY, PO(options) },
|
{ "ungreedy", MOD_PAT, MOD_OPT, PCRE2_UNGREEDY, PO(options) },
|
||||||
|
@ -499,6 +502,10 @@ static modstruct modlist[] = {
|
||||||
|
|
||||||
#define POSIX_SUPPORTED_MATCH_CONTROLS (CTL_AFTERTEXT|CTL_ALLAFTERTEXT)
|
#define POSIX_SUPPORTED_MATCH_CONTROLS (CTL_AFTERTEXT|CTL_ALLAFTERTEXT)
|
||||||
|
|
||||||
|
/* Controls that are mutually exclusive. */
|
||||||
|
|
||||||
|
#define EXCLUSIVE_DAT_CONTROLS (CTL_ALLUSEDTEXT|CTL_STARTCHAR)
|
||||||
|
|
||||||
/* Table of single-character abbreviated modifiers. The index field is
|
/* Table of single-character abbreviated modifiers. The index field is
|
||||||
initialized to -1, but the first time the modifier is encountered, it is filled
|
initialized to -1, but the first time the modifier is encountered, it is filled
|
||||||
in with the index of the full entry in modlist, to save repeated searching when
|
in with the index of the full entry in modlist, to save repeated searching when
|
||||||
|
@ -654,7 +661,7 @@ static uint8_t *dbuffer = NULL;
|
||||||
|
|
||||||
#ifdef SUPPORT_PCRE2_8
|
#ifdef SUPPORT_PCRE2_8
|
||||||
static pcre2_code_8 *compiled_code8;
|
static pcre2_code_8 *compiled_code8;
|
||||||
static pcre2_general_context_8 *general_context8;
|
static pcre2_general_context_8 *general_context8, *general_context_copy8;
|
||||||
static pcre2_compile_context_8 *pat_context8, *default_pat_context8;
|
static pcre2_compile_context_8 *pat_context8, *default_pat_context8;
|
||||||
static pcre2_match_context_8 *dat_context8, *default_dat_context8;
|
static pcre2_match_context_8 *dat_context8, *default_dat_context8;
|
||||||
static pcre2_match_data_8 *match_data8;
|
static pcre2_match_data_8 *match_data8;
|
||||||
|
@ -662,7 +669,7 @@ static pcre2_match_data_8 *match_data8;
|
||||||
|
|
||||||
#ifdef SUPPORT_PCRE2_16
|
#ifdef SUPPORT_PCRE2_16
|
||||||
static pcre2_code_16 *compiled_code16;
|
static pcre2_code_16 *compiled_code16;
|
||||||
static pcre2_general_context_16 *general_context16;
|
static pcre2_general_context_16 *general_context16, *general_context_copy16;
|
||||||
static pcre2_compile_context_16 *pat_context16, *default_pat_context16;
|
static pcre2_compile_context_16 *pat_context16, *default_pat_context16;
|
||||||
static pcre2_match_context_16 *dat_context16, *default_dat_context16;
|
static pcre2_match_context_16 *dat_context16, *default_dat_context16;
|
||||||
static pcre2_match_data_16 *match_data16;
|
static pcre2_match_data_16 *match_data16;
|
||||||
|
@ -672,7 +679,7 @@ static uint16_t *pbuffer16 = NULL;
|
||||||
|
|
||||||
#ifdef SUPPORT_PCRE2_32
|
#ifdef SUPPORT_PCRE2_32
|
||||||
static pcre2_code_32 *compiled_code32;
|
static pcre2_code_32 *compiled_code32;
|
||||||
static pcre2_general_context_32 *general_context32;
|
static pcre2_general_context_32 *general_context32, *general_context_copy32;
|
||||||
static pcre2_compile_context_32 *pat_context32, *default_pat_context32;
|
static pcre2_compile_context_32 *pat_context32, *default_pat_context32;
|
||||||
static pcre2_match_context_32 *dat_context32, *default_dat_context32;
|
static pcre2_match_context_32 *dat_context32, *default_dat_context32;
|
||||||
static pcre2_match_data_32 *match_data32;
|
static pcre2_match_data_32 *match_data32;
|
||||||
|
@ -771,11 +778,32 @@ are supported. */
|
||||||
else \
|
else \
|
||||||
r = pcre2_get_error_message_32(a,G(b,32),G(G(b,32),_size))
|
r = pcre2_get_error_message_32(a,G(b,32),G(G(b,32),_size))
|
||||||
|
|
||||||
|
#define PCRE2_GET_OVECTOR_COUNT(a,b) \
|
||||||
|
if (test_mode == PCRE8_MODE) \
|
||||||
|
a = pcre2_get_ovector_count_8(G(b,8)); \
|
||||||
|
else if (test_mode == PCRE16_MODE) \
|
||||||
|
a = pcre2_get_ovector_count_16(G(b,16)); \
|
||||||
|
else \
|
||||||
|
a = pcre2_get_ovector_count_32(G(b,32))
|
||||||
|
|
||||||
|
#define PCRE2_GET_STARTCHAR(a,b) \
|
||||||
|
if (test_mode == PCRE8_MODE) \
|
||||||
|
a = pcre2_get_startchar_8(G(b,8)); \
|
||||||
|
else if (test_mode == PCRE16_MODE) \
|
||||||
|
a = pcre2_get_startchar_16(G(b,16)); \
|
||||||
|
else \
|
||||||
|
a = pcre2_get_startchar_32(G(b,32))
|
||||||
|
|
||||||
#define PCRE2_JIT_COMPILE(a,b) \
|
#define PCRE2_JIT_COMPILE(a,b) \
|
||||||
if (test_mode == PCRE8_MODE) pcre2_jit_compile_8(G(a,8),b); \
|
if (test_mode == PCRE8_MODE) pcre2_jit_compile_8(G(a,8),b); \
|
||||||
else if (test_mode == PCRE16_MODE) pcre2_jit_compile_16(G(a,16),b); \
|
else if (test_mode == PCRE16_MODE) pcre2_jit_compile_16(G(a,16),b); \
|
||||||
else pcre2_jit_compile_32(G(a,32),b)
|
else pcre2_jit_compile_32(G(a,32),b)
|
||||||
|
|
||||||
|
#define PCRE2_JIT_FREE_UNUSED_MEMORY(a) \
|
||||||
|
if (test_mode == PCRE8_MODE) pcre2_jit_free_unused_memory_8(G(a,8)); \
|
||||||
|
else if (test_mode == PCRE16_MODE) pcre2_jit_free_unused_memory_16(G(a,16)); \
|
||||||
|
else pcre2_jit_free_unused_memory_32(G(a,32))
|
||||||
|
|
||||||
#define PCRE2_JIT_STACK_ALLOC(a,b,c,d) \
|
#define PCRE2_JIT_STACK_ALLOC(a,b,c,d) \
|
||||||
if (test_mode == PCRE8_MODE) \
|
if (test_mode == PCRE8_MODE) \
|
||||||
a = (PCRE2_JIT_STACK *)pcre2_jit_stack_alloc_8(b,c,d); \
|
a = (PCRE2_JIT_STACK *)pcre2_jit_stack_alloc_8(b,c,d); \
|
||||||
|
@ -821,6 +849,14 @@ are supported. */
|
||||||
else \
|
else \
|
||||||
G(a,32) = pcre2_match_data_create_32(b,c)
|
G(a,32) = pcre2_match_data_create_32(b,c)
|
||||||
|
|
||||||
|
#define PCRE2_MATCH_DATA_CREATE_FROM_PATTERN(a,b,c) \
|
||||||
|
if (test_mode == PCRE8_MODE) \
|
||||||
|
G(a,8) = pcre2_match_data_create_from_pattern_8(G(b,8),c); \
|
||||||
|
else if (test_mode == PCRE16_MODE) \
|
||||||
|
G(a,16) = pcre2_match_data_create_from_pattern_16(G(b,16),c); \
|
||||||
|
else \
|
||||||
|
G(a,32) = pcre2_match_data_create_from_pattern_32(G(b,32),c)
|
||||||
|
|
||||||
#define PCRE2_MATCH_DATA_FREE(a) \
|
#define PCRE2_MATCH_DATA_FREE(a) \
|
||||||
if (test_mode == PCRE8_MODE) \
|
if (test_mode == PCRE8_MODE) \
|
||||||
pcre2_match_data_free_8(G(a,8)); \
|
pcre2_match_data_free_8(G(a,8)); \
|
||||||
|
@ -877,6 +913,14 @@ are supported. */
|
||||||
else \
|
else \
|
||||||
pcre2_set_match_limit_32(G(a,32),b)
|
pcre2_set_match_limit_32(G(a,32),b)
|
||||||
|
|
||||||
|
#define PCRE2_SET_PARENS_NEST_LIMIT(a,b) \
|
||||||
|
if (test_mode == PCRE8_MODE) \
|
||||||
|
pcre2_set_parens_nest_limit_8(G(a,8),b); \
|
||||||
|
else if (test_mode == PCRE16_MODE) \
|
||||||
|
pcre2_set_parens_nest_limit_16(G(a,16),b); \
|
||||||
|
else \
|
||||||
|
pcre2_set_parens_nest_limit_32(G(a,32),b)
|
||||||
|
|
||||||
#define PCRE2_SET_RECURSION_LIMIT(a,b) \
|
#define PCRE2_SET_RECURSION_LIMIT(a,b) \
|
||||||
if (test_mode == PCRE8_MODE) \
|
if (test_mode == PCRE8_MODE) \
|
||||||
pcre2_set_recursion_limit_8(G(a,8),b); \
|
pcre2_set_recursion_limit_8(G(a,8),b); \
|
||||||
|
@ -923,6 +967,22 @@ are supported. */
|
||||||
else \
|
else \
|
||||||
a = pcre2_substring_get_bynumber_32(G(b,32),c,(PCRE2_UCHAR32 **)d,e)
|
a = pcre2_substring_get_bynumber_32(G(b,32),c,(PCRE2_UCHAR32 **)d,e)
|
||||||
|
|
||||||
|
#define PCRE2_SUBSTRING_LENGTH_BYNAME(a,b,c,d) \
|
||||||
|
if (test_mode == PCRE8_MODE) \
|
||||||
|
a = pcre2_substring_length_byname_8(G(b,8),G(c,8),d); \
|
||||||
|
else if (test_mode == PCRE16_MODE) \
|
||||||
|
a = pcre2_substring_length_byname_16(G(b,16),G(c,16),d); \
|
||||||
|
else \
|
||||||
|
a = pcre2_substring_length_byname_32(G(b,32),G(c,32),d)
|
||||||
|
|
||||||
|
#define PCRE2_SUBSTRING_LENGTH_BYNUMBER(a,b,c,d) \
|
||||||
|
if (test_mode == PCRE8_MODE) \
|
||||||
|
a = pcre2_substring_length_bynumber_8(G(b,8),c,d); \
|
||||||
|
else if (test_mode == PCRE16_MODE) \
|
||||||
|
a = pcre2_substring_length_bynumber_16(G(b,16),c,d); \
|
||||||
|
else \
|
||||||
|
a = pcre2_substring_length_bynumber_32(G(b,32),c,d)
|
||||||
|
|
||||||
#define PCRE2_SUBSTRING_LIST_GET(a,b,c,d) \
|
#define PCRE2_SUBSTRING_LIST_GET(a,b,c,d) \
|
||||||
if (test_mode == PCRE8_MODE) \
|
if (test_mode == PCRE8_MODE) \
|
||||||
a = pcre2_substring_list_get_8(G(b,8),(PCRE2_UCHAR8 ***)c,d); \
|
a = pcre2_substring_list_get_8(G(b,8),(PCRE2_UCHAR8 ***)c,d); \
|
||||||
|
@ -939,6 +999,14 @@ are supported. */
|
||||||
else \
|
else \
|
||||||
pcre2_substring_list_free_32((PCRE2_SPTR32 *)a)
|
pcre2_substring_list_free_32((PCRE2_SPTR32 *)a)
|
||||||
|
|
||||||
|
#define PCRE2_SUBSTRING_NUMBER_FROM_NAME(a,b,c) \
|
||||||
|
if (test_mode == PCRE8_MODE) \
|
||||||
|
a = pcre2_substring_number_from_name_8(G(b,8),G(c,8)); \
|
||||||
|
else if (test_mode == PCRE16_MODE) \
|
||||||
|
a = pcre2_substring_number_from_name_16(G(b,16),G(c,16)); \
|
||||||
|
else \
|
||||||
|
a = pcre2_substring_number_from_name_32(G(b,32),G(c,32))
|
||||||
|
|
||||||
#define PTR(x) ( \
|
#define PTR(x) ( \
|
||||||
(test_mode == PCRE8_MODE)? (void *)G(x,8) : \
|
(test_mode == PCRE8_MODE)? (void *)G(x,8) : \
|
||||||
(test_mode == PCRE16_MODE)? (void *)G(x,16) : \
|
(test_mode == PCRE16_MODE)? (void *)G(x,16) : \
|
||||||
|
@ -1082,12 +1150,30 @@ the three different cases. */
|
||||||
else \
|
else \
|
||||||
r = G(pcre2_get_error_message_,BITTWO)(a,G(b,BITTWO),G(G(b,BITTWO),_size))
|
r = G(pcre2_get_error_message_,BITTWO)(a,G(b,BITTWO),G(G(b,BITTWO),_size))
|
||||||
|
|
||||||
|
#define PCRE2_GET_OVECTOR_COUNT(a,b) \
|
||||||
|
if (test_mode == G(G(PCRE,BITONE),_MODE)) \
|
||||||
|
a = G(pcre2_get_ovector_count_,BITONE)(G(b,BITONE)); \
|
||||||
|
else \
|
||||||
|
a = G(pcre2_get_ovector_count_,BITTWO)(G(b,BITTWO))
|
||||||
|
|
||||||
|
#define PCRE2_GET_STARTCHAR(a,b) \
|
||||||
|
if (test_mode == G(G(PCRE,BITONE),_MODE)) \
|
||||||
|
a = G(pcre2_get_startchar_,BITONE)(G(b,BITONE)); \
|
||||||
|
else \
|
||||||
|
a = G(pcre2_get_startchar_,BITTWO)(G(b,BITTWO))
|
||||||
|
|
||||||
#define PCRE2_JIT_COMPILE(a,b) \
|
#define PCRE2_JIT_COMPILE(a,b) \
|
||||||
if (test_mode == G(G(PCRE,BITONE),_MODE)) \
|
if (test_mode == G(G(PCRE,BITONE),_MODE)) \
|
||||||
G(pcre2_jit_compile_,BITONE)(G(a,BITONE),b); \
|
G(pcre2_jit_compile_,BITONE)(G(a,BITONE),b); \
|
||||||
else \
|
else \
|
||||||
G(pcre2_jit_compile_,BITTWO)(G(a,BITTWO),b)
|
G(pcre2_jit_compile_,BITTWO)(G(a,BITTWO),b)
|
||||||
|
|
||||||
|
#define PCRE2_JIT_FREE_UNUSED_MEMORY(a) \
|
||||||
|
if (test_mode == G(G(PCRE,BITONE),_MODE)) \
|
||||||
|
G(pcre2_jit_free_unused_memory_,BITONE)(G(a,BITONE)); \
|
||||||
|
else \
|
||||||
|
G(pcre2_jit_free_unused_memory_,BITTWO)(G(a,BITTWO))
|
||||||
|
|
||||||
#define PCRE2_JIT_STACK_ALLOC(a,b,c,d) \
|
#define PCRE2_JIT_STACK_ALLOC(a,b,c,d) \
|
||||||
if (test_mode == G(G(PCRE,BITONE),_MODE)) \
|
if (test_mode == G(G(PCRE,BITONE),_MODE)) \
|
||||||
a = (PCRE2_JIT_STACK *)G(pcre2_jit_stack_alloc_,BITONE)(b,c,d); \
|
a = (PCRE2_JIT_STACK *)G(pcre2_jit_stack_alloc_,BITONE)(b,c,d); \
|
||||||
|
@ -1126,6 +1212,12 @@ the three different cases. */
|
||||||
else \
|
else \
|
||||||
G(a,BITTWO) = G(pcre2_match_data_create_,BITTWO)(b,c)
|
G(a,BITTWO) = G(pcre2_match_data_create_,BITTWO)(b,c)
|
||||||
|
|
||||||
|
#define PCRE2_MATCH_DATA_CREATE_FROM_PATTERN(a,b,c) \
|
||||||
|
if (test_mode == G(G(PCRE,BITONE),_MODE)) \
|
||||||
|
G(a,BITONE) = G(pcre2_match_data_create_from_pattern_,BITONE)(G(b,BITONE),c); \
|
||||||
|
else \
|
||||||
|
G(a,BITTWO) = G(pcre2_match_data_create_from_pattern_,BITTWO)(G(b,BITTWO),c)
|
||||||
|
|
||||||
#define PCRE2_MATCH_DATA_FREE(a) \
|
#define PCRE2_MATCH_DATA_FREE(a) \
|
||||||
if (test_mode == G(G(PCRE,BITONE),_MODE)) \
|
if (test_mode == G(G(PCRE,BITONE),_MODE)) \
|
||||||
G(pcre2_match_data_free_,BITONE)(G(a,BITONE)); \
|
G(pcre2_match_data_free_,BITONE)(G(a,BITONE)); \
|
||||||
|
@ -1170,6 +1262,12 @@ the three different cases. */
|
||||||
else \
|
else \
|
||||||
G(pcre2_set_match_limit_,BITTWO)(G(a,BITTWO),b)
|
G(pcre2_set_match_limit_,BITTWO)(G(a,BITTWO),b)
|
||||||
|
|
||||||
|
#define PCRE2_SET_PARENS_NEST_LIMIT(a,b) \
|
||||||
|
if (test_mode == G(G(PCRE,BITONE),_MODE)) \
|
||||||
|
G(pcre2_set_parens_nest_limit_,BITONE)(G(a,BITONE),b); \
|
||||||
|
else \
|
||||||
|
G(pcre2_set_parens_nest_limit_,BITTWO)(G(a,BITTWO),b)
|
||||||
|
|
||||||
#define PCRE2_SET_RECURSION_LIMIT(a,b) \
|
#define PCRE2_SET_RECURSION_LIMIT(a,b) \
|
||||||
if (test_mode == G(G(PCRE,BITONE),_MODE)) \
|
if (test_mode == G(G(PCRE,BITONE),_MODE)) \
|
||||||
G(pcre2_set_recursion_limit_,BITONE)(G(a,BITONE),b); \
|
G(pcre2_set_recursion_limit_,BITONE)(G(a,BITONE),b); \
|
||||||
|
@ -1213,6 +1311,18 @@ the three different cases. */
|
||||||
a = G(pcre2_substring_get_bynumber_,BITTWO)(G(b,BITTWO),c,\
|
a = G(pcre2_substring_get_bynumber_,BITTWO)(G(b,BITTWO),c,\
|
||||||
(G(PCRE2_UCHAR,BITTWO) **)d,e)
|
(G(PCRE2_UCHAR,BITTWO) **)d,e)
|
||||||
|
|
||||||
|
#define PCRE2_SUBSTRING_LENGTH_BYNAME(a,b,c,d) \
|
||||||
|
if (test_mode == G(G(PCRE,BITONE),_MODE)) \
|
||||||
|
a = G(pcre2_substring_length_byname_,BITONE)(G(b,BITONE),G(c,BITONE),d); \
|
||||||
|
else \
|
||||||
|
a = G(pcre2_substring_length_byname_,BITTWO)(G(b,BITTWO),G(c,BITTWO),d)
|
||||||
|
|
||||||
|
#define PCRE2_SUBSTRING_LENGTH_BYNUMBER(a,b,c,d) \
|
||||||
|
if (test_mode == G(G(PCRE,BITONE),_MODE)) \
|
||||||
|
a = G(pcre2_substring_length_bynumber_,BITONE)(G(b,BITONE),c,d); \
|
||||||
|
else \
|
||||||
|
a = G(pcre2_substring_length_bynumber_,BITTWO)(G(b,BITTWO),c,d)
|
||||||
|
|
||||||
#define PCRE2_SUBSTRING_LIST_GET(a,b,c,d) \
|
#define PCRE2_SUBSTRING_LIST_GET(a,b,c,d) \
|
||||||
if (test_mode == G(G(PCRE,BITONE),_MODE)) \
|
if (test_mode == G(G(PCRE,BITONE),_MODE)) \
|
||||||
a = G(pcre2_substring_list_get_,BITONE)(G(b,BITONE), \
|
a = G(pcre2_substring_list_get_,BITONE)(G(b,BITONE), \
|
||||||
|
@ -1227,6 +1337,12 @@ the three different cases. */
|
||||||
else \
|
else \
|
||||||
G(pcre2_substring_list_free_,BITTWO)((G(PCRE2_SPTR,BITTWO) *)a)
|
G(pcre2_substring_list_free_,BITTWO)((G(PCRE2_SPTR,BITTWO) *)a)
|
||||||
|
|
||||||
|
#define PCRE2_SUBSTRING_NUMBER_FROM_NAME(a,b,c) \
|
||||||
|
if (test_mode == G(G(PCRE,BITONE),_MODE)) \
|
||||||
|
a = G(pcre2_substring_number_from_name_,BITONE)(G(b,BITONE),G(c,BITONE)); \
|
||||||
|
else \
|
||||||
|
a = G(pcre2_substring_number_from_name_,BITTWO)(G(b,BITTWO),G(c,BITTWO))
|
||||||
|
|
||||||
#define PTR(x) ( \
|
#define PTR(x) ( \
|
||||||
(test_mode == G(G(PCRE,BITONE),_MODE))? (void *)G(x,BITONE) : \
|
(test_mode == G(G(PCRE,BITONE),_MODE))? (void *)G(x,BITONE) : \
|
||||||
(void *)G(x,BITTWO))
|
(void *)G(x,BITTWO))
|
||||||
|
@ -1298,7 +1414,10 @@ the three different cases. */
|
||||||
a = pcre2_dfa_match_8(G(b,8),(PCRE2_SPTR8)c,d,e,f,G(g,8),G(h,8),i,j)
|
a = pcre2_dfa_match_8(G(b,8),(PCRE2_SPTR8)c,d,e,f,G(g,8),G(h,8),i,j)
|
||||||
#define PCRE2_GET_ERROR_MESSAGE(r,a,b) \
|
#define PCRE2_GET_ERROR_MESSAGE(r,a,b) \
|
||||||
r = pcre2_get_error_message_8(a,G(b,8),G(G(b,8),_size))
|
r = pcre2_get_error_message_8(a,G(b,8),G(G(b,8),_size))
|
||||||
|
#define PCRE2_GET_OVECTOR_COUNT(a,b) a = pcre2_get_ovector_count_8(G(b,8))
|
||||||
|
#define PCRE2_GET_STARTCHAR(a,b) a = pcre2_get_startchar_8(G(b,8))
|
||||||
#define PCRE2_JIT_COMPILE(a,b) pcre2_jit_compile_8(G(a,8),b)
|
#define PCRE2_JIT_COMPILE(a,b) pcre2_jit_compile_8(G(a,8),b)
|
||||||
|
#define PCRE2_JIT_FREE_UNUSED_MEMORY(a) pcre2_jit_free_unused_memory_8(G(a,8))
|
||||||
#define PCRE2_JIT_STACK_ALLOC(a,b,c,d) \
|
#define PCRE2_JIT_STACK_ALLOC(a,b,c,d) \
|
||||||
a = (PCRE2_JIT_STACK *)pcre2_jit_stack_alloc_8(b,c,d);
|
a = (PCRE2_JIT_STACK *)pcre2_jit_stack_alloc_8(b,c,d);
|
||||||
#define PCRE2_JIT_STACK_ASSIGN(a,b,c) \
|
#define PCRE2_JIT_STACK_ASSIGN(a,b,c) \
|
||||||
|
@ -1308,6 +1427,8 @@ the three different cases. */
|
||||||
#define PCRE2_MATCH(a,b,c,d,e,f,g,h) \
|
#define PCRE2_MATCH(a,b,c,d,e,f,g,h) \
|
||||||
a = pcre2_match_8(G(b,8),(PCRE2_SPTR8)c,d,e,f,G(g,8),G(h,8))
|
a = pcre2_match_8(G(b,8),(PCRE2_SPTR8)c,d,e,f,G(g,8),G(h,8))
|
||||||
#define PCRE2_MATCH_DATA_CREATE(a,b,c) G(a,8) = pcre2_match_data_create_8(b,c)
|
#define PCRE2_MATCH_DATA_CREATE(a,b,c) G(a,8) = pcre2_match_data_create_8(b,c)
|
||||||
|
#define PCRE2_MATCH_DATA_CREATE_FROM_PATTERN(a,b,c) \
|
||||||
|
G(a,8) = pcre2_match_data_create_from_pattern_8(G(b,8),c)
|
||||||
#define PCRE2_MATCH_DATA_FREE(a) pcre2_match_data_free_8(G(a,8))
|
#define PCRE2_MATCH_DATA_FREE(a) pcre2_match_data_free_8(G(a,8))
|
||||||
#define PCRE2_PATTERN_INFO(a,b,c,d) a = pcre2_pattern_info_8(G(b,8),c,d)
|
#define PCRE2_PATTERN_INFO(a,b,c,d) a = pcre2_pattern_info_8(G(b,8),c,d)
|
||||||
#define PCRE2_PRINTINT(a) pcre2_printint_8(compiled_code8,outfile,a)
|
#define PCRE2_PRINTINT(a) pcre2_printint_8(compiled_code8,outfile,a)
|
||||||
|
@ -1317,6 +1438,7 @@ the three different cases. */
|
||||||
#define PCRE2_SET_COMPILE_RECURSION_GUARD(a,b) \
|
#define PCRE2_SET_COMPILE_RECURSION_GUARD(a,b) \
|
||||||
pcre2_set_compile_recursion_guard_8(G(a,8),b)
|
pcre2_set_compile_recursion_guard_8(G(a,8),b)
|
||||||
#define PCRE2_SET_MATCH_LIMIT(a,b) pcre2_set_match_limit_8(G(a,8),b)
|
#define PCRE2_SET_MATCH_LIMIT(a,b) pcre2_set_match_limit_8(G(a,8),b)
|
||||||
|
#define PCRE2_SET_PARENS_NEST_LIMIT(a,b) pcre2_set_parens_nest_limit_8(G(a,8),b)
|
||||||
#define PCRE2_SET_RECURSION_LIMIT(a,b) pcre2_set_recursion_limit_8(G(a,8),b)
|
#define PCRE2_SET_RECURSION_LIMIT(a,b) pcre2_set_recursion_limit_8(G(a,8),b)
|
||||||
#define PCRE2_SUBSTRING_COPY_BYNAME(a,b,c,d,e) \
|
#define PCRE2_SUBSTRING_COPY_BYNAME(a,b,c,d,e) \
|
||||||
a = pcre2_substring_copy_byname_8(G(b,8),G(c,8),(PCRE2_UCHAR8 *)d,e)
|
a = pcre2_substring_copy_byname_8(G(b,8),G(c,8),(PCRE2_UCHAR8 *)d,e)
|
||||||
|
@ -1327,10 +1449,16 @@ the three different cases. */
|
||||||
a = pcre2_substring_get_byname_8(G(b,8),G(c,8),(PCRE2_UCHAR8 **)d,e)
|
a = pcre2_substring_get_byname_8(G(b,8),G(c,8),(PCRE2_UCHAR8 **)d,e)
|
||||||
#define PCRE2_SUBSTRING_GET_BYNUMBER(a,b,c,d,e) \
|
#define PCRE2_SUBSTRING_GET_BYNUMBER(a,b,c,d,e) \
|
||||||
a = pcre2_substring_get_bynumber_8(G(b,8),c,(PCRE2_UCHAR8 **)d,e)
|
a = pcre2_substring_get_bynumber_8(G(b,8),c,(PCRE2_UCHAR8 **)d,e)
|
||||||
|
#define PCRE2_SUBSTRING_LENGTH_BYNAME(a,b,c,d) \
|
||||||
|
a = pcre2_substring_length_byname_8(G(b,8),G(c,8),d)
|
||||||
|
#define PCRE2_SUBSTRING_LENGTH_BYNUMBER(a,b,c,d) \
|
||||||
|
a = pcre2_substring_length_bynumber_8(G(b,8),c,d)
|
||||||
#define PCRE2_SUBSTRING_LIST_GET(a,b,c,d) \
|
#define PCRE2_SUBSTRING_LIST_GET(a,b,c,d) \
|
||||||
a = pcre2_substring_list_get_8(G(b,8),(PCRE2_UCHAR8 ***)c,d)
|
a = pcre2_substring_list_get_8(G(b,8),(PCRE2_UCHAR8 ***)c,d)
|
||||||
#define PCRE2_SUBSTRING_LIST_FREE(a) \
|
#define PCRE2_SUBSTRING_LIST_FREE(a) \
|
||||||
pcre2_substring_list_free_8((PCRE2_SPTR8 *)a)
|
pcre2_substring_list_free_8((PCRE2_SPTR8 *)a)
|
||||||
|
#define PCRE2_SUBSTRING_NUMBER_FROM_NAME(a,b,c) \
|
||||||
|
a = pcre2_substring_number_from_name_8(G(b,8),G(c,8));
|
||||||
#define PTR(x) (void *)G(x,8)
|
#define PTR(x) (void *)G(x,8)
|
||||||
#define SETFLD(x,y,z) G(x,8)->y = z
|
#define SETFLD(x,y,z) G(x,8)->y = z
|
||||||
#define SETFLDVEC(x,y,v,z) G(x,8)->y[v] = z
|
#define SETFLDVEC(x,y,v,z) G(x,8)->y[v] = z
|
||||||
|
@ -1362,7 +1490,10 @@ the three different cases. */
|
||||||
a = pcre2_dfa_match_16(G(b,16),(PCRE2_SPTR16)c,d,e,f,G(g,16),G(h,16),i,j)
|
a = pcre2_dfa_match_16(G(b,16),(PCRE2_SPTR16)c,d,e,f,G(g,16),G(h,16),i,j)
|
||||||
#define PCRE2_GET_ERROR_MESSAGE(r,a,b) \
|
#define PCRE2_GET_ERROR_MESSAGE(r,a,b) \
|
||||||
r = pcre2_get_error_message_16(a,G(b,16),G(G(b,16),_size))
|
r = pcre2_get_error_message_16(a,G(b,16),G(G(b,16),_size))
|
||||||
|
#define PCRE2_GET_OVECTOR_COUNT(a,b) a = pcre2_get_ovector_count_16(G(b,16))
|
||||||
|
#define PCRE2_GET_STARTCHAR(a,b) a = pcre2_get_startchar_16(G(b,16))
|
||||||
#define PCRE2_JIT_COMPILE(a,b) pcre2_jit_compile_16(G(a,16),b)
|
#define PCRE2_JIT_COMPILE(a,b) pcre2_jit_compile_16(G(a,16),b)
|
||||||
|
#define PCRE2_JIT_FREE_UNUSED_MEMORY(a) pcre2_jit_free_unused_memory_16(G(a,16))
|
||||||
#define PCRE2_JIT_STACK_ALLOC(a,b,c,d) \
|
#define PCRE2_JIT_STACK_ALLOC(a,b,c,d) \
|
||||||
a = (PCRE2_JIT_STACK *)pcre2_jit_stack_alloc_16(b,c,d);
|
a = (PCRE2_JIT_STACK *)pcre2_jit_stack_alloc_16(b,c,d);
|
||||||
#define PCRE2_JIT_STACK_ASSIGN(a,b,c) \
|
#define PCRE2_JIT_STACK_ASSIGN(a,b,c) \
|
||||||
|
@ -1372,6 +1503,8 @@ the three different cases. */
|
||||||
#define PCRE2_MATCH(a,b,c,d,e,f,g,h) \
|
#define PCRE2_MATCH(a,b,c,d,e,f,g,h) \
|
||||||
a = pcre2_match_16(G(b,16),(PCRE2_SPTR16)c,d,e,f,G(g,16),G(h,16))
|
a = pcre2_match_16(G(b,16),(PCRE2_SPTR16)c,d,e,f,G(g,16),G(h,16))
|
||||||
#define PCRE2_MATCH_DATA_CREATE(a,b,c) G(a,16) = pcre2_match_data_create_16(b,c)
|
#define PCRE2_MATCH_DATA_CREATE(a,b,c) G(a,16) = pcre2_match_data_create_16(b,c)
|
||||||
|
#define PCRE2_MATCH_DATA_CREATE_FROM_PATTERN(a,b,c) \
|
||||||
|
G(a,16) = pcre2_match_data_create_from_pattern_16(G(b,16),c)
|
||||||
#define PCRE2_MATCH_DATA_FREE(a) pcre2_match_data_free_16(G(a,16))
|
#define PCRE2_MATCH_DATA_FREE(a) pcre2_match_data_free_16(G(a,16))
|
||||||
#define PCRE2_PATTERN_INFO(a,b,c,d) a = pcre2_pattern_info_16(G(b,16),c,d)
|
#define PCRE2_PATTERN_INFO(a,b,c,d) a = pcre2_pattern_info_16(G(b,16),c,d)
|
||||||
#define PCRE2_PRINTINT(a) pcre2_printint_16(compiled_code16,outfile,a)
|
#define PCRE2_PRINTINT(a) pcre2_printint_16(compiled_code16,outfile,a)
|
||||||
|
@ -1381,6 +1514,7 @@ the three different cases. */
|
||||||
#define PCRE2_SET_COMPILE_RECURSION_GUARD(a,b) \
|
#define PCRE2_SET_COMPILE_RECURSION_GUARD(a,b) \
|
||||||
pcre2_set_compile_recursion_guard_16(G(a,16),b)
|
pcre2_set_compile_recursion_guard_16(G(a,16),b)
|
||||||
#define PCRE2_SET_MATCH_LIMIT(a,b) pcre2_set_match_limit_16(G(a,16),b)
|
#define PCRE2_SET_MATCH_LIMIT(a,b) pcre2_set_match_limit_16(G(a,16),b)
|
||||||
|
#define PCRE2_SET_PARENS_NEST_LIMIT(a,b) pcre2_set_parens_nest_limit_16(G(a,16),b)
|
||||||
#define PCRE2_SET_RECURSION_LIMIT(a,b) pcre2_set_recursion_limit_16(G(a,16),b)
|
#define PCRE2_SET_RECURSION_LIMIT(a,b) pcre2_set_recursion_limit_16(G(a,16),b)
|
||||||
#define PCRE2_SUBSTRING_COPY_BYNAME(a,b,c,d,e) \
|
#define PCRE2_SUBSTRING_COPY_BYNAME(a,b,c,d,e) \
|
||||||
a = pcre2_substring_copy_byname_16(G(b,16),G(c,16),(PCRE2_UCHAR16 *)d,e)
|
a = pcre2_substring_copy_byname_16(G(b,16),G(c,16),(PCRE2_UCHAR16 *)d,e)
|
||||||
|
@ -1391,10 +1525,16 @@ the three different cases. */
|
||||||
a = pcre2_substring_get_byname_16(G(b,16),G(c,16),(PCRE2_UCHAR16 **)d,e)
|
a = pcre2_substring_get_byname_16(G(b,16),G(c,16),(PCRE2_UCHAR16 **)d,e)
|
||||||
#define PCRE2_SUBSTRING_GET_BYNUMBER(a,b,c,d,e) \
|
#define PCRE2_SUBSTRING_GET_BYNUMBER(a,b,c,d,e) \
|
||||||
a = pcre2_substring_get_bynumber_16(G(b,16),c,(PCRE2_UCHAR16 **)d,e)
|
a = pcre2_substring_get_bynumber_16(G(b,16),c,(PCRE2_UCHAR16 **)d,e)
|
||||||
|
#define PCRE2_SUBSTRING_LENGTH_BYNAME(a,b,c,d) \
|
||||||
|
a = pcre2_substring_length_byname_16(G(b,16),G(c,16),d)
|
||||||
|
#define PCRE2_SUBSTRING_LENGTH_BYNUMBER(a,b,c,d) \
|
||||||
|
a = pcre2_substring_length_bynumber_16(G(b,16),c,d)
|
||||||
#define PCRE2_SUBSTRING_LIST_GET(a,b,c,d) \
|
#define PCRE2_SUBSTRING_LIST_GET(a,b,c,d) \
|
||||||
a = pcre2_substring_list_get_16(G(b,16),(PCRE2_UCHAR16 ***)c,d)
|
a = pcre2_substring_list_get_16(G(b,16),(PCRE2_UCHAR16 ***)c,d)
|
||||||
#define PCRE2_SUBSTRING_LIST_FREE(a) \
|
#define PCRE2_SUBSTRING_LIST_FREE(a) \
|
||||||
pcre2_substring_list_free_16((PCRE2_SPTR16 *)a)
|
pcre2_substring_list_free_16((PCRE2_SPTR16 *)a)
|
||||||
|
#define PCRE2_SUBSTRING_NUMBER_FROM_NAME(a,b,c) \
|
||||||
|
a = pcre2_substring_number_from_name_16(G(b,16),G(c,16));
|
||||||
#define PTR(x) (void *)G(x,16)
|
#define PTR(x) (void *)G(x,16)
|
||||||
#define SETFLD(x,y,z) G(x,16)->y = z
|
#define SETFLD(x,y,z) G(x,16)->y = z
|
||||||
#define SETFLDVEC(x,y,v,z) G(x,16)->y[v] = z
|
#define SETFLDVEC(x,y,v,z) G(x,16)->y[v] = z
|
||||||
|
@ -1426,7 +1566,10 @@ the three different cases. */
|
||||||
a = pcre2_dfa_match_32(G(b,32),(PCRE2_SPTR32)c,d,e,f,G(g,32),G(h,32),i,j)
|
a = pcre2_dfa_match_32(G(b,32),(PCRE2_SPTR32)c,d,e,f,G(g,32),G(h,32),i,j)
|
||||||
#define PCRE2_GET_ERROR_MESSAGE(r,a,b) \
|
#define PCRE2_GET_ERROR_MESSAGE(r,a,b) \
|
||||||
r = pcre2_get_error_message_32(a,G(b,32),G(G(b,32),_size))
|
r = pcre2_get_error_message_32(a,G(b,32),G(G(b,32),_size))
|
||||||
|
#define PCRE2_GET_OVECTOR_COUNT(a,b) a = pcre2_get_ovector_count_32(G(b,32))
|
||||||
|
#define PCRE2_GET_STARTCHAR(a,b) a = pcre2_get_startchar_32(G(b,32))
|
||||||
#define PCRE2_JIT_COMPILE(a,b) pcre2_jit_compile_32(G(a,32),b)
|
#define PCRE2_JIT_COMPILE(a,b) pcre2_jit_compile_32(G(a,32),b)
|
||||||
|
#define PCRE2_JIT_FREE_UNUSED_MEMORY(a) pcre2_jit_free_unused_memory_32(G(a,32))
|
||||||
#define PCRE2_JIT_STACK_ALLOC(a,b,c,d) \
|
#define PCRE2_JIT_STACK_ALLOC(a,b,c,d) \
|
||||||
a = (PCRE2_JIT_STACK *)pcre2_jit_stack_alloc_32(b,c,d);
|
a = (PCRE2_JIT_STACK *)pcre2_jit_stack_alloc_32(b,c,d);
|
||||||
#define PCRE2_JIT_STACK_ASSIGN(a,b,c) \
|
#define PCRE2_JIT_STACK_ASSIGN(a,b,c) \
|
||||||
|
@ -1436,6 +1579,8 @@ the three different cases. */
|
||||||
#define PCRE2_MATCH(a,b,c,d,e,f,g,h) \
|
#define PCRE2_MATCH(a,b,c,d,e,f,g,h) \
|
||||||
a = pcre2_match_32(G(b,32),(PCRE2_SPTR32)c,d,e,f,G(g,32),G(h,32))
|
a = pcre2_match_32(G(b,32),(PCRE2_SPTR32)c,d,e,f,G(g,32),G(h,32))
|
||||||
#define PCRE2_MATCH_DATA_CREATE(a,b,c) G(a,32) = pcre2_match_data_create_32(b,c)
|
#define PCRE2_MATCH_DATA_CREATE(a,b,c) G(a,32) = pcre2_match_data_create_32(b,c)
|
||||||
|
#define PCRE2_MATCH_DATA_CREATE_FROM_PATTERN(a,b,c) \
|
||||||
|
G(a,32) = pcre2_match_data_create_from_pattern_32(G(b,32),c)
|
||||||
#define PCRE2_MATCH_DATA_FREE(a) pcre2_match_data_free_32(G(a,32))
|
#define PCRE2_MATCH_DATA_FREE(a) pcre2_match_data_free_32(G(a,32))
|
||||||
#define PCRE2_PATTERN_INFO(a,b,c,d) a = pcre2_pattern_info_32(G(b,32),c,d)
|
#define PCRE2_PATTERN_INFO(a,b,c,d) a = pcre2_pattern_info_32(G(b,32),c,d)
|
||||||
#define PCRE2_PRINTINT(a) pcre2_printint_32(compiled_code32,outfile,a)
|
#define PCRE2_PRINTINT(a) pcre2_printint_32(compiled_code32,outfile,a)
|
||||||
|
@ -1445,6 +1590,7 @@ the three different cases. */
|
||||||
#define PCRE2_SET_COMPILE_RECURSION_GUARD(a,b) \
|
#define PCRE2_SET_COMPILE_RECURSION_GUARD(a,b) \
|
||||||
pcre2_set_compile_recursion_guard_32(G(a,32),b)
|
pcre2_set_compile_recursion_guard_32(G(a,32),b)
|
||||||
#define PCRE2_SET_MATCH_LIMIT(a,b) pcre2_set_match_limit_32(G(a,32),b)
|
#define PCRE2_SET_MATCH_LIMIT(a,b) pcre2_set_match_limit_32(G(a,32),b)
|
||||||
|
#define PCRE2_SET_PARENS_NEST_LIMIT(a,b) pcre2_set_parens_nest_limit_32(G(a,32),b)
|
||||||
#define PCRE2_SET_RECURSION_LIMIT(a,b) pcre2_set_recursion_limit_32(G(a,32),b)
|
#define PCRE2_SET_RECURSION_LIMIT(a,b) pcre2_set_recursion_limit_32(G(a,32),b)
|
||||||
#define PCRE2_SUBSTRING_COPY_BYNAME(a,b,c,d,e) \
|
#define PCRE2_SUBSTRING_COPY_BYNAME(a,b,c,d,e) \
|
||||||
a = pcre2_substring_copy_byname_32(G(b,32),G(c,32),(PCRE2_UCHAR32 *)d,e)
|
a = pcre2_substring_copy_byname_32(G(b,32),G(c,32),(PCRE2_UCHAR32 *)d,e)
|
||||||
|
@ -1455,10 +1601,16 @@ the three different cases. */
|
||||||
a = pcre2_substring_get_byname_32(G(b,32),G(c,32),(PCRE2_UCHAR32 **)d,e)
|
a = pcre2_substring_get_byname_32(G(b,32),G(c,32),(PCRE2_UCHAR32 **)d,e)
|
||||||
#define PCRE2_SUBSTRING_GET_BYNUMBER(a,b,c,d,e) \
|
#define PCRE2_SUBSTRING_GET_BYNUMBER(a,b,c,d,e) \
|
||||||
a = pcre2_substring_get_bynumber_32(G(b,32),c,(PCRE2_UCHAR32 **)d,e)
|
a = pcre2_substring_get_bynumber_32(G(b,32),c,(PCRE2_UCHAR32 **)d,e)
|
||||||
|
#define PCRE2_SUBSTRING_LENGTH_BYNAME(a,b,c,d) \
|
||||||
|
a = pcre2_substring_length_byname_32(G(b,32),G(c,32),d)
|
||||||
|
#define PCRE2_SUBSTRING_LENGTH_BYNUMBER(a,b,c,d) \
|
||||||
|
a = pcre2_substring_length_bynumber_32(G(b,32),c,d)
|
||||||
#define PCRE2_SUBSTRING_LIST_GET(a,b,c,d) \
|
#define PCRE2_SUBSTRING_LIST_GET(a,b,c,d) \
|
||||||
a = pcre2_substring_list_get_32(G(b,32),(PCRE2_UCHAR32 ***)c,d)
|
a = pcre2_substring_list_get_32(G(b,32),(PCRE2_UCHAR32 ***)c,d)
|
||||||
#define PCRE2_SUBSTRING_LIST_FREE(a) \
|
#define PCRE2_SUBSTRING_LIST_FREE(a) \
|
||||||
pcre2_substring_list_free_32((PCRE2_SPTR32 *)a)
|
pcre2_substring_list_free_32((PCRE2_SPTR32 *)a)
|
||||||
|
#define PCRE2_SUBSTRING_NUMBER_FROM_NAME(a,b,c) \
|
||||||
|
a = pcre2_substring_number_from_name_32(G(b,32),G(c,32));
|
||||||
#define PTR(x) (void *)G(x,32)
|
#define PTR(x) (void *)G(x,32)
|
||||||
#define SETFLD(x,y,z) G(x,32)->y = z
|
#define SETFLD(x,y,z) G(x,32)->y = z
|
||||||
#define SETFLDVEC(x,y,v,z) G(x,32)->y[v] = z
|
#define SETFLDVEC(x,y,v,z) G(x,32)->y[v] = z
|
||||||
|
@ -2978,43 +3130,48 @@ fprintf(outfile, "%s %s", *msg, s);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef SUPPORT_PCRE2_8
|
|
||||||
/*************************************************
|
/*************************************************
|
||||||
* Show compile controls *
|
* Show control bits *
|
||||||
*************************************************/
|
*************************************************/
|
||||||
|
|
||||||
/* Called for unsupported POSIX modifiers, and therefore needed only when the
|
/* Called for mutually exclusive controls and for unsupported POSIX controls.
|
||||||
8-bit library is supported.
|
Because the bits are unique, this can be used for both pattern and data control
|
||||||
|
words.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
controls control bits
|
controls control bits
|
||||||
before text to print before
|
before text to print before
|
||||||
after text to print after
|
|
||||||
|
|
||||||
Returns: nothing
|
Returns: nothing
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
show_compile_controls(uint32_t controls, const char *before, const char *after)
|
show_controls(uint32_t controls, const char *before)
|
||||||
{
|
{
|
||||||
fprintf(outfile, "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
|
fprintf(outfile, "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
|
||||||
before,
|
before,
|
||||||
((controls & CTL_AFTERTEXT) != 0)? " aftertext" : "",
|
((controls & CTL_AFTERTEXT) != 0)? " aftertext" : "",
|
||||||
((controls & CTL_ALLAFTERTEXT) != 0)? " allaftertext" : "",
|
((controls & CTL_ALLAFTERTEXT) != 0)? " allaftertext" : "",
|
||||||
((controls & CTL_ALLCAPTURES) != 0)? " allcaptures" : "",
|
((controls & CTL_ALLCAPTURES) != 0)? " allcaptures" : "",
|
||||||
|
((controls & CTL_ALLUSEDTEXT) != 0)? " allusedtext" : "",
|
||||||
((controls & CTL_ALTGLOBAL) != 0)? " altglobal" : "",
|
((controls & CTL_ALTGLOBAL) != 0)? " altglobal" : "",
|
||||||
((controls & CTL_BINCODE) != 0)? " bincode" : "",
|
((controls & CTL_BINCODE) != 0)? " bincode" : "",
|
||||||
|
((controls & CTL_CALLOUT_CAPTURE) != 0)? " callout_capture" : "",
|
||||||
|
((controls & CTL_CALLOUT_NONE) != 0)? " callout_none" : "",
|
||||||
|
((controls & CTL_DFA) != 0)? " dfa" : "",
|
||||||
|
((controls & CTL_FINDLIMITS) != 0)? " find_limits" : "",
|
||||||
((controls & CTL_FULLBINCODE) != 0)? " fullbincode" : "",
|
((controls & CTL_FULLBINCODE) != 0)? " fullbincode" : "",
|
||||||
|
((controls & CTL_GETALL) != 0)? " getall" : "",
|
||||||
((controls & CTL_GLOBAL) != 0)? " global" : "",
|
((controls & CTL_GLOBAL) != 0)? " global" : "",
|
||||||
((controls & CTL_HEXPAT) != 0)? " hex" : "",
|
((controls & CTL_HEXPAT) != 0)? " hex" : "",
|
||||||
((controls & CTL_INFO) != 0)? " info" : "",
|
((controls & CTL_INFO) != 0)? " info" : "",
|
||||||
((controls & CTL_JITVERIFY) != 0)? " jitverify" : "",
|
((controls & CTL_JITVERIFY) != 0)? " jitverify" : "",
|
||||||
((controls & CTL_MARK) != 0)? " mark" : "",
|
((controls & CTL_MARK) != 0)? " mark" : "",
|
||||||
|
((controls & CTL_MEMORY) != 0)? " memory" : "",
|
||||||
((controls & CTL_PATLEN) != 0)? " use_length" : "",
|
((controls & CTL_PATLEN) != 0)? " use_length" : "",
|
||||||
((controls & CTL_POSIX) != 0)? " posix" : "",
|
((controls & CTL_POSIX) != 0)? " posix" : "",
|
||||||
after);
|
((controls & CTL_STARTCHAR) != 0)? " startchar" : "");
|
||||||
}
|
}
|
||||||
#endif /* SUPPORT_PCRE2_8 */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -3064,34 +3221,6 @@ else fprintf(outfile, "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef SUPPORT_PCRE2_8
|
|
||||||
/*************************************************
|
|
||||||
* Show match controls *
|
|
||||||
*************************************************/
|
|
||||||
|
|
||||||
/* Called for unsupported POSIX modifiers. */
|
|
||||||
|
|
||||||
static void
|
|
||||||
show_match_controls(uint32_t controls)
|
|
||||||
{
|
|
||||||
fprintf(outfile, "%s%s%s%s%s%s%s%s%s%s%s%s%s",
|
|
||||||
((controls & CTL_AFTERTEXT) != 0)? " aftertext" : "",
|
|
||||||
((controls & CTL_ALLAFTERTEXT) != 0)? " allaftertext" : "",
|
|
||||||
((controls & CTL_ALLCAPTURES) != 0)? " allcaptures" : "",
|
|
||||||
((controls & CTL_ALTGLOBAL) != 0)? " altglobal" : "",
|
|
||||||
((controls & CTL_CALLOUT_CAPTURE) != 0)? " callout_capture" : "",
|
|
||||||
((controls & CTL_CALLOUT_NONE) != 0)? " callout_none" : "",
|
|
||||||
((controls & CTL_DFA) != 0)? " dfa" : "",
|
|
||||||
((controls & CTL_FINDLIMITS) != 0)? " find_limits" : "",
|
|
||||||
((controls & CTL_GETALL) != 0)? " getall" : "",
|
|
||||||
((controls & CTL_GLOBAL) != 0)? " global" : "",
|
|
||||||
((controls & CTL_JITVERIFY) != 0)? " jitverify" : "",
|
|
||||||
((controls & CTL_MARK) != 0)? " mark" : "",
|
|
||||||
((controls & CTL_MEMORY) != 0)? " memory" : "");
|
|
||||||
}
|
|
||||||
#endif /* SUPPORT_PCRE2_8 */
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef SUPPORT_PCRE2_8
|
#ifdef SUPPORT_PCRE2_8
|
||||||
/*************************************************
|
/*************************************************
|
||||||
* Show match options *
|
* Show match options *
|
||||||
|
@ -3635,8 +3764,7 @@ if ((pat_patctl.control & CTL_POSIX) != 0)
|
||||||
}
|
}
|
||||||
if ((pat_patctl.control & ~POSIX_SUPPORTED_COMPILE_CONTROLS) != 0)
|
if ((pat_patctl.control & ~POSIX_SUPPORTED_COMPILE_CONTROLS) != 0)
|
||||||
{
|
{
|
||||||
show_compile_controls(
|
show_controls(pat_patctl.control & ~POSIX_SUPPORTED_COMPILE_CONTROLS, msg);
|
||||||
pat_patctl.control & ~POSIX_SUPPORTED_COMPILE_CONTROLS, msg, "");
|
|
||||||
msg = "";
|
msg = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4345,6 +4473,16 @@ c = code_unit_size * ((pat_patctl.control & CTL_POSIX) != 0)? 1:0;
|
||||||
if (p[-1] != 0 && !decode_modifiers(p, CTX_DAT, NULL, &dat_datctl))
|
if (p[-1] != 0 && !decode_modifiers(p, CTX_DAT, NULL, &dat_datctl))
|
||||||
return PR_OK;
|
return PR_OK;
|
||||||
|
|
||||||
|
/* Check for mutually exclusive modifiers. */
|
||||||
|
|
||||||
|
c = dat_datctl.control & EXCLUSIVE_DAT_CONTROLS;
|
||||||
|
if (c - (c & -c) != 0)
|
||||||
|
{
|
||||||
|
show_controls(c, "** Not allowed together:");
|
||||||
|
fprintf(outfile, "\n");
|
||||||
|
return PR_OK;
|
||||||
|
}
|
||||||
|
|
||||||
/* Now run the pattern match: len contains the byte length, ulen contains the
|
/* Now run the pattern match: len contains the byte length, ulen contains the
|
||||||
code unit length, and pp points to the subject string. POSIX matching is only
|
code unit length, and pp points to the subject string. POSIX matching is only
|
||||||
possible in 8-bit mode, and it does not support timing or other fancy features.
|
possible in 8-bit mode, and it does not support timing or other fancy features.
|
||||||
|
@ -4375,8 +4513,7 @@ if ((pat_patctl.control & CTL_POSIX) != 0)
|
||||||
}
|
}
|
||||||
if ((dat_datctl.control & ~POSIX_SUPPORTED_MATCH_CONTROLS) != 0)
|
if ((dat_datctl.control & ~POSIX_SUPPORTED_MATCH_CONTROLS) != 0)
|
||||||
{
|
{
|
||||||
fprintf(outfile, "%s", msg);
|
show_controls(dat_datctl.control & ~POSIX_SUPPORTED_MATCH_CONTROLS, msg);
|
||||||
show_match_controls(dat_datctl.control & ~POSIX_SUPPORTED_MATCH_CONTROLS);
|
|
||||||
msg = "";
|
msg = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4445,11 +4582,6 @@ if ((dat_datctl.control & (CTL_ALLUSEDTEXT|CTL_DFA)) == CTL_ALLUSEDTEXT &&
|
||||||
dat_datctl.control &= ~CTL_ALLUSEDTEXT;
|
dat_datctl.control &= ~CTL_ALLUSEDTEXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* As pcre2_match_data_create() imposes a minimum of 1 on the ovector count, we
|
|
||||||
must do so too. */
|
|
||||||
|
|
||||||
if (dat_datctl.oveccount < 1) dat_datctl.oveccount = 1;
|
|
||||||
|
|
||||||
/* Enable display of malloc/free if wanted. */
|
/* Enable display of malloc/free if wanted. */
|
||||||
|
|
||||||
show_memory = (dat_datctl.control & CTL_MEMORY) != 0;
|
show_memory = (dat_datctl.control & CTL_MEMORY) != 0;
|
||||||
|
@ -4485,9 +4617,16 @@ if ((pat_patctl.control & CTL_JITVERIFY) != 0 && jit_stack == NULL)
|
||||||
PCRE2_JIT_STACK_ASSIGN(compiled_code, jit_callback, NULL);
|
PCRE2_JIT_STACK_ASSIGN(compiled_code, jit_callback, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Adjust match_data according to size of offsets required. */
|
/* Adjust match_data according to size of offsets required. A size of zero
|
||||||
|
causes a new match data block to be obtained that exactly fits the pattern. */
|
||||||
|
|
||||||
if (dat_datctl.oveccount <= max_oveccount)
|
if (dat_datctl.oveccount == 0)
|
||||||
|
{
|
||||||
|
PCRE2_MATCH_DATA_FREE(match_data);
|
||||||
|
PCRE2_MATCH_DATA_CREATE_FROM_PATTERN(match_data, compiled_code, NULL);
|
||||||
|
PCRE2_GET_OVECTOR_COUNT(max_oveccount, match_data);
|
||||||
|
}
|
||||||
|
else if (dat_datctl.oveccount <= max_oveccount)
|
||||||
{
|
{
|
||||||
SETFLD(match_data, oveccount, dat_datctl.oveccount);
|
SETFLD(match_data, oveccount, dat_datctl.oveccount);
|
||||||
}
|
}
|
||||||
|
@ -4619,16 +4758,18 @@ for (gmatched = 0;; gmatched++)
|
||||||
if (capcount >= 0)
|
if (capcount >= 0)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
uint32_t oveccount;
|
||||||
uint8_t *nptr;
|
uint8_t *nptr;
|
||||||
|
|
||||||
/* This is a check against a lunatic return value. */
|
/* This is a check against a lunatic return value. */
|
||||||
|
|
||||||
if (capcount > (int)dat_datctl.oveccount)
|
PCRE2_GET_OVECTOR_COUNT(oveccount, match_data);
|
||||||
|
if (capcount > (int)oveccount)
|
||||||
{
|
{
|
||||||
fprintf(outfile,
|
fprintf(outfile,
|
||||||
"** PCRE2 error: returned count %d is too big for ovector count %d\n",
|
"** PCRE2 error: returned count %d is too big for ovector count %d\n",
|
||||||
capcount, dat_datctl.oveccount);
|
capcount, oveccount);
|
||||||
capcount = dat_datctl.oveccount;
|
capcount = oveccount;
|
||||||
if ((dat_datctl.control & CTL_ANYGLOB) != 0)
|
if ((dat_datctl.control & CTL_ANYGLOB) != 0)
|
||||||
{
|
{
|
||||||
fprintf(outfile, "** Global loop abandoned\n");
|
fprintf(outfile, "** Global loop abandoned\n");
|
||||||
|
@ -4638,9 +4779,8 @@ for (gmatched = 0;; gmatched++)
|
||||||
|
|
||||||
/* If this is not the first time round a global loop, check that the
|
/* If this is not the first time round a global loop, check that the
|
||||||
returned string has changed. If not, there is a bug somewhere and we must
|
returned string has changed. If not, there is a bug somewhere and we must
|
||||||
break the loop because it will go on for ever. We know that for a global
|
break the loop because it will go on for ever. We know that there are
|
||||||
match there must be at least two elements in the ovector. This is checked
|
always at least two elements in the ovector. */
|
||||||
above. */
|
|
||||||
|
|
||||||
if (gmatched > 0 && ovecsave[0] == ovector[0] && ovecsave[1] == ovector[1])
|
if (gmatched > 0 && ovecsave[0] == ovector[0] && ovecsave[1] == ovector[1])
|
||||||
{
|
{
|
||||||
|
@ -4660,7 +4800,7 @@ for (gmatched = 0;; gmatched++)
|
||||||
if (pattern_info(PCRE2_INFO_CAPTURECOUNT, &maxcapcount, FALSE) < 0)
|
if (pattern_info(PCRE2_INFO_CAPTURECOUNT, &maxcapcount, FALSE) < 0)
|
||||||
return PR_SKIP;
|
return PR_SKIP;
|
||||||
capcount = maxcapcount + 1; /* Allow for full match */
|
capcount = maxcapcount + 1; /* Allow for full match */
|
||||||
if (capcount > (int)dat_datctl.oveccount) capcount = dat_datctl.oveccount;
|
if (capcount > (int)oveccount) capcount = oveccount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Output the captured substrings. Note that, for the matched string,
|
/* Output the captured substrings. Note that, for the matched string,
|
||||||
|
@ -4710,26 +4850,46 @@ for (gmatched = 0;; gmatched++)
|
||||||
|
|
||||||
if (showallused)
|
if (showallused)
|
||||||
{
|
{
|
||||||
|
PCRE2_SIZE j;
|
||||||
PCHARS(lleft, pp, leftchar, start - leftchar, utf, outfile);
|
PCHARS(lleft, pp, leftchar, start - leftchar, utf, outfile);
|
||||||
PCHARS(lmiddle, pp, start, end - start, utf, outfile);
|
PCHARS(lmiddle, pp, start, end - start, utf, outfile);
|
||||||
PCHARS(lright, pp, end, rightchar - end, utf, outfile);
|
PCHARS(lright, pp, end, rightchar - end, utf, outfile);
|
||||||
}
|
if ((pat_patctl.control & CTL_JITVERIFY) != 0 && jit_was_used)
|
||||||
else
|
fprintf(outfile, " (JIT)");
|
||||||
{
|
|
||||||
PCHARSV(pp, start, end - start, utf, outfile);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((pat_patctl.control & CTL_JITVERIFY) != 0 && jit_was_used)
|
|
||||||
fprintf(outfile, " (JIT)");
|
|
||||||
|
|
||||||
if (showallused)
|
|
||||||
{
|
|
||||||
PCRE2_SIZE j;
|
|
||||||
fprintf(outfile, "\n ");
|
fprintf(outfile, "\n ");
|
||||||
for (j = 0; j < lleft; j++) fprintf(outfile, "<");
|
for (j = 0; j < lleft; j++) fprintf(outfile, "<");
|
||||||
for (j = 0; j < lmiddle; j++) fprintf(outfile, " ");
|
for (j = 0; j < lmiddle; j++) fprintf(outfile, " ");
|
||||||
for (j = 0; j < lright; j++) fprintf(outfile, ">");
|
for (j = 0; j < lright; j++) fprintf(outfile, ">");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* When a pattern contains \K, the start of match position may be
|
||||||
|
different to the start of the matched string. When this is the case,
|
||||||
|
show it when requested. */
|
||||||
|
|
||||||
|
else if ((dat_datctl.control & CTL_STARTCHAR) != 0)
|
||||||
|
{
|
||||||
|
PCRE2_SIZE startchar;
|
||||||
|
PCRE2_GET_STARTCHAR(startchar, match_data);
|
||||||
|
PCHARS(lleft, pp, startchar, start - startchar, utf, outfile);
|
||||||
|
PCHARSV(pp, start, end - start, utf, outfile);
|
||||||
|
if ((pat_patctl.control & CTL_JITVERIFY) != 0 && jit_was_used)
|
||||||
|
fprintf(outfile, " (JIT)");
|
||||||
|
if (startchar != start)
|
||||||
|
{
|
||||||
|
PCRE2_SIZE j;
|
||||||
|
fprintf(outfile, "\n ");
|
||||||
|
for (j = 0; j < lleft; j++) fprintf(outfile, "^");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Otherwise, just show the matched string. */
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PCHARSV(pp, start, end - start, utf, outfile);
|
||||||
|
if ((pat_patctl.control & CTL_JITVERIFY) != 0 && jit_was_used)
|
||||||
|
fprintf(outfile, " (JIT)");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Not the main matched string. Just show it unadorned. */
|
/* Not the main matched string. Just show it unadorned. */
|
||||||
|
@ -4768,20 +4928,33 @@ for (gmatched = 0;; gmatched++)
|
||||||
for (i = 0; i < MAXCPYGET && dat_datctl.copy_numbers[i] >= 0; i++)
|
for (i = 0; i < MAXCPYGET && dat_datctl.copy_numbers[i] >= 0; i++)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
PCRE2_SIZE length;
|
PCRE2_SIZE length, length2;
|
||||||
uint32_t copybuffer[256];
|
uint32_t copybuffer[256];
|
||||||
uint32_t n = (uint32_t)(dat_datctl.copy_numbers[i]);
|
uint32_t n = (uint32_t)(dat_datctl.copy_numbers[i]);
|
||||||
length = sizeof(copybuffer)/code_unit_size;
|
length = sizeof(copybuffer)/code_unit_size;
|
||||||
PCRE2_SUBSTRING_COPY_BYNUMBER(rc, match_data, n, copybuffer, &length);
|
PCRE2_SUBSTRING_COPY_BYNUMBER(rc, match_data, n, copybuffer, &length);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
{
|
{
|
||||||
fprintf(outfile, "copy substring %d failed (%d): ", n, rc);
|
fprintf(outfile, "Copy substring %d failed (%d): ", n, rc);
|
||||||
PCRE2_GET_ERROR_MESSAGE(rc, rc, pbuffer);
|
PCRE2_GET_ERROR_MESSAGE(rc, rc, pbuffer);
|
||||||
PCHARSV(CASTVAR(void *, pbuffer), 0, rc, FALSE, outfile);
|
PCHARSV(CASTVAR(void *, pbuffer), 0, rc, FALSE, outfile);
|
||||||
fprintf(outfile, "\n");
|
fprintf(outfile, "\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
PCRE2_SUBSTRING_LENGTH_BYNUMBER(rc, match_data, n, &length2);
|
||||||
|
if (rc < 0)
|
||||||
|
{
|
||||||
|
fprintf(outfile, "Get substring %d length failed (%d): ", n, rc);
|
||||||
|
PCRE2_GET_ERROR_MESSAGE(rc, rc, pbuffer);
|
||||||
|
PCHARSV(CASTVAR(void *, pbuffer), 0, rc, FALSE, outfile);
|
||||||
|
fprintf(outfile, "\n");
|
||||||
|
}
|
||||||
|
else if (length2 != length)
|
||||||
|
{
|
||||||
|
fprintf(outfile, "Mismatched substring lengths: %ld %ld\n",
|
||||||
|
length, length2);
|
||||||
|
}
|
||||||
fprintf(outfile, "%2dC ", n);
|
fprintf(outfile, "%2dC ", n);
|
||||||
PCHARSV(copybuffer, 0, length, utf, outfile);
|
PCHARSV(copybuffer, 0, length, utf, outfile);
|
||||||
fprintf(outfile, " (%lu)\n", (unsigned long)length);
|
fprintf(outfile, " (%lu)\n", (unsigned long)length);
|
||||||
|
@ -4794,7 +4967,8 @@ for (gmatched = 0;; gmatched++)
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
PCRE2_SIZE length;
|
int groupnumber;
|
||||||
|
PCRE2_SIZE length, length2;
|
||||||
uint32_t copybuffer[256];
|
uint32_t copybuffer[256];
|
||||||
int namelen = strlen((const char *)nptr);
|
int namelen = strlen((const char *)nptr);
|
||||||
#if defined SUPPORT_PCRE2_16 || defined SUPPORT_PCRE2_32
|
#if defined SUPPORT_PCRE2_16 || defined SUPPORT_PCRE2_32
|
||||||
|
@ -4812,20 +4986,39 @@ for (gmatched = 0;; gmatched++)
|
||||||
if (test_mode == PCRE32_MODE)(void)to32(nptr, utf, &cnl);
|
if (test_mode == PCRE32_MODE)(void)to32(nptr, utf, &cnl);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
PCRE2_SUBSTRING_NUMBER_FROM_NAME(groupnumber, compiled_code, pbuffer);
|
||||||
|
if (groupnumber < 0 && groupnumber != PCRE2_ERROR_NOUNIQUESUBSTRING)
|
||||||
|
fprintf(outfile, "Number not found for group '%s'\n", nptr);
|
||||||
|
|
||||||
length = sizeof(copybuffer)/code_unit_size;
|
length = sizeof(copybuffer)/code_unit_size;
|
||||||
PCRE2_SUBSTRING_COPY_BYNAME(rc, match_data, pbuffer, copybuffer, &length);
|
PCRE2_SUBSTRING_COPY_BYNAME(rc, match_data, pbuffer, copybuffer, &length);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
{
|
{
|
||||||
fprintf(outfile, "copy substring '%s' failed (%d): ", nptr, rc);
|
fprintf(outfile, "Copy substring '%s' failed (%d): ", nptr, rc);
|
||||||
PCRE2_GET_ERROR_MESSAGE(rc, rc, pbuffer);
|
PCRE2_GET_ERROR_MESSAGE(rc, rc, pbuffer);
|
||||||
PCHARSV(CASTVAR(void *, pbuffer), 0, rc, FALSE, outfile);
|
PCHARSV(CASTVAR(void *, pbuffer), 0, rc, FALSE, outfile);
|
||||||
fprintf(outfile, "\n");
|
fprintf(outfile, "\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
PCRE2_SUBSTRING_LENGTH_BYNAME(rc, match_data, pbuffer, &length2);
|
||||||
|
if (rc < 0)
|
||||||
|
{
|
||||||
|
fprintf(outfile, "Get substring '%s' length failed (%d): ", nptr, rc);
|
||||||
|
PCRE2_GET_ERROR_MESSAGE(rc, rc, pbuffer);
|
||||||
|
PCHARSV(CASTVAR(void *, pbuffer), 0, rc, FALSE, outfile);
|
||||||
|
fprintf(outfile, "\n");
|
||||||
|
}
|
||||||
|
else if (length2 != length)
|
||||||
|
{
|
||||||
|
fprintf(outfile, "Mismatched substring lengths: %ld %ld\n",
|
||||||
|
length, length2);
|
||||||
|
}
|
||||||
fprintf(outfile, " C ");
|
fprintf(outfile, " C ");
|
||||||
PCHARSV(copybuffer, 0, length, utf, outfile);
|
PCHARSV(copybuffer, 0, length, utf, outfile);
|
||||||
fprintf(outfile, " (%lu) %s\n", (unsigned long)length, nptr);
|
fprintf(outfile, " (%lu) %s", (unsigned long)length, nptr);
|
||||||
|
if (groupnumber >= 0) fprintf(outfile, " (group %d)\n", groupnumber);
|
||||||
|
else fprintf(outfile, " (non-unique)\n");
|
||||||
}
|
}
|
||||||
nptr += namelen + 1;
|
nptr += namelen + 1;
|
||||||
}
|
}
|
||||||
|
@ -4841,7 +5034,7 @@ for (gmatched = 0;; gmatched++)
|
||||||
PCRE2_SUBSTRING_GET_BYNUMBER(rc, match_data, n, &gotbuffer, &length);
|
PCRE2_SUBSTRING_GET_BYNUMBER(rc, match_data, n, &gotbuffer, &length);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
{
|
{
|
||||||
fprintf(outfile, "get substring %d failed (%d): ", n, rc);
|
fprintf(outfile, "Get substring %d failed (%d): ", n, rc);
|
||||||
PCRE2_GET_ERROR_MESSAGE(rc, rc, pbuffer);
|
PCRE2_GET_ERROR_MESSAGE(rc, rc, pbuffer);
|
||||||
PCHARSV(CASTVAR(void *, pbuffer), 0, rc, FALSE, outfile);
|
PCHARSV(CASTVAR(void *, pbuffer), 0, rc, FALSE, outfile);
|
||||||
fprintf(outfile, "\n");
|
fprintf(outfile, "\n");
|
||||||
|
@ -4863,6 +5056,7 @@ for (gmatched = 0;; gmatched++)
|
||||||
PCRE2_SIZE length;
|
PCRE2_SIZE length;
|
||||||
void *gotbuffer;
|
void *gotbuffer;
|
||||||
int rc;
|
int rc;
|
||||||
|
int groupnumber;
|
||||||
int namelen = strlen((const char *)nptr);
|
int namelen = strlen((const char *)nptr);
|
||||||
#if defined SUPPORT_PCRE2_16 || defined SUPPORT_PCRE2_32
|
#if defined SUPPORT_PCRE2_16 || defined SUPPORT_PCRE2_32
|
||||||
PCRE2_SIZE cnl = namelen;
|
PCRE2_SIZE cnl = namelen;
|
||||||
|
@ -4879,10 +5073,14 @@ for (gmatched = 0;; gmatched++)
|
||||||
if (test_mode == PCRE32_MODE)(void)to32(nptr, utf, &cnl);
|
if (test_mode == PCRE32_MODE)(void)to32(nptr, utf, &cnl);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
PCRE2_SUBSTRING_NUMBER_FROM_NAME(groupnumber, compiled_code, pbuffer);
|
||||||
|
if (groupnumber < 0 && groupnumber != PCRE2_ERROR_NOUNIQUESUBSTRING)
|
||||||
|
fprintf(outfile, "Number not found for group '%s'\n", nptr);
|
||||||
|
|
||||||
PCRE2_SUBSTRING_GET_BYNAME(rc, match_data, pbuffer, &gotbuffer, &length);
|
PCRE2_SUBSTRING_GET_BYNAME(rc, match_data, pbuffer, &gotbuffer, &length);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
{
|
{
|
||||||
fprintf(outfile, "get substring '%s' failed (%d): ", nptr, rc);
|
fprintf(outfile, "Get substring '%s' failed (%d): ", nptr, rc);
|
||||||
PCRE2_GET_ERROR_MESSAGE(rc, rc, pbuffer);
|
PCRE2_GET_ERROR_MESSAGE(rc, rc, pbuffer);
|
||||||
PCHARSV(CASTVAR(void *, pbuffer), 0, rc, FALSE, outfile);
|
PCHARSV(CASTVAR(void *, pbuffer), 0, rc, FALSE, outfile);
|
||||||
fprintf(outfile, "\n");
|
fprintf(outfile, "\n");
|
||||||
|
@ -4891,7 +5089,9 @@ for (gmatched = 0;; gmatched++)
|
||||||
{
|
{
|
||||||
fprintf(outfile, " G ");
|
fprintf(outfile, " G ");
|
||||||
PCHARSV(gotbuffer, 0, length, utf, outfile);
|
PCHARSV(gotbuffer, 0, length, utf, outfile);
|
||||||
fprintf(outfile, " (%lu) %s\n", (unsigned long)length, nptr);
|
fprintf(outfile, " (%lu) %s", (unsigned long)length, nptr);
|
||||||
|
if (groupnumber >= 0) fprintf(outfile, " (group %d)\n", groupnumber);
|
||||||
|
else fprintf(outfile, " (non-unique)\n");
|
||||||
PCRE2_SUBSTRING_FREE(gotbuffer);
|
PCRE2_SUBSTRING_FREE(gotbuffer);
|
||||||
}
|
}
|
||||||
nptr += namelen + 1;
|
nptr += namelen + 1;
|
||||||
|
@ -5599,61 +5799,71 @@ while (argc > 1 && argv[op][0] == '-')
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize things that cannot be done until we know which test mode we are
|
/* Initialize things that cannot be done until we know which test mode we are
|
||||||
running in. */
|
running in. When HEAP_MATCH_RECURSE is undefined, calling pcre2_set_recursion_
|
||||||
|
memory_management() is a no-op, but we call it in order to exercise it. Also
|
||||||
|
exercise the general context copying function, which is not otherwise used. */
|
||||||
|
|
||||||
code_unit_size = test_mode/8;
|
code_unit_size = test_mode/8;
|
||||||
max_oveccount = DEFAULT_OVECCOUNT;
|
max_oveccount = DEFAULT_OVECCOUNT;
|
||||||
|
|
||||||
|
/* Use macros to save a lot of duplication. */
|
||||||
|
|
||||||
|
#define CREATECONTEXTS \
|
||||||
|
G(general_context,BITS) = G(pcre2_general_context_create_,BITS)(&my_malloc, &my_free, NULL); \
|
||||||
|
G(general_context_copy,BITS) = G(pcre2_general_context_copy_,BITS)(G(general_context,BITS)); \
|
||||||
|
G(default_pat_context,BITS) = G(pcre2_compile_context_create_,BITS)(G(general_context,BITS)); \
|
||||||
|
G(pat_context,BITS) = G(pcre2_compile_context_copy_,BITS)(G(default_pat_context,BITS)); \
|
||||||
|
G(default_dat_context,BITS) = G(pcre2_match_context_create_,BITS)(G(general_context,BITS)); \
|
||||||
|
G(dat_context,BITS) = G(pcre2_match_context_copy_,BITS)(G(default_dat_context,BITS)); \
|
||||||
|
G(match_data,BITS) = G(pcre2_match_data_create_,BITS)(max_oveccount, G(general_context,BITS))
|
||||||
|
|
||||||
|
#ifdef HEAP_MATCH_RECURSE
|
||||||
|
#define SETRECURSEMEMMAN \
|
||||||
|
(void)G(pcre2_set_recursion_memory_management_,BITS) \
|
||||||
|
(G(default_dat_context,BITS), \
|
||||||
|
&my_stack_malloc, &my_stack_free, NULL)
|
||||||
|
#else
|
||||||
|
#define SETRECURSEMEMMAN \
|
||||||
|
(void)G(pcre2_set_recursion_memory_management_,BITS)(NULL, NULL, NULL, NULL)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Call the appropriate functions for the current mode. */
|
||||||
|
|
||||||
#ifdef SUPPORT_PCRE2_8
|
#ifdef SUPPORT_PCRE2_8
|
||||||
|
#undef BITS
|
||||||
|
#define BITS 8
|
||||||
if (test_mode == PCRE8_MODE)
|
if (test_mode == PCRE8_MODE)
|
||||||
{
|
{
|
||||||
general_context8 = pcre2_general_context_create_8(&my_malloc, &my_free, NULL);
|
CREATECONTEXTS;
|
||||||
default_pat_context8 = pcre2_compile_context_create_8(general_context8);
|
SETRECURSEMEMMAN;
|
||||||
pat_context8 = pcre2_compile_context_create_8(general_context8);
|
|
||||||
default_dat_context8 = pcre2_match_context_create_8(general_context8);
|
|
||||||
dat_context8 = pcre2_match_context_create_8(general_context8);
|
|
||||||
match_data8 = pcre2_match_data_create_8(max_oveccount, general_context8);
|
|
||||||
#ifdef HEAP_MATCH_RECURSE
|
|
||||||
(void)pcre2_set_recursion_memory_management_8(default_dat_context8,
|
|
||||||
&my_stack_malloc, &my_stack_free, NULL);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SUPPORT_PCRE2_16
|
#ifdef SUPPORT_PCRE2_16
|
||||||
|
#undef BITS
|
||||||
|
#define BITS 16
|
||||||
if (test_mode == PCRE16_MODE)
|
if (test_mode == PCRE16_MODE)
|
||||||
{
|
{
|
||||||
general_context16 = pcre2_general_context_create_16(&my_malloc, &my_free,
|
CREATECONTEXTS;
|
||||||
NULL);
|
SETRECURSEMEMMAN;
|
||||||
default_pat_context16 = pcre2_compile_context_create_16(general_context16);
|
|
||||||
pat_context16 = pcre2_compile_context_create_16(general_context16);
|
|
||||||
default_dat_context16 = pcre2_match_context_create_16(general_context16);
|
|
||||||
dat_context16 = pcre2_match_context_create_16(general_context16);
|
|
||||||
match_data16 = pcre2_match_data_create_16(max_oveccount, general_context16);
|
|
||||||
#ifdef HEAP_MATCH_RECURSE
|
|
||||||
(void)pcre2_set_recursion_memory_management_16(default_dat_context16,
|
|
||||||
&my_stack_malloc, &my_stack_free, NULL);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SUPPORT_PCRE2_32
|
#ifdef SUPPORT_PCRE2_32
|
||||||
|
#undef BITS
|
||||||
|
#define BITS 32
|
||||||
if (test_mode == PCRE32_MODE)
|
if (test_mode == PCRE32_MODE)
|
||||||
{
|
{
|
||||||
general_context32 = pcre2_general_context_create_32(&my_malloc, &my_free,
|
CREATECONTEXTS;
|
||||||
NULL);
|
SETRECURSEMEMMAN;
|
||||||
default_pat_context32 = pcre2_compile_context_create_32(general_context32);
|
|
||||||
pat_context32 = pcre2_compile_context_create_32(general_context32);
|
|
||||||
default_dat_context32 = pcre2_match_context_create_32(general_context32);
|
|
||||||
dat_context32 = pcre2_match_context_create_32(general_context32);
|
|
||||||
match_data32 = pcre2_match_data_create_32(max_oveccount, general_context32);
|
|
||||||
#ifdef HEAP_MATCH_RECURSE
|
|
||||||
(void)pcre2_set_recursion_memory_management_32(default_dat_context32,
|
|
||||||
&my_stack_malloc, &my_stack_free, NULL);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Set a default parentheses nest limit that is large enough to run the
|
||||||
|
standard tests (this also exercises the function). */
|
||||||
|
|
||||||
|
PCRE2_SET_PARENS_NEST_LIMIT(default_pat_context, 220);
|
||||||
|
|
||||||
/* Handle command line modifier settings, sending any error messages to
|
/* Handle command line modifier settings, sending any error messages to
|
||||||
stderr. We need to know the mode before modifying the context, and it is tidier
|
stderr. We need to know the mode before modifying the context, and it is tidier
|
||||||
to do them all in the same way. */
|
to do them all in the same way. */
|
||||||
|
@ -5818,36 +6028,39 @@ free((void *)locale_tables);
|
||||||
PCRE2_MATCH_DATA_FREE(match_data);
|
PCRE2_MATCH_DATA_FREE(match_data);
|
||||||
SUB1(pcre2_code_free, compiled_code);
|
SUB1(pcre2_code_free, compiled_code);
|
||||||
|
|
||||||
|
PCRE2_JIT_FREE_UNUSED_MEMORY(general_context);
|
||||||
if (jit_stack != NULL)
|
if (jit_stack != NULL)
|
||||||
{
|
{
|
||||||
PCRE2_JIT_STACK_FREE(jit_stack);
|
PCRE2_JIT_STACK_FREE(jit_stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define FREECONTEXTS \
|
||||||
|
G(pcre2_general_context_free_,BITS)(G(general_context,BITS)); \
|
||||||
|
G(pcre2_general_context_free_,BITS)(G(general_context_copy,BITS)); \
|
||||||
|
G(pcre2_compile_context_free_,BITS)(G(pat_context,BITS)); \
|
||||||
|
G(pcre2_compile_context_free_,BITS)(G(default_pat_context,BITS)); \
|
||||||
|
G(pcre2_match_context_free_,BITS)(G(dat_context,BITS)); \
|
||||||
|
G(pcre2_match_context_free_,BITS)(G(default_dat_context,BITS))
|
||||||
|
|
||||||
#ifdef SUPPORT_PCRE2_8
|
#ifdef SUPPORT_PCRE2_8
|
||||||
|
#undef BITS
|
||||||
|
#define BITS 8
|
||||||
regfree(&preg);
|
regfree(&preg);
|
||||||
pcre2_general_context_free_8(general_context8);
|
FREECONTEXTS;
|
||||||
pcre2_compile_context_free_8(pat_context8);
|
|
||||||
pcre2_compile_context_free_8(default_pat_context8);
|
|
||||||
pcre2_match_context_free_8(dat_context8);
|
|
||||||
pcre2_match_context_free_8(default_dat_context8);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SUPPORT_PCRE2_16
|
#ifdef SUPPORT_PCRE2_16
|
||||||
|
#undef BITS
|
||||||
|
#define BITS 16
|
||||||
free(pbuffer16);
|
free(pbuffer16);
|
||||||
pcre2_general_context_free_16(general_context16);
|
FREECONTEXTS;
|
||||||
pcre2_compile_context_free_16(pat_context16);
|
|
||||||
pcre2_compile_context_free_16(default_pat_context16);
|
|
||||||
pcre2_match_context_free_16(dat_context16);
|
|
||||||
pcre2_match_context_free_16(default_dat_context16);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SUPPORT_PCRE2_32
|
#ifdef SUPPORT_PCRE2_32
|
||||||
|
#undef BITS
|
||||||
|
#define BITS 32
|
||||||
free(pbuffer32);
|
free(pbuffer32);
|
||||||
pcre2_general_context_free_32(general_context32);
|
FREECONTEXTS;
|
||||||
pcre2_compile_context_free_32(pat_context32);
|
|
||||||
pcre2_compile_context_free_32(default_pat_context32);
|
|
||||||
pcre2_match_context_free_32(dat_context32);
|
|
||||||
pcre2_match_context_free_32(default_dat_context32);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__VMS)
|
#if defined(__VMS)
|
||||||
|
|
|
@ -392,7 +392,7 @@ pcre2grep: pcre2_match() gave error -45 while matching this text:
|
||||||
|
|
||||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||||
|
|
||||||
pcre2grep: Error -44, -45 or -50 means that a resource limit was exceeded.
|
pcre2grep: Error -44, -45 or -51 means that a resource limit was exceeded.
|
||||||
pcre2grep: Check your regex for nested unlimited loops.
|
pcre2grep: Check your regex for nested unlimited loops.
|
||||||
---------------------------- Test 38 ------------------------------
|
---------------------------- Test 38 ------------------------------
|
||||||
This line contains a binary zero here > |