| 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::BinOp; | ||||||||||||
| 6 | |||||||||||||
| 7 | 3 | ▶ | use Moose; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | 3 | with 'Erlang::Parser::Node'; | |||||||||||
| 9 | |||||||||||||
| 10 | 3 | has 'op' => (is => 'rw', required => 1, isa => 'Str'); | |||||||||||
| 11 | 3 | has 'a' => (is => 'rw', required => 1, does => 'Erlang::Parser::Node'); | |||||||||||
| 12 | 3 | has 'b' => (is => 'rw', required => 1, does => 'Erlang::Parser::Node'); | |||||||||||
| 13 | |||||||||||||
| 14 | 5406 | ▶ | sub print { | ||||||||||
|
Subroutine
print: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||
| 15 | 5406 | my ($self, $fh, $depth) = @_; | |||||||||||
| 16 | 5406 | ▶ | $depth ||= 0; | ||||||||||
|
Condition100%2/2
$depth ||= 0
MC/DC100%1/1
$depth ||= 0
$depth
Truth table100%2/2
A
A= $depth
| |||||||||||||
| 17 | |||||||||||||
| 18 | 5406 | print $fh '('; | |||||||||||
| 19 | 5406 | $self->a->print($fh, $depth); | |||||||||||
| 20 | |||||||||||||
| 21 | 5406 | print $fh ' '; | |||||||||||
| 22 | 5406 | print $fh $self->op; | |||||||||||
| 23 | 5406 | print $fh ' '; | |||||||||||
| 24 | |||||||||||||
| 25 | 5406 | $self->b->print($fh, $depth); | |||||||||||
| 26 | 5406 | print $fh ')'; | |||||||||||
| 27 | } | ||||||||||||
| 28 | |||||||||||||
| 29 | 3 | __PACKAGE__->meta->make_immutable; | |||||||||||
| 30 | |||||||||||||
| 31 | =head1 NAME | ||||||||||||
| 32 | |||||||||||||
| 33 | Erlang::Parser::Node::BinOp - a binary operation | ||||||||||||
| 34 | |||||||||||||
| 35 | =head1 DESCRIPTION | ||||||||||||
| 36 | |||||||||||||
| 37 | An infix binary operation. | ||||||||||||
| 38 | |||||||||||||
| 39 | =head2 Accessors | ||||||||||||
| 40 | |||||||||||||
| 41 | =over 4 | ||||||||||||
| 42 | |||||||||||||
| 43 | =item C<op> | ||||||||||||
| 44 | |||||||||||||
| 45 | The operation as a string (i.e. '+' for addition, '--' for list difference). | ||||||||||||
| 46 | |||||||||||||
| 47 | =item C<a>, C<b> | ||||||||||||
| 48 | |||||||||||||
| 49 | The first and second L<Erlang::Parser::Node> arguments to the operation. | ||||||||||||
| 50 | |||||||||||||
| 51 | =back | ||||||||||||
| 52 | |||||||||||||
| 53 | =head2 Methods | ||||||||||||
| 54 | |||||||||||||
| 55 | =over 4 | ||||||||||||
| 56 | |||||||||||||
| 57 | =item C<print> | ||||||||||||
| 58 | |||||||||||||
| 59 | Pretty-prints the node to its filehandle argument. | ||||||||||||
| 60 | |||||||||||||
| 61 | =back | ||||||||||||
| 62 | |||||||||||||
| 63 | =head1 EXAMPLE | ||||||||||||
| 64 | |||||||||||||
| 65 | 1 + 1 | ||||||||||||
| 66 | |||||||||||||
| 67 | =cut | ||||||||||||
| 68 | |||||||||||||
| 69 | 3 | 1; | |||||||||||
| 70 | |||||||||||||
| 71 | # vim: set sw=4 ts=4: | ||||||||||||