B-DeparseTree
view release on metacpan or search on metacpan
lib/B/DeparseTree/P518.pm view on Meta::CPAN
use warnings ();
require feature;
our(@EXPORT, @ISA);
our $VERSION = '3.2.0';
@ISA = qw(Exporter);
BEGIN {
# List version-specific constants here.
# Easiest way to keep this code portable between version looks to
# be to fake up a dummy constant that will never actually be true.
foreach (qw(OPpSORT_INPLACE OPpSORT_DESCEND OPpITER_REVERSED OPpCONST_NOVER
OPpPAD_STATE PMf_SKIPWHITE RXf_SKIPWHITE
RXf_PMf_CHARSET RXf_PMf_KEEPCOPY
CVf_LOCKED OPpREVERSE_INPLACE OPpSUBSTR_REPL_FIRST
PMf_NONDESTRUCT OPpCONST_ARYBASE OPpEVAL_BYTES)) {
eval { import B $_ };
no strict 'refs';
*{$_} = sub () {0} unless *{$_}{CODE};
}
lib/B/DeparseTree/P522.pm view on Meta::CPAN
use strict;
use vars qw/$AUTOLOAD/;
use warnings ();
require feature;
our $VERSION = '3.2.0';
BEGIN {
# List version-specific constants here.
# Easiest way to keep this code portable between version looks to
# be to fake up a dummy constant that will never actually be true.
foreach (qw(OPpSORT_INPLACE OPpSORT_DESCEND OPpITER_REVERSED OPpCONST_NOVER
OPpPAD_STATE PMf_SKIPWHITE RXf_SKIPWHITE
RXf_PMf_CHARSET RXf_PMf_KEEPCOPY CVf_ANONCONST
CVf_LOCKED OPpREVERSE_INPLACE OPpSUBSTR_REPL_FIRST
PMf_NONDESTRUCT OPpCONST_ARYBASE OPpEVAL_BYTES)) {
eval { import B $_ };
no strict 'refs';
*{$_} = sub () {0} unless *{$_}{CODE};
}
lib/B/DeparseTree/P526.pm view on Meta::CPAN
our(@EXPORT, @ISA);
our $VERSION = '3.2.0';
@ISA = qw(B::DeparseTree::PP);
@EXPORT = qw(slice);
BEGIN {
# List version-specific constants here.
# Easiest way to keep this code portable between version looks to
# be to fake up a dummy constant that will never actually be true.
foreach (qw(OPpSORT_INPLACE OPpSORT_DESCEND OPpITER_REVERSED OPpCONST_NOVER
OPpPAD_STATE PMf_SKIPWHITE RXf_SKIPWHITE
PMf_CHARSET PMf_KEEPCOPY PMf_NOCAPTURE CVf_ANONCONST
CVf_LOCKED OPpREVERSE_INPLACE OPpSUBSTR_REPL_FIRST
PMf_NONDESTRUCT OPpCONST_ARYBASE OPpEVAL_BYTES
OPpLVREF_TYPE OPpLVREF_SV OPpLVREF_AV OPpLVREF_HV
OPpLVREF_CV OPpLVREF_ELEM SVpad_STATE)) {
eval { B->import($_) };
no strict 'refs';
lib/B/DeparseTree/P526c.pm view on Meta::CPAN
use warnings ();
require feature;
use types;
our $VERSION = '3.2.0';
our @ISA = qw(Exporter);
BEGIN {
# List version-specific constants here.
# Easiest way to keep this code portable between version looks to
# be to fake up a dummy constant that will never actually be true.
foreach (qw(OPpSORT_INPLACE OPpSORT_DESCEND OPpITER_REVERSED OPpCONST_NOVER
OPpPAD_STATE PMf_SKIPWHITE RXf_SKIPWHITE
PMf_CHARSET PMf_KEEPCOPY PMf_NOCAPTURE CVf_ANONCONST
CVf_LOCKED OPpREVERSE_INPLACE OPpSUBSTR_REPL_FIRST
PMf_NONDESTRUCT OPpCONST_ARYBASE OPpEVAL_BYTES
OPpLVREF_TYPE OPpLVREF_SV OPpLVREF_AV OPpLVREF_HV
OPpLVREF_CV OPpLVREF_ELEM SVpad_STATE)) {
eval { B->import($_) };
no strict 'refs';
lib/B/DeparseTree/PP.pm view on Meta::CPAN
pp_truncate
pp_unstack
pp_values
pp_vec
pp_waitpid
pp_xor
);
BEGIN {
# List version-specific constants here.
# Easiest way to keep this code portable between version looks to
# be to fake up a dummy constant that will never actually be true.
foreach (qw(OPpCONST_ARYBASE OPpEVAL_BYTES)) {
eval { import B $_ };
no strict 'refs';
*{$_} = sub () {0} unless *{$_}{CODE};
}
}
BEGIN { for (qw[ const stringify rv2sv list glob pushmark null aelem
nextstate dbstate rv2av rv2hv helem custom ]) {
lib/B/DeparseTree/PPfns.pm view on Meta::CPAN
# The BEGIN {} is used here because otherwise this code isn't executed
# when you run B::Deparse on itself.
my %globalnames;
BEGIN { map($globalnames{$_}++, "SIG", "STDIN", "STDOUT", "STDERR", "INC",
"ENV", "ARGV", "ARGVOUT", "_"); }
BEGIN {
# List version-specific constants here.
# Easiest way to keep this code portable between version looks to
# be to fake up a dummy constant that will never actually be true.
foreach (qw(
CVf_LOCKED
OPpCONST_ARYBASE
OPpCONST_NOVER
OPpEVAL_BYTES
OPpITER_REVERSED
OPpOUR_INTRO
OPpPAD_STATE
OPpREVERSE_INPLACE
lib/B/DeparseTree/PPfns.pm view on Meta::CPAN
my($self, $func, $params, $cx, $prec) = @_;
if ($prec <= $cx or substr($params, 0, 1) eq "(" or $self->{'parens'}) {
return ($func, '(', $params, ')');
} else {
return ($func, ' ', $params);
}
}
# Sort of like maybe_parens in that we may possibly add (). However we take
# an op rather than text, and return a tree node. Also, we get around
# the 'if it looks like a function' rule.
sub maybe_parens_unop($$$$$)
{
my ($self, $name, $op, $cx, $parent, $opts) = @_;
$opts = {} unless $opts;
my $info = $self->deparse($op, 1, $parent);
my $fmt;
my @exprs = ($info);
if ($name eq "umask" && $info->{text} =~ /^\d+$/) {
# Display umask numbers in octal.
# FIXME: add as a info_node option to run a transformation function
lib/B/DeparseTree/PPfns.pm view on Meta::CPAN
return $node;
} else {
# FIXME: we don't do \cS
# if (substr($text, 0, 1) eq "\cS") {
# # use op's parens
# return info_from_list($op, $self,[$name, substr($text, 1)],
# '', 'maybe_parens_unop_cS', {body => [$info]});
# } else
my $node;
if (substr($info->{text}, 0, 1) eq "(") {
# avoid looks-like-a-function trap with extra parens
# ('+' can lead to ambiguities)
$node = $self->info_from_template(
"$name(()) dup remove", $parent, "$name(%c)", [0], \@exprs, $opts);
} else {
$node = $self->info_from_template(
"$name <args>", $parent, "$name %c", [0], \@exprs, $opts);
}
$node->{prev_expr} = $exprs[0];
return $node;
}
lib/B/DeparseTree/TreeMain.pm view on Meta::CPAN
# when you run B::Deparse on itself.
my %globalnames;
BEGIN { map($globalnames{$_}++, "SIG", "STDIN", "STDOUT", "STDERR", "INC",
"ENV", "ARGV", "ARGVOUT", "_"); }
my $max_prec;
BEGIN { $max_prec = int(0.999 + 8*length(pack("F", 42))*log(2)/log(10)); }
BEGIN {
# List version-specific constants here.
# Easiest way to keep this code portable between version looks to
# be to fake up a dummy constant that will never actually be true.
foreach (qw(OPpSORT_INPLACE OPpSORT_DESCEND OPpITER_REVERSED
OPpCONST_NOVER OPpPAD_STATE PMf_SKIPWHITE RXf_SKIPWHITE
RXf_PMf_CHARSET RXf_PMf_KEEPCOPY
CVf_LOCKED OPpREVERSE_INPLACE OPpSUBSTR_REPL_FIRST
PMf_NONDESTRUCT OPpCONST_ARYBASE OPpEVAL_BYTES)) {
eval { import B $_ };
no strict 'refs';
*{$_} = sub () {0} unless *{$_}{CODE};
}
t/testdata/P526.pm view on Meta::CPAN
my $e = delete $h{'foo'}[$i];
####
# multideref with leading expression
my $r;
my $x = +($r // [])->{'foo'}[0];
####
# multideref with complex middle index
my(%h, $i, $j, $k);
my $x = $h{'foo'}[$i + $j]{$k};
####
# multideref with trailing non-simple index that initially looks simple
# (i.e. the constant "3")
my($r, $i, $j, $k);
my $x = +($r || {})->{'foo'}[$i + $j]{3 + $k};
####
# chdir
chdir 'file';
chdir FH;
chdir;
####
# 5.22 bitops
( run in 0.380 second using v1.01-cache-2.11-cpan-607d282f910 )