line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# [[[ HEADER ]]] |
2
|
|
|
|
|
|
|
package RPerl::CodeBlock; |
3
|
7
|
|
|
7
|
|
1770
|
use strict; |
|
7
|
|
|
|
|
17
|
|
|
7
|
|
|
|
|
154
|
|
4
|
7
|
|
|
7
|
|
29
|
use warnings; |
|
7
|
|
|
|
|
15
|
|
|
7
|
|
|
|
|
181
|
|
5
|
7
|
|
|
7
|
|
48
|
use RPerl::AfterSubclass; |
|
7
|
|
|
|
|
13
|
|
|
7
|
|
|
|
|
820
|
|
6
|
|
|
|
|
|
|
our $VERSION = 0.004_000; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# [[[ OO INHERITANCE ]]] |
9
|
7
|
|
|
7
|
|
38
|
use parent qw(RPerl::GrammarRule); |
|
7
|
|
|
|
|
13
|
|
|
7
|
|
|
|
|
52
|
|
10
|
7
|
|
|
7
|
|
216
|
use RPerl::GrammarRule; |
|
7
|
|
|
|
|
16
|
|
|
7
|
|
|
|
|
3739
|
|
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
|
|
|
|
|
|
|
## no critic qw(Capitalization ProhibitMultiplePackages ProhibitReusedNames) # SYSTEM DEFAULT 3: allow multiple & lower case package names |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# [[[ OO PROPERTIES ]]] |
18
|
|
|
|
|
|
|
our hashref $properties = {}; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# [[[ SUBROUTINES & OO METHODS ]]] |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub ast_to_rperl__generate { |
23
|
154
|
|
|
154
|
|
352
|
{ my string_hashref::method $RETURN_TYPE }; |
|
154
|
|
|
|
|
314
|
|
24
|
154
|
|
|
|
|
421
|
( my object $self, my string_hashref $modes) = @ARG; |
25
|
154
|
|
|
|
|
598
|
my string_hashref $rperl_source_group = { PMC => q{} }; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# RPerl::diag( 'in CodeBlock->ast_to_rperl__generate(), received $self = ' . "\n" . RPerl::Parser::rperl_ast__dump($self) . "\n" ); |
28
|
|
|
|
|
|
|
|
29
|
154
|
|
|
|
|
551
|
my string $self_class = ref $self; |
30
|
|
|
|
|
|
|
|
31
|
154
|
50
|
|
|
|
562
|
if ( $self_class eq 'CodeBlock_188' ) { # CodeBlock -> LBRACE PLUS-41 '}' |
32
|
154
|
|
|
|
|
611
|
my string $left_brace = $self->{children}->[0]; |
33
|
154
|
|
|
|
|
443
|
my object $operation_plus = $self->{children}->[1]; |
34
|
154
|
|
|
|
|
483
|
my string $right_brace = $self->{children}->[2]; |
35
|
|
|
|
|
|
|
|
36
|
154
|
|
|
|
|
533
|
$rperl_source_group->{PMC} .= $left_brace . "\n"; |
37
|
|
|
|
|
|
|
|
38
|
154
|
|
|
|
|
322
|
foreach my object $operation ( @{ $operation_plus->{children} } ) { |
|
154
|
|
|
|
|
538
|
|
39
|
262
|
|
|
|
|
5814
|
my object $rperl_source_subgroup = $operation->ast_to_rperl__generate($modes); |
40
|
262
|
|
|
|
|
6069
|
RPerl::Generator::source_group_append( $rperl_source_group, $rperl_source_subgroup ); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# $rperl_source_group->{PMC} .= "\n"; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
154
|
|
|
|
|
592
|
$rperl_source_group->{PMC} .= $right_brace . "\n"; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
else { |
48
|
0
|
|
|
|
|
0
|
die RPerl::Parser::rperl_rule__replace( |
49
|
|
|
|
|
|
|
'ERROR ECOGEASRP00, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL: Grammar rule ' . $self_class . ' found where CodeBlock_188 expected, dying' ) |
50
|
|
|
|
|
|
|
. "\n"; |
51
|
|
|
|
|
|
|
} |
52
|
154
|
|
|
|
|
7579
|
return $rperl_source_group; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub ast_to_cpp__generate__CPPOPS_PERLTYPES { |
56
|
0
|
|
|
0
|
|
|
{ my string_hashref::method $RETURN_TYPE }; |
|
0
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
( my object $self, my string $loop_label, my string_hashref $modes) = @ARG; |
58
|
0
|
|
|
|
|
|
my string_hashref $cpp_source_group = { CPP => q{// <<< RP::CB __DUMMY_SOURCE_CODE CPPOPS_PERLTYPES >>>} . "\n" }; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
#... |
61
|
0
|
|
|
|
|
|
return $cpp_source_group; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub ast_to_cpp__generate__CPPOPS_CPPTYPES { |
65
|
0
|
|
|
0
|
|
|
{ my string_hashref::method $RETURN_TYPE }; |
|
0
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
( my object $self, my string $loop_label, my string_hashref $modes) = @ARG; |
67
|
0
|
|
|
|
|
|
my string_hashref $cpp_source_group = { CPP => q{} }; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
# RPerl::diag( 'in CodeBlock->ast_to_cpp__generate__CPPOPS_CPPTYPES(), received $self = ' . "\n" . RPerl::Parser::rperl_ast__dump($self) . "\n" ); |
70
|
|
|
|
|
|
|
# RPerl::diag( 'in CodeBlock->ast_to_cpp__generate__CPPOPS_CPPTYPES(), received $loop_label = ' . "\n" . RPerl::Parser::rperl_ast__dump($loop_label) . "\n" ); |
71
|
|
|
|
|
|
|
# RPerl::diag( 'in CodeBlock->ast_to_cpp__generate__CPPOPS_CPPTYPES(), received $modes->{_inside_parallel_loop} = ' . "\n" . $modes->{_inside_parallel_loop} . "\n" ); |
72
|
|
|
|
|
|
|
# RPerl::diag( 'in CodeBlock->ast_to_cpp__generate__CPPOPS_CPPTYPES(), received $modes->{_current_parallel_loop} = ' . "\n" . Dumper($modes->{_current_parallel_loop}) . "\n" ); |
73
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
my string $self_class = ref $self; |
75
|
|
|
|
|
|
|
|
76
|
0
|
0
|
|
|
|
|
if ( $self_class eq 'CodeBlock_188' ) { # CodeBlock -> LBRACE PLUS-41 '}' |
77
|
0
|
|
|
|
|
|
my string $left_brace = $self->{children}->[0]; |
78
|
0
|
|
|
|
|
|
my object $operation_plus = $self->{children}->[1]; |
79
|
0
|
|
|
|
|
|
my string $right_brace = $self->{children}->[2]; |
80
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
$cpp_source_group->{CPP} .= $left_brace . "\n"; |
82
|
|
|
|
|
|
|
# NEED FIX PARALLEL: temporarily disabled loop control labels while inside parallel loop to avoid pluto polycc error |
83
|
|
|
|
|
|
|
# RPerl::diag( 'in CodeBlock->ast_to_cpp__generate__CPPOPS_CPPTYPES(), before _REDO, have $modes->{_inside_parallel_loop} = ' . "\n" . RPerl::Parser::rperl_ast__dump($modes->{_inside_parallel_loop}) . "\n" ); |
84
|
0
|
0
|
0
|
|
|
|
if (( defined $loop_label ) and |
|
|
|
0
|
|
|
|
|
85
|
|
|
|
|
|
|
not ((exists $modes->{_inside_parallel_loop}) and (defined $modes->{_inside_parallel_loop}) and $modes->{_inside_parallel_loop})) { |
86
|
0
|
|
|
|
|
|
$cpp_source_group->{CPP} .= $loop_label . '_REDO: 1;' . "\n"; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
0
|
|
|
|
|
|
foreach my object $operation ( @{ $operation_plus->{children} } ) { |
|
0
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
# RPerl::diag( 'in CodeBlock->ast_to_cpp__generate__CPPOPS_CPPTYPES(), have $operation = ' . "\n" . RPerl::Parser::rperl_ast__dump($operation) . "\n" ); |
91
|
0
|
|
|
|
|
|
my object $cpp_source_subgroup = $operation->ast_to_cpp__generate__CPPOPS_CPPTYPES($modes); |
92
|
0
|
|
|
|
|
|
RPerl::Generator::source_group_append( $cpp_source_group, $cpp_source_subgroup ); |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
# DEV NOTE, INLINE BUG: must include '1;' null statement after labels to avoid the following error messages during g++ call from 'Running Mkbootstrap' Inline phase |
96
|
|
|
|
|
|
|
# error: expected primary-expression before â}â token |
97
|
|
|
|
|
|
|
# error: expected â;â before â}â token |
98
|
|
|
|
|
|
|
# NEED FIX PARALLEL: temporarily disabled loop control labels while inside parallel loop to avoid pluto polycc error |
99
|
|
|
|
|
|
|
# RPerl::diag( 'in CodeBlock->ast_to_cpp__generate__CPPOPS_CPPTYPES(), before _NEXT, have $modes->{_inside_parallel_loop} = ' . "\n" . RPerl::Parser::rperl_ast__dump($modes->{_inside_parallel_loop}) . "\n" ); |
100
|
0
|
0
|
0
|
|
|
|
if (( defined $loop_label ) and |
|
|
|
0
|
|
|
|
|
101
|
|
|
|
|
|
|
not ((exists $modes->{_inside_parallel_loop}) and (defined $modes->{_inside_parallel_loop}) and $modes->{_inside_parallel_loop})) { |
102
|
0
|
|
|
|
|
|
$cpp_source_group->{CPP} .= $loop_label . '_NEXT: 1;' . "\n"; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
0
|
|
|
|
|
|
$cpp_source_group->{CPP} .= $right_brace . "\n"; |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
# RPerl::diag( 'in CodeBlock->ast_to_cpp__generate__CPPOPS_CPPTYPES(), before _LAST, have $modes->{_inside_parallel_loop} = ' . "\n" . RPerl::Parser::rperl_ast__dump($modes->{_inside_parallel_loop}) . "\n" ); |
108
|
0
|
0
|
0
|
|
|
|
if (( defined $loop_label ) and |
|
|
|
0
|
|
|
|
|
109
|
|
|
|
|
|
|
not ((exists $modes->{_inside_parallel_loop}) and (defined $modes->{_inside_parallel_loop}) and $modes->{_inside_parallel_loop})) { |
110
|
0
|
|
|
|
|
|
$cpp_source_group->{CPP} .= $loop_label . '_LAST: 1;' . "\n"; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
else { |
114
|
0
|
|
|
|
|
|
die RPerl::Parser::rperl_rule__replace( |
115
|
|
|
|
|
|
|
'ERROR ECOGEASCP00, CODE GENERATOR, ABSTRACT SYNTAX TO C++: Grammar rule ' . $self_class . ' found where CodeBlock_188 expected, dying' ) |
116
|
|
|
|
|
|
|
. "\n"; |
117
|
|
|
|
|
|
|
} |
118
|
0
|
|
|
|
|
|
return $cpp_source_group; |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
# [[[ SUB-TYPES ]]] |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
package RPerl::CodeReference; |
124
|
7
|
|
|
7
|
|
43
|
use strict; |
|
7
|
|
|
|
|
13
|
|
|
7
|
|
|
|
|
129
|
|
125
|
7
|
|
|
7
|
|
25
|
use warnings; |
|
7
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
167
|
|
126
|
7
|
|
|
7
|
|
30
|
use parent qw(RPerl::DataType::Modifier::Reference); |
|
7
|
|
|
|
|
25
|
|
|
7
|
|
|
|
|
30
|
|
127
|
7
|
|
|
7
|
|
421
|
use RPerl::DataType::Modifier::Reference; |
|
7
|
|
|
|
|
12
|
|
|
7
|
|
|
|
|
194
|
|
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
package # hide from PAUSE indexing |
130
|
|
|
|
|
|
|
coderef; |
131
|
7
|
|
|
7
|
|
33
|
use strict; |
|
7
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
109
|
|
132
|
7
|
|
|
7
|
|
28
|
use warnings; |
|
7
|
|
|
|
|
16
|
|
|
7
|
|
|
|
|
645
|
|
133
|
7
|
|
|
7
|
|
39
|
use parent -norequire, qw(RPerl::CodeReference); |
|
7
|
|
|
|
|
13
|
|
|
7
|
|
|
|
|
26
|
|
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
1; # end of class |