Branch Coverage

blib/lib/Template/Alloy/Parse.pm
Criterion Covered Total %
branch 282 348 81.0


line true false branch
141 2183 15471 $ARGS->{'auto_quote'} ? :
145 2183 15471 if ($is_aq)
146 1485 698 if ($$str_ref =~ / \G \s* $QR_COMMENTS $ARGS->{'auto_quote'} /cgx) { }
12 686 elsif ($$str_ref =~ / \G \$\{ /cgx) { }
45 641 elsif ($$str_ref =~ / \G \$ /cgx) { }
152 0 12 unless $$str_ref =~ / \G \s* $QR_COMMENTS \} /cgox
166 27 16085 if ($$str_ref =~ / \G -> \s* /cgox)
169 18 9 if ($$str_ref =~ / \G \( \s* /cgx)
171 0 18 unless $$str_ref =~ / \G \) \s* /cgx
173 0 27 unless $$str_ref =~ / \G \{ $QR_COMMENTS /cgx
192 0 16085 if ($$str_ref =~ / \G 0x ( [a-fA-F0-9]+ ) /cgx) { }
2845 13240 elsif ($$str_ref =~ / \G ( $QR_NUM ) /cgx) { }
18 13222 elsif (not $is_aq and $$str_ref =~ / \G qw ([^\w\s]) \s* /cgox) { }
6978 6244 elsif ($$str_ref =~ / \G (\w+) /cgx) { }
47 6197 elsif (not $is_aq and $$str_ref =~ m[ \G / ]cgx) { }
1400 4797 elsif ($$str_ref =~ / \G \' (.*?) (?
724 4073 elsif ($$str_ref =~ / \G \" /cgx) { }
302 3771 elsif ($$str_ref =~ / \G \$ (\w+) \b /cgx) { }
126 3645 elsif ($$str_ref =~ / \G \$\{ /cgx) { }
315 3330 elsif (not $is_aq and $$str_ref =~ / \G \[ /cgx) { }
197 3133 elsif (not $is_aq and $$str_ref =~ / \G \{ /cgx) { }
228 2905 elsif (not $is_aq and $$str_ref =~ / \G ([\$\@]?) \( /cgx) { }
207 0 18 unless $$str_ref =~ / \G (.*?) (?
218 45 3 if $self->{'NAMESPACE'} and $self->{'NAMESPACE'}{$1}
222 8 39 unless $$str_ref =~ m[ \G (.*?) (?
225 3 36 if $opts =~ /e/
226 3 33 if $opts =~ /g/
232 6 27 unless eval { do { '' =~ /$str/; 1 } }
239 25 1375 if $is_aq
248 735 129 if (length $str)
249 40 695 if (defined $pieces[-1] and not ref $pieces[-1]) { }
251 21 843 if ($item eq '\\') { }
721 122 elsif ($item eq '"') { }
16 106 elsif ($self->{'AUTO_EVAL'}) { }
252 21 0 $$str_ref =~ / \G ($QR_ESCAPES) /cgox ? :
253 21 0 if (defined $pieces[-1] and not ref $pieces[-1]) { }
258 16 0 if (defined $pieces[-1] and not ref $pieces[-1]) { }
265 42 64 if ($$str_ref =~ / \G \{ /cgx) { }
268 0 42 unless $$str_ref =~ / \G \s* $QR_COMMENTS \} /cgox
275 8 94 if (not $not and $self->{'SHOW_UNDEFINED_INTERP'})
278 106 0 if defined $ref
280 3 721 if (not @pieces) { }
51 670 elsif (@pieces == 1 and ref $pieces[0]) { }
44 626 elsif ($self->{'AUTO_EVAL'}) { }
573 53 elsif (@pieces == 1) { }
281 0 3 if $is_aq
285 12 39 if $is_aq
290 14 30 if $is_aq
293 8 565 if $is_aq
298 9 44 if $is_aq
303 203 99 if ($self->{'V1DOLLAR'}) { }
305 3 0 if $self->{'NAMESPACE'} and $self->{'NAMESPACE'}{$1}
313 0 126 unless $$str_ref =~ / \G \s* $QR_COMMENTS \} /cgox
324 3 309 unless $$str_ref =~ / \G \s* $QR_COMMENTS \] /cgox
338 0 197 unless $$str_ref =~ / \G \s* $QR_COMMENTS \} /cgox
348 0 228 unless $$str_ref =~ / \G \s* $QR_COMMENTS \) /cgox
351 3 225 if $$str_ref =~ / \G \( /cgx
355 3 222 if (not ref $var) { }
0 222 elsif (not defined $var->[0]) { }
363 90 135 if ($ctx)
370 476 2429 if $is_aq or $has_prefix
375 101 12982 if ($is_aq)
381 294 12688 if ($already_parsed_args) { }
185 12503 elsif ($$str_ref =~ / \G \( /cgox) { }
386 0 185 unless $$str_ref =~ / \G \s* $QR_COMMENTS \) /cgox
395 15 152 if ($1 eq '|' and $self->{'V2PIPE'})
400 3244 6 unless $ARGS->{'no_dots'}
405 54 3196 if ($$str_ref =~ / \G \$ (\w+) \b /cgox) { }
29 3167 elsif ($$str_ref =~ / \G \$\{ /cgx) { }
3167 0 elsif ($$str_ref =~ / \G (-? \w+) /cgx) { }
406 6 48 $self->{'V1DOLLAR'} ? :
411 0 29 unless $$str_ref =~ / \G \s* $QR_COMMENTS \} /cgox
423 713 2537 if ($$str_ref =~ / \G \( /cgx) { }
426 0 698 unless $$str_ref =~ / \G \s* $QR_COMMENTS \) /cgox
437 4776 8191 if ($is_literal) { }
48 8143 elsif ($is_namespace) { }
439 114 4662 if ($#var != 1)
452 11586 1381 unless ($self->{'_operator_precedence'})
460 5849 6821 if ($self->{'_end_tag'} and $$str_ref =~ / \G [+=~-]? $self->{'_end_tag'} /cgx) { }
3774 3047 elsif (not $$str_ref =~ / \G ($Template::Alloy::Parse::QR_OP) /cgox) { }
467 1955 1092 if ($Template::Alloy::Parse::OP_ASSIGN->{$1} and not $ARGS->{'allow_parened_ops'})
473 18 18 if $op eq '==' and !defined($self->{'V2EQUALS'}) || $self->{'V2EQUALS'}
474 6 3 if $op eq '!=' and !defined($self->{'V2EQUALS'}) || $self->{'V2EQUALS'}
477 9 1083 if ($Template::Alloy::Parse::OP_POSTFIX->{$op}) { }
9 2148 elsif ($has_prefix and $Template::Alloy::Parse::OP->{$op}[1] < $$Template::Alloy::Parse::OP_PREFIX{$has_prefix->[-1]}[1]) { }
483 0 9 if ($tree)
484 0 0 if ($#$tree == 1) { }
495 9 0 unless @$has_prefix
500 6 1075 unless defined $var2
506 863 10715 if ($tree)
507 744 119 if (@$tree == 2) { }
508 30 714 if ($$Template::Alloy::Parse::OP{$tree->[0]}[0] eq 'assign' and $tree->[0] =~ /(.+)=/) { }
521 89 12870 if ($has_prefix)
544 93 290 unless $$ops{$tree->[$i]}
550 0 146 unless @exprs
551 146 0 if scalar @$tree
555 370 66 if (@$node == 1) { }
39 27 elsif (@$node == 3) { }
572 72 74 if ($type eq 'ternary') { }
27 47 elsif ($type eq 'right' or $type eq 'assign') { }
576 57 15 if (@exprs == 3)
577 0 57 if $ops[0] ne $op
578 0 57 if not $ops[1] or $ops[1] eq $op
587 30 30 if $$Template::Alloy::Parse::OP{$ops[$i]}[2][1] eq $ops[$i]
598 9 30 if ($type eq 'assign' and $ops[$_ - 1] =~ /(.+)=$/) { }
631 6 310 $self->{'ANYCASE'} ? :
26 290 if (not $ARGS->{'is_parened'} || $ARGS->{'require_arg'} and $$str_ref =~ / \G \s* $QR_COMMENTS $QR_DIRECTIVE (?: \s+ | (?: \s* $QR_COMMENTS (?: ;|[+=~-]?$end))) /cgox and (pos $$str_ref = $mark) || 1 and $$DIRECTIVES{$self->{'ANYCASE'} ? uc $1 : $1})
639 645 4008 if ($$str_ref =~ / \G [+=~-]? $end /cgx)
646 755 3253 if ($ARGS->{'allow_bare_filenames'})
655 6 749 if ($$str_ref =~ / \G \+ (?! \s* $QR_COMMENTS [+=~-]? $end) /cgox)
661 3450 552 unless (defined $name)
663 1467 1968 unless (defined $name)
664 0 1467 if ($ARGS->{'require_arg'} and not @args and not $ARGS->{'positional_only'} and not @named) { }
675 597 1923 if ($$str_ref =~ / \G \s* $QR_COMMENTS = >? /cgox) { }
676 0 597 if $ARGS->{'positional_only'}
678 591 6 if ref $name and @$name == 2 and not $name->[1]
689 1178 960 if ($ARGS->{'named_at_front'}) { }
82 878 elsif (scalar @named) { }
712 68 391 unless defined $block_name
714 44 0 if ref $_
0 391 unless $self->{'_state'}
715 6 385 $prepend ? :
722 3 27 if $$str_ref =~ / \G DEFAULT \s* /cgx
743 52 57 if ($ctime{$key}) { }
3 54 elsif (not $rtime{$key}) { }
745 7 45 if ($key eq 'INTERPOLATE')
746 0 7 !$self->{'INTERPOLATE'} ? :
754 12 3 if ($ctime{$key}) { }
0 3 elsif (not $rtime{$key}) { }
755 6 6 defined $self->{$key} ? :
765 0 3 unless $$str_ref =~ / \G ([Oo][Nn] | [Oo][Ff][Ff] | [Ff][Oo][Rr][Mm][Aa][Tt]) \s* /cgx
768 3 0 if ($ret->[0] eq 'format')
769 0 3 unless $$str_ref =~ / \G ([\"\']) (|.*?[^\\]) \1 \s* /cgsx
791 18 56 if ($$str_ref =~ / \G ([^\W\d]\w*) \s* = \s* /cgx)
796 0 74 unless defined $filter
805 184 69 if ($$str_ref =~ / \G \s* $QR_COMMENTS (= | [Ii][Nn]\b) \s* /cgox)
815 17 368 unless defined $ref
816 13 355 if ($self->{'AUTO_FILTER'})
817 3 10 unless ref $ref
818 8 5 if @$ref < 3 or $ref->[-3] ne '|'
842 0 86 unless defined $name
843 86 0 unless (ref $name)
848 47 39 if ($$str_ref =~ / \G \( \s* /cgx) { }
24 15 elsif ($self->{'V1DOLLAR'}) { }
850 0 47 unless $$str_ref =~ / \G \) \s* /cgx
855 0 22 unless (defined $arg)
871 136 0 if $hash = $self->play_expr($args->[0]) and UNIVERSAL::isa($hash, 'HASH')
896 804 416 if ($initial_op)
897 0 140 $self->{'ANYCASE'} ? :
75 729 if ($initial_op eq '=' and $$str_ref =~ / \G \s* $QR_COMMENTS $QR_DIRECTIVE /cgx and (pos $$str_ref -= length $1) || 1 and $$DIRECTIVES{$self->{'ANYCASE'} ? uc $1 : $1}) { }
906 33 696 if ($initial_op =~ /(.+)=$/)
916 403 426 unless defined $set
918 399 27 if ($$str_ref =~ / \G \s* $QR_COMMENTS ($Template::Alloy::Parse::QR_OP_ASSIGN) >? /cgx) { }
920 2 11 $self->{'ANYCASE'} ? :
7 392 if ($op eq '=' and $$str_ref =~ / \G \s* $QR_COMMENTS $QR_DIRECTIVE /cgx and (pos $$str_ref -= length $1) || 1 and $$DIRECTIVES{$self->{'ANYCASE'} ? uc $1 : $1}) { }
926 0 7 if ($op =~ /(.+)=$/)
949 57 21 if ($$str_ref =~ / \G (\w+) /cgsx) { }
955 12 9 $$str_ref =~ m[ \G (?= \s* $QR_COMMENTS [\'\"\/]) ]cgx ? :
959 9 9 $$str_ref =~ m[ \G (?= \s* $QR_COMMENTS [\'\"\/]) ]cgx ? :
965 30 6 unless ref $tag
974 0 109 unless $name
989 7 91 if (defined(my $_var = $self->parse_expr($str_ref, {'auto_quote', "(\\w+\\b) (?! \\.) \\s* $QR_COMMENTS"})) and $$str_ref =~ / \G = >? \s* $QR_COMMENTS /cgox || (pos $$str_ref = $mark) && 0)
997 0 101 unless defined $module
1004 64 37 if ($open)
1005 0 64 unless $$str_ref =~ / \G \) \s* $QR_COMMENTS /cgox
1030 0 0 unless ref $self
1032 0 0 ref $str ? :
1039 0 0 unless (ref $node and $node->[4] || $node->[5])
1051 0 0 if ($node->[4])
1055 0 0 if ($node->[5]) { }
0 0 elsif (@$node >= 6) { }
1060 0 0 if (@$node >= 7)
1070 0 0 unless ref $self
1072 0 0 ref $str ? :