File Coverage

blib/lib/RPerl/CompileUnit/Critic.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 20 20 100.0


line stmt bran cond sub pod time code
1             # [[[ HEADER ]]]
2             package RPerl::CompileUnit::Critic;
3 4     4   25 use strict;
  4         10  
  4         104  
4 4     4   21 use warnings;
  4         8  
  4         95  
5 4     4   20 use RPerl::AfterSubclass;
  4         9  
  4         479  
6             our $VERSION = 0.001_000;
7              
8             # [[[ OO INHERITANCE ]]]
9 4     4   27 use parent qw(RPerl::GrammarRule);
  4         10  
  4         23  
10 4     4   260 use RPerl::GrammarRule;
  4         10  
  4         977  
11              
12             # [[[ CRITICS ]]]
13             ## no critic qw(ProhibitUselessNoCritic ProhibitMagicNumbers RequireCheckedSyscalls) # USER DEFAULT 1: allow numeric values & print operator
14             ## no critic qw(RequireInterpolationOfMetachars) # USER DEFAULT 2: allow single-quoted control characters & sigils
15              
16             # [[[ OO PROPERTIES ]]]
17             our hashref $properties = {};
18              
19             # [[[ SUBROUTINES & OO METHODS ]]]
20              
21             our string_hashref::method $ast_to_rperl__generate = sub {
22             ( my object $self, my string_hashref $modes) = @_;
23             my string_hashref $rperl_source_group = { PMC => q{} };
24              
25             # RPerl::diag( 'in Critic->ast_to_rperl__generate(), received $self = ' . "\n" . RPerl::Parser::rperl_ast__dump($self) . "\n" );
26            
27             my string $no_critic_qw = $self->{children}->[0];
28             my object $critic_words = $self->{children}->[1];
29             my string $right_parenthesis = $self->{children}->[2];
30            
31             $rperl_source_group->{PMC} .= $no_critic_qw;
32             foreach my object $critic_word (@{$critic_words->{children}}) {
33             $rperl_source_group->{PMC} .= $critic_word->{attr} . ' ';
34             }
35             chop $rperl_source_group->{PMC}; # remove extra trailing space
36             $rperl_source_group->{PMC} .= $right_parenthesis . "\n";
37              
38             return $rperl_source_group;
39             };
40              
41             our string_hashref::method $ast_to_cpp__generate__CPPOPS_PERLTYPES = sub {
42             ( my object $self, my string_hashref $modes) = @_;
43             my string_hashref $cpp_source_group
44             = { CPP => q{// <<< RP::CU::Cr __DUMMY_SOURCE_CODE CPPOPS_PERLTYPES >>>} . "\n" };
45              
46             #...
47             return $cpp_source_group;
48             };
49              
50             our string_hashref::method $ast_to_cpp__generate__CPPOPS_CPPTYPES = sub {
51             ( my object $self, my string_hashref $modes) = @_;
52             my string_hashref $cpp_source_group
53             = { CPP => q{// <<< RP::CU::Cr __DUMMY_SOURCE_CODE CPPOPS_CPPTYPES >>>}
54             . "\n" };
55              
56             #...
57             return $cpp_source_group;
58             };
59              
60             1; # end of class