Branch Coverage

blib/lib/Text/Xslate/Parser.pm
Criterion Covered Total %
branch 217 248 87.5


line true false branch
221 3409 3 if (my $input_pos = pos $parser->{'input'})
222 2 3407 if ($input_pos != length $parser->{'input'})
246 391 9988 if ($i >= 1 and ($p = $$tokens_ref[$i - 1])->[0] eq 'postchomp')
252 386 5 if ($1)
258 51 10328 if ($i + 1 < @{$tokens_ref;} and ($p = $$tokens_ref[$i + 1])->[0] eq 'prechomp') { }
16 10312 elsif ($i + 2 < @{$tokens_ref;} and ($p = $$tokens_ref[$i + 2])->[0] eq 'prechomp' and ($p = $$tokens_ref[$i + 1])->[0] eq 'text' and not $p->[1] =~ / [^ \t] /msx) { }
260 34 17 if (not ${$s_ref;} =~ / [^ \t] /msx) { }
315 2653 15595 if ($in_tag) { }
2554 13041 elsif ($lex_line_code and @tokens == 0 || $tokens[-1][1] =~ /\n\z/msx and s/$lex_line_code//msx) { }
2654 10387 elsif (s/$lex_tag_start//msx) { }
10387 0 elsif (s/$lex_text//msx) { }
321 2649 3 if (length $code == 0)
327 2649 4 if ($pos >= 0) { }
332 0 2649 unless s/\A \Q$tag_end\E //msx
335 393 2256 if ($chomp)
354 60 2594 if ($chomp)
366 5 3454 if ($in_tag)
394 10379 5655 if ($type eq 'text') { }
5202 453 elsif ($type eq 'code') { }
60 393 elsif ($type eq 'prechomp') { }
393 0 elsif ($type eq 'postchomp') { }
403 8838 1541 if $nl > 0
407 5202 0 if $shortcut
412 546 4656 if ($s =~ /\A \s* [}] \s* \z/msx) { }
2028 2628 elsif ($s =~ s/\n\z//msx) { }
630 25242 27715 if (defined $s) { }
631 1205 24037 if (defined $lbp)
664 46 64606 if (/\G $comment_rx /cgmsx) { }
19450 45156 elsif (/\G ($id_rx)/cgmsx) { }
17593 27563 elsif (/\G ($Text::Xslate::Parser::NUMBER | $Text::Xslate::Parser::STRING)/cgmosx) { }
24146 3417 elsif (/\G ($OPERATOR_TOKEN)/cgmosx) { }
0 3417 elsif (/\G (\S+)/cgmsx) { }
695 7 64570 if (defined $expect and $t->id ne $expect)
705 3418 61152 if ($t->[0] eq 'special')
714 63 61089 if ($arity eq 'name' and $parser->next_token_is('=>'))
721 17655 43497 if ($arity eq 'literal') { }
24117 19380 elsif ($arity eq 'operator') { }
729 3 24114 unless (defined $symbol)
813 17276 248 if ($parser->token->is_value)
817 12214 5310 unless ($parser->token->is_comma)
902 409 38 if ($arity eq 'name') { }
9 29 elsif ($arity eq 'literal') { }
915 0 447 unless ($parser->is_valid_field($t))
926 230 217 if ($t->id eq '(')
950 4 189 unless (ref $function)
1017 482 241 defined $value ? :
1040 2845 771 if ($name =~ /\A \$/msx) { }
1057 6016 16616 if (defined $s)
1062 9343 4080 defined $s ? :
1067 13246 571 if ($symbol->arity ne 'name' or $symbol->is_reserved)
1073 0 571 if ($t)
1074 0 0 if ($t->is_reserved)
1077 0 0 if ($t->arity eq 'name')
1092 1 594 if (defined $t)
1093 0 1 $t->is_reserved ? :
1119 109 885 unless (ref $symbol)
1123 0 994 unless (ref $lhs)
1129 39 955 unless (ref $rhs)
1157 30 14036 if ($t->can_be_modifier)
1163 1445 12621 if ($t->is_block_end or $parser->statement_is_finished) { }
12617 4 elsif ($t->id eq ';') { }
1179 448 14881 if ($t->id eq ';')
1184 13655 1226 if ($t->has_std)
1198 81 1119 if ($expr->is_statement) { }
1254 51 4 if ($parser->token->id eq '.')
1258 0 51 unless (any_in($t->arity, ('variable', 'name')))
1263 0 51 unless ($generator)
1270 15 36 if ($parser->token->id eq '(')
1286 33 0 $symbol->id eq 'my' ? :
37 33 $symbol->id eq 'constant' ? :
1290 0 70 if ($t->arity ne $expect)
1329 39 0 if ($parser->token->id ne '{')
1332 0 39 if $paren
1340 15 39 if ($t->id eq ',') { }
1348 0 39 if $paren
1366 1 0 ref $file ? :
1402 416 20 if ($parser->token->id eq '->')
1404 225 191 if ($parser->token->id ne '{')
1407 106 119 if $paren
1414 149 82 if ($in_for)
1420 7 224 if ($t->id eq ',') { }
1428 106 119 if $paren
1468 5 134 if ($parser->token eq 'else')
1495 0 150 if ($name->arity ne 'name')
1514 0 92 if ($name->arity ne 'name')
1524 0 11 if ($t->arity ne 'name')
1531 2 9 if ($t->id eq '(')
1537 2 9 $args ? :
1546 9 83 if (@filters)
1568 13 99 if (defined $expr)
1590 56 42 if ($t->id eq 'else')
1594 11 45 $t->id eq 'if' ? :
1610 14 16 unless (defined $given->second and @{$given->second;})
1624 0 60 unless ($parser->in_given)
1628 31 29 if ($symbol->id eq 'when')
1650 22 79 if ($when->arity ne $expect)
1652 21 1 if ($when->id eq 'print_raw' and not grep({not _only_white_spaces($_);} @{$when->first;}))
1660 43 36 if (defined(my $test = $when->first)) { }
1661 31 12 unless ($test->is_logical)
1671 35 8 if (not defined $if) { }
1680 36 3 if (defined $else)
1681 33 3 if (defined $elsif) { }
1688 38 1 defined $if ? :
1708 11518 0 if ($parser->token->id ne ';')
1723 1264 69 if ($t->arity ne 'name' or $t->is_defined)
1736 52 69 if ($t->id eq '::') { }
1739 0 52 if ($t->arity ne 'name')
1756 13 1286 if ($parser->token->id eq '{')
1771 57 7 if ($parser->token->id ne 'with')
1776 11 53 if ($parser->token->id eq 'with')
1824 1 15 if @args != 0
1831 1 9 if @args != 0
1838 1 6 if @args != 0
1845 1 3 if @args != 0
1852 0 16 if @args != 0
1861 1 2 if @args != 0
1868 1 7 if @args != 0
1887 0 3 if @args != 0
1893 2 3 if @args != 0
1905 0 6 if @args < 2
1955 0 3260 if (exists $parser->symbol_table->{$to})
1974 12 1 if (defined $got and $got ne ';') { }
1975 2 10 if ($got eq '(end)') { }
1991 39 10 if ($near ne ';' and not $message =~ /\b \Q$near\E \b/msx)