line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# [[[ HEADER ]]] |
2
|
|
|
|
|
|
|
package RPerl::Operation::Statement::Loop::ForEach; |
3
|
4
|
|
|
4
|
|
25
|
use strict; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
104
|
|
4
|
4
|
|
|
4
|
|
20
|
use warnings; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
84
|
|
5
|
4
|
|
|
4
|
|
19
|
use RPerl::AfterSubclass; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
584
|
|
6
|
|
|
|
|
|
|
our $VERSION = 0.001_000; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# [[[ OO INHERITANCE ]]] |
9
|
4
|
|
|
4
|
|
25
|
use parent qw(RPerl::Operation::Statement::Loop); |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
22
|
|
10
|
4
|
|
|
4
|
|
227
|
use RPerl::Operation::Statement::Loop; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
1511
|
|
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
|
37
|
|
|
37
|
|
96
|
{ my string_hashref::method $RETURN_TYPE }; |
|
37
|
|
|
|
|
118
|
|
23
|
37
|
|
|
|
|
148
|
( my object $self, my string_hashref $modes) = @ARG; |
24
|
37
|
|
|
|
|
172
|
my string_hashref $rperl_source_group = { PMC => q{} }; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# RPerl::diag( 'in Loop::ForEach->ast_to_rperl__generate(), received $self = ' . "\n" . RPerl::Parser::rperl_ast__dump($self) . "\n" ); |
27
|
|
|
|
|
|
|
|
28
|
37
|
|
|
|
|
122
|
my string $self_class = ref $self; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# unwrap LoopForEach_183 from Loop_179 |
31
|
37
|
50
|
|
|
|
137
|
if ( $self_class eq 'Loop_179' ) { # Loop -> LoopForEach |
32
|
37
|
|
|
|
|
135
|
$self = $self->{children}->[0]; |
33
|
37
|
|
|
|
|
129
|
$self_class = ref $self; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# LoopForEach -> 'foreach' MY Type VARIABLE_SYMBOL LPAREN ListElements ')' CodeBlock |
37
|
37
|
50
|
|
|
|
183
|
if ( $self_class eq 'LoopForEach_183' ) { |
38
|
37
|
|
|
|
|
128
|
my string $foreach = $self->{children}->[0]; |
39
|
37
|
|
|
|
|
139
|
my string $my = $self->{children}->[1]; |
40
|
37
|
|
|
|
|
134
|
my string $type = $self->{children}->[2]->{children}->[0]; |
41
|
37
|
|
|
|
|
114
|
my string $variable_symbol = $self->{children}->[3]; |
42
|
37
|
|
|
|
|
147
|
my string $left_paren = $self->{children}->[4]; |
43
|
37
|
|
|
|
|
154
|
my object $list_elements = $self->{children}->[5]; |
44
|
37
|
|
|
|
|
130
|
my string $right_paren = $self->{children}->[6]; |
45
|
37
|
|
|
|
|
123
|
my object $codeblock = $self->{children}->[7]; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# START HERE: add error checking for PERLOPS_PERLTYPES, then utilize for CPPOPS_CPPTYPES |
48
|
|
|
|
|
|
|
# START HERE: add error checking for PERLOPS_PERLTYPES, then utilize for CPPOPS_CPPTYPES |
49
|
|
|
|
|
|
|
# START HERE: add error checking for PERLOPS_PERLTYPES, then utilize for CPPOPS_CPPTYPES |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# RPerl::diag( 'in Loop::ForEach->ast_to_rperl__generate(), have $list_elements = ' . "\n" . RPerl::Parser::rperl_ast__dump($list_elements) . "\n" ); |
52
|
|
|
|
|
|
|
# die 'TMP DEBUG'; |
53
|
|
|
|
|
|
|
# if ((scalar @{$list_elements->{children}->[1]->{children}}) > 0) { # non-empty _STAR_LIST, meaning 2 or more total elements in ListElements |
54
|
|
|
|
|
|
|
# } |
55
|
|
|
|
|
|
|
|
56
|
37
|
|
|
|
|
236
|
$rperl_source_group->{PMC} .= $foreach . q{ } . $my . q{ } . $type . q{ } . $variable_symbol . q{ } . $left_paren . q{ }; |
57
|
37
|
|
|
|
|
874
|
my object $rperl_source_subgroup = $list_elements->ast_to_rperl__generate($modes); |
58
|
37
|
|
|
|
|
839
|
RPerl::Generator::source_group_append( $rperl_source_group, $rperl_source_subgroup ); |
59
|
37
|
|
|
|
|
174
|
$rperl_source_group->{PMC} .= q{ } . $right_paren . q{ }; |
60
|
37
|
|
|
|
|
1050
|
$rperl_source_subgroup = $codeblock->ast_to_rperl__generate($modes); |
61
|
37
|
|
|
|
|
897
|
RPerl::Generator::source_group_append( $rperl_source_group, $rperl_source_subgroup ); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
else { |
64
|
0
|
|
|
|
|
0
|
die RPerl::Parser::rperl_rule__replace( |
65
|
|
|
|
|
|
|
'ERROR ECOGEASRP00, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL: Grammar rule ' . $self_class . ' found where LoopForEach_183 expected, dying' ) |
66
|
|
|
|
|
|
|
. "\n"; |
67
|
|
|
|
|
|
|
} |
68
|
37
|
|
|
|
|
241
|
return $rperl_source_group; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub ast_to_cpp__generate__CPPOPS_PERLTYPES { |
72
|
0
|
|
|
0
|
|
|
{ my string_hashref::method $RETURN_TYPE }; |
|
0
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
( my object $self, my string_hashref $modes) = @ARG; |
74
|
0
|
|
|
|
|
|
my string_hashref $cpp_source_group = { CPP => q{// <<< RP::O::S::L::FE __DUMMY_SOURCE_CODE CPPOPS_PERLTYPES >>>} . "\n" }; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
#... |
77
|
0
|
|
|
|
|
|
return $cpp_source_group; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub ast_to_cpp__generate__CPPOPS_CPPTYPES { |
81
|
0
|
|
|
0
|
|
|
{ my string_hashref::method $RETURN_TYPE }; |
|
0
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
( my object $self, my string_hashref $modes) = @ARG; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
# START HERE: implement CPPOPS_CPPTYPES |
85
|
|
|
|
|
|
|
# START HERE: implement CPPOPS_CPPTYPES |
86
|
|
|
|
|
|
|
# START HERE: implement CPPOPS_CPPTYPES |
87
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
my string_hashref $cpp_source_group = { CPP => q{// <<< RP::O::S::L::FE __DUMMY_SOURCE_CODE CPPOPS_CPPTYPES >>>} . "\n" }; |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
#... |
91
|
0
|
|
|
|
|
|
return $cpp_source_group; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
1; # end of class |