blib/lib/Erlang/Parser/Node/Atom.pm

filter: Statementstmt 100% 15 / 15 Branchbran 100% 2 / 2 Conditioncond 100% 5 / 5 MC/DCmcdc 100% 3 / 3 Subroutinesub 100% 2 / 2 Podpod 100% 1 / 1 totaltotal 100% 28 / 28 CC 4 SCAR 12.2
CC
4
Cov
100%
print
4.0
BEGIN
1.0
CRAP 3.4
« blib/lib/Erlang/Parser/Node/ReceiveAfter.pm ↑ Summary blib/lib/Erlang/Parser/Node/Binary.pm »
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::Atom;
6  
7 4 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 4 with 'Erlang::Parser::Node';
9  
10 4 has 'atom' => (is => 'rw', required => 1, isa => 'Str');
11  
12 sub print {
13 13512 ▶ my ($self, $fh, $depth) = @_;
Subroutine print: called CC=4 SCAR=13.9
Pod documented
14 13512 ▶ $depth ||= 0;
Condition100%2/2
$depth ||= 0
l!l
117721740
MC/DC100%1/1
$depth ||= 0
$depth
Truth table100%2/2
A
A= $depth
Aresult
11
00
15  
16 13512 ▶ if (not $self->atom =~ /^[^a-z]|[^a-zA-Z_0-9]/
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->atom =~ /^[^a-z]|[^a-zA-Z_0-9]/ || $self->atom =~ /^(case|receive|after|of|end|fun|when|div|bs[lr]|bx?or|band|rem|try|catch|andalso|and|orelse|or|begin|not|if)$/) { } 13252 260 13512
Condition100%3/3
$self->atom =~ /^[^a-z]|[^a-zA-Z_0-9]/ || $self->atom =~ /^(case|receive|after|of|end|fun|when|div|bs[lr]|bx?or|band|rem|try|catch|andalso|and|orelse|or|begin|not|if)$/
l!l&&r!l&&!r
258213252
MC/DC100%2/2
$self->atom =~ /^[^a-z]|[^a-zA-Z_0-9]/ || $self->atom =~ /^(case|receive|after|of|end|fun|when|div|bs[lr]|bx?or|band|rem|try|catch|andalso|and|orelse|or|begin|not|if)$/
$self->atom =~ /^[^a-z]|[^a-zA-Z_0-9]/ $self->atom =~ /^(case|receive|after|of|end|fun|when|div|bs[lr]|bx?or|band|rem|try|catch|andalso|and|orelse|or|begin|not|if)$/
Truth table100%3/3
A || B
A= $self->atom =~ /^[^a-z]|[^a-zA-Z_0-9]/B= $self->atom =~ /^(case|receive|after|of|end|fun|when|div|bs[lr]|bx?or|band|rem|try|catch|andalso|and|orelse|or|begin|not|if)$/
ABresult
1X1
011
000
17 and not $self->atom =~ /^(case|receive|after|of|end|fun|when|div|bs[lr]|bx?or|band|rem|try|catch|andalso|and|orelse|or|begin|not|if)$/) {
18 13252 print $fh $self->atom;
19 } else {
20 260 my $atom = $self->atom;
21 260 $atom =~ s/\\/\\\\/g;
22 260 $atom =~ s/'/\\'/g;
23  
24 260 print $fh "'$atom'";
25 }
26 }
27  
28 4 __PACKAGE__->meta->make_immutable;
29  
30 =head1 NAME
31  
32 Erlang::Parser::Node::Atom - a plain atom
33  
34 =head1 DESCRIPTION
35  
36 The basic symbol unit in Erlang.
37  
38 =head2 Accessors
39  
40 =over 4
41  
42 =item C<atom>
43  
44 The string representation of the atom>
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 my.atom@is.long.
61  
62 =cut
63  
64 4 1;
65  
66 # vim: set sw=4 ts=4:
« blib/lib/Erlang/Parser/Node/ReceiveAfter.pm ↑ Summary blib/lib/Erlang/Parser/Node/Binary.pm »