| 1 | package ShiftJIS::Regexp; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 6 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | 6 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | 6 | ▶ | use vars qw($VERSION $PACKAGE @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 6 | $VERSION = '1.03'; | |||||||||||||||||||||||||||||||||||||||||
| 8 | 6 | $PACKAGE = 'ShiftJIS::Regexp'; #__PACKAGE__ | |||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | 6 | ▶ | use vars qw(%Err %Re $Char $PadA $PadG $PadGA); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 6 | ▶ | use ShiftJIS::Regexp::Class; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | 6 | ▶ | use ShiftJIS::Regexp::Const qw(%Err %Re $Char $PadA $PadG $PadGA); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | 6 | require Exporter; | |||||||||||||||||||||||||||||||||||||||||
| 15 | 6 | @ISA = qw(Exporter); | |||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | 6 | %EXPORT_TAGS = ( | |||||||||||||||||||||||||||||||||||||||||
| 18 | 're' => [qw(re mkclass rechar)], | ||||||||||||||||||||||||||||||||||||||||||
| 19 | 'op' => [qw(match replace)], | ||||||||||||||||||||||||||||||||||||||||||
| 20 | 'split' => [qw(jsplit splitchar splitspace)], | ||||||||||||||||||||||||||||||||||||||||||
| 21 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 22 | 6 | $EXPORT_TAGS{all} = [ map @$_, values %EXPORT_TAGS ]; | |||||||||||||||||||||||||||||||||||||||||
| 23 | 6 | @EXPORT_OK = @{ $EXPORT_TAGS{all} }; | |||||||||||||||||||||||||||||||||||||||||
| 24 | 6 | @EXPORT = (); | |||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | 6 | my(%Cache); | |||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | ▶ | sub getReCache { wantarray ? %Cache : \%Cache } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getReCache: not called CC=2 SCAR=17.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | 1353 | ▶ | sub re ($;$) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
re: called CC=48 SCAR=44.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | 1353 | my($flag); | |||||||||||||||||||||||||||||||||||||||||
| 32 | 1353 | my $pat = shift; | |||||||||||||||||||||||||||||||||||||||||
| 33 | 1353 | ▶ | my $mod = shift || ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
shift() || ''
MC/DC100%1/1
shift() || ''
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | 1353 | ▶ | if ($pat =~ s/^ (\^|\\[AG]|) \(\? ([a-zA-Z]+) \) /$1/x) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | 51 | $mod .= $2; | |||||||||||||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | 1353 | my $s = $mod =~ /s/; | |||||||||||||||||||||||||||||||||||||||||
| 39 | 1353 | my $m = $mod =~ /m/; | |||||||||||||||||||||||||||||||||||||||||
| 40 | 1353 | my $x = $mod =~ /x/; | |||||||||||||||||||||||||||||||||||||||||
| 41 | 1353 | my $h = $mod =~ /h/; | |||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | 1353 | ▶ | if ($mod =~ /o/ && defined $Cache{$pat}{$mod}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$mod =~ /o/ and defined $Cache{$pat}{$mod}
MC/DC100%2/2
$mod =~ /o/ and defined $Cache{$pat}{$mod}
$mod =~ /o/
defined $Cache{$pat}{$mod}
Truth table100%3/3
A and B
A= $mod =~ /o/B= defined $Cache{$pat}{$mod}
| |||||||||||||||||||||||||||||||||||||||||||
| 44 | 19 | return $Cache{$pat}{$mod}; | |||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | 1334 | ▶ | my $res = $m && $s ? '(?ms)' : $m ? '(?m)' : $s ? '(?s)' : ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition66%2/3
$m and $s
MC/DC0%0/2
$m and $s
$m
$s
Truth table66%2/3
A and B
A= $mB= $s
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | 1334 | my $tmppat = $pat; | |||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | 1334 | for ($tmppat) { | |||||||||||||||||||||||||||||||||||||||||
| 51 | 1334 | ▶ | while (length) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 52 | 2378 | ▶ | if (s/^(\(\?[p?]?\{)//) { # (?{}), (??{}) and (?p{}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | $res .= $1; | |||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | my $count = 1; | |||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | ▶ | while ($count && length) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$count and length $_
MC/DC0%0/2
$count and length $_
$count
length $_
Truth table0%0/3
A and B
A= $countB= length $_
| |||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | if (s/^(\x5C[\x00-\xFC])//) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | $res .= $1; | |||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | if (s/^([^\{\}\\]+)//) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | $res .= $1; | |||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | ▶ | if (s/^\{//) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | ++$count; | |||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | $res .= '{'; | |||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | ▶ | if (s/^\}//) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | --$count; | |||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | $res .= '}'; | |||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | croak $Err{Code}; | |||||||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | ▶ | if (s/^\)//) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | $res .= ')'; | |||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | croak $Err{Code}; | |||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||
| 83 | 2378 | ▶ | if (s/^\x5B(\^?)//) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 84 | 874 | my $not = $1; | |||||||||||||||||||||||||||||||||||||||||
| 85 | 874 | my $class = parse_class(\$_, $mod); | |||||||||||||||||||||||||||||||||||||||||
| 86 | 874 | ▶ | $res .= $not ? "(?:(?!$class)$Char)" : $class; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 87 | 874 | next; | |||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | 1504 | ▶ | if (s/^\\([.*+?^$|\\()\[\]\{\}])//) { # backslashed meta chars | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 91 | 4 | $res .= '\\'.$1; | |||||||||||||||||||||||||||||||||||||||||
| 92 | 4 | next; | |||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||
| 94 | 1500 | ▶ | if (s|^\\?(['"/])||) { # <'>, <">, </> should be backslashed. | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | $res .= '\\'.$1; | |||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||
| 98 | 1500 | ▶ | if ($x && s/^\s+//) { # skip whitespace | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$x and s/^\s+//
MC/DC100%2/2
$x and s/^\s+//
$x
s/^\s+//
Truth table100%3/3
A and B
A= $xB= s/^\s+//
| |||||||||||||||||||||||||||||||||||||||||||
| 99 | 11 | next; | |||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||
| 101 | 1489 | ▶ | if (s/^\.//) { # dot | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 102 | 5 | ▶ | $res .= $s ? $Re{'\j'} : $Re{'\J'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 103 | 5 | next; | |||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||
| 105 | 1484 | ▶ | if (s/^\^//) { # begin | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 106 | 598 | $res .= '(?:^)'; | |||||||||||||||||||||||||||||||||||||||||
| 107 | 598 | next; | |||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||
| 109 | 886 | ▶ | if (s/^\$//) { # end | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 110 | 37 | $res .= '(?:$)'; | |||||||||||||||||||||||||||||||||||||||||
| 111 | 37 | next; | |||||||||||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||||||||||||
| 113 | 849 | ▶ | if (s/^\\z//) { # \z (Perl 5.003 doesn't have this) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 114 | 8 | $res .= '(?!\n)\Z'; | |||||||||||||||||||||||||||||||||||||||||
| 115 | 8 | next; | |||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||
| 117 | 841 | ▶ | if (s/^\\([dDwWsSCjJ])//) { # class | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 118 | 46 | $res .= $Re{ "\\$1" }; | |||||||||||||||||||||||||||||||||||||||||
| 119 | 46 | next; | |||||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||||||
| 121 | 795 | ▶ | if (s/^\\([pP])//) { # prop | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | 227 | my $key = parse_prop($1, \$_); | |||||||||||||||||||||||||||||||||||||||||
| 123 | 227 | ▶ | if (defined $Re{$key}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 124 | 227 | $res .= $Re{$key}; | |||||||||||||||||||||||||||||||||||||||||
| 125 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | croak sprintf($Err{Undef}, $key); | |||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||
| 128 | 227 | next; | |||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||
| 130 | 568 | ▶ | if (s/^\\([R])//) { # regex | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 131 | 1 | my $key = parse_regex($1, \$_); | |||||||||||||||||||||||||||||||||||||||||
| 132 | 1 | ▶ | if (defined $Re{$key}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 133 | 1 | $res .= $Re{$key}; | |||||||||||||||||||||||||||||||||||||||||
| 134 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | croak sprintf($Err{Undef}, $key); | |||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||
| 137 | 1 | next; | |||||||||||||||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||||||||||||||||
| 139 | 567 | ▶ | if (s/^\\([0-7][0-7][0-7]?)//) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 140 | 1 | $res .= rechar(chr oct $1, $mod); | |||||||||||||||||||||||||||||||||||||||||
| 141 | 1 | next; | |||||||||||||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||||||||||||
| 143 | 566 | ▶ | if (s/^\\0//) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 144 | 3 | $res .='\\x00'; | |||||||||||||||||||||||||||||||||||||||||
| 145 | 3 | next; | |||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||
| 147 | 563 | ▶ | if (s/^\\c([\x00-\x7F])//) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 148 | 72 | $res .= rechar(chr(ord(uc $1) ^ 64), $mod); | |||||||||||||||||||||||||||||||||||||||||
| 149 | 72 | next; | |||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||
| 151 | 491 | ▶ | if (s/^\\x([0-9A-Fa-f][0-9A-Fa-f])//) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 152 | 1 | $res .= rechar(chr hex $1, $mod); | |||||||||||||||||||||||||||||||||||||||||
| 153 | 1 | next; | |||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||
| 155 | 490 | ▶ | if (s/^\\x\{([0-9A-Fa-f][0-9A-Fa-f])([0-9A-Fa-f][0-9A-Fa-f])\}//) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 156 | 2 | $res .= rechar(chr(hex $1).chr(hex $2), $mod); | |||||||||||||||||||||||||||||||||||||||||
| 157 | 2 | next; | |||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||
| 159 | 488 | ▶ | if (s/^\\([A-Za-z])//) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 160 | 9 | $res .= '\\'. $1; | |||||||||||||||||||||||||||||||||||||||||
| 161 | 9 | next; | |||||||||||||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||||||||||||
| 163 | 479 | ▶ | if (s/^(\(\?[a-z\-\s]+)//) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 164 | 2 | $res .= $1; | |||||||||||||||||||||||||||||||||||||||||
| 165 | 2 | next; | |||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||
| 167 | 477 | ▶ | if (s/^\\([1-9])//) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | 1 | ▶ | $res .= $h ? '\\'. ($1+1) : '\\'. $1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 169 | 1 | next; | |||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||
| 171 | 476 | ▶ | if (s/^([\x21-\x40\x5B\x5D-\x60\x7B-\x7E])//) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 172 | 306 | $res .= $1; | |||||||||||||||||||||||||||||||||||||||||
| 173 | 306 | next; | |||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||
| 175 | 170 | ▶ | if ($_ eq '\\') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | croak $Err{backtips}; | |||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||
| 178 | 170 | ▶ | if (s/^\\?($Char)//o) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 179 | 170 | $res .= rechar($1, $mod); | |||||||||||||||||||||||||||||||||||||||||
| 180 | 170 | next; | |||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | croak sprintf($Err{oddTrail}, ord); | |||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||||||||||||
| 185 | 1334 | ▶ | return $mod =~ /o/ ? ($Cache{$pat}{$mod} = $res) : $res; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||
| 190 | 48 | ▶ | sub dst ($) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dst: called CC=15 SCAR=29.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 191 | 48 | my $str = shift; | |||||||||||||||||||||||||||||||||||||||||
| 192 | 48 | my $res = ''; | |||||||||||||||||||||||||||||||||||||||||
| 193 | 48 | for ($str) { | |||||||||||||||||||||||||||||||||||||||||
| 194 | 48 | ▶ | while (length) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 195 | 76 | ▶ | if (s/^\\\\//) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 196 | 1 | $res .= '\\\\'; | |||||||||||||||||||||||||||||||||||||||||
| 197 | 1 | next; | |||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||
| 199 | 75 | ▶ | if (s/^\\?\///) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | $res .= '\\/'; | |||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||
| 203 | 75 | ▶ | if (s/^\$([1-8])//) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 204 | 24 | $res .= '${' . ($1 + 1) . '}'; | |||||||||||||||||||||||||||||||||||||||||
| 205 | 24 | next; | |||||||||||||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||||||||||||
| 207 | 51 | ▶ | if (s/^\$\{([1-8])\}//) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 208 | 4 | $res .= '${' . ($1 + 1) . '}'; | |||||||||||||||||||||||||||||||||||||||||
| 209 | 4 | next; | |||||||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||||||
| 211 | 47 | ▶ | if (s/^\\([0-7][0-7][0-7])//) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | $res .= "\\$1"; | |||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||
| 215 | 47 | ▶ | if (s/^\\([0-7][0-7])//) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | $res .= "\\0$1"; | |||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||||||
| 219 | 47 | ▶ | if (s/^\\x([0-9A-Fa-f][0-9A-Fa-f])//) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | $res .= "\\x$1"; | |||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||||||||||||
| 223 | 47 | ▶ | if (s/^\\x\{([0-9A-Fa-f][0-9A-Fa-f])([0-9A-Fa-f][0-9A-Fa-f])\}//) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 224 | 2 | $res .= '\\x' . $1 . '\\x' . $2; | |||||||||||||||||||||||||||||||||||||||||
| 225 | 2 | next; | |||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||
| 227 | 45 | ▶ | if (s/^\\0//) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | $res .='\\x00'; | |||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||
| 231 | 45 | ▶ | if (s/^\\([A-Za-z])//) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 232 | 1 | $res .= '\\'. $1; | |||||||||||||||||||||||||||||||||||||||||
| 233 | 1 | next; | |||||||||||||||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||||||||||||||||
| 235 | 44 | ▶ | if (s/^\\?([\x81-\x9F\xE0-\xFC][\x40-\x7E\x80-\xFC])//) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 236 | 15 | $res .= quotemeta($1); | |||||||||||||||||||||||||||||||||||||||||
| 237 | 15 | next; | |||||||||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||||||||
| 239 | 29 | ▶ | if (s/^\\?([\x00-\x7F\xA1-\xDF])//) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 240 | 29 | $res .= $1; | |||||||||||||||||||||||||||||||||||||||||
| 241 | 29 | next; | |||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | croak sprintf($Err{oddTrail}, ord); | |||||||||||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||
| 246 | 48 | return $res; | |||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||
| 249 | 98 | ▶ | sub match ($$;$) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
match: called CC=5 SCAR=20.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 250 | 98 | my $str = $_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 251 | 98 | ▶ | my $mod = $_[2] || ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$_[2] || ''
MC/DC100%1/1
$_[2] || ''
$_[2]
Truth table100%2/2
A
A= $_[2]
| |||||||||||||||||||||||||||||||||||||||||||
| 252 | 98 | my $pat = re($_[1], $mod); | |||||||||||||||||||||||||||||||||||||||||
| 253 | 98 | ▶ | if ($mod =~ /g/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | ▶ | my $fore = $mod =~ /z/ || '' =~ /$pat/ ? $PadGA : $PadG; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$mod =~ /z/ or "" =~ /$pat/
MC/DC0%0/2
$mod =~ /z/ or "" =~ /$pat/
$mod =~ /z/
"" =~ /$pat/
Truth table0%0/3
A or B
A= $mod =~ /z/B= "" =~ /$pat/
| |||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | $str =~ /$fore(?:$pat)/g; | |||||||||||||||||||||||||||||||||||||||||
| 256 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 257 | 98 | $str =~ /$PadA(?:$pat)/; | |||||||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||
| 262 | 48 | ▶ | sub replace ($$$;$) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
replace: called CC=7 SCAR=19.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 263 | 48 | my $str = $_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 264 | 48 | my $dst = dst($_[2]); | |||||||||||||||||||||||||||||||||||||||||
| 265 | 48 | ▶ | my $mod = $_[3] || ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$_[3] || ''
MC/DC100%1/1
$_[3] || ''
$_[3]
Truth table100%2/2
A
A= $_[3]
| |||||||||||||||||||||||||||||||||||||||||||
| 266 | 48 | my $pat = re($_[1], 'h'.$mod); | |||||||||||||||||||||||||||||||||||||||||
| 267 | 48 | ▶ | if ($mod =~ /g/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 268 | 32 | ▶ | my $fore = $mod =~ /z/ || '' =~ /$pat/ ? $PadGA : $PadG; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$mod =~ /z/ or "" =~ /$pat/
MC/DC100%2/2
$mod =~ /z/ or "" =~ /$pat/
$mod =~ /z/
"" =~ /$pat/
Truth table100%3/3
A or B
A= $mod =~ /z/B= "" =~ /$pat/
| |||||||||||||||||||||||||||||||||||||||||||
| 269 | 32 | ▶ | if (ref $str) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | eval "\$\$str =~ s/($fore)(?:$pat)/\${1}$dst/g"; | |||||||||||||||||||||||||||||||||||||||||
| 271 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 272 | 32 | eval "\$str =~ s/($fore)(?:$pat)/\${1}$dst/g"; | |||||||||||||||||||||||||||||||||||||||||
| 273 | 32 | $str; | |||||||||||||||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||||||||||||||||
| 275 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 276 | 16 | ▶ | if (ref $str) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 277 | 12 | eval "\$\$str =~ s/($PadA)(?:$pat)/\${1}$dst/"; | |||||||||||||||||||||||||||||||||||||||||
| 278 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 279 | 4 | eval "\$str =~ s/($PadA)(?:$pat)/\${1}$dst/"; | |||||||||||||||||||||||||||||||||||||||||
| 280 | 4 | $str; | |||||||||||||||||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||
| 286 | # | ||||||||||||||||||||||||||||||||||||||||||
| 287 | # splitchar(STRING; LIMIT) | ||||||||||||||||||||||||||||||||||||||||||
| 288 | # | ||||||||||||||||||||||||||||||||||||||||||
| 289 | 176 | ▶ | sub splitchar ($;$) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
splitchar: called CC=10 SCAR=23.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 290 | 176 | my $str = shift; | |||||||||||||||||||||||||||||||||||||||||
| 291 | 176 | ▶ | my $lim = shift || 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
shift() || 0
MC/DC100%1/1
shift() || 0
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||
| 293 | 176 | ▶ | return wantarray ? () : 0 if $str eq ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 294 | 88 | ▶ | return wantarray ? ($str) : 1 if $lim == 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||
| 296 | 84 | my(@ret); | |||||||||||||||||||||||||||||||||||||||||
| 297 | 84 | ▶ | if ($lim > 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 298 | 76 | ▶ | while ($str =~ s/($Char)//o) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 299 | 760 | push @ret, $1; | |||||||||||||||||||||||||||||||||||||||||
| 300 | 760 | ▶ | last if @ret >= $lim - 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||||||||||||||||
| 302 | 76 | push @ret, $str; | |||||||||||||||||||||||||||||||||||||||||
| 303 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 304 | 8 | @ret = $str =~ /$Char/go; | |||||||||||||||||||||||||||||||||||||||||
| 305 | 8 | ▶ | push @ret, '' if $lim < 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||||||||||||||||
| 307 | 84 | return @ret; | |||||||||||||||||||||||||||||||||||||||||
| 308 | } | ||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||
| 310 | # | ||||||||||||||||||||||||||||||||||||||||||
| 311 | # splitspace(STRING; LIMIT) | ||||||||||||||||||||||||||||||||||||||||||
| 312 | # | ||||||||||||||||||||||||||||||||||||||||||
| 313 | 47 | ▶ | sub splitspace ($;$) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
splitspace: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 314 | 47 | my $str = shift; | |||||||||||||||||||||||||||||||||||||||||
| 315 | 47 | ▶ | my $lim = shift || 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
shift() || 0
MC/DC100%1/1
shift() || 0
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 316 | 47 | ▶ | return wantarray ? () : 0 if $str eq ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||
| 318 | 33 | my @ret; | |||||||||||||||||||||||||||||||||||||||||
| 319 | 33 | ▶ | if (0 < $lim) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 320 | 20 | $str =~ s/^(?:[ \n\r\t\f]|\x81\x40)+//; | |||||||||||||||||||||||||||||||||||||||||
| 321 | 20 | @ret = jsplit('(?o)[ \n\r\t\f\x{8140}]+', $str, $lim) | |||||||||||||||||||||||||||||||||||||||||
| 322 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 323 | 13 | $str =~ s/\G($Char*?)\x81\x40/$1 /go; | |||||||||||||||||||||||||||||||||||||||||
| 324 | 13 | @ret = split(' ', $str, $lim); | |||||||||||||||||||||||||||||||||||||||||
| 325 | } | ||||||||||||||||||||||||||||||||||||||||||
| 326 | 33 | return @ret; | |||||||||||||||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||
| 329 | # | ||||||||||||||||||||||||||||||||||||||||||
| 330 | # jsplit(PATTERN, STRING; LIMIT) | ||||||||||||||||||||||||||||||||||||||||||
| 331 | # | ||||||||||||||||||||||||||||||||||||||||||
| 332 | 168 | ▶ | sub jsplit ($$;$) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
jsplit: called CC=22 SCAR=31.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 333 | 168 | my $thing = shift; | |||||||||||||||||||||||||||||||||||||||||
| 334 | 168 | my $str = shift; | |||||||||||||||||||||||||||||||||||||||||
| 335 | 168 | ▶ | my $lim = shift || 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
shift() || 0
MC/DC100%1/1
shift() || 0
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||
| 337 | 168 | ▶ | return splitspace($str, $lim) if !defined $thing; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||
| 339 | 145 | ▶ | my $pat = 'ARRAY' eq ref $thing | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 340 | ? re($$thing[0], $$thing[1]) | ||||||||||||||||||||||||||||||||||||||||||
| 341 | : re($thing); | ||||||||||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||||||||||
| 343 | 145 | ▶ | return splitchar($str, $lim) if $pat eq ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 344 | 57 | ▶ | return wantarray ? () : 0 if $str eq ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 345 | 50 | ▶ | return wantarray ? ($str) : 1 if $lim == 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||
| 347 | 43 | my $cnt = 0; | |||||||||||||||||||||||||||||||||||||||||
| 348 | 43 | my(@mat, @ret); | |||||||||||||||||||||||||||||||||||||||||
| 349 | 43 | ▶ | while (@mat = $str =~ /^($Char*?)($pat)/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 350 | 136 | ▶ | if ($mat[0] eq '' && $mat[1] eq '') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$mat[0] eq "" and $mat[1] eq ""
MC/DC0%0/2
$mat[0] eq "" and $mat[1] eq ""
$mat[0] eq ""
$mat[1] eq ""
Truth table66%2/3
A and B
A= $mat[0] eq ""B= $mat[1] eq ""
| |||||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | @mat = $str =~ /^($Char)($pat)/; | |||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | $str =~ s/^$Char$pat//; | |||||||||||||||||||||||||||||||||||||||||
| 353 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 354 | 136 | $str =~ s/^$Char*?$pat//; | |||||||||||||||||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||||||||||||||||
| 356 | 136 | ▶ | if (@mat) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 357 | 136 | push @ret, shift @mat; | |||||||||||||||||||||||||||||||||||||||||
| 358 | 136 | shift @mat; # $mat[1] eq $2 is to be removed. | |||||||||||||||||||||||||||||||||||||||||
| 359 | 136 | push @ret, @mat; | |||||||||||||||||||||||||||||||||||||||||
| 360 | } | ||||||||||||||||||||||||||||||||||||||||||
| 361 | 136 | $cnt++; | |||||||||||||||||||||||||||||||||||||||||
| 362 | 136 | ▶ | last if ! CORE::length $str; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 363 | 130 | ▶ | last if $lim > 1 && $cnt >= $lim - 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$lim > 1 and $cnt >= $lim - 1
MC/DC100%2/2
$lim > 1 and $cnt >= $lim - 1
$lim > 1
$cnt >= $lim - 1
Truth table100%3/3
A and B
A= $lim > 1B= $cnt >= $lim - 1
| |||||||||||||||||||||||||||||||||||||||||||
| 364 | } | ||||||||||||||||||||||||||||||||||||||||||
| 365 | 43 | ▶ | push @ret, $str if $str ne '' || $lim < 0 || $cnt < $lim; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$str ne "" or $lim < 0 or $cnt < $lim
$str ne "" or $lim < 0
MC/DC66%2/3
$str ne "" or $lim < 0 or $cnt < $lim
$str ne ""
$lim < 0
$cnt < $lim
Truth table75%3/4
A or B or C
A= $str ne ""B= $lim < 0C= $cnt < $lim
| |||||||||||||||||||||||||||||||||||||||||||
| 366 | 43 | ▶ | if ($lim == 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 367 | 10 | ▶ | pop @ret while defined $ret[-1] && $ret[-1] eq ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $ret[-1] and $ret[-1] eq ""
MC/DC50%1/2
defined $ret[-1] and $ret[-1] eq ""
defined $ret[-1]
$ret[-1] eq ""
Truth table66%2/3
A and B
A= defined $ret[-1]B= $ret[-1] eq ""
| |||||||||||||||||||||||||||||||||||||||||||
| 368 | } | ||||||||||||||||||||||||||||||||||||||||||
| 369 | 43 | return @ret; | |||||||||||||||||||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||
| 372 | 6 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 373 | __END__ | ||||||||||||||||||||||||||||||||||||||||||