Branch Coverage

blib/lib/PPI/Lexer.pm
Criterion Covered Total %
branch 254 294 86.3


line true false branch
143 1 506 ref $_[0] ? :
145 1 506 unless (defined $file)
154 0 506 if (&_INSTANCE($@, 'PPI::Exception')) { }
0 506 elsif ($@) { }
178 0 16293 ref $_[0] ? :
180 0 16293 unless (defined $source and not ref $source)
189 0 16293 if (&_INSTANCE($@, 'PPI::Exception')) { }
0 16293 elsif ($@) { }
212 16799 0 ref $_[0] ? :
214 0 16799 unless $Tokenizer
226 1 16798 unless (eval {
230 1 0 if (&_INSTANCE($@, 'PPI::Exception')) { }
256 20902 32468 unless ($Token->significant)
261 465 32003 if ($Token->content eq ";")
272 28990 3013 unless (ref $Token eq "PPI::Token::Structure")
285 946 2067 if ($Token->__LEXER__opens)
295 2067 0 if ($Token->__LEXER__closes)
310 0 16798 unless (defined $Token)
311 0 0 $self->{'Tokenizer'} ? :
324 2 16796 if (@$perl6)
327 0 2 unless (@$perl6)
405 7999 47200 if ($Parent->isa("PPI::Structure::List") or $Parent->isa("PPI::Structure::Constructor"))
410 2034 5965 if ($Token->isa("PPI::Token::Word"))
415 897 1983 unless ($Next->significant)
422 949 1034 if ($Next->isa('PPI::Token::Operator') and $Next->content eq '=>') { }
449 9909 44341 if ($class)
454 9580 9862 unless ($Next->significant)
462 1 9861 if ("PPI::Statement::Scheduled" eq $class and not $Next->isa('PPI::Token::Structure') && $Next->content =~ /\A[{;]\z/)
472 7 3085 if ($Token->content =~ /^(?:my|our|state)$/ and $Next->isa("PPI::Token::Word") and $Next->content eq "sub")
483 9833 21 if not $Next->isa("PPI::Token::Operator") or $Next->content ne "=>"
496 3883 50346 if ($Parent->isa("PPI::Structure::Subscript"))
498 3760 123 unless ($class and $class->isa("PPI::Statement::Expression"))
507 0 119 unless ($Next->significant)
515 119 0 if ($Next->content eq '}') { }
531 9727 40619 if $class
534 3287 37332 if ($is_lexsub or $Token->content eq "sub")
538 3248 3263 unless ($Next->significant)
546 28 3235 if ($sclass and $sclass eq "PPI::Statement::Scheduled")
550 3126 109 if ($Next->isa("PPI::Token::Word"))
576 2268 35064 if ($Token->content eq "use")
580 2265 2266 unless ($Next->significant)
587 1 2265 if ($Next->isa('PPI::Token::Operator') and $Next->content eq '=>') { }
2 2263 elsif ($Next->content eq 'v6') { }
612 1263 33801 if ($Parent->isa("PPI::Structure::Condition"))
617 5157 28644 if ($Parent->isa("PPI::Structure::List"))
622 6 28638 if ($Parent->isa("PPI::Structure::Given") or $Parent->isa("PPI::Structure::When"))
630 395 28243 if (&_INSTANCE($Token, "PPI::Token::Label"))
645 8 56581 if ($Statement->isa("PPI::Statement::End"))
653 93232 170323 unless ($Token->significant)
661 17730 152593 if ($Token->__LEXER__closes or $Token->isa("PPI::Token::Separator"))
671 24743 127850 unless ($Statement->__LEXER__normal)
673 4415 20328 unless ($self->_continues($Statement, $Token))
680 102718 45460 unless ($Token->isa("PPI::Token::Structure"))
686 23035 22425 if ($Token->content eq ";")
704 0 11401 unless (defined $Token)
729 0 8 unless (defined $Token)
750 46 24697 if ($Statement->schildren == 1 and $Statement->schild(0)->isa("PPI::Structure::Block"))
761 0 24697 if ref !($Statement =~ /\b(?:Scheduled|Sub|Compound|Given|When|Package)$/)
773 19097 5600 unless $Statement->isa("PPI::Statement::Compound")
780 3483 2117 if ($type eq "if")
787 2411 1072 unless ($LastChild->isa("PPI::Structure::Block"))
797 72 0 if ($NextLast and $NextLast->isa("PPI::Token") and $NextLast->isa("PPI::Token::Word") and $NextLast->content eq "else")
810 310 486 if ($Token->isa("PPI::Token::Word") and $Token->content eq 'else' || $Token->content eq 'elsif')
824 368 1749 if ($type eq "label")
834 38 330 if ($Token->isa("PPI::Token::Word") and $Token->content =~ /^(?:while|until|for|foreach)$/)
843 242 88 if ($Token->isa("PPI::Token::Structure") and $Token->content eq "{")
851 383 1366 if ($LastChild->isa("PPI::Structure") and $LastChild->braces eq "()")
861 140 1226 if ($type eq "for")
863 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')) { }
869 21 106 if ($Token->isa("PPI::Token::Structure") and $Token->content eq "(" or $Token->isa("PPI::Token::QuoteLike::Words"))
881 0 106 if ($LastChild->isa("PPI::Token::QuoteLike::Words"))
905 6 1326 if ($LastChild->isa("PPI::Token::Word") and $LastChild->content eq "continue")
913 6 0 if ($type eq "try" and $LastChild->presumed_features->{'try'})
914 4 2 unless $LastChild->isa("PPI::Structure::Block")
917 0 2 if $NextLast and $NextLast->isa("PPI::Token") and $NextLast->isa("PPI::Token::Word") and $NextLast->content eq "catch"
923 2 0 if $Token->isa("PPI::Token::Word") and $Token->content eq "catch"
930 462 858 if ($LastChild->isa("PPI::Structure::Block"))
938 6 456 if (&_INSTANCE($part[-2], "PPI::Token::Word") and $part[-2]->content eq "continue")
950 0 858 if ($type eq "block")
955 159 699 if ($type eq "while")
961 159 0 if ($LastChild->isa("PPI::Token::Word") and $LastChild->content eq 'while' || $LastChild->content eq 'until')
976 699 0 if ($type eq "foreach")
982 207 492 if ($LastChild->isa("PPI::Token::Symbol"))
985 191 16 if $Token->isa("PPI::Token::Structure") and $Token->content eq "("
986 16 0 if $Token->isa("PPI::Token::QuoteLike::Words")
990 278 214 if ($LastChild->content eq "foreach" or $LastChild->content eq "for")
992 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')) { }
1014 189 25 if (($STATEMENT_CLASSES{$LastChild->content} || '') eq "PPI::Statement::Variable")
1025 25 0 if ($LastChild->isa("PPI::Token::QuoteLike::Words"))
1053 6454 1636 if (&_INSTANCE($Element, "PPI::Token::Word"))
1056 1360 5094 if $rclass
1060 192 6538 if ($Parent->isa('PPI::Statement::Compound')) { }
3 6535 elsif ($Parent->isa('PPI::Statement::Given')) { }
3 6532 elsif ($Parent->isa('PPI::Statement::When')) { }
34 6498 elsif ($Parent->isa('PPI::Statement::Sub')) { }
1061 191 1 if ($Parent->type =~ /^for(?:each)?$/)
1075 10 6489 if (&_INSTANCE($Element, "PPI::Token::Operator") and $Element->content eq "->")
1094 2781 249 if ($Element)
1095 400 2381 if ($Element->isa("PPI::Token::Operator") and $Element->content eq "->")
1100 5 2376 if ($Element->isa("PPI::Structure::Subscript"))
1104 735 1641 if ($Element->isa("PPI::Token::Symbol") and $Element->content =~ /^(?:\$|\@)/)
1108 42 1599 if ($Element->isa("PPI::Token::Cast") and $Element->content =~ /^(?:\@|\%)/)
1110 2 13 if ($prior and $prior->isa("PPI::Token::Operator") and $prior->content eq "->")
1174 10678 627 $Element ? :
1177 10678 627 if ($Element)
1178 2089 8589 if ($content eq "->" and $Element->isa("PPI::Token::Operator"))
1183 71 8518 if ($Element->isa("PPI::Structure::Subscript"))
1187 579 7939 if ($content =~ /^(?:\$|\@)/ and $Element->isa("PPI::Token::Symbol"))
1191 303 7636 if ($Element->isa("PPI::Token::Cast") and $Element->content =~ /^(?:\@|\%|\*)/)
1193 3 207 if ($prior and $prior->isa("PPI::Token::Operator") and $prior->content eq "->")
1198 4 7932 if ($Element->isa("PPI::Structure::Block"))
1202 4 0 if (my $prior = $Parent->schild(-2))
1204 2 0 if $prior->isa("PPI::Token::Cast") and $prior_content eq '@' || $prior_content eq '$'
1213 2333 5601 if $Parent->isa("PPI::Statement::Sub")
1217 1293 4308 if $Parent->isa("PPI::Statement::Package")
1220 898 3410 if ($CURLY_CLASSES{$content})
1227 1938 2099 if ($Parent->isa("PPI::Statement::Compound"))
1233 53 2046 if ($Parent->isa("PPI::Statement::Include"))
1234 53 0 if ($Parent->schildren == 2 or $Parent->schildren == 3 and $Parent->schild(2)->isa("PPI::Token::Number"))
1245 1419 627 if $Element
1247 165 462 if ($Parent->isa("PPI::Statement") and &_INSTANCE(scalar $Parent->parent, "PPI::Structure::List"))
1256 94 71 if $function and $function->content =~ /^(?:map|grep|sort|eval|do)$/
1260 65 6 unless $function and $function->content =~ /^(?:print|say)$/
1269 188 941 unless ($Next->significant)
1275 111 830 if (++$position >= @CURLY_LOOKAHEAD_CLASSES) { }
271 559 elsif (my $class = $CURLY_LOOKAHEAD_CLASSES[$position]{$Next->content}) { }
1293 197 0 if (ref $Parent eq "PPI::Statement")
1309 42668 47270 unless ($Token->significant)
1316 26209 21061 unless ($Token->isa("PPI::Token::Structure"))
1332 444 20617 if ($Token->__LEXER__opens)
1342 20562 55 if ($Token->__LEXER__closes)
1344 19851 711 if ($Token->content eq $Structure->start->__LEXER__opposite)
1354 229 19622 if ($Structure->isa("PPI::Structure::For"))
1355 208 21 if (2 > scalar grep({$_->isa("PPI::Statement");} $Structure->children))
1383 0 1863 unless (defined $Token)
1401 392966 78809 unless shift @{$_[0]{"buffer"};}
1431 69101 159155 if (ref $Parent eq "PPI::Statement" and my $first = $Parent->schild(0))
1433 0 69101 if ($first->isa("PPI::Token::Label") and not my $second = $Parent->schild(1))
1437 0 0 if $new_class
1483 41867 11409 if (@_)
1488 29144 24132 if (@{$self->{'delayed'};})
1500 455 124 if (@_)