blib/lib/Elatin1.pm

filter: Statementstmt 36.4% 1198 / 3286 Branchbran 38.6% 1141 / 2954 Conditioncond 31.0% 115 / 370 MC/DCmcdc 15.9% 35 / 220 Subroutinesub 60.8% 73 / 120 Podpod 4.6% 3 / 64 totaltotal 36.5% 2565 / 7014 CC 1648 SCAR 99.4
CC
1648
Cov
37%
escape_token
55669.4
e_string
33636.6
e_s1
3320.4
CRAP 20709.5
↑ Summary blib/lib/Latin1.pm »
1 package Elatin1;
2 422 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 ######################################################################
4 #
5 # Elatin1 - Run-time routines for Latin1.pm
6 #
7 # http://search.cpan.org/dist/Char-Latin1/
8 #
9 # Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2018, 2019 INABA Hitoshi <ina@cpan.org>
10 ######################################################################
11  
12 422 ▶use 5.00503; # Galapagos Consensus 1998 for primetools
Subroutine BEGIN: called CC=1 SCAR=0.0
13 # use 5.008001; # Lancaster Consensus 2013 for toolchains
14  
15 # 12.3. Delaying use Until Runtime
16 # in Chapter 12. Packages, Libraries, and Modules
17 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
18 # (and so on)
19  
20 # Version numbers should be boring
21 # http://www.dagolden.com/index.php/369/version-numbers-should-be-boring/
22 # For the impatient, the disinterested or those who just want to follow
23 # a recipe, my advice for all modules is this:
24 # our $VERSION = "0.001"; # or "0.001_001" for a dev release
25 # $VERSION = eval $VERSION; # No!! because '1.10' makes '1.1'
26  
27 422 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
28 422 $VERSION = '1.15';
29 422 $VERSION = $VERSION;
30  
31 422 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=7.6
32 422 ▶ if ($^X =~ / jperl /oxmsi) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^X =~ / jperl /imosx) 0 422 422
33 0 die __FILE__, ": needs perl(not jperl) 5.00503 or later. (\$^X==$^X)\n";
34 }
35 422 if (CORE::ord('A') == 193) {
36 die __FILE__, ": is not US-ASCII script (may be EBCDIC or EBCDIK script).\n";
37 }
38 422 if (CORE::ord('A') != 0x41) {
39 die __FILE__, ": is not US-ASCII script (must be US-ASCII script).\n";
40 }
41 }
42  
43 422 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=9.5
44  
45 # instead of utf8.pm
46 422 ▶ 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
47 no warnings qw(redefine);
48 *utf8::upgrade = sub { CORE::length $_[0] };
49 *utf8::downgrade = sub { 1 };
50 *utf8::encode = sub { };
51 *utf8::decode = sub { 1 };
52 *utf8::is_utf8 = sub { };
53 *utf8::valid = sub { 1 };
54 };
55 422 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 422 422
56 0 ▶ *utf8::upgrade = sub { CORE::length $_[0] };
Subroutine __ANON__: not called CC=1 SCAR=6.9
57 0 ▶ *utf8::downgrade = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
58 0 ▶ *utf8::encode = sub { };
Subroutine __ANON__: not called CC=1 SCAR=6.9
59 0 ▶ *utf8::decode = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
60 0 ▶ *utf8::is_utf8 = sub { };
Subroutine __ANON__: not called CC=1 SCAR=6.9
61 0 ▶ *utf8::valid = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
62 }
63 }
64  
65 # instead of Symbol.pm
66 BEGIN {
67 0 ▶ sub gensym () {
Subroutine gensym: not called CC=2 SCAR=17.9
Pod undocumented
68 0 ▶ if ($] < 5.006) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] < 5.006) { } 0 0 0
69 0 return \do { local *_ };
70 }
71 else {
72 0 return undef;
73 }
74 }
75  
76 20 ▶ sub qualify ($$) {
Subroutine qualify: called CC=8 SCAR=28.9
Pod undocumented
77 20 my($name) = @_;
78  
79 20 ▶ if (ref $name) {
Branch: 7 branches
BranchTrueFalseTotal
if (ref $name) { } 5 15 20
elsif (&Elatin1::index($name, '::') >= 0) { } 0 15 15
elsif (&Elatin1::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
80 5 return $name;
81 }
82 elsif (Elatin1::index($name,'::') >= 0) {
83 0 return $name;
84 }
85 elsif (Elatin1::index($name,"'") >= 0) {
86 0 return $name;
87 }
88  
89 # special character, "^xyz"
90 elsif ($name =~ /\A \^ [ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]+ \z/x) {
91  
92 # RGS 2001-11-05 : translate leading ^X to control-char
93 0 $name =~ s{\A \^ ([ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]) }{'qq(\c'.$1.')'}xee;
94 0 return 'main::' . $name;
95 }
96  
97 # Global names
98 elsif ($name =~ /\A (?: ARGV | ARGVOUT | ENV | INC | SIG | STDERR | STDIN | STDOUT ) \z/x) {
99 0 return 'main::' . $name;
100 }
101  
102 # or other
103 elsif ($name =~ /\A [^ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz] \z/x) {
104 0 return 'main::' . $name;
105 }
106  
107 elsif (defined $_[1]) {
108 15 return $_[1] . '::' . $name;
109 }
110 else {
111 0 return (caller)[0] . '::' . $name;
112 }
113 }
114  
115 20 ▶ sub qualify_to_ref ($;$) {
Subroutine qualify_to_ref: called CC=2 SCAR=7.2
Pod undocumented
116 20 ▶ if (defined $_[1]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[1]) { } 20 0 20
117 422 ▶ no strict qw(refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
118 20 return \*{ qualify $_[0], $_[1] };
119 }
120 else {
121 422 ▶ no strict qw(refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: not called CC=1 SCAR=0.0
122 0 return \*{ qualify $_[0], (caller)[0] };
123 }
124 }
125 }
126  
127 # P.714 29.2.39. flock
128 # in Chapter 29: Functions
129 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
130  
131 # P.863 flock
132 # in Chapter 27: Functions
133 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
134  
135 sub LOCK_SH() {1}
136 sub LOCK_EX() {2}
137 sub LOCK_UN() {8}
138 sub LOCK_NB() {4}
139  
140 # instead of Carp.pm
141 sub carp;
142 sub croak;
143 sub cluck;
144 sub confess;
145  
146 # 6.18. Matching Multiple-Byte Characters
147 # in Chapter 6. Pattern Matching
148 # of ISBN 978-1-56592-243-3 Perl Perl Cookbook.
149 # (and so on)
150  
151 # regexp of character
152 422 my $your_char = q{[\x00-\xFF]};
153 422 ▶use vars qw($qq_char); $qq_char = qr/\\c[\x40-\x5F]|\\?(?:$your_char)/oxms;
Subroutine BEGIN: called CC=1 SCAR=0.0
154 422 ▶use vars qw($q_char); $q_char = qr/$your_char/oxms;
Subroutine BEGIN: called CC=1 SCAR=0.0
155  
156 #
157 # Latin-1 character range per length
158 #
159 422 my %range_tr = ();
160  
161 #
162 # Latin-1 case conversion
163 #
164 422 my %lc = ();
165 422 @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)} =
166 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 422 my %uc = ();
168 422 @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)} =
169 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 422 my %fc = ();
171 422 @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)} =
172 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  
174 422 ▶if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { __PACKAGE__ =~ / \b Elatin1 \z/mosx }) { } 422 0 422
175 }
176  
177 elsif (__PACKAGE__ =~ / \b Elatin1 \z/oxms) {
178 422 %range_tr = (
179 1 => [ [0x00..0xFF],
180 ],
181 );
182  
183 422 %lc = (%lc,
184 "\xC0" => "\xE0", # LATIN LETTER A WITH GRAVE
185 "\xC1" => "\xE1", # LATIN LETTER A WITH ACUTE
186 "\xC2" => "\xE2", # LATIN LETTER A WITH CIRCUMFLEX
187 "\xC3" => "\xE3", # LATIN LETTER A WITH TILDE
188 "\xC4" => "\xE4", # LATIN LETTER A WITH DIAERESIS
189 "\xC5" => "\xE5", # LATIN LETTER A WITH RING ABOVE
190 "\xC6" => "\xE6", # LATIN LETTER AE
191 "\xC7" => "\xE7", # LATIN LETTER C WITH CEDILLA
192 "\xC8" => "\xE8", # LATIN LETTER E WITH GRAVE
193 "\xC9" => "\xE9", # LATIN LETTER E WITH ACUTE
194 "\xCA" => "\xEA", # LATIN LETTER E WITH CIRCUMFLEX
195 "\xCB" => "\xEB", # LATIN LETTER E WITH DIAERESIS
196 "\xCC" => "\xEC", # LATIN LETTER I WITH GRAVE
197 "\xCD" => "\xED", # LATIN LETTER I WITH ACUTE
198 "\xCE" => "\xEE", # LATIN LETTER I WITH CIRCUMFLEX
199 "\xCF" => "\xEF", # LATIN LETTER I WITH DIAERESIS
200 "\xD0" => "\xF0", # LATIN LETTER ETH (Icelandic)
201 "\xD1" => "\xF1", # LATIN LETTER N WITH TILDE
202 "\xD2" => "\xF2", # LATIN LETTER O WITH GRAVE
203 "\xD3" => "\xF3", # LATIN LETTER O WITH ACUTE
204 "\xD4" => "\xF4", # LATIN LETTER O WITH CIRCUMFLEX
205 "\xD5" => "\xF5", # LATIN LETTER O WITH TILDE
206 "\xD6" => "\xF6", # LATIN LETTER O WITH DIAERESIS
207 "\xD8" => "\xF8", # LATIN LETTER O WITH STROKE
208 "\xD9" => "\xF9", # LATIN LETTER U WITH GRAVE
209 "\xDA" => "\xFA", # LATIN LETTER U WITH ACUTE
210 "\xDB" => "\xFB", # LATIN LETTER U WITH CIRCUMFLEX
211 "\xDC" => "\xFC", # LATIN LETTER U WITH DIAERESIS
212 "\xDD" => "\xFD", # LATIN LETTER Y WITH ACUTE
213 "\xDE" => "\xFE", # LATIN LETTER THORN (Icelandic)
214 );
215  
216 422 %uc = (%uc,
217 "\xE0" => "\xC0", # LATIN LETTER A WITH GRAVE
218 "\xE1" => "\xC1", # LATIN LETTER A WITH ACUTE
219 "\xE2" => "\xC2", # LATIN LETTER A WITH CIRCUMFLEX
220 "\xE3" => "\xC3", # LATIN LETTER A WITH TILDE
221 "\xE4" => "\xC4", # LATIN LETTER A WITH DIAERESIS
222 "\xE5" => "\xC5", # LATIN LETTER A WITH RING ABOVE
223 "\xE6" => "\xC6", # LATIN LETTER AE
224 "\xE7" => "\xC7", # LATIN LETTER C WITH CEDILLA
225 "\xE8" => "\xC8", # LATIN LETTER E WITH GRAVE
226 "\xE9" => "\xC9", # LATIN LETTER E WITH ACUTE
227 "\xEA" => "\xCA", # LATIN LETTER E WITH CIRCUMFLEX
228 "\xEB" => "\xCB", # LATIN LETTER E WITH DIAERESIS
229 "\xEC" => "\xCC", # LATIN LETTER I WITH GRAVE
230 "\xED" => "\xCD", # LATIN LETTER I WITH ACUTE
231 "\xEE" => "\xCE", # LATIN LETTER I WITH CIRCUMFLEX
232 "\xEF" => "\xCF", # LATIN LETTER I WITH DIAERESIS
233 "\xF0" => "\xD0", # LATIN LETTER ETH (Icelandic)
234 "\xF1" => "\xD1", # LATIN LETTER N WITH TILDE
235 "\xF2" => "\xD2", # LATIN LETTER O WITH GRAVE
236 "\xF3" => "\xD3", # LATIN LETTER O WITH ACUTE
237 "\xF4" => "\xD4", # LATIN LETTER O WITH CIRCUMFLEX
238 "\xF5" => "\xD5", # LATIN LETTER O WITH TILDE
239 "\xF6" => "\xD6", # LATIN LETTER O WITH DIAERESIS
240 "\xF8" => "\xD8", # LATIN LETTER O WITH STROKE
241 "\xF9" => "\xD9", # LATIN LETTER U WITH GRAVE
242 "\xFA" => "\xDA", # LATIN LETTER U WITH ACUTE
243 "\xFB" => "\xDB", # LATIN LETTER U WITH CIRCUMFLEX
244 "\xFC" => "\xDC", # LATIN LETTER U WITH DIAERESIS
245 "\xFD" => "\xDD", # LATIN LETTER Y WITH ACUTE
246 "\xFE" => "\xDE", # LATIN LETTER THORN (Icelandic)
247 );
248  
249 422 %fc = (%fc,
250 "\xC0" => "\xE0", # LATIN CAPITAL LETTER A WITH GRAVE --> LATIN SMALL LETTER A WITH GRAVE
251 "\xC1" => "\xE1", # LATIN CAPITAL LETTER A WITH ACUTE --> LATIN SMALL LETTER A WITH ACUTE
252 "\xC2" => "\xE2", # LATIN CAPITAL LETTER A WITH CIRCUMFLEX --> LATIN SMALL LETTER A WITH CIRCUMFLEX
253 "\xC3" => "\xE3", # LATIN CAPITAL LETTER A WITH TILDE --> LATIN SMALL LETTER A WITH TILDE
254 "\xC4" => "\xE4", # LATIN CAPITAL LETTER A WITH DIAERESIS --> LATIN SMALL LETTER A WITH DIAERESIS
255 "\xC5" => "\xE5", # LATIN CAPITAL LETTER A WITH RING ABOVE --> LATIN SMALL LETTER A WITH RING ABOVE
256 "\xC6" => "\xE6", # LATIN CAPITAL LETTER AE --> LATIN SMALL LETTER AE
257 "\xC7" => "\xE7", # LATIN CAPITAL LETTER C WITH CEDILLA --> LATIN SMALL LETTER C WITH CEDILLA
258 "\xC8" => "\xE8", # LATIN CAPITAL LETTER E WITH GRAVE --> LATIN SMALL LETTER E WITH GRAVE
259 "\xC9" => "\xE9", # LATIN CAPITAL LETTER E WITH ACUTE --> LATIN SMALL LETTER E WITH ACUTE
260 "\xCA" => "\xEA", # LATIN CAPITAL LETTER E WITH CIRCUMFLEX --> LATIN SMALL LETTER E WITH CIRCUMFLEX
261 "\xCB" => "\xEB", # LATIN CAPITAL LETTER E WITH DIAERESIS --> LATIN SMALL LETTER E WITH DIAERESIS
262 "\xCC" => "\xEC", # LATIN CAPITAL LETTER I WITH GRAVE --> LATIN SMALL LETTER I WITH GRAVE
263 "\xCD" => "\xED", # LATIN CAPITAL LETTER I WITH ACUTE --> LATIN SMALL LETTER I WITH ACUTE
264 "\xCE" => "\xEE", # LATIN CAPITAL LETTER I WITH CIRCUMFLEX --> LATIN SMALL LETTER I WITH CIRCUMFLEX
265 "\xCF" => "\xEF", # LATIN CAPITAL LETTER I WITH DIAERESIS --> LATIN SMALL LETTER I WITH DIAERESIS
266 "\xD0" => "\xF0", # LATIN CAPITAL LETTER ETH --> LATIN SMALL LETTER ETH
267 "\xD1" => "\xF1", # LATIN CAPITAL LETTER N WITH TILDE --> LATIN SMALL LETTER N WITH TILDE
268 "\xD2" => "\xF2", # LATIN CAPITAL LETTER O WITH GRAVE --> LATIN SMALL LETTER O WITH GRAVE
269 "\xD3" => "\xF3", # LATIN CAPITAL LETTER O WITH ACUTE --> LATIN SMALL LETTER O WITH ACUTE
270 "\xD4" => "\xF4", # LATIN CAPITAL LETTER O WITH CIRCUMFLEX --> LATIN SMALL LETTER O WITH CIRCUMFLEX
271 "\xD5" => "\xF5", # LATIN CAPITAL LETTER O WITH TILDE --> LATIN SMALL LETTER O WITH TILDE
272 "\xD6" => "\xF6", # LATIN CAPITAL LETTER O WITH DIAERESIS --> LATIN SMALL LETTER O WITH DIAERESIS
273 "\xD8" => "\xF8", # LATIN CAPITAL LETTER O WITH STROKE --> LATIN SMALL LETTER O WITH STROKE
274 "\xD9" => "\xF9", # LATIN CAPITAL LETTER U WITH GRAVE --> LATIN SMALL LETTER U WITH GRAVE
275 "\xDA" => "\xFA", # LATIN CAPITAL LETTER U WITH ACUTE --> LATIN SMALL LETTER U WITH ACUTE
276 "\xDB" => "\xFB", # LATIN CAPITAL LETTER U WITH CIRCUMFLEX --> LATIN SMALL LETTER U WITH CIRCUMFLEX
277 "\xDC" => "\xFC", # LATIN CAPITAL LETTER U WITH DIAERESIS --> LATIN SMALL LETTER U WITH DIAERESIS
278 "\xDD" => "\xFD", # LATIN CAPITAL LETTER Y WITH ACUTE --> LATIN SMALL LETTER Y WITH ACUTE
279 "\xDE" => "\xFE", # LATIN CAPITAL LETTER THORN --> LATIN SMALL LETTER THORN
280 "\xDF" => "\x73\x73", # LATIN SMALL LETTER SHARP S --> LATIN SMALL LETTER S, LATIN SMALL LETTER S
281 );
282 }
283  
284 else {
285 0 croak "Don't know my package name '@{[__PACKAGE__]}'";
286 }
287  
288 #
289 # @ARGV wildcard globbing
290 #
291 211 ▶sub import {
Subroutine import: called CC=7 SCAR=28.3
292  
293 211 ▶ if ($^O =~ /\A (?: MSWin32 | NetWare | symbian | dos ) \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O =~ /\A (?: MSWin32 | NetWare | symbian | dos ) \z/mosx) 0 211 211
294 0 my @argv = ();
295 0 for (@ARGV) {
296  
297 # has space
298 0 ▶ if (/\A (?:$q_char)*? [ ] /oxms) {
Branch: 2 branches
BranchTrueFalseTotal
if (/\A (?:$Elatin1::q_char)*? [ ] /mosx) { } 0 0 0
elsif (/\A (?:$Elatin1::q_char)*? [*?] /mosx) { } 0 0 0
299 0 ▶ if (my @glob = Elatin1::glob(qq{"$_"})) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@glob) = &Elatin1::glob(qq["$_"])) { } 0 0 0
300 0 push @argv, @glob;
301 }
302 else {
303 0 push @argv, $_;
304 }
305 }
306  
307 # has wildcard metachar
308 elsif (/\A (?:$q_char)*? [*?] /oxms) {
309 0 ▶ if (my @glob = Elatin1::glob($_)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@glob) = &Elatin1::glob($_)) { } 0 0 0
310 0 push @argv, @glob;
311 }
312 else {
313 0 push @argv, $_;
314 }
315 }
316  
317 # no wildcard globbing
318 else {
319 0 push @argv, $_;
320 }
321 }
322 0 @ARGV = @argv;
323 }
324  
325 211 *Char::ord = \&Latin1::ord;
326 211 *Char::ord_ = \&Latin1::ord_;
327 211 *Char::reverse = \&Latin1::reverse;
328 211 *Char::getc = \&Latin1::getc;
329 211 *Char::length = \&Latin1::length;
330 211 *Char::substr = \&Latin1::substr;
331 211 *Char::index = \&Latin1::index;
332 211 *Char::rindex = \&Latin1::rindex;
333 211 *Char::eval = \&Latin1::eval;
334 211 *Char::escape = \&Latin1::escape;
335 211 *Char::escape_token = \&Latin1::escape_token;
336 211 *Char::escape_script = \&Latin1::escape_script;
337 }
338  
339 # P.230 Care with Prototypes
340 # in Chapter 6: Subroutines
341 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
342 #
343 # If you aren't careful, you can get yourself into trouble with prototypes.
344 # But if you are careful, you can do a lot of neat things with them. This is
345 # all very powerful, of course, and should only be used in moderation to make
346 # the world a better place.
347  
348 # P.332 Care with Prototypes
349 # in Chapter 7: Subroutines
350 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
351 #
352 # If you aren't careful, you can get yourself into trouble with prototypes.
353 # But if you are careful, you can do a lot of neat things with them. This is
354 # all very powerful, of course, and should only be used in moderation to make
355 # the world a better place.
356  
357 #
358 # Prototypes of subroutines
359 #
360 0 ▶sub unimport {}
Subroutine unimport: not called CC=1 SCAR=0.0
361 sub Elatin1::split(;$$$);
362 sub Elatin1::tr($$$$;$);
363 sub Elatin1::chop(@);
364 sub Elatin1::index($$;$);
365 sub Elatin1::rindex($$;$);
366 sub Elatin1::lcfirst(@);
367 sub Elatin1::lcfirst_();
368 sub Elatin1::lc(@);
369 sub Elatin1::lc_();
370 sub Elatin1::ucfirst(@);
371 sub Elatin1::ucfirst_();
372 sub Elatin1::uc(@);
373 sub Elatin1::uc_();
374 sub Elatin1::fc(@);
375 sub Elatin1::fc_();
376 sub Elatin1::ignorecase;
377 sub Elatin1::classic_character_class;
378 sub Elatin1::capture;
379 sub Elatin1::chr(;$);
380 sub Elatin1::chr_();
381 sub Elatin1::glob($);
382 sub Elatin1::glob_();
383  
384 sub Latin1::ord(;$);
385 sub Latin1::ord_();
386 sub Latin1::reverse(@);
387 sub Latin1::getc(;*@);
388 sub Latin1::length(;$);
389 sub Latin1::substr($$;$$);
390 sub Latin1::index($$;$);
391 sub Latin1::rindex($$;$);
392 sub Latin1::escape(;$);
393  
394 #
395 # Regexp work
396 #
397 422 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
398 $re_a
399 $re_t
400 $re_n
401 $re_r
402 422 );
403  
404 #
405 # Character class
406 #
407 422 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
408 $dot
409 $dot_s
410 $eD
411 $eS
412 $eW
413 $eH
414 $eV
415 $eR
416 $eN
417 $not_alnum
418 $not_alpha
419 $not_ascii
420 $not_blank
421 $not_cntrl
422 $not_digit
423 $not_graph
424 $not_lower
425 $not_lower_i
426 $not_print
427 $not_punct
428 $not_space
429 $not_upper
430 $not_upper_i
431 $not_word
432 $not_xdigit
433 $eb
434 $eB
435 422 );
436  
437 422 ${Elatin1::dot} = qr{(?>[^\x0A])};
438 422 ${Elatin1::dot_s} = qr{(?>[\x00-\xFF])};
439 422 ${Elatin1::eD} = qr{(?>[^0-9])};
440  
441 # Vertical tabs are now whitespace
442 # \s in a regex now matches a vertical tab in all circumstances.
443 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
444 # ${Elatin1::eS} = qr{(?>[^\x09\x0A \x0C\x0D\x20])};
445 # ${Elatin1::eS} = qr{(?>[^\x09\x0A\x0B\x0C\x0D\x20])};
446 422 ${Elatin1::eS} = qr{(?>[^\s])};
447  
448 422 ${Elatin1::eW} = qr{(?>[^0-9A-Z_a-z])};
449 422 ${Elatin1::eH} = qr{(?>[^\x09\x20])};
450 422 ${Elatin1::eV} = qr{(?>[^\x0A\x0B\x0C\x0D])};
451 422 ${Elatin1::eR} = qr{(?>\x0D\x0A|[\x0A\x0D])};
452 422 ${Elatin1::eN} = qr{(?>[^\x0A])};
453 422 ${Elatin1::not_alnum} = qr{(?>[^\x30-\x39\x41-\x5A\x61-\x7A])};
454 422 ${Elatin1::not_alpha} = qr{(?>[^\x41-\x5A\x61-\x7A])};
455 422 ${Elatin1::not_ascii} = qr{(?>[^\x00-\x7F])};
456 422 ${Elatin1::not_blank} = qr{(?>[^\x09\x20])};
457 422 ${Elatin1::not_cntrl} = qr{(?>[^\x00-\x1F\x7F])};
458 422 ${Elatin1::not_digit} = qr{(?>[^\x30-\x39])};
459 422 ${Elatin1::not_graph} = qr{(?>[^\x21-\x7F])};
460 422 ${Elatin1::not_lower} = qr{(?>[^\x61-\x7A])};
461 422 ${Elatin1::not_lower_i} = qr{(?>[^\x41-\x5A\x61-\x7A])}; # Perl 5.16 compatible
462 # ${Elatin1::not_lower_i} = qr{(?>[\x00-\xFF])}; # older Perl compatible
463 422 ${Elatin1::not_print} = qr{(?>[^\x20-\x7F])};
464 422 ${Elatin1::not_punct} = qr{(?>[^\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E])};
465 422 ${Elatin1::not_space} = qr{(?>[^\s\x0B])};
466 422 ${Elatin1::not_upper} = qr{(?>[^\x41-\x5A])};
467 422 ${Elatin1::not_upper_i} = qr{(?>[^\x41-\x5A\x61-\x7A])}; # Perl 5.16 compatible
468 # ${Elatin1::not_upper_i} = qr{(?>[\x00-\xFF])}; # older Perl compatible
469 422 ${Elatin1::not_word} = qr{(?>[^\x30-\x39\x41-\x5A\x5F\x61-\x7A])};
470 422 ${Elatin1::not_xdigit} = qr{(?>[^\x30-\x39\x41-\x46\x61-\x66])};
471 422 ${Elatin1::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))};
472 422 ${Elatin1::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]))};
473  
474 # avoid: Name "Elatin1::foo" used only once: possible typo at here.
475 422 ${Elatin1::dot} = ${Elatin1::dot};
476 422 ${Elatin1::dot_s} = ${Elatin1::dot_s};
477 422 ${Elatin1::eD} = ${Elatin1::eD};
478 422 ${Elatin1::eS} = ${Elatin1::eS};
479 422 ${Elatin1::eW} = ${Elatin1::eW};
480 422 ${Elatin1::eH} = ${Elatin1::eH};
481 422 ${Elatin1::eV} = ${Elatin1::eV};
482 422 ${Elatin1::eR} = ${Elatin1::eR};
483 422 ${Elatin1::eN} = ${Elatin1::eN};
484 422 ${Elatin1::not_alnum} = ${Elatin1::not_alnum};
485 422 ${Elatin1::not_alpha} = ${Elatin1::not_alpha};
486 422 ${Elatin1::not_ascii} = ${Elatin1::not_ascii};
487 422 ${Elatin1::not_blank} = ${Elatin1::not_blank};
488 422 ${Elatin1::not_cntrl} = ${Elatin1::not_cntrl};
489 422 ${Elatin1::not_digit} = ${Elatin1::not_digit};
490 422 ${Elatin1::not_graph} = ${Elatin1::not_graph};
491 422 ${Elatin1::not_lower} = ${Elatin1::not_lower};
492 422 ${Elatin1::not_lower_i} = ${Elatin1::not_lower_i};
493 422 ${Elatin1::not_print} = ${Elatin1::not_print};
494 422 ${Elatin1::not_punct} = ${Elatin1::not_punct};
495 422 ${Elatin1::not_space} = ${Elatin1::not_space};
496 422 ${Elatin1::not_upper} = ${Elatin1::not_upper};
497 422 ${Elatin1::not_upper_i} = ${Elatin1::not_upper_i};
498 422 ${Elatin1::not_word} = ${Elatin1::not_word};
499 422 ${Elatin1::not_xdigit} = ${Elatin1::not_xdigit};
500 422 ${Elatin1::eb} = ${Elatin1::eb};
501 422 ${Elatin1::eB} = ${Elatin1::eB};
502  
503 #
504 # Latin-1 split
505 #
506 72 ▶sub Elatin1::split(;$$$) {
Subroutine split: called CC=34 SCAR=46.9
Pod undocumented
507  
508 # P.794 29.2.161. split
509 # in Chapter 29: Functions
510 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
511  
512 # P.951 split
513 # in Chapter 27: Functions
514 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
515  
516 72 my $pattern = $_[0];
517 72 my $string = $_[1];
518 72 my $limit = $_[2];
519  
520 # if $pattern is also omitted or is the literal space, " "
521 72 ▶ if (not defined $pattern) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $pattern) 2 70 72
522 2 $pattern = ' ';
523 }
524  
525 # if $string is omitted, the function splits the $_ string
526 72 ▶ if (not defined $string) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $string) 6 66 72
527 6 ▶ if (defined $_) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_) { } 0 6 6
528 0 $string = $_;
529 }
530 else {
531 6 $string = '';
532 }
533 }
534  
535 72 my @split = ();
536  
537 # when string is empty
538 72 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 10 62 72
elsif ($pattern eq ' ') { } 2 60 62
539  
540 # resulting list value in list context
541 10 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 5 5 10
542 5 return @split;
543 }
544  
545 # count of substrings in scalar context
546 else {
547 5 ▶ carp "Use of implicit split to \@_ is deprecated" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 5 5
548 5 @_ = @split;
549 5 return scalar @_;
550 }
551 }
552  
553 # split's first argument is more consistently interpreted
554 #
555 # After some changes earlier in v5.17, split's behavior has been simplified:
556 # if the PATTERN argument evaluates to a string containing one space, it is
557 # treated the way that a literal string containing one space once was.
558 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#split's_first_argument_is_more_consistently_interpreted
559  
560 # if $pattern is also omitted or is the literal space, " ", the function splits
561 # on whitespace, /\s+/, after skipping any leading whitespace
562 # (and so on)
563  
564 elsif ($pattern eq ' ') {
565 2 ▶ if (not defined $limit) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $limit) { } 2 0 2
566 2 return CORE::split(' ', $string);
567 }
568 else {
569 0 return CORE::split(' ', $string, $limit);
570 }
571 }
572  
573 # if $limit is negative, it is treated as if an arbitrarily large $limit has been specified
574 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
575  
576 # a pattern capable of matching either the null string or something longer than the
577 # null string will split the value of $string into separate characters wherever it
578 # matches the null string between characters
579 # (and so on)
580  
581 60 ▶ if ('' =~ / \A $pattern \z /xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ('' =~ / \A $pattern \z /msx) { } 2 58 60
582 2 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
583 2 my $limit = scalar(() = $string =~ /($pattern)/oxmsg);
584  
585 # P.1024 Appendix W.10 Multibyte Processing
586 # of ISBN 1-56592-224-7 CJKV Information Processing
587 # (and so on)
588  
589 # the //m modifier is assumed when you split on the pattern /^/
590 # (and so on)
591  
592 # V
593 2 ▶ while ((--$limit > 0) and ($string =~ s/\A((?:$q_char)+?)$pattern//m)) {
Branch: 1 branch
BranchTrueFalseTotal
if (--$limit > 0 and $string =~ s/\A((?:$Elatin1::q_char)+?)$pattern//m) 9 2 11
Condition100%3/3
--$limit > 0 and $string =~ s/\A((?:$Elatin1::q_char)+?)$pattern//m
!ll&&!rl&&r
119
MC/DC100%2/2
--$limit > 0 and $string =~ s/\A((?:$Elatin1::q_char)+?)$pattern//m
--$limit > 0 $string =~ s/\A((?:$Elatin1::q_char)+?)$pattern//m
Truth table100%3/3
A and B
A= --$limit > 0B= $string =~ s/\A((?:$Elatin1::q_char)+?)$pattern//m
ABresult
0X0
100
111
594  
595 # if the $pattern contains parentheses, then the substring matched by each pair of parentheses
596 # is included in the resulting list, interspersed with the fields that are ordinarily returned
597 # (and so on)
598  
599 9 local $@;
600 9 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 9 9 18
601 9 push @split, CORE::eval('$' . $digit);
602 }
603 }
604 }
605  
606 else {
607 58 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
608  
609 # V
610 58 ▶ while ($string =~ s/\A((?:$q_char)*?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Elatin1::q_char)*?)$pattern//m) 163 58 221
611 163 local $@;
612 163 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 230 163 393
613 230 push @split, CORE::eval('$' . $digit);
614 }
615 }
616 }
617 }
618  
619 elsif ($limit > 0) {
620 0 ▶ if ('' =~ / \A $pattern \z /xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ('' =~ / \A $pattern \z /msx) { } 0 0 0
621 0 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
622 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
623  
624 # V
625 0 ▶ if ($string =~ s/\A((?:$q_char)+?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Elatin1::q_char)+?)$pattern//m) 0 0 0
626 0 local $@;
627 0 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 0 0 0
628 0 push @split, CORE::eval('$' . $digit);
629 }
630 }
631 }
632 }
633 else {
634 0 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
635 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
636  
637 # V
638 0 ▶ if ($string =~ s/\A((?:$q_char)*?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Elatin1::q_char)*?)$pattern//m) 0 0 0
639 0 local $@;
640 0 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 0 0 0
641 0 push @split, CORE::eval('$' . $digit);
642 }
643 }
644 }
645 }
646 }
647  
648 60 ▶ if (CORE::length($string) > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $string > 0) 58 2 60
649 58 push @split, $string;
650 }
651  
652 # if $_[2] (NOT "$limit") is omitted or zero, trailing null fields are stripped from the result
653 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
654 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
655 0 pop @split;
656 }
657 }
658  
659 # resulting list value in list context
660 60 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 58 2 60
661 58 return @split;
662 }
663  
664 # count of substrings in scalar context
665 else {
666 2 ▶ carp "Use of implicit split to \@_ is deprecated" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 2 2
667 2 @_ = @split;
668 2 return scalar @_;
669 }
670 }
671  
672 #
673 # get last subexpression offsets
674 #
675 60 ▶sub _last_subexpression_offsets {
Subroutine _last_subexpression_offsets: called CC=3 SCAR=11.0
676 60 my $pattern = $_[0];
677  
678 # remove comment
679 60 $pattern =~ s/\(\?\# .*? \)//oxmsg;
680  
681 60 my $modifier = '';
682 60 ▶ if ($pattern =~ /\(\?\^? ([\-A-Za-z]+) :/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pattern =~ /\(\?\^? ([\-A-Za-z]+) :/mosx) 11 49 60
683 11 $modifier = $1;
684 11 $modifier =~ s/-[A-Za-z]*//;
685 }
686  
687 # with /x modifier
688 60 my @char = ();
689 60 ▶ if ($modifier =~ /x/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /x/mosx) { } 5 55 60
690 5 @char = $pattern =~ /\G((?>
691 [^\\\#\[\(] |
692 \\ $q_char |
693 \# (?>[^\n]*) $ |
694 \[ (?>(?:[^\\\]]|\\\\|\\\]|$q_char)+) \] |
695 \(\? |
696 $q_char
697 ))/oxmsg;
698 }
699  
700 # without /x modifier
701 else {
702 55 @char = $pattern =~ /\G((?>
703 [^\\\[\(] |
704 \\ $q_char |
705 \[ (?>(?:[^\\\]]|\\\\|\\\]|$q_char)+) \] |
706 \(\? |
707 $q_char
708 ))/oxmsg;
709 }
710  
711 60 return scalar grep { $_ eq '(' } @char;
712 }
713  
714 #
715 # Latin-1 transliteration (tr///)
716 #
717 6 ▶sub Elatin1::tr($$$$;$) {
Subroutine tr: called CC=26 SCAR=48.6
Pod undocumented
718  
719 6 my $bind_operator = $_[1];
720 6 my $searchlist = $_[2];
721 6 my $replacementlist = $_[3];
722 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
723  
724 6 ▶ if ($modifier =~ /r/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /r/mosx) 5 1 6
725 5 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) 0 5 5
726 0 croak "Using !~ with tr///r doesn't make sense";
727 }
728 }
729  
730 6 my @char = $_[0] =~ /\G (?>$q_char) /oxmsg;
731 6 my @searchlist = _charlist_tr($searchlist);
732 6 my @replacementlist = _charlist_tr($replacementlist);
733  
734 6 my %tr = ();
735 6 ▶ for (my $i=0; $i <= $#searchlist; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#searchlist) 19 6 25
736 19 ▶ if (not exists $tr{$searchlist[$i]}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $tr{$searchlist[$i]}) 19 0 19
737 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
738 19 $tr{$searchlist[$i]} = $replacementlist[$i];
739 }
740 elsif ($modifier =~ /d/oxms) {
741 0 $tr{$searchlist[$i]} = '';
742 }
743 ▶ 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
744 0 $tr{$searchlist[$i]} = $replacementlist[-1];
745 }
746 else {
747 0 $tr{$searchlist[$i]} = $searchlist[$i];
748 }
749 }
750 }
751  
752 6 my $tr = 0;
753 6 my $replaced = '';
754 6 ▶ if ($modifier =~ /c/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /c/mosx) { } 0 6 6
755 0 ▶ while (defined(my $char = shift @char)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $char = shift @char)) 0 0 0
756 0 ▶ if (not exists $tr{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $tr{$char}) { } 0 0 0
757 0 ▶ if (defined $replacementlist[0]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $replacementlist[0]) 0 0 0
758 0 $replaced .= $replacementlist[0];
759 }
760 0 $tr++;
761 0 ▶ if ($modifier =~ /s/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/mosx) 0 0 0
762 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
763 0 shift @char;
764 0 $tr++;
765 }
766 }
767 }
768 else {
769 0 $replaced .= $char;
770 }
771 }
772 }
773 else {
774 6 ▶ while (defined(my $char = shift @char)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $char = shift @char)) 36 6 42
775 36 ▶ if (exists $tr{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $tr{$char}) { } 19 17 36
776 19 $replaced .= $tr{$char};
777 19 $tr++;
778 19 ▶ if ($modifier =~ /s/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/mosx) 0 19 19
779 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
780 0 shift @char;
781 0 $tr++;
782 }
783 }
784 }
785 else {
786 17 $replaced .= $char;
787 }
788 }
789 }
790  
791 6 ▶ if ($modifier =~ /r/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /r/mosx) { } 5 1 6
792 5 return $replaced;
793 }
794 else {
795 1 $_[0] = $replaced;
796 1 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) { } 0 1 1
797 0 return not $tr;
798 }
799 else {
800 1 return $tr;
801 }
802 }
803 }
804  
805 #
806 # Latin-1 chop
807 #
808 0 ▶sub Elatin1::chop(@) {
Subroutine chop: not called CC=3 SCAR=24.8
Pod undocumented
809  
810 0 my $chop;
811 0 ▶ if (@_ == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 0) { } 0 0 0
812 0 my @char = /\G (?>$q_char) /oxmsg;
813 0 $chop = pop @char;
814 0 $_ = join '', @char;
815 }
816 else {
817 0 for (@_) {
818 0 my @char = /\G (?>$q_char) /oxmsg;
819 0 $chop = pop @char;
820 0 $_ = join '', @char;
821 }
822 }
823 0 return $chop;
824 }
825  
826 #
827 # Latin-1 index by octet
828 #
829 30 ▶sub Elatin1::index($$;$) {
Subroutine index: called CC=6 SCAR=20.8
Pod documented
830  
831 30 my($str,$substr,$position) = @_;
832 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
833 30 my $pos = 0;
834  
835 30 ▶ while ($pos < CORE::length($str)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos < length $str) 130 30 160
836 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
837 0 ▶ if ($pos >= $position) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos >= $position) 0 0 0
838 0 return $pos;
839 }
840 }
841 130 ▶ if (CORE::substr($str,$pos) =~ /\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($str, $pos) =~ /\A ($Elatin1::q_char) /mosx) { } 130 0 130
842 130 $pos += CORE::length($1);
843 }
844 else {
845 0 $pos += 1;
846 }
847 }
848 30 return -1;
849 }
850  
851 #
852 # Latin-1 reverse index
853 #
854 0 ▶sub Elatin1::rindex($$;$) {
Subroutine rindex: not called CC=6 SCAR=37.4
Pod undocumented
855  
856 0 my($str,$substr,$position) = @_;
857 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
858 0 my $pos = 0;
859 0 my $rindex = -1;
860  
861 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
862 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
863 0 $rindex = $pos;
864 }
865 0 ▶ if (CORE::substr($str,$pos) =~ /\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($str, $pos) =~ /\A ($Elatin1::q_char) /mosx) { } 0 0 0
866 0 $pos += CORE::length($1);
867 }
868 else {
869 0 $pos += 1;
870 }
871 }
872 0 return $rindex;
873 }
874  
875 #
876 # Latin-1 lower case first with parameter
877 #
878 0 ▶sub Elatin1::lcfirst(@) {
Subroutine lcfirst: not called CC=4 SCAR=30.0
Pod undocumented
879 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
880 0 my $s = shift @_;
881 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
882 0 return Elatin1::lc(CORE::substr($s,0,1)) . CORE::substr($s,1), @_;
883 }
884 else {
885 0 return Elatin1::lc(CORE::substr($s,0,1)) . CORE::substr($s,1);
886 }
887 }
888 else {
889 0 return Elatin1::lc(CORE::substr($_,0,1)) . CORE::substr($_,1);
890 }
891 }
892  
893 #
894 # Latin-1 lower case first without parameter
895 #
896 0 ▶sub Elatin1::lcfirst_() {
Subroutine lcfirst_: not called CC=1 SCAR=6.9
Pod undocumented
897 0 return Elatin1::lc(CORE::substr($_,0,1)) . CORE::substr($_,1);
898 }
899  
900 #
901 # Latin-1 lower case with parameter
902 #
903 57 ▶sub Elatin1::lc(@) {
Subroutine lc: called CC=6 SCAR=24.2
Pod undocumented
904 57 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 57 0 57
905 57 my $s = shift @_;
906 57 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 57 57
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
5700
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
907 0 ▶ return join('', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 0 0 0
908 }
909 else {
910 57 ▶ return join('', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 59 0 59
911 }
912 }
913 else {
914 0 return Elatin1::lc_();
915 }
916 }
917  
918 #
919 # Latin-1 lower case without parameter
920 #
921 0 ▶sub Elatin1::lc_() {
Subroutine lc_: not called CC=2 SCAR=17.9
Pod undocumented
922 0 my $s = $_;
923 0 ▶ return join '', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 0 0 0
924 }
925  
926 #
927 # Latin-1 upper case first with parameter
928 #
929 0 ▶sub Elatin1::ucfirst(@) {
Subroutine ucfirst: not called CC=4 SCAR=30.0
Pod undocumented
930 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
931 0 my $s = shift @_;
932 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
933 0 return Elatin1::uc(CORE::substr($s,0,1)) . CORE::substr($s,1), @_;
934 }
935 else {
936 0 return Elatin1::uc(CORE::substr($s,0,1)) . CORE::substr($s,1);
937 }
938 }
939 else {
940 0 return Elatin1::uc(CORE::substr($_,0,1)) . CORE::substr($_,1);
941 }
942 }
943  
944 #
945 # Latin-1 upper case first without parameter
946 #
947 0 ▶sub Elatin1::ucfirst_() {
Subroutine ucfirst_: not called CC=1 SCAR=6.9
Pod undocumented
948 0 return Elatin1::uc(CORE::substr($_,0,1)) . CORE::substr($_,1);
949 }
950  
951 #
952 # Latin-1 upper case with parameter
953 #
954 2385 ▶sub Elatin1::uc(@) {
Subroutine uc: called CC=6 SCAR=22.9
Pod undocumented
955 2385 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2385 0 2385
956 2385 my $s = shift @_;
957 2385 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 2385 2385
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
238500
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
958 0 ▶ return join('', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 0 0 0
959 }
960 else {
961 2385 ▶ return join('', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 853 1534 2387
962 }
963 }
964 else {
965 0 return Elatin1::uc_();
966 }
967 }
968  
969 #
970 # Latin-1 upper case without parameter
971 #
972 0 ▶sub Elatin1::uc_() {
Subroutine uc_: not called CC=2 SCAR=17.9
Pod undocumented
973 0 my $s = $_;
974 0 ▶ return join '', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 0 0 0
975 }
976  
977 #
978 # Latin-1 fold case with parameter
979 #
980 2399 ▶sub Elatin1::fc(@) {
Subroutine fc: called CC=6 SCAR=22.9
Pod undocumented
981 2399 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2399 0 2399
982 2399 my $s = shift @_;
983 2399 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 2399 2399
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
239900
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
984 0 ▶ return join('', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 0 0 0
985 }
986 else {
987 2399 ▶ return join('', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 1759 5439 7198
988 }
989 }
990 else {
991 0 return Elatin1::fc_();
992 }
993 }
994  
995 #
996 # Latin-1 fold case without parameter
997 #
998 0 ▶sub Elatin1::fc_() {
Subroutine fc_: not called CC=2 SCAR=17.9
Pod undocumented
999 0 my $s = $_;
1000 0 ▶ return join '', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 0 0 0
1001 }
1002  
1003 #
1004 # Latin-1 regexp capture
1005 #
1006 {
1007 0 ▶ sub Elatin1::capture {
Subroutine capture: not called CC=1 SCAR=6.9
Pod documented
1008 0 return $_[0];
1009 }
1010 }
1011  
1012 #
1013 # Latin-1 regexp ignore case modifier
1014 #
1015 422 ▶sub Elatin1::ignorecase {
Subroutine ignorecase: called CC=25 SCAR=52.1
Pod undocumented
1016  
1017 11 my @string = @_;
1018 11 my $metachar = qr/[\@\\|[\]{]/oxms;
1019  
1020 # ignore case of $scalar or @array
1021 11 for my $string (@string) {
1022  
1023 # split regexp
1024 11 my @char = $string =~ /\G (?>\[\^|\\$q_char|$q_char) /oxmsg;
1025  
1026 # unescape character
1027 11 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 924 11 935
1028 924 ▶ next if not defined $char[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $char[$i] 0 924 924
1029  
1030 # open character class [...]
1031 924 ▶ if ($char[$i] eq '[') {
Branch: 4 branches
BranchTrueFalseTotal
if ($char[$i] eq '[') { } 0 924 924
elsif ($char[$i] eq '[^') { } 0 924 924
elsif (my $char = classic_character_class($char[$i])) { } 0 924 924
elsif ($char[$i] =~ /\A [\x00-\xFF] \z/mosx) { } 924 0 924
1032 0 my $left = $i;
1033  
1034 # [] make die "unmatched [] in regexp ...\n"
1035  
1036 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
1037 0 $i++;
1038 }
1039  
1040 0 while (1) {
1041 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
1042 0 croak "Unmatched [] in regexp";
1043 }
1044 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
1045 0 my $right = $i;
1046 0 my @charlist = charlist_qr(@char[$left+1..$right-1], 'i');
1047  
1048 # escape character
1049 0 for my $char (@charlist) {
1050 0 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $char =~ /\A [.|)] \z/mosx }) 0 0 0
1051 }
1052  
1053 0 elsif ($char =~ /\A [.|)] \z/oxms) {
1054 0 $char = '\\' . $char;
1055 }
1056 }
1057  
1058 # [...]
1059 0 splice @char, $left, $right-$left+1, '(?:' . join('|', @charlist) . ')';
1060  
1061 0 $i = $left;
1062 0 last;
1063 }
1064 }
1065 }
1066  
1067 # open character class [^...]
1068 elsif ($char[$i] eq '[^') {
1069 0 my $left = $i;
1070  
1071 # [^] make die "unmatched [] in regexp ...\n"
1072  
1073 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
1074 0 $i++;
1075 }
1076  
1077 0 while (1) {
1078 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
1079 0 croak "Unmatched [] in regexp";
1080 }
1081 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
1082 0 my $right = $i;
1083 0 my @charlist = charlist_not_qr(@char[$left+1..$right-1], 'i');
1084  
1085 # escape character
1086 0 for my $char (@charlist) {
1087 0 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $char =~ /\A [.|)] \z/mosx }) 0 0 0
1088 }
1089  
1090 0 elsif ($char =~ /\A [.|)] \z/oxms) {
1091 0 $char = '\\' . $char;
1092 }
1093 }
1094  
1095 # [^...]
1096 0 splice @char, $left, $right-$left+1, '(?!' . join('|', @charlist) . ")(?:$your_char)";
1097  
1098 0 $i = $left;
1099 0 last;
1100 }
1101 }
1102 }
1103  
1104 # rewrite classic character class or escape character
1105 elsif (my $char = classic_character_class($char[$i])) {
1106 0 $char[$i] = $char;
1107 }
1108  
1109 # with /i modifier
1110 elsif ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) {
1111 924 my $uc = Elatin1::uc($char[$i]);
1112 924 my $fc = Elatin1::fc($char[$i]);
1113 924 ▶ if ($uc ne $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc ne $fc) 476 448 924
1114 476 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 473 3 476
1115 473 $char[$i] = '[' . $uc . $fc . ']';
1116 }
1117 else {
1118 3 $char[$i] = '(?:' . $uc . '|' . $fc . ')';
1119 }
1120 }
1121 }
1122 }
1123  
1124 # characterize
1125 11 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 924 11 935
1126 924 ▶ next if not defined $char[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $char[$i] 0 924 924
1127  
1128 924 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx }) 0 935 935
1129 }
1130  
1131 # quote character before ? + * {
1132 0 ▶ elsif (($i >= 1) and ($char[$i] =~ /\A [\?\+\*\{] \z/oxms)) {
Condition66%2/3
$i >= 1 && $char[$i] =~ /\A [\?\+\*\{] \z/mosx
!ll&&!rl&&r
119130
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
1133 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
1134 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
1135 }
1136 }
1137 }
1138  
1139 11 $string = join '', @char;
1140 }
1141  
1142 # make regexp string
1143 11 return @string;
1144 }
1145  
1146 #
1147 # classic character class ( \D \S \W \d \s \w \C \X \H \V \h \v \R \N \b \B )
1148 #
1149 2792 ▶sub Elatin1::classic_character_class {
Subroutine classic_character_class: called CC=2 SCAR=6.9
Pod undocumented
1150 2792 my($char) = @_;
1151  
1152 return {
1153 '\D' => '${Elatin1::eD}',
1154 '\S' => '${Elatin1::eS}',
1155 '\W' => '${Elatin1::eW}',
1156 '\d' => '[0-9]',
1157  
1158 # Before Perl 5.6, \s only matched the five whitespace characters
1159 # tab, newline, form-feed, carriage return, and the space character
1160 # itself, which, taken together, is the character class [\t\n\f\r ].
1161  
1162 # Vertical tabs are now whitespace
1163 # \s in a regex now matches a vertical tab in all circumstances.
1164 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
1165 # \t \n \v \f \r space
1166 # '\s' => '[\x09\x0A \x0C\x0D\x20]',
1167 # '\s' => '[\x09\x0A\x0B\x0C\x0D\x20]',
1168 '\s' => '\s',
1169  
1170 '\w' => '[0-9A-Z_a-z]',
1171 '\C' => '[\x00-\xFF]',
1172 '\X' => 'X',
1173  
1174 # \h \v \H \V
1175  
1176 # P.114 Character Class Shortcuts
1177 # in Chapter 7: In the World of Regular Expressions
1178 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
1179  
1180 # P.357 13.2.3 Whitespace
1181 # in Chapter 13: perlrecharclass: Perl Regular Expression Character Classes
1182 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
1183 #
1184 # 0x00009 CHARACTER TABULATION h s
1185 # 0x0000a LINE FEED (LF) vs
1186 # 0x0000b LINE TABULATION v
1187 # 0x0000c FORM FEED (FF) vs
1188 # 0x0000d CARRIAGE RETURN (CR) vs
1189 # 0x00020 SPACE h s
1190  
1191 # P.196 Table 5-9. Alphanumeric regex metasymbols
1192 # in Chapter 5. Pattern Matching
1193 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1194  
1195 # (and so on)
1196  
1197 '\H' => '${Elatin1::eH}',
1198 '\V' => '${Elatin1::eV}',
1199 '\h' => '[\x09\x20]',
1200 '\v' => '[\x0A\x0B\x0C\x0D]',
1201 '\R' => '${Elatin1::eR}',
1202  
1203 # \N
1204 #
1205 # http://perldoc.perl.org/perlre.html
1206 # Character Classes and other Special Escapes
1207 # Any character but \n (experimental). Not affected by /s modifier
1208  
1209 '\N' => '${Elatin1::eN}',
1210  
1211 # \b \B
1212  
1213 # P.180 Boundaries: The \b and \B Assertions
1214 # in Chapter 5: Pattern Matching
1215 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
1216  
1217 # P.219 Boundaries: The \b and \B Assertions
1218 # in Chapter 5: Pattern Matching
1219 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1220  
1221 # \b really means (?:(?<=\w)(?!\w)|(?<!\w)(?=\w))
1222 # or (?:(?<=\A|\W)(?=\w)|(?<=\w)(?=\W|\z))
1223 '\b' => '${Elatin1::eb}',
1224  
1225 # \B really means (?:(?<=\w)(?=\w)|(?<!\w)(?!\w))
1226 # or (?:(?<=\w)(?=\w)|(?<=\W)(?=\W))
1227 '\B' => '${Elatin1::eB}',
1228  
1229 2792 ▶ }->{$char} || '';
Condition100%2/2
{'\\D', '${Elatin1::eD}', '\\S', '${Elatin1::eS}', '\\W', '${Elatin1::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin1::eH}', '\\V', '${Elatin1::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin1::eR}', '\\N', '${Elatin1::eN}', '\\b', '${Elatin1::eb}', '\\B', '${Elatin1::eB}'}->{$char} || ''
l!l
1012691
MC/DC100%1/1
{'\\D', '${Elatin1::eD}', '\\S', '${Elatin1::eS}', '\\W', '${Elatin1::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin1::eH}', '\\V', '${Elatin1::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin1::eR}', '\\N', '${Elatin1::eN}', '\\b', '${Elatin1::eb}', '\\B', '${Elatin1::eB}'}->{$char} || ''
{'\\D', '${Elatin1::eD}', '\\S', '${Elatin1::eS}', '\\W', '${Elatin1::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin1::eH}', '\\V', '${Elatin1::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin1::eR}', '\\N', '${Elatin1::eN}', '\\b', '${Elatin1::eb}', '\\B', '${Elatin1::eB}'}->{$char}
Truth table100%2/2
A
A= {'\\D', '${Elatin1::eD}', '\\S', '${Elatin1::eS}', '\\W', '${Elatin1::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin1::eH}', '\\V', '${Elatin1::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin1::eR}', '\\N', '${Elatin1::eN}', '\\b', '${Elatin1::eb}', '\\B', '${Elatin1::eB}'}->{$char}
Aresult
11
00
1230 }
1231  
1232 #
1233 # prepare Latin-1 characters per length
1234 #
1235  
1236 # 1 octet characters
1237 422 my @chars1 = ();
1238 0 ▶sub chars1 {
Subroutine chars1: not called CC=5 SCAR=34.0
Pod undocumented
1239 0 ▶ if (@chars1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars1) 0 0 0
1240 0 return @chars1;
1241 }
1242 0 ▶ if (exists $range_tr{1}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{1}) 0 0 0
1243 0 my @ranges = @{ $range_tr{1} };
1244 0 ▶ while (my @range = splice(@ranges,0,1)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 1)) 0 0 0
1245 0 for my $oct0 (@{$range[0]}) {
1246 0 push @chars1, pack 'C', $oct0;
1247 }
1248 }
1249 }
1250 0 return @chars1;
1251 }
1252  
1253 # 2 octets characters
1254 422 my @chars2 = ();
1255 0 ▶sub chars2 {
Subroutine chars2: not called CC=6 SCAR=37.4
Pod undocumented
1256 0 ▶ if (@chars2) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars2) 0 0 0
1257 0 return @chars2;
1258 }
1259 0 ▶ if (exists $range_tr{2}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{2}) 0 0 0
1260 0 my @ranges = @{ $range_tr{2} };
1261 0 ▶ while (my @range = splice(@ranges,0,2)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 2)) 0 0 0
1262 0 for my $oct0 (@{$range[0]}) {
1263 0 for my $oct1 (@{$range[1]}) {
1264 0 push @chars2, pack 'CC', $oct0,$oct1;
1265 }
1266 }
1267 }
1268 }
1269 0 return @chars2;
1270 }
1271  
1272 # 3 octets characters
1273 422 my @chars3 = ();
1274 0 ▶sub chars3 {
Subroutine chars3: not called CC=7 SCAR=40.3
Pod undocumented
1275 0 ▶ if (@chars3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars3) 0 0 0
1276 0 return @chars3;
1277 }
1278 0 ▶ if (exists $range_tr{3}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{3}) 0 0 0
1279 0 my @ranges = @{ $range_tr{3} };
1280 0 ▶ while (my @range = splice(@ranges,0,3)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 3)) 0 0 0
1281 0 for my $oct0 (@{$range[0]}) {
1282 0 for my $oct1 (@{$range[1]}) {
1283 0 for my $oct2 (@{$range[2]}) {
1284 0 push @chars3, pack 'CCC', $oct0,$oct1,$oct2;
1285 }
1286 }
1287 }
1288 }
1289 }
1290 0 return @chars3;
1291 }
1292  
1293 # 4 octets characters
1294 422 my @chars4 = ();
1295 0 ▶sub chars4 {
Subroutine chars4: not called CC=8 SCAR=42.8
Pod undocumented
1296 0 ▶ if (@chars4) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars4) 0 0 0
1297 0 return @chars4;
1298 }
1299 0 ▶ if (exists $range_tr{4}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{4}) 0 0 0
1300 0 my @ranges = @{ $range_tr{4} };
1301 0 ▶ while (my @range = splice(@ranges,0,4)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 4)) 0 0 0
1302 0 for my $oct0 (@{$range[0]}) {
1303 0 for my $oct1 (@{$range[1]}) {
1304 0 for my $oct2 (@{$range[2]}) {
1305 0 for my $oct3 (@{$range[3]}) {
1306 0 push @chars4, pack 'CCCC', $oct0,$oct1,$oct2,$oct3;
1307 }
1308 }
1309 }
1310 }
1311 }
1312 }
1313 0 return @chars4;
1314 }
1315  
1316 #
1317 # Latin-1 open character list for tr
1318 #
1319 12 ▶sub _charlist_tr {
Subroutine _charlist_tr: called CC=35 SCAR=66.4
1320  
1321 12 local $_ = shift @_;
1322  
1323 # unescape character
1324 12 my @char = ();
1325 12 ▶ while (not /\G \z/oxmsgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgmosx) 38 12 50
1326 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 \\ ($Elatin1::q_char) /cgmosx) { } 0 38 38
elsif (/\G ($Elatin1::q_char) /cgmosx) { } 38 0 38
1327 0 push @char, '\-';
1328 }
1329 elsif (/\G \\ ([0-7]{2,3}) /oxmsgc) {
1330 0 push @char, CORE::chr(oct $1);
1331 }
1332 elsif (/\G \\x ([0-9A-Fa-f]{1,2}) /oxmsgc) {
1333 0 push @char, CORE::chr(hex $1);
1334 }
1335 elsif (/\G \\c ([\x40-\x5F]) /oxmsgc) {
1336 0 push @char, CORE::chr(CORE::ord($1) & 0x1F);
1337 }
1338 elsif (/\G (\\ [0nrtfbae]) /oxmsgc) {
1339 push @char, {
1340 '\0' => "\0",
1341 '\n' => "\n",
1342 '\r' => "\r",
1343 '\t' => "\t",
1344 '\f' => "\f",
1345 '\b' => "\x08", # \b means backspace in character class
1346 '\a' => "\a",
1347 '\e' => "\e",
1348 0 }->{$1};
1349 }
1350 elsif (/\G \\ ($q_char) /oxmsgc) {
1351 0 push @char, $1;
1352 }
1353 elsif (/\G ($q_char) /oxmsgc) {
1354 38 push @char, $1;
1355 }
1356 }
1357  
1358 # join separated multiple-octet
1359 12 @char = join('',@char) =~ /\G (?>\\-|$q_char) /oxmsg;
1360  
1361 # unescape '-'
1362 12 my @i = ();
1363 12 for my $i (0 .. $#char) {
1364 38 ▶ if ($char[$i] eq '\-') {
Branch: 2 branches
BranchTrueFalseTotal
if ($char[$i] eq '\\-') { } 0 38 38
elsif ($char[$i] eq '-') { } 0 38 38
1365 0 $char[$i] = '-';
1366 }
1367 elsif ($char[$i] eq '-') {
1368 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
1369 0 push @i, $i;
1370 }
1371 }
1372 }
1373  
1374 # open character list (reverse for splice)
1375 12 for my $i (CORE::reverse @i) {
1376 0 my @range = ();
1377  
1378 # range error
1379 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
1380 0 croak "Invalid tr/// range \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1381 }
1382  
1383 # range of multiple-octet code
1384 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
1385 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
1386 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
1387 }
1388 elsif (CORE::length($char[$i+1]) == 2) {
1389 0 push @range, grep {$char[$i-1] le $_} chars1();
1390 0 push @range, grep {$_ le $char[$i+1]} chars2();
1391 }
1392 elsif (CORE::length($char[$i+1]) == 3) {
1393 0 push @range, grep {$char[$i-1] le $_} chars1();
1394 0 push @range, chars2();
1395 0 push @range, grep {$_ le $char[$i+1]} chars3();
1396 }
1397 elsif (CORE::length($char[$i+1]) == 4) {
1398 0 push @range, grep {$char[$i-1] le $_} chars1();
1399 0 push @range, chars2();
1400 0 push @range, chars3();
1401 0 push @range, grep {$_ le $char[$i+1]} chars4();
1402 }
1403 else {
1404 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1405 }
1406 }
1407 elsif (CORE::length($char[$i-1]) == 2) {
1408 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
1409 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
1410 }
1411 elsif (CORE::length($char[$i+1]) == 3) {
1412 0 push @range, grep {$char[$i-1] le $_} chars2();
1413 0 push @range, grep {$_ le $char[$i+1]} chars3();
1414 }
1415 elsif (CORE::length($char[$i+1]) == 4) {
1416 0 push @range, grep {$char[$i-1] le $_} chars2();
1417 0 push @range, chars3();
1418 0 push @range, grep {$_ le $char[$i+1]} chars4();
1419 }
1420 else {
1421 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1422 }
1423 }
1424 elsif (CORE::length($char[$i-1]) == 3) {
1425 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
1426 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
1427 }
1428 elsif (CORE::length($char[$i+1]) == 4) {
1429 0 push @range, grep {$char[$i-1] le $_} chars3();
1430 0 push @range, grep {$_ le $char[$i+1]} chars4();
1431 }
1432 else {
1433 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1434 }
1435 }
1436 elsif (CORE::length($char[$i-1]) == 4) {
1437 0 ▶ if (CORE::length($char[$i+1]) == 4) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $char[$i + 1] == 4) { } 0 0 0
1438 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
1439 }
1440 else {
1441 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1442 }
1443 }
1444 else {
1445 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1446 }
1447  
1448 0 splice @char, $i-1, 3, @range;
1449 }
1450  
1451 12 return @char;
1452 }
1453  
1454 #
1455 # Latin-1 open character class
1456 #
1457 0 ▶sub _cc {
Subroutine _cc: not called CC=7 SCAR=40.3
1458 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
1459 0 die __FILE__, ": subroutine cc got no parameter.\n";
1460 }
1461 elsif (scalar(@_) == 1) {
1462 0 return sprintf('\x%02X',$_[0]);
1463 }
1464 elsif (scalar(@_) == 2) {
1465 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
1466 0 die __FILE__, ": subroutine cc got \$_[0] > \$_[1] parameters).\n";
1467 }
1468 elsif ($_[0] == $_[1]) {
1469 0 return sprintf('\x%02X',$_[0]);
1470 }
1471 elsif (($_[0]+1) == $_[1]) {
1472 0 return sprintf('[\\x%02X\\x%02X]',$_[0],$_[1]);
1473 }
1474 else {
1475 0 return sprintf('[\\x%02X-\\x%02X]',$_[0],$_[1]);
1476 }
1477 }
1478 else {
1479 0 die __FILE__, ": subroutine cc got 3 or more parameters (@{[scalar(@_)]} parameters).\n";
1480 }
1481 }
1482  
1483 #
1484 # Latin-1 octet range
1485 #
1486 246 ▶sub _octets {
Subroutine _octets: called CC=5 SCAR=19.3
1487 246 my $length = shift @_;
1488  
1489 246 ▶ if ($length == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length == 1) { } 246 0 246
1490 246 my($a1) = unpack 'C', $_[0];
1491 246 my($z1) = unpack 'C', $_[1];
1492  
1493 246 ▶ if ($a1 > $z1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($a1 > $z1) 0 246 246
1494 0 croak 'Invalid [] range in regexp (CORE::ord(A) > CORE::ord(B)) ' . '\x' . unpack('H*',$a1) . '-\x' . unpack('H*',$z1);
1495 }
1496  
1497 246 ▶ if ($a1 == $z1) {
Branch: 2 branches
BranchTrueFalseTotal
if ($a1 == $z1) { } 0 246 246
elsif ($a1 + 1 == $z1) { } 0 246 246
1498 0 return sprintf('\x%02X',$a1);
1499 }
1500 elsif (($a1+1) == $z1) {
1501 0 return sprintf('\x%02X\x%02X',$a1,$z1);
1502 }
1503 else {
1504 246 return sprintf('\x%02X-\x%02X',$a1,$z1);
1505 }
1506 }
1507 else {
1508 0 die __FILE__, ": subroutine _octets got invalid length ($length).\n";
1509 }
1510 }
1511  
1512 #
1513 # Latin-1 range regexp
1514 #
1515 246 ▶sub _range_regexp {
Subroutine _range_regexp: called CC=18 SCAR=41.7
1516 246 my($length,$first,$last) = @_;
1517  
1518 246 my @range_regexp = ();
1519 246 ▶ if (not exists $range_tr{$length}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $range_tr{$length}) 0 246 246
1520 0 return @range_regexp;
1521 }
1522  
1523 246 my @ranges = @{ $range_tr{$length} };
1524 246 ▶ while (my @range = splice(@ranges,0,$length)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, $length)) 246 246 492
1525 246 my $min = '';
1526 246 my $max = '';
1527 246 ▶ for (my $i=0; $i < $length; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $length) 246 246 492
1528 246 $min .= pack 'C', $range[$i][0];
1529 246 $max .= pack 'C', $range[$i][-1];
1530 }
1531  
1532 # min___max
1533 # FIRST_____________LAST
1534 # (nothing)
1535  
1536 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
1537 }
1538  
1539 # **********
1540 # min_________max
1541 # FIRST_____________LAST
1542 # **********
1543  
1544 ▶ 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
1545 0 push @range_regexp, _octets($length,$first,$max,$min,$max);
1546 }
1547  
1548 # **********************
1549 # min________________max
1550 # FIRST_____________LAST
1551 # **********************
1552  
1553 ▶ 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
1554 0 push @range_regexp, _octets($length,$first,$last,$min,$max);
1555 }
1556  
1557 # *********
1558 # min___max
1559 # FIRST_____________LAST
1560 # *********
1561  
1562 ▶ 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
1563 0 push @range_regexp, _octets($length,$min,$max,$min,$max);
1564 }
1565  
1566 # **********************
1567 # min__________________________max
1568 # FIRST_____________LAST
1569 # **********************
1570  
1571 ▶ 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
1572 246 push @range_regexp, _octets($length,$first,$last,$min,$max);
1573 }
1574  
1575 # *********
1576 # min________max
1577 # FIRST_____________LAST
1578 # *********
1579  
1580 ▶ 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
1581 0 push @range_regexp, _octets($length,$min,$last,$min,$max);
1582 }
1583  
1584 # min___max
1585 # FIRST_____________LAST
1586 # (nothing)
1587  
1588 elsif ($last lt $min) {
1589 }
1590  
1591 else {
1592 0 die __FILE__, ": subroutine _range_regexp panic.\n";
1593 }
1594 }
1595  
1596 246 return @range_regexp;
1597 }
1598  
1599 #
1600 # Latin-1 open character list for qr and not qr
1601 #
1602 650 ▶sub _charlist {
Subroutine _charlist: called CC=46 SCAR=45.9
1603  
1604 650 my $modifier = pop @_;
1605 650 my @char = @_;
1606  
1607 650 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 298 352 650
1608  
1609 # unescape character
1610 650 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1773 650 2423
1611  
1612 # escape - to ...
1613 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 \\ ($Elatin1::q_char) \z/mosx) { } 7 1371 1378
1614 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
1615 246 $char[$i] = '...';
1616 }
1617 }
1618  
1619 # octal escape sequence
1620 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
1621 0 $char[$i] = octchr($1);
1622 }
1623  
1624 # hexadecimal escape sequence
1625 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
1626 0 $char[$i] = hexchr($1);
1627 }
1628  
1629 # \b{...} --> b\{...}
1630 # \B{...} --> B\{...}
1631 # \N{CHARNAME} --> N\{CHARNAME}
1632 # \p{PROPERTY} --> p\{PROPERTY}
1633 # \P{PROPERTY} --> P\{PROPERTY}
1634 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
1635 0 $char[$i] = $1 . '\\' . $2;
1636 }
1637  
1638 # \p, \P, \X --> p, P, X
1639 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
1640 0 $char[$i] = $1;
1641 }
1642  
1643 elsif ($char[$i] =~ /\A \\ ([0-7]{2,3}) \z/oxms) {
1644 0 $char[$i] = CORE::chr oct $1;
1645 }
1646 elsif ($char[$i] =~ /\A \\x ([0-9A-Fa-f]{1,2}) \z/oxms) {
1647 22 $char[$i] = CORE::chr hex $1;
1648 }
1649 elsif ($char[$i] =~ /\A \\c ([\x40-\x5F]) \z/oxms) {
1650 0 $char[$i] = CORE::chr(CORE::ord($1) & 0x1F);
1651 }
1652 elsif ($char[$i] =~ /\A (\\ [0nrtfbaedswDSWHVhvR]) \z/oxms) {
1653 $char[$i] = {
1654 '\0' => "\0",
1655 '\n' => "\n",
1656 '\r' => "\r",
1657 '\t' => "\t",
1658 '\f' => "\f",
1659 '\b' => "\x08", # \b means backspace in character class
1660 '\a' => "\a",
1661 '\e' => "\e",
1662 '\d' => '[0-9]',
1663  
1664 # Vertical tabs are now whitespace
1665 # \s in a regex now matches a vertical tab in all circumstances.
1666 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
1667 # \t \n \v \f \r space
1668 # '\s' => '[\x09\x0A \x0C\x0D\x20]',
1669 # '\s' => '[\x09\x0A\x0B\x0C\x0D\x20]',
1670 '\s' => '\s',
1671  
1672 '\w' => '[0-9A-Z_a-z]',
1673 '\D' => '${Elatin1::eD}',
1674 '\S' => '${Elatin1::eS}',
1675 '\W' => '${Elatin1::eW}',
1676  
1677 '\H' => '${Elatin1::eH}',
1678 '\V' => '${Elatin1::eV}',
1679 '\h' => '[\x09\x20]',
1680 '\v' => '[\x0A\x0B\x0C\x0D]',
1681 '\R' => '${Elatin1::eR}',
1682  
1683 25 }->{$1};
1684 }
1685  
1686 # POSIX-style character classes
1687 ▶ 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
1688 $char[$i] = {
1689  
1690 '[:lower:]' => '[\x41-\x5A\x61-\x7A]',
1691 '[:upper:]' => '[\x41-\x5A\x61-\x7A]',
1692 '[:^lower:]' => '${Elatin1::not_lower_i}',
1693 '[:^upper:]' => '${Elatin1::not_upper_i}',
1694  
1695 8 }->{$1};
1696 }
1697 elsif ($char[$i] =~ /\A ( \[\: \^? (?:alnum|alpha|ascii|blank|cntrl|digit|graph|lower|print|punct|space|upper|word|xdigit) :\] ) \z/oxms) {
1698 $char[$i] = {
1699  
1700 '[:alnum:]' => '[\x30-\x39\x41-\x5A\x61-\x7A]',
1701 '[:alpha:]' => '[\x41-\x5A\x61-\x7A]',
1702 '[:ascii:]' => '[\x00-\x7F]',
1703 '[:blank:]' => '[\x09\x20]',
1704 '[:cntrl:]' => '[\x00-\x1F\x7F]',
1705 '[:digit:]' => '[\x30-\x39]',
1706 '[:graph:]' => '[\x21-\x7F]',
1707 '[:lower:]' => '[\x61-\x7A]',
1708 '[:print:]' => '[\x20-\x7F]',
1709 '[:punct:]' => '[\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E]',
1710  
1711 # P.174 POSIX-Style Character Classes
1712 # in Chapter 5: Pattern Matching
1713 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
1714  
1715 # P.311 11.2.4 Character Classes and other Special Escapes
1716 # in Chapter 11: perlre: Perl regular expressions
1717 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
1718  
1719 # P.210 POSIX-Style Character Classes
1720 # in Chapter 5: Pattern Matching
1721 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1722  
1723 '[:space:]' => '[\s\x0B]', # "\s" plus vertical tab ("\cK")
1724  
1725 '[:upper:]' => '[\x41-\x5A]',
1726 '[:word:]' => '[\x30-\x39\x41-\x5A\x5F\x61-\x7A]',
1727 '[:xdigit:]' => '[\x30-\x39\x41-\x46\x61-\x66]',
1728 '[:^alnum:]' => '${Elatin1::not_alnum}',
1729 '[:^alpha:]' => '${Elatin1::not_alpha}',
1730 '[:^ascii:]' => '${Elatin1::not_ascii}',
1731 '[:^blank:]' => '${Elatin1::not_blank}',
1732 '[:^cntrl:]' => '${Elatin1::not_cntrl}',
1733 '[:^digit:]' => '${Elatin1::not_digit}',
1734 '[:^graph:]' => '${Elatin1::not_graph}',
1735 '[:^lower:]' => '${Elatin1::not_lower}',
1736 '[:^print:]' => '${Elatin1::not_print}',
1737 '[:^punct:]' => '${Elatin1::not_punct}',
1738 '[:^space:]' => '${Elatin1::not_space}',
1739 '[:^upper:]' => '${Elatin1::not_upper}',
1740 '[:^word:]' => '${Elatin1::not_word}',
1741 '[:^xdigit:]' => '${Elatin1::not_xdigit}',
1742  
1743 70 }->{$1};
1744 }
1745 elsif ($char[$i] =~ /\A \\ ($q_char) \z/oxms) {
1746 7 $char[$i] = $1;
1747 }
1748 }
1749  
1750 # open character list
1751 650 my @singleoctet = ();
1752 650 my @multipleoctet = ();
1753 650 ▶ for (my $i=0; $i <= $#char; ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1527 650 2177
1754  
1755 # escaped -
1756 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
1757 246 $i += 1;
1758 246 next;
1759 }
1760  
1761 # make range regexp
1762 elsif ($char[$i] eq '...') {
1763  
1764 # range error
1765 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
1766 0 croak 'Invalid [] range in regexp (length(A) > length(B)) ' . '\x' . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]);
1767 }
1768 elsif (CORE::length($char[$i-1]) == CORE::length($char[$i+1])) {
1769 246 ▶ if ($char[$i-1] gt $char[$i+1]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i - 1] gt $char[$i + 1]) 0 246 246
1770 0 croak 'Invalid [] range in regexp (CORE::ord(A) > CORE::ord(B)) ' . '\x' . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]);
1771 }
1772 }
1773  
1774 # make range regexp per length
1775 246 for my $length (CORE::length($char[$i-1]) .. CORE::length($char[$i+1])) {
1776 246 my @regexp = ();
1777  
1778 # is first and last
1779 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
1780 246 push @regexp, _range_regexp($length, $char[$i-1], $char[$i+1]);
1781 }
1782  
1783 # is first
1784 elsif ($length == CORE::length($char[$i-1])) {
1785 0 push @regexp, _range_regexp($length, $char[$i-1], "\xFF" x $length);
1786 }
1787  
1788 # is inside in first and last
1789 ▶ 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
1790 0 push @regexp, _range_regexp($length, "\x00" x $length, "\xFF" x $length);
1791 }
1792  
1793 # is last
1794 elsif ($length == CORE::length($char[$i+1])) {
1795 0 push @regexp, _range_regexp($length, "\x00" x $length, $char[$i+1]);
1796 }
1797  
1798 else {
1799 0 die __FILE__, ": subroutine make_regexp panic.\n";
1800 }
1801  
1802 246 ▶ if ($length == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length == 1) { } 246 0 246
1803 246 push @singleoctet, @regexp;
1804 }
1805 else {
1806 0 push @multipleoctet, @regexp;
1807 }
1808 }
1809  
1810 246 $i += 2;
1811 }
1812  
1813 # with /i modifier
1814 elsif ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) {
1815 949 ▶ if ($modifier =~ /i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) { } 480 469 949
1816 480 my $uc = Elatin1::uc($char[$i]);
1817 480 my $fc = Elatin1::fc($char[$i]);
1818 480 ▶ if ($uc ne $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc ne $fc) { } 240 240 480
1819 240 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 240 0 240
1820 240 push @singleoctet, $uc, $fc;
1821 }
1822 else {
1823 0 push @singleoctet, $uc;
1824 0 push @multipleoctet, $fc;
1825 }
1826 }
1827 else {
1828 240 push @singleoctet, $char[$i];
1829 }
1830 }
1831 else {
1832 469 push @singleoctet, $char[$i];
1833 }
1834 949 $i += 1;
1835 }
1836  
1837 # single character of single octet code
1838 elsif ($char[$i] =~ /\A (?: \\h ) \z/oxms) {
1839 0 push @singleoctet, "\t", "\x20";
1840 0 $i += 1;
1841 }
1842 elsif ($char[$i] =~ /\A (?: \\v ) \z/oxms) {
1843 0 push @singleoctet, "\x0A", "\x0B", "\x0C", "\x0D";
1844 0 $i += 1;
1845 }
1846 elsif ($char[$i] =~ /\A (?: \\d | \\s | \\w ) \z/oxms) {
1847 2 push @singleoctet, $char[$i];
1848 2 $i += 1;
1849 }
1850  
1851 # single character of multiple-octet code
1852 else {
1853 84 push @multipleoctet, $char[$i];
1854 84 $i += 1;
1855 }
1856 }
1857  
1858 # quote metachar
1859 650 for (@singleoctet) {
1860 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
1861 0 $_ = '-';
1862 }
1863 elsif (/\A \n \z/oxms) {
1864 8 $_ = '\n';
1865 }
1866 elsif (/\A \r \z/oxms) {
1867 8 $_ = '\r';
1868 }
1869 elsif (/\A ([\x00-\x20\x7F-\xFF]) \z/oxms) {
1870 744 $_ = sprintf('\x%02X', CORE::ord $1);
1871 }
1872 elsif (/\A [\x00-\xFF] \z/oxms) {
1873 429 $_ = quotemeta $_;
1874 }
1875 }
1876  
1877 # return character list
1878 650 return \@singleoctet, \@multipleoctet;
1879 }
1880  
1881 #
1882 # Latin-1 octal escape sequence
1883 #
1884 5 ▶sub octchr {
Subroutine octchr: called CC=2 SCAR=6.9
Pod undocumented
1885 5 my($octdigit) = @_;
1886  
1887 5 my @binary = ();
1888 5 for my $octal (split(//,$octdigit)) {
1889 push @binary, {
1890 '0' => '000',
1891 '1' => '001',
1892 '2' => '010',
1893 '3' => '011',
1894 '4' => '100',
1895 '5' => '101',
1896 '6' => '110',
1897 '7' => '111',
1898 50 }->{$octal};
1899 }
1900 5 my $binary = join '', @binary;
1901  
1902 my $octchr = {
1903 # 1234567
1904 1 => pack('B*', "0000000$binary"),
1905 2 => pack('B*', "000000$binary"),
1906 3 => pack('B*', "00000$binary"),
1907 4 => pack('B*', "0000$binary"),
1908 5 => pack('B*', "000$binary"),
1909 6 => pack('B*', "00$binary"),
1910 7 => pack('B*', "0$binary"),
1911 0 => pack('B*', "$binary"),
1912  
1913 5 }->{CORE::length($binary) % 8};
1914  
1915 5 return $octchr;
1916 }
1917  
1918 #
1919 # Latin-1 hexadecimal escape sequence
1920 #
1921 5 ▶sub hexchr {
Subroutine hexchr: called CC=1 SCAR=0.0
Pod undocumented
1922 5 my($hexdigit) = @_;
1923  
1924 my $hexchr = {
1925 1 => pack('H*', "0$hexdigit"),
1926 0 => pack('H*', "$hexdigit"),
1927  
1928 5 }->{CORE::length($_[0]) % 2};
1929  
1930 5 return $hexchr;
1931 }
1932  
1933 #
1934 # Latin-1 open character list for qr
1935 #
1936 576 ▶sub charlist_qr {
Subroutine charlist_qr: called CC=17 SCAR=28.7
Pod undocumented
1937  
1938 576 my $modifier = pop @_;
1939 576 my @char = @_;
1940  
1941 576 my($singleoctet, $multipleoctet) = _charlist(@char, $modifier);
1942 576 my @singleoctet = @$singleoctet;
1943 576 my @multipleoctet = @$multipleoctet;
1944  
1945 # return character list
1946 576 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) 498 78 576
1947  
1948 # with /i modifier
1949 498 ▶ if ($modifier =~ m/i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) 265 233 498
1950 265 my %singleoctet_ignorecase = ();
1951 265 for (@singleoctet) {
1952 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
1953 745 for my $ord (hex($1) .. hex($2)) {
1954 795 my $char = CORE::chr($ord);
1955 795 my $uc = Elatin1::uc($char);
1956 795 my $fc = Elatin1::fc($char);
1957 795 ▶ if ($uc eq $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc eq $fc) { } 240 555 795
1958 240 $singleoctet_ignorecase{unpack 'C*', $char} = 1;
1959 }
1960 else {
1961 555 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 555 0 555
1962 555 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
1963 555 $singleoctet_ignorecase{unpack 'C*', $fc} = 1;
1964 }
1965 else {
1966 0 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
1967 0 push @multipleoctet, join '', map {sprintf('\x%02X',$_)} unpack 'C*', $fc;
1968 }
1969 }
1970 }
1971 }
1972 745 ▶ if ($_ ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ ne "") 0 745 745
1973 0 $singleoctet_ignorecase{unpack 'C*', $_} = 1;
1974 }
1975 }
1976 265 my $i = 0;
1977 265 my @singleoctet_ignorecase = ();
1978 265 for my $ord (0 .. 255) {
1979 67840 ▶ if (exists $singleoctet_ignorecase{$ord}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $singleoctet_ignorecase{$ord}) { } 870 66970 67840
1980 870 push @{$singleoctet_ignorecase[$i]}, $ord;
1981 }
1982 else {
1983 66970 $i++;
1984 }
1985 }
1986 265 @singleoctet = ();
1987 265 for my $range (@singleoctet_ignorecase) {
1988 56160 ▶ if (ref $range) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $range) 770 55390 56160
1989 770 ▶ if (scalar(@{$range}) == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @{$range;} == 1) { } 720 50 770
elsif (scalar @{$range;} == 2) { } 0 50 50
1990 720 push @singleoctet, sprintf('\x%02X', @{$range}[0]);
1991 }
1992 50 elsif (scalar(@{$range}) == 2) {
1993 0 push @singleoctet, sprintf('\x%02X\x%02X', @{$range}[0], @{$range}[-1]);
1994 }
1995 else {
1996 50 push @singleoctet, sprintf('\x%02X-\x%02X', @{$range}[0], @{$range}[-1]);
1997 }
1998 }
1999 }
2000 }
2001  
2002 498 my $not_anchor = '';
2003  
2004 498 push @multipleoctet, join('', $not_anchor, '[', @singleoctet, ']' );
2005 }
2006 576 ▶ if (scalar(@multipleoctet) >= 2) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @multipleoctet >= 2) { } 6 570 576
2007 6 return '(?:' . join('|', @multipleoctet) . ')';
2008 }
2009 else {
2010 570 return $multipleoctet[0];
2011 }
2012 }
2013  
2014 #
2015 # Latin-1 open character list for not qr
2016 #
2017 74 ▶sub charlist_not_qr {
Subroutine charlist_not_qr: called CC=18 SCAR=33.1
Pod undocumented
2018  
2019 74 my $modifier = pop @_;
2020 74 my @char = @_;
2021  
2022 74 my($singleoctet, $multipleoctet) = _charlist(@char, $modifier);
2023 74 my @singleoctet = @$singleoctet;
2024 74 my @multipleoctet = @$multipleoctet;
2025  
2026 # with /i modifier
2027 74 ▶ if ($modifier =~ m/i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) 25 49 74
2028 25 my %singleoctet_ignorecase = ();
2029 25 for (@singleoctet) {
2030 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
2031 25 for my $ord (hex($1) .. hex($2)) {
2032 75 my $char = CORE::chr($ord);
2033 75 my $uc = Elatin1::uc($char);
2034 75 my $fc = Elatin1::fc($char);
2035 75 ▶ if ($uc eq $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc eq $fc) { } 0 75 75
2036 0 $singleoctet_ignorecase{unpack 'C*', $char} = 1;
2037 }
2038 else {
2039 75 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 75 0 75
2040 75 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2041 75 $singleoctet_ignorecase{unpack 'C*', $fc} = 1;
2042 }
2043 else {
2044 0 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2045 0 push @multipleoctet, join '', map {sprintf('\x%02X',$_)} unpack 'C*', $fc;
2046 }
2047 }
2048 }
2049 }
2050 25 ▶ if ($_ ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ ne "") 0 25 25
2051 0 $singleoctet_ignorecase{unpack 'C*', $_} = 1;
2052 }
2053 }
2054 25 my $i = 0;
2055 25 my @singleoctet_ignorecase = ();
2056 25 for my $ord (0 .. 255) {
2057 6400 ▶ if (exists $singleoctet_ignorecase{$ord}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $singleoctet_ignorecase{$ord}) { } 150 6250 6400
2058 150 push @{$singleoctet_ignorecase[$i]}, $ord;
2059 }
2060 else {
2061 6250 $i++;
2062 }
2063 }
2064 25 @singleoctet = ();
2065 25 for my $range (@singleoctet_ignorecase) {
2066 2400 ▶ if (ref $range) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $range) 50 2350 2400
2067 50 ▶ if (scalar(@{$range}) == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @{$range;} == 1) { } 0 50 50
elsif (scalar @{$range;} == 2) { } 0 50 50
2068 0 push @singleoctet, sprintf('\x%02X', @{$range}[0]);
2069 }
2070 50 elsif (scalar(@{$range}) == 2) {
2071 0 push @singleoctet, sprintf('\x%02X\x%02X', @{$range}[0], @{$range}[-1]);
2072 }
2073 else {
2074 50 push @singleoctet, sprintf('\x%02X-\x%02X', @{$range}[0], @{$range}[-1]);
2075 }
2076 }
2077 }
2078 }
2079  
2080 # return character list
2081 74 ▶ if (scalar(@multipleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @multipleoctet >= 1) { } 0 74 74
2082 0 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) { } 0 0 0
2083  
2084 # any character other than multiple-octet and single octet character class
2085 0 return '(?!' . join('|', @multipleoctet) . ')(?:[^' . join('', @singleoctet) . '])';
2086 }
2087 else {
2088  
2089 # any character other than multiple-octet character class
2090 0 return '(?!' . join('|', @multipleoctet) . ")(?:$your_char)";
2091 }
2092 }
2093 else {
2094 74 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) { } 74 0 74
2095  
2096 # any character other than single octet character class
2097 74 return '(?:[^' . join('', @singleoctet) . '])';
2098 }
2099 else {
2100  
2101 # any character
2102 0 return "(?:$your_char)";
2103 }
2104 }
2105 }
2106  
2107 #
2108 # open file in read mode
2109 #
2110 422 ▶sub _open_r {
Subroutine _open_r: called CC=1 SCAR=0.0
2111 422 my(undef,$file) = @_;
2112 422 ▶ use Fcntl qw(O_RDONLY);
Subroutine BEGIN: called CC=1 SCAR=0.0
2113 422 return CORE::sysopen($_[0], $file, &O_RDONLY);
2114 }
2115  
2116 #
2117 # open file in append mode
2118 #
2119 211 ▶sub _open_a {
Subroutine _open_a: called CC=1 SCAR=0.0
2120 211 my(undef,$file) = @_;
2121 422 ▶ use Fcntl qw(O_WRONLY O_APPEND O_CREAT);
Subroutine BEGIN: called CC=1 SCAR=0.0
2122 211 return CORE::sysopen($_[0], $file, &O_WRONLY|&O_APPEND|&O_CREAT);
2123 }
2124  
2125 #
2126 # safe system
2127 #
2128 211 ▶sub _systemx {
Subroutine _systemx: called CC=1 SCAR=0.0
2129  
2130 # P.707 29.2.33. exec
2131 # in Chapter 29: Functions
2132 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2133 #
2134 # Be aware that in older releases of Perl, exec (and system) did not flush
2135 # your output buffer, so you needed to enable command buffering by setting $|
2136 # on one or more filehandles to avoid lost output in the case of exec, or
2137 # misordererd output in the case of system. This situation was largely remedied
2138 # in the 5.6 release of Perl. (So, 5.005 release not yet.)
2139  
2140 # P.855 exec
2141 # in Chapter 27: Functions
2142 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2143 #
2144 # In very old release of Perl (before v5.6), exec (and system) did not flush
2145 # your output buffer, so you needed to enable command buffering by setting $|
2146 # on one or more filehandles to avoid lost output with exec or misordered
2147 # output with system.
2148  
2149 211 $| = 1;
2150  
2151 # P.565 23.1.2. Cleaning Up Your Environment
2152 # in Chapter 23: Security
2153 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2154  
2155 # P.656 Cleaning Up Your Environment
2156 # in Chapter 20: Security
2157 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2158  
2159 # local $ENV{'PATH'} = '.';
2160 211 local @ENV{qw(IFS CDPATH ENV BASH_ENV)}; # Make %ENV safer
2161  
2162 # P.707 29.2.33. exec
2163 # in Chapter 29: Functions
2164 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2165 #
2166 # As we mentioned earlier, exec treats a discrete list of arguments as an
2167 # indication that it should bypass shell processing. However, there is one
2168 # place where you might still get tripped up. The exec call (and system, too)
2169 # will not distinguish between a single scalar argument and an array containing
2170 # only one element.
2171 #
2172 # @args = ("echo surprise"); # just one element in list
2173 # exec @args # still subject to shell escapes
2174 # or die "exec: $!"; # because @args == 1
2175 #
2176 # To avoid this, you can use the PATHNAME syntax, explicitly duplicating the
2177 # first argument as the pathname, which forces the rest of the arguments to be
2178 # interpreted as a list, even if there is only one of them:
2179 #
2180 # exec { $args[0] } @args # safe even with one-argument list
2181 # or die "can't exec @args: $!";
2182  
2183 # P.855 exec
2184 # in Chapter 27: Functions
2185 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2186 #
2187 # As we mentioned earlier, exec treats a discrete list of arguments as a
2188 # directive to bypass shell processing. However, there is one place where
2189 # you might still get tripped up. The exec call (and system, too) cannot
2190 # distinguish between a single scalar argument and an array containing
2191 # only one element.
2192 #
2193 # @args = ("echo surprise"); # just one element in list
2194 # exec @args # still subject to shell escapes
2195 # || die "exec: $!"; # because @args == 1
2196 #
2197 # To avoid this, use the PATHNAME syntax, explicitly duplicating the first
2198 # argument as the pathname, which forces the rest of the arguments to be
2199 # interpreted as a list, even if there is only one of them:
2200 #
2201 # exec { $args[0] } @args # safe even with one-argument list
2202 # || die "can't exec @args: $!";
2203  
2204 211 return CORE::system { $_[0] } @_; # safe even with one-argument list
2205 }
2206  
2207 #
2208 # Latin-1 order to character (with parameter)
2209 #
2210 3469 ▶sub Elatin1::chr(;$) {
Subroutine chr: called CC=4 SCAR=13.9
Pod undocumented
2211  
2212 3469 ▶ my $c = @_ ? $_[0] : $_;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 3469 0 3469
2213  
2214 3469 ▶ if ($c == 0x00) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c == 0) { } 24 3445 3469
2215 24 return "\x00";
2216 }
2217 else {
2218 3445 my @chr = ();
2219 3445 ▶ while ($c > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c > 0) 3445 3445 6890
2220 3445 unshift @chr, ($c % 0x100);
2221 3445 $c = int($c / 0x100);
2222 }
2223 3445 return pack 'C*', @chr;
2224 }
2225 }
2226  
2227 #
2228 # Latin-1 order to character (without parameter)
2229 #
2230 0 ▶sub Elatin1::chr_() {
Subroutine chr_: not called CC=3 SCAR=24.8
Pod undocumented
2231  
2232 0 my $c = $_;
2233  
2234 0 ▶ if ($c == 0x00) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c == 0) { } 0 0 0
2235 0 return "\x00";
2236 }
2237 else {
2238 0 my @chr = ();
2239 0 ▶ while ($c > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c > 0) 0 0 0
2240 0 unshift @chr, ($c % 0x100);
2241 0 $c = int($c / 0x100);
2242 }
2243 0 return pack 'C*', @chr;
2244 }
2245 }
2246  
2247 #
2248 # Latin-1 path globbing (with parameter)
2249 #
2250 0 ▶sub Elatin1::glob($) {
Subroutine glob: not called CC=3 SCAR=24.8
Pod undocumented
2251  
2252 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2253 0 my @glob = _DOS_like_glob(@_);
2254 0 for my $glob (@glob) {
2255 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2256 }
2257 0 return @glob;
2258 }
2259 else {
2260 0 my $glob = _DOS_like_glob(@_);
2261 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2262 0 return $glob;
2263 }
2264 }
2265  
2266 #
2267 # Latin-1 path globbing (without parameter)
2268 #
2269 0 ▶sub Elatin1::glob_() {
Subroutine glob_: not called CC=3 SCAR=24.8
Pod undocumented
2270  
2271 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2272 0 my @glob = _DOS_like_glob();
2273 0 for my $glob (@glob) {
2274 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2275 }
2276 0 return @glob;
2277 }
2278 else {
2279 0 my $glob = _DOS_like_glob();
2280 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2281 0 return $glob;
2282 }
2283 }
2284  
2285 #
2286 # Latin-1 path globbing via File::DosGlob 1.10
2287 #
2288 # Often I confuse "_dosglob" and "_doglob".
2289 # So, I renamed "_dosglob" to "_DOS_like_glob".
2290 #
2291 422 my %iter;
2292 my %entries;
2293 0 ▶sub _DOS_like_glob {
Subroutine _DOS_like_glob: not called CC=10 SCAR=47.0
2294  
2295 # context (keyed by second cxix argument provided by core)
2296 0 my($expr,$cxix) = @_;
2297  
2298 # glob without args defaults to $_
2299 0 ▶ $expr = $_ if not defined $expr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $expr 0 0 0
2300  
2301 # represents the current user's home directory
2302 #
2303 # 7.3. Expanding Tildes in Filenames
2304 # in Chapter 7. File Access
2305 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2306 #
2307 # and File::HomeDir, File::HomeDir::Windows module
2308  
2309 # DOS-like system
2310 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
2311 0 $expr =~ s{ \A ~ (?= [^/\\] ) }
2312 0 { my_home_MSWin32() }oxmse;
2313 }
2314  
2315 # UNIX-like system
2316 else {
2317 0 $expr =~ s{ \A ~ ( (?:[^/])* ) }
2318 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
2319 }
2320  
2321 # assume global context if not provided one
2322 0 ▶ $cxix = '_G_' if not defined $cxix;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $cxix 0 0 0
2323 0 ▶ $iter{$cxix} = 0 if not exists $iter{$cxix};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $iter{$cxix} 0 0 0
2324  
2325 # if we're just beginning, do it all first
2326 0 ▶ if ($iter{$cxix} == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iter{$cxix} == 0) 0 0 0
2327 0 $entries{$cxix} = [ _do_glob(1, _parse_line($expr)) ];
2328 }
2329  
2330 # chuck it all out, quick or slow
2331 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2332 0 delete $iter{$cxix};
2333 0 return @{delete $entries{$cxix}};
2334 }
2335 else {
2336 0 ▶ if ($iter{$cxix} = scalar @{$entries{$cxix}}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iter{$cxix} = scalar @{$entries{$cxix};}) { } 0 0 0
2337 0 return shift @{$entries{$cxix}};
2338 }
2339 else {
2340 # return undef for EOL
2341 0 delete $iter{$cxix};
2342 0 delete $entries{$cxix};
2343 0 return undef;
2344 }
2345 }
2346 }
2347  
2348 #
2349 # Latin-1 path globbing subroutine
2350 #
2351 0 ▶sub _do_glob {
Subroutine _do_glob: not called CC=44 SCAR=75.9
2352  
2353 0 my($cond,@expr) = @_;
2354 0 my @glob = ();
2355 0 my $fix_drive_relative_paths = 0;
2356  
2357 OUTER:
2358 0 for my $expr (@expr) {
2359 0 ▶ next OUTER if not defined $expr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $expr 0 0 0
2360 0 ▶ next OUTER if $expr eq '';
Branch: 1 branch
BranchTrueFalseTotal
if $expr eq "" 0 0 0
2361  
2362 0 my @matched = ();
2363 0 my @globdir = ();
2364 0 my $head = '.';
2365 0 my $pathsep = '/';
2366 0 my $tail;
2367  
2368 # if argument is within quotes strip em and do no globbing
2369 0 ▶ if ($expr =~ /\A " ((?:$q_char)*?) " \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expr =~ /\A " ((?:$Elatin1::q_char)*?) " \z/mosx) 0 0 0
2370 0 $expr = $1;
2371 0 ▶ if ($cond eq 'd') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cond eq 'd') { } 0 0 0
2372 0 ▶ if (-d $expr) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $expr) 0 0 0
2373 0 push @glob, $expr;
2374 }
2375 }
2376 else {
2377 0 ▶ if (-e $expr) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $expr) 0 0 0
2378 0 push @glob, $expr;
2379 }
2380 }
2381 0 next OUTER;
2382 }
2383  
2384 # wildcards with a drive prefix such as h:*.pm must be changed
2385 # to h:./*.pm to expand correctly
2386 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
2387 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
2388 0 $fix_drive_relative_paths = 1;
2389 }
2390 }
2391  
2392 0 ▶ if (($head, $tail) = _parse_path($expr,$pathsep)) {
Branch: 1 branch
BranchTrueFalseTotal
if (($head, $tail) = _parse_path($expr, $pathsep)) 0 0 0
2393 0 ▶ if ($tail eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($tail eq "") 0 0 0
2394 0 push @glob, $expr;
2395 0 next OUTER;
2396 }
2397 0 ▶ if ($head =~ / \A (?:$q_char)*? [*?] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head =~ / \A (?:$Elatin1::q_char)*? [*?] /mosx) 0 0 0
2398 0 ▶ if (@globdir = _do_glob('d', $head)) {
Branch: 1 branch
BranchTrueFalseTotal
if (@globdir = _do_glob("d", $head)) 0 0 0
2399 0 push @glob, _do_glob($cond, map {"$_$pathsep$tail"} @globdir);
2400 0 next OUTER;
2401 }
2402 }
2403 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
2404 0 $head .= $pathsep;
2405 }
2406 0 $expr = $tail;
2407 }
2408  
2409 # If file component has no wildcards, we can avoid opendir
2410 0 ▶ if ($expr !~ / \A (?:$q_char)*? [*?] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($expr =~ / \A (?:$Elatin1::q_char)*? [*?] /mosx) 0 0 0
2411 0 ▶ if ($head eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($head eq ".") 0 0 0
2412 0 $head = '';
2413 }
2414 0 ▶ if ($head ne '' and ($head =~ / \G ($q_char) /oxmsg)[-1] ne $pathsep) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head ne "" and ($head =~ / \G ($Elatin1::q_char) /gmosx)[-1] ne $pathsep) 0 0 0
Condition0%0/3
$head ne "" and ($head =~ / \G ($Elatin1::q_char) /gmosx)[-1] ne $pathsep
!ll&&!rl&&r
000
MC/DC0%0/2
$head ne "" and ($head =~ / \G ($Elatin1::q_char) /gmosx)[-1] ne $pathsep
$head ne "" ($head =~ / \G ($Elatin1::q_char) /gmosx)[-1] ne $pathsep
Truth table0%0/3
A and B
A= $head ne ""B= ($head =~ / \G ($Elatin1::q_char) /gmosx)[-1] ne $pathsep
ABresult
0X0
100
111
2415 0 $head .= $pathsep;
2416 }
2417 0 $head .= $expr;
2418 0 ▶ if ($cond eq 'd') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cond eq 'd') { } 0 0 0
2419 0 ▶ if (-d $head) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $head) 0 0 0
2420 0 push @glob, $head;
2421 }
2422 }
2423 else {
2424 0 ▶ if (-e $head) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $head) 0 0 0
2425 0 push @glob, $head;
2426 }
2427 }
2428 0 next OUTER;
2429 }
2430 0 ▶ opendir(*DIR, $head) or next OUTER;
Branch: 1 branch
BranchTrueFalseTotal
opendir *DIR, $head or next OUTER 0 0 0
2431 0 my @leaf = readdir DIR;
2432 0 closedir DIR;
2433  
2434 0 ▶ if ($head eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($head eq ".") 0 0 0
2435 0 $head = '';
2436 }
2437 0 ▶ if ($head ne '' and ($head =~ / \G ($q_char) /oxmsg)[-1] ne $pathsep) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head ne "" and ($head =~ / \G ($Elatin1::q_char) /gmosx)[-1] ne $pathsep) 0 0 0
Condition0%0/3
$head ne "" and ($head =~ / \G ($Elatin1::q_char) /gmosx)[-1] ne $pathsep
!ll&&!rl&&r
000
MC/DC0%0/2
$head ne "" and ($head =~ / \G ($Elatin1::q_char) /gmosx)[-1] ne $pathsep
$head ne "" ($head =~ / \G ($Elatin1::q_char) /gmosx)[-1] ne $pathsep
Truth table0%0/3
A and B
A= $head ne ""B= ($head =~ / \G ($Elatin1::q_char) /gmosx)[-1] ne $pathsep
ABresult
0X0
100
111
2438 0 $head .= $pathsep;
2439 }
2440  
2441 0 my $pattern = '';
2442 0 ▶ while ($expr =~ / \G ($q_char) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expr =~ / \G ($Elatin1::q_char) /cgox) 0 0 0
2443 0 my $char = $1;
2444  
2445 # 6.9. Matching Shell Globs as Regular Expressions
2446 # in Chapter 6. Pattern Matching
2447 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2448 # (and so on)
2449  
2450 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
2451 0 $pattern .= "(?:$your_char)*",
2452 }
2453 elsif ($char eq '?') {
2454 0 $pattern .= "(?:$your_char)?", # DOS style
2455 # $pattern .= "(?:$your_char)", # UNIX style
2456 }
2457 elsif ((my $fc = Elatin1::fc($char)) ne $char) {
2458 0 $pattern .= $fc;
2459 }
2460 else {
2461 0 $pattern .= quotemeta $char;
2462 }
2463 }
2464 0 ▶ my $matchsub = sub { Elatin1::fc($_[0]) =~ /\A $pattern \z/xms };
Subroutine __ANON__: not called CC=1 SCAR=6.9
2465  
2466 # if ($@) {
2467 # print STDERR "$0: $@\n";
2468 # next OUTER;
2469 # }
2470  
2471 INNER:
2472 0 for my $leaf (@leaf) {
2473 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
2474 0 next INNER;
2475 }
2476 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
2477 0 next INNER;
2478 }
2479  
2480 0 ▶ if (&$matchsub($leaf)) {
Branch: 1 branch
BranchTrueFalseTotal
if (&$matchsub($leaf)) 0 0 0
2481 0 push @matched, "$head$leaf";
2482 0 next INNER;
2483 }
2484  
2485 # [DOS compatibility special case]
2486 # Failed, add a trailing dot and try again, but only...
2487  
2488 0 ▶ if (Elatin1::index($leaf,'.') == -1 and # if name does not have a dot in it *and*
Branch: 1 branch
BranchTrueFalseTotal
if (&Elatin1::index($leaf, ".") == -1 and length $leaf <= 8 and &Elatin1::index($pattern, "\\.") != -1) 0 0 0
Condition0%0/6
&Elatin1::index($leaf, ".") == -1 and length $leaf <= 8 and &Elatin1::index($pattern, "\\.") != -1
!ll&&!rl&&r
000
&Elatin1::index($leaf, ".") == -1 and length $leaf <= 8
!ll&&!rl&&r
000
MC/DC0%0/3
&Elatin1::index($leaf, ".") == -1 and length $leaf <= 8 and &Elatin1::index($pattern, "\\.") != -1
&Elatin1::index($leaf, ".") == -1 length $leaf <= 8 &Elatin1::index($pattern, "\\.") != -1
Truth table0%0/4
A and B and C
A= &Elatin1::index($leaf, ".") == -1B= length $leaf <= 8C= &Elatin1::index($pattern, "\\.") != -1
ABCresult
0XX0
10X0
1100
1111
2489 CORE::length($leaf) <= 8 and # name is shorter than or equal to 8 chars *and*
2490 Elatin1::index($pattern,'\\.') != -1 # pattern has a dot.
2491 ) {
2492 0 ▶ if (&$matchsub("$leaf.")) {
Branch: 1 branch
BranchTrueFalseTotal
if (&$matchsub("$leaf.")) 0 0 0
2493 0 push @matched, "$head$leaf";
2494 0 next INNER;
2495 }
2496 }
2497 }
2498 0 ▶ if (@matched) {
Branch: 1 branch
BranchTrueFalseTotal
if (@matched) 0 0 0
2499 0 push @glob, @matched;
2500 }
2501 }
2502 0 ▶ if ($fix_drive_relative_paths) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fix_drive_relative_paths) 0 0 0
2503 0 for my $glob (@glob) {
2504 0 $glob =~ s# \A ([A-Za-z]:) \./ #$1#oxms;
2505 }
2506 }
2507 0 return @glob;
2508 }
2509  
2510 #
2511 # Latin-1 parse line
2512 #
2513 0 ▶sub _parse_line {
Subroutine _parse_line: not called CC=3 SCAR=24.8
2514  
2515 0 my($line) = @_;
2516  
2517 0 $line .= ' ';
2518 0 my @piece = ();
2519 0 ▶ while ($line =~ /
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ / " ( (?>(?: [^"] )* ) ) " (?>\s+) | ( (?>(?: [^"\s] )* ) ) (?>\s+) /gmosx) 0 0 0
2520 " ( (?>(?: [^"] )* ) ) " (?>\s+) |
2521 ( (?>(?: [^"\s] )* ) ) (?>\s+)
2522 /oxmsg
2523 ) {
2524 0 ▶ push @piece, defined($1) ? $1 : $2;
Branch: 1 branch
BranchTrueFalseTotal
defined $1 ? : 0 0 0
2525 }
2526 0 return @piece;
2527 }
2528  
2529 #
2530 # Latin-1 parse path
2531 #
2532 0 ▶sub _parse_path {
Subroutine _parse_path: not called CC=2 SCAR=17.9
2533  
2534 0 my($path,$pathsep) = @_;
2535  
2536 0 $path .= '/';
2537 0 my @subpath = ();
2538 0 ▶ while ($path =~ /
Branch: 1 branch
BranchTrueFalseTotal
if ($path =~ m( ((?: [^/\\] )+?) [/\\] )gmosx) 0 0 0
2539 ((?: [^\/\\] )+?) [\/\\]
2540 /oxmsg
2541 ) {
2542 0 push @subpath, $1;
2543 }
2544  
2545 0 my $tail = pop @subpath;
2546 0 my $head = join $pathsep, @subpath;
2547 0 return $head, $tail;
2548 }
2549  
2550 #
2551 # via File::HomeDir::Windows 1.00
2552 #
2553 0 ▶sub my_home_MSWin32 {
Subroutine my_home_MSWin32: not called CC=9 SCAR=45.0
Pod undocumented
2554  
2555 # A lot of unix people and unix-derived tools rely on
2556 # the ability to overload HOME. We will support it too
2557 # so that they can replace raw HOME calls with File::HomeDir.
2558 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
2559 0 return $ENV{'HOME'};
2560 }
2561  
2562 # Do we have a user profile?
2563 ▶ 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
2564 0 return $ENV{'USERPROFILE'};
2565 }
2566  
2567 # Some Windows use something like $ENV{'HOME'}
2568 ▶ 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
2569 0 return join '', $ENV{'HOMEDRIVE'}, $ENV{'HOMEPATH'};
2570 }
2571  
2572 0 return undef;
2573 }
2574  
2575 #
2576 # via File::HomeDir::Unix 1.00
2577 #
2578 0 ▶sub my_home {
Subroutine my_home: not called CC=7 SCAR=40.3
Pod undocumented
2579 0 my $home;
2580  
2581 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
2582 0 $home = $ENV{'HOME'};
2583 }
2584  
2585 # This is from the original code, but I'm guessing
2586 # it means "login directory" and exists on some Unixes.
2587 ▶ 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
2588 0 $home = $ENV{'LOGDIR'};
2589 }
2590  
2591 ### More-desperate methods
2592  
2593 # Light desperation on any (Unixish) platform
2594 else {
2595 0 $home = CORE::eval q{ (getpwuid($<))[7] };
2596 }
2597  
2598 # On Unix in general, a non-existant home means "no home"
2599 # For example, "nobody"-like users might use /nonexistant
2600 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
2601 0 $home = undef;
2602 }
2603 0 return $home;
2604 }
2605  
2606 #
2607 # ${^PREMATCH}, $PREMATCH, $` the string preceding what was matched
2608 #
2609 56 ▶sub Elatin1::PREMATCH {
Subroutine PREMATCH: called CC=1 SCAR=0.0
Pod undocumented
2610 56 return $`;
2611 }
2612  
2613 #
2614 # ${^MATCH}, $MATCH, $& the string that matched
2615 #
2616 81 ▶sub Elatin1::MATCH {
Subroutine MATCH: called CC=1 SCAR=0.0
Pod undocumented
2617 81 return $&;
2618 }
2619  
2620 #
2621 # ${^POSTMATCH}, $POSTMATCH, $' the string following what was matched
2622 #
2623 42 ▶sub Elatin1::POSTMATCH {
Subroutine POSTMATCH: called CC=1 SCAR=0.0
Pod undocumented
2624 42 return $';
2625 }
2626  
2627 #
2628 # Latin-1 character to order (with parameter)
2629 #
2630 0 ▶sub Latin1::ord(;$) {
Subroutine ord: not called CC=4 SCAR=30.0
2631  
2632 0 ▶ local $_ = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
2633  
2634 0 ▶ if (/\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\A ($Elatin1::q_char) /mosx) { } 0 0 0
2635 0 my @ord = unpack 'C*', $1;
2636 0 my $ord = 0;
2637 0 ▶ while (my $o = shift @ord) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $o = shift @ord) 0 0 0
2638 0 $ord = $ord * 0x100 + $o;
2639 }
2640 0 return $ord;
2641 }
2642 else {
2643 0 return CORE::ord $_;
2644 }
2645 }
2646  
2647 #
2648 # Latin-1 character to order (without parameter)
2649 #
2650 0 ▶sub Latin1::ord_() {
Subroutine ord_: not called CC=3 SCAR=24.8
2651  
2652 0 ▶ if (/\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\A ($Elatin1::q_char) /mosx) { } 0 0 0
2653 0 my @ord = unpack 'C*', $1;
2654 0 my $ord = 0;
2655 0 ▶ while (my $o = shift @ord) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $o = shift @ord) 0 0 0
2656 0 $ord = $ord * 0x100 + $o;
2657 }
2658 0 return $ord;
2659 }
2660 else {
2661 0 return CORE::ord $_;
2662 }
2663 }
2664  
2665 #
2666 # Latin-1 reverse
2667 #
2668 0 ▶sub Latin1::reverse(@) {
Subroutine reverse: not called CC=2 SCAR=17.9
2669  
2670 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2671 0 return CORE::reverse @_;
2672 }
2673 else {
2674  
2675 # One of us once cornered Larry in an elevator and asked him what
2676 # problem he was solving with this, but he looked as far off into
2677 # the distance as he could in an elevator and said, "It seemed like
2678 # a good idea at the time."
2679  
2680 0 return join '', CORE::reverse(join('',@_) =~ /\G ($q_char) /oxmsg);
2681 }
2682 }
2683  
2684 #
2685 # Latin-1 getc (with parameter, without parameter)
2686 #
2687 20 ▶sub Latin1::getc(;*@) {
Subroutine getc: called CC=9 SCAR=26.7
2688  
2689 20 my($package) = caller;
2690 20 ▶ my $fh = @_ ? qualify_to_ref(shift,$package) : \*STDIN;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 20 0 20
2691 20 ▶ croak 'Too many arguments for Latin1::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
2692  
2693 0 my @length = sort { $a <=> $b } keys %range_tr;
2694 20 my $getc = '';
2695 20 for my $length ($length[0] .. $length[-1]) {
2696 20 $getc .= CORE::getc($fh);
2697 20 ▶ if (exists $range_tr{CORE::length($getc)}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{length $getc}) 20 0 20
2698 20 ▶ if ($getc =~ /\A ${Elatin1::dot_s} \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($getc =~ /\A $Elatin1::dot_s \z/mosx) 20 0 20
2699 20 ▶ return wantarray ? ($getc,@_) : $getc;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 20 20
2700 }
2701 }
2702 }
2703 0 ▶ return wantarray ? ($getc,@_) : $getc;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
2704 }
2705  
2706 #
2707 # Latin-1 length by character
2708 #
2709 0 ▶sub Latin1::length(;$) {
Subroutine length: not called CC=2 SCAR=17.9
2710  
2711 0 ▶ local $_ = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
2712  
2713 0 local @_ = /\G ($q_char) /oxmsg;
2714 0 return scalar @_;
2715 }
2716  
2717 #
2718 # Latin-1 substr by character
2719 #
2720 422 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=7.0
2721  
2722 # P.232 The lvalue Attribute
2723 # in Chapter 6: Subroutines
2724 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2725  
2726 # P.336 The lvalue Attribute
2727 # in Chapter 7: Subroutines
2728 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2729  
2730 # P.144 8.4 Lvalue subroutines
2731 # in Chapter 8: perlsub: Perl subroutines
2732 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
2733  
2734 0 ▶ CORE::eval sprintf(<<'END', ($] >= 5.014000) ? ':lvalue' : '');
Subroutine substr: called CC=11 SCAR=24.4
Branch: 10 branches
BranchTrueFalseTotal
$] >= 5.014 ? : 422 0 422
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
2735 # vv----------------------*******
2736 sub Latin1::substr($$;$$) %s {
2737  
2738 my @char = $_[0] =~ /\G (?>$q_char) /oxmsg;
2739  
2740 # If the substring is beyond either end of the string, substr() returns the undefined
2741 # value and produces a warning. When used as an lvalue, specifying a substring that
2742 # is entirely outside the string raises an exception.
2743 # http://perldoc.perl.org/functions/substr.html
2744  
2745 # A return with no argument returns the scalar value undef in scalar context,
2746 # an empty list () in list context, and (naturally) nothing at all in void
2747 # context.
2748  
2749 my $offset = $_[1];
2750 if (($offset > scalar(@char)) or ($offset < (-1 * scalar(@char)))) {
2751 return;
2752 }
2753  
2754 # substr($string,$offset,$length,$replacement)
2755 if (@_ == 4) {
2756 my(undef,undef,$length,$replacement) = @_;
2757 my $substr = join '', splice(@char, $offset, $length, $replacement);
2758 $_[0] = join '', @char;
2759  
2760 # return $substr; this doesn't work, don't say "return"
2761 $substr;
2762 }
2763  
2764 # substr($string,$offset,$length)
2765 elsif (@_ == 3) {
2766 my(undef,undef,$length) = @_;
2767 my $octet_offset = 0;
2768 my $octet_length = 0;
2769 if ($offset == 0) {
2770 $octet_offset = 0;
2771 }
2772 elsif ($offset > 0) {
2773 $octet_offset = CORE::length(join '', @char[0..$offset-1]);
2774 }
2775 else {
2776 $octet_offset = -1 * CORE::length(join '', @char[$#char+$offset+1..$#char]);
2777 }
2778 if ($length == 0) {
2779 $octet_length = 0;
2780 }
2781 elsif ($length > 0) {
2782 $octet_length = CORE::length(join '', @char[$offset..$offset+$length-1]);
2783 }
2784 else {
2785 $octet_length = -1 * CORE::length(join '', @char[$#char+$length+1..$#char]);
2786 }
2787 CORE::substr($_[0], $octet_offset, $octet_length);
2788 }
2789  
2790 # substr($string,$offset)
2791 else {
2792 my $octet_offset = 0;
2793 if ($offset == 0) {
2794 $octet_offset = 0;
2795 }
2796 elsif ($offset > 0) {
2797 $octet_offset = CORE::length(join '', @char[0..$offset-1]);
2798 }
2799 else {
2800 $octet_offset = -1 * CORE::length(join '', @char[$#char+$offset+1..$#char]);
2801 }
2802 CORE::substr($_[0], $octet_offset);
2803 }
2804 }
2805 END
2806 }
2807  
2808 #
2809 # Latin-1 index by character
2810 #
2811 0 ▶sub Latin1::index($$;$) {
Subroutine index: not called CC=3 SCAR=24.8
2812  
2813 0 my $index;
2814 0 ▶ if (@_ == 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 3) { } 0 0 0
2815 0 $index = Elatin1::index($_[0], $_[1], CORE::length(Latin1::substr($_[0], 0, $_[2])));
2816 }
2817 else {
2818 0 $index = Elatin1::index($_[0], $_[1]);
2819 }
2820  
2821 0 ▶ if ($index == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($index == -1) { } 0 0 0
2822 0 return -1;
2823 }
2824 else {
2825 0 return Latin1::length(CORE::substr $_[0], 0, $index);
2826 }
2827 }
2828  
2829 #
2830 # Latin-1 rindex by character
2831 #
2832 0 ▶sub Latin1::rindex($$;$) {
Subroutine rindex: not called CC=3 SCAR=24.8
2833  
2834 0 my $rindex;
2835 0 ▶ if (@_ == 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 3) { } 0 0 0
2836 0 $rindex = Elatin1::rindex($_[0], $_[1], CORE::length(Latin1::substr($_[0], 0, $_[2])));
2837 }
2838 else {
2839 0 $rindex = Elatin1::rindex($_[0], $_[1]);
2840 }
2841  
2842 0 ▶ if ($rindex == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rindex == -1) { } 0 0 0
2843 0 return -1;
2844 }
2845 else {
2846 0 return Latin1::length(CORE::substr $_[0], 0, $rindex);
2847 }
2848 }
2849  
2850 # when 'm//', '/' means regexp match 'm//' and '?' means regexp match '??'
2851 # when 'div', '/' means division operator and '?' means conditional operator (condition ? then : else)
2852 422 ▶use vars qw($slash); $slash = 'm//';
Subroutine BEGIN: called CC=1 SCAR=0.0
2853  
2854 # ord() to ord() or Latin1::ord()
2855 422 my $function_ord = 'ord';
2856  
2857 # ord to ord or Latin1::ord_
2858 422 my $function_ord_ = 'ord';
2859  
2860 # reverse to reverse or Latin1::reverse
2861 422 my $function_reverse = 'reverse';
2862  
2863 # getc to getc or Latin1::getc
2864 422 my $function_getc = 'getc';
2865  
2866 # P.1023 Appendix W.9 Multibyte Anchoring
2867 # of ISBN 1-56592-224-7 CJKV Information Processing
2868  
2869 422 my $anchor = '';
2870  
2871 422 ▶use vars qw($nest);
Subroutine BEGIN: called CC=1 SCAR=0.0
2872  
2873 # regexp of nested parens in qqXX
2874  
2875 # P.340 Matching Nested Constructs with Embedded Code
2876 # in Chapter 7: Perl
2877 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
2878  
2879 my $qq_paren = qr{(?{local $nest=0}) (?>(?:
2880 [^\\()] |
2881 \( (?{$nest++}) |
2882 \) (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2883 \\ [^c] |
2884 \\c[\x40-\x5F] |
2885 [\x00-\xFF]
2886 422 }xms;
2887  
2888 my $qq_brace = qr{(?{local $nest=0}) (?>(?:
2889 [^\\{}] |
2890 \{ (?{$nest++}) |
2891 \} (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2892 \\ [^c] |
2893 \\c[\x40-\x5F] |
2894 [\x00-\xFF]
2895 422 }xms;
2896  
2897 my $qq_bracket = qr{(?{local $nest=0}) (?>(?:
2898 [^\\\[\]] |
2899 \[ (?{$nest++}) |
2900 \] (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2901 \\ [^c] |
2902 \\c[\x40-\x5F] |
2903 [\x00-\xFF]
2904 422 }xms;
2905  
2906 my $qq_angle = qr{(?{local $nest=0}) (?>(?:
2907 [^\\<>] |
2908 \< (?{$nest++}) |
2909 \> (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2910 \\ [^c] |
2911 \\c[\x40-\x5F] |
2912 [\x00-\xFF]
2913 422 }xms;
2914  
2915 422 my $qq_scalar = qr{(?: \{ (?:$qq_brace)*? \} |
2916 (?: ::)? (?:
2917 (?> [a-zA-Z_][a-zA-Z_0-9]* (?: ::[a-zA-Z_][a-zA-Z_0-9]*)* )
2918 (?>(?: \[ (?: \$\[ | \$\] | $qq_char )*? \] | \{ (?:$qq_brace)*? \} )*)
2919 (?>(?: (?: -> )? (?: [\$\@\%\&\*]\* | \$\#\* | [\@\%]? \[ (?: \$\[ | \$\] | $qq_char )*? \] | [\@\%\*]? \{ (?:$qq_brace)*? \} ) )*)
2920 ))
2921 }xms;
2922  
2923 422 my $qq_variable = qr{(?: \{ (?:$qq_brace)*? \} |
2924 (?: ::)? (?:
2925 (?>[0-9]+) |
2926 [^a-zA-Z_0-9\[\]] |
2927 ^[A-Z] |
2928 (?> [a-zA-Z_][a-zA-Z_0-9]* (?: ::[a-zA-Z_][a-zA-Z_0-9]*)* )
2929 (?>(?: \[ (?: \$\[ | \$\] | $qq_char )*? \] | \{ (?:$qq_brace)*? \} )*)
2930 (?>(?: (?: -> )? (?: [\$\@\%\&\*]\* | \$\#\* | [\@\%]? \[ (?: \$\[ | \$\] | $qq_char )*? \] | [\@\%\*]? \{ (?:$qq_brace)*? \} ) )*)
2931 ))
2932 }xms;
2933  
2934 422 my $qq_substr = qr{(?> Char::substr | Latin1::substr | CORE::substr | substr ) (?>\s*) \( $qq_paren \)
2935 }xms;
2936  
2937 # regexp of nested parens in qXX
2938 my $q_paren = qr{(?{local $nest=0}) (?>(?:
2939 [^()] |
2940 \( (?{$nest++}) |
2941 \) (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2942 [\x00-\xFF]
2943 422 }xms;
2944  
2945 my $q_brace = qr{(?{local $nest=0}) (?>(?:
2946 [^\{\}] |
2947 \{ (?{$nest++}) |
2948 \} (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2949 [\x00-\xFF]
2950 422 }xms;
2951  
2952 my $q_bracket = qr{(?{local $nest=0}) (?>(?:
2953 [^\[\]] |
2954 \[ (?{$nest++}) |
2955 \] (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2956 [\x00-\xFF]
2957 422 }xms;
2958  
2959 my $q_angle = qr{(?{local $nest=0}) (?>(?:
2960 [^<>] |
2961 \< (?{$nest++}) |
2962 \> (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2963 [\x00-\xFF]
2964 422 }xms;
2965  
2966 422 my $matched = '';
2967 422 my $s_matched = '';
2968  
2969 422 my $tr_variable = ''; # variable of tr///
2970 422 my $sub_variable = ''; # variable of s///
2971 422 my $bind_operator = ''; # =~ or !~
2972  
2973 422 my @heredoc = (); # here document
2974 422 my @heredoc_delimiter = ();
2975 422 my $here_script = ''; # here script
2976  
2977 #
2978 # escape Latin-1 script
2979 #
2980 547 ▶sub Latin1::escape(;$) {
Subroutine escape: called CC=3 SCAR=11.0
2981 547 ▶ local($_) = $_[0] if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 292 255 547
2982  
2983 # P.359 The Study Function
2984 # in Chapter 7: Perl
2985 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
2986  
2987 547 study $_; # Yes, I studied study yesterday.
2988  
2989 # while all script
2990  
2991 # 6.14. Matching from Where the Last Pattern Left Off
2992 # in Chapter 6. Pattern Matching
2993 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2994 # (and so on)
2995  
2996 # one member of Tag-team
2997 #
2998 # P.128 Start of match (or end of previous match): \G
2999 # P.130 Advanced Use of \G with Perl
3000 # in Chapter 3: Overview of Regular Expression Features and Flavors
3001 # P.255 Use leading anchors
3002 # P.256 Expose ^ and \G at the front expressions
3003 # in Chapter 6: Crafting an Efficient Expression
3004 # P.315 "Tag-team" matching with /gc
3005 # in Chapter 7: Perl
3006 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3007  
3008 547 my $e_script = '';
3009 547 ▶ while (not /\G \z/oxgc) { # member
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 86250 547 86797
3010 86250 $e_script .= Latin1::escape_token();
3011 }
3012  
3013 547 return $e_script;
3014 }
3015  
3016 #
3017 # escape Latin-1 token of script
3018 #
3019 86250 ▶sub Latin1::escape_token {
Subroutine escape_token: called CC=504 SCAR=109.3
3020  
3021 # \n output here document
3022  
3023 86250 my $ignore_modules = join('|', qw(
3024 utf8
3025 bytes
3026 charnames
3027 I18N::Japanese
3028 I18N::Collate
3029 I18N::JExt
3030 File::DosGlob
3031 Wild
3032 Wildcard
3033 Japanese
3034 ));
3035  
3036 # another member of Tag-team
3037 #
3038 # P.315 "Tag-team" matching with /gc
3039 # in Chapter 7: Perl
3040 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3041  
3042 86250 ▶ if (/\G ( \n ) /oxgc) { # another member (and so on)
Branch: 139 branches
BranchTrueFalseTotal
if (/\G ( \n ) /cgox) { } 12791 73459 86250
elsif (/\G ((?>\s+)|\#.*) /cgox) { } 21223 52236 73459
elsif (/\G ( (?: if | elsif | unless | while | until | given | when ) (?>\s*) \( ) /cgox) { } 1644 50592 52236
elsif (/\G ( \( (?>\s*) (?: local \b | my \b | our \b | state \b )? (?>\s*) \$ $qq_scalar ) /cgox) { } 90 50502 50592
elsif (/\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /cgmosx) { } 4 50498 50502
elsif (/\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /cgmosx) { } 28 50470 50498
elsif (/\G ( \$' | \$\{'\} ) /cgmosx) { } 1 50469 50470
elsif (/\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /cgmosx) { } 3 50466 50469
elsif (/\G ( \$ $qq_scalar | $qq_substr ) /cgox) { } 1752 48714 50466
elsif (/\G ( [,;] ) /cgox) { } 5050 43664 48714
elsif (/\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /cgmosx) { } 0 43664 43664
elsif (/\G ( \$ 0 ) /cgmosx) { } 2 43662 43664
elsif (/\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /cgmosx) { } 0 43662 43662
elsif (/\G ( \$ \$ ) (?![\w\{]) /cgmosx) { } 1 43661 43662
elsif (/\G \$ ((?>[1-9][0-9]*)) /cgmosx) { } 4 43657 43661
elsif (/\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /cgmosx) { } 0 43657 43657
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /cgmosx) { } 0 43657 43657
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /cgmosx) { } 0 43657 43657
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /cgmosx) { } 0 43657 43657
elsif (/\G \$ (?>\s*) \{ ( (?>\s*) (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* ) (?>\s*) ) \} /cgmosx) { } 0 43657 43657
elsif (/\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /cgmosx) { } 0 43657 43657
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 43615 43657
elsif (m{\G ( \$[\$\@\#\\\'\"/\?\(\)\[\]\<\>] ) }cgmosx) { } 63 43552 43615
elsif (/\G \b (while (?>\s*) \( (?>\s*) <[\$]?[A-Za-z_][A-Za-z_0-9]*> (?>\s*) \)) \b /cgox) { } 0 43552 43552
elsif (/\G \b while (?>\s*) \( (?>\s*) < ((?:[^>\0\a\e\f\n\r\t])+?) > (?>\s*) \) \b /cgox) { } 0 43552 43552
elsif (/\G \b while (?>\s*) \( (?>\s*) glob (?>\s*) \) /cgox) { } 0 43552 43552
elsif (/\G \b while (?>\s*) \( (?>\s*) glob \b /cgox) { } 0 43552 43552
elsif (/\G \b ( if | unless | while | until | for | when ) \b /cgox) { } 251 43301 43552
elsif (/\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /cgox) { } 19 43282 43301
elsif (/\G \b Char::eval (?= (?>\s*) \{ ) /cgox) { } 0 43282 43282
elsif (/\G \b Latin1::eval (?= (?>\s*) \{ ) /cgox) { } 22 43260 43282
elsif (/\G \b Char::eval \b (?! (?>\s*) => ) /cgox) { } 0 43260 43260
elsif (/\G \b Latin1::eval \b (?! (?>\s*) => ) /cgox) { } 168 43092 43260
elsif (/\G \b bytes::substr \b (?! (?>\s*) => ) /cgox) { } 2 43090 43092
elsif (/\G \b chop \b (?! (?>\s*) => ) /cgox) { } 0 43090 43090
elsif (/\G \b bytes::index \b (?! (?>\s*) => ) /cgox) { } 2 43088 43090
elsif (/\G \b Char::index \b (?! (?>\s*) => ) /cgox) { } 0 43088 43088
elsif (/\G \b Latin1::index \b (?! (?>\s*) => ) /cgox) { } 0 43088 43088
elsif (/\G \b index \b (?! (?>\s*) => ) /cgox) { } 0 43088 43088
elsif (/\G \b bytes::rindex \b (?! (?>\s*) => ) /cgox) { } 2 43086 43088
elsif (/\G \b Char::rindex \b (?! (?>\s*) => ) /cgox) { } 0 43086 43086
elsif (/\G \b Latin1::rindex \b (?! (?>\s*) => ) /cgox) { } 0 43086 43086
elsif (/\G \b rindex \b (?! (?>\s*) => ) /cgox) { } 0 43086 43086
elsif (/\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 1 43085 43086
elsif (/\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43085 43085
elsif (/\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 1 43084 43085
elsif (/\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43084 43084
elsif (/\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 6 43078 43084
elsif (/\G -s (?>\s*) (\") ((?:$Elatin1::qq_char)+?) (\") /cgox) { } 0 43078 43078
elsif (/\G -s (?>\s+) qq (?>\s*) (\#) ((?:$Elatin1::qq_char)+?) (\#) /cgox) { } 0 43078 43078
elsif (/\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /cgox) { } 0 43078 43078
elsif (/\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /cgox) { } 0 43078 43078
elsif (/\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /cgox) { } 0 43078 43078
elsif (/\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /cgox) { } 0 43078 43078
elsif (/\G -s (?>\s+) qq (?>\s*) (\S) ((?:$Elatin1::qq_char)+?) (\1) /cgox) { } 0 43078 43078
elsif (/\G -s (?>\s*) (\') ((?:\\\'|\\\\|$Elatin1::q_char)+?) (\') /cgox) { } 0 43078 43078
elsif (/\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$Elatin1::q_char)+?) (\#) /cgox) { } 0 43078 43078
elsif (/\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /cgox) { } 0 43078 43078
elsif (/\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /cgox) { } 0 43078 43078
elsif (/\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /cgox) { } 0 43078 43078
elsif (/\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /cgox) { } 0 43078 43078
elsif (/\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$Elatin1::q_char)+?) (\1) /cgox) { } 0 43078 43078
elsif (/\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)* ) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ) )*) /cgox) { } 0 43078 43078
elsif (/\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /cgox) { } 0 43078 43078
elsif (/\G -s (?= (?>\s+) [a-z]+) /cgox) { } 0 43078 43078
elsif (/\G -s (?>\s+) ((?>\w+)) /cgox) { } 0 43078 43078
elsif (/\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43076 43078
elsif (/\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43074 43076
elsif (/\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 36 43038 43074
elsif (/\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43036 43038
elsif (/\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 8 43028 43036
elsif (/\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43028 43028
elsif (/\G \b lc \b (?! (?>\s*) => ) /cgox) { } 0 43028 43028
elsif (/\G \b lcfirst \b (?! (?>\s*) => ) /cgox) { } 0 43028 43028
elsif (/\G \b uc \b (?! (?>\s*) => ) /cgox) { } 0 43028 43028
elsif (/\G \b ucfirst \b (?! (?>\s*) => ) /cgox) { } 0 43028 43028
elsif (/\G \b fc \b (?! (?>\s*) => ) /cgox) { } 0 43028 43028
elsif (/\G -s \b (?! (?>\s*) => ) /cgox) { } 0 43028 43028
elsif (/\G \b bytes::length \b (?! (?>\s*) => ) /cgox) { } 0 43028 43028
elsif (/\G \b bytes::chr \b (?! (?>\s*) => ) /cgox) { } 0 43028 43028
elsif (/\G \b chr \b (?! (?>\s*) => ) /cgox) { } 0 43028 43028
elsif (/\G \b bytes::ord \b (?! (?>\s*) => ) /cgox) { } 0 43028 43028
elsif (/\G \b ord \b (?! (?>\s*) => ) /cgox) { } 0 43028 43028
elsif (/\G \b glob \b (?! (?>\s*) => ) /cgox) { } 0 43028 43028
elsif (/\G \b reverse \b (?! (?>\s*) => ) /cgox) { } 0 43028 43028
elsif (/\G \b getc \b (?! (?>\s*) => ) /cgox) { } 8 43020 43028
elsif (/\G \b (split) \b (?! (?>\s*) => ) /cgox) { } 87 42933 43020
elsif (/\G \b ( tr | y ) \b /cgox) { } 4 42929 42933
elsif (/\G \b (qq) \b /cgox) { } 2252 40677 42929
elsif (/\G \b (qr) \b /cgox) { } 0 40677 40677
elsif (/\G \b (qw) \b /cgox) { } 16 40661 40677
elsif (/\G \b (qx) \b /cgox) { } 0 40661 40661
elsif (/\G \b (q) \b /cgox) { } 473 40188 40661
elsif (/\G \b (m) \b /cgox) { } 209 39979 40188
elsif (/\G \b (s) \b /cgox) { } 101 39878 39979
elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 0 39878 39878
elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 39878 39878
elsif (/\G \b require ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 39878 39878
elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [#\n]) /cgmosx) { } 37 39841 39878
elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 39841 39841
elsif (/\G \b use ((?>\s+) strict) \b /cgmosx) { } 0 39841 39841
elsif (/\G \b use (?>\s+) ((?>([1-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /cgmosx) { } 2 39839 39841
elsif (/\G \b use (?>\s+) ((?>v([0-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /cgmosx) { } 0 39839 39839
elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 2 39837 39839
elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 39837 39837
elsif (/\G \b use ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 39837 39837
elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 0 39837 39837
elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 39837 39837
elsif (/\G \b no ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 39837 39837
elsif (/\G \b use \b /cgmosx) { } 0 39837 39837
elsif (/\G \b no \b /cgmosx) { } 2 39835 39837
elsif (/\G (?<![\w\$\@\%\&\*]) (\') /cgox) { } 1142 38693 39835
elsif (/\G (\") /cgox) { } 1857 36836 38693
elsif (/\G (\`) /cgox) { } 1 36835 36836
elsif ($Elatin1::slash eq 'm//' and m[\G (/) ]cgox) { } 681 36154 36835
elsif ($Elatin1::slash eq 'm//' and /\G (\?) /cgox) { } 0 36154 36154
elsif (/\G ( <<>> ) /cgox) { } 0 36154 36154
elsif (/\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /cgox) { } 0 36154 36154
elsif (/\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /cgox) { } 6 36148 36154
elsif (/\G ( <<~ \\([a-zA-Z_0-9]+) ) /cgox) { } 3 36145 36148
elsif (/\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /cgox) { } 6 36139 36145
elsif (/\G ( <<~ ([a-zA-Z_0-9]+) ) /cgox) { } 3 36136 36139
elsif (/\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /cgox) { } 6 36130 36136
elsif (/\G ( << '([a-zA-Z_0-9]*)' ) /cgox) { } 72 36058 36130
elsif (/\G ( << \\([a-zA-Z_0-9]+) ) /cgox) { } 0 36058 36058
elsif (/\G ( << "([a-zA-Z_0-9]*)" ) /cgox) { } 36 36022 36058
elsif (/\G ( << ([a-zA-Z_0-9]+) ) /cgox) { } 42 35980 36022
elsif (/\G ( << `([a-zA-Z_0-9]*)` ) /cgox) { } 0 35980 35980
elsif (/\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/cgox) { } 12 35968 35980
elsif (/\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /cgox) { } 0 35968 35968
elsif (/\G < ((?:[^>\0\a\e\f\n\r\t])+?) > /cgox) { } 0 35968 35968
elsif (/\G ^ ( __DATA__ \n .*) \z /cgmosx) { } 0 35968 35968
elsif (/\G ^ ( __END__ \n .*) \z /cgmosx) { } 210 35758 35968
elsif (/\G ( \cD .*) \z /cgmosx) { } 0 35758 35758
elsif (/\G ( \cZ .*) \z /cgmosx) { } 0 35758 35758
elsif (/\G ( -- | \+\+ | [\)\}\]] ) /cgox) { } 5837 29921 35758
elsif (/\G ( \.\.\. ) /cgox) { } 7 29914 29921
elsif (m"\G ((?> !~~ | !~ | != | ! | %= | % | &&= | && | &= | &\.= | &\. | & | -= | -> | - | :(?>\s*)= | : | <<>> | <<= | <=> | <= | < | == | => | =~ | = | >>= | >> | >= | > | \*\*= | \*\* | \*= | \* | \+= | \+ | \.\. | \.= | \. | //= | // | /= | / | \? | \\ | \^= | \^\.= | \^\. | \^ | \b x= | \|\|= | \|\| | \|= | \|\.= | \|\. | \| | ~~ | ~\. | ~ | \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b | \b(?: print )\b | [,;\(\{\[] )) "cgox) { } 9758 20156 29914
elsif (/\G ($Elatin1::q_char) /cgox) { } 20156 0 20156
3043 12791 my $heredoc = '';
3044 12791 ▶ if (scalar(@heredoc_delimiter) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @heredoc_delimiter >= 1) 174 12617 12791
3045 174 $slash = 'm//';
3046  
3047 174 $heredoc = join '', @heredoc;
3048 174 @heredoc = ();
3049  
3050 # skip here document
3051 174 for my $heredoc_delimiter (@heredoc_delimiter) {
3052 174 /\G .*? \n $heredoc_delimiter \n/xmsgc;
3053 }
3054 174 @heredoc_delimiter = ();
3055  
3056 174 $here_script = '';
3057 }
3058 12791 return "\n" . $heredoc;
3059 }
3060  
3061 # ignore space, comment
3062 21223 elsif (/\G ((?>\s+)|\#.*) /oxgc) { return $1; }
3063  
3064 # if (, elsif (, unless (, while (, until (, given (, and when (
3065  
3066 # given, when
3067  
3068 # P.225 The given Statement
3069 # in Chapter 15: Smart Matching and given-when
3070 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
3071  
3072 # P.133 The given Statement
3073 # in Chapter 4: Statements and Declarations
3074 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
3075  
3076 elsif (/\G ( (?: if | elsif | unless | while | until | given | when ) (?>\s*) \( ) /oxgc) {
3077 1644 $slash = 'm//';
3078 1644 return $1;
3079 }
3080  
3081 # scalar variable ($scalar = ...) =~ tr///;
3082 # scalar variable ($scalar = ...) =~ s///;
3083  
3084 # state
3085  
3086 # P.68 Persistent, Private Variables
3087 # in Chapter 4: Subroutines
3088 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
3089  
3090 # P.160 Persistent Lexically Scoped Variables: state
3091 # in Chapter 4: Statements and Declarations
3092 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
3093  
3094 # (and so on)
3095  
3096 elsif (/\G ( \( (?>\s*) (?: local \b | my \b | our \b | state \b )? (?>\s*) \$ $qq_scalar ) /oxgc) {
3097 90 my $e_string = e_string($1);
3098  
3099 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
3100 0 $tr_variable = $e_string . e_string($1);
3101 0 $bind_operator = $2;
3102 0 $slash = 'm//';
3103 0 return '';
3104 }
3105 elsif (/\G ( (?>\s*) = $qq_paren \) ) ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /oxgc) {
3106 0 $sub_variable = $e_string . e_string($1);
3107 0 $bind_operator = $2;
3108 0 $slash = 'm//';
3109 0 return '';
3110 }
3111 else {
3112 90 $slash = 'div';
3113 90 return $e_string;
3114 }
3115 }
3116  
3117 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin1::PREMATCH()
3118 elsif (/\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /oxmsgc) {
3119 4 $slash = 'div';
3120 4 return q{Elatin1::PREMATCH()};
3121 }
3122  
3123 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin1::MATCH()
3124 elsif (/\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /oxmsgc) {
3125 28 $slash = 'div';
3126 28 return q{Elatin1::MATCH()};
3127 }
3128  
3129 # $', ${'} --> $', ${'}
3130 elsif (/\G ( \$' | \$\{'\} ) /oxmsgc) {
3131 1 $slash = 'div';
3132 1 return $1;
3133 }
3134  
3135 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin1::POSTMATCH()
3136 elsif (/\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /oxmsgc) {
3137 3 $slash = 'div';
3138 3 return q{Elatin1::POSTMATCH()};
3139 }
3140  
3141 # scalar variable $scalar =~ tr///;
3142 # scalar variable $scalar =~ s///;
3143 # substr() =~ tr///;
3144 # substr() =~ s///;
3145 elsif (/\G ( \$ $qq_scalar | $qq_substr ) /oxgc) {
3146 1752 my $scalar = e_string($1);
3147  
3148 1752 ▶ if (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= (?: tr | y ) \b ) /oxgc) {
Branch: 2 branches
BranchTrueFalseTotal
if (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= (?: tr | y ) \b ) /cgox) { } 2 1750 1752
elsif (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /cgox) { } 65 1685 1750
3149 2 $tr_variable = $scalar;
3150 2 $bind_operator = $1;
3151 2 $slash = 'm//';
3152 2 return '';
3153 }
3154 elsif (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /oxgc) {
3155 65 $sub_variable = $scalar;
3156 65 $bind_operator = $1;
3157 65 $slash = 'm//';
3158 65 return '';
3159 }
3160 else {
3161 1685 $slash = 'div';
3162 1685 return $scalar;
3163 }
3164 }
3165  
3166 # end of statement
3167 elsif (/\G ( [,;] ) /oxgc) {
3168 5050 $slash = 'm//';
3169  
3170 # clear tr/// variable
3171 5050 $tr_variable = '';
3172  
3173 # clear s/// variable
3174 5050 $sub_variable = '';
3175  
3176 5050 $bind_operator = '';
3177  
3178 5050 return $1;
3179 }
3180  
3181 # bareword
3182 elsif (/\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /oxmsgc) {
3183 0 return $1;
3184 }
3185  
3186 # $0 --> $0
3187 elsif (/\G ( \$ 0 ) /oxmsgc) {
3188 2 $slash = 'div';
3189 2 return $1;
3190 }
3191 elsif (/\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /oxmsgc) {
3192 0 $slash = 'div';
3193 0 return $1;
3194 }
3195  
3196 # $$ --> $$
3197 elsif (/\G ( \$ \$ ) (?![\w\{]) /oxmsgc) {
3198 1 $slash = 'div';
3199 1 return $1;
3200 }
3201  
3202 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
3203 # $1, $2, $3 --> $1, $2, $3 otherwise
3204 elsif (/\G \$ ((?>[1-9][0-9]*)) /oxmsgc) {
3205 4 $slash = 'div';
3206 4 return e_capture($1);
3207 }
3208 elsif (/\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /oxmsgc) {
3209 0 $slash = 'div';
3210 0 return e_capture($1);
3211 }
3212  
3213 # $$foo[ ... ] --> $ $foo->[ ... ]
3214 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /oxmsgc) {
3215 0 $slash = 'div';
3216 0 return e_capture($1.'->'.$2);
3217 }
3218  
3219 # $$foo{ ... } --> $ $foo->{ ... }
3220 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /oxmsgc) {
3221 0 $slash = 'div';
3222 0 return e_capture($1.'->'.$2);
3223 }
3224  
3225 # $$foo
3226 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /oxmsgc) {
3227 0 $slash = 'div';
3228 0 return e_capture($1);
3229 }
3230  
3231 # ${ foo }
3232 elsif (/\G \$ (?>\s*) \{ ( (?>\s*) (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* ) (?>\s*) ) \} /oxmsgc) {
3233 0 $slash = 'div';
3234 0 return '${' . $1 . '}';
3235 }
3236  
3237 # ${ ... }
3238 elsif (/\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /oxmsgc) {
3239 0 $slash = 'div';
3240 0 return e_capture($1);
3241 }
3242  
3243 # variable or function
3244 # $ @ % & * $ #
3245 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) {
3246 42 $slash = 'div';
3247 42 return $1;
3248 }
3249 # $ $ $ $ $ $ $ $ $ $ $ $ $ $
3250 # $ @ # \ ' " / ? ( ) [ ] < >
3251 elsif (/\G ( \$[\$\@\#\\\'\"\/\?\(\)\[\]\<\>] ) /oxmsgc) {
3252 63 $slash = 'div';
3253 63 return $1;
3254 }
3255  
3256 # while (<FILEHANDLE>)
3257 elsif (/\G \b (while (?>\s*) \( (?>\s*) <[\$]?[A-Za-z_][A-Za-z_0-9]*> (?>\s*) \)) \b /oxgc) {
3258 0 return $1;
3259 }
3260  
3261 # while (<WILDCARD>) --- glob
3262  
3263 # avoid "Error: Runtime exception" of perl version 5.005_03
3264  
3265 elsif (/\G \b while (?>\s*) \( (?>\s*) < ((?:[^>\0\a\e\f\n\r\t])+?) > (?>\s*) \) \b /oxgc) {
3266 0 return 'while ($_ = Elatin1::glob("' . $1 . '"))';
3267 }
3268  
3269 # while (glob)
3270 elsif (/\G \b while (?>\s*) \( (?>\s*) glob (?>\s*) \) /oxgc) {
3271 0 return 'while ($_ = Elatin1::glob_)';
3272 }
3273  
3274 # while (glob(WILDCARD))
3275 elsif (/\G \b while (?>\s*) \( (?>\s*) glob \b /oxgc) {
3276 0 return 'while ($_ = Elatin1::glob';
3277 }
3278  
3279 # doit if, doit unless, doit while, doit until, doit for, doit when
3280 251 elsif (/\G \b ( if | unless | while | until | for | when ) \b /oxgc) { $slash = 'm//'; return $1; }
3281  
3282 # subroutines of package Elatin1
3283 19 elsif (/\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /oxgc) { $slash = 'm//'; return $1; }
3284 0 elsif (/\G \b Char::eval (?= (?>\s*) \{ ) /oxgc) { $slash = 'm//'; return 'eval'; }
3285 22 elsif (/\G \b Latin1::eval (?= (?>\s*) \{ ) /oxgc) { $slash = 'm//'; return 'eval'; }
3286 0 elsif (/\G \b Char::eval \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'eval Char::escape'; }
3287 168 elsif (/\G \b Latin1::eval \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'eval Latin1::escape'; }
3288 2 elsif (/\G \b bytes::substr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'substr'; }
3289 0 elsif (/\G \b chop \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin1::chop'; }
3290 2 elsif (/\G \b bytes::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'index'; }
3291 0 elsif (/\G \b Char::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Char::index'; }
3292 0 elsif (/\G \b Latin1::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Latin1::index'; }
3293 0 elsif (/\G \b index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin1::index'; }
3294 2 elsif (/\G \b bytes::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'rindex'; }
3295 0 elsif (/\G \b Char::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Char::rindex'; }
3296 0 elsif (/\G \b Latin1::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Latin1::rindex'; }
3297 0 elsif (/\G \b rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin1::rindex'; }
3298 1 elsif (/\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin1::lc'; }
3299 0 elsif (/\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin1::lcfirst'; }
3300 1 elsif (/\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin1::uc'; }
3301 0 elsif (/\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin1::ucfirst'; }
3302 6 elsif (/\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin1::fc'; }
3303  
3304 # "-s '' ..." means file test "-s 'filename' ..." (not means "- s/// ...")
3305 0 elsif (/\G -s (?>\s*) (\") ((?:$qq_char)+?) (\") /oxgc) { $slash = 'm//'; return '-s ' . e_qq('', $1,$3,$2); }
3306 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\#) ((?:$qq_char)+?) (\#) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3307 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3308 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3309 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3310 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3311 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\S) ((?:$qq_char)+?) (\1) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3312  
3313 0 elsif (/\G -s (?>\s*) (\') ((?:\\\'|\\\\|$q_char)+?) (\') /oxgc) { $slash = 'm//'; return '-s ' . e_q ('', $1,$3,$2); }
3314 0 elsif (/\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$q_char)+?) (\#) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3315 0 elsif (/\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3316 0 elsif (/\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3317 0 elsif (/\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3318 0 elsif (/\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3319 0 elsif (/\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$q_char)+?) (\1) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3320  
3321 elsif (/\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)* ) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ) )*) /oxgc)
3322 0 { $slash = 'm//'; return "-s $1"; }
3323 0 elsif (/\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /oxgc) { $slash = 'm//'; return "-s ($1)"; }
3324 0 elsif (/\G -s (?= (?>\s+) [a-z]+) /oxgc) { $slash = 'm//'; return '-s'; }
3325 0 elsif (/\G -s (?>\s+) ((?>\w+)) /oxgc) { $slash = 'm//'; return "-s $1"; }
3326  
3327 2 elsif (/\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'length'; }
3328 2 elsif (/\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'chr'; }
3329 36 elsif (/\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin1::chr'; }
3330 2 elsif (/\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'div'; return 'ord'; }
3331 8 elsif (/\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'div'; return $function_ord; }
3332 0 elsif (/\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin1::glob'; }
3333 0 elsif (/\G \b lc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin1::lc_'; }
3334 0 elsif (/\G \b lcfirst \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin1::lcfirst_'; }
3335 0 elsif (/\G \b uc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin1::uc_'; }
3336 0 elsif (/\G \b ucfirst \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin1::ucfirst_'; }
3337 0 elsif (/\G \b fc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin1::fc_'; }
3338 0 elsif (/\G -s \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return '-s '; }
3339  
3340 0 elsif (/\G \b bytes::length \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'length'; }
3341 0 elsif (/\G \b bytes::chr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'chr'; }
3342 0 elsif (/\G \b chr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin1::chr_'; }
3343 0 elsif (/\G \b bytes::ord \b (?! (?>\s*) => ) /oxgc) { $slash = 'div'; return 'ord'; }
3344 0 elsif (/\G \b ord \b (?! (?>\s*) => ) /oxgc) { $slash = 'div'; return $function_ord_; }
3345 0 elsif (/\G \b glob \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin1::glob_'; }
3346 0 elsif (/\G \b reverse \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return $function_reverse; }
3347 8 elsif (/\G \b getc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return $function_getc; }
3348 # split
3349 elsif (/\G \b (split) \b (?! (?>\s*) => ) /oxgc) {
3350 87 $slash = 'm//';
3351  
3352 87 my $e = '';
3353 87 ▶ while (/\G ( (?>\s+) | \( | \#.* ) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\G ( (?>\s+) | \( | \#.* ) /cgox) 85 87 172
3354 85 $e .= $1;
3355 }
3356  
3357 # end of split
3358 87 ▶ if (/\G (?= [,;\)\}\]] ) /oxgc) { return 'Elatin1::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
3359  
3360 # split scalar value
3361 1 elsif (/\G ( [\$\@\&\*] $qq_scalar ) /oxgc) { return 'Elatin1::split' . $e . e_string($1); }
3362  
3363 # split literal space
3364 0 elsif (/\G \b qq (\#) [ ] (\#) /oxgc) { return 'Elatin1::split' . $e . qq {qq$1 $2}; }
3365 0 elsif (/\G \b qq ((?>\s*)) (\() [ ] (\)) /oxgc) { return 'Elatin1::split' . $e . qq{$1qq$2 $3}; }
3366 0 elsif (/\G \b qq ((?>\s*)) (\{) [ ] (\}) /oxgc) { return 'Elatin1::split' . $e . qq{$1qq$2 $3}; }
3367 0 elsif (/\G \b qq ((?>\s*)) (\[) [ ] (\]) /oxgc) { return 'Elatin1::split' . $e . qq{$1qq$2 $3}; }
3368 0 elsif (/\G \b qq ((?>\s*)) (\<) [ ] (\>) /oxgc) { return 'Elatin1::split' . $e . qq{$1qq$2 $3}; }
3369 0 elsif (/\G \b qq ((?>\s*)) (\S) [ ] (\2) /oxgc) { return 'Elatin1::split' . $e . qq{$1qq$2 $3}; }
3370 0 elsif (/\G \b q (\#) [ ] (\#) /oxgc) { return 'Elatin1::split' . $e . qq {q$1 $2}; }
3371 0 elsif (/\G \b q ((?>\s*)) (\() [ ] (\)) /oxgc) { return 'Elatin1::split' . $e . qq {$1q$2 $3}; }
3372 0 elsif (/\G \b q ((?>\s*)) (\{) [ ] (\}) /oxgc) { return 'Elatin1::split' . $e . qq {$1q$2 $3}; }
3373 0 elsif (/\G \b q ((?>\s*)) (\[) [ ] (\]) /oxgc) { return 'Elatin1::split' . $e . qq {$1q$2 $3}; }
3374 0 elsif (/\G \b q ((?>\s*)) (\<) [ ] (\>) /oxgc) { return 'Elatin1::split' . $e . qq {$1q$2 $3}; }
3375 0 elsif (/\G \b q ((?>\s*)) (\S) [ ] (\2) /oxgc) { return 'Elatin1::split' . $e . qq {$1q$2 $3}; }
3376 10 elsif (/\G ' [ ] ' /oxgc) { return 'Elatin1::split' . $e . qq {' '}; }
3377 0 elsif (/\G " [ ] " /oxgc) { return 'Elatin1::split' . $e . qq {" "}; }
3378  
3379 # split qq//
3380 elsif (/\G \b (qq) \b /oxgc) {
3381 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin1::qq_char)*?) (\#) /cgox) { } 0 0 0
3382 else {
3383 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3384 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 ([*\-:?\\^|]) ((?:$Elatin1::qq_char)*?) (\1) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin1::qq_char)*?) (\1) /cgox) { } 0 0 0
3385 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq ( ) --> qr ( )
3386 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq { } --> qr { }
3387 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq [ ] --> qr [ ]
3388 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq < > --> qr < >
3389 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) /oxgc) { return e_split($e.'qr','{','}',$2,''); } # qq | | --> qr { }
3390 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq * * --> qr * *
3391 }
3392 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3393 }
3394 }
3395  
3396 # split qr//
3397 elsif (/\G \b (qr) \b /oxgc) {
3398 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1,$3,$2,$4); } # qr# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin1::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 12 12
3399 else {
3400 12 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 12 0 12
3401 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 (\') ((?:$Elatin1::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 12 12
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin1::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 12 12
elsif (/\G (\S) ((?:$Elatin1::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 12 0 12
3402 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr ( )
3403 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr { }
3404 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr [ ]
3405 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr < >
3406 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { return e_split_q($e.'qr',$1, $3, $2,$4); } # qr ' '
3407 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr','{','}',$2,$4); } # qr | | --> qr { }
3408 12 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr * *
3409 }
3410 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3411 }
3412 }
3413  
3414 # split q//
3415 elsif (/\G \b (q) \b /oxgc) {
3416 0 ▶ if (/\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:\\\#|\\\\|$Elatin1::q_char)*?) (\#) /cgox) { } 0 0 0
3417 else {
3418 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3419 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 ([*\-:?\\^|]) ((?:$Elatin1::q_char)*?) (\1) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:\\\\|\\\1| $Elatin1::q_char)*?) (\1) /cgox) { } 0 0 0
3420 0 elsif (/\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q ( ) --> qr ( )
3421 0 elsif (/\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q { } --> qr { }
3422 0 elsif (/\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q [ ] --> qr [ ]
3423 0 elsif (/\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q < > --> qr < >
3424 0 elsif (/\G ([*\-:?\\^|]) ((?:$q_char)*?) (\1) /oxgc) { return e_split_q($e.'qr','{','}',$2,''); } # q | | --> qr { }
3425 0 elsif (/\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q * * --> qr * *
3426 }
3427 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3428 }
3429 }
3430  
3431 # split m//
3432 elsif (/\G \b (m) \b /oxgc) {
3433 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1,$3,$2,$4); } # m# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin1::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
3434 else {
3435 18 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 18 0 18
3436 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 (\') ((?:$Elatin1::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin1::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
elsif (/\G (\S) ((?:$Elatin1::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 18 0 18
3437 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m ( ) --> qr ( )
3438 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m { } --> qr { }
3439 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m [ ] --> qr [ ]
3440 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m < > --> qr < >
3441 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { return e_split_q($e.'qr',$1, $3, $2,$4); } # m ' ' --> qr ' '
3442 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr','{','}',$2,$4); } # m | | --> qr { }
3443 18 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m * * --> qr * *
3444 }
3445 0 die __FILE__, ": Search pattern not terminated\n";
3446 }
3447 }
3448  
3449 # split ''
3450 elsif (/\G (\') /oxgc) {
3451 0 my $q_string = '';
3452 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3453 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 ($Elatin1::q_char) /cgox) { } 0 0 0
3454 0 elsif (/\G (\\\') /oxgc) { $q_string .= $1; } # splitqr'' --> split qr''
3455 0 elsif (/\G \' /oxgc) { return e_split_q($e.q{ qr},"'","'",$q_string,''); } # ' ' --> qr ' '
3456 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3457 }
3458 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3459 }
3460  
3461 # split ""
3462 elsif (/\G (\") /oxgc) {
3463 0 my $qq_string = '';
3464 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3465 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 ($Elatin1::q_char) /cgox) { } 0 0 0
3466 0 elsif (/\G (\\\") /oxgc) { $qq_string .= $1; } # splitqr"" --> split qr""
3467 0 elsif (/\G \" /oxgc) { return e_split($e.q{ qr},'"','"',$qq_string,''); } # " " --> qr " "
3468 0 elsif (/\G ($q_char) /oxgc) { $qq_string .= $1; }
3469 }
3470 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3471 }
3472  
3473 # split //
3474 elsif (/\G (\/) /oxgc) {
3475 44 my $regexp = '';
3476 44 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 381 0 381
3477 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 ($Elatin1::q_char) /cgox) { } 337 0 337
3478 0 elsif (/\G (\\\/) /oxgc) { $regexp .= $1; } # splitqr// --> split qr//
3479 44 elsif (/\G \/ ([cgimosxpadlunbB]*) /oxgc) { return e_split($e.q{ qr}, '/','/',$regexp,$1); } # / / --> qr / /
3480 337 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
3481 }
3482 0 die __FILE__, ": Search pattern not terminated\n";
3483 }
3484 }
3485  
3486 # tr/// or y///
3487  
3488 # about [cdsrbB]* (/B modifier)
3489 #
3490 # P.559 appendix C
3491 # of ISBN 4-89052-384-7 Programming perl
3492 # (Japanese title is: Perl puroguramingu)
3493  
3494 elsif (/\G \b ( tr | y ) \b /oxgc) {
3495 4 my $ope = $1;
3496  
3497 # $1 $2 $3 $4 $5 $6
3498 4 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ((?:$qq_char)*?) (\#) ([cdsrbB]*) /oxgc) { # tr# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin1::qq_char)*?) (\#) ((?:$Elatin1::qq_char)*?) (\#) ([cdsrbB]*) /cgox) { } 0 4 4
3499 0 my @tr = ($tr_variable,$2);
3500 0 return e_tr(@tr,'',$4,$6);
3501 }
3502 else {
3503 4 my $e = '';
3504 4 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 4 0 4
3505 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) ((?:$Elatin1::qq_char)*?) (\1) ((?:$Elatin1::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 4 0 4
3506 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) {
3507 0 my @tr = ($tr_variable,$2);
3508 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3509 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) ((?:$Elatin1::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3510 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) ( )
3511 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) { }
3512 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) [ ]
3513 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) < >
3514 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) * *
3515 }
3516 0 die __FILE__, ": Transliteration replacement not terminated\n";
3517 }
3518 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) {
3519 0 my @tr = ($tr_variable,$2);
3520 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3521 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) ((?:$Elatin1::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3522 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } ( )
3523 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } { }
3524 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } [ ]
3525 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } < >
3526 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } * *
3527 }
3528 0 die __FILE__, ": Transliteration replacement not terminated\n";
3529 }
3530 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) {
3531 0 my @tr = ($tr_variable,$2);
3532 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3533 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) ((?:$Elatin1::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3534 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] ( )
3535 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] { }
3536 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] [ ]
3537 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] < >
3538 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] * *
3539 }
3540 0 die __FILE__, ": Transliteration replacement not terminated\n";
3541 }
3542 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) {
3543 0 my @tr = ($tr_variable,$2);
3544 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3545 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) ((?:$Elatin1::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3546 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > ( )
3547 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > { }
3548 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > [ ]
3549 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > < >
3550 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > * *
3551 }
3552 0 die __FILE__, ": Transliteration replacement not terminated\n";
3553 }
3554 # $1 $2 $3 $4 $5 $6
3555 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { # tr * * *
3556 4 my @tr = ($tr_variable,$2);
3557 4 return e_tr(@tr,'',$4,$6);
3558 }
3559 }
3560 0 die __FILE__, ": Transliteration pattern not terminated\n";
3561 }
3562 }
3563  
3564 # qq//
3565 elsif (/\G \b (qq) \b /oxgc) {
3566 2252 my $ope = $1;
3567  
3568 # if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { return e_qq($ope,$1,$3,$2); } # qq# #
3569 2252 ▶ if (/\G (\#) /oxgc) { # qq# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) /cgox) { } 0 2252 2252
3570 0 my $qq_string = '';
3571 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3572 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 ($Elatin1::qq_char) /cgox) { } 0 0 0
3573 0 elsif (/\G (\\\#) /oxgc) { $qq_string .= $1; }
3574 0 elsif (/\G (\#) /oxgc) { return e_qq($ope,'#','#',$qq_string); }
3575 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3576 }
3577 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3578 }
3579  
3580 else {
3581 2252 my $e = '';
3582 2252 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 2252 0 2252
3583 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
3584  
3585 # elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq ( )
3586 elsif (/\G (\() /oxgc) { # qq ( )
3587 0 my $qq_string = '';
3588 0 local $nest = 1;
3589 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3590 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 ($Elatin1::qq_char) /cgox) { } 0 0 0
3591 0 elsif (/\G (\\\)) /oxgc) { $qq_string .= $1; }
3592 0 elsif (/\G (\() /oxgc) { $qq_string .= $1; $nest++; }
3593 elsif (/\G (\)) /oxgc) {
3594 0 ▶ if (--$nest == 0) { return $e . e_qq($ope,'(',')',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin1::nest == 0) { } 0 0 0
3595 0 else { $qq_string .= $1; }
3596 }
3597 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3598 }
3599 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3600 }
3601  
3602 # elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq { }
3603 elsif (/\G (\{) /oxgc) { # qq { }
3604 2222 my $qq_string = '';
3605 2222 local $nest = 1;
3606 2222 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 85104 0 85104
3607 85104 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 5 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 722 84382 85104
elsif (/\G (\\\}) /cgox) { } 0 84382 84382
elsif (/\G (\{) /cgox) { } 1189 83193 84382
elsif (/\G (\}) /cgox) { } 3411 79782 83193
elsif (/\G ($Elatin1::qq_char) /cgox) { } 79782 0 79782
3608 0 elsif (/\G (\\\}) /oxgc) { $qq_string .= $1; }
3609 1189 elsif (/\G (\{) /oxgc) { $qq_string .= $1; $nest++; }
3610 elsif (/\G (\}) /oxgc) {
3611 3411 ▶ if (--$nest == 0) { return $e . e_qq($ope,'{','}',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin1::nest == 0) { } 2222 1189 3411
3612 1189 else { $qq_string .= $1; }
3613 }
3614 79782 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3615 }
3616 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3617 }
3618  
3619 # elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq [ ]
3620 elsif (/\G (\[) /oxgc) { # qq [ ]
3621 0 my $qq_string = '';
3622 0 local $nest = 1;
3623 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3624 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 ($Elatin1::qq_char) /cgox) { } 0 0 0
3625 0 elsif (/\G (\\\]) /oxgc) { $qq_string .= $1; }
3626 0 elsif (/\G (\[) /oxgc) { $qq_string .= $1; $nest++; }
3627 elsif (/\G (\]) /oxgc) {
3628 0 ▶ if (--$nest == 0) { return $e . e_qq($ope,'[',']',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin1::nest == 0) { } 0 0 0
3629 0 else { $qq_string .= $1; }
3630 }
3631 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3632 }
3633 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3634 }
3635  
3636 # elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq < >
3637 elsif (/\G (\<) /oxgc) { # qq < >
3638 30 my $qq_string = '';
3639 30 local $nest = 1;
3640 30 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 1166 0 1166
3641 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 ($Elatin1::qq_char) /cgox) { } 1114 0 1114
3642 0 elsif (/\G (\\\>) /oxgc) { $qq_string .= $1; }
3643 0 elsif (/\G (\<) /oxgc) { $qq_string .= $1; $nest++; }
3644 elsif (/\G (\>) /oxgc) {
3645 30 ▶ if (--$nest == 0) { return $e . e_qq($ope,'<','>',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin1::nest == 0) { } 30 0 30
3646 0 else { $qq_string .= $1; }
3647 }
3648 1114 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3649 }
3650 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3651 }
3652  
3653 # elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq * *
3654 elsif (/\G (\S) /oxgc) { # qq * *
3655 0 my $delimiter = $1;
3656 0 my $qq_string = '';
3657 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3658 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 ($Elatin1::qq_char) /cgox) { } 0 0 0
3659 0 elsif (/\G (\\\Q$delimiter\E) /oxgc) { $qq_string .= $1; }
3660 0 elsif (/\G (\Q$delimiter\E) /oxgc) { return $e . e_qq($ope,$delimiter,$delimiter,$qq_string); }
3661 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3662 }
3663 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3664 }
3665 }
3666 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3667 }
3668 }
3669  
3670 # qr//
3671 elsif (/\G \b (qr) \b /oxgc) {
3672 0 my $ope = $1;
3673 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { # qr# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin1::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 0 0
3674 0 return e_qr($ope,$1,$3,$2,$4);
3675 }
3676 else {
3677 0 my $e = '';
3678 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3679 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 (\') ((?:$Elatin1::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin1::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin1::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
3680 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr ( )
3681 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr { }
3682 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr [ ]
3683 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr < >
3684 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { return $e . e_qr_q($ope,$1, $3, $2,$4); } # qr ' '
3685 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,'{','}',$2,$4); } # qr | | --> qr { }
3686 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr * *
3687 }
3688 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3689 }
3690 }
3691  
3692 # qw//
3693 elsif (/\G \b (qw) \b /oxgc) {
3694 16 my $ope = $1;
3695 16 ▶ if (/\G (\#) (.*?) (\#) /oxmsgc) { # qw# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) (.*?) (\#) /cgmosx) { } 0 16 16
3696 0 return e_qw($ope,$1,$3,$2);
3697 }
3698 else {
3699 16 my $e = '';
3700 16 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 16 0 16
3701 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) ((?:$Elatin1::q_char)*?) (\1) /cgmosx) { } 0 0 0
3702  
3703 16 elsif (/\G (\() ([^(]*?) (\)) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw ( )
3704 0 elsif (/\G (\() ((?:$q_paren)*?) (\)) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw ( )
3705  
3706 0 elsif (/\G (\{) ([^{]*?) (\}) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw { }
3707 0 elsif (/\G (\{) ((?:$q_brace)*?) (\}) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw { }
3708  
3709 0 elsif (/\G (\[) ([^[]*?) (\]) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw [ ]
3710 0 elsif (/\G (\[) ((?:$q_bracket)*?) (\]) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw [ ]
3711  
3712 0 elsif (/\G (\<) ([^<]*?) (\>) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw < >
3713 0 elsif (/\G (\<) ((?:$q_angle)*?) (\>) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw < >
3714  
3715 0 elsif (/\G ([\x21-\x3F]) (.*?) (\1) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw * *
3716 0 elsif (/\G (\S) ((?:$q_char)*?) (\1) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw * *
3717 }
3718 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3719 }
3720 }
3721  
3722 # qx//
3723 elsif (/\G \b (qx) \b /oxgc) {
3724 0 my $ope = $1;
3725 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qx# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin1::qq_char)*?) (\#) /cgox) { } 0 0 0
3726 0 return e_qq($ope,$1,$3,$2);
3727 }
3728 else {
3729 0 my $e = '';
3730 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3731 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 (\') ((?:$Elatin1::qq_char)*?) (\') /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin1::qq_char)*?) (\1) /cgox) { } 0 0 0
3732 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx ( )
3733 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx { }
3734 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx [ ]
3735 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx < >
3736 0 elsif (/\G (\') ((?:$qq_char)*?) (\') /oxgc) { return $e . e_q ($ope,$1,$3,$2); } # qx ' '
3737 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx * *
3738 }
3739 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3740 }
3741 }
3742  
3743 # q//
3744 elsif (/\G \b (q) \b /oxgc) {
3745 473 my $ope = $1;
3746  
3747 # if (/\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { return e_q($ope,$1,$3,$2); } # q# #
3748  
3749 # avoid "Error: Runtime exception" of perl version 5.005_03
3750 # (and so on)
3751  
3752 473 ▶ if (/\G (\#) /oxgc) { # q# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) /cgox) { } 0 473 473
3753 0 my $q_string = '';
3754 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3755 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 ($Elatin1::q_char) /cgox) { } 0 0 0
3756 0 elsif (/\G (\\\#) /oxgc) { $q_string .= $1; }
3757 0 elsif (/\G (\#) /oxgc) { return e_q($ope,'#','#',$q_string); }
3758 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3759 }
3760 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3761 }
3762  
3763 else {
3764 473 my $e = '';
3765 473 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 473 0 473
3766 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
3767  
3768 # elsif (/\G (\() ((?:\\\)|\\\\|$q_paren)*?) (\)) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q ( )
3769 elsif (/\G (\() /oxgc) { # q ( )
3770 0 my $q_string = '';
3771 0 local $nest = 1;
3772 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3773 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 ($Elatin1::q_char) /cgox) { } 0 0 0
3774 0 elsif (/\G (\\\)) /oxgc) { $q_string .= $1; }
3775 0 elsif (/\G (\\\() /oxgc) { $q_string .= $1; }
3776 0 elsif (/\G (\() /oxgc) { $q_string .= $1; $nest++; }
3777 elsif (/\G (\)) /oxgc) {
3778 0 ▶ if (--$nest == 0) { return $e . e_q($ope,'(',')',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin1::nest == 0) { } 0 0 0
3779 0 else { $q_string .= $1; }
3780 }
3781 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3782 }
3783 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3784 }
3785  
3786 # elsif (/\G (\{) ((?:\\\}|\\\\|$q_brace)*?) (\}) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q { }
3787 elsif (/\G (\{) /oxgc) { # q { }
3788 467 my $q_string = '';
3789 467 local $nest = 1;
3790 467 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 8249 0 8249
3791 0 ▶ if (/\G (\\\\) /oxgc) { $q_string .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 8249 8249
elsif (/\G (\\\}) /cgox) { } 0 8249 8249
elsif (/\G (\\\{) /cgox) { } 0 8249 8249
elsif (/\G (\{) /cgox) { } 159 8090 8249
elsif (/\G (\}) /cgox) { } 626 7464 8090
elsif (/\G ($Elatin1::q_char) /cgox) { } 7464 0 7464
3792 0 elsif (/\G (\\\}) /oxgc) { $q_string .= $1; }
3793 0 elsif (/\G (\\\{) /oxgc) { $q_string .= $1; }
3794 159 elsif (/\G (\{) /oxgc) { $q_string .= $1; $nest++; }
3795 elsif (/\G (\}) /oxgc) {
3796 626 ▶ if (--$nest == 0) { return $e . e_q($ope,'{','}',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin1::nest == 0) { } 467 159 626
3797 159 else { $q_string .= $1; }
3798 }
3799 7464 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3800 }
3801 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3802 }
3803  
3804 # elsif (/\G (\[) ((?:\\\]|\\\\|$q_bracket)*?) (\]) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q [ ]
3805 elsif (/\G (\[) /oxgc) { # q [ ]
3806 0 my $q_string = '';
3807 0 local $nest = 1;
3808 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3809 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 ($Elatin1::q_char) /cgox) { } 0 0 0
3810 0 elsif (/\G (\\\]) /oxgc) { $q_string .= $1; }
3811 0 elsif (/\G (\\\[) /oxgc) { $q_string .= $1; }
3812 0 elsif (/\G (\[) /oxgc) { $q_string .= $1; $nest++; }
3813 elsif (/\G (\]) /oxgc) {
3814 0 ▶ if (--$nest == 0) { return $e . e_q($ope,'[',']',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin1::nest == 0) { } 0 0 0
3815 0 else { $q_string .= $1; }
3816 }
3817 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3818 }
3819 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3820 }
3821  
3822 # elsif (/\G (\<) ((?:\\\>|\\\\|$q_angle)*?) (\>) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q < >
3823 elsif (/\G (\<) /oxgc) { # q < >
3824 5 my $q_string = '';
3825 5 local $nest = 1;
3826 5 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 88 0 88
3827 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 ($Elatin1::q_char) /cgox) { } 83 0 83
3828 0 elsif (/\G (\\\>) /oxgc) { $q_string .= $1; }
3829 0 elsif (/\G (\\\<) /oxgc) { $q_string .= $1; }
3830 0 elsif (/\G (\<) /oxgc) { $q_string .= $1; $nest++; }
3831 elsif (/\G (\>) /oxgc) {
3832 5 ▶ if (--$nest == 0) { return $e . e_q($ope,'<','>',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin1::nest == 0) { } 5 0 5
3833 0 else { $q_string .= $1; }
3834 }
3835 83 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3836 }
3837 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3838 }
3839  
3840 # elsif (/\G (\S) ((?:\\\1|\\\\|$q_char)*?) (\1) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q * *
3841 elsif (/\G (\S) /oxgc) { # q * *
3842 1 my $delimiter = $1;
3843 1 my $q_string = '';
3844 1 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 14 0 14
3845 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 ($Elatin1::q_char) /cgox) { } 13 0 13
3846 0 elsif (/\G (\\\Q$delimiter\E) /oxgc) { $q_string .= $1; }
3847 1 elsif (/\G (\Q$delimiter\E) /oxgc) { return $e . e_q($ope,$delimiter,$delimiter,$q_string); }
3848 13 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3849 }
3850 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3851 }
3852 }
3853 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3854 }
3855 }
3856  
3857 # m//
3858 elsif (/\G \b (m) \b /oxgc) {
3859 209 my $ope = $1;
3860 209 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { # m# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin1::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
3861 0 return e_qr($ope,$1,$3,$2,$4);
3862 }
3863 else {
3864 209 my $e = '';
3865 209 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 209 0 209
3866 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 (\?) ((?:$Elatin1::qq_char)*?) (\?) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
elsif (/\G (\') ((?:$Elatin1::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 10 199 209
elsif (/\G ([*\-:\\^|]) ((?:$Elatin1::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 199 199
elsif (/\G (\S) ((?:$Elatin1::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 199 0 199
3867 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m ( )
3868 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m { }
3869 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m [ ]
3870 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m < >
3871 0 elsif (/\G (\?) ((?:$qq_char)*?) (\?) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m ? ?
3872 10 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr_q($ope,$1, $3, $2,$4); } # m ' '
3873 0 elsif (/\G ([*\-:\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,'{','}',$2,$4); } # m | | --> m { }
3874 199 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m * *
3875 }
3876 0 die __FILE__, ": Search pattern not terminated\n";
3877 }
3878 }
3879  
3880 # s///
3881  
3882 # about [cegimosxpradlunbB]* (/cg modifier)
3883 #
3884 # P.67 Pattern-Matching Operators
3885 # of ISBN 0-596-00241-6 Perl in a Nutshell, Second Edition.
3886  
3887 elsif (/\G \b (s) \b /oxgc) {
3888 101 my $ope = $1;
3889  
3890 # $1 $2 $3 $4 $5 $6
3891 101 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ((?:$qq_char)*?) (\#) ([cegimosxpradlunbB]*) /oxgc) { # s# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin1::qq_char)*?) (\#) ((?:$Elatin1::qq_char)*?) (\#) ([cegimosxpradlunbB]*) /cgox) { } 1 100 101
3892 1 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3893 }
3894 else {
3895 100 my $e = '';
3896 100 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 100 0 100
3897 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 (\') ((?:$Elatin1::qq_char)*?) (\') ((?:$Elatin1::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 21 79 100
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin1::qq_char)*?) (\1) ((?:$Elatin1::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 79 79
elsif (/\G (\$) ((?:$Elatin1::qq_char)*?) (\1) ((?:$Elatin1::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 79 79
elsif (/\G (\S) ((?:$Elatin1::qq_char)*?) (\1) ((?:$Elatin1::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 79 0 79
3898 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) {
3899 0 my @s = ($1,$2,$3);
3900 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3901 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 (\') ((?:$Elatin1::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin1::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Elatin1::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Elatin1::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin1::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3902 # $1 $2 $3 $4
3903 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3904 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3905 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3906 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3907 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3908 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3909 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3910 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3911 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3912 }
3913 0 die __FILE__, ": Substitution replacement not terminated\n";
3914 }
3915 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) {
3916 0 my @s = ($1,$2,$3);
3917 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3918 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 (\') ((?:$Elatin1::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin1::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Elatin1::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Elatin1::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin1::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3919 # $1 $2 $3 $4
3920 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3921 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3922 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3923 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3924 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3925 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3926 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3927 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3928 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3929 }
3930 0 die __FILE__, ": Substitution replacement not terminated\n";
3931 }
3932 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) {
3933 0 my @s = ($1,$2,$3);
3934 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3935 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 (\') ((?:$Elatin1::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin1::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin1::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3936 # $1 $2 $3 $4
3937 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3938 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3939 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3940 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3941 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3942 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3943 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3944 }
3945 0 die __FILE__, ": Substitution replacement not terminated\n";
3946 }
3947 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) {
3948 0 my @s = ($1,$2,$3);
3949 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3950 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 (\') ((?:$Elatin1::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin1::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Elatin1::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Elatin1::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin1::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3951 # $1 $2 $3 $4
3952 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3953 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3954 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3955 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3956 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3957 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3958 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3959 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3960 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3961 }
3962 0 die __FILE__, ": Substitution replacement not terminated\n";
3963 }
3964 # $1 $2 $3 $4 $5 $6
3965 elsif (/\G (\') ((?:$qq_char)*?) (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) {
3966 21 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3967 }
3968 # $1 $2 $3 $4 $5 $6
3969 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
3970 0 return e_sub($sub_variable,'{',$2,'}','{',$4,'}',$6); # s | | | --> s { } { }
3971 }
3972 # $1 $2 $3 $4 $5 $6
3973 elsif (/\G (\$) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
3974 0 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3975 }
3976 # $1 $2 $3 $4 $5 $6
3977 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
3978 79 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3979 }
3980 }
3981 0 die __FILE__, ": Substitution pattern not terminated\n";
3982 }
3983 }
3984  
3985 # require ignore module
3986 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# require$1$2"; }
3987 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# require$1\n$2"; }
3988 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# require$1"; }
3989  
3990 # use strict; --> use strict; no strict qw(refs);
3991 37 elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "use$1 no strict qw(refs);$2"; }
3992 0 elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [^#]) /oxmsgc) { return "use$1 no strict qw(refs);\n$2"; }
3993 0 elsif (/\G \b use ((?>\s+) strict) \b /oxmsgc) { return "use$1; no strict qw(refs)"; }
3994  
3995 # use 5.12.0; --> use 5.12.0; no strict qw(refs);
3996 elsif (/\G \b use (?>\s+) ((?>([1-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /oxmsgc) {
3997 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
3998 0 return "use $1; no strict qw(refs);";
3999 }
4000 else {
4001 2 return "use $1;";
4002 }
4003 }
4004 elsif (/\G \b use (?>\s+) ((?>v([0-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /oxmsgc) {
4005 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
4006 0 return "use $1; no strict qw(refs);";
4007 }
4008 else {
4009 0 return "use $1;";
4010 }
4011 }
4012  
4013 # ignore use module
4014 2 elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# use$1$2"; }
4015 0 elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# use$1\n$2"; }
4016 0 elsif (/\G \b use ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# use$1"; }
4017  
4018 # ignore no module
4019 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# no$1$2"; }
4020 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# no$1\n$2"; }
4021 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# no$1"; }
4022  
4023 # use else
4024 0 elsif (/\G \b use \b /oxmsgc) { return "use"; }
4025  
4026 # use else
4027 2 elsif (/\G \b no \b /oxmsgc) { return "no"; }
4028  
4029 # ''
4030 elsif (/\G (?<![\w\$\@\%\&\*]) (\') /oxgc) {
4031 1142 my $q_string = '';
4032 1142 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 10175 0 10175
4033 10175 ▶ if (/\G (\\\\) /oxgc) { $q_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 4 10171 10175
elsif (/\G (\\\') /cgox) { } 48 10123 10171
elsif (/\G \' /cgox) { } 1142 8981 10123
elsif (/\G ($Elatin1::q_char) /cgox) { } 8981 0 8981
4034 48 elsif (/\G (\\\') /oxgc) { $q_string .= $1; }
4035 1142 elsif (/\G \' /oxgc) { return e_q('', "'","'",$q_string); }
4036 8981 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
4037 }
4038 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4039 }
4040  
4041 # ""
4042 elsif (/\G (\") /oxgc) {
4043 1857 my $qq_string = '';
4044 1857 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 36958 0 36958
4045 36958 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 67 36891 36958
elsif (/\G (\\\") /cgox) { } 12 36879 36891
elsif (/\G \" /cgox) { } 1857 35022 36879
elsif (/\G ($Elatin1::q_char) /cgox) { } 35022 0 35022
4046 12 elsif (/\G (\\\") /oxgc) { $qq_string .= $1; }
4047 1857 elsif (/\G \" /oxgc) { return e_qq('', '"','"',$qq_string); }
4048 35022 elsif (/\G ($q_char) /oxgc) { $qq_string .= $1; }
4049 }
4050 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4051 }
4052  
4053 # ``
4054 elsif (/\G (\`) /oxgc) {
4055 1 my $qx_string = '';
4056 1 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 19 0 19
4057 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 ($Elatin1::q_char) /cgox) { } 18 0 18
4058 0 elsif (/\G (\\\`) /oxgc) { $qx_string .= $1; }
4059 1 elsif (/\G \` /oxgc) { return e_qq('', '`','`',$qx_string); }
4060 18 elsif (/\G ($q_char) /oxgc) { $qx_string .= $1; }
4061 }
4062 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4063 }
4064  
4065 # // --- not divide operator (num / num), not defined-or
4066 ▶ elsif (($slash eq 'm//') and /\G (\/) /oxgc) {
Condition100%3/3
$Elatin1::slash eq "m//" and m[\G (/) ]cgox
!ll&&!rl&&r
273188836681
MC/DC100%2/2
$Elatin1::slash eq "m//" and m[\G (/) ]cgox
$Elatin1::slash eq "m//" m[\G (/) ]cgox
Truth table100%3/3
A and B
A= $Elatin1::slash eq "m//"B= m[\G (/) ]cgox
ABresult
0X0
100
111
4067 681 my $regexp = '';
4068 681 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 5636 0 5636
4069 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 ($Elatin1::q_char) /cgox) { } 4955 0 4955
4070 0 elsif (/\G (\\\/) /oxgc) { $regexp .= $1; }
4071 681 elsif (/\G \/ ([cgimosxpadlunbB]*) /oxgc) { return e_qr('', '/','/',$regexp,$1); }
4072 4955 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
4073 }
4074 0 die __FILE__, ": Search pattern not terminated\n";
4075 }
4076  
4077 # ?? --- not conditional operator (condition ? then : else)
4078 ▶ elsif (($slash eq 'm//') and /\G (\?) /oxgc) {
Condition66%2/3
$Elatin1::slash eq "m//" and /\G (\?) /cgox
!ll&&!rl&&r
2731888360
MC/DC0%0/2
$Elatin1::slash eq "m//" and /\G (\?) /cgox
$Elatin1::slash eq "m//" /\G (\?) /cgox
Truth table66%2/3
A and B
A= $Elatin1::slash eq "m//"B= /\G (\?) /cgox
ABresult
0X0
100
111
4079 0 my $regexp = '';
4080 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
4081 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 ($Elatin1::q_char) /cgox) { } 0 0 0
4082 0 elsif (/\G (\\\?) /oxgc) { $regexp .= $1; }
4083 0 elsif (/\G \? ([cgimosxpadlunbB]*) /oxgc) { return e_qr('m','?','?',$regexp,$1); }
4084 0 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
4085 }
4086 0 die __FILE__, ": Search pattern not terminated\n";
4087 }
4088  
4089 # <<>> (a safer ARGV)
4090 0 elsif (/\G ( <<>> ) /oxgc) { $slash = 'm//'; return $1; }
4091  
4092 # << (bit shift) --- not here document
4093 0 elsif (/\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /oxgc) { $slash = 'm//'; return $1; }
4094  
4095 # <<~'HEREDOC'
4096 elsif (/\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /oxgc) {
4097 6 $slash = 'm//';
4098 6 my $here_quote = $1;
4099 6 my $delimiter = $2;
4100  
4101 # get here document
4102 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4103 6 $here_script = CORE::substr $_, pos $_;
4104 6 $here_script =~ s/.*?\n//oxm;
4105 }
4106 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
4107 6 my $heredoc = $1;
4108 6 my $indent = $2;
4109 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4110 6 push @heredoc, $heredoc . qq{\n$delimiter\n};
4111 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4112 }
4113 else {
4114 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4115 }
4116 6 return qq{<<'$delimiter'};
4117 }
4118  
4119 # <<~\HEREDOC
4120  
4121 # P.66 2.6.6. "Here" Documents
4122 # in Chapter 2: Bits and Pieces
4123 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4124  
4125 # P.73 "Here" Documents
4126 # in Chapter 2: Bits and Pieces
4127 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4128  
4129 elsif (/\G ( <<~ \\([a-zA-Z_0-9]+) ) /oxgc) {
4130 3 $slash = 'm//';
4131 3 my $here_quote = $1;
4132 3 my $delimiter = $2;
4133  
4134 # get here document
4135 3 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 3 0 3
4136 3 $here_script = CORE::substr $_, pos $_;
4137 3 $here_script =~ s/.*?\n//oxm;
4138 }
4139 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
4140 3 my $heredoc = $1;
4141 3 my $indent = $2;
4142 3 $heredoc =~ s{^$indent}{}msg; # no /ox
4143 3 push @heredoc, $heredoc . qq{\n$delimiter\n};
4144 3 push @heredoc_delimiter, qq{\\s*$delimiter};
4145 }
4146 else {
4147 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4148 }
4149 3 return qq{<<\\$delimiter};
4150 }
4151  
4152 # <<~"HEREDOC"
4153 elsif (/\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /oxgc) {
4154 6 $slash = 'm//';
4155 6 my $here_quote = $1;
4156 6 my $delimiter = $2;
4157  
4158 # get here document
4159 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4160 6 $here_script = CORE::substr $_, pos $_;
4161 6 $here_script =~ s/.*?\n//oxm;
4162 }
4163 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
4164 6 my $heredoc = $1;
4165 6 my $indent = $2;
4166 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4167 6 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4168 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4169 }
4170 else {
4171 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4172 }
4173 6 return qq{<<"$delimiter"};
4174 }
4175  
4176 # <<~HEREDOC
4177 elsif (/\G ( <<~ ([a-zA-Z_0-9]+) ) /oxgc) {
4178 3 $slash = 'm//';
4179 3 my $here_quote = $1;
4180 3 my $delimiter = $2;
4181  
4182 # get here document
4183 3 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 3 0 3
4184 3 $here_script = CORE::substr $_, pos $_;
4185 3 $here_script =~ s/.*?\n//oxm;
4186 }
4187 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
4188 3 my $heredoc = $1;
4189 3 my $indent = $2;
4190 3 $heredoc =~ s{^$indent}{}msg; # no /ox
4191 3 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4192 3 push @heredoc_delimiter, qq{\\s*$delimiter};
4193 }
4194 else {
4195 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4196 }
4197 3 return qq{<<$delimiter};
4198 }
4199  
4200 # <<~`HEREDOC`
4201 elsif (/\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /oxgc) {
4202 6 $slash = 'm//';
4203 6 my $here_quote = $1;
4204 6 my $delimiter = $2;
4205  
4206 # get here document
4207 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4208 6 $here_script = CORE::substr $_, pos $_;
4209 6 $here_script =~ s/.*?\n//oxm;
4210 }
4211 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
4212 6 my $heredoc = $1;
4213 6 my $indent = $2;
4214 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4215 6 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4216 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4217 }
4218 else {
4219 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4220 }
4221 6 return qq{<<`$delimiter`};
4222 }
4223  
4224 # <<'HEREDOC'
4225 elsif (/\G ( << '([a-zA-Z_0-9]*)' ) /oxgc) {
4226 72 $slash = 'm//';
4227 72 my $here_quote = $1;
4228 72 my $delimiter = $2;
4229  
4230 # get here document
4231 72 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 72 0 72
4232 72 $here_script = CORE::substr $_, pos $_;
4233 72 $here_script =~ s/.*?\n//oxm;
4234 }
4235 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
4236 72 push @heredoc, $1 . qq{\n$delimiter\n};
4237 72 push @heredoc_delimiter, $delimiter;
4238 }
4239 else {
4240 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4241 }
4242 72 return $here_quote;
4243 }
4244  
4245 # <<\HEREDOC
4246  
4247 # P.66 2.6.6. "Here" Documents
4248 # in Chapter 2: Bits and Pieces
4249 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4250  
4251 # P.73 "Here" Documents
4252 # in Chapter 2: Bits and Pieces
4253 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4254  
4255 elsif (/\G ( << \\([a-zA-Z_0-9]+) ) /oxgc) {
4256 0 $slash = 'm//';
4257 0 my $here_quote = $1;
4258 0 my $delimiter = $2;
4259  
4260 # get here document
4261 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4262 0 $here_script = CORE::substr $_, pos $_;
4263 0 $here_script =~ s/.*?\n//oxm;
4264 }
4265 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
4266 0 push @heredoc, $1 . qq{\n$delimiter\n};
4267 0 push @heredoc_delimiter, $delimiter;
4268 }
4269 else {
4270 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4271 }
4272 0 return $here_quote;
4273 }
4274  
4275 # <<"HEREDOC"
4276 elsif (/\G ( << "([a-zA-Z_0-9]*)" ) /oxgc) {
4277 36 $slash = 'm//';
4278 36 my $here_quote = $1;
4279 36 my $delimiter = $2;
4280  
4281 # get here document
4282 36 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 36 0 36
4283 36 $here_script = CORE::substr $_, pos $_;
4284 36 $here_script =~ s/.*?\n//oxm;
4285 }
4286 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
4287 36 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4288 36 push @heredoc_delimiter, $delimiter;
4289 }
4290 else {
4291 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4292 }
4293 36 return $here_quote;
4294 }
4295  
4296 # <<HEREDOC
4297 elsif (/\G ( << ([a-zA-Z_0-9]+) ) /oxgc) {
4298 42 $slash = 'm//';
4299 42 my $here_quote = $1;
4300 42 my $delimiter = $2;
4301  
4302 # get here document
4303 42 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 42 0 42
4304 42 $here_script = CORE::substr $_, pos $_;
4305 42 $here_script =~ s/.*?\n//oxm;
4306 }
4307 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
4308 42 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4309 42 push @heredoc_delimiter, $delimiter;
4310 }
4311 else {
4312 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4313 }
4314 42 return $here_quote;
4315 }
4316  
4317 # <<`HEREDOC`
4318 elsif (/\G ( << `([a-zA-Z_0-9]*)` ) /oxgc) {
4319 0 $slash = 'm//';
4320 0 my $here_quote = $1;
4321 0 my $delimiter = $2;
4322  
4323 # get here document
4324 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4325 0 $here_script = CORE::substr $_, pos $_;
4326 0 $here_script =~ s/.*?\n//oxm;
4327 }
4328 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
4329 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4330 0 push @heredoc_delimiter, $delimiter;
4331 }
4332 else {
4333 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4334 }
4335 0 return $here_quote;
4336 }
4337  
4338 # <<= <=> <= < operator
4339 elsif (/\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/oxgc) {
4340 12 return $1;
4341 }
4342  
4343 # <FILEHANDLE>
4344 elsif (/\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /oxgc) {
4345 0 return $1;
4346 }
4347  
4348 # <WILDCARD> --- glob
4349  
4350 # avoid "Error: Runtime exception" of perl version 5.005_03
4351  
4352 elsif (/\G < ((?:[^>\0\a\e\f\n\r\t])+?) > /oxgc) {
4353 0 return 'Elatin1::glob("' . $1 . '")';
4354 }
4355  
4356 # __DATA__
4357 0 elsif (/\G ^ ( __DATA__ \n .*) \z /oxmsgc) { return $1; }
4358  
4359 # __END__
4360 210 elsif (/\G ^ ( __END__ \n .*) \z /oxmsgc) { return $1; }
4361  
4362 # \cD Control-D
4363  
4364 # P.68 2.6.8. Other Literal Tokens
4365 # in Chapter 2: Bits and Pieces
4366 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4367  
4368 # P.76 Other Literal Tokens
4369 # in Chapter 2: Bits and Pieces
4370 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4371  
4372 0 elsif (/\G ( \cD .*) \z /oxmsgc) { return $1; }
4373  
4374 # \cZ Control-Z
4375 0 elsif (/\G ( \cZ .*) \z /oxmsgc) { return $1; }
4376  
4377 # any operator before div
4378 elsif (/\G (
4379 -- | \+\+ |
4380 [\)\}\]]
4381  
4382 5837 ) /oxgc) { $slash = 'div'; return $1; }
4383  
4384 # yada-yada or triple-dot operator
4385 elsif (/\G (
4386 \.\.\.
4387  
4388 7 ) /oxgc) { $slash = 'm//'; return q{die('Unimplemented')}; }
4389  
4390 # any operator before m//
4391  
4392 # //, //= (defined-or)
4393  
4394 # P.164 Logical Operators
4395 # in Chapter 10: More Control Structures
4396 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
4397  
4398 # P.119 C-Style Logical (Short-Circuit) Operators
4399 # in Chapter 3: Unary and Binary Operators
4400 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4401  
4402 # (and so on)
4403  
4404 # ~~
4405  
4406 # P.221 The Smart Match Operator
4407 # in Chapter 15: Smart Matching and given-when
4408 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
4409  
4410 # P.112 Smartmatch Operator
4411 # in Chapter 3: Unary and Binary Operators
4412 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4413  
4414 # (and so on)
4415  
4416 elsif (/\G ((?>
4417  
4418 !~~ | !~ | != | ! |
4419 %= | % |
4420 &&= | && | &= | &\.= | &\. | & |
4421 -= | -> | - |
4422 :(?>\s*)= |
4423 : |
4424 <<>> |
4425 <<= | <=> | <= | < |
4426 == | => | =~ | = |
4427 >>= | >> | >= | > |
4428 \*\*= | \*\* | \*= | \* |
4429 \+= | \+ |
4430 \.\. | \.= | \. |
4431 \/\/= | \/\/ |
4432 \/= | \/ |
4433 \? |
4434 \\ |
4435 \^= | \^\.= | \^\. | \^ |
4436 \b x= |
4437 \|\|= | \|\| | \|= | \|\.= | \|\. | \| |
4438 ~~ | ~\. | ~ |
4439 \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b |
4440 \b(?: print )\b |
4441  
4442 [,;\(\{\[]
4443  
4444 9758 )) /oxgc) { $slash = 'm//'; return $1; }
4445  
4446 # other any character
4447 20156 elsif (/\G ($q_char) /oxgc) { $slash = 'div'; return $1; }
4448  
4449 # system error
4450 else {
4451 0 die __FILE__, ": Oops, this shouldn't happen!\n";
4452 }
4453 }
4454  
4455 # escape Latin-1 string
4456 1871 ▶sub e_string {
Subroutine e_string: called CC=228 SCAR=104.2
Pod documented
4457 1871 my($string) = @_;
4458 1871 my $e_string = '';
4459  
4460 1871 local $slash = 'm//';
4461  
4462 # P.1024 Appendix W.10 Multibyte Processing
4463 # of ISBN 1-56592-224-7 CJKV Information Processing
4464 # (and so on)
4465  
4466 1871 my @char = $string =~ / \G (?>[^\\]|\\$q_char|$q_char) /oxmsg;
4467  
4468 # without { ... }
4469 1871 ▶ 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 17 1871
Condition66%2/3
grep /\A \{ \z/msx, @char and grep /\A \} \z/msx, @char
!ll&&!rl&&r
1854017
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
4470 1854 ▶ if ($string !~ /<</oxms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /<</mosx) 1854 0 1854
4471 1854 return $string;
4472 }
4473 }
4474  
4475 E_STRING_LOOP:
4476 17 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 190 17 207
4477 190 ▶ if (0) {
Branch: 101 branches
BranchTrueFalseTotal
if (do { $string =~ /\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /cgmosx }) { } 0 190 190
elsif ($string =~ /\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G ( \$' | \$\{'\} ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G ( \$ 0 ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G ( \$ \$ ) (?![\w\{]) /cgmosx) { } 0 190 190
elsif ($string =~ /\G \$ ((?>[1-9][0-9]*)) /cgmosx) { } 0 190 190
elsif ($string =~ /\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /cgmosx) { } 0 190 190
elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /cgmosx) { } 0 190 190
elsif ($string =~ /\G \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} /cgmosx) { } 0 190 190
elsif ($string =~ /\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /cgmosx) { } 3 187 190
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 180 187
elsif ($string =~ m{\G ( \$[\$\@\#\\\'\"/\?\(\)\[\]\<\>] ) }cgmosx) { } 0 180 180
elsif ($string =~ /\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b Char::eval (?= (?>\s*) \{ ) /cgox) { } 0 180 180
elsif ($string =~ /\G \b Latin1::eval (?= (?>\s*) \{ ) /cgox) { } 0 180 180
elsif ($string =~ /\G \b Char::eval \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b Latin1::eval \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::substr \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b chop \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::index \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b Char::index \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b Latin1::index \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b index \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::rindex \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b Char::rindex \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b Latin1::rindex \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b rindex \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s*) (\") ((?:$Elatin1::qq_char)+?) (\") /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\#) ((?:$Elatin1::qq_char)+?) (\#) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\S) ((?:$Elatin1::qq_char)+?) (\1) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s*) (\') ((?:\\\'|\\\\|$Elatin1::q_char)+?) (\') /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$Elatin1::q_char)+?) (\#) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$Elatin1::q_char)+?) (\1) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)*) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ))*) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?= (?>\s+) [a-z]+) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) ((?>\w+)) /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b lc \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b lcfirst \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b uc \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b ucfirst \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b fc \b /cgox) { } 0 180 180
elsif ($string =~ /\G -s \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::length \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::chr \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b chr \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::ord \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b ord \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b glob \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b reverse \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b getc \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b (split) \b (?! (?>\s*) => ) /cgox) { } 0 180 180
elsif ($string =~ /\G \b (qq) \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b (qx) \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b (q) \b /cgox) { } 0 180 180
elsif ($string =~ /\G (?<![\w\$\@\%\&\*]) (\') ((?:\\\'|\\\\|$Elatin1::q_char)*?) (\') /cgox) { } 0 180 180
elsif ($string =~ /\G (\") ((?:$Elatin1::qq_char)*?) (\") /cgox) { } 0 180 180
elsif ($string =~ /\G (\`) ((?:$Elatin1::qq_char)*?) (\`) /cgox) { } 0 180 180
elsif ($string =~ /\G ( <<>> ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/cgox) { } 0 180 180
elsif ($string =~ /\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /cgox) { } 0 180 180
elsif ($string =~ /\G < ((?:$Elatin1::q_char)+?) > /cgox) { } 0 180 180
elsif ($string =~ /\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( <<~ \\([a-zA-Z_0-9]+) ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( <<~ ([a-zA-Z_0-9]+) ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( << '([a-zA-Z_0-9]*)' ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( << \\([a-zA-Z_0-9]+) ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( << "([a-zA-Z_0-9]*)" ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( << ([a-zA-Z_0-9]+) ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( << `([a-zA-Z_0-9]*)` ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( -- | \+\+ | [\)\}\]] ) /cgox) { } 18 162 180
elsif ($string =~ /\G ( \.\.\. ) /cgox) { } 0 162 162
elsif ($string =~ m"\G ((?> !~~ | !~ | != | ! | %= | % | &&= | && | &= | &\.= | &\. | & | -= | -> | - | :(?>\s*)= | : | <<>> | <<= | <=> | <= | < | == | => | =~ | = | >>= | >> | >= | > | \*\*= | \*\* | \*= | \* | \+= | \+ | \.\. | \.= | \. | //= | // | /= | / | \? | \\ | \^= | \^\.= | \^\. | \^ | \b x= | \|\|= | \|\| | \|= | \|\.= | \|\. | \| | ~~ | ~\. | ~ | \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b | \b(?: print )\b | [,;\(\{\[] )) "cgox) { } 31 131 162
elsif ($string =~ /\G ($Elatin1::q_char) /cgox) { } 131 0 131
4478 }
4479  
4480 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> @{[Elatin1::PREMATCH()]}
4481 elsif ($string =~ /\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /oxmsgc) {
4482 0 $e_string .= q{Elatin1::PREMATCH()};
4483 0 $slash = 'div';
4484 }
4485  
4486 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> @{[Elatin1::MATCH()]}
4487 elsif ($string =~ /\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /oxmsgc) {
4488 0 $e_string .= q{Elatin1::MATCH()};
4489 0 $slash = 'div';
4490 }
4491  
4492 # $', ${'} --> $', ${'}
4493 elsif ($string =~ /\G ( \$' | \$\{'\} ) /oxmsgc) {
4494 0 $e_string .= $1;
4495 0 $slash = 'div';
4496 }
4497  
4498 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> @{[Elatin1::POSTMATCH()]}
4499 elsif ($string =~ /\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /oxmsgc) {
4500 0 $e_string .= q{Elatin1::POSTMATCH()};
4501 0 $slash = 'div';
4502 }
4503  
4504 # bareword
4505 elsif ($string =~ /\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /oxmsgc) {
4506 0 $e_string .= $1;
4507 0 $slash = 'div';
4508 }
4509  
4510 # $0 --> $0
4511 elsif ($string =~ /\G ( \$ 0 ) /oxmsgc) {
4512 0 $e_string .= $1;
4513 0 $slash = 'div';
4514 }
4515 elsif ($string =~ /\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /oxmsgc) {
4516 0 $e_string .= $1;
4517 0 $slash = 'div';
4518 }
4519  
4520 # $$ --> $$
4521 elsif ($string =~ /\G ( \$ \$ ) (?![\w\{]) /oxmsgc) {
4522 0 $e_string .= $1;
4523 0 $slash = 'div';
4524 }
4525  
4526 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
4527 # $1, $2, $3 --> $1, $2, $3 otherwise
4528 elsif ($string =~ /\G \$ ((?>[1-9][0-9]*)) /oxmsgc) {
4529 0 $e_string .= e_capture($1);
4530 0 $slash = 'div';
4531 }
4532 elsif ($string =~ /\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /oxmsgc) {
4533 0 $e_string .= e_capture($1);
4534 0 $slash = 'div';
4535 }
4536  
4537 # $$foo[ ... ] --> $ $foo->[ ... ]
4538 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /oxmsgc) {
4539 0 $e_string .= e_capture($1.'->'.$2);
4540 0 $slash = 'div';
4541 }
4542  
4543 # $$foo{ ... } --> $ $foo->{ ... }
4544 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /oxmsgc) {
4545 0 $e_string .= e_capture($1.'->'.$2);
4546 0 $slash = 'div';
4547 }
4548  
4549 # $$foo
4550 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /oxmsgc) {
4551 0 $e_string .= e_capture($1);
4552 0 $slash = 'div';
4553 }
4554  
4555 # ${ foo }
4556 elsif ($string =~ /\G \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} /oxmsgc) {
4557 0 $e_string .= '${' . $1 . '}';
4558 0 $slash = 'div';
4559 }
4560  
4561 # ${ ... }
4562 elsif ($string =~ /\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /oxmsgc) {
4563 3 $e_string .= e_capture($1);
4564 3 $slash = 'div';
4565 }
4566  
4567 # variable or function
4568 # $ @ % & * $ #
4569 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) {
4570 7 $e_string .= $1;
4571 7 $slash = 'div';
4572 }
4573 # $ $ $ $ $ $ $ $ $ $ $ $ $ $
4574 # $ @ # \ ' " / ? ( ) [ ] < >
4575 elsif ($string =~ /\G ( \$[\$\@\#\\\'\"\/\?\(\)\[\]\<\>] ) /oxmsgc) {
4576 0 $e_string .= $1;
4577 0 $slash = 'div';
4578 }
4579  
4580 # subroutines of package Elatin1
4581 0 elsif ($string =~ /\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /oxgc) { $e_string .= $1; $slash = 'm//'; }
4582 0 elsif ($string =~ /\G \b Char::eval (?= (?>\s*) \{ ) /oxgc) { $e_string .= 'eval'; $slash = 'm//'; }
4583 0 elsif ($string =~ /\G \b Latin1::eval (?= (?>\s*) \{ ) /oxgc) { $e_string .= 'eval'; $slash = 'm//'; }
4584 0 elsif ($string =~ /\G \b Char::eval \b /oxgc) { $e_string .= 'eval Char::escape'; $slash = 'm//'; }
4585 0 elsif ($string =~ /\G \b Latin1::eval \b /oxgc) { $e_string .= 'eval Latin1::escape'; $slash = 'm//'; }
4586 0 elsif ($string =~ /\G \b bytes::substr \b /oxgc) { $e_string .= 'substr'; $slash = 'm//'; }
4587 0 elsif ($string =~ /\G \b chop \b /oxgc) { $e_string .= 'Elatin1::chop'; $slash = 'm//'; }
4588 0 elsif ($string =~ /\G \b bytes::index \b /oxgc) { $e_string .= 'index'; $slash = 'm//'; }
4589 0 elsif ($string =~ /\G \b Char::index \b /oxgc) { $e_string .= 'Char::index'; $slash = 'm//'; }
4590 0 elsif ($string =~ /\G \b Latin1::index \b /oxgc) { $e_string .= 'Latin1::index'; $slash = 'm//'; }
4591 0 elsif ($string =~ /\G \b index \b /oxgc) { $e_string .= 'Elatin1::index'; $slash = 'm//'; }
4592 0 elsif ($string =~ /\G \b bytes::rindex \b /oxgc) { $e_string .= 'rindex'; $slash = 'm//'; }
4593 0 elsif ($string =~ /\G \b Char::rindex \b /oxgc) { $e_string .= 'Char::rindex'; $slash = 'm//'; }
4594 0 elsif ($string =~ /\G \b Latin1::rindex \b /oxgc) { $e_string .= 'Latin1::rindex'; $slash = 'm//'; }
4595 0 elsif ($string =~ /\G \b rindex \b /oxgc) { $e_string .= 'Elatin1::rindex'; $slash = 'm//'; }
4596 0 elsif ($string =~ /\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin1::lc'; $slash = 'm//'; }
4597 0 elsif ($string =~ /\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin1::lcfirst'; $slash = 'm//'; }
4598 0 elsif ($string =~ /\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin1::uc'; $slash = 'm//'; }
4599 0 elsif ($string =~ /\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin1::ucfirst'; $slash = 'm//'; }
4600 0 elsif ($string =~ /\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin1::fc'; $slash = 'm//'; }
4601  
4602 # "-s '' ..." means file test "-s 'filename' ..." (not means "- s/// ...")
4603 0 elsif ($string =~ /\G -s (?>\s*) (\") ((?:$qq_char)+?) (\") /oxgc) { $e_string .= '-s ' . e_qq('', $1,$3,$2); $slash = 'm//'; }
4604 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\#) ((?:$qq_char)+?) (\#) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4605 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4606 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4607 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4608 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4609 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\S) ((?:$qq_char)+?) (\1) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4610  
4611 0 elsif ($string =~ /\G -s (?>\s*) (\') ((?:\\\'|\\\\|$q_char)+?) (\') /oxgc) { $e_string .= '-s ' . e_q ('', $1,$3,$2); $slash = 'm//'; }
4612 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$q_char)+?) (\#) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4613 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4614 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4615 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4616 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4617 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$q_char)+?) (\1) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4618  
4619 elsif ($string =~ /\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)*) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ))*) /oxgc)
4620 0 { $e_string .= "-s $1"; $slash = 'm//'; }
4621 0 elsif ($string =~ /\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /oxgc) { $e_string .= "-s ($1)"; $slash = 'm//'; }
4622 0 elsif ($string =~ /\G -s (?= (?>\s+) [a-z]+) /oxgc) { $e_string .= '-s'; $slash = 'm//'; }
4623 0 elsif ($string =~ /\G -s (?>\s+) ((?>\w+)) /oxgc) { $e_string .= "-s $1"; $slash = 'm//'; }
4624  
4625 0 elsif ($string =~ /\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'length'; $slash = 'm//'; }
4626 0 elsif ($string =~ /\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'chr'; $slash = 'm//'; }
4627 0 elsif ($string =~ /\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin1::chr'; $slash = 'm//'; }
4628 0 elsif ($string =~ /\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'ord'; $slash = 'div'; }
4629 0 elsif ($string =~ /\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= $function_ord; $slash = 'div'; }
4630 0 elsif ($string =~ /\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin1::glob'; $slash = 'm//'; }
4631 0 elsif ($string =~ /\G \b lc \b /oxgc) { $e_string .= 'Elatin1::lc_'; $slash = 'm//'; }
4632 0 elsif ($string =~ /\G \b lcfirst \b /oxgc) { $e_string .= 'Elatin1::lcfirst_'; $slash = 'm//'; }
4633 0 elsif ($string =~ /\G \b uc \b /oxgc) { $e_string .= 'Elatin1::uc_'; $slash = 'm//'; }
4634 0 elsif ($string =~ /\G \b ucfirst \b /oxgc) { $e_string .= 'Elatin1::ucfirst_'; $slash = 'm//'; }
4635 0 elsif ($string =~ /\G \b fc \b /oxgc) { $e_string .= 'Elatin1::fc_'; $slash = 'm//'; }
4636 0 elsif ($string =~ /\G -s \b /oxgc) { $e_string .= '-s '; $slash = 'm//'; }
4637  
4638 0 elsif ($string =~ /\G \b bytes::length \b /oxgc) { $e_string .= 'length'; $slash = 'm//'; }
4639 0 elsif ($string =~ /\G \b bytes::chr \b /oxgc) { $e_string .= 'chr'; $slash = 'm//'; }
4640 0 elsif ($string =~ /\G \b chr \b /oxgc) { $e_string .= 'Elatin1::chr_'; $slash = 'm//'; }
4641 0 elsif ($string =~ /\G \b bytes::ord \b /oxgc) { $e_string .= 'ord'; $slash = 'div'; }
4642 0 elsif ($string =~ /\G \b ord \b /oxgc) { $e_string .= $function_ord_; $slash = 'div'; }
4643 0 elsif ($string =~ /\G \b glob \b /oxgc) { $e_string .= 'Elatin1::glob_'; $slash = 'm//'; }
4644 0 elsif ($string =~ /\G \b reverse \b /oxgc) { $e_string .= $function_reverse; $slash = 'm//'; }
4645 0 elsif ($string =~ /\G \b getc \b /oxgc) { $e_string .= $function_getc; $slash = 'm//'; }
4646 # split
4647 elsif ($string =~ /\G \b (split) \b (?! (?>\s*) => ) /oxgc) {
4648 0 $slash = 'm//';
4649  
4650 0 my $e = '';
4651 0 ▶ while ($string =~ /\G ( (?>\s+) | \( | \#.* ) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G ( (?>\s+) | \( | \#.* ) /cgox) 0 0 0
4652 0 $e .= $1;
4653 }
4654  
4655 # end of split
4656 0 ▶ if ($string =~ /\G (?= [,;\)\}\]] ) /oxgc) { return 'Elatin1::split' . $e; }
Branch: 23 branches
BranchTrueFalseTotal
if ($string =~ /\G (?= [,;\)\}\]] ) /cgox) { } 0 0 0
elsif ($string =~ /\G ( [\$\@\&\*] $qq_scalar ) /cgox) { } 0 0 0
elsif ($string =~ /\G \b qq (\#) [ ] (\#) /cgox) { } 0 0 0
elsif ($string =~ /\G \b qq ((?>\s*)) (\() [ ] (\)) /cgox) { } 0 0 0
elsif ($string =~ /\G \b qq ((?>\s*)) (\{) [ ] (\}) /cgox) { } 0 0 0
elsif ($string =~ /\G \b qq ((?>\s*)) (\[) [ ] (\]) /cgox) { } 0 0 0
elsif ($string =~ /\G \b qq ((?>\s*)) (\<) [ ] (\>) /cgox) { } 0 0 0
elsif ($string =~ /\G \b qq ((?>\s*)) (\S) [ ] (\2) /cgox) { } 0 0 0
elsif ($string =~ /\G \b q (\#) [ ] (\#) /cgox) { } 0 0 0
elsif ($string =~ /\G \b q ((?>\s*)) (\() [ ] (\)) /cgox) { } 0 0 0
elsif ($string =~ /\G \b q ((?>\s*)) (\{) [ ] (\}) /cgox) { } 0 0 0
elsif ($string =~ /\G \b q ((?>\s*)) (\[) [ ] (\]) /cgox) { } 0 0 0
elsif ($string =~ /\G \b q ((?>\s*)) (\<) [ ] (\>) /cgox) { } 0 0 0
elsif ($string =~ /\G \b q ((?>\s*)) (\S) [ ] (\2) /cgox) { } 0 0 0
elsif ($string =~ /\G ' [ ] ' /cgox) { } 0 0 0
elsif ($string =~ /\G " [ ] " /cgox) { } 0 0 0
elsif ($string =~ /\G \b (qq) \b /cgox) { } 0 0 0
elsif ($string =~ /\G \b (qr) \b /cgox) { } 0 0 0
elsif ($string =~ /\G \b (q) \b /cgox) { } 0 0 0
elsif ($string =~ /\G \b (m) \b /cgox) { } 0 0 0
elsif ($string =~ /\G (\') /cgox) { } 0 0 0
elsif ($string =~ /\G (\") /cgox) { } 0 0 0
elsif ($string =~ m[\G (/) ]cgox) { } 0 0 0
4657  
4658 # split scalar value
4659 0 elsif ($string =~ /\G ( [\$\@\&\*] $qq_scalar ) /oxgc) { $e_string .= 'Elatin1::split' . $e . e_string($1); next E_STRING_LOOP; }
4660  
4661 # split literal space
4662 0 elsif ($string =~ /\G \b qq (\#) [ ] (\#) /oxgc) { $e_string .= 'Elatin1::split' . $e . qq {qq$1 $2}; next E_STRING_LOOP; }
4663 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\() [ ] (\)) /oxgc) { $e_string .= 'Elatin1::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4664 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\{) [ ] (\}) /oxgc) { $e_string .= 'Elatin1::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4665 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\[) [ ] (\]) /oxgc) { $e_string .= 'Elatin1::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4666 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\<) [ ] (\>) /oxgc) { $e_string .= 'Elatin1::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4667 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\S) [ ] (\2) /oxgc) { $e_string .= 'Elatin1::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4668 0 elsif ($string =~ /\G \b q (\#) [ ] (\#) /oxgc) { $e_string .= 'Elatin1::split' . $e . qq {q$1 $2}; next E_STRING_LOOP; }
4669 0 elsif ($string =~ /\G \b q ((?>\s*)) (\() [ ] (\)) /oxgc) { $e_string .= 'Elatin1::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4670 0 elsif ($string =~ /\G \b q ((?>\s*)) (\{) [ ] (\}) /oxgc) { $e_string .= 'Elatin1::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4671 0 elsif ($string =~ /\G \b q ((?>\s*)) (\[) [ ] (\]) /oxgc) { $e_string .= 'Elatin1::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4672 0 elsif ($string =~ /\G \b q ((?>\s*)) (\<) [ ] (\>) /oxgc) { $e_string .= 'Elatin1::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4673 0 elsif ($string =~ /\G \b q ((?>\s*)) (\S) [ ] (\2) /oxgc) { $e_string .= 'Elatin1::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4674 0 elsif ($string =~ /\G ' [ ] ' /oxgc) { $e_string .= 'Elatin1::split' . $e . qq {' '}; next E_STRING_LOOP; }
4675 0 elsif ($string =~ /\G " [ ] " /oxgc) { $e_string .= 'Elatin1::split' . $e . qq {" "}; next E_STRING_LOOP; }
4676  
4677 # split qq//
4678 elsif ($string =~ /\G \b (qq) \b /oxgc) {
4679 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Elatin1::qq_char)*?) (\#) /cgox) { } 0 0 0
4680 else {
4681 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4682 0 ▶ if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e_string .= $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 ([*\-:?\\^|]) ((?:$Elatin1::qq_char)*?) (\1) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Elatin1::qq_char)*?) (\1) /cgox) { } 0 0 0
4683 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq ( ) --> qr ( )
4684 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq { } --> qr { }
4685 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq [ ] --> qr [ ]
4686 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq < > --> qr < >
4687 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= e_split($e.'qr','{','}',$2,''); next E_STRING_LOOP; } # qq | | --> qr { }
4688 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq * * --> qr * *
4689 }
4690 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4691 }
4692 }
4693  
4694 # split qr//
4695 elsif ($string =~ /\G \b (qr) \b /oxgc) {
4696 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1,$3,$2,$4); next E_STRING_LOOP; } # qr# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Elatin1::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 0 0
4697 else {
4698 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4699 0 ▶ if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e_string .= $e . $1; }
Branch: 8 branches
BranchTrueFalseTotal
if ($string =~ /\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\') ((?:$Elatin1::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$Elatin1::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Elatin1::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
4700 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr ( )
4701 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr { }
4702 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr [ ]
4703 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr < >
4704 0 elsif ($string =~ /\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split_q($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr ' '
4705 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr','{','}',$2,$4); next E_STRING_LOOP; } # qr | | --> qr { }
4706 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr * *
4707 }
4708 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4709 }
4710 }
4711  
4712 # split q//
4713 elsif ($string =~ /\G \b (q) \b /oxgc) {
4714 0 ▶ if ($string =~ /\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:\\\#|\\\\|$Elatin1::q_char)*?) (\#) /cgox) { } 0 0 0
4715 else {
4716 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4717 0 ▶ if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e_string .= $e . $1; }
Branch: 7 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 ([*\-:?\\^|]) ((?:$Elatin1::q_char)*?) (\1) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:\\\\|\\\1| $Elatin1::q_char)*?) (\1) /cgox) { } 0 0 0
4718 0 elsif ($string =~ /\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q ( ) --> qr ( )
4719 0 elsif ($string =~ /\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q { } --> qr { }
4720 0 elsif ($string =~ /\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q [ ] --> qr [ ]
4721 0 elsif ($string =~ /\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q < > --> qr < >
4722 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$q_char)*?) (\1) /oxgc) { $e_string .= e_split_q($e.'qr','{','}',$2,''); next E_STRING_LOOP; } # q | | --> qr { }
4723 0 elsif ($string =~ /\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q * * --> qr * *
4724 }
4725 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4726 }
4727 }
4728  
4729 # split m//
4730 elsif ($string =~ /\G \b (m) \b /oxgc) {
4731 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1,$3,$2,$4); next E_STRING_LOOP; } # m# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Elatin1::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
4732 else {
4733 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4734 0 ▶ if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e_string .= $e . $1; }
Branch: 8 branches
BranchTrueFalseTotal
if ($string =~ /\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\') ((?:$Elatin1::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$Elatin1::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Elatin1::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
4735 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m ( ) --> qr ( )
4736 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m { } --> qr { }
4737 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m [ ] --> qr [ ]
4738 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m < > --> qr < >
4739 0 elsif ($string =~ /\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split_q($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m ' ' --> qr ' '
4740 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr','{','}',$2,$4); next E_STRING_LOOP; } # m | | --> qr { }
4741 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m * * --> qr * *
4742 }
4743 0 die __FILE__, ": Search pattern not terminated\n";
4744 }
4745 }
4746  
4747 # split ''
4748 elsif ($string =~ /\G (\') /oxgc) {
4749 0 my $q_string = '';
4750 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4751 0 ▶ if ($string =~ /\G (\\\\) /oxgc) { $q_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if ($string =~ /\G (\\\\) /cgox) { } 0 0 0
elsif ($string =~ /\G (\\\') /cgox) { } 0 0 0
elsif ($string =~ /\G \' /cgox) { } 0 0 0
elsif ($string =~ /\G ($Elatin1::q_char) /cgox) { } 0 0 0
4752 0 elsif ($string =~ /\G (\\\') /oxgc) { $q_string .= $1; } # splitqr'' --> split qr''
4753 0 elsif ($string =~ /\G \' /oxgc) { $e_string .= e_split_q($e.q{ qr},"'","'",$q_string,''); next E_STRING_LOOP; } # ' ' --> qr ' '
4754 0 elsif ($string =~ /\G ($q_char) /oxgc) { $q_string .= $1; }
4755 }
4756 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4757 }
4758  
4759 # split ""
4760 elsif ($string =~ /\G (\") /oxgc) {
4761 0 my $qq_string = '';
4762 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4763 0 ▶ if ($string =~ /\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if ($string =~ /\G (\\\\) /cgox) { } 0 0 0
elsif ($string =~ /\G (\\\") /cgox) { } 0 0 0
elsif ($string =~ /\G \" /cgox) { } 0 0 0
elsif ($string =~ /\G ($Elatin1::q_char) /cgox) { } 0 0 0
4764 0 elsif ($string =~ /\G (\\\") /oxgc) { $qq_string .= $1; } # splitqr"" --> split qr""
4765 0 elsif ($string =~ /\G \" /oxgc) { $e_string .= e_split($e.q{ qr},'"','"',$qq_string,''); next E_STRING_LOOP; } # " " --> qr " "
4766 0 elsif ($string =~ /\G ($q_char) /oxgc) { $qq_string .= $1; }
4767 }
4768 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4769 }
4770  
4771 # split //
4772 elsif ($string =~ /\G (\/) /oxgc) {
4773 0 my $regexp = '';
4774 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4775 0 ▶ if ($string =~ /\G (\\\\) /oxgc) { $regexp .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if ($string =~ /\G (\\\\) /cgox) { } 0 0 0
elsif ($string =~ m[\G (\\/) ]cgox) { } 0 0 0
elsif ($string =~ m[\G / ([cgimosxpadlunbB]*) ]cgox) { } 0 0 0
elsif ($string =~ /\G ($Elatin1::q_char) /cgox) { } 0 0 0
4776 0 elsif ($string =~ /\G (\\\/) /oxgc) { $regexp .= $1; } # splitqr// --> split qr//
4777 0 elsif ($string =~ /\G \/ ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split($e.q{ qr}, '/','/',$regexp,$1); next E_STRING_LOOP; } # / / --> qr / /
4778 0 elsif ($string =~ /\G ($q_char) /oxgc) { $regexp .= $1; }
4779 }
4780 0 die __FILE__, ": Search pattern not terminated\n";
4781 }
4782 }
4783  
4784 # qq//
4785 elsif ($string =~ /\G \b (qq) \b /oxgc) {
4786 0 my $ope = $1;
4787 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qq# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Elatin1::qq_char)*?) (\#) /cgox) { } 0 0 0
4788 0 $e_string .= e_qq($ope,$1,$3,$2);
4789 }
4790 else {
4791 0 my $e = '';
4792 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4793 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) ((?:$Elatin1::qq_char)*?) (\1) /cgox) { } 0 0 0
4794 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq ( )
4795 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq { }
4796 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq [ ]
4797 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq < >
4798 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq * *
4799 }
4800 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4801 }
4802 }
4803  
4804 # qx//
4805 elsif ($string =~ /\G \b (qx) \b /oxgc) {
4806 0 my $ope = $1;
4807 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qx# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Elatin1::qq_char)*?) (\#) /cgox) { } 0 0 0
4808 0 $e_string .= e_qq($ope,$1,$3,$2);
4809 }
4810 else {
4811 0 my $e = '';
4812 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4813 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 (\') ((?:$Elatin1::qq_char)*?) (\') /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Elatin1::qq_char)*?) (\1) /cgox) { } 0 0 0
4814 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx ( )
4815 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx { }
4816 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx [ ]
4817 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx < >
4818 0 elsif ($string =~ /\G (\') ((?:$qq_char)*?) (\') /oxgc) { $e_string .= $e . e_q ($ope,$1,$3,$2); next E_STRING_LOOP; } # qx ' '
4819 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx * *
4820 }
4821 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4822 }
4823 }
4824  
4825 # q//
4826 elsif ($string =~ /\G \b (q) \b /oxgc) {
4827 0 my $ope = $1;
4828 0 ▶ if ($string =~ /\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { # q# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:\\\#|\\\\|$Elatin1::q_char)*?) (\#) /cgox) { } 0 0 0
4829 0 $e_string .= e_q($ope,$1,$3,$2);
4830 }
4831 else {
4832 0 my $e = '';
4833 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4834 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| $Elatin1::q_char)*?) (\1) /cgox) { } 0 0 0
4835 0 elsif ($string =~ /\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q ( )
4836 0 elsif ($string =~ /\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q { }
4837 0 elsif ($string =~ /\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q [ ]
4838 0 elsif ($string =~ /\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q < >
4839 0 elsif ($string =~ /\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q * *
4840 }
4841 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4842 }
4843 }
4844  
4845 # ''
4846 0 elsif ($string =~ /\G (?<![\w\$\@\%\&\*]) (\') ((?:\\\'|\\\\|$q_char)*?) (\') /oxgc) { $e_string .= e_q('',$1,$3,$2); }
4847  
4848 # ""
4849 0 elsif ($string =~ /\G (\") ((?:$qq_char)*?) (\") /oxgc) { $e_string .= e_qq('',$1,$3,$2); }
4850  
4851 # ``
4852 0 elsif ($string =~ /\G (\`) ((?:$qq_char)*?) (\`) /oxgc) { $e_string .= e_qq('',$1,$3,$2); }
4853  
4854 # <<>> (a safer ARGV)
4855 0 elsif ($string =~ /\G ( <<>> ) /oxgc) { $e_string .= $1; }
4856  
4857 # <<= <=> <= < operator
4858 0 elsif ($string =~ /\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/oxgc) { $e_string .= $1; }
4859  
4860 # <FILEHANDLE>
4861 0 elsif ($string =~ /\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /oxgc) { $e_string .= $1; }
4862  
4863 # <WILDCARD> --- glob
4864 elsif ($string =~ /\G < ((?:$q_char)+?) > /oxgc) {
4865 0 $e_string .= 'Elatin1::glob("' . $1 . '")';
4866 }
4867  
4868 # << (bit shift) --- not here document
4869 elsif ($string =~ /\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /oxgc) {
4870 0 $slash = 'm//';
4871 0 $e_string .= $1;
4872 }
4873  
4874 # <<~'HEREDOC'
4875 elsif ($string =~ /\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /oxgc) {
4876 0 $slash = 'm//';
4877 0 my $here_quote = $1;
4878 0 my $delimiter = $2;
4879  
4880 # get here document
4881 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4882 0 $here_script = CORE::substr $_, pos $_;
4883 0 $here_script =~ s/.*?\n//oxm;
4884 }
4885 0 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 0 0 0
4886 0 my $heredoc = $1;
4887 0 my $indent = $2;
4888 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4889 0 push @heredoc, $heredoc . qq{\n$delimiter\n};
4890 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4891 }
4892 else {
4893 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4894 }
4895 0 $e_string .= qq{<<'$delimiter'};
4896 }
4897  
4898 # <<~\HEREDOC
4899 elsif ($string =~ /\G ( <<~ \\([a-zA-Z_0-9]+) ) /oxgc) {
4900 0 $slash = 'm//';
4901 0 my $here_quote = $1;
4902 0 my $delimiter = $2;
4903  
4904 # get here document
4905 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4906 0 $here_script = CORE::substr $_, pos $_;
4907 0 $here_script =~ s/.*?\n//oxm;
4908 }
4909 0 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 0 0 0
4910 0 my $heredoc = $1;
4911 0 my $indent = $2;
4912 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4913 0 push @heredoc, $heredoc . qq{\n$delimiter\n};
4914 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4915 }
4916 else {
4917 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4918 }
4919 0 $e_string .= qq{<<\\$delimiter};
4920 }
4921  
4922 # <<~"HEREDOC"
4923 elsif ($string =~ /\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /oxgc) {
4924 0 $slash = 'm//';
4925 0 my $here_quote = $1;
4926 0 my $delimiter = $2;
4927  
4928 # get here document
4929 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4930 0 $here_script = CORE::substr $_, pos $_;
4931 0 $here_script =~ s/.*?\n//oxm;
4932 }
4933 0 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 0 0 0
4934 0 my $heredoc = $1;
4935 0 my $indent = $2;
4936 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4937 0 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4938 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4939 }
4940 else {
4941 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4942 }
4943 0 $e_string .= qq{<<"$delimiter"};
4944 }
4945  
4946 # <<~HEREDOC
4947 elsif ($string =~ /\G ( <<~ ([a-zA-Z_0-9]+) ) /oxgc) {
4948 0 $slash = 'm//';
4949 0 my $here_quote = $1;
4950 0 my $delimiter = $2;
4951  
4952 # get here document
4953 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4954 0 $here_script = CORE::substr $_, pos $_;
4955 0 $here_script =~ s/.*?\n//oxm;
4956 }
4957 0 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 0 0 0
4958 0 my $heredoc = $1;
4959 0 my $indent = $2;
4960 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4961 0 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4962 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4963 }
4964 else {
4965 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4966 }
4967 0 $e_string .= qq{<<$delimiter};
4968 }
4969  
4970 # <<~`HEREDOC`
4971 elsif ($string =~ /\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /oxgc) {
4972 0 $slash = 'm//';
4973 0 my $here_quote = $1;
4974 0 my $delimiter = $2;
4975  
4976 # get here document
4977 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4978 0 $here_script = CORE::substr $_, pos $_;
4979 0 $here_script =~ s/.*?\n//oxm;
4980 }
4981 0 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 0 0 0
4982 0 my $heredoc = $1;
4983 0 my $indent = $2;
4984 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4985 0 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4986 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4987 }
4988 else {
4989 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4990 }
4991 0 $e_string .= qq{<<`$delimiter`};
4992 }
4993  
4994 # <<'HEREDOC'
4995 elsif ($string =~ /\G ( << '([a-zA-Z_0-9]*)' ) /oxgc) {
4996 0 $slash = 'm//';
4997 0 my $here_quote = $1;
4998 0 my $delimiter = $2;
4999  
5000 # get here document
5001 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5002 0 $here_script = CORE::substr $_, pos $_;
5003 0 $here_script =~ s/.*?\n//oxm;
5004 }
5005 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
5006 0 push @heredoc, $1 . qq{\n$delimiter\n};
5007 0 push @heredoc_delimiter, $delimiter;
5008 }
5009 else {
5010 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5011 }
5012 0 $e_string .= $here_quote;
5013 }
5014  
5015 # <<\HEREDOC
5016 elsif ($string =~ /\G ( << \\([a-zA-Z_0-9]+) ) /oxgc) {
5017 0 $slash = 'm//';
5018 0 my $here_quote = $1;
5019 0 my $delimiter = $2;
5020  
5021 # get here document
5022 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5023 0 $here_script = CORE::substr $_, pos $_;
5024 0 $here_script =~ s/.*?\n//oxm;
5025 }
5026 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
5027 0 push @heredoc, $1 . qq{\n$delimiter\n};
5028 0 push @heredoc_delimiter, $delimiter;
5029 }
5030 else {
5031 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5032 }
5033 0 $e_string .= $here_quote;
5034 }
5035  
5036 # <<"HEREDOC"
5037 elsif ($string =~ /\G ( << "([a-zA-Z_0-9]*)" ) /oxgc) {
5038 0 $slash = 'm//';
5039 0 my $here_quote = $1;
5040 0 my $delimiter = $2;
5041  
5042 # get here document
5043 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5044 0 $here_script = CORE::substr $_, pos $_;
5045 0 $here_script =~ s/.*?\n//oxm;
5046 }
5047 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
5048 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
5049 0 push @heredoc_delimiter, $delimiter;
5050 }
5051 else {
5052 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5053 }
5054 0 $e_string .= $here_quote;
5055 }
5056  
5057 # <<HEREDOC
5058 elsif ($string =~ /\G ( << ([a-zA-Z_0-9]+) ) /oxgc) {
5059 0 $slash = 'm//';
5060 0 my $here_quote = $1;
5061 0 my $delimiter = $2;
5062  
5063 # get here document
5064 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5065 0 $here_script = CORE::substr $_, pos $_;
5066 0 $here_script =~ s/.*?\n//oxm;
5067 }
5068 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
5069 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
5070 0 push @heredoc_delimiter, $delimiter;
5071 }
5072 else {
5073 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5074 }
5075 0 $e_string .= $here_quote;
5076 }
5077  
5078 # <<`HEREDOC`
5079 elsif ($string =~ /\G ( << `([a-zA-Z_0-9]*)` ) /oxgc) {
5080 0 $slash = 'm//';
5081 0 my $here_quote = $1;
5082 0 my $delimiter = $2;
5083  
5084 # get here document
5085 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5086 0 $here_script = CORE::substr $_, pos $_;
5087 0 $here_script =~ s/.*?\n//oxm;
5088 }
5089 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
5090 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
5091 0 push @heredoc_delimiter, $delimiter;
5092 }
5093 else {
5094 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5095 }
5096 0 $e_string .= $here_quote;
5097 }
5098  
5099 # any operator before div
5100 elsif ($string =~ /\G (
5101 -- | \+\+ |
5102 [\)\}\]]
5103  
5104 18 ) /oxgc) { $slash = 'div'; $e_string .= $1; }
5105  
5106 # yada-yada or triple-dot operator
5107 elsif ($string =~ /\G (
5108 \.\.\.
5109  
5110 0 ) /oxgc) { $slash = 'm//'; $e_string .= q{die('Unimplemented')}; }
5111  
5112 # any operator before m//
5113 elsif ($string =~ /\G ((?>
5114  
5115 !~~ | !~ | != | ! |
5116 %= | % |
5117 &&= | && | &= | &\.= | &\. | & |
5118 -= | -> | - |
5119 :(?>\s*)= |
5120 : |
5121 <<>> |
5122 <<= | <=> | <= | < |
5123 == | => | =~ | = |
5124 >>= | >> | >= | > |
5125 \*\*= | \*\* | \*= | \* |
5126 \+= | \+ |
5127 \.\. | \.= | \. |
5128 \/\/= | \/\/ |
5129 \/= | \/ |
5130 \? |
5131 \\ |
5132 \^= | \^\.= | \^\. | \^ |
5133 \b x= |
5134 \|\|= | \|\| | \|= | \|\.= | \|\. | \| |
5135 ~~ | ~\. | ~ |
5136 \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b |
5137 \b(?: print )\b |
5138  
5139 [,;\(\{\[]
5140  
5141 31 )) /oxgc) { $slash = 'm//'; $e_string .= $1; }
5142  
5143 # other any character
5144 131 elsif ($string =~ /\G ($q_char) /oxgc) { $e_string .= $1; }
5145  
5146 # system error
5147 else {
5148 0 die __FILE__, ": Oops, this shouldn't happen!\n";
5149 }
5150 }
5151  
5152 17 return $e_string;
5153 }
5154  
5155 #
5156 # character class
5157 #
5158 1920 ▶sub character_class {
Subroutine character_class: called CC=3 SCAR=11.0
Pod undocumented
5159 1920 my($char,$modifier) = @_;
5160  
5161 1920 ▶ if ($char eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char eq '.') { } 52 1868 1920
5162 52 ▶ if ($modifier =~ /s/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/) { } 17 35 52
5163 17 return '${Elatin1::dot_s}';
5164 }
5165 else {
5166 35 return '${Elatin1::dot}';
5167 }
5168 }
5169 else {
5170 1868 return Elatin1::classic_character_class($char);
5171 }
5172 }
5173  
5174 #
5175 # escape capture ($1, $2, $3, ...)
5176 #
5177 212 ▶sub e_capture {
Subroutine e_capture: called CC=1 SCAR=0.0
Pod undocumented
5178  
5179 212 return join '', '${', $_[0], '}';
5180 }
5181  
5182 #
5183 # escape transliteration (tr/// or y///)
5184 #
5185 4 ▶sub e_tr {
Subroutine e_tr: called CC=5 SCAR=16.8
Pod undocumented
5186 4 my($variable,$charclass,$e,$charclass2,$modifier) = @_;
5187 4 my $e_tr = '';
5188 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
5189  
5190 4 $slash = 'div';
5191  
5192 # quote character class 1
5193 4 $charclass = q_tr($charclass);
5194  
5195 # quote character class 2
5196 4 $charclass2 = q_tr($charclass2);
5197  
5198 # /b /B modifier
5199 4 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) { } 0 4 4
5200 0 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq '') { } 0 0 0
5201 0 $e_tr = qq{tr$charclass$e$charclass2$modifier};
5202 }
5203 else {
5204 0 $e_tr = qq{$variable${bind_operator}tr$charclass$e$charclass2$modifier};
5205 }
5206 }
5207 else {
5208 4 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq '') { } 2 2 4
5209 2 $e_tr = qq{Elatin1::tr(\$_,' =~ ',$charclass,$e$charclass2,'$modifier')};
5210 }
5211 else {
5212 2 $e_tr = qq{Elatin1::tr($variable,'$bind_operator',$charclass,$e$charclass2,'$modifier')};
5213 }
5214 }
5215  
5216 # clear tr/// variable
5217 4 $tr_variable = '';
5218 4 $bind_operator = '';
5219  
5220 4 return $e_tr;
5221 }
5222  
5223 #
5224 # quote for escape transliteration (tr/// or y///)
5225 #
5226 8 ▶sub q_tr {
Subroutine q_tr: called CC=9 SCAR=40.6
Pod undocumented
5227 8 my($charclass) = @_;
5228  
5229 # quote character class
5230 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
5231 8 return e_q('', "'", "'", $charclass); # --> q' '
5232 }
5233 elsif ($charclass !~ /\//oxms) {
5234 0 return e_q('q', '/', '/', $charclass); # --> q/ /
5235 }
5236 elsif ($charclass !~ /\#/oxms) {
5237 0 return e_q('q', '#', '#', $charclass); # --> q# #
5238 }
5239 elsif ($charclass !~ /[\<\>]/oxms) {
5240 0 return e_q('q', '<', '>', $charclass); # --> q< >
5241 }
5242 elsif ($charclass !~ /[\(\)]/oxms) {
5243 0 return e_q('q', '(', ')', $charclass); # --> q( )
5244 }
5245 elsif ($charclass !~ /[\{\}]/oxms) {
5246 0 return e_q('q', '{', '}', $charclass); # --> q{ }
5247 }
5248 else {
5249 0 for my $char (qw( ! " $ % & * + . : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5250 0 ▶ if ($charclass !~ /\Q$char\E/xms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($charclass =~ /\Q$char\E/msx) 0 0 0
5251 0 return e_q('q', $char, $char, $charclass);
5252 }
5253 }
5254 }
5255  
5256 0 return e_q('q', '{', '}', $charclass);
5257 }
5258  
5259 #
5260 # escape q string (q//, '')
5261 #
5262 1623 ▶sub e_q {
Subroutine e_q: called CC=1 SCAR=0.0
Pod undocumented
5263 1623 my($ope,$delimiter,$end_delimiter,$string) = @_;
5264  
5265 1623 $slash = 'div';
5266  
5267 1623 return join '', $ope, $delimiter, $string, $end_delimiter;
5268 }
5269  
5270 #
5271 # escape qq string (qq//, "", qx//, ``)
5272 #
5273 4195 ▶sub e_qq {
Subroutine e_qq: called CC=37 SCAR=50.9
Pod undocumented
5274 4195 my($ope,$delimiter,$end_delimiter,$string) = @_;
5275  
5276 4195 $slash = 'div';
5277  
5278 4195 my $left_e = 0;
5279 4195 my $right_e = 0;
5280  
5281 # split regexp
5282 4195 my @char = $string =~ /\G((?>
5283 [^\\\$] |
5284 \\x\{ (?>[0-9A-Fa-f]+) \} |
5285 \\o\{ (?>[0-7]+) \} |
5286 \\N\{ (?>[^0-9\}][^\}]*) \} |
5287 \\ $q_char |
5288 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5289 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5290 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5291 \$ (?>\s* [0-9]+) |
5292 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5293 \$ \$ (?![\w\{]) |
5294 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5295 $q_char
5296 ))/oxmsg;
5297  
5298 4195 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 116593 4195 120788
5299  
5300 # "\L\u" --> "\u\L"
5301 116593 ▶ 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 116593 116593
elsif ($char[$i] eq '\\U' and $char[$i + 1] eq '\\l') { } 0 116593 116593
elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/mosx) { } 1 116592 116593
elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/mosx) { } 1 116591 116592
elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/mosx) { } 0 116591 116591
Condition33%1/3
$char[$i] eq "\\L" and $char[$i + 1] eq "\\u"
!ll&&!rl&&r
11659300
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
5302 0 @char[$i,$i+1] = @char[$i+1,$i];
5303 }
5304  
5305 # "\U\l" --> "\l\U"
5306 ▶ 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
11659300
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
5307 0 @char[$i,$i+1] = @char[$i+1,$i];
5308 }
5309  
5310 # octal escape sequence
5311 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5312 1 $char[$i] = Elatin1::octchr($1);
5313 }
5314  
5315 # hexadecimal escape sequence
5316 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5317 1 $char[$i] = Elatin1::hexchr($1);
5318 }
5319  
5320 # \N{CHARNAME} --> N{CHARNAME}
5321 elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5322 0 $char[$i] = $1;
5323 }
5324  
5325 116593 ▶ if (0) {
Branch: 23 branches
BranchTrueFalseTotal
if (do { $char[$i] =~ /\A ([<>]) \z/mosx }) { } 484 116109 116593
elsif ($char[$i] eq '\\u') { } 0 116109 116109
elsif ($char[$i] eq '\\l') { } 0 116109 116109
elsif ($char[$i] eq '\\U') { } 0 116109 116109
elsif ($char[$i] eq '\\L') { } 0 116109 116109
elsif ($char[$i] eq '\\F') { } 24 116085 116109
elsif ($char[$i] eq '\\Q') { } 0 116085 116085
elsif ($char[$i] eq '\\E') { } 24 116061 116085
elsif ($char[$i] eq '\\Q') { } 0 116061 116061
elsif ($char[$i] eq '\\E') { } 0 116061 116061
elsif ($char[$i] =~ /\A \$ 0 \z/mosx) { } 4 116057 116061
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/mosx) { } 0 116057 116057
elsif ($char[$i] =~ /\A \$\$ \z/mosx) { } 0 116057 116057
elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/mosx) { } 205 115852 116057
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/mosx) { } 0 115852 115852
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/mosx) { } 0 115852 115852
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/mosx) { } 0 115852 115852
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/mosx) { } 0 115852 115852
elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/cgmosx) { } 44 115808 115852
elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/cgmosx) { } 45 115763 115808
elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/cgmosx) { } 33 115730 115763
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/mosx) { } 0 115730 115730
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/mosx) { } 0 115730 115730
5326 }
5327  
5328 # \F
5329 #
5330 # P.69 Table 2-6. Translation escapes
5331 # in Chapter 2: Bits and Pieces
5332 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
5333 # (and so on)
5334  
5335 # \u \l \U \L \F \Q \E
5336 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
5337 484 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 484 484
5338 0 $char[$i] = '\\' . $char[$i];
5339 }
5340 }
5341 elsif ($char[$i] eq '\u') {
5342  
5343 # "STRING @{[ LIST EXPR ]} MORE STRING"
5344  
5345 # P.257 Other Tricks You Can Do with Hard References
5346 # in Chapter 8: References
5347 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
5348  
5349 # P.353 Other Tricks You Can Do with Hard References
5350 # in Chapter 8: References
5351 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
5352  
5353 # (and so on)
5354  
5355 0 $char[$i] = '@{[Elatin1::ucfirst qq<';
5356 0 $left_e++;
5357 }
5358 elsif ($char[$i] eq '\l') {
5359 0 $char[$i] = '@{[Elatin1::lcfirst qq<';
5360 0 $left_e++;
5361 }
5362 elsif ($char[$i] eq '\U') {
5363 0 $char[$i] = '@{[Elatin1::uc qq<';
5364 0 $left_e++;
5365 }
5366 elsif ($char[$i] eq '\L') {
5367 0 $char[$i] = '@{[Elatin1::lc qq<';
5368 0 $left_e++;
5369 }
5370 elsif ($char[$i] eq '\F') {
5371 24 $char[$i] = '@{[Elatin1::fc qq<';
5372 24 $left_e++;
5373 }
5374 elsif ($char[$i] eq '\Q') {
5375 0 $char[$i] = '@{[CORE::quotemeta qq<';
5376 0 $left_e++;
5377 }
5378 elsif ($char[$i] eq '\E') {
5379 24 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 24 0 24
5380 24 $char[$i] = '>]}';
5381 24 $right_e++;
5382 }
5383 else {
5384 0 $char[$i] = '';
5385 }
5386 }
5387 elsif ($char[$i] eq '\Q') {
5388 0 while (1) {
5389 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5390 0 last;
5391 }
5392 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
5393 0 last;
5394 }
5395 }
5396 }
5397 elsif ($char[$i] eq '\E') {
5398 }
5399  
5400 # $0 --> $0
5401 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
5402 }
5403 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
5404 }
5405  
5406 # $$ --> $$
5407 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
5408 }
5409  
5410 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
5411 # $1, $2, $3 --> $1, $2, $3 otherwise
5412 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
5413 205 $char[$i] = e_capture($1);
5414 }
5415 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
5416 0 $char[$i] = e_capture($1);
5417 }
5418  
5419 # $$foo[ ... ] --> $ $foo->[ ... ]
5420 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
5421 0 $char[$i] = e_capture($1.'->'.$2);
5422 }
5423  
5424 # $$foo{ ... } --> $ $foo->{ ... }
5425 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
5426 0 $char[$i] = e_capture($1.'->'.$2);
5427 }
5428  
5429 # $$foo
5430 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
5431 0 $char[$i] = e_capture($1);
5432 }
5433  
5434 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin1::PREMATCH()
5435 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
5436 44 $char[$i] = '@{[Elatin1::PREMATCH()]}';
5437 }
5438  
5439 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin1::MATCH()
5440 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
5441 45 $char[$i] = '@{[Elatin1::MATCH()]}';
5442 }
5443  
5444 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin1::POSTMATCH()
5445 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
5446 33 $char[$i] = '@{[Elatin1::POSTMATCH()]}';
5447 }
5448  
5449 # ${ foo } --> ${ foo }
5450 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/oxms) {
5451 }
5452  
5453 # ${ ... }
5454 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5455 0 $char[$i] = e_capture($1);
5456 }
5457 }
5458  
5459 # return string
5460 4195 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 4195 4195
5461 0 return join '', $ope, $delimiter, @char, '>]}' x ($left_e - $right_e), $end_delimiter;
5462 }
5463 4195 return join '', $ope, $delimiter, @char, $end_delimiter;
5464 }
5465  
5466 #
5467 # escape qw string (qw//)
5468 #
5469 16 ▶sub e_qw {
Subroutine e_qw: called CC=11 SCAR=43.1
Pod undocumented
5470 16 my($ope,$delimiter,$end_delimiter,$string) = @_;
5471  
5472 16 $slash = 'div';
5473  
5474 # choice again delimiter
5475 16 my %octet = map {$_ => 1} ($string =~ /\G ([\x00-\xFF]) /oxmsg);
5476 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
5477 16 return join '', $ope, $delimiter, $string, $end_delimiter;
5478 }
5479 elsif (not $octet{')'}) {
5480 0 return join '', $ope, '(', $string, ')';
5481 }
5482 elsif (not $octet{'}'}) {
5483 0 return join '', $ope, '{', $string, '}';
5484 }
5485 elsif (not $octet{']'}) {
5486 0 return join '', $ope, '[', $string, ']';
5487 }
5488 elsif (not $octet{'>'}) {
5489 0 return join '', $ope, '<', $string, '>';
5490 }
5491 else {
5492 0 for my $char (qw( ! " $ % & * + - . / : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5493 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5494 0 return join '', $ope, $char, $string, $char;
5495 }
5496 }
5497 }
5498  
5499 # qw/AAA BBB C'CC/ --> ('AAA', 'BBB', 'C\'CC')
5500 0 my @string = CORE::split(/\s+/, $string);
5501 0 for my $string (@string) {
5502 0 my @octet = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5503 0 for my $octet (@octet) {
5504 0 ▶ if ($octet =~ /\A (['\\]) \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($octet =~ /\A (['\\]) \z/mosx) 0 0 0
5505 0 $octet = '\\' . $1;
5506 }
5507 }
5508 0 $string = join '', @octet;
5509 }
5510 0 return join '', '(', (join ', ', map { "'$_'" } @string), ')';
5511 }
5512  
5513 #
5514 # escape here document (<<"HEREDOC", <<HEREDOC, <<`HEREDOC`, <<~"HEREDOC", <<~HEREDOC, <<~`HEREDOC`)
5515 #
5516 93 ▶sub e_heredoc {
Subroutine e_heredoc: called CC=37 SCAR=56.3
Pod undocumented
5517 93 my($string) = @_;
5518  
5519 93 $slash = 'm//';
5520  
5521 93 my $metachar = qr/[\@\\|]/oxms; # '|' is for <<`HEREDOC`
5522  
5523 93 my $left_e = 0;
5524 93 my $right_e = 0;
5525  
5526 # split regexp
5527 93 my @char = $string =~ /\G((?>
5528 [^\\\$] |
5529 \\x\{ (?>[0-9A-Fa-f]+) \} |
5530 \\o\{ (?>[0-7]+) \} |
5531 \\N\{ (?>[^0-9\}][^\}]*) \} |
5532 \\ $q_char |
5533 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5534 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5535 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5536 \$ (?>\s* [0-9]+) |
5537 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5538 \$ \$ (?![\w\{]) |
5539 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5540 $q_char
5541 ))/oxmsg;
5542  
5543 93 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 3177 93 3270
5544  
5545 # "\L\u" --> "\u\L"
5546 3177 ▶ 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 3177 3177
elsif ($char[$i] eq '\\U' and $char[$i + 1] eq '\\l') { } 0 3177 3177
elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/mosx) { } 1 3176 3177
elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/mosx) { } 1 3175 3176
elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/mosx) { } 0 3175 3175
Condition33%1/3
$char[$i] eq "\\L" and $char[$i + 1] eq "\\u"
!ll&&!rl&&r
317700
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
5547 0 @char[$i,$i+1] = @char[$i+1,$i];
5548 }
5549  
5550 # "\U\l" --> "\l\U"
5551 ▶ 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
317700
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
5552 0 @char[$i,$i+1] = @char[$i+1,$i];
5553 }
5554  
5555 # octal escape sequence
5556 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5557 1 $char[$i] = Elatin1::octchr($1);
5558 }
5559  
5560 # hexadecimal escape sequence
5561 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5562 1 $char[$i] = Elatin1::hexchr($1);
5563 }
5564  
5565 # \N{CHARNAME} --> N{CHARNAME}
5566 elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5567 0 $char[$i] = $1;
5568 }
5569  
5570 3177 ▶ if (0) {
Branch: 23 branches
BranchTrueFalseTotal
if (do { $char[$i] =~ /\A ([<>]) \z/mosx }) { } 0 3177 3177
elsif ($char[$i] eq '\\u') { } 0 3177 3177
elsif ($char[$i] eq '\\l') { } 0 3177 3177
elsif ($char[$i] eq '\\U') { } 0 3177 3177
elsif ($char[$i] eq '\\L') { } 0 3177 3177
elsif ($char[$i] eq '\\F') { } 0 3177 3177
elsif ($char[$i] eq '\\Q') { } 0 3177 3177
elsif ($char[$i] eq '\\E') { } 0 3177 3177
elsif ($char[$i] eq '\\Q') { } 0 3177 3177
elsif ($char[$i] eq '\\E') { } 0 3177 3177
elsif ($char[$i] =~ /\A \$ 0 \z/mosx) { } 0 3177 3177
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/mosx) { } 0 3177 3177
elsif ($char[$i] =~ /\A \$\$ \z/mosx) { } 0 3177 3177
elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/mosx) { } 0 3177 3177
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/mosx) { } 0 3177 3177
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/mosx) { } 0 3177 3177
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/mosx) { } 0 3177 3177
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/mosx) { } 0 3177 3177
elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/cgmosx) { } 8 3169 3177
elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/cgmosx) { } 8 3161 3169
elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/cgmosx) { } 6 3155 3161
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/mosx) { } 0 3155 3155
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/mosx) { } 0 3155 3155
5571 }
5572  
5573 # \u \l \U \L \F \Q \E
5574 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
5575 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
5576 0 $char[$i] = '\\' . $char[$i];
5577 }
5578 }
5579 elsif ($char[$i] eq '\u') {
5580 0 $char[$i] = '@{[Elatin1::ucfirst qq<';
5581 0 $left_e++;
5582 }
5583 elsif ($char[$i] eq '\l') {
5584 0 $char[$i] = '@{[Elatin1::lcfirst qq<';
5585 0 $left_e++;
5586 }
5587 elsif ($char[$i] eq '\U') {
5588 0 $char[$i] = '@{[Elatin1::uc qq<';
5589 0 $left_e++;
5590 }
5591 elsif ($char[$i] eq '\L') {
5592 0 $char[$i] = '@{[Elatin1::lc qq<';
5593 0 $left_e++;
5594 }
5595 elsif ($char[$i] eq '\F') {
5596 0 $char[$i] = '@{[Elatin1::fc qq<';
5597 0 $left_e++;
5598 }
5599 elsif ($char[$i] eq '\Q') {
5600 0 $char[$i] = '@{[CORE::quotemeta qq<';
5601 0 $left_e++;
5602 }
5603 elsif ($char[$i] eq '\E') {
5604 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
5605 0 $char[$i] = '>]}';
5606 0 $right_e++;
5607 }
5608 else {
5609 0 $char[$i] = '';
5610 }
5611 }
5612 elsif ($char[$i] eq '\Q') {
5613 0 while (1) {
5614 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5615 0 last;
5616 }
5617 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
5618 0 last;
5619 }
5620 }
5621 }
5622 elsif ($char[$i] eq '\E') {
5623 }
5624  
5625 # $0 --> $0
5626 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
5627 }
5628 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
5629 }
5630  
5631 # $$ --> $$
5632 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
5633 }
5634  
5635 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
5636 # $1, $2, $3 --> $1, $2, $3 otherwise
5637 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
5638 0 $char[$i] = e_capture($1);
5639 }
5640 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
5641 0 $char[$i] = e_capture($1);
5642 }
5643  
5644 # $$foo[ ... ] --> $ $foo->[ ... ]
5645 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
5646 0 $char[$i] = e_capture($1.'->'.$2);
5647 }
5648  
5649 # $$foo{ ... } --> $ $foo->{ ... }
5650 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
5651 0 $char[$i] = e_capture($1.'->'.$2);
5652 }
5653  
5654 # $$foo
5655 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
5656 0 $char[$i] = e_capture($1);
5657 }
5658  
5659 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin1::PREMATCH()
5660 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
5661 8 $char[$i] = '@{[Elatin1::PREMATCH()]}';
5662 }
5663  
5664 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin1::MATCH()
5665 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
5666 8 $char[$i] = '@{[Elatin1::MATCH()]}';
5667 }
5668  
5669 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin1::POSTMATCH()
5670 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
5671 6 $char[$i] = '@{[Elatin1::POSTMATCH()]}';
5672 }
5673  
5674 # ${ foo } --> ${ foo }
5675 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/oxms) {
5676 }
5677  
5678 # ${ ... }
5679 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5680 0 $char[$i] = e_capture($1);
5681 }
5682 }
5683  
5684 # return string
5685 93 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 93 93
5686 0 return join '', @char, '>]}' x ($left_e - $right_e);
5687 }
5688 93 return join '', @char;
5689 }
5690  
5691 #
5692 # escape regexp (m//, qr//)
5693 #
5694 880 ▶sub e_qr {
Subroutine e_qr: called CC=110 SCAR=73.6
Pod undocumented
5695 880 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5696 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
5697  
5698 880 $modifier =~ tr/p//d;
5699 880 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 880 880
5700 0 my $line = 0;
5701 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
5702 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
5703 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
5704 0 last;
5705 }
5706 }
5707 0 die qq{Unsupported modifier "$1" used at line $line.\n};
5708 }
5709  
5710 880 $slash = 'div';
5711  
5712 # literal null string pattern
5713 880 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 872 880
elsif ($modifier =~ tr/Bb//d) { } 2 870 872
5714 8 $modifier =~ tr/bB//d;
5715 8 $modifier =~ tr/i//d;
5716 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
5717 }
5718  
5719 # /b /B modifier
5720 elsif ($modifier =~ tr/bB//d) {
5721  
5722 # choice again delimiter
5723 2 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 2 2
5724 0 my @char = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5725 0 my %octet = map {$_ => 1} @char;
5726 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
5727 0 $delimiter = '(';
5728 0 $end_delimiter = ')';
5729 }
5730 elsif (not $octet{'}'}) {
5731 0 $delimiter = '{';
5732 0 $end_delimiter = '}';
5733 }
5734 elsif (not $octet{']'}) {
5735 0 $delimiter = '[';
5736 0 $end_delimiter = ']';
5737 }
5738 elsif (not $octet{'>'}) {
5739 0 $delimiter = '<';
5740 0 $end_delimiter = '>';
5741 }
5742 else {
5743 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5744 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5745 0 $delimiter = $char;
5746 0 $end_delimiter = $char;
5747 0 last;
5748 }
5749 }
5750 }
5751 }
5752  
5753 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
5754 0 return join '', $ope, $delimiter, $string, $matched, $end_delimiter, $modifier;
5755 }
5756 else {
5757 2 return join '', $ope, $delimiter, '(?:', $string, ')', $matched, $end_delimiter, $modifier;
5758 }
5759 }
5760  
5761 870 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 312 558 870
5762 870 my $metachar = qr/[\@\\|[\]{^]/oxms;
5763  
5764 # split regexp
5765 870 my @char = $string =~ /\G((?>
5766 [^\\\$\@\[\(] |
5767 \\x (?>[0-9A-Fa-f]{1,2}) |
5768 \\ (?>[0-7]{2,3}) |
5769 \\c [\x40-\x5F] |
5770 \\x\{ (?>[0-9A-Fa-f]+) \} |
5771 \\o\{ (?>[0-7]+) \} |
5772 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
5773 \\ $q_char |
5774 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5775 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5776 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5777 [\$\@] $qq_variable |
5778 \$ (?>\s* [0-9]+) |
5779 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5780 \$ \$ (?![\w\{]) |
5781 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5782 \[\^ |
5783 \[\: (?>[a-z]+) :\] |
5784 \[\:\^ (?>[a-z]+) :\] |
5785 \(\? |
5786 $q_char
5787 ))/oxmsg;
5788  
5789 # choice again delimiter
5790 870 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 870 870
5791 0 my %octet = map {$_ => 1} @char;
5792 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
5793 0 $delimiter = '(';
5794 0 $end_delimiter = ')';
5795 }
5796 elsif (not $octet{'}'}) {
5797 0 $delimiter = '{';
5798 0 $end_delimiter = '}';
5799 }
5800 elsif (not $octet{']'}) {
5801 0 $delimiter = '[';
5802 0 $end_delimiter = ']';
5803 }
5804 elsif (not $octet{'>'}) {
5805 0 $delimiter = '<';
5806 0 $end_delimiter = '>';
5807 }
5808 else {
5809 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5810 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5811 0 $delimiter = $char;
5812 0 $end_delimiter = $char;
5813 0 last;
5814 }
5815 }
5816 }
5817 }
5818  
5819 870 my $left_e = 0;
5820 870 my $right_e = 0;
5821 870 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 2100 870 2970
5822  
5823 # "\L\u" --> "\u\L"
5824 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
5825 0 @char[$i,$i+1] = @char[$i+1,$i];
5826 }
5827  
5828 # "\U\l" --> "\l\U"
5829 ▶ 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
5830 0 @char[$i,$i+1] = @char[$i+1,$i];
5831 }
5832  
5833 # octal escape sequence
5834 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5835 1 $char[$i] = Elatin1::octchr($1);
5836 }
5837  
5838 # hexadecimal escape sequence
5839 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5840 1 $char[$i] = Elatin1::hexchr($1);
5841 }
5842  
5843 # \b{...} --> b\{...}
5844 # \B{...} --> B\{...}
5845 # \N{CHARNAME} --> N\{CHARNAME}
5846 # \p{PROPERTY} --> p\{PROPERTY}
5847 # \P{PROPERTY} --> P\{PROPERTY}
5848 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5849 6 $char[$i] = $1 . '\\' . $2;
5850 }
5851  
5852 # \p, \P, \X --> p, P, X
5853 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
5854 4 $char[$i] = $1;
5855 }
5856  
5857 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 &Elatin1::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
5858 }
5859  
5860 # join separated multiple-octet
5861 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
5862 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 $Elatin1::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 $Elatin1::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 $Elatin1::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 $Elatin1::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 $Elatin1::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 $Elatin1::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 $Elatin1::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5863 0 $char[$i] .= join '', splice @char, $i+1, 3;
5864 }
5865 ▶ 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 $Elatin1::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 $Elatin1::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 $Elatin1::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 $Elatin1::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5866 0 $char[$i] .= join '', splice @char, $i+1, 2;
5867 }
5868 ▶ 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 $Elatin1::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 $Elatin1::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 $Elatin1::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 $Elatin1::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5869 0 $char[$i] .= join '', splice @char, $i+1, 1;
5870 }
5871 }
5872  
5873 # open character class [...]
5874 elsif ($char[$i] eq '[') {
5875 556 my $left = $i;
5876  
5877 # [] make die "Unmatched [] in regexp ...\n"
5878 # (and so on)
5879  
5880 556 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 3 553 556
5881 3 $i++;
5882 }
5883  
5884 556 while (1) {
5885 2063 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 2063 2063
5886 0 die __FILE__, ": Unmatched [] in regexp\n";
5887 }
5888 2063 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 556 1507 2063
5889 556 my $right = $i;
5890  
5891 # [...]
5892 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
5893 30 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin1::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
5894 }
5895 else {
5896 526 splice @char, $left, $right-$left+1, Elatin1::charlist_qr(@char[$left+1..$right-1], $modifier);
5897 }
5898  
5899 556 $i = $left;
5900 556 last;
5901 }
5902 }
5903 }
5904  
5905 # open character class [^...]
5906 elsif ($char[$i] eq '[^') {
5907 74 my $left = $i;
5908  
5909 # [^] make die "Unmatched [] in regexp ...\n"
5910 # (and so on)
5911  
5912 74 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 4 70 74
5913 4 $i++;
5914 }
5915  
5916 74 while (1) {
5917 272 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 272 272
5918 0 die __FILE__, ": Unmatched [] in regexp\n";
5919 }
5920 272 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 74 198 272
5921 74 my $right = $i;
5922  
5923 # [^...]
5924 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
5925 30 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin1::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
5926 }
5927 else {
5928 44 splice @char, $left, $right-$left+1, Elatin1::charlist_not_qr(@char[$left+1..$right-1], $modifier);
5929 }
5930  
5931 74 $i = $left;
5932 74 last;
5933 }
5934 }
5935 }
5936  
5937 # rewrite character class or escape character
5938 elsif (my $char = character_class($char[$i],$modifier)) {
5939 139 $char[$i] = $char;
5940 }
5941  
5942 # /i modifier
5943 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin1::uc($char[$i]) ne Elatin1::fc($char[$i]))) {
Condition100%6/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin1::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 &Elatin1::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin1::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= &Elatin1::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
5944 20 ▶ if (CORE::length(Elatin1::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 20 0 20
5945 20 $char[$i] = '[' . Elatin1::uc($char[$i]) . Elatin1::fc($char[$i]) . ']';
5946 }
5947 else {
5948 0 $char[$i] = '(?:' . Elatin1::uc($char[$i]) . '|' . Elatin1::fc($char[$i]) . ')';
5949 }
5950 }
5951  
5952 # \u \l \U \L \F \Q \E
5953 elsif ($char[$i] =~ /\A [<>] \z/oxms) {
5954 1 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 1 1
5955 0 $char[$i] = '\\' . $char[$i];
5956 }
5957 }
5958 elsif ($char[$i] eq '\u') {
5959 0 $char[$i] = '@{[Elatin1::ucfirst qq<';
5960 0 $left_e++;
5961 }
5962 elsif ($char[$i] eq '\l') {
5963 0 $char[$i] = '@{[Elatin1::lcfirst qq<';
5964 0 $left_e++;
5965 }
5966 elsif ($char[$i] eq '\U') {
5967 1 $char[$i] = '@{[Elatin1::uc qq<';
5968 1 $left_e++;
5969 }
5970 elsif ($char[$i] eq '\L') {
5971 1 $char[$i] = '@{[Elatin1::lc qq<';
5972 1 $left_e++;
5973 }
5974 elsif ($char[$i] eq '\F') {
5975 18 $char[$i] = '@{[Elatin1::fc qq<';
5976 18 $left_e++;
5977 }
5978 elsif ($char[$i] eq '\Q') {
5979 1 $char[$i] = '@{[CORE::quotemeta qq<';
5980 1 $left_e++;
5981 }
5982 elsif ($char[$i] eq '\E') {
5983 21 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 21 0 21
5984 21 $char[$i] = '>]}';
5985 21 $right_e++;
5986 }
5987 else {
5988 0 $char[$i] = '';
5989 }
5990 }
5991 elsif ($char[$i] eq '\Q') {
5992 0 while (1) {
5993 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5994 0 last;
5995 }
5996 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
5997 0 last;
5998 }
5999 }
6000 }
6001 elsif ($char[$i] eq '\E') {
6002 }
6003  
6004 # $0 --> $0
6005 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
6006 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6007 0 $char[$i] = '@{[Elatin1::ignorecase(' . $char[$i] . ')]}';
6008 }
6009 }
6010 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
6011 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6012 0 $char[$i] = '@{[Elatin1::ignorecase(' . $char[$i] . ')]}';
6013 }
6014 }
6015  
6016 # $$ --> $$
6017 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
6018 }
6019  
6020 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
6021 # $1, $2, $3 --> $1, $2, $3 otherwise
6022 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
6023 0 $char[$i] = e_capture($1);
6024 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6025 0 $char[$i] = '@{[Elatin1::ignorecase(' . $char[$i] . ')]}';
6026 }
6027 }
6028 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6029 0 $char[$i] = e_capture($1);
6030 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6031 0 $char[$i] = '@{[Elatin1::ignorecase(' . $char[$i] . ')]}';
6032 }
6033 }
6034  
6035 # $$foo[ ... ] --> $ $foo->[ ... ]
6036 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
6037 0 $char[$i] = e_capture($1.'->'.$2);
6038 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6039 0 $char[$i] = '@{[Elatin1::ignorecase(' . $char[$i] . ')]}';
6040 }
6041 }
6042  
6043 # $$foo{ ... } --> $ $foo->{ ... }
6044 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
6045 0 $char[$i] = e_capture($1.'->'.$2);
6046 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6047 0 $char[$i] = '@{[Elatin1::ignorecase(' . $char[$i] . ')]}';
6048 }
6049 }
6050  
6051 # $$foo
6052 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
6053 0 $char[$i] = e_capture($1);
6054 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6055 0 $char[$i] = '@{[Elatin1::ignorecase(' . $char[$i] . ')]}';
6056 }
6057 }
6058  
6059 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin1::PREMATCH()
6060 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
6061 8 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 8 8
6062 0 $char[$i] = '@{[Elatin1::ignorecase(Elatin1::PREMATCH())]}';
6063 }
6064 else {
6065 8 $char[$i] = '@{[Elatin1::PREMATCH()]}';
6066 }
6067 }
6068  
6069 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin1::MATCH()
6070 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
6071 8 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 8 8
6072 0 $char[$i] = '@{[Elatin1::ignorecase(Elatin1::MATCH())]}';
6073 }
6074 else {
6075 8 $char[$i] = '@{[Elatin1::MATCH()]}';
6076 }
6077 }
6078  
6079 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin1::POSTMATCH()
6080 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
6081 6 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 6 6
6082 0 $char[$i] = '@{[Elatin1::ignorecase(Elatin1::POSTMATCH())]}';
6083 }
6084 else {
6085 6 $char[$i] = '@{[Elatin1::POSTMATCH()]}';
6086 }
6087 }
6088  
6089 # ${ foo }
6090 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
6091 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6092 0 $char[$i] = '@{[Elatin1::ignorecase(' . $char[$i] . ')]}';
6093 }
6094 }
6095  
6096 # ${ ... }
6097 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
6098 0 $char[$i] = e_capture($1);
6099 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6100 0 $char[$i] = '@{[Elatin1::ignorecase(' . $char[$i] . ')]}';
6101 }
6102 }
6103  
6104 # $scalar or @array
6105 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
6106 21 $char[$i] = e_string($char[$i]);
6107 21 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 11 10 21
6108 11 $char[$i] = '@{[Elatin1::ignorecase(' . $char[$i] . ')]}';
6109 }
6110 }
6111  
6112 # quote character before ? + * {
6113 ▶ 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
6114 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
6115 }
6116 ▶ 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
6117 0 my $char = $char[$i-1];
6118 0 ▶ if ($char[$i] eq '{') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq '{') { } 0 0 0
6119 0 die __FILE__, qq{: "MULTIBYTE{n}" should be "(MULTIBYTE){n}" in m?? (and shift \$1,\$2,\$3,...) ($char){n}\n};
6120 }
6121 else {
6122 0 die __FILE__, qq{: "MULTIBYTE$char[$i]" should be "(MULTIBYTE)$char[$i]" in m?? (and shift \$1,\$2,\$3,...) ($char)$char[$i]\n};
6123 }
6124 }
6125 else {
6126 127 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6127 }
6128 }
6129 }
6130  
6131 # make regexp string
6132 870 $modifier =~ tr/i//d;
6133 870 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 870 870
6134 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
6135 0 return join '', $ope, $delimiter, $anchor, @char, '>]}' x ($left_e - $right_e), $matched, $end_delimiter, $modifier;
6136 }
6137 else {
6138 0 return join '', $ope, $delimiter, $anchor, '(?:', @char, '>]}' x ($left_e - $right_e), ')', $matched, $end_delimiter, $modifier;
6139 }
6140 }
6141 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
6142 0 return join '', $ope, $delimiter, $anchor, @char, $matched, $end_delimiter, $modifier;
6143 }
6144 else {
6145 870 return join '', $ope, $delimiter, $anchor, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6146 }
6147 }
6148  
6149 #
6150 # double quote stuff
6151 #
6152 180 ▶sub qq_stuff {
Subroutine qq_stuff: called CC=6 SCAR=18.5
Pod undocumented
6153 180 my($delimiter,$end_delimiter,$stuff) = @_;
6154  
6155 # scalar variable or array variable
6156 180 ▶ if ($stuff =~ /\A [\$\@] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($stuff =~ /\A [\$\@] /mosx) 100 80 180
6157 100 return $stuff;
6158 }
6159  
6160 # quote by delimiter
6161 80 my %octet = map {$_ => 1} ($stuff =~ /\G ([\x00-\xFF]) /oxmsg);
6162 80 for my $char (qw( ! " $ % & * + - . / : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
6163 80 ▶ next if $char eq $delimiter;
Branch: 1 branch
BranchTrueFalseTotal
if $char eq $delimiter 0 80 80
6164 80 ▶ next if $char eq $end_delimiter;
Branch: 1 branch
BranchTrueFalseTotal
if $char eq $end_delimiter 0 80 80
6165 80 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 80 0 80
6166 80 return join '', 'qq', $char, $stuff, $char;
6167 }
6168 }
6169 0 return join '', 'qq', '<', $stuff, '>';
6170 }
6171  
6172 #
6173 # escape regexp (m'', qr'', and m''b, qr''b)
6174 #
6175 10 ▶sub e_qr_q {
Subroutine e_qr_q: called CC=7 SCAR=25.3
Pod undocumented
6176 10 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6177 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
6178  
6179 10 $modifier =~ tr/p//d;
6180 10 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 10 10
6181 0 my $line = 0;
6182 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6183 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6184 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6185 0 last;
6186 }
6187 }
6188 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6189 }
6190  
6191 10 $slash = 'div';
6192  
6193 # literal null string pattern
6194 10 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 2 10
elsif ($modifier =~ tr/Bb//d) { } 0 2 2
6195 8 $modifier =~ tr/bB//d;
6196 8 $modifier =~ tr/i//d;
6197 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
6198 }
6199  
6200 # with /b /B modifier
6201 elsif ($modifier =~ tr/bB//d) {
6202 0 return e_qr_qb($ope,$delimiter,$end_delimiter,$string,$modifier);
6203 }
6204  
6205 # without /b /B modifier
6206 else {
6207 2 return e_qr_qt($ope,$delimiter,$end_delimiter,$string,$modifier);
6208 }
6209 }
6210  
6211 #
6212 # escape regexp (m'', qr'')
6213 #
6214 2 ▶sub e_qr_qt {
Subroutine e_qr_qt: called CC=20 SCAR=51.8
Pod undocumented
6215 2 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6216  
6217 2 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 2 2
6218  
6219 # split regexp
6220 2 my @char = $string =~ /\G((?>
6221 [^\\\[\$\@\/] |
6222 [\x00-\xFF] |
6223 \[\^ |
6224 \[\: (?>[a-z]+) \:\] |
6225 \[\:\^ (?>[a-z]+) \:\] |
6226 [\$\@\/] |
6227 \\ (?:$q_char) |
6228 (?:$q_char)
6229 ))/oxmsg;
6230  
6231 # unescape character
6232 2 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 2 2 4
6233 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 &Elatin1::uc($char[$i]) ne &fc($char[$i])) { } 0 2 2
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 4 4
6234 }
6235  
6236 # open character class [...]
6237 elsif ($char[$i] eq '[') {
6238 0 my $left = $i;
6239 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6240 0 $i++;
6241 }
6242 0 while (1) {
6243 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6244 0 die __FILE__, ": Unmatched [] in regexp\n";
6245 }
6246 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6247 0 my $right = $i;
6248  
6249 # [...]
6250 0 splice @char, $left, $right-$left+1, Elatin1::charlist_qr(@char[$left+1..$right-1], $modifier);
6251  
6252 0 $i = $left;
6253 0 last;
6254 }
6255 }
6256 }
6257  
6258 # open character class [^...]
6259 elsif ($char[$i] eq '[^') {
6260 0 my $left = $i;
6261 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6262 0 $i++;
6263 }
6264 0 while (1) {
6265 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6266 0 die __FILE__, ": Unmatched [] in regexp\n";
6267 }
6268 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6269 0 my $right = $i;
6270  
6271 # [^...]
6272 0 splice @char, $left, $right-$left+1, Elatin1::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6273  
6274 0 $i = $left;
6275 0 last;
6276 }
6277 }
6278 }
6279  
6280 # escape $ @ / and \
6281 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6282 0 $char[$i] = '\\' . $char[$i];
6283 }
6284  
6285 # rewrite character class or escape character
6286 elsif (my $char = character_class($char[$i],$modifier)) {
6287 0 $char[$i] = $char;
6288 }
6289  
6290 # /i modifier
6291 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin1::uc($char[$i]) ne Elatin1::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin1::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 &Elatin1::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin1::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= &Elatin1::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6292 0 ▶ if (CORE::length(Elatin1::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
6293 0 $char[$i] = '[' . Elatin1::uc($char[$i]) . Elatin1::fc($char[$i]) . ']';
6294 }
6295 else {
6296 0 $char[$i] = '(?:' . Elatin1::uc($char[$i]) . '|' . Elatin1::fc($char[$i]) . ')';
6297 }
6298 }
6299  
6300 # quote character before ? + * {
6301 ▶ 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
6302 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
6303 }
6304 else {
6305 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6306 }
6307 }
6308 }
6309  
6310 2 $delimiter = '/';
6311 2 $end_delimiter = '/';
6312  
6313 2 $modifier =~ tr/i//d;
6314 2 return join '', $ope, $delimiter, $anchor, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6315 }
6316  
6317 #
6318 # escape regexp (m''b, qr''b)
6319 #
6320 0 ▶sub e_qr_qb {
Subroutine e_qr_qb: not called CC=4 SCAR=30.0
Pod undocumented
6321 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6322  
6323 # split regexp
6324 0 my @char = $string =~ /\G ((?>[^\\]|\\\\)) /oxmsg;
6325  
6326 # unescape character
6327 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
6328 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
6329 }
6330  
6331 # remain \\
6332 elsif ($char[$i] eq '\\\\') {
6333 }
6334  
6335 # escape $ @ / and \
6336 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6337 0 $char[$i] = '\\' . $char[$i];
6338 }
6339 }
6340  
6341 0 $delimiter = '/';
6342 0 $end_delimiter = '/';
6343 0 return join '', $ope, $delimiter, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6344 }
6345  
6346 #
6347 # escape regexp (s/here//)
6348 #
6349 80 ▶sub e_s1 {
Subroutine e_s1: called CC=106 SCAR=81.1
Pod undocumented
6350 80 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6351 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
6352  
6353 80 $modifier =~ tr/p//d;
6354 80 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 80 80
6355 0 my $line = 0;
6356 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6357 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6358 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6359 0 last;
6360 }
6361 }
6362 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6363 }
6364  
6365 80 $slash = 'div';
6366  
6367 # literal null string pattern
6368 80 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 72 80
elsif ($modifier =~ tr/Bb//d) { } 0 72 72
6369 8 $modifier =~ tr/bB//d;
6370 8 $modifier =~ tr/i//d;
6371 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
6372 }
6373  
6374 # /b /B modifier
6375 elsif ($modifier =~ tr/bB//d) {
6376  
6377 # choice again delimiter
6378 0 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 0 0
6379 0 my @char = $string =~ /\G ([\x00-\xFF]) /oxmsg;
6380 0 my %octet = map {$_ => 1} @char;
6381 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
6382 0 $delimiter = '(';
6383 0 $end_delimiter = ')';
6384 }
6385 elsif (not $octet{'}'}) {
6386 0 $delimiter = '{';
6387 0 $end_delimiter = '}';
6388 }
6389 elsif (not $octet{']'}) {
6390 0 $delimiter = '[';
6391 0 $end_delimiter = ']';
6392 }
6393 elsif (not $octet{'>'}) {
6394 0 $delimiter = '<';
6395 0 $end_delimiter = '>';
6396 }
6397 else {
6398 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
6399 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
6400 0 $delimiter = $char;
6401 0 $end_delimiter = $char;
6402 0 last;
6403 }
6404 }
6405 }
6406 }
6407  
6408 0 my $prematch = '';
6409 0 return join '', $ope, $delimiter, $prematch, '(?:', $string, ')', $matched, $end_delimiter, $modifier;
6410 }
6411  
6412 72 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 1 71 72
6413 72 my $metachar = qr/[\@\\|[\]{^]/oxms;
6414  
6415 # split regexp
6416 72 my @char = $string =~ /\G((?>
6417 [^\\\$\@\[\(] |
6418 \\ (?>[1-9][0-9]*) |
6419 \\g (?>\s*) (?>[1-9][0-9]*) |
6420 \\g (?>\s*) \{ (?>\s*) (?>[1-9][0-9]*) (?>\s*) \} |
6421 \\g (?>\s*) \{ (?>\s*) - (?>\s*) (?>[1-9][0-9]*) (?>\s*) \} |
6422 \\x (?>[0-9A-Fa-f]{1,2}) |
6423 \\ (?>[0-7]{2,3}) |
6424 \\c [\x40-\x5F] |
6425 \\x\{ (?>[0-9A-Fa-f]+) \} |
6426 \\o\{ (?>[0-7]+) \} |
6427 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
6428 \\ $q_char |
6429 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
6430 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
6431 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
6432 [\$\@] $qq_variable |
6433 \$ (?>\s* [0-9]+) |
6434 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
6435 \$ \$ (?![\w\{]) |
6436 \$ (?>\s*) \$ (?>\s*) $qq_variable |
6437 \[\^ |
6438 \[\: (?>[a-z]+) :\] |
6439 \[\:\^ (?>[a-z]+) :\] |
6440 \(\? |
6441 $q_char
6442 ))/oxmsg;
6443  
6444 # choice again delimiter
6445 72 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 72 72
6446 0 my %octet = map {$_ => 1} @char;
6447 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
6448 0 $delimiter = '(';
6449 0 $end_delimiter = ')';
6450 }
6451 elsif (not $octet{'}'}) {
6452 0 $delimiter = '{';
6453 0 $end_delimiter = '}';
6454 }
6455 elsif (not $octet{']'}) {
6456 0 $delimiter = '[';
6457 0 $end_delimiter = ']';
6458 }
6459 elsif (not $octet{'>'}) {
6460 0 $delimiter = '<';
6461 0 $end_delimiter = '>';
6462 }
6463 else {
6464 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
6465 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
6466 0 $delimiter = $char;
6467 0 $end_delimiter = $char;
6468 0 last;
6469 }
6470 }
6471 }
6472 }
6473  
6474 # count '('
6475 72 my $parens = grep { $_ eq '(' } @char;
6476  
6477 72 my $left_e = 0;
6478 72 my $right_e = 0;
6479 72 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 200 72 272
6480  
6481 # "\L\u" --> "\u\L"
6482 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
6483 0 @char[$i,$i+1] = @char[$i+1,$i];
6484 }
6485  
6486 # "\U\l" --> "\l\U"
6487 ▶ 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
6488 0 @char[$i,$i+1] = @char[$i+1,$i];
6489 }
6490  
6491 # octal escape sequence
6492 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
6493 1 $char[$i] = Elatin1::octchr($1);
6494 }
6495  
6496 # hexadecimal escape sequence
6497 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
6498 1 $char[$i] = Elatin1::hexchr($1);
6499 }
6500  
6501 # \b{...} --> b\{...}
6502 # \B{...} --> B\{...}
6503 # \N{CHARNAME} --> N\{CHARNAME}
6504 # \p{PROPERTY} --> p\{PROPERTY}
6505 # \P{PROPERTY} --> P\{PROPERTY}
6506 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
6507 0 $char[$i] = $1 . '\\' . $2;
6508 }
6509  
6510 # \p, \P, \X --> p, P, X
6511 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
6512 0 $char[$i] = $1;
6513 }
6514  
6515 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 &Elatin1::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
6516 }
6517  
6518 # join separated multiple-octet
6519 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
6520 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 $Elatin1::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 $Elatin1::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 $Elatin1::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 $Elatin1::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 $Elatin1::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 $Elatin1::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 $Elatin1::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6521 0 $char[$i] .= join '', splice @char, $i+1, 3;
6522 }
6523 ▶ 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 $Elatin1::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 $Elatin1::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 $Elatin1::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 $Elatin1::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6524 0 $char[$i] .= join '', splice @char, $i+1, 2;
6525 }
6526 ▶ 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 $Elatin1::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 $Elatin1::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 $Elatin1::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 $Elatin1::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6527 0 $char[$i] .= join '', splice @char, $i+1, 1;
6528 }
6529 }
6530  
6531 # open character class [...]
6532 elsif ($char[$i] eq '[') {
6533 17 my $left = $i;
6534 17 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 17 17
6535 0 $i++;
6536 }
6537 17 while (1) {
6538 74 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 74 74
6539 0 die __FILE__, ": Unmatched [] in regexp\n";
6540 }
6541 74 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 17 57 74
6542 17 my $right = $i;
6543  
6544 # [...]
6545 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
6546 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin1::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6547 }
6548 else {
6549 17 splice @char, $left, $right-$left+1, Elatin1::charlist_qr(@char[$left+1..$right-1], $modifier);
6550 }
6551  
6552 17 $i = $left;
6553 17 last;
6554 }
6555 }
6556 }
6557  
6558 # open character class [^...]
6559 elsif ($char[$i] eq '[^') {
6560 0 my $left = $i;
6561 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6562 0 $i++;
6563 }
6564 0 while (1) {
6565 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6566 0 die __FILE__, ": Unmatched [] in regexp\n";
6567 }
6568 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6569 0 my $right = $i;
6570  
6571 # [^...]
6572 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
6573 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin1::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6574 }
6575 else {
6576 0 splice @char, $left, $right-$left+1, Elatin1::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6577 }
6578  
6579 0 $i = $left;
6580 0 last;
6581 }
6582 }
6583 }
6584  
6585 # rewrite character class or escape character
6586 elsif (my $char = character_class($char[$i],$modifier)) {
6587 7 $char[$i] = $char;
6588 }
6589  
6590 # /i modifier
6591 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin1::uc($char[$i]) ne Elatin1::fc($char[$i]))) {
Condition66%4/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin1::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 &Elatin1::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin1::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= &Elatin1::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6592 3 ▶ if (CORE::length(Elatin1::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 3 0 3
6593 3 $char[$i] = '[' . Elatin1::uc($char[$i]) . Elatin1::fc($char[$i]) . ']';
6594 }
6595 else {
6596 0 $char[$i] = '(?:' . Elatin1::uc($char[$i]) . '|' . Elatin1::fc($char[$i]) . ')';
6597 }
6598 }
6599  
6600 # \u \l \U \L \F \Q \E
6601 elsif ($char[$i] =~ /\A [<>] \z/oxms) {
6602 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
6603 0 $char[$i] = '\\' . $char[$i];
6604 }
6605 }
6606 elsif ($char[$i] eq '\u') {
6607 0 $char[$i] = '@{[Elatin1::ucfirst qq<';
6608 0 $left_e++;
6609 }
6610 elsif ($char[$i] eq '\l') {
6611 0 $char[$i] = '@{[Elatin1::lcfirst qq<';
6612 0 $left_e++;
6613 }
6614 elsif ($char[$i] eq '\U') {
6615 0 $char[$i] = '@{[Elatin1::uc qq<';
6616 0 $left_e++;
6617 }
6618 elsif ($char[$i] eq '\L') {
6619 0 $char[$i] = '@{[Elatin1::lc qq<';
6620 0 $left_e++;
6621 }
6622 elsif ($char[$i] eq '\F') {
6623 0 $char[$i] = '@{[Elatin1::fc qq<';
6624 0 $left_e++;
6625 }
6626 elsif ($char[$i] eq '\Q') {
6627 0 $char[$i] = '@{[CORE::quotemeta qq<';
6628 0 $left_e++;
6629 }
6630 elsif ($char[$i] eq '\E') {
6631 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
6632 0 $char[$i] = '>]}';
6633 0 $right_e++;
6634 }
6635 else {
6636 0 $char[$i] = '';
6637 }
6638 }
6639 elsif ($char[$i] eq '\Q') {
6640 0 while (1) {
6641 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6642 0 last;
6643 }
6644 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
6645 0 last;
6646 }
6647 }
6648 }
6649 elsif ($char[$i] eq '\E') {
6650 }
6651  
6652 # \0 --> \0
6653 elsif ($char[$i] =~ /\A \\ (?>\s*) 0 \z/oxms) {
6654 }
6655  
6656 # \g{N}, \g{-N}
6657  
6658 # P.108 Using Simple Patterns
6659 # in Chapter 7: In the World of Regular Expressions
6660 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
6661  
6662 # P.221 Capturing
6663 # in Chapter 5: Pattern Matching
6664 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
6665  
6666 # \g{-1}, \g{-2}, \g{-3} --> \g{-1}, \g{-2}, \g{-3}
6667 elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) - (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6668 }
6669  
6670 # \g{1}, \g{2}, \g{3} --> \g{2}, \g{3}, \g{4} (only when multibyte anchoring is enable)
6671 elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6672 }
6673  
6674 # \g1, \g2, \g3 --> \g2, \g3, \g4 (only when multibyte anchoring is enable)
6675 elsif ($char[$i] =~ /\A \\g (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) {
6676 }
6677  
6678 # \1, \2, \3 --> \2, \3, \4 (only when multibyte anchoring is enable)
6679 elsif ($char[$i] =~ /\A \\ (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) {
6680 }
6681  
6682 # $0 --> $0
6683 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
6684 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6685 0 $char[$i] = '@{[Elatin1::ignorecase(' . $char[$i] . ')]}';
6686 }
6687 }
6688 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
6689 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6690 0 $char[$i] = '@{[Elatin1::ignorecase(' . $char[$i] . ')]}';
6691 }
6692 }
6693  
6694 # $$ --> $$
6695 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
6696 }
6697  
6698 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
6699 # $1, $2, $3 --> $1, $2, $3 otherwise
6700 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
6701 0 $char[$i] = e_capture($1);
6702 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6703 0 $char[$i] = '@{[Elatin1::ignorecase(' . $char[$i] . ')]}';
6704 }
6705 }
6706 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6707 0 $char[$i] = e_capture($1);
6708 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6709 0 $char[$i] = '@{[Elatin1::ignorecase(' . $char[$i] . ')]}';
6710 }
6711 }
6712  
6713 # $$foo[ ... ] --> $ $foo->[ ... ]
6714 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
6715 0 $char[$i] = e_capture($1.'->'.$2);
6716 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6717 0 $char[$i] = '@{[Elatin1::ignorecase(' . $char[$i] . ')]}';
6718 }
6719 }
6720  
6721 # $$foo{ ... } --> $ $foo->{ ... }
6722 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
6723 0 $char[$i] = e_capture($1.'->'.$2);
6724 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6725 0 $char[$i] = '@{[Elatin1::ignorecase(' . $char[$i] . ')]}';
6726 }
6727 }
6728  
6729 # $$foo
6730 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
6731 0 $char[$i] = e_capture($1);
6732 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6733 0 $char[$i] = '@{[Elatin1::ignorecase(' . $char[$i] . ')]}';
6734 }
6735 }
6736  
6737 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin1::PREMATCH()
6738 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
6739 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 4 4
6740 0 $char[$i] = '@{[Elatin1::ignorecase(Elatin1::PREMATCH())]}';
6741 }
6742 else {
6743 4 $char[$i] = '@{[Elatin1::PREMATCH()]}';
6744 }
6745 }
6746  
6747 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin1::MATCH()
6748 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
6749 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 4 4
6750 0 $char[$i] = '@{[Elatin1::ignorecase(Elatin1::MATCH())]}';
6751 }
6752 else {
6753 4 $char[$i] = '@{[Elatin1::MATCH()]}';
6754 }
6755 }
6756  
6757 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin1::POSTMATCH()
6758 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
6759 3 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 3 3
6760 0 $char[$i] = '@{[Elatin1::ignorecase(Elatin1::POSTMATCH())]}';
6761 }
6762 else {
6763 3 $char[$i] = '@{[Elatin1::POSTMATCH()]}';
6764 }
6765 }
6766  
6767 # ${ foo }
6768 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
6769 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6770 0 $char[$i] = '@{[Elatin1::ignorecase(' . $char[$i] . ')]}';
6771 }
6772 }
6773  
6774 # ${ ... }
6775 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
6776 0 $char[$i] = e_capture($1);
6777 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6778 0 $char[$i] = '@{[Elatin1::ignorecase(' . $char[$i] . ')]}';
6779 }
6780 }
6781  
6782 # $scalar or @array
6783 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
6784 4 $char[$i] = e_string($char[$i]);
6785 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 4 4
6786 0 $char[$i] = '@{[Elatin1::ignorecase(' . $char[$i] . ')]}';
6787 }
6788 }
6789  
6790 # quote character before ? + * {
6791 ▶ 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
6792 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
6793 }
6794 else {
6795 14 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6796 }
6797 }
6798 }
6799  
6800 # make regexp string
6801 72 my $prematch = '';
6802 72 $modifier =~ tr/i//d;
6803 72 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 72 72
6804 0 return join '', $ope, $delimiter, $prematch, '(?:', @char, '>]}' x ($left_e - $right_e), ')', $matched, $end_delimiter, $modifier;
6805 }
6806 72 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6807 }
6808  
6809 #
6810 # escape regexp (s'here'' or s'here''b)
6811 #
6812 21 ▶sub e_s1_q {
Subroutine e_s1_q: called CC=7 SCAR=24.3
Pod undocumented
6813 21 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6814 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
6815  
6816 21 $modifier =~ tr/p//d;
6817 21 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 21 21
6818 0 my $line = 0;
6819 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6820 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6821 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6822 0 last;
6823 }
6824 }
6825 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6826 }
6827  
6828 21 $slash = 'div';
6829  
6830 # literal null string pattern
6831 21 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 13 21
elsif ($modifier =~ tr/Bb//d) { } 0 13 13
6832 8 $modifier =~ tr/bB//d;
6833 8 $modifier =~ tr/i//d;
6834 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
6835 }
6836  
6837 # with /b /B modifier
6838 elsif ($modifier =~ tr/bB//d) {
6839 0 return e_s1_qb($ope,$delimiter,$end_delimiter,$string,$modifier);
6840 }
6841  
6842 # without /b /B modifier
6843 else {
6844 13 return e_s1_qt($ope,$delimiter,$end_delimiter,$string,$modifier);
6845 }
6846 }
6847  
6848 #
6849 # escape regexp (s'here'')
6850 #
6851 13 ▶sub e_s1_qt {
Subroutine e_s1_qt: called CC=20 SCAR=50.1
Pod undocumented
6852 13 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6853  
6854 13 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 13 13
6855  
6856 # split regexp
6857 13 my @char = $string =~ /\G((?>
6858 [^\\\[\$\@\/] |
6859 [\x00-\xFF] |
6860 \[\^ |
6861 \[\: (?>[a-z]+) \:\] |
6862 \[\:\^ (?>[a-z]+) \:\] |
6863 [\$\@\/] |
6864 \\ (?:$q_char) |
6865 (?:$q_char)
6866 ))/oxmsg;
6867  
6868 # unescape character
6869 13 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 25 13 38
6870 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 &Elatin1::uc($char[$i]) ne &fc($char[$i])) { } 0 19 19
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 32 32
6871 }
6872  
6873 # open character class [...]
6874 elsif ($char[$i] eq '[') {
6875 0 my $left = $i;
6876 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6877 0 $i++;
6878 }
6879 0 while (1) {
6880 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6881 0 die __FILE__, ": Unmatched [] in regexp\n";
6882 }
6883 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6884 0 my $right = $i;
6885  
6886 # [...]
6887 0 splice @char, $left, $right-$left+1, Elatin1::charlist_qr(@char[$left+1..$right-1], $modifier);
6888  
6889 0 $i = $left;
6890 0 last;
6891 }
6892 }
6893 }
6894  
6895 # open character class [^...]
6896 elsif ($char[$i] eq '[^') {
6897 0 my $left = $i;
6898 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6899 0 $i++;
6900 }
6901 0 while (1) {
6902 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6903 0 die __FILE__, ": Unmatched [] in regexp\n";
6904 }
6905 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6906 0 my $right = $i;
6907  
6908 # [^...]
6909 0 splice @char, $left, $right-$left+1, Elatin1::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6910  
6911 0 $i = $left;
6912 0 last;
6913 }
6914 }
6915 }
6916  
6917 # escape $ @ / and \
6918 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6919 0 $char[$i] = '\\' . $char[$i];
6920 }
6921  
6922 # rewrite character class or escape character
6923 elsif (my $char = character_class($char[$i],$modifier)) {
6924 6 $char[$i] = $char;
6925 }
6926  
6927 # /i modifier
6928 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin1::uc($char[$i]) ne Elatin1::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin1::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 &Elatin1::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin1::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= &Elatin1::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6929 0 ▶ if (CORE::length(Elatin1::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
6930 0 $char[$i] = '[' . Elatin1::uc($char[$i]) . Elatin1::fc($char[$i]) . ']';
6931 }
6932 else {
6933 0 $char[$i] = '(?:' . Elatin1::uc($char[$i]) . '|' . Elatin1::fc($char[$i]) . ')';
6934 }
6935 }
6936  
6937 # quote character before ? + * {
6938 ▶ 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
6939 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
6940 }
6941 else {
6942 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6943 }
6944 }
6945 }
6946  
6947 13 $modifier =~ tr/i//d;
6948 13 $delimiter = '/';
6949 13 $end_delimiter = '/';
6950 13 my $prematch = '';
6951 13 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6952 }
6953  
6954 #
6955 # escape regexp (s'here''b)
6956 #
6957 0 ▶sub e_s1_qb {
Subroutine e_s1_qb: not called CC=4 SCAR=30.0
Pod undocumented
6958 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6959  
6960 # split regexp
6961 0 my @char = $string =~ /\G (?>[^\\]|\\\\) /oxmsg;
6962  
6963 # unescape character
6964 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
6965 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
6966 }
6967  
6968 # remain \\
6969 elsif ($char[$i] eq '\\\\') {
6970 }
6971  
6972 # escape $ @ / and \
6973 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6974 0 $char[$i] = '\\' . $char[$i];
6975 }
6976 }
6977  
6978 0 $delimiter = '/';
6979 0 $end_delimiter = '/';
6980 0 my $prematch = '';
6981 0 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6982 }
6983  
6984 #
6985 # escape regexp (s''here')
6986 #
6987 16 ▶sub e_s2_q {
Subroutine e_s2_q: called CC=4 SCAR=13.9
Pod undocumented
6988 16 my($ope,$delimiter,$end_delimiter,$string) = @_;
6989  
6990 16 $slash = 'div';
6991  
6992 16 my @char = $string =~ / \G (?>[^\\]|\\\\|$q_char) /oxmsg;
6993 16 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 9 16 25
6994 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
6995 }
6996  
6997 # not escape \\
6998 elsif ($char[$i] =~ /\A \\\\ \z/oxms) {
6999 }
7000  
7001 # escape $ @ / and \
7002 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
7003 5 $char[$i] = '\\' . $char[$i];
7004 }
7005 }
7006  
7007 16 return join '', $ope, $delimiter, @char, $end_delimiter;
7008 }
7009  
7010 #
7011 # escape regexp (s/here/and here/modifier)
7012 #
7013 101 ▶sub e_sub {
Subroutine e_sub: called CC=20 SCAR=32.6
Pod undocumented
7014 101 my($variable,$delimiter1,$pattern,$end_delimiter1,$delimiter2,$replacement,$end_delimiter2,$modifier) = @_;
7015 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
7016  
7017 101 $modifier =~ tr/p//d;
7018 101 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 101 101
7019 0 my $line = 0;
7020 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7021 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
7022 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
7023 0 last;
7024 }
7025 }
7026 0 die qq{Unsupported modifier "$1" used at line $line.\n};
7027 }
7028  
7029 101 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq "") 36 65 101
7030 36 $variable = '$_';
7031 36 $bind_operator = ' =~ ';
7032 }
7033  
7034 101 $slash = 'div';
7035  
7036 # P.128 Start of match (or end of previous match): \G
7037 # P.130 Advanced Use of \G with Perl
7038 # in Chapter 3: Overview of Regular Expression Features and Flavors
7039 # P.312 Iterative Matching: Scalar Context, with /g
7040 # in Chapter 7: Perl
7041 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
7042  
7043 # P.181 Where You Left Off: The \G Assertion
7044 # in Chapter 5: Pattern Matching
7045 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
7046  
7047 # P.220 Where You Left Off: The \G Assertion
7048 # in Chapter 5: Pattern Matching
7049 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
7050  
7051 101 my $e_modifier = $modifier =~ tr/e//d;
7052 101 my $r_modifier = $modifier =~ tr/r//d;
7053  
7054 101 my $my = '';
7055 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
7056 0 $my = $variable;
7057 0 $variable =~ s/ (?: local \b | my \b | our \b | state \b ) (?>\s*) //oxms;
7058 0 $variable =~ s/ = .+ \z//oxms;
7059 }
7060  
7061 101 (my $variable_basename = $variable) =~ s/ [\[\{].* \z//oxms;
7062 101 $variable_basename =~ s/ \s+ \z//oxms;
7063  
7064 # quote replacement string
7065 101 my $e_replacement = '';
7066 101 ▶ if ($e_modifier >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($e_modifier >= 1) { } 17 84 101
7067 17 $e_replacement = e_qq('', '', '', $replacement);
7068 17 $e_modifier--;
7069 }
7070 else {
7071 84 ▶ if ($delimiter2 eq "'") {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter2 eq q[']) { } 16 68 84
7072 16 $e_replacement = e_s2_q('qq', '/', '/', $replacement);
7073 }
7074 else {
7075 68 $e_replacement = e_qq ('qq', $delimiter2, $end_delimiter2, $replacement);
7076 }
7077 }
7078  
7079 101 my $sub = '';
7080  
7081 # with /r
7082 101 ▶ if ($r_modifier) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r_modifier) { } 10 91 101
7083 10 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $modifier =~ /g/mosx }) { } 5 5 10
7084 }
7085  
7086 # s///gr without multibyte anchoring
7087 elsif ($modifier =~ /g/oxms) {
7088 5 ▶ $sub = sprintf(
Branch: 1 branch
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 0 5 5
7089 # 1 2 3 4 5
7090 q<CORE::eval{local $Elatin1::re_t=%s; while($Elatin1::re_t =~ %s){%s local $^W=0; local $Elatin1::re_r=%s; %s$Elatin1::re_t="$`$Elatin1::re_r$'"; pos($Elatin1::re_t)=length "$`$Elatin1::re_r"; } return $Elatin1::re_t}>,
7091  
7092 $variable, # 1
7093 ($delimiter1 eq "'") ? # 2
7094 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
7095 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
7096 $s_matched, # 3
7097 $e_replacement, # 4
7098 '$Elatin1::re_r=CORE::eval $Elatin1::re_r; ' x $e_modifier, # 5
7099 );
7100 }
7101  
7102 # s///r
7103 else {
7104  
7105 5 my $prematch = q{$`};
7106  
7107 5 ▶ $sub = sprintf(
Branch: 1 branch
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 0 5 5
7108 # 1 2 3 4 5 6 7
7109 q<(%s =~ %s) ? CORE::eval{%s local $^W=0; local $Elatin1::re_r=%s; %s"%s$Elatin1::re_r$'" } : %s>,
7110  
7111 $variable, # 1
7112 ($delimiter1 eq "'") ? # 2
7113 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
7114 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
7115 $s_matched, # 3
7116 $e_replacement, # 4
7117 '$Elatin1::re_r=CORE::eval $Elatin1::re_r; ' x $e_modifier, # 5
7118 $prematch, # 6
7119 $variable, # 7
7120 );
7121 }
7122  
7123 # $var !~ s///r doesn't make sense
7124 10 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) 0 10 10
7125 0 $sub = q{die("$0: Using !~ with s///r doesn't make sense"), } . $sub;
7126 }
7127 }
7128  
7129 # without /r
7130 else {
7131 91 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $modifier =~ /g/mosx }) { } 23 68 91
7132 }
7133  
7134 # s///g without multibyte anchoring
7135 elsif ($modifier =~ /g/oxms) {
7136 23 ▶ $sub = sprintf(
Branch: 2 branches
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 3 20 23
$bind_operator =~ / !~ /mosx ? : 3 20 23
7137 # 1 2 3 4 5 6 7 8
7138 q<CORE::eval{local $Elatin1::re_n=0; while(%s =~ %s){%s local $^W=0; local $Elatin1::re_r=%s; %s%s="$`$Elatin1::re_r$'"; pos(%s)=length "$`$Elatin1::re_r"; $Elatin1::re_n++} return %s$Elatin1::re_n}>,
7139  
7140 $variable, # 1
7141 ($delimiter1 eq "'") ? # 2
7142 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
7143 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
7144 $s_matched, # 3
7145 $e_replacement, # 4
7146 '$Elatin1::re_r=CORE::eval $Elatin1::re_r; ' x $e_modifier, # 5
7147 $variable, # 6
7148 $variable, # 7
7149 ($bind_operator =~ / !~ /oxms) ? '!' : '', # 8
7150 );
7151 }
7152  
7153 # s///
7154 else {
7155  
7156 68 my $prematch = q{$`};
7157  
7158 68 ▶ $sub = sprintf(
Branch: 2 branches
BranchTrueFalseTotal
$bind_operator =~ / =~ /mosx ? : 65 3 68
$delimiter1 eq q['] ? : 18 50 68
7159  
7160 ($bind_operator =~ / =~ /oxms) ?
7161  
7162 # 1 2 3 4 5 6 7 8
7163 q<(%s%s%s) ? CORE::eval{%s local $^W=0; local $Elatin1::re_r=%s; %s%s="%s$Elatin1::re_r$'"; 1 } : undef> :
7164  
7165 # 1 2 3 4 5 6 7 8
7166 q<(%s%s%s) ? 1 : CORE::eval{%s local $^W=0; local $Elatin1::re_r=%s; %s%s="%s$Elatin1::re_r$'"; undef }>,
7167  
7168 $variable, # 1
7169 $bind_operator, # 2
7170 ($delimiter1 eq "'") ? # 3
7171 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
7172 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
7173 $s_matched, # 4
7174 $e_replacement, # 5
7175 '$Elatin1::re_r=CORE::eval $Elatin1::re_r; ' x $e_modifier, # 6
7176 $variable, # 7
7177 $prematch, # 8
7178 );
7179 }
7180 }
7181  
7182 # (my $foo = $bar) =~ s/// --> (my $foo = $bar, CORE::eval { ... })[1]
7183 101 ▶ if ($my ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($my ne "") 0 101 101
7184 0 $sub = "($my, $sub)[1]";
7185 }
7186  
7187 # clear s/// variable
7188 101 $sub_variable = '';
7189 101 $bind_operator = '';
7190  
7191 101 return $sub;
7192 }
7193  
7194 #
7195 # escape regexp of split qr//
7196 #
7197 74 ▶sub e_split {
Subroutine e_split: called CC=88 SCAR=76.4
Pod undocumented
7198 74 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
7199 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
7200  
7201 74 $modifier =~ tr/p//d;
7202 74 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 74 74
7203 0 my $line = 0;
7204 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7205 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
7206 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
7207 0 last;
7208 }
7209 }
7210 0 die qq{Unsupported modifier "$1" used at line $line.\n};
7211 }
7212  
7213 74 $slash = 'div';
7214  
7215 # /b /B modifier
7216 74 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) 0 74 74
7217 0 return join '', 'split', $ope, $delimiter, $string, $end_delimiter, $modifier;
7218 }
7219  
7220 74 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 74 74
7221 74 my $metachar = qr/[\@\\|[\]{^]/oxms;
7222  
7223 # split regexp
7224 74 my @char = $string =~ /\G((?>
7225 [^\\\$\@\[\(] |
7226 \\x (?>[0-9A-Fa-f]{1,2}) |
7227 \\ (?>[0-7]{2,3}) |
7228 \\c [\x40-\x5F] |
7229 \\x\{ (?>[0-9A-Fa-f]+) \} |
7230 \\o\{ (?>[0-7]+) \} |
7231 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
7232 \\ $q_char |
7233 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
7234 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
7235 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
7236 [\$\@] $qq_variable |
7237 \$ (?>\s* [0-9]+) |
7238 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
7239 \$ \$ (?![\w\{]) |
7240 \$ (?>\s*) \$ (?>\s*) $qq_variable |
7241 \[\^ |
7242 \[\: (?>[a-z]+) :\] |
7243 \[\:\^ (?>[a-z]+) :\] |
7244 \(\? |
7245 $q_char
7246 ))/oxmsg;
7247  
7248 74 my $left_e = 0;
7249 74 my $right_e = 0;
7250 74 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 249 74 323
7251  
7252 # "\L\u" --> "\u\L"
7253 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
7254 0 @char[$i,$i+1] = @char[$i+1,$i];
7255 }
7256  
7257 # "\U\l" --> "\l\U"
7258 ▶ 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
7259 0 @char[$i,$i+1] = @char[$i+1,$i];
7260 }
7261  
7262 # octal escape sequence
7263 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
7264 1 $char[$i] = Elatin1::octchr($1);
7265 }
7266  
7267 # hexadecimal escape sequence
7268 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
7269 1 $char[$i] = Elatin1::hexchr($1);
7270 }
7271  
7272 # \b{...} --> b\{...}
7273 # \B{...} --> B\{...}
7274 # \N{CHARNAME} --> N\{CHARNAME}
7275 # \p{PROPERTY} --> p\{PROPERTY}
7276 # \P{PROPERTY} --> P\{PROPERTY}
7277 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
7278 0 $char[$i] = $1 . '\\' . $2;
7279 }
7280  
7281 # \p, \P, \X --> p, P, X
7282 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
7283 0 $char[$i] = $1;
7284 }
7285  
7286 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 &Elatin1::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
7287 }
7288  
7289 # join separated multiple-octet
7290 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
7291 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 $Elatin1::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 $Elatin1::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 $Elatin1::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 $Elatin1::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 $Elatin1::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 $Elatin1::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 $Elatin1::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
7292 0 $char[$i] .= join '', splice @char, $i+1, 3;
7293 }
7294 ▶ 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 $Elatin1::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 $Elatin1::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 $Elatin1::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 $Elatin1::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
7295 0 $char[$i] .= join '', splice @char, $i+1, 2;
7296 }
7297 ▶ 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 $Elatin1::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 $Elatin1::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 $Elatin1::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 $Elatin1::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
7298 0 $char[$i] .= join '', splice @char, $i+1, 1;
7299 }
7300 }
7301  
7302 # open character class [...]
7303 elsif ($char[$i] eq '[') {
7304 3 my $left = $i;
7305 3 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 3 3
7306 0 $i++;
7307 }
7308 3 while (1) {
7309 7 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 7 7
7310 0 die __FILE__, ": Unmatched [] in regexp\n";
7311 }
7312 7 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 3 4 7
7313 3 my $right = $i;
7314  
7315 # [...]
7316 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
7317 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin1::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
7318 }
7319 else {
7320 3 splice @char, $left, $right-$left+1, Elatin1::charlist_qr(@char[$left+1..$right-1], $modifier);
7321 }
7322  
7323 3 $i = $left;
7324 3 last;
7325 }
7326 }
7327 }
7328  
7329 # open character class [^...]
7330 elsif ($char[$i] eq '[^') {
7331 0 my $left = $i;
7332 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7333 0 $i++;
7334 }
7335 0 while (1) {
7336 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7337 0 die __FILE__, ": Unmatched [] in regexp\n";
7338 }
7339 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7340 0 my $right = $i;
7341  
7342 # [^...]
7343 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
7344 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin1::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
7345 }
7346 else {
7347 0 splice @char, $left, $right-$left+1, Elatin1::charlist_not_qr(@char[$left+1..$right-1], $modifier);
7348 }
7349  
7350 0 $i = $left;
7351 0 last;
7352 }
7353 }
7354 }
7355  
7356 # rewrite character class or escape character
7357 elsif (my $char = character_class($char[$i],$modifier)) {
7358 1 $char[$i] = $char;
7359 }
7360  
7361 # P.794 29.2.161. split
7362 # in Chapter 29: Functions
7363 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
7364  
7365 # P.951 split
7366 # in Chapter 27: Functions
7367 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
7368  
7369 # said "The //m modifier is assumed when you split on the pattern /^/",
7370 # but perl5.008 is not so. Therefore, this software adds //m.
7371 # (and so on)
7372  
7373 # split(m/^/) --> split(m/^/m)
7374 ▶ 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
7375 7 $modifier .= 'm';
7376 }
7377  
7378 # /i modifier
7379 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin1::uc($char[$i]) ne Elatin1::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin1::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 &Elatin1::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin1::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= &Elatin1::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
7380 0 ▶ if (CORE::length(Elatin1::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
7381 0 $char[$i] = '[' . Elatin1::uc($char[$i]) . Elatin1::fc($char[$i]) . ']';
7382 }
7383 else {
7384 0 $char[$i] = '(?:' . Elatin1::uc($char[$i]) . '|' . Elatin1::fc($char[$i]) . ')';
7385 }
7386 }
7387  
7388 # \u \l \U \L \F \Q \E
7389 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
7390 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
7391 0 $char[$i] = '\\' . $char[$i];
7392 }
7393 }
7394 elsif ($char[$i] eq '\u') {
7395 0 $char[$i] = '@{[Elatin1::ucfirst qq<';
7396 0 $left_e++;
7397 }
7398 elsif ($char[$i] eq '\l') {
7399 0 $char[$i] = '@{[Elatin1::lcfirst qq<';
7400 0 $left_e++;
7401 }
7402 elsif ($char[$i] eq '\U') {
7403 0 $char[$i] = '@{[Elatin1::uc qq<';
7404 0 $left_e++;
7405 }
7406 elsif ($char[$i] eq '\L') {
7407 0 $char[$i] = '@{[Elatin1::lc qq<';
7408 0 $left_e++;
7409 }
7410 elsif ($char[$i] eq '\F') {
7411 0 $char[$i] = '@{[Elatin1::fc qq<';
7412 0 $left_e++;
7413 }
7414 elsif ($char[$i] eq '\Q') {
7415 0 $char[$i] = '@{[CORE::quotemeta qq<';
7416 0 $left_e++;
7417 }
7418 elsif ($char[$i] eq '\E') {
7419 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
7420 0 $char[$i] = '>]}';
7421 0 $right_e++;
7422 }
7423 else {
7424 0 $char[$i] = '';
7425 }
7426 }
7427 elsif ($char[$i] eq '\Q') {
7428 0 while (1) {
7429 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7430 0 last;
7431 }
7432 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
7433 0 last;
7434 }
7435 }
7436 }
7437 elsif ($char[$i] eq '\E') {
7438 }
7439  
7440 # $0 --> $0
7441 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
7442 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7443 0 $char[$i] = '@{[Elatin1::ignorecase(' . $char[$i] . ')]}';
7444 }
7445 }
7446 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
7447 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7448 0 $char[$i] = '@{[Elatin1::ignorecase(' . $char[$i] . ')]}';
7449 }
7450 }
7451  
7452 # $$ --> $$
7453 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
7454 }
7455  
7456 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
7457 # $1, $2, $3 --> $1, $2, $3 otherwise
7458 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
7459 0 $char[$i] = e_capture($1);
7460 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7461 0 $char[$i] = '@{[Elatin1::ignorecase(' . $char[$i] . ')]}';
7462 }
7463 }
7464 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
7465 0 $char[$i] = e_capture($1);
7466 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7467 0 $char[$i] = '@{[Elatin1::ignorecase(' . $char[$i] . ')]}';
7468 }
7469 }
7470  
7471 # $$foo[ ... ] --> $ $foo->[ ... ]
7472 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
7473 0 $char[$i] = e_capture($1.'->'.$2);
7474 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7475 0 $char[$i] = '@{[Elatin1::ignorecase(' . $char[$i] . ')]}';
7476 }
7477 }
7478  
7479 # $$foo{ ... } --> $ $foo->{ ... }
7480 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
7481 0 $char[$i] = e_capture($1.'->'.$2);
7482 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7483 0 $char[$i] = '@{[Elatin1::ignorecase(' . $char[$i] . ')]}';
7484 }
7485 }
7486  
7487 # $$foo
7488 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
7489 0 $char[$i] = e_capture($1);
7490 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7491 0 $char[$i] = '@{[Elatin1::ignorecase(' . $char[$i] . ')]}';
7492 }
7493 }
7494  
7495 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin1::PREMATCH()
7496 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
7497 12 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 12 12
7498 0 $char[$i] = '@{[Elatin1::ignorecase(Elatin1::PREMATCH())]}';
7499 }
7500 else {
7501 12 $char[$i] = '@{[Elatin1::PREMATCH()]}';
7502 }
7503 }
7504  
7505 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin1::MATCH()
7506 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
7507 12 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 12 12
7508 0 $char[$i] = '@{[Elatin1::ignorecase(Elatin1::MATCH())]}';
7509 }
7510 else {
7511 12 $char[$i] = '@{[Elatin1::MATCH()]}';
7512 }
7513 }
7514  
7515 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin1::POSTMATCH()
7516 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
7517 9 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 9 9
7518 0 $char[$i] = '@{[Elatin1::ignorecase(Elatin1::POSTMATCH())]}';
7519 }
7520 else {
7521 9 $char[$i] = '@{[Elatin1::POSTMATCH()]}';
7522 }
7523 }
7524  
7525 # ${ foo }
7526 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
7527 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7528 0 $char[$i] = '@{[Elatin1::ignorecase(' . $1 . ')]}';
7529 }
7530 }
7531  
7532 # ${ ... }
7533 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
7534 0 $char[$i] = e_capture($1);
7535 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7536 0 $char[$i] = '@{[Elatin1::ignorecase(' . $char[$i] . ')]}';
7537 }
7538 }
7539  
7540 # $scalar or @array
7541 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
7542 3 $char[$i] = e_string($char[$i]);
7543 3 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 3 3
7544 0 $char[$i] = '@{[Elatin1::ignorecase(' . $char[$i] . ')]}';
7545 }
7546 }
7547  
7548 # quote character before ? + * {
7549 ▶ 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
7550 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
7551 }
7552 else {
7553 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
7554 }
7555 }
7556 }
7557  
7558 # make regexp string
7559 74 $modifier =~ tr/i//d;
7560 74 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 74 74
7561 0 return join '', 'Elatin1::split', $ope, $delimiter, @char, '>]}' x ($left_e - $right_e), $end_delimiter, $modifier;
7562 }
7563 74 return join '', 'Elatin1::split', $ope, $delimiter, @char, $end_delimiter, $modifier;
7564 }
7565  
7566 #
7567 # escape regexp of split qr''
7568 #
7569 0 ▶sub e_split_q {
Subroutine e_split_q: not called CC=26 SCAR=65.5
Pod undocumented
7570 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
7571 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
7572  
7573 0 $modifier =~ tr/p//d;
7574 0 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 0 0
7575 0 my $line = 0;
7576 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7577 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
7578 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
7579 0 last;
7580 }
7581 }
7582 0 die qq{Unsupported modifier "$1" used at line $line.\n};
7583 }
7584  
7585 0 $slash = 'div';
7586  
7587 # /b /B modifier
7588 0 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) 0 0 0
7589 0 return join '', 'split', $ope, $delimiter, $string, $end_delimiter, $modifier;
7590 }
7591  
7592 0 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 0 0
7593  
7594 # split regexp
7595 0 my @char = $string =~ /\G((?>
7596 [^\\\[] |
7597 [\x00-\xFF] |
7598 \[\^ |
7599 \[\: (?>[a-z]+) \:\] |
7600 \[\:\^ (?>[a-z]+) \:\] |
7601 \\ (?:$q_char) |
7602 (?:$q_char)
7603 ))/oxmsg;
7604  
7605 # unescape character
7606 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
7607 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 &Elatin1::uc($char[$i]) ne &fc($char[$i])) { } 0 0 0
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 0 0
7608 }
7609  
7610 # open character class [...]
7611 elsif ($char[$i] eq '[') {
7612 0 my $left = $i;
7613 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7614 0 $i++;
7615 }
7616 0 while (1) {
7617 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7618 0 die __FILE__, ": Unmatched [] in regexp\n";
7619 }
7620 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7621 0 my $right = $i;
7622  
7623 # [...]
7624 0 splice @char, $left, $right-$left+1, Elatin1::charlist_qr(@char[$left+1..$right-1], $modifier);
7625  
7626 0 $i = $left;
7627 0 last;
7628 }
7629 }
7630 }
7631  
7632 # open character class [^...]
7633 elsif ($char[$i] eq '[^') {
7634 0 my $left = $i;
7635 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7636 0 $i++;
7637 }
7638 0 while (1) {
7639 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7640 0 die __FILE__, ": Unmatched [] in regexp\n";
7641 }
7642 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7643 0 my $right = $i;
7644  
7645 # [^...]
7646 0 splice @char, $left, $right-$left+1, Elatin1::charlist_not_qr(@char[$left+1..$right-1], $modifier);
7647  
7648 0 $i = $left;
7649 0 last;
7650 }
7651 }
7652 }
7653  
7654 # rewrite character class or escape character
7655 elsif (my $char = character_class($char[$i],$modifier)) {
7656 0 $char[$i] = $char;
7657 }
7658  
7659 # split(m/^/) --> split(m/^/m)
7660 ▶ 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
7661 0 $modifier .= 'm';
7662 }
7663  
7664 # /i modifier
7665 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin1::uc($char[$i]) ne Elatin1::fc($char[$i]))) {
Condition0%0/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin1::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 &Elatin1::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin1::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= &Elatin1::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
7666 0 ▶ if (CORE::length(Elatin1::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
7667 0 $char[$i] = '[' . Elatin1::uc($char[$i]) . Elatin1::fc($char[$i]) . ']';
7668 }
7669 else {
7670 0 $char[$i] = '(?:' . Elatin1::uc($char[$i]) . '|' . Elatin1::fc($char[$i]) . ')';
7671 }
7672 }
7673  
7674 # quote character before ? + * {
7675 ▶ 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
7676 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
7677 }
7678 else {
7679 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
7680 }
7681 }
7682 }
7683  
7684 0 $modifier =~ tr/i//d;
7685 0 return join '', 'Elatin1::split', $ope, $delimiter, @char, $end_delimiter, $modifier;
7686 }
7687  
7688 #
7689 # instead of Carp::carp
7690 #
7691 0 ▶sub carp {
Subroutine carp: not called CC=1 SCAR=6.9
Pod undocumented
7692 0 my($package,$filename,$line) = caller(1);
7693 0 print STDERR "@_ at $filename line $line.\n";
7694 }
7695  
7696 #
7697 # instead of Carp::croak
7698 #
7699 0 ▶sub croak {
Subroutine croak: not called CC=1 SCAR=6.9
Pod undocumented
7700 0 my($package,$filename,$line) = caller(1);
7701 0 print STDERR "@_ at $filename line $line.\n";
7702 0 die "\n";
7703 }
7704  
7705 #
7706 # instead of Carp::cluck
7707 #
7708 0 ▶sub cluck {
Subroutine cluck: not called CC=2 SCAR=17.9
Pod undocumented
7709 0 my $i = 0;
7710 0 my @cluck = ();
7711 0 ▶ while (my($package,$filename,$line,$subroutine) = caller($i)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7712 0 push @cluck, "[$i] $filename($line) $package::$subroutine\n";
7713 0 $i++;
7714 }
7715 0 print STDERR CORE::reverse @cluck;
7716 0 print STDERR "\n";
7717 0 print STDERR @_;
7718 }
7719  
7720 #
7721 # instead of Carp::confess
7722 #
7723 0 ▶sub confess {
Subroutine confess: not called CC=2 SCAR=17.9
Pod undocumented
7724 0 my $i = 0;
7725 0 my @confess = ();
7726 0 ▶ while (my($package,$filename,$line,$subroutine) = caller($i)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7727 0 push @confess, "[$i] $filename($line) $package::$subroutine\n";
7728 0 $i++;
7729 }
7730 0 print STDERR CORE::reverse @confess;
7731 0 print STDERR "\n";
7732 0 print STDERR @_;
7733 0 die "\n";
7734 }
7735  
7736 422 1;
7737  
7738 __END__
↑ Summary blib/lib/Latin1.pm »