line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# [[[ HEADER ]]] |
2
|
|
|
|
|
|
|
package RPerl::DataStructure::Hash::Reference; |
3
|
9
|
|
|
9
|
|
56
|
use strict; |
|
9
|
|
|
|
|
18
|
|
|
9
|
|
|
|
|
300
|
|
4
|
9
|
|
|
9
|
|
46
|
use warnings; |
|
9
|
|
|
|
|
22
|
|
|
9
|
|
|
|
|
493
|
|
5
|
9
|
|
|
9
|
|
48
|
use RPerl::AfterSubclass; |
|
9
|
|
|
|
|
19
|
|
|
9
|
|
|
|
|
1273
|
|
6
|
|
|
|
|
|
|
our $VERSION = 0.003_000; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# [[[ OO INHERITANCE ]]] |
9
|
9
|
|
|
9
|
|
59
|
use parent qw(RPerl::DataType::Modifier::Reference); |
|
9
|
|
|
|
|
18
|
|
|
9
|
|
|
|
|
49
|
|
10
|
9
|
|
|
9
|
|
1030
|
use RPerl::DataType::Modifier::Reference; |
|
9
|
|
|
|
|
20
|
|
|
9
|
|
|
|
|
205
|
|
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
|
|
|
|
|
|
|
# [[[ INCLUDES ]]] |
18
|
|
|
|
|
|
|
# DEV NOTE: must pre-declare string_hashref::method and object types here, because this file appears on a lower line number in rperltypes.pm |
19
|
|
|
|
|
|
|
#require RPerl::CodeBlock::Subroutine::Method; |
20
|
|
|
|
|
|
|
package # hide from PAUSE indexing |
21
|
|
|
|
|
|
|
string_hashref::method; |
22
|
9
|
|
|
9
|
|
39
|
use strict; |
|
9
|
|
|
|
|
18
|
|
|
9
|
|
|
|
|
149
|
|
23
|
9
|
|
|
9
|
|
40
|
use warnings; |
|
9
|
|
|
|
|
18
|
|
|
9
|
|
|
|
|
257
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
#require RPerl::Object; |
26
|
|
|
|
|
|
|
package # hide from PAUSE indexing |
27
|
|
|
|
|
|
|
object; |
28
|
9
|
|
|
9
|
|
43
|
use strict; |
|
9
|
|
|
|
|
20
|
|
|
9
|
|
|
|
|
140
|
|
29
|
9
|
|
|
9
|
|
39
|
use warnings; |
|
9
|
|
|
|
|
22
|
|
|
9
|
|
|
|
|
229
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
package RPerl::DataStructure::Hash::Reference; |
32
|
9
|
|
|
9
|
|
41
|
use strict; |
|
9
|
|
|
|
|
20
|
|
|
9
|
|
|
|
|
163
|
|
33
|
9
|
|
|
9
|
|
40
|
use warnings; |
|
9
|
|
|
0
|
|
19
|
|
|
9
|
|
|
|
|
5448
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# [[[ OO PROPERTIES ]]] |
36
|
|
|
|
|
|
|
our hashref $properties = {}; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# [[[ SUBROUTINES & OO METHODS ]]] |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
our string_hashref::method $ast_to_rperl__generate = sub { |
41
|
|
|
|
|
|
|
( my object $self, my string_hashref $modes) = @_; |
42
|
|
|
|
|
|
|
my string_hashref $rperl_source_group = { PMC => q{} }; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# RPerl::diag( 'in Hash::Reference->ast_to_rperl__generate(), received $self = ' . "\n" . RPerl::Parser::rperl_ast__dump($self) . "\n" ); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
my string $self_class = ref $self; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
# unwrap HashReference_211 & HashReference_212 from SubExpression_141 |
49
|
|
|
|
|
|
|
if ( $self_class eq 'SubExpression_141' ) { |
50
|
|
|
|
|
|
|
$self = $self->{children}->[0]; |
51
|
|
|
|
|
|
|
$self_class = ref $self; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
if ( $self_class eq 'HashReference_211' ) { # HashReference -> LBRACE HashEntry STAR-50 '}' |
55
|
|
|
|
|
|
|
my string $left_brace = $self->{children}->[0]; |
56
|
|
|
|
|
|
|
my object $hash_entry = $self->{children}->[1]; |
57
|
|
|
|
|
|
|
my object $hash_entries_star = $self->{children}->[2]; |
58
|
|
|
|
|
|
|
my string $right_brace = $self->{children}->[3]; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
$rperl_source_group->{PMC} .= $left_brace; |
61
|
|
|
|
|
|
|
my string_hashref $rperl_source_subgroup |
62
|
|
|
|
|
|
|
= $hash_entry->ast_to_rperl__generate($modes); |
63
|
|
|
|
|
|
|
RPerl::Generator::source_group_append( $rperl_source_group, |
64
|
|
|
|
|
|
|
$rperl_source_subgroup ); |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
foreach my $hash_entry_star ( @{ $hash_entries_star->{children} } ) { |
67
|
|
|
|
|
|
|
if ( ref $hash_entry_star eq 'TERMINAL' ) { |
68
|
|
|
|
|
|
|
if ( $hash_entry_star->{attr} ne q{,} ) { |
69
|
|
|
|
|
|
|
die RPerl::Parser::rperl_rule__replace( |
70
|
|
|
|
|
|
|
q{ERROR ECOGEASRP00, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL: Grammar rule '} |
71
|
|
|
|
|
|
|
. $hash_entry_star->{attr} |
72
|
|
|
|
|
|
|
. q{' found where OP21_LIST_COMMA ',' expected, dying} |
73
|
|
|
|
|
|
|
) . "\n"; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
$rperl_source_group->{PMC} |
76
|
|
|
|
|
|
|
.= $hash_entry_star->{attr} . q{ }; # OP21_LIST_COMMA |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
else { |
79
|
|
|
|
|
|
|
$rperl_source_subgroup |
80
|
|
|
|
|
|
|
= $hash_entry_star->ast_to_rperl__generate($modes); |
81
|
|
|
|
|
|
|
RPerl::Generator::source_group_append( $rperl_source_group, |
82
|
|
|
|
|
|
|
$rperl_source_subgroup ); |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
$rperl_source_group->{PMC} .= $right_brace; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
elsif ( $self_class eq 'HashReference_212' ) { # HashReference -> LBRACE '}' |
89
|
|
|
|
|
|
|
my string $left_brace = $self->{children}->[0]; |
90
|
|
|
|
|
|
|
my string $right_brace = $self->{children}->[1]; |
91
|
|
|
|
|
|
|
$rperl_source_group->{PMC} .= $left_brace . $right_brace; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
else { |
94
|
|
|
|
|
|
|
die RPerl::Parser::rperl_rule__replace( |
95
|
|
|
|
|
|
|
'ERROR ECOGEASRP00, CODE GENERATOR, ABSTRACT SYNTAX TO RPERL: Grammar rule ' |
96
|
|
|
|
|
|
|
. ($self_class) |
97
|
|
|
|
|
|
|
. ' found where HashReference_211, HashReference_212, or SubExpression_141 expected, dying' |
98
|
|
|
|
|
|
|
) . "\n"; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
return $rperl_source_group; |
102
|
|
|
|
|
|
|
}; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
our string_hashref::method $ast_to_cpp__generate__CPPOPS_PERLTYPES = sub { |
105
|
|
|
|
|
|
|
( my object $self, my string_hashref $modes) = @_; |
106
|
|
|
|
|
|
|
my string_hashref $cpp_source_group |
107
|
|
|
|
|
|
|
= { |
108
|
|
|
|
|
|
|
CPP => q{// <<< RP::DS::H::R __DUMMY_SOURCE_CODE CPPOPS_PERLTYPES >>>} |
109
|
|
|
|
|
|
|
. "\n" |
110
|
|
|
|
|
|
|
}; |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
#... |
113
|
|
|
|
|
|
|
return $cpp_source_group; |
114
|
|
|
|
|
|
|
}; |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
our string_hashref::method $ast_to_cpp__generate__CPPOPS_CPPTYPES = sub { |
117
|
|
|
|
|
|
|
( my object $self, my string_hashref $modes) = @_; |
118
|
|
|
|
|
|
|
my string_hashref $cpp_source_group = { CPP => q{} }; |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
# RPerl::diag( 'in Hash::Reference->ast_to_cpp__generate__CPPOPS_CPPTYPES(), received $self = ' . "\n" . RPerl::Parser::rperl_ast__dump($self) . "\n" ); |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
my string $self_class = ref $self; |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
# unwrap HashReference_211 & HashReference_212 from SubExpression_141 |
125
|
|
|
|
|
|
|
if ( $self_class eq 'SubExpression_141' ) { |
126
|
|
|
|
|
|
|
$self = $self->{children}->[0]; |
127
|
|
|
|
|
|
|
$self_class = ref $self; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
if ( $self_class eq 'HashReference_211' ) { # HashReference -> LBRACE HashEntry STAR-50 '}' |
131
|
|
|
|
|
|
|
my object $hash_entry = $self->{children}->[1]; |
132
|
|
|
|
|
|
|
my object $hash_entries_star = $self->{children}->[2]; |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
$cpp_source_group->{CPP} .= '{ '; |
135
|
|
|
|
|
|
|
my string_hashref $cpp_source_subgroup |
136
|
|
|
|
|
|
|
= $hash_entry->ast_to_cpp__generate__CPPOPS_CPPTYPES($modes); |
137
|
|
|
|
|
|
|
RPerl::Generator::source_group_append( $cpp_source_group, |
138
|
|
|
|
|
|
|
$cpp_source_subgroup ); |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
foreach my $hash_entry_star ( @{ $hash_entries_star->{children} } ) { |
141
|
|
|
|
|
|
|
if ( ref $hash_entry_star eq 'TERMINAL' ) { |
142
|
|
|
|
|
|
|
if ( $hash_entry_star->{attr} ne q{,} ) { |
143
|
|
|
|
|
|
|
die RPerl::Parser::rperl_rule__replace( |
144
|
|
|
|
|
|
|
q{ERROR ECOGEASCP00, CODE GENERATOR, ABSTRACT SYNTAX TO C++: Grammar rule '} |
145
|
|
|
|
|
|
|
. $hash_entry_star->{attr} |
146
|
|
|
|
|
|
|
. q{' found where OP21_LIST_COMMA ',' expected, dying} |
147
|
|
|
|
|
|
|
) . "\n"; |
148
|
|
|
|
|
|
|
} |
149
|
|
|
|
|
|
|
$cpp_source_group->{CPP} |
150
|
|
|
|
|
|
|
.= $hash_entry_star->{attr} . q{ }; # OP21_LIST_COMMA |
151
|
|
|
|
|
|
|
} |
152
|
|
|
|
|
|
|
else { |
153
|
|
|
|
|
|
|
$cpp_source_subgroup |
154
|
|
|
|
|
|
|
= $hash_entry_star->ast_to_cpp__generate__CPPOPS_CPPTYPES($modes); |
155
|
|
|
|
|
|
|
RPerl::Generator::source_group_append( $cpp_source_group, |
156
|
|
|
|
|
|
|
$cpp_source_subgroup ); |
157
|
|
|
|
|
|
|
} |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
$cpp_source_group->{CPP} .= ' }'; |
161
|
|
|
|
|
|
|
} |
162
|
|
|
|
|
|
|
elsif ( $self_class eq 'HashReference_212' ) { # HashReference -> LBRACE '}' |
163
|
|
|
|
|
|
|
$cpp_source_group->{CPP} .= '{}'; |
164
|
|
|
|
|
|
|
} |
165
|
|
|
|
|
|
|
else { |
166
|
|
|
|
|
|
|
die RPerl::Parser::rperl_rule__replace( |
167
|
|
|
|
|
|
|
'ERROR ECOGEASCP00, CODE GENERATOR, ABSTRACT SYNTAX TO C++: Grammar rule ' |
168
|
|
|
|
|
|
|
. ($self_class) |
169
|
|
|
|
|
|
|
. ' found where HashReference_211, HashReference_212, or SubExpression_141 expected, dying' |
170
|
|
|
|
|
|
|
) . "\n"; |
171
|
|
|
|
|
|
|
} |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
return $cpp_source_group; |
174
|
|
|
|
|
|
|
}; |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
1; # end of class |