line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# [[[ HEADER ]]] |
2
|
|
|
|
|
|
|
package RPerl::Operation::Expression::Operator::Logical::And; |
3
|
4
|
|
|
4
|
|
27
|
use strict; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
97
|
|
4
|
4
|
|
|
4
|
|
19
|
use warnings; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
126
|
|
5
|
4
|
|
|
4
|
|
20
|
use RPerl::AfterSubclass; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
500
|
|
6
|
|
|
|
|
|
|
our $VERSION = 0.002_000; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# [[[ OO INHERITANCE ]]] |
9
|
4
|
|
|
4
|
|
24
|
use parent qw(RPerl::Operation::Expression::Operator::Logical); |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
20
|
|
10
|
4
|
|
|
4
|
|
138
|
use RPerl::Operation::Expression::Operator::Logical; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
1290
|
|
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
|
12
|
|
|
12
|
|
19
|
{ my string_hashref::method $RETURN_TYPE }; |
|
12
|
|
|
|
|
22
|
|
23
|
12
|
|
|
|
|
29
|
( my object $self, my string_hashref $modes) = @ARG; |
24
|
12
|
|
|
|
|
30
|
my string_hashref $rperl_source_group = { PMC => q{} }; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# RPerl::diag( 'in Operator::Logical::And->ast_to_rperl__generate(), received $self = ' . "\n" . RPerl::Parser::rperl_ast__dump($self) . "\n" ); |
27
|
|
|
|
|
|
|
|
28
|
12
|
|
|
|
|
25
|
my string $self_class = ref $self; |
29
|
12
|
50
|
66
|
|
|
56
|
if (( $self_class eq 'Operator_116' ) # Operator -> SubExpression OP15_LOGICAL_AND SubExpression |
30
|
|
|
|
|
|
|
or ( $self_class eq 'Operator_122' ) # Operator -> SubExpression OP23_LOGICAL_AND SubExpression |
31
|
|
|
|
|
|
|
) |
32
|
|
|
|
|
|
|
{ |
33
|
|
|
|
|
|
|
my string_hashref $rperl_source_subgroup |
34
|
12
|
|
|
|
|
256
|
= $self->{children}->[0]->ast_to_rperl__generate($modes); |
35
|
12
|
|
|
|
|
235
|
RPerl::Generator::source_group_append( $rperl_source_group, $rperl_source_subgroup ); |
36
|
12
|
|
|
|
|
34
|
$rperl_source_group->{PMC} .= q{ } . $self->{children}->[1] . q{ }; |
37
|
|
|
|
|
|
|
$rperl_source_subgroup |
38
|
12
|
|
|
|
|
247
|
= $self->{children}->[2]->ast_to_rperl__generate($modes); |
39
|
12
|
|
|
|
|
243
|
RPerl::Generator::source_group_append( $rperl_source_group, $rperl_source_subgroup ); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
else { |
42
|
0
|
|
|
|
|
0
|
die RPerl::Parser::rperl_rule__replace( 'ERROR ECOGEASRP00, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL: Grammar rule ' |
43
|
|
|
|
|
|
|
. $self_class |
44
|
|
|
|
|
|
|
. ' found where Operator_116 or Operator_122 expected, dying' ) |
45
|
|
|
|
|
|
|
. "\n"; |
46
|
|
|
|
|
|
|
} |
47
|
12
|
|
|
|
|
59
|
return $rperl_source_group; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub ast_to_cpp__generate__CPPOPS_PERLTYPES { |
51
|
0
|
|
|
0
|
|
|
{ my string_hashref::method $RETURN_TYPE }; |
|
0
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
( my object $self, my string_hashref $modes) = @ARG; |
53
|
0
|
|
|
|
|
|
my string_hashref $cpp_source_group = { CPP => q{// <<< RP::O::E::O::L::A __DUMMY_SOURCE_CODE CPPOPS_PERLTYPES >>>} . "\n" }; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
#... |
56
|
0
|
|
|
|
|
|
return $cpp_source_group; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub ast_to_cpp__generate__CPPOPS_CPPTYPES { |
60
|
0
|
|
|
0
|
|
|
{ my string_hashref::method $RETURN_TYPE }; |
|
0
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
( my object $self, my string_hashref $modes) = @ARG; |
62
|
0
|
|
|
|
|
|
my string_hashref $cpp_source_group = { CPP => q{} }; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# RPerl::diag( 'in Operator::Logical::And->ast_to_cpp__generate__CPPOPS_CPPTYPES(), received $self = ' . "\n" . RPerl::Parser::rperl_ast__dump($self) . "\n" ); |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
# NEED FIX: in Perl, '&&' and 'and' are equivalent except 'and' has a lower precedence; in C++, '&&' and 'and' are exactly equivalent; |
67
|
|
|
|
|
|
|
# therefore I assume we need to add parenthesis around the operands to the left and right of Perl's 'and' when it is compiled to C++, |
68
|
|
|
|
|
|
|
# in order to replicate the precedence behavior? |
69
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
my string $self_class = ref $self; |
71
|
0
|
0
|
0
|
|
|
|
if (( $self_class eq 'Operator_116' ) # Operator -> SubExpression OP15_LOGICAL_AND SubExpression |
72
|
|
|
|
|
|
|
or ( $self_class eq 'Operator_122' ) # Operator -> SubExpression OP23_LOGICAL_AND SubExpression |
73
|
|
|
|
|
|
|
) |
74
|
|
|
|
|
|
|
{ |
75
|
0
|
|
|
|
|
|
my string_hashref $cpp_source_subgroup = $self->{children}->[0]->ast_to_cpp__generate__CPPOPS_CPPTYPES($modes); |
76
|
0
|
|
|
|
|
|
RPerl::Generator::source_group_append( $cpp_source_group, $cpp_source_subgroup ); |
77
|
0
|
|
|
|
|
|
$cpp_source_group->{CPP} .= q{ } . $self->{children}->[1] . q{ }; |
78
|
0
|
|
|
|
|
|
$cpp_source_subgroup = $self->{children}->[2]->ast_to_cpp__generate__CPPOPS_CPPTYPES($modes); |
79
|
0
|
|
|
|
|
|
RPerl::Generator::source_group_append( $cpp_source_group, $cpp_source_subgroup ); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
else { |
82
|
0
|
|
|
|
|
|
die RPerl::Parser::rperl_rule__replace( 'ERROR ECOGEASCP00, CODE GENERATOR, ABSTRACT SYNTAX TO C++: Grammar rule ' |
83
|
|
|
|
|
|
|
. $self_class |
84
|
|
|
|
|
|
|
. ' found where Operator_116 or Operator_122 expected, dying' ) |
85
|
|
|
|
|
|
|
. "\n"; |
86
|
|
|
|
|
|
|
} |
87
|
0
|
|
|
|
|
|
return $cpp_source_group; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
1; # end of class |