line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# Interface Definition Language (OMG IDL CORBA v3.0) |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# IDL to Java Language Mapping Specification, Version 1.2 August 2002 |
6
|
|
|
|
|
|
|
# |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package CORBA::JAVA::LiteralVisitor; |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
40
|
|
11
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
3103
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '2.62'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# needs $node->{java_name} (JavaNameVisitor) for Enum |
16
|
|
|
|
|
|
|
# builds $node->{java_literal} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub new { |
19
|
0
|
|
|
0
|
0
|
|
my $proto = shift; |
20
|
0
|
|
0
|
|
|
|
my $class = ref($proto) || $proto; |
21
|
0
|
|
|
|
|
|
my $self = {}; |
22
|
0
|
|
|
|
|
|
bless $self, $class; |
23
|
0
|
|
|
|
|
|
my ($parser) = @_; |
24
|
0
|
|
|
|
|
|
$self->{key} = 'java_literal'; |
25
|
0
|
|
|
|
|
|
$self->{symbtab} = $parser->YYData->{symbtab}; |
26
|
0
|
|
|
|
|
|
return $self; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub _get_defn { |
30
|
0
|
|
|
0
|
|
|
my $self = shift; |
31
|
0
|
|
|
|
|
|
my ($defn) = @_; |
32
|
0
|
0
|
|
|
|
|
if (ref $defn) { |
33
|
0
|
|
|
|
|
|
return $defn; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
else { |
36
|
0
|
|
|
|
|
|
return $self->{symbtab}->Lookup($defn); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub visitType { |
41
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
42
|
0
|
|
|
|
|
|
my ($type) = @_; |
43
|
|
|
|
|
|
|
|
44
|
0
|
0
|
|
|
|
|
if (ref $type) { |
45
|
0
|
|
|
|
|
|
$type->visit($self); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
else { |
48
|
0
|
|
|
|
|
|
$self->{symbtab}->Lookup($type)->visit($self); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# |
53
|
|
|
|
|
|
|
# 3.5 OMG IDL Specification |
54
|
|
|
|
|
|
|
# |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub visitSpecification { |
57
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
58
|
0
|
|
|
|
|
|
my ($node) = @_; |
59
|
0
|
|
|
|
|
|
foreach (@{$node->{list_export}}) { |
|
0
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
|
$self->{symbtab}->Lookup($_)->visit($self); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# |
65
|
|
|
|
|
|
|
# 3.7 Module Declaration |
66
|
|
|
|
|
|
|
# |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub visitModules { |
69
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
70
|
0
|
|
|
|
|
|
my ($node) = @_; |
71
|
0
|
|
|
|
|
|
foreach (@{$node->{list_export}}) { |
|
0
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
$self->{symbtab}->Lookup($_)->visit($self); |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
# |
77
|
|
|
|
|
|
|
# 3.8 Interface Declaration |
78
|
|
|
|
|
|
|
# |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub visitBaseInterface { |
81
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
82
|
0
|
|
|
|
|
|
my ($node) = @_; |
83
|
0
|
0
|
|
|
|
|
return if (exists $node->{$self->{key}}); |
84
|
0
|
|
|
|
|
|
$node->{$self->{key}} = 1; |
85
|
0
|
|
|
|
|
|
foreach (@{$node->{list_export}}) { |
|
0
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
$self->{symbtab}->Lookup($_)->visit($self); |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
0
|
|
|
0
|
0
|
|
sub visitForwardBaseInterface { |
91
|
|
|
|
|
|
|
# empty |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
# |
95
|
|
|
|
|
|
|
# 3.9 Value Declaration |
96
|
|
|
|
|
|
|
# |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub visitStateMember { |
99
|
0
|
|
|
0
|
0
|
|
shift->visitMember(@_); |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub visitInitializer { |
103
|
0
|
|
|
0
|
0
|
|
shift->visitOperation(@_); |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub visitBoxedValue { |
107
|
0
|
|
|
0
|
0
|
|
shift->visitTypeDeclarator(@_); |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
# |
111
|
|
|
|
|
|
|
# 3.10 Constant Declaration |
112
|
|
|
|
|
|
|
# |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub visitConstant { |
115
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
116
|
0
|
|
|
|
|
|
my ($node) = @_; |
117
|
0
|
|
|
|
|
|
my $defn; |
118
|
0
|
|
|
|
|
|
my $pkg = $node->{full}; |
119
|
0
|
|
|
|
|
|
$pkg =~ s/::[0-9A-Z_a-z]+$//; |
120
|
0
|
0
|
|
|
|
|
$defn = $self->{symbtab}->Lookup($pkg) if ($pkg); |
121
|
0
|
0
|
0
|
|
|
|
if ( defined $defn and $defn->isa('BaseInterface') ) { |
122
|
0
|
|
|
|
|
|
$node->{$self->{key}} = $node->{java_Name}; |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
else { |
125
|
0
|
|
|
|
|
|
$node->{$self->{key}} = $node->{java_Name} . '.value'; |
126
|
|
|
|
|
|
|
} |
127
|
0
|
|
|
|
|
|
$node->{value}->visit($self); # expression |
128
|
0
|
|
|
|
|
|
$self->_get_defn($node->{type})->visit($self); |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
sub _Eval { |
132
|
0
|
|
|
0
|
|
|
my $self = shift; |
133
|
0
|
|
|
|
|
|
my ($list_expr, $type) = @_; |
134
|
0
|
|
|
|
|
|
my $elt = pop @{$list_expr}; |
|
0
|
|
|
|
|
|
|
135
|
0
|
0
|
|
|
|
|
unless (ref $elt) { |
136
|
0
|
|
|
|
|
|
$elt = $self->{symbtab}->Lookup($elt); |
137
|
|
|
|
|
|
|
} |
138
|
0
|
0
|
|
|
|
|
if ( $elt->isa('BinaryOp') ) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
139
|
0
|
|
|
|
|
|
my $right = $self->_Eval($list_expr, $type); |
140
|
0
|
|
|
|
|
|
my $left = $self->_Eval($list_expr, $type); |
141
|
0
|
|
|
|
|
|
return '(' . $left . q{ } . $elt->{op} . q{ } . $right . ')'; |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
elsif ( $elt->isa('UnaryOp') ) { |
144
|
0
|
|
|
|
|
|
my $right = $self->_Eval($list_expr, $type); |
145
|
0
|
|
|
|
|
|
return $elt->{op} . $right; |
146
|
|
|
|
|
|
|
} |
147
|
|
|
|
|
|
|
elsif ( $elt->isa('Constant') ) { |
148
|
0
|
|
|
|
|
|
return $elt->{java_Name}; |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
elsif ( $elt->isa('Enum') ) { |
151
|
0
|
|
|
|
|
|
return $elt->{java_Name}; |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
elsif ( $elt->isa('Literal') ) { |
154
|
0
|
|
|
|
|
|
$elt->visit($self, $type); |
155
|
0
|
|
|
|
|
|
return $elt->{$self->{key}}; |
156
|
|
|
|
|
|
|
} |
157
|
|
|
|
|
|
|
else { |
158
|
0
|
|
|
|
|
|
warn __PACKAGE__,"::_Eval: INTERNAL ERROR ",ref $elt,".\n"; |
159
|
0
|
|
|
|
|
|
return undef; |
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
} |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
sub visitExpression { |
164
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
165
|
0
|
|
|
|
|
|
my ($node) = @_; |
166
|
0
|
|
|
|
|
|
my @list_expr = @{$node->{list_expr}}; # create a copy |
|
0
|
|
|
|
|
|
|
167
|
0
|
|
|
|
|
|
my $type = $node->{type}; |
168
|
0
|
|
|
|
|
|
my $str = $self->_Eval(\@list_expr, $type); |
169
|
0
|
|
|
|
|
|
my $cast = q{}; |
170
|
0
|
0
|
|
|
|
|
if (ref $type) { |
171
|
0
|
|
0
|
|
|
|
while ( $type->isa('TypeDeclarator') |
172
|
|
|
|
|
|
|
and ! exists $type->{array_size} ) { |
173
|
0
|
|
|
|
|
|
$type = $self->_get_defn($type->{type}); |
174
|
|
|
|
|
|
|
} |
175
|
0
|
0
|
|
|
|
|
if ($type->isa('EnumType')) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
176
|
|
|
|
|
|
|
# empty |
177
|
|
|
|
|
|
|
} |
178
|
|
|
|
|
|
|
elsif ($type->{value} eq 'short') { |
179
|
0
|
|
|
|
|
|
$cast = '(short)'; |
180
|
|
|
|
|
|
|
} |
181
|
|
|
|
|
|
|
elsif ($type->{value} eq 'unsigned short') { |
182
|
0
|
|
|
|
|
|
$cast = '(short)'; |
183
|
|
|
|
|
|
|
} |
184
|
|
|
|
|
|
|
elsif ($type->{value} eq 'long') { |
185
|
|
|
|
|
|
|
# empty |
186
|
|
|
|
|
|
|
} |
187
|
|
|
|
|
|
|
elsif ($type->{value} eq 'unsigned long') { |
188
|
|
|
|
|
|
|
# empty |
189
|
|
|
|
|
|
|
} |
190
|
|
|
|
|
|
|
elsif ($type->{value} eq 'long long') { |
191
|
0
|
|
|
|
|
|
$cast = '(long)'; |
192
|
|
|
|
|
|
|
} |
193
|
|
|
|
|
|
|
elsif ($type->{value} eq 'unsigned long long') { |
194
|
0
|
|
|
|
|
|
$cast = '(long)'; |
195
|
|
|
|
|
|
|
} |
196
|
|
|
|
|
|
|
elsif ($type->{value} eq 'octet') { |
197
|
0
|
|
|
|
|
|
$cast = '(byte)'; |
198
|
|
|
|
|
|
|
} |
199
|
|
|
|
|
|
|
} |
200
|
0
|
|
|
|
|
|
$node->{$self->{key}} = $cast . $str; |
201
|
|
|
|
|
|
|
} |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
sub visitIntegerLiteral { |
204
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
205
|
0
|
|
|
|
|
|
my ($node, $type) = @_; |
206
|
0
|
|
|
|
|
|
my $str = $node->{value}; |
207
|
0
|
|
|
|
|
|
$str =~ s/^\+//; |
208
|
0
|
|
|
|
|
|
$node->{$self->{key}} = $str; |
209
|
|
|
|
|
|
|
} |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
sub visitStringLiteral { |
212
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
213
|
0
|
|
|
|
|
|
my ($node) = @_; |
214
|
0
|
|
|
|
|
|
my @list = unpack 'C*', $node->{value}; |
215
|
0
|
|
|
|
|
|
my $str = q{"}; |
216
|
0
|
|
|
|
|
|
foreach (@list) { |
217
|
0
|
0
|
0
|
|
|
|
if ($_ == 10) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
218
|
0
|
|
|
|
|
|
$str .= "\\n"; |
219
|
|
|
|
|
|
|
} |
220
|
|
|
|
|
|
|
elsif ($_ == 13) { |
221
|
0
|
|
|
|
|
|
$str .= "\\r"; |
222
|
|
|
|
|
|
|
} |
223
|
|
|
|
|
|
|
elsif ($_ == 34) { |
224
|
0
|
|
|
|
|
|
$str .= "\\\""; |
225
|
|
|
|
|
|
|
} |
226
|
|
|
|
|
|
|
elsif ($_ < 32 or $_ >= 128) { |
227
|
0
|
|
|
|
|
|
$str .= sprintf "\\u%04x",$_; |
228
|
|
|
|
|
|
|
} |
229
|
|
|
|
|
|
|
else { |
230
|
0
|
|
|
|
|
|
$str .= chr $_; |
231
|
|
|
|
|
|
|
} |
232
|
|
|
|
|
|
|
} |
233
|
0
|
|
|
|
|
|
$str .= q{"}; |
234
|
0
|
|
|
|
|
|
$node->{$self->{key}} = $str; |
235
|
|
|
|
|
|
|
} |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
sub visitWideStringLiteral { |
238
|
0
|
|
|
0
|
0
|
|
shift->visitStringLiteral(@_); |
239
|
|
|
|
|
|
|
} |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
sub visitCharacterLiteral { |
242
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
243
|
0
|
|
|
|
|
|
my ($node) = @_; |
244
|
0
|
|
|
|
|
|
my @list = unpack 'C', $node->{value}; |
245
|
0
|
|
|
|
|
|
my $c = $list[0]; |
246
|
0
|
|
|
|
|
|
my $str = q{'}; |
247
|
0
|
0
|
0
|
|
|
|
if ($c == 10) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
248
|
0
|
|
|
|
|
|
$str .= "\\n"; |
249
|
|
|
|
|
|
|
} |
250
|
|
|
|
|
|
|
elsif ($c == 13) { |
251
|
0
|
|
|
|
|
|
$str .= "\\r"; |
252
|
|
|
|
|
|
|
} |
253
|
|
|
|
|
|
|
elsif ($c == 39) { |
254
|
0
|
|
|
|
|
|
$str .= "\\'"; |
255
|
|
|
|
|
|
|
} |
256
|
|
|
|
|
|
|
elsif ($c < 32 or $c >= 128) { |
257
|
0
|
|
|
|
|
|
$str .= sprintf "\\u%04x",$c; |
258
|
|
|
|
|
|
|
} |
259
|
|
|
|
|
|
|
else { |
260
|
0
|
|
|
|
|
|
$str .= chr $c; |
261
|
|
|
|
|
|
|
} |
262
|
0
|
|
|
|
|
|
$str .= q{'}; |
263
|
0
|
|
|
|
|
|
$node->{$self->{key}} = $str; |
264
|
|
|
|
|
|
|
} |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
sub visitWideCharacterLiteral { |
267
|
0
|
|
|
0
|
0
|
|
shift->visitCharacterLiteral(@_); |
268
|
|
|
|
|
|
|
} |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
sub visitFixedPtLiteral { |
271
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
272
|
0
|
|
|
|
|
|
my ($node) = @_; |
273
|
0
|
|
|
|
|
|
my $str = q{"}; |
274
|
0
|
|
|
|
|
|
$str .= $node->{value}; |
275
|
0
|
|
|
|
|
|
$str .= q{"}; |
276
|
0
|
|
|
|
|
|
$node->{$self->{key}} = $str; |
277
|
|
|
|
|
|
|
} |
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
sub visitFloatingPtLiteral { |
280
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
281
|
0
|
|
|
|
|
|
my ($node, $type) = @_; |
282
|
0
|
|
|
|
|
|
my $str = $node->{value}; |
283
|
0
|
0
|
|
|
|
|
if ( $type->{value} eq 'float' ) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
284
|
0
|
|
|
|
|
|
$str .= 'f'; |
285
|
|
|
|
|
|
|
} |
286
|
|
|
|
|
|
|
elsif ( $type->{value} eq 'double' ) { |
287
|
0
|
|
|
|
|
|
$str .= 'd'; |
288
|
|
|
|
|
|
|
} |
289
|
|
|
|
|
|
|
elsif ( $type->{value} eq 'long double' ) { |
290
|
0
|
|
|
|
|
|
$str .= 'd'; |
291
|
|
|
|
|
|
|
} |
292
|
0
|
|
|
|
|
|
$node->{$self->{key}} = $str; |
293
|
|
|
|
|
|
|
} |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
sub visitBooleanLiteral { |
296
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
297
|
0
|
|
|
|
|
|
my ($node) = @_; |
298
|
0
|
0
|
|
|
|
|
if ($node->{value} eq 'TRUE') { |
299
|
0
|
|
|
|
|
|
$node->{$self->{key}} = 'true'; |
300
|
|
|
|
|
|
|
} |
301
|
|
|
|
|
|
|
else { |
302
|
0
|
|
|
|
|
|
$node->{$self->{key}} = 'false'; |
303
|
|
|
|
|
|
|
} |
304
|
|
|
|
|
|
|
} |
305
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
# |
307
|
|
|
|
|
|
|
# 3.11 Type Declaration |
308
|
|
|
|
|
|
|
# |
309
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
sub visitTypeDeclarator { |
311
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
312
|
0
|
|
|
|
|
|
my ($node) = @_; |
313
|
0
|
|
|
|
|
|
$self->visitType($node->{type}); |
314
|
0
|
0
|
|
|
|
|
if (exists $node->{array_size}) { |
315
|
0
|
|
|
|
|
|
foreach (@{$node->{array_size}}) { |
|
0
|
|
|
|
|
|
|
316
|
0
|
|
|
|
|
|
my $str = $_->{value}; |
317
|
0
|
|
|
|
|
|
$str =~ s/^\+//; |
318
|
0
|
|
|
|
|
|
$_->{$self->{key}} = $str; |
319
|
|
|
|
|
|
|
} |
320
|
|
|
|
|
|
|
} |
321
|
|
|
|
|
|
|
} |
322
|
|
|
|
|
|
|
|
323
|
0
|
|
|
0
|
0
|
|
sub visitNativeType { |
324
|
|
|
|
|
|
|
# empty |
325
|
|
|
|
|
|
|
} |
326
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
# |
328
|
|
|
|
|
|
|
# 3.11.1 Basic Types |
329
|
|
|
|
|
|
|
# |
330
|
|
|
|
|
|
|
|
331
|
0
|
|
|
0
|
0
|
|
sub visitBasicType { |
332
|
|
|
|
|
|
|
# empty |
333
|
|
|
|
|
|
|
} |
334
|
|
|
|
|
|
|
|
335
|
0
|
|
|
0
|
0
|
|
sub visitAnyType { |
336
|
|
|
|
|
|
|
# empty |
337
|
|
|
|
|
|
|
} |
338
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
# |
340
|
|
|
|
|
|
|
# 3.11.2 Constructed Types |
341
|
|
|
|
|
|
|
# |
342
|
|
|
|
|
|
|
# 3.11.2.1 Structures |
343
|
|
|
|
|
|
|
# |
344
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
sub visitStructType { |
346
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
347
|
0
|
|
|
|
|
|
my ($node) = @_; |
348
|
0
|
0
|
|
|
|
|
return if (exists $node->{$self->{key}}); |
349
|
0
|
|
|
|
|
|
$node->{$self->{key}} = 1; |
350
|
0
|
|
|
|
|
|
foreach (@{$node->{list_member}}) { |
|
0
|
|
|
|
|
|
|
351
|
0
|
|
|
|
|
|
$self->visitType($_); # member |
352
|
|
|
|
|
|
|
} |
353
|
|
|
|
|
|
|
} |
354
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
sub visitMember { |
356
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
357
|
0
|
|
|
|
|
|
my ($node) = @_; |
358
|
0
|
|
|
|
|
|
$self->visitType($node->{type}); |
359
|
0
|
0
|
|
|
|
|
if (exists $node->{array_size}) { |
360
|
0
|
|
|
|
|
|
foreach (@{$node->{array_size}}) { |
|
0
|
|
|
|
|
|
|
361
|
0
|
|
|
|
|
|
my $str = $_->{value}; |
362
|
0
|
|
|
|
|
|
$str =~ s/^\+//; |
363
|
0
|
|
|
|
|
|
$_->{$self->{key}} = $str; |
364
|
|
|
|
|
|
|
} |
365
|
|
|
|
|
|
|
} |
366
|
|
|
|
|
|
|
} |
367
|
|
|
|
|
|
|
|
368
|
|
|
|
|
|
|
# 3.11.2.2 Discriminated Unions |
369
|
|
|
|
|
|
|
# |
370
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
sub visitUnionType { |
372
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
373
|
0
|
|
|
|
|
|
my ($node) = @_; |
374
|
0
|
0
|
|
|
|
|
return if (exists $node->{$self->{key}}); |
375
|
0
|
|
|
|
|
|
$node->{$self->{key}} = 1; |
376
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($node->{type}); |
377
|
0
|
|
0
|
|
|
|
while ( $type->isa('TypeDeclarator') |
378
|
|
|
|
|
|
|
and ! exists $type->{array_size} ) { |
379
|
0
|
|
|
|
|
|
$type = $self->_get_defn($type->{type}); |
380
|
|
|
|
|
|
|
} |
381
|
0
|
|
|
|
|
|
$self->visitType($type); |
382
|
0
|
|
|
|
|
|
foreach (@{$node->{list_expr}}) { |
|
0
|
|
|
|
|
|
|
383
|
0
|
|
|
|
|
|
$_->visit($self, $type); # case |
384
|
|
|
|
|
|
|
} |
385
|
|
|
|
|
|
|
} |
386
|
|
|
|
|
|
|
|
387
|
|
|
|
|
|
|
sub visitCase { |
388
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
389
|
0
|
|
|
|
|
|
my ($node, $type) = @_; |
390
|
0
|
|
|
|
|
|
foreach (@{$node->{list_label}}) { |
|
0
|
|
|
|
|
|
|
391
|
0
|
0
|
0
|
|
|
|
if ($type->isa('EnumType') and $_->isa('Expression')) { |
392
|
0
|
|
|
|
|
|
$_->{$self->{key}} = $type->{java_Name} . '._' . $_->{value}->{java_name}; |
393
|
|
|
|
|
|
|
} |
394
|
|
|
|
|
|
|
else { |
395
|
0
|
|
|
|
|
|
$_->visit($self); # default or expression |
396
|
|
|
|
|
|
|
} |
397
|
|
|
|
|
|
|
} |
398
|
0
|
|
|
|
|
|
$node->{element}->visit($self); # member |
399
|
|
|
|
|
|
|
} |
400
|
|
|
|
|
|
|
|
401
|
0
|
|
|
0
|
0
|
|
sub visitDefault { |
402
|
|
|
|
|
|
|
# empty |
403
|
|
|
|
|
|
|
} |
404
|
|
|
|
|
|
|
|
405
|
|
|
|
|
|
|
sub visitElement { |
406
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
407
|
0
|
|
|
|
|
|
my ($node) = @_; |
408
|
0
|
|
|
|
|
|
$self->visitType($node->{value}); # member |
409
|
|
|
|
|
|
|
} |
410
|
|
|
|
|
|
|
|
411
|
|
|
|
|
|
|
# 3.11.2.4 Enumerations |
412
|
|
|
|
|
|
|
# |
413
|
|
|
|
|
|
|
|
414
|
|
|
|
|
|
|
sub visitEnumType { |
415
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
416
|
0
|
|
|
|
|
|
my ($node) = @_; |
417
|
0
|
|
|
|
|
|
foreach (@{$node->{list_expr}}) { |
|
0
|
|
|
|
|
|
|
418
|
0
|
|
|
|
|
|
$_->visit($self); # enum |
419
|
|
|
|
|
|
|
} |
420
|
|
|
|
|
|
|
} |
421
|
|
|
|
|
|
|
|
422
|
|
|
|
|
|
|
sub visitEnum { |
423
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
424
|
0
|
|
|
|
|
|
my ($node) = @_; |
425
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($node->{type}); |
426
|
0
|
|
|
|
|
|
$node->{$self->{key}} = $type->{java_Name} . '.' . $node->{java_name}; |
427
|
|
|
|
|
|
|
} |
428
|
|
|
|
|
|
|
|
429
|
|
|
|
|
|
|
# |
430
|
|
|
|
|
|
|
# 3.11.3 Template Types |
431
|
|
|
|
|
|
|
# |
432
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
sub visitSequenceType { |
434
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
435
|
0
|
|
|
|
|
|
my ($node) = @_; |
436
|
0
|
|
|
|
|
|
$self->visitType($node->{type}); |
437
|
0
|
0
|
|
|
|
|
$node->{max}->visit($self) if (exists $node->{max}); |
438
|
|
|
|
|
|
|
} |
439
|
|
|
|
|
|
|
|
440
|
|
|
|
|
|
|
sub visitStringType { |
441
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
442
|
0
|
|
|
|
|
|
my ($node) = @_; |
443
|
0
|
0
|
|
|
|
|
$node->{max}->visit($self) if (exists $node->{max}); |
444
|
|
|
|
|
|
|
} |
445
|
|
|
|
|
|
|
|
446
|
|
|
|
|
|
|
sub visitWideStringType { |
447
|
0
|
|
|
0
|
0
|
|
shift->visitStringType(@_); |
448
|
|
|
|
|
|
|
} |
449
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
sub visitFixedPtType { |
451
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
452
|
0
|
|
|
|
|
|
my ($node) = @_; |
453
|
0
|
|
|
|
|
|
$node->{d}->visit($self); |
454
|
0
|
|
|
|
|
|
$node->{s}->visit($self); |
455
|
|
|
|
|
|
|
} |
456
|
|
|
|
|
|
|
|
457
|
0
|
|
|
0
|
0
|
|
sub visitFixedPtConstType { |
458
|
|
|
|
|
|
|
# empty |
459
|
|
|
|
|
|
|
} |
460
|
|
|
|
|
|
|
|
461
|
|
|
|
|
|
|
# |
462
|
|
|
|
|
|
|
# 3.12 Exception Declaration |
463
|
|
|
|
|
|
|
# |
464
|
|
|
|
|
|
|
|
465
|
|
|
|
|
|
|
sub visitException { |
466
|
0
|
|
|
0
|
0
|
|
shift->visitStructType(@_); |
467
|
|
|
|
|
|
|
} |
468
|
|
|
|
|
|
|
|
469
|
|
|
|
|
|
|
# |
470
|
|
|
|
|
|
|
# 3.13 Operation Declaration |
471
|
|
|
|
|
|
|
# |
472
|
|
|
|
|
|
|
|
473
|
|
|
|
|
|
|
sub visitOperation { |
474
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
475
|
0
|
|
|
|
|
|
my ($node) = @_; |
476
|
0
|
0
|
|
|
|
|
$self->visitType($node->{type}) # param_type_spec or void |
477
|
|
|
|
|
|
|
if (exists $node->{type}); # initializer or factory or finder |
478
|
0
|
|
|
|
|
|
foreach (@{$node->{list_param}}) { |
|
0
|
|
|
|
|
|
|
479
|
0
|
|
|
|
|
|
$_->visit($self); # parameter |
480
|
|
|
|
|
|
|
} |
481
|
|
|
|
|
|
|
} |
482
|
|
|
|
|
|
|
|
483
|
|
|
|
|
|
|
sub visitParameter { |
484
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
485
|
0
|
|
|
|
|
|
my ($node) = @_; |
486
|
0
|
|
|
|
|
|
$self->visitType($node->{type}); # param_type_spec |
487
|
|
|
|
|
|
|
} |
488
|
|
|
|
|
|
|
|
489
|
0
|
|
|
0
|
0
|
|
sub visitVoidType { |
490
|
|
|
|
|
|
|
# empty |
491
|
|
|
|
|
|
|
} |
492
|
|
|
|
|
|
|
|
493
|
|
|
|
|
|
|
# |
494
|
|
|
|
|
|
|
# 3.14 Attribute Declaration |
495
|
|
|
|
|
|
|
# |
496
|
|
|
|
|
|
|
|
497
|
|
|
|
|
|
|
sub visitAttribute { |
498
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
499
|
0
|
|
|
|
|
|
my ($node) = @_; |
500
|
0
|
|
|
|
|
|
$self->visitType($node->{type}); # param_type_spec |
501
|
|
|
|
|
|
|
} |
502
|
|
|
|
|
|
|
|
503
|
|
|
|
|
|
|
# |
504
|
|
|
|
|
|
|
# 3.15 Repository Identity Related Declarations |
505
|
|
|
|
|
|
|
# |
506
|
|
|
|
|
|
|
|
507
|
0
|
|
|
0
|
0
|
|
sub visitTypeId { |
508
|
|
|
|
|
|
|
# empty |
509
|
|
|
|
|
|
|
} |
510
|
|
|
|
|
|
|
|
511
|
0
|
|
|
0
|
0
|
|
sub visitTypePrefix { |
512
|
|
|
|
|
|
|
# empty |
513
|
|
|
|
|
|
|
} |
514
|
|
|
|
|
|
|
|
515
|
|
|
|
|
|
|
# |
516
|
|
|
|
|
|
|
# 3.16 Event Declaration |
517
|
|
|
|
|
|
|
# |
518
|
|
|
|
|
|
|
|
519
|
|
|
|
|
|
|
# |
520
|
|
|
|
|
|
|
# 3.17 Component Declaration |
521
|
|
|
|
|
|
|
# |
522
|
|
|
|
|
|
|
|
523
|
0
|
|
|
0
|
0
|
|
sub visitProvides { |
524
|
|
|
|
|
|
|
# empty |
525
|
|
|
|
|
|
|
} |
526
|
|
|
|
|
|
|
|
527
|
0
|
|
|
0
|
0
|
|
sub visitUses { |
528
|
|
|
|
|
|
|
# empty |
529
|
|
|
|
|
|
|
} |
530
|
|
|
|
|
|
|
|
531
|
0
|
|
|
0
|
0
|
|
sub visitPublishes { |
532
|
|
|
|
|
|
|
# empty |
533
|
|
|
|
|
|
|
} |
534
|
|
|
|
|
|
|
|
535
|
0
|
|
|
0
|
0
|
|
sub visitEmits { |
536
|
|
|
|
|
|
|
# empty |
537
|
|
|
|
|
|
|
} |
538
|
|
|
|
|
|
|
|
539
|
0
|
|
|
0
|
0
|
|
sub visitConsumes { |
540
|
|
|
|
|
|
|
# empty |
541
|
|
|
|
|
|
|
} |
542
|
|
|
|
|
|
|
|
543
|
|
|
|
|
|
|
# |
544
|
|
|
|
|
|
|
# 3.18 Home Declaration |
545
|
|
|
|
|
|
|
# |
546
|
|
|
|
|
|
|
|
547
|
|
|
|
|
|
|
sub visitFactory { |
548
|
0
|
|
|
0
|
0
|
|
shift->visitOperation(@_); |
549
|
|
|
|
|
|
|
} |
550
|
|
|
|
|
|
|
|
551
|
|
|
|
|
|
|
sub visitFinder { |
552
|
0
|
|
|
0
|
0
|
|
shift->visitOperation(@_); |
553
|
|
|
|
|
|
|
} |
554
|
|
|
|
|
|
|
|
555
|
|
|
|
|
|
|
1; |
556
|
|
|
|
|
|
|
|