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::DefList; |
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
11
|
use Moose; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
16
|
|
8
|
|
|
|
|
|
|
with 'Erlang::Parser::Node'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has 'defs' => (is => 'rw', default => sub {[]}, isa => 'ArrayRef[Erlang::Parser::Node::Def]'); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub _append { |
13
|
3238
|
|
|
3238
|
|
4004
|
my ($self, $expr) = @_; |
14
|
3238
|
|
|
|
|
2742
|
push @{$self->defs}, $expr; |
|
3238
|
|
|
|
|
87931
|
|
15
|
3238
|
|
|
|
|
5899
|
$self; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub print { |
19
|
1378
|
|
|
1378
|
1
|
5235
|
my ($self, $fh, $depth) = @_; |
20
|
1378
|
|
50
|
|
|
4267
|
$depth ||= 0; |
21
|
|
|
|
|
|
|
|
22
|
1378
|
|
|
|
|
1103
|
my $first = 1; |
23
|
1378
|
|
|
|
|
1179
|
foreach (@{$self->defs}) { |
|
1378
|
|
|
|
|
36019
|
|
24
|
3238
|
100
|
|
|
|
4566
|
if ($first) { $first = 0 } else { print $fh ";\n", "\t" x $depth } |
|
1378
|
|
|
|
|
1316
|
|
|
1860
|
|
|
|
|
2756
|
|
25
|
3238
|
|
|
|
|
6733
|
$_->print($fh, $depth); |
26
|
|
|
|
|
|
|
} |
27
|
1378
|
|
|
|
|
3690
|
print $fh ".\n"; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 NAME |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Erlang::Parser::Node::DefList - a list of definitions for one function |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 DESCRIPTION |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
A set of definitions (alternative matches) for one function. |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head2 Accessors |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=over 4 |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=item C<defs> |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
A list of L<Erlang::Parser::Node::Def>s. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=back |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 Methods |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=over 4 |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=item C<print> |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Pretty-prints the node to its filehandle argument. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=back |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 EXAMPLE |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
fac(0) -> |
63
|
|
|
|
|
|
|
1; |
64
|
|
|
|
|
|
|
fac(N) -> |
65
|
|
|
|
|
|
|
N * fac(N - 1) |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=cut |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# vim: set sw=4 ts=4: |