Branch Coverage

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


line true false branch
141 1 502 ref $_[0] ? :
143 1 502 unless (defined $file)
151 0 502 if (&_INSTANCE($@, 'PPI::Exception')) { }
0 502 elsif ($@) { }
173 0 16264 ref $_[0] ? :
175 0 16264 unless (defined $source and not ref $source)
183 0 16264 if (&_INSTANCE($@, 'PPI::Exception')) { }
0 16264 elsif ($@) { }
204 16766 0 ref $_[0] ? :
206 0 16766 unless $Tokenizer
215 1 16765 unless (eval { do { $self->_lex_document($Document); 1 } })
218 1 0 if (&_INSTANCE($@, 'PPI::Exception')) { }
244 20596 32598 unless ($Token->significant)
249 472 32126 if ($Token->content eq ";")
260 28947 3179 unless (ref $Token eq "PPI::Token::Structure")
273 978 2201 if ($Token->__LEXER__opens)
283 2201 0 if ($Token->__LEXER__closes)
298 0 16765 unless (defined $Token)
299 0 0 $self->{'Tokenizer'} ? :
312 2 16763 if (@$perl6)
315 0 2 unless (@$perl6)
393 7641 46760 if ($Parent->isa("PPI::Structure::List") or $Parent->isa("PPI::Structure::Constructor"))
398 1920 5721 if ($Token->isa("PPI::Token::Word"))
403 816 1872 unless ($Next->significant)
410 891 981 if ($Next->isa('PPI::Token::Operator') and $Next->content eq '=>') { }
432 9645 43865 if ($class)
437 9325 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 2965 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 3845 49644 if ($Parent->isa("PPI::Structure::Subscript"))
481 3722 123 unless ($class and $class->isa("PPI::Statement::Expression"))
490 0 119 unless ($Next->significant)
498 119 0 if ($Next->content eq '}') { }
514 9463 40181 if $class
517 3219 36962 if ($is_lexsub or $Token->content eq "sub")
521 3180 3195 unless ($Next->significant)
529 28 3167 if ($sclass and $sclass eq "PPI::Statement::Scheduled")
533 3060 107 if ($Next->isa("PPI::Token::Word"))
559 2238 34724 if ($Token->content eq "use")
563 2235 2236 unless ($Next->significant)
570 1 2235 if ($Next->isa('PPI::Token::Operator') and $Next->content eq '=>') { }
2 2233 elsif ($Next->content eq 'v6') { }
595 1220 33504 if ($Parent->isa("PPI::Structure::Condition"))
600 4965 28539 if ($Parent->isa("PPI::Structure::List"))
605 6 28533 if ($Parent->isa("PPI::Structure::Given") or $Parent->isa("PPI::Structure::When"))
613 357 28176 if (&_INSTANCE($Token, "PPI::Token::Label"))
628 8 55819 if ($Statement->isa("PPI::Statement::End"))
636 89457 165135 unless ($Token->significant)
644 17555 147580 if ($Token->__LEXER__closes or $Token->isa("PPI::Token::Separator"))
654 24328 123252 unless ($Statement->__LEXER__normal)
656 4322 20006 unless ($self->_continues($Statement, $Token))
663 98718 44540 unless ($Token->isa("PPI::Token::Structure"))
669 22670 21870 if ($Token->content eq ";")
687 0 11272 unless (defined $Token)
712 0 8 unless (defined $Token)
733 53 24275 if ($Statement->schildren == 1 and $Statement->schild(0)->isa("PPI::Structure::Block"))
744 0 24275 if ref !($Statement =~ /\b(?:Scheduled|Sub|Compound|Given|When|Package)$/)
756 18888 5387 unless $Statement->isa("PPI::Statement::Compound")
763 3376 2011 if ($type eq "if")
770 2335 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 300 465 if ($Token->isa("PPI::Token::Word") and $Token->content eq 'else' || $Token->content eq 'elsif')
807 333 1678 if ($type eq "label")
817 38 295 if ($Token->isa("PPI::Token::Word") and $Token->content =~ /^(?:while|until|for|foreach)$/)
826 210 85 if ($Token->isa("PPI::Token::Structure") and $Token->content eq "{")
834 371 1307 if ($LastChild->isa("PPI::Structure") and $LastChild->braces eq "()")
844 140 1167 if ($type eq "for")
846 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')) { }
852 21 106 if ($Token->isa("PPI::Token::Structure") and $Token->content eq "(" or $Token->isa("PPI::Token::QuoteLike::Words"))
864 0 106 if ($LastChild->isa("PPI::Token::QuoteLike::Words"))
888 6 1267 if ($LastChild->isa("PPI::Token::Word") and $LastChild->content eq "continue")
897 422 845 if ($LastChild->isa("PPI::Structure::Block"))
905 6 416 if (&_INSTANCE($part[-2], "PPI::Token::Word") and $part[-2]->content eq "continue")
917 0 845 if ($type eq "block")
922 149 696 if ($type eq "while")
928 149 0 if ($LastChild->isa("PPI::Token::Word") and $LastChild->content eq 'while' || $LastChild->content eq 'until')
943 696 0 if ($type eq "foreach")
949 206 490 if ($LastChild->isa("PPI::Token::Symbol"))
952 190 16 if $Token->isa("PPI::Token::Structure") and $Token->content eq "("
953 16 0 if $Token->isa("PPI::Token::QuoteLike::Words")
957 277 213 if ($LastChild->content eq "foreach" or $LastChild->content eq "for")
959 192 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 188 25 if (($STATEMENT_CLASSES{$LastChild->content} || '') eq "PPI::Statement::Variable")
992 25 0 if ($LastChild->isa("PPI::Token::QuoteLike::Words"))
1020 6230 1604 if (&_INSTANCE($Element, "PPI::Token::Word"))
1023 1311 4919 if $rclass
1027 190 6333 if ($Parent->isa('PPI::Statement::Compound')) { }
3 6330 elsif ($Parent->isa('PPI::Statement::Given')) { }
3 6327 elsif ($Parent->isa('PPI::Statement::When')) { }
1028 190 0 if ($Parent->type =~ /^for(?:each)?$/)
1040 6 6321 if (&_INSTANCE($Element, "PPI::Token::Operator") and $Element->content eq "->")
1059 2729 245 if ($Element)
1060 400 2329 if ($Element->isa("PPI::Token::Operator") and $Element->content eq "->")
1065 25 2304 if ($Element->isa("PPI::Structure::Subscript"))
1069 745 1559 if ($Element->isa("PPI::Token::Symbol") and $Element->content =~ /^(?:\$|\@)/)
1073 49 1510 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 10410 652 $Element ? :
1142 10410 652 if ($Element)
1143 2058 8352 if ($content eq "->" and $Element->isa("PPI::Token::Operator"))
1148 79 8273 if ($Element->isa("PPI::Structure::Subscript"))
1152 541 7732 if ($content =~ /^(?:\$|\@)/ and $Element->isa("PPI::Token::Symbol"))
1156 297 7435 if ($Element->isa("PPI::Token::Cast") and $Element->content =~ /^(?:\@|\%|\*)/)
1158 3 205 if ($prior and $prior->isa("PPI::Token::Operator") and $prior->content eq "->")
1163 4 7725 if ($Element->isa("PPI::Structure::Block"))
1167 4 0 if (my $prior = $Parent->schild(-2))
1169 2 0 if $prior->isa("PPI::Token::Cast") and $prior_content eq '@' || $prior_content eq '$'
1178 2269 5458 if $Parent->isa("PPI::Statement::Sub")
1182 1293 4165 if $Parent->isa("PPI::Statement::Package")
1185 829 3336 if ($CURLY_CLASSES{$content})
1192 1854 2134 if ($Parent->isa("PPI::Statement::Compound"))
1198 53 2081 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 1429 652 if $Element
1212 161 491 if ($Parent->isa("PPI::Statement") and &_INSTANCE(scalar $Parent->parent, "PPI::Structure::List"))
1221 94 67 if $function and $function->content =~ /^(?:map|grep|sort|eval|do)$/
1225 61 6 unless $function and $function->content =~ /^(?:print|say)$/
1234 207 1035 unless ($Next->significant)
1240 144 891 if (++$position >= @CURLY_LOOKAHEAD_CLASSES) { }
269 622 elsif (my $class = $CURLY_LOOKAHEAD_CLASSES[$position]{$Next->content}) { }
1258 228 0 if (ref $Parent eq "PPI::Statement")
1274 41426 46065 unless ($Token->significant)
1281 25454 20611 unless ($Token->isa("PPI::Token::Structure"))
1297 448 20163 if ($Token->__LEXER__opens)
1307 20111 52 if ($Token->__LEXER__closes)
1309 19371 740 if ($Token->content eq $Structure->start->__LEXER__opposite)
1319 228 19143 if ($Structure->isa("PPI::Structure::For"))
1320 207 21 if (2 > scalar grep({$_->isa("PPI::Statement");} $Structure->children))
1348 0 1759 unless (defined $Token)
1366 381704 77420 unless shift @{$_[0]{"buffer"};}
1396 66488 155918 if (ref $Parent eq "PPI::Statement" and my $first = $Parent->schild(0))
1398 0 66488 if ($first->isa("PPI::Token::Label") and not my $second = $Parent->schild(1))
1402 0 0 if $new_class
1448 41188 11280 if (@_)
1453 28440 24028 if (@{$self->{'delayed'};})
1465 485 156 if (@_)