AST/Data/Scan/Impl/_Default.pm

filter: Statementstmt 18.8% 34 / 180 Branchbran 2.3% 1 / 42 Conditioncond 0.0% 0 / 53 MC/DCmcdc 0.0% 0 / 32 Subroutinesub 33.3% 7 / 21 Podpod 0.0% 0 / 11 totaltotal 12.3% 42 / 339 CC 39 SCAR 59.0
CC
39
Cov
13%
dsopen
756.0
dsclose
110.0
dsread
12.0
CRAP 365.9
↑ Summary AST/Data/Scan/Impl/Perl5.pm »
1 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 2 ▶use warnings FATAL => 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package MarpaX::Languages::IDL::AST::Data::Scan::Impl::_Default;
5  
6 # ABSTRACT: Default implementation consumer of MarpaX::Languages::IDL::AST::Role::Consumer
7  
8 2 our $VERSION = '0.007'; # VERSION
9  
10 # AUTHORITY
11  
12  
13 2 ▶use Carp qw/croak/;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 2 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 2 ▶use Scalar::Util qw/blessed reftype/;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 2 ▶use Types::Standard -all;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 2 ▶use Types::Common::Numeric -all;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 #
19 # External attributes
20 #
21 2 has level => (is => 'rwp', isa => PositiveOrZeroInt, trigger => 1);
22 0 ▶sub _trigger_level { my $self = shift; return $self->trigger_level(@_) } # To make the trigger
Subroutine _trigger_level: not called CC=1 SCAR=6.9
23 0 ▶sub trigger_level { # around'able -;
Subroutine trigger_level: not called CC=1 SCAR=6.9
Pod undocumented
24 0 my ($self) = @_;
25 #
26 # I suppose having not more then 999 levels in an IDL is ok -;
27 # No consequence if I am wrong.
28 #
29 0 $self->_logger->tracef('[Level %3d] %s%s', $self->level, ' ' x $self->level, $self->globalScope)
30 };
31 #
32 # Internal attributes
33 #
34 2 has _default_root => (is => 'rw', isa => ArrayRef[Str]);
35 2 has _default_scope => (is => 'rw', isa => ArrayRef[Str]);
36 2 has _default_context => (is => 'rw', isa => ArrayRef[Any]);
37 2 has _default_unnamedScopeCounter => (is => 'rw', isa => PositiveOrZeroInt);
38  
39 0 ▶sub currentRoot {
Subroutine currentRoot: not called CC=1 SCAR=6.9
Pod undocumented
40 0 my ($self) = @_;
41 0 return join('', @{$self->_default_root})
42 }
43  
44 0 ▶sub currentScope {
Subroutine currentScope: not called CC=1 SCAR=6.9
Pod undocumented
45 0 my ($self) = @_;
46 0 return join('', @{$self->_default_scope})
47 }
48  
49 0 ▶sub globalName {
Subroutine globalName: not called CC=1 SCAR=6.9
Pod undocumented
50 0 my ($self, $token) = @_;
51  
52 0 return join('', $self->globalScope, $token)
53 }
54  
55 0 ▶sub globalScope {
Subroutine globalScope: not called CC=1 SCAR=6.9
Pod undocumented
56 0 my ($self) = @_;
57  
58 0 return join('', $self->currentRoot, $self->currentScope)
59 }
60  
61 #
62 # 5.21.1 Qualified Names
63 #
64 # Prior to starting to scan a file containing an IDL specification,
65 # the name of the current root is initially empty ('') and the
66 # name of the current scope is initially empty ('').
67 # Whenever a module keyword is encountered, the string “::” and the
68 # associated identifier are appended to the name of the current root;
69 # upon detection of the termination of the module, the trailing '::' and identifier are deleted
70 # from the name of the current root. Whenever an interface, struct, union, or
71 # exception keyword is encountered, the string '::' and the associated identifier are appended
72 # to the name of the current scope; upon detection of the termination of the interface, struct,
73 # union, or exception, the trailing '::' and identifier
74 # are deleted from the name of the current scope. Additionally, a new, unnamed,
75 # scope is entered when the parameters of an
76 # operation declaration are processed; this allows the parameter names to duplicate other identifiers;
77 # when parameter processing has completed, the unnamed scope is exited.
78 #
79  
80 0 ▶sub dsstart {
Subroutine dsstart: not called CC=1 SCAR=6.9
Pod undocumented
81 0 my ($self) = @_;
82  
83 0 $self->_default_root([]);
84 0 $self->_default_scope([]);
85 0 $self->_default_context([]);
86 0 $self->_default_unnamedScopeCounter(0);
87 0 $self->_set_level(0);
88  
89 return
90 0 }
91  
92 0 ▶sub dsend {
Subroutine dsend: not called CC=1 SCAR=6.9
Pod undocumented
93 0 my ($self) = @_;
94  
95 return
96 0 }
97 #
98 # In dsopen() and dsclose() we manage root and scope names
99 # --------------------------------------------------------
100 #
101 # 5.21.2 Scoping Rules and Name Resolution
102 #
103 # The scope for module, interface, valuetype, struct, exception, eventtype, component, and home begins immediately
104 # following its opening ‘{‘ and ends immediately preceding its closing ‘}’.
105 # The scope of an operation begins immediately following its ‘(‘ and ends immediately preceding its closing ‘)’.
106 # The scope of a union begins immediately following the ‘(‘ following the keyword switch, and ends immediately preceding its closing ‘}’.
107 # The appearance of the declaration of any of these kinds in any scope, subject to semantic validity of such declaration, opens a nested scope associated with that
108 # declaration.
109 #
110 0 ▶sub dsopen {
Subroutine dsopen: not called CC=27 SCAR=66.3
Pod undocumented
111 0 my ($self, $item) = @_;
112 #
113 # We always want to remember the full context.
114 # Per def we dsopen() only blessed items, c.f. dsread()
115 #
116 0 my $blessed = $self->_blessed($item);
117 0 push(@{$self->_default_context}, $item);
118 0 my $pushed;
119  
120 0 ▶ if ($blessed eq 'LCURLY') {
Branch: 2 branches
BranchTrueFalseTotal
if ($blessed eq 'LCURLY') { } 0 0 0
elsif ($blessed eq 'LPAREN') { } 0 0 0
121 #
122 # <module> ::= MODULE <identifier> LCURLY <definitionMany> RCURLY
123 #
124 0 ▶ if (scalar(@{$self->_default_context}) >= 2 && $self->_blessed(my $module = $self->_default_context->[-2]) eq 'module') {
Branch: 10 branches
BranchTrueFalseTotal
if (scalar @{$self->_default_context;} >= 2 and $self->_blessed(my $module = $self->_default_context->[-2]) eq 'module') { } 0 0 0
elsif (scalar @{$self->_default_context;} >= 2 and $self->_blessed(my $interfaceDcl = $self->_default_context->[-2]) eq 'interfaceDcl') { } 0 0 0
elsif (scalar @{$self->_default_context;} >= 2 and $self->_blessed(my $valueAbsDcl = $self->_default_context->[-2]) eq 'valueAbsDcl') { } 0 0 0
elsif (scalar @{$self->_default_context;} >= 2 and $self->_blessed(my $valueDcl = $self->_default_context->[-2]) eq 'valueDcl') { } 0 0 0
elsif (scalar @{$self->_default_context;} >= 2 and $self->_blessed(my $structType = $self->_default_context->[-2]) eq 'structType') { } 0 0 0
elsif (scalar @{$self->_default_context;} >= 2 and $self->_blessed(my $exceptDcl = $self->_default_context->[-2]) eq 'exceptDcl') { } 0 0 0
elsif (scalar @{$self->_default_context;} >= 2 and $self->_blessed(my $eventAbsDcl = $self->_default_context->[-2]) eq 'eventAbsDcl') { } 0 0 0
elsif (scalar @{$self->_default_context;} >= 2 and $self->_blessed(my $eventDcl = $self->_default_context->[-2]) eq 'eventDcl') { } 0 0 0
elsif (scalar @{$self->_default_context;} >= 2 and $self->_blessed(my $componentDcl = $self->_default_context->[-2]) eq 'componentDcl') { } 0 0 0
elsif (scalar @{$self->_default_context;} >= 3 and $self->_blessed(my $homeDcl = $self->_get_default_context(-3)) eq 'homeDcl') { } 0 0 0
Condition0%0/3
scalar @{$self->_default_context;} >= 2 and $self->_blessed(my $module = $self->_default_context->[-2]) eq "module"
!ll&&!rl&&r
000
MC/DC0%0/2
scalar @{$self->_default_context;} >= 2 and $self->_blessed(my $module = $self->_default_context->[-2]) eq "module"
scalar @{$self->_default_context;} >= 2 $self->_blessed(my $module = $self->_default_context->[-2]) eq "module"
Truth table0%0/3
A and B
A= scalar @{$self->_default_context;} >= 2B= $self->_blessed(my $module = $self->_default_context->[-2]) eq "module"
ABresult
0X0
100
111
125 0 my $identifier = $module->[1];
126 0 my $IDENTIFIER = $identifier->[0];
127 0 $pushed = push(@{$self->_default_root}, '::', $self->_token($IDENTIFIER));
128 0 $self->_set_level($self->level + 1)
129 }
130 0 ▶ elsif (scalar(@{$self->_default_context}) >= 2 && $self->_blessed(my $interfaceDcl = $self->_default_context->[-2]) eq 'interfaceDcl') {
Condition0%0/3
scalar @{$self->_default_context;} >= 2 and $self->_blessed(my $interfaceDcl = $self->_default_context->[-2]) eq "interfaceDcl"
!ll&&!rl&&r
000
MC/DC0%0/2
scalar @{$self->_default_context;} >= 2 and $self->_blessed(my $interfaceDcl = $self->_default_context->[-2]) eq "interfaceDcl"
scalar @{$self->_default_context;} >= 2 $self->_blessed(my $interfaceDcl = $self->_default_context->[-2]) eq "interfaceDcl"
Truth table0%0/3
A and B
A= scalar @{$self->_default_context;} >= 2B= $self->_blessed(my $interfaceDcl = $self->_default_context->[-2]) eq "interfaceDcl"
ABresult
0X0
100
111
131 #
132 # <interfaceDcl> ::= <interfaceHeader> LCURLY <interfaceBody> RCURLY
133 # <interface> ::= <interfaceDcl>
134 # | <forwardDcl>
135 # <interfaceHeader> ::= <abstractOrLocalMaybe> INTERFACE <identifier> <interfaceInheritanceSpecMaybe>
136 #
137 0 my $interfaceHeader = $interfaceDcl->[0];
138 0 my $identifier = $interfaceHeader->[2];
139 0 my $IDENTIFIER = $identifier->[0];
140 0 $pushed = push(@{$self->_default_scope}, '::', $self->_token($IDENTIFIER));
141 0 $self->_set_level($self->level + 1)
142 }
143 0 ▶ elsif (scalar(@{$self->_default_context}) >= 2 && $self->_blessed(my $valueAbsDcl = $self->_default_context->[-2]) eq 'valueAbsDcl') {
Condition0%0/3
scalar @{$self->_default_context;} >= 2 and $self->_blessed(my $valueAbsDcl = $self->_default_context->[-2]) eq "valueAbsDcl"
!ll&&!rl&&r
000
MC/DC0%0/2
scalar @{$self->_default_context;} >= 2 and $self->_blessed(my $valueAbsDcl = $self->_default_context->[-2]) eq "valueAbsDcl"
scalar @{$self->_default_context;} >= 2 $self->_blessed(my $valueAbsDcl = $self->_default_context->[-2]) eq "valueAbsDcl"
Truth table0%0/3
A and B
A= scalar @{$self->_default_context;} >= 2B= $self->_blessed(my $valueAbsDcl = $self->_default_context->[-2]) eq "valueAbsDcl"
ABresult
0X0
100
111
144 #
145 # <valueAbsDcl> ::= ABSTRACT VALUETYPE <identifier> <valueInheritanceSpecMaybe> LCURLY <exportAny> RCURLY
146 #
147 0 my $identifier = $valueAbsDcl->[2];
148 0 my $IDENTIFIER = $identifier->[0];
149 0 $pushed = push(@{$self->_default_scope}, '::', $self->_token($IDENTIFIER));
150 0 $self->_set_level($self->level + 1)
151 }
152 0 ▶ elsif (scalar(@{$self->_default_context}) >= 2 && $self->_blessed(my $valueDcl = $self->_default_context->[-2]) eq 'valueDcl') {
Condition0%0/3
scalar @{$self->_default_context;} >= 2 and $self->_blessed(my $valueDcl = $self->_default_context->[-2]) eq "valueDcl"
!ll&&!rl&&r
000
MC/DC0%0/2
scalar @{$self->_default_context;} >= 2 and $self->_blessed(my $valueDcl = $self->_default_context->[-2]) eq "valueDcl"
scalar @{$self->_default_context;} >= 2 $self->_blessed(my $valueDcl = $self->_default_context->[-2]) eq "valueDcl"
Truth table0%0/3
A and B
A= scalar @{$self->_default_context;} >= 2B= $self->_blessed(my $valueDcl = $self->_default_context->[-2]) eq "valueDcl"
ABresult
0X0
100
111
153 #
154 # <valueDcl> ::= <valueHeader> LCURLY <valueElementAny> RCURLY
155 # <valueHeader> ::= <customMaybe> VALUETYPE <identifier> <valueInheritanceSpecMaybe>
156 #
157 0 my $valueHeader = $valueDcl->[0];
158 0 my $identifier = $valueHeader->[2];
159 0 my $IDENTIFIER = $identifier->[0];
160 0 $pushed = push(@{$self->_default_scope}, '::', $self->_token($IDENTIFIER));
161 0 $self->_set_level($self->level + 1)
162 }
163 0 ▶ elsif (scalar(@{$self->_default_context}) >= 2 && $self->_blessed(my $structType = $self->_default_context->[-2]) eq 'structType') {
Condition0%0/3
scalar @{$self->_default_context;} >= 2 and $self->_blessed(my $structType = $self->_default_context->[-2]) eq "structType"
!ll&&!rl&&r
000
MC/DC0%0/2
scalar @{$self->_default_context;} >= 2 and $self->_blessed(my $structType = $self->_default_context->[-2]) eq "structType"
scalar @{$self->_default_context;} >= 2 $self->_blessed(my $structType = $self->_default_context->[-2]) eq "structType"
Truth table0%0/3
A and B
A= scalar @{$self->_default_context;} >= 2B= $self->_blessed(my $structType = $self->_default_context->[-2]) eq "structType"
ABresult
0X0
100
111
164 #
165 # <structType> ::= STRUCT <identifier> LCURLY <memberList> RCURLY
166 #
167 0 my $identifier = $structType->[1];
168 0 my $IDENTIFIER = $identifier->[0];
169 0 $pushed = push(@{$self->_default_scope}, '::', $self->_token($IDENTIFIER));
170 0 $self->_set_level($self->level + 1)
171 }
172 0 ▶ elsif (scalar(@{$self->_default_context}) >= 2 && $self->_blessed(my $exceptDcl = $self->_default_context->[-2]) eq 'exceptDcl') {
Condition0%0/3
scalar @{$self->_default_context;} >= 2 and $self->_blessed(my $exceptDcl = $self->_default_context->[-2]) eq "exceptDcl"
!ll&&!rl&&r
000
MC/DC0%0/2
scalar @{$self->_default_context;} >= 2 and $self->_blessed(my $exceptDcl = $self->_default_context->[-2]) eq "exceptDcl"
scalar @{$self->_default_context;} >= 2 $self->_blessed(my $exceptDcl = $self->_default_context->[-2]) eq "exceptDcl"
Truth table0%0/3
A and B
A= scalar @{$self->_default_context;} >= 2B= $self->_blessed(my $exceptDcl = $self->_default_context->[-2]) eq "exceptDcl"
ABresult
0X0
100
111
173 #
174 # <exceptDcl> ::= EXCEPTION <identifier> LCURLY <memberAny> RCURLY
175 #
176 0 my $identifier = $exceptDcl->[1];
177 0 my $IDENTIFIER = $identifier->[0];
178 0 $pushed = push(@{$self->_default_scope}, '::', $self->_token($IDENTIFIER));
179 0 $self->_set_level($self->level + 1)
180 }
181 0 ▶ elsif (scalar(@{$self->_default_context}) >= 2 && $self->_blessed(my $eventAbsDcl = $self->_default_context->[-2]) eq 'eventAbsDcl') {
Condition0%0/3
scalar @{$self->_default_context;} >= 2 and $self->_blessed(my $eventAbsDcl = $self->_default_context->[-2]) eq "eventAbsDcl"
!ll&&!rl&&r
000
MC/DC0%0/2
scalar @{$self->_default_context;} >= 2 and $self->_blessed(my $eventAbsDcl = $self->_default_context->[-2]) eq "eventAbsDcl"
scalar @{$self->_default_context;} >= 2 $self->_blessed(my $eventAbsDcl = $self->_default_context->[-2]) eq "eventAbsDcl"
Truth table0%0/3
A and B
A= scalar @{$self->_default_context;} >= 2B= $self->_blessed(my $eventAbsDcl = $self->_default_context->[-2]) eq "eventAbsDcl"
ABresult
0X0
100
111
182 #
183 # <eventAbsDcl> ::= ABSTRACT EVENTTYPE <identifier> <valueInheritanceSpecMaybe> LCURLY <exportAny> RCURLY
184 #
185 0 my $identifier = $eventAbsDcl->[2];
186 0 my $IDENTIFIER = $identifier->[0];
187 0 $pushed = push(@{$self->_default_scope}, '::', $self->_token($IDENTIFIER));
188 0 $self->_set_level($self->level + 1)
189 }
190 0 ▶ elsif (scalar(@{$self->_default_context}) >= 2 && $self->_blessed(my $eventDcl = $self->_default_context->[-2]) eq 'eventDcl') {
Condition0%0/3
scalar @{$self->_default_context;} >= 2 and $self->_blessed(my $eventDcl = $self->_default_context->[-2]) eq "eventDcl"
!ll&&!rl&&r
000
MC/DC0%0/2
scalar @{$self->_default_context;} >= 2 and $self->_blessed(my $eventDcl = $self->_default_context->[-2]) eq "eventDcl"
scalar @{$self->_default_context;} >= 2 $self->_blessed(my $eventDcl = $self->_default_context->[-2]) eq "eventDcl"
Truth table0%0/3
A and B
A= scalar @{$self->_default_context;} >= 2B= $self->_blessed(my $eventDcl = $self->_default_context->[-2]) eq "eventDcl"
ABresult
0X0
100
111
191 #
192 # <eventDcl> ::= <eventHeader> LCURLY <valueElementAny> RCURLY
193 # <eventHeader> ::= <customMaybe> EVENTTYPE <identifier> <valueInheritanceSpecMaybe>
194 #
195 0 my $eventHeader = $eventDcl->[0];
196 0 my $identifier = $eventHeader->[2];
197 0 my $IDENTIFIER = $identifier->[0];
198 0 $pushed = push(@{$self->_default_scope}, '::', $self->_token($IDENTIFIER));
199 0 $self->_set_level($self->level + 1)
200 }
201 0 ▶ elsif (scalar(@{$self->_default_context}) >= 2 && $self->_blessed(my $componentDcl = $self->_default_context->[-2]) eq 'componentDcl') {
Condition0%0/3
scalar @{$self->_default_context;} >= 2 and $self->_blessed(my $componentDcl = $self->_default_context->[-2]) eq "componentDcl"
!ll&&!rl&&r
000
MC/DC0%0/2
scalar @{$self->_default_context;} >= 2 and $self->_blessed(my $componentDcl = $self->_default_context->[-2]) eq "componentDcl"
scalar @{$self->_default_context;} >= 2 $self->_blessed(my $componentDcl = $self->_default_context->[-2]) eq "componentDcl"
Truth table0%0/3
A and B
A= scalar @{$self->_default_context;} >= 2B= $self->_blessed(my $componentDcl = $self->_default_context->[-2]) eq "componentDcl"
ABresult
0X0
100
111
202 #
203 # <componentDcl> ::= <componentHeader> LCURLY <componentBody> RCURLY
204 # <componentHeader> ::= COMPONENT <identifier> <componentInheritanceSpecMaybe> <supportedInterfaceSpecMaybe>
205 #
206 0 my $componentHeader = $componentDcl->[0];
207 0 my $identifier = $componentHeader->[1];
208 0 my $IDENTIFIER = $identifier->[0];
209 0 $pushed = push(@{$self->_default_scope}, '::', $self->_token($IDENTIFIER));
210 0 $self->_set_level($self->level + 1)
211 }
212 0 ▶ elsif (scalar(@{$self->_default_context}) >= 3 && $self->_blessed(my $homeDcl = $self->_get_default_context(-3)) eq 'homeDcl') {
Condition0%0/3
scalar @{$self->_default_context;} >= 3 and $self->_blessed(my $homeDcl = $self->_get_default_context(-3)) eq "homeDcl"
!ll&&!rl&&r
000
MC/DC0%0/2
scalar @{$self->_default_context;} >= 3 and $self->_blessed(my $homeDcl = $self->_get_default_context(-3)) eq "homeDcl"
scalar @{$self->_default_context;} >= 3 $self->_blessed(my $homeDcl = $self->_get_default_context(-3)) eq "homeDcl"
Truth table0%0/3
A and B
A= scalar @{$self->_default_context;} >= 3B= $self->_blessed(my $homeDcl = $self->_get_default_context(-3)) eq "homeDcl"
ABresult
0X0
100
111
213 #
214 # <homeBody> ::= LCURLY <homeExportAny> RCURLY
215 # <homeDcl> ::= <homeHeader> <homeBody>
216 # <homeHeader> ::= HOME <identifier> <homeInheritanceSpecMaybe> <supportedInterfaceSpecMaybe> MANAGES <scopedName> <primaryKeySpecMaybe>
217 #
218 0 my $homeHeader = $homeDcl->[0];
219 0 my $identifier = $homeHeader->[1];
220 0 my $IDENTIFIER = $identifier->[0];
221 0 $pushed = push(@{$self->_default_scope}, '::', $self->_token($IDENTIFIER));
222 0 $self->_set_level($self->level + 1)
223 }
224 }
225 elsif ($blessed eq 'LPAREN') {
226 0 ▶ if (scalar(@{$self->_default_context}) >= 2 && $self->_blessed(my $unionType = $self->_default_context->[-2]) eq 'unionType') {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @{$self->_default_context;} >= 2 and $self->_blessed(my $unionType = $self->_default_context->[-2]) eq 'unionType') { } 0 0 0
elsif (scalar @{$self->_default_context;} >= 2 and do { my $parentContext = $self->_blessed($self->_default_context->[-2]); grep {$_ eq $parentContext;} 'initDcl', 'primaryExpr', 'parameterDcls', 'factoryDcl', 'finderDcl' }) { } 0 0 0
Condition0%0/3
scalar @{$self->_default_context;} >= 2 and $self->_blessed(my $unionType = $self->_default_context->[-2]) eq "unionType"
!ll&&!rl&&r
000
MC/DC0%0/2
scalar @{$self->_default_context;} >= 2 and $self->_blessed(my $unionType = $self->_default_context->[-2]) eq "unionType"
scalar @{$self->_default_context;} >= 2 $self->_blessed(my $unionType = $self->_default_context->[-2]) eq "unionType"
Truth table0%0/3
A and B
A= scalar @{$self->_default_context;} >= 2B= $self->_blessed(my $unionType = $self->_default_context->[-2]) eq "unionType"
ABresult
0X0
100
111
227 #
228 # <unionType> ::= UNION <identifier> SWITCH LPAREN <switchTypeSpec> RPAREN LCURLY <switchBody> RCURLY
229 #
230 0 my $identifier = $unionType->[1];
231 0 my $IDENTIFIER = $identifier->[0];
232 0 $pushed = push(@{$self->_default_scope}, '::', $self->_token($IDENTIFIER));
233 0 $self->_set_level($self->level + 1)
234 }
235 #
236 # Unnamed scopes
237 #
238 0 ▶ elsif ((scalar(@{$self->_default_context}) >= 2) &&
Condition0%0/3
scalar @{$self->_default_context;} >= 2 and do { my $parentContext = $self->_blessed($self->_default_context->[-2]); grep {$_ eq $parentContext;} "initDcl", "primaryExpr", "parameterDcls", "factoryDcl", "finderDcl" }
!ll&&!rl&&r
000
MC/DC0%0/2
scalar @{$self->_default_context;} >= 2 and do { my $parentContext = $self->_blessed($self->_default_context->[-2]); grep {$_ eq $parentContext;} "initDcl", "primaryExpr", "parameterDcls", "factoryDcl", "finderDcl" }
scalar @{$self->_default_context;} >= 2 do { my $parentContext = $self->_blessed($self->_default_context->[-2]); grep {$_ eq $parentContext;} "initDcl", "primaryExpr", "parameterDcls", "factoryDcl", "finderDcl" }
Truth table0%0/3
A and B
A= scalar @{$self->_default_context;} >= 2B= do { my $parentContext = $self->_blessed($self->_default_context->[-2]); grep {$_ eq $parentContext;} "initDcl", "primaryExpr", "parameterDcls", "factoryDcl", "finderDcl" }
ABresult
0X0
100
111
239 do {
240 0 my $parentContext = $self->_blessed($self->_default_context->[-2]);
241 0 grep {$_ eq $parentContext} qw/initDcl primaryExpr parameterDcls factoryDcl finderDcl/
242 }
243 ) {
244 #
245 # <initDcl> ::= FACTORY <identifier> LPAREN <initParamDeclsMaybe> RPAREN <raisesExprMaybe> SEMICOLON
246 # <primaryExpr> ::= LPAREN <constExp> RPAREN
247 # <parameterDcls> ::= LPAREN <paramDclListMany> RPAREN
248 # | LPAREN RPAREN
249 # <factoryDcl> ::= FACTORY <identifier> LPAREN [ <initParamDecls> ] RPAREN <raisesExprMaybe>
250 # <finderDcl> ::= FINDER <identifier> LPAREN [ <initParamDecls> ] RPAREN <raisesExprMaybe>
251 #
252 0 my $unnamedScopeCounter = $self->_default_unnamedScopeCounter;
253 # Make sure unnamed scoped is an invalid identifier
254 0 my $unnamedScope = sprintf('[unnamedScope%d]', $unnamedScopeCounter);
255 0 $self->_default_unnamedScopeCounter(++$unnamedScopeCounter);
256 0 $pushed = push(@{$self->_default_scope}, '::', $unnamedScope);
257 0 $self->_set_level($self->level + 1)
258 }
259 }
260  
261 return
262 0 }
263  
264 0 ▶sub dsclose {
Subroutine dsclose: not called CC=10 SCAR=47.0
Pod undocumented
265 0 my ($self, $item) = @_;
266  
267 0 my $blessed = $self->_blessed($item);
268 0 my $parentContext;
269 my $spliced;
270  
271 0 ▶ if ($blessed eq 'RCURLY' &&
Branch: 2 branches
BranchTrueFalseTotal
if ($blessed eq 'RCURLY' and scalar @{$self->_default_context;} >= 2 and $parentContext = $self->_blessed($self->_default_context->[-2]) and grep {$parentContext eq $_;} 'module', 'interfaceDcl', 'valueAbsDcl', 'valueDcl', 'structType', 'exceptDcl', 'eventAbsDcl', 'eventDcl', 'componentDcl', 'homeBody', 'unionType') { } 0 0 0
elsif ($blessed eq 'RPAREN') { } 0 0 0
Condition0%0/9
$blessed eq "RCURLY" and scalar @{$self->_default_context;} >= 2 and $parentContext = $self->_blessed($self->_default_context->[-2]) and grep {$parentContext eq $_;} "module", "interfaceDcl", "valueAbsDcl", "valueDcl", "structType", "exceptDcl", "eventAbsDcl", "eventDcl", "componentDcl", "homeBody", "unionType"
!ll&&!rl&&r
000
$blessed eq "RCURLY" and scalar @{$self->_default_context;} >= 2 and $parentContext = $self->_blessed($self->_default_context->[-2])
!ll&&!rl&&r
000
$blessed eq "RCURLY" and scalar @{$self->_default_context;} >= 2
!ll&&!rl&&r
000
MC/DC0%0/4
$blessed eq "RCURLY" and scalar @{$self->_default_context;} >= 2 and $parentContext = $self->_blessed($self->_default_context->[-2]) and grep {$parentContext eq $_;} "module", "interfaceDcl", "valueAbsDcl", "valueDcl", "structType", "exceptDcl", "eventAbsDcl", "eventDcl", "componentDcl", "homeBody", "unionType"
$blessed eq "RCURLY" scalar @{$self->_default_context;} >= 2 $parentContext = $self->_blessed($self->_default_context->[-2]) grep {$parentContext eq $_;} "module", "interfaceDcl", "valueAbsDcl", "valueDcl", "structType", "exceptDcl", "eventAbsDcl", "eventDcl", "componentDcl", "homeBody", "unionType"
Truth table0%0/5
A and B and C and D
A= $blessed eq "RCURLY"B= scalar @{$self->_default_context;} >= 2C= $parentContext = $self->_blessed($self->_default_context->[-2])D= grep {$parentContext eq $_;} "module", "interfaceDcl", "valueAbsDcl", "valueDcl", "structType", "exceptDcl", "eventAbsDcl", "eventDcl", "componentDcl", "homeBody", "unionType"
ABCDresult
0XXX0
10XX0
110X0
11100
11111
272 0 scalar(@{$self->_default_context}) >= 2 &&
273 ($parentContext = $self->_blessed($self->_default_context->[-2])) &&
274 0 grep { $parentContext eq $_} qw/module
275 interfaceDcl
276 valueAbsDcl
277 valueDcl
278 structType
279 exceptDcl
280 eventAbsDcl
281 eventDcl
282 componentDcl
283 homeBody
284 unionType/
285 ) {
286 #
287 # <module> ::= MODULE <identifier> LCURLY <definitionMany> RCURLY
288 # <interfaceDcl> ::= <interfaceHeader> LCURLY <interfaceBody> RCURLY
289 # <valueAbsDcl> ::= ABSTRACT VALUETYPE <identifier> <valueInheritanceSpecMaybe> LCURLY <exportAny> RCURLY
290 # <valueDcl> ::= <valueHeader> LCURLY <valueElementAny> RCURLY
291 # <structType> ::= STRUCT <identifier> LCURLY <memberList> RCURLY
292 # <exceptDcl> ::= EXCEPTION <identifier> LCURLY <memberAny> RCURLY
293 # <eventAbsDcl> ::= ABSTRACT EVENTTYPE <identifier> <valueInheritanceSpecMaybe> LCURLY <exportAny> RCURLY
294 # <eventDcl> ::= <eventHeader> LCURLY <valueElementAny> RCURLY
295 # <componentDcl> ::= <componentHeader> LCURLY <componentBody> RCURLY
296 # <homeBody> ::= LCURLY <homeExportAny> RCURLY
297 # <unionType> ::= UNION <identifier> SWITCH LPAREN <switchTypeSpec> RPAREN LCURLY <switchBody> RCURLY
298 #
299 0 ▶ $spliced = ($parentContext eq 'module') ? splice(@{$self->_default_root}, -2, 2) : splice(@{$self->_default_scope}, -2, 2);
Branch: 1 branch
BranchTrueFalseTotal
$parentContext eq 'module' ? : 0 0 0
300 0 $self->_set_level($self->level - 1)
301 }
302 elsif ($blessed eq 'RPAREN') {
303 #
304 # Unnamed scopes
305 #
306 0 ▶ if ((scalar(@{$self->_default_context}) >= 2) &&
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @{$self->_default_context;} >= 2 and $parentContext = $self->_blessed($self->_default_context->[-2]) and grep {$_ eq $parentContext;} "initDcl", "primaryExpr", "parameterDcls", "factoryDcl", "finderDcl") 0 0 0
Condition0%0/6
scalar @{$self->_default_context;} >= 2 and $parentContext = $self->_blessed($self->_default_context->[-2]) and grep {$_ eq $parentContext;} "initDcl", "primaryExpr", "parameterDcls", "factoryDcl", "finderDcl"
!ll&&!rl&&r
000
scalar @{$self->_default_context;} >= 2 and $parentContext = $self->_blessed($self->_default_context->[-2])
!ll&&!rl&&r
000
MC/DC0%0/3
scalar @{$self->_default_context;} >= 2 and $parentContext = $self->_blessed($self->_default_context->[-2]) and grep {$_ eq $parentContext;} "initDcl", "primaryExpr", "parameterDcls", "factoryDcl", "finderDcl"
scalar @{$self->_default_context;} >= 2 $parentContext = $self->_blessed($self->_default_context->[-2]) grep {$_ eq $parentContext;} "initDcl", "primaryExpr", "parameterDcls", "factoryDcl", "finderDcl"
Truth table0%0/4
A and B and C
A= scalar @{$self->_default_context;} >= 2B= $parentContext = $self->_blessed($self->_default_context->[-2])C= grep {$_ eq $parentContext;} "initDcl", "primaryExpr", "parameterDcls", "factoryDcl", "finderDcl"
ABCresult
0XX0
10X0
1100
1111
307 ($parentContext = $self->_blessed($self->_default_context->[-2])) &&
308 0 grep {$_ eq $parentContext} qw/initDcl primaryExpr parameterDcls factoryDcl finderDcl/
309 ) {
310 #
311 # <initDcl> ::= FACTORY <identifier> LPAREN <initParamDeclsMaybe> RPAREN <raisesExprMaybe> SEMICOLON
312 # <primaryExpr> ::= LPAREN <constExp> RPAREN
313 # <parameterDcls> ::= LPAREN <paramDclListMany> RPAREN
314 # | LPAREN RPAREN
315 # <factoryDcl> ::= FACTORY <identifier> LPAREN [ <initParamDecls> ] RPAREN <raisesExprMaybe>
316 # <finderDcl> ::= FINDER <identifier> LPAREN [ <initParamDecls> ] RPAREN <raisesExprMaybe>
317 #
318 0 my $unnamedScopeCounter = $self->_default_unnamedScopeCounter;
319 0 $self->_default_unnamedScopeCounter(--$unnamedScopeCounter);
320 0 $spliced = splice(@{$self->_default_scope}, -2, 2);
321 0 $self->_set_level($self->level - 1)
322 }
323 }
324 0 pop(@{$self->_default_context});
325 return
326 0 }
327 #
328 # We just provide a default dsread that is capable to distinguish lexemes and
329 # to unfold when necessary.
330 #
331 2 my %G1 = ( specification => 1);
332 #
333 # Generate a dump default method for every required G1
334 #
335 2 foreach (keys %G1) {
336 2 ▶ eval "sub $_ {}";
Subroutine specification: not called CC=1 SCAR=0.0
Pod undocumented
337 2 ▶ croak "Failed to generate dump sub for $_, $@" if $@
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 2 2
338 }
339  
340 0 ▶sub dsread {
Subroutine dsread: not called CC=3 SCAR=24.8
Pod undocumented
341 0 my ($self, $item) = @_;
342 #
343 # Item, when blessed, is always an array reference in our case
344 #
345 0 my $blessed = $self->_blessed($item);
346 0 ▶ my $rc = $blessed ? $item : undef;
Branch: 1 branch
BranchTrueFalseTotal
$blessed ? : 0 0 0
347 #
348 # Per-rule implementations.
349 #
350 0 ▶ if (exists($G1{$blessed})) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $G1{$blessed}) 0 0 0
351 0 $self->$blessed($item)
352 }
353  
354 0 return $rc;
355 }
356  
357 0 ▶sub _blessed {
Subroutine _blessed: not called CC=2 SCAR=17.9
358 0 my ($self, $item) = @_;
359  
360 0 ▶ my $blessed = blessed($item) // '';
Condition0%0/2
builtin::blessed($item) // ""
l!l
00
MC/DC0%0/1
builtin::blessed($item) // ""
builtin::blessed($item)
Truth table0%0/2
A
A= builtin::blessed($item)
Aresult
11
00
361 0 $blessed =~ s/.*:://;
362  
363 0 return $blessed
364 }
365  
366 0 ▶sub _token {
Subroutine _token: not called CC=1 SCAR=6.9
367 0 my ($self, $item) = @_;
368  
369 0 return $item->[2]
370 }
371  
372 2 with 'MarpaX::Languages::IDL::AST::Data::Scan::Role::Consumer';
373 2 with 'MooX::Role::Logger';
374  
375 2 1;
376  
377 =pod
378  
379 =encoding UTF-8
380  
381 =head1 NAME
382  
383 MarpaX::Languages::IDL::AST::Data::Scan::Impl::_Default - Default implementation consumer of MarpaX::Languages::IDL::AST::Role::Consumer
384  
385 =head1 VERSION
386  
387 version 0.007
388  
389 =head1 SYNOPSIS
390  
391 use MarpaX::Languages::IDL::AST;
392  
393 my $idlPath = 'source.idl';
394 my $ast = MarpaX::Languages::IDL::AST->new()->parse($idlPath)->validate();
395  
396 =head1 DESCRIPTION
397  
398 This module provide and manage general notions of IDL, that are independant of the language generated bindings, like current root, current scope, and scoped name resolution. This module is writen as Data::Scan::Role::Consumer implementation.
399  
400 =head1 AUTHOR
401  
402 Jean-Damien Durand <jeandamiendurand@free.fr>
403  
404 =head1 COPYRIGHT AND LICENSE
405  
406 This software is copyright (c) 2014 by Jean-Damien Durand.
407  
408 This is free software; you can redistribute it and/or modify it under
409 the same terms as the Perl 5 programming language system itself.
410  
411 =cut
412  
413 __DATA__
↑ Summary AST/Data/Scan/Impl/Perl5.pm »