Branch Coverage

blib/lib/Text/Balanced.pm
Criterion Covered Total %
branch 290 340 85.2


line true false branch
69 7 883 if $message
70 870 20 if $wantarray
77 101 405 @_ > 18 ? :
82 289 217 if ($wantarray) { }
87 13 276 if ($extralen) { }
100 11 206 if $extralen
101 11 206 $extralen ? :
115 0 59 unless $dels =~ /\S/
116 9 50 unless $escs
124 24 137 if ($del eq $esc) { }
143 50 0 defined $_[0] ? :
144 46 4 unless pos $$textref
146 30 20 defined $_[1] ? :
147 8 42 defined $_[2] ? :
148 16 34 defined $_[3] ? :
151 7 43 unless $$textref =~ /\G($pre)($pat)/cg
165 45 6 if $eb_delim_cache{$ldel_orig}
169 0 6 if $ldel =~ s/'//g
170 3 3 if $ldel =~ s/"//g
171 2 4 if $ldel =~ s/`//g
172 1 5 if $ldel =~ s/q//g
175 0 6 unless $rdel =~ tr/(<[{/)>]}/
186 51 0 defined $_[0] ? :
187 20 31 unless pos $$textref
188 14 37 defined $_[1] ? :
189 0 51 defined $_[2] ? :
192 0 51 unless (@ret)
202 33 18 unless @match
215 0 93 unless ($$textref =~ /$pre/cg)
223 31 62 unless ($$textref =~ /$ldel/cg)
235 8 628 if $$textref =~ /\G\\./cgs
237 18 610 if ($$textref =~ /$ldel/cg) { }
78 532 elsif ($$textref =~ /$rdel/cg) { }
10 522 elsif ($qdel and $$textref =~ /$qdel/cg) { }
4 518 elsif ($quotelike and _match_quotelike($textref, qr/\G()/, $ref2slashvalid{$textref}, $ref2qmarkvalid{$textref})) { }
244 0 78 if ($#nesting < 0)
253 0 78 if ($expected ne $brackettype)
260 60 18 if $#nesting < 0
264 10 0 if $$textref =~ /\G[^\\$1]*(?:\\.[^\\$1]*)*(\Q$1\E)/cgs
278 2 60 if ($#nesting >= 0)
310 48 0 defined $_[0] ? :
311 48 0 unless pos $$textref
314 12 36 defined $_[3] ? :
315 16 32 defined $_[4] ? :
316 4 44 defined $options{'fail'} ? :
319 0 42 defined $options{'reject'} ? :
6 42 ref $options{'reject'} eq 'ARRAY' ? :
323 0 38 defined $options{'ignore'} ? :
10 38 ref $options{'ignore'} eq 'ARRAY' ? :
326 18 30 unless defined $ldel
331 14 34 unless @match
344 0 120 unless ($$textref =~ /$pre/cg)
352 8 112 unless ($$textref =~ /\G$ldel/cg)
360 70 42 if (not defined $rdel) { }
363 0 70 unless ($rdelspec =~ s#\A([[(<{]+)($XMLNAME).*#quotemeta "$1/$2" . &_revbracket($1);#eos)
387 0 1240 if $$textref =~ /\G\\./cg
389 0 1240 if ($$textref =~ /\G(\n[ \t]*\n)/cg) { }
82 1158 elsif ($$textref =~ /\G($rdelspec)/cg) { }
12 1146 elsif ($ignore and $$textref =~ /\G(?:$ignore)/cg) { }
12 1134 elsif ($bad and $$textref =~ /\G($bad)/cgs) { }
32 1102 elsif ($$textref =~ /\G($ldel)/cg) { }
391 0 0 unless defined $parapos
406 8 4 if $omode eq "PARA" or $omode eq "MAX"
414 4 28 unless (_match_tagged(@_))
416 0 4 if $omode eq "PARA" or $omode eq "MAX"
427 4 18 if $omode eq "MAX"
428 14 4 unless $omode eq "PARA"
430 0 4 if (defined $parapos) { }
451 14 16 unless $@
459 597 0 defined $_[0] ? :
460 0 597 unless defined $$textref
461 206 391 unless pos $$textref
462 60 537 defined $_[1] ? :
466 365 232 unless @match
479 339 960 unless ($$textref =~ /$pre/cg)
485 868 92 unless ($$textref =~ m[\G\$\s*(?!::)(\d+|[][&`'+*./|,";%=~:?!\@<>()-]|\^[a-z]?)]cig)
487 617 251 unless ($$textref =~ /\G((\$#?|[*\@\%]|\\&)+)/cg)
495 0 5 unless ($$textref =~ /\G\s*(?:::|')?(?:[_a-z]\w*(?:::|'))*[_a-z]\w*/cig or _match_codeblock($textref, qr/\G()/, "\\{", qr/\G\s*(\})/, "\\{", "\\}", 0) or $deref eq "\$#" or $deref eq "\$\$" or pos $$textref == length $$textref)
508 27 394 if $$textref =~ /\G\s*(?:->)?\s*[{]\w+[}]/cg
509 23 371 if _match_codeblock($textref, qr/\G\s*->\s*(?:[_a-zA-Z]\w+\s*)?/, qr/[({[]/, qr/\G\s*([)}\]])/, qr/[({[]/, qr/[)}\]]/, 0)
513 16 355 if _match_codeblock($textref, qr/\G\s*/, qr/[{[]/, qr/\G\s*([}\]])/, qr/[{[]/, qr/[}\]]/, 0)
516 0 355 if _match_variable($textref, qr/\G\s*->\s*/)
517 12 343 if $$textref =~ /\G\s*->\s*\w+(?![{([])/cg
533 0 95 if $ec_delim_cache{$ldel_outer}{$ldel_inner}
550 95 0 defined $_[0] ? :
551 50 45 unless pos $$textref
553 77 18 defined $_[1] ? :
554 48 47 !defined($_[2]) ? :
555 4 91 defined $_[3] ? :
560 45 50 unless @match
570 355 670 unless ($$textref =~ /$pre/cg)
579 539 131 unless ($$textref =~ /\G($ldel_outer)/cg)
592 0 131 unless pos $$textref and defined $ref2slashvalid{$textref}
595 0 480 if ($rd and $$textref =~ /\G(\(\?\)|\(s\?\)|\(s\))/cg)
601 6 474 if ($$textref =~ /\G\s*#.*/cg)
606 127 347 if ($$textref =~ /$rdel_outer/cg)
608 2 125 unless ($matched = $closing && $1 eq $closing)
610 2 0 if $1 eq ">"
619 137 210 if (_match_variable($textref, qr/\G\s*/) or _match_quotelike($textref, qr/\G\s*/, $ref2slashvalid{$textref}, $ref2qmarkvalid{$textref}))
626 72 138 if ($$textref =~ /\G\s*(?!$ldel_inner)(?:$RE_PREREGEX_PAT|$RE_EXPR_PAT)/cg)
632 15 123 if (_match_codeblock($textref, qr/\G\s*/, $ldel_inner, qr/\G\s*($rdel_inner)/, $ldel_inner, $rdel_inner, $rd))
638 0 123 if ($$textref =~ /\G\s*$ldel_outer/cg)
652 6 125 unless ($matched)
654 6 0 unless $@
682 514 1 $_[0] ? :
683 105 410 unless pos $$textref
685 46 469 defined $_[1] ? :
688 414 101 unless @match
703 105 700 unless pos $$textref and defined $ref2slashvalid{$textref}
710 0 805 unless ($$textref =~ /$pre/cg)
720 17 747 if ($initial and $maybe_quote{$initial} or $allow_slash_match and $initial eq "/" or $allow_qmark_match and $initial eq "?")
724 2 56 unless ($$textref =~ /\G \Q$initial\E [^\\$initial]* (\\.[^\\$initial]*)* \Q$initial\E /cgsx)
736 15 41 if ($initial eq "/" or $initial eq "?")
757 665 82 unless ($$textref =~ /\G(\b(?:m|s|qq|qx|qw|q|qr|tr|y)\b(?=\s*\S)|<<(?=[a-zA-Z]|\s*['"`;,]))/cg)
769 28 54 if ($op eq "<<")
772 9 19 if ($$textref =~ /\G([A-Za-z_]\w*)/cg) { }
16 3 elsif ($$textref =~ / \G ' ([^'\\]* (?:\\.[^'\\]*)*) ' | \G " ([^"\\]* (?:\\.[^"\\]*)*) " | \G ` ([^`\\]* (?:\\.[^`\\]*)*) ` /cgsx) { }
787 4 24 unless ($$textref =~ /.*?\n(?=\Q$label\E\n)/cg)
818 0 54 if (not $$textref =~ /\G(\S)/cg) { }
1 53 elsif (substr($$textref, $ld1pos, 2) eq '=>') { }
834 33 20 if ($ldel1 =~ /[[(<{]/) { }
838 0 33 unless (defined _match_bracketed($textref, qr/\G/, qr/\G($ldel1)/, "", "", qr/\G($rdel1)/))
845 0 20 unless ($$textref =~ /\G${ldel1}[^\\$ldel1]*(\\.[^\\$ldel1]*)*$ldel1/cgs)
849 23 30 $op =~ /s|tr|y/ ? :
850 23 30 if ($second_arg) { }
853 11 12 if ($ldel1 =~ /[[(<{]/) { }
855 0 11 unless ($$textref =~ /\G\s*(\S)/cg)
871 9 14 if ($ldel2 =~ /[[(<{]/) { }
875 0 9 unless (defined _match_bracketed($textref, qr/\G/, qr/\G($ldel2)/, "", "", qr/\G($rdel2)/))
880 0 14 unless ($$textref =~ /[^\\$ldel2]*(\\.[^\\$ldel2]*)*$ldel2/cgs)
918 25 538 if ($ref2slashvalid{$textref} and $text =~ /(?:$RE_NUM|[\)\]])\s*$/) { }
1 537 elsif (not $ref2slashvalid{$textref} and $text =~ /$RE_PREREGEX_PAT\s*$/) { }
45 695 elsif (not $ref2slashvalid{$textref} and $text =~ /$RE_EXPR_PAT\s*$/) { }
932 33 7 defined $_[0] ? :
933 40 0 unless pos $$textref
940 28 12 defined $_[1] ? :
941 14 26 defined $_[2] && $_[2] > 0 ? :
946 14 26 unless (wantarray)
949 0 0 if $^W and defined $_[2] and $max > 1
958 2 77 if ref $func eq "HASH"
959 10 69 unless $ref_not_regex{ref $func}
970 923 159 if (ref $func eq 'CODE') { }
0 159 elsif (ref $func eq 'Text::Balanced::Extractor') { }
33 126 elsif ($$textref =~ /$func[$i]/cg) { }
975 6 27 defined $1 ? :
980 105 977 if (defined $field and length $field)
982 98 7 unless ($igunk)
983 4 94 if length $pref and not defined $unkpos
985 70 28 if (defined $unkpos)
988 8 62 unless defined $firstpos
990 3 67 if @fields == $max
993 0 102 $class ? :
995 31 71 unless defined $firstpos
997 15 87 if @fields == $max
1001 461 0 if ($$textref =~ /\G(.)/cgs)
1003 83 378 unless $igunk or defined $unkpos
1009 17 23 if (defined $unkpos)
1012 1 16 unless defined $firstpos
1019 26 14 if wantarray
1031 4 9 defined $_[2] ? :
1032 6 7 defined $_[3] ? :
1033 2 11 defined $options{'fail'} ? :
1036 0 10 defined $options{'reject'} ? :
3 10 ref $options{'reject'} eq 'ARRAY' ? :
1040 0 10 defined $options{'ignore'} ? :
3 10 ref $options{'ignore'} eq 'ARRAY' ? :
1043 2 11 unless defined $ldel
1046 19 20 if $_
1051 40 0 defined $_[0] ? :
1054 12 28 unless @match