blib/lib/Ecyrillic.pm

filter: Statementstmt 36.4% 1197 / 3286 Branchbran 38.5% 1140 / 2954 Conditioncond 31.0% 115 / 370 MC/DCmcdc 15.9% 35 / 220 Subroutinesub 60.8% 73 / 120 Podpod 4.6% 3 / 64 totaltotal 36.5% 2563 / 7014 CC 1648 SCAR 99.4
CC
1648
Cov
37%
escape_token
55669.4
e_string
33636.6
e_s1
3320.4
CRAP 20709.7
↑ Summary blib/lib/Cyrillic.pm »
1 package Ecyrillic;
2 422 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 ######################################################################
4 #
5 # Ecyrillic - Run-time routines for Cyrillic.pm
6 #
7 # http://search.cpan.org/dist/Char-Cyrillic/
8 #
9 # Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2018, 2019 INABA Hitoshi <ina@cpan.org>
10 ######################################################################
11  
12 422 ▶use 5.00503; # Galapagos Consensus 1998 for primetools
Subroutine BEGIN: called CC=1 SCAR=0.0
13 # use 5.008001; # Lancaster Consensus 2013 for toolchains
14  
15 # 12.3. Delaying use Until Runtime
16 # in Chapter 12. Packages, Libraries, and Modules
17 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
18 # (and so on)
19  
20 # Version numbers should be boring
21 # http://www.dagolden.com/index.php/369/version-numbers-should-be-boring/
22 # For the impatient, the disinterested or those who just want to follow
23 # a recipe, my advice for all modules is this:
24 # our $VERSION = "0.001"; # or "0.001_001" for a dev release
25 # $VERSION = eval $VERSION; # No!! because '1.10' makes '1.1'
26  
27 422 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
28 422 $VERSION = '1.15';
29 422 $VERSION = $VERSION;
30  
31 422 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=7.6
32 422 ▶ if ($^X =~ / jperl /oxmsi) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^X =~ / jperl /imosx) 0 422 422
33 0 die __FILE__, ": needs perl(not jperl) 5.00503 or later. (\$^X==$^X)\n";
34 }
35 422 if (CORE::ord('A') == 193) {
36 die __FILE__, ": is not US-ASCII script (may be EBCDIC or EBCDIK script).\n";
37 }
38 422 if (CORE::ord('A') != 0x41) {
39 die __FILE__, ": is not US-ASCII script (must be US-ASCII script).\n";
40 }
41 }
42  
43 422 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=9.5
44  
45 # instead of utf8.pm
46 422 ▶ CORE::eval q{
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
47 no warnings qw(redefine);
48 *utf8::upgrade = sub { CORE::length $_[0] };
49 *utf8::downgrade = sub { 1 };
50 *utf8::encode = sub { };
51 *utf8::decode = sub { 1 };
52 *utf8::is_utf8 = sub { };
53 *utf8::valid = sub { 1 };
54 };
55 422 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 422 422
56 0 ▶ *utf8::upgrade = sub { CORE::length $_[0] };
Subroutine __ANON__: not called CC=1 SCAR=6.9
57 0 ▶ *utf8::downgrade = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
58 0 ▶ *utf8::encode = sub { };
Subroutine __ANON__: not called CC=1 SCAR=6.9
59 0 ▶ *utf8::decode = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
60 0 ▶ *utf8::is_utf8 = sub { };
Subroutine __ANON__: not called CC=1 SCAR=6.9
61 0 ▶ *utf8::valid = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
62 }
63 }
64  
65 # instead of Symbol.pm
66 BEGIN {
67 0 ▶ sub gensym () {
Subroutine gensym: not called CC=2 SCAR=17.9
Pod undocumented
68 0 ▶ if ($] < 5.006) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] < 5.006) { } 0 0 0
69 0 return \do { local *_ };
70 }
71 else {
72 0 return undef;
73 }
74 }
75  
76 20 ▶ sub qualify ($$) {
Subroutine qualify: called CC=8 SCAR=28.9
Pod undocumented
77 20 my($name) = @_;
78  
79 20 ▶ if (ref $name) {
Branch: 7 branches
BranchTrueFalseTotal
if (ref $name) { } 5 15 20
elsif (&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
80 5 return $name;
81 }
82 elsif (Ecyrillic::index($name,'::') >= 0) {
83 0 return $name;
84 }
85 elsif (Ecyrillic::index($name,"'") >= 0) {
86 0 return $name;
87 }
88  
89 # special character, "^xyz"
90 elsif ($name =~ /\A \^ [ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]+ \z/x) {
91  
92 # RGS 2001-11-05 : translate leading ^X to control-char
93 0 $name =~ s{\A \^ ([ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]) }{'qq(\c'.$1.')'}xee;
94 0 return 'main::' . $name;
95 }
96  
97 # Global names
98 elsif ($name =~ /\A (?: ARGV | ARGVOUT | ENV | INC | SIG | STDERR | STDIN | STDOUT ) \z/x) {
99 0 return 'main::' . $name;
100 }
101  
102 # or other
103 elsif ($name =~ /\A [^ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz] \z/x) {
104 0 return 'main::' . $name;
105 }
106  
107 elsif (defined $_[1]) {
108 15 return $_[1] . '::' . $name;
109 }
110 else {
111 0 return (caller)[0] . '::' . $name;
112 }
113 }
114  
115 20 ▶ sub qualify_to_ref ($;$) {
Subroutine qualify_to_ref: called CC=2 SCAR=7.2
Pod undocumented
116 20 ▶ if (defined $_[1]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[1]) { } 20 0 20
117 422 ▶ no strict qw(refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
118 20 return \*{ qualify $_[0], $_[1] };
119 }
120 else {
121 422 ▶ no strict qw(refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: not called CC=1 SCAR=0.0
122 0 return \*{ qualify $_[0], (caller)[0] };
123 }
124 }
125 }
126  
127 # P.714 29.2.39. flock
128 # in Chapter 29: Functions
129 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
130  
131 # P.863 flock
132 # in Chapter 27: Functions
133 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
134  
135 sub LOCK_SH() {1}
136 sub LOCK_EX() {2}
137 sub LOCK_UN() {8}
138 sub LOCK_NB() {4}
139  
140 # instead of Carp.pm
141 sub carp;
142 sub croak;
143 sub cluck;
144 sub confess;
145  
146 # 6.18. Matching Multiple-Byte Characters
147 # in Chapter 6. Pattern Matching
148 # of ISBN 978-1-56592-243-3 Perl Perl Cookbook.
149 # (and so on)
150  
151 # regexp of character
152 422 my $your_char = q{[\x00-\xFF]};
153 422 ▶use vars qw($qq_char); $qq_char = qr/\\c[\x40-\x5F]|\\?(?:$your_char)/oxms;
Subroutine BEGIN: called CC=1 SCAR=0.0
154 422 ▶use vars qw($q_char); $q_char = qr/$your_char/oxms;
Subroutine BEGIN: called CC=1 SCAR=0.0
155  
156 #
157 # Cyrillic character range per length
158 #
159 422 my %range_tr = ();
160  
161 #
162 # Cyrillic case conversion
163 #
164 422 my %lc = ();
165 422 @lc{qw(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)} =
166 qw(a b c d e f g h i j k l m n o p q r s t u v w x y z);
167 422 my %uc = ();
168 422 @uc{qw(a b c d e f g h i j k l m n o p q r s t u v w x y z)} =
169 qw(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z);
170 422 my %fc = ();
171 422 @fc{qw(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)} =
172 qw(a b c d e f g h i j k l m n o p q r s t u v w x y z);
173  
174 422 ▶if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { __PACKAGE__ =~ / \b Ecyrillic \z/mosx }) { } 422 0 422
175 }
176  
177 elsif (__PACKAGE__ =~ / \b Ecyrillic \z/oxms) {
178 422 %range_tr = (
179 1 => [ [0x00..0xFF],
180 ],
181 );
182  
183 422 %lc = (%lc,
184 "\xA1" => "\xF1", # CYRILLIC LETTER IO
185 "\xA2" => "\xF2", # CYRILLIC LETTER DJE
186 "\xA3" => "\xF3", # CYRILLIC LETTER GJE
187 "\xA4" => "\xF4", # CYRILLIC LETTER UKRAINIAN IE
188 "\xA5" => "\xF5", # CYRILLIC LETTER DZE
189 "\xA6" => "\xF6", # CYRILLIC LETTER BYELORUSSIAN-UKRAINIAN I
190 "\xA7" => "\xF7", # CYRILLIC LETTER YI
191 "\xA8" => "\xF8", # CYRILLIC LETTER JE
192 "\xA9" => "\xF9", # CYRILLIC LETTER LJE
193 "\xAA" => "\xFA", # CYRILLIC LETTER NJE
194 "\xAB" => "\xFB", # CYRILLIC LETTER TSHE
195 "\xAC" => "\xFC", # CYRILLIC LETTER KJE
196 "\xAE" => "\xFE", # CYRILLIC LETTER SHORT U
197 "\xAF" => "\xFF", # CYRILLIC LETTER DZHE
198 "\xB0" => "\xD0", # CYRILLIC LETTER A
199 "\xB1" => "\xD1", # CYRILLIC LETTER BE
200 "\xB2" => "\xD2", # CYRILLIC LETTER VE
201 "\xB3" => "\xD3", # CYRILLIC LETTER GHE
202 "\xB4" => "\xD4", # CYRILLIC LETTER DE
203 "\xB5" => "\xD5", # CYRILLIC LETTER IE
204 "\xB6" => "\xD6", # CYRILLIC LETTER ZHE
205 "\xB7" => "\xD7", # CYRILLIC LETTER ZE
206 "\xB8" => "\xD8", # CYRILLIC LETTER I
207 "\xB9" => "\xD9", # CYRILLIC LETTER SHORT I
208 "\xBA" => "\xDA", # CYRILLIC LETTER KA
209 "\xBB" => "\xDB", # CYRILLIC LETTER EL
210 "\xBC" => "\xDC", # CYRILLIC LETTER EM
211 "\xBD" => "\xDD", # CYRILLIC LETTER EN
212 "\xBE" => "\xDE", # CYRILLIC LETTER O
213 "\xBF" => "\xDF", # CYRILLIC LETTER PE
214 "\xC0" => "\xE0", # CYRILLIC LETTER ER
215 "\xC1" => "\xE1", # CYRILLIC LETTER ES
216 "\xC2" => "\xE2", # CYRILLIC LETTER TE
217 "\xC3" => "\xE3", # CYRILLIC LETTER U
218 "\xC4" => "\xE4", # CYRILLIC LETTER EF
219 "\xC5" => "\xE5", # CYRILLIC LETTER HA
220 "\xC6" => "\xE6", # CYRILLIC LETTER TSE
221 "\xC7" => "\xE7", # CYRILLIC LETTER CHE
222 "\xC8" => "\xE8", # CYRILLIC LETTER SHA
223 "\xC9" => "\xE9", # CYRILLIC LETTER SHCHA
224 "\xCA" => "\xEA", # CYRILLIC LETTER HARD SIGN
225 "\xCB" => "\xEB", # CYRILLIC LETTER YERU
226 "\xCC" => "\xEC", # CYRILLIC LETTER SOFT SIGN
227 "\xCD" => "\xED", # CYRILLIC LETTER E
228 "\xCE" => "\xEE", # CYRILLIC LETTER YU
229 "\xCF" => "\xEF", # CYRILLIC LETTER YA
230 );
231  
232 422 %uc = (%uc,
233 "\xD0" => "\xB0", # CYRILLIC LETTER A
234 "\xD1" => "\xB1", # CYRILLIC LETTER BE
235 "\xD2" => "\xB2", # CYRILLIC LETTER VE
236 "\xD3" => "\xB3", # CYRILLIC LETTER GHE
237 "\xD4" => "\xB4", # CYRILLIC LETTER DE
238 "\xD5" => "\xB5", # CYRILLIC LETTER IE
239 "\xD6" => "\xB6", # CYRILLIC LETTER ZHE
240 "\xD7" => "\xB7", # CYRILLIC LETTER ZE
241 "\xD8" => "\xB8", # CYRILLIC LETTER I
242 "\xD9" => "\xB9", # CYRILLIC LETTER SHORT I
243 "\xDA" => "\xBA", # CYRILLIC LETTER KA
244 "\xDB" => "\xBB", # CYRILLIC LETTER EL
245 "\xDC" => "\xBC", # CYRILLIC LETTER EM
246 "\xDD" => "\xBD", # CYRILLIC LETTER EN
247 "\xDE" => "\xBE", # CYRILLIC LETTER O
248 "\xDF" => "\xBF", # CYRILLIC LETTER PE
249 "\xE0" => "\xC0", # CYRILLIC LETTER ER
250 "\xE1" => "\xC1", # CYRILLIC LETTER ES
251 "\xE2" => "\xC2", # CYRILLIC LETTER TE
252 "\xE3" => "\xC3", # CYRILLIC LETTER U
253 "\xE4" => "\xC4", # CYRILLIC LETTER EF
254 "\xE5" => "\xC5", # CYRILLIC LETTER HA
255 "\xE6" => "\xC6", # CYRILLIC LETTER TSE
256 "\xE7" => "\xC7", # CYRILLIC LETTER CHE
257 "\xE8" => "\xC8", # CYRILLIC LETTER SHA
258 "\xE9" => "\xC9", # CYRILLIC LETTER SHCHA
259 "\xEA" => "\xCA", # CYRILLIC LETTER HARD SIGN
260 "\xEB" => "\xCB", # CYRILLIC LETTER YERU
261 "\xEC" => "\xCC", # CYRILLIC LETTER SOFT SIGN
262 "\xED" => "\xCD", # CYRILLIC LETTER E
263 "\xEE" => "\xCE", # CYRILLIC LETTER YU
264 "\xEF" => "\xCF", # CYRILLIC LETTER YA
265 "\xF1" => "\xA1", # CYRILLIC LETTER IO
266 "\xF2" => "\xA2", # CYRILLIC LETTER DJE
267 "\xF3" => "\xA3", # CYRILLIC LETTER GJE
268 "\xF4" => "\xA4", # CYRILLIC LETTER UKRAINIAN IE
269 "\xF5" => "\xA5", # CYRILLIC LETTER DZE
270 "\xF6" => "\xA6", # CYRILLIC LETTER BYELORUSSIAN-UKRAINIAN I
271 "\xF7" => "\xA7", # CYRILLIC LETTER YI
272 "\xF8" => "\xA8", # CYRILLIC LETTER JE
273 "\xF9" => "\xA9", # CYRILLIC LETTER LJE
274 "\xFA" => "\xAA", # CYRILLIC LETTER NJE
275 "\xFB" => "\xAB", # CYRILLIC LETTER TSHE
276 "\xFC" => "\xAC", # CYRILLIC LETTER KJE
277 "\xFE" => "\xAE", # CYRILLIC LETTER SHORT U
278 "\xFF" => "\xAF", # CYRILLIC LETTER DZHE
279 );
280  
281 422 %fc = (%fc,
282 "\xA1" => "\xF1", # CYRILLIC CAPITAL LETTER IO --> CYRILLIC SMALL LETTER IO
283 "\xA2" => "\xF2", # CYRILLIC CAPITAL LETTER DJE --> CYRILLIC SMALL LETTER DJE
284 "\xA3" => "\xF3", # CYRILLIC CAPITAL LETTER GJE --> CYRILLIC SMALL LETTER GJE
285 "\xA4" => "\xF4", # CYRILLIC CAPITAL LETTER UKRAINIAN IE --> CYRILLIC SMALL LETTER UKRAINIAN IE
286 "\xA5" => "\xF5", # CYRILLIC CAPITAL LETTER DZE --> CYRILLIC SMALL LETTER DZE
287 "\xA6" => "\xF6", # CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I --> CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I
288 "\xA7" => "\xF7", # CYRILLIC CAPITAL LETTER YI --> CYRILLIC SMALL LETTER YI
289 "\xA8" => "\xF8", # CYRILLIC CAPITAL LETTER JE --> CYRILLIC SMALL LETTER JE
290 "\xA9" => "\xF9", # CYRILLIC CAPITAL LETTER LJE --> CYRILLIC SMALL LETTER LJE
291 "\xAA" => "\xFA", # CYRILLIC CAPITAL LETTER NJE --> CYRILLIC SMALL LETTER NJE
292 "\xAB" => "\xFB", # CYRILLIC CAPITAL LETTER TSHE --> CYRILLIC SMALL LETTER TSHE
293 "\xAC" => "\xFC", # CYRILLIC CAPITAL LETTER KJE --> CYRILLIC SMALL LETTER KJE
294 "\xAE" => "\xFE", # CYRILLIC CAPITAL LETTER SHORT U --> CYRILLIC SMALL LETTER SHORT U
295 "\xAF" => "\xFF", # CYRILLIC CAPITAL LETTER DZHE --> CYRILLIC SMALL LETTER DZHE
296 "\xB0" => "\xD0", # CYRILLIC CAPITAL LETTER A --> CYRILLIC SMALL LETTER A
297 "\xB1" => "\xD1", # CYRILLIC CAPITAL LETTER BE --> CYRILLIC SMALL LETTER BE
298 "\xB2" => "\xD2", # CYRILLIC CAPITAL LETTER VE --> CYRILLIC SMALL LETTER VE
299 "\xB3" => "\xD3", # CYRILLIC CAPITAL LETTER GHE --> CYRILLIC SMALL LETTER GHE
300 "\xB4" => "\xD4", # CYRILLIC CAPITAL LETTER DE --> CYRILLIC SMALL LETTER DE
301 "\xB5" => "\xD5", # CYRILLIC CAPITAL LETTER IE --> CYRILLIC SMALL LETTER IE
302 "\xB6" => "\xD6", # CYRILLIC CAPITAL LETTER ZHE --> CYRILLIC SMALL LETTER ZHE
303 "\xB7" => "\xD7", # CYRILLIC CAPITAL LETTER ZE --> CYRILLIC SMALL LETTER ZE
304 "\xB8" => "\xD8", # CYRILLIC CAPITAL LETTER I --> CYRILLIC SMALL LETTER I
305 "\xB9" => "\xD9", # CYRILLIC CAPITAL LETTER SHORT I --> CYRILLIC SMALL LETTER SHORT I
306 "\xBA" => "\xDA", # CYRILLIC CAPITAL LETTER KA --> CYRILLIC SMALL LETTER KA
307 "\xBB" => "\xDB", # CYRILLIC CAPITAL LETTER EL --> CYRILLIC SMALL LETTER EL
308 "\xBC" => "\xDC", # CYRILLIC CAPITAL LETTER EM --> CYRILLIC SMALL LETTER EM
309 "\xBD" => "\xDD", # CYRILLIC CAPITAL LETTER EN --> CYRILLIC SMALL LETTER EN
310 "\xBE" => "\xDE", # CYRILLIC CAPITAL LETTER O --> CYRILLIC SMALL LETTER O
311 "\xBF" => "\xDF", # CYRILLIC CAPITAL LETTER PE --> CYRILLIC SMALL LETTER PE
312 "\xC0" => "\xE0", # CYRILLIC CAPITAL LETTER ER --> CYRILLIC SMALL LETTER ER
313 "\xC1" => "\xE1", # CYRILLIC CAPITAL LETTER ES --> CYRILLIC SMALL LETTER ES
314 "\xC2" => "\xE2", # CYRILLIC CAPITAL LETTER TE --> CYRILLIC SMALL LETTER TE
315 "\xC3" => "\xE3", # CYRILLIC CAPITAL LETTER U --> CYRILLIC SMALL LETTER U
316 "\xC4" => "\xE4", # CYRILLIC CAPITAL LETTER EF --> CYRILLIC SMALL LETTER EF
317 "\xC5" => "\xE5", # CYRILLIC CAPITAL LETTER HA --> CYRILLIC SMALL LETTER HA
318 "\xC6" => "\xE6", # CYRILLIC CAPITAL LETTER TSE --> CYRILLIC SMALL LETTER TSE
319 "\xC7" => "\xE7", # CYRILLIC CAPITAL LETTER CHE --> CYRILLIC SMALL LETTER CHE
320 "\xC8" => "\xE8", # CYRILLIC CAPITAL LETTER SHA --> CYRILLIC SMALL LETTER SHA
321 "\xC9" => "\xE9", # CYRILLIC CAPITAL LETTER SHCHA --> CYRILLIC SMALL LETTER SHCHA
322 "\xCA" => "\xEA", # CYRILLIC CAPITAL LETTER HARD SIGN --> CYRILLIC SMALL LETTER HARD SIGN
323 "\xCB" => "\xEB", # CYRILLIC CAPITAL LETTER YERU --> CYRILLIC SMALL LETTER YERU
324 "\xCC" => "\xEC", # CYRILLIC CAPITAL LETTER SOFT SIGN --> CYRILLIC SMALL LETTER SOFT SIGN
325 "\xCD" => "\xED", # CYRILLIC CAPITAL LETTER E --> CYRILLIC SMALL LETTER E
326 "\xCE" => "\xEE", # CYRILLIC CAPITAL LETTER YU --> CYRILLIC SMALL LETTER YU
327 "\xCF" => "\xEF", # CYRILLIC CAPITAL LETTER YA --> CYRILLIC SMALL LETTER YA
328 );
329 }
330  
331 else {
332 0 croak "Don't know my package name '@{[__PACKAGE__]}'";
333 }
334  
335 #
336 # @ARGV wildcard globbing
337 #
338 211 ▶sub import {
Subroutine import: called CC=7 SCAR=28.3
339  
340 211 ▶ if ($^O =~ /\A (?: MSWin32 | NetWare | symbian | dos ) \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O =~ /\A (?: MSWin32 | NetWare | symbian | dos ) \z/mosx) 0 211 211
341 0 my @argv = ();
342 0 for (@ARGV) {
343  
344 # has space
345 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
346 0 ▶ if (my @glob = Ecyrillic::glob(qq{"$_"})) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@glob) = &Ecyrillic::glob(qq["$_"])) { } 0 0 0
347 0 push @argv, @glob;
348 }
349 else {
350 0 push @argv, $_;
351 }
352 }
353  
354 # has wildcard metachar
355 elsif (/\A (?:$q_char)*? [*?] /oxms) {
356 0 ▶ if (my @glob = Ecyrillic::glob($_)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@glob) = &Ecyrillic::glob($_)) { } 0 0 0
357 0 push @argv, @glob;
358 }
359 else {
360 0 push @argv, $_;
361 }
362 }
363  
364 # no wildcard globbing
365 else {
366 0 push @argv, $_;
367 }
368 }
369 0 @ARGV = @argv;
370 }
371  
372 211 *Char::ord = \&Cyrillic::ord;
373 211 *Char::ord_ = \&Cyrillic::ord_;
374 211 *Char::reverse = \&Cyrillic::reverse;
375 211 *Char::getc = \&Cyrillic::getc;
376 211 *Char::length = \&Cyrillic::length;
377 211 *Char::substr = \&Cyrillic::substr;
378 211 *Char::index = \&Cyrillic::index;
379 211 *Char::rindex = \&Cyrillic::rindex;
380 211 *Char::eval = \&Cyrillic::eval;
381 211 *Char::escape = \&Cyrillic::escape;
382 211 *Char::escape_token = \&Cyrillic::escape_token;
383 211 *Char::escape_script = \&Cyrillic::escape_script;
384 }
385  
386 # P.230 Care with Prototypes
387 # in Chapter 6: Subroutines
388 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
389 #
390 # If you aren't careful, you can get yourself into trouble with prototypes.
391 # But if you are careful, you can do a lot of neat things with them. This is
392 # all very powerful, of course, and should only be used in moderation to make
393 # the world a better place.
394  
395 # P.332 Care with Prototypes
396 # in Chapter 7: Subroutines
397 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
398 #
399 # If you aren't careful, you can get yourself into trouble with prototypes.
400 # But if you are careful, you can do a lot of neat things with them. This is
401 # all very powerful, of course, and should only be used in moderation to make
402 # the world a better place.
403  
404 #
405 # Prototypes of subroutines
406 #
407 0 ▶sub unimport {}
Subroutine unimport: not called CC=1 SCAR=0.0
408 sub Ecyrillic::split(;$$$);
409 sub Ecyrillic::tr($$$$;$);
410 sub Ecyrillic::chop(@);
411 sub Ecyrillic::index($$;$);
412 sub Ecyrillic::rindex($$;$);
413 sub Ecyrillic::lcfirst(@);
414 sub Ecyrillic::lcfirst_();
415 sub Ecyrillic::lc(@);
416 sub Ecyrillic::lc_();
417 sub Ecyrillic::ucfirst(@);
418 sub Ecyrillic::ucfirst_();
419 sub Ecyrillic::uc(@);
420 sub Ecyrillic::uc_();
421 sub Ecyrillic::fc(@);
422 sub Ecyrillic::fc_();
423 sub Ecyrillic::ignorecase;
424 sub Ecyrillic::classic_character_class;
425 sub Ecyrillic::capture;
426 sub Ecyrillic::chr(;$);
427 sub Ecyrillic::chr_();
428 sub Ecyrillic::glob($);
429 sub Ecyrillic::glob_();
430  
431 sub Cyrillic::ord(;$);
432 sub Cyrillic::ord_();
433 sub Cyrillic::reverse(@);
434 sub Cyrillic::getc(;*@);
435 sub Cyrillic::length(;$);
436 sub Cyrillic::substr($$;$$);
437 sub Cyrillic::index($$;$);
438 sub Cyrillic::rindex($$;$);
439 sub Cyrillic::escape(;$);
440  
441 #
442 # Regexp work
443 #
444 422 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
445 $re_a
446 $re_t
447 $re_n
448 $re_r
449 422 );
450  
451 #
452 # Character class
453 #
454 422 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
455 $dot
456 $dot_s
457 $eD
458 $eS
459 $eW
460 $eH
461 $eV
462 $eR
463 $eN
464 $not_alnum
465 $not_alpha
466 $not_ascii
467 $not_blank
468 $not_cntrl
469 $not_digit
470 $not_graph
471 $not_lower
472 $not_lower_i
473 $not_print
474 $not_punct
475 $not_space
476 $not_upper
477 $not_upper_i
478 $not_word
479 $not_xdigit
480 $eb
481 $eB
482 422 );
483  
484 422 ${Ecyrillic::dot} = qr{(?>[^\x0A])};
485 422 ${Ecyrillic::dot_s} = qr{(?>[\x00-\xFF])};
486 422 ${Ecyrillic::eD} = qr{(?>[^0-9])};
487  
488 # Vertical tabs are now whitespace
489 # \s in a regex now matches a vertical tab in all circumstances.
490 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
491 # ${Ecyrillic::eS} = qr{(?>[^\x09\x0A \x0C\x0D\x20])};
492 # ${Ecyrillic::eS} = qr{(?>[^\x09\x0A\x0B\x0C\x0D\x20])};
493 422 ${Ecyrillic::eS} = qr{(?>[^\s])};
494  
495 422 ${Ecyrillic::eW} = qr{(?>[^0-9A-Z_a-z])};
496 422 ${Ecyrillic::eH} = qr{(?>[^\x09\x20])};
497 422 ${Ecyrillic::eV} = qr{(?>[^\x0A\x0B\x0C\x0D])};
498 422 ${Ecyrillic::eR} = qr{(?>\x0D\x0A|[\x0A\x0D])};
499 422 ${Ecyrillic::eN} = qr{(?>[^\x0A])};
500 422 ${Ecyrillic::not_alnum} = qr{(?>[^\x30-\x39\x41-\x5A\x61-\x7A])};
501 422 ${Ecyrillic::not_alpha} = qr{(?>[^\x41-\x5A\x61-\x7A])};
502 422 ${Ecyrillic::not_ascii} = qr{(?>[^\x00-\x7F])};
503 422 ${Ecyrillic::not_blank} = qr{(?>[^\x09\x20])};
504 422 ${Ecyrillic::not_cntrl} = qr{(?>[^\x00-\x1F\x7F])};
505 422 ${Ecyrillic::not_digit} = qr{(?>[^\x30-\x39])};
506 422 ${Ecyrillic::not_graph} = qr{(?>[^\x21-\x7F])};
507 422 ${Ecyrillic::not_lower} = qr{(?>[^\x61-\x7A])};
508 422 ${Ecyrillic::not_lower_i} = qr{(?>[^\x41-\x5A\x61-\x7A])}; # Perl 5.16 compatible
509 # ${Ecyrillic::not_lower_i} = qr{(?>[\x00-\xFF])}; # older Perl compatible
510 422 ${Ecyrillic::not_print} = qr{(?>[^\x20-\x7F])};
511 422 ${Ecyrillic::not_punct} = qr{(?>[^\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E])};
512 422 ${Ecyrillic::not_space} = qr{(?>[^\s\x0B])};
513 422 ${Ecyrillic::not_upper} = qr{(?>[^\x41-\x5A])};
514 422 ${Ecyrillic::not_upper_i} = qr{(?>[^\x41-\x5A\x61-\x7A])}; # Perl 5.16 compatible
515 # ${Ecyrillic::not_upper_i} = qr{(?>[\x00-\xFF])}; # older Perl compatible
516 422 ${Ecyrillic::not_word} = qr{(?>[^\x30-\x39\x41-\x5A\x5F\x61-\x7A])};
517 422 ${Ecyrillic::not_xdigit} = qr{(?>[^\x30-\x39\x41-\x46\x61-\x66])};
518 422 ${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))};
519 422 ${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]))};
520  
521 # avoid: Name "Ecyrillic::foo" used only once: possible typo at here.
522 422 ${Ecyrillic::dot} = ${Ecyrillic::dot};
523 422 ${Ecyrillic::dot_s} = ${Ecyrillic::dot_s};
524 422 ${Ecyrillic::eD} = ${Ecyrillic::eD};
525 422 ${Ecyrillic::eS} = ${Ecyrillic::eS};
526 422 ${Ecyrillic::eW} = ${Ecyrillic::eW};
527 422 ${Ecyrillic::eH} = ${Ecyrillic::eH};
528 422 ${Ecyrillic::eV} = ${Ecyrillic::eV};
529 422 ${Ecyrillic::eR} = ${Ecyrillic::eR};
530 422 ${Ecyrillic::eN} = ${Ecyrillic::eN};
531 422 ${Ecyrillic::not_alnum} = ${Ecyrillic::not_alnum};
532 422 ${Ecyrillic::not_alpha} = ${Ecyrillic::not_alpha};
533 422 ${Ecyrillic::not_ascii} = ${Ecyrillic::not_ascii};
534 422 ${Ecyrillic::not_blank} = ${Ecyrillic::not_blank};
535 422 ${Ecyrillic::not_cntrl} = ${Ecyrillic::not_cntrl};
536 422 ${Ecyrillic::not_digit} = ${Ecyrillic::not_digit};
537 422 ${Ecyrillic::not_graph} = ${Ecyrillic::not_graph};
538 422 ${Ecyrillic::not_lower} = ${Ecyrillic::not_lower};
539 422 ${Ecyrillic::not_lower_i} = ${Ecyrillic::not_lower_i};
540 422 ${Ecyrillic::not_print} = ${Ecyrillic::not_print};
541 422 ${Ecyrillic::not_punct} = ${Ecyrillic::not_punct};
542 422 ${Ecyrillic::not_space} = ${Ecyrillic::not_space};
543 422 ${Ecyrillic::not_upper} = ${Ecyrillic::not_upper};
544 422 ${Ecyrillic::not_upper_i} = ${Ecyrillic::not_upper_i};
545 422 ${Ecyrillic::not_word} = ${Ecyrillic::not_word};
546 422 ${Ecyrillic::not_xdigit} = ${Ecyrillic::not_xdigit};
547 422 ${Ecyrillic::eb} = ${Ecyrillic::eb};
548 422 ${Ecyrillic::eB} = ${Ecyrillic::eB};
549  
550 #
551 # Cyrillic split
552 #
553 72 ▶sub Ecyrillic::split(;$$$) {
Subroutine split: called CC=34 SCAR=46.9
Pod undocumented
554  
555 # P.794 29.2.161. split
556 # in Chapter 29: Functions
557 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
558  
559 # P.951 split
560 # in Chapter 27: Functions
561 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
562  
563 72 my $pattern = $_[0];
564 72 my $string = $_[1];
565 72 my $limit = $_[2];
566  
567 # if $pattern is also omitted or is the literal space, " "
568 72 ▶ if (not defined $pattern) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $pattern) 2 70 72
569 2 $pattern = ' ';
570 }
571  
572 # if $string is omitted, the function splits the $_ string
573 72 ▶ if (not defined $string) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $string) 6 66 72
574 6 ▶ if (defined $_) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_) { } 0 6 6
575 0 $string = $_;
576 }
577 else {
578 6 $string = '';
579 }
580 }
581  
582 72 my @split = ();
583  
584 # when string is empty
585 72 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 10 62 72
elsif ($pattern eq ' ') { } 2 60 62
586  
587 # resulting list value in list context
588 10 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 5 5 10
589 5 return @split;
590 }
591  
592 # count of substrings in scalar context
593 else {
594 5 ▶ carp "Use of implicit split to \@_ is deprecated" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 5 5
595 5 @_ = @split;
596 5 return scalar @_;
597 }
598 }
599  
600 # split's first argument is more consistently interpreted
601 #
602 # After some changes earlier in v5.17, split's behavior has been simplified:
603 # if the PATTERN argument evaluates to a string containing one space, it is
604 # treated the way that a literal string containing one space once was.
605 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#split's_first_argument_is_more_consistently_interpreted
606  
607 # if $pattern is also omitted or is the literal space, " ", the function splits
608 # on whitespace, /\s+/, after skipping any leading whitespace
609 # (and so on)
610  
611 elsif ($pattern eq ' ') {
612 2 ▶ if (not defined $limit) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $limit) { } 2 0 2
613 2 return CORE::split(' ', $string);
614 }
615 else {
616 0 return CORE::split(' ', $string, $limit);
617 }
618 }
619  
620 # if $limit is negative, it is treated as if an arbitrarily large $limit has been specified
621 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
622  
623 # a pattern capable of matching either the null string or something longer than the
624 # null string will split the value of $string into separate characters wherever it
625 # matches the null string between characters
626 # (and so on)
627  
628 60 ▶ if ('' =~ / \A $pattern \z /xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ('' =~ / \A $pattern \z /msx) { } 2 58 60
629 2 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
630 2 my $limit = scalar(() = $string =~ /($pattern)/oxmsg);
631  
632 # P.1024 Appendix W.10 Multibyte Processing
633 # of ISBN 1-56592-224-7 CJKV Information Processing
634 # (and so on)
635  
636 # the //m modifier is assumed when you split on the pattern /^/
637 # (and so on)
638  
639 # V
640 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
641  
642 # if the $pattern contains parentheses, then the substring matched by each pair of parentheses
643 # is included in the resulting list, interspersed with the fields that are ordinarily returned
644 # (and so on)
645  
646 9 local $@;
647 9 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 9 9 18
648 9 push @split, CORE::eval('$' . $digit);
649 }
650 }
651 }
652  
653 else {
654 58 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
655  
656 # V
657 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
658 163 local $@;
659 163 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 230 163 393
660 230 push @split, CORE::eval('$' . $digit);
661 }
662 }
663 }
664 }
665  
666 elsif ($limit > 0) {
667 0 ▶ if ('' =~ / \A $pattern \z /xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ('' =~ / \A $pattern \z /msx) { } 0 0 0
668 0 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
669 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
670  
671 # V
672 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
673 0 local $@;
674 0 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 0 0 0
675 0 push @split, CORE::eval('$' . $digit);
676 }
677 }
678 }
679 }
680 else {
681 0 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
682 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
683  
684 # V
685 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
686 0 local $@;
687 0 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 0 0 0
688 0 push @split, CORE::eval('$' . $digit);
689 }
690 }
691 }
692 }
693 }
694  
695 60 ▶ if (CORE::length($string) > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $string > 0) 58 2 60
696 58 push @split, $string;
697 }
698  
699 # if $_[2] (NOT "$limit") is omitted or zero, trailing null fields are stripped from the result
700 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
701 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
702 0 pop @split;
703 }
704 }
705  
706 # resulting list value in list context
707 60 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 58 2 60
708 58 return @split;
709 }
710  
711 # count of substrings in scalar context
712 else {
713 2 ▶ carp "Use of implicit split to \@_ is deprecated" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 2 2
714 2 @_ = @split;
715 2 return scalar @_;
716 }
717 }
718  
719 #
720 # get last subexpression offsets
721 #
722 60 ▶sub _last_subexpression_offsets {
Subroutine _last_subexpression_offsets: called CC=3 SCAR=11.0
723 60 my $pattern = $_[0];
724  
725 # remove comment
726 60 $pattern =~ s/\(\?\# .*? \)//oxmsg;
727  
728 60 my $modifier = '';
729 60 ▶ if ($pattern =~ /\(\?\^? ([\-A-Za-z]+) :/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pattern =~ /\(\?\^? ([\-A-Za-z]+) :/mosx) 11 49 60
730 11 $modifier = $1;
731 11 $modifier =~ s/-[A-Za-z]*//;
732 }
733  
734 # with /x modifier
735 60 my @char = ();
736 60 ▶ if ($modifier =~ /x/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /x/mosx) { } 5 55 60
737 5 @char = $pattern =~ /\G((?>
738 [^\\\#\[\(] |
739 \\ $q_char |
740 \# (?>[^\n]*) $ |
741 \[ (?>(?:[^\\\]]|\\\\|\\\]|$q_char)+) \] |
742 \(\? |
743 $q_char
744 ))/oxmsg;
745 }
746  
747 # without /x modifier
748 else {
749 55 @char = $pattern =~ /\G((?>
750 [^\\\[\(] |
751 \\ $q_char |
752 \[ (?>(?:[^\\\]]|\\\\|\\\]|$q_char)+) \] |
753 \(\? |
754 $q_char
755 ))/oxmsg;
756 }
757  
758 60 return scalar grep { $_ eq '(' } @char;
759 }
760  
761 #
762 # Cyrillic transliteration (tr///)
763 #
764 6 ▶sub Ecyrillic::tr($$$$;$) {
Subroutine tr: called CC=26 SCAR=48.6
Pod undocumented
765  
766 6 my $bind_operator = $_[1];
767 6 my $searchlist = $_[2];
768 6 my $replacementlist = $_[3];
769 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
770  
771 6 ▶ if ($modifier =~ /r/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /r/mosx) 5 1 6
772 5 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) 0 5 5
773 0 croak "Using !~ with tr///r doesn't make sense";
774 }
775 }
776  
777 6 my @char = $_[0] =~ /\G (?>$q_char) /oxmsg;
778 6 my @searchlist = _charlist_tr($searchlist);
779 6 my @replacementlist = _charlist_tr($replacementlist);
780  
781 6 my %tr = ();
782 6 ▶ for (my $i=0; $i <= $#searchlist; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#searchlist) 19 6 25
783 19 ▶ if (not exists $tr{$searchlist[$i]}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $tr{$searchlist[$i]}) 19 0 19
784 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
785 19 $tr{$searchlist[$i]} = $replacementlist[$i];
786 }
787 elsif ($modifier =~ /d/oxms) {
788 0 $tr{$searchlist[$i]} = '';
789 }
790 ▶ 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
791 0 $tr{$searchlist[$i]} = $replacementlist[-1];
792 }
793 else {
794 0 $tr{$searchlist[$i]} = $searchlist[$i];
795 }
796 }
797 }
798  
799 6 my $tr = 0;
800 6 my $replaced = '';
801 6 ▶ if ($modifier =~ /c/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /c/mosx) { } 0 6 6
802 0 ▶ while (defined(my $char = shift @char)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $char = shift @char)) 0 0 0
803 0 ▶ if (not exists $tr{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $tr{$char}) { } 0 0 0
804 0 ▶ if (defined $replacementlist[0]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $replacementlist[0]) 0 0 0
805 0 $replaced .= $replacementlist[0];
806 }
807 0 $tr++;
808 0 ▶ if ($modifier =~ /s/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/mosx) 0 0 0
809 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
810 0 shift @char;
811 0 $tr++;
812 }
813 }
814 }
815 else {
816 0 $replaced .= $char;
817 }
818 }
819 }
820 else {
821 6 ▶ while (defined(my $char = shift @char)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $char = shift @char)) 36 6 42
822 36 ▶ if (exists $tr{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $tr{$char}) { } 19 17 36
823 19 $replaced .= $tr{$char};
824 19 $tr++;
825 19 ▶ if ($modifier =~ /s/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/mosx) 0 19 19
826 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
827 0 shift @char;
828 0 $tr++;
829 }
830 }
831 }
832 else {
833 17 $replaced .= $char;
834 }
835 }
836 }
837  
838 6 ▶ if ($modifier =~ /r/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /r/mosx) { } 5 1 6
839 5 return $replaced;
840 }
841 else {
842 1 $_[0] = $replaced;
843 1 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) { } 0 1 1
844 0 return not $tr;
845 }
846 else {
847 1 return $tr;
848 }
849 }
850 }
851  
852 #
853 # Cyrillic chop
854 #
855 0 ▶sub Ecyrillic::chop(@) {
Subroutine chop: not called CC=3 SCAR=24.8
Pod undocumented
856  
857 0 my $chop;
858 0 ▶ if (@_ == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 0) { } 0 0 0
859 0 my @char = /\G (?>$q_char) /oxmsg;
860 0 $chop = pop @char;
861 0 $_ = join '', @char;
862 }
863 else {
864 0 for (@_) {
865 0 my @char = /\G (?>$q_char) /oxmsg;
866 0 $chop = pop @char;
867 0 $_ = join '', @char;
868 }
869 }
870 0 return $chop;
871 }
872  
873 #
874 # Cyrillic index by octet
875 #
876 30 ▶sub Ecyrillic::index($$;$) {
Subroutine index: called CC=6 SCAR=20.8
Pod documented
877  
878 30 my($str,$substr,$position) = @_;
879 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
880 30 my $pos = 0;
881  
882 30 ▶ while ($pos < CORE::length($str)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos < length $str) 130 30 160
883 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
884 0 ▶ if ($pos >= $position) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos >= $position) 0 0 0
885 0 return $pos;
886 }
887 }
888 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
889 130 $pos += CORE::length($1);
890 }
891 else {
892 0 $pos += 1;
893 }
894 }
895 30 return -1;
896 }
897  
898 #
899 # Cyrillic reverse index
900 #
901 0 ▶sub Ecyrillic::rindex($$;$) {
Subroutine rindex: not called CC=6 SCAR=37.4
Pod undocumented
902  
903 0 my($str,$substr,$position) = @_;
904 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
905 0 my $pos = 0;
906 0 my $rindex = -1;
907  
908 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
909 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
910 0 $rindex = $pos;
911 }
912 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
913 0 $pos += CORE::length($1);
914 }
915 else {
916 0 $pos += 1;
917 }
918 }
919 0 return $rindex;
920 }
921  
922 #
923 # Cyrillic lower case first with parameter
924 #
925 0 ▶sub Ecyrillic::lcfirst(@) {
Subroutine lcfirst: not called CC=4 SCAR=30.0
Pod undocumented
926 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
927 0 my $s = shift @_;
928 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
929 0 return Ecyrillic::lc(CORE::substr($s,0,1)) . CORE::substr($s,1), @_;
930 }
931 else {
932 0 return Ecyrillic::lc(CORE::substr($s,0,1)) . CORE::substr($s,1);
933 }
934 }
935 else {
936 0 return Ecyrillic::lc(CORE::substr($_,0,1)) . CORE::substr($_,1);
937 }
938 }
939  
940 #
941 # Cyrillic lower case first without parameter
942 #
943 0 ▶sub Ecyrillic::lcfirst_() {
Subroutine lcfirst_: not called CC=1 SCAR=6.9
Pod undocumented
944 0 return Ecyrillic::lc(CORE::substr($_,0,1)) . CORE::substr($_,1);
945 }
946  
947 #
948 # Cyrillic lower case with parameter
949 #
950 73 ▶sub Ecyrillic::lc(@) {
Subroutine lc: called CC=6 SCAR=24.2
Pod undocumented
951 73 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 73 0 73
952 73 my $s = shift @_;
953 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
954 0 ▶ return join('', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 0 0 0
955 }
956 else {
957 73 ▶ return join('', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 75 0 75
958 }
959 }
960 else {
961 0 return Ecyrillic::lc_();
962 }
963 }
964  
965 #
966 # Cyrillic lower case without parameter
967 #
968 0 ▶sub Ecyrillic::lc_() {
Subroutine lc_: not called CC=2 SCAR=17.9
Pod undocumented
969 0 my $s = $_;
970 0 ▶ return join '', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 0 0 0
971 }
972  
973 #
974 # Cyrillic upper case first with parameter
975 #
976 0 ▶sub Ecyrillic::ucfirst(@) {
Subroutine ucfirst: not called CC=4 SCAR=30.0
Pod undocumented
977 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
978 0 my $s = shift @_;
979 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
980 0 return Ecyrillic::uc(CORE::substr($s,0,1)) . CORE::substr($s,1), @_;
981 }
982 else {
983 0 return Ecyrillic::uc(CORE::substr($s,0,1)) . CORE::substr($s,1);
984 }
985 }
986 else {
987 0 return Ecyrillic::uc(CORE::substr($_,0,1)) . CORE::substr($_,1);
988 }
989 }
990  
991 #
992 # Cyrillic upper case first without parameter
993 #
994 0 ▶sub Ecyrillic::ucfirst_() {
Subroutine ucfirst_: not called CC=1 SCAR=6.9
Pod undocumented
995 0 return Ecyrillic::uc(CORE::substr($_,0,1)) . CORE::substr($_,1);
996 }
997  
998 #
999 # Cyrillic upper case with parameter
1000 #
1001 2636 ▶sub Ecyrillic::uc(@) {
Subroutine uc: called CC=6 SCAR=22.9
Pod undocumented
1002 2636 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2636 0 2636
1003 2636 my $s = shift @_;
1004 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
1005 0 ▶ return join('', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 0 0 0
1006 }
1007 else {
1008 2636 ▶ return join('', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 939 1699 2638
1009 }
1010 }
1011 else {
1012 0 return Ecyrillic::uc_();
1013 }
1014 }
1015  
1016 #
1017 # Cyrillic upper case without parameter
1018 #
1019 0 ▶sub Ecyrillic::uc_() {
Subroutine uc_: not called CC=2 SCAR=17.9
Pod undocumented
1020 0 my $s = $_;
1021 0 ▶ return join '', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 0 0 0
1022 }
1023  
1024 #
1025 # Cyrillic fold case with parameter
1026 #
1027 2634 ▶sub Ecyrillic::fc(@) {
Subroutine fc: called CC=6 SCAR=22.9
Pod undocumented
1028 2634 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2634 0 2634
1029 2634 my $s = shift @_;
1030 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
1031 0 ▶ return join('', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 0 0 0
1032 }
1033 else {
1034 2634 ▶ return join('', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 2086 6540 8626
1035 }
1036 }
1037 else {
1038 0 return Ecyrillic::fc_();
1039 }
1040 }
1041  
1042 #
1043 # Cyrillic fold case without parameter
1044 #
1045 0 ▶sub Ecyrillic::fc_() {
Subroutine fc_: not called CC=2 SCAR=17.9
Pod undocumented
1046 0 my $s = $_;
1047 0 ▶ return join '', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 0 0 0
1048 }
1049  
1050 #
1051 # Cyrillic regexp capture
1052 #
1053 {
1054 0 ▶ sub Ecyrillic::capture {
Subroutine capture: not called CC=1 SCAR=6.9
Pod documented
1055 0 return $_[0];
1056 }
1057 }
1058  
1059 #
1060 # Cyrillic regexp ignore case modifier
1061 #
1062 422 ▶sub Ecyrillic::ignorecase {
Subroutine ignorecase: called CC=25 SCAR=52.9
Pod undocumented
1063  
1064 11 my @string = @_;
1065 11 my $metachar = qr/[\@\\|[\]{]/oxms;
1066  
1067 # ignore case of $scalar or @array
1068 11 for my $string (@string) {
1069  
1070 # split regexp
1071 11 my @char = $string =~ /\G (?>\[\^|\\$q_char|$q_char) /oxmsg;
1072  
1073 # unescape character
1074 11 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1159 11 1170
1075 1159 ▶ next if not defined $char[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $char[$i] 0 1159 1159
1076  
1077 # open character class [...]
1078 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
1079 0 my $left = $i;
1080  
1081 # [] make die "unmatched [] in regexp ...\n"
1082  
1083 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
1084 0 $i++;
1085 }
1086  
1087 0 while (1) {
1088 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
1089 0 croak "Unmatched [] in regexp";
1090 }
1091 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
1092 0 my $right = $i;
1093 0 my @charlist = charlist_qr(@char[$left+1..$right-1], 'i');
1094  
1095 # escape character
1096 0 for my $char (@charlist) {
1097 0 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $char =~ /\A [.|)] \z/mosx }) 0 0 0
1098 }
1099  
1100 0 elsif ($char =~ /\A [.|)] \z/oxms) {
1101 0 $char = '\\' . $char;
1102 }
1103 }
1104  
1105 # [...]
1106 0 splice @char, $left, $right-$left+1, '(?:' . join('|', @charlist) . ')';
1107  
1108 0 $i = $left;
1109 0 last;
1110 }
1111 }
1112 }
1113  
1114 # open character class [^...]
1115 elsif ($char[$i] eq '[^') {
1116 0 my $left = $i;
1117  
1118 # [^] make die "unmatched [] in regexp ...\n"
1119  
1120 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
1121 0 $i++;
1122 }
1123  
1124 0 while (1) {
1125 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
1126 0 croak "Unmatched [] in regexp";
1127 }
1128 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
1129 0 my $right = $i;
1130 0 my @charlist = charlist_not_qr(@char[$left+1..$right-1], 'i');
1131  
1132 # escape character
1133 0 for my $char (@charlist) {
1134 0 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $char =~ /\A [.|)] \z/mosx }) 0 0 0
1135 }
1136  
1137 0 elsif ($char =~ /\A [.|)] \z/oxms) {
1138 0 $char = '\\' . $char;
1139 }
1140 }
1141  
1142 # [^...]
1143 0 splice @char, $left, $right-$left+1, '(?!' . join('|', @charlist) . ")(?:$your_char)";
1144  
1145 0 $i = $left;
1146 0 last;
1147 }
1148 }
1149 }
1150  
1151 # rewrite classic character class or escape character
1152 elsif (my $char = classic_character_class($char[$i])) {
1153 0 $char[$i] = $char;
1154 }
1155  
1156 # with /i modifier
1157 elsif ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) {
1158 1159 my $uc = Ecyrillic::uc($char[$i]);
1159 1159 my $fc = Ecyrillic::fc($char[$i]);
1160 1159 ▶ if ($uc ne $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc ne $fc) 591 568 1159
1161 591 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 591 0 591
1162 591 $char[$i] = '[' . $uc . $fc . ']';
1163 }
1164 else {
1165 0 $char[$i] = '(?:' . $uc . '|' . $fc . ')';
1166 }
1167 }
1168 }
1169 }
1170  
1171 # characterize
1172 11 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1159 11 1170
1173 1159 ▶ next if not defined $char[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $char[$i] 0 1159 1159
1174  
1175 1159 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx }) 0 1170 1170
1176 }
1177  
1178 # quote character before ? + * {
1179 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
1180 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
1181 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
1182 }
1183 }
1184 }
1185  
1186 11 $string = join '', @char;
1187 }
1188  
1189 # make regexp string
1190 11 return @string;
1191 }
1192  
1193 #
1194 # classic character class ( \D \S \W \d \s \w \C \X \H \V \h \v \R \N \b \B )
1195 #
1196 3027 ▶sub Ecyrillic::classic_character_class {
Subroutine classic_character_class: called CC=2 SCAR=6.9
Pod undocumented
1197 3027 my($char) = @_;
1198  
1199 return {
1200 '\D' => '${Ecyrillic::eD}',
1201 '\S' => '${Ecyrillic::eS}',
1202 '\W' => '${Ecyrillic::eW}',
1203 '\d' => '[0-9]',
1204  
1205 # Before Perl 5.6, \s only matched the five whitespace characters
1206 # tab, newline, form-feed, carriage return, and the space character
1207 # itself, which, taken together, is the character class [\t\n\f\r ].
1208  
1209 # Vertical tabs are now whitespace
1210 # \s in a regex now matches a vertical tab in all circumstances.
1211 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
1212 # \t \n \v \f \r space
1213 # '\s' => '[\x09\x0A \x0C\x0D\x20]',
1214 # '\s' => '[\x09\x0A\x0B\x0C\x0D\x20]',
1215 '\s' => '\s',
1216  
1217 '\w' => '[0-9A-Z_a-z]',
1218 '\C' => '[\x00-\xFF]',
1219 '\X' => 'X',
1220  
1221 # \h \v \H \V
1222  
1223 # P.114 Character Class Shortcuts
1224 # in Chapter 7: In the World of Regular Expressions
1225 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
1226  
1227 # P.357 13.2.3 Whitespace
1228 # in Chapter 13: perlrecharclass: Perl Regular Expression Character Classes
1229 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
1230 #
1231 # 0x00009 CHARACTER TABULATION h s
1232 # 0x0000a LINE FEED (LF) vs
1233 # 0x0000b LINE TABULATION v
1234 # 0x0000c FORM FEED (FF) vs
1235 # 0x0000d CARRIAGE RETURN (CR) vs
1236 # 0x00020 SPACE h s
1237  
1238 # P.196 Table 5-9. Alphanumeric regex metasymbols
1239 # in Chapter 5. Pattern Matching
1240 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1241  
1242 # (and so on)
1243  
1244 '\H' => '${Ecyrillic::eH}',
1245 '\V' => '${Ecyrillic::eV}',
1246 '\h' => '[\x09\x20]',
1247 '\v' => '[\x0A\x0B\x0C\x0D]',
1248 '\R' => '${Ecyrillic::eR}',
1249  
1250 # \N
1251 #
1252 # http://perldoc.perl.org/perlre.html
1253 # Character Classes and other Special Escapes
1254 # Any character but \n (experimental). Not affected by /s modifier
1255  
1256 '\N' => '${Ecyrillic::eN}',
1257  
1258 # \b \B
1259  
1260 # P.180 Boundaries: The \b and \B Assertions
1261 # in Chapter 5: Pattern Matching
1262 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
1263  
1264 # P.219 Boundaries: The \b and \B Assertions
1265 # in Chapter 5: Pattern Matching
1266 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1267  
1268 # \b really means (?:(?<=\w)(?!\w)|(?<!\w)(?=\w))
1269 # or (?:(?<=\A|\W)(?=\w)|(?<=\w)(?=\W|\z))
1270 '\b' => '${Ecyrillic::eb}',
1271  
1272 # \B really means (?:(?<=\w)(?=\w)|(?<!\w)(?!\w))
1273 # or (?:(?<=\w)(?=\w)|(?<=\W)(?=\W))
1274 '\B' => '${Ecyrillic::eB}',
1275  
1276 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
1277 }
1278  
1279 #
1280 # prepare Cyrillic characters per length
1281 #
1282  
1283 # 1 octet characters
1284 422 my @chars1 = ();
1285 0 ▶sub chars1 {
Subroutine chars1: not called CC=5 SCAR=34.0
Pod undocumented
1286 0 ▶ if (@chars1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars1) 0 0 0
1287 0 return @chars1;
1288 }
1289 0 ▶ if (exists $range_tr{1}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{1}) 0 0 0
1290 0 my @ranges = @{ $range_tr{1} };
1291 0 ▶ while (my @range = splice(@ranges,0,1)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 1)) 0 0 0
1292 0 for my $oct0 (@{$range[0]}) {
1293 0 push @chars1, pack 'C', $oct0;
1294 }
1295 }
1296 }
1297 0 return @chars1;
1298 }
1299  
1300 # 2 octets characters
1301 422 my @chars2 = ();
1302 0 ▶sub chars2 {
Subroutine chars2: not called CC=6 SCAR=37.4
Pod undocumented
1303 0 ▶ if (@chars2) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars2) 0 0 0
1304 0 return @chars2;
1305 }
1306 0 ▶ if (exists $range_tr{2}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{2}) 0 0 0
1307 0 my @ranges = @{ $range_tr{2} };
1308 0 ▶ while (my @range = splice(@ranges,0,2)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 2)) 0 0 0
1309 0 for my $oct0 (@{$range[0]}) {
1310 0 for my $oct1 (@{$range[1]}) {
1311 0 push @chars2, pack 'CC', $oct0,$oct1;
1312 }
1313 }
1314 }
1315 }
1316 0 return @chars2;
1317 }
1318  
1319 # 3 octets characters
1320 422 my @chars3 = ();
1321 0 ▶sub chars3 {
Subroutine chars3: not called CC=7 SCAR=40.3
Pod undocumented
1322 0 ▶ if (@chars3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars3) 0 0 0
1323 0 return @chars3;
1324 }
1325 0 ▶ if (exists $range_tr{3}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{3}) 0 0 0
1326 0 my @ranges = @{ $range_tr{3} };
1327 0 ▶ while (my @range = splice(@ranges,0,3)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 3)) 0 0 0
1328 0 for my $oct0 (@{$range[0]}) {
1329 0 for my $oct1 (@{$range[1]}) {
1330 0 for my $oct2 (@{$range[2]}) {
1331 0 push @chars3, pack 'CCC', $oct0,$oct1,$oct2;
1332 }
1333 }
1334 }
1335 }
1336 }
1337 0 return @chars3;
1338 }
1339  
1340 # 4 octets characters
1341 422 my @chars4 = ();
1342 0 ▶sub chars4 {
Subroutine chars4: not called CC=8 SCAR=42.8
Pod undocumented
1343 0 ▶ if (@chars4) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars4) 0 0 0
1344 0 return @chars4;
1345 }
1346 0 ▶ if (exists $range_tr{4}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{4}) 0 0 0
1347 0 my @ranges = @{ $range_tr{4} };
1348 0 ▶ while (my @range = splice(@ranges,0,4)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 4)) 0 0 0
1349 0 for my $oct0 (@{$range[0]}) {
1350 0 for my $oct1 (@{$range[1]}) {
1351 0 for my $oct2 (@{$range[2]}) {
1352 0 for my $oct3 (@{$range[3]}) {
1353 0 push @chars4, pack 'CCCC', $oct0,$oct1,$oct2,$oct3;
1354 }
1355 }
1356 }
1357 }
1358 }
1359 }
1360 0 return @chars4;
1361 }
1362  
1363 #
1364 # Cyrillic open character list for tr
1365 #
1366 12 ▶sub _charlist_tr {
Subroutine _charlist_tr: called CC=35 SCAR=66.4
1367  
1368 12 local $_ = shift @_;
1369  
1370 # unescape character
1371 12 my @char = ();
1372 12 ▶ while (not /\G \z/oxmsgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgmosx) 38 12 50
1373 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
1374 0 push @char, '\-';
1375 }
1376 elsif (/\G \\ ([0-7]{2,3}) /oxmsgc) {
1377 0 push @char, CORE::chr(oct $1);
1378 }
1379 elsif (/\G \\x ([0-9A-Fa-f]{1,2}) /oxmsgc) {
1380 0 push @char, CORE::chr(hex $1);
1381 }
1382 elsif (/\G \\c ([\x40-\x5F]) /oxmsgc) {
1383 0 push @char, CORE::chr(CORE::ord($1) & 0x1F);
1384 }
1385 elsif (/\G (\\ [0nrtfbae]) /oxmsgc) {
1386 push @char, {
1387 '\0' => "\0",
1388 '\n' => "\n",
1389 '\r' => "\r",
1390 '\t' => "\t",
1391 '\f' => "\f",
1392 '\b' => "\x08", # \b means backspace in character class
1393 '\a' => "\a",
1394 '\e' => "\e",
1395 0 }->{$1};
1396 }
1397 elsif (/\G \\ ($q_char) /oxmsgc) {
1398 0 push @char, $1;
1399 }
1400 elsif (/\G ($q_char) /oxmsgc) {
1401 38 push @char, $1;
1402 }
1403 }
1404  
1405 # join separated multiple-octet
1406 12 @char = join('',@char) =~ /\G (?>\\-|$q_char) /oxmsg;
1407  
1408 # unescape '-'
1409 12 my @i = ();
1410 12 for my $i (0 .. $#char) {
1411 38 ▶ if ($char[$i] eq '\-') {
Branch: 2 branches
BranchTrueFalseTotal
if ($char[$i] eq '\\-') { } 0 38 38
elsif ($char[$i] eq '-') { } 0 38 38
1412 0 $char[$i] = '-';
1413 }
1414 elsif ($char[$i] eq '-') {
1415 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
1416 0 push @i, $i;
1417 }
1418 }
1419 }
1420  
1421 # open character list (reverse for splice)
1422 12 for my $i (CORE::reverse @i) {
1423 0 my @range = ();
1424  
1425 # range error
1426 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
1427 0 croak "Invalid tr/// range \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1428 }
1429  
1430 # range of multiple-octet code
1431 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
1432 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
1433 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
1434 }
1435 elsif (CORE::length($char[$i+1]) == 2) {
1436 0 push @range, grep {$char[$i-1] le $_} chars1();
1437 0 push @range, grep {$_ le $char[$i+1]} chars2();
1438 }
1439 elsif (CORE::length($char[$i+1]) == 3) {
1440 0 push @range, grep {$char[$i-1] le $_} chars1();
1441 0 push @range, chars2();
1442 0 push @range, grep {$_ le $char[$i+1]} chars3();
1443 }
1444 elsif (CORE::length($char[$i+1]) == 4) {
1445 0 push @range, grep {$char[$i-1] le $_} chars1();
1446 0 push @range, chars2();
1447 0 push @range, chars3();
1448 0 push @range, grep {$_ le $char[$i+1]} chars4();
1449 }
1450 else {
1451 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1452 }
1453 }
1454 elsif (CORE::length($char[$i-1]) == 2) {
1455 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
1456 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
1457 }
1458 elsif (CORE::length($char[$i+1]) == 3) {
1459 0 push @range, grep {$char[$i-1] le $_} chars2();
1460 0 push @range, grep {$_ le $char[$i+1]} chars3();
1461 }
1462 elsif (CORE::length($char[$i+1]) == 4) {
1463 0 push @range, grep {$char[$i-1] le $_} chars2();
1464 0 push @range, chars3();
1465 0 push @range, grep {$_ le $char[$i+1]} chars4();
1466 }
1467 else {
1468 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1469 }
1470 }
1471 elsif (CORE::length($char[$i-1]) == 3) {
1472 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
1473 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
1474 }
1475 elsif (CORE::length($char[$i+1]) == 4) {
1476 0 push @range, grep {$char[$i-1] le $_} chars3();
1477 0 push @range, grep {$_ le $char[$i+1]} chars4();
1478 }
1479 else {
1480 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1481 }
1482 }
1483 elsif (CORE::length($char[$i-1]) == 4) {
1484 0 ▶ if (CORE::length($char[$i+1]) == 4) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $char[$i + 1] == 4) { } 0 0 0
1485 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
1486 }
1487 else {
1488 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1489 }
1490 }
1491 else {
1492 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1493 }
1494  
1495 0 splice @char, $i-1, 3, @range;
1496 }
1497  
1498 12 return @char;
1499 }
1500  
1501 #
1502 # Cyrillic open character class
1503 #
1504 0 ▶sub _cc {
Subroutine _cc: not called CC=7 SCAR=40.3
1505 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
1506 0 die __FILE__, ": subroutine cc got no parameter.\n";
1507 }
1508 elsif (scalar(@_) == 1) {
1509 0 return sprintf('\x%02X',$_[0]);
1510 }
1511 elsif (scalar(@_) == 2) {
1512 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
1513 0 die __FILE__, ": subroutine cc got \$_[0] > \$_[1] parameters).\n";
1514 }
1515 elsif ($_[0] == $_[1]) {
1516 0 return sprintf('\x%02X',$_[0]);
1517 }
1518 elsif (($_[0]+1) == $_[1]) {
1519 0 return sprintf('[\\x%02X\\x%02X]',$_[0],$_[1]);
1520 }
1521 else {
1522 0 return sprintf('[\\x%02X-\\x%02X]',$_[0],$_[1]);
1523 }
1524 }
1525 else {
1526 0 die __FILE__, ": subroutine cc got 3 or more parameters (@{[scalar(@_)]} parameters).\n";
1527 }
1528 }
1529  
1530 #
1531 # Cyrillic octet range
1532 #
1533 246 ▶sub _octets {
Subroutine _octets: called CC=5 SCAR=19.3
1534 246 my $length = shift @_;
1535  
1536 246 ▶ if ($length == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length == 1) { } 246 0 246
1537 246 my($a1) = unpack 'C', $_[0];
1538 246 my($z1) = unpack 'C', $_[1];
1539  
1540 246 ▶ if ($a1 > $z1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($a1 > $z1) 0 246 246
1541 0 croak 'Invalid [] range in regexp (CORE::ord(A) > CORE::ord(B)) ' . '\x' . unpack('H*',$a1) . '-\x' . unpack('H*',$z1);
1542 }
1543  
1544 246 ▶ if ($a1 == $z1) {
Branch: 2 branches
BranchTrueFalseTotal
if ($a1 == $z1) { } 0 246 246
elsif ($a1 + 1 == $z1) { } 0 246 246
1545 0 return sprintf('\x%02X',$a1);
1546 }
1547 elsif (($a1+1) == $z1) {
1548 0 return sprintf('\x%02X\x%02X',$a1,$z1);
1549 }
1550 else {
1551 246 return sprintf('\x%02X-\x%02X',$a1,$z1);
1552 }
1553 }
1554 else {
1555 0 die __FILE__, ": subroutine _octets got invalid length ($length).\n";
1556 }
1557 }
1558  
1559 #
1560 # Cyrillic range regexp
1561 #
1562 246 ▶sub _range_regexp {
Subroutine _range_regexp: called CC=18 SCAR=41.7
1563 246 my($length,$first,$last) = @_;
1564  
1565 246 my @range_regexp = ();
1566 246 ▶ if (not exists $range_tr{$length}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $range_tr{$length}) 0 246 246
1567 0 return @range_regexp;
1568 }
1569  
1570 246 my @ranges = @{ $range_tr{$length} };
1571 246 ▶ while (my @range = splice(@ranges,0,$length)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, $length)) 246 246 492
1572 246 my $min = '';
1573 246 my $max = '';
1574 246 ▶ for (my $i=0; $i < $length; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $length) 246 246 492
1575 246 $min .= pack 'C', $range[$i][0];
1576 246 $max .= pack 'C', $range[$i][-1];
1577 }
1578  
1579 # min___max
1580 # FIRST_____________LAST
1581 # (nothing)
1582  
1583 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
1584 }
1585  
1586 # **********
1587 # min_________max
1588 # FIRST_____________LAST
1589 # **********
1590  
1591 ▶ 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
1592 0 push @range_regexp, _octets($length,$first,$max,$min,$max);
1593 }
1594  
1595 # **********************
1596 # min________________max
1597 # FIRST_____________LAST
1598 # **********************
1599  
1600 ▶ 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
1601 0 push @range_regexp, _octets($length,$first,$last,$min,$max);
1602 }
1603  
1604 # *********
1605 # min___max
1606 # FIRST_____________LAST
1607 # *********
1608  
1609 ▶ 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
1610 0 push @range_regexp, _octets($length,$min,$max,$min,$max);
1611 }
1612  
1613 # **********************
1614 # min__________________________max
1615 # FIRST_____________LAST
1616 # **********************
1617  
1618 ▶ 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
1619 246 push @range_regexp, _octets($length,$first,$last,$min,$max);
1620 }
1621  
1622 # *********
1623 # min________max
1624 # FIRST_____________LAST
1625 # *********
1626  
1627 ▶ 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
1628 0 push @range_regexp, _octets($length,$min,$last,$min,$max);
1629 }
1630  
1631 # min___max
1632 # FIRST_____________LAST
1633 # (nothing)
1634  
1635 elsif ($last lt $min) {
1636 }
1637  
1638 else {
1639 0 die __FILE__, ": subroutine _range_regexp panic.\n";
1640 }
1641 }
1642  
1643 246 return @range_regexp;
1644 }
1645  
1646 #
1647 # Cyrillic open character list for qr and not qr
1648 #
1649 650 ▶sub _charlist {
Subroutine _charlist: called CC=46 SCAR=45.9
1650  
1651 650 my $modifier = pop @_;
1652 650 my @char = @_;
1653  
1654 650 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 298 352 650
1655  
1656 # unescape character
1657 650 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1773 650 2423
1658  
1659 # escape - to ...
1660 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
1661 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
1662 246 $char[$i] = '...';
1663 }
1664 }
1665  
1666 # octal escape sequence
1667 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
1668 0 $char[$i] = octchr($1);
1669 }
1670  
1671 # hexadecimal escape sequence
1672 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
1673 0 $char[$i] = hexchr($1);
1674 }
1675  
1676 # \b{...} --> b\{...}
1677 # \B{...} --> B\{...}
1678 # \N{CHARNAME} --> N\{CHARNAME}
1679 # \p{PROPERTY} --> p\{PROPERTY}
1680 # \P{PROPERTY} --> P\{PROPERTY}
1681 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
1682 0 $char[$i] = $1 . '\\' . $2;
1683 }
1684  
1685 # \p, \P, \X --> p, P, X
1686 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
1687 0 $char[$i] = $1;
1688 }
1689  
1690 elsif ($char[$i] =~ /\A \\ ([0-7]{2,3}) \z/oxms) {
1691 0 $char[$i] = CORE::chr oct $1;
1692 }
1693 elsif ($char[$i] =~ /\A \\x ([0-9A-Fa-f]{1,2}) \z/oxms) {
1694 22 $char[$i] = CORE::chr hex $1;
1695 }
1696 elsif ($char[$i] =~ /\A \\c ([\x40-\x5F]) \z/oxms) {
1697 0 $char[$i] = CORE::chr(CORE::ord($1) & 0x1F);
1698 }
1699 elsif ($char[$i] =~ /\A (\\ [0nrtfbaedswDSWHVhvR]) \z/oxms) {
1700 $char[$i] = {
1701 '\0' => "\0",
1702 '\n' => "\n",
1703 '\r' => "\r",
1704 '\t' => "\t",
1705 '\f' => "\f",
1706 '\b' => "\x08", # \b means backspace in character class
1707 '\a' => "\a",
1708 '\e' => "\e",
1709 '\d' => '[0-9]',
1710  
1711 # Vertical tabs are now whitespace
1712 # \s in a regex now matches a vertical tab in all circumstances.
1713 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
1714 # \t \n \v \f \r space
1715 # '\s' => '[\x09\x0A \x0C\x0D\x20]',
1716 # '\s' => '[\x09\x0A\x0B\x0C\x0D\x20]',
1717 '\s' => '\s',
1718  
1719 '\w' => '[0-9A-Z_a-z]',
1720 '\D' => '${Ecyrillic::eD}',
1721 '\S' => '${Ecyrillic::eS}',
1722 '\W' => '${Ecyrillic::eW}',
1723  
1724 '\H' => '${Ecyrillic::eH}',
1725 '\V' => '${Ecyrillic::eV}',
1726 '\h' => '[\x09\x20]',
1727 '\v' => '[\x0A\x0B\x0C\x0D]',
1728 '\R' => '${Ecyrillic::eR}',
1729  
1730 25 }->{$1};
1731 }
1732  
1733 # POSIX-style character classes
1734 ▶ 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
1735 $char[$i] = {
1736  
1737 '[:lower:]' => '[\x41-\x5A\x61-\x7A]',
1738 '[:upper:]' => '[\x41-\x5A\x61-\x7A]',
1739 '[:^lower:]' => '${Ecyrillic::not_lower_i}',
1740 '[:^upper:]' => '${Ecyrillic::not_upper_i}',
1741  
1742 8 }->{$1};
1743 }
1744 elsif ($char[$i] =~ /\A ( \[\: \^? (?:alnum|alpha|ascii|blank|cntrl|digit|graph|lower|print|punct|space|upper|word|xdigit) :\] ) \z/oxms) {
1745 $char[$i] = {
1746  
1747 '[:alnum:]' => '[\x30-\x39\x41-\x5A\x61-\x7A]',
1748 '[:alpha:]' => '[\x41-\x5A\x61-\x7A]',
1749 '[:ascii:]' => '[\x00-\x7F]',
1750 '[:blank:]' => '[\x09\x20]',
1751 '[:cntrl:]' => '[\x00-\x1F\x7F]',
1752 '[:digit:]' => '[\x30-\x39]',
1753 '[:graph:]' => '[\x21-\x7F]',
1754 '[:lower:]' => '[\x61-\x7A]',
1755 '[:print:]' => '[\x20-\x7F]',
1756 '[:punct:]' => '[\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E]',
1757  
1758 # P.174 POSIX-Style Character Classes
1759 # in Chapter 5: Pattern Matching
1760 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
1761  
1762 # P.311 11.2.4 Character Classes and other Special Escapes
1763 # in Chapter 11: perlre: Perl regular expressions
1764 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
1765  
1766 # P.210 POSIX-Style Character Classes
1767 # in Chapter 5: Pattern Matching
1768 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1769  
1770 '[:space:]' => '[\s\x0B]', # "\s" plus vertical tab ("\cK")
1771  
1772 '[:upper:]' => '[\x41-\x5A]',
1773 '[:word:]' => '[\x30-\x39\x41-\x5A\x5F\x61-\x7A]',
1774 '[:xdigit:]' => '[\x30-\x39\x41-\x46\x61-\x66]',
1775 '[:^alnum:]' => '${Ecyrillic::not_alnum}',
1776 '[:^alpha:]' => '${Ecyrillic::not_alpha}',
1777 '[:^ascii:]' => '${Ecyrillic::not_ascii}',
1778 '[:^blank:]' => '${Ecyrillic::not_blank}',
1779 '[:^cntrl:]' => '${Ecyrillic::not_cntrl}',
1780 '[:^digit:]' => '${Ecyrillic::not_digit}',
1781 '[:^graph:]' => '${Ecyrillic::not_graph}',
1782 '[:^lower:]' => '${Ecyrillic::not_lower}',
1783 '[:^print:]' => '${Ecyrillic::not_print}',
1784 '[:^punct:]' => '${Ecyrillic::not_punct}',
1785 '[:^space:]' => '${Ecyrillic::not_space}',
1786 '[:^upper:]' => '${Ecyrillic::not_upper}',
1787 '[:^word:]' => '${Ecyrillic::not_word}',
1788 '[:^xdigit:]' => '${Ecyrillic::not_xdigit}',
1789  
1790 70 }->{$1};
1791 }
1792 elsif ($char[$i] =~ /\A \\ ($q_char) \z/oxms) {
1793 7 $char[$i] = $1;
1794 }
1795 }
1796  
1797 # open character list
1798 650 my @singleoctet = ();
1799 650 my @multipleoctet = ();
1800 650 ▶ for (my $i=0; $i <= $#char; ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1527 650 2177
1801  
1802 # escaped -
1803 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
1804 246 $i += 1;
1805 246 next;
1806 }
1807  
1808 # make range regexp
1809 elsif ($char[$i] eq '...') {
1810  
1811 # range error
1812 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
1813 0 croak 'Invalid [] range in regexp (length(A) > length(B)) ' . '\x' . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]);
1814 }
1815 elsif (CORE::length($char[$i-1]) == CORE::length($char[$i+1])) {
1816 246 ▶ if ($char[$i-1] gt $char[$i+1]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i - 1] gt $char[$i + 1]) 0 246 246
1817 0 croak 'Invalid [] range in regexp (CORE::ord(A) > CORE::ord(B)) ' . '\x' . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]);
1818 }
1819 }
1820  
1821 # make range regexp per length
1822 246 for my $length (CORE::length($char[$i-1]) .. CORE::length($char[$i+1])) {
1823 246 my @regexp = ();
1824  
1825 # is first and last
1826 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
1827 246 push @regexp, _range_regexp($length, $char[$i-1], $char[$i+1]);
1828 }
1829  
1830 # is first
1831 elsif ($length == CORE::length($char[$i-1])) {
1832 0 push @regexp, _range_regexp($length, $char[$i-1], "\xFF" x $length);
1833 }
1834  
1835 # is inside in first and last
1836 ▶ 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
1837 0 push @regexp, _range_regexp($length, "\x00" x $length, "\xFF" x $length);
1838 }
1839  
1840 # is last
1841 elsif ($length == CORE::length($char[$i+1])) {
1842 0 push @regexp, _range_regexp($length, "\x00" x $length, $char[$i+1]);
1843 }
1844  
1845 else {
1846 0 die __FILE__, ": subroutine make_regexp panic.\n";
1847 }
1848  
1849 246 ▶ if ($length == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length == 1) { } 246 0 246
1850 246 push @singleoctet, @regexp;
1851 }
1852 else {
1853 0 push @multipleoctet, @regexp;
1854 }
1855 }
1856  
1857 246 $i += 2;
1858 }
1859  
1860 # with /i modifier
1861 elsif ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) {
1862 949 ▶ if ($modifier =~ /i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) { } 480 469 949
1863 480 my $uc = Ecyrillic::uc($char[$i]);
1864 480 my $fc = Ecyrillic::fc($char[$i]);
1865 480 ▶ if ($uc ne $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc ne $fc) { } 240 240 480
1866 240 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 240 0 240
1867 240 push @singleoctet, $uc, $fc;
1868 }
1869 else {
1870 0 push @singleoctet, $uc;
1871 0 push @multipleoctet, $fc;
1872 }
1873 }
1874 else {
1875 240 push @singleoctet, $char[$i];
1876 }
1877 }
1878 else {
1879 469 push @singleoctet, $char[$i];
1880 }
1881 949 $i += 1;
1882 }
1883  
1884 # single character of single octet code
1885 elsif ($char[$i] =~ /\A (?: \\h ) \z/oxms) {
1886 0 push @singleoctet, "\t", "\x20";
1887 0 $i += 1;
1888 }
1889 elsif ($char[$i] =~ /\A (?: \\v ) \z/oxms) {
1890 0 push @singleoctet, "\x0A", "\x0B", "\x0C", "\x0D";
1891 0 $i += 1;
1892 }
1893 elsif ($char[$i] =~ /\A (?: \\d | \\s | \\w ) \z/oxms) {
1894 2 push @singleoctet, $char[$i];
1895 2 $i += 1;
1896 }
1897  
1898 # single character of multiple-octet code
1899 else {
1900 84 push @multipleoctet, $char[$i];
1901 84 $i += 1;
1902 }
1903 }
1904  
1905 # quote metachar
1906 650 for (@singleoctet) {
1907 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
1908 0 $_ = '-';
1909 }
1910 elsif (/\A \n \z/oxms) {
1911 8 $_ = '\n';
1912 }
1913 elsif (/\A \r \z/oxms) {
1914 8 $_ = '\r';
1915 }
1916 elsif (/\A ([\x00-\x20\x7F-\xFF]) \z/oxms) {
1917 744 $_ = sprintf('\x%02X', CORE::ord $1);
1918 }
1919 elsif (/\A [\x00-\xFF] \z/oxms) {
1920 429 $_ = quotemeta $_;
1921 }
1922 }
1923  
1924 # return character list
1925 650 return \@singleoctet, \@multipleoctet;
1926 }
1927  
1928 #
1929 # Cyrillic octal escape sequence
1930 #
1931 5 ▶sub octchr {
Subroutine octchr: called CC=2 SCAR=6.9
Pod undocumented
1932 5 my($octdigit) = @_;
1933  
1934 5 my @binary = ();
1935 5 for my $octal (split(//,$octdigit)) {
1936 push @binary, {
1937 '0' => '000',
1938 '1' => '001',
1939 '2' => '010',
1940 '3' => '011',
1941 '4' => '100',
1942 '5' => '101',
1943 '6' => '110',
1944 '7' => '111',
1945 50 }->{$octal};
1946 }
1947 5 my $binary = join '', @binary;
1948  
1949 my $octchr = {
1950 # 1234567
1951 1 => pack('B*', "0000000$binary"),
1952 2 => pack('B*', "000000$binary"),
1953 3 => pack('B*', "00000$binary"),
1954 4 => pack('B*', "0000$binary"),
1955 5 => pack('B*', "000$binary"),
1956 6 => pack('B*', "00$binary"),
1957 7 => pack('B*', "0$binary"),
1958 0 => pack('B*', "$binary"),
1959  
1960 5 }->{CORE::length($binary) % 8};
1961  
1962 5 return $octchr;
1963 }
1964  
1965 #
1966 # Cyrillic hexadecimal escape sequence
1967 #
1968 5 ▶sub hexchr {
Subroutine hexchr: called CC=1 SCAR=0.0
Pod undocumented
1969 5 my($hexdigit) = @_;
1970  
1971 my $hexchr = {
1972 1 => pack('H*', "0$hexdigit"),
1973 0 => pack('H*', "$hexdigit"),
1974  
1975 5 }->{CORE::length($_[0]) % 2};
1976  
1977 5 return $hexchr;
1978 }
1979  
1980 #
1981 # Cyrillic open character list for qr
1982 #
1983 576 ▶sub charlist_qr {
Subroutine charlist_qr: called CC=17 SCAR=28.7
Pod undocumented
1984  
1985 576 my $modifier = pop @_;
1986 576 my @char = @_;
1987  
1988 576 my($singleoctet, $multipleoctet) = _charlist(@char, $modifier);
1989 576 my @singleoctet = @$singleoctet;
1990 576 my @multipleoctet = @$multipleoctet;
1991  
1992 # return character list
1993 576 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) 498 78 576
1994  
1995 # with /i modifier
1996 498 ▶ if ($modifier =~ m/i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) 265 233 498
1997 265 my %singleoctet_ignorecase = ();
1998 265 for (@singleoctet) {
1999 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
2000 745 for my $ord (hex($1) .. hex($2)) {
2001 795 my $char = CORE::chr($ord);
2002 795 my $uc = Ecyrillic::uc($char);
2003 795 my $fc = Ecyrillic::fc($char);
2004 795 ▶ if ($uc eq $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc eq $fc) { } 240 555 795
2005 240 $singleoctet_ignorecase{unpack 'C*', $char} = 1;
2006 }
2007 else {
2008 555 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 555 0 555
2009 555 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2010 555 $singleoctet_ignorecase{unpack 'C*', $fc} = 1;
2011 }
2012 else {
2013 0 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2014 0 push @multipleoctet, join '', map {sprintf('\x%02X',$_)} unpack 'C*', $fc;
2015 }
2016 }
2017 }
2018 }
2019 745 ▶ if ($_ ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ ne "") 0 745 745
2020 0 $singleoctet_ignorecase{unpack 'C*', $_} = 1;
2021 }
2022 }
2023 265 my $i = 0;
2024 265 my @singleoctet_ignorecase = ();
2025 265 for my $ord (0 .. 255) {
2026 67840 ▶ if (exists $singleoctet_ignorecase{$ord}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $singleoctet_ignorecase{$ord}) { } 870 66970 67840
2027 870 push @{$singleoctet_ignorecase[$i]}, $ord;
2028 }
2029 else {
2030 66970 $i++;
2031 }
2032 }
2033 265 @singleoctet = ();
2034 265 for my $range (@singleoctet_ignorecase) {
2035 56160 ▶ if (ref $range) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $range) 770 55390 56160
2036 770 ▶ if (scalar(@{$range}) == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @{$range;} == 1) { } 720 50 770
elsif (scalar @{$range;} == 2) { } 0 50 50
2037 720 push @singleoctet, sprintf('\x%02X', @{$range}[0]);
2038 }
2039 50 elsif (scalar(@{$range}) == 2) {
2040 0 push @singleoctet, sprintf('\x%02X\x%02X', @{$range}[0], @{$range}[-1]);
2041 }
2042 else {
2043 50 push @singleoctet, sprintf('\x%02X-\x%02X', @{$range}[0], @{$range}[-1]);
2044 }
2045 }
2046 }
2047 }
2048  
2049 498 my $not_anchor = '';
2050  
2051 498 push @multipleoctet, join('', $not_anchor, '[', @singleoctet, ']' );
2052 }
2053 576 ▶ if (scalar(@multipleoctet) >= 2) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @multipleoctet >= 2) { } 6 570 576
2054 6 return '(?:' . join('|', @multipleoctet) . ')';
2055 }
2056 else {
2057 570 return $multipleoctet[0];
2058 }
2059 }
2060  
2061 #
2062 # Cyrillic open character list for not qr
2063 #
2064 74 ▶sub charlist_not_qr {
Subroutine charlist_not_qr: called CC=18 SCAR=33.1
Pod undocumented
2065  
2066 74 my $modifier = pop @_;
2067 74 my @char = @_;
2068  
2069 74 my($singleoctet, $multipleoctet) = _charlist(@char, $modifier);
2070 74 my @singleoctet = @$singleoctet;
2071 74 my @multipleoctet = @$multipleoctet;
2072  
2073 # with /i modifier
2074 74 ▶ if ($modifier =~ m/i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) 25 49 74
2075 25 my %singleoctet_ignorecase = ();
2076 25 for (@singleoctet) {
2077 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
2078 25 for my $ord (hex($1) .. hex($2)) {
2079 75 my $char = CORE::chr($ord);
2080 75 my $uc = Ecyrillic::uc($char);
2081 75 my $fc = Ecyrillic::fc($char);
2082 75 ▶ if ($uc eq $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc eq $fc) { } 0 75 75
2083 0 $singleoctet_ignorecase{unpack 'C*', $char} = 1;
2084 }
2085 else {
2086 75 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 75 0 75
2087 75 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2088 75 $singleoctet_ignorecase{unpack 'C*', $fc} = 1;
2089 }
2090 else {
2091 0 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2092 0 push @multipleoctet, join '', map {sprintf('\x%02X',$_)} unpack 'C*', $fc;
2093 }
2094 }
2095 }
2096 }
2097 25 ▶ if ($_ ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ ne "") 0 25 25
2098 0 $singleoctet_ignorecase{unpack 'C*', $_} = 1;
2099 }
2100 }
2101 25 my $i = 0;
2102 25 my @singleoctet_ignorecase = ();
2103 25 for my $ord (0 .. 255) {
2104 6400 ▶ if (exists $singleoctet_ignorecase{$ord}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $singleoctet_ignorecase{$ord}) { } 150 6250 6400
2105 150 push @{$singleoctet_ignorecase[$i]}, $ord;
2106 }
2107 else {
2108 6250 $i++;
2109 }
2110 }
2111 25 @singleoctet = ();
2112 25 for my $range (@singleoctet_ignorecase) {
2113 2400 ▶ if (ref $range) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $range) 50 2350 2400
2114 50 ▶ if (scalar(@{$range}) == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @{$range;} == 1) { } 0 50 50
elsif (scalar @{$range;} == 2) { } 0 50 50
2115 0 push @singleoctet, sprintf('\x%02X', @{$range}[0]);
2116 }
2117 50 elsif (scalar(@{$range}) == 2) {
2118 0 push @singleoctet, sprintf('\x%02X\x%02X', @{$range}[0], @{$range}[-1]);
2119 }
2120 else {
2121 50 push @singleoctet, sprintf('\x%02X-\x%02X', @{$range}[0], @{$range}[-1]);
2122 }
2123 }
2124 }
2125 }
2126  
2127 # return character list
2128 74 ▶ if (scalar(@multipleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @multipleoctet >= 1) { } 0 74 74
2129 0 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) { } 0 0 0
2130  
2131 # any character other than multiple-octet and single octet character class
2132 0 return '(?!' . join('|', @multipleoctet) . ')(?:[^' . join('', @singleoctet) . '])';
2133 }
2134 else {
2135  
2136 # any character other than multiple-octet character class
2137 0 return '(?!' . join('|', @multipleoctet) . ")(?:$your_char)";
2138 }
2139 }
2140 else {
2141 74 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) { } 74 0 74
2142  
2143 # any character other than single octet character class
2144 74 return '(?:[^' . join('', @singleoctet) . '])';
2145 }
2146 else {
2147  
2148 # any character
2149 0 return "(?:$your_char)";
2150 }
2151 }
2152 }
2153  
2154 #
2155 # open file in read mode
2156 #
2157 422 ▶sub _open_r {
Subroutine _open_r: called CC=1 SCAR=0.0
2158 422 my(undef,$file) = @_;
2159 422 ▶ use Fcntl qw(O_RDONLY);
Subroutine BEGIN: called CC=1 SCAR=0.0
2160 422 return CORE::sysopen($_[0], $file, &O_RDONLY);
2161 }
2162  
2163 #
2164 # open file in append mode
2165 #
2166 211 ▶sub _open_a {
Subroutine _open_a: called CC=1 SCAR=0.0
2167 211 my(undef,$file) = @_;
2168 422 ▶ use Fcntl qw(O_WRONLY O_APPEND O_CREAT);
Subroutine BEGIN: called CC=1 SCAR=0.0
2169 211 return CORE::sysopen($_[0], $file, &O_WRONLY|&O_APPEND|&O_CREAT);
2170 }
2171  
2172 #
2173 # safe system
2174 #
2175 211 ▶sub _systemx {
Subroutine _systemx: called CC=1 SCAR=0.0
2176  
2177 # P.707 29.2.33. exec
2178 # in Chapter 29: Functions
2179 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2180 #
2181 # Be aware that in older releases of Perl, exec (and system) did not flush
2182 # your output buffer, so you needed to enable command buffering by setting $|
2183 # on one or more filehandles to avoid lost output in the case of exec, or
2184 # misordererd output in the case of system. This situation was largely remedied
2185 # in the 5.6 release of Perl. (So, 5.005 release not yet.)
2186  
2187 # P.855 exec
2188 # in Chapter 27: Functions
2189 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2190 #
2191 # In very old release of Perl (before v5.6), exec (and system) did not flush
2192 # your output buffer, so you needed to enable command buffering by setting $|
2193 # on one or more filehandles to avoid lost output with exec or misordered
2194 # output with system.
2195  
2196 211 $| = 1;
2197  
2198 # P.565 23.1.2. Cleaning Up Your Environment
2199 # in Chapter 23: Security
2200 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2201  
2202 # P.656 Cleaning Up Your Environment
2203 # in Chapter 20: Security
2204 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2205  
2206 # local $ENV{'PATH'} = '.';
2207 211 local @ENV{qw(IFS CDPATH ENV BASH_ENV)}; # Make %ENV safer
2208  
2209 # P.707 29.2.33. exec
2210 # in Chapter 29: Functions
2211 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2212 #
2213 # As we mentioned earlier, exec treats a discrete list of arguments as an
2214 # indication that it should bypass shell processing. However, there is one
2215 # place where you might still get tripped up. The exec call (and system, too)
2216 # will not distinguish between a single scalar argument and an array containing
2217 # only one element.
2218 #
2219 # @args = ("echo surprise"); # just one element in list
2220 # exec @args # still subject to shell escapes
2221 # or die "exec: $!"; # because @args == 1
2222 #
2223 # To avoid this, you can use the PATHNAME syntax, explicitly duplicating the
2224 # first argument as the pathname, which forces the rest of the arguments to be
2225 # interpreted as a list, even if there is only one of them:
2226 #
2227 # exec { $args[0] } @args # safe even with one-argument list
2228 # or die "can't exec @args: $!";
2229  
2230 # P.855 exec
2231 # in Chapter 27: Functions
2232 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2233 #
2234 # As we mentioned earlier, exec treats a discrete list of arguments as a
2235 # directive to bypass shell processing. However, there is one place where
2236 # you might still get tripped up. The exec call (and system, too) cannot
2237 # distinguish between a single scalar argument and an array containing
2238 # only one element.
2239 #
2240 # @args = ("echo surprise"); # just one element in list
2241 # exec @args # still subject to shell escapes
2242 # || die "exec: $!"; # because @args == 1
2243 #
2244 # To avoid this, use the PATHNAME syntax, explicitly duplicating the first
2245 # argument as the pathname, which forces the rest of the arguments to be
2246 # interpreted as a list, even if there is only one of them:
2247 #
2248 # exec { $args[0] } @args # safe even with one-argument list
2249 # || die "can't exec @args: $!";
2250  
2251 211 return CORE::system { $_[0] } @_; # safe even with one-argument list
2252 }
2253  
2254 #
2255 # Cyrillic order to character (with parameter)
2256 #
2257 3469 ▶sub Ecyrillic::chr(;$) {
Subroutine chr: called CC=4 SCAR=13.9
Pod undocumented
2258  
2259 3469 ▶ my $c = @_ ? $_[0] : $_;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 3469 0 3469
2260  
2261 3469 ▶ if ($c == 0x00) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c == 0) { } 24 3445 3469
2262 24 return "\x00";
2263 }
2264 else {
2265 3445 my @chr = ();
2266 3445 ▶ while ($c > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c > 0) 3445 3445 6890
2267 3445 unshift @chr, ($c % 0x100);
2268 3445 $c = int($c / 0x100);
2269 }
2270 3445 return pack 'C*', @chr;
2271 }
2272 }
2273  
2274 #
2275 # Cyrillic order to character (without parameter)
2276 #
2277 0 ▶sub Ecyrillic::chr_() {
Subroutine chr_: not called CC=3 SCAR=24.8
Pod undocumented
2278  
2279 0 my $c = $_;
2280  
2281 0 ▶ if ($c == 0x00) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c == 0) { } 0 0 0
2282 0 return "\x00";
2283 }
2284 else {
2285 0 my @chr = ();
2286 0 ▶ while ($c > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c > 0) 0 0 0
2287 0 unshift @chr, ($c % 0x100);
2288 0 $c = int($c / 0x100);
2289 }
2290 0 return pack 'C*', @chr;
2291 }
2292 }
2293  
2294 #
2295 # Cyrillic path globbing (with parameter)
2296 #
2297 0 ▶sub Ecyrillic::glob($) {
Subroutine glob: not called CC=3 SCAR=24.8
Pod undocumented
2298  
2299 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2300 0 my @glob = _DOS_like_glob(@_);
2301 0 for my $glob (@glob) {
2302 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2303 }
2304 0 return @glob;
2305 }
2306 else {
2307 0 my $glob = _DOS_like_glob(@_);
2308 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2309 0 return $glob;
2310 }
2311 }
2312  
2313 #
2314 # Cyrillic path globbing (without parameter)
2315 #
2316 0 ▶sub Ecyrillic::glob_() {
Subroutine glob_: not called CC=3 SCAR=24.8
Pod undocumented
2317  
2318 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2319 0 my @glob = _DOS_like_glob();
2320 0 for my $glob (@glob) {
2321 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2322 }
2323 0 return @glob;
2324 }
2325 else {
2326 0 my $glob = _DOS_like_glob();
2327 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2328 0 return $glob;
2329 }
2330 }
2331  
2332 #
2333 # Cyrillic path globbing via File::DosGlob 1.10
2334 #
2335 # Often I confuse "_dosglob" and "_doglob".
2336 # So, I renamed "_dosglob" to "_DOS_like_glob".
2337 #
2338 422 my %iter;
2339 my %entries;
2340 0 ▶sub _DOS_like_glob {
Subroutine _DOS_like_glob: not called CC=10 SCAR=47.0
2341  
2342 # context (keyed by second cxix argument provided by core)
2343 0 my($expr,$cxix) = @_;
2344  
2345 # glob without args defaults to $_
2346 0 ▶ $expr = $_ if not defined $expr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $expr 0 0 0
2347  
2348 # represents the current user's home directory
2349 #
2350 # 7.3. Expanding Tildes in Filenames
2351 # in Chapter 7. File Access
2352 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2353 #
2354 # and File::HomeDir, File::HomeDir::Windows module
2355  
2356 # DOS-like system
2357 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
2358 0 $expr =~ s{ \A ~ (?= [^/\\] ) }
2359 0 { my_home_MSWin32() }oxmse;
2360 }
2361  
2362 # UNIX-like system
2363 else {
2364 0 $expr =~ s{ \A ~ ( (?:[^/])* ) }
2365 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
2366 }
2367  
2368 # assume global context if not provided one
2369 0 ▶ $cxix = '_G_' if not defined $cxix;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $cxix 0 0 0
2370 0 ▶ $iter{$cxix} = 0 if not exists $iter{$cxix};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $iter{$cxix} 0 0 0
2371  
2372 # if we're just beginning, do it all first
2373 0 ▶ if ($iter{$cxix} == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iter{$cxix} == 0) 0 0 0
2374 0 $entries{$cxix} = [ _do_glob(1, _parse_line($expr)) ];
2375 }
2376  
2377 # chuck it all out, quick or slow
2378 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2379 0 delete $iter{$cxix};
2380 0 return @{delete $entries{$cxix}};
2381 }
2382 else {
2383 0 ▶ if ($iter{$cxix} = scalar @{$entries{$cxix}}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iter{$cxix} = scalar @{$entries{$cxix};}) { } 0 0 0
2384 0 return shift @{$entries{$cxix}};
2385 }
2386 else {
2387 # return undef for EOL
2388 0 delete $iter{$cxix};
2389 0 delete $entries{$cxix};
2390 0 return undef;
2391 }
2392 }
2393 }
2394  
2395 #
2396 # Cyrillic path globbing subroutine
2397 #
2398 0 ▶sub _do_glob {
Subroutine _do_glob: not called CC=44 SCAR=75.9
2399  
2400 0 my($cond,@expr) = @_;
2401 0 my @glob = ();
2402 0 my $fix_drive_relative_paths = 0;
2403  
2404 OUTER:
2405 0 for my $expr (@expr) {
2406 0 ▶ next OUTER if not defined $expr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $expr 0 0 0
2407 0 ▶ next OUTER if $expr eq '';
Branch: 1 branch
BranchTrueFalseTotal
if $expr eq "" 0 0 0
2408  
2409 0 my @matched = ();
2410 0 my @globdir = ();
2411 0 my $head = '.';
2412 0 my $pathsep = '/';
2413 0 my $tail;
2414  
2415 # if argument is within quotes strip em and do no globbing
2416 0 ▶ if ($expr =~ /\A " ((?:$q_char)*?) " \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expr =~ /\A " ((?:$Ecyrillic::q_char)*?) " \z/mosx) 0 0 0
2417 0 $expr = $1;
2418 0 ▶ if ($cond eq 'd') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cond eq 'd') { } 0 0 0
2419 0 ▶ if (-d $expr) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $expr) 0 0 0
2420 0 push @glob, $expr;
2421 }
2422 }
2423 else {
2424 0 ▶ if (-e $expr) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $expr) 0 0 0
2425 0 push @glob, $expr;
2426 }
2427 }
2428 0 next OUTER;
2429 }
2430  
2431 # wildcards with a drive prefix such as h:*.pm must be changed
2432 # to h:./*.pm to expand correctly
2433 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
2434 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
2435 0 $fix_drive_relative_paths = 1;
2436 }
2437 }
2438  
2439 0 ▶ if (($head, $tail) = _parse_path($expr,$pathsep)) {
Branch: 1 branch
BranchTrueFalseTotal
if (($head, $tail) = _parse_path($expr, $pathsep)) 0 0 0
2440 0 ▶ if ($tail eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($tail eq "") 0 0 0
2441 0 push @glob, $expr;
2442 0 next OUTER;
2443 }
2444 0 ▶ if ($head =~ / \A (?:$q_char)*? [*?] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head =~ / \A (?:$Ecyrillic::q_char)*? [*?] /mosx) 0 0 0
2445 0 ▶ if (@globdir = _do_glob('d', $head)) {
Branch: 1 branch
BranchTrueFalseTotal
if (@globdir = _do_glob("d", $head)) 0 0 0
2446 0 push @glob, _do_glob($cond, map {"$_$pathsep$tail"} @globdir);
2447 0 next OUTER;
2448 }
2449 }
2450 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
2451 0 $head .= $pathsep;
2452 }
2453 0 $expr = $tail;
2454 }
2455  
2456 # If file component has no wildcards, we can avoid opendir
2457 0 ▶ if ($expr !~ / \A (?:$q_char)*? [*?] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($expr =~ / \A (?:$Ecyrillic::q_char)*? [*?] /mosx) 0 0 0
2458 0 ▶ if ($head eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($head eq ".") 0 0 0
2459 0 $head = '';
2460 }
2461 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
2462 0 $head .= $pathsep;
2463 }
2464 0 $head .= $expr;
2465 0 ▶ if ($cond eq 'd') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cond eq 'd') { } 0 0 0
2466 0 ▶ if (-d $head) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $head) 0 0 0
2467 0 push @glob, $head;
2468 }
2469 }
2470 else {
2471 0 ▶ if (-e $head) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $head) 0 0 0
2472 0 push @glob, $head;
2473 }
2474 }
2475 0 next OUTER;
2476 }
2477 0 ▶ opendir(*DIR, $head) or next OUTER;
Branch: 1 branch
BranchTrueFalseTotal
opendir *DIR, $head or next OUTER 0 0 0
2478 0 my @leaf = readdir DIR;
2479 0 closedir DIR;
2480  
2481 0 ▶ if ($head eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($head eq ".") 0 0 0
2482 0 $head = '';
2483 }
2484 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
2485 0 $head .= $pathsep;
2486 }
2487  
2488 0 my $pattern = '';
2489 0 ▶ while ($expr =~ / \G ($q_char) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expr =~ / \G ($Ecyrillic::q_char) /cgox) 0 0 0
2490 0 my $char = $1;
2491  
2492 # 6.9. Matching Shell Globs as Regular Expressions
2493 # in Chapter 6. Pattern Matching
2494 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2495 # (and so on)
2496  
2497 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
2498 0 $pattern .= "(?:$your_char)*",
2499 }
2500 elsif ($char eq '?') {
2501 0 $pattern .= "(?:$your_char)?", # DOS style
2502 # $pattern .= "(?:$your_char)", # UNIX style
2503 }
2504 elsif ((my $fc = Ecyrillic::fc($char)) ne $char) {
2505 0 $pattern .= $fc;
2506 }
2507 else {
2508 0 $pattern .= quotemeta $char;
2509 }
2510 }
2511 0 ▶ my $matchsub = sub { Ecyrillic::fc($_[0]) =~ /\A $pattern \z/xms };
Subroutine __ANON__: not called CC=1 SCAR=6.9
2512  
2513 # if ($@) {
2514 # print STDERR "$0: $@\n";
2515 # next OUTER;
2516 # }
2517  
2518 INNER:
2519 0 for my $leaf (@leaf) {
2520 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
2521 0 next INNER;
2522 }
2523 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
2524 0 next INNER;
2525 }
2526  
2527 0 ▶ if (&$matchsub($leaf)) {
Branch: 1 branch
BranchTrueFalseTotal
if (&$matchsub($leaf)) 0 0 0
2528 0 push @matched, "$head$leaf";
2529 0 next INNER;
2530 }
2531  
2532 # [DOS compatibility special case]
2533 # Failed, add a trailing dot and try again, but only...
2534  
2535 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
2536 CORE::length($leaf) <= 8 and # name is shorter than or equal to 8 chars *and*
2537 Ecyrillic::index($pattern,'\\.') != -1 # pattern has a dot.
2538 ) {
2539 0 ▶ if (&$matchsub("$leaf.")) {
Branch: 1 branch
BranchTrueFalseTotal
if (&$matchsub("$leaf.")) 0 0 0
2540 0 push @matched, "$head$leaf";
2541 0 next INNER;
2542 }
2543 }
2544 }
2545 0 ▶ if (@matched) {
Branch: 1 branch
BranchTrueFalseTotal
if (@matched) 0 0 0
2546 0 push @glob, @matched;
2547 }
2548 }
2549 0 ▶ if ($fix_drive_relative_paths) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fix_drive_relative_paths) 0 0 0
2550 0 for my $glob (@glob) {
2551 0 $glob =~ s# \A ([A-Za-z]:) \./ #$1#oxms;
2552 }
2553 }
2554 0 return @glob;
2555 }
2556  
2557 #
2558 # Cyrillic parse line
2559 #
2560 0 ▶sub _parse_line {
Subroutine _parse_line: not called CC=3 SCAR=24.8
2561  
2562 0 my($line) = @_;
2563  
2564 0 $line .= ' ';
2565 0 my @piece = ();
2566 0 ▶ while ($line =~ /
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ / " ( (?>(?: [^"] )* ) ) " (?>\s+) | ( (?>(?: [^"\s] )* ) ) (?>\s+) /gmosx) 0 0 0
2567 " ( (?>(?: [^"] )* ) ) " (?>\s+) |
2568 ( (?>(?: [^"\s] )* ) ) (?>\s+)
2569 /oxmsg
2570 ) {
2571 0 ▶ push @piece, defined($1) ? $1 : $2;
Branch: 1 branch
BranchTrueFalseTotal
defined $1 ? : 0 0 0
2572 }
2573 0 return @piece;
2574 }
2575  
2576 #
2577 # Cyrillic parse path
2578 #
2579 0 ▶sub _parse_path {
Subroutine _parse_path: not called CC=2 SCAR=17.9
2580  
2581 0 my($path,$pathsep) = @_;
2582  
2583 0 $path .= '/';
2584 0 my @subpath = ();
2585 0 ▶ while ($path =~ /
Branch: 1 branch
BranchTrueFalseTotal
if ($path =~ m( ((?: [^/\\] )+?) [/\\] )gmosx) 0 0 0
2586 ((?: [^\/\\] )+?) [\/\\]
2587 /oxmsg
2588 ) {
2589 0 push @subpath, $1;
2590 }
2591  
2592 0 my $tail = pop @subpath;
2593 0 my $head = join $pathsep, @subpath;
2594 0 return $head, $tail;
2595 }
2596  
2597 #
2598 # via File::HomeDir::Windows 1.00
2599 #
2600 0 ▶sub my_home_MSWin32 {
Subroutine my_home_MSWin32: not called CC=9 SCAR=45.0
Pod undocumented
2601  
2602 # A lot of unix people and unix-derived tools rely on
2603 # the ability to overload HOME. We will support it too
2604 # so that they can replace raw HOME calls with File::HomeDir.
2605 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
2606 0 return $ENV{'HOME'};
2607 }
2608  
2609 # Do we have a user profile?
2610 ▶ 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
2611 0 return $ENV{'USERPROFILE'};
2612 }
2613  
2614 # Some Windows use something like $ENV{'HOME'}
2615 ▶ 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
2616 0 return join '', $ENV{'HOMEDRIVE'}, $ENV{'HOMEPATH'};
2617 }
2618  
2619 0 return undef;
2620 }
2621  
2622 #
2623 # via File::HomeDir::Unix 1.00
2624 #
2625 0 ▶sub my_home {
Subroutine my_home: not called CC=7 SCAR=40.3
Pod undocumented
2626 0 my $home;
2627  
2628 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
2629 0 $home = $ENV{'HOME'};
2630 }
2631  
2632 # This is from the original code, but I'm guessing
2633 # it means "login directory" and exists on some Unixes.
2634 ▶ 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
2635 0 $home = $ENV{'LOGDIR'};
2636 }
2637  
2638 ### More-desperate methods
2639  
2640 # Light desperation on any (Unixish) platform
2641 else {
2642 0 $home = CORE::eval q{ (getpwuid($<))[7] };
2643 }
2644  
2645 # On Unix in general, a non-existant home means "no home"
2646 # For example, "nobody"-like users might use /nonexistant
2647 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
2648 0 $home = undef;
2649 }
2650 0 return $home;
2651 }
2652  
2653 #
2654 # ${^PREMATCH}, $PREMATCH, $` the string preceding what was matched
2655 #
2656 56 ▶sub Ecyrillic::PREMATCH {
Subroutine PREMATCH: called CC=1 SCAR=0.0
Pod undocumented
2657 56 return $`;
2658 }
2659  
2660 #
2661 # ${^MATCH}, $MATCH, $& the string that matched
2662 #
2663 81 ▶sub Ecyrillic::MATCH {
Subroutine MATCH: called CC=1 SCAR=0.0
Pod undocumented
2664 81 return $&;
2665 }
2666  
2667 #
2668 # ${^POSTMATCH}, $POSTMATCH, $' the string following what was matched
2669 #
2670 42 ▶sub Ecyrillic::POSTMATCH {
Subroutine POSTMATCH: called CC=1 SCAR=0.0
Pod undocumented
2671 42 return $';
2672 }
2673  
2674 #
2675 # Cyrillic character to order (with parameter)
2676 #
2677 0 ▶sub Cyrillic::ord(;$) {
Subroutine ord: not called CC=4 SCAR=30.0
2678  
2679 0 ▶ local $_ = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
2680  
2681 0 ▶ if (/\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\A ($Ecyrillic::q_char) /mosx) { } 0 0 0
2682 0 my @ord = unpack 'C*', $1;
2683 0 my $ord = 0;
2684 0 ▶ while (my $o = shift @ord) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $o = shift @ord) 0 0 0
2685 0 $ord = $ord * 0x100 + $o;
2686 }
2687 0 return $ord;
2688 }
2689 else {
2690 0 return CORE::ord $_;
2691 }
2692 }
2693  
2694 #
2695 # Cyrillic character to order (without parameter)
2696 #
2697 0 ▶sub Cyrillic::ord_() {
Subroutine ord_: not called CC=3 SCAR=24.8
2698  
2699 0 ▶ if (/\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\A ($Ecyrillic::q_char) /mosx) { } 0 0 0
2700 0 my @ord = unpack 'C*', $1;
2701 0 my $ord = 0;
2702 0 ▶ while (my $o = shift @ord) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $o = shift @ord) 0 0 0
2703 0 $ord = $ord * 0x100 + $o;
2704 }
2705 0 return $ord;
2706 }
2707 else {
2708 0 return CORE::ord $_;
2709 }
2710 }
2711  
2712 #
2713 # Cyrillic reverse
2714 #
2715 0 ▶sub Cyrillic::reverse(@) {
Subroutine reverse: not called CC=2 SCAR=17.9
2716  
2717 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2718 0 return CORE::reverse @_;
2719 }
2720 else {
2721  
2722 # One of us once cornered Larry in an elevator and asked him what
2723 # problem he was solving with this, but he looked as far off into
2724 # the distance as he could in an elevator and said, "It seemed like
2725 # a good idea at the time."
2726  
2727 0 return join '', CORE::reverse(join('',@_) =~ /\G ($q_char) /oxmsg);
2728 }
2729 }
2730  
2731 #
2732 # Cyrillic getc (with parameter, without parameter)
2733 #
2734 20 ▶sub Cyrillic::getc(;*@) {
Subroutine getc: called CC=9 SCAR=26.7
2735  
2736 20 my($package) = caller;
2737 20 ▶ my $fh = @_ ? qualify_to_ref(shift,$package) : \*STDIN;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 20 0 20
2738 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
2739  
2740 0 my @length = sort { $a <=> $b } keys %range_tr;
2741 20 my $getc = '';
2742 20 for my $length ($length[0] .. $length[-1]) {
2743 20 $getc .= CORE::getc($fh);
2744 20 ▶ if (exists $range_tr{CORE::length($getc)}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{length $getc}) 20 0 20
2745 20 ▶ if ($getc =~ /\A ${Ecyrillic::dot_s} \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($getc =~ /\A $Ecyrillic::dot_s \z/mosx) 20 0 20
2746 20 ▶ return wantarray ? ($getc,@_) : $getc;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 20 20
2747 }
2748 }
2749 }
2750 0 ▶ return wantarray ? ($getc,@_) : $getc;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
2751 }
2752  
2753 #
2754 # Cyrillic length by character
2755 #
2756 0 ▶sub Cyrillic::length(;$) {
Subroutine length: not called CC=2 SCAR=17.9
2757  
2758 0 ▶ local $_ = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
2759  
2760 0 local @_ = /\G ($q_char) /oxmsg;
2761 0 return scalar @_;
2762 }
2763  
2764 #
2765 # Cyrillic substr by character
2766 #
2767 422 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=7.0
2768  
2769 # P.232 The lvalue Attribute
2770 # in Chapter 6: Subroutines
2771 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2772  
2773 # P.336 The lvalue Attribute
2774 # in Chapter 7: Subroutines
2775 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2776  
2777 # P.144 8.4 Lvalue subroutines
2778 # in Chapter 8: perlsub: Perl subroutines
2779 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
2780  
2781 0 ▶ CORE::eval sprintf(<<'END', ($] >= 5.014000) ? ':lvalue' : '');
Subroutine substr: called CC=11 SCAR=24.4
Branch: 10 branches
BranchTrueFalseTotal
$] >= 5.014 ? : 422 0 422
if ($offset > scalar @char or $offset < -1 * scalar(@char)) 2 25 27
if (@_ == 4) { } 1 24 25
elsif (@_ == 3) { } 21 3 24
if ($offset == 0) { } 0 21 21
elsif ($offset > 0) { } 20 1 21
if ($length == 0) { } 0 21 21
elsif ($length > 0) { } 20 1 21
if ($offset == 0) { } 0 3 3
elsif ($offset > 0) { } 2 1 3
Condition66%2/3
$offset > scalar @char or $offset < -1 * scalar(@char)
l!l&&r!l&&!r
2025
MC/DC50%1/2
$offset > scalar @char or $offset < -1 * scalar(@char)
$offset > scalar @char $offset < -1 * scalar(@char)
Truth table66%2/3
A or B
A= $offset > scalar @charB= $offset < -1 * scalar(@char)
ABresult
1X1
011
000
2782 # vv----------------------*******
2783 sub Cyrillic::substr($$;$$) %s {
2784  
2785 my @char = $_[0] =~ /\G (?>$q_char) /oxmsg;
2786  
2787 # If the substring is beyond either end of the string, substr() returns the undefined
2788 # value and produces a warning. When used as an lvalue, specifying a substring that
2789 # is entirely outside the string raises an exception.
2790 # http://perldoc.perl.org/functions/substr.html
2791  
2792 # A return with no argument returns the scalar value undef in scalar context,
2793 # an empty list () in list context, and (naturally) nothing at all in void
2794 # context.
2795  
2796 my $offset = $_[1];
2797 if (($offset > scalar(@char)) or ($offset < (-1 * scalar(@char)))) {
2798 return;
2799 }
2800  
2801 # substr($string,$offset,$length,$replacement)
2802 if (@_ == 4) {
2803 my(undef,undef,$length,$replacement) = @_;
2804 my $substr = join '', splice(@char, $offset, $length, $replacement);
2805 $_[0] = join '', @char;
2806  
2807 # return $substr; this doesn't work, don't say "return"
2808 $substr;
2809 }
2810  
2811 # substr($string,$offset,$length)
2812 elsif (@_ == 3) {
2813 my(undef,undef,$length) = @_;
2814 my $octet_offset = 0;
2815 my $octet_length = 0;
2816 if ($offset == 0) {
2817 $octet_offset = 0;
2818 }
2819 elsif ($offset > 0) {
2820 $octet_offset = CORE::length(join '', @char[0..$offset-1]);
2821 }
2822 else {
2823 $octet_offset = -1 * CORE::length(join '', @char[$#char+$offset+1..$#char]);
2824 }
2825 if ($length == 0) {
2826 $octet_length = 0;
2827 }
2828 elsif ($length > 0) {
2829 $octet_length = CORE::length(join '', @char[$offset..$offset+$length-1]);
2830 }
2831 else {
2832 $octet_length = -1 * CORE::length(join '', @char[$#char+$length+1..$#char]);
2833 }
2834 CORE::substr($_[0], $octet_offset, $octet_length);
2835 }
2836  
2837 # substr($string,$offset)
2838 else {
2839 my $octet_offset = 0;
2840 if ($offset == 0) {
2841 $octet_offset = 0;
2842 }
2843 elsif ($offset > 0) {
2844 $octet_offset = CORE::length(join '', @char[0..$offset-1]);
2845 }
2846 else {
2847 $octet_offset = -1 * CORE::length(join '', @char[$#char+$offset+1..$#char]);
2848 }
2849 CORE::substr($_[0], $octet_offset);
2850 }
2851 }
2852 END
2853 }
2854  
2855 #
2856 # Cyrillic index by character
2857 #
2858 0 ▶sub Cyrillic::index($$;$) {
Subroutine index: not called CC=3 SCAR=24.8
2859  
2860 0 my $index;
2861 0 ▶ if (@_ == 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 3) { } 0 0 0
2862 0 $index = Ecyrillic::index($_[0], $_[1], CORE::length(Cyrillic::substr($_[0], 0, $_[2])));
2863 }
2864 else {
2865 0 $index = Ecyrillic::index($_[0], $_[1]);
2866 }
2867  
2868 0 ▶ if ($index == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($index == -1) { } 0 0 0
2869 0 return -1;
2870 }
2871 else {
2872 0 return Cyrillic::length(CORE::substr $_[0], 0, $index);
2873 }
2874 }
2875  
2876 #
2877 # Cyrillic rindex by character
2878 #
2879 0 ▶sub Cyrillic::rindex($$;$) {
Subroutine rindex: not called CC=3 SCAR=24.8
2880  
2881 0 my $rindex;
2882 0 ▶ if (@_ == 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 3) { } 0 0 0
2883 0 $rindex = Ecyrillic::rindex($_[0], $_[1], CORE::length(Cyrillic::substr($_[0], 0, $_[2])));
2884 }
2885 else {
2886 0 $rindex = Ecyrillic::rindex($_[0], $_[1]);
2887 }
2888  
2889 0 ▶ if ($rindex == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rindex == -1) { } 0 0 0
2890 0 return -1;
2891 }
2892 else {
2893 0 return Cyrillic::length(CORE::substr $_[0], 0, $rindex);
2894 }
2895 }
2896  
2897 # when 'm//', '/' means regexp match 'm//' and '?' means regexp match '??'
2898 # when 'div', '/' means division operator and '?' means conditional operator (condition ? then : else)
2899 422 ▶use vars qw($slash); $slash = 'm//';
Subroutine BEGIN: called CC=1 SCAR=0.0
2900  
2901 # ord() to ord() or Cyrillic::ord()
2902 422 my $function_ord = 'ord';
2903  
2904 # ord to ord or Cyrillic::ord_
2905 422 my $function_ord_ = 'ord';
2906  
2907 # reverse to reverse or Cyrillic::reverse
2908 422 my $function_reverse = 'reverse';
2909  
2910 # getc to getc or Cyrillic::getc
2911 422 my $function_getc = 'getc';
2912  
2913 # P.1023 Appendix W.9 Multibyte Anchoring
2914 # of ISBN 1-56592-224-7 CJKV Information Processing
2915  
2916 422 my $anchor = '';
2917  
2918 422 ▶use vars qw($nest);
Subroutine BEGIN: called CC=1 SCAR=0.0
2919  
2920 # regexp of nested parens in qqXX
2921  
2922 # P.340 Matching Nested Constructs with Embedded Code
2923 # in Chapter 7: Perl
2924 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
2925  
2926 my $qq_paren = qr{(?{local $nest=0}) (?>(?:
2927 [^\\()] |
2928 \( (?{$nest++}) |
2929 \) (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2930 \\ [^c] |
2931 \\c[\x40-\x5F] |
2932 [\x00-\xFF]
2933 422 }xms;
2934  
2935 my $qq_brace = qr{(?{local $nest=0}) (?>(?:
2936 [^\\{}] |
2937 \{ (?{$nest++}) |
2938 \} (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2939 \\ [^c] |
2940 \\c[\x40-\x5F] |
2941 [\x00-\xFF]
2942 422 }xms;
2943  
2944 my $qq_bracket = qr{(?{local $nest=0}) (?>(?:
2945 [^\\\[\]] |
2946 \[ (?{$nest++}) |
2947 \] (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2948 \\ [^c] |
2949 \\c[\x40-\x5F] |
2950 [\x00-\xFF]
2951 422 }xms;
2952  
2953 my $qq_angle = qr{(?{local $nest=0}) (?>(?:
2954 [^\\<>] |
2955 \< (?{$nest++}) |
2956 \> (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2957 \\ [^c] |
2958 \\c[\x40-\x5F] |
2959 [\x00-\xFF]
2960 422 }xms;
2961  
2962 422 my $qq_scalar = qr{(?: \{ (?:$qq_brace)*? \} |
2963 (?: ::)? (?:
2964 (?> [a-zA-Z_][a-zA-Z_0-9]* (?: ::[a-zA-Z_][a-zA-Z_0-9]*)* )
2965 (?>(?: \[ (?: \$\[ | \$\] | $qq_char )*? \] | \{ (?:$qq_brace)*? \} )*)
2966 (?>(?: (?: -> )? (?: [\$\@\%\&\*]\* | \$\#\* | [\@\%]? \[ (?: \$\[ | \$\] | $qq_char )*? \] | [\@\%\*]? \{ (?:$qq_brace)*? \} ) )*)
2967 ))
2968 }xms;
2969  
2970 422 my $qq_variable = qr{(?: \{ (?:$qq_brace)*? \} |
2971 (?: ::)? (?:
2972 (?>[0-9]+) |
2973 [^a-zA-Z_0-9\[\]] |
2974 ^[A-Z] |
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 422 my $qq_substr = qr{(?> Char::substr | Cyrillic::substr | CORE::substr | substr ) (?>\s*) \( $qq_paren \)
2982 }xms;
2983  
2984 # regexp of nested parens in qXX
2985 my $q_paren = qr{(?{local $nest=0}) (?>(?:
2986 [^()] |
2987 \( (?{$nest++}) |
2988 \) (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2989 [\x00-\xFF]
2990 422 }xms;
2991  
2992 my $q_brace = qr{(?{local $nest=0}) (?>(?:
2993 [^\{\}] |
2994 \{ (?{$nest++}) |
2995 \} (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2996 [\x00-\xFF]
2997 422 }xms;
2998  
2999 my $q_bracket = qr{(?{local $nest=0}) (?>(?:
3000 [^\[\]] |
3001 \[ (?{$nest++}) |
3002 \] (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
3003 [\x00-\xFF]
3004 422 }xms;
3005  
3006 my $q_angle = qr{(?{local $nest=0}) (?>(?:
3007 [^<>] |
3008 \< (?{$nest++}) |
3009 \> (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
3010 [\x00-\xFF]
3011 422 }xms;
3012  
3013 422 my $matched = '';
3014 422 my $s_matched = '';
3015  
3016 422 my $tr_variable = ''; # variable of tr///
3017 422 my $sub_variable = ''; # variable of s///
3018 422 my $bind_operator = ''; # =~ or !~
3019  
3020 422 my @heredoc = (); # here document
3021 422 my @heredoc_delimiter = ();
3022 422 my $here_script = ''; # here script
3023  
3024 #
3025 # escape Cyrillic script
3026 #
3027 547 ▶sub Cyrillic::escape(;$) {
Subroutine escape: called CC=3 SCAR=11.0
3028 547 ▶ local($_) = $_[0] if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 292 255 547
3029  
3030 # P.359 The Study Function
3031 # in Chapter 7: Perl
3032 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3033  
3034 547 study $_; # Yes, I studied study yesterday.
3035  
3036 # while all script
3037  
3038 # 6.14. Matching from Where the Last Pattern Left Off
3039 # in Chapter 6. Pattern Matching
3040 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
3041 # (and so on)
3042  
3043 # one member of Tag-team
3044 #
3045 # P.128 Start of match (or end of previous match): \G
3046 # P.130 Advanced Use of \G with Perl
3047 # in Chapter 3: Overview of Regular Expression Features and Flavors
3048 # P.255 Use leading anchors
3049 # P.256 Expose ^ and \G at the front expressions
3050 # in Chapter 6: Crafting an Efficient Expression
3051 # P.315 "Tag-team" matching with /gc
3052 # in Chapter 7: Perl
3053 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3054  
3055 547 my $e_script = '';
3056 547 ▶ while (not /\G \z/oxgc) { # member
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 87080 547 87627
3057 87080 $e_script .= Cyrillic::escape_token();
3058 }
3059  
3060 547 return $e_script;
3061 }
3062  
3063 #
3064 # escape Cyrillic token of script
3065 #
3066 87080 ▶sub Cyrillic::escape_token {
Subroutine escape_token: called CC=504 SCAR=109.3
3067  
3068 # \n output here document
3069  
3070 87080 my $ignore_modules = join('|', qw(
3071 utf8
3072 bytes
3073 charnames
3074 I18N::Japanese
3075 I18N::Collate
3076 I18N::JExt
3077 File::DosGlob
3078 Wild
3079 Wildcard
3080 Japanese
3081 ));
3082  
3083 # another member of Tag-team
3084 #
3085 # P.315 "Tag-team" matching with /gc
3086 # in Chapter 7: Perl
3087 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3088  
3089 87080 ▶ if (/\G ( \n ) /oxgc) { # another member (and so on)
Branch: 139 branches
BranchTrueFalseTotal
if (/\G ( \n ) /cgox) { } 12838 74242 87080
elsif (/\G ((?>\s+)|\#.*) /cgox) { } 21458 52784 74242
elsif (/\G ( (?: if | elsif | unless | while | until | given | when ) (?>\s*) \( ) /cgox) { } 1644 51140 52784
elsif (/\G ( \( (?>\s*) (?: local \b | my \b | our \b | state \b )? (?>\s*) \$ $qq_scalar ) /cgox) { } 90 51050 51140
elsif (/\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /cgmosx) { } 4 51046 51050
elsif (/\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /cgmosx) { } 28 51018 51046
elsif (/\G ( \$' | \$\{'\} ) /cgmosx) { } 1 51017 51018
elsif (/\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /cgmosx) { } 3 51014 51017
elsif (/\G ( \$ $qq_scalar | $qq_substr ) /cgox) { } 1752 49262 51014
elsif (/\G ( [,;] ) /cgox) { } 5097 44165 49262
elsif (/\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /cgmosx) { } 0 44165 44165
elsif (/\G ( \$ 0 ) /cgmosx) { } 2 44163 44165
elsif (/\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /cgmosx) { } 0 44163 44163
elsif (/\G ( \$ \$ ) (?![\w\{]) /cgmosx) { } 1 44162 44163
elsif (/\G \$ ((?>[1-9][0-9]*)) /cgmosx) { } 4 44158 44162
elsif (/\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /cgmosx) { } 0 44158 44158
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /cgmosx) { } 0 44158 44158
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /cgmosx) { } 0 44158 44158
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /cgmosx) { } 0 44158 44158
elsif (/\G \$ (?>\s*) \{ ( (?>\s*) (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* ) (?>\s*) ) \} /cgmosx) { } 0 44158 44158
elsif (/\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /cgmosx) { } 0 44158 44158
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 44116 44158
elsif (m{\G ( \$[\$\@\#\\\'\"/\?\(\)\[\]\<\>] ) }cgmosx) { } 63 44053 44116
elsif (/\G \b (while (?>\s*) \( (?>\s*) <[\$]?[A-Za-z_][A-Za-z_0-9]*> (?>\s*) \)) \b /cgox) { } 0 44053 44053
elsif (/\G \b while (?>\s*) \( (?>\s*) < ((?:[^>\0\a\e\f\n\r\t])+?) > (?>\s*) \) \b /cgox) { } 0 44053 44053
elsif (/\G \b while (?>\s*) \( (?>\s*) glob (?>\s*) \) /cgox) { } 0 44053 44053
elsif (/\G \b while (?>\s*) \( (?>\s*) glob \b /cgox) { } 0 44053 44053
elsif (/\G \b ( if | unless | while | until | for | when ) \b /cgox) { } 251 43802 44053
elsif (/\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /cgox) { } 19 43783 43802
elsif (/\G \b Char::eval (?= (?>\s*) \{ ) /cgox) { } 0 43783 43783
elsif (/\G \b Cyrillic::eval (?= (?>\s*) \{ ) /cgox) { } 22 43761 43783
elsif (/\G \b Char::eval \b (?! (?>\s*) => ) /cgox) { } 0 43761 43761
elsif (/\G \b Cyrillic::eval \b (?! (?>\s*) => ) /cgox) { } 168 43593 43761
elsif (/\G \b bytes::substr \b (?! (?>\s*) => ) /cgox) { } 2 43591 43593
elsif (/\G \b chop \b (?! (?>\s*) => ) /cgox) { } 0 43591 43591
elsif (/\G \b bytes::index \b (?! (?>\s*) => ) /cgox) { } 2 43589 43591
elsif (/\G \b Char::index \b (?! (?>\s*) => ) /cgox) { } 0 43589 43589
elsif (/\G \b Cyrillic::index \b (?! (?>\s*) => ) /cgox) { } 0 43589 43589
elsif (/\G \b index \b (?! (?>\s*) => ) /cgox) { } 0 43589 43589
elsif (/\G \b bytes::rindex \b (?! (?>\s*) => ) /cgox) { } 2 43587 43589
elsif (/\G \b Char::rindex \b (?! (?>\s*) => ) /cgox) { } 0 43587 43587
elsif (/\G \b Cyrillic::rindex \b (?! (?>\s*) => ) /cgox) { } 0 43587 43587
elsif (/\G \b rindex \b (?! (?>\s*) => ) /cgox) { } 0 43587 43587
elsif (/\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 1 43586 43587
elsif (/\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43586 43586
elsif (/\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 1 43585 43586
elsif (/\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43585 43585
elsif (/\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 6 43579 43585
elsif (/\G -s (?>\s*) (\") ((?:$Ecyrillic::qq_char)+?) (\") /cgox) { } 0 43579 43579
elsif (/\G -s (?>\s+) qq (?>\s*) (\#) ((?:$Ecyrillic::qq_char)+?) (\#) /cgox) { } 0 43579 43579
elsif (/\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /cgox) { } 0 43579 43579
elsif (/\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /cgox) { } 0 43579 43579
elsif (/\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /cgox) { } 0 43579 43579
elsif (/\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /cgox) { } 0 43579 43579
elsif (/\G -s (?>\s+) qq (?>\s*) (\S) ((?:$Ecyrillic::qq_char)+?) (\1) /cgox) { } 0 43579 43579
elsif (/\G -s (?>\s*) (\') ((?:\\\'|\\\\|$Ecyrillic::q_char)+?) (\') /cgox) { } 0 43579 43579
elsif (/\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$Ecyrillic::q_char)+?) (\#) /cgox) { } 0 43579 43579
elsif (/\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /cgox) { } 0 43579 43579
elsif (/\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /cgox) { } 0 43579 43579
elsif (/\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /cgox) { } 0 43579 43579
elsif (/\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /cgox) { } 0 43579 43579
elsif (/\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$Ecyrillic::q_char)+?) (\1) /cgox) { } 0 43579 43579
elsif (/\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)* ) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ) )*) /cgox) { } 0 43579 43579
elsif (/\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /cgox) { } 0 43579 43579
elsif (/\G -s (?= (?>\s+) [a-z]+) /cgox) { } 0 43579 43579
elsif (/\G -s (?>\s+) ((?>\w+)) /cgox) { } 0 43579 43579
elsif (/\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43577 43579
elsif (/\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43575 43577
elsif (/\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 36 43539 43575
elsif (/\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43537 43539
elsif (/\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 8 43529 43537
elsif (/\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43529 43529
elsif (/\G \b lc \b (?! (?>\s*) => ) /cgox) { } 0 43529 43529
elsif (/\G \b lcfirst \b (?! (?>\s*) => ) /cgox) { } 0 43529 43529
elsif (/\G \b uc \b (?! (?>\s*) => ) /cgox) { } 0 43529 43529
elsif (/\G \b ucfirst \b (?! (?>\s*) => ) /cgox) { } 0 43529 43529
elsif (/\G \b fc \b (?! (?>\s*) => ) /cgox) { } 0 43529 43529
elsif (/\G -s \b (?! (?>\s*) => ) /cgox) { } 0 43529 43529
elsif (/\G \b bytes::length \b (?! (?>\s*) => ) /cgox) { } 0 43529 43529
elsif (/\G \b bytes::chr \b (?! (?>\s*) => ) /cgox) { } 0 43529 43529
elsif (/\G \b chr \b (?! (?>\s*) => ) /cgox) { } 0 43529 43529
elsif (/\G \b bytes::ord \b (?! (?>\s*) => ) /cgox) { } 0 43529 43529
elsif (/\G \b ord \b (?! (?>\s*) => ) /cgox) { } 0 43529 43529
elsif (/\G \b glob \b (?! (?>\s*) => ) /cgox) { } 0 43529 43529
elsif (/\G \b reverse \b (?! (?>\s*) => ) /cgox) { } 0 43529 43529
elsif (/\G \b getc \b (?! (?>\s*) => ) /cgox) { } 8 43521 43529
elsif (/\G \b (split) \b (?! (?>\s*) => ) /cgox) { } 87 43434 43521
elsif (/\G \b ( tr | y ) \b /cgox) { } 4 43430 43434
elsif (/\G \b (qq) \b /cgox) { } 2252 41178 43430
elsif (/\G \b (qr) \b /cgox) { } 0 41178 41178
elsif (/\G \b (qw) \b /cgox) { } 16 41162 41178
elsif (/\G \b (qx) \b /cgox) { } 0 41162 41162
elsif (/\G \b (q) \b /cgox) { } 473 40689 41162
elsif (/\G \b (m) \b /cgox) { } 209 40480 40689
elsif (/\G \b (s) \b /cgox) { } 101 40379 40480
elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 0 40379 40379
elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 40379 40379
elsif (/\G \b require ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 40379 40379
elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [#\n]) /cgmosx) { } 37 40342 40379
elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 40342 40342
elsif (/\G \b use ((?>\s+) strict) \b /cgmosx) { } 0 40342 40342
elsif (/\G \b use (?>\s+) ((?>([1-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /cgmosx) { } 2 40340 40342
elsif (/\G \b use (?>\s+) ((?>v([0-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /cgmosx) { } 0 40340 40340
elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 2 40338 40340
elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 40338 40338
elsif (/\G \b use ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 40338 40338
elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 0 40338 40338
elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 40338 40338
elsif (/\G \b no ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 40338 40338
elsif (/\G \b use \b /cgmosx) { } 0 40338 40338
elsif (/\G \b no \b /cgmosx) { } 2 40336 40338
elsif (/\G (?<![\w\$\@\%\&\*]) (\') /cgox) { } 1142 39194 40336
elsif (/\G (\") /cgox) { } 1951 37243 39194
elsif (/\G (\`) /cgox) { } 1 37242 37243
elsif ($Ecyrillic::slash eq 'm//' and m[\G (/) ]cgox) { } 681 36561 37242
elsif ($Ecyrillic::slash eq 'm//' and /\G (\?) /cgox) { } 0 36561 36561
elsif (/\G ( <<>> ) /cgox) { } 0 36561 36561
elsif (/\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /cgox) { } 0 36561 36561
elsif (/\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /cgox) { } 6 36555 36561
elsif (/\G ( <<~ \\([a-zA-Z_0-9]+) ) /cgox) { } 3 36552 36555
elsif (/\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /cgox) { } 6 36546 36552
elsif (/\G ( <<~ ([a-zA-Z_0-9]+) ) /cgox) { } 3 36543 36546
elsif (/\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /cgox) { } 6 36537 36543
elsif (/\G ( << '([a-zA-Z_0-9]*)' ) /cgox) { } 72 36465 36537
elsif (/\G ( << \\([a-zA-Z_0-9]+) ) /cgox) { } 0 36465 36465
elsif (/\G ( << "([a-zA-Z_0-9]*)" ) /cgox) { } 36 36429 36465
elsif (/\G ( << ([a-zA-Z_0-9]+) ) /cgox) { } 42 36387 36429
elsif (/\G ( << `([a-zA-Z_0-9]*)` ) /cgox) { } 0 36387 36387
elsif (/\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/cgox) { } 12 36375 36387
elsif (/\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /cgox) { } 0 36375 36375
elsif (/\G < ((?:[^>\0\a\e\f\n\r\t])+?) > /cgox) { } 0 36375 36375
elsif (/\G ^ ( __DATA__ \n .*) \z /cgmosx) { } 0 36375 36375
elsif (/\G ^ ( __END__ \n .*) \z /cgmosx) { } 210 36165 36375
elsif (/\G ( \cD .*) \z /cgmosx) { } 0 36165 36165
elsif (/\G ( \cZ .*) \z /cgmosx) { } 0 36165 36165
elsif (/\G ( -- | \+\+ | [\)\}\]] ) /cgox) { } 5837 30328 36165
elsif (/\G ( \.\.\. ) /cgox) { } 7 30321 30328
elsif (m"\G ((?> !~~ | !~ | != | ! | %= | % | &&= | && | &= | &\.= | &\. | & | -= | -> | - | :(?>\s*)= | : | <<>> | <<= | <=> | <= | < | == | => | =~ | = | >>= | >> | >= | > | \*\*= | \*\* | \*= | \* | \+= | \+ | \.\. | \.= | \. | //= | // | /= | / | \? | \\ | \^= | \^\.= | \^\. | \^ | \b x= | \|\|= | \|\| | \|= | \|\.= | \|\. | \| | ~~ | ~\. | ~ | \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b | \b(?: print )\b | [,;\(\{\[] )) "cgox) { } 9805 20516 30321
elsif (/\G ($Ecyrillic::q_char) /cgox) { } 20516 0 20516
3090 12838 my $heredoc = '';
3091 12838 ▶ if (scalar(@heredoc_delimiter) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @heredoc_delimiter >= 1) 174 12664 12838
3092 174 $slash = 'm//';
3093  
3094 174 $heredoc = join '', @heredoc;
3095 174 @heredoc = ();
3096  
3097 # skip here document
3098 174 for my $heredoc_delimiter (@heredoc_delimiter) {
3099 174 /\G .*? \n $heredoc_delimiter \n/xmsgc;
3100 }
3101 174 @heredoc_delimiter = ();
3102  
3103 174 $here_script = '';
3104 }
3105 12838 return "\n" . $heredoc;
3106 }
3107  
3108 # ignore space, comment
3109 21458 elsif (/\G ((?>\s+)|\#.*) /oxgc) { return $1; }
3110  
3111 # if (, elsif (, unless (, while (, until (, given (, and when (
3112  
3113 # given, when
3114  
3115 # P.225 The given Statement
3116 # in Chapter 15: Smart Matching and given-when
3117 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
3118  
3119 # P.133 The given Statement
3120 # in Chapter 4: Statements and Declarations
3121 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
3122  
3123 elsif (/\G ( (?: if | elsif | unless | while | until | given | when ) (?>\s*) \( ) /oxgc) {
3124 1644 $slash = 'm//';
3125 1644 return $1;
3126 }
3127  
3128 # scalar variable ($scalar = ...) =~ tr///;
3129 # scalar variable ($scalar = ...) =~ s///;
3130  
3131 # state
3132  
3133 # P.68 Persistent, Private Variables
3134 # in Chapter 4: Subroutines
3135 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
3136  
3137 # P.160 Persistent Lexically Scoped Variables: state
3138 # in Chapter 4: Statements and Declarations
3139 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
3140  
3141 # (and so on)
3142  
3143 elsif (/\G ( \( (?>\s*) (?: local \b | my \b | our \b | state \b )? (?>\s*) \$ $qq_scalar ) /oxgc) {
3144 90 my $e_string = e_string($1);
3145  
3146 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
3147 0 $tr_variable = $e_string . e_string($1);
3148 0 $bind_operator = $2;
3149 0 $slash = 'm//';
3150 0 return '';
3151 }
3152 elsif (/\G ( (?>\s*) = $qq_paren \) ) ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /oxgc) {
3153 0 $sub_variable = $e_string . e_string($1);
3154 0 $bind_operator = $2;
3155 0 $slash = 'm//';
3156 0 return '';
3157 }
3158 else {
3159 90 $slash = 'div';
3160 90 return $e_string;
3161 }
3162 }
3163  
3164 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Ecyrillic::PREMATCH()
3165 elsif (/\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /oxmsgc) {
3166 4 $slash = 'div';
3167 4 return q{Ecyrillic::PREMATCH()};
3168 }
3169  
3170 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Ecyrillic::MATCH()
3171 elsif (/\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /oxmsgc) {
3172 28 $slash = 'div';
3173 28 return q{Ecyrillic::MATCH()};
3174 }
3175  
3176 # $', ${'} --> $', ${'}
3177 elsif (/\G ( \$' | \$\{'\} ) /oxmsgc) {
3178 1 $slash = 'div';
3179 1 return $1;
3180 }
3181  
3182 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Ecyrillic::POSTMATCH()
3183 elsif (/\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /oxmsgc) {
3184 3 $slash = 'div';
3185 3 return q{Ecyrillic::POSTMATCH()};
3186 }
3187  
3188 # scalar variable $scalar =~ tr///;
3189 # scalar variable $scalar =~ s///;
3190 # substr() =~ tr///;
3191 # substr() =~ s///;
3192 elsif (/\G ( \$ $qq_scalar | $qq_substr ) /oxgc) {
3193 1752 my $scalar = e_string($1);
3194  
3195 1752 ▶ if (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= (?: tr | y ) \b ) /oxgc) {
Branch: 2 branches
BranchTrueFalseTotal
if (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= (?: tr | y ) \b ) /cgox) { } 2 1750 1752
elsif (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /cgox) { } 65 1685 1750
3196 2 $tr_variable = $scalar;
3197 2 $bind_operator = $1;
3198 2 $slash = 'm//';
3199 2 return '';
3200 }
3201 elsif (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /oxgc) {
3202 65 $sub_variable = $scalar;
3203 65 $bind_operator = $1;
3204 65 $slash = 'm//';
3205 65 return '';
3206 }
3207 else {
3208 1685 $slash = 'div';
3209 1685 return $scalar;
3210 }
3211 }
3212  
3213 # end of statement
3214 elsif (/\G ( [,;] ) /oxgc) {
3215 5097 $slash = 'm//';
3216  
3217 # clear tr/// variable
3218 5097 $tr_variable = '';
3219  
3220 # clear s/// variable
3221 5097 $sub_variable = '';
3222  
3223 5097 $bind_operator = '';
3224  
3225 5097 return $1;
3226 }
3227  
3228 # bareword
3229 elsif (/\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /oxmsgc) {
3230 0 return $1;
3231 }
3232  
3233 # $0 --> $0
3234 elsif (/\G ( \$ 0 ) /oxmsgc) {
3235 2 $slash = 'div';
3236 2 return $1;
3237 }
3238 elsif (/\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /oxmsgc) {
3239 0 $slash = 'div';
3240 0 return $1;
3241 }
3242  
3243 # $$ --> $$
3244 elsif (/\G ( \$ \$ ) (?![\w\{]) /oxmsgc) {
3245 1 $slash = 'div';
3246 1 return $1;
3247 }
3248  
3249 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
3250 # $1, $2, $3 --> $1, $2, $3 otherwise
3251 elsif (/\G \$ ((?>[1-9][0-9]*)) /oxmsgc) {
3252 4 $slash = 'div';
3253 4 return e_capture($1);
3254 }
3255 elsif (/\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /oxmsgc) {
3256 0 $slash = 'div';
3257 0 return e_capture($1);
3258 }
3259  
3260 # $$foo[ ... ] --> $ $foo->[ ... ]
3261 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /oxmsgc) {
3262 0 $slash = 'div';
3263 0 return e_capture($1.'->'.$2);
3264 }
3265  
3266 # $$foo{ ... } --> $ $foo->{ ... }
3267 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /oxmsgc) {
3268 0 $slash = 'div';
3269 0 return e_capture($1.'->'.$2);
3270 }
3271  
3272 # $$foo
3273 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /oxmsgc) {
3274 0 $slash = 'div';
3275 0 return e_capture($1);
3276 }
3277  
3278 # ${ foo }
3279 elsif (/\G \$ (?>\s*) \{ ( (?>\s*) (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* ) (?>\s*) ) \} /oxmsgc) {
3280 0 $slash = 'div';
3281 0 return '${' . $1 . '}';
3282 }
3283  
3284 # ${ ... }
3285 elsif (/\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /oxmsgc) {
3286 0 $slash = 'div';
3287 0 return e_capture($1);
3288 }
3289  
3290 # variable or function
3291 # $ @ % & * $ #
3292 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) {
3293 42 $slash = 'div';
3294 42 return $1;
3295 }
3296 # $ $ $ $ $ $ $ $ $ $ $ $ $ $
3297 # $ @ # \ ' " / ? ( ) [ ] < >
3298 elsif (/\G ( \$[\$\@\#\\\'\"\/\?\(\)\[\]\<\>] ) /oxmsgc) {
3299 63 $slash = 'div';
3300 63 return $1;
3301 }
3302  
3303 # while (<FILEHANDLE>)
3304 elsif (/\G \b (while (?>\s*) \( (?>\s*) <[\$]?[A-Za-z_][A-Za-z_0-9]*> (?>\s*) \)) \b /oxgc) {
3305 0 return $1;
3306 }
3307  
3308 # while (<WILDCARD>) --- glob
3309  
3310 # avoid "Error: Runtime exception" of perl version 5.005_03
3311  
3312 elsif (/\G \b while (?>\s*) \( (?>\s*) < ((?:[^>\0\a\e\f\n\r\t])+?) > (?>\s*) \) \b /oxgc) {
3313 0 return 'while ($_ = Ecyrillic::glob("' . $1 . '"))';
3314 }
3315  
3316 # while (glob)
3317 elsif (/\G \b while (?>\s*) \( (?>\s*) glob (?>\s*) \) /oxgc) {
3318 0 return 'while ($_ = Ecyrillic::glob_)';
3319 }
3320  
3321 # while (glob(WILDCARD))
3322 elsif (/\G \b while (?>\s*) \( (?>\s*) glob \b /oxgc) {
3323 0 return 'while ($_ = Ecyrillic::glob';
3324 }
3325  
3326 # doit if, doit unless, doit while, doit until, doit for, doit when
3327 251 elsif (/\G \b ( if | unless | while | until | for | when ) \b /oxgc) { $slash = 'm//'; return $1; }
3328  
3329 # subroutines of package Ecyrillic
3330 19 elsif (/\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /oxgc) { $slash = 'm//'; return $1; }
3331 0 elsif (/\G \b Char::eval (?= (?>\s*) \{ ) /oxgc) { $slash = 'm//'; return 'eval'; }
3332 22 elsif (/\G \b Cyrillic::eval (?= (?>\s*) \{ ) /oxgc) { $slash = 'm//'; return 'eval'; }
3333 0 elsif (/\G \b Char::eval \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'eval Char::escape'; }
3334 168 elsif (/\G \b Cyrillic::eval \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'eval Cyrillic::escape'; }
3335 2 elsif (/\G \b bytes::substr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'substr'; }
3336 0 elsif (/\G \b chop \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ecyrillic::chop'; }
3337 2 elsif (/\G \b bytes::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'index'; }
3338 0 elsif (/\G \b Char::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Char::index'; }
3339 0 elsif (/\G \b Cyrillic::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Cyrillic::index'; }
3340 0 elsif (/\G \b index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ecyrillic::index'; }
3341 2 elsif (/\G \b bytes::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'rindex'; }
3342 0 elsif (/\G \b Char::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Char::rindex'; }
3343 0 elsif (/\G \b Cyrillic::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Cyrillic::rindex'; }
3344 0 elsif (/\G \b rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ecyrillic::rindex'; }
3345 1 elsif (/\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Ecyrillic::lc'; }
3346 0 elsif (/\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Ecyrillic::lcfirst'; }
3347 1 elsif (/\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Ecyrillic::uc'; }
3348 0 elsif (/\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Ecyrillic::ucfirst'; }
3349 6 elsif (/\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Ecyrillic::fc'; }
3350  
3351 # "-s '' ..." means file test "-s 'filename' ..." (not means "- s/// ...")
3352 0 elsif (/\G -s (?>\s*) (\") ((?:$qq_char)+?) (\") /oxgc) { $slash = 'm//'; return '-s ' . e_qq('', $1,$3,$2); }
3353 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\#) ((?:$qq_char)+?) (\#) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3354 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3355 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3356 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3357 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3358 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\S) ((?:$qq_char)+?) (\1) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3359  
3360 0 elsif (/\G -s (?>\s*) (\') ((?:\\\'|\\\\|$q_char)+?) (\') /oxgc) { $slash = 'm//'; return '-s ' . e_q ('', $1,$3,$2); }
3361 0 elsif (/\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$q_char)+?) (\#) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3362 0 elsif (/\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3363 0 elsif (/\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3364 0 elsif (/\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3365 0 elsif (/\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3366 0 elsif (/\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$q_char)+?) (\1) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3367  
3368 elsif (/\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)* ) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ) )*) /oxgc)
3369 0 { $slash = 'm//'; return "-s $1"; }
3370 0 elsif (/\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /oxgc) { $slash = 'm//'; return "-s ($1)"; }
3371 0 elsif (/\G -s (?= (?>\s+) [a-z]+) /oxgc) { $slash = 'm//'; return '-s'; }
3372 0 elsif (/\G -s (?>\s+) ((?>\w+)) /oxgc) { $slash = 'm//'; return "-s $1"; }
3373  
3374 2 elsif (/\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'length'; }
3375 2 elsif (/\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'chr'; }
3376 36 elsif (/\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Ecyrillic::chr'; }
3377 2 elsif (/\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'div'; return 'ord'; }
3378 8 elsif (/\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'div'; return $function_ord; }
3379 0 elsif (/\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Ecyrillic::glob'; }
3380 0 elsif (/\G \b lc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ecyrillic::lc_'; }
3381 0 elsif (/\G \b lcfirst \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ecyrillic::lcfirst_'; }
3382 0 elsif (/\G \b uc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ecyrillic::uc_'; }
3383 0 elsif (/\G \b ucfirst \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ecyrillic::ucfirst_'; }
3384 0 elsif (/\G \b fc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ecyrillic::fc_'; }
3385 0 elsif (/\G -s \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return '-s '; }
3386  
3387 0 elsif (/\G \b bytes::length \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'length'; }
3388 0 elsif (/\G \b bytes::chr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'chr'; }
3389 0 elsif (/\G \b chr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ecyrillic::chr_'; }
3390 0 elsif (/\G \b bytes::ord \b (?! (?>\s*) => ) /oxgc) { $slash = 'div'; return 'ord'; }
3391 0 elsif (/\G \b ord \b (?! (?>\s*) => ) /oxgc) { $slash = 'div'; return $function_ord_; }
3392 0 elsif (/\G \b glob \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Ecyrillic::glob_'; }
3393 0 elsif (/\G \b reverse \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return $function_reverse; }
3394 8 elsif (/\G \b getc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return $function_getc; }
3395 # split
3396 elsif (/\G \b (split) \b (?! (?>\s*) => ) /oxgc) {
3397 87 $slash = 'm//';
3398  
3399 87 my $e = '';
3400 87 ▶ while (/\G ( (?>\s+) | \( | \#.* ) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\G ( (?>\s+) | \( | \#.* ) /cgox) 85 87 172
3401 85 $e .= $1;
3402 }
3403  
3404 # end of split
3405 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
3406  
3407 # split scalar value
3408 1 elsif (/\G ( [\$\@\&\*] $qq_scalar ) /oxgc) { return 'Ecyrillic::split' . $e . e_string($1); }
3409  
3410 # split literal space
3411 0 elsif (/\G \b qq (\#) [ ] (\#) /oxgc) { return 'Ecyrillic::split' . $e . qq {qq$1 $2}; }
3412 0 elsif (/\G \b qq ((?>\s*)) (\() [ ] (\)) /oxgc) { return 'Ecyrillic::split' . $e . qq{$1qq$2 $3}; }
3413 0 elsif (/\G \b qq ((?>\s*)) (\{) [ ] (\}) /oxgc) { return 'Ecyrillic::split' . $e . qq{$1qq$2 $3}; }
3414 0 elsif (/\G \b qq ((?>\s*)) (\[) [ ] (\]) /oxgc) { return 'Ecyrillic::split' . $e . qq{$1qq$2 $3}; }
3415 0 elsif (/\G \b qq ((?>\s*)) (\<) [ ] (\>) /oxgc) { return 'Ecyrillic::split' . $e . qq{$1qq$2 $3}; }
3416 0 elsif (/\G \b qq ((?>\s*)) (\S) [ ] (\2) /oxgc) { return 'Ecyrillic::split' . $e . qq{$1qq$2 $3}; }
3417 0 elsif (/\G \b q (\#) [ ] (\#) /oxgc) { return 'Ecyrillic::split' . $e . qq {q$1 $2}; }
3418 0 elsif (/\G \b q ((?>\s*)) (\() [ ] (\)) /oxgc) { return 'Ecyrillic::split' . $e . qq {$1q$2 $3}; }
3419 0 elsif (/\G \b q ((?>\s*)) (\{) [ ] (\}) /oxgc) { return 'Ecyrillic::split' . $e . qq {$1q$2 $3}; }
3420 0 elsif (/\G \b q ((?>\s*)) (\[) [ ] (\]) /oxgc) { return 'Ecyrillic::split' . $e . qq {$1q$2 $3}; }
3421 0 elsif (/\G \b q ((?>\s*)) (\<) [ ] (\>) /oxgc) { return 'Ecyrillic::split' . $e . qq {$1q$2 $3}; }
3422 0 elsif (/\G \b q ((?>\s*)) (\S) [ ] (\2) /oxgc) { return 'Ecyrillic::split' . $e . qq {$1q$2 $3}; }
3423 10 elsif (/\G ' [ ] ' /oxgc) { return 'Ecyrillic::split' . $e . qq {' '}; }
3424 0 elsif (/\G " [ ] " /oxgc) { return 'Ecyrillic::split' . $e . qq {" "}; }
3425  
3426 # split qq//
3427 elsif (/\G \b (qq) \b /oxgc) {
3428 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
3429 else {
3430 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3431 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
3432 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq ( ) --> qr ( )
3433 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq { } --> qr { }
3434 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq [ ] --> qr [ ]
3435 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq < > --> qr < >
3436 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) /oxgc) { return e_split($e.'qr','{','}',$2,''); } # qq | | --> qr { }
3437 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq * * --> qr * *
3438 }
3439 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3440 }
3441 }
3442  
3443 # split qr//
3444 elsif (/\G \b (qr) \b /oxgc) {
3445 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
3446 else {
3447 12 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 12 0 12
3448 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
3449 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr ( )
3450 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr { }
3451 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr [ ]
3452 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr < >
3453 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { return e_split_q($e.'qr',$1, $3, $2,$4); } # qr ' '
3454 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr','{','}',$2,$4); } # qr | | --> qr { }
3455 12 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr * *
3456 }
3457 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3458 }
3459 }
3460  
3461 # split q//
3462 elsif (/\G \b (q) \b /oxgc) {
3463 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
3464 else {
3465 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3466 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
3467 0 elsif (/\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q ( ) --> qr ( )
3468 0 elsif (/\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q { } --> qr { }
3469 0 elsif (/\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q [ ] --> qr [ ]
3470 0 elsif (/\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q < > --> qr < >
3471 0 elsif (/\G ([*\-:?\\^|]) ((?:$q_char)*?) (\1) /oxgc) { return e_split_q($e.'qr','{','}',$2,''); } # q | | --> qr { }
3472 0 elsif (/\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q * * --> qr * *
3473 }
3474 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3475 }
3476 }
3477  
3478 # split m//
3479 elsif (/\G \b (m) \b /oxgc) {
3480 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
3481 else {
3482 18 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 18 0 18
3483 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
3484 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m ( ) --> qr ( )
3485 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m { } --> qr { }
3486 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m [ ] --> qr [ ]
3487 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m < > --> qr < >
3488 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { return e_split_q($e.'qr',$1, $3, $2,$4); } # m ' ' --> qr ' '
3489 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr','{','}',$2,$4); } # m | | --> qr { }
3490 18 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m * * --> qr * *
3491 }
3492 0 die __FILE__, ": Search pattern not terminated\n";
3493 }
3494 }
3495  
3496 # split ''
3497 elsif (/\G (\') /oxgc) {
3498 0 my $q_string = '';
3499 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3500 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
3501 0 elsif (/\G (\\\') /oxgc) { $q_string .= $1; } # splitqr'' --> split qr''
3502 0 elsif (/\G \' /oxgc) { return e_split_q($e.q{ qr},"'","'",$q_string,''); } # ' ' --> qr ' '
3503 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3504 }
3505 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3506 }
3507  
3508 # split ""
3509 elsif (/\G (\") /oxgc) {
3510 0 my $qq_string = '';
3511 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3512 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
3513 0 elsif (/\G (\\\") /oxgc) { $qq_string .= $1; } # splitqr"" --> split qr""
3514 0 elsif (/\G \" /oxgc) { return e_split($e.q{ qr},'"','"',$qq_string,''); } # " " --> qr " "
3515 0 elsif (/\G ($q_char) /oxgc) { $qq_string .= $1; }
3516 }
3517 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3518 }
3519  
3520 # split //
3521 elsif (/\G (\/) /oxgc) {
3522 44 my $regexp = '';
3523 44 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 381 0 381
3524 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
3525 0 elsif (/\G (\\\/) /oxgc) { $regexp .= $1; } # splitqr// --> split qr//
3526 44 elsif (/\G \/ ([cgimosxpadlunbB]*) /oxgc) { return e_split($e.q{ qr}, '/','/',$regexp,$1); } # / / --> qr / /
3527 337 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
3528 }
3529 0 die __FILE__, ": Search pattern not terminated\n";
3530 }
3531 }
3532  
3533 # tr/// or y///
3534  
3535 # about [cdsrbB]* (/B modifier)
3536 #
3537 # P.559 appendix C
3538 # of ISBN 4-89052-384-7 Programming perl
3539 # (Japanese title is: Perl puroguramingu)
3540  
3541 elsif (/\G \b ( tr | y ) \b /oxgc) {
3542 4 my $ope = $1;
3543  
3544 # $1 $2 $3 $4 $5 $6
3545 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
3546 0 my @tr = ($tr_variable,$2);
3547 0 return e_tr(@tr,'',$4,$6);
3548 }
3549 else {
3550 4 my $e = '';
3551 4 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 4 0 4
3552 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
3553 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) {
3554 0 my @tr = ($tr_variable,$2);
3555 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3556 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
3557 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) ( )
3558 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) { }
3559 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) [ ]
3560 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) < >
3561 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) * *
3562 }
3563 0 die __FILE__, ": Transliteration replacement not terminated\n";
3564 }
3565 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) {
3566 0 my @tr = ($tr_variable,$2);
3567 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3568 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
3569 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } ( )
3570 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } { }
3571 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } [ ]
3572 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } < >
3573 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } * *
3574 }
3575 0 die __FILE__, ": Transliteration replacement not terminated\n";
3576 }
3577 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) {
3578 0 my @tr = ($tr_variable,$2);
3579 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3580 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
3581 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] ( )
3582 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] { }
3583 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] [ ]
3584 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] < >
3585 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] * *
3586 }
3587 0 die __FILE__, ": Transliteration replacement not terminated\n";
3588 }
3589 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) {
3590 0 my @tr = ($tr_variable,$2);
3591 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3592 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
3593 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > ( )
3594 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > { }
3595 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > [ ]
3596 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > < >
3597 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > * *
3598 }
3599 0 die __FILE__, ": Transliteration replacement not terminated\n";
3600 }
3601 # $1 $2 $3 $4 $5 $6
3602 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { # tr * * *
3603 4 my @tr = ($tr_variable,$2);
3604 4 return e_tr(@tr,'',$4,$6);
3605 }
3606 }
3607 0 die __FILE__, ": Transliteration pattern not terminated\n";
3608 }
3609 }
3610  
3611 # qq//
3612 elsif (/\G \b (qq) \b /oxgc) {
3613 2252 my $ope = $1;
3614  
3615 # if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { return e_qq($ope,$1,$3,$2); } # qq# #
3616 2252 ▶ if (/\G (\#) /oxgc) { # qq# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) /cgox) { } 0 2252 2252
3617 0 my $qq_string = '';
3618 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3619 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
3620 0 elsif (/\G (\\\#) /oxgc) { $qq_string .= $1; }
3621 0 elsif (/\G (\#) /oxgc) { return e_qq($ope,'#','#',$qq_string); }
3622 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3623 }
3624 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3625 }
3626  
3627 else {
3628 2252 my $e = '';
3629 2252 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 2252 0 2252
3630 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
3631  
3632 # elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq ( )
3633 elsif (/\G (\() /oxgc) { # qq ( )
3634 0 my $qq_string = '';
3635 0 local $nest = 1;
3636 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3637 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
3638 0 elsif (/\G (\\\)) /oxgc) { $qq_string .= $1; }
3639 0 elsif (/\G (\() /oxgc) { $qq_string .= $1; $nest++; }
3640 elsif (/\G (\)) /oxgc) {
3641 0 ▶ if (--$nest == 0) { return $e . e_qq($ope,'(',')',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ecyrillic::nest == 0) { } 0 0 0
3642 0 else { $qq_string .= $1; }
3643 }
3644 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3645 }
3646 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3647 }
3648  
3649 # elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq { }
3650 elsif (/\G (\{) /oxgc) { # qq { }
3651 2222 my $qq_string = '';
3652 2222 local $nest = 1;
3653 2222 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 85130 0 85130
3654 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
3655 0 elsif (/\G (\\\}) /oxgc) { $qq_string .= $1; }
3656 1189 elsif (/\G (\{) /oxgc) { $qq_string .= $1; $nest++; }
3657 elsif (/\G (\}) /oxgc) {
3658 3411 ▶ if (--$nest == 0) { return $e . e_qq($ope,'{','}',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ecyrillic::nest == 0) { } 2222 1189 3411
3659 1189 else { $qq_string .= $1; }
3660 }
3661 79808 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3662 }
3663 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3664 }
3665  
3666 # elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq [ ]
3667 elsif (/\G (\[) /oxgc) { # qq [ ]
3668 0 my $qq_string = '';
3669 0 local $nest = 1;
3670 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3671 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
3672 0 elsif (/\G (\\\]) /oxgc) { $qq_string .= $1; }
3673 0 elsif (/\G (\[) /oxgc) { $qq_string .= $1; $nest++; }
3674 elsif (/\G (\]) /oxgc) {
3675 0 ▶ if (--$nest == 0) { return $e . e_qq($ope,'[',']',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ecyrillic::nest == 0) { } 0 0 0
3676 0 else { $qq_string .= $1; }
3677 }
3678 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3679 }
3680 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3681 }
3682  
3683 # elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq < >
3684 elsif (/\G (\<) /oxgc) { # qq < >
3685 30 my $qq_string = '';
3686 30 local $nest = 1;
3687 30 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 1166 0 1166
3688 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
3689 0 elsif (/\G (\\\>) /oxgc) { $qq_string .= $1; }
3690 0 elsif (/\G (\<) /oxgc) { $qq_string .= $1; $nest++; }
3691 elsif (/\G (\>) /oxgc) {
3692 30 ▶ if (--$nest == 0) { return $e . e_qq($ope,'<','>',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ecyrillic::nest == 0) { } 30 0 30
3693 0 else { $qq_string .= $1; }
3694 }
3695 1114 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3696 }
3697 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3698 }
3699  
3700 # elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq * *
3701 elsif (/\G (\S) /oxgc) { # qq * *
3702 0 my $delimiter = $1;
3703 0 my $qq_string = '';
3704 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3705 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
3706 0 elsif (/\G (\\\Q$delimiter\E) /oxgc) { $qq_string .= $1; }
3707 0 elsif (/\G (\Q$delimiter\E) /oxgc) { return $e . e_qq($ope,$delimiter,$delimiter,$qq_string); }
3708 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3709 }
3710 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3711 }
3712 }
3713 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3714 }
3715 }
3716  
3717 # qr//
3718 elsif (/\G \b (qr) \b /oxgc) {
3719 0 my $ope = $1;
3720 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { # qr# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Ecyrillic::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 0 0
3721 0 return e_qr($ope,$1,$3,$2,$4);
3722 }
3723 else {
3724 0 my $e = '';
3725 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3726 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
3727 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr ( )
3728 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr { }
3729 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr [ ]
3730 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr < >
3731 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { return $e . e_qr_q($ope,$1, $3, $2,$4); } # qr ' '
3732 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,'{','}',$2,$4); } # qr | | --> qr { }
3733 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr * *
3734 }
3735 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3736 }
3737 }
3738  
3739 # qw//
3740 elsif (/\G \b (qw) \b /oxgc) {
3741 16 my $ope = $1;
3742 16 ▶ if (/\G (\#) (.*?) (\#) /oxmsgc) { # qw# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) (.*?) (\#) /cgmosx) { } 0 16 16
3743 0 return e_qw($ope,$1,$3,$2);
3744 }
3745 else {
3746 16 my $e = '';
3747 16 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 16 0 16
3748 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
3749  
3750 16 elsif (/\G (\() ([^(]*?) (\)) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw ( )
3751 0 elsif (/\G (\() ((?:$q_paren)*?) (\)) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw ( )
3752  
3753 0 elsif (/\G (\{) ([^{]*?) (\}) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw { }
3754 0 elsif (/\G (\{) ((?:$q_brace)*?) (\}) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw { }
3755  
3756 0 elsif (/\G (\[) ([^[]*?) (\]) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw [ ]
3757 0 elsif (/\G (\[) ((?:$q_bracket)*?) (\]) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw [ ]
3758  
3759 0 elsif (/\G (\<) ([^<]*?) (\>) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw < >
3760 0 elsif (/\G (\<) ((?:$q_angle)*?) (\>) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw < >
3761  
3762 0 elsif (/\G ([\x21-\x3F]) (.*?) (\1) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw * *
3763 0 elsif (/\G (\S) ((?:$q_char)*?) (\1) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw * *
3764 }
3765 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3766 }
3767 }
3768  
3769 # qx//
3770 elsif (/\G \b (qx) \b /oxgc) {
3771 0 my $ope = $1;
3772 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qx# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Ecyrillic::qq_char)*?) (\#) /cgox) { } 0 0 0
3773 0 return e_qq($ope,$1,$3,$2);
3774 }
3775 else {
3776 0 my $e = '';
3777 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3778 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
3779 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx ( )
3780 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx { }
3781 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx [ ]
3782 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx < >
3783 0 elsif (/\G (\') ((?:$qq_char)*?) (\') /oxgc) { return $e . e_q ($ope,$1,$3,$2); } # qx ' '
3784 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx * *
3785 }
3786 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3787 }
3788 }
3789  
3790 # q//
3791 elsif (/\G \b (q) \b /oxgc) {
3792 473 my $ope = $1;
3793  
3794 # if (/\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { return e_q($ope,$1,$3,$2); } # q# #
3795  
3796 # avoid "Error: Runtime exception" of perl version 5.005_03
3797 # (and so on)
3798  
3799 473 ▶ if (/\G (\#) /oxgc) { # q# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) /cgox) { } 0 473 473
3800 0 my $q_string = '';
3801 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3802 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
3803 0 elsif (/\G (\\\#) /oxgc) { $q_string .= $1; }
3804 0 elsif (/\G (\#) /oxgc) { return e_q($ope,'#','#',$q_string); }
3805 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3806 }
3807 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3808 }
3809  
3810 else {
3811 473 my $e = '';
3812 473 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 473 0 473
3813 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
3814  
3815 # elsif (/\G (\() ((?:\\\)|\\\\|$q_paren)*?) (\)) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q ( )
3816 elsif (/\G (\() /oxgc) { # q ( )
3817 0 my $q_string = '';
3818 0 local $nest = 1;
3819 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3820 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
3821 0 elsif (/\G (\\\)) /oxgc) { $q_string .= $1; }
3822 0 elsif (/\G (\\\() /oxgc) { $q_string .= $1; }
3823 0 elsif (/\G (\() /oxgc) { $q_string .= $1; $nest++; }
3824 elsif (/\G (\)) /oxgc) {
3825 0 ▶ if (--$nest == 0) { return $e . e_q($ope,'(',')',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ecyrillic::nest == 0) { } 0 0 0
3826 0 else { $q_string .= $1; }
3827 }
3828 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3829 }
3830 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3831 }
3832  
3833 # elsif (/\G (\{) ((?:\\\}|\\\\|$q_brace)*?) (\}) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q { }
3834 elsif (/\G (\{) /oxgc) { # q { }
3835 467 my $q_string = '';
3836 467 local $nest = 1;
3837 467 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 8275 0 8275
3838 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
3839 0 elsif (/\G (\\\}) /oxgc) { $q_string .= $1; }
3840 0 elsif (/\G (\\\{) /oxgc) { $q_string .= $1; }
3841 159 elsif (/\G (\{) /oxgc) { $q_string .= $1; $nest++; }
3842 elsif (/\G (\}) /oxgc) {
3843 626 ▶ if (--$nest == 0) { return $e . e_q($ope,'{','}',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ecyrillic::nest == 0) { } 467 159 626
3844 159 else { $q_string .= $1; }
3845 }
3846 7490 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3847 }
3848 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3849 }
3850  
3851 # elsif (/\G (\[) ((?:\\\]|\\\\|$q_bracket)*?) (\]) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q [ ]
3852 elsif (/\G (\[) /oxgc) { # q [ ]
3853 0 my $q_string = '';
3854 0 local $nest = 1;
3855 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3856 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
3857 0 elsif (/\G (\\\]) /oxgc) { $q_string .= $1; }
3858 0 elsif (/\G (\\\[) /oxgc) { $q_string .= $1; }
3859 0 elsif (/\G (\[) /oxgc) { $q_string .= $1; $nest++; }
3860 elsif (/\G (\]) /oxgc) {
3861 0 ▶ if (--$nest == 0) { return $e . e_q($ope,'[',']',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ecyrillic::nest == 0) { } 0 0 0
3862 0 else { $q_string .= $1; }
3863 }
3864 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3865 }
3866 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3867 }
3868  
3869 # elsif (/\G (\<) ((?:\\\>|\\\\|$q_angle)*?) (\>) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q < >
3870 elsif (/\G (\<) /oxgc) { # q < >
3871 5 my $q_string = '';
3872 5 local $nest = 1;
3873 5 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 88 0 88
3874 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
3875 0 elsif (/\G (\\\>) /oxgc) { $q_string .= $1; }
3876 0 elsif (/\G (\\\<) /oxgc) { $q_string .= $1; }
3877 0 elsif (/\G (\<) /oxgc) { $q_string .= $1; $nest++; }
3878 elsif (/\G (\>) /oxgc) {
3879 5 ▶ if (--$nest == 0) { return $e . e_q($ope,'<','>',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Ecyrillic::nest == 0) { } 5 0 5
3880 0 else { $q_string .= $1; }
3881 }
3882 83 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3883 }
3884 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3885 }
3886  
3887 # elsif (/\G (\S) ((?:\\\1|\\\\|$q_char)*?) (\1) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q * *
3888 elsif (/\G (\S) /oxgc) { # q * *
3889 1 my $delimiter = $1;
3890 1 my $q_string = '';
3891 1 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 14 0 14
3892 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
3893 0 elsif (/\G (\\\Q$delimiter\E) /oxgc) { $q_string .= $1; }
3894 1 elsif (/\G (\Q$delimiter\E) /oxgc) { return $e . e_q($ope,$delimiter,$delimiter,$q_string); }
3895 13 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3896 }
3897 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3898 }
3899 }
3900 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3901 }
3902 }
3903  
3904 # m//
3905 elsif (/\G \b (m) \b /oxgc) {
3906 209 my $ope = $1;
3907 209 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { # m# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Ecyrillic::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
3908 0 return e_qr($ope,$1,$3,$2,$4);
3909 }
3910 else {
3911 209 my $e = '';
3912 209 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 209 0 209
3913 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
3914 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m ( )
3915 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m { }
3916 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m [ ]
3917 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m < >
3918 0 elsif (/\G (\?) ((?:$qq_char)*?) (\?) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m ? ?
3919 10 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr_q($ope,$1, $3, $2,$4); } # m ' '
3920 0 elsif (/\G ([*\-:\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,'{','}',$2,$4); } # m | | --> m { }
3921 199 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m * *
3922 }
3923 0 die __FILE__, ": Search pattern not terminated\n";
3924 }
3925 }
3926  
3927 # s///
3928  
3929 # about [cegimosxpradlunbB]* (/cg modifier)
3930 #
3931 # P.67 Pattern-Matching Operators
3932 # of ISBN 0-596-00241-6 Perl in a Nutshell, Second Edition.
3933  
3934 elsif (/\G \b (s) \b /oxgc) {
3935 101 my $ope = $1;
3936  
3937 # $1 $2 $3 $4 $5 $6
3938 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
3939 1 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3940 }
3941 else {
3942 100 my $e = '';
3943 100 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 100 0 100
3944 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
3945 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) {
3946 0 my @s = ($1,$2,$3);
3947 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3948 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
3949 # $1 $2 $3 $4
3950 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3951 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3952 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3953 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3954 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3955 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3956 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3957 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3958 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3959 }
3960 0 die __FILE__, ": Substitution replacement not terminated\n";
3961 }
3962 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) {
3963 0 my @s = ($1,$2,$3);
3964 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3965 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
3966 # $1 $2 $3 $4
3967 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3968 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3969 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3970 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3971 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3972 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3973 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3974 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3975 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3976 }
3977 0 die __FILE__, ": Substitution replacement not terminated\n";
3978 }
3979 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) {
3980 0 my @s = ($1,$2,$3);
3981 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3982 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
3983 # $1 $2 $3 $4
3984 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3985 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3986 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3987 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3988 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3989 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3990 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3991 }
3992 0 die __FILE__, ": Substitution replacement not terminated\n";
3993 }
3994 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) {
3995 0 my @s = ($1,$2,$3);
3996 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3997 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
3998 # $1 $2 $3 $4
3999 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4000 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4001 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4002 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4003 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4004 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4005 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4006 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4007 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4008 }
4009 0 die __FILE__, ": Substitution replacement not terminated\n";
4010 }
4011 # $1 $2 $3 $4 $5 $6
4012 elsif (/\G (\') ((?:$qq_char)*?) (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) {
4013 21 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
4014 }
4015 # $1 $2 $3 $4 $5 $6
4016 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
4017 0 return e_sub($sub_variable,'{',$2,'}','{',$4,'}',$6); # s | | | --> s { } { }
4018 }
4019 # $1 $2 $3 $4 $5 $6
4020 elsif (/\G (\$) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
4021 0 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
4022 }
4023 # $1 $2 $3 $4 $5 $6
4024 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
4025 79 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
4026 }
4027 }
4028 0 die __FILE__, ": Substitution pattern not terminated\n";
4029 }
4030 }
4031  
4032 # require ignore module
4033 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# require$1$2"; }
4034 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# require$1\n$2"; }
4035 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# require$1"; }
4036  
4037 # use strict; --> use strict; no strict qw(refs);
4038 37 elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "use$1 no strict qw(refs);$2"; }
4039 0 elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [^#]) /oxmsgc) { return "use$1 no strict qw(refs);\n$2"; }
4040 0 elsif (/\G \b use ((?>\s+) strict) \b /oxmsgc) { return "use$1; no strict qw(refs)"; }
4041  
4042 # use 5.12.0; --> use 5.12.0; no strict qw(refs);
4043 elsif (/\G \b use (?>\s+) ((?>([1-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /oxmsgc) {
4044 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
4045 0 return "use $1; no strict qw(refs);";
4046 }
4047 else {
4048 2 return "use $1;";
4049 }
4050 }
4051 elsif (/\G \b use (?>\s+) ((?>v([0-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /oxmsgc) {
4052 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
4053 0 return "use $1; no strict qw(refs);";
4054 }
4055 else {
4056 0 return "use $1;";
4057 }
4058 }
4059  
4060 # ignore use module
4061 2 elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# use$1$2"; }
4062 0 elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# use$1\n$2"; }
4063 0 elsif (/\G \b use ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# use$1"; }
4064  
4065 # ignore no module
4066 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# no$1$2"; }
4067 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# no$1\n$2"; }
4068 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# no$1"; }
4069  
4070 # use else
4071 0 elsif (/\G \b use \b /oxmsgc) { return "use"; }
4072  
4073 # use else
4074 2 elsif (/\G \b no \b /oxmsgc) { return "no"; }
4075  
4076 # ''
4077 elsif (/\G (?<![\w\$\@\%\&\*]) (\') /oxgc) {
4078 1142 my $q_string = '';
4079 1142 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 10201 0 10201
4080 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
4081 48 elsif (/\G (\\\') /oxgc) { $q_string .= $1; }
4082 1142 elsif (/\G \' /oxgc) { return e_q('', "'","'",$q_string); }
4083 9007 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
4084 }
4085 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4086 }
4087  
4088 # ""
4089 elsif (/\G (\") /oxgc) {
4090 1951 my $qq_string = '';
4091 1951 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 37631 0 37631
4092 37631 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 67 37564 37631
elsif (/\G (\\\") /cgox) { } 12 37552 37564
elsif (/\G \" /cgox) { } 1951 35601 37552
elsif (/\G ($Ecyrillic::q_char) /cgox) { } 35601 0 35601
4093 12 elsif (/\G (\\\") /oxgc) { $qq_string .= $1; }
4094 1951 elsif (/\G \" /oxgc) { return e_qq('', '"','"',$qq_string); }
4095 35601 elsif (/\G ($q_char) /oxgc) { $qq_string .= $1; }
4096 }
4097 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4098 }
4099  
4100 # ``
4101 elsif (/\G (\`) /oxgc) {
4102 1 my $qx_string = '';
4103 1 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 19 0 19
4104 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
4105 0 elsif (/\G (\\\`) /oxgc) { $qx_string .= $1; }
4106 1 elsif (/\G \` /oxgc) { return e_qq('', '`','`',$qx_string); }
4107 18 elsif (/\G ($q_char) /oxgc) { $qx_string .= $1; }
4108 }
4109 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4110 }
4111  
4112 # // --- not divide operator (num / num), not defined-or
4113 ▶ elsif (($slash eq 'm//') and /\G (\/) /oxgc) {
Condition100%3/3
$Ecyrillic::slash eq "m//" and m[\G (/) ]cgox
!ll&&!rl&&r
277258836681
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
4114 681 my $regexp = '';
4115 681 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 5636 0 5636
4116 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
4117 0 elsif (/\G (\\\/) /oxgc) { $regexp .= $1; }
4118 681 elsif (/\G \/ ([cgimosxpadlunbB]*) /oxgc) { return e_qr('', '/','/',$regexp,$1); }
4119 4955 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
4120 }
4121 0 die __FILE__, ": Search pattern not terminated\n";
4122 }
4123  
4124 # ?? --- not conditional operator (condition ? then : else)
4125 ▶ elsif (($slash eq 'm//') and /\G (\?) /oxgc) {
Condition66%2/3
$Ecyrillic::slash eq "m//" and /\G (\?) /cgox
!ll&&!rl&&r
2772588360
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
4126 0 my $regexp = '';
4127 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
4128 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
4129 0 elsif (/\G (\\\?) /oxgc) { $regexp .= $1; }
4130 0 elsif (/\G \? ([cgimosxpadlunbB]*) /oxgc) { return e_qr('m','?','?',$regexp,$1); }
4131 0 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
4132 }
4133 0 die __FILE__, ": Search pattern not terminated\n";
4134 }
4135  
4136 # <<>> (a safer ARGV)
4137 0 elsif (/\G ( <<>> ) /oxgc) { $slash = 'm//'; return $1; }
4138  
4139 # << (bit shift) --- not here document
4140 0 elsif (/\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /oxgc) { $slash = 'm//'; return $1; }
4141  
4142 # <<~'HEREDOC'
4143 elsif (/\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /oxgc) {
4144 6 $slash = 'm//';
4145 6 my $here_quote = $1;
4146 6 my $delimiter = $2;
4147  
4148 # get here document
4149 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4150 6 $here_script = CORE::substr $_, pos $_;
4151 6 $here_script =~ s/.*?\n//oxm;
4152 }
4153 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
4154 6 my $heredoc = $1;
4155 6 my $indent = $2;
4156 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4157 6 push @heredoc, $heredoc . qq{\n$delimiter\n};
4158 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4159 }
4160 else {
4161 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4162 }
4163 6 return qq{<<'$delimiter'};
4164 }
4165  
4166 # <<~\HEREDOC
4167  
4168 # P.66 2.6.6. "Here" Documents
4169 # in Chapter 2: Bits and Pieces
4170 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4171  
4172 # P.73 "Here" Documents
4173 # in Chapter 2: Bits and Pieces
4174 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4175  
4176 elsif (/\G ( <<~ \\([a-zA-Z_0-9]+) ) /oxgc) {
4177 3 $slash = 'm//';
4178 3 my $here_quote = $1;
4179 3 my $delimiter = $2;
4180  
4181 # get here document
4182 3 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 3 0 3
4183 3 $here_script = CORE::substr $_, pos $_;
4184 3 $here_script =~ s/.*?\n//oxm;
4185 }
4186 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
4187 3 my $heredoc = $1;
4188 3 my $indent = $2;
4189 3 $heredoc =~ s{^$indent}{}msg; # no /ox
4190 3 push @heredoc, $heredoc . qq{\n$delimiter\n};
4191 3 push @heredoc_delimiter, qq{\\s*$delimiter};
4192 }
4193 else {
4194 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4195 }
4196 3 return qq{<<\\$delimiter};
4197 }
4198  
4199 # <<~"HEREDOC"
4200 elsif (/\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /oxgc) {
4201 6 $slash = 'm//';
4202 6 my $here_quote = $1;
4203 6 my $delimiter = $2;
4204  
4205 # get here document
4206 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4207 6 $here_script = CORE::substr $_, pos $_;
4208 6 $here_script =~ s/.*?\n//oxm;
4209 }
4210 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
4211 6 my $heredoc = $1;
4212 6 my $indent = $2;
4213 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4214 6 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4215 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4216 }
4217 else {
4218 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4219 }
4220 6 return qq{<<"$delimiter"};
4221 }
4222  
4223 # <<~HEREDOC
4224 elsif (/\G ( <<~ ([a-zA-Z_0-9]+) ) /oxgc) {
4225 3 $slash = 'm//';
4226 3 my $here_quote = $1;
4227 3 my $delimiter = $2;
4228  
4229 # get here document
4230 3 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 3 0 3
4231 3 $here_script = CORE::substr $_, pos $_;
4232 3 $here_script =~ s/.*?\n//oxm;
4233 }
4234 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
4235 3 my $heredoc = $1;
4236 3 my $indent = $2;
4237 3 $heredoc =~ s{^$indent}{}msg; # no /ox
4238 3 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4239 3 push @heredoc_delimiter, qq{\\s*$delimiter};
4240 }
4241 else {
4242 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4243 }
4244 3 return qq{<<$delimiter};
4245 }
4246  
4247 # <<~`HEREDOC`
4248 elsif (/\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /oxgc) {
4249 6 $slash = 'm//';
4250 6 my $here_quote = $1;
4251 6 my $delimiter = $2;
4252  
4253 # get here document
4254 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4255 6 $here_script = CORE::substr $_, pos $_;
4256 6 $here_script =~ s/.*?\n//oxm;
4257 }
4258 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
4259 6 my $heredoc = $1;
4260 6 my $indent = $2;
4261 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4262 6 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4263 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4264 }
4265 else {
4266 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4267 }
4268 6 return qq{<<`$delimiter`};
4269 }
4270  
4271 # <<'HEREDOC'
4272 elsif (/\G ( << '([a-zA-Z_0-9]*)' ) /oxgc) {
4273 72 $slash = 'm//';
4274 72 my $here_quote = $1;
4275 72 my $delimiter = $2;
4276  
4277 # get here document
4278 72 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 72 0 72
4279 72 $here_script = CORE::substr $_, pos $_;
4280 72 $here_script =~ s/.*?\n//oxm;
4281 }
4282 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
4283 72 push @heredoc, $1 . qq{\n$delimiter\n};
4284 72 push @heredoc_delimiter, $delimiter;
4285 }
4286 else {
4287 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4288 }
4289 72 return $here_quote;
4290 }
4291  
4292 # <<\HEREDOC
4293  
4294 # P.66 2.6.6. "Here" Documents
4295 # in Chapter 2: Bits and Pieces
4296 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4297  
4298 # P.73 "Here" Documents
4299 # in Chapter 2: Bits and Pieces
4300 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4301  
4302 elsif (/\G ( << \\([a-zA-Z_0-9]+) ) /oxgc) {
4303 0 $slash = 'm//';
4304 0 my $here_quote = $1;
4305 0 my $delimiter = $2;
4306  
4307 # get here document
4308 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4309 0 $here_script = CORE::substr $_, pos $_;
4310 0 $here_script =~ s/.*?\n//oxm;
4311 }
4312 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
4313 0 push @heredoc, $1 . qq{\n$delimiter\n};
4314 0 push @heredoc_delimiter, $delimiter;
4315 }
4316 else {
4317 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4318 }
4319 0 return $here_quote;
4320 }
4321  
4322 # <<"HEREDOC"
4323 elsif (/\G ( << "([a-zA-Z_0-9]*)" ) /oxgc) {
4324 36 $slash = 'm//';
4325 36 my $here_quote = $1;
4326 36 my $delimiter = $2;
4327  
4328 # get here document
4329 36 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 36 0 36
4330 36 $here_script = CORE::substr $_, pos $_;
4331 36 $here_script =~ s/.*?\n//oxm;
4332 }
4333 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
4334 36 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4335 36 push @heredoc_delimiter, $delimiter;
4336 }
4337 else {
4338 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4339 }
4340 36 return $here_quote;
4341 }
4342  
4343 # <<HEREDOC
4344 elsif (/\G ( << ([a-zA-Z_0-9]+) ) /oxgc) {
4345 42 $slash = 'm//';
4346 42 my $here_quote = $1;
4347 42 my $delimiter = $2;
4348  
4349 # get here document
4350 42 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 42 0 42
4351 42 $here_script = CORE::substr $_, pos $_;
4352 42 $here_script =~ s/.*?\n//oxm;
4353 }
4354 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
4355 42 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4356 42 push @heredoc_delimiter, $delimiter;
4357 }
4358 else {
4359 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4360 }
4361 42 return $here_quote;
4362 }
4363  
4364 # <<`HEREDOC`
4365 elsif (/\G ( << `([a-zA-Z_0-9]*)` ) /oxgc) {
4366 0 $slash = 'm//';
4367 0 my $here_quote = $1;
4368 0 my $delimiter = $2;
4369  
4370 # get here document
4371 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4372 0 $here_script = CORE::substr $_, pos $_;
4373 0 $here_script =~ s/.*?\n//oxm;
4374 }
4375 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
4376 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4377 0 push @heredoc_delimiter, $delimiter;
4378 }
4379 else {
4380 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4381 }
4382 0 return $here_quote;
4383 }
4384  
4385 # <<= <=> <= < operator
4386 elsif (/\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/oxgc) {
4387 12 return $1;
4388 }
4389  
4390 # <FILEHANDLE>
4391 elsif (/\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /oxgc) {
4392 0 return $1;
4393 }
4394  
4395 # <WILDCARD> --- glob
4396  
4397 # avoid "Error: Runtime exception" of perl version 5.005_03
4398  
4399 elsif (/\G < ((?:[^>\0\a\e\f\n\r\t])+?) > /oxgc) {
4400 0 return 'Ecyrillic::glob("' . $1 . '")';
4401 }
4402  
4403 # __DATA__
4404 0 elsif (/\G ^ ( __DATA__ \n .*) \z /oxmsgc) { return $1; }
4405  
4406 # __END__
4407 210 elsif (/\G ^ ( __END__ \n .*) \z /oxmsgc) { return $1; }
4408  
4409 # \cD Control-D
4410  
4411 # P.68 2.6.8. Other Literal Tokens
4412 # in Chapter 2: Bits and Pieces
4413 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4414  
4415 # P.76 Other Literal Tokens
4416 # in Chapter 2: Bits and Pieces
4417 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4418  
4419 0 elsif (/\G ( \cD .*) \z /oxmsgc) { return $1; }
4420  
4421 # \cZ Control-Z
4422 0 elsif (/\G ( \cZ .*) \z /oxmsgc) { return $1; }
4423  
4424 # any operator before div
4425 elsif (/\G (
4426 -- | \+\+ |
4427 [\)\}\]]
4428  
4429 5837 ) /oxgc) { $slash = 'div'; return $1; }
4430  
4431 # yada-yada or triple-dot operator
4432 elsif (/\G (
4433 \.\.\.
4434  
4435 7 ) /oxgc) { $slash = 'm//'; return q{die('Unimplemented')}; }
4436  
4437 # any operator before m//
4438  
4439 # //, //= (defined-or)
4440  
4441 # P.164 Logical Operators
4442 # in Chapter 10: More Control Structures
4443 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
4444  
4445 # P.119 C-Style Logical (Short-Circuit) Operators
4446 # in Chapter 3: Unary and Binary Operators
4447 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4448  
4449 # (and so on)
4450  
4451 # ~~
4452  
4453 # P.221 The Smart Match Operator
4454 # in Chapter 15: Smart Matching and given-when
4455 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
4456  
4457 # P.112 Smartmatch Operator
4458 # in Chapter 3: Unary and Binary Operators
4459 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4460  
4461 # (and so on)
4462  
4463 elsif (/\G ((?>
4464  
4465 !~~ | !~ | != | ! |
4466 %= | % |
4467 &&= | && | &= | &\.= | &\. | & |
4468 -= | -> | - |
4469 :(?>\s*)= |
4470 : |
4471 <<>> |
4472 <<= | <=> | <= | < |
4473 == | => | =~ | = |
4474 >>= | >> | >= | > |
4475 \*\*= | \*\* | \*= | \* |
4476 \+= | \+ |
4477 \.\. | \.= | \. |
4478 \/\/= | \/\/ |
4479 \/= | \/ |
4480 \? |
4481 \\ |
4482 \^= | \^\.= | \^\. | \^ |
4483 \b x= |
4484 \|\|= | \|\| | \|= | \|\.= | \|\. | \| |
4485 ~~ | ~\. | ~ |
4486 \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b |
4487 \b(?: print )\b |
4488  
4489 [,;\(\{\[]
4490  
4491 9805 )) /oxgc) { $slash = 'm//'; return $1; }
4492  
4493 # other any character
4494 20516 elsif (/\G ($q_char) /oxgc) { $slash = 'div'; return $1; }
4495  
4496 # system error
4497 else {
4498 0 die __FILE__, ": Oops, this shouldn't happen!\n";
4499 }
4500 }
4501  
4502 # escape Cyrillic string
4503 1871 ▶sub e_string {
Subroutine e_string: called CC=228 SCAR=104.2
Pod documented
4504 1871 my($string) = @_;
4505 1871 my $e_string = '';
4506  
4507 1871 local $slash = 'm//';
4508  
4509 # P.1024 Appendix W.10 Multibyte Processing
4510 # of ISBN 1-56592-224-7 CJKV Information Processing
4511 # (and so on)
4512  
4513 1871 my @char = $string =~ / \G (?>[^\\]|\\$q_char|$q_char) /oxmsg;
4514  
4515 # without { ... }
4516 1871 ▶ if (not (grep(/\A \{ \z/xms, @char) and grep(/\A \} \z/xms, @char))) {
Branch: 1 branch
BranchTrueFalseTotal
unless (grep /\A \{ \z/msx, @char and grep /\A \} \z/msx, @char) 1854 17 1871
Condition66%2/3
grep /\A \{ \z/msx, @char and grep /\A \} \z/msx, @char
!ll&&!rl&&r
1854017
MC/DC50%1/2
grep /\A \{ \z/msx, @char and grep /\A \} \z/msx, @char
grep /\A \{ \z/msx, @char grep /\A \} \z/msx, @char
Truth table66%2/3
A and B
A= grep /\A \{ \z/msx, @charB= grep /\A \} \z/msx, @char
ABresult
0X0
100
111
4517 1854 ▶ if ($string !~ /<</oxms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /<</mosx) 1854 0 1854
4518 1854 return $string;
4519 }
4520 }
4521  
4522 E_STRING_LOOP:
4523 17 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 190 17 207
4524 190 ▶ if (0) {
Branch: 101 branches
BranchTrueFalseTotal
if (do { $string =~ /\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /cgmosx }) { } 0 190 190
elsif ($string =~ /\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G ( \$' | \$\{'\} ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G ( \$ 0 ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G ( \$ \$ ) (?![\w\{]) /cgmosx) { } 0 190 190
elsif ($string =~ /\G \$ ((?>[1-9][0-9]*)) /cgmosx) { } 0 190 190
elsif ($string =~ /\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /cgmosx) { } 0 190 190
elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /cgmosx) { } 0 190 190
elsif ($string =~ /\G \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} /cgmosx) { } 0 190 190
elsif ($string =~ /\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /cgmosx) { } 3 187 190
elsif ($string =~ /\G ( (?: [\$\@\%\&\*] | \$\# | -> | \b sub \b) (?>\s*) (?: split | chop | index | rindex | lc | uc | fc | chr | ord | reverse | getc | tr | y | q | qq | qx | qw | m | s | qr | glob | lstat | opendir | stat | unlink | chdir ) ) \b /cgmosx) { } 7 180 187
elsif ($string =~ m{\G ( \$[\$\@\#\\\'\"/\?\(\)\[\]\<\>] ) }cgmosx) { } 0 180 180
elsif ($string =~ /\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b Char::eval (?= (?>\s*) \{ ) /cgox) { } 0 180 180
elsif ($string =~ /\G \b Cyrillic::eval (?= (?>\s*) \{ ) /cgox) { } 0 180 180
elsif ($string =~ /\G \b Char::eval \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b Cyrillic::eval \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::substr \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b chop \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::index \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b Char::index \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b Cyrillic::index \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b index \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::rindex \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b Char::rindex \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b Cyrillic::rindex \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b rindex \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s*) (\") ((?:$Ecyrillic::qq_char)+?) (\") /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\#) ((?:$Ecyrillic::qq_char)+?) (\#) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\S) ((?:$Ecyrillic::qq_char)+?) (\1) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s*) (\') ((?:\\\'|\\\\|$Ecyrillic::q_char)+?) (\') /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$Ecyrillic::q_char)+?) (\#) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$Ecyrillic::q_char)+?) (\1) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)*) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ))*) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?= (?>\s+) [a-z]+) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) ((?>\w+)) /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b lc \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b lcfirst \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b uc \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b ucfirst \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b fc \b /cgox) { } 0 180 180
elsif ($string =~ /\G -s \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::length \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::chr \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b chr \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::ord \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b ord \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b glob \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b reverse \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b getc \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b (split) \b (?! (?>\s*) => ) /cgox) { } 0 180 180
elsif ($string =~ /\G \b (qq) \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b (qx) \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b (q) \b /cgox) { } 0 180 180
elsif ($string =~ /\G (?<![\w\$\@\%\&\*]) (\') ((?:\\\'|\\\\|$Ecyrillic::q_char)*?) (\') /cgox) { } 0 180 180
elsif ($string =~ /\G (\") ((?:$Ecyrillic::qq_char)*?) (\") /cgox) { } 0 180 180
elsif ($string =~ /\G (\`) ((?:$Ecyrillic::qq_char)*?) (\`) /cgox) { } 0 180 180
elsif ($string =~ /\G ( <<>> ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/cgox) { } 0 180 180
elsif ($string =~ /\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /cgox) { } 0 180 180
elsif ($string =~ /\G < ((?:$Ecyrillic::q_char)+?) > /cgox) { } 0 180 180
elsif ($string =~ /\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( <<~ \\([a-zA-Z_0-9]+) ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( <<~ ([a-zA-Z_0-9]+) ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( << '([a-zA-Z_0-9]*)' ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( << \\([a-zA-Z_0-9]+) ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( << "([a-zA-Z_0-9]*)" ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( << ([a-zA-Z_0-9]+) ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( << `([a-zA-Z_0-9]*)` ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( -- | \+\+ | [\)\}\]] ) /cgox) { } 18 162 180
elsif ($string =~ /\G ( \.\.\. ) /cgox) { } 0 162 162
elsif ($string =~ m"\G ((?> !~~ | !~ | != | ! | %= | % | &&= | && | &= | &\.= | &\. | & | -= | -> | - | :(?>\s*)= | : | <<>> | <<= | <=> | <= | < | == | => | =~ | = | >>= | >> | >= | > | \*\*= | \*\* | \*= | \* | \+= | \+ | \.\. | \.= | \. | //= | // | /= | / | \? | \\ | \^= | \^\.= | \^\. | \^ | \b x= | \|\|= | \|\| | \|= | \|\.= | \|\. | \| | ~~ | ~\. | ~ | \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b | \b(?: print )\b | [,;\(\{\[] )) "cgox) { } 31 131 162
elsif ($string =~ /\G ($Ecyrillic::q_char) /cgox) { } 131 0 131
4525 }
4526  
4527 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> @{[Ecyrillic::PREMATCH()]}
4528 elsif ($string =~ /\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /oxmsgc) {
4529 0 $e_string .= q{Ecyrillic::PREMATCH()};
4530 0 $slash = 'div';
4531 }
4532  
4533 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> @{[Ecyrillic::MATCH()]}
4534 elsif ($string =~ /\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /oxmsgc) {
4535 0 $e_string .= q{Ecyrillic::MATCH()};
4536 0 $slash = 'div';
4537 }
4538  
4539 # $', ${'} --> $', ${'}
4540 elsif ($string =~ /\G ( \$' | \$\{'\} ) /oxmsgc) {
4541 0 $e_string .= $1;
4542 0 $slash = 'div';
4543 }
4544  
4545 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> @{[Ecyrillic::POSTMATCH()]}
4546 elsif ($string =~ /\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /oxmsgc) {
4547 0 $e_string .= q{Ecyrillic::POSTMATCH()};
4548 0 $slash = 'div';
4549 }
4550  
4551 # bareword
4552 elsif ($string =~ /\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /oxmsgc) {
4553 0 $e_string .= $1;
4554 0 $slash = 'div';
4555 }
4556  
4557 # $0 --> $0
4558 elsif ($string =~ /\G ( \$ 0 ) /oxmsgc) {
4559 0 $e_string .= $1;
4560 0 $slash = 'div';
4561 }
4562 elsif ($string =~ /\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /oxmsgc) {
4563 0 $e_string .= $1;
4564 0 $slash = 'div';
4565 }
4566  
4567 # $$ --> $$
4568 elsif ($string =~ /\G ( \$ \$ ) (?![\w\{]) /oxmsgc) {
4569 0 $e_string .= $1;
4570 0 $slash = 'div';
4571 }
4572  
4573 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
4574 # $1, $2, $3 --> $1, $2, $3 otherwise
4575 elsif ($string =~ /\G \$ ((?>[1-9][0-9]*)) /oxmsgc) {
4576 0 $e_string .= e_capture($1);
4577 0 $slash = 'div';
4578 }
4579 elsif ($string =~ /\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /oxmsgc) {
4580 0 $e_string .= e_capture($1);
4581 0 $slash = 'div';
4582 }
4583  
4584 # $$foo[ ... ] --> $ $foo->[ ... ]
4585 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /oxmsgc) {
4586 0 $e_string .= e_capture($1.'->'.$2);
4587 0 $slash = 'div';
4588 }
4589  
4590 # $$foo{ ... } --> $ $foo->{ ... }
4591 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /oxmsgc) {
4592 0 $e_string .= e_capture($1.'->'.$2);
4593 0 $slash = 'div';
4594 }
4595  
4596 # $$foo
4597 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /oxmsgc) {
4598 0 $e_string .= e_capture($1);
4599 0 $slash = 'div';
4600 }
4601  
4602 # ${ foo }
4603 elsif ($string =~ /\G \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} /oxmsgc) {
4604 0 $e_string .= '${' . $1 . '}';
4605 0 $slash = 'div';
4606 }
4607  
4608 # ${ ... }
4609 elsif ($string =~ /\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /oxmsgc) {
4610 3 $e_string .= e_capture($1);
4611 3 $slash = 'div';
4612 }
4613  
4614 # variable or function
4615 # $ @ % & * $ #
4616 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) {
4617 7 $e_string .= $1;
4618 7 $slash = 'div';
4619 }
4620 # $ $ $ $ $ $ $ $ $ $ $ $ $ $
4621 # $ @ # \ ' " / ? ( ) [ ] < >
4622 elsif ($string =~ /\G ( \$[\$\@\#\\\'\"\/\?\(\)\[\]\<\>] ) /oxmsgc) {
4623 0 $e_string .= $1;
4624 0 $slash = 'div';
4625 }
4626  
4627 # subroutines of package Ecyrillic
4628 0 elsif ($string =~ /\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /oxgc) { $e_string .= $1; $slash = 'm//'; }
4629 0 elsif ($string =~ /\G \b Char::eval (?= (?>\s*) \{ ) /oxgc) { $e_string .= 'eval'; $slash = 'm//'; }
4630 0 elsif ($string =~ /\G \b Cyrillic::eval (?= (?>\s*) \{ ) /oxgc) { $e_string .= 'eval'; $slash = 'm//'; }
4631 0 elsif ($string =~ /\G \b Char::eval \b /oxgc) { $e_string .= 'eval Char::escape'; $slash = 'm//'; }
4632 0 elsif ($string =~ /\G \b Cyrillic::eval \b /oxgc) { $e_string .= 'eval Cyrillic::escape'; $slash = 'm//'; }
4633 0 elsif ($string =~ /\G \b bytes::substr \b /oxgc) { $e_string .= 'substr'; $slash = 'm//'; }
4634 0 elsif ($string =~ /\G \b chop \b /oxgc) { $e_string .= 'Ecyrillic::chop'; $slash = 'm//'; }
4635 0 elsif ($string =~ /\G \b bytes::index \b /oxgc) { $e_string .= 'index'; $slash = 'm//'; }
4636 0 elsif ($string =~ /\G \b Char::index \b /oxgc) { $e_string .= 'Char::index'; $slash = 'm//'; }
4637 0 elsif ($string =~ /\G \b Cyrillic::index \b /oxgc) { $e_string .= 'Cyrillic::index'; $slash = 'm//'; }
4638 0 elsif ($string =~ /\G \b index \b /oxgc) { $e_string .= 'Ecyrillic::index'; $slash = 'm//'; }
4639 0 elsif ($string =~ /\G \b bytes::rindex \b /oxgc) { $e_string .= 'rindex'; $slash = 'm//'; }
4640 0 elsif ($string =~ /\G \b Char::rindex \b /oxgc) { $e_string .= 'Char::rindex'; $slash = 'm//'; }
4641 0 elsif ($string =~ /\G \b Cyrillic::rindex \b /oxgc) { $e_string .= 'Cyrillic::rindex'; $slash = 'm//'; }
4642 0 elsif ($string =~ /\G \b rindex \b /oxgc) { $e_string .= 'Ecyrillic::rindex'; $slash = 'm//'; }
4643 0 elsif ($string =~ /\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Ecyrillic::lc'; $slash = 'm//'; }
4644 0 elsif ($string =~ /\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Ecyrillic::lcfirst'; $slash = 'm//'; }
4645 0 elsif ($string =~ /\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Ecyrillic::uc'; $slash = 'm//'; }
4646 0 elsif ($string =~ /\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Ecyrillic::ucfirst'; $slash = 'm//'; }
4647 0 elsif ($string =~ /\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Ecyrillic::fc'; $slash = 'm//'; }
4648  
4649 # "-s '' ..." means file test "-s 'filename' ..." (not means "- s/// ...")
4650 0 elsif ($string =~ /\G -s (?>\s*) (\") ((?:$qq_char)+?) (\") /oxgc) { $e_string .= '-s ' . e_qq('', $1,$3,$2); $slash = 'm//'; }
4651 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\#) ((?:$qq_char)+?) (\#) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4652 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4653 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4654 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4655 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4656 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\S) ((?:$qq_char)+?) (\1) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4657  
4658 0 elsif ($string =~ /\G -s (?>\s*) (\') ((?:\\\'|\\\\|$q_char)+?) (\') /oxgc) { $e_string .= '-s ' . e_q ('', $1,$3,$2); $slash = 'm//'; }
4659 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$q_char)+?) (\#) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4660 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4661 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4662 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4663 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4664 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$q_char)+?) (\1) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4665  
4666 elsif ($string =~ /\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)*) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ))*) /oxgc)
4667 0 { $e_string .= "-s $1"; $slash = 'm//'; }
4668 0 elsif ($string =~ /\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /oxgc) { $e_string .= "-s ($1)"; $slash = 'm//'; }
4669 0 elsif ($string =~ /\G -s (?= (?>\s+) [a-z]+) /oxgc) { $e_string .= '-s'; $slash = 'm//'; }
4670 0 elsif ($string =~ /\G -s (?>\s+) ((?>\w+)) /oxgc) { $e_string .= "-s $1"; $slash = 'm//'; }
4671  
4672 0 elsif ($string =~ /\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'length'; $slash = 'm//'; }
4673 0 elsif ($string =~ /\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'chr'; $slash = 'm//'; }
4674 0 elsif ($string =~ /\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Ecyrillic::chr'; $slash = 'm//'; }
4675 0 elsif ($string =~ /\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'ord'; $slash = 'div'; }
4676 0 elsif ($string =~ /\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= $function_ord; $slash = 'div'; }
4677 0 elsif ($string =~ /\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Ecyrillic::glob'; $slash = 'm//'; }
4678 0 elsif ($string =~ /\G \b lc \b /oxgc) { $e_string .= 'Ecyrillic::lc_'; $slash = 'm//'; }
4679 0 elsif ($string =~ /\G \b lcfirst \b /oxgc) { $e_string .= 'Ecyrillic::lcfirst_'; $slash = 'm//'; }
4680 0 elsif ($string =~ /\G \b uc \b /oxgc) { $e_string .= 'Ecyrillic::uc_'; $slash = 'm//'; }
4681 0 elsif ($string =~ /\G \b ucfirst \b /oxgc) { $e_string .= 'Ecyrillic::ucfirst_'; $slash = 'm//'; }
4682 0 elsif ($string =~ /\G \b fc \b /oxgc) { $e_string .= 'Ecyrillic::fc_'; $slash = 'm//'; }
4683 0 elsif ($string =~ /\G -s \b /oxgc) { $e_string .= '-s '; $slash = 'm//'; }
4684  
4685 0 elsif ($string =~ /\G \b bytes::length \b /oxgc) { $e_string .= 'length'; $slash = 'm//'; }
4686 0 elsif ($string =~ /\G \b bytes::chr \b /oxgc) { $e_string .= 'chr'; $slash = 'm//'; }
4687 0 elsif ($string =~ /\G \b chr \b /oxgc) { $e_string .= 'Ecyrillic::chr_'; $slash = 'm//'; }
4688 0 elsif ($string =~ /\G \b bytes::ord \b /oxgc) { $e_string .= 'ord'; $slash = 'div'; }
4689 0 elsif ($string =~ /\G \b ord \b /oxgc) { $e_string .= $function_ord_; $slash = 'div'; }
4690 0 elsif ($string =~ /\G \b glob \b /oxgc) { $e_string .= 'Ecyrillic::glob_'; $slash = 'm//'; }
4691 0 elsif ($string =~ /\G \b reverse \b /oxgc) { $e_string .= $function_reverse; $slash = 'm//'; }
4692 0 elsif ($string =~ /\G \b getc \b /oxgc) { $e_string .= $function_getc; $slash = 'm//'; }
4693 # split
4694 elsif ($string =~ /\G \b (split) \b (?! (?>\s*) => ) /oxgc) {
4695 0 $slash = 'm//';
4696  
4697 0 my $e = '';
4698 0 ▶ while ($string =~ /\G ( (?>\s+) | \( | \#.* ) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G ( (?>\s+) | \( | \#.* ) /cgox) 0 0 0
4699 0 $e .= $1;
4700 }
4701  
4702 # end of split
4703 0 ▶ if ($string =~ /\G (?= [,;\)\}\]] ) /oxgc) { return 'Ecyrillic::split' . $e; }
Branch: 23 branches
BranchTrueFalseTotal
if ($string =~ /\G (?= [,;\)\}\]] ) /cgox) { } 0 0 0
elsif ($string =~ /\G ( [\$\@\&\*] $qq_scalar ) /cgox) { } 0 0 0
elsif ($string =~ /\G \b qq (\#) [ ] (\#) /cgox) { } 0 0 0
elsif ($string =~ /\G \b qq ((?>\s*)) (\() [ ] (\)) /cgox) { } 0 0 0
elsif ($string =~ /\G \b qq ((?>\s*)) (\{) [ ] (\}) /cgox) { } 0 0 0
elsif ($string =~ /\G \b qq ((?>\s*)) (\[) [ ] (\]) /cgox) { } 0 0 0
elsif ($string =~ /\G \b qq ((?>\s*)) (\<) [ ] (\>) /cgox) { } 0 0 0
elsif ($string =~ /\G \b qq ((?>\s*)) (\S) [ ] (\2) /cgox) { } 0 0 0
elsif ($string =~ /\G \b q (\#) [ ] (\#) /cgox) { } 0 0 0
elsif ($string =~ /\G \b q ((?>\s*)) (\() [ ] (\)) /cgox) { } 0 0 0
elsif ($string =~ /\G \b q ((?>\s*)) (\{) [ ] (\}) /cgox) { } 0 0 0
elsif ($string =~ /\G \b q ((?>\s*)) (\[) [ ] (\]) /cgox) { } 0 0 0
elsif ($string =~ /\G \b q ((?>\s*)) (\<) [ ] (\>) /cgox) { } 0 0 0
elsif ($string =~ /\G \b q ((?>\s*)) (\S) [ ] (\2) /cgox) { } 0 0 0
elsif ($string =~ /\G ' [ ] ' /cgox) { } 0 0 0
elsif ($string =~ /\G " [ ] " /cgox) { } 0 0 0
elsif ($string =~ /\G \b (qq) \b /cgox) { } 0 0 0
elsif ($string =~ /\G \b (qr) \b /cgox) { } 0 0 0
elsif ($string =~ /\G \b (q) \b /cgox) { } 0 0 0
elsif ($string =~ /\G \b (m) \b /cgox) { } 0 0 0
elsif ($string =~ /\G (\') /cgox) { } 0 0 0
elsif ($string =~ /\G (\") /cgox) { } 0 0 0
elsif ($string =~ m[\G (/) ]cgox) { } 0 0 0
4704  
4705 # split scalar value
4706 0 elsif ($string =~ /\G ( [\$\@\&\*] $qq_scalar ) /oxgc) { $e_string .= 'Ecyrillic::split' . $e . e_string($1); next E_STRING_LOOP; }
4707  
4708 # split literal space
4709 0 elsif ($string =~ /\G \b qq (\#) [ ] (\#) /oxgc) { $e_string .= 'Ecyrillic::split' . $e . qq {qq$1 $2}; next E_STRING_LOOP; }
4710 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\() [ ] (\)) /oxgc) { $e_string .= 'Ecyrillic::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4711 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\{) [ ] (\}) /oxgc) { $e_string .= 'Ecyrillic::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4712 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\[) [ ] (\]) /oxgc) { $e_string .= 'Ecyrillic::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4713 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\<) [ ] (\>) /oxgc) { $e_string .= 'Ecyrillic::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4714 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\S) [ ] (\2) /oxgc) { $e_string .= 'Ecyrillic::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4715 0 elsif ($string =~ /\G \b q (\#) [ ] (\#) /oxgc) { $e_string .= 'Ecyrillic::split' . $e . qq {q$1 $2}; next E_STRING_LOOP; }
4716 0 elsif ($string =~ /\G \b q ((?>\s*)) (\() [ ] (\)) /oxgc) { $e_string .= 'Ecyrillic::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4717 0 elsif ($string =~ /\G \b q ((?>\s*)) (\{) [ ] (\}) /oxgc) { $e_string .= 'Ecyrillic::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4718 0 elsif ($string =~ /\G \b q ((?>\s*)) (\[) [ ] (\]) /oxgc) { $e_string .= 'Ecyrillic::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4719 0 elsif ($string =~ /\G \b q ((?>\s*)) (\<) [ ] (\>) /oxgc) { $e_string .= 'Ecyrillic::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4720 0 elsif ($string =~ /\G \b q ((?>\s*)) (\S) [ ] (\2) /oxgc) { $e_string .= 'Ecyrillic::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4721 0 elsif ($string =~ /\G ' [ ] ' /oxgc) { $e_string .= 'Ecyrillic::split' . $e . qq {' '}; next E_STRING_LOOP; }
4722 0 elsif ($string =~ /\G " [ ] " /oxgc) { $e_string .= 'Ecyrillic::split' . $e . qq {" "}; next E_STRING_LOOP; }
4723  
4724 # split qq//
4725 elsif ($string =~ /\G \b (qq) \b /oxgc) {
4726 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Ecyrillic::qq_char)*?) (\#) /cgox) { } 0 0 0
4727 else {
4728 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4729 0 ▶ if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e_string .= $e . $1; }
Branch: 7 branches
BranchTrueFalseTotal
if ($string =~ /\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /cgox) { } 0 0 0
elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /cgox) { } 0 0 0
elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /cgox) { } 0 0 0
elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /cgox) { } 0 0 0
elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$Ecyrillic::qq_char)*?) (\1) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Ecyrillic::qq_char)*?) (\1) /cgox) { } 0 0 0
4730 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq ( ) --> qr ( )
4731 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq { } --> qr { }
4732 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq [ ] --> qr [ ]
4733 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq < > --> qr < >
4734 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= e_split($e.'qr','{','}',$2,''); next E_STRING_LOOP; } # qq | | --> qr { }
4735 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq * * --> qr * *
4736 }
4737 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4738 }
4739 }
4740  
4741 # split qr//
4742 elsif ($string =~ /\G \b (qr) \b /oxgc) {
4743 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1,$3,$2,$4); next E_STRING_LOOP; } # qr# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Ecyrillic::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 0 0
4744 else {
4745 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4746 0 ▶ if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e_string .= $e . $1; }
Branch: 8 branches
BranchTrueFalseTotal
if ($string =~ /\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\') ((?:$Ecyrillic::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$Ecyrillic::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Ecyrillic::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
4747 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr ( )
4748 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr { }
4749 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr [ ]
4750 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr < >
4751 0 elsif ($string =~ /\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split_q($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr ' '
4752 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr','{','}',$2,$4); next E_STRING_LOOP; } # qr | | --> qr { }
4753 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr * *
4754 }
4755 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4756 }
4757 }
4758  
4759 # split q//
4760 elsif ($string =~ /\G \b (q) \b /oxgc) {
4761 0 ▶ if ($string =~ /\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:\\\#|\\\\|$Ecyrillic::q_char)*?) (\#) /cgox) { } 0 0 0
4762 else {
4763 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4764 0 ▶ if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e_string .= $e . $1; }
Branch: 7 branches
BranchTrueFalseTotal
if ($string =~ /\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /cgox) { } 0 0 0
elsif ($string =~ /\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /cgox) { } 0 0 0
elsif ($string =~ /\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /cgox) { } 0 0 0
elsif ($string =~ /\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /cgox) { } 0 0 0
elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$Ecyrillic::q_char)*?) (\1) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:\\\\|\\\1| $Ecyrillic::q_char)*?) (\1) /cgox) { } 0 0 0
4765 0 elsif ($string =~ /\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q ( ) --> qr ( )
4766 0 elsif ($string =~ /\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q { } --> qr { }
4767 0 elsif ($string =~ /\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q [ ] --> qr [ ]
4768 0 elsif ($string =~ /\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q < > --> qr < >
4769 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$q_char)*?) (\1) /oxgc) { $e_string .= e_split_q($e.'qr','{','}',$2,''); next E_STRING_LOOP; } # q | | --> qr { }
4770 0 elsif ($string =~ /\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q * * --> qr * *
4771 }
4772 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4773 }
4774 }
4775  
4776 # split m//
4777 elsif ($string =~ /\G \b (m) \b /oxgc) {
4778 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1,$3,$2,$4); next E_STRING_LOOP; } # m# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Ecyrillic::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
4779 else {
4780 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4781 0 ▶ if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e_string .= $e . $1; }
Branch: 8 branches
BranchTrueFalseTotal
if ($string =~ /\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\') ((?:$Ecyrillic::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$Ecyrillic::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Ecyrillic::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
4782 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m ( ) --> qr ( )
4783 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m { } --> qr { }
4784 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m [ ] --> qr [ ]
4785 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m < > --> qr < >
4786 0 elsif ($string =~ /\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split_q($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m ' ' --> qr ' '
4787 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr','{','}',$2,$4); next E_STRING_LOOP; } # m | | --> qr { }
4788 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m * * --> qr * *
4789 }
4790 0 die __FILE__, ": Search pattern not terminated\n";
4791 }
4792 }
4793  
4794 # split ''
4795 elsif ($string =~ /\G (\') /oxgc) {
4796 0 my $q_string = '';
4797 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4798 0 ▶ if ($string =~ /\G (\\\\) /oxgc) { $q_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if ($string =~ /\G (\\\\) /cgox) { } 0 0 0
elsif ($string =~ /\G (\\\') /cgox) { } 0 0 0
elsif ($string =~ /\G \' /cgox) { } 0 0 0
elsif ($string =~ /\G ($Ecyrillic::q_char) /cgox) { } 0 0 0
4799 0 elsif ($string =~ /\G (\\\') /oxgc) { $q_string .= $1; } # splitqr'' --> split qr''
4800 0 elsif ($string =~ /\G \' /oxgc) { $e_string .= e_split_q($e.q{ qr},"'","'",$q_string,''); next E_STRING_LOOP; } # ' ' --> qr ' '
4801 0 elsif ($string =~ /\G ($q_char) /oxgc) { $q_string .= $1; }
4802 }
4803 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4804 }
4805  
4806 # split ""
4807 elsif ($string =~ /\G (\") /oxgc) {
4808 0 my $qq_string = '';
4809 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4810 0 ▶ if ($string =~ /\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if ($string =~ /\G (\\\\) /cgox) { } 0 0 0
elsif ($string =~ /\G (\\\") /cgox) { } 0 0 0
elsif ($string =~ /\G \" /cgox) { } 0 0 0
elsif ($string =~ /\G ($Ecyrillic::q_char) /cgox) { } 0 0 0
4811 0 elsif ($string =~ /\G (\\\") /oxgc) { $qq_string .= $1; } # splitqr"" --> split qr""
4812 0 elsif ($string =~ /\G \" /oxgc) { $e_string .= e_split($e.q{ qr},'"','"',$qq_string,''); next E_STRING_LOOP; } # " " --> qr " "
4813 0 elsif ($string =~ /\G ($q_char) /oxgc) { $qq_string .= $1; }
4814 }
4815 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4816 }
4817  
4818 # split //
4819 elsif ($string =~ /\G (\/) /oxgc) {
4820 0 my $regexp = '';
4821 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4822 0 ▶ if ($string =~ /\G (\\\\) /oxgc) { $regexp .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if ($string =~ /\G (\\\\) /cgox) { } 0 0 0
elsif ($string =~ m[\G (\\/) ]cgox) { } 0 0 0
elsif ($string =~ m[\G / ([cgimosxpadlunbB]*) ]cgox) { } 0 0 0
elsif ($string =~ /\G ($Ecyrillic::q_char) /cgox) { } 0 0 0
4823 0 elsif ($string =~ /\G (\\\/) /oxgc) { $regexp .= $1; } # splitqr// --> split qr//
4824 0 elsif ($string =~ /\G \/ ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split($e.q{ qr}, '/','/',$regexp,$1); next E_STRING_LOOP; } # / / --> qr / /
4825 0 elsif ($string =~ /\G ($q_char) /oxgc) { $regexp .= $1; }
4826 }
4827 0 die __FILE__, ": Search pattern not terminated\n";
4828 }
4829 }
4830  
4831 # qq//
4832 elsif ($string =~ /\G \b (qq) \b /oxgc) {
4833 0 my $ope = $1;
4834 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qq# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Ecyrillic::qq_char)*?) (\#) /cgox) { } 0 0 0
4835 0 $e_string .= e_qq($ope,$1,$3,$2);
4836 }
4837 else {
4838 0 my $e = '';
4839 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4840 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
4841 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq ( )
4842 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq { }
4843 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq [ ]
4844 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq < >
4845 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq * *
4846 }
4847 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4848 }
4849 }
4850  
4851 # qx//
4852 elsif ($string =~ /\G \b (qx) \b /oxgc) {
4853 0 my $ope = $1;
4854 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qx# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Ecyrillic::qq_char)*?) (\#) /cgox) { } 0 0 0
4855 0 $e_string .= e_qq($ope,$1,$3,$2);
4856 }
4857 else {
4858 0 my $e = '';
4859 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4860 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
4861 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx ( )
4862 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx { }
4863 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx [ ]
4864 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx < >
4865 0 elsif ($string =~ /\G (\') ((?:$qq_char)*?) (\') /oxgc) { $e_string .= $e . e_q ($ope,$1,$3,$2); next E_STRING_LOOP; } # qx ' '
4866 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx * *
4867 }
4868 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4869 }
4870 }
4871  
4872 # q//
4873 elsif ($string =~ /\G \b (q) \b /oxgc) {
4874 0 my $ope = $1;
4875 0 ▶ if ($string =~ /\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { # q# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:\\\#|\\\\|$Ecyrillic::q_char)*?) (\#) /cgox) { } 0 0 0
4876 0 $e_string .= e_q($ope,$1,$3,$2);
4877 }
4878 else {
4879 0 my $e = '';
4880 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4881 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
4882 0 elsif ($string =~ /\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q ( )
4883 0 elsif ($string =~ /\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q { }
4884 0 elsif ($string =~ /\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q [ ]
4885 0 elsif ($string =~ /\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q < >
4886 0 elsif ($string =~ /\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q * *
4887 }
4888 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4889 }
4890 }
4891  
4892 # ''
4893 0 elsif ($string =~ /\G (?<![\w\$\@\%\&\*]) (\') ((?:\\\'|\\\\|$q_char)*?) (\') /oxgc) { $e_string .= e_q('',$1,$3,$2); }
4894  
4895 # ""
4896 0 elsif ($string =~ /\G (\") ((?:$qq_char)*?) (\") /oxgc) { $e_string .= e_qq('',$1,$3,$2); }
4897  
4898 # ``
4899 0 elsif ($string =~ /\G (\`) ((?:$qq_char)*?) (\`) /oxgc) { $e_string .= e_qq('',$1,$3,$2); }
4900  
4901 # <<>> (a safer ARGV)
4902 0 elsif ($string =~ /\G ( <<>> ) /oxgc) { $e_string .= $1; }
4903  
4904 # <<= <=> <= < operator
4905 0 elsif ($string =~ /\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/oxgc) { $e_string .= $1; }
4906  
4907 # <FILEHANDLE>
4908 0 elsif ($string =~ /\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /oxgc) { $e_string .= $1; }
4909  
4910 # <WILDCARD> --- glob
4911 elsif ($string =~ /\G < ((?:$q_char)+?) > /oxgc) {
4912 0 $e_string .= 'Ecyrillic::glob("' . $1 . '")';
4913 }
4914  
4915 # << (bit shift) --- not here document
4916 elsif ($string =~ /\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /oxgc) {
4917 0 $slash = 'm//';
4918 0 $e_string .= $1;
4919 }
4920  
4921 # <<~'HEREDOC'
4922 elsif ($string =~ /\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /oxgc) {
4923 0 $slash = 'm//';
4924 0 my $here_quote = $1;
4925 0 my $delimiter = $2;
4926  
4927 # get here document
4928 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4929 0 $here_script = CORE::substr $_, pos $_;
4930 0 $here_script =~ s/.*?\n//oxm;
4931 }
4932 0 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 0 0 0
4933 0 my $heredoc = $1;
4934 0 my $indent = $2;
4935 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4936 0 push @heredoc, $heredoc . qq{\n$delimiter\n};
4937 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4938 }
4939 else {
4940 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4941 }
4942 0 $e_string .= qq{<<'$delimiter'};
4943 }
4944  
4945 # <<~\HEREDOC
4946 elsif ($string =~ /\G ( <<~ \\([a-zA-Z_0-9]+) ) /oxgc) {
4947 0 $slash = 'm//';
4948 0 my $here_quote = $1;
4949 0 my $delimiter = $2;
4950  
4951 # get here document
4952 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4953 0 $here_script = CORE::substr $_, pos $_;
4954 0 $here_script =~ s/.*?\n//oxm;
4955 }
4956 0 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 0 0 0
4957 0 my $heredoc = $1;
4958 0 my $indent = $2;
4959 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4960 0 push @heredoc, $heredoc . qq{\n$delimiter\n};
4961 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4962 }
4963 else {
4964 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4965 }
4966 0 $e_string .= qq{<<\\$delimiter};
4967 }
4968  
4969 # <<~"HEREDOC"
4970 elsif ($string =~ /\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /oxgc) {
4971 0 $slash = 'm//';
4972 0 my $here_quote = $1;
4973 0 my $delimiter = $2;
4974  
4975 # get here document
4976 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4977 0 $here_script = CORE::substr $_, pos $_;
4978 0 $here_script =~ s/.*?\n//oxm;
4979 }
4980 0 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 0 0 0
4981 0 my $heredoc = $1;
4982 0 my $indent = $2;
4983 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4984 0 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4985 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4986 }
4987 else {
4988 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4989 }
4990 0 $e_string .= qq{<<"$delimiter"};
4991 }
4992  
4993 # <<~HEREDOC
4994 elsif ($string =~ /\G ( <<~ ([a-zA-Z_0-9]+) ) /oxgc) {
4995 0 $slash = 'm//';
4996 0 my $here_quote = $1;
4997 0 my $delimiter = $2;
4998  
4999 # get here document
5000 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5001 0 $here_script = CORE::substr $_, pos $_;
5002 0 $here_script =~ s/.*?\n//oxm;
5003 }
5004 0 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 0 0 0
5005 0 my $heredoc = $1;
5006 0 my $indent = $2;
5007 0 $heredoc =~ s{^$indent}{}msg; # no /ox
5008 0 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
5009 0 push @heredoc_delimiter, qq{\\s*$delimiter};
5010 }
5011 else {
5012 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5013 }
5014 0 $e_string .= qq{<<$delimiter};
5015 }
5016  
5017 # <<~`HEREDOC`
5018 elsif ($string =~ /\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /oxgc) {
5019 0 $slash = 'm//';
5020 0 my $here_quote = $1;
5021 0 my $delimiter = $2;
5022  
5023 # get here document
5024 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5025 0 $here_script = CORE::substr $_, pos $_;
5026 0 $here_script =~ s/.*?\n//oxm;
5027 }
5028 0 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 0 0 0
5029 0 my $heredoc = $1;
5030 0 my $indent = $2;
5031 0 $heredoc =~ s{^$indent}{}msg; # no /ox
5032 0 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
5033 0 push @heredoc_delimiter, qq{\\s*$delimiter};
5034 }
5035 else {
5036 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5037 }
5038 0 $e_string .= qq{<<`$delimiter`};
5039 }
5040  
5041 # <<'HEREDOC'
5042 elsif ($string =~ /\G ( << '([a-zA-Z_0-9]*)' ) /oxgc) {
5043 0 $slash = 'm//';
5044 0 my $here_quote = $1;
5045 0 my $delimiter = $2;
5046  
5047 # get here document
5048 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5049 0 $here_script = CORE::substr $_, pos $_;
5050 0 $here_script =~ s/.*?\n//oxm;
5051 }
5052 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
5053 0 push @heredoc, $1 . qq{\n$delimiter\n};
5054 0 push @heredoc_delimiter, $delimiter;
5055 }
5056 else {
5057 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5058 }
5059 0 $e_string .= $here_quote;
5060 }
5061  
5062 # <<\HEREDOC
5063 elsif ($string =~ /\G ( << \\([a-zA-Z_0-9]+) ) /oxgc) {
5064 0 $slash = 'm//';
5065 0 my $here_quote = $1;
5066 0 my $delimiter = $2;
5067  
5068 # get here document
5069 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5070 0 $here_script = CORE::substr $_, pos $_;
5071 0 $here_script =~ s/.*?\n//oxm;
5072 }
5073 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
5074 0 push @heredoc, $1 . qq{\n$delimiter\n};
5075 0 push @heredoc_delimiter, $delimiter;
5076 }
5077 else {
5078 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5079 }
5080 0 $e_string .= $here_quote;
5081 }
5082  
5083 # <<"HEREDOC"
5084 elsif ($string =~ /\G ( << "([a-zA-Z_0-9]*)" ) /oxgc) {
5085 0 $slash = 'm//';
5086 0 my $here_quote = $1;
5087 0 my $delimiter = $2;
5088  
5089 # get here document
5090 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5091 0 $here_script = CORE::substr $_, pos $_;
5092 0 $here_script =~ s/.*?\n//oxm;
5093 }
5094 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
5095 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
5096 0 push @heredoc_delimiter, $delimiter;
5097 }
5098 else {
5099 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5100 }
5101 0 $e_string .= $here_quote;
5102 }
5103  
5104 # <<HEREDOC
5105 elsif ($string =~ /\G ( << ([a-zA-Z_0-9]+) ) /oxgc) {
5106 0 $slash = 'm//';
5107 0 my $here_quote = $1;
5108 0 my $delimiter = $2;
5109  
5110 # get here document
5111 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5112 0 $here_script = CORE::substr $_, pos $_;
5113 0 $here_script =~ s/.*?\n//oxm;
5114 }
5115 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
5116 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
5117 0 push @heredoc_delimiter, $delimiter;
5118 }
5119 else {
5120 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5121 }
5122 0 $e_string .= $here_quote;
5123 }
5124  
5125 # <<`HEREDOC`
5126 elsif ($string =~ /\G ( << `([a-zA-Z_0-9]*)` ) /oxgc) {
5127 0 $slash = 'm//';
5128 0 my $here_quote = $1;
5129 0 my $delimiter = $2;
5130  
5131 # get here document
5132 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5133 0 $here_script = CORE::substr $_, pos $_;
5134 0 $here_script =~ s/.*?\n//oxm;
5135 }
5136 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
5137 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
5138 0 push @heredoc_delimiter, $delimiter;
5139 }
5140 else {
5141 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5142 }
5143 0 $e_string .= $here_quote;
5144 }
5145  
5146 # any operator before div
5147 elsif ($string =~ /\G (
5148 -- | \+\+ |
5149 [\)\}\]]
5150  
5151 18 ) /oxgc) { $slash = 'div'; $e_string .= $1; }
5152  
5153 # yada-yada or triple-dot operator
5154 elsif ($string =~ /\G (
5155 \.\.\.
5156  
5157 0 ) /oxgc) { $slash = 'm//'; $e_string .= q{die('Unimplemented')}; }
5158  
5159 # any operator before m//
5160 elsif ($string =~ /\G ((?>
5161  
5162 !~~ | !~ | != | ! |
5163 %= | % |
5164 &&= | && | &= | &\.= | &\. | & |
5165 -= | -> | - |
5166 :(?>\s*)= |
5167 : |
5168 <<>> |
5169 <<= | <=> | <= | < |
5170 == | => | =~ | = |
5171 >>= | >> | >= | > |
5172 \*\*= | \*\* | \*= | \* |
5173 \+= | \+ |
5174 \.\. | \.= | \. |
5175 \/\/= | \/\/ |
5176 \/= | \/ |
5177 \? |
5178 \\ |
5179 \^= | \^\.= | \^\. | \^ |
5180 \b x= |
5181 \|\|= | \|\| | \|= | \|\.= | \|\. | \| |
5182 ~~ | ~\. | ~ |
5183 \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b |
5184 \b(?: print )\b |
5185  
5186 [,;\(\{\[]
5187  
5188 31 )) /oxgc) { $slash = 'm//'; $e_string .= $1; }
5189  
5190 # other any character
5191 131 elsif ($string =~ /\G ($q_char) /oxgc) { $e_string .= $1; }
5192  
5193 # system error
5194 else {
5195 0 die __FILE__, ": Oops, this shouldn't happen!\n";
5196 }
5197 }
5198  
5199 17 return $e_string;
5200 }
5201  
5202 #
5203 # character class
5204 #
5205 1920 ▶sub character_class {
Subroutine character_class: called CC=3 SCAR=11.0
Pod undocumented
5206 1920 my($char,$modifier) = @_;
5207  
5208 1920 ▶ if ($char eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char eq '.') { } 52 1868 1920
5209 52 ▶ if ($modifier =~ /s/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/) { } 17 35 52
5210 17 return '${Ecyrillic::dot_s}';
5211 }
5212 else {
5213 35 return '${Ecyrillic::dot}';
5214 }
5215 }
5216 else {
5217 1868 return Ecyrillic::classic_character_class($char);
5218 }
5219 }
5220  
5221 #
5222 # escape capture ($1, $2, $3, ...)
5223 #
5224 212 ▶sub e_capture {
Subroutine e_capture: called CC=1 SCAR=0.0
Pod undocumented
5225  
5226 212 return join '', '${', $_[0], '}';
5227 }
5228  
5229 #
5230 # escape transliteration (tr/// or y///)
5231 #
5232 4 ▶sub e_tr {
Subroutine e_tr: called CC=5 SCAR=16.8
Pod undocumented
5233 4 my($variable,$charclass,$e,$charclass2,$modifier) = @_;
5234 4 my $e_tr = '';
5235 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
5236  
5237 4 $slash = 'div';
5238  
5239 # quote character class 1
5240 4 $charclass = q_tr($charclass);
5241  
5242 # quote character class 2
5243 4 $charclass2 = q_tr($charclass2);
5244  
5245 # /b /B modifier
5246 4 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) { } 0 4 4
5247 0 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq '') { } 0 0 0
5248 0 $e_tr = qq{tr$charclass$e$charclass2$modifier};
5249 }
5250 else {
5251 0 $e_tr = qq{$variable${bind_operator}tr$charclass$e$charclass2$modifier};
5252 }
5253 }
5254 else {
5255 4 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq '') { } 2 2 4
5256 2 $e_tr = qq{Ecyrillic::tr(\$_,' =~ ',$charclass,$e$charclass2,'$modifier')};
5257 }
5258 else {
5259 2 $e_tr = qq{Ecyrillic::tr($variable,'$bind_operator',$charclass,$e$charclass2,'$modifier')};
5260 }
5261 }
5262  
5263 # clear tr/// variable
5264 4 $tr_variable = '';
5265 4 $bind_operator = '';
5266  
5267 4 return $e_tr;
5268 }
5269  
5270 #
5271 # quote for escape transliteration (tr/// or y///)
5272 #
5273 8 ▶sub q_tr {
Subroutine q_tr: called CC=9 SCAR=40.6
Pod undocumented
5274 8 my($charclass) = @_;
5275  
5276 # quote character class
5277 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
5278 8 return e_q('', "'", "'", $charclass); # --> q' '
5279 }
5280 elsif ($charclass !~ /\//oxms) {
5281 0 return e_q('q', '/', '/', $charclass); # --> q/ /
5282 }
5283 elsif ($charclass !~ /\#/oxms) {
5284 0 return e_q('q', '#', '#', $charclass); # --> q# #
5285 }
5286 elsif ($charclass !~ /[\<\>]/oxms) {
5287 0 return e_q('q', '<', '>', $charclass); # --> q< >
5288 }
5289 elsif ($charclass !~ /[\(\)]/oxms) {
5290 0 return e_q('q', '(', ')', $charclass); # --> q( )
5291 }
5292 elsif ($charclass !~ /[\{\}]/oxms) {
5293 0 return e_q('q', '{', '}', $charclass); # --> q{ }
5294 }
5295 else {
5296 0 for my $char (qw( ! " $ % & * + . : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5297 0 ▶ if ($charclass !~ /\Q$char\E/xms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($charclass =~ /\Q$char\E/msx) 0 0 0
5298 0 return e_q('q', $char, $char, $charclass);
5299 }
5300 }
5301 }
5302  
5303 0 return e_q('q', '{', '}', $charclass);
5304 }
5305  
5306 #
5307 # escape q string (q//, '')
5308 #
5309 1623 ▶sub e_q {
Subroutine e_q: called CC=1 SCAR=0.0
Pod undocumented
5310 1623 my($ope,$delimiter,$end_delimiter,$string) = @_;
5311  
5312 1623 $slash = 'div';
5313  
5314 1623 return join '', $ope, $delimiter, $string, $end_delimiter;
5315 }
5316  
5317 #
5318 # escape qq string (qq//, "", qx//, ``)
5319 #
5320 4289 ▶sub e_qq {
Subroutine e_qq: called CC=37 SCAR=50.9
Pod undocumented
5321 4289 my($ope,$delimiter,$end_delimiter,$string) = @_;
5322  
5323 4289 $slash = 'div';
5324  
5325 4289 my $left_e = 0;
5326 4289 my $right_e = 0;
5327  
5328 # split regexp
5329 4289 my @char = $string =~ /\G((?>
5330 [^\\\$] |
5331 \\x\{ (?>[0-9A-Fa-f]+) \} |
5332 \\o\{ (?>[0-7]+) \} |
5333 \\N\{ (?>[^0-9\}][^\}]*) \} |
5334 \\ $q_char |
5335 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5336 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5337 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5338 \$ (?>\s* [0-9]+) |
5339 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5340 \$ \$ (?![\w\{]) |
5341 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5342 $q_char
5343 ))/oxmsg;
5344  
5345 4289 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 117105 4289 121394
5346  
5347 # "\L\u" --> "\u\L"
5348 117105 ▶ 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 117105 117105
elsif ($char[$i] eq '\\U' and $char[$i + 1] eq '\\l') { } 0 117105 117105
elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/mosx) { } 1 117104 117105
elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/mosx) { } 1 117103 117104
elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/mosx) { } 0 117103 117103
Condition33%1/3
$char[$i] eq "\\L" and $char[$i + 1] eq "\\u"
!ll&&!rl&&r
11710500
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
5349 0 @char[$i,$i+1] = @char[$i+1,$i];
5350 }
5351  
5352 # "\U\l" --> "\l\U"
5353 ▶ 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
11710500
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
5354 0 @char[$i,$i+1] = @char[$i+1,$i];
5355 }
5356  
5357 # octal escape sequence
5358 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5359 1 $char[$i] = Ecyrillic::octchr($1);
5360 }
5361  
5362 # hexadecimal escape sequence
5363 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5364 1 $char[$i] = Ecyrillic::hexchr($1);
5365 }
5366  
5367 # \N{CHARNAME} --> N{CHARNAME}
5368 elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5369 0 $char[$i] = $1;
5370 }
5371  
5372 117105 ▶ if (0) {
Branch: 23 branches
BranchTrueFalseTotal
if (do { $char[$i] =~ /\A ([<>]) \z/mosx }) { } 484 116621 117105
elsif ($char[$i] eq '\\u') { } 0 116621 116621
elsif ($char[$i] eq '\\l') { } 0 116621 116621
elsif ($char[$i] eq '\\U') { } 0 116621 116621
elsif ($char[$i] eq '\\L') { } 0 116621 116621
elsif ($char[$i] eq '\\F') { } 24 116597 116621
elsif ($char[$i] eq '\\Q') { } 0 116597 116597
elsif ($char[$i] eq '\\E') { } 24 116573 116597
elsif ($char[$i] eq '\\Q') { } 0 116573 116573
elsif ($char[$i] eq '\\E') { } 0 116573 116573
elsif ($char[$i] =~ /\A \$ 0 \z/mosx) { } 4 116569 116573
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/mosx) { } 0 116569 116569
elsif ($char[$i] =~ /\A \$\$ \z/mosx) { } 0 116569 116569
elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/mosx) { } 205 116364 116569
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/mosx) { } 0 116364 116364
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/mosx) { } 0 116364 116364
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/mosx) { } 0 116364 116364
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/mosx) { } 0 116364 116364
elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/cgmosx) { } 44 116320 116364
elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/cgmosx) { } 45 116275 116320
elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/cgmosx) { } 33 116242 116275
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/mosx) { } 0 116242 116242
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/mosx) { } 0 116242 116242
5373 }
5374  
5375 # \F
5376 #
5377 # P.69 Table 2-6. Translation escapes
5378 # in Chapter 2: Bits and Pieces
5379 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
5380 # (and so on)
5381  
5382 # \u \l \U \L \F \Q \E
5383 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
5384 484 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 484 484
5385 0 $char[$i] = '\\' . $char[$i];
5386 }
5387 }
5388 elsif ($char[$i] eq '\u') {
5389  
5390 # "STRING @{[ LIST EXPR ]} MORE STRING"
5391  
5392 # P.257 Other Tricks You Can Do with Hard References
5393 # in Chapter 8: References
5394 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
5395  
5396 # P.353 Other Tricks You Can Do with Hard References
5397 # in Chapter 8: References
5398 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
5399  
5400 # (and so on)
5401  
5402 0 $char[$i] = '@{[Ecyrillic::ucfirst qq<';
5403 0 $left_e++;
5404 }
5405 elsif ($char[$i] eq '\l') {
5406 0 $char[$i] = '@{[Ecyrillic::lcfirst qq<';
5407 0 $left_e++;
5408 }
5409 elsif ($char[$i] eq '\U') {
5410 0 $char[$i] = '@{[Ecyrillic::uc qq<';
5411 0 $left_e++;
5412 }
5413 elsif ($char[$i] eq '\L') {
5414 0 $char[$i] = '@{[Ecyrillic::lc qq<';
5415 0 $left_e++;
5416 }
5417 elsif ($char[$i] eq '\F') {
5418 24 $char[$i] = '@{[Ecyrillic::fc qq<';
5419 24 $left_e++;
5420 }
5421 elsif ($char[$i] eq '\Q') {
5422 0 $char[$i] = '@{[CORE::quotemeta qq<';
5423 0 $left_e++;
5424 }
5425 elsif ($char[$i] eq '\E') {
5426 24 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 24 0 24
5427 24 $char[$i] = '>]}';
5428 24 $right_e++;
5429 }
5430 else {
5431 0 $char[$i] = '';
5432 }
5433 }
5434 elsif ($char[$i] eq '\Q') {
5435 0 while (1) {
5436 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5437 0 last;
5438 }
5439 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
5440 0 last;
5441 }
5442 }
5443 }
5444 elsif ($char[$i] eq '\E') {
5445 }
5446  
5447 # $0 --> $0
5448 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
5449 }
5450 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
5451 }
5452  
5453 # $$ --> $$
5454 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
5455 }
5456  
5457 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
5458 # $1, $2, $3 --> $1, $2, $3 otherwise
5459 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
5460 205 $char[$i] = e_capture($1);
5461 }
5462 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
5463 0 $char[$i] = e_capture($1);
5464 }
5465  
5466 # $$foo[ ... ] --> $ $foo->[ ... ]
5467 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
5468 0 $char[$i] = e_capture($1.'->'.$2);
5469 }
5470  
5471 # $$foo{ ... } --> $ $foo->{ ... }
5472 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
5473 0 $char[$i] = e_capture($1.'->'.$2);
5474 }
5475  
5476 # $$foo
5477 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
5478 0 $char[$i] = e_capture($1);
5479 }
5480  
5481 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Ecyrillic::PREMATCH()
5482 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
5483 44 $char[$i] = '@{[Ecyrillic::PREMATCH()]}';
5484 }
5485  
5486 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Ecyrillic::MATCH()
5487 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
5488 45 $char[$i] = '@{[Ecyrillic::MATCH()]}';
5489 }
5490  
5491 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Ecyrillic::POSTMATCH()
5492 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
5493 33 $char[$i] = '@{[Ecyrillic::POSTMATCH()]}';
5494 }
5495  
5496 # ${ foo } --> ${ foo }
5497 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/oxms) {
5498 }
5499  
5500 # ${ ... }
5501 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5502 0 $char[$i] = e_capture($1);
5503 }
5504 }
5505  
5506 # return string
5507 4289 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 4289 4289
5508 0 return join '', $ope, $delimiter, @char, '>]}' x ($left_e - $right_e), $end_delimiter;
5509 }
5510 4289 return join '', $ope, $delimiter, @char, $end_delimiter;
5511 }
5512  
5513 #
5514 # escape qw string (qw//)
5515 #
5516 16 ▶sub e_qw {
Subroutine e_qw: called CC=11 SCAR=43.1
Pod undocumented
5517 16 my($ope,$delimiter,$end_delimiter,$string) = @_;
5518  
5519 16 $slash = 'div';
5520  
5521 # choice again delimiter
5522 16 my %octet = map {$_ => 1} ($string =~ /\G ([\x00-\xFF]) /oxmsg);
5523 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
5524 16 return join '', $ope, $delimiter, $string, $end_delimiter;
5525 }
5526 elsif (not $octet{')'}) {
5527 0 return join '', $ope, '(', $string, ')';
5528 }
5529 elsif (not $octet{'}'}) {
5530 0 return join '', $ope, '{', $string, '}';
5531 }
5532 elsif (not $octet{']'}) {
5533 0 return join '', $ope, '[', $string, ']';
5534 }
5535 elsif (not $octet{'>'}) {
5536 0 return join '', $ope, '<', $string, '>';
5537 }
5538 else {
5539 0 for my $char (qw( ! " $ % & * + - . / : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5540 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5541 0 return join '', $ope, $char, $string, $char;
5542 }
5543 }
5544 }
5545  
5546 # qw/AAA BBB C'CC/ --> ('AAA', 'BBB', 'C\'CC')
5547 0 my @string = CORE::split(/\s+/, $string);
5548 0 for my $string (@string) {
5549 0 my @octet = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5550 0 for my $octet (@octet) {
5551 0 ▶ if ($octet =~ /\A (['\\]) \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($octet =~ /\A (['\\]) \z/mosx) 0 0 0
5552 0 $octet = '\\' . $1;
5553 }
5554 }
5555 0 $string = join '', @octet;
5556 }
5557 0 return join '', '(', (join ', ', map { "'$_'" } @string), ')';
5558 }
5559  
5560 #
5561 # escape here document (<<"HEREDOC", <<HEREDOC, <<`HEREDOC`, <<~"HEREDOC", <<~HEREDOC, <<~`HEREDOC`)
5562 #
5563 93 ▶sub e_heredoc {
Subroutine e_heredoc: called CC=37 SCAR=56.3
Pod undocumented
5564 93 my($string) = @_;
5565  
5566 93 $slash = 'm//';
5567  
5568 93 my $metachar = qr/[\@\\|]/oxms; # '|' is for <<`HEREDOC`
5569  
5570 93 my $left_e = 0;
5571 93 my $right_e = 0;
5572  
5573 # split regexp
5574 93 my @char = $string =~ /\G((?>
5575 [^\\\$] |
5576 \\x\{ (?>[0-9A-Fa-f]+) \} |
5577 \\o\{ (?>[0-7]+) \} |
5578 \\N\{ (?>[^0-9\}][^\}]*) \} |
5579 \\ $q_char |
5580 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5581 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5582 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5583 \$ (?>\s* [0-9]+) |
5584 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5585 \$ \$ (?![\w\{]) |
5586 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5587 $q_char
5588 ))/oxmsg;
5589  
5590 93 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 3229 93 3322
5591  
5592 # "\L\u" --> "\u\L"
5593 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
5594 0 @char[$i,$i+1] = @char[$i+1,$i];
5595 }
5596  
5597 # "\U\l" --> "\l\U"
5598 ▶ 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
5599 0 @char[$i,$i+1] = @char[$i+1,$i];
5600 }
5601  
5602 # octal escape sequence
5603 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5604 1 $char[$i] = Ecyrillic::octchr($1);
5605 }
5606  
5607 # hexadecimal escape sequence
5608 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5609 1 $char[$i] = Ecyrillic::hexchr($1);
5610 }
5611  
5612 # \N{CHARNAME} --> N{CHARNAME}
5613 elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5614 0 $char[$i] = $1;
5615 }
5616  
5617 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
5618 }
5619  
5620 # \u \l \U \L \F \Q \E
5621 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
5622 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
5623 0 $char[$i] = '\\' . $char[$i];
5624 }
5625 }
5626 elsif ($char[$i] eq '\u') {
5627 0 $char[$i] = '@{[Ecyrillic::ucfirst qq<';
5628 0 $left_e++;
5629 }
5630 elsif ($char[$i] eq '\l') {
5631 0 $char[$i] = '@{[Ecyrillic::lcfirst qq<';
5632 0 $left_e++;
5633 }
5634 elsif ($char[$i] eq '\U') {
5635 0 $char[$i] = '@{[Ecyrillic::uc qq<';
5636 0 $left_e++;
5637 }
5638 elsif ($char[$i] eq '\L') {
5639 0 $char[$i] = '@{[Ecyrillic::lc qq<';
5640 0 $left_e++;
5641 }
5642 elsif ($char[$i] eq '\F') {
5643 0 $char[$i] = '@{[Ecyrillic::fc qq<';
5644 0 $left_e++;
5645 }
5646 elsif ($char[$i] eq '\Q') {
5647 0 $char[$i] = '@{[CORE::quotemeta qq<';
5648 0 $left_e++;
5649 }
5650 elsif ($char[$i] eq '\E') {
5651 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
5652 0 $char[$i] = '>]}';
5653 0 $right_e++;
5654 }
5655 else {
5656 0 $char[$i] = '';
5657 }
5658 }
5659 elsif ($char[$i] eq '\Q') {
5660 0 while (1) {
5661 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5662 0 last;
5663 }
5664 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
5665 0 last;
5666 }
5667 }
5668 }
5669 elsif ($char[$i] eq '\E') {
5670 }
5671  
5672 # $0 --> $0
5673 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
5674 }
5675 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
5676 }
5677  
5678 # $$ --> $$
5679 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
5680 }
5681  
5682 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
5683 # $1, $2, $3 --> $1, $2, $3 otherwise
5684 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
5685 0 $char[$i] = e_capture($1);
5686 }
5687 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
5688 0 $char[$i] = e_capture($1);
5689 }
5690  
5691 # $$foo[ ... ] --> $ $foo->[ ... ]
5692 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
5693 0 $char[$i] = e_capture($1.'->'.$2);
5694 }
5695  
5696 # $$foo{ ... } --> $ $foo->{ ... }
5697 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
5698 0 $char[$i] = e_capture($1.'->'.$2);
5699 }
5700  
5701 # $$foo
5702 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
5703 0 $char[$i] = e_capture($1);
5704 }
5705  
5706 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Ecyrillic::PREMATCH()
5707 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
5708 8 $char[$i] = '@{[Ecyrillic::PREMATCH()]}';
5709 }
5710  
5711 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Ecyrillic::MATCH()
5712 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
5713 8 $char[$i] = '@{[Ecyrillic::MATCH()]}';
5714 }
5715  
5716 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Ecyrillic::POSTMATCH()
5717 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
5718 6 $char[$i] = '@{[Ecyrillic::POSTMATCH()]}';
5719 }
5720  
5721 # ${ foo } --> ${ foo }
5722 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/oxms) {
5723 }
5724  
5725 # ${ ... }
5726 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5727 0 $char[$i] = e_capture($1);
5728 }
5729 }
5730  
5731 # return string
5732 93 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 93 93
5733 0 return join '', @char, '>]}' x ($left_e - $right_e);
5734 }
5735 93 return join '', @char;
5736 }
5737  
5738 #
5739 # escape regexp (m//, qr//)
5740 #
5741 880 ▶sub e_qr {
Subroutine e_qr: called CC=110 SCAR=73.6
Pod undocumented
5742 880 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5743 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
5744  
5745 880 $modifier =~ tr/p//d;
5746 880 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 880 880
5747 0 my $line = 0;
5748 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
5749 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
5750 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
5751 0 last;
5752 }
5753 }
5754 0 die qq{Unsupported modifier "$1" used at line $line.\n};
5755 }
5756  
5757 880 $slash = 'div';
5758  
5759 # literal null string pattern
5760 880 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 872 880
elsif ($modifier =~ tr/Bb//d) { } 2 870 872
5761 8 $modifier =~ tr/bB//d;
5762 8 $modifier =~ tr/i//d;
5763 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
5764 }
5765  
5766 # /b /B modifier
5767 elsif ($modifier =~ tr/bB//d) {
5768  
5769 # choice again delimiter
5770 2 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 2 2
5771 0 my @char = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5772 0 my %octet = map {$_ => 1} @char;
5773 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
5774 0 $delimiter = '(';
5775 0 $end_delimiter = ')';
5776 }
5777 elsif (not $octet{'}'}) {
5778 0 $delimiter = '{';
5779 0 $end_delimiter = '}';
5780 }
5781 elsif (not $octet{']'}) {
5782 0 $delimiter = '[';
5783 0 $end_delimiter = ']';
5784 }
5785 elsif (not $octet{'>'}) {
5786 0 $delimiter = '<';
5787 0 $end_delimiter = '>';
5788 }
5789 else {
5790 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5791 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5792 0 $delimiter = $char;
5793 0 $end_delimiter = $char;
5794 0 last;
5795 }
5796 }
5797 }
5798 }
5799  
5800 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
5801 0 return join '', $ope, $delimiter, $string, $matched, $end_delimiter, $modifier;
5802 }
5803 else {
5804 2 return join '', $ope, $delimiter, '(?:', $string, ')', $matched, $end_delimiter, $modifier;
5805 }
5806 }
5807  
5808 870 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 312 558 870
5809 870 my $metachar = qr/[\@\\|[\]{^]/oxms;
5810  
5811 # split regexp
5812 870 my @char = $string =~ /\G((?>
5813 [^\\\$\@\[\(] |
5814 \\x (?>[0-9A-Fa-f]{1,2}) |
5815 \\ (?>[0-7]{2,3}) |
5816 \\c [\x40-\x5F] |
5817 \\x\{ (?>[0-9A-Fa-f]+) \} |
5818 \\o\{ (?>[0-7]+) \} |
5819 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
5820 \\ $q_char |
5821 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5822 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5823 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5824 [\$\@] $qq_variable |
5825 \$ (?>\s* [0-9]+) |
5826 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5827 \$ \$ (?![\w\{]) |
5828 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5829 \[\^ |
5830 \[\: (?>[a-z]+) :\] |
5831 \[\:\^ (?>[a-z]+) :\] |
5832 \(\? |
5833 $q_char
5834 ))/oxmsg;
5835  
5836 # choice again delimiter
5837 870 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 870 870
5838 0 my %octet = map {$_ => 1} @char;
5839 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
5840 0 $delimiter = '(';
5841 0 $end_delimiter = ')';
5842 }
5843 elsif (not $octet{'}'}) {
5844 0 $delimiter = '{';
5845 0 $end_delimiter = '}';
5846 }
5847 elsif (not $octet{']'}) {
5848 0 $delimiter = '[';
5849 0 $end_delimiter = ']';
5850 }
5851 elsif (not $octet{'>'}) {
5852 0 $delimiter = '<';
5853 0 $end_delimiter = '>';
5854 }
5855 else {
5856 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5857 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5858 0 $delimiter = $char;
5859 0 $end_delimiter = $char;
5860 0 last;
5861 }
5862 }
5863 }
5864 }
5865  
5866 870 my $left_e = 0;
5867 870 my $right_e = 0;
5868 870 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 2100 870 2970
5869  
5870 # "\L\u" --> "\u\L"
5871 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
5872 0 @char[$i,$i+1] = @char[$i+1,$i];
5873 }
5874  
5875 # "\U\l" --> "\l\U"
5876 ▶ 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
5877 0 @char[$i,$i+1] = @char[$i+1,$i];
5878 }
5879  
5880 # octal escape sequence
5881 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5882 1 $char[$i] = Ecyrillic::octchr($1);
5883 }
5884  
5885 # hexadecimal escape sequence
5886 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5887 1 $char[$i] = Ecyrillic::hexchr($1);
5888 }
5889  
5890 # \b{...} --> b\{...}
5891 # \B{...} --> B\{...}
5892 # \N{CHARNAME} --> N\{CHARNAME}
5893 # \p{PROPERTY} --> p\{PROPERTY}
5894 # \P{PROPERTY} --> P\{PROPERTY}
5895 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5896 6 $char[$i] = $1 . '\\' . $2;
5897 }
5898  
5899 # \p, \P, \X --> p, P, X
5900 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
5901 4 $char[$i] = $1;
5902 }
5903  
5904 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
5905 }
5906  
5907 # join separated multiple-octet
5908 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
5909 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
5910 0 $char[$i] .= join '', splice @char, $i+1, 3;
5911 }
5912 ▶ 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
5913 0 $char[$i] .= join '', splice @char, $i+1, 2;
5914 }
5915 ▶ 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
5916 0 $char[$i] .= join '', splice @char, $i+1, 1;
5917 }
5918 }
5919  
5920 # open character class [...]
5921 elsif ($char[$i] eq '[') {
5922 556 my $left = $i;
5923  
5924 # [] make die "Unmatched [] in regexp ...\n"
5925 # (and so on)
5926  
5927 556 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 3 553 556
5928 3 $i++;
5929 }
5930  
5931 556 while (1) {
5932 2063 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 2063 2063
5933 0 die __FILE__, ": Unmatched [] in regexp\n";
5934 }
5935 2063 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 556 1507 2063
5936 556 my $right = $i;
5937  
5938 # [...]
5939 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
5940 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);
5941 }
5942 else {
5943 526 splice @char, $left, $right-$left+1, Ecyrillic::charlist_qr(@char[$left+1..$right-1], $modifier);
5944 }
5945  
5946 556 $i = $left;
5947 556 last;
5948 }
5949 }
5950 }
5951  
5952 # open character class [^...]
5953 elsif ($char[$i] eq '[^') {
5954 74 my $left = $i;
5955  
5956 # [^] make die "Unmatched [] in regexp ...\n"
5957 # (and so on)
5958  
5959 74 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 4 70 74
5960 4 $i++;
5961 }
5962  
5963 74 while (1) {
5964 272 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 272 272
5965 0 die __FILE__, ": Unmatched [] in regexp\n";
5966 }
5967 272 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 74 198 272
5968 74 my $right = $i;
5969  
5970 # [^...]
5971 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
5972 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);
5973 }
5974 else {
5975 44 splice @char, $left, $right-$left+1, Ecyrillic::charlist_not_qr(@char[$left+1..$right-1], $modifier);
5976 }
5977  
5978 74 $i = $left;
5979 74 last;
5980 }
5981 }
5982 }
5983  
5984 # rewrite character class or escape character
5985 elsif (my $char = character_class($char[$i],$modifier)) {
5986 139 $char[$i] = $char;
5987 }
5988  
5989 # /i modifier
5990 ▶ 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
5991 20 ▶ if (CORE::length(Ecyrillic::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 20 0 20
5992 20 $char[$i] = '[' . Ecyrillic::uc($char[$i]) . Ecyrillic::fc($char[$i]) . ']';
5993 }
5994 else {
5995 0 $char[$i] = '(?:' . Ecyrillic::uc($char[$i]) . '|' . Ecyrillic::fc($char[$i]) . ')';
5996 }
5997 }
5998  
5999 # \u \l \U \L \F \Q \E
6000 elsif ($char[$i] =~ /\A [<>] \z/oxms) {
6001 1 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 1 1
6002 0 $char[$i] = '\\' . $char[$i];
6003 }
6004 }
6005 elsif ($char[$i] eq '\u') {
6006 0 $char[$i] = '@{[Ecyrillic::ucfirst qq<';
6007 0 $left_e++;
6008 }
6009 elsif ($char[$i] eq '\l') {
6010 0 $char[$i] = '@{[Ecyrillic::lcfirst qq<';
6011 0 $left_e++;
6012 }
6013 elsif ($char[$i] eq '\U') {
6014 1 $char[$i] = '@{[Ecyrillic::uc qq<';
6015 1 $left_e++;
6016 }
6017 elsif ($char[$i] eq '\L') {
6018 1 $char[$i] = '@{[Ecyrillic::lc qq<';
6019 1 $left_e++;
6020 }
6021 elsif ($char[$i] eq '\F') {
6022 18 $char[$i] = '@{[Ecyrillic::fc qq<';
6023 18 $left_e++;
6024 }
6025 elsif ($char[$i] eq '\Q') {
6026 1 $char[$i] = '@{[CORE::quotemeta qq<';
6027 1 $left_e++;
6028 }
6029 elsif ($char[$i] eq '\E') {
6030 21 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 21 0 21
6031 21 $char[$i] = '>]}';
6032 21 $right_e++;
6033 }
6034 else {
6035 0 $char[$i] = '';
6036 }
6037 }
6038 elsif ($char[$i] eq '\Q') {
6039 0 while (1) {
6040 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6041 0 last;
6042 }
6043 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
6044 0 last;
6045 }
6046 }
6047 }
6048 elsif ($char[$i] eq '\E') {
6049 }
6050  
6051 # $0 --> $0
6052 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
6053 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6054 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
6055 }
6056 }
6057 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
6058 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6059 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
6060 }
6061 }
6062  
6063 # $$ --> $$
6064 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
6065 }
6066  
6067 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
6068 # $1, $2, $3 --> $1, $2, $3 otherwise
6069 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
6070 0 $char[$i] = e_capture($1);
6071 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6072 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
6073 }
6074 }
6075 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6076 0 $char[$i] = e_capture($1);
6077 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6078 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
6079 }
6080 }
6081  
6082 # $$foo[ ... ] --> $ $foo->[ ... ]
6083 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
6084 0 $char[$i] = e_capture($1.'->'.$2);
6085 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6086 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
6087 }
6088 }
6089  
6090 # $$foo{ ... } --> $ $foo->{ ... }
6091 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
6092 0 $char[$i] = e_capture($1.'->'.$2);
6093 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6094 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
6095 }
6096 }
6097  
6098 # $$foo
6099 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
6100 0 $char[$i] = e_capture($1);
6101 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6102 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
6103 }
6104 }
6105  
6106 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Ecyrillic::PREMATCH()
6107 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
6108 8 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 8 8
6109 0 $char[$i] = '@{[Ecyrillic::ignorecase(Ecyrillic::PREMATCH())]}';
6110 }
6111 else {
6112 8 $char[$i] = '@{[Ecyrillic::PREMATCH()]}';
6113 }
6114 }
6115  
6116 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Ecyrillic::MATCH()
6117 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
6118 8 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 8 8
6119 0 $char[$i] = '@{[Ecyrillic::ignorecase(Ecyrillic::MATCH())]}';
6120 }
6121 else {
6122 8 $char[$i] = '@{[Ecyrillic::MATCH()]}';
6123 }
6124 }
6125  
6126 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Ecyrillic::POSTMATCH()
6127 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
6128 6 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 6 6
6129 0 $char[$i] = '@{[Ecyrillic::ignorecase(Ecyrillic::POSTMATCH())]}';
6130 }
6131 else {
6132 6 $char[$i] = '@{[Ecyrillic::POSTMATCH()]}';
6133 }
6134 }
6135  
6136 # ${ foo }
6137 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
6138 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6139 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
6140 }
6141 }
6142  
6143 # ${ ... }
6144 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
6145 0 $char[$i] = e_capture($1);
6146 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6147 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
6148 }
6149 }
6150  
6151 # $scalar or @array
6152 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
6153 21 $char[$i] = e_string($char[$i]);
6154 21 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 11 10 21
6155 11 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
6156 }
6157 }
6158  
6159 # quote character before ? + * {
6160 ▶ 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
6161 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
6162 }
6163 ▶ 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
6164 0 my $char = $char[$i-1];
6165 0 ▶ if ($char[$i] eq '{') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq '{') { } 0 0 0
6166 0 die __FILE__, qq{: "MULTIBYTE{n}" should be "(MULTIBYTE){n}" in m?? (and shift \$1,\$2,\$3,...) ($char){n}\n};
6167 }
6168 else {
6169 0 die __FILE__, qq{: "MULTIBYTE$char[$i]" should be "(MULTIBYTE)$char[$i]" in m?? (and shift \$1,\$2,\$3,...) ($char)$char[$i]\n};
6170 }
6171 }
6172 else {
6173 127 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6174 }
6175 }
6176 }
6177  
6178 # make regexp string
6179 870 $modifier =~ tr/i//d;
6180 870 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 870 870
6181 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
6182 0 return join '', $ope, $delimiter, $anchor, @char, '>]}' x ($left_e - $right_e), $matched, $end_delimiter, $modifier;
6183 }
6184 else {
6185 0 return join '', $ope, $delimiter, $anchor, '(?:', @char, '>]}' x ($left_e - $right_e), ')', $matched, $end_delimiter, $modifier;
6186 }
6187 }
6188 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
6189 0 return join '', $ope, $delimiter, $anchor, @char, $matched, $end_delimiter, $modifier;
6190 }
6191 else {
6192 870 return join '', $ope, $delimiter, $anchor, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6193 }
6194 }
6195  
6196 #
6197 # double quote stuff
6198 #
6199 180 ▶sub qq_stuff {
Subroutine qq_stuff: called CC=6 SCAR=18.5
Pod undocumented
6200 180 my($delimiter,$end_delimiter,$stuff) = @_;
6201  
6202 # scalar variable or array variable
6203 180 ▶ if ($stuff =~ /\A [\$\@] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($stuff =~ /\A [\$\@] /mosx) 100 80 180
6204 100 return $stuff;
6205 }
6206  
6207 # quote by delimiter
6208 80 my %octet = map {$_ => 1} ($stuff =~ /\G ([\x00-\xFF]) /oxmsg);
6209 80 for my $char (qw( ! " $ % & * + - . / : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
6210 80 ▶ next if $char eq $delimiter;
Branch: 1 branch
BranchTrueFalseTotal
if $char eq $delimiter 0 80 80
6211 80 ▶ next if $char eq $end_delimiter;
Branch: 1 branch
BranchTrueFalseTotal
if $char eq $end_delimiter 0 80 80
6212 80 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 80 0 80
6213 80 return join '', 'qq', $char, $stuff, $char;
6214 }
6215 }
6216 0 return join '', 'qq', '<', $stuff, '>';
6217 }
6218  
6219 #
6220 # escape regexp (m'', qr'', and m''b, qr''b)
6221 #
6222 10 ▶sub e_qr_q {
Subroutine e_qr_q: called CC=7 SCAR=25.3
Pod undocumented
6223 10 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6224 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
6225  
6226 10 $modifier =~ tr/p//d;
6227 10 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 10 10
6228 0 my $line = 0;
6229 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6230 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6231 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6232 0 last;
6233 }
6234 }
6235 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6236 }
6237  
6238 10 $slash = 'div';
6239  
6240 # literal null string pattern
6241 10 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 2 10
elsif ($modifier =~ tr/Bb//d) { } 0 2 2
6242 8 $modifier =~ tr/bB//d;
6243 8 $modifier =~ tr/i//d;
6244 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
6245 }
6246  
6247 # with /b /B modifier
6248 elsif ($modifier =~ tr/bB//d) {
6249 0 return e_qr_qb($ope,$delimiter,$end_delimiter,$string,$modifier);
6250 }
6251  
6252 # without /b /B modifier
6253 else {
6254 2 return e_qr_qt($ope,$delimiter,$end_delimiter,$string,$modifier);
6255 }
6256 }
6257  
6258 #
6259 # escape regexp (m'', qr'')
6260 #
6261 2 ▶sub e_qr_qt {
Subroutine e_qr_qt: called CC=20 SCAR=51.8
Pod undocumented
6262 2 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6263  
6264 2 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 2 2
6265  
6266 # split regexp
6267 2 my @char = $string =~ /\G((?>
6268 [^\\\[\$\@\/] |
6269 [\x00-\xFF] |
6270 \[\^ |
6271 \[\: (?>[a-z]+) \:\] |
6272 \[\:\^ (?>[a-z]+) \:\] |
6273 [\$\@\/] |
6274 \\ (?:$q_char) |
6275 (?:$q_char)
6276 ))/oxmsg;
6277  
6278 # unescape character
6279 2 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 2 2 4
6280 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
6281 }
6282  
6283 # open character class [...]
6284 elsif ($char[$i] eq '[') {
6285 0 my $left = $i;
6286 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6287 0 $i++;
6288 }
6289 0 while (1) {
6290 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6291 0 die __FILE__, ": Unmatched [] in regexp\n";
6292 }
6293 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6294 0 my $right = $i;
6295  
6296 # [...]
6297 0 splice @char, $left, $right-$left+1, Ecyrillic::charlist_qr(@char[$left+1..$right-1], $modifier);
6298  
6299 0 $i = $left;
6300 0 last;
6301 }
6302 }
6303 }
6304  
6305 # open character class [^...]
6306 elsif ($char[$i] eq '[^') {
6307 0 my $left = $i;
6308 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6309 0 $i++;
6310 }
6311 0 while (1) {
6312 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6313 0 die __FILE__, ": Unmatched [] in regexp\n";
6314 }
6315 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6316 0 my $right = $i;
6317  
6318 # [^...]
6319 0 splice @char, $left, $right-$left+1, Ecyrillic::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6320  
6321 0 $i = $left;
6322 0 last;
6323 }
6324 }
6325 }
6326  
6327 # escape $ @ / and \
6328 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6329 0 $char[$i] = '\\' . $char[$i];
6330 }
6331  
6332 # rewrite character class or escape character
6333 elsif (my $char = character_class($char[$i],$modifier)) {
6334 0 $char[$i] = $char;
6335 }
6336  
6337 # /i modifier
6338 ▶ 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
6339 0 ▶ if (CORE::length(Ecyrillic::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
6340 0 $char[$i] = '[' . Ecyrillic::uc($char[$i]) . Ecyrillic::fc($char[$i]) . ']';
6341 }
6342 else {
6343 0 $char[$i] = '(?:' . Ecyrillic::uc($char[$i]) . '|' . Ecyrillic::fc($char[$i]) . ')';
6344 }
6345 }
6346  
6347 # quote character before ? + * {
6348 ▶ 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
6349 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
6350 }
6351 else {
6352 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6353 }
6354 }
6355 }
6356  
6357 2 $delimiter = '/';
6358 2 $end_delimiter = '/';
6359  
6360 2 $modifier =~ tr/i//d;
6361 2 return join '', $ope, $delimiter, $anchor, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6362 }
6363  
6364 #
6365 # escape regexp (m''b, qr''b)
6366 #
6367 0 ▶sub e_qr_qb {
Subroutine e_qr_qb: not called CC=4 SCAR=30.0
Pod undocumented
6368 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6369  
6370 # split regexp
6371 0 my @char = $string =~ /\G ((?>[^\\]|\\\\)) /oxmsg;
6372  
6373 # unescape character
6374 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
6375 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
6376 }
6377  
6378 # remain \\
6379 elsif ($char[$i] eq '\\\\') {
6380 }
6381  
6382 # escape $ @ / and \
6383 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6384 0 $char[$i] = '\\' . $char[$i];
6385 }
6386 }
6387  
6388 0 $delimiter = '/';
6389 0 $end_delimiter = '/';
6390 0 return join '', $ope, $delimiter, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6391 }
6392  
6393 #
6394 # escape regexp (s/here//)
6395 #
6396 80 ▶sub e_s1 {
Subroutine e_s1: called CC=106 SCAR=81.1
Pod undocumented
6397 80 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6398 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
6399  
6400 80 $modifier =~ tr/p//d;
6401 80 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 80 80
6402 0 my $line = 0;
6403 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6404 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6405 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6406 0 last;
6407 }
6408 }
6409 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6410 }
6411  
6412 80 $slash = 'div';
6413  
6414 # literal null string pattern
6415 80 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 72 80
elsif ($modifier =~ tr/Bb//d) { } 0 72 72
6416 8 $modifier =~ tr/bB//d;
6417 8 $modifier =~ tr/i//d;
6418 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
6419 }
6420  
6421 # /b /B modifier
6422 elsif ($modifier =~ tr/bB//d) {
6423  
6424 # choice again delimiter
6425 0 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 0 0
6426 0 my @char = $string =~ /\G ([\x00-\xFF]) /oxmsg;
6427 0 my %octet = map {$_ => 1} @char;
6428 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
6429 0 $delimiter = '(';
6430 0 $end_delimiter = ')';
6431 }
6432 elsif (not $octet{'}'}) {
6433 0 $delimiter = '{';
6434 0 $end_delimiter = '}';
6435 }
6436 elsif (not $octet{']'}) {
6437 0 $delimiter = '[';
6438 0 $end_delimiter = ']';
6439 }
6440 elsif (not $octet{'>'}) {
6441 0 $delimiter = '<';
6442 0 $end_delimiter = '>';
6443 }
6444 else {
6445 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
6446 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
6447 0 $delimiter = $char;
6448 0 $end_delimiter = $char;
6449 0 last;
6450 }
6451 }
6452 }
6453 }
6454  
6455 0 my $prematch = '';
6456 0 return join '', $ope, $delimiter, $prematch, '(?:', $string, ')', $matched, $end_delimiter, $modifier;
6457 }
6458  
6459 72 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 1 71 72
6460 72 my $metachar = qr/[\@\\|[\]{^]/oxms;
6461  
6462 # split regexp
6463 72 my @char = $string =~ /\G((?>
6464 [^\\\$\@\[\(] |
6465 \\ (?>[1-9][0-9]*) |
6466 \\g (?>\s*) (?>[1-9][0-9]*) |
6467 \\g (?>\s*) \{ (?>\s*) (?>[1-9][0-9]*) (?>\s*) \} |
6468 \\g (?>\s*) \{ (?>\s*) - (?>\s*) (?>[1-9][0-9]*) (?>\s*) \} |
6469 \\x (?>[0-9A-Fa-f]{1,2}) |
6470 \\ (?>[0-7]{2,3}) |
6471 \\c [\x40-\x5F] |
6472 \\x\{ (?>[0-9A-Fa-f]+) \} |
6473 \\o\{ (?>[0-7]+) \} |
6474 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
6475 \\ $q_char |
6476 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
6477 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
6478 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
6479 [\$\@] $qq_variable |
6480 \$ (?>\s* [0-9]+) |
6481 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
6482 \$ \$ (?![\w\{]) |
6483 \$ (?>\s*) \$ (?>\s*) $qq_variable |
6484 \[\^ |
6485 \[\: (?>[a-z]+) :\] |
6486 \[\:\^ (?>[a-z]+) :\] |
6487 \(\? |
6488 $q_char
6489 ))/oxmsg;
6490  
6491 # choice again delimiter
6492 72 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 72 72
6493 0 my %octet = map {$_ => 1} @char;
6494 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
6495 0 $delimiter = '(';
6496 0 $end_delimiter = ')';
6497 }
6498 elsif (not $octet{'}'}) {
6499 0 $delimiter = '{';
6500 0 $end_delimiter = '}';
6501 }
6502 elsif (not $octet{']'}) {
6503 0 $delimiter = '[';
6504 0 $end_delimiter = ']';
6505 }
6506 elsif (not $octet{'>'}) {
6507 0 $delimiter = '<';
6508 0 $end_delimiter = '>';
6509 }
6510 else {
6511 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
6512 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
6513 0 $delimiter = $char;
6514 0 $end_delimiter = $char;
6515 0 last;
6516 }
6517 }
6518 }
6519 }
6520  
6521 # count '('
6522 72 my $parens = grep { $_ eq '(' } @char;
6523  
6524 72 my $left_e = 0;
6525 72 my $right_e = 0;
6526 72 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 200 72 272
6527  
6528 # "\L\u" --> "\u\L"
6529 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
6530 0 @char[$i,$i+1] = @char[$i+1,$i];
6531 }
6532  
6533 # "\U\l" --> "\l\U"
6534 ▶ 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
6535 0 @char[$i,$i+1] = @char[$i+1,$i];
6536 }
6537  
6538 # octal escape sequence
6539 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
6540 1 $char[$i] = Ecyrillic::octchr($1);
6541 }
6542  
6543 # hexadecimal escape sequence
6544 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
6545 1 $char[$i] = Ecyrillic::hexchr($1);
6546 }
6547  
6548 # \b{...} --> b\{...}
6549 # \B{...} --> B\{...}
6550 # \N{CHARNAME} --> N\{CHARNAME}
6551 # \p{PROPERTY} --> p\{PROPERTY}
6552 # \P{PROPERTY} --> P\{PROPERTY}
6553 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
6554 0 $char[$i] = $1 . '\\' . $2;
6555 }
6556  
6557 # \p, \P, \X --> p, P, X
6558 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
6559 0 $char[$i] = $1;
6560 }
6561  
6562 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
6563 }
6564  
6565 # join separated multiple-octet
6566 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
6567 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
6568 0 $char[$i] .= join '', splice @char, $i+1, 3;
6569 }
6570 ▶ 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
6571 0 $char[$i] .= join '', splice @char, $i+1, 2;
6572 }
6573 ▶ 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
6574 0 $char[$i] .= join '', splice @char, $i+1, 1;
6575 }
6576 }
6577  
6578 # open character class [...]
6579 elsif ($char[$i] eq '[') {
6580 17 my $left = $i;
6581 17 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 17 17
6582 0 $i++;
6583 }
6584 17 while (1) {
6585 74 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 74 74
6586 0 die __FILE__, ": Unmatched [] in regexp\n";
6587 }
6588 74 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 17 57 74
6589 17 my $right = $i;
6590  
6591 # [...]
6592 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
6593 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);
6594 }
6595 else {
6596 17 splice @char, $left, $right-$left+1, Ecyrillic::charlist_qr(@char[$left+1..$right-1], $modifier);
6597 }
6598  
6599 17 $i = $left;
6600 17 last;
6601 }
6602 }
6603 }
6604  
6605 # open character class [^...]
6606 elsif ($char[$i] eq '[^') {
6607 0 my $left = $i;
6608 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6609 0 $i++;
6610 }
6611 0 while (1) {
6612 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6613 0 die __FILE__, ": Unmatched [] in regexp\n";
6614 }
6615 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6616 0 my $right = $i;
6617  
6618 # [^...]
6619 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
6620 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);
6621 }
6622 else {
6623 0 splice @char, $left, $right-$left+1, Ecyrillic::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6624 }
6625  
6626 0 $i = $left;
6627 0 last;
6628 }
6629 }
6630 }
6631  
6632 # rewrite character class or escape character
6633 elsif (my $char = character_class($char[$i],$modifier)) {
6634 7 $char[$i] = $char;
6635 }
6636  
6637 # /i modifier
6638 ▶ 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
6639 3 ▶ if (CORE::length(Ecyrillic::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 3 0 3
6640 3 $char[$i] = '[' . Ecyrillic::uc($char[$i]) . Ecyrillic::fc($char[$i]) . ']';
6641 }
6642 else {
6643 0 $char[$i] = '(?:' . Ecyrillic::uc($char[$i]) . '|' . Ecyrillic::fc($char[$i]) . ')';
6644 }
6645 }
6646  
6647 # \u \l \U \L \F \Q \E
6648 elsif ($char[$i] =~ /\A [<>] \z/oxms) {
6649 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
6650 0 $char[$i] = '\\' . $char[$i];
6651 }
6652 }
6653 elsif ($char[$i] eq '\u') {
6654 0 $char[$i] = '@{[Ecyrillic::ucfirst qq<';
6655 0 $left_e++;
6656 }
6657 elsif ($char[$i] eq '\l') {
6658 0 $char[$i] = '@{[Ecyrillic::lcfirst qq<';
6659 0 $left_e++;
6660 }
6661 elsif ($char[$i] eq '\U') {
6662 0 $char[$i] = '@{[Ecyrillic::uc qq<';
6663 0 $left_e++;
6664 }
6665 elsif ($char[$i] eq '\L') {
6666 0 $char[$i] = '@{[Ecyrillic::lc qq<';
6667 0 $left_e++;
6668 }
6669 elsif ($char[$i] eq '\F') {
6670 0 $char[$i] = '@{[Ecyrillic::fc qq<';
6671 0 $left_e++;
6672 }
6673 elsif ($char[$i] eq '\Q') {
6674 0 $char[$i] = '@{[CORE::quotemeta qq<';
6675 0 $left_e++;
6676 }
6677 elsif ($char[$i] eq '\E') {
6678 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
6679 0 $char[$i] = '>]}';
6680 0 $right_e++;
6681 }
6682 else {
6683 0 $char[$i] = '';
6684 }
6685 }
6686 elsif ($char[$i] eq '\Q') {
6687 0 while (1) {
6688 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6689 0 last;
6690 }
6691 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
6692 0 last;
6693 }
6694 }
6695 }
6696 elsif ($char[$i] eq '\E') {
6697 }
6698  
6699 # \0 --> \0
6700 elsif ($char[$i] =~ /\A \\ (?>\s*) 0 \z/oxms) {
6701 }
6702  
6703 # \g{N}, \g{-N}
6704  
6705 # P.108 Using Simple Patterns
6706 # in Chapter 7: In the World of Regular Expressions
6707 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
6708  
6709 # P.221 Capturing
6710 # in Chapter 5: Pattern Matching
6711 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
6712  
6713 # \g{-1}, \g{-2}, \g{-3} --> \g{-1}, \g{-2}, \g{-3}
6714 elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) - (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6715 }
6716  
6717 # \g{1}, \g{2}, \g{3} --> \g{2}, \g{3}, \g{4} (only when multibyte anchoring is enable)
6718 elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6719 }
6720  
6721 # \g1, \g2, \g3 --> \g2, \g3, \g4 (only when multibyte anchoring is enable)
6722 elsif ($char[$i] =~ /\A \\g (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) {
6723 }
6724  
6725 # \1, \2, \3 --> \2, \3, \4 (only when multibyte anchoring is enable)
6726 elsif ($char[$i] =~ /\A \\ (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) {
6727 }
6728  
6729 # $0 --> $0
6730 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
6731 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6732 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
6733 }
6734 }
6735 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
6736 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6737 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
6738 }
6739 }
6740  
6741 # $$ --> $$
6742 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
6743 }
6744  
6745 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
6746 # $1, $2, $3 --> $1, $2, $3 otherwise
6747 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
6748 0 $char[$i] = e_capture($1);
6749 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6750 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
6751 }
6752 }
6753 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6754 0 $char[$i] = e_capture($1);
6755 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6756 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
6757 }
6758 }
6759  
6760 # $$foo[ ... ] --> $ $foo->[ ... ]
6761 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
6762 0 $char[$i] = e_capture($1.'->'.$2);
6763 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6764 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
6765 }
6766 }
6767  
6768 # $$foo{ ... } --> $ $foo->{ ... }
6769 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
6770 0 $char[$i] = e_capture($1.'->'.$2);
6771 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6772 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
6773 }
6774 }
6775  
6776 # $$foo
6777 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
6778 0 $char[$i] = e_capture($1);
6779 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6780 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
6781 }
6782 }
6783  
6784 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Ecyrillic::PREMATCH()
6785 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
6786 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 4 4
6787 0 $char[$i] = '@{[Ecyrillic::ignorecase(Ecyrillic::PREMATCH())]}';
6788 }
6789 else {
6790 4 $char[$i] = '@{[Ecyrillic::PREMATCH()]}';
6791 }
6792 }
6793  
6794 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Ecyrillic::MATCH()
6795 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
6796 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 4 4
6797 0 $char[$i] = '@{[Ecyrillic::ignorecase(Ecyrillic::MATCH())]}';
6798 }
6799 else {
6800 4 $char[$i] = '@{[Ecyrillic::MATCH()]}';
6801 }
6802 }
6803  
6804 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Ecyrillic::POSTMATCH()
6805 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
6806 3 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 3 3
6807 0 $char[$i] = '@{[Ecyrillic::ignorecase(Ecyrillic::POSTMATCH())]}';
6808 }
6809 else {
6810 3 $char[$i] = '@{[Ecyrillic::POSTMATCH()]}';
6811 }
6812 }
6813  
6814 # ${ foo }
6815 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
6816 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6817 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
6818 }
6819 }
6820  
6821 # ${ ... }
6822 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
6823 0 $char[$i] = e_capture($1);
6824 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6825 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
6826 }
6827 }
6828  
6829 # $scalar or @array
6830 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
6831 4 $char[$i] = e_string($char[$i]);
6832 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 4 4
6833 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
6834 }
6835 }
6836  
6837 # quote character before ? + * {
6838 ▶ 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
6839 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
6840 }
6841 else {
6842 14 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6843 }
6844 }
6845 }
6846  
6847 # make regexp string
6848 72 my $prematch = '';
6849 72 $modifier =~ tr/i//d;
6850 72 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 72 72
6851 0 return join '', $ope, $delimiter, $prematch, '(?:', @char, '>]}' x ($left_e - $right_e), ')', $matched, $end_delimiter, $modifier;
6852 }
6853 72 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6854 }
6855  
6856 #
6857 # escape regexp (s'here'' or s'here''b)
6858 #
6859 21 ▶sub e_s1_q {
Subroutine e_s1_q: called CC=7 SCAR=24.3
Pod undocumented
6860 21 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6861 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
6862  
6863 21 $modifier =~ tr/p//d;
6864 21 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 21 21
6865 0 my $line = 0;
6866 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6867 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6868 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6869 0 last;
6870 }
6871 }
6872 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6873 }
6874  
6875 21 $slash = 'div';
6876  
6877 # literal null string pattern
6878 21 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 13 21
elsif ($modifier =~ tr/Bb//d) { } 0 13 13
6879 8 $modifier =~ tr/bB//d;
6880 8 $modifier =~ tr/i//d;
6881 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
6882 }
6883  
6884 # with /b /B modifier
6885 elsif ($modifier =~ tr/bB//d) {
6886 0 return e_s1_qb($ope,$delimiter,$end_delimiter,$string,$modifier);
6887 }
6888  
6889 # without /b /B modifier
6890 else {
6891 13 return e_s1_qt($ope,$delimiter,$end_delimiter,$string,$modifier);
6892 }
6893 }
6894  
6895 #
6896 # escape regexp (s'here'')
6897 #
6898 13 ▶sub e_s1_qt {
Subroutine e_s1_qt: called CC=20 SCAR=50.1
Pod undocumented
6899 13 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6900  
6901 13 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 13 13
6902  
6903 # split regexp
6904 13 my @char = $string =~ /\G((?>
6905 [^\\\[\$\@\/] |
6906 [\x00-\xFF] |
6907 \[\^ |
6908 \[\: (?>[a-z]+) \:\] |
6909 \[\:\^ (?>[a-z]+) \:\] |
6910 [\$\@\/] |
6911 \\ (?:$q_char) |
6912 (?:$q_char)
6913 ))/oxmsg;
6914  
6915 # unescape character
6916 13 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 25 13 38
6917 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
6918 }
6919  
6920 # open character class [...]
6921 elsif ($char[$i] eq '[') {
6922 0 my $left = $i;
6923 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6924 0 $i++;
6925 }
6926 0 while (1) {
6927 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6928 0 die __FILE__, ": Unmatched [] in regexp\n";
6929 }
6930 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6931 0 my $right = $i;
6932  
6933 # [...]
6934 0 splice @char, $left, $right-$left+1, Ecyrillic::charlist_qr(@char[$left+1..$right-1], $modifier);
6935  
6936 0 $i = $left;
6937 0 last;
6938 }
6939 }
6940 }
6941  
6942 # open character class [^...]
6943 elsif ($char[$i] eq '[^') {
6944 0 my $left = $i;
6945 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6946 0 $i++;
6947 }
6948 0 while (1) {
6949 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6950 0 die __FILE__, ": Unmatched [] in regexp\n";
6951 }
6952 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6953 0 my $right = $i;
6954  
6955 # [^...]
6956 0 splice @char, $left, $right-$left+1, Ecyrillic::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6957  
6958 0 $i = $left;
6959 0 last;
6960 }
6961 }
6962 }
6963  
6964 # escape $ @ / and \
6965 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6966 0 $char[$i] = '\\' . $char[$i];
6967 }
6968  
6969 # rewrite character class or escape character
6970 elsif (my $char = character_class($char[$i],$modifier)) {
6971 6 $char[$i] = $char;
6972 }
6973  
6974 # /i modifier
6975 ▶ 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
6976 0 ▶ if (CORE::length(Ecyrillic::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
6977 0 $char[$i] = '[' . Ecyrillic::uc($char[$i]) . Ecyrillic::fc($char[$i]) . ']';
6978 }
6979 else {
6980 0 $char[$i] = '(?:' . Ecyrillic::uc($char[$i]) . '|' . Ecyrillic::fc($char[$i]) . ')';
6981 }
6982 }
6983  
6984 # quote character before ? + * {
6985 ▶ 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
6986 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
6987 }
6988 else {
6989 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6990 }
6991 }
6992 }
6993  
6994 13 $modifier =~ tr/i//d;
6995 13 $delimiter = '/';
6996 13 $end_delimiter = '/';
6997 13 my $prematch = '';
6998 13 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6999 }
7000  
7001 #
7002 # escape regexp (s'here''b)
7003 #
7004 0 ▶sub e_s1_qb {
Subroutine e_s1_qb: not called CC=4 SCAR=30.0
Pod undocumented
7005 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
7006  
7007 # split regexp
7008 0 my @char = $string =~ /\G (?>[^\\]|\\\\) /oxmsg;
7009  
7010 # unescape character
7011 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
7012 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
7013 }
7014  
7015 # remain \\
7016 elsif ($char[$i] eq '\\\\') {
7017 }
7018  
7019 # escape $ @ / and \
7020 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
7021 0 $char[$i] = '\\' . $char[$i];
7022 }
7023 }
7024  
7025 0 $delimiter = '/';
7026 0 $end_delimiter = '/';
7027 0 my $prematch = '';
7028 0 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
7029 }
7030  
7031 #
7032 # escape regexp (s''here')
7033 #
7034 16 ▶sub e_s2_q {
Subroutine e_s2_q: called CC=4 SCAR=13.9
Pod undocumented
7035 16 my($ope,$delimiter,$end_delimiter,$string) = @_;
7036  
7037 16 $slash = 'div';
7038  
7039 16 my @char = $string =~ / \G (?>[^\\]|\\\\|$q_char) /oxmsg;
7040 16 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 9 16 25
7041 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
7042 }
7043  
7044 # not escape \\
7045 elsif ($char[$i] =~ /\A \\\\ \z/oxms) {
7046 }
7047  
7048 # escape $ @ / and \
7049 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
7050 5 $char[$i] = '\\' . $char[$i];
7051 }
7052 }
7053  
7054 16 return join '', $ope, $delimiter, @char, $end_delimiter;
7055 }
7056  
7057 #
7058 # escape regexp (s/here/and here/modifier)
7059 #
7060 101 ▶sub e_sub {
Subroutine e_sub: called CC=20 SCAR=32.6
Pod undocumented
7061 101 my($variable,$delimiter1,$pattern,$end_delimiter1,$delimiter2,$replacement,$end_delimiter2,$modifier) = @_;
7062 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
7063  
7064 101 $modifier =~ tr/p//d;
7065 101 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 101 101
7066 0 my $line = 0;
7067 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7068 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
7069 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
7070 0 last;
7071 }
7072 }
7073 0 die qq{Unsupported modifier "$1" used at line $line.\n};
7074 }
7075  
7076 101 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq "") 36 65 101
7077 36 $variable = '$_';
7078 36 $bind_operator = ' =~ ';
7079 }
7080  
7081 101 $slash = 'div';
7082  
7083 # P.128 Start of match (or end of previous match): \G
7084 # P.130 Advanced Use of \G with Perl
7085 # in Chapter 3: Overview of Regular Expression Features and Flavors
7086 # P.312 Iterative Matching: Scalar Context, with /g
7087 # in Chapter 7: Perl
7088 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
7089  
7090 # P.181 Where You Left Off: The \G Assertion
7091 # in Chapter 5: Pattern Matching
7092 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
7093  
7094 # P.220 Where You Left Off: The \G Assertion
7095 # in Chapter 5: Pattern Matching
7096 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
7097  
7098 101 my $e_modifier = $modifier =~ tr/e//d;
7099 101 my $r_modifier = $modifier =~ tr/r//d;
7100  
7101 101 my $my = '';
7102 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
7103 0 $my = $variable;
7104 0 $variable =~ s/ (?: local \b | my \b | our \b | state \b ) (?>\s*) //oxms;
7105 0 $variable =~ s/ = .+ \z//oxms;
7106 }
7107  
7108 101 (my $variable_basename = $variable) =~ s/ [\[\{].* \z//oxms;
7109 101 $variable_basename =~ s/ \s+ \z//oxms;
7110  
7111 # quote replacement string
7112 101 my $e_replacement = '';
7113 101 ▶ if ($e_modifier >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($e_modifier >= 1) { } 17 84 101
7114 17 $e_replacement = e_qq('', '', '', $replacement);
7115 17 $e_modifier--;
7116 }
7117 else {
7118 84 ▶ if ($delimiter2 eq "'") {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter2 eq q[']) { } 16 68 84
7119 16 $e_replacement = e_s2_q('qq', '/', '/', $replacement);
7120 }
7121 else {
7122 68 $e_replacement = e_qq ('qq', $delimiter2, $end_delimiter2, $replacement);
7123 }
7124 }
7125  
7126 101 my $sub = '';
7127  
7128 # with /r
7129 101 ▶ if ($r_modifier) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r_modifier) { } 10 91 101
7130 10 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $modifier =~ /g/mosx }) { } 5 5 10
7131 }
7132  
7133 # s///gr without multibyte anchoring
7134 elsif ($modifier =~ /g/oxms) {
7135 5 ▶ $sub = sprintf(
Branch: 1 branch
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 0 5 5
7136 # 1 2 3 4 5
7137 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}>,
7138  
7139 $variable, # 1
7140 ($delimiter1 eq "'") ? # 2
7141 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
7142 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
7143 $s_matched, # 3
7144 $e_replacement, # 4
7145 '$Ecyrillic::re_r=CORE::eval $Ecyrillic::re_r; ' x $e_modifier, # 5
7146 );
7147 }
7148  
7149 # s///r
7150 else {
7151  
7152 5 my $prematch = q{$`};
7153  
7154 5 ▶ $sub = sprintf(
Branch: 1 branch
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 0 5 5
7155 # 1 2 3 4 5 6 7
7156 q<(%s =~ %s) ? CORE::eval{%s local $^W=0; local $Ecyrillic::re_r=%s; %s"%s$Ecyrillic::re_r$'" } : %s>,
7157  
7158 $variable, # 1
7159 ($delimiter1 eq "'") ? # 2
7160 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
7161 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
7162 $s_matched, # 3
7163 $e_replacement, # 4
7164 '$Ecyrillic::re_r=CORE::eval $Ecyrillic::re_r; ' x $e_modifier, # 5
7165 $prematch, # 6
7166 $variable, # 7
7167 );
7168 }
7169  
7170 # $var !~ s///r doesn't make sense
7171 10 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) 0 10 10
7172 0 $sub = q{die("$0: Using !~ with s///r doesn't make sense"), } . $sub;
7173 }
7174 }
7175  
7176 # without /r
7177 else {
7178 91 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $modifier =~ /g/mosx }) { } 23 68 91
7179 }
7180  
7181 # s///g without multibyte anchoring
7182 elsif ($modifier =~ /g/oxms) {
7183 23 ▶ $sub = sprintf(
Branch: 2 branches
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 3 20 23
$bind_operator =~ / !~ /mosx ? : 3 20 23
7184 # 1 2 3 4 5 6 7 8
7185 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}>,
7186  
7187 $variable, # 1
7188 ($delimiter1 eq "'") ? # 2
7189 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
7190 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
7191 $s_matched, # 3
7192 $e_replacement, # 4
7193 '$Ecyrillic::re_r=CORE::eval $Ecyrillic::re_r; ' x $e_modifier, # 5
7194 $variable, # 6
7195 $variable, # 7
7196 ($bind_operator =~ / !~ /oxms) ? '!' : '', # 8
7197 );
7198 }
7199  
7200 # s///
7201 else {
7202  
7203 68 my $prematch = q{$`};
7204  
7205 68 ▶ $sub = sprintf(
Branch: 2 branches
BranchTrueFalseTotal
$bind_operator =~ / =~ /mosx ? : 65 3 68
$delimiter1 eq q['] ? : 18 50 68
7206  
7207 ($bind_operator =~ / =~ /oxms) ?
7208  
7209 # 1 2 3 4 5 6 7 8
7210 q<(%s%s%s) ? CORE::eval{%s local $^W=0; local $Ecyrillic::re_r=%s; %s%s="%s$Ecyrillic::re_r$'"; 1 } : undef> :
7211  
7212 # 1 2 3 4 5 6 7 8
7213 q<(%s%s%s) ? 1 : CORE::eval{%s local $^W=0; local $Ecyrillic::re_r=%s; %s%s="%s$Ecyrillic::re_r$'"; undef }>,
7214  
7215 $variable, # 1
7216 $bind_operator, # 2
7217 ($delimiter1 eq "'") ? # 3
7218 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
7219 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
7220 $s_matched, # 4
7221 $e_replacement, # 5
7222 '$Ecyrillic::re_r=CORE::eval $Ecyrillic::re_r; ' x $e_modifier, # 6
7223 $variable, # 7
7224 $prematch, # 8
7225 );
7226 }
7227 }
7228  
7229 # (my $foo = $bar) =~ s/// --> (my $foo = $bar, CORE::eval { ... })[1]
7230 101 ▶ if ($my ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($my ne "") 0 101 101
7231 0 $sub = "($my, $sub)[1]";
7232 }
7233  
7234 # clear s/// variable
7235 101 $sub_variable = '';
7236 101 $bind_operator = '';
7237  
7238 101 return $sub;
7239 }
7240  
7241 #
7242 # escape regexp of split qr//
7243 #
7244 74 ▶sub e_split {
Subroutine e_split: called CC=88 SCAR=76.4
Pod undocumented
7245 74 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
7246 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
7247  
7248 74 $modifier =~ tr/p//d;
7249 74 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 74 74
7250 0 my $line = 0;
7251 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7252 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
7253 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
7254 0 last;
7255 }
7256 }
7257 0 die qq{Unsupported modifier "$1" used at line $line.\n};
7258 }
7259  
7260 74 $slash = 'div';
7261  
7262 # /b /B modifier
7263 74 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) 0 74 74
7264 0 return join '', 'split', $ope, $delimiter, $string, $end_delimiter, $modifier;
7265 }
7266  
7267 74 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 74 74
7268 74 my $metachar = qr/[\@\\|[\]{^]/oxms;
7269  
7270 # split regexp
7271 74 my @char = $string =~ /\G((?>
7272 [^\\\$\@\[\(] |
7273 \\x (?>[0-9A-Fa-f]{1,2}) |
7274 \\ (?>[0-7]{2,3}) |
7275 \\c [\x40-\x5F] |
7276 \\x\{ (?>[0-9A-Fa-f]+) \} |
7277 \\o\{ (?>[0-7]+) \} |
7278 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
7279 \\ $q_char |
7280 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
7281 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
7282 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
7283 [\$\@] $qq_variable |
7284 \$ (?>\s* [0-9]+) |
7285 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
7286 \$ \$ (?![\w\{]) |
7287 \$ (?>\s*) \$ (?>\s*) $qq_variable |
7288 \[\^ |
7289 \[\: (?>[a-z]+) :\] |
7290 \[\:\^ (?>[a-z]+) :\] |
7291 \(\? |
7292 $q_char
7293 ))/oxmsg;
7294  
7295 74 my $left_e = 0;
7296 74 my $right_e = 0;
7297 74 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 249 74 323
7298  
7299 # "\L\u" --> "\u\L"
7300 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
7301 0 @char[$i,$i+1] = @char[$i+1,$i];
7302 }
7303  
7304 # "\U\l" --> "\l\U"
7305 ▶ 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
7306 0 @char[$i,$i+1] = @char[$i+1,$i];
7307 }
7308  
7309 # octal escape sequence
7310 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
7311 1 $char[$i] = Ecyrillic::octchr($1);
7312 }
7313  
7314 # hexadecimal escape sequence
7315 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
7316 1 $char[$i] = Ecyrillic::hexchr($1);
7317 }
7318  
7319 # \b{...} --> b\{...}
7320 # \B{...} --> B\{...}
7321 # \N{CHARNAME} --> N\{CHARNAME}
7322 # \p{PROPERTY} --> p\{PROPERTY}
7323 # \P{PROPERTY} --> P\{PROPERTY}
7324 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
7325 0 $char[$i] = $1 . '\\' . $2;
7326 }
7327  
7328 # \p, \P, \X --> p, P, X
7329 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
7330 0 $char[$i] = $1;
7331 }
7332  
7333 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
7334 }
7335  
7336 # join separated multiple-octet
7337 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
7338 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
7339 0 $char[$i] .= join '', splice @char, $i+1, 3;
7340 }
7341 ▶ 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
7342 0 $char[$i] .= join '', splice @char, $i+1, 2;
7343 }
7344 ▶ 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
7345 0 $char[$i] .= join '', splice @char, $i+1, 1;
7346 }
7347 }
7348  
7349 # open character class [...]
7350 elsif ($char[$i] eq '[') {
7351 3 my $left = $i;
7352 3 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 3 3
7353 0 $i++;
7354 }
7355 3 while (1) {
7356 7 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 7 7
7357 0 die __FILE__, ": Unmatched [] in regexp\n";
7358 }
7359 7 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 3 4 7
7360 3 my $right = $i;
7361  
7362 # [...]
7363 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
7364 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);
7365 }
7366 else {
7367 3 splice @char, $left, $right-$left+1, Ecyrillic::charlist_qr(@char[$left+1..$right-1], $modifier);
7368 }
7369  
7370 3 $i = $left;
7371 3 last;
7372 }
7373 }
7374 }
7375  
7376 # open character class [^...]
7377 elsif ($char[$i] eq '[^') {
7378 0 my $left = $i;
7379 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7380 0 $i++;
7381 }
7382 0 while (1) {
7383 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7384 0 die __FILE__, ": Unmatched [] in regexp\n";
7385 }
7386 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7387 0 my $right = $i;
7388  
7389 # [^...]
7390 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
7391 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);
7392 }
7393 else {
7394 0 splice @char, $left, $right-$left+1, Ecyrillic::charlist_not_qr(@char[$left+1..$right-1], $modifier);
7395 }
7396  
7397 0 $i = $left;
7398 0 last;
7399 }
7400 }
7401 }
7402  
7403 # rewrite character class or escape character
7404 elsif (my $char = character_class($char[$i],$modifier)) {
7405 1 $char[$i] = $char;
7406 }
7407  
7408 # P.794 29.2.161. split
7409 # in Chapter 29: Functions
7410 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
7411  
7412 # P.951 split
7413 # in Chapter 27: Functions
7414 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
7415  
7416 # said "The //m modifier is assumed when you split on the pattern /^/",
7417 # but perl5.008 is not so. Therefore, this software adds //m.
7418 # (and so on)
7419  
7420 # split(m/^/) --> split(m/^/m)
7421 ▶ 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
7422 7 $modifier .= 'm';
7423 }
7424  
7425 # /i modifier
7426 ▶ 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
7427 0 ▶ if (CORE::length(Ecyrillic::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
7428 0 $char[$i] = '[' . Ecyrillic::uc($char[$i]) . Ecyrillic::fc($char[$i]) . ']';
7429 }
7430 else {
7431 0 $char[$i] = '(?:' . Ecyrillic::uc($char[$i]) . '|' . Ecyrillic::fc($char[$i]) . ')';
7432 }
7433 }
7434  
7435 # \u \l \U \L \F \Q \E
7436 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
7437 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
7438 0 $char[$i] = '\\' . $char[$i];
7439 }
7440 }
7441 elsif ($char[$i] eq '\u') {
7442 0 $char[$i] = '@{[Ecyrillic::ucfirst qq<';
7443 0 $left_e++;
7444 }
7445 elsif ($char[$i] eq '\l') {
7446 0 $char[$i] = '@{[Ecyrillic::lcfirst qq<';
7447 0 $left_e++;
7448 }
7449 elsif ($char[$i] eq '\U') {
7450 0 $char[$i] = '@{[Ecyrillic::uc qq<';
7451 0 $left_e++;
7452 }
7453 elsif ($char[$i] eq '\L') {
7454 0 $char[$i] = '@{[Ecyrillic::lc qq<';
7455 0 $left_e++;
7456 }
7457 elsif ($char[$i] eq '\F') {
7458 0 $char[$i] = '@{[Ecyrillic::fc qq<';
7459 0 $left_e++;
7460 }
7461 elsif ($char[$i] eq '\Q') {
7462 0 $char[$i] = '@{[CORE::quotemeta qq<';
7463 0 $left_e++;
7464 }
7465 elsif ($char[$i] eq '\E') {
7466 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
7467 0 $char[$i] = '>]}';
7468 0 $right_e++;
7469 }
7470 else {
7471 0 $char[$i] = '';
7472 }
7473 }
7474 elsif ($char[$i] eq '\Q') {
7475 0 while (1) {
7476 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7477 0 last;
7478 }
7479 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
7480 0 last;
7481 }
7482 }
7483 }
7484 elsif ($char[$i] eq '\E') {
7485 }
7486  
7487 # $0 --> $0
7488 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
7489 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7490 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
7491 }
7492 }
7493 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
7494 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7495 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
7496 }
7497 }
7498  
7499 # $$ --> $$
7500 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
7501 }
7502  
7503 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
7504 # $1, $2, $3 --> $1, $2, $3 otherwise
7505 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
7506 0 $char[$i] = e_capture($1);
7507 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7508 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
7509 }
7510 }
7511 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
7512 0 $char[$i] = e_capture($1);
7513 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7514 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
7515 }
7516 }
7517  
7518 # $$foo[ ... ] --> $ $foo->[ ... ]
7519 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
7520 0 $char[$i] = e_capture($1.'->'.$2);
7521 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7522 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
7523 }
7524 }
7525  
7526 # $$foo{ ... } --> $ $foo->{ ... }
7527 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
7528 0 $char[$i] = e_capture($1.'->'.$2);
7529 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7530 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
7531 }
7532 }
7533  
7534 # $$foo
7535 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
7536 0 $char[$i] = e_capture($1);
7537 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7538 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
7539 }
7540 }
7541  
7542 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Ecyrillic::PREMATCH()
7543 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
7544 12 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 12 12
7545 0 $char[$i] = '@{[Ecyrillic::ignorecase(Ecyrillic::PREMATCH())]}';
7546 }
7547 else {
7548 12 $char[$i] = '@{[Ecyrillic::PREMATCH()]}';
7549 }
7550 }
7551  
7552 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Ecyrillic::MATCH()
7553 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
7554 12 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 12 12
7555 0 $char[$i] = '@{[Ecyrillic::ignorecase(Ecyrillic::MATCH())]}';
7556 }
7557 else {
7558 12 $char[$i] = '@{[Ecyrillic::MATCH()]}';
7559 }
7560 }
7561  
7562 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Ecyrillic::POSTMATCH()
7563 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
7564 9 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 9 9
7565 0 $char[$i] = '@{[Ecyrillic::ignorecase(Ecyrillic::POSTMATCH())]}';
7566 }
7567 else {
7568 9 $char[$i] = '@{[Ecyrillic::POSTMATCH()]}';
7569 }
7570 }
7571  
7572 # ${ foo }
7573 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
7574 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7575 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $1 . ')]}';
7576 }
7577 }
7578  
7579 # ${ ... }
7580 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
7581 0 $char[$i] = e_capture($1);
7582 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7583 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
7584 }
7585 }
7586  
7587 # $scalar or @array
7588 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
7589 3 $char[$i] = e_string($char[$i]);
7590 3 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 3 3
7591 0 $char[$i] = '@{[Ecyrillic::ignorecase(' . $char[$i] . ')]}';
7592 }
7593 }
7594  
7595 # quote character before ? + * {
7596 ▶ 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
7597 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
7598 }
7599 else {
7600 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
7601 }
7602 }
7603 }
7604  
7605 # make regexp string
7606 74 $modifier =~ tr/i//d;
7607 74 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 74 74
7608 0 return join '', 'Ecyrillic::split', $ope, $delimiter, @char, '>]}' x ($left_e - $right_e), $end_delimiter, $modifier;
7609 }
7610 74 return join '', 'Ecyrillic::split', $ope, $delimiter, @char, $end_delimiter, $modifier;
7611 }
7612  
7613 #
7614 # escape regexp of split qr''
7615 #
7616 0 ▶sub e_split_q {
Subroutine e_split_q: not called CC=26 SCAR=65.5
Pod undocumented
7617 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
7618 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
7619  
7620 0 $modifier =~ tr/p//d;
7621 0 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 0 0
7622 0 my $line = 0;
7623 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7624 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
7625 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
7626 0 last;
7627 }
7628 }
7629 0 die qq{Unsupported modifier "$1" used at line $line.\n};
7630 }
7631  
7632 0 $slash = 'div';
7633  
7634 # /b /B modifier
7635 0 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) 0 0 0
7636 0 return join '', 'split', $ope, $delimiter, $string, $end_delimiter, $modifier;
7637 }
7638  
7639 0 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 0 0
7640  
7641 # split regexp
7642 0 my @char = $string =~ /\G((?>
7643 [^\\\[] |
7644 [\x00-\xFF] |
7645 \[\^ |
7646 \[\: (?>[a-z]+) \:\] |
7647 \[\:\^ (?>[a-z]+) \:\] |
7648 \\ (?:$q_char) |
7649 (?:$q_char)
7650 ))/oxmsg;
7651  
7652 # unescape character
7653 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
7654 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
7655 }
7656  
7657 # open character class [...]
7658 elsif ($char[$i] eq '[') {
7659 0 my $left = $i;
7660 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7661 0 $i++;
7662 }
7663 0 while (1) {
7664 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7665 0 die __FILE__, ": Unmatched [] in regexp\n";
7666 }
7667 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7668 0 my $right = $i;
7669  
7670 # [...]
7671 0 splice @char, $left, $right-$left+1, Ecyrillic::charlist_qr(@char[$left+1..$right-1], $modifier);
7672  
7673 0 $i = $left;
7674 0 last;
7675 }
7676 }
7677 }
7678  
7679 # open character class [^...]
7680 elsif ($char[$i] eq '[^') {
7681 0 my $left = $i;
7682 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7683 0 $i++;
7684 }
7685 0 while (1) {
7686 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7687 0 die __FILE__, ": Unmatched [] in regexp\n";
7688 }
7689 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7690 0 my $right = $i;
7691  
7692 # [^...]
7693 0 splice @char, $left, $right-$left+1, Ecyrillic::charlist_not_qr(@char[$left+1..$right-1], $modifier);
7694  
7695 0 $i = $left;
7696 0 last;
7697 }
7698 }
7699 }
7700  
7701 # rewrite character class or escape character
7702 elsif (my $char = character_class($char[$i],$modifier)) {
7703 0 $char[$i] = $char;
7704 }
7705  
7706 # split(m/^/) --> split(m/^/m)
7707 ▶ 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
7708 0 $modifier .= 'm';
7709 }
7710  
7711 # /i modifier
7712 ▶ 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
7713 0 ▶ if (CORE::length(Ecyrillic::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
7714 0 $char[$i] = '[' . Ecyrillic::uc($char[$i]) . Ecyrillic::fc($char[$i]) . ']';
7715 }
7716 else {
7717 0 $char[$i] = '(?:' . Ecyrillic::uc($char[$i]) . '|' . Ecyrillic::fc($char[$i]) . ')';
7718 }
7719 }
7720  
7721 # quote character before ? + * {
7722 ▶ 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
7723 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
7724 }
7725 else {
7726 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
7727 }
7728 }
7729 }
7730  
7731 0 $modifier =~ tr/i//d;
7732 0 return join '', 'Ecyrillic::split', $ope, $delimiter, @char, $end_delimiter, $modifier;
7733 }
7734  
7735 #
7736 # instead of Carp::carp
7737 #
7738 0 ▶sub carp {
Subroutine carp: not called CC=1 SCAR=6.9
Pod undocumented
7739 0 my($package,$filename,$line) = caller(1);
7740 0 print STDERR "@_ at $filename line $line.\n";
7741 }
7742  
7743 #
7744 # instead of Carp::croak
7745 #
7746 0 ▶sub croak {
Subroutine croak: not called CC=1 SCAR=6.9
Pod undocumented
7747 0 my($package,$filename,$line) = caller(1);
7748 0 print STDERR "@_ at $filename line $line.\n";
7749 0 die "\n";
7750 }
7751  
7752 #
7753 # instead of Carp::cluck
7754 #
7755 0 ▶sub cluck {
Subroutine cluck: not called CC=2 SCAR=17.9
Pod undocumented
7756 0 my $i = 0;
7757 0 my @cluck = ();
7758 0 ▶ while (my($package,$filename,$line,$subroutine) = caller($i)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7759 0 push @cluck, "[$i] $filename($line) $package::$subroutine\n";
7760 0 $i++;
7761 }
7762 0 print STDERR CORE::reverse @cluck;
7763 0 print STDERR "\n";
7764 0 print STDERR @_;
7765 }
7766  
7767 #
7768 # instead of Carp::confess
7769 #
7770 0 ▶sub confess {
Subroutine confess: not called CC=2 SCAR=17.9
Pod undocumented
7771 0 my $i = 0;
7772 0 my @confess = ();
7773 0 ▶ while (my($package,$filename,$line,$subroutine) = caller($i)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7774 0 push @confess, "[$i] $filename($line) $package::$subroutine\n";
7775 0 $i++;
7776 }
7777 0 print STDERR CORE::reverse @confess;
7778 0 print STDERR "\n";
7779 0 print STDERR @_;
7780 0 die "\n";
7781 }
7782  
7783 422 1;
7784  
7785 __END__
↑ Summary blib/lib/Cyrillic.pm »