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::Begin; |
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
12
|
use Moose; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
13
|
|
8
|
|
|
|
|
|
|
with 'Erlang::Parser::Node'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has 'exprs' => (is => 'rw', required => 1, isa => 'ArrayRef[Erlang::Parser::Node]'); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub print { |
13
|
12
|
|
|
12
|
1
|
27
|
my ($self, $fh, $depth) = @_; |
14
|
12
|
|
50
|
|
|
35
|
$depth ||= 0; |
15
|
|
|
|
|
|
|
|
16
|
12
|
|
|
|
|
31
|
print $fh "begin\n"; |
17
|
|
|
|
|
|
|
|
18
|
12
|
|
|
|
|
15
|
$depth++; |
19
|
12
|
|
|
|
|
32
|
print $fh "\t" x $depth; |
20
|
|
|
|
|
|
|
|
21
|
12
|
|
|
|
|
22
|
my $first = 1; |
22
|
12
|
|
|
|
|
16
|
foreach (@{$self->exprs}) { |
|
12
|
|
|
|
|
331
|
|
23
|
32
|
100
|
|
|
|
55
|
if ($first) { $first = 0 } else { print $fh ",\n", "\t" x $depth } |
|
12
|
|
|
|
|
16
|
|
|
20
|
|
|
|
|
54
|
|
24
|
32
|
|
|
|
|
85
|
$_->print($fh, $depth); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
12
|
|
|
|
|
17
|
$depth--; |
28
|
|
|
|
|
|
|
|
29
|
12
|
|
|
|
|
50
|
print $fh "\n", "\t" x $depth, 'end'; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 NAME |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Erlang::Parser::Node::Begin - a block of statements |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 DESCRIPTION |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
A block of statements; a glorified parenthesis. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head2 Accessors |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=over 4 |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=item C<exprs> |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
A list of L<Erlang::Parser::Node>s; the body for this block. The last |
49
|
|
|
|
|
|
|
expression is the value for the block. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=back |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head2 Methods |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=over 4 |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=item C<print> |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Pretty-prints the node to its filehandle argument. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=back |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 EXAMPLE |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
begin |
66
|
|
|
|
|
|
|
do_this(), |
67
|
|
|
|
|
|
|
xyz:do_that() |
68
|
|
|
|
|
|
|
end |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=cut |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
1; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
# vim: set sw=4 ts=4: |