line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pegex::Receiver; |
2
|
4
|
|
|
4
|
|
21
|
use Pegex::Base; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
23
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
has parser => (); # The parser object. |
5
|
|
|
|
|
|
|
|
6
|
0
|
|
|
0
|
0
|
|
sub rule { $_[0]->{parser}{rule} } |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# Flatten a structure of nested arrays into a single array in place. |
9
|
|
|
|
|
|
|
sub flatten { |
10
|
0
|
|
|
0
|
0
|
|
my ($self, $array, $times) = @_; |
11
|
0
|
0
|
|
|
|
|
$times = -1 |
12
|
|
|
|
|
|
|
unless defined $times; |
13
|
0
|
|
0
|
|
|
|
while ($times-- and grep {ref($_) eq 'ARRAY'} @$array) { |
|
0
|
|
|
|
|
|
|
14
|
0
|
0
|
|
|
|
|
@$array = map { |
15
|
0
|
|
|
|
|
|
(ref($_) eq 'ARRAY') ? @$_ : $_ |
16
|
|
|
|
|
|
|
} @$array; |
17
|
|
|
|
|
|
|
} |
18
|
0
|
|
|
|
|
|
return $array; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
1; |