Ecyrillic.pm

filter: Statementstmt 43.5% 1311 / 3009 Branchbran 40.7% 1062 / 2608 Conditioncond 31.0% 115 / 370 MC/DCmcdc 15.9% 35 / 220 Subroutinesub 68.9% 111 / 161 Podpod 4.6% 3 / 64 totaltotal 41.0% 2637 / 6432 CC 1475 SCAR 97.8
CC
1475
Cov
42%
escape_token
55669.4
e_s1
3320.4
e_split
2070.1
CRAP 17630.3
↑ Summary Cyrillic.pm »
1 package Ecyrillic;
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 # Ecyrillic - Run-time routines for Cyrillic.pm
7 #
8 # http://search.cpan.org/dist/Char-Cyrillic/
9 #
10 # Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2018, 2019 INABA Hitoshi <ina@cpan.org>
11 ######################################################################
12  
13 425 ▶use 5.00503; # Galapagos Consensus 1998 for primetools
Subroutine BEGIN: called CC=1 SCAR=0.0
14 # use 5.008001; # Lancaster Consensus 2013 for toolchains
15  
16 # 12.3. Delaying use Until Runtime
17 # in Chapter 12. Packages, Libraries, and Modules
18 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
19 # (and so on)
20  
21 # Version numbers should be boring
22 # http://www.dagolden.com/index.php/369/version-numbers-should-be-boring/
23 # For the impatient, the disinterested or those who just want to follow
24 # a recipe, my advice for all modules is this:
25 # our $VERSION = "0.001"; # or "0.001_001" for a dev release
26 # $VERSION = eval $VERSION; # No!! because '1.10' makes '1.1'
27  
28 425 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
29 424 $VERSION = '1.22';
30 424 $VERSION = $VERSION;
31  
32 424 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=7.0
33 425 ▶ if ($^X =~ / jperl /oxmsi) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^X =~ / jperl /imosx) 0 424 424
34 1 die __FILE__, ": needs perl(not jperl) 5.00503 or later. (\$^X==$^X)\n";
35 }
36 425 if (CORE::ord('A') == 193) {
37 die __FILE__, ": is not US-ASCII script (may be EBCDIC or EBCDIK script).\n";
38 }
39 424 if (CORE::ord('A') != 0x41) {
40 die __FILE__, ": is not US-ASCII script (must be US-ASCII script).\n";
41 }
42 }
43  
44 424 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=9.5
45  
46 # instead of utf8.pm
47 424 ▶ CORE::eval q{
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
48 no warnings qw(redefine);
49 *utf8::upgrade = sub { CORE::length $_[0] };
50 *utf8::downgrade = sub { 1 };
51 *utf8::encode = sub { };
52 *utf8::decode = sub { 1 };
53 *utf8::is_utf8 = sub { };
54 *utf8::valid = sub { 1 };
55 };
56 424 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 424 424
57 0 ▶ *utf8::upgrade = sub { CORE::length $_[0] };
Subroutine __ANON__: not called CC=1 SCAR=6.9
58 0 ▶ *utf8::downgrade = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
59 0 ▶ *utf8::encode = sub { };
Subroutine __ANON__: not called CC=1 SCAR=6.9
60 0 ▶ *utf8::decode = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
61 0 ▶ *utf8::is_utf8 = sub { };
Subroutine __ANON__: not called CC=1 SCAR=6.9
62 0 ▶ *utf8::valid = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
63 }
64 }
65  
66 # instead of Symbol.pm
67 BEGIN {
68 0 ▶ sub gensym () {
Subroutine gensym: not called CC=2 SCAR=17.9
Pod undocumented
69 0 ▶ if ($] < 5.006) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] < 5.006) { } 0 0 0
70 0 return \do { local *_ };
71 }
72 else {
73 0 return undef;
74 }
75 }
76  
77 20 ▶ sub qualify ($$) {
Subroutine qualify: called CC=8 SCAR=28.9
Pod undocumented
78 20 my($name) = @_;
79  
80 20 ▶ if (ref $name) {
Branch: 7 branches
BranchTrueFalseTotal
if (ref $name) { } 5 15 20
elsif (&Ecyrillic::index($name, '::') >= 0) { } 0 15 15
elsif (&Ecyrillic::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 (Ecyrillic::index($name,'::') >= 0) {
84 0 return $name;
85 }
86 elsif (Ecyrillic::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 # Cyrillic character range per length
159 #
160 424 my %range_tr = ();
161  
162 #
163 # Cyrillic 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 Ecyrillic \z/mosx }) { } 424 0 424
176 }
177  
178 elsif (__PACKAGE__ =~ / \b Ecyrillic \z/oxms) {
179 424 %range_tr = (
180 1 => [ [0x00..0xFF],
181 ],
182 );
183  
184 424 %lc = (%lc,
185 "\xA1" => "\xF1", # CYRILLIC LETTER IO
186 "\xA2" => "\xF2", # CYRILLIC LETTER DJE
187 "\xA3" => "\xF3", # CYRILLIC LETTER GJE
188 "\xA4" => "\xF4", # CYRILLIC LETTER UKRAINIAN IE
189 "\xA5" => "\xF5", # CYRILLIC LETTER DZE
190 "\xA6" => "\xF6", # CYRILLIC LETTER BYELORUSSIAN-UKRAINIAN I
191 "\xA7" => "\xF7", # CYRILLIC LETTER YI
192 "\xA8" => "\xF8", # CYRILLIC LETTER JE
193 "\xA9" => "\xF9", # CYRILLIC LETTER LJE
194 "\xAA" => "\xFA", # CYRILLIC LETTER NJE
195 "\xAB" => "\xFB", # CYRILLIC LETTER TSHE
196 "\xAC" => "\xFC", # CYRILLIC LETTER KJE
197 "\xAE" => "\xFE", # CYRILLIC LETTER SHORT U
198 "\xAF" => "\xFF", # CYRILLIC LETTER DZHE
199 "\xB0" => "\xD0", # CYRILLIC LETTER A
200 "\xB1" => "\xD1", # CYRILLIC LETTER BE
201 "\xB2" => "\xD2", # CYRILLIC LETTER VE
202 "\xB3" => "\xD3", # CYRILLIC LETTER GHE
203 "\xB4" => "\xD4", # CYRILLIC LETTER DE
204 "\xB5" => "\xD5", # CYRILLIC LETTER IE
205 "\xB6" => "\xD6", # CYRILLIC LETTER ZHE
206 "\xB7" => "\xD7", # CYRILLIC LETTER ZE
207 "\xB8" => "\xD8", # CYRILLIC LETTER I
208 "\xB9" => "\xD9", # CYRILLIC LETTER SHORT I
209 "\xBA" => "\xDA", # CYRILLIC LETTER KA
210 "\xBB" => "\xDB", # CYRILLIC LETTER EL
211 "\xBC" => "\xDC", # CYRILLIC LETTER EM
212 "\xBD" => "\xDD", # CYRILLIC LETTER EN
213 "\xBE" => "\xDE", # CYRILLIC LETTER O
214 "\xBF" => "\xDF", # CYRILLIC LETTER PE
215 "\xC0" => "\xE0", # CYRILLIC LETTER ER
216 "\xC1" => "\xE1", # CYRILLIC LETTER ES
217 "\xC2" => "\xE2", # CYRILLIC LETTER TE
218 "\xC3" => "\xE3", # CYRILLIC LETTER U
219 "\xC4" => "\xE4", # CYRILLIC LETTER EF
220 "\xC5" => "\xE5", # CYRILLIC LETTER HA
221 "\xC6" => "\xE6", # CYRILLIC LETTER TSE
222 "\xC7" => "\xE7", # CYRILLIC LETTER CHE
223 "\xC8" => "\xE8", # CYRILLIC LETTER SHA
224 "\xC9" => "\xE9", # CYRILLIC LETTER SHCHA
225 "\xCA" => "\xEA", # CYRILLIC LETTER HARD SIGN
226 "\xCB" => "\xEB", # CYRILLIC LETTER YERU
227 "\xCC" => "\xEC", # CYRILLIC LETTER SOFT SIGN
228 "\xCD" => "\xED", # CYRILLIC LETTER E
229 "\xCE" => "\xEE", # CYRILLIC LETTER YU
230 "\xCF" => "\xEF", # CYRILLIC LETTER YA
231 );
232  
233 424 %uc = (%uc,
234 "\xD0" => "\xB0", # CYRILLIC LETTER A
235 "\xD1" => "\xB1", # CYRILLIC LETTER BE
236 "\xD2" => "\xB2", # CYRILLIC LETTER VE
237 "\xD3" => "\xB3", # CYRILLIC LETTER GHE
238 "\xD4" => "\xB4", # CYRILLIC LETTER DE
239 "\xD5" => "\xB5", # CYRILLIC LETTER IE
240 "\xD6" => "\xB6", # CYRILLIC LETTER ZHE
241 "\xD7" => "\xB7", # CYRILLIC LETTER ZE
242 "\xD8" => "\xB8", # CYRILLIC LETTER I
243 "\xD9" => "\xB9", # CYRILLIC LETTER SHORT I
244 "\xDA" => "\xBA", # CYRILLIC LETTER KA
245 "\xDB" => "\xBB", # CYRILLIC LETTER EL
246 "\xDC" => "\xBC", # CYRILLIC LETTER EM
247 "\xDD" => "\xBD", # CYRILLIC LETTER EN
248 "\xDE" => "\xBE", # CYRILLIC LETTER O
249 "\xDF" => "\xBF", # CYRILLIC LETTER PE
250 "\xE0" => "\xC0", # CYRILLIC LETTER ER
251 "\xE1" => "\xC1", # CYRILLIC LETTER ES
252 "\xE2" => "\xC2", # CYRILLIC LETTER TE
253 "\xE3" => "\xC3", # CYRILLIC LETTER U
254 "\xE4" => "\xC4", # CYRILLIC LETTER EF
255 "\xE5" => "\xC5", # CYRILLIC LETTER HA
256 "\xE6" => "\xC6", # CYRILLIC LETTER TSE
257 "\xE7" => "\xC7", # CYRILLIC LETTER CHE
258 "\xE8" => "\xC8", # CYRILLIC LETTER SHA
259 "\xE9" => "\xC9", # CYRILLIC LETTER SHCHA
260 "\xEA" => "\xCA", # CYRILLIC LETTER HARD SIGN
261 "\xEB" => "\xCB", # CYRILLIC LETTER YERU
262 "\xEC" => "\xCC", # CYRILLIC LETTER SOFT SIGN
263 "\xED" => "\xCD", # CYRILLIC LETTER E
264 "\xEE" => "\xCE", # CYRILLIC LETTER YU
265 "\xEF" => "\xCF", # CYRILLIC LETTER YA
266 "\xF1" => "\xA1", # CYRILLIC LETTER IO
267 "\xF2" => "\xA2", # CYRILLIC LETTER DJE
268 "\xF3" => "\xA3", # CYRILLIC LETTER GJE
269 "\xF4" => "\xA4", # CYRILLIC LETTER UKRAINIAN IE
270 "\xF5" => "\xA5", # CYRILLIC LETTER DZE
271 "\xF6" => "\xA6", # CYRILLIC LETTER BYELORUSSIAN-UKRAINIAN I
272 "\xF7" => "\xA7", # CYRILLIC LETTER YI
273 "\xF8" => "\xA8", # CYRILLIC LETTER JE
274 "\xF9" => "\xA9", # CYRILLIC LETTER LJE
275 "\xFA" => "\xAA", # CYRILLIC LETTER NJE
276 "\xFB" => "\xAB", # CYRILLIC LETTER TSHE
277 "\xFC" => "\xAC", # CYRILLIC LETTER KJE
278 "\xFE" => "\xAE", # CYRILLIC LETTER SHORT U
279 "\xFF" => "\xAF", # CYRILLIC LETTER DZHE
280 );
281  
282 424 %fc = (%fc,
283 "\xA1" => "\xF1", # CYRILLIC CAPITAL LETTER IO --> CYRILLIC SMALL LETTER IO
284 "\xA2" => "\xF2", # CYRILLIC CAPITAL LETTER DJE --> CYRILLIC SMALL LETTER DJE
285 "\xA3" => "\xF3", # CYRILLIC CAPITAL LETTER GJE --> CYRILLIC SMALL LETTER GJE
286 "\xA4" => "\xF4", # CYRILLIC CAPITAL LETTER UKRAINIAN IE --> CYRILLIC SMALL LETTER UKRAINIAN IE
287 "\xA5" => "\xF5", # CYRILLIC CAPITAL LETTER DZE --> CYRILLIC SMALL LETTER DZE
288 "\xA6" => "\xF6", # CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I --> CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I
289 "\xA7" => "\xF7", # CYRILLIC CAPITAL LETTER YI --> CYRILLIC SMALL LETTER YI
290 "\xA8" => "\xF8", # CYRILLIC CAPITAL LETTER JE --> CYRILLIC SMALL LETTER JE
291 "\xA9" => "\xF9", # CYRILLIC CAPITAL LETTER LJE --> CYRILLIC SMALL LETTER LJE
292 "\xAA" => "\xFA", # CYRILLIC CAPITAL LETTER NJE --> CYRILLIC SMALL LETTER NJE
293 "\xAB" => "\xFB", # CYRILLIC CAPITAL LETTER TSHE --> CYRILLIC SMALL LETTER TSHE
294 "\xAC" => "\xFC", # CYRILLIC CAPITAL LETTER KJE --> CYRILLIC SMALL LETTER KJE
295 "\xAE" => "\xFE", # CYRILLIC CAPITAL LETTER SHORT U --> CYRILLIC SMALL LETTER SHORT U
296 "\xAF" => "\xFF", # CYRILLIC CAPITAL LETTER DZHE --> CYRILLIC SMALL LETTER DZHE
297 "\xB0" => "\xD0", # CYRILLIC CAPITAL LETTER A --> CYRILLIC SMALL LETTER A
298 "\xB1" => "\xD1", # CYRILLIC CAPITAL LETTER BE --> CYRILLIC SMALL LETTER BE
299 "\xB2" => "\xD2", # CYRILLIC CAPITAL LETTER VE --> CYRILLIC SMALL LETTER VE
300 "\xB3" => "\xD3", # CYRILLIC CAPITAL LETTER GHE --> CYRILLIC SMALL LETTER GHE
301 "\xB4" => "\xD4", # CYRILLIC CAPITAL LETTER DE --> CYRILLIC SMALL LETTER DE
302 "\xB5" => "\xD5", # CYRILLIC CAPITAL LETTER IE --> CYRILLIC SMALL LETTER IE
303 "\xB6" => "\xD6", # CYRILLIC CAPITAL LETTER ZHE --> CYRILLIC SMALL LETTER ZHE
304 "\xB7" => "\xD7", # CYRILLIC CAPITAL LETTER ZE --> CYRILLIC SMALL LETTER ZE
305 "\xB8" => "\xD8", # CYRILLIC CAPITAL LETTER I --> CYRILLIC SMALL LETTER I
306 "\xB9" => "\xD9", # CYRILLIC CAPITAL LETTER SHORT I --> CYRILLIC SMALL LETTER SHORT I
307 "\xBA" => "\xDA", # CYRILLIC CAPITAL LETTER KA --> CYRILLIC SMALL LETTER KA
308 "\xBB" => "\xDB", # CYRILLIC CAPITAL LETTER EL --> CYRILLIC SMALL LETTER EL
309 "\xBC" => "\xDC", # CYRILLIC CAPITAL LETTER EM --> CYRILLIC SMALL LETTER EM
310 "\xBD" => "\xDD", # CYRILLIC CAPITAL LETTER EN --> CYRILLIC SMALL LETTER EN
311 "\xBE" => "\xDE", # CYRILLIC CAPITAL LETTER O --> CYRILLIC SMALL LETTER O
312 "\xBF" => "\xDF", # CYRILLIC CAPITAL LETTER PE --> CYRILLIC SMALL LETTER PE
313 "\xC0" => "\xE0", # CYRILLIC CAPITAL LETTER ER --> CYRILLIC SMALL LETTER ER
314 "\xC1" => "\xE1", # CYRILLIC CAPITAL LETTER ES --> CYRILLIC SMALL LETTER ES
315 "\xC2" => "\xE2", # CYRILLIC CAPITAL LETTER TE --> CYRILLIC SMALL LETTER TE
316 "\xC3" => "\xE3", # CYRILLIC CAPITAL LETTER U --> CYRILLIC SMALL LETTER U
317 "\xC4" => "\xE4", # CYRILLIC CAPITAL LETTER EF --> CYRILLIC SMALL LETTER EF
318 "\xC5" => "\xE5", # CYRILLIC CAPITAL LETTER HA --> CYRILLIC SMALL LETTER HA
319 "\xC6" => "\xE6", # CYRILLIC CAPITAL LETTER TSE --> CYRILLIC SMALL LETTER TSE
320 "\xC7" => "\xE7", # CYRILLIC CAPITAL LETTER CHE --> CYRILLIC SMALL LETTER CHE
321 "\xC8" => "\xE8", # CYRILLIC CAPITAL LETTER SHA --> CYRILLIC SMALL LETTER SHA
322 "\xC9" => "\xE9", # CYRILLIC CAPITAL LETTER SHCHA --> CYRILLIC SMALL LETTER SHCHA
323 "\xCA" => "\xEA", # CYRILLIC CAPITAL LETTER HARD SIGN --> CYRILLIC SMALL LETTER HARD SIGN
324 "\xCB" => "\xEB", # CYRILLIC CAPITAL LETTER YERU --> CYRILLIC SMALL LETTER YERU
325 "\xCC" => "\xEC", # CYRILLIC CAPITAL LETTER SOFT SIGN --> CYRILLIC SMALL LETTER SOFT SIGN
326 "\xCD" => "\xED", # CYRILLIC CAPITAL LETTER E --> CYRILLIC SMALL LETTER E
327 "\xCE" => "\xEE", # CYRILLIC CAPITAL LETTER YU --> CYRILLIC SMALL LETTER YU
328 "\xCF" => "\xEF", # CYRILLIC CAPITAL LETTER YA --> CYRILLIC SMALL LETTER YA
329 );
330 }
331  
332 else {
333 0 croak "Don't know my package name '@{[__PACKAGE__]}'";
334 }
335  
336 #
337 # @ARGV wildcard globbing
338 #
339 212 ▶sub import {
Subroutine import: called CC=7 SCAR=28.3
340  
341 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
342 0 my @argv = ();
343 0 for (@ARGV) {
344  
345 # has space
346 0 ▶ if (/\A (?:$q_char)*? [ ] /oxms) {
Branch: 2 branches
BranchTrueFalseTotal
if (/\A (?:$Ecyrillic::q_char)*? [ ] /mosx) { } 0 0 0
elsif (/\A (?:$Ecyrillic::q_char)*? [*?] /mosx) { } 0 0 0
347 0 ▶ if (my @glob = Ecyrillic::glob(qq{"$_"})) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@glob) = &Ecyrillic::glob(qq["$_"])) { } 0 0 0
348 0 push @argv, @glob;
349 }
350 else {
351 0 push @argv, $_;
352 }
353 }
354  
355 # has wildcard metachar
356 elsif (/\A (?:$q_char)*? [*?] /oxms) {
357 0 ▶ if (my @glob = Ecyrillic::glob($_)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@glob) = &Ecyrillic::glob($_)) { } 0 0 0
358 0 push @argv, @glob;
359 }
360 else {
361 0 push @argv, $_;
362 }
363 }
364  
365 # no wildcard globbing
366 else {
367 0 push @argv, $_;
368 }
369 }
370 0 @ARGV = @argv;
371 }
372  
373 212 *Char::ord = \&Cyrillic::ord;
374 212 *Char::ord_ = \&Cyrillic::ord_;
375 212 *Char::reverse = \&Cyrillic::reverse;
376 212 *Char::getc = \&Cyrillic::getc;
377 212 *Char::length = \&Cyrillic::length;
378 212 *Char::substr = \&Cyrillic::substr;
379 212 *Char::index = \&Cyrillic::index;
380 212 *Char::rindex = \&Cyrillic::rindex;
381 212 *Char::eval = \&Cyrillic::eval;
382 212 *Char::escape = \&Cyrillic::escape;
383 212 *Char::escape_token = \&Cyrillic::escape_token;
384 212 *Char::escape_script = \&Cyrillic::escape_script;
385 }
386  
387 # P.230 Care with Prototypes
388 # in Chapter 6: Subroutines
389 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
390 #
391 # If you aren't careful, you can get yourself into trouble with prototypes.
392 # But if you are careful, you can do a lot of neat things with them. This is
393 # all very powerful, of course, and should only be used in moderation to make
394 # the world a better place.
395  
396 # P.332 Care with Prototypes
397 # in Chapter 7: Subroutines
398 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
399 #
400 # If you aren't careful, you can get yourself into trouble with prototypes.
401 # But if you are careful, you can do a lot of neat things with them. This is
402 # all very powerful, of course, and should only be used in moderation to make
403 # the world a better place.
404  
405 #
406 # Prototypes of subroutines
407 #
408 0 ▶sub unimport {}
Subroutine unimport: not called CC=1 SCAR=0.0
409 sub Ecyrillic::split(;$$$);
410 sub Ecyrillic::tr($$$$;$);
411 sub Ecyrillic::chop(@);
412 sub Ecyrillic::index($$;$);
413 sub Ecyrillic::rindex($$;$);
414 sub Ecyrillic::lcfirst(@);
415 sub Ecyrillic::lcfirst_();
416 sub Ecyrillic::lc(@);
417 sub Ecyrillic::lc_();
418 sub Ecyrillic::ucfirst(@);
419 sub Ecyrillic::ucfirst_();
420 sub Ecyrillic::uc(@);
421 sub Ecyrillic::uc_();
422 sub Ecyrillic::fc(@);
423 sub Ecyrillic::fc_();
424 sub Ecyrillic::ignorecase;
425 sub Ecyrillic::classic_character_class;
426 sub Ecyrillic::capture;
427 sub Ecyrillic::chr(;$);
428 sub Ecyrillic::chr_();
429 sub Ecyrillic::glob($);
430 sub Ecyrillic::glob_();
431  
432 sub Cyrillic::ord(;$);
433 sub Cyrillic::ord_();
434 sub Cyrillic::reverse(@);
435 sub Cyrillic::getc(;*@);
436 sub Cyrillic::length(;$);
437 sub Cyrillic::substr($$;$$);
438 sub Cyrillic::index($$;$);
439 sub Cyrillic::rindex($$;$);
440 sub Cyrillic::escape(;$);
441  
442 #
443 # Regexp work
444 #
445 424 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
446 $re_a
447 $re_t
448 $re_n
449 $re_r
450 424 );
451  
452 #
453 # Character class
454 #
455 424 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
456 $dot
457 $dot_s
458 $eD
459 $eS
460 $eW
461 $eH
462 $eV
463 $eR
464 $eN
465 $not_alnum
466 $not_alpha
467 $not_ascii
468 $not_blank
469 $not_cntrl
470 $not_digit
471 $not_graph
472 $not_lower
473 $not_lower_i
474 $not_print
475 $not_punct
476 $not_space
477 $not_upper
478 $not_upper_i
479 $not_word
480 $not_xdigit
481 $eb
482 $eB
483 424 );
484  
485 424 ${Ecyrillic::dot} = qr{(?>[^\x0A])};
486 424 ${Ecyrillic::dot_s} = qr{(?>[\x00-\xFF])};
487 424 ${Ecyrillic::eD} = qr{(?>[^0-9])};
488  
489 # Vertical tabs are now whitespace
490 # \s in a regex now matches a vertical tab in all circumstances.
491 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
492 # ${Ecyrillic::eS} = qr{(?>[^\x09\x0A \x0C\x0D\x20])};
493 # ${Ecyrillic::eS} = qr{(?>[^\x09\x0A\x0B\x0C\x0D\x20])};
494 424 ${Ecyrillic::eS} = qr{(?>[^\s])};
495  
496 424 ${Ecyrillic::eW} = qr{(?>[^0-9A-Z_a-z])};
497 424 ${Ecyrillic::eH} = qr{(?>[^\x09\x20])};
498 424 ${Ecyrillic::eV} = qr{(?>[^\x0A\x0B\x0C\x0D])};
499 424 ${Ecyrillic::eR} = qr{(?>\x0D\x0A|[\x0A\x0D])};
500 424 ${Ecyrillic::eN} = qr{(?>[^\x0A])};
501 424 ${Ecyrillic::not_alnum} = qr{(?>[^\x30-\x39\x41-\x5A\x61-\x7A])};
502 424 ${Ecyrillic::not_alpha} = qr{(?>[^\x41-\x5A\x61-\x7A])};
503 424 ${Ecyrillic::not_ascii} = qr{(?>[^\x00-\x7F])};
504 424 ${Ecyrillic::not_blank} = qr{(?>[^\x09\x20])};
505 424 ${Ecyrillic::not_cntrl} = qr{(?>[^\x00-\x1F\x7F])};
506 424 ${Ecyrillic::not_digit} = qr{(?>[^\x30-\x39])};
507 424 ${Ecyrillic::not_graph} = qr{(?>[^\x21-\x7F])};
508 424 ${Ecyrillic::not_lower} = qr{(?>[^\x61-\x7A])};
509 424 ${Ecyrillic::not_lower_i} = qr{(?>[^\x41-\x5A\x61-\x7A])}; # Perl 5.16 compatible
510 # ${Ecyrillic::not_lower_i} = qr{(?>[\x00-\xFF])}; # older Perl compatible
511 424 ${Ecyrillic::not_print} = qr{(?>[^\x20-\x7F])};
512 424 ${Ecyrillic::not_punct} = qr{(?>[^\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E])};
513 424 ${Ecyrillic::not_space} = qr{(?>[^\s\x0B])};
514 424 ${Ecyrillic::not_upper} = qr{(?>[^\x41-\x5A])};
515 424 ${Ecyrillic::not_upper_i} = qr{(?>[^\x41-\x5A\x61-\x7A])}; # Perl 5.16 compatible
516 # ${Ecyrillic::not_upper_i} = qr{(?>[\x00-\xFF])}; # older Perl compatible
517 424 ${Ecyrillic::not_word} = qr{(?>[^\x30-\x39\x41-\x5A\x5F\x61-\x7A])};
518 424 ${Ecyrillic::not_xdigit} = qr{(?>[^\x30-\x39\x41-\x46\x61-\x66])};
519 424 ${Ecyrillic::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))};
520 424 ${Ecyrillic::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]))};
521  
522 # avoid: Name "Ecyrillic::foo" used only once: possible typo at here.
523 424 ${Ecyrillic::dot} = ${Ecyrillic::dot};
524 424 ${Ecyrillic::dot_s} = ${Ecyrillic::dot_s};
525 424 ${Ecyrillic::eD} = ${Ecyrillic::eD};
526 424 ${Ecyrillic::eS} = ${Ecyrillic::eS};
527 424 ${Ecyrillic::eW} = ${Ecyrillic::eW};
528 424 ${Ecyrillic::eH} = ${Ecyrillic::eH};
529 424 ${Ecyrillic::eV} = ${Ecyrillic::eV};
530 424 ${Ecyrillic::eR} = ${Ecyrillic::eR};
531 424 ${Ecyrillic::eN} = ${Ecyrillic::eN};
532 424 ${Ecyrillic::not_alnum} = ${Ecyrillic::not_alnum};
533 424 ${Ecyrillic::not_alpha} = ${Ecyrillic::not_alpha};
534 424 ${Ecyrillic::not_ascii} = ${Ecyrillic::not_ascii};
535 424 ${Ecyrillic::not_blank} = ${Ecyrillic::not_blank};
536 424 ${Ecyrillic::not_cntrl} = ${Ecyrillic::not_cntrl};
537 424 ${Ecyrillic::not_digit} = ${Ecyrillic::not_digit};
538 424 ${Ecyrillic::not_graph} = ${Ecyrillic::not_graph};
539 424 ${Ecyrillic::not_lower} = ${Ecyrillic::not_lower};
540 424 ${Ecyrillic::not_lower_i} = ${Ecyrillic::not_lower_i};
541 424 ${Ecyrillic::not_print} = ${Ecyrillic::not_print};
542 424 ${Ecyrillic::not_punct} = ${Ecyrillic::not_punct};
543 424 ${Ecyrillic::not_space} = ${Ecyrillic::not_space};
544 424 ${Ecyrillic::not_upper} = ${Ecyrillic::not_upper};
545 424 ${Ecyrillic::not_upper_i} = ${Ecyrillic::not_upper_i};
546 424 ${Ecyrillic::not_word} = ${Ecyrillic::not_word};
547 424 ${Ecyrillic::not_xdigit} = ${Ecyrillic::not_xdigit};
548 424 ${Ecyrillic::eb} = ${Ecyrillic::eb};
549 424 ${Ecyrillic::eB} = ${Ecyrillic::eB};
550  
551 #
552 # Cyrillic split
553 #
554 72 ▶sub Ecyrillic::split(;$$$) {
Subroutine split: called CC=34 SCAR=38.5
Pod undocumented
555  
556 # P.794 29.2.161. split
557 # in Chapter 29: Functions
558 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
559  
560 # P.951 split
561 # in Chapter 27: Functions
562 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
563  
564 72 my $pattern = $_[0];
565 72 my $string = $_[1];
566 72 my $limit = $_[2];
567  
568 # if $pattern is also omitted or is the literal space, " "
569 72 ▶ if (not defined $pattern) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $pattern) 2 70 72
570 2 $pattern = ' ';
571 }
572  
573 # if $string is omitted, the function splits the $_ string
574 72 ▶ if (not defined $string) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $string) 6 66 72
575 6 ▶ if (defined $_) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_) { } 0 6 6
576 0 $string = $_;
577 }
578 else {
579 6 $string = '';
580 }
581 }
582  
583 72 my @split = ();
584  
585 # when string is empty
586 72 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 10 62 72
elsif ($pattern eq ' ') { } 2 60 62
587  
588 # resulting list value in list context
589 10 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 5 5 10
590 5 return @split;
591 }
592  
593 # count of substrings in scalar context
594 else {
595 5 ▶ carp "Use of implicit split to \@_ is deprecated" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 5 5
596 5 @_ = @split;
597 5 return scalar @_;
598 }
599 }
600  
601 # split's first argument is more consistently interpreted
602 #
603 # After some changes earlier in v5.17, split's behavior has been simplified:
604 # if the PATTERN argument evaluates to a string containing one space, it is
605 # treated the way that a literal string containing one space once was.
606 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#split's_first_argument_is_more_consistently_interpreted
607  
608 # if $pattern is also omitted or is the literal space, " ", the function splits
609 # on whitespace, /\s+/, after skipping any leading whitespace
610 # (and so on)
611  
612 elsif ($pattern eq ' ') {
613 2 ▶ if (not defined $limit) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $limit) { } 2 0 2
614 2 return CORE::split(' ', $string);
615 }
616 else {
617 0 return CORE::split(' ', $string, $limit);
618 }
619 }
620  
621 # if $limit is negative, it is treated as if an arbitrarily large $limit has been specified
622 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
623  
624 # a pattern capable of matching either the null string or something longer than the
625 # null string will split the value of $string into separate characters wherever it
626 # matches the null string between characters
627 # (and so on)
628  
629 60 ▶ if ('' =~ / \A $pattern \z /xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ('' =~ / \A $pattern \z /msx) { } 2 58 60
630 2 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
631 2 my $limit = scalar(() = $string =~ /($pattern)/oxmsg);
632  
633 # P.1024 Appendix W.10 Multibyte Processing
634 # of ISBN 1-56592-224-7 CJKV Information Processing
635 # (and so on)
636  
637 # the //m modifier is assumed when you split on the pattern /^/
638 # (and so on)
639  
640 2 ▶ eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
Subroutine BEGIN: called CC=1 SCAR=0.0
641 # V
642 2 ▶ while ((--$limit > 0) and ($string =~ s/\A((?:$q_char)+?)$pattern//m)) {
Branch: 1 branch
BranchTrueFalseTotal
if (--$limit > 0 and $string =~ s/\A((?:$Ecyrillic::q_char)+?)$pattern//m) 9 2 11
Condition100%3/3
--$limit > 0 and $string =~ s/\A((?:$Ecyrillic::q_char)+?)$pattern//m
!ll&&!rl&&r
119
MC/DC100%2/2
--$limit > 0 and $string =~ s/\A((?:$Ecyrillic::q_char)+?)$pattern//m
--$limit > 0 $string =~ s/\A((?:$Ecyrillic::q_char)+?)$pattern//m
Truth table100%3/3
A and B
A= --$limit > 0B= $string =~ s/\A((?:$Ecyrillic::q_char)+?)$pattern//m
ABresult
0X0
100
111
643  
644 # if the $pattern contains parentheses, then the substring matched by each pair of parentheses
645 # is included in the resulting list, interspersed with the fields that are ordinarily returned
646 # (and so on)
647  
648 9 local $@;
649 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
650 9 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 9 9 18
651 9 push @split, CORE::eval('$' . $digit);
652 }
653 }
654 }
655  
656 else {
657 58 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
658  
659 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
660 # V
661 58 ▶ while ($string =~ s/\A((?:$q_char)*?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Ecyrillic::q_char)*?)$pattern//m) 163 58 221
662 163 local $@;
663 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
664 163 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 230 163 393
665 230 push @split, CORE::eval('$' . $digit);
666 }
667 }
668 }
669 }
670  
671 elsif ($limit > 0) {
672 0 ▶ if ('' =~ / \A $pattern \z /xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ('' =~ / \A $pattern \z /msx) { } 0 0 0
673 0 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
674 0 ▶ while ((--$limit > 0) and (CORE::length($string) > 0)) {
Branch: 1 branch
BranchTrueFalseTotal
if (--$limit > 0 and length $string > 0) 0 0 0
Condition0%0/3
--$limit > 0 and length $string > 0
!ll&&!rl&&r
000
MC/DC0%0/2
--$limit > 0 and length $string > 0
--$limit > 0 length $string > 0
Truth table0%0/3
A and B
A= --$limit > 0B= length $string > 0
ABresult
0X0
100
111
675  
676 0 eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
677 # V
678 0 ▶ if ($string =~ s/\A((?:$q_char)+?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Ecyrillic::q_char)+?)$pattern//m) 0 0 0
679 0 local $@;
680 0 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 0 0 0
681 0 push @split, CORE::eval('$' . $digit);
682 }
683 }
684 }
685 }
686 else {
687 0 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
688 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
689  
690 0 eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
691 # V
692 0 ▶ if ($string =~ s/\A((?:$q_char)*?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Ecyrillic::q_char)*?)$pattern//m) 0 0 0
693 0 local $@;
694 0 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 0 0 0
695 0 push @split, CORE::eval('$' . $digit);
696 }
697 }
698 }
699 }
700 }
701  
702 60 ▶ if (CORE::length($string) > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $string > 0) 58 2 60
703 58 push @split, $string;
704 }
705  
706 # if $_[2] (NOT "$limit") is omitted or zero, trailing null fields are stripped from the result
707 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
708 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
709 0 pop @split;
710 }
711 }
712  
713 # resulting list value in list context
714 60 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 58 2 60
715 58 return @split;
716 }
717  
718 # count of substrings in scalar context
719 else {
720 2 ▶ carp "Use of implicit split to \@_ is deprecated" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 2 2
721 2 @_ = @split;
722 2 return scalar @_;
723 }
724 }
725  
726 #
727 # get last subexpression offsets
728 #
729 60 ▶sub _last_subexpression_offsets {
Subroutine _last_subexpression_offsets: called CC=3 SCAR=11.0
730 60 my $pattern = $_[0];
731  
732 # remove comment
733 60 $pattern =~ s/\(\?\# .*? \)//oxmsg;
734  
735 60 my $modifier = '';
736 60 ▶ if ($pattern =~ /\(\?\^? ([\-A-Za-z]+) :/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pattern =~ /\(\?\^? ([\-A-Za-z]+) :/mosx) 11 49 60
737 11 $modifier = $1;
738 11 $modifier =~ s/-[A-Za-z]*//;
739 }
740  
741 # with /x modifier
742 60 my @char = ();
743 60 ▶ if ($modifier =~ /x/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /x/mosx) { } 5 55 60
744 5 @char = $pattern =~ /\G((?>
745 [^\\\#\[\(] |
746 \\ $q_char |
747 \# (?>[^\n]*) $ |
748 \[ (?>(?:[^\\\]]|\\\\|\\\]|$q_char)+) \] |
749 \(\? |
750 $q_char
751 ))/oxmsg;
752 }
753  
754 # without /x modifier
755 else {
756 55 @char = $pattern =~ /\G((?>
757 [^\\\[\(] |
758 \\ $q_char |
759 \[ (?>(?:[^\\\]]|\\\\|\\\]|$q_char)+) \] |
760 \(\? |
761 $q_char
762 ))/oxmsg;
763 }
764  
765 60 return scalar grep { $_ eq '(' } @char;
766 }
767  
768 #
769 # Cyrillic transliteration (tr///)
770 #
771 6 ▶sub Ecyrillic::tr($$$$;$) {
Subroutine tr: called CC=26 SCAR=48.6
Pod undocumented
772  
773 6 my $bind_operator = $_[1];
774 6 my $searchlist = $_[2];
775 6 my $replacementlist = $_[3];
776 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
777  
778 6 ▶ if ($modifier =~ /r/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /r/mosx) 5 1 6
779 5 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) 0 5 5
780 0 croak "Using !~ with tr///r doesn't make sense";
781 }
782 }
783  
784 6 my @char = $_[0] =~ /\G (?>$q_char) /oxmsg;
785 6 my @searchlist = _charlist_tr($searchlist);
786 6 my @replacementlist = _charlist_tr($replacementlist);
787  
788 6 my %tr = ();
789 6 ▶ for (my $i=0; $i <= $#searchlist; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#searchlist) 19 6 25
790 19 ▶ if (not exists $tr{$searchlist[$i]}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $tr{$searchlist[$i]}) 19 0 19
791 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
792 19 $tr{$searchlist[$i]} = $replacementlist[$i];
793 }
794 elsif ($modifier =~ /d/oxms) {
795 0 $tr{$searchlist[$i]} = '';
796 }
797 ▶ 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
798 0 $tr{$searchlist[$i]} = $replacementlist[-1];
799 }
800 else {
801 0 $tr{$searchlist[$i]} = $searchlist[$i];
802 }
803 }
804 }
805  
806 6 my $tr = 0;
807 6 my $replaced = '';
808 6 ▶ if ($modifier =~ /c/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /c/mosx) { } 0 6 6
809 0 ▶ while (defined(my $char = shift @char)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $char = shift @char)) 0 0 0
810 0 ▶ if (not exists $tr{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $tr{$char}) { } 0 0 0
811 0 ▶ if (defined $replacementlist[-1]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $replacementlist[-1]) 0 0 0
812 0 $replaced .= $replacementlist[-1];
813 }
814 0 $tr++;
815 0 ▶ if ($modifier =~ /s/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/mosx) 0 0 0
816 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
817 0 shift @char;
818 0 $tr++;
819 }
820 }
821 }
822 else {
823 0 $replaced .= $char;
824 }
825 }
826 }
827 else {
828 6 ▶ while (defined(my $char = shift @char)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $char = shift @char)) 36 6 42
829 36 ▶ if (exists $tr{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $tr{$char}) { } 19 17 36
830 19 $replaced .= $tr{$char};
831 19 $tr++;
832 19 ▶ if ($modifier =~ /s/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/mosx) 0 19 19
833 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
834 0 shift @char;
835 0 $tr++;
836 }
837 }
838 }
839 else {
840 17 $replaced .= $char;
841 }
842 }
843 }
844  
845 6 ▶ if ($modifier =~ /r/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /r/mosx) { } 5 1 6
846 5 return $replaced;
847 }
848 else {
849 1 $_[0] = $replaced;
850 1 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) { } 0 1 1
851 0 return not $tr;
852 }
853 else {
854 1 return $tr;
855 }
856 }
857 }
858  
859 #
860 # Cyrillic chop
861 #
862 0 ▶sub Ecyrillic::chop(@) {
Subroutine chop: not called CC=3 SCAR=24.8
Pod undocumented
863  
864 0 my $chop;
865 0 ▶ if (@_ == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 0) { } 0 0 0
866 0 my @char = /\G (?>$q_char) /oxmsg;
867 0 $chop = pop @char;
868 0 $_ = join '', @char;
869 }
870 else {
871 0 for (@_) {
872 0 my @char = /\G (?>$q_char) /oxmsg;
873 0 $chop = pop @char;
874 0 $_ = join '', @char;
875 }
876 }
877 0 return $chop;
878 }
879  
880 #
881 # Cyrillic index by octet
882 #
883 30 ▶sub Ecyrillic::index($$;$) {
Subroutine index: called CC=6 SCAR=20.8
Pod documented
884  
885 30 my($str,$substr,$position) = @_;
886 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
887 30 my $pos = 0;
888  
889 30 ▶ while ($pos < CORE::length($str)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos < length $str) 130 30 160
890 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
891 0 ▶ if ($pos >= $position) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos >= $position) 0 0 0
892 0 return $pos;
893 }
894 }
895 130 ▶ if (CORE::substr($str,$pos) =~ /\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($str, $pos) =~ /\A ($Ecyrillic::q_char) /mosx) { } 130 0 130
896 130 $pos += CORE::length($1);
897 }
898 else {
899 0 $pos += 1;
900 }
901 }
902 30 return -1;
903 }
904  
905 #
906 # Cyrillic reverse index
907 #
908 0 ▶sub Ecyrillic::rindex($$;$) {
Subroutine rindex: not called CC=6 SCAR=37.4
Pod undocumented
909  
910 0 my($str,$substr,$position) = @_;
911 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
912 0 my $pos = 0;
913 0 my $rindex = -1;
914  
915 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
916 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
917 0 $rindex = $pos;
918 }
919 0 ▶ if (CORE::substr($str,$pos) =~ /\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($str, $pos) =~ /\A ($Ecyrillic::q_char) /mosx) { } 0 0 0
920 0 $pos += CORE::length($1);
921 }
922 else {
923 0 $pos += 1;
924 }
925 }
926 0 return $rindex;
927 }
928  
929 #
930 # Cyrillic lower case first with parameter
931 #
932 0 ▶sub Ecyrillic::lcfirst(@) {
Subroutine lcfirst: not called CC=4 SCAR=30.0
Pod undocumented
933 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
934 0 my $s = shift @_;
935 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
936 0 return Ecyrillic::lc(CORE::substr($s,0,1)) . CORE::substr($s,1), @_;
937 }
938 else {
939 0 return Ecyrillic::lc(CORE::substr($s,0,1)) . CORE::substr($s,1);
940 }
941 }
942 else {
943 0 return Ecyrillic::lc(CORE::substr($_,0,1)) . CORE::substr($_,1);
944 }
945 }
946  
947 #
948 # Cyrillic lower case first without parameter
949 #
950 0 ▶sub Ecyrillic::lcfirst_() {
Subroutine lcfirst_: not called CC=1 SCAR=6.9
Pod undocumented
951 0 return Ecyrillic::lc(CORE::substr($_,0,1)) . CORE::substr($_,1);
952 }
953  
954 #
955 # Cyrillic lower case with parameter
956 #
957 73 ▶sub Ecyrillic::lc(@) {
Subroutine lc: called CC=6 SCAR=24.2
Pod undocumented
958 73 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 73 0 73
959 73 my $s = shift @_;
960 73 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 73 73
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
7300
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
961 0 ▶ return join('', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 0 0 0
962 }
963 else {
964 73 ▶ return join('', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 75 0 75
965 }
966 }
967 else {
968 0 return Ecyrillic::lc_();
969 }
970 }
971  
972 #
973 # Cyrillic lower case without parameter
974 #
975 0 ▶sub Ecyrillic::lc_() {
Subroutine lc_: not called CC=2 SCAR=17.9
Pod undocumented
976 0 my $s = $_;
977 0 ▶ return join '', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 0 0 0
978 }
979  
980 #
981 # Cyrillic upper case first with parameter
982 #
983 0 ▶sub Ecyrillic::ucfirst(@) {
Subroutine ucfirst: not called CC=4 SCAR=30.0
Pod undocumented
984 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
985 0 my $s = shift @_;
986 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
987 0 return Ecyrillic::uc(CORE::substr($s,0,1)) . CORE::substr($s,1), @_;
988 }
989 else {
990 0 return Ecyrillic::uc(CORE::substr($s,0,1)) . CORE::substr($s,1);
991 }
992 }
993 else {
994 0 return Ecyrillic::uc(CORE::substr($_,0,1)) . CORE::substr($_,1);
995 }
996 }
997  
998 #
999 # Cyrillic upper case first without parameter
1000 #
1001 0 ▶sub Ecyrillic::ucfirst_() {
Subroutine ucfirst_: not called CC=1 SCAR=6.9
Pod undocumented
1002 0 return Ecyrillic::uc(CORE::substr($_,0,1)) . CORE::substr($_,1);
1003 }
1004  
1005 #
1006 # Cyrillic upper case with parameter
1007 #
1008 2636 ▶sub Ecyrillic::uc(@) {
Subroutine uc: called CC=6 SCAR=22.9
Pod undocumented
1009 2636 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2636 0 2636
1010 2636 my $s = shift @_;
1011 2636 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 2636 2636
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
263600
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
1012 0 ▶ return join('', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 0 0 0
1013 }
1014 else {
1015 2636 ▶ return join('', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 939 1699 2638
1016 }
1017 }
1018 else {
1019 0 return Ecyrillic::uc_();
1020 }
1021 }
1022  
1023 #
1024 # Cyrillic upper case without parameter
1025 #
1026 0 ▶sub Ecyrillic::uc_() {
Subroutine uc_: not called CC=2 SCAR=17.9
Pod undocumented
1027 0 my $s = $_;
1028 0 ▶ return join '', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 0 0 0
1029 }
1030  
1031 #
1032 # Cyrillic fold case with parameter
1033 #
1034 2634 ▶sub Ecyrillic::fc(@) {
Subroutine fc: called CC=6 SCAR=22.9
Pod undocumented
1035 2634 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2634 0 2634
1036 2634 my $s = shift @_;
1037 2634 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 2634 2634
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
263400
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
1038 0 ▶ return join('', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 0 0 0
1039 }
1040 else {
1041 2634 ▶ return join('', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 2086 6540 8626
1042 }
1043 }
1044 else {
1045 0 return Ecyrillic::fc_();
1046 }
1047 }
1048  
1049 #
1050 # Cyrillic fold case without parameter
1051 #
1052 0 ▶sub Ecyrillic::fc_() {
Subroutine fc_: not called CC=2 SCAR=17.9
Pod undocumented
1053 0 my $s = $_;
1054 0 ▶ return join '', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 0 0 0
1055 }
1056  
1057 #
1058 # Cyrillic regexp capture
1059 #
1060 {
1061 0 ▶ sub Ecyrillic::capture {
Subroutine capture: not called CC=1 SCAR=6.9
Pod documented
1062 0 return $_[0];
1063 }
1064 }
1065  
1066 #
1067 # Cyrillic regexp ignore case modifier
1068 #
1069 424 ▶sub Ecyrillic::ignorecase {
Subroutine ignorecase: called CC=25 SCAR=52.9
Pod undocumented
1070  
1071 11 my @string = @_;
1072 11 my $metachar = qr/[\@\\|[\]{]/oxms;
1073  
1074 # ignore case of $scalar or @array
1075 11 for my $string (@string) {
1076  
1077 # split regexp
1078 11 my @char = $string =~ /\G (?>\[\^|\\$q_char|$q_char) /oxmsg;
1079  
1080 # unescape character
1081 11 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1159 11 1170
1082 1159 ▶ next if not defined $char[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $char[$i] 0 1159 1159
1083  
1084 # open character class [...]
1085 1159 ▶ if ($char[$i] eq '[') {
Branch: 4 branches
BranchTrueFalseTotal
if ($char[$i] eq '[') { } 0 1159 1159
elsif ($char[$i] eq '[^') { } 0 1159 1159
elsif (my $char = classic_character_class($char[$i])) { } 0 1159 1159
elsif ($char[$i] =~ /\A [\x00-\xFF] \z/mosx) { } 1159 0 1159
1086 0 my $left = $i;
1087  
1088 # [] make die "unmatched [] in regexp ...\n"
1089  
1090 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
1091 0 $i++;
1092 }
1093  
1094 0 while (1) {
1095 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
1096 0 croak "Unmatched [] in regexp";
1097 }
1098 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
1099 0 my $right = $i;
1100 0 my @charlist = charlist_qr(@char[$left+1..$right-1], 'i');
1101  
1102 # escape character
1103 0 for my $char (@charlist) {
1104 0 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $char =~ /\A [.|)] \z/mosx }) 0 0 0
1105 }
1106  
1107 0 elsif ($char =~ /\A [.|)] \z/oxms) {
1108 0 $char = '\\' . $char;
1109 }
1110 }
1111  
1112 # [...]
1113 0 splice @char, $left, $right-$left+1, '(?:' . join('|', @charlist) . ')';
1114  
1115 0 $i = $left;
1116 0 last;
1117 }
1118 }
1119 }
1120  
1121 # open character class [^...]
1122 elsif ($char[$i] eq '[^') {
1123 0 my $left = $i;
1124  
1125 # [^] make die "unmatched [] in regexp ...\n"
1126  
1127 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
1128 0 $i++;
1129 }
1130  
1131 0 while (1) {
1132 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
1133 0 croak "Unmatched [] in regexp";
1134 }
1135 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
1136 0 my $right = $i;
1137 0 my @charlist = charlist_not_qr(@char[$left+1..$right-1], 'i');
1138  
1139 # escape character
1140 0 for my $char (@charlist) {
1141 0 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $char =~ /\A [.|)] \z/mosx }) 0 0 0
1142 }
1143  
1144 0 elsif ($char =~ /\A [.|)] \z/oxms) {
1145 0 $char = '\\' . $char;
1146 }
1147 }
1148  
1149 # [^...]
1150 0 splice @char, $left, $right-$left+1, '(?!' . join('|', @charlist) . ")(?:$your_char)";
1151  
1152 0 $i = $left;
1153 0 last;
1154 }
1155 }
1156 }
1157  
1158 # rewrite classic character class or escape character
1159 elsif (my $char = classic_character_class($char[$i])) {
1160 0 $char[$i] = $char;
1161 }
1162  
1163 # with /i modifier
1164 elsif ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) {
1165 1159 my $uc = Ecyrillic::uc($char[$i]);
1166 1159 my $fc = Ecyrillic::fc($char[$i]);
1167 1159 ▶ if ($uc ne $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc ne $fc) 591 568 1159
1168 591 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 591 0 591
1169 591 $char[$i] = '[' . $uc . $fc . ']';
1170 }
1171 else {
1172 0 $char[$i] = '(?:' . $uc . '|' . $fc . ')';
1173 }
1174 }
1175 }
1176 }
1177  
1178 # characterize
1179 11 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1159 11 1170
1180 1159 ▶ next if not defined $char[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $char[$i] 0 1159 1159
1181  
1182 1159 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx }) 0 1170 1170
1183 }
1184  
1185 # quote character before ? + * {
1186 0 ▶ elsif (($i >= 1) and ($char[$i] =~ /\A [\?\+\*\{] \z/oxms)) {
Condition66%2/3
$i >= 1 && $char[$i] =~ /\A [\?\+\*\{] \z/mosx
!ll&&!rl&&r
1111480
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
1187 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
1188 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
1189 }
1190 }
1191 }
1192  
1193 11 $string = join '', @char;
1194 }
1195  
1196 # make regexp string
1197 11 return @string;
1198 }
1199  
1200 #
1201 # classic character class ( \D \S \W \d \s \w \C \X \H \V \h \v \R \N \b \B )
1202 #
1203 3027 ▶sub Ecyrillic::classic_character_class {
Subroutine classic_character_class: called CC=2 SCAR=6.9
Pod undocumented
1204 3027 my($char) = @_;
1205  
1206 return {
1207 '\D' => '${Ecyrillic::eD}',
1208 '\S' => '${Ecyrillic::eS}',
1209 '\W' => '${Ecyrillic::eW}',
1210 '\d' => '[0-9]',
1211  
1212 # Before Perl 5.6, \s only matched the five whitespace characters
1213 # tab, newline, form-feed, carriage return, and the space character
1214 # itself, which, taken together, is the character class [\t\n\f\r ].
1215  
1216 # Vertical tabs are now whitespace
1217 # \s in a regex now matches a vertical tab in all circumstances.
1218 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
1219 # \t \n \v \f \r space
1220 # '\s' => '[\x09\x0A \x0C\x0D\x20]',
1221 # '\s' => '[\x09\x0A\x0B\x0C\x0D\x20]',
1222 '\s' => '\s',
1223  
1224 '\w' => '[0-9A-Z_a-z]',
1225 '\C' => '[\x00-\xFF]',
1226 '\X' => 'X',
1227  
1228 # \h \v \H \V
1229  
1230 # P.114 Character Class Shortcuts
1231 # in Chapter 7: In the World of Regular Expressions
1232 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
1233  
1234 # P.357 13.2.3 Whitespace
1235 # in Chapter 13: perlrecharclass: Perl Regular Expression Character Classes
1236 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
1237 #
1238 # 0x00009 CHARACTER TABULATION h s
1239 # 0x0000a LINE FEED (LF) vs
1240 # 0x0000b LINE TABULATION v
1241 # 0x0000c FORM FEED (FF) vs
1242 # 0x0000d CARRIAGE RETURN (CR) vs
1243 # 0x00020 SPACE h s
1244  
1245 # P.196 Table 5-9. Alphanumeric regex metasymbols
1246 # in Chapter 5. Pattern Matching
1247 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1248  
1249 # (and so on)
1250  
1251 '\H' => '${Ecyrillic::eH}',
1252 '\V' => '${Ecyrillic::eV}',
1253 '\h' => '[\x09\x20]',
1254 '\v' => '[\x0A\x0B\x0C\x0D]',
1255 '\R' => '${Ecyrillic::eR}',
1256  
1257 # \N
1258 #
1259 # http://perldoc.perl.org/perlre.html
1260 # Character Classes and other Special Escapes
1261 # Any character but \n (experimental). Not affected by /s modifier
1262  
1263 '\N' => '${Ecyrillic::eN}',
1264  
1265 # \b \B
1266  
1267 # P.180 Boundaries: The \b and \B Assertions
1268 # in Chapter 5: Pattern Matching
1269 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
1270  
1271 # P.219 Boundaries: The \b and \B Assertions
1272 # in Chapter 5: Pattern Matching
1273 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1274  
1275 # \b really means (?:(?<=\w)(?!\w)|(?<!\w)(?=\w))
1276 # or (?:(?<=\A|\W)(?=\w)|(?<=\w)(?=\W|\z))
1277 '\b' => '${Ecyrillic::eb}',
1278  
1279 # \B really means (?:(?<=\w)(?=\w)|(?<!\w)(?!\w))
1280 # or (?:(?<=\w)(?=\w)|(?<=\W)(?=\W))
1281 '\B' => '${Ecyrillic::eB}',
1282  
1283 3027 ▶ }->{$char} || '';
Condition100%2/2
{'\\D', '${Ecyrillic::eD}', '\\S', '${Ecyrillic::eS}', '\\W', '${Ecyrillic::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Ecyrillic::eH}', '\\V', '${Ecyrillic::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Ecyrillic::eR}', '\\N', '${Ecyrillic::eN}', '\\b', '${Ecyrillic::eb}', '\\B', '${Ecyrillic::eB}'}->{$char} || ''
l!l
1012926
MC/DC100%1/1
{'\\D', '${Ecyrillic::eD}', '\\S', '${Ecyrillic::eS}', '\\W', '${Ecyrillic::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Ecyrillic::eH}', '\\V', '${Ecyrillic::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Ecyrillic::eR}', '\\N', '${Ecyrillic::eN}', '\\b', '${Ecyrillic::eb}', '\\B', '${Ecyrillic::eB}'}->{$char} || ''
{'\\D', '${Ecyrillic::eD}', '\\S', '${Ecyrillic::eS}', '\\W', '${Ecyrillic::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Ecyrillic::eH}', '\\V', '${Ecyrillic::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Ecyrillic::eR}', '\\N', '${Ecyrillic::eN}', '\\b', '${Ecyrillic::eb}', '\\B', '${Ecyrillic::eB}'}->{$char}
Truth table100%2/2
A
A= {'\\D', '${Ecyrillic::eD}', '\\S', '${Ecyrillic::eS}', '\\W', '${Ecyrillic::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Ecyrillic::eH}', '\\V', '${Ecyrillic::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Ecyrillic::eR}', '\\N', '${Ecyrillic::eN}', '\\b', '${Ecyrillic::eb}', '\\B', '${Ecyrillic::eB}'}->{$char}
Aresult
11
00
1284 }
1285  
1286 #
1287 # prepare Cyrillic characters per length
1288 #
1289  
1290 # 1 octet characters
1291 424 my @chars1 = ();
1292 0 ▶sub chars1 {
Subroutine chars1: not called CC=5 SCAR=34.0
Pod undocumented
1293 0 ▶ if (@chars1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars1) 0 0 0
1294 0 return @chars1;
1295 }
1296 0 ▶ if (exists $range_tr{1}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{1}) 0 0 0
1297 0 my @ranges = @{ $range_tr{1} };
1298 0 ▶ while (my @range = splice(@ranges,0,1)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 1)) 0 0 0
1299 0 for my $oct0 (@{$range[0]}) {
1300 0 push @chars1, pack 'C', $oct0;
1301 }
1302 }
1303 }
1304 0 return @chars1;
1305 }
1306  
1307 # 2 octets characters
1308 424 my @chars2 = ();
1309 0 ▶sub chars2 {
Subroutine chars2: not called CC=6 SCAR=37.4
Pod undocumented
1310 0 ▶ if (@chars2) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars2) 0 0 0
1311 0 return @chars2;
1312 }
1313 0 ▶ if (exists $range_tr{2}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{2}) 0 0 0
1314 0 my @ranges = @{ $range_tr{2} };
1315 0 ▶ while (my @range = splice(@ranges,0,2)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 2)) 0 0 0
1316 0 for my $oct0 (@{$range[0]}) {
1317 0 for my $oct1 (@{$range[1]}) {
1318 0 push @chars2, pack 'CC', $oct0,$oct1;
1319 }
1320 }
1321 }
1322 }
1323 0 return @chars2;
1324 }
1325  
1326 # 3 octets characters
1327 424 my @chars3 = ();
1328 0 ▶sub chars3 {
Subroutine chars3: not called CC=7 SCAR=40.3
Pod undocumented
1329 0 ▶ if (@chars3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars3) 0 0 0
1330 0 return @chars3;
1331 }
1332 0 ▶ if (exists $range_tr{3}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{3}) 0 0 0
1333 0 my @ranges = @{ $range_tr{3} };
1334 0 ▶ while (my @range = splice(@ranges,0,3)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 3)) 0 0 0
1335 0 for my $oct0 (@{$range[0]}) {
1336 0 for my $oct1 (@{$range[1]}) {
1337 0 for my $oct2 (@{$range[2]}) {
1338 0 push @chars3, pack 'CCC', $oct0,$oct1,$oct2;
1339 }
1340 }
1341 }
1342 }
1343 }
1344 0 return @chars3;
1345 }
1346  
1347 # 4 octets characters
1348 424 my @chars4 = ();
1349 0 ▶sub chars4 {
Subroutine chars4: not called CC=8 SCAR=42.8
Pod undocumented
1350 0 ▶ if (@chars4) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars4) 0 0 0
1351 0 return @chars4;
1352 }
1353 0 ▶ if (exists $range_tr{4}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{4}) 0 0 0
1354 0 my @ranges = @{ $range_tr{4} };
1355 0 ▶ while (my @range = splice(@ranges,0,4)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 4)) 0 0 0
1356 0 for my $oct0 (@{$range[0]}) {
1357 0 for my $oct1 (@{$range[1]}) {
1358 0 for my $oct2 (@{$range[2]}) {
1359 0 for my $oct3 (@{$range[3]}) {
1360 0 push @chars4, pack 'CCCC', $oct0,$oct1,$oct2,$oct3;
1361 }
1362 }
1363 }
1364 }
1365 }
1366 }
1367 0 return @chars4;
1368 }
1369  
1370 #
1371 # Cyrillic open character list for tr
1372 #
1373 12 ▶sub _charlist_tr {
Subroutine _charlist_tr: called CC=35 SCAR=66.4
1374  
1375 12 local $_ = shift @_;
1376  
1377 # unescape character
1378 12 my @char = ();
1379 12 ▶ while (not /\G \z/oxmsgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgmosx) 38 12 50
1380 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 \\ ($Ecyrillic::q_char) /cgmosx) { } 0 38 38
elsif (/\G ($Ecyrillic::q_char) /cgmosx) { } 38 0 38
1381 0 push @char, '\-';
1382 }
1383 elsif (/\G \\ ([0-7]{2,3}) /oxmsgc) {
1384 0 push @char, CORE::chr(oct $1);
1385 }
1386 elsif (/\G \\x ([0-9A-Fa-f]{1,2}) /oxmsgc) {
1387 0 push @char, CORE::chr(hex $1);
1388 }
1389 elsif (/\G \\c ([\x40-\x5F]) /oxmsgc) {
1390 0 push @char, CORE::chr(CORE::ord($1) & 0x1F);
1391 }
1392 elsif (/\G (\\ [0nrtfbae]) /oxmsgc) {
1393 push @char, {
1394 '\0' => "\0",
1395 '\n' => "\n",
1396 '\r' => "\r",
1397 '\t' => "\t",
1398 '\f' => "\f",
1399 '\b' => "\x08", # \b means backspace in character class
1400 '\a' => "\a",
1401 '\e' => "\e",
1402 0 }->{$1};
1403 }
1404 elsif (/\G \\ ($q_char) /oxmsgc) {
1405 0 push @char, $1;
1406 }
1407 elsif (/\G ($q_char) /oxmsgc) {
1408 38 push @char, $1;
1409 }
1410 }
1411  
1412 # join separated multiple-octet
1413 12 @char = join('',@char) =~ /\G (?>\\-|$q_char) /oxmsg;
1414  
1415 # unescape '-'
1416 12 my @i = ();
1417 12 for my $i (0 .. $#char) {
1418 38 ▶ if ($char[$i] eq '\-') {
Branch: 2 branches
BranchTrueFalseTotal
if ($char[$i] eq '\\-') { } 0 38 38
elsif ($char[$i] eq '-') { } 0 38 38
1419 0 $char[$i] = '-';
1420 }
1421 elsif ($char[$i] eq '-') {
1422 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
1423 0 push @i, $i;
1424 }
1425 }
1426 }
1427  
1428 # open character list (reverse for splice)
1429 12 for my $i (CORE::reverse @i) {
1430 0 my @range = ();
1431  
1432 # range error
1433 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
1434 0 croak "Invalid tr/// range \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1435 }
1436  
1437 # range of multiple-octet code
1438 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
1439 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
1440 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
1441 }
1442 elsif (CORE::length($char[$i+1]) == 2) {
1443 0 push @range, grep {$char[$i-1] le $_} chars1();
1444 0 push @range, grep {$_ le $char[$i+1]} chars2();
1445 }
1446 elsif (CORE::length($char[$i+1]) == 3) {
1447 0 push @range, grep {$char[$i-1] le $_} chars1();
1448 0 push @range, chars2();
1449 0 push @range, grep {$_ le $char[$i+1]} chars3();
1450 }
1451 elsif (CORE::length($char[$i+1]) == 4) {
1452 0 push @range, grep {$char[$i-1] le $_} chars1();
1453 0 push @range, chars2();
1454 0 push @range, chars3();
1455 0 push @range, grep {$_ le $char[$i+1]} chars4();
1456 }
1457 else {
1458 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1459 }
1460 }
1461 elsif (CORE::length($char[$i-1]) == 2) {
1462 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
1463 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
1464 }
1465 elsif (CORE::length($char[$i+1]) == 3) {
1466 0 push @range, grep {$char[$i-1] le $_} chars2();
1467 0 push @range, grep {$_ le $char[$i+1]} chars3();
1468 }
1469 elsif (CORE::length($char[$i+1]) == 4) {
1470 0 push @range, grep {$char[$i-1] le $_} chars2();
1471 0 push @range, chars3();
1472 0 push @range, grep {$_ le $char[$i+1]} chars4();
1473 }
1474 else {
1475 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1476 }
1477 }
1478 elsif (CORE::length($char[$i-1]) == 3) {
1479 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
1480 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
1481 }
1482 elsif (CORE::length($char[$i+1]) == 4) {
1483 0 push @range, grep {$char[$i-1] le $_} chars3();
1484 0 push @range, grep {$_ le $char[$i+1]} chars4();
1485 }
1486 else {
1487 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1488 }
1489 }
1490 elsif (CORE::length($char[$i-1]) == 4) {
1491 0 ▶ if (CORE::length($char[$i+1]) == 4) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $char[$i + 1] == 4) { } 0 0 0
1492 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
1493 }
1494 else {
1495 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1496 }
1497 }
1498 else {
1499 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1500 }
1501  
1502 0 splice @char, $i-1, 3, @range;
1503 }
1504  
1505 12 return @char;
1506 }
1507  
1508 #
1509 # Cyrillic open character class
1510 #
1511 0 ▶sub _cc {
Subroutine _cc: not called CC=7 SCAR=40.3
1512 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
1513 0 die __FILE__, ": subroutine cc got no parameter.\n";
1514 }
1515 elsif (scalar(@_) == 1) {
1516 0 return sprintf('\x%02X',$_[0]);
1517 }
1518 elsif (scalar(@_) == 2) {
1519 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
1520 0 die __FILE__, ": subroutine cc got \$_[0] > \$_[1] parameters).\n";
1521 }
1522 elsif ($_[0] == $_[1]) {
1523 0 return sprintf('\x%02X',$_[0]);
1524 }
1525 elsif (($_[0]+1) == $_[1]) {
1526 0 return sprintf('[\\x%02X\\x%02X]',$_[0],$_[1]);
1527 }
1528 else {
1529 0 return sprintf('[\\x%02X-\\x%02X]',$_[0],$_[1]);
1530 }
1531 }
1532 else {
1533 0 die __FILE__, ": subroutine cc got 3 or more parameters (@{[scalar(@_)]} parameters).\n";
1534 }
1535 }
1536  
1537 #
1538 # Cyrillic octet range
1539 #
1540 246 ▶sub _octets {
Subroutine _octets: called CC=5 SCAR=19.3
1541 246 my $length = shift @_;
1542  
1543 246 ▶ if ($length == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length == 1) { } 246 0 246
1544 246 my($a1) = unpack 'C', $_[0];
1545 246 my($z1) = unpack 'C', $_[1];
1546  
1547 246 ▶ if ($a1 > $z1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($a1 > $z1) 0 246 246
1548 0 croak 'Invalid [] range in regexp (CORE::ord(A) > CORE::ord(B)) ' . '\x' . unpack('H*',$a1) . '-\x' . unpack('H*',$z1);
1549 }
1550  
1551 246 ▶ if ($a1 == $z1) {
Branch: 2 branches
BranchTrueFalseTotal
if ($a1 == $z1) { } 0 246 246
elsif ($a1 + 1 == $z1) { } 0 246 246
1552 0 return sprintf('\x%02X',$a1);
1553 }
1554 elsif (($a1+1) == $z1) {
1555 0 return sprintf('\x%02X\x%02X',$a1,$z1);
1556 }
1557 else {
1558 246 return sprintf('\x%02X-\x%02X',$a1,$z1);
1559 }
1560 }
1561 else {
1562 0 die __FILE__, ": subroutine _octets got invalid length ($length).\n";
1563 }
1564 }
1565  
1566 #
1567 # Cyrillic range regexp
1568 #
1569 246 ▶sub _range_regexp {
Subroutine _range_regexp: called CC=18 SCAR=41.7
1570 246 my($length,$first,$last) = @_;
1571  
1572 246 my @range_regexp = ();
1573 246 ▶ if (not exists $range_tr{$length}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $range_tr{$length}) 0 246 246
1574 0 return @range_regexp;
1575 }
1576  
1577 246 my @ranges = @{ $range_tr{$length} };
1578 246 ▶ while (my @range = splice(@ranges,0,$length)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, $length)) 246 246 492
1579 246 my $min = '';
1580 246 my $max = '';
1581 246 ▶ for (my $i=0; $i < $length; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $length) 246 246 492
1582 246 $min .= pack 'C', $range[$i][0];
1583 246 $max .= pack 'C', $range[$i][-1];
1584 }
1585  
1586 # min___max
1587 # FIRST_____________LAST
1588 # (nothing)
1589  
1590 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
1591 }
1592  
1593 # **********
1594 # min_________max
1595 # FIRST_____________LAST
1596 # **********
1597  
1598 ▶ 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
1599 0 push @range_regexp, _octets($length,$first,$max,$min,$max);
1600 }
1601  
1602 # **********************
1603 # min________________max
1604 # FIRST_____________LAST
1605 # **********************
1606  
1607 ▶ 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
1608 0 push @range_regexp, _octets($length,$first,$last,$min,$max);
1609 }
1610  
1611 # *********
1612 # min___max
1613 # FIRST_____________LAST
1614 # *********
1615  
1616 ▶ 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
1617 0 push @range_regexp, _octets($length,$min,$max,$min,$max);
1618 }
1619  
1620 # **********************
1621 # min__________________________max
1622 # FIRST_____________LAST
1623 # **********************
1624  
1625 ▶ 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
1626 246 push @range_regexp, _octets($length,$first,$last,$min,$max);
1627 }
1628  
1629 # *********
1630 # min________max
1631 # FIRST_____________LAST
1632 # *********
1633  
1634 ▶ 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
1635 0 push @range_regexp, _octets($length,$min,$last,$min,$max);
1636 }
1637  
1638 # min___max
1639 # FIRST_____________LAST
1640 # (nothing)
1641  
1642 elsif ($last lt $min) {
1643 }
1644  
1645 else {
1646 0 die __FILE__, ": subroutine _range_regexp panic.\n";
1647 }
1648 }
1649  
1650 246 return @range_regexp;
1651 }
1652  
1653 #
1654 # Cyrillic open character list for qr and not qr
1655 #
1656 650 ▶sub _charlist {
Subroutine _charlist: called CC=46 SCAR=45.9
1657  
1658 650 my $modifier = pop @_;
1659 650 my @char = @_;
1660  
1661 650 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 298 352 650
1662  
1663 # unescape character
1664 650 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1773 650 2423
1665  
1666 # escape - to ...
1667 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 \\ ($Ecyrillic::q_char) \z/mosx) { } 7 1371 1378
1668 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
1669 246 $char[$i] = '...';
1670 }
1671 }
1672  
1673 # octal escape sequence
1674 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
1675 0 $char[$i] = octchr($1);
1676 }
1677  
1678 # hexadecimal escape sequence
1679 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
1680 0 $char[$i] = hexchr($1);
1681 }
1682  
1683 # \b{...} --> b\{...}
1684 # \B{...} --> B\{...}
1685 # \N{CHARNAME} --> N\{CHARNAME}
1686 # \p{PROPERTY} --> p\{PROPERTY}
1687 # \P{PROPERTY} --> P\{PROPERTY}
1688 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
1689 0 $char[$i] = $1 . '\\' . $2;
1690 }
1691  
1692 # \p, \P, \X --> p, P, X
1693 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
1694 0 $char[$i] = $1;
1695 }
1696  
1697 elsif ($char[$i] =~ /\A \\ ([0-7]{2,3}) \z/oxms) {
1698 0 $char[$i] = CORE::chr oct $1;
1699 }
1700 elsif ($char[$i] =~ /\A \\x ([0-9A-Fa-f]{1,2}) \z/oxms) {
1701 22 $char[$i] = CORE::chr hex $1;
1702 }
1703 elsif ($char[$i] =~ /\A \\c ([\x40-\x5F]) \z/oxms) {
1704 0 $char[$i] = CORE::chr(CORE::ord($1) & 0x1F);
1705 }
1706 elsif ($char[$i] =~ /\A (\\ [0nrtfbaedswDSWHVhvR]) \z/oxms) {
1707 $char[$i] = {
1708 '\0' => "\0",
1709 '\n' => "\n",
1710 '\r' => "\r",
1711 '\t' => "\t",
1712 '\f' => "\f",
1713 '\b' => "\x08", # \b means backspace in character class
1714 '\a' => "\a",
1715 '\e' => "\e",
1716 '\d' => '[0-9]',
1717  
1718 # Vertical tabs are now whitespace
1719 # \s in a regex now matches a vertical tab in all circumstances.
1720 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
1721 # \t \n \v \f \r space
1722 # '\s' => '[\x09\x0A \x0C\x0D\x20]',
1723 # '\s' => '[\x09\x0A\x0B\x0C\x0D\x20]',
1724 '\s' => '\s',
1725  
1726 '\w' => '[0-9A-Z_a-z]',
1727 '\D' => '${Ecyrillic::eD}',
1728 '\S' => '${Ecyrillic::eS}',
1729 '\W' => '${Ecyrillic::eW}',
1730  
1731 '\H' => '${Ecyrillic::eH}',
1732 '\V' => '${Ecyrillic::eV}',
1733 '\h' => '[\x09\x20]',
1734 '\v' => '[\x0A\x0B\x0C\x0D]',
1735 '\R' => '${Ecyrillic::eR}',
1736  
1737 25 }->{$1};
1738 }
1739  
1740 # POSIX-style character classes
1741 ▶ 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
1742 $char[$i] = {
1743  
1744 '[:lower:]' => '[\x41-\x5A\x61-\x7A]',
1745 '[:upper:]' => '[\x41-\x5A\x61-\x7A]',
1746 '[:^lower:]' => '${Ecyrillic::not_lower_i}',
1747 '[:^upper:]' => '${Ecyrillic::not_upper_i}',
1748  
1749 8 }->{$1};
1750 }
1751 elsif ($char[$i] =~ /\A ( \[\: \^? (?:alnum|alpha|ascii|blank|cntrl|digit|graph|lower|print|punct|space|upper|word|xdigit) :\] ) \z/oxms) {
1752 $char[$i] = {
1753  
1754 '[:alnum:]' => '[\x30-\x39\x41-\x5A\x61-\x7A]',
1755 '[:alpha:]' => '[\x41-\x5A\x61-\x7A]',
1756 '[:ascii:]' => '[\x00-\x7F]',
1757 '[:blank:]' => '[\x09\x20]',
1758 '[:cntrl:]' => '[\x00-\x1F\x7F]',
1759 '[:digit:]' => '[\x30-\x39]',
1760 '[:graph:]' => '[\x21-\x7F]',
1761 '[:lower:]' => '[\x61-\x7A]',
1762 '[:print:]' => '[\x20-\x7F]',
1763 '[:punct:]' => '[\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E]',
1764  
1765 # P.174 POSIX-Style Character Classes
1766 # in Chapter 5: Pattern Matching
1767 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
1768  
1769 # P.311 11.2.4 Character Classes and other Special Escapes
1770 # in Chapter 11: perlre: Perl regular expressions
1771 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
1772  
1773 # P.210 POSIX-Style Character Classes
1774 # in Chapter 5: Pattern Matching
1775 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1776  
1777 '[:space:]' => '[\s\x0B]', # "\s" plus vertical tab ("\cK")
1778  
1779 '[:upper:]' => '[\x41-\x5A]',
1780 '[:word:]' => '[\x30-\x39\x41-\x5A\x5F\x61-\x7A]',
1781 '[:xdigit:]' => '[\x30-\x39\x41-\x46\x61-\x66]',
1782 '[:^alnum:]' => '${Ecyrillic::not_alnum}',
1783 '[:^alpha:]' => '${Ecyrillic::not_alpha}',
1784 '[:^ascii:]' => '${Ecyrillic::not_ascii}',
1785 '[:^blank:]' => '${Ecyrillic::not_blank}',
1786 '[:^cntrl:]' => '${Ecyrillic::not_cntrl}',
1787 '[:^digit:]' => '${Ecyrillic::not_digit}',
1788 '[:^graph:]' => '${Ecyrillic::not_graph}',
1789 '[:^lower:]' => '${Ecyrillic::not_lower}',
1790 '[:^print:]' => '${Ecyrillic::not_print}',
1791 '[:^punct:]' => '${Ecyrillic::not_punct}',
1792 '[:^space:]' => '${Ecyrillic::not_space}',
1793 '[:^upper:]' => '${Ecyrillic::not_upper}',
1794 '[:^word:]' => '${Ecyrillic::not_word}',
1795 '[:^xdigit:]' => '${Ecyrillic::not_xdigit}',
1796  
1797 70 }->{$1};
1798 }
1799 elsif ($char[$i] =~ /\A \\ ($q_char) \z/oxms) {
1800 7 $char[$i] = $1;
1801 }
1802 }
1803  
1804 # open character list
1805 650 my @singleoctet = ();
1806 650 my @multipleoctet = ();
1807 650 ▶ for (my $i=0; $i <= $#char; ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1527 650 2177
1808  
1809 # escaped -
1810 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
1811 246 $i += 1;
1812 246 next;
1813 }
1814  
1815 # make range regexp
1816 elsif ($char[$i] eq '...') {
1817  
1818 # range error
1819 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
1820 0 croak 'Invalid [] range in regexp (length(A) > length(B)) ' . '\x' . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]);
1821 }
1822 elsif (CORE::length($char[$i-1]) == CORE::length($char[$i+1])) {
1823 246 ▶ if ($char[$i-1] gt $char[$i+1]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i - 1] gt $char[$i + 1]) 0 246 246
1824 0 croak 'Invalid [] range in regexp (CORE::ord(A) > CORE::ord(B)) ' . '\x' . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]);
1825 }
1826 }
1827  
1828 # make range regexp per length
1829 246 for my $length (CORE::length($char[$i-1]) .. CORE::length($char[$i+1])) {
1830 246 my @regexp = ();
1831  
1832 # is first and last
1833 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
1834 246 push @regexp, _range_regexp($length, $char[$i-1], $char[$i+1]);
1835 }
1836  
1837 # is first
1838 elsif ($length == CORE::length($char[$i-1])) {
1839 0 push @regexp, _range_regexp($length, $char[$i-1], "\xFF" x $length);
1840 }
1841  
1842 # is inside in first and last
1843 ▶ 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
1844 0 push @regexp, _range_regexp($length, "\x00" x $length, "\xFF" x $length);
1845 }
1846  
1847 # is last
1848 elsif ($length == CORE::length($char[$i+1])) {
1849 0 push @regexp, _range_regexp($length, "\x00" x $length, $char[$i+1]);
1850 }
1851  
1852 else {
1853 0 die __FILE__, ": subroutine make_regexp panic.\n";
1854 }
1855  
1856 246 ▶ if ($length == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length == 1) { } 246 0 246
1857 246 push @singleoctet, @regexp;
1858 }
1859 else {
1860 0 push @multipleoctet, @regexp;
1861 }
1862 }
1863  
1864 246 $i += 2;
1865 }
1866  
1867 # with /i modifier
1868 elsif ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) {
1869 949 ▶ if ($modifier =~ /i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) { } 480 469 949
1870 480 my $uc = Ecyrillic::uc($char[$i]);
1871 480 my $fc = Ecyrillic::fc($char[$i]);
1872 480 ▶ if ($uc ne $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc ne $fc) { } 240 240 480
1873 240 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 240 0 240
1874 240 push @singleoctet, $uc, $fc;
1875 }
1876 else {
1877 0 push @singleoctet, $uc;
1878 0 push @multipleoctet, $fc;
1879 }
1880 }
1881 else {
1882 240 push @singleoctet, $char[$i];
1883 }
1884 }
1885 else {
1886 469 push @singleoctet, $char[$i];
1887 }
1888 949 $i += 1;
1889 }
1890  
1891 # single character of single octet code
1892 elsif ($char[$i] =~ /\A (?: \\h ) \z/oxms) {
1893 0 push @singleoctet, "\t", "\x20";
1894 0 $i += 1;
1895 }
1896 elsif ($char[$i] =~ /\A (?: \\v ) \z/oxms) {
1897 0 push @singleoctet, "\x0A", "\x0B", "\x0C", "\x0D";
1898 0 $i += 1;
1899 }
1900 elsif ($char[$i] =~ /\A (?: \\d | \\s | \\w ) \z/oxms) {
1901 2 push @singleoctet, $char[$i];
1902 2 $i += 1;
1903 }
1904  
1905 # single character of multiple-octet code
1906 else {
1907 84 push @multipleoctet, $char[$i];
1908 84 $i += 1;
1909 }
1910 }
1911  
1912 # quote metachar
1913 650 for (@singleoctet) {
1914 1437 ▶ if ($_ eq '...') {
Branch: 5 branches
BranchTrueFalseTotal
if ($_ eq '...') { } 0 1437 1437
elsif (/\A \n \z/mosx) { } 8 1429 1437
elsif (/\A \r \z/mosx) { } 8 1421 1429
elsif (/\A ([\x00-\x20\x7F-\xFF]) \z/mosx) { } 744 677 1421
elsif (/\A [\x00-\xFF] \z/mosx) { } 429 248 677
1915 0 $_ = '-';
1916 }
1917 elsif (/\A \n \z/oxms) {
1918 8 $_ = '\n';
1919 }
1920 elsif (/\A \r \z/oxms) {
1921 8 $_ = '\r';
1922 }
1923 elsif (/\A ([\x00-\x20\x7F-\xFF]) \z/oxms) {
1924 744 $_ = sprintf('\x%02X', CORE::ord $1);
1925 }
1926 elsif (/\A [\x00-\xFF] \z/oxms) {
1927 429 $_ = quotemeta $_;
1928 }
1929 }
1930  
1931 # return character list
1932 650 return \@singleoctet, \@multipleoctet;
1933 }
1934  
1935 #
1936 # Cyrillic octal escape sequence
1937 #
1938 5 ▶sub octchr {
Subroutine octchr: called CC=2 SCAR=6.9
Pod undocumented
1939 5 my($octdigit) = @_;
1940  
1941 5 my @binary = ();
1942 5 for my $octal (split(//,$octdigit)) {
1943 push @binary, {
1944 '0' => '000',
1945 '1' => '001',
1946 '2' => '010',
1947 '3' => '011',
1948 '4' => '100',
1949 '5' => '101',
1950 '6' => '110',
1951 '7' => '111',
1952 50 }->{$octal};
1953 }
1954 5 my $binary = join '', @binary;
1955  
1956 my $octchr = {
1957 # 1234567
1958 1 => pack('B*', "0000000$binary"),
1959 2 => pack('B*', "000000$binary"),
1960 3 => pack('B*', "00000$binary"),
1961 4 => pack('B*', "0000$binary"),
1962 5 => pack('B*', "000$binary"),
1963 6 => pack('B*', "00$binary"),
1964 7 => pack('B*', "0$binary"),
1965 0 => pack('B*', "$binary"),
1966  
1967 5 }->{CORE::length($binary) % 8};
1968  
1969 5 return $octchr;
1970 }
1971  
1972 #
1973 # Cyrillic hexadecimal escape sequence
1974 #
1975 5 ▶sub hexchr {
Subroutine hexchr: called CC=1 SCAR=0.0
Pod undocumented
1976 5 my($hexdigit) = @_;
1977  
1978 my $hexchr = {
1979 1 => pack('H*', "0$hexdigit"),
1980 0 => pack('H*', "$hexdigit"),
1981  
1982 5 }->{CORE::length($_[0]) % 2};
1983  
1984 5 return $hexchr;
1985 }
1986  
1987 #
1988 # Cyrillic open character list for qr
1989 #
1990 576 ▶sub charlist_qr {
Subroutine charlist_qr: called CC=17 SCAR=28.7
Pod undocumented
1991  
1992 576 my $modifier = pop @_;
1993 576 my @char = @_;
1994  
1995 576 my($singleoctet, $multipleoctet) = _charlist(@char, $modifier);
1996 576 my @singleoctet = @$singleoctet;
1997 576 my @multipleoctet = @$multipleoctet;
1998  
1999 # return character list
2000 576 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) 498 78 576
2001  
2002 # with /i modifier
2003 498 ▶ if ($modifier =~ m/i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) 265 233 498
2004 265 my %singleoctet_ignorecase = ();
2005 265 for (@singleoctet) {
2006 745 ▶ while (s/ \A \\x(..) - \\x(..) //oxms or s/ \A \\x((..)) //oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (s/ \A \\x(..) - \\x(..) //mosx or s/ \A \\x((..)) //mosx) 745 745 1490
Condition100%3/3
s/ \A \\x(..) - \\x(..) //mosx or s/ \A \\x((..)) //mosx
l!l&&r!l&&!r
25720745
MC/DC100%2/2
s/ \A \\x(..) - \\x(..) //mosx or s/ \A \\x((..)) //mosx
s/ \A \\x(..) - \\x(..) //mosx s/ \A \\x((..)) //mosx
Truth table100%3/3
A or B
A= s/ \A \\x(..) - \\x(..) //mosxB= s/ \A \\x((..)) //mosx
ABresult
1X1
011
000
2007 745 for my $ord (hex($1) .. hex($2)) {
2008 795 my $char = CORE::chr($ord);
2009 795 my $uc = Ecyrillic::uc($char);
2010 795 my $fc = Ecyrillic::fc($char);
2011 795 ▶ if ($uc eq $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc eq $fc) { } 240 555 795
2012 240 $singleoctet_ignorecase{unpack 'C*', $char} = 1;
2013 }
2014 else {
2015 555 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 555 0 555
2016 555 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2017 555 $singleoctet_ignorecase{unpack 'C*', $fc} = 1;
2018 }
2019 else {
2020 0 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2021 0 push @multipleoctet, join '', map {sprintf('\x%02X',$_)} unpack 'C*', $fc;
2022 }
2023 }
2024 }
2025 }
2026 745 ▶ if ($_ ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ ne "") 0 745 745
2027 0 $singleoctet_ignorecase{unpack 'C*', $_} = 1;
2028 }
2029 }
2030 265 my $i = 0;
2031 265 my @singleoctet_ignorecase = ();
2032 265 for my $ord (0 .. 255) {
2033 67840 ▶ if (exists $singleoctet_ignorecase{$ord}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $singleoctet_ignorecase{$ord}) { } 870 66970 67840
2034 870 push @{$singleoctet_ignorecase[$i]}, $ord;
2035 }
2036 else {
2037 66970 $i++;
2038 }
2039 }
2040 265 @singleoctet = ();
2041 265 for my $range (@singleoctet_ignorecase) {
2042 56160 ▶ if (ref $range) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $range) 770 55390 56160
2043 770 ▶ if (scalar(@{$range}) == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @{$range;} == 1) { } 720 50 770
elsif (scalar @{$range;} == 2) { } 0 50 50
2044 720 push @singleoctet, sprintf('\x%02X', @{$range}[0]);
2045 }
2046 50 elsif (scalar(@{$range}) == 2) {
2047 0 push @singleoctet, sprintf('\x%02X\x%02X', @{$range}[0], @{$range}[-1]);
2048 }
2049 else {
2050 50 push @singleoctet, sprintf('\x%02X-\x%02X', @{$range}[0], @{$range}[-1]);
2051 }
2052 }
2053 }
2054 }
2055  
2056 498 my $not_anchor = '';
2057  
2058 498 push @multipleoctet, join('', $not_anchor, '[', @singleoctet, ']' );
2059 }
2060 576 ▶ if (scalar(@multipleoctet) >= 2) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @multipleoctet >= 2) { } 6 570 576
2061 6 return '(?:' . join('|', @multipleoctet) . ')';
2062 }
2063 else {
2064 570 return $multipleoctet[0];
2065 }
2066 }
2067  
2068 #
2069 # Cyrillic open character list for not qr
2070 #
2071 74 ▶sub charlist_not_qr {
Subroutine charlist_not_qr: called CC=18 SCAR=33.1
Pod undocumented
2072  
2073 74 my $modifier = pop @_;
2074 74 my @char = @_;
2075  
2076 74 my($singleoctet, $multipleoctet) = _charlist(@char, $modifier);
2077 74 my @singleoctet = @$singleoctet;
2078 74 my @multipleoctet = @$multipleoctet;
2079  
2080 # with /i modifier
2081 74 ▶ if ($modifier =~ m/i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) 25 49 74
2082 25 my %singleoctet_ignorecase = ();
2083 25 for (@singleoctet) {
2084 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
2085 25 for my $ord (hex($1) .. hex($2)) {
2086 75 my $char = CORE::chr($ord);
2087 75 my $uc = Ecyrillic::uc($char);
2088 75 my $fc = Ecyrillic::fc($char);
2089 75 ▶ if ($uc eq $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc eq $fc) { } 0 75 75
2090 0 $singleoctet_ignorecase{unpack 'C*', $char} = 1;
2091 }
2092 else {
2093 75 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 75 0 75
2094 75 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2095 75 $singleoctet_ignorecase{unpack 'C*', $fc} = 1;
2096 }
2097 else {
2098 0 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2099 0 push @multipleoctet, join '', map {sprintf('\x%02X',$_)} unpack 'C*', $fc;
2100 }
2101 }
2102 }
2103 }
2104 25 ▶ if ($_ ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ ne "") 0 25 25
2105 0 $singleoctet_ignorecase{unpack 'C*', $_} = 1;
2106 }
2107 }
2108 25 my $i = 0;
2109 25 my @singleoctet_ignorecase = ();
2110 25 for my $ord (0 .. 255) {
2111 6400 ▶ if (exists $singleoctet_ignorecase{$ord}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $singleoctet_ignorecase{$ord}) { } 150 6250 6400
2112 150 push @{$singleoctet_ignorecase[$i]}, $ord;
2113 }
2114 else {
2115 6250 $i++;
2116 }
2117 }
2118 25 @singleoctet = ();
2119 25 for my $range (@singleoctet_ignorecase) {
2120 2400 ▶ if (ref $range) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $range) 50 2350 2400
2121 50 ▶ if (scalar(@{$range}) == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @{$range;} == 1) { } 0 50 50
elsif (scalar @{$range;} == 2) { } 0 50 50
2122 0 push @singleoctet, sprintf('\x%02X', @{$range}[0]);
2123 }
2124 50 elsif (scalar(@{$range}) == 2) {
2125 0 push @singleoctet, sprintf('\x%02X\x%02X', @{$range}[0], @{$range}[-1]);
2126 }
2127 else {
2128 50 push @singleoctet, sprintf('\x%02X-\x%02X', @{$range}[0], @{$range}[-1]);
2129 }
2130 }
2131 }
2132 }
2133  
2134 # return character list
2135 74 ▶ if (scalar(@multipleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @multipleoctet >= 1) { } 0 74 74
2136 0 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) { } 0 0 0
2137  
2138 # any character other than multiple-octet and single octet character class
2139 0 return '(?!' . join('|', @multipleoctet) . ')(?:[^' . join('', @singleoctet) . '])';
2140 }
2141 else {
2142  
2143 # any character other than multiple-octet character class
2144 0 return '(?!' . join('|', @multipleoctet) . ")(?:$your_char)";
2145 }
2146 }
2147 else {
2148 74 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) { } 74 0 74
2149  
2150 # any character other than single octet character class
2151 74 return '(?:[^' . join('', @singleoctet) . '])';
2152 }
2153 else {
2154  
2155 # any character
2156 0 return "(?:$your_char)";
2157 }
2158 }
2159 }
2160  
2161 #
2162 # open file in read mode
2163 #
2164 424 ▶sub _open_r {
Subroutine _open_r: called CC=1 SCAR=0.0
2165 424 my(undef,$file) = @_;
2166 424 ▶ use Fcntl qw(O_RDONLY);
Subroutine BEGIN: called CC=1 SCAR=0.0
2167 424 return CORE::sysopen($_[0], $file, &O_RDONLY);
2168 }
2169  
2170 #
2171 # open file in append mode
2172 #
2173 212 ▶sub _open_a {
Subroutine _open_a: called CC=1 SCAR=0.0
2174 212 my(undef,$file) = @_;
2175 424 ▶ use Fcntl qw(O_WRONLY O_APPEND O_CREAT);
Subroutine BEGIN: called CC=1 SCAR=0.0
2176 212 return CORE::sysopen($_[0], $file, &O_WRONLY|&O_APPEND|&O_CREAT);
2177 }
2178  
2179 #
2180 # safe system
2181 #
2182 212 ▶sub _systemx {
Subroutine _systemx: called CC=1 SCAR=0.0
2183  
2184 # P.707 29.2.33. exec
2185 # in Chapter 29: Functions
2186 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2187 #
2188 # Be aware that in older releases of Perl, exec (and system) did not flush
2189 # your output buffer, so you needed to enable command buffering by setting $|
2190 # on one or more filehandles to avoid lost output in the case of exec, or
2191 # misordererd output in the case of system. This situation was largely remedied
2192 # in the 5.6 release of Perl. (So, 5.005 release not yet.)
2193  
2194 # P.855 exec
2195 # in Chapter 27: Functions
2196 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2197 #
2198 # In very old release of Perl (before v5.6), exec (and system) did not flush
2199 # your output buffer, so you needed to enable command buffering by setting $|
2200 # on one or more filehandles to avoid lost output with exec or misordered
2201 # output with system.
2202  
2203 212 $| = 1;
2204  
2205 # P.565 23.1.2. Cleaning Up Your Environment
2206 # in Chapter 23: Security
2207 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2208  
2209 # P.656 Cleaning Up Your Environment
2210 # in Chapter 20: Security
2211 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2212  
2213 # local $ENV{'PATH'} = '.';
2214 212 local @ENV{qw(IFS CDPATH ENV BASH_ENV)}; # Make %ENV safer
2215  
2216 # P.707 29.2.33. exec
2217 # in Chapter 29: Functions
2218 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2219 #
2220 # As we mentioned earlier, exec treats a discrete list of arguments as an
2221 # indication that it should bypass shell processing. However, there is one
2222 # place where you might still get tripped up. The exec call (and system, too)
2223 # will not distinguish between a single scalar argument and an array containing
2224 # only one element.
2225 #
2226 # @args = ("echo surprise"); # just one element in list
2227 # exec @args # still subject to shell escapes
2228 # or die "exec: $!"; # because @args == 1
2229 #
2230 # To avoid this, you can use the PATHNAME syntax, explicitly duplicating the
2231 # first argument as the pathname, which forces the rest of the arguments to be
2232 # interpreted as a list, even if there is only one of them:
2233 #
2234 # exec { $args[0] } @args # safe even with one-argument list
2235 # or die "can't exec @args: $!";
2236  
2237 # P.855 exec
2238 # in Chapter 27: Functions
2239 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2240 #
2241 # As we mentioned earlier, exec treats a discrete list of arguments as a
2242 # directive to bypass shell processing. However, there is one place where
2243 # you might still get tripped up. The exec call (and system, too) cannot
2244 # distinguish between a single scalar argument and an array containing
2245 # only one element.
2246 #
2247 # @args = ("echo surprise"); # just one element in list
2248 # exec @args # still subject to shell escapes
2249 # || die "exec: $!"; # because @args == 1
2250 #
2251 # To avoid this, use the PATHNAME syntax, explicitly duplicating the first
2252 # argument as the pathname, which forces the rest of the arguments to be
2253 # interpreted as a list, even if there is only one of them:
2254 #
2255 # exec { $args[0] } @args # safe even with one-argument list
2256 # || die "can't exec @args: $!";
2257  
2258 212 return CORE::system { $_[0] } @_; # safe even with one-argument list
2259 }
2260  
2261 #
2262 # Cyrillic order to character (with parameter)
2263 #
2264 3469 ▶sub Ecyrillic::chr(;$) {
Subroutine chr: called CC=4 SCAR=13.9
Pod undocumented
2265  
2266 3469 ▶ my $c = @_ ? $_[0] : $_;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 3469 0 3469
2267  
2268 3469 ▶ if ($c == 0x00) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c == 0) { } 24 3445 3469
2269 24 return "\x00";
2270 }
2271 else {
2272 3445 my @chr = ();
2273 3445 ▶ while ($c > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c > 0) 3445 3445 6890
2274 3445 unshift @chr, ($c % 0x100);
2275 3445 $c = int($c / 0x100);
2276 }
2277 3445 return pack 'C*', @chr;
2278 }
2279 }
2280  
2281 #
2282 # Cyrillic order to character (without parameter)
2283 #
2284 0 ▶sub Ecyrillic::chr_() {
Subroutine chr_: not called CC=3 SCAR=24.8
Pod undocumented
2285  
2286 0 my $c = $_;
2287  
2288 0 ▶ if ($c == 0x00) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c == 0) { } 0 0 0
2289 0 return "\x00";
2290 }
2291 else {
2292 0 my @chr = ();
2293 0 ▶ while ($c > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c > 0) 0 0 0
2294 0 unshift @chr, ($c % 0x100);
2295 0 $c = int($c / 0x100);
2296 }
2297 0 return pack 'C*', @chr;
2298 }
2299 }
2300  
2301 #
2302 # Cyrillic path globbing (with parameter)
2303 #
2304 0 ▶sub Ecyrillic::glob($) {
Subroutine glob: not called CC=3 SCAR=24.8
Pod undocumented
2305  
2306 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2307 0 my @glob = _DOS_like_glob(@_);
2308 0 for my $glob (@glob) {
2309 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2310 }
2311 0 return @glob;
2312 }
2313 else {
2314 0 my $glob = _DOS_like_glob(@_);
2315 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2316 0 return $glob;
2317 }
2318 }
2319  
2320 #
2321 # Cyrillic path globbing (without parameter)
2322 #
2323 0 ▶sub Ecyrillic::glob_() {
Subroutine glob_: not called CC=3 SCAR=24.8
Pod undocumented
2324  
2325 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2326 0 my @glob = _DOS_like_glob();
2327 0 for my $glob (@glob) {
2328 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2329 }
2330 0 return @glob;
2331 }
2332 else {
2333 0 my $glob = _DOS_like_glob();
2334 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2335 0 return $glob;
2336 }
2337 }
2338  
2339 #
2340 # Cyrillic path globbing via File::DosGlob 1.10
2341 #
2342 # Often I confuse "_dosglob" and "_doglob".
2343 # So, I renamed "_dosglob" to "_DOS_like_glob".
2344 #
2345 424 my %iter;
2346 my %entries;
2347 0 ▶sub _DOS_like_glob {
Subroutine _DOS_like_glob: not called CC=10 SCAR=47.0
2348  
2349 # context (keyed by second cxix argument provided by core)
2350 0 my($expr,$cxix) = @_;
2351  
2352 # glob without args defaults to $_
2353 0 ▶ $expr = $_ if not defined $expr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $expr 0 0 0
2354  
2355 # represents the current user's home directory
2356 #
2357 # 7.3. Expanding Tildes in Filenames
2358 # in Chapter 7. File Access
2359 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2360 #
2361 # and File::HomeDir, File::HomeDir::Windows module
2362  
2363 # DOS-like system
2364 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
2365 0 $expr =~ s{ \A ~ (?= [^/\\] ) }
2366 0 { my_home_MSWin32() }oxmse;
2367 }
2368  
2369 # UNIX-like system
2370 else {
2371 0 $expr =~ s{ \A ~ ( (?:[^/])* ) }
2372 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
2373 }
2374  
2375 # assume global context if not provided one
2376 0 ▶ $cxix = '_G_' if not defined $cxix;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $cxix 0 0 0
2377 0 ▶ $iter{$cxix} = 0 if not exists $iter{$cxix};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $iter{$cxix} 0 0 0
2378  
2379 # if we're just beginning, do it all first
2380 0 ▶ if ($iter{$cxix} == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iter{$cxix} == 0) 0 0 0
2381 0 $entries{$cxix} = [ _do_glob(1, _parse_line($expr)) ];
2382 }
2383  
2384 # chuck it all out, quick or slow
2385 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2386 0 delete $iter{$cxix};
2387 0 return @{delete $entries{$cxix}};
2388 }
2389 else {
2390 0 ▶ if ($iter{$cxix} = scalar @{$entries{$cxix}}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iter{$cxix} = scalar @{$entries{$cxix};}) { } 0 0 0
2391 0 return shift @{$entries{$cxix}};
2392 }
2393 else {
2394 # return undef for EOL
2395 0 delete $iter{$cxix};
2396 0 delete $entries{$cxix};
2397 0 return undef;
2398 }
2399 }
2400 }
2401  
2402 #
2403 # Cyrillic path globbing subroutine
2404 #
2405 0 ▶sub _do_glob {
Subroutine _do_glob: not called CC=44 SCAR=75.9
2406  
2407 0 my($cond,@expr) = @_;
2408 0 my @glob = ();
2409 0 my $fix_drive_relative_paths = 0;
2410  
2411 OUTER:
2412 0 for my $expr (@expr) {
2413 0 ▶ next OUTER if not defined $expr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $expr 0 0 0
2414 0 ▶ next OUTER if $expr eq '';
Branch: 1 branch
BranchTrueFalseTotal
if $expr eq "" 0 0 0
2415  
2416 0 my @matched = ();
2417 0 my @globdir = ();
2418 0 my $head = '.';
2419 0 my $pathsep = '/';
2420 0 my $tail;
2421  
2422 # if argument is within quotes strip em and do no globbing
2423 0 ▶ if ($expr =~ /\A " ((?:$q_char)*?) " \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expr =~ /\A " ((?:$Ecyrillic::q_char)*?) " \z/mosx) 0 0 0
2424 0 $expr = $1;
2425 0 ▶ if ($cond eq 'd') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cond eq 'd') { } 0 0 0
2426 0 ▶ if (-d $expr) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $expr) 0 0 0
2427 0 push @glob, $expr;
2428 }
2429 }
2430 else {
2431 0 ▶ if (-e $expr) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $expr) 0 0 0
2432 0 push @glob, $expr;
2433 }
2434 }
2435 0 next OUTER;
2436 }
2437  
2438 # wildcards with a drive prefix such as h:*.pm must be changed
2439 # to h:./*.pm to expand correctly
2440 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
2441 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
2442 0 $fix_drive_relative_paths = 1;
2443 }
2444 }
2445  
2446 0 ▶ if (($head, $tail) = _parse_path($expr,$pathsep)) {
Branch: 1 branch
BranchTrueFalseTotal
if (($head, $tail) = _parse_path($expr, $pathsep)) 0 0 0
2447 0 ▶ if ($tail eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($tail eq "") 0 0 0
2448 0 push @glob, $expr;
2449 0 next OUTER;
2450 }
2451 0 ▶ if ($head =~ / \A (?:$q_char)*? [*?] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head =~ / \A (?:$Ecyrillic::q_char)*? [*?] /mosx) 0 0 0
2452 0 ▶ if (@globdir = _do_glob('d', $head)) {
Branch: 1 branch
BranchTrueFalseTotal
if (@globdir = _do_glob("d", $head)) 0 0 0
2453 0 push @glob, _do_glob($cond, map {"$_$pathsep$tail"} @globdir);
2454 0 next OUTER;
2455 }
2456 }
2457 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
2458 0 $head .= $pathsep;
2459 }
2460 0 $expr = $tail;
2461 }
2462  
2463 # If file component has no wildcards, we can avoid opendir
2464 0 ▶ if ($expr !~ / \A (?:$q_char)*? [*?] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($expr =~ / \A (?:$Ecyrillic::q_char)*? [*?] /mosx) 0 0 0
2465 0 ▶ if ($head eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($head eq ".") 0 0 0
2466 0 $head = '';
2467 }
2468 0 ▶ if ($head ne '' and ($head =~ / \G ($q_char) /oxmsg)[-1] ne $pathsep) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head ne "" and ($head =~ / \G ($Ecyrillic::q_char) /gmosx)[-1] ne $pathsep) 0 0 0
Condition0%0/3
$head ne "" and ($head =~ / \G ($Ecyrillic::q_char) /gmosx)[-1] ne $pathsep
!ll&&!rl&&r
000
MC/DC0%0/2
$head ne "" and ($head =~ / \G ($Ecyrillic::q_char) /gmosx)[-1] ne $pathsep
$head ne "" ($head =~ / \G ($Ecyrillic::q_char) /gmosx)[-1] ne $pathsep
Truth table0%0/3
A and B
A= $head ne ""B= ($head =~ / \G ($Ecyrillic::q_char) /gmosx)[-1] ne $pathsep
ABresult
0X0
100
111
2469 0 $head .= $pathsep;
2470 }
2471 0 $head .= $expr;
2472 0 ▶ if ($cond eq 'd') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cond eq 'd') { } 0 0 0
2473 0 ▶ if (-d $head) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $head) 0 0 0
2474 0 push @glob, $head;
2475 }
2476 }
2477 else {
2478 0 ▶ if (-e $head) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $head) 0 0 0
2479 0 push @glob, $head;
2480 }
2481 }
2482 0 next OUTER;
2483 }
2484 0 ▶ opendir(*DIR, $head) or next OUTER;
Branch: 1 branch
BranchTrueFalseTotal
opendir *DIR, $head or next OUTER 0 0 0
2485 0 my @leaf = readdir DIR;
2486 0 closedir DIR;
2487  
2488 0 ▶ if ($head eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($head eq ".") 0 0 0
2489 0 $head = '';
2490 }
2491 0 ▶ if ($head ne '' and ($head =~ / \G ($q_char) /oxmsg)[-1] ne $pathsep) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head ne "" and ($head =~ / \G ($Ecyrillic::q_char) /gmosx)[-1] ne $pathsep) 0 0 0
Condition0%0/3
$head ne "" and ($head =~ / \G ($Ecyrillic::q_char) /gmosx)[-1] ne $pathsep
!ll&&!rl&&r
000
MC/DC0%0/2
$head ne "" and ($head =~ / \G ($Ecyrillic::q_char) /gmosx)[-1] ne $pathsep
$head ne "" ($head =~ / \G ($Ecyrillic::q_char) /gmosx)[-1] ne $pathsep
Truth table0%0/3
A and B
A= $head ne ""B= ($head =~ / \G ($Ecyrillic::q_char) /gmosx)[-1] ne $pathsep
ABresult
0X0
100
111
2492 0 $head .= $pathsep;
2493 }
2494  
2495 0 my $pattern = '';
2496 0 ▶ while ($expr =~ / \G ($q_char) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expr =~ / \G ($Ecyrillic::q_char) /cgox) 0 0 0
2497 0 my $char = $1;
2498  
2499 # 6.9. Matching Shell Globs as Regular Expressions
2500 # in Chapter 6. Pattern Matching
2501 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2502 # (and so on)
2503  
2504 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
2505 0 $pattern .= "(?:$your_char)*",
2506 }
2507 elsif ($char eq '?') {
2508 0 $pattern .= "(?:$your_char)?", # DOS style
2509 # $pattern .= "(?:$your_char)", # UNIX style
2510 }
2511 elsif ((my $fc = Ecyrillic::fc($char)) ne $char) {
2512 0 $pattern .= $fc;
2513 }
2514 else {
2515 0 $pattern .= quotemeta $char;
2516 }
2517 }
2518 0 ▶ my $matchsub = sub { Ecyrillic::fc($_[0]) =~ /\A $pattern \z/xms };
Subroutine __ANON__: not called CC=1 SCAR=6.9
2519  
2520 # if ($@) {
2521 # print STDERR "$0: $@\n";
2522 # next OUTER;
2523 # }
2524  
2525 INNER:
2526 0 for my $leaf (@leaf) {
2527 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
2528 0 next INNER;
2529 }
2530 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
2531 0 next INNER;
2532 }
2533  
2534 0 ▶ if (&$matchsub($leaf)) {
Branch: 1 branch
BranchTrueFalseTotal
if (&$matchsub($leaf)) 0 0 0
2535 0 push @matched, "$head$leaf";
2536 0 next INNER;
2537 }
2538  
2539 # [DOS compatibility special case]
2540 # Failed, add a trailing dot and try again, but only...
2541  
2542 0 ▶ if (Ecyrillic::index($leaf,'.') == -1 and # if name does not have a dot in it *and*
Branch: 1 branch
BranchTrueFalseTotal
if (&Ecyrillic::index($leaf, ".") == -1 and length $leaf <= 8 and &Ecyrillic::index($pattern, "\\.") != -1) 0 0 0
Condition0%0/6
&Ecyrillic::index($leaf, ".") == -1 and length $leaf <= 8 and &Ecyrillic::index($pattern, "\\.") != -1
!ll&&!rl&&r
000
&Ecyrillic::index($leaf, ".") == -1 and length $leaf <= 8
!ll&&!rl&&r
000
MC/DC0%0/3
&Ecyrillic::index($leaf, ".") == -1 and length $leaf <= 8 and &Ecyrillic::index($pattern, "\\.") != -1
&Ecyrillic::index($leaf, ".") == -1 length $leaf <= 8 &Ecyrillic::index($pattern, "\\.") != -1
Truth table0%0/4
A and B and C
A= &Ecyrillic::index($leaf, ".") == -1B= length $leaf <= 8C= &Ecyrillic::index($pattern, "\\.") != -1
ABCresult
0XX0
10X0
1100
1111
2543 CORE::length($leaf) <= 8 and # name is shorter than or equal to 8 chars *and*
2544 Ecyrillic::index($pattern,'\\.') != -1 # pattern has a dot.
2545 ) {
2546 0 ▶ if (&$matchsub("$leaf.")) {
Branch: 1 branch
BranchTrueFalseTotal
if (&$matchsub("$leaf.")) 0 0 0
2547 0 push @matched, "$head$leaf";
2548 0 next INNER;
2549 }
2550 }
2551 }
2552 0 ▶ if (@matched) {
Branch: 1 branch
BranchTrueFalseTotal
if (@matched) 0 0 0
2553 0 push @glob, @matched;
2554 }
2555 }
2556 0 ▶ if ($fix_drive_relative_paths) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fix_drive_relative_paths) 0 0 0
2557 0 for my $glob (@glob) {
2558 0 $glob =~ s# \A ([A-Za-z]:) \./ #$1#oxms;
2559 }
2560 }
2561 0 return @glob;
2562 }
2563  
2564 #
2565 # Cyrillic parse line
2566 #
2567 0 ▶sub _parse_line {
Subroutine _parse_line: not called CC=3 SCAR=24.8
2568  
2569 0 my($line) = @_;
2570  
2571 0 $line .= ' ';
2572 0 my @piece = ();
2573 0 ▶ while ($line =~ /
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ / " ( (?>(?: [^"] )* ) ) " (?>\s+) | ( (?>(?: [^"\s] )* ) ) (?>\s+) /gmosx) 0 0 0
2574 " ( (?>(?: [^"] )* ) ) " (?>\s+) |
2575 ( (?>(?: [^"\s] )* ) ) (?>\s+)
2576 /oxmsg
2577 ) {
2578 0 ▶ push @piece, defined($1) ? $1 : $2;
Branch: 1 branch
BranchTrueFalseTotal
defined $1 ? : 0 0 0
2579 }
2580 0 return @piece;
2581 }
2582  
2583 #
2584 # Cyrillic parse path
2585 #
2586 0 ▶sub _parse_path {
Subroutine _parse_path: not called CC=2 SCAR=17.9
2587  
2588 0 my($path,$pathsep) = @_;
2589  
2590 0 $path .= '/';
2591 0 my @subpath = ();
2592 0 ▶ while ($path =~ /
Branch: 1 branch
BranchTrueFalseTotal
if ($path =~ m( ((?: [^/\\] )+?) [/\\] )gmosx) 0 0 0
2593 ((?: [^\/\\] )+?) [\/\\]
2594 /oxmsg
2595 ) {
2596 0 push @subpath, $1;
2597 }
2598  
2599 0 my $tail = pop @subpath;
2600 0 my $head = join $pathsep, @subpath;
2601 0 return $head, $tail;
2602 }
2603  
2604 #
2605 # via File::HomeDir::Windows 1.00
2606 #
2607 0 ▶sub my_home_MSWin32 {
Subroutine my_home_MSWin32: not called CC=9 SCAR=45.0
Pod undocumented
2608  
2609 # A lot of unix people and unix-derived tools rely on
2610 # the ability to overload HOME. We will support it too
2611 # so that they can replace raw HOME calls with File::HomeDir.
2612 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
2613 0 return $ENV{'HOME'};
2614 }
2615  
2616 # Do we have a user profile?
2617 ▶ 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
2618 0 return $ENV{'USERPROFILE'};
2619 }
2620  
2621 # Some Windows use something like $ENV{'HOME'}
2622 ▶ 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
2623 0 return join '', $ENV{'HOMEDRIVE'}, $ENV{'HOMEPATH'};
2624 }
2625  
2626 0 return undef;
2627 }
2628  
2629 #
2630 # via File::HomeDir::Unix 1.00
2631 #
2632 0 ▶sub my_home {
Subroutine my_home: not called CC=7 SCAR=40.3
Pod undocumented
2633 0 my $home;
2634  
2635 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
2636 0 $home = $ENV{'HOME'};
2637 }
2638  
2639 # This is from the original code, but I'm guessing
2640 # it means "login directory" and exists on some Unixes.
2641 ▶ 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
2642 0 $home = $ENV{'LOGDIR'};
2643 }
2644  
2645 ### More-desperate methods
2646  
2647 # Light desperation on any (Unixish) platform
2648 else {
2649 0 $home = CORE::eval q{ (getpwuid($<))[7] };
2650 }
2651  
2652 # On Unix in general, a non-existant home means "no home"
2653 # For example, "nobody"-like users might use /nonexistant
2654 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
2655 0 $home = undef;
2656 }
2657 0 return $home;
2658 }
2659  
2660 #
2661 # ${^PREMATCH}, $PREMATCH, $` the string preceding what was matched
2662 #
2663 56 ▶sub Ecyrillic::PREMATCH {
Subroutine PREMATCH: called CC=1 SCAR=0.0
Pod undocumented
2664 56 return $`;
2665 }
2666  
2667 #
2668 # ${^MATCH}, $MATCH, $& the string that matched
2669 #
2670 81 ▶sub Ecyrillic::MATCH {
Subroutine MATCH: called CC=1 SCAR=0.0
Pod undocumented
2671 81 return $&;
2672 }
2673  
2674 #
2675 # ${^POSTMATCH}, $POSTMATCH, $' the string following what was matched
2676 #
2677 42 ▶sub Ecyrillic::POSTMATCH {
Subroutine POSTMATCH: called CC=1 SCAR=0.0
Pod undocumented
2678 42 return $';
2679 }
2680  
2681 #
2682 # Cyrillic character to order (with parameter)
2683 #
2684 0 ▶sub Cyrillic::ord(;$) {
Subroutine ord: not called CC=4 SCAR=30.0
2685  
2686 0 ▶ local $_ = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
2687  
2688 0 ▶ if (/\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\A ($Ecyrillic::q_char) /mosx) { } 0 0 0
2689 0 my @ord = unpack 'C*', $1;
2690 0 my $ord = 0;
2691 0 ▶ while (my $o = shift @ord) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $o = shift @ord) 0 0 0
2692 0 $ord = $ord * 0x100 + $o;
2693 }
2694 0 return $ord;
2695 }
2696 else {
2697 0 return CORE::ord $_;
2698 }
2699 }
2700  
2701 #
2702 # Cyrillic character to order (without parameter)
2703 #
2704 0 ▶sub Cyrillic::ord_() {
Subroutine ord_: not called CC=3 SCAR=24.8
2705  
2706 0 ▶ if (/\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\A ($Ecyrillic::q_char) /mosx) { } 0 0 0
2707 0 my @ord = unpack 'C*', $1;
2708 0 my $ord = 0;
2709 0 ▶ while (my $o = shift @ord) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $o = shift @ord) 0 0 0
2710 0 $ord = $ord * 0x100 + $o;
2711 }
2712 0 return $ord;
2713 }
2714 else {
2715 0 return CORE::ord $_;
2716 }
2717 }
2718  
2719 #
2720 # Cyrillic reverse
2721 #
2722 0 ▶sub Cyrillic::reverse(@) {
Subroutine reverse: not called CC=2 SCAR=17.9
2723  
2724 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2725 0 return CORE::reverse @_;
2726 }
2727 else {
2728  
2729 # One of us once cornered Larry in an elevator and asked him what
2730 # problem he was solving with this, but he looked as far off into
2731 # the distance as he could in an elevator and said, "It seemed like
2732 # a good idea at the time."
2733  
2734 0 return join '', CORE::reverse(join('',@_) =~ /\G ($q_char) /oxmsg);
2735 }
2736 }
2737  
2738 #
2739 # Cyrillic getc (with parameter, without parameter)
2740 #
2741 20 ▶sub Cyrillic::getc(;*@) {
Subroutine getc: called CC=9 SCAR=26.7
2742  
2743 20 my($package) = caller;
2744 20 ▶ my $fh = @_ ? qualify_to_ref(shift,$package) : \*STDIN;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 20 0 20
2745 20 ▶ croak 'Too many arguments for Cyrillic::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
2746  
2747 0 my @length = sort { $a <=> $b } keys %range_tr;
2748 20 my $getc = '';
2749 20 for my $length ($length[0] .. $length[-1]) {
2750 20 $getc .= CORE::getc($fh);
2751 20 ▶ if (exists $range_tr{CORE::length($getc)}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{length $getc}) 20 0 20
2752 20 ▶ if ($getc =~ /\A ${Ecyrillic::dot_s} \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($getc =~ /\A $Ecyrillic::dot_s \z/mosx) 20 0 20
2753 20 ▶ return wantarray ? ($getc,@_) : $getc;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 20 20
2754 }
2755 }
2756 }
2757 0 ▶ return wantarray ? ($getc,@_) : $getc;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
2758 }
2759  
2760 #
2761 # Cyrillic length by character
2762 #
2763 0 ▶sub Cyrillic::length(;$) {
Subroutine length: not called CC=2 SCAR=17.9
2764  
2765 0 ▶ local $_ = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
2766  
2767 0 local @_ = /\G ($q_char) /oxmsg;
2768 0 return scalar @_;
2769 }
2770  
2771 #
2772 # Cyrillic substr by character
2773 #
2774 424 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=7.0
2775  
2776 # P.232 The lvalue Attribute
2777 # in Chapter 6: Subroutines
2778 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2779  
2780 # P.336 The lvalue Attribute
2781 # in Chapter 7: Subroutines
2782 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2783  
2784 # P.144 8.4 Lvalue subroutines
2785 # in Chapter 8: perlsub: Perl subroutines
2786 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
2787  
2788 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
2789 # vv----------------------*******
2790 sub Cyrillic::substr($$;$$) %s {
2791  
2792 my @char = $_[0] =~ /\G (?>$q_char) /oxmsg;
2793  
2794 # If the substring is beyond either end of the string, substr() returns the undefined
2795 # value and produces a warning. When used as an lvalue, specifying a substring that
2796 # is entirely outside the string raises an exception.
2797 # http://perldoc.perl.org/functions/substr.html
2798  
2799 # A return with no argument returns the scalar value undef in scalar context,
2800 # an empty list () in list context, and (naturally) nothing at all in void
2801 # context.
2802  
2803 my $offset = $_[1];
2804 if (($offset > scalar(@char)) or ($offset < (-1 * scalar(@char)))) {
2805 return;
2806 }
2807  
2808 # substr($string,$offset,$length,$replacement)
2809 if (@_ == 4) {
2810 my(undef,undef,$length,$replacement) = @_;
2811 my $substr = join '', splice(@char, $offset, $length, $replacement);
2812 $_[0] = join '', @char;
2813  
2814 # return $substr; this doesn't work, don't say "return"
2815 $substr;
2816 }
2817  
2818 # substr($string,$offset,$length)
2819 elsif (@_ == 3) {
2820 my(undef,undef,$length) = @_;
2821 my $octet_offset = 0;
2822 my $octet_length = 0;
2823 if ($offset == 0) {
2824 $octet_offset = 0;
2825 }
2826 elsif ($offset > 0) {
2827 local $SIG{__WARN__} = sub {}; # avoid: Use of uninitialized value in join or string at here
2828 $octet_offset = CORE::length(join '', @char[0..$offset-1]);
2829 }
2830 else {
2831 local $SIG{__WARN__} = sub {}; # avoid: Use of uninitialized value in join or string at here
2832 $octet_offset = -1 * CORE::length(join '', @char[$#char+$offset+1..$#char]);
2833 }
2834 if ($length == 0) {
2835 $octet_length = 0;
2836 }
2837 elsif ($length > 0) {
2838 local $SIG{__WARN__} = sub {}; # avoid: Use of uninitialized value in join or string at here
2839 $octet_length = CORE::length(join '', @char[$offset..$offset+$length-1]);
2840 }
2841 else {
2842 local $SIG{__WARN__} = sub {}; # avoid: Use of uninitialized value in join or string at here
2843 $octet_length = -1 * CORE::length(join '', @char[$#char+$length+1..$#char]);
2844 }
2845 CORE::substr($_[0], $octet_offset, $octet_length);
2846 }
2847  
2848 # substr($string,$offset)
2849 else {
2850 my $octet_offset = 0;
2851 if ($offset == 0) {
2852 $octet_offset = 0;
2853 }
2854 elsif ($offset > 0) {
2855 $octet_offset = CORE::length(join '', @char[0..$offset-1]);
2856 }
2857 else {
2858 $octet_offset = -1 * CORE::length(join '', @char[$#char+$offset+1..$#char]);
2859 }
2860 CORE::substr($_[0], $octet_offset);
2861 }
2862 }
2863 END
2864 }
2865  
2866 #
2867 # Cyrillic index by character
2868 #
2869 0 ▶sub Cyrillic::index($$;$) {
Subroutine index: not called CC=3 SCAR=24.8
2870  
2871 0 my $index;
2872 0 ▶ if (@_ == 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 3) { } 0 0 0
2873 0 $index = Ecyrillic::index($_[0], $_[1], CORE::length(Cyrillic::substr($_[0], 0, $_[2])));
2874 }
2875 else {
2876 0 $index = Ecyrillic::index($_[0], $_[1]);
2877 }
2878  
2879 0 ▶ if ($index == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($index == -1) { } 0 0 0
2880 0 return -1;
2881 }
2882 else {
2883 0 return Cyrillic::length(CORE::substr $_[0], 0, $index);
2884 }
2885 }
2886  
2887 #
2888 # Cyrillic rindex by character
2889 #
2890 0 ▶sub Cyrillic::rindex($$;$) {
Subroutine rindex: not called CC=3 SCAR=24.8
2891  
2892 0 my $rindex;
2893 0 ▶ if (@_ == 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 3) { } 0 0 0
2894 0 $rindex = Ecyrillic::rindex($_[0], $_[1], CORE::length(Cyrillic::substr($_[0], 0, $_[2])));
2895 }
2896 else {
2897 0 $rindex = Ecyrillic::rindex($_[0], $_[1]);
2898 }
2899  
2900 0 ▶ if ($rindex == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rindex == -1) { } 0 0 0
2901 0 return -1;
2902 }
2903 else {
2904 0 return Cyrillic::length(CORE::substr $_[0], 0, $rindex);
2905 }
2906 }
2907  
2908 # when 'm//', '/' means regexp match 'm//' and '?' means regexp match '??'
2909 # when 'div', '/' means division operator and '?' means conditional operator (condition ? then : else)
2910 424 ▶use vars qw($slash); $slash = 'm//';
Subroutine BEGIN: called CC=1 SCAR=0.0
2911  
2912 # ord() to ord() or Cyrillic::ord()
2913 424 my $function_ord = 'ord';
2914  
2915 # ord to ord or Cyrillic::ord_
2916 424 my $function_ord_ = 'ord';
2917  
2918 # reverse to reverse or Cyrillic::reverse
2919 424 my $function_reverse = 'reverse';
2920  
2921 # getc to getc or Cyrillic::getc
2922 424 my $function_getc = 'getc';
2923  
2924 # P.1023 Appendix W.9 Multibyte Anchoring
2925 # of ISBN 1-56592-224-7 CJKV Information Processing
2926  
2927 424 my $anchor = '';
2928  
2929 424 ▶use vars qw($nest);
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
2930  
2931 # regexp of nested parens in qqXX
2932  
2933 # P.340 Matching Nested Constructs with Embedded Code
2934 # in Chapter 7: Perl
2935 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
2936  
2937 my $qq_paren = qr{(?{local $nest=0}) (?>(?:
2938 [^\\()] |
2939 \( (?{$nest++}) |
2940 \) (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2941 \\ [^c] |
2942 \\c[\x40-\x5F] |
2943 [\x00-\xFF]
2944 424 }xms;
2945  
2946 my $qq_brace = qr{(?{local $nest=0}) (?>(?:
2947 [^\\{}] |
2948 \{ (?{$nest++}) |
2949 \} (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2950 \\ [^c] |
2951 \\c[\x40-\x5F] |
2952 [\x00-\xFF]
2953 424 }xms;
2954  
2955 my $qq_bracket = qr{(?{local $nest=0}) (?>(?:
2956 [^\\\[\]] |
2957 \[ (?{$nest++}) |
2958 \] (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2959 \\ [^c] |
2960 \\c[\x40-\x5F] |
2961 [\x00-\xFF]
2962 424 }xms;
2963  
2964 my $qq_angle = qr{(?{local $nest=0}) (?>(?:
2965 [^\\<>] |
2966 \< (?{$nest++}) |
2967 \> (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2968 \\ [^c] |
2969 \\c[\x40-\x5F] |
2970 [\x00-\xFF]
2971 424 }xms;
2972  
2973 424 my $qq_scalar = qr{(?: \{ (?:$qq_brace)*? \} |
2974 (?: ::)? (?:
2975 (?> [a-zA-Z_][a-zA-Z_0-9]* (?: ::[a-zA-Z_][a-zA-Z_0-9]*)* )
2976 (?>(?: \[ (?: \$\[ | \$\] | $qq_char )*? \] | \{ (?:$qq_brace)*? \} )*)
2977 (?>(?: (?: -> )? (?: [\$\@\%\&\*]\* | \$\#\* | [\@\%]? \[ (?: \$\[ | \$\] | $qq_char )*? \] | [\@\%\*]? \{ (?:$qq_brace)*? \} ) )*)
2978 ))
2979 }xms;
2980  
2981 424 my $qq_variable = qr{(?: \{ (?:$qq_brace)*? \} |
2982 (?: ::)? (?:
2983 (?>[0-9]+) |
2984 [^a-zA-Z_0-9\[\]] |
2985 ^[A-Z] |
2986 (?> [a-zA-Z_][a-zA-Z_0-9]* (?: ::[a-zA-Z_][a-zA-Z_0-9]*)* )
2987 (?>(?: \[ (?: \$\[ | \$\] | $qq_char )*? \] | \{ (?:$qq_brace)*? \} )*)
2988 (?>(?: (?: -> )? (?: [\$\@\%\&\*]\* | \$\#\* | [\@\%]? \[ (?: \$\[ | \$\] | $qq_char )*? \] | [\@\%\*]? \{ (?:$qq_brace)*? \} ) )*)
2989 ))
2990 }xms;
2991  
2992 424 my $qq_substr = qr{(?> Char::substr | Cyrillic::substr | CORE::substr | substr ) (?>\s*) \( $qq_paren \)
2993 }xms;
2994  
2995 # regexp of nested parens in qXX
2996 my $q_paren = qr{(?{local $nest=0}) (?>(?:
2997 [^()] |
2998 \( (?{$nest++}) |
2999 \) (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
3000 [\x00-\xFF]
3001 424 }xms;
3002  
3003 my $q_brace = qr{(?{local $nest=0}) (?>(?:
3004 [^\{\}] |
3005 \{ (?{$nest++}) |
3006 \} (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
3007 [\x00-\xFF]
3008 424 }xms;
3009  
3010 my $q_bracket = qr{(?{local $nest=0}) (?>(?:
3011 [^\[\]] |
3012 \[ (?{$nest++}) |
3013 \] (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
3014 [\x00-\xFF]
3015 424 }xms;
3016  
3017 my $q_angle = qr{(?{local $nest=0}) (?>(?:
3018 [^<>] |
3019 \< (?{$nest++}) |
3020 \> (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
3021 [\x00-\xFF]
3022 424 }xms;
3023  
3024 424 my $matched = '';
3025 424 my $s_matched = '';
3026  
3027 424 my $tr_variable = ''; # variable of tr///
3028 424 my $sub_variable = ''; # variable of s///
3029 424 my $bind_operator = ''; # =~ or !~
3030  
3031 424 my @heredoc = (); # here document
3032 424 my @heredoc_delimiter = ();
3033 424 my $here_script = ''; # here script
3034  
3035 #
3036 # escape Cyrillic script
3037 #
3038 548 ▶sub Cyrillic::escape(;$) {
Subroutine escape: called CC=3 SCAR=11.0
3039 548 ▶ local($_) = $_[0] if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 292 256 548
3040  
3041 # P.359 The Study Function
3042 # in Chapter 7: Perl
3043 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3044  
3045 548 study $_; # Yes, I studied study yesterday.
3046  
3047 # while all script
3048  
3049 # 6.14. Matching from Where the Last Pattern Left Off
3050 # in Chapter 6. Pattern Matching
3051 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
3052 # (and so on)
3053  
3054 # one member of Tag-team
3055 #
3056 # P.128 Start of match (or end of previous match): \G
3057 # P.130 Advanced Use of \G with Perl
3058 # in Chapter 3: Overview of Regular Expression Features and Flavors
3059 # P.255 Use leading anchors
3060 # P.256 Expose ^ and \G at the front expressions
3061 # in Chapter 6: Crafting an Efficient Expression
3062 # P.315 "Tag-team" matching with /gc
3063 # in Chapter 7: Perl
3064 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3065  
3066 548 my $e_script = '';
3067 548 ▶ while (not /\G \z/oxgc) { # member
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 87144 548 87692
3068 87144 $e_script .= Cyrillic::escape_token();
3069 }
3070  
3071 548 return $e_script;
3072 }
3073  
3074 #
3075 # escape Cyrillic token of script
3076 #
3077 87144 ▶sub Cyrillic::escape_token {
Subroutine escape_token: called CC=504 SCAR=109.3
3078  
3079 # \n output here document
3080  
3081 87144 my $ignore_modules = join('|', qw(
3082 utf8
3083 bytes
3084 charnames
3085 I18N::Japanese
3086 I18N::Collate
3087 I18N::JExt
3088 File::DosGlob
3089 Wild
3090 Wildcard
3091 Japanese
3092 ));
3093  
3094 # another member of Tag-team
3095 #
3096 # P.315 "Tag-team" matching with /gc
3097 # in Chapter 7: Perl
3098 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3099  
3100 87144 ▶ if (/\G ( \n ) /oxgc) { # another member (and so on)
Branch: 139 branches
BranchTrueFalseTotal
if (/\G ( \n ) /cgox) { } 12846 74298 87144
elsif (/\G ((?>\s+)|\#.*) /cgox) { } 21472 52826 74298
elsif (/\G ( (?: if | elsif | unless | while | until | given | when ) (?>\s*) \( ) /cgox) { } 1644 51182 52826
elsif (/\G ( \( (?>\s*) (?: local \b | my \b | our \b | state \b )? (?>\s*) \$ $qq_scalar ) /cgox) { } 90 51092 51182
elsif (/\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /cgmosx) { } 4 51088 51092
elsif (/\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /cgmosx) { } 28 51060 51088
elsif (/\G ( \$' | \$\{'\} ) /cgmosx) { } 1 51059 51060
elsif (/\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /cgmosx) { } 3 51056 51059
elsif (/\G ( \$ $qq_scalar | $qq_substr ) /cgox) { } 1754 49302 51056
elsif (/\G ( [,;] ) /cgox) { } 5103 44199 49302
elsif (/\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /cgmosx) { } 0 44199 44199
elsif (/\G ( \$ 0 ) /cgmosx) { } 2 44197 44199
elsif (/\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /cgmosx) { } 0 44197 44197
elsif (/\G ( \$ \$ ) (?![\w\{]) /cgmosx) { } 1 44196 44197
elsif (/\G \$ ((?>[1-9][0-9]*)) /cgmosx) { } 4 44192 44196
elsif (/\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /cgmosx) { } 0 44192 44192
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /cgmosx) { } 0 44192 44192
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /cgmosx) { } 0 44192 44192
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /cgmosx) { } 0 44192 44192
elsif (/\G \$ (?>\s*) \{ ( (?>\s*) (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* ) (?>\s*) ) \} /cgmosx) { } 0 44192 44192
elsif (/\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /cgmosx) { } 0 44192 44192
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 44150 44192
elsif (m{\G ( \$[\$\@\#\\\'\"/\?\(\)\[\]\<\>] ) }cgmosx) { } 63 44087 44150
elsif (/\G \b (while (?>\s*) \( (?>\s*) <[\$]?[A-Za-z_][A-Za-z_0-9]*> (?>\s*) \)) \b /cgox) { } 0 44087 44087
elsif (/\G \b while (?>\s*) \( (?>\s*) < ((?:[^>\0\a\e\f\n\r\t])+?) > (?>\s*) \) \b /cgox) { } 0 44087 44087
elsif (/\G \b while (?>\s*) \( (?>\s*) glob (?>\s*) \) /cgox) { } 0 44087 44087
elsif (/\G \b while (?>\s*) \( (?>\s*) glob \b /cgox) { } 0 44087 44087
elsif (/\G \b ( if | unless | while | until | for | when ) \b /cgox) { } 251 43836 44087
elsif (/\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /cgox) { } 19 43817 43836
elsif (/\G \b Char::eval (?= (?>\s*) \{ ) /cgox) { } 0 43817 43817
elsif (/\G \b Cyrillic::eval (?= (?>\s*) \{ ) /cgox) { } 22 43795 43817
elsif (/\G \b Char::eval \b (?! (?>\s*) => ) /cgox) { } 0 43795 43795
elsif (/\G \b Cyrillic::eval \b (?! (?>\s*) => ) /cgox) { } 168 43627 43795
elsif (/\G \b bytes::substr \b (?! (?>\s*) => ) /cgox) { } 2 43625 43627
elsif (/\G \b chop \b (?! (?>\s*) => ) /cgox) { } 0 43625 43625
elsif (/\G \b bytes::index \b (?! (?>\s*) => ) /cgox) { } 2 43623 43625
elsif (/\G \b Char::index \b (?! (?>\s*) => ) /cgox) { } 0 43623 43623
elsif (/\G \b Cyrillic::index \b (?! (?>\s*) => ) /cgox) { } 0 43623 43623
elsif (/\G \b index \b (?! (?>\s*) => ) /cgox) { } 0 43623 43623
elsif (/\G \b bytes::rindex \b (?! (?>\s*) => ) /cgox) { } 2 43621 43623
elsif (/\G \b Char::rindex \b (?! (?>\s*) => ) /cgox) { } 0 43621 43621
elsif (/\G \b Cyrillic::rindex \b (?! (?>\s*) => ) /cgox) { } 0 43621 43621
elsif (/\G \b rindex \b (?! (?>\s*) => ) /cgox) { } 0 43621 43621
elsif (/\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 1 43620 43621
elsif (/\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43620 43620
elsif (/\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 1 43619 43620
elsif (/\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43619 43619
elsif (/\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 6 43613 43619
elsif (/\G -s (?>\s*) (\") ((?:$Ecyrillic::qq_char)+?) (\") /cgox) { } 0 43613 43613
elsif (/\G -s (?>\s+) qq (?>\s*) (\#) ((?:$Ecyrillic::qq_char)+?) (\#) /cgox) { } 0 43613 43613
elsif (/\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /cgox) { } 0 43613 43613
elsif (/\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /cgox) { } 0 43613 43613
elsif (/\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /cgox) { } 0 43613 43613
elsif (/\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /cgox) { } 0 43613 43613
elsif (/\G -s (?>\s+) qq (?>\s*) (\S) ((?:$Ecyrillic::qq_char)+?) (\1) /cgox) { } 0 43613 43613
elsif (/\G -s (?>\s*) (\') ((?:\\\'|\\\\|$Ecyrillic::q_char)+?) (\') /cgox) { } 0 43613 43613
elsif (/\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$Ecyrillic::q_char)+?) (\#) /cgox) { } 0 43613 43613
elsif (/\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /cgox) { } 0 43613 43613
elsif (/\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /cgox) { } 0 43613 43613
elsif (/\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /cgox) { } 0 43613 43613
elsif (/\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /cgox) { } 0 43613 43613
elsif (/\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$Ecyrillic::q_char)+?) (\1) /cgox) { } 0 43613 43613
elsif (/\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)* ) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ) )*) /cgox) { } 0 43613 43613
elsif (/\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /cgox) { } 0 43613 43613
elsif (/\G -s (?= (?>\s+) [a-z]+) /cgox) { } 0 43613 43613
elsif (/\G -s (?>\s+) ((?>\w+)) /cgox) { } 0 43613 43613
elsif (/\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43611 43613
elsif (/\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43609 43611
elsif (/\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 36 43573 43609
elsif (/\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43571 43573
elsif (/\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 8 43563 43571
elsif (/\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43563 43563
elsif (/\G \b lc \b (?! (?>\s*) => ) /cgox) { } 0 43563 43563
elsif (/\G \b lcfirst \b (?! (?>\s*) => ) /cgox) { } 0 43563 43563
elsif (/\G \b uc \b (?! (?>\s*) => ) /cgox) { } 0 43563 43563
elsif (/\G \b ucfirst \b (?! (?>\s*) => ) /cgox) { } 0 43563 43563
elsif (/\G \b fc \b (?! (?>\s*) => ) /cgox) { } 0 43563 43563
elsif (/\G -s \b (?! (?>\s*) => ) /cgox) { } 0 43563 43563
elsif (/\G \b bytes::length \b (?! (?>\s*) => ) /cgox) { } 0 43563 43563
elsif (/\G \b bytes::chr \b (?! (?>\s*) => ) /cgox) { } 0 43563 43563
elsif (/\G \b chr \b (?! (?>\s*) => ) /cgox) { } 0 43563 43563
elsif (/\G \b bytes::ord \b (?! (?>\s*) => ) /cgox) { } 0 43563 43563
elsif (/\G \b ord \b (?! (?>\s*) => ) /cgox) { } 0 43563 43563
elsif (/\G \b glob \b (?! (?>\s*) => ) /cgox) { } 0 43563 43563
elsif (/\G \b reverse \b (?! (?>\s*) => ) /cgox) { } 0 43563 43563
elsif (/\G \b getc \b (?! (?>\s*) => ) /cgox) { } 8 43555 43563
elsif (/\G \b (split) \b (?! (?>\s*) => ) /cgox) { } 87 43468 43555
elsif (/\G \b ( tr | y ) \b /cgox) { } 4 43464 43468
elsif (/\G \b (qq) \b /cgox) { } 2252 41212 43464
elsif (/\G \b (qr) \b /cgox) { } 0 41212 41212
elsif (/\G \b (qw) \b /cgox) { } 16 41196 41212
elsif (/\G \b (qx) \b /cgox) { } 0 41196 41196
elsif (/\G \b (q) \b /cgox) { } 473 40723 41196
elsif (/\G \b (m) \b /cgox) { } 209 40514 40723
elsif (/\G \b (s) \b /cgox) { } 101 40413 40514
elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 0 40413 40413
elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 40413 40413
elsif (/\G \b require ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 40413 40413
elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [#\n]) /cgmosx) { } 37 40376 40413
elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 40376 40376
elsif (/\G \b use ((?>\s+) strict) \b /cgmosx) { } 0 40376 40376
elsif (/\G \b use (?>\s+) ((?>([1-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /cgmosx) { } 2 40374 40376
elsif (/\G \b use (?>\s+) ((?>v([0-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /cgmosx) { } 0 40374 40374
elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 2 40372 40374
elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 40372 40372
elsif (/\G \b use ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 40372 40372
elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 0 40372 40372
elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 40372 40372
elsif (/\G \b no ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 40372 40372
elsif (/\G \b use \b /cgmosx) { } 0 40372 40372
elsif (/\G \b no \b /cgmosx) { } 2 40370 40372
elsif (/\G (?<![\w\$\@\%\&\*]) (\') /cgox) { } 1142 39228 40370
elsif (/\G (\") /cgox) { } 1953 37275 39228
elsif (/\G (\`) /cgox) { } 1 37274 37275
elsif ($Ecyrillic::slash eq 'm//' and m[\G (/) ]cgox) { } 681 36593 37274
elsif ($Ecyrillic::slash eq 'm//' and /\G (\?) /cgox) { } 0 36593 36593
elsif (/\G ( <<>> ) /cgox) { } 0 36593 36593
elsif (/\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /cgox) { } 0 36593 36593
elsif (/\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /cgox) { } 6 36587 36593
elsif (/\G ( <<~ \\([a-zA-Z_0-9]+) ) /cgox) { } 3 36584 36587
elsif (/\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /cgox) { } 6 36578 36584
elsif (/\G ( <<~ ([a-zA-Z_0-9]+) ) /cgox) { } 3 36575 36578
elsif (/\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /cgox) { } 6 36569 36575
elsif (/\G ( << '([a-zA-Z_0-9]*)' ) /cgox) { } 72 36497 36569
elsif (/\G ( << \\([a-zA-Z_0-9]+) ) /cgox) { } 0 36497 36497
elsif (/\G ( << "([a-zA-Z_0-9]*)" ) /cgox) { } 36 36461 36497
elsif (/\G ( << ([a-zA-Z_0-9]+) ) /cgox) { } 42 36419 36461
elsif (/\G ( << `([a-zA-Z_0-9]*)` ) /cgox) { } 0 36419 36419
elsif (/\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/cgox) { } 12 36407 36419
elsif (/\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /cgox) { } 0 36407 36407
elsif (/\G < ((?:[^>\0\a\e\f\n\r\t])+?) > /cgox) { } 0 36407 36407
elsif (/\G ^ ( __DATA__ \n .*) \z /cgmosx) { } 0 36407 36407
elsif (/\G ^ ( __END__ \n .*) \z /cgmosx) { } 210 36197 36407
elsif (/\G ( \cD .*) \z /cgmosx) { } 0 36197 36197
elsif (/\G ( \cZ .*) \z /cgmosx) { } 0 36197 36197
elsif (/\G ( -- | \+\+ | [\)\}\]] ) /cgox) { } 5839 30358 36197
elsif (/\G ( \.\.\. ) /cgox) { } 7 30351 30358
elsif (m"\G ((?> !~~ | !~ | != | ! | %= | % | &&= | && | &= | &\.= | &\. | & | -= | -> | - | :(?>\s*)= | : | <<>> | <<= | <=> | <= | < | == | => | =~ | = | >>= | >> | >= | > | \*\*= | \*\* | \*= | \* | \+= | \+ | \.\. | \.= | \. | //= | // | /= | / | \? | \\ | \^= | \^\.= | \^\. | \^ | \b x= | \|\|= | \|\| | \|= | \|\.= | \|\. | \| | ~~ | ~\. | ~ | \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b | \b(?: print )\b | [,;\(\{\[] )) "cgox) { } 9813 20538 30351
elsif (/\G ($Ecyrillic::q_char) /cgox) { } 20538 0 20538
3101 12846 my $heredoc = '';
3102 12846 ▶ if (scalar(@heredoc_delimiter) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @heredoc_delimiter >= 1) 174 12672 12846
3103 174 $slash = 'm//';
3104  
3105 174 $heredoc = join '', @heredoc;
3106 174 @heredoc = ();
3107  
3108 # skip here document
3109 174 for my $heredoc_delimiter (@heredoc_delimiter) {
3110 174 /\G .*? \n $heredoc_delimiter \n/xmsgc;
3111 }
3112 174 @heredoc_delimiter = ();
3113  
3114 174 $here_script = '';
3115 }
3116 12846 return "\n" . $heredoc;
3117 }
3118  
3119 # ignore space, comment
3120 21472 elsif (/\G ((?>\s+)|\#.*) /oxgc) { return $1; }
3121  
3122 # if (, elsif (, unless (, while (, until (, given (, and when (
3123  
3124 # given, when
3125  
3126 # P.225 The given Statement
3127 # in Chapter 15: Smart Matching and given-when
3128 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
3129  
3130 # P.133 The given Statement
3131 # in Chapter 4: Statements and Declarations
3132 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
3133  
3134 elsif (/\G ( (?: if | elsif | unless | while | until | given | when ) (?>\s*) \( ) /oxgc) {
3135 1644 $slash = 'm//';
3136 1644 return $1;
3137 }
3138  
3139 # scalar variable ($scalar = ...) =~ tr///;
3140 # scalar variable ($scalar = ...) =~ s///;
3141  
3142 # state
3143  
3144 # P.68 Persistent, Private Variables
3145 # in Chapter 4: Subroutines
3146 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
3147  
3148 # P.160 Persistent Lexically Scoped Variables: state
3149 # in Chapter 4: Statements and Declarations
3150 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
3151  
3152 # (and so on)
3153  
3154 elsif (/\G ( \( (?>\s*) (?: local \b | my \b | our \b | state \b )? (?>\s*) \$ $qq_scalar ) /oxgc) {
3155 90 my $e_string = e_string($1);
3156  
3157 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
3158 0 $tr_variable = $e_string . e_string($1);
3159 0 $bind_operator = $2;
3160 0 $slash = 'm//';
3161 0 return '';
3162 }
3163 elsif (/\G ( (?>\s*) = $qq_paren \) ) ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /oxgc) {
3164 0 $sub_variable = $e_string . e_string($1);
3165 0 $bind_operator = $2;
3166 0 $slash = 'm//';
3167 0 return '';
3168 }
3169 else {
3170 90 $slash = 'div';
3171 90 return $e_string;
3172 }
3173 }
3174  
3175 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Ecyrillic::PREMATCH()
3176 elsif (/\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /oxmsgc) {
3177 4 $slash = 'div';
3178 4 return q{Ecyrillic::PREMATCH()};
3179 }
3180  
3181 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Ecyrillic::MATCH()
3182 elsif (/\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /oxmsgc) {
3183 28 $slash = 'div';
3184 28 return q{Ecyrillic::MATCH()};
3185 }
3186  
3187 # $', ${'} --> $', ${'}
3188 elsif (/\G ( \$' | \$\{'\} ) /oxmsgc) {
3189 1 $slash = 'div';
3190 1 return $1;
3191 }
3192  
3193 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Ecyrillic::POSTMATCH()
3194 elsif (/\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /oxmsgc) {
3195 3 $slash = 'div';
3196 3 return q{Ecyrillic::POSTMATCH()};
3197 }
3198  
3199 # scalar variable $scalar =~ tr///;
3200 # scalar variable $scalar =~ s///;
3201 # substr() =~ tr///;
3202 # substr() =~ s///;
3203 elsif (/\G ( \$ $qq_scalar | $qq_substr ) /oxgc) {
3204 1754 my $scalar = e_string($1);
3205  
3206 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
3207 2 $tr_variable = $scalar;
3208 2 $bind_operator = $1;
3209 2 $slash = 'm//';
3210 2 return '';
3211 }
3212 elsif (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /oxgc) {
3213 65 $sub_variable = $scalar;
3214 65 $bind_operator = $1;
3215 65 $slash = 'm//';
3216 65 return '';
3217 }
3218 else {
3219 1687 $slash = 'div';
3220 1687 return $scalar;
3221 }
3222 }
3223  
3224 # end of statement
3225 elsif (/\G ( [,;] ) /oxgc) {
3226 5103 $slash = 'm//';
3227  
3228 # clear tr/// variable
3229 5103 $tr_variable = '';
3230  
3231 # clear s/// variable
3232 5103 $sub_variable = '';
3233  
3234 5103 $bind_operator = '';
3235  
3236 5103 return $1;
3237 }
3238  
3239 # bareword
3240 elsif (/\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /oxmsgc) {
3241 0 return $1;
3242 }
3243  
3244 # $0 --> $0
3245 elsif (/\G ( \$ 0 ) /oxmsgc) {
3246 2 $slash = 'div';
3247 2 return $1;
3248 }
3249 elsif (/\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /oxmsgc) {
3250 0 $slash = 'div';
3251 0 return $1;
3252 }
3253  
3254 # $$ --> $$
3255 elsif (/\G ( \$ \$ ) (?![\w\{]) /oxmsgc) {
3256 1 $slash = 'div';
3257 1 return $1;
3258 }
3259  
3260 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
3261 # $1, $2, $3 --> $1, $2, $3 otherwise
3262 elsif (/\G \$ ((?>[1-9][0-9]*)) /oxmsgc) {
3263 4 $slash = 'div';
3264 4 return e_capture($1);
3265 }
3266 elsif (/\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /oxmsgc) {
3267 0 $slash = 'div';
3268 0 return e_capture($1);
3269 }
3270  
3271 # $$foo[ ... ] --> $ $foo->[ ... ]
3272 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /oxmsgc) {
3273 0 $slash = 'div';
3274 0 return e_capture($1.'->'.$2);
3275 }
3276  
3277 # $$foo{ ... } --> $ $foo->{ ... }
3278 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /oxmsgc) {
3279 0 $slash = 'div';
3280 0 return e_capture($1.'->'.$2);
3281 }
3282  
3283 # $$foo
3284 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /oxmsgc) {
3285 0 $slash = 'div';
3286 0 return e_capture($1);
3287 }
3288  
3289 # ${ foo }
3290 elsif (/\G \$ (?>\s*) \{ ( (?>\s*) (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* ) (?>\s*) ) \} /oxmsgc) {
3291 0 $slash = 'div';
3292 0 return '${' . $1 . '}';
3293 }
3294  
3295 # ${ ... }
3296 elsif (/\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /oxmsgc) {
3297 0 $slash = 'div';
3298 0 return e_capture($1);
3299 }
3300  
3301 # variable or function
3302 # $ @ % & * $ #
3303 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) {
3304 42 $slash = 'div';
3305 42 return $1;
3306 }
3307 # $ $ $ $ $ $ $ $ $ $ $ $ $ $
3308 # $ @ # \ ' " / ? ( ) [ ] < >
3309 elsif (/\G ( \$[\$\@\#\\\'\"\/\?\(\)\[\]\<\>] ) /oxmsgc) {
3310 63 $slash = 'div';
3311 63 return $1;
3312 }
3313  
3314 # while (<FILEHANDLE>)
3315 elsif (/\G \b (while (?>\s*) \( (?>\s*) <[\$]?[A-Za-z_][A-Za-z_0-9]*> (?>\s*) \)) \b /oxgc) {
3316 0 return $1;
3317 }
3318  
3319 # while (<WILDCARD>) --- glob
3320  
3321 # avoid "Error: Runtime exception" of perl version 5.005_03
3322  
3323 elsif (/\G \b while (?>\s*) \( (?>\s*) < ((?:[^>\0\a\e\f\n\r\t])+?) > (?>\s*) \) \b /oxgc) {
3324 0 return 'while ($_ = Ecyrillic::glob("' . $1 . '"))';
3325 }
3326  
3327 # while (glob)
3328 elsif (/\G \b while (?>\s*) \( (?>\s*) glob (?>\s*) \) /oxgc) {
3329 0 return 'while ($_ = Ecyrillic::glob_)';
3330 }
3331  
3332 # while (glob(WILDCARD))
3333 elsif (/\G \b while (?>\s*) \( (?>\s*) glob \b /oxgc) {
3334 0 return 'while ($_ = Ecyrillic::glob';
3335 }
3336  
3337 # doit if, doit unless, doit while, doit until, doit for, doit when
3338 251 elsif (/\G \b ( if | unless | while | until | for | when ) \b /oxgc) { $slash = 'm//'; return $1; }
3339  
3340 # subroutines of package Ecyrillic
3341 19 elsif (/\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /oxgc) { $slash = 'm//'; return $1; }
3342 0 elsif (/\G \b Char::eval (?= (?>\s*) \{ ) /oxgc) { $slash = 'm//'; return 'eval'; }
3343 22 elsif (/\G \b Cyrillic::eval (?= (?>\s*) \{ ) /oxgc) { $slash = 'm//'; return 'eval'; }
3344 0 elsif (/\G \b Char::eval \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'eval Char::escape'; }
3345 168 elsif (/\G \b Cyrillic::eval \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'eval Cyrillic::escape'; }
3346 2 elsif (/\G \b bytes::substr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'substr'; }
3347 0 elsif (/\G \b chop \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ecyrillic::chop'; }
3348 2 elsif (/\G \b bytes::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'index'; }
3349 0 elsif (/\G \b Char::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Char::index'; }
3350 0 elsif (/\G \b Cyrillic::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Cyrillic::index'; }
3351 0 elsif (/\G \b index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ecyrillic::index'; }
3352 2 elsif (/\G \b bytes::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'rindex'; }
3353 0 elsif (/\G \b Char::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Char::rindex'; }
3354 0 elsif (/\G \b Cyrillic::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Cyrillic::rindex'; }
3355 0 elsif (/\G \b rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ecyrillic::rindex'; }
3356 1 elsif (/\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Ecyrillic::lc'; }
3357 0 elsif (/\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Ecyrillic::lcfirst'; }
3358 1 elsif (/\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Ecyrillic::uc'; }
3359 0 elsif (/\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Ecyrillic::ucfirst'; }
3360 6 elsif (/\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Ecyrillic::fc'; }
3361  
3362 # "-s '' ..." means file test "-s 'filename' ..." (not means "- s/// ...")
3363 0 elsif (/\G -s (?>\s*) (\") ((?:$qq_char)+?) (\") /oxgc) { $slash = 'm//'; return '-s ' . e_qq('', $1,$3,$2); }
3364 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\#) ((?:$qq_char)+?) (\#) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3365 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3366 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3367 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3368 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3369 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\S) ((?:$qq_char)+?) (\1) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3370  
3371 0 elsif (/\G -s (?>\s*) (\') ((?:\\\'|\\\\|$q_char)+?) (\') /oxgc) { $slash = 'm//'; return '-s ' . e_q ('', $1,$3,$2); }
3372 0 elsif (/\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$q_char)+?) (\#) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3373 0 elsif (/\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3374 0 elsif (/\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3375 0 elsif (/\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3376 0 elsif (/\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3377 0 elsif (/\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$q_char)+?) (\1) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3378  
3379 elsif (/\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)* ) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ) )*) /oxgc)
3380 0 { $slash = 'm//'; return "-s $1"; }
3381 0 elsif (/\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /oxgc) { $slash = 'm//'; return "-s ($1)"; }
3382 0 elsif (/\G -s (?= (?>\s+) [a-z]+) /oxgc) { $slash = 'm//'; return '-s'; }
3383 0 elsif (/\G -s (?>\s+) ((?>\w+)) /oxgc) { $slash = 'm//'; return "-s $1"; }
3384  
3385 2 elsif (/\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'length'; }
3386 2 elsif (/\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'chr'; }
3387 36 elsif (/\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Ecyrillic::chr'; }
3388 2 elsif (/\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'div'; return 'ord'; }
3389 8 elsif (/\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'div'; return $function_ord; }
3390 0 elsif (/\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Ecyrillic::glob'; }
3391 0 elsif (/\G \b lc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ecyrillic::lc_'; }
3392 0 elsif (/\G \b lcfirst \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ecyrillic::lcfirst_'; }
3393 0 elsif (/\G \b uc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ecyrillic::uc_'; }
3394 0 elsif (/\G \b ucfirst \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ecyrillic::ucfirst_'; }
3395 0 elsif (/\G \b fc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ecyrillic::fc_'; }
3396 0 elsif (/\G -s \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return '-s '; }
3397  
3398 0 elsif (/\G \b bytes::length \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'length'; }
3399 0 elsif (/\G \b bytes::chr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'chr'; }
3400 0 elsif (/\G \b chr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ecyrillic::chr_'; }
3401 0 elsif (/\G \b bytes::ord \b (?! (?>\s*) => ) /oxgc) { $slash = 'div'; return 'ord'; }
3402 0 elsif (/\G \b ord \b (?! (?>\s*) => ) /oxgc) { $slash = 'div'; return $function_ord_; }
3403 0 elsif (/\G \b glob \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ecyrillic::glob_'; }
3404 0 elsif (/\G \b reverse \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return $function_reverse; }
3405 8 elsif (/\G \b getc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return $function_getc; }
3406 # split
3407 elsif (/\G \b (split) \b (?! (?>\s*) => ) /oxgc) {
3408 87 $slash = 'm//';
3409  
3410 87 my $e = '';
3411 87 ▶ while (/\G ( (?>\s+) | \( | \#.* ) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\G ( (?>\s+) | \( | \#.* ) /cgox) 85 87 172
3412 85 $e .= $1;
3413 }
3414  
3415 # end of split
3416 87 ▶ if (/\G (?= [,;\)\}\]] ) /oxgc) { return 'Ecyrillic::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
3417  
3418 # split scalar value
3419 1 elsif (/\G ( [\$\@\&\*] $qq_scalar ) /oxgc) { return 'Ecyrillic::split' . $e . e_string($1); }
3420  
3421 # split literal space
3422 0 elsif (/\G \b qq (\#) [ ] (\#) /oxgc) { return 'Ecyrillic::split' . $e . qq {qq$1 $2}; }
3423 0 elsif (/\G \b qq ((?>\s*)) (\() [ ] (\)) /oxgc) { return 'Ecyrillic::split' . $e . qq{$1qq$2 $3}; }
3424 0 elsif (/\G \b qq ((?>\s*)) (\{) [ ] (\}) /oxgc) { return 'Ecyrillic::split' . $e . qq{$1qq$2 $3}; }
3425 0 elsif (/\G \b qq ((?>\s*)) (\[) [ ] (\]) /oxgc) { return 'Ecyrillic::split' . $e . qq{$1qq$2 $3}; }
3426 0 elsif (/\G \b qq ((?>\s*)) (\<) [ ] (\>) /oxgc) { return 'Ecyrillic::split' . $e . qq{$1qq$2 $3}; }
3427 0 elsif (/\G \b qq ((?>\s*)) (\S) [ ] (\2) /oxgc) { return 'Ecyrillic::split' . $e . qq{$1qq$2 $3}; }
3428 0 elsif (/\G \b q (\#) [ ] (\#) /oxgc) { return 'Ecyrillic::split' . $e . qq {q$1 $2}; }
3429 0 elsif (/\G \b q ((?>\s*)) (\() [ ] (\)) /oxgc) { return 'Ecyrillic::split' . $e . qq {$1q$2 $3}; }
3430 0 elsif (/\G \b q ((?>\s*)) (\{) [ ] (\}) /oxgc) { return 'Ecyrillic::split' . $e . qq {$1q$2 $3}; }
3431 0 elsif (/\G \b q ((?>\s*)) (\[) [ ] (\]) /oxgc) { return 'Ecyrillic::split' . $e . qq {$1q$2 $3}; }
3432 0 elsif (/\G \b q ((?>\s*)) (\<) [ ] (\>) /oxgc) { return 'Ecyrillic::split' . $e . qq {$1q$2 $3}; }
3433 0 elsif (/\G \b q ((?>\s*)) (\S) [ ] (\2) /oxgc) { return 'Ecyrillic::split' . $e . qq {$1q$2 $3}; }
3434 10 elsif (/\G ' [ ] ' /oxgc) { return 'Ecyrillic::split' . $e . qq {' '}; }
3435 0 elsif (/\G " [ ] " /oxgc) { return 'Ecyrillic::split' . $e . qq {" "}; }
3436  
3437 # split qq//
3438 elsif (/\G \b (qq) \b /oxgc) {
3439 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Ecyrillic::qq_char)*?) (\#) /cgox) { } 0 0 0
3440 else {
3441 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3442 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 ([*\-:?\\^|]) ((?:$Ecyrillic::qq_char)*?) (\1) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Ecyrillic::qq_char)*?) (\1) /cgox) { } 0 0 0
3443 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq ( ) --> qr ( )
3444 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq { } --> qr { }
3445 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq [ ] --> qr [ ]
3446 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq < > --> qr < >
3447 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) /oxgc) { return e_split($e.'qr','{','}',$2,''); } # qq | | --> qr { }
3448 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq * * --> qr * *
3449 }
3450 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3451 }
3452 }
3453  
3454 # split qr//
3455 elsif (/\G \b (qr) \b /oxgc) {
3456 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1,$3,$2,$4); } # qr# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Ecyrillic::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 12 12
3457 else {
3458 12 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 12 0 12
3459 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 (\') ((?:$Ecyrillic::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 12 12
elsif (/\G ([*\-:?\\^|]) ((?:$Ecyrillic::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 12 12
elsif (/\G (\S) ((?:$Ecyrillic::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 12 0 12
3460 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr ( )
3461 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr { }
3462 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr [ ]
3463 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr < >
3464 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { return e_split_q($e.'qr',$1, $3, $2,$4); } # qr ' '
3465 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr','{','}',$2,$4); } # qr | | --> qr { }
3466 12 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr * *
3467 }
3468 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3469 }
3470 }
3471  
3472 # split q//
3473 elsif (/\G \b (q) \b /oxgc) {
3474 0 ▶ if (/\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:\\\#|\\\\|$Ecyrillic::q_char)*?) (\#) /cgox) { } 0 0 0
3475 else {
3476 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3477 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 ([*\-:?\\^|]) ((?:$Ecyrillic::q_char)*?) (\1) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:\\\\|\\\1| $Ecyrillic::q_char)*?) (\1) /cgox) { } 0 0 0
3478 0 elsif (/\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q ( ) --> qr ( )
3479 0 elsif (/\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q { } --> qr { }
3480 0 elsif (/\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q [ ] --> qr [ ]
3481 0 elsif (/\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q < > --> qr < >
3482 0 elsif (/\G ([*\-:?\\^|]) ((?:$q_char)*?) (\1) /oxgc) { return e_split_q($e.'qr','{','}',$2,''); } # q | | --> qr { }
3483 0 elsif (/\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q * * --> qr * *
3484 }
3485 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3486 }
3487 }
3488  
3489 # split m//
3490 elsif (/\G \b (m) \b /oxgc) {
3491 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1,$3,$2,$4); } # m# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Ecyrillic::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
3492 else {
3493 18 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 18 0 18
3494 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 (\') ((?:$Ecyrillic::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
elsif (/\G ([*\-:?\\^|]) ((?:$Ecyrillic::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
elsif (/\G (\S) ((?:$Ecyrillic::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 18 0 18
3495 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m ( ) --> qr ( )
3496 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m { } --> qr { }
3497 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m [ ] --> qr [ ]
3498 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m < > --> qr < >
3499 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { return e_split_q($e.'qr',$1, $3, $2,$4); } # m ' ' --> qr ' '
3500 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr','{','}',$2,$4); } # m | | --> qr { }
3501 18 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m * * --> qr * *
3502 }
3503 0 die __FILE__, ": Search pattern not terminated\n";
3504 }
3505 }
3506  
3507 # split ''
3508 elsif (/\G (\') /oxgc) {
3509 0 my $q_string = '';
3510 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3511 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 ($Ecyrillic::q_char) /cgox) { } 0 0 0
3512 0 elsif (/\G (\\\') /oxgc) { $q_string .= $1; } # splitqr'' --> split qr''
3513 0 elsif (/\G \' /oxgc) { return e_split_q($e.q{ qr},"'","'",$q_string,''); } # ' ' --> qr ' '
3514 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3515 }
3516 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3517 }
3518  
3519 # split ""
3520 elsif (/\G (\") /oxgc) {
3521 0 my $qq_string = '';
3522 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3523 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 ($Ecyrillic::q_char) /cgox) { } 0 0 0
3524 0 elsif (/\G (\\\") /oxgc) { $qq_string .= $1; } # splitqr"" --> split qr""
3525 0 elsif (/\G \" /oxgc) { return e_split($e.q{ qr},'"','"',$qq_string,''); } # " " --> qr " "
3526 0 elsif (/\G ($q_char) /oxgc) { $qq_string .= $1; }
3527 }
3528 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3529 }
3530  
3531 # split //
3532 elsif (/\G (\/) /oxgc) {
3533 44 my $regexp = '';
3534 44 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 381 0 381
3535 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 ($Ecyrillic::q_char) /cgox) { } 337 0 337
3536 0 elsif (/\G (\\\/) /oxgc) { $regexp .= $1; } # splitqr// --> split qr//
3537 44 elsif (/\G \/ ([cgimosxpadlunbB]*) /oxgc) { return e_split($e.q{ qr}, '/','/',$regexp,$1); } # / / --> qr / /
3538 337 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
3539 }
3540 0 die __FILE__, ": Search pattern not terminated\n";
3541 }
3542 }
3543  
3544 # tr/// or y///
3545  
3546 # about [cdsrbB]* (/B modifier)
3547 #
3548 # P.559 appendix C
3549 # of ISBN 4-89052-384-7 Programming perl
3550 # (Japanese title is: Perl puroguramingu)
3551  
3552 elsif (/\G \b ( tr | y ) \b /oxgc) {
3553 4 my $ope = $1;
3554  
3555 # $1 $2 $3 $4 $5 $6
3556 4 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ((?:$qq_char)*?) (\#) ([cdsrbB]*) /oxgc) { # tr# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Ecyrillic::qq_char)*?) (\#) ((?:$Ecyrillic::qq_char)*?) (\#) ([cdsrbB]*) /cgox) { } 0 4 4
3557 0 my @tr = ($tr_variable,$2);
3558 0 return e_tr(@tr,'',$4,$6);
3559 }
3560 else {
3561 4 my $e = '';
3562 4 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 4 0 4
3563 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) ((?:$Ecyrillic::qq_char)*?) (\1) ((?:$Ecyrillic::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 4 0 4
3564 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) {
3565 0 my @tr = ($tr_variable,$2);
3566 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3567 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) ((?:$Ecyrillic::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3568 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) ( )
3569 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) { }
3570 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) [ ]
3571 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) < >
3572 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) * *
3573 }
3574 0 die __FILE__, ": Transliteration replacement not terminated\n";
3575 }
3576 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) {
3577 0 my @tr = ($tr_variable,$2);
3578 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3579 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) ((?:$Ecyrillic::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3580 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } ( )
3581 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } { }
3582 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } [ ]
3583 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } < >
3584 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } * *
3585 }
3586 0 die __FILE__, ": Transliteration replacement not terminated\n";
3587 }
3588 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) {
3589 0 my @tr = ($tr_variable,$2);
3590 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3591 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) ((?:$Ecyrillic::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3592 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] ( )
3593 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] { }
3594 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] [ ]
3595 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] < >
3596 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] * *
3597 }
3598 0 die __FILE__, ": Transliteration replacement not terminated\n";
3599 }
3600 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) {
3601 0 my @tr = ($tr_variable,$2);
3602 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3603 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) ((?:$Ecyrillic::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3604 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > ( )
3605 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > { }
3606 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > [ ]
3607 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > < >
3608 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > * *
3609 }
3610 0 die __FILE__, ": Transliteration replacement not terminated\n";
3611 }
3612 # $1 $2 $3 $4 $5 $6
3613 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { # tr * * *
3614 4 my @tr = ($tr_variable,$2);
3615 4 return e_tr(@tr,'',$4,$6);
3616 }
3617 }
3618 0 die __FILE__, ": Transliteration pattern not terminated\n";
3619 }
3620 }
3621  
3622 # qq//
3623 elsif (/\G \b (qq) \b /oxgc) {
3624 2252 my $ope = $1;
3625  
3626 # if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { return e_qq($ope,$1,$3,$2); } # qq# #
3627 2252 ▶ if (/\G (\#) /oxgc) { # qq# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) /cgox) { } 0 2252 2252
3628 0 my $qq_string = '';
3629 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3630 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 ($Ecyrillic::qq_char) /cgox) { } 0 0 0
3631 0 elsif (/\G (\\\#) /oxgc) { $qq_string .= $1; }
3632 0 elsif (/\G (\#) /oxgc) { return e_qq($ope,'#','#',$qq_string); }
3633 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3634 }
3635 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3636 }
3637  
3638 else {
3639 2252 my $e = '';
3640 2252 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 2252 0 2252
3641 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
3642  
3643 # elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq ( )
3644 elsif (/\G (\() /oxgc) { # qq ( )
3645 0 my $qq_string = '';
3646 0 local $nest = 1;
3647 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3648 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 ($Ecyrillic::qq_char) /cgox) { } 0 0 0
3649 0 elsif (/\G (\\\)) /oxgc) { $qq_string .= $1; }
3650 0 elsif (/\G (\() /oxgc) { $qq_string .= $1; $nest++; }
3651 elsif (/\G (\)) /oxgc) {
3652 0 ▶ if (--$nest == 0) { return $e . e_qq($ope,'(',')',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ecyrillic::nest == 0) { } 0 0 0
3653 0 else { $qq_string .= $1; }
3654 }
3655 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3656 }
3657 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3658 }
3659  
3660 # elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq { }
3661 elsif (/\G (\{) /oxgc) { # qq { }
3662 2222 my $qq_string = '';
3663 2222 local $nest = 1;
3664 2222 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 85130 0 85130
3665 85130 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 5 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 722 84408 85130
elsif (/\G (\\\}) /cgox) { } 0 84408 84408
elsif (/\G (\{) /cgox) { } 1189 83219 84408
elsif (/\G (\}) /cgox) { } 3411 79808 83219
elsif (/\G ($Ecyrillic::qq_char) /cgox) { } 79808 0 79808
3666 0 elsif (/\G (\\\}) /oxgc) { $qq_string .= $1; }
3667 1189 elsif (/\G (\{) /oxgc) { $qq_string .= $1; $nest++; }
3668 elsif (/\G (\}) /oxgc) {
3669 3411 ▶ if (--$nest == 0) { return $e . e_qq($ope,'{','}',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ecyrillic::nest == 0) { } 2222 1189 3411
3670 1189 else { $qq_string .= $1; }
3671 }
3672 79808 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3673 }
3674 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3675 }
3676  
3677 # elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq [ ]
3678 elsif (/\G (\[) /oxgc) { # qq [ ]
3679 0 my $qq_string = '';
3680 0 local $nest = 1;
3681 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3682 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 ($Ecyrillic::qq_char) /cgox) { } 0 0 0
3683 0 elsif (/\G (\\\]) /oxgc) { $qq_string .= $1; }
3684 0 elsif (/\G (\[) /oxgc) { $qq_string .= $1; $nest++; }
3685 elsif (/\G (\]) /oxgc) {
3686 0 ▶ if (--$nest == 0) { return $e . e_qq($ope,'[',']',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ecyrillic::nest == 0) { } 0 0 0
3687 0 else { $qq_string .= $1; }
3688 }
3689 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3690 }
3691 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3692 }
3693  
3694 # elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq < >
3695 elsif (/\G (\<) /oxgc) { # qq < >
3696 30 my $qq_string = '';
3697 30 local $nest = 1;
3698 30 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 1166 0 1166
3699 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 ($Ecyrillic::qq_char) /cgox) { } 1114 0 1114
3700 0 elsif (/\G (\\\>) /oxgc) { $qq_string .= $1; }
3701 0 elsif (/\G (\<) /oxgc) { $qq_string .= $1; $nest++; }
3702 elsif (/\G (\>) /oxgc) {
3703 30 ▶ if (--$nest == 0) { return $e . e_qq($ope,'<','>',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ecyrillic::nest == 0) { } 30 0 30
3704 0 else { $qq_string .= $1; }
3705 }
3706 1114 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3707 }
3708 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3709 }
3710  
3711 # elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq * *
3712 elsif (/\G (\S) /oxgc) { # qq * *
3713 0 my $delimiter = $1;
3714 0 my $qq_string = '';
3715 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3716 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 ($Ecyrillic::qq_char) /cgox) { } 0 0 0
3717 0 elsif (/\G (\\\Q$delimiter\E) /oxgc) { $qq_string .= $1; }
3718 0 elsif (/\G (\Q$delimiter\E) /oxgc) { return $e . e_qq($ope,$delimiter,$delimiter,$qq_string); }
3719 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3720 }
3721 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3722 }
3723 }
3724 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3725 }
3726 }
3727  
3728 # qr//
3729 elsif (/\G \b (qr) \b /oxgc) {
3730 0 my $ope = $1;
3731 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { # qr# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Ecyrillic::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 0 0
3732 0 return e_qr($ope,$1,$3,$2,$4);
3733 }
3734 else {
3735 0 my $e = '';
3736 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3737 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 (\') ((?:$Ecyrillic::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G ([*\-:?\\^|]) ((?:$Ecyrillic::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Ecyrillic::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
3738 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr ( )
3739 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr { }
3740 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr [ ]
3741 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr < >
3742 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { return $e . e_qr_q($ope,$1, $3, $2,$4); } # qr ' '
3743 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,'{','}',$2,$4); } # qr | | --> qr { }
3744 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr * *
3745 }
3746 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3747 }
3748 }
3749  
3750 # qw//
3751 elsif (/\G \b (qw) \b /oxgc) {
3752 16 my $ope = $1;
3753 16 ▶ if (/\G (\#) (.*?) (\#) /oxmsgc) { # qw# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) (.*?) (\#) /cgmosx) { } 0 16 16
3754 0 return e_qw($ope,$1,$3,$2);
3755 }
3756 else {
3757 16 my $e = '';
3758 16 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 16 0 16
3759 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) ((?:$Ecyrillic::q_char)*?) (\1) /cgmosx) { } 0 0 0
3760  
3761 16 elsif (/\G (\() ([^(]*?) (\)) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw ( )
3762 0 elsif (/\G (\() ((?:$q_paren)*?) (\)) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw ( )
3763  
3764 0 elsif (/\G (\{) ([^{]*?) (\}) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw { }
3765 0 elsif (/\G (\{) ((?:$q_brace)*?) (\}) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw { }
3766  
3767 0 elsif (/\G (\[) ([^[]*?) (\]) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw [ ]
3768 0 elsif (/\G (\[) ((?:$q_bracket)*?) (\]) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw [ ]
3769  
3770 0 elsif (/\G (\<) ([^<]*?) (\>) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw < >
3771 0 elsif (/\G (\<) ((?:$q_angle)*?) (\>) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw < >
3772  
3773 0 elsif (/\G ([\x21-\x3F]) (.*?) (\1) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw * *
3774 0 elsif (/\G (\S) ((?:$q_char)*?) (\1) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw * *
3775 }
3776 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3777 }
3778 }
3779  
3780 # qx//
3781 elsif (/\G \b (qx) \b /oxgc) {
3782 0 my $ope = $1;
3783 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qx# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Ecyrillic::qq_char)*?) (\#) /cgox) { } 0 0 0
3784 0 return e_qq($ope,$1,$3,$2);
3785 }
3786 else {
3787 0 my $e = '';
3788 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3789 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 (\') ((?:$Ecyrillic::qq_char)*?) (\') /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Ecyrillic::qq_char)*?) (\1) /cgox) { } 0 0 0
3790 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx ( )
3791 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx { }
3792 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx [ ]
3793 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx < >
3794 0 elsif (/\G (\') ((?:$qq_char)*?) (\') /oxgc) { return $e . e_q ($ope,$1,$3,$2); } # qx ' '
3795 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx * *
3796 }
3797 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3798 }
3799 }
3800  
3801 # q//
3802 elsif (/\G \b (q) \b /oxgc) {
3803 473 my $ope = $1;
3804  
3805 # if (/\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { return e_q($ope,$1,$3,$2); } # q# #
3806  
3807 # avoid "Error: Runtime exception" of perl version 5.005_03
3808 # (and so on)
3809  
3810 473 ▶ if (/\G (\#) /oxgc) { # q# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) /cgox) { } 0 473 473
3811 0 my $q_string = '';
3812 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3813 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 ($Ecyrillic::q_char) /cgox) { } 0 0 0
3814 0 elsif (/\G (\\\#) /oxgc) { $q_string .= $1; }
3815 0 elsif (/\G (\#) /oxgc) { return e_q($ope,'#','#',$q_string); }
3816 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3817 }
3818 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3819 }
3820  
3821 else {
3822 473 my $e = '';
3823 473 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 473 0 473
3824 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
3825  
3826 # elsif (/\G (\() ((?:\\\)|\\\\|$q_paren)*?) (\)) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q ( )
3827 elsif (/\G (\() /oxgc) { # q ( )
3828 0 my $q_string = '';
3829 0 local $nest = 1;
3830 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3831 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 ($Ecyrillic::q_char) /cgox) { } 0 0 0
3832 0 elsif (/\G (\\\)) /oxgc) { $q_string .= $1; }
3833 0 elsif (/\G (\\\() /oxgc) { $q_string .= $1; }
3834 0 elsif (/\G (\() /oxgc) { $q_string .= $1; $nest++; }
3835 elsif (/\G (\)) /oxgc) {
3836 0 ▶ if (--$nest == 0) { return $e . e_q($ope,'(',')',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ecyrillic::nest == 0) { } 0 0 0
3837 0 else { $q_string .= $1; }
3838 }
3839 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3840 }
3841 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3842 }
3843  
3844 # elsif (/\G (\{) ((?:\\\}|\\\\|$q_brace)*?) (\}) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q { }
3845 elsif (/\G (\{) /oxgc) { # q { }
3846 467 my $q_string = '';
3847 467 local $nest = 1;
3848 467 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 8275 0 8275
3849 0 ▶ if (/\G (\\\\) /oxgc) { $q_string .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 8275 8275
elsif (/\G (\\\}) /cgox) { } 0 8275 8275
elsif (/\G (\\\{) /cgox) { } 0 8275 8275
elsif (/\G (\{) /cgox) { } 159 8116 8275
elsif (/\G (\}) /cgox) { } 626 7490 8116
elsif (/\G ($Ecyrillic::q_char) /cgox) { } 7490 0 7490
3850 0 elsif (/\G (\\\}) /oxgc) { $q_string .= $1; }
3851 0 elsif (/\G (\\\{) /oxgc) { $q_string .= $1; }
3852 159 elsif (/\G (\{) /oxgc) { $q_string .= $1; $nest++; }
3853 elsif (/\G (\}) /oxgc) {
3854 626 ▶ if (--$nest == 0) { return $e . e_q($ope,'{','}',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ecyrillic::nest == 0) { } 467 159 626
3855 159 else { $q_string .= $1; }
3856 }
3857 7490 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3858 }
3859 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3860 }
3861  
3862 # elsif (/\G (\[) ((?:\\\]|\\\\|$q_bracket)*?) (\]) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q [ ]
3863 elsif (/\G (\[) /oxgc) { # q [ ]
3864 0 my $q_string = '';
3865 0 local $nest = 1;
3866 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3867 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 ($Ecyrillic::q_char) /cgox) { } 0 0 0
3868 0 elsif (/\G (\\\]) /oxgc) { $q_string .= $1; }
3869 0 elsif (/\G (\\\[) /oxgc) { $q_string .= $1; }
3870 0 elsif (/\G (\[) /oxgc) { $q_string .= $1; $nest++; }
3871 elsif (/\G (\]) /oxgc) {
3872 0 ▶ if (--$nest == 0) { return $e . e_q($ope,'[',']',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ecyrillic::nest == 0) { } 0 0 0
3873 0 else { $q_string .= $1; }
3874 }
3875 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3876 }
3877 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3878 }
3879  
3880 # elsif (/\G (\<) ((?:\\\>|\\\\|$q_angle)*?) (\>) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q < >
3881 elsif (/\G (\<) /oxgc) { # q < >
3882 5 my $q_string = '';
3883 5 local $nest = 1;
3884 5 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 88 0 88
3885 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 ($Ecyrillic::q_char) /cgox) { } 83 0 83
3886 0 elsif (/\G (\\\>) /oxgc) { $q_string .= $1; }
3887 0 elsif (/\G (\\\<) /oxgc) { $q_string .= $1; }
3888 0 elsif (/\G (\<) /oxgc) { $q_string .= $1; $nest++; }
3889 elsif (/\G (\>) /oxgc) {
3890 5 ▶ if (--$nest == 0) { return $e . e_q($ope,'<','>',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ecyrillic::nest == 0) { } 5 0 5
3891 0 else { $q_string .= $1; }
3892 }
3893 83 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3894 }
3895 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3896 }
3897  
3898 # elsif (/\G (\S) ((?:\\\1|\\\\|$q_char)*?) (\1) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q * *
3899 elsif (/\G (\S) /oxgc) { # q * *
3900 1 my $delimiter = $1;
3901 1 my $q_string = '';
3902 1 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 14 0 14
3903 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 ($Ecyrillic::q_char) /cgox) { } 13 0 13
3904 0 elsif (/\G (\\\Q$delimiter\E) /oxgc) { $q_string .= $1; }
3905 1 elsif (/\G (\Q$delimiter\E) /oxgc) { return $e . e_q($ope,$delimiter,$delimiter,$q_string); }
3906 13 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3907 }
3908 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3909 }
3910 }
3911 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3912 }
3913 }
3914  
3915 # m//
3916 elsif (/\G \b (m) \b /oxgc) {
3917 209 my $ope = $1;
3918 209 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { # m# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Ecyrillic::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
3919 0 return e_qr($ope,$1,$3,$2,$4);
3920 }
3921 else {
3922 209 my $e = '';
3923 209 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 209 0 209
3924 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 (\?) ((?:$Ecyrillic::qq_char)*?) (\?) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
elsif (/\G (\') ((?:$Ecyrillic::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 10 199 209
elsif (/\G ([*\-:\\^|]) ((?:$Ecyrillic::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 199 199
elsif (/\G (\S) ((?:$Ecyrillic::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 199 0 199
3925 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m ( )
3926 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m { }
3927 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m [ ]
3928 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m < >
3929 0 elsif (/\G (\?) ((?:$qq_char)*?) (\?) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m ? ?
3930 10 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr_q($ope,$1, $3, $2,$4); } # m ' '
3931 0 elsif (/\G ([*\-:\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,'{','}',$2,$4); } # m | | --> m { }
3932 199 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m * *
3933 }
3934 0 die __FILE__, ": Search pattern not terminated\n";
3935 }
3936 }
3937  
3938 # s///
3939  
3940 # about [cegimosxpradlunbB]* (/cg modifier)
3941 #
3942 # P.67 Pattern-Matching Operators
3943 # of ISBN 0-596-00241-6 Perl in a Nutshell, Second Edition.
3944  
3945 elsif (/\G \b (s) \b /oxgc) {
3946 101 my $ope = $1;
3947  
3948 # $1 $2 $3 $4 $5 $6
3949 101 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ((?:$qq_char)*?) (\#) ([cegimosxpradlunbB]*) /oxgc) { # s# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Ecyrillic::qq_char)*?) (\#) ((?:$Ecyrillic::qq_char)*?) (\#) ([cegimosxpradlunbB]*) /cgox) { } 1 100 101
3950 1 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3951 }
3952 else {
3953 100 my $e = '';
3954 100 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 100 0 100
3955 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 (\') ((?:$Ecyrillic::qq_char)*?) (\') ((?:$Ecyrillic::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 21 79 100
elsif (/\G ([*\-:?\\^|]) ((?:$Ecyrillic::qq_char)*?) (\1) ((?:$Ecyrillic::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 79 79
elsif (/\G (\$) ((?:$Ecyrillic::qq_char)*?) (\1) ((?:$Ecyrillic::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 79 79
elsif (/\G (\S) ((?:$Ecyrillic::qq_char)*?) (\1) ((?:$Ecyrillic::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 79 0 79
3956 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) {
3957 0 my @s = ($1,$2,$3);
3958 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3959 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 (\') ((?:$Ecyrillic::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Ecyrillic::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Ecyrillic::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Ecyrillic::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Ecyrillic::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3960 # $1 $2 $3 $4
3961 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3962 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3963 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3964 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3965 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3966 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3967 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3968 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3969 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3970 }
3971 0 die __FILE__, ": Substitution replacement not terminated\n";
3972 }
3973 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) {
3974 0 my @s = ($1,$2,$3);
3975 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3976 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 (\') ((?:$Ecyrillic::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Ecyrillic::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Ecyrillic::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Ecyrillic::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Ecyrillic::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3977 # $1 $2 $3 $4
3978 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3979 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3980 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3981 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3982 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3983 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3984 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3985 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3986 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3987 }
3988 0 die __FILE__, ": Substitution replacement not terminated\n";
3989 }
3990 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) {
3991 0 my @s = ($1,$2,$3);
3992 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3993 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 (\') ((?:$Ecyrillic::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Ecyrillic::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Ecyrillic::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3994 # $1 $2 $3 $4
3995 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3996 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3997 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3998 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3999 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4000 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4001 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4002 }
4003 0 die __FILE__, ": Substitution replacement not terminated\n";
4004 }
4005 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) {
4006 0 my @s = ($1,$2,$3);
4007 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
4008 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 (\') ((?:$Ecyrillic::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Ecyrillic::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Ecyrillic::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Ecyrillic::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Ecyrillic::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
4009 # $1 $2 $3 $4
4010 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4011 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4012 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4013 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4014 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4015 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4016 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4017 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4018 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4019 }
4020 0 die __FILE__, ": Substitution replacement not terminated\n";
4021 }
4022 # $1 $2 $3 $4 $5 $6
4023 elsif (/\G (\') ((?:$qq_char)*?) (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) {
4024 21 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
4025 }
4026 # $1 $2 $3 $4 $5 $6
4027 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
4028 0 return e_sub($sub_variable,'{',$2,'}','{',$4,'}',$6); # s | | | --> s { } { }
4029 }
4030 # $1 $2 $3 $4 $5 $6
4031 elsif (/\G (\$) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
4032 0 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
4033 }
4034 # $1 $2 $3 $4 $5 $6
4035 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
4036 79 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
4037 }
4038 }
4039 0 die __FILE__, ": Substitution pattern not terminated\n";
4040 }
4041 }
4042  
4043 # require ignore module
4044 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# require$1$2"; }
4045 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# require$1\n$2"; }
4046 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# require$1"; }
4047  
4048 # use strict; --> use strict; no strict qw(refs);
4049 37 elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "use$1 no strict qw(refs);$2"; }
4050 0 elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [^#]) /oxmsgc) { return "use$1 no strict qw(refs);\n$2"; }
4051 0 elsif (/\G \b use ((?>\s+) strict) \b /oxmsgc) { return "use$1; no strict qw(refs)"; }
4052  
4053 # use 5.12.0; --> use 5.12.0; no strict qw(refs);
4054 elsif (/\G \b use (?>\s+) ((?>([1-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /oxmsgc) {
4055 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
4056 0 return "use $1; no strict qw(refs);";
4057 }
4058 else {
4059 2 return "use $1;";
4060 }
4061 }
4062 elsif (/\G \b use (?>\s+) ((?>v([0-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /oxmsgc) {
4063 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
4064 0 return "use $1; no strict qw(refs);";
4065 }
4066 else {
4067 0 return "use $1;";
4068 }
4069 }
4070  
4071 # ignore use module
4072 2 elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# use$1$2"; }
4073 0 elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# use$1\n$2"; }
4074 0 elsif (/\G \b use ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# use$1"; }
4075  
4076 # ignore no module
4077 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# no$1$2"; }
4078 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# no$1\n$2"; }
4079 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# no$1"; }
4080  
4081 # use else
4082 0 elsif (/\G \b use \b /oxmsgc) { return "use"; }
4083  
4084 # use else
4085 2 elsif (/\G \b no \b /oxmsgc) { return "no"; }
4086  
4087 # ''
4088 elsif (/\G (?<![\w\$\@\%\&\*]) (\') /oxgc) {
4089 1142 my $q_string = '';
4090 1142 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 10201 0 10201
4091 10201 ▶ if (/\G (\\\\) /oxgc) { $q_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 4 10197 10201
elsif (/\G (\\\') /cgox) { } 48 10149 10197
elsif (/\G \' /cgox) { } 1142 9007 10149
elsif (/\G ($Ecyrillic::q_char) /cgox) { } 9007 0 9007
4092 48 elsif (/\G (\\\') /oxgc) { $q_string .= $1; }
4093 1142 elsif (/\G \' /oxgc) { return e_q('', "'","'",$q_string); }
4094 9007 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
4095 }
4096 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4097 }
4098  
4099 # ""
4100 elsif (/\G (\") /oxgc) {
4101 1953 my $qq_string = '';
4102 1953 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 37647 0 37647
4103 37647 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 67 37580 37647
elsif (/\G (\\\") /cgox) { } 12 37568 37580
elsif (/\G \" /cgox) { } 1953 35615 37568
elsif (/\G ($Ecyrillic::q_char) /cgox) { } 35615 0 35615
4104 12 elsif (/\G (\\\") /oxgc) { $qq_string .= $1; }
4105 1953 elsif (/\G \" /oxgc) { return e_qq('', '"','"',$qq_string); }
4106 35615 elsif (/\G ($q_char) /oxgc) { $qq_string .= $1; }
4107 }
4108 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4109 }
4110  
4111 # ``
4112 elsif (/\G (\`) /oxgc) {
4113 1 my $qx_string = '';
4114 1 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 19 0 19
4115 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 ($Ecyrillic::q_char) /cgox) { } 18 0 18
4116 0 elsif (/\G (\\\`) /oxgc) { $qx_string .= $1; }
4117 1 elsif (/\G \` /oxgc) { return e_qq('', '`','`',$qx_string); }
4118 18 elsif (/\G ($q_char) /oxgc) { $qx_string .= $1; }
4119 }
4120 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4121 }
4122  
4123 # // --- not divide operator (num / num), not defined-or
4124 ▶ elsif (($slash eq 'm//') and /\G (\/) /oxgc) {
Condition100%3/3
$Ecyrillic::slash eq "m//" and m[\G (/) ]cgox
!ll&&!rl&&r
277458848681
MC/DC100%2/2
$Ecyrillic::slash eq "m//" and m[\G (/) ]cgox
$Ecyrillic::slash eq "m//" m[\G (/) ]cgox
Truth table100%3/3
A and B
A= $Ecyrillic::slash eq "m//"B= m[\G (/) ]cgox
ABresult
0X0
100
111
4125 681 my $regexp = '';
4126 681 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 5636 0 5636
4127 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 ($Ecyrillic::q_char) /cgox) { } 4955 0 4955
4128 0 elsif (/\G (\\\/) /oxgc) { $regexp .= $1; }
4129 681 elsif (/\G \/ ([cgimosxpadlunbB]*) /oxgc) { return e_qr('', '/','/',$regexp,$1); }
4130 4955 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
4131 }
4132 0 die __FILE__, ": Search pattern not terminated\n";
4133 }
4134  
4135 # ?? --- not conditional operator (condition ? then : else)
4136 ▶ elsif (($slash eq 'm//') and /\G (\?) /oxgc) {
Condition66%2/3
$Ecyrillic::slash eq "m//" and /\G (\?) /cgox
!ll&&!rl&&r
2774588480
MC/DC0%0/2
$Ecyrillic::slash eq "m//" and /\G (\?) /cgox
$Ecyrillic::slash eq "m//" /\G (\?) /cgox
Truth table66%2/3
A and B
A= $Ecyrillic::slash eq "m//"B= /\G (\?) /cgox
ABresult
0X0
100
111
4137 0 my $regexp = '';
4138 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
4139 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 ($Ecyrillic::q_char) /cgox) { } 0 0 0
4140 0 elsif (/\G (\\\?) /oxgc) { $regexp .= $1; }
4141 0 elsif (/\G \? ([cgimosxpadlunbB]*) /oxgc) { return e_qr('m','?','?',$regexp,$1); }
4142 0 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
4143 }
4144 0 die __FILE__, ": Search pattern not terminated\n";
4145 }
4146  
4147 # <<>> (a safer ARGV)
4148 0 elsif (/\G ( <<>> ) /oxgc) { $slash = 'm//'; return $1; }
4149  
4150 # << (bit shift) --- not here document
4151 0 elsif (/\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /oxgc) { $slash = 'm//'; return $1; }
4152  
4153 # <<~'HEREDOC'
4154 elsif (/\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /oxgc) {
4155 6 $slash = 'm//';
4156 6 my $here_quote = $1;
4157 6 my $delimiter = $2;
4158  
4159 # get here document
4160 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4161 6 $here_script = CORE::substr $_, pos $_;
4162 6 $here_script =~ s/.*?\n//oxm;
4163 }
4164 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
4165 6 my $heredoc = $1;
4166 6 my $indent = $2;
4167 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4168 6 push @heredoc, $heredoc . qq{\n$delimiter\n};
4169 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4170 }
4171 else {
4172 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4173 }
4174 6 return qq{<<'$delimiter'};
4175 }
4176  
4177 # <<~\HEREDOC
4178  
4179 # P.66 2.6.6. "Here" Documents
4180 # in Chapter 2: Bits and Pieces
4181 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4182  
4183 # P.73 "Here" Documents
4184 # in Chapter 2: Bits and Pieces
4185 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4186  
4187 elsif (/\G ( <<~ \\([a-zA-Z_0-9]+) ) /oxgc) {
4188 3 $slash = 'm//';
4189 3 my $here_quote = $1;
4190 3 my $delimiter = $2;
4191  
4192 # get here document
4193 3 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 3 0 3
4194 3 $here_script = CORE::substr $_, pos $_;
4195 3 $here_script =~ s/.*?\n//oxm;
4196 }
4197 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
4198 3 my $heredoc = $1;
4199 3 my $indent = $2;
4200 3 $heredoc =~ s{^$indent}{}msg; # no /ox
4201 3 push @heredoc, $heredoc . qq{\n$delimiter\n};
4202 3 push @heredoc_delimiter, qq{\\s*$delimiter};
4203 }
4204 else {
4205 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4206 }
4207 3 return qq{<<\\$delimiter};
4208 }
4209  
4210 # <<~"HEREDOC"
4211 elsif (/\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /oxgc) {
4212 6 $slash = 'm//';
4213 6 my $here_quote = $1;
4214 6 my $delimiter = $2;
4215  
4216 # get here document
4217 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4218 6 $here_script = CORE::substr $_, pos $_;
4219 6 $here_script =~ s/.*?\n//oxm;
4220 }
4221 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
4222 6 my $heredoc = $1;
4223 6 my $indent = $2;
4224 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4225 6 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4226 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4227 }
4228 else {
4229 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4230 }
4231 6 return qq{<<"$delimiter"};
4232 }
4233  
4234 # <<~HEREDOC
4235 elsif (/\G ( <<~ ([a-zA-Z_0-9]+) ) /oxgc) {
4236 3 $slash = 'm//';
4237 3 my $here_quote = $1;
4238 3 my $delimiter = $2;
4239  
4240 # get here document
4241 3 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 3 0 3
4242 3 $here_script = CORE::substr $_, pos $_;
4243 3 $here_script =~ s/.*?\n//oxm;
4244 }
4245 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
4246 3 my $heredoc = $1;
4247 3 my $indent = $2;
4248 3 $heredoc =~ s{^$indent}{}msg; # no /ox
4249 3 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4250 3 push @heredoc_delimiter, qq{\\s*$delimiter};
4251 }
4252 else {
4253 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4254 }
4255 3 return qq{<<$delimiter};
4256 }
4257  
4258 # <<~`HEREDOC`
4259 elsif (/\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /oxgc) {
4260 6 $slash = 'm//';
4261 6 my $here_quote = $1;
4262 6 my $delimiter = $2;
4263  
4264 # get here document
4265 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4266 6 $here_script = CORE::substr $_, pos $_;
4267 6 $here_script =~ s/.*?\n//oxm;
4268 }
4269 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
4270 6 my $heredoc = $1;
4271 6 my $indent = $2;
4272 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4273 6 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4274 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4275 }
4276 else {
4277 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4278 }
4279 6 return qq{<<`$delimiter`};
4280 }
4281  
4282 # <<'HEREDOC'
4283 elsif (/\G ( << '([a-zA-Z_0-9]*)' ) /oxgc) {
4284 72 $slash = 'm//';
4285 72 my $here_quote = $1;
4286 72 my $delimiter = $2;
4287  
4288 # get here document
4289 72 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 72 0 72
4290 72 $here_script = CORE::substr $_, pos $_;
4291 72 $here_script =~ s/.*?\n//oxm;
4292 }
4293 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
4294 72 push @heredoc, $1 . qq{\n$delimiter\n};
4295 72 push @heredoc_delimiter, $delimiter;
4296 }
4297 else {
4298 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4299 }
4300 72 return $here_quote;
4301 }
4302  
4303 # <<\HEREDOC
4304  
4305 # P.66 2.6.6. "Here" Documents
4306 # in Chapter 2: Bits and Pieces
4307 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4308  
4309 # P.73 "Here" Documents
4310 # in Chapter 2: Bits and Pieces
4311 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4312  
4313 elsif (/\G ( << \\([a-zA-Z_0-9]+) ) /oxgc) {
4314 0 $slash = 'm//';
4315 0 my $here_quote = $1;
4316 0 my $delimiter = $2;
4317  
4318 # get here document
4319 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4320 0 $here_script = CORE::substr $_, pos $_;
4321 0 $here_script =~ s/.*?\n//oxm;
4322 }
4323 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
4324 0 push @heredoc, $1 . qq{\n$delimiter\n};
4325 0 push @heredoc_delimiter, $delimiter;
4326 }
4327 else {
4328 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4329 }
4330 0 return $here_quote;
4331 }
4332  
4333 # <<"HEREDOC"
4334 elsif (/\G ( << "([a-zA-Z_0-9]*)" ) /oxgc) {
4335 36 $slash = 'm//';
4336 36 my $here_quote = $1;
4337 36 my $delimiter = $2;
4338  
4339 # get here document
4340 36 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 36 0 36
4341 36 $here_script = CORE::substr $_, pos $_;
4342 36 $here_script =~ s/.*?\n//oxm;
4343 }
4344 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
4345 36 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4346 36 push @heredoc_delimiter, $delimiter;
4347 }
4348 else {
4349 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4350 }
4351 36 return $here_quote;
4352 }
4353  
4354 # <<HEREDOC
4355 elsif (/\G ( << ([a-zA-Z_0-9]+) ) /oxgc) {
4356 42 $slash = 'm//';
4357 42 my $here_quote = $1;
4358 42 my $delimiter = $2;
4359  
4360 # get here document
4361 42 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 42 0 42
4362 42 $here_script = CORE::substr $_, pos $_;
4363 42 $here_script =~ s/.*?\n//oxm;
4364 }
4365 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
4366 42 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4367 42 push @heredoc_delimiter, $delimiter;
4368 }
4369 else {
4370 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4371 }
4372 42 return $here_quote;
4373 }
4374  
4375 # <<`HEREDOC`
4376 elsif (/\G ( << `([a-zA-Z_0-9]*)` ) /oxgc) {
4377 0 $slash = 'm//';
4378 0 my $here_quote = $1;
4379 0 my $delimiter = $2;
4380  
4381 # get here document
4382 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4383 0 $here_script = CORE::substr $_, pos $_;
4384 0 $here_script =~ s/.*?\n//oxm;
4385 }
4386 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
4387 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4388 0 push @heredoc_delimiter, $delimiter;
4389 }
4390 else {
4391 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4392 }
4393 0 return $here_quote;
4394 }
4395  
4396 # <<= <=> <= < operator
4397 elsif (/\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/oxgc) {
4398 12 return $1;
4399 }
4400  
4401 # <FILEHANDLE>
4402 elsif (/\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /oxgc) {
4403 0 return $1;
4404 }
4405  
4406 # <WILDCARD> --- glob
4407  
4408 # avoid "Error: Runtime exception" of perl version 5.005_03
4409  
4410 elsif (/\G < ((?:[^>\0\a\e\f\n\r\t])+?) > /oxgc) {
4411 0 return 'Ecyrillic::glob("' . $1 . '")';
4412 }
4413  
4414 # __DATA__
4415 0 elsif (/\G ^ ( __DATA__ \n .*) \z /oxmsgc) { return $1; }
4416  
4417 # __END__
4418 210 elsif (/\G ^ ( __END__ \n .*) \z /oxmsgc) { return $1; }
4419  
4420 # \cD Control-D
4421  
4422 # P.68 2.6.8. Other Literal Tokens
4423 # in Chapter 2: Bits and Pieces
4424 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4425  
4426 # P.76 Other Literal Tokens
4427 # in Chapter 2: Bits and Pieces
4428 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4429  
4430 0 elsif (/\G ( \cD .*) \z /oxmsgc) { return $1; }
4431  
4432 # \cZ Control-Z
4433 0 elsif (/\G ( \cZ .*) \z /oxmsgc) { return $1; }
4434  
4435 # any operator before div
4436 elsif (/\G (
4437 -- | \+\+ |
4438 [\)\}\]]
4439  
4440 5839 ) /oxgc) { $slash = 'div'; return $1; }
4441  
4442 # yada-yada or triple-dot operator
4443 elsif (/\G (
4444 \.\.\.
4445  
4446 7 ) /oxgc) { $slash = 'm//'; return q{die('Unimplemented')}; }
4447  
4448 # any operator before m//
4449  
4450 # //, //= (defined-or)
4451  
4452 # P.164 Logical Operators
4453 # in Chapter 10: More Control Structures
4454 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
4455  
4456 # P.119 C-Style Logical (Short-Circuit) Operators
4457 # in Chapter 3: Unary and Binary Operators
4458 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4459  
4460 # (and so on)
4461  
4462 # ~~
4463  
4464 # P.221 The Smart Match Operator
4465 # in Chapter 15: Smart Matching and given-when
4466 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
4467  
4468 # P.112 Smartmatch Operator
4469 # in Chapter 3: Unary and Binary Operators
4470 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4471  
4472 # (and so on)
4473  
4474 elsif (/\G ((?>
4475  
4476 !~~ | !~ | != | ! |
4477 %= | % |
4478 &&= | && | &= | &\.= | &\. | & |
4479 -= | -> | - |
4480 :(?>\s*)= |
4481 : |
4482 <<>> |
4483 <<= | <=> | <= | < |
4484 == | => | =~ | = |
4485 >>= | >> | >= | > |
4486 \*\*= | \*\* | \*= | \* |
4487 \+= | \+ |
4488 \.\. | \.= | \. |
4489 \/\/= | \/\/ |
4490 \/= | \/ |
4491 \? |
4492 \\ |
4493 \^= | \^\.= | \^\. | \^ |
4494 \b x= |
4495 \|\|= | \|\| | \|= | \|\.= | \|\. | \| |
4496 ~~ | ~\. | ~ |
4497 \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b |
4498 \b(?: print )\b |
4499  
4500 [,;\(\{\[]
4501  
4502 9813 )) /oxgc) { $slash = 'm//'; return $1; }
4503  
4504 # other any character
4505 20538 elsif (/\G ($q_char) /oxgc) { $slash = 'div'; return $1; }
4506  
4507 # system error
4508 else {
4509 0 die __FILE__, ": Oops, this shouldn't happen!\n";
4510 }
4511 }
4512  
4513 # escape Cyrillic string
4514 1873 ▶sub e_string {
Subroutine e_string: called CC=54 SCAR=72.5
Pod documented
4515 1873 my($string) = @_;
4516 1873 my $e_string = '';
4517  
4518 1873 local $slash = 'm//';
4519  
4520 # P.1024 Appendix W.10 Multibyte Processing
4521 # of ISBN 1-56592-224-7 CJKV Information Processing
4522 # (and so on)
4523  
4524 1873 my @char = $string =~ / \G (?>[^\\]|\\$q_char|$q_char) /oxmsg;
4525  
4526 # without { ... }
4527 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
4528 1854 ▶ if ($string !~ /<</oxms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /<</mosx) 1854 0 1854
4529 1854 return $string;
4530 }
4531 }
4532  
4533 E_STRING_LOOP:
4534 19 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 223 19 242
4535 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\$\@\%\&\*]) (\') ((?:\\\'|\\\\|$Ecyrillic::q_char)*?) (\') /cgox) { } 0 213 213
elsif ($string =~ /\G (\") ((?:$Ecyrillic::qq_char)*?) (\") /cgox) { } 0 213 213
elsif ($string =~ /\G (\`) ((?:$Ecyrillic::qq_char)*?) (\`) /cgox) { } 0 213 213
elsif ($string =~ /\G ($Ecyrillic::q_char) /cgox) { } 213 0 213
4536 }
4537  
4538 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> @{[Ecyrillic::PREMATCH()]}
4539 elsif ($string =~ /\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /oxmsgc) {
4540 0 $e_string .= q{Ecyrillic::PREMATCH()};
4541 0 $slash = 'div';
4542 }
4543  
4544 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> @{[Ecyrillic::MATCH()]}
4545 elsif ($string =~ /\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /oxmsgc) {
4546 0 $e_string .= q{Ecyrillic::MATCH()};
4547 0 $slash = 'div';
4548 }
4549  
4550 # $', ${'} --> $', ${'}
4551 elsif ($string =~ /\G ( \$' | \$\{'\} ) /oxmsgc) {
4552 0 $e_string .= $1;
4553 0 $slash = 'div';
4554 }
4555  
4556 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> @{[Ecyrillic::POSTMATCH()]}
4557 elsif ($string =~ /\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /oxmsgc) {
4558 0 $e_string .= q{Ecyrillic::POSTMATCH()};
4559 0 $slash = 'div';
4560 }
4561  
4562 # bareword
4563 elsif ($string =~ /\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /oxmsgc) {
4564 0 $e_string .= $1;
4565 0 $slash = 'div';
4566 }
4567  
4568 # $0 --> $0
4569 elsif ($string =~ /\G ( \$ 0 ) /oxmsgc) {
4570 0 $e_string .= $1;
4571 0 $slash = 'div';
4572 }
4573 elsif ($string =~ /\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /oxmsgc) {
4574 0 $e_string .= $1;
4575 0 $slash = 'div';
4576 }
4577  
4578 # $$ --> $$
4579 elsif ($string =~ /\G ( \$ \$ ) (?![\w\{]) /oxmsgc) {
4580 0 $e_string .= $1;
4581 0 $slash = 'div';
4582 }
4583  
4584 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
4585 # $1, $2, $3 --> $1, $2, $3 otherwise
4586 elsif ($string =~ /\G \$ ((?>[1-9][0-9]*)) /oxmsgc) {
4587 0 $e_string .= e_capture($1);
4588 0 $slash = 'div';
4589 }
4590 elsif ($string =~ /\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /oxmsgc) {
4591 0 $e_string .= e_capture($1);
4592 0 $slash = 'div';
4593 }
4594  
4595 # $$foo[ ... ] --> $ $foo->[ ... ]
4596 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /oxmsgc) {
4597 0 $e_string .= e_capture($1.'->'.$2);
4598 0 $slash = 'div';
4599 }
4600  
4601 # $$foo{ ... } --> $ $foo->{ ... }
4602 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /oxmsgc) {
4603 0 $e_string .= e_capture($1.'->'.$2);
4604 0 $slash = 'div';
4605 }
4606  
4607 # $$foo
4608 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /oxmsgc) {
4609 0 $e_string .= e_capture($1);
4610 0 $slash = 'div';
4611 }
4612  
4613 # ${ foo }
4614 elsif ($string =~ /\G \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} /oxmsgc) {
4615 0 $e_string .= '${' . $1 . '}';
4616 0 $slash = 'div';
4617 }
4618  
4619 # ${ ... }
4620 elsif ($string =~ /\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /oxmsgc) {
4621 3 $e_string .= e_capture($1);
4622 3 $slash = 'div';
4623 }
4624  
4625 # variable or function
4626 # $ @ % & * $ #
4627 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) {
4628 7 $e_string .= $1;
4629 7 $slash = 'div';
4630 }
4631 # $ $ $ $ $ $ $ $ $ $ $ $ $ $
4632 # $ @ # \ ' " / ? ( ) [ ] < >
4633 elsif ($string =~ /\G ( \$[\$\@\#\\\'\"\/\?\(\)\[\]\<\>] ) /oxmsgc) {
4634 0 $e_string .= $1;
4635 0 $slash = 'div';
4636 }
4637  
4638 # qq//
4639 elsif ($string =~ /\G \b (qq) \b /oxgc) {
4640 0 my $ope = $1;
4641 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qq# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Ecyrillic::qq_char)*?) (\#) /cgox) { } 0 0 0
4642 0 $e_string .= e_qq($ope,$1,$3,$2);
4643 }
4644 else {
4645 0 my $e = '';
4646 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4647 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) ((?:$Ecyrillic::qq_char)*?) (\1) /cgox) { } 0 0 0
4648 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq ( )
4649 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq { }
4650 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq [ ]
4651 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq < >
4652 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq * *
4653 }
4654 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4655 }
4656 }
4657  
4658 # qx//
4659 elsif ($string =~ /\G \b (qx) \b /oxgc) {
4660 0 my $ope = $1;
4661 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qx# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Ecyrillic::qq_char)*?) (\#) /cgox) { } 0 0 0
4662 0 $e_string .= e_qq($ope,$1,$3,$2);
4663 }
4664 else {
4665 0 my $e = '';
4666 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4667 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 (\') ((?:$Ecyrillic::qq_char)*?) (\') /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Ecyrillic::qq_char)*?) (\1) /cgox) { } 0 0 0
4668 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx ( )
4669 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx { }
4670 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx [ ]
4671 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx < >
4672 0 elsif ($string =~ /\G (\') ((?:$qq_char)*?) (\') /oxgc) { $e_string .= $e . e_q ($ope,$1,$3,$2); next E_STRING_LOOP; } # qx ' '
4673 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx * *
4674 }
4675 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4676 }
4677 }
4678  
4679 # q//
4680 elsif ($string =~ /\G \b (q) \b /oxgc) {
4681 0 my $ope = $1;
4682 0 ▶ if ($string =~ /\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { # q# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:\\\#|\\\\|$Ecyrillic::q_char)*?) (\#) /cgox) { } 0 0 0
4683 0 $e_string .= e_q($ope,$1,$3,$2);
4684 }
4685 else {
4686 0 my $e = '';
4687 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4688 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| $Ecyrillic::q_char)*?) (\1) /cgox) { } 0 0 0
4689 0 elsif ($string =~ /\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q ( )
4690 0 elsif ($string =~ /\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q { }
4691 0 elsif ($string =~ /\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q [ ]
4692 0 elsif ($string =~ /\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q < >
4693 0 elsif ($string =~ /\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q * *
4694 }
4695 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4696 }
4697 }
4698  
4699 # ''
4700 0 elsif ($string =~ /\G (?<![\w\$\@\%\&\*]) (\') ((?:\\\'|\\\\|$q_char)*?) (\') /oxgc) { $e_string .= e_q('',$1,$3,$2); }
4701  
4702 # ""
4703 0 elsif ($string =~ /\G (\") ((?:$qq_char)*?) (\") /oxgc) { $e_string .= e_qq('',$1,$3,$2); }
4704  
4705 # ``
4706 0 elsif ($string =~ /\G (\`) ((?:$qq_char)*?) (\`) /oxgc) { $e_string .= e_qq('',$1,$3,$2); }
4707  
4708 # other any character
4709 213 elsif ($string =~ /\G ($q_char) /oxgc) { $e_string .= $1; }
4710  
4711 # system error
4712 else {
4713 0 die __FILE__, ": Oops, this shouldn't happen!\n";
4714 }
4715 }
4716  
4717 19 return $e_string;
4718 }
4719  
4720 #
4721 # character class
4722 #
4723 1920 ▶sub character_class {
Subroutine character_class: called CC=3 SCAR=11.0
Pod undocumented
4724 1920 my($char,$modifier) = @_;
4725  
4726 1920 ▶ if ($char eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char eq '.') { } 52 1868 1920
4727 52 ▶ if ($modifier =~ /s/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/) { } 17 35 52
4728 17 return '${Ecyrillic::dot_s}';
4729 }
4730 else {
4731 35 return '${Ecyrillic::dot}';
4732 }
4733 }
4734 else {
4735 1868 return Ecyrillic::classic_character_class($char);
4736 }
4737 }
4738  
4739 #
4740 # escape capture ($1, $2, $3, ...)
4741 #
4742 212 ▶sub e_capture {
Subroutine e_capture: called CC=1 SCAR=0.0
Pod undocumented
4743  
4744 212 return join '', '${', $_[0], '}';
4745 }
4746  
4747 #
4748 # escape transliteration (tr/// or y///)
4749 #
4750 4 ▶sub e_tr {
Subroutine e_tr: called CC=5 SCAR=16.8
Pod undocumented
4751 4 my($variable,$charclass,$e,$charclass2,$modifier) = @_;
4752 4 my $e_tr = '';
4753 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
4754  
4755 4 $slash = 'div';
4756  
4757 # quote character class 1
4758 4 $charclass = q_tr($charclass);
4759  
4760 # quote character class 2
4761 4 $charclass2 = q_tr($charclass2);
4762  
4763 # /b /B modifier
4764 4 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) { } 0 4 4
4765 0 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq '') { } 0 0 0
4766 0 $e_tr = qq{tr$charclass$e$charclass2$modifier};
4767 }
4768 else {
4769 0 $e_tr = qq{$variable${bind_operator}tr$charclass$e$charclass2$modifier};
4770 }
4771 }
4772 else {
4773 4 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq '') { } 2 2 4
4774 2 $e_tr = qq{Ecyrillic::tr(\$_,' =~ ',$charclass,$e$charclass2,'$modifier')};
4775 }
4776 else {
4777 2 $e_tr = qq{Ecyrillic::tr($variable,'$bind_operator',$charclass,$e$charclass2,'$modifier')};
4778 }
4779 }
4780  
4781 # clear tr/// variable
4782 4 $tr_variable = '';
4783 4 $bind_operator = '';
4784  
4785 4 return $e_tr;
4786 }
4787  
4788 #
4789 # quote for escape transliteration (tr/// or y///)
4790 #
4791 8 ▶sub q_tr {
Subroutine q_tr: called CC=9 SCAR=40.6
Pod undocumented
4792 8 my($charclass) = @_;
4793  
4794 # quote character class
4795 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
4796 8 return e_q('', "'", "'", $charclass); # --> q' '
4797 }
4798 elsif ($charclass !~ /\//oxms) {
4799 0 return e_q('q', '/', '/', $charclass); # --> q/ /
4800 }
4801 elsif ($charclass !~ /\#/oxms) {
4802 0 return e_q('q', '#', '#', $charclass); # --> q# #
4803 }
4804 elsif ($charclass !~ /[\<\>]/oxms) {
4805 0 return e_q('q', '<', '>', $charclass); # --> q< >
4806 }
4807 elsif ($charclass !~ /[\(\)]/oxms) {
4808 0 return e_q('q', '(', ')', $charclass); # --> q( )
4809 }
4810 elsif ($charclass !~ /[\{\}]/oxms) {
4811 0 return e_q('q', '{', '}', $charclass); # --> q{ }
4812 }
4813 else {
4814 0 for my $char (qw( ! " $ % & * + . : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
4815 0 ▶ if ($charclass !~ /\Q$char\E/xms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($charclass =~ /\Q$char\E/msx) 0 0 0
4816 0 return e_q('q', $char, $char, $charclass);
4817 }
4818 }
4819 }
4820  
4821 0 return e_q('q', '{', '}', $charclass);
4822 }
4823  
4824 #
4825 # escape q string (q//, '')
4826 #
4827 1623 ▶sub e_q {
Subroutine e_q: called CC=1 SCAR=0.0
Pod undocumented
4828 1623 my($ope,$delimiter,$end_delimiter,$string) = @_;
4829  
4830 1623 $slash = 'div';
4831  
4832 1623 return join '', $ope, $delimiter, $string, $end_delimiter;
4833 }
4834  
4835 #
4836 # escape qq string (qq//, "", qx//, ``)
4837 #
4838 4291 ▶sub e_qq {
Subroutine e_qq: called CC=37 SCAR=50.9
Pod undocumented
4839 4291 my($ope,$delimiter,$end_delimiter,$string) = @_;
4840  
4841 4291 $slash = 'div';
4842  
4843 4291 my $left_e = 0;
4844 4291 my $right_e = 0;
4845  
4846 # split regexp
4847 4291 my @char = $string =~ /\G((?>
4848 [^\\\$] |
4849 \\x\{ (?>[0-9A-Fa-f]+) \} |
4850 \\o\{ (?>[0-7]+) \} |
4851 \\N\{ (?>[^0-9\}][^\}]*) \} |
4852 \\ $q_char |
4853 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
4854 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
4855 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
4856 \$ (?>\s* [0-9]+) |
4857 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
4858 \$ \$ (?![\w\{]) |
4859 \$ (?>\s*) \$ (?>\s*) $qq_variable |
4860 $q_char
4861 ))/oxmsg;
4862  
4863 4291 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 117117 4291 121408
4864  
4865 # "\L\u" --> "\u\L"
4866 117117 ▶ 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 117117 117117
elsif ($char[$i] eq '\\U' and $char[$i + 1] eq '\\l') { } 0 117117 117117
elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/mosx) { } 1 117116 117117
elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/mosx) { } 1 117115 117116
elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/mosx) { } 0 117115 117115
Condition33%1/3
$char[$i] eq "\\L" and $char[$i + 1] eq "\\u"
!ll&&!rl&&r
11711700
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
4867 0 @char[$i,$i+1] = @char[$i+1,$i];
4868 }
4869  
4870 # "\U\l" --> "\l\U"
4871 ▶ 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
11711700
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
4872 0 @char[$i,$i+1] = @char[$i+1,$i];
4873 }
4874  
4875 # octal escape sequence
4876 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
4877 1 $char[$i] = Ecyrillic::octchr($1);
4878 }
4879  
4880 # hexadecimal escape sequence
4881 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
4882 1 $char[$i] = Ecyrillic::hexchr($1);
4883 }
4884  
4885 # \N{CHARNAME} --> N{CHARNAME}
4886 elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
4887 0 $char[$i] = $1;
4888 }
4889  
4890 117117 ▶ if (0) {
Branch: 23 branches
BranchTrueFalseTotal
if (do { $char[$i] =~ /\A ([<>]) \z/mosx }) { } 484 116633 117117
elsif ($char[$i] eq '\\u') { } 0 116633 116633
elsif ($char[$i] eq '\\l') { } 0 116633 116633
elsif ($char[$i] eq '\\U') { } 0 116633 116633
elsif ($char[$i] eq '\\L') { } 0 116633 116633
elsif ($char[$i] eq '\\F') { } 24 116609 116633
elsif ($char[$i] eq '\\Q') { } 0 116609 116609
elsif ($char[$i] eq '\\E') { } 24 116585 116609
elsif ($char[$i] eq '\\Q') { } 0 116585 116585
elsif ($char[$i] eq '\\E') { } 0 116585 116585
elsif ($char[$i] =~ /\A \$ 0 \z/mosx) { } 4 116581 116585
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/mosx) { } 0 116581 116581
elsif ($char[$i] =~ /\A \$\$ \z/mosx) { } 0 116581 116581
elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/mosx) { } 205 116376 116581
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/mosx) { } 0 116376 116376
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/mosx) { } 0 116376 116376
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/mosx) { } 0 116376 116376
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/mosx) { } 0 116376 116376
elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/cgmosx) { } 44 116332 116376
elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/cgmosx) { } 45 116287 116332
elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/cgmosx) { } 33 116254 116287
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/mosx) { } 0 116254 116254
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/mosx) { } 0 116254 116254
4891 }
4892  
4893 # \F
4894 #
4895 # P.69 Table 2-6. Translation escapes
4896 # in Chapter 2: Bits and Pieces
4897 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4898 # (and so on)
4899  
4900 # \u \l \U \L \F \Q \E
4901 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
4902 484 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 484 484
4903 0 $char[$i] = '\\' . $char[$i];
4904 }
4905 }
4906 elsif ($char[$i] eq '\u') {
4907  
4908 # "STRING @{[ LIST EXPR ]} MORE STRING"
4909  
4910 # P.257 Other Tricks You Can Do with Hard References
4911 # in Chapter 8: References
4912 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4913  
4914 # P.353 Other Tricks You Can Do with Hard References
4915 # in Chapter 8: References
4916 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4917  
4918 # (and so on)
4919  
4920 0 $char[$i] = '@{[Ecyrillic::ucfirst qq<';
4921 0 $left_e++;
4922 }
4923 elsif ($char[$i] eq '\l') {
4924 0 $char[$i] = '@{[Ecyrillic::lcfirst qq<';
4925 0 $left_e++;
4926 }
4927 elsif ($char[$i] eq '\U') {
4928 0 $char[$i] = '@{[Ecyrillic::uc qq<';
4929 0 $left_e++;
4930 }
4931 elsif ($char[$i] eq '\L') {
4932 0 $char[$i] = '@{[Ecyrillic::lc qq<';
4933 0 $left_e++;
4934 }
4935 elsif ($char[$i] eq '\F') {
4936 24 $char[$i] = '@{[Ecyrillic::fc qq<';
4937 24 $left_e++;
4938 }
4939 elsif ($char[$i] eq '\Q') {
4940 0 $char[$i] = '@{[CORE::quotemeta qq<';
4941 0 $left_e++;
4942 }
4943 elsif ($char[$i] eq '\E') {
4944 24 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 24 0 24
4945 24 $char[$i] = '>]}';
4946 24 $right_e++;
4947 }
4948 else {
4949 0 $char[$i] = '';
4950 }
4951 }
4952 elsif ($char[$i] eq '\Q') {
4953 0 while (1) {
4954 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
4955 0 last;
4956 }
4957 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
4958 0 last;
4959 }
4960 }
4961 }
4962 elsif ($char[$i] eq '\E') {
4963 }
4964  
4965 # $0 --> $0
4966 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
4967 }
4968 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
4969 }
4970  
4971 # $$ --> $$
4972 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
4973 }
4974  
4975 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
4976 # $1, $2, $3 --> $1, $2, $3 otherwise
4977 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
4978 205 $char[$i] = e_capture($1);
4979 }
4980 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
4981 0 $char[$i] = e_capture($1);
4982 }
4983  
4984 # $$foo[ ... ] --> $ $foo->[ ... ]
4985 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
4986 0 $char[$i] = e_capture($1.'->'.$2);
4987 }
4988  
4989 # $$foo{ ... } --> $ $foo->{ ... }
4990 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
4991 0 $char[$i] = e_capture($1.'->'.$2);
4992 }
4993  
4994 # $$foo
4995 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
4996 0 $char[$i] = e_capture($1);
4997 }
4998  
4999 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Ecyrillic::PREMATCH()
5000 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
5001 44 $char[$i] = '@{[Ecyrillic::PREMATCH()]}';
5002 }
5003  
5004 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Ecyrillic::MATCH()
5005 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
5006 45 $char[$i] = '@{[Ecyrillic::MATCH()]}';
5007 }
5008  
5009 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Ecyrillic::POSTMATCH()
5010 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
5011 33 $char[$i] = '@{[Ecyrillic::POSTMATCH()]}';
5012 }
5013  
5014 # ${ foo } --> ${ foo }
5015 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/oxms) {
5016 }
5017  
5018 # ${ ... }
5019 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5020 0 $char[$i] = e_capture($1);
5021 }
5022 }
5023  
5024 # return string
5025 4291 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 4291 4291
5026 0 return join '', $ope, $delimiter, @char, '>]}' x ($left_e - $right_e), $end_delimiter;
5027 }
5028 4291 return join '', $ope, $delimiter, @char, $end_delimiter;
5029 }
5030  
5031 #
5032 # escape qw string (qw//)
5033 #
5034 16 ▶sub e_qw {
Subroutine e_qw: called CC=11 SCAR=43.1
Pod undocumented
5035 16 my($ope,$delimiter,$end_delimiter,$string) = @_;
5036  
5037 16 $slash = 'div';
5038  
5039 # choice again delimiter
5040 16 my %octet = map {$_ => 1} ($string =~ /\G ([\x00-\xFF]) /oxmsg);
5041 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
5042 16 return join '', $ope, $delimiter, $string, $end_delimiter;
5043 }
5044 elsif (not $octet{')'}) {
5045 0 return join '', $ope, '(', $string, ')';
5046 }
5047 elsif (not $octet{'}'}) {
5048 0 return join '', $ope, '{', $string, '}';
5049 }
5050 elsif (not $octet{']'}) {
5051 0 return join '', $ope, '[', $string, ']';
5052 }
5053 elsif (not $octet{'>'}) {
5054 0 return join '', $ope, '<', $string, '>';
5055 }
5056 else {
5057 0 for my $char (qw( ! " $ % & * + - . / : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5058 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5059 0 return join '', $ope, $char, $string, $char;
5060 }
5061 }
5062 }
5063  
5064 # qw/AAA BBB C'CC/ --> ('AAA', 'BBB', 'C\'CC')
5065 0 my @string = CORE::split(/\s+/, $string);
5066 0 for my $string (@string) {
5067 0 my @octet = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5068 0 for my $octet (@octet) {
5069 0 ▶ if ($octet =~ /\A (['\\]) \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($octet =~ /\A (['\\]) \z/mosx) 0 0 0
5070 0 $octet = '\\' . $1;
5071 }
5072 }
5073 0 $string = join '', @octet;
5074 }
5075 0 return join '', '(', (join ', ', map { "'$_'" } @string), ')';
5076 }
5077  
5078 #
5079 # escape here document (<<"HEREDOC", <<HEREDOC, <<`HEREDOC`, <<~"HEREDOC", <<~HEREDOC, <<~`HEREDOC`)
5080 #
5081 93 ▶sub e_heredoc {
Subroutine e_heredoc: called CC=37 SCAR=56.3
Pod undocumented
5082 93 my($string) = @_;
5083  
5084 93 $slash = 'm//';
5085  
5086 93 my $metachar = qr/[\@\\|]/oxms; # '|' is for <<`HEREDOC`
5087  
5088 93 my $left_e = 0;
5089 93 my $right_e = 0;
5090  
5091 # split regexp
5092 93 my @char = $string =~ /\G((?>
5093 [^\\\$] |
5094 \\x\{ (?>[0-9A-Fa-f]+) \} |
5095 \\o\{ (?>[0-7]+) \} |
5096 \\N\{ (?>[^0-9\}][^\}]*) \} |
5097 \\ $q_char |
5098 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5099 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5100 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5101 \$ (?>\s* [0-9]+) |
5102 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5103 \$ \$ (?![\w\{]) |
5104 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5105 $q_char
5106 ))/oxmsg;
5107  
5108 93 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 3229 93 3322
5109  
5110 # "\L\u" --> "\u\L"
5111 3229 ▶ 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 3229 3229
elsif ($char[$i] eq '\\U' and $char[$i + 1] eq '\\l') { } 0 3229 3229
elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/mosx) { } 1 3228 3229
elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/mosx) { } 1 3227 3228
elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/mosx) { } 0 3227 3227
Condition33%1/3
$char[$i] eq "\\L" and $char[$i + 1] eq "\\u"
!ll&&!rl&&r
322900
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
5112 0 @char[$i,$i+1] = @char[$i+1,$i];
5113 }
5114  
5115 # "\U\l" --> "\l\U"
5116 ▶ 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
322900
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
5117 0 @char[$i,$i+1] = @char[$i+1,$i];
5118 }
5119  
5120 # octal escape sequence
5121 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5122 1 $char[$i] = Ecyrillic::octchr($1);
5123 }
5124  
5125 # hexadecimal escape sequence
5126 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5127 1 $char[$i] = Ecyrillic::hexchr($1);
5128 }
5129  
5130 # \N{CHARNAME} --> N{CHARNAME}
5131 elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5132 0 $char[$i] = $1;
5133 }
5134  
5135 3229 ▶ if (0) {
Branch: 23 branches
BranchTrueFalseTotal
if (do { $char[$i] =~ /\A ([<>]) \z/mosx }) { } 0 3229 3229
elsif ($char[$i] eq '\\u') { } 0 3229 3229
elsif ($char[$i] eq '\\l') { } 0 3229 3229
elsif ($char[$i] eq '\\U') { } 0 3229 3229
elsif ($char[$i] eq '\\L') { } 0 3229 3229
elsif ($char[$i] eq '\\F') { } 0 3229 3229
elsif ($char[$i] eq '\\Q') { } 0 3229 3229
elsif ($char[$i] eq '\\E') { } 0 3229 3229
elsif ($char[$i] eq '\\Q') { } 0 3229 3229
elsif ($char[$i] eq '\\E') { } 0 3229 3229
elsif ($char[$i] =~ /\A \$ 0 \z/mosx) { } 0 3229 3229
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/mosx) { } 0 3229 3229
elsif ($char[$i] =~ /\A \$\$ \z/mosx) { } 0 3229 3229
elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/mosx) { } 0 3229 3229
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/mosx) { } 0 3229 3229
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/mosx) { } 0 3229 3229
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/mosx) { } 0 3229 3229
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/mosx) { } 0 3229 3229
elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/cgmosx) { } 8 3221 3229
elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/cgmosx) { } 8 3213 3221
elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/cgmosx) { } 6 3207 3213
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/mosx) { } 0 3207 3207
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/mosx) { } 0 3207 3207
5136 }
5137  
5138 # \u \l \U \L \F \Q \E
5139 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
5140 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
5141 0 $char[$i] = '\\' . $char[$i];
5142 }
5143 }
5144 elsif ($char[$i] eq '\u') {
5145 0 $char[$i] = '@{[Ecyrillic::ucfirst qq<';
5146 0 $left_e++;
5147 }
5148 elsif ($char[$i] eq '\l') {
5149 0 $char[$i] = '@{[Ecyrillic::lcfirst qq<';
5150 0 $left_e++;
5151 }
5152 elsif ($char[$i] eq '\U') {
5153 0 $char[$i] = '@{[Ecyrillic::uc qq<';
5154 0 $left_e++;
5155 }
5156 elsif ($char[$i] eq '\L') {
5157 0 $char[$i] = '@{[Ecyrillic::lc qq<';
5158 0 $left_e++;
5159 }
5160 elsif ($char[$i] eq '\F') {
5161 0 $char[$i] = '@{[Ecyrillic::fc qq<';
5162 0 $left_e++;
5163 }
5164 elsif ($char[$i] eq '\Q') {
5165 0 $char[$i] = '@{[CORE::quotemeta qq<';
5166 0 $left_e++;
5167 }
5168 elsif ($char[$i] eq '\E') {
5169 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
5170 0 $char[$i] = '>]}';
5171 0 $right_e++;
5172 }
5173 else {
5174 0 $char[$i] = '';
5175 }
5176 }
5177 elsif ($char[$i] eq '\Q') {
5178 0 while (1) {
5179 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5180 0 last;
5181 }
5182 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
5183 0 last;
5184 }
5185 }
5186 }
5187 elsif ($char[$i] eq '\E') {
5188 }
5189  
5190 # $0 --> $0
5191 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
5192 }
5193 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
5194 }
5195  
5196 # $$ --> $$
5197 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
5198 }
5199  
5200 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
5201 # $1, $2, $3 --> $1, $2, $3 otherwise
5202 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
5203 0 $char[$i] = e_capture($1);
5204 }
5205 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
5206 0 $char[$i] = e_capture($1);
5207 }
5208  
5209 # $$foo[ ... ] --> $ $foo->[ ... ]
5210 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
5211 0 $char[$i] = e_capture($1.'->'.$2);
5212 }
5213  
5214 # $$foo{ ... } --> $ $foo->{ ... }
5215 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
5216 0 $char[$i] = e_capture($1.'->'.$2);
5217 }
5218  
5219 # $$foo
5220 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
5221 0 $char[$i] = e_capture($1);
5222 }
5223  
5224 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Ecyrillic::PREMATCH()
5225 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
5226 8 $char[$i] = '@{[Ecyrillic::PREMATCH()]}';
5227 }
5228  
5229 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Ecyrillic::MATCH()
5230 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
5231 8 $char[$i] = '@{[Ecyrillic::MATCH()]}';
5232 }
5233  
5234 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Ecyrillic::POSTMATCH()
5235 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
5236 6 $char[$i] = '@{[Ecyrillic::POSTMATCH()]}';
5237 }
5238  
5239 # ${ foo } --> ${ foo }
5240 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/oxms) {
5241 }
5242  
5243 # ${ ... }
5244 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5245 0 $char[$i] = e_capture($1);
5246 }
5247 }
5248  
5249 # return string
5250 93 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 93 93
5251 0 return join '', @char, '>]}' x ($left_e - $right_e);
5252 }
5253 93 return join '', @char;
5254 }
5255  
5256 #
5257 # escape regexp (m//, qr//)
5258 #
5259 880 ▶sub e_qr {
Subroutine e_qr: called CC=110 SCAR=73.6
Pod undocumented
5260 880 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5261 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
5262  
5263 880 $modifier =~ tr/p//d;
5264 880 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 880 880
5265 0 my $line = 0;
5266 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
5267 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
5268 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
5269 0 last;
5270 }
5271 }
5272 0 die qq{Unsupported modifier "$1" used at line $line.\n};
5273 }
5274  
5275 880 $slash = 'div';
5276  
5277 # literal null string pattern
5278 880 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 872 880
elsif ($modifier =~ tr/Bb//d) { } 2 870 872
5279 8 $modifier =~ tr/bB//d;
5280 8 $modifier =~ tr/i//d;
5281 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
5282 }
5283  
5284 # /b /B modifier
5285 elsif ($modifier =~ tr/bB//d) {
5286  
5287 # choice again delimiter
5288 2 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 2 2
5289 0 my @char = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5290 0 my %octet = map {$_ => 1} @char;
5291 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
5292 0 $delimiter = '(';
5293 0 $end_delimiter = ')';
5294 }
5295 elsif (not $octet{'}'}) {
5296 0 $delimiter = '{';
5297 0 $end_delimiter = '}';
5298 }
5299 elsif (not $octet{']'}) {
5300 0 $delimiter = '[';
5301 0 $end_delimiter = ']';
5302 }
5303 elsif (not $octet{'>'}) {
5304 0 $delimiter = '<';
5305 0 $end_delimiter = '>';
5306 }
5307 else {
5308 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5309 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5310 0 $delimiter = $char;
5311 0 $end_delimiter = $char;
5312 0 last;
5313 }
5314 }
5315 }
5316 }
5317  
5318 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
5319 0 return join '', $ope, $delimiter, $string, $matched, $end_delimiter, $modifier;
5320 }
5321 else {
5322 2 return join '', $ope, $delimiter, '(?:', $string, ')', $matched, $end_delimiter, $modifier;
5323 }
5324 }
5325  
5326 870 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 312 558 870
5327 870 my $metachar = qr/[\@\\|[\]{^]/oxms;
5328  
5329 # split regexp
5330 870 my @char = $string =~ /\G((?>
5331 [^\\\$\@\[\(] |
5332 \\x (?>[0-9A-Fa-f]{1,2}) |
5333 \\ (?>[0-7]{2,3}) |
5334 \\c [\x40-\x5F] |
5335 \\x\{ (?>[0-9A-Fa-f]+) \} |
5336 \\o\{ (?>[0-7]+) \} |
5337 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
5338 \\ $q_char |
5339 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5340 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5341 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5342 [\$\@] $qq_variable |
5343 \$ (?>\s* [0-9]+) |
5344 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5345 \$ \$ (?![\w\{]) |
5346 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5347 \[\^ |
5348 \[\: (?>[a-z]+) :\] |
5349 \[\:\^ (?>[a-z]+) :\] |
5350 \(\? |
5351 $q_char
5352 ))/oxmsg;
5353  
5354 # choice again delimiter
5355 870 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 870 870
5356 0 my %octet = map {$_ => 1} @char;
5357 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
5358 0 $delimiter = '(';
5359 0 $end_delimiter = ')';
5360 }
5361 elsif (not $octet{'}'}) {
5362 0 $delimiter = '{';
5363 0 $end_delimiter = '}';
5364 }
5365 elsif (not $octet{']'}) {
5366 0 $delimiter = '[';
5367 0 $end_delimiter = ']';
5368 }
5369 elsif (not $octet{'>'}) {
5370 0 $delimiter = '<';
5371 0 $end_delimiter = '>';
5372 }
5373 else {
5374 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5375 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5376 0 $delimiter = $char;
5377 0 $end_delimiter = $char;
5378 0 last;
5379 }
5380 }
5381 }
5382 }
5383  
5384 870 my $left_e = 0;
5385 870 my $right_e = 0;
5386 870 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 2100 870 2970
5387  
5388 # "\L\u" --> "\u\L"
5389 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
5390 0 @char[$i,$i+1] = @char[$i+1,$i];
5391 }
5392  
5393 # "\U\l" --> "\l\U"
5394 ▶ 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
5395 0 @char[$i,$i+1] = @char[$i+1,$i];
5396 }
5397  
5398 # octal escape sequence
5399 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5400 1 $char[$i] = Ecyrillic::octchr($1);
5401 }
5402  
5403 # hexadecimal escape sequence
5404 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5405 1 $char[$i] = Ecyrillic::hexchr($1);
5406 }
5407  
5408 # \b{...} --> b\{...}
5409 # \B{...} --> B\{...}
5410 # \N{CHARNAME} --> N\{CHARNAME}
5411 # \p{PROPERTY} --> p\{PROPERTY}
5412 # \P{PROPERTY} --> P\{PROPERTY}
5413 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5414 6 $char[$i] = $1 . '\\' . $2;
5415 }
5416  
5417 # \p, \P, \X --> p, P, X
5418 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
5419 4 $char[$i] = $1;
5420 }
5421  
5422 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 &Ecyrillic::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
5423 }
5424  
5425 # join separated multiple-octet
5426 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
5427 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 $Ecyrillic::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 $Ecyrillic::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 $Ecyrillic::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 $Ecyrillic::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 $Ecyrillic::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 $Ecyrillic::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 $Ecyrillic::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5428 0 $char[$i] .= join '', splice @char, $i+1, 3;
5429 }
5430 ▶ 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 $Ecyrillic::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 $Ecyrillic::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 $Ecyrillic::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 $Ecyrillic::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5431 0 $char[$i] .= join '', splice @char, $i+1, 2;
5432 }
5433 ▶ 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 $Ecyrillic::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 $Ecyrillic::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 $Ecyrillic::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 $Ecyrillic::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5434 0 $char[$i] .= join '', splice @char, $i+1, 1;
5435 }
5436 }
5437  
5438 # open character class [...]
5439 elsif ($char[$i] eq '[') {
5440 556 my $left = $i;
5441  
5442 # [] make die "Unmatched [] in regexp ...\n"
5443 # (and so on)
5444  
5445 556 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 3 553 556
5446 3 $i++;
5447 }
5448  
5449 556 while (1) {
5450 2063 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 2063 2063
5451 0 die __FILE__, ": Unmatched [] in regexp\n";
5452 }
5453 2063 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 556 1507 2063
5454 556 my $right = $i;
5455  
5456 # [...]
5457 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
5458 30 splice @char, $left, $right-$left+1, sprintf(q{@{[Ecyrillic::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
5459 }
5460 else {
5461 526 splice @char, $left, $right-$left+1, Ecyrillic::charlist_qr(@char[$left+1..$right-1], $modifier);
5462 }
5463  
5464 556 $i = $left;
5465 556 last;
5466 }
5467 }
5468 }
5469  
5470 # open character class [^...]
5471 elsif ($char[$i] eq '[^') {
5472 74 my $left = $i;
5473  
5474 # [^] make die "Unmatched [] in regexp ...\n"
5475 # (and so on)
5476  
5477 74 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 4 70 74
5478 4 $i++;
5479 }
5480  
5481 74 while (1) {
5482 272 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 272 272
5483 0 die __FILE__, ": Unmatched [] in regexp\n";
5484 }
5485 272 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 74 198 272
5486 74 my $right = $i;
5487  
5488 # [^...]
5489 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
5490 30 splice @char, $left, $right-$left+1, sprintf(q{@{[Ecyrillic::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
5491 }
5492 else {
5493 44 splice @char, $left, $right-$left+1, Ecyrillic::charlist_not_qr(@char[$left+1..$right-1], $modifier);
5494 }
5495  
5496 74 $i = $left;
5497 74 last;
5498 }
5499 }
5500 }
5501  
5502 # rewrite character class or escape character
5503 elsif (my $char = character_class($char[$i],$modifier)) {
5504 139 $char[$i] = $char;
5505 }
5506  
5507 # /i modifier
5508 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Ecyrillic::uc($char[$i]) ne Ecyrillic::fc($char[$i]))) {
Condition100%6/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Ecyrillic::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 &Ecyrillic::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Ecyrillic::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= &Ecyrillic::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
5509 20 ▶ if (CORE::length(Ecyrillic::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 20 0 20
5510 20 $char[$i] = '[' . Ecyrillic::uc($char[$i]) . Ecyrillic::fc($char[$i]) . ']';
5511 }
5512 else {
5513 0 $char[$i] = '(?:' . Ecyrillic::uc($char[$i]) . '|' . Ecyrillic::fc($char[$i]) . ')';
5514 }
5515 }
5516  
5517 # \u \l \U \L \F \Q \E
5518 elsif ($char[$i] =~ /\A [<>] \z/oxms) {
5519 1 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 1 1
5520 0 $char[$i] = '\\' . $char[$i];
5521 }
5522 }
5523 elsif ($char[$i] eq '\u') {
5524 0 $char[$i] = '@{[Ecyrillic::ucfirst qq<';
5525 0 $left_e++;
5526 }
5527 elsif ($char[$i] eq '\l') {
5528 0 $char[$i] = '@{[Ecyrillic::lcfirst qq<';
5529 0 $left_e++;
5530 }
5531 elsif ($char[$i] eq '\U') {
5532 1 $char[$i] = '@{[Ecyrillic::uc qq<';
5533 1 $left_e++;
5534 }
5535 elsif ($char[$i] eq '\L') {
5536 1 $char[$i] = '@{[Ecyrillic::lc qq<';
5537 1 $left_e++;
5538 }
5539 elsif ($char[$i] eq '\F') {
5540 18 $char[$i] = '@{[Ecyrillic::fc qq<';
5541 18 $left_e++;
5542 }
5543 elsif ($char[$i] eq '\Q') {
5544 1 $char[$i] = '@{[CORE::quotemeta qq<';
5545 1 $left_e++;
5546 }
5547 elsif ($char[$i] eq '\E') {
5548 21 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 21 0 21
5549 21 $char[$i] = '>]}';
5550 21 $right_e++;
5551 }
5552 else {
5553 0 $char[$i] = '';
5554 }
5555 }
5556 elsif ($char[$i] eq '\Q') {
5557 0 while (1) {
5558 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5559 0 last;
5560 }
5561 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
5562 0 last;
5563 }
5564 }
5565 }
5566 elsif ($char[$i] eq '\E') {
5567 }
5568  
5569 # $0 --> $0
5570 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
5571 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5572 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
5573 }
5574 }
5575 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
5576 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5577 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
5578 }
5579 }
5580  
5581 # $$ --> $$
5582 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
5583 }
5584  
5585 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
5586 # $1, $2, $3 --> $1, $2, $3 otherwise
5587 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
5588 0 $char[$i] = e_capture($1);
5589 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5590 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
5591 }
5592 }
5593 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
5594 0 $char[$i] = e_capture($1);
5595 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5596 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
5597 }
5598 }
5599  
5600 # $$foo[ ... ] --> $ $foo->[ ... ]
5601 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
5602 0 $char[$i] = e_capture($1.'->'.$2);
5603 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5604 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
5605 }
5606 }
5607  
5608 # $$foo{ ... } --> $ $foo->{ ... }
5609 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
5610 0 $char[$i] = e_capture($1.'->'.$2);
5611 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5612 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
5613 }
5614 }
5615  
5616 # $$foo
5617 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
5618 0 $char[$i] = e_capture($1);
5619 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5620 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
5621 }
5622 }
5623  
5624 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Ecyrillic::PREMATCH()
5625 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
5626 8 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 8 8
5627 0 $char[$i] = '@{[Ecyrillic::ignorecase(Ecyrillic::PREMATCH())]}';
5628 }
5629 else {
5630 8 $char[$i] = '@{[Ecyrillic::PREMATCH()]}';
5631 }
5632 }
5633  
5634 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Ecyrillic::MATCH()
5635 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
5636 8 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 8 8
5637 0 $char[$i] = '@{[Ecyrillic::ignorecase(Ecyrillic::MATCH())]}';
5638 }
5639 else {
5640 8 $char[$i] = '@{[Ecyrillic::MATCH()]}';
5641 }
5642 }
5643  
5644 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Ecyrillic::POSTMATCH()
5645 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
5646 6 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 6 6
5647 0 $char[$i] = '@{[Ecyrillic::ignorecase(Ecyrillic::POSTMATCH())]}';
5648 }
5649 else {
5650 6 $char[$i] = '@{[Ecyrillic::POSTMATCH()]}';
5651 }
5652 }
5653  
5654 # ${ foo }
5655 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
5656 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5657 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
5658 }
5659 }
5660  
5661 # ${ ... }
5662 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5663 0 $char[$i] = e_capture($1);
5664 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5665 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
5666 }
5667 }
5668  
5669 # $scalar or @array
5670 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
5671 21 $char[$i] = e_string($char[$i]);
5672 21 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 11 10 21
5673 11 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
5674 }
5675 }
5676  
5677 # quote character before ? + * {
5678 ▶ 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
5679 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
5680 }
5681 ▶ 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
5682 0 my $char = $char[$i-1];
5683 0 ▶ if ($char[$i] eq '{') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq '{') { } 0 0 0
5684 0 die __FILE__, qq{: "MULTIBYTE{n}" should be "(MULTIBYTE){n}" in m?? (and shift \$1,\$2,\$3,...) ($char){n}\n};
5685 }
5686 else {
5687 0 die __FILE__, qq{: "MULTIBYTE$char[$i]" should be "(MULTIBYTE)$char[$i]" in m?? (and shift \$1,\$2,\$3,...) ($char)$char[$i]\n};
5688 }
5689 }
5690 else {
5691 127 $char[$i-1] = '(?:' . $char[$i-1] . ')';
5692 }
5693 }
5694 }
5695  
5696 # make regexp string
5697 870 $modifier =~ tr/i//d;
5698 870 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 870 870
5699 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
5700 0 return join '', $ope, $delimiter, $anchor, @char, '>]}' x ($left_e - $right_e), $matched, $end_delimiter, $modifier;
5701 }
5702 else {
5703 0 return join '', $ope, $delimiter, $anchor, '(?:', @char, '>]}' x ($left_e - $right_e), ')', $matched, $end_delimiter, $modifier;
5704 }
5705 }
5706 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
5707 0 return join '', $ope, $delimiter, $anchor, @char, $matched, $end_delimiter, $modifier;
5708 }
5709 else {
5710 870 return join '', $ope, $delimiter, $anchor, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
5711 }
5712 }
5713  
5714 #
5715 # double quote stuff
5716 #
5717 180 ▶sub qq_stuff {
Subroutine qq_stuff: called CC=6 SCAR=18.5
Pod undocumented
5718 180 my($delimiter,$end_delimiter,$stuff) = @_;
5719  
5720 # scalar variable or array variable
5721 180 ▶ if ($stuff =~ /\A [\$\@] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($stuff =~ /\A [\$\@] /mosx) 100 80 180
5722 100 return $stuff;
5723 }
5724  
5725 # quote by delimiter
5726 80 my %octet = map {$_ => 1} ($stuff =~ /\G ([\x00-\xFF]) /oxmsg);
5727 80 for my $char (qw( ! " $ % & * + - . / : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5728 80 ▶ next if $char eq $delimiter;
Branch: 1 branch
BranchTrueFalseTotal
if $char eq $delimiter 0 80 80
5729 80 ▶ next if $char eq $end_delimiter;
Branch: 1 branch
BranchTrueFalseTotal
if $char eq $end_delimiter 0 80 80
5730 80 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 80 0 80
5731 80 return join '', 'qq', $char, $stuff, $char;
5732 }
5733 }
5734 0 return join '', 'qq', '<', $stuff, '>';
5735 }
5736  
5737 #
5738 # escape regexp (m'', qr'', and m''b, qr''b)
5739 #
5740 10 ▶sub e_qr_q {
Subroutine e_qr_q: called CC=7 SCAR=25.3
Pod undocumented
5741 10 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5742 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
5743  
5744 10 $modifier =~ tr/p//d;
5745 10 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 10 10
5746 0 my $line = 0;
5747 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
5748 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
5749 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
5750 0 last;
5751 }
5752 }
5753 0 die qq{Unsupported modifier "$1" used at line $line.\n};
5754 }
5755  
5756 10 $slash = 'div';
5757  
5758 # literal null string pattern
5759 10 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 2 10
elsif ($modifier =~ tr/Bb//d) { } 0 2 2
5760 8 $modifier =~ tr/bB//d;
5761 8 $modifier =~ tr/i//d;
5762 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
5763 }
5764  
5765 # with /b /B modifier
5766 elsif ($modifier =~ tr/bB//d) {
5767 0 return e_qr_qb($ope,$delimiter,$end_delimiter,$string,$modifier);
5768 }
5769  
5770 # without /b /B modifier
5771 else {
5772 2 return e_qr_qt($ope,$delimiter,$end_delimiter,$string,$modifier);
5773 }
5774 }
5775  
5776 #
5777 # escape regexp (m'', qr'')
5778 #
5779 2 ▶sub e_qr_qt {
Subroutine e_qr_qt: called CC=20 SCAR=51.8
Pod undocumented
5780 2 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5781  
5782 2 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 2 2
5783  
5784 # split regexp
5785 2 my @char = $string =~ /\G((?>
5786 [^\\\[\$\@\/] |
5787 [\x00-\xFF] |
5788 \[\^ |
5789 \[\: (?>[a-z]+) \:\] |
5790 \[\:\^ (?>[a-z]+) \:\] |
5791 [\$\@\/] |
5792 \\ (?:$q_char) |
5793 (?:$q_char)
5794 ))/oxmsg;
5795  
5796 # unescape character
5797 2 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 2 2 4
5798 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 &Ecyrillic::uc($char[$i]) ne &fc($char[$i])) { } 0 2 2
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 4 4
5799 }
5800  
5801 # open character class [...]
5802 elsif ($char[$i] eq '[') {
5803 0 my $left = $i;
5804 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
5805 0 $i++;
5806 }
5807 0 while (1) {
5808 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5809 0 die __FILE__, ": Unmatched [] in regexp\n";
5810 }
5811 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
5812 0 my $right = $i;
5813  
5814 # [...]
5815 0 splice @char, $left, $right-$left+1, Ecyrillic::charlist_qr(@char[$left+1..$right-1], $modifier);
5816  
5817 0 $i = $left;
5818 0 last;
5819 }
5820 }
5821 }
5822  
5823 # open character class [^...]
5824 elsif ($char[$i] eq '[^') {
5825 0 my $left = $i;
5826 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
5827 0 $i++;
5828 }
5829 0 while (1) {
5830 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5831 0 die __FILE__, ": Unmatched [] in regexp\n";
5832 }
5833 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
5834 0 my $right = $i;
5835  
5836 # [^...]
5837 0 splice @char, $left, $right-$left+1, Ecyrillic::charlist_not_qr(@char[$left+1..$right-1], $modifier);
5838  
5839 0 $i = $left;
5840 0 last;
5841 }
5842 }
5843 }
5844  
5845 # escape $ @ / and \
5846 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
5847 0 $char[$i] = '\\' . $char[$i];
5848 }
5849  
5850 # rewrite character class or escape character
5851 elsif (my $char = character_class($char[$i],$modifier)) {
5852 0 $char[$i] = $char;
5853 }
5854  
5855 # /i modifier
5856 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Ecyrillic::uc($char[$i]) ne Ecyrillic::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Ecyrillic::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 &Ecyrillic::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Ecyrillic::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= &Ecyrillic::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
5857 0 ▶ if (CORE::length(Ecyrillic::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
5858 0 $char[$i] = '[' . Ecyrillic::uc($char[$i]) . Ecyrillic::fc($char[$i]) . ']';
5859 }
5860 else {
5861 0 $char[$i] = '(?:' . Ecyrillic::uc($char[$i]) . '|' . Ecyrillic::fc($char[$i]) . ')';
5862 }
5863 }
5864  
5865 # quote character before ? + * {
5866 ▶ 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
5867 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
5868 }
5869 else {
5870 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
5871 }
5872 }
5873 }
5874  
5875 2 $delimiter = '/';
5876 2 $end_delimiter = '/';
5877  
5878 2 $modifier =~ tr/i//d;
5879 2 return join '', $ope, $delimiter, $anchor, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
5880 }
5881  
5882 #
5883 # escape regexp (m''b, qr''b)
5884 #
5885 0 ▶sub e_qr_qb {
Subroutine e_qr_qb: not called CC=4 SCAR=30.0
Pod undocumented
5886 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5887  
5888 # split regexp
5889 0 my @char = $string =~ /\G ((?>[^\\]|\\\\)) /oxmsg;
5890  
5891 # unescape character
5892 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
5893 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
5894 }
5895  
5896 # remain \\
5897 elsif ($char[$i] eq '\\\\') {
5898 }
5899  
5900 # escape $ @ / and \
5901 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
5902 0 $char[$i] = '\\' . $char[$i];
5903 }
5904 }
5905  
5906 0 $delimiter = '/';
5907 0 $end_delimiter = '/';
5908 0 return join '', $ope, $delimiter, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
5909 }
5910  
5911 #
5912 # escape regexp (s/here//)
5913 #
5914 80 ▶sub e_s1 {
Subroutine e_s1: called CC=106 SCAR=81.1
Pod undocumented
5915 80 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5916 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
5917  
5918 80 $modifier =~ tr/p//d;
5919 80 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 80 80
5920 0 my $line = 0;
5921 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
5922 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
5923 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
5924 0 last;
5925 }
5926 }
5927 0 die qq{Unsupported modifier "$1" used at line $line.\n};
5928 }
5929  
5930 80 $slash = 'div';
5931  
5932 # literal null string pattern
5933 80 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 72 80
elsif ($modifier =~ tr/Bb//d) { } 0 72 72
5934 8 $modifier =~ tr/bB//d;
5935 8 $modifier =~ tr/i//d;
5936 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
5937 }
5938  
5939 # /b /B modifier
5940 elsif ($modifier =~ tr/bB//d) {
5941  
5942 # choice again delimiter
5943 0 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 0 0
5944 0 my @char = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5945 0 my %octet = map {$_ => 1} @char;
5946 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
5947 0 $delimiter = '(';
5948 0 $end_delimiter = ')';
5949 }
5950 elsif (not $octet{'}'}) {
5951 0 $delimiter = '{';
5952 0 $end_delimiter = '}';
5953 }
5954 elsif (not $octet{']'}) {
5955 0 $delimiter = '[';
5956 0 $end_delimiter = ']';
5957 }
5958 elsif (not $octet{'>'}) {
5959 0 $delimiter = '<';
5960 0 $end_delimiter = '>';
5961 }
5962 else {
5963 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5964 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5965 0 $delimiter = $char;
5966 0 $end_delimiter = $char;
5967 0 last;
5968 }
5969 }
5970 }
5971 }
5972  
5973 0 my $prematch = '';
5974 0 return join '', $ope, $delimiter, $prematch, '(?:', $string, ')', $matched, $end_delimiter, $modifier;
5975 }
5976  
5977 72 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 1 71 72
5978 72 my $metachar = qr/[\@\\|[\]{^]/oxms;
5979  
5980 # split regexp
5981 72 my @char = $string =~ /\G((?>
5982 [^\\\$\@\[\(] |
5983 \\ (?>[1-9][0-9]*) |
5984 \\g (?>\s*) (?>[1-9][0-9]*) |
5985 \\g (?>\s*) \{ (?>\s*) (?>[1-9][0-9]*) (?>\s*) \} |
5986 \\g (?>\s*) \{ (?>\s*) - (?>\s*) (?>[1-9][0-9]*) (?>\s*) \} |
5987 \\x (?>[0-9A-Fa-f]{1,2}) |
5988 \\ (?>[0-7]{2,3}) |
5989 \\c [\x40-\x5F] |
5990 \\x\{ (?>[0-9A-Fa-f]+) \} |
5991 \\o\{ (?>[0-7]+) \} |
5992 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
5993 \\ $q_char |
5994 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5995 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5996 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5997 [\$\@] $qq_variable |
5998 \$ (?>\s* [0-9]+) |
5999 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
6000 \$ \$ (?![\w\{]) |
6001 \$ (?>\s*) \$ (?>\s*) $qq_variable |
6002 \[\^ |
6003 \[\: (?>[a-z]+) :\] |
6004 \[\:\^ (?>[a-z]+) :\] |
6005 \(\? |
6006 $q_char
6007 ))/oxmsg;
6008  
6009 # choice again delimiter
6010 72 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 72 72
6011 0 my %octet = map {$_ => 1} @char;
6012 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
6013 0 $delimiter = '(';
6014 0 $end_delimiter = ')';
6015 }
6016 elsif (not $octet{'}'}) {
6017 0 $delimiter = '{';
6018 0 $end_delimiter = '}';
6019 }
6020 elsif (not $octet{']'}) {
6021 0 $delimiter = '[';
6022 0 $end_delimiter = ']';
6023 }
6024 elsif (not $octet{'>'}) {
6025 0 $delimiter = '<';
6026 0 $end_delimiter = '>';
6027 }
6028 else {
6029 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
6030 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
6031 0 $delimiter = $char;
6032 0 $end_delimiter = $char;
6033 0 last;
6034 }
6035 }
6036 }
6037 }
6038  
6039 # count '('
6040 72 my $parens = grep { $_ eq '(' } @char;
6041  
6042 72 my $left_e = 0;
6043 72 my $right_e = 0;
6044 72 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 200 72 272
6045  
6046 # "\L\u" --> "\u\L"
6047 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
6048 0 @char[$i,$i+1] = @char[$i+1,$i];
6049 }
6050  
6051 # "\U\l" --> "\l\U"
6052 ▶ 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
6053 0 @char[$i,$i+1] = @char[$i+1,$i];
6054 }
6055  
6056 # octal escape sequence
6057 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
6058 1 $char[$i] = Ecyrillic::octchr($1);
6059 }
6060  
6061 # hexadecimal escape sequence
6062 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
6063 1 $char[$i] = Ecyrillic::hexchr($1);
6064 }
6065  
6066 # \b{...} --> b\{...}
6067 # \B{...} --> B\{...}
6068 # \N{CHARNAME} --> N\{CHARNAME}
6069 # \p{PROPERTY} --> p\{PROPERTY}
6070 # \P{PROPERTY} --> P\{PROPERTY}
6071 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
6072 0 $char[$i] = $1 . '\\' . $2;
6073 }
6074  
6075 # \p, \P, \X --> p, P, X
6076 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
6077 0 $char[$i] = $1;
6078 }
6079  
6080 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 &Ecyrillic::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
6081 }
6082  
6083 # join separated multiple-octet
6084 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
6085 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 $Ecyrillic::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 $Ecyrillic::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 $Ecyrillic::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 $Ecyrillic::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 $Ecyrillic::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 $Ecyrillic::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 $Ecyrillic::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6086 0 $char[$i] .= join '', splice @char, $i+1, 3;
6087 }
6088 ▶ 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 $Ecyrillic::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 $Ecyrillic::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 $Ecyrillic::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 $Ecyrillic::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6089 0 $char[$i] .= join '', splice @char, $i+1, 2;
6090 }
6091 ▶ 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 $Ecyrillic::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 $Ecyrillic::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 $Ecyrillic::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 $Ecyrillic::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6092 0 $char[$i] .= join '', splice @char, $i+1, 1;
6093 }
6094 }
6095  
6096 # open character class [...]
6097 elsif ($char[$i] eq '[') {
6098 17 my $left = $i;
6099 17 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 17 17
6100 0 $i++;
6101 }
6102 17 while (1) {
6103 74 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 74 74
6104 0 die __FILE__, ": Unmatched [] in regexp\n";
6105 }
6106 74 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 17 57 74
6107 17 my $right = $i;
6108  
6109 # [...]
6110 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
6111 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Ecyrillic::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6112 }
6113 else {
6114 17 splice @char, $left, $right-$left+1, Ecyrillic::charlist_qr(@char[$left+1..$right-1], $modifier);
6115 }
6116  
6117 17 $i = $left;
6118 17 last;
6119 }
6120 }
6121 }
6122  
6123 # open character class [^...]
6124 elsif ($char[$i] eq '[^') {
6125 0 my $left = $i;
6126 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6127 0 $i++;
6128 }
6129 0 while (1) {
6130 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6131 0 die __FILE__, ": Unmatched [] in regexp\n";
6132 }
6133 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6134 0 my $right = $i;
6135  
6136 # [^...]
6137 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
6138 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Ecyrillic::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6139 }
6140 else {
6141 0 splice @char, $left, $right-$left+1, Ecyrillic::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6142 }
6143  
6144 0 $i = $left;
6145 0 last;
6146 }
6147 }
6148 }
6149  
6150 # rewrite character class or escape character
6151 elsif (my $char = character_class($char[$i],$modifier)) {
6152 7 $char[$i] = $char;
6153 }
6154  
6155 # /i modifier
6156 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Ecyrillic::uc($char[$i]) ne Ecyrillic::fc($char[$i]))) {
Condition66%4/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Ecyrillic::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 &Ecyrillic::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Ecyrillic::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= &Ecyrillic::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6157 3 ▶ if (CORE::length(Ecyrillic::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 3 0 3
6158 3 $char[$i] = '[' . Ecyrillic::uc($char[$i]) . Ecyrillic::fc($char[$i]) . ']';
6159 }
6160 else {
6161 0 $char[$i] = '(?:' . Ecyrillic::uc($char[$i]) . '|' . Ecyrillic::fc($char[$i]) . ')';
6162 }
6163 }
6164  
6165 # \u \l \U \L \F \Q \E
6166 elsif ($char[$i] =~ /\A [<>] \z/oxms) {
6167 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
6168 0 $char[$i] = '\\' . $char[$i];
6169 }
6170 }
6171 elsif ($char[$i] eq '\u') {
6172 0 $char[$i] = '@{[Ecyrillic::ucfirst qq<';
6173 0 $left_e++;
6174 }
6175 elsif ($char[$i] eq '\l') {
6176 0 $char[$i] = '@{[Ecyrillic::lcfirst qq<';
6177 0 $left_e++;
6178 }
6179 elsif ($char[$i] eq '\U') {
6180 0 $char[$i] = '@{[Ecyrillic::uc qq<';
6181 0 $left_e++;
6182 }
6183 elsif ($char[$i] eq '\L') {
6184 0 $char[$i] = '@{[Ecyrillic::lc qq<';
6185 0 $left_e++;
6186 }
6187 elsif ($char[$i] eq '\F') {
6188 0 $char[$i] = '@{[Ecyrillic::fc qq<';
6189 0 $left_e++;
6190 }
6191 elsif ($char[$i] eq '\Q') {
6192 0 $char[$i] = '@{[CORE::quotemeta qq<';
6193 0 $left_e++;
6194 }
6195 elsif ($char[$i] eq '\E') {
6196 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
6197 0 $char[$i] = '>]}';
6198 0 $right_e++;
6199 }
6200 else {
6201 0 $char[$i] = '';
6202 }
6203 }
6204 elsif ($char[$i] eq '\Q') {
6205 0 while (1) {
6206 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6207 0 last;
6208 }
6209 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
6210 0 last;
6211 }
6212 }
6213 }
6214 elsif ($char[$i] eq '\E') {
6215 }
6216  
6217 # \0 --> \0
6218 elsif ($char[$i] =~ /\A \\ (?>\s*) 0 \z/oxms) {
6219 }
6220  
6221 # \g{N}, \g{-N}
6222  
6223 # P.108 Using Simple Patterns
6224 # in Chapter 7: In the World of Regular Expressions
6225 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
6226  
6227 # P.221 Capturing
6228 # in Chapter 5: Pattern Matching
6229 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
6230  
6231 # \g{-1}, \g{-2}, \g{-3} --> \g{-1}, \g{-2}, \g{-3}
6232 elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) - (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6233 }
6234  
6235 # \g{1}, \g{2}, \g{3} --> \g{2}, \g{3}, \g{4} (only when multibyte anchoring is enable)
6236 elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6237 }
6238  
6239 # \g1, \g2, \g3 --> \g2, \g3, \g4 (only when multibyte anchoring is enable)
6240 elsif ($char[$i] =~ /\A \\g (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) {
6241 }
6242  
6243 # \1, \2, \3 --> \2, \3, \4 (only when multibyte anchoring is enable)
6244 elsif ($char[$i] =~ /\A \\ (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) {
6245 }
6246  
6247 # $0 --> $0
6248 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
6249 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6250 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
6251 }
6252 }
6253 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
6254 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6255 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
6256 }
6257 }
6258  
6259 # $$ --> $$
6260 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
6261 }
6262  
6263 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
6264 # $1, $2, $3 --> $1, $2, $3 otherwise
6265 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
6266 0 $char[$i] = e_capture($1);
6267 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6268 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
6269 }
6270 }
6271 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6272 0 $char[$i] = e_capture($1);
6273 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6274 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
6275 }
6276 }
6277  
6278 # $$foo[ ... ] --> $ $foo->[ ... ]
6279 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
6280 0 $char[$i] = e_capture($1.'->'.$2);
6281 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6282 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
6283 }
6284 }
6285  
6286 # $$foo{ ... } --> $ $foo->{ ... }
6287 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
6288 0 $char[$i] = e_capture($1.'->'.$2);
6289 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6290 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
6291 }
6292 }
6293  
6294 # $$foo
6295 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
6296 0 $char[$i] = e_capture($1);
6297 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6298 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
6299 }
6300 }
6301  
6302 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Ecyrillic::PREMATCH()
6303 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
6304 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 4 4
6305 0 $char[$i] = '@{[Ecyrillic::ignorecase(Ecyrillic::PREMATCH())]}';
6306 }
6307 else {
6308 4 $char[$i] = '@{[Ecyrillic::PREMATCH()]}';
6309 }
6310 }
6311  
6312 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Ecyrillic::MATCH()
6313 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
6314 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 4 4
6315 0 $char[$i] = '@{[Ecyrillic::ignorecase(Ecyrillic::MATCH())]}';
6316 }
6317 else {
6318 4 $char[$i] = '@{[Ecyrillic::MATCH()]}';
6319 }
6320 }
6321  
6322 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Ecyrillic::POSTMATCH()
6323 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
6324 3 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 3 3
6325 0 $char[$i] = '@{[Ecyrillic::ignorecase(Ecyrillic::POSTMATCH())]}';
6326 }
6327 else {
6328 3 $char[$i] = '@{[Ecyrillic::POSTMATCH()]}';
6329 }
6330 }
6331  
6332 # ${ foo }
6333 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
6334 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6335 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
6336 }
6337 }
6338  
6339 # ${ ... }
6340 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
6341 0 $char[$i] = e_capture($1);
6342 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6343 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
6344 }
6345 }
6346  
6347 # $scalar or @array
6348 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
6349 4 $char[$i] = e_string($char[$i]);
6350 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 4 4
6351 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
6352 }
6353 }
6354  
6355 # quote character before ? + * {
6356 ▶ 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
6357 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
6358 }
6359 else {
6360 14 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6361 }
6362 }
6363 }
6364  
6365 # make regexp string
6366 72 my $prematch = '';
6367 72 $modifier =~ tr/i//d;
6368 72 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 72 72
6369 0 return join '', $ope, $delimiter, $prematch, '(?:', @char, '>]}' x ($left_e - $right_e), ')', $matched, $end_delimiter, $modifier;
6370 }
6371 72 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6372 }
6373  
6374 #
6375 # escape regexp (s'here'' or s'here''b)
6376 #
6377 21 ▶sub e_s1_q {
Subroutine e_s1_q: called CC=7 SCAR=24.3
Pod undocumented
6378 21 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6379 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
6380  
6381 21 $modifier =~ tr/p//d;
6382 21 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 21 21
6383 0 my $line = 0;
6384 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6385 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6386 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6387 0 last;
6388 }
6389 }
6390 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6391 }
6392  
6393 21 $slash = 'div';
6394  
6395 # literal null string pattern
6396 21 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 13 21
elsif ($modifier =~ tr/Bb//d) { } 0 13 13
6397 8 $modifier =~ tr/bB//d;
6398 8 $modifier =~ tr/i//d;
6399 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
6400 }
6401  
6402 # with /b /B modifier
6403 elsif ($modifier =~ tr/bB//d) {
6404 0 return e_s1_qb($ope,$delimiter,$end_delimiter,$string,$modifier);
6405 }
6406  
6407 # without /b /B modifier
6408 else {
6409 13 return e_s1_qt($ope,$delimiter,$end_delimiter,$string,$modifier);
6410 }
6411 }
6412  
6413 #
6414 # escape regexp (s'here'')
6415 #
6416 13 ▶sub e_s1_qt {
Subroutine e_s1_qt: called CC=20 SCAR=50.1
Pod undocumented
6417 13 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6418  
6419 13 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 13 13
6420  
6421 # split regexp
6422 13 my @char = $string =~ /\G((?>
6423 [^\\\[\$\@\/] |
6424 [\x00-\xFF] |
6425 \[\^ |
6426 \[\: (?>[a-z]+) \:\] |
6427 \[\:\^ (?>[a-z]+) \:\] |
6428 [\$\@\/] |
6429 \\ (?:$q_char) |
6430 (?:$q_char)
6431 ))/oxmsg;
6432  
6433 # unescape character
6434 13 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 25 13 38
6435 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 &Ecyrillic::uc($char[$i]) ne &fc($char[$i])) { } 0 19 19
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 32 32
6436 }
6437  
6438 # open character class [...]
6439 elsif ($char[$i] eq '[') {
6440 0 my $left = $i;
6441 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6442 0 $i++;
6443 }
6444 0 while (1) {
6445 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6446 0 die __FILE__, ": Unmatched [] in regexp\n";
6447 }
6448 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6449 0 my $right = $i;
6450  
6451 # [...]
6452 0 splice @char, $left, $right-$left+1, Ecyrillic::charlist_qr(@char[$left+1..$right-1], $modifier);
6453  
6454 0 $i = $left;
6455 0 last;
6456 }
6457 }
6458 }
6459  
6460 # open character class [^...]
6461 elsif ($char[$i] eq '[^') {
6462 0 my $left = $i;
6463 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6464 0 $i++;
6465 }
6466 0 while (1) {
6467 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6468 0 die __FILE__, ": Unmatched [] in regexp\n";
6469 }
6470 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6471 0 my $right = $i;
6472  
6473 # [^...]
6474 0 splice @char, $left, $right-$left+1, Ecyrillic::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6475  
6476 0 $i = $left;
6477 0 last;
6478 }
6479 }
6480 }
6481  
6482 # escape $ @ / and \
6483 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6484 0 $char[$i] = '\\' . $char[$i];
6485 }
6486  
6487 # rewrite character class or escape character
6488 elsif (my $char = character_class($char[$i],$modifier)) {
6489 6 $char[$i] = $char;
6490 }
6491  
6492 # /i modifier
6493 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Ecyrillic::uc($char[$i]) ne Ecyrillic::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Ecyrillic::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 &Ecyrillic::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Ecyrillic::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= &Ecyrillic::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6494 0 ▶ if (CORE::length(Ecyrillic::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
6495 0 $char[$i] = '[' . Ecyrillic::uc($char[$i]) . Ecyrillic::fc($char[$i]) . ']';
6496 }
6497 else {
6498 0 $char[$i] = '(?:' . Ecyrillic::uc($char[$i]) . '|' . Ecyrillic::fc($char[$i]) . ')';
6499 }
6500 }
6501  
6502 # quote character before ? + * {
6503 ▶ 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
6504 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
6505 }
6506 else {
6507 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6508 }
6509 }
6510 }
6511  
6512 13 $modifier =~ tr/i//d;
6513 13 $delimiter = '/';
6514 13 $end_delimiter = '/';
6515 13 my $prematch = '';
6516 13 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6517 }
6518  
6519 #
6520 # escape regexp (s'here''b)
6521 #
6522 0 ▶sub e_s1_qb {
Subroutine e_s1_qb: not called CC=4 SCAR=30.0
Pod undocumented
6523 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6524  
6525 # split regexp
6526 0 my @char = $string =~ /\G (?>[^\\]|\\\\) /oxmsg;
6527  
6528 # unescape character
6529 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
6530 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
6531 }
6532  
6533 # remain \\
6534 elsif ($char[$i] eq '\\\\') {
6535 }
6536  
6537 # escape $ @ / and \
6538 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6539 0 $char[$i] = '\\' . $char[$i];
6540 }
6541 }
6542  
6543 0 $delimiter = '/';
6544 0 $end_delimiter = '/';
6545 0 my $prematch = '';
6546 0 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6547 }
6548  
6549 #
6550 # escape regexp (s''here')
6551 #
6552 16 ▶sub e_s2_q {
Subroutine e_s2_q: called CC=4 SCAR=13.9
Pod undocumented
6553 16 my($ope,$delimiter,$end_delimiter,$string) = @_;
6554  
6555 16 $slash = 'div';
6556  
6557 16 my @char = $string =~ / \G (?>[^\\]|\\\\|$q_char) /oxmsg;
6558 16 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 9 16 25
6559 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
6560 }
6561  
6562 # not escape \\
6563 elsif ($char[$i] =~ /\A \\\\ \z/oxms) {
6564 }
6565  
6566 # escape $ @ / and \
6567 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6568 5 $char[$i] = '\\' . $char[$i];
6569 }
6570 }
6571  
6572 16 return join '', $ope, $delimiter, @char, $end_delimiter;
6573 }
6574  
6575 #
6576 # escape regexp (s/here/and here/modifier)
6577 #
6578 101 ▶sub e_sub {
Subroutine e_sub: called CC=20 SCAR=32.6
Pod undocumented
6579 101 my($variable,$delimiter1,$pattern,$end_delimiter1,$delimiter2,$replacement,$end_delimiter2,$modifier) = @_;
6580 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
6581  
6582 101 $modifier =~ tr/p//d;
6583 101 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 101 101
6584 0 my $line = 0;
6585 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6586 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6587 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6588 0 last;
6589 }
6590 }
6591 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6592 }
6593  
6594 101 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq "") 36 65 101
6595 36 $variable = '$_';
6596 36 $bind_operator = ' =~ ';
6597 }
6598  
6599 101 $slash = 'div';
6600  
6601 # P.128 Start of match (or end of previous match): \G
6602 # P.130 Advanced Use of \G with Perl
6603 # in Chapter 3: Overview of Regular Expression Features and Flavors
6604 # P.312 Iterative Matching: Scalar Context, with /g
6605 # in Chapter 7: Perl
6606 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
6607  
6608 # P.181 Where You Left Off: The \G Assertion
6609 # in Chapter 5: Pattern Matching
6610 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
6611  
6612 # P.220 Where You Left Off: The \G Assertion
6613 # in Chapter 5: Pattern Matching
6614 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
6615  
6616 101 my $e_modifier = $modifier =~ tr/e//d;
6617 101 my $r_modifier = $modifier =~ tr/r//d;
6618  
6619 101 my $my = '';
6620 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
6621 0 $my = $variable;
6622 0 $variable =~ s/ (?: local \b | my \b | our \b | state \b ) (?>\s*) //oxms;
6623 0 $variable =~ s/ = .+ \z//oxms;
6624 }
6625  
6626 101 (my $variable_basename = $variable) =~ s/ [\[\{].* \z//oxms;
6627 101 $variable_basename =~ s/ \s+ \z//oxms;
6628  
6629 # quote replacement string
6630 101 my $e_replacement = '';
6631 101 ▶ if ($e_modifier >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($e_modifier >= 1) { } 17 84 101
6632 17 $e_replacement = e_qq('', '', '', $replacement);
6633 17 $e_modifier--;
6634 }
6635 else {
6636 84 ▶ if ($delimiter2 eq "'") {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter2 eq q[']) { } 16 68 84
6637 16 $e_replacement = e_s2_q('qq', '/', '/', $replacement);
6638 }
6639 else {
6640 68 $e_replacement = e_qq ('qq', $delimiter2, $end_delimiter2, $replacement);
6641 }
6642 }
6643  
6644 101 my $sub = '';
6645  
6646 # with /r
6647 101 ▶ if ($r_modifier) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r_modifier) { } 10 91 101
6648 10 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $modifier =~ /g/mosx }) { } 5 5 10
6649 }
6650  
6651 # s///gr without multibyte anchoring
6652 elsif ($modifier =~ /g/oxms) {
6653 5 ▶ $sub = sprintf(
Branch: 1 branch
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 0 5 5
6654 # 1 2 3 4 5
6655 q<CORE::eval{local $Ecyrillic::re_t=%s; while($Ecyrillic::re_t =~ %s){%s local $^W=0; local $Ecyrillic::re_r=%s; %s$Ecyrillic::re_t="$`$Ecyrillic::re_r$'"; pos($Ecyrillic::re_t)=length "$`$Ecyrillic::re_r"; } return $Ecyrillic::re_t}>,
6656  
6657 $variable, # 1
6658 ($delimiter1 eq "'") ? # 2
6659 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
6660 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
6661 $s_matched, # 3
6662 $e_replacement, # 4
6663 '$Ecyrillic::re_r=CORE::eval $Ecyrillic::re_r; ' x $e_modifier, # 5
6664 );
6665 }
6666  
6667 # s///r
6668 else {
6669  
6670 5 my $prematch = q{$`};
6671  
6672 5 ▶ $sub = sprintf(
Branch: 1 branch
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 0 5 5
6673 # 1 2 3 4 5 6 7
6674 q<(%s =~ %s) ? CORE::eval{%s local $^W=0; local $Ecyrillic::re_r=%s; %s"%s$Ecyrillic::re_r$'" } : %s>,
6675  
6676 $variable, # 1
6677 ($delimiter1 eq "'") ? # 2
6678 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
6679 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
6680 $s_matched, # 3
6681 $e_replacement, # 4
6682 '$Ecyrillic::re_r=CORE::eval $Ecyrillic::re_r; ' x $e_modifier, # 5
6683 $prematch, # 6
6684 $variable, # 7
6685 );
6686 }
6687  
6688 # $var !~ s///r doesn't make sense
6689 10 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) 0 10 10
6690 0 $sub = q{die("$0: Using !~ with s///r doesn't make sense"), } . $sub;
6691 }
6692 }
6693  
6694 # without /r
6695 else {
6696 91 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $modifier =~ /g/mosx }) { } 23 68 91
6697 }
6698  
6699 # s///g without multibyte anchoring
6700 elsif ($modifier =~ /g/oxms) {
6701 23 ▶ $sub = sprintf(
Branch: 2 branches
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 3 20 23
$bind_operator =~ / !~ /mosx ? : 3 20 23
6702 # 1 2 3 4 5 6 7 8
6703 q<CORE::eval{local $Ecyrillic::re_n=0; while(%s =~ %s){%s local $^W=0; local $Ecyrillic::re_r=%s; %s%s="$`$Ecyrillic::re_r$'"; pos(%s)=length "$`$Ecyrillic::re_r"; $Ecyrillic::re_n++} return %s$Ecyrillic::re_n}>,
6704  
6705 $variable, # 1
6706 ($delimiter1 eq "'") ? # 2
6707 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
6708 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
6709 $s_matched, # 3
6710 $e_replacement, # 4
6711 '$Ecyrillic::re_r=CORE::eval $Ecyrillic::re_r; ' x $e_modifier, # 5
6712 $variable, # 6
6713 $variable, # 7
6714 ($bind_operator =~ / !~ /oxms) ? '!' : '', # 8
6715 );
6716 }
6717  
6718 # s///
6719 else {
6720  
6721 68 my $prematch = q{$`};
6722  
6723 68 ▶ $sub = sprintf(
Branch: 2 branches
BranchTrueFalseTotal
$bind_operator =~ / =~ /mosx ? : 65 3 68
$delimiter1 eq q['] ? : 18 50 68
6724  
6725 ($bind_operator =~ / =~ /oxms) ?
6726  
6727 # 1 2 3 4 5 6 7 8
6728 q<(%s%s%s) ? CORE::eval{%s local $^W=0; local $Ecyrillic::re_r=%s; %s%s="%s$Ecyrillic::re_r$'"; 1 } : undef> :
6729  
6730 # 1 2 3 4 5 6 7 8
6731 q<(%s%s%s) ? 1 : CORE::eval{%s local $^W=0; local $Ecyrillic::re_r=%s; %s%s="%s$Ecyrillic::re_r$'"; undef }>,
6732  
6733 $variable, # 1
6734 $bind_operator, # 2
6735 ($delimiter1 eq "'") ? # 3
6736 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
6737 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
6738 $s_matched, # 4
6739 $e_replacement, # 5
6740 '$Ecyrillic::re_r=CORE::eval $Ecyrillic::re_r; ' x $e_modifier, # 6
6741 $variable, # 7
6742 $prematch, # 8
6743 );
6744 }
6745 }
6746  
6747 # (my $foo = $bar) =~ s/// --> (my $foo = $bar, CORE::eval { ... })[1]
6748 101 ▶ if ($my ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($my ne "") 0 101 101
6749 0 $sub = "($my, $sub)[1]";
6750 }
6751  
6752 # clear s/// variable
6753 101 $sub_variable = '';
6754 101 $bind_operator = '';
6755  
6756 101 return $sub;
6757 }
6758  
6759 #
6760 # escape regexp of split qr//
6761 #
6762 74 ▶sub e_split {
Subroutine e_split: called CC=88 SCAR=76.4
Pod undocumented
6763 74 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6764 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
6765  
6766 74 $modifier =~ tr/p//d;
6767 74 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 74 74
6768 0 my $line = 0;
6769 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6770 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6771 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6772 0 last;
6773 }
6774 }
6775 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6776 }
6777  
6778 74 $slash = 'div';
6779  
6780 # /b /B modifier
6781 74 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) 0 74 74
6782 0 return join '', 'split', $ope, $delimiter, $string, $end_delimiter, $modifier;
6783 }
6784  
6785 74 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 74 74
6786 74 my $metachar = qr/[\@\\|[\]{^]/oxms;
6787  
6788 # split regexp
6789 74 my @char = $string =~ /\G((?>
6790 [^\\\$\@\[\(] |
6791 \\x (?>[0-9A-Fa-f]{1,2}) |
6792 \\ (?>[0-7]{2,3}) |
6793 \\c [\x40-\x5F] |
6794 \\x\{ (?>[0-9A-Fa-f]+) \} |
6795 \\o\{ (?>[0-7]+) \} |
6796 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
6797 \\ $q_char |
6798 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
6799 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
6800 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
6801 [\$\@] $qq_variable |
6802 \$ (?>\s* [0-9]+) |
6803 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
6804 \$ \$ (?![\w\{]) |
6805 \$ (?>\s*) \$ (?>\s*) $qq_variable |
6806 \[\^ |
6807 \[\: (?>[a-z]+) :\] |
6808 \[\:\^ (?>[a-z]+) :\] |
6809 \(\? |
6810 $q_char
6811 ))/oxmsg;
6812  
6813 74 my $left_e = 0;
6814 74 my $right_e = 0;
6815 74 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 249 74 323
6816  
6817 # "\L\u" --> "\u\L"
6818 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
6819 0 @char[$i,$i+1] = @char[$i+1,$i];
6820 }
6821  
6822 # "\U\l" --> "\l\U"
6823 ▶ 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
6824 0 @char[$i,$i+1] = @char[$i+1,$i];
6825 }
6826  
6827 # octal escape sequence
6828 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
6829 1 $char[$i] = Ecyrillic::octchr($1);
6830 }
6831  
6832 # hexadecimal escape sequence
6833 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
6834 1 $char[$i] = Ecyrillic::hexchr($1);
6835 }
6836  
6837 # \b{...} --> b\{...}
6838 # \B{...} --> B\{...}
6839 # \N{CHARNAME} --> N\{CHARNAME}
6840 # \p{PROPERTY} --> p\{PROPERTY}
6841 # \P{PROPERTY} --> P\{PROPERTY}
6842 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
6843 0 $char[$i] = $1 . '\\' . $2;
6844 }
6845  
6846 # \p, \P, \X --> p, P, X
6847 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
6848 0 $char[$i] = $1;
6849 }
6850  
6851 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 &Ecyrillic::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
6852 }
6853  
6854 # join separated multiple-octet
6855 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
6856 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 $Ecyrillic::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 $Ecyrillic::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 $Ecyrillic::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 $Ecyrillic::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 $Ecyrillic::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 $Ecyrillic::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 $Ecyrillic::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6857 0 $char[$i] .= join '', splice @char, $i+1, 3;
6858 }
6859 ▶ 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 $Ecyrillic::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 $Ecyrillic::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 $Ecyrillic::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 $Ecyrillic::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6860 0 $char[$i] .= join '', splice @char, $i+1, 2;
6861 }
6862 ▶ 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 $Ecyrillic::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 $Ecyrillic::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 $Ecyrillic::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 $Ecyrillic::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6863 0 $char[$i] .= join '', splice @char, $i+1, 1;
6864 }
6865 }
6866  
6867 # open character class [...]
6868 elsif ($char[$i] eq '[') {
6869 3 my $left = $i;
6870 3 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 3 3
6871 0 $i++;
6872 }
6873 3 while (1) {
6874 7 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 7 7
6875 0 die __FILE__, ": Unmatched [] in regexp\n";
6876 }
6877 7 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 3 4 7
6878 3 my $right = $i;
6879  
6880 # [...]
6881 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
6882 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Ecyrillic::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6883 }
6884 else {
6885 3 splice @char, $left, $right-$left+1, Ecyrillic::charlist_qr(@char[$left+1..$right-1], $modifier);
6886 }
6887  
6888 3 $i = $left;
6889 3 last;
6890 }
6891 }
6892 }
6893  
6894 # open character class [^...]
6895 elsif ($char[$i] eq '[^') {
6896 0 my $left = $i;
6897 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6898 0 $i++;
6899 }
6900 0 while (1) {
6901 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6902 0 die __FILE__, ": Unmatched [] in regexp\n";
6903 }
6904 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6905 0 my $right = $i;
6906  
6907 # [^...]
6908 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
6909 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Ecyrillic::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6910 }
6911 else {
6912 0 splice @char, $left, $right-$left+1, Ecyrillic::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6913 }
6914  
6915 0 $i = $left;
6916 0 last;
6917 }
6918 }
6919 }
6920  
6921 # rewrite character class or escape character
6922 elsif (my $char = character_class($char[$i],$modifier)) {
6923 1 $char[$i] = $char;
6924 }
6925  
6926 # P.794 29.2.161. split
6927 # in Chapter 29: Functions
6928 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
6929  
6930 # P.951 split
6931 # in Chapter 27: Functions
6932 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
6933  
6934 # said "The //m modifier is assumed when you split on the pattern /^/",
6935 # but perl5.008 is not so. Therefore, this software adds //m.
6936 # (and so on)
6937  
6938 # split(m/^/) --> split(m/^/m)
6939 ▶ 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
6940 7 $modifier .= 'm';
6941 }
6942  
6943 # /i modifier
6944 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Ecyrillic::uc($char[$i]) ne Ecyrillic::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Ecyrillic::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 &Ecyrillic::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Ecyrillic::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= &Ecyrillic::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6945 0 ▶ if (CORE::length(Ecyrillic::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
6946 0 $char[$i] = '[' . Ecyrillic::uc($char[$i]) . Ecyrillic::fc($char[$i]) . ']';
6947 }
6948 else {
6949 0 $char[$i] = '(?:' . Ecyrillic::uc($char[$i]) . '|' . Ecyrillic::fc($char[$i]) . ')';
6950 }
6951 }
6952  
6953 # \u \l \U \L \F \Q \E
6954 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
6955 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
6956 0 $char[$i] = '\\' . $char[$i];
6957 }
6958 }
6959 elsif ($char[$i] eq '\u') {
6960 0 $char[$i] = '@{[Ecyrillic::ucfirst qq<';
6961 0 $left_e++;
6962 }
6963 elsif ($char[$i] eq '\l') {
6964 0 $char[$i] = '@{[Ecyrillic::lcfirst qq<';
6965 0 $left_e++;
6966 }
6967 elsif ($char[$i] eq '\U') {
6968 0 $char[$i] = '@{[Ecyrillic::uc qq<';
6969 0 $left_e++;
6970 }
6971 elsif ($char[$i] eq '\L') {
6972 0 $char[$i] = '@{[Ecyrillic::lc qq<';
6973 0 $left_e++;
6974 }
6975 elsif ($char[$i] eq '\F') {
6976 0 $char[$i] = '@{[Ecyrillic::fc qq<';
6977 0 $left_e++;
6978 }
6979 elsif ($char[$i] eq '\Q') {
6980 0 $char[$i] = '@{[CORE::quotemeta qq<';
6981 0 $left_e++;
6982 }
6983 elsif ($char[$i] eq '\E') {
6984 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
6985 0 $char[$i] = '>]}';
6986 0 $right_e++;
6987 }
6988 else {
6989 0 $char[$i] = '';
6990 }
6991 }
6992 elsif ($char[$i] eq '\Q') {
6993 0 while (1) {
6994 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6995 0 last;
6996 }
6997 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
6998 0 last;
6999 }
7000 }
7001 }
7002 elsif ($char[$i] eq '\E') {
7003 }
7004  
7005 # $0 --> $0
7006 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
7007 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7008 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
7009 }
7010 }
7011 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
7012 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7013 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
7014 }
7015 }
7016  
7017 # $$ --> $$
7018 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
7019 }
7020  
7021 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
7022 # $1, $2, $3 --> $1, $2, $3 otherwise
7023 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
7024 0 $char[$i] = e_capture($1);
7025 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7026 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
7027 }
7028 }
7029 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
7030 0 $char[$i] = e_capture($1);
7031 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7032 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
7033 }
7034 }
7035  
7036 # $$foo[ ... ] --> $ $foo->[ ... ]
7037 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
7038 0 $char[$i] = e_capture($1.'->'.$2);
7039 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7040 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
7041 }
7042 }
7043  
7044 # $$foo{ ... } --> $ $foo->{ ... }
7045 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
7046 0 $char[$i] = e_capture($1.'->'.$2);
7047 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7048 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
7049 }
7050 }
7051  
7052 # $$foo
7053 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
7054 0 $char[$i] = e_capture($1);
7055 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7056 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
7057 }
7058 }
7059  
7060 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Ecyrillic::PREMATCH()
7061 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
7062 12 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 12 12
7063 0 $char[$i] = '@{[Ecyrillic::ignorecase(Ecyrillic::PREMATCH())]}';
7064 }
7065 else {
7066 12 $char[$i] = '@{[Ecyrillic::PREMATCH()]}';
7067 }
7068 }
7069  
7070 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Ecyrillic::MATCH()
7071 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
7072 12 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 12 12
7073 0 $char[$i] = '@{[Ecyrillic::ignorecase(Ecyrillic::MATCH())]}';
7074 }
7075 else {
7076 12 $char[$i] = '@{[Ecyrillic::MATCH()]}';
7077 }
7078 }
7079  
7080 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Ecyrillic::POSTMATCH()
7081 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
7082 9 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 9 9
7083 0 $char[$i] = '@{[Ecyrillic::ignorecase(Ecyrillic::POSTMATCH())]}';
7084 }
7085 else {
7086 9 $char[$i] = '@{[Ecyrillic::POSTMATCH()]}';
7087 }
7088 }
7089  
7090 # ${ foo }
7091 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
7092 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7093 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $1 . ')]}';
7094 }
7095 }
7096  
7097 # ${ ... }
7098 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
7099 0 $char[$i] = e_capture($1);
7100 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7101 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
7102 }
7103 }
7104  
7105 # $scalar or @array
7106 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
7107 3 $char[$i] = e_string($char[$i]);
7108 3 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 3 3
7109 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
7110 }
7111 }
7112  
7113 # quote character before ? + * {
7114 ▶ 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
7115 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
7116 }
7117 else {
7118 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
7119 }
7120 }
7121 }
7122  
7123 # make regexp string
7124 74 $modifier =~ tr/i//d;
7125 74 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 74 74
7126 0 return join '', 'Ecyrillic::split', $ope, $delimiter, @char, '>]}' x ($left_e - $right_e), $end_delimiter, $modifier;
7127 }
7128 74 return join '', 'Ecyrillic::split', $ope, $delimiter, @char, $end_delimiter, $modifier;
7129 }
7130  
7131 #
7132 # escape regexp of split qr''
7133 #
7134 0 ▶sub e_split_q {
Subroutine e_split_q: not called CC=26 SCAR=65.5
Pod undocumented
7135 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
7136 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
7137  
7138 0 $modifier =~ tr/p//d;
7139 0 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 0 0
7140 0 my $line = 0;
7141 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7142 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
7143 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
7144 0 last;
7145 }
7146 }
7147 0 die qq{Unsupported modifier "$1" used at line $line.\n};
7148 }
7149  
7150 0 $slash = 'div';
7151  
7152 # /b /B modifier
7153 0 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) 0 0 0
7154 0 return join '', 'split', $ope, $delimiter, $string, $end_delimiter, $modifier;
7155 }
7156  
7157 0 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 0 0
7158  
7159 # split regexp
7160 0 my @char = $string =~ /\G((?>
7161 [^\\\[] |
7162 [\x00-\xFF] |
7163 \[\^ |
7164 \[\: (?>[a-z]+) \:\] |
7165 \[\:\^ (?>[a-z]+) \:\] |
7166 \\ (?:$q_char) |
7167 (?:$q_char)
7168 ))/oxmsg;
7169  
7170 # unescape character
7171 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
7172 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 &Ecyrillic::uc($char[$i]) ne &fc($char[$i])) { } 0 0 0
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 0 0
7173 }
7174  
7175 # open character class [...]
7176 elsif ($char[$i] eq '[') {
7177 0 my $left = $i;
7178 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7179 0 $i++;
7180 }
7181 0 while (1) {
7182 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7183 0 die __FILE__, ": Unmatched [] in regexp\n";
7184 }
7185 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7186 0 my $right = $i;
7187  
7188 # [...]
7189 0 splice @char, $left, $right-$left+1, Ecyrillic::charlist_qr(@char[$left+1..$right-1], $modifier);
7190  
7191 0 $i = $left;
7192 0 last;
7193 }
7194 }
7195 }
7196  
7197 # open character class [^...]
7198 elsif ($char[$i] eq '[^') {
7199 0 my $left = $i;
7200 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7201 0 $i++;
7202 }
7203 0 while (1) {
7204 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7205 0 die __FILE__, ": Unmatched [] in regexp\n";
7206 }
7207 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7208 0 my $right = $i;
7209  
7210 # [^...]
7211 0 splice @char, $left, $right-$left+1, Ecyrillic::charlist_not_qr(@char[$left+1..$right-1], $modifier);
7212  
7213 0 $i = $left;
7214 0 last;
7215 }
7216 }
7217 }
7218  
7219 # rewrite character class or escape character
7220 elsif (my $char = character_class($char[$i],$modifier)) {
7221 0 $char[$i] = $char;
7222 }
7223  
7224 # split(m/^/) --> split(m/^/m)
7225 ▶ 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
7226 0 $modifier .= 'm';
7227 }
7228  
7229 # /i modifier
7230 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Ecyrillic::uc($char[$i]) ne Ecyrillic::fc($char[$i]))) {
Condition0%0/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Ecyrillic::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 &Ecyrillic::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Ecyrillic::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= &Ecyrillic::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
7231 0 ▶ if (CORE::length(Ecyrillic::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
7232 0 $char[$i] = '[' . Ecyrillic::uc($char[$i]) . Ecyrillic::fc($char[$i]) . ']';
7233 }
7234 else {
7235 0 $char[$i] = '(?:' . Ecyrillic::uc($char[$i]) . '|' . Ecyrillic::fc($char[$i]) . ')';
7236 }
7237 }
7238  
7239 # quote character before ? + * {
7240 ▶ 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
7241 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
7242 }
7243 else {
7244 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
7245 }
7246 }
7247 }
7248  
7249 0 $modifier =~ tr/i//d;
7250 0 return join '', 'Ecyrillic::split', $ope, $delimiter, @char, $end_delimiter, $modifier;
7251 }
7252  
7253 #
7254 # instead of Carp::carp
7255 #
7256 0 ▶sub carp {
Subroutine carp: not called CC=1 SCAR=6.9
Pod undocumented
7257 0 my($package,$filename,$line) = caller(1);
7258 0 print STDERR "@_ at $filename line $line.\n";
7259 }
7260  
7261 #
7262 # instead of Carp::croak
7263 #
7264 0 ▶sub croak {
Subroutine croak: not called CC=1 SCAR=6.9
Pod undocumented
7265 0 my($package,$filename,$line) = caller(1);
7266 0 print STDERR "@_ at $filename line $line.\n";
7267 0 die "\n";
7268 }
7269  
7270 #
7271 # instead of Carp::cluck
7272 #
7273 0 ▶sub cluck {
Subroutine cluck: not called CC=2 SCAR=17.9
Pod undocumented
7274 0 my $i = 0;
7275 0 my @cluck = ();
7276 0 ▶ while (my($package,$filename,$line,$subroutine) = caller($i)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7277 0 push @cluck, "[$i] $filename($line) $package::$subroutine\n";
7278 0 $i++;
7279 }
7280 0 print STDERR CORE::reverse @cluck;
7281 0 print STDERR "\n";
7282 0 print STDERR @_;
7283 }
7284  
7285 #
7286 # instead of Carp::confess
7287 #
7288 0 ▶sub confess {
Subroutine confess: not called CC=2 SCAR=17.9
Pod undocumented
7289 0 my $i = 0;
7290 0 my @confess = ();
7291 0 ▶ while (my($package,$filename,$line,$subroutine) = caller($i)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7292 0 push @confess, "[$i] $filename($line) $package::$subroutine\n";
7293 0 $i++;
7294 }
7295 0 print STDERR CORE::reverse @confess;
7296 0 print STDERR "\n";
7297 0 print STDERR @_;
7298 0 die "\n";
7299 }
7300  
7301 424 1;
7302  
7303 __END__
↑ Summary Cyrillic.pm »