inc/Pegex/Receiver.pm | |||
---|---|---|---|
Criterion | Covered | Total | % |
statement | 3 | 10 | 30.0 |
branch | 0 | 4 | 0.0 |
condition | 0 | 3 | 0.0 |
subroutine | 1 | 2 | 50.0 |
pod | 1 | 1 | 100.0 |
total | 5 | 20 | 25.0 |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package Pegex::Receiver; | ||||||
2 | 1 | 1 | 1531 | use Pegex::Base; | |||
1 | 1 | ||||||
1 | 7 | ||||||
3 | |||||||
4 | has parser => (); # The parser object. | ||||||
5 | |||||||
6 | # Flatten a structure of nested arrays into a single array in place. | ||||||
7 | sub flatten { | ||||||
8 | 0 | 0 | 1 | my ($self, $array, $times) = @_; | |||
9 | 0 | 0 | $times = -1 | ||||
10 | unless defined $times; | ||||||
11 | 0 | 0 | while ($times-- and grep {ref($_) eq 'ARRAY'} @$array) { | ||||
0 | |||||||
12 | 0 | 0 | @$array = map { | ||||
13 | 0 | (ref($_) eq 'ARRAY') ? @$_ : $_ | |||||
14 | } @$array; | ||||||
15 | } | ||||||
16 | 0 | return $array; | |||||
17 | } | ||||||
18 | |||||||
19 | 1; |