Psh/Support/Debug.pm untested

filter: Statementstmt 0.0% 0 / 13 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 1 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 21 CC 4 SCAR 30.0
CC
4
Cov
0%
explain_tokens
20.0
CRAP 20.0
1 package Psh::Support::Debug;
2  
3 my %token_types= ( 0=> 'END', 1=>'WORD:',2=>'PIPE',
4 3=>'REDIRECT',4=>'BACKGROUND',
5 5=>'OR', 6=> 'AND');
6  
7 sub explain_tokens {
8 my $tokens= shift;
9 my @result=();
10 my @tokens= @$tokens;
11 foreach my $tok (@tokens) {
12 if (ref $tok eq 'ARRAY') {
13 my @tok=@$tok;
14 my $type= shift @tok;
15 if ($type==0) {
16 push @result,"\n";
17 } else {
18 $type= $token_types{$type} if $token_types{$type};
19 push @result, join('',$type,@tok,' ');
20 }
21 }
22 }
23 return join('',@result);
24 }
25  
26 1;