| 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 | 4 | ▶ | use Moose; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | 4 | with 'Erlang::Parser::Node'; | |||||||||||
| 9 | |||||||||||||
| 10 | 4 | has 'output' => (is => 'rw', required => 1, isa => 'Erlang::Parser::Node'); | |||||||||||
| 11 | 4 | has 'size' => (is => 'rw', required => 0, isa => 'Maybe[Erlang::Parser::Node]'); | |||||||||||
| 12 | 4 | has 'qualifier' => (is => 'rw', required => 0, isa => 'Maybe[Str]'); | |||||||||||
| 13 | |||||||||||||
| 14 | sub print { | ||||||||||||
| 15 | 3270 | ▶ | my ($self, $fh, $depth) = @_; | ||||||||||
|
Subroutine
print: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||
| 16 | 3270 | ▶ | $depth ||= 0; | ||||||||||
|
Condition100%2/2
$depth ||= 0
MC/DC100%1/1
$depth ||= 0
$depth
Truth table100%2/2
A
A= $depth
| |||||||||||||
| 17 | |||||||||||||
| 18 | 3270 | print $fh '('; | |||||||||||
| 19 | 3270 | $self->output->print($fh, $depth); | |||||||||||
| 20 | 3270 | print $fh ')'; | |||||||||||
| 21 | 3270 | ▶ | if (defined $self->size) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 22 | 500 | print $fh ':'; | |||||||||||
| 23 | 500 | $self->size->print($fh, $depth); | |||||||||||
| 24 | } | ||||||||||||
| 25 | 3270 | ▶ | print $fh '/', $self->qualifier if defined $self->qualifier; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 26 | } | ||||||||||||
| 27 | |||||||||||||
| 28 | 4 | __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 | 4 | 1; | |||||||||||
| 75 | |||||||||||||
| 76 | # vim: set sw=4 ts=4: | ||||||||||||