blib/lib/Pugs/AST/Expression.pm untested

filter: Statementstmt 0.0% 0 / 27 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 36 CC 2 SCAR 12.0
CC
2
Cov
0%
operator
6.0
term
2.0
BEGIN
2.0
CRAP 3.3
1 package Pugs::AST::Expression;
2  
3 use strict;
4 use warnings;
5 use Data::Dumper;
6  
7 sub term {
8 { term => $_[1]{'term'}->() ,}
9 }
10  
11 sub operator {
12 my $self = shift;
13 my $match = shift;
14 # die "not a match" unless ref($match) eq 'Pugs::Runtime::Match';
15 my %h = %$match;
16 my %opt = @_;
17
18 #print "capture ", Dumper($match) if $opt{'fixity'} eq 'circumfix';
19 for ( keys %h ) {
20 $h{$_} = $h{$_}->();
21 }
22 my @a = @$match;
23 if ( @a ) {
24 $a = shift @a;
25 for ( @$a ) {
26 $_ = $self->operator( $_ );
27 ${$_}{fixity} = $opt{fixity};
28 }
29 $h{list} = $a;
30 delete $opt{fixity};
31 }
32 $h{$_} = $opt{$_} for keys %opt;
33 return \%h;
34 }
35  
36 1;