| 1 | package Language::Expr::Interpreter::default; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 3 | our $DATE = '2016-07-03'; # DATE | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 3 | our $VERSION = '0.29'; # VERSION | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 3 | ▶ | use 5.010; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 3 | ▶ | use Role::Tiny::With; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 3 | ▶ | use Mo qw(build default); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 3 | extends 'Language::Expr::Interpreter::Base'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 3 | with 'Language::Expr::InterpreterRole'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 3 | ▶ | use List::Util 'reduce'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 3 | ▶ | use boolean; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 0 | ▶ | has vars => (is => 'rw', default => sub { {} }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 0 | ▶ | has funcs => (is => 'rw', default => sub { {} }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 0 | ▶ | has level => (is => 'rw', default => sub { 0 }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 10 | ▶ | sub rule_pair_simple { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rule_pair_simple: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 10 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 10 | my $match = $args{match}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 10 | [$match->{key}, $match->{value}]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 6 | ▶ | sub rule_pair_string { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rule_pair_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 6 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 6 | my $match = $args{match}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 6 | [$match->{key}, $match->{value}]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 8 | ▶ | sub rule_or_xor { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rule_or_xor: called CC=10 SCAR=25.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 8 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 8 | my $match = $args{match}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 8 | my $res = shift @{$match->{operand}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 8 | for my $term (@{$match->{operand}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 8 | ▶ | my $op = shift @{$match->{op}//=[]}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$match->{"op"} //= []
MC/DC0%0/1
$match->{"op"} //= []
$match->{"op"}
Truth table50%1/2
A
A= $match->{"op"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 8 | ▶ | last unless $op; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 8 | ▶ | if ($op eq '||') { $res ||= $term } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition66%2/3
$res ||= $term
MC/DC0%0/2
$res ||= $term
$res
$term
Truth table66%2/3
A ||= B
A= $resB= $term
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 4 | ▶ | elsif ($op eq '//') { $res //= $term } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$res //= $term
MC/DC100%2/2
$res //= $term
$res
$term
Truth table100%3/3
A //= B
A= $resB= $term
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | ▶ | elsif ($op eq '^^') { $res = ($res xor $term) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/4
$res ^^ $term
MC/DC0%0/2
$res ^^ $term
$res
$term
Truth table0%0/4
A ^^ B
A= $resB= $term
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 8 | $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 10 | ▶ | sub rule_ternary { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rule_ternary: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 10 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 10 | my $match = $args{match}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 10 | my $opd = $match->{operand}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 10 | ▶ | $opd->[0] ? $opd->[1] : $opd->[2]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 4 | ▶ | sub rule_and { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rule_and: called CC=7 SCAR=19.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 4 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 4 | my $match = $args{match}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 4 | my $res = shift @{$match->{operand}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 4 | for my $term (@{$match->{operand}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 4 | ▶ | my $op = shift @{$match->{op}//=[]}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$match->{"op"} //= []
MC/DC0%0/1
$match->{"op"} //= []
$match->{"op"}
Truth table50%1/2
A
A= $match->{"op"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 4 | ▶ | last unless $op; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 4 | ▶ | if ($op eq '&&') { $res = $res && $term || false } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$res && $term || &false()
$res and $term
MC/DC0%0/3
$res && $term || &false()
$res
$term
&false()
Truth table60%3/5
A and B || C
A= $resB= $termC= &false()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 4 | $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 2 | ▶ | sub rule_bit_or_xor { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rule_bit_or_xor: called CC=6 SCAR=18.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 2 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 2 | my $match = $args{match}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 2 | my $res = shift @{$match->{operand}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 2 | for my $term (@{$match->{operand}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 2 | ▶ | my $op = shift @{$match->{op}//=[]}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$match->{"op"} //= []
MC/DC0%0/1
$match->{"op"} //= []
$match->{"op"}
Truth table50%1/2
A
A= $match->{"op"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 2 | ▶ | last unless $op; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 2 | ▶ | if ($op eq '|') { $res = $res+0 | $term } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 1 | elsif ($op eq '^') { $res = $res+0 ^ $term } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 2 | $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 1 | ▶ | sub rule_bit_and { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rule_bit_and: called CC=5 SCAR=16.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 1 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 1 | my $match = $args{match}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 1 | my $res = shift @{$match->{operand}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 1 | for my $term (@{$match->{operand}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 1 | ▶ | my $op = shift @{$match->{op}//=[]}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$match->{"op"} //= []
MC/DC0%0/1
$match->{"op"} //= []
$match->{"op"}
Truth table50%1/2
A
A= $match->{"op"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 1 | ▶ | last unless $op; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 1 | ▶ | if ($op eq '&') { $res = $res+0 & $term } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 1 | $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 5 | ▶ | sub rule_comparison3 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rule_comparison3: called CC=7 SCAR=19.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 5 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 5 | my $match = $args{match}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 5 | my $res = shift @{$match->{operand}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 5 | ▶ | return $res unless @{$match->{operand}}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 5 | my $last_term = $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 5 | for my $term (@{$match->{operand}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 5 | ▶ | my $op = shift @{$match->{op}//=[]}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$match->{"op"} //= []
MC/DC0%0/1
$match->{"op"} //= []
$match->{"op"}
Truth table50%1/2
A
A= $match->{"op"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 5 | ▶ | last unless $op; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 5 | ▶ | if ($op eq '<=>') { $res = ($last_term <=> $term) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 1 | elsif ($op eq 'cmp') { $res = ($last_term cmp $term) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 5 | $last_term = $term; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 5 | $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 43 | ▶ | sub rule_comparison { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rule_comparison: called CC=42 SCAR=48.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 43 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 43 | my $match = $args{match}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 43 | my $res = shift @{$match->{operand}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 43 | ▶ | return $res unless @{$match->{operand}}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 43 | my $last_term = $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 43 | for my $term (@{$match->{operand}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 46 | ▶ | my $op = shift @{$match->{op}//=[]}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$match->{"op"} //= []
MC/DC0%0/1
$match->{"op"} //= []
$match->{"op"}
Truth table50%1/2
A
A= $match->{"op"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 46 | ▶ | last unless $op; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 46 | ▶ | if ($op eq '==' ) { return false unless $res = ($last_term == $term ? true:false) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 14 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 4 | ▶ | elsif ($op eq '!=' ) { return false unless $res = ($last_term != $term ? true:false) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 2 | ▶ | elsif ($op eq 'eq' ) { return false unless $res = ($last_term eq $term ? true:false) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | ▶ | elsif ($op eq 'ne' ) { return false unless $res = ($last_term ne $term ? true:false) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 3 | ▶ | elsif ($op eq '<' ) { return false unless $res = ($last_term < $term ? true:false) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 3 | ▶ | elsif ($op eq '<=' ) { return false unless $res = ($last_term <= $term ? true:false) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 13 | ▶ | elsif ($op eq '>' ) { return false unless $res = ($last_term > $term ? true:false) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 5 | ▶ | elsif ($op eq '>=' ) { return false unless $res = ($last_term >= $term ? true:false) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | ▶ | elsif ($op eq 'lt' ) { return false unless $res = ($last_term lt $term ? true:false) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | ▶ | elsif ($op eq 'gt' ) { return false unless $res = ($last_term gt $term ? true:false) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | ▶ | elsif ($op eq 'le' ) { return false unless $res = ($last_term le $term ? true:false) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | ▶ | elsif ($op eq 'ge' ) { return false unless $res = ($last_term ge $term ? true:false) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 23 | $last_term = $term; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 20 | ▶ | $res ? true : false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 4 | ▶ | sub rule_bit_shift { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rule_bit_shift: called CC=6 SCAR=18.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 4 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 4 | my $match = $args{match}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 4 | my $res = shift @{$match->{operand}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 4 | for my $term (@{$match->{operand}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 4 | ▶ | my $op = shift @{$match->{op}//=[]}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$match->{"op"} //= []
MC/DC0%0/1
$match->{"op"} //= []
$match->{"op"}
Truth table50%1/2
A
A= $match->{"op"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 4 | ▶ | last unless $op; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 4 | ▶ | if ($op eq '>>') { $res >>= $term } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 2 | elsif ($op eq '<<') { $res <<= $term } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 4 | $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 20 | ▶ | sub rule_add { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rule_add: called CC=7 SCAR=19.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 20 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 20 | my $match = $args{match}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 20 | my $res = shift @{$match->{operand}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 20 | for my $term (@{$match->{operand}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 37 | ▶ | my $op = shift @{$match->{op}//=[]}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$match->{"op"} //= []
MC/DC0%0/1
$match->{"op"} //= []
$match->{"op"}
Truth table50%1/2
A
A= $match->{"op"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 37 | ▶ | last unless $op; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 37 | ▶ | if ($op eq '+') { $res += $term } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 5 | elsif ($op eq '-') { $res -= $term } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 2 | elsif ($op eq '.') { $res .= $term } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 20 | $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 12 | ▶ | sub rule_mult { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rule_mult: called CC=8 SCAR=20.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 12 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 12 | my $match = $args{match}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 12 | my $res = shift @{$match->{operand}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 12 | for my $term (@{$match->{operand}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 20 | ▶ | my $op = shift @{$match->{op}//=[]}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$match->{"op"} //= []
MC/DC0%0/1
$match->{"op"} //= []
$match->{"op"}
Truth table50%1/2
A
A= $match->{"op"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 20 | ▶ | last unless $op; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 20 | ▶ | if ($op eq '*') { $res *= $term } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 6 | elsif ($op eq '/') { $res /= $term } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 3 | elsif ($op eq '%') { $res %= $term } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 4 | elsif ($op eq 'x') { $res x= $term } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 12 | $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 12 | ▶ | sub rule_unary { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rule_unary: called CC=7 SCAR=19.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 12 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 12 | my $match = $args{match}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 12 | my $res = $match->{operand}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 12 | ▶ | if ($match->{op}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 12 | for my $op (reverse @{$match->{op}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 17 | ▶ | if ($op eq '!') { $res = $res ? false : true } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 11 | elsif ($op eq '-') { $res = -$res } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 1 | elsif ($op eq '~') { $res = ~($res+0) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 12 | $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 3 | ▶ | sub rule_power { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rule_power: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 3 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 3 | my $match = $args{match}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 3 | ▶ | reduce { $b ** $a } reverse @{$match->{operand}}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 2 | ▶ | sub rule_subscripting_var { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rule_subscripting_var: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 2 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 2 | $self->rule_subscripting_expr(%args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 9 | ▶ | sub rule_subscripting_expr { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rule_subscripting_expr: called CC=4 SCAR=14.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 9 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 9 | my $match = $args{match}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 9 | my $res = $match->{operand}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 9 | for my $i (@{$match->{subscript}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 10 | ▶ | if (ref($res) eq 'ARRAY' ) { $res = $res->[$i] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 5 | elsif (ref($res) eq 'HASH') { $res = $res->{$i} } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | else { die "Invalid subscript on nonhash/nonarray" } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 9 | $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 7 | ▶ | sub rule_array { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rule_array: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 7 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 7 | my $match = $args{match}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 7 | $match->{element}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 9 | ▶ | sub rule_hash { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rule_hash: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 9 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 9 | my $match = $args{match}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 9 | return { map { $_->[0] => $_->[1] } @{ $match->{pair} } } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 5 | ▶ | sub rule_undef { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rule_undef: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 5 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 5 | my $match = $args{match}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 5 | undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 10 | ▶ | sub rule_squotestr { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rule_squotestr: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 10 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | join("", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 10 | map { $_->{value} } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 10 | @{ $self->parse_squotestr($args{match}{part}) }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 48 | ▶ | sub rule_dquotestr { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rule_dquotestr: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 48 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | join("", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | map { $_->{type} eq 'VAR' ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | $self->rule_var(match=>{var=>$_->{value}}) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | $_->{value} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 48 | ▶ | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 48 | @{ $self->parse_dquotestr($args{match}{part}) }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 2 | ▶ | sub rule_bool { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rule_bool: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 2 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 2 | my $match = $args{match}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 2 | ▶ | if ($match->{bool} eq 'true') { true } else { false } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 263 | ▶ | sub rule_num { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rule_num: called CC=3 SCAR=12.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 263 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 263 | my $match = $args{match}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | ▶ | if ($match->{num} eq 'inf') { "Inf"+0 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | elsif ($match->{num} eq 'nan') { "NaN"+0 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 263 | else { $match->{num}+0 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 9 | ▶ | sub rule_var { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rule_var: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 9 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 9 | my $match = $args{match}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 9 | $self->vars->{ $match->{var} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 4 | ▶ | sub rule_func { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rule_func: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 4 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 4 | my $match = $args{match}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 4 | my $f = $match->{func_name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 4 | my $args = $match->{args}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 4 | my $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 4 | ▶ | if ($self->funcs->{$f}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 4 | return $self->funcs->{$f}->(@$args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | die "Unknown function $f"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | ▶ | sub _map_grep_usort { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_map_grep_usort: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | my ($self, $which, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | my $match = $args{match}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | my $ary = $match->{array}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | my $expr = $match->{expr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | ▶ | die "Second argument to map/grep/usort must be an array" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | unless ref($ary) eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | local $self->{level} = $self->{level}+1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | #print "DEBUG: _map_grep_usort: level=$self->{level}, expr=`$expr`, array=[".join(",", @$ary),"]\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | my $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | ▶ | if ($which eq 'map') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | $res = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | local $self->{vars}{_}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | for (@$ary) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | $self->{vars}{_} = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | push @$res, Language::Expr::Parser::parse_expr($expr, $self, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | $self->level); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | push @$res, $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | } elsif ($which eq 'grep') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | local $self->{vars}{_}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | $res = [ grep { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | $self->{vars}{_} = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | $self->Language::Expr::Parser::parse_expr($expr, $self, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | $self->level) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | } @$ary]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | } elsif ($which eq 'usort') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | local $self->{vars}{a}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | local $self->{vars}{b}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | $res = [ sort { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | $self->{vars}{a} = $a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | $self->{vars}{b} = $b; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | Language::Expr::Parser::parse_expr($expr, $self, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | $self->level) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | } @$ary]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | ▶ | sub rule_func_map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rule_func_map: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | $self->_map_grep_usort('map', %args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | ▶ | sub rule_func_grep { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rule_func_grep: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | $self->_map_grep_usort('grep', %args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | ▶ | sub rule_func_usort { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rule_func_usort: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | $self->_map_grep_usort('usort', %args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 31 | ▶ | sub rule_parenthesis {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rule_parenthesis: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 166 | ▶ | sub expr_preprocess {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
expr_preprocess: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 139 | ▶ | sub expr_postprocess { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
expr_postprocess: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 139 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 139 | my $result = $args{result}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 139 | $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | # ABSTRACT: A default interpreter for Language::Expr | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||