Branch Coverage

blib/lib/PPI/Lexer.pm
Criterion Covered Total %
branch 260 296 87.8


line true false branch
163 1 16846 ref $self ? :
168 3 0 &_INSTANCE($@, 'PPI::Exception') ? :
0 16844 !&_INSTANCE($Tokenizer, 'PPI::Tokenizer') ? :
3 16844 $@ ? :
189 16844 0 ref $_[0] ? :
191 0 16844 unless $Tokenizer
200 18 16826 if (my $feat = $Document->feature_mods)
207 1 16843 unless (eval { do { $self->_lex_document($Document); 1 } })
211 1 0 if (&_INSTANCE($@, 'PPI::Exception')) { }
237 21244 32866 unless ($Token->significant)
242 470 32396 if ($Token->content eq ";")
253 29270 3126 unless (ref $Token eq "PPI::Token::Structure")
266 977 2149 if ($Token->__LEXER__opens)
276 2149 0 if ($Token->__LEXER__closes)
291 0 16843 unless (defined $Token)
292 0 0 $self->{'Tokenizer'} ? :
305 2 16841 if (@$perl6)
308 0 2 unless (@$perl6)
386 11846 54922 if ($Parent->isa("PPI::Structure::List") or $Parent->isa("PPI::Structure::Constructor"))
391 2018 9828 if ($Token->isa("PPI::Token::Word"))
396 883 1971 unless ($Next->significant)
403 947 1024 if ($Next->isa('PPI::Token::Operator') and $Next->content eq '=>') { }
428 2 65819 $content eq 'try' && +($self->{'features_stack'}[-1] || {})->{'try'} ? :
430 9918 55903 if ($class)
435 9596 9871 unless ($Next->significant)
443 1 9870 if ("PPI::Statement::Scheduled" eq $class and not $Next->isa('PPI::Token::Structure') && $Next->content =~ /\A[{;]\z/)
453 7 3109 if ($content =~ /^(?:my|our|state)\z/ and $Next->isa("PPI::Token::Word") and $Next->content eq "sub")
464 9842 21 if not $Next->isa("PPI::Token::Operator") or $Next->content ne "=>"
477 7579 58221 if ($Parent->isa("PPI::Structure::Subscript"))
479 7456 123 unless ($class and $class->isa("PPI::Statement::Expression"))
488 0 119 unless ($Next->significant)
496 119 0 if ($Next->content eq '}') { }
512 9736 48485 if $class
515 3416 45069 if ($is_lexsub or $content eq "sub")
519 3377 3392 unless ($Next->significant)
527 28 3364 if ($sclass and $sclass eq "PPI::Statement::Scheduled")
531 3255 109 if ($Next->isa("PPI::Token::Word"))
557 2293 42776 if ($content eq "use")
561 2290 2291 unless ($Next->significant)
568 1 2290 if ($Next->isa('PPI::Token::Operator') and $Next->content eq '=>') { }
2 2288 elsif ($Next->content eq 'v6') { }
593 1244 41532 if ($Parent->isa("PPI::Structure::Condition"))
598 8933 32599 if ($Parent->isa("PPI::Structure::List"))
603 6 32593 if ($Parent->isa("PPI::Structure::Given") or $Parent->isa("PPI::Structure::When"))
611 392 32201 if (&_INSTANCE($Token, "PPI::Token::Label"))
623 64892 3326 if ref $statement ne "PPI::Statement::Include"
625 3307 19 unless my $new_features = $statement->feature_mods
627 18 1 unless @{$self->{'features_stack'};}
640 8 68218 if ($Statement->isa("PPI::Statement::End"))
648 147601 300802 unless ($Token->significant)
656 25355 275447 if ($Token->__LEXER__closes or $Token->isa("PPI::Token::Separator"))
667 25228 250219 unless ($Statement->__LEXER__normal)
669 4549 20679 unless ($self->_continues($Statement, $Token))
677 213865 57033 unless ($Token->isa("PPI::Token::Structure"))
683 26836 30197 if ($Token->content eq ";")
702 0 11478 unless (defined $Token)
728 0 8 unless (defined $Token)
749 50 25178 if ($Statement->schildren == 1 and $Statement->schild(0)->isa("PPI::Structure::Block"))
760 0 25178 if ref !($Statement =~ /\b(?:Scheduled|Sub|Compound|Given|When|Package)$/)
772 19604 5574 unless $Statement->isa("PPI::Statement::Compound")
779 3444 2130 if ($type eq "if")
786 2380 1064 unless ($LastChild->isa("PPI::Structure::Block"))
796 73 0 if ($NextLast and $NextLast->isa("PPI::Token") and $NextLast->isa("PPI::Token::Word") and $NextLast->content eq "else")
809 303 486 if ($Token->isa("PPI::Token::Word") and $Token->content eq 'else' || $Token->content eq 'elsif')
823 370 1760 if ($type eq "label")
833 38 332 if ($Token->isa("PPI::Token::Word") and $Token->content =~ /^(?:while|until|for|foreach)$/)
842 243 89 if ($Token->isa("PPI::Token::Structure") and $Token->content eq "{")
850 384 1376 if ($LastChild->isa("PPI::Structure") and $LastChild->braces eq "()")
860 143 1233 if ($type eq "for")
862 130 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')) { }
868 21 109 if ($Token->isa("PPI::Token::Structure") and $Token->content eq "(" or $Token->isa("PPI::Token::QuoteLike::Words"))
880 0 109 if ($LastChild->isa("PPI::Token::QuoteLike::Words"))
904 6 1336 if ($LastChild->isa("PPI::Token::Word") and $LastChild->content eq "continue")
912 6 0 if ($type eq "try" and $LastChild->presumed_features->{'try'})
913 4 2 unless $LastChild->isa("PPI::Structure::Block")
916 0 2 if $NextLast and $NextLast->isa("PPI::Token") and $NextLast->isa("PPI::Token::Word") and $NextLast->content eq "catch"
922 2 0 if $Token->isa("PPI::Token::Word") and $Token->content eq "catch"
929 465 865 if ($LastChild->isa("PPI::Structure::Block"))
937 6 459 if (&_INSTANCE($part[-2], "PPI::Token::Word") and $part[-2]->content eq "continue")
949 0 865 if ($type eq "block")
954 157 708 if ($type eq "while")
960 157 0 if ($LastChild->isa("PPI::Token::Word") and $LastChild->content eq 'while' || $LastChild->content eq 'until')
975 708 0 if ($type eq "foreach")
981 210 498 if ($LastChild->isa("PPI::Token::Symbol"))
984 194 16 if $Token->isa("PPI::Token::Structure") and $Token->content eq "("
985 16 0 if $Token->isa("PPI::Token::QuoteLike::Words")
989 281 217 if ($LastChild->content eq "foreach" or $LastChild->content eq "for")
991 196 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')) { }
1013 192 25 if (($STATEMENT_CLASSES{$LastChild->content} || '') eq "PPI::Statement::Variable")
1024 25 0 if ($LastChild->isa("PPI::Token::QuoteLike::Words"))
1052 10247 1639 if (&_INSTANCE($Element, "PPI::Token::Word"))
1055 1343 8904 if $rclass
1059 195 10348 if ($Parent->isa('PPI::Statement::Compound')) { }
3 10345 elsif ($Parent->isa('PPI::Statement::Given')) { }
3 10342 elsif ($Parent->isa('PPI::Statement::When')) { }
156 10186 elsif ($Parent->isa('PPI::Statement::Sub')) { }
1060 194 1 if ($Parent->type =~ /^for(?:each)?$/)
1074 10 10177 if (&_INSTANCE($Element, "PPI::Token::Operator") and $Element->content eq "->")
1093 6536 259 if ($Element)
1094 4060 2476 if ($Element->isa("PPI::Token::Operator") and $Element->content eq "->")
1099 15 2461 if ($Element->isa("PPI::Structure::Subscript"))
1103 737 1724 if ($Element->isa("PPI::Token::Symbol") and $Element->content =~ /^(?:\$|\@)/)
1107 49 1675 if ($Element->isa("PPI::Token::Cast") and $Element->content =~ /^(?:\@|\%)/)
1109 2 19 if ($prior and $prior->isa("PPI::Token::Operator") and $prior->content eq "->")
1173 10857 659 $Element ? :
1176 10857 659 if ($Element)
1177 2116 8741 if ($content eq "->" and $Element->isa("PPI::Token::Operator"))
1182 73 8668 if ($Element->isa("PPI::Structure::Subscript"))
1186 584 8084 if ($content =~ /^(?:\$|\@)/ and $Element->isa("PPI::Token::Symbol"))
1190 337 7747 if ($Element->isa("PPI::Token::Cast") and $Element->content =~ /^(?:\@|\%|\*)/)
1192 3 241 if ($prior and $prior->isa("PPI::Token::Operator") and $prior->content eq "->")
1197 2 8079 if ($Element->isa("PPI::Structure::Block"))
1201 2 0 if (my $prior = $Parent->schild(-2))
1203 2 0 if $prior->isa("PPI::Token::Cast") and $prior_content eq '@' || $prior_content eq '$'
1212 2462 5617 if $Parent->isa("PPI::Statement::Sub")
1216 1293 4324 if $Parent->isa("PPI::Statement::Package")
1219 893 3431 if ($CURLY_CLASSES{$content})
1226 1924 2166 if ($Parent->isa("PPI::Statement::Compound"))
1232 53 2113 if ($Parent->isa("PPI::Statement::Include"))
1233 53 0 if ($Parent->schildren == 2 or $Parent->schildren == 3 and $Parent->schild(2)->isa("PPI::Token::Number"))
1244 1454 659 if $Element
1246 179 480 if ($Parent->isa("PPI::Statement") and &_INSTANCE(scalar $Parent->parent, "PPI::Structure::List"))
1255 94 85 if $function and $function->content =~ /^(?:map|grep|sort|eval|do)$/
1259 79 6 unless $function and $function->content =~ /^(?:print|say)$/
1268 212 997 unless ($Next->significant)
1274 130 867 if (++$position >= @CURLY_LOOKAHEAD_CLASSES) { }
266 601 elsif (my $class = $CURLY_LOOKAHEAD_CLASSES[$position]{$Next->content}) { }
1292 220 0 if (ref $Parent eq "PPI::Statement")
1310 50286 66311 unless ($Token->significant)
1317 37498 28813 unless ($Token->isa("PPI::Token::Structure"))
1333 481 28332 if ($Token->__LEXER__opens)
1343 28279 53 if ($Token->__LEXER__closes)
1347 27537 742 if ($Token->content eq $Structure->start->__LEXER__opposite)
1357 232 27305 if ($Structure->isa("PPI::Structure::For"))
1358 211 21 if (2 > scalar grep({$_->isa("PPI::Statement");} $Structure->children))
1386 0 1918 unless (defined $Token)
1406 597155 87431 unless shift @{$_[0]{"buffer"};}
1436 77527 285513 if (ref $Parent eq "PPI::Statement" and my $first = $Parent->schild(0))
1438 0 77527 if ($first->isa("PPI::Token::Label") and not my $second = $Parent->schild(1))
1442 0 0 if $new_class
1488 49872 11486 if (@_)
1493 29529 31829 if (@{$self->{'delayed'};})
1505 474 142 if (@_)