blib/lib/Inline/C/Parser/Pegex/AST.pm

filter: Statementstmt 100% 38 / 38 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 50.0% 2 / 4 totaltotal 96.2% 51 / 53 CC 4 SCAR 7.9
CC
4
Cov
100%
got_function_definition
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.2
« blib/lib/Inline/C/Parser/Pegex.pm ↑ Summary blib/lib/Inline/C/Parser.pm »
1 2 ▶use strict; use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
2 package Inline::C::Parser::Pegex::AST;
3 2 ▶use Pegex::Base;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 2 extends 'Pegex::Tree';
6  
7 2 has data => {};
8  
9 24 ▶sub initial {
Subroutine initial: called CC=1 SCAR=0.0
Pod documented
10 24 my ($self) = @_;
11 24 my $data = {
12 functions => [],
13 function => {},
14 done => {},
15 };
16 24 $self->data($data);
17 }
18  
19 24 ▶sub final {
Subroutine final: called CC=1 SCAR=0.0
Pod documented
20 24 my ($self, $got) = @_;
21 24 return $self->{data};
22 }
23  
24 11 ▶sub got_function_definition {
Subroutine got_function_definition: called CC=4 SCAR=13.9
Pod undocumented
25 11 my ($self, $ast) = @_;
26 11 my ($rtype, $name, $args) = @$ast;
27 11 my ($rname, $rstars) = @$rtype;
28 11 my $data = $self->data;
29 11 my $def = $data->{function}{$name} = {};
30 11 push @{$data->{functions}}, $name;
31 11 ▶ $def->{return_type} = $rname . ($rstars ? " $rstars" : '');
Branch: 1 branch
BranchTrueFalseTotal
$rstars ? : 2 9 11
32 11 $def->{arg_names} = [];
33 11 $def->{arg_types} = [];
34 11 for my $arg (@$args) {
35 14 my ($type, $stars, $name) = @$arg;
36 14 push @{$def->{arg_names}}, $name;
37 14 ▶ push @{$def->{arg_types}}, $type . ($stars ? " $stars" : '');
Branch: 1 branch
BranchTrueFalseTotal
$stars ? : 5 9 14
38 }
39 11 $data->{done}{$name} = 1;
40 11 return;
41 }
42  
43  
44 21 ▶sub got_arg {
Subroutine got_arg: called CC=1 SCAR=0.0
Pod undocumented
45 21 my ($self, $ast) = @_;
46 21 pop @$ast;
47 21 return $ast;
48 }
49  
50 2 1;
« blib/lib/Inline/C/Parser/Pegex.pm ↑ Summary blib/lib/Inline/C/Parser.pm »