File Coverage

blib/lib/Erlang/Parser/Node/Macro.pm
Criterion Covered Total %
statement 6 6 100.0
branch n/a
condition 2 2 100.0
subroutine 2 2 100.0
pod 1 1 100.0
total 11 11 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::Macro;
6              
7 3     3   11 use Moose;
  3         5  
  3         13  
8             with 'Erlang::Parser::Node';
9              
10             has 'macro' => (is => 'rw', required => 1, isa => 'Str');
11              
12             sub print {
13 1420     1420 1 1432 my ($self, $fh, $depth) = @_;
14 1420   100     2193 $depth ||= 0;
15              
16 1420         33881 print $fh '?', $self->macro;
17             }
18              
19             __PACKAGE__->meta->make_immutable;
20              
21             =head1 NAME
22              
23             Erlang::Parser::Node::Macro - a preprocessor-style macro
24              
25             =head1 DESCRIPTION
26              
27             Defined with the -define() directive; expands as any node.
28              
29             =head2 Accessors
30              
31             =over 4
32              
33             =item C<macro>
34              
35             The name of the macro being invoked.
36              
37             =back
38              
39             =head2 Methods
40              
41             =over 4
42              
43             =item C<print>
44              
45             Pretty-prints the node to its filehandle argument.
46              
47             =back
48              
49             =head1 EXAMPLE
50              
51             ?MODULE
52              
53             =cut
54              
55             1;
56              
57             # vim: set sw=4 ts=4: