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::ReceiveAfter; |
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
12
|
use Moose; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
13
|
|
8
|
|
|
|
|
|
|
with 'Erlang::Parser::Node'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has 'time' => (is => 'rw', required => 1, isa => 'Erlang::Parser::Node'); |
11
|
|
|
|
|
|
|
has 'stmts' => (is => 'rw', required => 0, isa => 'ArrayRef[Erlang::Parser::Node]'); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub print { |
14
|
6
|
|
|
6
|
1
|
13
|
my ($self, $fh, $depth) = @_; |
15
|
6
|
|
50
|
|
|
12
|
$depth ||= 0; |
16
|
|
|
|
|
|
|
|
17
|
6
|
|
|
|
|
14
|
print $fh 'after '; |
18
|
6
|
|
|
|
|
168
|
$self->time->print($fh, $depth); |
19
|
|
|
|
|
|
|
|
20
|
6
|
|
|
|
|
12
|
$depth++; |
21
|
6
|
|
|
|
|
13
|
print $fh " ->\n", "\t" x $depth; |
22
|
|
|
|
|
|
|
|
23
|
6
|
|
|
|
|
7
|
my $first = 1; |
24
|
6
|
|
|
|
|
6
|
foreach (@{$self->stmts}) { |
|
6
|
|
|
|
|
162
|
|
25
|
10
|
100
|
|
|
|
17
|
if ($first) { $first = 0 } else { print $fh ",\n", "\t" x $depth } |
|
6
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
12
|
|
26
|
10
|
|
|
|
|
23
|
$_->print($fh, $depth); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
6
|
|
|
|
|
15
|
$depth--; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 NAME |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Erlang::Parser::Node::ReceiveAfter - the after clause for a receive statement |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 DESCRIPTION |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Specifies the length of time after which the clause should activate, and the |
41
|
|
|
|
|
|
|
statement block to execute in that case. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head2 Accessors |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=over 4 |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=item C<time> |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
A L<Erlang::Parser::Node> that yields the number of milliseconds, or the atom |
50
|
|
|
|
|
|
|
infinity. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=item C<stmts> |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
A list of L<Erlang::Parser::Node>s to run if the timeout is activated. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=back |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head2 Methods |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=over 4 |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=item C<print> |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Pretty-prints the node to its filehandle argument. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=back |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 EXAMPLE |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
after X -> |
71
|
|
|
|
|
|
|
Y |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=cut |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
# vim: set sw=4 ts=4: |