File Coverage

blib/lib/RPerl/Operation/Expression/Operator/Arithmetic/Negative.pm
Criterion Covered Total %
statement 37 44 84.0
branch 2 4 50.0
condition n/a
subroutine 7 8 87.5
pod n/a
total 46 56 82.1


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