Branch Coverage

blib/lib/LaTeX/TOM/Parser.pm
Criterion Covered Total %
branch 148 226 65.4


line true false branch
68 28 23 if defined $opt
131 2 17 if $parser->{'applymappings'}
155 19 0 unless (exists $parser->{'MAPPEDCMDS'}{'\\['})
178 8 0 defined $_[0] ? :
179 2 6 defined $_[1] ? :
215 27 119 unless (defined $bracehash)
229 145 119 $i == $startidx ? :
231 264 0 if ($node->{'type'} eq "TEXT")
241 122 122 if ($brace eq '{') { }
122 0 elsif ($brace eq '}') { }
243 119 3 if ($leftcount == 0)
258 119 3 if ($leftcount == 0)
262 119 0 if ($leftidx == $i) { }
338 0 3 if ($leftcount < 0)
354 0 146 if ($leftcount > 0)
379 266 119 if ($node->{'type'} eq "TEXT")
387 2 3 if ($text =~ /^\s*\\(\w+\*?)/ and defined $parent and $parser->{'config'}{'INNERCMDS'}{$1})
393 0 2 if ($parent->{'type'} eq 'COMMAND') { }
2 0 elsif ($parent->{'type'} eq 'GROUP') { }
434 112 1 if ($text =~ /(?:^|[^\\])(\\\w+\*?(\s*\[.*?\])?)\s*$/so and defined $tree->{'nodes'}[$i + 1] and $tree->{'nodes'}[$i + 1]{'type'} eq "GROUP")
464 2 264 if ($text =~ /(\\(\w+\*?)[ \t]+(\S+))/sog or $text =~ /(\\(\w+)(\d+))/sog)
469 0 2 if ($parser->{'config'}{'BRACELESS'}{$command})
514 119 266 if ($node->{'type'} eq "GROUP" or $node->{'type'} eq "COMMAND")
546 32 428 if ($node->{'type'} eq 'COMMAND' and $node->{'command'} eq 'begin') { }
27 401 elsif ($node->{'type'} eq 'COMMAND' and $node->{'command'} eq 'end' and $node->{'children'}{'nodes'}[0]{'content'} eq $class) { }
90 311 elsif ($node->{'children'}) { }
551 28 4 if ($bcount == 0) { }
0 4 elsif ($node->{'children'}{'nodes'}[0]{'content'} eq $class) { }
576 27 0 if ($bcount == 0)
597 0 27 if ($parser->{'config'}{'MATHENVS'}{$envnode->{'class'}})
622 1 143 if ($bcount > 0)
672 1114 452 if ($node->{'type'} eq 'TEXT' and !$caremath || !$node->{'math'} && $caremath) { }
414 38 elsif ($node->{'children'} and not $node->{'type'} eq 'COMMAND' && $node->{'command'} =~ /^verb/ || $node->{'type'} eq 'ENVIRONMENT' && $node->{'class'} =~ /^verbatim/) { }
676 1114 0 if ($leftidx == -1)
679 0 1114 if ($leftpos != -1)
687 0 1114 if ($leftpos != -1) { }
691 0 0 if ($rightpos != -1)
694 0 0 if ($leftidx == $i) { }
769 0 1114 if ($rightpos != -1)
783 0 414 if ($LaTeX::TOM::DEBUG)
785 0 0 if $node->{'type'} eq "COMMAND"
786 0 0 if $node->{'type'} eq "ENVIRONMENT"
795 0 554 if ($leftpos != -1)
818 384 152 if ($node->{'type'} eq 'TEXT') { }
152 0 elsif (defined $node->{'children'}) { }
832 148 4 if ($node->{'type'} eq 'ENVIRONMENT' or $node->{'type'} eq 'COMMAND') { }
4 0 elsif ($node->{'type'} eq 'GROUP') { }
833 0 148 if (defined $node->{'class'} and $parser->{'config'}{'MATHENVS'}{$node->{'class'}} || $parser->{'config'}{'MATHENVS'}{"$node->{'class'}*"}) { }
54 68 elsif ($node->{'type'} eq 'COMMAND' and $parser->{'config'}{'TEXTENVS'}{$node->{'command'}} || $parser->{'config'}{'TEXTENVS'}{"$node->{'command'}*"} or $node->{'type'} eq 'ENVIRONMENT' and $parser->{'config'}{'TEXTENVS'}{$node->{'class'}} || $parser->{'config'}{'TEXTENVS'}{"$node->{'command'}*"}) { }
901 1 41 if ($node->{'type'} eq 'COMMAND' and $node->{'command'} eq 'begin' and $node->{'children'}{'nodes'}[0]{'content'} eq $mapping->{'name'}) { }
1 40 elsif ($node->{'type'} eq 'COMMAND' and $node->{'command'} eq 'end' and $node->{'children'}{'nodes'}[0]{'content'} eq $mapping->{'name'}) { }
1 39 elsif ($node->{'type'} eq 'COMMAND' and $node->{'command'} eq $mapping->{'name'} and $mapping->{'nparams'}) { }
15 24 elsif ($node->{'type'} eq 'TEXT' and not $mapping->{'nparams'}) { }
10 14 elsif ($node->{'children'}) { }
916 0 0 if ($node->{'type'} eq "GROUP")
925 0 1 if $remain
974 0 0 if ($node->{'type'} eq "GROUP")
983 0 1 if $remain > 0
1005 15 0 $command =~ /\w$/ ? :
1058 1 48 if ($node->{'type'} eq 'COMMAND' and $node->{'command'} =~ /^(re)?newcommand$/) { }
1 47 elsif ($node->{'type'} eq 'COMMAND' and $node->{'command'} =~ /^(re)?newenvironment$/) { }
0 47 elsif ($node->{'type'} eq 'COMMAND' and defined $prev and $prev->{'type'} eq 'TEXT' and $prev->{'content'} =~ /\\def\s*$/o) { }
12 35 elsif ($node->{'children'}) { }
1062 0 1 unless $mapping->{'name'}
1064 1 0 if ($parser->{'USED_COMMANDS'}{$mapping->{'name'}}) { }
1084 1 0 if ($count > 0)
1098 0 1 unless $mapping->{'name'}
1128 0 0 unless $mapping->{'name'}
1130 0 0 if ($parser->{'USED_COMMANDS'}{$mapping->{'name'}}) { }
1173 7 230 if ($node->{'type'} eq 'COMMAND' and $node->{'command'} eq 'input') { }
1 401 elsif ($node->{'type'} eq 'COMMAND' and $node->{'command'} eq 'bibliography') { }
1177 1 6 if $file =~ /pstex/
1186 5 1 if (-e $file and $filename =~ /$has_extension/) { }
1 0 elsif (not $filename =~ /$has_extension/) { }
1191 1 0 if -e $file
1197 1 5 if (defined $contents and $contents =~ m[^ \% \s*? Psfig/TeX \s* $]mx)
1206 5 1 if (defined $contents)
1226 1 0 if (defined $contents)
1236 71 165 if ($node->{'children'})
1253 18 9 if $parser->{'readinputs'}
1294 0 0 if ($idx != -1)
1297 0 0 if ($prevchar eq "\\")
1317 0 389 if ($symbol eq "}" and $index - 1 >= 0 and substr($text, $index - 1, 1) eq " ")
1322 460 2546 if ($index != -1)
1326 455 5 $index - 1 >= 0 ? :
1327 455 5 $index - 2 >= 0 ? :
1329 0 460 if ($prev_char eq "\\" and $pprev_char ne "\\")
1354 145 244 if ($index_o == -1 and $index_c == -1) { }
122 122 elsif ($index_c == -1 or $index_o != -1 and $index_o < $index_c) { }
122 0 elsif ($index_o == -1 or $index_c < $index_o) { }
1388 2 0 if ($node->{'type'} eq "GROUP" or $node->{'type'} eq "COMMAND" and $node->{'position'} eq "inner")
1402 2 0 if ($node->{'type'} eq 'GROUP') { }
0 0 elsif ($node->{'type'} eq 'COMMAND') { }
1423 0 2 if ($node->{'type'} ne "COMMAND" or $node->{'command'} ne "new$type" and $node->{'command'} ne "renew$type")
1432 1 1 if ($command =~ /^\s* \\(\S+) \s*$/x)
1440 2 0 if ($node->{'type'} eq "TEXT")
1443 1 1 if ($text =~ /^\s* \[\s* ([0-9]+) \s*\] \s*$/x)
1465 0 1 unless my($command, $nparams) = _getMapping("environment", $tree, \$i)
1480 1 0 if (_validParamNode($node))
1487 1 0 if (_validParamNode($node))
1517 0 1 unless my($command, $nparams) = _getMapping("command", $tree, \$i)
1524 1 0 if ($node->{'type'} eq 'GROUP') { }
1572 7 2 if ($node->{'type'} eq 'TEXT') { }
2 0 elsif (defined $node->{'children'}) { }
1578 1 6 if ($text =~ /(#([0-9]+))/)
1653 0 26 $line =~ /^\s*\%/ && !($node_text =~ / \\begin\{verbatim\} .* \Q$line\E .* \\end\{verbatim\} /sx) ? :
1663 26 0 if ($first or $line_type eq $mode_type) { }
1684 26 1 if defined $output
1698 0 16 unless ($opened)
1699 0 0 if $raise_error
1714 920 0 unless $DEBUG >= 1 and $DEBUG <= 2
1719 0 0 if $DEBUG >= 1 and defined $message
1720 0 0 if $DEBUG == 2 and defined $code