| 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::String; | 
| 6 |  |  |  |  |  |  |  | 
| 7 | 3 |  |  | 3 |  | 10 | use Moose; | 
|  | 3 |  |  |  |  | 3 |  | 
|  | 3 |  |  |  |  | 14 |  | 
| 8 |  |  |  |  |  |  | with 'Erlang::Parser::Node'; | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | has 'string' => (is => 'rw', required => 1, isa => 'Str'); | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | sub print { | 
| 13 | 6096 |  |  | 6096 | 1 | 5307 | my ($self, $fh, $depth) = @_; | 
| 14 | 6096 |  | 100 |  |  | 8776 | $depth ||= 0; | 
| 15 |  |  |  |  |  |  |  | 
| 16 | 6096 |  |  |  |  | 145788 | my $string = $self->string; | 
| 17 | 6096 |  |  |  |  | 6317 | $string =~ s/\\/\\\\/g; | 
| 18 | 6096 |  |  |  |  | 5588 | $string =~ s/"/\\"/g; | 
| 19 |  |  |  |  |  |  |  | 
| 20 | 6096 |  |  |  |  | 14832 | print $fh "\"$string\""; | 
| 21 |  |  |  |  |  |  | } | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | sub _append { | 
| 24 | 29 |  |  | 29 |  | 35 | my ($self, $str) = @_; | 
| 25 | 29 |  |  |  |  | 767 | $self->string($self->string . $str); | 
| 26 | 29 |  |  |  |  | 53 | $self; | 
| 27 |  |  |  |  |  |  | } | 
| 28 |  |  |  |  |  |  |  | 
| 29 |  |  |  |  |  |  | __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 |  |  |  |  |  |  | 1; | 
| 66 |  |  |  |  |  |  |  | 
| 67 |  |  |  |  |  |  | # vim: set sw=4 ts=4: |