wmls/node.pm

filter: Statementstmt 16.6% 121 / 729 Branchbran 0.0% 0 / 98 Conditioncond 0.0% 0 / 135 MC/DCmcdc 0.0% 0 / 90 Subroutinesub 28.5% 40 / 140 Podpod 0.0% 0 / 11 totaltotal 13.3% 161 / 1203 CC 97 SCAR 23.5
CC
97
Cov
13%
printConst
72.0
_CheckBreakContinue
42.0
visitFunction
30.0
CRAP 10.5
« wmls/gen.pm ↑ Summary wmls/parser.pm »
1 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3
4 #
5 # WMLScript Language Specification Version 1.1
6 #
7
8 package WAP::wmls::node;
9
10 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod undocumented
11 0 my $proto = shift;
12 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
13 0 my $self = {};
14 0 bless $self, $class;
15 0 my ($op) = @_;
16 0 $self->{OpCode} = $op;
17 0 $self->{Next} = undef;
18 0 $self->{Prev} = undef;
19 0 $self->{Last} = $self;
20 0 $self->{Deleted} = 0;
21 0 return $self;
22 }
23
24 0 ▶sub del {
Subroutine del: not called CC=1 SCAR=6.9
Pod undocumented
25 0 my $self = shift;
26 0 $self->{Deleted} = 1;
27 0 $self->{OpCode}->{Deleted} = 1;
28 0 return $self;
29 }
30
31 0 ▶sub configure {
Subroutine configure: not called CC=1 SCAR=6.9
Pod undocumented
32 0 my $self = shift;
33 0 $self->{OpCode}->configure(@_);
34 0 return $self;
35 }
36
37 0 ▶sub concat {
Subroutine concat: not called CC=1 SCAR=6.9
Pod undocumented
38 0 my $node1 = shift;
39 0 my ($node2) = @_;
40 0 $node1->{Last}->{Next} = $node2;
41 0 $node2->{Prev} = $node1->{Last};
42 0 $node1->{Last} = $node2->{Last};
43 0 return $node1;
44 }
45
46 0 ▶sub insert {
Subroutine insert: not called CC=2 SCAR=17.9
Pod undocumented
47 0 my $node1 = shift;
48 0 my ($node2) = @_;
49 0 $node2->{Next} = $node1->{Next};
50 0 $node2->{Prev} = $node1;
51 0 ▶ if (defined $node1->{Next}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $node1->{"Next"}) 0 0 0
52 0 $node1->{Next}->{Prev} = $node2;
53 }
54 0 $node1->{Next} = $node2;
55 0 return;
56 }
57
58 0 ▶sub visit {
Subroutine visit: not called CC=2 SCAR=17.9
Pod undocumented
59 0 my $self = shift;
60 0 my $visitor = shift;
61 0 ▶ for (my $node = $self; defined $node; $node = $node->{Next}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $node) 0 0 0
62 0 my $opcode = $node->{OpCode};
63 0 my $class = ref $opcode;
64 0 my $func = 'visit' . substr($class, rindex($class, ':') + 1);
65 0 $visitor->$func($opcode, @_);
66 }
67 0 return;
68 }
69
70 0 ▶sub visitActive {
Subroutine visitActive: not called CC=3 SCAR=24.8
Pod undocumented
71 0 my $self = shift;
72 0 my $visitor = shift;
73 0 ▶ for (my $node = $self; defined $node; $node = $node->{Next}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $node) 0 0 0
74 0 ▶ next if ($node->{Deleted});
Branch: 1 branch
BranchTrueFalseTotal
if $node->{"Deleted"} 0 0 0
75 0 my $opcode = $node->{OpCode};
76 0 my $class = ref $opcode;
77 0 my $func = 'visit' . substr($class, rindex($class, ':') + 1);
78 0 $visitor->$func($opcode, @_);
79 }
80 0 return;
81 }
82
83 0 ▶sub getFirstActive {
Subroutine getFirstActive: not called CC=3 SCAR=24.8
Pod undocumented
84 0 my $self = shift;
85 0 my $node;
86 0 ▶ for ( $node = $self;
Branch: 1 branch
BranchTrueFalseTotal
if (defined $node and $node->{"Deleted"}) 0 0 0
Condition0%0/3
defined $node and $node->{"Deleted"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $node and $node->{"Deleted"}
defined $node $node->{"Deleted"}
Truth table0%0/3
A and B
A= defined $nodeB= $node->{"Deleted"}
ABresult
0X0
100
111
87 defined($node) and $node->{Deleted};
88 $node = $node->{Next} ) {}
89 0 return $node;
90 }
91
92 0 ▶sub getLastActive {
Subroutine getLastActive: not called CC=4 SCAR=30.0
Pod undocumented
93 0 my $self = shift;
94 0 my $node;
95 0 ▶ for ( $node = $self->{Last};
Branch: 1 branch
BranchTrueFalseTotal
if (defined $node->{"Next"}) 0 0 0
96 defined($node->{Next});
97 $node = $node->{Next} ) {}
98 0 ▶ for ( ;
Branch: 1 branch
BranchTrueFalseTotal
if (defined $node and $node->{"Deleted"}) 0 0 0
Condition0%0/3
defined $node and $node->{"Deleted"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $node and $node->{"Deleted"}
defined $node $node->{"Deleted"}
Truth table0%0/3
A and B
A= defined $nodeB= $node->{"Deleted"}
ABresult
0X0
100
111
99 defined($node) and $node->{Deleted};
100 $node = $node->{Prev} ) {}
101 0 return $node;
102 }
103
104 0 ▶sub getNextActive {
Subroutine getNextActive: not called CC=3 SCAR=24.8
Pod undocumented
105 0 my $self = shift;
106 0 my $node;
107 0 ▶ for ( $node = $self->{Next};
Branch: 1 branch
BranchTrueFalseTotal
if (defined $node and $node->{"Deleted"}) 0 0 0
Condition0%0/3
defined $node and $node->{"Deleted"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $node and $node->{"Deleted"}
defined $node $node->{"Deleted"}
Truth table0%0/3
A and B
A= defined $nodeB= $node->{"Deleted"}
ABresult
0X0
100
111
108 defined($node) and $node->{Deleted};
109 $node = $node->{Next} ) {}
110 0 return $node;
111 }
112
113 0 ▶sub getPrevActive {
Subroutine getPrevActive: not called CC=3 SCAR=24.8
Pod undocumented
114 0 my $self = shift;
115 0 my $node;
116 0 ▶ for ( $node = $self->{Prev};
Branch: 1 branch
BranchTrueFalseTotal
if (defined $node and $node->{"Deleted"}) 0 0 0
Condition0%0/3
defined $node and $node->{"Deleted"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $node and $node->{"Deleted"}
defined $node $node->{"Deleted"}
Truth table0%0/3
A and B
A= defined $nodeB= $node->{"Deleted"}
ABresult
0X0
100
111
117 defined $node and $node->{Deleted};
118 $node = $node->{Prev} ) {}
119 0 return $node;
120 }
121
122 ###############################################################################
123
124 package WAP::wmls::OpCode;
125
126 0 ▶sub new {
Subroutine new: not called CC=4 SCAR=30.0
127 0 my $proto = shift;
128 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
129 0 my $parser = shift;
130 0 my %attr = @_;
131 0 my $self = \%attr;
132 0 foreach (keys %attr) {
133 0 ▶ unless (defined $self->{$_}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{$_}) 0 0 0
134 0 delete $self->{$_};
135 }
136 }
137 0 $self->{Lineno} = $parser->YYData->{lineno};
138 0 return $self;
139 }
140
141 0 ▶sub isa {
Subroutine isa: not called CC=1 SCAR=6.9
142 0 my $self = shift;
143 0 my ($type) = @_;
144 0 return UNIVERSAL::isa($self, 'WAP::wmls::' . $type);
145 }
146
147 0 ▶sub configure {
Subroutine configure: not called CC=3 SCAR=24.8
148 0 my $self = shift;
149 0 my %attr = @_;
150 0 ▶ while ( my ($key, $value) = each(%attr) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %attr) 0 0 0
151 0 ▶ if (defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 0 0 0
152 0 $self->{$key} = $value;
153 }
154 }
155 0 return $self;
156 }
157
158 package WAP::wmls::Url;
159
160 1 ▶use base qw(WAP::wmls::OpCode);
Subroutine BEGIN: called CC=1 SCAR=0.0
161
162 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
163 0 my $proto = shift;
164 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
165 0 my $self = new WAP::wmls::OpCode(@_);
166 0 bless $self, $class;
167 0 return new WAP::wmls::node($self);
168 }
169
170 package WAP::wmls::AccessDomain;
171
172 1 ▶use base qw(WAP::wmls::OpCode);
Subroutine BEGIN: called CC=1 SCAR=0.0
173
174 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
175 0 my $proto = shift;
176 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
177 0 my $self = new WAP::wmls::OpCode(@_);
178 0 bless $self, $class;
179 0 return new WAP::wmls::node($self);
180 }
181
182 package WAP::wmls::AccessPath;
183
184 1 ▶use base qw(WAP::wmls::OpCode);
Subroutine BEGIN: called CC=1 SCAR=0.0
185
186 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
187 0 my $proto = shift;
188 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
189 0 my $self = new WAP::wmls::OpCode(@_);
190 0 bless $self, $class;
191 0 return new WAP::wmls::node($self);
192 }
193
194 package WAP::wmls::MetaName;
195
196 1 ▶use base qw(WAP::wmls::OpCode);
Subroutine BEGIN: called CC=1 SCAR=0.0
197
198 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
199 0 my $proto = shift;
200 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
201 0 my $self = new WAP::wmls::OpCode(@_);
202 0 bless $self, $class;
203 0 return new WAP::wmls::node($self);
204 }
205
206 package WAP::wmls::MetaHttpEquiv;
207
208 1 ▶use base qw(WAP::wmls::OpCode);
Subroutine BEGIN: called CC=1 SCAR=0.0
209
210 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
211 0 my $proto = shift;
212 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
213 0 my $self = new WAP::wmls::OpCode(@_);
214 0 bless $self, $class;
215 0 return new WAP::wmls::node($self);
216 }
217
218 package WAP::wmls::MetaUserAgent;
219
220 1 ▶use base qw(WAP::wmls::OpCode);
Subroutine BEGIN: called CC=1 SCAR=0.0
221
222 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
223 0 my $proto = shift;
224 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
225 0 my $self = new WAP::wmls::OpCode(@_);
226 0 bless $self, $class;
227 0 return new WAP::wmls::node($self);
228 }
229
230 package WAP::wmls::Function;
231
232 1 ▶use base qw(WAP::wmls::OpCode);
Subroutine BEGIN: called CC=1 SCAR=0.0
233
234 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
235 1 ▶use constant UINT8_MAX => 255;
Subroutine BEGIN: called CC=1 SCAR=0.0
236
237 0 ▶sub new {
Subroutine new: not called CC=3 SCAR=24.8
238 0 my $proto = shift;
239 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
240 0 my $parser = shift;
241 0 my $self = new WAP::wmls::OpCode($parser, @_);
242 0 bless $self, $class;
243 # specific
244 0 $self->_SetNbArg($parser);
245 0 ▶ if (defined $self->{Value}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{'Value'}) { } 0 0 0
246 0 $self->_CheckBreakContinue($parser, $self->{Value});
247 }
248 else {
249 0 $parser->Warning("function without statement.\n");
250 }
251 0 $parser->YYData->{symbtab_var}->Check();
252 0 return new WAP::wmls::node($self);
253 }
254
255 0 ▶sub _SetNbArg {
Subroutine _SetNbArg: not called CC=3 SCAR=24.8
256 0 my $self = shift;
257 0 my ($parser) = @_;
258 0 my $def = $self->{Definition};
259 0 ▶ if (defined $self->{Param}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{'Param'}) { } 0 0 0
260 0 my $nbargs = $self->{Param}->{OpCode}->{Index};
261 0 ▶ if ($nbargs >= UINT8_MAX) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nbargs >= 255) { } 0 0 0
262 0 $parser->Error("too many function parameter.");
263 }
264 else {
265 0 $def->{NumberOfArguments} = $nbargs;
266 }
267 }
268 else {
269 0 $def->{NumberOfArguments} = 0;
270 }
271 0 return;
272 }
273
274 0 ▶sub _CheckBreakContinue {
Subroutine _CheckBreakContinue: not called CC=6 SCAR=37.4
275 0 my $self = shift;
276 0 my ($parser, $block) = @_;
277 0 ▶ for (my $node = $block; defined $node; $node = $node->{Next}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $node) 0 0 0
278 0 my $opcode = $node->{OpCode};
279 0 ▶ if ( $opcode->isa('Jump')
Branch: 1 branch
BranchTrueFalseTotal
if ($opcode->isa("Jump") and not defined $opcode->{"Definition"}) 0 0 0
Condition0%0/3
$opcode->isa("Jump") and not defined $opcode->{"Definition"}
!ll&&!rl&&r
000
MC/DC0%0/2
$opcode->isa("Jump") and not defined $opcode->{"Definition"}
$opcode->isa("Jump") not defined $opcode->{"Definition"}
Truth table0%0/3
A and not(B)
A= $opcode->isa("Jump")B= not defined $opcode->{"Definition"}
ABresult
0X0
100
111
280 and !defined $opcode->{Definition} ) {
281 0 my $type = $opcode->{TypeDef};
282 0 ▶ if ($type eq 'LABEL_CONTINUE') {
Branch: 2 branches
BranchTrueFalseTotal
if ($type eq 'LABEL_CONTINUE') { } 0 0 0
elsif ($type eq 'LABEL_BREAK') { } 0 0 0
283 0 $parser->Error("continue without loop.\n");
284 }
285 elsif ($type eq 'LABEL_BREAK') {
286 0 $parser->Error("break without loop.\n");
287 }
288 else {
289 0 croak "INTERNAL_ERROR: _CheckBreakContinue\n";
290 }
291 }
292 }
293 0 return;
294 }
295
296 package WAP::wmls::Argument;
297
298 1 ▶use base qw(WAP::wmls::OpCode);
Subroutine BEGIN: called CC=1 SCAR=0.0
299
300 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
301 0 my $proto = shift;
302 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
303 0 my $self = new WAP::wmls::OpCode(@_);
304 0 bless $self, $class;
305 0 return new WAP::wmls::node($self);
306 }
307
308 package WAP::wmls::LoadVar;
309
310 1 ▶use base qw(WAP::wmls::OpCode);
Subroutine BEGIN: called CC=1 SCAR=0.0
311
312 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
313 0 my $proto = shift;
314 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
315 0 my $self = new WAP::wmls::OpCode(@_);
316 0 bless $self, $class;
317 0 return new WAP::wmls::node($self);
318 }
319
320 package WAP::wmls::StoreVar;
321
322 1 ▶use base qw(WAP::wmls::OpCode);
Subroutine BEGIN: called CC=1 SCAR=0.0
323
324 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
325 0 my $proto = shift;
326 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
327 0 my $self = new WAP::wmls::OpCode(@_);
328 0 bless $self, $class;
329 0 return new WAP::wmls::node($self);
330 }
331
332 package WAP::wmls::IncrVar;
333
334 1 ▶use base qw(WAP::wmls::OpCode);
Subroutine BEGIN: called CC=1 SCAR=0.0
335
336 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
337 0 my $proto = shift;
338 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
339 0 my $self = new WAP::wmls::OpCode(@_);
340 0 bless $self, $class;
341 0 return new WAP::wmls::node($self);
342 }
343
344 package WAP::wmls::DecrVar;
345
346 1 ▶use base qw(WAP::wmls::OpCode);
Subroutine BEGIN: called CC=1 SCAR=0.0
347
348 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
349 0 my $proto = shift;
350 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
351 0 my $self = new WAP::wmls::OpCode(@_);
352 0 bless $self, $class;
353 0 return new WAP::wmls::node($self);
354 }
355
356 package WAP::wmls::AddAsg;
357
358 1 ▶use base qw(WAP::wmls::OpCode);
Subroutine BEGIN: called CC=1 SCAR=0.0
359
360 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
361 0 my $proto = shift;
362 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
363 0 my $self = new WAP::wmls::OpCode(@_);
364 0 bless $self, $class;
365 0 return new WAP::wmls::node($self);
366 }
367
368 package WAP::wmls::SubAsg;
369
370 1 ▶use base qw(WAP::wmls::OpCode);
Subroutine BEGIN: called CC=1 SCAR=0.0
371
372 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
373 0 my $proto = shift;
374 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
375 0 my $self = new WAP::wmls::OpCode(@_);
376 0 bless $self, $class;
377 0 return new WAP::wmls::node($self);
378 }
379
380 package WAP::wmls::Label;
381
382 1 ▶use base qw(WAP::wmls::OpCode);
Subroutine BEGIN: called CC=1 SCAR=0.0
383
384 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
385 0 my $proto = shift;
386 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
387 0 my $self = new WAP::wmls::OpCode(@_);
388 0 bless $self, $class;
389 0 return new WAP::wmls::node($self);
390 }
391
392 package WAP::wmls::Pop;
393
394 1 ▶use base qw(WAP::wmls::OpCode);
Subroutine BEGIN: called CC=1 SCAR=0.0
395
396 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
397 0 my $proto = shift;
398 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
399 0 my $self = new WAP::wmls::OpCode(@_);
400 0 bless $self, $class;
401 0 return new WAP::wmls::node($self);
402 }
403
404 package WAP::wmls::ToBool;
405
406 1 ▶use base qw(WAP::wmls::OpCode);
Subroutine BEGIN: called CC=1 SCAR=0.0
407
408 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
409 0 my $proto = shift;
410 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
411 0 my $self = new WAP::wmls::OpCode(@_);
412 0 bless $self, $class;
413 0 return new WAP::wmls::node($self);
414 }
415
416 package WAP::wmls::ScOr;
417
418 1 ▶use base qw(WAP::wmls::OpCode);
Subroutine BEGIN: called CC=1 SCAR=0.0
419
420 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
421 0 my $proto = shift;
422 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
423 0 my $self = new WAP::wmls::OpCode(@_);
424 0 bless $self, $class;
425 0 return new WAP::wmls::node($self);
426 }
427
428 package WAP::wmls::ScAnd;
429
430 1 ▶use base qw(WAP::wmls::OpCode);
Subroutine BEGIN: called CC=1 SCAR=0.0
431
432 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
433 0 my $proto = shift;
434 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
435 0 my $self = new WAP::wmls::OpCode(@_);
436 0 bless $self, $class;
437 0 return new WAP::wmls::node($self);
438 }
439
440 package WAP::wmls::Return;
441
442 1 ▶use base qw(WAP::wmls::OpCode);
Subroutine BEGIN: called CC=1 SCAR=0.0
443
444 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
445 0 my $proto = shift;
446 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
447 0 my $self = new WAP::wmls::OpCode(@_);
448 0 bless $self, $class;
449 0 return new WAP::wmls::node($self);
450 }
451
452 package WAP::wmls::ReturnES;
453
454 1 ▶use base qw(WAP::wmls::OpCode);
Subroutine BEGIN: called CC=1 SCAR=0.0
455
456 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
457 0 my $proto = shift;
458 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
459 0 my $self = new WAP::wmls::OpCode(@_);
460 0 bless $self, $class;
461 0 return new WAP::wmls::node($self);
462 }
463
464 package WAP::wmls::Call;
465
466 1 ▶use base qw(WAP::wmls::OpCode);
Subroutine BEGIN: called CC=1 SCAR=0.0
467
468 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
469 0 my $proto = shift;
470 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
471 0 my $self = new WAP::wmls::OpCode(@_);
472 0 bless $self, $class;
473 0 return new WAP::wmls::node($self);
474 }
475
476 package WAP::wmls::CallLib;
477
478 1 ▶use base qw(WAP::wmls::OpCode);
Subroutine BEGIN: called CC=1 SCAR=0.0
479
480 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
481 0 my $proto = shift;
482 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
483 0 my $self = new WAP::wmls::OpCode(@_);
484 0 bless $self, $class;
485 0 return new WAP::wmls::node($self);
486 }
487
488 package WAP::wmls::CallUrl;
489
490 1 ▶use base qw(WAP::wmls::OpCode);
Subroutine BEGIN: called CC=1 SCAR=0.0
491
492 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
493 0 my $proto = shift;
494 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
495 0 my $self = new WAP::wmls::OpCode(@_);
496 0 bless $self, $class;
497 0 return new WAP::wmls::node($self);
498 }
499
500 package WAP::wmls::Jump;
501
502 1 ▶use base qw(WAP::wmls::OpCode);
Subroutine BEGIN: called CC=1 SCAR=0.0
503
504 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
505 0 my $proto = shift;
506 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
507 0 my $self = new WAP::wmls::OpCode(@_);
508 0 bless $self, $class;
509 0 return new WAP::wmls::node($self);
510 }
511
512 package WAP::wmls::FalseJump;
513
514 1 ▶use base qw(WAP::wmls::OpCode);
Subroutine BEGIN: called CC=1 SCAR=0.0
515
516 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
517 0 my $proto = shift;
518 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
519 0 my $self = new WAP::wmls::OpCode(@_);
520 0 bless $self, $class;
521 0 return new WAP::wmls::node($self);
522 }
523
524 package WAP::wmls::UnaryOp;
525
526 1 ▶use base qw(WAP::wmls::OpCode);
Subroutine BEGIN: called CC=1 SCAR=0.0
527
528 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
529 0 my $proto = shift;
530 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
531 0 my $self = new WAP::wmls::OpCode(@_);
532 0 bless $self, $class;
533 0 return new WAP::wmls::node($self);
534 }
535
536 package WAP::wmls::BinaryOp;
537
538 1 ▶use base qw(WAP::wmls::OpCode);
Subroutine BEGIN: called CC=1 SCAR=0.0
539
540 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
541 0 my $proto = shift;
542 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
543 0 my $self = new WAP::wmls::OpCode(@_);
544 0 bless $self, $class;
545 0 return new WAP::wmls::node($self);
546 }
547
548 package WAP::wmls::LoadConst;
549
550 1 ▶use base qw(WAP::wmls::OpCode);
Subroutine BEGIN: called CC=1 SCAR=0.0
551
552 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
553 0 my $proto = shift;
554 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
555 0 my $self = new WAP::wmls::OpCode(@_);
556 0 bless $self, $class;
557 0 return new WAP::wmls::node($self);
558 }
559
560 ###############################################################################
561
562 package WAP::wmls::printVisitor;
563
564 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
565 0 my $proto = shift;
566 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
567 0 my $self = {};
568 0 bless $self, $class;
569 0 $self->{level} = 0;
570 0 return $self;
571 }
572
573 0 ▶sub printLabel {
Subroutine printLabel: not called CC=3 SCAR=24.8
574 0 my ($level, $deleted, $label) = @_;
575
576 0 ▶ print '~'
Branch: 1 branch
BranchTrueFalseTotal
if $deleted 0 0 0
577 if ($deleted);
578 0 ▶ while ($level--) {
Branch: 1 branch
BranchTrueFalseTotal
if ($level--) 0 0 0
579 0 print "\t";
580 }
581 0 print $label;
582 0 return;
583 }
584
585 0 ▶sub printDefn {
Subroutine printDefn: not called CC=2 SCAR=17.9
586 0 my ($def) = @_;
587
588 0 ▶ if (defined $def) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $def) { } 0 0 0
589 0 print " $def->{Symbol}\n";
590 }
591 else {
592 0 print " null\n";
593 }
594 0 return;
595 }
596
597 0 ▶sub printOp {
Subroutine printOp: not called CC=1 SCAR=6.9
598 0 my ($op) = @_;
599
600 0 print " $op\n";
601 0 return;
602 }
603
604 0 ▶sub printConst {
Subroutine printConst: not called CC=8 SCAR=42.8
605 0 my ($typedef, $value) = @_;
606
607 0 ▶ if ($typedef eq 'TYPE_INTEGER') {
Branch: 6 branches
BranchTrueFalseTotal
if ($typedef eq 'TYPE_INTEGER') { } 0 0 0
elsif ($typedef eq 'TYPE_FLOAT') { } 0 0 0
elsif ($typedef eq 'TYPE_STRING') { } 0 0 0
elsif ($typedef eq 'TYPE_UTF8_STRING') { } 0 0 0
elsif ($typedef eq 'TYPE_BOOLEAN') { } 0 0 0
elsif ($typedef eq 'TYPE_INVALID') { } 0 0 0
608 0 print " $value\n";
609 }
610 elsif ($typedef eq 'TYPE_FLOAT') {
611 0 print " $value\n";
612 }
613 elsif ($typedef eq 'TYPE_STRING') {
614 0 print " $value\n";
615 }
616 elsif ($typedef eq 'TYPE_UTF8_STRING') {
617 0 print " $value\n";
618 }
619 elsif ($typedef eq 'TYPE_BOOLEAN') {
620 0 ▶ if ($value) {
Branch: 1 branch
BranchTrueFalseTotal
if ($value) { } 0 0 0
621 0 print " true\n";
622 }
623 else {
624 0 print " false\n";
625 }
626 }
627 elsif ($typedef eq 'TYPE_INVALID') {
628 0 print " INVALID\n";
629 }
630 else {
631 0 print "type incompatible of CONST\n";
632 }
633 0 return;
634 }
635
636 0 ▶sub visitUrl {
Subroutine visitUrl: not called CC=1 SCAR=6.9
637 0 my $self = shift;
638 0 my ($opcode) = @_;
639 0 printLabel($self->{level}, 0, "URL");
640 0 printDefn($opcode->{Definition});
641 0 $self->{level} ++;
642 0 $opcode->{Value}->visit($self);
643 0 $self->{level} --;
644 0 return;
645 }
646
647 0 ▶sub visitAccessDomain {
Subroutine visitAccessDomain: not called CC=1 SCAR=6.9
648 0 my $self = shift;
649 0 my ($opcode) = @_;
650 0 printLabel($self->{level}, 0, "ACCESS DOMAIN\n");
651 0 $self->{level} ++;
652 0 $opcode->{Value}->visit($self);
653 0 $self->{level} --;
654 0 return;
655 }
656
657 0 ▶sub visitAccessPath {
Subroutine visitAccessPath: not called CC=1 SCAR=6.9
658 0 my $self = shift;
659 0 my ($opcode) = @_;
660 0 printLabel($self->{level}, 0, "ACCESS PATH\n");
661 0 $self->{level} ++;
662 0 $opcode->{Value}->visit($self);
663 0 $self->{level} --;
664 0 return;
665 }
666
667 0 ▶sub visitMetaName {
Subroutine visitMetaName: not called CC=1 SCAR=6.9
668 0 my $self = shift;
669 0 my ($opcode) = @_;
670 0 printLabel($self->{level}, 0, "META NAME\n");
671 0 $self->{level} ++;
672 0 $opcode->{Value}->visit($self);
673 0 $self->{level} --;
674 0 return;
675 }
676
677 0 ▶sub visitMetaHttpEquiv {
Subroutine visitMetaHttpEquiv: not called CC=1 SCAR=6.9
678 0 my $self = shift;
679 0 my ($opcode) = @_;
680 0 printLabel($self->{level}, 0, "META HTTP EQUIV\n");
681 0 $self->{level} ++;
682 0 $opcode->{Value}->visit($self);
683 0 $self->{level} --;
684 0 return;
685 }
686
687 0 ▶sub visitMetaUserAgent {
Subroutine visitMetaUserAgent: not called CC=1 SCAR=6.9
688 0 my $self = shift;
689 0 my ($opcode) = @_;
690 0 printLabel($self->{level}, 0, "META USER AGENT\n");
691 0 $self->{level} ++;
692 0 $opcode->{Value}->visit($self);
693 0 $self->{level} --;
694 0 return;
695 }
696
697 0 ▶sub visitFunction {
Subroutine visitFunction: not called CC=5 SCAR=34.0
698 0 my $self = shift;
699 0 my ($opcode) = @_;
700 0 printf("\n");
701 0 my $def = $opcode->{Definition};
702 0 ▶ if ($def->{Type} eq 'PRIVATE_FUNC') {
Branch: 2 branches
BranchTrueFalseTotal
if ($def->{'Type'} eq 'PRIVATE_FUNC') { } 0 0 0
elsif ($def->{'Type'} eq 'PUBLIC_FUNC') { } 0 0 0
703 0 printLabel($self->{level}, 0, "FUNCTION");
704 }
705 elsif ($def->{Type} eq 'PUBLIC_FUNC') {
706 0 printLabel($self->{level}, 0, "EXTERN FUNCTION");
707 }
708 else {
709 0 print "Incompatible type of FUNC\n";
710 }
711 0 printDefn($def);
712 0 $self->{level} ++;
713 $opcode->{Param}->visit($self)
714 0 ▶ if (defined $opcode->{Param});
Branch: 1 branch
BranchTrueFalseTotal
if defined $opcode->{"Param"} 0 0 0
715 $opcode->{Value}->visit($self)
716 0 ▶ if (defined $opcode->{Value});
Branch: 1 branch
BranchTrueFalseTotal
if defined $opcode->{"Value"} 0 0 0
717 0 $self->{level} --;
718 0 return;
719 }
720
721 0 ▶sub visitArgument {
Subroutine visitArgument: not called CC=1 SCAR=6.9
722 0 my $self = shift;
723 0 my ($opcode) = @_;
724 0 printLabel($self->{level}, 0, "ARG");
725 0 printDefn($opcode->{Definition});
726 0 return;
727 }
728
729 0 ▶sub visitLoadVar {
Subroutine visitLoadVar: not called CC=1 SCAR=6.9
730 0 my $self = shift;
731 0 my ($opcode) = @_;
732 0 printLabel($self->{level}, $opcode->{Deleted}, "LOAD_VAR");
733 0 printDefn($opcode->{Definition});
734 0 return;
735 }
736
737 0 ▶sub visitStoreVar {
Subroutine visitStoreVar: not called CC=1 SCAR=6.9
738 0 my $self = shift;
739 0 my ($opcode) = @_;
740 0 printLabel($self->{level}, $opcode->{Deleted}, "STORE_VAR");
741 0 printDefn($opcode->{Definition});
742 0 return;
743 }
744
745 0 ▶sub visitIncrVar {
Subroutine visitIncrVar: not called CC=1 SCAR=6.9
746 0 my $self = shift;
747 0 my ($opcode) = @_;
748 0 printLabel($self->{level}, $opcode->{Deleted}, "INCR_VAR");
749 0 printDefn($opcode->{Definition});
750 0 return;
751 }
752
753 0 ▶sub visitDecrVar {
Subroutine visitDecrVar: not called CC=1 SCAR=6.9
754 0 my $self = shift;
755 0 my ($opcode) = @_;
756 0 printLabel($self->{level}, $opcode->{Deleted}, "DECR_VAR");
757 0 printDefn($opcode->{Definition});
758 0 return;
759 }
760
761 0 ▶sub visitAddAsg {
Subroutine visitAddAsg: not called CC=1 SCAR=6.9
762 0 my $self = shift;
763 0 my ($opcode) = @_;
764 0 printLabel($self->{level}, $opcode->{Deleted}, "ADD_ASG");
765 0 printDefn($opcode->{Definition});
766 0 return;
767 }
768
769 0 ▶sub visitSubAsg {
Subroutine visitSubAsg: not called CC=1 SCAR=6.9
770 0 my $self = shift;
771 0 my ($opcode) = @_;
772 0 printLabel($self->{level}, $opcode->{Deleted}, "SUB_ASG");
773 0 printDefn($opcode->{Definition});
774 0 return;
775 }
776
777 0 ▶sub visitLabel {
Subroutine visitLabel: not called CC=1 SCAR=6.9
778 0 my $self = shift;
779 0 my ($opcode) = @_;
780 0 printLabel(0, $opcode->{Deleted}, "LABEL\t");
781 0 printDefn($opcode->{Definition});
782 0 return;
783 }
784
785 0 ▶sub visitPop {
Subroutine visitPop: not called CC=1 SCAR=6.9
786 0 my $self = shift;
787 0 my ($opcode) = @_;
788 0 printLabel($self->{level}, $opcode->{Deleted}, "POP\n");
789 0 return;
790 }
791
792 0 ▶sub visitToBool {
Subroutine visitToBool: not called CC=1 SCAR=6.9
793 0 my $self = shift;
794 0 my ($opcode) = @_;
795 0 printLabel($self->{level}, $opcode->{Deleted}, "TOBOOL\n");
796 0 return;
797 }
798
799 0 ▶sub visitScOr {
Subroutine visitScOr: not called CC=1 SCAR=6.9
800 0 my $self = shift;
801 0 my ($opcode) = @_;
802 0 printLabel($self->{level}, $opcode->{Deleted}, "SCOR\n");
803 0 return;
804 }
805
806 0 ▶sub visitScAnd {
Subroutine visitScAnd: not called CC=1 SCAR=6.9
807 0 my $self = shift;
808 0 my ($opcode) = @_;
809 0 printLabel($self->{level}, $opcode->{Deleted}, "SCAND\n");
810 0 return;
811 }
812
813 0 ▶sub visitReturn {
Subroutine visitReturn: not called CC=1 SCAR=6.9
814 0 my $self = shift;
815 0 my ($opcode) = @_;
816 0 printLabel($self->{level}, $opcode->{Deleted}, "RETURN\n");
817 0 return;
818 }
819
820 0 ▶sub visitReturnES {
Subroutine visitReturnES: not called CC=1 SCAR=6.9
821 0 my $self = shift;
822 0 my ($opcode) = @_;
823 0 printLabel($self->{level}, $opcode->{Deleted}, "RETURN_ES\n");
824 0 return;
825 }
826
827 0 ▶sub visitCall {
Subroutine visitCall: not called CC=1 SCAR=6.9
828 0 my $self = shift;
829 0 my ($opcode) = @_;
830 0 printLabel($self->{level}, $opcode->{Deleted}, "CALL");
831 0 printDefn($opcode->{Definition});
832 0 return;
833 }
834
835 0 ▶sub visitCallLib {
Subroutine visitCallLib: not called CC=1 SCAR=6.9
836 0 my $self = shift;
837 0 my ($opcode) = @_;
838 0 printLabel($self->{level}, $opcode->{Deleted}, "CALL_LIB");
839 0 printDefn($opcode->{Definition});
840 0 return;
841 }
842
843 0 ▶sub visitCallUrl {
Subroutine visitCallUrl: not called CC=1 SCAR=6.9
844 0 my $self = shift;
845 0 my ($opcode) = @_;
846 0 printLabel($self->{level}, $opcode->{Deleted}, "CALL_URL");
847 0 printDefn($opcode->{Definition});
848 0 return;
849 }
850
851 0 ▶sub visitJump {
Subroutine visitJump: not called CC=1 SCAR=6.9
852 0 my $self = shift;
853 0 my ($opcode) = @_;
854 0 printLabel($self->{level}, $opcode->{Deleted}, "JUMP\t\t");
855 0 printDefn($opcode->{Definition});
856 0 return;
857 }
858
859 0 ▶sub visitFalseJump {
Subroutine visitFalseJump: not called CC=1 SCAR=6.9
860 0 my $self = shift;
861 0 my ($opcode) = @_;
862 0 printLabel($self->{level}, $opcode->{Deleted}, "FALSE_JUMP\t");
863 0 printDefn($opcode->{Definition});
864 0 return;
865 }
866
867 0 ▶sub visitUnaryOp {
Subroutine visitUnaryOp: not called CC=1 SCAR=6.9
868 0 my $self = shift;
869 0 my ($opcode) = @_;
870 0 printLabel($self->{level}, $opcode->{Deleted}, "UNOP");
871 0 printOp($opcode->{Operator});
872 0 return;
873 }
874
875 0 ▶sub visitBinaryOp {
Subroutine visitBinaryOp: not called CC=1 SCAR=6.9
876 0 my $self = shift;
877 0 my ($opcode) = @_;
878 0 printLabel($self->{level}, $opcode->{Deleted}, "BINOP");
879 0 printOp($opcode->{Operator});
880 0 return;
881 }
882
883 0 ▶sub visitLoadConst {
Subroutine visitLoadConst: not called CC=1 SCAR=6.9
884 0 my $self = shift;
885 0 my ($opcode) = @_;
886 0 printLabel($self->{level}, $opcode->{Deleted}, "LOAD_CONST");
887 0 printConst($opcode->{TypeDef}, $opcode->{Value});
888 0 return;
889 }
890
891 ###############################################################################
892
893 package WAP::wmls::defn;
894
895 0 ▶sub new {
Subroutine new: not called CC=3 SCAR=24.8
896 0 my $proto = shift;
897 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
898 0 my $self = {};
899 0 bless $self, $class;
900 0 my ($symb, $type) = @_;
901 0 $self->{Symbol} = $symb;
902 0 ▶ $self->{Type} = $type if (defined $type);
Branch: 1 branch
BranchTrueFalseTotal
if defined $type 0 0 0
903 0 $self->{ID} = 0xffff;
904 0 $self->{NbUse} = 0;
905 0 return $self;
906 }
907
908 ###############################################################################
909
910 package WAP::wmls::SymbTab;
911
912 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
913 0 my $proto = shift;
914 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
915 0 my ($parser) = @_;
916 0 my $self = {};
917 0 bless $self, $class;
918 0 $self->{parser} = $parser;
919 0 $self->{tab} = {};
920 0 return $self;
921 }
922
923 0 ▶sub Insert {
Subroutine Insert: not called CC=2 SCAR=17.9
924 0 my $self = shift;
925 0 my ($symb, $def) = @_;
926 0 ▶ if (exists $self->{tab}{$symb}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{'tab'}{$symb}) { } 0 0 0
927 0 $self->{parser}->Error("Redefinition - $symb.\n");
928 }
929 else {
930 0 $self->{tab}{$symb} = $def;
931 }
932 0 return;
933 }
934
935 ###############################################################################
936
937 package WAP::wmls::SymbTabVar;
938
939 1 ▶use base qw(WAP::wmls::SymbTab);
Subroutine BEGIN: called CC=1 SCAR=0.0
940
941 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
942 0 my $proto = shift;
943 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
944 0 my $self = new WAP::wmls::SymbTab(@_);
945 0 bless $self, $class;
946 0 return $self;
947 }
948
949 0 ▶sub InsertLocal {
Subroutine InsertLocal: not called CC=1 SCAR=6.9
950 0 my $self = shift;
951 0 my ($symb) = @_;
952 0 my $def = new WAP::wmls::defn($symb);
953 0 $def->{NbUse} ++;
954 0 $self->SUPER::Insert($symb, $def);
955 0 return $def;
956 }
957
958 0 ▶sub InsertArg {
Subroutine InsertArg: not called CC=1 SCAR=6.9
959 0 my $self = shift;
960 0 my ($symb, $num) = @_;
961 0 my $def = new WAP::wmls::defn($symb);
962 0 $def->{ID} = $num;
963 0 $self->SUPER::Insert($symb, $def);
964 0 return $def;
965 }
966
967 0 ▶sub Lookup {
Subroutine Lookup: not called CC=2 SCAR=17.9
968 0 my $self = shift;
969 0 my ($symb) = @_;
970 0 ▶ if (exists $self->{tab}{$symb}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{'tab'}{$symb}) { } 0 0 0
971 0 my $def = $self->{tab}{$symb};
972 0 $def->{NbUse} ++;
973 0 return $def;
974 }
975 else {
976 0 $self->{parser}->Error("Variable undefined - $symb.\n");
977 0 return;
978 }
979 }
980
981 0 ▶sub Check {
Subroutine Check: not called CC=3 SCAR=24.8
982 0 my $self = shift;
983 0 foreach (keys %{$self->{tab}}) {
984 0 my $def = $self->{tab}{$_};
985 0 ▶ unless ($def->{NbUse}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($def->{"NbUse"}) 0 0 0
986 0 $self->{parser}->Warning("Unused variable - $_.\n");
987 }
988 }
989 0 $self->{tab} = {};
990 0 return;
991 }
992
993 ###############################################################################
994
995 package WAP::wmls::SymbTabLib;
996
997 1 ▶use base qw(WAP::wmls::SymbTab);
Subroutine BEGIN: called CC=1 SCAR=0.0
998
999 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
1000 0 my $proto = shift;
1001 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
1002 0 my $self = new WAP::wmls::SymbTab(@_);
1003 0 bless $self, $class;
1004 0 return $self;
1005 }
1006
1007 0 ▶sub Lookup {
Subroutine Lookup: not called CC=2 SCAR=17.9
1008 0 my $self = shift;
1009 0 my ($library) = @_;
1010 0 ▶ unless (exists $self->{tab}{$library}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"tab"}{$library}) 0 0 0
1011 0 $self->{parser}->Error("Library unknown - $library.\n");
1012 0 return;
1013 }
1014 0 return 1;
1015 }
1016
1017 ###############################################################################
1018
1019 package WAP::wmls::SymbTabFunc;
1020
1021 1 ▶use base qw(WAP::wmls::SymbTab);
Subroutine BEGIN: called CC=1 SCAR=0.0
1022
1023 1 ▶use constant UINT8_MAX => 255;
Subroutine BEGIN: called CC=1 SCAR=0.0
1024
1025 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
1026 0 my $proto = shift;
1027 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
1028 0 my $self = new WAP::wmls::SymbTab(@_);
1029 0 bless $self, $class;
1030 0 $self->{FunctionID} = 0;
1031 0 return $self;
1032 }
1033
1034 0 ▶sub InsertLocal {
Subroutine InsertLocal: not called CC=5 SCAR=34.0
1035 0 my $self = shift;
1036 0 my ($symb, $type) = @_;
1037 0 ▶ if ( $type eq 'PUBLIC_FUNC'
Branch: 1 branch
BranchTrueFalseTotal
if ($type eq "PUBLIC_FUNC" and length $symb > 255) 0 0 0
Condition0%0/3
$type eq "PUBLIC_FUNC" and length $symb > 255
!ll&&!rl&&r
000
MC/DC0%0/2
$type eq "PUBLIC_FUNC" and length $symb > 255
$type eq "PUBLIC_FUNC" length $symb > 255
Truth table0%0/3
A and B
A= $type eq "PUBLIC_FUNC"B= length $symb > 255
ABresult
0X0
100
111
1038 and length $symb > UINT8_MAX ) {
1039 0 $self->{parser}->Error("Too long public function name - $symb.\n");
1040 }
1041 0 my $def = $self->{tab}{$symb};
1042 0 ▶ if (defined $def) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $def) { } 0 0 0
1043 0 ▶ if ($def->{Type} ne 'UNDEF_FUNC') {
Branch: 1 branch
BranchTrueFalseTotal
if ($def->{'Type'} ne 'UNDEF_FUNC') { } 0 0 0
1044 0 $self->{parser}->Error("Redefinition - $symb.\n");
1045 }
1046 else {
1047 0 $def->{Type} = $type;
1048 }
1049 }
1050 else {
1051 0 $def = new WAP::wmls::defn($symb, $type);
1052 0 $self->SUPER::Insert($symb, $def);
1053 }
1054 0 $def->{ID} = $self->{FunctionID} ++;
1055 0 return $def;
1056 }
1057
1058 0 ▶sub LookupLocal {
Subroutine LookupLocal: not called CC=2 SCAR=17.9
1059 0 my $self = shift;
1060 0 my ($symb) = @_;
1061 0 my $def = $self->{tab}{$symb};
1062 0 ▶ unless (defined $def) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $def) 0 0 0
1063 0 $def = new WAP::wmls::defn($symb, 'UNDEF_FUNC');
1064 0 $self->SUPER::Insert($symb, $def);
1065 }
1066 0 return $def;
1067 }
1068
1069 0 ▶sub LookupExternal {
Subroutine LookupExternal: not called CC=5 SCAR=34.0
1070 0 my $self = shift;
1071 0 my ($script, $func, $nbargs) = @_;
1072 0 ▶ if (length $func > UINT8_MAX) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $func > 255) 0 0 0
1073 0 $self->{parser}->Error("Too long external function name - $func.\n");
1074 }
1075 0 ▶ if ($nbargs > UINT8_MAX) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nbargs > 255) 0 0 0
1076 0 $self->{parser}->Error("External function with too many parameter - $func.\n");
1077 }
1078 0 my $symb = $script . '#' . $func;
1079 0 my $def = $self->{tab}{$symb};
1080 0 ▶ if (defined $def) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $def) { } 0 0 0
1081 0 ▶ if ($nbargs != $def->{NumberOfArguments}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nbargs != $def->{"NumberOfArguments"}) 0 0 0
1082 0 $self->{parser}->Error("Previous call with different argument number - $func.\n");
1083 }
1084 }
1085 else {
1086 0 $def = new WAP::wmls::defn($symb, 'EXTERN_FUNC');
1087 0 $def->{FunctionName} = $func;
1088 0 $def->{NumberOfArguments} = $nbargs;
1089 0 $self->SUPER::Insert($symb, $def);
1090 }
1091 0 return $def;
1092 }
1093
1094 0 ▶sub LookupLibrary {
Subroutine LookupLibrary: not called CC=3 SCAR=24.8
1095 0 my $self = shift;
1096 0 my ($library, $func, $nbargs) = @_;
1097 0 my $symb = $library . '.' . $func;
1098 0 my $def = $self->{tab}{$symb};
1099 0 ▶ if (defined $def) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $def) { } 0 0 0
1100 0 ▶ if ($def->{NumberOfArguments} != $nbargs) {
Branch: 1 branch
BranchTrueFalseTotal
if ($def->{"NumberOfArguments"} != $nbargs) 0 0 0
1101 0 $self->{parser}->Error("Wrong argument number for standard function - $func.\n");
1102 }
1103 0 return $def;
1104 }
1105 else {
1106 0 $self->{parser}->Error("Library function unknown - $func.\n");
1107 0 return;
1108 }
1109 }
1110
1111 0 ▶sub InsertLibrary {
Subroutine InsertLibrary: not called CC=1 SCAR=6.9
1112 0 my $self = shift;
1113 0 my ($symb, $libId, $id, $nbargs) = @_;
1114 0 my $def = new WAP::wmls::defn($symb, 'STANDARD_FUNC');
1115 0 $def->{LibraryID} = $libId;
1116 0 $def->{ID} = $id;
1117 0 $def->{NumberOfArguments} = $nbargs;
1118 0 $self->SUPER::Insert($symb, $def);
1119 0 return $def;
1120 }
1121
1122 ###############################################################################
1123
1124 package WAP::wmls::SymbTabUrl;
1125
1126 1 ▶use base qw(WAP::wmls::SymbTab);
Subroutine BEGIN: called CC=1 SCAR=0.0
1127
1128 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
1129 0 my $proto = shift;
1130 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
1131 0 my $self = new WAP::wmls::SymbTab(@_);
1132 0 bless $self, $class;
1133 0 return $self;
1134 }
1135
1136 0 ▶sub Insert {
Subroutine Insert: not called CC=1 SCAR=6.9
1137 0 my $self = shift;
1138 0 my ($symb) = @_;
1139 0 my $def = new WAP::wmls::defn($symb);
1140 0 $self->SUPER::Insert($symb, $def);
1141 0 return $def;
1142 }
1143
1144 0 ▶sub Lookup {
Subroutine Lookup: not called CC=2 SCAR=17.9
1145 0 my $self = shift;
1146 0 my ($script) = @_;
1147 0 ▶ if (exists $self->{tab}{$script}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{'tab'}{$script}) { } 0 0 0
1148 0 my $def = $self->{tab}{$script};
1149 0 $def->{NbUse} ++;
1150 0 return $def;
1151 }
1152 else {
1153 0 $self->{parser}->Error("ScriptName undefined - $script.\n");
1154 0 return;
1155 }
1156 }
1157
1158 ###############################################################################
1159
1160 package WAP::wmls::SymbTabLabel;
1161
1162 1 ▶use constant UINT32_MAX => 4294967295;
Subroutine BEGIN: called CC=1 SCAR=0.0
1163
1164 1 ▶use base qw(WAP::wmls::SymbTab);
Subroutine BEGIN: called CC=1 SCAR=0.0
1165
1166 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
1167 0 my $proto = shift;
1168 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
1169 0 my $self = new WAP::wmls::SymbTab(@_);
1170 0 $self->{idx} = 0;
1171 0 bless $self, $class;
1172 0 return $self;
1173 }
1174
1175 0 ▶sub Next {
Subroutine Next: not called CC=1 SCAR=6.9
1176 0 my $self = shift;
1177 0 my $symb = sprintf("L%d", $self->{idx}++);
1178 0 my $def = new WAP::wmls::defn($symb);
1179 0 $def->{Index} = UINT32_MAX;
1180 0 $self->SUPER::Insert($symb, $def);
1181 0 return $def;
1182 }
1183
1184 1 1;
1185
« wmls/gen.pm ↑ Summary wmls/parser.pm »