File Coverage

inc/Pegex/Receiver.pm
Criterion Covered Total %
statement 3 11 27.2
branch 0 4 0.0
condition 0 3 0.0
subroutine 1 3 33.3
pod 0 2 0.0
total 4 23 17.3


line stmt bran cond sub pod time code
1             package Pegex::Receiver;
2 1     1   5 use Pegex::Base;
  1         1  
  1         24  
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;