Ewindows1258.pm

filter: Statementstmt 43.6% 1312 / 3009 Branchbran 40.7% 1063 / 2608 Conditioncond 31.0% 115 / 370 MC/DCmcdc 15.9% 35 / 220 Subroutinesub 68.9% 111 / 161 Podpod 4.6% 3 / 64 totaltotal 41.0% 2639 / 6432 CC 1475 SCAR 97.8
CC
1475
Cov
42%
escape_token
55669.4
e_s1
3320.4
e_split
2070.1
CRAP 17630.0
↑ Summary Windows1258.pm »
1 package Ewindows1258;
2 425 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 425 ▶BEGIN { $INC{'warnings.pm'} = '' if $] < 5.006 } use warnings;
Subroutine BEGIN: called CC=2 SCAR=7.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
if $] < "5.006" 0 424 424
4 ######################################################################
5 #
6 # Ewindows1258 - Run-time routines for Windows1258.pm
7 #
8 # http://search.cpan.org/dist/Char-Windows1258/
9 #
10 # Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2018, 2019 INABA Hitoshi <ina@cpan.org>
11 ######################################################################
12  
13 425 ▶use 5.00503; # Galapagos Consensus 1998 for primetools
Subroutine BEGIN: called CC=1 SCAR=0.0
14 # use 5.008001; # Lancaster Consensus 2013 for toolchains
15  
16 # 12.3. Delaying use Until Runtime
17 # in Chapter 12. Packages, Libraries, and Modules
18 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
19 # (and so on)
20  
21 # Version numbers should be boring
22 # http://www.dagolden.com/index.php/369/version-numbers-should-be-boring/
23 # For the impatient, the disinterested or those who just want to follow
24 # a recipe, my advice for all modules is this:
25 # our $VERSION = "0.001"; # or "0.001_001" for a dev release
26 # $VERSION = eval $VERSION; # No!! because '1.10' makes '1.1'
27  
28 425 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
29 424 $VERSION = '1.22';
30 424 $VERSION = $VERSION;
31  
32 424 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=7.0
33 425 ▶ if ($^X =~ / jperl /oxmsi) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^X =~ / jperl /imosx) 0 424 424
34 1 die __FILE__, ": needs perl(not jperl) 5.00503 or later. (\$^X==$^X)\n";
35 }
36 425 if (CORE::ord('A') == 193) {
37 die __FILE__, ": is not US-ASCII script (may be EBCDIC or EBCDIK script).\n";
38 }
39 424 if (CORE::ord('A') != 0x41) {
40 die __FILE__, ": is not US-ASCII script (must be US-ASCII script).\n";
41 }
42 }
43  
44 424 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=9.5
45  
46 # instead of utf8.pm
47 424 ▶ CORE::eval q{
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
48 no warnings qw(redefine);
49 *utf8::upgrade = sub { CORE::length $_[0] };
50 *utf8::downgrade = sub { 1 };
51 *utf8::encode = sub { };
52 *utf8::decode = sub { 1 };
53 *utf8::is_utf8 = sub { };
54 *utf8::valid = sub { 1 };
55 };
56 424 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 424 424
57 0 ▶ *utf8::upgrade = sub { CORE::length $_[0] };
Subroutine __ANON__: not called CC=1 SCAR=6.9
58 0 ▶ *utf8::downgrade = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
59 0 ▶ *utf8::encode = sub { };
Subroutine __ANON__: not called CC=1 SCAR=6.9
60 0 ▶ *utf8::decode = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
61 0 ▶ *utf8::is_utf8 = sub { };
Subroutine __ANON__: not called CC=1 SCAR=6.9
62 0 ▶ *utf8::valid = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
63 }
64 }
65  
66 # instead of Symbol.pm
67 BEGIN {
68 0 ▶ sub gensym () {
Subroutine gensym: not called CC=2 SCAR=17.9
Pod undocumented
69 0 ▶ if ($] < 5.006) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] < 5.006) { } 0 0 0
70 0 return \do { local *_ };
71 }
72 else {
73 0 return undef;
74 }
75 }
76  
77 20 ▶ sub qualify ($$) {
Subroutine qualify: called CC=8 SCAR=28.9
Pod undocumented
78 20 my($name) = @_;
79  
80 20 ▶ if (ref $name) {
Branch: 7 branches
BranchTrueFalseTotal
if (ref $name) { } 5 15 20
elsif (&Ewindows1258::index($name, '::') >= 0) { } 0 15 15
elsif (&Ewindows1258::index($name, q[']) >= 0) { } 0 15 15
elsif ($name =~ /\A \^ [ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]+ \z/x) { } 0 15 15
elsif ($name =~ /\A (?: ARGV | ARGVOUT | ENV | INC | SIG | STDERR | STDIN | STDOUT ) \z/x) { } 0 15 15
elsif ($name =~ /\A [^ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz] \z/x) { } 0 15 15
elsif (defined $_[1]) { } 15 0 15
81 5 return $name;
82 }
83 elsif (Ewindows1258::index($name,'::') >= 0) {
84 0 return $name;
85 }
86 elsif (Ewindows1258::index($name,"'") >= 0) {
87 0 return $name;
88 }
89  
90 # special character, "^xyz"
91 elsif ($name =~ /\A \^ [ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]+ \z/x) {
92  
93 # RGS 2001-11-05 : translate leading ^X to control-char
94 0 $name =~ s{\A \^ ([ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]) }{'qq(\c'.$1.')'}xee;
95 0 return 'main::' . $name;
96 }
97  
98 # Global names
99 elsif ($name =~ /\A (?: ARGV | ARGVOUT | ENV | INC | SIG | STDERR | STDIN | STDOUT ) \z/x) {
100 0 return 'main::' . $name;
101 }
102  
103 # or other
104 elsif ($name =~ /\A [^ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz] \z/x) {
105 0 return 'main::' . $name;
106 }
107  
108 elsif (defined $_[1]) {
109 15 return $_[1] . '::' . $name;
110 }
111 else {
112 0 return (caller)[0] . '::' . $name;
113 }
114 }
115  
116 20 ▶ sub qualify_to_ref ($;$) {
Subroutine qualify_to_ref: called CC=2 SCAR=7.2
Pod undocumented
117 20 ▶ if (defined $_[1]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[1]) { } 20 0 20
118 424 ▶ no strict qw(refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
119 20 return \*{ qualify $_[0], $_[1] };
120 }
121 else {
122 424 ▶ no strict qw(refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: not called CC=1 SCAR=0.0
123 0 return \*{ qualify $_[0], (caller)[0] };
124 }
125 }
126 }
127  
128 # P.714 29.2.39. flock
129 # in Chapter 29: Functions
130 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
131  
132 # P.863 flock
133 # in Chapter 27: Functions
134 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
135  
136 sub LOCK_SH() {1}
137 sub LOCK_EX() {2}
138 sub LOCK_UN() {8}
139 sub LOCK_NB() {4}
140  
141 # instead of Carp.pm
142 sub carp;
143 sub croak;
144 sub cluck;
145 sub confess;
146  
147 # 6.18. Matching Multiple-Byte Characters
148 # in Chapter 6. Pattern Matching
149 # of ISBN 978-1-56592-243-3 Perl Perl Cookbook.
150 # (and so on)
151  
152 # regexp of character
153 424 my $your_char = q{[\x00-\xFF]};
154 424 ▶use vars qw($qq_char); $qq_char = qr/\\c[\x40-\x5F]|\\?(?:$your_char)/oxms;
Subroutine BEGIN: called CC=1 SCAR=0.0
155 424 ▶use vars qw($q_char); $q_char = qr/$your_char/oxms;
Subroutine BEGIN: called CC=1 SCAR=0.0
156  
157 #
158 # Windows-1258 character range per length
159 #
160 424 my %range_tr = ();
161  
162 #
163 # Windows-1258 case conversion
164 #
165 424 my %lc = ();
166 424 @lc{qw(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)} =
167 qw(a b c d e f g h i j k l m n o p q r s t u v w x y z);
168 424 my %uc = ();
169 424 @uc{qw(a b c d e f g h i j k l m n o p q r s t u v w x y z)} =
170 qw(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z);
171 424 my %fc = ();
172 424 @fc{qw(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)} =
173 qw(a b c d e f g h i j k l m n o p q r s t u v w x y z);
174  
175 424 ▶if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { __PACKAGE__ =~ / \b Ewindows1258 \z/mosx }) { } 424 0 424
176 }
177  
178 elsif (__PACKAGE__ =~ / \b Ewindows1258 \z/oxms) {
179 424 %range_tr = (
180 1 => [ [0x00..0xFF],
181 ],
182 );
183  
184 424 %lc = (%lc,
185 "\x8C" => "\x9C", # LATIN LIGATURE OE
186 "\x9F" => "\xFF", # LATIN LETTER Y WITH DIAERESIS
187 "\xC0" => "\xE0", # LATIN LETTER A WITH GRAVE
188 "\xC1" => "\xE1", # LATIN LETTER A WITH ACUTE
189 "\xC2" => "\xE2", # LATIN LETTER A WITH CIRCUMFLEX
190 "\xC3" => "\xE3", # LATIN LETTER A WITH BREVE
191 "\xC4" => "\xE4", # LATIN LETTER A WITH DIAERESIS
192 "\xC5" => "\xE5", # LATIN LETTER A WITH RING ABOVE
193 "\xC6" => "\xE6", # LATIN LETTER AE
194 "\xC7" => "\xE7", # LATIN LETTER C WITH CEDILLA
195 "\xC8" => "\xE8", # LATIN LETTER E WITH GRAVE
196 "\xC9" => "\xE9", # LATIN LETTER E WITH ACUTE
197 "\xCA" => "\xEA", # LATIN LETTER E WITH CIRCUMFLEX
198 "\xCB" => "\xEB", # LATIN LETTER E WITH DIAERESIS
199 "\xCD" => "\xED", # LATIN LETTER I WITH ACUTE
200 "\xCE" => "\xEE", # LATIN LETTER I WITH CIRCUMFLEX
201 "\xCF" => "\xEF", # LATIN LETTER I WITH DIAERESIS
202 "\xD0" => "\xF0", # LATIN LETTER D WITH STROKE
203 "\xD1" => "\xF1", # LATIN LETTER N WITH TILDE
204 "\xD3" => "\xF3", # LATIN LETTER O WITH ACUTE
205 "\xD4" => "\xF4", # LATIN LETTER O WITH CIRCUMFLEX
206 "\xD5" => "\xF5", # LATIN LETTER O WITH HORN
207 "\xD6" => "\xF6", # LATIN LETTER O WITH DIAERESIS
208 "\xD8" => "\xF8", # LATIN LETTER O WITH STROKE
209 "\xD9" => "\xF9", # LATIN LETTER U WITH GRAVE
210 "\xDA" => "\xFA", # LATIN LETTER U WITH ACUTE
211 "\xDB" => "\xFB", # LATIN LETTER U WITH CIRCUMFLEX
212 "\xDC" => "\xFC", # LATIN LETTER U WITH DIAERESIS
213 "\xDD" => "\xFD", # LATIN LETTER U WITH HORN
214 );
215  
216 424 %uc = (%uc,
217 "\x9C" => "\x8C", # LATIN LIGATURE OE
218 "\xFF" => "\x9F", # LATIN LETTER Y WITH DIAERESIS
219 "\xE0" => "\xC0", # LATIN LETTER A WITH GRAVE
220 "\xE1" => "\xC1", # LATIN LETTER A WITH ACUTE
221 "\xE2" => "\xC2", # LATIN LETTER A WITH CIRCUMFLEX
222 "\xE3" => "\xC3", # LATIN LETTER A WITH BREVE
223 "\xE4" => "\xC4", # LATIN LETTER A WITH DIAERESIS
224 "\xE5" => "\xC5", # LATIN LETTER A WITH RING ABOVE
225 "\xE6" => "\xC6", # LATIN LETTER AE
226 "\xE7" => "\xC7", # LATIN LETTER C WITH CEDILLA
227 "\xE8" => "\xC8", # LATIN LETTER E WITH GRAVE
228 "\xE9" => "\xC9", # LATIN LETTER E WITH ACUTE
229 "\xEA" => "\xCA", # LATIN LETTER E WITH CIRCUMFLEX
230 "\xEB" => "\xCB", # LATIN LETTER E WITH DIAERESIS
231 "\xED" => "\xCD", # LATIN LETTER I WITH ACUTE
232 "\xEE" => "\xCE", # LATIN LETTER I WITH CIRCUMFLEX
233 "\xEF" => "\xCF", # LATIN LETTER I WITH DIAERESIS
234 "\xF0" => "\xD0", # LATIN LETTER D WITH STROKE
235 "\xF1" => "\xD1", # LATIN LETTER N WITH TILDE
236 "\xF3" => "\xD3", # LATIN LETTER O WITH ACUTE
237 "\xF4" => "\xD4", # LATIN LETTER O WITH CIRCUMFLEX
238 "\xF5" => "\xD5", # LATIN LETTER O WITH HORN
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 U WITH HORN
246 );
247  
248 424 %fc = (%fc,
249 "\x8C" => "\x9C", # LATIN CAPITAL LIGATURE OE --> LATIN SMALL LIGATURE OE
250 "\x9F" => "\xFF", # LATIN CAPITAL LETTER Y WITH DIAERESIS --> LATIN SMALL LETTER Y WITH DIAERESIS
251 "\xC0" => "\xE0", # LATIN CAPITAL LETTER A WITH GRAVE --> LATIN SMALL LETTER A WITH GRAVE
252 "\xC1" => "\xE1", # LATIN CAPITAL LETTER A WITH ACUTE --> LATIN SMALL LETTER A WITH ACUTE
253 "\xC2" => "\xE2", # LATIN CAPITAL LETTER A WITH CIRCUMFLEX --> LATIN SMALL LETTER A WITH CIRCUMFLEX
254 "\xC3" => "\xE3", # LATIN CAPITAL LETTER A WITH BREVE --> LATIN SMALL LETTER A WITH BREVE
255 "\xC4" => "\xE4", # LATIN CAPITAL LETTER A WITH DIAERESIS --> LATIN SMALL LETTER A WITH DIAERESIS
256 "\xC5" => "\xE5", # LATIN CAPITAL LETTER A WITH RING ABOVE --> LATIN SMALL LETTER A WITH RING ABOVE
257 "\xC6" => "\xE6", # LATIN CAPITAL LETTER AE --> LATIN SMALL LETTER AE
258 "\xC7" => "\xE7", # LATIN CAPITAL LETTER C WITH CEDILLA --> LATIN SMALL LETTER C WITH CEDILLA
259 "\xC8" => "\xE8", # LATIN CAPITAL LETTER E WITH GRAVE --> LATIN SMALL LETTER E WITH GRAVE
260 "\xC9" => "\xE9", # LATIN CAPITAL LETTER E WITH ACUTE --> LATIN SMALL LETTER E WITH ACUTE
261 "\xCA" => "\xEA", # LATIN CAPITAL LETTER E WITH CIRCUMFLEX --> LATIN SMALL LETTER E WITH CIRCUMFLEX
262 "\xCB" => "\xEB", # LATIN CAPITAL LETTER E WITH DIAERESIS --> LATIN SMALL LETTER E WITH DIAERESIS
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 D WITH STROKE --> LATIN SMALL LETTER D WITH STROKE
267 "\xD1" => "\xF1", # LATIN CAPITAL LETTER N WITH TILDE --> LATIN SMALL LETTER N WITH TILDE
268 "\xD3" => "\xF3", # LATIN CAPITAL LETTER O WITH ACUTE --> LATIN SMALL LETTER O WITH ACUTE
269 "\xD4" => "\xF4", # LATIN CAPITAL LETTER O WITH CIRCUMFLEX --> LATIN SMALL LETTER O WITH CIRCUMFLEX
270 "\xD5" => "\xF5", # LATIN CAPITAL LETTER O WITH HORN --> LATIN SMALL LETTER O WITH HORN
271 "\xD6" => "\xF6", # LATIN CAPITAL LETTER O WITH DIAERESIS --> LATIN SMALL LETTER O WITH DIAERESIS
272 "\xD8" => "\xF8", # LATIN CAPITAL LETTER O WITH STROKE --> LATIN SMALL LETTER O WITH STROKE
273 "\xD9" => "\xF9", # LATIN CAPITAL LETTER U WITH GRAVE --> LATIN SMALL LETTER U WITH GRAVE
274 "\xDA" => "\xFA", # LATIN CAPITAL LETTER U WITH ACUTE --> LATIN SMALL LETTER U WITH ACUTE
275 "\xDB" => "\xFB", # LATIN CAPITAL LETTER U WITH CIRCUMFLEX --> LATIN SMALL LETTER U WITH CIRCUMFLEX
276 "\xDC" => "\xFC", # LATIN CAPITAL LETTER U WITH DIAERESIS --> LATIN SMALL LETTER U WITH DIAERESIS
277 "\xDD" => "\xFD", # LATIN CAPITAL LETTER U WITH HORN --> LATIN SMALL LETTER U WITH HORN
278 "\xDF" => "\x73\x73", # LATIN SMALL LETTER SHARP S --> LATIN SMALL LETTER S, LATIN SMALL LETTER S
279 );
280 }
281  
282 else {
283 0 croak "Don't know my package name '@{[__PACKAGE__]}'";
284 }
285  
286 #
287 # @ARGV wildcard globbing
288 #
289 212 ▶sub import {
Subroutine import: called CC=7 SCAR=28.3
290  
291 212 ▶ if ($^O =~ /\A (?: MSWin32 | NetWare | symbian | dos ) \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O =~ /\A (?: MSWin32 | NetWare | symbian | dos ) \z/mosx) 0 212 212
292 0 my @argv = ();
293 0 for (@ARGV) {
294  
295 # has space
296 0 ▶ if (/\A (?:$q_char)*? [ ] /oxms) {
Branch: 2 branches
BranchTrueFalseTotal
if (/\A (?:$Ewindows1258::q_char)*? [ ] /mosx) { } 0 0 0
elsif (/\A (?:$Ewindows1258::q_char)*? [*?] /mosx) { } 0 0 0
297 0 ▶ if (my @glob = Ewindows1258::glob(qq{"$_"})) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@glob) = &Ewindows1258::glob(qq["$_"])) { } 0 0 0
298 0 push @argv, @glob;
299 }
300 else {
301 0 push @argv, $_;
302 }
303 }
304  
305 # has wildcard metachar
306 elsif (/\A (?:$q_char)*? [*?] /oxms) {
307 0 ▶ if (my @glob = Ewindows1258::glob($_)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@glob) = &Ewindows1258::glob($_)) { } 0 0 0
308 0 push @argv, @glob;
309 }
310 else {
311 0 push @argv, $_;
312 }
313 }
314  
315 # no wildcard globbing
316 else {
317 0 push @argv, $_;
318 }
319 }
320 0 @ARGV = @argv;
321 }
322  
323 212 *Char::ord = \&Windows1258::ord;
324 212 *Char::ord_ = \&Windows1258::ord_;
325 212 *Char::reverse = \&Windows1258::reverse;
326 212 *Char::getc = \&Windows1258::getc;
327 212 *Char::length = \&Windows1258::length;
328 212 *Char::substr = \&Windows1258::substr;
329 212 *Char::index = \&Windows1258::index;
330 212 *Char::rindex = \&Windows1258::rindex;
331 212 *Char::eval = \&Windows1258::eval;
332 212 *Char::escape = \&Windows1258::escape;
333 212 *Char::escape_token = \&Windows1258::escape_token;
334 212 *Char::escape_script = \&Windows1258::escape_script;
335 }
336  
337 # P.230 Care with Prototypes
338 # in Chapter 6: Subroutines
339 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
340 #
341 # If you aren't careful, you can get yourself into trouble with prototypes.
342 # But if you are careful, you can do a lot of neat things with them. This is
343 # all very powerful, of course, and should only be used in moderation to make
344 # the world a better place.
345  
346 # P.332 Care with Prototypes
347 # in Chapter 7: Subroutines
348 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
349 #
350 # If you aren't careful, you can get yourself into trouble with prototypes.
351 # But if you are careful, you can do a lot of neat things with them. This is
352 # all very powerful, of course, and should only be used in moderation to make
353 # the world a better place.
354  
355 #
356 # Prototypes of subroutines
357 #
358 0 ▶sub unimport {}
Subroutine unimport: not called CC=1 SCAR=0.0
359 sub Ewindows1258::split(;$$$);
360 sub Ewindows1258::tr($$$$;$);
361 sub Ewindows1258::chop(@);
362 sub Ewindows1258::index($$;$);
363 sub Ewindows1258::rindex($$;$);
364 sub Ewindows1258::lcfirst(@);
365 sub Ewindows1258::lcfirst_();
366 sub Ewindows1258::lc(@);
367 sub Ewindows1258::lc_();
368 sub Ewindows1258::ucfirst(@);
369 sub Ewindows1258::ucfirst_();
370 sub Ewindows1258::uc(@);
371 sub Ewindows1258::uc_();
372 sub Ewindows1258::fc(@);
373 sub Ewindows1258::fc_();
374 sub Ewindows1258::ignorecase;
375 sub Ewindows1258::classic_character_class;
376 sub Ewindows1258::capture;
377 sub Ewindows1258::chr(;$);
378 sub Ewindows1258::chr_();
379 sub Ewindows1258::glob($);
380 sub Ewindows1258::glob_();
381  
382 sub Windows1258::ord(;$);
383 sub Windows1258::ord_();
384 sub Windows1258::reverse(@);
385 sub Windows1258::getc(;*@);
386 sub Windows1258::length(;$);
387 sub Windows1258::substr($$;$$);
388 sub Windows1258::index($$;$);
389 sub Windows1258::rindex($$;$);
390 sub Windows1258::escape(;$);
391  
392 #
393 # Regexp work
394 #
395 424 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
396 $re_a
397 $re_t
398 $re_n
399 $re_r
400 424 );
401  
402 #
403 # Character class
404 #
405 424 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
406 $dot
407 $dot_s
408 $eD
409 $eS
410 $eW
411 $eH
412 $eV
413 $eR
414 $eN
415 $not_alnum
416 $not_alpha
417 $not_ascii
418 $not_blank
419 $not_cntrl
420 $not_digit
421 $not_graph
422 $not_lower
423 $not_lower_i
424 $not_print
425 $not_punct
426 $not_space
427 $not_upper
428 $not_upper_i
429 $not_word
430 $not_xdigit
431 $eb
432 $eB
433 424 );
434  
435 424 ${Ewindows1258::dot} = qr{(?>[^\x0A])};
436 424 ${Ewindows1258::dot_s} = qr{(?>[\x00-\xFF])};
437 424 ${Ewindows1258::eD} = qr{(?>[^0-9])};
438  
439 # Vertical tabs are now whitespace
440 # \s in a regex now matches a vertical tab in all circumstances.
441 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
442 # ${Ewindows1258::eS} = qr{(?>[^\x09\x0A \x0C\x0D\x20])};
443 # ${Ewindows1258::eS} = qr{(?>[^\x09\x0A\x0B\x0C\x0D\x20])};
444 424 ${Ewindows1258::eS} = qr{(?>[^\s])};
445  
446 424 ${Ewindows1258::eW} = qr{(?>[^0-9A-Z_a-z])};
447 424 ${Ewindows1258::eH} = qr{(?>[^\x09\x20])};
448 424 ${Ewindows1258::eV} = qr{(?>[^\x0A\x0B\x0C\x0D])};
449 424 ${Ewindows1258::eR} = qr{(?>\x0D\x0A|[\x0A\x0D])};
450 424 ${Ewindows1258::eN} = qr{(?>[^\x0A])};
451 424 ${Ewindows1258::not_alnum} = qr{(?>[^\x30-\x39\x41-\x5A\x61-\x7A])};
452 424 ${Ewindows1258::not_alpha} = qr{(?>[^\x41-\x5A\x61-\x7A])};
453 424 ${Ewindows1258::not_ascii} = qr{(?>[^\x00-\x7F])};
454 424 ${Ewindows1258::not_blank} = qr{(?>[^\x09\x20])};
455 424 ${Ewindows1258::not_cntrl} = qr{(?>[^\x00-\x1F\x7F])};
456 424 ${Ewindows1258::not_digit} = qr{(?>[^\x30-\x39])};
457 424 ${Ewindows1258::not_graph} = qr{(?>[^\x21-\x7F])};
458 424 ${Ewindows1258::not_lower} = qr{(?>[^\x61-\x7A])};
459 424 ${Ewindows1258::not_lower_i} = qr{(?>[^\x41-\x5A\x61-\x7A])}; # Perl 5.16 compatible
460 # ${Ewindows1258::not_lower_i} = qr{(?>[\x00-\xFF])}; # older Perl compatible
461 424 ${Ewindows1258::not_print} = qr{(?>[^\x20-\x7F])};
462 424 ${Ewindows1258::not_punct} = qr{(?>[^\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E])};
463 424 ${Ewindows1258::not_space} = qr{(?>[^\s\x0B])};
464 424 ${Ewindows1258::not_upper} = qr{(?>[^\x41-\x5A])};
465 424 ${Ewindows1258::not_upper_i} = qr{(?>[^\x41-\x5A\x61-\x7A])}; # Perl 5.16 compatible
466 # ${Ewindows1258::not_upper_i} = qr{(?>[\x00-\xFF])}; # older Perl compatible
467 424 ${Ewindows1258::not_word} = qr{(?>[^\x30-\x39\x41-\x5A\x5F\x61-\x7A])};
468 424 ${Ewindows1258::not_xdigit} = qr{(?>[^\x30-\x39\x41-\x46\x61-\x66])};
469 424 ${Ewindows1258::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))};
470 424 ${Ewindows1258::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]))};
471  
472 # avoid: Name "Ewindows1258::foo" used only once: possible typo at here.
473 424 ${Ewindows1258::dot} = ${Ewindows1258::dot};
474 424 ${Ewindows1258::dot_s} = ${Ewindows1258::dot_s};
475 424 ${Ewindows1258::eD} = ${Ewindows1258::eD};
476 424 ${Ewindows1258::eS} = ${Ewindows1258::eS};
477 424 ${Ewindows1258::eW} = ${Ewindows1258::eW};
478 424 ${Ewindows1258::eH} = ${Ewindows1258::eH};
479 424 ${Ewindows1258::eV} = ${Ewindows1258::eV};
480 424 ${Ewindows1258::eR} = ${Ewindows1258::eR};
481 424 ${Ewindows1258::eN} = ${Ewindows1258::eN};
482 424 ${Ewindows1258::not_alnum} = ${Ewindows1258::not_alnum};
483 424 ${Ewindows1258::not_alpha} = ${Ewindows1258::not_alpha};
484 424 ${Ewindows1258::not_ascii} = ${Ewindows1258::not_ascii};
485 424 ${Ewindows1258::not_blank} = ${Ewindows1258::not_blank};
486 424 ${Ewindows1258::not_cntrl} = ${Ewindows1258::not_cntrl};
487 424 ${Ewindows1258::not_digit} = ${Ewindows1258::not_digit};
488 424 ${Ewindows1258::not_graph} = ${Ewindows1258::not_graph};
489 424 ${Ewindows1258::not_lower} = ${Ewindows1258::not_lower};
490 424 ${Ewindows1258::not_lower_i} = ${Ewindows1258::not_lower_i};
491 424 ${Ewindows1258::not_print} = ${Ewindows1258::not_print};
492 424 ${Ewindows1258::not_punct} = ${Ewindows1258::not_punct};
493 424 ${Ewindows1258::not_space} = ${Ewindows1258::not_space};
494 424 ${Ewindows1258::not_upper} = ${Ewindows1258::not_upper};
495 424 ${Ewindows1258::not_upper_i} = ${Ewindows1258::not_upper_i};
496 424 ${Ewindows1258::not_word} = ${Ewindows1258::not_word};
497 424 ${Ewindows1258::not_xdigit} = ${Ewindows1258::not_xdigit};
498 424 ${Ewindows1258::eb} = ${Ewindows1258::eb};
499 424 ${Ewindows1258::eB} = ${Ewindows1258::eB};
500  
501 #
502 # Windows-1258 split
503 #
504 72 ▶sub Ewindows1258::split(;$$$) {
Subroutine split: called CC=34 SCAR=38.5
Pod undocumented
505  
506 # P.794 29.2.161. split
507 # in Chapter 29: Functions
508 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
509  
510 # P.951 split
511 # in Chapter 27: Functions
512 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
513  
514 72 my $pattern = $_[0];
515 72 my $string = $_[1];
516 72 my $limit = $_[2];
517  
518 # if $pattern is also omitted or is the literal space, " "
519 72 ▶ if (not defined $pattern) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $pattern) 2 70 72
520 2 $pattern = ' ';
521 }
522  
523 # if $string is omitted, the function splits the $_ string
524 72 ▶ if (not defined $string) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $string) 6 66 72
525 6 ▶ if (defined $_) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_) { } 0 6 6
526 0 $string = $_;
527 }
528 else {
529 6 $string = '';
530 }
531 }
532  
533 72 my @split = ();
534  
535 # when string is empty
536 72 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 10 62 72
elsif ($pattern eq ' ') { } 2 60 62
537  
538 # resulting list value in list context
539 10 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 5 5 10
540 5 return @split;
541 }
542  
543 # count of substrings in scalar context
544 else {
545 5 ▶ carp "Use of implicit split to \@_ is deprecated" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 5 5
546 5 @_ = @split;
547 5 return scalar @_;
548 }
549 }
550  
551 # split's first argument is more consistently interpreted
552 #
553 # After some changes earlier in v5.17, split's behavior has been simplified:
554 # if the PATTERN argument evaluates to a string containing one space, it is
555 # treated the way that a literal string containing one space once was.
556 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#split's_first_argument_is_more_consistently_interpreted
557  
558 # if $pattern is also omitted or is the literal space, " ", the function splits
559 # on whitespace, /\s+/, after skipping any leading whitespace
560 # (and so on)
561  
562 elsif ($pattern eq ' ') {
563 2 ▶ if (not defined $limit) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $limit) { } 2 0 2
564 2 return CORE::split(' ', $string);
565 }
566 else {
567 0 return CORE::split(' ', $string, $limit);
568 }
569 }
570  
571 # if $limit is negative, it is treated as if an arbitrarily large $limit has been specified
572 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
573  
574 # a pattern capable of matching either the null string or something longer than the
575 # null string will split the value of $string into separate characters wherever it
576 # matches the null string between characters
577 # (and so on)
578  
579 60 ▶ if ('' =~ / \A $pattern \z /xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ('' =~ / \A $pattern \z /msx) { } 2 58 60
580 2 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
581 2 my $limit = scalar(() = $string =~ /($pattern)/oxmsg);
582  
583 # P.1024 Appendix W.10 Multibyte Processing
584 # of ISBN 1-56592-224-7 CJKV Information Processing
585 # (and so on)
586  
587 # the //m modifier is assumed when you split on the pattern /^/
588 # (and so on)
589  
590 2 ▶ eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
Subroutine BEGIN: called CC=1 SCAR=0.0
591 # V
592 2 ▶ while ((--$limit > 0) and ($string =~ s/\A((?:$q_char)+?)$pattern//m)) {
Branch: 1 branch
BranchTrueFalseTotal
if (--$limit > 0 and $string =~ s/\A((?:$Ewindows1258::q_char)+?)$pattern//m) 9 2 11
Condition100%3/3
--$limit > 0 and $string =~ s/\A((?:$Ewindows1258::q_char)+?)$pattern//m
!ll&&!rl&&r
119
MC/DC100%2/2
--$limit > 0 and $string =~ s/\A((?:$Ewindows1258::q_char)+?)$pattern//m
--$limit > 0 $string =~ s/\A((?:$Ewindows1258::q_char)+?)$pattern//m
Truth table100%3/3
A and B
A= --$limit > 0B= $string =~ s/\A((?:$Ewindows1258::q_char)+?)$pattern//m
ABresult
0X0
100
111
593  
594 # if the $pattern contains parentheses, then the substring matched by each pair of parentheses
595 # is included in the resulting list, interspersed with the fields that are ordinarily returned
596 # (and so on)
597  
598 9 local $@;
599 9 ▶ eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
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 58 ▶ eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
610 # V
611 58 ▶ while ($string =~ s/\A((?:$q_char)*?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Ewindows1258::q_char)*?)$pattern//m) 163 58 221
612 163 local $@;
613 163 ▶ eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
614 163 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 230 163 393
615 230 push @split, CORE::eval('$' . $digit);
616 }
617 }
618 }
619 }
620  
621 elsif ($limit > 0) {
622 0 ▶ if ('' =~ / \A $pattern \z /xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ('' =~ / \A $pattern \z /msx) { } 0 0 0
623 0 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
624 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
625  
626 0 eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
627 # V
628 0 ▶ if ($string =~ s/\A((?:$q_char)+?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Ewindows1258::q_char)+?)$pattern//m) 0 0 0
629 0 local $@;
630 0 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 0 0 0
631 0 push @split, CORE::eval('$' . $digit);
632 }
633 }
634 }
635 }
636 else {
637 0 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
638 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
639  
640 0 eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
641 # V
642 0 ▶ if ($string =~ s/\A((?:$q_char)*?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Ewindows1258::q_char)*?)$pattern//m) 0 0 0
643 0 local $@;
644 0 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 0 0 0
645 0 push @split, CORE::eval('$' . $digit);
646 }
647 }
648 }
649 }
650 }
651  
652 60 ▶ if (CORE::length($string) > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $string > 0) 58 2 60
653 58 push @split, $string;
654 }
655  
656 # if $_[2] (NOT "$limit") is omitted or zero, trailing null fields are stripped from the result
657 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
658 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
659 0 pop @split;
660 }
661 }
662  
663 # resulting list value in list context
664 60 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 58 2 60
665 58 return @split;
666 }
667  
668 # count of substrings in scalar context
669 else {
670 2 ▶ carp "Use of implicit split to \@_ is deprecated" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 2 2
671 2 @_ = @split;
672 2 return scalar @_;
673 }
674 }
675  
676 #
677 # get last subexpression offsets
678 #
679 60 ▶sub _last_subexpression_offsets {
Subroutine _last_subexpression_offsets: called CC=3 SCAR=11.0
680 60 my $pattern = $_[0];
681  
682 # remove comment
683 60 $pattern =~ s/\(\?\# .*? \)//oxmsg;
684  
685 60 my $modifier = '';
686 60 ▶ if ($pattern =~ /\(\?\^? ([\-A-Za-z]+) :/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pattern =~ /\(\?\^? ([\-A-Za-z]+) :/mosx) 11 49 60
687 11 $modifier = $1;
688 11 $modifier =~ s/-[A-Za-z]*//;
689 }
690  
691 # with /x modifier
692 60 my @char = ();
693 60 ▶ if ($modifier =~ /x/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /x/mosx) { } 5 55 60
694 5 @char = $pattern =~ /\G((?>
695 [^\\\#\[\(] |
696 \\ $q_char |
697 \# (?>[^\n]*) $ |
698 \[ (?>(?:[^\\\]]|\\\\|\\\]|$q_char)+) \] |
699 \(\? |
700 $q_char
701 ))/oxmsg;
702 }
703  
704 # without /x modifier
705 else {
706 55 @char = $pattern =~ /\G((?>
707 [^\\\[\(] |
708 \\ $q_char |
709 \[ (?>(?:[^\\\]]|\\\\|\\\]|$q_char)+) \] |
710 \(\? |
711 $q_char
712 ))/oxmsg;
713 }
714  
715 60 return scalar grep { $_ eq '(' } @char;
716 }
717  
718 #
719 # Windows-1258 transliteration (tr///)
720 #
721 6 ▶sub Ewindows1258::tr($$$$;$) {
Subroutine tr: called CC=26 SCAR=48.6
Pod undocumented
722  
723 6 my $bind_operator = $_[1];
724 6 my $searchlist = $_[2];
725 6 my $replacementlist = $_[3];
726 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
727  
728 6 ▶ if ($modifier =~ /r/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /r/mosx) 5 1 6
729 5 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) 0 5 5
730 0 croak "Using !~ with tr///r doesn't make sense";
731 }
732 }
733  
734 6 my @char = $_[0] =~ /\G (?>$q_char) /oxmsg;
735 6 my @searchlist = _charlist_tr($searchlist);
736 6 my @replacementlist = _charlist_tr($replacementlist);
737  
738 6 my %tr = ();
739 6 ▶ for (my $i=0; $i <= $#searchlist; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#searchlist) 19 6 25
740 19 ▶ if (not exists $tr{$searchlist[$i]}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $tr{$searchlist[$i]}) 19 0 19
741 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
742 19 $tr{$searchlist[$i]} = $replacementlist[$i];
743 }
744 elsif ($modifier =~ /d/oxms) {
745 0 $tr{$searchlist[$i]} = '';
746 }
747 ▶ 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
748 0 $tr{$searchlist[$i]} = $replacementlist[-1];
749 }
750 else {
751 0 $tr{$searchlist[$i]} = $searchlist[$i];
752 }
753 }
754 }
755  
756 6 my $tr = 0;
757 6 my $replaced = '';
758 6 ▶ if ($modifier =~ /c/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /c/mosx) { } 0 6 6
759 0 ▶ while (defined(my $char = shift @char)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $char = shift @char)) 0 0 0
760 0 ▶ if (not exists $tr{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $tr{$char}) { } 0 0 0
761 0 ▶ if (defined $replacementlist[-1]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $replacementlist[-1]) 0 0 0
762 0 $replaced .= $replacementlist[-1];
763 }
764 0 $tr++;
765 0 ▶ if ($modifier =~ /s/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/mosx) 0 0 0
766 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
767 0 shift @char;
768 0 $tr++;
769 }
770 }
771 }
772 else {
773 0 $replaced .= $char;
774 }
775 }
776 }
777 else {
778 6 ▶ while (defined(my $char = shift @char)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $char = shift @char)) 36 6 42
779 36 ▶ if (exists $tr{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $tr{$char}) { } 19 17 36
780 19 $replaced .= $tr{$char};
781 19 $tr++;
782 19 ▶ if ($modifier =~ /s/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/mosx) 0 19 19
783 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
784 0 shift @char;
785 0 $tr++;
786 }
787 }
788 }
789 else {
790 17 $replaced .= $char;
791 }
792 }
793 }
794  
795 6 ▶ if ($modifier =~ /r/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /r/mosx) { } 5 1 6
796 5 return $replaced;
797 }
798 else {
799 1 $_[0] = $replaced;
800 1 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) { } 0 1 1
801 0 return not $tr;
802 }
803 else {
804 1 return $tr;
805 }
806 }
807 }
808  
809 #
810 # Windows-1258 chop
811 #
812 0 ▶sub Ewindows1258::chop(@) {
Subroutine chop: not called CC=3 SCAR=24.8
Pod undocumented
813  
814 0 my $chop;
815 0 ▶ if (@_ == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 0) { } 0 0 0
816 0 my @char = /\G (?>$q_char) /oxmsg;
817 0 $chop = pop @char;
818 0 $_ = join '', @char;
819 }
820 else {
821 0 for (@_) {
822 0 my @char = /\G (?>$q_char) /oxmsg;
823 0 $chop = pop @char;
824 0 $_ = join '', @char;
825 }
826 }
827 0 return $chop;
828 }
829  
830 #
831 # Windows-1258 index by octet
832 #
833 30 ▶sub Ewindows1258::index($$;$) {
Subroutine index: called CC=6 SCAR=20.8
Pod documented
834  
835 30 my($str,$substr,$position) = @_;
836 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
837 30 my $pos = 0;
838  
839 30 ▶ while ($pos < CORE::length($str)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos < length $str) 130 30 160
840 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
841 0 ▶ if ($pos >= $position) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos >= $position) 0 0 0
842 0 return $pos;
843 }
844 }
845 130 ▶ if (CORE::substr($str,$pos) =~ /\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($str, $pos) =~ /\A ($Ewindows1258::q_char) /mosx) { } 130 0 130
846 130 $pos += CORE::length($1);
847 }
848 else {
849 0 $pos += 1;
850 }
851 }
852 30 return -1;
853 }
854  
855 #
856 # Windows-1258 reverse index
857 #
858 0 ▶sub Ewindows1258::rindex($$;$) {
Subroutine rindex: not called CC=6 SCAR=37.4
Pod undocumented
859  
860 0 my($str,$substr,$position) = @_;
861 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
862 0 my $pos = 0;
863 0 my $rindex = -1;
864  
865 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
866 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
867 0 $rindex = $pos;
868 }
869 0 ▶ if (CORE::substr($str,$pos) =~ /\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($str, $pos) =~ /\A ($Ewindows1258::q_char) /mosx) { } 0 0 0
870 0 $pos += CORE::length($1);
871 }
872 else {
873 0 $pos += 1;
874 }
875 }
876 0 return $rindex;
877 }
878  
879 #
880 # Windows-1258 lower case first with parameter
881 #
882 0 ▶sub Ewindows1258::lcfirst(@) {
Subroutine lcfirst: not called CC=4 SCAR=30.0
Pod undocumented
883 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
884 0 my $s = shift @_;
885 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
886 0 return Ewindows1258::lc(CORE::substr($s,0,1)) . CORE::substr($s,1), @_;
887 }
888 else {
889 0 return Ewindows1258::lc(CORE::substr($s,0,1)) . CORE::substr($s,1);
890 }
891 }
892 else {
893 0 return Ewindows1258::lc(CORE::substr($_,0,1)) . CORE::substr($_,1);
894 }
895 }
896  
897 #
898 # Windows-1258 lower case first without parameter
899 #
900 0 ▶sub Ewindows1258::lcfirst_() {
Subroutine lcfirst_: not called CC=1 SCAR=6.9
Pod undocumented
901 0 return Ewindows1258::lc(CORE::substr($_,0,1)) . CORE::substr($_,1);
902 }
903  
904 #
905 # Windows-1258 lower case with parameter
906 #
907 56 ▶sub Ewindows1258::lc(@) {
Subroutine lc: called CC=6 SCAR=24.2
Pod undocumented
908 56 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 56 0 56
909 56 my $s = shift @_;
910 56 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 56 56
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
5600
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
911 0 ▶ return join('', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 0 0 0
912 }
913 else {
914 56 ▶ return join('', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 58 0 58
915 }
916 }
917 else {
918 0 return Ewindows1258::lc_();
919 }
920 }
921  
922 #
923 # Windows-1258 lower case without parameter
924 #
925 0 ▶sub Ewindows1258::lc_() {
Subroutine lc_: not called CC=2 SCAR=17.9
Pod undocumented
926 0 my $s = $_;
927 0 ▶ return join '', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 0 0 0
928 }
929  
930 #
931 # Windows-1258 upper case first with parameter
932 #
933 0 ▶sub Ewindows1258::ucfirst(@) {
Subroutine ucfirst: not called CC=4 SCAR=30.0
Pod undocumented
934 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
935 0 my $s = shift @_;
936 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
937 0 return Ewindows1258::uc(CORE::substr($s,0,1)) . CORE::substr($s,1), @_;
938 }
939 else {
940 0 return Ewindows1258::uc(CORE::substr($s,0,1)) . CORE::substr($s,1);
941 }
942 }
943 else {
944 0 return Ewindows1258::uc(CORE::substr($_,0,1)) . CORE::substr($_,1);
945 }
946 }
947  
948 #
949 # Windows-1258 upper case first without parameter
950 #
951 0 ▶sub Ewindows1258::ucfirst_() {
Subroutine ucfirst_: not called CC=1 SCAR=6.9
Pod undocumented
952 0 return Ewindows1258::uc(CORE::substr($_,0,1)) . CORE::substr($_,1);
953 }
954  
955 #
956 # Windows-1258 upper case with parameter
957 #
958 2368 ▶sub Ewindows1258::uc(@) {
Subroutine uc: called CC=6 SCAR=22.9
Pod undocumented
959 2368 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2368 0 2368
960 2368 my $s = shift @_;
961 2368 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 2368 2368
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
236800
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
962 0 ▶ return join('', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 0 0 0
963 }
964 else {
965 2368 ▶ return join('', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 847 1523 2370
966 }
967 }
968 else {
969 0 return Ewindows1258::uc_();
970 }
971 }
972  
973 #
974 # Windows-1258 upper case without parameter
975 #
976 0 ▶sub Ewindows1258::uc_() {
Subroutine uc_: not called CC=2 SCAR=17.9
Pod undocumented
977 0 my $s = $_;
978 0 ▶ return join '', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 0 0 0
979 }
980  
981 #
982 # Windows-1258 fold case with parameter
983 #
984 2383 ▶sub Ewindows1258::fc(@) {
Subroutine fc: called CC=6 SCAR=22.9
Pod undocumented
985 2383 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2383 0 2383
986 2383 my $s = shift @_;
987 2383 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 2383 2383
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
238300
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
988 0 ▶ return join('', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 0 0 0
989 }
990 else {
991 2383 ▶ return join('', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 1737 5363 7100
992 }
993 }
994 else {
995 0 return Ewindows1258::fc_();
996 }
997 }
998  
999 #
1000 # Windows-1258 fold case without parameter
1001 #
1002 0 ▶sub Ewindows1258::fc_() {
Subroutine fc_: not called CC=2 SCAR=17.9
Pod undocumented
1003 0 my $s = $_;
1004 0 ▶ return join '', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 0 0 0
1005 }
1006  
1007 #
1008 # Windows-1258 regexp capture
1009 #
1010 {
1011 0 ▶ sub Ewindows1258::capture {
Subroutine capture: not called CC=1 SCAR=6.9
Pod documented
1012 0 return $_[0];
1013 }
1014 }
1015  
1016 #
1017 # Windows-1258 regexp ignore case modifier
1018 #
1019 424 ▶sub Ewindows1258::ignorecase {
Subroutine ignorecase: called CC=25 SCAR=52.1
Pod undocumented
1020  
1021 11 my @string = @_;
1022 11 my $metachar = qr/[\@\\|[\]{]/oxms;
1023  
1024 # ignore case of $scalar or @array
1025 11 for my $string (@string) {
1026  
1027 # split regexp
1028 11 my @char = $string =~ /\G (?>\[\^|\\$q_char|$q_char) /oxmsg;
1029  
1030 # unescape character
1031 11 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 908 11 919
1032 908 ▶ next if not defined $char[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $char[$i] 0 908 908
1033  
1034 # open character class [...]
1035 908 ▶ if ($char[$i] eq '[') {
Branch: 4 branches
BranchTrueFalseTotal
if ($char[$i] eq '[') { } 0 908 908
elsif ($char[$i] eq '[^') { } 0 908 908
elsif (my $char = classic_character_class($char[$i])) { } 0 908 908
elsif ($char[$i] =~ /\A [\x00-\xFF] \z/mosx) { } 908 0 908
1036 0 my $left = $i;
1037  
1038 # [] make die "unmatched [] in regexp ...\n"
1039  
1040 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
1041 0 $i++;
1042 }
1043  
1044 0 while (1) {
1045 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
1046 0 croak "Unmatched [] in regexp";
1047 }
1048 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
1049 0 my $right = $i;
1050 0 my @charlist = charlist_qr(@char[$left+1..$right-1], 'i');
1051  
1052 # escape character
1053 0 for my $char (@charlist) {
1054 0 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $char =~ /\A [.|)] \z/mosx }) 0 0 0
1055 }
1056  
1057 0 elsif ($char =~ /\A [.|)] \z/oxms) {
1058 0 $char = '\\' . $char;
1059 }
1060 }
1061  
1062 # [...]
1063 0 splice @char, $left, $right-$left+1, '(?:' . join('|', @charlist) . ')';
1064  
1065 0 $i = $left;
1066 0 last;
1067 }
1068 }
1069 }
1070  
1071 # open character class [^...]
1072 elsif ($char[$i] eq '[^') {
1073 0 my $left = $i;
1074  
1075 # [^] make die "unmatched [] in regexp ...\n"
1076  
1077 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
1078 0 $i++;
1079 }
1080  
1081 0 while (1) {
1082 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
1083 0 croak "Unmatched [] in regexp";
1084 }
1085 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
1086 0 my $right = $i;
1087 0 my @charlist = charlist_not_qr(@char[$left+1..$right-1], 'i');
1088  
1089 # escape character
1090 0 for my $char (@charlist) {
1091 0 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $char =~ /\A [.|)] \z/mosx }) 0 0 0
1092 }
1093  
1094 0 elsif ($char =~ /\A [.|)] \z/oxms) {
1095 0 $char = '\\' . $char;
1096 }
1097 }
1098  
1099 # [^...]
1100 0 splice @char, $left, $right-$left+1, '(?!' . join('|', @charlist) . ")(?:$your_char)";
1101  
1102 0 $i = $left;
1103 0 last;
1104 }
1105 }
1106 }
1107  
1108 # rewrite classic character class or escape character
1109 elsif (my $char = classic_character_class($char[$i])) {
1110 0 $char[$i] = $char;
1111 }
1112  
1113 # with /i modifier
1114 elsif ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) {
1115 908 my $uc = Ewindows1258::uc($char[$i]);
1116 908 my $fc = Ewindows1258::fc($char[$i]);
1117 908 ▶ if ($uc ne $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc ne $fc) 468 440 908
1118 468 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 465 3 468
1119 465 $char[$i] = '[' . $uc . $fc . ']';
1120 }
1121 else {
1122 3 $char[$i] = '(?:' . $uc . '|' . $fc . ')';
1123 }
1124 }
1125 }
1126 }
1127  
1128 # characterize
1129 11 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 908 11 919
1130 908 ▶ next if not defined $char[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $char[$i] 0 908 908
1131  
1132 908 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx }) 0 919 919
1133 }
1134  
1135 # quote character before ? + * {
1136 0 ▶ elsif (($i >= 1) and ($char[$i] =~ /\A [\?\+\*\{] \z/oxms)) {
Condition66%2/3
$i >= 1 && $char[$i] =~ /\A [\?\+\*\{] \z/mosx
!ll&&!rl&&r
118970
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
1137 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
1138 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
1139 }
1140 }
1141 }
1142  
1143 11 $string = join '', @char;
1144 }
1145  
1146 # make regexp string
1147 11 return @string;
1148 }
1149  
1150 #
1151 # classic character class ( \D \S \W \d \s \w \C \X \H \V \h \v \R \N \b \B )
1152 #
1153 2776 ▶sub Ewindows1258::classic_character_class {
Subroutine classic_character_class: called CC=2 SCAR=6.9
Pod undocumented
1154 2776 my($char) = @_;
1155  
1156 return {
1157 '\D' => '${Ewindows1258::eD}',
1158 '\S' => '${Ewindows1258::eS}',
1159 '\W' => '${Ewindows1258::eW}',
1160 '\d' => '[0-9]',
1161  
1162 # Before Perl 5.6, \s only matched the five whitespace characters
1163 # tab, newline, form-feed, carriage return, and the space character
1164 # itself, which, taken together, is the character class [\t\n\f\r ].
1165  
1166 # Vertical tabs are now whitespace
1167 # \s in a regex now matches a vertical tab in all circumstances.
1168 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
1169 # \t \n \v \f \r space
1170 # '\s' => '[\x09\x0A \x0C\x0D\x20]',
1171 # '\s' => '[\x09\x0A\x0B\x0C\x0D\x20]',
1172 '\s' => '\s',
1173  
1174 '\w' => '[0-9A-Z_a-z]',
1175 '\C' => '[\x00-\xFF]',
1176 '\X' => 'X',
1177  
1178 # \h \v \H \V
1179  
1180 # P.114 Character Class Shortcuts
1181 # in Chapter 7: In the World of Regular Expressions
1182 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
1183  
1184 # P.357 13.2.3 Whitespace
1185 # in Chapter 13: perlrecharclass: Perl Regular Expression Character Classes
1186 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
1187 #
1188 # 0x00009 CHARACTER TABULATION h s
1189 # 0x0000a LINE FEED (LF) vs
1190 # 0x0000b LINE TABULATION v
1191 # 0x0000c FORM FEED (FF) vs
1192 # 0x0000d CARRIAGE RETURN (CR) vs
1193 # 0x00020 SPACE h s
1194  
1195 # P.196 Table 5-9. Alphanumeric regex metasymbols
1196 # in Chapter 5. Pattern Matching
1197 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1198  
1199 # (and so on)
1200  
1201 '\H' => '${Ewindows1258::eH}',
1202 '\V' => '${Ewindows1258::eV}',
1203 '\h' => '[\x09\x20]',
1204 '\v' => '[\x0A\x0B\x0C\x0D]',
1205 '\R' => '${Ewindows1258::eR}',
1206  
1207 # \N
1208 #
1209 # http://perldoc.perl.org/perlre.html
1210 # Character Classes and other Special Escapes
1211 # Any character but \n (experimental). Not affected by /s modifier
1212  
1213 '\N' => '${Ewindows1258::eN}',
1214  
1215 # \b \B
1216  
1217 # P.180 Boundaries: The \b and \B Assertions
1218 # in Chapter 5: Pattern Matching
1219 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
1220  
1221 # P.219 Boundaries: The \b and \B Assertions
1222 # in Chapter 5: Pattern Matching
1223 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1224  
1225 # \b really means (?:(?<=\w)(?!\w)|(?<!\w)(?=\w))
1226 # or (?:(?<=\A|\W)(?=\w)|(?<=\w)(?=\W|\z))
1227 '\b' => '${Ewindows1258::eb}',
1228  
1229 # \B really means (?:(?<=\w)(?=\w)|(?<!\w)(?!\w))
1230 # or (?:(?<=\w)(?=\w)|(?<=\W)(?=\W))
1231 '\B' => '${Ewindows1258::eB}',
1232  
1233 2776 ▶ }->{$char} || '';
Condition100%2/2
{'\\D', '${Ewindows1258::eD}', '\\S', '${Ewindows1258::eS}', '\\W', '${Ewindows1258::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Ewindows1258::eH}', '\\V', '${Ewindows1258::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Ewindows1258::eR}', '\\N', '${Ewindows1258::eN}', '\\b', '${Ewindows1258::eb}', '\\B', '${Ewindows1258::eB}'}->{$char} || ''
l!l
1012675
MC/DC100%1/1
{'\\D', '${Ewindows1258::eD}', '\\S', '${Ewindows1258::eS}', '\\W', '${Ewindows1258::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Ewindows1258::eH}', '\\V', '${Ewindows1258::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Ewindows1258::eR}', '\\N', '${Ewindows1258::eN}', '\\b', '${Ewindows1258::eb}', '\\B', '${Ewindows1258::eB}'}->{$char} || ''
{'\\D', '${Ewindows1258::eD}', '\\S', '${Ewindows1258::eS}', '\\W', '${Ewindows1258::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Ewindows1258::eH}', '\\V', '${Ewindows1258::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Ewindows1258::eR}', '\\N', '${Ewindows1258::eN}', '\\b', '${Ewindows1258::eb}', '\\B', '${Ewindows1258::eB}'}->{$char}
Truth table100%2/2
A
A= {'\\D', '${Ewindows1258::eD}', '\\S', '${Ewindows1258::eS}', '\\W', '${Ewindows1258::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Ewindows1258::eH}', '\\V', '${Ewindows1258::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Ewindows1258::eR}', '\\N', '${Ewindows1258::eN}', '\\b', '${Ewindows1258::eb}', '\\B', '${Ewindows1258::eB}'}->{$char}
Aresult
11
00
1234 }
1235  
1236 #
1237 # prepare Windows-1258 characters per length
1238 #
1239  
1240 # 1 octet characters
1241 424 my @chars1 = ();
1242 0 ▶sub chars1 {
Subroutine chars1: not called CC=5 SCAR=34.0
Pod undocumented
1243 0 ▶ if (@chars1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars1) 0 0 0
1244 0 return @chars1;
1245 }
1246 0 ▶ if (exists $range_tr{1}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{1}) 0 0 0
1247 0 my @ranges = @{ $range_tr{1} };
1248 0 ▶ while (my @range = splice(@ranges,0,1)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 1)) 0 0 0
1249 0 for my $oct0 (@{$range[0]}) {
1250 0 push @chars1, pack 'C', $oct0;
1251 }
1252 }
1253 }
1254 0 return @chars1;
1255 }
1256  
1257 # 2 octets characters
1258 424 my @chars2 = ();
1259 0 ▶sub chars2 {
Subroutine chars2: not called CC=6 SCAR=37.4
Pod undocumented
1260 0 ▶ if (@chars2) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars2) 0 0 0
1261 0 return @chars2;
1262 }
1263 0 ▶ if (exists $range_tr{2}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{2}) 0 0 0
1264 0 my @ranges = @{ $range_tr{2} };
1265 0 ▶ while (my @range = splice(@ranges,0,2)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 2)) 0 0 0
1266 0 for my $oct0 (@{$range[0]}) {
1267 0 for my $oct1 (@{$range[1]}) {
1268 0 push @chars2, pack 'CC', $oct0,$oct1;
1269 }
1270 }
1271 }
1272 }
1273 0 return @chars2;
1274 }
1275  
1276 # 3 octets characters
1277 424 my @chars3 = ();
1278 0 ▶sub chars3 {
Subroutine chars3: not called CC=7 SCAR=40.3
Pod undocumented
1279 0 ▶ if (@chars3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars3) 0 0 0
1280 0 return @chars3;
1281 }
1282 0 ▶ if (exists $range_tr{3}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{3}) 0 0 0
1283 0 my @ranges = @{ $range_tr{3} };
1284 0 ▶ while (my @range = splice(@ranges,0,3)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 3)) 0 0 0
1285 0 for my $oct0 (@{$range[0]}) {
1286 0 for my $oct1 (@{$range[1]}) {
1287 0 for my $oct2 (@{$range[2]}) {
1288 0 push @chars3, pack 'CCC', $oct0,$oct1,$oct2;
1289 }
1290 }
1291 }
1292 }
1293 }
1294 0 return @chars3;
1295 }
1296  
1297 # 4 octets characters
1298 424 my @chars4 = ();
1299 0 ▶sub chars4 {
Subroutine chars4: not called CC=8 SCAR=42.8
Pod undocumented
1300 0 ▶ if (@chars4) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars4) 0 0 0
1301 0 return @chars4;
1302 }
1303 0 ▶ if (exists $range_tr{4}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{4}) 0 0 0
1304 0 my @ranges = @{ $range_tr{4} };
1305 0 ▶ while (my @range = splice(@ranges,0,4)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 4)) 0 0 0
1306 0 for my $oct0 (@{$range[0]}) {
1307 0 for my $oct1 (@{$range[1]}) {
1308 0 for my $oct2 (@{$range[2]}) {
1309 0 for my $oct3 (@{$range[3]}) {
1310 0 push @chars4, pack 'CCCC', $oct0,$oct1,$oct2,$oct3;
1311 }
1312 }
1313 }
1314 }
1315 }
1316 }
1317 0 return @chars4;
1318 }
1319  
1320 #
1321 # Windows-1258 open character list for tr
1322 #
1323 12 ▶sub _charlist_tr {
Subroutine _charlist_tr: called CC=35 SCAR=66.4
1324  
1325 12 local $_ = shift @_;
1326  
1327 # unescape character
1328 12 my @char = ();
1329 12 ▶ while (not /\G \z/oxmsgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgmosx) 38 12 50
1330 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 \\ ($Ewindows1258::q_char) /cgmosx) { } 0 38 38
elsif (/\G ($Ewindows1258::q_char) /cgmosx) { } 38 0 38
1331 0 push @char, '\-';
1332 }
1333 elsif (/\G \\ ([0-7]{2,3}) /oxmsgc) {
1334 0 push @char, CORE::chr(oct $1);
1335 }
1336 elsif (/\G \\x ([0-9A-Fa-f]{1,2}) /oxmsgc) {
1337 0 push @char, CORE::chr(hex $1);
1338 }
1339 elsif (/\G \\c ([\x40-\x5F]) /oxmsgc) {
1340 0 push @char, CORE::chr(CORE::ord($1) & 0x1F);
1341 }
1342 elsif (/\G (\\ [0nrtfbae]) /oxmsgc) {
1343 push @char, {
1344 '\0' => "\0",
1345 '\n' => "\n",
1346 '\r' => "\r",
1347 '\t' => "\t",
1348 '\f' => "\f",
1349 '\b' => "\x08", # \b means backspace in character class
1350 '\a' => "\a",
1351 '\e' => "\e",
1352 0 }->{$1};
1353 }
1354 elsif (/\G \\ ($q_char) /oxmsgc) {
1355 0 push @char, $1;
1356 }
1357 elsif (/\G ($q_char) /oxmsgc) {
1358 38 push @char, $1;
1359 }
1360 }
1361  
1362 # join separated multiple-octet
1363 12 @char = join('',@char) =~ /\G (?>\\-|$q_char) /oxmsg;
1364  
1365 # unescape '-'
1366 12 my @i = ();
1367 12 for my $i (0 .. $#char) {
1368 38 ▶ if ($char[$i] eq '\-') {
Branch: 2 branches
BranchTrueFalseTotal
if ($char[$i] eq '\\-') { } 0 38 38
elsif ($char[$i] eq '-') { } 0 38 38
1369 0 $char[$i] = '-';
1370 }
1371 elsif ($char[$i] eq '-') {
1372 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
1373 0 push @i, $i;
1374 }
1375 }
1376 }
1377  
1378 # open character list (reverse for splice)
1379 12 for my $i (CORE::reverse @i) {
1380 0 my @range = ();
1381  
1382 # range error
1383 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
1384 0 croak "Invalid tr/// range \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1385 }
1386  
1387 # range of multiple-octet code
1388 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
1389 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
1390 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
1391 }
1392 elsif (CORE::length($char[$i+1]) == 2) {
1393 0 push @range, grep {$char[$i-1] le $_} chars1();
1394 0 push @range, grep {$_ le $char[$i+1]} chars2();
1395 }
1396 elsif (CORE::length($char[$i+1]) == 3) {
1397 0 push @range, grep {$char[$i-1] le $_} chars1();
1398 0 push @range, chars2();
1399 0 push @range, grep {$_ le $char[$i+1]} chars3();
1400 }
1401 elsif (CORE::length($char[$i+1]) == 4) {
1402 0 push @range, grep {$char[$i-1] le $_} chars1();
1403 0 push @range, chars2();
1404 0 push @range, chars3();
1405 0 push @range, grep {$_ le $char[$i+1]} chars4();
1406 }
1407 else {
1408 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1409 }
1410 }
1411 elsif (CORE::length($char[$i-1]) == 2) {
1412 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
1413 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
1414 }
1415 elsif (CORE::length($char[$i+1]) == 3) {
1416 0 push @range, grep {$char[$i-1] le $_} chars2();
1417 0 push @range, grep {$_ le $char[$i+1]} chars3();
1418 }
1419 elsif (CORE::length($char[$i+1]) == 4) {
1420 0 push @range, grep {$char[$i-1] le $_} chars2();
1421 0 push @range, chars3();
1422 0 push @range, grep {$_ le $char[$i+1]} chars4();
1423 }
1424 else {
1425 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1426 }
1427 }
1428 elsif (CORE::length($char[$i-1]) == 3) {
1429 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
1430 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
1431 }
1432 elsif (CORE::length($char[$i+1]) == 4) {
1433 0 push @range, grep {$char[$i-1] le $_} chars3();
1434 0 push @range, grep {$_ le $char[$i+1]} chars4();
1435 }
1436 else {
1437 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1438 }
1439 }
1440 elsif (CORE::length($char[$i-1]) == 4) {
1441 0 ▶ if (CORE::length($char[$i+1]) == 4) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $char[$i + 1] == 4) { } 0 0 0
1442 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
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 else {
1449 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1450 }
1451  
1452 0 splice @char, $i-1, 3, @range;
1453 }
1454  
1455 12 return @char;
1456 }
1457  
1458 #
1459 # Windows-1258 open character class
1460 #
1461 0 ▶sub _cc {
Subroutine _cc: not called CC=7 SCAR=40.3
1462 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
1463 0 die __FILE__, ": subroutine cc got no parameter.\n";
1464 }
1465 elsif (scalar(@_) == 1) {
1466 0 return sprintf('\x%02X',$_[0]);
1467 }
1468 elsif (scalar(@_) == 2) {
1469 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
1470 0 die __FILE__, ": subroutine cc got \$_[0] > \$_[1] parameters).\n";
1471 }
1472 elsif ($_[0] == $_[1]) {
1473 0 return sprintf('\x%02X',$_[0]);
1474 }
1475 elsif (($_[0]+1) == $_[1]) {
1476 0 return sprintf('[\\x%02X\\x%02X]',$_[0],$_[1]);
1477 }
1478 else {
1479 0 return sprintf('[\\x%02X-\\x%02X]',$_[0],$_[1]);
1480 }
1481 }
1482 else {
1483 0 die __FILE__, ": subroutine cc got 3 or more parameters (@{[scalar(@_)]} parameters).\n";
1484 }
1485 }
1486  
1487 #
1488 # Windows-1258 octet range
1489 #
1490 246 ▶sub _octets {
Subroutine _octets: called CC=5 SCAR=19.3
1491 246 my $length = shift @_;
1492  
1493 246 ▶ if ($length == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length == 1) { } 246 0 246
1494 246 my($a1) = unpack 'C', $_[0];
1495 246 my($z1) = unpack 'C', $_[1];
1496  
1497 246 ▶ if ($a1 > $z1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($a1 > $z1) 0 246 246
1498 0 croak 'Invalid [] range in regexp (CORE::ord(A) > CORE::ord(B)) ' . '\x' . unpack('H*',$a1) . '-\x' . unpack('H*',$z1);
1499 }
1500  
1501 246 ▶ if ($a1 == $z1) {
Branch: 2 branches
BranchTrueFalseTotal
if ($a1 == $z1) { } 0 246 246
elsif ($a1 + 1 == $z1) { } 0 246 246
1502 0 return sprintf('\x%02X',$a1);
1503 }
1504 elsif (($a1+1) == $z1) {
1505 0 return sprintf('\x%02X\x%02X',$a1,$z1);
1506 }
1507 else {
1508 246 return sprintf('\x%02X-\x%02X',$a1,$z1);
1509 }
1510 }
1511 else {
1512 0 die __FILE__, ": subroutine _octets got invalid length ($length).\n";
1513 }
1514 }
1515  
1516 #
1517 # Windows-1258 range regexp
1518 #
1519 246 ▶sub _range_regexp {
Subroutine _range_regexp: called CC=18 SCAR=41.7
1520 246 my($length,$first,$last) = @_;
1521  
1522 246 my @range_regexp = ();
1523 246 ▶ if (not exists $range_tr{$length}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $range_tr{$length}) 0 246 246
1524 0 return @range_regexp;
1525 }
1526  
1527 246 my @ranges = @{ $range_tr{$length} };
1528 246 ▶ while (my @range = splice(@ranges,0,$length)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, $length)) 246 246 492
1529 246 my $min = '';
1530 246 my $max = '';
1531 246 ▶ for (my $i=0; $i < $length; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $length) 246 246 492
1532 246 $min .= pack 'C', $range[$i][0];
1533 246 $max .= pack 'C', $range[$i][-1];
1534 }
1535  
1536 # min___max
1537 # FIRST_____________LAST
1538 # (nothing)
1539  
1540 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
1541 }
1542  
1543 # **********
1544 # min_________max
1545 # FIRST_____________LAST
1546 # **********
1547  
1548 ▶ 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
1549 0 push @range_regexp, _octets($length,$first,$max,$min,$max);
1550 }
1551  
1552 # **********************
1553 # min________________max
1554 # FIRST_____________LAST
1555 # **********************
1556  
1557 ▶ 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
1558 0 push @range_regexp, _octets($length,$first,$last,$min,$max);
1559 }
1560  
1561 # *********
1562 # min___max
1563 # FIRST_____________LAST
1564 # *********
1565  
1566 ▶ 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
1567 0 push @range_regexp, _octets($length,$min,$max,$min,$max);
1568 }
1569  
1570 # **********************
1571 # min__________________________max
1572 # FIRST_____________LAST
1573 # **********************
1574  
1575 ▶ 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
1576 246 push @range_regexp, _octets($length,$first,$last,$min,$max);
1577 }
1578  
1579 # *********
1580 # min________max
1581 # FIRST_____________LAST
1582 # *********
1583  
1584 ▶ 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
1585 0 push @range_regexp, _octets($length,$min,$last,$min,$max);
1586 }
1587  
1588 # min___max
1589 # FIRST_____________LAST
1590 # (nothing)
1591  
1592 elsif ($last lt $min) {
1593 }
1594  
1595 else {
1596 0 die __FILE__, ": subroutine _range_regexp panic.\n";
1597 }
1598 }
1599  
1600 246 return @range_regexp;
1601 }
1602  
1603 #
1604 # Windows-1258 open character list for qr and not qr
1605 #
1606 650 ▶sub _charlist {
Subroutine _charlist: called CC=46 SCAR=45.9
1607  
1608 650 my $modifier = pop @_;
1609 650 my @char = @_;
1610  
1611 650 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 298 352 650
1612  
1613 # unescape character
1614 650 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1773 650 2423
1615  
1616 # escape - to ...
1617 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 \\ ($Ewindows1258::q_char) \z/mosx) { } 7 1371 1378
1618 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
1619 246 $char[$i] = '...';
1620 }
1621 }
1622  
1623 # octal escape sequence
1624 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
1625 0 $char[$i] = octchr($1);
1626 }
1627  
1628 # hexadecimal escape sequence
1629 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
1630 0 $char[$i] = hexchr($1);
1631 }
1632  
1633 # \b{...} --> b\{...}
1634 # \B{...} --> B\{...}
1635 # \N{CHARNAME} --> N\{CHARNAME}
1636 # \p{PROPERTY} --> p\{PROPERTY}
1637 # \P{PROPERTY} --> P\{PROPERTY}
1638 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
1639 0 $char[$i] = $1 . '\\' . $2;
1640 }
1641  
1642 # \p, \P, \X --> p, P, X
1643 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
1644 0 $char[$i] = $1;
1645 }
1646  
1647 elsif ($char[$i] =~ /\A \\ ([0-7]{2,3}) \z/oxms) {
1648 0 $char[$i] = CORE::chr oct $1;
1649 }
1650 elsif ($char[$i] =~ /\A \\x ([0-9A-Fa-f]{1,2}) \z/oxms) {
1651 22 $char[$i] = CORE::chr hex $1;
1652 }
1653 elsif ($char[$i] =~ /\A \\c ([\x40-\x5F]) \z/oxms) {
1654 0 $char[$i] = CORE::chr(CORE::ord($1) & 0x1F);
1655 }
1656 elsif ($char[$i] =~ /\A (\\ [0nrtfbaedswDSWHVhvR]) \z/oxms) {
1657 $char[$i] = {
1658 '\0' => "\0",
1659 '\n' => "\n",
1660 '\r' => "\r",
1661 '\t' => "\t",
1662 '\f' => "\f",
1663 '\b' => "\x08", # \b means backspace in character class
1664 '\a' => "\a",
1665 '\e' => "\e",
1666 '\d' => '[0-9]',
1667  
1668 # Vertical tabs are now whitespace
1669 # \s in a regex now matches a vertical tab in all circumstances.
1670 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
1671 # \t \n \v \f \r space
1672 # '\s' => '[\x09\x0A \x0C\x0D\x20]',
1673 # '\s' => '[\x09\x0A\x0B\x0C\x0D\x20]',
1674 '\s' => '\s',
1675  
1676 '\w' => '[0-9A-Z_a-z]',
1677 '\D' => '${Ewindows1258::eD}',
1678 '\S' => '${Ewindows1258::eS}',
1679 '\W' => '${Ewindows1258::eW}',
1680  
1681 '\H' => '${Ewindows1258::eH}',
1682 '\V' => '${Ewindows1258::eV}',
1683 '\h' => '[\x09\x20]',
1684 '\v' => '[\x0A\x0B\x0C\x0D]',
1685 '\R' => '${Ewindows1258::eR}',
1686  
1687 25 }->{$1};
1688 }
1689  
1690 # POSIX-style character classes
1691 ▶ 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
1692 $char[$i] = {
1693  
1694 '[:lower:]' => '[\x41-\x5A\x61-\x7A]',
1695 '[:upper:]' => '[\x41-\x5A\x61-\x7A]',
1696 '[:^lower:]' => '${Ewindows1258::not_lower_i}',
1697 '[:^upper:]' => '${Ewindows1258::not_upper_i}',
1698  
1699 8 }->{$1};
1700 }
1701 elsif ($char[$i] =~ /\A ( \[\: \^? (?:alnum|alpha|ascii|blank|cntrl|digit|graph|lower|print|punct|space|upper|word|xdigit) :\] ) \z/oxms) {
1702 $char[$i] = {
1703  
1704 '[:alnum:]' => '[\x30-\x39\x41-\x5A\x61-\x7A]',
1705 '[:alpha:]' => '[\x41-\x5A\x61-\x7A]',
1706 '[:ascii:]' => '[\x00-\x7F]',
1707 '[:blank:]' => '[\x09\x20]',
1708 '[:cntrl:]' => '[\x00-\x1F\x7F]',
1709 '[:digit:]' => '[\x30-\x39]',
1710 '[:graph:]' => '[\x21-\x7F]',
1711 '[:lower:]' => '[\x61-\x7A]',
1712 '[:print:]' => '[\x20-\x7F]',
1713 '[:punct:]' => '[\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E]',
1714  
1715 # P.174 POSIX-Style Character Classes
1716 # in Chapter 5: Pattern Matching
1717 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
1718  
1719 # P.311 11.2.4 Character Classes and other Special Escapes
1720 # in Chapter 11: perlre: Perl regular expressions
1721 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
1722  
1723 # P.210 POSIX-Style Character Classes
1724 # in Chapter 5: Pattern Matching
1725 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1726  
1727 '[:space:]' => '[\s\x0B]', # "\s" plus vertical tab ("\cK")
1728  
1729 '[:upper:]' => '[\x41-\x5A]',
1730 '[:word:]' => '[\x30-\x39\x41-\x5A\x5F\x61-\x7A]',
1731 '[:xdigit:]' => '[\x30-\x39\x41-\x46\x61-\x66]',
1732 '[:^alnum:]' => '${Ewindows1258::not_alnum}',
1733 '[:^alpha:]' => '${Ewindows1258::not_alpha}',
1734 '[:^ascii:]' => '${Ewindows1258::not_ascii}',
1735 '[:^blank:]' => '${Ewindows1258::not_blank}',
1736 '[:^cntrl:]' => '${Ewindows1258::not_cntrl}',
1737 '[:^digit:]' => '${Ewindows1258::not_digit}',
1738 '[:^graph:]' => '${Ewindows1258::not_graph}',
1739 '[:^lower:]' => '${Ewindows1258::not_lower}',
1740 '[:^print:]' => '${Ewindows1258::not_print}',
1741 '[:^punct:]' => '${Ewindows1258::not_punct}',
1742 '[:^space:]' => '${Ewindows1258::not_space}',
1743 '[:^upper:]' => '${Ewindows1258::not_upper}',
1744 '[:^word:]' => '${Ewindows1258::not_word}',
1745 '[:^xdigit:]' => '${Ewindows1258::not_xdigit}',
1746  
1747 70 }->{$1};
1748 }
1749 elsif ($char[$i] =~ /\A \\ ($q_char) \z/oxms) {
1750 7 $char[$i] = $1;
1751 }
1752 }
1753  
1754 # open character list
1755 650 my @singleoctet = ();
1756 650 my @multipleoctet = ();
1757 650 ▶ for (my $i=0; $i <= $#char; ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1527 650 2177
1758  
1759 # escaped -
1760 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
1761 246 $i += 1;
1762 246 next;
1763 }
1764  
1765 # make range regexp
1766 elsif ($char[$i] eq '...') {
1767  
1768 # range error
1769 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
1770 0 croak 'Invalid [] range in regexp (length(A) > length(B)) ' . '\x' . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]);
1771 }
1772 elsif (CORE::length($char[$i-1]) == CORE::length($char[$i+1])) {
1773 246 ▶ if ($char[$i-1] gt $char[$i+1]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i - 1] gt $char[$i + 1]) 0 246 246
1774 0 croak 'Invalid [] range in regexp (CORE::ord(A) > CORE::ord(B)) ' . '\x' . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]);
1775 }
1776 }
1777  
1778 # make range regexp per length
1779 246 for my $length (CORE::length($char[$i-1]) .. CORE::length($char[$i+1])) {
1780 246 my @regexp = ();
1781  
1782 # is first and last
1783 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
1784 246 push @regexp, _range_regexp($length, $char[$i-1], $char[$i+1]);
1785 }
1786  
1787 # is first
1788 elsif ($length == CORE::length($char[$i-1])) {
1789 0 push @regexp, _range_regexp($length, $char[$i-1], "\xFF" x $length);
1790 }
1791  
1792 # is inside in first and last
1793 ▶ 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
1794 0 push @regexp, _range_regexp($length, "\x00" x $length, "\xFF" x $length);
1795 }
1796  
1797 # is last
1798 elsif ($length == CORE::length($char[$i+1])) {
1799 0 push @regexp, _range_regexp($length, "\x00" x $length, $char[$i+1]);
1800 }
1801  
1802 else {
1803 0 die __FILE__, ": subroutine make_regexp panic.\n";
1804 }
1805  
1806 246 ▶ if ($length == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length == 1) { } 246 0 246
1807 246 push @singleoctet, @regexp;
1808 }
1809 else {
1810 0 push @multipleoctet, @regexp;
1811 }
1812 }
1813  
1814 246 $i += 2;
1815 }
1816  
1817 # with /i modifier
1818 elsif ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) {
1819 949 ▶ if ($modifier =~ /i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) { } 480 469 949
1820 480 my $uc = Ewindows1258::uc($char[$i]);
1821 480 my $fc = Ewindows1258::fc($char[$i]);
1822 480 ▶ if ($uc ne $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc ne $fc) { } 240 240 480
1823 240 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 240 0 240
1824 240 push @singleoctet, $uc, $fc;
1825 }
1826 else {
1827 0 push @singleoctet, $uc;
1828 0 push @multipleoctet, $fc;
1829 }
1830 }
1831 else {
1832 240 push @singleoctet, $char[$i];
1833 }
1834 }
1835 else {
1836 469 push @singleoctet, $char[$i];
1837 }
1838 949 $i += 1;
1839 }
1840  
1841 # single character of single octet code
1842 elsif ($char[$i] =~ /\A (?: \\h ) \z/oxms) {
1843 0 push @singleoctet, "\t", "\x20";
1844 0 $i += 1;
1845 }
1846 elsif ($char[$i] =~ /\A (?: \\v ) \z/oxms) {
1847 0 push @singleoctet, "\x0A", "\x0B", "\x0C", "\x0D";
1848 0 $i += 1;
1849 }
1850 elsif ($char[$i] =~ /\A (?: \\d | \\s | \\w ) \z/oxms) {
1851 2 push @singleoctet, $char[$i];
1852 2 $i += 1;
1853 }
1854  
1855 # single character of multiple-octet code
1856 else {
1857 84 push @multipleoctet, $char[$i];
1858 84 $i += 1;
1859 }
1860 }
1861  
1862 # quote metachar
1863 650 for (@singleoctet) {
1864 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
1865 0 $_ = '-';
1866 }
1867 elsif (/\A \n \z/oxms) {
1868 8 $_ = '\n';
1869 }
1870 elsif (/\A \r \z/oxms) {
1871 8 $_ = '\r';
1872 }
1873 elsif (/\A ([\x00-\x20\x7F-\xFF]) \z/oxms) {
1874 744 $_ = sprintf('\x%02X', CORE::ord $1);
1875 }
1876 elsif (/\A [\x00-\xFF] \z/oxms) {
1877 429 $_ = quotemeta $_;
1878 }
1879 }
1880  
1881 # return character list
1882 650 return \@singleoctet, \@multipleoctet;
1883 }
1884  
1885 #
1886 # Windows-1258 octal escape sequence
1887 #
1888 5 ▶sub octchr {
Subroutine octchr: called CC=2 SCAR=6.9
Pod undocumented
1889 5 my($octdigit) = @_;
1890  
1891 5 my @binary = ();
1892 5 for my $octal (split(//,$octdigit)) {
1893 push @binary, {
1894 '0' => '000',
1895 '1' => '001',
1896 '2' => '010',
1897 '3' => '011',
1898 '4' => '100',
1899 '5' => '101',
1900 '6' => '110',
1901 '7' => '111',
1902 50 }->{$octal};
1903 }
1904 5 my $binary = join '', @binary;
1905  
1906 my $octchr = {
1907 # 1234567
1908 1 => pack('B*', "0000000$binary"),
1909 2 => pack('B*', "000000$binary"),
1910 3 => pack('B*', "00000$binary"),
1911 4 => pack('B*', "0000$binary"),
1912 5 => pack('B*', "000$binary"),
1913 6 => pack('B*', "00$binary"),
1914 7 => pack('B*', "0$binary"),
1915 0 => pack('B*', "$binary"),
1916  
1917 5 }->{CORE::length($binary) % 8};
1918  
1919 5 return $octchr;
1920 }
1921  
1922 #
1923 # Windows-1258 hexadecimal escape sequence
1924 #
1925 5 ▶sub hexchr {
Subroutine hexchr: called CC=1 SCAR=0.0
Pod undocumented
1926 5 my($hexdigit) = @_;
1927  
1928 my $hexchr = {
1929 1 => pack('H*', "0$hexdigit"),
1930 0 => pack('H*', "$hexdigit"),
1931  
1932 5 }->{CORE::length($_[0]) % 2};
1933  
1934 5 return $hexchr;
1935 }
1936  
1937 #
1938 # Windows-1258 open character list for qr
1939 #
1940 576 ▶sub charlist_qr {
Subroutine charlist_qr: called CC=17 SCAR=28.7
Pod undocumented
1941  
1942 576 my $modifier = pop @_;
1943 576 my @char = @_;
1944  
1945 576 my($singleoctet, $multipleoctet) = _charlist(@char, $modifier);
1946 576 my @singleoctet = @$singleoctet;
1947 576 my @multipleoctet = @$multipleoctet;
1948  
1949 # return character list
1950 576 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) 498 78 576
1951  
1952 # with /i modifier
1953 498 ▶ if ($modifier =~ m/i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) 265 233 498
1954 265 my %singleoctet_ignorecase = ();
1955 265 for (@singleoctet) {
1956 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
1957 745 for my $ord (hex($1) .. hex($2)) {
1958 795 my $char = CORE::chr($ord);
1959 795 my $uc = Ewindows1258::uc($char);
1960 795 my $fc = Ewindows1258::fc($char);
1961 795 ▶ if ($uc eq $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc eq $fc) { } 240 555 795
1962 240 $singleoctet_ignorecase{unpack 'C*', $char} = 1;
1963 }
1964 else {
1965 555 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 555 0 555
1966 555 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
1967 555 $singleoctet_ignorecase{unpack 'C*', $fc} = 1;
1968 }
1969 else {
1970 0 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
1971 0 push @multipleoctet, join '', map {sprintf('\x%02X',$_)} unpack 'C*', $fc;
1972 }
1973 }
1974 }
1975 }
1976 745 ▶ if ($_ ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ ne "") 0 745 745
1977 0 $singleoctet_ignorecase{unpack 'C*', $_} = 1;
1978 }
1979 }
1980 265 my $i = 0;
1981 265 my @singleoctet_ignorecase = ();
1982 265 for my $ord (0 .. 255) {
1983 67840 ▶ if (exists $singleoctet_ignorecase{$ord}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $singleoctet_ignorecase{$ord}) { } 870 66970 67840
1984 870 push @{$singleoctet_ignorecase[$i]}, $ord;
1985 }
1986 else {
1987 66970 $i++;
1988 }
1989 }
1990 265 @singleoctet = ();
1991 265 for my $range (@singleoctet_ignorecase) {
1992 56160 ▶ if (ref $range) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $range) 770 55390 56160
1993 770 ▶ if (scalar(@{$range}) == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @{$range;} == 1) { } 720 50 770
elsif (scalar @{$range;} == 2) { } 0 50 50
1994 720 push @singleoctet, sprintf('\x%02X', @{$range}[0]);
1995 }
1996 50 elsif (scalar(@{$range}) == 2) {
1997 0 push @singleoctet, sprintf('\x%02X\x%02X', @{$range}[0], @{$range}[-1]);
1998 }
1999 else {
2000 50 push @singleoctet, sprintf('\x%02X-\x%02X', @{$range}[0], @{$range}[-1]);
2001 }
2002 }
2003 }
2004 }
2005  
2006 498 my $not_anchor = '';
2007  
2008 498 push @multipleoctet, join('', $not_anchor, '[', @singleoctet, ']' );
2009 }
2010 576 ▶ if (scalar(@multipleoctet) >= 2) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @multipleoctet >= 2) { } 6 570 576
2011 6 return '(?:' . join('|', @multipleoctet) . ')';
2012 }
2013 else {
2014 570 return $multipleoctet[0];
2015 }
2016 }
2017  
2018 #
2019 # Windows-1258 open character list for not qr
2020 #
2021 74 ▶sub charlist_not_qr {
Subroutine charlist_not_qr: called CC=18 SCAR=33.1
Pod undocumented
2022  
2023 74 my $modifier = pop @_;
2024 74 my @char = @_;
2025  
2026 74 my($singleoctet, $multipleoctet) = _charlist(@char, $modifier);
2027 74 my @singleoctet = @$singleoctet;
2028 74 my @multipleoctet = @$multipleoctet;
2029  
2030 # with /i modifier
2031 74 ▶ if ($modifier =~ m/i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) 25 49 74
2032 25 my %singleoctet_ignorecase = ();
2033 25 for (@singleoctet) {
2034 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
2035 25 for my $ord (hex($1) .. hex($2)) {
2036 75 my $char = CORE::chr($ord);
2037 75 my $uc = Ewindows1258::uc($char);
2038 75 my $fc = Ewindows1258::fc($char);
2039 75 ▶ if ($uc eq $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc eq $fc) { } 0 75 75
2040 0 $singleoctet_ignorecase{unpack 'C*', $char} = 1;
2041 }
2042 else {
2043 75 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 75 0 75
2044 75 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2045 75 $singleoctet_ignorecase{unpack 'C*', $fc} = 1;
2046 }
2047 else {
2048 0 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2049 0 push @multipleoctet, join '', map {sprintf('\x%02X',$_)} unpack 'C*', $fc;
2050 }
2051 }
2052 }
2053 }
2054 25 ▶ if ($_ ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ ne "") 0 25 25
2055 0 $singleoctet_ignorecase{unpack 'C*', $_} = 1;
2056 }
2057 }
2058 25 my $i = 0;
2059 25 my @singleoctet_ignorecase = ();
2060 25 for my $ord (0 .. 255) {
2061 6400 ▶ if (exists $singleoctet_ignorecase{$ord}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $singleoctet_ignorecase{$ord}) { } 150 6250 6400
2062 150 push @{$singleoctet_ignorecase[$i]}, $ord;
2063 }
2064 else {
2065 6250 $i++;
2066 }
2067 }
2068 25 @singleoctet = ();
2069 25 for my $range (@singleoctet_ignorecase) {
2070 2400 ▶ if (ref $range) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $range) 50 2350 2400
2071 50 ▶ if (scalar(@{$range}) == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @{$range;} == 1) { } 0 50 50
elsif (scalar @{$range;} == 2) { } 0 50 50
2072 0 push @singleoctet, sprintf('\x%02X', @{$range}[0]);
2073 }
2074 50 elsif (scalar(@{$range}) == 2) {
2075 0 push @singleoctet, sprintf('\x%02X\x%02X', @{$range}[0], @{$range}[-1]);
2076 }
2077 else {
2078 50 push @singleoctet, sprintf('\x%02X-\x%02X', @{$range}[0], @{$range}[-1]);
2079 }
2080 }
2081 }
2082 }
2083  
2084 # return character list
2085 74 ▶ if (scalar(@multipleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @multipleoctet >= 1) { } 0 74 74
2086 0 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) { } 0 0 0
2087  
2088 # any character other than multiple-octet and single octet character class
2089 0 return '(?!' . join('|', @multipleoctet) . ')(?:[^' . join('', @singleoctet) . '])';
2090 }
2091 else {
2092  
2093 # any character other than multiple-octet character class
2094 0 return '(?!' . join('|', @multipleoctet) . ")(?:$your_char)";
2095 }
2096 }
2097 else {
2098 74 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) { } 74 0 74
2099  
2100 # any character other than single octet character class
2101 74 return '(?:[^' . join('', @singleoctet) . '])';
2102 }
2103 else {
2104  
2105 # any character
2106 0 return "(?:$your_char)";
2107 }
2108 }
2109 }
2110  
2111 #
2112 # open file in read mode
2113 #
2114 424 ▶sub _open_r {
Subroutine _open_r: called CC=1 SCAR=0.0
2115 424 my(undef,$file) = @_;
2116 424 ▶ use Fcntl qw(O_RDONLY);
Subroutine BEGIN: called CC=1 SCAR=0.0
2117 424 return CORE::sysopen($_[0], $file, &O_RDONLY);
2118 }
2119  
2120 #
2121 # open file in append mode
2122 #
2123 212 ▶sub _open_a {
Subroutine _open_a: called CC=1 SCAR=0.0
2124 212 my(undef,$file) = @_;
2125 424 ▶ use Fcntl qw(O_WRONLY O_APPEND O_CREAT);
Subroutine BEGIN: called CC=1 SCAR=0.0
2126 212 return CORE::sysopen($_[0], $file, &O_WRONLY|&O_APPEND|&O_CREAT);
2127 }
2128  
2129 #
2130 # safe system
2131 #
2132 212 ▶sub _systemx {
Subroutine _systemx: called CC=1 SCAR=0.0
2133  
2134 # P.707 29.2.33. exec
2135 # in Chapter 29: Functions
2136 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2137 #
2138 # Be aware that in older releases of Perl, exec (and system) did not flush
2139 # your output buffer, so you needed to enable command buffering by setting $|
2140 # on one or more filehandles to avoid lost output in the case of exec, or
2141 # misordererd output in the case of system. This situation was largely remedied
2142 # in the 5.6 release of Perl. (So, 5.005 release not yet.)
2143  
2144 # P.855 exec
2145 # in Chapter 27: Functions
2146 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2147 #
2148 # In very old release of Perl (before v5.6), exec (and system) did not flush
2149 # your output buffer, so you needed to enable command buffering by setting $|
2150 # on one or more filehandles to avoid lost output with exec or misordered
2151 # output with system.
2152  
2153 212 $| = 1;
2154  
2155 # P.565 23.1.2. Cleaning Up Your Environment
2156 # in Chapter 23: Security
2157 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2158  
2159 # P.656 Cleaning Up Your Environment
2160 # in Chapter 20: Security
2161 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2162  
2163 # local $ENV{'PATH'} = '.';
2164 212 local @ENV{qw(IFS CDPATH ENV BASH_ENV)}; # Make %ENV safer
2165  
2166 # P.707 29.2.33. exec
2167 # in Chapter 29: Functions
2168 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2169 #
2170 # As we mentioned earlier, exec treats a discrete list of arguments as an
2171 # indication that it should bypass shell processing. However, there is one
2172 # place where you might still get tripped up. The exec call (and system, too)
2173 # will not distinguish between a single scalar argument and an array containing
2174 # only one element.
2175 #
2176 # @args = ("echo surprise"); # just one element in list
2177 # exec @args # still subject to shell escapes
2178 # or die "exec: $!"; # because @args == 1
2179 #
2180 # To avoid this, you can use the PATHNAME syntax, explicitly duplicating the
2181 # first argument as the pathname, which forces the rest of the arguments to be
2182 # interpreted as a list, even if there is only one of them:
2183 #
2184 # exec { $args[0] } @args # safe even with one-argument list
2185 # or die "can't exec @args: $!";
2186  
2187 # P.855 exec
2188 # in Chapter 27: Functions
2189 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2190 #
2191 # As we mentioned earlier, exec treats a discrete list of arguments as a
2192 # directive to bypass shell processing. However, there is one place where
2193 # you might still get tripped up. The exec call (and system, too) cannot
2194 # distinguish between a single scalar argument and an array containing
2195 # only one element.
2196 #
2197 # @args = ("echo surprise"); # just one element in list
2198 # exec @args # still subject to shell escapes
2199 # || die "exec: $!"; # because @args == 1
2200 #
2201 # To avoid this, use the PATHNAME syntax, explicitly duplicating the first
2202 # argument as the pathname, which forces the rest of the arguments to be
2203 # interpreted as a list, even if there is only one of them:
2204 #
2205 # exec { $args[0] } @args # safe even with one-argument list
2206 # || die "can't exec @args: $!";
2207  
2208 212 return CORE::system { $_[0] } @_; # safe even with one-argument list
2209 }
2210  
2211 #
2212 # Windows-1258 order to character (with parameter)
2213 #
2214 3469 ▶sub Ewindows1258::chr(;$) {
Subroutine chr: called CC=4 SCAR=13.9
Pod undocumented
2215  
2216 3469 ▶ my $c = @_ ? $_[0] : $_;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 3469 0 3469
2217  
2218 3469 ▶ if ($c == 0x00) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c == 0) { } 24 3445 3469
2219 24 return "\x00";
2220 }
2221 else {
2222 3445 my @chr = ();
2223 3445 ▶ while ($c > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c > 0) 3445 3445 6890
2224 3445 unshift @chr, ($c % 0x100);
2225 3445 $c = int($c / 0x100);
2226 }
2227 3445 return pack 'C*', @chr;
2228 }
2229 }
2230  
2231 #
2232 # Windows-1258 order to character (without parameter)
2233 #
2234 0 ▶sub Ewindows1258::chr_() {
Subroutine chr_: not called CC=3 SCAR=24.8
Pod undocumented
2235  
2236 0 my $c = $_;
2237  
2238 0 ▶ if ($c == 0x00) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c == 0) { } 0 0 0
2239 0 return "\x00";
2240 }
2241 else {
2242 0 my @chr = ();
2243 0 ▶ while ($c > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c > 0) 0 0 0
2244 0 unshift @chr, ($c % 0x100);
2245 0 $c = int($c / 0x100);
2246 }
2247 0 return pack 'C*', @chr;
2248 }
2249 }
2250  
2251 #
2252 # Windows-1258 path globbing (with parameter)
2253 #
2254 0 ▶sub Ewindows1258::glob($) {
Subroutine glob: not called CC=3 SCAR=24.8
Pod undocumented
2255  
2256 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2257 0 my @glob = _DOS_like_glob(@_);
2258 0 for my $glob (@glob) {
2259 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2260 }
2261 0 return @glob;
2262 }
2263 else {
2264 0 my $glob = _DOS_like_glob(@_);
2265 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2266 0 return $glob;
2267 }
2268 }
2269  
2270 #
2271 # Windows-1258 path globbing (without parameter)
2272 #
2273 0 ▶sub Ewindows1258::glob_() {
Subroutine glob_: not called CC=3 SCAR=24.8
Pod undocumented
2274  
2275 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2276 0 my @glob = _DOS_like_glob();
2277 0 for my $glob (@glob) {
2278 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2279 }
2280 0 return @glob;
2281 }
2282 else {
2283 0 my $glob = _DOS_like_glob();
2284 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2285 0 return $glob;
2286 }
2287 }
2288  
2289 #
2290 # Windows-1258 path globbing via File::DosGlob 1.10
2291 #
2292 # Often I confuse "_dosglob" and "_doglob".
2293 # So, I renamed "_dosglob" to "_DOS_like_glob".
2294 #
2295 424 my %iter;
2296 my %entries;
2297 0 ▶sub _DOS_like_glob {
Subroutine _DOS_like_glob: not called CC=10 SCAR=47.0
2298  
2299 # context (keyed by second cxix argument provided by core)
2300 0 my($expr,$cxix) = @_;
2301  
2302 # glob without args defaults to $_
2303 0 ▶ $expr = $_ if not defined $expr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $expr 0 0 0
2304  
2305 # represents the current user's home directory
2306 #
2307 # 7.3. Expanding Tildes in Filenames
2308 # in Chapter 7. File Access
2309 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2310 #
2311 # and File::HomeDir, File::HomeDir::Windows module
2312  
2313 # DOS-like system
2314 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
2315 0 $expr =~ s{ \A ~ (?= [^/\\] ) }
2316 0 { my_home_MSWin32() }oxmse;
2317 }
2318  
2319 # UNIX-like system
2320 else {
2321 0 $expr =~ s{ \A ~ ( (?:[^/])* ) }
2322 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
2323 }
2324  
2325 # assume global context if not provided one
2326 0 ▶ $cxix = '_G_' if not defined $cxix;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $cxix 0 0 0
2327 0 ▶ $iter{$cxix} = 0 if not exists $iter{$cxix};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $iter{$cxix} 0 0 0
2328  
2329 # if we're just beginning, do it all first
2330 0 ▶ if ($iter{$cxix} == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iter{$cxix} == 0) 0 0 0
2331 0 $entries{$cxix} = [ _do_glob(1, _parse_line($expr)) ];
2332 }
2333  
2334 # chuck it all out, quick or slow
2335 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2336 0 delete $iter{$cxix};
2337 0 return @{delete $entries{$cxix}};
2338 }
2339 else {
2340 0 ▶ if ($iter{$cxix} = scalar @{$entries{$cxix}}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iter{$cxix} = scalar @{$entries{$cxix};}) { } 0 0 0
2341 0 return shift @{$entries{$cxix}};
2342 }
2343 else {
2344 # return undef for EOL
2345 0 delete $iter{$cxix};
2346 0 delete $entries{$cxix};
2347 0 return undef;
2348 }
2349 }
2350 }
2351  
2352 #
2353 # Windows-1258 path globbing subroutine
2354 #
2355 0 ▶sub _do_glob {
Subroutine _do_glob: not called CC=44 SCAR=75.9
2356  
2357 0 my($cond,@expr) = @_;
2358 0 my @glob = ();
2359 0 my $fix_drive_relative_paths = 0;
2360  
2361 OUTER:
2362 0 for my $expr (@expr) {
2363 0 ▶ next OUTER if not defined $expr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $expr 0 0 0
2364 0 ▶ next OUTER if $expr eq '';
Branch: 1 branch
BranchTrueFalseTotal
if $expr eq "" 0 0 0
2365  
2366 0 my @matched = ();
2367 0 my @globdir = ();
2368 0 my $head = '.';
2369 0 my $pathsep = '/';
2370 0 my $tail;
2371  
2372 # if argument is within quotes strip em and do no globbing
2373 0 ▶ if ($expr =~ /\A " ((?:$q_char)*?) " \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expr =~ /\A " ((?:$Ewindows1258::q_char)*?) " \z/mosx) 0 0 0
2374 0 $expr = $1;
2375 0 ▶ if ($cond eq 'd') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cond eq 'd') { } 0 0 0
2376 0 ▶ if (-d $expr) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $expr) 0 0 0
2377 0 push @glob, $expr;
2378 }
2379 }
2380 else {
2381 0 ▶ if (-e $expr) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $expr) 0 0 0
2382 0 push @glob, $expr;
2383 }
2384 }
2385 0 next OUTER;
2386 }
2387  
2388 # wildcards with a drive prefix such as h:*.pm must be changed
2389 # to h:./*.pm to expand correctly
2390 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
2391 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
2392 0 $fix_drive_relative_paths = 1;
2393 }
2394 }
2395  
2396 0 ▶ if (($head, $tail) = _parse_path($expr,$pathsep)) {
Branch: 1 branch
BranchTrueFalseTotal
if (($head, $tail) = _parse_path($expr, $pathsep)) 0 0 0
2397 0 ▶ if ($tail eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($tail eq "") 0 0 0
2398 0 push @glob, $expr;
2399 0 next OUTER;
2400 }
2401 0 ▶ if ($head =~ / \A (?:$q_char)*? [*?] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head =~ / \A (?:$Ewindows1258::q_char)*? [*?] /mosx) 0 0 0
2402 0 ▶ if (@globdir = _do_glob('d', $head)) {
Branch: 1 branch
BranchTrueFalseTotal
if (@globdir = _do_glob("d", $head)) 0 0 0
2403 0 push @glob, _do_glob($cond, map {"$_$pathsep$tail"} @globdir);
2404 0 next OUTER;
2405 }
2406 }
2407 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
2408 0 $head .= $pathsep;
2409 }
2410 0 $expr = $tail;
2411 }
2412  
2413 # If file component has no wildcards, we can avoid opendir
2414 0 ▶ if ($expr !~ / \A (?:$q_char)*? [*?] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($expr =~ / \A (?:$Ewindows1258::q_char)*? [*?] /mosx) 0 0 0
2415 0 ▶ if ($head eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($head eq ".") 0 0 0
2416 0 $head = '';
2417 }
2418 0 ▶ if ($head ne '' and ($head =~ / \G ($q_char) /oxmsg)[-1] ne $pathsep) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head ne "" and ($head =~ / \G ($Ewindows1258::q_char) /gmosx)[-1] ne $pathsep) 0 0 0
Condition0%0/3
$head ne "" and ($head =~ / \G ($Ewindows1258::q_char) /gmosx)[-1] ne $pathsep
!ll&&!rl&&r
000
MC/DC0%0/2
$head ne "" and ($head =~ / \G ($Ewindows1258::q_char) /gmosx)[-1] ne $pathsep
$head ne "" ($head =~ / \G ($Ewindows1258::q_char) /gmosx)[-1] ne $pathsep
Truth table0%0/3
A and B
A= $head ne ""B= ($head =~ / \G ($Ewindows1258::q_char) /gmosx)[-1] ne $pathsep
ABresult
0X0
100
111
2419 0 $head .= $pathsep;
2420 }
2421 0 $head .= $expr;
2422 0 ▶ if ($cond eq 'd') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cond eq 'd') { } 0 0 0
2423 0 ▶ if (-d $head) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $head) 0 0 0
2424 0 push @glob, $head;
2425 }
2426 }
2427 else {
2428 0 ▶ if (-e $head) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $head) 0 0 0
2429 0 push @glob, $head;
2430 }
2431 }
2432 0 next OUTER;
2433 }
2434 0 ▶ opendir(*DIR, $head) or next OUTER;
Branch: 1 branch
BranchTrueFalseTotal
opendir *DIR, $head or next OUTER 0 0 0
2435 0 my @leaf = readdir DIR;
2436 0 closedir DIR;
2437  
2438 0 ▶ if ($head eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($head eq ".") 0 0 0
2439 0 $head = '';
2440 }
2441 0 ▶ if ($head ne '' and ($head =~ / \G ($q_char) /oxmsg)[-1] ne $pathsep) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head ne "" and ($head =~ / \G ($Ewindows1258::q_char) /gmosx)[-1] ne $pathsep) 0 0 0
Condition0%0/3
$head ne "" and ($head =~ / \G ($Ewindows1258::q_char) /gmosx)[-1] ne $pathsep
!ll&&!rl&&r
000
MC/DC0%0/2
$head ne "" and ($head =~ / \G ($Ewindows1258::q_char) /gmosx)[-1] ne $pathsep
$head ne "" ($head =~ / \G ($Ewindows1258::q_char) /gmosx)[-1] ne $pathsep
Truth table0%0/3
A and B
A= $head ne ""B= ($head =~ / \G ($Ewindows1258::q_char) /gmosx)[-1] ne $pathsep
ABresult
0X0
100
111
2442 0 $head .= $pathsep;
2443 }
2444  
2445 0 my $pattern = '';
2446 0 ▶ while ($expr =~ / \G ($q_char) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expr =~ / \G ($Ewindows1258::q_char) /cgox) 0 0 0
2447 0 my $char = $1;
2448  
2449 # 6.9. Matching Shell Globs as Regular Expressions
2450 # in Chapter 6. Pattern Matching
2451 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2452 # (and so on)
2453  
2454 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
2455 0 $pattern .= "(?:$your_char)*",
2456 }
2457 elsif ($char eq '?') {
2458 0 $pattern .= "(?:$your_char)?", # DOS style
2459 # $pattern .= "(?:$your_char)", # UNIX style
2460 }
2461 elsif ((my $fc = Ewindows1258::fc($char)) ne $char) {
2462 0 $pattern .= $fc;
2463 }
2464 else {
2465 0 $pattern .= quotemeta $char;
2466 }
2467 }
2468 0 ▶ my $matchsub = sub { Ewindows1258::fc($_[0]) =~ /\A $pattern \z/xms };
Subroutine __ANON__: not called CC=1 SCAR=6.9
2469  
2470 # if ($@) {
2471 # print STDERR "$0: $@\n";
2472 # next OUTER;
2473 # }
2474  
2475 INNER:
2476 0 for my $leaf (@leaf) {
2477 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
2478 0 next INNER;
2479 }
2480 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
2481 0 next INNER;
2482 }
2483  
2484 0 ▶ if (&$matchsub($leaf)) {
Branch: 1 branch
BranchTrueFalseTotal
if (&$matchsub($leaf)) 0 0 0
2485 0 push @matched, "$head$leaf";
2486 0 next INNER;
2487 }
2488  
2489 # [DOS compatibility special case]
2490 # Failed, add a trailing dot and try again, but only...
2491  
2492 0 ▶ if (Ewindows1258::index($leaf,'.') == -1 and # if name does not have a dot in it *and*
Branch: 1 branch
BranchTrueFalseTotal
if (&Ewindows1258::index($leaf, ".") == -1 and length $leaf <= 8 and &Ewindows1258::index($pattern, "\\.") != -1) 0 0 0
Condition0%0/6
&Ewindows1258::index($leaf, ".") == -1 and length $leaf <= 8 and &Ewindows1258::index($pattern, "\\.") != -1
!ll&&!rl&&r
000
&Ewindows1258::index($leaf, ".") == -1 and length $leaf <= 8
!ll&&!rl&&r
000
MC/DC0%0/3
&Ewindows1258::index($leaf, ".") == -1 and length $leaf <= 8 and &Ewindows1258::index($pattern, "\\.") != -1
&Ewindows1258::index($leaf, ".") == -1 length $leaf <= 8 &Ewindows1258::index($pattern, "\\.") != -1
Truth table0%0/4
A and B and C
A= &Ewindows1258::index($leaf, ".") == -1B= length $leaf <= 8C= &Ewindows1258::index($pattern, "\\.") != -1
ABCresult
0XX0
10X0
1100
1111
2493 CORE::length($leaf) <= 8 and # name is shorter than or equal to 8 chars *and*
2494 Ewindows1258::index($pattern,'\\.') != -1 # pattern has a dot.
2495 ) {
2496 0 ▶ if (&$matchsub("$leaf.")) {
Branch: 1 branch
BranchTrueFalseTotal
if (&$matchsub("$leaf.")) 0 0 0
2497 0 push @matched, "$head$leaf";
2498 0 next INNER;
2499 }
2500 }
2501 }
2502 0 ▶ if (@matched) {
Branch: 1 branch
BranchTrueFalseTotal
if (@matched) 0 0 0
2503 0 push @glob, @matched;
2504 }
2505 }
2506 0 ▶ if ($fix_drive_relative_paths) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fix_drive_relative_paths) 0 0 0
2507 0 for my $glob (@glob) {
2508 0 $glob =~ s# \A ([A-Za-z]:) \./ #$1#oxms;
2509 }
2510 }
2511 0 return @glob;
2512 }
2513  
2514 #
2515 # Windows-1258 parse line
2516 #
2517 0 ▶sub _parse_line {
Subroutine _parse_line: not called CC=3 SCAR=24.8
2518  
2519 0 my($line) = @_;
2520  
2521 0 $line .= ' ';
2522 0 my @piece = ();
2523 0 ▶ while ($line =~ /
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ / " ( (?>(?: [^"] )* ) ) " (?>\s+) | ( (?>(?: [^"\s] )* ) ) (?>\s+) /gmosx) 0 0 0
2524 " ( (?>(?: [^"] )* ) ) " (?>\s+) |
2525 ( (?>(?: [^"\s] )* ) ) (?>\s+)
2526 /oxmsg
2527 ) {
2528 0 ▶ push @piece, defined($1) ? $1 : $2;
Branch: 1 branch
BranchTrueFalseTotal
defined $1 ? : 0 0 0
2529 }
2530 0 return @piece;
2531 }
2532  
2533 #
2534 # Windows-1258 parse path
2535 #
2536 0 ▶sub _parse_path {
Subroutine _parse_path: not called CC=2 SCAR=17.9
2537  
2538 0 my($path,$pathsep) = @_;
2539  
2540 0 $path .= '/';
2541 0 my @subpath = ();
2542 0 ▶ while ($path =~ /
Branch: 1 branch
BranchTrueFalseTotal
if ($path =~ m( ((?: [^/\\] )+?) [/\\] )gmosx) 0 0 0
2543 ((?: [^\/\\] )+?) [\/\\]
2544 /oxmsg
2545 ) {
2546 0 push @subpath, $1;
2547 }
2548  
2549 0 my $tail = pop @subpath;
2550 0 my $head = join $pathsep, @subpath;
2551 0 return $head, $tail;
2552 }
2553  
2554 #
2555 # via File::HomeDir::Windows 1.00
2556 #
2557 0 ▶sub my_home_MSWin32 {
Subroutine my_home_MSWin32: not called CC=9 SCAR=45.0
Pod undocumented
2558  
2559 # A lot of unix people and unix-derived tools rely on
2560 # the ability to overload HOME. We will support it too
2561 # so that they can replace raw HOME calls with File::HomeDir.
2562 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
2563 0 return $ENV{'HOME'};
2564 }
2565  
2566 # Do we have a user profile?
2567 ▶ 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
2568 0 return $ENV{'USERPROFILE'};
2569 }
2570  
2571 # Some Windows use something like $ENV{'HOME'}
2572 ▶ 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
2573 0 return join '', $ENV{'HOMEDRIVE'}, $ENV{'HOMEPATH'};
2574 }
2575  
2576 0 return undef;
2577 }
2578  
2579 #
2580 # via File::HomeDir::Unix 1.00
2581 #
2582 0 ▶sub my_home {
Subroutine my_home: not called CC=7 SCAR=40.3
Pod undocumented
2583 0 my $home;
2584  
2585 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
2586 0 $home = $ENV{'HOME'};
2587 }
2588  
2589 # This is from the original code, but I'm guessing
2590 # it means "login directory" and exists on some Unixes.
2591 ▶ 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
2592 0 $home = $ENV{'LOGDIR'};
2593 }
2594  
2595 ### More-desperate methods
2596  
2597 # Light desperation on any (Unixish) platform
2598 else {
2599 0 $home = CORE::eval q{ (getpwuid($<))[7] };
2600 }
2601  
2602 # On Unix in general, a non-existant home means "no home"
2603 # For example, "nobody"-like users might use /nonexistant
2604 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
2605 0 $home = undef;
2606 }
2607 0 return $home;
2608 }
2609  
2610 #
2611 # ${^PREMATCH}, $PREMATCH, $` the string preceding what was matched
2612 #
2613 56 ▶sub Ewindows1258::PREMATCH {
Subroutine PREMATCH: called CC=1 SCAR=0.0
Pod undocumented
2614 56 return $`;
2615 }
2616  
2617 #
2618 # ${^MATCH}, $MATCH, $& the string that matched
2619 #
2620 81 ▶sub Ewindows1258::MATCH {
Subroutine MATCH: called CC=1 SCAR=0.0
Pod undocumented
2621 81 return $&;
2622 }
2623  
2624 #
2625 # ${^POSTMATCH}, $POSTMATCH, $' the string following what was matched
2626 #
2627 42 ▶sub Ewindows1258::POSTMATCH {
Subroutine POSTMATCH: called CC=1 SCAR=0.0
Pod undocumented
2628 42 return $';
2629 }
2630  
2631 #
2632 # Windows-1258 character to order (with parameter)
2633 #
2634 0 ▶sub Windows1258::ord(;$) {
Subroutine ord: not called CC=4 SCAR=30.0
2635  
2636 0 ▶ local $_ = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
2637  
2638 0 ▶ if (/\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\A ($Ewindows1258::q_char) /mosx) { } 0 0 0
2639 0 my @ord = unpack 'C*', $1;
2640 0 my $ord = 0;
2641 0 ▶ while (my $o = shift @ord) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $o = shift @ord) 0 0 0
2642 0 $ord = $ord * 0x100 + $o;
2643 }
2644 0 return $ord;
2645 }
2646 else {
2647 0 return CORE::ord $_;
2648 }
2649 }
2650  
2651 #
2652 # Windows-1258 character to order (without parameter)
2653 #
2654 0 ▶sub Windows1258::ord_() {
Subroutine ord_: not called CC=3 SCAR=24.8
2655  
2656 0 ▶ if (/\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\A ($Ewindows1258::q_char) /mosx) { } 0 0 0
2657 0 my @ord = unpack 'C*', $1;
2658 0 my $ord = 0;
2659 0 ▶ while (my $o = shift @ord) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $o = shift @ord) 0 0 0
2660 0 $ord = $ord * 0x100 + $o;
2661 }
2662 0 return $ord;
2663 }
2664 else {
2665 0 return CORE::ord $_;
2666 }
2667 }
2668  
2669 #
2670 # Windows-1258 reverse
2671 #
2672 0 ▶sub Windows1258::reverse(@) {
Subroutine reverse: not called CC=2 SCAR=17.9
2673  
2674 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2675 0 return CORE::reverse @_;
2676 }
2677 else {
2678  
2679 # One of us once cornered Larry in an elevator and asked him what
2680 # problem he was solving with this, but he looked as far off into
2681 # the distance as he could in an elevator and said, "It seemed like
2682 # a good idea at the time."
2683  
2684 0 return join '', CORE::reverse(join('',@_) =~ /\G ($q_char) /oxmsg);
2685 }
2686 }
2687  
2688 #
2689 # Windows-1258 getc (with parameter, without parameter)
2690 #
2691 20 ▶sub Windows1258::getc(;*@) {
Subroutine getc: called CC=9 SCAR=26.7
2692  
2693 20 my($package) = caller;
2694 20 ▶ my $fh = @_ ? qualify_to_ref(shift,$package) : \*STDIN;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 20 0 20
2695 20 ▶ croak 'Too many arguments for Windows1258::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
2696  
2697 0 my @length = sort { $a <=> $b } keys %range_tr;
2698 20 my $getc = '';
2699 20 for my $length ($length[0] .. $length[-1]) {
2700 20 $getc .= CORE::getc($fh);
2701 20 ▶ if (exists $range_tr{CORE::length($getc)}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{length $getc}) 20 0 20
2702 20 ▶ if ($getc =~ /\A ${Ewindows1258::dot_s} \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($getc =~ /\A $Ewindows1258::dot_s \z/mosx) 20 0 20
2703 20 ▶ return wantarray ? ($getc,@_) : $getc;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 20 20
2704 }
2705 }
2706 }
2707 0 ▶ return wantarray ? ($getc,@_) : $getc;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
2708 }
2709  
2710 #
2711 # Windows-1258 length by character
2712 #
2713 0 ▶sub Windows1258::length(;$) {
Subroutine length: not called CC=2 SCAR=17.9
2714  
2715 0 ▶ local $_ = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
2716  
2717 0 local @_ = /\G ($q_char) /oxmsg;
2718 0 return scalar @_;
2719 }
2720  
2721 #
2722 # Windows-1258 substr by character
2723 #
2724 424 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=7.0
2725  
2726 # P.232 The lvalue Attribute
2727 # in Chapter 6: Subroutines
2728 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2729  
2730 # P.336 The lvalue Attribute
2731 # in Chapter 7: Subroutines
2732 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2733  
2734 # P.144 8.4 Lvalue subroutines
2735 # in Chapter 8: perlsub: Perl subroutines
2736 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
2737  
2738 0 ▶ CORE::eval sprintf(<<'END', ($] >= 5.014000) ? ':lvalue' : '');
Subroutine __ANON__: not called CC=1 SCAR=0.0
Subroutine __ANON__: not called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: not called CC=1 SCAR=0.0
Subroutine substr: called CC=11 SCAR=24.3
Branch: 10 branches
BranchTrueFalseTotal
$] >= 5.014 ? : 424 0 424
if ($offset > scalar @char or $offset < -1 * scalar(@char)) 2 25 27
if (@_ == 4) { } 1 24 25
elsif (@_ == 3) { } 21 3 24
if ($offset == 0) { } 0 21 21
elsif ($offset > 0) { } 20 1 21
if ($length == 0) { } 0 21 21
elsif ($length > 0) { } 20 1 21
if ($offset == 0) { } 0 3 3
elsif ($offset > 0) { } 2 1 3
Condition66%2/3
$offset > scalar @char or $offset < -1 * scalar(@char)
l!l&&r!l&&!r
2025
MC/DC50%1/2
$offset > scalar @char or $offset < -1 * scalar(@char)
$offset > scalar @char $offset < -1 * scalar(@char)
Truth table66%2/3
A or B
A= $offset > scalar @charB= $offset < -1 * scalar(@char)
ABresult
1X1
011
000
2739 # vv----------------------*******
2740 sub Windows1258::substr($$;$$) %s {
2741  
2742 my @char = $_[0] =~ /\G (?>$q_char) /oxmsg;
2743  
2744 # If the substring is beyond either end of the string, substr() returns the undefined
2745 # value and produces a warning. When used as an lvalue, specifying a substring that
2746 # is entirely outside the string raises an exception.
2747 # http://perldoc.perl.org/functions/substr.html
2748  
2749 # A return with no argument returns the scalar value undef in scalar context,
2750 # an empty list () in list context, and (naturally) nothing at all in void
2751 # context.
2752  
2753 my $offset = $_[1];
2754 if (($offset > scalar(@char)) or ($offset < (-1 * scalar(@char)))) {
2755 return;
2756 }
2757  
2758 # substr($string,$offset,$length,$replacement)
2759 if (@_ == 4) {
2760 my(undef,undef,$length,$replacement) = @_;
2761 my $substr = join '', splice(@char, $offset, $length, $replacement);
2762 $_[0] = join '', @char;
2763  
2764 # return $substr; this doesn't work, don't say "return"
2765 $substr;
2766 }
2767  
2768 # substr($string,$offset,$length)
2769 elsif (@_ == 3) {
2770 my(undef,undef,$length) = @_;
2771 my $octet_offset = 0;
2772 my $octet_length = 0;
2773 if ($offset == 0) {
2774 $octet_offset = 0;
2775 }
2776 elsif ($offset > 0) {
2777 local $SIG{__WARN__} = sub {}; # avoid: Use of uninitialized value in join or string at here
2778 $octet_offset = CORE::length(join '', @char[0..$offset-1]);
2779 }
2780 else {
2781 local $SIG{__WARN__} = sub {}; # avoid: Use of uninitialized value in join or string at here
2782 $octet_offset = -1 * CORE::length(join '', @char[$#char+$offset+1..$#char]);
2783 }
2784 if ($length == 0) {
2785 $octet_length = 0;
2786 }
2787 elsif ($length > 0) {
2788 local $SIG{__WARN__} = sub {}; # avoid: Use of uninitialized value in join or string at here
2789 $octet_length = CORE::length(join '', @char[$offset..$offset+$length-1]);
2790 }
2791 else {
2792 local $SIG{__WARN__} = sub {}; # avoid: Use of uninitialized value in join or string at here
2793 $octet_length = -1 * CORE::length(join '', @char[$#char+$length+1..$#char]);
2794 }
2795 CORE::substr($_[0], $octet_offset, $octet_length);
2796 }
2797  
2798 # substr($string,$offset)
2799 else {
2800 my $octet_offset = 0;
2801 if ($offset == 0) {
2802 $octet_offset = 0;
2803 }
2804 elsif ($offset > 0) {
2805 $octet_offset = CORE::length(join '', @char[0..$offset-1]);
2806 }
2807 else {
2808 $octet_offset = -1 * CORE::length(join '', @char[$#char+$offset+1..$#char]);
2809 }
2810 CORE::substr($_[0], $octet_offset);
2811 }
2812 }
2813 END
2814 }
2815  
2816 #
2817 # Windows-1258 index by character
2818 #
2819 0 ▶sub Windows1258::index($$;$) {
Subroutine index: not called CC=3 SCAR=24.8
2820  
2821 0 my $index;
2822 0 ▶ if (@_ == 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 3) { } 0 0 0
2823 0 $index = Ewindows1258::index($_[0], $_[1], CORE::length(Windows1258::substr($_[0], 0, $_[2])));
2824 }
2825 else {
2826 0 $index = Ewindows1258::index($_[0], $_[1]);
2827 }
2828  
2829 0 ▶ if ($index == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($index == -1) { } 0 0 0
2830 0 return -1;
2831 }
2832 else {
2833 0 return Windows1258::length(CORE::substr $_[0], 0, $index);
2834 }
2835 }
2836  
2837 #
2838 # Windows-1258 rindex by character
2839 #
2840 0 ▶sub Windows1258::rindex($$;$) {
Subroutine rindex: not called CC=3 SCAR=24.8
2841  
2842 0 my $rindex;
2843 0 ▶ if (@_ == 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 3) { } 0 0 0
2844 0 $rindex = Ewindows1258::rindex($_[0], $_[1], CORE::length(Windows1258::substr($_[0], 0, $_[2])));
2845 }
2846 else {
2847 0 $rindex = Ewindows1258::rindex($_[0], $_[1]);
2848 }
2849  
2850 0 ▶ if ($rindex == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rindex == -1) { } 0 0 0
2851 0 return -1;
2852 }
2853 else {
2854 0 return Windows1258::length(CORE::substr $_[0], 0, $rindex);
2855 }
2856 }
2857  
2858 # when 'm//', '/' means regexp match 'm//' and '?' means regexp match '??'
2859 # when 'div', '/' means division operator and '?' means conditional operator (condition ? then : else)
2860 424 ▶use vars qw($slash); $slash = 'm//';
Subroutine BEGIN: called CC=1 SCAR=0.0
2861  
2862 # ord() to ord() or Windows1258::ord()
2863 424 my $function_ord = 'ord';
2864  
2865 # ord to ord or Windows1258::ord_
2866 424 my $function_ord_ = 'ord';
2867  
2868 # reverse to reverse or Windows1258::reverse
2869 424 my $function_reverse = 'reverse';
2870  
2871 # getc to getc or Windows1258::getc
2872 424 my $function_getc = 'getc';
2873  
2874 # P.1023 Appendix W.9 Multibyte Anchoring
2875 # of ISBN 1-56592-224-7 CJKV Information Processing
2876  
2877 424 my $anchor = '';
2878  
2879 424 ▶use vars qw($nest);
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
2880  
2881 # regexp of nested parens in qqXX
2882  
2883 # P.340 Matching Nested Constructs with Embedded Code
2884 # in Chapter 7: Perl
2885 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
2886  
2887 my $qq_paren = qr{(?{local $nest=0}) (?>(?:
2888 [^\\()] |
2889 \( (?{$nest++}) |
2890 \) (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2891 \\ [^c] |
2892 \\c[\x40-\x5F] |
2893 [\x00-\xFF]
2894 424 }xms;
2895  
2896 my $qq_brace = qr{(?{local $nest=0}) (?>(?:
2897 [^\\{}] |
2898 \{ (?{$nest++}) |
2899 \} (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2900 \\ [^c] |
2901 \\c[\x40-\x5F] |
2902 [\x00-\xFF]
2903 424 }xms;
2904  
2905 my $qq_bracket = qr{(?{local $nest=0}) (?>(?:
2906 [^\\\[\]] |
2907 \[ (?{$nest++}) |
2908 \] (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2909 \\ [^c] |
2910 \\c[\x40-\x5F] |
2911 [\x00-\xFF]
2912 424 }xms;
2913  
2914 my $qq_angle = qr{(?{local $nest=0}) (?>(?:
2915 [^\\<>] |
2916 \< (?{$nest++}) |
2917 \> (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2918 \\ [^c] |
2919 \\c[\x40-\x5F] |
2920 [\x00-\xFF]
2921 424 }xms;
2922  
2923 424 my $qq_scalar = qr{(?: \{ (?:$qq_brace)*? \} |
2924 (?: ::)? (?:
2925 (?> [a-zA-Z_][a-zA-Z_0-9]* (?: ::[a-zA-Z_][a-zA-Z_0-9]*)* )
2926 (?>(?: \[ (?: \$\[ | \$\] | $qq_char )*? \] | \{ (?:$qq_brace)*? \} )*)
2927 (?>(?: (?: -> )? (?: [\$\@\%\&\*]\* | \$\#\* | [\@\%]? \[ (?: \$\[ | \$\] | $qq_char )*? \] | [\@\%\*]? \{ (?:$qq_brace)*? \} ) )*)
2928 ))
2929 }xms;
2930  
2931 424 my $qq_variable = qr{(?: \{ (?:$qq_brace)*? \} |
2932 (?: ::)? (?:
2933 (?>[0-9]+) |
2934 [^a-zA-Z_0-9\[\]] |
2935 ^[A-Z] |
2936 (?> [a-zA-Z_][a-zA-Z_0-9]* (?: ::[a-zA-Z_][a-zA-Z_0-9]*)* )
2937 (?>(?: \[ (?: \$\[ | \$\] | $qq_char )*? \] | \{ (?:$qq_brace)*? \} )*)
2938 (?>(?: (?: -> )? (?: [\$\@\%\&\*]\* | \$\#\* | [\@\%]? \[ (?: \$\[ | \$\] | $qq_char )*? \] | [\@\%\*]? \{ (?:$qq_brace)*? \} ) )*)
2939 ))
2940 }xms;
2941  
2942 424 my $qq_substr = qr{(?> Char::substr | Windows1258::substr | CORE::substr | substr ) (?>\s*) \( $qq_paren \)
2943 }xms;
2944  
2945 # regexp of nested parens in qXX
2946 my $q_paren = qr{(?{local $nest=0}) (?>(?:
2947 [^()] |
2948 \( (?{$nest++}) |
2949 \) (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2950 [\x00-\xFF]
2951 424 }xms;
2952  
2953 my $q_brace = qr{(?{local $nest=0}) (?>(?:
2954 [^\{\}] |
2955 \{ (?{$nest++}) |
2956 \} (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2957 [\x00-\xFF]
2958 424 }xms;
2959  
2960 my $q_bracket = qr{(?{local $nest=0}) (?>(?:
2961 [^\[\]] |
2962 \[ (?{$nest++}) |
2963 \] (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2964 [\x00-\xFF]
2965 424 }xms;
2966  
2967 my $q_angle = qr{(?{local $nest=0}) (?>(?:
2968 [^<>] |
2969 \< (?{$nest++}) |
2970 \> (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2971 [\x00-\xFF]
2972 424 }xms;
2973  
2974 424 my $matched = '';
2975 424 my $s_matched = '';
2976  
2977 424 my $tr_variable = ''; # variable of tr///
2978 424 my $sub_variable = ''; # variable of s///
2979 424 my $bind_operator = ''; # =~ or !~
2980  
2981 424 my @heredoc = (); # here document
2982 424 my @heredoc_delimiter = ();
2983 424 my $here_script = ''; # here script
2984  
2985 #
2986 # escape Windows-1258 script
2987 #
2988 548 ▶sub Windows1258::escape(;$) {
Subroutine escape: called CC=3 SCAR=11.0
2989 548 ▶ local($_) = $_[0] if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 292 256 548
2990  
2991 # P.359 The Study Function
2992 # in Chapter 7: Perl
2993 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
2994  
2995 548 study $_; # Yes, I studied study yesterday.
2996  
2997 # while all script
2998  
2999 # 6.14. Matching from Where the Last Pattern Left Off
3000 # in Chapter 6. Pattern Matching
3001 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
3002 # (and so on)
3003  
3004 # one member of Tag-team
3005 #
3006 # P.128 Start of match (or end of previous match): \G
3007 # P.130 Advanced Use of \G with Perl
3008 # in Chapter 3: Overview of Regular Expression Features and Flavors
3009 # P.255 Use leading anchors
3010 # P.256 Expose ^ and \G at the front expressions
3011 # in Chapter 6: Crafting an Efficient Expression
3012 # P.315 "Tag-team" matching with /gc
3013 # in Chapter 7: Perl
3014 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3015  
3016 548 my $e_script = '';
3017 548 ▶ while (not /\G \z/oxgc) { # member
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 87184 548 87732
3018 87184 $e_script .= Windows1258::escape_token();
3019 }
3020  
3021 548 return $e_script;
3022 }
3023  
3024 #
3025 # escape Windows-1258 token of script
3026 #
3027 87184 ▶sub Windows1258::escape_token {
Subroutine escape_token: called CC=504 SCAR=109.3
3028  
3029 # \n output here document
3030  
3031 87184 my $ignore_modules = join('|', qw(
3032 utf8
3033 bytes
3034 charnames
3035 I18N::Japanese
3036 I18N::Collate
3037 I18N::JExt
3038 File::DosGlob
3039 Wild
3040 Wildcard
3041 Japanese
3042 ));
3043  
3044 # another member of Tag-team
3045 #
3046 # P.315 "Tag-team" matching with /gc
3047 # in Chapter 7: Perl
3048 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3049  
3050 87184 ▶ if (/\G ( \n ) /oxgc) { # another member (and so on)
Branch: 139 branches
BranchTrueFalseTotal
if (/\G ( \n ) /cgox) { } 12796 74388 87184
elsif (/\G ((?>\s+)|\#.*) /cgox) { } 21222 53166 74388
elsif (/\G ( (?: if | elsif | unless | while | until | given | when ) (?>\s*) \( ) /cgox) { } 1644 51522 53166
elsif (/\G ( \( (?>\s*) (?: local \b | my \b | our \b | state \b )? (?>\s*) \$ $qq_scalar ) /cgox) { } 90 51432 51522
elsif (/\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /cgmosx) { } 4 51428 51432
elsif (/\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /cgmosx) { } 28 51400 51428
elsif (/\G ( \$' | \$\{'\} ) /cgmosx) { } 1 51399 51400
elsif (/\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /cgmosx) { } 3 51396 51399
elsif (/\G ( \$ $qq_scalar | $qq_substr ) /cgox) { } 1754 49642 51396
elsif (/\G ( [,;] ) /cgox) { } 5053 44589 49642
elsif (/\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /cgmosx) { } 0 44589 44589
elsif (/\G ( \$ 0 ) /cgmosx) { } 2 44587 44589
elsif (/\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /cgmosx) { } 0 44587 44587
elsif (/\G ( \$ \$ ) (?![\w\{]) /cgmosx) { } 1 44586 44587
elsif (/\G \$ ((?>[1-9][0-9]*)) /cgmosx) { } 4 44582 44586
elsif (/\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /cgmosx) { } 0 44582 44582
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /cgmosx) { } 0 44582 44582
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /cgmosx) { } 0 44582 44582
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /cgmosx) { } 0 44582 44582
elsif (/\G \$ (?>\s*) \{ ( (?>\s*) (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* ) (?>\s*) ) \} /cgmosx) { } 0 44582 44582
elsif (/\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /cgmosx) { } 0 44582 44582
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 44540 44582
elsif (m{\G ( \$[\$\@\#\\\'\"/\?\(\)\[\]\<\>] ) }cgmosx) { } 63 44477 44540
elsif (/\G \b (while (?>\s*) \( (?>\s*) <[\$]?[A-Za-z_][A-Za-z_0-9]*> (?>\s*) \)) \b /cgox) { } 0 44477 44477
elsif (/\G \b while (?>\s*) \( (?>\s*) < ((?:[^>\0\a\e\f\n\r\t])+?) > (?>\s*) \) \b /cgox) { } 0 44477 44477
elsif (/\G \b while (?>\s*) \( (?>\s*) glob (?>\s*) \) /cgox) { } 0 44477 44477
elsif (/\G \b while (?>\s*) \( (?>\s*) glob \b /cgox) { } 0 44477 44477
elsif (/\G \b ( if | unless | while | until | for | when ) \b /cgox) { } 251 44226 44477
elsif (/\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /cgox) { } 19 44207 44226
elsif (/\G \b Char::eval (?= (?>\s*) \{ ) /cgox) { } 0 44207 44207
elsif (/\G \b Windows1258::eval (?= (?>\s*) \{ ) /cgox) { } 22 44185 44207
elsif (/\G \b Char::eval \b (?! (?>\s*) => ) /cgox) { } 0 44185 44185
elsif (/\G \b Windows1258::eval \b (?! (?>\s*) => ) /cgox) { } 168 44017 44185
elsif (/\G \b bytes::substr \b (?! (?>\s*) => ) /cgox) { } 2 44015 44017
elsif (/\G \b chop \b (?! (?>\s*) => ) /cgox) { } 0 44015 44015
elsif (/\G \b bytes::index \b (?! (?>\s*) => ) /cgox) { } 2 44013 44015
elsif (/\G \b Char::index \b (?! (?>\s*) => ) /cgox) { } 0 44013 44013
elsif (/\G \b Windows1258::index \b (?! (?>\s*) => ) /cgox) { } 0 44013 44013
elsif (/\G \b index \b (?! (?>\s*) => ) /cgox) { } 0 44013 44013
elsif (/\G \b bytes::rindex \b (?! (?>\s*) => ) /cgox) { } 2 44011 44013
elsif (/\G \b Char::rindex \b (?! (?>\s*) => ) /cgox) { } 0 44011 44011
elsif (/\G \b Windows1258::rindex \b (?! (?>\s*) => ) /cgox) { } 0 44011 44011
elsif (/\G \b rindex \b (?! (?>\s*) => ) /cgox) { } 0 44011 44011
elsif (/\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 1 44010 44011
elsif (/\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 44010 44010
elsif (/\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 1 44009 44010
elsif (/\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 44009 44009
elsif (/\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 6 44003 44009
elsif (/\G -s (?>\s*) (\") ((?:$Ewindows1258::qq_char)+?) (\") /cgox) { } 0 44003 44003
elsif (/\G -s (?>\s+) qq (?>\s*) (\#) ((?:$Ewindows1258::qq_char)+?) (\#) /cgox) { } 0 44003 44003
elsif (/\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /cgox) { } 0 44003 44003
elsif (/\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /cgox) { } 0 44003 44003
elsif (/\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /cgox) { } 0 44003 44003
elsif (/\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /cgox) { } 0 44003 44003
elsif (/\G -s (?>\s+) qq (?>\s*) (\S) ((?:$Ewindows1258::qq_char)+?) (\1) /cgox) { } 0 44003 44003
elsif (/\G -s (?>\s*) (\') ((?:\\\'|\\\\|$Ewindows1258::q_char)+?) (\') /cgox) { } 0 44003 44003
elsif (/\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$Ewindows1258::q_char)+?) (\#) /cgox) { } 0 44003 44003
elsif (/\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /cgox) { } 0 44003 44003
elsif (/\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /cgox) { } 0 44003 44003
elsif (/\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /cgox) { } 0 44003 44003
elsif (/\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /cgox) { } 0 44003 44003
elsif (/\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$Ewindows1258::q_char)+?) (\1) /cgox) { } 0 44003 44003
elsif (/\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)* ) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ) )*) /cgox) { } 0 44003 44003
elsif (/\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /cgox) { } 0 44003 44003
elsif (/\G -s (?= (?>\s+) [a-z]+) /cgox) { } 0 44003 44003
elsif (/\G -s (?>\s+) ((?>\w+)) /cgox) { } 0 44003 44003
elsif (/\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 44001 44003
elsif (/\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43999 44001
elsif (/\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 36 43963 43999
elsif (/\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43961 43963
elsif (/\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 8 43953 43961
elsif (/\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43953 43953
elsif (/\G \b lc \b (?! (?>\s*) => ) /cgox) { } 0 43953 43953
elsif (/\G \b lcfirst \b (?! (?>\s*) => ) /cgox) { } 0 43953 43953
elsif (/\G \b uc \b (?! (?>\s*) => ) /cgox) { } 0 43953 43953
elsif (/\G \b ucfirst \b (?! (?>\s*) => ) /cgox) { } 0 43953 43953
elsif (/\G \b fc \b (?! (?>\s*) => ) /cgox) { } 0 43953 43953
elsif (/\G -s \b (?! (?>\s*) => ) /cgox) { } 0 43953 43953
elsif (/\G \b bytes::length \b (?! (?>\s*) => ) /cgox) { } 0 43953 43953
elsif (/\G \b bytes::chr \b (?! (?>\s*) => ) /cgox) { } 0 43953 43953
elsif (/\G \b chr \b (?! (?>\s*) => ) /cgox) { } 0 43953 43953
elsif (/\G \b bytes::ord \b (?! (?>\s*) => ) /cgox) { } 0 43953 43953
elsif (/\G \b ord \b (?! (?>\s*) => ) /cgox) { } 0 43953 43953
elsif (/\G \b glob \b (?! (?>\s*) => ) /cgox) { } 0 43953 43953
elsif (/\G \b reverse \b (?! (?>\s*) => ) /cgox) { } 0 43953 43953
elsif (/\G \b getc \b (?! (?>\s*) => ) /cgox) { } 8 43945 43953
elsif (/\G \b (split) \b (?! (?>\s*) => ) /cgox) { } 87 43858 43945
elsif (/\G \b ( tr | y ) \b /cgox) { } 4 43854 43858
elsif (/\G \b (qq) \b /cgox) { } 2252 41602 43854
elsif (/\G \b (qr) \b /cgox) { } 0 41602 41602
elsif (/\G \b (qw) \b /cgox) { } 16 41586 41602
elsif (/\G \b (qx) \b /cgox) { } 0 41586 41586
elsif (/\G \b (q) \b /cgox) { } 473 41113 41586
elsif (/\G \b (m) \b /cgox) { } 209 40904 41113
elsif (/\G \b (s) \b /cgox) { } 101 40803 40904
elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 0 40803 40803
elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 40803 40803
elsif (/\G \b require ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 40803 40803
elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [#\n]) /cgmosx) { } 37 40766 40803
elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 40766 40766
elsif (/\G \b use ((?>\s+) strict) \b /cgmosx) { } 0 40766 40766
elsif (/\G \b use (?>\s+) ((?>([1-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /cgmosx) { } 2 40764 40766
elsif (/\G \b use (?>\s+) ((?>v([0-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /cgmosx) { } 0 40764 40764
elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 2 40762 40764
elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 40762 40762
elsif (/\G \b use ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 40762 40762
elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 0 40762 40762
elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 40762 40762
elsif (/\G \b no ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 40762 40762
elsif (/\G \b use \b /cgmosx) { } 0 40762 40762
elsif (/\G \b no \b /cgmosx) { } 2 40760 40762
elsif (/\G (?<![\w\$\@\%\&\*]) (\') /cgox) { } 1142 39618 40760
elsif (/\G (\") /cgox) { } 1853 37765 39618
elsif (/\G (\`) /cgox) { } 1 37764 37765
elsif ($Ewindows1258::slash eq 'm//' and m[\G (/) ]cgox) { } 681 37083 37764
elsif ($Ewindows1258::slash eq 'm//' and /\G (\?) /cgox) { } 0 37083 37083
elsif (/\G ( <<>> ) /cgox) { } 0 37083 37083
elsif (/\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /cgox) { } 0 37083 37083
elsif (/\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /cgox) { } 6 37077 37083
elsif (/\G ( <<~ \\([a-zA-Z_0-9]+) ) /cgox) { } 3 37074 37077
elsif (/\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /cgox) { } 6 37068 37074
elsif (/\G ( <<~ ([a-zA-Z_0-9]+) ) /cgox) { } 3 37065 37068
elsif (/\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /cgox) { } 6 37059 37065
elsif (/\G ( << '([a-zA-Z_0-9]*)' ) /cgox) { } 72 36987 37059
elsif (/\G ( << \\([a-zA-Z_0-9]+) ) /cgox) { } 0 36987 36987
elsif (/\G ( << "([a-zA-Z_0-9]*)" ) /cgox) { } 36 36951 36987
elsif (/\G ( << ([a-zA-Z_0-9]+) ) /cgox) { } 42 36909 36951
elsif (/\G ( << `([a-zA-Z_0-9]*)` ) /cgox) { } 0 36909 36909
elsif (/\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/cgox) { } 12 36897 36909
elsif (/\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /cgox) { } 0 36897 36897
elsif (/\G < ((?:[^>\0\a\e\f\n\r\t])+?) > /cgox) { } 0 36897 36897
elsif (/\G ^ ( __DATA__ \n .*) \z /cgmosx) { } 0 36897 36897
elsif (/\G ^ ( __END__ \n .*) \z /cgmosx) { } 210 36687 36897
elsif (/\G ( \cD .*) \z /cgmosx) { } 0 36687 36687
elsif (/\G ( \cZ .*) \z /cgmosx) { } 0 36687 36687
elsif (/\G ( -- | \+\+ | [\)\}\]] ) /cgox) { } 5839 30848 36687
elsif (/\G ( \.\.\. ) /cgox) { } 7 30841 30848
elsif (m"\G ((?> !~~ | !~ | != | ! | %= | % | &&= | && | &= | &\.= | &\. | & | -= | -> | - | :(?>\s*)= | : | <<>> | <<= | <=> | <= | < | == | => | =~ | = | >>= | >> | >= | > | \*\*= | \*\* | \*= | \* | \+= | \+ | \.\. | \.= | \. | //= | // | /= | / | \? | \\ | \^= | \^\.= | \^\. | \^ | \b x= | \|\|= | \|\| | \|= | \|\.= | \|\. | \| | ~~ | ~\. | ~ | \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b | \b(?: print )\b | [,;\(\{\[] )) "cgox) { } 9763 21078 30841
elsif (/\G ($Ewindows1258::q_char) /cgox) { } 21078 0 21078
3051 12796 my $heredoc = '';
3052 12796 ▶ if (scalar(@heredoc_delimiter) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @heredoc_delimiter >= 1) 174 12622 12796
3053 174 $slash = 'm//';
3054  
3055 174 $heredoc = join '', @heredoc;
3056 174 @heredoc = ();
3057  
3058 # skip here document
3059 174 for my $heredoc_delimiter (@heredoc_delimiter) {
3060 174 /\G .*? \n $heredoc_delimiter \n/xmsgc;
3061 }
3062 174 @heredoc_delimiter = ();
3063  
3064 174 $here_script = '';
3065 }
3066 12796 return "\n" . $heredoc;
3067 }
3068  
3069 # ignore space, comment
3070 21222 elsif (/\G ((?>\s+)|\#.*) /oxgc) { return $1; }
3071  
3072 # if (, elsif (, unless (, while (, until (, given (, and when (
3073  
3074 # given, when
3075  
3076 # P.225 The given Statement
3077 # in Chapter 15: Smart Matching and given-when
3078 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
3079  
3080 # P.133 The given Statement
3081 # in Chapter 4: Statements and Declarations
3082 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
3083  
3084 elsif (/\G ( (?: if | elsif | unless | while | until | given | when ) (?>\s*) \( ) /oxgc) {
3085 1644 $slash = 'm//';
3086 1644 return $1;
3087 }
3088  
3089 # scalar variable ($scalar = ...) =~ tr///;
3090 # scalar variable ($scalar = ...) =~ s///;
3091  
3092 # state
3093  
3094 # P.68 Persistent, Private Variables
3095 # in Chapter 4: Subroutines
3096 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
3097  
3098 # P.160 Persistent Lexically Scoped Variables: state
3099 # in Chapter 4: Statements and Declarations
3100 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
3101  
3102 # (and so on)
3103  
3104 elsif (/\G ( \( (?>\s*) (?: local \b | my \b | our \b | state \b )? (?>\s*) \$ $qq_scalar ) /oxgc) {
3105 90 my $e_string = e_string($1);
3106  
3107 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
3108 0 $tr_variable = $e_string . e_string($1);
3109 0 $bind_operator = $2;
3110 0 $slash = 'm//';
3111 0 return '';
3112 }
3113 elsif (/\G ( (?>\s*) = $qq_paren \) ) ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /oxgc) {
3114 0 $sub_variable = $e_string . e_string($1);
3115 0 $bind_operator = $2;
3116 0 $slash = 'm//';
3117 0 return '';
3118 }
3119 else {
3120 90 $slash = 'div';
3121 90 return $e_string;
3122 }
3123 }
3124  
3125 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Ewindows1258::PREMATCH()
3126 elsif (/\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /oxmsgc) {
3127 4 $slash = 'div';
3128 4 return q{Ewindows1258::PREMATCH()};
3129 }
3130  
3131 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Ewindows1258::MATCH()
3132 elsif (/\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /oxmsgc) {
3133 28 $slash = 'div';
3134 28 return q{Ewindows1258::MATCH()};
3135 }
3136  
3137 # $', ${'} --> $', ${'}
3138 elsif (/\G ( \$' | \$\{'\} ) /oxmsgc) {
3139 1 $slash = 'div';
3140 1 return $1;
3141 }
3142  
3143 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Ewindows1258::POSTMATCH()
3144 elsif (/\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /oxmsgc) {
3145 3 $slash = 'div';
3146 3 return q{Ewindows1258::POSTMATCH()};
3147 }
3148  
3149 # scalar variable $scalar =~ tr///;
3150 # scalar variable $scalar =~ s///;
3151 # substr() =~ tr///;
3152 # substr() =~ s///;
3153 elsif (/\G ( \$ $qq_scalar | $qq_substr ) /oxgc) {
3154 1754 my $scalar = e_string($1);
3155  
3156 1754 ▶ if (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= (?: tr | y ) \b ) /oxgc) {
Branch: 2 branches
BranchTrueFalseTotal
if (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= (?: tr | y ) \b ) /cgox) { } 2 1752 1754
elsif (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /cgox) { } 65 1687 1752
3157 2 $tr_variable = $scalar;
3158 2 $bind_operator = $1;
3159 2 $slash = 'm//';
3160 2 return '';
3161 }
3162 elsif (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /oxgc) {
3163 65 $sub_variable = $scalar;
3164 65 $bind_operator = $1;
3165 65 $slash = 'm//';
3166 65 return '';
3167 }
3168 else {
3169 1687 $slash = 'div';
3170 1687 return $scalar;
3171 }
3172 }
3173  
3174 # end of statement
3175 elsif (/\G ( [,;] ) /oxgc) {
3176 5053 $slash = 'm//';
3177  
3178 # clear tr/// variable
3179 5053 $tr_variable = '';
3180  
3181 # clear s/// variable
3182 5053 $sub_variable = '';
3183  
3184 5053 $bind_operator = '';
3185  
3186 5053 return $1;
3187 }
3188  
3189 # bareword
3190 elsif (/\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /oxmsgc) {
3191 0 return $1;
3192 }
3193  
3194 # $0 --> $0
3195 elsif (/\G ( \$ 0 ) /oxmsgc) {
3196 2 $slash = 'div';
3197 2 return $1;
3198 }
3199 elsif (/\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /oxmsgc) {
3200 0 $slash = 'div';
3201 0 return $1;
3202 }
3203  
3204 # $$ --> $$
3205 elsif (/\G ( \$ \$ ) (?![\w\{]) /oxmsgc) {
3206 1 $slash = 'div';
3207 1 return $1;
3208 }
3209  
3210 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
3211 # $1, $2, $3 --> $1, $2, $3 otherwise
3212 elsif (/\G \$ ((?>[1-9][0-9]*)) /oxmsgc) {
3213 4 $slash = 'div';
3214 4 return e_capture($1);
3215 }
3216 elsif (/\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /oxmsgc) {
3217 0 $slash = 'div';
3218 0 return e_capture($1);
3219 }
3220  
3221 # $$foo[ ... ] --> $ $foo->[ ... ]
3222 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /oxmsgc) {
3223 0 $slash = 'div';
3224 0 return e_capture($1.'->'.$2);
3225 }
3226  
3227 # $$foo{ ... } --> $ $foo->{ ... }
3228 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /oxmsgc) {
3229 0 $slash = 'div';
3230 0 return e_capture($1.'->'.$2);
3231 }
3232  
3233 # $$foo
3234 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /oxmsgc) {
3235 0 $slash = 'div';
3236 0 return e_capture($1);
3237 }
3238  
3239 # ${ foo }
3240 elsif (/\G \$ (?>\s*) \{ ( (?>\s*) (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* ) (?>\s*) ) \} /oxmsgc) {
3241 0 $slash = 'div';
3242 0 return '${' . $1 . '}';
3243 }
3244  
3245 # ${ ... }
3246 elsif (/\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /oxmsgc) {
3247 0 $slash = 'div';
3248 0 return e_capture($1);
3249 }
3250  
3251 # variable or function
3252 # $ @ % & * $ #
3253 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) {
3254 42 $slash = 'div';
3255 42 return $1;
3256 }
3257 # $ $ $ $ $ $ $ $ $ $ $ $ $ $
3258 # $ @ # \ ' " / ? ( ) [ ] < >
3259 elsif (/\G ( \$[\$\@\#\\\'\"\/\?\(\)\[\]\<\>] ) /oxmsgc) {
3260 63 $slash = 'div';
3261 63 return $1;
3262 }
3263  
3264 # while (<FILEHANDLE>)
3265 elsif (/\G \b (while (?>\s*) \( (?>\s*) <[\$]?[A-Za-z_][A-Za-z_0-9]*> (?>\s*) \)) \b /oxgc) {
3266 0 return $1;
3267 }
3268  
3269 # while (<WILDCARD>) --- glob
3270  
3271 # avoid "Error: Runtime exception" of perl version 5.005_03
3272  
3273 elsif (/\G \b while (?>\s*) \( (?>\s*) < ((?:[^>\0\a\e\f\n\r\t])+?) > (?>\s*) \) \b /oxgc) {
3274 0 return 'while ($_ = Ewindows1258::glob("' . $1 . '"))';
3275 }
3276  
3277 # while (glob)
3278 elsif (/\G \b while (?>\s*) \( (?>\s*) glob (?>\s*) \) /oxgc) {
3279 0 return 'while ($_ = Ewindows1258::glob_)';
3280 }
3281  
3282 # while (glob(WILDCARD))
3283 elsif (/\G \b while (?>\s*) \( (?>\s*) glob \b /oxgc) {
3284 0 return 'while ($_ = Ewindows1258::glob';
3285 }
3286  
3287 # doit if, doit unless, doit while, doit until, doit for, doit when
3288 251 elsif (/\G \b ( if | unless | while | until | for | when ) \b /oxgc) { $slash = 'm//'; return $1; }
3289  
3290 # subroutines of package Ewindows1258
3291 19 elsif (/\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /oxgc) { $slash = 'm//'; return $1; }
3292 0 elsif (/\G \b Char::eval (?= (?>\s*) \{ ) /oxgc) { $slash = 'm//'; return 'eval'; }
3293 22 elsif (/\G \b Windows1258::eval (?= (?>\s*) \{ ) /oxgc) { $slash = 'm//'; return 'eval'; }
3294 0 elsif (/\G \b Char::eval \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'eval Char::escape'; }
3295 168 elsif (/\G \b Windows1258::eval \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'eval Windows1258::escape'; }
3296 2 elsif (/\G \b bytes::substr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'substr'; }
3297 0 elsif (/\G \b chop \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ewindows1258::chop'; }
3298 2 elsif (/\G \b bytes::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'index'; }
3299 0 elsif (/\G \b Char::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Char::index'; }
3300 0 elsif (/\G \b Windows1258::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Windows1258::index'; }
3301 0 elsif (/\G \b index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ewindows1258::index'; }
3302 2 elsif (/\G \b bytes::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'rindex'; }
3303 0 elsif (/\G \b Char::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Char::rindex'; }
3304 0 elsif (/\G \b Windows1258::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Windows1258::rindex'; }
3305 0 elsif (/\G \b rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ewindows1258::rindex'; }
3306 1 elsif (/\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Ewindows1258::lc'; }
3307 0 elsif (/\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Ewindows1258::lcfirst'; }
3308 1 elsif (/\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Ewindows1258::uc'; }
3309 0 elsif (/\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Ewindows1258::ucfirst'; }
3310 6 elsif (/\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Ewindows1258::fc'; }
3311  
3312 # "-s '' ..." means file test "-s 'filename' ..." (not means "- s/// ...")
3313 0 elsif (/\G -s (?>\s*) (\") ((?:$qq_char)+?) (\") /oxgc) { $slash = 'm//'; return '-s ' . e_qq('', $1,$3,$2); }
3314 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\#) ((?:$qq_char)+?) (\#) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3315 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3316 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3317 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3318 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3319 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\S) ((?:$qq_char)+?) (\1) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3320  
3321 0 elsif (/\G -s (?>\s*) (\') ((?:\\\'|\\\\|$q_char)+?) (\') /oxgc) { $slash = 'm//'; return '-s ' . e_q ('', $1,$3,$2); }
3322 0 elsif (/\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$q_char)+?) (\#) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3323 0 elsif (/\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3324 0 elsif (/\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3325 0 elsif (/\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3326 0 elsif (/\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3327 0 elsif (/\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$q_char)+?) (\1) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3328  
3329 elsif (/\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)* ) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ) )*) /oxgc)
3330 0 { $slash = 'm//'; return "-s $1"; }
3331 0 elsif (/\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /oxgc) { $slash = 'm//'; return "-s ($1)"; }
3332 0 elsif (/\G -s (?= (?>\s+) [a-z]+) /oxgc) { $slash = 'm//'; return '-s'; }
3333 0 elsif (/\G -s (?>\s+) ((?>\w+)) /oxgc) { $slash = 'm//'; return "-s $1"; }
3334  
3335 2 elsif (/\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'length'; }
3336 2 elsif (/\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'chr'; }
3337 36 elsif (/\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Ewindows1258::chr'; }
3338 2 elsif (/\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'div'; return 'ord'; }
3339 8 elsif (/\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'div'; return $function_ord; }
3340 0 elsif (/\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Ewindows1258::glob'; }
3341 0 elsif (/\G \b lc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ewindows1258::lc_'; }
3342 0 elsif (/\G \b lcfirst \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ewindows1258::lcfirst_'; }
3343 0 elsif (/\G \b uc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ewindows1258::uc_'; }
3344 0 elsif (/\G \b ucfirst \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ewindows1258::ucfirst_'; }
3345 0 elsif (/\G \b fc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ewindows1258::fc_'; }
3346 0 elsif (/\G -s \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return '-s '; }
3347  
3348 0 elsif (/\G \b bytes::length \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'length'; }
3349 0 elsif (/\G \b bytes::chr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'chr'; }
3350 0 elsif (/\G \b chr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ewindows1258::chr_'; }
3351 0 elsif (/\G \b bytes::ord \b (?! (?>\s*) => ) /oxgc) { $slash = 'div'; return 'ord'; }
3352 0 elsif (/\G \b ord \b (?! (?>\s*) => ) /oxgc) { $slash = 'div'; return $function_ord_; }
3353 0 elsif (/\G \b glob \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ewindows1258::glob_'; }
3354 0 elsif (/\G \b reverse \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return $function_reverse; }
3355 8 elsif (/\G \b getc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return $function_getc; }
3356 # split
3357 elsif (/\G \b (split) \b (?! (?>\s*) => ) /oxgc) {
3358 87 $slash = 'm//';
3359  
3360 87 my $e = '';
3361 87 ▶ while (/\G ( (?>\s+) | \( | \#.* ) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\G ( (?>\s+) | \( | \#.* ) /cgox) 85 87 172
3362 85 $e .= $1;
3363 }
3364  
3365 # end of split
3366 87 ▶ if (/\G (?= [,;\)\}\]] ) /oxgc) { return 'Ewindows1258::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
3367  
3368 # split scalar value
3369 1 elsif (/\G ( [\$\@\&\*] $qq_scalar ) /oxgc) { return 'Ewindows1258::split' . $e . e_string($1); }
3370  
3371 # split literal space
3372 0 elsif (/\G \b qq (\#) [ ] (\#) /oxgc) { return 'Ewindows1258::split' . $e . qq {qq$1 $2}; }
3373 0 elsif (/\G \b qq ((?>\s*)) (\() [ ] (\)) /oxgc) { return 'Ewindows1258::split' . $e . qq{$1qq$2 $3}; }
3374 0 elsif (/\G \b qq ((?>\s*)) (\{) [ ] (\}) /oxgc) { return 'Ewindows1258::split' . $e . qq{$1qq$2 $3}; }
3375 0 elsif (/\G \b qq ((?>\s*)) (\[) [ ] (\]) /oxgc) { return 'Ewindows1258::split' . $e . qq{$1qq$2 $3}; }
3376 0 elsif (/\G \b qq ((?>\s*)) (\<) [ ] (\>) /oxgc) { return 'Ewindows1258::split' . $e . qq{$1qq$2 $3}; }
3377 0 elsif (/\G \b qq ((?>\s*)) (\S) [ ] (\2) /oxgc) { return 'Ewindows1258::split' . $e . qq{$1qq$2 $3}; }
3378 0 elsif (/\G \b q (\#) [ ] (\#) /oxgc) { return 'Ewindows1258::split' . $e . qq {q$1 $2}; }
3379 0 elsif (/\G \b q ((?>\s*)) (\() [ ] (\)) /oxgc) { return 'Ewindows1258::split' . $e . qq {$1q$2 $3}; }
3380 0 elsif (/\G \b q ((?>\s*)) (\{) [ ] (\}) /oxgc) { return 'Ewindows1258::split' . $e . qq {$1q$2 $3}; }
3381 0 elsif (/\G \b q ((?>\s*)) (\[) [ ] (\]) /oxgc) { return 'Ewindows1258::split' . $e . qq {$1q$2 $3}; }
3382 0 elsif (/\G \b q ((?>\s*)) (\<) [ ] (\>) /oxgc) { return 'Ewindows1258::split' . $e . qq {$1q$2 $3}; }
3383 0 elsif (/\G \b q ((?>\s*)) (\S) [ ] (\2) /oxgc) { return 'Ewindows1258::split' . $e . qq {$1q$2 $3}; }
3384 10 elsif (/\G ' [ ] ' /oxgc) { return 'Ewindows1258::split' . $e . qq {' '}; }
3385 0 elsif (/\G " [ ] " /oxgc) { return 'Ewindows1258::split' . $e . qq {" "}; }
3386  
3387 # split qq//
3388 elsif (/\G \b (qq) \b /oxgc) {
3389 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Ewindows1258::qq_char)*?) (\#) /cgox) { } 0 0 0
3390 else {
3391 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3392 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 ([*\-:?\\^|]) ((?:$Ewindows1258::qq_char)*?) (\1) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Ewindows1258::qq_char)*?) (\1) /cgox) { } 0 0 0
3393 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq ( ) --> qr ( )
3394 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq { } --> qr { }
3395 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq [ ] --> qr [ ]
3396 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq < > --> qr < >
3397 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) /oxgc) { return e_split($e.'qr','{','}',$2,''); } # qq | | --> qr { }
3398 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq * * --> qr * *
3399 }
3400 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3401 }
3402 }
3403  
3404 # split qr//
3405 elsif (/\G \b (qr) \b /oxgc) {
3406 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1,$3,$2,$4); } # qr# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Ewindows1258::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 12 12
3407 else {
3408 12 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 12 0 12
3409 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 (\') ((?:$Ewindows1258::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 12 12
elsif (/\G ([*\-:?\\^|]) ((?:$Ewindows1258::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 12 12
elsif (/\G (\S) ((?:$Ewindows1258::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 12 0 12
3410 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr ( )
3411 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr { }
3412 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr [ ]
3413 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr < >
3414 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { return e_split_q($e.'qr',$1, $3, $2,$4); } # qr ' '
3415 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr','{','}',$2,$4); } # qr | | --> qr { }
3416 12 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr * *
3417 }
3418 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3419 }
3420 }
3421  
3422 # split q//
3423 elsif (/\G \b (q) \b /oxgc) {
3424 0 ▶ if (/\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:\\\#|\\\\|$Ewindows1258::q_char)*?) (\#) /cgox) { } 0 0 0
3425 else {
3426 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3427 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 ([*\-:?\\^|]) ((?:$Ewindows1258::q_char)*?) (\1) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:\\\\|\\\1| $Ewindows1258::q_char)*?) (\1) /cgox) { } 0 0 0
3428 0 elsif (/\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q ( ) --> qr ( )
3429 0 elsif (/\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q { } --> qr { }
3430 0 elsif (/\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q [ ] --> qr [ ]
3431 0 elsif (/\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q < > --> qr < >
3432 0 elsif (/\G ([*\-:?\\^|]) ((?:$q_char)*?) (\1) /oxgc) { return e_split_q($e.'qr','{','}',$2,''); } # q | | --> qr { }
3433 0 elsif (/\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q * * --> qr * *
3434 }
3435 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3436 }
3437 }
3438  
3439 # split m//
3440 elsif (/\G \b (m) \b /oxgc) {
3441 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1,$3,$2,$4); } # m# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Ewindows1258::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
3442 else {
3443 18 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 18 0 18
3444 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 (\') ((?:$Ewindows1258::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
elsif (/\G ([*\-:?\\^|]) ((?:$Ewindows1258::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
elsif (/\G (\S) ((?:$Ewindows1258::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 18 0 18
3445 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m ( ) --> qr ( )
3446 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m { } --> qr { }
3447 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m [ ] --> qr [ ]
3448 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m < > --> qr < >
3449 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { return e_split_q($e.'qr',$1, $3, $2,$4); } # m ' ' --> qr ' '
3450 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr','{','}',$2,$4); } # m | | --> qr { }
3451 18 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m * * --> qr * *
3452 }
3453 0 die __FILE__, ": Search pattern not terminated\n";
3454 }
3455 }
3456  
3457 # split ''
3458 elsif (/\G (\') /oxgc) {
3459 0 my $q_string = '';
3460 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3461 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 ($Ewindows1258::q_char) /cgox) { } 0 0 0
3462 0 elsif (/\G (\\\') /oxgc) { $q_string .= $1; } # splitqr'' --> split qr''
3463 0 elsif (/\G \' /oxgc) { return e_split_q($e.q{ qr},"'","'",$q_string,''); } # ' ' --> qr ' '
3464 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3465 }
3466 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3467 }
3468  
3469 # split ""
3470 elsif (/\G (\") /oxgc) {
3471 0 my $qq_string = '';
3472 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3473 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 ($Ewindows1258::q_char) /cgox) { } 0 0 0
3474 0 elsif (/\G (\\\") /oxgc) { $qq_string .= $1; } # splitqr"" --> split qr""
3475 0 elsif (/\G \" /oxgc) { return e_split($e.q{ qr},'"','"',$qq_string,''); } # " " --> qr " "
3476 0 elsif (/\G ($q_char) /oxgc) { $qq_string .= $1; }
3477 }
3478 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3479 }
3480  
3481 # split //
3482 elsif (/\G (\/) /oxgc) {
3483 44 my $regexp = '';
3484 44 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 381 0 381
3485 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 ($Ewindows1258::q_char) /cgox) { } 337 0 337
3486 0 elsif (/\G (\\\/) /oxgc) { $regexp .= $1; } # splitqr// --> split qr//
3487 44 elsif (/\G \/ ([cgimosxpadlunbB]*) /oxgc) { return e_split($e.q{ qr}, '/','/',$regexp,$1); } # / / --> qr / /
3488 337 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
3489 }
3490 0 die __FILE__, ": Search pattern not terminated\n";
3491 }
3492 }
3493  
3494 # tr/// or y///
3495  
3496 # about [cdsrbB]* (/B modifier)
3497 #
3498 # P.559 appendix C
3499 # of ISBN 4-89052-384-7 Programming perl
3500 # (Japanese title is: Perl puroguramingu)
3501  
3502 elsif (/\G \b ( tr | y ) \b /oxgc) {
3503 4 my $ope = $1;
3504  
3505 # $1 $2 $3 $4 $5 $6
3506 4 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ((?:$qq_char)*?) (\#) ([cdsrbB]*) /oxgc) { # tr# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Ewindows1258::qq_char)*?) (\#) ((?:$Ewindows1258::qq_char)*?) (\#) ([cdsrbB]*) /cgox) { } 0 4 4
3507 0 my @tr = ($tr_variable,$2);
3508 0 return e_tr(@tr,'',$4,$6);
3509 }
3510 else {
3511 4 my $e = '';
3512 4 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 4 0 4
3513 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) ((?:$Ewindows1258::qq_char)*?) (\1) ((?:$Ewindows1258::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 4 0 4
3514 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) {
3515 0 my @tr = ($tr_variable,$2);
3516 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3517 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) ((?:$Ewindows1258::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3518 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) ( )
3519 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) { }
3520 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) [ ]
3521 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) < >
3522 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) * *
3523 }
3524 0 die __FILE__, ": Transliteration replacement not terminated\n";
3525 }
3526 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) {
3527 0 my @tr = ($tr_variable,$2);
3528 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3529 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) ((?:$Ewindows1258::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3530 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } ( )
3531 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } { }
3532 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } [ ]
3533 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } < >
3534 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } * *
3535 }
3536 0 die __FILE__, ": Transliteration replacement not terminated\n";
3537 }
3538 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) {
3539 0 my @tr = ($tr_variable,$2);
3540 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3541 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) ((?:$Ewindows1258::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3542 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] ( )
3543 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] { }
3544 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] [ ]
3545 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] < >
3546 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] * *
3547 }
3548 0 die __FILE__, ": Transliteration replacement not terminated\n";
3549 }
3550 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) {
3551 0 my @tr = ($tr_variable,$2);
3552 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3553 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Ewindows1258::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3554 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > ( )
3555 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > { }
3556 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > [ ]
3557 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > < >
3558 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > * *
3559 }
3560 0 die __FILE__, ": Transliteration replacement not terminated\n";
3561 }
3562 # $1 $2 $3 $4 $5 $6
3563 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { # tr * * *
3564 4 my @tr = ($tr_variable,$2);
3565 4 return e_tr(@tr,'',$4,$6);
3566 }
3567 }
3568 0 die __FILE__, ": Transliteration pattern not terminated\n";
3569 }
3570 }
3571  
3572 # qq//
3573 elsif (/\G \b (qq) \b /oxgc) {
3574 2252 my $ope = $1;
3575  
3576 # if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { return e_qq($ope,$1,$3,$2); } # qq# #
3577 2252 ▶ if (/\G (\#) /oxgc) { # qq# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) /cgox) { } 0 2252 2252
3578 0 my $qq_string = '';
3579 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3580 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 ($Ewindows1258::qq_char) /cgox) { } 0 0 0
3581 0 elsif (/\G (\\\#) /oxgc) { $qq_string .= $1; }
3582 0 elsif (/\G (\#) /oxgc) { return e_qq($ope,'#','#',$qq_string); }
3583 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3584 }
3585 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3586 }
3587  
3588 else {
3589 2252 my $e = '';
3590 2252 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 2252 0 2252
3591 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
3592  
3593 # elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq ( )
3594 elsif (/\G (\() /oxgc) { # qq ( )
3595 0 my $qq_string = '';
3596 0 local $nest = 1;
3597 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3598 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 ($Ewindows1258::qq_char) /cgox) { } 0 0 0
3599 0 elsif (/\G (\\\)) /oxgc) { $qq_string .= $1; }
3600 0 elsif (/\G (\() /oxgc) { $qq_string .= $1; $nest++; }
3601 elsif (/\G (\)) /oxgc) {
3602 0 ▶ if (--$nest == 0) { return $e . e_qq($ope,'(',')',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ewindows1258::nest == 0) { } 0 0 0
3603 0 else { $qq_string .= $1; }
3604 }
3605 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3606 }
3607 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3608 }
3609  
3610 # elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq { }
3611 elsif (/\G (\{) /oxgc) { # qq { }
3612 2222 my $qq_string = '';
3613 2222 local $nest = 1;
3614 2222 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 85169 0 85169
3615 85169 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 5 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 722 84447 85169
elsif (/\G (\\\}) /cgox) { } 0 84447 84447
elsif (/\G (\{) /cgox) { } 1189 83258 84447
elsif (/\G (\}) /cgox) { } 3411 79847 83258
elsif (/\G ($Ewindows1258::qq_char) /cgox) { } 79847 0 79847
3616 0 elsif (/\G (\\\}) /oxgc) { $qq_string .= $1; }
3617 1189 elsif (/\G (\{) /oxgc) { $qq_string .= $1; $nest++; }
3618 elsif (/\G (\}) /oxgc) {
3619 3411 ▶ if (--$nest == 0) { return $e . e_qq($ope,'{','}',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ewindows1258::nest == 0) { } 2222 1189 3411
3620 1189 else { $qq_string .= $1; }
3621 }
3622 79847 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3623 }
3624 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3625 }
3626  
3627 # elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq [ ]
3628 elsif (/\G (\[) /oxgc) { # qq [ ]
3629 0 my $qq_string = '';
3630 0 local $nest = 1;
3631 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3632 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 ($Ewindows1258::qq_char) /cgox) { } 0 0 0
3633 0 elsif (/\G (\\\]) /oxgc) { $qq_string .= $1; }
3634 0 elsif (/\G (\[) /oxgc) { $qq_string .= $1; $nest++; }
3635 elsif (/\G (\]) /oxgc) {
3636 0 ▶ if (--$nest == 0) { return $e . e_qq($ope,'[',']',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ewindows1258::nest == 0) { } 0 0 0
3637 0 else { $qq_string .= $1; }
3638 }
3639 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3640 }
3641 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3642 }
3643  
3644 # elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq < >
3645 elsif (/\G (\<) /oxgc) { # qq < >
3646 30 my $qq_string = '';
3647 30 local $nest = 1;
3648 30 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 1166 0 1166
3649 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 ($Ewindows1258::qq_char) /cgox) { } 1114 0 1114
3650 0 elsif (/\G (\\\>) /oxgc) { $qq_string .= $1; }
3651 0 elsif (/\G (\<) /oxgc) { $qq_string .= $1; $nest++; }
3652 elsif (/\G (\>) /oxgc) {
3653 30 ▶ if (--$nest == 0) { return $e . e_qq($ope,'<','>',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ewindows1258::nest == 0) { } 30 0 30
3654 0 else { $qq_string .= $1; }
3655 }
3656 1114 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3657 }
3658 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3659 }
3660  
3661 # elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq * *
3662 elsif (/\G (\S) /oxgc) { # qq * *
3663 0 my $delimiter = $1;
3664 0 my $qq_string = '';
3665 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3666 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 ($Ewindows1258::qq_char) /cgox) { } 0 0 0
3667 0 elsif (/\G (\\\Q$delimiter\E) /oxgc) { $qq_string .= $1; }
3668 0 elsif (/\G (\Q$delimiter\E) /oxgc) { return $e . e_qq($ope,$delimiter,$delimiter,$qq_string); }
3669 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3670 }
3671 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3672 }
3673 }
3674 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3675 }
3676 }
3677  
3678 # qr//
3679 elsif (/\G \b (qr) \b /oxgc) {
3680 0 my $ope = $1;
3681 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { # qr# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Ewindows1258::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 0 0
3682 0 return e_qr($ope,$1,$3,$2,$4);
3683 }
3684 else {
3685 0 my $e = '';
3686 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3687 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 (\') ((?:$Ewindows1258::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G ([*\-:?\\^|]) ((?:$Ewindows1258::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Ewindows1258::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
3688 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr ( )
3689 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr { }
3690 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr [ ]
3691 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr < >
3692 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { return $e . e_qr_q($ope,$1, $3, $2,$4); } # qr ' '
3693 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,'{','}',$2,$4); } # qr | | --> qr { }
3694 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr * *
3695 }
3696 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3697 }
3698 }
3699  
3700 # qw//
3701 elsif (/\G \b (qw) \b /oxgc) {
3702 16 my $ope = $1;
3703 16 ▶ if (/\G (\#) (.*?) (\#) /oxmsgc) { # qw# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) (.*?) (\#) /cgmosx) { } 0 16 16
3704 0 return e_qw($ope,$1,$3,$2);
3705 }
3706 else {
3707 16 my $e = '';
3708 16 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 16 0 16
3709 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) ((?:$Ewindows1258::q_char)*?) (\1) /cgmosx) { } 0 0 0
3710  
3711 16 elsif (/\G (\() ([^(]*?) (\)) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw ( )
3712 0 elsif (/\G (\() ((?:$q_paren)*?) (\)) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw ( )
3713  
3714 0 elsif (/\G (\{) ([^{]*?) (\}) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw { }
3715 0 elsif (/\G (\{) ((?:$q_brace)*?) (\}) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw { }
3716  
3717 0 elsif (/\G (\[) ([^[]*?) (\]) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw [ ]
3718 0 elsif (/\G (\[) ((?:$q_bracket)*?) (\]) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw [ ]
3719  
3720 0 elsif (/\G (\<) ([^<]*?) (\>) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw < >
3721 0 elsif (/\G (\<) ((?:$q_angle)*?) (\>) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw < >
3722  
3723 0 elsif (/\G ([\x21-\x3F]) (.*?) (\1) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw * *
3724 0 elsif (/\G (\S) ((?:$q_char)*?) (\1) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw * *
3725 }
3726 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3727 }
3728 }
3729  
3730 # qx//
3731 elsif (/\G \b (qx) \b /oxgc) {
3732 0 my $ope = $1;
3733 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qx# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Ewindows1258::qq_char)*?) (\#) /cgox) { } 0 0 0
3734 0 return e_qq($ope,$1,$3,$2);
3735 }
3736 else {
3737 0 my $e = '';
3738 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3739 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 (\') ((?:$Ewindows1258::qq_char)*?) (\') /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Ewindows1258::qq_char)*?) (\1) /cgox) { } 0 0 0
3740 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx ( )
3741 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx { }
3742 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx [ ]
3743 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx < >
3744 0 elsif (/\G (\') ((?:$qq_char)*?) (\') /oxgc) { return $e . e_q ($ope,$1,$3,$2); } # qx ' '
3745 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx * *
3746 }
3747 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3748 }
3749 }
3750  
3751 # q//
3752 elsif (/\G \b (q) \b /oxgc) {
3753 473 my $ope = $1;
3754  
3755 # if (/\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { return e_q($ope,$1,$3,$2); } # q# #
3756  
3757 # avoid "Error: Runtime exception" of perl version 5.005_03
3758 # (and so on)
3759  
3760 473 ▶ if (/\G (\#) /oxgc) { # q# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) /cgox) { } 0 473 473
3761 0 my $q_string = '';
3762 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3763 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 ($Ewindows1258::q_char) /cgox) { } 0 0 0
3764 0 elsif (/\G (\\\#) /oxgc) { $q_string .= $1; }
3765 0 elsif (/\G (\#) /oxgc) { return e_q($ope,'#','#',$q_string); }
3766 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3767 }
3768 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3769 }
3770  
3771 else {
3772 473 my $e = '';
3773 473 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 473 0 473
3774 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
3775  
3776 # elsif (/\G (\() ((?:\\\)|\\\\|$q_paren)*?) (\)) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q ( )
3777 elsif (/\G (\() /oxgc) { # q ( )
3778 0 my $q_string = '';
3779 0 local $nest = 1;
3780 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3781 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 ($Ewindows1258::q_char) /cgox) { } 0 0 0
3782 0 elsif (/\G (\\\)) /oxgc) { $q_string .= $1; }
3783 0 elsif (/\G (\\\() /oxgc) { $q_string .= $1; }
3784 0 elsif (/\G (\() /oxgc) { $q_string .= $1; $nest++; }
3785 elsif (/\G (\)) /oxgc) {
3786 0 ▶ if (--$nest == 0) { return $e . e_q($ope,'(',')',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ewindows1258::nest == 0) { } 0 0 0
3787 0 else { $q_string .= $1; }
3788 }
3789 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3790 }
3791 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3792 }
3793  
3794 # elsif (/\G (\{) ((?:\\\}|\\\\|$q_brace)*?) (\}) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q { }
3795 elsif (/\G (\{) /oxgc) { # q { }
3796 467 my $q_string = '';
3797 467 local $nest = 1;
3798 467 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 8314 0 8314
3799 0 ▶ if (/\G (\\\\) /oxgc) { $q_string .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 8314 8314
elsif (/\G (\\\}) /cgox) { } 0 8314 8314
elsif (/\G (\\\{) /cgox) { } 0 8314 8314
elsif (/\G (\{) /cgox) { } 159 8155 8314
elsif (/\G (\}) /cgox) { } 626 7529 8155
elsif (/\G ($Ewindows1258::q_char) /cgox) { } 7529 0 7529
3800 0 elsif (/\G (\\\}) /oxgc) { $q_string .= $1; }
3801 0 elsif (/\G (\\\{) /oxgc) { $q_string .= $1; }
3802 159 elsif (/\G (\{) /oxgc) { $q_string .= $1; $nest++; }
3803 elsif (/\G (\}) /oxgc) {
3804 626 ▶ if (--$nest == 0) { return $e . e_q($ope,'{','}',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ewindows1258::nest == 0) { } 467 159 626
3805 159 else { $q_string .= $1; }
3806 }
3807 7529 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3808 }
3809 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3810 }
3811  
3812 # elsif (/\G (\[) ((?:\\\]|\\\\|$q_bracket)*?) (\]) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q [ ]
3813 elsif (/\G (\[) /oxgc) { # q [ ]
3814 0 my $q_string = '';
3815 0 local $nest = 1;
3816 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3817 0 ▶ if (/\G (\\\\) /oxgc) { $q_string .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 0 0
elsif (/\G (\\\]) /cgox) { } 0 0 0
elsif (/\G (\\\[) /cgox) { } 0 0 0
elsif (/\G (\[) /cgox) { } 0 0 0
elsif (/\G (\]) /cgox) { } 0 0 0
elsif (/\G ($Ewindows1258::q_char) /cgox) { } 0 0 0
3818 0 elsif (/\G (\\\]) /oxgc) { $q_string .= $1; }
3819 0 elsif (/\G (\\\[) /oxgc) { $q_string .= $1; }
3820 0 elsif (/\G (\[) /oxgc) { $q_string .= $1; $nest++; }
3821 elsif (/\G (\]) /oxgc) {
3822 0 ▶ if (--$nest == 0) { return $e . e_q($ope,'[',']',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ewindows1258::nest == 0) { } 0 0 0
3823 0 else { $q_string .= $1; }
3824 }
3825 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3826 }
3827 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3828 }
3829  
3830 # elsif (/\G (\<) ((?:\\\>|\\\\|$q_angle)*?) (\>) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q < >
3831 elsif (/\G (\<) /oxgc) { # q < >
3832 5 my $q_string = '';
3833 5 local $nest = 1;
3834 5 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 88 0 88
3835 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 ($Ewindows1258::q_char) /cgox) { } 83 0 83
3836 0 elsif (/\G (\\\>) /oxgc) { $q_string .= $1; }
3837 0 elsif (/\G (\\\<) /oxgc) { $q_string .= $1; }
3838 0 elsif (/\G (\<) /oxgc) { $q_string .= $1; $nest++; }
3839 elsif (/\G (\>) /oxgc) {
3840 5 ▶ if (--$nest == 0) { return $e . e_q($ope,'<','>',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ewindows1258::nest == 0) { } 5 0 5
3841 0 else { $q_string .= $1; }
3842 }
3843 83 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3844 }
3845 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3846 }
3847  
3848 # elsif (/\G (\S) ((?:\\\1|\\\\|$q_char)*?) (\1) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q * *
3849 elsif (/\G (\S) /oxgc) { # q * *
3850 1 my $delimiter = $1;
3851 1 my $q_string = '';
3852 1 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 14 0 14
3853 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 ($Ewindows1258::q_char) /cgox) { } 13 0 13
3854 0 elsif (/\G (\\\Q$delimiter\E) /oxgc) { $q_string .= $1; }
3855 1 elsif (/\G (\Q$delimiter\E) /oxgc) { return $e . e_q($ope,$delimiter,$delimiter,$q_string); }
3856 13 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3857 }
3858 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3859 }
3860 }
3861 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3862 }
3863 }
3864  
3865 # m//
3866 elsif (/\G \b (m) \b /oxgc) {
3867 209 my $ope = $1;
3868 209 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { # m# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Ewindows1258::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
3869 0 return e_qr($ope,$1,$3,$2,$4);
3870 }
3871 else {
3872 209 my $e = '';
3873 209 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 209 0 209
3874 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 (\?) ((?:$Ewindows1258::qq_char)*?) (\?) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
elsif (/\G (\') ((?:$Ewindows1258::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 10 199 209
elsif (/\G ([*\-:\\^|]) ((?:$Ewindows1258::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 199 199
elsif (/\G (\S) ((?:$Ewindows1258::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 199 0 199
3875 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m ( )
3876 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m { }
3877 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m [ ]
3878 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m < >
3879 0 elsif (/\G (\?) ((?:$qq_char)*?) (\?) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m ? ?
3880 10 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr_q($ope,$1, $3, $2,$4); } # m ' '
3881 0 elsif (/\G ([*\-:\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,'{','}',$2,$4); } # m | | --> m { }
3882 199 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m * *
3883 }
3884 0 die __FILE__, ": Search pattern not terminated\n";
3885 }
3886 }
3887  
3888 # s///
3889  
3890 # about [cegimosxpradlunbB]* (/cg modifier)
3891 #
3892 # P.67 Pattern-Matching Operators
3893 # of ISBN 0-596-00241-6 Perl in a Nutshell, Second Edition.
3894  
3895 elsif (/\G \b (s) \b /oxgc) {
3896 101 my $ope = $1;
3897  
3898 # $1 $2 $3 $4 $5 $6
3899 101 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ((?:$qq_char)*?) (\#) ([cegimosxpradlunbB]*) /oxgc) { # s# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Ewindows1258::qq_char)*?) (\#) ((?:$Ewindows1258::qq_char)*?) (\#) ([cegimosxpradlunbB]*) /cgox) { } 1 100 101
3900 1 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3901 }
3902 else {
3903 100 my $e = '';
3904 100 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 100 0 100
3905 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 (\') ((?:$Ewindows1258::qq_char)*?) (\') ((?:$Ewindows1258::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 21 79 100
elsif (/\G ([*\-:?\\^|]) ((?:$Ewindows1258::qq_char)*?) (\1) ((?:$Ewindows1258::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 79 79
elsif (/\G (\$) ((?:$Ewindows1258::qq_char)*?) (\1) ((?:$Ewindows1258::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 79 79
elsif (/\G (\S) ((?:$Ewindows1258::qq_char)*?) (\1) ((?:$Ewindows1258::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 79 0 79
3906 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) {
3907 0 my @s = ($1,$2,$3);
3908 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3909 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 (\') ((?:$Ewindows1258::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Ewindows1258::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Ewindows1258::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Ewindows1258::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Ewindows1258::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3910 # $1 $2 $3 $4
3911 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3912 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3913 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3914 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3915 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3916 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3917 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3918 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3919 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3920 }
3921 0 die __FILE__, ": Substitution replacement not terminated\n";
3922 }
3923 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) {
3924 0 my @s = ($1,$2,$3);
3925 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3926 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 (\') ((?:$Ewindows1258::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Ewindows1258::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Ewindows1258::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Ewindows1258::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Ewindows1258::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3927 # $1 $2 $3 $4
3928 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3929 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3930 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3931 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3932 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3933 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3934 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3935 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3936 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3937 }
3938 0 die __FILE__, ": Substitution replacement not terminated\n";
3939 }
3940 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) {
3941 0 my @s = ($1,$2,$3);
3942 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3943 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 (\') ((?:$Ewindows1258::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Ewindows1258::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Ewindows1258::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3944 # $1 $2 $3 $4
3945 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3946 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3947 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3948 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3949 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3950 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3951 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3952 }
3953 0 die __FILE__, ": Substitution replacement not terminated\n";
3954 }
3955 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) {
3956 0 my @s = ($1,$2,$3);
3957 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3958 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 (\') ((?:$Ewindows1258::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Ewindows1258::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Ewindows1258::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Ewindows1258::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Ewindows1258::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3959 # $1 $2 $3 $4
3960 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3961 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3962 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3963 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3964 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3965 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3966 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3967 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3968 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3969 }
3970 0 die __FILE__, ": Substitution replacement not terminated\n";
3971 }
3972 # $1 $2 $3 $4 $5 $6
3973 elsif (/\G (\') ((?:$qq_char)*?) (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) {
3974 21 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3975 }
3976 # $1 $2 $3 $4 $5 $6
3977 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
3978 0 return e_sub($sub_variable,'{',$2,'}','{',$4,'}',$6); # s | | | --> s { } { }
3979 }
3980 # $1 $2 $3 $4 $5 $6
3981 elsif (/\G (\$) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
3982 0 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3983 }
3984 # $1 $2 $3 $4 $5 $6
3985 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
3986 79 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3987 }
3988 }
3989 0 die __FILE__, ": Substitution pattern not terminated\n";
3990 }
3991 }
3992  
3993 # require ignore module
3994 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# require$1$2"; }
3995 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# require$1\n$2"; }
3996 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# require$1"; }
3997  
3998 # use strict; --> use strict; no strict qw(refs);
3999 37 elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "use$1 no strict qw(refs);$2"; }
4000 0 elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [^#]) /oxmsgc) { return "use$1 no strict qw(refs);\n$2"; }
4001 0 elsif (/\G \b use ((?>\s+) strict) \b /oxmsgc) { return "use$1; no strict qw(refs)"; }
4002  
4003 # use 5.12.0; --> use 5.12.0; no strict qw(refs);
4004 elsif (/\G \b use (?>\s+) ((?>([1-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /oxmsgc) {
4005 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
4006 0 return "use $1; no strict qw(refs);";
4007 }
4008 else {
4009 2 return "use $1;";
4010 }
4011 }
4012 elsif (/\G \b use (?>\s+) ((?>v([0-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /oxmsgc) {
4013 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
4014 0 return "use $1; no strict qw(refs);";
4015 }
4016 else {
4017 0 return "use $1;";
4018 }
4019 }
4020  
4021 # ignore use module
4022 2 elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# use$1$2"; }
4023 0 elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# use$1\n$2"; }
4024 0 elsif (/\G \b use ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# use$1"; }
4025  
4026 # ignore no module
4027 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# no$1$2"; }
4028 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# no$1\n$2"; }
4029 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# no$1"; }
4030  
4031 # use else
4032 0 elsif (/\G \b use \b /oxmsgc) { return "use"; }
4033  
4034 # use else
4035 2 elsif (/\G \b no \b /oxmsgc) { return "no"; }
4036  
4037 # ''
4038 elsif (/\G (?<![\w\$\@\%\&\*]) (\') /oxgc) {
4039 1142 my $q_string = '';
4040 1142 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 10240 0 10240
4041 10240 ▶ if (/\G (\\\\) /oxgc) { $q_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 4 10236 10240
elsif (/\G (\\\') /cgox) { } 48 10188 10236
elsif (/\G \' /cgox) { } 1142 9046 10188
elsif (/\G ($Ewindows1258::q_char) /cgox) { } 9046 0 9046
4042 48 elsif (/\G (\\\') /oxgc) { $q_string .= $1; }
4043 1142 elsif (/\G \' /oxgc) { return e_q('', "'","'",$q_string); }
4044 9046 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
4045 }
4046 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4047 }
4048  
4049 # ""
4050 elsif (/\G (\") /oxgc) {
4051 1853 my $qq_string = '';
4052 1853 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 37914 0 37914
4053 37914 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 67 37847 37914
elsif (/\G (\\\") /cgox) { } 12 37835 37847
elsif (/\G \" /cgox) { } 1853 35982 37835
elsif (/\G ($Ewindows1258::q_char) /cgox) { } 35982 0 35982
4054 12 elsif (/\G (\\\") /oxgc) { $qq_string .= $1; }
4055 1853 elsif (/\G \" /oxgc) { return e_qq('', '"','"',$qq_string); }
4056 35982 elsif (/\G ($q_char) /oxgc) { $qq_string .= $1; }
4057 }
4058 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4059 }
4060  
4061 # ``
4062 elsif (/\G (\`) /oxgc) {
4063 1 my $qx_string = '';
4064 1 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 19 0 19
4065 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 ($Ewindows1258::q_char) /cgox) { } 18 0 18
4066 0 elsif (/\G (\\\`) /oxgc) { $qx_string .= $1; }
4067 1 elsif (/\G \` /oxgc) { return e_qq('', '`','`',$qx_string); }
4068 18 elsif (/\G ($q_char) /oxgc) { $qx_string .= $1; }
4069 }
4070 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4071 }
4072  
4073 # // --- not divide operator (num / num), not defined-or
4074 ▶ elsif (($slash eq 'm//') and /\G (\/) /oxgc) {
Condition100%3/3
$Ewindows1258::slash eq "m//" and m[\G (/) ]cgox
!ll&&!rl&&r
282358848681
MC/DC100%2/2
$Ewindows1258::slash eq "m//" and m[\G (/) ]cgox
$Ewindows1258::slash eq "m//" m[\G (/) ]cgox
Truth table100%3/3
A and B
A= $Ewindows1258::slash eq "m//"B= m[\G (/) ]cgox
ABresult
0X0
100
111
4075 681 my $regexp = '';
4076 681 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 5636 0 5636
4077 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 ($Ewindows1258::q_char) /cgox) { } 4955 0 4955
4078 0 elsif (/\G (\\\/) /oxgc) { $regexp .= $1; }
4079 681 elsif (/\G \/ ([cgimosxpadlunbB]*) /oxgc) { return e_qr('', '/','/',$regexp,$1); }
4080 4955 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
4081 }
4082 0 die __FILE__, ": Search pattern not terminated\n";
4083 }
4084  
4085 # ?? --- not conditional operator (condition ? then : else)
4086 ▶ elsif (($slash eq 'm//') and /\G (\?) /oxgc) {
Condition66%2/3
$Ewindows1258::slash eq "m//" and /\G (\?) /cgox
!ll&&!rl&&r
2823588480
MC/DC0%0/2
$Ewindows1258::slash eq "m//" and /\G (\?) /cgox
$Ewindows1258::slash eq "m//" /\G (\?) /cgox
Truth table66%2/3
A and B
A= $Ewindows1258::slash eq "m//"B= /\G (\?) /cgox
ABresult
0X0
100
111
4087 0 my $regexp = '';
4088 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
4089 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 ($Ewindows1258::q_char) /cgox) { } 0 0 0
4090 0 elsif (/\G (\\\?) /oxgc) { $regexp .= $1; }
4091 0 elsif (/\G \? ([cgimosxpadlunbB]*) /oxgc) { return e_qr('m','?','?',$regexp,$1); }
4092 0 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
4093 }
4094 0 die __FILE__, ": Search pattern not terminated\n";
4095 }
4096  
4097 # <<>> (a safer ARGV)
4098 0 elsif (/\G ( <<>> ) /oxgc) { $slash = 'm//'; return $1; }
4099  
4100 # << (bit shift) --- not here document
4101 0 elsif (/\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /oxgc) { $slash = 'm//'; return $1; }
4102  
4103 # <<~'HEREDOC'
4104 elsif (/\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /oxgc) {
4105 6 $slash = 'm//';
4106 6 my $here_quote = $1;
4107 6 my $delimiter = $2;
4108  
4109 # get here document
4110 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4111 6 $here_script = CORE::substr $_, pos $_;
4112 6 $here_script =~ s/.*?\n//oxm;
4113 }
4114 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
4115 6 my $heredoc = $1;
4116 6 my $indent = $2;
4117 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4118 6 push @heredoc, $heredoc . qq{\n$delimiter\n};
4119 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4120 }
4121 else {
4122 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4123 }
4124 6 return qq{<<'$delimiter'};
4125 }
4126  
4127 # <<~\HEREDOC
4128  
4129 # P.66 2.6.6. "Here" Documents
4130 # in Chapter 2: Bits and Pieces
4131 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4132  
4133 # P.73 "Here" Documents
4134 # in Chapter 2: Bits and Pieces
4135 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4136  
4137 elsif (/\G ( <<~ \\([a-zA-Z_0-9]+) ) /oxgc) {
4138 3 $slash = 'm//';
4139 3 my $here_quote = $1;
4140 3 my $delimiter = $2;
4141  
4142 # get here document
4143 3 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 3 0 3
4144 3 $here_script = CORE::substr $_, pos $_;
4145 3 $here_script =~ s/.*?\n//oxm;
4146 }
4147 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
4148 3 my $heredoc = $1;
4149 3 my $indent = $2;
4150 3 $heredoc =~ s{^$indent}{}msg; # no /ox
4151 3 push @heredoc, $heredoc . qq{\n$delimiter\n};
4152 3 push @heredoc_delimiter, qq{\\s*$delimiter};
4153 }
4154 else {
4155 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4156 }
4157 3 return qq{<<\\$delimiter};
4158 }
4159  
4160 # <<~"HEREDOC"
4161 elsif (/\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /oxgc) {
4162 6 $slash = 'm//';
4163 6 my $here_quote = $1;
4164 6 my $delimiter = $2;
4165  
4166 # get here document
4167 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4168 6 $here_script = CORE::substr $_, pos $_;
4169 6 $here_script =~ s/.*?\n//oxm;
4170 }
4171 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
4172 6 my $heredoc = $1;
4173 6 my $indent = $2;
4174 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4175 6 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4176 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4177 }
4178 else {
4179 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4180 }
4181 6 return qq{<<"$delimiter"};
4182 }
4183  
4184 # <<~HEREDOC
4185 elsif (/\G ( <<~ ([a-zA-Z_0-9]+) ) /oxgc) {
4186 3 $slash = 'm//';
4187 3 my $here_quote = $1;
4188 3 my $delimiter = $2;
4189  
4190 # get here document
4191 3 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 3 0 3
4192 3 $here_script = CORE::substr $_, pos $_;
4193 3 $here_script =~ s/.*?\n//oxm;
4194 }
4195 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
4196 3 my $heredoc = $1;
4197 3 my $indent = $2;
4198 3 $heredoc =~ s{^$indent}{}msg; # no /ox
4199 3 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4200 3 push @heredoc_delimiter, qq{\\s*$delimiter};
4201 }
4202 else {
4203 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4204 }
4205 3 return qq{<<$delimiter};
4206 }
4207  
4208 # <<~`HEREDOC`
4209 elsif (/\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /oxgc) {
4210 6 $slash = 'm//';
4211 6 my $here_quote = $1;
4212 6 my $delimiter = $2;
4213  
4214 # get here document
4215 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4216 6 $here_script = CORE::substr $_, pos $_;
4217 6 $here_script =~ s/.*?\n//oxm;
4218 }
4219 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
4220 6 my $heredoc = $1;
4221 6 my $indent = $2;
4222 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4223 6 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4224 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4225 }
4226 else {
4227 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4228 }
4229 6 return qq{<<`$delimiter`};
4230 }
4231  
4232 # <<'HEREDOC'
4233 elsif (/\G ( << '([a-zA-Z_0-9]*)' ) /oxgc) {
4234 72 $slash = 'm//';
4235 72 my $here_quote = $1;
4236 72 my $delimiter = $2;
4237  
4238 # get here document
4239 72 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 72 0 72
4240 72 $here_script = CORE::substr $_, pos $_;
4241 72 $here_script =~ s/.*?\n//oxm;
4242 }
4243 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
4244 72 push @heredoc, $1 . qq{\n$delimiter\n};
4245 72 push @heredoc_delimiter, $delimiter;
4246 }
4247 else {
4248 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4249 }
4250 72 return $here_quote;
4251 }
4252  
4253 # <<\HEREDOC
4254  
4255 # P.66 2.6.6. "Here" Documents
4256 # in Chapter 2: Bits and Pieces
4257 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4258  
4259 # P.73 "Here" Documents
4260 # in Chapter 2: Bits and Pieces
4261 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4262  
4263 elsif (/\G ( << \\([a-zA-Z_0-9]+) ) /oxgc) {
4264 0 $slash = 'm//';
4265 0 my $here_quote = $1;
4266 0 my $delimiter = $2;
4267  
4268 # get here document
4269 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4270 0 $here_script = CORE::substr $_, pos $_;
4271 0 $here_script =~ s/.*?\n//oxm;
4272 }
4273 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
4274 0 push @heredoc, $1 . qq{\n$delimiter\n};
4275 0 push @heredoc_delimiter, $delimiter;
4276 }
4277 else {
4278 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4279 }
4280 0 return $here_quote;
4281 }
4282  
4283 # <<"HEREDOC"
4284 elsif (/\G ( << "([a-zA-Z_0-9]*)" ) /oxgc) {
4285 36 $slash = 'm//';
4286 36 my $here_quote = $1;
4287 36 my $delimiter = $2;
4288  
4289 # get here document
4290 36 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 36 0 36
4291 36 $here_script = CORE::substr $_, pos $_;
4292 36 $here_script =~ s/.*?\n//oxm;
4293 }
4294 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
4295 36 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4296 36 push @heredoc_delimiter, $delimiter;
4297 }
4298 else {
4299 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4300 }
4301 36 return $here_quote;
4302 }
4303  
4304 # <<HEREDOC
4305 elsif (/\G ( << ([a-zA-Z_0-9]+) ) /oxgc) {
4306 42 $slash = 'm//';
4307 42 my $here_quote = $1;
4308 42 my $delimiter = $2;
4309  
4310 # get here document
4311 42 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 42 0 42
4312 42 $here_script = CORE::substr $_, pos $_;
4313 42 $here_script =~ s/.*?\n//oxm;
4314 }
4315 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
4316 42 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4317 42 push @heredoc_delimiter, $delimiter;
4318 }
4319 else {
4320 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4321 }
4322 42 return $here_quote;
4323 }
4324  
4325 # <<`HEREDOC`
4326 elsif (/\G ( << `([a-zA-Z_0-9]*)` ) /oxgc) {
4327 0 $slash = 'm//';
4328 0 my $here_quote = $1;
4329 0 my $delimiter = $2;
4330  
4331 # get here document
4332 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4333 0 $here_script = CORE::substr $_, pos $_;
4334 0 $here_script =~ s/.*?\n//oxm;
4335 }
4336 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
4337 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4338 0 push @heredoc_delimiter, $delimiter;
4339 }
4340 else {
4341 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4342 }
4343 0 return $here_quote;
4344 }
4345  
4346 # <<= <=> <= < operator
4347 elsif (/\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/oxgc) {
4348 12 return $1;
4349 }
4350  
4351 # <FILEHANDLE>
4352 elsif (/\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /oxgc) {
4353 0 return $1;
4354 }
4355  
4356 # <WILDCARD> --- glob
4357  
4358 # avoid "Error: Runtime exception" of perl version 5.005_03
4359  
4360 elsif (/\G < ((?:[^>\0\a\e\f\n\r\t])+?) > /oxgc) {
4361 0 return 'Ewindows1258::glob("' . $1 . '")';
4362 }
4363  
4364 # __DATA__
4365 0 elsif (/\G ^ ( __DATA__ \n .*) \z /oxmsgc) { return $1; }
4366  
4367 # __END__
4368 210 elsif (/\G ^ ( __END__ \n .*) \z /oxmsgc) { return $1; }
4369  
4370 # \cD Control-D
4371  
4372 # P.68 2.6.8. Other Literal Tokens
4373 # in Chapter 2: Bits and Pieces
4374 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4375  
4376 # P.76 Other Literal Tokens
4377 # in Chapter 2: Bits and Pieces
4378 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4379  
4380 0 elsif (/\G ( \cD .*) \z /oxmsgc) { return $1; }
4381  
4382 # \cZ Control-Z
4383 0 elsif (/\G ( \cZ .*) \z /oxmsgc) { return $1; }
4384  
4385 # any operator before div
4386 elsif (/\G (
4387 -- | \+\+ |
4388 [\)\}\]]
4389  
4390 5839 ) /oxgc) { $slash = 'div'; return $1; }
4391  
4392 # yada-yada or triple-dot operator
4393 elsif (/\G (
4394 \.\.\.
4395  
4396 7 ) /oxgc) { $slash = 'm//'; return q{die('Unimplemented')}; }
4397  
4398 # any operator before m//
4399  
4400 # //, //= (defined-or)
4401  
4402 # P.164 Logical Operators
4403 # in Chapter 10: More Control Structures
4404 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
4405  
4406 # P.119 C-Style Logical (Short-Circuit) Operators
4407 # in Chapter 3: Unary and Binary Operators
4408 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4409  
4410 # (and so on)
4411  
4412 # ~~
4413  
4414 # P.221 The Smart Match Operator
4415 # in Chapter 15: Smart Matching and given-when
4416 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
4417  
4418 # P.112 Smartmatch Operator
4419 # in Chapter 3: Unary and Binary Operators
4420 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4421  
4422 # (and so on)
4423  
4424 elsif (/\G ((?>
4425  
4426 !~~ | !~ | != | ! |
4427 %= | % |
4428 &&= | && | &= | &\.= | &\. | & |
4429 -= | -> | - |
4430 :(?>\s*)= |
4431 : |
4432 <<>> |
4433 <<= | <=> | <= | < |
4434 == | => | =~ | = |
4435 >>= | >> | >= | > |
4436 \*\*= | \*\* | \*= | \* |
4437 \+= | \+ |
4438 \.\. | \.= | \. |
4439 \/\/= | \/\/ |
4440 \/= | \/ |
4441 \? |
4442 \\ |
4443 \^= | \^\.= | \^\. | \^ |
4444 \b x= |
4445 \|\|= | \|\| | \|= | \|\.= | \|\. | \| |
4446 ~~ | ~\. | ~ |
4447 \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b |
4448 \b(?: print )\b |
4449  
4450 [,;\(\{\[]
4451  
4452 9763 )) /oxgc) { $slash = 'm//'; return $1; }
4453  
4454 # other any character
4455 21078 elsif (/\G ($q_char) /oxgc) { $slash = 'div'; return $1; }
4456  
4457 # system error
4458 else {
4459 0 die __FILE__, ": Oops, this shouldn't happen!\n";
4460 }
4461 }
4462  
4463 # escape Windows-1258 string
4464 1873 ▶sub e_string {
Subroutine e_string: called CC=54 SCAR=72.5
Pod documented
4465 1873 my($string) = @_;
4466 1873 my $e_string = '';
4467  
4468 1873 local $slash = 'm//';
4469  
4470 # P.1024 Appendix W.10 Multibyte Processing
4471 # of ISBN 1-56592-224-7 CJKV Information Processing
4472 # (and so on)
4473  
4474 1873 my @char = $string =~ / \G (?>[^\\]|\\$q_char|$q_char) /oxmsg;
4475  
4476 # without { ... }
4477 1873 ▶ if (not (grep(/\A \{ \z/xms, @char) and grep(/\A \} \z/xms, @char))) {
Branch: 1 branch
BranchTrueFalseTotal
unless (grep /\A \{ \z/msx, @char and grep /\A \} \z/msx, @char) 1854 19 1873
Condition66%2/3
grep /\A \{ \z/msx, @char and grep /\A \} \z/msx, @char
!ll&&!rl&&r
1854019
MC/DC50%1/2
grep /\A \{ \z/msx, @char and grep /\A \} \z/msx, @char
grep /\A \{ \z/msx, @char grep /\A \} \z/msx, @char
Truth table66%2/3
A and B
A= grep /\A \{ \z/msx, @charB= grep /\A \} \z/msx, @char
ABresult
0X0
100
111
4478 1854 ▶ if ($string !~ /<</oxms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /<</mosx) 1854 0 1854
4479 1854 return $string;
4480 }
4481 }
4482  
4483 E_STRING_LOOP:
4484 19 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 223 19 242
4485 223 ▶ if (0) {
Branch: 24 branches
BranchTrueFalseTotal
if (do { $string =~ /\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /cgmosx }) { } 0 223 223
elsif ($string =~ /\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G ( \$' | \$\{'\} ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G ( \$ 0 ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G ( \$ \$ ) (?![\w\{]) /cgmosx) { } 0 223 223
elsif ($string =~ /\G \$ ((?>[1-9][0-9]*)) /cgmosx) { } 0 223 223
elsif ($string =~ /\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /cgmosx) { } 0 223 223
elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /cgmosx) { } 0 223 223
elsif ($string =~ /\G \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} /cgmosx) { } 0 223 223
elsif ($string =~ /\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /cgmosx) { } 3 220 223
elsif ($string =~ /\G ( (?: [\$\@\%\&\*] | \$\# | -> | \b sub \b) (?>\s*) (?: split | chop | index | rindex | lc | uc | fc | chr | ord | reverse | getc | tr | y | q | qq | qx | qw | m | s | qr | glob | lstat | opendir | stat | unlink | chdir ) ) \b /cgmosx) { } 7 213 220
elsif ($string =~ m{\G ( \$[\$\@\#\\\'\"/\?\(\)\[\]\<\>] ) }cgmosx) { } 0 213 213
elsif ($string =~ /\G \b (qq) \b /cgox) { } 0 213 213
elsif ($string =~ /\G \b (qx) \b /cgox) { } 0 213 213
elsif ($string =~ /\G \b (q) \b /cgox) { } 0 213 213
elsif ($string =~ /\G (?<![\w\$\@\%\&\*]) (\') ((?:\\\'|\\\\|$Ewindows1258::q_char)*?) (\') /cgox) { } 0 213 213
elsif ($string =~ /\G (\") ((?:$Ewindows1258::qq_char)*?) (\") /cgox) { } 0 213 213
elsif ($string =~ /\G (\`) ((?:$Ewindows1258::qq_char)*?) (\`) /cgox) { } 0 213 213
elsif ($string =~ /\G ($Ewindows1258::q_char) /cgox) { } 213 0 213
4486 }
4487  
4488 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> @{[Ewindows1258::PREMATCH()]}
4489 elsif ($string =~ /\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /oxmsgc) {
4490 0 $e_string .= q{Ewindows1258::PREMATCH()};
4491 0 $slash = 'div';
4492 }
4493  
4494 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> @{[Ewindows1258::MATCH()]}
4495 elsif ($string =~ /\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /oxmsgc) {
4496 0 $e_string .= q{Ewindows1258::MATCH()};
4497 0 $slash = 'div';
4498 }
4499  
4500 # $', ${'} --> $', ${'}
4501 elsif ($string =~ /\G ( \$' | \$\{'\} ) /oxmsgc) {
4502 0 $e_string .= $1;
4503 0 $slash = 'div';
4504 }
4505  
4506 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> @{[Ewindows1258::POSTMATCH()]}
4507 elsif ($string =~ /\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /oxmsgc) {
4508 0 $e_string .= q{Ewindows1258::POSTMATCH()};
4509 0 $slash = 'div';
4510 }
4511  
4512 # bareword
4513 elsif ($string =~ /\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /oxmsgc) {
4514 0 $e_string .= $1;
4515 0 $slash = 'div';
4516 }
4517  
4518 # $0 --> $0
4519 elsif ($string =~ /\G ( \$ 0 ) /oxmsgc) {
4520 0 $e_string .= $1;
4521 0 $slash = 'div';
4522 }
4523 elsif ($string =~ /\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /oxmsgc) {
4524 0 $e_string .= $1;
4525 0 $slash = 'div';
4526 }
4527  
4528 # $$ --> $$
4529 elsif ($string =~ /\G ( \$ \$ ) (?![\w\{]) /oxmsgc) {
4530 0 $e_string .= $1;
4531 0 $slash = 'div';
4532 }
4533  
4534 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
4535 # $1, $2, $3 --> $1, $2, $3 otherwise
4536 elsif ($string =~ /\G \$ ((?>[1-9][0-9]*)) /oxmsgc) {
4537 0 $e_string .= e_capture($1);
4538 0 $slash = 'div';
4539 }
4540 elsif ($string =~ /\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /oxmsgc) {
4541 0 $e_string .= e_capture($1);
4542 0 $slash = 'div';
4543 }
4544  
4545 # $$foo[ ... ] --> $ $foo->[ ... ]
4546 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /oxmsgc) {
4547 0 $e_string .= e_capture($1.'->'.$2);
4548 0 $slash = 'div';
4549 }
4550  
4551 # $$foo{ ... } --> $ $foo->{ ... }
4552 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /oxmsgc) {
4553 0 $e_string .= e_capture($1.'->'.$2);
4554 0 $slash = 'div';
4555 }
4556  
4557 # $$foo
4558 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /oxmsgc) {
4559 0 $e_string .= e_capture($1);
4560 0 $slash = 'div';
4561 }
4562  
4563 # ${ foo }
4564 elsif ($string =~ /\G \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} /oxmsgc) {
4565 0 $e_string .= '${' . $1 . '}';
4566 0 $slash = 'div';
4567 }
4568  
4569 # ${ ... }
4570 elsif ($string =~ /\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /oxmsgc) {
4571 3 $e_string .= e_capture($1);
4572 3 $slash = 'div';
4573 }
4574  
4575 # variable or function
4576 # $ @ % & * $ #
4577 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) {
4578 7 $e_string .= $1;
4579 7 $slash = 'div';
4580 }
4581 # $ $ $ $ $ $ $ $ $ $ $ $ $ $
4582 # $ @ # \ ' " / ? ( ) [ ] < >
4583 elsif ($string =~ /\G ( \$[\$\@\#\\\'\"\/\?\(\)\[\]\<\>] ) /oxmsgc) {
4584 0 $e_string .= $1;
4585 0 $slash = 'div';
4586 }
4587  
4588 # qq//
4589 elsif ($string =~ /\G \b (qq) \b /oxgc) {
4590 0 my $ope = $1;
4591 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qq# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Ewindows1258::qq_char)*?) (\#) /cgox) { } 0 0 0
4592 0 $e_string .= e_qq($ope,$1,$3,$2);
4593 }
4594 else {
4595 0 my $e = '';
4596 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4597 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) ((?:$Ewindows1258::qq_char)*?) (\1) /cgox) { } 0 0 0
4598 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq ( )
4599 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq { }
4600 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq [ ]
4601 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq < >
4602 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq * *
4603 }
4604 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4605 }
4606 }
4607  
4608 # qx//
4609 elsif ($string =~ /\G \b (qx) \b /oxgc) {
4610 0 my $ope = $1;
4611 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qx# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Ewindows1258::qq_char)*?) (\#) /cgox) { } 0 0 0
4612 0 $e_string .= e_qq($ope,$1,$3,$2);
4613 }
4614 else {
4615 0 my $e = '';
4616 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4617 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 (\') ((?:$Ewindows1258::qq_char)*?) (\') /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Ewindows1258::qq_char)*?) (\1) /cgox) { } 0 0 0
4618 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx ( )
4619 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx { }
4620 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx [ ]
4621 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx < >
4622 0 elsif ($string =~ /\G (\') ((?:$qq_char)*?) (\') /oxgc) { $e_string .= $e . e_q ($ope,$1,$3,$2); next E_STRING_LOOP; } # qx ' '
4623 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx * *
4624 }
4625 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4626 }
4627 }
4628  
4629 # q//
4630 elsif ($string =~ /\G \b (q) \b /oxgc) {
4631 0 my $ope = $1;
4632 0 ▶ if ($string =~ /\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { # q# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:\\\#|\\\\|$Ewindows1258::q_char)*?) (\#) /cgox) { } 0 0 0
4633 0 $e_string .= e_q($ope,$1,$3,$2);
4634 }
4635 else {
4636 0 my $e = '';
4637 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4638 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| $Ewindows1258::q_char)*?) (\1) /cgox) { } 0 0 0
4639 0 elsif ($string =~ /\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q ( )
4640 0 elsif ($string =~ /\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q { }
4641 0 elsif ($string =~ /\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q [ ]
4642 0 elsif ($string =~ /\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q < >
4643 0 elsif ($string =~ /\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q * *
4644 }
4645 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4646 }
4647 }
4648  
4649 # ''
4650 0 elsif ($string =~ /\G (?<![\w\$\@\%\&\*]) (\') ((?:\\\'|\\\\|$q_char)*?) (\') /oxgc) { $e_string .= e_q('',$1,$3,$2); }
4651  
4652 # ""
4653 0 elsif ($string =~ /\G (\") ((?:$qq_char)*?) (\") /oxgc) { $e_string .= e_qq('',$1,$3,$2); }
4654  
4655 # ``
4656 0 elsif ($string =~ /\G (\`) ((?:$qq_char)*?) (\`) /oxgc) { $e_string .= e_qq('',$1,$3,$2); }
4657  
4658 # other any character
4659 213 elsif ($string =~ /\G ($q_char) /oxgc) { $e_string .= $1; }
4660  
4661 # system error
4662 else {
4663 0 die __FILE__, ": Oops, this shouldn't happen!\n";
4664 }
4665 }
4666  
4667 19 return $e_string;
4668 }
4669  
4670 #
4671 # character class
4672 #
4673 1920 ▶sub character_class {
Subroutine character_class: called CC=3 SCAR=11.0
Pod undocumented
4674 1920 my($char,$modifier) = @_;
4675  
4676 1920 ▶ if ($char eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char eq '.') { } 52 1868 1920
4677 52 ▶ if ($modifier =~ /s/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/) { } 17 35 52
4678 17 return '${Ewindows1258::dot_s}';
4679 }
4680 else {
4681 35 return '${Ewindows1258::dot}';
4682 }
4683 }
4684 else {
4685 1868 return Ewindows1258::classic_character_class($char);
4686 }
4687 }
4688  
4689 #
4690 # escape capture ($1, $2, $3, ...)
4691 #
4692 212 ▶sub e_capture {
Subroutine e_capture: called CC=1 SCAR=0.0
Pod undocumented
4693  
4694 212 return join '', '${', $_[0], '}';
4695 }
4696  
4697 #
4698 # escape transliteration (tr/// or y///)
4699 #
4700 4 ▶sub e_tr {
Subroutine e_tr: called CC=5 SCAR=16.8
Pod undocumented
4701 4 my($variable,$charclass,$e,$charclass2,$modifier) = @_;
4702 4 my $e_tr = '';
4703 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
4704  
4705 4 $slash = 'div';
4706  
4707 # quote character class 1
4708 4 $charclass = q_tr($charclass);
4709  
4710 # quote character class 2
4711 4 $charclass2 = q_tr($charclass2);
4712  
4713 # /b /B modifier
4714 4 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) { } 0 4 4
4715 0 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq '') { } 0 0 0
4716 0 $e_tr = qq{tr$charclass$e$charclass2$modifier};
4717 }
4718 else {
4719 0 $e_tr = qq{$variable${bind_operator}tr$charclass$e$charclass2$modifier};
4720 }
4721 }
4722 else {
4723 4 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq '') { } 2 2 4
4724 2 $e_tr = qq{Ewindows1258::tr(\$_,' =~ ',$charclass,$e$charclass2,'$modifier')};
4725 }
4726 else {
4727 2 $e_tr = qq{Ewindows1258::tr($variable,'$bind_operator',$charclass,$e$charclass2,'$modifier')};
4728 }
4729 }
4730  
4731 # clear tr/// variable
4732 4 $tr_variable = '';
4733 4 $bind_operator = '';
4734  
4735 4 return $e_tr;
4736 }
4737  
4738 #
4739 # quote for escape transliteration (tr/// or y///)
4740 #
4741 8 ▶sub q_tr {
Subroutine q_tr: called CC=9 SCAR=40.6
Pod undocumented
4742 8 my($charclass) = @_;
4743  
4744 # quote character class
4745 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
4746 8 return e_q('', "'", "'", $charclass); # --> q' '
4747 }
4748 elsif ($charclass !~ /\//oxms) {
4749 0 return e_q('q', '/', '/', $charclass); # --> q/ /
4750 }
4751 elsif ($charclass !~ /\#/oxms) {
4752 0 return e_q('q', '#', '#', $charclass); # --> q# #
4753 }
4754 elsif ($charclass !~ /[\<\>]/oxms) {
4755 0 return e_q('q', '<', '>', $charclass); # --> q< >
4756 }
4757 elsif ($charclass !~ /[\(\)]/oxms) {
4758 0 return e_q('q', '(', ')', $charclass); # --> q( )
4759 }
4760 elsif ($charclass !~ /[\{\}]/oxms) {
4761 0 return e_q('q', '{', '}', $charclass); # --> q{ }
4762 }
4763 else {
4764 0 for my $char (qw( ! " $ % & * + . : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
4765 0 ▶ if ($charclass !~ /\Q$char\E/xms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($charclass =~ /\Q$char\E/msx) 0 0 0
4766 0 return e_q('q', $char, $char, $charclass);
4767 }
4768 }
4769 }
4770  
4771 0 return e_q('q', '{', '}', $charclass);
4772 }
4773  
4774 #
4775 # escape q string (q//, '')
4776 #
4777 1623 ▶sub e_q {
Subroutine e_q: called CC=1 SCAR=0.0
Pod undocumented
4778 1623 my($ope,$delimiter,$end_delimiter,$string) = @_;
4779  
4780 1623 $slash = 'div';
4781  
4782 1623 return join '', $ope, $delimiter, $string, $end_delimiter;
4783 }
4784  
4785 #
4786 # escape qq string (qq//, "", qx//, ``)
4787 #
4788 4191 ▶sub e_qq {
Subroutine e_qq: called CC=37 SCAR=50.9
Pod undocumented
4789 4191 my($ope,$delimiter,$end_delimiter,$string) = @_;
4790  
4791 4191 $slash = 'div';
4792  
4793 4191 my $left_e = 0;
4794 4191 my $right_e = 0;
4795  
4796 # split regexp
4797 4191 my @char = $string =~ /\G((?>
4798 [^\\\$] |
4799 \\x\{ (?>[0-9A-Fa-f]+) \} |
4800 \\o\{ (?>[0-7]+) \} |
4801 \\N\{ (?>[^0-9\}][^\}]*) \} |
4802 \\ $q_char |
4803 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
4804 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
4805 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
4806 \$ (?>\s* [0-9]+) |
4807 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
4808 \$ \$ (?![\w\{]) |
4809 \$ (?>\s*) \$ (?>\s*) $qq_variable |
4810 $q_char
4811 ))/oxmsg;
4812  
4813 4191 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 117622 4191 121813
4814  
4815 # "\L\u" --> "\u\L"
4816 117622 ▶ 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 117622 117622
elsif ($char[$i] eq '\\U' and $char[$i + 1] eq '\\l') { } 0 117622 117622
elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/mosx) { } 1 117621 117622
elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/mosx) { } 1 117620 117621
elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/mosx) { } 0 117620 117620
Condition33%1/3
$char[$i] eq "\\L" and $char[$i + 1] eq "\\u"
!ll&&!rl&&r
11762200
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
4817 0 @char[$i,$i+1] = @char[$i+1,$i];
4818 }
4819  
4820 # "\U\l" --> "\l\U"
4821 ▶ 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
11762200
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
4822 0 @char[$i,$i+1] = @char[$i+1,$i];
4823 }
4824  
4825 # octal escape sequence
4826 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
4827 1 $char[$i] = Ewindows1258::octchr($1);
4828 }
4829  
4830 # hexadecimal escape sequence
4831 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
4832 1 $char[$i] = Ewindows1258::hexchr($1);
4833 }
4834  
4835 # \N{CHARNAME} --> N{CHARNAME}
4836 elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
4837 0 $char[$i] = $1;
4838 }
4839  
4840 117622 ▶ if (0) {
Branch: 23 branches
BranchTrueFalseTotal
if (do { $char[$i] =~ /\A ([<>]) \z/mosx }) { } 484 117138 117622
elsif ($char[$i] eq '\\u') { } 0 117138 117138
elsif ($char[$i] eq '\\l') { } 0 117138 117138
elsif ($char[$i] eq '\\U') { } 0 117138 117138
elsif ($char[$i] eq '\\L') { } 0 117138 117138
elsif ($char[$i] eq '\\F') { } 24 117114 117138
elsif ($char[$i] eq '\\Q') { } 0 117114 117114
elsif ($char[$i] eq '\\E') { } 24 117090 117114
elsif ($char[$i] eq '\\Q') { } 0 117090 117090
elsif ($char[$i] eq '\\E') { } 0 117090 117090
elsif ($char[$i] =~ /\A \$ 0 \z/mosx) { } 4 117086 117090
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/mosx) { } 0 117086 117086
elsif ($char[$i] =~ /\A \$\$ \z/mosx) { } 0 117086 117086
elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/mosx) { } 205 116881 117086
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/mosx) { } 0 116881 116881
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/mosx) { } 0 116881 116881
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/mosx) { } 0 116881 116881
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/mosx) { } 0 116881 116881
elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/cgmosx) { } 44 116837 116881
elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/cgmosx) { } 45 116792 116837
elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/cgmosx) { } 33 116759 116792
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/mosx) { } 0 116759 116759
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/mosx) { } 0 116759 116759
4841 }
4842  
4843 # \F
4844 #
4845 # P.69 Table 2-6. Translation escapes
4846 # in Chapter 2: Bits and Pieces
4847 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4848 # (and so on)
4849  
4850 # \u \l \U \L \F \Q \E
4851 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
4852 484 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 484 484
4853 0 $char[$i] = '\\' . $char[$i];
4854 }
4855 }
4856 elsif ($char[$i] eq '\u') {
4857  
4858 # "STRING @{[ LIST EXPR ]} MORE STRING"
4859  
4860 # P.257 Other Tricks You Can Do with Hard References
4861 # in Chapter 8: References
4862 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4863  
4864 # P.353 Other Tricks You Can Do with Hard References
4865 # in Chapter 8: References
4866 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4867  
4868 # (and so on)
4869  
4870 0 $char[$i] = '@{[Ewindows1258::ucfirst qq<';
4871 0 $left_e++;
4872 }
4873 elsif ($char[$i] eq '\l') {
4874 0 $char[$i] = '@{[Ewindows1258::lcfirst qq<';
4875 0 $left_e++;
4876 }
4877 elsif ($char[$i] eq '\U') {
4878 0 $char[$i] = '@{[Ewindows1258::uc qq<';
4879 0 $left_e++;
4880 }
4881 elsif ($char[$i] eq '\L') {
4882 0 $char[$i] = '@{[Ewindows1258::lc qq<';
4883 0 $left_e++;
4884 }
4885 elsif ($char[$i] eq '\F') {
4886 24 $char[$i] = '@{[Ewindows1258::fc qq<';
4887 24 $left_e++;
4888 }
4889 elsif ($char[$i] eq '\Q') {
4890 0 $char[$i] = '@{[CORE::quotemeta qq<';
4891 0 $left_e++;
4892 }
4893 elsif ($char[$i] eq '\E') {
4894 24 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 24 0 24
4895 24 $char[$i] = '>]}';
4896 24 $right_e++;
4897 }
4898 else {
4899 0 $char[$i] = '';
4900 }
4901 }
4902 elsif ($char[$i] eq '\Q') {
4903 0 while (1) {
4904 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
4905 0 last;
4906 }
4907 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
4908 0 last;
4909 }
4910 }
4911 }
4912 elsif ($char[$i] eq '\E') {
4913 }
4914  
4915 # $0 --> $0
4916 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
4917 }
4918 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
4919 }
4920  
4921 # $$ --> $$
4922 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
4923 }
4924  
4925 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
4926 # $1, $2, $3 --> $1, $2, $3 otherwise
4927 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
4928 205 $char[$i] = e_capture($1);
4929 }
4930 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
4931 0 $char[$i] = e_capture($1);
4932 }
4933  
4934 # $$foo[ ... ] --> $ $foo->[ ... ]
4935 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
4936 0 $char[$i] = e_capture($1.'->'.$2);
4937 }
4938  
4939 # $$foo{ ... } --> $ $foo->{ ... }
4940 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
4941 0 $char[$i] = e_capture($1.'->'.$2);
4942 }
4943  
4944 # $$foo
4945 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
4946 0 $char[$i] = e_capture($1);
4947 }
4948  
4949 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Ewindows1258::PREMATCH()
4950 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
4951 44 $char[$i] = '@{[Ewindows1258::PREMATCH()]}';
4952 }
4953  
4954 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Ewindows1258::MATCH()
4955 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
4956 45 $char[$i] = '@{[Ewindows1258::MATCH()]}';
4957 }
4958  
4959 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Ewindows1258::POSTMATCH()
4960 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
4961 33 $char[$i] = '@{[Ewindows1258::POSTMATCH()]}';
4962 }
4963  
4964 # ${ foo } --> ${ foo }
4965 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/oxms) {
4966 }
4967  
4968 # ${ ... }
4969 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
4970 0 $char[$i] = e_capture($1);
4971 }
4972 }
4973  
4974 # return string
4975 4191 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 4191 4191
4976 0 return join '', $ope, $delimiter, @char, '>]}' x ($left_e - $right_e), $end_delimiter;
4977 }
4978 4191 return join '', $ope, $delimiter, @char, $end_delimiter;
4979 }
4980  
4981 #
4982 # escape qw string (qw//)
4983 #
4984 16 ▶sub e_qw {
Subroutine e_qw: called CC=11 SCAR=43.1
Pod undocumented
4985 16 my($ope,$delimiter,$end_delimiter,$string) = @_;
4986  
4987 16 $slash = 'div';
4988  
4989 # choice again delimiter
4990 16 my %octet = map {$_ => 1} ($string =~ /\G ([\x00-\xFF]) /oxmsg);
4991 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
4992 16 return join '', $ope, $delimiter, $string, $end_delimiter;
4993 }
4994 elsif (not $octet{')'}) {
4995 0 return join '', $ope, '(', $string, ')';
4996 }
4997 elsif (not $octet{'}'}) {
4998 0 return join '', $ope, '{', $string, '}';
4999 }
5000 elsif (not $octet{']'}) {
5001 0 return join '', $ope, '[', $string, ']';
5002 }
5003 elsif (not $octet{'>'}) {
5004 0 return join '', $ope, '<', $string, '>';
5005 }
5006 else {
5007 0 for my $char (qw( ! " $ % & * + - . / : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5008 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5009 0 return join '', $ope, $char, $string, $char;
5010 }
5011 }
5012 }
5013  
5014 # qw/AAA BBB C'CC/ --> ('AAA', 'BBB', 'C\'CC')
5015 0 my @string = CORE::split(/\s+/, $string);
5016 0 for my $string (@string) {
5017 0 my @octet = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5018 0 for my $octet (@octet) {
5019 0 ▶ if ($octet =~ /\A (['\\]) \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($octet =~ /\A (['\\]) \z/mosx) 0 0 0
5020 0 $octet = '\\' . $1;
5021 }
5022 }
5023 0 $string = join '', @octet;
5024 }
5025 0 return join '', '(', (join ', ', map { "'$_'" } @string), ')';
5026 }
5027  
5028 #
5029 # escape here document (<<"HEREDOC", <<HEREDOC, <<`HEREDOC`, <<~"HEREDOC", <<~HEREDOC, <<~`HEREDOC`)
5030 #
5031 93 ▶sub e_heredoc {
Subroutine e_heredoc: called CC=37 SCAR=56.3
Pod undocumented
5032 93 my($string) = @_;
5033  
5034 93 $slash = 'm//';
5035  
5036 93 my $metachar = qr/[\@\\|]/oxms; # '|' is for <<`HEREDOC`
5037  
5038 93 my $left_e = 0;
5039 93 my $right_e = 0;
5040  
5041 # split regexp
5042 93 my @char = $string =~ /\G((?>
5043 [^\\\$] |
5044 \\x\{ (?>[0-9A-Fa-f]+) \} |
5045 \\o\{ (?>[0-7]+) \} |
5046 \\N\{ (?>[^0-9\}][^\}]*) \} |
5047 \\ $q_char |
5048 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5049 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5050 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5051 \$ (?>\s* [0-9]+) |
5052 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5053 \$ \$ (?![\w\{]) |
5054 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5055 $q_char
5056 ))/oxmsg;
5057  
5058 93 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 3307 93 3400
5059  
5060 # "\L\u" --> "\u\L"
5061 3307 ▶ 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 3307 3307
elsif ($char[$i] eq '\\U' and $char[$i + 1] eq '\\l') { } 0 3307 3307
elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/mosx) { } 1 3306 3307
elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/mosx) { } 1 3305 3306
elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/mosx) { } 0 3305 3305
Condition33%1/3
$char[$i] eq "\\L" and $char[$i + 1] eq "\\u"
!ll&&!rl&&r
330700
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
5062 0 @char[$i,$i+1] = @char[$i+1,$i];
5063 }
5064  
5065 # "\U\l" --> "\l\U"
5066 ▶ 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
330700
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
5067 0 @char[$i,$i+1] = @char[$i+1,$i];
5068 }
5069  
5070 # octal escape sequence
5071 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5072 1 $char[$i] = Ewindows1258::octchr($1);
5073 }
5074  
5075 # hexadecimal escape sequence
5076 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5077 1 $char[$i] = Ewindows1258::hexchr($1);
5078 }
5079  
5080 # \N{CHARNAME} --> N{CHARNAME}
5081 elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5082 0 $char[$i] = $1;
5083 }
5084  
5085 3307 ▶ if (0) {
Branch: 23 branches
BranchTrueFalseTotal
if (do { $char[$i] =~ /\A ([<>]) \z/mosx }) { } 0 3307 3307
elsif ($char[$i] eq '\\u') { } 0 3307 3307
elsif ($char[$i] eq '\\l') { } 0 3307 3307
elsif ($char[$i] eq '\\U') { } 0 3307 3307
elsif ($char[$i] eq '\\L') { } 0 3307 3307
elsif ($char[$i] eq '\\F') { } 0 3307 3307
elsif ($char[$i] eq '\\Q') { } 0 3307 3307
elsif ($char[$i] eq '\\E') { } 0 3307 3307
elsif ($char[$i] eq '\\Q') { } 0 3307 3307
elsif ($char[$i] eq '\\E') { } 0 3307 3307
elsif ($char[$i] =~ /\A \$ 0 \z/mosx) { } 0 3307 3307
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/mosx) { } 0 3307 3307
elsif ($char[$i] =~ /\A \$\$ \z/mosx) { } 0 3307 3307
elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/mosx) { } 0 3307 3307
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/mosx) { } 0 3307 3307
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/mosx) { } 0 3307 3307
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/mosx) { } 0 3307 3307
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/mosx) { } 0 3307 3307
elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/cgmosx) { } 8 3299 3307
elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/cgmosx) { } 8 3291 3299
elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/cgmosx) { } 6 3285 3291
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/mosx) { } 0 3285 3285
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/mosx) { } 0 3285 3285
5086 }
5087  
5088 # \u \l \U \L \F \Q \E
5089 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
5090 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
5091 0 $char[$i] = '\\' . $char[$i];
5092 }
5093 }
5094 elsif ($char[$i] eq '\u') {
5095 0 $char[$i] = '@{[Ewindows1258::ucfirst qq<';
5096 0 $left_e++;
5097 }
5098 elsif ($char[$i] eq '\l') {
5099 0 $char[$i] = '@{[Ewindows1258::lcfirst qq<';
5100 0 $left_e++;
5101 }
5102 elsif ($char[$i] eq '\U') {
5103 0 $char[$i] = '@{[Ewindows1258::uc qq<';
5104 0 $left_e++;
5105 }
5106 elsif ($char[$i] eq '\L') {
5107 0 $char[$i] = '@{[Ewindows1258::lc qq<';
5108 0 $left_e++;
5109 }
5110 elsif ($char[$i] eq '\F') {
5111 0 $char[$i] = '@{[Ewindows1258::fc qq<';
5112 0 $left_e++;
5113 }
5114 elsif ($char[$i] eq '\Q') {
5115 0 $char[$i] = '@{[CORE::quotemeta qq<';
5116 0 $left_e++;
5117 }
5118 elsif ($char[$i] eq '\E') {
5119 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
5120 0 $char[$i] = '>]}';
5121 0 $right_e++;
5122 }
5123 else {
5124 0 $char[$i] = '';
5125 }
5126 }
5127 elsif ($char[$i] eq '\Q') {
5128 0 while (1) {
5129 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5130 0 last;
5131 }
5132 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
5133 0 last;
5134 }
5135 }
5136 }
5137 elsif ($char[$i] eq '\E') {
5138 }
5139  
5140 # $0 --> $0
5141 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
5142 }
5143 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
5144 }
5145  
5146 # $$ --> $$
5147 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
5148 }
5149  
5150 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
5151 # $1, $2, $3 --> $1, $2, $3 otherwise
5152 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
5153 0 $char[$i] = e_capture($1);
5154 }
5155 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
5156 0 $char[$i] = e_capture($1);
5157 }
5158  
5159 # $$foo[ ... ] --> $ $foo->[ ... ]
5160 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
5161 0 $char[$i] = e_capture($1.'->'.$2);
5162 }
5163  
5164 # $$foo{ ... } --> $ $foo->{ ... }
5165 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
5166 0 $char[$i] = e_capture($1.'->'.$2);
5167 }
5168  
5169 # $$foo
5170 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
5171 0 $char[$i] = e_capture($1);
5172 }
5173  
5174 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Ewindows1258::PREMATCH()
5175 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
5176 8 $char[$i] = '@{[Ewindows1258::PREMATCH()]}';
5177 }
5178  
5179 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Ewindows1258::MATCH()
5180 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
5181 8 $char[$i] = '@{[Ewindows1258::MATCH()]}';
5182 }
5183  
5184 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Ewindows1258::POSTMATCH()
5185 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
5186 6 $char[$i] = '@{[Ewindows1258::POSTMATCH()]}';
5187 }
5188  
5189 # ${ foo } --> ${ foo }
5190 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/oxms) {
5191 }
5192  
5193 # ${ ... }
5194 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5195 0 $char[$i] = e_capture($1);
5196 }
5197 }
5198  
5199 # return string
5200 93 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 93 93
5201 0 return join '', @char, '>]}' x ($left_e - $right_e);
5202 }
5203 93 return join '', @char;
5204 }
5205  
5206 #
5207 # escape regexp (m//, qr//)
5208 #
5209 880 ▶sub e_qr {
Subroutine e_qr: called CC=110 SCAR=73.6
Pod undocumented
5210 880 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5211 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
5212  
5213 880 $modifier =~ tr/p//d;
5214 880 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 880 880
5215 0 my $line = 0;
5216 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
5217 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
5218 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
5219 0 last;
5220 }
5221 }
5222 0 die qq{Unsupported modifier "$1" used at line $line.\n};
5223 }
5224  
5225 880 $slash = 'div';
5226  
5227 # literal null string pattern
5228 880 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 872 880
elsif ($modifier =~ tr/Bb//d) { } 2 870 872
5229 8 $modifier =~ tr/bB//d;
5230 8 $modifier =~ tr/i//d;
5231 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
5232 }
5233  
5234 # /b /B modifier
5235 elsif ($modifier =~ tr/bB//d) {
5236  
5237 # choice again delimiter
5238 2 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 2 2
5239 0 my @char = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5240 0 my %octet = map {$_ => 1} @char;
5241 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
5242 0 $delimiter = '(';
5243 0 $end_delimiter = ')';
5244 }
5245 elsif (not $octet{'}'}) {
5246 0 $delimiter = '{';
5247 0 $end_delimiter = '}';
5248 }
5249 elsif (not $octet{']'}) {
5250 0 $delimiter = '[';
5251 0 $end_delimiter = ']';
5252 }
5253 elsif (not $octet{'>'}) {
5254 0 $delimiter = '<';
5255 0 $end_delimiter = '>';
5256 }
5257 else {
5258 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5259 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5260 0 $delimiter = $char;
5261 0 $end_delimiter = $char;
5262 0 last;
5263 }
5264 }
5265 }
5266 }
5267  
5268 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
5269 0 return join '', $ope, $delimiter, $string, $matched, $end_delimiter, $modifier;
5270 }
5271 else {
5272 2 return join '', $ope, $delimiter, '(?:', $string, ')', $matched, $end_delimiter, $modifier;
5273 }
5274 }
5275  
5276 870 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 312 558 870
5277 870 my $metachar = qr/[\@\\|[\]{^]/oxms;
5278  
5279 # split regexp
5280 870 my @char = $string =~ /\G((?>
5281 [^\\\$\@\[\(] |
5282 \\x (?>[0-9A-Fa-f]{1,2}) |
5283 \\ (?>[0-7]{2,3}) |
5284 \\c [\x40-\x5F] |
5285 \\x\{ (?>[0-9A-Fa-f]+) \} |
5286 \\o\{ (?>[0-7]+) \} |
5287 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
5288 \\ $q_char |
5289 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5290 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5291 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5292 [\$\@] $qq_variable |
5293 \$ (?>\s* [0-9]+) |
5294 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5295 \$ \$ (?![\w\{]) |
5296 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5297 \[\^ |
5298 \[\: (?>[a-z]+) :\] |
5299 \[\:\^ (?>[a-z]+) :\] |
5300 \(\? |
5301 $q_char
5302 ))/oxmsg;
5303  
5304 # choice again delimiter
5305 870 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 870 870
5306 0 my %octet = map {$_ => 1} @char;
5307 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
5308 0 $delimiter = '(';
5309 0 $end_delimiter = ')';
5310 }
5311 elsif (not $octet{'}'}) {
5312 0 $delimiter = '{';
5313 0 $end_delimiter = '}';
5314 }
5315 elsif (not $octet{']'}) {
5316 0 $delimiter = '[';
5317 0 $end_delimiter = ']';
5318 }
5319 elsif (not $octet{'>'}) {
5320 0 $delimiter = '<';
5321 0 $end_delimiter = '>';
5322 }
5323 else {
5324 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5325 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5326 0 $delimiter = $char;
5327 0 $end_delimiter = $char;
5328 0 last;
5329 }
5330 }
5331 }
5332 }
5333  
5334 870 my $left_e = 0;
5335 870 my $right_e = 0;
5336 870 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 2100 870 2970
5337  
5338 # "\L\u" --> "\u\L"
5339 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
5340 0 @char[$i,$i+1] = @char[$i+1,$i];
5341 }
5342  
5343 # "\U\l" --> "\l\U"
5344 ▶ 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
5345 0 @char[$i,$i+1] = @char[$i+1,$i];
5346 }
5347  
5348 # octal escape sequence
5349 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5350 1 $char[$i] = Ewindows1258::octchr($1);
5351 }
5352  
5353 # hexadecimal escape sequence
5354 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5355 1 $char[$i] = Ewindows1258::hexchr($1);
5356 }
5357  
5358 # \b{...} --> b\{...}
5359 # \B{...} --> B\{...}
5360 # \N{CHARNAME} --> N\{CHARNAME}
5361 # \p{PROPERTY} --> p\{PROPERTY}
5362 # \P{PROPERTY} --> P\{PROPERTY}
5363 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5364 6 $char[$i] = $1 . '\\' . $2;
5365 }
5366  
5367 # \p, \P, \X --> p, P, X
5368 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
5369 4 $char[$i] = $1;
5370 }
5371  
5372 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 &Ewindows1258::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
5373 }
5374  
5375 # join separated multiple-octet
5376 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
5377 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 $Ewindows1258::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 $Ewindows1258::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 $Ewindows1258::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 $Ewindows1258::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 $Ewindows1258::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 $Ewindows1258::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 $Ewindows1258::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5378 0 $char[$i] .= join '', splice @char, $i+1, 3;
5379 }
5380 ▶ 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 $Ewindows1258::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 $Ewindows1258::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 $Ewindows1258::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 $Ewindows1258::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5381 0 $char[$i] .= join '', splice @char, $i+1, 2;
5382 }
5383 ▶ 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 $Ewindows1258::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 $Ewindows1258::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 $Ewindows1258::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 $Ewindows1258::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5384 0 $char[$i] .= join '', splice @char, $i+1, 1;
5385 }
5386 }
5387  
5388 # open character class [...]
5389 elsif ($char[$i] eq '[') {
5390 556 my $left = $i;
5391  
5392 # [] make die "Unmatched [] in regexp ...\n"
5393 # (and so on)
5394  
5395 556 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 3 553 556
5396 3 $i++;
5397 }
5398  
5399 556 while (1) {
5400 2063 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 2063 2063
5401 0 die __FILE__, ": Unmatched [] in regexp\n";
5402 }
5403 2063 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 556 1507 2063
5404 556 my $right = $i;
5405  
5406 # [...]
5407 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
5408 30 splice @char, $left, $right-$left+1, sprintf(q{@{[Ewindows1258::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
5409 }
5410 else {
5411 526 splice @char, $left, $right-$left+1, Ewindows1258::charlist_qr(@char[$left+1..$right-1], $modifier);
5412 }
5413  
5414 556 $i = $left;
5415 556 last;
5416 }
5417 }
5418 }
5419  
5420 # open character class [^...]
5421 elsif ($char[$i] eq '[^') {
5422 74 my $left = $i;
5423  
5424 # [^] make die "Unmatched [] in regexp ...\n"
5425 # (and so on)
5426  
5427 74 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 4 70 74
5428 4 $i++;
5429 }
5430  
5431 74 while (1) {
5432 272 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 272 272
5433 0 die __FILE__, ": Unmatched [] in regexp\n";
5434 }
5435 272 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 74 198 272
5436 74 my $right = $i;
5437  
5438 # [^...]
5439 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
5440 30 splice @char, $left, $right-$left+1, sprintf(q{@{[Ewindows1258::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
5441 }
5442 else {
5443 44 splice @char, $left, $right-$left+1, Ewindows1258::charlist_not_qr(@char[$left+1..$right-1], $modifier);
5444 }
5445  
5446 74 $i = $left;
5447 74 last;
5448 }
5449 }
5450 }
5451  
5452 # rewrite character class or escape character
5453 elsif (my $char = character_class($char[$i],$modifier)) {
5454 139 $char[$i] = $char;
5455 }
5456  
5457 # /i modifier
5458 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Ewindows1258::uc($char[$i]) ne Ewindows1258::fc($char[$i]))) {
Condition100%6/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Ewindows1258::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 &Ewindows1258::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Ewindows1258::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= &Ewindows1258::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
5459 20 ▶ if (CORE::length(Ewindows1258::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 20 0 20
5460 20 $char[$i] = '[' . Ewindows1258::uc($char[$i]) . Ewindows1258::fc($char[$i]) . ']';
5461 }
5462 else {
5463 0 $char[$i] = '(?:' . Ewindows1258::uc($char[$i]) . '|' . Ewindows1258::fc($char[$i]) . ')';
5464 }
5465 }
5466  
5467 # \u \l \U \L \F \Q \E
5468 elsif ($char[$i] =~ /\A [<>] \z/oxms) {
5469 1 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 1 1
5470 0 $char[$i] = '\\' . $char[$i];
5471 }
5472 }
5473 elsif ($char[$i] eq '\u') {
5474 0 $char[$i] = '@{[Ewindows1258::ucfirst qq<';
5475 0 $left_e++;
5476 }
5477 elsif ($char[$i] eq '\l') {
5478 0 $char[$i] = '@{[Ewindows1258::lcfirst qq<';
5479 0 $left_e++;
5480 }
5481 elsif ($char[$i] eq '\U') {
5482 1 $char[$i] = '@{[Ewindows1258::uc qq<';
5483 1 $left_e++;
5484 }
5485 elsif ($char[$i] eq '\L') {
5486 1 $char[$i] = '@{[Ewindows1258::lc qq<';
5487 1 $left_e++;
5488 }
5489 elsif ($char[$i] eq '\F') {
5490 18 $char[$i] = '@{[Ewindows1258::fc qq<';
5491 18 $left_e++;
5492 }
5493 elsif ($char[$i] eq '\Q') {
5494 1 $char[$i] = '@{[CORE::quotemeta qq<';
5495 1 $left_e++;
5496 }
5497 elsif ($char[$i] eq '\E') {
5498 21 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 21 0 21
5499 21 $char[$i] = '>]}';
5500 21 $right_e++;
5501 }
5502 else {
5503 0 $char[$i] = '';
5504 }
5505 }
5506 elsif ($char[$i] eq '\Q') {
5507 0 while (1) {
5508 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5509 0 last;
5510 }
5511 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
5512 0 last;
5513 }
5514 }
5515 }
5516 elsif ($char[$i] eq '\E') {
5517 }
5518  
5519 # $0 --> $0
5520 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
5521 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5522 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
5523 }
5524 }
5525 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
5526 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5527 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
5528 }
5529 }
5530  
5531 # $$ --> $$
5532 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
5533 }
5534  
5535 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
5536 # $1, $2, $3 --> $1, $2, $3 otherwise
5537 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
5538 0 $char[$i] = e_capture($1);
5539 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5540 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
5541 }
5542 }
5543 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
5544 0 $char[$i] = e_capture($1);
5545 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5546 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
5547 }
5548 }
5549  
5550 # $$foo[ ... ] --> $ $foo->[ ... ]
5551 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
5552 0 $char[$i] = e_capture($1.'->'.$2);
5553 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5554 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
5555 }
5556 }
5557  
5558 # $$foo{ ... } --> $ $foo->{ ... }
5559 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
5560 0 $char[$i] = e_capture($1.'->'.$2);
5561 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5562 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
5563 }
5564 }
5565  
5566 # $$foo
5567 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
5568 0 $char[$i] = e_capture($1);
5569 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5570 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
5571 }
5572 }
5573  
5574 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Ewindows1258::PREMATCH()
5575 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
5576 8 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 8 8
5577 0 $char[$i] = '@{[Ewindows1258::ignorecase(Ewindows1258::PREMATCH())]}';
5578 }
5579 else {
5580 8 $char[$i] = '@{[Ewindows1258::PREMATCH()]}';
5581 }
5582 }
5583  
5584 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Ewindows1258::MATCH()
5585 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
5586 8 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 8 8
5587 0 $char[$i] = '@{[Ewindows1258::ignorecase(Ewindows1258::MATCH())]}';
5588 }
5589 else {
5590 8 $char[$i] = '@{[Ewindows1258::MATCH()]}';
5591 }
5592 }
5593  
5594 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Ewindows1258::POSTMATCH()
5595 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
5596 6 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 6 6
5597 0 $char[$i] = '@{[Ewindows1258::ignorecase(Ewindows1258::POSTMATCH())]}';
5598 }
5599 else {
5600 6 $char[$i] = '@{[Ewindows1258::POSTMATCH()]}';
5601 }
5602 }
5603  
5604 # ${ foo }
5605 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
5606 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5607 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
5608 }
5609 }
5610  
5611 # ${ ... }
5612 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5613 0 $char[$i] = e_capture($1);
5614 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5615 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
5616 }
5617 }
5618  
5619 # $scalar or @array
5620 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
5621 21 $char[$i] = e_string($char[$i]);
5622 21 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 11 10 21
5623 11 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
5624 }
5625 }
5626  
5627 # quote character before ? + * {
5628 ▶ 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
5629 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
5630 }
5631 ▶ 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
5632 0 my $char = $char[$i-1];
5633 0 ▶ if ($char[$i] eq '{') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq '{') { } 0 0 0
5634 0 die __FILE__, qq{: "MULTIBYTE{n}" should be "(MULTIBYTE){n}" in m?? (and shift \$1,\$2,\$3,...) ($char){n}\n};
5635 }
5636 else {
5637 0 die __FILE__, qq{: "MULTIBYTE$char[$i]" should be "(MULTIBYTE)$char[$i]" in m?? (and shift \$1,\$2,\$3,...) ($char)$char[$i]\n};
5638 }
5639 }
5640 else {
5641 127 $char[$i-1] = '(?:' . $char[$i-1] . ')';
5642 }
5643 }
5644 }
5645  
5646 # make regexp string
5647 870 $modifier =~ tr/i//d;
5648 870 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 870 870
5649 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
5650 0 return join '', $ope, $delimiter, $anchor, @char, '>]}' x ($left_e - $right_e), $matched, $end_delimiter, $modifier;
5651 }
5652 else {
5653 0 return join '', $ope, $delimiter, $anchor, '(?:', @char, '>]}' x ($left_e - $right_e), ')', $matched, $end_delimiter, $modifier;
5654 }
5655 }
5656 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
5657 0 return join '', $ope, $delimiter, $anchor, @char, $matched, $end_delimiter, $modifier;
5658 }
5659 else {
5660 870 return join '', $ope, $delimiter, $anchor, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
5661 }
5662 }
5663  
5664 #
5665 # double quote stuff
5666 #
5667 180 ▶sub qq_stuff {
Subroutine qq_stuff: called CC=6 SCAR=18.5
Pod undocumented
5668 180 my($delimiter,$end_delimiter,$stuff) = @_;
5669  
5670 # scalar variable or array variable
5671 180 ▶ if ($stuff =~ /\A [\$\@] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($stuff =~ /\A [\$\@] /mosx) 100 80 180
5672 100 return $stuff;
5673 }
5674  
5675 # quote by delimiter
5676 80 my %octet = map {$_ => 1} ($stuff =~ /\G ([\x00-\xFF]) /oxmsg);
5677 80 for my $char (qw( ! " $ % & * + - . / : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5678 80 ▶ next if $char eq $delimiter;
Branch: 1 branch
BranchTrueFalseTotal
if $char eq $delimiter 0 80 80
5679 80 ▶ next if $char eq $end_delimiter;
Branch: 1 branch
BranchTrueFalseTotal
if $char eq $end_delimiter 0 80 80
5680 80 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 80 0 80
5681 80 return join '', 'qq', $char, $stuff, $char;
5682 }
5683 }
5684 0 return join '', 'qq', '<', $stuff, '>';
5685 }
5686  
5687 #
5688 # escape regexp (m'', qr'', and m''b, qr''b)
5689 #
5690 10 ▶sub e_qr_q {
Subroutine e_qr_q: called CC=7 SCAR=25.3
Pod undocumented
5691 10 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5692 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
5693  
5694 10 $modifier =~ tr/p//d;
5695 10 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 10 10
5696 0 my $line = 0;
5697 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
5698 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
5699 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
5700 0 last;
5701 }
5702 }
5703 0 die qq{Unsupported modifier "$1" used at line $line.\n};
5704 }
5705  
5706 10 $slash = 'div';
5707  
5708 # literal null string pattern
5709 10 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 2 10
elsif ($modifier =~ tr/Bb//d) { } 0 2 2
5710 8 $modifier =~ tr/bB//d;
5711 8 $modifier =~ tr/i//d;
5712 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
5713 }
5714  
5715 # with /b /B modifier
5716 elsif ($modifier =~ tr/bB//d) {
5717 0 return e_qr_qb($ope,$delimiter,$end_delimiter,$string,$modifier);
5718 }
5719  
5720 # without /b /B modifier
5721 else {
5722 2 return e_qr_qt($ope,$delimiter,$end_delimiter,$string,$modifier);
5723 }
5724 }
5725  
5726 #
5727 # escape regexp (m'', qr'')
5728 #
5729 2 ▶sub e_qr_qt {
Subroutine e_qr_qt: called CC=20 SCAR=51.8
Pod undocumented
5730 2 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5731  
5732 2 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 2 2
5733  
5734 # split regexp
5735 2 my @char = $string =~ /\G((?>
5736 [^\\\[\$\@\/] |
5737 [\x00-\xFF] |
5738 \[\^ |
5739 \[\: (?>[a-z]+) \:\] |
5740 \[\:\^ (?>[a-z]+) \:\] |
5741 [\$\@\/] |
5742 \\ (?:$q_char) |
5743 (?:$q_char)
5744 ))/oxmsg;
5745  
5746 # unescape character
5747 2 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 2 2 4
5748 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 &Ewindows1258::uc($char[$i]) ne &fc($char[$i])) { } 0 2 2
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 4 4
5749 }
5750  
5751 # open character class [...]
5752 elsif ($char[$i] eq '[') {
5753 0 my $left = $i;
5754 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
5755 0 $i++;
5756 }
5757 0 while (1) {
5758 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5759 0 die __FILE__, ": Unmatched [] in regexp\n";
5760 }
5761 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
5762 0 my $right = $i;
5763  
5764 # [...]
5765 0 splice @char, $left, $right-$left+1, Ewindows1258::charlist_qr(@char[$left+1..$right-1], $modifier);
5766  
5767 0 $i = $left;
5768 0 last;
5769 }
5770 }
5771 }
5772  
5773 # open character class [^...]
5774 elsif ($char[$i] eq '[^') {
5775 0 my $left = $i;
5776 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
5777 0 $i++;
5778 }
5779 0 while (1) {
5780 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5781 0 die __FILE__, ": Unmatched [] in regexp\n";
5782 }
5783 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
5784 0 my $right = $i;
5785  
5786 # [^...]
5787 0 splice @char, $left, $right-$left+1, Ewindows1258::charlist_not_qr(@char[$left+1..$right-1], $modifier);
5788  
5789 0 $i = $left;
5790 0 last;
5791 }
5792 }
5793 }
5794  
5795 # escape $ @ / and \
5796 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
5797 0 $char[$i] = '\\' . $char[$i];
5798 }
5799  
5800 # rewrite character class or escape character
5801 elsif (my $char = character_class($char[$i],$modifier)) {
5802 0 $char[$i] = $char;
5803 }
5804  
5805 # /i modifier
5806 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Ewindows1258::uc($char[$i]) ne Ewindows1258::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Ewindows1258::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 &Ewindows1258::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Ewindows1258::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= &Ewindows1258::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
5807 0 ▶ if (CORE::length(Ewindows1258::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
5808 0 $char[$i] = '[' . Ewindows1258::uc($char[$i]) . Ewindows1258::fc($char[$i]) . ']';
5809 }
5810 else {
5811 0 $char[$i] = '(?:' . Ewindows1258::uc($char[$i]) . '|' . Ewindows1258::fc($char[$i]) . ')';
5812 }
5813 }
5814  
5815 # quote character before ? + * {
5816 ▶ 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
5817 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
5818 }
5819 else {
5820 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
5821 }
5822 }
5823 }
5824  
5825 2 $delimiter = '/';
5826 2 $end_delimiter = '/';
5827  
5828 2 $modifier =~ tr/i//d;
5829 2 return join '', $ope, $delimiter, $anchor, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
5830 }
5831  
5832 #
5833 # escape regexp (m''b, qr''b)
5834 #
5835 0 ▶sub e_qr_qb {
Subroutine e_qr_qb: not called CC=4 SCAR=30.0
Pod undocumented
5836 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5837  
5838 # split regexp
5839 0 my @char = $string =~ /\G ((?>[^\\]|\\\\)) /oxmsg;
5840  
5841 # unescape character
5842 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
5843 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
5844 }
5845  
5846 # remain \\
5847 elsif ($char[$i] eq '\\\\') {
5848 }
5849  
5850 # escape $ @ / and \
5851 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
5852 0 $char[$i] = '\\' . $char[$i];
5853 }
5854 }
5855  
5856 0 $delimiter = '/';
5857 0 $end_delimiter = '/';
5858 0 return join '', $ope, $delimiter, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
5859 }
5860  
5861 #
5862 # escape regexp (s/here//)
5863 #
5864 80 ▶sub e_s1 {
Subroutine e_s1: called CC=106 SCAR=81.1
Pod undocumented
5865 80 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5866 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
5867  
5868 80 $modifier =~ tr/p//d;
5869 80 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 80 80
5870 0 my $line = 0;
5871 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
5872 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
5873 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
5874 0 last;
5875 }
5876 }
5877 0 die qq{Unsupported modifier "$1" used at line $line.\n};
5878 }
5879  
5880 80 $slash = 'div';
5881  
5882 # literal null string pattern
5883 80 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 72 80
elsif ($modifier =~ tr/Bb//d) { } 0 72 72
5884 8 $modifier =~ tr/bB//d;
5885 8 $modifier =~ tr/i//d;
5886 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
5887 }
5888  
5889 # /b /B modifier
5890 elsif ($modifier =~ tr/bB//d) {
5891  
5892 # choice again delimiter
5893 0 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 0 0
5894 0 my @char = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5895 0 my %octet = map {$_ => 1} @char;
5896 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
5897 0 $delimiter = '(';
5898 0 $end_delimiter = ')';
5899 }
5900 elsif (not $octet{'}'}) {
5901 0 $delimiter = '{';
5902 0 $end_delimiter = '}';
5903 }
5904 elsif (not $octet{']'}) {
5905 0 $delimiter = '[';
5906 0 $end_delimiter = ']';
5907 }
5908 elsif (not $octet{'>'}) {
5909 0 $delimiter = '<';
5910 0 $end_delimiter = '>';
5911 }
5912 else {
5913 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5914 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5915 0 $delimiter = $char;
5916 0 $end_delimiter = $char;
5917 0 last;
5918 }
5919 }
5920 }
5921 }
5922  
5923 0 my $prematch = '';
5924 0 return join '', $ope, $delimiter, $prematch, '(?:', $string, ')', $matched, $end_delimiter, $modifier;
5925 }
5926  
5927 72 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 1 71 72
5928 72 my $metachar = qr/[\@\\|[\]{^]/oxms;
5929  
5930 # split regexp
5931 72 my @char = $string =~ /\G((?>
5932 [^\\\$\@\[\(] |
5933 \\ (?>[1-9][0-9]*) |
5934 \\g (?>\s*) (?>[1-9][0-9]*) |
5935 \\g (?>\s*) \{ (?>\s*) (?>[1-9][0-9]*) (?>\s*) \} |
5936 \\g (?>\s*) \{ (?>\s*) - (?>\s*) (?>[1-9][0-9]*) (?>\s*) \} |
5937 \\x (?>[0-9A-Fa-f]{1,2}) |
5938 \\ (?>[0-7]{2,3}) |
5939 \\c [\x40-\x5F] |
5940 \\x\{ (?>[0-9A-Fa-f]+) \} |
5941 \\o\{ (?>[0-7]+) \} |
5942 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
5943 \\ $q_char |
5944 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5945 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5946 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5947 [\$\@] $qq_variable |
5948 \$ (?>\s* [0-9]+) |
5949 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5950 \$ \$ (?![\w\{]) |
5951 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5952 \[\^ |
5953 \[\: (?>[a-z]+) :\] |
5954 \[\:\^ (?>[a-z]+) :\] |
5955 \(\? |
5956 $q_char
5957 ))/oxmsg;
5958  
5959 # choice again delimiter
5960 72 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 72 72
5961 0 my %octet = map {$_ => 1} @char;
5962 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
5963 0 $delimiter = '(';
5964 0 $end_delimiter = ')';
5965 }
5966 elsif (not $octet{'}'}) {
5967 0 $delimiter = '{';
5968 0 $end_delimiter = '}';
5969 }
5970 elsif (not $octet{']'}) {
5971 0 $delimiter = '[';
5972 0 $end_delimiter = ']';
5973 }
5974 elsif (not $octet{'>'}) {
5975 0 $delimiter = '<';
5976 0 $end_delimiter = '>';
5977 }
5978 else {
5979 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5980 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5981 0 $delimiter = $char;
5982 0 $end_delimiter = $char;
5983 0 last;
5984 }
5985 }
5986 }
5987 }
5988  
5989 # count '('
5990 72 my $parens = grep { $_ eq '(' } @char;
5991  
5992 72 my $left_e = 0;
5993 72 my $right_e = 0;
5994 72 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 200 72 272
5995  
5996 # "\L\u" --> "\u\L"
5997 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
5998 0 @char[$i,$i+1] = @char[$i+1,$i];
5999 }
6000  
6001 # "\U\l" --> "\l\U"
6002 ▶ 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
6003 0 @char[$i,$i+1] = @char[$i+1,$i];
6004 }
6005  
6006 # octal escape sequence
6007 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
6008 1 $char[$i] = Ewindows1258::octchr($1);
6009 }
6010  
6011 # hexadecimal escape sequence
6012 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
6013 1 $char[$i] = Ewindows1258::hexchr($1);
6014 }
6015  
6016 # \b{...} --> b\{...}
6017 # \B{...} --> B\{...}
6018 # \N{CHARNAME} --> N\{CHARNAME}
6019 # \p{PROPERTY} --> p\{PROPERTY}
6020 # \P{PROPERTY} --> P\{PROPERTY}
6021 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
6022 0 $char[$i] = $1 . '\\' . $2;
6023 }
6024  
6025 # \p, \P, \X --> p, P, X
6026 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
6027 0 $char[$i] = $1;
6028 }
6029  
6030 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 &Ewindows1258::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
6031 }
6032  
6033 # join separated multiple-octet
6034 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
6035 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 $Ewindows1258::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 $Ewindows1258::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 $Ewindows1258::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 $Ewindows1258::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 $Ewindows1258::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 $Ewindows1258::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 $Ewindows1258::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6036 0 $char[$i] .= join '', splice @char, $i+1, 3;
6037 }
6038 ▶ 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 $Ewindows1258::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 $Ewindows1258::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 $Ewindows1258::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 $Ewindows1258::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6039 0 $char[$i] .= join '', splice @char, $i+1, 2;
6040 }
6041 ▶ 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 $Ewindows1258::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 $Ewindows1258::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 $Ewindows1258::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 $Ewindows1258::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6042 0 $char[$i] .= join '', splice @char, $i+1, 1;
6043 }
6044 }
6045  
6046 # open character class [...]
6047 elsif ($char[$i] eq '[') {
6048 17 my $left = $i;
6049 17 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 17 17
6050 0 $i++;
6051 }
6052 17 while (1) {
6053 74 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 74 74
6054 0 die __FILE__, ": Unmatched [] in regexp\n";
6055 }
6056 74 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 17 57 74
6057 17 my $right = $i;
6058  
6059 # [...]
6060 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
6061 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Ewindows1258::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6062 }
6063 else {
6064 17 splice @char, $left, $right-$left+1, Ewindows1258::charlist_qr(@char[$left+1..$right-1], $modifier);
6065 }
6066  
6067 17 $i = $left;
6068 17 last;
6069 }
6070 }
6071 }
6072  
6073 # open character class [^...]
6074 elsif ($char[$i] eq '[^') {
6075 0 my $left = $i;
6076 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6077 0 $i++;
6078 }
6079 0 while (1) {
6080 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6081 0 die __FILE__, ": Unmatched [] in regexp\n";
6082 }
6083 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6084 0 my $right = $i;
6085  
6086 # [^...]
6087 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
6088 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Ewindows1258::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6089 }
6090 else {
6091 0 splice @char, $left, $right-$left+1, Ewindows1258::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6092 }
6093  
6094 0 $i = $left;
6095 0 last;
6096 }
6097 }
6098 }
6099  
6100 # rewrite character class or escape character
6101 elsif (my $char = character_class($char[$i],$modifier)) {
6102 7 $char[$i] = $char;
6103 }
6104  
6105 # /i modifier
6106 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Ewindows1258::uc($char[$i]) ne Ewindows1258::fc($char[$i]))) {
Condition66%4/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Ewindows1258::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 &Ewindows1258::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Ewindows1258::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= &Ewindows1258::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6107 3 ▶ if (CORE::length(Ewindows1258::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 3 0 3
6108 3 $char[$i] = '[' . Ewindows1258::uc($char[$i]) . Ewindows1258::fc($char[$i]) . ']';
6109 }
6110 else {
6111 0 $char[$i] = '(?:' . Ewindows1258::uc($char[$i]) . '|' . Ewindows1258::fc($char[$i]) . ')';
6112 }
6113 }
6114  
6115 # \u \l \U \L \F \Q \E
6116 elsif ($char[$i] =~ /\A [<>] \z/oxms) {
6117 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
6118 0 $char[$i] = '\\' . $char[$i];
6119 }
6120 }
6121 elsif ($char[$i] eq '\u') {
6122 0 $char[$i] = '@{[Ewindows1258::ucfirst qq<';
6123 0 $left_e++;
6124 }
6125 elsif ($char[$i] eq '\l') {
6126 0 $char[$i] = '@{[Ewindows1258::lcfirst qq<';
6127 0 $left_e++;
6128 }
6129 elsif ($char[$i] eq '\U') {
6130 0 $char[$i] = '@{[Ewindows1258::uc qq<';
6131 0 $left_e++;
6132 }
6133 elsif ($char[$i] eq '\L') {
6134 0 $char[$i] = '@{[Ewindows1258::lc qq<';
6135 0 $left_e++;
6136 }
6137 elsif ($char[$i] eq '\F') {
6138 0 $char[$i] = '@{[Ewindows1258::fc qq<';
6139 0 $left_e++;
6140 }
6141 elsif ($char[$i] eq '\Q') {
6142 0 $char[$i] = '@{[CORE::quotemeta qq<';
6143 0 $left_e++;
6144 }
6145 elsif ($char[$i] eq '\E') {
6146 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
6147 0 $char[$i] = '>]}';
6148 0 $right_e++;
6149 }
6150 else {
6151 0 $char[$i] = '';
6152 }
6153 }
6154 elsif ($char[$i] eq '\Q') {
6155 0 while (1) {
6156 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6157 0 last;
6158 }
6159 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
6160 0 last;
6161 }
6162 }
6163 }
6164 elsif ($char[$i] eq '\E') {
6165 }
6166  
6167 # \0 --> \0
6168 elsif ($char[$i] =~ /\A \\ (?>\s*) 0 \z/oxms) {
6169 }
6170  
6171 # \g{N}, \g{-N}
6172  
6173 # P.108 Using Simple Patterns
6174 # in Chapter 7: In the World of Regular Expressions
6175 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
6176  
6177 # P.221 Capturing
6178 # in Chapter 5: Pattern Matching
6179 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
6180  
6181 # \g{-1}, \g{-2}, \g{-3} --> \g{-1}, \g{-2}, \g{-3}
6182 elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) - (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6183 }
6184  
6185 # \g{1}, \g{2}, \g{3} --> \g{2}, \g{3}, \g{4} (only when multibyte anchoring is enable)
6186 elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6187 }
6188  
6189 # \g1, \g2, \g3 --> \g2, \g3, \g4 (only when multibyte anchoring is enable)
6190 elsif ($char[$i] =~ /\A \\g (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) {
6191 }
6192  
6193 # \1, \2, \3 --> \2, \3, \4 (only when multibyte anchoring is enable)
6194 elsif ($char[$i] =~ /\A \\ (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) {
6195 }
6196  
6197 # $0 --> $0
6198 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
6199 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6200 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
6201 }
6202 }
6203 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
6204 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6205 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
6206 }
6207 }
6208  
6209 # $$ --> $$
6210 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
6211 }
6212  
6213 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
6214 # $1, $2, $3 --> $1, $2, $3 otherwise
6215 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
6216 0 $char[$i] = e_capture($1);
6217 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6218 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
6219 }
6220 }
6221 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6222 0 $char[$i] = e_capture($1);
6223 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6224 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
6225 }
6226 }
6227  
6228 # $$foo[ ... ] --> $ $foo->[ ... ]
6229 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
6230 0 $char[$i] = e_capture($1.'->'.$2);
6231 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6232 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
6233 }
6234 }
6235  
6236 # $$foo{ ... } --> $ $foo->{ ... }
6237 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
6238 0 $char[$i] = e_capture($1.'->'.$2);
6239 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6240 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
6241 }
6242 }
6243  
6244 # $$foo
6245 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
6246 0 $char[$i] = e_capture($1);
6247 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6248 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
6249 }
6250 }
6251  
6252 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Ewindows1258::PREMATCH()
6253 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
6254 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 4 4
6255 0 $char[$i] = '@{[Ewindows1258::ignorecase(Ewindows1258::PREMATCH())]}';
6256 }
6257 else {
6258 4 $char[$i] = '@{[Ewindows1258::PREMATCH()]}';
6259 }
6260 }
6261  
6262 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Ewindows1258::MATCH()
6263 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
6264 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 4 4
6265 0 $char[$i] = '@{[Ewindows1258::ignorecase(Ewindows1258::MATCH())]}';
6266 }
6267 else {
6268 4 $char[$i] = '@{[Ewindows1258::MATCH()]}';
6269 }
6270 }
6271  
6272 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Ewindows1258::POSTMATCH()
6273 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
6274 3 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 3 3
6275 0 $char[$i] = '@{[Ewindows1258::ignorecase(Ewindows1258::POSTMATCH())]}';
6276 }
6277 else {
6278 3 $char[$i] = '@{[Ewindows1258::POSTMATCH()]}';
6279 }
6280 }
6281  
6282 # ${ foo }
6283 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
6284 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6285 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
6286 }
6287 }
6288  
6289 # ${ ... }
6290 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
6291 0 $char[$i] = e_capture($1);
6292 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6293 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
6294 }
6295 }
6296  
6297 # $scalar or @array
6298 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
6299 4 $char[$i] = e_string($char[$i]);
6300 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 4 4
6301 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
6302 }
6303 }
6304  
6305 # quote character before ? + * {
6306 ▶ 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
6307 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
6308 }
6309 else {
6310 14 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6311 }
6312 }
6313 }
6314  
6315 # make regexp string
6316 72 my $prematch = '';
6317 72 $modifier =~ tr/i//d;
6318 72 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 72 72
6319 0 return join '', $ope, $delimiter, $prematch, '(?:', @char, '>]}' x ($left_e - $right_e), ')', $matched, $end_delimiter, $modifier;
6320 }
6321 72 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6322 }
6323  
6324 #
6325 # escape regexp (s'here'' or s'here''b)
6326 #
6327 21 ▶sub e_s1_q {
Subroutine e_s1_q: called CC=7 SCAR=24.3
Pod undocumented
6328 21 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6329 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
6330  
6331 21 $modifier =~ tr/p//d;
6332 21 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 21 21
6333 0 my $line = 0;
6334 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6335 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6336 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6337 0 last;
6338 }
6339 }
6340 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6341 }
6342  
6343 21 $slash = 'div';
6344  
6345 # literal null string pattern
6346 21 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 13 21
elsif ($modifier =~ tr/Bb//d) { } 0 13 13
6347 8 $modifier =~ tr/bB//d;
6348 8 $modifier =~ tr/i//d;
6349 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
6350 }
6351  
6352 # with /b /B modifier
6353 elsif ($modifier =~ tr/bB//d) {
6354 0 return e_s1_qb($ope,$delimiter,$end_delimiter,$string,$modifier);
6355 }
6356  
6357 # without /b /B modifier
6358 else {
6359 13 return e_s1_qt($ope,$delimiter,$end_delimiter,$string,$modifier);
6360 }
6361 }
6362  
6363 #
6364 # escape regexp (s'here'')
6365 #
6366 13 ▶sub e_s1_qt {
Subroutine e_s1_qt: called CC=20 SCAR=50.1
Pod undocumented
6367 13 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6368  
6369 13 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 13 13
6370  
6371 # split regexp
6372 13 my @char = $string =~ /\G((?>
6373 [^\\\[\$\@\/] |
6374 [\x00-\xFF] |
6375 \[\^ |
6376 \[\: (?>[a-z]+) \:\] |
6377 \[\:\^ (?>[a-z]+) \:\] |
6378 [\$\@\/] |
6379 \\ (?:$q_char) |
6380 (?:$q_char)
6381 ))/oxmsg;
6382  
6383 # unescape character
6384 13 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 25 13 38
6385 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 &Ewindows1258::uc($char[$i]) ne &fc($char[$i])) { } 0 19 19
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 32 32
6386 }
6387  
6388 # open character class [...]
6389 elsif ($char[$i] eq '[') {
6390 0 my $left = $i;
6391 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6392 0 $i++;
6393 }
6394 0 while (1) {
6395 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6396 0 die __FILE__, ": Unmatched [] in regexp\n";
6397 }
6398 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6399 0 my $right = $i;
6400  
6401 # [...]
6402 0 splice @char, $left, $right-$left+1, Ewindows1258::charlist_qr(@char[$left+1..$right-1], $modifier);
6403  
6404 0 $i = $left;
6405 0 last;
6406 }
6407 }
6408 }
6409  
6410 # open character class [^...]
6411 elsif ($char[$i] eq '[^') {
6412 0 my $left = $i;
6413 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6414 0 $i++;
6415 }
6416 0 while (1) {
6417 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6418 0 die __FILE__, ": Unmatched [] in regexp\n";
6419 }
6420 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6421 0 my $right = $i;
6422  
6423 # [^...]
6424 0 splice @char, $left, $right-$left+1, Ewindows1258::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6425  
6426 0 $i = $left;
6427 0 last;
6428 }
6429 }
6430 }
6431  
6432 # escape $ @ / and \
6433 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6434 0 $char[$i] = '\\' . $char[$i];
6435 }
6436  
6437 # rewrite character class or escape character
6438 elsif (my $char = character_class($char[$i],$modifier)) {
6439 6 $char[$i] = $char;
6440 }
6441  
6442 # /i modifier
6443 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Ewindows1258::uc($char[$i]) ne Ewindows1258::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Ewindows1258::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 &Ewindows1258::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Ewindows1258::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= &Ewindows1258::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6444 0 ▶ if (CORE::length(Ewindows1258::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
6445 0 $char[$i] = '[' . Ewindows1258::uc($char[$i]) . Ewindows1258::fc($char[$i]) . ']';
6446 }
6447 else {
6448 0 $char[$i] = '(?:' . Ewindows1258::uc($char[$i]) . '|' . Ewindows1258::fc($char[$i]) . ')';
6449 }
6450 }
6451  
6452 # quote character before ? + * {
6453 ▶ 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
6454 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
6455 }
6456 else {
6457 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6458 }
6459 }
6460 }
6461  
6462 13 $modifier =~ tr/i//d;
6463 13 $delimiter = '/';
6464 13 $end_delimiter = '/';
6465 13 my $prematch = '';
6466 13 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6467 }
6468  
6469 #
6470 # escape regexp (s'here''b)
6471 #
6472 0 ▶sub e_s1_qb {
Subroutine e_s1_qb: not called CC=4 SCAR=30.0
Pod undocumented
6473 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6474  
6475 # split regexp
6476 0 my @char = $string =~ /\G (?>[^\\]|\\\\) /oxmsg;
6477  
6478 # unescape character
6479 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
6480 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
6481 }
6482  
6483 # remain \\
6484 elsif ($char[$i] eq '\\\\') {
6485 }
6486  
6487 # escape $ @ / and \
6488 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6489 0 $char[$i] = '\\' . $char[$i];
6490 }
6491 }
6492  
6493 0 $delimiter = '/';
6494 0 $end_delimiter = '/';
6495 0 my $prematch = '';
6496 0 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6497 }
6498  
6499 #
6500 # escape regexp (s''here')
6501 #
6502 16 ▶sub e_s2_q {
Subroutine e_s2_q: called CC=4 SCAR=13.9
Pod undocumented
6503 16 my($ope,$delimiter,$end_delimiter,$string) = @_;
6504  
6505 16 $slash = 'div';
6506  
6507 16 my @char = $string =~ / \G (?>[^\\]|\\\\|$q_char) /oxmsg;
6508 16 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 9 16 25
6509 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
6510 }
6511  
6512 # not escape \\
6513 elsif ($char[$i] =~ /\A \\\\ \z/oxms) {
6514 }
6515  
6516 # escape $ @ / and \
6517 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6518 5 $char[$i] = '\\' . $char[$i];
6519 }
6520 }
6521  
6522 16 return join '', $ope, $delimiter, @char, $end_delimiter;
6523 }
6524  
6525 #
6526 # escape regexp (s/here/and here/modifier)
6527 #
6528 101 ▶sub e_sub {
Subroutine e_sub: called CC=20 SCAR=32.6
Pod undocumented
6529 101 my($variable,$delimiter1,$pattern,$end_delimiter1,$delimiter2,$replacement,$end_delimiter2,$modifier) = @_;
6530 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
6531  
6532 101 $modifier =~ tr/p//d;
6533 101 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 101 101
6534 0 my $line = 0;
6535 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6536 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6537 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6538 0 last;
6539 }
6540 }
6541 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6542 }
6543  
6544 101 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq "") 36 65 101
6545 36 $variable = '$_';
6546 36 $bind_operator = ' =~ ';
6547 }
6548  
6549 101 $slash = 'div';
6550  
6551 # P.128 Start of match (or end of previous match): \G
6552 # P.130 Advanced Use of \G with Perl
6553 # in Chapter 3: Overview of Regular Expression Features and Flavors
6554 # P.312 Iterative Matching: Scalar Context, with /g
6555 # in Chapter 7: Perl
6556 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
6557  
6558 # P.181 Where You Left Off: The \G Assertion
6559 # in Chapter 5: Pattern Matching
6560 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
6561  
6562 # P.220 Where You Left Off: The \G Assertion
6563 # in Chapter 5: Pattern Matching
6564 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
6565  
6566 101 my $e_modifier = $modifier =~ tr/e//d;
6567 101 my $r_modifier = $modifier =~ tr/r//d;
6568  
6569 101 my $my = '';
6570 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
6571 0 $my = $variable;
6572 0 $variable =~ s/ (?: local \b | my \b | our \b | state \b ) (?>\s*) //oxms;
6573 0 $variable =~ s/ = .+ \z//oxms;
6574 }
6575  
6576 101 (my $variable_basename = $variable) =~ s/ [\[\{].* \z//oxms;
6577 101 $variable_basename =~ s/ \s+ \z//oxms;
6578  
6579 # quote replacement string
6580 101 my $e_replacement = '';
6581 101 ▶ if ($e_modifier >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($e_modifier >= 1) { } 17 84 101
6582 17 $e_replacement = e_qq('', '', '', $replacement);
6583 17 $e_modifier--;
6584 }
6585 else {
6586 84 ▶ if ($delimiter2 eq "'") {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter2 eq q[']) { } 16 68 84
6587 16 $e_replacement = e_s2_q('qq', '/', '/', $replacement);
6588 }
6589 else {
6590 68 $e_replacement = e_qq ('qq', $delimiter2, $end_delimiter2, $replacement);
6591 }
6592 }
6593  
6594 101 my $sub = '';
6595  
6596 # with /r
6597 101 ▶ if ($r_modifier) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r_modifier) { } 10 91 101
6598 10 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $modifier =~ /g/mosx }) { } 5 5 10
6599 }
6600  
6601 # s///gr without multibyte anchoring
6602 elsif ($modifier =~ /g/oxms) {
6603 5 ▶ $sub = sprintf(
Branch: 1 branch
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 0 5 5
6604 # 1 2 3 4 5
6605 q<CORE::eval{local $Ewindows1258::re_t=%s; while($Ewindows1258::re_t =~ %s){%s local $^W=0; local $Ewindows1258::re_r=%s; %s$Ewindows1258::re_t="$`$Ewindows1258::re_r$'"; pos($Ewindows1258::re_t)=length "$`$Ewindows1258::re_r"; } return $Ewindows1258::re_t}>,
6606  
6607 $variable, # 1
6608 ($delimiter1 eq "'") ? # 2
6609 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
6610 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
6611 $s_matched, # 3
6612 $e_replacement, # 4
6613 '$Ewindows1258::re_r=CORE::eval $Ewindows1258::re_r; ' x $e_modifier, # 5
6614 );
6615 }
6616  
6617 # s///r
6618 else {
6619  
6620 5 my $prematch = q{$`};
6621  
6622 5 ▶ $sub = sprintf(
Branch: 1 branch
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 0 5 5
6623 # 1 2 3 4 5 6 7
6624 q<(%s =~ %s) ? CORE::eval{%s local $^W=0; local $Ewindows1258::re_r=%s; %s"%s$Ewindows1258::re_r$'" } : %s>,
6625  
6626 $variable, # 1
6627 ($delimiter1 eq "'") ? # 2
6628 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
6629 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
6630 $s_matched, # 3
6631 $e_replacement, # 4
6632 '$Ewindows1258::re_r=CORE::eval $Ewindows1258::re_r; ' x $e_modifier, # 5
6633 $prematch, # 6
6634 $variable, # 7
6635 );
6636 }
6637  
6638 # $var !~ s///r doesn't make sense
6639 10 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) 0 10 10
6640 0 $sub = q{die("$0: Using !~ with s///r doesn't make sense"), } . $sub;
6641 }
6642 }
6643  
6644 # without /r
6645 else {
6646 91 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $modifier =~ /g/mosx }) { } 23 68 91
6647 }
6648  
6649 # s///g without multibyte anchoring
6650 elsif ($modifier =~ /g/oxms) {
6651 23 ▶ $sub = sprintf(
Branch: 2 branches
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 3 20 23
$bind_operator =~ / !~ /mosx ? : 3 20 23
6652 # 1 2 3 4 5 6 7 8
6653 q<CORE::eval{local $Ewindows1258::re_n=0; while(%s =~ %s){%s local $^W=0; local $Ewindows1258::re_r=%s; %s%s="$`$Ewindows1258::re_r$'"; pos(%s)=length "$`$Ewindows1258::re_r"; $Ewindows1258::re_n++} return %s$Ewindows1258::re_n}>,
6654  
6655 $variable, # 1
6656 ($delimiter1 eq "'") ? # 2
6657 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
6658 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
6659 $s_matched, # 3
6660 $e_replacement, # 4
6661 '$Ewindows1258::re_r=CORE::eval $Ewindows1258::re_r; ' x $e_modifier, # 5
6662 $variable, # 6
6663 $variable, # 7
6664 ($bind_operator =~ / !~ /oxms) ? '!' : '', # 8
6665 );
6666 }
6667  
6668 # s///
6669 else {
6670  
6671 68 my $prematch = q{$`};
6672  
6673 68 ▶ $sub = sprintf(
Branch: 2 branches
BranchTrueFalseTotal
$bind_operator =~ / =~ /mosx ? : 65 3 68
$delimiter1 eq q['] ? : 18 50 68
6674  
6675 ($bind_operator =~ / =~ /oxms) ?
6676  
6677 # 1 2 3 4 5 6 7 8
6678 q<(%s%s%s) ? CORE::eval{%s local $^W=0; local $Ewindows1258::re_r=%s; %s%s="%s$Ewindows1258::re_r$'"; 1 } : undef> :
6679  
6680 # 1 2 3 4 5 6 7 8
6681 q<(%s%s%s) ? 1 : CORE::eval{%s local $^W=0; local $Ewindows1258::re_r=%s; %s%s="%s$Ewindows1258::re_r$'"; undef }>,
6682  
6683 $variable, # 1
6684 $bind_operator, # 2
6685 ($delimiter1 eq "'") ? # 3
6686 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
6687 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
6688 $s_matched, # 4
6689 $e_replacement, # 5
6690 '$Ewindows1258::re_r=CORE::eval $Ewindows1258::re_r; ' x $e_modifier, # 6
6691 $variable, # 7
6692 $prematch, # 8
6693 );
6694 }
6695 }
6696  
6697 # (my $foo = $bar) =~ s/// --> (my $foo = $bar, CORE::eval { ... })[1]
6698 101 ▶ if ($my ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($my ne "") 0 101 101
6699 0 $sub = "($my, $sub)[1]";
6700 }
6701  
6702 # clear s/// variable
6703 101 $sub_variable = '';
6704 101 $bind_operator = '';
6705  
6706 101 return $sub;
6707 }
6708  
6709 #
6710 # escape regexp of split qr//
6711 #
6712 74 ▶sub e_split {
Subroutine e_split: called CC=88 SCAR=76.4
Pod undocumented
6713 74 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6714 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
6715  
6716 74 $modifier =~ tr/p//d;
6717 74 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 74 74
6718 0 my $line = 0;
6719 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6720 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6721 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6722 0 last;
6723 }
6724 }
6725 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6726 }
6727  
6728 74 $slash = 'div';
6729  
6730 # /b /B modifier
6731 74 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) 0 74 74
6732 0 return join '', 'split', $ope, $delimiter, $string, $end_delimiter, $modifier;
6733 }
6734  
6735 74 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 74 74
6736 74 my $metachar = qr/[\@\\|[\]{^]/oxms;
6737  
6738 # split regexp
6739 74 my @char = $string =~ /\G((?>
6740 [^\\\$\@\[\(] |
6741 \\x (?>[0-9A-Fa-f]{1,2}) |
6742 \\ (?>[0-7]{2,3}) |
6743 \\c [\x40-\x5F] |
6744 \\x\{ (?>[0-9A-Fa-f]+) \} |
6745 \\o\{ (?>[0-7]+) \} |
6746 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
6747 \\ $q_char |
6748 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
6749 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
6750 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
6751 [\$\@] $qq_variable |
6752 \$ (?>\s* [0-9]+) |
6753 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
6754 \$ \$ (?![\w\{]) |
6755 \$ (?>\s*) \$ (?>\s*) $qq_variable |
6756 \[\^ |
6757 \[\: (?>[a-z]+) :\] |
6758 \[\:\^ (?>[a-z]+) :\] |
6759 \(\? |
6760 $q_char
6761 ))/oxmsg;
6762  
6763 74 my $left_e = 0;
6764 74 my $right_e = 0;
6765 74 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 249 74 323
6766  
6767 # "\L\u" --> "\u\L"
6768 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
6769 0 @char[$i,$i+1] = @char[$i+1,$i];
6770 }
6771  
6772 # "\U\l" --> "\l\U"
6773 ▶ 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
6774 0 @char[$i,$i+1] = @char[$i+1,$i];
6775 }
6776  
6777 # octal escape sequence
6778 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
6779 1 $char[$i] = Ewindows1258::octchr($1);
6780 }
6781  
6782 # hexadecimal escape sequence
6783 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
6784 1 $char[$i] = Ewindows1258::hexchr($1);
6785 }
6786  
6787 # \b{...} --> b\{...}
6788 # \B{...} --> B\{...}
6789 # \N{CHARNAME} --> N\{CHARNAME}
6790 # \p{PROPERTY} --> p\{PROPERTY}
6791 # \P{PROPERTY} --> P\{PROPERTY}
6792 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
6793 0 $char[$i] = $1 . '\\' . $2;
6794 }
6795  
6796 # \p, \P, \X --> p, P, X
6797 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
6798 0 $char[$i] = $1;
6799 }
6800  
6801 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 &Ewindows1258::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
6802 }
6803  
6804 # join separated multiple-octet
6805 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
6806 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 $Ewindows1258::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 $Ewindows1258::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 $Ewindows1258::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 $Ewindows1258::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 $Ewindows1258::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 $Ewindows1258::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 $Ewindows1258::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6807 0 $char[$i] .= join '', splice @char, $i+1, 3;
6808 }
6809 ▶ 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 $Ewindows1258::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 $Ewindows1258::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 $Ewindows1258::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 $Ewindows1258::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6810 0 $char[$i] .= join '', splice @char, $i+1, 2;
6811 }
6812 ▶ 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 $Ewindows1258::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 $Ewindows1258::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 $Ewindows1258::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 $Ewindows1258::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6813 0 $char[$i] .= join '', splice @char, $i+1, 1;
6814 }
6815 }
6816  
6817 # open character class [...]
6818 elsif ($char[$i] eq '[') {
6819 3 my $left = $i;
6820 3 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 3 3
6821 0 $i++;
6822 }
6823 3 while (1) {
6824 7 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 7 7
6825 0 die __FILE__, ": Unmatched [] in regexp\n";
6826 }
6827 7 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 3 4 7
6828 3 my $right = $i;
6829  
6830 # [...]
6831 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
6832 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Ewindows1258::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6833 }
6834 else {
6835 3 splice @char, $left, $right-$left+1, Ewindows1258::charlist_qr(@char[$left+1..$right-1], $modifier);
6836 }
6837  
6838 3 $i = $left;
6839 3 last;
6840 }
6841 }
6842 }
6843  
6844 # open character class [^...]
6845 elsif ($char[$i] eq '[^') {
6846 0 my $left = $i;
6847 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6848 0 $i++;
6849 }
6850 0 while (1) {
6851 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6852 0 die __FILE__, ": Unmatched [] in regexp\n";
6853 }
6854 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6855 0 my $right = $i;
6856  
6857 # [^...]
6858 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
6859 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Ewindows1258::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6860 }
6861 else {
6862 0 splice @char, $left, $right-$left+1, Ewindows1258::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6863 }
6864  
6865 0 $i = $left;
6866 0 last;
6867 }
6868 }
6869 }
6870  
6871 # rewrite character class or escape character
6872 elsif (my $char = character_class($char[$i],$modifier)) {
6873 1 $char[$i] = $char;
6874 }
6875  
6876 # P.794 29.2.161. split
6877 # in Chapter 29: Functions
6878 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
6879  
6880 # P.951 split
6881 # in Chapter 27: Functions
6882 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
6883  
6884 # said "The //m modifier is assumed when you split on the pattern /^/",
6885 # but perl5.008 is not so. Therefore, this software adds //m.
6886 # (and so on)
6887  
6888 # split(m/^/) --> split(m/^/m)
6889 ▶ 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
6890 7 $modifier .= 'm';
6891 }
6892  
6893 # /i modifier
6894 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Ewindows1258::uc($char[$i]) ne Ewindows1258::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Ewindows1258::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 &Ewindows1258::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Ewindows1258::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= &Ewindows1258::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6895 0 ▶ if (CORE::length(Ewindows1258::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
6896 0 $char[$i] = '[' . Ewindows1258::uc($char[$i]) . Ewindows1258::fc($char[$i]) . ']';
6897 }
6898 else {
6899 0 $char[$i] = '(?:' . Ewindows1258::uc($char[$i]) . '|' . Ewindows1258::fc($char[$i]) . ')';
6900 }
6901 }
6902  
6903 # \u \l \U \L \F \Q \E
6904 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
6905 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
6906 0 $char[$i] = '\\' . $char[$i];
6907 }
6908 }
6909 elsif ($char[$i] eq '\u') {
6910 0 $char[$i] = '@{[Ewindows1258::ucfirst qq<';
6911 0 $left_e++;
6912 }
6913 elsif ($char[$i] eq '\l') {
6914 0 $char[$i] = '@{[Ewindows1258::lcfirst qq<';
6915 0 $left_e++;
6916 }
6917 elsif ($char[$i] eq '\U') {
6918 0 $char[$i] = '@{[Ewindows1258::uc qq<';
6919 0 $left_e++;
6920 }
6921 elsif ($char[$i] eq '\L') {
6922 0 $char[$i] = '@{[Ewindows1258::lc qq<';
6923 0 $left_e++;
6924 }
6925 elsif ($char[$i] eq '\F') {
6926 0 $char[$i] = '@{[Ewindows1258::fc qq<';
6927 0 $left_e++;
6928 }
6929 elsif ($char[$i] eq '\Q') {
6930 0 $char[$i] = '@{[CORE::quotemeta qq<';
6931 0 $left_e++;
6932 }
6933 elsif ($char[$i] eq '\E') {
6934 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
6935 0 $char[$i] = '>]}';
6936 0 $right_e++;
6937 }
6938 else {
6939 0 $char[$i] = '';
6940 }
6941 }
6942 elsif ($char[$i] eq '\Q') {
6943 0 while (1) {
6944 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6945 0 last;
6946 }
6947 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
6948 0 last;
6949 }
6950 }
6951 }
6952 elsif ($char[$i] eq '\E') {
6953 }
6954  
6955 # $0 --> $0
6956 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
6957 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6958 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
6959 }
6960 }
6961 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
6962 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6963 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
6964 }
6965 }
6966  
6967 # $$ --> $$
6968 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
6969 }
6970  
6971 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
6972 # $1, $2, $3 --> $1, $2, $3 otherwise
6973 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
6974 0 $char[$i] = e_capture($1);
6975 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6976 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
6977 }
6978 }
6979 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6980 0 $char[$i] = e_capture($1);
6981 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6982 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
6983 }
6984 }
6985  
6986 # $$foo[ ... ] --> $ $foo->[ ... ]
6987 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
6988 0 $char[$i] = e_capture($1.'->'.$2);
6989 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6990 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
6991 }
6992 }
6993  
6994 # $$foo{ ... } --> $ $foo->{ ... }
6995 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
6996 0 $char[$i] = e_capture($1.'->'.$2);
6997 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6998 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
6999 }
7000 }
7001  
7002 # $$foo
7003 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
7004 0 $char[$i] = e_capture($1);
7005 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7006 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
7007 }
7008 }
7009  
7010 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Ewindows1258::PREMATCH()
7011 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
7012 12 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 12 12
7013 0 $char[$i] = '@{[Ewindows1258::ignorecase(Ewindows1258::PREMATCH())]}';
7014 }
7015 else {
7016 12 $char[$i] = '@{[Ewindows1258::PREMATCH()]}';
7017 }
7018 }
7019  
7020 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Ewindows1258::MATCH()
7021 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
7022 12 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 12 12
7023 0 $char[$i] = '@{[Ewindows1258::ignorecase(Ewindows1258::MATCH())]}';
7024 }
7025 else {
7026 12 $char[$i] = '@{[Ewindows1258::MATCH()]}';
7027 }
7028 }
7029  
7030 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Ewindows1258::POSTMATCH()
7031 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
7032 9 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 9 9
7033 0 $char[$i] = '@{[Ewindows1258::ignorecase(Ewindows1258::POSTMATCH())]}';
7034 }
7035 else {
7036 9 $char[$i] = '@{[Ewindows1258::POSTMATCH()]}';
7037 }
7038 }
7039  
7040 # ${ foo }
7041 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
7042 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7043 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $1 . ')]}';
7044 }
7045 }
7046  
7047 # ${ ... }
7048 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
7049 0 $char[$i] = e_capture($1);
7050 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7051 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
7052 }
7053 }
7054  
7055 # $scalar or @array
7056 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
7057 3 $char[$i] = e_string($char[$i]);
7058 3 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 3 3
7059 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
7060 }
7061 }
7062  
7063 # quote character before ? + * {
7064 ▶ 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
7065 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
7066 }
7067 else {
7068 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
7069 }
7070 }
7071 }
7072  
7073 # make regexp string
7074 74 $modifier =~ tr/i//d;
7075 74 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 74 74
7076 0 return join '', 'Ewindows1258::split', $ope, $delimiter, @char, '>]}' x ($left_e - $right_e), $end_delimiter, $modifier;
7077 }
7078 74 return join '', 'Ewindows1258::split', $ope, $delimiter, @char, $end_delimiter, $modifier;
7079 }
7080  
7081 #
7082 # escape regexp of split qr''
7083 #
7084 0 ▶sub e_split_q {
Subroutine e_split_q: not called CC=26 SCAR=65.5
Pod undocumented
7085 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
7086 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
7087  
7088 0 $modifier =~ tr/p//d;
7089 0 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 0 0
7090 0 my $line = 0;
7091 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7092 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
7093 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
7094 0 last;
7095 }
7096 }
7097 0 die qq{Unsupported modifier "$1" used at line $line.\n};
7098 }
7099  
7100 0 $slash = 'div';
7101  
7102 # /b /B modifier
7103 0 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) 0 0 0
7104 0 return join '', 'split', $ope, $delimiter, $string, $end_delimiter, $modifier;
7105 }
7106  
7107 0 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 0 0
7108  
7109 # split regexp
7110 0 my @char = $string =~ /\G((?>
7111 [^\\\[] |
7112 [\x00-\xFF] |
7113 \[\^ |
7114 \[\: (?>[a-z]+) \:\] |
7115 \[\:\^ (?>[a-z]+) \:\] |
7116 \\ (?:$q_char) |
7117 (?:$q_char)
7118 ))/oxmsg;
7119  
7120 # unescape character
7121 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
7122 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 &Ewindows1258::uc($char[$i]) ne &fc($char[$i])) { } 0 0 0
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 0 0
7123 }
7124  
7125 # open character class [...]
7126 elsif ($char[$i] eq '[') {
7127 0 my $left = $i;
7128 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7129 0 $i++;
7130 }
7131 0 while (1) {
7132 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7133 0 die __FILE__, ": Unmatched [] in regexp\n";
7134 }
7135 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7136 0 my $right = $i;
7137  
7138 # [...]
7139 0 splice @char, $left, $right-$left+1, Ewindows1258::charlist_qr(@char[$left+1..$right-1], $modifier);
7140  
7141 0 $i = $left;
7142 0 last;
7143 }
7144 }
7145 }
7146  
7147 # open character class [^...]
7148 elsif ($char[$i] eq '[^') {
7149 0 my $left = $i;
7150 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7151 0 $i++;
7152 }
7153 0 while (1) {
7154 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7155 0 die __FILE__, ": Unmatched [] in regexp\n";
7156 }
7157 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7158 0 my $right = $i;
7159  
7160 # [^...]
7161 0 splice @char, $left, $right-$left+1, Ewindows1258::charlist_not_qr(@char[$left+1..$right-1], $modifier);
7162  
7163 0 $i = $left;
7164 0 last;
7165 }
7166 }
7167 }
7168  
7169 # rewrite character class or escape character
7170 elsif (my $char = character_class($char[$i],$modifier)) {
7171 0 $char[$i] = $char;
7172 }
7173  
7174 # split(m/^/) --> split(m/^/m)
7175 ▶ 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
7176 0 $modifier .= 'm';
7177 }
7178  
7179 # /i modifier
7180 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Ewindows1258::uc($char[$i]) ne Ewindows1258::fc($char[$i]))) {
Condition0%0/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Ewindows1258::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 &Ewindows1258::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Ewindows1258::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= &Ewindows1258::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
7181 0 ▶ if (CORE::length(Ewindows1258::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
7182 0 $char[$i] = '[' . Ewindows1258::uc($char[$i]) . Ewindows1258::fc($char[$i]) . ']';
7183 }
7184 else {
7185 0 $char[$i] = '(?:' . Ewindows1258::uc($char[$i]) . '|' . Ewindows1258::fc($char[$i]) . ')';
7186 }
7187 }
7188  
7189 # quote character before ? + * {
7190 ▶ 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
7191 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
7192 }
7193 else {
7194 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
7195 }
7196 }
7197 }
7198  
7199 0 $modifier =~ tr/i//d;
7200 0 return join '', 'Ewindows1258::split', $ope, $delimiter, @char, $end_delimiter, $modifier;
7201 }
7202  
7203 #
7204 # instead of Carp::carp
7205 #
7206 0 ▶sub carp {
Subroutine carp: not called CC=1 SCAR=6.9
Pod undocumented
7207 0 my($package,$filename,$line) = caller(1);
7208 0 print STDERR "@_ at $filename line $line.\n";
7209 }
7210  
7211 #
7212 # instead of Carp::croak
7213 #
7214 0 ▶sub croak {
Subroutine croak: not called CC=1 SCAR=6.9
Pod undocumented
7215 0 my($package,$filename,$line) = caller(1);
7216 0 print STDERR "@_ at $filename line $line.\n";
7217 0 die "\n";
7218 }
7219  
7220 #
7221 # instead of Carp::cluck
7222 #
7223 0 ▶sub cluck {
Subroutine cluck: not called CC=2 SCAR=17.9
Pod undocumented
7224 0 my $i = 0;
7225 0 my @cluck = ();
7226 0 ▶ while (my($package,$filename,$line,$subroutine) = caller($i)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7227 0 push @cluck, "[$i] $filename($line) $package::$subroutine\n";
7228 0 $i++;
7229 }
7230 0 print STDERR CORE::reverse @cluck;
7231 0 print STDERR "\n";
7232 0 print STDERR @_;
7233 }
7234  
7235 #
7236 # instead of Carp::confess
7237 #
7238 0 ▶sub confess {
Subroutine confess: not called CC=2 SCAR=17.9
Pod undocumented
7239 0 my $i = 0;
7240 0 my @confess = ();
7241 0 ▶ while (my($package,$filename,$line,$subroutine) = caller($i)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7242 0 push @confess, "[$i] $filename($line) $package::$subroutine\n";
7243 0 $i++;
7244 }
7245 0 print STDERR CORE::reverse @confess;
7246 0 print STDERR "\n";
7247 0 print STDERR @_;
7248 0 die "\n";
7249 }
7250  
7251 424 1;
7252  
7253 __END__
↑ Summary Windows1258.pm »