summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/perl/ext/re
diff options
context:
space:
mode:
authorafresh1 <afresh1@cvs.openbsd.org>2014-03-24 14:59:14 +0000
committerafresh1 <afresh1@cvs.openbsd.org>2014-03-24 14:59:14 +0000
commitc080cf55b5ad88c4056e6e9a4f858e0dfbf642b1 (patch)
tree90e52b9a68c9bf2fe8cd12484950cdc93821c2c4 /gnu/usr.bin/perl/ext/re
parent2fae50d18aceff793a4705626eb1156e0070870a (diff)
Import perl-5.18.2
OK espie@ sthen@ deraadt@
Diffstat (limited to 'gnu/usr.bin/perl/ext/re')
-rw-r--r--gnu/usr.bin/perl/ext/re/Makefile.PL9
-rw-r--r--gnu/usr.bin/perl/ext/re/re.pm43
-rw-r--r--gnu/usr.bin/perl/ext/re/re.xs12
-rw-r--r--gnu/usr.bin/perl/ext/re/re_top.h5
-rw-r--r--gnu/usr.bin/perl/ext/re/t/re_funcs_u.t4
5 files changed, 48 insertions, 25 deletions
diff --git a/gnu/usr.bin/perl/ext/re/Makefile.PL b/gnu/usr.bin/perl/ext/re/Makefile.PL
index a9733528c11..c6338c7ea2f 100644
--- a/gnu/usr.bin/perl/ext/re/Makefile.PL
+++ b/gnu/usr.bin/perl/ext/re/Makefile.PL
@@ -25,24 +25,29 @@ sub postamble {
my $regcomp_c = upupfile('regcomp.c');
my $regexec_c = upupfile('regexec.c');
my $dquote_static_c = upupfile('dquote_static.c');
+ my $inline_invlist_c = upupfile('inline_invlist.c');
<<EOF;
re_comp.c : $regcomp_c
- \$(RM_F) re_comp.c
\$(CP) $regcomp_c re_comp.c
-re_comp\$(OBJ_EXT) : re_comp.c dquote_static.c
+re_comp\$(OBJ_EXT) : re_comp.c dquote_static.c inline_invlist.c
re_exec.c : $regexec_c
- \$(RM_F) re_exec.c
\$(CP) $regexec_c re_exec.c
-re_exec\$(OBJ_EXT) : re_exec.c
+re_exec\$(OBJ_EXT) : re_exec.c inline_invlist.c
dquote_static.c : $dquote_static_c
- \$(RM_F) dquote_static.c
\$(CP) $dquote_static_c dquote_static.c
+inline_invlist.c : $inline_invlist_c
+ - \$(RM_F) inline_invlist.c
+ \$(CP) $inline_invlist_c inline_invlist.c
+
EOF
}
diff --git a/gnu/usr.bin/perl/ext/re/re.pm b/gnu/usr.bin/perl/ext/re/re.pm
index 5ce980104a4..84b701154d2 100644
--- a/gnu/usr.bin/perl/ext/re/re.pm
+++ b/gnu/usr.bin/perl/ext/re/re.pm
@@ -4,7 +4,7 @@ package re;
use strict;
use warnings;
-our $VERSION = "0.19_01";
+our $VERSION = "0.23";
our @ISA = qw(Exporter);
our @EXPORT_OK = ('regmust',
qw(is_regexp regexp_pattern
@@ -235,14 +235,16 @@ re - Perl pragma to alter regular expression behaviour
$pat = '(?{ $foo = 1 })';
use re 'eval';
- /foo${pat}bar/; # won't fail (when not under -T switch)
+ /foo${pat}bar/; # won't fail (when not under -T
+ # switch)
{
no re 'taint'; # the default
($x) = ($^X =~ /^(.*)$/s); # $x is not tainted here
no re 'eval'; # the default
- /foo${pat}bar/; # disallowed (with or without -T switch)
+ /foo${pat}bar/; # disallowed (with or without -T
+ # switch)
}
use re '/ix';
@@ -251,22 +253,27 @@ re - Perl pragma to alter regular expression behaviour
"FOO" =~ /foo/; # just /i implied
use re 'debug'; # output debugging info during
- /^(.*)$/s; # compile and run time
+ /^(.*)$/s; # compile and run time
- use re 'debugcolor'; # same as 'debug', but with colored output
+ use re 'debugcolor'; # same as 'debug', but with colored
+ # output
...
- use re qw(Debug All); # Finer tuned debugging options.
- use re qw(Debug More);
- no re qw(Debug ALL); # Turn of all re debugging in this scope
+ use re qw(Debug All); # Same as "use re 'debug'", but you
+ # can use "Debug" with things other
+ # than 'All'
+ use re qw(Debug More); # 'All' plus output more details
+ no re qw(Debug ALL); # Turn on (almost) all re debugging
+ # in this scope
use re qw(is_regexp regexp_pattern); # import utility functions
my ($pat,$mods)=regexp_pattern(qr/foo/i);
if (is_regexp($obj)) {
print "Got regexp: ",
- scalar regexp_pattern($obj); # just as perl would stringify it
- } # but no hassle with blessed re's.
+ scalar regexp_pattern($obj); # just as perl would stringify
+ } # it but no hassle with blessed
+ # re's.
(We use $^X in these examples because it's tainted by default.)
@@ -284,8 +291,9 @@ other transformations.
When C<use re 'eval'> is in effect, a regexp is allowed to contain
C<(?{ ... })> zero-width assertions and C<(??{ ... })> postponed
-subexpressions, even if the regular expression contains
-variable interpolation. That is normally disallowed, since it is a
+subexpressions that are derived from variable interpolation, rather than
+appearing literally within the regexp. That is normally disallowed, since
+it is a
potential security risk. Note that this pragma is ignored when the regular
expression is obtained from tainted data, i.e. evaluation is always
disallowed with tainted regular expressions. See L<perlre/(?{ code })>
@@ -408,7 +416,7 @@ Extra debugging of how tries execute.
=item INTUIT
-Enable debugging of start point optimisations.
+Enable debugging of start-point optimisations.
=back
@@ -442,7 +450,7 @@ states as well. This output from this can be quite large.
=item OPTIMISEM
-Enable enhanced optimisation debugging and start point optimisations.
+Enable enhanced optimisation debugging and start-point optimisations.
Probably not useful except when debugging the regexp engine itself.
=item OFFSETS
@@ -475,7 +483,8 @@ These are useful shortcuts to save on the typing.
=item ALL
-Enable all options at once except OFFSETS, OFFSETSDBG and BUFFERS
+Enable all options at once except OFFSETS, OFFSETSDBG and BUFFERS.
+(To get every single option without exception, use both ALL and EXTRA.)
=item All
@@ -487,14 +496,14 @@ Enable DUMP and all execute options. Equivalent to:
=item More
-Enable TRIEM and all execute compile and execute options.
+Enable the options enabled by "All", plus STATE, TRIEC, and TRIEM.
=back
=back
As of 5.9.5 the directive C<use re 'debug'> and its equivalents are
-lexically scoped, as the other directives are. However they have both
+lexically scoped, as are the other directives. However they have both
compile-time and run-time effects.
=head2 Exportable Functions
diff --git a/gnu/usr.bin/perl/ext/re/re.xs b/gnu/usr.bin/perl/ext/re/re.xs
index f40e16c8e46..1da68f12ee1 100644
--- a/gnu/usr.bin/perl/ext/re/re.xs
+++ b/gnu/usr.bin/perl/ext/re/re.xs
@@ -12,6 +12,10 @@
START_EXTERN_C
extern REGEXP* my_re_compile (pTHX_ SV * const pattern, const U32 pm_flags);
+extern REGEXP* my_re_op_compile (pTHX_ SV ** const patternp, int pat_count,
+ OP *expr, const regexp_engine* eng, REGEXP *VOL old_re,
+ bool *is_bare_re, U32 rx_flags, U32 pm_flags);
+
extern I32 my_regexec (pTHX_ REGEXP * const prog, char* stringarg, char* strend,
char* strbeg, I32 minend, SV* screamer,
void* data, U32 flags);
@@ -57,8 +61,9 @@ const struct regexp_engine my_reg_engine = {
my_reg_named_buff_iter,
my_reg_qr_package,
#if defined(USE_ITHREADS)
- my_regdupe
+ my_regdupe,
#endif
+ my_re_op_compile,
};
MODULE = re PACKAGE = re
@@ -95,8 +100,9 @@ PPCODE:
} else if (RX_FLOAT_UTF8(re)) {
fl = sv_2mortal(newSVsv(RX_FLOAT_UTF8(re)));
}
- XPUSHs(an);
- XPUSHs(fl);
+ EXTEND(SP, 2);
+ PUSHs(an);
+ PUSHs(fl);
XSRETURN(2);
}
XSRETURN_UNDEF;
diff --git a/gnu/usr.bin/perl/ext/re/re_top.h b/gnu/usr.bin/perl/ext/re/re_top.h
index 6eb02e33684..e73550f9a86 100644
--- a/gnu/usr.bin/perl/ext/re/re_top.h
+++ b/gnu/usr.bin/perl/ext/re/re_top.h
@@ -13,6 +13,7 @@
#define Perl_regprop my_regprop
#define Perl_re_intuit_start my_re_intuit_start
#define Perl_re_compile my_re_compile
+#define Perl_re_op_compile my_re_op_compile
#define Perl_regfree_internal my_regfree
#define Perl_re_intuit_string my_re_intuit_string
#define Perl_regdupe_internal my_regdupe
@@ -35,8 +36,8 @@
* Local variables:
* c-indentation-style: bsd
* c-basic-offset: 4
- * indent-tabs-mode: t
+ * indent-tabs-mode: nil
* End:
*
- * ex: set ts=8 sts=4 sw=4 noet:
+ * ex: set ts=8 sts=4 sw=4 et:
*/
diff --git a/gnu/usr.bin/perl/ext/re/t/re_funcs_u.t b/gnu/usr.bin/perl/ext/re/t/re_funcs_u.t
index 57d7281acf9..706437ec18b 100644
--- a/gnu/usr.bin/perl/ext/re/t/re_funcs_u.t
+++ b/gnu/usr.bin/perl/ext/re/t/re_funcs_u.t
@@ -41,7 +41,7 @@ if ('1234'=~/(?:(?<A>\d)|(?<C>!))(?<B>\d)(?<A>\d)(?<B>\d)/){
@names = sort +regnames(0);
is("@names","A B","regnames");
my $names = regnames();
- is($names, "B", "regnames in scalar context");
+ ok(($names eq "B" || $names eq "A"), "regnames in scalar context");
@names = sort +regnames(1);
is("@names","A B C","regnames");
is(join("", @{regname("A",1)}),"13");
@@ -92,6 +92,7 @@ if ('1234'=~/(?:(?<A>\d)|(?<C>!))(?<B>\d)(?<A>\d)(?<B>\d)/){
SKIP: {
skip_if_miniperl("no dynamic loading on miniperl, no POSIX", 3);
+ skip 'No locale testing without d_setlocale', 3 if(!$Config::Config{d_setlocale});
require POSIX;
my $current_locale = POSIX::setlocale( &POSIX::LC_CTYPE, 'de_DE.ISO-8859-1' );
if ( !$current_locale || $current_locale ne 'de_DE.ISO-8859-1' ) {
@@ -108,6 +109,7 @@ if ('1234'=~/(?:(?<A>\d)|(?<C>!))(?<B>\d)(?<A>\d)(?<B>\d)/){
SKIP: {
skip_if_miniperl("no dynamic loading on miniperl, no POSIX", 3);
+ skip 'No locale testing without d_setlocale', 3 if(!$Config::Config{d_setlocale});
require POSIX;
my $current_locale = POSIX::setlocale( &POSIX::LC_CTYPE, 'C' );
if ( !$current_locale || $current_locale ne 'C' ) {