line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# [[[ HEADER ]]] |
2
|
|
|
|
|
|
|
package RPerl::Operation::Statement::Loop; |
3
|
4
|
|
|
4
|
|
21
|
use strict; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
100
|
|
4
|
4
|
|
|
4
|
|
18
|
use warnings; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
85
|
|
5
|
4
|
|
|
4
|
|
17
|
use RPerl::AfterSubclass; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
575
|
|
6
|
|
|
|
|
|
|
our $VERSION = 0.002_010; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# [[[ OO INHERITANCE ]]] |
9
|
4
|
|
|
4
|
|
26
|
use parent qw(RPerl::Operation::Statement); |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
20
|
|
10
|
4
|
|
|
4
|
|
208
|
use RPerl::Operation::Statement; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
1401
|
|
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
|
0
|
|
|
0
|
|
|
{ my string_hashref::method $RETURN_TYPE }; |
|
0
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
( my object $self, my string_hashref $modes) = @ARG; |
24
|
0
|
|
|
|
|
|
my string_hashref $rperl_source_group = { PMC => q{} }; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# RPerl::diag( 'in Loop->ast_to_rperl__generate(), received $self = ' . "\n" . RPerl::Parser::rperl_ast__dump($self) . "\n" ); |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
my string $self_class = ref $self; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# unwrap Loop_178, Loop_179, and Loop_180 from Statement_167 |
31
|
0
|
0
|
|
|
|
|
if ( $self_class eq 'Statement_167' ) { |
32
|
0
|
|
|
|
|
|
$self = $self->{children}->[0]; |
33
|
0
|
|
|
|
|
|
$self_class = ref $self; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
0
|
0
|
0
|
|
|
|
if ( ( $self_class eq 'Loop_178' ) # Loop -> LoopFor |
|
|
|
0
|
|
|
|
|
37
|
|
|
|
|
|
|
or ( $self_class eq 'Loop_179' ) # Loop -> LoopForEach |
38
|
|
|
|
|
|
|
or ( $self_class eq 'Loop_180' ) ) # Loop -> LoopWhile |
39
|
|
|
|
|
|
|
{ |
40
|
0
|
|
|
|
|
|
my object $rperl_source_subgroup = $self->ast_to_rperl__generate($modes); |
41
|
0
|
|
|
|
|
|
RPerl::Generator::source_group_append( $rperl_source_group, |
42
|
|
|
|
|
|
|
$rperl_source_subgroup ); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
else { |
45
|
0
|
|
|
|
|
|
die RPerl::Parser::rperl_rule__replace( |
46
|
|
|
|
|
|
|
'ERROR ECOGEASRP00, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL: Grammar rule ' |
47
|
|
|
|
|
|
|
. $self_class |
48
|
|
|
|
|
|
|
. ' found where Loop_178, Loop_179, or Loop_180 expected, dying' |
49
|
|
|
|
|
|
|
) . "\n"; |
50
|
|
|
|
|
|
|
} |
51
|
0
|
|
|
|
|
|
return $rperl_source_group; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub ast_to_cpp__generate__CPPOPS_PERLTYPES { |
55
|
0
|
|
|
0
|
|
|
{ my string_hashref::method $RETURN_TYPE }; |
|
0
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
( my object $self, my string $loop_label, my string_hashref $modes) = @ARG; |
57
|
0
|
|
|
|
|
|
my string_hashref $cpp_source_group |
58
|
|
|
|
|
|
|
= { |
59
|
|
|
|
|
|
|
CPP => q{// <<< RP::O::S::L __DUMMY_SOURCE_CODE CPPOPS_PERLTYPES >>>} |
60
|
|
|
|
|
|
|
. "\n" |
61
|
|
|
|
|
|
|
}; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
#... |
64
|
0
|
|
|
|
|
|
return $cpp_source_group; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub ast_to_cpp__generate__CPPOPS_CPPTYPES { |
68
|
0
|
|
|
0
|
|
|
{ my string_hashref::method $RETURN_TYPE }; |
|
0
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
( my object $self, my string $loop_label, my string_hashref $modes) = @ARG; |
70
|
0
|
|
|
|
|
|
my string_hashref $cpp_source_group = { CPP => q{} }; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
# RPerl::diag( 'in Loop->ast_to_cpp__generate__CPPOPS_CPPTYPES(), received $self = ' . "\n" . RPerl::Parser::rperl_ast__dump($self) . "\n" ); |
73
|
|
|
|
|
|
|
# RPerl::diag( 'in Loop->ast_to_cpp__generate__CPPOPS_CPPTYPES(), received $loop_label = ' . $loop_label . "\n" ); |
74
|
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
my string $self_class = ref $self; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
# unwrap Loop_178, Loop_179, and Loop_180 from Statement_167 |
78
|
0
|
0
|
|
|
|
|
if ( $self_class eq 'Statement_167' ) { |
79
|
0
|
|
|
|
|
|
$self = $self->{children}->[0]; |
80
|
0
|
|
|
|
|
|
$self_class = ref $self; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
0
|
0
|
0
|
|
|
|
if ( ( $self_class eq 'Loop_178' ) # Loop -> LoopFor |
|
|
|
0
|
|
|
|
|
84
|
|
|
|
|
|
|
or ( $self_class eq 'Loop_179' ) # Loop -> LoopForEach |
85
|
|
|
|
|
|
|
or ( $self_class eq 'Loop_180' ) ) # Loop -> LoopWhile |
86
|
|
|
|
|
|
|
{ |
87
|
0
|
|
|
|
|
|
my object $cpp_source_subgroup = $self->ast_to_cpp__generate__CPPOPS_CPPTYPES($loop_label, $modes); |
88
|
0
|
|
|
|
|
|
RPerl::Generator::source_group_append( $cpp_source_group, |
89
|
|
|
|
|
|
|
$cpp_source_subgroup ); |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
else { |
92
|
0
|
|
|
|
|
|
die RPerl::Parser::rperl_rule__replace( |
93
|
|
|
|
|
|
|
'ERROR ECOGEASCP00, CODE GENERATOR, ABSTRACT SYNTAX TO C++: Grammar rule ' |
94
|
|
|
|
|
|
|
. $self_class |
95
|
|
|
|
|
|
|
. ' found where Loop_178, Loop_179, or Loop_180 expected, dying' |
96
|
|
|
|
|
|
|
) . "\n"; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
# RPerl::diag( 'in Loop->ast_to_cpp__generate__CPPOPS_CPPTYPES(), bottom of subroutine, have $modes->{_loop_iterators} = ' . "\n" . Dumper($modes->{_loop_iterators}) . "\n" ); |
99
|
0
|
|
|
|
|
|
return $cpp_source_group; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
1; # end of class |