Branch Coverage

blib/lib/Text/Balanced.pm
Criterion Covered Total %
branch 293 342 85.6


line true false branch
70 7 934 if $message
71 921 20 if $wantarray
78 103 408 @_ > 18 ? :
83 294 217 if ($wantarray) { }
88 13 281 if ($extralen) { }
101 11 206 if $extralen
102 11 206 $extralen ? :
116 0 59 unless $dels =~ /\S/
117 9 50 unless $escs
125 24 137 if ($del eq $esc) { }
144 50 0 defined $_[0] ? :
145 46 4 unless pos $$textref
147 30 20 defined $_[1] ? :
148 8 42 defined $_[2] ? :
149 16 34 defined $_[3] ? :
152 7 43 unless $$textref =~ /\G($pre)($pat)/cg
166 45 6 if $eb_delim_cache{$ldel_orig}
170 0 6 if $ldel =~ s/'//g
171 3 3 if $ldel =~ s/"//g
172 2 4 if $ldel =~ s/`//g
173 1 5 if $ldel =~ s/q//g
176 0 6 unless $rdel =~ tr/(<[{/)>]}/
187 51 0 defined $_[0] ? :
188 20 31 unless pos $$textref
189 14 37 defined $_[1] ? :
190 0 51 defined $_[2] ? :
193 0 51 unless (@ret)
203 33 18 unless @match
216 0 93 unless ($$textref =~ /$pre/cg)
224 31 62 unless ($$textref =~ /$ldel/cg)
236 8 628 if $$textref =~ /\G\\./cgs
238 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})) { }
245 0 78 if ($#nesting < 0)
254 0 78 if ($expected ne $brackettype)
261 60 18 if $#nesting < 0
265 10 0 if $$textref =~ /\G[^\\$1]*(?:\\.[^\\$1]*)*(\Q$1\E)/cgs
279 2 60 if ($#nesting >= 0)
311 48 0 defined $_[0] ? :
312 48 0 unless pos $$textref
315 12 36 defined $_[3] ? :
316 16 32 defined $_[4] ? :
317 4 44 defined $options{'fail'} ? :
320 0 42 defined $options{'reject'} ? :
6 42 ref $options{'reject'} eq 'ARRAY' ? :
324 0 38 defined $options{'ignore'} ? :
10 38 ref $options{'ignore'} eq 'ARRAY' ? :
327 18 30 unless defined $ldel
332 14 34 unless @match
345 0 120 unless ($$textref =~ /$pre/cg)
353 8 112 unless ($$textref =~ /\G$ldel/cg)
361 70 42 if (not defined $rdel) { }
364 0 70 unless ($rdelspec =~ s#\A([[(<{]+)($XMLNAME).*#quotemeta "$1/$2" . &_revbracket($1);#eos)
388 0 1240 if $$textref =~ /\G\\./cg
390 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) { }
392 0 0 unless defined $parapos
407 8 4 if $omode eq "PARA" or $omode eq "MAX"
415 4 28 unless (_match_tagged(@_))
417 0 4 if $omode eq "PARA" or $omode eq "MAX"
428 4 18 if $omode eq "MAX"
429 14 4 unless $omode eq "PARA"
431 0 4 if (defined $parapos) { }
452 14 16 unless $@
460 625 0 defined $_[0] ? :
461 0 625 unless defined $$textref
462 207 418 unless pos $$textref
463 60 565 defined $_[1] ? :
467 391 234 unless @match
480 341 1004 unless ($$textref =~ /$pre/cg)
486 912 92 unless ($$textref =~ m[\G\$\s*(?!::)(\d+|[][&`'+*./|,";%=~:?!\@<>()-]|\^[a-z]?)]cig)
488 659 253 unless ($$textref =~ /\G((\$#?|[*\@\%]|\\&)+)/cg)
496 0 5 unless ($$textref =~ /\G\s*(?:::|')?(?:[_a-z]\w*(?:::|'))*[_a-z]\w*/cig or _match_codeblock($textref, qr/\G()/, "\\{", qr/\G\s*(\})/, "\\{", "\\}", 0, 1) or $deref eq "\$#" or $deref eq "\$\$" or pos $$textref == length $$textref)
509 27 396 if $$textref =~ /\G\s*(?:->)?\s*[{]\w+[}]/cg
510 23 373 if _match_codeblock($textref, qr/\G\s*->\s*(?:[_a-zA-Z]\w+\s*)?/, qr/[({[]/, qr/\G\s*([)}\]])/, qr/[({[]/, qr/[)}\]]/, 0, 1)
514 16 357 if _match_codeblock($textref, qr/\G\s*/, qr/[{[]/, qr/\G\s*([}\]])/, qr/[{[]/, qr/[}\]]/, 0, 1)
517 0 357 if _match_variable($textref, qr/\G\s*->\s*/)
518 12 345 if $$textref =~ /\G\s*->\s*\w+(?![{([])/cg
534 0 96 if $ec_delim_cache{$ldel_outer}{$ldel_inner}
551 96 0 defined $_[0] ? :
552 50 46 unless pos $$textref
554 78 18 defined $_[1] ? :
555 49 47 !defined($_[2]) ? :
556 5 91 defined $_[3] ? :
561 45 51 unless @match
570 1 1043 unless $no_backcompat
572 357 687 unless ($$textref =~ /$pre/cg)
581 552 135 unless ($$textref =~ /\G($ldel_outer)/cg)
594 4 131 unless pos $$textref and defined $ref2slashvalid{$textref}
597 0 500 if ($rd and $$textref =~ /\G(\(\?\)|\(s\?\)|\(s\))/cg)
603 6 494 if ($$textref =~ /\G\s*#.*/cg)
608 131 363 if ($$textref =~ /$rdel_outer/cg)
610 2 129 unless ($matched = $closing && $1 eq $closing)
612 2 0 if $1 eq ">"
621 138 225 if (_match_variable($textref, qr/\G\s*/) or _match_quotelike($textref, qr/\G\s*/, $ref2slashvalid{$textref}, $ref2qmarkvalid{$textref}))
628 74 151 if ($$textref =~ /\G\s*(?!$ldel_inner)(?:$RE_PREREGEX_PAT|$RE_EXPR_PAT)/cg)
634 17 134 if (_match_codeblock($textref, qr/\G\s*/, $ldel_inner, qr/\G\s*($rdel_inner)/, $ldel_inner, $rdel_inner, $rd, 1))
640 0 134 if ($$textref =~ /\G\s*$ldel_outer/cg)
654 6 129 unless ($matched)
656 6 0 unless $@
685 541 1 $_[0] ? :
686 105 437 unless pos $$textref
688 46 496 defined $_[1] ? :
691 439 103 unless @match
706 109 739 unless pos $$textref and defined $ref2slashvalid{$textref}
713 0 848 unless ($$textref =~ /$pre/cg)
723 19 788 if ($initial and $maybe_quote{$initial} or $allow_slash_match and $initial eq "/" or $allow_qmark_match and $initial eq "?")
727 2 58 unless ($$textref =~ /\G \Q$initial\E [^\\$initial]* (\\.[^\\$initial]*)* \Q$initial\E /cgsx)
739 17 41 if ($initial eq "/" or $initial eq "?")
760 705 83 unless ($$textref =~ /\G(\b(?:m|s|qq|qx|qw|q|qr|tr|y)\b(?=\s*\S)|<<(?=[a-zA-Z]|\s*['"`;,]))/cg)
772 28 55 if ($op eq "<<")
775 9 19 if ($$textref =~ /\G([A-Za-z_]\w*)/cg) { }
16 3 elsif ($$textref =~ / \G ' ([^'\\]* (?:\\.[^'\\]*)*) ' | \G " ([^"\\]* (?:\\.[^"\\]*)*) " | \G ` ([^`\\]* (?:\\.[^`\\]*)*) ` /cgsx) { }
790 4 24 unless ($$textref =~ /.*?\n(?=\Q$label\E\n)/cg)
821 0 55 if (not $$textref =~ /\G(\S)/cg) { }
1 54 elsif (substr($$textref, $ld1pos, 2) eq '=>') { }
837 33 21 if ($ldel1 =~ /[[(<{]/) { }
841 0 33 unless (defined _match_bracketed($textref, qr/\G/, qr/\G($ldel1)/, "", "", qr/\G($rdel1)/))
848 0 21 unless ($$textref =~ /\G${ldel1}[^\\$ldel1]*(\\.[^\\$ldel1]*)*$ldel1/cgs)
852 23 31 $op =~ /s|tr|y/ ? :
853 23 31 if ($second_arg) { }
856 11 12 if ($ldel1 =~ /[[(<{]/) { }
858 0 11 unless ($$textref =~ /\G\s*(\S)/cg)
874 9 14 if ($ldel2 =~ /[[(<{]/) { }
878 0 9 unless (defined _match_bracketed($textref, qr/\G/, qr/\G($ldel2)/, "", "", qr/\G($rdel2)/))
883 0 14 unless ($$textref =~ /[^\\$ldel2]*(\\.[^\\$ldel2]*)*$ldel2/cgs)
921 26 565 if ($ref2slashvalid{$textref} and $text =~ /(?:$RE_NUM|[\)\]])\s*$/) { }
2 563 elsif (not $ref2slashvalid{$textref} and $text =~ /$RE_PREREGEX_PAT\s*$/) { }
46 723 elsif (not $ref2slashvalid{$textref} and $text =~ /$RE_EXPR_PAT\s*$/) { }
935 34 7 defined $_[0] ? :
936 41 0 unless pos $$textref
943 29 12 defined $_[1] ? :
944 14 27 defined $_[2] && $_[2] > 0 ? :
949 14 27 unless (wantarray)
952 0 0 if $^W and defined $_[2] and $max > 1
961 2 79 if ref $func eq "HASH"
962 10 71 unless $ref_not_regex{ref $func}
973 977 159 if (ref $func eq 'CODE') { }
0 159 elsif (ref $func eq 'Text::Balanced::Extractor') { }
33 126 elsif ($$textref =~ /$func[$i]/cg) { }
978 6 27 defined $1 ? :
983 108 1028 if (defined $field and length $field)
985 101 7 unless ($igunk)
986 4 97 if length $pref and not defined $unkpos
988 72 29 if (defined $unkpos)
991 8 64 unless defined $firstpos
993 3 69 if @fields == $max
996 0 105 $class ? :
998 32 73 unless defined $firstpos
1000 15 90 if @fields == $max
1004 486 0 if ($$textref =~ /\G(.)/cgs)
1006 86 400 unless $igunk or defined $unkpos
1012 18 23 if (defined $unkpos)
1015 1 17 unless defined $firstpos
1022 27 14 if wantarray
1034 4 9 defined $_[2] ? :
1035 6 7 defined $_[3] ? :
1036 2 11 defined $options{'fail'} ? :
1039 0 10 defined $options{'reject'} ? :
3 10 ref $options{'reject'} eq 'ARRAY' ? :
1043 0 10 defined $options{'ignore'} ? :
3 10 ref $options{'ignore'} eq 'ARRAY' ? :
1046 2 11 unless defined $ldel
1049 19 20 if $_
1054 40 0 defined $_[0] ? :
1057 12 28 unless @match