line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
#
|
3
|
|
|
|
|
|
|
# Interface Definition Language (OMG IDL CORBA v3.0)
|
4
|
|
|
|
|
|
|
#
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package CORBA::IDL::ParserFactory;
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
10
|
use strict;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
9
|
1
|
|
|
1
|
|
4
|
use warnings;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '2.60';
|
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
671
|
use CORBA::IDL::Lexer;
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
50
|
|
14
|
1
|
|
|
1
|
|
877
|
use CORBA::IDL::Symbtab;
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
40
|
|
15
|
1
|
|
|
1
|
|
942
|
use CORBA::IDL::Node;
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
11
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub create {
|
18
|
0
|
|
|
0
|
0
|
|
my ($version) = @_;
|
19
|
|
|
|
|
|
|
|
20
|
0
|
0
|
|
|
|
|
$version = '30' unless (defined $version);
|
21
|
0
|
|
|
|
|
|
$version =~ s/\.//g;
|
22
|
0
|
|
|
|
|
|
eval "require CORBA::IDL::Parser$version";
|
23
|
0
|
0
|
|
|
|
|
die $@ if ($@);
|
24
|
0
|
|
|
|
|
|
my $parser = new CORBA::IDL::Parser();
|
25
|
0
|
|
|
|
|
|
$parser->YYData->{verbose_error} = 1; # 0, 1
|
26
|
0
|
|
|
|
|
|
$parser->YYData->{verbose_warning} = 1; # 0, 1
|
27
|
0
|
|
|
|
|
|
$parser->YYData->{verbose_info} = 1; # 0, 1
|
28
|
0
|
|
|
|
|
|
$parser->YYData->{verbose_deprecated} = 0; # 0, 1 (concerns only version '2.4' and upper)
|
29
|
0
|
|
|
|
|
|
$parser->YYData->{collision_allowed} = 0; # 0, 1
|
30
|
0
|
|
|
|
|
|
$parser->YYData->{symbtab} = new CORBA::IDL::Symbtab($parser);
|
31
|
0
|
|
|
|
|
|
return $parser;
|
32
|
|
|
|
|
|
|
}
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
package CORBA::IDL::Parser;
|
35
|
|
|
|
|
|
|
|
36
|
1
|
|
|
1
|
|
162
|
use strict;
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
30
|
|
37
|
1
|
|
|
1
|
|
4
|
use warnings;
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
38
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub getopts { # from Getopt::Std
|
40
|
1
|
|
|
1
|
|
3
|
no strict;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1503
|
|
41
|
0
|
|
|
0
|
|
|
my $parser = shift;
|
42
|
0
|
|
|
|
|
|
local($argumentative) = @_;
|
43
|
0
|
|
|
|
|
|
local(@args, $_, $first, $rest);
|
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
$parser->YYData->{args} = [];
|
46
|
0
|
|
|
|
|
|
@args = split( / */, $argumentative );
|
47
|
0
|
|
0
|
|
|
|
while (@ARGV && ($_ = $ARGV[0]) =~ /^-(.)(.*)/) {
|
48
|
0
|
|
|
|
|
|
($first, $rest) = ($1, $2);
|
49
|
0
|
0
|
|
|
|
|
if (/^--$/) { # early exit if --
|
50
|
0
|
|
|
|
|
|
shift(@ARGV);
|
51
|
0
|
|
|
|
|
|
last;
|
52
|
|
|
|
|
|
|
}
|
53
|
0
|
|
|
|
|
|
$pos = index($argumentative,$first);
|
54
|
0
|
0
|
|
|
|
|
if ($pos >= 0) {
|
55
|
0
|
0
|
0
|
|
|
|
if (defined($args[$pos+1]) and ($args[$pos+1] eq ':')) {
|
56
|
0
|
|
|
|
|
|
shift(@ARGV);
|
57
|
0
|
0
|
|
|
|
|
if ($rest eq q{}) {
|
58
|
0
|
|
|
|
|
|
$rest = shift(@ARGV);
|
59
|
|
|
|
|
|
|
}
|
60
|
0
|
|
|
|
|
|
$parser->YYData->{"opt_$first"} = $rest;
|
61
|
|
|
|
|
|
|
}
|
62
|
|
|
|
|
|
|
else {
|
63
|
0
|
|
|
|
|
|
$parser->YYData->{"opt_$first"} = 1;
|
64
|
0
|
0
|
|
|
|
|
if ($rest eq q{}) {
|
65
|
0
|
|
|
|
|
|
shift(@ARGV);
|
66
|
|
|
|
|
|
|
}
|
67
|
|
|
|
|
|
|
else {
|
68
|
0
|
|
|
|
|
|
$ARGV[0] = "-$rest";
|
69
|
|
|
|
|
|
|
}
|
70
|
|
|
|
|
|
|
}
|
71
|
|
|
|
|
|
|
}
|
72
|
|
|
|
|
|
|
else {
|
73
|
0
|
|
|
|
|
|
push @{$parser->YYData->{args}}, shift(@ARGV);
|
|
0
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
}
|
75
|
|
|
|
|
|
|
}
|
76
|
|
|
|
|
|
|
}
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub Configure {
|
79
|
0
|
|
|
0
|
|
|
my $parser = shift;
|
80
|
0
|
|
|
|
|
|
my %attr = @_;
|
81
|
0
|
|
|
|
|
|
while ( my ($key, $value) = each(%attr) ) {
|
82
|
0
|
0
|
|
|
|
|
if (defined $value) {
|
83
|
0
|
|
|
|
|
|
$parser->YYData->{$key} = $value;
|
84
|
|
|
|
|
|
|
}
|
85
|
|
|
|
|
|
|
}
|
86
|
0
|
|
|
|
|
|
return $parser;
|
87
|
|
|
|
|
|
|
}
|
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub Run {
|
90
|
0
|
|
|
0
|
|
|
my $parser = shift;
|
91
|
0
|
|
|
|
|
|
my $preprocessor = $parser->YYData->{preprocessor};
|
92
|
|
|
|
|
|
|
|
93
|
0
|
0
|
|
|
|
|
if ($preprocessor) {
|
94
|
0
|
|
|
|
|
|
my @args;
|
95
|
0
|
0
|
|
|
|
|
@args = @{$parser->YYData->{args}}
|
|
0
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
if (exists $parser->YYData->{args});
|
97
|
0
|
|
|
|
|
|
push @args, @_;
|
98
|
|
|
|
|
|
|
|
99
|
0
|
0
|
|
|
|
|
open $parser->YYData->{fh}, "$preprocessor @args|"
|
100
|
|
|
|
|
|
|
or die "can't open @_ ($!).\n";
|
101
|
|
|
|
|
|
|
}
|
102
|
|
|
|
|
|
|
else {
|
103
|
0
|
|
|
|
|
|
my $file = shift;
|
104
|
0
|
0
|
|
|
|
|
if (ref $file) {
|
105
|
0
|
|
|
|
|
|
$parser->YYData->{fh} = $file;
|
106
|
0
|
|
|
|
|
|
$parser->YYData->{srcname} = shift;
|
107
|
|
|
|
|
|
|
}
|
108
|
|
|
|
|
|
|
else {
|
109
|
0
|
0
|
|
|
|
|
open $parser->YYData->{fh}, $file
|
110
|
|
|
|
|
|
|
or die "can't open $file ($!).\n";
|
111
|
0
|
|
0
|
|
|
|
$parser->YYData->{srcname} = shift || $file;
|
112
|
|
|
|
|
|
|
}
|
113
|
0
|
|
|
|
|
|
my @st = stat($parser->YYData->{srcname});
|
114
|
0
|
|
|
|
|
|
$parser->YYData->{srcname_size} = $st[7];
|
115
|
0
|
|
|
|
|
|
$parser->YYData->{srcname_mtime} = $st[9];
|
116
|
|
|
|
|
|
|
}
|
117
|
|
|
|
|
|
|
|
118
|
0
|
|
|
|
|
|
CORBA::IDL::Lexer::InitLexico($parser);
|
119
|
0
|
|
|
|
|
|
$parser->YYData->{doc} = q{};
|
120
|
0
|
|
|
|
|
|
$parser->YYData->{curr_node} = undef;
|
121
|
0
|
|
|
|
|
|
$parser->YYData->{curr_itf} = undef;
|
122
|
0
|
|
|
|
|
|
$parser->YYData->{prop} = 0;
|
123
|
0
|
|
|
|
|
|
$parser->YYData->{native} = 0;
|
124
|
|
|
|
|
|
|
$parser->YYParse(
|
125
|
|
|
|
|
|
|
yylex => \&CORBA::IDL::Lexer::Lexer,
|
126
|
0
|
|
|
0
|
|
|
yyerror => sub { return; },
|
127
|
|
|
|
|
|
|
# yydebug => 0x17,
|
128
|
0
|
|
|
|
|
|
);
|
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
# Bit Value Outputs
|
131
|
|
|
|
|
|
|
# 0x01 Token reading (useful for Lexer debugging)
|
132
|
|
|
|
|
|
|
# 0x02 States information
|
133
|
|
|
|
|
|
|
# 0x04 Driver actions (shifts, reduces, accept...)
|
134
|
|
|
|
|
|
|
# 0x08 Parse Stack dump
|
135
|
|
|
|
|
|
|
# 0x10 Error Recovery tracing
|
136
|
|
|
|
|
|
|
|
137
|
0
|
|
|
|
|
|
close $parser->YYData->{fh};
|
138
|
0
|
|
|
|
|
|
delete $parser->{RULES};
|
139
|
0
|
|
|
|
|
|
delete $parser->{STATES};
|
140
|
0
|
|
|
|
|
|
delete $parser->{STACK};
|
141
|
|
|
|
|
|
|
|
142
|
0
|
0
|
|
|
|
|
if (exists $parser->YYData->{symbtab}) {
|
143
|
0
|
|
|
|
|
|
$parser->YYData->{symbtab}->CheckForward();
|
144
|
0
|
|
|
|
|
|
$parser->YYData->{symbtab}->CheckRepositoryID();
|
145
|
|
|
|
|
|
|
}
|
146
|
|
|
|
|
|
|
}
|
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
sub DisplayStatus {
|
149
|
0
|
|
|
0
|
|
|
my $parser = shift;
|
150
|
0
|
0
|
|
|
|
|
if (exists $parser->YYData->{nb_error}) {
|
151
|
0
|
|
|
|
|
|
my $nb = $parser->YYData->{nb_error};
|
152
|
0
|
|
|
|
|
|
print "$nb error(s).\n"
|
153
|
|
|
|
|
|
|
}
|
154
|
0
|
0
|
0
|
|
|
|
if ( $parser->YYData->{verbose_warning}
|
155
|
|
|
|
|
|
|
and exists $parser->YYData->{nb_warning} ) {
|
156
|
0
|
|
|
|
|
|
my $nb = $parser->YYData->{nb_warning};
|
157
|
0
|
|
|
|
|
|
print "$nb warning(s).\n"
|
158
|
|
|
|
|
|
|
}
|
159
|
0
|
0
|
0
|
|
|
|
if ( $parser->YYData->{verbose_info}
|
160
|
|
|
|
|
|
|
and exists $parser->YYData->{nb_info} ) {
|
161
|
0
|
|
|
|
|
|
my $nb = $parser->YYData->{nb_info};
|
162
|
0
|
|
|
|
|
|
print "$nb info(s).\n"
|
163
|
|
|
|
|
|
|
}
|
164
|
0
|
0
|
0
|
|
|
|
if ( $parser->YYData->{verbose_deprecated}
|
165
|
|
|
|
|
|
|
and exists $parser->YYData->{nb_deprecated} ) {
|
166
|
0
|
|
|
|
|
|
my $nb = $parser->YYData->{nb_deprecated};
|
167
|
0
|
|
|
|
|
|
print "$nb deprecated(s).\n"
|
168
|
|
|
|
|
|
|
}
|
169
|
|
|
|
|
|
|
}
|
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
sub Export {
|
172
|
0
|
|
|
0
|
|
|
my $parser = shift;
|
173
|
0
|
0
|
|
|
|
|
if ( our $IDL_VERSION ge '3.0' ) {
|
174
|
0
|
|
|
|
|
|
$parser->YYData->{symbtab}->Export();
|
175
|
|
|
|
|
|
|
}
|
176
|
|
|
|
|
|
|
}
|
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
sub getRoot {
|
179
|
0
|
|
|
0
|
|
|
my $parser = shift;
|
180
|
0
|
0
|
0
|
|
|
|
if ( exists $parser->YYData->{root}
|
181
|
|
|
|
|
|
|
and ! exists $parser->YYData->{nb_error} ) {
|
182
|
0
|
|
|
|
|
|
return $parser->YYData->{root};
|
183
|
|
|
|
|
|
|
}
|
184
|
0
|
|
|
|
|
|
return undef;
|
185
|
|
|
|
|
|
|
}
|
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
sub Error {
|
188
|
0
|
|
|
0
|
|
|
my $parser = shift;
|
189
|
0
|
|
|
|
|
|
my ($msg) = @_;
|
190
|
|
|
|
|
|
|
|
191
|
0
|
|
0
|
|
|
|
$msg ||= "Syntax error.\n";
|
192
|
|
|
|
|
|
|
|
193
|
0
|
0
|
|
|
|
|
if (exists $parser->YYData->{nb_error}) {
|
194
|
0
|
|
|
|
|
|
$parser->YYData->{nb_error} ++;
|
195
|
|
|
|
|
|
|
}
|
196
|
|
|
|
|
|
|
else {
|
197
|
0
|
|
|
|
|
|
$parser->YYData->{nb_error} = 1;
|
198
|
|
|
|
|
|
|
}
|
199
|
|
|
|
|
|
|
|
200
|
0
|
0
|
|
|
|
|
unless (exists $parser->YYData->{filename}) {
|
201
|
0
|
|
|
|
|
|
print STDOUT "#No parsed input : ",$msg;
|
202
|
|
|
|
|
|
|
}
|
203
|
|
|
|
|
|
|
else {
|
204
|
0
|
0
|
0
|
|
|
|
print STDOUT '#',$parser->YYData->{filename},':',$parser->YYData->{lineno},'#Error: ',$msg
|
205
|
|
|
|
|
|
|
if ( exists $parser->YYData->{verbose_error}
|
206
|
|
|
|
|
|
|
and $parser->YYData->{verbose_error});
|
207
|
|
|
|
|
|
|
}
|
208
|
|
|
|
|
|
|
}
|
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
sub Warning {
|
211
|
0
|
|
|
0
|
|
|
my $parser = shift;
|
212
|
0
|
|
|
|
|
|
my ($msg) = @_;
|
213
|
|
|
|
|
|
|
|
214
|
0
|
|
0
|
|
|
|
$msg ||= ".\n";
|
215
|
|
|
|
|
|
|
|
216
|
0
|
0
|
|
|
|
|
if (exists $parser->YYData->{nb_warning}) {
|
217
|
0
|
|
|
|
|
|
$parser->YYData->{nb_warning} ++;
|
218
|
|
|
|
|
|
|
}
|
219
|
|
|
|
|
|
|
else {
|
220
|
0
|
|
|
|
|
|
$parser->YYData->{nb_warning} = 1;
|
221
|
|
|
|
|
|
|
}
|
222
|
|
|
|
|
|
|
|
223
|
0
|
0
|
0
|
|
|
|
print STDOUT '#',$parser->YYData->{filename},':',$parser->YYData->{lineno},'#Warning: ',$msg
|
224
|
|
|
|
|
|
|
if ( exists $parser->YYData->{verbose_warning}
|
225
|
|
|
|
|
|
|
and $parser->YYData->{verbose_warning});
|
226
|
|
|
|
|
|
|
}
|
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
sub Info {
|
229
|
0
|
|
|
0
|
|
|
my $parser = shift;
|
230
|
0
|
|
|
|
|
|
my ($msg) = @_;
|
231
|
|
|
|
|
|
|
|
232
|
0
|
|
0
|
|
|
|
$msg ||= ".\n";
|
233
|
|
|
|
|
|
|
|
234
|
0
|
0
|
|
|
|
|
if (exists $parser->YYData->{nb_info}) {
|
235
|
0
|
|
|
|
|
|
$parser->YYData->{nb_info} ++;
|
236
|
|
|
|
|
|
|
}
|
237
|
|
|
|
|
|
|
else {
|
238
|
0
|
|
|
|
|
|
$parser->YYData->{nb_info} = 1;
|
239
|
|
|
|
|
|
|
}
|
240
|
|
|
|
|
|
|
|
241
|
0
|
0
|
0
|
|
|
|
print STDOUT '#',$parser->YYData->{filename},':',$parser->YYData->{lineno},'#Info: ',$msg
|
242
|
|
|
|
|
|
|
if ( exists $parser->YYData->{verbose_info}
|
243
|
|
|
|
|
|
|
and $parser->YYData->{verbose_info});
|
244
|
|
|
|
|
|
|
}
|
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
sub Deprecated {
|
247
|
0
|
|
|
0
|
|
|
my $parser = shift;
|
248
|
0
|
|
|
|
|
|
my ($msg) = @_;
|
249
|
|
|
|
|
|
|
|
250
|
0
|
|
0
|
|
|
|
$msg ||= ".\n";
|
251
|
|
|
|
|
|
|
|
252
|
0
|
0
|
|
|
|
|
if (exists $parser->YYData->{nb_deprecated}) {
|
253
|
0
|
|
|
|
|
|
$parser->YYData->{nb_deprecated} ++;
|
254
|
|
|
|
|
|
|
}
|
255
|
|
|
|
|
|
|
else {
|
256
|
0
|
|
|
|
|
|
$parser->YYData->{nb_deprecated} = 1;
|
257
|
|
|
|
|
|
|
}
|
258
|
|
|
|
|
|
|
|
259
|
0
|
0
|
0
|
|
|
|
print STDOUT '#',$parser->YYData->{filename},':',$parser->YYData->{lineno},'#Deprecated: ',$msg
|
260
|
|
|
|
|
|
|
if ( exists $parser->YYData->{verbose_deprecated}
|
261
|
|
|
|
|
|
|
and $parser->YYData->{verbose_deprecated});
|
262
|
|
|
|
|
|
|
}
|
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
1;
|
265
|
|
|
|
|
|
|
|