Branch Coverage

blib/lib/PPI/Lexer.pm
Criterion Covered Total %
branch 262 302 86.7


line true false branch
144 1 506 ref $_[0] ? :
146 1 506 unless (defined $file)
155 0 506 if (&_INSTANCE($@, 'PPI::Exception')) { }
0 506 elsif ($@) { }
179 0 16293 ref $_[0] ? :
181 0 16293 unless (defined $source and not ref $source)
190 0 16293 if (&_INSTANCE($@, 'PPI::Exception')) { }
0 16293 elsif ($@) { }
213 16799 0 ref $_[0] ? :
215 0 16799 unless $Tokenizer
224 18 16781 if (my $feat = $Document->feature_mods)
231 1 16798 unless (eval { do { $self->_lex_document($Document); 1 } })
235 1 0 if (&_INSTANCE($@, 'PPI::Exception')) { }
261 21304 32622 unless ($Token->significant)
266 463 32159 if ($Token->content eq ";")
277 29079 3080 unless (ref $Token eq "PPI::Token::Structure")
290 936 2144 if ($Token->__LEXER__opens)
300 2144 0 if ($Token->__LEXER__closes)
315 0 16798 unless (defined $Token)
316 0 0 $self->{'Tokenizer'} ? :
329 2 16796 if (@$perl6)
332 0 2 unless (@$perl6)
410 7926 47370 if ($Parent->isa("PPI::Structure::List") or $Parent->isa("PPI::Structure::Constructor"))
415 1995 5931 if ($Token->isa("PPI::Token::Word"))
420 887 1947 unless ($Next->significant)
427 945 1002 if ($Next->isa('PPI::Token::Operator') and $Next->content eq '=>') { }
452 2 54349 $content eq 'try' && +($self->{'features'}[-1] || {})->{'try'} ? :
454 9930 44421 if ($class)
459 9601 9883 unless ($Next->significant)
467 1 9882 if ("PPI::Statement::Scheduled" eq $class and not $Next->isa('PPI::Token::Structure') && $Next->content =~ /\A[{;]\z/)
477 7 3100 if ($content =~ /^(?:my|our|state)\z/ and $Next->isa("PPI::Token::Word") and $Next->content eq "sub")
488 9854 21 if not $Next->isa("PPI::Token::Operator") or $Next->content ne "=>"
501 3903 50427 if ($Parent->isa("PPI::Structure::Subscript"))
503 3780 123 unless ($class and $class->isa("PPI::Statement::Expression"))
512 0 119 unless ($Next->significant)
520 119 0 if ($Next->content eq '}') { }
536 9748 40679 if $class
539 3291 37388 if ($is_lexsub or $content eq "sub")
543 3252 3267 unless ($Next->significant)
551 28 3239 if ($sclass and $sclass eq "PPI::Statement::Scheduled")
555 3130 109 if ($Next->isa("PPI::Token::Word"))
581 2268 35120 if ($content eq "use")
585 2265 2266 unless ($Next->significant)
592 1 2265 if ($Next->isa('PPI::Token::Operator') and $Next->content eq '=>') { }
2 2263 elsif ($Next->content eq 'v6') { }
617 1265 33855 if ($Parent->isa("PPI::Structure::Condition"))
622 5123 28732 if ($Parent->isa("PPI::Structure::List"))
627 6 28726 if ($Parent->isa("PPI::Structure::Given") or $Parent->isa("PPI::Structure::When"))
635 379 28347 if (&_INSTANCE($Token, "PPI::Token::Label"))
647 17 56662 if (ref $statement eq "PPI::Statement::Include" and my $feat = $statement->feature_mods)
648 16 1 unless @{$self->{'features'};}
662 8 56679 if ($Statement->isa("PPI::Statement::End"))
670 93414 171005 unless ($Token->significant)
678 17833 153172 if ($Token->__LEXER__closes or $Token->isa("PPI::Token::Separator"))
689 24751 128421 unless ($Statement->__LEXER__normal)
691 4409 20342 unless ($self->_continues($Statement, $Token))
699 103252 45511 unless ($Token->isa("PPI::Token::Structure"))
705 23038 22473 if ($Token->content eq ";")
724 0 11399 unless (defined $Token)
750 0 8 unless (defined $Token)
771 44 24707 if ($Statement->schildren == 1 and $Statement->schild(0)->isa("PPI::Structure::Block"))
782 0 24707 if ref !($Statement =~ /\b(?:Scheduled|Sub|Compound|Given|When|Package)$/)
794 19109 5598 unless $Statement->isa("PPI::Statement::Compound")
801 3499 2099 if ($type eq "if")
808 2423 1076 unless ($LastChild->isa("PPI::Structure::Block"))
818 72 0 if ($NextLast and $NextLast->isa("PPI::Token") and $NextLast->isa("PPI::Token::Word") and $NextLast->content eq "else")
831 310 490 if ($Token->isa("PPI::Token::Word") and $Token->content eq 'else' || $Token->content eq 'elsif')
845 356 1743 if ($type eq "label")
855 38 318 if ($Token->isa("PPI::Token::Word") and $Token->content =~ /^(?:while|until|for|foreach)$/)
864 240 78 if ($Token->isa("PPI::Token::Structure") and $Token->content eq "{")
872 381 1362 if ($LastChild->isa("PPI::Structure") and $LastChild->braces eq "()")
882 140 1222 if ($type eq "for")
884 127 13 if ($LastChild->isa('PPI::Token::Word') and $LastChild->content =~ /^for(?:each)?\z/) { }
13 0 elsif ($LastChild->isa('PPI::Structure::Block')) { }
0 0 elsif ($LastChild->isa('PPI::Token::QuoteLike::Words')) { }
890 21 106 if ($Token->isa("PPI::Token::Structure") and $Token->content eq "(" or $Token->isa("PPI::Token::QuoteLike::Words"))
902 0 106 if ($LastChild->isa("PPI::Token::QuoteLike::Words"))
926 6 1322 if ($LastChild->isa("PPI::Token::Word") and $LastChild->content eq "continue")
934 6 0 if ($type eq "try" and $LastChild->presumed_features->{'try'})
935 4 2 unless $LastChild->isa("PPI::Structure::Block")
938 0 2 if $NextLast and $NextLast->isa("PPI::Token") and $NextLast->isa("PPI::Token::Word") and $NextLast->content eq "catch"
944 2 0 if $Token->isa("PPI::Token::Word") and $Token->content eq "catch"
951 460 856 if ($LastChild->isa("PPI::Structure::Block"))
959 6 454 if (&_INSTANCE($part[-2], "PPI::Token::Word") and $part[-2]->content eq "continue")
971 0 856 if ($type eq "block")
976 157 699 if ($type eq "while")
982 157 0 if ($LastChild->isa("PPI::Token::Word") and $LastChild->content eq 'while' || $LastChild->content eq 'until')
997 699 0 if ($type eq "foreach")
1003 207 492 if ($LastChild->isa("PPI::Token::Symbol"))
1006 191 16 if $Token->isa("PPI::Token::Structure") and $Token->content eq "("
1007 16 0 if $Token->isa("PPI::Token::QuoteLike::Words")
1011 278 214 if ($LastChild->content eq "foreach" or $LastChild->content eq "for")
1013 193 85 if ($Token->isa('PPI::Token::Word') and ($STATEMENT_CLASSES{$Token->content} || '') eq 'PPI::Statement::Variable') { }
34 51 elsif ($Token->content =~ /^\$/) { }
42 9 elsif ($Token->isa('PPI::Token::Structure') and $Token->content eq '(') { }
6 3 elsif ($Token->isa('PPI::Token::QuoteLike::Words')) { }
1035 189 25 if (($STATEMENT_CLASSES{$LastChild->content} || '') eq "PPI::Statement::Variable")
1046 25 0 if ($LastChild->isa("PPI::Token::QuoteLike::Words"))
1074 6466 1606 if (&_INSTANCE($Element, "PPI::Token::Word"))
1077 1364 5102 if $rclass
1081 192 6516 if ($Parent->isa('PPI::Statement::Compound')) { }
3 6513 elsif ($Parent->isa('PPI::Statement::Given')) { }
3 6510 elsif ($Parent->isa('PPI::Statement::When')) { }
34 6476 elsif ($Parent->isa('PPI::Statement::Sub')) { }
1082 191 1 if ($Parent->type =~ /^for(?:each)?$/)
1096 10 6467 if (&_INSTANCE($Element, "PPI::Token::Operator") and $Element->content eq "->")
1115 2811 224 if ($Element)
1116 400 2411 if ($Element->isa("PPI::Token::Operator") and $Element->content eq "->")
1121 13 2398 if ($Element->isa("PPI::Structure::Subscript"))
1125 733 1665 if ($Element->isa("PPI::Token::Symbol") and $Element->content =~ /^(?:\$|\@)/)
1129 46 1619 if ($Element->isa("PPI::Token::Cast") and $Element->content =~ /^(?:\@|\%)/)
1131 2 18 if ($prior and $prior->isa("PPI::Token::Operator") and $prior->content eq "->")
1195 10723 643 $Element ? :
1198 10723 643 if ($Element)
1199 2111 8612 if ($content eq "->" and $Element->isa("PPI::Token::Operator"))
1204 73 8539 if ($Element->isa("PPI::Structure::Subscript"))
1208 573 7966 if ($content =~ /^(?:\$|\@)/ and $Element->isa("PPI::Token::Symbol"))
1212 326 7640 if ($Element->isa("PPI::Token::Cast") and $Element->content =~ /^(?:\@|\%|\*)/)
1214 3 229 if ($prior and $prior->isa("PPI::Token::Operator") and $prior->content eq "->")
1219 4 7959 if ($Element->isa("PPI::Structure::Block"))
1223 4 0 if (my $prior = $Parent->schild(-2))
1225 2 0 if $prior->isa("PPI::Token::Cast") and $prior_content eq '@' || $prior_content eq '$'
1234 2337 5624 if $Parent->isa("PPI::Statement::Sub")
1238 1293 4331 if $Parent->isa("PPI::Statement::Package")
1241 893 3438 if ($CURLY_CLASSES{$content})
1248 1940 2141 if ($Parent->isa("PPI::Statement::Compound"))
1254 53 2088 if ($Parent->isa("PPI::Statement::Include"))
1255 53 0 if ($Parent->schildren == 2 or $Parent->schildren == 3 and $Parent->schild(2)->isa("PPI::Token::Number"))
1266 1445 643 if $Element
1268 165 478 if ($Parent->isa("PPI::Statement") and &_INSTANCE(scalar $Parent->parent, "PPI::Structure::List"))
1277 94 71 if $function and $function->content =~ /^(?:map|grep|sort|eval|do)$/
1281 65 6 unless $function and $function->content =~ /^(?:print|say)$/
1290 194 1001 unless ($Next->significant)
1296 131 870 if (++$position >= @CURLY_LOOKAHEAD_CLASSES) { }
265 605 elsif (my $class = $CURLY_LOOKAHEAD_CLASSES[$position]{$Next->content}) { }
1314 219 0 if (ref $Parent eq "PPI::Statement")
1332 42751 47330 unless ($Token->significant)
1339 26217 21113 unless ($Token->isa("PPI::Token::Structure"))
1355 455 20658 if ($Token->__LEXER__opens)
1365 20607 51 if ($Token->__LEXER__closes)
1369 19939 668 if ($Token->content eq $Structure->start->__LEXER__opposite)
1379 229 19710 if ($Structure->isa("PPI::Structure::For"))
1380 208 21 if (2 > scalar grep({$_->isa("PPI::Statement");} $Structure->children))
1408 0 1866 unless (defined $Token)
1428 394415 78993 unless shift @{$_[0]{"buffer"};}
1458 69727 159685 if (ref $Parent eq "PPI::Statement" and my $first = $Parent->schild(0))
1460 0 69727 if ($first->isa("PPI::Token::Label") and not my $second = $Parent->schild(1))
1464 0 0 if $new_class
1510 41908 11407 if (@_)
1515 29211 24104 if (@{$self->{'delayed'};})
1527 472 143 if (@_)