Pegex.pm

filter: Statementstmt 100% 26 / 26 Branchbran 62.5% 5 / 8 Conditioncond 66.6% 2 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 84.4% 38 / 45 CC 6 SCAR 14.2
CC
6
Cov
89%
pegex
6.2
BEGIN
1.0
BEGIN
1.0
CRAP 4.1
« Pegex/Receiver.pm ↑ Summary Pegex/Module.pm »
1 13 ▶use strict; use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
2 package Pegex;
3 13 our $VERSION = '0.75';
4  
5 13 ▶use Pegex::Parser;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 13 ▶use base 'Exporter';
Subroutine BEGIN: called CC=1 SCAR=0.0
8 13 our @EXPORT = 'pegex';
9  
10 83 ▶sub pegex {
Subroutine pegex: called CC=6 SCAR=18.3
Pod undocumented
11 83 my ($grammar, $receiver) = @_;
12 83 ▶ die "Argument 'grammar' required in function 'pegex'"
Branch: 1 branch
BranchTrueFalseTotal
unless $grammar 0 83 83
13 unless $grammar;
14 83 ▶ if (not ref $grammar or $grammar->isa('Pegex::Input')) {
Branch: 1 branch
BranchTrueFalseTotal
if (not ref $grammar or $grammar->isa("Pegex::Input")) 83 0 83
Condition66%2/3
not ref $grammar or $grammar->isa("Pegex::Input")
l!l&&r!l&&!r
8210
MC/DC0%0/2
not ref $grammar or $grammar->isa("Pegex::Input")
not ref $grammar $grammar->isa("Pegex::Input")
Truth table66%2/3
not(A) or B
A= not ref $grammarB= $grammar->isa("Pegex::Input")
ABresult
1X1
011
000
15 83 require Pegex::Grammar;
16 83 $grammar = Pegex::Grammar->new(text => $grammar),
17 }
18 83 ▶ if (not defined $receiver) {
Branch: 2 branches
BranchTrueFalseTotal
if (not defined $receiver) { } 22 61 83
elsif (not ref $receiver) { } 61 0 61
19 22 require Pegex::Tree::Wrap;
20 22 $receiver = Pegex::Tree::Wrap->new;
21 }
22 elsif (not ref $receiver) {
23 61 eval "require $receiver; 1";
24 61 $receiver = $receiver->new;
25 }
26 83 return Pegex::Parser->new(
27 grammar => $grammar,
28 receiver => $receiver,
29 );
30 }
31  
32 13 1;
« Pegex/Receiver.pm ↑ Summary Pegex/Module.pm »