File Coverage

blib/lib/RPerl/Operation/Expression/Operator/Logical/Negation.pm
Criterion Covered Total %
statement 25 50 50.0
branch 1 8 12.5
condition 2 6 33.3
subroutine 6 8 75.0
pod n/a
total 34 72 47.2


line stmt bran cond sub pod time code
1             # [[[ HEADER ]]]
2             package RPerl::Operation::Expression::Operator::Logical::Negation;
3 4     4   21 use strict;
  4         8  
  4         95  
4 4     4   20 use warnings;
  4         8  
  4         134  
5 4     4   22 use RPerl::AfterSubclass;
  4         11  
  4         515  
6             our $VERSION = 0.003_000;
7              
8             # [[[ OO INHERITANCE ]]]
9 4     4   26 use parent qw(RPerl::Operation::Expression::Operator::Logical);
  4         11  
  4         20  
10 4     4   215 use RPerl::Operation::Expression::Operator::Logical;
  4         12  
  4         1504  
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             sub ast_to_rperl__generate {
22 21     21   48 { my string_hashref::method $RETURN_TYPE };
  21         47  
23 21         53 ( my object $self, my string_hashref $modes) = @ARG;
24 21         64 my string_hashref $rperl_source_group = { PMC => q{} };
25              
26             # RPerl::diag( 'in Operator::Logical::Negation->ast_to_rperl__generate(), received $self = ' . "\n" . RPerl::Parser::rperl_ast__dump($self) . "\n" );
27              
28 21         65 my string $self_class = ref $self;
29 21 50 66     137 if (( $self_class eq 'Operator_102' ) # Operator -> OP05_LOGICAL_NEG SubExpression
    0          
30             or ( $self_class eq 'Operator_121' ) # Operator -> OP22_LOGICAL_NEG SubExpression
31             )
32             {
33 21         110 $rperl_source_group->{PMC} .= $self->{children}->[0] . q{ };
34 21         468 my string_hashref $rperl_source_subgroup = $self->{children}->[1]->ast_to_rperl__generate($modes);
35 21         428 RPerl::Generator::source_group_append( $rperl_source_group, $rperl_source_subgroup );
36             }
37             elsif ( $self_class eq 'Operator_120' ) { # Operator -> OP22_LOGICAL_NEG_LPAREN SubExpression ')'
38 0         0 $rperl_source_group->{PMC} .= $self->{children}->[0] . q{ };
39 0         0 my string_hashref $rperl_source_subgroup = $self->{children}->[1]->ast_to_rperl__generate($modes);
40 0         0 RPerl::Generator::source_group_append( $rperl_source_group, $rperl_source_subgroup );
41 0         0 $rperl_source_group->{PMC} .= q{ } . $self->{children}->[2];
42             }
43             else {
44 0         0 die RPerl::Parser::rperl_rule__replace(
45             'ERROR ECOGEASRP00, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL: Grammar rule '
46             . $self_class
47             . ' found where Operator_102, Operator_121, or Operator_120 expected, dying' )
48             . "\n";
49             }
50 21         116 return $rperl_source_group;
51             }
52              
53             sub ast_to_cpp__generate__CPPOPS_PERLTYPES {
54 0     0     { my string_hashref::method $RETURN_TYPE };
  0            
55 0           ( my object $self, my string_hashref $modes) = @ARG;
56 0           my string_hashref $cpp_source_group
57             = { CPP =>
58             q{// <<< RP::O::E::O::Lo::N __DUMMY_SOURCE_CODE CPPOPS_PERLTYPES >>>}
59             . "\n" };
60              
61             #...
62 0           return $cpp_source_group;
63             }
64              
65             # DEV NOTE: PERLOPS_PERLTYPES & CPPOPS_CPPTYPES code generation are exactly equivalent
66             sub ast_to_cpp__generate__CPPOPS_CPPTYPES {
67 0     0     { my string_hashref::method $RETURN_TYPE };
  0            
68 0           ( my object $self, my string_hashref $modes) = @ARG;
69 0           my string_hashref $cpp_source_group = { CPP => q{} };
70              
71             # RPerl::diag( 'in Operator::Logical::Negation->ast_to_cpp__generate__CPPOPS_CPPTYPES(), received $self = ' . "\n" . RPerl::Parser::rperl_ast__dump($self) . "\n" );
72              
73 0           my string $self_class = ref $self;
74 0 0 0       if (( $self_class eq 'Operator_102' ) # Operator -> OP05_LOGICAL_NEG SubExpression
    0          
75             or ( $self_class eq 'Operator_121' ) # Operator -> OP22_LOGICAL_NEG SubExpression
76             )
77             {
78 0           $cpp_source_group->{CPP} .= $self->{children}->[0] . q{ };
79 0           my string_hashref $cpp_source_subgroup = $self->{children}->[1]->ast_to_cpp__generate__CPPOPS_CPPTYPES($modes);
80 0           RPerl::Generator::source_group_append( $cpp_source_group, $cpp_source_subgroup );
81             }
82             elsif ( $self_class eq 'Operator_120' ) { # Operator -> OP22_LOGICAL_NEG_LPAREN SubExpression ')'
83 0           $cpp_source_group->{CPP} .= $self->{children}->[0] . q{ };
84 0           my string_hashref $cpp_source_subgroup = $self->{children}->[1]->ast_to_cpp__generate__CPPOPS_CPPTYPES($modes);
85 0           RPerl::Generator::source_group_append( $cpp_source_group, $cpp_source_subgroup );
86 0           $cpp_source_group->{CPP} .= q{ } . $self->{children}->[2];
87             }
88             else {
89 0           die RPerl::Parser::rperl_rule__replace(
90             'ERROR ECOGEASCP00, CODE GENERATOR, ABSTRACT SYNTAX TO C++: Grammar rule '
91             . $self_class
92             . ' found where Operator_102, Operator_121, or Operator_120 expected, dying' )
93             . "\n";
94             }
95 0           return $cpp_source_group;
96             }
97              
98             1; # end of class