line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# [[[ HEADER ]]] |
2
|
|
|
|
|
|
|
package RPerl::Operation::Statement; |
3
|
4
|
|
|
4
|
|
1035
|
use strict; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
89
|
|
4
|
4
|
|
|
4
|
|
19
|
use warnings; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
77
|
|
5
|
4
|
|
|
4
|
|
18
|
use RPerl::AfterSubclass; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
462
|
|
6
|
|
|
|
|
|
|
our $VERSION = 0.002_010; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# [[[ OO INHERITANCE ]]] |
9
|
4
|
|
|
4
|
|
24
|
use parent qw(RPerl::Operation); |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
420
|
|
10
|
4
|
|
|
4
|
|
201
|
use RPerl::Operation; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
1797
|
|
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
|
2410
|
|
|
2410
|
|
4789
|
{ my string_hashref::method $RETURN_TYPE }; |
|
2410
|
|
|
|
|
4331
|
|
23
|
2410
|
|
|
|
|
5890
|
( my object $self, my string_hashref $modes) = @ARG; |
24
|
2410
|
|
|
|
|
7398
|
my string_hashref $rperl_source_group = { PMC => q{} }; |
25
|
2410
|
|
|
|
|
6916
|
my object $child0 = $self->{children}->[0]; |
26
|
2410
|
|
|
|
|
5796
|
my string $child0_class = ref $child0; |
27
|
2410
|
|
|
|
|
4990
|
my string_hashref $rperl_source_subgroup; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# RPerl::diag( 'in Statement->ast_to_rperl__generate(), received $self = ' . "\n" . RPerl::Parser::rperl_ast__dump($self) . "\n" ); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# Conditional, OperatorVoid, VariableDeclaration, or VariableModification |
32
|
2410
|
100
|
100
|
|
|
21973
|
if ( ( $child0_class eq 'Statement_166' ) |
|
|
50
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
33
|
|
|
|
|
|
|
or ( $child0_class eq 'Statement_168' ) |
34
|
|
|
|
|
|
|
or ( $child0_class eq 'Statement_169' ) |
35
|
|
|
|
|
|
|
or ( $child0_class eq 'Statement_170' ) ) |
36
|
|
|
|
|
|
|
{ |
37
|
2320
|
|
|
|
|
51408
|
$rperl_source_subgroup |
38
|
|
|
|
|
|
|
= $child0->ast_to_rperl__generate($modes); |
39
|
2293
|
|
|
|
|
45373
|
RPerl::Generator::source_group_append( $rperl_source_group, |
40
|
|
|
|
|
|
|
$rperl_source_subgroup ); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# Loop |
44
|
|
|
|
|
|
|
elsif ( $child0_class eq 'Statement_167' ) { |
45
|
90
|
|
|
|
|
308
|
my $optional_loop_label = $child0->{children}->[0]; |
46
|
90
|
|
|
|
|
307
|
my $loop = $child0->{children}->[1]; |
47
|
|
|
|
|
|
|
# RPerl::diag( 'in Statement->ast_to_rperl__generate(), have $optional_loop_label = ' . "\n" . RPerl::Parser::rperl_ast__dump($optional_loop_label) . "\n" ); |
48
|
90
|
100
|
|
|
|
418
|
if ( exists $optional_loop_label->{children}->[0] ) { # LoopLabel COLON |
49
|
23
|
|
|
|
|
182
|
$rperl_source_group->{PMC} .= "\n" . $optional_loop_label->{children}->[0]->{children}->[0] . $optional_loop_label->{children}->[1]->{attr} . "\n"; |
50
|
|
|
|
|
|
|
} |
51
|
90
|
|
|
|
|
2501
|
$rperl_source_subgroup = $loop->ast_to_rperl__generate($modes); |
52
|
89
|
|
|
|
|
1868
|
RPerl::Generator::source_group_append( $rperl_source_group, $rperl_source_subgroup ); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
else { |
55
|
0
|
|
|
|
|
0
|
die RPerl::Parser::rperl_rule__replace( |
56
|
|
|
|
|
|
|
'ERROR ECOGEASRP00, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL: Grammar rule ' |
57
|
|
|
|
|
|
|
. $child0_class |
58
|
|
|
|
|
|
|
. ' found where Statement_166, Statement_167, Statement_168, Statement_169, or Statement_170 expected, dying' |
59
|
|
|
|
|
|
|
) . "\n"; |
60
|
|
|
|
|
|
|
} |
61
|
2382
|
|
|
|
|
58308
|
return $rperl_source_group; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub ast_to_cpp__generate__CPPOPS_PERLTYPES { |
65
|
0
|
|
|
0
|
|
0
|
{ my string_hashref::method $RETURN_TYPE }; |
|
0
|
|
|
|
|
0
|
|
66
|
0
|
|
|
|
|
0
|
( my object $self, my string_hashref $modes) = @ARG; |
67
|
0
|
|
|
|
|
0
|
my string_hashref $cpp_source_group |
68
|
|
|
|
|
|
|
= { CPP => q{// <<< RP::O::S __DUMMY_SOURCE_CODE CPPOPS_PERLTYPES >>>} |
69
|
|
|
|
|
|
|
. "\n" }; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
#... |
72
|
0
|
|
|
|
|
0
|
return $cpp_source_group; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub ast_to_cpp__generate__CPPOPS_CPPTYPES { |
76
|
180
|
|
|
180
|
|
319
|
{ my string_hashref::method $RETURN_TYPE }; |
|
180
|
|
|
|
|
265
|
|
77
|
180
|
|
|
|
|
373
|
( my object $self, my string_hashref $modes) = @ARG; |
78
|
|
|
|
|
|
|
# RPerl::diag( 'in Statement->ast_to_cpp__generate__CPPOPS_CPPTYPES(), received $modes->{_symbol_table} = ' . "\n" . Dumper($modes->{_symbol_table}) . "\n"); |
79
|
|
|
|
|
|
|
|
80
|
180
|
|
|
|
|
568
|
my string_hashref $cpp_source_group = { CPP => q{} }; |
81
|
180
|
|
|
|
|
517
|
my object $child0 = $self->{children}->[0]; |
82
|
180
|
|
|
|
|
332
|
my string $child0_class = ref $child0; |
83
|
180
|
|
|
|
|
242
|
my string_hashref $cpp_source_subgroup; |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
# RPerl::diag( 'in Statement->ast_to_cpp__generate__CPPOPS_CPPTYPES(), received $self = ' . "\n" . RPerl::Parser::rperl_ast__dump($self) . "\n" ); |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
# Conditional, OperatorVoid, VariableDeclaration, or VariableModification |
88
|
180
|
50
|
66
|
|
|
1085
|
if ( ( $child0_class eq 'Statement_166' ) |
|
|
0
|
100
|
|
|
|
|
|
|
|
66
|
|
|
|
|
89
|
|
|
|
|
|
|
or ( $child0_class eq 'Statement_168' ) |
90
|
|
|
|
|
|
|
or ( $child0_class eq 'Statement_169' ) |
91
|
|
|
|
|
|
|
or ( $child0_class eq 'Statement_170' ) ) |
92
|
|
|
|
|
|
|
{ |
93
|
180
|
|
|
|
|
3710
|
$cpp_source_subgroup = $child0->ast_to_cpp__generate__CPPOPS_CPPTYPES($modes); |
94
|
|
|
|
|
|
|
# RPerl::diag( 'in Statement->ast_to_cpp__generate__CPPOPS_CPPTYPES(), have $cpp_source_subgroup = ' . "\n" . RPerl::Parser::rperl_ast__dump($cpp_source_subgroup) . "\n" ); |
95
|
180
|
|
|
|
|
3525
|
RPerl::Generator::source_group_append( $cpp_source_group, $cpp_source_subgroup ); |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
# Loop |
99
|
|
|
|
|
|
|
elsif ( $child0_class eq 'Statement_167' ) { |
100
|
0
|
|
|
|
|
0
|
my object $optional_loop_label = $child0->{children}->[0]; |
101
|
0
|
|
|
|
|
0
|
my object $loop = $child0->{children}->[1]; |
102
|
0
|
|
|
|
|
0
|
my string $loop_label = undef; |
103
|
|
|
|
|
|
|
# RPerl::diag( 'in Statement->ast_to_cpp__generate__CPPOPS_CPPTYPES(), have $loop = ' . "\n" . RPerl::Parser::rperl_ast__dump($loop) . "\n" ); |
104
|
|
|
|
|
|
|
# RPerl::diag( 'in Statement->ast_to_cpp__generate__CPPOPS_CPPTYPES(), have $optional_loop_label = ' . "\n" . RPerl::Parser::rperl_ast__dump($optional_loop_label) . "\n" ); |
105
|
|
|
|
|
|
|
|
106
|
0
|
0
|
|
|
|
0
|
if ( exists $optional_loop_label->{children}->[0] ) { # LoopLabel COLON |
107
|
0
|
|
|
|
|
0
|
$loop_label = $optional_loop_label->{children}->[0]->{children}->[0]; |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
# RPerl::diag( 'in Statement->ast_to_cpp__generate__CPPOPS_CPPTYPES(), have $loop_label = ' . "\n" . RPerl::Parser::rperl_ast__dump($loop_label) . "\n" ); |
110
|
0
|
|
|
|
|
0
|
$cpp_source_subgroup = $loop->ast_to_cpp__generate__CPPOPS_CPPTYPES($loop_label, $modes); |
111
|
0
|
|
|
|
|
0
|
RPerl::Generator::source_group_append( $cpp_source_group, $cpp_source_subgroup ); |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
else { |
114
|
0
|
|
|
|
|
0
|
die RPerl::Parser::rperl_rule__replace( |
115
|
|
|
|
|
|
|
'ERROR ECOGEASCP00, CODE GENERATOR, ABSTRACT SYNTAX TO C++: Grammar rule ' |
116
|
|
|
|
|
|
|
. $child0_class |
117
|
|
|
|
|
|
|
. ' found where Statement_166, Statement_167, Statement_168, Statement_169, or Statement_170 expected, dying' |
118
|
|
|
|
|
|
|
) . "\n"; |
119
|
|
|
|
|
|
|
} |
120
|
180
|
|
|
|
|
4005
|
return $cpp_source_group; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
1; # end of class |