Branch Coverage

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


line true false branch
141 1 495 ref $_[0] ? :
143 1 495 unless (defined $file)
151 0 495 if (&_INSTANCE($@, 'PPI::Exception')) { }
0 495 elsif ($@) { }
173 0 16208 ref $_[0] ? :
175 0 16208 unless (defined $source and not ref $source)
183 0 16208 if (&_INSTANCE($@, 'PPI::Exception')) { }
0 16208 elsif ($@) { }
204 16703 0 ref $_[0] ? :
206 0 16703 unless $Tokenizer
215 1 16702 unless (eval { do { $self->_lex_document($Document); 1 } })
218 1 0 if (&_INSTANCE($@, 'PPI::Exception')) { }
244 20319 32115 unless ($Token->significant)
249 451 31664 if ($Token->content eq ";")
260 28631 3033 unless (ref $Token eq "PPI::Token::Structure")
273 959 2074 if ($Token->__LEXER__opens)
283 2074 0 if ($Token->__LEXER__closes)
298 0 16702 unless (defined $Token)
299 0 0 $self->{'Tokenizer'} ? :
312 2 16700 if (@$perl6)
315 0 2 unless (@$perl6)
393 7852 46495 if ($Parent->isa("PPI::Structure::List") or $Parent->isa("PPI::Structure::Constructor"))
398 1957 5895 if ($Token->isa("PPI::Token::Word"))
403 830 1900 unless ($Next->significant)
410 888 1012 if ($Next->isa('PPI::Token::Operator') and $Next->content eq '=>') { }
432 9597 43862 if ($class)
437 9278 9550 unless ($Next->significant)
445 1 9549 if ("PPI::Statement::Scheduled" eq $class and not $Next->isa('PPI::Token::Structure') && $Next->content =~ /\A[{;]\z/)
455 7 2933 if ($Token->content =~ /^(?:my|our|state)$/ and $Next->isa("PPI::Token::Word") and $Next->content eq "sub")
466 9521 21 if not $Next->isa("PPI::Token::Operator") or $Next->content ne "=>"
479 3829 49609 if ($Parent->isa("PPI::Structure::Subscript"))
481 3706 123 unless ($class and $class->isa("PPI::Statement::Expression"))
490 0 119 unless ($Next->significant)
498 119 0 if ($Next->content eq '}') { }
514 9415 40194 if $class
517 3299 36895 if ($is_lexsub or $Token->content eq "sub")
521 3264 3275 unless ($Next->significant)
529 28 3247 if ($sclass and $sclass eq "PPI::Statement::Scheduled")
533 3118 129 if ($Next->isa("PPI::Token::Word"))
559 2184 34711 if ($Token->content eq "use")
563 2181 2182 unless ($Next->significant)
570 1 2181 if ($Next->isa('PPI::Token::Operator') and $Next->content eq '=>') { }
2 2179 elsif ($Next->content eq 'v6') { }
595 1218 33493 if ($Parent->isa("PPI::Structure::Condition"))
600 5098 28395 if ($Parent->isa("PPI::Structure::List"))
605 6 28389 if ($Parent->isa("PPI::Structure::Given") or $Parent->isa("PPI::Structure::When"))
613 347 28042 if (&_INSTANCE($Token, "PPI::Token::Label"))
628 8 55767 if ($Statement->isa("PPI::Statement::End"))
636 88343 163997 unless ($Token->significant)
644 17600 146397 if ($Token->__LEXER__closes or $Token->isa("PPI::Token::Separator"))
654 24490 121907 unless ($Statement->__LEXER__normal)
656 4305 20185 unless ($self->_continues($Statement, $Token))
663 97348 44744 unless ($Token->isa("PPI::Token::Structure"))
669 22619 22125 if ($Token->content eq ";")
687 0 11243 unless (defined $Token)
712 0 8 unless (defined $Token)
733 48 24442 if ($Statement->schildren == 1 and $Statement->schild(0)->isa("PPI::Structure::Block"))
744 0 24442 if ref !($Statement =~ /\b(?:Scheduled|Sub|Compound|Given|When|Package)$/)
756 19064 5378 unless $Statement->isa("PPI::Statement::Compound")
763 3373 2005 if ($type eq "if")
770 2332 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 326 1679 if ($type eq "label")
817 38 288 if ($Token->isa("PPI::Token::Word") and $Token->content =~ /^(?:while|until|for|foreach)$/)
826 208 80 if ($Token->isa("PPI::Token::Structure") and $Token->content eq "{")
834 372 1307 if ($LastChild->isa("PPI::Structure") and $LastChild->braces eq "()")
844 141 1166 if ($type eq "for")
846 128 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 107 if ($Token->isa("PPI::Token::Structure") and $Token->content eq "(" or $Token->isa("PPI::Token::QuoteLike::Words"))
864 0 107 if ($LastChild->isa("PPI::Token::QuoteLike::Words"))
888 6 1267 if ($LastChild->isa("PPI::Token::Word") and $LastChild->content eq "continue")
897 419 848 if ($LastChild->isa("PPI::Structure::Block"))
905 6 413 if (&_INSTANCE($part[-2], "PPI::Token::Word") and $part[-2]->content eq "continue")
917 0 848 if ($type eq "block")
922 149 699 if ($type eq "while")
928 149 0 if ($LastChild->isa("PPI::Token::Word") and $LastChild->content eq 'while' || $LastChild->content eq 'until')
943 699 0 if ($type eq "foreach")
949 207 492 if ($LastChild->isa("PPI::Token::Symbol"))
952 191 16 if $Token->isa("PPI::Token::Structure") and $Token->content eq "("
953 16 0 if $Token->isa("PPI::Token::QuoteLike::Words")
957 278 214 if ($LastChild->content eq "foreach" or $LastChild->content eq "for")
959 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')) { }
981 189 25 if (($STATEMENT_CLASSES{$LastChild->content} || '') eq "PPI::Statement::Variable")
992 25 0 if ($LastChild->isa("PPI::Token::QuoteLike::Words"))
1020 6411 1565 if (&_INSTANCE($Element, "PPI::Token::Word"))
1023 1309 5102 if $rclass
1027 191 6476 if ($Parent->isa('PPI::Statement::Compound')) { }
3 6473 elsif ($Parent->isa('PPI::Statement::Given')) { }
3 6470 elsif ($Parent->isa('PPI::Statement::When')) { }
1028 191 0 if ($Parent->type =~ /^for(?:each)?$/)
1040 6 6464 if (&_INSTANCE($Element, "PPI::Token::Operator") and $Element->content eq "->")
1059 2778 251 if ($Element)
1060 392 2386 if ($Element->isa("PPI::Token::Operator") and $Element->content eq "->")
1065 21 2365 if ($Element->isa("PPI::Structure::Subscript"))
1069 741 1624 if ($Element->isa("PPI::Token::Symbol") and $Element->content =~ /^(?:\$|\@)/)
1073 43 1581 if ($Element->isa("PPI::Token::Cast") and $Element->content =~ /^(?:\@|\%)/)
1075 2 16 if ($prior and $prior->isa("PPI::Token::Operator") and $prior->content eq "->")
1139 10478 642 $Element ? :
1142 10478 642 if ($Element)
1143 2066 8412 if ($content eq "->" and $Element->isa("PPI::Token::Operator"))
1148 79 8333 if ($Element->isa("PPI::Structure::Subscript"))
1152 535 7798 if ($content =~ /^(?:\$|\@)/ and $Element->isa("PPI::Token::Symbol"))
1156 300 7498 if ($Element->isa("PPI::Token::Cast") and $Element->content =~ /^(?:\@|\%|\*)/)
1158 3 203 if ($prior and $prior->isa("PPI::Token::Operator") and $prior->content eq "->")
1163 2 7793 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 2298 5495 if $Parent->isa("PPI::Statement::Sub")
1182 1293 4202 if $Parent->isa("PPI::Statement::Package")
1185 830 3372 if ($CURLY_CLASSES{$content})
1192 1852 2162 if ($Parent->isa("PPI::Statement::Compound"))
1198 53 2109 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 1467 642 if $Element
1212 168 474 if ($Parent->isa("PPI::Statement") and &_INSTANCE(scalar $Parent->parent, "PPI::Structure::List"))
1221 94 74 if $function and $function->content =~ /^(?:map|grep|sort|eval|do)$/
1225 68 6 unless $function and $function->content =~ /^(?:print|say)$/
1234 192 987 unless ($Next->significant)
1240 127 860 if (++$position >= @CURLY_LOOKAHEAD_CLASSES) { }
268 592 elsif (my $class = $CURLY_LOOKAHEAD_CLASSES[$position]{$Next->content}) { }
1258 212 0 if (ref $Parent eq "PPI::Statement")
1274 41847 46538 unless ($Token->significant)
1281 25716 20822 unless ($Token->isa("PPI::Token::Structure"))
1297 469 20353 if ($Token->__LEXER__opens)
1307 20303 50 if ($Token->__LEXER__closes)
1309 19578 725 if ($Token->content eq $Structure->start->__LEXER__opposite)
1319 229 19349 if ($Structure->isa("PPI::Structure::For"))
1320 208 21 if (2 > scalar grep({$_->isa("PPI::Statement");} $Structure->children))
1348 0 1822 unless (defined $Token)
1366 379371 77556 unless shift @{$_[0]{"buffer"};}
1396 65375 155386 if (ref $Parent eq "PPI::Statement" and my $first = $Parent->schild(0))
1398 0 65375 if ($first->isa("PPI::Token::Label") and not my $second = $Parent->schild(1))
1402 0 0 if $new_class
1448 41218 11251 if (@_)
1453 28616 23853 if (@{$self->{'delayed'};})
1465 468 139 if (@_)