File Coverage

blib/lib/Erlang/Parser/Node/UnOp.pm
Criterion Covered Total %
statement 10 10 100.0
branch n/a
condition 2 2 100.0
subroutine 2 2 100.0
pod 1 1 100.0
total 15 15 100.0


line stmt bran cond sub pod time code
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 3     3   10 use Moose;
  3         4  
  3         12  
8             with 'Erlang::Parser::Node';
9              
10             has 'op' => (is => 'rw', required => 1, isa => 'Str');
11             has 'a' => (is => 'rw', required => 1, does => 'Erlang::Parser::Node');
12              
13             sub print {
14 104     104 1 170 my ($self, $fh, $depth) = @_;
15 104   100     252 $depth ||= 0;
16              
17 104         227 print $fh '(';
18 104         2779 print $fh $self->op;
19 104         216 print $fh ' ';
20 104         2637 $self->a->print($fh, $depth);
21 104         268 print $fh ')';
22             }
23              
24             __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             1;
65              
66             # vim: set sw=4 ts=4: