| 1 | # Copyright 2011-2012 Yuki Izumi. ( anneli AT cpan DOT org ) | ||||||||||||
| 2 | # This is free software; you can redistribute it and/or modify it under the | ||||||||||||
| 3 | # same terms as Perl itself. | ||||||||||||
| 4 | |||||||||||||
| 5 | package Erlang::Parser::Node::UnOp; | ||||||||||||
| 6 | |||||||||||||
| 7 | 4 | ▶ | use Moose; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | 4 | with 'Erlang::Parser::Node'; | |||||||||||
| 9 | |||||||||||||
| 10 | 4 | has 'op' => (is => 'rw', required => 1, isa => 'Str'); | |||||||||||
| 11 | 4 | has 'a' => (is => 'rw', required => 1, does => 'Erlang::Parser::Node'); | |||||||||||
| 12 | |||||||||||||
| 13 | sub print { | ||||||||||||
| 14 | 104 | ▶ | my ($self, $fh, $depth) = @_; | ||||||||||
|
Subroutine
print: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||
| 15 | 104 | ▶ | $depth ||= 0; | ||||||||||
|
Condition100%2/2
$depth ||= 0
MC/DC100%1/1
$depth ||= 0
$depth
Truth table100%2/2
A
A= $depth
| |||||||||||||
| 16 | |||||||||||||
| 17 | 104 | print $fh '('; | |||||||||||
| 18 | 104 | print $fh $self->op; | |||||||||||
| 19 | 104 | print $fh ' '; | |||||||||||
| 20 | 104 | $self->a->print($fh, $depth); | |||||||||||
| 21 | 104 | print $fh ')'; | |||||||||||
| 22 | } | ||||||||||||
| 23 | |||||||||||||
| 24 | 4 | __PACKAGE__->meta->make_immutable; | |||||||||||
| 25 | |||||||||||||
| 26 | =head1 NAME | ||||||||||||
| 27 | |||||||||||||
| 28 | Erlang::Parser::Node::UnOp - a unary operation | ||||||||||||
| 29 | |||||||||||||
| 30 | =head1 DESCRIPTION | ||||||||||||
| 31 | |||||||||||||
| 32 | An prefix unary operation. | ||||||||||||
| 33 | |||||||||||||
| 34 | =head2 Accessors | ||||||||||||
| 35 | |||||||||||||
| 36 | =over 4 | ||||||||||||
| 37 | |||||||||||||
| 38 | =item C<op> | ||||||||||||
| 39 | |||||||||||||
| 40 | The operation as a string (i.e. '!', 'not'). | ||||||||||||
| 41 | |||||||||||||
| 42 | =item C<a> | ||||||||||||
| 43 | |||||||||||||
| 44 | The L<Erlang::Parser::Node> argument to the operation. | ||||||||||||
| 45 | |||||||||||||
| 46 | =back | ||||||||||||
| 47 | |||||||||||||
| 48 | =head2 Methods | ||||||||||||
| 49 | |||||||||||||
| 50 | =over 4 | ||||||||||||
| 51 | |||||||||||||
| 52 | =item C<print> | ||||||||||||
| 53 | |||||||||||||
| 54 | Pretty-prints the node to its filehandle argument. | ||||||||||||
| 55 | |||||||||||||
| 56 | =back | ||||||||||||
| 57 | |||||||||||||
| 58 | =head1 EXAMPLE | ||||||||||||
| 59 | |||||||||||||
| 60 | !true | ||||||||||||
| 61 | |||||||||||||
| 62 | =cut | ||||||||||||
| 63 | |||||||||||||
| 64 | 4 | 1; | |||||||||||
| 65 | |||||||||||||
| 66 | # vim: set sw=4 ts=4: | ||||||||||||