lib/Perl/PrereqScanner/NotQuiteLite.pm

filter: Statementstmt 87.0% 1313 / 1508 Branchbran 81.3% 776 / 954 Conditioncond 73.9% 307 / 415 MC/DCmcdc 53.5% 122 / 228 Subroutinesub 81.5% 31 / 38 Podpod 100% 3 / 3 totaltotal 81.1% 2552 / 3146 SCAR 78.1
CC
626
Cov
83%
_scan
1228.5
_scan_re
58.9
_skim_string
30.0
CRAP 2457.3
« blib/lib/Perl/PrereqScanner/NotQuiteLite/Context.pm ↑ Summary blib/lib/Perl/PrereqScanner/NotQuiteLite/Parser/Core.pm »
1 package Perl::PrereqScanner::NotQuiteLite;
2  
3 96 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 96 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 96 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 96 ▶use Perl::PrereqScanner::NotQuiteLite::Context;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 96 ▶use Perl::PrereqScanner::NotQuiteLite::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 96 our $VERSION = '0.9917';
10  
11 96 our @BUNDLED_PARSERS = qw/
12 Aliased AnyMoose Autouse Catalyst ClassAccessor
13 ClassAutouse ClassLoad Core Inline KeywordDeclare Later
14 Mixin ModuleRuntime MojoBase Moose MooseXDeclare ObjectPad Only
15 PackageVariant Plack POE Prefork Superclass Syntax SyntaxCollector
16 TestClassMost TestMore TestRequires UniversalVersion Unless
17 /;
18 96 our @DEFAULT_PARSERS = qw/Core Moose/;
19  
20 ### Helpers For Debugging
21  
22 96 ▶use constant DEBUG => !!$ENV{PERL_PSNQL_DEBUG} || 0;
Subroutine BEGIN: called CC=2 SCAR=7.1
Condition50%1/2
!!$ENV{'PERL_PSNQL_DEBUG'} || 0
l!l
096
MC/DC0%0/1
!!$ENV{'PERL_PSNQL_DEBUG'} || 0
!!$ENV{'PERL_PSNQL_DEBUG'}
Truth table50%1/2
A
A= !!$ENV{'PERL_PSNQL_DEBUG'}
Aresult
11
00
23 96 ▶use constant DEBUG_RE => DEBUG > 3 ? 1 : 0;
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 ▶sub _debug {}
Subroutine _debug: not called CC=1 SCAR=0.0
26 ▶sub _error {}
Subroutine _error: called CC=1 SCAR=0.0
27 ▶sub _dump_stack {}
Subroutine _dump_stack: not called CC=1 SCAR=0.0
28  
29 96 if (DEBUG) {
30 require Data::Dump; Data::Dump->import(qw/dump/);
31 96 ▶ no warnings 'redefine';
Subroutine BEGIN: called CC=1 SCAR=0.0
32 0 ▶ *_debug = sub { print @_, "\n" };
Subroutine __ANON__: not called CC=1 SCAR=6.9
33 0 ▶ *_error = sub { print @_, "*" x 50, "\n" };
Subroutine __ANON__: not called CC=1 SCAR=6.9
34 *_dump_stack = sub {
35 0 ▶ my ($c, $char) = @_;
Subroutine __ANON__: not called CC=2 SCAR=17.9
36 0 ▶ my $stacked = join '', map {($_->[2] ? "($_->[2])" : '').$_->[0]} @{$c->{stack}};
Branch: 1 branch
BranchTrueFalseTotal
$_->[2] ? : 0 0 0
37 0 _debug("$char \t\t\t\t stacked: $stacked");
38 };
39 }
40  
41 sub _match_error {
42 5 ▶ my $rstr = shift;
Subroutine _match_error: called CC=1 SCAR=0.0
43 5 $@ = shift() . substr($$rstr, pos($$rstr), 100);
44 5 return;
45 }
46  
47 ### Global Variables To Be Sorted Out Later
48  
49 96 my %unsupported_packages = map {$_ => 1} qw(
50 );
51  
52 96 my %sub_keywords = (
53 'Function::Parameters' => [qw/fun method/],
54 'TryCatch' => [qw/try catch/],
55 );
56  
57 my %filter_modules = (
58 1 ▶ tt => sub { ${$_[0]} =~ s|\G.+?no\s*tt\s*;||s; 0; },
Subroutine __ANON__: called CC=1 SCAR=0.0
59 0 ▶ 'Text::RewriteRules' => sub { ${$_[0]} =~ s|RULES.+?ENDRULES\n||gs; 1 },
Subroutine __ANON__: not called CC=1 SCAR=6.9
60 96 );
61  
62 96 my %is_conditional = map {$_ => 1} qw(
63 if elsif unless else given when
64 for foreach while until
65 );
66  
67 96 my %ends_expr = map {$_ => 1} qw(
68 and or xor
69 if else elsif unless when default
70 for foreach while until
71 && || !~ =~ = += -= *= /= **= //= %= ^= |=
72 > < >= <= <> <=> cmp ge gt le lt eq ne ? :
73 );
74  
75 96 my %has_sideff = map {$_ => 1} qw(
76 and or xor && || //
77 if unless when
78 );
79  
80 # keywords that allow /regexp/ to follow directly
81 96 my %regexp_may_follow = map {$_ => 1} qw(
82 and or cmp if elsif unless eq ne
83 gt lt ge le for while until grep map not split when
84 return
85 );
86  
87 96 my $re_namespace = qr/(?:::|')?(?:[a-zA-Z0-9_]+(?:(?:::|')[a-zA-Z0-9_]+)*)/;
88 96 my $re_nonblock_chars = qr/[^\\\(\)\{\}\[\]\<\>\/"'`#q~,\s]*/;
89 96 my $re_variable = qr/
90 (?:$re_namespace)
91 | (?:\^[A-Z\]])
92 | (?:\{\^[A-Z0-9_]+\})
93 | (?:[_"\(\)<\\\&`'\+\-,.\/\%#:=~\|?!\@\*\[\]\^])
94 /x;
95 96 my $re_pod = qr/(
96 =[a-zA-Z]\w*\b
97 .*?
98 (?:(?:\n)
99 =cut\b.*?(?:\n|\z)|\z)
100 )/sx;
101 96 my $re_comment = qr/(?:\s*#[^\n]*?\n)*(?:\s*#[^\n]*?)(?:\n|$)/s;
102  
103 96 my $g_re_scalar_variable = qr{\G(\$(?:$re_variable))};
104 96 my $g_re_hash_shortcut = qr{\G(\{\s*(?:[\+\-]?\w+|(['"])[\w\s]+\2|(?:$re_nonblock_chars))\s*(?<!\$)\})};
105 96 my $g_re_prototype = qr{\G(\([^\)]*?\))};
106  
107 96 my %ReStrInDelims;
108 sub _gen_re_str_in_delims {
109 321 ▶ my $delim = shift;
Subroutine _gen_re_str_in_delims: called CC=3 SCAR=11.0
110 321 ▶ $ReStrInDelims{$delim} ||= do {
Condition66%2/3
$ReStrInDelims{$delim} ||= do { if ($delim eq "\\") { qr/(?:[^\\]*(?:(?:\\\\)[^\\]*)*)/s; } else { $delim = quotemeta $delim; qr/(?:[^\\$delim]*(?:\\.[^\\$delim]*)*)/s; } }
l!l&&r!l&&!r
13200
MC/DC0%0/2
$ReStrInDelims{$delim} ||= do { if ($delim eq "\\") { qr/(?:[^\\]*(?:(?:\\\\)[^\\]*)*)/s; } else { $delim = quotemeta $delim; qr/(?:[^\\$delim]*(?:\\.[^\\$delim]*)*)/s; } }
$ReStrInDelims{$delim} do { if ($delim eq "\\") { qr/(?:[^\\]*(?:(?:\\\\)[^\\]*)*)/s; } else { $delim = quotemeta $delim; qr/(?:[^\\$delim]*(?:\\.[^\\$delim]*)*)/s; } }
Truth table66%2/3
A ||= B
A= $ReStrInDelims{$delim}B= do { if ($delim eq "\\") { qr/(?:[^\\]*(?:(?:\\\\)[^\\]*)*)/s; } else { $delim = quotemeta $delim; qr/(?:[^\\$delim]*(?:\\.[^\\$delim]*)*)/s; } }
ABresult
1X1
011
000
111 320 ▶ if ($delim eq '\\') {
Branch: 1 branch
BranchTrueFalseTotal
if ($delim eq '\\') { } 2 318 320
112 2 qr/(?:[^\\]*(?:(?:\\\\)[^\\]*)*)/s;
113 } else {
114 318 $delim = quotemeta $delim;
115 318 qr/(?:[^\\$delim]*(?:\\.[^\\$delim]*)*)/s;
116 }
117 };
118 }
119  
120 96 my $re_str_in_single_quotes = _gen_re_str_in_delims(q{'});
121 96 my $re_str_in_double_quotes = _gen_re_str_in_delims(q{"});
122 96 my $re_str_in_backticks = _gen_re_str_in_delims(q{`});
123  
124 96 my %ReStrInDelimsWithEndDelim;
125 sub _gen_re_str_in_delims_with_end_delim {
126 96 ▶ my $delim = shift;
Subroutine _gen_re_str_in_delims_with_end_delim: called CC=2 SCAR=7.0
127 96 ▶ $ReStrInDelimsWithEndDelim{$delim} ||= do {
Condition66%2/3
$ReStrInDelimsWithEndDelim{$delim} ||= do { my $re = _gen_re_str_in_delims($delim); qr/$re\Q$delim\E/ }
l!l&&r!l&&!r
63330
MC/DC0%0/2
$ReStrInDelimsWithEndDelim{$delim} ||= do { my $re = _gen_re_str_in_delims($delim); qr/$re\Q$delim\E/ }
$ReStrInDelimsWithEndDelim{$delim} do { my $re = _gen_re_str_in_delims($delim); qr/$re\Q$delim\E/ }
Truth table66%2/3
A ||= B
A= $ReStrInDelimsWithEndDelim{$delim}B= do { my $re = _gen_re_str_in_delims($delim); qr/$re\Q$delim\E/ }
ABresult
1X1
011
000
128 33 my $re = _gen_re_str_in_delims($delim);
129 33 qr{$re\Q$delim\E};
130 };
131 }
132  
133 my %RdelSkip;
134 sub _gen_rdel_and_re_skip {
135 158 ▶ my $ldel = shift;
Subroutine _gen_rdel_and_re_skip: called CC=2 SCAR=7.0
136 158 ▶ @{$RdelSkip{$ldel} ||= do {
Condition66%2/3
$RdelSkip{$ldel} ||= do { (my $rdel = $ldel) =~ tr/(<[{/)>]}/; my $re_skip = qr/[^\Q$ldel$rdel\E\\]+/; [$rdel, $re_skip] }
l!l&&r!l&&!r
121370
MC/DC0%0/2
$RdelSkip{$ldel} ||= do { (my $rdel = $ldel) =~ tr/(<[{/)>]}/; my $re_skip = qr/[^\Q$ldel$rdel\E\\]+/; [$rdel, $re_skip] }
$RdelSkip{$ldel} do { (my $rdel = $ldel) =~ tr/(<[{/)>]}/; my $re_skip = qr/[^\Q$ldel$rdel\E\\]+/; [$rdel, $re_skip] }
Truth table66%2/3
A ||= B
A= $RdelSkip{$ldel}B= do { (my $rdel = $ldel) =~ tr/(<[{/)>]}/; my $re_skip = qr/[^\Q$ldel$rdel\E\\]+/; [$rdel, $re_skip] }
ABresult
1X1
011
000
137 37 (my $rdel = $ldel) =~ tr/[({</])}>/;
138 37 my $re_skip = qr{[^\Q$ldel$rdel\E\\]+};
139 37 [$rdel, $re_skip];
140 }};
141 }
142  
143 96 my %RegexpShortcut;
144 sub _gen_re_regexp_shortcut {
145 198 ▶ my ($ldel, $rdel) = @_;
Subroutine _gen_re_regexp_shortcut: called CC=3 SCAR=11.0
146 198 ▶ $RegexpShortcut{$ldel} ||= do {
Condition66%2/3
$RegexpShortcut{$ldel} ||= do { $ldel = quotemeta $ldel; $rdel = $rdel ? quotemeta $rdel : $ldel; qr/(?:[^\\\(\)\{\}\[\]<>$ldel$rdel]*(?:\\.[^\\\(\)\[\]\{\}<>$ldel$rdel]*)*)$rdel/ }
l!l&&r!l&&!r
170280
MC/DC0%0/2
$RegexpShortcut{$ldel} ||= do { $ldel = quotemeta $ldel; $rdel = $rdel ? quotemeta $rdel : $ldel; qr/(?:[^\\\(\)\{\}\[\]<>$ldel$rdel]*(?:\\.[^\\\(\)\[\]\{\}<>$ldel$rdel]*)*)$rdel/ }
$RegexpShortcut{$ldel} do { $ldel = quotemeta $ldel; $rdel = $rdel ? quotemeta $rdel : $ldel; qr/(?:[^\\\(\)\{\}\[\]<>$ldel$rdel]*(?:\\.[^\\\(\)\[\]\{\}<>$ldel$rdel]*)*)$rdel/ }
Truth table66%2/3
A ||= B
A= $RegexpShortcut{$ldel}B= do { $ldel = quotemeta $ldel; $rdel = $rdel ? quotemeta $rdel : $ldel; qr/(?:[^\\\(\)\{\}\[\]<>$ldel$rdel]*(?:\\.[^\\\(\)\[\]\{\}<>$ldel$rdel]*)*)$rdel/ }
ABresult
1X1
011
000
147 28 $ldel = quotemeta $ldel;
148 28 ▶ $rdel = $rdel ? quotemeta $rdel : $ldel;
Branch: 1 branch
BranchTrueFalseTotal
$rdel ? : 17 11 28
149 28 qr{(?:[^\\\(\)\{\}\[\]<>$ldel$rdel]*(?:\\.[^\\\(\)\[\]\{\}<>$ldel$rdel]*)*)$rdel};
150 };
151 }
152  
153 ############################
154  
155 96 my %LOADED;
156  
157 sub new {
158 750 ▶ my ($class, %args) = @_;
Subroutine new: called CC=14 SCAR=26.8
Pod documented
159  
160 750 my %mapping;
161 750 my @parsers = $class->_get_parsers($args{parsers});
162 750 for my $parser (@parsers) {
163 22305 ▶ if (!exists $LOADED{$parser}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $LOADED{$parser}) 2616 19689 22305
164 2616 eval "require $parser; 1";
165 2616 ▶ if (my $error = $@) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $error = $@) 0 2616 2616
166 0 ▶ $parser->can('register') or die "Parser Error: $error";
Branch: 1 branch
BranchTrueFalseTotal
$parser->can("register") or die "Parser Error: $error" 0 0 0
167 }
168 2616 ▶ $LOADED{$parser} = $parser->can('register') ? $parser->register(%args) : undef;
Branch: 1 branch
BranchTrueFalseTotal
$parser->can('register') ? : 2616 0 2616
169 }
170 22305 ▶ my $parser_mapping = $LOADED{$parser} or next;
Branch: 1 branch
BranchTrueFalseTotal
my $parser_mapping = $LOADED{$parser} or next 0 22305 22305
171 22305 for my $type (qw/use no keyword method/) {
172 89220 ▶ next unless exists $parser_mapping->{$type};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $parser_mapping->{$type} 64674 24546 89220
173 24546 for my $name (keys %{$parser_mapping->{$type}}) {
174 $mapping{$type}{$name} = [
175 $parser,
176 129234 ▶ $parser_mapping->{$type}{$name},
Branch: 1 branch
BranchTrueFalseTotal
$type eq 'use' || $type eq 'no' ? : 126991 2243 129234
Condition100%3/3
$type eq "use" or $type eq "no"
l!l&&r!l&&!r
77628493632243
MC/DC100%2/2
$type eq "use" or $type eq "no"
$type eq "use" $type eq "no"
Truth table100%3/3
A or B
A= $type eq "use"B= $type eq "no"
ABresult
1X1
011
000
177 (($type eq 'use' or $type eq 'no') ? ($name) : ()),
178 ];
179 }
180 }
181 22305 ▶ if ($parser->can('register_fqfn')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($parser->can("register_fqfn")) 2232 20073 22305
182 2232 my $fqfn_mapping = $parser->register_fqfn;
183 2232 for my $name (keys %$fqfn_mapping) {
184 6693 my ($module) = $name =~ /^(.+)::/;
185 $mapping{keyword}{$name} = [
186 $parser,
187 6693 $fqfn_mapping->{$name},
188 $module,
189 ];
190 }
191 }
192 }
193 750 $args{_} = \%mapping;
194  
195 750 bless \%args, $class;
196 }
197  
198 sub _get_parsers {
199 750 ▶ my ($class, $list) = @_;
Subroutine _get_parsers: called CC=9 SCAR=22.2
200 750 my @parsers;
201 my %should_ignore;
202 750 ▶ for my $parser (@{$list || [qw/:default/]}) {
Branch: 1 branch
BranchTrueFalseTotal
$list or [":default"] 0 750 750
203 755 ▶ if ($parser eq ':installed') {
Branch: 6 branches
BranchTrueFalseTotal
if ($parser eq ':installed') { } 0 755 755
elsif ($parser eq ':bundled') { } 743 12 755
elsif ($parser eq ':default') { } 5 7 12
elsif ($parser =~ s/^\+//) { } 1 6 7
elsif ($parser =~ s/^\-//) { } 1 5 6
elsif ($parser =~ /^$class\::Parser::/) { } 1 4 5
204 0 require Module::Find;
205 0 push @parsers, Module::Find::findsubmod("$class\::Parser");
206 } elsif ($parser eq ':bundled') {
207 743 push @parsers, map {"$class\::Parser::$_"} @BUNDLED_PARSERS;
208 } elsif ($parser eq ':default') {
209 5 push @parsers, map {"$class\::Parser::$_"} @DEFAULT_PARSERS;
210 } elsif ($parser =~ s/^\+//) {
211 1 push @parsers, $parser;
212 } elsif ($parser =~ s/^\-//) {
213 1 $should_ignore{"$class\::Parser\::$parser"} = 1;
214 } elsif ($parser =~ /^$class\::Parser::/) {
215 1 push @parsers, $parser;
216 } else {
217 4 push @parsers, "$class\::Parser\::$parser";
218 }
219 }
220 750 grep {!$should_ignore{$_}} @parsers;
221 }
222  
223 sub scan_file {
224 83 ▶ my ($self, $file) = @_;
Subroutine scan_file: called CC=3 SCAR=11.1
Pod documented
225 83 _debug("START SCANNING $file") if DEBUG;
226 83 ▶ print STDERR " Scanning $file\n" if $self->{verbose};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"verbose"} 0 83 83
227 83 ▶ open my $fh, '<', $file or croak "Can't open $file: $!";
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, "<", $file or croak("Can't open ${file}: $!") 0 83 83
228 83 my $code = do { local $/; <$fh> };
229 83 $self->{file} = $file;
230 83 $self->scan_string($code);
231 }
232  
233 sub scan_string {
234 750 ▶ my ($self, $string) = @_;
Subroutine scan_string: called CC=9 SCAR=22.8
Pod documented
235  
236 750 ▶ $string = '' unless defined $string;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $string 0 750 750
237  
238 750 my $c = Perl::PrereqScanner::NotQuiteLite::Context->new(%$self);
239  
240 750 ▶ if ($self->{quick}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"quick"}) 0 750 750
241 0 $c->{file_size} = length $string;
242 0 ▶ $self->_skim_string($c, \$string) if $c->{file_size} > 30_000;
Branch: 1 branch
BranchTrueFalseTotal
if $c->{"file_size"} > 30000 0 0 0
243 }
244  
245 # UTF8 BOM
246 750 ▶ if ($string =~ s/\A(\xef\xbb\xbf)//s) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A(\xef\xbb\xbf)//s) 0 750 750
247 0 utf8::decode($string);
248 0 $c->{decoded} = 1;
249 }
250 # Other BOMs (TODO: also decode?)
251 750 $string =~ s/\A(\x00\x00\xfe\xff|\xff\xfe\x00\x00|\xfe\xff|\xff\xfe)//s;
252  
253 # normalize
254 750 if ("\n" eq "\015") {
255 $string =~ s/(?:\015?\012)/\n/gs;
256 } elsif ("\n" eq "\012") {
257 750 $string =~ s/(?:\015\012?)/\n/gs;
258 } elsif ("\n" eq "\015\012") {
259 $string =~ s/(?:\015(?!\012)|(?<!\015)\012)/\n/gs;
260 } else {
261 $string =~ s/(?:\015\012|\015|\012)/\n/gs;
262 }
263 750 $string =~ s/[ \t]+/ /g;
264 750 $string =~ s/(?: *\n)+/\n/gs;
265  
266 # FIXME
267 750 $c->{stack} = [];
268 750 $c->{errors} = [];
269 $c->{callback} = {
270 750 use => \&_use,
271 require => \&_require,
272 no => \&_no,
273 };
274 750 $c->{wants_doc} = 0;
275  
276 750 pos($string) = 0;
277  
278 {
279 750 local $@;
280 759 eval { $self->_scan($c, \$string, 0) };
281 759 ▶ push @{$c->{errors}}, "Scan Error: $@" if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 759 759
282 759 ▶ if ($c->{redo}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c->{"redo"}) 9 750 759
283 9 delete $c->{redo};
284 9 delete $c->{ended};
285 9 @{$c->{stack}} = ();
286 9 redo;
287 }
288 }
289  
290 750 ▶ if (@{$c->{stack}} and !$c->{quick}) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{$c->{"stack"};} and not $c->{"quick"}) 1 749 750
Condition66%2/3
@{$c->{"stack"};} and not $c->{"quick"}
!ll&&!rl&&r
74901
MC/DC50%1/2
@{$c->{"stack"};} and not $c->{"quick"}
@{$c->{"stack"};} not $c->{"quick"}
Truth table66%2/3
A and not(B)
A= @{$c->{"stack"};}B= not $c->{"quick"}
ABresult
0X0
100
111
291 1 require Data::Dump;
292 1 push @{$c->{errors}}, Data::Dump::dump($c->{stack});
293 }
294  
295 750 $c->remove_inner_packages_from_requirements;
296 750 $c->merge_perl;
297  
298 750 $c;
299 }
300  
301 sub _skim_string {
302 0 ▶ my ($self, $c, $rstr) = @_;
Subroutine _skim_string: not called CC=5 SCAR=34.0
303 0 ▶ my $pos = pos($$rstr) || 0;
Condition0%0/2
pos $$rstr || 0
l!l
00
MC/DC0%0/1
pos $$rstr || 0
pos $$rstr
Truth table0%0/2
A
A= pos $$rstr
Aresult
11
00
304 0 my $last_found = 0;
305 0 my $saw_moose;
306 0 my $re = qr/\G.*?\b((?:use|require|no)\s+(?:[A-Za-z][A-Za-z0-9_]*::)*[A-Za-z][A-Za-z0-9_]*)/;
307 0 ▶ while(my ($match) = $$rstr =~ /$re/gc) {
Branch: 1 branch
BranchTrueFalseTotal
if (my($match) = $$rstr =~ /$re/cg) 0 0 0
308 0 $last_found = pos($$rstr) + length $match;
309 0 ▶ if (!$saw_moose and $match =~ /^use\s+(?:Mo(?:o|(?:[ou]se))?X?|MooseX::Declare)\b/) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $saw_moose and $match =~ /^use\s+(?:Mo(?:o|(?:[ou]se))?X?|MooseX::Declare)\b/) 0 0 0
Condition0%0/3
not $saw_moose and $match =~ /^use\s+(?:Mo(?:o|(?:[ou]se))?X?|MooseX::Declare)\b/
!ll&&!rl&&r
000
MC/DC0%0/2
not $saw_moose and $match =~ /^use\s+(?:Mo(?:o|(?:[ou]se))?X?|MooseX::Declare)\b/
not $saw_moose $match =~ /^use\s+(?:Mo(?:o|(?:[ou]se))?X?|MooseX::Declare)\b/
Truth table0%0/3
not(A) and B
A= not $saw_mooseB= $match =~ /^use\s+(?:Mo(?:o|(?:[ou]se))?X?|MooseX::Declare)\b/
ABresult
0X0
100
111
310 0 $re = qr/\G.*?\b((?:(?:use|require|no)\s+(?:[A-Za-z][A-Za-z0-9_]*::)*[A-Za-z][A-Za-z0-9_]*)|(?:(?:extends|with)\s+(?:["']|q[a-z]*[^a-zA-Z0-9_])(?:[A-Za-z][A-Za-z0-9_]*::)*[A-Za-z][A-Za-z0-9_]*))/;
311 0 $saw_moose = 1;
312 }
313 }
314 0 $c->{last_found_by_skimming} = $last_found;
315 0 pos($$rstr) = $pos;
316 }
317  
318 sub _scan {
319 3170 ▶ my ($self, $c, $rstr, $parent_scope) = @_;
Subroutine _scan: called CC=427 SCAR=71.1
320  
321 3170 ▶ if (@{$c->{stack}} > 90) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{$c->{"stack"};} > 90) 1 3169 3170
322 1 _error("deep recursion found");
323 1 $c->{ended} = 1;
324 }
325  
326 3170 _dump_stack($c, "BEGIN SCOPE") if DEBUG;
327  
328 # found __DATA|END__ somewhere?
329 3170 ▶ return $c if $c->{ended};
Branch: 1 branch
BranchTrueFalseTotal
if $c->{"ended"} 1 3169 3170
330  
331 3169 my $wants_doc = $c->{wants_doc};
332 3169 my $line_top = 1;
333 3169 my $waiting_for_a_block;
334  
335 3169 my $current_scope = 0;
336 3169 my ($token, $token_desc, $token_type) = ('', '', '');
337 3169 my ($prev_token, $prev_token_type) = ('', '');
338 3169 my ($stack, $unstack);
339 3169 my (@keywords, @tokens, @scope_tokens);
340 3169 my $caller_package;
341 3169 my $prepend;
342 3169 my ($pos, $c1);
343 3169 my $prev_pos = 0;
344 3169 ▶ while(defined($pos = pos($$rstr))) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($pos = pos $$rstr)) 47953 0 47953
345 47953 $token = undef;
346  
347 # cache first letter for better performance
348 47953 $c1 = substr($$rstr, $pos, 1);
349  
350 47953 ▶ if ($line_top) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line_top) 7778 40175 47953
351 7778 ▶ if ($c1 eq '=') {
Branch: 1 branch
BranchTrueFalseTotal
if ($c1 eq "=") 10 7768 7778
352 10 ▶ if ($$rstr =~ m/\G($re_pod)/gcsx) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$rstr =~ /\G($re_pod)/cgsx) 10 0 10
353 10 ▶ ($token, $token_desc, $token_type) = ($1, 'POD', '') if $wants_doc;
Branch: 1 branch
BranchTrueFalseTotal
if $wants_doc 0 10 10
354 10 next;
355 }
356 }
357 }
358 47943 ▶ if ($c1 eq "\n") {
Branch: 1 branch
BranchTrueFalseTotal
if ($c1 eq "\n") 4340 43603 47943
359 4340 pos($$rstr)++;
360 4340 $line_top = 1;
361 4340 next;
362 }
363  
364 43603 $line_top = 0;
365 # ignore whitespaces
366 43603 ▶ if ($c1 eq ' ') {
Branch: 34 branches
BranchTrueFalseTotal
if ($c1 eq ' ') { } 15164 28439 43603
elsif ($c1 eq '_') { } 57 28382 28439
elsif ($c1 eq '#') { } 259 28123 28382
elsif ($c1 eq ';') { } 2759 25364 28123
elsif ($c1 eq '$') { } 3752 21612 25364
elsif ($c1 eq '@') { } 317 21295 21612
elsif ($c1 eq '%') { } 117 21178 21295
elsif ($c1 eq '*') { } 89 21089 21178
elsif ($c1 eq '&') { } 129 20960 21089
elsif ($c1 eq '\\') { } 70 20890 20960
elsif ($c1 eq '-') { } 1267 19623 20890
elsif ($c1 eq '"') { } 436 19187 19623
elsif ($c1 eq q[']) { } 865 18322 19187
elsif ($c1 eq '`') { } 0 18322 18322
elsif ($c1 eq '/') { } 144 18178 18322
elsif ($c1 eq '{') { } 1813 16365 18178
elsif ($c1 eq '[') { } 395 15970 16365
elsif ($c1 eq '(') { } 1500 14470 15970
elsif ($c1 eq '}') { } 1037 13433 14470
elsif ($c1 eq ']') { } 96 13337 13433
elsif ($c1 eq ')') { } 1090 12247 13337
elsif ($c1 eq '<') { } 93 12154 12247
elsif ($c1 eq ':') { } 293 11861 12154
elsif ($c1 eq '=') { } 1734 10127 11861
elsif ($c1 eq '>') { } 54 10073 10127
elsif ($c1 eq '+') { } 162 9911 10073
elsif ($c1 eq '|') { } 93 9818 9911
elsif ($c1 eq '^') { } 4 9814 9818
elsif ($c1 eq '!') { } 51 9763 9814
elsif ($c1 eq '~') { } 2 9761 9763
elsif ($c1 eq ',') { } 1393 8368 9761
elsif ($c1 eq '?') { } 131 8237 8368
elsif ($c1 eq '.') { } 195 8042 8237
elsif ($c1 eq '0') { } 247 7795 8042
367 15164 pos($$rstr)++;
368 15164 next;
369 } elsif ($c1 eq '_') {
370 57 my $c2 = substr($$rstr, $pos + 1, 1);
371 57 ▶ if ($c2 eq '_' and $$rstr =~ m/\G(__(?:DATA|END)__\b)(?!\s*=>)/gc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c2 eq "_" and $$rstr =~ /\G(__(?:DATA|END)__\b)(?!\s*=>)/cg) 1 56 57
Condition100%3/3
$c2 eq "_" and $$rstr =~ /\G(__(?:DATA|END)__\b)(?!\s*=>)/cg
!ll&&!rl&&r
4971
MC/DC100%2/2
$c2 eq "_" and $$rstr =~ /\G(__(?:DATA|END)__\b)(?!\s*=>)/cg
$c2 eq "_" $$rstr =~ /\G(__(?:DATA|END)__\b)(?!\s*=>)/cg
Truth table100%3/3
A and B
A= $c2 eq "_"B= $$rstr =~ /\G(__(?:DATA|END)__\b)(?!\s*=>)/cg
ABresult
0X0
100
111
372 1 ▶ if ($wants_doc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($wants_doc) { } 0 1 1
373 0 ($token, $token_desc, $token_type) = ($1, 'END_OF_CODE', '');
374 0 next;
375 } else {
376 1 $c->{ended} = 1;
377 1 last;
378 }
379 }
380 } elsif ($c1 eq '#') {
381 259 ▶ if ($$rstr =~ m{\G($re_comment)}gcs) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$rstr =~ /\G($re_comment)/cgs) 259 0 259
382 259 ▶ ($token, $token_desc, $token_type) = ($1, 'COMMENT', '') if $wants_doc;
Branch: 1 branch
BranchTrueFalseTotal
if $wants_doc 0 259 259
383 259 $line_top = 1;
384 259 next;
385 }
386 } elsif ($c1 eq ';') {
387 2759 pos($$rstr) = $pos + 1;
388 2759 ($token, $token_desc, $token_type) = ($c1, ';', ';');
389 2759 $current_scope |= F_STATEMENT_END|F_EXPR_END;
390 2759 next;
391 } elsif ($c1 eq '$') {
392 3752 my $c2 = substr($$rstr, $pos + 1, 1);
393 3752 ▶ if ($c2 eq '#') {
Branch: 6 branches
BranchTrueFalseTotal
if ($c2 eq '#') { } 32 3720 3752
elsif ($c2 eq '$') { } 44 3676 3720
elsif ($c2 eq '{') { } 10 3666 3676
elsif ($c2 eq '*' and $prev_token_type eq 'ARROW') { } 2 3664 3666
elsif ($c2 eq '+' or $c2 eq '-') { } 2 3662 3664
elsif ($$rstr =~ /$g_re_scalar_variable/cg) { } 3660 2 3662
394 32 ▶ if (substr($$rstr, $pos + 2, 1) eq '{') {
Branch: 3 branches
BranchTrueFalseTotal
if (substr($$rstr, $pos + 2, 1) eq '{') { } 2 30 32
elsif ($$rstr =~ /\G(\$\#(?:$re_namespace))/cg) { } 14 16 30
elsif ($prev_token_type eq 'ARROW') { } 2 14 16
395 2 ▶ if ($$rstr =~ m{\G(\$\#\{[\w\s]+\})}gc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$rstr =~ /\G(\$\#\{[\w\s]+\})/cg) { } 0 2 2
396 0 ($token, $token_desc, $token_type) = ($1, '$#{NAME}', 'EXPR');
397 0 next;
398 } else {
399 2 pos($$rstr) = $pos + 3;
400 2 ($token, $token_desc, $token_type) = ('$#{', '$#{', 'EXPR');
401 2 $stack = [$token, $pos, 'VARIABLE'];
402 2 next;
403 }
404 } elsif ($$rstr =~ m{\G(\$\#(?:$re_namespace))}gc) {
405 14 ($token, $token_desc, $token_type) = ($1, '$#NAME', 'EXPR');
406 14 next;
407 } elsif ($prev_token_type eq 'ARROW') {
408 2 my $c3 = substr($$rstr, $pos + 2, 1);
409 2 ▶ if ($c3 eq '*') {
Branch: 1 branch
BranchTrueFalseTotal
if ($c3 eq "*") 2 0 2
410 2 pos($$rstr) = $pos + 3;
411 2 ($token, $token_desc, $token_type) = ('$#*', 'VARIABLE', 'VARIABLE');
412 2 $c->add_perl('5.020', '->$#*');
413 2 next;
414 }
415 } else {
416 14 pos($$rstr) = $pos + 2;
417 14 ($token, $token_desc, $token_type) = ('$#', 'SPECIAL_VARIABLE', 'EXPR');
418 14 next;
419 }
420 } elsif ($c2 eq '$') {
421 44 ▶ if ($$rstr =~ m{\G(\$(?:\$)+(?:$re_namespace))}gc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$rstr =~ /\G(\$(?:\$)+(?:$re_namespace))/cg) { } 42 2 44
422 42 ($token, $token_desc, $token_type) = ($1, '$$NAME', 'VARIABLE');
423 42 next;
424 } else {
425 2 pos($$rstr) = $pos + 2;
426 2 ($token, $token_desc, $token_type) = ('$$', 'SPECIAL_VARIABLE', 'EXPR');
427 2 next;
428 }
429 } elsif ($c2 eq '{') {
430 10 ▶ if ($$rstr =~ m{\G(\$\{[\w\s]+\})}gc) {
Branch: 2 branches
BranchTrueFalseTotal
if ($$rstr =~ /\G(\$\{[\w\s]+\})/cg) { } 2 8 10
elsif ($$rstr =~ /\G(\$\{\^[A-Z_]+\})/cg) { } 0 8 8
431 2 ($token, $token_desc, $token_type) = ($1, '${NAME}', 'VARIABLE');
432 2 ▶ if ($prev_token_type eq 'KEYWORD' and $c->token_expects_fh_or_block_list($prev_token)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($prev_token_type eq "KEYWORD" and $c->token_expects_fh_or_block_list($prev_token)) 0 2 2
Condition33%1/3
$prev_token_type eq "KEYWORD" and $c->token_expects_fh_or_block_list($prev_token)
!ll&&!rl&&r
200
MC/DC0%0/2
$prev_token_type eq "KEYWORD" and $c->token_expects_fh_or_block_list($prev_token)
$prev_token_type eq "KEYWORD" $c->token_expects_fh_or_block_list($prev_token)
Truth table33%1/3
A and B
A= $prev_token_type eq "KEYWORD"B= $c->token_expects_fh_or_block_list($prev_token)
ABresult
0X0
100
111
433 0 $token_type = '';
434 0 next;
435 }
436 } elsif ($$rstr =~ m{\G(\$\{\^[A-Z_]+\})}gc) {
437 0 ($token, $token_desc, $token_type) = ($1, '${^NAME}', 'VARIABLE');
438 0 ▶ if ($token eq '${^CAPTURE}' or $token eq '${^CAPTURE_ALL}') {
Branch: 1 branch
BranchTrueFalseTotal
if ($token eq "\${^CAPTURE}" or $token eq "\${^CAPTURE_ALL}") 0 0 0
Condition0%0/3
$token eq "\${^CAPTURE}" or $token eq "\${^CAPTURE_ALL}"
l!l&&r!l&&!r
000
MC/DC0%0/2
$token eq "\${^CAPTURE}" or $token eq "\${^CAPTURE_ALL}"
$token eq "\${^CAPTURE}" $token eq "\${^CAPTURE_ALL}"
Truth table0%0/3
A or B
A= $token eq "\${^CAPTURE}"B= $token eq "\${^CAPTURE_ALL}"
ABresult
1X1
011
000
439 0 $c->add_perl('5.026', '${^CAPTURE}');
440 }
441 0 ▶ if ($token eq '${^SAFE_LOCALES}') {
Branch: 1 branch
BranchTrueFalseTotal
if ($token eq "\${^SAFE_LOCALES}") 0 0 0
442 0 $c->add_perl('5.028', '${^SAFE_LOCALES}');
443 }
444 } else {
445 8 pos($$rstr) = $pos + 2;
446 8 ($token, $token_desc, $token_type) = ('${', '${', 'VARIABLE');
447 8 $stack = [$token, $pos, 'VARIABLE'];
448 }
449 10 ▶ if ($parent_scope & F_EXPECTS_BRACKET) {
Branch: 1 branch
BranchTrueFalseTotal
if ($parent_scope & 8) 3 7 10
450 3 $current_scope |= F_SCOPE_END;
451 }
452 10 next;
453 ▶ } elsif ($c2 eq '*' and $prev_token_type eq 'ARROW') {
Condition66%2/3
$c2 eq "*" and $prev_token_type eq "ARROW"
!ll&&!rl&&r
366402
MC/DC50%1/2
$c2 eq "*" and $prev_token_type eq "ARROW"
$c2 eq "*" $prev_token_type eq "ARROW"
Truth table66%2/3
A and B
A= $c2 eq "*"B= $prev_token_type eq "ARROW"
ABresult
0X0
100
111
454 2 pos($$rstr) = $pos + 2;
455 2 ($token, $token_desc, $token_type) = ('$*', '$*', 'VARIABLE');
456 2 $c->add_perl('5.020', '->$*');
457 2 next;
458 ▶ } elsif ($c2 eq '+' or $c2 eq '-') {
Condition100%3/3
$c2 eq "+" or $c2 eq "-"
l!l&&r!l&&!r
113662
MC/DC100%2/2
$c2 eq "+" or $c2 eq "-"
$c2 eq "+" $c2 eq "-"
Truth table100%3/3
A or B
A= $c2 eq "+"B= $c2 eq "-"
ABresult
1X1
011
000
459 2 pos($$rstr) = $pos + 2;
460 2 ($token, $token_desc, $token_type) = ('$'.$c2, 'SPECIAL_VARIABLE', 'VARIABLE');
461 2 $c->add_perl('5.010', '$'.$c2);
462 2 next;
463 } elsif ($$rstr =~ m{$g_re_scalar_variable}gc) {
464 3660 ($token, $token_desc, $token_type) = ($1, '$NAME', 'VARIABLE');
465 3660 next;
466 } else {
467 2 pos($$rstr) = $pos + 1;
468 2 ($token, $token_desc, $token_type) = ($c1, $c1, 'VARIABLE');
469 2 next;
470 }
471 } elsif ($c1 eq '@') {
472 317 my $c2 = substr($$rstr, $pos + 1, 1);
473 317 ▶ if ($c2 eq '_' and $$rstr =~ m{\G\@_\b}gc) {
Branch: 7 branches
BranchTrueFalseTotal
if ($c2 eq '_' and $$rstr =~ /\G\@_\b/cg) { } 118 199 317
elsif ($c2 eq '{') { } 37 162 199
elsif ($c2 eq '$') { } 37 125 162
elsif ($prev_token_type eq 'ARROW') { } 11 114 125
elsif ($c2 eq '[') { } 1 113 114
elsif ($c2 eq '+' or $c2 eq '-') { } 2 111 113
elsif ($$rstr =~ /\G(\@(?:$re_namespace))/cg) { } 111 0 111
Condition100%3/3
$c2 eq "_" and $$rstr =~ /\G\@_\b/cg
!ll&&!rl&&r
1945118
MC/DC100%2/2
$c2 eq "_" and $$rstr =~ /\G\@_\b/cg
$c2 eq "_" $$rstr =~ /\G\@_\b/cg
Truth table100%3/3
A and B
A= $c2 eq "_"B= $$rstr =~ /\G\@_\b/cg
ABresult
0X0
100
111
474 118 ($token, $token_desc, $token_type) = ('@_', 'SPECIAL_VARIABLE', 'VARIABLE');
475 118 next;
476 } elsif ($c2 eq '{') {
477 37 ▶ if ($$rstr =~ m{\G(\@\{[\w\s]+\})}gc) {
Branch: 2 branches
BranchTrueFalseTotal
if ($$rstr =~ /\G(\@\{[\w\s]+\})/cg) { } 0 37 37
elsif ($$rstr =~ /\G(\@\{\^[A-Z_]+\})/cg) { } 2 35 37
478 0 ($token, $token_desc, $token_type) = ($1, '@{NAME}', 'VARIABLE');
479 0 ▶ if ($token eq '@{^CAPTURE}' or $token eq '@{^CAPTURE_ALL}') {
Branch: 1 branch
BranchTrueFalseTotal
if ($token eq "\@{^CAPTURE}" or $token eq "\@{^CAPTURE_ALL}") 0 0 0
Condition0%0/3
$token eq "\@{^CAPTURE}" or $token eq "\@{^CAPTURE_ALL}"
l!l&&r!l&&!r
000
MC/DC0%0/2
$token eq "\@{^CAPTURE}" or $token eq "\@{^CAPTURE_ALL}"
$token eq "\@{^CAPTURE}" $token eq "\@{^CAPTURE_ALL}"
Truth table0%0/3
A or B
A= $token eq "\@{^CAPTURE}"B= $token eq "\@{^CAPTURE_ALL}"
ABresult
1X1
011
000
480 0 $c->add_perl('5.026', '@{^CAPTURE}');
481 }
482 } elsif ($$rstr =~ m{\G(\@\{\^[A-Z_]+\})}gc) {
483 2 ($token, $token_desc, $token_type) = ($1, '@{^NAME}', 'VARIABLE');
484 2 ▶ if ($token eq '@{^CAPTURE}' or $token eq '@{^CAPTURE_ALL}') {
Branch: 1 branch
BranchTrueFalseTotal
if ($token eq "\@{^CAPTURE}" or $token eq "\@{^CAPTURE_ALL}") 2 0 2
Condition33%1/3
$token eq "\@{^CAPTURE}" or $token eq "\@{^CAPTURE_ALL}"
l!l&&r!l&&!r
200
MC/DC0%0/2
$token eq "\@{^CAPTURE}" or $token eq "\@{^CAPTURE_ALL}"
$token eq "\@{^CAPTURE}" $token eq "\@{^CAPTURE_ALL}"
Truth table33%1/3
A or B
A= $token eq "\@{^CAPTURE}"B= $token eq "\@{^CAPTURE_ALL}"
ABresult
1X1
011
000
485 2 $c->add_perl('5.026', '@{^CAPTURE}');
486 }
487 } else {
488 35 pos($$rstr) = $pos + 2;
489 35 ($token, $token_desc, $token_type) = ('@{', '@{', 'VARIABLE');
490 35 $stack = [$token, $pos, 'VARIABLE'];
491 }
492 37 ▶ if ($prev_token_type eq 'ARROW') {
Branch: 1 branch
BranchTrueFalseTotal
if ($prev_token_type eq "ARROW") 5 32 37
493 5 $c->add_perl('5.020', '->@{}');
494 }
495 37 ▶ if ($parent_scope & F_EXPECTS_BRACKET) {
Branch: 1 branch
BranchTrueFalseTotal
if ($parent_scope & 8) 0 37 37
496 0 $current_scope |= F_SCOPE_END;
497 }
498 37 next;
499 } elsif ($c2 eq '$') {
500 37 ▶ if ($$rstr =~ m{\G(\@\$(?:$re_namespace))}gc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$rstr =~ /\G(\@\$(?:$re_namespace))/cg) { } 35 2 37
501 35 ($token, $token_desc, $token_type) = ($1, '@$NAME', 'VARIABLE');
502 35 next;
503 } else {
504 2 pos($$rstr) = $pos + 2;
505 2 ($token, $token_desc, $token_type) = ('@$', '@$', 'VARIABLE');
506 2 next;
507 }
508 } elsif ($prev_token_type eq 'ARROW') {
509 # postderef
510 11 ▶ if ($c2 eq '*') {
Branch: 1 branch
BranchTrueFalseTotal
if ($c2 eq '*') { } 5 6 11
511 5 pos($$rstr) = $pos + 2;
512 5 ($token, $token_desc, $token_type) = ('@*', '@*', 'VARIABLE');
513 5 $c->add_perl('5.020', '->@*');
514 5 next;
515 } else {
516 6 pos($$rstr) = $pos + 1;
517 6 ($token, $token_desc, $token_type) = ('@', '@', 'VARIABLE');
518 6 $c->add_perl('5.020', '->@');
519 6 next;
520 }
521 } elsif ($c2 eq '[') {
522 1 pos($$rstr) = $pos + 2;
523 1 ($token, $token_desc, $token_type) = ('@[', 'SPECIAL_VARIABLE', 'VARIABLE');
524 1 next;
525 ▶ } elsif ($c2 eq '+' or $c2 eq '-') {
Condition100%3/3
$c2 eq "+" or $c2 eq "-"
l!l&&r!l&&!r
11111
MC/DC100%2/2
$c2 eq "+" or $c2 eq "-"
$c2 eq "+" $c2 eq "-"
Truth table100%3/3
A or B
A= $c2 eq "+"B= $c2 eq "-"
ABresult
1X1
011
000
526 2 pos($$rstr) = $pos + 2;
527 2 ($token, $token_desc, $token_type) = ('@'.$c2, 'SPECIAL_VARIABLE', 'VARIABLE');
528 2 $c->add_perl('5.010', '@'.$c2);
529 2 next;
530 } elsif ($$rstr =~ m{\G(\@(?:$re_namespace))}gc) {
531 111 ($token, $token_desc, $token_type) = ($1, '@NAME', 'VARIABLE');
532 111 next;
533 } else {
534 0 pos($$rstr) = $pos + 1;
535 0 ($token, $token_desc, $token_type) = ($c1, $c1, 'VARIABLE');
536 0 next;
537 }
538 } elsif ($c1 eq '%') {
539 117 my $c2 = substr($$rstr, $pos + 1, 1);
540 117 ▶ if ($c2 eq '{') {
Branch: 7 branches
BranchTrueFalseTotal
if ($c2 eq '{') { } 42 75 117
elsif ($c2 eq '=') { } 1 74 75
elsif ($$rstr =~ /\G(\%\$(?:$re_namespace))/cg) { } 5 69 74
elsif ($$rstr =~ /\G(\%(?:$re_namespace))/cg) { } 57 12 69
elsif ($prev_token_type eq 'VARIABLE' or $prev_token_type eq 'EXPR') { } 4 8 12
elsif ($prev_token_type eq 'ARROW') { } 6 2 8
elsif ($c2 eq '+' or $c2 eq '-') { } 2 0 2
541 42 ▶ if ($$rstr =~ m{\G(\%\{[\w\s]+\})}gc) {
Branch: 2 branches
BranchTrueFalseTotal
if ($$rstr =~ /\G(\%\{[\w\s]+\})/cg) { } 0 42 42
elsif ($$rstr =~ /\G(\%\{\^[A-Z_]+\})/cg) { } 2 40 42
542 0 ($token, $token_desc, $token_type) = ($1, '%{NAME}', 'VARIABLE');
543 } elsif ($$rstr =~ m{\G(\%\{\^[A-Z_]+\})}gc) {
544 2 ($token, $token_desc, $token_type) = ($1, '%{^NAME}', 'VARIABLE');
545 2 ▶ if ($token eq '%{^CAPTURE}' or $token eq '%{^CAPTURE_ALL}') {
Branch: 1 branch
BranchTrueFalseTotal
if ($token eq "%{^CAPTURE}" or $token eq "%{^CAPTURE_ALL}") 2 0 2
Condition66%2/3
$token eq "%{^CAPTURE}" or $token eq "%{^CAPTURE_ALL}"
l!l&&r!l&&!r
110
MC/DC0%0/2
$token eq "%{^CAPTURE}" or $token eq "%{^CAPTURE_ALL}"
$token eq "%{^CAPTURE}" $token eq "%{^CAPTURE_ALL}"
Truth table66%2/3
A or B
A= $token eq "%{^CAPTURE}"B= $token eq "%{^CAPTURE_ALL}"
ABresult
1X1
011
000
546 2 $c->add_perl('5.026', '%{^CAPTURE}');
547 }
548 } else {
549 40 pos($$rstr) = $pos + 2;
550 40 ($token, $token_desc, $token_type) = ('%{', '%{', 'VARIABLE');
551 40 $stack = [$token, $pos, 'VARIABLE'];
552 }
553 42 ▶ if ($prev_token_type eq 'ARROW') {
Branch: 1 branch
BranchTrueFalseTotal
if ($prev_token_type eq "ARROW") 4 38 42
554 4 $c->add_perl('5.020', '->%{');
555 }
556 42 ▶ if ($parent_scope & F_EXPECTS_BRACKET) {
Branch: 1 branch
BranchTrueFalseTotal
if ($parent_scope & 8) 0 42 42
557 0 $current_scope |= F_SCOPE_END;
558 }
559 42 next;
560 } elsif ($c2 eq '=') {
561 1 pos($$rstr) = $pos + 2;
562 1 ($token, $token_desc, $token_type) = ('%=', '%=', 'OP');
563 1 next;
564 } elsif ($$rstr =~ m{\G(\%\$(?:$re_namespace))}gc) {
565 5 ($token, $token_desc, $token_type) = ($1, '%$NAME', 'VARIABLE');
566 5 next;
567 } elsif ($$rstr =~ m{\G(\%(?:$re_namespace))}gc) {
568 57 ($token, $token_desc, $token_type) = ($1, '%NAME', 'VARIABLE');
569 57 next;
570 ▶ } elsif ($prev_token_type eq 'VARIABLE' or $prev_token_type eq 'EXPR') {
Condition66%2/3
$prev_token_type eq "VARIABLE" or $prev_token_type eq "EXPR"
l!l&&r!l&&!r
048
MC/DC50%1/2
$prev_token_type eq "VARIABLE" or $prev_token_type eq "EXPR"
$prev_token_type eq "VARIABLE" $prev_token_type eq "EXPR"
Truth table66%2/3
A or B
A= $prev_token_type eq "VARIABLE"B= $prev_token_type eq "EXPR"
ABresult
1X1
011
000
571 4 pos($$rstr) = $pos + 1;
572 4 ($token, $token_desc, $token_type) = ($c1, $c1, 'OP');
573 4 next;
574 } elsif ($prev_token_type eq 'ARROW') {
575 6 ▶ if ($c2 eq '*') {
Branch: 1 branch
BranchTrueFalseTotal
if ($c2 eq '*') { } 2 4 6
576 2 pos($$rstr) = $pos + 2;
577 2 ($token, $token_desc, $token_type) = ('%*', '%*', 'VARIABLE');
578 2 $c->add_perl('5.020', '->%*');
579 2 next;
580 } else {
581 4 pos($$rstr) = $pos + 1;
582 4 ($token, $token_desc, $token_type) = ('%', '%', 'VARIABLE');
583 4 $c->add_perl('5.020', '->%');
584 4 next;
585 }
586 ▶ } elsif ($c2 eq '+' or $c2 eq '-') {
Condition66%2/3
$c2 eq "+" or $c2 eq "-"
l!l&&r!l&&!r
110
MC/DC0%0/2
$c2 eq "+" or $c2 eq "-"
$c2 eq "+" $c2 eq "-"
Truth table66%2/3
A or B
A= $c2 eq "+"B= $c2 eq "-"
ABresult
1X1
011
000
587 2 pos($$rstr) = $pos + 2;
588 2 ($token, $token_desc, $token_type) = ('%'.$c2, 'SPECIAL_VARIABLE', 'VARIABLE');
589 2 $c->add_perl('5.010', '%'.$c2);
590 2 next;
591 } else {
592 0 pos($$rstr) = $pos + 1;
593 0 ($token, $token_desc, $token_type) = ($c1, $c1, 'VARIABLE');
594 0 next;
595 }
596 } elsif ($c1 eq '*') {
597 89 my $c2 = substr($$rstr, $pos + 1, 1);
598 89 ▶ if ($c2 eq '{') {
Branch: 4 branches
BranchTrueFalseTotal
if ($c2 eq '{') { } 15 74 89
elsif ($c2 eq '*') { } 3 71 74
elsif ($c2 eq '=') { } 2 69 71
elsif ($$rstr =~ /\G(\*(?:$re_namespace))/cg) { } 29 40 69
599 15 ▶ if ($prev_token_type eq 'ARROW') {
Branch: 2 branches
BranchTrueFalseTotal
if ($prev_token_type eq 'ARROW') { } 2 13 15
elsif ($$rstr =~ /\G(\*\{[\w\s]+\})/cg) { } 0 13 13
600 2 pos($$rstr) = $pos + 2;
601 2 ($token, $token_desc, $token_type) = ('*{', '*{', 'VARIABLE');
602 2 $c->add_perl('5.020', '->*{}');
603 2 next;
604 } elsif ($$rstr =~ m{\G(\*\{[\w\s]+\})}gc) {
605 0 ($token, $token_desc, $token_type) = ($1, '*{NAME}', 'VARIABLE');
606 0 ▶ if ($prev_token eq 'KEYWORD' and $c->token_expects_fh_or_block_list($prev_token)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($prev_token eq "KEYWORD" and $c->token_expects_fh_or_block_list($prev_token)) 0 0 0
Condition0%0/3
$prev_token eq "KEYWORD" and $c->token_expects_fh_or_block_list($prev_token)
!ll&&!rl&&r
000
MC/DC0%0/2
$prev_token eq "KEYWORD" and $c->token_expects_fh_or_block_list($prev_token)
$prev_token eq "KEYWORD" $c->token_expects_fh_or_block_list($prev_token)
Truth table0%0/3
A and B
A= $prev_token eq "KEYWORD"B= $c->token_expects_fh_or_block_list($prev_token)
ABresult
0X0
100
111
607 0 $token_type = '';
608 0 next;
609 }
610 } else {
611 13 pos($$rstr) = $pos + 2;
612 13 ($token, $token_desc, $token_type) = ('*{', '*{', 'VARIABLE');
613 13 $stack = [$token, $pos, 'VARIABLE'];
614 }
615 13 ▶ if ($parent_scope & F_EXPECTS_BRACKET) {
Branch: 1 branch
BranchTrueFalseTotal
if ($parent_scope & 8) 0 13 13
616 0 $current_scope |= F_SCOPE_END;
617 }
618 13 next;
619 } elsif ($c2 eq '*') {
620 3 ▶ if (substr($$rstr, $pos + 2, 1) eq '=') {
Branch: 2 branches
BranchTrueFalseTotal
if (substr($$rstr, $pos + 2, 1) eq '=') { } 0 3 3
elsif ($prev_token_type eq 'ARROW') { } 2 1 3
621 0 pos($$rstr) = $pos + 3;
622 0 ($token, $token_desc, $token_type) = ('**=', '**=', 'OP');
623 0 next;
624 } elsif ($prev_token_type eq 'ARROW') {
625 2 pos($$rstr) = $pos + 2;
626 2 ($token, $token_desc, $token_type) = ('**', '**', 'VARIABLE');
627 2 $c->add_perl('5.020', '->**');
628 2 next;
629 } else {
630 1 pos($$rstr) = $pos + 2;
631 1 ($token, $token_desc, $token_type) = ('**', '**', 'OP');
632 1 next;
633 }
634 } elsif ($c2 eq '=') {
635 2 pos($$rstr) = $pos + 2;
636 2 ($token, $token_desc, $token_type) = ('*=', '*=', 'OP');
637 2 next;
638 } elsif ($$rstr =~ m{\G(\*(?:$re_namespace))}gc) {
639 29 ($token, $token_desc, $token_type) = ($1, '*NAME', 'VARIABLE');
640 29 next;
641 } else {
642 40 pos($$rstr) = $pos + 1;
643 40 ($token, $token_desc, $token_type) = ($c1, $c1, 'OP');
644 40 next;
645 }
646 } elsif ($c1 eq '&') {
647 129 my $c2 = substr($$rstr, $pos + 1, 1);
648 129 ▶ if ($c2 eq '&') {
Branch: 7 branches
BranchTrueFalseTotal
if ($c2 eq '&') { } 58 71 129
elsif ($c2 eq '=') { } 0 71 71
elsif ($c2 eq '{') { } 8 63 71
elsif ($c2 eq '.') { } 2 61 63
elsif ($$rstr =~ /\G(\&(?:$re_namespace))/cg) { } 48 13 61
elsif ($$rstr =~ /\G(\&\$(?:$re_namespace))/cg) { } 3 10 13
elsif ($prev_token_type eq 'ARROW') { } 2 8 10
649 58 pos($$rstr) = $pos + 2;
650 58 ($token, $token_desc, $token_type) = ('&&', '&&', 'OP');
651 58 next;
652 } elsif ($c2 eq '=') {
653 0 pos($$rstr) = $pos + 2;
654 0 ($token, $token_desc, $token_type) = ('&=', '&=', 'OP');
655 0 next;
656 } elsif ($c2 eq '{') {
657 8 ▶ if ($$rstr =~ m{\G(\&\{[\w\s]+\})}gc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$rstr =~ /\G(\&\{[\w\s]+\})/cg) { } 0 8 8
658 0 ($token, $token_desc, $token_type) = ($1, '&{NAME}', 'EXPR');
659 } else {
660 8 pos($$rstr) = $pos + 2;
661 8 ($token, $token_desc, $token_type) = ('&{', '&{', 'EXPR');
662 8 $stack = [$token, $pos, 'FUNC'];
663 }
664 8 ▶ if ($parent_scope & F_EXPECTS_BRACKET) {
Branch: 1 branch
BranchTrueFalseTotal
if ($parent_scope & 8) 0 8 8
665 0 $current_scope |= F_SCOPE_END;
666 }
667 8 next;
668 } elsif ($c2 eq '.') {
669 2 ▶ if (substr($$rstr, $pos + 2, 1) eq '=') {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($$rstr, $pos + 2, 1) eq '=') { } 1 1 2
670 1 pos($$rstr) = $pos + 3;
671 1 ($token, $token_desc, $token_type) = ('&.=', '&.=', 'OP');
672 } else {
673 1 pos($$rstr) = $pos + 2;
674 1 ($token, $token_desc, $token_type) = ('&.', '&.', 'OP');
675 }
676 2 $c->add_perl('5.022', '&.');
677 2 next;
678 } elsif ($$rstr =~ m{\G(\&(?:$re_namespace))}gc) {
679 48 ($token, $token_desc, $token_type) = ($1, '&NAME', 'EXPR');
680 48 next;
681 } elsif ($$rstr =~ m{\G(\&\$(?:$re_namespace))}gc) {
682 3 ($token, $token_desc, $token_type) = ($1, '&$NAME', 'EXPR');
683 3 next;
684 } elsif ($prev_token_type eq 'ARROW') {
685 2 ▶ if ($c2 eq '*') {
Branch: 1 branch
BranchTrueFalseTotal
if ($c2 eq "*") 2 0 2
686 2 pos($$rstr) = $pos + 2;
687 2 ($token, $token_desc, $token_type) = ('&*', '&*', 'VARIABLE');
688 2 $c->add_perl('5.020', '->&*');
689 2 next;
690 }
691 } else {
692 8 pos($$rstr) = $pos + 1;
693 8 ($token, $token_desc, $token_type) = ($c1, $c1, 'OP');
694 8 next;
695 }
696 } elsif ($c1 eq '\\') {
697 70 my $c2 = substr($$rstr, $pos + 1, 1);
698 70 ▶ if ($c2 eq '{') {
Branch: 1 branch
BranchTrueFalseTotal
if ($c2 eq '{') { } 0 70 70
699 0 ▶ if ($$rstr =~ m{\G(\\\{[\w\s]+\})}gc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$rstr =~ /\G(\\\{[\w\s]+\})/cg) { } 0 0 0
700 0 ($token, $token_desc, $token_type) = ($1, '\\{NAME}', 'VARIABLE');
701 } else {
702 0 pos($$rstr) = $pos + 2;
703 0 ($token, $token_desc, $token_type) = ('\\{', '\\{', 'VARIABLE');
704 0 $stack = [$token, $pos, 'VARIABLE'];
705 }
706 0 ▶ if ($parent_scope & F_EXPECTS_BRACKET) {
Branch: 1 branch
BranchTrueFalseTotal
if ($parent_scope & 8) 0 0 0
707 0 $current_scope |= F_SCOPE_END;
708 }
709 0 next;
710 } else {
711 70 pos($$rstr) = $pos + 1;
712 70 ($token, $token_desc, $token_type) = ($c1, $c1, '');
713 70 next;
714 }
715 } elsif ($c1 eq '-') {
716 1267 my $c2 = substr($$rstr, $pos + 1, 1);
717 1267 ▶ if ($c2 eq '>') {
Branch: 4 branches
BranchTrueFalseTotal
if ($c2 eq '>') { } 1103 164 1267
elsif ($c2 eq '-') { } 4 160 164
elsif ($c2 eq '=') { } 5 155 160
elsif ($$rstr =~ /\G(\-[ABCMORSTWXbcdefgkloprstuwxz]\b)/cg) { } 4 151 155
718 1103 pos($$rstr) = $pos + 2;
719 1103 ($token, $token_desc, $token_type) = ('->', 'ARROW', 'ARROW');
720 1103 ▶ if ($prev_token_type eq 'WORD' or $prev_token_type eq 'KEYWORD') {
Branch: 1 branch
BranchTrueFalseTotal
if ($prev_token_type eq "WORD" or $prev_token_type eq "KEYWORD") 51 1052 1103
Condition100%3/3
$prev_token_type eq "WORD" or $prev_token_type eq "KEYWORD"
l!l&&r!l&&!r
39121052
MC/DC100%2/2
$prev_token_type eq "WORD" or $prev_token_type eq "KEYWORD"
$prev_token_type eq "WORD" $prev_token_type eq "KEYWORD"
Truth table100%3/3
A or B
A= $prev_token_type eq "WORD"B= $prev_token_type eq "KEYWORD"
ABresult
1X1
011
000
721 51 $caller_package = $prev_token;
722 51 $current_scope |= F_KEEP_TOKENS;
723 }
724 1103 next;
725 } elsif ($c2 eq '-') {
726 4 pos($$rstr) = $pos + 2;
727 4 ($token, $token_desc, $token_type) = ('--', '--', $prev_token_type);
728 4 next;
729 } elsif ($c2 eq '=') {
730 5 pos($$rstr) = $pos + 2;
731 5 ($token, $token_desc, $token_type) = ('-=', '-=', 'OP');
732 5 next;
733 } elsif ($$rstr =~ m{\G(\-[ABCMORSTWXbcdefgkloprstuwxz]\b)}gc) {
734 4 ($token, $token_desc, $token_type) = ($1, 'FILE_TEST', 'EXPR');
735 4 next;
736 } else {
737 151 pos($$rstr) = $pos + 1;
738 151 ($token, $token_desc, $token_type) = ($c1, $c1, 'OP');
739 151 next;
740 }
741 } elsif ($c1 eq q{"}) {
742 436 ▶ if ($$rstr =~ m{\G(?:\"($re_str_in_double_quotes)\")}gcs) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$rstr =~ /\G(?:\"($re_str_in_double_quotes)\")/cgs) 435 1 436
743 435 ($token, $token_desc, $token_type) = ([$1, q{"}], 'STRING', 'STRING');
744 435 next;
745 }
746 } elsif ($c1 eq q{'}) {
747 865 ▶ if ($$rstr =~ m{\G(?:\'($re_str_in_single_quotes)\')}gcs) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$rstr =~ /\G(?:\'($re_str_in_single_quotes)\')/cgs) 865 0 865
748 865 ($token, $token_desc, $token_type) = ([$1, q{'}], 'STRING', 'STRING');
749 865 next;
750 }
751 } elsif ($c1 eq '`') {
752 0 ▶ if ($$rstr =~ m{\G(?:\`($re_str_in_backticks)\`)}gcs) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$rstr =~ /\G(?:\`($re_str_in_backticks)\`)/cgs) 0 0 0
753 0 ($token, $token_desc, $token_type) = ([$1, q{`}], 'BACKTICK', 'EXPR');
754 0 next;
755 }
756 } elsif ($c1 eq '/') {
757 144 ▶ if ($prev_token_type eq '' or $prev_token_type eq 'OP' or ($prev_token_type eq 'KEYWORD' and $regexp_may_follow{$prev_token})) { # undoubtedly regexp
Branch: 1 branch
BranchTrueFalseTotal
if ($prev_token_type eq "" or $prev_token_type eq "OP" or $prev_token_type eq "KEYWORD" and $regexp_may_follow{$prev_token}) 72 47 119
Condition100%9/9
$prev_token_type eq "" or $prev_token_type eq "OP" or $prev_token_type eq "KEYWORD" and $regexp_may_follow{$prev_token}
l!l&&r!l&&!r
775215
$prev_token_type eq "" or $prev_token_type eq "OP"
l!l&&r!l&&!r
255267
$prev_token_type eq "KEYWORD" and $regexp_may_follow{$prev_token}
!ll&&!rl&&r
44320
MC/DC75%3/4
$prev_token_type eq "" or $prev_token_type eq "OP" or $prev_token_type eq "KEYWORD" and $regexp_may_follow{$prev_token}
$prev_token_type eq "" $prev_token_type eq "OP" $prev_token_type eq "KEYWORD" $regexp_may_follow{$prev_token}
Truth table80%4/5
A or B or C and D
A= $prev_token_type eq ""B= $prev_token_type eq "OP"C= $prev_token_type eq "KEYWORD"D= $regexp_may_follow{$prev_token}
ABCDresult
1XXX1
01XX1
00111
000X0
00100
758 97 ▶ if (my $regexp = $self->_match_regexp0($c, $rstr, $pos, 'm')) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $regexp = $self->_match_regexp0($c, $rstr, $pos, 'm')) { } 96 1 97
759 96 ($token, $token_desc, $token_type) = ($regexp, 'REGEXP', 'EXPR');
760 96 next;
761 } else {
762 # the above may fail
763 1 _debug("REGEXP ERROR: $@") if DEBUG;
764 1 pos($$rstr) = $pos;
765 }
766 }
767 48 ▶ if (($prev_token_type eq '' or (!($current_scope & F_EXPR) and $prev_token_type eq 'WORD')) or ($prev_token_type eq 'KEYWORD' and @keywords and $prev_token eq $keywords[-1] and $regexp_may_follow{$prev_token})) {
Branch: 1 branch
BranchTrueFalseTotal
if ($prev_token_type eq "" or not $current_scope & 512 and $prev_token_type eq "WORD" or $prev_token_type eq "KEYWORD" and @keywords and $prev_token eq $keywords[-1] and $regexp_may_follow{$prev_token}) 0 47 47
Condition61%11/18
$prev_token_type eq "" or not $current_scope & 512 and $prev_token_type eq "WORD" or $prev_token_type eq "KEYWORD" and @keywords and $prev_token eq $keywords[-1] and $regexp_may_follow{$prev_token}
l!l&&r!l&&!r
1047
$prev_token_type eq "" or not $current_scope & 512 and $prev_token_type eq "WORD"
l!l&&r!l&&!r
1047
not $current_scope & 512 and $prev_token_type eq "WORD"
!ll&&!rl&&r
4700
$prev_token_type eq "KEYWORD" and @keywords and $prev_token eq $keywords[-1] and $regexp_may_follow{$prev_token}
!ll&&!rl&&r
4430
$prev_token_type eq "KEYWORD" and @keywords and $prev_token eq $keywords[-1]
!ll&&!rl&&r
4403
$prev_token_type eq "KEYWORD" and @keywords
!ll&&!rl&&r
4403
MC/DC14%1/7
$prev_token_type eq "" or not $current_scope & 512 and $prev_token_type eq "WORD" or $prev_token_type eq "KEYWORD" and @keywords and $prev_token eq $keywords[-1] and $regexp_may_follow{$prev_token}
$prev_token_type eq "" not $current_scope & 512 $prev_token_type eq "WORD" $prev_token_type eq "KEYWORD" @keywords $prev_token eq $keywords[-1] $regexp_may_follow{$prev_token}
Truth table16%2/12
A or not(B) and C or D and E and F and G
A= $prev_token_type eq ""B= not $current_scope & 512C= $prev_token_type eq "WORD"D= $prev_token_type eq "KEYWORD"E= @keywordsF= $prev_token eq $keywords[-1]G= $regexp_may_follow{$prev_token}
ABCDEFGresult
1XXXXXX1
011XXXX1
00X11111
01011111
00X0XXX0
00X10XX0
00X110X0
00X11100
0100XXX0
01010XX0
010110X0
01011100
768  
769 1 ▶ if (my $regexp = $self->_match_regexp0($c, $rstr, $pos)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $regexp = $self->_match_regexp0($c, $rstr, $pos)) { } 0 1 1
770 0 ($token, $token_desc, $token_type) = ($regexp, 'REGEXP', 'EXPR');
771 0 next;
772 } else {
773 # the above may fail
774 1 _debug("REGEXP ERROR: $@") if DEBUG;
775 1 pos($$rstr) = $pos;
776 }
777 }
778 48 my $c2 = substr($$rstr, $pos + 1, 1);
779 48 ▶ if ($c2 eq '/') {
Branch: 1 branch
BranchTrueFalseTotal
if ($c2 eq "/") 9 39 48
780 9 ▶ if (substr($$rstr, $pos + 2, 1) eq '=') {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($$rstr, $pos + 2, 1) eq '=') { } 2 7 9
781 2 pos($$rstr) = $pos + 3;
782 2 ($token, $token_desc, $token_type) = ('//=', '//=', 'OP');
783 2 $c->add_perl('5.010', '//=');
784 2 next;
785 } else {
786 7 pos($$rstr) = $pos + 2;
787 7 ($token, $token_desc, $token_type) = ('//', '//', 'OP');
788 7 $c->add_perl('5.010', '//');
789 7 next;
790 }
791 }
792 39 ▶ if ($c2 eq '=') { # this may be a part of /=.../
Branch: 1 branch
BranchTrueFalseTotal
if ($c2 eq '=') { } 1 38 39
793 1 pos($$rstr) = $pos + 2;
794 1 ($token, $token_desc, $token_type) = ('/=', '/=', 'OP');
795 1 next;
796 } else {
797 38 pos($$rstr) = $pos + 1;
798 38 ($token, $token_desc, $token_type) = ($c1, $c1, 'OP');
799 38 next;
800 }
801 } elsif ($c1 eq '{') {
802 1813 ▶ if ($$rstr =~ m{$g_re_hash_shortcut}gc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$rstr =~ /$g_re_hash_shortcut/cg) 879 934 1813
803 879 ($token, $token_desc) = ($1, '{EXPR}');
804 879 ▶ if ($current_scope & F_EVAL) {
Branch: 1 branch
BranchTrueFalseTotal
if ($current_scope & 2) 1 878 879
805 1 $current_scope &= MASK_EVAL;
806 1 ▶ $c->{eval} = ($current_scope | $parent_scope) & F_EVAL ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
($current_scope | $parent_scope) & 2 ? : 0 1 1
807 }
808 879 ▶ if ($parent_scope & F_EXPECTS_BRACKET) {
Branch: 1 branch
BranchTrueFalseTotal
if ($parent_scope & 8) 8 871 879
809 8 $current_scope |= F_SCOPE_END;
810 8 next;
811 }
812 871 ▶ if ($prev_token_type eq 'ARROW' or $prev_token_type eq 'VARIABLE') {
Branch: 3 branches
BranchTrueFalseTotal
if ($prev_token_type eq 'ARROW' or $prev_token_type eq 'VARIABLE') { } 755 116 871
elsif ($waiting_for_a_block) { } 82 34 116
elsif ($prev_token_type eq 'KEYWORD' and $c->token_expects_fh_or_block_list($prev_token)) { } 15 19 34
Condition100%3/3
$prev_token_type eq "ARROW" or $prev_token_type eq "VARIABLE"
l!l&&r!l&&!r
488267116
MC/DC100%2/2
$prev_token_type eq "ARROW" or $prev_token_type eq "VARIABLE"
$prev_token_type eq "ARROW" $prev_token_type eq "VARIABLE"
Truth table100%3/3
A or B
A= $prev_token_type eq "ARROW"B= $prev_token_type eq "VARIABLE"
ABresult
1X1
011
000
813 755 $token_type = 'VARIABLE';
814 755 next;
815 } elsif ($waiting_for_a_block) {
816 82 $waiting_for_a_block = 0;
817 82 ▶ if (@keywords and $c->token_expects_block($keywords[0])) {
Branch: 1 branch
BranchTrueFalseTotal
if (@keywords and $c->token_expects_block($keywords[0])) 70 12 82
Condition100%3/3
@keywords and $c->token_expects_block($keywords[0])
!ll&&!rl&&r
3970
MC/DC100%2/2
@keywords and $c->token_expects_block($keywords[0])
@keywords $c->token_expects_block($keywords[0])
Truth table100%3/3
A and B
A= @keywordsB= $c->token_expects_block($keywords[0])
ABresult
0X0
100
111
818 70 my $first_token = $keywords[0];
819 70 $current_scope |= F_EXPR_END;
820 70 ▶ if ($c->token_defines_sub($first_token) and $c->has_callback_for(sub => $first_token)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c->token_defines_sub($first_token) and $c->has_callback_for("sub", $first_token)) 3 67 70
Condition100%3/3
$c->token_defines_sub($first_token) and $c->has_callback_for("sub", $first_token)
!ll&&!rl&&r
14533
MC/DC100%2/2
$c->token_defines_sub($first_token) and $c->has_callback_for("sub", $first_token)
$c->token_defines_sub($first_token) $c->has_callback_for("sub", $first_token)
Truth table100%3/3
A and B
A= $c->token_defines_sub($first_token)B= $c->has_callback_for("sub", $first_token)
ABresult
0X0
100
111
821 3 $c->run_callback_for(sub => $first_token, \@tokens);
822 3 $current_scope &= MASK_KEEP_TOKENS;
823 3 @tokens = ();
824 }
825 }
826 82 next;
827 ▶ } elsif ($prev_token_type eq 'KEYWORD' and $c->token_expects_fh_or_block_list($prev_token)) {
Condition100%3/3
$prev_token_type eq "KEYWORD" and $c->token_expects_fh_or_block_list($prev_token)
!ll&&!rl&&r
16315
MC/DC100%2/2
$prev_token_type eq "KEYWORD" and $c->token_expects_fh_or_block_list($prev_token)
$prev_token_type eq "KEYWORD" $c->token_expects_fh_or_block_list($prev_token)
Truth table100%3/3
A and B
A= $prev_token_type eq "KEYWORD"B= $c->token_expects_fh_or_block_list($prev_token)
ABresult
0X0
100
111
828 15 $token_type = '';
829 15 next;
830 } else {
831 19 $token_type = 'EXPR';
832 19 next;
833 }
834 }
835 934 pos($$rstr) = $pos + 1;
836 934 ($token, $token_desc) = ($c1, $c1);
837 934 my $stack_owner;
838 934 ▶ if (@keywords) {
Branch: 1 branch
BranchTrueFalseTotal
if (@keywords) 741 193 934
839 741 ▶ for(my $i = @keywords; $i > 0; $i--) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i > 0) 773 41 814
840 773 my $keyword = $keywords[$i - 1];
841 773 ▶ if ($c->token_expects_block($keyword)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c->token_expects_block($keyword)) 700 73 773
842 700 $stack_owner = $keyword;
843 700 ▶ if (@tokens and $c->token_defines_sub($keyword) and $c->has_callback_for(sub => $keyword)) {
Branch: 1 branch
BranchTrueFalseTotal
if (@tokens and $c->token_defines_sub($keyword) and $c->has_callback_for("sub", $keyword)) 54 646 700
Condition100%6/6
@tokens and $c->token_defines_sub($keyword) and $c->has_callback_for("sub", $keyword)
!ll&&!rl&&r
639754
@tokens and $c->token_defines_sub($keyword)
!ll&&!rl&&r
638161
MC/DC100%3/3
@tokens and $c->token_defines_sub($keyword) and $c->has_callback_for("sub", $keyword)
@tokens $c->token_defines_sub($keyword) $c->has_callback_for("sub", $keyword)
Truth table100%4/4
A and B and C
A= @tokensB= $c->token_defines_sub($keyword)C= $c->has_callback_for("sub", $keyword)
ABCresult
0XX0
10X0
1100
1111
844 54 $c->run_callback_for(sub => $keyword, \@tokens);
845 54 $current_scope &= MASK_KEEP_TOKENS;
846 54 @tokens = ();
847 }
848 700 last;
849 }
850 }
851 }
852 934 ▶ $stack = [$token, $pos, $stack_owner || ''];
Condition100%2/2
$stack_owner || ''
l!l
700234
MC/DC100%1/1
$stack_owner || ''
$stack_owner
Truth table100%2/2
A
A= $stack_owner
Aresult
11
00
853 934 ▶ if ($parent_scope & F_EXPECTS_BRACKET) {
Branch: 1 branch
BranchTrueFalseTotal
if ($parent_scope & 8) 62 872 934
854 62 $current_scope |= F_SCOPE_END|F_STATEMENT_END|F_EXPR_END;
855 62 next;
856 }
857 872 ▶ if ($prev_token_type eq 'ARROW' or $prev_token_type eq 'VARIABLE') {
Branch: 2 branches
BranchTrueFalseTotal
if ($prev_token_type eq 'ARROW' or $prev_token_type eq 'VARIABLE') { } 35 837 872
elsif ($waiting_for_a_block) { } 704 133 837
Condition100%3/3
$prev_token_type eq "ARROW" or $prev_token_type eq "VARIABLE"
l!l&&r!l&&!r
728837
MC/DC100%2/2
$prev_token_type eq "ARROW" or $prev_token_type eq "VARIABLE"
$prev_token_type eq "ARROW" $prev_token_type eq "VARIABLE"
Truth table100%3/3
A or B
A= $prev_token_type eq "ARROW"B= $prev_token_type eq "VARIABLE"
ABresult
1X1
011
000
858 35 $token_type = 'VARIABLE';
859 } elsif ($waiting_for_a_block) {
860 704 $waiting_for_a_block = 0;
861 } else {
862 133 ▶ $token_type = (($current_scope | $parent_scope) & F_KEEP_TOKENS) ? 'EXPR' : '';
Branch: 1 branch
BranchTrueFalseTotal
($current_scope | $parent_scope) & 1 ? : 52 81 133
863 }
864 872 next;
865 } elsif ($c1 eq '[') {
866 395 ▶ if ($$rstr =~ m{\G(\[(?:$re_nonblock_chars)\])}gc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$rstr =~ /\G(\[(?:$re_nonblock_chars)\])/cg) { } 208 187 395
867 208 ($token, $token_desc, $token_type) = ($1, '[EXPR]', 'VARIABLE');
868 208 next;
869 } else {
870 187 pos($$rstr) = $pos + 1;
871 187 ($token, $token_desc, $token_type) = ($c1, $c1, 'VARIABLE');
872 187 $stack = [$token, $pos, 'VARIABLE'];
873 187 next;
874 }
875 } elsif ($c1 eq '(') {
876 1500 my $prototype_re = $c->prototype_re;
877 1500 ▶ if ($waiting_for_a_block and @keywords and $c->token_defines_sub($keywords[-1]) and $$rstr =~ m{$prototype_re}gc) {
Branch: 2 branches
BranchTrueFalseTotal
if ($waiting_for_a_block and @keywords and $c->token_defines_sub($keywords[-1]) and $$rstr =~ /$prototype_re/cg) { } 115 1385 1500
elsif ($$rstr =~ /\G\(((?:$re_nonblock_chars)(?<!\$))\)/cg) { } 295 1090 1385
Condition100%9/9
$waiting_for_a_block and @keywords and $c->token_defines_sub($keywords[-1]) and $$rstr =~ /$prototype_re/cg
!ll&&!rl&&r
13832115
$waiting_for_a_block and @keywords and $c->token_defines_sub($keywords[-1])
!ll&&!rl&&r
1083300117
$waiting_for_a_block and @keywords
!ll&&!rl&&r
980103417
MC/DC100%4/4
$waiting_for_a_block and @keywords and $c->token_defines_sub($keywords[-1]) and $$rstr =~ /$prototype_re/cg
$waiting_for_a_block @keywords $c->token_defines_sub($keywords[-1]) $$rstr =~ /$prototype_re/cg
Truth table100%5/5
A and B and C and D
A= $waiting_for_a_blockB= @keywordsC= $c->token_defines_sub($keywords[-1])D= $$rstr =~ /$prototype_re/cg
ABCDresult
0XXX0
10XX0
110X0
11100
11111
878 115 my $proto = $1;
879 115 ▶ if ($proto =~ /^\([\\\$\@\%\&\[\]\*;\+]*\)$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($proto =~ /^\([\\\$\@\%\&\[\]\*;\+]*\)$/) { } 56 59 115
880 56 ($token, $token_desc, $token_type) = ($proto, '(PROTOTYPE)', '');
881 } else {
882 59 ($token, $token_desc, $token_type) = ($proto, '(SIGNATURES)', '');
883 59 $c->add_perl('5.020', 'signatures');
884 }
885 115 next;
886 } elsif ($$rstr =~ m{\G\(((?:$re_nonblock_chars)(?<!\$))\)}gc) {
887 295 ($token, $token_desc, $token_type) = ([[[$1, 'EXPR']]], '()', 'EXPR');
888 295 ▶ if ($prev_token_type eq 'KEYWORD' and @keywords and $keywords[-1] eq $prev_token and !$c->token_expects_expr_block($prev_token)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($prev_token_type eq "KEYWORD" and @keywords and $keywords[-1] eq $prev_token and not $c->token_expects_expr_block($prev_token)) 54 241 295
Condition88%8/9
$prev_token_type eq "KEYWORD" and @keywords and $keywords[-1] eq $prev_token and not $c->token_expects_expr_block($prev_token)
!ll&&!rl&&r
2162554
$prev_token_type eq "KEYWORD" and @keywords and $keywords[-1] eq $prev_token
!ll&&!rl&&r
216079
$prev_token_type eq "KEYWORD" and @keywords
!ll&&!rl&&r
212479
MC/DC75%3/4
$prev_token_type eq "KEYWORD" and @keywords and $keywords[-1] eq $prev_token and not $c->token_expects_expr_block($prev_token)
$prev_token_type eq "KEYWORD" @keywords $keywords[-1] eq $prev_token not $c->token_expects_expr_block($prev_token)
Truth table80%4/5
A and B and C and not(D)
A= $prev_token_type eq "KEYWORD"B= @keywordsC= $keywords[-1] eq $prev_tokenD= not $c->token_expects_expr_block($prev_token)
ABCDresult
0XXX0
10XX0
110X0
11100
11111
889 54 ▶ if ($prev_token eq 'eval') {
Branch: 1 branch
BranchTrueFalseTotal
if ($prev_token eq "eval") 1 53 54
890 1 $current_scope &= MASK_EVAL;
891 1 ▶ $c->{eval} = ($current_scope | $parent_scope) & F_EVAL ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
($current_scope | $parent_scope) & 2 ? : 0 1 1
892 }
893 54 pop @keywords;
894 }
895 295 next;
896 } else {
897 1090 pos($$rstr) = $pos + 1;
898 1090 ($token, $token_desc, $token_type) = ($c1, $c1, 'EXPR');
899 1090 my $stack_owner;
900 1090 ▶ if (@keywords) {
Branch: 1 branch
BranchTrueFalseTotal
if (@keywords) 609 481 1090
901 609 ▶ for (my $i = @keywords; $i > 0; $i--) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i > 0) 661 394 1055
902 661 my $keyword = $keywords[$i - 1];
903 661 ▶ if ($c->token_expects_block($keyword)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c->token_expects_block($keyword)) 215 446 661
904 215 $stack_owner = $keyword;
905 215 last;
906 }
907 }
908 }
909 1090 ▶ $stack = [$token, $pos, $stack_owner || ''];
Condition100%2/2
$stack_owner || ''
l!l
215875
MC/DC100%1/1
$stack_owner || ''
$stack_owner
Truth table100%2/2
A
A= $stack_owner
Aresult
11
00
910 1090 next;
911 }
912 } elsif ($c1 eq '}') {
913 1037 pos($$rstr) = $pos + 1;
914 1037 ($token, $token_desc, $token_type) = ($c1, $c1, '');
915 1037 $unstack = $token;
916 1037 $current_scope |= F_STATEMENT_END|F_EXPR_END;
917 1037 next;
918 } elsif ($c1 eq ']') {
919 96 pos($$rstr) = $pos + 1;
920 96 ($token, $token_desc, $token_type) = ($c1, $c1, '');
921 96 $unstack = $token;
922 96 next;
923 } elsif ($c1 eq ')') {
924 1090 pos($$rstr) = $pos + 1;
925 1090 ($token, $token_desc, $token_type) = ($c1, $c1, '');
926 1090 $unstack = $token;
927 1090 next;
928 } elsif ($c1 eq '<') {
929 93 my $c2 = substr($$rstr, $pos + 1, 1);
930 93 ▶ if ($c2 eq '<'){
Branch: 4 branches
BranchTrueFalseTotal
if ($c2 eq '<') { } 19 74 93
elsif ($c2 eq '=') { } 10 64 74
elsif ($c2 eq '>') { } 1 63 64
elsif ($$rstr =~ m(\G(<(?: \\. | \w+ | [./-] | \[[^\]]*\] | \{[^\}]*\} | \* | \? | \~ | \$ | )*(?<!\-)>))cgx) { } 12 51 63
931 19 ▶ if ($$rstr =~ m{\G(<<(?:
Branch: 2 branches
BranchTrueFalseTotal
if ($$rstr =~ m(\G(<<(?: \\. | \w+ | [./-] | \[[^\]]*\] | \{[^\}]*\} | \* | \? | \~ | \$ | )*(?<!\-)>>))cgx) { } 1 18 19
elsif ($$rstr =~ /\G<<~?\s*(?: \\?[A-Za-z_][\w]* | "(?:[^\\"]*(?:\\.[^\\"]*)*)" | '(?:[^\\']*(?:\\.[^\\']*)*)' | `(?:[^\\`]*(?:\\.[^\\`]*)*)` )/sx) { } 16 2 18
932 \\. |
933 \w+ |
934 [./-] |
935 \[[^\]]*\] |
936 \{[^\}]*\} |
937 \* |
938 \? |
939 \~ |
940 \$ |
941 )*(?<!\-)>>)}gcx) {
942 1 ($token, $token_desc, $token_type) = ($1, '<<NAME>>', 'EXPR');
943 1 $c->add_perl('5.022', '<<NAME>>');
944 1 next;
945 } elsif ($$rstr =~ m{\G<<~?\s*(?:
946 \\?[A-Za-z_][\w]* |
947 "(?:[^\\"]*(?:\\.[^\\"]*)*)" |
948 '(?:[^\\']*(?:\\.[^\\']*)*)' |
949 `(?:[^\\`]*(?:\\.[^\\`]*)*)`
950 )}sx) {
951 16 ▶ if (my $heredoc = $self->_match_heredoc($c, $rstr)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $heredoc = $self->_match_heredoc($c, $rstr)) { } 14 2 16
952 14 ($token, $token_desc, $token_type) = ($heredoc, 'HEREDOC', 'EXPR');
953 14 next;
954 } else {
955 # the above may fail
956 2 pos($$rstr) = $pos;
957 }
958 }
959 4 ▶ if (substr($$rstr, $pos + 2, 1) eq '=') {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($$rstr, $pos + 2, 1) eq '=') { } 0 4 4
960 0 pos($$rstr) = $pos + 3;
961 0 ($token, $token_desc, $token_type) = ('<<=', '<<=', 'OP');
962 0 next;
963 } else {
964 4 pos($$rstr) = $pos + 2;
965 4 ($token, $token_desc, $token_type) = ('<<', '<<', 'OP');
966 4 next;
967 }
968 } elsif ($c2 eq '=') {
969 10 ▶ if (substr($$rstr, $pos + 2, 1) eq '>') {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($$rstr, $pos + 2, 1) eq '>') { } 1 9 10
970 1 pos($$rstr) = $pos + 3;
971 1 ($token, $token_desc, $token_type) = ('<=>', '<=>', 'OP');
972 1 next;
973 } else {
974 9 pos($$rstr) = $pos + 2;
975 9 ($token, $token_desc, $token_type) = ('<=', '<=', 'OP');
976 9 next;
977 }
978 } elsif ($c2 eq '>') {
979 1 pos($$rstr) = $pos + 2;
980 1 ($token, $token_desc, $token_type) = ('<>', '<>', 'OP');
981 1 next;
982 } elsif ($$rstr =~ m{\G(<(?:
983 \\. |
984 \w+ |
985 [./-] |
986 \[[^\]]*\] |
987 \{[^\}]*\} |
988 \* |
989 \? |
990 \~ |
991 \$ |
992 )*(?<!\-)>)}gcx) {
993 12 ($token, $token_desc, $token_type) = ($1, '<NAME>', 'EXPR');
994 12 next;
995 } else {
996 51 pos($$rstr) = $pos + 1;
997 51 ($token, $token_desc, $token_type) = ($c1, $c1, 'OP');
998 51 next;
999 }
1000 } elsif ($c1 eq ':') {
1001 293 my $c2 = substr($$rstr, $pos + 1, 1);
1002 293 ▶ if ($c2 eq ':') {
Branch: 1 branch
BranchTrueFalseTotal
if ($c2 eq ":") 21 272 293
1003 21 pos($$rstr) = $pos + 2;
1004 21 ($token, $token_desc, $token_type) = ('::', '::', '');
1005 21 next;
1006 }
1007 272 ▶ if ($waiting_for_a_block and @keywords and $c->token_defines_sub($keywords[-1])) {
Branch: 1 branch
BranchTrueFalseTotal
if ($waiting_for_a_block and @keywords and $c->token_defines_sub($keywords[-1])) { } 82 190 272
Condition100%6/6
$waiting_for_a_block and @keywords and $c->token_defines_sub($keywords[-1])
!ll&&!rl&&r
184682
$waiting_for_a_block and @keywords
!ll&&!rl&&r
182288
MC/DC100%3/3
$waiting_for_a_block and @keywords and $c->token_defines_sub($keywords[-1])
$waiting_for_a_block @keywords $c->token_defines_sub($keywords[-1])
Truth table100%4/4
A and B and C
A= $waiting_for_a_blockB= @keywordsC= $c->token_defines_sub($keywords[-1])
ABCresult
0XX0
10X0
1100
1111
1008 82 ▶ while($$rstr =~ m{\G\s*(:?\s*[\w]+)}gcs) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$rstr =~ /\G\s*(:?\s*[\w]+)/cgs) 139 82 221
1009 139 my $startpos = pos($$rstr);
1010 139 ▶ if (substr($$rstr, $startpos, 1) eq '(') {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($$rstr, $startpos, 1) eq "(") 108 31 139
1011 108 my @nest = '(';
1012 108 pos($$rstr) = $startpos + 1;
1013 108 my ($p, $c1);
1014 108 ▶ while(defined($p = pos($$rstr))) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($p = pos $$rstr)) 231 0 231
1015 231 $c1 = substr($$rstr, $p, 1);
1016 231 ▶ if ($c1 eq '\\') {
Branch: 1 branch
BranchTrueFalseTotal
if ($c1 eq "\\") 0 231 231
1017 0 pos($$rstr) = $p + 2;
1018 0 next;
1019 }
1020 231 ▶ if ($c1 eq ')') {
Branch: 1 branch
BranchTrueFalseTotal
if ($c1 eq ")") 114 117 231
1021 114 pop @nest;
1022 114 pos($$rstr) = $p + 1;
1023 114 ▶ last unless @nest;
Branch: 1 branch
BranchTrueFalseTotal
unless @nest 108 6 114
1024 }
1025 123 ▶ if ($c1 eq '(') {
Branch: 1 branch
BranchTrueFalseTotal
if ($c1 eq "(") 6 117 123
1026 6 push @nest, $c1;
1027 6 pos($$rstr) = $p + 1;
1028 6 next;
1029 }
1030 117 ▶ $$rstr =~ m{\G([^\\()]+)}gc and next;
Branch: 1 branch
BranchTrueFalseTotal
$$rstr =~ /\G([^\\()]+)/cg and next 112 5 117
1031 }
1032 }
1033 }
1034 82 $token = substr($$rstr, $pos, pos($$rstr) - $pos);
1035 82 ($token_desc, $token_type) = ('ATTRIBUTE', '');
1036 82 ▶ if ($token =~ /^:prototype\(/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($token =~ /^:prototype\(/) 2 80 82
1037 2 $c->add_perl('5.020', ':prototype');
1038 }
1039 82 next;
1040 } else {
1041 190 pos($$rstr) = $pos + 1;
1042 190 ($token, $token_desc, $token_type) = ($c1, $c1, 'OP');
1043 190 next;
1044 }
1045 } elsif ($c1 eq '=') {
1046 1734 my $c2 = substr($$rstr, $pos + 1, 1);
1047 1734 ▶ if ($c2 eq '>') {
Branch: 3 branches
BranchTrueFalseTotal
if ($c2 eq '>') { } 600 1134 1734
elsif ($c2 eq '=') { } 74 1060 1134
elsif ($c2 eq '~') { } 101 959 1060
1048 600 pos($$rstr) = $pos + 2;
1049 600 ($token, $token_desc, $token_type) = ('=>', 'COMMA', 'OP');
1050 600 ▶ if (@keywords and $prev_token_type eq 'KEYWORD' and $keywords[-1] eq $prev_token) {
Branch: 1 branch
BranchTrueFalseTotal
if (@keywords and $prev_token_type eq "KEYWORD" and $keywords[-1] eq $prev_token) 19 581 600
Condition83%5/6
@keywords and $prev_token_type eq "KEYWORD" and $keywords[-1] eq $prev_token
!ll&&!rl&&r
581019
@keywords and $prev_token_type eq "KEYWORD"
!ll&&!rl&&r
45212919
MC/DC66%2/3
@keywords and $prev_token_type eq "KEYWORD" and $keywords[-1] eq $prev_token
@keywords $prev_token_type eq "KEYWORD" $keywords[-1] eq $prev_token
Truth table75%3/4
A and B and C
A= @keywordsB= $prev_token_type eq "KEYWORD"C= $keywords[-1] eq $prev_token
ABCresult
0XX0
10X0
1100
1111
1051 19 pop @keywords;
1052 19 ▶ if (!@keywords and ($current_scope & F_KEEP_TOKENS)) {
Branch: 1 branch
BranchTrueFalseTotal
if (not @keywords and $current_scope & 1) 1 18 19
Condition100%3/3
not @keywords and $current_scope & 1
!ll&&!rl&&r
1351
MC/DC100%2/2
not @keywords and $current_scope & 1
not @keywords $current_scope & 1
Truth table100%3/3
not(A) and B
A= not @keywordsB= $current_scope & 1
ABresult
0X0
100
111
1053 1 $current_scope &= MASK_KEEP_TOKENS;
1054 1 @tokens = ();
1055 }
1056 }
1057 600 next;
1058 } elsif ($c2 eq '=') {
1059 74 pos($$rstr) = $pos + 2;
1060 74 ($token, $token_desc, $token_type) = ('==', '==', 'OP');
1061 74 next;
1062 } elsif ($c2 eq '~') {
1063 101 pos($$rstr) = $pos + 2;
1064 101 ($token, $token_desc, $token_type) = ('=~', '=~', 'OP');
1065 101 next;
1066 } else {
1067 959 pos($$rstr) = $pos + 1;
1068 959 ($token, $token_desc, $token_type) = ($c1, $c1, 'OP');
1069 959 next;
1070 }
1071 } elsif ($c1 eq '>') {
1072 54 my $c2 = substr($$rstr, $pos + 1, 1);
1073 54 ▶ if ($c2 eq '>') {
Branch: 2 branches
BranchTrueFalseTotal
if ($c2 eq '>') { } 0 54 54
elsif ($c2 eq '=') { } 4 50 54
1074 0 ▶ if (substr($$rstr, $pos + 2, 1) eq '=') {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($$rstr, $pos + 2, 1) eq '=') { } 0 0 0
1075 0 pos($$rstr) = $pos + 3;
1076 0 ($token, $token_desc, $token_type) = ('>>=', '>>=', 'OP');
1077 0 next;
1078 } else {
1079 0 pos($$rstr) = $pos + 2;
1080 0 ($token, $token_desc, $token_type) = ('>>', '>>', 'OP');
1081 0 next;
1082 }
1083 } elsif ($c2 eq '=') {
1084 4 pos($$rstr) = $pos + 2;
1085 4 ($token, $token_desc, $token_type) = ('>=', '>=', 'OP');
1086 4 next;
1087 } else {
1088 50 pos($$rstr) = $pos + 1;
1089 50 ($token, $token_desc, $token_type) = ($c1, $c1, 'OP');
1090 50 next;
1091 }
1092 } elsif ($c1 eq '+') {
1093 162 my $c2 = substr($$rstr, $pos + 1, 1);
1094 162 ▶ if ($c2 eq '+') {
Branch: 2 branches
BranchTrueFalseTotal
if ($c2 eq '+') { } 19 143 162
elsif ($c2 eq '=') { } 68 75 143
1095 19 ▶ if (substr($$rstr, $pos + 2, 1) eq '=') {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($$rstr, $pos + 2, 1) eq '=') { } 0 19 19
1096 0 pos($$rstr) = $pos + 3;
1097 0 ($token, $token_desc, $token_type) = ('++=', '++=', 'OP');
1098 0 next;
1099 } else {
1100 19 pos($$rstr) = $pos + 2;
1101 19 ($token, $token_desc, $token_type) = ('++', '++', $prev_token_type);
1102 19 next;
1103 }
1104 } elsif ($c2 eq '=') {
1105 68 pos($$rstr) = $pos + 2;
1106 68 ($token, $token_desc, $token_type) = ('+=', '+=', 'OP');
1107 68 next;
1108 } else {
1109 75 pos($$rstr) = $pos + 1;
1110 75 ($token, $token_desc, $token_type) = ($c1, $c1, 'OP');
1111 75 next;
1112 }
1113 } elsif ($c1 eq '|') {
1114 93 my $c2 = substr($$rstr, $pos + 1, 1);
1115 93 ▶ if ($c2 eq '|') {
Branch: 3 branches
BranchTrueFalseTotal
if ($c2 eq '|') { } 85 8 93
elsif ($c2 eq '=') { } 1 7 8
elsif ($c2 eq '.') { } 2 5 7
1116 85 ▶ if (substr($$rstr, $pos + 2, 1) eq '=') {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($$rstr, $pos + 2, 1) eq '=') { } 17 68 85
1117 17 pos($$rstr) = $pos + 3;
1118 17 ($token, $token_desc, $token_type) = ('||=', '||=', 'OP');
1119 17 next;
1120 } else {
1121 68 pos($$rstr) = $pos + 2;
1122 68 ($token, $token_desc, $token_type) = ('||', '||', 'OP');
1123 68 next;
1124 }
1125 } elsif ($c2 eq '=') {
1126 1 pos($$rstr) = $pos + 2;
1127 1 ($token, $token_desc, $token_type) = ('|=', '|=', 'OP');
1128 1 next;
1129 } elsif ($c2 eq '.') {
1130 2 ▶ if (substr($$rstr, $pos + 2, 1) eq '=') {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($$rstr, $pos + 2, 1) eq '=') { } 1 1 2
1131 1 pos($$rstr) = $pos + 3;
1132 1 ($token, $token_desc, $token_type) = ('|.=', '|.=', 'OP');
1133 } else {
1134 1 pos($$rstr) = $pos + 2;
1135 1 ($token, $token_desc, $token_type) = ('|.', '|.', 'OP');
1136 }
1137 2 $c->add_perl('5.022', '|.');
1138 2 next;
1139 } else {
1140 5 pos($$rstr) = $pos + 1;
1141 5 ($token, $token_desc, $token_type) = ($c1, $c1, 'OP');
1142 5 next;
1143 }
1144 } elsif ($c1 eq '^') {
1145 4 my $c2 = substr($$rstr, $pos + 1, 1);
1146 4 ▶ if ($c2 eq '=') {
Branch: 2 branches
BranchTrueFalseTotal
if ($c2 eq '=') { } 0 4 4
elsif ($c2 eq '.') { } 2 2 4
1147 0 pos($$rstr) = $pos + 2;
1148 0 ($token, $token_desc, $token_type) = ('^=', '^=', 'OP');
1149 0 next;
1150 } elsif ($c2 eq '.') {
1151 2 ▶ if (substr($$rstr, $pos + 2, 1) eq '=') {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($$rstr, $pos + 2, 1) eq '=') { } 1 1 2
1152 1 pos($$rstr) = $pos + 3;
1153 1 ($token, $token_desc, $token_type) = ('^.=', '^.=', 'OP');
1154 } else {
1155 1 pos($$rstr) = $pos + 2;
1156 1 ($token, $token_desc, $token_type) = ('^.', '^.', 'OP');
1157 }
1158 2 $c->add_perl('5.022', '^.');
1159 2 next;
1160 } else {
1161 2 pos($$rstr) = $pos + 1;
1162 2 ($token, $token_desc, $token_type) = ($c1, $c1, 'OP');
1163 2 next;
1164 }
1165 } elsif ($c1 eq '!') {
1166 51 my $c2 = substr($$rstr, $pos + 1, 1);
1167 51 ▶ if ($c2 eq '~') {
Branch: 1 branch
BranchTrueFalseTotal
if ($c2 eq '~') { } 5 46 51
1168 5 pos($$rstr) = $pos + 2;
1169 5 ($token, $token_desc, $token_type) = ('!~', '!~', 'OP');
1170 5 next;
1171 } else {
1172 46 pos($$rstr) = $pos + 1;
1173 46 ($token, $token_desc, $token_type) = ($c1, $c1, 'OP');
1174 46 next;
1175 }
1176 } elsif ($c1 eq '~') {
1177 2 my $c2 = substr($$rstr, $pos + 1, 1);
1178 2 ▶ if ($c2 eq '~') {
Branch: 2 branches
BranchTrueFalseTotal
if ($c2 eq '~') { } 1 1 2
elsif ($c2 eq '.') { } 1 0 1
1179 1 pos($$rstr) = $pos + 2;
1180 1 ($token, $token_desc, $token_type) = ('~~', '~~', 'OP');
1181 1 $c->add_perl('5.010', '~~');
1182 1 next;
1183 } elsif ($c2 eq '.') {
1184 1 pos($$rstr) = $pos + 2;
1185 1 ($token, $token_desc, $token_type) = ('~.', '~.', 'OP');
1186 1 $c->add_perl('5.022', '~.');
1187 1 next;
1188 } else {
1189 0 pos($$rstr) = $pos + 1;
1190 0 ($token, $token_desc, $token_type) = ($c1, $c1, 'OP');
1191 0 next;
1192 }
1193 } elsif ($c1 eq ',') {
1194 1393 pos($$rstr) = $pos + 1;
1195 1393 ($token, $token_desc, $token_type) = ($c1, 'COMMA', 'OP');
1196 1393 next;
1197 } elsif ($c1 eq '?') {
1198 131 pos($$rstr) = $pos + 1;
1199 131 ($token, $token_desc, $token_type) = ($c1, $c1, 'OP');
1200 131 next;
1201 } elsif ($c1 eq '.') {
1202 195 my $c2 = substr($$rstr, $pos + 1, 1);
1203 195 ▶ if ($c2 eq '.') {
Branch: 2 branches
BranchTrueFalseTotal
if ($c2 eq '.') { } 20 175 195
elsif ($c2 eq '=') { } 26 149 175
1204 20 ▶ if (substr($$rstr, $pos + 2, 1) eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($$rstr, $pos + 2, 1) eq '.') { } 15 5 20
1205 15 pos($$rstr) = $pos + 3;
1206 15 ($token, $token_desc, $token_type) = ('...', '...', 'OP');
1207 15 $c->add_perl('5.012', '...');
1208 15 next;
1209 } else {
1210 5 pos($$rstr) = $pos + 2;
1211 5 ($token, $token_desc, $token_type) = ('..', '..', 'OP');
1212 5 next;
1213 }
1214 } elsif ($c2 eq '=') {
1215 26 pos($$rstr) = $pos + 2;
1216 26 ($token, $token_desc, $token_type) = ('.=', '.=', 'OP');
1217 26 next;
1218 } else {
1219 149 pos($$rstr) = $pos + 1;
1220 149 ($token, $token_desc, $token_type) = ($c1, $c1, 'OP');
1221 149 next;
1222 }
1223 } elsif ($c1 eq '0') {
1224 247 my $c2 = substr($$rstr, $pos + 1, 1);
1225 247 ▶ if ($c2 eq 'x') {
Branch: 2 branches
BranchTrueFalseTotal
if ($c2 eq 'x') { } 4 243 247
elsif ($c2 eq 'b') { } 0 243 243
1226 4 ▶ if ($$rstr =~ m{\G(0x[0-9A-Fa-f_]+)}gc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$rstr =~ /\G(0x[0-9A-Fa-f_]+)/cg) 4 0 4
1227 4 ($token, $token_desc, $token_type) = ($1, 'HEX NUMBER', 'EXPR');
1228 4 next;
1229 }
1230 } elsif ($c2 eq 'b') {
1231 0 ▶ if ($$rstr =~ m{\G(0b[01_]+)}gc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$rstr =~ /\G(0b[01_]+)/cg) 0 0 0
1232 0 ($token, $token_desc, $token_type) = ($1, 'BINARY NUMBER', 'EXPR');
1233 0 next;
1234 }
1235 }
1236 }
1237  
1238 8095 ▶ if ($$rstr =~ m{\G((?:0|[1-9][0-9_]*)(?:\.[0-9][0-9_]*)?)}gc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$rstr =~ /\G((?:0|[1-9][0-9_]*)(?:\.[0-9][0-9_]*)?)/cg) 700 7395 8095
1239 700 my $number = $1;
1240 700 my $p = pos($$rstr);
1241 700 my $n1 = substr($$rstr, $p, 1);
1242 700 ▶ if ($n1 eq '.') {
Branch: 2 branches
BranchTrueFalseTotal
if ($n1 eq '.') { } 9 691 700
elsif ($n1 eq 'E' or $n1 eq 'e') { } 0 691 691
1243 9 ▶ if ($$rstr =~ m{\G((?:\.[0-9_])+)}gc) {
Branch: 2 branches
BranchTrueFalseTotal
if ($$rstr =~ /\G((?:\.[0-9_])+)/cg) { } 0 9 9
elsif (substr($$rstr, $p, 2) ne '..') { } 7 2 9
1244 0 $number .= $1;
1245 0 ($token, $token_desc, $token_type) = ($number, 'VERSION_STRING', 'EXPR');
1246 0 next;
1247 } elsif (substr($$rstr, $p, 2) ne '..') {
1248 7 $number .= '.';
1249 7 pos($$rstr) = $p + 1;
1250 }
1251 ▶ } elsif ($n1 eq 'E' or $n1 eq 'e') {
Condition33%1/3
$n1 eq "E" or $n1 eq "e"
l!l&&r!l&&!r
00691
MC/DC0%0/2
$n1 eq "E" or $n1 eq "e"
$n1 eq "E" $n1 eq "e"
Truth table33%1/3
A or B
A= $n1 eq "E"B= $n1 eq "e"
ABresult
1X1
011
000
1252 0 ▶ if ($$rstr =~ m{\G([Ee][+-]?[0-9]+)}gc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$rstr =~ /\G([Ee][+-]?[0-9]+)/cg) 0 0 0
1253 0 $number .= $1;
1254 }
1255 }
1256 700 ($token, $token_desc, $token_type) = ($number, 'NUMBER', 'EXPR');
1257 700 ▶ if ($prepend) {
Branch: 1 branch
BranchTrueFalseTotal
if ($prepend) 2 698 700
1258 2 $token = "$prepend$token";
1259 2 ▶ pop @tokens if @tokens and $tokens[-1][0] eq $prepend;
Branch: 1 branch
BranchTrueFalseTotal
if @tokens and $tokens[-1][0] eq $prepend 2 0 2
Condition33%1/3
@tokens and $tokens[-1][0] eq $prepend
!ll&&!rl&&r
002
MC/DC0%0/2
@tokens and $tokens[-1][0] eq $prepend
@tokens $tokens[-1][0] eq $prepend
Truth table33%1/3
A and B
A= @tokensB= $tokens[-1][0] eq $prepend
ABresult
0X0
100
111
1260 2 ▶ pop @scope_tokens if @scope_tokens and $scope_tokens[-1][0] eq $prepend;
Branch: 1 branch
BranchTrueFalseTotal
if @scope_tokens and $scope_tokens[-1][0] eq $prepend 0 2 2
Condition33%1/3
@scope_tokens and $scope_tokens[-1][0] eq $prepend
!ll&&!rl&&r
200
MC/DC0%0/2
@scope_tokens and $scope_tokens[-1][0] eq $prepend
@scope_tokens $scope_tokens[-1][0] eq $prepend
Truth table33%1/3
A and B
A= @scope_tokensB= $scope_tokens[-1][0] eq $prepend
ABresult
0X0
100
111
1261 }
1262 700 next;
1263 }
1264  
1265 7395 ▶ if ($prev_token_type ne 'ARROW' and ($prev_token_type ne 'KEYWORD' or !$c->token_expects_word($prev_token))) {
Branch: 1 branch
BranchTrueFalseTotal
if ($prev_token_type ne "ARROW" and $prev_token_type ne "KEYWORD" || !$c->token_expects_word($prev_token)) 5676 1719 7395
Condition100%6/6
$prev_token_type ne "ARROW" and $prev_token_type ne "KEYWORD" || !$c->token_expects_word($prev_token)
!ll&&!rl&&r
52151591715
$prev_token_type ne "KEYWORD" or not $c->token_expects_word($prev_token)
l!l&&r!l&&!r
54262501198
MC/DC100%3/3
$prev_token_type ne "ARROW" and $prev_token_type ne "KEYWORD" || !$c->token_expects_word($prev_token)
$prev_token_type ne "ARROW" $prev_token_type ne "KEYWORD" not $c->token_expects_word($prev_token)
Truth table100%4/4
A and B or not(C)
A= $prev_token_type ne "ARROW"B= $prev_token_type ne "KEYWORD"C= not $c->token_expects_word($prev_token)
ABCresult
0XX0
1000
11X1
1011
1266 5676 ▶ if ($prev_token_type eq 'EXPR' or $prev_token_type eq 'VARIABLE') {
Branch: 1 branch
BranchTrueFalseTotal
if ($prev_token_type eq "EXPR" or $prev_token_type eq "VARIABLE") 330 5346 5676
Condition100%3/3
$prev_token_type eq "EXPR" or $prev_token_type eq "VARIABLE"
l!l&&r!l&&!r
1631675346
MC/DC100%2/2
$prev_token_type eq "EXPR" or $prev_token_type eq "VARIABLE"
$prev_token_type eq "EXPR" $prev_token_type eq "VARIABLE"
Truth table100%3/3
A or B
A= $prev_token_type eq "EXPR"B= $prev_token_type eq "VARIABLE"
ABresult
1X1
011
000
1267 330 ▶ if ($c1 eq 'x') {
Branch: 1 branch
BranchTrueFalseTotal
if ($c1 eq "x") 5 325 330
1268 5 ▶ if ($$rstr =~ m{\G(x\b(?!\s*=>))}gc){
Branch: 1 branch
BranchTrueFalseTotal
if ($$rstr =~ /\G(x\b(?!\s*=>))/cg) 3 2 5
1269 3 ($token, $token_desc, $token_type) = ($1, $1, '');
1270 3 next;
1271 }
1272 }
1273 }
1274  
1275 5673 ▶ if ($c1 eq 'q') {
Branch: 5 branches
BranchTrueFalseTotal
if ($c1 eq 'q') { } 206 5467 5673
elsif ($c1 eq 'm') { } 651 4816 5467
elsif ($c1 eq 's') { } 591 4225 4816
elsif ($c1 eq 't') { } 28 4197 4225
elsif ($c1 eq 'y') { } 4 4193 4197
1276 206 my $quotelike_re = $c->quotelike_re;
1277 206 ▶ if ($$rstr =~ m{\G((?:$quotelike_re)\b(?!\s*=>))}gc) {
Branch: 4 branches
BranchTrueFalseTotal
if ($$rstr =~ /\G((?:$quotelike_re)\b(?!\s*=>))/cg) { } 96 110 206
elsif ($$rstr =~ /\G((?:qw)\b(?!\s*=>))/cg) { } 92 18 110
elsif ($$rstr =~ /\G((?:qx)\b(?!\s*=>))/cg) { } 0 18 18
elsif ($$rstr =~ /\G(qr\b(?!\s*=>))/cg) { } 16 2 18
1278 96 ▶ if (my $quotelike = $self->_match_quotelike($c, $rstr, $1)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $quotelike = $self->_match_quotelike($c, $rstr, $1)) { } 96 0 96
1279 96 ($token, $token_desc, $token_type) = ($quotelike, 'STRING', 'STRING');
1280 96 next;
1281 } else {
1282 0 _debug("QUOTELIKE ERROR: $@") if DEBUG;
1283 0 pos($$rstr) = $pos;
1284 }
1285 } elsif ($$rstr =~ m{\G((?:qw)\b(?!\s*=>))}gc) {
1286 92 ▶ if (my $quotelike = $self->_match_quotelike($c, $rstr, $1)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $quotelike = $self->_match_quotelike($c, $rstr, $1)) { } 92 0 92
1287 92 ($token, $token_desc, $token_type) = ($quotelike, 'QUOTED_WORD_LIST', 'EXPR');
1288 92 next;
1289 } else {
1290 0 _debug("QUOTELIKE ERROR: $@") if DEBUG;
1291 0 pos($$rstr) = $pos;
1292 }
1293 } elsif ($$rstr =~ m{\G((?:qx)\b(?!\s*=>))}gc) {
1294 0 ▶ if (my $quotelike = $self->_match_quotelike($c, $rstr, $1)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $quotelike = $self->_match_quotelike($c, $rstr, $1)) { } 0 0 0
1295 0 ($token, $token_desc, $token_type) = ($quotelike, 'BACKTICK', 'EXPR');
1296 0 next;
1297 } else {
1298 0 _debug("QUOTELIKE ERROR: $@") if DEBUG;
1299 0 pos($$rstr) = $pos;
1300 }
1301 } elsif ($$rstr =~ m{\G(qr\b(?!\s*=>))}gc) {
1302 16 ▶ if (my $regexp = $self->_match_regexp($c, $rstr)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $regexp = $self->_match_regexp($c, $rstr)) { } 16 0 16
1303 16 ($token, $token_desc, $token_type) = ($regexp, 'qr', 'EXPR');
1304 16 next;
1305 } else {
1306 0 _debug("QUOTELIKE ERROR: $@") if DEBUG;
1307 0 pos($$rstr) = $pos;
1308 }
1309 }
1310 } elsif ($c1 eq 'm') {
1311 651 ▶ if ($$rstr =~ m{\G(m\b(?!\s*=>))}gc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$rstr =~ /\G(m\b(?!\s*=>))/cg) 31 620 651
1312 31 ▶ if (my $regexp = $self->_match_regexp($c, $rstr)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $regexp = $self->_match_regexp($c, $rstr)) { } 31 0 31
1313 31 ($token, $token_desc, $token_type) = ($regexp, 'm', 'EXPR');
1314 31 next;
1315 } else {
1316 0 _debug("REGEXP ERROR: $@") if DEBUG;
1317 0 pos($$rstr) = $pos;
1318 }
1319 }
1320 } elsif ($c1 eq 's') {
1321 591 ▶ if ($$rstr =~ m{\G(s\b(?!\s*=>))}gc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$rstr =~ /\G(s\b(?!\s*=>))/cg) 53 538 591
1322 53 ▶ if (my $regexp = $self->_match_substitute($c, $rstr)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $regexp = $self->_match_substitute($c, $rstr)) { } 53 0 53
1323 53 ($token, $token_desc, $token_type) = ($regexp, 's', 'EXPR');
1324 53 next;
1325 } else {
1326 0 _debug("SUBSTITUTE ERROR: $@") if DEBUG;
1327 0 pos($$rstr) = $pos;
1328 }
1329 }
1330 } elsif ($c1 eq 't') {
1331 28 ▶ if ($$rstr =~ m{\G(tr\b(?!\s*=>))}gc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$rstr =~ /\G(tr\b(?!\s*=>))/cg) 3 25 28
1332 3 ▶ if (my $trans = $self->_match_transliterate($c, $rstr)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $trans = $self->_match_transliterate($c, $rstr)) { } 3 0 3
1333 3 ($token, $token_desc, $token_type) = ($trans, 'tr', 'EXPR');
1334 3 next;
1335 } else {
1336 0 _debug("TRANSLITERATE ERROR: $@") if DEBUG;
1337 0 pos($$rstr) = $pos;
1338 }
1339 }
1340 } elsif ($c1 eq 'y') {
1341 4 ▶ if ($$rstr =~ m{\G(y\b(?!\s*=>))}gc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$rstr =~ /\G(y\b(?!\s*=>))/cg) 2 2 4
1342 2 ▶ if (my $trans = $self->_match_transliterate($c, $rstr)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $trans = $self->_match_transliterate($c, $rstr)) { } 2 0 2
1343 2 ($token, $token_desc, $token_type) = ($trans, 'y', 'EXPR');
1344 2 next;
1345 } else {
1346 0 _debug("TRANSLITERATE ERROR: $@") if DEBUG;
1347 0 pos($$rstr) = $pos;
1348 }
1349 }
1350 }
1351 }
1352  
1353 7099 ▶ if ($$rstr =~ m{\G(\w+)}gc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$rstr =~ /\G(\w+)/cg) 6330 769 7099
1354 6330 $token = $1;
1355 6330 ▶ if ($prev_token_type eq 'ARROW') {
Branch: 4 branches
BranchTrueFalseTotal
if ($prev_token_type eq 'ARROW') { } 521 5809 6330
elsif ($token eq 'CORE') { } 3 5806 5809
elsif ($token eq 'format') { } 5 5801 5806
elsif ($c->token_is_keyword($token) and $prev_token_type ne 'KEYWORD' || !$c->token_expects_word($prev_token) || $prev_token eq 'sub' && $token eq 'BEGIN') { } 3649 2152 5801
1356 521 ▶ $$rstr =~ m{\G((?:(?:::|')\w+)+)\b}gc and $token .= $1;
Branch: 1 branch
BranchTrueFalseTotal
$$rstr =~ /\G((?:(?:::|')\w+)+)\b/cg and $token .= $1 9 512 521
1357 521 ($token_desc, $token_type) = ('METHOD', 'METHOD');
1358 } elsif ($token eq 'CORE') {
1359 3 ($token_desc, $token_type) = ('NAMESPACE', 'WORD');
1360 } elsif ($token eq 'format') {
1361 5 ▶ if ($$rstr =~ m{\G([^=]*?=[ \t]*\n.*?\n\.\n)}gcs) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$rstr =~ /\G([^=]*?=[ \t]*\n.*?\n\.\n)/cgs) 4 1 5
1362 4 $token .= $1;
1363 4 ($token_desc, $token_type) = ('FORMAT', '');
1364 4 $current_scope |= F_STATEMENT_END|F_EXPR_END;
1365 4 next;
1366 }
1367 ▶ } elsif ($c->token_is_keyword($token) and ($prev_token_type ne 'KEYWORD' or !$c->token_expects_word($prev_token) or ($prev_token eq 'sub' and $token eq 'BEGIN'))) {
Condition100%12/12
$c->token_is_keyword($token) and $prev_token_type ne "KEYWORD" || !$c->token_expects_word($prev_token) || $prev_token eq "sub" && $token eq "BEGIN"
!ll&&!rl&&r
2132203649
$prev_token_type ne "KEYWORD" or not $c->token_expects_word($prev_token) or $prev_token eq "sub" and $token eq "BEGIN"
l!l&&r!l&&!r
3643620
$prev_token_type ne "KEYWORD" or not $c->token_expects_word($prev_token)
l!l&&r!l&&!r
350114226
$prev_token eq "sub" and $token eq "BEGIN"
!ll&&!rl&&r
1196
MC/DC100%5/5
$c->token_is_keyword($token) and $prev_token_type ne "KEYWORD" || !$c->token_expects_word($prev_token) || $prev_token eq "sub" && $token eq "BEGIN"
$c->token_is_keyword($token) $prev_token_type ne "KEYWORD" not $c->token_expects_word($prev_token) $prev_token eq "sub" $token eq "BEGIN"
Truth table100%6/6
A and B or not(C) or D and E
A= $c->token_is_keyword($token)B= $prev_token_type ne "KEYWORD"C= not $c->token_expects_word($prev_token)D= $prev_token eq "sub"E= $token eq "BEGIN"
ABCDEresult
0XXXX0
1000X0
100100
11XXX1
101XX1
100111
1368 3649 ▶ if ($c->token_is_op_keyword($token)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c->token_is_op_keyword($token)) { } 164 3485 3649
1369 164 ($token_desc, $token_type) = ($token, 'OP');
1370 } else {
1371 3485 ($token_desc, $token_type) = ('KEYWORD', 'KEYWORD');
1372 3485 $c->check_new_keyword($token);
1373 3485 ▶ push @keywords, $token unless $token eq 'undef';
Branch: 1 branch
BranchTrueFalseTotal
unless $token eq "undef" 3441 44 3485
1374 }
1375 } else {
1376 2152 ▶ if ($c1 eq 'v' and $token =~ /^v(?:0|[1-9][0-9]*)$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c1 eq "v" and $token =~ /^v(?:0|[1-9][0-9]*)$/) 5 2147 2152
Condition100%3/3
$c1 eq "v" and $token =~ /^v(?:0|[1-9][0-9]*)$/
!ll&&!rl&&r
2102455
MC/DC100%2/2
$c1 eq "v" and $token =~ /^v(?:0|[1-9][0-9]*)$/
$c1 eq "v" $token =~ /^v(?:0|[1-9][0-9]*)$/
Truth table100%3/3
A and B
A= $c1 eq "v"B= $token =~ /^v(?:0|[1-9][0-9]*)$/
ABresult
0X0
100
111
1377 5 ▶ if ($$rstr =~ m{\G((?:\.[0-9][0-9_]*)+)}gc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$rstr =~ /\G((?:\.[0-9][0-9_]*)+)/cg) 5 0 5
1378 5 $token .= $1;
1379 5 ($token_desc, $token_type) = ('VERSION_STRING', 'EXPR');
1380 5 next;
1381 }
1382 }
1383 2147 ▶ $$rstr =~ m{\G((?:(?:::|')\w+)+)\b}gc and $token .= $1;
Branch: 1 branch
BranchTrueFalseTotal
$$rstr =~ /\G((?:(?:::|')\w+)+)\b/cg and $token .= $1 421 1726 2147
1384 2147 ($token_desc, $token_type) = ('WORD', 'WORD');
1385 2147 ▶ if ($prepend) {
Branch: 1 branch
BranchTrueFalseTotal
if ($prepend) 49 2098 2147
1386 49 $token = "$prepend$token";
1387 49 ▶ pop @tokens if @tokens and $tokens[-1][0] eq $prepend;
Branch: 1 branch
BranchTrueFalseTotal
if @tokens and $tokens[-1][0] eq $prepend 10 39 49
Condition66%2/3
@tokens and $tokens[-1][0] eq $prepend
!ll&&!rl&&r
39010
MC/DC50%1/2
@tokens and $tokens[-1][0] eq $prepend
@tokens $tokens[-1][0] eq $prepend
Truth table66%2/3
A and B
A= @tokensB= $tokens[-1][0] eq $prepend
ABresult
0X0
100
111
1388 49 ▶ pop @scope_tokens if @scope_tokens and $scope_tokens[-1][0] eq $prepend;
Branch: 1 branch
BranchTrueFalseTotal
if @scope_tokens and $scope_tokens[-1][0] eq $prepend 39 10 49
Condition66%2/3
@scope_tokens and $scope_tokens[-1][0] eq $prepend
!ll&&!rl&&r
10039
MC/DC50%1/2
@scope_tokens and $scope_tokens[-1][0] eq $prepend
@scope_tokens $scope_tokens[-1][0] eq $prepend
Truth table66%2/3
A and B
A= @scope_tokensB= $scope_tokens[-1][0] eq $prepend
ABresult
0X0
100
111
1389 }
1390 }
1391 6321 next;
1392 }
1393  
1394 # ignore control characters
1395 769 ▶ if ($$rstr =~ m{\G([[:cntrl:]]+)}gc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$rstr =~ /\G([[:cntrl:]]+)/cg) 0 769 769
1396 0 next;
1397 }
1398  
1399 769 ▶ if ($$rstr =~ m{\G([[:ascii:]]+)}gc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$rstr =~ /\G([[:ascii:]]+)/cg) 1 768 769
1400 1 ▶ last if $parent_scope & F_STRING_EVAL;
Branch: 1 branch
BranchTrueFalseTotal
if $parent_scope & 4 1 0 1
1401 0 _error("UNKNOWN: $1");
1402 0 push @{$c->{errors}}, qq{"$1"};
1403 0 $token = $1;
1404 0 next;
1405 }
1406 768 ▶ if ($$rstr =~ m{\G([[:^ascii:]](?:[[:^ascii:]]|\w)*)}gc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$rstr =~ /\G([[:^ascii:]](?:[[:^ascii:]]|\w)*)/cg) 0 768 768
1407 0 ▶ if (!$c->{utf8}) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $c->{'utf8'}) { } 0 0 0
1408 0 ▶ last if $parent_scope & F_STRING_EVAL;
Branch: 1 branch
BranchTrueFalseTotal
if $parent_scope & 4 0 0 0
1409 0 _error("UNICODE?: $1");
1410 0 push @{$c->{errors}}, qq{"$1"};
1411 } else {
1412 0 _debug("UTF8: $1") if DEBUG;
1413 }
1414 0 $token = $1;
1415 0 next;
1416 }
1417 768 ▶ if ($$rstr =~ m{\G(\S+)}gc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$rstr =~ /\G(\S+)/cg) 0 768 768
1418 0 ▶ last if $parent_scope & F_STRING_EVAL;
Branch: 1 branch
BranchTrueFalseTotal
if $parent_scope & 4 0 0 0
1419 0 _error("UNEXPECTED: $1");
1420 0 push @{$c->{errors}}, qq{"$1"};
1421 0 $token = $1;
1422 }
1423  
1424 768 last;
1425 } continue {
1426 47183 ▶ die "Aborted at $prev_pos" if $prev_pos == pos($$rstr);
Branch: 1 branch
BranchTrueFalseTotal
if $prev_pos == pos $$rstr 0 47183 47183
1427 47183 $prev_pos = pos($$rstr);
1428  
1429 47183 ▶ if (defined $token) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $token) 27410 19773 47183
1430 27410 ▶ if (!($current_scope & F_EXPR)) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $current_scope & 512) { } 6154 21256 27410
elsif ($current_scope & 512 and $current_scope & 256 || $ends_expr{$token} && $token_type eq 'KEYWORD' && $prev_token ne ',' && $prev_token ne '=>') { } 3515 35482 38997
1431 6154 _debug('BEGIN EXPR') if DEBUG;
1432 6154 $current_scope |= F_EXPR;
1433 ▶ } elsif (($current_scope & F_EXPR) and (($current_scope & F_EXPR_END) or ($ends_expr{$token} and $token_type eq 'KEYWORD' and $prev_token ne ',' and $prev_token ne '=>'))) {
Condition86%13/15
$current_scope & 512 and $current_scope & 256 || $ends_expr{$token} && $token_type eq "KEYWORD" && $prev_token ne "," && $prev_token ne "=>"
!ll&&!rl&&r
0177413515
$current_scope & 256 or $ends_expr{$token} and $token_type eq "KEYWORD" and $prev_token ne "," and $prev_token ne "=>"
l!l&&r!l&&!r
328922617741
$ends_expr{$token} and $token_type eq "KEYWORD" and $prev_token ne "," and $prev_token ne "=>"
!ll&&!rl&&r
177410226
$ends_expr{$token} and $token_type eq "KEYWORD" and $prev_token ne ","
!ll&&!rl&&r
177383226
$ends_expr{$token} and $token_type eq "KEYWORD"
!ll&&!rl&&r
158691869229
MC/DC66%4/6
$current_scope & 512 and $current_scope & 256 || $ends_expr{$token} && $token_type eq "KEYWORD" && $prev_token ne "," && $prev_token ne "=>"
$current_scope & 512 $current_scope & 256 $ends_expr{$token} $token_type eq "KEYWORD" $prev_token ne "," $prev_token ne "=>"
Truth table71%5/7
A and B or C and D and E and F
A= $current_scope & 512B= $current_scope & 256C= $ends_expr{$token}D= $token_type eq "KEYWORD"E= $prev_token ne ","F= $prev_token ne "=>"
ABCDEFresult
0XXXXX0
100XXX0
1010XX0
10110X0
1011100
11XXXX1
1011111
1434 3515 @keywords = ();
1435 3515 _debug('END EXPR') if DEBUG;
1436 3515 $current_scope &= MASK_EXPR_END;
1437 }
1438 27410 $prepend = undef;
1439  
1440 27410 if (DEBUG) {
1441 my $token_str = ref $token ? Data::Dump::dump($token) : $token;
1442 _debug("GOT: $token_str ($pos) TYPE: $token_desc ($token_type)".($prev_token_type ? " PREV: $prev_token_type" : '').(@keywords ? " KEYWORD: @keywords" : '').(($current_scope | $parent_scope) & F_EVAL ? ' EVAL' : '').(($current_scope | $parent_scope) & F_KEEP_TOKENS ? ' KEEP' : ''));
1443 }
1444  
1445 27410 ▶ if ($parent_scope & F_KEEP_TOKENS) {
Branch: 1 branch
BranchTrueFalseTotal
if ($parent_scope & 1) 841 26569 27410
1446 841 push @scope_tokens, [$token, $token_desc];
1447 841 ▶ if ($token eq '-' or $token eq '+') {
Branch: 1 branch
BranchTrueFalseTotal
if ($token eq "-" or $token eq "+") 39 802 841
Condition66%2/3
$token eq "-" or $token eq "+"
l!l&&r!l&&!r
390802
MC/DC50%1/2
$token eq "-" or $token eq "+"
$token eq "-" $token eq "+"
Truth table66%2/3
A or B
A= $token eq "-"B= $token eq "+"
ABresult
1X1
011
000
1448 39 $prepend = $token;
1449 }
1450 }
1451 27410 ▶ if (!($current_scope & F_KEEP_TOKENS) and (exists $c->{callback}{$token} or exists $c->{keyword}{$token} or exists $c->{sub}{$token}) and $token_type ne 'METHOD' and !$c->token_expects_word($prev_token)) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $current_scope & 1 and exists $c->{"callback"}{$token} || exists $c->{"keyword"}{$token} || exists $c->{"sub"}{$token} and $token_type ne "METHOD" and not $c->token_expects_word($prev_token)) 1109 26301 27410
Condition100%15/15
not $current_scope & 1 and exists $c->{"callback"}{$token} || exists $c->{"keyword"}{$token} || exists $c->{"sub"}{$token} and $token_type ne "METHOD" and not $c->token_expects_word($prev_token)
!ll&&!rl&&r
2630011109
not $current_scope & 1 and exists $c->{"callback"}{$token} || exists $c->{"keyword"}{$token} || exists $c->{"sub"}{$token} and $token_type ne "METHOD"
!ll&&!rl&&r
2629911110
not $current_scope & 1 and exists $c->{"callback"}{$token} || exists $c->{"keyword"}{$token} || exists $c->{"sub"}{$token}
!ll&&!rl&&r
3462228371111
exists $c->{"callback"}{$token} or exists $c->{"keyword"}{$token} or exists $c->{"sub"}{$token}
l!l&&r!l&&!r
10822922837
exists $c->{"callback"}{$token} or exists $c->{"keyword"}{$token}
l!l&&r!l&&!r
82325922866
MC/DC100%6/6
not $current_scope & 1 and exists $c->{"callback"}{$token} || exists $c->{"keyword"}{$token} || exists $c->{"sub"}{$token} and $token_type ne "METHOD" and not $c->token_expects_word($prev_token)
not $current_scope & 1 exists $c->{"callback"}{$token} exists $c->{"keyword"}{$token} exists $c->{"sub"}{$token} $token_type ne "METHOD" not $c->token_expects_word($prev_token)
Truth table63%7/11
not(A) and B or C or D and E and not(F)
A= not $current_scope & 1B= exists $c->{"callback"}{$token}C= exists $c->{"keyword"}{$token}D= exists $c->{"sub"}{$token}E= $token_type ne "METHOD"F= not $c->token_expects_word($prev_token)
ABCDEFresult
0XXXXX0
1000XX0
11XX0X0
101X0X0
10010X0
11XX100
101X100
1001100
11XX111
101X111
1001111
1452 1109 $current_scope |= F_KEEP_TOKENS;
1453 }
1454 27410 ▶ if ($c->token_expects_block($token)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c->token_expects_block($token)) 1153 26257 27410
1455 1153 $waiting_for_a_block = 1;
1456 }
1457 27410 ▶ if ($current_scope & F_EVAL or ($parent_scope & F_EVAL and (!@{$c->{stack}} or $c->{stack}[-1][0] ne '{'))) {
Branch: 1 branch
BranchTrueFalseTotal
if ($current_scope & 2 or $parent_scope & 2 and !@{$c->{"stack"};} || $c->{"stack"}[-1][0] ne "{") 134 27276 27410
Condition100%9/9
$current_scope & 2 or $parent_scope & 2 and !@{$c->{"stack"};} || $c->{"stack"}[-1][0] ne "{"
l!l&&r!l&&!r
5828227070
$parent_scope & 2 and !@{$c->{"stack"};} || $c->{"stack"}[-1][0] ne "{"
!ll&&!rl&&r
2719512928
not @{$c->{"stack"};} or $c->{"stack"}[-1][0] ne "{"
l!l&&r!l&&!r
621481
MC/DC100%4/4
$current_scope & 2 or $parent_scope & 2 and !@{$c->{"stack"};} || $c->{"stack"}[-1][0] ne "{"
$current_scope & 2 $parent_scope & 2 not @{$c->{"stack"};} $c->{"stack"}[-1][0] ne "{"
Truth table100%5/5
A or B and not(C) or D
A= $current_scope & 2B= $parent_scope & 2C= not @{$c->{"stack"};}D= $c->{"stack"}[-1][0] ne "{"
ABCDresult
1XXX1
011X1
01011
00XX0
01000
1458 134 ▶ if ($token_type eq 'STRING') {
Branch: 3 branches
BranchTrueFalseTotal
if ($token_type eq 'STRING') { } 32 102 134
elsif ($token_desc eq 'HEREDOC') { } 1 101 102
elsif ($token_type eq 'VARIABLE') { } 8 93 101
1459 32 ▶ if ($token->[0] =~ /\b(?:(?:use|no)\s+[A-Za-z]|require\s+(?:q[qw]?.|['"])?[A-Za-z])/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($token->[0] =~ /\b(?:(?:use|no)\s+[A-Za-z]|require\s+(?:q[qw]?.|['"])?[A-Za-z])/) 20 12 32
1460 20 my $eval_string = $token->[0];
1461 20 ▶ if (defined $eval_string and $eval_string ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $eval_string and $eval_string ne "") 20 0 20
Condition33%1/3
defined $eval_string and $eval_string ne ""
!ll&&!rl&&r
0020
MC/DC0%0/2
defined $eval_string and $eval_string ne ""
defined $eval_string $eval_string ne ""
Truth table33%1/3
A and B
A= defined $eval_stringB= $eval_string ne ""
ABresult
0X0
100
111
1462 20 $eval_string =~ s/\\(.)/$1/g;
1463 20 pos($eval_string) = 0;
1464 20 $c->{eval} = 1;
1465 20 my $saved_stack = $c->{stack};
1466 20 $c->{stack} = [];
1467 20 eval { $self->_scan($c, \$eval_string, (
1468 ($current_scope | $parent_scope | F_STRING_EVAL) &
1469 F_RESCAN
1470 ))};
1471 20 $c->{stack} = $saved_stack;
1472 }
1473 }
1474 32 $current_scope &= MASK_EVAL;
1475 } elsif ($token_desc eq 'HEREDOC') {
1476 1 ▶ if ($token->[0] =~ /\b(?:use|require|no)\s+[A-Za-z]/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($token->[0] =~ /\b(?:use|require|no)\s+[A-Za-z]/) 1 0 1
1477 1 my $eval_string = $token->[0];
1478 1 ▶ if (defined $eval_string and $eval_string ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $eval_string and $eval_string ne "") 1 0 1
Condition33%1/3
defined $eval_string and $eval_string ne ""
!ll&&!rl&&r
001
MC/DC0%0/2
defined $eval_string and $eval_string ne ""
defined $eval_string $eval_string ne ""
Truth table33%1/3
A and B
A= defined $eval_stringB= $eval_string ne ""
ABresult
0X0
100
111
1479 1 $eval_string =~ s/\\(.)/$1/g;
1480 1 pos($eval_string) = 0;
1481 1 $c->{eval} = 1;
1482 1 my $saved_stack = $c->{stack};
1483 1 $c->{stack} = [];
1484 1 eval { $self->_scan($c, \$eval_string, (
1485 ($current_scope | $parent_scope | F_STRING_EVAL) &
1486 F_RESCAN
1487 ))};
1488 1 $c->{stack} = $saved_stack;
1489 }
1490 }
1491 1 $current_scope &= MASK_EVAL;
1492 } elsif ($token_type eq 'VARIABLE') {
1493 8 $current_scope &= MASK_EVAL;
1494 }
1495 134 ▶ $c->{eval} = ($current_scope | $parent_scope) & F_EVAL ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
($current_scope | $parent_scope) & 2 ? : 104 30 134
1496 }
1497 27410 ▶ if ($token eq 'eval') {
Branch: 1 branch
BranchTrueFalseTotal
if ($token eq "eval") 51 27359 27410
1498 51 $current_scope |= F_EVAL;
1499 51 $c->{eval} = 1;
1500 }
1501  
1502 27410 ▶ if ($current_scope & F_KEEP_TOKENS) {
Branch: 1 branch
BranchTrueFalseTotal
if ($current_scope & 1) 4571 22839 27410
1503 4571 push @tokens, [$token, $token_desc];
1504 4571 ▶ if ($token eq '-' or $token eq '+') {
Branch: 1 branch
BranchTrueFalseTotal
if ($token eq "-" or $token eq "+") 12 4559 4571
Condition100%3/3
$token eq "-" or $token eq "+"
l!l&&r!l&&!r
1114559
MC/DC100%2/2
$token eq "-" or $token eq "+"
$token eq "-" $token eq "+"
Truth table100%3/3
A or B
A= $token eq "-"B= $token eq "+"
ABresult
1X1
011
000
1505 12 $prepend = $token;
1506 }
1507 4571 ▶ if ($token_type eq 'KEYWORD' and $has_sideff{$token}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($token_type eq "KEYWORD" and $has_sideff{$token}) 11 4560 4571
Condition100%3/3
$token_type eq "KEYWORD" and $has_sideff{$token}
!ll&&!rl&&r
3395116511
MC/DC100%2/2
$token_type eq "KEYWORD" and $has_sideff{$token}
$token_type eq "KEYWORD" $has_sideff{$token}
Truth table100%3/3
A and B
A= $token_type eq "KEYWORD"B= $has_sideff{$token}
ABresult
0X0
100
111
1508 11 $current_scope |= F_SIDEFF;
1509 }
1510 }
1511 27410 ▶ if ($stack) {
Branch: 1 branch
BranchTrueFalseTotal
if ($stack) 2317 25093 27410
1512 2317 push @{$c->{stack}}, $stack;
1513 2317 _dump_stack($c, $stack->[0]) if DEBUG;
1514 2317 my $child_scope = $current_scope | $parent_scope;
1515 2317 ▶ if ($token eq '{' and $is_conditional{$stack->[2]}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($token eq "{" and $is_conditional{$stack->[2]}) 271 2046 2317
Condition100%3/3
$token eq "{" and $is_conditional{$stack->[2]}
!ll&&!rl&&r
1383663271
MC/DC100%2/2
$token eq "{" and $is_conditional{$stack->[2]}
$token eq "{" $is_conditional{$stack->[2]}
Truth table100%3/3
A and B
A= $token eq "{"B= $is_conditional{$stack->[2]}
ABresult
0X0
100
111
1516 271 $child_scope |= F_CONDITIONAL
1517 }
1518 2317 my $scanned_tokens = $self->_scan($c, $rstr, (
1519 $child_scope & F_RESCAN
1520 ));
1521 2317 ▶ if ($token eq '{' and $current_scope & F_EVAL) {
Branch: 1 branch
BranchTrueFalseTotal
if ($token eq "{" and $current_scope & 2) 16 2301 2317
Condition100%3/3
$token eq "{" and $current_scope & 2
!ll&&!rl&&r
138391816
MC/DC100%2/2
$token eq "{" and $current_scope & 2
$token eq "{" $current_scope & 2
Truth table100%3/3
A and B
A= $token eq "{"B= $current_scope & 2
ABresult
0X0
100
111
1522 16 $current_scope &= MASK_EVAL;
1523 16 ▶ $c->{eval} = ($current_scope | $parent_scope) & F_EVAL ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
($current_scope | $parent_scope) & 2 ? : 0 16 16
1524 }
1525 2317 ▶ if ($current_scope & F_KEEP_TOKENS) {
Branch: 2 branches
BranchTrueFalseTotal
if ($current_scope & 1) { } 139 2178 2317
elsif ($parent_scope & 1) { } 36 2142 2178
1526 139 ▶ my $start = pop @tokens || '';
Condition50%1/2
pop @tokens || ''
l!l
1390
MC/DC0%0/1
pop @tokens || ''
pop @tokens
Truth table50%1/2
A
A= pop @tokens
Aresult
11
00
1527 139 ▶ my $end = pop @$scanned_tokens || '';
Condition50%1/2
pop @$scanned_tokens || ''
l!l
1390
MC/DC0%0/1
pop @$scanned_tokens || ''
pop @$scanned_tokens
Truth table50%1/2
A
A= pop @$scanned_tokens
Aresult
11
00
1528 139 push @tokens, [$scanned_tokens, "$start->[0]$end->[0]"];
1529 } elsif ($parent_scope & F_KEEP_TOKENS) {
1530 36 ▶ my $start = pop @scope_tokens || '';
Condition50%1/2
pop @scope_tokens || ''
l!l
360
MC/DC0%0/1
pop @scope_tokens || ''
pop @scope_tokens
Truth table50%1/2
A
A= pop @scope_tokens
Aresult
11
00
1531 36 ▶ my $end = pop @$scanned_tokens || '';
Condition50%1/2
pop @$scanned_tokens || ''
l!l
360
MC/DC0%0/1
pop @$scanned_tokens || ''
pop @$scanned_tokens
Truth table50%1/2
A
A= pop @$scanned_tokens
Aresult
11
00
1532 36 push @scope_tokens, [$scanned_tokens, "$start->[0]$end->[0]"];
1533 }
1534  
1535 2317 ▶ if ($stack->[0] eq '(' and $prev_token_type eq 'KEYWORD' and @keywords and $keywords[-1] eq $prev_token and !$c->token_expects_expr_block($prev_token)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($stack->[0] eq "(" and $prev_token_type eq "KEYWORD" and @keywords and $keywords[-1] eq $prev_token and not $c->token_expects_expr_block($prev_token)) 302 2015 2317
Condition91%11/12
$stack->[0] eq "(" and $prev_token_type eq "KEYWORD" and @keywords and $keywords[-1] eq $prev_token and not $c->token_expects_expr_block($prev_token)
!ll&&!rl&&r
1828187302
$stack->[0] eq "(" and $prev_token_type eq "KEYWORD" and @keywords and $keywords[-1] eq $prev_token
!ll&&!rl&&r
18280489
$stack->[0] eq "(" and $prev_token_type eq "KEYWORD" and @keywords
!ll&&!rl&&r
181513489
$stack->[0] eq "(" and $prev_token_type eq "KEYWORD"
!ll&&!rl&&r
1227588502
MC/DC80%4/5
$stack->[0] eq "(" and $prev_token_type eq "KEYWORD" and @keywords and $keywords[-1] eq $prev_token and not $c->token_expects_expr_block($prev_token)
$stack->[0] eq "(" $prev_token_type eq "KEYWORD" @keywords $keywords[-1] eq $prev_token not $c->token_expects_expr_block($prev_token)
Truth table83%5/6
A and B and C and D and not(E)
A= $stack->[0] eq "("B= $prev_token_type eq "KEYWORD"C= @keywordsD= $keywords[-1] eq $prev_tokenE= not $c->token_expects_expr_block($prev_token)
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
1536 302 pop @keywords;
1537 }
1538  
1539 2317 ▶ if ($stack->[0] eq '{' and @keywords and $c->token_expects_block($keywords[0]) and !$c->token_expects_block_list($keywords[-1])) {
Branch: 1 branch
BranchTrueFalseTotal
if ($stack->[0] eq "{" and @keywords and $c->token_expects_block($keywords[0]) and not $c->token_expects_block_list($keywords[-1])) 639 1678 2317
Condition100%9/9
$stack->[0] eq "{" and @keywords and $c->token_expects_block($keywords[0]) and not $c->token_expects_block_list($keywords[-1])
!ll&&!rl&&r
165226639
$stack->[0] eq "{" and @keywords and $c->token_expects_block($keywords[0])
!ll&&!rl&&r
157676665
$stack->[0] eq "{" and @keywords
!ll&&!rl&&r
1383193741
MC/DC100%4/4
$stack->[0] eq "{" and @keywords and $c->token_expects_block($keywords[0]) and not $c->token_expects_block_list($keywords[-1])
$stack->[0] eq "{" @keywords $c->token_expects_block($keywords[0]) not $c->token_expects_block_list($keywords[-1])
Truth table100%5/5
A and B and C and not(D)
A= $stack->[0] eq "{"B= @keywordsC= $c->token_expects_block($keywords[0])D= not $c->token_expects_block_list($keywords[-1])
ABCDresult
0XXX0
10XX0
110X0
11100
11111
1540 639 ▶ $current_scope |= F_STATEMENT_END unless @tokens and ($c->token_defines_sub($keywords[-1]) or $keywords[-1] eq 'eval');
Branch: 1 branch
BranchTrueFalseTotal
unless @tokens and $c->token_defines_sub($keywords[-1]) || $keywords[-1] eq "eval" 639 0 639
Condition16%1/6
@tokens and $c->token_defines_sub($keywords[-1]) || $keywords[-1] eq "eval"
!ll&&!rl&&r
63900
$c->token_defines_sub($keywords[-1]) or $keywords[-1] eq "eval"
l!l&&r!l&&!r
000
MC/DC0%0/3
@tokens and $c->token_defines_sub($keywords[-1]) || $keywords[-1] eq "eval"
@tokens $c->token_defines_sub($keywords[-1]) $keywords[-1] eq "eval"
Truth table25%1/4
A and B or C
A= @tokensB= $c->token_defines_sub($keywords[-1])C= $keywords[-1] eq "eval"
ABCresult
0XX0
1000
11X1
1011
1541 }
1542 2317 $stack = undef;
1543 }
1544 27410 ▶ if ($current_scope & F_STATEMENT_END) {
Branch: 1 branch
BranchTrueFalseTotal
if ($current_scope & 128) 4501 22909 27410
1545 4501 ▶ if (($current_scope & F_KEEP_TOKENS) and @tokens) {
Branch: 1 branch
BranchTrueFalseTotal
if ($current_scope & 1 and @tokens) 1059 3442 4501
Condition66%2/3
$current_scope & 1 and @tokens
!ll&&!rl&&r
344201059
MC/DC50%1/2
$current_scope & 1 and @tokens
$current_scope & 1 @tokens
Truth table66%2/3
A and B
A= $current_scope & 1B= @tokens
ABresult
0X0
100
111
1546 1059 my $first_token = $tokens[0][0];
1547 1059 ▶ if ($first_token eq '->') {
Branch: 1 branch
BranchTrueFalseTotal
if ($first_token eq "->") 46 1013 1059
1548 46 $first_token = $tokens[1][0];
1549 # ignore ->use and ->no
1550 # ->require may be from UNIVERSAL::require
1551 46 ▶ if ($first_token eq 'use' or $first_token eq 'no') {
Branch: 1 branch
BranchTrueFalseTotal
if ($first_token eq "use" or $first_token eq "no") 1 45 46
Condition66%2/3
$first_token eq "use" or $first_token eq "no"
l!l&&r!l&&!r
1045
MC/DC50%1/2
$first_token eq "use" or $first_token eq "no"
$first_token eq "use" $first_token eq "no"
Truth table66%2/3
A or B
A= $first_token eq "use"B= $first_token eq "no"
ABresult
1X1
011
000
1552 1 $first_token = '';
1553 }
1554 }
1555 1059 ▶ my $cond = (($current_scope | $parent_scope) & (F_CONDITIONAL|F_SIDEFF)) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
($current_scope | $parent_scope) & 48 ? : 44 1015 1059
1556 1059 ▶ if (exists $c->{callback}{$first_token}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $c->{"callback"}{$first_token}) 793 266 1059
1557 793 $c->{current_scope} = \$current_scope;
1558 793 $c->{cond} = $cond;
1559 793 $c->{callback}{$first_token}->($c, $rstr, \@tokens);
1560  
1561 793 ▶ if ($c->{found_unsupported_package} and !$c->{quick}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c->{"found_unsupported_package"} and not $c->{"quick"}) 0 793 793
Condition33%1/3
$c->{"found_unsupported_package"} and not $c->{"quick"}
!ll&&!rl&&r
79300
MC/DC0%0/2
$c->{"found_unsupported_package"} and not $c->{"quick"}
$c->{"found_unsupported_package"} not $c->{"quick"}
Truth table33%1/3
A and not(B)
A= $c->{"found_unsupported_package"}B= not $c->{"quick"}
ABresult
0X0
100
111
1562 0 my $unsupported = $c->{found_unsupported_package};
1563 0 $c->{quick} = 1;
1564 0 $self->_skim_string($c, $rstr);
1565 0 warn "Unsupported package '$unsupported' is found. Result may be incorrect.\n";
1566 }
1567 }
1568 1059 ▶ if (exists $c->{keyword}{$first_token}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $c->{"keyword"}{$first_token}) 220 839 1059
1569 220 $c->{current_scope} = \$current_scope;
1570 220 $c->{cond} = $cond;
1571 220 $tokens[0][1] = 'KEYWORD';
1572 220 $c->run_callback_for(keyword => $first_token, \@tokens);
1573 }
1574 1059 ▶ if (exists $c->{method}{$first_token} and $caller_package) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $c->{"method"}{$first_token} and $caller_package) 18 1041 1059
Condition66%2/3
exists $c->{"method"}{$first_token} and $caller_package
!ll&&!rl&&r
1041018
MC/DC50%1/2
exists $c->{"method"}{$first_token} and $caller_package
exists $c->{"method"}{$first_token} $caller_package
Truth table66%2/3
A and B
A= exists $c->{"method"}{$first_token}B= $caller_package
ABresult
0X0
100
111
1575 18 unshift @tokens, [$caller_package, 'WORD'];
1576 18 $c->{current_scope} = \$current_scope;
1577 18 $c->{cond} = $cond;
1578 18 $c->run_callback_for(method => $first_token, \@tokens);
1579 }
1580 1059 ▶ if ($current_scope & F_SIDEFF) {
Branch: 1 branch
BranchTrueFalseTotal
if ($current_scope & 32) 11 1048 1059
1581 11 $current_scope &= MASK_SIDEFF;
1582 11 ▶ while(my $token = shift @tokens) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $token = shift @tokens) 58 0 58
1583 58 ▶ last if $has_sideff{$token->[0]};
Branch: 1 branch
BranchTrueFalseTotal
if $has_sideff{$token->[0]} 11 47 58
1584 }
1585 11 ▶ $current_scope &= F_SIDEFF if grep {$has_sideff{$_->[0]}} @tokens;
Branch: 1 branch
BranchTrueFalseTotal
if grep {$has_sideff{$_->[0]};} @tokens 2 9 11
1586 11 ▶ if (@tokens) {
Branch: 1 branch
BranchTrueFalseTotal
if (@tokens) 11 0 11
1587 11 $first_token = $tokens[0][0];
1588 11 ▶ $cond = (($current_scope | $parent_scope) & (F_CONDITIONAL|F_SIDEFF)) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
($current_scope | $parent_scope) & 48 ? : 1 10 11
1589 11 ▶ if (exists $c->{callback}{$first_token}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $c->{"callback"}{$first_token}) 0 11 11
1590 0 $c->{current_scope} = \$current_scope;
1591 0 $c->{cond} = $cond;
1592 0 $c->{callback}{$first_token}->($c, $rstr, \@tokens);
1593 }
1594 11 ▶ if (exists $c->{keyword}{$first_token}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $c->{"keyword"}{$first_token}) 1 10 11
1595 1 $c->{current_scope} = \$current_scope;
1596 1 $c->{cond} = $cond;
1597 1 $tokens[0][1] = 'KEYWORD';
1598 1 $c->run_callback_for(keyword => $first_token, \@tokens);
1599 }
1600 11 ▶ if (exists $c->{method}{$first_token} and $caller_package) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $c->{"method"}{$first_token} and $caller_package) 0 11 11
Condition33%1/3
exists $c->{"method"}{$first_token} and $caller_package
!ll&&!rl&&r
1100
MC/DC0%0/2
exists $c->{"method"}{$first_token} and $caller_package
exists $c->{"method"}{$first_token} $caller_package
Truth table33%1/3
A and B
A= exists $c->{"method"}{$first_token}B= $caller_package
ABresult
0X0
100
111
1601 0 unshift @tokens, [$caller_package, 'WORD'];
1602 0 $c->{current_scope} = \$current_scope;
1603 0 $c->{cond} = $cond;
1604 0 $c->run_callback_for(method => $first_token, \@tokens);
1605 }
1606 }
1607 }
1608 }
1609 4501 @tokens = ();
1610 4501 @keywords = ();
1611 4501 $current_scope &= MASK_STATEMENT_END;
1612 4501 $caller_package = undef;
1613 4501 $token = $token_type = '';
1614 4501 _debug('END SENTENSE') if DEBUG;
1615 }
1616 27410 ▶ if ($unstack and @{$c->{stack}}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($unstack and @{$c->{"stack"};}) 2221 25189 27410
Condition100%3/3
$unstack and @{$c->{"stack"};}
!ll&&!rl&&r
25167222221
MC/DC100%2/2
$unstack and @{$c->{"stack"};}
$unstack @{$c->{"stack"};}
Truth table100%3/3
A and B
A= $unstackB= @{$c->{"stack"};}
ABresult
0X0
100
111
1617 2221 my $stacked = pop @{$c->{stack}};
1618 2221 my $stacked_type = substr($stacked->[0], -1);
1619 2221 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($unstack eq "}" and $stacked_type ne "{" or $unstack eq "]" and $stacked_type ne "[" or $unstack eq ")" and $stacked_type ne "(") 0 2221 2221
Condition53%8/15
$unstack eq "}" and $stacked_type ne "{" or $unstack eq "]" and $stacked_type ne "[" or $unstack eq ")" and $stacked_type ne "("
l!l&&r!l&&!r
002221
$unstack eq "}" and $stacked_type ne "{" or $unstack eq "]" and $stacked_type ne "["
l!l&&r!l&&!r
002221
$unstack eq "}" and $stacked_type ne "{"
!ll&&!rl&&r
118610350
$unstack eq "]" and $stacked_type ne "["
!ll&&!rl&&r
2125960
$unstack eq ")" and $stacked_type ne "("
!ll&&!rl&&r
113110900
MC/DC0%0/6
$unstack eq "}" and $stacked_type ne "{" or $unstack eq "]" and $stacked_type ne "[" or $unstack eq ")" and $stacked_type ne "("
$unstack eq "}" $stacked_type ne "{" $unstack eq "]" $stacked_type ne "[" $unstack eq ")" $stacked_type ne "("
Truth table6%1/15
A and B or C and D or E and F
A= $unstack eq "}"B= $stacked_type ne "{"C= $unstack eq "]"D= $stacked_type ne "["E= $unstack eq ")"F= $stacked_type ne "("
ABCDEFresult
11XXXX1
0X11XX1
1011XX1
0X0X111
0X10111
100X111
1010111
0X0X0X0
0X0X100
0X100X0
0X10100
100X0X0
100X100
10100X0
1010100
1620 ($unstack eq '}' and $stacked_type ne '{') or
1621 ($unstack eq ']' and $stacked_type ne '[') or
1622 ($unstack eq ')' and $stacked_type ne '(')
1623 ) {
1624 0 ▶ my $prev_pos = $stacked->[1] || 0;
Condition0%0/2
$stacked->[1] || 0
l!l
00
MC/DC0%0/1
$stacked->[1] || 0
$stacked->[1]
Truth table0%0/2
A
A= $stacked->[1]
Aresult
11
00
1625 0 die "mismatch $stacked_type $unstack\n" .
1626 substr($$rstr, $prev_pos, pos($$rstr) - $prev_pos);
1627 }
1628 2221 _dump_stack($c, $unstack) if DEBUG;
1629 2221 $current_scope |= F_SCOPE_END;
1630 2221 $unstack = undef;
1631 }
1632  
1633 27410 ▶ last if $current_scope & F_SCOPE_END;
Branch: 1 branch
BranchTrueFalseTotal
if $current_scope & 64 2294 25116 27410
1634 25116 ▶ last if $c->{ended};
Branch: 1 branch
BranchTrueFalseTotal
if $c->{"ended"} 105 25011 25116
1635 25011 ▶ last if $c->{last_found_by_skimming} and $c->{last_found_by_skimming} < pos($$rstr);
Branch: 1 branch
BranchTrueFalseTotal
if $c->{"last_found_by_skimming"} and $c->{"last_found_by_skimming"} < pos $$rstr 0 25011 25011
Condition33%1/3
$c->{"last_found_by_skimming"} and $c->{"last_found_by_skimming"} < pos $$rstr
!ll&&!rl&&r
2501100
MC/DC0%0/2
$c->{"last_found_by_skimming"} and $c->{"last_found_by_skimming"} < pos $$rstr
$c->{"last_found_by_skimming"} $c->{"last_found_by_skimming"} < pos $$rstr
Truth table33%1/3
A and B
A= $c->{"last_found_by_skimming"}B= $c->{"last_found_by_skimming"} < pos $$rstr
ABresult
0X0
100
111
1636  
1637 25011 ($prev_token, $prev_token_type) = ($token, $token_type);
1638 }
1639  
1640 44784 ▶ if (@{$c->{errors}} and !($parent_scope & F_STRING_EVAL)) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{$c->{"errors"};} and not $parent_scope & 4) 0 44784 44784
Condition33%1/3
@{$c->{"errors"};} and not $parent_scope & 4
!ll&&!rl&&r
4478400
MC/DC0%0/2
@{$c->{"errors"};} and not $parent_scope & 4
@{$c->{"errors"};} not $parent_scope & 4
Truth table33%1/3
A and not(B)
A= @{$c->{"errors"};}B= not $parent_scope & 4
ABresult
0X0
100
111
1641 0 my $rest = substr($$rstr, pos($$rstr));
1642 0 ▶ _error("REST:\n\n".$rest) if $rest;
Branch: 1 branch
BranchTrueFalseTotal
if $rest 0 0 0
1643 0 last;
1644 }
1645 }
1646  
1647 3169 ▶ if (@tokens) {
Branch: 1 branch
BranchTrueFalseTotal
if (@tokens) 41 3128 3169
1648 41 ▶ if (my $first_token = $tokens[0][0]) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $first_token = $tokens[0][0]) 41 0 41
1649 41 ▶ if (exists $c->{callback}{$first_token}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $c->{"callback"}{$first_token}) 28 13 41
1650 28 $c->{callback}{$first_token}->($c, $rstr, \@tokens);
1651 }
1652 41 ▶ if (exists $c->{keyword}{$first_token}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $c->{"keyword"}{$first_token}) 10 31 41
1653 10 $tokens[0][1] = 'KEYWORD';
1654 10 $c->run_callback_for(keyword => $first_token, \@tokens);
1655 }
1656 }
1657 }
1658  
1659 3169 _dump_stack($c, "END SCOPE") if DEBUG;
1660  
1661 3169 \@scope_tokens;
1662 }
1663  
1664 sub _match_quotelike {
1665 188 ▶ my ($self, $c, $rstr, $op) = @_;
Subroutine _match_quotelike: called CC=11 SCAR=24.3
1666  
1667 # '#' only works when it comes just after the op,
1668 # without prepending spaces
1669 188 $$rstr =~ m/\G(?:\s(?:$re_comment))?\s*/gcs;
1670  
1671 188 ▶ unless ($$rstr =~ m/\G(\S)/gc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($$rstr =~ /\G(\S)/cg) 0 188 188
1672 0 return _match_error($rstr, "No block delimiter found after $op");
1673 }
1674 188 my $ldel = $1;
1675 188 my $startpos = pos($$rstr);
1676  
1677 188 ▶ if ($ldel =~ /[[(<{]/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ldel =~ /[[(<{]/) { } 135 53 188
1678 135 my ($rdel, $re_skip) = _gen_rdel_and_re_skip($ldel);
1679 135 my @nest = ($ldel);
1680 135 my ($p, $c1);
1681 135 ▶ while(defined($p = pos($$rstr))) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($p = pos $$rstr)) 360 0 360
1682 360 $c1 = substr($$rstr, $p, 1);
1683 360 ▶ if ($c1 eq '\\') {
Branch: 1 branch
BranchTrueFalseTotal
if ($c1 eq "\\") 28 332 360
1684 28 pos($$rstr) = $p + 2;
1685 28 next;
1686 }
1687 332 ▶ if ($c1 eq $ldel) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c1 eq $ldel) 15 317 332
1688 15 pos($$rstr) = $p + 1;
1689 15 push @nest, $ldel;
1690 15 next;
1691 }
1692 317 ▶ if ($c1 eq $rdel) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c1 eq $rdel) 150 167 317
1693 150 pos($$rstr) = $p + 1;
1694 150 pop @nest;
1695 150 ▶ last unless @nest;
Branch: 1 branch
BranchTrueFalseTotal
unless @nest 135 15 150
1696 15 next;
1697 }
1698 167 ▶ $$rstr =~ m{\G$re_skip}gc and next;
Branch: 1 branch
BranchTrueFalseTotal
$$rstr =~ /\G$re_skip/cg and next 167 0 167
1699 0 last;
1700 }
1701 135 ▶ return if @nest;
Branch: 1 branch
BranchTrueFalseTotal
if @nest 0 135 135
1702 } else {
1703 53 my $re = _gen_re_str_in_delims_with_end_delim($ldel);
1704 53 ▶ $$rstr =~ /\G$re/gcs or return;
Branch: 1 branch
BranchTrueFalseTotal
$$rstr =~ /\G$re/cgs or return 0 53 53
1705 }
1706  
1707 188 my $endpos = pos($$rstr);
1708  
1709 188 return [substr($$rstr, $startpos, $endpos - $startpos - 1), $op];
1710 }
1711  
1712 sub _match_regexp0 { # //
1713 98 ▶ my ($self, $c, $rstr, $startpos, $token_type) = @_;
Subroutine _match_regexp0: called CC=6 SCAR=17.9
1714 98 pos($$rstr) = $startpos + 1;
1715  
1716 98 my $re_shortcut = _gen_re_regexp_shortcut('/');
1717 98 ▶ $$rstr =~ m{\G$re_shortcut}gcs or # shortcut
Branch: 2 branches
BranchTrueFalseTotal
$$rstr =~ /\G$re_shortcut/cgs or defined $self->_scan_re($c, $rstr, "/", "/", $token_type ? "m" : "") or return _match_error($rstr, "Closing delimiter was not found: $@") 1 97 98
$token_type ? : 50 1 51
Condition100%3/3
$$rstr =~ /\G$re_shortcut/cgs or defined $self->_scan_re($c, $rstr, "/", "/", $token_type ? "m" : "")
l!l&&r!l&&!r
47501
MC/DC100%2/2
$$rstr =~ /\G$re_shortcut/cgs or defined $self->_scan_re($c, $rstr, "/", "/", $token_type ? "m" : "")
$$rstr =~ /\G$re_shortcut/cgs defined $self->_scan_re($c, $rstr, "/", "/", $token_type ? "m" : "")
Truth table100%3/3
A or B
A= $$rstr =~ /\G$re_shortcut/cgsB= defined $self->_scan_re($c, $rstr, "/", "/", $token_type ? "m" : "")
ABresult
1X1
011
000
1718 defined($self->_scan_re($c, $rstr, '/', '/', $token_type ? 'm' : '')) or return _match_error($rstr, "Closing delimiter was not found: $@");
1719  
1720 97 $$rstr =~ m/\G([msixpodualgc]*)/gc;
1721 97 my $mod = $1;
1722  
1723 97 my $endpos = pos($$rstr);
1724  
1725 97 my $re = substr($$rstr, $startpos, $endpos - $startpos);
1726 97 ▶ if ($re =~ /\n/s and $mod !~ /x/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($re =~ /\n/s and not $mod =~ /x/) 1 96 97
Condition100%3/3
$re =~ /\n/s and not $mod =~ /x/
!ll&&!rl&&r
9511
MC/DC100%2/2
$re =~ /\n/s and not $mod =~ /x/
$re =~ /\n/s not $mod =~ /x/
Truth table100%3/3
A and not(B)
A= $re =~ /\n/sB= not $mod =~ /x/
ABresult
0X0
100
111
1727 1 return _match_error($rstr, "multiline without x");
1728 }
1729 96 return $re;
1730 }
1731  
1732 sub _match_regexp {
1733 47 ▶ my ($self, $c, $rstr) = @_;
Subroutine _match_regexp: called CC=6 SCAR=18.4
1734 47 ▶ my $startpos = pos($$rstr) || 0;
Condition50%1/2
pos $$rstr || 0
l!l
470
MC/DC0%0/1
pos $$rstr || 0
pos $$rstr
Truth table50%1/2
A
A= pos $$rstr
Aresult
11
00
1735  
1736 # '#' only works when it comes just after the op,
1737 # without prepending spaces
1738 47 $$rstr =~ m/\G(?:\s(?:$re_comment))?\s*/gcs;
1739  
1740 47 ▶ unless ($$rstr =~ m/\G(\S)/gc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($$rstr =~ /\G(\S)/cg) 0 47 47
1741 0 return _match_error($rstr, "No block delimiter found");
1742 }
1743 47 my ($ldel, $rdel) = ($1, $1);
1744  
1745 47 ▶ if ($ldel =~ /[[(<{]/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ldel =~ /[[(<{]/) 27 20 47
1746 27 $rdel =~ tr/[({</])}>/;
1747 }
1748  
1749 47 my $re_shortcut = _gen_re_regexp_shortcut($ldel, $rdel);
1750 47 ▶ $$rstr =~ m{\G$re_shortcut}gcs or # shortcut
Branch: 1 branch
BranchTrueFalseTotal
$$rstr =~ /\G$re_shortcut/cgs or defined $self->_scan_re($c, $rstr, $ldel, $rdel, "m/qr") or return _match_error($rstr, "Closing delimiter was not found: $@") 0 47 47
Condition66%2/3
$$rstr =~ /\G$re_shortcut/cgs or defined $self->_scan_re($c, $rstr, $ldel, $rdel, "m/qr")
l!l&&r!l&&!r
2450
MC/DC0%0/2
$$rstr =~ /\G$re_shortcut/cgs or defined $self->_scan_re($c, $rstr, $ldel, $rdel, "m/qr")
$$rstr =~ /\G$re_shortcut/cgs defined $self->_scan_re($c, $rstr, $ldel, $rdel, "m/qr")
Truth table66%2/3
A or B
A= $$rstr =~ /\G$re_shortcut/cgsB= defined $self->_scan_re($c, $rstr, $ldel, $rdel, "m/qr")
ABresult
1X1
011
000
1751 defined($self->_scan_re($c, $rstr, $ldel, $rdel, 'm/qr')) or return _match_error($rstr, "Closing delimiter was not found: $@");
1752  
1753 # strictly speaking, qr// doesn't support gc.
1754 47 $$rstr =~ m/\G[msixpodualgc]*/gc;
1755 47 my $endpos = pos($$rstr);
1756  
1757 47 return substr($$rstr, $startpos, $endpos - $startpos);
1758 }
1759  
1760 sub _match_substitute {
1761 53 ▶ my ($self, $c, $rstr) = @_;
Subroutine _match_substitute: called CC=8 SCAR=21.4
1762 53 ▶ my $startpos = pos($$rstr) || 0;
Condition50%1/2
pos $$rstr || 0
l!l
530
MC/DC0%0/1
pos $$rstr || 0
pos $$rstr
Truth table50%1/2
A
A= pos $$rstr
Aresult
11
00
1763  
1764 # '#' only works when it comes just after the op,
1765 # without prepending spaces
1766 53 $$rstr =~ m/\G(?:\s(?:$re_comment))?\s*/gcs;
1767  
1768 53 ▶ unless ($$rstr =~ m/\G(\S)/gc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($$rstr =~ /\G(\S)/cg) 0 53 53
1769 0 return _match_error($rstr, "No block delimiter found");
1770 }
1771 53 my ($ldel1, $rdel1) = ($1, $1);
1772  
1773 53 ▶ if ($ldel1 =~ /[[(<{]/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ldel1 =~ /[[(<{]/) 22 31 53
1774 22 $rdel1 =~ tr/[({</])}>/;
1775 }
1776  
1777 53 my $re_shortcut = _gen_re_regexp_shortcut($ldel1, $rdel1);
1778 53 ▶ ($ldel1 ne '\\' and $$rstr =~ m{\G$re_shortcut}gcs) or # shortcut
Branch: 1 branch
BranchTrueFalseTotal
$ldel1 ne "\\" and $$rstr =~ /\G$re_shortcut/cgs or defined $self->_scan_re($c, $rstr, $ldel1, $rdel1, "s") or return _match_error($rstr, "Closing delimiter was not found: $@") 0 53 53
Condition83%5/6
$ldel1 ne "\\" and $$rstr =~ /\G$re_shortcut/cgs or defined $self->_scan_re($c, $rstr, $ldel1, $rdel1, "s")
l!l&&r!l&&!r
23300
$ldel1 ne "\\" and $$rstr =~ /\G$re_shortcut/cgs
!ll&&!rl&&r
12923
MC/DC0%0/3
$ldel1 ne "\\" and $$rstr =~ /\G$re_shortcut/cgs or defined $self->_scan_re($c, $rstr, $ldel1, $rdel1, "s")
$ldel1 ne "\\" $$rstr =~ /\G$re_shortcut/cgs defined $self->_scan_re($c, $rstr, $ldel1, $rdel1, "s")
Truth table60%3/5
A and B or C
A= $ldel1 ne "\\"B= $$rstr =~ /\G$re_shortcut/cgsC= defined $self->_scan_re($c, $rstr, $ldel1, $rdel1, "s")
ABCresult
11X1
0X11
1011
0X00
1000
1779 defined($self->_scan_re($c, $rstr, $ldel1, $rdel1, 's')) or return _match_error($rstr, "Closing delimiter was not found: $@");
1780 53 ▶ defined($self->_scan_re2($c, $rstr, $ldel1, 's')) or return;
Branch: 1 branch
BranchTrueFalseTotal
defined $self->_scan_re2($c, $rstr, $ldel1, "s") or return 0 53 53
1781 53 $$rstr =~ m/\G[msixpodualgcer]*/gc;
1782 53 my $endpos = pos($$rstr);
1783  
1784 53 return substr($$rstr, $startpos, $endpos - $startpos);
1785 }
1786  
1787 sub _match_transliterate {
1788 5 ▶ my ($self, $c, $rstr) = @_;
Subroutine _match_transliterate: called CC=10 SCAR=23.8
1789 5 ▶ my $startpos = pos($$rstr) || 0;
Condition50%1/2
pos $$rstr || 0
l!l
50
MC/DC0%0/1
pos $$rstr || 0
pos $$rstr
Truth table50%1/2
A
A= pos $$rstr
Aresult
11
00
1790  
1791 # '#' only works when it comes just after the op,
1792 # without prepending spaces
1793 5 $$rstr =~ m/\G(?:\s(?:$re_comment))?\s*/gcs;
1794  
1795 5 ▶ unless ($$rstr =~ m/\G(\S)/gc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($$rstr =~ /\G(\S)/cg) 0 5 5
1796 0 return _match_error($rstr, "No block delimiter found");
1797 }
1798 5 my $ldel1 = $1;
1799 5 my $ldel2;
1800  
1801 5 ▶ if ($ldel1 =~ /[[(<{]/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ldel1 =~ /[[(<{]/) { } 1 4 5
1802 1 (my $rdel1 = $ldel1) =~ tr/[({</])}>/;
1803 1 my $re = _gen_re_str_in_delims_with_end_delim($rdel1);
1804 1 ▶ $$rstr =~ /\G$re/gcs or return;
Branch: 1 branch
BranchTrueFalseTotal
$$rstr =~ /\G$re/cgs or return 0 1 1
1805 1 $$rstr =~ /\G(?:$re_comment)/gcs;
1806 1 ▶ unless ($$rstr =~ /\G\s*(\S)/gc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($$rstr =~ /\G\s*(\S)/cg) 0 1 1
1807 0 return _match_error($rstr, "Missing second block");
1808 }
1809 1 $ldel2 = $1;
1810 } else {
1811 4 my $re = _gen_re_str_in_delims_with_end_delim($ldel1);
1812 4 ▶ $$rstr =~ /\G$re/gcs or return;
Branch: 1 branch
BranchTrueFalseTotal
$$rstr =~ /\G$re/cgs or return 0 4 4
1813 4 $ldel2 = $ldel1;
1814 }
1815  
1816 5 ▶ if ($ldel2 =~ /[[(<{]/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ldel2 =~ /[[(<{]/) { } 1 4 5
1817 1 (my $rdel2 = $ldel2) =~ tr/[({</])}>/;
1818 1 my $re = _gen_re_str_in_delims_with_end_delim($rdel2);
1819 1 ▶ $$rstr =~ /\G$re/gcs or return;
Branch: 1 branch
BranchTrueFalseTotal
$$rstr =~ /\G$re/cgs or return 0 1 1
1820 } else {
1821 4 my $re = _gen_re_str_in_delims_with_end_delim($ldel2);
1822 4 ▶ $$rstr =~ /\G$re/gcs or return;
Branch: 1 branch
BranchTrueFalseTotal
$$rstr =~ /\G$re/cgs or return 0 4 4
1823 }
1824  
1825 5 $$rstr =~ m/\G[cdsr]*/gc;
1826 5 my $endpos = pos($$rstr);
1827  
1828 5 return substr($$rstr, $startpos, $endpos - $startpos);
1829 }
1830  
1831 sub _match_heredoc {
1832 16 ▶ my ($self, $c, $rstr) = @_;
Subroutine _match_heredoc: called CC=7 SCAR=19.5
1833  
1834 16 ▶ my $startpos = pos($$rstr) || 0;
Condition50%1/2
pos $$rstr || 0
l!l
160
MC/DC0%0/1
pos $$rstr || 0
pos $$rstr
Truth table50%1/2
A
A= pos $$rstr
Aresult
11
00
1835  
1836 16 $$rstr =~ m{\G(?:<<(~)?\s*)}gc;
1837 16 ▶ my $indent = $1 ? "\\s*" : "";
Branch: 1 branch
BranchTrueFalseTotal
$1 ? : 1 15 16
1838  
1839 16 my $label;
1840 16 ▶ if ($$rstr =~ m{\G\\?([A-Za-z_]\w*)}gc) {
Branch: 2 branches
BranchTrueFalseTotal
if ($$rstr =~ /\G\\?([A-Za-z_]\w*)/cg) { } 8 8 16
elsif ($$rstr =~ / \G ' ($re_str_in_single_quotes) ' | \G " ($re_str_in_double_quotes) " | \G ` ($re_str_in_backticks) ` /cgsx) { } 8 0 8
1841 8 $label = $1;
1842 } elsif ($$rstr =~ m{
1843 \G ' ($re_str_in_single_quotes) '
1844 | \G " ($re_str_in_double_quotes) "
1845 | \G ` ($re_str_in_backticks) `
1846 }gcsx) {
1847 8 $label = $+;
1848 } else {
1849 0 return;
1850 }
1851 16 $label =~ s/\\(.)/$1/g;
1852 16 my $extrapos = pos($$rstr);
1853 16 $$rstr =~ m{\G.*\n}gc;
1854 16 my $str1pos = pos($$rstr)--;
1855 16 ▶ unless ($$rstr =~ m{\G.*?\n$indent(?=\Q$label\E\n)}gcs) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($$rstr =~ /\G.*?\n$indent(?=\Q$label\E\n)/cgs) 2 14 16
1856 2 return _match_error($rstr, qq{Missing here doc terminator ('$label')});
1857 }
1858 14 my $ldpos = pos($$rstr);
1859 14 $$rstr =~ m{\G\Q$label\E\n}gc;
1860 14 my $ld2pos = pos($$rstr);
1861  
1862 14 my $heredoc = [
1863 substr($$rstr, $str1pos, $ldpos-$str1pos),
1864 substr($$rstr, $startpos, $extrapos-$startpos),
1865 substr($$rstr, $ldpos, $ld2pos-$ldpos),
1866 ];
1867 14 substr($$rstr, $str1pos, $ld2pos - $str1pos) = '';
1868 14 pos($$rstr) = $extrapos;
1869 14 ▶ if ($indent) {
Branch: 1 branch
BranchTrueFalseTotal
if ($indent) 1 13 14
1870 1 $c->add_perl('5.026', '<<~');
1871 }
1872 14 return $heredoc;
1873 }
1874  
1875 sub _scan_re {
1876 126 ▶ my ($self, $c, $rstr, $ldel, $rdel, $op) = @_;
Subroutine _scan_re: called CC=55 SCAR=40.8
1877 126 ▶ my $startpos = pos($$rstr) || 0;
Condition50%1/2
pos $$rstr || 0
l!l
1260
MC/DC0%0/1
pos $$rstr || 0
pos $$rstr
Truth table50%1/2
A
A= pos $$rstr
Aresult
11
00
1878  
1879 126 _debug(" L $ldel R $rdel") if DEBUG_RE;
1880  
1881 126 my ($outer_opening_delimiter, $outer_closing_delimiter);
1882 126 ▶ if (@{$c->{stack}}) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{$c->{"stack"};}) 110 16 126
1883 110 ($outer_closing_delimiter = $outer_opening_delimiter = $c->{stack}[-1][0]) =~ tr/[({</])}>/;
1884 }
1885  
1886 126 my @nesting = ($ldel);
1887 126 my $multiline = 0;
1888 126 my $saw_sharp = 0;
1889 126 my $prev;
1890 126 my ($p, $c1);
1891 126 ▶ while (defined($p = pos($$rstr))) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($p = pos $$rstr)) 5053 0 5053
1892 5053 $c1 = substr($$rstr, $p, 1);
1893 5053 ▶ if ($c1 eq "\n") {
Branch: 1 branch
BranchTrueFalseTotal
if ($c1 eq "\n") 271 4782 5053
1894 271 $$rstr =~ m{\G\n\s*}gcs;
1895 271 $multiline = 1;
1896 271 $saw_sharp = 0;
1897 # _debug("CRLF") if DEBUG_RE;
1898 271 next;
1899 }
1900 4782 ▶ if ($c1 eq ' ' or $c1 eq "\t") {
Branch: 1 branch
BranchTrueFalseTotal
if ($c1 eq " " or $c1 eq "\t") 696 4086 4782
Condition66%2/3
$c1 eq " " or $c1 eq "\t"
l!l&&r!l&&!r
69604086
MC/DC50%1/2
$c1 eq " " or $c1 eq "\t"
$c1 eq " " $c1 eq "\t"
Truth table66%2/3
A or B
A= $c1 eq " "B= $c1 eq "\t"
ABresult
1X1
011
000
1901 696 $$rstr =~ m{\G\s*}gc;
1902 # _debug("WHITESPACE") if DEBUG_RE;
1903 696 next;
1904 }
1905 4086 ▶ if ($c1 eq '#' and $rdel ne '#') {
Branch: 1 branch
BranchTrueFalseTotal
if ($c1 eq "#" and $rdel ne "#") 144 3942 4086
Condition100%3/3
$c1 eq "#" and $rdel ne "#"
!ll&&!rl&&r
39411144
MC/DC100%2/2
$c1 eq "#" and $rdel ne "#"
$c1 eq "#" $rdel ne "#"
Truth table100%3/3
A and B
A= $c1 eq "#"B= $rdel ne "#"
ABresult
0X0
100
111
1906 144 ▶ if ($multiline and $$rstr =~ m{\G(#[^\Q$rdel\E]*?)\n}gcs) {
Branch: 1 branch
BranchTrueFalseTotal
if ($multiline and $$rstr =~ /\G(#[^\Q$rdel\E]*?)\n/cgs) { } 94 50 144
Condition100%3/3
$multiline and $$rstr =~ /\G(#[^\Q$rdel\E]*?)\n/cgs
!ll&&!rl&&r
193194
MC/DC100%2/2
$multiline and $$rstr =~ /\G(#[^\Q$rdel\E]*?)\n/cgs
$multiline $$rstr =~ /\G(#[^\Q$rdel\E]*?)\n/cgs
Truth table100%3/3
A and B
A= $multilineB= $$rstr =~ /\G(#[^\Q$rdel\E]*?)\n/cgs
ABresult
0X0
100
111
1907 94 _debug(" comment $1") if DEBUG_RE
1908 } else {
1909 50 pos($$rstr) = $p + 1;
1910 50 $saw_sharp = 1;
1911 50 _debug(" saw #") if DEBUG_RE;
1912 }
1913 144 next;
1914 }
1915  
1916 3942 ▶ if ($c1 eq '\\' and $rdel ne '\\') {
Branch: 1 branch
BranchTrueFalseTotal
if ($c1 eq "\\" and $rdel ne "\\") 416 3526 3942
Condition100%3/3
$c1 eq "\\" and $rdel ne "\\"
!ll&&!rl&&r
35251416
MC/DC100%2/2
$c1 eq "\\" and $rdel ne "\\"
$c1 eq "\\" $rdel ne "\\"
Truth table100%3/3
A and B
A= $c1 eq "\\"B= $rdel ne "\\"
ABresult
0X0
100
111
1917 416 ▶ if ($$rstr =~ m/\G(\\.)/gcs) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$rstr =~ /\G(\\.)/cgs) 416 0 416
1918 416 _debug(" escaped $1") if DEBUG_RE;
1919 416 next;
1920 }
1921 }
1922  
1923 3526 _debug(" looking @nesting: $c1") if DEBUG_RE;
1924  
1925 3526 ▶ if ($c1 eq '[') {
Branch: 1 branch
BranchTrueFalseTotal
if ($c1 eq "[") 197 3329 3526
1926 # character class may have other (ignorable) delimiters
1927 197 ▶ if ($$rstr =~ m/\G(\[\[:\w+?:\]\])/gcs) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$rstr =~ /\G(\[\[:\w+?:\]\])/cgs) 0 197 197
1928 0 _debug(" character class $1") if DEBUG_RE;
1929 0 next;
1930 }
1931 197 ▶ if ($$rstr =~ m/\G(\[[^\\\]]]*?(\\.[^\\\]]]*)*\])/gcs) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$rstr =~ /\G(\[[^\\\]]]*?(\\.[^\\\]]]*)*\])/cgs) 59 138 197
1932 59 _debug(" character class: $1") if DEBUG_RE;
1933 59 next;
1934 }
1935 }
1936  
1937 3467 ▶ if ($c1 eq $rdel) {
Branch: 2 branches
BranchTrueFalseTotal
if ($c1 eq $rdel) { } 156 3311 3467
elsif ($c1 eq $ldel) { } 30 3281 3311
1938 156 pos($$rstr) = $p + 1;
1939 156 ▶ if ($saw_sharp) {
Branch: 1 branch
BranchTrueFalseTotal
if ($saw_sharp) 39 117 156
1940 39 my $tmp_pos = $p + 1;
1941 39 ▶ if ($op eq 's') {
Branch: 1 branch
BranchTrueFalseTotal
if ($op eq "s") 3 36 39
1942 3 _debug(" looking for latter part") if DEBUG_RE;
1943 3 my $latter = $self->_scan_re2($c, $rstr, $ldel, $op);
1944 3 ▶ if (!defined $latter) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $latter) 0 3 3
1945 0 pos($$rstr) = $tmp_pos;
1946 0 next;
1947 }
1948 3 _debug(" latter: $latter") if DEBUG_RE;
1949 }
1950 39 ▶ if ($$rstr =~ m/\G[a-wyz]*x/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$rstr =~ /\G[a-wyz]*x/) 2 37 39
1951 # looks like an end of block
1952 2 _debug(" end of block $rdel (after #)") if DEBUG_RE;
1953 2 @nesting = ();
1954 2 pos($$rstr) = $tmp_pos;
1955 2 last;
1956 }
1957 37 pos($$rstr) = $tmp_pos;
1958 37 ▶ if ($multiline) {
Branch: 1 branch
BranchTrueFalseTotal
if ($multiline) 29 8 37
1959 29 next; # part of a comment
1960 }
1961 }
1962 125 _debug(" end of block $rdel") if DEBUG_RE;
1963 125 my $expected = $rdel;
1964 125 ▶ if ($ldel ne $rdel) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ldel ne $rdel) 44 81 125
1965 44 $expected =~ tr/)}]>/({[</;
1966 }
1967 125 ▶ while(my $nested = pop @nesting) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $nested = pop @nesting) 129 0 129
1968 129 ▶ last if $nested eq $expected;
Branch: 1 branch
BranchTrueFalseTotal
if $nested eq $expected 125 4 129
1969 }
1970 125 ▶ last unless @nesting;
Branch: 1 branch
BranchTrueFalseTotal
unless @nesting 123 2 125
1971 2 next;
1972 } elsif ($c1 eq $ldel) {
1973 30 pos($$rstr) = $p + 1;
1974 30 ▶ if ($multiline and $saw_sharp) {
Branch: 1 branch
BranchTrueFalseTotal
if ($multiline and $saw_sharp) { } 28 2 30
Condition66%2/3
$multiline and $saw_sharp
!ll&&!rl&&r
0228
MC/DC50%1/2
$multiline and $saw_sharp
$multiline $saw_sharp
Truth table66%2/3
A and B
A= $multilineB= $saw_sharp
ABresult
0X0
100
111
1975 } else {
1976 2 _debug(" block $ldel") if DEBUG_RE;
1977 2 push @nesting, $ldel;
1978 2 next;
1979 }
1980 }
1981  
1982 3309 ▶ if ($c1 eq '{') {
Branch: 1 branch
BranchTrueFalseTotal
if ($c1 eq "{") 45 3264 3309
1983 # quantifier shouldn't be nested
1984 45 ▶ if ($$rstr =~ m/\G(\{[0-9]+(?:,(?:[0-9]+)?)?})/gcs) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$rstr =~ /\G(\{[0-9]+(?:,(?:[0-9]+)?)?})/cgs) 4 41 45
1985 4 _debug(" quantifier $1") if DEBUG_RE;
1986 4 next;
1987 }
1988 }
1989  
1990 3305 ▶ if ($c1 eq '(') {
Branch: 1 branch
BranchTrueFalseTotal
if ($c1 eq "(") 407 2898 3305
1991 407 my $c2 = substr($$rstr, $p + 1, 1);
1992 407 ▶ if ($c2 eq '?' and !($multiline and $saw_sharp)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c2 eq "?" and not $multiline && $saw_sharp) 209 198 407
Condition100%6/6
$c2 eq "?" and not $multiline && $saw_sharp
!ll&&!rl&&r
18612209
$multiline && $saw_sharp
!ll&&!rl&&r
6814112
MC/DC100%3/3
$c2 eq "?" and not $multiline && $saw_sharp
$c2 eq "?" $multiline $saw_sharp
Truth table100%4/4
A and not(B && C)
A= $c2 eq "?"B= $multilineC= $saw_sharp
ABCresult
0XX0
1110
10X1
1101
1993 # code
1994 209 ▶ if ($$rstr =~ m/\G((\()\?+?)(?=\{)/gc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$rstr =~ /\G((\()\?+?)(?=\{)/cg) 70 139 209
1995 70 _debug(" code $1") if DEBUG_RE;
1996 70 push @nesting, $2;
1997 70 ▶ unless (eval { $self->_scan($c, $rstr, F_EXPECTS_BRACKET); 1 }) {
Branch: 1 branch
BranchTrueFalseTotal
unless (eval { do { $self->_scan($c, $rstr, 8); 1 } }) 0 70 70
1998 0 _debug("scan failed") if DEBUG_RE;
1999 0 return;
2000 }
2001 70 next;
2002 }
2003 # comment
2004 139 ▶ if ($$rstr =~ m{\G(\(\?\#[^\\\)]*(?:\\.[^\\\)]*)*\))}gcs) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$rstr =~ /\G(\(\?\#[^\\\)]*(?:\\.[^\\\)]*)*\))/cgs) 10 129 139
2005 10 _debug(" comment $1") if DEBUG_RE;
2006 10 next;
2007 }
2008 }
2009  
2010 # grouping may have (ignorable) <>
2011 327 ▶ if ($$rstr =~ m/\G((\()(?:<[!=]|<\w+?>|>)?)/gc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$rstr =~ /\G((\()(?:<[!=]|<\w+?>|>)?)/cg) 327 0 327
2012 327 _debug(" group $1") if DEBUG_RE;
2013 327 push @nesting, $2;
2014 327 next;
2015 }
2016 }
2017  
2018 # maybe variables (maybe not)
2019 2898 ▶ if ($c1 eq '$' and substr($$rstr, $p + 1, 1) eq '{') {
Branch: 1 branch
BranchTrueFalseTotal
if ($c1 eq "\$" and substr($$rstr, $p + 1, 1) eq "{") 3 2895 2898
Condition100%3/3
$c1 eq "\$" and substr($$rstr, $p + 1, 1) eq "{"
!ll&&!rl&&r
27111843
MC/DC100%2/2
$c1 eq "\$" and substr($$rstr, $p + 1, 1) eq "{"
$c1 eq "\$" substr($$rstr, $p + 1, 1) eq "{"
Truth table100%3/3
A and B
A= $c1 eq "\$"B= substr($$rstr, $p + 1, 1) eq "{"
ABresult
0X0
100
111
2020 3 my @tmp_stack = @{$c->{stack}};
2021 3 ▶ next if eval { $self->_scan($c, $rstr, F_EXPECTS_BRACKET); 1 };
Branch: 1 branch
BranchTrueFalseTotal
if eval { do { $self->_scan($c, $rstr, 8); 1 } } 3 0 3
2022 0 pos($$rstr) = $p;
2023 0 $c->{stack} = \@tmp_stack;
2024 }
2025  
2026 2895 ▶ if ($c1 eq ')') {
Branch: 1 branch
BranchTrueFalseTotal
if ($c1 eq ")") 397 2498 2895
2027 397 ▶ if (@nesting and $nesting[-1] eq '(') {
Branch: 1 branch
BranchTrueFalseTotal
if (@nesting and $nesting[-1] eq '(') { } 393 4 397
Condition66%2/3
@nesting and $nesting[-1] eq "("
!ll&&!rl&&r
04393
MC/DC50%1/2
@nesting and $nesting[-1] eq "("
@nesting $nesting[-1] eq "("
Truth table66%2/3
A and B
A= @nestingB= $nesting[-1] eq "("
ABresult
0X0
100
111
2028 393 _debug(" end of group $c1") if DEBUG_RE;
2029 393 pop @nesting;
2030 393 pos($$rstr) = $p + 1;
2031 393 next;
2032 } else {
2033 # die "unnested @nesting" unless $saw_sharp;
2034 }
2035 }
2036  
2037 # for //, see if an outer closing delimiter is found first (ie. see if it was actually a /)
2038 2502 ▶ if (!$op) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($op) 87 2415 2502
2039 87 ▶ if ($outer_opening_delimiter and $c1 eq $outer_opening_delimiter) {
Branch: 1 branch
BranchTrueFalseTotal
if ($outer_opening_delimiter and $c1 eq $outer_opening_delimiter) 1 86 87
Condition66%2/3
$outer_opening_delimiter and $c1 eq $outer_opening_delimiter
!ll&&!rl&&r
0861
MC/DC50%1/2
$outer_opening_delimiter and $c1 eq $outer_opening_delimiter
$outer_opening_delimiter $c1 eq $outer_opening_delimiter
Truth table66%2/3
A and B
A= $outer_opening_delimiterB= $c1 eq $outer_opening_delimiter
ABresult
0X0
100
111
2040 1 push @nesting, $c1;
2041 1 pos($$rstr) = $p + 1;
2042 1 next;
2043 }
2044  
2045 86 ▶ if ($outer_closing_delimiter and $c1 eq $outer_closing_delimiter) {
Branch: 1 branch
BranchTrueFalseTotal
if ($outer_closing_delimiter and $c1 eq $outer_closing_delimiter) 2 84 86
Condition66%2/3
$outer_closing_delimiter and $c1 eq $outer_closing_delimiter
!ll&&!rl&&r
0842
MC/DC50%1/2
$outer_closing_delimiter and $c1 eq $outer_closing_delimiter
$outer_closing_delimiter $c1 eq $outer_closing_delimiter
Truth table66%2/3
A and B
A= $outer_closing_delimiterB= $c1 eq $outer_closing_delimiter
ABresult
0X0
100
111
2046 2 ▶ if (@nesting and $nesting[-1] eq $outer_opening_delimiter) {
Branch: 1 branch
BranchTrueFalseTotal
if (@nesting and $nesting[-1] eq $outer_opening_delimiter) 1 1 2
Condition66%2/3
@nesting and $nesting[-1] eq $outer_opening_delimiter
!ll&&!rl&&r
011
MC/DC50%1/2
@nesting and $nesting[-1] eq $outer_opening_delimiter
@nesting $nesting[-1] eq $outer_opening_delimiter
Truth table66%2/3
A and B
A= @nestingB= $nesting[-1] eq $outer_opening_delimiter
ABresult
0X0
100
111
2047 1 pop @nesting;
2048 1 pos($$rstr) = $p + 1;
2049 1 next;
2050 }
2051  
2052 1 return _match_error($rstr, "Outer closing delimiter: $outer_closing_delimiter is found");
2053 }
2054 }
2055  
2056 2499 ▶ if ($$rstr =~ m/\G(\w+|.)/gcs) {
Branch: 1 branch
BranchTrueFalseTotal
if ($$rstr =~ /\G(\w+|.)/cgs) 2499 0 2499
2057 2499 _debug(" rest $1") if DEBUG_RE;
2058 2499 next;
2059 }
2060 0 last;
2061 }
2062 125 ▶ if ($#nesting>=0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($#nesting >= 0) 0 125 125
2063 0 return _match_error($rstr, "Unmatched opening bracket(s): ". join("..",@nesting)."..");
2064 }
2065  
2066 125 my $endpos = pos($$rstr);
2067  
2068 125 return substr($$rstr, $startpos, $endpos - $startpos);
2069 }
2070  
2071  
2072 sub _scan_re2 {
2073 56 ▶ my ($self, $c, $rstr, $ldel, $op) = @_;
Subroutine _scan_re2: called CC=12 SCAR=25.1
2074 56 my $startpos = pos($$rstr);
2075  
2076 56 ▶ if ($ldel =~ /[[(<{]/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ldel =~ /[[(<{]/) 23 33 56
2077 23 $$rstr =~ /\G(?:$re_comment)/gcs;
2078  
2079 23 ▶ unless ($$rstr =~ /\G\s*(\S)/gc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($$rstr =~ /\G\s*(\S)/cg) 0 23 23
2080 0 return _match_error($rstr, "Missing second block for quotelike $op");
2081 }
2082 23 $ldel = $1;
2083 }
2084  
2085 56 ▶ if ($ldel =~ /[[(<{]/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ldel =~ /[[(<{]/) { } 23 33 56
2086 23 my ($rdel, $re_skip) = _gen_rdel_and_re_skip($ldel);
2087 23 my @nest = $ldel;
2088 23 my ($p, $c1);
2089 23 ▶ while(defined($p = pos($$rstr))) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($p = pos $$rstr)) 168 0 168
2090 168 $c1 = substr($$rstr, $p, 1);
2091 168 ▶ if ($c1 eq '\\') {
Branch: 1 branch
BranchTrueFalseTotal
if ($c1 eq "\\") 16 152 168
2092 16 pos($$rstr) = $p + 2;
2093 16 next;
2094 }
2095 152 ▶ if ($c1 eq $ldel) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c1 eq $ldel) 25 127 152
2096 25 pos($$rstr) = $p + 1;
2097 25 push @nest, $ldel;
2098 25 next;
2099 }
2100 127 ▶ if ($c1 eq $rdel) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c1 eq $rdel) 48 79 127
2101 48 pos($$rstr) = $p + 1;
2102 48 pop @nest;
2103 48 ▶ last unless @nest;
Branch: 1 branch
BranchTrueFalseTotal
unless @nest 23 25 48
2104 25 next;
2105 }
2106 79 ▶ $$rstr =~ m{\G$re_skip}gc and next;
Branch: 1 branch
BranchTrueFalseTotal
$$rstr =~ /\G$re_skip/cg and next 79 0 79
2107 0 last;
2108 }
2109 23 ▶ return _match_error($rstr, "nesting mismatch: @nest") if @nest;
Branch: 1 branch
BranchTrueFalseTotal
if @nest 0 23 23
2110 } else {
2111 33 my $re = _gen_re_str_in_delims_with_end_delim($ldel);
2112 33 ▶ $$rstr =~ /\G$re/gcs or return;
Branch: 1 branch
BranchTrueFalseTotal
$$rstr =~ /\G$re/cgs or return 0 33 33
2113 }
2114  
2115 56 my $endpos = pos($$rstr);
2116  
2117 56 return substr($$rstr, $startpos, $endpos - $startpos);
2118 }
2119  
2120 sub _use {
2121 721 ▶ my ($c, $rstr, $tokens) = @_;
Subroutine _use: called CC=25 SCAR=33.3
2122 721 _debug("USE TOKENS: ".(Data::Dump::dump($tokens))) if DEBUG;
2123 721 shift @$tokens; # discard 'use' itself
2124  
2125 # TODO: see if the token is WORD or not?
2126 721 ▶ my $name_token = shift @$tokens or return;
Branch: 1 branch
BranchTrueFalseTotal
my $name_token = shift @$tokens or return 0 721 721
2127 721 my $name = $name_token->[0];
2128 721 ▶ return if !defined $name or ref $name or $name eq '';
Branch: 1 branch
BranchTrueFalseTotal
if not defined $name or ref $name or $name eq "" 0 721 721
Condition33%2/6
not defined $name or ref $name or $name eq ""
l!l&&r!l&&!r
00721
not defined $name or ref $name
l!l&&r!l&&!r
00721
MC/DC0%0/3
not defined $name or ref $name or $name eq ""
not defined $name ref $name $name eq ""
Truth table25%1/4
not(A) or B or C
A= not defined $nameB= ref $nameC= $name eq ""
ABCresult
1XX1
01X1
0011
0000
2129  
2130 721 my $c1 = substr($name, 0, 1);
2131 721 ▶ if ($c1 eq '5') {
Branch: 1 branch
BranchTrueFalseTotal
if ($c1 eq 5) 3 718 721
2132 3 $c->add(perl => $name);
2133 3 return;
2134 }
2135 718 ▶ if ($c1 eq 'v') {
Branch: 1 branch
BranchTrueFalseTotal
if ($c1 eq "v") 6 712 718
2136 6 my $c2 = substr($name, 1, 1);
2137 6 ▶ if ($c2 eq '5') {
Branch: 1 branch
BranchTrueFalseTotal
if ($c2 eq 5) 1 5 6
2138 1 $c->add(perl => $name);
2139 1 return;
2140 }
2141 5 ▶ if ($c2 eq '6') {
Branch: 1 branch
BranchTrueFalseTotal
if ($c2 eq 6) 0 5 5
2142 0 $c->{perl6} = 1;
2143 0 $c->{ended} = 1;
2144 0 return;
2145 }
2146 }
2147 717 ▶ if ($c->enables_utf8($name)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c->enables_utf8($name)) 18 699 717
2148 18 $c->add($name => 0);
2149 18 $c->{utf8} = 1;
2150 18 ▶ if (!$c->{decoded}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($c->{"decoded"}) 9 9 18
2151 9 $c->{decoded} = 1;
2152 9 _debug("UTF8 IS ON") if DEBUG;
2153 9 utf8::decode($$rstr);
2154 9 pos($$rstr) = 0;
2155 9 $c->{ended} = $c->{redo} = 1;
2156 }
2157 }
2158  
2159 717 ▶ if (is_module_name($name)) {
Branch: 1 branch
BranchTrueFalseTotal
if (is_module_name($name)) 717 0 717
2160 717 my $maybe_version_token = $tokens->[0];
2161 717 my $maybe_version_token_desc = $maybe_version_token->[1];
2162 717 ▶ if ($maybe_version_token_desc and ($maybe_version_token_desc eq 'NUMBER' or $maybe_version_token_desc eq 'VERSION_STRING')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($maybe_version_token_desc and $maybe_version_token_desc eq 'NUMBER' || $maybe_version_token_desc eq 'VERSION_STRING') { } 34 683 717
Condition83%5/6
$maybe_version_token_desc and $maybe_version_token_desc eq "NUMBER" || $maybe_version_token_desc eq "VERSION_STRING"
!ll&&!rl&&r
667734
$maybe_version_token_desc eq "NUMBER" or $maybe_version_token_desc eq "VERSION_STRING"
l!l&&r!l&&!r
340677
MC/DC66%2/3
$maybe_version_token_desc and $maybe_version_token_desc eq "NUMBER" || $maybe_version_token_desc eq "VERSION_STRING"
$maybe_version_token_desc $maybe_version_token_desc eq "NUMBER" $maybe_version_token_desc eq "VERSION_STRING"
Truth table75%3/4
A and B or C
A= $maybe_version_token_descB= $maybe_version_token_desc eq "NUMBER"C= $maybe_version_token_desc eq "VERSION_STRING"
ABCresult
0XX0
1000
11X1
1011
2163 34 $c->add($name => $maybe_version_token->[0]);
2164 34 shift @$tokens;
2165 } else {
2166 683 $c->add($name => 0);
2167 }
2168  
2169 717 ▶ if (exists $sub_keywords{$name}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $sub_keywords{$name}) 5 712 717
2170 5 $c->register_sub_keywords(@{$sub_keywords{$name}});
2171 5 $c->prototype_re(qr{\G(\((?:[^\\\(\)]*(?:\\.[^\\\(\)]*)*)\))});
2172 }
2173 717 ▶ if (exists $filter_modules{$name}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $filter_modules{$name}) 1 716 717
2174 1 my $tmp = pos($$rstr);
2175 1 my $redo = $filter_modules{$name}->($rstr);
2176 1 pos($$rstr) = $tmp;
2177 1 ▶ $c->{ended} = $c->{redo} = 1 if $redo;
Branch: 1 branch
BranchTrueFalseTotal
if $redo 0 1 1
2178 }
2179 }
2180  
2181 717 ▶ if ($c->has_callback_for(use => $name)) {
Branch: 2 branches
BranchTrueFalseTotal
if ($c->has_callback_for('use', $name)) { } 355 362 717
elsif ($name =~ /\b(?:Mo[ou]se?X?|MooX?|Elk|Antlers|Role)\b/) { } 3 359 362
2182 355 eval { $c->run_callback_for(use => $name, $tokens) };
2183 355 ▶ warn "Callback Error: $@" if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 355 355
2184 } elsif ($name =~ /\b(?:Mo[ou]se?X?|MooX?|Elk|Antlers|Role)\b/) {
2185 3 ▶ my $module = $name =~ /Role/ ? 'Moose::Role' : 'Moose';
Branch: 1 branch
BranchTrueFalseTotal
$name =~ /Role/ ? : 0 3 3
2186 3 ▶ if ($c->has_callback_for(use => $module)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c->has_callback_for("use", $module)) 1 2 3
2187 1 eval { $c->run_callback_for(use => $module, $tokens) };
2188 1 ▶ warn "Callback Error: $@" if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 1 1
2189 }
2190 }
2191  
2192 717 ▶ if (exists $unsupported_packages{$name}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $unsupported_packages{$name}) 0 717 717
2193 0 $c->{found_unsupported_package} = $name;
2194 }
2195 }
2196  
2197 sub _require {
2198 69 ▶ my ($c, $rstr, $tokens) = @_;
Subroutine _require: called CC=11 SCAR=25.2
2199 69 _debug("REQUIRE TOKENS: ".(Data::Dump::dump($tokens))) if DEBUG;
2200 69 shift @$tokens; # discard 'require' itself
2201  
2202 # TODO: see if the token is WORD or not?
2203 69 ▶ my $name_token = shift @$tokens or return;
Branch: 1 branch
BranchTrueFalseTotal
my $name_token = shift @$tokens or return 0 69 69
2204 69 my $name = $name_token->[0];
2205 69 ▶ if (ref $name) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $name) 7 62 69
2206 7 $name = $name->[0];
2207 7 ▶ return if $name =~ /\.pl$/i;
Branch: 1 branch
BranchTrueFalseTotal
if $name =~ /\.pl$/i 2 5 7
2208  
2209 5 $name =~ s|/|::|g;
2210 5 $name =~ s|\.pm$||i;
2211 }
2212 67 ▶ return if !defined $name or $name eq '';
Branch: 1 branch
BranchTrueFalseTotal
if not defined $name or $name eq "" 0 67 67
Condition33%1/3
not defined $name or $name eq ""
l!l&&r!l&&!r
0067
MC/DC0%0/2
not defined $name or $name eq ""
not defined $name $name eq ""
Truth table33%1/3
not(A) or B
A= not defined $nameB= $name eq ""
ABresult
1X1
011
000
2213  
2214 67 my $c1 = substr($name, 0, 1);
2215 67 ▶ if ($c1 eq '5') {
Branch: 1 branch
BranchTrueFalseTotal
if ($c1 eq 5) 1 66 67
2216 1 $c->add_conditional(perl => $name);
2217 1 return;
2218 }
2219 66 ▶ if ($c1 eq 'v') {
Branch: 1 branch
BranchTrueFalseTotal
if ($c1 eq "v") 1 65 66
2220 1 my $c2 = substr($name, 1, 1);
2221 1 ▶ if ($c2 eq '5') {
Branch: 1 branch
BranchTrueFalseTotal
if ($c2 eq 5) 1 0 1
2222 1 $c->add_conditional(perl => $name);
2223 1 return;
2224 }
2225 0 ▶ if ($c2 eq '6') {
Branch: 1 branch
BranchTrueFalseTotal
if ($c2 eq 6) 0 0 0
2226 0 $c->{perl6} = 1;
2227 0 $c->{ended} = 1;
2228 0 return;
2229 }
2230 }
2231 65 ▶ if (is_module_name($name)) {
Branch: 1 branch
BranchTrueFalseTotal
if (is_module_name($name)) 62 3 65
2232 62 $c->add_conditional($name => 0);
2233 62 return;
2234 }
2235 }
2236  
2237 sub _no {
2238 31 ▶ my ($c, $rstr, $tokens) = @_;
Subroutine _no: called CC=16 SCAR=30.8
2239 31 _debug("NO TOKENS: ".(Data::Dump::dump($tokens))) if DEBUG;
2240 31 shift @$tokens; # discard 'no' itself
2241  
2242 # TODO: see if the token is WORD or not?
2243 31 ▶ my $name_token = shift @$tokens or return;
Branch: 1 branch
BranchTrueFalseTotal
my $name_token = shift @$tokens or return 0 31 31
2244 31 my $name = $name_token->[0];
2245 31 ▶ return if !defined $name or ref $name or $name eq '';
Branch: 1 branch
BranchTrueFalseTotal
if not defined $name or ref $name or $name eq "" 0 31 31
Condition33%2/6
not defined $name or ref $name or $name eq ""
l!l&&r!l&&!r
0031
not defined $name or ref $name
l!l&&r!l&&!r
0031
MC/DC0%0/3
not defined $name or ref $name or $name eq ""
not defined $name ref $name $name eq ""
Truth table25%1/4
not(A) or B or C
A= not defined $nameB= ref $nameC= $name eq ""
ABCresult
1XX1
01X1
0011
0000
2246  
2247 31 my $c1 = substr($name, 0, 1);
2248 31 ▶ if ($c1 eq '5') {
Branch: 1 branch
BranchTrueFalseTotal
if ($c1 eq 5) 1 30 31
2249 1 $c->add_no(perl => $name);
2250 1 return;
2251 }
2252 30 ▶ if ($c1 eq 'v') {
Branch: 1 branch
BranchTrueFalseTotal
if ($c1 eq "v") 1 29 30
2253 1 my $c2 = substr($name, 1, 1);
2254 1 ▶ if ($c2 eq '5') {
Branch: 1 branch
BranchTrueFalseTotal
if ($c2 eq 5) 1 0 1
2255 1 $c->add_no(perl => $name);
2256 1 return;
2257 }
2258 0 ▶ if ($c2 eq '6') {
Branch: 1 branch
BranchTrueFalseTotal
if ($c2 eq 6) 0 0 0
2259 0 $c->{perl6} = 1;
2260 0 $c->{ended} = 1;
2261 0 return;
2262 }
2263 }
2264 29 ▶ if ($name eq 'utf8') {
Branch: 1 branch
BranchTrueFalseTotal
if ($name eq "utf8") 0 29 29
2265 0 $c->{utf8} = 0;
2266 }
2267  
2268 29 ▶ if (is_module_name($name)) {
Branch: 1 branch
BranchTrueFalseTotal
if (is_module_name($name)) 29 0 29
2269 29 my $maybe_version_token = $tokens->[0];
2270 29 my $maybe_version_token_desc = $maybe_version_token->[1];
2271 29 ▶ if ($maybe_version_token_desc and ($maybe_version_token_desc eq 'NUMBER' or $maybe_version_token_desc eq 'VERSION_STRING')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($maybe_version_token_desc and $maybe_version_token_desc eq 'NUMBER' || $maybe_version_token_desc eq 'VERSION_STRING') { } 3 26 29
Condition66%4/6
$maybe_version_token_desc and $maybe_version_token_desc eq "NUMBER" || $maybe_version_token_desc eq "VERSION_STRING"
!ll&&!rl&&r
0263
$maybe_version_token_desc eq "NUMBER" or $maybe_version_token_desc eq "VERSION_STRING"
l!l&&r!l&&!r
3026
MC/DC33%1/3
$maybe_version_token_desc and $maybe_version_token_desc eq "NUMBER" || $maybe_version_token_desc eq "VERSION_STRING"
$maybe_version_token_desc $maybe_version_token_desc eq "NUMBER" $maybe_version_token_desc eq "VERSION_STRING"
Truth table50%2/4
A and B or C
A= $maybe_version_token_descB= $maybe_version_token_desc eq "NUMBER"C= $maybe_version_token_desc eq "VERSION_STRING"
ABCresult
0XX0
1000
11X1
1011
2272 3 $c->add_no($name => $maybe_version_token->[0]);
2273 3 shift @$tokens;
2274 } else {
2275 26 $c->add_no($name => 0);
2276 }
2277 }
2278  
2279 29 ▶ if ($c->has_callback_for(no => $name)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c->has_callback_for("no", $name)) 2 27 29
2280 2 eval { $c->run_callback_for(no => $name, $tokens) };
2281 2 ▶ warn "Callback Error: $@" if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 2 2
2282 2 return;
2283 }
2284 }
2285  
2286 96 1;
2287  
2288 __END__
« blib/lib/Perl/PrereqScanner/NotQuiteLite/Context.pm ↑ Summary blib/lib/Perl/PrereqScanner/NotQuiteLite/Parser/Core.pm »