File Coverage

blib/lib/Erlang/Parser/Node/BinaryExpr.pm
Criterion Covered Total %
statement 12 12 100.0
branch 4 4 100.0
condition 2 2 100.0
subroutine 2 2 100.0
pod 1 1 100.0
total 21 21 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::BinaryExpr;
6              
7 3     3   12 use Moose;
  3         4  
  3         14  
8             with 'Erlang::Parser::Node';
9              
10             has 'output' => (is => 'rw', required => 1, isa => 'Erlang::Parser::Node');
11             has 'size' => (is => 'rw', required => 0, isa => 'Maybe[Erlang::Parser::Node]');
12             has 'qualifier' => (is => 'rw', required => 0, isa => 'Maybe[Str]');
13              
14             sub print {
15 3270     3270 1 2842 my ($self, $fh, $depth) = @_;
16 3270   100     4360 $depth ||= 0;
17              
18 3270         3108 print $fh '(';
19 3270         82188 $self->output->print($fh, $depth);
20 3270         3753 print $fh ')';
21 3270 100       81732 if (defined $self->size) {
22 500         583 print $fh ':';
23 500         12172 $self->size->print($fh, $depth);
24             }
25 3270 100       81756 print $fh '/', $self->qualifier if defined $self->qualifier;
26             }
27              
28             __PACKAGE__->meta->make_immutable;
29              
30             =head1 NAME
31              
32             Erlang::Parser::Node::BinaryExpr - a term within a binary term
33              
34             =head1 DESCRIPTION
35              
36             Any expression that can be part of the body of a binary list or string.
37              
38             =head2 Accessors
39              
40             =over 4
41              
42             =item C<output>
43              
44             The L<Erlang::Parser::Node> which provides the output for this term.
45              
46             =item C<size>
47              
48             A L<Erlang::Parser::Node> which specifies the length (in bits) of this term,
49             or C<undef>.
50              
51             =item C<qualifier>
52              
53             Qualifiers that specify how this term is to be output in string form, or
54             C<undef>.
55              
56             =back
57              
58             =head2 Methods
59              
60             =over 4
61              
62             =item C<print>
63              
64             Pretty-prints the node to its filehandle argument.
65              
66             =back
67              
68             =head1 EXAMPLE
69              
70             X:8/integer-signed-big
71              
72             =cut
73              
74             1;
75              
76             # vim: set sw=4 ts=4: