From: Gurusamy Sarathy Date: Fri, 3 Mar 2000 02:19:50 +0000 (+0000) Subject: /(?p{})/ changed to /(??{})/, per Larry's suggestion (from X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=14455d6cc193f1e4316f87b9dbe258db24ceb714;p=p5sagit%2Fp5-mst-13.2.git /(?p{})/ changed to /(??{})/, per Larry's suggestion (from Simon Cozens ) p4raw-id: //depot/perl@5467 --- diff --git a/lib/AutoSplit.pm b/lib/AutoSplit.pm index ecdb039..0be3ae6 100644 --- a/lib/AutoSplit.pm +++ b/lib/AutoSplit.pm @@ -148,7 +148,7 @@ my $Is_VMS = ($^O eq 'VMS'); # allow checking for valid ': attrlist' attachments my $nested; -$nested = qr{ \( (?: (?> [^()]+ ) | (?p{ $nested }) )* \) }x; +$nested = qr{ \( (?: (?> [^()]+ ) | (??{ $nested }) )* \) }x; my $one_attr = qr{ (?> (?! \d) \w+ (?:$nested)? ) (?:\s*\:\s*|\s+(?!\:)) }x; my $attr_list = qr{ \s* : \s* (?: $one_attr )* }x; diff --git a/lib/ExtUtils/xsubpp b/lib/ExtUtils/xsubpp index 49d167d..ff66b22 100755 --- a/lib/ExtUtils/xsubpp +++ b/lib/ExtUtils/xsubpp @@ -249,9 +249,9 @@ foreach $key (keys %input_expr) { $input_expr{$key} =~ s/\n+$//; } -$bal = qr[(?:(?>[^()]+)|\((?p{ $bal })\))*]; # ()-balanced +$bal = qr[(?:(?>[^()]+)|\((??{ $bal })\))*]; # ()-balanced $cast = qr[(?:\(\s*SV\s*\*\s*\)\s*)?]; # Optional (SV*) cast -$size = qr[,\s* (?p{ $bal }) ]x; # Third arg (to setpvn) +$size = qr[,\s* (??{ $bal }) ]x; # Third arg (to setpvn) foreach $key (keys %output_expr) { use re 'eval'; @@ -260,8 +260,8 @@ foreach $key (keys %output_expr) { ($output_expr{$key} =~ m[^ \s+ sv_set ( [iunp] ) v (n)? # Type, is_setpvn \s* \( \s* $cast \$arg \s* , - \s* ( (?p{ $bal }) ) # Set from - ( (?p{ $size }) )? # Possible sizeof set-from + \s* ( (??{ $bal }) ) # Set from + ( (??{ $size }) )? # Possible sizeof set-from \) \s* ; \s* $ ]x); $targetable{$key} = [$t, $with_size, $arg, $sarg] if $t; @@ -287,11 +287,11 @@ sub check_keyword { my ($C_group_rex, $C_arg); # Group in C (no support for comments or literals) $C_group_rex = qr/ [({\[] - (?: (?> [^()\[\]{}]+ ) | (?p{ $C_group_rex }) )* + (?: (?> [^()\[\]{}]+ ) | (??{ $C_group_rex }) )* [)}\]] /x ; # Chunk in C without comma at toplevel (no comments): $C_arg = qr/ (?: (?> [^()\[\]{},"']+ ) - | (?p{ $C_group_rex }) + | (??{ $C_group_rex }) | " (?: (?> [^\\"]+ ) | \\. )* " # String literal @@ -1029,8 +1029,8 @@ while (fetch_para()) { my %out_vars; if ($process_argtypes and $orig_args =~ /\S/) { my $args = "$orig_args ,"; - if ($args =~ /^( (?p{ $C_arg }) , )* $ /x) { - @args = ($args =~ /\G ( (?p{ $C_arg }) ) , /xg); + if ($args =~ /^( (??{ $C_arg }) , )* $ /x) { + @args = ($args =~ /\G ( (??{ $C_arg }) ) , /xg); for ( @args ) { s/^\s+//; s/\s+$//; diff --git a/lib/SelfLoader.pm b/lib/SelfLoader.pm index 2aa2930..ff441c7 100644 --- a/lib/SelfLoader.pm +++ b/lib/SelfLoader.pm @@ -11,7 +11,7 @@ my %Cache; # private cache for all SelfLoader's client packages # allow checking for valid ': attrlist' attachments my $nested; -$nested = qr{ \( (?: (?> [^()]+ ) | (?p{ $nested }) )* \) }x; +$nested = qr{ \( (?: (?> [^()]+ ) | (??{ $nested }) )* \) }x; my $one_attr = qr{ (?> (?! \d) \w+ (?:$nested)? ) (?:\s*\:\s*|\s+(?!\:)) }x; my $attr_list = qr{ \s* : \s* (?: $one_attr )* }x; diff --git a/pod/perlre.pod b/pod/perlre.pod index d2f64d2..52eac04 100644 --- a/pod/perlre.pod +++ b/pod/perlre.pod @@ -570,7 +570,7 @@ so you should only do so if you are also using taint checking. Better yet, use the carefully constrained evaluation within a Safe module. See L for details about both these mechanisms. -=item C<(?p{ code })> +=item C<(??{ code })> B: This extended regular expression feature is considered highly experimental, and may be changed or deleted without notice. @@ -592,7 +592,7 @@ The following pattern matches a parenthesized group: (?: (?> [^()]+ ) # Non-parens without backtracking | - (?p{ $re }) # Group with matching parens + (??{ $re }) # Group with matching parens )* \) }x; @@ -1175,7 +1175,7 @@ else in the whole regular expression.) For this grouping operator there is no need to describe the ordering, since only whether or not C can match is important. -=item C<(?p{ EXPR })> +=item C<(??{ EXPR })> The ordering is the same as for the regular expression which is the result of EXPR. diff --git a/pod/perltoc.pod b/pod/perltoc.pod index 83d40d4..0a67fdc 100644 --- a/pod/perltoc.pod +++ b/pod/perltoc.pod @@ -1648,7 +1648,7 @@ cntrl, graph, print, punct, xdigit C<(?#text)>, C<(?imsx-imsx)>, C<(?:pattern)>, C<(?imsx-imsx:pattern)>, C<(?=pattern)>, C<(?!pattern)>, C<(?E=pattern)>, C<(?, C<(?{ -code })>, C<(?p{ code })>, C<(?Epattern)>, +code })>, C<(??{ code })>, C<(?Epattern)>, C<(?(condition)yes-pattern|no-pattern)>, C<(?(condition)yes-pattern)> =item Backtracking @@ -1663,7 +1663,7 @@ C<(?(condition)yes-pattern|no-pattern)>, C<(?(condition)yes-pattern)> C, C, C, C, C, C, C, C, C, C, C, C<(?ES)>, C<(?=S)>, C<(?<=S)>, -C<(?!S)>, C<(?, C<(?p{ EXPR })>, +C<(?!S)>, C<(?, C<(??{ EXPR })>, C<(?(condition)yes-pattern|no-pattern)> =item Creating custom RE engines diff --git a/regcomp.c b/regcomp.c index 271c20c..f4fcaa9 100644 --- a/regcomp.c +++ b/regcomp.c @@ -1734,7 +1734,7 @@ S_reg(pTHX_ I32 paren, I32 *flagp) nextchar(); *flagp = TRYAGAIN; return NULL; - case 'p': + case '?': logical = 1; paren = *PL_regcomp_parse++; /* FALL THROUGH */ diff --git a/t/op/misc.t b/t/op/misc.t index b46c0cc..a595694 100755 --- a/t/op/misc.t +++ b/t/op/misc.t @@ -482,7 +482,7 @@ new1new22DESTROY2new33DESTROY31DESTROY1 ######## re(); sub re { - my $re = join '', eval 'qr/(?p{ $obj->method })/'; + my $re = join '', eval 'qr/(??{ $obj->method })/'; $re; } EXPECT diff --git a/t/op/pat.t b/t/op/pat.t index 142b82e..103e613 100755 --- a/t/op/pat.t +++ b/t/op/pat.t @@ -370,7 +370,7 @@ print "ok $test\n"; $test++; my $matched; -$matched = qr/\((?:(?>[^()]+)|(?p{$matched}))*\)/; +$matched = qr/\((?:(?>[^()]+)|(??{$matched}))*\)/; @ans = @ans1 = (); push(@ans, $res), push(@ans1, $&) while $res = m/$matched/g; @@ -866,7 +866,7 @@ print "ok $test\n"; $test++; $brackets = qr{ - { (?> [^{}]+ | (?p{ $brackets }) )* } + { (?> [^{}]+ | (??{ $brackets }) )* } }x; "{{}" =~ $brackets; @@ -877,7 +877,7 @@ $test++; print "ok $test\n"; # Did we survive? $test++; -"something { long { and } hairy" =~ m/((?p{ $brackets }))/; +"something { long { and } hairy" =~ m/((??{ $brackets }))/; print "not " unless $1 eq "{ and }"; print "ok $test\n"; $test++; diff --git a/toke.c b/toke.c index e18a4c8..3af0896 100644 --- a/toke.c +++ b/toke.c @@ -1270,7 +1270,7 @@ S_scan_const(pTHX_ char *start) while (s < send && *s != ')') *d++ = *s++; } else if (s[2] == '{' - || s[2] == 'p' && s[3] == '{') { /* This should march regcomp.c */ + || s[2] == '?' && s[3] == '{') { /* This should march regcomp.c */ I32 count = 1; char *regparse = s + (s[2] == '{' ? 3 : 4); char c;