B-DeparseTree

 view release on metacpan or  search on metacpan

lib/B/DeparseTree/PP.pm  view on Meta::CPAN

    pp_kvhslice
    pp_le
    pp_leave
    pp_leavegiven
    pp_leaveloop
    pp_leavetry
    pp_leavewhen
    pp_lineseq
    pp_list
    pp_lslice
    pp_lt
    pp_mapstart
    pp_ne
    pp_negate
    pp_not
    pp_null
    pp_once
    pp_open_dir
    pp_or
    pp_padcv
    pp_pos
    pp_preinc
    pp_print
    pp_prtf
    pp_pushre
    pp_qr
    pp_rcatline
    pp_readline
    pp_refgen
    pp_require
    pp_rv2cv
    pp_sassign
    pp_scalar
    pp_scmp
    pp_scope
    pp_seq
    pp_sge
    pp_sgt
    pp_sle
    pp_slt
    pp_sne
    pp_sockpair
    pp_split
    pp_smartmatch
    pp_stringify
    pp_stub
    pp_subst
    pp_substr
    pp_trans
    pp_transr
    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 ]) {
    eval "sub OP_\U$_ () { " . opnumber($_) . "}"
}}

sub feature_enabled {
	my($self,$name) = @_;
	my $hh;
	my $hints = $self->{hints} & $feature::hint_mask;
	if ($hints && $hints != $feature::hint_mask) {
	    $hh = B::Deparse::_features_from_bundle($hints);
	}
	elsif ($hints) { $hh = $self->{'hinthash'} }
	return $hh && $hh->{"feature_$feature_keywords{$name}"}
}

# FIXME: These don't seem to be able to go into the table.
# PPfns calls pp_sockpair for example?
sub pp_avalues  { unop(@_, "values") }
sub pp_exec     { maybe_targmy(@_, \&listop, "exec") }
sub pp_exp      { maybe_targmy(@_, \&unop, "exp") }
sub pp_leave    { scopeop(1, @_); }
sub pp_lineseq  { scopeop(0, @_); }
sub pp_or       { logop(@_, "or",  2, "||", 10, "unless") }
sub pp_preinc   { pfixop(@_, "++", 23) }
sub pp_print    { indirop(@_, "print") }
sub pp_prtf     { indirop(@_, "printf") }
sub pp_sockpair { listop(@_, "socketpair") }
sub pp_values   { unop(@_, "values") }
sub pp_pushre   { matchop(@_, "m", "/") }  # Is also in OP_PP table
sub pp_qr       { matchop(@_, "qr", "") }  # Is also in OP_PP table

# Convert these to table entries...
sub pp_aelem { maybe_local(@_, elem(@_, "[", "]", "padav")) }
sub pp_aslice   { maybe_local(@_, slice(@_, "[", "]", "rv2av", "padav")) }
sub pp_cmp { binop(@_, "<=>", 14) }
sub pp_eq { binop(@_, "==", 14) }
sub pp_ge { binop(@_, ">=", 15) }
sub pp_gt { binop(@_, ">", 15) }
sub pp_helem { maybe_local(@_, elem(@_, "{", "}", "padhv")) }
sub pp_hslice   { maybe_local(@_, slice(@_, "{", "}", "rv2hv", "padhv")) }
sub pp_i_cmp { maybe_targmy(@_, \&binop, "<=>", 14) }
sub pp_i_eq { binop(@_, "==", 14) }
sub pp_i_ge { binop(@_, ">=", 15) }
sub pp_i_gt { binop(@_, ">", 15) }
sub pp_i_le { binop(@_, "<=", 15) }
sub pp_i_lt { binop(@_, "<", 15) }
sub pp_i_ne { binop(@_, "!=", 14) }
sub pp_kvaslice { slice(@_, "[", "]", "rv2av", "padav")  }
sub pp_kvhslice { slice(@_, "{", "}", "rv2hv", "padhv")  }
sub pp_le { binop(@_, "<=", 15) }
sub pp_lt { binop(@_, "<", 15) }



( run in 3.053 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )