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

filter: Statementstmt 100% 16 / 16 Branchbran n/a Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 3 / 3 Podpod 100% 1 / 1 totaltotal 100% 23 / 23 CC 2 SCAR 4.1
CC
2
Cov
100%
print
2.0
BEGIN
1.0
_append
1.0
CRAP 1.5
« blib/lib/Erlang/Parser/Lexer.pm ↑ Summary lib/Erlang/Parser/Parser.yp »
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::String;
6  
7 3 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 with 'Erlang::Parser::Node';
9  
10 3 has 'string' => (is => 'rw', required => 1, isa => 'Str');
11  
12 6096 ▶sub print {
Subroutine print: called CC=2 SCAR=6.9
Pod documented
13 6096 my ($self, $fh, $depth) = @_;
14 6096 ▶ $depth ||= 0;
Condition100%2/2
$depth ||= 0
l!l
49881108
MC/DC100%1/1
$depth ||= 0
$depth
Truth table100%2/2
A
A= $depth
Aresult
11
00
15  
16 6096 my $string = $self->string;
17 6096 $string =~ s/\\/\\\\/g;
18 6096 $string =~ s/"/\\"/g;
19  
20 6096 print $fh "\"$string\"";
21 }
22  
23 29 ▶sub _append {
Subroutine _append: called CC=1 SCAR=0.0
24 29 my ($self, $str) = @_;
25 29 $self->string($self->string . $str);
26 29 $self;
27 }
28  
29 3 __PACKAGE__->meta->make_immutable;
30  
31 =head1 NAME
32  
33 Erlang::Parser::Node::String - a string
34  
35 =head1 DESCRIPTION
36  
37 Just a string literal.
38  
39 =head2 Accessors
40  
41 =over 4
42  
43 =item C<string>
44  
45 The string.
46  
47 =back
48  
49 =head2 Methods
50  
51 =over 4
52  
53 =item C<print>
54  
55 Pretty-prints the node to its filehandle argument.
56  
57 =back
58  
59 =head1 EXAMPLE
60  
61 "I ain't buyin' the Hone Avenue one for like, above 580."
62  
63 =cut
64  
65 3 1;
66  
67 # vim: set sw=4 ts=4:
« blib/lib/Erlang/Parser/Lexer.pm ↑ Summary lib/Erlang/Parser/Parser.yp »