line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# [[[ HEADER ]]] |
2
|
|
|
|
|
|
|
package RPerl::Operation::Expression::SubroutineCall; |
3
|
4
|
|
|
4
|
|
21
|
use strict; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
93
|
|
4
|
4
|
|
|
4
|
|
18
|
use warnings; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
77
|
|
5
|
4
|
|
|
4
|
|
16
|
use RPerl::AfterSubclass; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
480
|
|
6
|
|
|
|
|
|
|
our $VERSION = 0.002_100; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# [[[ OO INHERITANCE ]]] |
9
|
4
|
|
|
4
|
|
26
|
use parent qw(RPerl::Operation::Expression); |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
20
|
|
10
|
4
|
|
|
4
|
|
218
|
use RPerl::Operation::Expression; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
1628
|
|
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
|
503
|
|
|
503
|
|
886
|
{ my string_hashref::method $RETURN_TYPE }; |
|
503
|
|
|
|
|
1087
|
|
23
|
503
|
|
|
|
|
1135
|
( my object $self, my string_hashref $modes) = @ARG; |
24
|
503
|
|
|
|
|
1599
|
my string_hashref $rperl_source_group = { PMC => q{} }; |
25
|
503
|
|
|
|
|
1222
|
my string_hashref $rperl_source_subgroup; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# RPerl::diag( 'in SubroutineCall->ast_to_rperl__generate(), received $self = ' . "\n" . RPerl::Parser::rperl_ast__dump($self) . "\n" ); |
28
|
|
|
|
|
|
|
|
29
|
503
|
50
|
|
|
|
1879
|
if ( ( ref $self ) ne 'Expression_146' ) { |
30
|
0
|
|
|
|
|
0
|
die RPerl::Parser::rperl_rule__replace( |
31
|
|
|
|
|
|
|
'ERROR ECOGEASRP00, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL: Grammar rule ' |
32
|
|
|
|
|
|
|
. ( ref $self ) |
33
|
|
|
|
|
|
|
. ' found where Expression_146 expected, dying' ) |
34
|
|
|
|
|
|
|
. "\n"; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# Expression -> WordScoped LPAREN OPTIONAL-33 ')' |
38
|
503
|
|
|
|
|
1582
|
my object $name = $self->{children}->[0]; |
39
|
503
|
|
|
|
|
1197
|
my string $left_paren = $self->{children}->[1]; |
40
|
503
|
|
|
|
|
1113
|
my object $arguments_optional = $self->{children}->[2]; |
41
|
503
|
|
|
|
|
1116
|
my string $right_paren = $self->{children}->[3]; |
42
|
|
|
|
|
|
|
$rperl_source_group->{PMC} |
43
|
503
|
|
|
|
|
2051
|
.= $name->{children}->[0] . $left_paren; |
44
|
|
|
|
|
|
|
|
45
|
503
|
100
|
|
|
|
1764
|
if ( exists $arguments_optional->{children}->[0] ) { |
46
|
453
|
|
|
|
|
9582
|
$rperl_source_subgroup = $arguments_optional->{children}->[0] |
47
|
|
|
|
|
|
|
->ast_to_rperl__generate($modes); |
48
|
453
|
|
|
|
|
8961
|
RPerl::Generator::source_group_append( $rperl_source_group, |
49
|
|
|
|
|
|
|
$rperl_source_subgroup ); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
503
|
|
|
|
|
1299
|
$rperl_source_group->{PMC} .= $right_paren; |
53
|
503
|
|
|
|
|
3089
|
return $rperl_source_group; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub ast_to_cpp__generate__CPPOPS_PERLTYPES { |
57
|
0
|
|
|
0
|
|
0
|
{ my string_hashref::method $RETURN_TYPE }; |
|
0
|
|
|
|
|
0
|
|
58
|
0
|
|
|
|
|
0
|
( my object $self, my string_hashref $modes) = @ARG; |
59
|
0
|
|
|
|
|
0
|
my string_hashref $cpp_source_group |
60
|
|
|
|
|
|
|
= { |
61
|
|
|
|
|
|
|
CPP => q{// <<< RP::O::E::SC __DUMMY_SOURCE_CODE CPPOPS_PERLTYPES >>>} |
62
|
|
|
|
|
|
|
. "\n" |
63
|
|
|
|
|
|
|
}; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
#... |
66
|
0
|
|
|
|
|
0
|
return $cpp_source_group; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub ast_to_cpp__generate__CPPOPS_CPPTYPES { |
70
|
13
|
|
|
13
|
|
32
|
{ my string_hashref::method $RETURN_TYPE }; |
|
13
|
|
|
|
|
30
|
|
71
|
13
|
|
|
|
|
38
|
( my object $self, my string_hashref $modes) = @ARG; |
72
|
13
|
|
|
|
|
55
|
my string_hashref $cpp_source_group = { CPP => q{} }; |
73
|
13
|
|
|
|
|
26
|
my string_hashref $cpp_source_subgroup; |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
# RPerl::diag( 'in SubroutineCall->ast_to_cpp__generate__CPPOPS_CPPTYPES(), received $self = ' . "\n" . RPerl::Parser::rperl_ast__dump($self) . "\n" ); |
76
|
|
|
|
|
|
|
|
77
|
13
|
50
|
|
|
|
59
|
if ( ( ref $self ) ne 'Expression_146' ) { |
78
|
0
|
|
|
|
|
0
|
die RPerl::Parser::rperl_rule__replace( |
79
|
|
|
|
|
|
|
'ERROR ECOGEASCP00, CODE GENERATOR, ABSTRACT SYNTAX TO C++: Grammar rule ' |
80
|
|
|
|
|
|
|
. ( ref $self ) |
81
|
|
|
|
|
|
|
. ' found where Expression_146 expected, dying' ) |
82
|
|
|
|
|
|
|
. "\n"; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
# Expression -> WordScoped LPAREN OPTIONAL-33 ')' |
86
|
13
|
|
|
|
|
51
|
my object $name = $self->{children}->[0]; |
87
|
13
|
|
|
|
|
37
|
my string $left_paren = $self->{children}->[1]; |
88
|
13
|
|
|
|
|
28
|
my object $arguments_optional = $self->{children}->[2]; |
89
|
13
|
|
|
|
|
34
|
my string $right_paren = $self->{children}->[3]; |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
# remove leading double-colon scope operator '::' |
92
|
13
|
|
|
|
|
47
|
my string $name_string = $name->{children}->[0]; |
93
|
13
|
50
|
|
|
|
54
|
if ((substr $name_string, 0, 2) eq '::') { |
94
|
0
|
|
|
|
|
0
|
substr $name_string, 0, 2, ''; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
# replace RPerl system builtin functions with proper C++ name alternatives |
98
|
13
|
50
|
|
|
|
52
|
if (exists $rperloperations::BUILTINS->{$name_string}) { |
99
|
0
|
|
|
|
|
0
|
$name_string = $rperloperations::BUILTINS->{$name_string}; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
# replace all semicolons with underscores |
103
|
13
|
|
|
|
|
50
|
$name_string =~ s/:/_/gxms; |
104
|
|
|
|
|
|
|
|
105
|
13
|
|
|
|
|
42
|
$cpp_source_group->{CPP} .= $name_string . $left_paren; |
106
|
|
|
|
|
|
|
|
107
|
13
|
100
|
|
|
|
55
|
if ( exists $arguments_optional->{children}->[0] ) { |
108
|
12
|
|
|
|
|
291
|
$cpp_source_subgroup = $arguments_optional->{children}->[0] |
109
|
|
|
|
|
|
|
->ast_to_cpp__generate__CPPOPS_CPPTYPES($modes); |
110
|
12
|
|
|
|
|
234
|
RPerl::Generator::source_group_append( $cpp_source_group, |
111
|
|
|
|
|
|
|
$cpp_source_subgroup ); |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
13
|
|
|
|
|
29
|
$cpp_source_group->{CPP} .= $right_paren; |
115
|
13
|
|
|
|
|
100
|
return $cpp_source_group; |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
1; # end of class |