File Coverage

blib/lib/RPerl/Operation/Expression/Operator/IncrementDecrement.pm
Criterion Covered Total %
statement 38 48 79.1
branch 5 8 62.5
condition n/a
subroutine 7 8 87.5
pod n/a
total 50 64 78.1


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