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::Directive; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
551
|
use Moose; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
with 'Erlang::Parser::Node'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has 'directive' => (is => 'rw', required => 1, isa => 'Str'); |
11
|
|
|
|
|
|
|
has 'args' => (is => 'rw', required => 1, isa => 'ArrayRef[Erlang::Parser::Node]'); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub print { |
14
|
|
|
|
|
|
|
my ($self, $fh, $depth) = @_; |
15
|
|
|
|
|
|
|
$depth ||= 0; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
print $fh "-", $self->directive, "("; |
18
|
|
|
|
|
|
|
my $first = 1; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
foreach (@{$self->args}) { |
21
|
|
|
|
|
|
|
if ($first) { $first = 0 } else { print $fh ', ' } |
22
|
|
|
|
|
|
|
$_->print($fh, $depth); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
print $fh ").\n"; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 NAME |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Erlang::Parser::Node::Directive - a compiler directive |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 DESCRIPTION |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Any pragma to the compiler. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head2 Accessors |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=over 4 |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=item C<directive> |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
The name of the pragma. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=item C<args> |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
A list of L<Erlang::Parser::Node>s which make up the arguments of the |
48
|
|
|
|
|
|
|
directive, if any. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=back |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 Methods |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=over 4 |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=item C<print> |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Pretty-prints the node to its filehandle argument. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=back |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 EXAMPLE |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
-export([a/0]). |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=cut |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
# vim: set sw=4 ts=4: |