Branch Coverage

blib/lib/PPI/Lexer.pm
Criterion Covered Total %
branch 246 284 86.6


line true false branch
141 1 496 ref $_[0] ? :
143 1 496 unless (defined $file)
151 0 496 if (&_INSTANCE($@, 'PPI::Exception')) { }
0 496 elsif ($@) { }
173 0 16213 ref $_[0] ? :
175 0 16213 unless (defined $source and not ref $source)
183 0 16213 if (&_INSTANCE($@, 'PPI::Exception')) { }
0 16213 elsif ($@) { }
204 16709 0 ref $_[0] ? :
206 0 16709 unless $Tokenizer
215 1 16708 unless (eval { do { $self->_lex_document($Document); 1 } })
218 1 0 if (&_INSTANCE($@, 'PPI::Exception')) { }
244 20323 32162 unless ($Token->significant)
249 451 31711 if ($Token->content eq ";")
260 28615 3096 unless (ref $Token eq "PPI::Token::Structure")
273 985 2111 if ($Token->__LEXER__opens)
283 2111 0 if ($Token->__LEXER__closes)
298 0 16708 unless (defined $Token)
299 0 0 $self->{'Tokenizer'} ? :
312 2 16706 if (@$perl6)
315 0 2 unless (@$perl6)
393 7897 46578 if ($Parent->isa("PPI::Structure::List") or $Parent->isa("PPI::Structure::Constructor"))
398 1965 5932 if ($Token->isa("PPI::Token::Word"))
403 809 1916 unless ($Next->significant)
410 888 1028 if ($Next->isa('PPI::Token::Operator') and $Next->content eq '=>') { }
432 9645 43942 if ($class)
437 9328 9598 unless ($Next->significant)
445 1 9597 if ("PPI::Statement::Scheduled" eq $class and not $Next->isa('PPI::Token::Structure') && $Next->content =~ /\A[{;]\z/)
455 7 2968 if ($Token->content =~ /^(?:my|our|state)$/ and $Next->isa("PPI::Token::Word") and $Next->content eq "sub")
466 9569 21 if not $Next->isa("PPI::Token::Operator") or $Next->content ne "=>"
479 3852 49714 if ($Parent->isa("PPI::Structure::Subscript"))
481 3729 123 unless ($class and $class->isa("PPI::Statement::Expression"))
490 0 119 unless ($Next->significant)
498 119 0 if ($Next->content eq '}') { }
514 9463 40251 if $class
517 3303 36948 if ($is_lexsub or $Token->content eq "sub")
521 3268 3279 unless ($Next->significant)
529 28 3251 if ($sclass and $sclass eq "PPI::Statement::Scheduled")
533 3122 129 if ($Next->isa("PPI::Token::Word"))
559 2188 34760 if ($Token->content eq "use")
563 2185 2186 unless ($Next->significant)
570 1 2185 if ($Next->isa('PPI::Token::Operator') and $Next->content eq '=>') { }
2 2183 elsif ($Next->content eq 'v6') { }
595 1220 33540 if ($Parent->isa("PPI::Structure::Condition"))
600 5190 28350 if ($Parent->isa("PPI::Structure::List"))
605 6 28344 if ($Parent->isa("PPI::Structure::Given") or $Parent->isa("PPI::Structure::When"))
613 348 27996 if (&_INSTANCE($Token, "PPI::Token::Label"))
628 8 55906 if ($Statement->isa("PPI::Statement::End"))
636 88603 164642 unless ($Token->significant)
644 17640 147002 if ($Token->__LEXER__closes or $Token->isa("PPI::Token::Separator"))
654 24513 122489 unless ($Statement->__LEXER__normal)
656 4310 20203 unless ($self->_continues($Statement, $Token))
663 97817 44875 unless ($Token->isa("PPI::Token::Structure"))
669 22676 22199 if ($Token->content eq ";")
687 0 11280 unless (defined $Token)
712 0 8 unless (defined $Token)
733 49 24464 if ($Statement->schildren == 1 and $Statement->schild(0)->isa("PPI::Structure::Block"))
744 0 24464 if ref !($Statement =~ /\b(?:Scheduled|Sub|Compound|Given|When|Package)$/)
756 19076 5388 unless $Statement->isa("PPI::Statement::Compound")
763 3377 2011 if ($type eq "if")
770 2336 1041 unless ($LastChild->isa("PPI::Structure::Block"))
780 74 0 if ($NextLast and $NextLast->isa("PPI::Token") and $NextLast->isa("PPI::Token::Word") and $NextLast->content eq "else")
793 299 466 if ($Token->isa("PPI::Token::Word") and $Token->content eq 'else' || $Token->content eq 'elsif')
807 327 1684 if ($type eq "label")
817 38 289 if ($Token->isa("PPI::Token::Word") and $Token->content =~ /^(?:while|until|for|foreach)$/)
826 210 79 if ($Token->isa("PPI::Token::Structure") and $Token->content eq "{")
834 373 1311 if ($LastChild->isa("PPI::Structure") and $LastChild->braces eq "()")
844 142 1169 if ($type eq "for")
846 129 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')) { }
852 21 108 if ($Token->isa("PPI::Token::Structure") and $Token->content eq "(" or $Token->isa("PPI::Token::QuoteLike::Words"))
864 0 108 if ($LastChild->isa("PPI::Token::QuoteLike::Words"))
888 6 1271 if ($LastChild->isa("PPI::Token::Word") and $LastChild->content eq "continue")
897 420 851 if ($LastChild->isa("PPI::Structure::Block"))
905 6 414 if (&_INSTANCE($part[-2], "PPI::Token::Word") and $part[-2]->content eq "continue")
917 0 851 if ($type eq "block")
922 149 702 if ($type eq "while")
928 149 0 if ($LastChild->isa("PPI::Token::Word") and $LastChild->content eq 'while' || $LastChild->content eq 'until')
943 702 0 if ($type eq "foreach")
949 208 494 if ($LastChild->isa("PPI::Token::Symbol"))
952 192 16 if $Token->isa("PPI::Token::Structure") and $Token->content eq "("
953 16 0 if $Token->isa("PPI::Token::QuoteLike::Words")
957 279 215 if ($LastChild->content eq "foreach" or $LastChild->content eq "for")
959 194 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')) { }
981 190 25 if (($STATEMENT_CLASSES{$LastChild->content} || '') eq "PPI::Statement::Variable")
992 25 0 if ($LastChild->isa("PPI::Token::QuoteLike::Words"))
1020 6479 1583 if (&_INSTANCE($Element, "PPI::Token::Word"))
1023 1311 5168 if $rclass
1027 192 6559 if ($Parent->isa('PPI::Statement::Compound')) { }
3 6556 elsif ($Parent->isa('PPI::Statement::Given')) { }
3 6553 elsif ($Parent->isa('PPI::Statement::When')) { }
1028 192 0 if ($Parent->type =~ /^for(?:each)?$/)
1040 6 6547 if (&_INSTANCE($Element, "PPI::Token::Operator") and $Element->content eq "->")
1059 2769 245 if ($Element)
1060 399 2370 if ($Element->isa("PPI::Token::Operator") and $Element->content eq "->")
1065 22 2348 if ($Element->isa("PPI::Structure::Subscript"))
1069 745 1603 if ($Element->isa("PPI::Token::Symbol") and $Element->content =~ /^(?:\$|\@)/)
1073 48 1555 if ($Element->isa("PPI::Token::Cast") and $Element->content =~ /^(?:\@|\%)/)
1075 2 19 if ($prior and $prior->isa("PPI::Token::Operator") and $prior->content eq "->")
1139 10483 640 $Element ? :
1142 10483 640 if ($Element)
1143 2066 8417 if ($content eq "->" and $Element->isa("PPI::Token::Operator"))
1148 80 8337 if ($Element->isa("PPI::Structure::Subscript"))
1152 544 7793 if ($content =~ /^(?:\$|\@)/ and $Element->isa("PPI::Token::Symbol"))
1156 299 7494 if ($Element->isa("PPI::Token::Cast") and $Element->content =~ /^(?:\@|\%|\*)/)
1158 3 206 if ($prior and $prior->isa("PPI::Token::Operator") and $prior->content eq "->")
1163 2 7788 if ($Element->isa("PPI::Structure::Block"))
1167 2 0 if (my $prior = $Parent->schild(-2))
1169 2 0 if $prior->isa("PPI::Token::Cast") and $prior_content eq '@' || $prior_content eq '$'
1178 2302 5486 if $Parent->isa("PPI::Statement::Sub")
1182 1293 4193 if $Parent->isa("PPI::Statement::Package")
1185 829 3364 if ($CURLY_CLASSES{$content})
1192 1857 2147 if ($Parent->isa("PPI::Statement::Compound"))
1198 53 2094 if ($Parent->isa("PPI::Statement::Include"))
1199 53 0 if ($Parent->schildren == 2 or $Parent->schildren == 3 and $Parent->schild(2)->isa("PPI::Token::Number"))
1210 1454 640 if $Element
1212 162 478 if ($Parent->isa("PPI::Statement") and &_INSTANCE(scalar $Parent->parent, "PPI::Structure::List"))
1221 94 68 if $function and $function->content =~ /^(?:map|grep|sort|eval|do)$/
1225 62 6 unless $function and $function->content =~ /^(?:print|say)$/
1234 203 989 unless ($Next->significant)
1240 128 861 if (++$position >= @CURLY_LOOKAHEAD_CLASSES) { }
268 593 elsif (my $class = $CURLY_LOOKAHEAD_CLASSES[$position]{$Next->content}) { }
1258 216 0 if (ref $Parent eq "PPI::Statement")
1274 42122 46701 unless ($Token->significant)
1281 25860 20841 unless ($Token->isa("PPI::Token::Structure"))
1297 454 20387 if ($Token->__LEXER__opens)
1307 20337 50 if ($Token->__LEXER__closes)
1309 19652 685 if ($Token->content eq $Structure->start->__LEXER__opposite)
1319 230 19422 if ($Structure->isa("PPI::Structure::For"))
1320 209 21 if (2 > scalar grep({$_->isa("PPI::Statement");} $Structure->children))
1348 0 1862 unless (defined $Token)
1366 380813 77708 unless shift @{$_[0]{"buffer"};}
1396 65263 156278 if (ref $Parent eq "PPI::Statement" and my $first = $Parent->schild(0))
1398 0 65263 if ($first->isa("PPI::Token::Label") and not my $second = $Parent->schild(1))
1402 0 0 if $new_class
1448 41298 11288 if (@_)
1453 28653 23933 if (@{$self->{'delayed'};})
1465 471 141 if (@_)