blib/lib/Pugs/Compiler/Grammar.pm

filter: Statementstmt 62.5% 20 / 32 Branchbran 0.0% 0 / 2 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 85.7% 6 / 7 Podpod 100% 2 / 2 totaltotal 67.3% 31 / 46 CC 4 SCAR 15.5
CC
4
Cov
61%
compile
10.0
perl5
2.0
BEGIN
1.0
CRAP 4.7
« blib/lib/Pugs/Runtime/Tracer.pm ↑ Summary blib/lib/Pugs/Runtime/Common.pm »
1 15 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 15 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 #use Smart::Comments;
4  
5 package Pugs::Compiler::Grammar;
6  
7 15 our $VERSION = '0.28';
8  
9 15 ▶use Pugs::Grammar::Rule;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 15 ▶use Pugs::Emitter::Grammar::Perl5;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 15 ▶use Carp qw(carp croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 15 ▶sub compile {
Subroutine compile: called CC=4 SCAR=23.1
Pod documented
14 15 my ($class, $src, $opts) = @_;
15 15 ▶ $opts ||= {};
Condition100%2/2
$opts ||= {}
l!l
141
MC/DC100%1/1
$opts ||= {}
$opts
Truth table100%2/2
A
A= $opts
Aresult
11
00
16 15 my $match = Pugs::Grammar::Rule->spec($src);
17 0 ▶ if ($match->bool) {
Branch: 1 branch
BranchTrueFalseTotal
if ($match->bool) { } 0 0 0
18 ## $match
19 0 my $capture = $match->();
20 0 my $leading_block = $capture->{block};
21 ### leading block: $leading_block
22 0 my $ast = $capture->{grammar};
23 ## $ast
24 0 my $perl5;
25 0 for my $g (@$ast) {
26 ### Grammar found...
27 0 $g = $g->();
28 0 my ($name) = keys %$g;
29 ### Grammar: $name
30 0 $perl5 .= Pugs::Emitter::Grammar::Perl5::emit($g, $opts);
31 }
32 bless {
33 0 source => $src,
34 ast => $ast,
35 perl5 => $perl5,
36 }, $class;
37 } else {
38 0 carp "Failed to compile the grammar source";
39 }
40 }
41  
42 0 ▶sub perl5 {
Subroutine perl5: not called CC=1 SCAR=6.9
Pod documented
43 0 $_[0]->{perl5};
44 }
45  
46 15 1;
47 __END__
« blib/lib/Pugs/Runtime/Tracer.pm ↑ Summary blib/lib/Pugs/Runtime/Common.pm »