File Coverage

blib/lib/Pegex/Receiver.pm
Criterion Covered Total %
statement 10 11 90.9
branch 2 4 50.0
condition 2 3 66.6
subroutine 2 3 66.6
pod 1 2 50.0
total 17 23 73.9


line stmt bran cond sub pod time code
1             package Pegex::Receiver;
2 11     11   1075 use Pegex::Base;
  11         18  
  11         54  
3              
4             has parser => (); # The parser object.
5              
6 0     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 1     1 1 10 my ($self, $array, $times) = @_;
11 1 50       4 $times = -1
12             unless defined $times;
13 1   66     5 while ($times-- and grep {ref($_) eq 'ARRAY'} @$array) {
  9         45  
14             @$array = map {
15 2 50       5 (ref($_) eq 'ARRAY') ? @$_ : $_
  6         16  
16             } @$array;
17             }
18 1         3 return $array;
19             }
20              
21             1;