Ewindows1254.pm

filter: Statementstmt 43.5% 1310 / 3009 Branchbran 40.6% 1061 / 2608 Conditioncond 31.0% 115 / 370 MC/DCmcdc 15.9% 35 / 220 Subroutinesub 68.9% 111 / 161 Podpod 4.6% 3 / 64 totaltotal 40.9% 2635 / 6432 CC 1475 SCAR 97.8
CC
1475
Cov
42%
escape_token
55669.4
e_s1
3320.4
e_split
2070.1
CRAP 17630.2
↑ Summary Windows1254.pm »
1 package Ewindows1254;
2 425 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 425 ▶BEGIN { $INC{'warnings.pm'} = '' if $] < 5.006 } use warnings;
Subroutine BEGIN: called CC=2 SCAR=7.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
if $] < "5.006" 0 424 424
4 ######################################################################
5 #
6 # Ewindows1254 - Run-time routines for Windows1254.pm
7 #
8 # http://search.cpan.org/dist/Char-Windows1254/
9 #
10 # Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2018, 2019 INABA Hitoshi <ina@cpan.org>
11 ######################################################################
12  
13 425 ▶use 5.00503; # Galapagos Consensus 1998 for primetools
Subroutine BEGIN: called CC=1 SCAR=0.0
14 # use 5.008001; # Lancaster Consensus 2013 for toolchains
15  
16 # 12.3. Delaying use Until Runtime
17 # in Chapter 12. Packages, Libraries, and Modules
18 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
19 # (and so on)
20  
21 # Version numbers should be boring
22 # http://www.dagolden.com/index.php/369/version-numbers-should-be-boring/
23 # For the impatient, the disinterested or those who just want to follow
24 # a recipe, my advice for all modules is this:
25 # our $VERSION = "0.001"; # or "0.001_001" for a dev release
26 # $VERSION = eval $VERSION; # No!! because '1.10' makes '1.1'
27  
28 425 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
29 424 $VERSION = '1.23';
30 424 $VERSION = $VERSION;
31  
32 424 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=7.0
33 425 ▶ if ($^X =~ / jperl /oxmsi) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^X =~ / jperl /imosx) 0 424 424
34 1 die __FILE__, ": needs perl(not jperl) 5.00503 or later. (\$^X==$^X)\n";
35 }
36 425 if (CORE::ord('A') == 193) {
37 die __FILE__, ": is not US-ASCII script (may be EBCDIC or EBCDIK script).\n";
38 }
39 424 if (CORE::ord('A') != 0x41) {
40 die __FILE__, ": is not US-ASCII script (must be US-ASCII script).\n";
41 }
42 }
43  
44 424 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=9.5
45  
46 # instead of utf8.pm
47 424 ▶ CORE::eval q{
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
48 no warnings qw(redefine);
49 *utf8::upgrade = sub { CORE::length $_[0] };
50 *utf8::downgrade = sub { 1 };
51 *utf8::encode = sub { };
52 *utf8::decode = sub { 1 };
53 *utf8::is_utf8 = sub { };
54 *utf8::valid = sub { 1 };
55 };
56 424 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 424 424
57 0 ▶ *utf8::upgrade = sub { CORE::length $_[0] };
Subroutine __ANON__: not called CC=1 SCAR=6.9
58 0 ▶ *utf8::downgrade = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
59 0 ▶ *utf8::encode = sub { };
Subroutine __ANON__: not called CC=1 SCAR=6.9
60 0 ▶ *utf8::decode = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
61 0 ▶ *utf8::is_utf8 = sub { };
Subroutine __ANON__: not called CC=1 SCAR=6.9
62 0 ▶ *utf8::valid = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
63 }
64 }
65  
66 # instead of Symbol.pm
67 BEGIN {
68 0 ▶ sub gensym () {
Subroutine gensym: not called CC=2 SCAR=17.9
Pod undocumented
69 0 ▶ if ($] < 5.006) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] < 5.006) { } 0 0 0
70 0 return \do { local *_ };
71 }
72 else {
73 0 return undef;
74 }
75 }
76  
77 20 ▶ sub qualify ($$) {
Subroutine qualify: called CC=8 SCAR=28.9
Pod undocumented
78 20 my($name) = @_;
79  
80 20 ▶ if (ref $name) {
Branch: 7 branches
BranchTrueFalseTotal
if (ref $name) { } 5 15 20
elsif (&Ewindows1254::index($name, '::') >= 0) { } 0 15 15
elsif (&Ewindows1254::index($name, q[']) >= 0) { } 0 15 15
elsif ($name =~ /\A \^ [ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]+ \z/x) { } 0 15 15
elsif ($name =~ /\A (?: ARGV | ARGVOUT | ENV | INC | SIG | STDERR | STDIN | STDOUT ) \z/x) { } 0 15 15
elsif ($name =~ /\A [^ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz] \z/x) { } 0 15 15
elsif (defined $_[1]) { } 15 0 15
81 5 return $name;
82 }
83 elsif (Ewindows1254::index($name,'::') >= 0) {
84 0 return $name;
85 }
86 elsif (Ewindows1254::index($name,"'") >= 0) {
87 0 return $name;
88 }
89  
90 # special character, "^xyz"
91 elsif ($name =~ /\A \^ [ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]+ \z/x) {
92  
93 # RGS 2001-11-05 : translate leading ^X to control-char
94 0 $name =~ s{\A \^ ([ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]) }{'qq(\c'.$1.')'}xee;
95 0 return 'main::' . $name;
96 }
97  
98 # Global names
99 elsif ($name =~ /\A (?: ARGV | ARGVOUT | ENV | INC | SIG | STDERR | STDIN | STDOUT ) \z/x) {
100 0 return 'main::' . $name;
101 }
102  
103 # or other
104 elsif ($name =~ /\A [^ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz] \z/x) {
105 0 return 'main::' . $name;
106 }
107  
108 elsif (defined $_[1]) {
109 15 return $_[1] . '::' . $name;
110 }
111 else {
112 0 return (caller)[0] . '::' . $name;
113 }
114 }
115  
116 20 ▶ sub qualify_to_ref ($;$) {
Subroutine qualify_to_ref: called CC=2 SCAR=7.2
Pod undocumented
117 20 ▶ if (defined $_[1]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[1]) { } 20 0 20
118 424 ▶ no strict qw(refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
119 20 return \*{ qualify $_[0], $_[1] };
120 }
121 else {
122 424 ▶ no strict qw(refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: not called CC=1 SCAR=0.0
123 0 return \*{ qualify $_[0], (caller)[0] };
124 }
125 }
126 }
127  
128 # P.714 29.2.39. flock
129 # in Chapter 29: Functions
130 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
131  
132 # P.863 flock
133 # in Chapter 27: Functions
134 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
135  
136 sub LOCK_SH() {1}
137 sub LOCK_EX() {2}
138 sub LOCK_UN() {8}
139 sub LOCK_NB() {4}
140  
141 # instead of Carp.pm
142 sub carp;
143 sub croak;
144 sub cluck;
145 sub confess;
146  
147 # 6.18. Matching Multiple-Byte Characters
148 # in Chapter 6. Pattern Matching
149 # of ISBN 978-1-56592-243-3 Perl Perl Cookbook.
150 # (and so on)
151  
152 # regexp of character
153 424 my $your_char = q{[\x00-\xFF]};
154 424 ▶use vars qw($qq_char); $qq_char = qr/\\c[\x40-\x5F]|\\?(?:$your_char)/oxms;
Subroutine BEGIN: called CC=1 SCAR=0.0
155 424 ▶use vars qw($q_char); $q_char = qr/$your_char/oxms;
Subroutine BEGIN: called CC=1 SCAR=0.0
156  
157 #
158 # Windows-1254 character range per length
159 #
160 424 my %range_tr = ();
161  
162 #
163 # Windows-1254 case conversion
164 #
165 424 my %lc = ();
166 424 @lc{qw(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)} =
167 qw(a b c d e f g h i j k l m n o p q r s t u v w x y z);
168 424 my %uc = ();
169 424 @uc{qw(a b c d e f g h i j k l m n o p q r s t u v w x y z)} =
170 qw(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z);
171 424 my %fc = ();
172 424 @fc{qw(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)} =
173 qw(a b c d e f g h i j k l m n o p q r s t u v w x y z);
174  
175 424 ▶if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { __PACKAGE__ =~ / \b Ewindows1254 \z/mosx }) { } 424 0 424
176 }
177  
178 elsif (__PACKAGE__ =~ / \b Ewindows1254 \z/oxms) {
179 424 %range_tr = (
180 1 => [ [0x00..0xFF],
181 ],
182 );
183  
184 424 %lc = (%lc,
185 "\x8A" => "\x9A", # LATIN LETTER S WITH CARON
186 "\x8C" => "\x9C", # LATIN LIGATURE OE
187 "\x9F" => "\xFF", # LATIN LETTER Y WITH DIAERESIS
188 "\xC0" => "\xE0", # LATIN LETTER A WITH GRAVE
189 "\xC1" => "\xE1", # LATIN LETTER A WITH ACUTE
190 "\xC2" => "\xE2", # LATIN LETTER A WITH CIRCUMFLEX
191 "\xC3" => "\xE3", # LATIN LETTER A WITH TILDE
192 "\xC4" => "\xE4", # LATIN LETTER A WITH DIAERESIS
193 "\xC5" => "\xE5", # LATIN LETTER A WITH RING ABOVE
194 "\xC6" => "\xE6", # LATIN LETTER AE
195 "\xC7" => "\xE7", # LATIN LETTER C WITH CEDILLA
196 "\xC8" => "\xE8", # LATIN LETTER E WITH GRAVE
197 "\xC9" => "\xE9", # LATIN LETTER E WITH ACUTE
198 "\xCA" => "\xEA", # LATIN LETTER E WITH CIRCUMFLEX
199 "\xCB" => "\xEB", # LATIN LETTER E WITH DIAERESIS
200 "\xCC" => "\xEC", # LATIN LETTER I WITH GRAVE
201 "\xCD" => "\xED", # LATIN LETTER I WITH ACUTE
202 "\xCE" => "\xEE", # LATIN LETTER I WITH CIRCUMFLEX
203 "\xCF" => "\xEF", # LATIN LETTER I WITH DIAERESIS
204 "\xD0" => "\xF0", # LATIN LETTER G WITH BREVE
205 "\xD1" => "\xF1", # LATIN LETTER N WITH TILDE
206 "\xD2" => "\xF2", # LATIN LETTER O WITH GRAVE
207 "\xD3" => "\xF3", # LATIN LETTER O WITH ACUTE
208 "\xD4" => "\xF4", # LATIN LETTER O WITH CIRCUMFLEX
209 "\xD5" => "\xF5", # LATIN LETTER O WITH TILDE
210 "\xD6" => "\xF6", # LATIN LETTER O WITH DIAERESIS
211 "\xD8" => "\xF8", # LATIN LETTER O WITH STROKE
212 "\xD9" => "\xF9", # LATIN LETTER U WITH GRAVE
213 "\xDA" => "\xFA", # LATIN LETTER U WITH ACUTE
214 "\xDB" => "\xFB", # LATIN LETTER U WITH CIRCUMFLEX
215 "\xDC" => "\xFC", # LATIN LETTER U WITH DIAERESIS
216 "\xDE" => "\xFE", # LATIN LETTER S WITH CEDILLA
217 );
218  
219 424 %uc = (%uc,
220 "\x9A" => "\x8A", # LATIN LETTER S WITH CARON
221 "\x9C" => "\x8C", # LATIN LIGATURE OE
222 "\xFF" => "\x9F", # LATIN LETTER Y WITH DIAERESIS
223 "\xE0" => "\xC0", # LATIN LETTER A WITH GRAVE
224 "\xE1" => "\xC1", # LATIN LETTER A WITH ACUTE
225 "\xE2" => "\xC2", # LATIN LETTER A WITH CIRCUMFLEX
226 "\xE3" => "\xC3", # LATIN LETTER A WITH TILDE
227 "\xE4" => "\xC4", # LATIN LETTER A WITH DIAERESIS
228 "\xE5" => "\xC5", # LATIN LETTER A WITH RING ABOVE
229 "\xE6" => "\xC6", # LATIN LETTER AE
230 "\xE7" => "\xC7", # LATIN LETTER C WITH CEDILLA
231 "\xE8" => "\xC8", # LATIN LETTER E WITH GRAVE
232 "\xE9" => "\xC9", # LATIN LETTER E WITH ACUTE
233 "\xEA" => "\xCA", # LATIN LETTER E WITH CIRCUMFLEX
234 "\xEB" => "\xCB", # LATIN LETTER E WITH DIAERESIS
235 "\xEC" => "\xCC", # LATIN LETTER I WITH GRAVE
236 "\xED" => "\xCD", # LATIN LETTER I WITH ACUTE
237 "\xEE" => "\xCE", # LATIN LETTER I WITH CIRCUMFLEX
238 "\xEF" => "\xCF", # LATIN LETTER I WITH DIAERESIS
239 "\xF0" => "\xD0", # LATIN LETTER G WITH BREVE
240 "\xF1" => "\xD1", # LATIN LETTER N WITH TILDE
241 "\xF2" => "\xD2", # LATIN LETTER O WITH GRAVE
242 "\xF3" => "\xD3", # LATIN LETTER O WITH ACUTE
243 "\xF4" => "\xD4", # LATIN LETTER O WITH CIRCUMFLEX
244 "\xF5" => "\xD5", # LATIN LETTER O WITH TILDE
245 "\xF6" => "\xD6", # LATIN LETTER O WITH DIAERESIS
246 "\xF8" => "\xD8", # LATIN LETTER O WITH STROKE
247 "\xF9" => "\xD9", # LATIN LETTER U WITH GRAVE
248 "\xFA" => "\xDA", # LATIN LETTER U WITH ACUTE
249 "\xFB" => "\xDB", # LATIN LETTER U WITH CIRCUMFLEX
250 "\xFC" => "\xDC", # LATIN LETTER U WITH DIAERESIS
251 "\xFE" => "\xDE", # LATIN LETTER S WITH CEDILLA
252 );
253  
254 424 %fc = (%fc,
255 "\x8A" => "\x9A", # LATIN CAPITAL LETTER S WITH CARON --> LATIN SMALL LETTER S WITH CARON
256 "\x8C" => "\x9C", # LATIN CAPITAL LIGATURE OE --> LATIN SMALL LIGATURE OE
257 "\x9F" => "\xFF", # LATIN CAPITAL LETTER Y WITH DIAERESIS --> LATIN SMALL LETTER Y WITH DIAERESIS
258 "\xC0" => "\xE0", # LATIN CAPITAL LETTER A WITH GRAVE --> LATIN SMALL LETTER A WITH GRAVE
259 "\xC1" => "\xE1", # LATIN CAPITAL LETTER A WITH ACUTE --> LATIN SMALL LETTER A WITH ACUTE
260 "\xC2" => "\xE2", # LATIN CAPITAL LETTER A WITH CIRCUMFLEX --> LATIN SMALL LETTER A WITH CIRCUMFLEX
261 "\xC3" => "\xE3", # LATIN CAPITAL LETTER A WITH TILDE --> LATIN SMALL LETTER A WITH TILDE
262 "\xC4" => "\xE4", # LATIN CAPITAL LETTER A WITH DIAERESIS --> LATIN SMALL LETTER A WITH DIAERESIS
263 "\xC5" => "\xE5", # LATIN CAPITAL LETTER A WITH RING ABOVE --> LATIN SMALL LETTER A WITH RING ABOVE
264 "\xC6" => "\xE6", # LATIN CAPITAL LETTER AE --> LATIN SMALL LETTER AE
265 "\xC7" => "\xE7", # LATIN CAPITAL LETTER C WITH CEDILLA --> LATIN SMALL LETTER C WITH CEDILLA
266 "\xC8" => "\xE8", # LATIN CAPITAL LETTER E WITH GRAVE --> LATIN SMALL LETTER E WITH GRAVE
267 "\xC9" => "\xE9", # LATIN CAPITAL LETTER E WITH ACUTE --> LATIN SMALL LETTER E WITH ACUTE
268 "\xCA" => "\xEA", # LATIN CAPITAL LETTER E WITH CIRCUMFLEX --> LATIN SMALL LETTER E WITH CIRCUMFLEX
269 "\xCB" => "\xEB", # LATIN CAPITAL LETTER E WITH DIAERESIS --> LATIN SMALL LETTER E WITH DIAERESIS
270 "\xCC" => "\xEC", # LATIN CAPITAL LETTER I WITH GRAVE --> LATIN SMALL LETTER I WITH GRAVE
271 "\xCD" => "\xED", # LATIN CAPITAL LETTER I WITH ACUTE --> LATIN SMALL LETTER I WITH ACUTE
272 "\xCE" => "\xEE", # LATIN CAPITAL LETTER I WITH CIRCUMFLEX --> LATIN SMALL LETTER I WITH CIRCUMFLEX
273 "\xCF" => "\xEF", # LATIN CAPITAL LETTER I WITH DIAERESIS --> LATIN SMALL LETTER I WITH DIAERESIS
274 "\xD0" => "\xF0", # LATIN CAPITAL LETTER G WITH BREVE --> LATIN SMALL LETTER G WITH BREVE
275 "\xD1" => "\xF1", # LATIN CAPITAL LETTER N WITH TILDE --> LATIN SMALL LETTER N WITH TILDE
276 "\xD2" => "\xF2", # LATIN CAPITAL LETTER O WITH GRAVE --> LATIN SMALL LETTER O WITH GRAVE
277 "\xD3" => "\xF3", # LATIN CAPITAL LETTER O WITH ACUTE --> LATIN SMALL LETTER O WITH ACUTE
278 "\xD4" => "\xF4", # LATIN CAPITAL LETTER O WITH CIRCUMFLEX --> LATIN SMALL LETTER O WITH CIRCUMFLEX
279 "\xD5" => "\xF5", # LATIN CAPITAL LETTER O WITH TILDE --> LATIN SMALL LETTER O WITH TILDE
280 "\xD6" => "\xF6", # LATIN CAPITAL LETTER O WITH DIAERESIS --> LATIN SMALL LETTER O WITH DIAERESIS
281 "\xD8" => "\xF8", # LATIN CAPITAL LETTER O WITH STROKE --> LATIN SMALL LETTER O WITH STROKE
282 "\xD9" => "\xF9", # LATIN CAPITAL LETTER U WITH GRAVE --> LATIN SMALL LETTER U WITH GRAVE
283 "\xDA" => "\xFA", # LATIN CAPITAL LETTER U WITH ACUTE --> LATIN SMALL LETTER U WITH ACUTE
284 "\xDB" => "\xFB", # LATIN CAPITAL LETTER U WITH CIRCUMFLEX --> LATIN SMALL LETTER U WITH CIRCUMFLEX
285 "\xDC" => "\xFC", # LATIN CAPITAL LETTER U WITH DIAERESIS --> LATIN SMALL LETTER U WITH DIAERESIS
286 "\xDD" => "\x69", # LATIN CAPITAL LETTER I WITH DOT ABOVE --> LATIN SMALL LETTER I (without COMBINING DOT ABOVE)
287 "\xDE" => "\xFE", # LATIN CAPITAL LETTER S WITH CEDILLA --> LATIN SMALL LETTER S WITH CEDILLA
288 "\xDF" => "\x73\x73", # LATIN SMALL LETTER SHARP S --> LATIN SMALL LETTER S, LATIN SMALL LETTER S
289 );
290 }
291  
292 else {
293 0 croak "Don't know my package name '@{[__PACKAGE__]}'";
294 }
295  
296 #
297 # @ARGV wildcard globbing
298 #
299 212 ▶sub import {
Subroutine import: called CC=7 SCAR=28.3
300  
301 212 ▶ if ($^O =~ /\A (?: MSWin32 | NetWare | symbian | dos ) \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O =~ /\A (?: MSWin32 | NetWare | symbian | dos ) \z/mosx) 0 212 212
302 0 my @argv = ();
303 0 for (@ARGV) {
304  
305 # has space
306 0 ▶ if (/\A (?:$q_char)*? [ ] /oxms) {
Branch: 2 branches
BranchTrueFalseTotal
if (/\A (?:$Ewindows1254::q_char)*? [ ] /mosx) { } 0 0 0
elsif (/\A (?:$Ewindows1254::q_char)*? [*?] /mosx) { } 0 0 0
307 0 ▶ if (my @glob = Ewindows1254::glob(qq{"$_"})) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@glob) = &Ewindows1254::glob(qq["$_"])) { } 0 0 0
308 0 push @argv, @glob;
309 }
310 else {
311 0 push @argv, $_;
312 }
313 }
314  
315 # has wildcard metachar
316 elsif (/\A (?:$q_char)*? [*?] /oxms) {
317 0 ▶ if (my @glob = Ewindows1254::glob($_)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@glob) = &Ewindows1254::glob($_)) { } 0 0 0
318 0 push @argv, @glob;
319 }
320 else {
321 0 push @argv, $_;
322 }
323 }
324  
325 # no wildcard globbing
326 else {
327 0 push @argv, $_;
328 }
329 }
330 0 @ARGV = @argv;
331 }
332  
333 212 *Char::ord = \&Windows1254::ord;
334 212 *Char::ord_ = \&Windows1254::ord_;
335 212 *Char::reverse = \&Windows1254::reverse;
336 212 *Char::getc = \&Windows1254::getc;
337 212 *Char::length = \&Windows1254::length;
338 212 *Char::substr = \&Windows1254::substr;
339 212 *Char::index = \&Windows1254::index;
340 212 *Char::rindex = \&Windows1254::rindex;
341 212 *Char::eval = \&Windows1254::eval;
342 212 *Char::escape = \&Windows1254::escape;
343 212 *Char::escape_token = \&Windows1254::escape_token;
344 212 *Char::escape_script = \&Windows1254::escape_script;
345 }
346  
347 # P.230 Care with Prototypes
348 # in Chapter 6: Subroutines
349 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
350 #
351 # If you aren't careful, you can get yourself into trouble with prototypes.
352 # But if you are careful, you can do a lot of neat things with them. This is
353 # all very powerful, of course, and should only be used in moderation to make
354 # the world a better place.
355  
356 # P.332 Care with Prototypes
357 # in Chapter 7: Subroutines
358 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
359 #
360 # If you aren't careful, you can get yourself into trouble with prototypes.
361 # But if you are careful, you can do a lot of neat things with them. This is
362 # all very powerful, of course, and should only be used in moderation to make
363 # the world a better place.
364  
365 #
366 # Prototypes of subroutines
367 #
368 0 ▶sub unimport {}
Subroutine unimport: not called CC=1 SCAR=0.0
369 sub Ewindows1254::split(;$$$);
370 sub Ewindows1254::tr($$$$;$);
371 sub Ewindows1254::chop(@);
372 sub Ewindows1254::index($$;$);
373 sub Ewindows1254::rindex($$;$);
374 sub Ewindows1254::lcfirst(@);
375 sub Ewindows1254::lcfirst_();
376 sub Ewindows1254::lc(@);
377 sub Ewindows1254::lc_();
378 sub Ewindows1254::ucfirst(@);
379 sub Ewindows1254::ucfirst_();
380 sub Ewindows1254::uc(@);
381 sub Ewindows1254::uc_();
382 sub Ewindows1254::fc(@);
383 sub Ewindows1254::fc_();
384 sub Ewindows1254::ignorecase;
385 sub Ewindows1254::classic_character_class;
386 sub Ewindows1254::capture;
387 sub Ewindows1254::chr(;$);
388 sub Ewindows1254::chr_();
389 sub Ewindows1254::glob($);
390 sub Ewindows1254::glob_();
391  
392 sub Windows1254::ord(;$);
393 sub Windows1254::ord_();
394 sub Windows1254::reverse(@);
395 sub Windows1254::getc(;*@);
396 sub Windows1254::length(;$);
397 sub Windows1254::substr($$;$$);
398 sub Windows1254::index($$;$);
399 sub Windows1254::rindex($$;$);
400 sub Windows1254::escape(;$);
401  
402 #
403 # Regexp work
404 #
405 424 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
406 $re_a
407 $re_t
408 $re_n
409 $re_r
410 424 );
411  
412 #
413 # Character class
414 #
415 424 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
416 $dot
417 $dot_s
418 $eD
419 $eS
420 $eW
421 $eH
422 $eV
423 $eR
424 $eN
425 $not_alnum
426 $not_alpha
427 $not_ascii
428 $not_blank
429 $not_cntrl
430 $not_digit
431 $not_graph
432 $not_lower
433 $not_lower_i
434 $not_print
435 $not_punct
436 $not_space
437 $not_upper
438 $not_upper_i
439 $not_word
440 $not_xdigit
441 $eb
442 $eB
443 424 );
444  
445 424 ${Ewindows1254::dot} = qr{(?>[^\x0A])};
446 424 ${Ewindows1254::dot_s} = qr{(?>[\x00-\xFF])};
447 424 ${Ewindows1254::eD} = qr{(?>[^0-9])};
448  
449 # Vertical tabs are now whitespace
450 # \s in a regex now matches a vertical tab in all circumstances.
451 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
452 # ${Ewindows1254::eS} = qr{(?>[^\x09\x0A \x0C\x0D\x20])};
453 # ${Ewindows1254::eS} = qr{(?>[^\x09\x0A\x0B\x0C\x0D\x20])};
454 424 ${Ewindows1254::eS} = qr{(?>[^\s])};
455  
456 424 ${Ewindows1254::eW} = qr{(?>[^0-9A-Z_a-z])};
457 424 ${Ewindows1254::eH} = qr{(?>[^\x09\x20])};
458 424 ${Ewindows1254::eV} = qr{(?>[^\x0A\x0B\x0C\x0D])};
459 424 ${Ewindows1254::eR} = qr{(?>\x0D\x0A|[\x0A\x0D])};
460 424 ${Ewindows1254::eN} = qr{(?>[^\x0A])};
461 424 ${Ewindows1254::not_alnum} = qr{(?>[^\x30-\x39\x41-\x5A\x61-\x7A])};
462 424 ${Ewindows1254::not_alpha} = qr{(?>[^\x41-\x5A\x61-\x7A])};
463 424 ${Ewindows1254::not_ascii} = qr{(?>[^\x00-\x7F])};
464 424 ${Ewindows1254::not_blank} = qr{(?>[^\x09\x20])};
465 424 ${Ewindows1254::not_cntrl} = qr{(?>[^\x00-\x1F\x7F])};
466 424 ${Ewindows1254::not_digit} = qr{(?>[^\x30-\x39])};
467 424 ${Ewindows1254::not_graph} = qr{(?>[^\x21-\x7F])};
468 424 ${Ewindows1254::not_lower} = qr{(?>[^\x61-\x7A])};
469 424 ${Ewindows1254::not_lower_i} = qr{(?>[^\x41-\x5A\x61-\x7A])}; # Perl 5.16 compatible
470 # ${Ewindows1254::not_lower_i} = qr{(?>[\x00-\xFF])}; # older Perl compatible
471 424 ${Ewindows1254::not_print} = qr{(?>[^\x20-\x7F])};
472 424 ${Ewindows1254::not_punct} = qr{(?>[^\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E])};
473 424 ${Ewindows1254::not_space} = qr{(?>[^\s\x0B])};
474 424 ${Ewindows1254::not_upper} = qr{(?>[^\x41-\x5A])};
475 424 ${Ewindows1254::not_upper_i} = qr{(?>[^\x41-\x5A\x61-\x7A])}; # Perl 5.16 compatible
476 # ${Ewindows1254::not_upper_i} = qr{(?>[\x00-\xFF])}; # older Perl compatible
477 424 ${Ewindows1254::not_word} = qr{(?>[^\x30-\x39\x41-\x5A\x5F\x61-\x7A])};
478 424 ${Ewindows1254::not_xdigit} = qr{(?>[^\x30-\x39\x41-\x46\x61-\x66])};
479 424 ${Ewindows1254::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))};
480 424 ${Ewindows1254::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]))};
481  
482 # avoid: Name "Ewindows1254::foo" used only once: possible typo at here.
483 424 ${Ewindows1254::dot} = ${Ewindows1254::dot};
484 424 ${Ewindows1254::dot_s} = ${Ewindows1254::dot_s};
485 424 ${Ewindows1254::eD} = ${Ewindows1254::eD};
486 424 ${Ewindows1254::eS} = ${Ewindows1254::eS};
487 424 ${Ewindows1254::eW} = ${Ewindows1254::eW};
488 424 ${Ewindows1254::eH} = ${Ewindows1254::eH};
489 424 ${Ewindows1254::eV} = ${Ewindows1254::eV};
490 424 ${Ewindows1254::eR} = ${Ewindows1254::eR};
491 424 ${Ewindows1254::eN} = ${Ewindows1254::eN};
492 424 ${Ewindows1254::not_alnum} = ${Ewindows1254::not_alnum};
493 424 ${Ewindows1254::not_alpha} = ${Ewindows1254::not_alpha};
494 424 ${Ewindows1254::not_ascii} = ${Ewindows1254::not_ascii};
495 424 ${Ewindows1254::not_blank} = ${Ewindows1254::not_blank};
496 424 ${Ewindows1254::not_cntrl} = ${Ewindows1254::not_cntrl};
497 424 ${Ewindows1254::not_digit} = ${Ewindows1254::not_digit};
498 424 ${Ewindows1254::not_graph} = ${Ewindows1254::not_graph};
499 424 ${Ewindows1254::not_lower} = ${Ewindows1254::not_lower};
500 424 ${Ewindows1254::not_lower_i} = ${Ewindows1254::not_lower_i};
501 424 ${Ewindows1254::not_print} = ${Ewindows1254::not_print};
502 424 ${Ewindows1254::not_punct} = ${Ewindows1254::not_punct};
503 424 ${Ewindows1254::not_space} = ${Ewindows1254::not_space};
504 424 ${Ewindows1254::not_upper} = ${Ewindows1254::not_upper};
505 424 ${Ewindows1254::not_upper_i} = ${Ewindows1254::not_upper_i};
506 424 ${Ewindows1254::not_word} = ${Ewindows1254::not_word};
507 424 ${Ewindows1254::not_xdigit} = ${Ewindows1254::not_xdigit};
508 424 ${Ewindows1254::eb} = ${Ewindows1254::eb};
509 424 ${Ewindows1254::eB} = ${Ewindows1254::eB};
510  
511 #
512 # Windows-1254 split
513 #
514 72 ▶sub Ewindows1254::split(;$$$) {
Subroutine split: called CC=34 SCAR=38.5
Pod undocumented
515  
516 # P.794 29.2.161. split
517 # in Chapter 29: Functions
518 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
519  
520 # P.951 split
521 # in Chapter 27: Functions
522 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
523  
524 72 my $pattern = $_[0];
525 72 my $string = $_[1];
526 72 my $limit = $_[2];
527  
528 # if $pattern is also omitted or is the literal space, " "
529 72 ▶ if (not defined $pattern) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $pattern) 2 70 72
530 2 $pattern = ' ';
531 }
532  
533 # if $string is omitted, the function splits the $_ string
534 72 ▶ if (not defined $string) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $string) 6 66 72
535 6 ▶ if (defined $_) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_) { } 0 6 6
536 0 $string = $_;
537 }
538 else {
539 6 $string = '';
540 }
541 }
542  
543 72 my @split = ();
544  
545 # when string is empty
546 72 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 10 62 72
elsif ($pattern eq ' ') { } 2 60 62
547  
548 # resulting list value in list context
549 10 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 5 5 10
550 5 return @split;
551 }
552  
553 # count of substrings in scalar context
554 else {
555 5 ▶ carp "Use of implicit split to \@_ is deprecated" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 5 5
556 5 @_ = @split;
557 5 return scalar @_;
558 }
559 }
560  
561 # split's first argument is more consistently interpreted
562 #
563 # After some changes earlier in v5.17, split's behavior has been simplified:
564 # if the PATTERN argument evaluates to a string containing one space, it is
565 # treated the way that a literal string containing one space once was.
566 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#split's_first_argument_is_more_consistently_interpreted
567  
568 # if $pattern is also omitted or is the literal space, " ", the function splits
569 # on whitespace, /\s+/, after skipping any leading whitespace
570 # (and so on)
571  
572 elsif ($pattern eq ' ') {
573 2 ▶ if (not defined $limit) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $limit) { } 2 0 2
574 2 return CORE::split(' ', $string);
575 }
576 else {
577 0 return CORE::split(' ', $string, $limit);
578 }
579 }
580  
581 # if $limit is negative, it is treated as if an arbitrarily large $limit has been specified
582 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
583  
584 # a pattern capable of matching either the null string or something longer than the
585 # null string will split the value of $string into separate characters wherever it
586 # matches the null string between characters
587 # (and so on)
588  
589 60 ▶ if ('' =~ / \A $pattern \z /xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ('' =~ / \A $pattern \z /msx) { } 2 58 60
590 2 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
591 2 my $limit = scalar(() = $string =~ /($pattern)/oxmsg);
592  
593 # P.1024 Appendix W.10 Multibyte Processing
594 # of ISBN 1-56592-224-7 CJKV Information Processing
595 # (and so on)
596  
597 # the //m modifier is assumed when you split on the pattern /^/
598 # (and so on)
599  
600 2 ▶ eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
Subroutine BEGIN: called CC=1 SCAR=0.0
601 # V
602 2 ▶ while ((--$limit > 0) and ($string =~ s/\A((?:$q_char)+?)$pattern//m)) {
Branch: 1 branch
BranchTrueFalseTotal
if (--$limit > 0 and $string =~ s/\A((?:$Ewindows1254::q_char)+?)$pattern//m) 9 2 11
Condition100%3/3
--$limit > 0 and $string =~ s/\A((?:$Ewindows1254::q_char)+?)$pattern//m
!ll&&!rl&&r
119
MC/DC100%2/2
--$limit > 0 and $string =~ s/\A((?:$Ewindows1254::q_char)+?)$pattern//m
--$limit > 0 $string =~ s/\A((?:$Ewindows1254::q_char)+?)$pattern//m
Truth table100%3/3
A and B
A= --$limit > 0B= $string =~ s/\A((?:$Ewindows1254::q_char)+?)$pattern//m
ABresult
0X0
100
111
603  
604 # if the $pattern contains parentheses, then the substring matched by each pair of parentheses
605 # is included in the resulting list, interspersed with the fields that are ordinarily returned
606 # (and so on)
607  
608 9 local $@;
609 9 ▶ eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
610 9 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 9 9 18
611 9 push @split, CORE::eval('$' . $digit);
612 }
613 }
614 }
615  
616 else {
617 58 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
618  
619 58 ▶ eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
620 # V
621 58 ▶ while ($string =~ s/\A((?:$q_char)*?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Ewindows1254::q_char)*?)$pattern//m) 163 58 221
622 163 local $@;
623 163 ▶ eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
624 163 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 230 163 393
625 230 push @split, CORE::eval('$' . $digit);
626 }
627 }
628 }
629 }
630  
631 elsif ($limit > 0) {
632 0 ▶ if ('' =~ / \A $pattern \z /xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ('' =~ / \A $pattern \z /msx) { } 0 0 0
633 0 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
634 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
635  
636 0 eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
637 # V
638 0 ▶ if ($string =~ s/\A((?:$q_char)+?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Ewindows1254::q_char)+?)$pattern//m) 0 0 0
639 0 local $@;
640 0 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 0 0 0
641 0 push @split, CORE::eval('$' . $digit);
642 }
643 }
644 }
645 }
646 else {
647 0 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
648 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
649  
650 0 eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
651 # V
652 0 ▶ if ($string =~ s/\A((?:$q_char)*?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Ewindows1254::q_char)*?)$pattern//m) 0 0 0
653 0 local $@;
654 0 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 0 0 0
655 0 push @split, CORE::eval('$' . $digit);
656 }
657 }
658 }
659 }
660 }
661  
662 60 ▶ if (CORE::length($string) > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $string > 0) 58 2 60
663 58 push @split, $string;
664 }
665  
666 # if $_[2] (NOT "$limit") is omitted or zero, trailing null fields are stripped from the result
667 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
668 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
669 0 pop @split;
670 }
671 }
672  
673 # resulting list value in list context
674 60 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 58 2 60
675 58 return @split;
676 }
677  
678 # count of substrings in scalar context
679 else {
680 2 ▶ carp "Use of implicit split to \@_ is deprecated" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 2 2
681 2 @_ = @split;
682 2 return scalar @_;
683 }
684 }
685  
686 #
687 # get last subexpression offsets
688 #
689 60 ▶sub _last_subexpression_offsets {
Subroutine _last_subexpression_offsets: called CC=3 SCAR=11.0
690 60 my $pattern = $_[0];
691  
692 # remove comment
693 60 $pattern =~ s/\(\?\# .*? \)//oxmsg;
694  
695 60 my $modifier = '';
696 60 ▶ if ($pattern =~ /\(\?\^? ([\-A-Za-z]+) :/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pattern =~ /\(\?\^? ([\-A-Za-z]+) :/mosx) 11 49 60
697 11 $modifier = $1;
698 11 $modifier =~ s/-[A-Za-z]*//;
699 }
700  
701 # with /x modifier
702 60 my @char = ();
703 60 ▶ if ($modifier =~ /x/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /x/mosx) { } 5 55 60
704 5 @char = $pattern =~ /\G((?>
705 [^\\\#\[\(] |
706 \\ $q_char |
707 \# (?>[^\n]*) $ |
708 \[ (?>(?:[^\\\]]|\\\\|\\\]|$q_char)+) \] |
709 \(\? |
710 $q_char
711 ))/oxmsg;
712 }
713  
714 # without /x modifier
715 else {
716 55 @char = $pattern =~ /\G((?>
717 [^\\\[\(] |
718 \\ $q_char |
719 \[ (?>(?:[^\\\]]|\\\\|\\\]|$q_char)+) \] |
720 \(\? |
721 $q_char
722 ))/oxmsg;
723 }
724  
725 60 return scalar grep { $_ eq '(' } @char;
726 }
727  
728 #
729 # Windows-1254 transliteration (tr///)
730 #
731 6 ▶sub Ewindows1254::tr($$$$;$) {
Subroutine tr: called CC=26 SCAR=48.6
Pod undocumented
732  
733 6 my $bind_operator = $_[1];
734 6 my $searchlist = $_[2];
735 6 my $replacementlist = $_[3];
736 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
737  
738 6 ▶ if ($modifier =~ /r/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /r/mosx) 5 1 6
739 5 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) 0 5 5
740 0 croak "Using !~ with tr///r doesn't make sense";
741 }
742 }
743  
744 6 my @char = $_[0] =~ /\G (?>$q_char) /oxmsg;
745 6 my @searchlist = _charlist_tr($searchlist);
746 6 my @replacementlist = _charlist_tr($replacementlist);
747  
748 6 my %tr = ();
749 6 ▶ for (my $i=0; $i <= $#searchlist; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#searchlist) 19 6 25
750 19 ▶ if (not exists $tr{$searchlist[$i]}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $tr{$searchlist[$i]}) 19 0 19
751 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
752 19 $tr{$searchlist[$i]} = $replacementlist[$i];
753 }
754 elsif ($modifier =~ /d/oxms) {
755 0 $tr{$searchlist[$i]} = '';
756 }
757 ▶ 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
758 0 $tr{$searchlist[$i]} = $replacementlist[-1];
759 }
760 else {
761 0 $tr{$searchlist[$i]} = $searchlist[$i];
762 }
763 }
764 }
765  
766 6 my $tr = 0;
767 6 my $replaced = '';
768 6 ▶ if ($modifier =~ /c/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /c/mosx) { } 0 6 6
769 0 ▶ while (defined(my $char = shift @char)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $char = shift @char)) 0 0 0
770 0 ▶ if (not exists $tr{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $tr{$char}) { } 0 0 0
771 0 ▶ if (defined $replacementlist[-1]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $replacementlist[-1]) 0 0 0
772 0 $replaced .= $replacementlist[-1];
773 }
774 0 $tr++;
775 0 ▶ if ($modifier =~ /s/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/mosx) 0 0 0
776 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
777 0 shift @char;
778 0 $tr++;
779 }
780 }
781 }
782 else {
783 0 $replaced .= $char;
784 }
785 }
786 }
787 else {
788 6 ▶ while (defined(my $char = shift @char)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $char = shift @char)) 36 6 42
789 36 ▶ if (exists $tr{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $tr{$char}) { } 19 17 36
790 19 $replaced .= $tr{$char};
791 19 $tr++;
792 19 ▶ if ($modifier =~ /s/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/mosx) 0 19 19
793 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
794 0 shift @char;
795 0 $tr++;
796 }
797 }
798 }
799 else {
800 17 $replaced .= $char;
801 }
802 }
803 }
804  
805 6 ▶ if ($modifier =~ /r/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /r/mosx) { } 5 1 6
806 5 return $replaced;
807 }
808 else {
809 1 $_[0] = $replaced;
810 1 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) { } 0 1 1
811 0 return not $tr;
812 }
813 else {
814 1 return $tr;
815 }
816 }
817 }
818  
819 #
820 # Windows-1254 chop
821 #
822 0 ▶sub Ewindows1254::chop(@) {
Subroutine chop: not called CC=3 SCAR=24.8
Pod undocumented
823  
824 0 my $chop;
825 0 ▶ if (@_ == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 0) { } 0 0 0
826 0 my @char = /\G (?>$q_char) /oxmsg;
827 0 $chop = pop @char;
828 0 $_ = join '', @char;
829 }
830 else {
831 0 for (@_) {
832 0 my @char = /\G (?>$q_char) /oxmsg;
833 0 $chop = pop @char;
834 0 $_ = join '', @char;
835 }
836 }
837 0 return $chop;
838 }
839  
840 #
841 # Windows-1254 index by octet
842 #
843 30 ▶sub Ewindows1254::index($$;$) {
Subroutine index: called CC=6 SCAR=20.8
Pod documented
844  
845 30 my($str,$substr,$position) = @_;
846 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
847 30 my $pos = 0;
848  
849 30 ▶ while ($pos < CORE::length($str)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos < length $str) 130 30 160
850 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
851 0 ▶ if ($pos >= $position) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos >= $position) 0 0 0
852 0 return $pos;
853 }
854 }
855 130 ▶ if (CORE::substr($str,$pos) =~ /\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($str, $pos) =~ /\A ($Ewindows1254::q_char) /mosx) { } 130 0 130
856 130 $pos += CORE::length($1);
857 }
858 else {
859 0 $pos += 1;
860 }
861 }
862 30 return -1;
863 }
864  
865 #
866 # Windows-1254 reverse index
867 #
868 0 ▶sub Ewindows1254::rindex($$;$) {
Subroutine rindex: not called CC=6 SCAR=37.4
Pod undocumented
869  
870 0 my($str,$substr,$position) = @_;
871 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
872 0 my $pos = 0;
873 0 my $rindex = -1;
874  
875 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
876 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
877 0 $rindex = $pos;
878 }
879 0 ▶ if (CORE::substr($str,$pos) =~ /\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($str, $pos) =~ /\A ($Ewindows1254::q_char) /mosx) { } 0 0 0
880 0 $pos += CORE::length($1);
881 }
882 else {
883 0 $pos += 1;
884 }
885 }
886 0 return $rindex;
887 }
888  
889 #
890 # Windows-1254 lower case first with parameter
891 #
892 0 ▶sub Ewindows1254::lcfirst(@) {
Subroutine lcfirst: not called CC=4 SCAR=30.0
Pod undocumented
893 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
894 0 my $s = shift @_;
895 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
896 0 return Ewindows1254::lc(CORE::substr($s,0,1)) . CORE::substr($s,1), @_;
897 }
898 else {
899 0 return Ewindows1254::lc(CORE::substr($s,0,1)) . CORE::substr($s,1);
900 }
901 }
902 else {
903 0 return Ewindows1254::lc(CORE::substr($_,0,1)) . CORE::substr($_,1);
904 }
905 }
906  
907 #
908 # Windows-1254 lower case first without parameter
909 #
910 0 ▶sub Ewindows1254::lcfirst_() {
Subroutine lcfirst_: not called CC=1 SCAR=6.9
Pod undocumented
911 0 return Ewindows1254::lc(CORE::substr($_,0,1)) . CORE::substr($_,1);
912 }
913  
914 #
915 # Windows-1254 lower case with parameter
916 #
917 59 ▶sub Ewindows1254::lc(@) {
Subroutine lc: called CC=6 SCAR=24.2
Pod undocumented
918 59 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 59 0 59
919 59 my $s = shift @_;
920 59 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 59 59
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
5900
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
921 0 ▶ return join('', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 0 0 0
922 }
923 else {
924 59 ▶ return join('', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 61 0 61
925 }
926 }
927 else {
928 0 return Ewindows1254::lc_();
929 }
930 }
931  
932 #
933 # Windows-1254 lower case without parameter
934 #
935 0 ▶sub Ewindows1254::lc_() {
Subroutine lc_: not called CC=2 SCAR=17.9
Pod undocumented
936 0 my $s = $_;
937 0 ▶ return join '', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 0 0 0
938 }
939  
940 #
941 # Windows-1254 upper case first with parameter
942 #
943 0 ▶sub Ewindows1254::ucfirst(@) {
Subroutine ucfirst: not called CC=4 SCAR=30.0
Pod undocumented
944 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
945 0 my $s = shift @_;
946 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
947 0 return Ewindows1254::uc(CORE::substr($s,0,1)) . CORE::substr($s,1), @_;
948 }
949 else {
950 0 return Ewindows1254::uc(CORE::substr($s,0,1)) . CORE::substr($s,1);
951 }
952 }
953 else {
954 0 return Ewindows1254::uc(CORE::substr($_,0,1)) . CORE::substr($_,1);
955 }
956 }
957  
958 #
959 # Windows-1254 upper case first without parameter
960 #
961 0 ▶sub Ewindows1254::ucfirst_() {
Subroutine ucfirst_: not called CC=1 SCAR=6.9
Pod undocumented
962 0 return Ewindows1254::uc(CORE::substr($_,0,1)) . CORE::substr($_,1);
963 }
964  
965 #
966 # Windows-1254 upper case with parameter
967 #
968 2675 ▶sub Ewindows1254::uc(@) {
Subroutine uc: called CC=6 SCAR=22.9
Pod undocumented
969 2675 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2675 0 2675
970 2675 my $s = shift @_;
971 2675 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 2675 2675
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
267500
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
972 0 ▶ return join('', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 0 0 0
973 }
974 else {
975 2675 ▶ return join('', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 1110 1567 2677
976 }
977 }
978 else {
979 0 return Ewindows1254::uc_();
980 }
981 }
982  
983 #
984 # Windows-1254 upper case without parameter
985 #
986 0 ▶sub Ewindows1254::uc_() {
Subroutine uc_: not called CC=2 SCAR=17.9
Pod undocumented
987 0 my $s = $_;
988 0 ▶ return join '', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 0 0 0
989 }
990  
991 #
992 # Windows-1254 fold case with parameter
993 #
994 2687 ▶sub Ewindows1254::fc(@) {
Subroutine fc: called CC=6 SCAR=22.9
Pod undocumented
995 2687 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2687 0 2687
996 2687 my $s = shift @_;
997 2687 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 2687 2687
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
268700
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
998 0 ▶ return join('', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 0 0 0
999 }
1000 else {
1001 2687 ▶ return join('', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 2305 5427 7732
1002 }
1003 }
1004 else {
1005 0 return Ewindows1254::fc_();
1006 }
1007 }
1008  
1009 #
1010 # Windows-1254 fold case without parameter
1011 #
1012 0 ▶sub Ewindows1254::fc_() {
Subroutine fc_: not called CC=2 SCAR=17.9
Pod undocumented
1013 0 my $s = $_;
1014 0 ▶ return join '', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 0 0 0
1015 }
1016  
1017 #
1018 # Windows-1254 regexp capture
1019 #
1020 {
1021 0 ▶ sub Ewindows1254::capture {
Subroutine capture: not called CC=1 SCAR=6.9
Pod documented
1022 0 return $_[0];
1023 }
1024 }
1025  
1026 #
1027 # Windows-1254 regexp ignore case modifier
1028 #
1029 424 ▶sub Ewindows1254::ignorecase {
Subroutine ignorecase: called CC=25 SCAR=52.1
Pod undocumented
1030  
1031 11 my @string = @_;
1032 11 my $metachar = qr/[\@\\|[\]{]/oxms;
1033  
1034 # ignore case of $scalar or @array
1035 11 for my $string (@string) {
1036  
1037 # split regexp
1038 11 my @char = $string =~ /\G (?>\[\^|\\$q_char|$q_char) /oxmsg;
1039  
1040 # unescape character
1041 11 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 972 11 983
1042 972 ▶ next if not defined $char[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $char[$i] 0 972 972
1043  
1044 # open character class [...]
1045 972 ▶ if ($char[$i] eq '[') {
Branch: 4 branches
BranchTrueFalseTotal
if ($char[$i] eq '[') { } 0 972 972
elsif ($char[$i] eq '[^') { } 0 972 972
elsif (my $char = classic_character_class($char[$i])) { } 0 972 972
elsif ($char[$i] =~ /\A [\x00-\xFF] \z/mosx) { } 972 0 972
1046 0 my $left = $i;
1047  
1048 # [] make die "unmatched [] in regexp ...\n"
1049  
1050 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
1051 0 $i++;
1052 }
1053  
1054 0 while (1) {
1055 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
1056 0 croak "Unmatched [] in regexp";
1057 }
1058 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
1059 0 my $right = $i;
1060 0 my @charlist = charlist_qr(@char[$left+1..$right-1], 'i');
1061  
1062 # escape character
1063 0 for my $char (@charlist) {
1064 0 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $char =~ /\A [.|)] \z/mosx }) 0 0 0
1065 }
1066  
1067 0 elsif ($char =~ /\A [.|)] \z/oxms) {
1068 0 $char = '\\' . $char;
1069 }
1070 }
1071  
1072 # [...]
1073 0 splice @char, $left, $right-$left+1, '(?:' . join('|', @charlist) . ')';
1074  
1075 0 $i = $left;
1076 0 last;
1077 }
1078 }
1079 }
1080  
1081 # open character class [^...]
1082 elsif ($char[$i] eq '[^') {
1083 0 my $left = $i;
1084  
1085 # [^] make die "unmatched [] in regexp ...\n"
1086  
1087 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
1088 0 $i++;
1089 }
1090  
1091 0 while (1) {
1092 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
1093 0 croak "Unmatched [] in regexp";
1094 }
1095 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
1096 0 my $right = $i;
1097 0 my @charlist = charlist_not_qr(@char[$left+1..$right-1], 'i');
1098  
1099 # escape character
1100 0 for my $char (@charlist) {
1101 0 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $char =~ /\A [.|)] \z/mosx }) 0 0 0
1102 }
1103  
1104 0 elsif ($char =~ /\A [.|)] \z/oxms) {
1105 0 $char = '\\' . $char;
1106 }
1107 }
1108  
1109 # [^...]
1110 0 splice @char, $left, $right-$left+1, '(?!' . join('|', @charlist) . ")(?:$your_char)";
1111  
1112 0 $i = $left;
1113 0 last;
1114 }
1115 }
1116 }
1117  
1118 # rewrite classic character class or escape character
1119 elsif (my $char = classic_character_class($char[$i])) {
1120 0 $char[$i] = $char;
1121 }
1122  
1123 # with /i modifier
1124 elsif ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) {
1125 972 my $uc = Ewindows1254::uc($char[$i]);
1126 972 my $fc = Ewindows1254::fc($char[$i]);
1127 972 ▶ if ($uc ne $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc ne $fc) 500 472 972
1128 500 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 497 3 500
1129 497 $char[$i] = '[' . $uc . $fc . ']';
1130 }
1131 else {
1132 3 $char[$i] = '(?:' . $uc . '|' . $fc . ')';
1133 }
1134 }
1135 }
1136 }
1137  
1138 # characterize
1139 11 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 972 11 983
1140 972 ▶ next if not defined $char[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $char[$i] 0 972 972
1141  
1142 972 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx }) 0 983 983
1143 }
1144  
1145 # quote character before ? + * {
1146 0 ▶ elsif (($i >= 1) and ($char[$i] =~ /\A [\?\+\*\{] \z/oxms)) {
Condition66%2/3
$i >= 1 && $char[$i] =~ /\A [\?\+\*\{] \z/mosx
!ll&&!rl&&r
119610
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
1147 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
1148 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
1149 }
1150 }
1151 }
1152  
1153 11 $string = join '', @char;
1154 }
1155  
1156 # make regexp string
1157 11 return @string;
1158 }
1159  
1160 #
1161 # classic character class ( \D \S \W \d \s \w \C \X \H \V \h \v \R \N \b \B )
1162 #
1163 2840 ▶sub Ewindows1254::classic_character_class {
Subroutine classic_character_class: called CC=2 SCAR=6.9
Pod undocumented
1164 2840 my($char) = @_;
1165  
1166 return {
1167 '\D' => '${Ewindows1254::eD}',
1168 '\S' => '${Ewindows1254::eS}',
1169 '\W' => '${Ewindows1254::eW}',
1170 '\d' => '[0-9]',
1171  
1172 # Before Perl 5.6, \s only matched the five whitespace characters
1173 # tab, newline, form-feed, carriage return, and the space character
1174 # itself, which, taken together, is the character class [\t\n\f\r ].
1175  
1176 # Vertical tabs are now whitespace
1177 # \s in a regex now matches a vertical tab in all circumstances.
1178 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
1179 # \t \n \v \f \r space
1180 # '\s' => '[\x09\x0A \x0C\x0D\x20]',
1181 # '\s' => '[\x09\x0A\x0B\x0C\x0D\x20]',
1182 '\s' => '\s',
1183  
1184 '\w' => '[0-9A-Z_a-z]',
1185 '\C' => '[\x00-\xFF]',
1186 '\X' => 'X',
1187  
1188 # \h \v \H \V
1189  
1190 # P.114 Character Class Shortcuts
1191 # in Chapter 7: In the World of Regular Expressions
1192 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
1193  
1194 # P.357 13.2.3 Whitespace
1195 # in Chapter 13: perlrecharclass: Perl Regular Expression Character Classes
1196 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
1197 #
1198 # 0x00009 CHARACTER TABULATION h s
1199 # 0x0000a LINE FEED (LF) vs
1200 # 0x0000b LINE TABULATION v
1201 # 0x0000c FORM FEED (FF) vs
1202 # 0x0000d CARRIAGE RETURN (CR) vs
1203 # 0x00020 SPACE h s
1204  
1205 # P.196 Table 5-9. Alphanumeric regex metasymbols
1206 # in Chapter 5. Pattern Matching
1207 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1208  
1209 # (and so on)
1210  
1211 '\H' => '${Ewindows1254::eH}',
1212 '\V' => '${Ewindows1254::eV}',
1213 '\h' => '[\x09\x20]',
1214 '\v' => '[\x0A\x0B\x0C\x0D]',
1215 '\R' => '${Ewindows1254::eR}',
1216  
1217 # \N
1218 #
1219 # http://perldoc.perl.org/perlre.html
1220 # Character Classes and other Special Escapes
1221 # Any character but \n (experimental). Not affected by /s modifier
1222  
1223 '\N' => '${Ewindows1254::eN}',
1224  
1225 # \b \B
1226  
1227 # P.180 Boundaries: The \b and \B Assertions
1228 # in Chapter 5: Pattern Matching
1229 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
1230  
1231 # P.219 Boundaries: The \b and \B Assertions
1232 # in Chapter 5: Pattern Matching
1233 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1234  
1235 # \b really means (?:(?<=\w)(?!\w)|(?<!\w)(?=\w))
1236 # or (?:(?<=\A|\W)(?=\w)|(?<=\w)(?=\W|\z))
1237 '\b' => '${Ewindows1254::eb}',
1238  
1239 # \B really means (?:(?<=\w)(?=\w)|(?<!\w)(?!\w))
1240 # or (?:(?<=\w)(?=\w)|(?<=\W)(?=\W))
1241 '\B' => '${Ewindows1254::eB}',
1242  
1243 2840 ▶ }->{$char} || '';
Condition100%2/2
{'\\D', '${Ewindows1254::eD}', '\\S', '${Ewindows1254::eS}', '\\W', '${Ewindows1254::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Ewindows1254::eH}', '\\V', '${Ewindows1254::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Ewindows1254::eR}', '\\N', '${Ewindows1254::eN}', '\\b', '${Ewindows1254::eb}', '\\B', '${Ewindows1254::eB}'}->{$char} || ''
l!l
1012739
MC/DC100%1/1
{'\\D', '${Ewindows1254::eD}', '\\S', '${Ewindows1254::eS}', '\\W', '${Ewindows1254::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Ewindows1254::eH}', '\\V', '${Ewindows1254::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Ewindows1254::eR}', '\\N', '${Ewindows1254::eN}', '\\b', '${Ewindows1254::eb}', '\\B', '${Ewindows1254::eB}'}->{$char} || ''
{'\\D', '${Ewindows1254::eD}', '\\S', '${Ewindows1254::eS}', '\\W', '${Ewindows1254::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Ewindows1254::eH}', '\\V', '${Ewindows1254::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Ewindows1254::eR}', '\\N', '${Ewindows1254::eN}', '\\b', '${Ewindows1254::eb}', '\\B', '${Ewindows1254::eB}'}->{$char}
Truth table100%2/2
A
A= {'\\D', '${Ewindows1254::eD}', '\\S', '${Ewindows1254::eS}', '\\W', '${Ewindows1254::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Ewindows1254::eH}', '\\V', '${Ewindows1254::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Ewindows1254::eR}', '\\N', '${Ewindows1254::eN}', '\\b', '${Ewindows1254::eb}', '\\B', '${Ewindows1254::eB}'}->{$char}
Aresult
11
00
1244 }
1245  
1246 #
1247 # prepare Windows-1254 characters per length
1248 #
1249  
1250 # 1 octet characters
1251 424 my @chars1 = ();
1252 0 ▶sub chars1 {
Subroutine chars1: not called CC=5 SCAR=34.0
Pod undocumented
1253 0 ▶ if (@chars1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars1) 0 0 0
1254 0 return @chars1;
1255 }
1256 0 ▶ if (exists $range_tr{1}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{1}) 0 0 0
1257 0 my @ranges = @{ $range_tr{1} };
1258 0 ▶ while (my @range = splice(@ranges,0,1)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 1)) 0 0 0
1259 0 for my $oct0 (@{$range[0]}) {
1260 0 push @chars1, pack 'C', $oct0;
1261 }
1262 }
1263 }
1264 0 return @chars1;
1265 }
1266  
1267 # 2 octets characters
1268 424 my @chars2 = ();
1269 0 ▶sub chars2 {
Subroutine chars2: not called CC=6 SCAR=37.4
Pod undocumented
1270 0 ▶ if (@chars2) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars2) 0 0 0
1271 0 return @chars2;
1272 }
1273 0 ▶ if (exists $range_tr{2}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{2}) 0 0 0
1274 0 my @ranges = @{ $range_tr{2} };
1275 0 ▶ while (my @range = splice(@ranges,0,2)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 2)) 0 0 0
1276 0 for my $oct0 (@{$range[0]}) {
1277 0 for my $oct1 (@{$range[1]}) {
1278 0 push @chars2, pack 'CC', $oct0,$oct1;
1279 }
1280 }
1281 }
1282 }
1283 0 return @chars2;
1284 }
1285  
1286 # 3 octets characters
1287 424 my @chars3 = ();
1288 0 ▶sub chars3 {
Subroutine chars3: not called CC=7 SCAR=40.3
Pod undocumented
1289 0 ▶ if (@chars3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars3) 0 0 0
1290 0 return @chars3;
1291 }
1292 0 ▶ if (exists $range_tr{3}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{3}) 0 0 0
1293 0 my @ranges = @{ $range_tr{3} };
1294 0 ▶ while (my @range = splice(@ranges,0,3)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 3)) 0 0 0
1295 0 for my $oct0 (@{$range[0]}) {
1296 0 for my $oct1 (@{$range[1]}) {
1297 0 for my $oct2 (@{$range[2]}) {
1298 0 push @chars3, pack 'CCC', $oct0,$oct1,$oct2;
1299 }
1300 }
1301 }
1302 }
1303 }
1304 0 return @chars3;
1305 }
1306  
1307 # 4 octets characters
1308 424 my @chars4 = ();
1309 0 ▶sub chars4 {
Subroutine chars4: not called CC=8 SCAR=42.8
Pod undocumented
1310 0 ▶ if (@chars4) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars4) 0 0 0
1311 0 return @chars4;
1312 }
1313 0 ▶ if (exists $range_tr{4}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{4}) 0 0 0
1314 0 my @ranges = @{ $range_tr{4} };
1315 0 ▶ while (my @range = splice(@ranges,0,4)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 4)) 0 0 0
1316 0 for my $oct0 (@{$range[0]}) {
1317 0 for my $oct1 (@{$range[1]}) {
1318 0 for my $oct2 (@{$range[2]}) {
1319 0 for my $oct3 (@{$range[3]}) {
1320 0 push @chars4, pack 'CCCC', $oct0,$oct1,$oct2,$oct3;
1321 }
1322 }
1323 }
1324 }
1325 }
1326 }
1327 0 return @chars4;
1328 }
1329  
1330 #
1331 # Windows-1254 open character list for tr
1332 #
1333 12 ▶sub _charlist_tr {
Subroutine _charlist_tr: called CC=35 SCAR=66.4
1334  
1335 12 local $_ = shift @_;
1336  
1337 # unescape character
1338 12 my @char = ();
1339 12 ▶ while (not /\G \z/oxmsgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgmosx) 38 12 50
1340 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 \\ ($Ewindows1254::q_char) /cgmosx) { } 0 38 38
elsif (/\G ($Ewindows1254::q_char) /cgmosx) { } 38 0 38
1341 0 push @char, '\-';
1342 }
1343 elsif (/\G \\ ([0-7]{2,3}) /oxmsgc) {
1344 0 push @char, CORE::chr(oct $1);
1345 }
1346 elsif (/\G \\x ([0-9A-Fa-f]{1,2}) /oxmsgc) {
1347 0 push @char, CORE::chr(hex $1);
1348 }
1349 elsif (/\G \\c ([\x40-\x5F]) /oxmsgc) {
1350 0 push @char, CORE::chr(CORE::ord($1) & 0x1F);
1351 }
1352 elsif (/\G (\\ [0nrtfbae]) /oxmsgc) {
1353 push @char, {
1354 '\0' => "\0",
1355 '\n' => "\n",
1356 '\r' => "\r",
1357 '\t' => "\t",
1358 '\f' => "\f",
1359 '\b' => "\x08", # \b means backspace in character class
1360 '\a' => "\a",
1361 '\e' => "\e",
1362 0 }->{$1};
1363 }
1364 elsif (/\G \\ ($q_char) /oxmsgc) {
1365 0 push @char, $1;
1366 }
1367 elsif (/\G ($q_char) /oxmsgc) {
1368 38 push @char, $1;
1369 }
1370 }
1371  
1372 # join separated multiple-octet
1373 12 @char = join('',@char) =~ /\G (?>\\-|$q_char) /oxmsg;
1374  
1375 # unescape '-'
1376 12 my @i = ();
1377 12 for my $i (0 .. $#char) {
1378 38 ▶ if ($char[$i] eq '\-') {
Branch: 2 branches
BranchTrueFalseTotal
if ($char[$i] eq '\\-') { } 0 38 38
elsif ($char[$i] eq '-') { } 0 38 38
1379 0 $char[$i] = '-';
1380 }
1381 elsif ($char[$i] eq '-') {
1382 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
1383 0 push @i, $i;
1384 }
1385 }
1386 }
1387  
1388 # open character list (reverse for splice)
1389 12 for my $i (CORE::reverse @i) {
1390 0 my @range = ();
1391  
1392 # range error
1393 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
1394 0 croak "Invalid tr/// range \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1395 }
1396  
1397 # range of multiple-octet code
1398 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
1399 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
1400 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
1401 }
1402 elsif (CORE::length($char[$i+1]) == 2) {
1403 0 push @range, grep {$char[$i-1] le $_} chars1();
1404 0 push @range, grep {$_ le $char[$i+1]} chars2();
1405 }
1406 elsif (CORE::length($char[$i+1]) == 3) {
1407 0 push @range, grep {$char[$i-1] le $_} chars1();
1408 0 push @range, chars2();
1409 0 push @range, grep {$_ le $char[$i+1]} chars3();
1410 }
1411 elsif (CORE::length($char[$i+1]) == 4) {
1412 0 push @range, grep {$char[$i-1] le $_} chars1();
1413 0 push @range, 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]) == 2) {
1422 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
1423 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
1424 }
1425 elsif (CORE::length($char[$i+1]) == 3) {
1426 0 push @range, grep {$char[$i-1] le $_} chars2();
1427 0 push @range, grep {$_ le $char[$i+1]} chars3();
1428 }
1429 elsif (CORE::length($char[$i+1]) == 4) {
1430 0 push @range, grep {$char[$i-1] le $_} chars2();
1431 0 push @range, chars3();
1432 0 push @range, grep {$_ le $char[$i+1]} chars4();
1433 }
1434 else {
1435 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1436 }
1437 }
1438 elsif (CORE::length($char[$i-1]) == 3) {
1439 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
1440 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
1441 }
1442 elsif (CORE::length($char[$i+1]) == 4) {
1443 0 push @range, grep {$char[$i-1] le $_} chars3();
1444 0 push @range, grep {$_ le $char[$i+1]} chars4();
1445 }
1446 else {
1447 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1448 }
1449 }
1450 elsif (CORE::length($char[$i-1]) == 4) {
1451 0 ▶ if (CORE::length($char[$i+1]) == 4) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $char[$i + 1] == 4) { } 0 0 0
1452 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
1453 }
1454 else {
1455 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1456 }
1457 }
1458 else {
1459 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1460 }
1461  
1462 0 splice @char, $i-1, 3, @range;
1463 }
1464  
1465 12 return @char;
1466 }
1467  
1468 #
1469 # Windows-1254 open character class
1470 #
1471 0 ▶sub _cc {
Subroutine _cc: not called CC=7 SCAR=40.3
1472 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
1473 0 die __FILE__, ": subroutine cc got no parameter.\n";
1474 }
1475 elsif (scalar(@_) == 1) {
1476 0 return sprintf('\x%02X',$_[0]);
1477 }
1478 elsif (scalar(@_) == 2) {
1479 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
1480 0 die __FILE__, ": subroutine cc got \$_[0] > \$_[1] parameters).\n";
1481 }
1482 elsif ($_[0] == $_[1]) {
1483 0 return sprintf('\x%02X',$_[0]);
1484 }
1485 elsif (($_[0]+1) == $_[1]) {
1486 0 return sprintf('[\\x%02X\\x%02X]',$_[0],$_[1]);
1487 }
1488 else {
1489 0 return sprintf('[\\x%02X-\\x%02X]',$_[0],$_[1]);
1490 }
1491 }
1492 else {
1493 0 die __FILE__, ": subroutine cc got 3 or more parameters (@{[scalar(@_)]} parameters).\n";
1494 }
1495 }
1496  
1497 #
1498 # Windows-1254 octet range
1499 #
1500 246 ▶sub _octets {
Subroutine _octets: called CC=5 SCAR=19.3
1501 246 my $length = shift @_;
1502  
1503 246 ▶ if ($length == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length == 1) { } 246 0 246
1504 246 my($a1) = unpack 'C', $_[0];
1505 246 my($z1) = unpack 'C', $_[1];
1506  
1507 246 ▶ if ($a1 > $z1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($a1 > $z1) 0 246 246
1508 0 croak 'Invalid [] range in regexp (CORE::ord(A) > CORE::ord(B)) ' . '\x' . unpack('H*',$a1) . '-\x' . unpack('H*',$z1);
1509 }
1510  
1511 246 ▶ if ($a1 == $z1) {
Branch: 2 branches
BranchTrueFalseTotal
if ($a1 == $z1) { } 0 246 246
elsif ($a1 + 1 == $z1) { } 0 246 246
1512 0 return sprintf('\x%02X',$a1);
1513 }
1514 elsif (($a1+1) == $z1) {
1515 0 return sprintf('\x%02X\x%02X',$a1,$z1);
1516 }
1517 else {
1518 246 return sprintf('\x%02X-\x%02X',$a1,$z1);
1519 }
1520 }
1521 else {
1522 0 die __FILE__, ": subroutine _octets got invalid length ($length).\n";
1523 }
1524 }
1525  
1526 #
1527 # Windows-1254 range regexp
1528 #
1529 246 ▶sub _range_regexp {
Subroutine _range_regexp: called CC=18 SCAR=41.7
1530 246 my($length,$first,$last) = @_;
1531  
1532 246 my @range_regexp = ();
1533 246 ▶ if (not exists $range_tr{$length}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $range_tr{$length}) 0 246 246
1534 0 return @range_regexp;
1535 }
1536  
1537 246 my @ranges = @{ $range_tr{$length} };
1538 246 ▶ while (my @range = splice(@ranges,0,$length)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, $length)) 246 246 492
1539 246 my $min = '';
1540 246 my $max = '';
1541 246 ▶ for (my $i=0; $i < $length; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $length) 246 246 492
1542 246 $min .= pack 'C', $range[$i][0];
1543 246 $max .= pack 'C', $range[$i][-1];
1544 }
1545  
1546 # min___max
1547 # FIRST_____________LAST
1548 # (nothing)
1549  
1550 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
1551 }
1552  
1553 # **********
1554 # min_________max
1555 # FIRST_____________LAST
1556 # **********
1557  
1558 ▶ 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
1559 0 push @range_regexp, _octets($length,$first,$max,$min,$max);
1560 }
1561  
1562 # **********************
1563 # min________________max
1564 # FIRST_____________LAST
1565 # **********************
1566  
1567 ▶ 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
1568 0 push @range_regexp, _octets($length,$first,$last,$min,$max);
1569 }
1570  
1571 # *********
1572 # min___max
1573 # FIRST_____________LAST
1574 # *********
1575  
1576 ▶ 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
1577 0 push @range_regexp, _octets($length,$min,$max,$min,$max);
1578 }
1579  
1580 # **********************
1581 # min__________________________max
1582 # FIRST_____________LAST
1583 # **********************
1584  
1585 ▶ 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
1586 246 push @range_regexp, _octets($length,$first,$last,$min,$max);
1587 }
1588  
1589 # *********
1590 # min________max
1591 # FIRST_____________LAST
1592 # *********
1593  
1594 ▶ 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
1595 0 push @range_regexp, _octets($length,$min,$last,$min,$max);
1596 }
1597  
1598 # min___max
1599 # FIRST_____________LAST
1600 # (nothing)
1601  
1602 elsif ($last lt $min) {
1603 }
1604  
1605 else {
1606 0 die __FILE__, ": subroutine _range_regexp panic.\n";
1607 }
1608 }
1609  
1610 246 return @range_regexp;
1611 }
1612  
1613 #
1614 # Windows-1254 open character list for qr and not qr
1615 #
1616 650 ▶sub _charlist {
Subroutine _charlist: called CC=46 SCAR=46.6
1617  
1618 650 my $modifier = pop @_;
1619 650 my @char = @_;
1620  
1621 650 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 298 352 650
1622  
1623 # unescape character
1624 650 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1773 650 2423
1625  
1626 # escape - to ...
1627 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 \\ ($Ewindows1254::q_char) \z/mosx) { } 7 1371 1378
1628 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
1629 246 $char[$i] = '...';
1630 }
1631 }
1632  
1633 # octal escape sequence
1634 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
1635 0 $char[$i] = octchr($1);
1636 }
1637  
1638 # hexadecimal escape sequence
1639 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
1640 0 $char[$i] = hexchr($1);
1641 }
1642  
1643 # \b{...} --> b\{...}
1644 # \B{...} --> B\{...}
1645 # \N{CHARNAME} --> N\{CHARNAME}
1646 # \p{PROPERTY} --> p\{PROPERTY}
1647 # \P{PROPERTY} --> P\{PROPERTY}
1648 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
1649 0 $char[$i] = $1 . '\\' . $2;
1650 }
1651  
1652 # \p, \P, \X --> p, P, X
1653 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
1654 0 $char[$i] = $1;
1655 }
1656  
1657 elsif ($char[$i] =~ /\A \\ ([0-7]{2,3}) \z/oxms) {
1658 0 $char[$i] = CORE::chr oct $1;
1659 }
1660 elsif ($char[$i] =~ /\A \\x ([0-9A-Fa-f]{1,2}) \z/oxms) {
1661 22 $char[$i] = CORE::chr hex $1;
1662 }
1663 elsif ($char[$i] =~ /\A \\c ([\x40-\x5F]) \z/oxms) {
1664 0 $char[$i] = CORE::chr(CORE::ord($1) & 0x1F);
1665 }
1666 elsif ($char[$i] =~ /\A (\\ [0nrtfbaedswDSWHVhvR]) \z/oxms) {
1667 $char[$i] = {
1668 '\0' => "\0",
1669 '\n' => "\n",
1670 '\r' => "\r",
1671 '\t' => "\t",
1672 '\f' => "\f",
1673 '\b' => "\x08", # \b means backspace in character class
1674 '\a' => "\a",
1675 '\e' => "\e",
1676 '\d' => '[0-9]',
1677  
1678 # Vertical tabs are now whitespace
1679 # \s in a regex now matches a vertical tab in all circumstances.
1680 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
1681 # \t \n \v \f \r space
1682 # '\s' => '[\x09\x0A \x0C\x0D\x20]',
1683 # '\s' => '[\x09\x0A\x0B\x0C\x0D\x20]',
1684 '\s' => '\s',
1685  
1686 '\w' => '[0-9A-Z_a-z]',
1687 '\D' => '${Ewindows1254::eD}',
1688 '\S' => '${Ewindows1254::eS}',
1689 '\W' => '${Ewindows1254::eW}',
1690  
1691 '\H' => '${Ewindows1254::eH}',
1692 '\V' => '${Ewindows1254::eV}',
1693 '\h' => '[\x09\x20]',
1694 '\v' => '[\x0A\x0B\x0C\x0D]',
1695 '\R' => '${Ewindows1254::eR}',
1696  
1697 25 }->{$1};
1698 }
1699  
1700 # POSIX-style character classes
1701 ▶ 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
1702 $char[$i] = {
1703  
1704 '[:lower:]' => '[\x41-\x5A\x61-\x7A]',
1705 '[:upper:]' => '[\x41-\x5A\x61-\x7A]',
1706 '[:^lower:]' => '${Ewindows1254::not_lower_i}',
1707 '[:^upper:]' => '${Ewindows1254::not_upper_i}',
1708  
1709 8 }->{$1};
1710 }
1711 elsif ($char[$i] =~ /\A ( \[\: \^? (?:alnum|alpha|ascii|blank|cntrl|digit|graph|lower|print|punct|space|upper|word|xdigit) :\] ) \z/oxms) {
1712 $char[$i] = {
1713  
1714 '[:alnum:]' => '[\x30-\x39\x41-\x5A\x61-\x7A]',
1715 '[:alpha:]' => '[\x41-\x5A\x61-\x7A]',
1716 '[:ascii:]' => '[\x00-\x7F]',
1717 '[:blank:]' => '[\x09\x20]',
1718 '[:cntrl:]' => '[\x00-\x1F\x7F]',
1719 '[:digit:]' => '[\x30-\x39]',
1720 '[:graph:]' => '[\x21-\x7F]',
1721 '[:lower:]' => '[\x61-\x7A]',
1722 '[:print:]' => '[\x20-\x7F]',
1723 '[:punct:]' => '[\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E]',
1724  
1725 # P.174 POSIX-Style Character Classes
1726 # in Chapter 5: Pattern Matching
1727 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
1728  
1729 # P.311 11.2.4 Character Classes and other Special Escapes
1730 # in Chapter 11: perlre: Perl regular expressions
1731 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
1732  
1733 # P.210 POSIX-Style Character Classes
1734 # in Chapter 5: Pattern Matching
1735 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1736  
1737 '[:space:]' => '[\s\x0B]', # "\s" plus vertical tab ("\cK")
1738  
1739 '[:upper:]' => '[\x41-\x5A]',
1740 '[:word:]' => '[\x30-\x39\x41-\x5A\x5F\x61-\x7A]',
1741 '[:xdigit:]' => '[\x30-\x39\x41-\x46\x61-\x66]',
1742 '[:^alnum:]' => '${Ewindows1254::not_alnum}',
1743 '[:^alpha:]' => '${Ewindows1254::not_alpha}',
1744 '[:^ascii:]' => '${Ewindows1254::not_ascii}',
1745 '[:^blank:]' => '${Ewindows1254::not_blank}',
1746 '[:^cntrl:]' => '${Ewindows1254::not_cntrl}',
1747 '[:^digit:]' => '${Ewindows1254::not_digit}',
1748 '[:^graph:]' => '${Ewindows1254::not_graph}',
1749 '[:^lower:]' => '${Ewindows1254::not_lower}',
1750 '[:^print:]' => '${Ewindows1254::not_print}',
1751 '[:^punct:]' => '${Ewindows1254::not_punct}',
1752 '[:^space:]' => '${Ewindows1254::not_space}',
1753 '[:^upper:]' => '${Ewindows1254::not_upper}',
1754 '[:^word:]' => '${Ewindows1254::not_word}',
1755 '[:^xdigit:]' => '${Ewindows1254::not_xdigit}',
1756  
1757 70 }->{$1};
1758 }
1759 elsif ($char[$i] =~ /\A \\ ($q_char) \z/oxms) {
1760 7 $char[$i] = $1;
1761 }
1762 }
1763  
1764 # open character list
1765 650 my @singleoctet = ();
1766 650 my @multipleoctet = ();
1767 650 ▶ for (my $i=0; $i <= $#char; ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1527 650 2177
1768  
1769 # escaped -
1770 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
1771 246 $i += 1;
1772 246 next;
1773 }
1774  
1775 # make range regexp
1776 elsif ($char[$i] eq '...') {
1777  
1778 # range error
1779 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
1780 0 croak 'Invalid [] range in regexp (length(A) > length(B)) ' . '\x' . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]);
1781 }
1782 elsif (CORE::length($char[$i-1]) == CORE::length($char[$i+1])) {
1783 246 ▶ if ($char[$i-1] gt $char[$i+1]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i - 1] gt $char[$i + 1]) 0 246 246
1784 0 croak 'Invalid [] range in regexp (CORE::ord(A) > CORE::ord(B)) ' . '\x' . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]);
1785 }
1786 }
1787  
1788 # make range regexp per length
1789 246 for my $length (CORE::length($char[$i-1]) .. CORE::length($char[$i+1])) {
1790 246 my @regexp = ();
1791  
1792 # is first and last
1793 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
1794 246 push @regexp, _range_regexp($length, $char[$i-1], $char[$i+1]);
1795 }
1796  
1797 # is first
1798 elsif ($length == CORE::length($char[$i-1])) {
1799 0 push @regexp, _range_regexp($length, $char[$i-1], "\xFF" x $length);
1800 }
1801  
1802 # is inside in first and last
1803 ▶ 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
1804 0 push @regexp, _range_regexp($length, "\x00" x $length, "\xFF" x $length);
1805 }
1806  
1807 # is last
1808 elsif ($length == CORE::length($char[$i+1])) {
1809 0 push @regexp, _range_regexp($length, "\x00" x $length, $char[$i+1]);
1810 }
1811  
1812 else {
1813 0 die __FILE__, ": subroutine make_regexp panic.\n";
1814 }
1815  
1816 246 ▶ if ($length == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length == 1) { } 246 0 246
1817 246 push @singleoctet, @regexp;
1818 }
1819 else {
1820 0 push @multipleoctet, @regexp;
1821 }
1822 }
1823  
1824 246 $i += 2;
1825 }
1826  
1827 # with /i modifier
1828 elsif ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) {
1829 949 ▶ if ($modifier =~ /i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) { } 480 469 949
1830 480 my $uc = Ewindows1254::uc($char[$i]);
1831 480 my $fc = Ewindows1254::fc($char[$i]);
1832 480 ▶ if ($uc ne $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc ne $fc) { } 480 0 480
1833 480 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 480 0 480
1834 480 push @singleoctet, $uc, $fc;
1835 }
1836 else {
1837 0 push @singleoctet, $uc;
1838 0 push @multipleoctet, $fc;
1839 }
1840 }
1841 else {
1842 0 push @singleoctet, $char[$i];
1843 }
1844 }
1845 else {
1846 469 push @singleoctet, $char[$i];
1847 }
1848 949 $i += 1;
1849 }
1850  
1851 # single character of single octet code
1852 elsif ($char[$i] =~ /\A (?: \\h ) \z/oxms) {
1853 0 push @singleoctet, "\t", "\x20";
1854 0 $i += 1;
1855 }
1856 elsif ($char[$i] =~ /\A (?: \\v ) \z/oxms) {
1857 0 push @singleoctet, "\x0A", "\x0B", "\x0C", "\x0D";
1858 0 $i += 1;
1859 }
1860 elsif ($char[$i] =~ /\A (?: \\d | \\s | \\w ) \z/oxms) {
1861 2 push @singleoctet, $char[$i];
1862 2 $i += 1;
1863 }
1864  
1865 # single character of multiple-octet code
1866 else {
1867 84 push @multipleoctet, $char[$i];
1868 84 $i += 1;
1869 }
1870 }
1871  
1872 # quote metachar
1873 650 for (@singleoctet) {
1874 1677 ▶ if ($_ eq '...') {
Branch: 5 branches
BranchTrueFalseTotal
if ($_ eq '...') { } 0 1677 1677
elsif (/\A \n \z/mosx) { } 8 1669 1677
elsif (/\A \r \z/mosx) { } 8 1661 1669
elsif (/\A ([\x00-\x20\x7F-\xFF]) \z/mosx) { } 984 677 1661
elsif (/\A [\x00-\xFF] \z/mosx) { } 429 248 677
1875 0 $_ = '-';
1876 }
1877 elsif (/\A \n \z/oxms) {
1878 8 $_ = '\n';
1879 }
1880 elsif (/\A \r \z/oxms) {
1881 8 $_ = '\r';
1882 }
1883 elsif (/\A ([\x00-\x20\x7F-\xFF]) \z/oxms) {
1884 984 $_ = sprintf('\x%02X', CORE::ord $1);
1885 }
1886 elsif (/\A [\x00-\xFF] \z/oxms) {
1887 429 $_ = quotemeta $_;
1888 }
1889 }
1890  
1891 # return character list
1892 650 return \@singleoctet, \@multipleoctet;
1893 }
1894  
1895 #
1896 # Windows-1254 octal escape sequence
1897 #
1898 5 ▶sub octchr {
Subroutine octchr: called CC=2 SCAR=6.9
Pod undocumented
1899 5 my($octdigit) = @_;
1900  
1901 5 my @binary = ();
1902 5 for my $octal (split(//,$octdigit)) {
1903 push @binary, {
1904 '0' => '000',
1905 '1' => '001',
1906 '2' => '010',
1907 '3' => '011',
1908 '4' => '100',
1909 '5' => '101',
1910 '6' => '110',
1911 '7' => '111',
1912 50 }->{$octal};
1913 }
1914 5 my $binary = join '', @binary;
1915  
1916 my $octchr = {
1917 # 1234567
1918 1 => pack('B*', "0000000$binary"),
1919 2 => pack('B*', "000000$binary"),
1920 3 => pack('B*', "00000$binary"),
1921 4 => pack('B*', "0000$binary"),
1922 5 => pack('B*', "000$binary"),
1923 6 => pack('B*', "00$binary"),
1924 7 => pack('B*', "0$binary"),
1925 0 => pack('B*', "$binary"),
1926  
1927 5 }->{CORE::length($binary) % 8};
1928  
1929 5 return $octchr;
1930 }
1931  
1932 #
1933 # Windows-1254 hexadecimal escape sequence
1934 #
1935 5 ▶sub hexchr {
Subroutine hexchr: called CC=1 SCAR=0.0
Pod undocumented
1936 5 my($hexdigit) = @_;
1937  
1938 my $hexchr = {
1939 1 => pack('H*', "0$hexdigit"),
1940 0 => pack('H*', "$hexdigit"),
1941  
1942 5 }->{CORE::length($_[0]) % 2};
1943  
1944 5 return $hexchr;
1945 }
1946  
1947 #
1948 # Windows-1254 open character list for qr
1949 #
1950 576 ▶sub charlist_qr {
Subroutine charlist_qr: called CC=17 SCAR=29.0
Pod undocumented
1951  
1952 576 my $modifier = pop @_;
1953 576 my @char = @_;
1954  
1955 576 my($singleoctet, $multipleoctet) = _charlist(@char, $modifier);
1956 576 my @singleoctet = @$singleoctet;
1957 576 my @multipleoctet = @$multipleoctet;
1958  
1959 # return character list
1960 576 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) 498 78 576
1961  
1962 # with /i modifier
1963 498 ▶ if ($modifier =~ m/i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) 265 233 498
1964 265 my %singleoctet_ignorecase = ();
1965 265 for (@singleoctet) {
1966 985 ▶ 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) 985 985 1970
Condition100%3/3
s/ \A \\x(..) - \\x(..) //mosx or s/ \A \\x((..)) //mosx
l!l&&r!l&&!r
25960985
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
1967 985 for my $ord (hex($1) .. hex($2)) {
1968 1035 my $char = CORE::chr($ord);
1969 1035 my $uc = Ewindows1254::uc($char);
1970 1035 my $fc = Ewindows1254::fc($char);
1971 1035 ▶ if ($uc eq $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc eq $fc) { } 0 1035 1035
1972 0 $singleoctet_ignorecase{unpack 'C*', $char} = 1;
1973 }
1974 else {
1975 1035 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 1035 0 1035
1976 1035 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
1977 1035 $singleoctet_ignorecase{unpack 'C*', $fc} = 1;
1978 }
1979 else {
1980 0 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
1981 0 push @multipleoctet, join '', map {sprintf('\x%02X',$_)} unpack 'C*', $fc;
1982 }
1983 }
1984 }
1985 }
1986 985 ▶ if ($_ ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ ne "") 0 985 985
1987 0 $singleoctet_ignorecase{unpack 'C*', $_} = 1;
1988 }
1989 }
1990 265 my $i = 0;
1991 265 my @singleoctet_ignorecase = ();
1992 265 for my $ord (0 .. 255) {
1993 67840 ▶ if (exists $singleoctet_ignorecase{$ord}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $singleoctet_ignorecase{$ord}) { } 1110 66730 67840
1994 1110 push @{$singleoctet_ignorecase[$i]}, $ord;
1995 }
1996 else {
1997 66730 $i++;
1998 }
1999 }
2000 265 @singleoctet = ();
2001 265 for my $range (@singleoctet_ignorecase) {
2002 55920 ▶ if (ref $range) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $range) 1010 54910 55920
2003 1010 ▶ if (scalar(@{$range}) == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @{$range;} == 1) { } 960 50 1010
elsif (scalar @{$range;} == 2) { } 0 50 50
2004 960 push @singleoctet, sprintf('\x%02X', @{$range}[0]);
2005 }
2006 50 elsif (scalar(@{$range}) == 2) {
2007 0 push @singleoctet, sprintf('\x%02X\x%02X', @{$range}[0], @{$range}[-1]);
2008 }
2009 else {
2010 50 push @singleoctet, sprintf('\x%02X-\x%02X', @{$range}[0], @{$range}[-1]);
2011 }
2012 }
2013 }
2014 }
2015  
2016 498 my $not_anchor = '';
2017  
2018 498 push @multipleoctet, join('', $not_anchor, '[', @singleoctet, ']' );
2019 }
2020 576 ▶ if (scalar(@multipleoctet) >= 2) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @multipleoctet >= 2) { } 6 570 576
2021 6 return '(?:' . join('|', @multipleoctet) . ')';
2022 }
2023 else {
2024 570 return $multipleoctet[0];
2025 }
2026 }
2027  
2028 #
2029 # Windows-1254 open character list for not qr
2030 #
2031 74 ▶sub charlist_not_qr {
Subroutine charlist_not_qr: called CC=18 SCAR=33.1
Pod undocumented
2032  
2033 74 my $modifier = pop @_;
2034 74 my @char = @_;
2035  
2036 74 my($singleoctet, $multipleoctet) = _charlist(@char, $modifier);
2037 74 my @singleoctet = @$singleoctet;
2038 74 my @multipleoctet = @$multipleoctet;
2039  
2040 # with /i modifier
2041 74 ▶ if ($modifier =~ m/i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) 25 49 74
2042 25 my %singleoctet_ignorecase = ();
2043 25 for (@singleoctet) {
2044 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
2045 25 for my $ord (hex($1) .. hex($2)) {
2046 75 my $char = CORE::chr($ord);
2047 75 my $uc = Ewindows1254::uc($char);
2048 75 my $fc = Ewindows1254::fc($char);
2049 75 ▶ if ($uc eq $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc eq $fc) { } 0 75 75
2050 0 $singleoctet_ignorecase{unpack 'C*', $char} = 1;
2051 }
2052 else {
2053 75 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 75 0 75
2054 75 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2055 75 $singleoctet_ignorecase{unpack 'C*', $fc} = 1;
2056 }
2057 else {
2058 0 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2059 0 push @multipleoctet, join '', map {sprintf('\x%02X',$_)} unpack 'C*', $fc;
2060 }
2061 }
2062 }
2063 }
2064 25 ▶ if ($_ ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ ne "") 0 25 25
2065 0 $singleoctet_ignorecase{unpack 'C*', $_} = 1;
2066 }
2067 }
2068 25 my $i = 0;
2069 25 my @singleoctet_ignorecase = ();
2070 25 for my $ord (0 .. 255) {
2071 6400 ▶ if (exists $singleoctet_ignorecase{$ord}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $singleoctet_ignorecase{$ord}) { } 150 6250 6400
2072 150 push @{$singleoctet_ignorecase[$i]}, $ord;
2073 }
2074 else {
2075 6250 $i++;
2076 }
2077 }
2078 25 @singleoctet = ();
2079 25 for my $range (@singleoctet_ignorecase) {
2080 2400 ▶ if (ref $range) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $range) 50 2350 2400
2081 50 ▶ if (scalar(@{$range}) == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @{$range;} == 1) { } 0 50 50
elsif (scalar @{$range;} == 2) { } 0 50 50
2082 0 push @singleoctet, sprintf('\x%02X', @{$range}[0]);
2083 }
2084 50 elsif (scalar(@{$range}) == 2) {
2085 0 push @singleoctet, sprintf('\x%02X\x%02X', @{$range}[0], @{$range}[-1]);
2086 }
2087 else {
2088 50 push @singleoctet, sprintf('\x%02X-\x%02X', @{$range}[0], @{$range}[-1]);
2089 }
2090 }
2091 }
2092 }
2093  
2094 # return character list
2095 74 ▶ if (scalar(@multipleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @multipleoctet >= 1) { } 0 74 74
2096 0 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) { } 0 0 0
2097  
2098 # any character other than multiple-octet and single octet character class
2099 0 return '(?!' . join('|', @multipleoctet) . ')(?:[^' . join('', @singleoctet) . '])';
2100 }
2101 else {
2102  
2103 # any character other than multiple-octet character class
2104 0 return '(?!' . join('|', @multipleoctet) . ")(?:$your_char)";
2105 }
2106 }
2107 else {
2108 74 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) { } 74 0 74
2109  
2110 # any character other than single octet character class
2111 74 return '(?:[^' . join('', @singleoctet) . '])';
2112 }
2113 else {
2114  
2115 # any character
2116 0 return "(?:$your_char)";
2117 }
2118 }
2119 }
2120  
2121 #
2122 # open file in read mode
2123 #
2124 424 ▶sub _open_r {
Subroutine _open_r: called CC=1 SCAR=0.0
2125 424 my(undef,$file) = @_;
2126 424 ▶ use Fcntl qw(O_RDONLY);
Subroutine BEGIN: called CC=1 SCAR=0.0
2127 424 return CORE::sysopen($_[0], $file, &O_RDONLY);
2128 }
2129  
2130 #
2131 # open file in append mode
2132 #
2133 212 ▶sub _open_a {
Subroutine _open_a: called CC=1 SCAR=0.0
2134 212 my(undef,$file) = @_;
2135 424 ▶ use Fcntl qw(O_WRONLY O_APPEND O_CREAT);
Subroutine BEGIN: called CC=1 SCAR=0.0
2136 212 return CORE::sysopen($_[0], $file, &O_WRONLY|&O_APPEND|&O_CREAT);
2137 }
2138  
2139 #
2140 # safe system
2141 #
2142 212 ▶sub _systemx {
Subroutine _systemx: called CC=1 SCAR=0.0
2143  
2144 # P.707 29.2.33. exec
2145 # in Chapter 29: Functions
2146 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2147 #
2148 # Be aware that in older releases of Perl, exec (and system) did not flush
2149 # your output buffer, so you needed to enable command buffering by setting $|
2150 # on one or more filehandles to avoid lost output in the case of exec, or
2151 # misordererd output in the case of system. This situation was largely remedied
2152 # in the 5.6 release of Perl. (So, 5.005 release not yet.)
2153  
2154 # P.855 exec
2155 # in Chapter 27: Functions
2156 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2157 #
2158 # In very old release of Perl (before v5.6), exec (and system) did not flush
2159 # your output buffer, so you needed to enable command buffering by setting $|
2160 # on one or more filehandles to avoid lost output with exec or misordered
2161 # output with system.
2162  
2163 212 $| = 1;
2164  
2165 # P.565 23.1.2. Cleaning Up Your Environment
2166 # in Chapter 23: Security
2167 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2168  
2169 # P.656 Cleaning Up Your Environment
2170 # in Chapter 20: Security
2171 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2172  
2173 # local $ENV{'PATH'} = '.';
2174 212 local @ENV{qw(IFS CDPATH ENV BASH_ENV)}; # Make %ENV safer
2175  
2176 # P.707 29.2.33. exec
2177 # in Chapter 29: Functions
2178 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2179 #
2180 # As we mentioned earlier, exec treats a discrete list of arguments as an
2181 # indication that it should bypass shell processing. However, there is one
2182 # place where you might still get tripped up. The exec call (and system, too)
2183 # will not distinguish between a single scalar argument and an array containing
2184 # only one element.
2185 #
2186 # @args = ("echo surprise"); # just one element in list
2187 # exec @args # still subject to shell escapes
2188 # or die "exec: $!"; # because @args == 1
2189 #
2190 # To avoid this, you can use the PATHNAME syntax, explicitly duplicating the
2191 # first argument as the pathname, which forces the rest of the arguments to be
2192 # interpreted as a list, even if there is only one of them:
2193 #
2194 # exec { $args[0] } @args # safe even with one-argument list
2195 # or die "can't exec @args: $!";
2196  
2197 # P.855 exec
2198 # in Chapter 27: Functions
2199 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2200 #
2201 # As we mentioned earlier, exec treats a discrete list of arguments as a
2202 # directive to bypass shell processing. However, there is one place where
2203 # you might still get tripped up. The exec call (and system, too) cannot
2204 # distinguish between a single scalar argument and an array containing
2205 # only one element.
2206 #
2207 # @args = ("echo surprise"); # just one element in list
2208 # exec @args # still subject to shell escapes
2209 # || die "exec: $!"; # because @args == 1
2210 #
2211 # To avoid this, use the PATHNAME syntax, explicitly duplicating the first
2212 # argument as the pathname, which forces the rest of the arguments to be
2213 # interpreted as a list, even if there is only one of them:
2214 #
2215 # exec { $args[0] } @args # safe even with one-argument list
2216 # || die "can't exec @args: $!";
2217  
2218 212 return CORE::system { $_[0] } @_; # safe even with one-argument list
2219 }
2220  
2221 #
2222 # Windows-1254 order to character (with parameter)
2223 #
2224 3469 ▶sub Ewindows1254::chr(;$) {
Subroutine chr: called CC=4 SCAR=13.9
Pod undocumented
2225  
2226 3469 ▶ my $c = @_ ? $_[0] : $_;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 3469 0 3469
2227  
2228 3469 ▶ if ($c == 0x00) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c == 0) { } 24 3445 3469
2229 24 return "\x00";
2230 }
2231 else {
2232 3445 my @chr = ();
2233 3445 ▶ while ($c > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c > 0) 3445 3445 6890
2234 3445 unshift @chr, ($c % 0x100);
2235 3445 $c = int($c / 0x100);
2236 }
2237 3445 return pack 'C*', @chr;
2238 }
2239 }
2240  
2241 #
2242 # Windows-1254 order to character (without parameter)
2243 #
2244 0 ▶sub Ewindows1254::chr_() {
Subroutine chr_: not called CC=3 SCAR=24.8
Pod undocumented
2245  
2246 0 my $c = $_;
2247  
2248 0 ▶ if ($c == 0x00) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c == 0) { } 0 0 0
2249 0 return "\x00";
2250 }
2251 else {
2252 0 my @chr = ();
2253 0 ▶ while ($c > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c > 0) 0 0 0
2254 0 unshift @chr, ($c % 0x100);
2255 0 $c = int($c / 0x100);
2256 }
2257 0 return pack 'C*', @chr;
2258 }
2259 }
2260  
2261 #
2262 # Windows-1254 path globbing (with parameter)
2263 #
2264 0 ▶sub Ewindows1254::glob($) {
Subroutine glob: not called CC=3 SCAR=24.8
Pod undocumented
2265  
2266 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2267 0 my @glob = _DOS_like_glob(@_);
2268 0 for my $glob (@glob) {
2269 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2270 }
2271 0 return @glob;
2272 }
2273 else {
2274 0 my $glob = _DOS_like_glob(@_);
2275 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2276 0 return $glob;
2277 }
2278 }
2279  
2280 #
2281 # Windows-1254 path globbing (without parameter)
2282 #
2283 0 ▶sub Ewindows1254::glob_() {
Subroutine glob_: not called CC=3 SCAR=24.8
Pod undocumented
2284  
2285 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2286 0 my @glob = _DOS_like_glob();
2287 0 for my $glob (@glob) {
2288 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2289 }
2290 0 return @glob;
2291 }
2292 else {
2293 0 my $glob = _DOS_like_glob();
2294 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2295 0 return $glob;
2296 }
2297 }
2298  
2299 #
2300 # Windows-1254 path globbing via File::DosGlob 1.10
2301 #
2302 # Often I confuse "_dosglob" and "_doglob".
2303 # So, I renamed "_dosglob" to "_DOS_like_glob".
2304 #
2305 424 my %iter;
2306 my %entries;
2307 0 ▶sub _DOS_like_glob {
Subroutine _DOS_like_glob: not called CC=10 SCAR=47.0
2308  
2309 # context (keyed by second cxix argument provided by core)
2310 0 my($expr,$cxix) = @_;
2311  
2312 # glob without args defaults to $_
2313 0 ▶ $expr = $_ if not defined $expr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $expr 0 0 0
2314  
2315 # represents the current user's home directory
2316 #
2317 # 7.3. Expanding Tildes in Filenames
2318 # in Chapter 7. File Access
2319 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2320 #
2321 # and File::HomeDir, File::HomeDir::Windows module
2322  
2323 # DOS-like system
2324 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
2325 0 $expr =~ s{ \A ~ (?= [^/\\] ) }
2326 0 { my_home_MSWin32() }oxmse;
2327 }
2328  
2329 # UNIX-like system
2330 else {
2331 0 $expr =~ s{ \A ~ ( (?:[^/])* ) }
2332 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
2333 }
2334  
2335 # assume global context if not provided one
2336 0 ▶ $cxix = '_G_' if not defined $cxix;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $cxix 0 0 0
2337 0 ▶ $iter{$cxix} = 0 if not exists $iter{$cxix};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $iter{$cxix} 0 0 0
2338  
2339 # if we're just beginning, do it all first
2340 0 ▶ if ($iter{$cxix} == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iter{$cxix} == 0) 0 0 0
2341 0 $entries{$cxix} = [ _do_glob(1, _parse_line($expr)) ];
2342 }
2343  
2344 # chuck it all out, quick or slow
2345 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2346 0 delete $iter{$cxix};
2347 0 return @{delete $entries{$cxix}};
2348 }
2349 else {
2350 0 ▶ if ($iter{$cxix} = scalar @{$entries{$cxix}}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iter{$cxix} = scalar @{$entries{$cxix};}) { } 0 0 0
2351 0 return shift @{$entries{$cxix}};
2352 }
2353 else {
2354 # return undef for EOL
2355 0 delete $iter{$cxix};
2356 0 delete $entries{$cxix};
2357 0 return undef;
2358 }
2359 }
2360 }
2361  
2362 #
2363 # Windows-1254 path globbing subroutine
2364 #
2365 0 ▶sub _do_glob {
Subroutine _do_glob: not called CC=44 SCAR=75.9
2366  
2367 0 my($cond,@expr) = @_;
2368 0 my @glob = ();
2369 0 my $fix_drive_relative_paths = 0;
2370  
2371 OUTER:
2372 0 for my $expr (@expr) {
2373 0 ▶ next OUTER if not defined $expr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $expr 0 0 0
2374 0 ▶ next OUTER if $expr eq '';
Branch: 1 branch
BranchTrueFalseTotal
if $expr eq "" 0 0 0
2375  
2376 0 my @matched = ();
2377 0 my @globdir = ();
2378 0 my $head = '.';
2379 0 my $pathsep = '/';
2380 0 my $tail;
2381  
2382 # if argument is within quotes strip em and do no globbing
2383 0 ▶ if ($expr =~ /\A " ((?:$q_char)*?) " \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expr =~ /\A " ((?:$Ewindows1254::q_char)*?) " \z/mosx) 0 0 0
2384 0 $expr = $1;
2385 0 ▶ if ($cond eq 'd') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cond eq 'd') { } 0 0 0
2386 0 ▶ if (-d $expr) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $expr) 0 0 0
2387 0 push @glob, $expr;
2388 }
2389 }
2390 else {
2391 0 ▶ if (-e $expr) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $expr) 0 0 0
2392 0 push @glob, $expr;
2393 }
2394 }
2395 0 next OUTER;
2396 }
2397  
2398 # wildcards with a drive prefix such as h:*.pm must be changed
2399 # to h:./*.pm to expand correctly
2400 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
2401 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
2402 0 $fix_drive_relative_paths = 1;
2403 }
2404 }
2405  
2406 0 ▶ if (($head, $tail) = _parse_path($expr,$pathsep)) {
Branch: 1 branch
BranchTrueFalseTotal
if (($head, $tail) = _parse_path($expr, $pathsep)) 0 0 0
2407 0 ▶ if ($tail eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($tail eq "") 0 0 0
2408 0 push @glob, $expr;
2409 0 next OUTER;
2410 }
2411 0 ▶ if ($head =~ / \A (?:$q_char)*? [*?] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head =~ / \A (?:$Ewindows1254::q_char)*? [*?] /mosx) 0 0 0
2412 0 ▶ if (@globdir = _do_glob('d', $head)) {
Branch: 1 branch
BranchTrueFalseTotal
if (@globdir = _do_glob("d", $head)) 0 0 0
2413 0 push @glob, _do_glob($cond, map {"$_$pathsep$tail"} @globdir);
2414 0 next OUTER;
2415 }
2416 }
2417 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
2418 0 $head .= $pathsep;
2419 }
2420 0 $expr = $tail;
2421 }
2422  
2423 # If file component has no wildcards, we can avoid opendir
2424 0 ▶ if ($expr !~ / \A (?:$q_char)*? [*?] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($expr =~ / \A (?:$Ewindows1254::q_char)*? [*?] /mosx) 0 0 0
2425 0 ▶ if ($head eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($head eq ".") 0 0 0
2426 0 $head = '';
2427 }
2428 0 ▶ if ($head ne '' and ($head =~ / \G ($q_char) /oxmsg)[-1] ne $pathsep) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head ne "" and ($head =~ / \G ($Ewindows1254::q_char) /gmosx)[-1] ne $pathsep) 0 0 0
Condition0%0/3
$head ne "" and ($head =~ / \G ($Ewindows1254::q_char) /gmosx)[-1] ne $pathsep
!ll&&!rl&&r
000
MC/DC0%0/2
$head ne "" and ($head =~ / \G ($Ewindows1254::q_char) /gmosx)[-1] ne $pathsep
$head ne "" ($head =~ / \G ($Ewindows1254::q_char) /gmosx)[-1] ne $pathsep
Truth table0%0/3
A and B
A= $head ne ""B= ($head =~ / \G ($Ewindows1254::q_char) /gmosx)[-1] ne $pathsep
ABresult
0X0
100
111
2429 0 $head .= $pathsep;
2430 }
2431 0 $head .= $expr;
2432 0 ▶ if ($cond eq 'd') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cond eq 'd') { } 0 0 0
2433 0 ▶ if (-d $head) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $head) 0 0 0
2434 0 push @glob, $head;
2435 }
2436 }
2437 else {
2438 0 ▶ if (-e $head) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $head) 0 0 0
2439 0 push @glob, $head;
2440 }
2441 }
2442 0 next OUTER;
2443 }
2444 0 ▶ opendir(*DIR, $head) or next OUTER;
Branch: 1 branch
BranchTrueFalseTotal
opendir *DIR, $head or next OUTER 0 0 0
2445 0 my @leaf = readdir DIR;
2446 0 closedir DIR;
2447  
2448 0 ▶ if ($head eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($head eq ".") 0 0 0
2449 0 $head = '';
2450 }
2451 0 ▶ if ($head ne '' and ($head =~ / \G ($q_char) /oxmsg)[-1] ne $pathsep) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head ne "" and ($head =~ / \G ($Ewindows1254::q_char) /gmosx)[-1] ne $pathsep) 0 0 0
Condition0%0/3
$head ne "" and ($head =~ / \G ($Ewindows1254::q_char) /gmosx)[-1] ne $pathsep
!ll&&!rl&&r
000
MC/DC0%0/2
$head ne "" and ($head =~ / \G ($Ewindows1254::q_char) /gmosx)[-1] ne $pathsep
$head ne "" ($head =~ / \G ($Ewindows1254::q_char) /gmosx)[-1] ne $pathsep
Truth table0%0/3
A and B
A= $head ne ""B= ($head =~ / \G ($Ewindows1254::q_char) /gmosx)[-1] ne $pathsep
ABresult
0X0
100
111
2452 0 $head .= $pathsep;
2453 }
2454  
2455 0 my $pattern = '';
2456 0 ▶ while ($expr =~ / \G ($q_char) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expr =~ / \G ($Ewindows1254::q_char) /cgox) 0 0 0
2457 0 my $char = $1;
2458  
2459 # 6.9. Matching Shell Globs as Regular Expressions
2460 # in Chapter 6. Pattern Matching
2461 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2462 # (and so on)
2463  
2464 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
2465 0 $pattern .= "(?:$your_char)*",
2466 }
2467 elsif ($char eq '?') {
2468 0 $pattern .= "(?:$your_char)?", # DOS style
2469 # $pattern .= "(?:$your_char)", # UNIX style
2470 }
2471 elsif ((my $fc = Ewindows1254::fc($char)) ne $char) {
2472 0 $pattern .= $fc;
2473 }
2474 else {
2475 0 $pattern .= quotemeta $char;
2476 }
2477 }
2478 0 ▶ my $matchsub = sub { Ewindows1254::fc($_[0]) =~ /\A $pattern \z/xms };
Subroutine __ANON__: not called CC=1 SCAR=6.9
2479  
2480 # if ($@) {
2481 # print STDERR "$0: $@\n";
2482 # next OUTER;
2483 # }
2484  
2485 INNER:
2486 0 for my $leaf (@leaf) {
2487 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
2488 0 next INNER;
2489 }
2490 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
2491 0 next INNER;
2492 }
2493  
2494 0 ▶ if (&$matchsub($leaf)) {
Branch: 1 branch
BranchTrueFalseTotal
if (&$matchsub($leaf)) 0 0 0
2495 0 push @matched, "$head$leaf";
2496 0 next INNER;
2497 }
2498  
2499 # [DOS compatibility special case]
2500 # Failed, add a trailing dot and try again, but only...
2501  
2502 0 ▶ if (Ewindows1254::index($leaf,'.') == -1 and # if name does not have a dot in it *and*
Branch: 1 branch
BranchTrueFalseTotal
if (&Ewindows1254::index($leaf, ".") == -1 and length $leaf <= 8 and &Ewindows1254::index($pattern, "\\.") != -1) 0 0 0
Condition0%0/6
&Ewindows1254::index($leaf, ".") == -1 and length $leaf <= 8 and &Ewindows1254::index($pattern, "\\.") != -1
!ll&&!rl&&r
000
&Ewindows1254::index($leaf, ".") == -1 and length $leaf <= 8
!ll&&!rl&&r
000
MC/DC0%0/3
&Ewindows1254::index($leaf, ".") == -1 and length $leaf <= 8 and &Ewindows1254::index($pattern, "\\.") != -1
&Ewindows1254::index($leaf, ".") == -1 length $leaf <= 8 &Ewindows1254::index($pattern, "\\.") != -1
Truth table0%0/4
A and B and C
A= &Ewindows1254::index($leaf, ".") == -1B= length $leaf <= 8C= &Ewindows1254::index($pattern, "\\.") != -1
ABCresult
0XX0
10X0
1100
1111
2503 CORE::length($leaf) <= 8 and # name is shorter than or equal to 8 chars *and*
2504 Ewindows1254::index($pattern,'\\.') != -1 # pattern has a dot.
2505 ) {
2506 0 ▶ if (&$matchsub("$leaf.")) {
Branch: 1 branch
BranchTrueFalseTotal
if (&$matchsub("$leaf.")) 0 0 0
2507 0 push @matched, "$head$leaf";
2508 0 next INNER;
2509 }
2510 }
2511 }
2512 0 ▶ if (@matched) {
Branch: 1 branch
BranchTrueFalseTotal
if (@matched) 0 0 0
2513 0 push @glob, @matched;
2514 }
2515 }
2516 0 ▶ if ($fix_drive_relative_paths) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fix_drive_relative_paths) 0 0 0
2517 0 for my $glob (@glob) {
2518 0 $glob =~ s# \A ([A-Za-z]:) \./ #$1#oxms;
2519 }
2520 }
2521 0 return @glob;
2522 }
2523  
2524 #
2525 # Windows-1254 parse line
2526 #
2527 0 ▶sub _parse_line {
Subroutine _parse_line: not called CC=3 SCAR=24.8
2528  
2529 0 my($line) = @_;
2530  
2531 0 $line .= ' ';
2532 0 my @piece = ();
2533 0 ▶ while ($line =~ /
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ / " ( (?>(?: [^"] )* ) ) " (?>\s+) | ( (?>(?: [^"\s] )* ) ) (?>\s+) /gmosx) 0 0 0
2534 " ( (?>(?: [^"] )* ) ) " (?>\s+) |
2535 ( (?>(?: [^"\s] )* ) ) (?>\s+)
2536 /oxmsg
2537 ) {
2538 0 ▶ push @piece, defined($1) ? $1 : $2;
Branch: 1 branch
BranchTrueFalseTotal
defined $1 ? : 0 0 0
2539 }
2540 0 return @piece;
2541 }
2542  
2543 #
2544 # Windows-1254 parse path
2545 #
2546 0 ▶sub _parse_path {
Subroutine _parse_path: not called CC=2 SCAR=17.9
2547  
2548 0 my($path,$pathsep) = @_;
2549  
2550 0 $path .= '/';
2551 0 my @subpath = ();
2552 0 ▶ while ($path =~ /
Branch: 1 branch
BranchTrueFalseTotal
if ($path =~ m( ((?: [^/\\] )+?) [/\\] )gmosx) 0 0 0
2553 ((?: [^\/\\] )+?) [\/\\]
2554 /oxmsg
2555 ) {
2556 0 push @subpath, $1;
2557 }
2558  
2559 0 my $tail = pop @subpath;
2560 0 my $head = join $pathsep, @subpath;
2561 0 return $head, $tail;
2562 }
2563  
2564 #
2565 # via File::HomeDir::Windows 1.00
2566 #
2567 0 ▶sub my_home_MSWin32 {
Subroutine my_home_MSWin32: not called CC=9 SCAR=45.0
Pod undocumented
2568  
2569 # A lot of unix people and unix-derived tools rely on
2570 # the ability to overload HOME. We will support it too
2571 # so that they can replace raw HOME calls with File::HomeDir.
2572 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
2573 0 return $ENV{'HOME'};
2574 }
2575  
2576 # Do we have a user profile?
2577 ▶ 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
2578 0 return $ENV{'USERPROFILE'};
2579 }
2580  
2581 # Some Windows use something like $ENV{'HOME'}
2582 ▶ 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
2583 0 return join '', $ENV{'HOMEDRIVE'}, $ENV{'HOMEPATH'};
2584 }
2585  
2586 0 return undef;
2587 }
2588  
2589 #
2590 # via File::HomeDir::Unix 1.00
2591 #
2592 0 ▶sub my_home {
Subroutine my_home: not called CC=7 SCAR=40.3
Pod undocumented
2593 0 my $home;
2594  
2595 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
2596 0 $home = $ENV{'HOME'};
2597 }
2598  
2599 # This is from the original code, but I'm guessing
2600 # it means "login directory" and exists on some Unixes.
2601 ▶ 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
2602 0 $home = $ENV{'LOGDIR'};
2603 }
2604  
2605 ### More-desperate methods
2606  
2607 # Light desperation on any (Unixish) platform
2608 else {
2609 0 $home = CORE::eval q{ (getpwuid($<))[7] };
2610 }
2611  
2612 # On Unix in general, a non-existant home means "no home"
2613 # For example, "nobody"-like users might use /nonexistant
2614 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
2615 0 $home = undef;
2616 }
2617 0 return $home;
2618 }
2619  
2620 #
2621 # ${^PREMATCH}, $PREMATCH, $` the string preceding what was matched
2622 #
2623 56 ▶sub Ewindows1254::PREMATCH {
Subroutine PREMATCH: called CC=1 SCAR=0.0
Pod undocumented
2624 56 return $`;
2625 }
2626  
2627 #
2628 # ${^MATCH}, $MATCH, $& the string that matched
2629 #
2630 81 ▶sub Ewindows1254::MATCH {
Subroutine MATCH: called CC=1 SCAR=0.0
Pod undocumented
2631 81 return $&;
2632 }
2633  
2634 #
2635 # ${^POSTMATCH}, $POSTMATCH, $' the string following what was matched
2636 #
2637 42 ▶sub Ewindows1254::POSTMATCH {
Subroutine POSTMATCH: called CC=1 SCAR=0.0
Pod undocumented
2638 42 return $';
2639 }
2640  
2641 #
2642 # Windows-1254 character to order (with parameter)
2643 #
2644 0 ▶sub Windows1254::ord(;$) {
Subroutine ord: not called CC=4 SCAR=30.0
2645  
2646 0 ▶ local $_ = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
2647  
2648 0 ▶ if (/\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\A ($Ewindows1254::q_char) /mosx) { } 0 0 0
2649 0 my @ord = unpack 'C*', $1;
2650 0 my $ord = 0;
2651 0 ▶ while (my $o = shift @ord) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $o = shift @ord) 0 0 0
2652 0 $ord = $ord * 0x100 + $o;
2653 }
2654 0 return $ord;
2655 }
2656 else {
2657 0 return CORE::ord $_;
2658 }
2659 }
2660  
2661 #
2662 # Windows-1254 character to order (without parameter)
2663 #
2664 0 ▶sub Windows1254::ord_() {
Subroutine ord_: not called CC=3 SCAR=24.8
2665  
2666 0 ▶ if (/\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\A ($Ewindows1254::q_char) /mosx) { } 0 0 0
2667 0 my @ord = unpack 'C*', $1;
2668 0 my $ord = 0;
2669 0 ▶ while (my $o = shift @ord) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $o = shift @ord) 0 0 0
2670 0 $ord = $ord * 0x100 + $o;
2671 }
2672 0 return $ord;
2673 }
2674 else {
2675 0 return CORE::ord $_;
2676 }
2677 }
2678  
2679 #
2680 # Windows-1254 reverse
2681 #
2682 0 ▶sub Windows1254::reverse(@) {
Subroutine reverse: not called CC=2 SCAR=17.9
2683  
2684 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2685 0 return CORE::reverse @_;
2686 }
2687 else {
2688  
2689 # One of us once cornered Larry in an elevator and asked him what
2690 # problem he was solving with this, but he looked as far off into
2691 # the distance as he could in an elevator and said, "It seemed like
2692 # a good idea at the time."
2693  
2694 0 return join '', CORE::reverse(join('',@_) =~ /\G ($q_char) /oxmsg);
2695 }
2696 }
2697  
2698 #
2699 # Windows-1254 getc (with parameter, without parameter)
2700 #
2701 20 ▶sub Windows1254::getc(;*@) {
Subroutine getc: called CC=9 SCAR=26.7
2702  
2703 20 my($package) = caller;
2704 20 ▶ my $fh = @_ ? qualify_to_ref(shift,$package) : \*STDIN;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 20 0 20
2705 20 ▶ croak 'Too many arguments for Windows1254::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
2706  
2707 0 my @length = sort { $a <=> $b } keys %range_tr;
2708 20 my $getc = '';
2709 20 for my $length ($length[0] .. $length[-1]) {
2710 20 $getc .= CORE::getc($fh);
2711 20 ▶ if (exists $range_tr{CORE::length($getc)}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{length $getc}) 20 0 20
2712 20 ▶ if ($getc =~ /\A ${Ewindows1254::dot_s} \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($getc =~ /\A $Ewindows1254::dot_s \z/mosx) 20 0 20
2713 20 ▶ return wantarray ? ($getc,@_) : $getc;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 20 20
2714 }
2715 }
2716 }
2717 0 ▶ return wantarray ? ($getc,@_) : $getc;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
2718 }
2719  
2720 #
2721 # Windows-1254 length by character
2722 #
2723 0 ▶sub Windows1254::length(;$) {
Subroutine length: not called CC=2 SCAR=17.9
2724  
2725 0 ▶ local $_ = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
2726  
2727 0 local @_ = /\G ($q_char) /oxmsg;
2728 0 return scalar @_;
2729 }
2730  
2731 #
2732 # Windows-1254 substr by character
2733 #
2734 424 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=7.0
2735  
2736 # P.232 The lvalue Attribute
2737 # in Chapter 6: Subroutines
2738 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2739  
2740 # P.336 The lvalue Attribute
2741 # in Chapter 7: Subroutines
2742 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2743  
2744 # P.144 8.4 Lvalue subroutines
2745 # in Chapter 8: perlsub: Perl subroutines
2746 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
2747  
2748 0 ▶ CORE::eval sprintf(<<'END', ($] >= 5.014000) ? ':lvalue' : '');
Subroutine __ANON__: not called CC=1 SCAR=0.0
Subroutine __ANON__: not called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: not called CC=1 SCAR=0.0
Subroutine substr: called CC=11 SCAR=24.3
Branch: 10 branches
BranchTrueFalseTotal
$] >= 5.014 ? : 424 0 424
if ($offset > scalar @char or $offset < -1 * scalar(@char)) 2 25 27
if (@_ == 4) { } 1 24 25
elsif (@_ == 3) { } 21 3 24
if ($offset == 0) { } 0 21 21
elsif ($offset > 0) { } 20 1 21
if ($length == 0) { } 0 21 21
elsif ($length > 0) { } 20 1 21
if ($offset == 0) { } 0 3 3
elsif ($offset > 0) { } 2 1 3
Condition66%2/3
$offset > scalar @char or $offset < -1 * scalar(@char)
l!l&&r!l&&!r
2025
MC/DC50%1/2
$offset > scalar @char or $offset < -1 * scalar(@char)
$offset > scalar @char $offset < -1 * scalar(@char)
Truth table66%2/3
A or B
A= $offset > scalar @charB= $offset < -1 * scalar(@char)
ABresult
1X1
011
000
2749 # vv----------------------*******
2750 sub Windows1254::substr($$;$$) %s {
2751  
2752 my @char = $_[0] =~ /\G (?>$q_char) /oxmsg;
2753  
2754 # If the substring is beyond either end of the string, substr() returns the undefined
2755 # value and produces a warning. When used as an lvalue, specifying a substring that
2756 # is entirely outside the string raises an exception.
2757 # http://perldoc.perl.org/functions/substr.html
2758  
2759 # A return with no argument returns the scalar value undef in scalar context,
2760 # an empty list () in list context, and (naturally) nothing at all in void
2761 # context.
2762  
2763 my $offset = $_[1];
2764 if (($offset > scalar(@char)) or ($offset < (-1 * scalar(@char)))) {
2765 return;
2766 }
2767  
2768 # substr($string,$offset,$length,$replacement)
2769 if (@_ == 4) {
2770 my(undef,undef,$length,$replacement) = @_;
2771 my $substr = join '', splice(@char, $offset, $length, $replacement);
2772 $_[0] = join '', @char;
2773  
2774 # return $substr; this doesn't work, don't say "return"
2775 $substr;
2776 }
2777  
2778 # substr($string,$offset,$length)
2779 elsif (@_ == 3) {
2780 my(undef,undef,$length) = @_;
2781 my $octet_offset = 0;
2782 my $octet_length = 0;
2783 if ($offset == 0) {
2784 $octet_offset = 0;
2785 }
2786 elsif ($offset > 0) {
2787 local $SIG{__WARN__} = sub {}; # avoid: Use of uninitialized value in join or string at here
2788 $octet_offset = CORE::length(join '', @char[0..$offset-1]);
2789 }
2790 else {
2791 local $SIG{__WARN__} = sub {}; # avoid: Use of uninitialized value in join or string at here
2792 $octet_offset = -1 * CORE::length(join '', @char[$#char+$offset+1..$#char]);
2793 }
2794 if ($length == 0) {
2795 $octet_length = 0;
2796 }
2797 elsif ($length > 0) {
2798 local $SIG{__WARN__} = sub {}; # avoid: Use of uninitialized value in join or string at here
2799 $octet_length = CORE::length(join '', @char[$offset..$offset+$length-1]);
2800 }
2801 else {
2802 local $SIG{__WARN__} = sub {}; # avoid: Use of uninitialized value in join or string at here
2803 $octet_length = -1 * CORE::length(join '', @char[$#char+$length+1..$#char]);
2804 }
2805 CORE::substr($_[0], $octet_offset, $octet_length);
2806 }
2807  
2808 # substr($string,$offset)
2809 else {
2810 my $octet_offset = 0;
2811 if ($offset == 0) {
2812 $octet_offset = 0;
2813 }
2814 elsif ($offset > 0) {
2815 $octet_offset = CORE::length(join '', @char[0..$offset-1]);
2816 }
2817 else {
2818 $octet_offset = -1 * CORE::length(join '', @char[$#char+$offset+1..$#char]);
2819 }
2820 CORE::substr($_[0], $octet_offset);
2821 }
2822 }
2823 END
2824 }
2825  
2826 #
2827 # Windows-1254 index by character
2828 #
2829 0 ▶sub Windows1254::index($$;$) {
Subroutine index: not called CC=3 SCAR=24.8
2830  
2831 0 my $index;
2832 0 ▶ if (@_ == 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 3) { } 0 0 0
2833 0 $index = Ewindows1254::index($_[0], $_[1], CORE::length(Windows1254::substr($_[0], 0, $_[2])));
2834 }
2835 else {
2836 0 $index = Ewindows1254::index($_[0], $_[1]);
2837 }
2838  
2839 0 ▶ if ($index == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($index == -1) { } 0 0 0
2840 0 return -1;
2841 }
2842 else {
2843 0 return Windows1254::length(CORE::substr $_[0], 0, $index);
2844 }
2845 }
2846  
2847 #
2848 # Windows-1254 rindex by character
2849 #
2850 0 ▶sub Windows1254::rindex($$;$) {
Subroutine rindex: not called CC=3 SCAR=24.8
2851  
2852 0 my $rindex;
2853 0 ▶ if (@_ == 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 3) { } 0 0 0
2854 0 $rindex = Ewindows1254::rindex($_[0], $_[1], CORE::length(Windows1254::substr($_[0], 0, $_[2])));
2855 }
2856 else {
2857 0 $rindex = Ewindows1254::rindex($_[0], $_[1]);
2858 }
2859  
2860 0 ▶ if ($rindex == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rindex == -1) { } 0 0 0
2861 0 return -1;
2862 }
2863 else {
2864 0 return Windows1254::length(CORE::substr $_[0], 0, $rindex);
2865 }
2866 }
2867  
2868 # when 'm//', '/' means regexp match 'm//' and '?' means regexp match '??'
2869 # when 'div', '/' means division operator and '?' means conditional operator (condition ? then : else)
2870 424 ▶use vars qw($slash); $slash = 'm//';
Subroutine BEGIN: called CC=1 SCAR=0.0
2871  
2872 # ord() to ord() or Windows1254::ord()
2873 424 my $function_ord = 'ord';
2874  
2875 # ord to ord or Windows1254::ord_
2876 424 my $function_ord_ = 'ord';
2877  
2878 # reverse to reverse or Windows1254::reverse
2879 424 my $function_reverse = 'reverse';
2880  
2881 # getc to getc or Windows1254::getc
2882 424 my $function_getc = 'getc';
2883  
2884 # P.1023 Appendix W.9 Multibyte Anchoring
2885 # of ISBN 1-56592-224-7 CJKV Information Processing
2886  
2887 424 my $anchor = '';
2888  
2889 424 ▶use vars qw($nest);
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
2890  
2891 # regexp of nested parens in qqXX
2892  
2893 # P.340 Matching Nested Constructs with Embedded Code
2894 # in Chapter 7: Perl
2895 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
2896  
2897 my $qq_paren = qr{(?{local $nest=0}) (?>(?:
2898 [^\\()] |
2899 \( (?{$nest++}) |
2900 \) (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2901 \\ [^c] |
2902 \\c[\x40-\x5F] |
2903 [\x00-\xFF]
2904 424 }xms;
2905  
2906 my $qq_brace = qr{(?{local $nest=0}) (?>(?:
2907 [^\\{}] |
2908 \{ (?{$nest++}) |
2909 \} (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2910 \\ [^c] |
2911 \\c[\x40-\x5F] |
2912 [\x00-\xFF]
2913 424 }xms;
2914  
2915 my $qq_bracket = qr{(?{local $nest=0}) (?>(?:
2916 [^\\\[\]] |
2917 \[ (?{$nest++}) |
2918 \] (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2919 \\ [^c] |
2920 \\c[\x40-\x5F] |
2921 [\x00-\xFF]
2922 424 }xms;
2923  
2924 my $qq_angle = qr{(?{local $nest=0}) (?>(?:
2925 [^\\<>] |
2926 \< (?{$nest++}) |
2927 \> (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2928 \\ [^c] |
2929 \\c[\x40-\x5F] |
2930 [\x00-\xFF]
2931 424 }xms;
2932  
2933 424 my $qq_scalar = qr{(?: \{ (?:$qq_brace)*? \} |
2934 (?: ::)? (?:
2935 (?> [a-zA-Z_][a-zA-Z_0-9]* (?: ::[a-zA-Z_][a-zA-Z_0-9]*)* )
2936 (?>(?: \[ (?: \$\[ | \$\] | $qq_char )*? \] | \{ (?:$qq_brace)*? \} )*)
2937 (?>(?: (?: -> )? (?: [\$\@\%\&\*]\* | \$\#\* | [\@\%]? \[ (?: \$\[ | \$\] | $qq_char )*? \] | [\@\%\*]? \{ (?:$qq_brace)*? \} ) )*)
2938 ))
2939 }xms;
2940  
2941 424 my $qq_variable = qr{(?: \{ (?:$qq_brace)*? \} |
2942 (?: ::)? (?:
2943 (?>[0-9]+) |
2944 [^a-zA-Z_0-9\[\]] |
2945 ^[A-Z] |
2946 (?> [a-zA-Z_][a-zA-Z_0-9]* (?: ::[a-zA-Z_][a-zA-Z_0-9]*)* )
2947 (?>(?: \[ (?: \$\[ | \$\] | $qq_char )*? \] | \{ (?:$qq_brace)*? \} )*)
2948 (?>(?: (?: -> )? (?: [\$\@\%\&\*]\* | \$\#\* | [\@\%]? \[ (?: \$\[ | \$\] | $qq_char )*? \] | [\@\%\*]? \{ (?:$qq_brace)*? \} ) )*)
2949 ))
2950 }xms;
2951  
2952 424 my $qq_substr = qr{(?> Char::substr | Windows1254::substr | CORE::substr | substr ) (?>\s*) \( $qq_paren \)
2953 }xms;
2954  
2955 # regexp of nested parens in qXX
2956 my $q_paren = qr{(?{local $nest=0}) (?>(?:
2957 [^()] |
2958 \( (?{$nest++}) |
2959 \) (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2960 [\x00-\xFF]
2961 424 }xms;
2962  
2963 my $q_brace = qr{(?{local $nest=0}) (?>(?:
2964 [^\{\}] |
2965 \{ (?{$nest++}) |
2966 \} (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2967 [\x00-\xFF]
2968 424 }xms;
2969  
2970 my $q_bracket = qr{(?{local $nest=0}) (?>(?:
2971 [^\[\]] |
2972 \[ (?{$nest++}) |
2973 \] (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2974 [\x00-\xFF]
2975 424 }xms;
2976  
2977 my $q_angle = qr{(?{local $nest=0}) (?>(?:
2978 [^<>] |
2979 \< (?{$nest++}) |
2980 \> (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2981 [\x00-\xFF]
2982 424 }xms;
2983  
2984 424 my $matched = '';
2985 424 my $s_matched = '';
2986  
2987 424 my $tr_variable = ''; # variable of tr///
2988 424 my $sub_variable = ''; # variable of s///
2989 424 my $bind_operator = ''; # =~ or !~
2990  
2991 424 my @heredoc = (); # here document
2992 424 my @heredoc_delimiter = ();
2993 424 my $here_script = ''; # here script
2994  
2995 #
2996 # escape Windows-1254 script
2997 #
2998 548 ▶sub Windows1254::escape(;$) {
Subroutine escape: called CC=3 SCAR=11.0
2999 548 ▶ local($_) = $_[0] if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 292 256 548
3000  
3001 # P.359 The Study Function
3002 # in Chapter 7: Perl
3003 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3004  
3005 548 study $_; # Yes, I studied study yesterday.
3006  
3007 # while all script
3008  
3009 # 6.14. Matching from Where the Last Pattern Left Off
3010 # in Chapter 6. Pattern Matching
3011 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
3012 # (and so on)
3013  
3014 # one member of Tag-team
3015 #
3016 # P.128 Start of match (or end of previous match): \G
3017 # P.130 Advanced Use of \G with Perl
3018 # in Chapter 3: Overview of Regular Expression Features and Flavors
3019 # P.255 Use leading anchors
3020 # P.256 Expose ^ and \G at the front expressions
3021 # in Chapter 6: Crafting an Efficient Expression
3022 # P.315 "Tag-team" matching with /gc
3023 # in Chapter 7: Perl
3024 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3025  
3026 548 my $e_script = '';
3027 548 ▶ while (not /\G \z/oxgc) { # member
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 87284 548 87832
3028 87284 $e_script .= Windows1254::escape_token();
3029 }
3030  
3031 548 return $e_script;
3032 }
3033  
3034 #
3035 # escape Windows-1254 token of script
3036 #
3037 87284 ▶sub Windows1254::escape_token {
Subroutine escape_token: called CC=504 SCAR=109.3
3038  
3039 # \n output here document
3040  
3041 87284 my $ignore_modules = join('|', qw(
3042 utf8
3043 bytes
3044 charnames
3045 I18N::Japanese
3046 I18N::Collate
3047 I18N::JExt
3048 File::DosGlob
3049 Wild
3050 Wildcard
3051 Japanese
3052 ));
3053  
3054 # another member of Tag-team
3055 #
3056 # P.315 "Tag-team" matching with /gc
3057 # in Chapter 7: Perl
3058 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3059  
3060 87284 ▶ if (/\G ( \n ) /oxgc) { # another member (and so on)
Branch: 139 branches
BranchTrueFalseTotal
if (/\G ( \n ) /cgox) { } 12806 74478 87284
elsif (/\G ((?>\s+)|\#.*) /cgox) { } 21272 53206 74478
elsif (/\G ( (?: if | elsif | unless | while | until | given | when ) (?>\s*) \( ) /cgox) { } 1644 51562 53206
elsif (/\G ( \( (?>\s*) (?: local \b | my \b | our \b | state \b )? (?>\s*) \$ $qq_scalar ) /cgox) { } 90 51472 51562
elsif (/\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /cgmosx) { } 4 51468 51472
elsif (/\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /cgmosx) { } 28 51440 51468
elsif (/\G ( \$' | \$\{'\} ) /cgmosx) { } 1 51439 51440
elsif (/\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /cgmosx) { } 3 51436 51439
elsif (/\G ( \$ $qq_scalar | $qq_substr ) /cgox) { } 1754 49682 51436
elsif (/\G ( [,;] ) /cgox) { } 5063 44619 49682
elsif (/\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /cgmosx) { } 0 44619 44619
elsif (/\G ( \$ 0 ) /cgmosx) { } 2 44617 44619
elsif (/\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /cgmosx) { } 0 44617 44617
elsif (/\G ( \$ \$ ) (?![\w\{]) /cgmosx) { } 1 44616 44617
elsif (/\G \$ ((?>[1-9][0-9]*)) /cgmosx) { } 4 44612 44616
elsif (/\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /cgmosx) { } 0 44612 44612
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /cgmosx) { } 0 44612 44612
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /cgmosx) { } 0 44612 44612
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /cgmosx) { } 0 44612 44612
elsif (/\G \$ (?>\s*) \{ ( (?>\s*) (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* ) (?>\s*) ) \} /cgmosx) { } 0 44612 44612
elsif (/\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /cgmosx) { } 0 44612 44612
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 44570 44612
elsif (m{\G ( \$[\$\@\#\\\'\"/\?\(\)\[\]\<\>] ) }cgmosx) { } 63 44507 44570
elsif (/\G \b (while (?>\s*) \( (?>\s*) <[\$]?[A-Za-z_][A-Za-z_0-9]*> (?>\s*) \)) \b /cgox) { } 0 44507 44507
elsif (/\G \b while (?>\s*) \( (?>\s*) < ((?:[^>\0\a\e\f\n\r\t])+?) > (?>\s*) \) \b /cgox) { } 0 44507 44507
elsif (/\G \b while (?>\s*) \( (?>\s*) glob (?>\s*) \) /cgox) { } 0 44507 44507
elsif (/\G \b while (?>\s*) \( (?>\s*) glob \b /cgox) { } 0 44507 44507
elsif (/\G \b ( if | unless | while | until | for | when ) \b /cgox) { } 251 44256 44507
elsif (/\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /cgox) { } 19 44237 44256
elsif (/\G \b Char::eval (?= (?>\s*) \{ ) /cgox) { } 0 44237 44237
elsif (/\G \b Windows1254::eval (?= (?>\s*) \{ ) /cgox) { } 22 44215 44237
elsif (/\G \b Char::eval \b (?! (?>\s*) => ) /cgox) { } 0 44215 44215
elsif (/\G \b Windows1254::eval \b (?! (?>\s*) => ) /cgox) { } 168 44047 44215
elsif (/\G \b bytes::substr \b (?! (?>\s*) => ) /cgox) { } 2 44045 44047
elsif (/\G \b chop \b (?! (?>\s*) => ) /cgox) { } 0 44045 44045
elsif (/\G \b bytes::index \b (?! (?>\s*) => ) /cgox) { } 2 44043 44045
elsif (/\G \b Char::index \b (?! (?>\s*) => ) /cgox) { } 0 44043 44043
elsif (/\G \b Windows1254::index \b (?! (?>\s*) => ) /cgox) { } 0 44043 44043
elsif (/\G \b index \b (?! (?>\s*) => ) /cgox) { } 0 44043 44043
elsif (/\G \b bytes::rindex \b (?! (?>\s*) => ) /cgox) { } 2 44041 44043
elsif (/\G \b Char::rindex \b (?! (?>\s*) => ) /cgox) { } 0 44041 44041
elsif (/\G \b Windows1254::rindex \b (?! (?>\s*) => ) /cgox) { } 0 44041 44041
elsif (/\G \b rindex \b (?! (?>\s*) => ) /cgox) { } 0 44041 44041
elsif (/\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 1 44040 44041
elsif (/\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 44040 44040
elsif (/\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 1 44039 44040
elsif (/\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 44039 44039
elsif (/\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 6 44033 44039
elsif (/\G -s (?>\s*) (\") ((?:$Ewindows1254::qq_char)+?) (\") /cgox) { } 0 44033 44033
elsif (/\G -s (?>\s+) qq (?>\s*) (\#) ((?:$Ewindows1254::qq_char)+?) (\#) /cgox) { } 0 44033 44033
elsif (/\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /cgox) { } 0 44033 44033
elsif (/\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /cgox) { } 0 44033 44033
elsif (/\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /cgox) { } 0 44033 44033
elsif (/\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /cgox) { } 0 44033 44033
elsif (/\G -s (?>\s+) qq (?>\s*) (\S) ((?:$Ewindows1254::qq_char)+?) (\1) /cgox) { } 0 44033 44033
elsif (/\G -s (?>\s*) (\') ((?:\\\'|\\\\|$Ewindows1254::q_char)+?) (\') /cgox) { } 0 44033 44033
elsif (/\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$Ewindows1254::q_char)+?) (\#) /cgox) { } 0 44033 44033
elsif (/\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /cgox) { } 0 44033 44033
elsif (/\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /cgox) { } 0 44033 44033
elsif (/\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /cgox) { } 0 44033 44033
elsif (/\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /cgox) { } 0 44033 44033
elsif (/\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$Ewindows1254::q_char)+?) (\1) /cgox) { } 0 44033 44033
elsif (/\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)* ) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ) )*) /cgox) { } 0 44033 44033
elsif (/\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /cgox) { } 0 44033 44033
elsif (/\G -s (?= (?>\s+) [a-z]+) /cgox) { } 0 44033 44033
elsif (/\G -s (?>\s+) ((?>\w+)) /cgox) { } 0 44033 44033
elsif (/\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 44031 44033
elsif (/\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 44029 44031
elsif (/\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 36 43993 44029
elsif (/\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43991 43993
elsif (/\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 8 43983 43991
elsif (/\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43983 43983
elsif (/\G \b lc \b (?! (?>\s*) => ) /cgox) { } 0 43983 43983
elsif (/\G \b lcfirst \b (?! (?>\s*) => ) /cgox) { } 0 43983 43983
elsif (/\G \b uc \b (?! (?>\s*) => ) /cgox) { } 0 43983 43983
elsif (/\G \b ucfirst \b (?! (?>\s*) => ) /cgox) { } 0 43983 43983
elsif (/\G \b fc \b (?! (?>\s*) => ) /cgox) { } 0 43983 43983
elsif (/\G -s \b (?! (?>\s*) => ) /cgox) { } 0 43983 43983
elsif (/\G \b bytes::length \b (?! (?>\s*) => ) /cgox) { } 0 43983 43983
elsif (/\G \b bytes::chr \b (?! (?>\s*) => ) /cgox) { } 0 43983 43983
elsif (/\G \b chr \b (?! (?>\s*) => ) /cgox) { } 0 43983 43983
elsif (/\G \b bytes::ord \b (?! (?>\s*) => ) /cgox) { } 0 43983 43983
elsif (/\G \b ord \b (?! (?>\s*) => ) /cgox) { } 0 43983 43983
elsif (/\G \b glob \b (?! (?>\s*) => ) /cgox) { } 0 43983 43983
elsif (/\G \b reverse \b (?! (?>\s*) => ) /cgox) { } 0 43983 43983
elsif (/\G \b getc \b (?! (?>\s*) => ) /cgox) { } 8 43975 43983
elsif (/\G \b (split) \b (?! (?>\s*) => ) /cgox) { } 87 43888 43975
elsif (/\G \b ( tr | y ) \b /cgox) { } 4 43884 43888
elsif (/\G \b (qq) \b /cgox) { } 2252 41632 43884
elsif (/\G \b (qr) \b /cgox) { } 0 41632 41632
elsif (/\G \b (qw) \b /cgox) { } 16 41616 41632
elsif (/\G \b (qx) \b /cgox) { } 0 41616 41616
elsif (/\G \b (q) \b /cgox) { } 473 41143 41616
elsif (/\G \b (m) \b /cgox) { } 209 40934 41143
elsif (/\G \b (s) \b /cgox) { } 101 40833 40934
elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 0 40833 40833
elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 40833 40833
elsif (/\G \b require ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 40833 40833
elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [#\n]) /cgmosx) { } 37 40796 40833
elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 40796 40796
elsif (/\G \b use ((?>\s+) strict) \b /cgmosx) { } 0 40796 40796
elsif (/\G \b use (?>\s+) ((?>([1-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /cgmosx) { } 2 40794 40796
elsif (/\G \b use (?>\s+) ((?>v([0-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /cgmosx) { } 0 40794 40794
elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 2 40792 40794
elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 40792 40792
elsif (/\G \b use ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 40792 40792
elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 0 40792 40792
elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 40792 40792
elsif (/\G \b no ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 40792 40792
elsif (/\G \b use \b /cgmosx) { } 0 40792 40792
elsif (/\G \b no \b /cgmosx) { } 2 40790 40792
elsif (/\G (?<![\w\$\@\%\&\*]) (\') /cgox) { } 1142 39648 40790
elsif (/\G (\") /cgox) { } 1873 37775 39648
elsif (/\G (\`) /cgox) { } 1 37774 37775
elsif ($Ewindows1254::slash eq 'm//' and m[\G (/) ]cgox) { } 681 37093 37774
elsif ($Ewindows1254::slash eq 'm//' and /\G (\?) /cgox) { } 0 37093 37093
elsif (/\G ( <<>> ) /cgox) { } 0 37093 37093
elsif (/\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /cgox) { } 0 37093 37093
elsif (/\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /cgox) { } 6 37087 37093
elsif (/\G ( <<~ \\([a-zA-Z_0-9]+) ) /cgox) { } 3 37084 37087
elsif (/\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /cgox) { } 6 37078 37084
elsif (/\G ( <<~ ([a-zA-Z_0-9]+) ) /cgox) { } 3 37075 37078
elsif (/\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /cgox) { } 6 37069 37075
elsif (/\G ( << '([a-zA-Z_0-9]*)' ) /cgox) { } 72 36997 37069
elsif (/\G ( << \\([a-zA-Z_0-9]+) ) /cgox) { } 0 36997 36997
elsif (/\G ( << "([a-zA-Z_0-9]*)" ) /cgox) { } 36 36961 36997
elsif (/\G ( << ([a-zA-Z_0-9]+) ) /cgox) { } 42 36919 36961
elsif (/\G ( << `([a-zA-Z_0-9]*)` ) /cgox) { } 0 36919 36919
elsif (/\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/cgox) { } 12 36907 36919
elsif (/\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /cgox) { } 0 36907 36907
elsif (/\G < ((?:[^>\0\a\e\f\n\r\t])+?) > /cgox) { } 0 36907 36907
elsif (/\G ^ ( __DATA__ \n .*) \z /cgmosx) { } 0 36907 36907
elsif (/\G ^ ( __END__ \n .*) \z /cgmosx) { } 210 36697 36907
elsif (/\G ( \cD .*) \z /cgmosx) { } 0 36697 36697
elsif (/\G ( \cZ .*) \z /cgmosx) { } 0 36697 36697
elsif (/\G ( -- | \+\+ | [\)\}\]] ) /cgox) { } 5839 30858 36697
elsif (/\G ( \.\.\. ) /cgox) { } 7 30851 30858
elsif (m"\G ((?> !~~ | !~ | != | ! | %= | % | &&= | && | &= | &\.= | &\. | & | -= | -> | - | :(?>\s*)= | : | <<>> | <<= | <=> | <= | < | == | => | =~ | = | >>= | >> | >= | > | \*\*= | \*\* | \*= | \* | \+= | \+ | \.\. | \.= | \. | //= | // | /= | / | \? | \\ | \^= | \^\.= | \^\. | \^ | \b x= | \|\|= | \|\| | \|= | \|\.= | \|\. | \| | ~~ | ~\. | ~ | \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b | \b(?: print )\b | [,;\(\{\[] )) "cgox) { } 9773 21078 30851
elsif (/\G ($Ewindows1254::q_char) /cgox) { } 21078 0 21078
3061 12806 my $heredoc = '';
3062 12806 ▶ if (scalar(@heredoc_delimiter) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @heredoc_delimiter >= 1) 174 12632 12806
3063 174 $slash = 'm//';
3064  
3065 174 $heredoc = join '', @heredoc;
3066 174 @heredoc = ();
3067  
3068 # skip here document
3069 174 for my $heredoc_delimiter (@heredoc_delimiter) {
3070 174 /\G .*? \n $heredoc_delimiter \n/xmsgc;
3071 }
3072 174 @heredoc_delimiter = ();
3073  
3074 174 $here_script = '';
3075 }
3076 12806 return "\n" . $heredoc;
3077 }
3078  
3079 # ignore space, comment
3080 21272 elsif (/\G ((?>\s+)|\#.*) /oxgc) { return $1; }
3081  
3082 # if (, elsif (, unless (, while (, until (, given (, and when (
3083  
3084 # given, when
3085  
3086 # P.225 The given Statement
3087 # in Chapter 15: Smart Matching and given-when
3088 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
3089  
3090 # P.133 The given Statement
3091 # in Chapter 4: Statements and Declarations
3092 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
3093  
3094 elsif (/\G ( (?: if | elsif | unless | while | until | given | when ) (?>\s*) \( ) /oxgc) {
3095 1644 $slash = 'm//';
3096 1644 return $1;
3097 }
3098  
3099 # scalar variable ($scalar = ...) =~ tr///;
3100 # scalar variable ($scalar = ...) =~ s///;
3101  
3102 # state
3103  
3104 # P.68 Persistent, Private Variables
3105 # in Chapter 4: Subroutines
3106 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
3107  
3108 # P.160 Persistent Lexically Scoped Variables: state
3109 # in Chapter 4: Statements and Declarations
3110 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
3111  
3112 # (and so on)
3113  
3114 elsif (/\G ( \( (?>\s*) (?: local \b | my \b | our \b | state \b )? (?>\s*) \$ $qq_scalar ) /oxgc) {
3115 90 my $e_string = e_string($1);
3116  
3117 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
3118 0 $tr_variable = $e_string . e_string($1);
3119 0 $bind_operator = $2;
3120 0 $slash = 'm//';
3121 0 return '';
3122 }
3123 elsif (/\G ( (?>\s*) = $qq_paren \) ) ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /oxgc) {
3124 0 $sub_variable = $e_string . e_string($1);
3125 0 $bind_operator = $2;
3126 0 $slash = 'm//';
3127 0 return '';
3128 }
3129 else {
3130 90 $slash = 'div';
3131 90 return $e_string;
3132 }
3133 }
3134  
3135 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Ewindows1254::PREMATCH()
3136 elsif (/\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /oxmsgc) {
3137 4 $slash = 'div';
3138 4 return q{Ewindows1254::PREMATCH()};
3139 }
3140  
3141 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Ewindows1254::MATCH()
3142 elsif (/\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /oxmsgc) {
3143 28 $slash = 'div';
3144 28 return q{Ewindows1254::MATCH()};
3145 }
3146  
3147 # $', ${'} --> $', ${'}
3148 elsif (/\G ( \$' | \$\{'\} ) /oxmsgc) {
3149 1 $slash = 'div';
3150 1 return $1;
3151 }
3152  
3153 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Ewindows1254::POSTMATCH()
3154 elsif (/\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /oxmsgc) {
3155 3 $slash = 'div';
3156 3 return q{Ewindows1254::POSTMATCH()};
3157 }
3158  
3159 # scalar variable $scalar =~ tr///;
3160 # scalar variable $scalar =~ s///;
3161 # substr() =~ tr///;
3162 # substr() =~ s///;
3163 elsif (/\G ( \$ $qq_scalar | $qq_substr ) /oxgc) {
3164 1754 my $scalar = e_string($1);
3165  
3166 1754 ▶ if (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= (?: tr | y ) \b ) /oxgc) {
Branch: 2 branches
BranchTrueFalseTotal
if (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= (?: tr | y ) \b ) /cgox) { } 2 1752 1754
elsif (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /cgox) { } 65 1687 1752
3167 2 $tr_variable = $scalar;
3168 2 $bind_operator = $1;
3169 2 $slash = 'm//';
3170 2 return '';
3171 }
3172 elsif (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /oxgc) {
3173 65 $sub_variable = $scalar;
3174 65 $bind_operator = $1;
3175 65 $slash = 'm//';
3176 65 return '';
3177 }
3178 else {
3179 1687 $slash = 'div';
3180 1687 return $scalar;
3181 }
3182 }
3183  
3184 # end of statement
3185 elsif (/\G ( [,;] ) /oxgc) {
3186 5063 $slash = 'm//';
3187  
3188 # clear tr/// variable
3189 5063 $tr_variable = '';
3190  
3191 # clear s/// variable
3192 5063 $sub_variable = '';
3193  
3194 5063 $bind_operator = '';
3195  
3196 5063 return $1;
3197 }
3198  
3199 # bareword
3200 elsif (/\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /oxmsgc) {
3201 0 return $1;
3202 }
3203  
3204 # $0 --> $0
3205 elsif (/\G ( \$ 0 ) /oxmsgc) {
3206 2 $slash = 'div';
3207 2 return $1;
3208 }
3209 elsif (/\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /oxmsgc) {
3210 0 $slash = 'div';
3211 0 return $1;
3212 }
3213  
3214 # $$ --> $$
3215 elsif (/\G ( \$ \$ ) (?![\w\{]) /oxmsgc) {
3216 1 $slash = 'div';
3217 1 return $1;
3218 }
3219  
3220 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
3221 # $1, $2, $3 --> $1, $2, $3 otherwise
3222 elsif (/\G \$ ((?>[1-9][0-9]*)) /oxmsgc) {
3223 4 $slash = 'div';
3224 4 return e_capture($1);
3225 }
3226 elsif (/\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /oxmsgc) {
3227 0 $slash = 'div';
3228 0 return e_capture($1);
3229 }
3230  
3231 # $$foo[ ... ] --> $ $foo->[ ... ]
3232 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /oxmsgc) {
3233 0 $slash = 'div';
3234 0 return e_capture($1.'->'.$2);
3235 }
3236  
3237 # $$foo{ ... } --> $ $foo->{ ... }
3238 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /oxmsgc) {
3239 0 $slash = 'div';
3240 0 return e_capture($1.'->'.$2);
3241 }
3242  
3243 # $$foo
3244 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /oxmsgc) {
3245 0 $slash = 'div';
3246 0 return e_capture($1);
3247 }
3248  
3249 # ${ foo }
3250 elsif (/\G \$ (?>\s*) \{ ( (?>\s*) (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* ) (?>\s*) ) \} /oxmsgc) {
3251 0 $slash = 'div';
3252 0 return '${' . $1 . '}';
3253 }
3254  
3255 # ${ ... }
3256 elsif (/\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /oxmsgc) {
3257 0 $slash = 'div';
3258 0 return e_capture($1);
3259 }
3260  
3261 # variable or function
3262 # $ @ % & * $ #
3263 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) {
3264 42 $slash = 'div';
3265 42 return $1;
3266 }
3267 # $ $ $ $ $ $ $ $ $ $ $ $ $ $
3268 # $ @ # \ ' " / ? ( ) [ ] < >
3269 elsif (/\G ( \$[\$\@\#\\\'\"\/\?\(\)\[\]\<\>] ) /oxmsgc) {
3270 63 $slash = 'div';
3271 63 return $1;
3272 }
3273  
3274 # while (<FILEHANDLE>)
3275 elsif (/\G \b (while (?>\s*) \( (?>\s*) <[\$]?[A-Za-z_][A-Za-z_0-9]*> (?>\s*) \)) \b /oxgc) {
3276 0 return $1;
3277 }
3278  
3279 # while (<WILDCARD>) --- glob
3280  
3281 # avoid "Error: Runtime exception" of perl version 5.005_03
3282  
3283 elsif (/\G \b while (?>\s*) \( (?>\s*) < ((?:[^>\0\a\e\f\n\r\t])+?) > (?>\s*) \) \b /oxgc) {
3284 0 return 'while ($_ = Ewindows1254::glob("' . $1 . '"))';
3285 }
3286  
3287 # while (glob)
3288 elsif (/\G \b while (?>\s*) \( (?>\s*) glob (?>\s*) \) /oxgc) {
3289 0 return 'while ($_ = Ewindows1254::glob_)';
3290 }
3291  
3292 # while (glob(WILDCARD))
3293 elsif (/\G \b while (?>\s*) \( (?>\s*) glob \b /oxgc) {
3294 0 return 'while ($_ = Ewindows1254::glob';
3295 }
3296  
3297 # doit if, doit unless, doit while, doit until, doit for, doit when
3298 251 elsif (/\G \b ( if | unless | while | until | for | when ) \b /oxgc) { $slash = 'm//'; return $1; }
3299  
3300 # subroutines of package Ewindows1254
3301 19 elsif (/\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /oxgc) { $slash = 'm//'; return $1; }
3302 0 elsif (/\G \b Char::eval (?= (?>\s*) \{ ) /oxgc) { $slash = 'm//'; return 'eval'; }
3303 22 elsif (/\G \b Windows1254::eval (?= (?>\s*) \{ ) /oxgc) { $slash = 'm//'; return 'eval'; }
3304 0 elsif (/\G \b Char::eval \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'eval Char::escape'; }
3305 168 elsif (/\G \b Windows1254::eval \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'eval Windows1254::escape'; }
3306 2 elsif (/\G \b bytes::substr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'substr'; }
3307 0 elsif (/\G \b chop \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ewindows1254::chop'; }
3308 2 elsif (/\G \b bytes::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'index'; }
3309 0 elsif (/\G \b Char::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Char::index'; }
3310 0 elsif (/\G \b Windows1254::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Windows1254::index'; }
3311 0 elsif (/\G \b index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ewindows1254::index'; }
3312 2 elsif (/\G \b bytes::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'rindex'; }
3313 0 elsif (/\G \b Char::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Char::rindex'; }
3314 0 elsif (/\G \b Windows1254::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Windows1254::rindex'; }
3315 0 elsif (/\G \b rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ewindows1254::rindex'; }
3316 1 elsif (/\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Ewindows1254::lc'; }
3317 0 elsif (/\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Ewindows1254::lcfirst'; }
3318 1 elsif (/\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Ewindows1254::uc'; }
3319 0 elsif (/\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Ewindows1254::ucfirst'; }
3320 6 elsif (/\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Ewindows1254::fc'; }
3321  
3322 # "-s '' ..." means file test "-s 'filename' ..." (not means "- s/// ...")
3323 0 elsif (/\G -s (?>\s*) (\") ((?:$qq_char)+?) (\") /oxgc) { $slash = 'm//'; return '-s ' . e_qq('', $1,$3,$2); }
3324 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\#) ((?:$qq_char)+?) (\#) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3325 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3326 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3327 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3328 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3329 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\S) ((?:$qq_char)+?) (\1) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3330  
3331 0 elsif (/\G -s (?>\s*) (\') ((?:\\\'|\\\\|$q_char)+?) (\') /oxgc) { $slash = 'm//'; return '-s ' . e_q ('', $1,$3,$2); }
3332 0 elsif (/\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$q_char)+?) (\#) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3333 0 elsif (/\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3334 0 elsif (/\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3335 0 elsif (/\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3336 0 elsif (/\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3337 0 elsif (/\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$q_char)+?) (\1) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3338  
3339 elsif (/\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)* ) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ) )*) /oxgc)
3340 0 { $slash = 'm//'; return "-s $1"; }
3341 0 elsif (/\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /oxgc) { $slash = 'm//'; return "-s ($1)"; }
3342 0 elsif (/\G -s (?= (?>\s+) [a-z]+) /oxgc) { $slash = 'm//'; return '-s'; }
3343 0 elsif (/\G -s (?>\s+) ((?>\w+)) /oxgc) { $slash = 'm//'; return "-s $1"; }
3344  
3345 2 elsif (/\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'length'; }
3346 2 elsif (/\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'chr'; }
3347 36 elsif (/\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Ewindows1254::chr'; }
3348 2 elsif (/\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'div'; return 'ord'; }
3349 8 elsif (/\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'div'; return $function_ord; }
3350 0 elsif (/\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Ewindows1254::glob'; }
3351 0 elsif (/\G \b lc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ewindows1254::lc_'; }
3352 0 elsif (/\G \b lcfirst \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ewindows1254::lcfirst_'; }
3353 0 elsif (/\G \b uc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ewindows1254::uc_'; }
3354 0 elsif (/\G \b ucfirst \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ewindows1254::ucfirst_'; }
3355 0 elsif (/\G \b fc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ewindows1254::fc_'; }
3356 0 elsif (/\G -s \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return '-s '; }
3357  
3358 0 elsif (/\G \b bytes::length \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'length'; }
3359 0 elsif (/\G \b bytes::chr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'chr'; }
3360 0 elsif (/\G \b chr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ewindows1254::chr_'; }
3361 0 elsif (/\G \b bytes::ord \b (?! (?>\s*) => ) /oxgc) { $slash = 'div'; return 'ord'; }
3362 0 elsif (/\G \b ord \b (?! (?>\s*) => ) /oxgc) { $slash = 'div'; return $function_ord_; }
3363 0 elsif (/\G \b glob \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ewindows1254::glob_'; }
3364 0 elsif (/\G \b reverse \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return $function_reverse; }
3365 8 elsif (/\G \b getc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return $function_getc; }
3366 # split
3367 elsif (/\G \b (split) \b (?! (?>\s*) => ) /oxgc) {
3368 87 $slash = 'm//';
3369  
3370 87 my $e = '';
3371 87 ▶ while (/\G ( (?>\s+) | \( | \#.* ) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\G ( (?>\s+) | \( | \#.* ) /cgox) 85 87 172
3372 85 $e .= $1;
3373 }
3374  
3375 # end of split
3376 87 ▶ if (/\G (?= [,;\)\}\]] ) /oxgc) { return 'Ewindows1254::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
3377  
3378 # split scalar value
3379 1 elsif (/\G ( [\$\@\&\*] $qq_scalar ) /oxgc) { return 'Ewindows1254::split' . $e . e_string($1); }
3380  
3381 # split literal space
3382 0 elsif (/\G \b qq (\#) [ ] (\#) /oxgc) { return 'Ewindows1254::split' . $e . qq {qq$1 $2}; }
3383 0 elsif (/\G \b qq ((?>\s*)) (\() [ ] (\)) /oxgc) { return 'Ewindows1254::split' . $e . qq{$1qq$2 $3}; }
3384 0 elsif (/\G \b qq ((?>\s*)) (\{) [ ] (\}) /oxgc) { return 'Ewindows1254::split' . $e . qq{$1qq$2 $3}; }
3385 0 elsif (/\G \b qq ((?>\s*)) (\[) [ ] (\]) /oxgc) { return 'Ewindows1254::split' . $e . qq{$1qq$2 $3}; }
3386 0 elsif (/\G \b qq ((?>\s*)) (\<) [ ] (\>) /oxgc) { return 'Ewindows1254::split' . $e . qq{$1qq$2 $3}; }
3387 0 elsif (/\G \b qq ((?>\s*)) (\S) [ ] (\2) /oxgc) { return 'Ewindows1254::split' . $e . qq{$1qq$2 $3}; }
3388 0 elsif (/\G \b q (\#) [ ] (\#) /oxgc) { return 'Ewindows1254::split' . $e . qq {q$1 $2}; }
3389 0 elsif (/\G \b q ((?>\s*)) (\() [ ] (\)) /oxgc) { return 'Ewindows1254::split' . $e . qq {$1q$2 $3}; }
3390 0 elsif (/\G \b q ((?>\s*)) (\{) [ ] (\}) /oxgc) { return 'Ewindows1254::split' . $e . qq {$1q$2 $3}; }
3391 0 elsif (/\G \b q ((?>\s*)) (\[) [ ] (\]) /oxgc) { return 'Ewindows1254::split' . $e . qq {$1q$2 $3}; }
3392 0 elsif (/\G \b q ((?>\s*)) (\<) [ ] (\>) /oxgc) { return 'Ewindows1254::split' . $e . qq {$1q$2 $3}; }
3393 0 elsif (/\G \b q ((?>\s*)) (\S) [ ] (\2) /oxgc) { return 'Ewindows1254::split' . $e . qq {$1q$2 $3}; }
3394 10 elsif (/\G ' [ ] ' /oxgc) { return 'Ewindows1254::split' . $e . qq {' '}; }
3395 0 elsif (/\G " [ ] " /oxgc) { return 'Ewindows1254::split' . $e . qq {" "}; }
3396  
3397 # split qq//
3398 elsif (/\G \b (qq) \b /oxgc) {
3399 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Ewindows1254::qq_char)*?) (\#) /cgox) { } 0 0 0
3400 else {
3401 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3402 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 ([*\-:?\\^|]) ((?:$Ewindows1254::qq_char)*?) (\1) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Ewindows1254::qq_char)*?) (\1) /cgox) { } 0 0 0
3403 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq ( ) --> qr ( )
3404 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq { } --> qr { }
3405 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq [ ] --> qr [ ]
3406 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq < > --> qr < >
3407 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) /oxgc) { return e_split($e.'qr','{','}',$2,''); } # qq | | --> qr { }
3408 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq * * --> qr * *
3409 }
3410 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3411 }
3412 }
3413  
3414 # split qr//
3415 elsif (/\G \b (qr) \b /oxgc) {
3416 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1,$3,$2,$4); } # qr# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Ewindows1254::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 12 12
3417 else {
3418 12 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 12 0 12
3419 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 (\') ((?:$Ewindows1254::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 12 12
elsif (/\G ([*\-:?\\^|]) ((?:$Ewindows1254::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 12 12
elsif (/\G (\S) ((?:$Ewindows1254::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 12 0 12
3420 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr ( )
3421 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr { }
3422 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr [ ]
3423 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr < >
3424 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { return e_split_q($e.'qr',$1, $3, $2,$4); } # qr ' '
3425 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr','{','}',$2,$4); } # qr | | --> qr { }
3426 12 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr * *
3427 }
3428 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3429 }
3430 }
3431  
3432 # split q//
3433 elsif (/\G \b (q) \b /oxgc) {
3434 0 ▶ if (/\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:\\\#|\\\\|$Ewindows1254::q_char)*?) (\#) /cgox) { } 0 0 0
3435 else {
3436 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3437 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 ([*\-:?\\^|]) ((?:$Ewindows1254::q_char)*?) (\1) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:\\\\|\\\1| $Ewindows1254::q_char)*?) (\1) /cgox) { } 0 0 0
3438 0 elsif (/\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q ( ) --> qr ( )
3439 0 elsif (/\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q { } --> qr { }
3440 0 elsif (/\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q [ ] --> qr [ ]
3441 0 elsif (/\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q < > --> qr < >
3442 0 elsif (/\G ([*\-:?\\^|]) ((?:$q_char)*?) (\1) /oxgc) { return e_split_q($e.'qr','{','}',$2,''); } # q | | --> qr { }
3443 0 elsif (/\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q * * --> qr * *
3444 }
3445 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3446 }
3447 }
3448  
3449 # split m//
3450 elsif (/\G \b (m) \b /oxgc) {
3451 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1,$3,$2,$4); } # m# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Ewindows1254::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
3452 else {
3453 18 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 18 0 18
3454 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 (\') ((?:$Ewindows1254::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
elsif (/\G ([*\-:?\\^|]) ((?:$Ewindows1254::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
elsif (/\G (\S) ((?:$Ewindows1254::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 18 0 18
3455 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m ( ) --> qr ( )
3456 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m { } --> qr { }
3457 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m [ ] --> qr [ ]
3458 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m < > --> qr < >
3459 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { return e_split_q($e.'qr',$1, $3, $2,$4); } # m ' ' --> qr ' '
3460 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr','{','}',$2,$4); } # m | | --> qr { }
3461 18 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m * * --> qr * *
3462 }
3463 0 die __FILE__, ": Search pattern not terminated\n";
3464 }
3465 }
3466  
3467 # split ''
3468 elsif (/\G (\') /oxgc) {
3469 0 my $q_string = '';
3470 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3471 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 ($Ewindows1254::q_char) /cgox) { } 0 0 0
3472 0 elsif (/\G (\\\') /oxgc) { $q_string .= $1; } # splitqr'' --> split qr''
3473 0 elsif (/\G \' /oxgc) { return e_split_q($e.q{ qr},"'","'",$q_string,''); } # ' ' --> qr ' '
3474 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3475 }
3476 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3477 }
3478  
3479 # split ""
3480 elsif (/\G (\") /oxgc) {
3481 0 my $qq_string = '';
3482 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3483 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 ($Ewindows1254::q_char) /cgox) { } 0 0 0
3484 0 elsif (/\G (\\\") /oxgc) { $qq_string .= $1; } # splitqr"" --> split qr""
3485 0 elsif (/\G \" /oxgc) { return e_split($e.q{ qr},'"','"',$qq_string,''); } # " " --> qr " "
3486 0 elsif (/\G ($q_char) /oxgc) { $qq_string .= $1; }
3487 }
3488 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3489 }
3490  
3491 # split //
3492 elsif (/\G (\/) /oxgc) {
3493 44 my $regexp = '';
3494 44 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 381 0 381
3495 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 ($Ewindows1254::q_char) /cgox) { } 337 0 337
3496 0 elsif (/\G (\\\/) /oxgc) { $regexp .= $1; } # splitqr// --> split qr//
3497 44 elsif (/\G \/ ([cgimosxpadlunbB]*) /oxgc) { return e_split($e.q{ qr}, '/','/',$regexp,$1); } # / / --> qr / /
3498 337 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
3499 }
3500 0 die __FILE__, ": Search pattern not terminated\n";
3501 }
3502 }
3503  
3504 # tr/// or y///
3505  
3506 # about [cdsrbB]* (/B modifier)
3507 #
3508 # P.559 appendix C
3509 # of ISBN 4-89052-384-7 Programming perl
3510 # (Japanese title is: Perl puroguramingu)
3511  
3512 elsif (/\G \b ( tr | y ) \b /oxgc) {
3513 4 my $ope = $1;
3514  
3515 # $1 $2 $3 $4 $5 $6
3516 4 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ((?:$qq_char)*?) (\#) ([cdsrbB]*) /oxgc) { # tr# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Ewindows1254::qq_char)*?) (\#) ((?:$Ewindows1254::qq_char)*?) (\#) ([cdsrbB]*) /cgox) { } 0 4 4
3517 0 my @tr = ($tr_variable,$2);
3518 0 return e_tr(@tr,'',$4,$6);
3519 }
3520 else {
3521 4 my $e = '';
3522 4 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 4 0 4
3523 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) ((?:$Ewindows1254::qq_char)*?) (\1) ((?:$Ewindows1254::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 4 0 4
3524 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) {
3525 0 my @tr = ($tr_variable,$2);
3526 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3527 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) ((?:$Ewindows1254::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3528 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) ( )
3529 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) { }
3530 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) [ ]
3531 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) < >
3532 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) * *
3533 }
3534 0 die __FILE__, ": Transliteration replacement not terminated\n";
3535 }
3536 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) {
3537 0 my @tr = ($tr_variable,$2);
3538 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3539 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) ((?:$Ewindows1254::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3540 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } ( )
3541 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } { }
3542 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } [ ]
3543 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } < >
3544 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } * *
3545 }
3546 0 die __FILE__, ": Transliteration replacement not terminated\n";
3547 }
3548 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) {
3549 0 my @tr = ($tr_variable,$2);
3550 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3551 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) ((?:$Ewindows1254::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3552 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] ( )
3553 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] { }
3554 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] [ ]
3555 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] < >
3556 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] * *
3557 }
3558 0 die __FILE__, ": Transliteration replacement not terminated\n";
3559 }
3560 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) {
3561 0 my @tr = ($tr_variable,$2);
3562 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3563 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) ((?:$Ewindows1254::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3564 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > ( )
3565 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > { }
3566 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > [ ]
3567 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > < >
3568 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > * *
3569 }
3570 0 die __FILE__, ": Transliteration replacement not terminated\n";
3571 }
3572 # $1 $2 $3 $4 $5 $6
3573 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { # tr * * *
3574 4 my @tr = ($tr_variable,$2);
3575 4 return e_tr(@tr,'',$4,$6);
3576 }
3577 }
3578 0 die __FILE__, ": Transliteration pattern not terminated\n";
3579 }
3580 }
3581  
3582 # qq//
3583 elsif (/\G \b (qq) \b /oxgc) {
3584 2252 my $ope = $1;
3585  
3586 # if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { return e_qq($ope,$1,$3,$2); } # qq# #
3587 2252 ▶ if (/\G (\#) /oxgc) { # qq# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) /cgox) { } 0 2252 2252
3588 0 my $qq_string = '';
3589 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3590 0 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 0 0
elsif (/\G (\\\#) /cgox) { } 0 0 0
elsif (/\G (\#) /cgox) { } 0 0 0
elsif (/\G ($Ewindows1254::qq_char) /cgox) { } 0 0 0
3591 0 elsif (/\G (\\\#) /oxgc) { $qq_string .= $1; }
3592 0 elsif (/\G (\#) /oxgc) { return e_qq($ope,'#','#',$qq_string); }
3593 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3594 }
3595 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3596 }
3597  
3598 else {
3599 2252 my $e = '';
3600 2252 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 2252 0 2252
3601 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
3602  
3603 # elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq ( )
3604 elsif (/\G (\() /oxgc) { # qq ( )
3605 0 my $qq_string = '';
3606 0 local $nest = 1;
3607 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3608 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 ($Ewindows1254::qq_char) /cgox) { } 0 0 0
3609 0 elsif (/\G (\\\)) /oxgc) { $qq_string .= $1; }
3610 0 elsif (/\G (\() /oxgc) { $qq_string .= $1; $nest++; }
3611 elsif (/\G (\)) /oxgc) {
3612 0 ▶ if (--$nest == 0) { return $e . e_qq($ope,'(',')',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ewindows1254::nest == 0) { } 0 0 0
3613 0 else { $qq_string .= $1; }
3614 }
3615 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3616 }
3617 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3618 }
3619  
3620 # elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq { }
3621 elsif (/\G (\{) /oxgc) { # qq { }
3622 2222 my $qq_string = '';
3623 2222 local $nest = 1;
3624 2222 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 85169 0 85169
3625 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 ($Ewindows1254::qq_char) /cgox) { } 79847 0 79847
3626 0 elsif (/\G (\\\}) /oxgc) { $qq_string .= $1; }
3627 1189 elsif (/\G (\{) /oxgc) { $qq_string .= $1; $nest++; }
3628 elsif (/\G (\}) /oxgc) {
3629 3411 ▶ if (--$nest == 0) { return $e . e_qq($ope,'{','}',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ewindows1254::nest == 0) { } 2222 1189 3411
3630 1189 else { $qq_string .= $1; }
3631 }
3632 79847 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3633 }
3634 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3635 }
3636  
3637 # elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq [ ]
3638 elsif (/\G (\[) /oxgc) { # qq [ ]
3639 0 my $qq_string = '';
3640 0 local $nest = 1;
3641 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3642 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 ($Ewindows1254::qq_char) /cgox) { } 0 0 0
3643 0 elsif (/\G (\\\]) /oxgc) { $qq_string .= $1; }
3644 0 elsif (/\G (\[) /oxgc) { $qq_string .= $1; $nest++; }
3645 elsif (/\G (\]) /oxgc) {
3646 0 ▶ if (--$nest == 0) { return $e . e_qq($ope,'[',']',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ewindows1254::nest == 0) { } 0 0 0
3647 0 else { $qq_string .= $1; }
3648 }
3649 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3650 }
3651 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3652 }
3653  
3654 # elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq < >
3655 elsif (/\G (\<) /oxgc) { # qq < >
3656 30 my $qq_string = '';
3657 30 local $nest = 1;
3658 30 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 1166 0 1166
3659 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 ($Ewindows1254::qq_char) /cgox) { } 1114 0 1114
3660 0 elsif (/\G (\\\>) /oxgc) { $qq_string .= $1; }
3661 0 elsif (/\G (\<) /oxgc) { $qq_string .= $1; $nest++; }
3662 elsif (/\G (\>) /oxgc) {
3663 30 ▶ if (--$nest == 0) { return $e . e_qq($ope,'<','>',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ewindows1254::nest == 0) { } 30 0 30
3664 0 else { $qq_string .= $1; }
3665 }
3666 1114 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3667 }
3668 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3669 }
3670  
3671 # elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq * *
3672 elsif (/\G (\S) /oxgc) { # qq * *
3673 0 my $delimiter = $1;
3674 0 my $qq_string = '';
3675 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3676 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 ($Ewindows1254::qq_char) /cgox) { } 0 0 0
3677 0 elsif (/\G (\\\Q$delimiter\E) /oxgc) { $qq_string .= $1; }
3678 0 elsif (/\G (\Q$delimiter\E) /oxgc) { return $e . e_qq($ope,$delimiter,$delimiter,$qq_string); }
3679 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3680 }
3681 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3682 }
3683 }
3684 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3685 }
3686 }
3687  
3688 # qr//
3689 elsif (/\G \b (qr) \b /oxgc) {
3690 0 my $ope = $1;
3691 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { # qr# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Ewindows1254::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 0 0
3692 0 return e_qr($ope,$1,$3,$2,$4);
3693 }
3694 else {
3695 0 my $e = '';
3696 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3697 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 (\') ((?:$Ewindows1254::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G ([*\-:?\\^|]) ((?:$Ewindows1254::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Ewindows1254::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
3698 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr ( )
3699 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr { }
3700 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr [ ]
3701 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr < >
3702 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { return $e . e_qr_q($ope,$1, $3, $2,$4); } # qr ' '
3703 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,'{','}',$2,$4); } # qr | | --> qr { }
3704 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr * *
3705 }
3706 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3707 }
3708 }
3709  
3710 # qw//
3711 elsif (/\G \b (qw) \b /oxgc) {
3712 16 my $ope = $1;
3713 16 ▶ if (/\G (\#) (.*?) (\#) /oxmsgc) { # qw# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) (.*?) (\#) /cgmosx) { } 0 16 16
3714 0 return e_qw($ope,$1,$3,$2);
3715 }
3716 else {
3717 16 my $e = '';
3718 16 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 16 0 16
3719 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) ((?:$Ewindows1254::q_char)*?) (\1) /cgmosx) { } 0 0 0
3720  
3721 16 elsif (/\G (\() ([^(]*?) (\)) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw ( )
3722 0 elsif (/\G (\() ((?:$q_paren)*?) (\)) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw ( )
3723  
3724 0 elsif (/\G (\{) ([^{]*?) (\}) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw { }
3725 0 elsif (/\G (\{) ((?:$q_brace)*?) (\}) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw { }
3726  
3727 0 elsif (/\G (\[) ([^[]*?) (\]) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw [ ]
3728 0 elsif (/\G (\[) ((?:$q_bracket)*?) (\]) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw [ ]
3729  
3730 0 elsif (/\G (\<) ([^<]*?) (\>) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw < >
3731 0 elsif (/\G (\<) ((?:$q_angle)*?) (\>) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw < >
3732  
3733 0 elsif (/\G ([\x21-\x3F]) (.*?) (\1) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw * *
3734 0 elsif (/\G (\S) ((?:$q_char)*?) (\1) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw * *
3735 }
3736 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3737 }
3738 }
3739  
3740 # qx//
3741 elsif (/\G \b (qx) \b /oxgc) {
3742 0 my $ope = $1;
3743 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qx# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Ewindows1254::qq_char)*?) (\#) /cgox) { } 0 0 0
3744 0 return e_qq($ope,$1,$3,$2);
3745 }
3746 else {
3747 0 my $e = '';
3748 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3749 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 (\') ((?:$Ewindows1254::qq_char)*?) (\') /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Ewindows1254::qq_char)*?) (\1) /cgox) { } 0 0 0
3750 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx ( )
3751 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx { }
3752 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx [ ]
3753 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx < >
3754 0 elsif (/\G (\') ((?:$qq_char)*?) (\') /oxgc) { return $e . e_q ($ope,$1,$3,$2); } # qx ' '
3755 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx * *
3756 }
3757 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3758 }
3759 }
3760  
3761 # q//
3762 elsif (/\G \b (q) \b /oxgc) {
3763 473 my $ope = $1;
3764  
3765 # if (/\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { return e_q($ope,$1,$3,$2); } # q# #
3766  
3767 # avoid "Error: Runtime exception" of perl version 5.005_03
3768 # (and so on)
3769  
3770 473 ▶ if (/\G (\#) /oxgc) { # q# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) /cgox) { } 0 473 473
3771 0 my $q_string = '';
3772 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3773 0 ▶ if (/\G (\\\\) /oxgc) { $q_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 0 0
elsif (/\G (\\\#) /cgox) { } 0 0 0
elsif (/\G (\#) /cgox) { } 0 0 0
elsif (/\G ($Ewindows1254::q_char) /cgox) { } 0 0 0
3774 0 elsif (/\G (\\\#) /oxgc) { $q_string .= $1; }
3775 0 elsif (/\G (\#) /oxgc) { return e_q($ope,'#','#',$q_string); }
3776 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3777 }
3778 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3779 }
3780  
3781 else {
3782 473 my $e = '';
3783 473 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 473 0 473
3784 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
3785  
3786 # elsif (/\G (\() ((?:\\\)|\\\\|$q_paren)*?) (\)) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q ( )
3787 elsif (/\G (\() /oxgc) { # q ( )
3788 0 my $q_string = '';
3789 0 local $nest = 1;
3790 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3791 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 ($Ewindows1254::q_char) /cgox) { } 0 0 0
3792 0 elsif (/\G (\\\)) /oxgc) { $q_string .= $1; }
3793 0 elsif (/\G (\\\() /oxgc) { $q_string .= $1; }
3794 0 elsif (/\G (\() /oxgc) { $q_string .= $1; $nest++; }
3795 elsif (/\G (\)) /oxgc) {
3796 0 ▶ if (--$nest == 0) { return $e . e_q($ope,'(',')',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ewindows1254::nest == 0) { } 0 0 0
3797 0 else { $q_string .= $1; }
3798 }
3799 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3800 }
3801 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3802 }
3803  
3804 # elsif (/\G (\{) ((?:\\\}|\\\\|$q_brace)*?) (\}) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q { }
3805 elsif (/\G (\{) /oxgc) { # q { }
3806 467 my $q_string = '';
3807 467 local $nest = 1;
3808 467 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 8314 0 8314
3809 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 ($Ewindows1254::q_char) /cgox) { } 7529 0 7529
3810 0 elsif (/\G (\\\}) /oxgc) { $q_string .= $1; }
3811 0 elsif (/\G (\\\{) /oxgc) { $q_string .= $1; }
3812 159 elsif (/\G (\{) /oxgc) { $q_string .= $1; $nest++; }
3813 elsif (/\G (\}) /oxgc) {
3814 626 ▶ if (--$nest == 0) { return $e . e_q($ope,'{','}',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ewindows1254::nest == 0) { } 467 159 626
3815 159 else { $q_string .= $1; }
3816 }
3817 7529 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3818 }
3819 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3820 }
3821  
3822 # elsif (/\G (\[) ((?:\\\]|\\\\|$q_bracket)*?) (\]) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q [ ]
3823 elsif (/\G (\[) /oxgc) { # q [ ]
3824 0 my $q_string = '';
3825 0 local $nest = 1;
3826 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3827 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 ($Ewindows1254::q_char) /cgox) { } 0 0 0
3828 0 elsif (/\G (\\\]) /oxgc) { $q_string .= $1; }
3829 0 elsif (/\G (\\\[) /oxgc) { $q_string .= $1; }
3830 0 elsif (/\G (\[) /oxgc) { $q_string .= $1; $nest++; }
3831 elsif (/\G (\]) /oxgc) {
3832 0 ▶ if (--$nest == 0) { return $e . e_q($ope,'[',']',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ewindows1254::nest == 0) { } 0 0 0
3833 0 else { $q_string .= $1; }
3834 }
3835 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3836 }
3837 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3838 }
3839  
3840 # elsif (/\G (\<) ((?:\\\>|\\\\|$q_angle)*?) (\>) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q < >
3841 elsif (/\G (\<) /oxgc) { # q < >
3842 5 my $q_string = '';
3843 5 local $nest = 1;
3844 5 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 88 0 88
3845 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 ($Ewindows1254::q_char) /cgox) { } 83 0 83
3846 0 elsif (/\G (\\\>) /oxgc) { $q_string .= $1; }
3847 0 elsif (/\G (\\\<) /oxgc) { $q_string .= $1; }
3848 0 elsif (/\G (\<) /oxgc) { $q_string .= $1; $nest++; }
3849 elsif (/\G (\>) /oxgc) {
3850 5 ▶ if (--$nest == 0) { return $e . e_q($ope,'<','>',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ewindows1254::nest == 0) { } 5 0 5
3851 0 else { $q_string .= $1; }
3852 }
3853 83 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3854 }
3855 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3856 }
3857  
3858 # elsif (/\G (\S) ((?:\\\1|\\\\|$q_char)*?) (\1) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q * *
3859 elsif (/\G (\S) /oxgc) { # q * *
3860 1 my $delimiter = $1;
3861 1 my $q_string = '';
3862 1 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 14 0 14
3863 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 ($Ewindows1254::q_char) /cgox) { } 13 0 13
3864 0 elsif (/\G (\\\Q$delimiter\E) /oxgc) { $q_string .= $1; }
3865 1 elsif (/\G (\Q$delimiter\E) /oxgc) { return $e . e_q($ope,$delimiter,$delimiter,$q_string); }
3866 13 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3867 }
3868 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3869 }
3870 }
3871 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3872 }
3873 }
3874  
3875 # m//
3876 elsif (/\G \b (m) \b /oxgc) {
3877 209 my $ope = $1;
3878 209 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { # m# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Ewindows1254::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
3879 0 return e_qr($ope,$1,$3,$2,$4);
3880 }
3881 else {
3882 209 my $e = '';
3883 209 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 209 0 209
3884 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 (\?) ((?:$Ewindows1254::qq_char)*?) (\?) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
elsif (/\G (\') ((?:$Ewindows1254::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 10 199 209
elsif (/\G ([*\-:\\^|]) ((?:$Ewindows1254::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 199 199
elsif (/\G (\S) ((?:$Ewindows1254::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 199 0 199
3885 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m ( )
3886 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m { }
3887 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m [ ]
3888 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m < >
3889 0 elsif (/\G (\?) ((?:$qq_char)*?) (\?) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m ? ?
3890 10 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr_q($ope,$1, $3, $2,$4); } # m ' '
3891 0 elsif (/\G ([*\-:\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,'{','}',$2,$4); } # m | | --> m { }
3892 199 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m * *
3893 }
3894 0 die __FILE__, ": Search pattern not terminated\n";
3895 }
3896 }
3897  
3898 # s///
3899  
3900 # about [cegimosxpradlunbB]* (/cg modifier)
3901 #
3902 # P.67 Pattern-Matching Operators
3903 # of ISBN 0-596-00241-6 Perl in a Nutshell, Second Edition.
3904  
3905 elsif (/\G \b (s) \b /oxgc) {
3906 101 my $ope = $1;
3907  
3908 # $1 $2 $3 $4 $5 $6
3909 101 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ((?:$qq_char)*?) (\#) ([cegimosxpradlunbB]*) /oxgc) { # s# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Ewindows1254::qq_char)*?) (\#) ((?:$Ewindows1254::qq_char)*?) (\#) ([cegimosxpradlunbB]*) /cgox) { } 1 100 101
3910 1 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3911 }
3912 else {
3913 100 my $e = '';
3914 100 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 100 0 100
3915 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 (\') ((?:$Ewindows1254::qq_char)*?) (\') ((?:$Ewindows1254::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 21 79 100
elsif (/\G ([*\-:?\\^|]) ((?:$Ewindows1254::qq_char)*?) (\1) ((?:$Ewindows1254::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 79 79
elsif (/\G (\$) ((?:$Ewindows1254::qq_char)*?) (\1) ((?:$Ewindows1254::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 79 79
elsif (/\G (\S) ((?:$Ewindows1254::qq_char)*?) (\1) ((?:$Ewindows1254::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 79 0 79
3916 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) {
3917 0 my @s = ($1,$2,$3);
3918 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3919 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 (\') ((?:$Ewindows1254::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Ewindows1254::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Ewindows1254::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Ewindows1254::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Ewindows1254::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3920 # $1 $2 $3 $4
3921 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3922 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3923 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3924 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3925 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3926 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3927 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3928 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3929 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3930 }
3931 0 die __FILE__, ": Substitution replacement not terminated\n";
3932 }
3933 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) {
3934 0 my @s = ($1,$2,$3);
3935 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3936 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 (\') ((?:$Ewindows1254::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Ewindows1254::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Ewindows1254::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Ewindows1254::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Ewindows1254::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3937 # $1 $2 $3 $4
3938 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3939 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3940 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3941 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3942 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3943 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3944 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3945 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3946 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3947 }
3948 0 die __FILE__, ": Substitution replacement not terminated\n";
3949 }
3950 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) {
3951 0 my @s = ($1,$2,$3);
3952 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3953 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 (\') ((?:$Ewindows1254::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Ewindows1254::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Ewindows1254::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3954 # $1 $2 $3 $4
3955 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3956 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3957 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3958 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3959 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3960 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3961 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3962 }
3963 0 die __FILE__, ": Substitution replacement not terminated\n";
3964 }
3965 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) {
3966 0 my @s = ($1,$2,$3);
3967 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3968 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 (\') ((?:$Ewindows1254::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Ewindows1254::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Ewindows1254::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Ewindows1254::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Ewindows1254::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3969 # $1 $2 $3 $4
3970 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3971 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3972 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3973 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3974 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3975 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3976 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3977 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3978 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3979 }
3980 0 die __FILE__, ": Substitution replacement not terminated\n";
3981 }
3982 # $1 $2 $3 $4 $5 $6
3983 elsif (/\G (\') ((?:$qq_char)*?) (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) {
3984 21 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3985 }
3986 # $1 $2 $3 $4 $5 $6
3987 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
3988 0 return e_sub($sub_variable,'{',$2,'}','{',$4,'}',$6); # s | | | --> s { } { }
3989 }
3990 # $1 $2 $3 $4 $5 $6
3991 elsif (/\G (\$) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
3992 0 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3993 }
3994 # $1 $2 $3 $4 $5 $6
3995 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
3996 79 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3997 }
3998 }
3999 0 die __FILE__, ": Substitution pattern not terminated\n";
4000 }
4001 }
4002  
4003 # require ignore module
4004 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# require$1$2"; }
4005 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# require$1\n$2"; }
4006 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# require$1"; }
4007  
4008 # use strict; --> use strict; no strict qw(refs);
4009 37 elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "use$1 no strict qw(refs);$2"; }
4010 0 elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [^#]) /oxmsgc) { return "use$1 no strict qw(refs);\n$2"; }
4011 0 elsif (/\G \b use ((?>\s+) strict) \b /oxmsgc) { return "use$1; no strict qw(refs)"; }
4012  
4013 # use 5.12.0; --> use 5.12.0; no strict qw(refs);
4014 elsif (/\G \b use (?>\s+) ((?>([1-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /oxmsgc) {
4015 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
4016 0 return "use $1; no strict qw(refs);";
4017 }
4018 else {
4019 2 return "use $1;";
4020 }
4021 }
4022 elsif (/\G \b use (?>\s+) ((?>v([0-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /oxmsgc) {
4023 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
4024 0 return "use $1; no strict qw(refs);";
4025 }
4026 else {
4027 0 return "use $1;";
4028 }
4029 }
4030  
4031 # ignore use module
4032 2 elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# use$1$2"; }
4033 0 elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# use$1\n$2"; }
4034 0 elsif (/\G \b use ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# use$1"; }
4035  
4036 # ignore no module
4037 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# no$1$2"; }
4038 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# no$1\n$2"; }
4039 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# no$1"; }
4040  
4041 # use else
4042 0 elsif (/\G \b use \b /oxmsgc) { return "use"; }
4043  
4044 # use else
4045 2 elsif (/\G \b no \b /oxmsgc) { return "no"; }
4046  
4047 # ''
4048 elsif (/\G (?<![\w\$\@\%\&\*]) (\') /oxgc) {
4049 1142 my $q_string = '';
4050 1142 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 10240 0 10240
4051 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 ($Ewindows1254::q_char) /cgox) { } 9046 0 9046
4052 48 elsif (/\G (\\\') /oxgc) { $q_string .= $1; }
4053 1142 elsif (/\G \' /oxgc) { return e_q('', "'","'",$q_string); }
4054 9046 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
4055 }
4056 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4057 }
4058  
4059 # ""
4060 elsif (/\G (\") /oxgc) {
4061 1873 my $qq_string = '';
4062 1873 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 38014 0 38014
4063 38014 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 67 37947 38014
elsif (/\G (\\\") /cgox) { } 12 37935 37947
elsif (/\G \" /cgox) { } 1873 36062 37935
elsif (/\G ($Ewindows1254::q_char) /cgox) { } 36062 0 36062
4064 12 elsif (/\G (\\\") /oxgc) { $qq_string .= $1; }
4065 1873 elsif (/\G \" /oxgc) { return e_qq('', '"','"',$qq_string); }
4066 36062 elsif (/\G ($q_char) /oxgc) { $qq_string .= $1; }
4067 }
4068 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4069 }
4070  
4071 # ``
4072 elsif (/\G (\`) /oxgc) {
4073 1 my $qx_string = '';
4074 1 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 19 0 19
4075 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 ($Ewindows1254::q_char) /cgox) { } 18 0 18
4076 0 elsif (/\G (\\\`) /oxgc) { $qx_string .= $1; }
4077 1 elsif (/\G \` /oxgc) { return e_qq('', '`','`',$qx_string); }
4078 18 elsif (/\G ($q_char) /oxgc) { $qx_string .= $1; }
4079 }
4080 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4081 }
4082  
4083 # // --- not divide operator (num / num), not defined-or
4084 ▶ elsif (($slash eq 'm//') and /\G (\/) /oxgc) {
Condition100%3/3
$Ewindows1254::slash eq "m//" and m[\G (/) ]cgox
!ll&&!rl&&r
282458848681
MC/DC100%2/2
$Ewindows1254::slash eq "m//" and m[\G (/) ]cgox
$Ewindows1254::slash eq "m//" m[\G (/) ]cgox
Truth table100%3/3
A and B
A= $Ewindows1254::slash eq "m//"B= m[\G (/) ]cgox
ABresult
0X0
100
111
4085 681 my $regexp = '';
4086 681 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 5636 0 5636
4087 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 ($Ewindows1254::q_char) /cgox) { } 4955 0 4955
4088 0 elsif (/\G (\\\/) /oxgc) { $regexp .= $1; }
4089 681 elsif (/\G \/ ([cgimosxpadlunbB]*) /oxgc) { return e_qr('', '/','/',$regexp,$1); }
4090 4955 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
4091 }
4092 0 die __FILE__, ": Search pattern not terminated\n";
4093 }
4094  
4095 # ?? --- not conditional operator (condition ? then : else)
4096 ▶ elsif (($slash eq 'm//') and /\G (\?) /oxgc) {
Condition66%2/3
$Ewindows1254::slash eq "m//" and /\G (\?) /cgox
!ll&&!rl&&r
2824588480
MC/DC0%0/2
$Ewindows1254::slash eq "m//" and /\G (\?) /cgox
$Ewindows1254::slash eq "m//" /\G (\?) /cgox
Truth table66%2/3
A and B
A= $Ewindows1254::slash eq "m//"B= /\G (\?) /cgox
ABresult
0X0
100
111
4097 0 my $regexp = '';
4098 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
4099 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 ($Ewindows1254::q_char) /cgox) { } 0 0 0
4100 0 elsif (/\G (\\\?) /oxgc) { $regexp .= $1; }
4101 0 elsif (/\G \? ([cgimosxpadlunbB]*) /oxgc) { return e_qr('m','?','?',$regexp,$1); }
4102 0 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
4103 }
4104 0 die __FILE__, ": Search pattern not terminated\n";
4105 }
4106  
4107 # <<>> (a safer ARGV)
4108 0 elsif (/\G ( <<>> ) /oxgc) { $slash = 'm//'; return $1; }
4109  
4110 # << (bit shift) --- not here document
4111 0 elsif (/\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /oxgc) { $slash = 'm//'; return $1; }
4112  
4113 # <<~'HEREDOC'
4114 elsif (/\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /oxgc) {
4115 6 $slash = 'm//';
4116 6 my $here_quote = $1;
4117 6 my $delimiter = $2;
4118  
4119 # get here document
4120 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4121 6 $here_script = CORE::substr $_, pos $_;
4122 6 $here_script =~ s/.*?\n//oxm;
4123 }
4124 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
4125 6 my $heredoc = $1;
4126 6 my $indent = $2;
4127 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4128 6 push @heredoc, $heredoc . qq{\n$delimiter\n};
4129 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4130 }
4131 else {
4132 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4133 }
4134 6 return qq{<<'$delimiter'};
4135 }
4136  
4137 # <<~\HEREDOC
4138  
4139 # P.66 2.6.6. "Here" Documents
4140 # in Chapter 2: Bits and Pieces
4141 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4142  
4143 # P.73 "Here" Documents
4144 # in Chapter 2: Bits and Pieces
4145 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4146  
4147 elsif (/\G ( <<~ \\([a-zA-Z_0-9]+) ) /oxgc) {
4148 3 $slash = 'm//';
4149 3 my $here_quote = $1;
4150 3 my $delimiter = $2;
4151  
4152 # get here document
4153 3 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 3 0 3
4154 3 $here_script = CORE::substr $_, pos $_;
4155 3 $here_script =~ s/.*?\n//oxm;
4156 }
4157 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
4158 3 my $heredoc = $1;
4159 3 my $indent = $2;
4160 3 $heredoc =~ s{^$indent}{}msg; # no /ox
4161 3 push @heredoc, $heredoc . qq{\n$delimiter\n};
4162 3 push @heredoc_delimiter, qq{\\s*$delimiter};
4163 }
4164 else {
4165 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4166 }
4167 3 return qq{<<\\$delimiter};
4168 }
4169  
4170 # <<~"HEREDOC"
4171 elsif (/\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /oxgc) {
4172 6 $slash = 'm//';
4173 6 my $here_quote = $1;
4174 6 my $delimiter = $2;
4175  
4176 # get here document
4177 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4178 6 $here_script = CORE::substr $_, pos $_;
4179 6 $here_script =~ s/.*?\n//oxm;
4180 }
4181 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
4182 6 my $heredoc = $1;
4183 6 my $indent = $2;
4184 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4185 6 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4186 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4187 }
4188 else {
4189 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4190 }
4191 6 return qq{<<"$delimiter"};
4192 }
4193  
4194 # <<~HEREDOC
4195 elsif (/\G ( <<~ ([a-zA-Z_0-9]+) ) /oxgc) {
4196 3 $slash = 'm//';
4197 3 my $here_quote = $1;
4198 3 my $delimiter = $2;
4199  
4200 # get here document
4201 3 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 3 0 3
4202 3 $here_script = CORE::substr $_, pos $_;
4203 3 $here_script =~ s/.*?\n//oxm;
4204 }
4205 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
4206 3 my $heredoc = $1;
4207 3 my $indent = $2;
4208 3 $heredoc =~ s{^$indent}{}msg; # no /ox
4209 3 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4210 3 push @heredoc_delimiter, qq{\\s*$delimiter};
4211 }
4212 else {
4213 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4214 }
4215 3 return qq{<<$delimiter};
4216 }
4217  
4218 # <<~`HEREDOC`
4219 elsif (/\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /oxgc) {
4220 6 $slash = 'm//';
4221 6 my $here_quote = $1;
4222 6 my $delimiter = $2;
4223  
4224 # get here document
4225 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4226 6 $here_script = CORE::substr $_, pos $_;
4227 6 $here_script =~ s/.*?\n//oxm;
4228 }
4229 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
4230 6 my $heredoc = $1;
4231 6 my $indent = $2;
4232 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4233 6 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4234 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4235 }
4236 else {
4237 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4238 }
4239 6 return qq{<<`$delimiter`};
4240 }
4241  
4242 # <<'HEREDOC'
4243 elsif (/\G ( << '([a-zA-Z_0-9]*)' ) /oxgc) {
4244 72 $slash = 'm//';
4245 72 my $here_quote = $1;
4246 72 my $delimiter = $2;
4247  
4248 # get here document
4249 72 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 72 0 72
4250 72 $here_script = CORE::substr $_, pos $_;
4251 72 $here_script =~ s/.*?\n//oxm;
4252 }
4253 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
4254 72 push @heredoc, $1 . qq{\n$delimiter\n};
4255 72 push @heredoc_delimiter, $delimiter;
4256 }
4257 else {
4258 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4259 }
4260 72 return $here_quote;
4261 }
4262  
4263 # <<\HEREDOC
4264  
4265 # P.66 2.6.6. "Here" Documents
4266 # in Chapter 2: Bits and Pieces
4267 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4268  
4269 # P.73 "Here" Documents
4270 # in Chapter 2: Bits and Pieces
4271 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4272  
4273 elsif (/\G ( << \\([a-zA-Z_0-9]+) ) /oxgc) {
4274 0 $slash = 'm//';
4275 0 my $here_quote = $1;
4276 0 my $delimiter = $2;
4277  
4278 # get here document
4279 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4280 0 $here_script = CORE::substr $_, pos $_;
4281 0 $here_script =~ s/.*?\n//oxm;
4282 }
4283 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
4284 0 push @heredoc, $1 . qq{\n$delimiter\n};
4285 0 push @heredoc_delimiter, $delimiter;
4286 }
4287 else {
4288 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4289 }
4290 0 return $here_quote;
4291 }
4292  
4293 # <<"HEREDOC"
4294 elsif (/\G ( << "([a-zA-Z_0-9]*)" ) /oxgc) {
4295 36 $slash = 'm//';
4296 36 my $here_quote = $1;
4297 36 my $delimiter = $2;
4298  
4299 # get here document
4300 36 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 36 0 36
4301 36 $here_script = CORE::substr $_, pos $_;
4302 36 $here_script =~ s/.*?\n//oxm;
4303 }
4304 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
4305 36 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4306 36 push @heredoc_delimiter, $delimiter;
4307 }
4308 else {
4309 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4310 }
4311 36 return $here_quote;
4312 }
4313  
4314 # <<HEREDOC
4315 elsif (/\G ( << ([a-zA-Z_0-9]+) ) /oxgc) {
4316 42 $slash = 'm//';
4317 42 my $here_quote = $1;
4318 42 my $delimiter = $2;
4319  
4320 # get here document
4321 42 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 42 0 42
4322 42 $here_script = CORE::substr $_, pos $_;
4323 42 $here_script =~ s/.*?\n//oxm;
4324 }
4325 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
4326 42 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4327 42 push @heredoc_delimiter, $delimiter;
4328 }
4329 else {
4330 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4331 }
4332 42 return $here_quote;
4333 }
4334  
4335 # <<`HEREDOC`
4336 elsif (/\G ( << `([a-zA-Z_0-9]*)` ) /oxgc) {
4337 0 $slash = 'm//';
4338 0 my $here_quote = $1;
4339 0 my $delimiter = $2;
4340  
4341 # get here document
4342 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4343 0 $here_script = CORE::substr $_, pos $_;
4344 0 $here_script =~ s/.*?\n//oxm;
4345 }
4346 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
4347 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4348 0 push @heredoc_delimiter, $delimiter;
4349 }
4350 else {
4351 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4352 }
4353 0 return $here_quote;
4354 }
4355  
4356 # <<= <=> <= < operator
4357 elsif (/\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/oxgc) {
4358 12 return $1;
4359 }
4360  
4361 # <FILEHANDLE>
4362 elsif (/\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /oxgc) {
4363 0 return $1;
4364 }
4365  
4366 # <WILDCARD> --- glob
4367  
4368 # avoid "Error: Runtime exception" of perl version 5.005_03
4369  
4370 elsif (/\G < ((?:[^>\0\a\e\f\n\r\t])+?) > /oxgc) {
4371 0 return 'Ewindows1254::glob("' . $1 . '")';
4372 }
4373  
4374 # __DATA__
4375 0 elsif (/\G ^ ( __DATA__ \n .*) \z /oxmsgc) { return $1; }
4376  
4377 # __END__
4378 210 elsif (/\G ^ ( __END__ \n .*) \z /oxmsgc) { return $1; }
4379  
4380 # \cD Control-D
4381  
4382 # P.68 2.6.8. Other Literal Tokens
4383 # in Chapter 2: Bits and Pieces
4384 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4385  
4386 # P.76 Other Literal Tokens
4387 # in Chapter 2: Bits and Pieces
4388 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4389  
4390 0 elsif (/\G ( \cD .*) \z /oxmsgc) { return $1; }
4391  
4392 # \cZ Control-Z
4393 0 elsif (/\G ( \cZ .*) \z /oxmsgc) { return $1; }
4394  
4395 # any operator before div
4396 elsif (/\G (
4397 -- | \+\+ |
4398 [\)\}\]]
4399  
4400 5839 ) /oxgc) { $slash = 'div'; return $1; }
4401  
4402 # yada-yada or triple-dot operator
4403 elsif (/\G (
4404 \.\.\.
4405  
4406 7 ) /oxgc) { $slash = 'm//'; return q{die('Unimplemented')}; }
4407  
4408 # any operator before m//
4409  
4410 # //, //= (defined-or)
4411  
4412 # P.164 Logical Operators
4413 # in Chapter 10: More Control Structures
4414 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
4415  
4416 # P.119 C-Style Logical (Short-Circuit) Operators
4417 # in Chapter 3: Unary and Binary Operators
4418 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4419  
4420 # (and so on)
4421  
4422 # ~~
4423  
4424 # P.221 The Smart Match Operator
4425 # in Chapter 15: Smart Matching and given-when
4426 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
4427  
4428 # P.112 Smartmatch Operator
4429 # in Chapter 3: Unary and Binary Operators
4430 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4431  
4432 # (and so on)
4433  
4434 elsif (/\G ((?>
4435  
4436 !~~ | !~ | != | ! |
4437 %= | % |
4438 &&= | && | &= | &\.= | &\. | & |
4439 -= | -> | - |
4440 :(?>\s*)= |
4441 : |
4442 <<>> |
4443 <<= | <=> | <= | < |
4444 == | => | =~ | = |
4445 >>= | >> | >= | > |
4446 \*\*= | \*\* | \*= | \* |
4447 \+= | \+ |
4448 \.\. | \.= | \. |
4449 \/\/= | \/\/ |
4450 \/= | \/ |
4451 \? |
4452 \\ |
4453 \^= | \^\.= | \^\. | \^ |
4454 \b x= |
4455 \|\|= | \|\| | \|= | \|\.= | \|\. | \| |
4456 ~~ | ~\. | ~ |
4457 \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b |
4458 \b(?: print )\b |
4459  
4460 [,;\(\{\[]
4461  
4462 9773 )) /oxgc) { $slash = 'm//'; return $1; }
4463  
4464 # other any character
4465 21078 elsif (/\G ($q_char) /oxgc) { $slash = 'div'; return $1; }
4466  
4467 # system error
4468 else {
4469 0 die __FILE__, ": Oops, this shouldn't happen!\n";
4470 }
4471 }
4472  
4473 # escape Windows-1254 string
4474 1873 ▶sub e_string {
Subroutine e_string: called CC=54 SCAR=72.5
Pod documented
4475 1873 my($string) = @_;
4476 1873 my $e_string = '';
4477  
4478 1873 local $slash = 'm//';
4479  
4480 # P.1024 Appendix W.10 Multibyte Processing
4481 # of ISBN 1-56592-224-7 CJKV Information Processing
4482 # (and so on)
4483  
4484 1873 my @char = $string =~ / \G (?>[^\\]|\\$q_char|$q_char) /oxmsg;
4485  
4486 # without { ... }
4487 1873 ▶ if (not (grep(/\A \{ \z/xms, @char) and grep(/\A \} \z/xms, @char))) {
Branch: 1 branch
BranchTrueFalseTotal
unless (grep /\A \{ \z/msx, @char and grep /\A \} \z/msx, @char) 1854 19 1873
Condition66%2/3
grep /\A \{ \z/msx, @char and grep /\A \} \z/msx, @char
!ll&&!rl&&r
1854019
MC/DC50%1/2
grep /\A \{ \z/msx, @char and grep /\A \} \z/msx, @char
grep /\A \{ \z/msx, @char grep /\A \} \z/msx, @char
Truth table66%2/3
A and B
A= grep /\A \{ \z/msx, @charB= grep /\A \} \z/msx, @char
ABresult
0X0
100
111
4488 1854 ▶ if ($string !~ /<</oxms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /<</mosx) 1854 0 1854
4489 1854 return $string;
4490 }
4491 }
4492  
4493 E_STRING_LOOP:
4494 19 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 223 19 242
4495 223 ▶ if (0) {
Branch: 24 branches
BranchTrueFalseTotal
if (do { $string =~ /\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /cgmosx }) { } 0 223 223
elsif ($string =~ /\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G ( \$' | \$\{'\} ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G ( \$ 0 ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G ( \$ \$ ) (?![\w\{]) /cgmosx) { } 0 223 223
elsif ($string =~ /\G \$ ((?>[1-9][0-9]*)) /cgmosx) { } 0 223 223
elsif ($string =~ /\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /cgmosx) { } 0 223 223
elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /cgmosx) { } 0 223 223
elsif ($string =~ /\G \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} /cgmosx) { } 0 223 223
elsif ($string =~ /\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /cgmosx) { } 3 220 223
elsif ($string =~ /\G ( (?: [\$\@\%\&\*] | \$\# | -> | \b sub \b) (?>\s*) (?: split | chop | index | rindex | lc | uc | fc | chr | ord | reverse | getc | tr | y | q | qq | qx | qw | m | s | qr | glob | lstat | opendir | stat | unlink | chdir ) ) \b /cgmosx) { } 7 213 220
elsif ($string =~ m{\G ( \$[\$\@\#\\\'\"/\?\(\)\[\]\<\>] ) }cgmosx) { } 0 213 213
elsif ($string =~ /\G \b (qq) \b /cgox) { } 0 213 213
elsif ($string =~ /\G \b (qx) \b /cgox) { } 0 213 213
elsif ($string =~ /\G \b (q) \b /cgox) { } 0 213 213
elsif ($string =~ /\G (?<![\w\$\@\%\&\*]) (\') ((?:\\\'|\\\\|$Ewindows1254::q_char)*?) (\') /cgox) { } 0 213 213
elsif ($string =~ /\G (\") ((?:$Ewindows1254::qq_char)*?) (\") /cgox) { } 0 213 213
elsif ($string =~ /\G (\`) ((?:$Ewindows1254::qq_char)*?) (\`) /cgox) { } 0 213 213
elsif ($string =~ /\G ($Ewindows1254::q_char) /cgox) { } 213 0 213
4496 }
4497  
4498 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> @{[Ewindows1254::PREMATCH()]}
4499 elsif ($string =~ /\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /oxmsgc) {
4500 0 $e_string .= q{Ewindows1254::PREMATCH()};
4501 0 $slash = 'div';
4502 }
4503  
4504 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> @{[Ewindows1254::MATCH()]}
4505 elsif ($string =~ /\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /oxmsgc) {
4506 0 $e_string .= q{Ewindows1254::MATCH()};
4507 0 $slash = 'div';
4508 }
4509  
4510 # $', ${'} --> $', ${'}
4511 elsif ($string =~ /\G ( \$' | \$\{'\} ) /oxmsgc) {
4512 0 $e_string .= $1;
4513 0 $slash = 'div';
4514 }
4515  
4516 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> @{[Ewindows1254::POSTMATCH()]}
4517 elsif ($string =~ /\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /oxmsgc) {
4518 0 $e_string .= q{Ewindows1254::POSTMATCH()};
4519 0 $slash = 'div';
4520 }
4521  
4522 # bareword
4523 elsif ($string =~ /\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /oxmsgc) {
4524 0 $e_string .= $1;
4525 0 $slash = 'div';
4526 }
4527  
4528 # $0 --> $0
4529 elsif ($string =~ /\G ( \$ 0 ) /oxmsgc) {
4530 0 $e_string .= $1;
4531 0 $slash = 'div';
4532 }
4533 elsif ($string =~ /\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /oxmsgc) {
4534 0 $e_string .= $1;
4535 0 $slash = 'div';
4536 }
4537  
4538 # $$ --> $$
4539 elsif ($string =~ /\G ( \$ \$ ) (?![\w\{]) /oxmsgc) {
4540 0 $e_string .= $1;
4541 0 $slash = 'div';
4542 }
4543  
4544 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
4545 # $1, $2, $3 --> $1, $2, $3 otherwise
4546 elsif ($string =~ /\G \$ ((?>[1-9][0-9]*)) /oxmsgc) {
4547 0 $e_string .= e_capture($1);
4548 0 $slash = 'div';
4549 }
4550 elsif ($string =~ /\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /oxmsgc) {
4551 0 $e_string .= e_capture($1);
4552 0 $slash = 'div';
4553 }
4554  
4555 # $$foo[ ... ] --> $ $foo->[ ... ]
4556 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /oxmsgc) {
4557 0 $e_string .= e_capture($1.'->'.$2);
4558 0 $slash = 'div';
4559 }
4560  
4561 # $$foo{ ... } --> $ $foo->{ ... }
4562 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /oxmsgc) {
4563 0 $e_string .= e_capture($1.'->'.$2);
4564 0 $slash = 'div';
4565 }
4566  
4567 # $$foo
4568 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /oxmsgc) {
4569 0 $e_string .= e_capture($1);
4570 0 $slash = 'div';
4571 }
4572  
4573 # ${ foo }
4574 elsif ($string =~ /\G \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} /oxmsgc) {
4575 0 $e_string .= '${' . $1 . '}';
4576 0 $slash = 'div';
4577 }
4578  
4579 # ${ ... }
4580 elsif ($string =~ /\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /oxmsgc) {
4581 3 $e_string .= e_capture($1);
4582 3 $slash = 'div';
4583 }
4584  
4585 # variable or function
4586 # $ @ % & * $ #
4587 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) {
4588 7 $e_string .= $1;
4589 7 $slash = 'div';
4590 }
4591 # $ $ $ $ $ $ $ $ $ $ $ $ $ $
4592 # $ @ # \ ' " / ? ( ) [ ] < >
4593 elsif ($string =~ /\G ( \$[\$\@\#\\\'\"\/\?\(\)\[\]\<\>] ) /oxmsgc) {
4594 0 $e_string .= $1;
4595 0 $slash = 'div';
4596 }
4597  
4598 # qq//
4599 elsif ($string =~ /\G \b (qq) \b /oxgc) {
4600 0 my $ope = $1;
4601 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qq# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Ewindows1254::qq_char)*?) (\#) /cgox) { } 0 0 0
4602 0 $e_string .= e_qq($ope,$1,$3,$2);
4603 }
4604 else {
4605 0 my $e = '';
4606 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4607 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) ((?:$Ewindows1254::qq_char)*?) (\1) /cgox) { } 0 0 0
4608 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq ( )
4609 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq { }
4610 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq [ ]
4611 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq < >
4612 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq * *
4613 }
4614 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4615 }
4616 }
4617  
4618 # qx//
4619 elsif ($string =~ /\G \b (qx) \b /oxgc) {
4620 0 my $ope = $1;
4621 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qx# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Ewindows1254::qq_char)*?) (\#) /cgox) { } 0 0 0
4622 0 $e_string .= e_qq($ope,$1,$3,$2);
4623 }
4624 else {
4625 0 my $e = '';
4626 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4627 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 (\') ((?:$Ewindows1254::qq_char)*?) (\') /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Ewindows1254::qq_char)*?) (\1) /cgox) { } 0 0 0
4628 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx ( )
4629 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx { }
4630 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx [ ]
4631 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx < >
4632 0 elsif ($string =~ /\G (\') ((?:$qq_char)*?) (\') /oxgc) { $e_string .= $e . e_q ($ope,$1,$3,$2); next E_STRING_LOOP; } # qx ' '
4633 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx * *
4634 }
4635 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4636 }
4637 }
4638  
4639 # q//
4640 elsif ($string =~ /\G \b (q) \b /oxgc) {
4641 0 my $ope = $1;
4642 0 ▶ if ($string =~ /\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { # q# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:\\\#|\\\\|$Ewindows1254::q_char)*?) (\#) /cgox) { } 0 0 0
4643 0 $e_string .= e_q($ope,$1,$3,$2);
4644 }
4645 else {
4646 0 my $e = '';
4647 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4648 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| $Ewindows1254::q_char)*?) (\1) /cgox) { } 0 0 0
4649 0 elsif ($string =~ /\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q ( )
4650 0 elsif ($string =~ /\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q { }
4651 0 elsif ($string =~ /\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q [ ]
4652 0 elsif ($string =~ /\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q < >
4653 0 elsif ($string =~ /\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q * *
4654 }
4655 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4656 }
4657 }
4658  
4659 # ''
4660 0 elsif ($string =~ /\G (?<![\w\$\@\%\&\*]) (\') ((?:\\\'|\\\\|$q_char)*?) (\') /oxgc) { $e_string .= e_q('',$1,$3,$2); }
4661  
4662 # ""
4663 0 elsif ($string =~ /\G (\") ((?:$qq_char)*?) (\") /oxgc) { $e_string .= e_qq('',$1,$3,$2); }
4664  
4665 # ``
4666 0 elsif ($string =~ /\G (\`) ((?:$qq_char)*?) (\`) /oxgc) { $e_string .= e_qq('',$1,$3,$2); }
4667  
4668 # other any character
4669 213 elsif ($string =~ /\G ($q_char) /oxgc) { $e_string .= $1; }
4670  
4671 # system error
4672 else {
4673 0 die __FILE__, ": Oops, this shouldn't happen!\n";
4674 }
4675 }
4676  
4677 19 return $e_string;
4678 }
4679  
4680 #
4681 # character class
4682 #
4683 1920 ▶sub character_class {
Subroutine character_class: called CC=3 SCAR=11.0
Pod undocumented
4684 1920 my($char,$modifier) = @_;
4685  
4686 1920 ▶ if ($char eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char eq '.') { } 52 1868 1920
4687 52 ▶ if ($modifier =~ /s/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/) { } 17 35 52
4688 17 return '${Ewindows1254::dot_s}';
4689 }
4690 else {
4691 35 return '${Ewindows1254::dot}';
4692 }
4693 }
4694 else {
4695 1868 return Ewindows1254::classic_character_class($char);
4696 }
4697 }
4698  
4699 #
4700 # escape capture ($1, $2, $3, ...)
4701 #
4702 212 ▶sub e_capture {
Subroutine e_capture: called CC=1 SCAR=0.0
Pod undocumented
4703  
4704 212 return join '', '${', $_[0], '}';
4705 }
4706  
4707 #
4708 # escape transliteration (tr/// or y///)
4709 #
4710 4 ▶sub e_tr {
Subroutine e_tr: called CC=5 SCAR=16.8
Pod undocumented
4711 4 my($variable,$charclass,$e,$charclass2,$modifier) = @_;
4712 4 my $e_tr = '';
4713 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
4714  
4715 4 $slash = 'div';
4716  
4717 # quote character class 1
4718 4 $charclass = q_tr($charclass);
4719  
4720 # quote character class 2
4721 4 $charclass2 = q_tr($charclass2);
4722  
4723 # /b /B modifier
4724 4 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) { } 0 4 4
4725 0 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq '') { } 0 0 0
4726 0 $e_tr = qq{tr$charclass$e$charclass2$modifier};
4727 }
4728 else {
4729 0 $e_tr = qq{$variable${bind_operator}tr$charclass$e$charclass2$modifier};
4730 }
4731 }
4732 else {
4733 4 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq '') { } 2 2 4
4734 2 $e_tr = qq{Ewindows1254::tr(\$_,' =~ ',$charclass,$e$charclass2,'$modifier')};
4735 }
4736 else {
4737 2 $e_tr = qq{Ewindows1254::tr($variable,'$bind_operator',$charclass,$e$charclass2,'$modifier')};
4738 }
4739 }
4740  
4741 # clear tr/// variable
4742 4 $tr_variable = '';
4743 4 $bind_operator = '';
4744  
4745 4 return $e_tr;
4746 }
4747  
4748 #
4749 # quote for escape transliteration (tr/// or y///)
4750 #
4751 8 ▶sub q_tr {
Subroutine q_tr: called CC=9 SCAR=40.6
Pod undocumented
4752 8 my($charclass) = @_;
4753  
4754 # quote character class
4755 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
4756 8 return e_q('', "'", "'", $charclass); # --> q' '
4757 }
4758 elsif ($charclass !~ /\//oxms) {
4759 0 return e_q('q', '/', '/', $charclass); # --> q/ /
4760 }
4761 elsif ($charclass !~ /\#/oxms) {
4762 0 return e_q('q', '#', '#', $charclass); # --> q# #
4763 }
4764 elsif ($charclass !~ /[\<\>]/oxms) {
4765 0 return e_q('q', '<', '>', $charclass); # --> q< >
4766 }
4767 elsif ($charclass !~ /[\(\)]/oxms) {
4768 0 return e_q('q', '(', ')', $charclass); # --> q( )
4769 }
4770 elsif ($charclass !~ /[\{\}]/oxms) {
4771 0 return e_q('q', '{', '}', $charclass); # --> q{ }
4772 }
4773 else {
4774 0 for my $char (qw( ! " $ % & * + . : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
4775 0 ▶ if ($charclass !~ /\Q$char\E/xms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($charclass =~ /\Q$char\E/msx) 0 0 0
4776 0 return e_q('q', $char, $char, $charclass);
4777 }
4778 }
4779 }
4780  
4781 0 return e_q('q', '{', '}', $charclass);
4782 }
4783  
4784 #
4785 # escape q string (q//, '')
4786 #
4787 1623 ▶sub e_q {
Subroutine e_q: called CC=1 SCAR=0.0
Pod undocumented
4788 1623 my($ope,$delimiter,$end_delimiter,$string) = @_;
4789  
4790 1623 $slash = 'div';
4791  
4792 1623 return join '', $ope, $delimiter, $string, $end_delimiter;
4793 }
4794  
4795 #
4796 # escape qq string (qq//, "", qx//, ``)
4797 #
4798 4211 ▶sub e_qq {
Subroutine e_qq: called CC=37 SCAR=50.9
Pod undocumented
4799 4211 my($ope,$delimiter,$end_delimiter,$string) = @_;
4800  
4801 4211 $slash = 'div';
4802  
4803 4211 my $left_e = 0;
4804 4211 my $right_e = 0;
4805  
4806 # split regexp
4807 4211 my @char = $string =~ /\G((?>
4808 [^\\\$] |
4809 \\x\{ (?>[0-9A-Fa-f]+) \} |
4810 \\o\{ (?>[0-7]+) \} |
4811 \\N\{ (?>[^0-9\}][^\}]*) \} |
4812 \\ $q_char |
4813 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
4814 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
4815 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
4816 \$ (?>\s* [0-9]+) |
4817 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
4818 \$ \$ (?![\w\{]) |
4819 \$ (?>\s*) \$ (?>\s*) $qq_variable |
4820 $q_char
4821 ))/oxmsg;
4822  
4823 4211 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 117682 4211 121893
4824  
4825 # "\L\u" --> "\u\L"
4826 117682 ▶ 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 117682 117682
elsif ($char[$i] eq '\\U' and $char[$i + 1] eq '\\l') { } 0 117682 117682
elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/mosx) { } 1 117681 117682
elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/mosx) { } 1 117680 117681
elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/mosx) { } 0 117680 117680
Condition33%1/3
$char[$i] eq "\\L" and $char[$i + 1] eq "\\u"
!ll&&!rl&&r
11768200
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
4827 0 @char[$i,$i+1] = @char[$i+1,$i];
4828 }
4829  
4830 # "\U\l" --> "\l\U"
4831 ▶ 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
11768200
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
4832 0 @char[$i,$i+1] = @char[$i+1,$i];
4833 }
4834  
4835 # octal escape sequence
4836 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
4837 1 $char[$i] = Ewindows1254::octchr($1);
4838 }
4839  
4840 # hexadecimal escape sequence
4841 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
4842 1 $char[$i] = Ewindows1254::hexchr($1);
4843 }
4844  
4845 # \N{CHARNAME} --> N{CHARNAME}
4846 elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
4847 0 $char[$i] = $1;
4848 }
4849  
4850 117682 ▶ if (0) {
Branch: 23 branches
BranchTrueFalseTotal
if (do { $char[$i] =~ /\A ([<>]) \z/mosx }) { } 484 117198 117682
elsif ($char[$i] eq '\\u') { } 0 117198 117198
elsif ($char[$i] eq '\\l') { } 0 117198 117198
elsif ($char[$i] eq '\\U') { } 0 117198 117198
elsif ($char[$i] eq '\\L') { } 0 117198 117198
elsif ($char[$i] eq '\\F') { } 24 117174 117198
elsif ($char[$i] eq '\\Q') { } 0 117174 117174
elsif ($char[$i] eq '\\E') { } 24 117150 117174
elsif ($char[$i] eq '\\Q') { } 0 117150 117150
elsif ($char[$i] eq '\\E') { } 0 117150 117150
elsif ($char[$i] =~ /\A \$ 0 \z/mosx) { } 4 117146 117150
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/mosx) { } 0 117146 117146
elsif ($char[$i] =~ /\A \$\$ \z/mosx) { } 0 117146 117146
elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/mosx) { } 205 116941 117146
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/mosx) { } 0 116941 116941
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/mosx) { } 0 116941 116941
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/mosx) { } 0 116941 116941
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/mosx) { } 0 116941 116941
elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/cgmosx) { } 44 116897 116941
elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/cgmosx) { } 45 116852 116897
elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/cgmosx) { } 33 116819 116852
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/mosx) { } 0 116819 116819
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/mosx) { } 0 116819 116819
4851 }
4852  
4853 # \F
4854 #
4855 # P.69 Table 2-6. Translation escapes
4856 # in Chapter 2: Bits and Pieces
4857 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4858 # (and so on)
4859  
4860 # \u \l \U \L \F \Q \E
4861 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
4862 484 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 484 484
4863 0 $char[$i] = '\\' . $char[$i];
4864 }
4865 }
4866 elsif ($char[$i] eq '\u') {
4867  
4868 # "STRING @{[ LIST EXPR ]} MORE STRING"
4869  
4870 # P.257 Other Tricks You Can Do with Hard References
4871 # in Chapter 8: References
4872 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4873  
4874 # P.353 Other Tricks You Can Do with Hard References
4875 # in Chapter 8: References
4876 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4877  
4878 # (and so on)
4879  
4880 0 $char[$i] = '@{[Ewindows1254::ucfirst qq<';
4881 0 $left_e++;
4882 }
4883 elsif ($char[$i] eq '\l') {
4884 0 $char[$i] = '@{[Ewindows1254::lcfirst qq<';
4885 0 $left_e++;
4886 }
4887 elsif ($char[$i] eq '\U') {
4888 0 $char[$i] = '@{[Ewindows1254::uc qq<';
4889 0 $left_e++;
4890 }
4891 elsif ($char[$i] eq '\L') {
4892 0 $char[$i] = '@{[Ewindows1254::lc qq<';
4893 0 $left_e++;
4894 }
4895 elsif ($char[$i] eq '\F') {
4896 24 $char[$i] = '@{[Ewindows1254::fc qq<';
4897 24 $left_e++;
4898 }
4899 elsif ($char[$i] eq '\Q') {
4900 0 $char[$i] = '@{[CORE::quotemeta qq<';
4901 0 $left_e++;
4902 }
4903 elsif ($char[$i] eq '\E') {
4904 24 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 24 0 24
4905 24 $char[$i] = '>]}';
4906 24 $right_e++;
4907 }
4908 else {
4909 0 $char[$i] = '';
4910 }
4911 }
4912 elsif ($char[$i] eq '\Q') {
4913 0 while (1) {
4914 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
4915 0 last;
4916 }
4917 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
4918 0 last;
4919 }
4920 }
4921 }
4922 elsif ($char[$i] eq '\E') {
4923 }
4924  
4925 # $0 --> $0
4926 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
4927 }
4928 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
4929 }
4930  
4931 # $$ --> $$
4932 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
4933 }
4934  
4935 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
4936 # $1, $2, $3 --> $1, $2, $3 otherwise
4937 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
4938 205 $char[$i] = e_capture($1);
4939 }
4940 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
4941 0 $char[$i] = e_capture($1);
4942 }
4943  
4944 # $$foo[ ... ] --> $ $foo->[ ... ]
4945 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
4946 0 $char[$i] = e_capture($1.'->'.$2);
4947 }
4948  
4949 # $$foo{ ... } --> $ $foo->{ ... }
4950 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
4951 0 $char[$i] = e_capture($1.'->'.$2);
4952 }
4953  
4954 # $$foo
4955 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
4956 0 $char[$i] = e_capture($1);
4957 }
4958  
4959 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Ewindows1254::PREMATCH()
4960 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
4961 44 $char[$i] = '@{[Ewindows1254::PREMATCH()]}';
4962 }
4963  
4964 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Ewindows1254::MATCH()
4965 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
4966 45 $char[$i] = '@{[Ewindows1254::MATCH()]}';
4967 }
4968  
4969 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Ewindows1254::POSTMATCH()
4970 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
4971 33 $char[$i] = '@{[Ewindows1254::POSTMATCH()]}';
4972 }
4973  
4974 # ${ foo } --> ${ foo }
4975 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/oxms) {
4976 }
4977  
4978 # ${ ... }
4979 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
4980 0 $char[$i] = e_capture($1);
4981 }
4982 }
4983  
4984 # return string
4985 4211 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 4211 4211
4986 0 return join '', $ope, $delimiter, @char, '>]}' x ($left_e - $right_e), $end_delimiter;
4987 }
4988 4211 return join '', $ope, $delimiter, @char, $end_delimiter;
4989 }
4990  
4991 #
4992 # escape qw string (qw//)
4993 #
4994 16 ▶sub e_qw {
Subroutine e_qw: called CC=11 SCAR=43.1
Pod undocumented
4995 16 my($ope,$delimiter,$end_delimiter,$string) = @_;
4996  
4997 16 $slash = 'div';
4998  
4999 # choice again delimiter
5000 16 my %octet = map {$_ => 1} ($string =~ /\G ([\x00-\xFF]) /oxmsg);
5001 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
5002 16 return join '', $ope, $delimiter, $string, $end_delimiter;
5003 }
5004 elsif (not $octet{')'}) {
5005 0 return join '', $ope, '(', $string, ')';
5006 }
5007 elsif (not $octet{'}'}) {
5008 0 return join '', $ope, '{', $string, '}';
5009 }
5010 elsif (not $octet{']'}) {
5011 0 return join '', $ope, '[', $string, ']';
5012 }
5013 elsif (not $octet{'>'}) {
5014 0 return join '', $ope, '<', $string, '>';
5015 }
5016 else {
5017 0 for my $char (qw( ! " $ % & * + - . / : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5018 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5019 0 return join '', $ope, $char, $string, $char;
5020 }
5021 }
5022 }
5023  
5024 # qw/AAA BBB C'CC/ --> ('AAA', 'BBB', 'C\'CC')
5025 0 my @string = CORE::split(/\s+/, $string);
5026 0 for my $string (@string) {
5027 0 my @octet = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5028 0 for my $octet (@octet) {
5029 0 ▶ if ($octet =~ /\A (['\\]) \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($octet =~ /\A (['\\]) \z/mosx) 0 0 0
5030 0 $octet = '\\' . $1;
5031 }
5032 }
5033 0 $string = join '', @octet;
5034 }
5035 0 return join '', '(', (join ', ', map { "'$_'" } @string), ')';
5036 }
5037  
5038 #
5039 # escape here document (<<"HEREDOC", <<HEREDOC, <<`HEREDOC`, <<~"HEREDOC", <<~HEREDOC, <<~`HEREDOC`)
5040 #
5041 93 ▶sub e_heredoc {
Subroutine e_heredoc: called CC=37 SCAR=56.3
Pod undocumented
5042 93 my($string) = @_;
5043  
5044 93 $slash = 'm//';
5045  
5046 93 my $metachar = qr/[\@\\|]/oxms; # '|' is for <<`HEREDOC`
5047  
5048 93 my $left_e = 0;
5049 93 my $right_e = 0;
5050  
5051 # split regexp
5052 93 my @char = $string =~ /\G((?>
5053 [^\\\$] |
5054 \\x\{ (?>[0-9A-Fa-f]+) \} |
5055 \\o\{ (?>[0-7]+) \} |
5056 \\N\{ (?>[^0-9\}][^\}]*) \} |
5057 \\ $q_char |
5058 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5059 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5060 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5061 \$ (?>\s* [0-9]+) |
5062 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5063 \$ \$ (?![\w\{]) |
5064 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5065 $q_char
5066 ))/oxmsg;
5067  
5068 93 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 3307 93 3400
5069  
5070 # "\L\u" --> "\u\L"
5071 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
5072 0 @char[$i,$i+1] = @char[$i+1,$i];
5073 }
5074  
5075 # "\U\l" --> "\l\U"
5076 ▶ 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
5077 0 @char[$i,$i+1] = @char[$i+1,$i];
5078 }
5079  
5080 # octal escape sequence
5081 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5082 1 $char[$i] = Ewindows1254::octchr($1);
5083 }
5084  
5085 # hexadecimal escape sequence
5086 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5087 1 $char[$i] = Ewindows1254::hexchr($1);
5088 }
5089  
5090 # \N{CHARNAME} --> N{CHARNAME}
5091 elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5092 0 $char[$i] = $1;
5093 }
5094  
5095 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
5096 }
5097  
5098 # \u \l \U \L \F \Q \E
5099 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
5100 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
5101 0 $char[$i] = '\\' . $char[$i];
5102 }
5103 }
5104 elsif ($char[$i] eq '\u') {
5105 0 $char[$i] = '@{[Ewindows1254::ucfirst qq<';
5106 0 $left_e++;
5107 }
5108 elsif ($char[$i] eq '\l') {
5109 0 $char[$i] = '@{[Ewindows1254::lcfirst qq<';
5110 0 $left_e++;
5111 }
5112 elsif ($char[$i] eq '\U') {
5113 0 $char[$i] = '@{[Ewindows1254::uc qq<';
5114 0 $left_e++;
5115 }
5116 elsif ($char[$i] eq '\L') {
5117 0 $char[$i] = '@{[Ewindows1254::lc qq<';
5118 0 $left_e++;
5119 }
5120 elsif ($char[$i] eq '\F') {
5121 0 $char[$i] = '@{[Ewindows1254::fc qq<';
5122 0 $left_e++;
5123 }
5124 elsif ($char[$i] eq '\Q') {
5125 0 $char[$i] = '@{[CORE::quotemeta qq<';
5126 0 $left_e++;
5127 }
5128 elsif ($char[$i] eq '\E') {
5129 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
5130 0 $char[$i] = '>]}';
5131 0 $right_e++;
5132 }
5133 else {
5134 0 $char[$i] = '';
5135 }
5136 }
5137 elsif ($char[$i] eq '\Q') {
5138 0 while (1) {
5139 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5140 0 last;
5141 }
5142 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
5143 0 last;
5144 }
5145 }
5146 }
5147 elsif ($char[$i] eq '\E') {
5148 }
5149  
5150 # $0 --> $0
5151 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
5152 }
5153 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
5154 }
5155  
5156 # $$ --> $$
5157 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
5158 }
5159  
5160 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
5161 # $1, $2, $3 --> $1, $2, $3 otherwise
5162 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
5163 0 $char[$i] = e_capture($1);
5164 }
5165 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
5166 0 $char[$i] = e_capture($1);
5167 }
5168  
5169 # $$foo[ ... ] --> $ $foo->[ ... ]
5170 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
5171 0 $char[$i] = e_capture($1.'->'.$2);
5172 }
5173  
5174 # $$foo{ ... } --> $ $foo->{ ... }
5175 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
5176 0 $char[$i] = e_capture($1.'->'.$2);
5177 }
5178  
5179 # $$foo
5180 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
5181 0 $char[$i] = e_capture($1);
5182 }
5183  
5184 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Ewindows1254::PREMATCH()
5185 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
5186 8 $char[$i] = '@{[Ewindows1254::PREMATCH()]}';
5187 }
5188  
5189 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Ewindows1254::MATCH()
5190 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
5191 8 $char[$i] = '@{[Ewindows1254::MATCH()]}';
5192 }
5193  
5194 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Ewindows1254::POSTMATCH()
5195 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
5196 6 $char[$i] = '@{[Ewindows1254::POSTMATCH()]}';
5197 }
5198  
5199 # ${ foo } --> ${ foo }
5200 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/oxms) {
5201 }
5202  
5203 # ${ ... }
5204 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5205 0 $char[$i] = e_capture($1);
5206 }
5207 }
5208  
5209 # return string
5210 93 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 93 93
5211 0 return join '', @char, '>]}' x ($left_e - $right_e);
5212 }
5213 93 return join '', @char;
5214 }
5215  
5216 #
5217 # escape regexp (m//, qr//)
5218 #
5219 880 ▶sub e_qr {
Subroutine e_qr: called CC=110 SCAR=73.6
Pod undocumented
5220 880 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5221 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
5222  
5223 880 $modifier =~ tr/p//d;
5224 880 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 880 880
5225 0 my $line = 0;
5226 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
5227 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
5228 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
5229 0 last;
5230 }
5231 }
5232 0 die qq{Unsupported modifier "$1" used at line $line.\n};
5233 }
5234  
5235 880 $slash = 'div';
5236  
5237 # literal null string pattern
5238 880 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 872 880
elsif ($modifier =~ tr/Bb//d) { } 2 870 872
5239 8 $modifier =~ tr/bB//d;
5240 8 $modifier =~ tr/i//d;
5241 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
5242 }
5243  
5244 # /b /B modifier
5245 elsif ($modifier =~ tr/bB//d) {
5246  
5247 # choice again delimiter
5248 2 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 2 2
5249 0 my @char = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5250 0 my %octet = map {$_ => 1} @char;
5251 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
5252 0 $delimiter = '(';
5253 0 $end_delimiter = ')';
5254 }
5255 elsif (not $octet{'}'}) {
5256 0 $delimiter = '{';
5257 0 $end_delimiter = '}';
5258 }
5259 elsif (not $octet{']'}) {
5260 0 $delimiter = '[';
5261 0 $end_delimiter = ']';
5262 }
5263 elsif (not $octet{'>'}) {
5264 0 $delimiter = '<';
5265 0 $end_delimiter = '>';
5266 }
5267 else {
5268 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5269 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5270 0 $delimiter = $char;
5271 0 $end_delimiter = $char;
5272 0 last;
5273 }
5274 }
5275 }
5276 }
5277  
5278 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
5279 0 return join '', $ope, $delimiter, $string, $matched, $end_delimiter, $modifier;
5280 }
5281 else {
5282 2 return join '', $ope, $delimiter, '(?:', $string, ')', $matched, $end_delimiter, $modifier;
5283 }
5284 }
5285  
5286 870 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 312 558 870
5287 870 my $metachar = qr/[\@\\|[\]{^]/oxms;
5288  
5289 # split regexp
5290 870 my @char = $string =~ /\G((?>
5291 [^\\\$\@\[\(] |
5292 \\x (?>[0-9A-Fa-f]{1,2}) |
5293 \\ (?>[0-7]{2,3}) |
5294 \\c [\x40-\x5F] |
5295 \\x\{ (?>[0-9A-Fa-f]+) \} |
5296 \\o\{ (?>[0-7]+) \} |
5297 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
5298 \\ $q_char |
5299 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5300 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5301 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5302 [\$\@] $qq_variable |
5303 \$ (?>\s* [0-9]+) |
5304 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5305 \$ \$ (?![\w\{]) |
5306 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5307 \[\^ |
5308 \[\: (?>[a-z]+) :\] |
5309 \[\:\^ (?>[a-z]+) :\] |
5310 \(\? |
5311 $q_char
5312 ))/oxmsg;
5313  
5314 # choice again delimiter
5315 870 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 870 870
5316 0 my %octet = map {$_ => 1} @char;
5317 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
5318 0 $delimiter = '(';
5319 0 $end_delimiter = ')';
5320 }
5321 elsif (not $octet{'}'}) {
5322 0 $delimiter = '{';
5323 0 $end_delimiter = '}';
5324 }
5325 elsif (not $octet{']'}) {
5326 0 $delimiter = '[';
5327 0 $end_delimiter = ']';
5328 }
5329 elsif (not $octet{'>'}) {
5330 0 $delimiter = '<';
5331 0 $end_delimiter = '>';
5332 }
5333 else {
5334 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5335 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5336 0 $delimiter = $char;
5337 0 $end_delimiter = $char;
5338 0 last;
5339 }
5340 }
5341 }
5342 }
5343  
5344 870 my $left_e = 0;
5345 870 my $right_e = 0;
5346 870 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 2100 870 2970
5347  
5348 # "\L\u" --> "\u\L"
5349 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
5350 0 @char[$i,$i+1] = @char[$i+1,$i];
5351 }
5352  
5353 # "\U\l" --> "\l\U"
5354 ▶ 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
5355 0 @char[$i,$i+1] = @char[$i+1,$i];
5356 }
5357  
5358 # octal escape sequence
5359 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5360 1 $char[$i] = Ewindows1254::octchr($1);
5361 }
5362  
5363 # hexadecimal escape sequence
5364 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5365 1 $char[$i] = Ewindows1254::hexchr($1);
5366 }
5367  
5368 # \b{...} --> b\{...}
5369 # \B{...} --> B\{...}
5370 # \N{CHARNAME} --> N\{CHARNAME}
5371 # \p{PROPERTY} --> p\{PROPERTY}
5372 # \P{PROPERTY} --> P\{PROPERTY}
5373 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5374 6 $char[$i] = $1 . '\\' . $2;
5375 }
5376  
5377 # \p, \P, \X --> p, P, X
5378 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
5379 4 $char[$i] = $1;
5380 }
5381  
5382 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 &Ewindows1254::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
5383 }
5384  
5385 # join separated multiple-octet
5386 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
5387 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 $Ewindows1254::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 $Ewindows1254::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 $Ewindows1254::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 $Ewindows1254::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 $Ewindows1254::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 $Ewindows1254::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 $Ewindows1254::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5388 0 $char[$i] .= join '', splice @char, $i+1, 3;
5389 }
5390 ▶ 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 $Ewindows1254::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 $Ewindows1254::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 $Ewindows1254::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 $Ewindows1254::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5391 0 $char[$i] .= join '', splice @char, $i+1, 2;
5392 }
5393 ▶ 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 $Ewindows1254::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 $Ewindows1254::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 $Ewindows1254::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 $Ewindows1254::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5394 0 $char[$i] .= join '', splice @char, $i+1, 1;
5395 }
5396 }
5397  
5398 # open character class [...]
5399 elsif ($char[$i] eq '[') {
5400 556 my $left = $i;
5401  
5402 # [] make die "Unmatched [] in regexp ...\n"
5403 # (and so on)
5404  
5405 556 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 3 553 556
5406 3 $i++;
5407 }
5408  
5409 556 while (1) {
5410 2063 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 2063 2063
5411 0 die __FILE__, ": Unmatched [] in regexp\n";
5412 }
5413 2063 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 556 1507 2063
5414 556 my $right = $i;
5415  
5416 # [...]
5417 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
5418 30 splice @char, $left, $right-$left+1, sprintf(q{@{[Ewindows1254::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
5419 }
5420 else {
5421 526 splice @char, $left, $right-$left+1, Ewindows1254::charlist_qr(@char[$left+1..$right-1], $modifier);
5422 }
5423  
5424 556 $i = $left;
5425 556 last;
5426 }
5427 }
5428 }
5429  
5430 # open character class [^...]
5431 elsif ($char[$i] eq '[^') {
5432 74 my $left = $i;
5433  
5434 # [^] make die "Unmatched [] in regexp ...\n"
5435 # (and so on)
5436  
5437 74 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 4 70 74
5438 4 $i++;
5439 }
5440  
5441 74 while (1) {
5442 272 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 272 272
5443 0 die __FILE__, ": Unmatched [] in regexp\n";
5444 }
5445 272 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 74 198 272
5446 74 my $right = $i;
5447  
5448 # [^...]
5449 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
5450 30 splice @char, $left, $right-$left+1, sprintf(q{@{[Ewindows1254::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
5451 }
5452 else {
5453 44 splice @char, $left, $right-$left+1, Ewindows1254::charlist_not_qr(@char[$left+1..$right-1], $modifier);
5454 }
5455  
5456 74 $i = $left;
5457 74 last;
5458 }
5459 }
5460 }
5461  
5462 # rewrite character class or escape character
5463 elsif (my $char = character_class($char[$i],$modifier)) {
5464 139 $char[$i] = $char;
5465 }
5466  
5467 # /i modifier
5468 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Ewindows1254::uc($char[$i]) ne Ewindows1254::fc($char[$i]))) {
Condition100%6/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Ewindows1254::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 &Ewindows1254::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Ewindows1254::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= &Ewindows1254::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
5469 20 ▶ if (CORE::length(Ewindows1254::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 20 0 20
5470 20 $char[$i] = '[' . Ewindows1254::uc($char[$i]) . Ewindows1254::fc($char[$i]) . ']';
5471 }
5472 else {
5473 0 $char[$i] = '(?:' . Ewindows1254::uc($char[$i]) . '|' . Ewindows1254::fc($char[$i]) . ')';
5474 }
5475 }
5476  
5477 # \u \l \U \L \F \Q \E
5478 elsif ($char[$i] =~ /\A [<>] \z/oxms) {
5479 1 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 1 1
5480 0 $char[$i] = '\\' . $char[$i];
5481 }
5482 }
5483 elsif ($char[$i] eq '\u') {
5484 0 $char[$i] = '@{[Ewindows1254::ucfirst qq<';
5485 0 $left_e++;
5486 }
5487 elsif ($char[$i] eq '\l') {
5488 0 $char[$i] = '@{[Ewindows1254::lcfirst qq<';
5489 0 $left_e++;
5490 }
5491 elsif ($char[$i] eq '\U') {
5492 1 $char[$i] = '@{[Ewindows1254::uc qq<';
5493 1 $left_e++;
5494 }
5495 elsif ($char[$i] eq '\L') {
5496 1 $char[$i] = '@{[Ewindows1254::lc qq<';
5497 1 $left_e++;
5498 }
5499 elsif ($char[$i] eq '\F') {
5500 18 $char[$i] = '@{[Ewindows1254::fc qq<';
5501 18 $left_e++;
5502 }
5503 elsif ($char[$i] eq '\Q') {
5504 1 $char[$i] = '@{[CORE::quotemeta qq<';
5505 1 $left_e++;
5506 }
5507 elsif ($char[$i] eq '\E') {
5508 21 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 21 0 21
5509 21 $char[$i] = '>]}';
5510 21 $right_e++;
5511 }
5512 else {
5513 0 $char[$i] = '';
5514 }
5515 }
5516 elsif ($char[$i] eq '\Q') {
5517 0 while (1) {
5518 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5519 0 last;
5520 }
5521 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
5522 0 last;
5523 }
5524 }
5525 }
5526 elsif ($char[$i] eq '\E') {
5527 }
5528  
5529 # $0 --> $0
5530 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
5531 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5532 0 $char[$i] = '@{[Ewindows1254::ignorecase(' . $char[$i] . ')]}';
5533 }
5534 }
5535 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
5536 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5537 0 $char[$i] = '@{[Ewindows1254::ignorecase(' . $char[$i] . ')]}';
5538 }
5539 }
5540  
5541 # $$ --> $$
5542 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
5543 }
5544  
5545 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
5546 # $1, $2, $3 --> $1, $2, $3 otherwise
5547 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
5548 0 $char[$i] = e_capture($1);
5549 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5550 0 $char[$i] = '@{[Ewindows1254::ignorecase(' . $char[$i] . ')]}';
5551 }
5552 }
5553 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
5554 0 $char[$i] = e_capture($1);
5555 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5556 0 $char[$i] = '@{[Ewindows1254::ignorecase(' . $char[$i] . ')]}';
5557 }
5558 }
5559  
5560 # $$foo[ ... ] --> $ $foo->[ ... ]
5561 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
5562 0 $char[$i] = e_capture($1.'->'.$2);
5563 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5564 0 $char[$i] = '@{[Ewindows1254::ignorecase(' . $char[$i] . ')]}';
5565 }
5566 }
5567  
5568 # $$foo{ ... } --> $ $foo->{ ... }
5569 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
5570 0 $char[$i] = e_capture($1.'->'.$2);
5571 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5572 0 $char[$i] = '@{[Ewindows1254::ignorecase(' . $char[$i] . ')]}';
5573 }
5574 }
5575  
5576 # $$foo
5577 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
5578 0 $char[$i] = e_capture($1);
5579 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5580 0 $char[$i] = '@{[Ewindows1254::ignorecase(' . $char[$i] . ')]}';
5581 }
5582 }
5583  
5584 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Ewindows1254::PREMATCH()
5585 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
5586 8 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 8 8
5587 0 $char[$i] = '@{[Ewindows1254::ignorecase(Ewindows1254::PREMATCH())]}';
5588 }
5589 else {
5590 8 $char[$i] = '@{[Ewindows1254::PREMATCH()]}';
5591 }
5592 }
5593  
5594 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Ewindows1254::MATCH()
5595 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
5596 8 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 8 8
5597 0 $char[$i] = '@{[Ewindows1254::ignorecase(Ewindows1254::MATCH())]}';
5598 }
5599 else {
5600 8 $char[$i] = '@{[Ewindows1254::MATCH()]}';
5601 }
5602 }
5603  
5604 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Ewindows1254::POSTMATCH()
5605 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
5606 6 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 6 6
5607 0 $char[$i] = '@{[Ewindows1254::ignorecase(Ewindows1254::POSTMATCH())]}';
5608 }
5609 else {
5610 6 $char[$i] = '@{[Ewindows1254::POSTMATCH()]}';
5611 }
5612 }
5613  
5614 # ${ foo }
5615 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
5616 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5617 0 $char[$i] = '@{[Ewindows1254::ignorecase(' . $char[$i] . ')]}';
5618 }
5619 }
5620  
5621 # ${ ... }
5622 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5623 0 $char[$i] = e_capture($1);
5624 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5625 0 $char[$i] = '@{[Ewindows1254::ignorecase(' . $char[$i] . ')]}';
5626 }
5627 }
5628  
5629 # $scalar or @array
5630 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
5631 21 $char[$i] = e_string($char[$i]);
5632 21 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 11 10 21
5633 11 $char[$i] = '@{[Ewindows1254::ignorecase(' . $char[$i] . ')]}';
5634 }
5635 }
5636  
5637 # quote character before ? + * {
5638 ▶ 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
5639 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
5640 }
5641 ▶ 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
5642 0 my $char = $char[$i-1];
5643 0 ▶ if ($char[$i] eq '{') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq '{') { } 0 0 0
5644 0 die __FILE__, qq{: "MULTIBYTE{n}" should be "(MULTIBYTE){n}" in m?? (and shift \$1,\$2,\$3,...) ($char){n}\n};
5645 }
5646 else {
5647 0 die __FILE__, qq{: "MULTIBYTE$char[$i]" should be "(MULTIBYTE)$char[$i]" in m?? (and shift \$1,\$2,\$3,...) ($char)$char[$i]\n};
5648 }
5649 }
5650 else {
5651 127 $char[$i-1] = '(?:' . $char[$i-1] . ')';
5652 }
5653 }
5654 }
5655  
5656 # make regexp string
5657 870 $modifier =~ tr/i//d;
5658 870 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 870 870
5659 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
5660 0 return join '', $ope, $delimiter, $anchor, @char, '>]}' x ($left_e - $right_e), $matched, $end_delimiter, $modifier;
5661 }
5662 else {
5663 0 return join '', $ope, $delimiter, $anchor, '(?:', @char, '>]}' x ($left_e - $right_e), ')', $matched, $end_delimiter, $modifier;
5664 }
5665 }
5666 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
5667 0 return join '', $ope, $delimiter, $anchor, @char, $matched, $end_delimiter, $modifier;
5668 }
5669 else {
5670 870 return join '', $ope, $delimiter, $anchor, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
5671 }
5672 }
5673  
5674 #
5675 # double quote stuff
5676 #
5677 180 ▶sub qq_stuff {
Subroutine qq_stuff: called CC=6 SCAR=18.5
Pod undocumented
5678 180 my($delimiter,$end_delimiter,$stuff) = @_;
5679  
5680 # scalar variable or array variable
5681 180 ▶ if ($stuff =~ /\A [\$\@] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($stuff =~ /\A [\$\@] /mosx) 100 80 180
5682 100 return $stuff;
5683 }
5684  
5685 # quote by delimiter
5686 80 my %octet = map {$_ => 1} ($stuff =~ /\G ([\x00-\xFF]) /oxmsg);
5687 80 for my $char (qw( ! " $ % & * + - . / : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5688 80 ▶ next if $char eq $delimiter;
Branch: 1 branch
BranchTrueFalseTotal
if $char eq $delimiter 0 80 80
5689 80 ▶ next if $char eq $end_delimiter;
Branch: 1 branch
BranchTrueFalseTotal
if $char eq $end_delimiter 0 80 80
5690 80 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 80 0 80
5691 80 return join '', 'qq', $char, $stuff, $char;
5692 }
5693 }
5694 0 return join '', 'qq', '<', $stuff, '>';
5695 }
5696  
5697 #
5698 # escape regexp (m'', qr'', and m''b, qr''b)
5699 #
5700 10 ▶sub e_qr_q {
Subroutine e_qr_q: called CC=7 SCAR=25.3
Pod undocumented
5701 10 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5702 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
5703  
5704 10 $modifier =~ tr/p//d;
5705 10 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 10 10
5706 0 my $line = 0;
5707 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
5708 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
5709 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
5710 0 last;
5711 }
5712 }
5713 0 die qq{Unsupported modifier "$1" used at line $line.\n};
5714 }
5715  
5716 10 $slash = 'div';
5717  
5718 # literal null string pattern
5719 10 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 2 10
elsif ($modifier =~ tr/Bb//d) { } 0 2 2
5720 8 $modifier =~ tr/bB//d;
5721 8 $modifier =~ tr/i//d;
5722 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
5723 }
5724  
5725 # with /b /B modifier
5726 elsif ($modifier =~ tr/bB//d) {
5727 0 return e_qr_qb($ope,$delimiter,$end_delimiter,$string,$modifier);
5728 }
5729  
5730 # without /b /B modifier
5731 else {
5732 2 return e_qr_qt($ope,$delimiter,$end_delimiter,$string,$modifier);
5733 }
5734 }
5735  
5736 #
5737 # escape regexp (m'', qr'')
5738 #
5739 2 ▶sub e_qr_qt {
Subroutine e_qr_qt: called CC=20 SCAR=51.8
Pod undocumented
5740 2 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5741  
5742 2 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 2 2
5743  
5744 # split regexp
5745 2 my @char = $string =~ /\G((?>
5746 [^\\\[\$\@\/] |
5747 [\x00-\xFF] |
5748 \[\^ |
5749 \[\: (?>[a-z]+) \:\] |
5750 \[\:\^ (?>[a-z]+) \:\] |
5751 [\$\@\/] |
5752 \\ (?:$q_char) |
5753 (?:$q_char)
5754 ))/oxmsg;
5755  
5756 # unescape character
5757 2 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 2 2 4
5758 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 &Ewindows1254::uc($char[$i]) ne &fc($char[$i])) { } 0 2 2
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 4 4
5759 }
5760  
5761 # open character class [...]
5762 elsif ($char[$i] eq '[') {
5763 0 my $left = $i;
5764 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
5765 0 $i++;
5766 }
5767 0 while (1) {
5768 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5769 0 die __FILE__, ": Unmatched [] in regexp\n";
5770 }
5771 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
5772 0 my $right = $i;
5773  
5774 # [...]
5775 0 splice @char, $left, $right-$left+1, Ewindows1254::charlist_qr(@char[$left+1..$right-1], $modifier);
5776  
5777 0 $i = $left;
5778 0 last;
5779 }
5780 }
5781 }
5782  
5783 # open character class [^...]
5784 elsif ($char[$i] eq '[^') {
5785 0 my $left = $i;
5786 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
5787 0 $i++;
5788 }
5789 0 while (1) {
5790 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5791 0 die __FILE__, ": Unmatched [] in regexp\n";
5792 }
5793 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
5794 0 my $right = $i;
5795  
5796 # [^...]
5797 0 splice @char, $left, $right-$left+1, Ewindows1254::charlist_not_qr(@char[$left+1..$right-1], $modifier);
5798  
5799 0 $i = $left;
5800 0 last;
5801 }
5802 }
5803 }
5804  
5805 # escape $ @ / and \
5806 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
5807 0 $char[$i] = '\\' . $char[$i];
5808 }
5809  
5810 # rewrite character class or escape character
5811 elsif (my $char = character_class($char[$i],$modifier)) {
5812 0 $char[$i] = $char;
5813 }
5814  
5815 # /i modifier
5816 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Ewindows1254::uc($char[$i]) ne Ewindows1254::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Ewindows1254::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 &Ewindows1254::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Ewindows1254::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= &Ewindows1254::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
5817 0 ▶ if (CORE::length(Ewindows1254::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
5818 0 $char[$i] = '[' . Ewindows1254::uc($char[$i]) . Ewindows1254::fc($char[$i]) . ']';
5819 }
5820 else {
5821 0 $char[$i] = '(?:' . Ewindows1254::uc($char[$i]) . '|' . Ewindows1254::fc($char[$i]) . ')';
5822 }
5823 }
5824  
5825 # quote character before ? + * {
5826 ▶ 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
5827 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
5828 }
5829 else {
5830 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
5831 }
5832 }
5833 }
5834  
5835 2 $delimiter = '/';
5836 2 $end_delimiter = '/';
5837  
5838 2 $modifier =~ tr/i//d;
5839 2 return join '', $ope, $delimiter, $anchor, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
5840 }
5841  
5842 #
5843 # escape regexp (m''b, qr''b)
5844 #
5845 0 ▶sub e_qr_qb {
Subroutine e_qr_qb: not called CC=4 SCAR=30.0
Pod undocumented
5846 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5847  
5848 # split regexp
5849 0 my @char = $string =~ /\G ((?>[^\\]|\\\\)) /oxmsg;
5850  
5851 # unescape character
5852 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
5853 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
5854 }
5855  
5856 # remain \\
5857 elsif ($char[$i] eq '\\\\') {
5858 }
5859  
5860 # escape $ @ / and \
5861 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
5862 0 $char[$i] = '\\' . $char[$i];
5863 }
5864 }
5865  
5866 0 $delimiter = '/';
5867 0 $end_delimiter = '/';
5868 0 return join '', $ope, $delimiter, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
5869 }
5870  
5871 #
5872 # escape regexp (s/here//)
5873 #
5874 80 ▶sub e_s1 {
Subroutine e_s1: called CC=106 SCAR=81.1
Pod undocumented
5875 80 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5876 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
5877  
5878 80 $modifier =~ tr/p//d;
5879 80 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 80 80
5880 0 my $line = 0;
5881 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
5882 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
5883 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
5884 0 last;
5885 }
5886 }
5887 0 die qq{Unsupported modifier "$1" used at line $line.\n};
5888 }
5889  
5890 80 $slash = 'div';
5891  
5892 # literal null string pattern
5893 80 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 72 80
elsif ($modifier =~ tr/Bb//d) { } 0 72 72
5894 8 $modifier =~ tr/bB//d;
5895 8 $modifier =~ tr/i//d;
5896 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
5897 }
5898  
5899 # /b /B modifier
5900 elsif ($modifier =~ tr/bB//d) {
5901  
5902 # choice again delimiter
5903 0 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 0 0
5904 0 my @char = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5905 0 my %octet = map {$_ => 1} @char;
5906 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
5907 0 $delimiter = '(';
5908 0 $end_delimiter = ')';
5909 }
5910 elsif (not $octet{'}'}) {
5911 0 $delimiter = '{';
5912 0 $end_delimiter = '}';
5913 }
5914 elsif (not $octet{']'}) {
5915 0 $delimiter = '[';
5916 0 $end_delimiter = ']';
5917 }
5918 elsif (not $octet{'>'}) {
5919 0 $delimiter = '<';
5920 0 $end_delimiter = '>';
5921 }
5922 else {
5923 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5924 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5925 0 $delimiter = $char;
5926 0 $end_delimiter = $char;
5927 0 last;
5928 }
5929 }
5930 }
5931 }
5932  
5933 0 my $prematch = '';
5934 0 return join '', $ope, $delimiter, $prematch, '(?:', $string, ')', $matched, $end_delimiter, $modifier;
5935 }
5936  
5937 72 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 1 71 72
5938 72 my $metachar = qr/[\@\\|[\]{^]/oxms;
5939  
5940 # split regexp
5941 72 my @char = $string =~ /\G((?>
5942 [^\\\$\@\[\(] |
5943 \\ (?>[1-9][0-9]*) |
5944 \\g (?>\s*) (?>[1-9][0-9]*) |
5945 \\g (?>\s*) \{ (?>\s*) (?>[1-9][0-9]*) (?>\s*) \} |
5946 \\g (?>\s*) \{ (?>\s*) - (?>\s*) (?>[1-9][0-9]*) (?>\s*) \} |
5947 \\x (?>[0-9A-Fa-f]{1,2}) |
5948 \\ (?>[0-7]{2,3}) |
5949 \\c [\x40-\x5F] |
5950 \\x\{ (?>[0-9A-Fa-f]+) \} |
5951 \\o\{ (?>[0-7]+) \} |
5952 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
5953 \\ $q_char |
5954 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5955 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5956 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5957 [\$\@] $qq_variable |
5958 \$ (?>\s* [0-9]+) |
5959 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5960 \$ \$ (?![\w\{]) |
5961 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5962 \[\^ |
5963 \[\: (?>[a-z]+) :\] |
5964 \[\:\^ (?>[a-z]+) :\] |
5965 \(\? |
5966 $q_char
5967 ))/oxmsg;
5968  
5969 # choice again delimiter
5970 72 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 72 72
5971 0 my %octet = map {$_ => 1} @char;
5972 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
5973 0 $delimiter = '(';
5974 0 $end_delimiter = ')';
5975 }
5976 elsif (not $octet{'}'}) {
5977 0 $delimiter = '{';
5978 0 $end_delimiter = '}';
5979 }
5980 elsif (not $octet{']'}) {
5981 0 $delimiter = '[';
5982 0 $end_delimiter = ']';
5983 }
5984 elsif (not $octet{'>'}) {
5985 0 $delimiter = '<';
5986 0 $end_delimiter = '>';
5987 }
5988 else {
5989 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5990 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5991 0 $delimiter = $char;
5992 0 $end_delimiter = $char;
5993 0 last;
5994 }
5995 }
5996 }
5997 }
5998  
5999 # count '('
6000 72 my $parens = grep { $_ eq '(' } @char;
6001  
6002 72 my $left_e = 0;
6003 72 my $right_e = 0;
6004 72 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 200 72 272
6005  
6006 # "\L\u" --> "\u\L"
6007 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
6008 0 @char[$i,$i+1] = @char[$i+1,$i];
6009 }
6010  
6011 # "\U\l" --> "\l\U"
6012 ▶ 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
6013 0 @char[$i,$i+1] = @char[$i+1,$i];
6014 }
6015  
6016 # octal escape sequence
6017 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
6018 1 $char[$i] = Ewindows1254::octchr($1);
6019 }
6020  
6021 # hexadecimal escape sequence
6022 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
6023 1 $char[$i] = Ewindows1254::hexchr($1);
6024 }
6025  
6026 # \b{...} --> b\{...}
6027 # \B{...} --> B\{...}
6028 # \N{CHARNAME} --> N\{CHARNAME}
6029 # \p{PROPERTY} --> p\{PROPERTY}
6030 # \P{PROPERTY} --> P\{PROPERTY}
6031 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
6032 0 $char[$i] = $1 . '\\' . $2;
6033 }
6034  
6035 # \p, \P, \X --> p, P, X
6036 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
6037 0 $char[$i] = $1;
6038 }
6039  
6040 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 &Ewindows1254::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
6041 }
6042  
6043 # join separated multiple-octet
6044 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
6045 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 $Ewindows1254::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 $Ewindows1254::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 $Ewindows1254::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 $Ewindows1254::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 $Ewindows1254::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 $Ewindows1254::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 $Ewindows1254::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6046 0 $char[$i] .= join '', splice @char, $i+1, 3;
6047 }
6048 ▶ 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 $Ewindows1254::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 $Ewindows1254::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 $Ewindows1254::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 $Ewindows1254::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6049 0 $char[$i] .= join '', splice @char, $i+1, 2;
6050 }
6051 ▶ 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 $Ewindows1254::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 $Ewindows1254::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 $Ewindows1254::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 $Ewindows1254::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6052 0 $char[$i] .= join '', splice @char, $i+1, 1;
6053 }
6054 }
6055  
6056 # open character class [...]
6057 elsif ($char[$i] eq '[') {
6058 17 my $left = $i;
6059 17 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 17 17
6060 0 $i++;
6061 }
6062 17 while (1) {
6063 74 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 74 74
6064 0 die __FILE__, ": Unmatched [] in regexp\n";
6065 }
6066 74 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 17 57 74
6067 17 my $right = $i;
6068  
6069 # [...]
6070 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
6071 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Ewindows1254::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6072 }
6073 else {
6074 17 splice @char, $left, $right-$left+1, Ewindows1254::charlist_qr(@char[$left+1..$right-1], $modifier);
6075 }
6076  
6077 17 $i = $left;
6078 17 last;
6079 }
6080 }
6081 }
6082  
6083 # open character class [^...]
6084 elsif ($char[$i] eq '[^') {
6085 0 my $left = $i;
6086 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6087 0 $i++;
6088 }
6089 0 while (1) {
6090 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6091 0 die __FILE__, ": Unmatched [] in regexp\n";
6092 }
6093 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6094 0 my $right = $i;
6095  
6096 # [^...]
6097 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
6098 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Ewindows1254::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6099 }
6100 else {
6101 0 splice @char, $left, $right-$left+1, Ewindows1254::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6102 }
6103  
6104 0 $i = $left;
6105 0 last;
6106 }
6107 }
6108 }
6109  
6110 # rewrite character class or escape character
6111 elsif (my $char = character_class($char[$i],$modifier)) {
6112 7 $char[$i] = $char;
6113 }
6114  
6115 # /i modifier
6116 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Ewindows1254::uc($char[$i]) ne Ewindows1254::fc($char[$i]))) {
Condition66%4/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Ewindows1254::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 &Ewindows1254::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Ewindows1254::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= &Ewindows1254::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6117 3 ▶ if (CORE::length(Ewindows1254::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 3 0 3
6118 3 $char[$i] = '[' . Ewindows1254::uc($char[$i]) . Ewindows1254::fc($char[$i]) . ']';
6119 }
6120 else {
6121 0 $char[$i] = '(?:' . Ewindows1254::uc($char[$i]) . '|' . Ewindows1254::fc($char[$i]) . ')';
6122 }
6123 }
6124  
6125 # \u \l \U \L \F \Q \E
6126 elsif ($char[$i] =~ /\A [<>] \z/oxms) {
6127 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
6128 0 $char[$i] = '\\' . $char[$i];
6129 }
6130 }
6131 elsif ($char[$i] eq '\u') {
6132 0 $char[$i] = '@{[Ewindows1254::ucfirst qq<';
6133 0 $left_e++;
6134 }
6135 elsif ($char[$i] eq '\l') {
6136 0 $char[$i] = '@{[Ewindows1254::lcfirst qq<';
6137 0 $left_e++;
6138 }
6139 elsif ($char[$i] eq '\U') {
6140 0 $char[$i] = '@{[Ewindows1254::uc qq<';
6141 0 $left_e++;
6142 }
6143 elsif ($char[$i] eq '\L') {
6144 0 $char[$i] = '@{[Ewindows1254::lc qq<';
6145 0 $left_e++;
6146 }
6147 elsif ($char[$i] eq '\F') {
6148 0 $char[$i] = '@{[Ewindows1254::fc qq<';
6149 0 $left_e++;
6150 }
6151 elsif ($char[$i] eq '\Q') {
6152 0 $char[$i] = '@{[CORE::quotemeta qq<';
6153 0 $left_e++;
6154 }
6155 elsif ($char[$i] eq '\E') {
6156 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
6157 0 $char[$i] = '>]}';
6158 0 $right_e++;
6159 }
6160 else {
6161 0 $char[$i] = '';
6162 }
6163 }
6164 elsif ($char[$i] eq '\Q') {
6165 0 while (1) {
6166 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6167 0 last;
6168 }
6169 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
6170 0 last;
6171 }
6172 }
6173 }
6174 elsif ($char[$i] eq '\E') {
6175 }
6176  
6177 # \0 --> \0
6178 elsif ($char[$i] =~ /\A \\ (?>\s*) 0 \z/oxms) {
6179 }
6180  
6181 # \g{N}, \g{-N}
6182  
6183 # P.108 Using Simple Patterns
6184 # in Chapter 7: In the World of Regular Expressions
6185 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
6186  
6187 # P.221 Capturing
6188 # in Chapter 5: Pattern Matching
6189 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
6190  
6191 # \g{-1}, \g{-2}, \g{-3} --> \g{-1}, \g{-2}, \g{-3}
6192 elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) - (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6193 }
6194  
6195 # \g{1}, \g{2}, \g{3} --> \g{2}, \g{3}, \g{4} (only when multibyte anchoring is enable)
6196 elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6197 }
6198  
6199 # \g1, \g2, \g3 --> \g2, \g3, \g4 (only when multibyte anchoring is enable)
6200 elsif ($char[$i] =~ /\A \\g (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) {
6201 }
6202  
6203 # \1, \2, \3 --> \2, \3, \4 (only when multibyte anchoring is enable)
6204 elsif ($char[$i] =~ /\A \\ (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) {
6205 }
6206  
6207 # $0 --> $0
6208 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
6209 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6210 0 $char[$i] = '@{[Ewindows1254::ignorecase(' . $char[$i] . ')]}';
6211 }
6212 }
6213 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
6214 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6215 0 $char[$i] = '@{[Ewindows1254::ignorecase(' . $char[$i] . ')]}';
6216 }
6217 }
6218  
6219 # $$ --> $$
6220 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
6221 }
6222  
6223 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
6224 # $1, $2, $3 --> $1, $2, $3 otherwise
6225 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
6226 0 $char[$i] = e_capture($1);
6227 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6228 0 $char[$i] = '@{[Ewindows1254::ignorecase(' . $char[$i] . ')]}';
6229 }
6230 }
6231 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6232 0 $char[$i] = e_capture($1);
6233 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6234 0 $char[$i] = '@{[Ewindows1254::ignorecase(' . $char[$i] . ')]}';
6235 }
6236 }
6237  
6238 # $$foo[ ... ] --> $ $foo->[ ... ]
6239 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
6240 0 $char[$i] = e_capture($1.'->'.$2);
6241 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6242 0 $char[$i] = '@{[Ewindows1254::ignorecase(' . $char[$i] . ')]}';
6243 }
6244 }
6245  
6246 # $$foo{ ... } --> $ $foo->{ ... }
6247 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
6248 0 $char[$i] = e_capture($1.'->'.$2);
6249 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6250 0 $char[$i] = '@{[Ewindows1254::ignorecase(' . $char[$i] . ')]}';
6251 }
6252 }
6253  
6254 # $$foo
6255 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
6256 0 $char[$i] = e_capture($1);
6257 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6258 0 $char[$i] = '@{[Ewindows1254::ignorecase(' . $char[$i] . ')]}';
6259 }
6260 }
6261  
6262 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Ewindows1254::PREMATCH()
6263 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
6264 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 4 4
6265 0 $char[$i] = '@{[Ewindows1254::ignorecase(Ewindows1254::PREMATCH())]}';
6266 }
6267 else {
6268 4 $char[$i] = '@{[Ewindows1254::PREMATCH()]}';
6269 }
6270 }
6271  
6272 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Ewindows1254::MATCH()
6273 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
6274 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 4 4
6275 0 $char[$i] = '@{[Ewindows1254::ignorecase(Ewindows1254::MATCH())]}';
6276 }
6277 else {
6278 4 $char[$i] = '@{[Ewindows1254::MATCH()]}';
6279 }
6280 }
6281  
6282 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Ewindows1254::POSTMATCH()
6283 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
6284 3 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 3 3
6285 0 $char[$i] = '@{[Ewindows1254::ignorecase(Ewindows1254::POSTMATCH())]}';
6286 }
6287 else {
6288 3 $char[$i] = '@{[Ewindows1254::POSTMATCH()]}';
6289 }
6290 }
6291  
6292 # ${ foo }
6293 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
6294 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6295 0 $char[$i] = '@{[Ewindows1254::ignorecase(' . $char[$i] . ')]}';
6296 }
6297 }
6298  
6299 # ${ ... }
6300 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
6301 0 $char[$i] = e_capture($1);
6302 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6303 0 $char[$i] = '@{[Ewindows1254::ignorecase(' . $char[$i] . ')]}';
6304 }
6305 }
6306  
6307 # $scalar or @array
6308 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
6309 4 $char[$i] = e_string($char[$i]);
6310 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 4 4
6311 0 $char[$i] = '@{[Ewindows1254::ignorecase(' . $char[$i] . ')]}';
6312 }
6313 }
6314  
6315 # quote character before ? + * {
6316 ▶ 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
6317 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
6318 }
6319 else {
6320 14 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6321 }
6322 }
6323 }
6324  
6325 # make regexp string
6326 72 my $prematch = '';
6327 72 $modifier =~ tr/i//d;
6328 72 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 72 72
6329 0 return join '', $ope, $delimiter, $prematch, '(?:', @char, '>]}' x ($left_e - $right_e), ')', $matched, $end_delimiter, $modifier;
6330 }
6331 72 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6332 }
6333  
6334 #
6335 # escape regexp (s'here'' or s'here''b)
6336 #
6337 21 ▶sub e_s1_q {
Subroutine e_s1_q: called CC=7 SCAR=24.3
Pod undocumented
6338 21 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6339 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
6340  
6341 21 $modifier =~ tr/p//d;
6342 21 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 21 21
6343 0 my $line = 0;
6344 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6345 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6346 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6347 0 last;
6348 }
6349 }
6350 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6351 }
6352  
6353 21 $slash = 'div';
6354  
6355 # literal null string pattern
6356 21 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 13 21
elsif ($modifier =~ tr/Bb//d) { } 0 13 13
6357 8 $modifier =~ tr/bB//d;
6358 8 $modifier =~ tr/i//d;
6359 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
6360 }
6361  
6362 # with /b /B modifier
6363 elsif ($modifier =~ tr/bB//d) {
6364 0 return e_s1_qb($ope,$delimiter,$end_delimiter,$string,$modifier);
6365 }
6366  
6367 # without /b /B modifier
6368 else {
6369 13 return e_s1_qt($ope,$delimiter,$end_delimiter,$string,$modifier);
6370 }
6371 }
6372  
6373 #
6374 # escape regexp (s'here'')
6375 #
6376 13 ▶sub e_s1_qt {
Subroutine e_s1_qt: called CC=20 SCAR=50.1
Pod undocumented
6377 13 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6378  
6379 13 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 13 13
6380  
6381 # split regexp
6382 13 my @char = $string =~ /\G((?>
6383 [^\\\[\$\@\/] |
6384 [\x00-\xFF] |
6385 \[\^ |
6386 \[\: (?>[a-z]+) \:\] |
6387 \[\:\^ (?>[a-z]+) \:\] |
6388 [\$\@\/] |
6389 \\ (?:$q_char) |
6390 (?:$q_char)
6391 ))/oxmsg;
6392  
6393 # unescape character
6394 13 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 25 13 38
6395 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 &Ewindows1254::uc($char[$i]) ne &fc($char[$i])) { } 0 19 19
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 32 32
6396 }
6397  
6398 # open character class [...]
6399 elsif ($char[$i] eq '[') {
6400 0 my $left = $i;
6401 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6402 0 $i++;
6403 }
6404 0 while (1) {
6405 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6406 0 die __FILE__, ": Unmatched [] in regexp\n";
6407 }
6408 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6409 0 my $right = $i;
6410  
6411 # [...]
6412 0 splice @char, $left, $right-$left+1, Ewindows1254::charlist_qr(@char[$left+1..$right-1], $modifier);
6413  
6414 0 $i = $left;
6415 0 last;
6416 }
6417 }
6418 }
6419  
6420 # open character class [^...]
6421 elsif ($char[$i] eq '[^') {
6422 0 my $left = $i;
6423 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6424 0 $i++;
6425 }
6426 0 while (1) {
6427 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6428 0 die __FILE__, ": Unmatched [] in regexp\n";
6429 }
6430 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6431 0 my $right = $i;
6432  
6433 # [^...]
6434 0 splice @char, $left, $right-$left+1, Ewindows1254::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6435  
6436 0 $i = $left;
6437 0 last;
6438 }
6439 }
6440 }
6441  
6442 # escape $ @ / and \
6443 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6444 0 $char[$i] = '\\' . $char[$i];
6445 }
6446  
6447 # rewrite character class or escape character
6448 elsif (my $char = character_class($char[$i],$modifier)) {
6449 6 $char[$i] = $char;
6450 }
6451  
6452 # /i modifier
6453 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Ewindows1254::uc($char[$i]) ne Ewindows1254::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Ewindows1254::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 &Ewindows1254::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Ewindows1254::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= &Ewindows1254::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6454 0 ▶ if (CORE::length(Ewindows1254::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
6455 0 $char[$i] = '[' . Ewindows1254::uc($char[$i]) . Ewindows1254::fc($char[$i]) . ']';
6456 }
6457 else {
6458 0 $char[$i] = '(?:' . Ewindows1254::uc($char[$i]) . '|' . Ewindows1254::fc($char[$i]) . ')';
6459 }
6460 }
6461  
6462 # quote character before ? + * {
6463 ▶ 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
6464 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
6465 }
6466 else {
6467 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6468 }
6469 }
6470 }
6471  
6472 13 $modifier =~ tr/i//d;
6473 13 $delimiter = '/';
6474 13 $end_delimiter = '/';
6475 13 my $prematch = '';
6476 13 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6477 }
6478  
6479 #
6480 # escape regexp (s'here''b)
6481 #
6482 0 ▶sub e_s1_qb {
Subroutine e_s1_qb: not called CC=4 SCAR=30.0
Pod undocumented
6483 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6484  
6485 # split regexp
6486 0 my @char = $string =~ /\G (?>[^\\]|\\\\) /oxmsg;
6487  
6488 # unescape character
6489 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
6490 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
6491 }
6492  
6493 # remain \\
6494 elsif ($char[$i] eq '\\\\') {
6495 }
6496  
6497 # escape $ @ / and \
6498 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6499 0 $char[$i] = '\\' . $char[$i];
6500 }
6501 }
6502  
6503 0 $delimiter = '/';
6504 0 $end_delimiter = '/';
6505 0 my $prematch = '';
6506 0 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6507 }
6508  
6509 #
6510 # escape regexp (s''here')
6511 #
6512 16 ▶sub e_s2_q {
Subroutine e_s2_q: called CC=4 SCAR=13.9
Pod undocumented
6513 16 my($ope,$delimiter,$end_delimiter,$string) = @_;
6514  
6515 16 $slash = 'div';
6516  
6517 16 my @char = $string =~ / \G (?>[^\\]|\\\\|$q_char) /oxmsg;
6518 16 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 9 16 25
6519 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
6520 }
6521  
6522 # not escape \\
6523 elsif ($char[$i] =~ /\A \\\\ \z/oxms) {
6524 }
6525  
6526 # escape $ @ / and \
6527 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6528 5 $char[$i] = '\\' . $char[$i];
6529 }
6530 }
6531  
6532 16 return join '', $ope, $delimiter, @char, $end_delimiter;
6533 }
6534  
6535 #
6536 # escape regexp (s/here/and here/modifier)
6537 #
6538 101 ▶sub e_sub {
Subroutine e_sub: called CC=20 SCAR=32.6
Pod undocumented
6539 101 my($variable,$delimiter1,$pattern,$end_delimiter1,$delimiter2,$replacement,$end_delimiter2,$modifier) = @_;
6540 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
6541  
6542 101 $modifier =~ tr/p//d;
6543 101 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 101 101
6544 0 my $line = 0;
6545 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6546 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6547 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6548 0 last;
6549 }
6550 }
6551 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6552 }
6553  
6554 101 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq "") 36 65 101
6555 36 $variable = '$_';
6556 36 $bind_operator = ' =~ ';
6557 }
6558  
6559 101 $slash = 'div';
6560  
6561 # P.128 Start of match (or end of previous match): \G
6562 # P.130 Advanced Use of \G with Perl
6563 # in Chapter 3: Overview of Regular Expression Features and Flavors
6564 # P.312 Iterative Matching: Scalar Context, with /g
6565 # in Chapter 7: Perl
6566 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
6567  
6568 # P.181 Where You Left Off: The \G Assertion
6569 # in Chapter 5: Pattern Matching
6570 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
6571  
6572 # P.220 Where You Left Off: The \G Assertion
6573 # in Chapter 5: Pattern Matching
6574 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
6575  
6576 101 my $e_modifier = $modifier =~ tr/e//d;
6577 101 my $r_modifier = $modifier =~ tr/r//d;
6578  
6579 101 my $my = '';
6580 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
6581 0 $my = $variable;
6582 0 $variable =~ s/ (?: local \b | my \b | our \b | state \b ) (?>\s*) //oxms;
6583 0 $variable =~ s/ = .+ \z//oxms;
6584 }
6585  
6586 101 (my $variable_basename = $variable) =~ s/ [\[\{].* \z//oxms;
6587 101 $variable_basename =~ s/ \s+ \z//oxms;
6588  
6589 # quote replacement string
6590 101 my $e_replacement = '';
6591 101 ▶ if ($e_modifier >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($e_modifier >= 1) { } 17 84 101
6592 17 $e_replacement = e_qq('', '', '', $replacement);
6593 17 $e_modifier--;
6594 }
6595 else {
6596 84 ▶ if ($delimiter2 eq "'") {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter2 eq q[']) { } 16 68 84
6597 16 $e_replacement = e_s2_q('qq', '/', '/', $replacement);
6598 }
6599 else {
6600 68 $e_replacement = e_qq ('qq', $delimiter2, $end_delimiter2, $replacement);
6601 }
6602 }
6603  
6604 101 my $sub = '';
6605  
6606 # with /r
6607 101 ▶ if ($r_modifier) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r_modifier) { } 10 91 101
6608 10 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $modifier =~ /g/mosx }) { } 5 5 10
6609 }
6610  
6611 # s///gr without multibyte anchoring
6612 elsif ($modifier =~ /g/oxms) {
6613 5 ▶ $sub = sprintf(
Branch: 1 branch
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 0 5 5
6614 # 1 2 3 4 5
6615 q<CORE::eval{local $Ewindows1254::re_t=%s; while($Ewindows1254::re_t =~ %s){%s local $^W=0; local $Ewindows1254::re_r=%s; %s$Ewindows1254::re_t="$`$Ewindows1254::re_r$'"; pos($Ewindows1254::re_t)=length "$`$Ewindows1254::re_r"; } return $Ewindows1254::re_t}>,
6616  
6617 $variable, # 1
6618 ($delimiter1 eq "'") ? # 2
6619 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
6620 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
6621 $s_matched, # 3
6622 $e_replacement, # 4
6623 '$Ewindows1254::re_r=CORE::eval $Ewindows1254::re_r; ' x $e_modifier, # 5
6624 );
6625 }
6626  
6627 # s///r
6628 else {
6629  
6630 5 my $prematch = q{$`};
6631  
6632 5 ▶ $sub = sprintf(
Branch: 1 branch
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 0 5 5
6633 # 1 2 3 4 5 6 7
6634 q<(%s =~ %s) ? CORE::eval{%s local $^W=0; local $Ewindows1254::re_r=%s; %s"%s$Ewindows1254::re_r$'" } : %s>,
6635  
6636 $variable, # 1
6637 ($delimiter1 eq "'") ? # 2
6638 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
6639 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
6640 $s_matched, # 3
6641 $e_replacement, # 4
6642 '$Ewindows1254::re_r=CORE::eval $Ewindows1254::re_r; ' x $e_modifier, # 5
6643 $prematch, # 6
6644 $variable, # 7
6645 );
6646 }
6647  
6648 # $var !~ s///r doesn't make sense
6649 10 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) 0 10 10
6650 0 $sub = q{die("$0: Using !~ with s///r doesn't make sense"), } . $sub;
6651 }
6652 }
6653  
6654 # without /r
6655 else {
6656 91 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $modifier =~ /g/mosx }) { } 23 68 91
6657 }
6658  
6659 # s///g without multibyte anchoring
6660 elsif ($modifier =~ /g/oxms) {
6661 23 ▶ $sub = sprintf(
Branch: 2 branches
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 3 20 23
$bind_operator =~ / !~ /mosx ? : 3 20 23
6662 # 1 2 3 4 5 6 7 8
6663 q<CORE::eval{local $Ewindows1254::re_n=0; while(%s =~ %s){%s local $^W=0; local $Ewindows1254::re_r=%s; %s%s="$`$Ewindows1254::re_r$'"; pos(%s)=length "$`$Ewindows1254::re_r"; $Ewindows1254::re_n++} return %s$Ewindows1254::re_n}>,
6664  
6665 $variable, # 1
6666 ($delimiter1 eq "'") ? # 2
6667 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
6668 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
6669 $s_matched, # 3
6670 $e_replacement, # 4
6671 '$Ewindows1254::re_r=CORE::eval $Ewindows1254::re_r; ' x $e_modifier, # 5
6672 $variable, # 6
6673 $variable, # 7
6674 ($bind_operator =~ / !~ /oxms) ? '!' : '', # 8
6675 );
6676 }
6677  
6678 # s///
6679 else {
6680  
6681 68 my $prematch = q{$`};
6682  
6683 68 ▶ $sub = sprintf(
Branch: 2 branches
BranchTrueFalseTotal
$bind_operator =~ / =~ /mosx ? : 65 3 68
$delimiter1 eq q['] ? : 18 50 68
6684  
6685 ($bind_operator =~ / =~ /oxms) ?
6686  
6687 # 1 2 3 4 5 6 7 8
6688 q<(%s%s%s) ? CORE::eval{%s local $^W=0; local $Ewindows1254::re_r=%s; %s%s="%s$Ewindows1254::re_r$'"; 1 } : undef> :
6689  
6690 # 1 2 3 4 5 6 7 8
6691 q<(%s%s%s) ? 1 : CORE::eval{%s local $^W=0; local $Ewindows1254::re_r=%s; %s%s="%s$Ewindows1254::re_r$'"; undef }>,
6692  
6693 $variable, # 1
6694 $bind_operator, # 2
6695 ($delimiter1 eq "'") ? # 3
6696 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
6697 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
6698 $s_matched, # 4
6699 $e_replacement, # 5
6700 '$Ewindows1254::re_r=CORE::eval $Ewindows1254::re_r; ' x $e_modifier, # 6
6701 $variable, # 7
6702 $prematch, # 8
6703 );
6704 }
6705 }
6706  
6707 # (my $foo = $bar) =~ s/// --> (my $foo = $bar, CORE::eval { ... })[1]
6708 101 ▶ if ($my ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($my ne "") 0 101 101
6709 0 $sub = "($my, $sub)[1]";
6710 }
6711  
6712 # clear s/// variable
6713 101 $sub_variable = '';
6714 101 $bind_operator = '';
6715  
6716 101 return $sub;
6717 }
6718  
6719 #
6720 # escape regexp of split qr//
6721 #
6722 74 ▶sub e_split {
Subroutine e_split: called CC=88 SCAR=76.4
Pod undocumented
6723 74 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6724 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
6725  
6726 74 $modifier =~ tr/p//d;
6727 74 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 74 74
6728 0 my $line = 0;
6729 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6730 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6731 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6732 0 last;
6733 }
6734 }
6735 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6736 }
6737  
6738 74 $slash = 'div';
6739  
6740 # /b /B modifier
6741 74 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) 0 74 74
6742 0 return join '', 'split', $ope, $delimiter, $string, $end_delimiter, $modifier;
6743 }
6744  
6745 74 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 74 74
6746 74 my $metachar = qr/[\@\\|[\]{^]/oxms;
6747  
6748 # split regexp
6749 74 my @char = $string =~ /\G((?>
6750 [^\\\$\@\[\(] |
6751 \\x (?>[0-9A-Fa-f]{1,2}) |
6752 \\ (?>[0-7]{2,3}) |
6753 \\c [\x40-\x5F] |
6754 \\x\{ (?>[0-9A-Fa-f]+) \} |
6755 \\o\{ (?>[0-7]+) \} |
6756 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
6757 \\ $q_char |
6758 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
6759 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
6760 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
6761 [\$\@] $qq_variable |
6762 \$ (?>\s* [0-9]+) |
6763 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
6764 \$ \$ (?![\w\{]) |
6765 \$ (?>\s*) \$ (?>\s*) $qq_variable |
6766 \[\^ |
6767 \[\: (?>[a-z]+) :\] |
6768 \[\:\^ (?>[a-z]+) :\] |
6769 \(\? |
6770 $q_char
6771 ))/oxmsg;
6772  
6773 74 my $left_e = 0;
6774 74 my $right_e = 0;
6775 74 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 249 74 323
6776  
6777 # "\L\u" --> "\u\L"
6778 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
6779 0 @char[$i,$i+1] = @char[$i+1,$i];
6780 }
6781  
6782 # "\U\l" --> "\l\U"
6783 ▶ 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
6784 0 @char[$i,$i+1] = @char[$i+1,$i];
6785 }
6786  
6787 # octal escape sequence
6788 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
6789 1 $char[$i] = Ewindows1254::octchr($1);
6790 }
6791  
6792 # hexadecimal escape sequence
6793 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
6794 1 $char[$i] = Ewindows1254::hexchr($1);
6795 }
6796  
6797 # \b{...} --> b\{...}
6798 # \B{...} --> B\{...}
6799 # \N{CHARNAME} --> N\{CHARNAME}
6800 # \p{PROPERTY} --> p\{PROPERTY}
6801 # \P{PROPERTY} --> P\{PROPERTY}
6802 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
6803 0 $char[$i] = $1 . '\\' . $2;
6804 }
6805  
6806 # \p, \P, \X --> p, P, X
6807 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
6808 0 $char[$i] = $1;
6809 }
6810  
6811 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 &Ewindows1254::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
6812 }
6813  
6814 # join separated multiple-octet
6815 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
6816 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 $Ewindows1254::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 $Ewindows1254::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 $Ewindows1254::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 $Ewindows1254::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 $Ewindows1254::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 $Ewindows1254::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 $Ewindows1254::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6817 0 $char[$i] .= join '', splice @char, $i+1, 3;
6818 }
6819 ▶ 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 $Ewindows1254::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 $Ewindows1254::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 $Ewindows1254::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 $Ewindows1254::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6820 0 $char[$i] .= join '', splice @char, $i+1, 2;
6821 }
6822 ▶ 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 $Ewindows1254::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 $Ewindows1254::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 $Ewindows1254::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 $Ewindows1254::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6823 0 $char[$i] .= join '', splice @char, $i+1, 1;
6824 }
6825 }
6826  
6827 # open character class [...]
6828 elsif ($char[$i] eq '[') {
6829 3 my $left = $i;
6830 3 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 3 3
6831 0 $i++;
6832 }
6833 3 while (1) {
6834 7 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 7 7
6835 0 die __FILE__, ": Unmatched [] in regexp\n";
6836 }
6837 7 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 3 4 7
6838 3 my $right = $i;
6839  
6840 # [...]
6841 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
6842 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Ewindows1254::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6843 }
6844 else {
6845 3 splice @char, $left, $right-$left+1, Ewindows1254::charlist_qr(@char[$left+1..$right-1], $modifier);
6846 }
6847  
6848 3 $i = $left;
6849 3 last;
6850 }
6851 }
6852 }
6853  
6854 # open character class [^...]
6855 elsif ($char[$i] eq '[^') {
6856 0 my $left = $i;
6857 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6858 0 $i++;
6859 }
6860 0 while (1) {
6861 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6862 0 die __FILE__, ": Unmatched [] in regexp\n";
6863 }
6864 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6865 0 my $right = $i;
6866  
6867 # [^...]
6868 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
6869 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Ewindows1254::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6870 }
6871 else {
6872 0 splice @char, $left, $right-$left+1, Ewindows1254::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6873 }
6874  
6875 0 $i = $left;
6876 0 last;
6877 }
6878 }
6879 }
6880  
6881 # rewrite character class or escape character
6882 elsif (my $char = character_class($char[$i],$modifier)) {
6883 1 $char[$i] = $char;
6884 }
6885  
6886 # P.794 29.2.161. split
6887 # in Chapter 29: Functions
6888 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
6889  
6890 # P.951 split
6891 # in Chapter 27: Functions
6892 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
6893  
6894 # said "The //m modifier is assumed when you split on the pattern /^/",
6895 # but perl5.008 is not so. Therefore, this software adds //m.
6896 # (and so on)
6897  
6898 # split(m/^/) --> split(m/^/m)
6899 ▶ 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
6900 7 $modifier .= 'm';
6901 }
6902  
6903 # /i modifier
6904 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Ewindows1254::uc($char[$i]) ne Ewindows1254::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Ewindows1254::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 &Ewindows1254::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Ewindows1254::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= &Ewindows1254::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6905 0 ▶ if (CORE::length(Ewindows1254::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
6906 0 $char[$i] = '[' . Ewindows1254::uc($char[$i]) . Ewindows1254::fc($char[$i]) . ']';
6907 }
6908 else {
6909 0 $char[$i] = '(?:' . Ewindows1254::uc($char[$i]) . '|' . Ewindows1254::fc($char[$i]) . ')';
6910 }
6911 }
6912  
6913 # \u \l \U \L \F \Q \E
6914 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
6915 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
6916 0 $char[$i] = '\\' . $char[$i];
6917 }
6918 }
6919 elsif ($char[$i] eq '\u') {
6920 0 $char[$i] = '@{[Ewindows1254::ucfirst qq<';
6921 0 $left_e++;
6922 }
6923 elsif ($char[$i] eq '\l') {
6924 0 $char[$i] = '@{[Ewindows1254::lcfirst qq<';
6925 0 $left_e++;
6926 }
6927 elsif ($char[$i] eq '\U') {
6928 0 $char[$i] = '@{[Ewindows1254::uc qq<';
6929 0 $left_e++;
6930 }
6931 elsif ($char[$i] eq '\L') {
6932 0 $char[$i] = '@{[Ewindows1254::lc qq<';
6933 0 $left_e++;
6934 }
6935 elsif ($char[$i] eq '\F') {
6936 0 $char[$i] = '@{[Ewindows1254::fc qq<';
6937 0 $left_e++;
6938 }
6939 elsif ($char[$i] eq '\Q') {
6940 0 $char[$i] = '@{[CORE::quotemeta qq<';
6941 0 $left_e++;
6942 }
6943 elsif ($char[$i] eq '\E') {
6944 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
6945 0 $char[$i] = '>]}';
6946 0 $right_e++;
6947 }
6948 else {
6949 0 $char[$i] = '';
6950 }
6951 }
6952 elsif ($char[$i] eq '\Q') {
6953 0 while (1) {
6954 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6955 0 last;
6956 }
6957 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
6958 0 last;
6959 }
6960 }
6961 }
6962 elsif ($char[$i] eq '\E') {
6963 }
6964  
6965 # $0 --> $0
6966 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
6967 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6968 0 $char[$i] = '@{[Ewindows1254::ignorecase(' . $char[$i] . ')]}';
6969 }
6970 }
6971 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
6972 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6973 0 $char[$i] = '@{[Ewindows1254::ignorecase(' . $char[$i] . ')]}';
6974 }
6975 }
6976  
6977 # $$ --> $$
6978 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
6979 }
6980  
6981 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
6982 # $1, $2, $3 --> $1, $2, $3 otherwise
6983 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
6984 0 $char[$i] = e_capture($1);
6985 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6986 0 $char[$i] = '@{[Ewindows1254::ignorecase(' . $char[$i] . ')]}';
6987 }
6988 }
6989 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6990 0 $char[$i] = e_capture($1);
6991 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6992 0 $char[$i] = '@{[Ewindows1254::ignorecase(' . $char[$i] . ')]}';
6993 }
6994 }
6995  
6996 # $$foo[ ... ] --> $ $foo->[ ... ]
6997 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
6998 0 $char[$i] = e_capture($1.'->'.$2);
6999 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7000 0 $char[$i] = '@{[Ewindows1254::ignorecase(' . $char[$i] . ')]}';
7001 }
7002 }
7003  
7004 # $$foo{ ... } --> $ $foo->{ ... }
7005 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
7006 0 $char[$i] = e_capture($1.'->'.$2);
7007 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7008 0 $char[$i] = '@{[Ewindows1254::ignorecase(' . $char[$i] . ')]}';
7009 }
7010 }
7011  
7012 # $$foo
7013 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
7014 0 $char[$i] = e_capture($1);
7015 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7016 0 $char[$i] = '@{[Ewindows1254::ignorecase(' . $char[$i] . ')]}';
7017 }
7018 }
7019  
7020 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Ewindows1254::PREMATCH()
7021 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
7022 12 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 12 12
7023 0 $char[$i] = '@{[Ewindows1254::ignorecase(Ewindows1254::PREMATCH())]}';
7024 }
7025 else {
7026 12 $char[$i] = '@{[Ewindows1254::PREMATCH()]}';
7027 }
7028 }
7029  
7030 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Ewindows1254::MATCH()
7031 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
7032 12 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 12 12
7033 0 $char[$i] = '@{[Ewindows1254::ignorecase(Ewindows1254::MATCH())]}';
7034 }
7035 else {
7036 12 $char[$i] = '@{[Ewindows1254::MATCH()]}';
7037 }
7038 }
7039  
7040 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Ewindows1254::POSTMATCH()
7041 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
7042 9 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 9 9
7043 0 $char[$i] = '@{[Ewindows1254::ignorecase(Ewindows1254::POSTMATCH())]}';
7044 }
7045 else {
7046 9 $char[$i] = '@{[Ewindows1254::POSTMATCH()]}';
7047 }
7048 }
7049  
7050 # ${ foo }
7051 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
7052 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7053 0 $char[$i] = '@{[Ewindows1254::ignorecase(' . $1 . ')]}';
7054 }
7055 }
7056  
7057 # ${ ... }
7058 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
7059 0 $char[$i] = e_capture($1);
7060 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7061 0 $char[$i] = '@{[Ewindows1254::ignorecase(' . $char[$i] . ')]}';
7062 }
7063 }
7064  
7065 # $scalar or @array
7066 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
7067 3 $char[$i] = e_string($char[$i]);
7068 3 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 3 3
7069 0 $char[$i] = '@{[Ewindows1254::ignorecase(' . $char[$i] . ')]}';
7070 }
7071 }
7072  
7073 # quote character before ? + * {
7074 ▶ 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
7075 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
7076 }
7077 else {
7078 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
7079 }
7080 }
7081 }
7082  
7083 # make regexp string
7084 74 $modifier =~ tr/i//d;
7085 74 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 74 74
7086 0 return join '', 'Ewindows1254::split', $ope, $delimiter, @char, '>]}' x ($left_e - $right_e), $end_delimiter, $modifier;
7087 }
7088 74 return join '', 'Ewindows1254::split', $ope, $delimiter, @char, $end_delimiter, $modifier;
7089 }
7090  
7091 #
7092 # escape regexp of split qr''
7093 #
7094 0 ▶sub e_split_q {
Subroutine e_split_q: not called CC=26 SCAR=65.5
Pod undocumented
7095 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
7096 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
7097  
7098 0 $modifier =~ tr/p//d;
7099 0 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 0 0
7100 0 my $line = 0;
7101 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7102 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
7103 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
7104 0 last;
7105 }
7106 }
7107 0 die qq{Unsupported modifier "$1" used at line $line.\n};
7108 }
7109  
7110 0 $slash = 'div';
7111  
7112 # /b /B modifier
7113 0 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) 0 0 0
7114 0 return join '', 'split', $ope, $delimiter, $string, $end_delimiter, $modifier;
7115 }
7116  
7117 0 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 0 0
7118  
7119 # split regexp
7120 0 my @char = $string =~ /\G((?>
7121 [^\\\[] |
7122 [\x00-\xFF] |
7123 \[\^ |
7124 \[\: (?>[a-z]+) \:\] |
7125 \[\:\^ (?>[a-z]+) \:\] |
7126 \\ (?:$q_char) |
7127 (?:$q_char)
7128 ))/oxmsg;
7129  
7130 # unescape character
7131 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
7132 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 &Ewindows1254::uc($char[$i]) ne &fc($char[$i])) { } 0 0 0
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 0 0
7133 }
7134  
7135 # open character class [...]
7136 elsif ($char[$i] eq '[') {
7137 0 my $left = $i;
7138 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7139 0 $i++;
7140 }
7141 0 while (1) {
7142 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7143 0 die __FILE__, ": Unmatched [] in regexp\n";
7144 }
7145 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7146 0 my $right = $i;
7147  
7148 # [...]
7149 0 splice @char, $left, $right-$left+1, Ewindows1254::charlist_qr(@char[$left+1..$right-1], $modifier);
7150  
7151 0 $i = $left;
7152 0 last;
7153 }
7154 }
7155 }
7156  
7157 # open character class [^...]
7158 elsif ($char[$i] eq '[^') {
7159 0 my $left = $i;
7160 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7161 0 $i++;
7162 }
7163 0 while (1) {
7164 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7165 0 die __FILE__, ": Unmatched [] in regexp\n";
7166 }
7167 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7168 0 my $right = $i;
7169  
7170 # [^...]
7171 0 splice @char, $left, $right-$left+1, Ewindows1254::charlist_not_qr(@char[$left+1..$right-1], $modifier);
7172  
7173 0 $i = $left;
7174 0 last;
7175 }
7176 }
7177 }
7178  
7179 # rewrite character class or escape character
7180 elsif (my $char = character_class($char[$i],$modifier)) {
7181 0 $char[$i] = $char;
7182 }
7183  
7184 # split(m/^/) --> split(m/^/m)
7185 ▶ 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
7186 0 $modifier .= 'm';
7187 }
7188  
7189 # /i modifier
7190 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Ewindows1254::uc($char[$i]) ne Ewindows1254::fc($char[$i]))) {
Condition0%0/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Ewindows1254::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 &Ewindows1254::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Ewindows1254::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= &Ewindows1254::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
7191 0 ▶ if (CORE::length(Ewindows1254::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
7192 0 $char[$i] = '[' . Ewindows1254::uc($char[$i]) . Ewindows1254::fc($char[$i]) . ']';
7193 }
7194 else {
7195 0 $char[$i] = '(?:' . Ewindows1254::uc($char[$i]) . '|' . Ewindows1254::fc($char[$i]) . ')';
7196 }
7197 }
7198  
7199 # quote character before ? + * {
7200 ▶ 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
7201 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
7202 }
7203 else {
7204 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
7205 }
7206 }
7207 }
7208  
7209 0 $modifier =~ tr/i//d;
7210 0 return join '', 'Ewindows1254::split', $ope, $delimiter, @char, $end_delimiter, $modifier;
7211 }
7212  
7213 #
7214 # instead of Carp::carp
7215 #
7216 0 ▶sub carp {
Subroutine carp: not called CC=1 SCAR=6.9
Pod undocumented
7217 0 my($package,$filename,$line) = caller(1);
7218 0 print STDERR "@_ at $filename line $line.\n";
7219 }
7220  
7221 #
7222 # instead of Carp::croak
7223 #
7224 0 ▶sub croak {
Subroutine croak: not called CC=1 SCAR=6.9
Pod undocumented
7225 0 my($package,$filename,$line) = caller(1);
7226 0 print STDERR "@_ at $filename line $line.\n";
7227 0 die "\n";
7228 }
7229  
7230 #
7231 # instead of Carp::cluck
7232 #
7233 0 ▶sub cluck {
Subroutine cluck: not called CC=2 SCAR=17.9
Pod undocumented
7234 0 my $i = 0;
7235 0 my @cluck = ();
7236 0 ▶ while (my($package,$filename,$line,$subroutine) = caller($i)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7237 0 push @cluck, "[$i] $filename($line) $package::$subroutine\n";
7238 0 $i++;
7239 }
7240 0 print STDERR CORE::reverse @cluck;
7241 0 print STDERR "\n";
7242 0 print STDERR @_;
7243 }
7244  
7245 #
7246 # instead of Carp::confess
7247 #
7248 0 ▶sub confess {
Subroutine confess: not called CC=2 SCAR=17.9
Pod undocumented
7249 0 my $i = 0;
7250 0 my @confess = ();
7251 0 ▶ while (my($package,$filename,$line,$subroutine) = caller($i)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7252 0 push @confess, "[$i] $filename($line) $package::$subroutine\n";
7253 0 $i++;
7254 }
7255 0 print STDERR CORE::reverse @confess;
7256 0 print STDERR "\n";
7257 0 print STDERR @_;
7258 0 die "\n";
7259 }
7260  
7261 424 1;
7262  
7263 __END__
↑ Summary Windows1254.pm »