File Coverage

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 0 1 0.0
total 4 20 20.0


line stmt bran cond sub pod time code
1             package Pegex::Receiver;
2 4     4   21 use Pegex::Base;
  4         8  
  4         27  
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 0   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;