line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# [[[ DOCUMENTATION ]]] |
2
|
|
|
|
|
|
|
# http://perldoc.perl.org/functions/return.html |
3
|
|
|
|
|
|
|
# SUPPORTED: return EXPR |
4
|
|
|
|
|
|
|
# SUPPORTED: return |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# [[[ HEADER ]]] |
7
|
|
|
|
|
|
|
package RPerl::Operation::Statement::OperatorVoid::Named::Return; |
8
|
4
|
|
|
4
|
|
27
|
use strict; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
115
|
|
9
|
4
|
|
|
4
|
|
20
|
use warnings; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
106
|
|
10
|
4
|
|
|
4
|
|
24
|
use RPerl::AfterSubclass; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
622
|
|
11
|
|
|
|
|
|
|
our $VERSION = 0.002_010; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# [[[ OO INHERITANCE ]]] |
14
|
|
|
|
|
|
|
# NEED FIX: is not a Grammar Rule so should not inherit from OperatorVoid, need create Grammar Production class |
15
|
4
|
|
|
4
|
|
29
|
use parent qw(RPerl::Operation::Statement::OperatorVoid::Named); |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
20
|
|
16
|
4
|
|
|
4
|
|
156
|
use RPerl::Operation::Statement::OperatorVoid::Named; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
121
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# [[[ CRITICS ]]] |
19
|
|
|
|
|
|
|
## no critic qw(ProhibitUselessNoCritic ProhibitMagicNumbers RequireCheckedSyscalls) # USER DEFAULT 1: allow numeric values & print operator |
20
|
|
|
|
|
|
|
## no critic qw(RequireInterpolationOfMetachars) # USER DEFAULT 2: allow single-quoted control characters & sigils |
21
|
|
|
|
|
|
|
## no critic qw(ProhibitConstantPragma ProhibitMagicNumbers) # USER DEFAULT 3: allow constants |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# [[[ CONSTANTS ]]] |
24
|
4
|
|
|
4
|
|
19
|
use constant NAME_PERLOPS_PERLTYPES => my string $TYPED_NAME_PERLOPS_PERLTYPES = 'return'; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
284
|
|
25
|
4
|
|
|
4
|
|
44
|
use constant NAME_CPPOPS_PERLTYPES => my string $TYPED_NAME_CPPOPS_PERLTYPES = 'return'; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
184
|
|
26
|
4
|
|
|
4
|
|
22
|
use constant NAME_CPPOPS_CPPTYPES => my string $TYPED_NAME_CPPOPS_CPPTYPES = 'return'; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
171
|
|
27
|
|
|
|
|
|
|
# DEV NOTE: ARGUMENTS_MIN of 0 can be ignored, no such thing as negative number of args! |
28
|
4
|
|
|
4
|
|
20
|
use constant ARGUMENTS_MIN => my integer $TYPED_ARGUMENTS_MIN = 0; # call 'return;' for all subroutines which return void |
|
4
|
|
|
|
|
12
|
|
|
4
|
|
|
|
|
164
|
|
29
|
4
|
|
|
4
|
|
21
|
use constant ARGUMENTS_MAX => my integer $TYPED_ARGUMENTS_MAX = 1; # call 'return @{[ELEM0, ELEM1, ...]};' for all subroutines which return an array; disallow return(ELEM0, ELEM1, ...) multiple return values |
|
4
|
|
|
|
|
12
|
|
|
4
|
|
|
|
|
4236
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# [[[ OO PROPERTIES ]]] |
32
|
|
|
|
|
|
|
our hashref $properties = {}; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# [[[ SUBROUTINES & OO METHODS ]]] |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub ast_to_rperl__generate { |
37
|
330
|
|
|
330
|
|
919
|
{ my string_hashref::method $RETURN_TYPE }; |
|
330
|
|
|
|
|
933
|
|
38
|
330
|
|
|
|
|
1543
|
( my object $self, |
39
|
|
|
|
|
|
|
my string_hashref $modes, |
40
|
|
|
|
|
|
|
my object $operator_void_named) |
41
|
|
|
|
|
|
|
= @ARG; |
42
|
330
|
|
|
|
|
1406
|
my string_hashref $rperl_source_group = { PMC => q{} }; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# RPerl::diag( 'in OperatorVoid::Named::Return->ast_to_rperl__generate(), received $self = ' . "\n" . RPerl::Parser::rperl_ast__dump($self) . "\n" ); |
45
|
|
|
|
|
|
|
# RPerl::diag( 'in OperatorVoid::Named::Return->ast_to_rperl__generate(), received $operator_void_named = ' . "\n" . RPerl::Parser::rperl_ast__dump($operator_void_named) . "\n" ); |
46
|
|
|
|
|
|
|
|
47
|
330
|
100
|
|
|
|
3254
|
if ( ref $operator_void_named eq 'OperatorVoid_131' ) { # OperatorVoid -> OP01_NAMED_VOID_SCOLON |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
48
|
38
|
|
|
|
|
135
|
$rperl_source_group->{PMC} .= $operator_void_named->{children}->[0]; # name semicolon |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
elsif ( ref $operator_void_named eq 'OperatorVoid_132' ) { # OperatorVoid -> OP01_NAMED_VOID_LPAREN OPTIONAL-32 ')' ';' |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# DEV NOTE: if $arguments_optional is empty, will generate 'return();' which perltidy will change to 'return ();', both return undef, not empty array, so it's okay |
53
|
|
|
|
|
|
|
$rperl_source_group->{PMC} |
54
|
15
|
|
|
|
|
57
|
.= $operator_void_named->{children}->[0]; # name lparen |
55
|
15
|
|
|
|
|
40
|
my object $arguments_optional = $operator_void_named->{children}->[1]; |
56
|
15
|
100
|
|
|
|
71
|
if ( exists $arguments_optional->{children}->[0] ) { |
57
|
14
|
|
|
|
|
47
|
my object $arguments = $arguments_optional->{children}->[0]; |
58
|
14
|
|
|
|
|
329
|
my integer $argument_count = $arguments->length(); |
59
|
14
|
100
|
|
|
|
73
|
if ( $argument_count > ARGUMENTS_MAX() ) { |
60
|
2
|
|
|
|
|
83
|
die |
61
|
|
|
|
|
|
|
'ERROR ECOGEASRP03, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL:' |
62
|
|
|
|
|
|
|
. "\n" |
63
|
|
|
|
|
|
|
. 'Argument count ' |
64
|
|
|
|
|
|
|
. $argument_count |
65
|
|
|
|
|
|
|
. ' exceeds maximum argument limit ' |
66
|
|
|
|
|
|
|
. ARGUMENTS_MAX() |
67
|
|
|
|
|
|
|
. ' for operator ' . q{'} |
68
|
|
|
|
|
|
|
. NAME_PERLOPS_PERLTYPES() . q{'} |
69
|
|
|
|
|
|
|
. ', dying' . "\n"; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
# RPerl::diag( 'in OperatorVoid::Named::Return->ast_to_rperl__generate(), have $arguments = ' . "\n" . RPerl::Parser::rperl_ast__dump($arguments) . "\n" ); |
72
|
12
|
50
|
33
|
|
|
111
|
if ((( ref $arguments->{children}->[0] ) eq 'ListElement_205' ) and ( exists $arguments->{children}->[0]->{children}->[0] )) |
73
|
|
|
|
|
|
|
{ |
74
|
12
|
|
|
|
|
37
|
my object $arguments_subexpression = $arguments->{children}->[0]->{children}->[0]; |
75
|
|
|
|
|
|
|
# look inside nested parenthesis-as-subexpressions, always length 1 so no need to check length |
76
|
12
|
|
|
|
|
53
|
while ((ref $arguments_subexpression) eq 'SubExpression_157') { # RPerl::Operation::Expression::SubExpression::Parenthesis |
77
|
18
|
|
|
|
|
63
|
$arguments_subexpression = $arguments_subexpression->{children}->[1]; |
78
|
|
|
|
|
|
|
} |
79
|
12
|
100
|
|
|
|
68
|
if (( ref $arguments_subexpression ) eq 'SubExpression_154' ) { |
|
|
100
|
|
|
|
|
|
80
|
4
|
|
|
|
|
108
|
die 'ERROR ECOGEASRP04, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL:' . "\n" . 'Attempt to return dereferenced array, please return arrayref instead, dying' . "\n"; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
elsif (( ref $arguments_subexpression ) eq 'SubExpression_156' ) { |
83
|
4
|
|
|
|
|
85
|
die 'ERROR ECOGEASRP05, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL:' . "\n" . 'Attempt to return dereferenced hash, please return hashref instead, dying' . "\n"; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
} |
86
|
4
|
|
|
|
|
101
|
my string_hashref $rperl_source_subgroup |
87
|
|
|
|
|
|
|
= $arguments->ast_to_rperl__generate( $modes, $self ); |
88
|
4
|
|
|
|
|
84
|
RPerl::Generator::source_group_append( $rperl_source_group, |
89
|
|
|
|
|
|
|
$rperl_source_subgroup ); |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
$rperl_source_group->{PMC} .= $operator_void_named->{children}->[2] |
92
|
5
|
|
|
|
|
19
|
. $operator_void_named->{children}->[3]; # rparen semicolon |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
elsif ( ref $operator_void_named eq 'OperatorVoid_133' ) { # OperatorVoid -> OP01_NAMED_VOID ListElements ';' |
95
|
|
|
|
|
|
|
$rperl_source_group->{PMC} |
96
|
277
|
|
|
|
|
1451
|
.= $operator_void_named->{children}->[0] . q{ }; # name |
97
|
277
|
|
|
|
|
1019
|
my object $arguments = $operator_void_named->{children}->[1]; |
98
|
277
|
|
|
|
|
6696
|
my integer $argument_count = $arguments->length(); |
99
|
277
|
100
|
|
|
|
1619
|
if ( $argument_count > ARGUMENTS_MAX() ) { |
100
|
3
|
|
|
|
|
90
|
die |
101
|
|
|
|
|
|
|
'ERROR ECOGEASRP03, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL:' |
102
|
|
|
|
|
|
|
. "\n" |
103
|
|
|
|
|
|
|
. 'Argument count ' |
104
|
|
|
|
|
|
|
. $argument_count |
105
|
|
|
|
|
|
|
. ' exceeds maximum argument limit ' |
106
|
|
|
|
|
|
|
. ARGUMENTS_MAX() |
107
|
|
|
|
|
|
|
. ' for operator ' . q{'} |
108
|
|
|
|
|
|
|
. NAME_PERLOPS_PERLTYPES() . q{'} |
109
|
|
|
|
|
|
|
. ', dying' . "\n"; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
# RPerl::diag( 'in OperatorVoid::Named::Return->ast_to_rperl__generate(), have $arguments = ' . "\n" . RPerl::Parser::rperl_ast__dump($arguments) . "\n" ); |
112
|
274
|
50
|
33
|
|
|
3511
|
if ((( ref $arguments->{children}->[0] ) eq 'ListElement_205' ) and ( exists $arguments->{children}->[0]->{children}->[0] )) |
113
|
|
|
|
|
|
|
{ |
114
|
274
|
|
|
|
|
912
|
my object $arguments_subexpression = $arguments->{children}->[0]->{children}->[0]; |
115
|
|
|
|
|
|
|
# look inside nested parenthesis-as-subexpressions, always length 1 so no need to check length |
116
|
274
|
|
|
|
|
1579
|
while ((ref $arguments_subexpression) eq 'SubExpression_157') { # RPerl::Operation::Expression::SubExpression::Parenthesis |
117
|
101
|
|
|
|
|
510
|
$arguments_subexpression = $arguments_subexpression->{children}->[1]; |
118
|
|
|
|
|
|
|
} |
119
|
274
|
100
|
|
|
|
1782
|
if (( ref $arguments_subexpression ) eq 'SubExpression_154' ) { |
|
|
100
|
|
|
|
|
|
120
|
4
|
|
|
|
|
97
|
die 'ERROR ECOGEASRP04, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL:' . "\n" . 'Attempt to return dereferenced array, please return arrayref instead, dying' . "\n"; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
elsif (( ref $arguments_subexpression ) eq 'SubExpression_156' ) { |
123
|
4
|
|
|
|
|
90
|
die 'ERROR ECOGEASRP05, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL:' . "\n" . 'Attempt to return dereferenced hash, please return hashref instead, dying' . "\n"; |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
} |
126
|
266
|
|
|
|
|
6291
|
my string_hashref $rperl_source_subgroup |
127
|
|
|
|
|
|
|
= $arguments->ast_to_rperl__generate( $modes, $self ); |
128
|
266
|
|
|
|
|
5580
|
RPerl::Generator::source_group_append( $rperl_source_group, |
129
|
|
|
|
|
|
|
$rperl_source_subgroup ); |
130
|
266
|
|
|
|
|
1079
|
$rperl_source_group->{PMC} .= $operator_void_named->{children}->[2]; # semicolon |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
else { |
133
|
0
|
|
|
|
|
0
|
die RPerl::Parser::rperl_rule__replace( |
134
|
|
|
|
|
|
|
'ERROR ECOGEASRP00, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL: Grammar rule ' |
135
|
|
|
|
|
|
|
. ( ref $operator_void_named ) |
136
|
|
|
|
|
|
|
. ' found where OperatorVoid_131, OperatorVoid_132, or OperatorVoid_133 expected, dying' |
137
|
|
|
|
|
|
|
) . "\n"; |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
309
|
|
|
|
|
905
|
$rperl_source_group->{PMC} .= "\n"; |
141
|
309
|
|
|
|
|
1067
|
return $rperl_source_group; |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
sub ast_to_cpp__generate__CPPOPS_PERLTYPES { |
145
|
0
|
|
|
0
|
|
0
|
{ my string_hashref::method $RETURN_TYPE }; |
|
0
|
|
|
|
|
0
|
|
146
|
0
|
|
|
|
|
0
|
( my object $self, my string_hashref $modes) = @ARG; |
147
|
0
|
|
|
|
|
0
|
my string_hashref $cpp_source_group |
148
|
|
|
|
|
|
|
= { CPP => |
149
|
|
|
|
|
|
|
q{// <<< RP::O::S::OV::N::R __DUMMY_SOURCE_CODE CPPOPS_PERLTYPES >>>} |
150
|
|
|
|
|
|
|
. "\n" }; |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
#... |
153
|
0
|
|
|
|
|
0
|
return $cpp_source_group; |
154
|
|
|
|
|
|
|
} |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
# DEV NOTE: PERLOPS_PERLTYPES & CPPOPS_CPPTYPES code generation are exactly equivalent |
157
|
|
|
|
|
|
|
sub ast_to_cpp__generate__CPPOPS_CPPTYPES { |
158
|
38
|
|
|
38
|
|
69
|
{ my string_hashref::method $RETURN_TYPE }; |
|
38
|
|
|
|
|
94
|
|
159
|
38
|
|
|
|
|
95
|
( my object $self, |
160
|
|
|
|
|
|
|
my string_hashref $modes, |
161
|
|
|
|
|
|
|
my object $operator_void_named) |
162
|
|
|
|
|
|
|
= @ARG; |
163
|
38
|
|
|
|
|
211
|
my string_hashref $cpp_source_group = { CPP => q{} }; |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
# RPerl::diag( 'in OperatorVoid::Named::Return->ast_to_cpp__generate__CPPOPS_CPPTYPES(), received $self = ' . "\n" . RPerl::Parser::rperl_ast__dump($self) . "\n" ); |
166
|
|
|
|
|
|
|
# RPerl::diag( 'in OperatorVoid::Named::Return->ast_to_cpp__generate__CPPOPS_CPPTYPES(), received $operator_void_named = ' . "\n" . RPerl::Parser::rperl_ast__dump($operator_void_named) . "\n" ); |
167
|
|
|
|
|
|
|
|
168
|
38
|
100
|
|
|
|
178
|
if ( ref $operator_void_named eq 'OperatorVoid_131' ) { # OperatorVoid -> OP01_NAMED_VOID_SCOLON |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
169
|
21
|
|
|
|
|
89
|
$cpp_source_group->{CPP} .= $operator_void_named->{children}->[0]; # name semicolon |
170
|
|
|
|
|
|
|
} |
171
|
|
|
|
|
|
|
elsif ( ref $operator_void_named eq 'OperatorVoid_132' ) { # OperatorVoid -> OP01_NAMED_VOID_LPAREN OPTIONAL-32 ')' ';' |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
# DEV NOTE: if $arguments_optional is empty, will generate 'return();' which perltidy will change to 'return ();', both return undef, not empty array, so it's okay |
174
|
|
|
|
|
|
|
$cpp_source_group->{CPP} |
175
|
0
|
|
|
|
|
0
|
.= $operator_void_named->{children}->[0]; # name lparen |
176
|
0
|
|
|
|
|
0
|
my object $arguments_optional = $operator_void_named->{children}->[1]; |
177
|
0
|
0
|
|
|
|
0
|
if ( exists $arguments_optional->{children}->[0] ) { |
178
|
0
|
|
|
|
|
0
|
my object $arguments = $arguments_optional->{children}->[0]; |
179
|
0
|
|
|
|
|
0
|
my integer $argument_count = $arguments->length(); |
180
|
0
|
0
|
|
|
|
0
|
if ( $argument_count > ARGUMENTS_MAX() ) { |
181
|
0
|
|
|
|
|
0
|
die |
182
|
|
|
|
|
|
|
'ERROR ECOGEASCP03, CODE GENERATOR, ABSTRACT SYNTAX TO C++:' |
183
|
|
|
|
|
|
|
. "\n" |
184
|
|
|
|
|
|
|
. 'Argument count ' |
185
|
|
|
|
|
|
|
. $argument_count |
186
|
|
|
|
|
|
|
. ' exceeds maximum argument limit ' |
187
|
|
|
|
|
|
|
. ARGUMENTS_MAX() |
188
|
|
|
|
|
|
|
. ' for operator ' . q{'} |
189
|
|
|
|
|
|
|
. NAME_PERLOPS_PERLTYPES() . q{'} |
190
|
|
|
|
|
|
|
. ', dying' . "\n"; |
191
|
|
|
|
|
|
|
} |
192
|
|
|
|
|
|
|
# RPerl::diag( 'in OperatorVoid::Named::Return->ast_to_cpp__generate__CPPOPS_CPPTYPES(), have $arguments = ' . "\n" . RPerl::Parser::rperl_ast__dump($arguments) . "\n" ); |
193
|
0
|
0
|
0
|
|
|
0
|
if ((( ref $arguments->{children}->[0] ) eq 'ListElement_205' ) and ( exists $arguments->{children}->[0]->{children}->[0] )) |
194
|
|
|
|
|
|
|
{ |
195
|
0
|
|
|
|
|
0
|
my object $arguments_subexpression = $arguments->{children}->[0]->{children}->[0]; |
196
|
|
|
|
|
|
|
# look inside nested parenthesis-as-subexpressions, always length 1 so no need to check length |
197
|
0
|
|
|
|
|
0
|
while ((ref $arguments_subexpression) eq 'SubExpression_157') { # RPerl::Operation::Expression::SubExpression::Parenthesis |
198
|
0
|
|
|
|
|
0
|
$arguments_subexpression = $arguments_subexpression->{children}->[1]; |
199
|
|
|
|
|
|
|
} |
200
|
0
|
0
|
|
|
|
0
|
if (( ref $arguments_subexpression ) eq 'SubExpression_154' ) { |
|
|
0
|
|
|
|
|
|
201
|
0
|
|
|
|
|
0
|
die 'ERROR ECOGEASCP04, CODE GENERATOR, ABSTRACT SYNTAX TO C++:' . "\n" . 'Attempt to return dereferenced array, please return arrayref instead, dying' . "\n"; |
202
|
|
|
|
|
|
|
} |
203
|
|
|
|
|
|
|
elsif (( ref $arguments_subexpression ) eq 'SubExpression_156' ) { |
204
|
0
|
|
|
|
|
0
|
die 'ERROR ECOGEASCP05, CODE GENERATOR, ABSTRACT SYNTAX TO C++:' . "\n" . 'Attempt to return dereferenced hash, please return hashref instead, dying' . "\n"; |
205
|
|
|
|
|
|
|
} |
206
|
|
|
|
|
|
|
} |
207
|
0
|
|
|
|
|
0
|
my string_hashref $cpp_source_subgroup |
208
|
|
|
|
|
|
|
= $arguments->ast_to_cpp__generate__CPPOPS_CPPTYPES( $modes, $self ); |
209
|
|
|
|
|
|
|
# RPerl::diag( 'in OperatorVoid::Named::Return->ast_to_cpp__generate__CPPOPS_CPPTYPES(), have $cpp_source_subgroup = ' . "\n" . RPerl::Parser::rperl_ast__dump($cpp_source_subgroup) . "\n" ); |
210
|
0
|
|
|
|
|
0
|
RPerl::Generator::source_group_append( $cpp_source_group, |
211
|
|
|
|
|
|
|
$cpp_source_subgroup ); |
212
|
|
|
|
|
|
|
} |
213
|
|
|
|
|
|
|
$cpp_source_group->{CPP} .= $operator_void_named->{children}->[2] |
214
|
0
|
|
|
|
|
0
|
. $operator_void_named->{children}->[3]; # rparen semicolon |
215
|
|
|
|
|
|
|
} |
216
|
|
|
|
|
|
|
elsif ( ref $operator_void_named eq 'OperatorVoid_133' ) { # OperatorVoid -> OP01_NAMED_VOID ListElements ';' |
217
|
|
|
|
|
|
|
$cpp_source_group->{CPP} |
218
|
17
|
|
|
|
|
53
|
.= $operator_void_named->{children}->[0] . q{ }; # name |
219
|
17
|
|
|
|
|
33
|
my object $arguments = $operator_void_named->{children}->[1]; |
220
|
17
|
|
|
|
|
333
|
my integer $argument_count = $arguments->length(); |
221
|
17
|
50
|
|
|
|
57
|
if ( $argument_count > ARGUMENTS_MAX() ) { |
222
|
0
|
|
|
|
|
0
|
die |
223
|
|
|
|
|
|
|
'ERROR ECOGEASCP03, CODE GENERATOR, ABSTRACT SYNTAX TO C++:' |
224
|
|
|
|
|
|
|
. "\n" |
225
|
|
|
|
|
|
|
. 'Argument count ' |
226
|
|
|
|
|
|
|
. $argument_count |
227
|
|
|
|
|
|
|
. ' exceeds maximum argument limit ' |
228
|
|
|
|
|
|
|
. ARGUMENTS_MAX() |
229
|
|
|
|
|
|
|
. ' for operator ' . q{'} |
230
|
|
|
|
|
|
|
. NAME_PERLOPS_PERLTYPES() . q{'} |
231
|
|
|
|
|
|
|
. ', dying' . "\n"; |
232
|
|
|
|
|
|
|
} |
233
|
|
|
|
|
|
|
# RPerl::diag( 'in OperatorVoid::Named::Return->ast_to_cpp__generate__CPPOPS_CPPTYPES(), have $arguments = ' . "\n" . RPerl::Parser::rperl_ast__dump($arguments) . "\n" ); |
234
|
17
|
50
|
33
|
|
|
125
|
if ((( ref $arguments->{children}->[0] ) eq 'ListElement_205' ) and ( exists $arguments->{children}->[0]->{children}->[0] )) |
235
|
|
|
|
|
|
|
{ |
236
|
17
|
|
|
|
|
38
|
my object $arguments_subexpression = $arguments->{children}->[0]->{children}->[0]; |
237
|
|
|
|
|
|
|
# look inside nested parenthesis-as-subexpressions, always length 1 so no need to check length |
238
|
17
|
|
|
|
|
56
|
while ((ref $arguments_subexpression) eq 'SubExpression_157') { # RPerl::Operation::Expression::SubExpression::Parenthesis |
239
|
1
|
|
|
|
|
4
|
$arguments_subexpression = $arguments_subexpression->{children}->[1]; |
240
|
|
|
|
|
|
|
} |
241
|
17
|
50
|
|
|
|
63
|
if (( ref $arguments_subexpression ) eq 'SubExpression_154' ) { |
|
|
50
|
|
|
|
|
|
242
|
0
|
|
|
|
|
0
|
die 'ERROR ECOGEASCP04, CODE GENERATOR, ABSTRACT SYNTAX TO C++:' . "\n" . 'Attempt to return dereferenced array, please return arrayref instead, dying' . "\n"; |
243
|
|
|
|
|
|
|
} |
244
|
|
|
|
|
|
|
elsif (( ref $arguments_subexpression ) eq 'SubExpression_156' ) { |
245
|
0
|
|
|
|
|
0
|
die 'ERROR ECOGEASCP05, CODE GENERATOR, ABSTRACT SYNTAX TO C++:' . "\n" . 'Attempt to return dereferenced hash, please return hashref instead, dying' . "\n"; |
246
|
|
|
|
|
|
|
} |
247
|
|
|
|
|
|
|
} |
248
|
17
|
|
|
|
|
336
|
my string_hashref $cpp_source_subgroup |
249
|
|
|
|
|
|
|
= $arguments->ast_to_cpp__generate__CPPOPS_CPPTYPES( $modes, $self ); |
250
|
|
|
|
|
|
|
# RPerl::diag( 'in OperatorVoid::Named::Return->ast_to_cpp__generate__CPPOPS_CPPTYPES(), have $cpp_source_subgroup = ' . "\n" . RPerl::Parser::rperl_ast__dump($cpp_source_subgroup) . "\n" ); |
251
|
17
|
|
|
|
|
333
|
RPerl::Generator::source_group_append( $cpp_source_group, |
252
|
|
|
|
|
|
|
$cpp_source_subgroup ); |
253
|
17
|
|
|
|
|
58
|
$cpp_source_group->{CPP} .= $operator_void_named->{children}->[2]; # semicolon |
254
|
|
|
|
|
|
|
} |
255
|
|
|
|
|
|
|
else { |
256
|
0
|
|
|
|
|
0
|
die RPerl::Parser::rperl_rule__replace( |
257
|
|
|
|
|
|
|
'ERROR ECOGEASCP00, CODE GENERATOR, ABSTRACT SYNTAX TO C++: Grammar rule ' |
258
|
|
|
|
|
|
|
. ( ref $operator_void_named ) |
259
|
|
|
|
|
|
|
. ' found where OperatorVoid_131, OperatorVoid_132, or OperatorVoid_133 expected, dying' |
260
|
|
|
|
|
|
|
) . "\n"; |
261
|
|
|
|
|
|
|
} |
262
|
|
|
|
|
|
|
|
263
|
38
|
|
|
|
|
91
|
$cpp_source_group->{CPP} .= "\n"; |
264
|
38
|
|
|
|
|
112
|
return $cpp_source_group; |
265
|
|
|
|
|
|
|
} |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
1; # end of class |