blib/lib/Ewindows1258.pm

filter: Statementstmt 36.4% 1198 / 3286 Branchbran 38.6% 1141 / 2954 Conditioncond 31.0% 115 / 370 MC/DCmcdc 15.9% 35 / 220 Subroutinesub 60.8% 73 / 120 Podpod 4.6% 3 / 64 totaltotal 36.5% 2565 / 7014 CC 1648 SCAR 99.4
CC
1648
Cov
37%
escape_token
55669.4
e_string
33636.6
e_s1
3320.4
CRAP 20709.5
↑ Summary blib/lib/Windows1258.pm »
1 package Ewindows1258;
2 422 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 ######################################################################
4 #
5 # Ewindows1258 - Run-time routines for Windows1258.pm
6 #
7 # http://search.cpan.org/dist/Char-Windows1258/
8 #
9 # Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2018, 2019 INABA Hitoshi <ina@cpan.org>
10 ######################################################################
11  
12 422 ▶use 5.00503; # Galapagos Consensus 1998 for primetools
Subroutine BEGIN: called CC=1 SCAR=0.0
13 # use 5.008001; # Lancaster Consensus 2013 for toolchains
14  
15 # 12.3. Delaying use Until Runtime
16 # in Chapter 12. Packages, Libraries, and Modules
17 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
18 # (and so on)
19  
20 # Version numbers should be boring
21 # http://www.dagolden.com/index.php/369/version-numbers-should-be-boring/
22 # For the impatient, the disinterested or those who just want to follow
23 # a recipe, my advice for all modules is this:
24 # our $VERSION = "0.001"; # or "0.001_001" for a dev release
25 # $VERSION = eval $VERSION; # No!! because '1.10' makes '1.1'
26  
27 422 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
28 422 $VERSION = '1.15';
29 422 $VERSION = $VERSION;
30  
31 422 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=7.6
32 422 ▶ if ($^X =~ / jperl /oxmsi) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^X =~ / jperl /imosx) 0 422 422
33 0 die __FILE__, ": needs perl(not jperl) 5.00503 or later. (\$^X==$^X)\n";
34 }
35 422 if (CORE::ord('A') == 193) {
36 die __FILE__, ": is not US-ASCII script (may be EBCDIC or EBCDIK script).\n";
37 }
38 422 if (CORE::ord('A') != 0x41) {
39 die __FILE__, ": is not US-ASCII script (must be US-ASCII script).\n";
40 }
41 }
42  
43 422 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=9.5
44  
45 # instead of utf8.pm
46 422 ▶ CORE::eval q{
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
47 no warnings qw(redefine);
48 *utf8::upgrade = sub { CORE::length $_[0] };
49 *utf8::downgrade = sub { 1 };
50 *utf8::encode = sub { };
51 *utf8::decode = sub { 1 };
52 *utf8::is_utf8 = sub { };
53 *utf8::valid = sub { 1 };
54 };
55 422 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 422 422
56 0 ▶ *utf8::upgrade = sub { CORE::length $_[0] };
Subroutine __ANON__: not called CC=1 SCAR=6.9
57 0 ▶ *utf8::downgrade = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
58 0 ▶ *utf8::encode = sub { };
Subroutine __ANON__: not called CC=1 SCAR=6.9
59 0 ▶ *utf8::decode = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
60 0 ▶ *utf8::is_utf8 = sub { };
Subroutine __ANON__: not called CC=1 SCAR=6.9
61 0 ▶ *utf8::valid = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
62 }
63 }
64  
65 # instead of Symbol.pm
66 BEGIN {
67 0 ▶ sub gensym () {
Subroutine gensym: not called CC=2 SCAR=17.9
Pod undocumented
68 0 ▶ if ($] < 5.006) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] < 5.006) { } 0 0 0
69 0 return \do { local *_ };
70 }
71 else {
72 0 return undef;
73 }
74 }
75  
76 20 ▶ sub qualify ($$) {
Subroutine qualify: called CC=8 SCAR=28.9
Pod undocumented
77 20 my($name) = @_;
78  
79 20 ▶ if (ref $name) {
Branch: 7 branches
BranchTrueFalseTotal
if (ref $name) { } 5 15 20
elsif (&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
80 5 return $name;
81 }
82 elsif (Ewindows1258::index($name,'::') >= 0) {
83 0 return $name;
84 }
85 elsif (Ewindows1258::index($name,"'") >= 0) {
86 0 return $name;
87 }
88  
89 # special character, "^xyz"
90 elsif ($name =~ /\A \^ [ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]+ \z/x) {
91  
92 # RGS 2001-11-05 : translate leading ^X to control-char
93 0 $name =~ s{\A \^ ([ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]) }{'qq(\c'.$1.')'}xee;
94 0 return 'main::' . $name;
95 }
96  
97 # Global names
98 elsif ($name =~ /\A (?: ARGV | ARGVOUT | ENV | INC | SIG | STDERR | STDIN | STDOUT ) \z/x) {
99 0 return 'main::' . $name;
100 }
101  
102 # or other
103 elsif ($name =~ /\A [^ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz] \z/x) {
104 0 return 'main::' . $name;
105 }
106  
107 elsif (defined $_[1]) {
108 15 return $_[1] . '::' . $name;
109 }
110 else {
111 0 return (caller)[0] . '::' . $name;
112 }
113 }
114  
115 20 ▶ sub qualify_to_ref ($;$) {
Subroutine qualify_to_ref: called CC=2 SCAR=7.2
Pod undocumented
116 20 ▶ if (defined $_[1]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[1]) { } 20 0 20
117 422 ▶ no strict qw(refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
118 20 return \*{ qualify $_[0], $_[1] };
119 }
120 else {
121 422 ▶ no strict qw(refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: not called CC=1 SCAR=0.0
122 0 return \*{ qualify $_[0], (caller)[0] };
123 }
124 }
125 }
126  
127 # P.714 29.2.39. flock
128 # in Chapter 29: Functions
129 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
130  
131 # P.863 flock
132 # in Chapter 27: Functions
133 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
134  
135 sub LOCK_SH() {1}
136 sub LOCK_EX() {2}
137 sub LOCK_UN() {8}
138 sub LOCK_NB() {4}
139  
140 # instead of Carp.pm
141 sub carp;
142 sub croak;
143 sub cluck;
144 sub confess;
145  
146 # 6.18. Matching Multiple-Byte Characters
147 # in Chapter 6. Pattern Matching
148 # of ISBN 978-1-56592-243-3 Perl Perl Cookbook.
149 # (and so on)
150  
151 # regexp of character
152 422 my $your_char = q{[\x00-\xFF]};
153 422 ▶use vars qw($qq_char); $qq_char = qr/\\c[\x40-\x5F]|\\?(?:$your_char)/oxms;
Subroutine BEGIN: called CC=1 SCAR=0.0
154 422 ▶use vars qw($q_char); $q_char = qr/$your_char/oxms;
Subroutine BEGIN: called CC=1 SCAR=0.0
155  
156 #
157 # Windows-1258 character range per length
158 #
159 422 my %range_tr = ();
160  
161 #
162 # Windows-1258 case conversion
163 #
164 422 my %lc = ();
165 422 @lc{qw(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)} =
166 qw(a b c d e f g h i j k l m n o p q r s t u v w x y z);
167 422 my %uc = ();
168 422 @uc{qw(a b c d e f g h i j k l m n o p q r s t u v w x y z)} =
169 qw(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z);
170 422 my %fc = ();
171 422 @fc{qw(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)} =
172 qw(a b c d e f g h i j k l m n o p q r s t u v w x y z);
173  
174 422 ▶if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { __PACKAGE__ =~ / \b Ewindows1258 \z/mosx }) { } 422 0 422
175 }
176  
177 elsif (__PACKAGE__ =~ / \b Ewindows1258 \z/oxms) {
178 422 %range_tr = (
179 1 => [ [0x00..0xFF],
180 ],
181 );
182  
183 422 %lc = (%lc,
184 "\x8C" => "\x9C", # LATIN LIGATURE OE
185 "\x9F" => "\xFF", # LATIN LETTER Y WITH DIAERESIS
186 "\xC0" => "\xE0", # LATIN LETTER A WITH GRAVE
187 "\xC1" => "\xE1", # LATIN LETTER A WITH ACUTE
188 "\xC2" => "\xE2", # LATIN LETTER A WITH CIRCUMFLEX
189 "\xC3" => "\xE3", # LATIN LETTER A WITH BREVE
190 "\xC4" => "\xE4", # LATIN LETTER A WITH DIAERESIS
191 "\xC5" => "\xE5", # LATIN LETTER A WITH RING ABOVE
192 "\xC6" => "\xE6", # LATIN LETTER AE
193 "\xC7" => "\xE7", # LATIN LETTER C WITH CEDILLA
194 "\xC8" => "\xE8", # LATIN LETTER E WITH GRAVE
195 "\xC9" => "\xE9", # LATIN LETTER E WITH ACUTE
196 "\xCA" => "\xEA", # LATIN LETTER E WITH CIRCUMFLEX
197 "\xCB" => "\xEB", # LATIN LETTER E WITH DIAERESIS
198 "\xCD" => "\xED", # LATIN LETTER I WITH ACUTE
199 "\xCE" => "\xEE", # LATIN LETTER I WITH CIRCUMFLEX
200 "\xCF" => "\xEF", # LATIN LETTER I WITH DIAERESIS
201 "\xD0" => "\xF0", # LATIN LETTER D WITH STROKE
202 "\xD1" => "\xF1", # LATIN LETTER N WITH TILDE
203 "\xD3" => "\xF3", # LATIN LETTER O WITH ACUTE
204 "\xD4" => "\xF4", # LATIN LETTER O WITH CIRCUMFLEX
205 "\xD5" => "\xF5", # LATIN LETTER O WITH HORN
206 "\xD6" => "\xF6", # LATIN LETTER O WITH DIAERESIS
207 "\xD8" => "\xF8", # LATIN LETTER O WITH STROKE
208 "\xD9" => "\xF9", # LATIN LETTER U WITH GRAVE
209 "\xDA" => "\xFA", # LATIN LETTER U WITH ACUTE
210 "\xDB" => "\xFB", # LATIN LETTER U WITH CIRCUMFLEX
211 "\xDC" => "\xFC", # LATIN LETTER U WITH DIAERESIS
212 "\xDD" => "\xFD", # LATIN LETTER U WITH HORN
213 );
214  
215 422 %uc = (%uc,
216 "\x9C" => "\x8C", # LATIN LIGATURE OE
217 "\xFF" => "\x9F", # LATIN LETTER Y WITH DIAERESIS
218 "\xE0" => "\xC0", # LATIN LETTER A WITH GRAVE
219 "\xE1" => "\xC1", # LATIN LETTER A WITH ACUTE
220 "\xE2" => "\xC2", # LATIN LETTER A WITH CIRCUMFLEX
221 "\xE3" => "\xC3", # LATIN LETTER A WITH BREVE
222 "\xE4" => "\xC4", # LATIN LETTER A WITH DIAERESIS
223 "\xE5" => "\xC5", # LATIN LETTER A WITH RING ABOVE
224 "\xE6" => "\xC6", # LATIN LETTER AE
225 "\xE7" => "\xC7", # LATIN LETTER C WITH CEDILLA
226 "\xE8" => "\xC8", # LATIN LETTER E WITH GRAVE
227 "\xE9" => "\xC9", # LATIN LETTER E WITH ACUTE
228 "\xEA" => "\xCA", # LATIN LETTER E WITH CIRCUMFLEX
229 "\xEB" => "\xCB", # LATIN LETTER E WITH DIAERESIS
230 "\xED" => "\xCD", # LATIN LETTER I WITH ACUTE
231 "\xEE" => "\xCE", # LATIN LETTER I WITH CIRCUMFLEX
232 "\xEF" => "\xCF", # LATIN LETTER I WITH DIAERESIS
233 "\xF0" => "\xD0", # LATIN LETTER D WITH STROKE
234 "\xF1" => "\xD1", # LATIN LETTER N WITH TILDE
235 "\xF3" => "\xD3", # LATIN LETTER O WITH ACUTE
236 "\xF4" => "\xD4", # LATIN LETTER O WITH CIRCUMFLEX
237 "\xF5" => "\xD5", # LATIN LETTER O WITH HORN
238 "\xF6" => "\xD6", # LATIN LETTER O WITH DIAERESIS
239 "\xF8" => "\xD8", # LATIN LETTER O WITH STROKE
240 "\xF9" => "\xD9", # LATIN LETTER U WITH GRAVE
241 "\xFA" => "\xDA", # LATIN LETTER U WITH ACUTE
242 "\xFB" => "\xDB", # LATIN LETTER U WITH CIRCUMFLEX
243 "\xFC" => "\xDC", # LATIN LETTER U WITH DIAERESIS
244 "\xFD" => "\xDD", # LATIN LETTER U WITH HORN
245 );
246  
247 422 %fc = (%fc,
248 "\x8C" => "\x9C", # LATIN CAPITAL LIGATURE OE --> LATIN SMALL LIGATURE OE
249 "\x9F" => "\xFF", # LATIN CAPITAL LETTER Y WITH DIAERESIS --> LATIN SMALL LETTER Y WITH DIAERESIS
250 "\xC0" => "\xE0", # LATIN CAPITAL LETTER A WITH GRAVE --> LATIN SMALL LETTER A WITH GRAVE
251 "\xC1" => "\xE1", # LATIN CAPITAL LETTER A WITH ACUTE --> LATIN SMALL LETTER A WITH ACUTE
252 "\xC2" => "\xE2", # LATIN CAPITAL LETTER A WITH CIRCUMFLEX --> LATIN SMALL LETTER A WITH CIRCUMFLEX
253 "\xC3" => "\xE3", # LATIN CAPITAL LETTER A WITH BREVE --> LATIN SMALL LETTER A WITH BREVE
254 "\xC4" => "\xE4", # LATIN CAPITAL LETTER A WITH DIAERESIS --> LATIN SMALL LETTER A WITH DIAERESIS
255 "\xC5" => "\xE5", # LATIN CAPITAL LETTER A WITH RING ABOVE --> LATIN SMALL LETTER A WITH RING ABOVE
256 "\xC6" => "\xE6", # LATIN CAPITAL LETTER AE --> LATIN SMALL LETTER AE
257 "\xC7" => "\xE7", # LATIN CAPITAL LETTER C WITH CEDILLA --> LATIN SMALL LETTER C WITH CEDILLA
258 "\xC8" => "\xE8", # LATIN CAPITAL LETTER E WITH GRAVE --> LATIN SMALL LETTER E WITH GRAVE
259 "\xC9" => "\xE9", # LATIN CAPITAL LETTER E WITH ACUTE --> LATIN SMALL LETTER E WITH ACUTE
260 "\xCA" => "\xEA", # LATIN CAPITAL LETTER E WITH CIRCUMFLEX --> LATIN SMALL LETTER E WITH CIRCUMFLEX
261 "\xCB" => "\xEB", # LATIN CAPITAL LETTER E WITH DIAERESIS --> LATIN SMALL LETTER E WITH DIAERESIS
262 "\xCD" => "\xED", # LATIN CAPITAL LETTER I WITH ACUTE --> LATIN SMALL LETTER I WITH ACUTE
263 "\xCE" => "\xEE", # LATIN CAPITAL LETTER I WITH CIRCUMFLEX --> LATIN SMALL LETTER I WITH CIRCUMFLEX
264 "\xCF" => "\xEF", # LATIN CAPITAL LETTER I WITH DIAERESIS --> LATIN SMALL LETTER I WITH DIAERESIS
265 "\xD0" => "\xF0", # LATIN CAPITAL LETTER D WITH STROKE --> LATIN SMALL LETTER D WITH STROKE
266 "\xD1" => "\xF1", # LATIN CAPITAL LETTER N WITH TILDE --> LATIN SMALL LETTER N WITH TILDE
267 "\xD3" => "\xF3", # LATIN CAPITAL LETTER O WITH ACUTE --> LATIN SMALL LETTER O WITH ACUTE
268 "\xD4" => "\xF4", # LATIN CAPITAL LETTER O WITH CIRCUMFLEX --> LATIN SMALL LETTER O WITH CIRCUMFLEX
269 "\xD5" => "\xF5", # LATIN CAPITAL LETTER O WITH HORN --> LATIN SMALL LETTER O WITH HORN
270 "\xD6" => "\xF6", # LATIN CAPITAL LETTER O WITH DIAERESIS --> LATIN SMALL LETTER O WITH DIAERESIS
271 "\xD8" => "\xF8", # LATIN CAPITAL LETTER O WITH STROKE --> LATIN SMALL LETTER O WITH STROKE
272 "\xD9" => "\xF9", # LATIN CAPITAL LETTER U WITH GRAVE --> LATIN SMALL LETTER U WITH GRAVE
273 "\xDA" => "\xFA", # LATIN CAPITAL LETTER U WITH ACUTE --> LATIN SMALL LETTER U WITH ACUTE
274 "\xDB" => "\xFB", # LATIN CAPITAL LETTER U WITH CIRCUMFLEX --> LATIN SMALL LETTER U WITH CIRCUMFLEX
275 "\xDC" => "\xFC", # LATIN CAPITAL LETTER U WITH DIAERESIS --> LATIN SMALL LETTER U WITH DIAERESIS
276 "\xDD" => "\xFD", # LATIN CAPITAL LETTER U WITH HORN --> LATIN SMALL LETTER U WITH HORN
277 "\xDF" => "\x73\x73", # LATIN SMALL LETTER SHARP S --> LATIN SMALL LETTER S, LATIN SMALL LETTER S
278 );
279 }
280  
281 else {
282 0 croak "Don't know my package name '@{[__PACKAGE__]}'";
283 }
284  
285 #
286 # @ARGV wildcard globbing
287 #
288 211 ▶sub import {
Subroutine import: called CC=7 SCAR=28.3
289  
290 211 ▶ if ($^O =~ /\A (?: MSWin32 | NetWare | symbian | dos ) \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O =~ /\A (?: MSWin32 | NetWare | symbian | dos ) \z/mosx) 0 211 211
291 0 my @argv = ();
292 0 for (@ARGV) {
293  
294 # has space
295 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
296 0 ▶ if (my @glob = Ewindows1258::glob(qq{"$_"})) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@glob) = &Ewindows1258::glob(qq["$_"])) { } 0 0 0
297 0 push @argv, @glob;
298 }
299 else {
300 0 push @argv, $_;
301 }
302 }
303  
304 # has wildcard metachar
305 elsif (/\A (?:$q_char)*? [*?] /oxms) {
306 0 ▶ if (my @glob = Ewindows1258::glob($_)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@glob) = &Ewindows1258::glob($_)) { } 0 0 0
307 0 push @argv, @glob;
308 }
309 else {
310 0 push @argv, $_;
311 }
312 }
313  
314 # no wildcard globbing
315 else {
316 0 push @argv, $_;
317 }
318 }
319 0 @ARGV = @argv;
320 }
321  
322 211 *Char::ord = \&Windows1258::ord;
323 211 *Char::ord_ = \&Windows1258::ord_;
324 211 *Char::reverse = \&Windows1258::reverse;
325 211 *Char::getc = \&Windows1258::getc;
326 211 *Char::length = \&Windows1258::length;
327 211 *Char::substr = \&Windows1258::substr;
328 211 *Char::index = \&Windows1258::index;
329 211 *Char::rindex = \&Windows1258::rindex;
330 211 *Char::eval = \&Windows1258::eval;
331 211 *Char::escape = \&Windows1258::escape;
332 211 *Char::escape_token = \&Windows1258::escape_token;
333 211 *Char::escape_script = \&Windows1258::escape_script;
334 }
335  
336 # P.230 Care with Prototypes
337 # in Chapter 6: Subroutines
338 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
339 #
340 # If you aren't careful, you can get yourself into trouble with prototypes.
341 # But if you are careful, you can do a lot of neat things with them. This is
342 # all very powerful, of course, and should only be used in moderation to make
343 # the world a better place.
344  
345 # P.332 Care with Prototypes
346 # in Chapter 7: Subroutines
347 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
348 #
349 # If you aren't careful, you can get yourself into trouble with prototypes.
350 # But if you are careful, you can do a lot of neat things with them. This is
351 # all very powerful, of course, and should only be used in moderation to make
352 # the world a better place.
353  
354 #
355 # Prototypes of subroutines
356 #
357 0 ▶sub unimport {}
Subroutine unimport: not called CC=1 SCAR=0.0
358 sub Ewindows1258::split(;$$$);
359 sub Ewindows1258::tr($$$$;$);
360 sub Ewindows1258::chop(@);
361 sub Ewindows1258::index($$;$);
362 sub Ewindows1258::rindex($$;$);
363 sub Ewindows1258::lcfirst(@);
364 sub Ewindows1258::lcfirst_();
365 sub Ewindows1258::lc(@);
366 sub Ewindows1258::lc_();
367 sub Ewindows1258::ucfirst(@);
368 sub Ewindows1258::ucfirst_();
369 sub Ewindows1258::uc(@);
370 sub Ewindows1258::uc_();
371 sub Ewindows1258::fc(@);
372 sub Ewindows1258::fc_();
373 sub Ewindows1258::ignorecase;
374 sub Ewindows1258::classic_character_class;
375 sub Ewindows1258::capture;
376 sub Ewindows1258::chr(;$);
377 sub Ewindows1258::chr_();
378 sub Ewindows1258::glob($);
379 sub Ewindows1258::glob_();
380  
381 sub Windows1258::ord(;$);
382 sub Windows1258::ord_();
383 sub Windows1258::reverse(@);
384 sub Windows1258::getc(;*@);
385 sub Windows1258::length(;$);
386 sub Windows1258::substr($$;$$);
387 sub Windows1258::index($$;$);
388 sub Windows1258::rindex($$;$);
389 sub Windows1258::escape(;$);
390  
391 #
392 # Regexp work
393 #
394 422 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
395 $re_a
396 $re_t
397 $re_n
398 $re_r
399 422 );
400  
401 #
402 # Character class
403 #
404 422 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
405 $dot
406 $dot_s
407 $eD
408 $eS
409 $eW
410 $eH
411 $eV
412 $eR
413 $eN
414 $not_alnum
415 $not_alpha
416 $not_ascii
417 $not_blank
418 $not_cntrl
419 $not_digit
420 $not_graph
421 $not_lower
422 $not_lower_i
423 $not_print
424 $not_punct
425 $not_space
426 $not_upper
427 $not_upper_i
428 $not_word
429 $not_xdigit
430 $eb
431 $eB
432 422 );
433  
434 422 ${Ewindows1258::dot} = qr{(?>[^\x0A])};
435 422 ${Ewindows1258::dot_s} = qr{(?>[\x00-\xFF])};
436 422 ${Ewindows1258::eD} = qr{(?>[^0-9])};
437  
438 # Vertical tabs are now whitespace
439 # \s in a regex now matches a vertical tab in all circumstances.
440 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
441 # ${Ewindows1258::eS} = qr{(?>[^\x09\x0A \x0C\x0D\x20])};
442 # ${Ewindows1258::eS} = qr{(?>[^\x09\x0A\x0B\x0C\x0D\x20])};
443 422 ${Ewindows1258::eS} = qr{(?>[^\s])};
444  
445 422 ${Ewindows1258::eW} = qr{(?>[^0-9A-Z_a-z])};
446 422 ${Ewindows1258::eH} = qr{(?>[^\x09\x20])};
447 422 ${Ewindows1258::eV} = qr{(?>[^\x0A\x0B\x0C\x0D])};
448 422 ${Ewindows1258::eR} = qr{(?>\x0D\x0A|[\x0A\x0D])};
449 422 ${Ewindows1258::eN} = qr{(?>[^\x0A])};
450 422 ${Ewindows1258::not_alnum} = qr{(?>[^\x30-\x39\x41-\x5A\x61-\x7A])};
451 422 ${Ewindows1258::not_alpha} = qr{(?>[^\x41-\x5A\x61-\x7A])};
452 422 ${Ewindows1258::not_ascii} = qr{(?>[^\x00-\x7F])};
453 422 ${Ewindows1258::not_blank} = qr{(?>[^\x09\x20])};
454 422 ${Ewindows1258::not_cntrl} = qr{(?>[^\x00-\x1F\x7F])};
455 422 ${Ewindows1258::not_digit} = qr{(?>[^\x30-\x39])};
456 422 ${Ewindows1258::not_graph} = qr{(?>[^\x21-\x7F])};
457 422 ${Ewindows1258::not_lower} = qr{(?>[^\x61-\x7A])};
458 422 ${Ewindows1258::not_lower_i} = qr{(?>[^\x41-\x5A\x61-\x7A])}; # Perl 5.16 compatible
459 # ${Ewindows1258::not_lower_i} = qr{(?>[\x00-\xFF])}; # older Perl compatible
460 422 ${Ewindows1258::not_print} = qr{(?>[^\x20-\x7F])};
461 422 ${Ewindows1258::not_punct} = qr{(?>[^\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E])};
462 422 ${Ewindows1258::not_space} = qr{(?>[^\s\x0B])};
463 422 ${Ewindows1258::not_upper} = qr{(?>[^\x41-\x5A])};
464 422 ${Ewindows1258::not_upper_i} = qr{(?>[^\x41-\x5A\x61-\x7A])}; # Perl 5.16 compatible
465 # ${Ewindows1258::not_upper_i} = qr{(?>[\x00-\xFF])}; # older Perl compatible
466 422 ${Ewindows1258::not_word} = qr{(?>[^\x30-\x39\x41-\x5A\x5F\x61-\x7A])};
467 422 ${Ewindows1258::not_xdigit} = qr{(?>[^\x30-\x39\x41-\x46\x61-\x66])};
468 422 ${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))};
469 422 ${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]))};
470  
471 # avoid: Name "Ewindows1258::foo" used only once: possible typo at here.
472 422 ${Ewindows1258::dot} = ${Ewindows1258::dot};
473 422 ${Ewindows1258::dot_s} = ${Ewindows1258::dot_s};
474 422 ${Ewindows1258::eD} = ${Ewindows1258::eD};
475 422 ${Ewindows1258::eS} = ${Ewindows1258::eS};
476 422 ${Ewindows1258::eW} = ${Ewindows1258::eW};
477 422 ${Ewindows1258::eH} = ${Ewindows1258::eH};
478 422 ${Ewindows1258::eV} = ${Ewindows1258::eV};
479 422 ${Ewindows1258::eR} = ${Ewindows1258::eR};
480 422 ${Ewindows1258::eN} = ${Ewindows1258::eN};
481 422 ${Ewindows1258::not_alnum} = ${Ewindows1258::not_alnum};
482 422 ${Ewindows1258::not_alpha} = ${Ewindows1258::not_alpha};
483 422 ${Ewindows1258::not_ascii} = ${Ewindows1258::not_ascii};
484 422 ${Ewindows1258::not_blank} = ${Ewindows1258::not_blank};
485 422 ${Ewindows1258::not_cntrl} = ${Ewindows1258::not_cntrl};
486 422 ${Ewindows1258::not_digit} = ${Ewindows1258::not_digit};
487 422 ${Ewindows1258::not_graph} = ${Ewindows1258::not_graph};
488 422 ${Ewindows1258::not_lower} = ${Ewindows1258::not_lower};
489 422 ${Ewindows1258::not_lower_i} = ${Ewindows1258::not_lower_i};
490 422 ${Ewindows1258::not_print} = ${Ewindows1258::not_print};
491 422 ${Ewindows1258::not_punct} = ${Ewindows1258::not_punct};
492 422 ${Ewindows1258::not_space} = ${Ewindows1258::not_space};
493 422 ${Ewindows1258::not_upper} = ${Ewindows1258::not_upper};
494 422 ${Ewindows1258::not_upper_i} = ${Ewindows1258::not_upper_i};
495 422 ${Ewindows1258::not_word} = ${Ewindows1258::not_word};
496 422 ${Ewindows1258::not_xdigit} = ${Ewindows1258::not_xdigit};
497 422 ${Ewindows1258::eb} = ${Ewindows1258::eb};
498 422 ${Ewindows1258::eB} = ${Ewindows1258::eB};
499  
500 #
501 # Windows-1258 split
502 #
503 72 ▶sub Ewindows1258::split(;$$$) {
Subroutine split: called CC=34 SCAR=46.9
Pod undocumented
504  
505 # P.794 29.2.161. split
506 # in Chapter 29: Functions
507 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
508  
509 # P.951 split
510 # in Chapter 27: Functions
511 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
512  
513 72 my $pattern = $_[0];
514 72 my $string = $_[1];
515 72 my $limit = $_[2];
516  
517 # if $pattern is also omitted or is the literal space, " "
518 72 ▶ if (not defined $pattern) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $pattern) 2 70 72
519 2 $pattern = ' ';
520 }
521  
522 # if $string is omitted, the function splits the $_ string
523 72 ▶ if (not defined $string) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $string) 6 66 72
524 6 ▶ if (defined $_) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_) { } 0 6 6
525 0 $string = $_;
526 }
527 else {
528 6 $string = '';
529 }
530 }
531  
532 72 my @split = ();
533  
534 # when string is empty
535 72 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 10 62 72
elsif ($pattern eq ' ') { } 2 60 62
536  
537 # resulting list value in list context
538 10 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 5 5 10
539 5 return @split;
540 }
541  
542 # count of substrings in scalar context
543 else {
544 5 ▶ carp "Use of implicit split to \@_ is deprecated" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 5 5
545 5 @_ = @split;
546 5 return scalar @_;
547 }
548 }
549  
550 # split's first argument is more consistently interpreted
551 #
552 # After some changes earlier in v5.17, split's behavior has been simplified:
553 # if the PATTERN argument evaluates to a string containing one space, it is
554 # treated the way that a literal string containing one space once was.
555 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#split's_first_argument_is_more_consistently_interpreted
556  
557 # if $pattern is also omitted or is the literal space, " ", the function splits
558 # on whitespace, /\s+/, after skipping any leading whitespace
559 # (and so on)
560  
561 elsif ($pattern eq ' ') {
562 2 ▶ if (not defined $limit) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $limit) { } 2 0 2
563 2 return CORE::split(' ', $string);
564 }
565 else {
566 0 return CORE::split(' ', $string, $limit);
567 }
568 }
569  
570 # if $limit is negative, it is treated as if an arbitrarily large $limit has been specified
571 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
572  
573 # a pattern capable of matching either the null string or something longer than the
574 # null string will split the value of $string into separate characters wherever it
575 # matches the null string between characters
576 # (and so on)
577  
578 60 ▶ if ('' =~ / \A $pattern \z /xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ('' =~ / \A $pattern \z /msx) { } 2 58 60
579 2 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
580 2 my $limit = scalar(() = $string =~ /($pattern)/oxmsg);
581  
582 # P.1024 Appendix W.10 Multibyte Processing
583 # of ISBN 1-56592-224-7 CJKV Information Processing
584 # (and so on)
585  
586 # the //m modifier is assumed when you split on the pattern /^/
587 # (and so on)
588  
589 # V
590 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
591  
592 # if the $pattern contains parentheses, then the substring matched by each pair of parentheses
593 # is included in the resulting list, interspersed with the fields that are ordinarily returned
594 # (and so on)
595  
596 9 local $@;
597 9 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 9 9 18
598 9 push @split, CORE::eval('$' . $digit);
599 }
600 }
601 }
602  
603 else {
604 58 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
605  
606 # V
607 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
608 163 local $@;
609 163 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 230 163 393
610 230 push @split, CORE::eval('$' . $digit);
611 }
612 }
613 }
614 }
615  
616 elsif ($limit > 0) {
617 0 ▶ if ('' =~ / \A $pattern \z /xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ('' =~ / \A $pattern \z /msx) { } 0 0 0
618 0 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
619 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
620  
621 # V
622 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
623 0 local $@;
624 0 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 0 0 0
625 0 push @split, CORE::eval('$' . $digit);
626 }
627 }
628 }
629 }
630 else {
631 0 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
632 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
633  
634 # V
635 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
636 0 local $@;
637 0 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 0 0 0
638 0 push @split, CORE::eval('$' . $digit);
639 }
640 }
641 }
642 }
643 }
644  
645 60 ▶ if (CORE::length($string) > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $string > 0) 58 2 60
646 58 push @split, $string;
647 }
648  
649 # if $_[2] (NOT "$limit") is omitted or zero, trailing null fields are stripped from the result
650 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
651 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
652 0 pop @split;
653 }
654 }
655  
656 # resulting list value in list context
657 60 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 58 2 60
658 58 return @split;
659 }
660  
661 # count of substrings in scalar context
662 else {
663 2 ▶ carp "Use of implicit split to \@_ is deprecated" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 2 2
664 2 @_ = @split;
665 2 return scalar @_;
666 }
667 }
668  
669 #
670 # get last subexpression offsets
671 #
672 60 ▶sub _last_subexpression_offsets {
Subroutine _last_subexpression_offsets: called CC=3 SCAR=11.0
673 60 my $pattern = $_[0];
674  
675 # remove comment
676 60 $pattern =~ s/\(\?\# .*? \)//oxmsg;
677  
678 60 my $modifier = '';
679 60 ▶ if ($pattern =~ /\(\?\^? ([\-A-Za-z]+) :/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pattern =~ /\(\?\^? ([\-A-Za-z]+) :/mosx) 11 49 60
680 11 $modifier = $1;
681 11 $modifier =~ s/-[A-Za-z]*//;
682 }
683  
684 # with /x modifier
685 60 my @char = ();
686 60 ▶ if ($modifier =~ /x/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /x/mosx) { } 5 55 60
687 5 @char = $pattern =~ /\G((?>
688 [^\\\#\[\(] |
689 \\ $q_char |
690 \# (?>[^\n]*) $ |
691 \[ (?>(?:[^\\\]]|\\\\|\\\]|$q_char)+) \] |
692 \(\? |
693 $q_char
694 ))/oxmsg;
695 }
696  
697 # without /x modifier
698 else {
699 55 @char = $pattern =~ /\G((?>
700 [^\\\[\(] |
701 \\ $q_char |
702 \[ (?>(?:[^\\\]]|\\\\|\\\]|$q_char)+) \] |
703 \(\? |
704 $q_char
705 ))/oxmsg;
706 }
707  
708 60 return scalar grep { $_ eq '(' } @char;
709 }
710  
711 #
712 # Windows-1258 transliteration (tr///)
713 #
714 6 ▶sub Ewindows1258::tr($$$$;$) {
Subroutine tr: called CC=26 SCAR=48.6
Pod undocumented
715  
716 6 my $bind_operator = $_[1];
717 6 my $searchlist = $_[2];
718 6 my $replacementlist = $_[3];
719 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
720  
721 6 ▶ if ($modifier =~ /r/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /r/mosx) 5 1 6
722 5 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) 0 5 5
723 0 croak "Using !~ with tr///r doesn't make sense";
724 }
725 }
726  
727 6 my @char = $_[0] =~ /\G (?>$q_char) /oxmsg;
728 6 my @searchlist = _charlist_tr($searchlist);
729 6 my @replacementlist = _charlist_tr($replacementlist);
730  
731 6 my %tr = ();
732 6 ▶ for (my $i=0; $i <= $#searchlist; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#searchlist) 19 6 25
733 19 ▶ if (not exists $tr{$searchlist[$i]}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $tr{$searchlist[$i]}) 19 0 19
734 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
735 19 $tr{$searchlist[$i]} = $replacementlist[$i];
736 }
737 elsif ($modifier =~ /d/oxms) {
738 0 $tr{$searchlist[$i]} = '';
739 }
740 ▶ 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
741 0 $tr{$searchlist[$i]} = $replacementlist[-1];
742 }
743 else {
744 0 $tr{$searchlist[$i]} = $searchlist[$i];
745 }
746 }
747 }
748  
749 6 my $tr = 0;
750 6 my $replaced = '';
751 6 ▶ if ($modifier =~ /c/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /c/mosx) { } 0 6 6
752 0 ▶ while (defined(my $char = shift @char)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $char = shift @char)) 0 0 0
753 0 ▶ if (not exists $tr{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $tr{$char}) { } 0 0 0
754 0 ▶ if (defined $replacementlist[0]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $replacementlist[0]) 0 0 0
755 0 $replaced .= $replacementlist[0];
756 }
757 0 $tr++;
758 0 ▶ if ($modifier =~ /s/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/mosx) 0 0 0
759 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
760 0 shift @char;
761 0 $tr++;
762 }
763 }
764 }
765 else {
766 0 $replaced .= $char;
767 }
768 }
769 }
770 else {
771 6 ▶ while (defined(my $char = shift @char)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $char = shift @char)) 36 6 42
772 36 ▶ if (exists $tr{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $tr{$char}) { } 19 17 36
773 19 $replaced .= $tr{$char};
774 19 $tr++;
775 19 ▶ if ($modifier =~ /s/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/mosx) 0 19 19
776 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
777 0 shift @char;
778 0 $tr++;
779 }
780 }
781 }
782 else {
783 17 $replaced .= $char;
784 }
785 }
786 }
787  
788 6 ▶ if ($modifier =~ /r/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /r/mosx) { } 5 1 6
789 5 return $replaced;
790 }
791 else {
792 1 $_[0] = $replaced;
793 1 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) { } 0 1 1
794 0 return not $tr;
795 }
796 else {
797 1 return $tr;
798 }
799 }
800 }
801  
802 #
803 # Windows-1258 chop
804 #
805 0 ▶sub Ewindows1258::chop(@) {
Subroutine chop: not called CC=3 SCAR=24.8
Pod undocumented
806  
807 0 my $chop;
808 0 ▶ if (@_ == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 0) { } 0 0 0
809 0 my @char = /\G (?>$q_char) /oxmsg;
810 0 $chop = pop @char;
811 0 $_ = join '', @char;
812 }
813 else {
814 0 for (@_) {
815 0 my @char = /\G (?>$q_char) /oxmsg;
816 0 $chop = pop @char;
817 0 $_ = join '', @char;
818 }
819 }
820 0 return $chop;
821 }
822  
823 #
824 # Windows-1258 index by octet
825 #
826 30 ▶sub Ewindows1258::index($$;$) {
Subroutine index: called CC=6 SCAR=20.8
Pod documented
827  
828 30 my($str,$substr,$position) = @_;
829 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
830 30 my $pos = 0;
831  
832 30 ▶ while ($pos < CORE::length($str)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos < length $str) 130 30 160
833 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
834 0 ▶ if ($pos >= $position) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos >= $position) 0 0 0
835 0 return $pos;
836 }
837 }
838 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
839 130 $pos += CORE::length($1);
840 }
841 else {
842 0 $pos += 1;
843 }
844 }
845 30 return -1;
846 }
847  
848 #
849 # Windows-1258 reverse index
850 #
851 0 ▶sub Ewindows1258::rindex($$;$) {
Subroutine rindex: not called CC=6 SCAR=37.4
Pod undocumented
852  
853 0 my($str,$substr,$position) = @_;
854 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
855 0 my $pos = 0;
856 0 my $rindex = -1;
857  
858 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
859 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
860 0 $rindex = $pos;
861 }
862 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
863 0 $pos += CORE::length($1);
864 }
865 else {
866 0 $pos += 1;
867 }
868 }
869 0 return $rindex;
870 }
871  
872 #
873 # Windows-1258 lower case first with parameter
874 #
875 0 ▶sub Ewindows1258::lcfirst(@) {
Subroutine lcfirst: not called CC=4 SCAR=30.0
Pod undocumented
876 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
877 0 my $s = shift @_;
878 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
879 0 return Ewindows1258::lc(CORE::substr($s,0,1)) . CORE::substr($s,1), @_;
880 }
881 else {
882 0 return Ewindows1258::lc(CORE::substr($s,0,1)) . CORE::substr($s,1);
883 }
884 }
885 else {
886 0 return Ewindows1258::lc(CORE::substr($_,0,1)) . CORE::substr($_,1);
887 }
888 }
889  
890 #
891 # Windows-1258 lower case first without parameter
892 #
893 0 ▶sub Ewindows1258::lcfirst_() {
Subroutine lcfirst_: not called CC=1 SCAR=6.9
Pod undocumented
894 0 return Ewindows1258::lc(CORE::substr($_,0,1)) . CORE::substr($_,1);
895 }
896  
897 #
898 # Windows-1258 lower case with parameter
899 #
900 56 ▶sub Ewindows1258::lc(@) {
Subroutine lc: called CC=6 SCAR=24.2
Pod undocumented
901 56 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 56 0 56
902 56 my $s = shift @_;
903 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
904 0 ▶ return join('', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 0 0 0
905 }
906 else {
907 56 ▶ return join('', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 58 0 58
908 }
909 }
910 else {
911 0 return Ewindows1258::lc_();
912 }
913 }
914  
915 #
916 # Windows-1258 lower case without parameter
917 #
918 0 ▶sub Ewindows1258::lc_() {
Subroutine lc_: not called CC=2 SCAR=17.9
Pod undocumented
919 0 my $s = $_;
920 0 ▶ return join '', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 0 0 0
921 }
922  
923 #
924 # Windows-1258 upper case first with parameter
925 #
926 0 ▶sub Ewindows1258::ucfirst(@) {
Subroutine ucfirst: not called CC=4 SCAR=30.0
Pod undocumented
927 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
928 0 my $s = shift @_;
929 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
930 0 return Ewindows1258::uc(CORE::substr($s,0,1)) . CORE::substr($s,1), @_;
931 }
932 else {
933 0 return Ewindows1258::uc(CORE::substr($s,0,1)) . CORE::substr($s,1);
934 }
935 }
936 else {
937 0 return Ewindows1258::uc(CORE::substr($_,0,1)) . CORE::substr($_,1);
938 }
939 }
940  
941 #
942 # Windows-1258 upper case first without parameter
943 #
944 0 ▶sub Ewindows1258::ucfirst_() {
Subroutine ucfirst_: not called CC=1 SCAR=6.9
Pod undocumented
945 0 return Ewindows1258::uc(CORE::substr($_,0,1)) . CORE::substr($_,1);
946 }
947  
948 #
949 # Windows-1258 upper case with parameter
950 #
951 2368 ▶sub Ewindows1258::uc(@) {
Subroutine uc: called CC=6 SCAR=22.9
Pod undocumented
952 2368 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2368 0 2368
953 2368 my $s = shift @_;
954 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
955 0 ▶ return join('', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 0 0 0
956 }
957 else {
958 2368 ▶ return join('', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 847 1523 2370
959 }
960 }
961 else {
962 0 return Ewindows1258::uc_();
963 }
964 }
965  
966 #
967 # Windows-1258 upper case without parameter
968 #
969 0 ▶sub Ewindows1258::uc_() {
Subroutine uc_: not called CC=2 SCAR=17.9
Pod undocumented
970 0 my $s = $_;
971 0 ▶ return join '', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 0 0 0
972 }
973  
974 #
975 # Windows-1258 fold case with parameter
976 #
977 2383 ▶sub Ewindows1258::fc(@) {
Subroutine fc: called CC=6 SCAR=22.9
Pod undocumented
978 2383 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2383 0 2383
979 2383 my $s = shift @_;
980 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
981 0 ▶ return join('', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 0 0 0
982 }
983 else {
984 2383 ▶ return join('', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 1737 5363 7100
985 }
986 }
987 else {
988 0 return Ewindows1258::fc_();
989 }
990 }
991  
992 #
993 # Windows-1258 fold case without parameter
994 #
995 0 ▶sub Ewindows1258::fc_() {
Subroutine fc_: not called CC=2 SCAR=17.9
Pod undocumented
996 0 my $s = $_;
997 0 ▶ return join '', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 0 0 0
998 }
999  
1000 #
1001 # Windows-1258 regexp capture
1002 #
1003 {
1004 0 ▶ sub Ewindows1258::capture {
Subroutine capture: not called CC=1 SCAR=6.9
Pod documented
1005 0 return $_[0];
1006 }
1007 }
1008  
1009 #
1010 # Windows-1258 regexp ignore case modifier
1011 #
1012 422 ▶sub Ewindows1258::ignorecase {
Subroutine ignorecase: called CC=25 SCAR=52.1
Pod undocumented
1013  
1014 11 my @string = @_;
1015 11 my $metachar = qr/[\@\\|[\]{]/oxms;
1016  
1017 # ignore case of $scalar or @array
1018 11 for my $string (@string) {
1019  
1020 # split regexp
1021 11 my @char = $string =~ /\G (?>\[\^|\\$q_char|$q_char) /oxmsg;
1022  
1023 # unescape character
1024 11 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 908 11 919
1025 908 ▶ next if not defined $char[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $char[$i] 0 908 908
1026  
1027 # open character class [...]
1028 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
1029 0 my $left = $i;
1030  
1031 # [] make die "unmatched [] in regexp ...\n"
1032  
1033 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
1034 0 $i++;
1035 }
1036  
1037 0 while (1) {
1038 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
1039 0 croak "Unmatched [] in regexp";
1040 }
1041 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
1042 0 my $right = $i;
1043 0 my @charlist = charlist_qr(@char[$left+1..$right-1], 'i');
1044  
1045 # escape character
1046 0 for my $char (@charlist) {
1047 0 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $char =~ /\A [.|)] \z/mosx }) 0 0 0
1048 }
1049  
1050 0 elsif ($char =~ /\A [.|)] \z/oxms) {
1051 0 $char = '\\' . $char;
1052 }
1053 }
1054  
1055 # [...]
1056 0 splice @char, $left, $right-$left+1, '(?:' . join('|', @charlist) . ')';
1057  
1058 0 $i = $left;
1059 0 last;
1060 }
1061 }
1062 }
1063  
1064 # open character class [^...]
1065 elsif ($char[$i] eq '[^') {
1066 0 my $left = $i;
1067  
1068 # [^] make die "unmatched [] in regexp ...\n"
1069  
1070 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
1071 0 $i++;
1072 }
1073  
1074 0 while (1) {
1075 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
1076 0 croak "Unmatched [] in regexp";
1077 }
1078 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
1079 0 my $right = $i;
1080 0 my @charlist = charlist_not_qr(@char[$left+1..$right-1], 'i');
1081  
1082 # escape character
1083 0 for my $char (@charlist) {
1084 0 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $char =~ /\A [.|)] \z/mosx }) 0 0 0
1085 }
1086  
1087 0 elsif ($char =~ /\A [.|)] \z/oxms) {
1088 0 $char = '\\' . $char;
1089 }
1090 }
1091  
1092 # [^...]
1093 0 splice @char, $left, $right-$left+1, '(?!' . join('|', @charlist) . ")(?:$your_char)";
1094  
1095 0 $i = $left;
1096 0 last;
1097 }
1098 }
1099 }
1100  
1101 # rewrite classic character class or escape character
1102 elsif (my $char = classic_character_class($char[$i])) {
1103 0 $char[$i] = $char;
1104 }
1105  
1106 # with /i modifier
1107 elsif ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) {
1108 908 my $uc = Ewindows1258::uc($char[$i]);
1109 908 my $fc = Ewindows1258::fc($char[$i]);
1110 908 ▶ if ($uc ne $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc ne $fc) 468 440 908
1111 468 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 465 3 468
1112 465 $char[$i] = '[' . $uc . $fc . ']';
1113 }
1114 else {
1115 3 $char[$i] = '(?:' . $uc . '|' . $fc . ')';
1116 }
1117 }
1118 }
1119 }
1120  
1121 # characterize
1122 11 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 908 11 919
1123 908 ▶ next if not defined $char[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $char[$i] 0 908 908
1124  
1125 908 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx }) 0 919 919
1126 }
1127  
1128 # quote character before ? + * {
1129 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
1130 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
1131 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
1132 }
1133 }
1134 }
1135  
1136 11 $string = join '', @char;
1137 }
1138  
1139 # make regexp string
1140 11 return @string;
1141 }
1142  
1143 #
1144 # classic character class ( \D \S \W \d \s \w \C \X \H \V \h \v \R \N \b \B )
1145 #
1146 2776 ▶sub Ewindows1258::classic_character_class {
Subroutine classic_character_class: called CC=2 SCAR=6.9
Pod undocumented
1147 2776 my($char) = @_;
1148  
1149 return {
1150 '\D' => '${Ewindows1258::eD}',
1151 '\S' => '${Ewindows1258::eS}',
1152 '\W' => '${Ewindows1258::eW}',
1153 '\d' => '[0-9]',
1154  
1155 # Before Perl 5.6, \s only matched the five whitespace characters
1156 # tab, newline, form-feed, carriage return, and the space character
1157 # itself, which, taken together, is the character class [\t\n\f\r ].
1158  
1159 # Vertical tabs are now whitespace
1160 # \s in a regex now matches a vertical tab in all circumstances.
1161 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
1162 # \t \n \v \f \r space
1163 # '\s' => '[\x09\x0A \x0C\x0D\x20]',
1164 # '\s' => '[\x09\x0A\x0B\x0C\x0D\x20]',
1165 '\s' => '\s',
1166  
1167 '\w' => '[0-9A-Z_a-z]',
1168 '\C' => '[\x00-\xFF]',
1169 '\X' => 'X',
1170  
1171 # \h \v \H \V
1172  
1173 # P.114 Character Class Shortcuts
1174 # in Chapter 7: In the World of Regular Expressions
1175 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
1176  
1177 # P.357 13.2.3 Whitespace
1178 # in Chapter 13: perlrecharclass: Perl Regular Expression Character Classes
1179 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
1180 #
1181 # 0x00009 CHARACTER TABULATION h s
1182 # 0x0000a LINE FEED (LF) vs
1183 # 0x0000b LINE TABULATION v
1184 # 0x0000c FORM FEED (FF) vs
1185 # 0x0000d CARRIAGE RETURN (CR) vs
1186 # 0x00020 SPACE h s
1187  
1188 # P.196 Table 5-9. Alphanumeric regex metasymbols
1189 # in Chapter 5. Pattern Matching
1190 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1191  
1192 # (and so on)
1193  
1194 '\H' => '${Ewindows1258::eH}',
1195 '\V' => '${Ewindows1258::eV}',
1196 '\h' => '[\x09\x20]',
1197 '\v' => '[\x0A\x0B\x0C\x0D]',
1198 '\R' => '${Ewindows1258::eR}',
1199  
1200 # \N
1201 #
1202 # http://perldoc.perl.org/perlre.html
1203 # Character Classes and other Special Escapes
1204 # Any character but \n (experimental). Not affected by /s modifier
1205  
1206 '\N' => '${Ewindows1258::eN}',
1207  
1208 # \b \B
1209  
1210 # P.180 Boundaries: The \b and \B Assertions
1211 # in Chapter 5: Pattern Matching
1212 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
1213  
1214 # P.219 Boundaries: The \b and \B Assertions
1215 # in Chapter 5: Pattern Matching
1216 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1217  
1218 # \b really means (?:(?<=\w)(?!\w)|(?<!\w)(?=\w))
1219 # or (?:(?<=\A|\W)(?=\w)|(?<=\w)(?=\W|\z))
1220 '\b' => '${Ewindows1258::eb}',
1221  
1222 # \B really means (?:(?<=\w)(?=\w)|(?<!\w)(?!\w))
1223 # or (?:(?<=\w)(?=\w)|(?<=\W)(?=\W))
1224 '\B' => '${Ewindows1258::eB}',
1225  
1226 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
1227 }
1228  
1229 #
1230 # prepare Windows-1258 characters per length
1231 #
1232  
1233 # 1 octet characters
1234 422 my @chars1 = ();
1235 0 ▶sub chars1 {
Subroutine chars1: not called CC=5 SCAR=34.0
Pod undocumented
1236 0 ▶ if (@chars1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars1) 0 0 0
1237 0 return @chars1;
1238 }
1239 0 ▶ if (exists $range_tr{1}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{1}) 0 0 0
1240 0 my @ranges = @{ $range_tr{1} };
1241 0 ▶ while (my @range = splice(@ranges,0,1)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 1)) 0 0 0
1242 0 for my $oct0 (@{$range[0]}) {
1243 0 push @chars1, pack 'C', $oct0;
1244 }
1245 }
1246 }
1247 0 return @chars1;
1248 }
1249  
1250 # 2 octets characters
1251 422 my @chars2 = ();
1252 0 ▶sub chars2 {
Subroutine chars2: not called CC=6 SCAR=37.4
Pod undocumented
1253 0 ▶ if (@chars2) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars2) 0 0 0
1254 0 return @chars2;
1255 }
1256 0 ▶ if (exists $range_tr{2}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{2}) 0 0 0
1257 0 my @ranges = @{ $range_tr{2} };
1258 0 ▶ while (my @range = splice(@ranges,0,2)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 2)) 0 0 0
1259 0 for my $oct0 (@{$range[0]}) {
1260 0 for my $oct1 (@{$range[1]}) {
1261 0 push @chars2, pack 'CC', $oct0,$oct1;
1262 }
1263 }
1264 }
1265 }
1266 0 return @chars2;
1267 }
1268  
1269 # 3 octets characters
1270 422 my @chars3 = ();
1271 0 ▶sub chars3 {
Subroutine chars3: not called CC=7 SCAR=40.3
Pod undocumented
1272 0 ▶ if (@chars3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars3) 0 0 0
1273 0 return @chars3;
1274 }
1275 0 ▶ if (exists $range_tr{3}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{3}) 0 0 0
1276 0 my @ranges = @{ $range_tr{3} };
1277 0 ▶ while (my @range = splice(@ranges,0,3)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 3)) 0 0 0
1278 0 for my $oct0 (@{$range[0]}) {
1279 0 for my $oct1 (@{$range[1]}) {
1280 0 for my $oct2 (@{$range[2]}) {
1281 0 push @chars3, pack 'CCC', $oct0,$oct1,$oct2;
1282 }
1283 }
1284 }
1285 }
1286 }
1287 0 return @chars3;
1288 }
1289  
1290 # 4 octets characters
1291 422 my @chars4 = ();
1292 0 ▶sub chars4 {
Subroutine chars4: not called CC=8 SCAR=42.8
Pod undocumented
1293 0 ▶ if (@chars4) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars4) 0 0 0
1294 0 return @chars4;
1295 }
1296 0 ▶ if (exists $range_tr{4}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{4}) 0 0 0
1297 0 my @ranges = @{ $range_tr{4} };
1298 0 ▶ while (my @range = splice(@ranges,0,4)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 4)) 0 0 0
1299 0 for my $oct0 (@{$range[0]}) {
1300 0 for my $oct1 (@{$range[1]}) {
1301 0 for my $oct2 (@{$range[2]}) {
1302 0 for my $oct3 (@{$range[3]}) {
1303 0 push @chars4, pack 'CCCC', $oct0,$oct1,$oct2,$oct3;
1304 }
1305 }
1306 }
1307 }
1308 }
1309 }
1310 0 return @chars4;
1311 }
1312  
1313 #
1314 # Windows-1258 open character list for tr
1315 #
1316 12 ▶sub _charlist_tr {
Subroutine _charlist_tr: called CC=35 SCAR=66.4
1317  
1318 12 local $_ = shift @_;
1319  
1320 # unescape character
1321 12 my @char = ();
1322 12 ▶ while (not /\G \z/oxmsgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgmosx) 38 12 50
1323 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
1324 0 push @char, '\-';
1325 }
1326 elsif (/\G \\ ([0-7]{2,3}) /oxmsgc) {
1327 0 push @char, CORE::chr(oct $1);
1328 }
1329 elsif (/\G \\x ([0-9A-Fa-f]{1,2}) /oxmsgc) {
1330 0 push @char, CORE::chr(hex $1);
1331 }
1332 elsif (/\G \\c ([\x40-\x5F]) /oxmsgc) {
1333 0 push @char, CORE::chr(CORE::ord($1) & 0x1F);
1334 }
1335 elsif (/\G (\\ [0nrtfbae]) /oxmsgc) {
1336 push @char, {
1337 '\0' => "\0",
1338 '\n' => "\n",
1339 '\r' => "\r",
1340 '\t' => "\t",
1341 '\f' => "\f",
1342 '\b' => "\x08", # \b means backspace in character class
1343 '\a' => "\a",
1344 '\e' => "\e",
1345 0 }->{$1};
1346 }
1347 elsif (/\G \\ ($q_char) /oxmsgc) {
1348 0 push @char, $1;
1349 }
1350 elsif (/\G ($q_char) /oxmsgc) {
1351 38 push @char, $1;
1352 }
1353 }
1354  
1355 # join separated multiple-octet
1356 12 @char = join('',@char) =~ /\G (?>\\-|$q_char) /oxmsg;
1357  
1358 # unescape '-'
1359 12 my @i = ();
1360 12 for my $i (0 .. $#char) {
1361 38 ▶ if ($char[$i] eq '\-') {
Branch: 2 branches
BranchTrueFalseTotal
if ($char[$i] eq '\\-') { } 0 38 38
elsif ($char[$i] eq '-') { } 0 38 38
1362 0 $char[$i] = '-';
1363 }
1364 elsif ($char[$i] eq '-') {
1365 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
1366 0 push @i, $i;
1367 }
1368 }
1369 }
1370  
1371 # open character list (reverse for splice)
1372 12 for my $i (CORE::reverse @i) {
1373 0 my @range = ();
1374  
1375 # range error
1376 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
1377 0 croak "Invalid tr/// range \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1378 }
1379  
1380 # range of multiple-octet code
1381 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
1382 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
1383 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
1384 }
1385 elsif (CORE::length($char[$i+1]) == 2) {
1386 0 push @range, grep {$char[$i-1] le $_} chars1();
1387 0 push @range, grep {$_ le $char[$i+1]} chars2();
1388 }
1389 elsif (CORE::length($char[$i+1]) == 3) {
1390 0 push @range, grep {$char[$i-1] le $_} chars1();
1391 0 push @range, chars2();
1392 0 push @range, grep {$_ le $char[$i+1]} chars3();
1393 }
1394 elsif (CORE::length($char[$i+1]) == 4) {
1395 0 push @range, grep {$char[$i-1] le $_} chars1();
1396 0 push @range, chars2();
1397 0 push @range, chars3();
1398 0 push @range, grep {$_ le $char[$i+1]} chars4();
1399 }
1400 else {
1401 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1402 }
1403 }
1404 elsif (CORE::length($char[$i-1]) == 2) {
1405 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
1406 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
1407 }
1408 elsif (CORE::length($char[$i+1]) == 3) {
1409 0 push @range, grep {$char[$i-1] le $_} chars2();
1410 0 push @range, grep {$_ le $char[$i+1]} chars3();
1411 }
1412 elsif (CORE::length($char[$i+1]) == 4) {
1413 0 push @range, grep {$char[$i-1] le $_} chars2();
1414 0 push @range, chars3();
1415 0 push @range, grep {$_ le $char[$i+1]} chars4();
1416 }
1417 else {
1418 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1419 }
1420 }
1421 elsif (CORE::length($char[$i-1]) == 3) {
1422 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
1423 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
1424 }
1425 elsif (CORE::length($char[$i+1]) == 4) {
1426 0 push @range, grep {$char[$i-1] le $_} chars3();
1427 0 push @range, grep {$_ le $char[$i+1]} chars4();
1428 }
1429 else {
1430 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1431 }
1432 }
1433 elsif (CORE::length($char[$i-1]) == 4) {
1434 0 ▶ if (CORE::length($char[$i+1]) == 4) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $char[$i + 1] == 4) { } 0 0 0
1435 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
1436 }
1437 else {
1438 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1439 }
1440 }
1441 else {
1442 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1443 }
1444  
1445 0 splice @char, $i-1, 3, @range;
1446 }
1447  
1448 12 return @char;
1449 }
1450  
1451 #
1452 # Windows-1258 open character class
1453 #
1454 0 ▶sub _cc {
Subroutine _cc: not called CC=7 SCAR=40.3
1455 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
1456 0 die __FILE__, ": subroutine cc got no parameter.\n";
1457 }
1458 elsif (scalar(@_) == 1) {
1459 0 return sprintf('\x%02X',$_[0]);
1460 }
1461 elsif (scalar(@_) == 2) {
1462 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
1463 0 die __FILE__, ": subroutine cc got \$_[0] > \$_[1] parameters).\n";
1464 }
1465 elsif ($_[0] == $_[1]) {
1466 0 return sprintf('\x%02X',$_[0]);
1467 }
1468 elsif (($_[0]+1) == $_[1]) {
1469 0 return sprintf('[\\x%02X\\x%02X]',$_[0],$_[1]);
1470 }
1471 else {
1472 0 return sprintf('[\\x%02X-\\x%02X]',$_[0],$_[1]);
1473 }
1474 }
1475 else {
1476 0 die __FILE__, ": subroutine cc got 3 or more parameters (@{[scalar(@_)]} parameters).\n";
1477 }
1478 }
1479  
1480 #
1481 # Windows-1258 octet range
1482 #
1483 246 ▶sub _octets {
Subroutine _octets: called CC=5 SCAR=19.3
1484 246 my $length = shift @_;
1485  
1486 246 ▶ if ($length == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length == 1) { } 246 0 246
1487 246 my($a1) = unpack 'C', $_[0];
1488 246 my($z1) = unpack 'C', $_[1];
1489  
1490 246 ▶ if ($a1 > $z1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($a1 > $z1) 0 246 246
1491 0 croak 'Invalid [] range in regexp (CORE::ord(A) > CORE::ord(B)) ' . '\x' . unpack('H*',$a1) . '-\x' . unpack('H*',$z1);
1492 }
1493  
1494 246 ▶ if ($a1 == $z1) {
Branch: 2 branches
BranchTrueFalseTotal
if ($a1 == $z1) { } 0 246 246
elsif ($a1 + 1 == $z1) { } 0 246 246
1495 0 return sprintf('\x%02X',$a1);
1496 }
1497 elsif (($a1+1) == $z1) {
1498 0 return sprintf('\x%02X\x%02X',$a1,$z1);
1499 }
1500 else {
1501 246 return sprintf('\x%02X-\x%02X',$a1,$z1);
1502 }
1503 }
1504 else {
1505 0 die __FILE__, ": subroutine _octets got invalid length ($length).\n";
1506 }
1507 }
1508  
1509 #
1510 # Windows-1258 range regexp
1511 #
1512 246 ▶sub _range_regexp {
Subroutine _range_regexp: called CC=18 SCAR=41.7
1513 246 my($length,$first,$last) = @_;
1514  
1515 246 my @range_regexp = ();
1516 246 ▶ if (not exists $range_tr{$length}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $range_tr{$length}) 0 246 246
1517 0 return @range_regexp;
1518 }
1519  
1520 246 my @ranges = @{ $range_tr{$length} };
1521 246 ▶ while (my @range = splice(@ranges,0,$length)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, $length)) 246 246 492
1522 246 my $min = '';
1523 246 my $max = '';
1524 246 ▶ for (my $i=0; $i < $length; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $length) 246 246 492
1525 246 $min .= pack 'C', $range[$i][0];
1526 246 $max .= pack 'C', $range[$i][-1];
1527 }
1528  
1529 # min___max
1530 # FIRST_____________LAST
1531 # (nothing)
1532  
1533 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
1534 }
1535  
1536 # **********
1537 # min_________max
1538 # FIRST_____________LAST
1539 # **********
1540  
1541 ▶ 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
1542 0 push @range_regexp, _octets($length,$first,$max,$min,$max);
1543 }
1544  
1545 # **********************
1546 # min________________max
1547 # FIRST_____________LAST
1548 # **********************
1549  
1550 ▶ 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
1551 0 push @range_regexp, _octets($length,$first,$last,$min,$max);
1552 }
1553  
1554 # *********
1555 # min___max
1556 # FIRST_____________LAST
1557 # *********
1558  
1559 ▶ 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
1560 0 push @range_regexp, _octets($length,$min,$max,$min,$max);
1561 }
1562  
1563 # **********************
1564 # min__________________________max
1565 # FIRST_____________LAST
1566 # **********************
1567  
1568 ▶ 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
1569 246 push @range_regexp, _octets($length,$first,$last,$min,$max);
1570 }
1571  
1572 # *********
1573 # min________max
1574 # FIRST_____________LAST
1575 # *********
1576  
1577 ▶ 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
1578 0 push @range_regexp, _octets($length,$min,$last,$min,$max);
1579 }
1580  
1581 # min___max
1582 # FIRST_____________LAST
1583 # (nothing)
1584  
1585 elsif ($last lt $min) {
1586 }
1587  
1588 else {
1589 0 die __FILE__, ": subroutine _range_regexp panic.\n";
1590 }
1591 }
1592  
1593 246 return @range_regexp;
1594 }
1595  
1596 #
1597 # Windows-1258 open character list for qr and not qr
1598 #
1599 650 ▶sub _charlist {
Subroutine _charlist: called CC=46 SCAR=45.9
1600  
1601 650 my $modifier = pop @_;
1602 650 my @char = @_;
1603  
1604 650 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 298 352 650
1605  
1606 # unescape character
1607 650 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1773 650 2423
1608  
1609 # escape - to ...
1610 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
1611 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
1612 246 $char[$i] = '...';
1613 }
1614 }
1615  
1616 # octal escape sequence
1617 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
1618 0 $char[$i] = octchr($1);
1619 }
1620  
1621 # hexadecimal escape sequence
1622 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
1623 0 $char[$i] = hexchr($1);
1624 }
1625  
1626 # \b{...} --> b\{...}
1627 # \B{...} --> B\{...}
1628 # \N{CHARNAME} --> N\{CHARNAME}
1629 # \p{PROPERTY} --> p\{PROPERTY}
1630 # \P{PROPERTY} --> P\{PROPERTY}
1631 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
1632 0 $char[$i] = $1 . '\\' . $2;
1633 }
1634  
1635 # \p, \P, \X --> p, P, X
1636 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
1637 0 $char[$i] = $1;
1638 }
1639  
1640 elsif ($char[$i] =~ /\A \\ ([0-7]{2,3}) \z/oxms) {
1641 0 $char[$i] = CORE::chr oct $1;
1642 }
1643 elsif ($char[$i] =~ /\A \\x ([0-9A-Fa-f]{1,2}) \z/oxms) {
1644 22 $char[$i] = CORE::chr hex $1;
1645 }
1646 elsif ($char[$i] =~ /\A \\c ([\x40-\x5F]) \z/oxms) {
1647 0 $char[$i] = CORE::chr(CORE::ord($1) & 0x1F);
1648 }
1649 elsif ($char[$i] =~ /\A (\\ [0nrtfbaedswDSWHVhvR]) \z/oxms) {
1650 $char[$i] = {
1651 '\0' => "\0",
1652 '\n' => "\n",
1653 '\r' => "\r",
1654 '\t' => "\t",
1655 '\f' => "\f",
1656 '\b' => "\x08", # \b means backspace in character class
1657 '\a' => "\a",
1658 '\e' => "\e",
1659 '\d' => '[0-9]',
1660  
1661 # Vertical tabs are now whitespace
1662 # \s in a regex now matches a vertical tab in all circumstances.
1663 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
1664 # \t \n \v \f \r space
1665 # '\s' => '[\x09\x0A \x0C\x0D\x20]',
1666 # '\s' => '[\x09\x0A\x0B\x0C\x0D\x20]',
1667 '\s' => '\s',
1668  
1669 '\w' => '[0-9A-Z_a-z]',
1670 '\D' => '${Ewindows1258::eD}',
1671 '\S' => '${Ewindows1258::eS}',
1672 '\W' => '${Ewindows1258::eW}',
1673  
1674 '\H' => '${Ewindows1258::eH}',
1675 '\V' => '${Ewindows1258::eV}',
1676 '\h' => '[\x09\x20]',
1677 '\v' => '[\x0A\x0B\x0C\x0D]',
1678 '\R' => '${Ewindows1258::eR}',
1679  
1680 25 }->{$1};
1681 }
1682  
1683 # POSIX-style character classes
1684 ▶ 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
1685 $char[$i] = {
1686  
1687 '[:lower:]' => '[\x41-\x5A\x61-\x7A]',
1688 '[:upper:]' => '[\x41-\x5A\x61-\x7A]',
1689 '[:^lower:]' => '${Ewindows1258::not_lower_i}',
1690 '[:^upper:]' => '${Ewindows1258::not_upper_i}',
1691  
1692 8 }->{$1};
1693 }
1694 elsif ($char[$i] =~ /\A ( \[\: \^? (?:alnum|alpha|ascii|blank|cntrl|digit|graph|lower|print|punct|space|upper|word|xdigit) :\] ) \z/oxms) {
1695 $char[$i] = {
1696  
1697 '[:alnum:]' => '[\x30-\x39\x41-\x5A\x61-\x7A]',
1698 '[:alpha:]' => '[\x41-\x5A\x61-\x7A]',
1699 '[:ascii:]' => '[\x00-\x7F]',
1700 '[:blank:]' => '[\x09\x20]',
1701 '[:cntrl:]' => '[\x00-\x1F\x7F]',
1702 '[:digit:]' => '[\x30-\x39]',
1703 '[:graph:]' => '[\x21-\x7F]',
1704 '[:lower:]' => '[\x61-\x7A]',
1705 '[:print:]' => '[\x20-\x7F]',
1706 '[:punct:]' => '[\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E]',
1707  
1708 # P.174 POSIX-Style Character Classes
1709 # in Chapter 5: Pattern Matching
1710 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
1711  
1712 # P.311 11.2.4 Character Classes and other Special Escapes
1713 # in Chapter 11: perlre: Perl regular expressions
1714 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
1715  
1716 # P.210 POSIX-Style Character Classes
1717 # in Chapter 5: Pattern Matching
1718 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1719  
1720 '[:space:]' => '[\s\x0B]', # "\s" plus vertical tab ("\cK")
1721  
1722 '[:upper:]' => '[\x41-\x5A]',
1723 '[:word:]' => '[\x30-\x39\x41-\x5A\x5F\x61-\x7A]',
1724 '[:xdigit:]' => '[\x30-\x39\x41-\x46\x61-\x66]',
1725 '[:^alnum:]' => '${Ewindows1258::not_alnum}',
1726 '[:^alpha:]' => '${Ewindows1258::not_alpha}',
1727 '[:^ascii:]' => '${Ewindows1258::not_ascii}',
1728 '[:^blank:]' => '${Ewindows1258::not_blank}',
1729 '[:^cntrl:]' => '${Ewindows1258::not_cntrl}',
1730 '[:^digit:]' => '${Ewindows1258::not_digit}',
1731 '[:^graph:]' => '${Ewindows1258::not_graph}',
1732 '[:^lower:]' => '${Ewindows1258::not_lower}',
1733 '[:^print:]' => '${Ewindows1258::not_print}',
1734 '[:^punct:]' => '${Ewindows1258::not_punct}',
1735 '[:^space:]' => '${Ewindows1258::not_space}',
1736 '[:^upper:]' => '${Ewindows1258::not_upper}',
1737 '[:^word:]' => '${Ewindows1258::not_word}',
1738 '[:^xdigit:]' => '${Ewindows1258::not_xdigit}',
1739  
1740 70 }->{$1};
1741 }
1742 elsif ($char[$i] =~ /\A \\ ($q_char) \z/oxms) {
1743 7 $char[$i] = $1;
1744 }
1745 }
1746  
1747 # open character list
1748 650 my @singleoctet = ();
1749 650 my @multipleoctet = ();
1750 650 ▶ for (my $i=0; $i <= $#char; ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1527 650 2177
1751  
1752 # escaped -
1753 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
1754 246 $i += 1;
1755 246 next;
1756 }
1757  
1758 # make range regexp
1759 elsif ($char[$i] eq '...') {
1760  
1761 # range error
1762 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
1763 0 croak 'Invalid [] range in regexp (length(A) > length(B)) ' . '\x' . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]);
1764 }
1765 elsif (CORE::length($char[$i-1]) == CORE::length($char[$i+1])) {
1766 246 ▶ if ($char[$i-1] gt $char[$i+1]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i - 1] gt $char[$i + 1]) 0 246 246
1767 0 croak 'Invalid [] range in regexp (CORE::ord(A) > CORE::ord(B)) ' . '\x' . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]);
1768 }
1769 }
1770  
1771 # make range regexp per length
1772 246 for my $length (CORE::length($char[$i-1]) .. CORE::length($char[$i+1])) {
1773 246 my @regexp = ();
1774  
1775 # is first and last
1776 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
1777 246 push @regexp, _range_regexp($length, $char[$i-1], $char[$i+1]);
1778 }
1779  
1780 # is first
1781 elsif ($length == CORE::length($char[$i-1])) {
1782 0 push @regexp, _range_regexp($length, $char[$i-1], "\xFF" x $length);
1783 }
1784  
1785 # is inside in first and last
1786 ▶ 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
1787 0 push @regexp, _range_regexp($length, "\x00" x $length, "\xFF" x $length);
1788 }
1789  
1790 # is last
1791 elsif ($length == CORE::length($char[$i+1])) {
1792 0 push @regexp, _range_regexp($length, "\x00" x $length, $char[$i+1]);
1793 }
1794  
1795 else {
1796 0 die __FILE__, ": subroutine make_regexp panic.\n";
1797 }
1798  
1799 246 ▶ if ($length == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length == 1) { } 246 0 246
1800 246 push @singleoctet, @regexp;
1801 }
1802 else {
1803 0 push @multipleoctet, @regexp;
1804 }
1805 }
1806  
1807 246 $i += 2;
1808 }
1809  
1810 # with /i modifier
1811 elsif ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) {
1812 949 ▶ if ($modifier =~ /i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) { } 480 469 949
1813 480 my $uc = Ewindows1258::uc($char[$i]);
1814 480 my $fc = Ewindows1258::fc($char[$i]);
1815 480 ▶ if ($uc ne $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc ne $fc) { } 240 240 480
1816 240 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 240 0 240
1817 240 push @singleoctet, $uc, $fc;
1818 }
1819 else {
1820 0 push @singleoctet, $uc;
1821 0 push @multipleoctet, $fc;
1822 }
1823 }
1824 else {
1825 240 push @singleoctet, $char[$i];
1826 }
1827 }
1828 else {
1829 469 push @singleoctet, $char[$i];
1830 }
1831 949 $i += 1;
1832 }
1833  
1834 # single character of single octet code
1835 elsif ($char[$i] =~ /\A (?: \\h ) \z/oxms) {
1836 0 push @singleoctet, "\t", "\x20";
1837 0 $i += 1;
1838 }
1839 elsif ($char[$i] =~ /\A (?: \\v ) \z/oxms) {
1840 0 push @singleoctet, "\x0A", "\x0B", "\x0C", "\x0D";
1841 0 $i += 1;
1842 }
1843 elsif ($char[$i] =~ /\A (?: \\d | \\s | \\w ) \z/oxms) {
1844 2 push @singleoctet, $char[$i];
1845 2 $i += 1;
1846 }
1847  
1848 # single character of multiple-octet code
1849 else {
1850 84 push @multipleoctet, $char[$i];
1851 84 $i += 1;
1852 }
1853 }
1854  
1855 # quote metachar
1856 650 for (@singleoctet) {
1857 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
1858 0 $_ = '-';
1859 }
1860 elsif (/\A \n \z/oxms) {
1861 8 $_ = '\n';
1862 }
1863 elsif (/\A \r \z/oxms) {
1864 8 $_ = '\r';
1865 }
1866 elsif (/\A ([\x00-\x20\x7F-\xFF]) \z/oxms) {
1867 744 $_ = sprintf('\x%02X', CORE::ord $1);
1868 }
1869 elsif (/\A [\x00-\xFF] \z/oxms) {
1870 429 $_ = quotemeta $_;
1871 }
1872 }
1873  
1874 # return character list
1875 650 return \@singleoctet, \@multipleoctet;
1876 }
1877  
1878 #
1879 # Windows-1258 octal escape sequence
1880 #
1881 5 ▶sub octchr {
Subroutine octchr: called CC=2 SCAR=6.9
Pod undocumented
1882 5 my($octdigit) = @_;
1883  
1884 5 my @binary = ();
1885 5 for my $octal (split(//,$octdigit)) {
1886 push @binary, {
1887 '0' => '000',
1888 '1' => '001',
1889 '2' => '010',
1890 '3' => '011',
1891 '4' => '100',
1892 '5' => '101',
1893 '6' => '110',
1894 '7' => '111',
1895 50 }->{$octal};
1896 }
1897 5 my $binary = join '', @binary;
1898  
1899 my $octchr = {
1900 # 1234567
1901 1 => pack('B*', "0000000$binary"),
1902 2 => pack('B*', "000000$binary"),
1903 3 => pack('B*', "00000$binary"),
1904 4 => pack('B*', "0000$binary"),
1905 5 => pack('B*', "000$binary"),
1906 6 => pack('B*', "00$binary"),
1907 7 => pack('B*', "0$binary"),
1908 0 => pack('B*', "$binary"),
1909  
1910 5 }->{CORE::length($binary) % 8};
1911  
1912 5 return $octchr;
1913 }
1914  
1915 #
1916 # Windows-1258 hexadecimal escape sequence
1917 #
1918 5 ▶sub hexchr {
Subroutine hexchr: called CC=1 SCAR=0.0
Pod undocumented
1919 5 my($hexdigit) = @_;
1920  
1921 my $hexchr = {
1922 1 => pack('H*', "0$hexdigit"),
1923 0 => pack('H*', "$hexdigit"),
1924  
1925 5 }->{CORE::length($_[0]) % 2};
1926  
1927 5 return $hexchr;
1928 }
1929  
1930 #
1931 # Windows-1258 open character list for qr
1932 #
1933 576 ▶sub charlist_qr {
Subroutine charlist_qr: called CC=17 SCAR=28.7
Pod undocumented
1934  
1935 576 my $modifier = pop @_;
1936 576 my @char = @_;
1937  
1938 576 my($singleoctet, $multipleoctet) = _charlist(@char, $modifier);
1939 576 my @singleoctet = @$singleoctet;
1940 576 my @multipleoctet = @$multipleoctet;
1941  
1942 # return character list
1943 576 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) 498 78 576
1944  
1945 # with /i modifier
1946 498 ▶ if ($modifier =~ m/i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) 265 233 498
1947 265 my %singleoctet_ignorecase = ();
1948 265 for (@singleoctet) {
1949 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
1950 745 for my $ord (hex($1) .. hex($2)) {
1951 795 my $char = CORE::chr($ord);
1952 795 my $uc = Ewindows1258::uc($char);
1953 795 my $fc = Ewindows1258::fc($char);
1954 795 ▶ if ($uc eq $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc eq $fc) { } 240 555 795
1955 240 $singleoctet_ignorecase{unpack 'C*', $char} = 1;
1956 }
1957 else {
1958 555 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 555 0 555
1959 555 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
1960 555 $singleoctet_ignorecase{unpack 'C*', $fc} = 1;
1961 }
1962 else {
1963 0 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
1964 0 push @multipleoctet, join '', map {sprintf('\x%02X',$_)} unpack 'C*', $fc;
1965 }
1966 }
1967 }
1968 }
1969 745 ▶ if ($_ ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ ne "") 0 745 745
1970 0 $singleoctet_ignorecase{unpack 'C*', $_} = 1;
1971 }
1972 }
1973 265 my $i = 0;
1974 265 my @singleoctet_ignorecase = ();
1975 265 for my $ord (0 .. 255) {
1976 67840 ▶ if (exists $singleoctet_ignorecase{$ord}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $singleoctet_ignorecase{$ord}) { } 870 66970 67840
1977 870 push @{$singleoctet_ignorecase[$i]}, $ord;
1978 }
1979 else {
1980 66970 $i++;
1981 }
1982 }
1983 265 @singleoctet = ();
1984 265 for my $range (@singleoctet_ignorecase) {
1985 56160 ▶ if (ref $range) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $range) 770 55390 56160
1986 770 ▶ if (scalar(@{$range}) == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @{$range;} == 1) { } 720 50 770
elsif (scalar @{$range;} == 2) { } 0 50 50
1987 720 push @singleoctet, sprintf('\x%02X', @{$range}[0]);
1988 }
1989 50 elsif (scalar(@{$range}) == 2) {
1990 0 push @singleoctet, sprintf('\x%02X\x%02X', @{$range}[0], @{$range}[-1]);
1991 }
1992 else {
1993 50 push @singleoctet, sprintf('\x%02X-\x%02X', @{$range}[0], @{$range}[-1]);
1994 }
1995 }
1996 }
1997 }
1998  
1999 498 my $not_anchor = '';
2000  
2001 498 push @multipleoctet, join('', $not_anchor, '[', @singleoctet, ']' );
2002 }
2003 576 ▶ if (scalar(@multipleoctet) >= 2) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @multipleoctet >= 2) { } 6 570 576
2004 6 return '(?:' . join('|', @multipleoctet) . ')';
2005 }
2006 else {
2007 570 return $multipleoctet[0];
2008 }
2009 }
2010  
2011 #
2012 # Windows-1258 open character list for not qr
2013 #
2014 74 ▶sub charlist_not_qr {
Subroutine charlist_not_qr: called CC=18 SCAR=33.1
Pod undocumented
2015  
2016 74 my $modifier = pop @_;
2017 74 my @char = @_;
2018  
2019 74 my($singleoctet, $multipleoctet) = _charlist(@char, $modifier);
2020 74 my @singleoctet = @$singleoctet;
2021 74 my @multipleoctet = @$multipleoctet;
2022  
2023 # with /i modifier
2024 74 ▶ if ($modifier =~ m/i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) 25 49 74
2025 25 my %singleoctet_ignorecase = ();
2026 25 for (@singleoctet) {
2027 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
2028 25 for my $ord (hex($1) .. hex($2)) {
2029 75 my $char = CORE::chr($ord);
2030 75 my $uc = Ewindows1258::uc($char);
2031 75 my $fc = Ewindows1258::fc($char);
2032 75 ▶ if ($uc eq $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc eq $fc) { } 0 75 75
2033 0 $singleoctet_ignorecase{unpack 'C*', $char} = 1;
2034 }
2035 else {
2036 75 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 75 0 75
2037 75 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2038 75 $singleoctet_ignorecase{unpack 'C*', $fc} = 1;
2039 }
2040 else {
2041 0 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2042 0 push @multipleoctet, join '', map {sprintf('\x%02X',$_)} unpack 'C*', $fc;
2043 }
2044 }
2045 }
2046 }
2047 25 ▶ if ($_ ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ ne "") 0 25 25
2048 0 $singleoctet_ignorecase{unpack 'C*', $_} = 1;
2049 }
2050 }
2051 25 my $i = 0;
2052 25 my @singleoctet_ignorecase = ();
2053 25 for my $ord (0 .. 255) {
2054 6400 ▶ if (exists $singleoctet_ignorecase{$ord}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $singleoctet_ignorecase{$ord}) { } 150 6250 6400
2055 150 push @{$singleoctet_ignorecase[$i]}, $ord;
2056 }
2057 else {
2058 6250 $i++;
2059 }
2060 }
2061 25 @singleoctet = ();
2062 25 for my $range (@singleoctet_ignorecase) {
2063 2400 ▶ if (ref $range) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $range) 50 2350 2400
2064 50 ▶ if (scalar(@{$range}) == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @{$range;} == 1) { } 0 50 50
elsif (scalar @{$range;} == 2) { } 0 50 50
2065 0 push @singleoctet, sprintf('\x%02X', @{$range}[0]);
2066 }
2067 50 elsif (scalar(@{$range}) == 2) {
2068 0 push @singleoctet, sprintf('\x%02X\x%02X', @{$range}[0], @{$range}[-1]);
2069 }
2070 else {
2071 50 push @singleoctet, sprintf('\x%02X-\x%02X', @{$range}[0], @{$range}[-1]);
2072 }
2073 }
2074 }
2075 }
2076  
2077 # return character list
2078 74 ▶ if (scalar(@multipleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @multipleoctet >= 1) { } 0 74 74
2079 0 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) { } 0 0 0
2080  
2081 # any character other than multiple-octet and single octet character class
2082 0 return '(?!' . join('|', @multipleoctet) . ')(?:[^' . join('', @singleoctet) . '])';
2083 }
2084 else {
2085  
2086 # any character other than multiple-octet character class
2087 0 return '(?!' . join('|', @multipleoctet) . ")(?:$your_char)";
2088 }
2089 }
2090 else {
2091 74 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) { } 74 0 74
2092  
2093 # any character other than single octet character class
2094 74 return '(?:[^' . join('', @singleoctet) . '])';
2095 }
2096 else {
2097  
2098 # any character
2099 0 return "(?:$your_char)";
2100 }
2101 }
2102 }
2103  
2104 #
2105 # open file in read mode
2106 #
2107 422 ▶sub _open_r {
Subroutine _open_r: called CC=1 SCAR=0.0
2108 422 my(undef,$file) = @_;
2109 422 ▶ use Fcntl qw(O_RDONLY);
Subroutine BEGIN: called CC=1 SCAR=0.0
2110 422 return CORE::sysopen($_[0], $file, &O_RDONLY);
2111 }
2112  
2113 #
2114 # open file in append mode
2115 #
2116 211 ▶sub _open_a {
Subroutine _open_a: called CC=1 SCAR=0.0
2117 211 my(undef,$file) = @_;
2118 422 ▶ use Fcntl qw(O_WRONLY O_APPEND O_CREAT);
Subroutine BEGIN: called CC=1 SCAR=0.0
2119 211 return CORE::sysopen($_[0], $file, &O_WRONLY|&O_APPEND|&O_CREAT);
2120 }
2121  
2122 #
2123 # safe system
2124 #
2125 211 ▶sub _systemx {
Subroutine _systemx: called CC=1 SCAR=0.0
2126  
2127 # P.707 29.2.33. exec
2128 # in Chapter 29: Functions
2129 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2130 #
2131 # Be aware that in older releases of Perl, exec (and system) did not flush
2132 # your output buffer, so you needed to enable command buffering by setting $|
2133 # on one or more filehandles to avoid lost output in the case of exec, or
2134 # misordererd output in the case of system. This situation was largely remedied
2135 # in the 5.6 release of Perl. (So, 5.005 release not yet.)
2136  
2137 # P.855 exec
2138 # in Chapter 27: Functions
2139 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2140 #
2141 # In very old release of Perl (before v5.6), exec (and system) did not flush
2142 # your output buffer, so you needed to enable command buffering by setting $|
2143 # on one or more filehandles to avoid lost output with exec or misordered
2144 # output with system.
2145  
2146 211 $| = 1;
2147  
2148 # P.565 23.1.2. Cleaning Up Your Environment
2149 # in Chapter 23: Security
2150 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2151  
2152 # P.656 Cleaning Up Your Environment
2153 # in Chapter 20: Security
2154 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2155  
2156 # local $ENV{'PATH'} = '.';
2157 211 local @ENV{qw(IFS CDPATH ENV BASH_ENV)}; # Make %ENV safer
2158  
2159 # P.707 29.2.33. exec
2160 # in Chapter 29: Functions
2161 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2162 #
2163 # As we mentioned earlier, exec treats a discrete list of arguments as an
2164 # indication that it should bypass shell processing. However, there is one
2165 # place where you might still get tripped up. The exec call (and system, too)
2166 # will not distinguish between a single scalar argument and an array containing
2167 # only one element.
2168 #
2169 # @args = ("echo surprise"); # just one element in list
2170 # exec @args # still subject to shell escapes
2171 # or die "exec: $!"; # because @args == 1
2172 #
2173 # To avoid this, you can use the PATHNAME syntax, explicitly duplicating the
2174 # first argument as the pathname, which forces the rest of the arguments to be
2175 # interpreted as a list, even if there is only one of them:
2176 #
2177 # exec { $args[0] } @args # safe even with one-argument list
2178 # or die "can't exec @args: $!";
2179  
2180 # P.855 exec
2181 # in Chapter 27: Functions
2182 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2183 #
2184 # As we mentioned earlier, exec treats a discrete list of arguments as a
2185 # directive to bypass shell processing. However, there is one place where
2186 # you might still get tripped up. The exec call (and system, too) cannot
2187 # distinguish between a single scalar argument and an array containing
2188 # only one element.
2189 #
2190 # @args = ("echo surprise"); # just one element in list
2191 # exec @args # still subject to shell escapes
2192 # || die "exec: $!"; # because @args == 1
2193 #
2194 # To avoid this, use the PATHNAME syntax, explicitly duplicating the first
2195 # argument as the pathname, which forces the rest of the arguments to be
2196 # interpreted as a list, even if there is only one of them:
2197 #
2198 # exec { $args[0] } @args # safe even with one-argument list
2199 # || die "can't exec @args: $!";
2200  
2201 211 return CORE::system { $_[0] } @_; # safe even with one-argument list
2202 }
2203  
2204 #
2205 # Windows-1258 order to character (with parameter)
2206 #
2207 3469 ▶sub Ewindows1258::chr(;$) {
Subroutine chr: called CC=4 SCAR=13.9
Pod undocumented
2208  
2209 3469 ▶ my $c = @_ ? $_[0] : $_;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 3469 0 3469
2210  
2211 3469 ▶ if ($c == 0x00) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c == 0) { } 24 3445 3469
2212 24 return "\x00";
2213 }
2214 else {
2215 3445 my @chr = ();
2216 3445 ▶ while ($c > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c > 0) 3445 3445 6890
2217 3445 unshift @chr, ($c % 0x100);
2218 3445 $c = int($c / 0x100);
2219 }
2220 3445 return pack 'C*', @chr;
2221 }
2222 }
2223  
2224 #
2225 # Windows-1258 order to character (without parameter)
2226 #
2227 0 ▶sub Ewindows1258::chr_() {
Subroutine chr_: not called CC=3 SCAR=24.8
Pod undocumented
2228  
2229 0 my $c = $_;
2230  
2231 0 ▶ if ($c == 0x00) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c == 0) { } 0 0 0
2232 0 return "\x00";
2233 }
2234 else {
2235 0 my @chr = ();
2236 0 ▶ while ($c > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c > 0) 0 0 0
2237 0 unshift @chr, ($c % 0x100);
2238 0 $c = int($c / 0x100);
2239 }
2240 0 return pack 'C*', @chr;
2241 }
2242 }
2243  
2244 #
2245 # Windows-1258 path globbing (with parameter)
2246 #
2247 0 ▶sub Ewindows1258::glob($) {
Subroutine glob: not called CC=3 SCAR=24.8
Pod undocumented
2248  
2249 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2250 0 my @glob = _DOS_like_glob(@_);
2251 0 for my $glob (@glob) {
2252 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2253 }
2254 0 return @glob;
2255 }
2256 else {
2257 0 my $glob = _DOS_like_glob(@_);
2258 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2259 0 return $glob;
2260 }
2261 }
2262  
2263 #
2264 # Windows-1258 path globbing (without parameter)
2265 #
2266 0 ▶sub Ewindows1258::glob_() {
Subroutine glob_: not called CC=3 SCAR=24.8
Pod undocumented
2267  
2268 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2269 0 my @glob = _DOS_like_glob();
2270 0 for my $glob (@glob) {
2271 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2272 }
2273 0 return @glob;
2274 }
2275 else {
2276 0 my $glob = _DOS_like_glob();
2277 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2278 0 return $glob;
2279 }
2280 }
2281  
2282 #
2283 # Windows-1258 path globbing via File::DosGlob 1.10
2284 #
2285 # Often I confuse "_dosglob" and "_doglob".
2286 # So, I renamed "_dosglob" to "_DOS_like_glob".
2287 #
2288 422 my %iter;
2289 my %entries;
2290 0 ▶sub _DOS_like_glob {
Subroutine _DOS_like_glob: not called CC=10 SCAR=47.0
2291  
2292 # context (keyed by second cxix argument provided by core)
2293 0 my($expr,$cxix) = @_;
2294  
2295 # glob without args defaults to $_
2296 0 ▶ $expr = $_ if not defined $expr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $expr 0 0 0
2297  
2298 # represents the current user's home directory
2299 #
2300 # 7.3. Expanding Tildes in Filenames
2301 # in Chapter 7. File Access
2302 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2303 #
2304 # and File::HomeDir, File::HomeDir::Windows module
2305  
2306 # DOS-like system
2307 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
2308 0 $expr =~ s{ \A ~ (?= [^/\\] ) }
2309 0 { my_home_MSWin32() }oxmse;
2310 }
2311  
2312 # UNIX-like system
2313 else {
2314 0 $expr =~ s{ \A ~ ( (?:[^/])* ) }
2315 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
2316 }
2317  
2318 # assume global context if not provided one
2319 0 ▶ $cxix = '_G_' if not defined $cxix;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $cxix 0 0 0
2320 0 ▶ $iter{$cxix} = 0 if not exists $iter{$cxix};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $iter{$cxix} 0 0 0
2321  
2322 # if we're just beginning, do it all first
2323 0 ▶ if ($iter{$cxix} == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iter{$cxix} == 0) 0 0 0
2324 0 $entries{$cxix} = [ _do_glob(1, _parse_line($expr)) ];
2325 }
2326  
2327 # chuck it all out, quick or slow
2328 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2329 0 delete $iter{$cxix};
2330 0 return @{delete $entries{$cxix}};
2331 }
2332 else {
2333 0 ▶ if ($iter{$cxix} = scalar @{$entries{$cxix}}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iter{$cxix} = scalar @{$entries{$cxix};}) { } 0 0 0
2334 0 return shift @{$entries{$cxix}};
2335 }
2336 else {
2337 # return undef for EOL
2338 0 delete $iter{$cxix};
2339 0 delete $entries{$cxix};
2340 0 return undef;
2341 }
2342 }
2343 }
2344  
2345 #
2346 # Windows-1258 path globbing subroutine
2347 #
2348 0 ▶sub _do_glob {
Subroutine _do_glob: not called CC=44 SCAR=75.9
2349  
2350 0 my($cond,@expr) = @_;
2351 0 my @glob = ();
2352 0 my $fix_drive_relative_paths = 0;
2353  
2354 OUTER:
2355 0 for my $expr (@expr) {
2356 0 ▶ next OUTER if not defined $expr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $expr 0 0 0
2357 0 ▶ next OUTER if $expr eq '';
Branch: 1 branch
BranchTrueFalseTotal
if $expr eq "" 0 0 0
2358  
2359 0 my @matched = ();
2360 0 my @globdir = ();
2361 0 my $head = '.';
2362 0 my $pathsep = '/';
2363 0 my $tail;
2364  
2365 # if argument is within quotes strip em and do no globbing
2366 0 ▶ if ($expr =~ /\A " ((?:$q_char)*?) " \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expr =~ /\A " ((?:$Ewindows1258::q_char)*?) " \z/mosx) 0 0 0
2367 0 $expr = $1;
2368 0 ▶ if ($cond eq 'd') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cond eq 'd') { } 0 0 0
2369 0 ▶ if (-d $expr) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $expr) 0 0 0
2370 0 push @glob, $expr;
2371 }
2372 }
2373 else {
2374 0 ▶ if (-e $expr) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $expr) 0 0 0
2375 0 push @glob, $expr;
2376 }
2377 }
2378 0 next OUTER;
2379 }
2380  
2381 # wildcards with a drive prefix such as h:*.pm must be changed
2382 # to h:./*.pm to expand correctly
2383 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
2384 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
2385 0 $fix_drive_relative_paths = 1;
2386 }
2387 }
2388  
2389 0 ▶ if (($head, $tail) = _parse_path($expr,$pathsep)) {
Branch: 1 branch
BranchTrueFalseTotal
if (($head, $tail) = _parse_path($expr, $pathsep)) 0 0 0
2390 0 ▶ if ($tail eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($tail eq "") 0 0 0
2391 0 push @glob, $expr;
2392 0 next OUTER;
2393 }
2394 0 ▶ if ($head =~ / \A (?:$q_char)*? [*?] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head =~ / \A (?:$Ewindows1258::q_char)*? [*?] /mosx) 0 0 0
2395 0 ▶ if (@globdir = _do_glob('d', $head)) {
Branch: 1 branch
BranchTrueFalseTotal
if (@globdir = _do_glob("d", $head)) 0 0 0
2396 0 push @glob, _do_glob($cond, map {"$_$pathsep$tail"} @globdir);
2397 0 next OUTER;
2398 }
2399 }
2400 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
2401 0 $head .= $pathsep;
2402 }
2403 0 $expr = $tail;
2404 }
2405  
2406 # If file component has no wildcards, we can avoid opendir
2407 0 ▶ if ($expr !~ / \A (?:$q_char)*? [*?] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($expr =~ / \A (?:$Ewindows1258::q_char)*? [*?] /mosx) 0 0 0
2408 0 ▶ if ($head eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($head eq ".") 0 0 0
2409 0 $head = '';
2410 }
2411 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
2412 0 $head .= $pathsep;
2413 }
2414 0 $head .= $expr;
2415 0 ▶ if ($cond eq 'd') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cond eq 'd') { } 0 0 0
2416 0 ▶ if (-d $head) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $head) 0 0 0
2417 0 push @glob, $head;
2418 }
2419 }
2420 else {
2421 0 ▶ if (-e $head) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $head) 0 0 0
2422 0 push @glob, $head;
2423 }
2424 }
2425 0 next OUTER;
2426 }
2427 0 ▶ opendir(*DIR, $head) or next OUTER;
Branch: 1 branch
BranchTrueFalseTotal
opendir *DIR, $head or next OUTER 0 0 0
2428 0 my @leaf = readdir DIR;
2429 0 closedir DIR;
2430  
2431 0 ▶ if ($head eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($head eq ".") 0 0 0
2432 0 $head = '';
2433 }
2434 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
2435 0 $head .= $pathsep;
2436 }
2437  
2438 0 my $pattern = '';
2439 0 ▶ while ($expr =~ / \G ($q_char) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expr =~ / \G ($Ewindows1258::q_char) /cgox) 0 0 0
2440 0 my $char = $1;
2441  
2442 # 6.9. Matching Shell Globs as Regular Expressions
2443 # in Chapter 6. Pattern Matching
2444 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2445 # (and so on)
2446  
2447 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
2448 0 $pattern .= "(?:$your_char)*",
2449 }
2450 elsif ($char eq '?') {
2451 0 $pattern .= "(?:$your_char)?", # DOS style
2452 # $pattern .= "(?:$your_char)", # UNIX style
2453 }
2454 elsif ((my $fc = Ewindows1258::fc($char)) ne $char) {
2455 0 $pattern .= $fc;
2456 }
2457 else {
2458 0 $pattern .= quotemeta $char;
2459 }
2460 }
2461 0 ▶ my $matchsub = sub { Ewindows1258::fc($_[0]) =~ /\A $pattern \z/xms };
Subroutine __ANON__: not called CC=1 SCAR=6.9
2462  
2463 # if ($@) {
2464 # print STDERR "$0: $@\n";
2465 # next OUTER;
2466 # }
2467  
2468 INNER:
2469 0 for my $leaf (@leaf) {
2470 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
2471 0 next INNER;
2472 }
2473 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
2474 0 next INNER;
2475 }
2476  
2477 0 ▶ if (&$matchsub($leaf)) {
Branch: 1 branch
BranchTrueFalseTotal
if (&$matchsub($leaf)) 0 0 0
2478 0 push @matched, "$head$leaf";
2479 0 next INNER;
2480 }
2481  
2482 # [DOS compatibility special case]
2483 # Failed, add a trailing dot and try again, but only...
2484  
2485 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
2486 CORE::length($leaf) <= 8 and # name is shorter than or equal to 8 chars *and*
2487 Ewindows1258::index($pattern,'\\.') != -1 # pattern has a dot.
2488 ) {
2489 0 ▶ if (&$matchsub("$leaf.")) {
Branch: 1 branch
BranchTrueFalseTotal
if (&$matchsub("$leaf.")) 0 0 0
2490 0 push @matched, "$head$leaf";
2491 0 next INNER;
2492 }
2493 }
2494 }
2495 0 ▶ if (@matched) {
Branch: 1 branch
BranchTrueFalseTotal
if (@matched) 0 0 0
2496 0 push @glob, @matched;
2497 }
2498 }
2499 0 ▶ if ($fix_drive_relative_paths) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fix_drive_relative_paths) 0 0 0
2500 0 for my $glob (@glob) {
2501 0 $glob =~ s# \A ([A-Za-z]:) \./ #$1#oxms;
2502 }
2503 }
2504 0 return @glob;
2505 }
2506  
2507 #
2508 # Windows-1258 parse line
2509 #
2510 0 ▶sub _parse_line {
Subroutine _parse_line: not called CC=3 SCAR=24.8
2511  
2512 0 my($line) = @_;
2513  
2514 0 $line .= ' ';
2515 0 my @piece = ();
2516 0 ▶ while ($line =~ /
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ / " ( (?>(?: [^"] )* ) ) " (?>\s+) | ( (?>(?: [^"\s] )* ) ) (?>\s+) /gmosx) 0 0 0
2517 " ( (?>(?: [^"] )* ) ) " (?>\s+) |
2518 ( (?>(?: [^"\s] )* ) ) (?>\s+)
2519 /oxmsg
2520 ) {
2521 0 ▶ push @piece, defined($1) ? $1 : $2;
Branch: 1 branch
BranchTrueFalseTotal
defined $1 ? : 0 0 0
2522 }
2523 0 return @piece;
2524 }
2525  
2526 #
2527 # Windows-1258 parse path
2528 #
2529 0 ▶sub _parse_path {
Subroutine _parse_path: not called CC=2 SCAR=17.9
2530  
2531 0 my($path,$pathsep) = @_;
2532  
2533 0 $path .= '/';
2534 0 my @subpath = ();
2535 0 ▶ while ($path =~ /
Branch: 1 branch
BranchTrueFalseTotal
if ($path =~ m( ((?: [^/\\] )+?) [/\\] )gmosx) 0 0 0
2536 ((?: [^\/\\] )+?) [\/\\]
2537 /oxmsg
2538 ) {
2539 0 push @subpath, $1;
2540 }
2541  
2542 0 my $tail = pop @subpath;
2543 0 my $head = join $pathsep, @subpath;
2544 0 return $head, $tail;
2545 }
2546  
2547 #
2548 # via File::HomeDir::Windows 1.00
2549 #
2550 0 ▶sub my_home_MSWin32 {
Subroutine my_home_MSWin32: not called CC=9 SCAR=45.0
Pod undocumented
2551  
2552 # A lot of unix people and unix-derived tools rely on
2553 # the ability to overload HOME. We will support it too
2554 # so that they can replace raw HOME calls with File::HomeDir.
2555 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
2556 0 return $ENV{'HOME'};
2557 }
2558  
2559 # Do we have a user profile?
2560 ▶ 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
2561 0 return $ENV{'USERPROFILE'};
2562 }
2563  
2564 # Some Windows use something like $ENV{'HOME'}
2565 ▶ 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
2566 0 return join '', $ENV{'HOMEDRIVE'}, $ENV{'HOMEPATH'};
2567 }
2568  
2569 0 return undef;
2570 }
2571  
2572 #
2573 # via File::HomeDir::Unix 1.00
2574 #
2575 0 ▶sub my_home {
Subroutine my_home: not called CC=7 SCAR=40.3
Pod undocumented
2576 0 my $home;
2577  
2578 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
2579 0 $home = $ENV{'HOME'};
2580 }
2581  
2582 # This is from the original code, but I'm guessing
2583 # it means "login directory" and exists on some Unixes.
2584 ▶ 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
2585 0 $home = $ENV{'LOGDIR'};
2586 }
2587  
2588 ### More-desperate methods
2589  
2590 # Light desperation on any (Unixish) platform
2591 else {
2592 0 $home = CORE::eval q{ (getpwuid($<))[7] };
2593 }
2594  
2595 # On Unix in general, a non-existant home means "no home"
2596 # For example, "nobody"-like users might use /nonexistant
2597 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
2598 0 $home = undef;
2599 }
2600 0 return $home;
2601 }
2602  
2603 #
2604 # ${^PREMATCH}, $PREMATCH, $` the string preceding what was matched
2605 #
2606 56 ▶sub Ewindows1258::PREMATCH {
Subroutine PREMATCH: called CC=1 SCAR=0.0
Pod undocumented
2607 56 return $`;
2608 }
2609  
2610 #
2611 # ${^MATCH}, $MATCH, $& the string that matched
2612 #
2613 81 ▶sub Ewindows1258::MATCH {
Subroutine MATCH: called CC=1 SCAR=0.0
Pod undocumented
2614 81 return $&;
2615 }
2616  
2617 #
2618 # ${^POSTMATCH}, $POSTMATCH, $' the string following what was matched
2619 #
2620 42 ▶sub Ewindows1258::POSTMATCH {
Subroutine POSTMATCH: called CC=1 SCAR=0.0
Pod undocumented
2621 42 return $';
2622 }
2623  
2624 #
2625 # Windows-1258 character to order (with parameter)
2626 #
2627 0 ▶sub Windows1258::ord(;$) {
Subroutine ord: not called CC=4 SCAR=30.0
2628  
2629 0 ▶ local $_ = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
2630  
2631 0 ▶ if (/\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\A ($Ewindows1258::q_char) /mosx) { } 0 0 0
2632 0 my @ord = unpack 'C*', $1;
2633 0 my $ord = 0;
2634 0 ▶ while (my $o = shift @ord) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $o = shift @ord) 0 0 0
2635 0 $ord = $ord * 0x100 + $o;
2636 }
2637 0 return $ord;
2638 }
2639 else {
2640 0 return CORE::ord $_;
2641 }
2642 }
2643  
2644 #
2645 # Windows-1258 character to order (without parameter)
2646 #
2647 0 ▶sub Windows1258::ord_() {
Subroutine ord_: not called CC=3 SCAR=24.8
2648  
2649 0 ▶ if (/\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\A ($Ewindows1258::q_char) /mosx) { } 0 0 0
2650 0 my @ord = unpack 'C*', $1;
2651 0 my $ord = 0;
2652 0 ▶ while (my $o = shift @ord) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $o = shift @ord) 0 0 0
2653 0 $ord = $ord * 0x100 + $o;
2654 }
2655 0 return $ord;
2656 }
2657 else {
2658 0 return CORE::ord $_;
2659 }
2660 }
2661  
2662 #
2663 # Windows-1258 reverse
2664 #
2665 0 ▶sub Windows1258::reverse(@) {
Subroutine reverse: not called CC=2 SCAR=17.9
2666  
2667 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2668 0 return CORE::reverse @_;
2669 }
2670 else {
2671  
2672 # One of us once cornered Larry in an elevator and asked him what
2673 # problem he was solving with this, but he looked as far off into
2674 # the distance as he could in an elevator and said, "It seemed like
2675 # a good idea at the time."
2676  
2677 0 return join '', CORE::reverse(join('',@_) =~ /\G ($q_char) /oxmsg);
2678 }
2679 }
2680  
2681 #
2682 # Windows-1258 getc (with parameter, without parameter)
2683 #
2684 20 ▶sub Windows1258::getc(;*@) {
Subroutine getc: called CC=9 SCAR=26.7
2685  
2686 20 my($package) = caller;
2687 20 ▶ my $fh = @_ ? qualify_to_ref(shift,$package) : \*STDIN;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 20 0 20
2688 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
2689  
2690 0 my @length = sort { $a <=> $b } keys %range_tr;
2691 20 my $getc = '';
2692 20 for my $length ($length[0] .. $length[-1]) {
2693 20 $getc .= CORE::getc($fh);
2694 20 ▶ if (exists $range_tr{CORE::length($getc)}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{length $getc}) 20 0 20
2695 20 ▶ if ($getc =~ /\A ${Ewindows1258::dot_s} \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($getc =~ /\A $Ewindows1258::dot_s \z/mosx) 20 0 20
2696 20 ▶ return wantarray ? ($getc,@_) : $getc;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 20 20
2697 }
2698 }
2699 }
2700 0 ▶ return wantarray ? ($getc,@_) : $getc;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
2701 }
2702  
2703 #
2704 # Windows-1258 length by character
2705 #
2706 0 ▶sub Windows1258::length(;$) {
Subroutine length: not called CC=2 SCAR=17.9
2707  
2708 0 ▶ local $_ = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
2709  
2710 0 local @_ = /\G ($q_char) /oxmsg;
2711 0 return scalar @_;
2712 }
2713  
2714 #
2715 # Windows-1258 substr by character
2716 #
2717 422 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=7.0
2718  
2719 # P.232 The lvalue Attribute
2720 # in Chapter 6: Subroutines
2721 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2722  
2723 # P.336 The lvalue Attribute
2724 # in Chapter 7: Subroutines
2725 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2726  
2727 # P.144 8.4 Lvalue subroutines
2728 # in Chapter 8: perlsub: Perl subroutines
2729 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
2730  
2731 0 ▶ CORE::eval sprintf(<<'END', ($] >= 5.014000) ? ':lvalue' : '');
Subroutine substr: called CC=11 SCAR=24.4
Branch: 10 branches
BranchTrueFalseTotal
$] >= 5.014 ? : 422 0 422
if ($offset > scalar @char or $offset < -1 * scalar(@char)) 2 25 27
if (@_ == 4) { } 1 24 25
elsif (@_ == 3) { } 21 3 24
if ($offset == 0) { } 0 21 21
elsif ($offset > 0) { } 20 1 21
if ($length == 0) { } 0 21 21
elsif ($length > 0) { } 20 1 21
if ($offset == 0) { } 0 3 3
elsif ($offset > 0) { } 2 1 3
Condition66%2/3
$offset > scalar @char or $offset < -1 * scalar(@char)
l!l&&r!l&&!r
2025
MC/DC50%1/2
$offset > scalar @char or $offset < -1 * scalar(@char)
$offset > scalar @char $offset < -1 * scalar(@char)
Truth table66%2/3
A or B
A= $offset > scalar @charB= $offset < -1 * scalar(@char)
ABresult
1X1
011
000
2732 # vv----------------------*******
2733 sub Windows1258::substr($$;$$) %s {
2734  
2735 my @char = $_[0] =~ /\G (?>$q_char) /oxmsg;
2736  
2737 # If the substring is beyond either end of the string, substr() returns the undefined
2738 # value and produces a warning. When used as an lvalue, specifying a substring that
2739 # is entirely outside the string raises an exception.
2740 # http://perldoc.perl.org/functions/substr.html
2741  
2742 # A return with no argument returns the scalar value undef in scalar context,
2743 # an empty list () in list context, and (naturally) nothing at all in void
2744 # context.
2745  
2746 my $offset = $_[1];
2747 if (($offset > scalar(@char)) or ($offset < (-1 * scalar(@char)))) {
2748 return;
2749 }
2750  
2751 # substr($string,$offset,$length,$replacement)
2752 if (@_ == 4) {
2753 my(undef,undef,$length,$replacement) = @_;
2754 my $substr = join '', splice(@char, $offset, $length, $replacement);
2755 $_[0] = join '', @char;
2756  
2757 # return $substr; this doesn't work, don't say "return"
2758 $substr;
2759 }
2760  
2761 # substr($string,$offset,$length)
2762 elsif (@_ == 3) {
2763 my(undef,undef,$length) = @_;
2764 my $octet_offset = 0;
2765 my $octet_length = 0;
2766 if ($offset == 0) {
2767 $octet_offset = 0;
2768 }
2769 elsif ($offset > 0) {
2770 $octet_offset = CORE::length(join '', @char[0..$offset-1]);
2771 }
2772 else {
2773 $octet_offset = -1 * CORE::length(join '', @char[$#char+$offset+1..$#char]);
2774 }
2775 if ($length == 0) {
2776 $octet_length = 0;
2777 }
2778 elsif ($length > 0) {
2779 $octet_length = CORE::length(join '', @char[$offset..$offset+$length-1]);
2780 }
2781 else {
2782 $octet_length = -1 * CORE::length(join '', @char[$#char+$length+1..$#char]);
2783 }
2784 CORE::substr($_[0], $octet_offset, $octet_length);
2785 }
2786  
2787 # substr($string,$offset)
2788 else {
2789 my $octet_offset = 0;
2790 if ($offset == 0) {
2791 $octet_offset = 0;
2792 }
2793 elsif ($offset > 0) {
2794 $octet_offset = CORE::length(join '', @char[0..$offset-1]);
2795 }
2796 else {
2797 $octet_offset = -1 * CORE::length(join '', @char[$#char+$offset+1..$#char]);
2798 }
2799 CORE::substr($_[0], $octet_offset);
2800 }
2801 }
2802 END
2803 }
2804  
2805 #
2806 # Windows-1258 index by character
2807 #
2808 0 ▶sub Windows1258::index($$;$) {
Subroutine index: not called CC=3 SCAR=24.8
2809  
2810 0 my $index;
2811 0 ▶ if (@_ == 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 3) { } 0 0 0
2812 0 $index = Ewindows1258::index($_[0], $_[1], CORE::length(Windows1258::substr($_[0], 0, $_[2])));
2813 }
2814 else {
2815 0 $index = Ewindows1258::index($_[0], $_[1]);
2816 }
2817  
2818 0 ▶ if ($index == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($index == -1) { } 0 0 0
2819 0 return -1;
2820 }
2821 else {
2822 0 return Windows1258::length(CORE::substr $_[0], 0, $index);
2823 }
2824 }
2825  
2826 #
2827 # Windows-1258 rindex by character
2828 #
2829 0 ▶sub Windows1258::rindex($$;$) {
Subroutine rindex: not called CC=3 SCAR=24.8
2830  
2831 0 my $rindex;
2832 0 ▶ if (@_ == 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 3) { } 0 0 0
2833 0 $rindex = Ewindows1258::rindex($_[0], $_[1], CORE::length(Windows1258::substr($_[0], 0, $_[2])));
2834 }
2835 else {
2836 0 $rindex = Ewindows1258::rindex($_[0], $_[1]);
2837 }
2838  
2839 0 ▶ if ($rindex == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rindex == -1) { } 0 0 0
2840 0 return -1;
2841 }
2842 else {
2843 0 return Windows1258::length(CORE::substr $_[0], 0, $rindex);
2844 }
2845 }
2846  
2847 # when 'm//', '/' means regexp match 'm//' and '?' means regexp match '??'
2848 # when 'div', '/' means division operator and '?' means conditional operator (condition ? then : else)
2849 422 ▶use vars qw($slash); $slash = 'm//';
Subroutine BEGIN: called CC=1 SCAR=0.0
2850  
2851 # ord() to ord() or Windows1258::ord()
2852 422 my $function_ord = 'ord';
2853  
2854 # ord to ord or Windows1258::ord_
2855 422 my $function_ord_ = 'ord';
2856  
2857 # reverse to reverse or Windows1258::reverse
2858 422 my $function_reverse = 'reverse';
2859  
2860 # getc to getc or Windows1258::getc
2861 422 my $function_getc = 'getc';
2862  
2863 # P.1023 Appendix W.9 Multibyte Anchoring
2864 # of ISBN 1-56592-224-7 CJKV Information Processing
2865  
2866 422 my $anchor = '';
2867  
2868 422 ▶use vars qw($nest);
Subroutine BEGIN: called CC=1 SCAR=0.0
2869  
2870 # regexp of nested parens in qqXX
2871  
2872 # P.340 Matching Nested Constructs with Embedded Code
2873 # in Chapter 7: Perl
2874 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
2875  
2876 my $qq_paren = qr{(?{local $nest=0}) (?>(?:
2877 [^\\()] |
2878 \( (?{$nest++}) |
2879 \) (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2880 \\ [^c] |
2881 \\c[\x40-\x5F] |
2882 [\x00-\xFF]
2883 422 }xms;
2884  
2885 my $qq_brace = qr{(?{local $nest=0}) (?>(?:
2886 [^\\{}] |
2887 \{ (?{$nest++}) |
2888 \} (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2889 \\ [^c] |
2890 \\c[\x40-\x5F] |
2891 [\x00-\xFF]
2892 422 }xms;
2893  
2894 my $qq_bracket = qr{(?{local $nest=0}) (?>(?:
2895 [^\\\[\]] |
2896 \[ (?{$nest++}) |
2897 \] (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2898 \\ [^c] |
2899 \\c[\x40-\x5F] |
2900 [\x00-\xFF]
2901 422 }xms;
2902  
2903 my $qq_angle = qr{(?{local $nest=0}) (?>(?:
2904 [^\\<>] |
2905 \< (?{$nest++}) |
2906 \> (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2907 \\ [^c] |
2908 \\c[\x40-\x5F] |
2909 [\x00-\xFF]
2910 422 }xms;
2911  
2912 422 my $qq_scalar = qr{(?: \{ (?:$qq_brace)*? \} |
2913 (?: ::)? (?:
2914 (?> [a-zA-Z_][a-zA-Z_0-9]* (?: ::[a-zA-Z_][a-zA-Z_0-9]*)* )
2915 (?>(?: \[ (?: \$\[ | \$\] | $qq_char )*? \] | \{ (?:$qq_brace)*? \} )*)
2916 (?>(?: (?: -> )? (?: [\$\@\%\&\*]\* | \$\#\* | [\@\%]? \[ (?: \$\[ | \$\] | $qq_char )*? \] | [\@\%\*]? \{ (?:$qq_brace)*? \} ) )*)
2917 ))
2918 }xms;
2919  
2920 422 my $qq_variable = qr{(?: \{ (?:$qq_brace)*? \} |
2921 (?: ::)? (?:
2922 (?>[0-9]+) |
2923 [^a-zA-Z_0-9\[\]] |
2924 ^[A-Z] |
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 422 my $qq_substr = qr{(?> Char::substr | Windows1258::substr | CORE::substr | substr ) (?>\s*) \( $qq_paren \)
2932 }xms;
2933  
2934 # regexp of nested parens in qXX
2935 my $q_paren = qr{(?{local $nest=0}) (?>(?:
2936 [^()] |
2937 \( (?{$nest++}) |
2938 \) (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2939 [\x00-\xFF]
2940 422 }xms;
2941  
2942 my $q_brace = qr{(?{local $nest=0}) (?>(?:
2943 [^\{\}] |
2944 \{ (?{$nest++}) |
2945 \} (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2946 [\x00-\xFF]
2947 422 }xms;
2948  
2949 my $q_bracket = qr{(?{local $nest=0}) (?>(?:
2950 [^\[\]] |
2951 \[ (?{$nest++}) |
2952 \] (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2953 [\x00-\xFF]
2954 422 }xms;
2955  
2956 my $q_angle = qr{(?{local $nest=0}) (?>(?:
2957 [^<>] |
2958 \< (?{$nest++}) |
2959 \> (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2960 [\x00-\xFF]
2961 422 }xms;
2962  
2963 422 my $matched = '';
2964 422 my $s_matched = '';
2965  
2966 422 my $tr_variable = ''; # variable of tr///
2967 422 my $sub_variable = ''; # variable of s///
2968 422 my $bind_operator = ''; # =~ or !~
2969  
2970 422 my @heredoc = (); # here document
2971 422 my @heredoc_delimiter = ();
2972 422 my $here_script = ''; # here script
2973  
2974 #
2975 # escape Windows-1258 script
2976 #
2977 547 ▶sub Windows1258::escape(;$) {
Subroutine escape: called CC=3 SCAR=11.0
2978 547 ▶ local($_) = $_[0] if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 292 255 547
2979  
2980 # P.359 The Study Function
2981 # in Chapter 7: Perl
2982 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
2983  
2984 547 study $_; # Yes, I studied study yesterday.
2985  
2986 # while all script
2987  
2988 # 6.14. Matching from Where the Last Pattern Left Off
2989 # in Chapter 6. Pattern Matching
2990 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2991 # (and so on)
2992  
2993 # one member of Tag-team
2994 #
2995 # P.128 Start of match (or end of previous match): \G
2996 # P.130 Advanced Use of \G with Perl
2997 # in Chapter 3: Overview of Regular Expression Features and Flavors
2998 # P.255 Use leading anchors
2999 # P.256 Expose ^ and \G at the front expressions
3000 # in Chapter 6: Crafting an Efficient Expression
3001 # P.315 "Tag-team" matching with /gc
3002 # in Chapter 7: Perl
3003 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3004  
3005 547 my $e_script = '';
3006 547 ▶ while (not /\G \z/oxgc) { # member
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 87120 547 87667
3007 87120 $e_script .= Windows1258::escape_token();
3008 }
3009  
3010 547 return $e_script;
3011 }
3012  
3013 #
3014 # escape Windows-1258 token of script
3015 #
3016 87120 ▶sub Windows1258::escape_token {
Subroutine escape_token: called CC=504 SCAR=109.3
3017  
3018 # \n output here document
3019  
3020 87120 my $ignore_modules = join('|', qw(
3021 utf8
3022 bytes
3023 charnames
3024 I18N::Japanese
3025 I18N::Collate
3026 I18N::JExt
3027 File::DosGlob
3028 Wild
3029 Wildcard
3030 Japanese
3031 ));
3032  
3033 # another member of Tag-team
3034 #
3035 # P.315 "Tag-team" matching with /gc
3036 # in Chapter 7: Perl
3037 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3038  
3039 87120 ▶ if (/\G ( \n ) /oxgc) { # another member (and so on)
Branch: 139 branches
BranchTrueFalseTotal
if (/\G ( \n ) /cgox) { } 12788 74332 87120
elsif (/\G ((?>\s+)|\#.*) /cgox) { } 21208 53124 74332
elsif (/\G ( (?: if | elsif | unless | while | until | given | when ) (?>\s*) \( ) /cgox) { } 1644 51480 53124
elsif (/\G ( \( (?>\s*) (?: local \b | my \b | our \b | state \b )? (?>\s*) \$ $qq_scalar ) /cgox) { } 90 51390 51480
elsif (/\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /cgmosx) { } 4 51386 51390
elsif (/\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /cgmosx) { } 28 51358 51386
elsif (/\G ( \$' | \$\{'\} ) /cgmosx) { } 1 51357 51358
elsif (/\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /cgmosx) { } 3 51354 51357
elsif (/\G ( \$ $qq_scalar | $qq_substr ) /cgox) { } 1752 49602 51354
elsif (/\G ( [,;] ) /cgox) { } 5047 44555 49602
elsif (/\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /cgmosx) { } 0 44555 44555
elsif (/\G ( \$ 0 ) /cgmosx) { } 2 44553 44555
elsif (/\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /cgmosx) { } 0 44553 44553
elsif (/\G ( \$ \$ ) (?![\w\{]) /cgmosx) { } 1 44552 44553
elsif (/\G \$ ((?>[1-9][0-9]*)) /cgmosx) { } 4 44548 44552
elsif (/\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /cgmosx) { } 0 44548 44548
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /cgmosx) { } 0 44548 44548
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /cgmosx) { } 0 44548 44548
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /cgmosx) { } 0 44548 44548
elsif (/\G \$ (?>\s*) \{ ( (?>\s*) (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* ) (?>\s*) ) \} /cgmosx) { } 0 44548 44548
elsif (/\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /cgmosx) { } 0 44548 44548
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 44506 44548
elsif (m{\G ( \$[\$\@\#\\\'\"/\?\(\)\[\]\<\>] ) }cgmosx) { } 63 44443 44506
elsif (/\G \b (while (?>\s*) \( (?>\s*) <[\$]?[A-Za-z_][A-Za-z_0-9]*> (?>\s*) \)) \b /cgox) { } 0 44443 44443
elsif (/\G \b while (?>\s*) \( (?>\s*) < ((?:[^>\0\a\e\f\n\r\t])+?) > (?>\s*) \) \b /cgox) { } 0 44443 44443
elsif (/\G \b while (?>\s*) \( (?>\s*) glob (?>\s*) \) /cgox) { } 0 44443 44443
elsif (/\G \b while (?>\s*) \( (?>\s*) glob \b /cgox) { } 0 44443 44443
elsif (/\G \b ( if | unless | while | until | for | when ) \b /cgox) { } 251 44192 44443
elsif (/\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /cgox) { } 19 44173 44192
elsif (/\G \b Char::eval (?= (?>\s*) \{ ) /cgox) { } 0 44173 44173
elsif (/\G \b Windows1258::eval (?= (?>\s*) \{ ) /cgox) { } 22 44151 44173
elsif (/\G \b Char::eval \b (?! (?>\s*) => ) /cgox) { } 0 44151 44151
elsif (/\G \b Windows1258::eval \b (?! (?>\s*) => ) /cgox) { } 168 43983 44151
elsif (/\G \b bytes::substr \b (?! (?>\s*) => ) /cgox) { } 2 43981 43983
elsif (/\G \b chop \b (?! (?>\s*) => ) /cgox) { } 0 43981 43981
elsif (/\G \b bytes::index \b (?! (?>\s*) => ) /cgox) { } 2 43979 43981
elsif (/\G \b Char::index \b (?! (?>\s*) => ) /cgox) { } 0 43979 43979
elsif (/\G \b Windows1258::index \b (?! (?>\s*) => ) /cgox) { } 0 43979 43979
elsif (/\G \b index \b (?! (?>\s*) => ) /cgox) { } 0 43979 43979
elsif (/\G \b bytes::rindex \b (?! (?>\s*) => ) /cgox) { } 2 43977 43979
elsif (/\G \b Char::rindex \b (?! (?>\s*) => ) /cgox) { } 0 43977 43977
elsif (/\G \b Windows1258::rindex \b (?! (?>\s*) => ) /cgox) { } 0 43977 43977
elsif (/\G \b rindex \b (?! (?>\s*) => ) /cgox) { } 0 43977 43977
elsif (/\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 1 43976 43977
elsif (/\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43976 43976
elsif (/\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 1 43975 43976
elsif (/\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43975 43975
elsif (/\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 6 43969 43975
elsif (/\G -s (?>\s*) (\") ((?:$Ewindows1258::qq_char)+?) (\") /cgox) { } 0 43969 43969
elsif (/\G -s (?>\s+) qq (?>\s*) (\#) ((?:$Ewindows1258::qq_char)+?) (\#) /cgox) { } 0 43969 43969
elsif (/\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /cgox) { } 0 43969 43969
elsif (/\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /cgox) { } 0 43969 43969
elsif (/\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /cgox) { } 0 43969 43969
elsif (/\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /cgox) { } 0 43969 43969
elsif (/\G -s (?>\s+) qq (?>\s*) (\S) ((?:$Ewindows1258::qq_char)+?) (\1) /cgox) { } 0 43969 43969
elsif (/\G -s (?>\s*) (\') ((?:\\\'|\\\\|$Ewindows1258::q_char)+?) (\') /cgox) { } 0 43969 43969
elsif (/\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$Ewindows1258::q_char)+?) (\#) /cgox) { } 0 43969 43969
elsif (/\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /cgox) { } 0 43969 43969
elsif (/\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /cgox) { } 0 43969 43969
elsif (/\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /cgox) { } 0 43969 43969
elsif (/\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /cgox) { } 0 43969 43969
elsif (/\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$Ewindows1258::q_char)+?) (\1) /cgox) { } 0 43969 43969
elsif (/\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)* ) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ) )*) /cgox) { } 0 43969 43969
elsif (/\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /cgox) { } 0 43969 43969
elsif (/\G -s (?= (?>\s+) [a-z]+) /cgox) { } 0 43969 43969
elsif (/\G -s (?>\s+) ((?>\w+)) /cgox) { } 0 43969 43969
elsif (/\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43967 43969
elsif (/\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43965 43967
elsif (/\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 36 43929 43965
elsif (/\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43927 43929
elsif (/\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 8 43919 43927
elsif (/\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43919 43919
elsif (/\G \b lc \b (?! (?>\s*) => ) /cgox) { } 0 43919 43919
elsif (/\G \b lcfirst \b (?! (?>\s*) => ) /cgox) { } 0 43919 43919
elsif (/\G \b uc \b (?! (?>\s*) => ) /cgox) { } 0 43919 43919
elsif (/\G \b ucfirst \b (?! (?>\s*) => ) /cgox) { } 0 43919 43919
elsif (/\G \b fc \b (?! (?>\s*) => ) /cgox) { } 0 43919 43919
elsif (/\G -s \b (?! (?>\s*) => ) /cgox) { } 0 43919 43919
elsif (/\G \b bytes::length \b (?! (?>\s*) => ) /cgox) { } 0 43919 43919
elsif (/\G \b bytes::chr \b (?! (?>\s*) => ) /cgox) { } 0 43919 43919
elsif (/\G \b chr \b (?! (?>\s*) => ) /cgox) { } 0 43919 43919
elsif (/\G \b bytes::ord \b (?! (?>\s*) => ) /cgox) { } 0 43919 43919
elsif (/\G \b ord \b (?! (?>\s*) => ) /cgox) { } 0 43919 43919
elsif (/\G \b glob \b (?! (?>\s*) => ) /cgox) { } 0 43919 43919
elsif (/\G \b reverse \b (?! (?>\s*) => ) /cgox) { } 0 43919 43919
elsif (/\G \b getc \b (?! (?>\s*) => ) /cgox) { } 8 43911 43919
elsif (/\G \b (split) \b (?! (?>\s*) => ) /cgox) { } 87 43824 43911
elsif (/\G \b ( tr | y ) \b /cgox) { } 4 43820 43824
elsif (/\G \b (qq) \b /cgox) { } 2252 41568 43820
elsif (/\G \b (qr) \b /cgox) { } 0 41568 41568
elsif (/\G \b (qw) \b /cgox) { } 16 41552 41568
elsif (/\G \b (qx) \b /cgox) { } 0 41552 41552
elsif (/\G \b (q) \b /cgox) { } 473 41079 41552
elsif (/\G \b (m) \b /cgox) { } 209 40870 41079
elsif (/\G \b (s) \b /cgox) { } 101 40769 40870
elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 0 40769 40769
elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 40769 40769
elsif (/\G \b require ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 40769 40769
elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [#\n]) /cgmosx) { } 37 40732 40769
elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 40732 40732
elsif (/\G \b use ((?>\s+) strict) \b /cgmosx) { } 0 40732 40732
elsif (/\G \b use (?>\s+) ((?>([1-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /cgmosx) { } 2 40730 40732
elsif (/\G \b use (?>\s+) ((?>v([0-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /cgmosx) { } 0 40730 40730
elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 2 40728 40730
elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 40728 40728
elsif (/\G \b use ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 40728 40728
elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 0 40728 40728
elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 40728 40728
elsif (/\G \b no ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 40728 40728
elsif (/\G \b use \b /cgmosx) { } 0 40728 40728
elsif (/\G \b no \b /cgmosx) { } 2 40726 40728
elsif (/\G (?<![\w\$\@\%\&\*]) (\') /cgox) { } 1142 39584 40726
elsif (/\G (\") /cgox) { } 1851 37733 39584
elsif (/\G (\`) /cgox) { } 1 37732 37733
elsif ($Ewindows1258::slash eq 'm//' and m[\G (/) ]cgox) { } 681 37051 37732
elsif ($Ewindows1258::slash eq 'm//' and /\G (\?) /cgox) { } 0 37051 37051
elsif (/\G ( <<>> ) /cgox) { } 0 37051 37051
elsif (/\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /cgox) { } 0 37051 37051
elsif (/\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /cgox) { } 6 37045 37051
elsif (/\G ( <<~ \\([a-zA-Z_0-9]+) ) /cgox) { } 3 37042 37045
elsif (/\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /cgox) { } 6 37036 37042
elsif (/\G ( <<~ ([a-zA-Z_0-9]+) ) /cgox) { } 3 37033 37036
elsif (/\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /cgox) { } 6 37027 37033
elsif (/\G ( << '([a-zA-Z_0-9]*)' ) /cgox) { } 72 36955 37027
elsif (/\G ( << \\([a-zA-Z_0-9]+) ) /cgox) { } 0 36955 36955
elsif (/\G ( << "([a-zA-Z_0-9]*)" ) /cgox) { } 36 36919 36955
elsif (/\G ( << ([a-zA-Z_0-9]+) ) /cgox) { } 42 36877 36919
elsif (/\G ( << `([a-zA-Z_0-9]*)` ) /cgox) { } 0 36877 36877
elsif (/\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/cgox) { } 12 36865 36877
elsif (/\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /cgox) { } 0 36865 36865
elsif (/\G < ((?:[^>\0\a\e\f\n\r\t])+?) > /cgox) { } 0 36865 36865
elsif (/\G ^ ( __DATA__ \n .*) \z /cgmosx) { } 0 36865 36865
elsif (/\G ^ ( __END__ \n .*) \z /cgmosx) { } 210 36655 36865
elsif (/\G ( \cD .*) \z /cgmosx) { } 0 36655 36655
elsif (/\G ( \cZ .*) \z /cgmosx) { } 0 36655 36655
elsif (/\G ( -- | \+\+ | [\)\}\]] ) /cgox) { } 5837 30818 36655
elsif (/\G ( \.\.\. ) /cgox) { } 7 30811 30818
elsif (m"\G ((?> !~~ | !~ | != | ! | %= | % | &&= | && | &= | &\.= | &\. | & | -= | -> | - | :(?>\s*)= | : | <<>> | <<= | <=> | <= | < | == | => | =~ | = | >>= | >> | >= | > | \*\*= | \*\* | \*= | \* | \+= | \+ | \.\. | \.= | \. | //= | // | /= | / | \? | \\ | \^= | \^\.= | \^\. | \^ | \b x= | \|\|= | \|\| | \|= | \|\.= | \|\. | \| | ~~ | ~\. | ~ | \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b | \b(?: print )\b | [,;\(\{\[] )) "cgox) { } 9755 21056 30811
elsif (/\G ($Ewindows1258::q_char) /cgox) { } 21056 0 21056
3040 12788 my $heredoc = '';
3041 12788 ▶ if (scalar(@heredoc_delimiter) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @heredoc_delimiter >= 1) 174 12614 12788
3042 174 $slash = 'm//';
3043  
3044 174 $heredoc = join '', @heredoc;
3045 174 @heredoc = ();
3046  
3047 # skip here document
3048 174 for my $heredoc_delimiter (@heredoc_delimiter) {
3049 174 /\G .*? \n $heredoc_delimiter \n/xmsgc;
3050 }
3051 174 @heredoc_delimiter = ();
3052  
3053 174 $here_script = '';
3054 }
3055 12788 return "\n" . $heredoc;
3056 }
3057  
3058 # ignore space, comment
3059 21208 elsif (/\G ((?>\s+)|\#.*) /oxgc) { return $1; }
3060  
3061 # if (, elsif (, unless (, while (, until (, given (, and when (
3062  
3063 # given, when
3064  
3065 # P.225 The given Statement
3066 # in Chapter 15: Smart Matching and given-when
3067 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
3068  
3069 # P.133 The given Statement
3070 # in Chapter 4: Statements and Declarations
3071 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
3072  
3073 elsif (/\G ( (?: if | elsif | unless | while | until | given | when ) (?>\s*) \( ) /oxgc) {
3074 1644 $slash = 'm//';
3075 1644 return $1;
3076 }
3077  
3078 # scalar variable ($scalar = ...) =~ tr///;
3079 # scalar variable ($scalar = ...) =~ s///;
3080  
3081 # state
3082  
3083 # P.68 Persistent, Private Variables
3084 # in Chapter 4: Subroutines
3085 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
3086  
3087 # P.160 Persistent Lexically Scoped Variables: state
3088 # in Chapter 4: Statements and Declarations
3089 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
3090  
3091 # (and so on)
3092  
3093 elsif (/\G ( \( (?>\s*) (?: local \b | my \b | our \b | state \b )? (?>\s*) \$ $qq_scalar ) /oxgc) {
3094 90 my $e_string = e_string($1);
3095  
3096 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
3097 0 $tr_variable = $e_string . e_string($1);
3098 0 $bind_operator = $2;
3099 0 $slash = 'm//';
3100 0 return '';
3101 }
3102 elsif (/\G ( (?>\s*) = $qq_paren \) ) ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /oxgc) {
3103 0 $sub_variable = $e_string . e_string($1);
3104 0 $bind_operator = $2;
3105 0 $slash = 'm//';
3106 0 return '';
3107 }
3108 else {
3109 90 $slash = 'div';
3110 90 return $e_string;
3111 }
3112 }
3113  
3114 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Ewindows1258::PREMATCH()
3115 elsif (/\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /oxmsgc) {
3116 4 $slash = 'div';
3117 4 return q{Ewindows1258::PREMATCH()};
3118 }
3119  
3120 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Ewindows1258::MATCH()
3121 elsif (/\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /oxmsgc) {
3122 28 $slash = 'div';
3123 28 return q{Ewindows1258::MATCH()};
3124 }
3125  
3126 # $', ${'} --> $', ${'}
3127 elsif (/\G ( \$' | \$\{'\} ) /oxmsgc) {
3128 1 $slash = 'div';
3129 1 return $1;
3130 }
3131  
3132 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Ewindows1258::POSTMATCH()
3133 elsif (/\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /oxmsgc) {
3134 3 $slash = 'div';
3135 3 return q{Ewindows1258::POSTMATCH()};
3136 }
3137  
3138 # scalar variable $scalar =~ tr///;
3139 # scalar variable $scalar =~ s///;
3140 # substr() =~ tr///;
3141 # substr() =~ s///;
3142 elsif (/\G ( \$ $qq_scalar | $qq_substr ) /oxgc) {
3143 1752 my $scalar = e_string($1);
3144  
3145 1752 ▶ if (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= (?: tr | y ) \b ) /oxgc) {
Branch: 2 branches
BranchTrueFalseTotal
if (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= (?: tr | y ) \b ) /cgox) { } 2 1750 1752
elsif (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /cgox) { } 65 1685 1750
3146 2 $tr_variable = $scalar;
3147 2 $bind_operator = $1;
3148 2 $slash = 'm//';
3149 2 return '';
3150 }
3151 elsif (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /oxgc) {
3152 65 $sub_variable = $scalar;
3153 65 $bind_operator = $1;
3154 65 $slash = 'm//';
3155 65 return '';
3156 }
3157 else {
3158 1685 $slash = 'div';
3159 1685 return $scalar;
3160 }
3161 }
3162  
3163 # end of statement
3164 elsif (/\G ( [,;] ) /oxgc) {
3165 5047 $slash = 'm//';
3166  
3167 # clear tr/// variable
3168 5047 $tr_variable = '';
3169  
3170 # clear s/// variable
3171 5047 $sub_variable = '';
3172  
3173 5047 $bind_operator = '';
3174  
3175 5047 return $1;
3176 }
3177  
3178 # bareword
3179 elsif (/\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /oxmsgc) {
3180 0 return $1;
3181 }
3182  
3183 # $0 --> $0
3184 elsif (/\G ( \$ 0 ) /oxmsgc) {
3185 2 $slash = 'div';
3186 2 return $1;
3187 }
3188 elsif (/\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /oxmsgc) {
3189 0 $slash = 'div';
3190 0 return $1;
3191 }
3192  
3193 # $$ --> $$
3194 elsif (/\G ( \$ \$ ) (?![\w\{]) /oxmsgc) {
3195 1 $slash = 'div';
3196 1 return $1;
3197 }
3198  
3199 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
3200 # $1, $2, $3 --> $1, $2, $3 otherwise
3201 elsif (/\G \$ ((?>[1-9][0-9]*)) /oxmsgc) {
3202 4 $slash = 'div';
3203 4 return e_capture($1);
3204 }
3205 elsif (/\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /oxmsgc) {
3206 0 $slash = 'div';
3207 0 return e_capture($1);
3208 }
3209  
3210 # $$foo[ ... ] --> $ $foo->[ ... ]
3211 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /oxmsgc) {
3212 0 $slash = 'div';
3213 0 return e_capture($1.'->'.$2);
3214 }
3215  
3216 # $$foo{ ... } --> $ $foo->{ ... }
3217 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /oxmsgc) {
3218 0 $slash = 'div';
3219 0 return e_capture($1.'->'.$2);
3220 }
3221  
3222 # $$foo
3223 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /oxmsgc) {
3224 0 $slash = 'div';
3225 0 return e_capture($1);
3226 }
3227  
3228 # ${ foo }
3229 elsif (/\G \$ (?>\s*) \{ ( (?>\s*) (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* ) (?>\s*) ) \} /oxmsgc) {
3230 0 $slash = 'div';
3231 0 return '${' . $1 . '}';
3232 }
3233  
3234 # ${ ... }
3235 elsif (/\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /oxmsgc) {
3236 0 $slash = 'div';
3237 0 return e_capture($1);
3238 }
3239  
3240 # variable or function
3241 # $ @ % & * $ #
3242 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) {
3243 42 $slash = 'div';
3244 42 return $1;
3245 }
3246 # $ $ $ $ $ $ $ $ $ $ $ $ $ $
3247 # $ @ # \ ' " / ? ( ) [ ] < >
3248 elsif (/\G ( \$[\$\@\#\\\'\"\/\?\(\)\[\]\<\>] ) /oxmsgc) {
3249 63 $slash = 'div';
3250 63 return $1;
3251 }
3252  
3253 # while (<FILEHANDLE>)
3254 elsif (/\G \b (while (?>\s*) \( (?>\s*) <[\$]?[A-Za-z_][A-Za-z_0-9]*> (?>\s*) \)) \b /oxgc) {
3255 0 return $1;
3256 }
3257  
3258 # while (<WILDCARD>) --- glob
3259  
3260 # avoid "Error: Runtime exception" of perl version 5.005_03
3261  
3262 elsif (/\G \b while (?>\s*) \( (?>\s*) < ((?:[^>\0\a\e\f\n\r\t])+?) > (?>\s*) \) \b /oxgc) {
3263 0 return 'while ($_ = Ewindows1258::glob("' . $1 . '"))';
3264 }
3265  
3266 # while (glob)
3267 elsif (/\G \b while (?>\s*) \( (?>\s*) glob (?>\s*) \) /oxgc) {
3268 0 return 'while ($_ = Ewindows1258::glob_)';
3269 }
3270  
3271 # while (glob(WILDCARD))
3272 elsif (/\G \b while (?>\s*) \( (?>\s*) glob \b /oxgc) {
3273 0 return 'while ($_ = Ewindows1258::glob';
3274 }
3275  
3276 # doit if, doit unless, doit while, doit until, doit for, doit when
3277 251 elsif (/\G \b ( if | unless | while | until | for | when ) \b /oxgc) { $slash = 'm//'; return $1; }
3278  
3279 # subroutines of package Ewindows1258
3280 19 elsif (/\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /oxgc) { $slash = 'm//'; return $1; }
3281 0 elsif (/\G \b Char::eval (?= (?>\s*) \{ ) /oxgc) { $slash = 'm//'; return 'eval'; }
3282 22 elsif (/\G \b Windows1258::eval (?= (?>\s*) \{ ) /oxgc) { $slash = 'm//'; return 'eval'; }
3283 0 elsif (/\G \b Char::eval \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'eval Char::escape'; }
3284 168 elsif (/\G \b Windows1258::eval \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'eval Windows1258::escape'; }
3285 2 elsif (/\G \b bytes::substr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'substr'; }
3286 0 elsif (/\G \b chop \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ewindows1258::chop'; }
3287 2 elsif (/\G \b bytes::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'index'; }
3288 0 elsif (/\G \b Char::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Char::index'; }
3289 0 elsif (/\G \b Windows1258::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Windows1258::index'; }
3290 0 elsif (/\G \b index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ewindows1258::index'; }
3291 2 elsif (/\G \b bytes::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'rindex'; }
3292 0 elsif (/\G \b Char::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Char::rindex'; }
3293 0 elsif (/\G \b Windows1258::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Windows1258::rindex'; }
3294 0 elsif (/\G \b rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ewindows1258::rindex'; }
3295 1 elsif (/\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Ewindows1258::lc'; }
3296 0 elsif (/\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Ewindows1258::lcfirst'; }
3297 1 elsif (/\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Ewindows1258::uc'; }
3298 0 elsif (/\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Ewindows1258::ucfirst'; }
3299 6 elsif (/\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Ewindows1258::fc'; }
3300  
3301 # "-s '' ..." means file test "-s 'filename' ..." (not means "- s/// ...")
3302 0 elsif (/\G -s (?>\s*) (\") ((?:$qq_char)+?) (\") /oxgc) { $slash = 'm//'; return '-s ' . e_qq('', $1,$3,$2); }
3303 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\#) ((?:$qq_char)+?) (\#) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3304 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3305 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3306 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3307 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3308 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\S) ((?:$qq_char)+?) (\1) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3309  
3310 0 elsif (/\G -s (?>\s*) (\') ((?:\\\'|\\\\|$q_char)+?) (\') /oxgc) { $slash = 'm//'; return '-s ' . e_q ('', $1,$3,$2); }
3311 0 elsif (/\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$q_char)+?) (\#) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3312 0 elsif (/\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3313 0 elsif (/\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3314 0 elsif (/\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3315 0 elsif (/\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3316 0 elsif (/\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$q_char)+?) (\1) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3317  
3318 elsif (/\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)* ) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ) )*) /oxgc)
3319 0 { $slash = 'm//'; return "-s $1"; }
3320 0 elsif (/\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /oxgc) { $slash = 'm//'; return "-s ($1)"; }
3321 0 elsif (/\G -s (?= (?>\s+) [a-z]+) /oxgc) { $slash = 'm//'; return '-s'; }
3322 0 elsif (/\G -s (?>\s+) ((?>\w+)) /oxgc) { $slash = 'm//'; return "-s $1"; }
3323  
3324 2 elsif (/\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'length'; }
3325 2 elsif (/\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'chr'; }
3326 36 elsif (/\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Ewindows1258::chr'; }
3327 2 elsif (/\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'div'; return 'ord'; }
3328 8 elsif (/\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'div'; return $function_ord; }
3329 0 elsif (/\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Ewindows1258::glob'; }
3330 0 elsif (/\G \b lc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ewindows1258::lc_'; }
3331 0 elsif (/\G \b lcfirst \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ewindows1258::lcfirst_'; }
3332 0 elsif (/\G \b uc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ewindows1258::uc_'; }
3333 0 elsif (/\G \b ucfirst \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ewindows1258::ucfirst_'; }
3334 0 elsif (/\G \b fc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ewindows1258::fc_'; }
3335 0 elsif (/\G -s \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return '-s '; }
3336  
3337 0 elsif (/\G \b bytes::length \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'length'; }
3338 0 elsif (/\G \b bytes::chr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'chr'; }
3339 0 elsif (/\G \b chr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ewindows1258::chr_'; }
3340 0 elsif (/\G \b bytes::ord \b (?! (?>\s*) => ) /oxgc) { $slash = 'div'; return 'ord'; }
3341 0 elsif (/\G \b ord \b (?! (?>\s*) => ) /oxgc) { $slash = 'div'; return $function_ord_; }
3342 0 elsif (/\G \b glob \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ewindows1258::glob_'; }
3343 0 elsif (/\G \b reverse \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return $function_reverse; }
3344 8 elsif (/\G \b getc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return $function_getc; }
3345 # split
3346 elsif (/\G \b (split) \b (?! (?>\s*) => ) /oxgc) {
3347 87 $slash = 'm//';
3348  
3349 87 my $e = '';
3350 87 ▶ while (/\G ( (?>\s+) | \( | \#.* ) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\G ( (?>\s+) | \( | \#.* ) /cgox) 85 87 172
3351 85 $e .= $1;
3352 }
3353  
3354 # end of split
3355 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
3356  
3357 # split scalar value
3358 1 elsif (/\G ( [\$\@\&\*] $qq_scalar ) /oxgc) { return 'Ewindows1258::split' . $e . e_string($1); }
3359  
3360 # split literal space
3361 0 elsif (/\G \b qq (\#) [ ] (\#) /oxgc) { return 'Ewindows1258::split' . $e . qq {qq$1 $2}; }
3362 0 elsif (/\G \b qq ((?>\s*)) (\() [ ] (\)) /oxgc) { return 'Ewindows1258::split' . $e . qq{$1qq$2 $3}; }
3363 0 elsif (/\G \b qq ((?>\s*)) (\{) [ ] (\}) /oxgc) { return 'Ewindows1258::split' . $e . qq{$1qq$2 $3}; }
3364 0 elsif (/\G \b qq ((?>\s*)) (\[) [ ] (\]) /oxgc) { return 'Ewindows1258::split' . $e . qq{$1qq$2 $3}; }
3365 0 elsif (/\G \b qq ((?>\s*)) (\<) [ ] (\>) /oxgc) { return 'Ewindows1258::split' . $e . qq{$1qq$2 $3}; }
3366 0 elsif (/\G \b qq ((?>\s*)) (\S) [ ] (\2) /oxgc) { return 'Ewindows1258::split' . $e . qq{$1qq$2 $3}; }
3367 0 elsif (/\G \b q (\#) [ ] (\#) /oxgc) { return 'Ewindows1258::split' . $e . qq {q$1 $2}; }
3368 0 elsif (/\G \b q ((?>\s*)) (\() [ ] (\)) /oxgc) { return 'Ewindows1258::split' . $e . qq {$1q$2 $3}; }
3369 0 elsif (/\G \b q ((?>\s*)) (\{) [ ] (\}) /oxgc) { return 'Ewindows1258::split' . $e . qq {$1q$2 $3}; }
3370 0 elsif (/\G \b q ((?>\s*)) (\[) [ ] (\]) /oxgc) { return 'Ewindows1258::split' . $e . qq {$1q$2 $3}; }
3371 0 elsif (/\G \b q ((?>\s*)) (\<) [ ] (\>) /oxgc) { return 'Ewindows1258::split' . $e . qq {$1q$2 $3}; }
3372 0 elsif (/\G \b q ((?>\s*)) (\S) [ ] (\2) /oxgc) { return 'Ewindows1258::split' . $e . qq {$1q$2 $3}; }
3373 10 elsif (/\G ' [ ] ' /oxgc) { return 'Ewindows1258::split' . $e . qq {' '}; }
3374 0 elsif (/\G " [ ] " /oxgc) { return 'Ewindows1258::split' . $e . qq {" "}; }
3375  
3376 # split qq//
3377 elsif (/\G \b (qq) \b /oxgc) {
3378 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
3379 else {
3380 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3381 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
3382 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq ( ) --> qr ( )
3383 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq { } --> qr { }
3384 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq [ ] --> qr [ ]
3385 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq < > --> qr < >
3386 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) /oxgc) { return e_split($e.'qr','{','}',$2,''); } # qq | | --> qr { }
3387 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq * * --> qr * *
3388 }
3389 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3390 }
3391 }
3392  
3393 # split qr//
3394 elsif (/\G \b (qr) \b /oxgc) {
3395 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
3396 else {
3397 12 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 12 0 12
3398 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
3399 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr ( )
3400 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr { }
3401 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr [ ]
3402 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr < >
3403 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { return e_split_q($e.'qr',$1, $3, $2,$4); } # qr ' '
3404 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr','{','}',$2,$4); } # qr | | --> qr { }
3405 12 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr * *
3406 }
3407 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3408 }
3409 }
3410  
3411 # split q//
3412 elsif (/\G \b (q) \b /oxgc) {
3413 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
3414 else {
3415 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3416 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
3417 0 elsif (/\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q ( ) --> qr ( )
3418 0 elsif (/\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q { } --> qr { }
3419 0 elsif (/\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q [ ] --> qr [ ]
3420 0 elsif (/\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q < > --> qr < >
3421 0 elsif (/\G ([*\-:?\\^|]) ((?:$q_char)*?) (\1) /oxgc) { return e_split_q($e.'qr','{','}',$2,''); } # q | | --> qr { }
3422 0 elsif (/\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q * * --> qr * *
3423 }
3424 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3425 }
3426 }
3427  
3428 # split m//
3429 elsif (/\G \b (m) \b /oxgc) {
3430 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
3431 else {
3432 18 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 18 0 18
3433 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
3434 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m ( ) --> qr ( )
3435 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m { } --> qr { }
3436 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m [ ] --> qr [ ]
3437 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m < > --> qr < >
3438 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { return e_split_q($e.'qr',$1, $3, $2,$4); } # m ' ' --> qr ' '
3439 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr','{','}',$2,$4); } # m | | --> qr { }
3440 18 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m * * --> qr * *
3441 }
3442 0 die __FILE__, ": Search pattern not terminated\n";
3443 }
3444 }
3445  
3446 # split ''
3447 elsif (/\G (\') /oxgc) {
3448 0 my $q_string = '';
3449 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3450 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
3451 0 elsif (/\G (\\\') /oxgc) { $q_string .= $1; } # splitqr'' --> split qr''
3452 0 elsif (/\G \' /oxgc) { return e_split_q($e.q{ qr},"'","'",$q_string,''); } # ' ' --> qr ' '
3453 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3454 }
3455 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3456 }
3457  
3458 # split ""
3459 elsif (/\G (\") /oxgc) {
3460 0 my $qq_string = '';
3461 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3462 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
3463 0 elsif (/\G (\\\") /oxgc) { $qq_string .= $1; } # splitqr"" --> split qr""
3464 0 elsif (/\G \" /oxgc) { return e_split($e.q{ qr},'"','"',$qq_string,''); } # " " --> qr " "
3465 0 elsif (/\G ($q_char) /oxgc) { $qq_string .= $1; }
3466 }
3467 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3468 }
3469  
3470 # split //
3471 elsif (/\G (\/) /oxgc) {
3472 44 my $regexp = '';
3473 44 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 381 0 381
3474 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
3475 0 elsif (/\G (\\\/) /oxgc) { $regexp .= $1; } # splitqr// --> split qr//
3476 44 elsif (/\G \/ ([cgimosxpadlunbB]*) /oxgc) { return e_split($e.q{ qr}, '/','/',$regexp,$1); } # / / --> qr / /
3477 337 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
3478 }
3479 0 die __FILE__, ": Search pattern not terminated\n";
3480 }
3481 }
3482  
3483 # tr/// or y///
3484  
3485 # about [cdsrbB]* (/B modifier)
3486 #
3487 # P.559 appendix C
3488 # of ISBN 4-89052-384-7 Programming perl
3489 # (Japanese title is: Perl puroguramingu)
3490  
3491 elsif (/\G \b ( tr | y ) \b /oxgc) {
3492 4 my $ope = $1;
3493  
3494 # $1 $2 $3 $4 $5 $6
3495 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
3496 0 my @tr = ($tr_variable,$2);
3497 0 return e_tr(@tr,'',$4,$6);
3498 }
3499 else {
3500 4 my $e = '';
3501 4 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 4 0 4
3502 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
3503 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) {
3504 0 my @tr = ($tr_variable,$2);
3505 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3506 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
3507 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) ( )
3508 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) { }
3509 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) [ ]
3510 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) < >
3511 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) * *
3512 }
3513 0 die __FILE__, ": Transliteration replacement not terminated\n";
3514 }
3515 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) {
3516 0 my @tr = ($tr_variable,$2);
3517 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3518 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
3519 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } ( )
3520 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } { }
3521 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } [ ]
3522 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } < >
3523 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } * *
3524 }
3525 0 die __FILE__, ": Transliteration replacement not terminated\n";
3526 }
3527 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) {
3528 0 my @tr = ($tr_variable,$2);
3529 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3530 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
3531 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] ( )
3532 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] { }
3533 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] [ ]
3534 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] < >
3535 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] * *
3536 }
3537 0 die __FILE__, ": Transliteration replacement not terminated\n";
3538 }
3539 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) {
3540 0 my @tr = ($tr_variable,$2);
3541 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3542 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
3543 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > ( )
3544 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > { }
3545 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > [ ]
3546 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > < >
3547 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > * *
3548 }
3549 0 die __FILE__, ": Transliteration replacement not terminated\n";
3550 }
3551 # $1 $2 $3 $4 $5 $6
3552 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { # tr * * *
3553 4 my @tr = ($tr_variable,$2);
3554 4 return e_tr(@tr,'',$4,$6);
3555 }
3556 }
3557 0 die __FILE__, ": Transliteration pattern not terminated\n";
3558 }
3559 }
3560  
3561 # qq//
3562 elsif (/\G \b (qq) \b /oxgc) {
3563 2252 my $ope = $1;
3564  
3565 # if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { return e_qq($ope,$1,$3,$2); } # qq# #
3566 2252 ▶ if (/\G (\#) /oxgc) { # qq# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) /cgox) { } 0 2252 2252
3567 0 my $qq_string = '';
3568 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3569 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
3570 0 elsif (/\G (\\\#) /oxgc) { $qq_string .= $1; }
3571 0 elsif (/\G (\#) /oxgc) { return e_qq($ope,'#','#',$qq_string); }
3572 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3573 }
3574 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3575 }
3576  
3577 else {
3578 2252 my $e = '';
3579 2252 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 2252 0 2252
3580 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
3581  
3582 # elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq ( )
3583 elsif (/\G (\() /oxgc) { # qq ( )
3584 0 my $qq_string = '';
3585 0 local $nest = 1;
3586 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3587 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
3588 0 elsif (/\G (\\\)) /oxgc) { $qq_string .= $1; }
3589 0 elsif (/\G (\() /oxgc) { $qq_string .= $1; $nest++; }
3590 elsif (/\G (\)) /oxgc) {
3591 0 ▶ if (--$nest == 0) { return $e . e_qq($ope,'(',')',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ewindows1258::nest == 0) { } 0 0 0
3592 0 else { $qq_string .= $1; }
3593 }
3594 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3595 }
3596 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3597 }
3598  
3599 # elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq { }
3600 elsif (/\G (\{) /oxgc) { # qq { }
3601 2222 my $qq_string = '';
3602 2222 local $nest = 1;
3603 2222 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 85169 0 85169
3604 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
3605 0 elsif (/\G (\\\}) /oxgc) { $qq_string .= $1; }
3606 1189 elsif (/\G (\{) /oxgc) { $qq_string .= $1; $nest++; }
3607 elsif (/\G (\}) /oxgc) {
3608 3411 ▶ if (--$nest == 0) { return $e . e_qq($ope,'{','}',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ewindows1258::nest == 0) { } 2222 1189 3411
3609 1189 else { $qq_string .= $1; }
3610 }
3611 79847 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3612 }
3613 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3614 }
3615  
3616 # elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq [ ]
3617 elsif (/\G (\[) /oxgc) { # qq [ ]
3618 0 my $qq_string = '';
3619 0 local $nest = 1;
3620 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3621 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
3622 0 elsif (/\G (\\\]) /oxgc) { $qq_string .= $1; }
3623 0 elsif (/\G (\[) /oxgc) { $qq_string .= $1; $nest++; }
3624 elsif (/\G (\]) /oxgc) {
3625 0 ▶ if (--$nest == 0) { return $e . e_qq($ope,'[',']',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ewindows1258::nest == 0) { } 0 0 0
3626 0 else { $qq_string .= $1; }
3627 }
3628 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3629 }
3630 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3631 }
3632  
3633 # elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq < >
3634 elsif (/\G (\<) /oxgc) { # qq < >
3635 30 my $qq_string = '';
3636 30 local $nest = 1;
3637 30 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 1166 0 1166
3638 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
3639 0 elsif (/\G (\\\>) /oxgc) { $qq_string .= $1; }
3640 0 elsif (/\G (\<) /oxgc) { $qq_string .= $1; $nest++; }
3641 elsif (/\G (\>) /oxgc) {
3642 30 ▶ if (--$nest == 0) { return $e . e_qq($ope,'<','>',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ewindows1258::nest == 0) { } 30 0 30
3643 0 else { $qq_string .= $1; }
3644 }
3645 1114 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3646 }
3647 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3648 }
3649  
3650 # elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq * *
3651 elsif (/\G (\S) /oxgc) { # qq * *
3652 0 my $delimiter = $1;
3653 0 my $qq_string = '';
3654 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3655 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
3656 0 elsif (/\G (\\\Q$delimiter\E) /oxgc) { $qq_string .= $1; }
3657 0 elsif (/\G (\Q$delimiter\E) /oxgc) { return $e . e_qq($ope,$delimiter,$delimiter,$qq_string); }
3658 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3659 }
3660 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3661 }
3662 }
3663 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3664 }
3665 }
3666  
3667 # qr//
3668 elsif (/\G \b (qr) \b /oxgc) {
3669 0 my $ope = $1;
3670 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { # qr# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Ewindows1258::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 0 0
3671 0 return e_qr($ope,$1,$3,$2,$4);
3672 }
3673 else {
3674 0 my $e = '';
3675 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3676 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
3677 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr ( )
3678 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr { }
3679 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr [ ]
3680 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr < >
3681 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { return $e . e_qr_q($ope,$1, $3, $2,$4); } # qr ' '
3682 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,'{','}',$2,$4); } # qr | | --> qr { }
3683 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr * *
3684 }
3685 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3686 }
3687 }
3688  
3689 # qw//
3690 elsif (/\G \b (qw) \b /oxgc) {
3691 16 my $ope = $1;
3692 16 ▶ if (/\G (\#) (.*?) (\#) /oxmsgc) { # qw# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) (.*?) (\#) /cgmosx) { } 0 16 16
3693 0 return e_qw($ope,$1,$3,$2);
3694 }
3695 else {
3696 16 my $e = '';
3697 16 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 16 0 16
3698 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
3699  
3700 16 elsif (/\G (\() ([^(]*?) (\)) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw ( )
3701 0 elsif (/\G (\() ((?:$q_paren)*?) (\)) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw ( )
3702  
3703 0 elsif (/\G (\{) ([^{]*?) (\}) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw { }
3704 0 elsif (/\G (\{) ((?:$q_brace)*?) (\}) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw { }
3705  
3706 0 elsif (/\G (\[) ([^[]*?) (\]) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw [ ]
3707 0 elsif (/\G (\[) ((?:$q_bracket)*?) (\]) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw [ ]
3708  
3709 0 elsif (/\G (\<) ([^<]*?) (\>) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw < >
3710 0 elsif (/\G (\<) ((?:$q_angle)*?) (\>) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw < >
3711  
3712 0 elsif (/\G ([\x21-\x3F]) (.*?) (\1) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw * *
3713 0 elsif (/\G (\S) ((?:$q_char)*?) (\1) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw * *
3714 }
3715 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3716 }
3717 }
3718  
3719 # qx//
3720 elsif (/\G \b (qx) \b /oxgc) {
3721 0 my $ope = $1;
3722 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qx# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Ewindows1258::qq_char)*?) (\#) /cgox) { } 0 0 0
3723 0 return e_qq($ope,$1,$3,$2);
3724 }
3725 else {
3726 0 my $e = '';
3727 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3728 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
3729 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx ( )
3730 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx { }
3731 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx [ ]
3732 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx < >
3733 0 elsif (/\G (\') ((?:$qq_char)*?) (\') /oxgc) { return $e . e_q ($ope,$1,$3,$2); } # qx ' '
3734 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx * *
3735 }
3736 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3737 }
3738 }
3739  
3740 # q//
3741 elsif (/\G \b (q) \b /oxgc) {
3742 473 my $ope = $1;
3743  
3744 # if (/\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { return e_q($ope,$1,$3,$2); } # q# #
3745  
3746 # avoid "Error: Runtime exception" of perl version 5.005_03
3747 # (and so on)
3748  
3749 473 ▶ if (/\G (\#) /oxgc) { # q# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) /cgox) { } 0 473 473
3750 0 my $q_string = '';
3751 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3752 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
3753 0 elsif (/\G (\\\#) /oxgc) { $q_string .= $1; }
3754 0 elsif (/\G (\#) /oxgc) { return e_q($ope,'#','#',$q_string); }
3755 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3756 }
3757 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3758 }
3759  
3760 else {
3761 473 my $e = '';
3762 473 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 473 0 473
3763 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
3764  
3765 # elsif (/\G (\() ((?:\\\)|\\\\|$q_paren)*?) (\)) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q ( )
3766 elsif (/\G (\() /oxgc) { # q ( )
3767 0 my $q_string = '';
3768 0 local $nest = 1;
3769 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3770 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
3771 0 elsif (/\G (\\\)) /oxgc) { $q_string .= $1; }
3772 0 elsif (/\G (\\\() /oxgc) { $q_string .= $1; }
3773 0 elsif (/\G (\() /oxgc) { $q_string .= $1; $nest++; }
3774 elsif (/\G (\)) /oxgc) {
3775 0 ▶ if (--$nest == 0) { return $e . e_q($ope,'(',')',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ewindows1258::nest == 0) { } 0 0 0
3776 0 else { $q_string .= $1; }
3777 }
3778 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3779 }
3780 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3781 }
3782  
3783 # elsif (/\G (\{) ((?:\\\}|\\\\|$q_brace)*?) (\}) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q { }
3784 elsif (/\G (\{) /oxgc) { # q { }
3785 467 my $q_string = '';
3786 467 local $nest = 1;
3787 467 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 8314 0 8314
3788 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
3789 0 elsif (/\G (\\\}) /oxgc) { $q_string .= $1; }
3790 0 elsif (/\G (\\\{) /oxgc) { $q_string .= $1; }
3791 159 elsif (/\G (\{) /oxgc) { $q_string .= $1; $nest++; }
3792 elsif (/\G (\}) /oxgc) {
3793 626 ▶ if (--$nest == 0) { return $e . e_q($ope,'{','}',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ewindows1258::nest == 0) { } 467 159 626
3794 159 else { $q_string .= $1; }
3795 }
3796 7529 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3797 }
3798 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3799 }
3800  
3801 # elsif (/\G (\[) ((?:\\\]|\\\\|$q_bracket)*?) (\]) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q [ ]
3802 elsif (/\G (\[) /oxgc) { # q [ ]
3803 0 my $q_string = '';
3804 0 local $nest = 1;
3805 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3806 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
3807 0 elsif (/\G (\\\]) /oxgc) { $q_string .= $1; }
3808 0 elsif (/\G (\\\[) /oxgc) { $q_string .= $1; }
3809 0 elsif (/\G (\[) /oxgc) { $q_string .= $1; $nest++; }
3810 elsif (/\G (\]) /oxgc) {
3811 0 ▶ if (--$nest == 0) { return $e . e_q($ope,'[',']',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ewindows1258::nest == 0) { } 0 0 0
3812 0 else { $q_string .= $1; }
3813 }
3814 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3815 }
3816 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3817 }
3818  
3819 # elsif (/\G (\<) ((?:\\\>|\\\\|$q_angle)*?) (\>) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q < >
3820 elsif (/\G (\<) /oxgc) { # q < >
3821 5 my $q_string = '';
3822 5 local $nest = 1;
3823 5 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 88 0 88
3824 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
3825 0 elsif (/\G (\\\>) /oxgc) { $q_string .= $1; }
3826 0 elsif (/\G (\\\<) /oxgc) { $q_string .= $1; }
3827 0 elsif (/\G (\<) /oxgc) { $q_string .= $1; $nest++; }
3828 elsif (/\G (\>) /oxgc) {
3829 5 ▶ if (--$nest == 0) { return $e . e_q($ope,'<','>',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ewindows1258::nest == 0) { } 5 0 5
3830 0 else { $q_string .= $1; }
3831 }
3832 83 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3833 }
3834 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3835 }
3836  
3837 # elsif (/\G (\S) ((?:\\\1|\\\\|$q_char)*?) (\1) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q * *
3838 elsif (/\G (\S) /oxgc) { # q * *
3839 1 my $delimiter = $1;
3840 1 my $q_string = '';
3841 1 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 14 0 14
3842 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
3843 0 elsif (/\G (\\\Q$delimiter\E) /oxgc) { $q_string .= $1; }
3844 1 elsif (/\G (\Q$delimiter\E) /oxgc) { return $e . e_q($ope,$delimiter,$delimiter,$q_string); }
3845 13 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3846 }
3847 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3848 }
3849 }
3850 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3851 }
3852 }
3853  
3854 # m//
3855 elsif (/\G \b (m) \b /oxgc) {
3856 209 my $ope = $1;
3857 209 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { # m# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Ewindows1258::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
3858 0 return e_qr($ope,$1,$3,$2,$4);
3859 }
3860 else {
3861 209 my $e = '';
3862 209 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 209 0 209
3863 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
3864 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m ( )
3865 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m { }
3866 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m [ ]
3867 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m < >
3868 0 elsif (/\G (\?) ((?:$qq_char)*?) (\?) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m ? ?
3869 10 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr_q($ope,$1, $3, $2,$4); } # m ' '
3870 0 elsif (/\G ([*\-:\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,'{','}',$2,$4); } # m | | --> m { }
3871 199 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m * *
3872 }
3873 0 die __FILE__, ": Search pattern not terminated\n";
3874 }
3875 }
3876  
3877 # s///
3878  
3879 # about [cegimosxpradlunbB]* (/cg modifier)
3880 #
3881 # P.67 Pattern-Matching Operators
3882 # of ISBN 0-596-00241-6 Perl in a Nutshell, Second Edition.
3883  
3884 elsif (/\G \b (s) \b /oxgc) {
3885 101 my $ope = $1;
3886  
3887 # $1 $2 $3 $4 $5 $6
3888 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
3889 1 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3890 }
3891 else {
3892 100 my $e = '';
3893 100 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 100 0 100
3894 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
3895 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) {
3896 0 my @s = ($1,$2,$3);
3897 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3898 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
3899 # $1 $2 $3 $4
3900 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3901 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3902 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3903 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3904 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3905 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3906 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3907 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3908 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3909 }
3910 0 die __FILE__, ": Substitution replacement not terminated\n";
3911 }
3912 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) {
3913 0 my @s = ($1,$2,$3);
3914 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3915 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
3916 # $1 $2 $3 $4
3917 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3918 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3919 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3920 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3921 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3922 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3923 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3924 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3925 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3926 }
3927 0 die __FILE__, ": Substitution replacement not terminated\n";
3928 }
3929 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) {
3930 0 my @s = ($1,$2,$3);
3931 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3932 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
3933 # $1 $2 $3 $4
3934 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3935 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3936 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3937 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3938 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3939 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3940 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3941 }
3942 0 die __FILE__, ": Substitution replacement not terminated\n";
3943 }
3944 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) {
3945 0 my @s = ($1,$2,$3);
3946 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3947 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
3948 # $1 $2 $3 $4
3949 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3950 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3951 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3952 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3953 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3954 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3955 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3956 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3957 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3958 }
3959 0 die __FILE__, ": Substitution replacement not terminated\n";
3960 }
3961 # $1 $2 $3 $4 $5 $6
3962 elsif (/\G (\') ((?:$qq_char)*?) (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) {
3963 21 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3964 }
3965 # $1 $2 $3 $4 $5 $6
3966 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
3967 0 return e_sub($sub_variable,'{',$2,'}','{',$4,'}',$6); # s | | | --> s { } { }
3968 }
3969 # $1 $2 $3 $4 $5 $6
3970 elsif (/\G (\$) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
3971 0 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3972 }
3973 # $1 $2 $3 $4 $5 $6
3974 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
3975 79 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3976 }
3977 }
3978 0 die __FILE__, ": Substitution pattern not terminated\n";
3979 }
3980 }
3981  
3982 # require ignore module
3983 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# require$1$2"; }
3984 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# require$1\n$2"; }
3985 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# require$1"; }
3986  
3987 # use strict; --> use strict; no strict qw(refs);
3988 37 elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "use$1 no strict qw(refs);$2"; }
3989 0 elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [^#]) /oxmsgc) { return "use$1 no strict qw(refs);\n$2"; }
3990 0 elsif (/\G \b use ((?>\s+) strict) \b /oxmsgc) { return "use$1; no strict qw(refs)"; }
3991  
3992 # use 5.12.0; --> use 5.12.0; no strict qw(refs);
3993 elsif (/\G \b use (?>\s+) ((?>([1-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /oxmsgc) {
3994 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
3995 0 return "use $1; no strict qw(refs);";
3996 }
3997 else {
3998 2 return "use $1;";
3999 }
4000 }
4001 elsif (/\G \b use (?>\s+) ((?>v([0-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /oxmsgc) {
4002 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
4003 0 return "use $1; no strict qw(refs);";
4004 }
4005 else {
4006 0 return "use $1;";
4007 }
4008 }
4009  
4010 # ignore use module
4011 2 elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# use$1$2"; }
4012 0 elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# use$1\n$2"; }
4013 0 elsif (/\G \b use ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# use$1"; }
4014  
4015 # ignore no module
4016 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# no$1$2"; }
4017 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# no$1\n$2"; }
4018 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# no$1"; }
4019  
4020 # use else
4021 0 elsif (/\G \b use \b /oxmsgc) { return "use"; }
4022  
4023 # use else
4024 2 elsif (/\G \b no \b /oxmsgc) { return "no"; }
4025  
4026 # ''
4027 elsif (/\G (?<![\w\$\@\%\&\*]) (\') /oxgc) {
4028 1142 my $q_string = '';
4029 1142 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 10240 0 10240
4030 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
4031 48 elsif (/\G (\\\') /oxgc) { $q_string .= $1; }
4032 1142 elsif (/\G \' /oxgc) { return e_q('', "'","'",$q_string); }
4033 9046 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
4034 }
4035 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4036 }
4037  
4038 # ""
4039 elsif (/\G (\") /oxgc) {
4040 1851 my $qq_string = '';
4041 1851 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 37898 0 37898
4042 37898 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 67 37831 37898
elsif (/\G (\\\") /cgox) { } 12 37819 37831
elsif (/\G \" /cgox) { } 1851 35968 37819
elsif (/\G ($Ewindows1258::q_char) /cgox) { } 35968 0 35968
4043 12 elsif (/\G (\\\") /oxgc) { $qq_string .= $1; }
4044 1851 elsif (/\G \" /oxgc) { return e_qq('', '"','"',$qq_string); }
4045 35968 elsif (/\G ($q_char) /oxgc) { $qq_string .= $1; }
4046 }
4047 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4048 }
4049  
4050 # ``
4051 elsif (/\G (\`) /oxgc) {
4052 1 my $qx_string = '';
4053 1 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 19 0 19
4054 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
4055 0 elsif (/\G (\\\`) /oxgc) { $qx_string .= $1; }
4056 1 elsif (/\G \` /oxgc) { return e_qq('', '`','`',$qx_string); }
4057 18 elsif (/\G ($q_char) /oxgc) { $qx_string .= $1; }
4058 }
4059 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4060 }
4061  
4062 # // --- not divide operator (num / num), not defined-or
4063 ▶ elsif (($slash eq 'm//') and /\G (\/) /oxgc) {
Condition100%3/3
$Ewindows1258::slash eq "m//" and m[\G (/) ]cgox
!ll&&!rl&&r
282158836681
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
4064 681 my $regexp = '';
4065 681 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 5636 0 5636
4066 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
4067 0 elsif (/\G (\\\/) /oxgc) { $regexp .= $1; }
4068 681 elsif (/\G \/ ([cgimosxpadlunbB]*) /oxgc) { return e_qr('', '/','/',$regexp,$1); }
4069 4955 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
4070 }
4071 0 die __FILE__, ": Search pattern not terminated\n";
4072 }
4073  
4074 # ?? --- not conditional operator (condition ? then : else)
4075 ▶ elsif (($slash eq 'm//') and /\G (\?) /oxgc) {
Condition66%2/3
$Ewindows1258::slash eq "m//" and /\G (\?) /cgox
!ll&&!rl&&r
2821588360
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
4076 0 my $regexp = '';
4077 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
4078 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
4079 0 elsif (/\G (\\\?) /oxgc) { $regexp .= $1; }
4080 0 elsif (/\G \? ([cgimosxpadlunbB]*) /oxgc) { return e_qr('m','?','?',$regexp,$1); }
4081 0 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
4082 }
4083 0 die __FILE__, ": Search pattern not terminated\n";
4084 }
4085  
4086 # <<>> (a safer ARGV)
4087 0 elsif (/\G ( <<>> ) /oxgc) { $slash = 'm//'; return $1; }
4088  
4089 # << (bit shift) --- not here document
4090 0 elsif (/\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /oxgc) { $slash = 'm//'; return $1; }
4091  
4092 # <<~'HEREDOC'
4093 elsif (/\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /oxgc) {
4094 6 $slash = 'm//';
4095 6 my $here_quote = $1;
4096 6 my $delimiter = $2;
4097  
4098 # get here document
4099 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4100 6 $here_script = CORE::substr $_, pos $_;
4101 6 $here_script =~ s/.*?\n//oxm;
4102 }
4103 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
4104 6 my $heredoc = $1;
4105 6 my $indent = $2;
4106 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4107 6 push @heredoc, $heredoc . qq{\n$delimiter\n};
4108 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4109 }
4110 else {
4111 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4112 }
4113 6 return qq{<<'$delimiter'};
4114 }
4115  
4116 # <<~\HEREDOC
4117  
4118 # P.66 2.6.6. "Here" Documents
4119 # in Chapter 2: Bits and Pieces
4120 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4121  
4122 # P.73 "Here" Documents
4123 # in Chapter 2: Bits and Pieces
4124 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4125  
4126 elsif (/\G ( <<~ \\([a-zA-Z_0-9]+) ) /oxgc) {
4127 3 $slash = 'm//';
4128 3 my $here_quote = $1;
4129 3 my $delimiter = $2;
4130  
4131 # get here document
4132 3 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 3 0 3
4133 3 $here_script = CORE::substr $_, pos $_;
4134 3 $here_script =~ s/.*?\n//oxm;
4135 }
4136 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
4137 3 my $heredoc = $1;
4138 3 my $indent = $2;
4139 3 $heredoc =~ s{^$indent}{}msg; # no /ox
4140 3 push @heredoc, $heredoc . qq{\n$delimiter\n};
4141 3 push @heredoc_delimiter, qq{\\s*$delimiter};
4142 }
4143 else {
4144 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4145 }
4146 3 return qq{<<\\$delimiter};
4147 }
4148  
4149 # <<~"HEREDOC"
4150 elsif (/\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /oxgc) {
4151 6 $slash = 'm//';
4152 6 my $here_quote = $1;
4153 6 my $delimiter = $2;
4154  
4155 # get here document
4156 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4157 6 $here_script = CORE::substr $_, pos $_;
4158 6 $here_script =~ s/.*?\n//oxm;
4159 }
4160 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
4161 6 my $heredoc = $1;
4162 6 my $indent = $2;
4163 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4164 6 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4165 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4166 }
4167 else {
4168 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4169 }
4170 6 return qq{<<"$delimiter"};
4171 }
4172  
4173 # <<~HEREDOC
4174 elsif (/\G ( <<~ ([a-zA-Z_0-9]+) ) /oxgc) {
4175 3 $slash = 'm//';
4176 3 my $here_quote = $1;
4177 3 my $delimiter = $2;
4178  
4179 # get here document
4180 3 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 3 0 3
4181 3 $here_script = CORE::substr $_, pos $_;
4182 3 $here_script =~ s/.*?\n//oxm;
4183 }
4184 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
4185 3 my $heredoc = $1;
4186 3 my $indent = $2;
4187 3 $heredoc =~ s{^$indent}{}msg; # no /ox
4188 3 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4189 3 push @heredoc_delimiter, qq{\\s*$delimiter};
4190 }
4191 else {
4192 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4193 }
4194 3 return qq{<<$delimiter};
4195 }
4196  
4197 # <<~`HEREDOC`
4198 elsif (/\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /oxgc) {
4199 6 $slash = 'm//';
4200 6 my $here_quote = $1;
4201 6 my $delimiter = $2;
4202  
4203 # get here document
4204 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4205 6 $here_script = CORE::substr $_, pos $_;
4206 6 $here_script =~ s/.*?\n//oxm;
4207 }
4208 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
4209 6 my $heredoc = $1;
4210 6 my $indent = $2;
4211 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4212 6 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4213 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4214 }
4215 else {
4216 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4217 }
4218 6 return qq{<<`$delimiter`};
4219 }
4220  
4221 # <<'HEREDOC'
4222 elsif (/\G ( << '([a-zA-Z_0-9]*)' ) /oxgc) {
4223 72 $slash = 'm//';
4224 72 my $here_quote = $1;
4225 72 my $delimiter = $2;
4226  
4227 # get here document
4228 72 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 72 0 72
4229 72 $here_script = CORE::substr $_, pos $_;
4230 72 $here_script =~ s/.*?\n//oxm;
4231 }
4232 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
4233 72 push @heredoc, $1 . qq{\n$delimiter\n};
4234 72 push @heredoc_delimiter, $delimiter;
4235 }
4236 else {
4237 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4238 }
4239 72 return $here_quote;
4240 }
4241  
4242 # <<\HEREDOC
4243  
4244 # P.66 2.6.6. "Here" Documents
4245 # in Chapter 2: Bits and Pieces
4246 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4247  
4248 # P.73 "Here" Documents
4249 # in Chapter 2: Bits and Pieces
4250 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4251  
4252 elsif (/\G ( << \\([a-zA-Z_0-9]+) ) /oxgc) {
4253 0 $slash = 'm//';
4254 0 my $here_quote = $1;
4255 0 my $delimiter = $2;
4256  
4257 # get here document
4258 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4259 0 $here_script = CORE::substr $_, pos $_;
4260 0 $here_script =~ s/.*?\n//oxm;
4261 }
4262 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
4263 0 push @heredoc, $1 . qq{\n$delimiter\n};
4264 0 push @heredoc_delimiter, $delimiter;
4265 }
4266 else {
4267 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4268 }
4269 0 return $here_quote;
4270 }
4271  
4272 # <<"HEREDOC"
4273 elsif (/\G ( << "([a-zA-Z_0-9]*)" ) /oxgc) {
4274 36 $slash = 'm//';
4275 36 my $here_quote = $1;
4276 36 my $delimiter = $2;
4277  
4278 # get here document
4279 36 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 36 0 36
4280 36 $here_script = CORE::substr $_, pos $_;
4281 36 $here_script =~ s/.*?\n//oxm;
4282 }
4283 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
4284 36 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4285 36 push @heredoc_delimiter, $delimiter;
4286 }
4287 else {
4288 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4289 }
4290 36 return $here_quote;
4291 }
4292  
4293 # <<HEREDOC
4294 elsif (/\G ( << ([a-zA-Z_0-9]+) ) /oxgc) {
4295 42 $slash = 'm//';
4296 42 my $here_quote = $1;
4297 42 my $delimiter = $2;
4298  
4299 # get here document
4300 42 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 42 0 42
4301 42 $here_script = CORE::substr $_, pos $_;
4302 42 $here_script =~ s/.*?\n//oxm;
4303 }
4304 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
4305 42 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4306 42 push @heredoc_delimiter, $delimiter;
4307 }
4308 else {
4309 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4310 }
4311 42 return $here_quote;
4312 }
4313  
4314 # <<`HEREDOC`
4315 elsif (/\G ( << `([a-zA-Z_0-9]*)` ) /oxgc) {
4316 0 $slash = 'm//';
4317 0 my $here_quote = $1;
4318 0 my $delimiter = $2;
4319  
4320 # get here document
4321 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4322 0 $here_script = CORE::substr $_, pos $_;
4323 0 $here_script =~ s/.*?\n//oxm;
4324 }
4325 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
4326 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4327 0 push @heredoc_delimiter, $delimiter;
4328 }
4329 else {
4330 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4331 }
4332 0 return $here_quote;
4333 }
4334  
4335 # <<= <=> <= < operator
4336 elsif (/\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/oxgc) {
4337 12 return $1;
4338 }
4339  
4340 # <FILEHANDLE>
4341 elsif (/\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /oxgc) {
4342 0 return $1;
4343 }
4344  
4345 # <WILDCARD> --- glob
4346  
4347 # avoid "Error: Runtime exception" of perl version 5.005_03
4348  
4349 elsif (/\G < ((?:[^>\0\a\e\f\n\r\t])+?) > /oxgc) {
4350 0 return 'Ewindows1258::glob("' . $1 . '")';
4351 }
4352  
4353 # __DATA__
4354 0 elsif (/\G ^ ( __DATA__ \n .*) \z /oxmsgc) { return $1; }
4355  
4356 # __END__
4357 210 elsif (/\G ^ ( __END__ \n .*) \z /oxmsgc) { return $1; }
4358  
4359 # \cD Control-D
4360  
4361 # P.68 2.6.8. Other Literal Tokens
4362 # in Chapter 2: Bits and Pieces
4363 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4364  
4365 # P.76 Other Literal Tokens
4366 # in Chapter 2: Bits and Pieces
4367 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4368  
4369 0 elsif (/\G ( \cD .*) \z /oxmsgc) { return $1; }
4370  
4371 # \cZ Control-Z
4372 0 elsif (/\G ( \cZ .*) \z /oxmsgc) { return $1; }
4373  
4374 # any operator before div
4375 elsif (/\G (
4376 -- | \+\+ |
4377 [\)\}\]]
4378  
4379 5837 ) /oxgc) { $slash = 'div'; return $1; }
4380  
4381 # yada-yada or triple-dot operator
4382 elsif (/\G (
4383 \.\.\.
4384  
4385 7 ) /oxgc) { $slash = 'm//'; return q{die('Unimplemented')}; }
4386  
4387 # any operator before m//
4388  
4389 # //, //= (defined-or)
4390  
4391 # P.164 Logical Operators
4392 # in Chapter 10: More Control Structures
4393 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
4394  
4395 # P.119 C-Style Logical (Short-Circuit) Operators
4396 # in Chapter 3: Unary and Binary Operators
4397 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4398  
4399 # (and so on)
4400  
4401 # ~~
4402  
4403 # P.221 The Smart Match Operator
4404 # in Chapter 15: Smart Matching and given-when
4405 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
4406  
4407 # P.112 Smartmatch Operator
4408 # in Chapter 3: Unary and Binary Operators
4409 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4410  
4411 # (and so on)
4412  
4413 elsif (/\G ((?>
4414  
4415 !~~ | !~ | != | ! |
4416 %= | % |
4417 &&= | && | &= | &\.= | &\. | & |
4418 -= | -> | - |
4419 :(?>\s*)= |
4420 : |
4421 <<>> |
4422 <<= | <=> | <= | < |
4423 == | => | =~ | = |
4424 >>= | >> | >= | > |
4425 \*\*= | \*\* | \*= | \* |
4426 \+= | \+ |
4427 \.\. | \.= | \. |
4428 \/\/= | \/\/ |
4429 \/= | \/ |
4430 \? |
4431 \\ |
4432 \^= | \^\.= | \^\. | \^ |
4433 \b x= |
4434 \|\|= | \|\| | \|= | \|\.= | \|\. | \| |
4435 ~~ | ~\. | ~ |
4436 \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b |
4437 \b(?: print )\b |
4438  
4439 [,;\(\{\[]
4440  
4441 9755 )) /oxgc) { $slash = 'm//'; return $1; }
4442  
4443 # other any character
4444 21056 elsif (/\G ($q_char) /oxgc) { $slash = 'div'; return $1; }
4445  
4446 # system error
4447 else {
4448 0 die __FILE__, ": Oops, this shouldn't happen!\n";
4449 }
4450 }
4451  
4452 # escape Windows-1258 string
4453 1871 ▶sub e_string {
Subroutine e_string: called CC=228 SCAR=104.2
Pod documented
4454 1871 my($string) = @_;
4455 1871 my $e_string = '';
4456  
4457 1871 local $slash = 'm//';
4458  
4459 # P.1024 Appendix W.10 Multibyte Processing
4460 # of ISBN 1-56592-224-7 CJKV Information Processing
4461 # (and so on)
4462  
4463 1871 my @char = $string =~ / \G (?>[^\\]|\\$q_char|$q_char) /oxmsg;
4464  
4465 # without { ... }
4466 1871 ▶ if (not (grep(/\A \{ \z/xms, @char) and grep(/\A \} \z/xms, @char))) {
Branch: 1 branch
BranchTrueFalseTotal
unless (grep /\A \{ \z/msx, @char and grep /\A \} \z/msx, @char) 1854 17 1871
Condition66%2/3
grep /\A \{ \z/msx, @char and grep /\A \} \z/msx, @char
!ll&&!rl&&r
1854017
MC/DC50%1/2
grep /\A \{ \z/msx, @char and grep /\A \} \z/msx, @char
grep /\A \{ \z/msx, @char grep /\A \} \z/msx, @char
Truth table66%2/3
A and B
A= grep /\A \{ \z/msx, @charB= grep /\A \} \z/msx, @char
ABresult
0X0
100
111
4467 1854 ▶ if ($string !~ /<</oxms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /<</mosx) 1854 0 1854
4468 1854 return $string;
4469 }
4470 }
4471  
4472 E_STRING_LOOP:
4473 17 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 190 17 207
4474 190 ▶ if (0) {
Branch: 101 branches
BranchTrueFalseTotal
if (do { $string =~ /\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /cgmosx }) { } 0 190 190
elsif ($string =~ /\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G ( \$' | \$\{'\} ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G ( \$ 0 ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G ( \$ \$ ) (?![\w\{]) /cgmosx) { } 0 190 190
elsif ($string =~ /\G \$ ((?>[1-9][0-9]*)) /cgmosx) { } 0 190 190
elsif ($string =~ /\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /cgmosx) { } 0 190 190
elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /cgmosx) { } 0 190 190
elsif ($string =~ /\G \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} /cgmosx) { } 0 190 190
elsif ($string =~ /\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /cgmosx) { } 3 187 190
elsif ($string =~ /\G ( (?: [\$\@\%\&\*] | \$\# | -> | \b sub \b) (?>\s*) (?: split | chop | index | rindex | lc | uc | fc | chr | ord | reverse | getc | tr | y | q | qq | qx | qw | m | s | qr | glob | lstat | opendir | stat | unlink | chdir ) ) \b /cgmosx) { } 7 180 187
elsif ($string =~ m{\G ( \$[\$\@\#\\\'\"/\?\(\)\[\]\<\>] ) }cgmosx) { } 0 180 180
elsif ($string =~ /\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b Char::eval (?= (?>\s*) \{ ) /cgox) { } 0 180 180
elsif ($string =~ /\G \b Windows1258::eval (?= (?>\s*) \{ ) /cgox) { } 0 180 180
elsif ($string =~ /\G \b Char::eval \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b Windows1258::eval \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::substr \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b chop \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::index \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b Char::index \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b Windows1258::index \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b index \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::rindex \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b Char::rindex \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b Windows1258::rindex \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b rindex \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s*) (\") ((?:$Ewindows1258::qq_char)+?) (\") /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\#) ((?:$Ewindows1258::qq_char)+?) (\#) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\S) ((?:$Ewindows1258::qq_char)+?) (\1) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s*) (\') ((?:\\\'|\\\\|$Ewindows1258::q_char)+?) (\') /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$Ewindows1258::q_char)+?) (\#) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$Ewindows1258::q_char)+?) (\1) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)*) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ))*) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?= (?>\s+) [a-z]+) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) ((?>\w+)) /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b lc \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b lcfirst \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b uc \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b ucfirst \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b fc \b /cgox) { } 0 180 180
elsif ($string =~ /\G -s \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::length \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::chr \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b chr \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::ord \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b ord \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b glob \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b reverse \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b getc \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b (split) \b (?! (?>\s*) => ) /cgox) { } 0 180 180
elsif ($string =~ /\G \b (qq) \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b (qx) \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b (q) \b /cgox) { } 0 180 180
elsif ($string =~ /\G (?<![\w\$\@\%\&\*]) (\') ((?:\\\'|\\\\|$Ewindows1258::q_char)*?) (\') /cgox) { } 0 180 180
elsif ($string =~ /\G (\") ((?:$Ewindows1258::qq_char)*?) (\") /cgox) { } 0 180 180
elsif ($string =~ /\G (\`) ((?:$Ewindows1258::qq_char)*?) (\`) /cgox) { } 0 180 180
elsif ($string =~ /\G ( <<>> ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/cgox) { } 0 180 180
elsif ($string =~ /\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /cgox) { } 0 180 180
elsif ($string =~ /\G < ((?:$Ewindows1258::q_char)+?) > /cgox) { } 0 180 180
elsif ($string =~ /\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( <<~ \\([a-zA-Z_0-9]+) ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( <<~ ([a-zA-Z_0-9]+) ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( << '([a-zA-Z_0-9]*)' ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( << \\([a-zA-Z_0-9]+) ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( << "([a-zA-Z_0-9]*)" ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( << ([a-zA-Z_0-9]+) ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( << `([a-zA-Z_0-9]*)` ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( -- | \+\+ | [\)\}\]] ) /cgox) { } 18 162 180
elsif ($string =~ /\G ( \.\.\. ) /cgox) { } 0 162 162
elsif ($string =~ m"\G ((?> !~~ | !~ | != | ! | %= | % | &&= | && | &= | &\.= | &\. | & | -= | -> | - | :(?>\s*)= | : | <<>> | <<= | <=> | <= | < | == | => | =~ | = | >>= | >> | >= | > | \*\*= | \*\* | \*= | \* | \+= | \+ | \.\. | \.= | \. | //= | // | /= | / | \? | \\ | \^= | \^\.= | \^\. | \^ | \b x= | \|\|= | \|\| | \|= | \|\.= | \|\. | \| | ~~ | ~\. | ~ | \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b | \b(?: print )\b | [,;\(\{\[] )) "cgox) { } 31 131 162
elsif ($string =~ /\G ($Ewindows1258::q_char) /cgox) { } 131 0 131
4475 }
4476  
4477 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> @{[Ewindows1258::PREMATCH()]}
4478 elsif ($string =~ /\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /oxmsgc) {
4479 0 $e_string .= q{Ewindows1258::PREMATCH()};
4480 0 $slash = 'div';
4481 }
4482  
4483 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> @{[Ewindows1258::MATCH()]}
4484 elsif ($string =~ /\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /oxmsgc) {
4485 0 $e_string .= q{Ewindows1258::MATCH()};
4486 0 $slash = 'div';
4487 }
4488  
4489 # $', ${'} --> $', ${'}
4490 elsif ($string =~ /\G ( \$' | \$\{'\} ) /oxmsgc) {
4491 0 $e_string .= $1;
4492 0 $slash = 'div';
4493 }
4494  
4495 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> @{[Ewindows1258::POSTMATCH()]}
4496 elsif ($string =~ /\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /oxmsgc) {
4497 0 $e_string .= q{Ewindows1258::POSTMATCH()};
4498 0 $slash = 'div';
4499 }
4500  
4501 # bareword
4502 elsif ($string =~ /\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /oxmsgc) {
4503 0 $e_string .= $1;
4504 0 $slash = 'div';
4505 }
4506  
4507 # $0 --> $0
4508 elsif ($string =~ /\G ( \$ 0 ) /oxmsgc) {
4509 0 $e_string .= $1;
4510 0 $slash = 'div';
4511 }
4512 elsif ($string =~ /\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /oxmsgc) {
4513 0 $e_string .= $1;
4514 0 $slash = 'div';
4515 }
4516  
4517 # $$ --> $$
4518 elsif ($string =~ /\G ( \$ \$ ) (?![\w\{]) /oxmsgc) {
4519 0 $e_string .= $1;
4520 0 $slash = 'div';
4521 }
4522  
4523 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
4524 # $1, $2, $3 --> $1, $2, $3 otherwise
4525 elsif ($string =~ /\G \$ ((?>[1-9][0-9]*)) /oxmsgc) {
4526 0 $e_string .= e_capture($1);
4527 0 $slash = 'div';
4528 }
4529 elsif ($string =~ /\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /oxmsgc) {
4530 0 $e_string .= e_capture($1);
4531 0 $slash = 'div';
4532 }
4533  
4534 # $$foo[ ... ] --> $ $foo->[ ... ]
4535 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /oxmsgc) {
4536 0 $e_string .= e_capture($1.'->'.$2);
4537 0 $slash = 'div';
4538 }
4539  
4540 # $$foo{ ... } --> $ $foo->{ ... }
4541 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /oxmsgc) {
4542 0 $e_string .= e_capture($1.'->'.$2);
4543 0 $slash = 'div';
4544 }
4545  
4546 # $$foo
4547 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /oxmsgc) {
4548 0 $e_string .= e_capture($1);
4549 0 $slash = 'div';
4550 }
4551  
4552 # ${ foo }
4553 elsif ($string =~ /\G \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} /oxmsgc) {
4554 0 $e_string .= '${' . $1 . '}';
4555 0 $slash = 'div';
4556 }
4557  
4558 # ${ ... }
4559 elsif ($string =~ /\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /oxmsgc) {
4560 3 $e_string .= e_capture($1);
4561 3 $slash = 'div';
4562 }
4563  
4564 # variable or function
4565 # $ @ % & * $ #
4566 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) {
4567 7 $e_string .= $1;
4568 7 $slash = 'div';
4569 }
4570 # $ $ $ $ $ $ $ $ $ $ $ $ $ $
4571 # $ @ # \ ' " / ? ( ) [ ] < >
4572 elsif ($string =~ /\G ( \$[\$\@\#\\\'\"\/\?\(\)\[\]\<\>] ) /oxmsgc) {
4573 0 $e_string .= $1;
4574 0 $slash = 'div';
4575 }
4576  
4577 # subroutines of package Ewindows1258
4578 0 elsif ($string =~ /\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /oxgc) { $e_string .= $1; $slash = 'm//'; }
4579 0 elsif ($string =~ /\G \b Char::eval (?= (?>\s*) \{ ) /oxgc) { $e_string .= 'eval'; $slash = 'm//'; }
4580 0 elsif ($string =~ /\G \b Windows1258::eval (?= (?>\s*) \{ ) /oxgc) { $e_string .= 'eval'; $slash = 'm//'; }
4581 0 elsif ($string =~ /\G \b Char::eval \b /oxgc) { $e_string .= 'eval Char::escape'; $slash = 'm//'; }
4582 0 elsif ($string =~ /\G \b Windows1258::eval \b /oxgc) { $e_string .= 'eval Windows1258::escape'; $slash = 'm//'; }
4583 0 elsif ($string =~ /\G \b bytes::substr \b /oxgc) { $e_string .= 'substr'; $slash = 'm//'; }
4584 0 elsif ($string =~ /\G \b chop \b /oxgc) { $e_string .= 'Ewindows1258::chop'; $slash = 'm//'; }
4585 0 elsif ($string =~ /\G \b bytes::index \b /oxgc) { $e_string .= 'index'; $slash = 'm//'; }
4586 0 elsif ($string =~ /\G \b Char::index \b /oxgc) { $e_string .= 'Char::index'; $slash = 'm//'; }
4587 0 elsif ($string =~ /\G \b Windows1258::index \b /oxgc) { $e_string .= 'Windows1258::index'; $slash = 'm//'; }
4588 0 elsif ($string =~ /\G \b index \b /oxgc) { $e_string .= 'Ewindows1258::index'; $slash = 'm//'; }
4589 0 elsif ($string =~ /\G \b bytes::rindex \b /oxgc) { $e_string .= 'rindex'; $slash = 'm//'; }
4590 0 elsif ($string =~ /\G \b Char::rindex \b /oxgc) { $e_string .= 'Char::rindex'; $slash = 'm//'; }
4591 0 elsif ($string =~ /\G \b Windows1258::rindex \b /oxgc) { $e_string .= 'Windows1258::rindex'; $slash = 'm//'; }
4592 0 elsif ($string =~ /\G \b rindex \b /oxgc) { $e_string .= 'Ewindows1258::rindex'; $slash = 'm//'; }
4593 0 elsif ($string =~ /\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Ewindows1258::lc'; $slash = 'm//'; }
4594 0 elsif ($string =~ /\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Ewindows1258::lcfirst'; $slash = 'm//'; }
4595 0 elsif ($string =~ /\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Ewindows1258::uc'; $slash = 'm//'; }
4596 0 elsif ($string =~ /\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Ewindows1258::ucfirst'; $slash = 'm//'; }
4597 0 elsif ($string =~ /\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Ewindows1258::fc'; $slash = 'm//'; }
4598  
4599 # "-s '' ..." means file test "-s 'filename' ..." (not means "- s/// ...")
4600 0 elsif ($string =~ /\G -s (?>\s*) (\") ((?:$qq_char)+?) (\") /oxgc) { $e_string .= '-s ' . e_qq('', $1,$3,$2); $slash = 'm//'; }
4601 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\#) ((?:$qq_char)+?) (\#) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4602 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4603 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4604 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4605 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4606 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\S) ((?:$qq_char)+?) (\1) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4607  
4608 0 elsif ($string =~ /\G -s (?>\s*) (\') ((?:\\\'|\\\\|$q_char)+?) (\') /oxgc) { $e_string .= '-s ' . e_q ('', $1,$3,$2); $slash = 'm//'; }
4609 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$q_char)+?) (\#) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4610 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4611 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4612 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4613 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4614 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$q_char)+?) (\1) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4615  
4616 elsif ($string =~ /\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)*) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ))*) /oxgc)
4617 0 { $e_string .= "-s $1"; $slash = 'm//'; }
4618 0 elsif ($string =~ /\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /oxgc) { $e_string .= "-s ($1)"; $slash = 'm//'; }
4619 0 elsif ($string =~ /\G -s (?= (?>\s+) [a-z]+) /oxgc) { $e_string .= '-s'; $slash = 'm//'; }
4620 0 elsif ($string =~ /\G -s (?>\s+) ((?>\w+)) /oxgc) { $e_string .= "-s $1"; $slash = 'm//'; }
4621  
4622 0 elsif ($string =~ /\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'length'; $slash = 'm//'; }
4623 0 elsif ($string =~ /\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'chr'; $slash = 'm//'; }
4624 0 elsif ($string =~ /\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Ewindows1258::chr'; $slash = 'm//'; }
4625 0 elsif ($string =~ /\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'ord'; $slash = 'div'; }
4626 0 elsif ($string =~ /\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= $function_ord; $slash = 'div'; }
4627 0 elsif ($string =~ /\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Ewindows1258::glob'; $slash = 'm//'; }
4628 0 elsif ($string =~ /\G \b lc \b /oxgc) { $e_string .= 'Ewindows1258::lc_'; $slash = 'm//'; }
4629 0 elsif ($string =~ /\G \b lcfirst \b /oxgc) { $e_string .= 'Ewindows1258::lcfirst_'; $slash = 'm//'; }
4630 0 elsif ($string =~ /\G \b uc \b /oxgc) { $e_string .= 'Ewindows1258::uc_'; $slash = 'm//'; }
4631 0 elsif ($string =~ /\G \b ucfirst \b /oxgc) { $e_string .= 'Ewindows1258::ucfirst_'; $slash = 'm//'; }
4632 0 elsif ($string =~ /\G \b fc \b /oxgc) { $e_string .= 'Ewindows1258::fc_'; $slash = 'm//'; }
4633 0 elsif ($string =~ /\G -s \b /oxgc) { $e_string .= '-s '; $slash = 'm//'; }
4634  
4635 0 elsif ($string =~ /\G \b bytes::length \b /oxgc) { $e_string .= 'length'; $slash = 'm//'; }
4636 0 elsif ($string =~ /\G \b bytes::chr \b /oxgc) { $e_string .= 'chr'; $slash = 'm//'; }
4637 0 elsif ($string =~ /\G \b chr \b /oxgc) { $e_string .= 'Ewindows1258::chr_'; $slash = 'm//'; }
4638 0 elsif ($string =~ /\G \b bytes::ord \b /oxgc) { $e_string .= 'ord'; $slash = 'div'; }
4639 0 elsif ($string =~ /\G \b ord \b /oxgc) { $e_string .= $function_ord_; $slash = 'div'; }
4640 0 elsif ($string =~ /\G \b glob \b /oxgc) { $e_string .= 'Ewindows1258::glob_'; $slash = 'm//'; }
4641 0 elsif ($string =~ /\G \b reverse \b /oxgc) { $e_string .= $function_reverse; $slash = 'm//'; }
4642 0 elsif ($string =~ /\G \b getc \b /oxgc) { $e_string .= $function_getc; $slash = 'm//'; }
4643 # split
4644 elsif ($string =~ /\G \b (split) \b (?! (?>\s*) => ) /oxgc) {
4645 0 $slash = 'm//';
4646  
4647 0 my $e = '';
4648 0 ▶ while ($string =~ /\G ( (?>\s+) | \( | \#.* ) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G ( (?>\s+) | \( | \#.* ) /cgox) 0 0 0
4649 0 $e .= $1;
4650 }
4651  
4652 # end of split
4653 0 ▶ if ($string =~ /\G (?= [,;\)\}\]] ) /oxgc) { return 'Ewindows1258::split' . $e; }
Branch: 23 branches
BranchTrueFalseTotal
if ($string =~ /\G (?= [,;\)\}\]] ) /cgox) { } 0 0 0
elsif ($string =~ /\G ( [\$\@\&\*] $qq_scalar ) /cgox) { } 0 0 0
elsif ($string =~ /\G \b qq (\#) [ ] (\#) /cgox) { } 0 0 0
elsif ($string =~ /\G \b qq ((?>\s*)) (\() [ ] (\)) /cgox) { } 0 0 0
elsif ($string =~ /\G \b qq ((?>\s*)) (\{) [ ] (\}) /cgox) { } 0 0 0
elsif ($string =~ /\G \b qq ((?>\s*)) (\[) [ ] (\]) /cgox) { } 0 0 0
elsif ($string =~ /\G \b qq ((?>\s*)) (\<) [ ] (\>) /cgox) { } 0 0 0
elsif ($string =~ /\G \b qq ((?>\s*)) (\S) [ ] (\2) /cgox) { } 0 0 0
elsif ($string =~ /\G \b q (\#) [ ] (\#) /cgox) { } 0 0 0
elsif ($string =~ /\G \b q ((?>\s*)) (\() [ ] (\)) /cgox) { } 0 0 0
elsif ($string =~ /\G \b q ((?>\s*)) (\{) [ ] (\}) /cgox) { } 0 0 0
elsif ($string =~ /\G \b q ((?>\s*)) (\[) [ ] (\]) /cgox) { } 0 0 0
elsif ($string =~ /\G \b q ((?>\s*)) (\<) [ ] (\>) /cgox) { } 0 0 0
elsif ($string =~ /\G \b q ((?>\s*)) (\S) [ ] (\2) /cgox) { } 0 0 0
elsif ($string =~ /\G ' [ ] ' /cgox) { } 0 0 0
elsif ($string =~ /\G " [ ] " /cgox) { } 0 0 0
elsif ($string =~ /\G \b (qq) \b /cgox) { } 0 0 0
elsif ($string =~ /\G \b (qr) \b /cgox) { } 0 0 0
elsif ($string =~ /\G \b (q) \b /cgox) { } 0 0 0
elsif ($string =~ /\G \b (m) \b /cgox) { } 0 0 0
elsif ($string =~ /\G (\') /cgox) { } 0 0 0
elsif ($string =~ /\G (\") /cgox) { } 0 0 0
elsif ($string =~ m[\G (/) ]cgox) { } 0 0 0
4654  
4655 # split scalar value
4656 0 elsif ($string =~ /\G ( [\$\@\&\*] $qq_scalar ) /oxgc) { $e_string .= 'Ewindows1258::split' . $e . e_string($1); next E_STRING_LOOP; }
4657  
4658 # split literal space
4659 0 elsif ($string =~ /\G \b qq (\#) [ ] (\#) /oxgc) { $e_string .= 'Ewindows1258::split' . $e . qq {qq$1 $2}; next E_STRING_LOOP; }
4660 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\() [ ] (\)) /oxgc) { $e_string .= 'Ewindows1258::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4661 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\{) [ ] (\}) /oxgc) { $e_string .= 'Ewindows1258::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4662 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\[) [ ] (\]) /oxgc) { $e_string .= 'Ewindows1258::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4663 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\<) [ ] (\>) /oxgc) { $e_string .= 'Ewindows1258::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4664 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\S) [ ] (\2) /oxgc) { $e_string .= 'Ewindows1258::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4665 0 elsif ($string =~ /\G \b q (\#) [ ] (\#) /oxgc) { $e_string .= 'Ewindows1258::split' . $e . qq {q$1 $2}; next E_STRING_LOOP; }
4666 0 elsif ($string =~ /\G \b q ((?>\s*)) (\() [ ] (\)) /oxgc) { $e_string .= 'Ewindows1258::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4667 0 elsif ($string =~ /\G \b q ((?>\s*)) (\{) [ ] (\}) /oxgc) { $e_string .= 'Ewindows1258::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4668 0 elsif ($string =~ /\G \b q ((?>\s*)) (\[) [ ] (\]) /oxgc) { $e_string .= 'Ewindows1258::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4669 0 elsif ($string =~ /\G \b q ((?>\s*)) (\<) [ ] (\>) /oxgc) { $e_string .= 'Ewindows1258::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4670 0 elsif ($string =~ /\G \b q ((?>\s*)) (\S) [ ] (\2) /oxgc) { $e_string .= 'Ewindows1258::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4671 0 elsif ($string =~ /\G ' [ ] ' /oxgc) { $e_string .= 'Ewindows1258::split' . $e . qq {' '}; next E_STRING_LOOP; }
4672 0 elsif ($string =~ /\G " [ ] " /oxgc) { $e_string .= 'Ewindows1258::split' . $e . qq {" "}; next E_STRING_LOOP; }
4673  
4674 # split qq//
4675 elsif ($string =~ /\G \b (qq) \b /oxgc) {
4676 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Ewindows1258::qq_char)*?) (\#) /cgox) { } 0 0 0
4677 else {
4678 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4679 0 ▶ if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e_string .= $e . $1; }
Branch: 7 branches
BranchTrueFalseTotal
if ($string =~ /\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /cgox) { } 0 0 0
elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /cgox) { } 0 0 0
elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /cgox) { } 0 0 0
elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /cgox) { } 0 0 0
elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$Ewindows1258::qq_char)*?) (\1) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Ewindows1258::qq_char)*?) (\1) /cgox) { } 0 0 0
4680 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq ( ) --> qr ( )
4681 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq { } --> qr { }
4682 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq [ ] --> qr [ ]
4683 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq < > --> qr < >
4684 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= e_split($e.'qr','{','}',$2,''); next E_STRING_LOOP; } # qq | | --> qr { }
4685 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq * * --> qr * *
4686 }
4687 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4688 }
4689 }
4690  
4691 # split qr//
4692 elsif ($string =~ /\G \b (qr) \b /oxgc) {
4693 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1,$3,$2,$4); next E_STRING_LOOP; } # qr# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Ewindows1258::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 0 0
4694 else {
4695 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4696 0 ▶ if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e_string .= $e . $1; }
Branch: 8 branches
BranchTrueFalseTotal
if ($string =~ /\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\') ((?:$Ewindows1258::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$Ewindows1258::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Ewindows1258::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
4697 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr ( )
4698 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr { }
4699 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr [ ]
4700 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr < >
4701 0 elsif ($string =~ /\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split_q($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr ' '
4702 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr','{','}',$2,$4); next E_STRING_LOOP; } # qr | | --> qr { }
4703 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr * *
4704 }
4705 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4706 }
4707 }
4708  
4709 # split q//
4710 elsif ($string =~ /\G \b (q) \b /oxgc) {
4711 0 ▶ if ($string =~ /\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:\\\#|\\\\|$Ewindows1258::q_char)*?) (\#) /cgox) { } 0 0 0
4712 else {
4713 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4714 0 ▶ if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e_string .= $e . $1; }
Branch: 7 branches
BranchTrueFalseTotal
if ($string =~ /\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /cgox) { } 0 0 0
elsif ($string =~ /\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /cgox) { } 0 0 0
elsif ($string =~ /\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /cgox) { } 0 0 0
elsif ($string =~ /\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /cgox) { } 0 0 0
elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$Ewindows1258::q_char)*?) (\1) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:\\\\|\\\1| $Ewindows1258::q_char)*?) (\1) /cgox) { } 0 0 0
4715 0 elsif ($string =~ /\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q ( ) --> qr ( )
4716 0 elsif ($string =~ /\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q { } --> qr { }
4717 0 elsif ($string =~ /\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q [ ] --> qr [ ]
4718 0 elsif ($string =~ /\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q < > --> qr < >
4719 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$q_char)*?) (\1) /oxgc) { $e_string .= e_split_q($e.'qr','{','}',$2,''); next E_STRING_LOOP; } # q | | --> qr { }
4720 0 elsif ($string =~ /\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q * * --> qr * *
4721 }
4722 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4723 }
4724 }
4725  
4726 # split m//
4727 elsif ($string =~ /\G \b (m) \b /oxgc) {
4728 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1,$3,$2,$4); next E_STRING_LOOP; } # m# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Ewindows1258::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
4729 else {
4730 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4731 0 ▶ if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e_string .= $e . $1; }
Branch: 8 branches
BranchTrueFalseTotal
if ($string =~ /\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\') ((?:$Ewindows1258::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$Ewindows1258::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Ewindows1258::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
4732 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m ( ) --> qr ( )
4733 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m { } --> qr { }
4734 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m [ ] --> qr [ ]
4735 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m < > --> qr < >
4736 0 elsif ($string =~ /\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split_q($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m ' ' --> qr ' '
4737 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr','{','}',$2,$4); next E_STRING_LOOP; } # m | | --> qr { }
4738 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m * * --> qr * *
4739 }
4740 0 die __FILE__, ": Search pattern not terminated\n";
4741 }
4742 }
4743  
4744 # split ''
4745 elsif ($string =~ /\G (\') /oxgc) {
4746 0 my $q_string = '';
4747 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4748 0 ▶ if ($string =~ /\G (\\\\) /oxgc) { $q_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if ($string =~ /\G (\\\\) /cgox) { } 0 0 0
elsif ($string =~ /\G (\\\') /cgox) { } 0 0 0
elsif ($string =~ /\G \' /cgox) { } 0 0 0
elsif ($string =~ /\G ($Ewindows1258::q_char) /cgox) { } 0 0 0
4749 0 elsif ($string =~ /\G (\\\') /oxgc) { $q_string .= $1; } # splitqr'' --> split qr''
4750 0 elsif ($string =~ /\G \' /oxgc) { $e_string .= e_split_q($e.q{ qr},"'","'",$q_string,''); next E_STRING_LOOP; } # ' ' --> qr ' '
4751 0 elsif ($string =~ /\G ($q_char) /oxgc) { $q_string .= $1; }
4752 }
4753 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4754 }
4755  
4756 # split ""
4757 elsif ($string =~ /\G (\") /oxgc) {
4758 0 my $qq_string = '';
4759 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4760 0 ▶ if ($string =~ /\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if ($string =~ /\G (\\\\) /cgox) { } 0 0 0
elsif ($string =~ /\G (\\\") /cgox) { } 0 0 0
elsif ($string =~ /\G \" /cgox) { } 0 0 0
elsif ($string =~ /\G ($Ewindows1258::q_char) /cgox) { } 0 0 0
4761 0 elsif ($string =~ /\G (\\\") /oxgc) { $qq_string .= $1; } # splitqr"" --> split qr""
4762 0 elsif ($string =~ /\G \" /oxgc) { $e_string .= e_split($e.q{ qr},'"','"',$qq_string,''); next E_STRING_LOOP; } # " " --> qr " "
4763 0 elsif ($string =~ /\G ($q_char) /oxgc) { $qq_string .= $1; }
4764 }
4765 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4766 }
4767  
4768 # split //
4769 elsif ($string =~ /\G (\/) /oxgc) {
4770 0 my $regexp = '';
4771 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4772 0 ▶ if ($string =~ /\G (\\\\) /oxgc) { $regexp .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if ($string =~ /\G (\\\\) /cgox) { } 0 0 0
elsif ($string =~ m[\G (\\/) ]cgox) { } 0 0 0
elsif ($string =~ m[\G / ([cgimosxpadlunbB]*) ]cgox) { } 0 0 0
elsif ($string =~ /\G ($Ewindows1258::q_char) /cgox) { } 0 0 0
4773 0 elsif ($string =~ /\G (\\\/) /oxgc) { $regexp .= $1; } # splitqr// --> split qr//
4774 0 elsif ($string =~ /\G \/ ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split($e.q{ qr}, '/','/',$regexp,$1); next E_STRING_LOOP; } # / / --> qr / /
4775 0 elsif ($string =~ /\G ($q_char) /oxgc) { $regexp .= $1; }
4776 }
4777 0 die __FILE__, ": Search pattern not terminated\n";
4778 }
4779 }
4780  
4781 # qq//
4782 elsif ($string =~ /\G \b (qq) \b /oxgc) {
4783 0 my $ope = $1;
4784 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qq# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Ewindows1258::qq_char)*?) (\#) /cgox) { } 0 0 0
4785 0 $e_string .= e_qq($ope,$1,$3,$2);
4786 }
4787 else {
4788 0 my $e = '';
4789 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4790 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
4791 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq ( )
4792 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq { }
4793 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq [ ]
4794 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq < >
4795 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq * *
4796 }
4797 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4798 }
4799 }
4800  
4801 # qx//
4802 elsif ($string =~ /\G \b (qx) \b /oxgc) {
4803 0 my $ope = $1;
4804 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qx# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Ewindows1258::qq_char)*?) (\#) /cgox) { } 0 0 0
4805 0 $e_string .= e_qq($ope,$1,$3,$2);
4806 }
4807 else {
4808 0 my $e = '';
4809 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4810 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
4811 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx ( )
4812 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx { }
4813 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx [ ]
4814 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx < >
4815 0 elsif ($string =~ /\G (\') ((?:$qq_char)*?) (\') /oxgc) { $e_string .= $e . e_q ($ope,$1,$3,$2); next E_STRING_LOOP; } # qx ' '
4816 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx * *
4817 }
4818 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4819 }
4820 }
4821  
4822 # q//
4823 elsif ($string =~ /\G \b (q) \b /oxgc) {
4824 0 my $ope = $1;
4825 0 ▶ if ($string =~ /\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { # q# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:\\\#|\\\\|$Ewindows1258::q_char)*?) (\#) /cgox) { } 0 0 0
4826 0 $e_string .= e_q($ope,$1,$3,$2);
4827 }
4828 else {
4829 0 my $e = '';
4830 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4831 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
4832 0 elsif ($string =~ /\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q ( )
4833 0 elsif ($string =~ /\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q { }
4834 0 elsif ($string =~ /\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q [ ]
4835 0 elsif ($string =~ /\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q < >
4836 0 elsif ($string =~ /\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q * *
4837 }
4838 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4839 }
4840 }
4841  
4842 # ''
4843 0 elsif ($string =~ /\G (?<![\w\$\@\%\&\*]) (\') ((?:\\\'|\\\\|$q_char)*?) (\') /oxgc) { $e_string .= e_q('',$1,$3,$2); }
4844  
4845 # ""
4846 0 elsif ($string =~ /\G (\") ((?:$qq_char)*?) (\") /oxgc) { $e_string .= e_qq('',$1,$3,$2); }
4847  
4848 # ``
4849 0 elsif ($string =~ /\G (\`) ((?:$qq_char)*?) (\`) /oxgc) { $e_string .= e_qq('',$1,$3,$2); }
4850  
4851 # <<>> (a safer ARGV)
4852 0 elsif ($string =~ /\G ( <<>> ) /oxgc) { $e_string .= $1; }
4853  
4854 # <<= <=> <= < operator
4855 0 elsif ($string =~ /\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/oxgc) { $e_string .= $1; }
4856  
4857 # <FILEHANDLE>
4858 0 elsif ($string =~ /\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /oxgc) { $e_string .= $1; }
4859  
4860 # <WILDCARD> --- glob
4861 elsif ($string =~ /\G < ((?:$q_char)+?) > /oxgc) {
4862 0 $e_string .= 'Ewindows1258::glob("' . $1 . '")';
4863 }
4864  
4865 # << (bit shift) --- not here document
4866 elsif ($string =~ /\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /oxgc) {
4867 0 $slash = 'm//';
4868 0 $e_string .= $1;
4869 }
4870  
4871 # <<~'HEREDOC'
4872 elsif ($string =~ /\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /oxgc) {
4873 0 $slash = 'm//';
4874 0 my $here_quote = $1;
4875 0 my $delimiter = $2;
4876  
4877 # get here document
4878 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4879 0 $here_script = CORE::substr $_, pos $_;
4880 0 $here_script =~ s/.*?\n//oxm;
4881 }
4882 0 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 0 0 0
4883 0 my $heredoc = $1;
4884 0 my $indent = $2;
4885 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4886 0 push @heredoc, $heredoc . qq{\n$delimiter\n};
4887 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4888 }
4889 else {
4890 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4891 }
4892 0 $e_string .= qq{<<'$delimiter'};
4893 }
4894  
4895 # <<~\HEREDOC
4896 elsif ($string =~ /\G ( <<~ \\([a-zA-Z_0-9]+) ) /oxgc) {
4897 0 $slash = 'm//';
4898 0 my $here_quote = $1;
4899 0 my $delimiter = $2;
4900  
4901 # get here document
4902 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4903 0 $here_script = CORE::substr $_, pos $_;
4904 0 $here_script =~ s/.*?\n//oxm;
4905 }
4906 0 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 0 0 0
4907 0 my $heredoc = $1;
4908 0 my $indent = $2;
4909 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4910 0 push @heredoc, $heredoc . qq{\n$delimiter\n};
4911 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4912 }
4913 else {
4914 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4915 }
4916 0 $e_string .= qq{<<\\$delimiter};
4917 }
4918  
4919 # <<~"HEREDOC"
4920 elsif ($string =~ /\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /oxgc) {
4921 0 $slash = 'm//';
4922 0 my $here_quote = $1;
4923 0 my $delimiter = $2;
4924  
4925 # get here document
4926 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4927 0 $here_script = CORE::substr $_, pos $_;
4928 0 $here_script =~ s/.*?\n//oxm;
4929 }
4930 0 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 0 0 0
4931 0 my $heredoc = $1;
4932 0 my $indent = $2;
4933 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4934 0 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4935 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4936 }
4937 else {
4938 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4939 }
4940 0 $e_string .= qq{<<"$delimiter"};
4941 }
4942  
4943 # <<~HEREDOC
4944 elsif ($string =~ /\G ( <<~ ([a-zA-Z_0-9]+) ) /oxgc) {
4945 0 $slash = 'm//';
4946 0 my $here_quote = $1;
4947 0 my $delimiter = $2;
4948  
4949 # get here document
4950 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4951 0 $here_script = CORE::substr $_, pos $_;
4952 0 $here_script =~ s/.*?\n//oxm;
4953 }
4954 0 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 0 0 0
4955 0 my $heredoc = $1;
4956 0 my $indent = $2;
4957 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4958 0 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4959 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4960 }
4961 else {
4962 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4963 }
4964 0 $e_string .= qq{<<$delimiter};
4965 }
4966  
4967 # <<~`HEREDOC`
4968 elsif ($string =~ /\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /oxgc) {
4969 0 $slash = 'm//';
4970 0 my $here_quote = $1;
4971 0 my $delimiter = $2;
4972  
4973 # get here document
4974 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4975 0 $here_script = CORE::substr $_, pos $_;
4976 0 $here_script =~ s/.*?\n//oxm;
4977 }
4978 0 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 0 0 0
4979 0 my $heredoc = $1;
4980 0 my $indent = $2;
4981 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4982 0 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4983 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4984 }
4985 else {
4986 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4987 }
4988 0 $e_string .= qq{<<`$delimiter`};
4989 }
4990  
4991 # <<'HEREDOC'
4992 elsif ($string =~ /\G ( << '([a-zA-Z_0-9]*)' ) /oxgc) {
4993 0 $slash = 'm//';
4994 0 my $here_quote = $1;
4995 0 my $delimiter = $2;
4996  
4997 # get here document
4998 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4999 0 $here_script = CORE::substr $_, pos $_;
5000 0 $here_script =~ s/.*?\n//oxm;
5001 }
5002 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
5003 0 push @heredoc, $1 . qq{\n$delimiter\n};
5004 0 push @heredoc_delimiter, $delimiter;
5005 }
5006 else {
5007 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5008 }
5009 0 $e_string .= $here_quote;
5010 }
5011  
5012 # <<\HEREDOC
5013 elsif ($string =~ /\G ( << \\([a-zA-Z_0-9]+) ) /oxgc) {
5014 0 $slash = 'm//';
5015 0 my $here_quote = $1;
5016 0 my $delimiter = $2;
5017  
5018 # get here document
5019 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5020 0 $here_script = CORE::substr $_, pos $_;
5021 0 $here_script =~ s/.*?\n//oxm;
5022 }
5023 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
5024 0 push @heredoc, $1 . qq{\n$delimiter\n};
5025 0 push @heredoc_delimiter, $delimiter;
5026 }
5027 else {
5028 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5029 }
5030 0 $e_string .= $here_quote;
5031 }
5032  
5033 # <<"HEREDOC"
5034 elsif ($string =~ /\G ( << "([a-zA-Z_0-9]*)" ) /oxgc) {
5035 0 $slash = 'm//';
5036 0 my $here_quote = $1;
5037 0 my $delimiter = $2;
5038  
5039 # get here document
5040 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5041 0 $here_script = CORE::substr $_, pos $_;
5042 0 $here_script =~ s/.*?\n//oxm;
5043 }
5044 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
5045 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
5046 0 push @heredoc_delimiter, $delimiter;
5047 }
5048 else {
5049 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5050 }
5051 0 $e_string .= $here_quote;
5052 }
5053  
5054 # <<HEREDOC
5055 elsif ($string =~ /\G ( << ([a-zA-Z_0-9]+) ) /oxgc) {
5056 0 $slash = 'm//';
5057 0 my $here_quote = $1;
5058 0 my $delimiter = $2;
5059  
5060 # get here document
5061 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5062 0 $here_script = CORE::substr $_, pos $_;
5063 0 $here_script =~ s/.*?\n//oxm;
5064 }
5065 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
5066 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
5067 0 push @heredoc_delimiter, $delimiter;
5068 }
5069 else {
5070 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5071 }
5072 0 $e_string .= $here_quote;
5073 }
5074  
5075 # <<`HEREDOC`
5076 elsif ($string =~ /\G ( << `([a-zA-Z_0-9]*)` ) /oxgc) {
5077 0 $slash = 'm//';
5078 0 my $here_quote = $1;
5079 0 my $delimiter = $2;
5080  
5081 # get here document
5082 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5083 0 $here_script = CORE::substr $_, pos $_;
5084 0 $here_script =~ s/.*?\n//oxm;
5085 }
5086 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
5087 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
5088 0 push @heredoc_delimiter, $delimiter;
5089 }
5090 else {
5091 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5092 }
5093 0 $e_string .= $here_quote;
5094 }
5095  
5096 # any operator before div
5097 elsif ($string =~ /\G (
5098 -- | \+\+ |
5099 [\)\}\]]
5100  
5101 18 ) /oxgc) { $slash = 'div'; $e_string .= $1; }
5102  
5103 # yada-yada or triple-dot operator
5104 elsif ($string =~ /\G (
5105 \.\.\.
5106  
5107 0 ) /oxgc) { $slash = 'm//'; $e_string .= q{die('Unimplemented')}; }
5108  
5109 # any operator before m//
5110 elsif ($string =~ /\G ((?>
5111  
5112 !~~ | !~ | != | ! |
5113 %= | % |
5114 &&= | && | &= | &\.= | &\. | & |
5115 -= | -> | - |
5116 :(?>\s*)= |
5117 : |
5118 <<>> |
5119 <<= | <=> | <= | < |
5120 == | => | =~ | = |
5121 >>= | >> | >= | > |
5122 \*\*= | \*\* | \*= | \* |
5123 \+= | \+ |
5124 \.\. | \.= | \. |
5125 \/\/= | \/\/ |
5126 \/= | \/ |
5127 \? |
5128 \\ |
5129 \^= | \^\.= | \^\. | \^ |
5130 \b x= |
5131 \|\|= | \|\| | \|= | \|\.= | \|\. | \| |
5132 ~~ | ~\. | ~ |
5133 \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b |
5134 \b(?: print )\b |
5135  
5136 [,;\(\{\[]
5137  
5138 31 )) /oxgc) { $slash = 'm//'; $e_string .= $1; }
5139  
5140 # other any character
5141 131 elsif ($string =~ /\G ($q_char) /oxgc) { $e_string .= $1; }
5142  
5143 # system error
5144 else {
5145 0 die __FILE__, ": Oops, this shouldn't happen!\n";
5146 }
5147 }
5148  
5149 17 return $e_string;
5150 }
5151  
5152 #
5153 # character class
5154 #
5155 1920 ▶sub character_class {
Subroutine character_class: called CC=3 SCAR=11.0
Pod undocumented
5156 1920 my($char,$modifier) = @_;
5157  
5158 1920 ▶ if ($char eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char eq '.') { } 52 1868 1920
5159 52 ▶ if ($modifier =~ /s/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/) { } 17 35 52
5160 17 return '${Ewindows1258::dot_s}';
5161 }
5162 else {
5163 35 return '${Ewindows1258::dot}';
5164 }
5165 }
5166 else {
5167 1868 return Ewindows1258::classic_character_class($char);
5168 }
5169 }
5170  
5171 #
5172 # escape capture ($1, $2, $3, ...)
5173 #
5174 212 ▶sub e_capture {
Subroutine e_capture: called CC=1 SCAR=0.0
Pod undocumented
5175  
5176 212 return join '', '${', $_[0], '}';
5177 }
5178  
5179 #
5180 # escape transliteration (tr/// or y///)
5181 #
5182 4 ▶sub e_tr {
Subroutine e_tr: called CC=5 SCAR=16.8
Pod undocumented
5183 4 my($variable,$charclass,$e,$charclass2,$modifier) = @_;
5184 4 my $e_tr = '';
5185 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
5186  
5187 4 $slash = 'div';
5188  
5189 # quote character class 1
5190 4 $charclass = q_tr($charclass);
5191  
5192 # quote character class 2
5193 4 $charclass2 = q_tr($charclass2);
5194  
5195 # /b /B modifier
5196 4 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) { } 0 4 4
5197 0 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq '') { } 0 0 0
5198 0 $e_tr = qq{tr$charclass$e$charclass2$modifier};
5199 }
5200 else {
5201 0 $e_tr = qq{$variable${bind_operator}tr$charclass$e$charclass2$modifier};
5202 }
5203 }
5204 else {
5205 4 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq '') { } 2 2 4
5206 2 $e_tr = qq{Ewindows1258::tr(\$_,' =~ ',$charclass,$e$charclass2,'$modifier')};
5207 }
5208 else {
5209 2 $e_tr = qq{Ewindows1258::tr($variable,'$bind_operator',$charclass,$e$charclass2,'$modifier')};
5210 }
5211 }
5212  
5213 # clear tr/// variable
5214 4 $tr_variable = '';
5215 4 $bind_operator = '';
5216  
5217 4 return $e_tr;
5218 }
5219  
5220 #
5221 # quote for escape transliteration (tr/// or y///)
5222 #
5223 8 ▶sub q_tr {
Subroutine q_tr: called CC=9 SCAR=40.6
Pod undocumented
5224 8 my($charclass) = @_;
5225  
5226 # quote character class
5227 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
5228 8 return e_q('', "'", "'", $charclass); # --> q' '
5229 }
5230 elsif ($charclass !~ /\//oxms) {
5231 0 return e_q('q', '/', '/', $charclass); # --> q/ /
5232 }
5233 elsif ($charclass !~ /\#/oxms) {
5234 0 return e_q('q', '#', '#', $charclass); # --> q# #
5235 }
5236 elsif ($charclass !~ /[\<\>]/oxms) {
5237 0 return e_q('q', '<', '>', $charclass); # --> q< >
5238 }
5239 elsif ($charclass !~ /[\(\)]/oxms) {
5240 0 return e_q('q', '(', ')', $charclass); # --> q( )
5241 }
5242 elsif ($charclass !~ /[\{\}]/oxms) {
5243 0 return e_q('q', '{', '}', $charclass); # --> q{ }
5244 }
5245 else {
5246 0 for my $char (qw( ! " $ % & * + . : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5247 0 ▶ if ($charclass !~ /\Q$char\E/xms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($charclass =~ /\Q$char\E/msx) 0 0 0
5248 0 return e_q('q', $char, $char, $charclass);
5249 }
5250 }
5251 }
5252  
5253 0 return e_q('q', '{', '}', $charclass);
5254 }
5255  
5256 #
5257 # escape q string (q//, '')
5258 #
5259 1623 ▶sub e_q {
Subroutine e_q: called CC=1 SCAR=0.0
Pod undocumented
5260 1623 my($ope,$delimiter,$end_delimiter,$string) = @_;
5261  
5262 1623 $slash = 'div';
5263  
5264 1623 return join '', $ope, $delimiter, $string, $end_delimiter;
5265 }
5266  
5267 #
5268 # escape qq string (qq//, "", qx//, ``)
5269 #
5270 4189 ▶sub e_qq {
Subroutine e_qq: called CC=37 SCAR=50.9
Pod undocumented
5271 4189 my($ope,$delimiter,$end_delimiter,$string) = @_;
5272  
5273 4189 $slash = 'div';
5274  
5275 4189 my $left_e = 0;
5276 4189 my $right_e = 0;
5277  
5278 # split regexp
5279 4189 my @char = $string =~ /\G((?>
5280 [^\\\$] |
5281 \\x\{ (?>[0-9A-Fa-f]+) \} |
5282 \\o\{ (?>[0-7]+) \} |
5283 \\N\{ (?>[^0-9\}][^\}]*) \} |
5284 \\ $q_char |
5285 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5286 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5287 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5288 \$ (?>\s* [0-9]+) |
5289 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5290 \$ \$ (?![\w\{]) |
5291 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5292 $q_char
5293 ))/oxmsg;
5294  
5295 4189 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 117610 4189 121799
5296  
5297 # "\L\u" --> "\u\L"
5298 117610 ▶ 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 117610 117610
elsif ($char[$i] eq '\\U' and $char[$i + 1] eq '\\l') { } 0 117610 117610
elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/mosx) { } 1 117609 117610
elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/mosx) { } 1 117608 117609
elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/mosx) { } 0 117608 117608
Condition33%1/3
$char[$i] eq "\\L" and $char[$i + 1] eq "\\u"
!ll&&!rl&&r
11761000
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
5299 0 @char[$i,$i+1] = @char[$i+1,$i];
5300 }
5301  
5302 # "\U\l" --> "\l\U"
5303 ▶ 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
11761000
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
5304 0 @char[$i,$i+1] = @char[$i+1,$i];
5305 }
5306  
5307 # octal escape sequence
5308 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5309 1 $char[$i] = Ewindows1258::octchr($1);
5310 }
5311  
5312 # hexadecimal escape sequence
5313 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5314 1 $char[$i] = Ewindows1258::hexchr($1);
5315 }
5316  
5317 # \N{CHARNAME} --> N{CHARNAME}
5318 elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5319 0 $char[$i] = $1;
5320 }
5321  
5322 117610 ▶ if (0) {
Branch: 23 branches
BranchTrueFalseTotal
if (do { $char[$i] =~ /\A ([<>]) \z/mosx }) { } 484 117126 117610
elsif ($char[$i] eq '\\u') { } 0 117126 117126
elsif ($char[$i] eq '\\l') { } 0 117126 117126
elsif ($char[$i] eq '\\U') { } 0 117126 117126
elsif ($char[$i] eq '\\L') { } 0 117126 117126
elsif ($char[$i] eq '\\F') { } 24 117102 117126
elsif ($char[$i] eq '\\Q') { } 0 117102 117102
elsif ($char[$i] eq '\\E') { } 24 117078 117102
elsif ($char[$i] eq '\\Q') { } 0 117078 117078
elsif ($char[$i] eq '\\E') { } 0 117078 117078
elsif ($char[$i] =~ /\A \$ 0 \z/mosx) { } 4 117074 117078
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/mosx) { } 0 117074 117074
elsif ($char[$i] =~ /\A \$\$ \z/mosx) { } 0 117074 117074
elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/mosx) { } 205 116869 117074
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/mosx) { } 0 116869 116869
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/mosx) { } 0 116869 116869
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/mosx) { } 0 116869 116869
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/mosx) { } 0 116869 116869
elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/cgmosx) { } 44 116825 116869
elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/cgmosx) { } 45 116780 116825
elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/cgmosx) { } 33 116747 116780
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/mosx) { } 0 116747 116747
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/mosx) { } 0 116747 116747
5323 }
5324  
5325 # \F
5326 #
5327 # P.69 Table 2-6. Translation escapes
5328 # in Chapter 2: Bits and Pieces
5329 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
5330 # (and so on)
5331  
5332 # \u \l \U \L \F \Q \E
5333 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
5334 484 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 484 484
5335 0 $char[$i] = '\\' . $char[$i];
5336 }
5337 }
5338 elsif ($char[$i] eq '\u') {
5339  
5340 # "STRING @{[ LIST EXPR ]} MORE STRING"
5341  
5342 # P.257 Other Tricks You Can Do with Hard References
5343 # in Chapter 8: References
5344 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
5345  
5346 # P.353 Other Tricks You Can Do with Hard References
5347 # in Chapter 8: References
5348 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
5349  
5350 # (and so on)
5351  
5352 0 $char[$i] = '@{[Ewindows1258::ucfirst qq<';
5353 0 $left_e++;
5354 }
5355 elsif ($char[$i] eq '\l') {
5356 0 $char[$i] = '@{[Ewindows1258::lcfirst qq<';
5357 0 $left_e++;
5358 }
5359 elsif ($char[$i] eq '\U') {
5360 0 $char[$i] = '@{[Ewindows1258::uc qq<';
5361 0 $left_e++;
5362 }
5363 elsif ($char[$i] eq '\L') {
5364 0 $char[$i] = '@{[Ewindows1258::lc qq<';
5365 0 $left_e++;
5366 }
5367 elsif ($char[$i] eq '\F') {
5368 24 $char[$i] = '@{[Ewindows1258::fc qq<';
5369 24 $left_e++;
5370 }
5371 elsif ($char[$i] eq '\Q') {
5372 0 $char[$i] = '@{[CORE::quotemeta qq<';
5373 0 $left_e++;
5374 }
5375 elsif ($char[$i] eq '\E') {
5376 24 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 24 0 24
5377 24 $char[$i] = '>]}';
5378 24 $right_e++;
5379 }
5380 else {
5381 0 $char[$i] = '';
5382 }
5383 }
5384 elsif ($char[$i] eq '\Q') {
5385 0 while (1) {
5386 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5387 0 last;
5388 }
5389 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
5390 0 last;
5391 }
5392 }
5393 }
5394 elsif ($char[$i] eq '\E') {
5395 }
5396  
5397 # $0 --> $0
5398 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
5399 }
5400 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
5401 }
5402  
5403 # $$ --> $$
5404 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
5405 }
5406  
5407 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
5408 # $1, $2, $3 --> $1, $2, $3 otherwise
5409 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
5410 205 $char[$i] = e_capture($1);
5411 }
5412 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
5413 0 $char[$i] = e_capture($1);
5414 }
5415  
5416 # $$foo[ ... ] --> $ $foo->[ ... ]
5417 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
5418 0 $char[$i] = e_capture($1.'->'.$2);
5419 }
5420  
5421 # $$foo{ ... } --> $ $foo->{ ... }
5422 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
5423 0 $char[$i] = e_capture($1.'->'.$2);
5424 }
5425  
5426 # $$foo
5427 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
5428 0 $char[$i] = e_capture($1);
5429 }
5430  
5431 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Ewindows1258::PREMATCH()
5432 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
5433 44 $char[$i] = '@{[Ewindows1258::PREMATCH()]}';
5434 }
5435  
5436 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Ewindows1258::MATCH()
5437 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
5438 45 $char[$i] = '@{[Ewindows1258::MATCH()]}';
5439 }
5440  
5441 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Ewindows1258::POSTMATCH()
5442 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
5443 33 $char[$i] = '@{[Ewindows1258::POSTMATCH()]}';
5444 }
5445  
5446 # ${ foo } --> ${ foo }
5447 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/oxms) {
5448 }
5449  
5450 # ${ ... }
5451 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5452 0 $char[$i] = e_capture($1);
5453 }
5454 }
5455  
5456 # return string
5457 4189 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 4189 4189
5458 0 return join '', $ope, $delimiter, @char, '>]}' x ($left_e - $right_e), $end_delimiter;
5459 }
5460 4189 return join '', $ope, $delimiter, @char, $end_delimiter;
5461 }
5462  
5463 #
5464 # escape qw string (qw//)
5465 #
5466 16 ▶sub e_qw {
Subroutine e_qw: called CC=11 SCAR=43.1
Pod undocumented
5467 16 my($ope,$delimiter,$end_delimiter,$string) = @_;
5468  
5469 16 $slash = 'div';
5470  
5471 # choice again delimiter
5472 16 my %octet = map {$_ => 1} ($string =~ /\G ([\x00-\xFF]) /oxmsg);
5473 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
5474 16 return join '', $ope, $delimiter, $string, $end_delimiter;
5475 }
5476 elsif (not $octet{')'}) {
5477 0 return join '', $ope, '(', $string, ')';
5478 }
5479 elsif (not $octet{'}'}) {
5480 0 return join '', $ope, '{', $string, '}';
5481 }
5482 elsif (not $octet{']'}) {
5483 0 return join '', $ope, '[', $string, ']';
5484 }
5485 elsif (not $octet{'>'}) {
5486 0 return join '', $ope, '<', $string, '>';
5487 }
5488 else {
5489 0 for my $char (qw( ! " $ % & * + - . / : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5490 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5491 0 return join '', $ope, $char, $string, $char;
5492 }
5493 }
5494 }
5495  
5496 # qw/AAA BBB C'CC/ --> ('AAA', 'BBB', 'C\'CC')
5497 0 my @string = CORE::split(/\s+/, $string);
5498 0 for my $string (@string) {
5499 0 my @octet = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5500 0 for my $octet (@octet) {
5501 0 ▶ if ($octet =~ /\A (['\\]) \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($octet =~ /\A (['\\]) \z/mosx) 0 0 0
5502 0 $octet = '\\' . $1;
5503 }
5504 }
5505 0 $string = join '', @octet;
5506 }
5507 0 return join '', '(', (join ', ', map { "'$_'" } @string), ')';
5508 }
5509  
5510 #
5511 # escape here document (<<"HEREDOC", <<HEREDOC, <<`HEREDOC`, <<~"HEREDOC", <<~HEREDOC, <<~`HEREDOC`)
5512 #
5513 93 ▶sub e_heredoc {
Subroutine e_heredoc: called CC=37 SCAR=56.3
Pod undocumented
5514 93 my($string) = @_;
5515  
5516 93 $slash = 'm//';
5517  
5518 93 my $metachar = qr/[\@\\|]/oxms; # '|' is for <<`HEREDOC`
5519  
5520 93 my $left_e = 0;
5521 93 my $right_e = 0;
5522  
5523 # split regexp
5524 93 my @char = $string =~ /\G((?>
5525 [^\\\$] |
5526 \\x\{ (?>[0-9A-Fa-f]+) \} |
5527 \\o\{ (?>[0-7]+) \} |
5528 \\N\{ (?>[^0-9\}][^\}]*) \} |
5529 \\ $q_char |
5530 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5531 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5532 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5533 \$ (?>\s* [0-9]+) |
5534 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5535 \$ \$ (?![\w\{]) |
5536 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5537 $q_char
5538 ))/oxmsg;
5539  
5540 93 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 3307 93 3400
5541  
5542 # "\L\u" --> "\u\L"
5543 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
5544 0 @char[$i,$i+1] = @char[$i+1,$i];
5545 }
5546  
5547 # "\U\l" --> "\l\U"
5548 ▶ 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
5549 0 @char[$i,$i+1] = @char[$i+1,$i];
5550 }
5551  
5552 # octal escape sequence
5553 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5554 1 $char[$i] = Ewindows1258::octchr($1);
5555 }
5556  
5557 # hexadecimal escape sequence
5558 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5559 1 $char[$i] = Ewindows1258::hexchr($1);
5560 }
5561  
5562 # \N{CHARNAME} --> N{CHARNAME}
5563 elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5564 0 $char[$i] = $1;
5565 }
5566  
5567 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
5568 }
5569  
5570 # \u \l \U \L \F \Q \E
5571 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
5572 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
5573 0 $char[$i] = '\\' . $char[$i];
5574 }
5575 }
5576 elsif ($char[$i] eq '\u') {
5577 0 $char[$i] = '@{[Ewindows1258::ucfirst qq<';
5578 0 $left_e++;
5579 }
5580 elsif ($char[$i] eq '\l') {
5581 0 $char[$i] = '@{[Ewindows1258::lcfirst qq<';
5582 0 $left_e++;
5583 }
5584 elsif ($char[$i] eq '\U') {
5585 0 $char[$i] = '@{[Ewindows1258::uc qq<';
5586 0 $left_e++;
5587 }
5588 elsif ($char[$i] eq '\L') {
5589 0 $char[$i] = '@{[Ewindows1258::lc qq<';
5590 0 $left_e++;
5591 }
5592 elsif ($char[$i] eq '\F') {
5593 0 $char[$i] = '@{[Ewindows1258::fc qq<';
5594 0 $left_e++;
5595 }
5596 elsif ($char[$i] eq '\Q') {
5597 0 $char[$i] = '@{[CORE::quotemeta qq<';
5598 0 $left_e++;
5599 }
5600 elsif ($char[$i] eq '\E') {
5601 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
5602 0 $char[$i] = '>]}';
5603 0 $right_e++;
5604 }
5605 else {
5606 0 $char[$i] = '';
5607 }
5608 }
5609 elsif ($char[$i] eq '\Q') {
5610 0 while (1) {
5611 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5612 0 last;
5613 }
5614 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
5615 0 last;
5616 }
5617 }
5618 }
5619 elsif ($char[$i] eq '\E') {
5620 }
5621  
5622 # $0 --> $0
5623 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
5624 }
5625 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
5626 }
5627  
5628 # $$ --> $$
5629 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
5630 }
5631  
5632 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
5633 # $1, $2, $3 --> $1, $2, $3 otherwise
5634 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
5635 0 $char[$i] = e_capture($1);
5636 }
5637 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
5638 0 $char[$i] = e_capture($1);
5639 }
5640  
5641 # $$foo[ ... ] --> $ $foo->[ ... ]
5642 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
5643 0 $char[$i] = e_capture($1.'->'.$2);
5644 }
5645  
5646 # $$foo{ ... } --> $ $foo->{ ... }
5647 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
5648 0 $char[$i] = e_capture($1.'->'.$2);
5649 }
5650  
5651 # $$foo
5652 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
5653 0 $char[$i] = e_capture($1);
5654 }
5655  
5656 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Ewindows1258::PREMATCH()
5657 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
5658 8 $char[$i] = '@{[Ewindows1258::PREMATCH()]}';
5659 }
5660  
5661 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Ewindows1258::MATCH()
5662 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
5663 8 $char[$i] = '@{[Ewindows1258::MATCH()]}';
5664 }
5665  
5666 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Ewindows1258::POSTMATCH()
5667 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
5668 6 $char[$i] = '@{[Ewindows1258::POSTMATCH()]}';
5669 }
5670  
5671 # ${ foo } --> ${ foo }
5672 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/oxms) {
5673 }
5674  
5675 # ${ ... }
5676 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5677 0 $char[$i] = e_capture($1);
5678 }
5679 }
5680  
5681 # return string
5682 93 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 93 93
5683 0 return join '', @char, '>]}' x ($left_e - $right_e);
5684 }
5685 93 return join '', @char;
5686 }
5687  
5688 #
5689 # escape regexp (m//, qr//)
5690 #
5691 880 ▶sub e_qr {
Subroutine e_qr: called CC=110 SCAR=73.6
Pod undocumented
5692 880 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5693 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
5694  
5695 880 $modifier =~ tr/p//d;
5696 880 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 880 880
5697 0 my $line = 0;
5698 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
5699 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
5700 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
5701 0 last;
5702 }
5703 }
5704 0 die qq{Unsupported modifier "$1" used at line $line.\n};
5705 }
5706  
5707 880 $slash = 'div';
5708  
5709 # literal null string pattern
5710 880 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 872 880
elsif ($modifier =~ tr/Bb//d) { } 2 870 872
5711 8 $modifier =~ tr/bB//d;
5712 8 $modifier =~ tr/i//d;
5713 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
5714 }
5715  
5716 # /b /B modifier
5717 elsif ($modifier =~ tr/bB//d) {
5718  
5719 # choice again delimiter
5720 2 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 2 2
5721 0 my @char = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5722 0 my %octet = map {$_ => 1} @char;
5723 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
5724 0 $delimiter = '(';
5725 0 $end_delimiter = ')';
5726 }
5727 elsif (not $octet{'}'}) {
5728 0 $delimiter = '{';
5729 0 $end_delimiter = '}';
5730 }
5731 elsif (not $octet{']'}) {
5732 0 $delimiter = '[';
5733 0 $end_delimiter = ']';
5734 }
5735 elsif (not $octet{'>'}) {
5736 0 $delimiter = '<';
5737 0 $end_delimiter = '>';
5738 }
5739 else {
5740 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5741 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5742 0 $delimiter = $char;
5743 0 $end_delimiter = $char;
5744 0 last;
5745 }
5746 }
5747 }
5748 }
5749  
5750 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
5751 0 return join '', $ope, $delimiter, $string, $matched, $end_delimiter, $modifier;
5752 }
5753 else {
5754 2 return join '', $ope, $delimiter, '(?:', $string, ')', $matched, $end_delimiter, $modifier;
5755 }
5756 }
5757  
5758 870 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 312 558 870
5759 870 my $metachar = qr/[\@\\|[\]{^]/oxms;
5760  
5761 # split regexp
5762 870 my @char = $string =~ /\G((?>
5763 [^\\\$\@\[\(] |
5764 \\x (?>[0-9A-Fa-f]{1,2}) |
5765 \\ (?>[0-7]{2,3}) |
5766 \\c [\x40-\x5F] |
5767 \\x\{ (?>[0-9A-Fa-f]+) \} |
5768 \\o\{ (?>[0-7]+) \} |
5769 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
5770 \\ $q_char |
5771 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5772 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5773 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5774 [\$\@] $qq_variable |
5775 \$ (?>\s* [0-9]+) |
5776 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5777 \$ \$ (?![\w\{]) |
5778 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5779 \[\^ |
5780 \[\: (?>[a-z]+) :\] |
5781 \[\:\^ (?>[a-z]+) :\] |
5782 \(\? |
5783 $q_char
5784 ))/oxmsg;
5785  
5786 # choice again delimiter
5787 870 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 870 870
5788 0 my %octet = map {$_ => 1} @char;
5789 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
5790 0 $delimiter = '(';
5791 0 $end_delimiter = ')';
5792 }
5793 elsif (not $octet{'}'}) {
5794 0 $delimiter = '{';
5795 0 $end_delimiter = '}';
5796 }
5797 elsif (not $octet{']'}) {
5798 0 $delimiter = '[';
5799 0 $end_delimiter = ']';
5800 }
5801 elsif (not $octet{'>'}) {
5802 0 $delimiter = '<';
5803 0 $end_delimiter = '>';
5804 }
5805 else {
5806 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5807 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5808 0 $delimiter = $char;
5809 0 $end_delimiter = $char;
5810 0 last;
5811 }
5812 }
5813 }
5814 }
5815  
5816 870 my $left_e = 0;
5817 870 my $right_e = 0;
5818 870 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 2100 870 2970
5819  
5820 # "\L\u" --> "\u\L"
5821 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
5822 0 @char[$i,$i+1] = @char[$i+1,$i];
5823 }
5824  
5825 # "\U\l" --> "\l\U"
5826 ▶ 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
5827 0 @char[$i,$i+1] = @char[$i+1,$i];
5828 }
5829  
5830 # octal escape sequence
5831 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5832 1 $char[$i] = Ewindows1258::octchr($1);
5833 }
5834  
5835 # hexadecimal escape sequence
5836 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5837 1 $char[$i] = Ewindows1258::hexchr($1);
5838 }
5839  
5840 # \b{...} --> b\{...}
5841 # \B{...} --> B\{...}
5842 # \N{CHARNAME} --> N\{CHARNAME}
5843 # \p{PROPERTY} --> p\{PROPERTY}
5844 # \P{PROPERTY} --> P\{PROPERTY}
5845 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5846 6 $char[$i] = $1 . '\\' . $2;
5847 }
5848  
5849 # \p, \P, \X --> p, P, X
5850 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
5851 4 $char[$i] = $1;
5852 }
5853  
5854 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
5855 }
5856  
5857 # join separated multiple-octet
5858 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
5859 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
5860 0 $char[$i] .= join '', splice @char, $i+1, 3;
5861 }
5862 ▶ 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
5863 0 $char[$i] .= join '', splice @char, $i+1, 2;
5864 }
5865 ▶ 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
5866 0 $char[$i] .= join '', splice @char, $i+1, 1;
5867 }
5868 }
5869  
5870 # open character class [...]
5871 elsif ($char[$i] eq '[') {
5872 556 my $left = $i;
5873  
5874 # [] make die "Unmatched [] in regexp ...\n"
5875 # (and so on)
5876  
5877 556 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 3 553 556
5878 3 $i++;
5879 }
5880  
5881 556 while (1) {
5882 2063 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 2063 2063
5883 0 die __FILE__, ": Unmatched [] in regexp\n";
5884 }
5885 2063 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 556 1507 2063
5886 556 my $right = $i;
5887  
5888 # [...]
5889 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
5890 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);
5891 }
5892 else {
5893 526 splice @char, $left, $right-$left+1, Ewindows1258::charlist_qr(@char[$left+1..$right-1], $modifier);
5894 }
5895  
5896 556 $i = $left;
5897 556 last;
5898 }
5899 }
5900 }
5901  
5902 # open character class [^...]
5903 elsif ($char[$i] eq '[^') {
5904 74 my $left = $i;
5905  
5906 # [^] make die "Unmatched [] in regexp ...\n"
5907 # (and so on)
5908  
5909 74 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 4 70 74
5910 4 $i++;
5911 }
5912  
5913 74 while (1) {
5914 272 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 272 272
5915 0 die __FILE__, ": Unmatched [] in regexp\n";
5916 }
5917 272 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 74 198 272
5918 74 my $right = $i;
5919  
5920 # [^...]
5921 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
5922 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);
5923 }
5924 else {
5925 44 splice @char, $left, $right-$left+1, Ewindows1258::charlist_not_qr(@char[$left+1..$right-1], $modifier);
5926 }
5927  
5928 74 $i = $left;
5929 74 last;
5930 }
5931 }
5932 }
5933  
5934 # rewrite character class or escape character
5935 elsif (my $char = character_class($char[$i],$modifier)) {
5936 139 $char[$i] = $char;
5937 }
5938  
5939 # /i modifier
5940 ▶ 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
5941 20 ▶ if (CORE::length(Ewindows1258::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 20 0 20
5942 20 $char[$i] = '[' . Ewindows1258::uc($char[$i]) . Ewindows1258::fc($char[$i]) . ']';
5943 }
5944 else {
5945 0 $char[$i] = '(?:' . Ewindows1258::uc($char[$i]) . '|' . Ewindows1258::fc($char[$i]) . ')';
5946 }
5947 }
5948  
5949 # \u \l \U \L \F \Q \E
5950 elsif ($char[$i] =~ /\A [<>] \z/oxms) {
5951 1 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 1 1
5952 0 $char[$i] = '\\' . $char[$i];
5953 }
5954 }
5955 elsif ($char[$i] eq '\u') {
5956 0 $char[$i] = '@{[Ewindows1258::ucfirst qq<';
5957 0 $left_e++;
5958 }
5959 elsif ($char[$i] eq '\l') {
5960 0 $char[$i] = '@{[Ewindows1258::lcfirst qq<';
5961 0 $left_e++;
5962 }
5963 elsif ($char[$i] eq '\U') {
5964 1 $char[$i] = '@{[Ewindows1258::uc qq<';
5965 1 $left_e++;
5966 }
5967 elsif ($char[$i] eq '\L') {
5968 1 $char[$i] = '@{[Ewindows1258::lc qq<';
5969 1 $left_e++;
5970 }
5971 elsif ($char[$i] eq '\F') {
5972 18 $char[$i] = '@{[Ewindows1258::fc qq<';
5973 18 $left_e++;
5974 }
5975 elsif ($char[$i] eq '\Q') {
5976 1 $char[$i] = '@{[CORE::quotemeta qq<';
5977 1 $left_e++;
5978 }
5979 elsif ($char[$i] eq '\E') {
5980 21 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 21 0 21
5981 21 $char[$i] = '>]}';
5982 21 $right_e++;
5983 }
5984 else {
5985 0 $char[$i] = '';
5986 }
5987 }
5988 elsif ($char[$i] eq '\Q') {
5989 0 while (1) {
5990 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5991 0 last;
5992 }
5993 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
5994 0 last;
5995 }
5996 }
5997 }
5998 elsif ($char[$i] eq '\E') {
5999 }
6000  
6001 # $0 --> $0
6002 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
6003 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6004 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
6005 }
6006 }
6007 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
6008 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6009 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
6010 }
6011 }
6012  
6013 # $$ --> $$
6014 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
6015 }
6016  
6017 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
6018 # $1, $2, $3 --> $1, $2, $3 otherwise
6019 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
6020 0 $char[$i] = e_capture($1);
6021 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6022 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
6023 }
6024 }
6025 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6026 0 $char[$i] = e_capture($1);
6027 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6028 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
6029 }
6030 }
6031  
6032 # $$foo[ ... ] --> $ $foo->[ ... ]
6033 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
6034 0 $char[$i] = e_capture($1.'->'.$2);
6035 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6036 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
6037 }
6038 }
6039  
6040 # $$foo{ ... } --> $ $foo->{ ... }
6041 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
6042 0 $char[$i] = e_capture($1.'->'.$2);
6043 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6044 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
6045 }
6046 }
6047  
6048 # $$foo
6049 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
6050 0 $char[$i] = e_capture($1);
6051 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6052 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
6053 }
6054 }
6055  
6056 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Ewindows1258::PREMATCH()
6057 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
6058 8 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 8 8
6059 0 $char[$i] = '@{[Ewindows1258::ignorecase(Ewindows1258::PREMATCH())]}';
6060 }
6061 else {
6062 8 $char[$i] = '@{[Ewindows1258::PREMATCH()]}';
6063 }
6064 }
6065  
6066 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Ewindows1258::MATCH()
6067 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
6068 8 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 8 8
6069 0 $char[$i] = '@{[Ewindows1258::ignorecase(Ewindows1258::MATCH())]}';
6070 }
6071 else {
6072 8 $char[$i] = '@{[Ewindows1258::MATCH()]}';
6073 }
6074 }
6075  
6076 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Ewindows1258::POSTMATCH()
6077 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
6078 6 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 6 6
6079 0 $char[$i] = '@{[Ewindows1258::ignorecase(Ewindows1258::POSTMATCH())]}';
6080 }
6081 else {
6082 6 $char[$i] = '@{[Ewindows1258::POSTMATCH()]}';
6083 }
6084 }
6085  
6086 # ${ foo }
6087 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
6088 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6089 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
6090 }
6091 }
6092  
6093 # ${ ... }
6094 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
6095 0 $char[$i] = e_capture($1);
6096 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6097 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
6098 }
6099 }
6100  
6101 # $scalar or @array
6102 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
6103 21 $char[$i] = e_string($char[$i]);
6104 21 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 11 10 21
6105 11 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
6106 }
6107 }
6108  
6109 # quote character before ? + * {
6110 ▶ 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
6111 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
6112 }
6113 ▶ 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
6114 0 my $char = $char[$i-1];
6115 0 ▶ if ($char[$i] eq '{') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq '{') { } 0 0 0
6116 0 die __FILE__, qq{: "MULTIBYTE{n}" should be "(MULTIBYTE){n}" in m?? (and shift \$1,\$2,\$3,...) ($char){n}\n};
6117 }
6118 else {
6119 0 die __FILE__, qq{: "MULTIBYTE$char[$i]" should be "(MULTIBYTE)$char[$i]" in m?? (and shift \$1,\$2,\$3,...) ($char)$char[$i]\n};
6120 }
6121 }
6122 else {
6123 127 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6124 }
6125 }
6126 }
6127  
6128 # make regexp string
6129 870 $modifier =~ tr/i//d;
6130 870 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 870 870
6131 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
6132 0 return join '', $ope, $delimiter, $anchor, @char, '>]}' x ($left_e - $right_e), $matched, $end_delimiter, $modifier;
6133 }
6134 else {
6135 0 return join '', $ope, $delimiter, $anchor, '(?:', @char, '>]}' x ($left_e - $right_e), ')', $matched, $end_delimiter, $modifier;
6136 }
6137 }
6138 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
6139 0 return join '', $ope, $delimiter, $anchor, @char, $matched, $end_delimiter, $modifier;
6140 }
6141 else {
6142 870 return join '', $ope, $delimiter, $anchor, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6143 }
6144 }
6145  
6146 #
6147 # double quote stuff
6148 #
6149 180 ▶sub qq_stuff {
Subroutine qq_stuff: called CC=6 SCAR=18.5
Pod undocumented
6150 180 my($delimiter,$end_delimiter,$stuff) = @_;
6151  
6152 # scalar variable or array variable
6153 180 ▶ if ($stuff =~ /\A [\$\@] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($stuff =~ /\A [\$\@] /mosx) 100 80 180
6154 100 return $stuff;
6155 }
6156  
6157 # quote by delimiter
6158 80 my %octet = map {$_ => 1} ($stuff =~ /\G ([\x00-\xFF]) /oxmsg);
6159 80 for my $char (qw( ! " $ % & * + - . / : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
6160 80 ▶ next if $char eq $delimiter;
Branch: 1 branch
BranchTrueFalseTotal
if $char eq $delimiter 0 80 80
6161 80 ▶ next if $char eq $end_delimiter;
Branch: 1 branch
BranchTrueFalseTotal
if $char eq $end_delimiter 0 80 80
6162 80 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 80 0 80
6163 80 return join '', 'qq', $char, $stuff, $char;
6164 }
6165 }
6166 0 return join '', 'qq', '<', $stuff, '>';
6167 }
6168  
6169 #
6170 # escape regexp (m'', qr'', and m''b, qr''b)
6171 #
6172 10 ▶sub e_qr_q {
Subroutine e_qr_q: called CC=7 SCAR=25.3
Pod undocumented
6173 10 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6174 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
6175  
6176 10 $modifier =~ tr/p//d;
6177 10 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 10 10
6178 0 my $line = 0;
6179 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6180 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6181 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6182 0 last;
6183 }
6184 }
6185 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6186 }
6187  
6188 10 $slash = 'div';
6189  
6190 # literal null string pattern
6191 10 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 2 10
elsif ($modifier =~ tr/Bb//d) { } 0 2 2
6192 8 $modifier =~ tr/bB//d;
6193 8 $modifier =~ tr/i//d;
6194 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
6195 }
6196  
6197 # with /b /B modifier
6198 elsif ($modifier =~ tr/bB//d) {
6199 0 return e_qr_qb($ope,$delimiter,$end_delimiter,$string,$modifier);
6200 }
6201  
6202 # without /b /B modifier
6203 else {
6204 2 return e_qr_qt($ope,$delimiter,$end_delimiter,$string,$modifier);
6205 }
6206 }
6207  
6208 #
6209 # escape regexp (m'', qr'')
6210 #
6211 2 ▶sub e_qr_qt {
Subroutine e_qr_qt: called CC=20 SCAR=51.8
Pod undocumented
6212 2 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6213  
6214 2 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 2 2
6215  
6216 # split regexp
6217 2 my @char = $string =~ /\G((?>
6218 [^\\\[\$\@\/] |
6219 [\x00-\xFF] |
6220 \[\^ |
6221 \[\: (?>[a-z]+) \:\] |
6222 \[\:\^ (?>[a-z]+) \:\] |
6223 [\$\@\/] |
6224 \\ (?:$q_char) |
6225 (?:$q_char)
6226 ))/oxmsg;
6227  
6228 # unescape character
6229 2 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 2 2 4
6230 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
6231 }
6232  
6233 # open character class [...]
6234 elsif ($char[$i] eq '[') {
6235 0 my $left = $i;
6236 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6237 0 $i++;
6238 }
6239 0 while (1) {
6240 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6241 0 die __FILE__, ": Unmatched [] in regexp\n";
6242 }
6243 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6244 0 my $right = $i;
6245  
6246 # [...]
6247 0 splice @char, $left, $right-$left+1, Ewindows1258::charlist_qr(@char[$left+1..$right-1], $modifier);
6248  
6249 0 $i = $left;
6250 0 last;
6251 }
6252 }
6253 }
6254  
6255 # open character class [^...]
6256 elsif ($char[$i] eq '[^') {
6257 0 my $left = $i;
6258 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6259 0 $i++;
6260 }
6261 0 while (1) {
6262 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6263 0 die __FILE__, ": Unmatched [] in regexp\n";
6264 }
6265 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6266 0 my $right = $i;
6267  
6268 # [^...]
6269 0 splice @char, $left, $right-$left+1, Ewindows1258::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6270  
6271 0 $i = $left;
6272 0 last;
6273 }
6274 }
6275 }
6276  
6277 # escape $ @ / and \
6278 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6279 0 $char[$i] = '\\' . $char[$i];
6280 }
6281  
6282 # rewrite character class or escape character
6283 elsif (my $char = character_class($char[$i],$modifier)) {
6284 0 $char[$i] = $char;
6285 }
6286  
6287 # /i modifier
6288 ▶ 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
6289 0 ▶ if (CORE::length(Ewindows1258::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
6290 0 $char[$i] = '[' . Ewindows1258::uc($char[$i]) . Ewindows1258::fc($char[$i]) . ']';
6291 }
6292 else {
6293 0 $char[$i] = '(?:' . Ewindows1258::uc($char[$i]) . '|' . Ewindows1258::fc($char[$i]) . ')';
6294 }
6295 }
6296  
6297 # quote character before ? + * {
6298 ▶ 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
6299 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
6300 }
6301 else {
6302 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6303 }
6304 }
6305 }
6306  
6307 2 $delimiter = '/';
6308 2 $end_delimiter = '/';
6309  
6310 2 $modifier =~ tr/i//d;
6311 2 return join '', $ope, $delimiter, $anchor, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6312 }
6313  
6314 #
6315 # escape regexp (m''b, qr''b)
6316 #
6317 0 ▶sub e_qr_qb {
Subroutine e_qr_qb: not called CC=4 SCAR=30.0
Pod undocumented
6318 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6319  
6320 # split regexp
6321 0 my @char = $string =~ /\G ((?>[^\\]|\\\\)) /oxmsg;
6322  
6323 # unescape character
6324 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
6325 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
6326 }
6327  
6328 # remain \\
6329 elsif ($char[$i] eq '\\\\') {
6330 }
6331  
6332 # escape $ @ / and \
6333 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6334 0 $char[$i] = '\\' . $char[$i];
6335 }
6336 }
6337  
6338 0 $delimiter = '/';
6339 0 $end_delimiter = '/';
6340 0 return join '', $ope, $delimiter, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6341 }
6342  
6343 #
6344 # escape regexp (s/here//)
6345 #
6346 80 ▶sub e_s1 {
Subroutine e_s1: called CC=106 SCAR=81.1
Pod undocumented
6347 80 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6348 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
6349  
6350 80 $modifier =~ tr/p//d;
6351 80 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 80 80
6352 0 my $line = 0;
6353 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6354 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6355 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6356 0 last;
6357 }
6358 }
6359 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6360 }
6361  
6362 80 $slash = 'div';
6363  
6364 # literal null string pattern
6365 80 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 72 80
elsif ($modifier =~ tr/Bb//d) { } 0 72 72
6366 8 $modifier =~ tr/bB//d;
6367 8 $modifier =~ tr/i//d;
6368 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
6369 }
6370  
6371 # /b /B modifier
6372 elsif ($modifier =~ tr/bB//d) {
6373  
6374 # choice again delimiter
6375 0 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 0 0
6376 0 my @char = $string =~ /\G ([\x00-\xFF]) /oxmsg;
6377 0 my %octet = map {$_ => 1} @char;
6378 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
6379 0 $delimiter = '(';
6380 0 $end_delimiter = ')';
6381 }
6382 elsif (not $octet{'}'}) {
6383 0 $delimiter = '{';
6384 0 $end_delimiter = '}';
6385 }
6386 elsif (not $octet{']'}) {
6387 0 $delimiter = '[';
6388 0 $end_delimiter = ']';
6389 }
6390 elsif (not $octet{'>'}) {
6391 0 $delimiter = '<';
6392 0 $end_delimiter = '>';
6393 }
6394 else {
6395 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
6396 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
6397 0 $delimiter = $char;
6398 0 $end_delimiter = $char;
6399 0 last;
6400 }
6401 }
6402 }
6403 }
6404  
6405 0 my $prematch = '';
6406 0 return join '', $ope, $delimiter, $prematch, '(?:', $string, ')', $matched, $end_delimiter, $modifier;
6407 }
6408  
6409 72 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 1 71 72
6410 72 my $metachar = qr/[\@\\|[\]{^]/oxms;
6411  
6412 # split regexp
6413 72 my @char = $string =~ /\G((?>
6414 [^\\\$\@\[\(] |
6415 \\ (?>[1-9][0-9]*) |
6416 \\g (?>\s*) (?>[1-9][0-9]*) |
6417 \\g (?>\s*) \{ (?>\s*) (?>[1-9][0-9]*) (?>\s*) \} |
6418 \\g (?>\s*) \{ (?>\s*) - (?>\s*) (?>[1-9][0-9]*) (?>\s*) \} |
6419 \\x (?>[0-9A-Fa-f]{1,2}) |
6420 \\ (?>[0-7]{2,3}) |
6421 \\c [\x40-\x5F] |
6422 \\x\{ (?>[0-9A-Fa-f]+) \} |
6423 \\o\{ (?>[0-7]+) \} |
6424 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
6425 \\ $q_char |
6426 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
6427 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
6428 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
6429 [\$\@] $qq_variable |
6430 \$ (?>\s* [0-9]+) |
6431 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
6432 \$ \$ (?![\w\{]) |
6433 \$ (?>\s*) \$ (?>\s*) $qq_variable |
6434 \[\^ |
6435 \[\: (?>[a-z]+) :\] |
6436 \[\:\^ (?>[a-z]+) :\] |
6437 \(\? |
6438 $q_char
6439 ))/oxmsg;
6440  
6441 # choice again delimiter
6442 72 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 72 72
6443 0 my %octet = map {$_ => 1} @char;
6444 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
6445 0 $delimiter = '(';
6446 0 $end_delimiter = ')';
6447 }
6448 elsif (not $octet{'}'}) {
6449 0 $delimiter = '{';
6450 0 $end_delimiter = '}';
6451 }
6452 elsif (not $octet{']'}) {
6453 0 $delimiter = '[';
6454 0 $end_delimiter = ']';
6455 }
6456 elsif (not $octet{'>'}) {
6457 0 $delimiter = '<';
6458 0 $end_delimiter = '>';
6459 }
6460 else {
6461 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
6462 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
6463 0 $delimiter = $char;
6464 0 $end_delimiter = $char;
6465 0 last;
6466 }
6467 }
6468 }
6469 }
6470  
6471 # count '('
6472 72 my $parens = grep { $_ eq '(' } @char;
6473  
6474 72 my $left_e = 0;
6475 72 my $right_e = 0;
6476 72 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 200 72 272
6477  
6478 # "\L\u" --> "\u\L"
6479 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
6480 0 @char[$i,$i+1] = @char[$i+1,$i];
6481 }
6482  
6483 # "\U\l" --> "\l\U"
6484 ▶ 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
6485 0 @char[$i,$i+1] = @char[$i+1,$i];
6486 }
6487  
6488 # octal escape sequence
6489 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
6490 1 $char[$i] = Ewindows1258::octchr($1);
6491 }
6492  
6493 # hexadecimal escape sequence
6494 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
6495 1 $char[$i] = Ewindows1258::hexchr($1);
6496 }
6497  
6498 # \b{...} --> b\{...}
6499 # \B{...} --> B\{...}
6500 # \N{CHARNAME} --> N\{CHARNAME}
6501 # \p{PROPERTY} --> p\{PROPERTY}
6502 # \P{PROPERTY} --> P\{PROPERTY}
6503 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
6504 0 $char[$i] = $1 . '\\' . $2;
6505 }
6506  
6507 # \p, \P, \X --> p, P, X
6508 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
6509 0 $char[$i] = $1;
6510 }
6511  
6512 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
6513 }
6514  
6515 # join separated multiple-octet
6516 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
6517 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
6518 0 $char[$i] .= join '', splice @char, $i+1, 3;
6519 }
6520 ▶ 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
6521 0 $char[$i] .= join '', splice @char, $i+1, 2;
6522 }
6523 ▶ 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
6524 0 $char[$i] .= join '', splice @char, $i+1, 1;
6525 }
6526 }
6527  
6528 # open character class [...]
6529 elsif ($char[$i] eq '[') {
6530 17 my $left = $i;
6531 17 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 17 17
6532 0 $i++;
6533 }
6534 17 while (1) {
6535 74 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 74 74
6536 0 die __FILE__, ": Unmatched [] in regexp\n";
6537 }
6538 74 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 17 57 74
6539 17 my $right = $i;
6540  
6541 # [...]
6542 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
6543 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);
6544 }
6545 else {
6546 17 splice @char, $left, $right-$left+1, Ewindows1258::charlist_qr(@char[$left+1..$right-1], $modifier);
6547 }
6548  
6549 17 $i = $left;
6550 17 last;
6551 }
6552 }
6553 }
6554  
6555 # open character class [^...]
6556 elsif ($char[$i] eq '[^') {
6557 0 my $left = $i;
6558 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6559 0 $i++;
6560 }
6561 0 while (1) {
6562 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6563 0 die __FILE__, ": Unmatched [] in regexp\n";
6564 }
6565 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6566 0 my $right = $i;
6567  
6568 # [^...]
6569 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
6570 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);
6571 }
6572 else {
6573 0 splice @char, $left, $right-$left+1, Ewindows1258::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6574 }
6575  
6576 0 $i = $left;
6577 0 last;
6578 }
6579 }
6580 }
6581  
6582 # rewrite character class or escape character
6583 elsif (my $char = character_class($char[$i],$modifier)) {
6584 7 $char[$i] = $char;
6585 }
6586  
6587 # /i modifier
6588 ▶ 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
6589 3 ▶ if (CORE::length(Ewindows1258::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 3 0 3
6590 3 $char[$i] = '[' . Ewindows1258::uc($char[$i]) . Ewindows1258::fc($char[$i]) . ']';
6591 }
6592 else {
6593 0 $char[$i] = '(?:' . Ewindows1258::uc($char[$i]) . '|' . Ewindows1258::fc($char[$i]) . ')';
6594 }
6595 }
6596  
6597 # \u \l \U \L \F \Q \E
6598 elsif ($char[$i] =~ /\A [<>] \z/oxms) {
6599 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
6600 0 $char[$i] = '\\' . $char[$i];
6601 }
6602 }
6603 elsif ($char[$i] eq '\u') {
6604 0 $char[$i] = '@{[Ewindows1258::ucfirst qq<';
6605 0 $left_e++;
6606 }
6607 elsif ($char[$i] eq '\l') {
6608 0 $char[$i] = '@{[Ewindows1258::lcfirst qq<';
6609 0 $left_e++;
6610 }
6611 elsif ($char[$i] eq '\U') {
6612 0 $char[$i] = '@{[Ewindows1258::uc qq<';
6613 0 $left_e++;
6614 }
6615 elsif ($char[$i] eq '\L') {
6616 0 $char[$i] = '@{[Ewindows1258::lc qq<';
6617 0 $left_e++;
6618 }
6619 elsif ($char[$i] eq '\F') {
6620 0 $char[$i] = '@{[Ewindows1258::fc qq<';
6621 0 $left_e++;
6622 }
6623 elsif ($char[$i] eq '\Q') {
6624 0 $char[$i] = '@{[CORE::quotemeta qq<';
6625 0 $left_e++;
6626 }
6627 elsif ($char[$i] eq '\E') {
6628 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
6629 0 $char[$i] = '>]}';
6630 0 $right_e++;
6631 }
6632 else {
6633 0 $char[$i] = '';
6634 }
6635 }
6636 elsif ($char[$i] eq '\Q') {
6637 0 while (1) {
6638 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6639 0 last;
6640 }
6641 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
6642 0 last;
6643 }
6644 }
6645 }
6646 elsif ($char[$i] eq '\E') {
6647 }
6648  
6649 # \0 --> \0
6650 elsif ($char[$i] =~ /\A \\ (?>\s*) 0 \z/oxms) {
6651 }
6652  
6653 # \g{N}, \g{-N}
6654  
6655 # P.108 Using Simple Patterns
6656 # in Chapter 7: In the World of Regular Expressions
6657 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
6658  
6659 # P.221 Capturing
6660 # in Chapter 5: Pattern Matching
6661 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
6662  
6663 # \g{-1}, \g{-2}, \g{-3} --> \g{-1}, \g{-2}, \g{-3}
6664 elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) - (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6665 }
6666  
6667 # \g{1}, \g{2}, \g{3} --> \g{2}, \g{3}, \g{4} (only when multibyte anchoring is enable)
6668 elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6669 }
6670  
6671 # \g1, \g2, \g3 --> \g2, \g3, \g4 (only when multibyte anchoring is enable)
6672 elsif ($char[$i] =~ /\A \\g (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) {
6673 }
6674  
6675 # \1, \2, \3 --> \2, \3, \4 (only when multibyte anchoring is enable)
6676 elsif ($char[$i] =~ /\A \\ (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) {
6677 }
6678  
6679 # $0 --> $0
6680 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
6681 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6682 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
6683 }
6684 }
6685 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
6686 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6687 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
6688 }
6689 }
6690  
6691 # $$ --> $$
6692 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
6693 }
6694  
6695 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
6696 # $1, $2, $3 --> $1, $2, $3 otherwise
6697 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
6698 0 $char[$i] = e_capture($1);
6699 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6700 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
6701 }
6702 }
6703 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6704 0 $char[$i] = e_capture($1);
6705 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6706 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
6707 }
6708 }
6709  
6710 # $$foo[ ... ] --> $ $foo->[ ... ]
6711 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
6712 0 $char[$i] = e_capture($1.'->'.$2);
6713 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6714 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
6715 }
6716 }
6717  
6718 # $$foo{ ... } --> $ $foo->{ ... }
6719 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
6720 0 $char[$i] = e_capture($1.'->'.$2);
6721 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6722 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
6723 }
6724 }
6725  
6726 # $$foo
6727 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
6728 0 $char[$i] = e_capture($1);
6729 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6730 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
6731 }
6732 }
6733  
6734 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Ewindows1258::PREMATCH()
6735 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
6736 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 4 4
6737 0 $char[$i] = '@{[Ewindows1258::ignorecase(Ewindows1258::PREMATCH())]}';
6738 }
6739 else {
6740 4 $char[$i] = '@{[Ewindows1258::PREMATCH()]}';
6741 }
6742 }
6743  
6744 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Ewindows1258::MATCH()
6745 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
6746 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 4 4
6747 0 $char[$i] = '@{[Ewindows1258::ignorecase(Ewindows1258::MATCH())]}';
6748 }
6749 else {
6750 4 $char[$i] = '@{[Ewindows1258::MATCH()]}';
6751 }
6752 }
6753  
6754 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Ewindows1258::POSTMATCH()
6755 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
6756 3 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 3 3
6757 0 $char[$i] = '@{[Ewindows1258::ignorecase(Ewindows1258::POSTMATCH())]}';
6758 }
6759 else {
6760 3 $char[$i] = '@{[Ewindows1258::POSTMATCH()]}';
6761 }
6762 }
6763  
6764 # ${ foo }
6765 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
6766 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6767 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
6768 }
6769 }
6770  
6771 # ${ ... }
6772 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
6773 0 $char[$i] = e_capture($1);
6774 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6775 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
6776 }
6777 }
6778  
6779 # $scalar or @array
6780 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
6781 4 $char[$i] = e_string($char[$i]);
6782 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 4 4
6783 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
6784 }
6785 }
6786  
6787 # quote character before ? + * {
6788 ▶ 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
6789 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
6790 }
6791 else {
6792 14 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6793 }
6794 }
6795 }
6796  
6797 # make regexp string
6798 72 my $prematch = '';
6799 72 $modifier =~ tr/i//d;
6800 72 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 72 72
6801 0 return join '', $ope, $delimiter, $prematch, '(?:', @char, '>]}' x ($left_e - $right_e), ')', $matched, $end_delimiter, $modifier;
6802 }
6803 72 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6804 }
6805  
6806 #
6807 # escape regexp (s'here'' or s'here''b)
6808 #
6809 21 ▶sub e_s1_q {
Subroutine e_s1_q: called CC=7 SCAR=24.3
Pod undocumented
6810 21 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6811 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
6812  
6813 21 $modifier =~ tr/p//d;
6814 21 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 21 21
6815 0 my $line = 0;
6816 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6817 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6818 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6819 0 last;
6820 }
6821 }
6822 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6823 }
6824  
6825 21 $slash = 'div';
6826  
6827 # literal null string pattern
6828 21 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 13 21
elsif ($modifier =~ tr/Bb//d) { } 0 13 13
6829 8 $modifier =~ tr/bB//d;
6830 8 $modifier =~ tr/i//d;
6831 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
6832 }
6833  
6834 # with /b /B modifier
6835 elsif ($modifier =~ tr/bB//d) {
6836 0 return e_s1_qb($ope,$delimiter,$end_delimiter,$string,$modifier);
6837 }
6838  
6839 # without /b /B modifier
6840 else {
6841 13 return e_s1_qt($ope,$delimiter,$end_delimiter,$string,$modifier);
6842 }
6843 }
6844  
6845 #
6846 # escape regexp (s'here'')
6847 #
6848 13 ▶sub e_s1_qt {
Subroutine e_s1_qt: called CC=20 SCAR=50.1
Pod undocumented
6849 13 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6850  
6851 13 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 13 13
6852  
6853 # split regexp
6854 13 my @char = $string =~ /\G((?>
6855 [^\\\[\$\@\/] |
6856 [\x00-\xFF] |
6857 \[\^ |
6858 \[\: (?>[a-z]+) \:\] |
6859 \[\:\^ (?>[a-z]+) \:\] |
6860 [\$\@\/] |
6861 \\ (?:$q_char) |
6862 (?:$q_char)
6863 ))/oxmsg;
6864  
6865 # unescape character
6866 13 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 25 13 38
6867 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
6868 }
6869  
6870 # open character class [...]
6871 elsif ($char[$i] eq '[') {
6872 0 my $left = $i;
6873 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6874 0 $i++;
6875 }
6876 0 while (1) {
6877 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6878 0 die __FILE__, ": Unmatched [] in regexp\n";
6879 }
6880 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6881 0 my $right = $i;
6882  
6883 # [...]
6884 0 splice @char, $left, $right-$left+1, Ewindows1258::charlist_qr(@char[$left+1..$right-1], $modifier);
6885  
6886 0 $i = $left;
6887 0 last;
6888 }
6889 }
6890 }
6891  
6892 # open character class [^...]
6893 elsif ($char[$i] eq '[^') {
6894 0 my $left = $i;
6895 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6896 0 $i++;
6897 }
6898 0 while (1) {
6899 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6900 0 die __FILE__, ": Unmatched [] in regexp\n";
6901 }
6902 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6903 0 my $right = $i;
6904  
6905 # [^...]
6906 0 splice @char, $left, $right-$left+1, Ewindows1258::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6907  
6908 0 $i = $left;
6909 0 last;
6910 }
6911 }
6912 }
6913  
6914 # escape $ @ / and \
6915 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6916 0 $char[$i] = '\\' . $char[$i];
6917 }
6918  
6919 # rewrite character class or escape character
6920 elsif (my $char = character_class($char[$i],$modifier)) {
6921 6 $char[$i] = $char;
6922 }
6923  
6924 # /i modifier
6925 ▶ 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
6926 0 ▶ if (CORE::length(Ewindows1258::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
6927 0 $char[$i] = '[' . Ewindows1258::uc($char[$i]) . Ewindows1258::fc($char[$i]) . ']';
6928 }
6929 else {
6930 0 $char[$i] = '(?:' . Ewindows1258::uc($char[$i]) . '|' . Ewindows1258::fc($char[$i]) . ')';
6931 }
6932 }
6933  
6934 # quote character before ? + * {
6935 ▶ 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
6936 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
6937 }
6938 else {
6939 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6940 }
6941 }
6942 }
6943  
6944 13 $modifier =~ tr/i//d;
6945 13 $delimiter = '/';
6946 13 $end_delimiter = '/';
6947 13 my $prematch = '';
6948 13 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6949 }
6950  
6951 #
6952 # escape regexp (s'here''b)
6953 #
6954 0 ▶sub e_s1_qb {
Subroutine e_s1_qb: not called CC=4 SCAR=30.0
Pod undocumented
6955 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6956  
6957 # split regexp
6958 0 my @char = $string =~ /\G (?>[^\\]|\\\\) /oxmsg;
6959  
6960 # unescape character
6961 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
6962 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
6963 }
6964  
6965 # remain \\
6966 elsif ($char[$i] eq '\\\\') {
6967 }
6968  
6969 # escape $ @ / and \
6970 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6971 0 $char[$i] = '\\' . $char[$i];
6972 }
6973 }
6974  
6975 0 $delimiter = '/';
6976 0 $end_delimiter = '/';
6977 0 my $prematch = '';
6978 0 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6979 }
6980  
6981 #
6982 # escape regexp (s''here')
6983 #
6984 16 ▶sub e_s2_q {
Subroutine e_s2_q: called CC=4 SCAR=13.9
Pod undocumented
6985 16 my($ope,$delimiter,$end_delimiter,$string) = @_;
6986  
6987 16 $slash = 'div';
6988  
6989 16 my @char = $string =~ / \G (?>[^\\]|\\\\|$q_char) /oxmsg;
6990 16 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 9 16 25
6991 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
6992 }
6993  
6994 # not escape \\
6995 elsif ($char[$i] =~ /\A \\\\ \z/oxms) {
6996 }
6997  
6998 # escape $ @ / and \
6999 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
7000 5 $char[$i] = '\\' . $char[$i];
7001 }
7002 }
7003  
7004 16 return join '', $ope, $delimiter, @char, $end_delimiter;
7005 }
7006  
7007 #
7008 # escape regexp (s/here/and here/modifier)
7009 #
7010 101 ▶sub e_sub {
Subroutine e_sub: called CC=20 SCAR=32.6
Pod undocumented
7011 101 my($variable,$delimiter1,$pattern,$end_delimiter1,$delimiter2,$replacement,$end_delimiter2,$modifier) = @_;
7012 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
7013  
7014 101 $modifier =~ tr/p//d;
7015 101 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 101 101
7016 0 my $line = 0;
7017 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7018 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
7019 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
7020 0 last;
7021 }
7022 }
7023 0 die qq{Unsupported modifier "$1" used at line $line.\n};
7024 }
7025  
7026 101 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq "") 36 65 101
7027 36 $variable = '$_';
7028 36 $bind_operator = ' =~ ';
7029 }
7030  
7031 101 $slash = 'div';
7032  
7033 # P.128 Start of match (or end of previous match): \G
7034 # P.130 Advanced Use of \G with Perl
7035 # in Chapter 3: Overview of Regular Expression Features and Flavors
7036 # P.312 Iterative Matching: Scalar Context, with /g
7037 # in Chapter 7: Perl
7038 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
7039  
7040 # P.181 Where You Left Off: The \G Assertion
7041 # in Chapter 5: Pattern Matching
7042 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
7043  
7044 # P.220 Where You Left Off: The \G Assertion
7045 # in Chapter 5: Pattern Matching
7046 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
7047  
7048 101 my $e_modifier = $modifier =~ tr/e//d;
7049 101 my $r_modifier = $modifier =~ tr/r//d;
7050  
7051 101 my $my = '';
7052 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
7053 0 $my = $variable;
7054 0 $variable =~ s/ (?: local \b | my \b | our \b | state \b ) (?>\s*) //oxms;
7055 0 $variable =~ s/ = .+ \z//oxms;
7056 }
7057  
7058 101 (my $variable_basename = $variable) =~ s/ [\[\{].* \z//oxms;
7059 101 $variable_basename =~ s/ \s+ \z//oxms;
7060  
7061 # quote replacement string
7062 101 my $e_replacement = '';
7063 101 ▶ if ($e_modifier >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($e_modifier >= 1) { } 17 84 101
7064 17 $e_replacement = e_qq('', '', '', $replacement);
7065 17 $e_modifier--;
7066 }
7067 else {
7068 84 ▶ if ($delimiter2 eq "'") {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter2 eq q[']) { } 16 68 84
7069 16 $e_replacement = e_s2_q('qq', '/', '/', $replacement);
7070 }
7071 else {
7072 68 $e_replacement = e_qq ('qq', $delimiter2, $end_delimiter2, $replacement);
7073 }
7074 }
7075  
7076 101 my $sub = '';
7077  
7078 # with /r
7079 101 ▶ if ($r_modifier) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r_modifier) { } 10 91 101
7080 10 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $modifier =~ /g/mosx }) { } 5 5 10
7081 }
7082  
7083 # s///gr without multibyte anchoring
7084 elsif ($modifier =~ /g/oxms) {
7085 5 ▶ $sub = sprintf(
Branch: 1 branch
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 0 5 5
7086 # 1 2 3 4 5
7087 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}>,
7088  
7089 $variable, # 1
7090 ($delimiter1 eq "'") ? # 2
7091 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
7092 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
7093 $s_matched, # 3
7094 $e_replacement, # 4
7095 '$Ewindows1258::re_r=CORE::eval $Ewindows1258::re_r; ' x $e_modifier, # 5
7096 );
7097 }
7098  
7099 # s///r
7100 else {
7101  
7102 5 my $prematch = q{$`};
7103  
7104 5 ▶ $sub = sprintf(
Branch: 1 branch
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 0 5 5
7105 # 1 2 3 4 5 6 7
7106 q<(%s =~ %s) ? CORE::eval{%s local $^W=0; local $Ewindows1258::re_r=%s; %s"%s$Ewindows1258::re_r$'" } : %s>,
7107  
7108 $variable, # 1
7109 ($delimiter1 eq "'") ? # 2
7110 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
7111 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
7112 $s_matched, # 3
7113 $e_replacement, # 4
7114 '$Ewindows1258::re_r=CORE::eval $Ewindows1258::re_r; ' x $e_modifier, # 5
7115 $prematch, # 6
7116 $variable, # 7
7117 );
7118 }
7119  
7120 # $var !~ s///r doesn't make sense
7121 10 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) 0 10 10
7122 0 $sub = q{die("$0: Using !~ with s///r doesn't make sense"), } . $sub;
7123 }
7124 }
7125  
7126 # without /r
7127 else {
7128 91 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $modifier =~ /g/mosx }) { } 23 68 91
7129 }
7130  
7131 # s///g without multibyte anchoring
7132 elsif ($modifier =~ /g/oxms) {
7133 23 ▶ $sub = sprintf(
Branch: 2 branches
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 3 20 23
$bind_operator =~ / !~ /mosx ? : 3 20 23
7134 # 1 2 3 4 5 6 7 8
7135 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}>,
7136  
7137 $variable, # 1
7138 ($delimiter1 eq "'") ? # 2
7139 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
7140 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
7141 $s_matched, # 3
7142 $e_replacement, # 4
7143 '$Ewindows1258::re_r=CORE::eval $Ewindows1258::re_r; ' x $e_modifier, # 5
7144 $variable, # 6
7145 $variable, # 7
7146 ($bind_operator =~ / !~ /oxms) ? '!' : '', # 8
7147 );
7148 }
7149  
7150 # s///
7151 else {
7152  
7153 68 my $prematch = q{$`};
7154  
7155 68 ▶ $sub = sprintf(
Branch: 2 branches
BranchTrueFalseTotal
$bind_operator =~ / =~ /mosx ? : 65 3 68
$delimiter1 eq q['] ? : 18 50 68
7156  
7157 ($bind_operator =~ / =~ /oxms) ?
7158  
7159 # 1 2 3 4 5 6 7 8
7160 q<(%s%s%s) ? CORE::eval{%s local $^W=0; local $Ewindows1258::re_r=%s; %s%s="%s$Ewindows1258::re_r$'"; 1 } : undef> :
7161  
7162 # 1 2 3 4 5 6 7 8
7163 q<(%s%s%s) ? 1 : CORE::eval{%s local $^W=0; local $Ewindows1258::re_r=%s; %s%s="%s$Ewindows1258::re_r$'"; undef }>,
7164  
7165 $variable, # 1
7166 $bind_operator, # 2
7167 ($delimiter1 eq "'") ? # 3
7168 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
7169 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
7170 $s_matched, # 4
7171 $e_replacement, # 5
7172 '$Ewindows1258::re_r=CORE::eval $Ewindows1258::re_r; ' x $e_modifier, # 6
7173 $variable, # 7
7174 $prematch, # 8
7175 );
7176 }
7177 }
7178  
7179 # (my $foo = $bar) =~ s/// --> (my $foo = $bar, CORE::eval { ... })[1]
7180 101 ▶ if ($my ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($my ne "") 0 101 101
7181 0 $sub = "($my, $sub)[1]";
7182 }
7183  
7184 # clear s/// variable
7185 101 $sub_variable = '';
7186 101 $bind_operator = '';
7187  
7188 101 return $sub;
7189 }
7190  
7191 #
7192 # escape regexp of split qr//
7193 #
7194 74 ▶sub e_split {
Subroutine e_split: called CC=88 SCAR=76.4
Pod undocumented
7195 74 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
7196 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
7197  
7198 74 $modifier =~ tr/p//d;
7199 74 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 74 74
7200 0 my $line = 0;
7201 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7202 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
7203 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
7204 0 last;
7205 }
7206 }
7207 0 die qq{Unsupported modifier "$1" used at line $line.\n};
7208 }
7209  
7210 74 $slash = 'div';
7211  
7212 # /b /B modifier
7213 74 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) 0 74 74
7214 0 return join '', 'split', $ope, $delimiter, $string, $end_delimiter, $modifier;
7215 }
7216  
7217 74 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 74 74
7218 74 my $metachar = qr/[\@\\|[\]{^]/oxms;
7219  
7220 # split regexp
7221 74 my @char = $string =~ /\G((?>
7222 [^\\\$\@\[\(] |
7223 \\x (?>[0-9A-Fa-f]{1,2}) |
7224 \\ (?>[0-7]{2,3}) |
7225 \\c [\x40-\x5F] |
7226 \\x\{ (?>[0-9A-Fa-f]+) \} |
7227 \\o\{ (?>[0-7]+) \} |
7228 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
7229 \\ $q_char |
7230 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
7231 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
7232 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
7233 [\$\@] $qq_variable |
7234 \$ (?>\s* [0-9]+) |
7235 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
7236 \$ \$ (?![\w\{]) |
7237 \$ (?>\s*) \$ (?>\s*) $qq_variable |
7238 \[\^ |
7239 \[\: (?>[a-z]+) :\] |
7240 \[\:\^ (?>[a-z]+) :\] |
7241 \(\? |
7242 $q_char
7243 ))/oxmsg;
7244  
7245 74 my $left_e = 0;
7246 74 my $right_e = 0;
7247 74 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 249 74 323
7248  
7249 # "\L\u" --> "\u\L"
7250 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
7251 0 @char[$i,$i+1] = @char[$i+1,$i];
7252 }
7253  
7254 # "\U\l" --> "\l\U"
7255 ▶ 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
7256 0 @char[$i,$i+1] = @char[$i+1,$i];
7257 }
7258  
7259 # octal escape sequence
7260 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
7261 1 $char[$i] = Ewindows1258::octchr($1);
7262 }
7263  
7264 # hexadecimal escape sequence
7265 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
7266 1 $char[$i] = Ewindows1258::hexchr($1);
7267 }
7268  
7269 # \b{...} --> b\{...}
7270 # \B{...} --> B\{...}
7271 # \N{CHARNAME} --> N\{CHARNAME}
7272 # \p{PROPERTY} --> p\{PROPERTY}
7273 # \P{PROPERTY} --> P\{PROPERTY}
7274 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
7275 0 $char[$i] = $1 . '\\' . $2;
7276 }
7277  
7278 # \p, \P, \X --> p, P, X
7279 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
7280 0 $char[$i] = $1;
7281 }
7282  
7283 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
7284 }
7285  
7286 # join separated multiple-octet
7287 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
7288 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
7289 0 $char[$i] .= join '', splice @char, $i+1, 3;
7290 }
7291 ▶ 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
7292 0 $char[$i] .= join '', splice @char, $i+1, 2;
7293 }
7294 ▶ 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
7295 0 $char[$i] .= join '', splice @char, $i+1, 1;
7296 }
7297 }
7298  
7299 # open character class [...]
7300 elsif ($char[$i] eq '[') {
7301 3 my $left = $i;
7302 3 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 3 3
7303 0 $i++;
7304 }
7305 3 while (1) {
7306 7 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 7 7
7307 0 die __FILE__, ": Unmatched [] in regexp\n";
7308 }
7309 7 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 3 4 7
7310 3 my $right = $i;
7311  
7312 # [...]
7313 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
7314 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);
7315 }
7316 else {
7317 3 splice @char, $left, $right-$left+1, Ewindows1258::charlist_qr(@char[$left+1..$right-1], $modifier);
7318 }
7319  
7320 3 $i = $left;
7321 3 last;
7322 }
7323 }
7324 }
7325  
7326 # open character class [^...]
7327 elsif ($char[$i] eq '[^') {
7328 0 my $left = $i;
7329 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7330 0 $i++;
7331 }
7332 0 while (1) {
7333 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7334 0 die __FILE__, ": Unmatched [] in regexp\n";
7335 }
7336 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7337 0 my $right = $i;
7338  
7339 # [^...]
7340 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
7341 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);
7342 }
7343 else {
7344 0 splice @char, $left, $right-$left+1, Ewindows1258::charlist_not_qr(@char[$left+1..$right-1], $modifier);
7345 }
7346  
7347 0 $i = $left;
7348 0 last;
7349 }
7350 }
7351 }
7352  
7353 # rewrite character class or escape character
7354 elsif (my $char = character_class($char[$i],$modifier)) {
7355 1 $char[$i] = $char;
7356 }
7357  
7358 # P.794 29.2.161. split
7359 # in Chapter 29: Functions
7360 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
7361  
7362 # P.951 split
7363 # in Chapter 27: Functions
7364 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
7365  
7366 # said "The //m modifier is assumed when you split on the pattern /^/",
7367 # but perl5.008 is not so. Therefore, this software adds //m.
7368 # (and so on)
7369  
7370 # split(m/^/) --> split(m/^/m)
7371 ▶ 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
7372 7 $modifier .= 'm';
7373 }
7374  
7375 # /i modifier
7376 ▶ 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
7377 0 ▶ if (CORE::length(Ewindows1258::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
7378 0 $char[$i] = '[' . Ewindows1258::uc($char[$i]) . Ewindows1258::fc($char[$i]) . ']';
7379 }
7380 else {
7381 0 $char[$i] = '(?:' . Ewindows1258::uc($char[$i]) . '|' . Ewindows1258::fc($char[$i]) . ')';
7382 }
7383 }
7384  
7385 # \u \l \U \L \F \Q \E
7386 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
7387 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
7388 0 $char[$i] = '\\' . $char[$i];
7389 }
7390 }
7391 elsif ($char[$i] eq '\u') {
7392 0 $char[$i] = '@{[Ewindows1258::ucfirst qq<';
7393 0 $left_e++;
7394 }
7395 elsif ($char[$i] eq '\l') {
7396 0 $char[$i] = '@{[Ewindows1258::lcfirst qq<';
7397 0 $left_e++;
7398 }
7399 elsif ($char[$i] eq '\U') {
7400 0 $char[$i] = '@{[Ewindows1258::uc qq<';
7401 0 $left_e++;
7402 }
7403 elsif ($char[$i] eq '\L') {
7404 0 $char[$i] = '@{[Ewindows1258::lc qq<';
7405 0 $left_e++;
7406 }
7407 elsif ($char[$i] eq '\F') {
7408 0 $char[$i] = '@{[Ewindows1258::fc qq<';
7409 0 $left_e++;
7410 }
7411 elsif ($char[$i] eq '\Q') {
7412 0 $char[$i] = '@{[CORE::quotemeta qq<';
7413 0 $left_e++;
7414 }
7415 elsif ($char[$i] eq '\E') {
7416 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
7417 0 $char[$i] = '>]}';
7418 0 $right_e++;
7419 }
7420 else {
7421 0 $char[$i] = '';
7422 }
7423 }
7424 elsif ($char[$i] eq '\Q') {
7425 0 while (1) {
7426 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7427 0 last;
7428 }
7429 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
7430 0 last;
7431 }
7432 }
7433 }
7434 elsif ($char[$i] eq '\E') {
7435 }
7436  
7437 # $0 --> $0
7438 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
7439 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7440 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
7441 }
7442 }
7443 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
7444 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7445 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
7446 }
7447 }
7448  
7449 # $$ --> $$
7450 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
7451 }
7452  
7453 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
7454 # $1, $2, $3 --> $1, $2, $3 otherwise
7455 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
7456 0 $char[$i] = e_capture($1);
7457 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7458 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
7459 }
7460 }
7461 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
7462 0 $char[$i] = e_capture($1);
7463 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7464 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
7465 }
7466 }
7467  
7468 # $$foo[ ... ] --> $ $foo->[ ... ]
7469 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
7470 0 $char[$i] = e_capture($1.'->'.$2);
7471 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7472 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
7473 }
7474 }
7475  
7476 # $$foo{ ... } --> $ $foo->{ ... }
7477 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
7478 0 $char[$i] = e_capture($1.'->'.$2);
7479 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7480 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
7481 }
7482 }
7483  
7484 # $$foo
7485 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
7486 0 $char[$i] = e_capture($1);
7487 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7488 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
7489 }
7490 }
7491  
7492 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Ewindows1258::PREMATCH()
7493 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
7494 12 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 12 12
7495 0 $char[$i] = '@{[Ewindows1258::ignorecase(Ewindows1258::PREMATCH())]}';
7496 }
7497 else {
7498 12 $char[$i] = '@{[Ewindows1258::PREMATCH()]}';
7499 }
7500 }
7501  
7502 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Ewindows1258::MATCH()
7503 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
7504 12 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 12 12
7505 0 $char[$i] = '@{[Ewindows1258::ignorecase(Ewindows1258::MATCH())]}';
7506 }
7507 else {
7508 12 $char[$i] = '@{[Ewindows1258::MATCH()]}';
7509 }
7510 }
7511  
7512 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Ewindows1258::POSTMATCH()
7513 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
7514 9 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 9 9
7515 0 $char[$i] = '@{[Ewindows1258::ignorecase(Ewindows1258::POSTMATCH())]}';
7516 }
7517 else {
7518 9 $char[$i] = '@{[Ewindows1258::POSTMATCH()]}';
7519 }
7520 }
7521  
7522 # ${ foo }
7523 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
7524 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7525 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $1 . ')]}';
7526 }
7527 }
7528  
7529 # ${ ... }
7530 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
7531 0 $char[$i] = e_capture($1);
7532 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7533 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
7534 }
7535 }
7536  
7537 # $scalar or @array
7538 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
7539 3 $char[$i] = e_string($char[$i]);
7540 3 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 3 3
7541 0 $char[$i] = '@{[Ewindows1258::ignorecase(' . $char[$i] . ')]}';
7542 }
7543 }
7544  
7545 # quote character before ? + * {
7546 ▶ 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
7547 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
7548 }
7549 else {
7550 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
7551 }
7552 }
7553 }
7554  
7555 # make regexp string
7556 74 $modifier =~ tr/i//d;
7557 74 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 74 74
7558 0 return join '', 'Ewindows1258::split', $ope, $delimiter, @char, '>]}' x ($left_e - $right_e), $end_delimiter, $modifier;
7559 }
7560 74 return join '', 'Ewindows1258::split', $ope, $delimiter, @char, $end_delimiter, $modifier;
7561 }
7562  
7563 #
7564 # escape regexp of split qr''
7565 #
7566 0 ▶sub e_split_q {
Subroutine e_split_q: not called CC=26 SCAR=65.5
Pod undocumented
7567 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
7568 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
7569  
7570 0 $modifier =~ tr/p//d;
7571 0 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 0 0
7572 0 my $line = 0;
7573 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7574 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
7575 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
7576 0 last;
7577 }
7578 }
7579 0 die qq{Unsupported modifier "$1" used at line $line.\n};
7580 }
7581  
7582 0 $slash = 'div';
7583  
7584 # /b /B modifier
7585 0 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) 0 0 0
7586 0 return join '', 'split', $ope, $delimiter, $string, $end_delimiter, $modifier;
7587 }
7588  
7589 0 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 0 0
7590  
7591 # split regexp
7592 0 my @char = $string =~ /\G((?>
7593 [^\\\[] |
7594 [\x00-\xFF] |
7595 \[\^ |
7596 \[\: (?>[a-z]+) \:\] |
7597 \[\:\^ (?>[a-z]+) \:\] |
7598 \\ (?:$q_char) |
7599 (?:$q_char)
7600 ))/oxmsg;
7601  
7602 # unescape character
7603 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
7604 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
7605 }
7606  
7607 # open character class [...]
7608 elsif ($char[$i] eq '[') {
7609 0 my $left = $i;
7610 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7611 0 $i++;
7612 }
7613 0 while (1) {
7614 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7615 0 die __FILE__, ": Unmatched [] in regexp\n";
7616 }
7617 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7618 0 my $right = $i;
7619  
7620 # [...]
7621 0 splice @char, $left, $right-$left+1, Ewindows1258::charlist_qr(@char[$left+1..$right-1], $modifier);
7622  
7623 0 $i = $left;
7624 0 last;
7625 }
7626 }
7627 }
7628  
7629 # open character class [^...]
7630 elsif ($char[$i] eq '[^') {
7631 0 my $left = $i;
7632 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7633 0 $i++;
7634 }
7635 0 while (1) {
7636 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7637 0 die __FILE__, ": Unmatched [] in regexp\n";
7638 }
7639 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7640 0 my $right = $i;
7641  
7642 # [^...]
7643 0 splice @char, $left, $right-$left+1, Ewindows1258::charlist_not_qr(@char[$left+1..$right-1], $modifier);
7644  
7645 0 $i = $left;
7646 0 last;
7647 }
7648 }
7649 }
7650  
7651 # rewrite character class or escape character
7652 elsif (my $char = character_class($char[$i],$modifier)) {
7653 0 $char[$i] = $char;
7654 }
7655  
7656 # split(m/^/) --> split(m/^/m)
7657 ▶ 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
7658 0 $modifier .= 'm';
7659 }
7660  
7661 # /i modifier
7662 ▶ 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
7663 0 ▶ if (CORE::length(Ewindows1258::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
7664 0 $char[$i] = '[' . Ewindows1258::uc($char[$i]) . Ewindows1258::fc($char[$i]) . ']';
7665 }
7666 else {
7667 0 $char[$i] = '(?:' . Ewindows1258::uc($char[$i]) . '|' . Ewindows1258::fc($char[$i]) . ')';
7668 }
7669 }
7670  
7671 # quote character before ? + * {
7672 ▶ 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
7673 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
7674 }
7675 else {
7676 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
7677 }
7678 }
7679 }
7680  
7681 0 $modifier =~ tr/i//d;
7682 0 return join '', 'Ewindows1258::split', $ope, $delimiter, @char, $end_delimiter, $modifier;
7683 }
7684  
7685 #
7686 # instead of Carp::carp
7687 #
7688 0 ▶sub carp {
Subroutine carp: not called CC=1 SCAR=6.9
Pod undocumented
7689 0 my($package,$filename,$line) = caller(1);
7690 0 print STDERR "@_ at $filename line $line.\n";
7691 }
7692  
7693 #
7694 # instead of Carp::croak
7695 #
7696 0 ▶sub croak {
Subroutine croak: not called CC=1 SCAR=6.9
Pod undocumented
7697 0 my($package,$filename,$line) = caller(1);
7698 0 print STDERR "@_ at $filename line $line.\n";
7699 0 die "\n";
7700 }
7701  
7702 #
7703 # instead of Carp::cluck
7704 #
7705 0 ▶sub cluck {
Subroutine cluck: not called CC=2 SCAR=17.9
Pod undocumented
7706 0 my $i = 0;
7707 0 my @cluck = ();
7708 0 ▶ while (my($package,$filename,$line,$subroutine) = caller($i)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7709 0 push @cluck, "[$i] $filename($line) $package::$subroutine\n";
7710 0 $i++;
7711 }
7712 0 print STDERR CORE::reverse @cluck;
7713 0 print STDERR "\n";
7714 0 print STDERR @_;
7715 }
7716  
7717 #
7718 # instead of Carp::confess
7719 #
7720 0 ▶sub confess {
Subroutine confess: not called CC=2 SCAR=17.9
Pod undocumented
7721 0 my $i = 0;
7722 0 my @confess = ();
7723 0 ▶ while (my($package,$filename,$line,$subroutine) = caller($i)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7724 0 push @confess, "[$i] $filename($line) $package::$subroutine\n";
7725 0 $i++;
7726 }
7727 0 print STDERR CORE::reverse @confess;
7728 0 print STDERR "\n";
7729 0 print STDERR @_;
7730 0 die "\n";
7731 }
7732  
7733 422 1;
7734  
7735 __END__
↑ Summary blib/lib/Windows1258.pm »