Elatin10.pm

filter: Statementstmt 43.6% 1312 / 3009 Branchbran 40.7% 1063 / 2608 Conditioncond 31.0% 115 / 370 MC/DCmcdc 15.9% 35 / 220 Subroutinesub 68.9% 111 / 161 Podpod 4.6% 3 / 64 totaltotal 41.0% 2639 / 6432 CC 1475 SCAR 97.8
CC
1475
Cov
42%
escape_token
55669.4
e_s1
3320.4
e_split
2070.1
CRAP 17630.0
↑ Summary Latin10.pm »
1 package Elatin10;
2 425 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 425 ▶BEGIN { $INC{'warnings.pm'} = '' if $] < 5.006 } use warnings;
Subroutine BEGIN: called CC=2 SCAR=7.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
if $] < "5.006" 0 424 424
4 ######################################################################
5 #
6 # Elatin10 - Run-time routines for Latin10.pm
7 #
8 # http://search.cpan.org/dist/Char-Latin10/
9 #
10 # Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2018, 2019 INABA Hitoshi <ina@cpan.org>
11 ######################################################################
12  
13 425 ▶use 5.00503; # Galapagos Consensus 1998 for primetools
Subroutine BEGIN: called CC=1 SCAR=0.0
14 # use 5.008001; # Lancaster Consensus 2013 for toolchains
15  
16 # 12.3. Delaying use Until Runtime
17 # in Chapter 12. Packages, Libraries, and Modules
18 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
19 # (and so on)
20  
21 # Version numbers should be boring
22 # http://www.dagolden.com/index.php/369/version-numbers-should-be-boring/
23 # For the impatient, the disinterested or those who just want to follow
24 # a recipe, my advice for all modules is this:
25 # our $VERSION = "0.001"; # or "0.001_001" for a dev release
26 # $VERSION = eval $VERSION; # No!! because '1.10' makes '1.1'
27  
28 425 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
29 424 $VERSION = '1.22';
30 424 $VERSION = $VERSION;
31  
32 424 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=7.0
33 425 ▶ if ($^X =~ / jperl /oxmsi) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^X =~ / jperl /imosx) 0 424 424
34 1 die __FILE__, ": needs perl(not jperl) 5.00503 or later. (\$^X==$^X)\n";
35 }
36 425 if (CORE::ord('A') == 193) {
37 die __FILE__, ": is not US-ASCII script (may be EBCDIC or EBCDIK script).\n";
38 }
39 424 if (CORE::ord('A') != 0x41) {
40 die __FILE__, ": is not US-ASCII script (must be US-ASCII script).\n";
41 }
42 }
43  
44 424 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=9.5
45  
46 # instead of utf8.pm
47 424 ▶ CORE::eval q{
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
48 no warnings qw(redefine);
49 *utf8::upgrade = sub { CORE::length $_[0] };
50 *utf8::downgrade = sub { 1 };
51 *utf8::encode = sub { };
52 *utf8::decode = sub { 1 };
53 *utf8::is_utf8 = sub { };
54 *utf8::valid = sub { 1 };
55 };
56 424 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 424 424
57 0 ▶ *utf8::upgrade = sub { CORE::length $_[0] };
Subroutine __ANON__: not called CC=1 SCAR=6.9
58 0 ▶ *utf8::downgrade = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
59 0 ▶ *utf8::encode = sub { };
Subroutine __ANON__: not called CC=1 SCAR=6.9
60 0 ▶ *utf8::decode = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
61 0 ▶ *utf8::is_utf8 = sub { };
Subroutine __ANON__: not called CC=1 SCAR=6.9
62 0 ▶ *utf8::valid = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
63 }
64 }
65  
66 # instead of Symbol.pm
67 BEGIN {
68 0 ▶ sub gensym () {
Subroutine gensym: not called CC=2 SCAR=17.9
Pod undocumented
69 0 ▶ if ($] < 5.006) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] < 5.006) { } 0 0 0
70 0 return \do { local *_ };
71 }
72 else {
73 0 return undef;
74 }
75 }
76  
77 20 ▶ sub qualify ($$) {
Subroutine qualify: called CC=8 SCAR=28.9
Pod undocumented
78 20 my($name) = @_;
79  
80 20 ▶ if (ref $name) {
Branch: 7 branches
BranchTrueFalseTotal
if (ref $name) { } 5 15 20
elsif (&Elatin10::index($name, '::') >= 0) { } 0 15 15
elsif (&Elatin10::index($name, q[']) >= 0) { } 0 15 15
elsif ($name =~ /\A \^ [ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]+ \z/x) { } 0 15 15
elsif ($name =~ /\A (?: ARGV | ARGVOUT | ENV | INC | SIG | STDERR | STDIN | STDOUT ) \z/x) { } 0 15 15
elsif ($name =~ /\A [^ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz] \z/x) { } 0 15 15
elsif (defined $_[1]) { } 15 0 15
81 5 return $name;
82 }
83 elsif (Elatin10::index($name,'::') >= 0) {
84 0 return $name;
85 }
86 elsif (Elatin10::index($name,"'") >= 0) {
87 0 return $name;
88 }
89  
90 # special character, "^xyz"
91 elsif ($name =~ /\A \^ [ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]+ \z/x) {
92  
93 # RGS 2001-11-05 : translate leading ^X to control-char
94 0 $name =~ s{\A \^ ([ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]) }{'qq(\c'.$1.')'}xee;
95 0 return 'main::' . $name;
96 }
97  
98 # Global names
99 elsif ($name =~ /\A (?: ARGV | ARGVOUT | ENV | INC | SIG | STDERR | STDIN | STDOUT ) \z/x) {
100 0 return 'main::' . $name;
101 }
102  
103 # or other
104 elsif ($name =~ /\A [^ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz] \z/x) {
105 0 return 'main::' . $name;
106 }
107  
108 elsif (defined $_[1]) {
109 15 return $_[1] . '::' . $name;
110 }
111 else {
112 0 return (caller)[0] . '::' . $name;
113 }
114 }
115  
116 20 ▶ sub qualify_to_ref ($;$) {
Subroutine qualify_to_ref: called CC=2 SCAR=7.2
Pod undocumented
117 20 ▶ if (defined $_[1]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[1]) { } 20 0 20
118 424 ▶ no strict qw(refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
119 20 return \*{ qualify $_[0], $_[1] };
120 }
121 else {
122 424 ▶ no strict qw(refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: not called CC=1 SCAR=0.0
123 0 return \*{ qualify $_[0], (caller)[0] };
124 }
125 }
126 }
127  
128 # P.714 29.2.39. flock
129 # in Chapter 29: Functions
130 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
131  
132 # P.863 flock
133 # in Chapter 27: Functions
134 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
135  
136 sub LOCK_SH() {1}
137 sub LOCK_EX() {2}
138 sub LOCK_UN() {8}
139 sub LOCK_NB() {4}
140  
141 # instead of Carp.pm
142 sub carp;
143 sub croak;
144 sub cluck;
145 sub confess;
146  
147 # 6.18. Matching Multiple-Byte Characters
148 # in Chapter 6. Pattern Matching
149 # of ISBN 978-1-56592-243-3 Perl Perl Cookbook.
150 # (and so on)
151  
152 # regexp of character
153 424 my $your_char = q{[\x00-\xFF]};
154 424 ▶use vars qw($qq_char); $qq_char = qr/\\c[\x40-\x5F]|\\?(?:$your_char)/oxms;
Subroutine BEGIN: called CC=1 SCAR=0.0
155 424 ▶use vars qw($q_char); $q_char = qr/$your_char/oxms;
Subroutine BEGIN: called CC=1 SCAR=0.0
156  
157 #
158 # Latin-10 character range per length
159 #
160 424 my %range_tr = ();
161  
162 #
163 # Latin-10 case conversion
164 #
165 424 my %lc = ();
166 424 @lc{qw(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)} =
167 qw(a b c d e f g h i j k l m n o p q r s t u v w x y z);
168 424 my %uc = ();
169 424 @uc{qw(a b c d e f g h i j k l m n o p q r s t u v w x y z)} =
170 qw(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z);
171 424 my %fc = ();
172 424 @fc{qw(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)} =
173 qw(a b c d e f g h i j k l m n o p q r s t u v w x y z);
174  
175 424 ▶if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { __PACKAGE__ =~ / \b Elatin10 \z/mosx }) { } 424 0 424
176 }
177  
178 elsif (__PACKAGE__ =~ / \b Elatin10 \z/oxms) {
179 424 %range_tr = (
180 1 => [ [0x00..0xFF],
181 ],
182 );
183  
184 424 %lc = (%lc,
185 "\xA1" => "\xA2", # LATIN LETTER A WITH OGONEK
186 "\xA3" => "\xB3", # LATIN LETTER L WITH STROKE
187 "\xA6" => "\xA8", # LATIN LETTER S WITH CARON
188 "\xAA" => "\xBA", # LATIN LETTER S WITH COMMA BELOW
189 "\xAC" => "\xAE", # LATIN LETTER Z WITH ACUTE
190 "\xAF" => "\xBF", # LATIN LETTER Z WITH DOT ABOVE
191 "\xB2" => "\xB9", # LATIN LETTER C WITH CARON
192 "\xB4" => "\xB8", # LATIN LETTER Z WITH CARON
193 "\xBC" => "\xBD", # LATIN LIGATURE OE
194 "\xBE" => "\xFF", # LATIN LETTER Y WITH DIAERESIS
195 "\xC0" => "\xE0", # LATIN LETTER A WITH GRAVE
196 "\xC1" => "\xE1", # LATIN LETTER A WITH ACUTE
197 "\xC2" => "\xE2", # LATIN LETTER A WITH CIRCUMFLEX
198 "\xC3" => "\xE3", # LATIN LETTER A WITH BREVE
199 "\xC4" => "\xE4", # LATIN LETTER A WITH DIAERESIS
200 "\xC5" => "\xE5", # LATIN LETTER C WITH ACUTE
201 "\xC6" => "\xE6", # LATIN LETTER AE
202 "\xC7" => "\xE7", # LATIN LETTER C WITH CEDILLA
203 "\xC8" => "\xE8", # LATIN LETTER E WITH GRAVE
204 "\xC9" => "\xE9", # LATIN LETTER E WITH ACUTE
205 "\xCA" => "\xEA", # LATIN LETTER E WITH CIRCUMFLEX
206 "\xCB" => "\xEB", # LATIN LETTER E WITH DIAERESIS
207 "\xCC" => "\xEC", # LATIN LETTER I WITH GRAVE
208 "\xCD" => "\xED", # LATIN LETTER I WITH ACUTE
209 "\xCE" => "\xEE", # LATIN LETTER I WITH CIRCUMFLEX
210 "\xCF" => "\xEF", # LATIN LETTER I WITH DIAERESIS
211 "\xD0" => "\xF0", # LATIN LETTER D WITH STROKE
212 "\xD1" => "\xF1", # LATIN LETTER N WITH ACUTE
213 "\xD2" => "\xF2", # LATIN LETTER O WITH GRAVE
214 "\xD3" => "\xF3", # LATIN LETTER O WITH ACUTE
215 "\xD4" => "\xF4", # LATIN LETTER O WITH CIRCUMFLEX
216 "\xD5" => "\xF5", # LATIN LETTER O WITH DOUBLE ACUTE
217 "\xD6" => "\xF6", # LATIN LETTER O WITH DIAERESIS
218 "\xD7" => "\xF7", # LATIN LETTER S WITH ACUTE
219 "\xD8" => "\xF8", # LATIN LETTER U WITH DOUBLE ACUTE
220 "\xD9" => "\xF9", # LATIN LETTER U WITH GRAVE
221 "\xDA" => "\xFA", # LATIN LETTER U WITH ACUTE
222 "\xDB" => "\xFB", # LATIN LETTER U WITH CIRCUMFLEX
223 "\xDC" => "\xFC", # LATIN LETTER U WITH DIAERESIS
224 "\xDD" => "\xFD", # LATIN LETTER E WITH OGONEK
225 "\xDE" => "\xFE", # LATIN LETTER T WITH COMMA BELOW
226 );
227  
228 424 %uc = (%uc,
229 "\xA2" => "\xA1", # LATIN LETTER A WITH OGONEK
230 "\xA8" => "\xA6", # LATIN LETTER S WITH CARON
231 "\xAE" => "\xAC", # LATIN LETTER Z WITH ACUTE
232 "\xB3" => "\xA3", # LATIN LETTER L WITH STROKE
233 "\xB8" => "\xB4", # LATIN LETTER Z WITH CARON
234 "\xB9" => "\xB2", # LATIN LETTER C WITH CARON
235 "\xBA" => "\xAA", # LATIN LETTER S WITH COMMA BELOW
236 "\xBD" => "\xBC", # LATIN LIGATURE OE
237 "\xBF" => "\xAF", # LATIN LETTER Z WITH DOT ABOVE
238 "\xE0" => "\xC0", # LATIN LETTER A WITH GRAVE
239 "\xE1" => "\xC1", # LATIN LETTER A WITH ACUTE
240 "\xE2" => "\xC2", # LATIN LETTER A WITH CIRCUMFLEX
241 "\xE3" => "\xC3", # LATIN LETTER A WITH BREVE
242 "\xE4" => "\xC4", # LATIN LETTER A WITH DIAERESIS
243 "\xE5" => "\xC5", # LATIN LETTER C WITH ACUTE
244 "\xE6" => "\xC6", # LATIN LETTER AE
245 "\xE7" => "\xC7", # LATIN LETTER C WITH CEDILLA
246 "\xE8" => "\xC8", # LATIN LETTER E WITH GRAVE
247 "\xE9" => "\xC9", # LATIN LETTER E WITH ACUTE
248 "\xEA" => "\xCA", # LATIN LETTER E WITH CIRCUMFLEX
249 "\xEB" => "\xCB", # LATIN LETTER E WITH DIAERESIS
250 "\xEC" => "\xCC", # LATIN LETTER I WITH GRAVE
251 "\xED" => "\xCD", # LATIN LETTER I WITH ACUTE
252 "\xEE" => "\xCE", # LATIN LETTER I WITH CIRCUMFLEX
253 "\xEF" => "\xCF", # LATIN LETTER I WITH DIAERESIS
254 "\xF0" => "\xD0", # LATIN LETTER D WITH STROKE
255 "\xF1" => "\xD1", # LATIN LETTER N WITH ACUTE
256 "\xF2" => "\xD2", # LATIN LETTER O WITH GRAVE
257 "\xF3" => "\xD3", # LATIN LETTER O WITH ACUTE
258 "\xF4" => "\xD4", # LATIN LETTER O WITH CIRCUMFLEX
259 "\xF5" => "\xD5", # LATIN LETTER O WITH DOUBLE ACUTE
260 "\xF6" => "\xD6", # LATIN LETTER O WITH DIAERESIS
261 "\xF7" => "\xD7", # LATIN LETTER S WITH ACUTE
262 "\xF8" => "\xD8", # LATIN LETTER U WITH DOUBLE ACUTE
263 "\xF9" => "\xD9", # LATIN LETTER U WITH GRAVE
264 "\xFA" => "\xDA", # LATIN LETTER U WITH ACUTE
265 "\xFB" => "\xDB", # LATIN LETTER U WITH CIRCUMFLEX
266 "\xFC" => "\xDC", # LATIN LETTER U WITH DIAERESIS
267 "\xFD" => "\xDD", # LATIN LETTER E WITH OGONEK
268 "\xFE" => "\xDE", # LATIN LETTER T WITH COMMA BELOW
269 "\xFF" => "\xBE", # LATIN LETTER Y WITH DIAERESIS
270 );
271  
272 424 %fc = (%fc,
273 "\xA1" => "\xA2", # LATIN CAPITAL LETTER A WITH OGONEK --> LATIN SMALL LETTER A WITH OGONEK
274 "\xA3" => "\xB3", # LATIN CAPITAL LETTER L WITH STROKE --> LATIN SMALL LETTER L WITH STROKE
275 "\xA6" => "\xA8", # LATIN CAPITAL LETTER S WITH CARON --> LATIN SMALL LETTER S WITH CARON
276 "\xAA" => "\xBA", # LATIN CAPITAL LETTER S WITH COMMA BELOW --> LATIN SMALL LETTER S WITH COMMA BELOW
277 "\xAC" => "\xAE", # LATIN CAPITAL LETTER Z WITH ACUTE --> LATIN SMALL LETTER Z WITH ACUTE
278 "\xAF" => "\xBF", # LATIN CAPITAL LETTER Z WITH DOT ABOVE --> LATIN SMALL LETTER Z WITH DOT ABOVE
279 "\xB2" => "\xB9", # LATIN CAPITAL LETTER C WITH CARON --> LATIN SMALL LETTER C WITH CARON
280 "\xB4" => "\xB8", # LATIN CAPITAL LETTER Z WITH CARON --> LATIN SMALL LETTER Z WITH CARON
281 "\xBC" => "\xBD", # LATIN CAPITAL LIGATURE OE --> LATIN SMALL LIGATURE OE
282 "\xBE" => "\xFF", # LATIN CAPITAL LETTER Y WITH DIAERESIS --> LATIN SMALL LETTER Y WITH DIAERESIS
283 "\xC0" => "\xE0", # LATIN CAPITAL LETTER A WITH GRAVE --> LATIN SMALL LETTER A WITH GRAVE
284 "\xC1" => "\xE1", # LATIN CAPITAL LETTER A WITH ACUTE --> LATIN SMALL LETTER A WITH ACUTE
285 "\xC2" => "\xE2", # LATIN CAPITAL LETTER A WITH CIRCUMFLEX --> LATIN SMALL LETTER A WITH CIRCUMFLEX
286 "\xC3" => "\xE3", # LATIN CAPITAL LETTER A WITH BREVE --> LATIN SMALL LETTER A WITH BREVE
287 "\xC4" => "\xE4", # LATIN CAPITAL LETTER A WITH DIAERESIS --> LATIN SMALL LETTER A WITH DIAERESIS
288 "\xC5" => "\xE5", # LATIN CAPITAL LETTER C WITH ACUTE --> LATIN SMALL LETTER C WITH ACUTE
289 "\xC6" => "\xE6", # LATIN CAPITAL LETTER AE --> LATIN SMALL LETTER AE
290 "\xC7" => "\xE7", # LATIN CAPITAL LETTER C WITH CEDILLA --> LATIN SMALL LETTER C WITH CEDILLA
291 "\xC8" => "\xE8", # LATIN CAPITAL LETTER E WITH GRAVE --> LATIN SMALL LETTER E WITH GRAVE
292 "\xC9" => "\xE9", # LATIN CAPITAL LETTER E WITH ACUTE --> LATIN SMALL LETTER E WITH ACUTE
293 "\xCA" => "\xEA", # LATIN CAPITAL LETTER E WITH CIRCUMFLEX --> LATIN SMALL LETTER E WITH CIRCUMFLEX
294 "\xCB" => "\xEB", # LATIN CAPITAL LETTER E WITH DIAERESIS --> LATIN SMALL LETTER E WITH DIAERESIS
295 "\xCC" => "\xEC", # LATIN CAPITAL LETTER I WITH GRAVE --> LATIN SMALL LETTER I WITH GRAVE
296 "\xCD" => "\xED", # LATIN CAPITAL LETTER I WITH ACUTE --> LATIN SMALL LETTER I WITH ACUTE
297 "\xCE" => "\xEE", # LATIN CAPITAL LETTER I WITH CIRCUMFLEX --> LATIN SMALL LETTER I WITH CIRCUMFLEX
298 "\xCF" => "\xEF", # LATIN CAPITAL LETTER I WITH DIAERESIS --> LATIN SMALL LETTER I WITH DIAERESIS
299 "\xD0" => "\xF0", # LATIN CAPITAL LETTER D WITH STROKE --> LATIN SMALL LETTER D WITH STROKE
300 "\xD1" => "\xF1", # LATIN CAPITAL LETTER N WITH ACUTE --> LATIN SMALL LETTER N WITH ACUTE
301 "\xD2" => "\xF2", # LATIN CAPITAL LETTER O WITH GRAVE --> LATIN SMALL LETTER O WITH GRAVE
302 "\xD3" => "\xF3", # LATIN CAPITAL LETTER O WITH ACUTE --> LATIN SMALL LETTER O WITH ACUTE
303 "\xD4" => "\xF4", # LATIN CAPITAL LETTER O WITH CIRCUMFLEX --> LATIN SMALL LETTER O WITH CIRCUMFLEX
304 "\xD5" => "\xF5", # LATIN CAPITAL LETTER O WITH DOUBLE ACUTE --> LATIN SMALL LETTER O WITH DOUBLE ACUTE
305 "\xD6" => "\xF6", # LATIN CAPITAL LETTER O WITH DIAERESIS --> LATIN SMALL LETTER O WITH DIAERESIS
306 "\xD7" => "\xF7", # LATIN CAPITAL LETTER S WITH ACUTE --> LATIN SMALL LETTER S WITH ACUTE
307 "\xD8" => "\xF8", # LATIN CAPITAL LETTER U WITH DOUBLE ACUTE --> LATIN SMALL LETTER U WITH DOUBLE ACUTE
308 "\xD9" => "\xF9", # LATIN CAPITAL LETTER U WITH GRAVE --> LATIN SMALL LETTER U WITH GRAVE
309 "\xDA" => "\xFA", # LATIN CAPITAL LETTER U WITH ACUTE --> LATIN SMALL LETTER U WITH ACUTE
310 "\xDB" => "\xFB", # LATIN CAPITAL LETTER U WITH CIRCUMFLEX --> LATIN SMALL LETTER U WITH CIRCUMFLEX
311 "\xDC" => "\xFC", # LATIN CAPITAL LETTER U WITH DIAERESIS --> LATIN SMALL LETTER U WITH DIAERESIS
312 "\xDD" => "\xFD", # LATIN CAPITAL LETTER E WITH OGONEK --> LATIN SMALL LETTER E WITH OGONEK
313 "\xDE" => "\xFE", # LATIN CAPITAL LETTER T WITH COMMA BELOW --> LATIN SMALL LETTER T WITH COMMA BELOW
314 "\xDF" => "\x73\x73", # LATIN SMALL LETTER SHARP S --> LATIN SMALL LETTER S, LATIN SMALL LETTER S
315 );
316 }
317  
318 else {
319 0 croak "Don't know my package name '@{[__PACKAGE__]}'";
320 }
321  
322 #
323 # @ARGV wildcard globbing
324 #
325 212 ▶sub import {
Subroutine import: called CC=7 SCAR=28.3
326  
327 212 ▶ if ($^O =~ /\A (?: MSWin32 | NetWare | symbian | dos ) \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O =~ /\A (?: MSWin32 | NetWare | symbian | dos ) \z/mosx) 0 212 212
328 0 my @argv = ();
329 0 for (@ARGV) {
330  
331 # has space
332 0 ▶ if (/\A (?:$q_char)*? [ ] /oxms) {
Branch: 2 branches
BranchTrueFalseTotal
if (/\A (?:$Elatin10::q_char)*? [ ] /mosx) { } 0 0 0
elsif (/\A (?:$Elatin10::q_char)*? [*?] /mosx) { } 0 0 0
333 0 ▶ if (my @glob = Elatin10::glob(qq{"$_"})) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@glob) = &Elatin10::glob(qq["$_"])) { } 0 0 0
334 0 push @argv, @glob;
335 }
336 else {
337 0 push @argv, $_;
338 }
339 }
340  
341 # has wildcard metachar
342 elsif (/\A (?:$q_char)*? [*?] /oxms) {
343 0 ▶ if (my @glob = Elatin10::glob($_)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@glob) = &Elatin10::glob($_)) { } 0 0 0
344 0 push @argv, @glob;
345 }
346 else {
347 0 push @argv, $_;
348 }
349 }
350  
351 # no wildcard globbing
352 else {
353 0 push @argv, $_;
354 }
355 }
356 0 @ARGV = @argv;
357 }
358  
359 212 *Char::ord = \&Latin10::ord;
360 212 *Char::ord_ = \&Latin10::ord_;
361 212 *Char::reverse = \&Latin10::reverse;
362 212 *Char::getc = \&Latin10::getc;
363 212 *Char::length = \&Latin10::length;
364 212 *Char::substr = \&Latin10::substr;
365 212 *Char::index = \&Latin10::index;
366 212 *Char::rindex = \&Latin10::rindex;
367 212 *Char::eval = \&Latin10::eval;
368 212 *Char::escape = \&Latin10::escape;
369 212 *Char::escape_token = \&Latin10::escape_token;
370 212 *Char::escape_script = \&Latin10::escape_script;
371 }
372  
373 # P.230 Care with Prototypes
374 # in Chapter 6: Subroutines
375 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
376 #
377 # If you aren't careful, you can get yourself into trouble with prototypes.
378 # But if you are careful, you can do a lot of neat things with them. This is
379 # all very powerful, of course, and should only be used in moderation to make
380 # the world a better place.
381  
382 # P.332 Care with Prototypes
383 # in Chapter 7: Subroutines
384 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
385 #
386 # If you aren't careful, you can get yourself into trouble with prototypes.
387 # But if you are careful, you can do a lot of neat things with them. This is
388 # all very powerful, of course, and should only be used in moderation to make
389 # the world a better place.
390  
391 #
392 # Prototypes of subroutines
393 #
394 0 ▶sub unimport {}
Subroutine unimport: not called CC=1 SCAR=0.0
395 sub Elatin10::split(;$$$);
396 sub Elatin10::tr($$$$;$);
397 sub Elatin10::chop(@);
398 sub Elatin10::index($$;$);
399 sub Elatin10::rindex($$;$);
400 sub Elatin10::lcfirst(@);
401 sub Elatin10::lcfirst_();
402 sub Elatin10::lc(@);
403 sub Elatin10::lc_();
404 sub Elatin10::ucfirst(@);
405 sub Elatin10::ucfirst_();
406 sub Elatin10::uc(@);
407 sub Elatin10::uc_();
408 sub Elatin10::fc(@);
409 sub Elatin10::fc_();
410 sub Elatin10::ignorecase;
411 sub Elatin10::classic_character_class;
412 sub Elatin10::capture;
413 sub Elatin10::chr(;$);
414 sub Elatin10::chr_();
415 sub Elatin10::glob($);
416 sub Elatin10::glob_();
417  
418 sub Latin10::ord(;$);
419 sub Latin10::ord_();
420 sub Latin10::reverse(@);
421 sub Latin10::getc(;*@);
422 sub Latin10::length(;$);
423 sub Latin10::substr($$;$$);
424 sub Latin10::index($$;$);
425 sub Latin10::rindex($$;$);
426 sub Latin10::escape(;$);
427  
428 #
429 # Regexp work
430 #
431 424 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
432 $re_a
433 $re_t
434 $re_n
435 $re_r
436 424 );
437  
438 #
439 # Character class
440 #
441 424 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
442 $dot
443 $dot_s
444 $eD
445 $eS
446 $eW
447 $eH
448 $eV
449 $eR
450 $eN
451 $not_alnum
452 $not_alpha
453 $not_ascii
454 $not_blank
455 $not_cntrl
456 $not_digit
457 $not_graph
458 $not_lower
459 $not_lower_i
460 $not_print
461 $not_punct
462 $not_space
463 $not_upper
464 $not_upper_i
465 $not_word
466 $not_xdigit
467 $eb
468 $eB
469 424 );
470  
471 424 ${Elatin10::dot} = qr{(?>[^\x0A])};
472 424 ${Elatin10::dot_s} = qr{(?>[\x00-\xFF])};
473 424 ${Elatin10::eD} = qr{(?>[^0-9])};
474  
475 # Vertical tabs are now whitespace
476 # \s in a regex now matches a vertical tab in all circumstances.
477 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
478 # ${Elatin10::eS} = qr{(?>[^\x09\x0A \x0C\x0D\x20])};
479 # ${Elatin10::eS} = qr{(?>[^\x09\x0A\x0B\x0C\x0D\x20])};
480 424 ${Elatin10::eS} = qr{(?>[^\s])};
481  
482 424 ${Elatin10::eW} = qr{(?>[^0-9A-Z_a-z])};
483 424 ${Elatin10::eH} = qr{(?>[^\x09\x20])};
484 424 ${Elatin10::eV} = qr{(?>[^\x0A\x0B\x0C\x0D])};
485 424 ${Elatin10::eR} = qr{(?>\x0D\x0A|[\x0A\x0D])};
486 424 ${Elatin10::eN} = qr{(?>[^\x0A])};
487 424 ${Elatin10::not_alnum} = qr{(?>[^\x30-\x39\x41-\x5A\x61-\x7A])};
488 424 ${Elatin10::not_alpha} = qr{(?>[^\x41-\x5A\x61-\x7A])};
489 424 ${Elatin10::not_ascii} = qr{(?>[^\x00-\x7F])};
490 424 ${Elatin10::not_blank} = qr{(?>[^\x09\x20])};
491 424 ${Elatin10::not_cntrl} = qr{(?>[^\x00-\x1F\x7F])};
492 424 ${Elatin10::not_digit} = qr{(?>[^\x30-\x39])};
493 424 ${Elatin10::not_graph} = qr{(?>[^\x21-\x7F])};
494 424 ${Elatin10::not_lower} = qr{(?>[^\x61-\x7A])};
495 424 ${Elatin10::not_lower_i} = qr{(?>[^\x41-\x5A\x61-\x7A])}; # Perl 5.16 compatible
496 # ${Elatin10::not_lower_i} = qr{(?>[\x00-\xFF])}; # older Perl compatible
497 424 ${Elatin10::not_print} = qr{(?>[^\x20-\x7F])};
498 424 ${Elatin10::not_punct} = qr{(?>[^\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E])};
499 424 ${Elatin10::not_space} = qr{(?>[^\s\x0B])};
500 424 ${Elatin10::not_upper} = qr{(?>[^\x41-\x5A])};
501 424 ${Elatin10::not_upper_i} = qr{(?>[^\x41-\x5A\x61-\x7A])}; # Perl 5.16 compatible
502 # ${Elatin10::not_upper_i} = qr{(?>[\x00-\xFF])}; # older Perl compatible
503 424 ${Elatin10::not_word} = qr{(?>[^\x30-\x39\x41-\x5A\x5F\x61-\x7A])};
504 424 ${Elatin10::not_xdigit} = qr{(?>[^\x30-\x39\x41-\x46\x61-\x66])};
505 424 ${Elatin10::eb} = qr{(?:\A(?=[0-9A-Z_a-z])|(?<=[\x00-\x2F\x40\x5B-\x5E\x60\x7B-\xFF])(?=[0-9A-Z_a-z])|(?<=[0-9A-Z_a-z])(?=[\x00-\x2F\x40\x5B-\x5E\x60\x7B-\xFF]|\z))};
506 424 ${Elatin10::eB} = qr{(?:(?<=[0-9A-Z_a-z])(?=[0-9A-Z_a-z])|(?<=[\x00-\x2F\x40\x5B-\x5E\x60\x7B-\xFF])(?=[\x00-\x2F\x40\x5B-\x5E\x60\x7B-\xFF]))};
507  
508 # avoid: Name "Elatin10::foo" used only once: possible typo at here.
509 424 ${Elatin10::dot} = ${Elatin10::dot};
510 424 ${Elatin10::dot_s} = ${Elatin10::dot_s};
511 424 ${Elatin10::eD} = ${Elatin10::eD};
512 424 ${Elatin10::eS} = ${Elatin10::eS};
513 424 ${Elatin10::eW} = ${Elatin10::eW};
514 424 ${Elatin10::eH} = ${Elatin10::eH};
515 424 ${Elatin10::eV} = ${Elatin10::eV};
516 424 ${Elatin10::eR} = ${Elatin10::eR};
517 424 ${Elatin10::eN} = ${Elatin10::eN};
518 424 ${Elatin10::not_alnum} = ${Elatin10::not_alnum};
519 424 ${Elatin10::not_alpha} = ${Elatin10::not_alpha};
520 424 ${Elatin10::not_ascii} = ${Elatin10::not_ascii};
521 424 ${Elatin10::not_blank} = ${Elatin10::not_blank};
522 424 ${Elatin10::not_cntrl} = ${Elatin10::not_cntrl};
523 424 ${Elatin10::not_digit} = ${Elatin10::not_digit};
524 424 ${Elatin10::not_graph} = ${Elatin10::not_graph};
525 424 ${Elatin10::not_lower} = ${Elatin10::not_lower};
526 424 ${Elatin10::not_lower_i} = ${Elatin10::not_lower_i};
527 424 ${Elatin10::not_print} = ${Elatin10::not_print};
528 424 ${Elatin10::not_punct} = ${Elatin10::not_punct};
529 424 ${Elatin10::not_space} = ${Elatin10::not_space};
530 424 ${Elatin10::not_upper} = ${Elatin10::not_upper};
531 424 ${Elatin10::not_upper_i} = ${Elatin10::not_upper_i};
532 424 ${Elatin10::not_word} = ${Elatin10::not_word};
533 424 ${Elatin10::not_xdigit} = ${Elatin10::not_xdigit};
534 424 ${Elatin10::eb} = ${Elatin10::eb};
535 424 ${Elatin10::eB} = ${Elatin10::eB};
536  
537 #
538 # Latin-10 split
539 #
540 72 ▶sub Elatin10::split(;$$$) {
Subroutine split: called CC=34 SCAR=38.5
Pod undocumented
541  
542 # P.794 29.2.161. split
543 # in Chapter 29: Functions
544 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
545  
546 # P.951 split
547 # in Chapter 27: Functions
548 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
549  
550 72 my $pattern = $_[0];
551 72 my $string = $_[1];
552 72 my $limit = $_[2];
553  
554 # if $pattern is also omitted or is the literal space, " "
555 72 ▶ if (not defined $pattern) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $pattern) 2 70 72
556 2 $pattern = ' ';
557 }
558  
559 # if $string is omitted, the function splits the $_ string
560 72 ▶ if (not defined $string) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $string) 6 66 72
561 6 ▶ if (defined $_) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_) { } 0 6 6
562 0 $string = $_;
563 }
564 else {
565 6 $string = '';
566 }
567 }
568  
569 72 my @split = ();
570  
571 # when string is empty
572 72 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 10 62 72
elsif ($pattern eq ' ') { } 2 60 62
573  
574 # resulting list value in list context
575 10 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 5 5 10
576 5 return @split;
577 }
578  
579 # count of substrings in scalar context
580 else {
581 5 ▶ carp "Use of implicit split to \@_ is deprecated" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 5 5
582 5 @_ = @split;
583 5 return scalar @_;
584 }
585 }
586  
587 # split's first argument is more consistently interpreted
588 #
589 # After some changes earlier in v5.17, split's behavior has been simplified:
590 # if the PATTERN argument evaluates to a string containing one space, it is
591 # treated the way that a literal string containing one space once was.
592 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#split's_first_argument_is_more_consistently_interpreted
593  
594 # if $pattern is also omitted or is the literal space, " ", the function splits
595 # on whitespace, /\s+/, after skipping any leading whitespace
596 # (and so on)
597  
598 elsif ($pattern eq ' ') {
599 2 ▶ if (not defined $limit) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $limit) { } 2 0 2
600 2 return CORE::split(' ', $string);
601 }
602 else {
603 0 return CORE::split(' ', $string, $limit);
604 }
605 }
606  
607 # if $limit is negative, it is treated as if an arbitrarily large $limit has been specified
608 60 ▶ if ((not defined $limit) or ($limit <= 0)) {
Branch: 2 branches
BranchTrueFalseTotal
if (not defined $limit or $limit <= 0) { } 60 0 60
elsif ($limit > 0) { } 0 0 0
Condition33%1/3
not defined $limit or $limit <= 0
l!l&&r!l&&!r
6000
MC/DC0%0/2
not defined $limit or $limit <= 0
not defined $limit $limit <= 0
Truth table33%1/3
not(A) or B
A= not defined $limitB= $limit <= 0
ABresult
1X1
011
000
609  
610 # a pattern capable of matching either the null string or something longer than the
611 # null string will split the value of $string into separate characters wherever it
612 # matches the null string between characters
613 # (and so on)
614  
615 60 ▶ if ('' =~ / \A $pattern \z /xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ('' =~ / \A $pattern \z /msx) { } 2 58 60
616 2 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
617 2 my $limit = scalar(() = $string =~ /($pattern)/oxmsg);
618  
619 # P.1024 Appendix W.10 Multibyte Processing
620 # of ISBN 1-56592-224-7 CJKV Information Processing
621 # (and so on)
622  
623 # the //m modifier is assumed when you split on the pattern /^/
624 # (and so on)
625  
626 2 ▶ eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
Subroutine BEGIN: called CC=1 SCAR=0.0
627 # V
628 2 ▶ while ((--$limit > 0) and ($string =~ s/\A((?:$q_char)+?)$pattern//m)) {
Branch: 1 branch
BranchTrueFalseTotal
if (--$limit > 0 and $string =~ s/\A((?:$Elatin10::q_char)+?)$pattern//m) 9 2 11
Condition100%3/3
--$limit > 0 and $string =~ s/\A((?:$Elatin10::q_char)+?)$pattern//m
!ll&&!rl&&r
119
MC/DC100%2/2
--$limit > 0 and $string =~ s/\A((?:$Elatin10::q_char)+?)$pattern//m
--$limit > 0 $string =~ s/\A((?:$Elatin10::q_char)+?)$pattern//m
Truth table100%3/3
A and B
A= --$limit > 0B= $string =~ s/\A((?:$Elatin10::q_char)+?)$pattern//m
ABresult
0X0
100
111
629  
630 # if the $pattern contains parentheses, then the substring matched by each pair of parentheses
631 # is included in the resulting list, interspersed with the fields that are ordinarily returned
632 # (and so on)
633  
634 9 local $@;
635 9 ▶ eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
636 9 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 9 9 18
637 9 push @split, CORE::eval('$' . $digit);
638 }
639 }
640 }
641  
642 else {
643 58 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
644  
645 58 ▶ eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
646 # V
647 58 ▶ while ($string =~ s/\A((?:$q_char)*?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Elatin10::q_char)*?)$pattern//m) 163 58 221
648 163 local $@;
649 163 ▶ eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
650 163 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 230 163 393
651 230 push @split, CORE::eval('$' . $digit);
652 }
653 }
654 }
655 }
656  
657 elsif ($limit > 0) {
658 0 ▶ if ('' =~ / \A $pattern \z /xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ('' =~ / \A $pattern \z /msx) { } 0 0 0
659 0 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
660 0 ▶ while ((--$limit > 0) and (CORE::length($string) > 0)) {
Branch: 1 branch
BranchTrueFalseTotal
if (--$limit > 0 and length $string > 0) 0 0 0
Condition0%0/3
--$limit > 0 and length $string > 0
!ll&&!rl&&r
000
MC/DC0%0/2
--$limit > 0 and length $string > 0
--$limit > 0 length $string > 0
Truth table0%0/3
A and B
A= --$limit > 0B= length $string > 0
ABresult
0X0
100
111
661  
662 0 eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
663 # V
664 0 ▶ if ($string =~ s/\A((?:$q_char)+?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Elatin10::q_char)+?)$pattern//m) 0 0 0
665 0 local $@;
666 0 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 0 0 0
667 0 push @split, CORE::eval('$' . $digit);
668 }
669 }
670 }
671 }
672 else {
673 0 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
674 0 ▶ while ((--$limit > 0) and (CORE::length($string) > 0)) {
Branch: 1 branch
BranchTrueFalseTotal
if (--$limit > 0 and length $string > 0) 0 0 0
Condition0%0/3
--$limit > 0 and length $string > 0
!ll&&!rl&&r
000
MC/DC0%0/2
--$limit > 0 and length $string > 0
--$limit > 0 length $string > 0
Truth table0%0/3
A and B
A= --$limit > 0B= length $string > 0
ABresult
0X0
100
111
675  
676 0 eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
677 # V
678 0 ▶ if ($string =~ s/\A((?:$q_char)*?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Elatin10::q_char)*?)$pattern//m) 0 0 0
679 0 local $@;
680 0 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 0 0 0
681 0 push @split, CORE::eval('$' . $digit);
682 }
683 }
684 }
685 }
686 }
687  
688 60 ▶ if (CORE::length($string) > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $string > 0) 58 2 60
689 58 push @split, $string;
690 }
691  
692 # if $_[2] (NOT "$limit") is omitted or zero, trailing null fields are stripped from the result
693 60 ▶ if ((not defined $_[2]) or ($_[2] == 0)) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $_[2] or $_[2] == 0) 60 0 60
Condition33%1/3
not defined $_[2] or $_[2] == 0
l!l&&r!l&&!r
6000
MC/DC0%0/2
not defined $_[2] or $_[2] == 0
not defined $_[2] $_[2] == 0
Truth table33%1/3
not(A) or B
A= not defined $_[2]B= $_[2] == 0
ABresult
1X1
011
000
694 60 ▶ while ((scalar(@split) >= 1) and ($split[-1] eq '')) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @split >= 1 and $split[-1] eq "") 0 60 60
Condition33%1/3
scalar @split >= 1 and $split[-1] eq ""
!ll&&!rl&&r
0600
MC/DC0%0/2
scalar @split >= 1 and $split[-1] eq ""
scalar @split >= 1 $split[-1] eq ""
Truth table33%1/3
A and B
A= scalar @split >= 1B= $split[-1] eq ""
ABresult
0X0
100
111
695 0 pop @split;
696 }
697 }
698  
699 # resulting list value in list context
700 60 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 58 2 60
701 58 return @split;
702 }
703  
704 # count of substrings in scalar context
705 else {
706 2 ▶ carp "Use of implicit split to \@_ is deprecated" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 2 2
707 2 @_ = @split;
708 2 return scalar @_;
709 }
710 }
711  
712 #
713 # get last subexpression offsets
714 #
715 60 ▶sub _last_subexpression_offsets {
Subroutine _last_subexpression_offsets: called CC=3 SCAR=11.0
716 60 my $pattern = $_[0];
717  
718 # remove comment
719 60 $pattern =~ s/\(\?\# .*? \)//oxmsg;
720  
721 60 my $modifier = '';
722 60 ▶ if ($pattern =~ /\(\?\^? ([\-A-Za-z]+) :/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pattern =~ /\(\?\^? ([\-A-Za-z]+) :/mosx) 11 49 60
723 11 $modifier = $1;
724 11 $modifier =~ s/-[A-Za-z]*//;
725 }
726  
727 # with /x modifier
728 60 my @char = ();
729 60 ▶ if ($modifier =~ /x/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /x/mosx) { } 5 55 60
730 5 @char = $pattern =~ /\G((?>
731 [^\\\#\[\(] |
732 \\ $q_char |
733 \# (?>[^\n]*) $ |
734 \[ (?>(?:[^\\\]]|\\\\|\\\]|$q_char)+) \] |
735 \(\? |
736 $q_char
737 ))/oxmsg;
738 }
739  
740 # without /x modifier
741 else {
742 55 @char = $pattern =~ /\G((?>
743 [^\\\[\(] |
744 \\ $q_char |
745 \[ (?>(?:[^\\\]]|\\\\|\\\]|$q_char)+) \] |
746 \(\? |
747 $q_char
748 ))/oxmsg;
749 }
750  
751 60 return scalar grep { $_ eq '(' } @char;
752 }
753  
754 #
755 # Latin-10 transliteration (tr///)
756 #
757 6 ▶sub Elatin10::tr($$$$;$) {
Subroutine tr: called CC=26 SCAR=48.6
Pod undocumented
758  
759 6 my $bind_operator = $_[1];
760 6 my $searchlist = $_[2];
761 6 my $replacementlist = $_[3];
762 6 ▶ my $modifier = $_[4] || '';
Condition100%2/2
$_[4] || ''
l!l
51
MC/DC100%1/1
$_[4] || ''
$_[4]
Truth table100%2/2
A
A= $_[4]
Aresult
11
00
763  
764 6 ▶ if ($modifier =~ /r/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /r/mosx) 5 1 6
765 5 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) 0 5 5
766 0 croak "Using !~ with tr///r doesn't make sense";
767 }
768 }
769  
770 6 my @char = $_[0] =~ /\G (?>$q_char) /oxmsg;
771 6 my @searchlist = _charlist_tr($searchlist);
772 6 my @replacementlist = _charlist_tr($replacementlist);
773  
774 6 my %tr = ();
775 6 ▶ for (my $i=0; $i <= $#searchlist; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#searchlist) 19 6 25
776 19 ▶ if (not exists $tr{$searchlist[$i]}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $tr{$searchlist[$i]}) 19 0 19
777 19 ▶ if (defined $replacementlist[$i] and ($replacementlist[$i] ne '')) {
Branch: 3 branches
BranchTrueFalseTotal
if (defined $replacementlist[$i] and $replacementlist[$i] ne '') { } 19 0 19
elsif ($modifier =~ /d/mosx) { } 0 0 0
elsif (defined $replacementlist[-1] and $replacementlist[-1] ne '') { } 0 0 0
Condition33%1/3
defined $replacementlist[$i] and $replacementlist[$i] ne ""
!ll&&!rl&&r
0019
MC/DC0%0/2
defined $replacementlist[$i] and $replacementlist[$i] ne ""
defined $replacementlist[$i] $replacementlist[$i] ne ""
Truth table33%1/3
A and B
A= defined $replacementlist[$i]B= $replacementlist[$i] ne ""
ABresult
0X0
100
111
778 19 $tr{$searchlist[$i]} = $replacementlist[$i];
779 }
780 elsif ($modifier =~ /d/oxms) {
781 0 $tr{$searchlist[$i]} = '';
782 }
783 ▶ elsif (defined $replacementlist[-1] and ($replacementlist[-1] ne '')) {
Condition0%0/3
defined $replacementlist[-1] and $replacementlist[-1] ne ""
!ll&&!rl&&r
000
MC/DC0%0/2
defined $replacementlist[-1] and $replacementlist[-1] ne ""
defined $replacementlist[-1] $replacementlist[-1] ne ""
Truth table0%0/3
A and B
A= defined $replacementlist[-1]B= $replacementlist[-1] ne ""
ABresult
0X0
100
111
784 0 $tr{$searchlist[$i]} = $replacementlist[-1];
785 }
786 else {
787 0 $tr{$searchlist[$i]} = $searchlist[$i];
788 }
789 }
790 }
791  
792 6 my $tr = 0;
793 6 my $replaced = '';
794 6 ▶ if ($modifier =~ /c/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /c/mosx) { } 0 6 6
795 0 ▶ while (defined(my $char = shift @char)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $char = shift @char)) 0 0 0
796 0 ▶ if (not exists $tr{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $tr{$char}) { } 0 0 0
797 0 ▶ if (defined $replacementlist[-1]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $replacementlist[-1]) 0 0 0
798 0 $replaced .= $replacementlist[-1];
799 }
800 0 $tr++;
801 0 ▶ if ($modifier =~ /s/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/mosx) 0 0 0
802 0 ▶ while (@char and (not exists $tr{$char[0]})) {
Branch: 1 branch
BranchTrueFalseTotal
if (@char and not exists $tr{$char[0]}) 0 0 0
Condition0%0/3
@char and not exists $tr{$char[0]}
!ll&&!rl&&r
000
MC/DC0%0/2
@char and not exists $tr{$char[0]}
@char not exists $tr{$char[0]}
Truth table0%0/3
A and not(B)
A= @charB= not exists $tr{$char[0]}
ABresult
0X0
100
111
803 0 shift @char;
804 0 $tr++;
805 }
806 }
807 }
808 else {
809 0 $replaced .= $char;
810 }
811 }
812 }
813 else {
814 6 ▶ while (defined(my $char = shift @char)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $char = shift @char)) 36 6 42
815 36 ▶ if (exists $tr{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $tr{$char}) { } 19 17 36
816 19 $replaced .= $tr{$char};
817 19 $tr++;
818 19 ▶ if ($modifier =~ /s/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/mosx) 0 19 19
819 0 ▶ while (@char and (exists $tr{$char[0]}) and ($tr{$char[0]} eq $tr{$char})) {
Branch: 1 branch
BranchTrueFalseTotal
if (@char and exists $tr{$char[0]} and $tr{$char[0]} eq $tr{$char}) 0 0 0
Condition0%0/6
@char and exists $tr{$char[0]} and $tr{$char[0]} eq $tr{$char}
!ll&&!rl&&r
000
@char and exists $tr{$char[0]}
!ll&&!rl&&r
000
MC/DC0%0/3
@char and exists $tr{$char[0]} and $tr{$char[0]} eq $tr{$char}
@char exists $tr{$char[0]} $tr{$char[0]} eq $tr{$char}
Truth table0%0/4
A and B and C
A= @charB= exists $tr{$char[0]}C= $tr{$char[0]} eq $tr{$char}
ABCresult
0XX0
10X0
1100
1111
820 0 shift @char;
821 0 $tr++;
822 }
823 }
824 }
825 else {
826 17 $replaced .= $char;
827 }
828 }
829 }
830  
831 6 ▶ if ($modifier =~ /r/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /r/mosx) { } 5 1 6
832 5 return $replaced;
833 }
834 else {
835 1 $_[0] = $replaced;
836 1 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) { } 0 1 1
837 0 return not $tr;
838 }
839 else {
840 1 return $tr;
841 }
842 }
843 }
844  
845 #
846 # Latin-10 chop
847 #
848 0 ▶sub Elatin10::chop(@) {
Subroutine chop: not called CC=3 SCAR=24.8
Pod undocumented
849  
850 0 my $chop;
851 0 ▶ if (@_ == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 0) { } 0 0 0
852 0 my @char = /\G (?>$q_char) /oxmsg;
853 0 $chop = pop @char;
854 0 $_ = join '', @char;
855 }
856 else {
857 0 for (@_) {
858 0 my @char = /\G (?>$q_char) /oxmsg;
859 0 $chop = pop @char;
860 0 $_ = join '', @char;
861 }
862 }
863 0 return $chop;
864 }
865  
866 #
867 # Latin-10 index by octet
868 #
869 30 ▶sub Elatin10::index($$;$) {
Subroutine index: called CC=6 SCAR=20.8
Pod documented
870  
871 30 my($str,$substr,$position) = @_;
872 30 ▶ $position ||= 0;
Condition50%1/2
$position ||= 0
l!l
030
MC/DC0%0/1
$position ||= 0
$position
Truth table50%1/2
A
A= $position
Aresult
11
00
873 30 my $pos = 0;
874  
875 30 ▶ while ($pos < CORE::length($str)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos < length $str) 130 30 160
876 130 ▶ if (CORE::substr($str,$pos,CORE::length($substr)) eq $substr) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($str, $pos, length $substr) eq $substr) 0 130 130
877 0 ▶ if ($pos >= $position) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos >= $position) 0 0 0
878 0 return $pos;
879 }
880 }
881 130 ▶ if (CORE::substr($str,$pos) =~ /\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($str, $pos) =~ /\A ($Elatin10::q_char) /mosx) { } 130 0 130
882 130 $pos += CORE::length($1);
883 }
884 else {
885 0 $pos += 1;
886 }
887 }
888 30 return -1;
889 }
890  
891 #
892 # Latin-10 reverse index
893 #
894 0 ▶sub Elatin10::rindex($$;$) {
Subroutine rindex: not called CC=6 SCAR=37.4
Pod undocumented
895  
896 0 my($str,$substr,$position) = @_;
897 0 ▶ $position ||= CORE::length($str) - 1;
Condition0%0/3
$position ||= length($str) - 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$position ||= length($str) - 1
$position length($str) - 1
Truth table0%0/3
A ||= B
A= $positionB= length($str) - 1
ABresult
1X1
011
000
898 0 my $pos = 0;
899 0 my $rindex = -1;
900  
901 0 ▶ while (($pos < CORE::length($str)) and ($pos <= $position)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos < length $str and $pos <= $position) 0 0 0
Condition0%0/3
$pos < length $str and $pos <= $position
!ll&&!rl&&r
000
MC/DC0%0/2
$pos < length $str and $pos <= $position
$pos < length $str $pos <= $position
Truth table0%0/3
A and B
A= $pos < length $strB= $pos <= $position
ABresult
0X0
100
111
902 0 ▶ if (CORE::substr($str,$pos,CORE::length($substr)) eq $substr) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($str, $pos, length $substr) eq $substr) 0 0 0
903 0 $rindex = $pos;
904 }
905 0 ▶ if (CORE::substr($str,$pos) =~ /\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($str, $pos) =~ /\A ($Elatin10::q_char) /mosx) { } 0 0 0
906 0 $pos += CORE::length($1);
907 }
908 else {
909 0 $pos += 1;
910 }
911 }
912 0 return $rindex;
913 }
914  
915 #
916 # Latin-10 lower case first with parameter
917 #
918 0 ▶sub Elatin10::lcfirst(@) {
Subroutine lcfirst: not called CC=4 SCAR=30.0
Pod undocumented
919 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
920 0 my $s = shift @_;
921 0 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 0 0
Condition0%0/3
@_ and wantarray
!ll&&!rl&&r
000
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table0%0/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
922 0 return Elatin10::lc(CORE::substr($s,0,1)) . CORE::substr($s,1), @_;
923 }
924 else {
925 0 return Elatin10::lc(CORE::substr($s,0,1)) . CORE::substr($s,1);
926 }
927 }
928 else {
929 0 return Elatin10::lc(CORE::substr($_,0,1)) . CORE::substr($_,1);
930 }
931 }
932  
933 #
934 # Latin-10 lower case first without parameter
935 #
936 0 ▶sub Elatin10::lcfirst_() {
Subroutine lcfirst_: not called CC=1 SCAR=6.9
Pod undocumented
937 0 return Elatin10::lc(CORE::substr($_,0,1)) . CORE::substr($_,1);
938 }
939  
940 #
941 # Latin-10 lower case with parameter
942 #
943 68 ▶sub Elatin10::lc(@) {
Subroutine lc: called CC=6 SCAR=24.2
Pod undocumented
944 68 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 68 0 68
945 68 my $s = shift @_;
946 68 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 68 68
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
6800
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
947 0 ▶ return join('', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 0 0 0
948 }
949 else {
950 68 ▶ return join('', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 70 0 70
951 }
952 }
953 else {
954 0 return Elatin10::lc_();
955 }
956 }
957  
958 #
959 # Latin-10 lower case without parameter
960 #
961 0 ▶sub Elatin10::lc_() {
Subroutine lc_: not called CC=2 SCAR=17.9
Pod undocumented
962 0 my $s = $_;
963 0 ▶ return join '', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 0 0 0
964 }
965  
966 #
967 # Latin-10 upper case first with parameter
968 #
969 0 ▶sub Elatin10::ucfirst(@) {
Subroutine ucfirst: not called CC=4 SCAR=30.0
Pod undocumented
970 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
971 0 my $s = shift @_;
972 0 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 0 0
Condition0%0/3
@_ and wantarray
!ll&&!rl&&r
000
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table0%0/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
973 0 return Elatin10::uc(CORE::substr($s,0,1)) . CORE::substr($s,1), @_;
974 }
975 else {
976 0 return Elatin10::uc(CORE::substr($s,0,1)) . CORE::substr($s,1);
977 }
978 }
979 else {
980 0 return Elatin10::uc(CORE::substr($_,0,1)) . CORE::substr($_,1);
981 }
982 }
983  
984 #
985 # Latin-10 upper case first without parameter
986 #
987 0 ▶sub Elatin10::ucfirst_() {
Subroutine ucfirst_: not called CC=1 SCAR=6.9
Pod undocumented
988 0 return Elatin10::uc(CORE::substr($_,0,1)) . CORE::substr($_,1);
989 }
990  
991 #
992 # Latin-10 upper case with parameter
993 #
994 2572 ▶sub Elatin10::uc(@) {
Subroutine uc: called CC=6 SCAR=22.9
Pod undocumented
995 2572 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2572 0 2572
996 2572 my $s = shift @_;
997 2572 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 2572 2572
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
257200
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
998 0 ▶ return join('', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 0 0 0
999 }
1000 else {
1001 2572 ▶ return join('', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 919 1655 2574
1002 }
1003 }
1004 else {
1005 0 return Elatin10::uc_();
1006 }
1007 }
1008  
1009 #
1010 # Latin-10 upper case without parameter
1011 #
1012 0 ▶sub Elatin10::uc_() {
Subroutine uc_: not called CC=2 SCAR=17.9
Pod undocumented
1013 0 my $s = $_;
1014 0 ▶ return join '', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 0 0 0
1015 }
1016  
1017 #
1018 # Latin-10 fold case with parameter
1019 #
1020 2575 ▶sub Elatin10::fc(@) {
Subroutine fc: called CC=6 SCAR=22.9
Pod undocumented
1021 2575 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2575 0 2575
1022 2575 my $s = shift @_;
1023 2575 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 2575 2575
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
257500
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
1024 0 ▶ return join('', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 0 0 0
1025 }
1026 else {
1027 2575 ▶ return join('', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 2001 6275 8276
1028 }
1029 }
1030 else {
1031 0 return Elatin10::fc_();
1032 }
1033 }
1034  
1035 #
1036 # Latin-10 fold case without parameter
1037 #
1038 0 ▶sub Elatin10::fc_() {
Subroutine fc_: not called CC=2 SCAR=17.9
Pod undocumented
1039 0 my $s = $_;
1040 0 ▶ return join '', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 0 0 0
1041 }
1042  
1043 #
1044 # Latin-10 regexp capture
1045 #
1046 {
1047 0 ▶ sub Elatin10::capture {
Subroutine capture: not called CC=1 SCAR=6.9
Pod documented
1048 0 return $_[0];
1049 }
1050 }
1051  
1052 #
1053 # Latin-10 regexp ignore case modifier
1054 #
1055 424 ▶sub Elatin10::ignorecase {
Subroutine ignorecase: called CC=25 SCAR=52.1
Pod undocumented
1056  
1057 11 my @string = @_;
1058 11 my $metachar = qr/[\@\\|[\]{]/oxms;
1059  
1060 # ignore case of $scalar or @array
1061 11 for my $string (@string) {
1062  
1063 # split regexp
1064 11 my @char = $string =~ /\G (?>\[\^|\\$q_char|$q_char) /oxmsg;
1065  
1066 # unescape character
1067 11 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1100 11 1111
1068 1100 ▶ next if not defined $char[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $char[$i] 0 1100 1100
1069  
1070 # open character class [...]
1071 1100 ▶ if ($char[$i] eq '[') {
Branch: 4 branches
BranchTrueFalseTotal
if ($char[$i] eq '[') { } 0 1100 1100
elsif ($char[$i] eq '[^') { } 0 1100 1100
elsif (my $char = classic_character_class($char[$i])) { } 0 1100 1100
elsif ($char[$i] =~ /\A [\x00-\xFF] \z/mosx) { } 1100 0 1100
1072 0 my $left = $i;
1073  
1074 # [] make die "unmatched [] in regexp ...\n"
1075  
1076 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
1077 0 $i++;
1078 }
1079  
1080 0 while (1) {
1081 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
1082 0 croak "Unmatched [] in regexp";
1083 }
1084 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
1085 0 my $right = $i;
1086 0 my @charlist = charlist_qr(@char[$left+1..$right-1], 'i');
1087  
1088 # escape character
1089 0 for my $char (@charlist) {
1090 0 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $char =~ /\A [.|)] \z/mosx }) 0 0 0
1091 }
1092  
1093 0 elsif ($char =~ /\A [.|)] \z/oxms) {
1094 0 $char = '\\' . $char;
1095 }
1096 }
1097  
1098 # [...]
1099 0 splice @char, $left, $right-$left+1, '(?:' . join('|', @charlist) . ')';
1100  
1101 0 $i = $left;
1102 0 last;
1103 }
1104 }
1105 }
1106  
1107 # open character class [^...]
1108 elsif ($char[$i] eq '[^') {
1109 0 my $left = $i;
1110  
1111 # [^] make die "unmatched [] in regexp ...\n"
1112  
1113 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
1114 0 $i++;
1115 }
1116  
1117 0 while (1) {
1118 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
1119 0 croak "Unmatched [] in regexp";
1120 }
1121 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
1122 0 my $right = $i;
1123 0 my @charlist = charlist_not_qr(@char[$left+1..$right-1], 'i');
1124  
1125 # escape character
1126 0 for my $char (@charlist) {
1127 0 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $char =~ /\A [.|)] \z/mosx }) 0 0 0
1128 }
1129  
1130 0 elsif ($char =~ /\A [.|)] \z/oxms) {
1131 0 $char = '\\' . $char;
1132 }
1133 }
1134  
1135 # [^...]
1136 0 splice @char, $left, $right-$left+1, '(?!' . join('|', @charlist) . ")(?:$your_char)";
1137  
1138 0 $i = $left;
1139 0 last;
1140 }
1141 }
1142 }
1143  
1144 # rewrite classic character class or escape character
1145 elsif (my $char = classic_character_class($char[$i])) {
1146 0 $char[$i] = $char;
1147 }
1148  
1149 # with /i modifier
1150 elsif ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) {
1151 1100 my $uc = Elatin10::uc($char[$i]);
1152 1100 my $fc = Elatin10::fc($char[$i]);
1153 1100 ▶ if ($uc ne $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc ne $fc) 564 536 1100
1154 564 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 561 3 564
1155 561 $char[$i] = '[' . $uc . $fc . ']';
1156 }
1157 else {
1158 3 $char[$i] = '(?:' . $uc . '|' . $fc . ')';
1159 }
1160 }
1161 }
1162 }
1163  
1164 # characterize
1165 11 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1100 11 1111
1166 1100 ▶ next if not defined $char[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $char[$i] 0 1100 1100
1167  
1168 1100 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx }) 0 1111 1111
1169 }
1170  
1171 # quote character before ? + * {
1172 0 ▶ elsif (($i >= 1) and ($char[$i] =~ /\A [\?\+\*\{] \z/oxms)) {
Condition66%2/3
$i >= 1 && $char[$i] =~ /\A [\?\+\*\{] \z/mosx
!ll&&!rl&&r
1110890
MC/DC0%0/2
$i >= 1 && $char[$i] =~ /\A [\?\+\*\{] \z/mosx
$i >= 1 $char[$i] =~ /\A [\?\+\*\{] \z/mosx
Truth table66%2/3
A && B
A= $i >= 1B= $char[$i] =~ /\A [\?\+\*\{] \z/mosx
ABresult
0X0
100
111
1173 0 ▶ if ($char[$i-1] !~ /\A [\x00-\xFF] \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($char[$i - 1] =~ /\A [\x00-\xFF] \z/mosx) 0 0 0
1174 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
1175 }
1176 }
1177 }
1178  
1179 11 $string = join '', @char;
1180 }
1181  
1182 # make regexp string
1183 11 return @string;
1184 }
1185  
1186 #
1187 # classic character class ( \D \S \W \d \s \w \C \X \H \V \h \v \R \N \b \B )
1188 #
1189 2968 ▶sub Elatin10::classic_character_class {
Subroutine classic_character_class: called CC=2 SCAR=6.9
Pod undocumented
1190 2968 my($char) = @_;
1191  
1192 return {
1193 '\D' => '${Elatin10::eD}',
1194 '\S' => '${Elatin10::eS}',
1195 '\W' => '${Elatin10::eW}',
1196 '\d' => '[0-9]',
1197  
1198 # Before Perl 5.6, \s only matched the five whitespace characters
1199 # tab, newline, form-feed, carriage return, and the space character
1200 # itself, which, taken together, is the character class [\t\n\f\r ].
1201  
1202 # Vertical tabs are now whitespace
1203 # \s in a regex now matches a vertical tab in all circumstances.
1204 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
1205 # \t \n \v \f \r space
1206 # '\s' => '[\x09\x0A \x0C\x0D\x20]',
1207 # '\s' => '[\x09\x0A\x0B\x0C\x0D\x20]',
1208 '\s' => '\s',
1209  
1210 '\w' => '[0-9A-Z_a-z]',
1211 '\C' => '[\x00-\xFF]',
1212 '\X' => 'X',
1213  
1214 # \h \v \H \V
1215  
1216 # P.114 Character Class Shortcuts
1217 # in Chapter 7: In the World of Regular Expressions
1218 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
1219  
1220 # P.357 13.2.3 Whitespace
1221 # in Chapter 13: perlrecharclass: Perl Regular Expression Character Classes
1222 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
1223 #
1224 # 0x00009 CHARACTER TABULATION h s
1225 # 0x0000a LINE FEED (LF) vs
1226 # 0x0000b LINE TABULATION v
1227 # 0x0000c FORM FEED (FF) vs
1228 # 0x0000d CARRIAGE RETURN (CR) vs
1229 # 0x00020 SPACE h s
1230  
1231 # P.196 Table 5-9. Alphanumeric regex metasymbols
1232 # in Chapter 5. Pattern Matching
1233 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1234  
1235 # (and so on)
1236  
1237 '\H' => '${Elatin10::eH}',
1238 '\V' => '${Elatin10::eV}',
1239 '\h' => '[\x09\x20]',
1240 '\v' => '[\x0A\x0B\x0C\x0D]',
1241 '\R' => '${Elatin10::eR}',
1242  
1243 # \N
1244 #
1245 # http://perldoc.perl.org/perlre.html
1246 # Character Classes and other Special Escapes
1247 # Any character but \n (experimental). Not affected by /s modifier
1248  
1249 '\N' => '${Elatin10::eN}',
1250  
1251 # \b \B
1252  
1253 # P.180 Boundaries: The \b and \B Assertions
1254 # in Chapter 5: Pattern Matching
1255 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
1256  
1257 # P.219 Boundaries: The \b and \B Assertions
1258 # in Chapter 5: Pattern Matching
1259 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1260  
1261 # \b really means (?:(?<=\w)(?!\w)|(?<!\w)(?=\w))
1262 # or (?:(?<=\A|\W)(?=\w)|(?<=\w)(?=\W|\z))
1263 '\b' => '${Elatin10::eb}',
1264  
1265 # \B really means (?:(?<=\w)(?=\w)|(?<!\w)(?!\w))
1266 # or (?:(?<=\w)(?=\w)|(?<=\W)(?=\W))
1267 '\B' => '${Elatin10::eB}',
1268  
1269 2968 ▶ }->{$char} || '';
Condition100%2/2
{'\\D', '${Elatin10::eD}', '\\S', '${Elatin10::eS}', '\\W', '${Elatin10::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin10::eH}', '\\V', '${Elatin10::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin10::eR}', '\\N', '${Elatin10::eN}', '\\b', '${Elatin10::eb}', '\\B', '${Elatin10::eB}'}->{$char} || ''
l!l
1012867
MC/DC100%1/1
{'\\D', '${Elatin10::eD}', '\\S', '${Elatin10::eS}', '\\W', '${Elatin10::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin10::eH}', '\\V', '${Elatin10::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin10::eR}', '\\N', '${Elatin10::eN}', '\\b', '${Elatin10::eb}', '\\B', '${Elatin10::eB}'}->{$char} || ''
{'\\D', '${Elatin10::eD}', '\\S', '${Elatin10::eS}', '\\W', '${Elatin10::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin10::eH}', '\\V', '${Elatin10::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin10::eR}', '\\N', '${Elatin10::eN}', '\\b', '${Elatin10::eb}', '\\B', '${Elatin10::eB}'}->{$char}
Truth table100%2/2
A
A= {'\\D', '${Elatin10::eD}', '\\S', '${Elatin10::eS}', '\\W', '${Elatin10::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin10::eH}', '\\V', '${Elatin10::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin10::eR}', '\\N', '${Elatin10::eN}', '\\b', '${Elatin10::eb}', '\\B', '${Elatin10::eB}'}->{$char}
Aresult
11
00
1270 }
1271  
1272 #
1273 # prepare Latin-10 characters per length
1274 #
1275  
1276 # 1 octet characters
1277 424 my @chars1 = ();
1278 0 ▶sub chars1 {
Subroutine chars1: not called CC=5 SCAR=34.0
Pod undocumented
1279 0 ▶ if (@chars1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars1) 0 0 0
1280 0 return @chars1;
1281 }
1282 0 ▶ if (exists $range_tr{1}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{1}) 0 0 0
1283 0 my @ranges = @{ $range_tr{1} };
1284 0 ▶ while (my @range = splice(@ranges,0,1)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 1)) 0 0 0
1285 0 for my $oct0 (@{$range[0]}) {
1286 0 push @chars1, pack 'C', $oct0;
1287 }
1288 }
1289 }
1290 0 return @chars1;
1291 }
1292  
1293 # 2 octets characters
1294 424 my @chars2 = ();
1295 0 ▶sub chars2 {
Subroutine chars2: not called CC=6 SCAR=37.4
Pod undocumented
1296 0 ▶ if (@chars2) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars2) 0 0 0
1297 0 return @chars2;
1298 }
1299 0 ▶ if (exists $range_tr{2}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{2}) 0 0 0
1300 0 my @ranges = @{ $range_tr{2} };
1301 0 ▶ while (my @range = splice(@ranges,0,2)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 2)) 0 0 0
1302 0 for my $oct0 (@{$range[0]}) {
1303 0 for my $oct1 (@{$range[1]}) {
1304 0 push @chars2, pack 'CC', $oct0,$oct1;
1305 }
1306 }
1307 }
1308 }
1309 0 return @chars2;
1310 }
1311  
1312 # 3 octets characters
1313 424 my @chars3 = ();
1314 0 ▶sub chars3 {
Subroutine chars3: not called CC=7 SCAR=40.3
Pod undocumented
1315 0 ▶ if (@chars3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars3) 0 0 0
1316 0 return @chars3;
1317 }
1318 0 ▶ if (exists $range_tr{3}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{3}) 0 0 0
1319 0 my @ranges = @{ $range_tr{3} };
1320 0 ▶ while (my @range = splice(@ranges,0,3)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 3)) 0 0 0
1321 0 for my $oct0 (@{$range[0]}) {
1322 0 for my $oct1 (@{$range[1]}) {
1323 0 for my $oct2 (@{$range[2]}) {
1324 0 push @chars3, pack 'CCC', $oct0,$oct1,$oct2;
1325 }
1326 }
1327 }
1328 }
1329 }
1330 0 return @chars3;
1331 }
1332  
1333 # 4 octets characters
1334 424 my @chars4 = ();
1335 0 ▶sub chars4 {
Subroutine chars4: not called CC=8 SCAR=42.8
Pod undocumented
1336 0 ▶ if (@chars4) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars4) 0 0 0
1337 0 return @chars4;
1338 }
1339 0 ▶ if (exists $range_tr{4}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{4}) 0 0 0
1340 0 my @ranges = @{ $range_tr{4} };
1341 0 ▶ while (my @range = splice(@ranges,0,4)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 4)) 0 0 0
1342 0 for my $oct0 (@{$range[0]}) {
1343 0 for my $oct1 (@{$range[1]}) {
1344 0 for my $oct2 (@{$range[2]}) {
1345 0 for my $oct3 (@{$range[3]}) {
1346 0 push @chars4, pack 'CCCC', $oct0,$oct1,$oct2,$oct3;
1347 }
1348 }
1349 }
1350 }
1351 }
1352 }
1353 0 return @chars4;
1354 }
1355  
1356 #
1357 # Latin-10 open character list for tr
1358 #
1359 12 ▶sub _charlist_tr {
Subroutine _charlist_tr: called CC=35 SCAR=66.4
1360  
1361 12 local $_ = shift @_;
1362  
1363 # unescape character
1364 12 my @char = ();
1365 12 ▶ while (not /\G \z/oxmsgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgmosx) 38 12 50
1366 38 ▶ if (/\G (\\0?55|\\x2[Dd]|\\-) /oxmsgc) {
Branch: 7 branches
BranchTrueFalseTotal
if (/\G (\\0?55|\\x2[Dd]|\\-) /cgmosx) { } 0 38 38
elsif (/\G \\ ([0-7]{2,3}) /cgmosx) { } 0 38 38
elsif (/\G \\x ([0-9A-Fa-f]{1,2}) /cgmosx) { } 0 38 38
elsif (/\G \\c ([\x40-\x5F]) /cgmosx) { } 0 38 38
elsif (/\G (\\ [0nrtfbae]) /cgmosx) { } 0 38 38
elsif (/\G \\ ($Elatin10::q_char) /cgmosx) { } 0 38 38
elsif (/\G ($Elatin10::q_char) /cgmosx) { } 38 0 38
1367 0 push @char, '\-';
1368 }
1369 elsif (/\G \\ ([0-7]{2,3}) /oxmsgc) {
1370 0 push @char, CORE::chr(oct $1);
1371 }
1372 elsif (/\G \\x ([0-9A-Fa-f]{1,2}) /oxmsgc) {
1373 0 push @char, CORE::chr(hex $1);
1374 }
1375 elsif (/\G \\c ([\x40-\x5F]) /oxmsgc) {
1376 0 push @char, CORE::chr(CORE::ord($1) & 0x1F);
1377 }
1378 elsif (/\G (\\ [0nrtfbae]) /oxmsgc) {
1379 push @char, {
1380 '\0' => "\0",
1381 '\n' => "\n",
1382 '\r' => "\r",
1383 '\t' => "\t",
1384 '\f' => "\f",
1385 '\b' => "\x08", # \b means backspace in character class
1386 '\a' => "\a",
1387 '\e' => "\e",
1388 0 }->{$1};
1389 }
1390 elsif (/\G \\ ($q_char) /oxmsgc) {
1391 0 push @char, $1;
1392 }
1393 elsif (/\G ($q_char) /oxmsgc) {
1394 38 push @char, $1;
1395 }
1396 }
1397  
1398 # join separated multiple-octet
1399 12 @char = join('',@char) =~ /\G (?>\\-|$q_char) /oxmsg;
1400  
1401 # unescape '-'
1402 12 my @i = ();
1403 12 for my $i (0 .. $#char) {
1404 38 ▶ if ($char[$i] eq '\-') {
Branch: 2 branches
BranchTrueFalseTotal
if ($char[$i] eq '\\-') { } 0 38 38
elsif ($char[$i] eq '-') { } 0 38 38
1405 0 $char[$i] = '-';
1406 }
1407 elsif ($char[$i] eq '-') {
1408 0 ▶ if ((0 < $i) and ($i < $#char)) {
Branch: 1 branch
BranchTrueFalseTotal
if (0 < $i and $i < $#char) 0 0 0
Condition0%0/3
0 < $i and $i < $#char
!ll&&!rl&&r
000
MC/DC0%0/2
0 < $i and $i < $#char
0 < $i $i < $#char
Truth table0%0/3
A and B
A= 0 < $iB= $i < $#char
ABresult
0X0
100
111
1409 0 push @i, $i;
1410 }
1411 }
1412 }
1413  
1414 # open character list (reverse for splice)
1415 12 for my $i (CORE::reverse @i) {
1416 0 my @range = ();
1417  
1418 # range error
1419 0 ▶ if ((CORE::length($char[$i-1]) > CORE::length($char[$i+1])) or ($char[$i-1] gt $char[$i+1])) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $char[$i - 1] > length $char[$i + 1] or $char[$i - 1] gt $char[$i + 1]) 0 0 0
Condition0%0/3
length $char[$i - 1] > length $char[$i + 1] or $char[$i - 1] gt $char[$i + 1]
l!l&&r!l&&!r
000
MC/DC0%0/2
length $char[$i - 1] > length $char[$i + 1] or $char[$i - 1] gt $char[$i + 1]
length $char[$i - 1] > length $char[$i + 1] $char[$i - 1] gt $char[$i + 1]
Truth table0%0/3
A or B
A= length $char[$i - 1] > length $char[$i + 1]B= $char[$i - 1] gt $char[$i + 1]
ABresult
1X1
011
000
1420 0 croak "Invalid tr/// range \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1421 }
1422  
1423 # range of multiple-octet code
1424 0 ▶ if (CORE::length($char[$i-1]) == 1) {
Branch: 4 branches
BranchTrueFalseTotal
if (length $char[$i - 1] == 1) { } 0 0 0
elsif (length $char[$i - 1] == 2) { } 0 0 0
elsif (length $char[$i - 1] == 3) { } 0 0 0
elsif (length $char[$i - 1] == 4) { } 0 0 0
1425 0 ▶ if (CORE::length($char[$i+1]) == 1) {
Branch: 4 branches
BranchTrueFalseTotal
if (length $char[$i + 1] == 1) { } 0 0 0
elsif (length $char[$i + 1] == 2) { } 0 0 0
elsif (length $char[$i + 1] == 3) { } 0 0 0
elsif (length $char[$i + 1] == 4) { } 0 0 0
1426 0 ▶ push @range, grep {($char[$i-1] le $_) and ($_ le $char[$i+1])} chars1();
Condition0%0/3
$char[$i - 1] le $_ && $_ le $char[$i + 1]
!ll&&!rl&&r
000
MC/DC0%0/2
$char[$i - 1] le $_ && $_ le $char[$i + 1]
$char[$i - 1] le $_ $_ le $char[$i + 1]
Truth table0%0/3
A && B
A= $char[$i - 1] le $_B= $_ le $char[$i + 1]
ABresult
0X0
100
111
1427 }
1428 elsif (CORE::length($char[$i+1]) == 2) {
1429 0 push @range, grep {$char[$i-1] le $_} chars1();
1430 0 push @range, grep {$_ le $char[$i+1]} chars2();
1431 }
1432 elsif (CORE::length($char[$i+1]) == 3) {
1433 0 push @range, grep {$char[$i-1] le $_} chars1();
1434 0 push @range, chars2();
1435 0 push @range, grep {$_ le $char[$i+1]} chars3();
1436 }
1437 elsif (CORE::length($char[$i+1]) == 4) {
1438 0 push @range, grep {$char[$i-1] le $_} chars1();
1439 0 push @range, chars2();
1440 0 push @range, chars3();
1441 0 push @range, grep {$_ le $char[$i+1]} chars4();
1442 }
1443 else {
1444 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1445 }
1446 }
1447 elsif (CORE::length($char[$i-1]) == 2) {
1448 0 ▶ if (CORE::length($char[$i+1]) == 2) {
Branch: 3 branches
BranchTrueFalseTotal
if (length $char[$i + 1] == 2) { } 0 0 0
elsif (length $char[$i + 1] == 3) { } 0 0 0
elsif (length $char[$i + 1] == 4) { } 0 0 0
1449 0 ▶ push @range, grep {($char[$i-1] le $_) and ($_ le $char[$i+1])} chars2();
Condition0%0/3
$char[$i - 1] le $_ && $_ le $char[$i + 1]
!ll&&!rl&&r
000
MC/DC0%0/2
$char[$i - 1] le $_ && $_ le $char[$i + 1]
$char[$i - 1] le $_ $_ le $char[$i + 1]
Truth table0%0/3
A && B
A= $char[$i - 1] le $_B= $_ le $char[$i + 1]
ABresult
0X0
100
111
1450 }
1451 elsif (CORE::length($char[$i+1]) == 3) {
1452 0 push @range, grep {$char[$i-1] le $_} chars2();
1453 0 push @range, grep {$_ le $char[$i+1]} chars3();
1454 }
1455 elsif (CORE::length($char[$i+1]) == 4) {
1456 0 push @range, grep {$char[$i-1] le $_} chars2();
1457 0 push @range, chars3();
1458 0 push @range, grep {$_ le $char[$i+1]} chars4();
1459 }
1460 else {
1461 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1462 }
1463 }
1464 elsif (CORE::length($char[$i-1]) == 3) {
1465 0 ▶ if (CORE::length($char[$i+1]) == 3) {
Branch: 2 branches
BranchTrueFalseTotal
if (length $char[$i + 1] == 3) { } 0 0 0
elsif (length $char[$i + 1] == 4) { } 0 0 0
1466 0 ▶ push @range, grep {($char[$i-1] le $_) and ($_ le $char[$i+1])} chars3();
Condition0%0/3
$char[$i - 1] le $_ && $_ le $char[$i + 1]
!ll&&!rl&&r
000
MC/DC0%0/2
$char[$i - 1] le $_ && $_ le $char[$i + 1]
$char[$i - 1] le $_ $_ le $char[$i + 1]
Truth table0%0/3
A && B
A= $char[$i - 1] le $_B= $_ le $char[$i + 1]
ABresult
0X0
100
111
1467 }
1468 elsif (CORE::length($char[$i+1]) == 4) {
1469 0 push @range, grep {$char[$i-1] le $_} chars3();
1470 0 push @range, grep {$_ le $char[$i+1]} chars4();
1471 }
1472 else {
1473 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1474 }
1475 }
1476 elsif (CORE::length($char[$i-1]) == 4) {
1477 0 ▶ if (CORE::length($char[$i+1]) == 4) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $char[$i + 1] == 4) { } 0 0 0
1478 0 ▶ push @range, grep {($char[$i-1] le $_) and ($_ le $char[$i+1])} chars4();
Condition0%0/3
$char[$i - 1] le $_ && $_ le $char[$i + 1]
!ll&&!rl&&r
000
MC/DC0%0/2
$char[$i - 1] le $_ && $_ le $char[$i + 1]
$char[$i - 1] le $_ $_ le $char[$i + 1]
Truth table0%0/3
A && B
A= $char[$i - 1] le $_B= $_ le $char[$i + 1]
ABresult
0X0
100
111
1479 }
1480 else {
1481 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1482 }
1483 }
1484 else {
1485 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1486 }
1487  
1488 0 splice @char, $i-1, 3, @range;
1489 }
1490  
1491 12 return @char;
1492 }
1493  
1494 #
1495 # Latin-10 open character class
1496 #
1497 0 ▶sub _cc {
Subroutine _cc: not called CC=7 SCAR=40.3
1498 0 ▶ if (scalar(@_) == 0) {
Branch: 3 branches
BranchTrueFalseTotal
if (scalar @_ == 0) { } 0 0 0
elsif (scalar @_ == 1) { } 0 0 0
elsif (scalar @_ == 2) { } 0 0 0
1499 0 die __FILE__, ": subroutine cc got no parameter.\n";
1500 }
1501 elsif (scalar(@_) == 1) {
1502 0 return sprintf('\x%02X',$_[0]);
1503 }
1504 elsif (scalar(@_) == 2) {
1505 0 ▶ if ($_[0] > $_[1]) {
Branch: 3 branches
BranchTrueFalseTotal
if ($_[0] > $_[1]) { } 0 0 0
elsif ($_[0] == $_[1]) { } 0 0 0
elsif ($_[0] + 1 == $_[1]) { } 0 0 0
1506 0 die __FILE__, ": subroutine cc got \$_[0] > \$_[1] parameters).\n";
1507 }
1508 elsif ($_[0] == $_[1]) {
1509 0 return sprintf('\x%02X',$_[0]);
1510 }
1511 elsif (($_[0]+1) == $_[1]) {
1512 0 return sprintf('[\\x%02X\\x%02X]',$_[0],$_[1]);
1513 }
1514 else {
1515 0 return sprintf('[\\x%02X-\\x%02X]',$_[0],$_[1]);
1516 }
1517 }
1518 else {
1519 0 die __FILE__, ": subroutine cc got 3 or more parameters (@{[scalar(@_)]} parameters).\n";
1520 }
1521 }
1522  
1523 #
1524 # Latin-10 octet range
1525 #
1526 246 ▶sub _octets {
Subroutine _octets: called CC=5 SCAR=19.3
1527 246 my $length = shift @_;
1528  
1529 246 ▶ if ($length == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length == 1) { } 246 0 246
1530 246 my($a1) = unpack 'C', $_[0];
1531 246 my($z1) = unpack 'C', $_[1];
1532  
1533 246 ▶ if ($a1 > $z1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($a1 > $z1) 0 246 246
1534 0 croak 'Invalid [] range in regexp (CORE::ord(A) > CORE::ord(B)) ' . '\x' . unpack('H*',$a1) . '-\x' . unpack('H*',$z1);
1535 }
1536  
1537 246 ▶ if ($a1 == $z1) {
Branch: 2 branches
BranchTrueFalseTotal
if ($a1 == $z1) { } 0 246 246
elsif ($a1 + 1 == $z1) { } 0 246 246
1538 0 return sprintf('\x%02X',$a1);
1539 }
1540 elsif (($a1+1) == $z1) {
1541 0 return sprintf('\x%02X\x%02X',$a1,$z1);
1542 }
1543 else {
1544 246 return sprintf('\x%02X-\x%02X',$a1,$z1);
1545 }
1546 }
1547 else {
1548 0 die __FILE__, ": subroutine _octets got invalid length ($length).\n";
1549 }
1550 }
1551  
1552 #
1553 # Latin-10 range regexp
1554 #
1555 246 ▶sub _range_regexp {
Subroutine _range_regexp: called CC=18 SCAR=41.7
1556 246 my($length,$first,$last) = @_;
1557  
1558 246 my @range_regexp = ();
1559 246 ▶ if (not exists $range_tr{$length}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $range_tr{$length}) 0 246 246
1560 0 return @range_regexp;
1561 }
1562  
1563 246 my @ranges = @{ $range_tr{$length} };
1564 246 ▶ while (my @range = splice(@ranges,0,$length)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, $length)) 246 246 492
1565 246 my $min = '';
1566 246 my $max = '';
1567 246 ▶ for (my $i=0; $i < $length; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $length) 246 246 492
1568 246 $min .= pack 'C', $range[$i][0];
1569 246 $max .= pack 'C', $range[$i][-1];
1570 }
1571  
1572 # min___max
1573 # FIRST_____________LAST
1574 # (nothing)
1575  
1576 246 ▶ if ($max lt $first) {
Branch: 7 branches
BranchTrueFalseTotal
if ($max lt $first) { } 0 246 246
elsif ($min le $first and $first le $max and $max le $last) { } 0 246 246
elsif ($min eq $first and $max eq $last) { } 0 246 246
elsif ($first le $min and $max le $last) { } 0 246 246
elsif ($min le $first and $last le $max) { } 246 0 246
elsif ($first le $min and $min le $last and $last le $max) { } 0 0 0
elsif ($last lt $min) { } 0 0 0
1577 }
1578  
1579 # **********
1580 # min_________max
1581 # FIRST_____________LAST
1582 # **********
1583  
1584 ▶ elsif (($min le $first) and ($first le $max) and ($max le $last)) {
Condition33%2/6
$min le $first and $first le $max and $max le $last
!ll&&!rl&&r
02460
$min le $first and $first le $max
!ll&&!rl&&r
00246
MC/DC0%0/3
$min le $first and $first le $max and $max le $last
$min le $first $first le $max $max le $last
Truth table25%1/4
A and B and C
A= $min le $firstB= $first le $maxC= $max le $last
ABCresult
0XX0
10X0
1100
1111
1585 0 push @range_regexp, _octets($length,$first,$max,$min,$max);
1586 }
1587  
1588 # **********************
1589 # min________________max
1590 # FIRST_____________LAST
1591 # **********************
1592  
1593 ▶ elsif (($min eq $first) and ($max eq $last)) {
Condition33%1/3
$min eq $first and $max eq $last
!ll&&!rl&&r
24600
MC/DC0%0/2
$min eq $first and $max eq $last
$min eq $first $max eq $last
Truth table33%1/3
A and B
A= $min eq $firstB= $max eq $last
ABresult
0X0
100
111
1594 0 push @range_regexp, _octets($length,$first,$last,$min,$max);
1595 }
1596  
1597 # *********
1598 # min___max
1599 # FIRST_____________LAST
1600 # *********
1601  
1602 ▶ elsif (($first le $min) and ($max le $last)) {
Condition33%1/3
$first le $min and $max le $last
!ll&&!rl&&r
24600
MC/DC0%0/2
$first le $min and $max le $last
$first le $min $max le $last
Truth table33%1/3
A and B
A= $first le $minB= $max le $last
ABresult
0X0
100
111
1603 0 push @range_regexp, _octets($length,$min,$max,$min,$max);
1604 }
1605  
1606 # **********************
1607 # min__________________________max
1608 # FIRST_____________LAST
1609 # **********************
1610  
1611 ▶ elsif (($min le $first) and ($last le $max)) {
Condition33%1/3
$min le $first and $last le $max
!ll&&!rl&&r
00246
MC/DC0%0/2
$min le $first and $last le $max
$min le $first $last le $max
Truth table33%1/3
A and B
A= $min le $firstB= $last le $max
ABresult
0X0
100
111
1612 246 push @range_regexp, _octets($length,$first,$last,$min,$max);
1613 }
1614  
1615 # *********
1616 # min________max
1617 # FIRST_____________LAST
1618 # *********
1619  
1620 ▶ elsif (($first le $min) and ($min le $last) and ($last le $max)) {
Condition0%0/6
$first le $min and $min le $last and $last le $max
!ll&&!rl&&r
000
$first le $min and $min le $last
!ll&&!rl&&r
000
MC/DC0%0/3
$first le $min and $min le $last and $last le $max
$first le $min $min le $last $last le $max
Truth table0%0/4
A and B and C
A= $first le $minB= $min le $lastC= $last le $max
ABCresult
0XX0
10X0
1100
1111
1621 0 push @range_regexp, _octets($length,$min,$last,$min,$max);
1622 }
1623  
1624 # min___max
1625 # FIRST_____________LAST
1626 # (nothing)
1627  
1628 elsif ($last lt $min) {
1629 }
1630  
1631 else {
1632 0 die __FILE__, ": subroutine _range_regexp panic.\n";
1633 }
1634 }
1635  
1636 246 return @range_regexp;
1637 }
1638  
1639 #
1640 # Latin-10 open character list for qr and not qr
1641 #
1642 650 ▶sub _charlist {
Subroutine _charlist: called CC=46 SCAR=45.9
1643  
1644 650 my $modifier = pop @_;
1645 650 my @char = @_;
1646  
1647 650 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 298 352 650
1648  
1649 # unescape character
1650 650 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1773 650 2423
1651  
1652 # escape - to ...
1653 1773 ▶ if ($char[$i] eq '-') {
Branch: 12 branches
BranchTrueFalseTotal
if ($char[$i] eq '-') { } 270 1503 1773
elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/mosx) { } 0 1503 1503
elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/mosx) { } 0 1503 1503
elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/mosx) { } 0 1503 1503
elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/mosx) { } 0 1503 1503
elsif ($char[$i] =~ /\A \\ ([0-7]{2,3}) \z/mosx) { } 0 1503 1503
elsif ($char[$i] =~ /\A \\x ([0-9A-Fa-f]{1,2}) \z/mosx) { } 22 1481 1503
elsif ($char[$i] =~ /\A \\c ([\x40-\x5F]) \z/mosx) { } 0 1481 1481
elsif ($char[$i] =~ /\A (\\ [0nrtfbaedswDSWHVhvR]) \z/mosx) { } 25 1456 1481
elsif ($ignorecase and $char[$i] =~ /\A ( \[\: \^? (?:lower|upper) :\] ) \z/mosx) { } 8 1448 1456
elsif ($char[$i] =~ /\A ( \[\: \^? (?:alnum|alpha|ascii|blank|cntrl|digit|graph|lower|print|punct|space|upper|word|xdigit) :\] ) \z/mosx) { } 70 1378 1448
elsif ($char[$i] =~ /\A \\ ($Elatin10::q_char) \z/mosx) { } 7 1371 1378
1654 270 ▶ if ((0 < $i) and ($i < $#char)) {
Branch: 1 branch
BranchTrueFalseTotal
if (0 < $i and $i < $#char) 246 24 270
Condition100%3/3
0 < $i and $i < $#char
!ll&&!rl&&r
195246
MC/DC100%2/2
0 < $i and $i < $#char
0 < $i $i < $#char
Truth table100%3/3
A and B
A= 0 < $iB= $i < $#char
ABresult
0X0
100
111
1655 246 $char[$i] = '...';
1656 }
1657 }
1658  
1659 # octal escape sequence
1660 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
1661 0 $char[$i] = octchr($1);
1662 }
1663  
1664 # hexadecimal escape sequence
1665 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
1666 0 $char[$i] = hexchr($1);
1667 }
1668  
1669 # \b{...} --> b\{...}
1670 # \B{...} --> B\{...}
1671 # \N{CHARNAME} --> N\{CHARNAME}
1672 # \p{PROPERTY} --> p\{PROPERTY}
1673 # \P{PROPERTY} --> P\{PROPERTY}
1674 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
1675 0 $char[$i] = $1 . '\\' . $2;
1676 }
1677  
1678 # \p, \P, \X --> p, P, X
1679 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
1680 0 $char[$i] = $1;
1681 }
1682  
1683 elsif ($char[$i] =~ /\A \\ ([0-7]{2,3}) \z/oxms) {
1684 0 $char[$i] = CORE::chr oct $1;
1685 }
1686 elsif ($char[$i] =~ /\A \\x ([0-9A-Fa-f]{1,2}) \z/oxms) {
1687 22 $char[$i] = CORE::chr hex $1;
1688 }
1689 elsif ($char[$i] =~ /\A \\c ([\x40-\x5F]) \z/oxms) {
1690 0 $char[$i] = CORE::chr(CORE::ord($1) & 0x1F);
1691 }
1692 elsif ($char[$i] =~ /\A (\\ [0nrtfbaedswDSWHVhvR]) \z/oxms) {
1693 $char[$i] = {
1694 '\0' => "\0",
1695 '\n' => "\n",
1696 '\r' => "\r",
1697 '\t' => "\t",
1698 '\f' => "\f",
1699 '\b' => "\x08", # \b means backspace in character class
1700 '\a' => "\a",
1701 '\e' => "\e",
1702 '\d' => '[0-9]',
1703  
1704 # Vertical tabs are now whitespace
1705 # \s in a regex now matches a vertical tab in all circumstances.
1706 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
1707 # \t \n \v \f \r space
1708 # '\s' => '[\x09\x0A \x0C\x0D\x20]',
1709 # '\s' => '[\x09\x0A\x0B\x0C\x0D\x20]',
1710 '\s' => '\s',
1711  
1712 '\w' => '[0-9A-Z_a-z]',
1713 '\D' => '${Elatin10::eD}',
1714 '\S' => '${Elatin10::eS}',
1715 '\W' => '${Elatin10::eW}',
1716  
1717 '\H' => '${Elatin10::eH}',
1718 '\V' => '${Elatin10::eV}',
1719 '\h' => '[\x09\x20]',
1720 '\v' => '[\x0A\x0B\x0C\x0D]',
1721 '\R' => '${Elatin10::eR}',
1722  
1723 25 }->{$1};
1724 }
1725  
1726 # POSIX-style character classes
1727 ▶ elsif ($ignorecase and ($char[$i] =~ /\A ( \[\: \^? (?:lower|upper) :\] ) \z/oxms)) {
Condition100%3/3
$ignorecase and $char[$i] =~ /\A ( \[\: \^? (?:lower|upper) :\] ) \z/mosx
!ll&&!rl&&r
8785708
MC/DC100%2/2
$ignorecase and $char[$i] =~ /\A ( \[\: \^? (?:lower|upper) :\] ) \z/mosx
$ignorecase $char[$i] =~ /\A ( \[\: \^? (?:lower|upper) :\] ) \z/mosx
Truth table100%3/3
A and B
A= $ignorecaseB= $char[$i] =~ /\A ( \[\: \^? (?:lower|upper) :\] ) \z/mosx
ABresult
0X0
100
111
1728 $char[$i] = {
1729  
1730 '[:lower:]' => '[\x41-\x5A\x61-\x7A]',
1731 '[:upper:]' => '[\x41-\x5A\x61-\x7A]',
1732 '[:^lower:]' => '${Elatin10::not_lower_i}',
1733 '[:^upper:]' => '${Elatin10::not_upper_i}',
1734  
1735 8 }->{$1};
1736 }
1737 elsif ($char[$i] =~ /\A ( \[\: \^? (?:alnum|alpha|ascii|blank|cntrl|digit|graph|lower|print|punct|space|upper|word|xdigit) :\] ) \z/oxms) {
1738 $char[$i] = {
1739  
1740 '[:alnum:]' => '[\x30-\x39\x41-\x5A\x61-\x7A]',
1741 '[:alpha:]' => '[\x41-\x5A\x61-\x7A]',
1742 '[:ascii:]' => '[\x00-\x7F]',
1743 '[:blank:]' => '[\x09\x20]',
1744 '[:cntrl:]' => '[\x00-\x1F\x7F]',
1745 '[:digit:]' => '[\x30-\x39]',
1746 '[:graph:]' => '[\x21-\x7F]',
1747 '[:lower:]' => '[\x61-\x7A]',
1748 '[:print:]' => '[\x20-\x7F]',
1749 '[:punct:]' => '[\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E]',
1750  
1751 # P.174 POSIX-Style Character Classes
1752 # in Chapter 5: Pattern Matching
1753 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
1754  
1755 # P.311 11.2.4 Character Classes and other Special Escapes
1756 # in Chapter 11: perlre: Perl regular expressions
1757 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
1758  
1759 # P.210 POSIX-Style Character Classes
1760 # in Chapter 5: Pattern Matching
1761 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1762  
1763 '[:space:]' => '[\s\x0B]', # "\s" plus vertical tab ("\cK")
1764  
1765 '[:upper:]' => '[\x41-\x5A]',
1766 '[:word:]' => '[\x30-\x39\x41-\x5A\x5F\x61-\x7A]',
1767 '[:xdigit:]' => '[\x30-\x39\x41-\x46\x61-\x66]',
1768 '[:^alnum:]' => '${Elatin10::not_alnum}',
1769 '[:^alpha:]' => '${Elatin10::not_alpha}',
1770 '[:^ascii:]' => '${Elatin10::not_ascii}',
1771 '[:^blank:]' => '${Elatin10::not_blank}',
1772 '[:^cntrl:]' => '${Elatin10::not_cntrl}',
1773 '[:^digit:]' => '${Elatin10::not_digit}',
1774 '[:^graph:]' => '${Elatin10::not_graph}',
1775 '[:^lower:]' => '${Elatin10::not_lower}',
1776 '[:^print:]' => '${Elatin10::not_print}',
1777 '[:^punct:]' => '${Elatin10::not_punct}',
1778 '[:^space:]' => '${Elatin10::not_space}',
1779 '[:^upper:]' => '${Elatin10::not_upper}',
1780 '[:^word:]' => '${Elatin10::not_word}',
1781 '[:^xdigit:]' => '${Elatin10::not_xdigit}',
1782  
1783 70 }->{$1};
1784 }
1785 elsif ($char[$i] =~ /\A \\ ($q_char) \z/oxms) {
1786 7 $char[$i] = $1;
1787 }
1788 }
1789  
1790 # open character list
1791 650 my @singleoctet = ();
1792 650 my @multipleoctet = ();
1793 650 ▶ for (my $i=0; $i <= $#char; ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1527 650 2177
1794  
1795 # escaped -
1796 1527 ▶ if (defined($char[$i+1]) and ($char[$i+1] eq '...')) {
Branch: 6 branches
BranchTrueFalseTotal
if (defined $char[$i + 1] and $char[$i + 1] eq '...') { } 246 1281 1527
elsif ($char[$i] eq '...') { } 246 1035 1281
elsif ($char[$i] =~ /\A [\x00-\xFF] \z/mosx) { } 949 86 1035
elsif ($char[$i] =~ /\A (?: \\h ) \z/mosx) { } 0 86 86
elsif ($char[$i] =~ /\A (?: \\v ) \z/mosx) { } 0 86 86
elsif ($char[$i] =~ /\A (?: \\d | \\s | \\w ) \z/mosx) { } 2 84 86
Condition100%3/3
defined $char[$i + 1] and $char[$i + 1] eq "..."
!ll&&!rl&&r
406875246
MC/DC100%2/2
defined $char[$i + 1] and $char[$i + 1] eq "..."
defined $char[$i + 1] $char[$i + 1] eq "..."
Truth table100%3/3
A and B
A= defined $char[$i + 1]B= $char[$i + 1] eq "..."
ABresult
0X0
100
111
1797 246 $i += 1;
1798 246 next;
1799 }
1800  
1801 # make range regexp
1802 elsif ($char[$i] eq '...') {
1803  
1804 # range error
1805 246 ▶ if (CORE::length($char[$i-1]) > CORE::length($char[$i+1])) {
Branch: 2 branches
BranchTrueFalseTotal
if (length $char[$i - 1] > length $char[$i + 1]) { } 0 246 246
elsif (length $char[$i - 1] == length $char[$i + 1]) { } 246 0 246
1806 0 croak 'Invalid [] range in regexp (length(A) > length(B)) ' . '\x' . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]);
1807 }
1808 elsif (CORE::length($char[$i-1]) == CORE::length($char[$i+1])) {
1809 246 ▶ if ($char[$i-1] gt $char[$i+1]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i - 1] gt $char[$i + 1]) 0 246 246
1810 0 croak 'Invalid [] range in regexp (CORE::ord(A) > CORE::ord(B)) ' . '\x' . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]);
1811 }
1812 }
1813  
1814 # make range regexp per length
1815 246 for my $length (CORE::length($char[$i-1]) .. CORE::length($char[$i+1])) {
1816 246 my @regexp = ();
1817  
1818 # is first and last
1819 246 ▶ if (($length == CORE::length($char[$i-1])) and ($length == CORE::length($char[$i+1]))) {
Branch: 4 branches
BranchTrueFalseTotal
if ($length == length $char[$i - 1] and $length == length $char[$i + 1]) { } 246 0 246
elsif ($length == length $char[$i - 1]) { } 0 0 0
elsif (length $char[$i - 1] < $length and $length < length $char[$i + 1]) { } 0 0 0
elsif ($length == length $char[$i + 1]) { } 0 0 0
Condition33%1/3
$length == length $char[$i - 1] and $length == length $char[$i + 1]
!ll&&!rl&&r
00246
MC/DC0%0/2
$length == length $char[$i - 1] and $length == length $char[$i + 1]
$length == length $char[$i - 1] $length == length $char[$i + 1]
Truth table33%1/3
A and B
A= $length == length $char[$i - 1]B= $length == length $char[$i + 1]
ABresult
0X0
100
111
1820 246 push @regexp, _range_regexp($length, $char[$i-1], $char[$i+1]);
1821 }
1822  
1823 # is first
1824 elsif ($length == CORE::length($char[$i-1])) {
1825 0 push @regexp, _range_regexp($length, $char[$i-1], "\xFF" x $length);
1826 }
1827  
1828 # is inside in first and last
1829 ▶ elsif ((CORE::length($char[$i-1]) < $length) and ($length < CORE::length($char[$i+1]))) {
Condition0%0/3
length $char[$i - 1] < $length and $length < length $char[$i + 1]
!ll&&!rl&&r
000
MC/DC0%0/2
length $char[$i - 1] < $length and $length < length $char[$i + 1]
length $char[$i - 1] < $length $length < length $char[$i + 1]
Truth table0%0/3
A and B
A= length $char[$i - 1] < $lengthB= $length < length $char[$i + 1]
ABresult
0X0
100
111
1830 0 push @regexp, _range_regexp($length, "\x00" x $length, "\xFF" x $length);
1831 }
1832  
1833 # is last
1834 elsif ($length == CORE::length($char[$i+1])) {
1835 0 push @regexp, _range_regexp($length, "\x00" x $length, $char[$i+1]);
1836 }
1837  
1838 else {
1839 0 die __FILE__, ": subroutine make_regexp panic.\n";
1840 }
1841  
1842 246 ▶ if ($length == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length == 1) { } 246 0 246
1843 246 push @singleoctet, @regexp;
1844 }
1845 else {
1846 0 push @multipleoctet, @regexp;
1847 }
1848 }
1849  
1850 246 $i += 2;
1851 }
1852  
1853 # with /i modifier
1854 elsif ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) {
1855 949 ▶ if ($modifier =~ /i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) { } 480 469 949
1856 480 my $uc = Elatin10::uc($char[$i]);
1857 480 my $fc = Elatin10::fc($char[$i]);
1858 480 ▶ if ($uc ne $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc ne $fc) { } 240 240 480
1859 240 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 240 0 240
1860 240 push @singleoctet, $uc, $fc;
1861 }
1862 else {
1863 0 push @singleoctet, $uc;
1864 0 push @multipleoctet, $fc;
1865 }
1866 }
1867 else {
1868 240 push @singleoctet, $char[$i];
1869 }
1870 }
1871 else {
1872 469 push @singleoctet, $char[$i];
1873 }
1874 949 $i += 1;
1875 }
1876  
1877 # single character of single octet code
1878 elsif ($char[$i] =~ /\A (?: \\h ) \z/oxms) {
1879 0 push @singleoctet, "\t", "\x20";
1880 0 $i += 1;
1881 }
1882 elsif ($char[$i] =~ /\A (?: \\v ) \z/oxms) {
1883 0 push @singleoctet, "\x0A", "\x0B", "\x0C", "\x0D";
1884 0 $i += 1;
1885 }
1886 elsif ($char[$i] =~ /\A (?: \\d | \\s | \\w ) \z/oxms) {
1887 2 push @singleoctet, $char[$i];
1888 2 $i += 1;
1889 }
1890  
1891 # single character of multiple-octet code
1892 else {
1893 84 push @multipleoctet, $char[$i];
1894 84 $i += 1;
1895 }
1896 }
1897  
1898 # quote metachar
1899 650 for (@singleoctet) {
1900 1437 ▶ if ($_ eq '...') {
Branch: 5 branches
BranchTrueFalseTotal
if ($_ eq '...') { } 0 1437 1437
elsif (/\A \n \z/mosx) { } 8 1429 1437
elsif (/\A \r \z/mosx) { } 8 1421 1429
elsif (/\A ([\x00-\x20\x7F-\xFF]) \z/mosx) { } 744 677 1421
elsif (/\A [\x00-\xFF] \z/mosx) { } 429 248 677
1901 0 $_ = '-';
1902 }
1903 elsif (/\A \n \z/oxms) {
1904 8 $_ = '\n';
1905 }
1906 elsif (/\A \r \z/oxms) {
1907 8 $_ = '\r';
1908 }
1909 elsif (/\A ([\x00-\x20\x7F-\xFF]) \z/oxms) {
1910 744 $_ = sprintf('\x%02X', CORE::ord $1);
1911 }
1912 elsif (/\A [\x00-\xFF] \z/oxms) {
1913 429 $_ = quotemeta $_;
1914 }
1915 }
1916  
1917 # return character list
1918 650 return \@singleoctet, \@multipleoctet;
1919 }
1920  
1921 #
1922 # Latin-10 octal escape sequence
1923 #
1924 5 ▶sub octchr {
Subroutine octchr: called CC=2 SCAR=6.9
Pod undocumented
1925 5 my($octdigit) = @_;
1926  
1927 5 my @binary = ();
1928 5 for my $octal (split(//,$octdigit)) {
1929 push @binary, {
1930 '0' => '000',
1931 '1' => '001',
1932 '2' => '010',
1933 '3' => '011',
1934 '4' => '100',
1935 '5' => '101',
1936 '6' => '110',
1937 '7' => '111',
1938 50 }->{$octal};
1939 }
1940 5 my $binary = join '', @binary;
1941  
1942 my $octchr = {
1943 # 1234567
1944 1 => pack('B*', "0000000$binary"),
1945 2 => pack('B*', "000000$binary"),
1946 3 => pack('B*', "00000$binary"),
1947 4 => pack('B*', "0000$binary"),
1948 5 => pack('B*', "000$binary"),
1949 6 => pack('B*', "00$binary"),
1950 7 => pack('B*', "0$binary"),
1951 0 => pack('B*', "$binary"),
1952  
1953 5 }->{CORE::length($binary) % 8};
1954  
1955 5 return $octchr;
1956 }
1957  
1958 #
1959 # Latin-10 hexadecimal escape sequence
1960 #
1961 5 ▶sub hexchr {
Subroutine hexchr: called CC=1 SCAR=0.0
Pod undocumented
1962 5 my($hexdigit) = @_;
1963  
1964 my $hexchr = {
1965 1 => pack('H*', "0$hexdigit"),
1966 0 => pack('H*', "$hexdigit"),
1967  
1968 5 }->{CORE::length($_[0]) % 2};
1969  
1970 5 return $hexchr;
1971 }
1972  
1973 #
1974 # Latin-10 open character list for qr
1975 #
1976 576 ▶sub charlist_qr {
Subroutine charlist_qr: called CC=17 SCAR=28.7
Pod undocumented
1977  
1978 576 my $modifier = pop @_;
1979 576 my @char = @_;
1980  
1981 576 my($singleoctet, $multipleoctet) = _charlist(@char, $modifier);
1982 576 my @singleoctet = @$singleoctet;
1983 576 my @multipleoctet = @$multipleoctet;
1984  
1985 # return character list
1986 576 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) 498 78 576
1987  
1988 # with /i modifier
1989 498 ▶ if ($modifier =~ m/i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) 265 233 498
1990 265 my %singleoctet_ignorecase = ();
1991 265 for (@singleoctet) {
1992 745 ▶ while (s/ \A \\x(..) - \\x(..) //oxms or s/ \A \\x((..)) //oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (s/ \A \\x(..) - \\x(..) //mosx or s/ \A \\x((..)) //mosx) 745 745 1490
Condition100%3/3
s/ \A \\x(..) - \\x(..) //mosx or s/ \A \\x((..)) //mosx
l!l&&r!l&&!r
25720745
MC/DC100%2/2
s/ \A \\x(..) - \\x(..) //mosx or s/ \A \\x((..)) //mosx
s/ \A \\x(..) - \\x(..) //mosx s/ \A \\x((..)) //mosx
Truth table100%3/3
A or B
A= s/ \A \\x(..) - \\x(..) //mosxB= s/ \A \\x((..)) //mosx
ABresult
1X1
011
000
1993 745 for my $ord (hex($1) .. hex($2)) {
1994 795 my $char = CORE::chr($ord);
1995 795 my $uc = Elatin10::uc($char);
1996 795 my $fc = Elatin10::fc($char);
1997 795 ▶ if ($uc eq $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc eq $fc) { } 240 555 795
1998 240 $singleoctet_ignorecase{unpack 'C*', $char} = 1;
1999 }
2000 else {
2001 555 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 555 0 555
2002 555 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2003 555 $singleoctet_ignorecase{unpack 'C*', $fc} = 1;
2004 }
2005 else {
2006 0 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2007 0 push @multipleoctet, join '', map {sprintf('\x%02X',$_)} unpack 'C*', $fc;
2008 }
2009 }
2010 }
2011 }
2012 745 ▶ if ($_ ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ ne "") 0 745 745
2013 0 $singleoctet_ignorecase{unpack 'C*', $_} = 1;
2014 }
2015 }
2016 265 my $i = 0;
2017 265 my @singleoctet_ignorecase = ();
2018 265 for my $ord (0 .. 255) {
2019 67840 ▶ if (exists $singleoctet_ignorecase{$ord}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $singleoctet_ignorecase{$ord}) { } 870 66970 67840
2020 870 push @{$singleoctet_ignorecase[$i]}, $ord;
2021 }
2022 else {
2023 66970 $i++;
2024 }
2025 }
2026 265 @singleoctet = ();
2027 265 for my $range (@singleoctet_ignorecase) {
2028 56160 ▶ if (ref $range) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $range) 770 55390 56160
2029 770 ▶ if (scalar(@{$range}) == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @{$range;} == 1) { } 720 50 770
elsif (scalar @{$range;} == 2) { } 0 50 50
2030 720 push @singleoctet, sprintf('\x%02X', @{$range}[0]);
2031 }
2032 50 elsif (scalar(@{$range}) == 2) {
2033 0 push @singleoctet, sprintf('\x%02X\x%02X', @{$range}[0], @{$range}[-1]);
2034 }
2035 else {
2036 50 push @singleoctet, sprintf('\x%02X-\x%02X', @{$range}[0], @{$range}[-1]);
2037 }
2038 }
2039 }
2040 }
2041  
2042 498 my $not_anchor = '';
2043  
2044 498 push @multipleoctet, join('', $not_anchor, '[', @singleoctet, ']' );
2045 }
2046 576 ▶ if (scalar(@multipleoctet) >= 2) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @multipleoctet >= 2) { } 6 570 576
2047 6 return '(?:' . join('|', @multipleoctet) . ')';
2048 }
2049 else {
2050 570 return $multipleoctet[0];
2051 }
2052 }
2053  
2054 #
2055 # Latin-10 open character list for not qr
2056 #
2057 74 ▶sub charlist_not_qr {
Subroutine charlist_not_qr: called CC=18 SCAR=33.1
Pod undocumented
2058  
2059 74 my $modifier = pop @_;
2060 74 my @char = @_;
2061  
2062 74 my($singleoctet, $multipleoctet) = _charlist(@char, $modifier);
2063 74 my @singleoctet = @$singleoctet;
2064 74 my @multipleoctet = @$multipleoctet;
2065  
2066 # with /i modifier
2067 74 ▶ if ($modifier =~ m/i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) 25 49 74
2068 25 my %singleoctet_ignorecase = ();
2069 25 for (@singleoctet) {
2070 25 ▶ while (s/ \A \\x(..) - \\x(..) //oxms or s/ \A \\x((..)) //oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (s/ \A \\x(..) - \\x(..) //mosx or s/ \A \\x((..)) //mosx) 25 25 50
Condition66%2/3
s/ \A \\x(..) - \\x(..) //mosx or s/ \A \\x((..)) //mosx
l!l&&r!l&&!r
25025
MC/DC50%1/2
s/ \A \\x(..) - \\x(..) //mosx or s/ \A \\x((..)) //mosx
s/ \A \\x(..) - \\x(..) //mosx s/ \A \\x((..)) //mosx
Truth table66%2/3
A or B
A= s/ \A \\x(..) - \\x(..) //mosxB= s/ \A \\x((..)) //mosx
ABresult
1X1
011
000
2071 25 for my $ord (hex($1) .. hex($2)) {
2072 75 my $char = CORE::chr($ord);
2073 75 my $uc = Elatin10::uc($char);
2074 75 my $fc = Elatin10::fc($char);
2075 75 ▶ if ($uc eq $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc eq $fc) { } 0 75 75
2076 0 $singleoctet_ignorecase{unpack 'C*', $char} = 1;
2077 }
2078 else {
2079 75 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 75 0 75
2080 75 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2081 75 $singleoctet_ignorecase{unpack 'C*', $fc} = 1;
2082 }
2083 else {
2084 0 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2085 0 push @multipleoctet, join '', map {sprintf('\x%02X',$_)} unpack 'C*', $fc;
2086 }
2087 }
2088 }
2089 }
2090 25 ▶ if ($_ ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ ne "") 0 25 25
2091 0 $singleoctet_ignorecase{unpack 'C*', $_} = 1;
2092 }
2093 }
2094 25 my $i = 0;
2095 25 my @singleoctet_ignorecase = ();
2096 25 for my $ord (0 .. 255) {
2097 6400 ▶ if (exists $singleoctet_ignorecase{$ord}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $singleoctet_ignorecase{$ord}) { } 150 6250 6400
2098 150 push @{$singleoctet_ignorecase[$i]}, $ord;
2099 }
2100 else {
2101 6250 $i++;
2102 }
2103 }
2104 25 @singleoctet = ();
2105 25 for my $range (@singleoctet_ignorecase) {
2106 2400 ▶ if (ref $range) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $range) 50 2350 2400
2107 50 ▶ if (scalar(@{$range}) == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @{$range;} == 1) { } 0 50 50
elsif (scalar @{$range;} == 2) { } 0 50 50
2108 0 push @singleoctet, sprintf('\x%02X', @{$range}[0]);
2109 }
2110 50 elsif (scalar(@{$range}) == 2) {
2111 0 push @singleoctet, sprintf('\x%02X\x%02X', @{$range}[0], @{$range}[-1]);
2112 }
2113 else {
2114 50 push @singleoctet, sprintf('\x%02X-\x%02X', @{$range}[0], @{$range}[-1]);
2115 }
2116 }
2117 }
2118 }
2119  
2120 # return character list
2121 74 ▶ if (scalar(@multipleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @multipleoctet >= 1) { } 0 74 74
2122 0 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) { } 0 0 0
2123  
2124 # any character other than multiple-octet and single octet character class
2125 0 return '(?!' . join('|', @multipleoctet) . ')(?:[^' . join('', @singleoctet) . '])';
2126 }
2127 else {
2128  
2129 # any character other than multiple-octet character class
2130 0 return '(?!' . join('|', @multipleoctet) . ")(?:$your_char)";
2131 }
2132 }
2133 else {
2134 74 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) { } 74 0 74
2135  
2136 # any character other than single octet character class
2137 74 return '(?:[^' . join('', @singleoctet) . '])';
2138 }
2139 else {
2140  
2141 # any character
2142 0 return "(?:$your_char)";
2143 }
2144 }
2145 }
2146  
2147 #
2148 # open file in read mode
2149 #
2150 424 ▶sub _open_r {
Subroutine _open_r: called CC=1 SCAR=0.0
2151 424 my(undef,$file) = @_;
2152 424 ▶ use Fcntl qw(O_RDONLY);
Subroutine BEGIN: called CC=1 SCAR=0.0
2153 424 return CORE::sysopen($_[0], $file, &O_RDONLY);
2154 }
2155  
2156 #
2157 # open file in append mode
2158 #
2159 212 ▶sub _open_a {
Subroutine _open_a: called CC=1 SCAR=0.0
2160 212 my(undef,$file) = @_;
2161 424 ▶ use Fcntl qw(O_WRONLY O_APPEND O_CREAT);
Subroutine BEGIN: called CC=1 SCAR=0.0
2162 212 return CORE::sysopen($_[0], $file, &O_WRONLY|&O_APPEND|&O_CREAT);
2163 }
2164  
2165 #
2166 # safe system
2167 #
2168 212 ▶sub _systemx {
Subroutine _systemx: called CC=1 SCAR=0.0
2169  
2170 # P.707 29.2.33. exec
2171 # in Chapter 29: Functions
2172 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2173 #
2174 # Be aware that in older releases of Perl, exec (and system) did not flush
2175 # your output buffer, so you needed to enable command buffering by setting $|
2176 # on one or more filehandles to avoid lost output in the case of exec, or
2177 # misordererd output in the case of system. This situation was largely remedied
2178 # in the 5.6 release of Perl. (So, 5.005 release not yet.)
2179  
2180 # P.855 exec
2181 # in Chapter 27: Functions
2182 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2183 #
2184 # In very old release of Perl (before v5.6), exec (and system) did not flush
2185 # your output buffer, so you needed to enable command buffering by setting $|
2186 # on one or more filehandles to avoid lost output with exec or misordered
2187 # output with system.
2188  
2189 212 $| = 1;
2190  
2191 # P.565 23.1.2. Cleaning Up Your Environment
2192 # in Chapter 23: Security
2193 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2194  
2195 # P.656 Cleaning Up Your Environment
2196 # in Chapter 20: Security
2197 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2198  
2199 # local $ENV{'PATH'} = '.';
2200 212 local @ENV{qw(IFS CDPATH ENV BASH_ENV)}; # Make %ENV safer
2201  
2202 # P.707 29.2.33. exec
2203 # in Chapter 29: Functions
2204 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2205 #
2206 # As we mentioned earlier, exec treats a discrete list of arguments as an
2207 # indication that it should bypass shell processing. However, there is one
2208 # place where you might still get tripped up. The exec call (and system, too)
2209 # will not distinguish between a single scalar argument and an array containing
2210 # only one element.
2211 #
2212 # @args = ("echo surprise"); # just one element in list
2213 # exec @args # still subject to shell escapes
2214 # or die "exec: $!"; # because @args == 1
2215 #
2216 # To avoid this, you can use the PATHNAME syntax, explicitly duplicating the
2217 # first argument as the pathname, which forces the rest of the arguments to be
2218 # interpreted as a list, even if there is only one of them:
2219 #
2220 # exec { $args[0] } @args # safe even with one-argument list
2221 # or die "can't exec @args: $!";
2222  
2223 # P.855 exec
2224 # in Chapter 27: Functions
2225 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2226 #
2227 # As we mentioned earlier, exec treats a discrete list of arguments as a
2228 # directive to bypass shell processing. However, there is one place where
2229 # you might still get tripped up. The exec call (and system, too) cannot
2230 # distinguish between a single scalar argument and an array containing
2231 # only one element.
2232 #
2233 # @args = ("echo surprise"); # just one element in list
2234 # exec @args # still subject to shell escapes
2235 # || die "exec: $!"; # because @args == 1
2236 #
2237 # To avoid this, use the PATHNAME syntax, explicitly duplicating the first
2238 # argument as the pathname, which forces the rest of the arguments to be
2239 # interpreted as a list, even if there is only one of them:
2240 #
2241 # exec { $args[0] } @args # safe even with one-argument list
2242 # || die "can't exec @args: $!";
2243  
2244 212 return CORE::system { $_[0] } @_; # safe even with one-argument list
2245 }
2246  
2247 #
2248 # Latin-10 order to character (with parameter)
2249 #
2250 3469 ▶sub Elatin10::chr(;$) {
Subroutine chr: called CC=4 SCAR=13.9
Pod undocumented
2251  
2252 3469 ▶ my $c = @_ ? $_[0] : $_;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 3469 0 3469
2253  
2254 3469 ▶ if ($c == 0x00) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c == 0) { } 24 3445 3469
2255 24 return "\x00";
2256 }
2257 else {
2258 3445 my @chr = ();
2259 3445 ▶ while ($c > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c > 0) 3445 3445 6890
2260 3445 unshift @chr, ($c % 0x100);
2261 3445 $c = int($c / 0x100);
2262 }
2263 3445 return pack 'C*', @chr;
2264 }
2265 }
2266  
2267 #
2268 # Latin-10 order to character (without parameter)
2269 #
2270 0 ▶sub Elatin10::chr_() {
Subroutine chr_: not called CC=3 SCAR=24.8
Pod undocumented
2271  
2272 0 my $c = $_;
2273  
2274 0 ▶ if ($c == 0x00) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c == 0) { } 0 0 0
2275 0 return "\x00";
2276 }
2277 else {
2278 0 my @chr = ();
2279 0 ▶ while ($c > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c > 0) 0 0 0
2280 0 unshift @chr, ($c % 0x100);
2281 0 $c = int($c / 0x100);
2282 }
2283 0 return pack 'C*', @chr;
2284 }
2285 }
2286  
2287 #
2288 # Latin-10 path globbing (with parameter)
2289 #
2290 0 ▶sub Elatin10::glob($) {
Subroutine glob: not called CC=3 SCAR=24.8
Pod undocumented
2291  
2292 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2293 0 my @glob = _DOS_like_glob(@_);
2294 0 for my $glob (@glob) {
2295 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2296 }
2297 0 return @glob;
2298 }
2299 else {
2300 0 my $glob = _DOS_like_glob(@_);
2301 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2302 0 return $glob;
2303 }
2304 }
2305  
2306 #
2307 # Latin-10 path globbing (without parameter)
2308 #
2309 0 ▶sub Elatin10::glob_() {
Subroutine glob_: not called CC=3 SCAR=24.8
Pod undocumented
2310  
2311 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2312 0 my @glob = _DOS_like_glob();
2313 0 for my $glob (@glob) {
2314 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2315 }
2316 0 return @glob;
2317 }
2318 else {
2319 0 my $glob = _DOS_like_glob();
2320 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2321 0 return $glob;
2322 }
2323 }
2324  
2325 #
2326 # Latin-10 path globbing via File::DosGlob 1.10
2327 #
2328 # Often I confuse "_dosglob" and "_doglob".
2329 # So, I renamed "_dosglob" to "_DOS_like_glob".
2330 #
2331 424 my %iter;
2332 my %entries;
2333 0 ▶sub _DOS_like_glob {
Subroutine _DOS_like_glob: not called CC=10 SCAR=47.0
2334  
2335 # context (keyed by second cxix argument provided by core)
2336 0 my($expr,$cxix) = @_;
2337  
2338 # glob without args defaults to $_
2339 0 ▶ $expr = $_ if not defined $expr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $expr 0 0 0
2340  
2341 # represents the current user's home directory
2342 #
2343 # 7.3. Expanding Tildes in Filenames
2344 # in Chapter 7. File Access
2345 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2346 #
2347 # and File::HomeDir, File::HomeDir::Windows module
2348  
2349 # DOS-like system
2350 0 ▶ if ($^O =~ /\A (?: MSWin32 | NetWare | symbian | dos ) \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O =~ /\A (?: MSWin32 | NetWare | symbian | dos ) \z/mosx) { } 0 0 0
2351 0 $expr =~ s{ \A ~ (?= [^/\\] ) }
2352 0 { my_home_MSWin32() }oxmse;
2353 }
2354  
2355 # UNIX-like system
2356 else {
2357 0 $expr =~ s{ \A ~ ( (?:[^/])* ) }
2358 0 ▶ { $1 ? (CORE::eval(q{(getpwnam($1))[7]})||my_home()) : my_home() }oxmse;
Branch: 1 branch
BranchTrueFalseTotal
$1 ? : 0 0 0
Condition0%0/3
eval "(getpwnam(\$1))[7]" or my_home()
l!l&&r!l&&!r
000
MC/DC0%0/2
eval "(getpwnam(\$1))[7]" or my_home()
eval "(getpwnam(\$1))[7]" my_home()
Truth table0%0/3
A or B
A= eval "(getpwnam(\$1))[7]"B= my_home()
ABresult
1X1
011
000
2359 }
2360  
2361 # assume global context if not provided one
2362 0 ▶ $cxix = '_G_' if not defined $cxix;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $cxix 0 0 0
2363 0 ▶ $iter{$cxix} = 0 if not exists $iter{$cxix};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $iter{$cxix} 0 0 0
2364  
2365 # if we're just beginning, do it all first
2366 0 ▶ if ($iter{$cxix} == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iter{$cxix} == 0) 0 0 0
2367 0 $entries{$cxix} = [ _do_glob(1, _parse_line($expr)) ];
2368 }
2369  
2370 # chuck it all out, quick or slow
2371 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2372 0 delete $iter{$cxix};
2373 0 return @{delete $entries{$cxix}};
2374 }
2375 else {
2376 0 ▶ if ($iter{$cxix} = scalar @{$entries{$cxix}}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iter{$cxix} = scalar @{$entries{$cxix};}) { } 0 0 0
2377 0 return shift @{$entries{$cxix}};
2378 }
2379 else {
2380 # return undef for EOL
2381 0 delete $iter{$cxix};
2382 0 delete $entries{$cxix};
2383 0 return undef;
2384 }
2385 }
2386 }
2387  
2388 #
2389 # Latin-10 path globbing subroutine
2390 #
2391 0 ▶sub _do_glob {
Subroutine _do_glob: not called CC=44 SCAR=75.9
2392  
2393 0 my($cond,@expr) = @_;
2394 0 my @glob = ();
2395 0 my $fix_drive_relative_paths = 0;
2396  
2397 OUTER:
2398 0 for my $expr (@expr) {
2399 0 ▶ next OUTER if not defined $expr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $expr 0 0 0
2400 0 ▶ next OUTER if $expr eq '';
Branch: 1 branch
BranchTrueFalseTotal
if $expr eq "" 0 0 0
2401  
2402 0 my @matched = ();
2403 0 my @globdir = ();
2404 0 my $head = '.';
2405 0 my $pathsep = '/';
2406 0 my $tail;
2407  
2408 # if argument is within quotes strip em and do no globbing
2409 0 ▶ if ($expr =~ /\A " ((?:$q_char)*?) " \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expr =~ /\A " ((?:$Elatin10::q_char)*?) " \z/mosx) 0 0 0
2410 0 $expr = $1;
2411 0 ▶ if ($cond eq 'd') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cond eq 'd') { } 0 0 0
2412 0 ▶ if (-d $expr) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $expr) 0 0 0
2413 0 push @glob, $expr;
2414 }
2415 }
2416 else {
2417 0 ▶ if (-e $expr) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $expr) 0 0 0
2418 0 push @glob, $expr;
2419 }
2420 }
2421 0 next OUTER;
2422 }
2423  
2424 # wildcards with a drive prefix such as h:*.pm must be changed
2425 # to h:./*.pm to expand correctly
2426 0 ▶ if ($^O =~ /\A (?: MSWin32 | NetWare | symbian | dos ) \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O =~ /\A (?: MSWin32 | NetWare | symbian | dos ) \z/mosx) 0 0 0
2427 0 ▶ if ($expr =~ s# \A ((?:[A-Za-z]:)?) ([^/\\]) #$1./$2#oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expr =~ s( \A ((?:[A-Za-z]:)?) ([^/\\]) )[$1./$2]mosx) 0 0 0
2428 0 $fix_drive_relative_paths = 1;
2429 }
2430 }
2431  
2432 0 ▶ if (($head, $tail) = _parse_path($expr,$pathsep)) {
Branch: 1 branch
BranchTrueFalseTotal
if (($head, $tail) = _parse_path($expr, $pathsep)) 0 0 0
2433 0 ▶ if ($tail eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($tail eq "") 0 0 0
2434 0 push @glob, $expr;
2435 0 next OUTER;
2436 }
2437 0 ▶ if ($head =~ / \A (?:$q_char)*? [*?] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head =~ / \A (?:$Elatin10::q_char)*? [*?] /mosx) 0 0 0
2438 0 ▶ if (@globdir = _do_glob('d', $head)) {
Branch: 1 branch
BranchTrueFalseTotal
if (@globdir = _do_glob("d", $head)) 0 0 0
2439 0 push @glob, _do_glob($cond, map {"$_$pathsep$tail"} @globdir);
2440 0 next OUTER;
2441 }
2442 }
2443 0 ▶ if ($head eq '' or $head =~ /\A [A-Za-z]: \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head eq "" or $head =~ /\A [A-Za-z]: \z/mosx) 0 0 0
Condition0%0/3
$head eq "" or $head =~ /\A [A-Za-z]: \z/mosx
l!l&&r!l&&!r
000
MC/DC0%0/2
$head eq "" or $head =~ /\A [A-Za-z]: \z/mosx
$head eq "" $head =~ /\A [A-Za-z]: \z/mosx
Truth table0%0/3
A or B
A= $head eq ""B= $head =~ /\A [A-Za-z]: \z/mosx
ABresult
1X1
011
000
2444 0 $head .= $pathsep;
2445 }
2446 0 $expr = $tail;
2447 }
2448  
2449 # If file component has no wildcards, we can avoid opendir
2450 0 ▶ if ($expr !~ / \A (?:$q_char)*? [*?] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($expr =~ / \A (?:$Elatin10::q_char)*? [*?] /mosx) 0 0 0
2451 0 ▶ if ($head eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($head eq ".") 0 0 0
2452 0 $head = '';
2453 }
2454 0 ▶ if ($head ne '' and ($head =~ / \G ($q_char) /oxmsg)[-1] ne $pathsep) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head ne "" and ($head =~ / \G ($Elatin10::q_char) /gmosx)[-1] ne $pathsep) 0 0 0
Condition0%0/3
$head ne "" and ($head =~ / \G ($Elatin10::q_char) /gmosx)[-1] ne $pathsep
!ll&&!rl&&r
000
MC/DC0%0/2
$head ne "" and ($head =~ / \G ($Elatin10::q_char) /gmosx)[-1] ne $pathsep
$head ne "" ($head =~ / \G ($Elatin10::q_char) /gmosx)[-1] ne $pathsep
Truth table0%0/3
A and B
A= $head ne ""B= ($head =~ / \G ($Elatin10::q_char) /gmosx)[-1] ne $pathsep
ABresult
0X0
100
111
2455 0 $head .= $pathsep;
2456 }
2457 0 $head .= $expr;
2458 0 ▶ if ($cond eq 'd') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cond eq 'd') { } 0 0 0
2459 0 ▶ if (-d $head) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $head) 0 0 0
2460 0 push @glob, $head;
2461 }
2462 }
2463 else {
2464 0 ▶ if (-e $head) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $head) 0 0 0
2465 0 push @glob, $head;
2466 }
2467 }
2468 0 next OUTER;
2469 }
2470 0 ▶ opendir(*DIR, $head) or next OUTER;
Branch: 1 branch
BranchTrueFalseTotal
opendir *DIR, $head or next OUTER 0 0 0
2471 0 my @leaf = readdir DIR;
2472 0 closedir DIR;
2473  
2474 0 ▶ if ($head eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($head eq ".") 0 0 0
2475 0 $head = '';
2476 }
2477 0 ▶ if ($head ne '' and ($head =~ / \G ($q_char) /oxmsg)[-1] ne $pathsep) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head ne "" and ($head =~ / \G ($Elatin10::q_char) /gmosx)[-1] ne $pathsep) 0 0 0
Condition0%0/3
$head ne "" and ($head =~ / \G ($Elatin10::q_char) /gmosx)[-1] ne $pathsep
!ll&&!rl&&r
000
MC/DC0%0/2
$head ne "" and ($head =~ / \G ($Elatin10::q_char) /gmosx)[-1] ne $pathsep
$head ne "" ($head =~ / \G ($Elatin10::q_char) /gmosx)[-1] ne $pathsep
Truth table0%0/3
A and B
A= $head ne ""B= ($head =~ / \G ($Elatin10::q_char) /gmosx)[-1] ne $pathsep
ABresult
0X0
100
111
2478 0 $head .= $pathsep;
2479 }
2480  
2481 0 my $pattern = '';
2482 0 ▶ while ($expr =~ / \G ($q_char) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expr =~ / \G ($Elatin10::q_char) /cgox) 0 0 0
2483 0 my $char = $1;
2484  
2485 # 6.9. Matching Shell Globs as Regular Expressions
2486 # in Chapter 6. Pattern Matching
2487 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2488 # (and so on)
2489  
2490 0 ▶ if ($char eq '*') {
Branch: 3 branches
BranchTrueFalseTotal
if ($char eq '*') { } 0 0 0
elsif ($char eq '?') { } 0 0 0
elsif ((my $fc = &fc($char)) ne $char) { } 0 0 0
2491 0 $pattern .= "(?:$your_char)*",
2492 }
2493 elsif ($char eq '?') {
2494 0 $pattern .= "(?:$your_char)?", # DOS style
2495 # $pattern .= "(?:$your_char)", # UNIX style
2496 }
2497 elsif ((my $fc = Elatin10::fc($char)) ne $char) {
2498 0 $pattern .= $fc;
2499 }
2500 else {
2501 0 $pattern .= quotemeta $char;
2502 }
2503 }
2504 0 ▶ my $matchsub = sub { Elatin10::fc($_[0]) =~ /\A $pattern \z/xms };
Subroutine __ANON__: not called CC=1 SCAR=6.9
2505  
2506 # if ($@) {
2507 # print STDERR "$0: $@\n";
2508 # next OUTER;
2509 # }
2510  
2511 INNER:
2512 0 for my $leaf (@leaf) {
2513 0 ▶ if ($leaf eq '.' or $leaf eq '..') {
Branch: 1 branch
BranchTrueFalseTotal
if ($leaf eq "." or $leaf eq "..") 0 0 0
Condition0%0/3
$leaf eq "." or $leaf eq ".."
l!l&&r!l&&!r
000
MC/DC0%0/2
$leaf eq "." or $leaf eq ".."
$leaf eq "." $leaf eq ".."
Truth table0%0/3
A or B
A= $leaf eq "."B= $leaf eq ".."
ABresult
1X1
011
000
2514 0 next INNER;
2515 }
2516 0 ▶ if ($cond eq 'd' and not -d "$head$leaf") {
Branch: 1 branch
BranchTrueFalseTotal
if ($cond eq "d" and not -d "$head$leaf") 0 0 0
Condition0%0/3
$cond eq "d" and not -d "$head$leaf"
!ll&&!rl&&r
000
MC/DC0%0/2
$cond eq "d" and not -d "$head$leaf"
$cond eq "d" not -d "$head$leaf"
Truth table0%0/3
A and not(B)
A= $cond eq "d"B= not -d "$head$leaf"
ABresult
0X0
100
111
2517 0 next INNER;
2518 }
2519  
2520 0 ▶ if (&$matchsub($leaf)) {
Branch: 1 branch
BranchTrueFalseTotal
if (&$matchsub($leaf)) 0 0 0
2521 0 push @matched, "$head$leaf";
2522 0 next INNER;
2523 }
2524  
2525 # [DOS compatibility special case]
2526 # Failed, add a trailing dot and try again, but only...
2527  
2528 0 ▶ if (Elatin10::index($leaf,'.') == -1 and # if name does not have a dot in it *and*
Branch: 1 branch
BranchTrueFalseTotal
if (&Elatin10::index($leaf, ".") == -1 and length $leaf <= 8 and &Elatin10::index($pattern, "\\.") != -1) 0 0 0
Condition0%0/6
&Elatin10::index($leaf, ".") == -1 and length $leaf <= 8 and &Elatin10::index($pattern, "\\.") != -1
!ll&&!rl&&r
000
&Elatin10::index($leaf, ".") == -1 and length $leaf <= 8
!ll&&!rl&&r
000
MC/DC0%0/3
&Elatin10::index($leaf, ".") == -1 and length $leaf <= 8 and &Elatin10::index($pattern, "\\.") != -1
&Elatin10::index($leaf, ".") == -1 length $leaf <= 8 &Elatin10::index($pattern, "\\.") != -1
Truth table0%0/4
A and B and C
A= &Elatin10::index($leaf, ".") == -1B= length $leaf <= 8C= &Elatin10::index($pattern, "\\.") != -1
ABCresult
0XX0
10X0
1100
1111
2529 CORE::length($leaf) <= 8 and # name is shorter than or equal to 8 chars *and*
2530 Elatin10::index($pattern,'\\.') != -1 # pattern has a dot.
2531 ) {
2532 0 ▶ if (&$matchsub("$leaf.")) {
Branch: 1 branch
BranchTrueFalseTotal
if (&$matchsub("$leaf.")) 0 0 0
2533 0 push @matched, "$head$leaf";
2534 0 next INNER;
2535 }
2536 }
2537 }
2538 0 ▶ if (@matched) {
Branch: 1 branch
BranchTrueFalseTotal
if (@matched) 0 0 0
2539 0 push @glob, @matched;
2540 }
2541 }
2542 0 ▶ if ($fix_drive_relative_paths) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fix_drive_relative_paths) 0 0 0
2543 0 for my $glob (@glob) {
2544 0 $glob =~ s# \A ([A-Za-z]:) \./ #$1#oxms;
2545 }
2546 }
2547 0 return @glob;
2548 }
2549  
2550 #
2551 # Latin-10 parse line
2552 #
2553 0 ▶sub _parse_line {
Subroutine _parse_line: not called CC=3 SCAR=24.8
2554  
2555 0 my($line) = @_;
2556  
2557 0 $line .= ' ';
2558 0 my @piece = ();
2559 0 ▶ while ($line =~ /
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ / " ( (?>(?: [^"] )* ) ) " (?>\s+) | ( (?>(?: [^"\s] )* ) ) (?>\s+) /gmosx) 0 0 0
2560 " ( (?>(?: [^"] )* ) ) " (?>\s+) |
2561 ( (?>(?: [^"\s] )* ) ) (?>\s+)
2562 /oxmsg
2563 ) {
2564 0 ▶ push @piece, defined($1) ? $1 : $2;
Branch: 1 branch
BranchTrueFalseTotal
defined $1 ? : 0 0 0
2565 }
2566 0 return @piece;
2567 }
2568  
2569 #
2570 # Latin-10 parse path
2571 #
2572 0 ▶sub _parse_path {
Subroutine _parse_path: not called CC=2 SCAR=17.9
2573  
2574 0 my($path,$pathsep) = @_;
2575  
2576 0 $path .= '/';
2577 0 my @subpath = ();
2578 0 ▶ while ($path =~ /
Branch: 1 branch
BranchTrueFalseTotal
if ($path =~ m( ((?: [^/\\] )+?) [/\\] )gmosx) 0 0 0
2579 ((?: [^\/\\] )+?) [\/\\]
2580 /oxmsg
2581 ) {
2582 0 push @subpath, $1;
2583 }
2584  
2585 0 my $tail = pop @subpath;
2586 0 my $head = join $pathsep, @subpath;
2587 0 return $head, $tail;
2588 }
2589  
2590 #
2591 # via File::HomeDir::Windows 1.00
2592 #
2593 0 ▶sub my_home_MSWin32 {
Subroutine my_home_MSWin32: not called CC=9 SCAR=45.0
Pod undocumented
2594  
2595 # A lot of unix people and unix-derived tools rely on
2596 # the ability to overload HOME. We will support it too
2597 # so that they can replace raw HOME calls with File::HomeDir.
2598 0 ▶ if (exists $ENV{'HOME'} and $ENV{'HOME'}) {
Branch: 3 branches
BranchTrueFalseTotal
if (exists $ENV{'HOME'} and $ENV{'HOME'}) { } 0 0 0
elsif (exists $ENV{'USERPROFILE'} and $ENV{'USERPROFILE'}) { } 0 0 0
elsif (exists $ENV{'HOMEDRIVE'} and exists $ENV{'HOMEPATH'} and $ENV{'HOMEDRIVE'} and $ENV{'HOMEPATH'}) { } 0 0 0
Condition0%0/3
exists $ENV{"HOME"} and $ENV{"HOME"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $ENV{"HOME"} and $ENV{"HOME"}
exists $ENV{"HOME"} $ENV{"HOME"}
Truth table0%0/3
A and B
A= exists $ENV{"HOME"}B= $ENV{"HOME"}
ABresult
0X0
100
111
2599 0 return $ENV{'HOME'};
2600 }
2601  
2602 # Do we have a user profile?
2603 ▶ elsif (exists $ENV{'USERPROFILE'} and $ENV{'USERPROFILE'}) {
Condition0%0/3
exists $ENV{"USERPROFILE"} and $ENV{"USERPROFILE"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $ENV{"USERPROFILE"} and $ENV{"USERPROFILE"}
exists $ENV{"USERPROFILE"} $ENV{"USERPROFILE"}
Truth table0%0/3
A and B
A= exists $ENV{"USERPROFILE"}B= $ENV{"USERPROFILE"}
ABresult
0X0
100
111
2604 0 return $ENV{'USERPROFILE'};
2605 }
2606  
2607 # Some Windows use something like $ENV{'HOME'}
2608 ▶ elsif (exists $ENV{'HOMEDRIVE'} and exists $ENV{'HOMEPATH'} and $ENV{'HOMEDRIVE'} and $ENV{'HOMEPATH'}) {
Condition0%0/9
exists $ENV{"HOMEDRIVE"} and exists $ENV{"HOMEPATH"} and $ENV{"HOMEDRIVE"} and $ENV{"HOMEPATH"}
!ll&&!rl&&r
000
exists $ENV{"HOMEDRIVE"} and exists $ENV{"HOMEPATH"} and $ENV{"HOMEDRIVE"}
!ll&&!rl&&r
000
exists $ENV{"HOMEDRIVE"} and exists $ENV{"HOMEPATH"}
!ll&&!rl&&r
000
MC/DC0%0/4
exists $ENV{"HOMEDRIVE"} and exists $ENV{"HOMEPATH"} and $ENV{"HOMEDRIVE"} and $ENV{"HOMEPATH"}
exists $ENV{"HOMEDRIVE"} exists $ENV{"HOMEPATH"} $ENV{"HOMEDRIVE"} $ENV{"HOMEPATH"}
Truth table0%0/5
A and B and C and D
A= exists $ENV{"HOMEDRIVE"}B= exists $ENV{"HOMEPATH"}C= $ENV{"HOMEDRIVE"}D= $ENV{"HOMEPATH"}
ABCDresult
0XXX0
10XX0
110X0
11100
11111
2609 0 return join '', $ENV{'HOMEDRIVE'}, $ENV{'HOMEPATH'};
2610 }
2611  
2612 0 return undef;
2613 }
2614  
2615 #
2616 # via File::HomeDir::Unix 1.00
2617 #
2618 0 ▶sub my_home {
Subroutine my_home: not called CC=7 SCAR=40.3
Pod undocumented
2619 0 my $home;
2620  
2621 0 ▶ if (exists $ENV{'HOME'} and defined $ENV{'HOME'}) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $ENV{'HOME'} and defined $ENV{'HOME'}) { } 0 0 0
elsif (exists $ENV{'LOGDIR'} and $ENV{'LOGDIR'}) { } 0 0 0
Condition0%0/3
exists $ENV{"HOME"} and defined $ENV{"HOME"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $ENV{"HOME"} and defined $ENV{"HOME"}
exists $ENV{"HOME"} defined $ENV{"HOME"}
Truth table0%0/3
A and B
A= exists $ENV{"HOME"}B= defined $ENV{"HOME"}
ABresult
0X0
100
111
2622 0 $home = $ENV{'HOME'};
2623 }
2624  
2625 # This is from the original code, but I'm guessing
2626 # it means "login directory" and exists on some Unixes.
2627 ▶ elsif (exists $ENV{'LOGDIR'} and $ENV{'LOGDIR'}) {
Condition0%0/3
exists $ENV{"LOGDIR"} and $ENV{"LOGDIR"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $ENV{"LOGDIR"} and $ENV{"LOGDIR"}
exists $ENV{"LOGDIR"} $ENV{"LOGDIR"}
Truth table0%0/3
A and B
A= exists $ENV{"LOGDIR"}B= $ENV{"LOGDIR"}
ABresult
0X0
100
111
2628 0 $home = $ENV{'LOGDIR'};
2629 }
2630  
2631 ### More-desperate methods
2632  
2633 # Light desperation on any (Unixish) platform
2634 else {
2635 0 $home = CORE::eval q{ (getpwuid($<))[7] };
2636 }
2637  
2638 # On Unix in general, a non-existant home means "no home"
2639 # For example, "nobody"-like users might use /nonexistant
2640 0 ▶ if (defined $home and ! -d($home)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $home and not -d $home) 0 0 0
Condition0%0/3
defined $home and not -d $home
!ll&&!rl&&r
000
MC/DC0%0/2
defined $home and not -d $home
defined $home not -d $home
Truth table0%0/3
A and not(B)
A= defined $homeB= not -d $home
ABresult
0X0
100
111
2641 0 $home = undef;
2642 }
2643 0 return $home;
2644 }
2645  
2646 #
2647 # ${^PREMATCH}, $PREMATCH, $` the string preceding what was matched
2648 #
2649 56 ▶sub Elatin10::PREMATCH {
Subroutine PREMATCH: called CC=1 SCAR=0.0
Pod undocumented
2650 56 return $`;
2651 }
2652  
2653 #
2654 # ${^MATCH}, $MATCH, $& the string that matched
2655 #
2656 81 ▶sub Elatin10::MATCH {
Subroutine MATCH: called CC=1 SCAR=0.0
Pod undocumented
2657 81 return $&;
2658 }
2659  
2660 #
2661 # ${^POSTMATCH}, $POSTMATCH, $' the string following what was matched
2662 #
2663 42 ▶sub Elatin10::POSTMATCH {
Subroutine POSTMATCH: called CC=1 SCAR=0.0
Pod undocumented
2664 42 return $';
2665 }
2666  
2667 #
2668 # Latin-10 character to order (with parameter)
2669 #
2670 0 ▶sub Latin10::ord(;$) {
Subroutine ord: not called CC=4 SCAR=30.0
2671  
2672 0 ▶ local $_ = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
2673  
2674 0 ▶ if (/\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\A ($Elatin10::q_char) /mosx) { } 0 0 0
2675 0 my @ord = unpack 'C*', $1;
2676 0 my $ord = 0;
2677 0 ▶ while (my $o = shift @ord) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $o = shift @ord) 0 0 0
2678 0 $ord = $ord * 0x100 + $o;
2679 }
2680 0 return $ord;
2681 }
2682 else {
2683 0 return CORE::ord $_;
2684 }
2685 }
2686  
2687 #
2688 # Latin-10 character to order (without parameter)
2689 #
2690 0 ▶sub Latin10::ord_() {
Subroutine ord_: not called CC=3 SCAR=24.8
2691  
2692 0 ▶ if (/\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\A ($Elatin10::q_char) /mosx) { } 0 0 0
2693 0 my @ord = unpack 'C*', $1;
2694 0 my $ord = 0;
2695 0 ▶ while (my $o = shift @ord) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $o = shift @ord) 0 0 0
2696 0 $ord = $ord * 0x100 + $o;
2697 }
2698 0 return $ord;
2699 }
2700 else {
2701 0 return CORE::ord $_;
2702 }
2703 }
2704  
2705 #
2706 # Latin-10 reverse
2707 #
2708 0 ▶sub Latin10::reverse(@) {
Subroutine reverse: not called CC=2 SCAR=17.9
2709  
2710 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2711 0 return CORE::reverse @_;
2712 }
2713 else {
2714  
2715 # One of us once cornered Larry in an elevator and asked him what
2716 # problem he was solving with this, but he looked as far off into
2717 # the distance as he could in an elevator and said, "It seemed like
2718 # a good idea at the time."
2719  
2720 0 return join '', CORE::reverse(join('',@_) =~ /\G ($q_char) /oxmsg);
2721 }
2722 }
2723  
2724 #
2725 # Latin-10 getc (with parameter, without parameter)
2726 #
2727 20 ▶sub Latin10::getc(;*@) {
Subroutine getc: called CC=9 SCAR=26.7
2728  
2729 20 my($package) = caller;
2730 20 ▶ my $fh = @_ ? qualify_to_ref(shift,$package) : \*STDIN;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 20 0 20
2731 20 ▶ croak 'Too many arguments for Latin10::getc' if @_ and not wantarray;
Branch: 1 branch
BranchTrueFalseTotal
if @_ and not wantarray 0 20 20
Condition33%1/3
@_ and not wantarray
!ll&&!rl&&r
2000
MC/DC0%0/2
@_ and not wantarray
@_ not wantarray
Truth table33%1/3
A and not(B)
A= @_B= not wantarray
ABresult
0X0
100
111
2732  
2733 0 my @length = sort { $a <=> $b } keys %range_tr;
2734 20 my $getc = '';
2735 20 for my $length ($length[0] .. $length[-1]) {
2736 20 $getc .= CORE::getc($fh);
2737 20 ▶ if (exists $range_tr{CORE::length($getc)}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{length $getc}) 20 0 20
2738 20 ▶ if ($getc =~ /\A ${Elatin10::dot_s} \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($getc =~ /\A $Elatin10::dot_s \z/mosx) 20 0 20
2739 20 ▶ return wantarray ? ($getc,@_) : $getc;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 20 20
2740 }
2741 }
2742 }
2743 0 ▶ return wantarray ? ($getc,@_) : $getc;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
2744 }
2745  
2746 #
2747 # Latin-10 length by character
2748 #
2749 0 ▶sub Latin10::length(;$) {
Subroutine length: not called CC=2 SCAR=17.9
2750  
2751 0 ▶ local $_ = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
2752  
2753 0 local @_ = /\G ($q_char) /oxmsg;
2754 0 return scalar @_;
2755 }
2756  
2757 #
2758 # Latin-10 substr by character
2759 #
2760 424 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=7.0
2761  
2762 # P.232 The lvalue Attribute
2763 # in Chapter 6: Subroutines
2764 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2765  
2766 # P.336 The lvalue Attribute
2767 # in Chapter 7: Subroutines
2768 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2769  
2770 # P.144 8.4 Lvalue subroutines
2771 # in Chapter 8: perlsub: Perl subroutines
2772 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
2773  
2774 0 ▶ CORE::eval sprintf(<<'END', ($] >= 5.014000) ? ':lvalue' : '');
Subroutine __ANON__: not called CC=1 SCAR=0.0
Subroutine __ANON__: not called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: not called CC=1 SCAR=0.0
Subroutine substr: called CC=11 SCAR=24.3
Branch: 10 branches
BranchTrueFalseTotal
$] >= 5.014 ? : 424 0 424
if ($offset > scalar @char or $offset < -1 * scalar(@char)) 2 25 27
if (@_ == 4) { } 1 24 25
elsif (@_ == 3) { } 21 3 24
if ($offset == 0) { } 0 21 21
elsif ($offset > 0) { } 20 1 21
if ($length == 0) { } 0 21 21
elsif ($length > 0) { } 20 1 21
if ($offset == 0) { } 0 3 3
elsif ($offset > 0) { } 2 1 3
Condition66%2/3
$offset > scalar @char or $offset < -1 * scalar(@char)
l!l&&r!l&&!r
2025
MC/DC50%1/2
$offset > scalar @char or $offset < -1 * scalar(@char)
$offset > scalar @char $offset < -1 * scalar(@char)
Truth table66%2/3
A or B
A= $offset > scalar @charB= $offset < -1 * scalar(@char)
ABresult
1X1
011
000
2775 # vv----------------------*******
2776 sub Latin10::substr($$;$$) %s {
2777  
2778 my @char = $_[0] =~ /\G (?>$q_char) /oxmsg;
2779  
2780 # If the substring is beyond either end of the string, substr() returns the undefined
2781 # value and produces a warning. When used as an lvalue, specifying a substring that
2782 # is entirely outside the string raises an exception.
2783 # http://perldoc.perl.org/functions/substr.html
2784  
2785 # A return with no argument returns the scalar value undef in scalar context,
2786 # an empty list () in list context, and (naturally) nothing at all in void
2787 # context.
2788  
2789 my $offset = $_[1];
2790 if (($offset > scalar(@char)) or ($offset < (-1 * scalar(@char)))) {
2791 return;
2792 }
2793  
2794 # substr($string,$offset,$length,$replacement)
2795 if (@_ == 4) {
2796 my(undef,undef,$length,$replacement) = @_;
2797 my $substr = join '', splice(@char, $offset, $length, $replacement);
2798 $_[0] = join '', @char;
2799  
2800 # return $substr; this doesn't work, don't say "return"
2801 $substr;
2802 }
2803  
2804 # substr($string,$offset,$length)
2805 elsif (@_ == 3) {
2806 my(undef,undef,$length) = @_;
2807 my $octet_offset = 0;
2808 my $octet_length = 0;
2809 if ($offset == 0) {
2810 $octet_offset = 0;
2811 }
2812 elsif ($offset > 0) {
2813 local $SIG{__WARN__} = sub {}; # avoid: Use of uninitialized value in join or string at here
2814 $octet_offset = CORE::length(join '', @char[0..$offset-1]);
2815 }
2816 else {
2817 local $SIG{__WARN__} = sub {}; # avoid: Use of uninitialized value in join or string at here
2818 $octet_offset = -1 * CORE::length(join '', @char[$#char+$offset+1..$#char]);
2819 }
2820 if ($length == 0) {
2821 $octet_length = 0;
2822 }
2823 elsif ($length > 0) {
2824 local $SIG{__WARN__} = sub {}; # avoid: Use of uninitialized value in join or string at here
2825 $octet_length = CORE::length(join '', @char[$offset..$offset+$length-1]);
2826 }
2827 else {
2828 local $SIG{__WARN__} = sub {}; # avoid: Use of uninitialized value in join or string at here
2829 $octet_length = -1 * CORE::length(join '', @char[$#char+$length+1..$#char]);
2830 }
2831 CORE::substr($_[0], $octet_offset, $octet_length);
2832 }
2833  
2834 # substr($string,$offset)
2835 else {
2836 my $octet_offset = 0;
2837 if ($offset == 0) {
2838 $octet_offset = 0;
2839 }
2840 elsif ($offset > 0) {
2841 $octet_offset = CORE::length(join '', @char[0..$offset-1]);
2842 }
2843 else {
2844 $octet_offset = -1 * CORE::length(join '', @char[$#char+$offset+1..$#char]);
2845 }
2846 CORE::substr($_[0], $octet_offset);
2847 }
2848 }
2849 END
2850 }
2851  
2852 #
2853 # Latin-10 index by character
2854 #
2855 0 ▶sub Latin10::index($$;$) {
Subroutine index: not called CC=3 SCAR=24.8
2856  
2857 0 my $index;
2858 0 ▶ if (@_ == 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 3) { } 0 0 0
2859 0 $index = Elatin10::index($_[0], $_[1], CORE::length(Latin10::substr($_[0], 0, $_[2])));
2860 }
2861 else {
2862 0 $index = Elatin10::index($_[0], $_[1]);
2863 }
2864  
2865 0 ▶ if ($index == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($index == -1) { } 0 0 0
2866 0 return -1;
2867 }
2868 else {
2869 0 return Latin10::length(CORE::substr $_[0], 0, $index);
2870 }
2871 }
2872  
2873 #
2874 # Latin-10 rindex by character
2875 #
2876 0 ▶sub Latin10::rindex($$;$) {
Subroutine rindex: not called CC=3 SCAR=24.8
2877  
2878 0 my $rindex;
2879 0 ▶ if (@_ == 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 3) { } 0 0 0
2880 0 $rindex = Elatin10::rindex($_[0], $_[1], CORE::length(Latin10::substr($_[0], 0, $_[2])));
2881 }
2882 else {
2883 0 $rindex = Elatin10::rindex($_[0], $_[1]);
2884 }
2885  
2886 0 ▶ if ($rindex == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rindex == -1) { } 0 0 0
2887 0 return -1;
2888 }
2889 else {
2890 0 return Latin10::length(CORE::substr $_[0], 0, $rindex);
2891 }
2892 }
2893  
2894 # when 'm//', '/' means regexp match 'm//' and '?' means regexp match '??'
2895 # when 'div', '/' means division operator and '?' means conditional operator (condition ? then : else)
2896 424 ▶use vars qw($slash); $slash = 'm//';
Subroutine BEGIN: called CC=1 SCAR=0.0
2897  
2898 # ord() to ord() or Latin10::ord()
2899 424 my $function_ord = 'ord';
2900  
2901 # ord to ord or Latin10::ord_
2902 424 my $function_ord_ = 'ord';
2903  
2904 # reverse to reverse or Latin10::reverse
2905 424 my $function_reverse = 'reverse';
2906  
2907 # getc to getc or Latin10::getc
2908 424 my $function_getc = 'getc';
2909  
2910 # P.1023 Appendix W.9 Multibyte Anchoring
2911 # of ISBN 1-56592-224-7 CJKV Information Processing
2912  
2913 424 my $anchor = '';
2914  
2915 424 ▶use vars qw($nest);
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
2916  
2917 # regexp of nested parens in qqXX
2918  
2919 # P.340 Matching Nested Constructs with Embedded Code
2920 # in Chapter 7: Perl
2921 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
2922  
2923 my $qq_paren = qr{(?{local $nest=0}) (?>(?:
2924 [^\\()] |
2925 \( (?{$nest++}) |
2926 \) (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2927 \\ [^c] |
2928 \\c[\x40-\x5F] |
2929 [\x00-\xFF]
2930 424 }xms;
2931  
2932 my $qq_brace = qr{(?{local $nest=0}) (?>(?:
2933 [^\\{}] |
2934 \{ (?{$nest++}) |
2935 \} (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2936 \\ [^c] |
2937 \\c[\x40-\x5F] |
2938 [\x00-\xFF]
2939 424 }xms;
2940  
2941 my $qq_bracket = qr{(?{local $nest=0}) (?>(?:
2942 [^\\\[\]] |
2943 \[ (?{$nest++}) |
2944 \] (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2945 \\ [^c] |
2946 \\c[\x40-\x5F] |
2947 [\x00-\xFF]
2948 424 }xms;
2949  
2950 my $qq_angle = qr{(?{local $nest=0}) (?>(?:
2951 [^\\<>] |
2952 \< (?{$nest++}) |
2953 \> (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2954 \\ [^c] |
2955 \\c[\x40-\x5F] |
2956 [\x00-\xFF]
2957 424 }xms;
2958  
2959 424 my $qq_scalar = qr{(?: \{ (?:$qq_brace)*? \} |
2960 (?: ::)? (?:
2961 (?> [a-zA-Z_][a-zA-Z_0-9]* (?: ::[a-zA-Z_][a-zA-Z_0-9]*)* )
2962 (?>(?: \[ (?: \$\[ | \$\] | $qq_char )*? \] | \{ (?:$qq_brace)*? \} )*)
2963 (?>(?: (?: -> )? (?: [\$\@\%\&\*]\* | \$\#\* | [\@\%]? \[ (?: \$\[ | \$\] | $qq_char )*? \] | [\@\%\*]? \{ (?:$qq_brace)*? \} ) )*)
2964 ))
2965 }xms;
2966  
2967 424 my $qq_variable = qr{(?: \{ (?:$qq_brace)*? \} |
2968 (?: ::)? (?:
2969 (?>[0-9]+) |
2970 [^a-zA-Z_0-9\[\]] |
2971 ^[A-Z] |
2972 (?> [a-zA-Z_][a-zA-Z_0-9]* (?: ::[a-zA-Z_][a-zA-Z_0-9]*)* )
2973 (?>(?: \[ (?: \$\[ | \$\] | $qq_char )*? \] | \{ (?:$qq_brace)*? \} )*)
2974 (?>(?: (?: -> )? (?: [\$\@\%\&\*]\* | \$\#\* | [\@\%]? \[ (?: \$\[ | \$\] | $qq_char )*? \] | [\@\%\*]? \{ (?:$qq_brace)*? \} ) )*)
2975 ))
2976 }xms;
2977  
2978 424 my $qq_substr = qr{(?> Char::substr | Latin10::substr | CORE::substr | substr ) (?>\s*) \( $qq_paren \)
2979 }xms;
2980  
2981 # regexp of nested parens in qXX
2982 my $q_paren = qr{(?{local $nest=0}) (?>(?:
2983 [^()] |
2984 \( (?{$nest++}) |
2985 \) (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2986 [\x00-\xFF]
2987 424 }xms;
2988  
2989 my $q_brace = qr{(?{local $nest=0}) (?>(?:
2990 [^\{\}] |
2991 \{ (?{$nest++}) |
2992 \} (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2993 [\x00-\xFF]
2994 424 }xms;
2995  
2996 my $q_bracket = qr{(?{local $nest=0}) (?>(?:
2997 [^\[\]] |
2998 \[ (?{$nest++}) |
2999 \] (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
3000 [\x00-\xFF]
3001 424 }xms;
3002  
3003 my $q_angle = qr{(?{local $nest=0}) (?>(?:
3004 [^<>] |
3005 \< (?{$nest++}) |
3006 \> (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
3007 [\x00-\xFF]
3008 424 }xms;
3009  
3010 424 my $matched = '';
3011 424 my $s_matched = '';
3012  
3013 424 my $tr_variable = ''; # variable of tr///
3014 424 my $sub_variable = ''; # variable of s///
3015 424 my $bind_operator = ''; # =~ or !~
3016  
3017 424 my @heredoc = (); # here document
3018 424 my @heredoc_delimiter = ();
3019 424 my $here_script = ''; # here script
3020  
3021 #
3022 # escape Latin-10 script
3023 #
3024 548 ▶sub Latin10::escape(;$) {
Subroutine escape: called CC=3 SCAR=11.0
3025 548 ▶ local($_) = $_[0] if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 292 256 548
3026  
3027 # P.359 The Study Function
3028 # in Chapter 7: Perl
3029 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3030  
3031 548 study $_; # Yes, I studied study yesterday.
3032  
3033 # while all script
3034  
3035 # 6.14. Matching from Where the Last Pattern Left Off
3036 # in Chapter 6. Pattern Matching
3037 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
3038 # (and so on)
3039  
3040 # one member of Tag-team
3041 #
3042 # P.128 Start of match (or end of previous match): \G
3043 # P.130 Advanced Use of \G with Perl
3044 # in Chapter 3: Overview of Regular Expression Features and Flavors
3045 # P.255 Use leading anchors
3046 # P.256 Expose ^ and \G at the front expressions
3047 # in Chapter 6: Crafting an Efficient Expression
3048 # P.315 "Tag-team" matching with /gc
3049 # in Chapter 7: Perl
3050 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3051  
3052 548 my $e_script = '';
3053 548 ▶ while (not /\G \z/oxgc) { # member
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 86824 548 87372
3054 86824 $e_script .= Latin10::escape_token();
3055 }
3056  
3057 548 return $e_script;
3058 }
3059  
3060 #
3061 # escape Latin-10 token of script
3062 #
3063 86824 ▶sub Latin10::escape_token {
Subroutine escape_token: called CC=504 SCAR=109.3
3064  
3065 # \n output here document
3066  
3067 86824 my $ignore_modules = join('|', qw(
3068 utf8
3069 bytes
3070 charnames
3071 I18N::Japanese
3072 I18N::Collate
3073 I18N::JExt
3074 File::DosGlob
3075 Wild
3076 Wildcard
3077 Japanese
3078 ));
3079  
3080 # another member of Tag-team
3081 #
3082 # P.315 "Tag-team" matching with /gc
3083 # in Chapter 7: Perl
3084 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3085  
3086 86824 ▶ if (/\G ( \n ) /oxgc) { # another member (and so on)
Branch: 139 branches
BranchTrueFalseTotal
if (/\G ( \n ) /cgox) { } 12832 73992 86824
elsif (/\G ((?>\s+)|\#.*) /cgox) { } 21402 52590 73992
elsif (/\G ( (?: if | elsif | unless | while | until | given | when ) (?>\s*) \( ) /cgox) { } 1644 50946 52590
elsif (/\G ( \( (?>\s*) (?: local \b | my \b | our \b | state \b )? (?>\s*) \$ $qq_scalar ) /cgox) { } 90 50856 50946
elsif (/\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /cgmosx) { } 4 50852 50856
elsif (/\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /cgmosx) { } 28 50824 50852
elsif (/\G ( \$' | \$\{'\} ) /cgmosx) { } 1 50823 50824
elsif (/\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /cgmosx) { } 3 50820 50823
elsif (/\G ( \$ $qq_scalar | $qq_substr ) /cgox) { } 1754 49066 50820
elsif (/\G ( [,;] ) /cgox) { } 5089 43977 49066
elsif (/\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /cgmosx) { } 0 43977 43977
elsif (/\G ( \$ 0 ) /cgmosx) { } 2 43975 43977
elsif (/\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /cgmosx) { } 0 43975 43975
elsif (/\G ( \$ \$ ) (?![\w\{]) /cgmosx) { } 1 43974 43975
elsif (/\G \$ ((?>[1-9][0-9]*)) /cgmosx) { } 4 43970 43974
elsif (/\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /cgmosx) { } 0 43970 43970
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /cgmosx) { } 0 43970 43970
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /cgmosx) { } 0 43970 43970
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /cgmosx) { } 0 43970 43970
elsif (/\G \$ (?>\s*) \{ ( (?>\s*) (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* ) (?>\s*) ) \} /cgmosx) { } 0 43970 43970
elsif (/\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /cgmosx) { } 0 43970 43970
elsif (/\G ( (?: [\$\@\%\&\*] | \$\# | -> | \b sub \b) (?>\s*) (?: split | chop | index | rindex | lc | uc | fc | chr | ord | reverse | getc | tr | y | q | qq | qx | qw | m | s | qr | glob | lstat | opendir | stat | unlink | chdir ) ) \b /cgmosx) { } 42 43928 43970
elsif (m{\G ( \$[\$\@\#\\\'\"/\?\(\)\[\]\<\>] ) }cgmosx) { } 63 43865 43928
elsif (/\G \b (while (?>\s*) \( (?>\s*) <[\$]?[A-Za-z_][A-Za-z_0-9]*> (?>\s*) \)) \b /cgox) { } 0 43865 43865
elsif (/\G \b while (?>\s*) \( (?>\s*) < ((?:[^>\0\a\e\f\n\r\t])+?) > (?>\s*) \) \b /cgox) { } 0 43865 43865
elsif (/\G \b while (?>\s*) \( (?>\s*) glob (?>\s*) \) /cgox) { } 0 43865 43865
elsif (/\G \b while (?>\s*) \( (?>\s*) glob \b /cgox) { } 0 43865 43865
elsif (/\G \b ( if | unless | while | until | for | when ) \b /cgox) { } 251 43614 43865
elsif (/\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /cgox) { } 19 43595 43614
elsif (/\G \b Char::eval (?= (?>\s*) \{ ) /cgox) { } 0 43595 43595
elsif (/\G \b Latin10::eval (?= (?>\s*) \{ ) /cgox) { } 22 43573 43595
elsif (/\G \b Char::eval \b (?! (?>\s*) => ) /cgox) { } 0 43573 43573
elsif (/\G \b Latin10::eval \b (?! (?>\s*) => ) /cgox) { } 168 43405 43573
elsif (/\G \b bytes::substr \b (?! (?>\s*) => ) /cgox) { } 2 43403 43405
elsif (/\G \b chop \b (?! (?>\s*) => ) /cgox) { } 0 43403 43403
elsif (/\G \b bytes::index \b (?! (?>\s*) => ) /cgox) { } 2 43401 43403
elsif (/\G \b Char::index \b (?! (?>\s*) => ) /cgox) { } 0 43401 43401
elsif (/\G \b Latin10::index \b (?! (?>\s*) => ) /cgox) { } 0 43401 43401
elsif (/\G \b index \b (?! (?>\s*) => ) /cgox) { } 0 43401 43401
elsif (/\G \b bytes::rindex \b (?! (?>\s*) => ) /cgox) { } 2 43399 43401
elsif (/\G \b Char::rindex \b (?! (?>\s*) => ) /cgox) { } 0 43399 43399
elsif (/\G \b Latin10::rindex \b (?! (?>\s*) => ) /cgox) { } 0 43399 43399
elsif (/\G \b rindex \b (?! (?>\s*) => ) /cgox) { } 0 43399 43399
elsif (/\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 1 43398 43399
elsif (/\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43398 43398
elsif (/\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 1 43397 43398
elsif (/\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43397 43397
elsif (/\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 6 43391 43397
elsif (/\G -s (?>\s*) (\") ((?:$Elatin10::qq_char)+?) (\") /cgox) { } 0 43391 43391
elsif (/\G -s (?>\s+) qq (?>\s*) (\#) ((?:$Elatin10::qq_char)+?) (\#) /cgox) { } 0 43391 43391
elsif (/\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /cgox) { } 0 43391 43391
elsif (/\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /cgox) { } 0 43391 43391
elsif (/\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /cgox) { } 0 43391 43391
elsif (/\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /cgox) { } 0 43391 43391
elsif (/\G -s (?>\s+) qq (?>\s*) (\S) ((?:$Elatin10::qq_char)+?) (\1) /cgox) { } 0 43391 43391
elsif (/\G -s (?>\s*) (\') ((?:\\\'|\\\\|$Elatin10::q_char)+?) (\') /cgox) { } 0 43391 43391
elsif (/\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$Elatin10::q_char)+?) (\#) /cgox) { } 0 43391 43391
elsif (/\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /cgox) { } 0 43391 43391
elsif (/\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /cgox) { } 0 43391 43391
elsif (/\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /cgox) { } 0 43391 43391
elsif (/\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /cgox) { } 0 43391 43391
elsif (/\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$Elatin10::q_char)+?) (\1) /cgox) { } 0 43391 43391
elsif (/\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)* ) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ) )*) /cgox) { } 0 43391 43391
elsif (/\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /cgox) { } 0 43391 43391
elsif (/\G -s (?= (?>\s+) [a-z]+) /cgox) { } 0 43391 43391
elsif (/\G -s (?>\s+) ((?>\w+)) /cgox) { } 0 43391 43391
elsif (/\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43389 43391
elsif (/\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43387 43389
elsif (/\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 36 43351 43387
elsif (/\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43349 43351
elsif (/\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 8 43341 43349
elsif (/\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43341 43341
elsif (/\G \b lc \b (?! (?>\s*) => ) /cgox) { } 0 43341 43341
elsif (/\G \b lcfirst \b (?! (?>\s*) => ) /cgox) { } 0 43341 43341
elsif (/\G \b uc \b (?! (?>\s*) => ) /cgox) { } 0 43341 43341
elsif (/\G \b ucfirst \b (?! (?>\s*) => ) /cgox) { } 0 43341 43341
elsif (/\G \b fc \b (?! (?>\s*) => ) /cgox) { } 0 43341 43341
elsif (/\G -s \b (?! (?>\s*) => ) /cgox) { } 0 43341 43341
elsif (/\G \b bytes::length \b (?! (?>\s*) => ) /cgox) { } 0 43341 43341
elsif (/\G \b bytes::chr \b (?! (?>\s*) => ) /cgox) { } 0 43341 43341
elsif (/\G \b chr \b (?! (?>\s*) => ) /cgox) { } 0 43341 43341
elsif (/\G \b bytes::ord \b (?! (?>\s*) => ) /cgox) { } 0 43341 43341
elsif (/\G \b ord \b (?! (?>\s*) => ) /cgox) { } 0 43341 43341
elsif (/\G \b glob \b (?! (?>\s*) => ) /cgox) { } 0 43341 43341
elsif (/\G \b reverse \b (?! (?>\s*) => ) /cgox) { } 0 43341 43341
elsif (/\G \b getc \b (?! (?>\s*) => ) /cgox) { } 8 43333 43341
elsif (/\G \b (split) \b (?! (?>\s*) => ) /cgox) { } 87 43246 43333
elsif (/\G \b ( tr | y ) \b /cgox) { } 4 43242 43246
elsif (/\G \b (qq) \b /cgox) { } 2252 40990 43242
elsif (/\G \b (qr) \b /cgox) { } 0 40990 40990
elsif (/\G \b (qw) \b /cgox) { } 16 40974 40990
elsif (/\G \b (qx) \b /cgox) { } 0 40974 40974
elsif (/\G \b (q) \b /cgox) { } 473 40501 40974
elsif (/\G \b (m) \b /cgox) { } 209 40292 40501
elsif (/\G \b (s) \b /cgox) { } 101 40191 40292
elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 0 40191 40191
elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 40191 40191
elsif (/\G \b require ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 40191 40191
elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [#\n]) /cgmosx) { } 37 40154 40191
elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 40154 40154
elsif (/\G \b use ((?>\s+) strict) \b /cgmosx) { } 0 40154 40154
elsif (/\G \b use (?>\s+) ((?>([1-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /cgmosx) { } 2 40152 40154
elsif (/\G \b use (?>\s+) ((?>v([0-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /cgmosx) { } 0 40152 40152
elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 2 40150 40152
elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 40150 40150
elsif (/\G \b use ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 40150 40150
elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 0 40150 40150
elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 40150 40150
elsif (/\G \b no ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 40150 40150
elsif (/\G \b use \b /cgmosx) { } 0 40150 40150
elsif (/\G \b no \b /cgmosx) { } 2 40148 40150
elsif (/\G (?<![\w\$\@\%\&\*]) (\') /cgox) { } 1142 39006 40148
elsif (/\G (\") /cgox) { } 1925 37081 39006
elsif (/\G (\`) /cgox) { } 1 37080 37081
elsif ($Elatin10::slash eq 'm//' and m[\G (/) ]cgox) { } 681 36399 37080
elsif ($Elatin10::slash eq 'm//' and /\G (\?) /cgox) { } 0 36399 36399
elsif (/\G ( <<>> ) /cgox) { } 0 36399 36399
elsif (/\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /cgox) { } 0 36399 36399
elsif (/\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /cgox) { } 6 36393 36399
elsif (/\G ( <<~ \\([a-zA-Z_0-9]+) ) /cgox) { } 3 36390 36393
elsif (/\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /cgox) { } 6 36384 36390
elsif (/\G ( <<~ ([a-zA-Z_0-9]+) ) /cgox) { } 3 36381 36384
elsif (/\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /cgox) { } 6 36375 36381
elsif (/\G ( << '([a-zA-Z_0-9]*)' ) /cgox) { } 72 36303 36375
elsif (/\G ( << \\([a-zA-Z_0-9]+) ) /cgox) { } 0 36303 36303
elsif (/\G ( << "([a-zA-Z_0-9]*)" ) /cgox) { } 36 36267 36303
elsif (/\G ( << ([a-zA-Z_0-9]+) ) /cgox) { } 42 36225 36267
elsif (/\G ( << `([a-zA-Z_0-9]*)` ) /cgox) { } 0 36225 36225
elsif (/\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/cgox) { } 12 36213 36225
elsif (/\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /cgox) { } 0 36213 36213
elsif (/\G < ((?:[^>\0\a\e\f\n\r\t])+?) > /cgox) { } 0 36213 36213
elsif (/\G ^ ( __DATA__ \n .*) \z /cgmosx) { } 0 36213 36213
elsif (/\G ^ ( __END__ \n .*) \z /cgmosx) { } 210 36003 36213
elsif (/\G ( \cD .*) \z /cgmosx) { } 0 36003 36003
elsif (/\G ( \cZ .*) \z /cgmosx) { } 0 36003 36003
elsif (/\G ( -- | \+\+ | [\)\}\]] ) /cgox) { } 5839 30164 36003
elsif (/\G ( \.\.\. ) /cgox) { } 7 30157 30164
elsif (m"\G ((?> !~~ | !~ | != | ! | %= | % | &&= | && | &= | &\.= | &\. | & | -= | -> | - | :(?>\s*)= | : | <<>> | <<= | <=> | <= | < | == | => | =~ | = | >>= | >> | >= | > | \*\*= | \*\* | \*= | \* | \+= | \+ | \.\. | \.= | \. | //= | // | /= | / | \? | \\ | \^= | \^\.= | \^\. | \^ | \b x= | \|\|= | \|\| | \|= | \|\.= | \|\. | \| | ~~ | ~\. | ~ | \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b | \b(?: print )\b | [,;\(\{\[] )) "cgox) { } 9799 20358 30157
elsif (/\G ($Elatin10::q_char) /cgox) { } 20358 0 20358
3087 12832 my $heredoc = '';
3088 12832 ▶ if (scalar(@heredoc_delimiter) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @heredoc_delimiter >= 1) 174 12658 12832
3089 174 $slash = 'm//';
3090  
3091 174 $heredoc = join '', @heredoc;
3092 174 @heredoc = ();
3093  
3094 # skip here document
3095 174 for my $heredoc_delimiter (@heredoc_delimiter) {
3096 174 /\G .*? \n $heredoc_delimiter \n/xmsgc;
3097 }
3098 174 @heredoc_delimiter = ();
3099  
3100 174 $here_script = '';
3101 }
3102 12832 return "\n" . $heredoc;
3103 }
3104  
3105 # ignore space, comment
3106 21402 elsif (/\G ((?>\s+)|\#.*) /oxgc) { return $1; }
3107  
3108 # if (, elsif (, unless (, while (, until (, given (, and when (
3109  
3110 # given, when
3111  
3112 # P.225 The given Statement
3113 # in Chapter 15: Smart Matching and given-when
3114 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
3115  
3116 # P.133 The given Statement
3117 # in Chapter 4: Statements and Declarations
3118 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
3119  
3120 elsif (/\G ( (?: if | elsif | unless | while | until | given | when ) (?>\s*) \( ) /oxgc) {
3121 1644 $slash = 'm//';
3122 1644 return $1;
3123 }
3124  
3125 # scalar variable ($scalar = ...) =~ tr///;
3126 # scalar variable ($scalar = ...) =~ s///;
3127  
3128 # state
3129  
3130 # P.68 Persistent, Private Variables
3131 # in Chapter 4: Subroutines
3132 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
3133  
3134 # P.160 Persistent Lexically Scoped Variables: state
3135 # in Chapter 4: Statements and Declarations
3136 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
3137  
3138 # (and so on)
3139  
3140 elsif (/\G ( \( (?>\s*) (?: local \b | my \b | our \b | state \b )? (?>\s*) \$ $qq_scalar ) /oxgc) {
3141 90 my $e_string = e_string($1);
3142  
3143 90 ▶ if (/\G ( (?>\s*) = $qq_paren \) ) ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= (?: tr | y ) \b ) /oxgc) {
Branch: 2 branches
BranchTrueFalseTotal
if (/\G ( (?>\s*) = $qq_paren \) ) ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= (?: tr | y ) \b ) /cgox) { } 0 90 90
elsif (/\G ( (?>\s*) = $qq_paren \) ) ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /cgox) { } 0 90 90
3144 0 $tr_variable = $e_string . e_string($1);
3145 0 $bind_operator = $2;
3146 0 $slash = 'm//';
3147 0 return '';
3148 }
3149 elsif (/\G ( (?>\s*) = $qq_paren \) ) ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /oxgc) {
3150 0 $sub_variable = $e_string . e_string($1);
3151 0 $bind_operator = $2;
3152 0 $slash = 'm//';
3153 0 return '';
3154 }
3155 else {
3156 90 $slash = 'div';
3157 90 return $e_string;
3158 }
3159 }
3160  
3161 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin10::PREMATCH()
3162 elsif (/\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /oxmsgc) {
3163 4 $slash = 'div';
3164 4 return q{Elatin10::PREMATCH()};
3165 }
3166  
3167 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin10::MATCH()
3168 elsif (/\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /oxmsgc) {
3169 28 $slash = 'div';
3170 28 return q{Elatin10::MATCH()};
3171 }
3172  
3173 # $', ${'} --> $', ${'}
3174 elsif (/\G ( \$' | \$\{'\} ) /oxmsgc) {
3175 1 $slash = 'div';
3176 1 return $1;
3177 }
3178  
3179 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin10::POSTMATCH()
3180 elsif (/\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /oxmsgc) {
3181 3 $slash = 'div';
3182 3 return q{Elatin10::POSTMATCH()};
3183 }
3184  
3185 # scalar variable $scalar =~ tr///;
3186 # scalar variable $scalar =~ s///;
3187 # substr() =~ tr///;
3188 # substr() =~ s///;
3189 elsif (/\G ( \$ $qq_scalar | $qq_substr ) /oxgc) {
3190 1754 my $scalar = e_string($1);
3191  
3192 1754 ▶ if (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= (?: tr | y ) \b ) /oxgc) {
Branch: 2 branches
BranchTrueFalseTotal
if (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= (?: tr | y ) \b ) /cgox) { } 2 1752 1754
elsif (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /cgox) { } 65 1687 1752
3193 2 $tr_variable = $scalar;
3194 2 $bind_operator = $1;
3195 2 $slash = 'm//';
3196 2 return '';
3197 }
3198 elsif (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /oxgc) {
3199 65 $sub_variable = $scalar;
3200 65 $bind_operator = $1;
3201 65 $slash = 'm//';
3202 65 return '';
3203 }
3204 else {
3205 1687 $slash = 'div';
3206 1687 return $scalar;
3207 }
3208 }
3209  
3210 # end of statement
3211 elsif (/\G ( [,;] ) /oxgc) {
3212 5089 $slash = 'm//';
3213  
3214 # clear tr/// variable
3215 5089 $tr_variable = '';
3216  
3217 # clear s/// variable
3218 5089 $sub_variable = '';
3219  
3220 5089 $bind_operator = '';
3221  
3222 5089 return $1;
3223 }
3224  
3225 # bareword
3226 elsif (/\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /oxmsgc) {
3227 0 return $1;
3228 }
3229  
3230 # $0 --> $0
3231 elsif (/\G ( \$ 0 ) /oxmsgc) {
3232 2 $slash = 'div';
3233 2 return $1;
3234 }
3235 elsif (/\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /oxmsgc) {
3236 0 $slash = 'div';
3237 0 return $1;
3238 }
3239  
3240 # $$ --> $$
3241 elsif (/\G ( \$ \$ ) (?![\w\{]) /oxmsgc) {
3242 1 $slash = 'div';
3243 1 return $1;
3244 }
3245  
3246 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
3247 # $1, $2, $3 --> $1, $2, $3 otherwise
3248 elsif (/\G \$ ((?>[1-9][0-9]*)) /oxmsgc) {
3249 4 $slash = 'div';
3250 4 return e_capture($1);
3251 }
3252 elsif (/\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /oxmsgc) {
3253 0 $slash = 'div';
3254 0 return e_capture($1);
3255 }
3256  
3257 # $$foo[ ... ] --> $ $foo->[ ... ]
3258 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /oxmsgc) {
3259 0 $slash = 'div';
3260 0 return e_capture($1.'->'.$2);
3261 }
3262  
3263 # $$foo{ ... } --> $ $foo->{ ... }
3264 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /oxmsgc) {
3265 0 $slash = 'div';
3266 0 return e_capture($1.'->'.$2);
3267 }
3268  
3269 # $$foo
3270 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /oxmsgc) {
3271 0 $slash = 'div';
3272 0 return e_capture($1);
3273 }
3274  
3275 # ${ foo }
3276 elsif (/\G \$ (?>\s*) \{ ( (?>\s*) (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* ) (?>\s*) ) \} /oxmsgc) {
3277 0 $slash = 'div';
3278 0 return '${' . $1 . '}';
3279 }
3280  
3281 # ${ ... }
3282 elsif (/\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /oxmsgc) {
3283 0 $slash = 'div';
3284 0 return e_capture($1);
3285 }
3286  
3287 # variable or function
3288 # $ @ % & * $ #
3289 elsif (/\G ( (?: [\$\@\%\&\*] | \$\# | -> | \b sub \b) (?>\s*) (?: split | chop | index | rindex | lc | uc | fc | chr | ord | reverse | getc | tr | y | q | qq | qx | qw | m | s | qr | glob | lstat | opendir | stat | unlink | chdir ) ) \b /oxmsgc) {
3290 42 $slash = 'div';
3291 42 return $1;
3292 }
3293 # $ $ $ $ $ $ $ $ $ $ $ $ $ $
3294 # $ @ # \ ' " / ? ( ) [ ] < >
3295 elsif (/\G ( \$[\$\@\#\\\'\"\/\?\(\)\[\]\<\>] ) /oxmsgc) {
3296 63 $slash = 'div';
3297 63 return $1;
3298 }
3299  
3300 # while (<FILEHANDLE>)
3301 elsif (/\G \b (while (?>\s*) \( (?>\s*) <[\$]?[A-Za-z_][A-Za-z_0-9]*> (?>\s*) \)) \b /oxgc) {
3302 0 return $1;
3303 }
3304  
3305 # while (<WILDCARD>) --- glob
3306  
3307 # avoid "Error: Runtime exception" of perl version 5.005_03
3308  
3309 elsif (/\G \b while (?>\s*) \( (?>\s*) < ((?:[^>\0\a\e\f\n\r\t])+?) > (?>\s*) \) \b /oxgc) {
3310 0 return 'while ($_ = Elatin10::glob("' . $1 . '"))';
3311 }
3312  
3313 # while (glob)
3314 elsif (/\G \b while (?>\s*) \( (?>\s*) glob (?>\s*) \) /oxgc) {
3315 0 return 'while ($_ = Elatin10::glob_)';
3316 }
3317  
3318 # while (glob(WILDCARD))
3319 elsif (/\G \b while (?>\s*) \( (?>\s*) glob \b /oxgc) {
3320 0 return 'while ($_ = Elatin10::glob';
3321 }
3322  
3323 # doit if, doit unless, doit while, doit until, doit for, doit when
3324 251 elsif (/\G \b ( if | unless | while | until | for | when ) \b /oxgc) { $slash = 'm//'; return $1; }
3325  
3326 # subroutines of package Elatin10
3327 19 elsif (/\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /oxgc) { $slash = 'm//'; return $1; }
3328 0 elsif (/\G \b Char::eval (?= (?>\s*) \{ ) /oxgc) { $slash = 'm//'; return 'eval'; }
3329 22 elsif (/\G \b Latin10::eval (?= (?>\s*) \{ ) /oxgc) { $slash = 'm//'; return 'eval'; }
3330 0 elsif (/\G \b Char::eval \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'eval Char::escape'; }
3331 168 elsif (/\G \b Latin10::eval \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'eval Latin10::escape'; }
3332 2 elsif (/\G \b bytes::substr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'substr'; }
3333 0 elsif (/\G \b chop \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin10::chop'; }
3334 2 elsif (/\G \b bytes::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'index'; }
3335 0 elsif (/\G \b Char::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Char::index'; }
3336 0 elsif (/\G \b Latin10::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Latin10::index'; }
3337 0 elsif (/\G \b index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin10::index'; }
3338 2 elsif (/\G \b bytes::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'rindex'; }
3339 0 elsif (/\G \b Char::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Char::rindex'; }
3340 0 elsif (/\G \b Latin10::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Latin10::rindex'; }
3341 0 elsif (/\G \b rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin10::rindex'; }
3342 1 elsif (/\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin10::lc'; }
3343 0 elsif (/\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin10::lcfirst'; }
3344 1 elsif (/\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin10::uc'; }
3345 0 elsif (/\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin10::ucfirst'; }
3346 6 elsif (/\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin10::fc'; }
3347  
3348 # "-s '' ..." means file test "-s 'filename' ..." (not means "- s/// ...")
3349 0 elsif (/\G -s (?>\s*) (\") ((?:$qq_char)+?) (\") /oxgc) { $slash = 'm//'; return '-s ' . e_qq('', $1,$3,$2); }
3350 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\#) ((?:$qq_char)+?) (\#) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3351 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3352 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3353 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3354 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3355 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\S) ((?:$qq_char)+?) (\1) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3356  
3357 0 elsif (/\G -s (?>\s*) (\') ((?:\\\'|\\\\|$q_char)+?) (\') /oxgc) { $slash = 'm//'; return '-s ' . e_q ('', $1,$3,$2); }
3358 0 elsif (/\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$q_char)+?) (\#) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3359 0 elsif (/\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3360 0 elsif (/\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3361 0 elsif (/\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3362 0 elsif (/\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3363 0 elsif (/\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$q_char)+?) (\1) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3364  
3365 elsif (/\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)* ) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ) )*) /oxgc)
3366 0 { $slash = 'm//'; return "-s $1"; }
3367 0 elsif (/\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /oxgc) { $slash = 'm//'; return "-s ($1)"; }
3368 0 elsif (/\G -s (?= (?>\s+) [a-z]+) /oxgc) { $slash = 'm//'; return '-s'; }
3369 0 elsif (/\G -s (?>\s+) ((?>\w+)) /oxgc) { $slash = 'm//'; return "-s $1"; }
3370  
3371 2 elsif (/\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'length'; }
3372 2 elsif (/\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'chr'; }
3373 36 elsif (/\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin10::chr'; }
3374 2 elsif (/\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'div'; return 'ord'; }
3375 8 elsif (/\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'div'; return $function_ord; }
3376 0 elsif (/\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin10::glob'; }
3377 0 elsif (/\G \b lc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin10::lc_'; }
3378 0 elsif (/\G \b lcfirst \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin10::lcfirst_'; }
3379 0 elsif (/\G \b uc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin10::uc_'; }
3380 0 elsif (/\G \b ucfirst \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin10::ucfirst_'; }
3381 0 elsif (/\G \b fc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin10::fc_'; }
3382 0 elsif (/\G -s \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return '-s '; }
3383  
3384 0 elsif (/\G \b bytes::length \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'length'; }
3385 0 elsif (/\G \b bytes::chr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'chr'; }
3386 0 elsif (/\G \b chr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin10::chr_'; }
3387 0 elsif (/\G \b bytes::ord \b (?! (?>\s*) => ) /oxgc) { $slash = 'div'; return 'ord'; }
3388 0 elsif (/\G \b ord \b (?! (?>\s*) => ) /oxgc) { $slash = 'div'; return $function_ord_; }
3389 0 elsif (/\G \b glob \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin10::glob_'; }
3390 0 elsif (/\G \b reverse \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return $function_reverse; }
3391 8 elsif (/\G \b getc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return $function_getc; }
3392 # split
3393 elsif (/\G \b (split) \b (?! (?>\s*) => ) /oxgc) {
3394 87 $slash = 'm//';
3395  
3396 87 my $e = '';
3397 87 ▶ while (/\G ( (?>\s+) | \( | \#.* ) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\G ( (?>\s+) | \( | \#.* ) /cgox) 85 87 172
3398 85 $e .= $1;
3399 }
3400  
3401 # end of split
3402 87 ▶ if (/\G (?= [,;\)\}\]] ) /oxgc) { return 'Elatin10::split' . $e; }
Branch: 23 branches
BranchTrueFalseTotal
if (/\G (?= [,;\)\}\]] ) /cgox) { } 2 85 87
elsif (/\G ( [\$\@\&\*] $qq_scalar ) /cgox) { } 1 84 85
elsif (/\G \b qq (\#) [ ] (\#) /cgox) { } 0 84 84
elsif (/\G \b qq ((?>\s*)) (\() [ ] (\)) /cgox) { } 0 84 84
elsif (/\G \b qq ((?>\s*)) (\{) [ ] (\}) /cgox) { } 0 84 84
elsif (/\G \b qq ((?>\s*)) (\[) [ ] (\]) /cgox) { } 0 84 84
elsif (/\G \b qq ((?>\s*)) (\<) [ ] (\>) /cgox) { } 0 84 84
elsif (/\G \b qq ((?>\s*)) (\S) [ ] (\2) /cgox) { } 0 84 84
elsif (/\G \b q (\#) [ ] (\#) /cgox) { } 0 84 84
elsif (/\G \b q ((?>\s*)) (\() [ ] (\)) /cgox) { } 0 84 84
elsif (/\G \b q ((?>\s*)) (\{) [ ] (\}) /cgox) { } 0 84 84
elsif (/\G \b q ((?>\s*)) (\[) [ ] (\]) /cgox) { } 0 84 84
elsif (/\G \b q ((?>\s*)) (\<) [ ] (\>) /cgox) { } 0 84 84
elsif (/\G \b q ((?>\s*)) (\S) [ ] (\2) /cgox) { } 0 84 84
elsif (/\G ' [ ] ' /cgox) { } 10 74 84
elsif (/\G " [ ] " /cgox) { } 0 74 74
elsif (/\G \b (qq) \b /cgox) { } 0 74 74
elsif (/\G \b (qr) \b /cgox) { } 12 62 74
elsif (/\G \b (q) \b /cgox) { } 0 62 62
elsif (/\G \b (m) \b /cgox) { } 18 44 62
elsif (/\G (\') /cgox) { } 0 44 44
elsif (/\G (\") /cgox) { } 0 44 44
elsif (m[\G (/) ]cgox) { } 44 0 44
3403  
3404 # split scalar value
3405 1 elsif (/\G ( [\$\@\&\*] $qq_scalar ) /oxgc) { return 'Elatin10::split' . $e . e_string($1); }
3406  
3407 # split literal space
3408 0 elsif (/\G \b qq (\#) [ ] (\#) /oxgc) { return 'Elatin10::split' . $e . qq {qq$1 $2}; }
3409 0 elsif (/\G \b qq ((?>\s*)) (\() [ ] (\)) /oxgc) { return 'Elatin10::split' . $e . qq{$1qq$2 $3}; }
3410 0 elsif (/\G \b qq ((?>\s*)) (\{) [ ] (\}) /oxgc) { return 'Elatin10::split' . $e . qq{$1qq$2 $3}; }
3411 0 elsif (/\G \b qq ((?>\s*)) (\[) [ ] (\]) /oxgc) { return 'Elatin10::split' . $e . qq{$1qq$2 $3}; }
3412 0 elsif (/\G \b qq ((?>\s*)) (\<) [ ] (\>) /oxgc) { return 'Elatin10::split' . $e . qq{$1qq$2 $3}; }
3413 0 elsif (/\G \b qq ((?>\s*)) (\S) [ ] (\2) /oxgc) { return 'Elatin10::split' . $e . qq{$1qq$2 $3}; }
3414 0 elsif (/\G \b q (\#) [ ] (\#) /oxgc) { return 'Elatin10::split' . $e . qq {q$1 $2}; }
3415 0 elsif (/\G \b q ((?>\s*)) (\() [ ] (\)) /oxgc) { return 'Elatin10::split' . $e . qq {$1q$2 $3}; }
3416 0 elsif (/\G \b q ((?>\s*)) (\{) [ ] (\}) /oxgc) { return 'Elatin10::split' . $e . qq {$1q$2 $3}; }
3417 0 elsif (/\G \b q ((?>\s*)) (\[) [ ] (\]) /oxgc) { return 'Elatin10::split' . $e . qq {$1q$2 $3}; }
3418 0 elsif (/\G \b q ((?>\s*)) (\<) [ ] (\>) /oxgc) { return 'Elatin10::split' . $e . qq {$1q$2 $3}; }
3419 0 elsif (/\G \b q ((?>\s*)) (\S) [ ] (\2) /oxgc) { return 'Elatin10::split' . $e . qq {$1q$2 $3}; }
3420 10 elsif (/\G ' [ ] ' /oxgc) { return 'Elatin10::split' . $e . qq {' '}; }
3421 0 elsif (/\G " [ ] " /oxgc) { return 'Elatin10::split' . $e . qq {" "}; }
3422  
3423 # split qq//
3424 elsif (/\G \b (qq) \b /oxgc) {
3425 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin10::qq_char)*?) (\#) /cgox) { } 0 0 0
3426 else {
3427 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3428 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 7 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif (/\G (\() ((?:$qq_paren)*?) (\)) /cgox) { } 0 0 0
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /cgox) { } 0 0 0
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /cgox) { } 0 0 0
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /cgox) { } 0 0 0
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin10::qq_char)*?) (\1) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin10::qq_char)*?) (\1) /cgox) { } 0 0 0
3429 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq ( ) --> qr ( )
3430 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq { } --> qr { }
3431 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq [ ] --> qr [ ]
3432 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq < > --> qr < >
3433 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) /oxgc) { return e_split($e.'qr','{','}',$2,''); } # qq | | --> qr { }
3434 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq * * --> qr * *
3435 }
3436 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3437 }
3438 }
3439  
3440 # split qr//
3441 elsif (/\G \b (qr) \b /oxgc) {
3442 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1,$3,$2,$4); } # qr# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin10::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 12 12
3443 else {
3444 12 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 12 0 12
3445 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 8 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 12 12
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /cgox) { } 0 12 12
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /cgox) { } 0 12 12
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /cgox) { } 0 12 12
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /cgox) { } 0 12 12
elsif (/\G (\') ((?:$Elatin10::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 12 12
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin10::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 12 12
elsif (/\G (\S) ((?:$Elatin10::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 12 0 12
3446 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr ( )
3447 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr { }
3448 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr [ ]
3449 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr < >
3450 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { return e_split_q($e.'qr',$1, $3, $2,$4); } # qr ' '
3451 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr','{','}',$2,$4); } # qr | | --> qr { }
3452 12 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr * *
3453 }
3454 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3455 }
3456 }
3457  
3458 # split q//
3459 elsif (/\G \b (q) \b /oxgc) {
3460 0 ▶ if (/\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:\\\#|\\\\|$Elatin10::q_char)*?) (\#) /cgox) { } 0 0 0
3461 else {
3462 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3463 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 7 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif (/\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /cgox) { } 0 0 0
elsif (/\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /cgox) { } 0 0 0
elsif (/\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /cgox) { } 0 0 0
elsif (/\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /cgox) { } 0 0 0
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin10::q_char)*?) (\1) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:\\\\|\\\1| $Elatin10::q_char)*?) (\1) /cgox) { } 0 0 0
3464 0 elsif (/\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q ( ) --> qr ( )
3465 0 elsif (/\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q { } --> qr { }
3466 0 elsif (/\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q [ ] --> qr [ ]
3467 0 elsif (/\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q < > --> qr < >
3468 0 elsif (/\G ([*\-:?\\^|]) ((?:$q_char)*?) (\1) /oxgc) { return e_split_q($e.'qr','{','}',$2,''); } # q | | --> qr { }
3469 0 elsif (/\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q * * --> qr * *
3470 }
3471 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3472 }
3473 }
3474  
3475 # split m//
3476 elsif (/\G \b (m) \b /oxgc) {
3477 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1,$3,$2,$4); } # m# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin10::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
3478 else {
3479 18 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 18 0 18
3480 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 8 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 18 18
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
elsif (/\G (\') ((?:$Elatin10::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin10::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
elsif (/\G (\S) ((?:$Elatin10::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 18 0 18
3481 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m ( ) --> qr ( )
3482 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m { } --> qr { }
3483 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m [ ] --> qr [ ]
3484 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m < > --> qr < >
3485 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { return e_split_q($e.'qr',$1, $3, $2,$4); } # m ' ' --> qr ' '
3486 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr','{','}',$2,$4); } # m | | --> qr { }
3487 18 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m * * --> qr * *
3488 }
3489 0 die __FILE__, ": Search pattern not terminated\n";
3490 }
3491 }
3492  
3493 # split ''
3494 elsif (/\G (\') /oxgc) {
3495 0 my $q_string = '';
3496 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3497 0 ▶ if (/\G (\\\\) /oxgc) { $q_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 0 0
elsif (/\G (\\\') /cgox) { } 0 0 0
elsif (/\G \' /cgox) { } 0 0 0
elsif (/\G ($Elatin10::q_char) /cgox) { } 0 0 0
3498 0 elsif (/\G (\\\') /oxgc) { $q_string .= $1; } # splitqr'' --> split qr''
3499 0 elsif (/\G \' /oxgc) { return e_split_q($e.q{ qr},"'","'",$q_string,''); } # ' ' --> qr ' '
3500 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3501 }
3502 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3503 }
3504  
3505 # split ""
3506 elsif (/\G (\") /oxgc) {
3507 0 my $qq_string = '';
3508 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3509 0 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 0 0
elsif (/\G (\\\") /cgox) { } 0 0 0
elsif (/\G \" /cgox) { } 0 0 0
elsif (/\G ($Elatin10::q_char) /cgox) { } 0 0 0
3510 0 elsif (/\G (\\\") /oxgc) { $qq_string .= $1; } # splitqr"" --> split qr""
3511 0 elsif (/\G \" /oxgc) { return e_split($e.q{ qr},'"','"',$qq_string,''); } # " " --> qr " "
3512 0 elsif (/\G ($q_char) /oxgc) { $qq_string .= $1; }
3513 }
3514 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3515 }
3516  
3517 # split //
3518 elsif (/\G (\/) /oxgc) {
3519 44 my $regexp = '';
3520 44 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 381 0 381
3521 0 ▶ if (/\G (\\\\) /oxgc) { $regexp .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 381 381
elsif (m[\G (\\/) ]cgox) { } 0 381 381
elsif (m[\G / ([cgimosxpadlunbB]*) ]cgox) { } 44 337 381
elsif (/\G ($Elatin10::q_char) /cgox) { } 337 0 337
3522 0 elsif (/\G (\\\/) /oxgc) { $regexp .= $1; } # splitqr// --> split qr//
3523 44 elsif (/\G \/ ([cgimosxpadlunbB]*) /oxgc) { return e_split($e.q{ qr}, '/','/',$regexp,$1); } # / / --> qr / /
3524 337 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
3525 }
3526 0 die __FILE__, ": Search pattern not terminated\n";
3527 }
3528 }
3529  
3530 # tr/// or y///
3531  
3532 # about [cdsrbB]* (/B modifier)
3533 #
3534 # P.559 appendix C
3535 # of ISBN 4-89052-384-7 Programming perl
3536 # (Japanese title is: Perl puroguramingu)
3537  
3538 elsif (/\G \b ( tr | y ) \b /oxgc) {
3539 4 my $ope = $1;
3540  
3541 # $1 $2 $3 $4 $5 $6
3542 4 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ((?:$qq_char)*?) (\#) ([cdsrbB]*) /oxgc) { # tr# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin10::qq_char)*?) (\#) ((?:$Elatin10::qq_char)*?) (\#) ([cdsrbB]*) /cgox) { } 0 4 4
3543 0 my @tr = ($tr_variable,$2);
3544 0 return e_tr(@tr,'',$4,$6);
3545 }
3546 else {
3547 4 my $e = '';
3548 4 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 4 0 4
3549 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 4 4
elsif (/\G (\() ((?:$qq_paren)*?) (\)) /cgox) { } 0 4 4
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /cgox) { } 0 4 4
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /cgox) { } 0 4 4
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /cgox) { } 0 4 4
elsif (/\G (\S) ((?:$Elatin10::qq_char)*?) (\1) ((?:$Elatin10::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 4 0 4
3550 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) {
3551 0 my @tr = ($tr_variable,$2);
3552 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3553 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin10::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3554 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) ( )
3555 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) { }
3556 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) [ ]
3557 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) < >
3558 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) * *
3559 }
3560 0 die __FILE__, ": Transliteration replacement not terminated\n";
3561 }
3562 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) {
3563 0 my @tr = ($tr_variable,$2);
3564 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3565 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin10::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3566 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } ( )
3567 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } { }
3568 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } [ ]
3569 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } < >
3570 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } * *
3571 }
3572 0 die __FILE__, ": Transliteration replacement not terminated\n";
3573 }
3574 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) {
3575 0 my @tr = ($tr_variable,$2);
3576 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3577 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin10::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3578 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] ( )
3579 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] { }
3580 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] [ ]
3581 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] < >
3582 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] * *
3583 }
3584 0 die __FILE__, ": Transliteration replacement not terminated\n";
3585 }
3586 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) {
3587 0 my @tr = ($tr_variable,$2);
3588 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3589 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin10::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3590 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > ( )
3591 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > { }
3592 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > [ ]
3593 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > < >
3594 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > * *
3595 }
3596 0 die __FILE__, ": Transliteration replacement not terminated\n";
3597 }
3598 # $1 $2 $3 $4 $5 $6
3599 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { # tr * * *
3600 4 my @tr = ($tr_variable,$2);
3601 4 return e_tr(@tr,'',$4,$6);
3602 }
3603 }
3604 0 die __FILE__, ": Transliteration pattern not terminated\n";
3605 }
3606 }
3607  
3608 # qq//
3609 elsif (/\G \b (qq) \b /oxgc) {
3610 2252 my $ope = $1;
3611  
3612 # if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { return e_qq($ope,$1,$3,$2); } # qq# #
3613 2252 ▶ if (/\G (\#) /oxgc) { # qq# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) /cgox) { } 0 2252 2252
3614 0 my $qq_string = '';
3615 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3616 0 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 0 0
elsif (/\G (\\\#) /cgox) { } 0 0 0
elsif (/\G (\#) /cgox) { } 0 0 0
elsif (/\G ($Elatin10::qq_char) /cgox) { } 0 0 0
3617 0 elsif (/\G (\\\#) /oxgc) { $qq_string .= $1; }
3618 0 elsif (/\G (\#) /oxgc) { return e_qq($ope,'#','#',$qq_string); }
3619 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3620 }
3621 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3622 }
3623  
3624 else {
3625 2252 my $e = '';
3626 2252 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 2252 0 2252
3627 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 2252 2252
elsif (/\G (\() /cgox) { } 0 2252 2252
elsif (/\G (\{) /cgox) { } 2222 30 2252
elsif (/\G (\[) /cgox) { } 0 30 30
elsif (/\G (\<) /cgox) { } 30 0 30
elsif (/\G (\S) /cgox) { } 0 0 0
3628  
3629 # elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq ( )
3630 elsif (/\G (\() /oxgc) { # qq ( )
3631 0 my $qq_string = '';
3632 0 local $nest = 1;
3633 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3634 0 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 5 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 0 0
elsif (/\G (\\\)) /cgox) { } 0 0 0
elsif (/\G (\() /cgox) { } 0 0 0
elsif (/\G (\)) /cgox) { } 0 0 0
elsif (/\G ($Elatin10::qq_char) /cgox) { } 0 0 0
3635 0 elsif (/\G (\\\)) /oxgc) { $qq_string .= $1; }
3636 0 elsif (/\G (\() /oxgc) { $qq_string .= $1; $nest++; }
3637 elsif (/\G (\)) /oxgc) {
3638 0 ▶ if (--$nest == 0) { return $e . e_qq($ope,'(',')',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin10::nest == 0) { } 0 0 0
3639 0 else { $qq_string .= $1; }
3640 }
3641 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3642 }
3643 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3644 }
3645  
3646 # elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq { }
3647 elsif (/\G (\{) /oxgc) { # qq { }
3648 2222 my $qq_string = '';
3649 2222 local $nest = 1;
3650 2222 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 85117 0 85117
3651 85117 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 5 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 722 84395 85117
elsif (/\G (\\\}) /cgox) { } 0 84395 84395
elsif (/\G (\{) /cgox) { } 1189 83206 84395
elsif (/\G (\}) /cgox) { } 3411 79795 83206
elsif (/\G ($Elatin10::qq_char) /cgox) { } 79795 0 79795
3652 0 elsif (/\G (\\\}) /oxgc) { $qq_string .= $1; }
3653 1189 elsif (/\G (\{) /oxgc) { $qq_string .= $1; $nest++; }
3654 elsif (/\G (\}) /oxgc) {
3655 3411 ▶ if (--$nest == 0) { return $e . e_qq($ope,'{','}',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin10::nest == 0) { } 2222 1189 3411
3656 1189 else { $qq_string .= $1; }
3657 }
3658 79795 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3659 }
3660 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3661 }
3662  
3663 # elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq [ ]
3664 elsif (/\G (\[) /oxgc) { # qq [ ]
3665 0 my $qq_string = '';
3666 0 local $nest = 1;
3667 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3668 0 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 5 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 0 0
elsif (/\G (\\\]) /cgox) { } 0 0 0
elsif (/\G (\[) /cgox) { } 0 0 0
elsif (/\G (\]) /cgox) { } 0 0 0
elsif (/\G ($Elatin10::qq_char) /cgox) { } 0 0 0
3669 0 elsif (/\G (\\\]) /oxgc) { $qq_string .= $1; }
3670 0 elsif (/\G (\[) /oxgc) { $qq_string .= $1; $nest++; }
3671 elsif (/\G (\]) /oxgc) {
3672 0 ▶ if (--$nest == 0) { return $e . e_qq($ope,'[',']',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin10::nest == 0) { } 0 0 0
3673 0 else { $qq_string .= $1; }
3674 }
3675 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3676 }
3677 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3678 }
3679  
3680 # elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq < >
3681 elsif (/\G (\<) /oxgc) { # qq < >
3682 30 my $qq_string = '';
3683 30 local $nest = 1;
3684 30 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 1166 0 1166
3685 1166 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 5 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 22 1144 1166
elsif (/\G (\\\>) /cgox) { } 0 1144 1144
elsif (/\G (\<) /cgox) { } 0 1144 1144
elsif (/\G (\>) /cgox) { } 30 1114 1144
elsif (/\G ($Elatin10::qq_char) /cgox) { } 1114 0 1114
3686 0 elsif (/\G (\\\>) /oxgc) { $qq_string .= $1; }
3687 0 elsif (/\G (\<) /oxgc) { $qq_string .= $1; $nest++; }
3688 elsif (/\G (\>) /oxgc) {
3689 30 ▶ if (--$nest == 0) { return $e . e_qq($ope,'<','>',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin10::nest == 0) { } 30 0 30
3690 0 else { $qq_string .= $1; }
3691 }
3692 1114 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3693 }
3694 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3695 }
3696  
3697 # elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq * *
3698 elsif (/\G (\S) /oxgc) { # qq * *
3699 0 my $delimiter = $1;
3700 0 my $qq_string = '';
3701 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3702 0 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 0 0
elsif (/\G (\\\Q$delimiter\E) /cgox) { } 0 0 0
elsif (/\G (\Q$delimiter\E) /cgox) { } 0 0 0
elsif (/\G ($Elatin10::qq_char) /cgox) { } 0 0 0
3703 0 elsif (/\G (\\\Q$delimiter\E) /oxgc) { $qq_string .= $1; }
3704 0 elsif (/\G (\Q$delimiter\E) /oxgc) { return $e . e_qq($ope,$delimiter,$delimiter,$qq_string); }
3705 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3706 }
3707 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3708 }
3709 }
3710 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3711 }
3712 }
3713  
3714 # qr//
3715 elsif (/\G \b (qr) \b /oxgc) {
3716 0 my $ope = $1;
3717 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { # qr# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin10::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 0 0
3718 0 return e_qr($ope,$1,$3,$2,$4);
3719 }
3720 else {
3721 0 my $e = '';
3722 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3723 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 8 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\') ((?:$Elatin10::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin10::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin10::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
3724 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr ( )
3725 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr { }
3726 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr [ ]
3727 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr < >
3728 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { return $e . e_qr_q($ope,$1, $3, $2,$4); } # qr ' '
3729 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,'{','}',$2,$4); } # qr | | --> qr { }
3730 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr * *
3731 }
3732 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3733 }
3734 }
3735  
3736 # qw//
3737 elsif (/\G \b (qw) \b /oxgc) {
3738 16 my $ope = $1;
3739 16 ▶ if (/\G (\#) (.*?) (\#) /oxmsgc) { # qw# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) (.*?) (\#) /cgmosx) { } 0 16 16
3740 0 return e_qw($ope,$1,$3,$2);
3741 }
3742 else {
3743 16 my $e = '';
3744 16 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 16 0 16
3745 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 11 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 16 16
elsif (/\G (\() ([^(]*?) (\)) /cgmosx) { } 16 0 16
elsif (/\G (\() ((?:$q_paren)*?) (\)) /cgmosx) { } 0 0 0
elsif (/\G (\{) ([^{]*?) (\}) /cgmosx) { } 0 0 0
elsif (/\G (\{) ((?:$q_brace)*?) (\}) /cgmosx) { } 0 0 0
elsif (/\G (\[) ([^[]*?) (\]) /cgmosx) { } 0 0 0
elsif (/\G (\[) ((?:$q_bracket)*?) (\]) /cgmosx) { } 0 0 0
elsif (/\G (\<) ([^<]*?) (\>) /cgmosx) { } 0 0 0
elsif (/\G (\<) ((?:$q_angle)*?) (\>) /cgmosx) { } 0 0 0
elsif (/\G ([\x21-\x3F]) (.*?) (\1) /cgmosx) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin10::q_char)*?) (\1) /cgmosx) { } 0 0 0
3746  
3747 16 elsif (/\G (\() ([^(]*?) (\)) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw ( )
3748 0 elsif (/\G (\() ((?:$q_paren)*?) (\)) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw ( )
3749  
3750 0 elsif (/\G (\{) ([^{]*?) (\}) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw { }
3751 0 elsif (/\G (\{) ((?:$q_brace)*?) (\}) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw { }
3752  
3753 0 elsif (/\G (\[) ([^[]*?) (\]) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw [ ]
3754 0 elsif (/\G (\[) ((?:$q_bracket)*?) (\]) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw [ ]
3755  
3756 0 elsif (/\G (\<) ([^<]*?) (\>) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw < >
3757 0 elsif (/\G (\<) ((?:$q_angle)*?) (\>) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw < >
3758  
3759 0 elsif (/\G ([\x21-\x3F]) (.*?) (\1) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw * *
3760 0 elsif (/\G (\S) ((?:$q_char)*?) (\1) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw * *
3761 }
3762 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3763 }
3764 }
3765  
3766 # qx//
3767 elsif (/\G \b (qx) \b /oxgc) {
3768 0 my $ope = $1;
3769 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qx# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin10::qq_char)*?) (\#) /cgox) { } 0 0 0
3770 0 return e_qq($ope,$1,$3,$2);
3771 }
3772 else {
3773 0 my $e = '';
3774 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3775 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 7 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif (/\G (\() ((?:$qq_paren)*?) (\)) /cgox) { } 0 0 0
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /cgox) { } 0 0 0
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /cgox) { } 0 0 0
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /cgox) { } 0 0 0
elsif (/\G (\') ((?:$Elatin10::qq_char)*?) (\') /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin10::qq_char)*?) (\1) /cgox) { } 0 0 0
3776 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx ( )
3777 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx { }
3778 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx [ ]
3779 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx < >
3780 0 elsif (/\G (\') ((?:$qq_char)*?) (\') /oxgc) { return $e . e_q ($ope,$1,$3,$2); } # qx ' '
3781 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx * *
3782 }
3783 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3784 }
3785 }
3786  
3787 # q//
3788 elsif (/\G \b (q) \b /oxgc) {
3789 473 my $ope = $1;
3790  
3791 # if (/\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { return e_q($ope,$1,$3,$2); } # q# #
3792  
3793 # avoid "Error: Runtime exception" of perl version 5.005_03
3794 # (and so on)
3795  
3796 473 ▶ if (/\G (\#) /oxgc) { # q# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) /cgox) { } 0 473 473
3797 0 my $q_string = '';
3798 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3799 0 ▶ if (/\G (\\\\) /oxgc) { $q_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 0 0
elsif (/\G (\\\#) /cgox) { } 0 0 0
elsif (/\G (\#) /cgox) { } 0 0 0
elsif (/\G ($Elatin10::q_char) /cgox) { } 0 0 0
3800 0 elsif (/\G (\\\#) /oxgc) { $q_string .= $1; }
3801 0 elsif (/\G (\#) /oxgc) { return e_q($ope,'#','#',$q_string); }
3802 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3803 }
3804 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3805 }
3806  
3807 else {
3808 473 my $e = '';
3809 473 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 473 0 473
3810 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 473 473
elsif (/\G (\() /cgox) { } 0 473 473
elsif (/\G (\{) /cgox) { } 467 6 473
elsif (/\G (\[) /cgox) { } 0 6 6
elsif (/\G (\<) /cgox) { } 5 1 6
elsif (/\G (\S) /cgox) { } 1 0 1
3811  
3812 # elsif (/\G (\() ((?:\\\)|\\\\|$q_paren)*?) (\)) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q ( )
3813 elsif (/\G (\() /oxgc) { # q ( )
3814 0 my $q_string = '';
3815 0 local $nest = 1;
3816 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3817 0 ▶ if (/\G (\\\\) /oxgc) { $q_string .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 0 0
elsif (/\G (\\\)) /cgox) { } 0 0 0
elsif (/\G (\\\() /cgox) { } 0 0 0
elsif (/\G (\() /cgox) { } 0 0 0
elsif (/\G (\)) /cgox) { } 0 0 0
elsif (/\G ($Elatin10::q_char) /cgox) { } 0 0 0
3818 0 elsif (/\G (\\\)) /oxgc) { $q_string .= $1; }
3819 0 elsif (/\G (\\\() /oxgc) { $q_string .= $1; }
3820 0 elsif (/\G (\() /oxgc) { $q_string .= $1; $nest++; }
3821 elsif (/\G (\)) /oxgc) {
3822 0 ▶ if (--$nest == 0) { return $e . e_q($ope,'(',')',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin10::nest == 0) { } 0 0 0
3823 0 else { $q_string .= $1; }
3824 }
3825 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3826 }
3827 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3828 }
3829  
3830 # elsif (/\G (\{) ((?:\\\}|\\\\|$q_brace)*?) (\}) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q { }
3831 elsif (/\G (\{) /oxgc) { # q { }
3832 467 my $q_string = '';
3833 467 local $nest = 1;
3834 467 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 8262 0 8262
3835 0 ▶ if (/\G (\\\\) /oxgc) { $q_string .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 8262 8262
elsif (/\G (\\\}) /cgox) { } 0 8262 8262
elsif (/\G (\\\{) /cgox) { } 0 8262 8262
elsif (/\G (\{) /cgox) { } 159 8103 8262
elsif (/\G (\}) /cgox) { } 626 7477 8103
elsif (/\G ($Elatin10::q_char) /cgox) { } 7477 0 7477
3836 0 elsif (/\G (\\\}) /oxgc) { $q_string .= $1; }
3837 0 elsif (/\G (\\\{) /oxgc) { $q_string .= $1; }
3838 159 elsif (/\G (\{) /oxgc) { $q_string .= $1; $nest++; }
3839 elsif (/\G (\}) /oxgc) {
3840 626 ▶ if (--$nest == 0) { return $e . e_q($ope,'{','}',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin10::nest == 0) { } 467 159 626
3841 159 else { $q_string .= $1; }
3842 }
3843 7477 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3844 }
3845 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3846 }
3847  
3848 # elsif (/\G (\[) ((?:\\\]|\\\\|$q_bracket)*?) (\]) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q [ ]
3849 elsif (/\G (\[) /oxgc) { # q [ ]
3850 0 my $q_string = '';
3851 0 local $nest = 1;
3852 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3853 0 ▶ if (/\G (\\\\) /oxgc) { $q_string .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 0 0
elsif (/\G (\\\]) /cgox) { } 0 0 0
elsif (/\G (\\\[) /cgox) { } 0 0 0
elsif (/\G (\[) /cgox) { } 0 0 0
elsif (/\G (\]) /cgox) { } 0 0 0
elsif (/\G ($Elatin10::q_char) /cgox) { } 0 0 0
3854 0 elsif (/\G (\\\]) /oxgc) { $q_string .= $1; }
3855 0 elsif (/\G (\\\[) /oxgc) { $q_string .= $1; }
3856 0 elsif (/\G (\[) /oxgc) { $q_string .= $1; $nest++; }
3857 elsif (/\G (\]) /oxgc) {
3858 0 ▶ if (--$nest == 0) { return $e . e_q($ope,'[',']',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin10::nest == 0) { } 0 0 0
3859 0 else { $q_string .= $1; }
3860 }
3861 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3862 }
3863 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3864 }
3865  
3866 # elsif (/\G (\<) ((?:\\\>|\\\\|$q_angle)*?) (\>) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q < >
3867 elsif (/\G (\<) /oxgc) { # q < >
3868 5 my $q_string = '';
3869 5 local $nest = 1;
3870 5 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 88 0 88
3871 0 ▶ if (/\G (\\\\) /oxgc) { $q_string .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 88 88
elsif (/\G (\\\>) /cgox) { } 0 88 88
elsif (/\G (\\\<) /cgox) { } 0 88 88
elsif (/\G (\<) /cgox) { } 0 88 88
elsif (/\G (\>) /cgox) { } 5 83 88
elsif (/\G ($Elatin10::q_char) /cgox) { } 83 0 83
3872 0 elsif (/\G (\\\>) /oxgc) { $q_string .= $1; }
3873 0 elsif (/\G (\\\<) /oxgc) { $q_string .= $1; }
3874 0 elsif (/\G (\<) /oxgc) { $q_string .= $1; $nest++; }
3875 elsif (/\G (\>) /oxgc) {
3876 5 ▶ if (--$nest == 0) { return $e . e_q($ope,'<','>',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin10::nest == 0) { } 5 0 5
3877 0 else { $q_string .= $1; }
3878 }
3879 83 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3880 }
3881 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3882 }
3883  
3884 # elsif (/\G (\S) ((?:\\\1|\\\\|$q_char)*?) (\1) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q * *
3885 elsif (/\G (\S) /oxgc) { # q * *
3886 1 my $delimiter = $1;
3887 1 my $q_string = '';
3888 1 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 14 0 14
3889 0 ▶ if (/\G (\\\\) /oxgc) { $q_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 14 14
elsif (/\G (\\\Q$delimiter\E) /cgox) { } 0 14 14
elsif (/\G (\Q$delimiter\E) /cgox) { } 1 13 14
elsif (/\G ($Elatin10::q_char) /cgox) { } 13 0 13
3890 0 elsif (/\G (\\\Q$delimiter\E) /oxgc) { $q_string .= $1; }
3891 1 elsif (/\G (\Q$delimiter\E) /oxgc) { return $e . e_q($ope,$delimiter,$delimiter,$q_string); }
3892 13 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3893 }
3894 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3895 }
3896 }
3897 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3898 }
3899 }
3900  
3901 # m//
3902 elsif (/\G \b (m) \b /oxgc) {
3903 209 my $ope = $1;
3904 209 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { # m# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin10::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
3905 0 return e_qr($ope,$1,$3,$2,$4);
3906 }
3907 else {
3908 209 my $e = '';
3909 209 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 209 0 209
3910 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 9 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 209 209
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
elsif (/\G (\?) ((?:$Elatin10::qq_char)*?) (\?) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
elsif (/\G (\') ((?:$Elatin10::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 10 199 209
elsif (/\G ([*\-:\\^|]) ((?:$Elatin10::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 199 199
elsif (/\G (\S) ((?:$Elatin10::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 199 0 199
3911 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m ( )
3912 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m { }
3913 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m [ ]
3914 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m < >
3915 0 elsif (/\G (\?) ((?:$qq_char)*?) (\?) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m ? ?
3916 10 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr_q($ope,$1, $3, $2,$4); } # m ' '
3917 0 elsif (/\G ([*\-:\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,'{','}',$2,$4); } # m | | --> m { }
3918 199 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m * *
3919 }
3920 0 die __FILE__, ": Search pattern not terminated\n";
3921 }
3922 }
3923  
3924 # s///
3925  
3926 # about [cegimosxpradlunbB]* (/cg modifier)
3927 #
3928 # P.67 Pattern-Matching Operators
3929 # of ISBN 0-596-00241-6 Perl in a Nutshell, Second Edition.
3930  
3931 elsif (/\G \b (s) \b /oxgc) {
3932 101 my $ope = $1;
3933  
3934 # $1 $2 $3 $4 $5 $6
3935 101 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ((?:$qq_char)*?) (\#) ([cegimosxpradlunbB]*) /oxgc) { # s# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin10::qq_char)*?) (\#) ((?:$Elatin10::qq_char)*?) (\#) ([cegimosxpradlunbB]*) /cgox) { } 1 100 101
3936 1 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3937 }
3938 else {
3939 100 my $e = '';
3940 100 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 100 0 100
3941 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 9 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 100 100
elsif (/\G (\() ((?:$qq_paren)*?) (\)) /cgox) { } 0 100 100
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /cgox) { } 0 100 100
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /cgox) { } 0 100 100
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /cgox) { } 0 100 100
elsif (/\G (\') ((?:$Elatin10::qq_char)*?) (\') ((?:$Elatin10::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 21 79 100
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin10::qq_char)*?) (\1) ((?:$Elatin10::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 79 79
elsif (/\G (\$) ((?:$Elatin10::qq_char)*?) (\1) ((?:$Elatin10::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 79 79
elsif (/\G (\S) ((?:$Elatin10::qq_char)*?) (\1) ((?:$Elatin10::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 79 0 79
3942 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) {
3943 0 my @s = ($1,$2,$3);
3944 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3945 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 10 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\') ((?:$Elatin10::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin10::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Elatin10::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Elatin10::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin10::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3946 # $1 $2 $3 $4
3947 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3948 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3949 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3950 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3951 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3952 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3953 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3954 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3955 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3956 }
3957 0 die __FILE__, ": Substitution replacement not terminated\n";
3958 }
3959 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) {
3960 0 my @s = ($1,$2,$3);
3961 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3962 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 10 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\') ((?:$Elatin10::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin10::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Elatin10::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Elatin10::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin10::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3963 # $1 $2 $3 $4
3964 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3965 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3966 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3967 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3968 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3969 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3970 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3971 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3972 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3973 }
3974 0 die __FILE__, ": Substitution replacement not terminated\n";
3975 }
3976 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) {
3977 0 my @s = ($1,$2,$3);
3978 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3979 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 8 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\') ((?:$Elatin10::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin10::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin10::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3980 # $1 $2 $3 $4
3981 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3982 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3983 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3984 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3985 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3986 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3987 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3988 }
3989 0 die __FILE__, ": Substitution replacement not terminated\n";
3990 }
3991 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) {
3992 0 my @s = ($1,$2,$3);
3993 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3994 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 10 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\') ((?:$Elatin10::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin10::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Elatin10::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Elatin10::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin10::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3995 # $1 $2 $3 $4
3996 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3997 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3998 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3999 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4000 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4001 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4002 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4003 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4004 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4005 }
4006 0 die __FILE__, ": Substitution replacement not terminated\n";
4007 }
4008 # $1 $2 $3 $4 $5 $6
4009 elsif (/\G (\') ((?:$qq_char)*?) (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) {
4010 21 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
4011 }
4012 # $1 $2 $3 $4 $5 $6
4013 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
4014 0 return e_sub($sub_variable,'{',$2,'}','{',$4,'}',$6); # s | | | --> s { } { }
4015 }
4016 # $1 $2 $3 $4 $5 $6
4017 elsif (/\G (\$) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
4018 0 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
4019 }
4020 # $1 $2 $3 $4 $5 $6
4021 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
4022 79 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
4023 }
4024 }
4025 0 die __FILE__, ": Substitution pattern not terminated\n";
4026 }
4027 }
4028  
4029 # require ignore module
4030 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# require$1$2"; }
4031 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# require$1\n$2"; }
4032 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# require$1"; }
4033  
4034 # use strict; --> use strict; no strict qw(refs);
4035 37 elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "use$1 no strict qw(refs);$2"; }
4036 0 elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [^#]) /oxmsgc) { return "use$1 no strict qw(refs);\n$2"; }
4037 0 elsif (/\G \b use ((?>\s+) strict) \b /oxmsgc) { return "use$1; no strict qw(refs)"; }
4038  
4039 # use 5.12.0; --> use 5.12.0; no strict qw(refs);
4040 elsif (/\G \b use (?>\s+) ((?>([1-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /oxmsgc) {
4041 2 ▶ if (($2 >= 6) or (($2 == 5) and ($3 ge '012'))) {
Branch: 1 branch
BranchTrueFalseTotal
if ($2 >= 6 or $2 == 5 and $3 ge '012') { } 0 2 2
Condition33%2/6
$2 >= 6 or $2 == 5 and $3 ge "012"
l!l&&r!l&&!r
002
$2 == 5 and $3 ge "012"
!ll&&!rl&&r
020
MC/DC0%0/3
$2 >= 6 or $2 == 5 and $3 ge "012"
$2 >= 6 $2 == 5 $3 ge "012"
Truth table25%1/4
A or B and C
A= $2 >= 6B= $2 == 5C= $3 ge "012"
ABCresult
1XX1
0111
00X0
0100
4042 0 return "use $1; no strict qw(refs);";
4043 }
4044 else {
4045 2 return "use $1;";
4046 }
4047 }
4048 elsif (/\G \b use (?>\s+) ((?>v([0-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /oxmsgc) {
4049 0 ▶ if (($2 >= 6) or (($2 == 5) and ($3 >= 12))) {
Branch: 1 branch
BranchTrueFalseTotal
if ($2 >= 6 or $2 == 5 and $3 >= 12) { } 0 0 0
Condition0%0/6
$2 >= 6 or $2 == 5 and $3 >= 12
l!l&&r!l&&!r
000
$2 == 5 and $3 >= 12
!ll&&!rl&&r
000
MC/DC0%0/3
$2 >= 6 or $2 == 5 and $3 >= 12
$2 >= 6 $2 == 5 $3 >= 12
Truth table0%0/4
A or B and C
A= $2 >= 6B= $2 == 5C= $3 >= 12
ABCresult
1XX1
0111
00X0
0100
4050 0 return "use $1; no strict qw(refs);";
4051 }
4052 else {
4053 0 return "use $1;";
4054 }
4055 }
4056  
4057 # ignore use module
4058 2 elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# use$1$2"; }
4059 0 elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# use$1\n$2"; }
4060 0 elsif (/\G \b use ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# use$1"; }
4061  
4062 # ignore no module
4063 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# no$1$2"; }
4064 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# no$1\n$2"; }
4065 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# no$1"; }
4066  
4067 # use else
4068 0 elsif (/\G \b use \b /oxmsgc) { return "use"; }
4069  
4070 # use else
4071 2 elsif (/\G \b no \b /oxmsgc) { return "no"; }
4072  
4073 # ''
4074 elsif (/\G (?<![\w\$\@\%\&\*]) (\') /oxgc) {
4075 1142 my $q_string = '';
4076 1142 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 10188 0 10188
4077 10188 ▶ if (/\G (\\\\) /oxgc) { $q_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 4 10184 10188
elsif (/\G (\\\') /cgox) { } 48 10136 10184
elsif (/\G \' /cgox) { } 1142 8994 10136
elsif (/\G ($Elatin10::q_char) /cgox) { } 8994 0 8994
4078 48 elsif (/\G (\\\') /oxgc) { $q_string .= $1; }
4079 1142 elsif (/\G \' /oxgc) { return e_q('', "'","'",$q_string); }
4080 8994 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
4081 }
4082 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4083 }
4084  
4085 # ""
4086 elsif (/\G (\") /oxgc) {
4087 1925 my $qq_string = '';
4088 1925 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 37498 0 37498
4089 37498 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 67 37431 37498
elsif (/\G (\\\") /cgox) { } 12 37419 37431
elsif (/\G \" /cgox) { } 1925 35494 37419
elsif (/\G ($Elatin10::q_char) /cgox) { } 35494 0 35494
4090 12 elsif (/\G (\\\") /oxgc) { $qq_string .= $1; }
4091 1925 elsif (/\G \" /oxgc) { return e_qq('', '"','"',$qq_string); }
4092 35494 elsif (/\G ($q_char) /oxgc) { $qq_string .= $1; }
4093 }
4094 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4095 }
4096  
4097 # ``
4098 elsif (/\G (\`) /oxgc) {
4099 1 my $qx_string = '';
4100 1 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 19 0 19
4101 0 ▶ if (/\G (\\\\) /oxgc) { $qx_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 19 19
elsif (/\G (\\\`) /cgox) { } 0 19 19
elsif (/\G \` /cgox) { } 1 18 19
elsif (/\G ($Elatin10::q_char) /cgox) { } 18 0 18
4102 0 elsif (/\G (\\\`) /oxgc) { $qx_string .= $1; }
4103 1 elsif (/\G \` /oxgc) { return e_qq('', '`','`',$qx_string); }
4104 18 elsif (/\G ($q_char) /oxgc) { $qx_string .= $1; }
4105 }
4106 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4107 }
4108  
4109 # // --- not divide operator (num / num), not defined-or
4110 ▶ elsif (($slash eq 'm//') and /\G (\/) /oxgc) {
Condition100%3/3
$Elatin10::slash eq "m//" and m[\G (/) ]cgox
!ll&&!rl&&r
275518848681
MC/DC100%2/2
$Elatin10::slash eq "m//" and m[\G (/) ]cgox
$Elatin10::slash eq "m//" m[\G (/) ]cgox
Truth table100%3/3
A and B
A= $Elatin10::slash eq "m//"B= m[\G (/) ]cgox
ABresult
0X0
100
111
4111 681 my $regexp = '';
4112 681 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 5636 0 5636
4113 0 ▶ if (/\G (\\\\) /oxgc) { $regexp .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 5636 5636
elsif (m[\G (\\/) ]cgox) { } 0 5636 5636
elsif (m[\G / ([cgimosxpadlunbB]*) ]cgox) { } 681 4955 5636
elsif (/\G ($Elatin10::q_char) /cgox) { } 4955 0 4955
4114 0 elsif (/\G (\\\/) /oxgc) { $regexp .= $1; }
4115 681 elsif (/\G \/ ([cgimosxpadlunbB]*) /oxgc) { return e_qr('', '/','/',$regexp,$1); }
4116 4955 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
4117 }
4118 0 die __FILE__, ": Search pattern not terminated\n";
4119 }
4120  
4121 # ?? --- not conditional operator (condition ? then : else)
4122 ▶ elsif (($slash eq 'm//') and /\G (\?) /oxgc) {
Condition66%2/3
$Elatin10::slash eq "m//" and /\G (\?) /cgox
!ll&&!rl&&r
2755188480
MC/DC0%0/2
$Elatin10::slash eq "m//" and /\G (\?) /cgox
$Elatin10::slash eq "m//" /\G (\?) /cgox
Truth table66%2/3
A and B
A= $Elatin10::slash eq "m//"B= /\G (\?) /cgox
ABresult
0X0
100
111
4123 0 my $regexp = '';
4124 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
4125 0 ▶ if (/\G (\\\\) /oxgc) { $regexp .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 0 0
elsif (/\G (\\\?) /cgox) { } 0 0 0
elsif (/\G \? ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G ($Elatin10::q_char) /cgox) { } 0 0 0
4126 0 elsif (/\G (\\\?) /oxgc) { $regexp .= $1; }
4127 0 elsif (/\G \? ([cgimosxpadlunbB]*) /oxgc) { return e_qr('m','?','?',$regexp,$1); }
4128 0 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
4129 }
4130 0 die __FILE__, ": Search pattern not terminated\n";
4131 }
4132  
4133 # <<>> (a safer ARGV)
4134 0 elsif (/\G ( <<>> ) /oxgc) { $slash = 'm//'; return $1; }
4135  
4136 # << (bit shift) --- not here document
4137 0 elsif (/\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /oxgc) { $slash = 'm//'; return $1; }
4138  
4139 # <<~'HEREDOC'
4140 elsif (/\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /oxgc) {
4141 6 $slash = 'm//';
4142 6 my $here_quote = $1;
4143 6 my $delimiter = $2;
4144  
4145 # get here document
4146 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4147 6 $here_script = CORE::substr $_, pos $_;
4148 6 $here_script =~ s/.*?\n//oxm;
4149 }
4150 6 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 6 0 6
4151 6 my $heredoc = $1;
4152 6 my $indent = $2;
4153 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4154 6 push @heredoc, $heredoc . qq{\n$delimiter\n};
4155 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4156 }
4157 else {
4158 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4159 }
4160 6 return qq{<<'$delimiter'};
4161 }
4162  
4163 # <<~\HEREDOC
4164  
4165 # P.66 2.6.6. "Here" Documents
4166 # in Chapter 2: Bits and Pieces
4167 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4168  
4169 # P.73 "Here" Documents
4170 # in Chapter 2: Bits and Pieces
4171 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4172  
4173 elsif (/\G ( <<~ \\([a-zA-Z_0-9]+) ) /oxgc) {
4174 3 $slash = 'm//';
4175 3 my $here_quote = $1;
4176 3 my $delimiter = $2;
4177  
4178 # get here document
4179 3 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 3 0 3
4180 3 $here_script = CORE::substr $_, pos $_;
4181 3 $here_script =~ s/.*?\n//oxm;
4182 }
4183 3 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 3 0 3
4184 3 my $heredoc = $1;
4185 3 my $indent = $2;
4186 3 $heredoc =~ s{^$indent}{}msg; # no /ox
4187 3 push @heredoc, $heredoc . qq{\n$delimiter\n};
4188 3 push @heredoc_delimiter, qq{\\s*$delimiter};
4189 }
4190 else {
4191 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4192 }
4193 3 return qq{<<\\$delimiter};
4194 }
4195  
4196 # <<~"HEREDOC"
4197 elsif (/\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /oxgc) {
4198 6 $slash = 'm//';
4199 6 my $here_quote = $1;
4200 6 my $delimiter = $2;
4201  
4202 # get here document
4203 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4204 6 $here_script = CORE::substr $_, pos $_;
4205 6 $here_script =~ s/.*?\n//oxm;
4206 }
4207 6 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 6 0 6
4208 6 my $heredoc = $1;
4209 6 my $indent = $2;
4210 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4211 6 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4212 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4213 }
4214 else {
4215 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4216 }
4217 6 return qq{<<"$delimiter"};
4218 }
4219  
4220 # <<~HEREDOC
4221 elsif (/\G ( <<~ ([a-zA-Z_0-9]+) ) /oxgc) {
4222 3 $slash = 'm//';
4223 3 my $here_quote = $1;
4224 3 my $delimiter = $2;
4225  
4226 # get here document
4227 3 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 3 0 3
4228 3 $here_script = CORE::substr $_, pos $_;
4229 3 $here_script =~ s/.*?\n//oxm;
4230 }
4231 3 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 3 0 3
4232 3 my $heredoc = $1;
4233 3 my $indent = $2;
4234 3 $heredoc =~ s{^$indent}{}msg; # no /ox
4235 3 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4236 3 push @heredoc_delimiter, qq{\\s*$delimiter};
4237 }
4238 else {
4239 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4240 }
4241 3 return qq{<<$delimiter};
4242 }
4243  
4244 # <<~`HEREDOC`
4245 elsif (/\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /oxgc) {
4246 6 $slash = 'm//';
4247 6 my $here_quote = $1;
4248 6 my $delimiter = $2;
4249  
4250 # get here document
4251 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4252 6 $here_script = CORE::substr $_, pos $_;
4253 6 $here_script =~ s/.*?\n//oxm;
4254 }
4255 6 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 6 0 6
4256 6 my $heredoc = $1;
4257 6 my $indent = $2;
4258 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4259 6 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4260 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4261 }
4262 else {
4263 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4264 }
4265 6 return qq{<<`$delimiter`};
4266 }
4267  
4268 # <<'HEREDOC'
4269 elsif (/\G ( << '([a-zA-Z_0-9]*)' ) /oxgc) {
4270 72 $slash = 'm//';
4271 72 my $here_quote = $1;
4272 72 my $delimiter = $2;
4273  
4274 # get here document
4275 72 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 72 0 72
4276 72 $here_script = CORE::substr $_, pos $_;
4277 72 $here_script =~ s/.*?\n//oxm;
4278 }
4279 72 ▶ if ($here_script =~ s/\A (.*?) \n $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n $delimiter \n //msx) { } 72 0 72
4280 72 push @heredoc, $1 . qq{\n$delimiter\n};
4281 72 push @heredoc_delimiter, $delimiter;
4282 }
4283 else {
4284 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4285 }
4286 72 return $here_quote;
4287 }
4288  
4289 # <<\HEREDOC
4290  
4291 # P.66 2.6.6. "Here" Documents
4292 # in Chapter 2: Bits and Pieces
4293 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4294  
4295 # P.73 "Here" Documents
4296 # in Chapter 2: Bits and Pieces
4297 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4298  
4299 elsif (/\G ( << \\([a-zA-Z_0-9]+) ) /oxgc) {
4300 0 $slash = 'm//';
4301 0 my $here_quote = $1;
4302 0 my $delimiter = $2;
4303  
4304 # get here document
4305 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4306 0 $here_script = CORE::substr $_, pos $_;
4307 0 $here_script =~ s/.*?\n//oxm;
4308 }
4309 0 ▶ if ($here_script =~ s/\A (.*?) \n $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n $delimiter \n //msx) { } 0 0 0
4310 0 push @heredoc, $1 . qq{\n$delimiter\n};
4311 0 push @heredoc_delimiter, $delimiter;
4312 }
4313 else {
4314 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4315 }
4316 0 return $here_quote;
4317 }
4318  
4319 # <<"HEREDOC"
4320 elsif (/\G ( << "([a-zA-Z_0-9]*)" ) /oxgc) {
4321 36 $slash = 'm//';
4322 36 my $here_quote = $1;
4323 36 my $delimiter = $2;
4324  
4325 # get here document
4326 36 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 36 0 36
4327 36 $here_script = CORE::substr $_, pos $_;
4328 36 $here_script =~ s/.*?\n//oxm;
4329 }
4330 36 ▶ if ($here_script =~ s/\A (.*?) \n $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n $delimiter \n //msx) { } 36 0 36
4331 36 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4332 36 push @heredoc_delimiter, $delimiter;
4333 }
4334 else {
4335 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4336 }
4337 36 return $here_quote;
4338 }
4339  
4340 # <<HEREDOC
4341 elsif (/\G ( << ([a-zA-Z_0-9]+) ) /oxgc) {
4342 42 $slash = 'm//';
4343 42 my $here_quote = $1;
4344 42 my $delimiter = $2;
4345  
4346 # get here document
4347 42 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 42 0 42
4348 42 $here_script = CORE::substr $_, pos $_;
4349 42 $here_script =~ s/.*?\n//oxm;
4350 }
4351 42 ▶ if ($here_script =~ s/\A (.*?) \n $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n $delimiter \n //msx) { } 42 0 42
4352 42 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4353 42 push @heredoc_delimiter, $delimiter;
4354 }
4355 else {
4356 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4357 }
4358 42 return $here_quote;
4359 }
4360  
4361 # <<`HEREDOC`
4362 elsif (/\G ( << `([a-zA-Z_0-9]*)` ) /oxgc) {
4363 0 $slash = 'm//';
4364 0 my $here_quote = $1;
4365 0 my $delimiter = $2;
4366  
4367 # get here document
4368 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4369 0 $here_script = CORE::substr $_, pos $_;
4370 0 $here_script =~ s/.*?\n//oxm;
4371 }
4372 0 ▶ if ($here_script =~ s/\A (.*?) \n $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n $delimiter \n //msx) { } 0 0 0
4373 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4374 0 push @heredoc_delimiter, $delimiter;
4375 }
4376 else {
4377 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4378 }
4379 0 return $here_quote;
4380 }
4381  
4382 # <<= <=> <= < operator
4383 elsif (/\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/oxgc) {
4384 12 return $1;
4385 }
4386  
4387 # <FILEHANDLE>
4388 elsif (/\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /oxgc) {
4389 0 return $1;
4390 }
4391  
4392 # <WILDCARD> --- glob
4393  
4394 # avoid "Error: Runtime exception" of perl version 5.005_03
4395  
4396 elsif (/\G < ((?:[^>\0\a\e\f\n\r\t])+?) > /oxgc) {
4397 0 return 'Elatin10::glob("' . $1 . '")';
4398 }
4399  
4400 # __DATA__
4401 0 elsif (/\G ^ ( __DATA__ \n .*) \z /oxmsgc) { return $1; }
4402  
4403 # __END__
4404 210 elsif (/\G ^ ( __END__ \n .*) \z /oxmsgc) { return $1; }
4405  
4406 # \cD Control-D
4407  
4408 # P.68 2.6.8. Other Literal Tokens
4409 # in Chapter 2: Bits and Pieces
4410 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4411  
4412 # P.76 Other Literal Tokens
4413 # in Chapter 2: Bits and Pieces
4414 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4415  
4416 0 elsif (/\G ( \cD .*) \z /oxmsgc) { return $1; }
4417  
4418 # \cZ Control-Z
4419 0 elsif (/\G ( \cZ .*) \z /oxmsgc) { return $1; }
4420  
4421 # any operator before div
4422 elsif (/\G (
4423 -- | \+\+ |
4424 [\)\}\]]
4425  
4426 5839 ) /oxgc) { $slash = 'div'; return $1; }
4427  
4428 # yada-yada or triple-dot operator
4429 elsif (/\G (
4430 \.\.\.
4431  
4432 7 ) /oxgc) { $slash = 'm//'; return q{die('Unimplemented')}; }
4433  
4434 # any operator before m//
4435  
4436 # //, //= (defined-or)
4437  
4438 # P.164 Logical Operators
4439 # in Chapter 10: More Control Structures
4440 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
4441  
4442 # P.119 C-Style Logical (Short-Circuit) Operators
4443 # in Chapter 3: Unary and Binary Operators
4444 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4445  
4446 # (and so on)
4447  
4448 # ~~
4449  
4450 # P.221 The Smart Match Operator
4451 # in Chapter 15: Smart Matching and given-when
4452 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
4453  
4454 # P.112 Smartmatch Operator
4455 # in Chapter 3: Unary and Binary Operators
4456 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4457  
4458 # (and so on)
4459  
4460 elsif (/\G ((?>
4461  
4462 !~~ | !~ | != | ! |
4463 %= | % |
4464 &&= | && | &= | &\.= | &\. | & |
4465 -= | -> | - |
4466 :(?>\s*)= |
4467 : |
4468 <<>> |
4469 <<= | <=> | <= | < |
4470 == | => | =~ | = |
4471 >>= | >> | >= | > |
4472 \*\*= | \*\* | \*= | \* |
4473 \+= | \+ |
4474 \.\. | \.= | \. |
4475 \/\/= | \/\/ |
4476 \/= | \/ |
4477 \? |
4478 \\ |
4479 \^= | \^\.= | \^\. | \^ |
4480 \b x= |
4481 \|\|= | \|\| | \|= | \|\.= | \|\. | \| |
4482 ~~ | ~\. | ~ |
4483 \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b |
4484 \b(?: print )\b |
4485  
4486 [,;\(\{\[]
4487  
4488 9799 )) /oxgc) { $slash = 'm//'; return $1; }
4489  
4490 # other any character
4491 20358 elsif (/\G ($q_char) /oxgc) { $slash = 'div'; return $1; }
4492  
4493 # system error
4494 else {
4495 0 die __FILE__, ": Oops, this shouldn't happen!\n";
4496 }
4497 }
4498  
4499 # escape Latin-10 string
4500 1873 ▶sub e_string {
Subroutine e_string: called CC=54 SCAR=72.5
Pod documented
4501 1873 my($string) = @_;
4502 1873 my $e_string = '';
4503  
4504 1873 local $slash = 'm//';
4505  
4506 # P.1024 Appendix W.10 Multibyte Processing
4507 # of ISBN 1-56592-224-7 CJKV Information Processing
4508 # (and so on)
4509  
4510 1873 my @char = $string =~ / \G (?>[^\\]|\\$q_char|$q_char) /oxmsg;
4511  
4512 # without { ... }
4513 1873 ▶ if (not (grep(/\A \{ \z/xms, @char) and grep(/\A \} \z/xms, @char))) {
Branch: 1 branch
BranchTrueFalseTotal
unless (grep /\A \{ \z/msx, @char and grep /\A \} \z/msx, @char) 1854 19 1873
Condition66%2/3
grep /\A \{ \z/msx, @char and grep /\A \} \z/msx, @char
!ll&&!rl&&r
1854019
MC/DC50%1/2
grep /\A \{ \z/msx, @char and grep /\A \} \z/msx, @char
grep /\A \{ \z/msx, @char grep /\A \} \z/msx, @char
Truth table66%2/3
A and B
A= grep /\A \{ \z/msx, @charB= grep /\A \} \z/msx, @char
ABresult
0X0
100
111
4514 1854 ▶ if ($string !~ /<</oxms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /<</mosx) 1854 0 1854
4515 1854 return $string;
4516 }
4517 }
4518  
4519 E_STRING_LOOP:
4520 19 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 223 19 242
4521 223 ▶ if (0) {
Branch: 24 branches
BranchTrueFalseTotal
if (do { $string =~ /\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /cgmosx }) { } 0 223 223
elsif ($string =~ /\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G ( \$' | \$\{'\} ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G ( \$ 0 ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G ( \$ \$ ) (?![\w\{]) /cgmosx) { } 0 223 223
elsif ($string =~ /\G \$ ((?>[1-9][0-9]*)) /cgmosx) { } 0 223 223
elsif ($string =~ /\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /cgmosx) { } 0 223 223
elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /cgmosx) { } 0 223 223
elsif ($string =~ /\G \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} /cgmosx) { } 0 223 223
elsif ($string =~ /\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /cgmosx) { } 3 220 223
elsif ($string =~ /\G ( (?: [\$\@\%\&\*] | \$\# | -> | \b sub \b) (?>\s*) (?: split | chop | index | rindex | lc | uc | fc | chr | ord | reverse | getc | tr | y | q | qq | qx | qw | m | s | qr | glob | lstat | opendir | stat | unlink | chdir ) ) \b /cgmosx) { } 7 213 220
elsif ($string =~ m{\G ( \$[\$\@\#\\\'\"/\?\(\)\[\]\<\>] ) }cgmosx) { } 0 213 213
elsif ($string =~ /\G \b (qq) \b /cgox) { } 0 213 213
elsif ($string =~ /\G \b (qx) \b /cgox) { } 0 213 213
elsif ($string =~ /\G \b (q) \b /cgox) { } 0 213 213
elsif ($string =~ /\G (?<![\w\$\@\%\&\*]) (\') ((?:\\\'|\\\\|$Elatin10::q_char)*?) (\') /cgox) { } 0 213 213
elsif ($string =~ /\G (\") ((?:$Elatin10::qq_char)*?) (\") /cgox) { } 0 213 213
elsif ($string =~ /\G (\`) ((?:$Elatin10::qq_char)*?) (\`) /cgox) { } 0 213 213
elsif ($string =~ /\G ($Elatin10::q_char) /cgox) { } 213 0 213
4522 }
4523  
4524 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> @{[Elatin10::PREMATCH()]}
4525 elsif ($string =~ /\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /oxmsgc) {
4526 0 $e_string .= q{Elatin10::PREMATCH()};
4527 0 $slash = 'div';
4528 }
4529  
4530 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> @{[Elatin10::MATCH()]}
4531 elsif ($string =~ /\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /oxmsgc) {
4532 0 $e_string .= q{Elatin10::MATCH()};
4533 0 $slash = 'div';
4534 }
4535  
4536 # $', ${'} --> $', ${'}
4537 elsif ($string =~ /\G ( \$' | \$\{'\} ) /oxmsgc) {
4538 0 $e_string .= $1;
4539 0 $slash = 'div';
4540 }
4541  
4542 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> @{[Elatin10::POSTMATCH()]}
4543 elsif ($string =~ /\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /oxmsgc) {
4544 0 $e_string .= q{Elatin10::POSTMATCH()};
4545 0 $slash = 'div';
4546 }
4547  
4548 # bareword
4549 elsif ($string =~ /\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /oxmsgc) {
4550 0 $e_string .= $1;
4551 0 $slash = 'div';
4552 }
4553  
4554 # $0 --> $0
4555 elsif ($string =~ /\G ( \$ 0 ) /oxmsgc) {
4556 0 $e_string .= $1;
4557 0 $slash = 'div';
4558 }
4559 elsif ($string =~ /\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /oxmsgc) {
4560 0 $e_string .= $1;
4561 0 $slash = 'div';
4562 }
4563  
4564 # $$ --> $$
4565 elsif ($string =~ /\G ( \$ \$ ) (?![\w\{]) /oxmsgc) {
4566 0 $e_string .= $1;
4567 0 $slash = 'div';
4568 }
4569  
4570 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
4571 # $1, $2, $3 --> $1, $2, $3 otherwise
4572 elsif ($string =~ /\G \$ ((?>[1-9][0-9]*)) /oxmsgc) {
4573 0 $e_string .= e_capture($1);
4574 0 $slash = 'div';
4575 }
4576 elsif ($string =~ /\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /oxmsgc) {
4577 0 $e_string .= e_capture($1);
4578 0 $slash = 'div';
4579 }
4580  
4581 # $$foo[ ... ] --> $ $foo->[ ... ]
4582 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /oxmsgc) {
4583 0 $e_string .= e_capture($1.'->'.$2);
4584 0 $slash = 'div';
4585 }
4586  
4587 # $$foo{ ... } --> $ $foo->{ ... }
4588 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /oxmsgc) {
4589 0 $e_string .= e_capture($1.'->'.$2);
4590 0 $slash = 'div';
4591 }
4592  
4593 # $$foo
4594 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /oxmsgc) {
4595 0 $e_string .= e_capture($1);
4596 0 $slash = 'div';
4597 }
4598  
4599 # ${ foo }
4600 elsif ($string =~ /\G \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} /oxmsgc) {
4601 0 $e_string .= '${' . $1 . '}';
4602 0 $slash = 'div';
4603 }
4604  
4605 # ${ ... }
4606 elsif ($string =~ /\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /oxmsgc) {
4607 3 $e_string .= e_capture($1);
4608 3 $slash = 'div';
4609 }
4610  
4611 # variable or function
4612 # $ @ % & * $ #
4613 elsif ($string =~ /\G ( (?: [\$\@\%\&\*] | \$\# | -> | \b sub \b) (?>\s*) (?: split | chop | index | rindex | lc | uc | fc | chr | ord | reverse | getc | tr | y | q | qq | qx | qw | m | s | qr | glob | lstat | opendir | stat | unlink | chdir ) ) \b /oxmsgc) {
4614 7 $e_string .= $1;
4615 7 $slash = 'div';
4616 }
4617 # $ $ $ $ $ $ $ $ $ $ $ $ $ $
4618 # $ @ # \ ' " / ? ( ) [ ] < >
4619 elsif ($string =~ /\G ( \$[\$\@\#\\\'\"\/\?\(\)\[\]\<\>] ) /oxmsgc) {
4620 0 $e_string .= $1;
4621 0 $slash = 'div';
4622 }
4623  
4624 # qq//
4625 elsif ($string =~ /\G \b (qq) \b /oxgc) {
4626 0 my $ope = $1;
4627 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qq# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Elatin10::qq_char)*?) (\#) /cgox) { } 0 0 0
4628 0 $e_string .= e_qq($ope,$1,$3,$2);
4629 }
4630 else {
4631 0 my $e = '';
4632 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4633 0 ▶ if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if ($string =~ /\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /cgox) { } 0 0 0
elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /cgox) { } 0 0 0
elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /cgox) { } 0 0 0
elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Elatin10::qq_char)*?) (\1) /cgox) { } 0 0 0
4634 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq ( )
4635 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq { }
4636 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq [ ]
4637 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq < >
4638 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq * *
4639 }
4640 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4641 }
4642 }
4643  
4644 # qx//
4645 elsif ($string =~ /\G \b (qx) \b /oxgc) {
4646 0 my $ope = $1;
4647 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qx# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Elatin10::qq_char)*?) (\#) /cgox) { } 0 0 0
4648 0 $e_string .= e_qq($ope,$1,$3,$2);
4649 }
4650 else {
4651 0 my $e = '';
4652 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4653 0 ▶ if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 7 branches
BranchTrueFalseTotal
if ($string =~ /\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /cgox) { } 0 0 0
elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /cgox) { } 0 0 0
elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /cgox) { } 0 0 0
elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /cgox) { } 0 0 0
elsif ($string =~ /\G (\') ((?:$Elatin10::qq_char)*?) (\') /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Elatin10::qq_char)*?) (\1) /cgox) { } 0 0 0
4654 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx ( )
4655 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx { }
4656 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx [ ]
4657 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx < >
4658 0 elsif ($string =~ /\G (\') ((?:$qq_char)*?) (\') /oxgc) { $e_string .= $e . e_q ($ope,$1,$3,$2); next E_STRING_LOOP; } # qx ' '
4659 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx * *
4660 }
4661 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4662 }
4663 }
4664  
4665 # q//
4666 elsif ($string =~ /\G \b (q) \b /oxgc) {
4667 0 my $ope = $1;
4668 0 ▶ if ($string =~ /\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { # q# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:\\\#|\\\\|$Elatin10::q_char)*?) (\#) /cgox) { } 0 0 0
4669 0 $e_string .= e_q($ope,$1,$3,$2);
4670 }
4671 else {
4672 0 my $e = '';
4673 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4674 0 ▶ if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if ($string =~ /\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /cgox) { } 0 0 0
elsif ($string =~ /\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /cgox) { } 0 0 0
elsif ($string =~ /\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /cgox) { } 0 0 0
elsif ($string =~ /\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:\\\\|\\\1| $Elatin10::q_char)*?) (\1) /cgox) { } 0 0 0
4675 0 elsif ($string =~ /\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q ( )
4676 0 elsif ($string =~ /\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q { }
4677 0 elsif ($string =~ /\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q [ ]
4678 0 elsif ($string =~ /\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q < >
4679 0 elsif ($string =~ /\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q * *
4680 }
4681 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4682 }
4683 }
4684  
4685 # ''
4686 0 elsif ($string =~ /\G (?<![\w\$\@\%\&\*]) (\') ((?:\\\'|\\\\|$q_char)*?) (\') /oxgc) { $e_string .= e_q('',$1,$3,$2); }
4687  
4688 # ""
4689 0 elsif ($string =~ /\G (\") ((?:$qq_char)*?) (\") /oxgc) { $e_string .= e_qq('',$1,$3,$2); }
4690  
4691 # ``
4692 0 elsif ($string =~ /\G (\`) ((?:$qq_char)*?) (\`) /oxgc) { $e_string .= e_qq('',$1,$3,$2); }
4693  
4694 # other any character
4695 213 elsif ($string =~ /\G ($q_char) /oxgc) { $e_string .= $1; }
4696  
4697 # system error
4698 else {
4699 0 die __FILE__, ": Oops, this shouldn't happen!\n";
4700 }
4701 }
4702  
4703 19 return $e_string;
4704 }
4705  
4706 #
4707 # character class
4708 #
4709 1920 ▶sub character_class {
Subroutine character_class: called CC=3 SCAR=11.0
Pod undocumented
4710 1920 my($char,$modifier) = @_;
4711  
4712 1920 ▶ if ($char eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char eq '.') { } 52 1868 1920
4713 52 ▶ if ($modifier =~ /s/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/) { } 17 35 52
4714 17 return '${Elatin10::dot_s}';
4715 }
4716 else {
4717 35 return '${Elatin10::dot}';
4718 }
4719 }
4720 else {
4721 1868 return Elatin10::classic_character_class($char);
4722 }
4723 }
4724  
4725 #
4726 # escape capture ($1, $2, $3, ...)
4727 #
4728 212 ▶sub e_capture {
Subroutine e_capture: called CC=1 SCAR=0.0
Pod undocumented
4729  
4730 212 return join '', '${', $_[0], '}';
4731 }
4732  
4733 #
4734 # escape transliteration (tr/// or y///)
4735 #
4736 4 ▶sub e_tr {
Subroutine e_tr: called CC=5 SCAR=16.8
Pod undocumented
4737 4 my($variable,$charclass,$e,$charclass2,$modifier) = @_;
4738 4 my $e_tr = '';
4739 4 ▶ $modifier ||= '';
Condition100%2/2
$modifier ||= ""
l!l
31
MC/DC100%1/1
$modifier ||= ""
$modifier
Truth table100%2/2
A
A= $modifier
Aresult
11
00
4740  
4741 4 $slash = 'div';
4742  
4743 # quote character class 1
4744 4 $charclass = q_tr($charclass);
4745  
4746 # quote character class 2
4747 4 $charclass2 = q_tr($charclass2);
4748  
4749 # /b /B modifier
4750 4 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) { } 0 4 4
4751 0 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq '') { } 0 0 0
4752 0 $e_tr = qq{tr$charclass$e$charclass2$modifier};
4753 }
4754 else {
4755 0 $e_tr = qq{$variable${bind_operator}tr$charclass$e$charclass2$modifier};
4756 }
4757 }
4758 else {
4759 4 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq '') { } 2 2 4
4760 2 $e_tr = qq{Elatin10::tr(\$_,' =~ ',$charclass,$e$charclass2,'$modifier')};
4761 }
4762 else {
4763 2 $e_tr = qq{Elatin10::tr($variable,'$bind_operator',$charclass,$e$charclass2,'$modifier')};
4764 }
4765 }
4766  
4767 # clear tr/// variable
4768 4 $tr_variable = '';
4769 4 $bind_operator = '';
4770  
4771 4 return $e_tr;
4772 }
4773  
4774 #
4775 # quote for escape transliteration (tr/// or y///)
4776 #
4777 8 ▶sub q_tr {
Subroutine q_tr: called CC=9 SCAR=40.6
Pod undocumented
4778 8 my($charclass) = @_;
4779  
4780 # quote character class
4781 8 ▶ if ($charclass !~ /'/oxms) {
Branch: 6 branches
BranchTrueFalseTotal
if (not $charclass =~ /'/mosx) { } 8 0 8
elsif (not $charclass =~ m[/]mosx) { } 0 0 0
elsif (not $charclass =~ /\#/mosx) { } 0 0 0
elsif (not $charclass =~ /[\<\>]/mosx) { } 0 0 0
elsif (not $charclass =~ /[\(\)]/mosx) { } 0 0 0
elsif (not $charclass =~ /[\{\}]/mosx) { } 0 0 0
4782 8 return e_q('', "'", "'", $charclass); # --> q' '
4783 }
4784 elsif ($charclass !~ /\//oxms) {
4785 0 return e_q('q', '/', '/', $charclass); # --> q/ /
4786 }
4787 elsif ($charclass !~ /\#/oxms) {
4788 0 return e_q('q', '#', '#', $charclass); # --> q# #
4789 }
4790 elsif ($charclass !~ /[\<\>]/oxms) {
4791 0 return e_q('q', '<', '>', $charclass); # --> q< >
4792 }
4793 elsif ($charclass !~ /[\(\)]/oxms) {
4794 0 return e_q('q', '(', ')', $charclass); # --> q( )
4795 }
4796 elsif ($charclass !~ /[\{\}]/oxms) {
4797 0 return e_q('q', '{', '}', $charclass); # --> q{ }
4798 }
4799 else {
4800 0 for my $char (qw( ! " $ % & * + . : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
4801 0 ▶ if ($charclass !~ /\Q$char\E/xms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($charclass =~ /\Q$char\E/msx) 0 0 0
4802 0 return e_q('q', $char, $char, $charclass);
4803 }
4804 }
4805 }
4806  
4807 0 return e_q('q', '{', '}', $charclass);
4808 }
4809  
4810 #
4811 # escape q string (q//, '')
4812 #
4813 1623 ▶sub e_q {
Subroutine e_q: called CC=1 SCAR=0.0
Pod undocumented
4814 1623 my($ope,$delimiter,$end_delimiter,$string) = @_;
4815  
4816 1623 $slash = 'div';
4817  
4818 1623 return join '', $ope, $delimiter, $string, $end_delimiter;
4819 }
4820  
4821 #
4822 # escape qq string (qq//, "", qx//, ``)
4823 #
4824 4263 ▶sub e_qq {
Subroutine e_qq: called CC=37 SCAR=50.9
Pod undocumented
4825 4263 my($ope,$delimiter,$end_delimiter,$string) = @_;
4826  
4827 4263 $slash = 'div';
4828  
4829 4263 my $left_e = 0;
4830 4263 my $right_e = 0;
4831  
4832 # split regexp
4833 4263 my @char = $string =~ /\G((?>
4834 [^\\\$] |
4835 \\x\{ (?>[0-9A-Fa-f]+) \} |
4836 \\o\{ (?>[0-7]+) \} |
4837 \\N\{ (?>[^0-9\}][^\}]*) \} |
4838 \\ $q_char |
4839 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
4840 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
4841 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
4842 \$ (?>\s* [0-9]+) |
4843 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
4844 \$ \$ (?![\w\{]) |
4845 \$ (?>\s*) \$ (?>\s*) $qq_variable |
4846 $q_char
4847 ))/oxmsg;
4848  
4849 4263 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 117010 4263 121273
4850  
4851 # "\L\u" --> "\u\L"
4852 117010 ▶ if (($char[$i] eq '\L') and ($char[$i+1] eq '\u')) {
Branch: 5 branches
BranchTrueFalseTotal
if ($char[$i] eq '\\L' and $char[$i + 1] eq '\\u') { } 0 117010 117010
elsif ($char[$i] eq '\\U' and $char[$i + 1] eq '\\l') { } 0 117010 117010
elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/mosx) { } 1 117009 117010
elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/mosx) { } 1 117008 117009
elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/mosx) { } 0 117008 117008
Condition33%1/3
$char[$i] eq "\\L" and $char[$i + 1] eq "\\u"
!ll&&!rl&&r
11701000
MC/DC0%0/2
$char[$i] eq "\\L" and $char[$i + 1] eq "\\u"
$char[$i] eq "\\L" $char[$i + 1] eq "\\u"
Truth table33%1/3
A and B
A= $char[$i] eq "\\L"B= $char[$i + 1] eq "\\u"
ABresult
0X0
100
111
4853 0 @char[$i,$i+1] = @char[$i+1,$i];
4854 }
4855  
4856 # "\U\l" --> "\l\U"
4857 ▶ elsif (($char[$i] eq '\U') and ($char[$i+1] eq '\l')) {
Condition33%1/3
$char[$i] eq "\\U" and $char[$i + 1] eq "\\l"
!ll&&!rl&&r
11701000
MC/DC0%0/2
$char[$i] eq "\\U" and $char[$i + 1] eq "\\l"
$char[$i] eq "\\U" $char[$i + 1] eq "\\l"
Truth table33%1/3
A and B
A= $char[$i] eq "\\U"B= $char[$i + 1] eq "\\l"
ABresult
0X0
100
111
4858 0 @char[$i,$i+1] = @char[$i+1,$i];
4859 }
4860  
4861 # octal escape sequence
4862 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
4863 1 $char[$i] = Elatin10::octchr($1);
4864 }
4865  
4866 # hexadecimal escape sequence
4867 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
4868 1 $char[$i] = Elatin10::hexchr($1);
4869 }
4870  
4871 # \N{CHARNAME} --> N{CHARNAME}
4872 elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
4873 0 $char[$i] = $1;
4874 }
4875  
4876 117010 ▶ if (0) {
Branch: 23 branches
BranchTrueFalseTotal
if (do { $char[$i] =~ /\A ([<>]) \z/mosx }) { } 484 116526 117010
elsif ($char[$i] eq '\\u') { } 0 116526 116526
elsif ($char[$i] eq '\\l') { } 0 116526 116526
elsif ($char[$i] eq '\\U') { } 0 116526 116526
elsif ($char[$i] eq '\\L') { } 0 116526 116526
elsif ($char[$i] eq '\\F') { } 24 116502 116526
elsif ($char[$i] eq '\\Q') { } 0 116502 116502
elsif ($char[$i] eq '\\E') { } 24 116478 116502
elsif ($char[$i] eq '\\Q') { } 0 116478 116478
elsif ($char[$i] eq '\\E') { } 0 116478 116478
elsif ($char[$i] =~ /\A \$ 0 \z/mosx) { } 4 116474 116478
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/mosx) { } 0 116474 116474
elsif ($char[$i] =~ /\A \$\$ \z/mosx) { } 0 116474 116474
elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/mosx) { } 205 116269 116474
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/mosx) { } 0 116269 116269
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/mosx) { } 0 116269 116269
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/mosx) { } 0 116269 116269
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/mosx) { } 0 116269 116269
elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/cgmosx) { } 44 116225 116269
elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/cgmosx) { } 45 116180 116225
elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/cgmosx) { } 33 116147 116180
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/mosx) { } 0 116147 116147
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/mosx) { } 0 116147 116147
4877 }
4878  
4879 # \F
4880 #
4881 # P.69 Table 2-6. Translation escapes
4882 # in Chapter 2: Bits and Pieces
4883 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4884 # (and so on)
4885  
4886 # \u \l \U \L \F \Q \E
4887 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
4888 484 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 484 484
4889 0 $char[$i] = '\\' . $char[$i];
4890 }
4891 }
4892 elsif ($char[$i] eq '\u') {
4893  
4894 # "STRING @{[ LIST EXPR ]} MORE STRING"
4895  
4896 # P.257 Other Tricks You Can Do with Hard References
4897 # in Chapter 8: References
4898 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4899  
4900 # P.353 Other Tricks You Can Do with Hard References
4901 # in Chapter 8: References
4902 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4903  
4904 # (and so on)
4905  
4906 0 $char[$i] = '@{[Elatin10::ucfirst qq<';
4907 0 $left_e++;
4908 }
4909 elsif ($char[$i] eq '\l') {
4910 0 $char[$i] = '@{[Elatin10::lcfirst qq<';
4911 0 $left_e++;
4912 }
4913 elsif ($char[$i] eq '\U') {
4914 0 $char[$i] = '@{[Elatin10::uc qq<';
4915 0 $left_e++;
4916 }
4917 elsif ($char[$i] eq '\L') {
4918 0 $char[$i] = '@{[Elatin10::lc qq<';
4919 0 $left_e++;
4920 }
4921 elsif ($char[$i] eq '\F') {
4922 24 $char[$i] = '@{[Elatin10::fc qq<';
4923 24 $left_e++;
4924 }
4925 elsif ($char[$i] eq '\Q') {
4926 0 $char[$i] = '@{[CORE::quotemeta qq<';
4927 0 $left_e++;
4928 }
4929 elsif ($char[$i] eq '\E') {
4930 24 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 24 0 24
4931 24 $char[$i] = '>]}';
4932 24 $right_e++;
4933 }
4934 else {
4935 0 $char[$i] = '';
4936 }
4937 }
4938 elsif ($char[$i] eq '\Q') {
4939 0 while (1) {
4940 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
4941 0 last;
4942 }
4943 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
4944 0 last;
4945 }
4946 }
4947 }
4948 elsif ($char[$i] eq '\E') {
4949 }
4950  
4951 # $0 --> $0
4952 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
4953 }
4954 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
4955 }
4956  
4957 # $$ --> $$
4958 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
4959 }
4960  
4961 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
4962 # $1, $2, $3 --> $1, $2, $3 otherwise
4963 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
4964 205 $char[$i] = e_capture($1);
4965 }
4966 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
4967 0 $char[$i] = e_capture($1);
4968 }
4969  
4970 # $$foo[ ... ] --> $ $foo->[ ... ]
4971 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
4972 0 $char[$i] = e_capture($1.'->'.$2);
4973 }
4974  
4975 # $$foo{ ... } --> $ $foo->{ ... }
4976 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
4977 0 $char[$i] = e_capture($1.'->'.$2);
4978 }
4979  
4980 # $$foo
4981 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
4982 0 $char[$i] = e_capture($1);
4983 }
4984  
4985 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin10::PREMATCH()
4986 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
4987 44 $char[$i] = '@{[Elatin10::PREMATCH()]}';
4988 }
4989  
4990 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin10::MATCH()
4991 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
4992 45 $char[$i] = '@{[Elatin10::MATCH()]}';
4993 }
4994  
4995 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin10::POSTMATCH()
4996 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
4997 33 $char[$i] = '@{[Elatin10::POSTMATCH()]}';
4998 }
4999  
5000 # ${ foo } --> ${ foo }
5001 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/oxms) {
5002 }
5003  
5004 # ${ ... }
5005 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5006 0 $char[$i] = e_capture($1);
5007 }
5008 }
5009  
5010 # return string
5011 4263 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 4263 4263
5012 0 return join '', $ope, $delimiter, @char, '>]}' x ($left_e - $right_e), $end_delimiter;
5013 }
5014 4263 return join '', $ope, $delimiter, @char, $end_delimiter;
5015 }
5016  
5017 #
5018 # escape qw string (qw//)
5019 #
5020 16 ▶sub e_qw {
Subroutine e_qw: called CC=11 SCAR=43.1
Pod undocumented
5021 16 my($ope,$delimiter,$end_delimiter,$string) = @_;
5022  
5023 16 $slash = 'div';
5024  
5025 # choice again delimiter
5026 16 my %octet = map {$_ => 1} ($string =~ /\G ([\x00-\xFF]) /oxmsg);
5027 16 ▶ if (not $octet{$end_delimiter}) {
Branch: 5 branches
BranchTrueFalseTotal
if (not $octet{$end_delimiter}) { } 16 0 16
elsif (not $octet{')'}) { } 0 0 0
elsif (not $octet{'}'}) { } 0 0 0
elsif (not $octet{']'}) { } 0 0 0
elsif (not $octet{'>'}) { } 0 0 0
5028 16 return join '', $ope, $delimiter, $string, $end_delimiter;
5029 }
5030 elsif (not $octet{')'}) {
5031 0 return join '', $ope, '(', $string, ')';
5032 }
5033 elsif (not $octet{'}'}) {
5034 0 return join '', $ope, '{', $string, '}';
5035 }
5036 elsif (not $octet{']'}) {
5037 0 return join '', $ope, '[', $string, ']';
5038 }
5039 elsif (not $octet{'>'}) {
5040 0 return join '', $ope, '<', $string, '>';
5041 }
5042 else {
5043 0 for my $char (qw( ! " $ % & * + - . / : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5044 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5045 0 return join '', $ope, $char, $string, $char;
5046 }
5047 }
5048 }
5049  
5050 # qw/AAA BBB C'CC/ --> ('AAA', 'BBB', 'C\'CC')
5051 0 my @string = CORE::split(/\s+/, $string);
5052 0 for my $string (@string) {
5053 0 my @octet = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5054 0 for my $octet (@octet) {
5055 0 ▶ if ($octet =~ /\A (['\\]) \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($octet =~ /\A (['\\]) \z/mosx) 0 0 0
5056 0 $octet = '\\' . $1;
5057 }
5058 }
5059 0 $string = join '', @octet;
5060 }
5061 0 return join '', '(', (join ', ', map { "'$_'" } @string), ')';
5062 }
5063  
5064 #
5065 # escape here document (<<"HEREDOC", <<HEREDOC, <<`HEREDOC`, <<~"HEREDOC", <<~HEREDOC, <<~`HEREDOC`)
5066 #
5067 93 ▶sub e_heredoc {
Subroutine e_heredoc: called CC=37 SCAR=56.3
Pod undocumented
5068 93 my($string) = @_;
5069  
5070 93 $slash = 'm//';
5071  
5072 93 my $metachar = qr/[\@\\|]/oxms; # '|' is for <<`HEREDOC`
5073  
5074 93 my $left_e = 0;
5075 93 my $right_e = 0;
5076  
5077 # split regexp
5078 93 my @char = $string =~ /\G((?>
5079 [^\\\$] |
5080 \\x\{ (?>[0-9A-Fa-f]+) \} |
5081 \\o\{ (?>[0-7]+) \} |
5082 \\N\{ (?>[^0-9\}][^\}]*) \} |
5083 \\ $q_char |
5084 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5085 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5086 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5087 \$ (?>\s* [0-9]+) |
5088 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5089 \$ \$ (?![\w\{]) |
5090 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5091 $q_char
5092 ))/oxmsg;
5093  
5094 93 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 3203 93 3296
5095  
5096 # "\L\u" --> "\u\L"
5097 3203 ▶ if (($char[$i] eq '\L') and ($char[$i+1] eq '\u')) {
Branch: 5 branches
BranchTrueFalseTotal
if ($char[$i] eq '\\L' and $char[$i + 1] eq '\\u') { } 0 3203 3203
elsif ($char[$i] eq '\\U' and $char[$i + 1] eq '\\l') { } 0 3203 3203
elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/mosx) { } 1 3202 3203
elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/mosx) { } 1 3201 3202
elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/mosx) { } 0 3201 3201
Condition33%1/3
$char[$i] eq "\\L" and $char[$i + 1] eq "\\u"
!ll&&!rl&&r
320300
MC/DC0%0/2
$char[$i] eq "\\L" and $char[$i + 1] eq "\\u"
$char[$i] eq "\\L" $char[$i + 1] eq "\\u"
Truth table33%1/3
A and B
A= $char[$i] eq "\\L"B= $char[$i + 1] eq "\\u"
ABresult
0X0
100
111
5098 0 @char[$i,$i+1] = @char[$i+1,$i];
5099 }
5100  
5101 # "\U\l" --> "\l\U"
5102 ▶ elsif (($char[$i] eq '\U') and ($char[$i+1] eq '\l')) {
Condition33%1/3
$char[$i] eq "\\U" and $char[$i + 1] eq "\\l"
!ll&&!rl&&r
320300
MC/DC0%0/2
$char[$i] eq "\\U" and $char[$i + 1] eq "\\l"
$char[$i] eq "\\U" $char[$i + 1] eq "\\l"
Truth table33%1/3
A and B
A= $char[$i] eq "\\U"B= $char[$i + 1] eq "\\l"
ABresult
0X0
100
111
5103 0 @char[$i,$i+1] = @char[$i+1,$i];
5104 }
5105  
5106 # octal escape sequence
5107 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5108 1 $char[$i] = Elatin10::octchr($1);
5109 }
5110  
5111 # hexadecimal escape sequence
5112 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5113 1 $char[$i] = Elatin10::hexchr($1);
5114 }
5115  
5116 # \N{CHARNAME} --> N{CHARNAME}
5117 elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5118 0 $char[$i] = $1;
5119 }
5120  
5121 3203 ▶ if (0) {
Branch: 23 branches
BranchTrueFalseTotal
if (do { $char[$i] =~ /\A ([<>]) \z/mosx }) { } 0 3203 3203
elsif ($char[$i] eq '\\u') { } 0 3203 3203
elsif ($char[$i] eq '\\l') { } 0 3203 3203
elsif ($char[$i] eq '\\U') { } 0 3203 3203
elsif ($char[$i] eq '\\L') { } 0 3203 3203
elsif ($char[$i] eq '\\F') { } 0 3203 3203
elsif ($char[$i] eq '\\Q') { } 0 3203 3203
elsif ($char[$i] eq '\\E') { } 0 3203 3203
elsif ($char[$i] eq '\\Q') { } 0 3203 3203
elsif ($char[$i] eq '\\E') { } 0 3203 3203
elsif ($char[$i] =~ /\A \$ 0 \z/mosx) { } 0 3203 3203
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/mosx) { } 0 3203 3203
elsif ($char[$i] =~ /\A \$\$ \z/mosx) { } 0 3203 3203
elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/mosx) { } 0 3203 3203
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/mosx) { } 0 3203 3203
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/mosx) { } 0 3203 3203
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/mosx) { } 0 3203 3203
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/mosx) { } 0 3203 3203
elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/cgmosx) { } 8 3195 3203
elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/cgmosx) { } 8 3187 3195
elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/cgmosx) { } 6 3181 3187
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/mosx) { } 0 3181 3181
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/mosx) { } 0 3181 3181
5122 }
5123  
5124 # \u \l \U \L \F \Q \E
5125 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
5126 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
5127 0 $char[$i] = '\\' . $char[$i];
5128 }
5129 }
5130 elsif ($char[$i] eq '\u') {
5131 0 $char[$i] = '@{[Elatin10::ucfirst qq<';
5132 0 $left_e++;
5133 }
5134 elsif ($char[$i] eq '\l') {
5135 0 $char[$i] = '@{[Elatin10::lcfirst qq<';
5136 0 $left_e++;
5137 }
5138 elsif ($char[$i] eq '\U') {
5139 0 $char[$i] = '@{[Elatin10::uc qq<';
5140 0 $left_e++;
5141 }
5142 elsif ($char[$i] eq '\L') {
5143 0 $char[$i] = '@{[Elatin10::lc qq<';
5144 0 $left_e++;
5145 }
5146 elsif ($char[$i] eq '\F') {
5147 0 $char[$i] = '@{[Elatin10::fc qq<';
5148 0 $left_e++;
5149 }
5150 elsif ($char[$i] eq '\Q') {
5151 0 $char[$i] = '@{[CORE::quotemeta qq<';
5152 0 $left_e++;
5153 }
5154 elsif ($char[$i] eq '\E') {
5155 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
5156 0 $char[$i] = '>]}';
5157 0 $right_e++;
5158 }
5159 else {
5160 0 $char[$i] = '';
5161 }
5162 }
5163 elsif ($char[$i] eq '\Q') {
5164 0 while (1) {
5165 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5166 0 last;
5167 }
5168 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
5169 0 last;
5170 }
5171 }
5172 }
5173 elsif ($char[$i] eq '\E') {
5174 }
5175  
5176 # $0 --> $0
5177 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
5178 }
5179 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
5180 }
5181  
5182 # $$ --> $$
5183 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
5184 }
5185  
5186 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
5187 # $1, $2, $3 --> $1, $2, $3 otherwise
5188 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
5189 0 $char[$i] = e_capture($1);
5190 }
5191 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
5192 0 $char[$i] = e_capture($1);
5193 }
5194  
5195 # $$foo[ ... ] --> $ $foo->[ ... ]
5196 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
5197 0 $char[$i] = e_capture($1.'->'.$2);
5198 }
5199  
5200 # $$foo{ ... } --> $ $foo->{ ... }
5201 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
5202 0 $char[$i] = e_capture($1.'->'.$2);
5203 }
5204  
5205 # $$foo
5206 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
5207 0 $char[$i] = e_capture($1);
5208 }
5209  
5210 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin10::PREMATCH()
5211 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
5212 8 $char[$i] = '@{[Elatin10::PREMATCH()]}';
5213 }
5214  
5215 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin10::MATCH()
5216 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
5217 8 $char[$i] = '@{[Elatin10::MATCH()]}';
5218 }
5219  
5220 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin10::POSTMATCH()
5221 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
5222 6 $char[$i] = '@{[Elatin10::POSTMATCH()]}';
5223 }
5224  
5225 # ${ foo } --> ${ foo }
5226 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/oxms) {
5227 }
5228  
5229 # ${ ... }
5230 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5231 0 $char[$i] = e_capture($1);
5232 }
5233 }
5234  
5235 # return string
5236 93 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 93 93
5237 0 return join '', @char, '>]}' x ($left_e - $right_e);
5238 }
5239 93 return join '', @char;
5240 }
5241  
5242 #
5243 # escape regexp (m//, qr//)
5244 #
5245 880 ▶sub e_qr {
Subroutine e_qr: called CC=110 SCAR=73.6
Pod undocumented
5246 880 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5247 880 ▶ $modifier ||= '';
Condition100%2/2
$modifier ||= ""
l!l
366514
MC/DC100%1/1
$modifier ||= ""
$modifier
Truth table100%2/2
A
A= $modifier
Aresult
11
00
5248  
5249 880 $modifier =~ tr/p//d;
5250 880 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 880 880
5251 0 my $line = 0;
5252 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
5253 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
5254 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
5255 0 last;
5256 }
5257 }
5258 0 die qq{Unsupported modifier "$1" used at line $line.\n};
5259 }
5260  
5261 880 $slash = 'div';
5262  
5263 # literal null string pattern
5264 880 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 872 880
elsif ($modifier =~ tr/Bb//d) { } 2 870 872
5265 8 $modifier =~ tr/bB//d;
5266 8 $modifier =~ tr/i//d;
5267 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
5268 }
5269  
5270 # /b /B modifier
5271 elsif ($modifier =~ tr/bB//d) {
5272  
5273 # choice again delimiter
5274 2 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 2 2
5275 0 my @char = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5276 0 my %octet = map {$_ => 1} @char;
5277 0 ▶ if (not $octet{')'}) {
Branch: 4 branches
BranchTrueFalseTotal
if (not $octet{')'}) { } 0 0 0
elsif (not $octet{'}'}) { } 0 0 0
elsif (not $octet{']'}) { } 0 0 0
elsif (not $octet{'>'}) { } 0 0 0
5278 0 $delimiter = '(';
5279 0 $end_delimiter = ')';
5280 }
5281 elsif (not $octet{'}'}) {
5282 0 $delimiter = '{';
5283 0 $end_delimiter = '}';
5284 }
5285 elsif (not $octet{']'}) {
5286 0 $delimiter = '[';
5287 0 $end_delimiter = ']';
5288 }
5289 elsif (not $octet{'>'}) {
5290 0 $delimiter = '<';
5291 0 $end_delimiter = '>';
5292 }
5293 else {
5294 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5295 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5296 0 $delimiter = $char;
5297 0 $end_delimiter = $char;
5298 0 last;
5299 }
5300 }
5301 }
5302 }
5303  
5304 2 ▶ if (($ope =~ /\A m? \z/oxms) and ($delimiter eq '?')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ope =~ /\A m? \z/mosx and $delimiter eq '?') { } 0 2 2
Condition33%1/3
$ope =~ /\A m? \z/mosx and $delimiter eq "?"
!ll&&!rl&&r
020
MC/DC0%0/2
$ope =~ /\A m? \z/mosx and $delimiter eq "?"
$ope =~ /\A m? \z/mosx $delimiter eq "?"
Truth table33%1/3
A and B
A= $ope =~ /\A m? \z/mosxB= $delimiter eq "?"
ABresult
0X0
100
111
5305 0 return join '', $ope, $delimiter, $string, $matched, $end_delimiter, $modifier;
5306 }
5307 else {
5308 2 return join '', $ope, $delimiter, '(?:', $string, ')', $matched, $end_delimiter, $modifier;
5309 }
5310 }
5311  
5312 870 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 312 558 870
5313 870 my $metachar = qr/[\@\\|[\]{^]/oxms;
5314  
5315 # split regexp
5316 870 my @char = $string =~ /\G((?>
5317 [^\\\$\@\[\(] |
5318 \\x (?>[0-9A-Fa-f]{1,2}) |
5319 \\ (?>[0-7]{2,3}) |
5320 \\c [\x40-\x5F] |
5321 \\x\{ (?>[0-9A-Fa-f]+) \} |
5322 \\o\{ (?>[0-7]+) \} |
5323 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
5324 \\ $q_char |
5325 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5326 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5327 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5328 [\$\@] $qq_variable |
5329 \$ (?>\s* [0-9]+) |
5330 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5331 \$ \$ (?![\w\{]) |
5332 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5333 \[\^ |
5334 \[\: (?>[a-z]+) :\] |
5335 \[\:\^ (?>[a-z]+) :\] |
5336 \(\? |
5337 $q_char
5338 ))/oxmsg;
5339  
5340 # choice again delimiter
5341 870 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 870 870
5342 0 my %octet = map {$_ => 1} @char;
5343 0 ▶ if (not $octet{')'}) {
Branch: 4 branches
BranchTrueFalseTotal
if (not $octet{')'}) { } 0 0 0
elsif (not $octet{'}'}) { } 0 0 0
elsif (not $octet{']'}) { } 0 0 0
elsif (not $octet{'>'}) { } 0 0 0
5344 0 $delimiter = '(';
5345 0 $end_delimiter = ')';
5346 }
5347 elsif (not $octet{'}'}) {
5348 0 $delimiter = '{';
5349 0 $end_delimiter = '}';
5350 }
5351 elsif (not $octet{']'}) {
5352 0 $delimiter = '[';
5353 0 $end_delimiter = ']';
5354 }
5355 elsif (not $octet{'>'}) {
5356 0 $delimiter = '<';
5357 0 $end_delimiter = '>';
5358 }
5359 else {
5360 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5361 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5362 0 $delimiter = $char;
5363 0 $end_delimiter = $char;
5364 0 last;
5365 }
5366 }
5367 }
5368 }
5369  
5370 870 my $left_e = 0;
5371 870 my $right_e = 0;
5372 870 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 2100 870 2970
5373  
5374 # "\L\u" --> "\u\L"
5375 2100 ▶ if (($char[$i] eq '\L') and ($char[$i+1] eq '\u')) {
Branch: 6 branches
BranchTrueFalseTotal
if ($char[$i] eq '\\L' and $char[$i + 1] eq '\\u') { } 0 2100 2100
elsif ($char[$i] eq '\\U' and $char[$i + 1] eq '\\l') { } 0 2100 2100
elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/mosx) { } 1 2099 2100
elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/mosx) { } 1 2098 2099
elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/mosx) { } 6 2092 2098
elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/mosx) { } 4 2088 2092
Condition66%2/3
$char[$i] eq "\\L" and $char[$i + 1] eq "\\u"
!ll&&!rl&&r
209910
MC/DC0%0/2
$char[$i] eq "\\L" and $char[$i + 1] eq "\\u"
$char[$i] eq "\\L" $char[$i + 1] eq "\\u"
Truth table66%2/3
A and B
A= $char[$i] eq "\\L"B= $char[$i + 1] eq "\\u"
ABresult
0X0
100
111
5376 0 @char[$i,$i+1] = @char[$i+1,$i];
5377 }
5378  
5379 # "\U\l" --> "\l\U"
5380 ▶ elsif (($char[$i] eq '\U') and ($char[$i+1] eq '\l')) {
Condition66%2/3
$char[$i] eq "\\U" and $char[$i + 1] eq "\\l"
!ll&&!rl&&r
209910
MC/DC0%0/2
$char[$i] eq "\\U" and $char[$i + 1] eq "\\l"
$char[$i] eq "\\U" $char[$i + 1] eq "\\l"
Truth table66%2/3
A and B
A= $char[$i] eq "\\U"B= $char[$i + 1] eq "\\l"
ABresult
0X0
100
111
5381 0 @char[$i,$i+1] = @char[$i+1,$i];
5382 }
5383  
5384 # octal escape sequence
5385 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5386 1 $char[$i] = Elatin10::octchr($1);
5387 }
5388  
5389 # hexadecimal escape sequence
5390 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5391 1 $char[$i] = Elatin10::hexchr($1);
5392 }
5393  
5394 # \b{...} --> b\{...}
5395 # \B{...} --> B\{...}
5396 # \N{CHARNAME} --> N\{CHARNAME}
5397 # \p{PROPERTY} --> p\{PROPERTY}
5398 # \P{PROPERTY} --> P\{PROPERTY}
5399 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5400 6 $char[$i] = $1 . '\\' . $2;
5401 }
5402  
5403 # \p, \P, \X --> p, P, X
5404 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
5405 4 $char[$i] = $1;
5406 }
5407  
5408 2100 ▶ if (0) {
Branch: 30 branches
BranchTrueFalseTotal
if (do { $char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx }) { } 6 2094 2100
elsif ($char[$i] eq '[') { } 556 1538 2094
elsif ($char[$i] eq '[^') { } 74 1464 1538
elsif (my $char = character_class($char[$i], $modifier)) { } 139 1325 1464
elsif ($ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin10::uc($char[$i]) ne &fc($char[$i])) { } 20 1305 1325
elsif ($char[$i] =~ /\A [<>] \z/mosx) { } 1 1304 1305
elsif ($char[$i] eq '\\u') { } 0 1304 1304
elsif ($char[$i] eq '\\l') { } 0 1304 1304
elsif ($char[$i] eq '\\U') { } 1 1303 1304
elsif ($char[$i] eq '\\L') { } 1 1302 1303
elsif ($char[$i] eq '\\F') { } 18 1284 1302
elsif ($char[$i] eq '\\Q') { } 1 1283 1284
elsif ($char[$i] eq '\\E') { } 21 1262 1283
elsif ($char[$i] eq '\\Q') { } 0 1262 1262
elsif ($char[$i] eq '\\E') { } 0 1262 1262
elsif ($char[$i] =~ /\A \$ 0 \z/mosx) { } 0 1262 1262
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/mosx) { } 0 1262 1262
elsif ($char[$i] =~ /\A \$\$ \z/mosx) { } 0 1262 1262
elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/mosx) { } 0 1262 1262
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/mosx) { } 0 1262 1262
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/mosx) { } 0 1262 1262
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/mosx) { } 0 1262 1262
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/mosx) { } 0 1262 1262
elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/cgmosx) { } 8 1254 1262
elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/cgmosx) { } 8 1246 1254
elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/cgmosx) { } 6 1240 1246
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/mosx) { } 0 1240 1240
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/mosx) { } 0 1240 1240
elsif ($char[$i] =~ /\A [\$\@].+ /mosx) { } 21 1219 1240
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 138 1377 1515
5409 }
5410  
5411 # join separated multiple-octet
5412 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
5413 6 ▶ if ( ($i+3 <= $#char) and (grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms, @char[$i+1..$i+3]) == 3) and (CORE::eval(sprintf '"%s%s%s%s"', @char[$i..$i+3]) =~ /\A $q_char \z/oxms)) {
Branch: 3 branches
BranchTrueFalseTotal
if ($i + 3 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 3]) == 3 and eval(sprintf '"%s%s%s%s"', @char[$i .. $i + 3]) =~ /\A $Elatin10::q_char \z/mosx) { } 0 6 6
elsif ($i + 2 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 2]) == 2 and eval(sprintf '"%s%s%s"', @char[$i .. $i + 2]) =~ /\A $Elatin10::q_char \z/mosx) { } 0 6 6
elsif ($i + 1 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, $char[$i + 1]) == 1 and eval(sprintf '"%s%s"', @char[$i .. $i + 1]) =~ /\A $Elatin10::q_char \z/mosx) { } 0 12 12
Condition33%2/6
$i + 3 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 3]) == 3 and eval(sprintf "\"%s%s%s%s\"", @char[$i .. $i + 3]) =~ /\A $Elatin10::q_char \z/mosx
!ll&&!rl&&r
600
$i + 3 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 3]) == 3
!ll&&!rl&&r
600
MC/DC0%0/3
$i + 3 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 3]) == 3 and eval(sprintf "\"%s%s%s%s\"", @char[$i .. $i + 3]) =~ /\A $Elatin10::q_char \z/mosx
$i + 3 <= $#char grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 3]) == 3 eval(sprintf "\"%s%s%s%s\"", @char[$i .. $i + 3]) =~ /\A $Elatin10::q_char \z/mosx
Truth table25%1/4
A and B and C
A= $i + 3 <= $#charB= grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 3]) == 3C= eval(sprintf "\"%s%s%s%s\"", @char[$i .. $i + 3]) =~ /\A $Elatin10::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5414 0 $char[$i] .= join '', splice @char, $i+1, 3;
5415 }
5416 ▶ elsif (($i+2 <= $#char) and (grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms, @char[$i+1..$i+2]) == 2) and (CORE::eval(sprintf '"%s%s%s"', @char[$i..$i+2]) =~ /\A $q_char \z/oxms)) {
Condition33%2/6
$i + 2 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 2]) == 2 and eval(sprintf "\"%s%s%s\"", @char[$i .. $i + 2]) =~ /\A $Elatin10::q_char \z/mosx
!ll&&!rl&&r
600
$i + 2 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 2]) == 2
!ll&&!rl&&r
600
MC/DC0%0/3
$i + 2 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 2]) == 2 and eval(sprintf "\"%s%s%s\"", @char[$i .. $i + 2]) =~ /\A $Elatin10::q_char \z/mosx
$i + 2 <= $#char grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 2]) == 2 eval(sprintf "\"%s%s%s\"", @char[$i .. $i + 2]) =~ /\A $Elatin10::q_char \z/mosx
Truth table25%1/4
A and B and C
A= $i + 2 <= $#charB= grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 2]) == 2C= eval(sprintf "\"%s%s%s\"", @char[$i .. $i + 2]) =~ /\A $Elatin10::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5417 0 $char[$i] .= join '', splice @char, $i+1, 2;
5418 }
5419 ▶ elsif (($i+1 <= $#char) and (grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms, $char[$i+1 ]) == 1) and (CORE::eval(sprintf '"%s%s"', @char[$i..$i+1]) =~ /\A $q_char \z/oxms)) {
Condition50%3/6
$i + 1 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, $char[$i + 1]) == 1 and eval(sprintf "\"%s%s\"", @char[$i .. $i + 1]) =~ /\A $Elatin10::q_char \z/mosx
!ll&&!rl&&r
600
$i + 1 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, $char[$i + 1]) == 1
!ll&&!rl&&r
420
MC/DC0%0/3
$i + 1 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, $char[$i + 1]) == 1 and eval(sprintf "\"%s%s\"", @char[$i .. $i + 1]) =~ /\A $Elatin10::q_char \z/mosx
$i + 1 <= $#char grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, $char[$i + 1]) == 1 eval(sprintf "\"%s%s\"", @char[$i .. $i + 1]) =~ /\A $Elatin10::q_char \z/mosx
Truth table50%2/4
A and B and C
A= $i + 1 <= $#charB= grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, $char[$i + 1]) == 1C= eval(sprintf "\"%s%s\"", @char[$i .. $i + 1]) =~ /\A $Elatin10::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5420 0 $char[$i] .= join '', splice @char, $i+1, 1;
5421 }
5422 }
5423  
5424 # open character class [...]
5425 elsif ($char[$i] eq '[') {
5426 556 my $left = $i;
5427  
5428 # [] make die "Unmatched [] in regexp ...\n"
5429 # (and so on)
5430  
5431 556 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 3 553 556
5432 3 $i++;
5433 }
5434  
5435 556 while (1) {
5436 2063 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 2063 2063
5437 0 die __FILE__, ": Unmatched [] in regexp\n";
5438 }
5439 2063 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 556 1507 2063
5440 556 my $right = $i;
5441  
5442 # [...]
5443 556 ▶ if (grep(/\A [\$\@]/oxms,@char[$left+1..$right-1]) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep(/\A [\$\@]/mosx, @char[$left + 1 .. $right - 1]) >= 1) { } 30 526 556
5444 30 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin10::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
5445 }
5446 else {
5447 526 splice @char, $left, $right-$left+1, Elatin10::charlist_qr(@char[$left+1..$right-1], $modifier);
5448 }
5449  
5450 556 $i = $left;
5451 556 last;
5452 }
5453 }
5454 }
5455  
5456 # open character class [^...]
5457 elsif ($char[$i] eq '[^') {
5458 74 my $left = $i;
5459  
5460 # [^] make die "Unmatched [] in regexp ...\n"
5461 # (and so on)
5462  
5463 74 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 4 70 74
5464 4 $i++;
5465 }
5466  
5467 74 while (1) {
5468 272 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 272 272
5469 0 die __FILE__, ": Unmatched [] in regexp\n";
5470 }
5471 272 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 74 198 272
5472 74 my $right = $i;
5473  
5474 # [^...]
5475 74 ▶ if (grep(/\A [\$\@]/oxms,@char[$left+1..$right-1]) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep(/\A [\$\@]/mosx, @char[$left + 1 .. $right - 1]) >= 1) { } 30 44 74
5476 30 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin10::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
5477 }
5478 else {
5479 44 splice @char, $left, $right-$left+1, Elatin10::charlist_not_qr(@char[$left+1..$right-1], $modifier);
5480 }
5481  
5482 74 $i = $left;
5483 74 last;
5484 }
5485 }
5486 }
5487  
5488 # rewrite character class or escape character
5489 elsif (my $char = character_class($char[$i],$modifier)) {
5490 139 $char[$i] = $char;
5491 }
5492  
5493 # /i modifier
5494 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin10::uc($char[$i]) ne Elatin10::fc($char[$i]))) {
Condition100%6/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin10::uc($char[$i]) ne &fc($char[$i])
!ll&&!rl&&r
1297820
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx
!ll&&!rl&&r
12663128
MC/DC100%3/3
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin10::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin10::uc($char[$i]) ne &fc($char[$i])
Truth table100%4/4
A and B and C
A= $ignorecaseB= $char[$i] =~ /\A [\x00-\xFF] \z/mosxC= &Elatin10::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
5495 20 ▶ if (CORE::length(Elatin10::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 20 0 20
5496 20 $char[$i] = '[' . Elatin10::uc($char[$i]) . Elatin10::fc($char[$i]) . ']';
5497 }
5498 else {
5499 0 $char[$i] = '(?:' . Elatin10::uc($char[$i]) . '|' . Elatin10::fc($char[$i]) . ')';
5500 }
5501 }
5502  
5503 # \u \l \U \L \F \Q \E
5504 elsif ($char[$i] =~ /\A [<>] \z/oxms) {
5505 1 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 1 1
5506 0 $char[$i] = '\\' . $char[$i];
5507 }
5508 }
5509 elsif ($char[$i] eq '\u') {
5510 0 $char[$i] = '@{[Elatin10::ucfirst qq<';
5511 0 $left_e++;
5512 }
5513 elsif ($char[$i] eq '\l') {
5514 0 $char[$i] = '@{[Elatin10::lcfirst qq<';
5515 0 $left_e++;
5516 }
5517 elsif ($char[$i] eq '\U') {
5518 1 $char[$i] = '@{[Elatin10::uc qq<';
5519 1 $left_e++;
5520 }
5521 elsif ($char[$i] eq '\L') {
5522 1 $char[$i] = '@{[Elatin10::lc qq<';
5523 1 $left_e++;
5524 }
5525 elsif ($char[$i] eq '\F') {
5526 18 $char[$i] = '@{[Elatin10::fc qq<';
5527 18 $left_e++;
5528 }
5529 elsif ($char[$i] eq '\Q') {
5530 1 $char[$i] = '@{[CORE::quotemeta qq<';
5531 1 $left_e++;
5532 }
5533 elsif ($char[$i] eq '\E') {
5534 21 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 21 0 21
5535 21 $char[$i] = '>]}';
5536 21 $right_e++;
5537 }
5538 else {
5539 0 $char[$i] = '';
5540 }
5541 }
5542 elsif ($char[$i] eq '\Q') {
5543 0 while (1) {
5544 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5545 0 last;
5546 }
5547 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
5548 0 last;
5549 }
5550 }
5551 }
5552 elsif ($char[$i] eq '\E') {
5553 }
5554  
5555 # $0 --> $0
5556 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
5557 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5558 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
5559 }
5560 }
5561 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
5562 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5563 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
5564 }
5565 }
5566  
5567 # $$ --> $$
5568 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
5569 }
5570  
5571 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
5572 # $1, $2, $3 --> $1, $2, $3 otherwise
5573 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
5574 0 $char[$i] = e_capture($1);
5575 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5576 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
5577 }
5578 }
5579 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
5580 0 $char[$i] = e_capture($1);
5581 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5582 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
5583 }
5584 }
5585  
5586 # $$foo[ ... ] --> $ $foo->[ ... ]
5587 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
5588 0 $char[$i] = e_capture($1.'->'.$2);
5589 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5590 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
5591 }
5592 }
5593  
5594 # $$foo{ ... } --> $ $foo->{ ... }
5595 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
5596 0 $char[$i] = e_capture($1.'->'.$2);
5597 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5598 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
5599 }
5600 }
5601  
5602 # $$foo
5603 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
5604 0 $char[$i] = e_capture($1);
5605 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5606 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
5607 }
5608 }
5609  
5610 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin10::PREMATCH()
5611 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
5612 8 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 8 8
5613 0 $char[$i] = '@{[Elatin10::ignorecase(Elatin10::PREMATCH())]}';
5614 }
5615 else {
5616 8 $char[$i] = '@{[Elatin10::PREMATCH()]}';
5617 }
5618 }
5619  
5620 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin10::MATCH()
5621 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
5622 8 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 8 8
5623 0 $char[$i] = '@{[Elatin10::ignorecase(Elatin10::MATCH())]}';
5624 }
5625 else {
5626 8 $char[$i] = '@{[Elatin10::MATCH()]}';
5627 }
5628 }
5629  
5630 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin10::POSTMATCH()
5631 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
5632 6 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 6 6
5633 0 $char[$i] = '@{[Elatin10::ignorecase(Elatin10::POSTMATCH())]}';
5634 }
5635 else {
5636 6 $char[$i] = '@{[Elatin10::POSTMATCH()]}';
5637 }
5638 }
5639  
5640 # ${ foo }
5641 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
5642 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5643 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
5644 }
5645 }
5646  
5647 # ${ ... }
5648 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5649 0 $char[$i] = e_capture($1);
5650 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5651 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
5652 }
5653 }
5654  
5655 # $scalar or @array
5656 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
5657 21 $char[$i] = e_string($char[$i]);
5658 21 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 11 10 21
5659 11 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
5660 }
5661 }
5662  
5663 # quote character before ? + * {
5664 ▶ elsif (($i >= 1) and ($char[$i] =~ /\A [\?\+\*\{] \z/oxms)) {
Condition100%3/3
$i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx
!ll&&!rl&&r
296785138
MC/DC100%2/2
$i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx
$i >= 1 $char[$i] =~ /\A [\?\+\*\{] \z/mosx
Truth table100%3/3
A and B
A= $i >= 1B= $char[$i] =~ /\A [\?\+\*\{] \z/mosx
ABresult
0X0
100
111
5665 138 ▶ if ($char[$i-1] =~ /\A (?:[\x00-\xFF]|\\[0-7]{2,3}|\\x[0-9-A-Fa-f]{1,2}) \z/oxms) {
Branch: 2 branches
BranchTrueFalseTotal
if ($char[$i - 1] =~ /\A (?:[\x00-\xFF]|\\[0-7]{2,3}|\\x[0-9-A-Fa-f]{1,2}) \z/mosx) { } 11 127 138
elsif ($ope =~ /\A m? \z/mosx and $delimiter eq '?') { } 0 127 127
5666 }
5667 ▶ elsif (($ope =~ /\A m? \z/oxms) and ($delimiter eq '?')) {
Condition33%1/3
$ope =~ /\A m? \z/mosx and $delimiter eq "?"
!ll&&!rl&&r
01270
MC/DC0%0/2
$ope =~ /\A m? \z/mosx and $delimiter eq "?"
$ope =~ /\A m? \z/mosx $delimiter eq "?"
Truth table33%1/3
A and B
A= $ope =~ /\A m? \z/mosxB= $delimiter eq "?"
ABresult
0X0
100
111
5668 0 my $char = $char[$i-1];
5669 0 ▶ if ($char[$i] eq '{') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq '{') { } 0 0 0
5670 0 die __FILE__, qq{: "MULTIBYTE{n}" should be "(MULTIBYTE){n}" in m?? (and shift \$1,\$2,\$3,...) ($char){n}\n};
5671 }
5672 else {
5673 0 die __FILE__, qq{: "MULTIBYTE$char[$i]" should be "(MULTIBYTE)$char[$i]" in m?? (and shift \$1,\$2,\$3,...) ($char)$char[$i]\n};
5674 }
5675 }
5676 else {
5677 127 $char[$i-1] = '(?:' . $char[$i-1] . ')';
5678 }
5679 }
5680 }
5681  
5682 # make regexp string
5683 870 $modifier =~ tr/i//d;
5684 870 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 870 870
5685 0 ▶ if (($ope =~ /\A m? \z/oxms) and ($delimiter eq '?')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ope =~ /\A m? \z/mosx and $delimiter eq '?') { } 0 0 0
Condition0%0/3
$ope =~ /\A m? \z/mosx and $delimiter eq "?"
!ll&&!rl&&r
000
MC/DC0%0/2
$ope =~ /\A m? \z/mosx and $delimiter eq "?"
$ope =~ /\A m? \z/mosx $delimiter eq "?"
Truth table0%0/3
A and B
A= $ope =~ /\A m? \z/mosxB= $delimiter eq "?"
ABresult
0X0
100
111
5686 0 return join '', $ope, $delimiter, $anchor, @char, '>]}' x ($left_e - $right_e), $matched, $end_delimiter, $modifier;
5687 }
5688 else {
5689 0 return join '', $ope, $delimiter, $anchor, '(?:', @char, '>]}' x ($left_e - $right_e), ')', $matched, $end_delimiter, $modifier;
5690 }
5691 }
5692 870 ▶ if (($ope =~ /\A m? \z/oxms) and ($delimiter eq '?')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ope =~ /\A m? \z/mosx and $delimiter eq '?') { } 0 870 870
Condition33%1/3
$ope =~ /\A m? \z/mosx and $delimiter eq "?"
!ll&&!rl&&r
08700
MC/DC0%0/2
$ope =~ /\A m? \z/mosx and $delimiter eq "?"
$ope =~ /\A m? \z/mosx $delimiter eq "?"
Truth table33%1/3
A and B
A= $ope =~ /\A m? \z/mosxB= $delimiter eq "?"
ABresult
0X0
100
111
5693 0 return join '', $ope, $delimiter, $anchor, @char, $matched, $end_delimiter, $modifier;
5694 }
5695 else {
5696 870 return join '', $ope, $delimiter, $anchor, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
5697 }
5698 }
5699  
5700 #
5701 # double quote stuff
5702 #
5703 180 ▶sub qq_stuff {
Subroutine qq_stuff: called CC=6 SCAR=18.5
Pod undocumented
5704 180 my($delimiter,$end_delimiter,$stuff) = @_;
5705  
5706 # scalar variable or array variable
5707 180 ▶ if ($stuff =~ /\A [\$\@] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($stuff =~ /\A [\$\@] /mosx) 100 80 180
5708 100 return $stuff;
5709 }
5710  
5711 # quote by delimiter
5712 80 my %octet = map {$_ => 1} ($stuff =~ /\G ([\x00-\xFF]) /oxmsg);
5713 80 for my $char (qw( ! " $ % & * + - . / : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5714 80 ▶ next if $char eq $delimiter;
Branch: 1 branch
BranchTrueFalseTotal
if $char eq $delimiter 0 80 80
5715 80 ▶ next if $char eq $end_delimiter;
Branch: 1 branch
BranchTrueFalseTotal
if $char eq $end_delimiter 0 80 80
5716 80 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 80 0 80
5717 80 return join '', 'qq', $char, $stuff, $char;
5718 }
5719 }
5720 0 return join '', 'qq', '<', $stuff, '>';
5721 }
5722  
5723 #
5724 # escape regexp (m'', qr'', and m''b, qr''b)
5725 #
5726 10 ▶sub e_qr_q {
Subroutine e_qr_q: called CC=7 SCAR=25.3
Pod undocumented
5727 10 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5728 10 ▶ $modifier ||= '';
Condition50%1/2
$modifier ||= ""
l!l
010
MC/DC0%0/1
$modifier ||= ""
$modifier
Truth table50%1/2
A
A= $modifier
Aresult
11
00
5729  
5730 10 $modifier =~ tr/p//d;
5731 10 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 10 10
5732 0 my $line = 0;
5733 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
5734 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
5735 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
5736 0 last;
5737 }
5738 }
5739 0 die qq{Unsupported modifier "$1" used at line $line.\n};
5740 }
5741  
5742 10 $slash = 'div';
5743  
5744 # literal null string pattern
5745 10 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 2 10
elsif ($modifier =~ tr/Bb//d) { } 0 2 2
5746 8 $modifier =~ tr/bB//d;
5747 8 $modifier =~ tr/i//d;
5748 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
5749 }
5750  
5751 # with /b /B modifier
5752 elsif ($modifier =~ tr/bB//d) {
5753 0 return e_qr_qb($ope,$delimiter,$end_delimiter,$string,$modifier);
5754 }
5755  
5756 # without /b /B modifier
5757 else {
5758 2 return e_qr_qt($ope,$delimiter,$end_delimiter,$string,$modifier);
5759 }
5760 }
5761  
5762 #
5763 # escape regexp (m'', qr'')
5764 #
5765 2 ▶sub e_qr_qt {
Subroutine e_qr_qt: called CC=20 SCAR=51.8
Pod undocumented
5766 2 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5767  
5768 2 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 2 2
5769  
5770 # split regexp
5771 2 my @char = $string =~ /\G((?>
5772 [^\\\[\$\@\/] |
5773 [\x00-\xFF] |
5774 \[\^ |
5775 \[\: (?>[a-z]+) \:\] |
5776 \[\:\^ (?>[a-z]+) \:\] |
5777 [\$\@\/] |
5778 \\ (?:$q_char) |
5779 (?:$q_char)
5780 ))/oxmsg;
5781  
5782 # unescape character
5783 2 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 2 2 4
5784 2 ▶ if (0) {
Branch: 6 branches
BranchTrueFalseTotal
if (do { $char[$i] eq '[' }) { } 0 2 2
elsif ($char[$i] eq '[^') { } 0 2 2
elsif ($char[$i] =~ m(\A [\$\@/\\] \z)mosx) { } 0 2 2
elsif (my $char = character_class($char[$i], $modifier)) { } 0 2 2
elsif ($ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin10::uc($char[$i]) ne &fc($char[$i])) { } 0 2 2
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 4 4
5785 }
5786  
5787 # open character class [...]
5788 elsif ($char[$i] eq '[') {
5789 0 my $left = $i;
5790 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
5791 0 $i++;
5792 }
5793 0 while (1) {
5794 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5795 0 die __FILE__, ": Unmatched [] in regexp\n";
5796 }
5797 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
5798 0 my $right = $i;
5799  
5800 # [...]
5801 0 splice @char, $left, $right-$left+1, Elatin10::charlist_qr(@char[$left+1..$right-1], $modifier);
5802  
5803 0 $i = $left;
5804 0 last;
5805 }
5806 }
5807 }
5808  
5809 # open character class [^...]
5810 elsif ($char[$i] eq '[^') {
5811 0 my $left = $i;
5812 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
5813 0 $i++;
5814 }
5815 0 while (1) {
5816 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5817 0 die __FILE__, ": Unmatched [] in regexp\n";
5818 }
5819 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
5820 0 my $right = $i;
5821  
5822 # [^...]
5823 0 splice @char, $left, $right-$left+1, Elatin10::charlist_not_qr(@char[$left+1..$right-1], $modifier);
5824  
5825 0 $i = $left;
5826 0 last;
5827 }
5828 }
5829 }
5830  
5831 # escape $ @ / and \
5832 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
5833 0 $char[$i] = '\\' . $char[$i];
5834 }
5835  
5836 # rewrite character class or escape character
5837 elsif (my $char = character_class($char[$i],$modifier)) {
5838 0 $char[$i] = $char;
5839 }
5840  
5841 # /i modifier
5842 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin10::uc($char[$i]) ne Elatin10::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin10::uc($char[$i]) ne &fc($char[$i])
!ll&&!rl&&r
200
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx
!ll&&!rl&&r
200
MC/DC0%0/3
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin10::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin10::uc($char[$i]) ne &fc($char[$i])
Truth table25%1/4
A and B and C
A= $ignorecaseB= $char[$i] =~ /\A [\x00-\xFF] \z/mosxC= &Elatin10::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
5843 0 ▶ if (CORE::length(Elatin10::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
5844 0 $char[$i] = '[' . Elatin10::uc($char[$i]) . Elatin10::fc($char[$i]) . ']';
5845 }
5846 else {
5847 0 $char[$i] = '(?:' . Elatin10::uc($char[$i]) . '|' . Elatin10::fc($char[$i]) . ')';
5848 }
5849 }
5850  
5851 # quote character before ? + * {
5852 ▶ elsif (($i >= 1) and ($char[$i] =~ /\A [\?\+\*\{] \z/oxms)) {
Condition33%1/3
$i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx
!ll&&!rl&&r
200
MC/DC0%0/2
$i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx
$i >= 1 $char[$i] =~ /\A [\?\+\*\{] \z/mosx
Truth table33%1/3
A and B
A= $i >= 1B= $char[$i] =~ /\A [\?\+\*\{] \z/mosx
ABresult
0X0
100
111
5853 0 ▶ if ($char[$i-1] =~ /\A [\x00-\xFF] \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i - 1] =~ /\A [\x00-\xFF] \z/mosx) { } 0 0 0
5854 }
5855 else {
5856 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
5857 }
5858 }
5859 }
5860  
5861 2 $delimiter = '/';
5862 2 $end_delimiter = '/';
5863  
5864 2 $modifier =~ tr/i//d;
5865 2 return join '', $ope, $delimiter, $anchor, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
5866 }
5867  
5868 #
5869 # escape regexp (m''b, qr''b)
5870 #
5871 0 ▶sub e_qr_qb {
Subroutine e_qr_qb: not called CC=4 SCAR=30.0
Pod undocumented
5872 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5873  
5874 # split regexp
5875 0 my @char = $string =~ /\G ((?>[^\\]|\\\\)) /oxmsg;
5876  
5877 # unescape character
5878 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
5879 0 ▶ if (0) {
Branch: 2 branches
BranchTrueFalseTotal
if (do { $char[$i] eq '\\\\' }) { } 0 0 0
elsif ($char[$i] =~ m(\A [\$\@/\\] \z)mosx) { } 0 0 0
5880 }
5881  
5882 # remain \\
5883 elsif ($char[$i] eq '\\\\') {
5884 }
5885  
5886 # escape $ @ / and \
5887 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
5888 0 $char[$i] = '\\' . $char[$i];
5889 }
5890 }
5891  
5892 0 $delimiter = '/';
5893 0 $end_delimiter = '/';
5894 0 return join '', $ope, $delimiter, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
5895 }
5896  
5897 #
5898 # escape regexp (s/here//)
5899 #
5900 80 ▶sub e_s1 {
Subroutine e_s1: called CC=106 SCAR=81.1
Pod undocumented
5901 80 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5902 80 ▶ $modifier ||= '';
Condition100%2/2
$modifier ||= ""
l!l
3050
MC/DC100%1/1
$modifier ||= ""
$modifier
Truth table100%2/2
A
A= $modifier
Aresult
11
00
5903  
5904 80 $modifier =~ tr/p//d;
5905 80 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 80 80
5906 0 my $line = 0;
5907 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
5908 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
5909 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
5910 0 last;
5911 }
5912 }
5913 0 die qq{Unsupported modifier "$1" used at line $line.\n};
5914 }
5915  
5916 80 $slash = 'div';
5917  
5918 # literal null string pattern
5919 80 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 72 80
elsif ($modifier =~ tr/Bb//d) { } 0 72 72
5920 8 $modifier =~ tr/bB//d;
5921 8 $modifier =~ tr/i//d;
5922 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
5923 }
5924  
5925 # /b /B modifier
5926 elsif ($modifier =~ tr/bB//d) {
5927  
5928 # choice again delimiter
5929 0 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 0 0
5930 0 my @char = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5931 0 my %octet = map {$_ => 1} @char;
5932 0 ▶ if (not $octet{')'}) {
Branch: 4 branches
BranchTrueFalseTotal
if (not $octet{')'}) { } 0 0 0
elsif (not $octet{'}'}) { } 0 0 0
elsif (not $octet{']'}) { } 0 0 0
elsif (not $octet{'>'}) { } 0 0 0
5933 0 $delimiter = '(';
5934 0 $end_delimiter = ')';
5935 }
5936 elsif (not $octet{'}'}) {
5937 0 $delimiter = '{';
5938 0 $end_delimiter = '}';
5939 }
5940 elsif (not $octet{']'}) {
5941 0 $delimiter = '[';
5942 0 $end_delimiter = ']';
5943 }
5944 elsif (not $octet{'>'}) {
5945 0 $delimiter = '<';
5946 0 $end_delimiter = '>';
5947 }
5948 else {
5949 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5950 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5951 0 $delimiter = $char;
5952 0 $end_delimiter = $char;
5953 0 last;
5954 }
5955 }
5956 }
5957 }
5958  
5959 0 my $prematch = '';
5960 0 return join '', $ope, $delimiter, $prematch, '(?:', $string, ')', $matched, $end_delimiter, $modifier;
5961 }
5962  
5963 72 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 1 71 72
5964 72 my $metachar = qr/[\@\\|[\]{^]/oxms;
5965  
5966 # split regexp
5967 72 my @char = $string =~ /\G((?>
5968 [^\\\$\@\[\(] |
5969 \\ (?>[1-9][0-9]*) |
5970 \\g (?>\s*) (?>[1-9][0-9]*) |
5971 \\g (?>\s*) \{ (?>\s*) (?>[1-9][0-9]*) (?>\s*) \} |
5972 \\g (?>\s*) \{ (?>\s*) - (?>\s*) (?>[1-9][0-9]*) (?>\s*) \} |
5973 \\x (?>[0-9A-Fa-f]{1,2}) |
5974 \\ (?>[0-7]{2,3}) |
5975 \\c [\x40-\x5F] |
5976 \\x\{ (?>[0-9A-Fa-f]+) \} |
5977 \\o\{ (?>[0-7]+) \} |
5978 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
5979 \\ $q_char |
5980 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5981 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5982 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5983 [\$\@] $qq_variable |
5984 \$ (?>\s* [0-9]+) |
5985 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5986 \$ \$ (?![\w\{]) |
5987 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5988 \[\^ |
5989 \[\: (?>[a-z]+) :\] |
5990 \[\:\^ (?>[a-z]+) :\] |
5991 \(\? |
5992 $q_char
5993 ))/oxmsg;
5994  
5995 # choice again delimiter
5996 72 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 72 72
5997 0 my %octet = map {$_ => 1} @char;
5998 0 ▶ if (not $octet{')'}) {
Branch: 4 branches
BranchTrueFalseTotal
if (not $octet{')'}) { } 0 0 0
elsif (not $octet{'}'}) { } 0 0 0
elsif (not $octet{']'}) { } 0 0 0
elsif (not $octet{'>'}) { } 0 0 0
5999 0 $delimiter = '(';
6000 0 $end_delimiter = ')';
6001 }
6002 elsif (not $octet{'}'}) {
6003 0 $delimiter = '{';
6004 0 $end_delimiter = '}';
6005 }
6006 elsif (not $octet{']'}) {
6007 0 $delimiter = '[';
6008 0 $end_delimiter = ']';
6009 }
6010 elsif (not $octet{'>'}) {
6011 0 $delimiter = '<';
6012 0 $end_delimiter = '>';
6013 }
6014 else {
6015 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
6016 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
6017 0 $delimiter = $char;
6018 0 $end_delimiter = $char;
6019 0 last;
6020 }
6021 }
6022 }
6023 }
6024  
6025 # count '('
6026 72 my $parens = grep { $_ eq '(' } @char;
6027  
6028 72 my $left_e = 0;
6029 72 my $right_e = 0;
6030 72 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 200 72 272
6031  
6032 # "\L\u" --> "\u\L"
6033 200 ▶ if (($char[$i] eq '\L') and ($char[$i+1] eq '\u')) {
Branch: 6 branches
BranchTrueFalseTotal
if ($char[$i] eq '\\L' and $char[$i + 1] eq '\\u') { } 0 200 200
elsif ($char[$i] eq '\\U' and $char[$i + 1] eq '\\l') { } 0 200 200
elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/mosx) { } 1 199 200
elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/mosx) { } 1 198 199
elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/mosx) { } 0 198 198
elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/mosx) { } 0 198 198
Condition33%1/3
$char[$i] eq "\\L" and $char[$i + 1] eq "\\u"
!ll&&!rl&&r
20000
MC/DC0%0/2
$char[$i] eq "\\L" and $char[$i + 1] eq "\\u"
$char[$i] eq "\\L" $char[$i + 1] eq "\\u"
Truth table33%1/3
A and B
A= $char[$i] eq "\\L"B= $char[$i + 1] eq "\\u"
ABresult
0X0
100
111
6034 0 @char[$i,$i+1] = @char[$i+1,$i];
6035 }
6036  
6037 # "\U\l" --> "\l\U"
6038 ▶ elsif (($char[$i] eq '\U') and ($char[$i+1] eq '\l')) {
Condition33%1/3
$char[$i] eq "\\U" and $char[$i + 1] eq "\\l"
!ll&&!rl&&r
20000
MC/DC0%0/2
$char[$i] eq "\\U" and $char[$i + 1] eq "\\l"
$char[$i] eq "\\U" $char[$i + 1] eq "\\l"
Truth table33%1/3
A and B
A= $char[$i] eq "\\U"B= $char[$i + 1] eq "\\l"
ABresult
0X0
100
111
6039 0 @char[$i,$i+1] = @char[$i+1,$i];
6040 }
6041  
6042 # octal escape sequence
6043 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
6044 1 $char[$i] = Elatin10::octchr($1);
6045 }
6046  
6047 # hexadecimal escape sequence
6048 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
6049 1 $char[$i] = Elatin10::hexchr($1);
6050 }
6051  
6052 # \b{...} --> b\{...}
6053 # \B{...} --> B\{...}
6054 # \N{CHARNAME} --> N\{CHARNAME}
6055 # \p{PROPERTY} --> p\{PROPERTY}
6056 # \P{PROPERTY} --> P\{PROPERTY}
6057 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
6058 0 $char[$i] = $1 . '\\' . $2;
6059 }
6060  
6061 # \p, \P, \X --> p, P, X
6062 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
6063 0 $char[$i] = $1;
6064 }
6065  
6066 200 ▶ if (0) {
Branch: 35 branches
BranchTrueFalseTotal
if (do { $char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx }) { } 0 200 200
elsif ($char[$i] eq '[') { } 17 183 200
elsif ($char[$i] eq '[^') { } 0 183 183
elsif (my $char = character_class($char[$i], $modifier)) { } 7 176 183
elsif ($ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin10::uc($char[$i]) ne &fc($char[$i])) { } 3 173 176
elsif ($char[$i] =~ /\A [<>] \z/mosx) { } 0 173 173
elsif ($char[$i] eq '\\u') { } 0 173 173
elsif ($char[$i] eq '\\l') { } 0 173 173
elsif ($char[$i] eq '\\U') { } 0 173 173
elsif ($char[$i] eq '\\L') { } 0 173 173
elsif ($char[$i] eq '\\F') { } 0 173 173
elsif ($char[$i] eq '\\Q') { } 0 173 173
elsif ($char[$i] eq '\\E') { } 0 173 173
elsif ($char[$i] eq '\\Q') { } 0 173 173
elsif ($char[$i] eq '\\E') { } 0 173 173
elsif ($char[$i] =~ /\A \\ (?>\s*) 0 \z/mosx) { } 0 173 173
elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) - (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/mosx) { } 0 173 173
elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/mosx) { } 0 173 173
elsif ($char[$i] =~ /\A \\g (?>\s*) ((?>[1-9][0-9]*)) \z/mosx) { } 0 173 173
elsif ($char[$i] =~ /\A \\ (?>\s*) ((?>[1-9][0-9]*)) \z/mosx) { } 0 173 173
elsif ($char[$i] =~ /\A \$ 0 \z/mosx) { } 0 173 173
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/mosx) { } 0 173 173
elsif ($char[$i] =~ /\A \$\$ \z/mosx) { } 0 173 173
elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/mosx) { } 0 173 173
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/mosx) { } 0 173 173
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/mosx) { } 0 173 173
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/mosx) { } 0 173 173
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/mosx) { } 0 173 173
elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/cgmosx) { } 4 169 173
elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/cgmosx) { } 4 165 169
elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/cgmosx) { } 3 162 165
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/mosx) { } 0 162 162
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/mosx) { } 0 162 162
elsif ($char[$i] =~ /\A [\$\@].+ /mosx) { } 4 158 162
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 14 204 218
6067 }
6068  
6069 # join separated multiple-octet
6070 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
6071 0 ▶ if ( ($i+3 <= $#char) and (grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms, @char[$i+1..$i+3]) == 3) and (CORE::eval(sprintf '"%s%s%s%s"', @char[$i..$i+3]) =~ /\A $q_char \z/oxms)) {
Branch: 3 branches
BranchTrueFalseTotal
if ($i + 3 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 3]) == 3 and eval(sprintf '"%s%s%s%s"', @char[$i .. $i + 3]) =~ /\A $Elatin10::q_char \z/mosx) { } 0 0 0
elsif ($i + 2 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 2]) == 2 and eval(sprintf '"%s%s%s"', @char[$i .. $i + 2]) =~ /\A $Elatin10::q_char \z/mosx) { } 0 0 0
elsif ($i + 1 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, $char[$i + 1]) == 1 and eval(sprintf '"%s%s"', @char[$i .. $i + 1]) =~ /\A $Elatin10::q_char \z/mosx) { } 0 0 0
Condition0%0/6
$i + 3 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 3]) == 3 and eval(sprintf "\"%s%s%s%s\"", @char[$i .. $i + 3]) =~ /\A $Elatin10::q_char \z/mosx
!ll&&!rl&&r
000
$i + 3 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 3]) == 3
!ll&&!rl&&r
000
MC/DC0%0/3
$i + 3 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 3]) == 3 and eval(sprintf "\"%s%s%s%s\"", @char[$i .. $i + 3]) =~ /\A $Elatin10::q_char \z/mosx
$i + 3 <= $#char grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 3]) == 3 eval(sprintf "\"%s%s%s%s\"", @char[$i .. $i + 3]) =~ /\A $Elatin10::q_char \z/mosx
Truth table0%0/4
A and B and C
A= $i + 3 <= $#charB= grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 3]) == 3C= eval(sprintf "\"%s%s%s%s\"", @char[$i .. $i + 3]) =~ /\A $Elatin10::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6072 0 $char[$i] .= join '', splice @char, $i+1, 3;
6073 }
6074 ▶ elsif (($i+2 <= $#char) and (grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms, @char[$i+1..$i+2]) == 2) and (CORE::eval(sprintf '"%s%s%s"', @char[$i..$i+2]) =~ /\A $q_char \z/oxms)) {
Condition0%0/6
$i + 2 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 2]) == 2 and eval(sprintf "\"%s%s%s\"", @char[$i .. $i + 2]) =~ /\A $Elatin10::q_char \z/mosx
!ll&&!rl&&r
000
$i + 2 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 2]) == 2
!ll&&!rl&&r
000
MC/DC0%0/3
$i + 2 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 2]) == 2 and eval(sprintf "\"%s%s%s\"", @char[$i .. $i + 2]) =~ /\A $Elatin10::q_char \z/mosx
$i + 2 <= $#char grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 2]) == 2 eval(sprintf "\"%s%s%s\"", @char[$i .. $i + 2]) =~ /\A $Elatin10::q_char \z/mosx
Truth table0%0/4
A and B and C
A= $i + 2 <= $#charB= grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 2]) == 2C= eval(sprintf "\"%s%s%s\"", @char[$i .. $i + 2]) =~ /\A $Elatin10::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6075 0 $char[$i] .= join '', splice @char, $i+1, 2;
6076 }
6077 ▶ elsif (($i+1 <= $#char) and (grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms, $char[$i+1 ]) == 1) and (CORE::eval(sprintf '"%s%s"', @char[$i..$i+1]) =~ /\A $q_char \z/oxms)) {
Condition0%0/6
$i + 1 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, $char[$i + 1]) == 1 and eval(sprintf "\"%s%s\"", @char[$i .. $i + 1]) =~ /\A $Elatin10::q_char \z/mosx
!ll&&!rl&&r
000
$i + 1 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, $char[$i + 1]) == 1
!ll&&!rl&&r
000
MC/DC0%0/3
$i + 1 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, $char[$i + 1]) == 1 and eval(sprintf "\"%s%s\"", @char[$i .. $i + 1]) =~ /\A $Elatin10::q_char \z/mosx
$i + 1 <= $#char grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, $char[$i + 1]) == 1 eval(sprintf "\"%s%s\"", @char[$i .. $i + 1]) =~ /\A $Elatin10::q_char \z/mosx
Truth table0%0/4
A and B and C
A= $i + 1 <= $#charB= grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, $char[$i + 1]) == 1C= eval(sprintf "\"%s%s\"", @char[$i .. $i + 1]) =~ /\A $Elatin10::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6078 0 $char[$i] .= join '', splice @char, $i+1, 1;
6079 }
6080 }
6081  
6082 # open character class [...]
6083 elsif ($char[$i] eq '[') {
6084 17 my $left = $i;
6085 17 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 17 17
6086 0 $i++;
6087 }
6088 17 while (1) {
6089 74 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 74 74
6090 0 die __FILE__, ": Unmatched [] in regexp\n";
6091 }
6092 74 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 17 57 74
6093 17 my $right = $i;
6094  
6095 # [...]
6096 17 ▶ if (grep(/\A [\$\@]/oxms,@char[$left+1..$right-1]) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep(/\A [\$\@]/mosx, @char[$left + 1 .. $right - 1]) >= 1) { } 0 17 17
6097 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin10::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6098 }
6099 else {
6100 17 splice @char, $left, $right-$left+1, Elatin10::charlist_qr(@char[$left+1..$right-1], $modifier);
6101 }
6102  
6103 17 $i = $left;
6104 17 last;
6105 }
6106 }
6107 }
6108  
6109 # open character class [^...]
6110 elsif ($char[$i] eq '[^') {
6111 0 my $left = $i;
6112 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6113 0 $i++;
6114 }
6115 0 while (1) {
6116 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6117 0 die __FILE__, ": Unmatched [] in regexp\n";
6118 }
6119 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6120 0 my $right = $i;
6121  
6122 # [^...]
6123 0 ▶ if (grep(/\A [\$\@]/oxms,@char[$left+1..$right-1]) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep(/\A [\$\@]/mosx, @char[$left + 1 .. $right - 1]) >= 1) { } 0 0 0
6124 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin10::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6125 }
6126 else {
6127 0 splice @char, $left, $right-$left+1, Elatin10::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6128 }
6129  
6130 0 $i = $left;
6131 0 last;
6132 }
6133 }
6134 }
6135  
6136 # rewrite character class or escape character
6137 elsif (my $char = character_class($char[$i],$modifier)) {
6138 7 $char[$i] = $char;
6139 }
6140  
6141 # /i modifier
6142 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin10::uc($char[$i]) ne Elatin10::fc($char[$i]))) {
Condition66%4/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin10::uc($char[$i]) ne &fc($char[$i])
!ll&&!rl&&r
17303
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx
!ll&&!rl&&r
17303
MC/DC33%1/3
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin10::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin10::uc($char[$i]) ne &fc($char[$i])
Truth table50%2/4
A and B and C
A= $ignorecaseB= $char[$i] =~ /\A [\x00-\xFF] \z/mosxC= &Elatin10::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6143 3 ▶ if (CORE::length(Elatin10::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 3 0 3
6144 3 $char[$i] = '[' . Elatin10::uc($char[$i]) . Elatin10::fc($char[$i]) . ']';
6145 }
6146 else {
6147 0 $char[$i] = '(?:' . Elatin10::uc($char[$i]) . '|' . Elatin10::fc($char[$i]) . ')';
6148 }
6149 }
6150  
6151 # \u \l \U \L \F \Q \E
6152 elsif ($char[$i] =~ /\A [<>] \z/oxms) {
6153 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
6154 0 $char[$i] = '\\' . $char[$i];
6155 }
6156 }
6157 elsif ($char[$i] eq '\u') {
6158 0 $char[$i] = '@{[Elatin10::ucfirst qq<';
6159 0 $left_e++;
6160 }
6161 elsif ($char[$i] eq '\l') {
6162 0 $char[$i] = '@{[Elatin10::lcfirst qq<';
6163 0 $left_e++;
6164 }
6165 elsif ($char[$i] eq '\U') {
6166 0 $char[$i] = '@{[Elatin10::uc qq<';
6167 0 $left_e++;
6168 }
6169 elsif ($char[$i] eq '\L') {
6170 0 $char[$i] = '@{[Elatin10::lc qq<';
6171 0 $left_e++;
6172 }
6173 elsif ($char[$i] eq '\F') {
6174 0 $char[$i] = '@{[Elatin10::fc qq<';
6175 0 $left_e++;
6176 }
6177 elsif ($char[$i] eq '\Q') {
6178 0 $char[$i] = '@{[CORE::quotemeta qq<';
6179 0 $left_e++;
6180 }
6181 elsif ($char[$i] eq '\E') {
6182 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
6183 0 $char[$i] = '>]}';
6184 0 $right_e++;
6185 }
6186 else {
6187 0 $char[$i] = '';
6188 }
6189 }
6190 elsif ($char[$i] eq '\Q') {
6191 0 while (1) {
6192 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6193 0 last;
6194 }
6195 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
6196 0 last;
6197 }
6198 }
6199 }
6200 elsif ($char[$i] eq '\E') {
6201 }
6202  
6203 # \0 --> \0
6204 elsif ($char[$i] =~ /\A \\ (?>\s*) 0 \z/oxms) {
6205 }
6206  
6207 # \g{N}, \g{-N}
6208  
6209 # P.108 Using Simple Patterns
6210 # in Chapter 7: In the World of Regular Expressions
6211 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
6212  
6213 # P.221 Capturing
6214 # in Chapter 5: Pattern Matching
6215 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
6216  
6217 # \g{-1}, \g{-2}, \g{-3} --> \g{-1}, \g{-2}, \g{-3}
6218 elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) - (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6219 }
6220  
6221 # \g{1}, \g{2}, \g{3} --> \g{2}, \g{3}, \g{4} (only when multibyte anchoring is enable)
6222 elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6223 }
6224  
6225 # \g1, \g2, \g3 --> \g2, \g3, \g4 (only when multibyte anchoring is enable)
6226 elsif ($char[$i] =~ /\A \\g (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) {
6227 }
6228  
6229 # \1, \2, \3 --> \2, \3, \4 (only when multibyte anchoring is enable)
6230 elsif ($char[$i] =~ /\A \\ (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) {
6231 }
6232  
6233 # $0 --> $0
6234 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
6235 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6236 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
6237 }
6238 }
6239 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
6240 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6241 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
6242 }
6243 }
6244  
6245 # $$ --> $$
6246 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
6247 }
6248  
6249 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
6250 # $1, $2, $3 --> $1, $2, $3 otherwise
6251 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
6252 0 $char[$i] = e_capture($1);
6253 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6254 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
6255 }
6256 }
6257 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6258 0 $char[$i] = e_capture($1);
6259 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6260 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
6261 }
6262 }
6263  
6264 # $$foo[ ... ] --> $ $foo->[ ... ]
6265 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
6266 0 $char[$i] = e_capture($1.'->'.$2);
6267 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6268 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
6269 }
6270 }
6271  
6272 # $$foo{ ... } --> $ $foo->{ ... }
6273 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
6274 0 $char[$i] = e_capture($1.'->'.$2);
6275 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6276 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
6277 }
6278 }
6279  
6280 # $$foo
6281 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
6282 0 $char[$i] = e_capture($1);
6283 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6284 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
6285 }
6286 }
6287  
6288 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin10::PREMATCH()
6289 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
6290 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 4 4
6291 0 $char[$i] = '@{[Elatin10::ignorecase(Elatin10::PREMATCH())]}';
6292 }
6293 else {
6294 4 $char[$i] = '@{[Elatin10::PREMATCH()]}';
6295 }
6296 }
6297  
6298 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin10::MATCH()
6299 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
6300 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 4 4
6301 0 $char[$i] = '@{[Elatin10::ignorecase(Elatin10::MATCH())]}';
6302 }
6303 else {
6304 4 $char[$i] = '@{[Elatin10::MATCH()]}';
6305 }
6306 }
6307  
6308 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin10::POSTMATCH()
6309 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
6310 3 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 3 3
6311 0 $char[$i] = '@{[Elatin10::ignorecase(Elatin10::POSTMATCH())]}';
6312 }
6313 else {
6314 3 $char[$i] = '@{[Elatin10::POSTMATCH()]}';
6315 }
6316 }
6317  
6318 # ${ foo }
6319 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
6320 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6321 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
6322 }
6323 }
6324  
6325 # ${ ... }
6326 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
6327 0 $char[$i] = e_capture($1);
6328 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6329 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
6330 }
6331 }
6332  
6333 # $scalar or @array
6334 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
6335 4 $char[$i] = e_string($char[$i]);
6336 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 4 4
6337 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
6338 }
6339 }
6340  
6341 # quote character before ? + * {
6342 ▶ elsif (($i >= 1) and ($char[$i] =~ /\A [\?\+\*\{] \z/oxms)) {
Condition100%3/3
$i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx
!ll&&!rl&&r
608414
MC/DC100%2/2
$i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx
$i >= 1 $char[$i] =~ /\A [\?\+\*\{] \z/mosx
Truth table100%3/3
A and B
A= $i >= 1B= $char[$i] =~ /\A [\?\+\*\{] \z/mosx
ABresult
0X0
100
111
6343 14 ▶ if ($char[$i-1] =~ /\A (?:[\x00-\xFF]|\\[0-7]{2,3}|\\x[0-9-A-Fa-f]{1,2}) \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i - 1] =~ /\A (?:[\x00-\xFF]|\\[0-7]{2,3}|\\x[0-9-A-Fa-f]{1,2}) \z/mosx) { } 0 14 14
6344 }
6345 else {
6346 14 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6347 }
6348 }
6349 }
6350  
6351 # make regexp string
6352 72 my $prematch = '';
6353 72 $modifier =~ tr/i//d;
6354 72 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 72 72
6355 0 return join '', $ope, $delimiter, $prematch, '(?:', @char, '>]}' x ($left_e - $right_e), ')', $matched, $end_delimiter, $modifier;
6356 }
6357 72 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6358 }
6359  
6360 #
6361 # escape regexp (s'here'' or s'here''b)
6362 #
6363 21 ▶sub e_s1_q {
Subroutine e_s1_q: called CC=7 SCAR=24.3
Pod undocumented
6364 21 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6365 21 ▶ $modifier ||= '';
Condition100%2/2
$modifier ||= ""
l!l
318
MC/DC100%1/1
$modifier ||= ""
$modifier
Truth table100%2/2
A
A= $modifier
Aresult
11
00
6366  
6367 21 $modifier =~ tr/p//d;
6368 21 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 21 21
6369 0 my $line = 0;
6370 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6371 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6372 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6373 0 last;
6374 }
6375 }
6376 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6377 }
6378  
6379 21 $slash = 'div';
6380  
6381 # literal null string pattern
6382 21 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 13 21
elsif ($modifier =~ tr/Bb//d) { } 0 13 13
6383 8 $modifier =~ tr/bB//d;
6384 8 $modifier =~ tr/i//d;
6385 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
6386 }
6387  
6388 # with /b /B modifier
6389 elsif ($modifier =~ tr/bB//d) {
6390 0 return e_s1_qb($ope,$delimiter,$end_delimiter,$string,$modifier);
6391 }
6392  
6393 # without /b /B modifier
6394 else {
6395 13 return e_s1_qt($ope,$delimiter,$end_delimiter,$string,$modifier);
6396 }
6397 }
6398  
6399 #
6400 # escape regexp (s'here'')
6401 #
6402 13 ▶sub e_s1_qt {
Subroutine e_s1_qt: called CC=20 SCAR=50.1
Pod undocumented
6403 13 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6404  
6405 13 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 13 13
6406  
6407 # split regexp
6408 13 my @char = $string =~ /\G((?>
6409 [^\\\[\$\@\/] |
6410 [\x00-\xFF] |
6411 \[\^ |
6412 \[\: (?>[a-z]+) \:\] |
6413 \[\:\^ (?>[a-z]+) \:\] |
6414 [\$\@\/] |
6415 \\ (?:$q_char) |
6416 (?:$q_char)
6417 ))/oxmsg;
6418  
6419 # unescape character
6420 13 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 25 13 38
6421 25 ▶ if (0) {
Branch: 6 branches
BranchTrueFalseTotal
if (do { $char[$i] eq '[' }) { } 0 25 25
elsif ($char[$i] eq '[^') { } 0 25 25
elsif ($char[$i] =~ m(\A [\$\@/\\] \z)mosx) { } 0 25 25
elsif (my $char = character_class($char[$i], $modifier)) { } 6 19 25
elsif ($ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin10::uc($char[$i]) ne &fc($char[$i])) { } 0 19 19
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 32 32
6422 }
6423  
6424 # open character class [...]
6425 elsif ($char[$i] eq '[') {
6426 0 my $left = $i;
6427 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6428 0 $i++;
6429 }
6430 0 while (1) {
6431 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6432 0 die __FILE__, ": Unmatched [] in regexp\n";
6433 }
6434 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6435 0 my $right = $i;
6436  
6437 # [...]
6438 0 splice @char, $left, $right-$left+1, Elatin10::charlist_qr(@char[$left+1..$right-1], $modifier);
6439  
6440 0 $i = $left;
6441 0 last;
6442 }
6443 }
6444 }
6445  
6446 # open character class [^...]
6447 elsif ($char[$i] eq '[^') {
6448 0 my $left = $i;
6449 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6450 0 $i++;
6451 }
6452 0 while (1) {
6453 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6454 0 die __FILE__, ": Unmatched [] in regexp\n";
6455 }
6456 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6457 0 my $right = $i;
6458  
6459 # [^...]
6460 0 splice @char, $left, $right-$left+1, Elatin10::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6461  
6462 0 $i = $left;
6463 0 last;
6464 }
6465 }
6466 }
6467  
6468 # escape $ @ / and \
6469 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6470 0 $char[$i] = '\\' . $char[$i];
6471 }
6472  
6473 # rewrite character class or escape character
6474 elsif (my $char = character_class($char[$i],$modifier)) {
6475 6 $char[$i] = $char;
6476 }
6477  
6478 # /i modifier
6479 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin10::uc($char[$i]) ne Elatin10::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin10::uc($char[$i]) ne &fc($char[$i])
!ll&&!rl&&r
1900
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx
!ll&&!rl&&r
1900
MC/DC0%0/3
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin10::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin10::uc($char[$i]) ne &fc($char[$i])
Truth table25%1/4
A and B and C
A= $ignorecaseB= $char[$i] =~ /\A [\x00-\xFF] \z/mosxC= &Elatin10::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6480 0 ▶ if (CORE::length(Elatin10::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
6481 0 $char[$i] = '[' . Elatin10::uc($char[$i]) . Elatin10::fc($char[$i]) . ']';
6482 }
6483 else {
6484 0 $char[$i] = '(?:' . Elatin10::uc($char[$i]) . '|' . Elatin10::fc($char[$i]) . ')';
6485 }
6486 }
6487  
6488 # quote character before ? + * {
6489 ▶ elsif (($i >= 1) and ($char[$i] =~ /\A [\?\+\*\{] \z/oxms)) {
Condition66%2/3
$i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx
!ll&&!rl&&r
1360
MC/DC0%0/2
$i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx
$i >= 1 $char[$i] =~ /\A [\?\+\*\{] \z/mosx
Truth table66%2/3
A and B
A= $i >= 1B= $char[$i] =~ /\A [\?\+\*\{] \z/mosx
ABresult
0X0
100
111
6490 0 ▶ if ($char[$i-1] =~ /\A [\x00-\xFF] \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i - 1] =~ /\A [\x00-\xFF] \z/mosx) { } 0 0 0
6491 }
6492 else {
6493 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6494 }
6495 }
6496 }
6497  
6498 13 $modifier =~ tr/i//d;
6499 13 $delimiter = '/';
6500 13 $end_delimiter = '/';
6501 13 my $prematch = '';
6502 13 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6503 }
6504  
6505 #
6506 # escape regexp (s'here''b)
6507 #
6508 0 ▶sub e_s1_qb {
Subroutine e_s1_qb: not called CC=4 SCAR=30.0
Pod undocumented
6509 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6510  
6511 # split regexp
6512 0 my @char = $string =~ /\G (?>[^\\]|\\\\) /oxmsg;
6513  
6514 # unescape character
6515 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
6516 0 ▶ if (0) {
Branch: 2 branches
BranchTrueFalseTotal
if (do { $char[$i] eq '\\\\' }) { } 0 0 0
elsif ($char[$i] =~ m(\A [\$\@/\\] \z)mosx) { } 0 0 0
6517 }
6518  
6519 # remain \\
6520 elsif ($char[$i] eq '\\\\') {
6521 }
6522  
6523 # escape $ @ / and \
6524 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6525 0 $char[$i] = '\\' . $char[$i];
6526 }
6527 }
6528  
6529 0 $delimiter = '/';
6530 0 $end_delimiter = '/';
6531 0 my $prematch = '';
6532 0 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6533 }
6534  
6535 #
6536 # escape regexp (s''here')
6537 #
6538 16 ▶sub e_s2_q {
Subroutine e_s2_q: called CC=4 SCAR=13.9
Pod undocumented
6539 16 my($ope,$delimiter,$end_delimiter,$string) = @_;
6540  
6541 16 $slash = 'div';
6542  
6543 16 my @char = $string =~ / \G (?>[^\\]|\\\\|$q_char) /oxmsg;
6544 16 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 9 16 25
6545 9 ▶ if (0) {
Branch: 2 branches
BranchTrueFalseTotal
if (do { $char[$i] =~ /\A \\\\ \z/mosx }) { } 1 8 9
elsif ($char[$i] =~ m(\A [\$\@/\\] \z)mosx) { } 5 3 8
6546 }
6547  
6548 # not escape \\
6549 elsif ($char[$i] =~ /\A \\\\ \z/oxms) {
6550 }
6551  
6552 # escape $ @ / and \
6553 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6554 5 $char[$i] = '\\' . $char[$i];
6555 }
6556 }
6557  
6558 16 return join '', $ope, $delimiter, @char, $end_delimiter;
6559 }
6560  
6561 #
6562 # escape regexp (s/here/and here/modifier)
6563 #
6564 101 ▶sub e_sub {
Subroutine e_sub: called CC=20 SCAR=32.6
Pod undocumented
6565 101 my($variable,$delimiter1,$pattern,$end_delimiter1,$delimiter2,$replacement,$end_delimiter2,$modifier) = @_;
6566 101 ▶ $modifier ||= '';
Condition100%2/2
$modifier ||= ""
l!l
4556
MC/DC100%1/1
$modifier ||= ""
$modifier
Truth table100%2/2
A
A= $modifier
Aresult
11
00
6567  
6568 101 $modifier =~ tr/p//d;
6569 101 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 101 101
6570 0 my $line = 0;
6571 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6572 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6573 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6574 0 last;
6575 }
6576 }
6577 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6578 }
6579  
6580 101 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq "") 36 65 101
6581 36 $variable = '$_';
6582 36 $bind_operator = ' =~ ';
6583 }
6584  
6585 101 $slash = 'div';
6586  
6587 # P.128 Start of match (or end of previous match): \G
6588 # P.130 Advanced Use of \G with Perl
6589 # in Chapter 3: Overview of Regular Expression Features and Flavors
6590 # P.312 Iterative Matching: Scalar Context, with /g
6591 # in Chapter 7: Perl
6592 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
6593  
6594 # P.181 Where You Left Off: The \G Assertion
6595 # in Chapter 5: Pattern Matching
6596 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
6597  
6598 # P.220 Where You Left Off: The \G Assertion
6599 # in Chapter 5: Pattern Matching
6600 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
6601  
6602 101 my $e_modifier = $modifier =~ tr/e//d;
6603 101 my $r_modifier = $modifier =~ tr/r//d;
6604  
6605 101 my $my = '';
6606 101 ▶ if ($variable =~ s/\A \( (?>\s*) ( (?>(?: local \b | my \b | our \b | state \b )?) .+ ) \) \z/$1/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable =~ s/\A \( (?>\s*) ( (?>(?: local \b | my \b | our \b | state \b )?) .+ ) \) \z/$1/mosx) 0 101 101
6607 0 $my = $variable;
6608 0 $variable =~ s/ (?: local \b | my \b | our \b | state \b ) (?>\s*) //oxms;
6609 0 $variable =~ s/ = .+ \z//oxms;
6610 }
6611  
6612 101 (my $variable_basename = $variable) =~ s/ [\[\{].* \z//oxms;
6613 101 $variable_basename =~ s/ \s+ \z//oxms;
6614  
6615 # quote replacement string
6616 101 my $e_replacement = '';
6617 101 ▶ if ($e_modifier >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($e_modifier >= 1) { } 17 84 101
6618 17 $e_replacement = e_qq('', '', '', $replacement);
6619 17 $e_modifier--;
6620 }
6621 else {
6622 84 ▶ if ($delimiter2 eq "'") {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter2 eq q[']) { } 16 68 84
6623 16 $e_replacement = e_s2_q('qq', '/', '/', $replacement);
6624 }
6625 else {
6626 68 $e_replacement = e_qq ('qq', $delimiter2, $end_delimiter2, $replacement);
6627 }
6628 }
6629  
6630 101 my $sub = '';
6631  
6632 # with /r
6633 101 ▶ if ($r_modifier) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r_modifier) { } 10 91 101
6634 10 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $modifier =~ /g/mosx }) { } 5 5 10
6635 }
6636  
6637 # s///gr without multibyte anchoring
6638 elsif ($modifier =~ /g/oxms) {
6639 5 ▶ $sub = sprintf(
Branch: 1 branch
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 0 5 5
6640 # 1 2 3 4 5
6641 q<CORE::eval{local $Elatin10::re_t=%s; while($Elatin10::re_t =~ %s){%s local $^W=0; local $Elatin10::re_r=%s; %s$Elatin10::re_t="$`$Elatin10::re_r$'"; pos($Elatin10::re_t)=length "$`$Elatin10::re_r"; } return $Elatin10::re_t}>,
6642  
6643 $variable, # 1
6644 ($delimiter1 eq "'") ? # 2
6645 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
6646 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
6647 $s_matched, # 3
6648 $e_replacement, # 4
6649 '$Elatin10::re_r=CORE::eval $Elatin10::re_r; ' x $e_modifier, # 5
6650 );
6651 }
6652  
6653 # s///r
6654 else {
6655  
6656 5 my $prematch = q{$`};
6657  
6658 5 ▶ $sub = sprintf(
Branch: 1 branch
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 0 5 5
6659 # 1 2 3 4 5 6 7
6660 q<(%s =~ %s) ? CORE::eval{%s local $^W=0; local $Elatin10::re_r=%s; %s"%s$Elatin10::re_r$'" } : %s>,
6661  
6662 $variable, # 1
6663 ($delimiter1 eq "'") ? # 2
6664 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
6665 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
6666 $s_matched, # 3
6667 $e_replacement, # 4
6668 '$Elatin10::re_r=CORE::eval $Elatin10::re_r; ' x $e_modifier, # 5
6669 $prematch, # 6
6670 $variable, # 7
6671 );
6672 }
6673  
6674 # $var !~ s///r doesn't make sense
6675 10 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) 0 10 10
6676 0 $sub = q{die("$0: Using !~ with s///r doesn't make sense"), } . $sub;
6677 }
6678 }
6679  
6680 # without /r
6681 else {
6682 91 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $modifier =~ /g/mosx }) { } 23 68 91
6683 }
6684  
6685 # s///g without multibyte anchoring
6686 elsif ($modifier =~ /g/oxms) {
6687 23 ▶ $sub = sprintf(
Branch: 2 branches
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 3 20 23
$bind_operator =~ / !~ /mosx ? : 3 20 23
6688 # 1 2 3 4 5 6 7 8
6689 q<CORE::eval{local $Elatin10::re_n=0; while(%s =~ %s){%s local $^W=0; local $Elatin10::re_r=%s; %s%s="$`$Elatin10::re_r$'"; pos(%s)=length "$`$Elatin10::re_r"; $Elatin10::re_n++} return %s$Elatin10::re_n}>,
6690  
6691 $variable, # 1
6692 ($delimiter1 eq "'") ? # 2
6693 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
6694 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
6695 $s_matched, # 3
6696 $e_replacement, # 4
6697 '$Elatin10::re_r=CORE::eval $Elatin10::re_r; ' x $e_modifier, # 5
6698 $variable, # 6
6699 $variable, # 7
6700 ($bind_operator =~ / !~ /oxms) ? '!' : '', # 8
6701 );
6702 }
6703  
6704 # s///
6705 else {
6706  
6707 68 my $prematch = q{$`};
6708  
6709 68 ▶ $sub = sprintf(
Branch: 2 branches
BranchTrueFalseTotal
$bind_operator =~ / =~ /mosx ? : 65 3 68
$delimiter1 eq q['] ? : 18 50 68
6710  
6711 ($bind_operator =~ / =~ /oxms) ?
6712  
6713 # 1 2 3 4 5 6 7 8
6714 q<(%s%s%s) ? CORE::eval{%s local $^W=0; local $Elatin10::re_r=%s; %s%s="%s$Elatin10::re_r$'"; 1 } : undef> :
6715  
6716 # 1 2 3 4 5 6 7 8
6717 q<(%s%s%s) ? 1 : CORE::eval{%s local $^W=0; local $Elatin10::re_r=%s; %s%s="%s$Elatin10::re_r$'"; undef }>,
6718  
6719 $variable, # 1
6720 $bind_operator, # 2
6721 ($delimiter1 eq "'") ? # 3
6722 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
6723 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
6724 $s_matched, # 4
6725 $e_replacement, # 5
6726 '$Elatin10::re_r=CORE::eval $Elatin10::re_r; ' x $e_modifier, # 6
6727 $variable, # 7
6728 $prematch, # 8
6729 );
6730 }
6731 }
6732  
6733 # (my $foo = $bar) =~ s/// --> (my $foo = $bar, CORE::eval { ... })[1]
6734 101 ▶ if ($my ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($my ne "") 0 101 101
6735 0 $sub = "($my, $sub)[1]";
6736 }
6737  
6738 # clear s/// variable
6739 101 $sub_variable = '';
6740 101 $bind_operator = '';
6741  
6742 101 return $sub;
6743 }
6744  
6745 #
6746 # escape regexp of split qr//
6747 #
6748 74 ▶sub e_split {
Subroutine e_split: called CC=88 SCAR=76.4
Pod undocumented
6749 74 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6750 74 ▶ $modifier ||= '';
Condition100%2/2
$modifier ||= ""
l!l
767
MC/DC100%1/1
$modifier ||= ""
$modifier
Truth table100%2/2
A
A= $modifier
Aresult
11
00
6751  
6752 74 $modifier =~ tr/p//d;
6753 74 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 74 74
6754 0 my $line = 0;
6755 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6756 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6757 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6758 0 last;
6759 }
6760 }
6761 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6762 }
6763  
6764 74 $slash = 'div';
6765  
6766 # /b /B modifier
6767 74 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) 0 74 74
6768 0 return join '', 'split', $ope, $delimiter, $string, $end_delimiter, $modifier;
6769 }
6770  
6771 74 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 74 74
6772 74 my $metachar = qr/[\@\\|[\]{^]/oxms;
6773  
6774 # split regexp
6775 74 my @char = $string =~ /\G((?>
6776 [^\\\$\@\[\(] |
6777 \\x (?>[0-9A-Fa-f]{1,2}) |
6778 \\ (?>[0-7]{2,3}) |
6779 \\c [\x40-\x5F] |
6780 \\x\{ (?>[0-9A-Fa-f]+) \} |
6781 \\o\{ (?>[0-7]+) \} |
6782 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
6783 \\ $q_char |
6784 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
6785 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
6786 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
6787 [\$\@] $qq_variable |
6788 \$ (?>\s* [0-9]+) |
6789 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
6790 \$ \$ (?![\w\{]) |
6791 \$ (?>\s*) \$ (?>\s*) $qq_variable |
6792 \[\^ |
6793 \[\: (?>[a-z]+) :\] |
6794 \[\:\^ (?>[a-z]+) :\] |
6795 \(\? |
6796 $q_char
6797 ))/oxmsg;
6798  
6799 74 my $left_e = 0;
6800 74 my $right_e = 0;
6801 74 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 249 74 323
6802  
6803 # "\L\u" --> "\u\L"
6804 249 ▶ if (($char[$i] eq '\L') and ($char[$i+1] eq '\u')) {
Branch: 6 branches
BranchTrueFalseTotal
if ($char[$i] eq '\\L' and $char[$i + 1] eq '\\u') { } 0 249 249
elsif ($char[$i] eq '\\U' and $char[$i + 1] eq '\\l') { } 0 249 249
elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/mosx) { } 1 248 249
elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/mosx) { } 1 247 248
elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/mosx) { } 0 247 247
elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/mosx) { } 0 247 247
Condition33%1/3
$char[$i] eq "\\L" and $char[$i + 1] eq "\\u"
!ll&&!rl&&r
24900
MC/DC0%0/2
$char[$i] eq "\\L" and $char[$i + 1] eq "\\u"
$char[$i] eq "\\L" $char[$i + 1] eq "\\u"
Truth table33%1/3
A and B
A= $char[$i] eq "\\L"B= $char[$i + 1] eq "\\u"
ABresult
0X0
100
111
6805 0 @char[$i,$i+1] = @char[$i+1,$i];
6806 }
6807  
6808 # "\U\l" --> "\l\U"
6809 ▶ elsif (($char[$i] eq '\U') and ($char[$i+1] eq '\l')) {
Condition33%1/3
$char[$i] eq "\\U" and $char[$i + 1] eq "\\l"
!ll&&!rl&&r
24900
MC/DC0%0/2
$char[$i] eq "\\U" and $char[$i + 1] eq "\\l"
$char[$i] eq "\\U" $char[$i + 1] eq "\\l"
Truth table33%1/3
A and B
A= $char[$i] eq "\\U"B= $char[$i + 1] eq "\\l"
ABresult
0X0
100
111
6810 0 @char[$i,$i+1] = @char[$i+1,$i];
6811 }
6812  
6813 # octal escape sequence
6814 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
6815 1 $char[$i] = Elatin10::octchr($1);
6816 }
6817  
6818 # hexadecimal escape sequence
6819 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
6820 1 $char[$i] = Elatin10::hexchr($1);
6821 }
6822  
6823 # \b{...} --> b\{...}
6824 # \B{...} --> B\{...}
6825 # \N{CHARNAME} --> N\{CHARNAME}
6826 # \p{PROPERTY} --> p\{PROPERTY}
6827 # \P{PROPERTY} --> P\{PROPERTY}
6828 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
6829 0 $char[$i] = $1 . '\\' . $2;
6830 }
6831  
6832 # \p, \P, \X --> p, P, X
6833 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
6834 0 $char[$i] = $1;
6835 }
6836  
6837 249 ▶ if (0) {
Branch: 31 branches
BranchTrueFalseTotal
if (do { $char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx }) { } 0 249 249
elsif ($char[$i] eq '[') { } 3 246 249
elsif ($char[$i] eq '[^') { } 0 246 246
elsif (my $char = character_class($char[$i], $modifier)) { } 1 245 246
elsif ($char[$i] eq '^' and not $modifier =~ /m/mosx) { } 7 238 245
elsif ($ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin10::uc($char[$i]) ne &fc($char[$i])) { } 0 238 238
elsif ($char[$i] =~ /\A ([<>]) \z/mosx) { } 0 238 238
elsif ($char[$i] eq '\\u') { } 0 238 238
elsif ($char[$i] eq '\\l') { } 0 238 238
elsif ($char[$i] eq '\\U') { } 0 238 238
elsif ($char[$i] eq '\\L') { } 0 238 238
elsif ($char[$i] eq '\\F') { } 0 238 238
elsif ($char[$i] eq '\\Q') { } 0 238 238
elsif ($char[$i] eq '\\E') { } 0 238 238
elsif ($char[$i] eq '\\Q') { } 0 238 238
elsif ($char[$i] eq '\\E') { } 0 238 238
elsif ($char[$i] =~ /\A \$ 0 \z/mosx) { } 0 238 238
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/mosx) { } 0 238 238
elsif ($char[$i] =~ /\A \$\$ \z/mosx) { } 0 238 238
elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/mosx) { } 0 238 238
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/mosx) { } 0 238 238
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/mosx) { } 0 238 238
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/mosx) { } 0 238 238
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/mosx) { } 0 238 238
elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/cgmosx) { } 12 226 238
elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/cgmosx) { } 12 214 226
elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/cgmosx) { } 9 205 214
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/mosx) { } 0 205 205
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/mosx) { } 0 205 205
elsif ($char[$i] =~ /\A [\$\@].+ /mosx) { } 3 202 205
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 1 234 235
6838 }
6839  
6840 # join separated multiple-octet
6841 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
6842 0 ▶ if ( ($i+3 <= $#char) and (grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms, @char[$i+1..$i+3]) == 3) and (CORE::eval(sprintf '"%s%s%s%s"', @char[$i..$i+3]) =~ /\A $q_char \z/oxms)) {
Branch: 3 branches
BranchTrueFalseTotal
if ($i + 3 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 3]) == 3 and eval(sprintf '"%s%s%s%s"', @char[$i .. $i + 3]) =~ /\A $Elatin10::q_char \z/mosx) { } 0 0 0
elsif ($i + 2 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 2]) == 2 and eval(sprintf '"%s%s%s"', @char[$i .. $i + 2]) =~ /\A $Elatin10::q_char \z/mosx) { } 0 0 0
elsif ($i + 1 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, $char[$i + 1]) == 1 and eval(sprintf '"%s%s"', @char[$i .. $i + 1]) =~ /\A $Elatin10::q_char \z/mosx) { } 0 0 0
Condition0%0/6
$i + 3 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 3]) == 3 and eval(sprintf "\"%s%s%s%s\"", @char[$i .. $i + 3]) =~ /\A $Elatin10::q_char \z/mosx
!ll&&!rl&&r
000
$i + 3 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 3]) == 3
!ll&&!rl&&r
000
MC/DC0%0/3
$i + 3 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 3]) == 3 and eval(sprintf "\"%s%s%s%s\"", @char[$i .. $i + 3]) =~ /\A $Elatin10::q_char \z/mosx
$i + 3 <= $#char grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 3]) == 3 eval(sprintf "\"%s%s%s%s\"", @char[$i .. $i + 3]) =~ /\A $Elatin10::q_char \z/mosx
Truth table0%0/4
A and B and C
A= $i + 3 <= $#charB= grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 3]) == 3C= eval(sprintf "\"%s%s%s%s\"", @char[$i .. $i + 3]) =~ /\A $Elatin10::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6843 0 $char[$i] .= join '', splice @char, $i+1, 3;
6844 }
6845 ▶ elsif (($i+2 <= $#char) and (grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms, @char[$i+1..$i+2]) == 2) and (CORE::eval(sprintf '"%s%s%s"', @char[$i..$i+2]) =~ /\A $q_char \z/oxms)) {
Condition0%0/6
$i + 2 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 2]) == 2 and eval(sprintf "\"%s%s%s\"", @char[$i .. $i + 2]) =~ /\A $Elatin10::q_char \z/mosx
!ll&&!rl&&r
000
$i + 2 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 2]) == 2
!ll&&!rl&&r
000
MC/DC0%0/3
$i + 2 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 2]) == 2 and eval(sprintf "\"%s%s%s\"", @char[$i .. $i + 2]) =~ /\A $Elatin10::q_char \z/mosx
$i + 2 <= $#char grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 2]) == 2 eval(sprintf "\"%s%s%s\"", @char[$i .. $i + 2]) =~ /\A $Elatin10::q_char \z/mosx
Truth table0%0/4
A and B and C
A= $i + 2 <= $#charB= grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 2]) == 2C= eval(sprintf "\"%s%s%s\"", @char[$i .. $i + 2]) =~ /\A $Elatin10::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6846 0 $char[$i] .= join '', splice @char, $i+1, 2;
6847 }
6848 ▶ elsif (($i+1 <= $#char) and (grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms, $char[$i+1 ]) == 1) and (CORE::eval(sprintf '"%s%s"', @char[$i..$i+1]) =~ /\A $q_char \z/oxms)) {
Condition0%0/6
$i + 1 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, $char[$i + 1]) == 1 and eval(sprintf "\"%s%s\"", @char[$i .. $i + 1]) =~ /\A $Elatin10::q_char \z/mosx
!ll&&!rl&&r
000
$i + 1 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, $char[$i + 1]) == 1
!ll&&!rl&&r
000
MC/DC0%0/3
$i + 1 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, $char[$i + 1]) == 1 and eval(sprintf "\"%s%s\"", @char[$i .. $i + 1]) =~ /\A $Elatin10::q_char \z/mosx
$i + 1 <= $#char grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, $char[$i + 1]) == 1 eval(sprintf "\"%s%s\"", @char[$i .. $i + 1]) =~ /\A $Elatin10::q_char \z/mosx
Truth table0%0/4
A and B and C
A= $i + 1 <= $#charB= grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, $char[$i + 1]) == 1C= eval(sprintf "\"%s%s\"", @char[$i .. $i + 1]) =~ /\A $Elatin10::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6849 0 $char[$i] .= join '', splice @char, $i+1, 1;
6850 }
6851 }
6852  
6853 # open character class [...]
6854 elsif ($char[$i] eq '[') {
6855 3 my $left = $i;
6856 3 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 3 3
6857 0 $i++;
6858 }
6859 3 while (1) {
6860 7 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 7 7
6861 0 die __FILE__, ": Unmatched [] in regexp\n";
6862 }
6863 7 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 3 4 7
6864 3 my $right = $i;
6865  
6866 # [...]
6867 3 ▶ if (grep(/\A [\$\@]/oxms,@char[$left+1..$right-1]) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep(/\A [\$\@]/mosx, @char[$left + 1 .. $right - 1]) >= 1) { } 0 3 3
6868 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin10::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6869 }
6870 else {
6871 3 splice @char, $left, $right-$left+1, Elatin10::charlist_qr(@char[$left+1..$right-1], $modifier);
6872 }
6873  
6874 3 $i = $left;
6875 3 last;
6876 }
6877 }
6878 }
6879  
6880 # open character class [^...]
6881 elsif ($char[$i] eq '[^') {
6882 0 my $left = $i;
6883 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6884 0 $i++;
6885 }
6886 0 while (1) {
6887 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6888 0 die __FILE__, ": Unmatched [] in regexp\n";
6889 }
6890 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6891 0 my $right = $i;
6892  
6893 # [^...]
6894 0 ▶ if (grep(/\A [\$\@]/oxms,@char[$left+1..$right-1]) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep(/\A [\$\@]/mosx, @char[$left + 1 .. $right - 1]) >= 1) { } 0 0 0
6895 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin10::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6896 }
6897 else {
6898 0 splice @char, $left, $right-$left+1, Elatin10::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6899 }
6900  
6901 0 $i = $left;
6902 0 last;
6903 }
6904 }
6905 }
6906  
6907 # rewrite character class or escape character
6908 elsif (my $char = character_class($char[$i],$modifier)) {
6909 1 $char[$i] = $char;
6910 }
6911  
6912 # P.794 29.2.161. split
6913 # in Chapter 29: Functions
6914 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
6915  
6916 # P.951 split
6917 # in Chapter 27: Functions
6918 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
6919  
6920 # said "The //m modifier is assumed when you split on the pattern /^/",
6921 # but perl5.008 is not so. Therefore, this software adds //m.
6922 # (and so on)
6923  
6924 # split(m/^/) --> split(m/^/m)
6925 ▶ elsif (($char[$i] eq '^') and ($modifier !~ /m/oxms)) {
Condition100%3/3
$char[$i] eq "^" and not $modifier =~ /m/mosx
!ll&&!rl&&r
23627
MC/DC100%2/2
$char[$i] eq "^" and not $modifier =~ /m/mosx
$char[$i] eq "^" not $modifier =~ /m/mosx
Truth table100%3/3
A and not(B)
A= $char[$i] eq "^"B= not $modifier =~ /m/mosx
ABresult
0X0
100
111
6926 7 $modifier .= 'm';
6927 }
6928  
6929 # /i modifier
6930 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin10::uc($char[$i]) ne Elatin10::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin10::uc($char[$i]) ne &fc($char[$i])
!ll&&!rl&&r
23800
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx
!ll&&!rl&&r
23800
MC/DC0%0/3
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin10::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin10::uc($char[$i]) ne &fc($char[$i])
Truth table25%1/4
A and B and C
A= $ignorecaseB= $char[$i] =~ /\A [\x00-\xFF] \z/mosxC= &Elatin10::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6931 0 ▶ if (CORE::length(Elatin10::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
6932 0 $char[$i] = '[' . Elatin10::uc($char[$i]) . Elatin10::fc($char[$i]) . ']';
6933 }
6934 else {
6935 0 $char[$i] = '(?:' . Elatin10::uc($char[$i]) . '|' . Elatin10::fc($char[$i]) . ')';
6936 }
6937 }
6938  
6939 # \u \l \U \L \F \Q \E
6940 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
6941 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
6942 0 $char[$i] = '\\' . $char[$i];
6943 }
6944 }
6945 elsif ($char[$i] eq '\u') {
6946 0 $char[$i] = '@{[Elatin10::ucfirst qq<';
6947 0 $left_e++;
6948 }
6949 elsif ($char[$i] eq '\l') {
6950 0 $char[$i] = '@{[Elatin10::lcfirst qq<';
6951 0 $left_e++;
6952 }
6953 elsif ($char[$i] eq '\U') {
6954 0 $char[$i] = '@{[Elatin10::uc qq<';
6955 0 $left_e++;
6956 }
6957 elsif ($char[$i] eq '\L') {
6958 0 $char[$i] = '@{[Elatin10::lc qq<';
6959 0 $left_e++;
6960 }
6961 elsif ($char[$i] eq '\F') {
6962 0 $char[$i] = '@{[Elatin10::fc qq<';
6963 0 $left_e++;
6964 }
6965 elsif ($char[$i] eq '\Q') {
6966 0 $char[$i] = '@{[CORE::quotemeta qq<';
6967 0 $left_e++;
6968 }
6969 elsif ($char[$i] eq '\E') {
6970 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
6971 0 $char[$i] = '>]}';
6972 0 $right_e++;
6973 }
6974 else {
6975 0 $char[$i] = '';
6976 }
6977 }
6978 elsif ($char[$i] eq '\Q') {
6979 0 while (1) {
6980 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6981 0 last;
6982 }
6983 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
6984 0 last;
6985 }
6986 }
6987 }
6988 elsif ($char[$i] eq '\E') {
6989 }
6990  
6991 # $0 --> $0
6992 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
6993 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6994 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
6995 }
6996 }
6997 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
6998 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6999 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
7000 }
7001 }
7002  
7003 # $$ --> $$
7004 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
7005 }
7006  
7007 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
7008 # $1, $2, $3 --> $1, $2, $3 otherwise
7009 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
7010 0 $char[$i] = e_capture($1);
7011 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7012 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
7013 }
7014 }
7015 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
7016 0 $char[$i] = e_capture($1);
7017 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7018 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
7019 }
7020 }
7021  
7022 # $$foo[ ... ] --> $ $foo->[ ... ]
7023 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
7024 0 $char[$i] = e_capture($1.'->'.$2);
7025 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7026 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
7027 }
7028 }
7029  
7030 # $$foo{ ... } --> $ $foo->{ ... }
7031 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
7032 0 $char[$i] = e_capture($1.'->'.$2);
7033 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7034 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
7035 }
7036 }
7037  
7038 # $$foo
7039 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
7040 0 $char[$i] = e_capture($1);
7041 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7042 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
7043 }
7044 }
7045  
7046 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin10::PREMATCH()
7047 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
7048 12 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 12 12
7049 0 $char[$i] = '@{[Elatin10::ignorecase(Elatin10::PREMATCH())]}';
7050 }
7051 else {
7052 12 $char[$i] = '@{[Elatin10::PREMATCH()]}';
7053 }
7054 }
7055  
7056 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin10::MATCH()
7057 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
7058 12 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 12 12
7059 0 $char[$i] = '@{[Elatin10::ignorecase(Elatin10::MATCH())]}';
7060 }
7061 else {
7062 12 $char[$i] = '@{[Elatin10::MATCH()]}';
7063 }
7064 }
7065  
7066 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin10::POSTMATCH()
7067 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
7068 9 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 9 9
7069 0 $char[$i] = '@{[Elatin10::ignorecase(Elatin10::POSTMATCH())]}';
7070 }
7071 else {
7072 9 $char[$i] = '@{[Elatin10::POSTMATCH()]}';
7073 }
7074 }
7075  
7076 # ${ foo }
7077 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
7078 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7079 0 $char[$i] = '@{[Elatin10::ignorecase(' . $1 . ')]}';
7080 }
7081 }
7082  
7083 # ${ ... }
7084 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
7085 0 $char[$i] = e_capture($1);
7086 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7087 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
7088 }
7089 }
7090  
7091 # $scalar or @array
7092 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
7093 3 $char[$i] = e_string($char[$i]);
7094 3 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 3 3
7095 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
7096 }
7097 }
7098  
7099 # quote character before ? + * {
7100 ▶ elsif (($i >= 1) and ($char[$i] =~ /\A [\?\+\*\{] \z/oxms)) {
Condition100%3/3
$i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx
!ll&&!rl&&r
331681
MC/DC100%2/2
$i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx
$i >= 1 $char[$i] =~ /\A [\?\+\*\{] \z/mosx
Truth table100%3/3
A and B
A= $i >= 1B= $char[$i] =~ /\A [\?\+\*\{] \z/mosx
ABresult
0X0
100
111
7101 1 ▶ if ($char[$i-1] =~ /\A (?:[\x00-\xFF]|\\[0-7]{2,3}|\\x[0-9-A-Fa-f]{1,2}) \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i - 1] =~ /\A (?:[\x00-\xFF]|\\[0-7]{2,3}|\\x[0-9-A-Fa-f]{1,2}) \z/mosx) { } 1 0 1
7102 }
7103 else {
7104 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
7105 }
7106 }
7107 }
7108  
7109 # make regexp string
7110 74 $modifier =~ tr/i//d;
7111 74 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 74 74
7112 0 return join '', 'Elatin10::split', $ope, $delimiter, @char, '>]}' x ($left_e - $right_e), $end_delimiter, $modifier;
7113 }
7114 74 return join '', 'Elatin10::split', $ope, $delimiter, @char, $end_delimiter, $modifier;
7115 }
7116  
7117 #
7118 # escape regexp of split qr''
7119 #
7120 0 ▶sub e_split_q {
Subroutine e_split_q: not called CC=26 SCAR=65.5
Pod undocumented
7121 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
7122 0 ▶ $modifier ||= '';
Condition0%0/2
$modifier ||= ""
l!l
00
MC/DC0%0/1
$modifier ||= ""
$modifier
Truth table0%0/2
A
A= $modifier
Aresult
11
00
7123  
7124 0 $modifier =~ tr/p//d;
7125 0 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 0 0
7126 0 my $line = 0;
7127 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7128 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
7129 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
7130 0 last;
7131 }
7132 }
7133 0 die qq{Unsupported modifier "$1" used at line $line.\n};
7134 }
7135  
7136 0 $slash = 'div';
7137  
7138 # /b /B modifier
7139 0 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) 0 0 0
7140 0 return join '', 'split', $ope, $delimiter, $string, $end_delimiter, $modifier;
7141 }
7142  
7143 0 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 0 0
7144  
7145 # split regexp
7146 0 my @char = $string =~ /\G((?>
7147 [^\\\[] |
7148 [\x00-\xFF] |
7149 \[\^ |
7150 \[\: (?>[a-z]+) \:\] |
7151 \[\:\^ (?>[a-z]+) \:\] |
7152 \\ (?:$q_char) |
7153 (?:$q_char)
7154 ))/oxmsg;
7155  
7156 # unescape character
7157 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
7158 0 ▶ if (0) {
Branch: 6 branches
BranchTrueFalseTotal
if (do { $char[$i] eq '[' }) { } 0 0 0
elsif ($char[$i] eq '[^') { } 0 0 0
elsif (my $char = character_class($char[$i], $modifier)) { } 0 0 0
elsif ($char[$i] eq '^' and not $modifier =~ /m/mosx) { } 0 0 0
elsif ($ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin10::uc($char[$i]) ne &fc($char[$i])) { } 0 0 0
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 0 0
7159 }
7160  
7161 # open character class [...]
7162 elsif ($char[$i] eq '[') {
7163 0 my $left = $i;
7164 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7165 0 $i++;
7166 }
7167 0 while (1) {
7168 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7169 0 die __FILE__, ": Unmatched [] in regexp\n";
7170 }
7171 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7172 0 my $right = $i;
7173  
7174 # [...]
7175 0 splice @char, $left, $right-$left+1, Elatin10::charlist_qr(@char[$left+1..$right-1], $modifier);
7176  
7177 0 $i = $left;
7178 0 last;
7179 }
7180 }
7181 }
7182  
7183 # open character class [^...]
7184 elsif ($char[$i] eq '[^') {
7185 0 my $left = $i;
7186 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7187 0 $i++;
7188 }
7189 0 while (1) {
7190 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7191 0 die __FILE__, ": Unmatched [] in regexp\n";
7192 }
7193 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7194 0 my $right = $i;
7195  
7196 # [^...]
7197 0 splice @char, $left, $right-$left+1, Elatin10::charlist_not_qr(@char[$left+1..$right-1], $modifier);
7198  
7199 0 $i = $left;
7200 0 last;
7201 }
7202 }
7203 }
7204  
7205 # rewrite character class or escape character
7206 elsif (my $char = character_class($char[$i],$modifier)) {
7207 0 $char[$i] = $char;
7208 }
7209  
7210 # split(m/^/) --> split(m/^/m)
7211 ▶ elsif (($char[$i] eq '^') and ($modifier !~ /m/oxms)) {
Condition0%0/3
$char[$i] eq "^" and not $modifier =~ /m/mosx
!ll&&!rl&&r
000
MC/DC0%0/2
$char[$i] eq "^" and not $modifier =~ /m/mosx
$char[$i] eq "^" not $modifier =~ /m/mosx
Truth table0%0/3
A and not(B)
A= $char[$i] eq "^"B= not $modifier =~ /m/mosx
ABresult
0X0
100
111
7212 0 $modifier .= 'm';
7213 }
7214  
7215 # /i modifier
7216 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin10::uc($char[$i]) ne Elatin10::fc($char[$i]))) {
Condition0%0/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin10::uc($char[$i]) ne &fc($char[$i])
!ll&&!rl&&r
000
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx
!ll&&!rl&&r
000
MC/DC0%0/3
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin10::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin10::uc($char[$i]) ne &fc($char[$i])
Truth table0%0/4
A and B and C
A= $ignorecaseB= $char[$i] =~ /\A [\x00-\xFF] \z/mosxC= &Elatin10::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
7217 0 ▶ if (CORE::length(Elatin10::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
7218 0 $char[$i] = '[' . Elatin10::uc($char[$i]) . Elatin10::fc($char[$i]) . ']';
7219 }
7220 else {
7221 0 $char[$i] = '(?:' . Elatin10::uc($char[$i]) . '|' . Elatin10::fc($char[$i]) . ')';
7222 }
7223 }
7224  
7225 # quote character before ? + * {
7226 ▶ elsif (($i >= 1) and ($char[$i] =~ /\A [\?\+\*\{] \z/oxms)) {
Condition0%0/3
$i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx
!ll&&!rl&&r
000
MC/DC0%0/2
$i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx
$i >= 1 $char[$i] =~ /\A [\?\+\*\{] \z/mosx
Truth table0%0/3
A and B
A= $i >= 1B= $char[$i] =~ /\A [\?\+\*\{] \z/mosx
ABresult
0X0
100
111
7227 0 ▶ if ($char[$i-1] =~ /\A [\x00-\xFF] \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i - 1] =~ /\A [\x00-\xFF] \z/mosx) { } 0 0 0
7228 }
7229 else {
7230 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
7231 }
7232 }
7233 }
7234  
7235 0 $modifier =~ tr/i//d;
7236 0 return join '', 'Elatin10::split', $ope, $delimiter, @char, $end_delimiter, $modifier;
7237 }
7238  
7239 #
7240 # instead of Carp::carp
7241 #
7242 0 ▶sub carp {
Subroutine carp: not called CC=1 SCAR=6.9
Pod undocumented
7243 0 my($package,$filename,$line) = caller(1);
7244 0 print STDERR "@_ at $filename line $line.\n";
7245 }
7246  
7247 #
7248 # instead of Carp::croak
7249 #
7250 0 ▶sub croak {
Subroutine croak: not called CC=1 SCAR=6.9
Pod undocumented
7251 0 my($package,$filename,$line) = caller(1);
7252 0 print STDERR "@_ at $filename line $line.\n";
7253 0 die "\n";
7254 }
7255  
7256 #
7257 # instead of Carp::cluck
7258 #
7259 0 ▶sub cluck {
Subroutine cluck: not called CC=2 SCAR=17.9
Pod undocumented
7260 0 my $i = 0;
7261 0 my @cluck = ();
7262 0 ▶ while (my($package,$filename,$line,$subroutine) = caller($i)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7263 0 push @cluck, "[$i] $filename($line) $package::$subroutine\n";
7264 0 $i++;
7265 }
7266 0 print STDERR CORE::reverse @cluck;
7267 0 print STDERR "\n";
7268 0 print STDERR @_;
7269 }
7270  
7271 #
7272 # instead of Carp::confess
7273 #
7274 0 ▶sub confess {
Subroutine confess: not called CC=2 SCAR=17.9
Pod undocumented
7275 0 my $i = 0;
7276 0 my @confess = ();
7277 0 ▶ while (my($package,$filename,$line,$subroutine) = caller($i)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7278 0 push @confess, "[$i] $filename($line) $package::$subroutine\n";
7279 0 $i++;
7280 }
7281 0 print STDERR CORE::reverse @confess;
7282 0 print STDERR "\n";
7283 0 print STDERR @_;
7284 0 die "\n";
7285 }
7286  
7287 424 1;
7288  
7289 __END__
↑ Summary Latin10.pm »