blib/lib/Elatin8.pm

filter: Statementstmt 36.4% 1198 / 3286 Branchbran 38.6% 1141 / 2954 Conditioncond 31.0% 115 / 370 MC/DCmcdc 15.9% 35 / 220 Subroutinesub 60.8% 73 / 120 Podpod 4.6% 3 / 64 totaltotal 36.5% 2565 / 7014 CC 1648 SCAR 99.4
CC
1648
Cov
37%
escape_token
55669.4
e_string
33636.6
e_s1
3320.4
CRAP 20709.5
↑ Summary blib/lib/Latin8.pm »
1 package Elatin8;
2 422 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 ######################################################################
4 #
5 # Elatin8 - Run-time routines for Latin8.pm
6 #
7 # http://search.cpan.org/dist/Char-Latin8/
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 (&Elatin8::index($name, '::') >= 0) { } 0 15 15
elsif (&Elatin8::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 (Elatin8::index($name,'::') >= 0) {
83 0 return $name;
84 }
85 elsif (Elatin8::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 # Latin-8 character range per length
158 #
159 422 my %range_tr = ();
160  
161 #
162 # Latin-8 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 Elatin8 \z/mosx }) { } 422 0 422
175 }
176  
177 elsif (__PACKAGE__ =~ / \b Elatin8 \z/oxms) {
178 422 %range_tr = (
179 1 => [ [0x00..0xFF],
180 ],
181 );
182  
183 422 %lc = (%lc,
184 "\xA1" => "\xA2", # LATIN LETTER B WITH DOT ABOVE
185 "\xA4" => "\xA5", # LATIN LETTER C WITH DOT ABOVE
186 "\xA6" => "\xAB", # LATIN LETTER D WITH DOT ABOVE
187 "\xA8" => "\xB8", # LATIN LETTER W WITH GRAVE
188 "\xAA" => "\xBA", # LATIN LETTER W WITH ACUTE
189 "\xAC" => "\xBC", # LATIN LETTER Y WITH GRAVE
190 "\xAF" => "\xFF", # LATIN LETTER Y WITH DIAERESIS
191 "\xB0" => "\xB1", # LATIN LETTER F WITH DOT ABOVE
192 "\xB2" => "\xB3", # LATIN LETTER G WITH DOT ABOVE
193 "\xB4" => "\xB5", # LATIN LETTER M WITH DOT ABOVE
194 "\xB7" => "\xB9", # LATIN LETTER P WITH DOT ABOVE
195 "\xBB" => "\xBF", # LATIN LETTER S WITH DOT ABOVE
196 "\xBD" => "\xBE", # LATIN LETTER W WITH DIAERESIS
197 "\xC0" => "\xE0", # LATIN LETTER A WITH GRAVE
198 "\xC1" => "\xE1", # LATIN LETTER A WITH ACUTE
199 "\xC2" => "\xE2", # LATIN LETTER A WITH CIRCUMFLEX
200 "\xC3" => "\xE3", # LATIN LETTER A WITH TILDE
201 "\xC4" => "\xE4", # LATIN LETTER A WITH DIAERESIS
202 "\xC5" => "\xE5", # LATIN LETTER A WITH RING ABOVE
203 "\xC6" => "\xE6", # LATIN LETTER AE
204 "\xC7" => "\xE7", # LATIN LETTER C WITH CEDILLA
205 "\xC8" => "\xE8", # LATIN LETTER E WITH GRAVE
206 "\xC9" => "\xE9", # LATIN LETTER E WITH ACUTE
207 "\xCA" => "\xEA", # LATIN LETTER E WITH CIRCUMFLEX
208 "\xCB" => "\xEB", # LATIN LETTER E WITH DIAERESIS
209 "\xCC" => "\xEC", # LATIN LETTER I WITH GRAVE
210 "\xCD" => "\xED", # LATIN LETTER I WITH ACUTE
211 "\xCE" => "\xEE", # LATIN LETTER I WITH CIRCUMFLEX
212 "\xCF" => "\xEF", # LATIN LETTER I WITH DIAERESIS
213 "\xD0" => "\xF0", # LATIN LETTER W WITH CIRCUMFLEX
214 "\xD1" => "\xF1", # LATIN LETTER N WITH TILDE
215 "\xD2" => "\xF2", # LATIN LETTER O WITH GRAVE
216 "\xD3" => "\xF3", # LATIN LETTER O WITH ACUTE
217 "\xD4" => "\xF4", # LATIN LETTER O WITH CIRCUMFLEX
218 "\xD5" => "\xF5", # LATIN LETTER O WITH TILDE
219 "\xD6" => "\xF6", # LATIN LETTER O WITH DIAERESIS
220 "\xD7" => "\xF7", # LATIN LETTER T WITH DOT ABOVE
221 "\xD8" => "\xF8", # LATIN LETTER O WITH STROKE
222 "\xD9" => "\xF9", # LATIN LETTER U WITH GRAVE
223 "\xDA" => "\xFA", # LATIN LETTER U WITH ACUTE
224 "\xDB" => "\xFB", # LATIN LETTER U WITH CIRCUMFLEX
225 "\xDC" => "\xFC", # LATIN LETTER U WITH DIAERESIS
226 "\xDD" => "\xFD", # LATIN LETTER Y WITH ACUTE
227 "\xDE" => "\xFE", # LATIN LETTER Y WITH CIRCUMFLEX
228 );
229  
230 422 %uc = (%uc,
231 "\xA2" => "\xA1", # LATIN LETTER B WITH DOT ABOVE
232 "\xA5" => "\xA4", # LATIN LETTER C WITH DOT ABOVE
233 "\xAB" => "\xA6", # LATIN LETTER D WITH DOT ABOVE
234 "\xB1" => "\xB0", # LATIN LETTER F WITH DOT ABOVE
235 "\xB3" => "\xB2", # LATIN LETTER G WITH DOT ABOVE
236 "\xB5" => "\xB4", # LATIN LETTER M WITH DOT ABOVE
237 "\xB8" => "\xA8", # LATIN LETTER W WITH GRAVE
238 "\xB9" => "\xB7", # LATIN LETTER P WITH DOT ABOVE
239 "\xBA" => "\xAA", # LATIN LETTER W WITH ACUTE
240 "\xBC" => "\xAC", # LATIN LETTER Y WITH GRAVE
241 "\xBE" => "\xBD", # LATIN LETTER W WITH DIAERESIS
242 "\xBF" => "\xBB", # LATIN LETTER S WITH DOT ABOVE
243 "\xE0" => "\xC0", # LATIN LETTER A WITH GRAVE
244 "\xE1" => "\xC1", # LATIN LETTER A WITH ACUTE
245 "\xE2" => "\xC2", # LATIN LETTER A WITH CIRCUMFLEX
246 "\xE3" => "\xC3", # LATIN LETTER A WITH TILDE
247 "\xE4" => "\xC4", # LATIN LETTER A WITH DIAERESIS
248 "\xE5" => "\xC5", # LATIN LETTER A WITH RING ABOVE
249 "\xE6" => "\xC6", # LATIN LETTER AE
250 "\xE7" => "\xC7", # LATIN LETTER C WITH CEDILLA
251 "\xE8" => "\xC8", # LATIN LETTER E WITH GRAVE
252 "\xE9" => "\xC9", # LATIN LETTER E WITH ACUTE
253 "\xEA" => "\xCA", # LATIN LETTER E WITH CIRCUMFLEX
254 "\xEB" => "\xCB", # LATIN LETTER E WITH DIAERESIS
255 "\xEC" => "\xCC", # LATIN LETTER I WITH GRAVE
256 "\xED" => "\xCD", # LATIN LETTER I WITH ACUTE
257 "\xEE" => "\xCE", # LATIN LETTER I WITH CIRCUMFLEX
258 "\xEF" => "\xCF", # LATIN LETTER I WITH DIAERESIS
259 "\xF0" => "\xD0", # LATIN LETTER W WITH CIRCUMFLEX
260 "\xF1" => "\xD1", # LATIN LETTER N WITH TILDE
261 "\xF2" => "\xD2", # LATIN LETTER O WITH GRAVE
262 "\xF3" => "\xD3", # LATIN LETTER O WITH ACUTE
263 "\xF4" => "\xD4", # LATIN LETTER O WITH CIRCUMFLEX
264 "\xF5" => "\xD5", # LATIN LETTER O WITH TILDE
265 "\xF6" => "\xD6", # LATIN LETTER O WITH DIAERESIS
266 "\xF7" => "\xD7", # LATIN LETTER T WITH DOT ABOVE
267 "\xF8" => "\xD8", # LATIN LETTER O WITH STROKE
268 "\xF9" => "\xD9", # LATIN LETTER U WITH GRAVE
269 "\xFA" => "\xDA", # LATIN LETTER U WITH ACUTE
270 "\xFB" => "\xDB", # LATIN LETTER U WITH CIRCUMFLEX
271 "\xFC" => "\xDC", # LATIN LETTER U WITH DIAERESIS
272 "\xFD" => "\xDD", # LATIN LETTER Y WITH ACUTE
273 "\xFE" => "\xDE", # LATIN LETTER Y WITH CIRCUMFLEX
274 "\xFF" => "\xAF", # LATIN LETTER Y WITH DIAERESIS
275 );
276  
277 422 %fc = (%fc,
278 "\xA1" => "\xA2", # LATIN CAPITAL LETTER B WITH DOT ABOVE --> LATIN SMALL LETTER B WITH DOT ABOVE
279 "\xA4" => "\xA5", # LATIN CAPITAL LETTER C WITH DOT ABOVE --> LATIN SMALL LETTER C WITH DOT ABOVE
280 "\xA6" => "\xAB", # LATIN CAPITAL LETTER D WITH DOT ABOVE --> LATIN SMALL LETTER D WITH DOT ABOVE
281 "\xA8" => "\xB8", # LATIN CAPITAL LETTER W WITH GRAVE --> LATIN SMALL LETTER W WITH GRAVE
282 "\xAA" => "\xBA", # LATIN CAPITAL LETTER W WITH ACUTE --> LATIN SMALL LETTER W WITH ACUTE
283 "\xAC" => "\xBC", # LATIN CAPITAL LETTER Y WITH GRAVE --> LATIN SMALL LETTER Y WITH GRAVE
284 "\xAF" => "\xFF", # LATIN CAPITAL LETTER Y WITH DIAERESIS --> LATIN SMALL LETTER Y WITH DIAERESIS
285 "\xB0" => "\xB1", # LATIN CAPITAL LETTER F WITH DOT ABOVE --> LATIN SMALL LETTER F WITH DOT ABOVE
286 "\xB2" => "\xB3", # LATIN CAPITAL LETTER G WITH DOT ABOVE --> LATIN SMALL LETTER G WITH DOT ABOVE
287 "\xB4" => "\xB5", # LATIN CAPITAL LETTER M WITH DOT ABOVE --> LATIN SMALL LETTER M WITH DOT ABOVE
288 "\xB7" => "\xB9", # LATIN CAPITAL LETTER P WITH DOT ABOVE --> LATIN SMALL LETTER P WITH DOT ABOVE
289 "\xBB" => "\xBF", # LATIN CAPITAL LETTER S WITH DOT ABOVE --> LATIN SMALL LETTER S WITH DOT ABOVE
290 "\xBD" => "\xBE", # LATIN CAPITAL LETTER W WITH DIAERESIS --> LATIN SMALL LETTER W WITH DIAERESIS
291 "\xC0" => "\xE0", # LATIN CAPITAL LETTER A WITH GRAVE --> LATIN SMALL LETTER A WITH GRAVE
292 "\xC1" => "\xE1", # LATIN CAPITAL LETTER A WITH ACUTE --> LATIN SMALL LETTER A WITH ACUTE
293 "\xC2" => "\xE2", # LATIN CAPITAL LETTER A WITH CIRCUMFLEX --> LATIN SMALL LETTER A WITH CIRCUMFLEX
294 "\xC3" => "\xE3", # LATIN CAPITAL LETTER A WITH TILDE --> LATIN SMALL LETTER A WITH TILDE
295 "\xC4" => "\xE4", # LATIN CAPITAL LETTER A WITH DIAERESIS --> LATIN SMALL LETTER A WITH DIAERESIS
296 "\xC5" => "\xE5", # LATIN CAPITAL LETTER A WITH RING ABOVE --> LATIN SMALL LETTER A WITH RING ABOVE
297 "\xC6" => "\xE6", # LATIN CAPITAL LETTER AE --> LATIN SMALL LETTER AE
298 "\xC7" => "\xE7", # LATIN CAPITAL LETTER C WITH CEDILLA --> LATIN SMALL LETTER C WITH CEDILLA
299 "\xC8" => "\xE8", # LATIN CAPITAL LETTER E WITH GRAVE --> LATIN SMALL LETTER E WITH GRAVE
300 "\xC9" => "\xE9", # LATIN CAPITAL LETTER E WITH ACUTE --> LATIN SMALL LETTER E WITH ACUTE
301 "\xCA" => "\xEA", # LATIN CAPITAL LETTER E WITH CIRCUMFLEX --> LATIN SMALL LETTER E WITH CIRCUMFLEX
302 "\xCB" => "\xEB", # LATIN CAPITAL LETTER E WITH DIAERESIS --> LATIN SMALL LETTER E WITH DIAERESIS
303 "\xCC" => "\xEC", # LATIN CAPITAL LETTER I WITH GRAVE --> LATIN SMALL LETTER I WITH GRAVE
304 "\xCD" => "\xED", # LATIN CAPITAL LETTER I WITH ACUTE --> LATIN SMALL LETTER I WITH ACUTE
305 "\xCE" => "\xEE", # LATIN CAPITAL LETTER I WITH CIRCUMFLEX --> LATIN SMALL LETTER I WITH CIRCUMFLEX
306 "\xCF" => "\xEF", # LATIN CAPITAL LETTER I WITH DIAERESIS --> LATIN SMALL LETTER I WITH DIAERESIS
307 "\xD0" => "\xF0", # LATIN CAPITAL LETTER W WITH CIRCUMFLEX --> LATIN SMALL LETTER W WITH CIRCUMFLEX
308 "\xD1" => "\xF1", # LATIN CAPITAL LETTER N WITH TILDE --> LATIN SMALL LETTER N WITH TILDE
309 "\xD2" => "\xF2", # LATIN CAPITAL LETTER O WITH GRAVE --> LATIN SMALL LETTER O WITH GRAVE
310 "\xD3" => "\xF3", # LATIN CAPITAL LETTER O WITH ACUTE --> LATIN SMALL LETTER O WITH ACUTE
311 "\xD4" => "\xF4", # LATIN CAPITAL LETTER O WITH CIRCUMFLEX --> LATIN SMALL LETTER O WITH CIRCUMFLEX
312 "\xD5" => "\xF5", # LATIN CAPITAL LETTER O WITH TILDE --> LATIN SMALL LETTER O WITH TILDE
313 "\xD6" => "\xF6", # LATIN CAPITAL LETTER O WITH DIAERESIS --> LATIN SMALL LETTER O WITH DIAERESIS
314 "\xD7" => "\xF7", # LATIN CAPITAL LETTER T WITH DOT ABOVE --> LATIN SMALL LETTER T WITH DOT ABOVE
315 "\xD8" => "\xF8", # LATIN CAPITAL LETTER O WITH STROKE --> LATIN SMALL LETTER O WITH STROKE
316 "\xD9" => "\xF9", # LATIN CAPITAL LETTER U WITH GRAVE --> LATIN SMALL LETTER U WITH GRAVE
317 "\xDA" => "\xFA", # LATIN CAPITAL LETTER U WITH ACUTE --> LATIN SMALL LETTER U WITH ACUTE
318 "\xDB" => "\xFB", # LATIN CAPITAL LETTER U WITH CIRCUMFLEX --> LATIN SMALL LETTER U WITH CIRCUMFLEX
319 "\xDC" => "\xFC", # LATIN CAPITAL LETTER U WITH DIAERESIS --> LATIN SMALL LETTER U WITH DIAERESIS
320 "\xDD" => "\xFD", # LATIN CAPITAL LETTER Y WITH ACUTE --> LATIN SMALL LETTER Y WITH ACUTE
321 "\xDE" => "\xFE", # LATIN CAPITAL LETTER Y WITH CIRCUMFLEX --> LATIN SMALL LETTER Y WITH CIRCUMFLEX
322 "\xDF" => "\x73\x73", # LATIN SMALL LETTER SHARP S --> LATIN SMALL LETTER S, LATIN SMALL LETTER S
323 );
324 }
325  
326 else {
327 0 croak "Don't know my package name '@{[__PACKAGE__]}'";
328 }
329  
330 #
331 # @ARGV wildcard globbing
332 #
333 211 ▶sub import {
Subroutine import: called CC=7 SCAR=28.3
334  
335 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
336 0 my @argv = ();
337 0 for (@ARGV) {
338  
339 # has space
340 0 ▶ if (/\A (?:$q_char)*? [ ] /oxms) {
Branch: 2 branches
BranchTrueFalseTotal
if (/\A (?:$Elatin8::q_char)*? [ ] /mosx) { } 0 0 0
elsif (/\A (?:$Elatin8::q_char)*? [*?] /mosx) { } 0 0 0
341 0 ▶ if (my @glob = Elatin8::glob(qq{"$_"})) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@glob) = &Elatin8::glob(qq["$_"])) { } 0 0 0
342 0 push @argv, @glob;
343 }
344 else {
345 0 push @argv, $_;
346 }
347 }
348  
349 # has wildcard metachar
350 elsif (/\A (?:$q_char)*? [*?] /oxms) {
351 0 ▶ if (my @glob = Elatin8::glob($_)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@glob) = &Elatin8::glob($_)) { } 0 0 0
352 0 push @argv, @glob;
353 }
354 else {
355 0 push @argv, $_;
356 }
357 }
358  
359 # no wildcard globbing
360 else {
361 0 push @argv, $_;
362 }
363 }
364 0 @ARGV = @argv;
365 }
366  
367 211 *Char::ord = \&Latin8::ord;
368 211 *Char::ord_ = \&Latin8::ord_;
369 211 *Char::reverse = \&Latin8::reverse;
370 211 *Char::getc = \&Latin8::getc;
371 211 *Char::length = \&Latin8::length;
372 211 *Char::substr = \&Latin8::substr;
373 211 *Char::index = \&Latin8::index;
374 211 *Char::rindex = \&Latin8::rindex;
375 211 *Char::eval = \&Latin8::eval;
376 211 *Char::escape = \&Latin8::escape;
377 211 *Char::escape_token = \&Latin8::escape_token;
378 211 *Char::escape_script = \&Latin8::escape_script;
379 }
380  
381 # P.230 Care with Prototypes
382 # in Chapter 6: Subroutines
383 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
384 #
385 # If you aren't careful, you can get yourself into trouble with prototypes.
386 # But if you are careful, you can do a lot of neat things with them. This is
387 # all very powerful, of course, and should only be used in moderation to make
388 # the world a better place.
389  
390 # P.332 Care with Prototypes
391 # in Chapter 7: Subroutines
392 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
393 #
394 # If you aren't careful, you can get yourself into trouble with prototypes.
395 # But if you are careful, you can do a lot of neat things with them. This is
396 # all very powerful, of course, and should only be used in moderation to make
397 # the world a better place.
398  
399 #
400 # Prototypes of subroutines
401 #
402 0 ▶sub unimport {}
Subroutine unimport: not called CC=1 SCAR=0.0
403 sub Elatin8::split(;$$$);
404 sub Elatin8::tr($$$$;$);
405 sub Elatin8::chop(@);
406 sub Elatin8::index($$;$);
407 sub Elatin8::rindex($$;$);
408 sub Elatin8::lcfirst(@);
409 sub Elatin8::lcfirst_();
410 sub Elatin8::lc(@);
411 sub Elatin8::lc_();
412 sub Elatin8::ucfirst(@);
413 sub Elatin8::ucfirst_();
414 sub Elatin8::uc(@);
415 sub Elatin8::uc_();
416 sub Elatin8::fc(@);
417 sub Elatin8::fc_();
418 sub Elatin8::ignorecase;
419 sub Elatin8::classic_character_class;
420 sub Elatin8::capture;
421 sub Elatin8::chr(;$);
422 sub Elatin8::chr_();
423 sub Elatin8::glob($);
424 sub Elatin8::glob_();
425  
426 sub Latin8::ord(;$);
427 sub Latin8::ord_();
428 sub Latin8::reverse(@);
429 sub Latin8::getc(;*@);
430 sub Latin8::length(;$);
431 sub Latin8::substr($$;$$);
432 sub Latin8::index($$;$);
433 sub Latin8::rindex($$;$);
434 sub Latin8::escape(;$);
435  
436 #
437 # Regexp work
438 #
439 422 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
440 $re_a
441 $re_t
442 $re_n
443 $re_r
444 422 );
445  
446 #
447 # Character class
448 #
449 422 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
450 $dot
451 $dot_s
452 $eD
453 $eS
454 $eW
455 $eH
456 $eV
457 $eR
458 $eN
459 $not_alnum
460 $not_alpha
461 $not_ascii
462 $not_blank
463 $not_cntrl
464 $not_digit
465 $not_graph
466 $not_lower
467 $not_lower_i
468 $not_print
469 $not_punct
470 $not_space
471 $not_upper
472 $not_upper_i
473 $not_word
474 $not_xdigit
475 $eb
476 $eB
477 422 );
478  
479 422 ${Elatin8::dot} = qr{(?>[^\x0A])};
480 422 ${Elatin8::dot_s} = qr{(?>[\x00-\xFF])};
481 422 ${Elatin8::eD} = qr{(?>[^0-9])};
482  
483 # Vertical tabs are now whitespace
484 # \s in a regex now matches a vertical tab in all circumstances.
485 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
486 # ${Elatin8::eS} = qr{(?>[^\x09\x0A \x0C\x0D\x20])};
487 # ${Elatin8::eS} = qr{(?>[^\x09\x0A\x0B\x0C\x0D\x20])};
488 422 ${Elatin8::eS} = qr{(?>[^\s])};
489  
490 422 ${Elatin8::eW} = qr{(?>[^0-9A-Z_a-z])};
491 422 ${Elatin8::eH} = qr{(?>[^\x09\x20])};
492 422 ${Elatin8::eV} = qr{(?>[^\x0A\x0B\x0C\x0D])};
493 422 ${Elatin8::eR} = qr{(?>\x0D\x0A|[\x0A\x0D])};
494 422 ${Elatin8::eN} = qr{(?>[^\x0A])};
495 422 ${Elatin8::not_alnum} = qr{(?>[^\x30-\x39\x41-\x5A\x61-\x7A])};
496 422 ${Elatin8::not_alpha} = qr{(?>[^\x41-\x5A\x61-\x7A])};
497 422 ${Elatin8::not_ascii} = qr{(?>[^\x00-\x7F])};
498 422 ${Elatin8::not_blank} = qr{(?>[^\x09\x20])};
499 422 ${Elatin8::not_cntrl} = qr{(?>[^\x00-\x1F\x7F])};
500 422 ${Elatin8::not_digit} = qr{(?>[^\x30-\x39])};
501 422 ${Elatin8::not_graph} = qr{(?>[^\x21-\x7F])};
502 422 ${Elatin8::not_lower} = qr{(?>[^\x61-\x7A])};
503 422 ${Elatin8::not_lower_i} = qr{(?>[^\x41-\x5A\x61-\x7A])}; # Perl 5.16 compatible
504 # ${Elatin8::not_lower_i} = qr{(?>[\x00-\xFF])}; # older Perl compatible
505 422 ${Elatin8::not_print} = qr{(?>[^\x20-\x7F])};
506 422 ${Elatin8::not_punct} = qr{(?>[^\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E])};
507 422 ${Elatin8::not_space} = qr{(?>[^\s\x0B])};
508 422 ${Elatin8::not_upper} = qr{(?>[^\x41-\x5A])};
509 422 ${Elatin8::not_upper_i} = qr{(?>[^\x41-\x5A\x61-\x7A])}; # Perl 5.16 compatible
510 # ${Elatin8::not_upper_i} = qr{(?>[\x00-\xFF])}; # older Perl compatible
511 422 ${Elatin8::not_word} = qr{(?>[^\x30-\x39\x41-\x5A\x5F\x61-\x7A])};
512 422 ${Elatin8::not_xdigit} = qr{(?>[^\x30-\x39\x41-\x46\x61-\x66])};
513 422 ${Elatin8::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))};
514 422 ${Elatin8::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]))};
515  
516 # avoid: Name "Elatin8::foo" used only once: possible typo at here.
517 422 ${Elatin8::dot} = ${Elatin8::dot};
518 422 ${Elatin8::dot_s} = ${Elatin8::dot_s};
519 422 ${Elatin8::eD} = ${Elatin8::eD};
520 422 ${Elatin8::eS} = ${Elatin8::eS};
521 422 ${Elatin8::eW} = ${Elatin8::eW};
522 422 ${Elatin8::eH} = ${Elatin8::eH};
523 422 ${Elatin8::eV} = ${Elatin8::eV};
524 422 ${Elatin8::eR} = ${Elatin8::eR};
525 422 ${Elatin8::eN} = ${Elatin8::eN};
526 422 ${Elatin8::not_alnum} = ${Elatin8::not_alnum};
527 422 ${Elatin8::not_alpha} = ${Elatin8::not_alpha};
528 422 ${Elatin8::not_ascii} = ${Elatin8::not_ascii};
529 422 ${Elatin8::not_blank} = ${Elatin8::not_blank};
530 422 ${Elatin8::not_cntrl} = ${Elatin8::not_cntrl};
531 422 ${Elatin8::not_digit} = ${Elatin8::not_digit};
532 422 ${Elatin8::not_graph} = ${Elatin8::not_graph};
533 422 ${Elatin8::not_lower} = ${Elatin8::not_lower};
534 422 ${Elatin8::not_lower_i} = ${Elatin8::not_lower_i};
535 422 ${Elatin8::not_print} = ${Elatin8::not_print};
536 422 ${Elatin8::not_punct} = ${Elatin8::not_punct};
537 422 ${Elatin8::not_space} = ${Elatin8::not_space};
538 422 ${Elatin8::not_upper} = ${Elatin8::not_upper};
539 422 ${Elatin8::not_upper_i} = ${Elatin8::not_upper_i};
540 422 ${Elatin8::not_word} = ${Elatin8::not_word};
541 422 ${Elatin8::not_xdigit} = ${Elatin8::not_xdigit};
542 422 ${Elatin8::eb} = ${Elatin8::eb};
543 422 ${Elatin8::eB} = ${Elatin8::eB};
544  
545 #
546 # Latin-8 split
547 #
548 72 ▶sub Elatin8::split(;$$$) {
Subroutine split: called CC=34 SCAR=46.9
Pod undocumented
549  
550 # P.794 29.2.161. split
551 # in Chapter 29: Functions
552 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
553  
554 # P.951 split
555 # in Chapter 27: Functions
556 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
557  
558 72 my $pattern = $_[0];
559 72 my $string = $_[1];
560 72 my $limit = $_[2];
561  
562 # if $pattern is also omitted or is the literal space, " "
563 72 ▶ if (not defined $pattern) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $pattern) 2 70 72
564 2 $pattern = ' ';
565 }
566  
567 # if $string is omitted, the function splits the $_ string
568 72 ▶ if (not defined $string) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $string) 6 66 72
569 6 ▶ if (defined $_) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_) { } 0 6 6
570 0 $string = $_;
571 }
572 else {
573 6 $string = '';
574 }
575 }
576  
577 72 my @split = ();
578  
579 # when string is empty
580 72 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 10 62 72
elsif ($pattern eq ' ') { } 2 60 62
581  
582 # resulting list value in list context
583 10 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 5 5 10
584 5 return @split;
585 }
586  
587 # count of substrings in scalar context
588 else {
589 5 ▶ carp "Use of implicit split to \@_ is deprecated" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 5 5
590 5 @_ = @split;
591 5 return scalar @_;
592 }
593 }
594  
595 # split's first argument is more consistently interpreted
596 #
597 # After some changes earlier in v5.17, split's behavior has been simplified:
598 # if the PATTERN argument evaluates to a string containing one space, it is
599 # treated the way that a literal string containing one space once was.
600 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#split's_first_argument_is_more_consistently_interpreted
601  
602 # if $pattern is also omitted or is the literal space, " ", the function splits
603 # on whitespace, /\s+/, after skipping any leading whitespace
604 # (and so on)
605  
606 elsif ($pattern eq ' ') {
607 2 ▶ if (not defined $limit) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $limit) { } 2 0 2
608 2 return CORE::split(' ', $string);
609 }
610 else {
611 0 return CORE::split(' ', $string, $limit);
612 }
613 }
614  
615 # if $limit is negative, it is treated as if an arbitrarily large $limit has been specified
616 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
617  
618 # a pattern capable of matching either the null string or something longer than the
619 # null string will split the value of $string into separate characters wherever it
620 # matches the null string between characters
621 # (and so on)
622  
623 60 ▶ if ('' =~ / \A $pattern \z /xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ('' =~ / \A $pattern \z /msx) { } 2 58 60
624 2 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
625 2 my $limit = scalar(() = $string =~ /($pattern)/oxmsg);
626  
627 # P.1024 Appendix W.10 Multibyte Processing
628 # of ISBN 1-56592-224-7 CJKV Information Processing
629 # (and so on)
630  
631 # the //m modifier is assumed when you split on the pattern /^/
632 # (and so on)
633  
634 # V
635 2 ▶ while ((--$limit > 0) and ($string =~ s/\A((?:$q_char)+?)$pattern//m)) {
Branch: 1 branch
BranchTrueFalseTotal
if (--$limit > 0 and $string =~ s/\A((?:$Elatin8::q_char)+?)$pattern//m) 9 2 11
Condition100%3/3
--$limit > 0 and $string =~ s/\A((?:$Elatin8::q_char)+?)$pattern//m
!ll&&!rl&&r
119
MC/DC100%2/2
--$limit > 0 and $string =~ s/\A((?:$Elatin8::q_char)+?)$pattern//m
--$limit > 0 $string =~ s/\A((?:$Elatin8::q_char)+?)$pattern//m
Truth table100%3/3
A and B
A= --$limit > 0B= $string =~ s/\A((?:$Elatin8::q_char)+?)$pattern//m
ABresult
0X0
100
111
636  
637 # if the $pattern contains parentheses, then the substring matched by each pair of parentheses
638 # is included in the resulting list, interspersed with the fields that are ordinarily returned
639 # (and so on)
640  
641 9 local $@;
642 9 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 9 9 18
643 9 push @split, CORE::eval('$' . $digit);
644 }
645 }
646 }
647  
648 else {
649 58 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
650  
651 # V
652 58 ▶ while ($string =~ s/\A((?:$q_char)*?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Elatin8::q_char)*?)$pattern//m) 163 58 221
653 163 local $@;
654 163 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 230 163 393
655 230 push @split, CORE::eval('$' . $digit);
656 }
657 }
658 }
659 }
660  
661 elsif ($limit > 0) {
662 0 ▶ if ('' =~ / \A $pattern \z /xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ('' =~ / \A $pattern \z /msx) { } 0 0 0
663 0 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
664 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
665  
666 # V
667 0 ▶ if ($string =~ s/\A((?:$q_char)+?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Elatin8::q_char)+?)$pattern//m) 0 0 0
668 0 local $@;
669 0 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 0 0 0
670 0 push @split, CORE::eval('$' . $digit);
671 }
672 }
673 }
674 }
675 else {
676 0 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
677 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
678  
679 # V
680 0 ▶ if ($string =~ s/\A((?:$q_char)*?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Elatin8::q_char)*?)$pattern//m) 0 0 0
681 0 local $@;
682 0 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 0 0 0
683 0 push @split, CORE::eval('$' . $digit);
684 }
685 }
686 }
687 }
688 }
689  
690 60 ▶ if (CORE::length($string) > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $string > 0) 58 2 60
691 58 push @split, $string;
692 }
693  
694 # if $_[2] (NOT "$limit") is omitted or zero, trailing null fields are stripped from the result
695 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
696 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
697 0 pop @split;
698 }
699 }
700  
701 # resulting list value in list context
702 60 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 58 2 60
703 58 return @split;
704 }
705  
706 # count of substrings in scalar context
707 else {
708 2 ▶ carp "Use of implicit split to \@_ is deprecated" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 2 2
709 2 @_ = @split;
710 2 return scalar @_;
711 }
712 }
713  
714 #
715 # get last subexpression offsets
716 #
717 60 ▶sub _last_subexpression_offsets {
Subroutine _last_subexpression_offsets: called CC=3 SCAR=11.0
718 60 my $pattern = $_[0];
719  
720 # remove comment
721 60 $pattern =~ s/\(\?\# .*? \)//oxmsg;
722  
723 60 my $modifier = '';
724 60 ▶ if ($pattern =~ /\(\?\^? ([\-A-Za-z]+) :/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pattern =~ /\(\?\^? ([\-A-Za-z]+) :/mosx) 11 49 60
725 11 $modifier = $1;
726 11 $modifier =~ s/-[A-Za-z]*//;
727 }
728  
729 # with /x modifier
730 60 my @char = ();
731 60 ▶ if ($modifier =~ /x/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /x/mosx) { } 5 55 60
732 5 @char = $pattern =~ /\G((?>
733 [^\\\#\[\(] |
734 \\ $q_char |
735 \# (?>[^\n]*) $ |
736 \[ (?>(?:[^\\\]]|\\\\|\\\]|$q_char)+) \] |
737 \(\? |
738 $q_char
739 ))/oxmsg;
740 }
741  
742 # without /x modifier
743 else {
744 55 @char = $pattern =~ /\G((?>
745 [^\\\[\(] |
746 \\ $q_char |
747 \[ (?>(?:[^\\\]]|\\\\|\\\]|$q_char)+) \] |
748 \(\? |
749 $q_char
750 ))/oxmsg;
751 }
752  
753 60 return scalar grep { $_ eq '(' } @char;
754 }
755  
756 #
757 # Latin-8 transliteration (tr///)
758 #
759 6 ▶sub Elatin8::tr($$$$;$) {
Subroutine tr: called CC=26 SCAR=48.6
Pod undocumented
760  
761 6 my $bind_operator = $_[1];
762 6 my $searchlist = $_[2];
763 6 my $replacementlist = $_[3];
764 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
765  
766 6 ▶ if ($modifier =~ /r/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /r/mosx) 5 1 6
767 5 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) 0 5 5
768 0 croak "Using !~ with tr///r doesn't make sense";
769 }
770 }
771  
772 6 my @char = $_[0] =~ /\G (?>$q_char) /oxmsg;
773 6 my @searchlist = _charlist_tr($searchlist);
774 6 my @replacementlist = _charlist_tr($replacementlist);
775  
776 6 my %tr = ();
777 6 ▶ for (my $i=0; $i <= $#searchlist; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#searchlist) 19 6 25
778 19 ▶ if (not exists $tr{$searchlist[$i]}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $tr{$searchlist[$i]}) 19 0 19
779 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
780 19 $tr{$searchlist[$i]} = $replacementlist[$i];
781 }
782 elsif ($modifier =~ /d/oxms) {
783 0 $tr{$searchlist[$i]} = '';
784 }
785 ▶ 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
786 0 $tr{$searchlist[$i]} = $replacementlist[-1];
787 }
788 else {
789 0 $tr{$searchlist[$i]} = $searchlist[$i];
790 }
791 }
792 }
793  
794 6 my $tr = 0;
795 6 my $replaced = '';
796 6 ▶ if ($modifier =~ /c/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /c/mosx) { } 0 6 6
797 0 ▶ while (defined(my $char = shift @char)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $char = shift @char)) 0 0 0
798 0 ▶ if (not exists $tr{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $tr{$char}) { } 0 0 0
799 0 ▶ if (defined $replacementlist[0]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $replacementlist[0]) 0 0 0
800 0 $replaced .= $replacementlist[0];
801 }
802 0 $tr++;
803 0 ▶ if ($modifier =~ /s/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/mosx) 0 0 0
804 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
805 0 shift @char;
806 0 $tr++;
807 }
808 }
809 }
810 else {
811 0 $replaced .= $char;
812 }
813 }
814 }
815 else {
816 6 ▶ while (defined(my $char = shift @char)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $char = shift @char)) 36 6 42
817 36 ▶ if (exists $tr{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $tr{$char}) { } 19 17 36
818 19 $replaced .= $tr{$char};
819 19 $tr++;
820 19 ▶ if ($modifier =~ /s/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/mosx) 0 19 19
821 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
822 0 shift @char;
823 0 $tr++;
824 }
825 }
826 }
827 else {
828 17 $replaced .= $char;
829 }
830 }
831 }
832  
833 6 ▶ if ($modifier =~ /r/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /r/mosx) { } 5 1 6
834 5 return $replaced;
835 }
836 else {
837 1 $_[0] = $replaced;
838 1 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) { } 0 1 1
839 0 return not $tr;
840 }
841 else {
842 1 return $tr;
843 }
844 }
845 }
846  
847 #
848 # Latin-8 chop
849 #
850 0 ▶sub Elatin8::chop(@) {
Subroutine chop: not called CC=3 SCAR=24.8
Pod undocumented
851  
852 0 my $chop;
853 0 ▶ if (@_ == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 0) { } 0 0 0
854 0 my @char = /\G (?>$q_char) /oxmsg;
855 0 $chop = pop @char;
856 0 $_ = join '', @char;
857 }
858 else {
859 0 for (@_) {
860 0 my @char = /\G (?>$q_char) /oxmsg;
861 0 $chop = pop @char;
862 0 $_ = join '', @char;
863 }
864 }
865 0 return $chop;
866 }
867  
868 #
869 # Latin-8 index by octet
870 #
871 30 ▶sub Elatin8::index($$;$) {
Subroutine index: called CC=6 SCAR=20.8
Pod documented
872  
873 30 my($str,$substr,$position) = @_;
874 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
875 30 my $pos = 0;
876  
877 30 ▶ while ($pos < CORE::length($str)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos < length $str) 130 30 160
878 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
879 0 ▶ if ($pos >= $position) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos >= $position) 0 0 0
880 0 return $pos;
881 }
882 }
883 130 ▶ if (CORE::substr($str,$pos) =~ /\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($str, $pos) =~ /\A ($Elatin8::q_char) /mosx) { } 130 0 130
884 130 $pos += CORE::length($1);
885 }
886 else {
887 0 $pos += 1;
888 }
889 }
890 30 return -1;
891 }
892  
893 #
894 # Latin-8 reverse index
895 #
896 0 ▶sub Elatin8::rindex($$;$) {
Subroutine rindex: not called CC=6 SCAR=37.4
Pod undocumented
897  
898 0 my($str,$substr,$position) = @_;
899 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
900 0 my $pos = 0;
901 0 my $rindex = -1;
902  
903 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
904 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
905 0 $rindex = $pos;
906 }
907 0 ▶ if (CORE::substr($str,$pos) =~ /\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($str, $pos) =~ /\A ($Elatin8::q_char) /mosx) { } 0 0 0
908 0 $pos += CORE::length($1);
909 }
910 else {
911 0 $pos += 1;
912 }
913 }
914 0 return $rindex;
915 }
916  
917 #
918 # Latin-8 lower case first with parameter
919 #
920 0 ▶sub Elatin8::lcfirst(@) {
Subroutine lcfirst: not called CC=4 SCAR=30.0
Pod undocumented
921 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
922 0 my $s = shift @_;
923 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
924 0 return Elatin8::lc(CORE::substr($s,0,1)) . CORE::substr($s,1), @_;
925 }
926 else {
927 0 return Elatin8::lc(CORE::substr($s,0,1)) . CORE::substr($s,1);
928 }
929 }
930 else {
931 0 return Elatin8::lc(CORE::substr($_,0,1)) . CORE::substr($_,1);
932 }
933 }
934  
935 #
936 # Latin-8 lower case first without parameter
937 #
938 0 ▶sub Elatin8::lcfirst_() {
Subroutine lcfirst_: not called CC=1 SCAR=6.9
Pod undocumented
939 0 return Elatin8::lc(CORE::substr($_,0,1)) . CORE::substr($_,1);
940 }
941  
942 #
943 # Latin-8 lower case with parameter
944 #
945 71 ▶sub Elatin8::lc(@) {
Subroutine lc: called CC=6 SCAR=24.2
Pod undocumented
946 71 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 71 0 71
947 71 my $s = shift @_;
948 71 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 71 71
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
7100
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
949 0 ▶ return join('', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 0 0 0
950 }
951 else {
952 71 ▶ return join('', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 73 0 73
953 }
954 }
955 else {
956 0 return Elatin8::lc_();
957 }
958 }
959  
960 #
961 # Latin-8 lower case without parameter
962 #
963 0 ▶sub Elatin8::lc_() {
Subroutine lc_: not called CC=2 SCAR=17.9
Pod undocumented
964 0 my $s = $_;
965 0 ▶ return join '', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 0 0 0
966 }
967  
968 #
969 # Latin-8 upper case first with parameter
970 #
971 0 ▶sub Elatin8::ucfirst(@) {
Subroutine ucfirst: not called CC=4 SCAR=30.0
Pod undocumented
972 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
973 0 my $s = shift @_;
974 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
975 0 return Elatin8::uc(CORE::substr($s,0,1)) . CORE::substr($s,1), @_;
976 }
977 else {
978 0 return Elatin8::uc(CORE::substr($s,0,1)) . CORE::substr($s,1);
979 }
980 }
981 else {
982 0 return Elatin8::uc(CORE::substr($_,0,1)) . CORE::substr($_,1);
983 }
984 }
985  
986 #
987 # Latin-8 upper case first without parameter
988 #
989 0 ▶sub Elatin8::ucfirst_() {
Subroutine ucfirst_: not called CC=1 SCAR=6.9
Pod undocumented
990 0 return Elatin8::uc(CORE::substr($_,0,1)) . CORE::substr($_,1);
991 }
992  
993 #
994 # Latin-8 upper case with parameter
995 #
996 2623 ▶sub Elatin8::uc(@) {
Subroutine uc: called CC=6 SCAR=22.9
Pod undocumented
997 2623 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2623 0 2623
998 2623 my $s = shift @_;
999 2623 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 2623 2623
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
262300
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
1000 0 ▶ return join('', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 0 0 0
1001 }
1002 else {
1003 2623 ▶ return join('', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 937 1688 2625
1004 }
1005 }
1006 else {
1007 0 return Elatin8::uc_();
1008 }
1009 }
1010  
1011 #
1012 # Latin-8 upper case without parameter
1013 #
1014 0 ▶sub Elatin8::uc_() {
Subroutine uc_: not called CC=2 SCAR=17.9
Pod undocumented
1015 0 my $s = $_;
1016 0 ▶ return join '', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 0 0 0
1017 }
1018  
1019 #
1020 # Latin-8 fold case with parameter
1021 #
1022 2623 ▶sub Elatin8::fc(@) {
Subroutine fc: called CC=6 SCAR=22.9
Pod undocumented
1023 2623 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2623 0 2623
1024 2623 my $s = shift @_;
1025 2623 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 2623 2623
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
262300
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
1026 0 ▶ return join('', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 0 0 0
1027 }
1028 else {
1029 2623 ▶ return join('', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 2067 6503 8570
1030 }
1031 }
1032 else {
1033 0 return Elatin8::fc_();
1034 }
1035 }
1036  
1037 #
1038 # Latin-8 fold case without parameter
1039 #
1040 0 ▶sub Elatin8::fc_() {
Subroutine fc_: not called CC=2 SCAR=17.9
Pod undocumented
1041 0 my $s = $_;
1042 0 ▶ return join '', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 0 0 0
1043 }
1044  
1045 #
1046 # Latin-8 regexp capture
1047 #
1048 {
1049 0 ▶ sub Elatin8::capture {
Subroutine capture: not called CC=1 SCAR=6.9
Pod documented
1050 0 return $_[0];
1051 }
1052 }
1053  
1054 #
1055 # Latin-8 regexp ignore case modifier
1056 #
1057 422 ▶sub Elatin8::ignorecase {
Subroutine ignorecase: called CC=25 SCAR=52.1
Pod undocumented
1058  
1059 11 my @string = @_;
1060 11 my $metachar = qr/[\@\\|[\]{]/oxms;
1061  
1062 # ignore case of $scalar or @array
1063 11 for my $string (@string) {
1064  
1065 # split regexp
1066 11 my @char = $string =~ /\G (?>\[\^|\\$q_char|$q_char) /oxmsg;
1067  
1068 # unescape character
1069 11 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1148 11 1159
1070 1148 ▶ next if not defined $char[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $char[$i] 0 1148 1148
1071  
1072 # open character class [...]
1073 1148 ▶ if ($char[$i] eq '[') {
Branch: 4 branches
BranchTrueFalseTotal
if ($char[$i] eq '[') { } 0 1148 1148
elsif ($char[$i] eq '[^') { } 0 1148 1148
elsif (my $char = classic_character_class($char[$i])) { } 0 1148 1148
elsif ($char[$i] =~ /\A [\x00-\xFF] \z/mosx) { } 1148 0 1148
1074 0 my $left = $i;
1075  
1076 # [] make die "unmatched [] in regexp ...\n"
1077  
1078 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
1079 0 $i++;
1080 }
1081  
1082 0 while (1) {
1083 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
1084 0 croak "Unmatched [] in regexp";
1085 }
1086 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
1087 0 my $right = $i;
1088 0 my @charlist = charlist_qr(@char[$left+1..$right-1], 'i');
1089  
1090 # escape character
1091 0 for my $char (@charlist) {
1092 0 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $char =~ /\A [.|)] \z/mosx }) 0 0 0
1093 }
1094  
1095 0 elsif ($char =~ /\A [.|)] \z/oxms) {
1096 0 $char = '\\' . $char;
1097 }
1098 }
1099  
1100 # [...]
1101 0 splice @char, $left, $right-$left+1, '(?:' . join('|', @charlist) . ')';
1102  
1103 0 $i = $left;
1104 0 last;
1105 }
1106 }
1107 }
1108  
1109 # open character class [^...]
1110 elsif ($char[$i] eq '[^') {
1111 0 my $left = $i;
1112  
1113 # [^] make die "unmatched [] in regexp ...\n"
1114  
1115 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
1116 0 $i++;
1117 }
1118  
1119 0 while (1) {
1120 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
1121 0 croak "Unmatched [] in regexp";
1122 }
1123 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
1124 0 my $right = $i;
1125 0 my @charlist = charlist_not_qr(@char[$left+1..$right-1], 'i');
1126  
1127 # escape character
1128 0 for my $char (@charlist) {
1129 0 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $char =~ /\A [.|)] \z/mosx }) 0 0 0
1130 }
1131  
1132 0 elsif ($char =~ /\A [.|)] \z/oxms) {
1133 0 $char = '\\' . $char;
1134 }
1135 }
1136  
1137 # [^...]
1138 0 splice @char, $left, $right-$left+1, '(?!' . join('|', @charlist) . ")(?:$your_char)";
1139  
1140 0 $i = $left;
1141 0 last;
1142 }
1143 }
1144 }
1145  
1146 # rewrite classic character class or escape character
1147 elsif (my $char = classic_character_class($char[$i])) {
1148 0 $char[$i] = $char;
1149 }
1150  
1151 # with /i modifier
1152 elsif ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) {
1153 1148 my $uc = Elatin8::uc($char[$i]);
1154 1148 my $fc = Elatin8::fc($char[$i]);
1155 1148 ▶ if ($uc ne $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc ne $fc) 588 560 1148
1156 588 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 585 3 588
1157 585 $char[$i] = '[' . $uc . $fc . ']';
1158 }
1159 else {
1160 3 $char[$i] = '(?:' . $uc . '|' . $fc . ')';
1161 }
1162 }
1163 }
1164 }
1165  
1166 # characterize
1167 11 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1148 11 1159
1168 1148 ▶ next if not defined $char[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $char[$i] 0 1148 1148
1169  
1170 1148 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx }) 0 1159 1159
1171 }
1172  
1173 # quote character before ? + * {
1174 0 ▶ elsif (($i >= 1) and ($char[$i] =~ /\A [\?\+\*\{] \z/oxms)) {
Condition66%2/3
$i >= 1 && $char[$i] =~ /\A [\?\+\*\{] \z/mosx
!ll&&!rl&&r
1111370
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
1175 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
1176 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
1177 }
1178 }
1179 }
1180  
1181 11 $string = join '', @char;
1182 }
1183  
1184 # make regexp string
1185 11 return @string;
1186 }
1187  
1188 #
1189 # classic character class ( \D \S \W \d \s \w \C \X \H \V \h \v \R \N \b \B )
1190 #
1191 3016 ▶sub Elatin8::classic_character_class {
Subroutine classic_character_class: called CC=2 SCAR=6.9
Pod undocumented
1192 3016 my($char) = @_;
1193  
1194 return {
1195 '\D' => '${Elatin8::eD}',
1196 '\S' => '${Elatin8::eS}',
1197 '\W' => '${Elatin8::eW}',
1198 '\d' => '[0-9]',
1199  
1200 # Before Perl 5.6, \s only matched the five whitespace characters
1201 # tab, newline, form-feed, carriage return, and the space character
1202 # itself, which, taken together, is the character class [\t\n\f\r ].
1203  
1204 # Vertical tabs are now whitespace
1205 # \s in a regex now matches a vertical tab in all circumstances.
1206 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
1207 # \t \n \v \f \r space
1208 # '\s' => '[\x09\x0A \x0C\x0D\x20]',
1209 # '\s' => '[\x09\x0A\x0B\x0C\x0D\x20]',
1210 '\s' => '\s',
1211  
1212 '\w' => '[0-9A-Z_a-z]',
1213 '\C' => '[\x00-\xFF]',
1214 '\X' => 'X',
1215  
1216 # \h \v \H \V
1217  
1218 # P.114 Character Class Shortcuts
1219 # in Chapter 7: In the World of Regular Expressions
1220 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
1221  
1222 # P.357 13.2.3 Whitespace
1223 # in Chapter 13: perlrecharclass: Perl Regular Expression Character Classes
1224 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
1225 #
1226 # 0x00009 CHARACTER TABULATION h s
1227 # 0x0000a LINE FEED (LF) vs
1228 # 0x0000b LINE TABULATION v
1229 # 0x0000c FORM FEED (FF) vs
1230 # 0x0000d CARRIAGE RETURN (CR) vs
1231 # 0x00020 SPACE h s
1232  
1233 # P.196 Table 5-9. Alphanumeric regex metasymbols
1234 # in Chapter 5. Pattern Matching
1235 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1236  
1237 # (and so on)
1238  
1239 '\H' => '${Elatin8::eH}',
1240 '\V' => '${Elatin8::eV}',
1241 '\h' => '[\x09\x20]',
1242 '\v' => '[\x0A\x0B\x0C\x0D]',
1243 '\R' => '${Elatin8::eR}',
1244  
1245 # \N
1246 #
1247 # http://perldoc.perl.org/perlre.html
1248 # Character Classes and other Special Escapes
1249 # Any character but \n (experimental). Not affected by /s modifier
1250  
1251 '\N' => '${Elatin8::eN}',
1252  
1253 # \b \B
1254  
1255 # P.180 Boundaries: The \b and \B Assertions
1256 # in Chapter 5: Pattern Matching
1257 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
1258  
1259 # P.219 Boundaries: The \b and \B Assertions
1260 # in Chapter 5: Pattern Matching
1261 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1262  
1263 # \b really means (?:(?<=\w)(?!\w)|(?<!\w)(?=\w))
1264 # or (?:(?<=\A|\W)(?=\w)|(?<=\w)(?=\W|\z))
1265 '\b' => '${Elatin8::eb}',
1266  
1267 # \B really means (?:(?<=\w)(?=\w)|(?<!\w)(?!\w))
1268 # or (?:(?<=\w)(?=\w)|(?<=\W)(?=\W))
1269 '\B' => '${Elatin8::eB}',
1270  
1271 3016 ▶ }->{$char} || '';
Condition100%2/2
{'\\D', '${Elatin8::eD}', '\\S', '${Elatin8::eS}', '\\W', '${Elatin8::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin8::eH}', '\\V', '${Elatin8::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin8::eR}', '\\N', '${Elatin8::eN}', '\\b', '${Elatin8::eb}', '\\B', '${Elatin8::eB}'}->{$char} || ''
l!l
1012915
MC/DC100%1/1
{'\\D', '${Elatin8::eD}', '\\S', '${Elatin8::eS}', '\\W', '${Elatin8::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin8::eH}', '\\V', '${Elatin8::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin8::eR}', '\\N', '${Elatin8::eN}', '\\b', '${Elatin8::eb}', '\\B', '${Elatin8::eB}'}->{$char} || ''
{'\\D', '${Elatin8::eD}', '\\S', '${Elatin8::eS}', '\\W', '${Elatin8::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin8::eH}', '\\V', '${Elatin8::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin8::eR}', '\\N', '${Elatin8::eN}', '\\b', '${Elatin8::eb}', '\\B', '${Elatin8::eB}'}->{$char}
Truth table100%2/2
A
A= {'\\D', '${Elatin8::eD}', '\\S', '${Elatin8::eS}', '\\W', '${Elatin8::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin8::eH}', '\\V', '${Elatin8::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin8::eR}', '\\N', '${Elatin8::eN}', '\\b', '${Elatin8::eb}', '\\B', '${Elatin8::eB}'}->{$char}
Aresult
11
00
1272 }
1273  
1274 #
1275 # prepare Latin-8 characters per length
1276 #
1277  
1278 # 1 octet characters
1279 422 my @chars1 = ();
1280 0 ▶sub chars1 {
Subroutine chars1: not called CC=5 SCAR=34.0
Pod undocumented
1281 0 ▶ if (@chars1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars1) 0 0 0
1282 0 return @chars1;
1283 }
1284 0 ▶ if (exists $range_tr{1}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{1}) 0 0 0
1285 0 my @ranges = @{ $range_tr{1} };
1286 0 ▶ while (my @range = splice(@ranges,0,1)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 1)) 0 0 0
1287 0 for my $oct0 (@{$range[0]}) {
1288 0 push @chars1, pack 'C', $oct0;
1289 }
1290 }
1291 }
1292 0 return @chars1;
1293 }
1294  
1295 # 2 octets characters
1296 422 my @chars2 = ();
1297 0 ▶sub chars2 {
Subroutine chars2: not called CC=6 SCAR=37.4
Pod undocumented
1298 0 ▶ if (@chars2) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars2) 0 0 0
1299 0 return @chars2;
1300 }
1301 0 ▶ if (exists $range_tr{2}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{2}) 0 0 0
1302 0 my @ranges = @{ $range_tr{2} };
1303 0 ▶ while (my @range = splice(@ranges,0,2)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 2)) 0 0 0
1304 0 for my $oct0 (@{$range[0]}) {
1305 0 for my $oct1 (@{$range[1]}) {
1306 0 push @chars2, pack 'CC', $oct0,$oct1;
1307 }
1308 }
1309 }
1310 }
1311 0 return @chars2;
1312 }
1313  
1314 # 3 octets characters
1315 422 my @chars3 = ();
1316 0 ▶sub chars3 {
Subroutine chars3: not called CC=7 SCAR=40.3
Pod undocumented
1317 0 ▶ if (@chars3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars3) 0 0 0
1318 0 return @chars3;
1319 }
1320 0 ▶ if (exists $range_tr{3}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{3}) 0 0 0
1321 0 my @ranges = @{ $range_tr{3} };
1322 0 ▶ while (my @range = splice(@ranges,0,3)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 3)) 0 0 0
1323 0 for my $oct0 (@{$range[0]}) {
1324 0 for my $oct1 (@{$range[1]}) {
1325 0 for my $oct2 (@{$range[2]}) {
1326 0 push @chars3, pack 'CCC', $oct0,$oct1,$oct2;
1327 }
1328 }
1329 }
1330 }
1331 }
1332 0 return @chars3;
1333 }
1334  
1335 # 4 octets characters
1336 422 my @chars4 = ();
1337 0 ▶sub chars4 {
Subroutine chars4: not called CC=8 SCAR=42.8
Pod undocumented
1338 0 ▶ if (@chars4) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars4) 0 0 0
1339 0 return @chars4;
1340 }
1341 0 ▶ if (exists $range_tr{4}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{4}) 0 0 0
1342 0 my @ranges = @{ $range_tr{4} };
1343 0 ▶ while (my @range = splice(@ranges,0,4)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 4)) 0 0 0
1344 0 for my $oct0 (@{$range[0]}) {
1345 0 for my $oct1 (@{$range[1]}) {
1346 0 for my $oct2 (@{$range[2]}) {
1347 0 for my $oct3 (@{$range[3]}) {
1348 0 push @chars4, pack 'CCCC', $oct0,$oct1,$oct2,$oct3;
1349 }
1350 }
1351 }
1352 }
1353 }
1354 }
1355 0 return @chars4;
1356 }
1357  
1358 #
1359 # Latin-8 open character list for tr
1360 #
1361 12 ▶sub _charlist_tr {
Subroutine _charlist_tr: called CC=35 SCAR=66.4
1362  
1363 12 local $_ = shift @_;
1364  
1365 # unescape character
1366 12 my @char = ();
1367 12 ▶ while (not /\G \z/oxmsgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgmosx) 38 12 50
1368 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 \\ ($Elatin8::q_char) /cgmosx) { } 0 38 38
elsif (/\G ($Elatin8::q_char) /cgmosx) { } 38 0 38
1369 0 push @char, '\-';
1370 }
1371 elsif (/\G \\ ([0-7]{2,3}) /oxmsgc) {
1372 0 push @char, CORE::chr(oct $1);
1373 }
1374 elsif (/\G \\x ([0-9A-Fa-f]{1,2}) /oxmsgc) {
1375 0 push @char, CORE::chr(hex $1);
1376 }
1377 elsif (/\G \\c ([\x40-\x5F]) /oxmsgc) {
1378 0 push @char, CORE::chr(CORE::ord($1) & 0x1F);
1379 }
1380 elsif (/\G (\\ [0nrtfbae]) /oxmsgc) {
1381 push @char, {
1382 '\0' => "\0",
1383 '\n' => "\n",
1384 '\r' => "\r",
1385 '\t' => "\t",
1386 '\f' => "\f",
1387 '\b' => "\x08", # \b means backspace in character class
1388 '\a' => "\a",
1389 '\e' => "\e",
1390 0 }->{$1};
1391 }
1392 elsif (/\G \\ ($q_char) /oxmsgc) {
1393 0 push @char, $1;
1394 }
1395 elsif (/\G ($q_char) /oxmsgc) {
1396 38 push @char, $1;
1397 }
1398 }
1399  
1400 # join separated multiple-octet
1401 12 @char = join('',@char) =~ /\G (?>\\-|$q_char) /oxmsg;
1402  
1403 # unescape '-'
1404 12 my @i = ();
1405 12 for my $i (0 .. $#char) {
1406 38 ▶ if ($char[$i] eq '\-') {
Branch: 2 branches
BranchTrueFalseTotal
if ($char[$i] eq '\\-') { } 0 38 38
elsif ($char[$i] eq '-') { } 0 38 38
1407 0 $char[$i] = '-';
1408 }
1409 elsif ($char[$i] eq '-') {
1410 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
1411 0 push @i, $i;
1412 }
1413 }
1414 }
1415  
1416 # open character list (reverse for splice)
1417 12 for my $i (CORE::reverse @i) {
1418 0 my @range = ();
1419  
1420 # range error
1421 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
1422 0 croak "Invalid tr/// range \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1423 }
1424  
1425 # range of multiple-octet code
1426 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
1427 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
1428 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
1429 }
1430 elsif (CORE::length($char[$i+1]) == 2) {
1431 0 push @range, grep {$char[$i-1] le $_} chars1();
1432 0 push @range, grep {$_ le $char[$i+1]} chars2();
1433 }
1434 elsif (CORE::length($char[$i+1]) == 3) {
1435 0 push @range, grep {$char[$i-1] le $_} chars1();
1436 0 push @range, chars2();
1437 0 push @range, grep {$_ le $char[$i+1]} chars3();
1438 }
1439 elsif (CORE::length($char[$i+1]) == 4) {
1440 0 push @range, grep {$char[$i-1] le $_} chars1();
1441 0 push @range, chars2();
1442 0 push @range, chars3();
1443 0 push @range, grep {$_ le $char[$i+1]} chars4();
1444 }
1445 else {
1446 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1447 }
1448 }
1449 elsif (CORE::length($char[$i-1]) == 2) {
1450 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
1451 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
1452 }
1453 elsif (CORE::length($char[$i+1]) == 3) {
1454 0 push @range, grep {$char[$i-1] le $_} chars2();
1455 0 push @range, grep {$_ le $char[$i+1]} chars3();
1456 }
1457 elsif (CORE::length($char[$i+1]) == 4) {
1458 0 push @range, grep {$char[$i-1] le $_} chars2();
1459 0 push @range, chars3();
1460 0 push @range, grep {$_ le $char[$i+1]} chars4();
1461 }
1462 else {
1463 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1464 }
1465 }
1466 elsif (CORE::length($char[$i-1]) == 3) {
1467 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
1468 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
1469 }
1470 elsif (CORE::length($char[$i+1]) == 4) {
1471 0 push @range, grep {$char[$i-1] le $_} chars3();
1472 0 push @range, grep {$_ le $char[$i+1]} chars4();
1473 }
1474 else {
1475 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1476 }
1477 }
1478 elsif (CORE::length($char[$i-1]) == 4) {
1479 0 ▶ if (CORE::length($char[$i+1]) == 4) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $char[$i + 1] == 4) { } 0 0 0
1480 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
1481 }
1482 else {
1483 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1484 }
1485 }
1486 else {
1487 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1488 }
1489  
1490 0 splice @char, $i-1, 3, @range;
1491 }
1492  
1493 12 return @char;
1494 }
1495  
1496 #
1497 # Latin-8 open character class
1498 #
1499 0 ▶sub _cc {
Subroutine _cc: not called CC=7 SCAR=40.3
1500 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
1501 0 die __FILE__, ": subroutine cc got no parameter.\n";
1502 }
1503 elsif (scalar(@_) == 1) {
1504 0 return sprintf('\x%02X',$_[0]);
1505 }
1506 elsif (scalar(@_) == 2) {
1507 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
1508 0 die __FILE__, ": subroutine cc got \$_[0] > \$_[1] parameters).\n";
1509 }
1510 elsif ($_[0] == $_[1]) {
1511 0 return sprintf('\x%02X',$_[0]);
1512 }
1513 elsif (($_[0]+1) == $_[1]) {
1514 0 return sprintf('[\\x%02X\\x%02X]',$_[0],$_[1]);
1515 }
1516 else {
1517 0 return sprintf('[\\x%02X-\\x%02X]',$_[0],$_[1]);
1518 }
1519 }
1520 else {
1521 0 die __FILE__, ": subroutine cc got 3 or more parameters (@{[scalar(@_)]} parameters).\n";
1522 }
1523 }
1524  
1525 #
1526 # Latin-8 octet range
1527 #
1528 246 ▶sub _octets {
Subroutine _octets: called CC=5 SCAR=19.3
1529 246 my $length = shift @_;
1530  
1531 246 ▶ if ($length == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length == 1) { } 246 0 246
1532 246 my($a1) = unpack 'C', $_[0];
1533 246 my($z1) = unpack 'C', $_[1];
1534  
1535 246 ▶ if ($a1 > $z1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($a1 > $z1) 0 246 246
1536 0 croak 'Invalid [] range in regexp (CORE::ord(A) > CORE::ord(B)) ' . '\x' . unpack('H*',$a1) . '-\x' . unpack('H*',$z1);
1537 }
1538  
1539 246 ▶ if ($a1 == $z1) {
Branch: 2 branches
BranchTrueFalseTotal
if ($a1 == $z1) { } 0 246 246
elsif ($a1 + 1 == $z1) { } 0 246 246
1540 0 return sprintf('\x%02X',$a1);
1541 }
1542 elsif (($a1+1) == $z1) {
1543 0 return sprintf('\x%02X\x%02X',$a1,$z1);
1544 }
1545 else {
1546 246 return sprintf('\x%02X-\x%02X',$a1,$z1);
1547 }
1548 }
1549 else {
1550 0 die __FILE__, ": subroutine _octets got invalid length ($length).\n";
1551 }
1552 }
1553  
1554 #
1555 # Latin-8 range regexp
1556 #
1557 246 ▶sub _range_regexp {
Subroutine _range_regexp: called CC=18 SCAR=41.7
1558 246 my($length,$first,$last) = @_;
1559  
1560 246 my @range_regexp = ();
1561 246 ▶ if (not exists $range_tr{$length}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $range_tr{$length}) 0 246 246
1562 0 return @range_regexp;
1563 }
1564  
1565 246 my @ranges = @{ $range_tr{$length} };
1566 246 ▶ while (my @range = splice(@ranges,0,$length)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, $length)) 246 246 492
1567 246 my $min = '';
1568 246 my $max = '';
1569 246 ▶ for (my $i=0; $i < $length; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $length) 246 246 492
1570 246 $min .= pack 'C', $range[$i][0];
1571 246 $max .= pack 'C', $range[$i][-1];
1572 }
1573  
1574 # min___max
1575 # FIRST_____________LAST
1576 # (nothing)
1577  
1578 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
1579 }
1580  
1581 # **********
1582 # min_________max
1583 # FIRST_____________LAST
1584 # **********
1585  
1586 ▶ 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
1587 0 push @range_regexp, _octets($length,$first,$max,$min,$max);
1588 }
1589  
1590 # **********************
1591 # min________________max
1592 # FIRST_____________LAST
1593 # **********************
1594  
1595 ▶ 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
1596 0 push @range_regexp, _octets($length,$first,$last,$min,$max);
1597 }
1598  
1599 # *********
1600 # min___max
1601 # FIRST_____________LAST
1602 # *********
1603  
1604 ▶ 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
1605 0 push @range_regexp, _octets($length,$min,$max,$min,$max);
1606 }
1607  
1608 # **********************
1609 # min__________________________max
1610 # FIRST_____________LAST
1611 # **********************
1612  
1613 ▶ 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
1614 246 push @range_regexp, _octets($length,$first,$last,$min,$max);
1615 }
1616  
1617 # *********
1618 # min________max
1619 # FIRST_____________LAST
1620 # *********
1621  
1622 ▶ 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
1623 0 push @range_regexp, _octets($length,$min,$last,$min,$max);
1624 }
1625  
1626 # min___max
1627 # FIRST_____________LAST
1628 # (nothing)
1629  
1630 elsif ($last lt $min) {
1631 }
1632  
1633 else {
1634 0 die __FILE__, ": subroutine _range_regexp panic.\n";
1635 }
1636 }
1637  
1638 246 return @range_regexp;
1639 }
1640  
1641 #
1642 # Latin-8 open character list for qr and not qr
1643 #
1644 650 ▶sub _charlist {
Subroutine _charlist: called CC=46 SCAR=45.9
1645  
1646 650 my $modifier = pop @_;
1647 650 my @char = @_;
1648  
1649 650 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 298 352 650
1650  
1651 # unescape character
1652 650 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1773 650 2423
1653  
1654 # escape - to ...
1655 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 \\ ($Elatin8::q_char) \z/mosx) { } 7 1371 1378
1656 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
1657 246 $char[$i] = '...';
1658 }
1659 }
1660  
1661 # octal escape sequence
1662 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
1663 0 $char[$i] = octchr($1);
1664 }
1665  
1666 # hexadecimal escape sequence
1667 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
1668 0 $char[$i] = hexchr($1);
1669 }
1670  
1671 # \b{...} --> b\{...}
1672 # \B{...} --> B\{...}
1673 # \N{CHARNAME} --> N\{CHARNAME}
1674 # \p{PROPERTY} --> p\{PROPERTY}
1675 # \P{PROPERTY} --> P\{PROPERTY}
1676 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
1677 0 $char[$i] = $1 . '\\' . $2;
1678 }
1679  
1680 # \p, \P, \X --> p, P, X
1681 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
1682 0 $char[$i] = $1;
1683 }
1684  
1685 elsif ($char[$i] =~ /\A \\ ([0-7]{2,3}) \z/oxms) {
1686 0 $char[$i] = CORE::chr oct $1;
1687 }
1688 elsif ($char[$i] =~ /\A \\x ([0-9A-Fa-f]{1,2}) \z/oxms) {
1689 22 $char[$i] = CORE::chr hex $1;
1690 }
1691 elsif ($char[$i] =~ /\A \\c ([\x40-\x5F]) \z/oxms) {
1692 0 $char[$i] = CORE::chr(CORE::ord($1) & 0x1F);
1693 }
1694 elsif ($char[$i] =~ /\A (\\ [0nrtfbaedswDSWHVhvR]) \z/oxms) {
1695 $char[$i] = {
1696 '\0' => "\0",
1697 '\n' => "\n",
1698 '\r' => "\r",
1699 '\t' => "\t",
1700 '\f' => "\f",
1701 '\b' => "\x08", # \b means backspace in character class
1702 '\a' => "\a",
1703 '\e' => "\e",
1704 '\d' => '[0-9]',
1705  
1706 # Vertical tabs are now whitespace
1707 # \s in a regex now matches a vertical tab in all circumstances.
1708 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
1709 # \t \n \v \f \r space
1710 # '\s' => '[\x09\x0A \x0C\x0D\x20]',
1711 # '\s' => '[\x09\x0A\x0B\x0C\x0D\x20]',
1712 '\s' => '\s',
1713  
1714 '\w' => '[0-9A-Z_a-z]',
1715 '\D' => '${Elatin8::eD}',
1716 '\S' => '${Elatin8::eS}',
1717 '\W' => '${Elatin8::eW}',
1718  
1719 '\H' => '${Elatin8::eH}',
1720 '\V' => '${Elatin8::eV}',
1721 '\h' => '[\x09\x20]',
1722 '\v' => '[\x0A\x0B\x0C\x0D]',
1723 '\R' => '${Elatin8::eR}',
1724  
1725 25 }->{$1};
1726 }
1727  
1728 # POSIX-style character classes
1729 ▶ 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
1730 $char[$i] = {
1731  
1732 '[:lower:]' => '[\x41-\x5A\x61-\x7A]',
1733 '[:upper:]' => '[\x41-\x5A\x61-\x7A]',
1734 '[:^lower:]' => '${Elatin8::not_lower_i}',
1735 '[:^upper:]' => '${Elatin8::not_upper_i}',
1736  
1737 8 }->{$1};
1738 }
1739 elsif ($char[$i] =~ /\A ( \[\: \^? (?:alnum|alpha|ascii|blank|cntrl|digit|graph|lower|print|punct|space|upper|word|xdigit) :\] ) \z/oxms) {
1740 $char[$i] = {
1741  
1742 '[:alnum:]' => '[\x30-\x39\x41-\x5A\x61-\x7A]',
1743 '[:alpha:]' => '[\x41-\x5A\x61-\x7A]',
1744 '[:ascii:]' => '[\x00-\x7F]',
1745 '[:blank:]' => '[\x09\x20]',
1746 '[:cntrl:]' => '[\x00-\x1F\x7F]',
1747 '[:digit:]' => '[\x30-\x39]',
1748 '[:graph:]' => '[\x21-\x7F]',
1749 '[:lower:]' => '[\x61-\x7A]',
1750 '[:print:]' => '[\x20-\x7F]',
1751 '[:punct:]' => '[\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E]',
1752  
1753 # P.174 POSIX-Style Character Classes
1754 # in Chapter 5: Pattern Matching
1755 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
1756  
1757 # P.311 11.2.4 Character Classes and other Special Escapes
1758 # in Chapter 11: perlre: Perl regular expressions
1759 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
1760  
1761 # P.210 POSIX-Style Character Classes
1762 # in Chapter 5: Pattern Matching
1763 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1764  
1765 '[:space:]' => '[\s\x0B]', # "\s" plus vertical tab ("\cK")
1766  
1767 '[:upper:]' => '[\x41-\x5A]',
1768 '[:word:]' => '[\x30-\x39\x41-\x5A\x5F\x61-\x7A]',
1769 '[:xdigit:]' => '[\x30-\x39\x41-\x46\x61-\x66]',
1770 '[:^alnum:]' => '${Elatin8::not_alnum}',
1771 '[:^alpha:]' => '${Elatin8::not_alpha}',
1772 '[:^ascii:]' => '${Elatin8::not_ascii}',
1773 '[:^blank:]' => '${Elatin8::not_blank}',
1774 '[:^cntrl:]' => '${Elatin8::not_cntrl}',
1775 '[:^digit:]' => '${Elatin8::not_digit}',
1776 '[:^graph:]' => '${Elatin8::not_graph}',
1777 '[:^lower:]' => '${Elatin8::not_lower}',
1778 '[:^print:]' => '${Elatin8::not_print}',
1779 '[:^punct:]' => '${Elatin8::not_punct}',
1780 '[:^space:]' => '${Elatin8::not_space}',
1781 '[:^upper:]' => '${Elatin8::not_upper}',
1782 '[:^word:]' => '${Elatin8::not_word}',
1783 '[:^xdigit:]' => '${Elatin8::not_xdigit}',
1784  
1785 70 }->{$1};
1786 }
1787 elsif ($char[$i] =~ /\A \\ ($q_char) \z/oxms) {
1788 7 $char[$i] = $1;
1789 }
1790 }
1791  
1792 # open character list
1793 650 my @singleoctet = ();
1794 650 my @multipleoctet = ();
1795 650 ▶ for (my $i=0; $i <= $#char; ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1527 650 2177
1796  
1797 # escaped -
1798 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
1799 246 $i += 1;
1800 246 next;
1801 }
1802  
1803 # make range regexp
1804 elsif ($char[$i] eq '...') {
1805  
1806 # range error
1807 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
1808 0 croak 'Invalid [] range in regexp (length(A) > length(B)) ' . '\x' . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]);
1809 }
1810 elsif (CORE::length($char[$i-1]) == CORE::length($char[$i+1])) {
1811 246 ▶ if ($char[$i-1] gt $char[$i+1]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i - 1] gt $char[$i + 1]) 0 246 246
1812 0 croak 'Invalid [] range in regexp (CORE::ord(A) > CORE::ord(B)) ' . '\x' . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]);
1813 }
1814 }
1815  
1816 # make range regexp per length
1817 246 for my $length (CORE::length($char[$i-1]) .. CORE::length($char[$i+1])) {
1818 246 my @regexp = ();
1819  
1820 # is first and last
1821 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
1822 246 push @regexp, _range_regexp($length, $char[$i-1], $char[$i+1]);
1823 }
1824  
1825 # is first
1826 elsif ($length == CORE::length($char[$i-1])) {
1827 0 push @regexp, _range_regexp($length, $char[$i-1], "\xFF" x $length);
1828 }
1829  
1830 # is inside in first and last
1831 ▶ 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
1832 0 push @regexp, _range_regexp($length, "\x00" x $length, "\xFF" x $length);
1833 }
1834  
1835 # is last
1836 elsif ($length == CORE::length($char[$i+1])) {
1837 0 push @regexp, _range_regexp($length, "\x00" x $length, $char[$i+1]);
1838 }
1839  
1840 else {
1841 0 die __FILE__, ": subroutine make_regexp panic.\n";
1842 }
1843  
1844 246 ▶ if ($length == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length == 1) { } 246 0 246
1845 246 push @singleoctet, @regexp;
1846 }
1847 else {
1848 0 push @multipleoctet, @regexp;
1849 }
1850 }
1851  
1852 246 $i += 2;
1853 }
1854  
1855 # with /i modifier
1856 elsif ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) {
1857 949 ▶ if ($modifier =~ /i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) { } 480 469 949
1858 480 my $uc = Elatin8::uc($char[$i]);
1859 480 my $fc = Elatin8::fc($char[$i]);
1860 480 ▶ if ($uc ne $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc ne $fc) { } 240 240 480
1861 240 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 240 0 240
1862 240 push @singleoctet, $uc, $fc;
1863 }
1864 else {
1865 0 push @singleoctet, $uc;
1866 0 push @multipleoctet, $fc;
1867 }
1868 }
1869 else {
1870 240 push @singleoctet, $char[$i];
1871 }
1872 }
1873 else {
1874 469 push @singleoctet, $char[$i];
1875 }
1876 949 $i += 1;
1877 }
1878  
1879 # single character of single octet code
1880 elsif ($char[$i] =~ /\A (?: \\h ) \z/oxms) {
1881 0 push @singleoctet, "\t", "\x20";
1882 0 $i += 1;
1883 }
1884 elsif ($char[$i] =~ /\A (?: \\v ) \z/oxms) {
1885 0 push @singleoctet, "\x0A", "\x0B", "\x0C", "\x0D";
1886 0 $i += 1;
1887 }
1888 elsif ($char[$i] =~ /\A (?: \\d | \\s | \\w ) \z/oxms) {
1889 2 push @singleoctet, $char[$i];
1890 2 $i += 1;
1891 }
1892  
1893 # single character of multiple-octet code
1894 else {
1895 84 push @multipleoctet, $char[$i];
1896 84 $i += 1;
1897 }
1898 }
1899  
1900 # quote metachar
1901 650 for (@singleoctet) {
1902 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
1903 0 $_ = '-';
1904 }
1905 elsif (/\A \n \z/oxms) {
1906 8 $_ = '\n';
1907 }
1908 elsif (/\A \r \z/oxms) {
1909 8 $_ = '\r';
1910 }
1911 elsif (/\A ([\x00-\x20\x7F-\xFF]) \z/oxms) {
1912 744 $_ = sprintf('\x%02X', CORE::ord $1);
1913 }
1914 elsif (/\A [\x00-\xFF] \z/oxms) {
1915 429 $_ = quotemeta $_;
1916 }
1917 }
1918  
1919 # return character list
1920 650 return \@singleoctet, \@multipleoctet;
1921 }
1922  
1923 #
1924 # Latin-8 octal escape sequence
1925 #
1926 5 ▶sub octchr {
Subroutine octchr: called CC=2 SCAR=6.9
Pod undocumented
1927 5 my($octdigit) = @_;
1928  
1929 5 my @binary = ();
1930 5 for my $octal (split(//,$octdigit)) {
1931 push @binary, {
1932 '0' => '000',
1933 '1' => '001',
1934 '2' => '010',
1935 '3' => '011',
1936 '4' => '100',
1937 '5' => '101',
1938 '6' => '110',
1939 '7' => '111',
1940 50 }->{$octal};
1941 }
1942 5 my $binary = join '', @binary;
1943  
1944 my $octchr = {
1945 # 1234567
1946 1 => pack('B*', "0000000$binary"),
1947 2 => pack('B*', "000000$binary"),
1948 3 => pack('B*', "00000$binary"),
1949 4 => pack('B*', "0000$binary"),
1950 5 => pack('B*', "000$binary"),
1951 6 => pack('B*', "00$binary"),
1952 7 => pack('B*', "0$binary"),
1953 0 => pack('B*', "$binary"),
1954  
1955 5 }->{CORE::length($binary) % 8};
1956  
1957 5 return $octchr;
1958 }
1959  
1960 #
1961 # Latin-8 hexadecimal escape sequence
1962 #
1963 5 ▶sub hexchr {
Subroutine hexchr: called CC=1 SCAR=0.0
Pod undocumented
1964 5 my($hexdigit) = @_;
1965  
1966 my $hexchr = {
1967 1 => pack('H*', "0$hexdigit"),
1968 0 => pack('H*', "$hexdigit"),
1969  
1970 5 }->{CORE::length($_[0]) % 2};
1971  
1972 5 return $hexchr;
1973 }
1974  
1975 #
1976 # Latin-8 open character list for qr
1977 #
1978 576 ▶sub charlist_qr {
Subroutine charlist_qr: called CC=17 SCAR=28.7
Pod undocumented
1979  
1980 576 my $modifier = pop @_;
1981 576 my @char = @_;
1982  
1983 576 my($singleoctet, $multipleoctet) = _charlist(@char, $modifier);
1984 576 my @singleoctet = @$singleoctet;
1985 576 my @multipleoctet = @$multipleoctet;
1986  
1987 # return character list
1988 576 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) 498 78 576
1989  
1990 # with /i modifier
1991 498 ▶ if ($modifier =~ m/i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) 265 233 498
1992 265 my %singleoctet_ignorecase = ();
1993 265 for (@singleoctet) {
1994 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
1995 745 for my $ord (hex($1) .. hex($2)) {
1996 795 my $char = CORE::chr($ord);
1997 795 my $uc = Elatin8::uc($char);
1998 795 my $fc = Elatin8::fc($char);
1999 795 ▶ if ($uc eq $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc eq $fc) { } 240 555 795
2000 240 $singleoctet_ignorecase{unpack 'C*', $char} = 1;
2001 }
2002 else {
2003 555 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 555 0 555
2004 555 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2005 555 $singleoctet_ignorecase{unpack 'C*', $fc} = 1;
2006 }
2007 else {
2008 0 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2009 0 push @multipleoctet, join '', map {sprintf('\x%02X',$_)} unpack 'C*', $fc;
2010 }
2011 }
2012 }
2013 }
2014 745 ▶ if ($_ ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ ne "") 0 745 745
2015 0 $singleoctet_ignorecase{unpack 'C*', $_} = 1;
2016 }
2017 }
2018 265 my $i = 0;
2019 265 my @singleoctet_ignorecase = ();
2020 265 for my $ord (0 .. 255) {
2021 67840 ▶ if (exists $singleoctet_ignorecase{$ord}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $singleoctet_ignorecase{$ord}) { } 870 66970 67840
2022 870 push @{$singleoctet_ignorecase[$i]}, $ord;
2023 }
2024 else {
2025 66970 $i++;
2026 }
2027 }
2028 265 @singleoctet = ();
2029 265 for my $range (@singleoctet_ignorecase) {
2030 56160 ▶ if (ref $range) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $range) 770 55390 56160
2031 770 ▶ if (scalar(@{$range}) == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @{$range;} == 1) { } 720 50 770
elsif (scalar @{$range;} == 2) { } 0 50 50
2032 720 push @singleoctet, sprintf('\x%02X', @{$range}[0]);
2033 }
2034 50 elsif (scalar(@{$range}) == 2) {
2035 0 push @singleoctet, sprintf('\x%02X\x%02X', @{$range}[0], @{$range}[-1]);
2036 }
2037 else {
2038 50 push @singleoctet, sprintf('\x%02X-\x%02X', @{$range}[0], @{$range}[-1]);
2039 }
2040 }
2041 }
2042 }
2043  
2044 498 my $not_anchor = '';
2045  
2046 498 push @multipleoctet, join('', $not_anchor, '[', @singleoctet, ']' );
2047 }
2048 576 ▶ if (scalar(@multipleoctet) >= 2) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @multipleoctet >= 2) { } 6 570 576
2049 6 return '(?:' . join('|', @multipleoctet) . ')';
2050 }
2051 else {
2052 570 return $multipleoctet[0];
2053 }
2054 }
2055  
2056 #
2057 # Latin-8 open character list for not qr
2058 #
2059 74 ▶sub charlist_not_qr {
Subroutine charlist_not_qr: called CC=18 SCAR=33.1
Pod undocumented
2060  
2061 74 my $modifier = pop @_;
2062 74 my @char = @_;
2063  
2064 74 my($singleoctet, $multipleoctet) = _charlist(@char, $modifier);
2065 74 my @singleoctet = @$singleoctet;
2066 74 my @multipleoctet = @$multipleoctet;
2067  
2068 # with /i modifier
2069 74 ▶ if ($modifier =~ m/i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) 25 49 74
2070 25 my %singleoctet_ignorecase = ();
2071 25 for (@singleoctet) {
2072 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
2073 25 for my $ord (hex($1) .. hex($2)) {
2074 75 my $char = CORE::chr($ord);
2075 75 my $uc = Elatin8::uc($char);
2076 75 my $fc = Elatin8::fc($char);
2077 75 ▶ if ($uc eq $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc eq $fc) { } 0 75 75
2078 0 $singleoctet_ignorecase{unpack 'C*', $char} = 1;
2079 }
2080 else {
2081 75 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 75 0 75
2082 75 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2083 75 $singleoctet_ignorecase{unpack 'C*', $fc} = 1;
2084 }
2085 else {
2086 0 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2087 0 push @multipleoctet, join '', map {sprintf('\x%02X',$_)} unpack 'C*', $fc;
2088 }
2089 }
2090 }
2091 }
2092 25 ▶ if ($_ ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ ne "") 0 25 25
2093 0 $singleoctet_ignorecase{unpack 'C*', $_} = 1;
2094 }
2095 }
2096 25 my $i = 0;
2097 25 my @singleoctet_ignorecase = ();
2098 25 for my $ord (0 .. 255) {
2099 6400 ▶ if (exists $singleoctet_ignorecase{$ord}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $singleoctet_ignorecase{$ord}) { } 150 6250 6400
2100 150 push @{$singleoctet_ignorecase[$i]}, $ord;
2101 }
2102 else {
2103 6250 $i++;
2104 }
2105 }
2106 25 @singleoctet = ();
2107 25 for my $range (@singleoctet_ignorecase) {
2108 2400 ▶ if (ref $range) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $range) 50 2350 2400
2109 50 ▶ if (scalar(@{$range}) == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @{$range;} == 1) { } 0 50 50
elsif (scalar @{$range;} == 2) { } 0 50 50
2110 0 push @singleoctet, sprintf('\x%02X', @{$range}[0]);
2111 }
2112 50 elsif (scalar(@{$range}) == 2) {
2113 0 push @singleoctet, sprintf('\x%02X\x%02X', @{$range}[0], @{$range}[-1]);
2114 }
2115 else {
2116 50 push @singleoctet, sprintf('\x%02X-\x%02X', @{$range}[0], @{$range}[-1]);
2117 }
2118 }
2119 }
2120 }
2121  
2122 # return character list
2123 74 ▶ if (scalar(@multipleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @multipleoctet >= 1) { } 0 74 74
2124 0 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) { } 0 0 0
2125  
2126 # any character other than multiple-octet and single octet character class
2127 0 return '(?!' . join('|', @multipleoctet) . ')(?:[^' . join('', @singleoctet) . '])';
2128 }
2129 else {
2130  
2131 # any character other than multiple-octet character class
2132 0 return '(?!' . join('|', @multipleoctet) . ")(?:$your_char)";
2133 }
2134 }
2135 else {
2136 74 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) { } 74 0 74
2137  
2138 # any character other than single octet character class
2139 74 return '(?:[^' . join('', @singleoctet) . '])';
2140 }
2141 else {
2142  
2143 # any character
2144 0 return "(?:$your_char)";
2145 }
2146 }
2147 }
2148  
2149 #
2150 # open file in read mode
2151 #
2152 422 ▶sub _open_r {
Subroutine _open_r: called CC=1 SCAR=0.0
2153 422 my(undef,$file) = @_;
2154 422 ▶ use Fcntl qw(O_RDONLY);
Subroutine BEGIN: called CC=1 SCAR=0.0
2155 422 return CORE::sysopen($_[0], $file, &O_RDONLY);
2156 }
2157  
2158 #
2159 # open file in append mode
2160 #
2161 211 ▶sub _open_a {
Subroutine _open_a: called CC=1 SCAR=0.0
2162 211 my(undef,$file) = @_;
2163 422 ▶ use Fcntl qw(O_WRONLY O_APPEND O_CREAT);
Subroutine BEGIN: called CC=1 SCAR=0.0
2164 211 return CORE::sysopen($_[0], $file, &O_WRONLY|&O_APPEND|&O_CREAT);
2165 }
2166  
2167 #
2168 # safe system
2169 #
2170 211 ▶sub _systemx {
Subroutine _systemx: called CC=1 SCAR=0.0
2171  
2172 # P.707 29.2.33. exec
2173 # in Chapter 29: Functions
2174 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2175 #
2176 # Be aware that in older releases of Perl, exec (and system) did not flush
2177 # your output buffer, so you needed to enable command buffering by setting $|
2178 # on one or more filehandles to avoid lost output in the case of exec, or
2179 # misordererd output in the case of system. This situation was largely remedied
2180 # in the 5.6 release of Perl. (So, 5.005 release not yet.)
2181  
2182 # P.855 exec
2183 # in Chapter 27: Functions
2184 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2185 #
2186 # In very old release of Perl (before v5.6), exec (and system) did not flush
2187 # your output buffer, so you needed to enable command buffering by setting $|
2188 # on one or more filehandles to avoid lost output with exec or misordered
2189 # output with system.
2190  
2191 211 $| = 1;
2192  
2193 # P.565 23.1.2. Cleaning Up Your Environment
2194 # in Chapter 23: Security
2195 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2196  
2197 # P.656 Cleaning Up Your Environment
2198 # in Chapter 20: Security
2199 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2200  
2201 # local $ENV{'PATH'} = '.';
2202 211 local @ENV{qw(IFS CDPATH ENV BASH_ENV)}; # Make %ENV safer
2203  
2204 # P.707 29.2.33. exec
2205 # in Chapter 29: Functions
2206 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2207 #
2208 # As we mentioned earlier, exec treats a discrete list of arguments as an
2209 # indication that it should bypass shell processing. However, there is one
2210 # place where you might still get tripped up. The exec call (and system, too)
2211 # will not distinguish between a single scalar argument and an array containing
2212 # only one element.
2213 #
2214 # @args = ("echo surprise"); # just one element in list
2215 # exec @args # still subject to shell escapes
2216 # or die "exec: $!"; # because @args == 1
2217 #
2218 # To avoid this, you can use the PATHNAME syntax, explicitly duplicating the
2219 # first argument as the pathname, which forces the rest of the arguments to be
2220 # interpreted as a list, even if there is only one of them:
2221 #
2222 # exec { $args[0] } @args # safe even with one-argument list
2223 # or die "can't exec @args: $!";
2224  
2225 # P.855 exec
2226 # in Chapter 27: Functions
2227 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2228 #
2229 # As we mentioned earlier, exec treats a discrete list of arguments as a
2230 # directive to bypass shell processing. However, there is one place where
2231 # you might still get tripped up. The exec call (and system, too) cannot
2232 # distinguish between a single scalar argument and an array containing
2233 # only one element.
2234 #
2235 # @args = ("echo surprise"); # just one element in list
2236 # exec @args # still subject to shell escapes
2237 # || die "exec: $!"; # because @args == 1
2238 #
2239 # To avoid this, use the PATHNAME syntax, explicitly duplicating the first
2240 # argument as the pathname, which forces the rest of the arguments to be
2241 # interpreted as a list, even if there is only one of them:
2242 #
2243 # exec { $args[0] } @args # safe even with one-argument list
2244 # || die "can't exec @args: $!";
2245  
2246 211 return CORE::system { $_[0] } @_; # safe even with one-argument list
2247 }
2248  
2249 #
2250 # Latin-8 order to character (with parameter)
2251 #
2252 3469 ▶sub Elatin8::chr(;$) {
Subroutine chr: called CC=4 SCAR=13.9
Pod undocumented
2253  
2254 3469 ▶ my $c = @_ ? $_[0] : $_;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 3469 0 3469
2255  
2256 3469 ▶ if ($c == 0x00) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c == 0) { } 24 3445 3469
2257 24 return "\x00";
2258 }
2259 else {
2260 3445 my @chr = ();
2261 3445 ▶ while ($c > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c > 0) 3445 3445 6890
2262 3445 unshift @chr, ($c % 0x100);
2263 3445 $c = int($c / 0x100);
2264 }
2265 3445 return pack 'C*', @chr;
2266 }
2267 }
2268  
2269 #
2270 # Latin-8 order to character (without parameter)
2271 #
2272 0 ▶sub Elatin8::chr_() {
Subroutine chr_: not called CC=3 SCAR=24.8
Pod undocumented
2273  
2274 0 my $c = $_;
2275  
2276 0 ▶ if ($c == 0x00) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c == 0) { } 0 0 0
2277 0 return "\x00";
2278 }
2279 else {
2280 0 my @chr = ();
2281 0 ▶ while ($c > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c > 0) 0 0 0
2282 0 unshift @chr, ($c % 0x100);
2283 0 $c = int($c / 0x100);
2284 }
2285 0 return pack 'C*', @chr;
2286 }
2287 }
2288  
2289 #
2290 # Latin-8 path globbing (with parameter)
2291 #
2292 0 ▶sub Elatin8::glob($) {
Subroutine glob: not called CC=3 SCAR=24.8
Pod undocumented
2293  
2294 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2295 0 my @glob = _DOS_like_glob(@_);
2296 0 for my $glob (@glob) {
2297 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2298 }
2299 0 return @glob;
2300 }
2301 else {
2302 0 my $glob = _DOS_like_glob(@_);
2303 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2304 0 return $glob;
2305 }
2306 }
2307  
2308 #
2309 # Latin-8 path globbing (without parameter)
2310 #
2311 0 ▶sub Elatin8::glob_() {
Subroutine glob_: not called CC=3 SCAR=24.8
Pod undocumented
2312  
2313 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2314 0 my @glob = _DOS_like_glob();
2315 0 for my $glob (@glob) {
2316 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2317 }
2318 0 return @glob;
2319 }
2320 else {
2321 0 my $glob = _DOS_like_glob();
2322 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2323 0 return $glob;
2324 }
2325 }
2326  
2327 #
2328 # Latin-8 path globbing via File::DosGlob 1.10
2329 #
2330 # Often I confuse "_dosglob" and "_doglob".
2331 # So, I renamed "_dosglob" to "_DOS_like_glob".
2332 #
2333 422 my %iter;
2334 my %entries;
2335 0 ▶sub _DOS_like_glob {
Subroutine _DOS_like_glob: not called CC=10 SCAR=47.0
2336  
2337 # context (keyed by second cxix argument provided by core)
2338 0 my($expr,$cxix) = @_;
2339  
2340 # glob without args defaults to $_
2341 0 ▶ $expr = $_ if not defined $expr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $expr 0 0 0
2342  
2343 # represents the current user's home directory
2344 #
2345 # 7.3. Expanding Tildes in Filenames
2346 # in Chapter 7. File Access
2347 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2348 #
2349 # and File::HomeDir, File::HomeDir::Windows module
2350  
2351 # DOS-like system
2352 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
2353 0 $expr =~ s{ \A ~ (?= [^/\\] ) }
2354 0 { my_home_MSWin32() }oxmse;
2355 }
2356  
2357 # UNIX-like system
2358 else {
2359 0 $expr =~ s{ \A ~ ( (?:[^/])* ) }
2360 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
2361 }
2362  
2363 # assume global context if not provided one
2364 0 ▶ $cxix = '_G_' if not defined $cxix;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $cxix 0 0 0
2365 0 ▶ $iter{$cxix} = 0 if not exists $iter{$cxix};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $iter{$cxix} 0 0 0
2366  
2367 # if we're just beginning, do it all first
2368 0 ▶ if ($iter{$cxix} == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iter{$cxix} == 0) 0 0 0
2369 0 $entries{$cxix} = [ _do_glob(1, _parse_line($expr)) ];
2370 }
2371  
2372 # chuck it all out, quick or slow
2373 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2374 0 delete $iter{$cxix};
2375 0 return @{delete $entries{$cxix}};
2376 }
2377 else {
2378 0 ▶ if ($iter{$cxix} = scalar @{$entries{$cxix}}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iter{$cxix} = scalar @{$entries{$cxix};}) { } 0 0 0
2379 0 return shift @{$entries{$cxix}};
2380 }
2381 else {
2382 # return undef for EOL
2383 0 delete $iter{$cxix};
2384 0 delete $entries{$cxix};
2385 0 return undef;
2386 }
2387 }
2388 }
2389  
2390 #
2391 # Latin-8 path globbing subroutine
2392 #
2393 0 ▶sub _do_glob {
Subroutine _do_glob: not called CC=44 SCAR=75.9
2394  
2395 0 my($cond,@expr) = @_;
2396 0 my @glob = ();
2397 0 my $fix_drive_relative_paths = 0;
2398  
2399 OUTER:
2400 0 for my $expr (@expr) {
2401 0 ▶ next OUTER if not defined $expr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $expr 0 0 0
2402 0 ▶ next OUTER if $expr eq '';
Branch: 1 branch
BranchTrueFalseTotal
if $expr eq "" 0 0 0
2403  
2404 0 my @matched = ();
2405 0 my @globdir = ();
2406 0 my $head = '.';
2407 0 my $pathsep = '/';
2408 0 my $tail;
2409  
2410 # if argument is within quotes strip em and do no globbing
2411 0 ▶ if ($expr =~ /\A " ((?:$q_char)*?) " \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expr =~ /\A " ((?:$Elatin8::q_char)*?) " \z/mosx) 0 0 0
2412 0 $expr = $1;
2413 0 ▶ if ($cond eq 'd') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cond eq 'd') { } 0 0 0
2414 0 ▶ if (-d $expr) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $expr) 0 0 0
2415 0 push @glob, $expr;
2416 }
2417 }
2418 else {
2419 0 ▶ if (-e $expr) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $expr) 0 0 0
2420 0 push @glob, $expr;
2421 }
2422 }
2423 0 next OUTER;
2424 }
2425  
2426 # wildcards with a drive prefix such as h:*.pm must be changed
2427 # to h:./*.pm to expand correctly
2428 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
2429 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
2430 0 $fix_drive_relative_paths = 1;
2431 }
2432 }
2433  
2434 0 ▶ if (($head, $tail) = _parse_path($expr,$pathsep)) {
Branch: 1 branch
BranchTrueFalseTotal
if (($head, $tail) = _parse_path($expr, $pathsep)) 0 0 0
2435 0 ▶ if ($tail eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($tail eq "") 0 0 0
2436 0 push @glob, $expr;
2437 0 next OUTER;
2438 }
2439 0 ▶ if ($head =~ / \A (?:$q_char)*? [*?] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head =~ / \A (?:$Elatin8::q_char)*? [*?] /mosx) 0 0 0
2440 0 ▶ if (@globdir = _do_glob('d', $head)) {
Branch: 1 branch
BranchTrueFalseTotal
if (@globdir = _do_glob("d", $head)) 0 0 0
2441 0 push @glob, _do_glob($cond, map {"$_$pathsep$tail"} @globdir);
2442 0 next OUTER;
2443 }
2444 }
2445 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
2446 0 $head .= $pathsep;
2447 }
2448 0 $expr = $tail;
2449 }
2450  
2451 # If file component has no wildcards, we can avoid opendir
2452 0 ▶ if ($expr !~ / \A (?:$q_char)*? [*?] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($expr =~ / \A (?:$Elatin8::q_char)*? [*?] /mosx) 0 0 0
2453 0 ▶ if ($head eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($head eq ".") 0 0 0
2454 0 $head = '';
2455 }
2456 0 ▶ if ($head ne '' and ($head =~ / \G ($q_char) /oxmsg)[-1] ne $pathsep) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head ne "" and ($head =~ / \G ($Elatin8::q_char) /gmosx)[-1] ne $pathsep) 0 0 0
Condition0%0/3
$head ne "" and ($head =~ / \G ($Elatin8::q_char) /gmosx)[-1] ne $pathsep
!ll&&!rl&&r
000
MC/DC0%0/2
$head ne "" and ($head =~ / \G ($Elatin8::q_char) /gmosx)[-1] ne $pathsep
$head ne "" ($head =~ / \G ($Elatin8::q_char) /gmosx)[-1] ne $pathsep
Truth table0%0/3
A and B
A= $head ne ""B= ($head =~ / \G ($Elatin8::q_char) /gmosx)[-1] ne $pathsep
ABresult
0X0
100
111
2457 0 $head .= $pathsep;
2458 }
2459 0 $head .= $expr;
2460 0 ▶ if ($cond eq 'd') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cond eq 'd') { } 0 0 0
2461 0 ▶ if (-d $head) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $head) 0 0 0
2462 0 push @glob, $head;
2463 }
2464 }
2465 else {
2466 0 ▶ if (-e $head) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $head) 0 0 0
2467 0 push @glob, $head;
2468 }
2469 }
2470 0 next OUTER;
2471 }
2472 0 ▶ opendir(*DIR, $head) or next OUTER;
Branch: 1 branch
BranchTrueFalseTotal
opendir *DIR, $head or next OUTER 0 0 0
2473 0 my @leaf = readdir DIR;
2474 0 closedir DIR;
2475  
2476 0 ▶ if ($head eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($head eq ".") 0 0 0
2477 0 $head = '';
2478 }
2479 0 ▶ if ($head ne '' and ($head =~ / \G ($q_char) /oxmsg)[-1] ne $pathsep) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head ne "" and ($head =~ / \G ($Elatin8::q_char) /gmosx)[-1] ne $pathsep) 0 0 0
Condition0%0/3
$head ne "" and ($head =~ / \G ($Elatin8::q_char) /gmosx)[-1] ne $pathsep
!ll&&!rl&&r
000
MC/DC0%0/2
$head ne "" and ($head =~ / \G ($Elatin8::q_char) /gmosx)[-1] ne $pathsep
$head ne "" ($head =~ / \G ($Elatin8::q_char) /gmosx)[-1] ne $pathsep
Truth table0%0/3
A and B
A= $head ne ""B= ($head =~ / \G ($Elatin8::q_char) /gmosx)[-1] ne $pathsep
ABresult
0X0
100
111
2480 0 $head .= $pathsep;
2481 }
2482  
2483 0 my $pattern = '';
2484 0 ▶ while ($expr =~ / \G ($q_char) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expr =~ / \G ($Elatin8::q_char) /cgox) 0 0 0
2485 0 my $char = $1;
2486  
2487 # 6.9. Matching Shell Globs as Regular Expressions
2488 # in Chapter 6. Pattern Matching
2489 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2490 # (and so on)
2491  
2492 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
2493 0 $pattern .= "(?:$your_char)*",
2494 }
2495 elsif ($char eq '?') {
2496 0 $pattern .= "(?:$your_char)?", # DOS style
2497 # $pattern .= "(?:$your_char)", # UNIX style
2498 }
2499 elsif ((my $fc = Elatin8::fc($char)) ne $char) {
2500 0 $pattern .= $fc;
2501 }
2502 else {
2503 0 $pattern .= quotemeta $char;
2504 }
2505 }
2506 0 ▶ my $matchsub = sub { Elatin8::fc($_[0]) =~ /\A $pattern \z/xms };
Subroutine __ANON__: not called CC=1 SCAR=6.9
2507  
2508 # if ($@) {
2509 # print STDERR "$0: $@\n";
2510 # next OUTER;
2511 # }
2512  
2513 INNER:
2514 0 for my $leaf (@leaf) {
2515 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
2516 0 next INNER;
2517 }
2518 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
2519 0 next INNER;
2520 }
2521  
2522 0 ▶ if (&$matchsub($leaf)) {
Branch: 1 branch
BranchTrueFalseTotal
if (&$matchsub($leaf)) 0 0 0
2523 0 push @matched, "$head$leaf";
2524 0 next INNER;
2525 }
2526  
2527 # [DOS compatibility special case]
2528 # Failed, add a trailing dot and try again, but only...
2529  
2530 0 ▶ if (Elatin8::index($leaf,'.') == -1 and # if name does not have a dot in it *and*
Branch: 1 branch
BranchTrueFalseTotal
if (&Elatin8::index($leaf, ".") == -1 and length $leaf <= 8 and &Elatin8::index($pattern, "\\.") != -1) 0 0 0
Condition0%0/6
&Elatin8::index($leaf, ".") == -1 and length $leaf <= 8 and &Elatin8::index($pattern, "\\.") != -1
!ll&&!rl&&r
000
&Elatin8::index($leaf, ".") == -1 and length $leaf <= 8
!ll&&!rl&&r
000
MC/DC0%0/3
&Elatin8::index($leaf, ".") == -1 and length $leaf <= 8 and &Elatin8::index($pattern, "\\.") != -1
&Elatin8::index($leaf, ".") == -1 length $leaf <= 8 &Elatin8::index($pattern, "\\.") != -1
Truth table0%0/4
A and B and C
A= &Elatin8::index($leaf, ".") == -1B= length $leaf <= 8C= &Elatin8::index($pattern, "\\.") != -1
ABCresult
0XX0
10X0
1100
1111
2531 CORE::length($leaf) <= 8 and # name is shorter than or equal to 8 chars *and*
2532 Elatin8::index($pattern,'\\.') != -1 # pattern has a dot.
2533 ) {
2534 0 ▶ if (&$matchsub("$leaf.")) {
Branch: 1 branch
BranchTrueFalseTotal
if (&$matchsub("$leaf.")) 0 0 0
2535 0 push @matched, "$head$leaf";
2536 0 next INNER;
2537 }
2538 }
2539 }
2540 0 ▶ if (@matched) {
Branch: 1 branch
BranchTrueFalseTotal
if (@matched) 0 0 0
2541 0 push @glob, @matched;
2542 }
2543 }
2544 0 ▶ if ($fix_drive_relative_paths) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fix_drive_relative_paths) 0 0 0
2545 0 for my $glob (@glob) {
2546 0 $glob =~ s# \A ([A-Za-z]:) \./ #$1#oxms;
2547 }
2548 }
2549 0 return @glob;
2550 }
2551  
2552 #
2553 # Latin-8 parse line
2554 #
2555 0 ▶sub _parse_line {
Subroutine _parse_line: not called CC=3 SCAR=24.8
2556  
2557 0 my($line) = @_;
2558  
2559 0 $line .= ' ';
2560 0 my @piece = ();
2561 0 ▶ while ($line =~ /
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ / " ( (?>(?: [^"] )* ) ) " (?>\s+) | ( (?>(?: [^"\s] )* ) ) (?>\s+) /gmosx) 0 0 0
2562 " ( (?>(?: [^"] )* ) ) " (?>\s+) |
2563 ( (?>(?: [^"\s] )* ) ) (?>\s+)
2564 /oxmsg
2565 ) {
2566 0 ▶ push @piece, defined($1) ? $1 : $2;
Branch: 1 branch
BranchTrueFalseTotal
defined $1 ? : 0 0 0
2567 }
2568 0 return @piece;
2569 }
2570  
2571 #
2572 # Latin-8 parse path
2573 #
2574 0 ▶sub _parse_path {
Subroutine _parse_path: not called CC=2 SCAR=17.9
2575  
2576 0 my($path,$pathsep) = @_;
2577  
2578 0 $path .= '/';
2579 0 my @subpath = ();
2580 0 ▶ while ($path =~ /
Branch: 1 branch
BranchTrueFalseTotal
if ($path =~ m( ((?: [^/\\] )+?) [/\\] )gmosx) 0 0 0
2581 ((?: [^\/\\] )+?) [\/\\]
2582 /oxmsg
2583 ) {
2584 0 push @subpath, $1;
2585 }
2586  
2587 0 my $tail = pop @subpath;
2588 0 my $head = join $pathsep, @subpath;
2589 0 return $head, $tail;
2590 }
2591  
2592 #
2593 # via File::HomeDir::Windows 1.00
2594 #
2595 0 ▶sub my_home_MSWin32 {
Subroutine my_home_MSWin32: not called CC=9 SCAR=45.0
Pod undocumented
2596  
2597 # A lot of unix people and unix-derived tools rely on
2598 # the ability to overload HOME. We will support it too
2599 # so that they can replace raw HOME calls with File::HomeDir.
2600 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
2601 0 return $ENV{'HOME'};
2602 }
2603  
2604 # Do we have a user profile?
2605 ▶ 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
2606 0 return $ENV{'USERPROFILE'};
2607 }
2608  
2609 # Some Windows use something like $ENV{'HOME'}
2610 ▶ 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
2611 0 return join '', $ENV{'HOMEDRIVE'}, $ENV{'HOMEPATH'};
2612 }
2613  
2614 0 return undef;
2615 }
2616  
2617 #
2618 # via File::HomeDir::Unix 1.00
2619 #
2620 0 ▶sub my_home {
Subroutine my_home: not called CC=7 SCAR=40.3
Pod undocumented
2621 0 my $home;
2622  
2623 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
2624 0 $home = $ENV{'HOME'};
2625 }
2626  
2627 # This is from the original code, but I'm guessing
2628 # it means "login directory" and exists on some Unixes.
2629 ▶ 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
2630 0 $home = $ENV{'LOGDIR'};
2631 }
2632  
2633 ### More-desperate methods
2634  
2635 # Light desperation on any (Unixish) platform
2636 else {
2637 0 $home = CORE::eval q{ (getpwuid($<))[7] };
2638 }
2639  
2640 # On Unix in general, a non-existant home means "no home"
2641 # For example, "nobody"-like users might use /nonexistant
2642 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
2643 0 $home = undef;
2644 }
2645 0 return $home;
2646 }
2647  
2648 #
2649 # ${^PREMATCH}, $PREMATCH, $` the string preceding what was matched
2650 #
2651 56 ▶sub Elatin8::PREMATCH {
Subroutine PREMATCH: called CC=1 SCAR=0.0
Pod undocumented
2652 56 return $`;
2653 }
2654  
2655 #
2656 # ${^MATCH}, $MATCH, $& the string that matched
2657 #
2658 81 ▶sub Elatin8::MATCH {
Subroutine MATCH: called CC=1 SCAR=0.0
Pod undocumented
2659 81 return $&;
2660 }
2661  
2662 #
2663 # ${^POSTMATCH}, $POSTMATCH, $' the string following what was matched
2664 #
2665 42 ▶sub Elatin8::POSTMATCH {
Subroutine POSTMATCH: called CC=1 SCAR=0.0
Pod undocumented
2666 42 return $';
2667 }
2668  
2669 #
2670 # Latin-8 character to order (with parameter)
2671 #
2672 0 ▶sub Latin8::ord(;$) {
Subroutine ord: not called CC=4 SCAR=30.0
2673  
2674 0 ▶ local $_ = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
2675  
2676 0 ▶ if (/\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\A ($Elatin8::q_char) /mosx) { } 0 0 0
2677 0 my @ord = unpack 'C*', $1;
2678 0 my $ord = 0;
2679 0 ▶ while (my $o = shift @ord) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $o = shift @ord) 0 0 0
2680 0 $ord = $ord * 0x100 + $o;
2681 }
2682 0 return $ord;
2683 }
2684 else {
2685 0 return CORE::ord $_;
2686 }
2687 }
2688  
2689 #
2690 # Latin-8 character to order (without parameter)
2691 #
2692 0 ▶sub Latin8::ord_() {
Subroutine ord_: not called CC=3 SCAR=24.8
2693  
2694 0 ▶ if (/\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\A ($Elatin8::q_char) /mosx) { } 0 0 0
2695 0 my @ord = unpack 'C*', $1;
2696 0 my $ord = 0;
2697 0 ▶ while (my $o = shift @ord) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $o = shift @ord) 0 0 0
2698 0 $ord = $ord * 0x100 + $o;
2699 }
2700 0 return $ord;
2701 }
2702 else {
2703 0 return CORE::ord $_;
2704 }
2705 }
2706  
2707 #
2708 # Latin-8 reverse
2709 #
2710 0 ▶sub Latin8::reverse(@) {
Subroutine reverse: not called CC=2 SCAR=17.9
2711  
2712 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2713 0 return CORE::reverse @_;
2714 }
2715 else {
2716  
2717 # One of us once cornered Larry in an elevator and asked him what
2718 # problem he was solving with this, but he looked as far off into
2719 # the distance as he could in an elevator and said, "It seemed like
2720 # a good idea at the time."
2721  
2722 0 return join '', CORE::reverse(join('',@_) =~ /\G ($q_char) /oxmsg);
2723 }
2724 }
2725  
2726 #
2727 # Latin-8 getc (with parameter, without parameter)
2728 #
2729 20 ▶sub Latin8::getc(;*@) {
Subroutine getc: called CC=9 SCAR=26.7
2730  
2731 20 my($package) = caller;
2732 20 ▶ my $fh = @_ ? qualify_to_ref(shift,$package) : \*STDIN;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 20 0 20
2733 20 ▶ croak 'Too many arguments for Latin8::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
2734  
2735 0 my @length = sort { $a <=> $b } keys %range_tr;
2736 20 my $getc = '';
2737 20 for my $length ($length[0] .. $length[-1]) {
2738 20 $getc .= CORE::getc($fh);
2739 20 ▶ if (exists $range_tr{CORE::length($getc)}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{length $getc}) 20 0 20
2740 20 ▶ if ($getc =~ /\A ${Elatin8::dot_s} \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($getc =~ /\A $Elatin8::dot_s \z/mosx) 20 0 20
2741 20 ▶ return wantarray ? ($getc,@_) : $getc;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 20 20
2742 }
2743 }
2744 }
2745 0 ▶ return wantarray ? ($getc,@_) : $getc;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
2746 }
2747  
2748 #
2749 # Latin-8 length by character
2750 #
2751 0 ▶sub Latin8::length(;$) {
Subroutine length: not called CC=2 SCAR=17.9
2752  
2753 0 ▶ local $_ = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
2754  
2755 0 local @_ = /\G ($q_char) /oxmsg;
2756 0 return scalar @_;
2757 }
2758  
2759 #
2760 # Latin-8 substr by character
2761 #
2762 422 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=7.0
2763  
2764 # P.232 The lvalue Attribute
2765 # in Chapter 6: Subroutines
2766 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2767  
2768 # P.336 The lvalue Attribute
2769 # in Chapter 7: Subroutines
2770 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2771  
2772 # P.144 8.4 Lvalue subroutines
2773 # in Chapter 8: perlsub: Perl subroutines
2774 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
2775  
2776 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
2777 # vv----------------------*******
2778 sub Latin8::substr($$;$$) %s {
2779  
2780 my @char = $_[0] =~ /\G (?>$q_char) /oxmsg;
2781  
2782 # If the substring is beyond either end of the string, substr() returns the undefined
2783 # value and produces a warning. When used as an lvalue, specifying a substring that
2784 # is entirely outside the string raises an exception.
2785 # http://perldoc.perl.org/functions/substr.html
2786  
2787 # A return with no argument returns the scalar value undef in scalar context,
2788 # an empty list () in list context, and (naturally) nothing at all in void
2789 # context.
2790  
2791 my $offset = $_[1];
2792 if (($offset > scalar(@char)) or ($offset < (-1 * scalar(@char)))) {
2793 return;
2794 }
2795  
2796 # substr($string,$offset,$length,$replacement)
2797 if (@_ == 4) {
2798 my(undef,undef,$length,$replacement) = @_;
2799 my $substr = join '', splice(@char, $offset, $length, $replacement);
2800 $_[0] = join '', @char;
2801  
2802 # return $substr; this doesn't work, don't say "return"
2803 $substr;
2804 }
2805  
2806 # substr($string,$offset,$length)
2807 elsif (@_ == 3) {
2808 my(undef,undef,$length) = @_;
2809 my $octet_offset = 0;
2810 my $octet_length = 0;
2811 if ($offset == 0) {
2812 $octet_offset = 0;
2813 }
2814 elsif ($offset > 0) {
2815 $octet_offset = CORE::length(join '', @char[0..$offset-1]);
2816 }
2817 else {
2818 $octet_offset = -1 * CORE::length(join '', @char[$#char+$offset+1..$#char]);
2819 }
2820 if ($length == 0) {
2821 $octet_length = 0;
2822 }
2823 elsif ($length > 0) {
2824 $octet_length = CORE::length(join '', @char[$offset..$offset+$length-1]);
2825 }
2826 else {
2827 $octet_length = -1 * CORE::length(join '', @char[$#char+$length+1..$#char]);
2828 }
2829 CORE::substr($_[0], $octet_offset, $octet_length);
2830 }
2831  
2832 # substr($string,$offset)
2833 else {
2834 my $octet_offset = 0;
2835 if ($offset == 0) {
2836 $octet_offset = 0;
2837 }
2838 elsif ($offset > 0) {
2839 $octet_offset = CORE::length(join '', @char[0..$offset-1]);
2840 }
2841 else {
2842 $octet_offset = -1 * CORE::length(join '', @char[$#char+$offset+1..$#char]);
2843 }
2844 CORE::substr($_[0], $octet_offset);
2845 }
2846 }
2847 END
2848 }
2849  
2850 #
2851 # Latin-8 index by character
2852 #
2853 0 ▶sub Latin8::index($$;$) {
Subroutine index: not called CC=3 SCAR=24.8
2854  
2855 0 my $index;
2856 0 ▶ if (@_ == 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 3) { } 0 0 0
2857 0 $index = Elatin8::index($_[0], $_[1], CORE::length(Latin8::substr($_[0], 0, $_[2])));
2858 }
2859 else {
2860 0 $index = Elatin8::index($_[0], $_[1]);
2861 }
2862  
2863 0 ▶ if ($index == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($index == -1) { } 0 0 0
2864 0 return -1;
2865 }
2866 else {
2867 0 return Latin8::length(CORE::substr $_[0], 0, $index);
2868 }
2869 }
2870  
2871 #
2872 # Latin-8 rindex by character
2873 #
2874 0 ▶sub Latin8::rindex($$;$) {
Subroutine rindex: not called CC=3 SCAR=24.8
2875  
2876 0 my $rindex;
2877 0 ▶ if (@_ == 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 3) { } 0 0 0
2878 0 $rindex = Elatin8::rindex($_[0], $_[1], CORE::length(Latin8::substr($_[0], 0, $_[2])));
2879 }
2880 else {
2881 0 $rindex = Elatin8::rindex($_[0], $_[1]);
2882 }
2883  
2884 0 ▶ if ($rindex == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rindex == -1) { } 0 0 0
2885 0 return -1;
2886 }
2887 else {
2888 0 return Latin8::length(CORE::substr $_[0], 0, $rindex);
2889 }
2890 }
2891  
2892 # when 'm//', '/' means regexp match 'm//' and '?' means regexp match '??'
2893 # when 'div', '/' means division operator and '?' means conditional operator (condition ? then : else)
2894 422 ▶use vars qw($slash); $slash = 'm//';
Subroutine BEGIN: called CC=1 SCAR=0.0
2895  
2896 # ord() to ord() or Latin8::ord()
2897 422 my $function_ord = 'ord';
2898  
2899 # ord to ord or Latin8::ord_
2900 422 my $function_ord_ = 'ord';
2901  
2902 # reverse to reverse or Latin8::reverse
2903 422 my $function_reverse = 'reverse';
2904  
2905 # getc to getc or Latin8::getc
2906 422 my $function_getc = 'getc';
2907  
2908 # P.1023 Appendix W.9 Multibyte Anchoring
2909 # of ISBN 1-56592-224-7 CJKV Information Processing
2910  
2911 422 my $anchor = '';
2912  
2913 422 ▶use vars qw($nest);
Subroutine BEGIN: called CC=1 SCAR=0.0
2914  
2915 # regexp of nested parens in qqXX
2916  
2917 # P.340 Matching Nested Constructs with Embedded Code
2918 # in Chapter 7: Perl
2919 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
2920  
2921 my $qq_paren = qr{(?{local $nest=0}) (?>(?:
2922 [^\\()] |
2923 \( (?{$nest++}) |
2924 \) (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2925 \\ [^c] |
2926 \\c[\x40-\x5F] |
2927 [\x00-\xFF]
2928 422 }xms;
2929  
2930 my $qq_brace = qr{(?{local $nest=0}) (?>(?:
2931 [^\\{}] |
2932 \{ (?{$nest++}) |
2933 \} (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2934 \\ [^c] |
2935 \\c[\x40-\x5F] |
2936 [\x00-\xFF]
2937 422 }xms;
2938  
2939 my $qq_bracket = qr{(?{local $nest=0}) (?>(?:
2940 [^\\\[\]] |
2941 \[ (?{$nest++}) |
2942 \] (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2943 \\ [^c] |
2944 \\c[\x40-\x5F] |
2945 [\x00-\xFF]
2946 422 }xms;
2947  
2948 my $qq_angle = qr{(?{local $nest=0}) (?>(?:
2949 [^\\<>] |
2950 \< (?{$nest++}) |
2951 \> (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2952 \\ [^c] |
2953 \\c[\x40-\x5F] |
2954 [\x00-\xFF]
2955 422 }xms;
2956  
2957 422 my $qq_scalar = qr{(?: \{ (?:$qq_brace)*? \} |
2958 (?: ::)? (?:
2959 (?> [a-zA-Z_][a-zA-Z_0-9]* (?: ::[a-zA-Z_][a-zA-Z_0-9]*)* )
2960 (?>(?: \[ (?: \$\[ | \$\] | $qq_char )*? \] | \{ (?:$qq_brace)*? \} )*)
2961 (?>(?: (?: -> )? (?: [\$\@\%\&\*]\* | \$\#\* | [\@\%]? \[ (?: \$\[ | \$\] | $qq_char )*? \] | [\@\%\*]? \{ (?:$qq_brace)*? \} ) )*)
2962 ))
2963 }xms;
2964  
2965 422 my $qq_variable = qr{(?: \{ (?:$qq_brace)*? \} |
2966 (?: ::)? (?:
2967 (?>[0-9]+) |
2968 [^a-zA-Z_0-9\[\]] |
2969 ^[A-Z] |
2970 (?> [a-zA-Z_][a-zA-Z_0-9]* (?: ::[a-zA-Z_][a-zA-Z_0-9]*)* )
2971 (?>(?: \[ (?: \$\[ | \$\] | $qq_char )*? \] | \{ (?:$qq_brace)*? \} )*)
2972 (?>(?: (?: -> )? (?: [\$\@\%\&\*]\* | \$\#\* | [\@\%]? \[ (?: \$\[ | \$\] | $qq_char )*? \] | [\@\%\*]? \{ (?:$qq_brace)*? \} ) )*)
2973 ))
2974 }xms;
2975  
2976 422 my $qq_substr = qr{(?> Char::substr | Latin8::substr | CORE::substr | substr ) (?>\s*) \( $qq_paren \)
2977 }xms;
2978  
2979 # regexp of nested parens in qXX
2980 my $q_paren = qr{(?{local $nest=0}) (?>(?:
2981 [^()] |
2982 \( (?{$nest++}) |
2983 \) (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2984 [\x00-\xFF]
2985 422 }xms;
2986  
2987 my $q_brace = qr{(?{local $nest=0}) (?>(?:
2988 [^\{\}] |
2989 \{ (?{$nest++}) |
2990 \} (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2991 [\x00-\xFF]
2992 422 }xms;
2993  
2994 my $q_bracket = qr{(?{local $nest=0}) (?>(?:
2995 [^\[\]] |
2996 \[ (?{$nest++}) |
2997 \] (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2998 [\x00-\xFF]
2999 422 }xms;
3000  
3001 my $q_angle = qr{(?{local $nest=0}) (?>(?:
3002 [^<>] |
3003 \< (?{$nest++}) |
3004 \> (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
3005 [\x00-\xFF]
3006 422 }xms;
3007  
3008 422 my $matched = '';
3009 422 my $s_matched = '';
3010  
3011 422 my $tr_variable = ''; # variable of tr///
3012 422 my $sub_variable = ''; # variable of s///
3013 422 my $bind_operator = ''; # =~ or !~
3014  
3015 422 my @heredoc = (); # here document
3016 422 my @heredoc_delimiter = ();
3017 422 my $here_script = ''; # here script
3018  
3019 #
3020 # escape Latin-8 script
3021 #
3022 547 ▶sub Latin8::escape(;$) {
Subroutine escape: called CC=3 SCAR=11.0
3023 547 ▶ local($_) = $_[0] if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 292 255 547
3024  
3025 # P.359 The Study Function
3026 # in Chapter 7: Perl
3027 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3028  
3029 547 study $_; # Yes, I studied study yesterday.
3030  
3031 # while all script
3032  
3033 # 6.14. Matching from Where the Last Pattern Left Off
3034 # in Chapter 6. Pattern Matching
3035 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
3036 # (and so on)
3037  
3038 # one member of Tag-team
3039 #
3040 # P.128 Start of match (or end of previous match): \G
3041 # P.130 Advanced Use of \G with Perl
3042 # in Chapter 3: Overview of Regular Expression Features and Flavors
3043 # P.255 Use leading anchors
3044 # P.256 Expose ^ and \G at the front expressions
3045 # in Chapter 6: Crafting an Efficient Expression
3046 # P.315 "Tag-team" matching with /gc
3047 # in Chapter 7: Perl
3048 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3049  
3050 547 my $e_script = '';
3051 547 ▶ while (not /\G \z/oxgc) { # member
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 86670 547 87217
3052 86670 $e_script .= Latin8::escape_token();
3053 }
3054  
3055 547 return $e_script;
3056 }
3057  
3058 #
3059 # escape Latin-8 token of script
3060 #
3061 86670 ▶sub Latin8::escape_token {
Subroutine escape_token: called CC=504 SCAR=109.3
3062  
3063 # \n output here document
3064  
3065 86670 my $ignore_modules = join('|', qw(
3066 utf8
3067 bytes
3068 charnames
3069 I18N::Japanese
3070 I18N::Collate
3071 I18N::JExt
3072 File::DosGlob
3073 Wild
3074 Wildcard
3075 Japanese
3076 ));
3077  
3078 # another member of Tag-team
3079 #
3080 # P.315 "Tag-team" matching with /gc
3081 # in Chapter 7: Perl
3082 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3083  
3084 86670 ▶ if (/\G ( \n ) /oxgc) { # another member (and so on)
Branch: 139 branches
BranchTrueFalseTotal
if (/\G ( \n ) /cgox) { } 12833 73837 86670
elsif (/\G ((?>\s+)|\#.*) /cgox) { } 21433 52404 73837
elsif (/\G ( (?: if | elsif | unless | while | until | given | when ) (?>\s*) \( ) /cgox) { } 1644 50760 52404
elsif (/\G ( \( (?>\s*) (?: local \b | my \b | our \b | state \b )? (?>\s*) \$ $qq_scalar ) /cgox) { } 90 50670 50760
elsif (/\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /cgmosx) { } 4 50666 50670
elsif (/\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /cgmosx) { } 28 50638 50666
elsif (/\G ( \$' | \$\{'\} ) /cgmosx) { } 1 50637 50638
elsif (/\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /cgmosx) { } 3 50634 50637
elsif (/\G ( \$ $qq_scalar | $qq_substr ) /cgox) { } 1752 48882 50634
elsif (/\G ( [,;] ) /cgox) { } 5092 43790 48882
elsif (/\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /cgmosx) { } 0 43790 43790
elsif (/\G ( \$ 0 ) /cgmosx) { } 2 43788 43790
elsif (/\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /cgmosx) { } 0 43788 43788
elsif (/\G ( \$ \$ ) (?![\w\{]) /cgmosx) { } 1 43787 43788
elsif (/\G \$ ((?>[1-9][0-9]*)) /cgmosx) { } 4 43783 43787
elsif (/\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /cgmosx) { } 0 43783 43783
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /cgmosx) { } 0 43783 43783
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /cgmosx) { } 0 43783 43783
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /cgmosx) { } 0 43783 43783
elsif (/\G \$ (?>\s*) \{ ( (?>\s*) (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* ) (?>\s*) ) \} /cgmosx) { } 0 43783 43783
elsif (/\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /cgmosx) { } 0 43783 43783
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 43741 43783
elsif (m{\G ( \$[\$\@\#\\\'\"/\?\(\)\[\]\<\>] ) }cgmosx) { } 63 43678 43741
elsif (/\G \b (while (?>\s*) \( (?>\s*) <[\$]?[A-Za-z_][A-Za-z_0-9]*> (?>\s*) \)) \b /cgox) { } 0 43678 43678
elsif (/\G \b while (?>\s*) \( (?>\s*) < ((?:[^>\0\a\e\f\n\r\t])+?) > (?>\s*) \) \b /cgox) { } 0 43678 43678
elsif (/\G \b while (?>\s*) \( (?>\s*) glob (?>\s*) \) /cgox) { } 0 43678 43678
elsif (/\G \b while (?>\s*) \( (?>\s*) glob \b /cgox) { } 0 43678 43678
elsif (/\G \b ( if | unless | while | until | for | when ) \b /cgox) { } 251 43427 43678
elsif (/\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /cgox) { } 19 43408 43427
elsif (/\G \b Char::eval (?= (?>\s*) \{ ) /cgox) { } 0 43408 43408
elsif (/\G \b Latin8::eval (?= (?>\s*) \{ ) /cgox) { } 22 43386 43408
elsif (/\G \b Char::eval \b (?! (?>\s*) => ) /cgox) { } 0 43386 43386
elsif (/\G \b Latin8::eval \b (?! (?>\s*) => ) /cgox) { } 168 43218 43386
elsif (/\G \b bytes::substr \b (?! (?>\s*) => ) /cgox) { } 2 43216 43218
elsif (/\G \b chop \b (?! (?>\s*) => ) /cgox) { } 0 43216 43216
elsif (/\G \b bytes::index \b (?! (?>\s*) => ) /cgox) { } 2 43214 43216
elsif (/\G \b Char::index \b (?! (?>\s*) => ) /cgox) { } 0 43214 43214
elsif (/\G \b Latin8::index \b (?! (?>\s*) => ) /cgox) { } 0 43214 43214
elsif (/\G \b index \b (?! (?>\s*) => ) /cgox) { } 0 43214 43214
elsif (/\G \b bytes::rindex \b (?! (?>\s*) => ) /cgox) { } 2 43212 43214
elsif (/\G \b Char::rindex \b (?! (?>\s*) => ) /cgox) { } 0 43212 43212
elsif (/\G \b Latin8::rindex \b (?! (?>\s*) => ) /cgox) { } 0 43212 43212
elsif (/\G \b rindex \b (?! (?>\s*) => ) /cgox) { } 0 43212 43212
elsif (/\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 1 43211 43212
elsif (/\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43211 43211
elsif (/\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 1 43210 43211
elsif (/\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43210 43210
elsif (/\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 6 43204 43210
elsif (/\G -s (?>\s*) (\") ((?:$Elatin8::qq_char)+?) (\") /cgox) { } 0 43204 43204
elsif (/\G -s (?>\s+) qq (?>\s*) (\#) ((?:$Elatin8::qq_char)+?) (\#) /cgox) { } 0 43204 43204
elsif (/\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /cgox) { } 0 43204 43204
elsif (/\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /cgox) { } 0 43204 43204
elsif (/\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /cgox) { } 0 43204 43204
elsif (/\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /cgox) { } 0 43204 43204
elsif (/\G -s (?>\s+) qq (?>\s*) (\S) ((?:$Elatin8::qq_char)+?) (\1) /cgox) { } 0 43204 43204
elsif (/\G -s (?>\s*) (\') ((?:\\\'|\\\\|$Elatin8::q_char)+?) (\') /cgox) { } 0 43204 43204
elsif (/\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$Elatin8::q_char)+?) (\#) /cgox) { } 0 43204 43204
elsif (/\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /cgox) { } 0 43204 43204
elsif (/\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /cgox) { } 0 43204 43204
elsif (/\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /cgox) { } 0 43204 43204
elsif (/\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /cgox) { } 0 43204 43204
elsif (/\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$Elatin8::q_char)+?) (\1) /cgox) { } 0 43204 43204
elsif (/\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)* ) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ) )*) /cgox) { } 0 43204 43204
elsif (/\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /cgox) { } 0 43204 43204
elsif (/\G -s (?= (?>\s+) [a-z]+) /cgox) { } 0 43204 43204
elsif (/\G -s (?>\s+) ((?>\w+)) /cgox) { } 0 43204 43204
elsif (/\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43202 43204
elsif (/\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43200 43202
elsif (/\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 36 43164 43200
elsif (/\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43162 43164
elsif (/\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 8 43154 43162
elsif (/\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43154 43154
elsif (/\G \b lc \b (?! (?>\s*) => ) /cgox) { } 0 43154 43154
elsif (/\G \b lcfirst \b (?! (?>\s*) => ) /cgox) { } 0 43154 43154
elsif (/\G \b uc \b (?! (?>\s*) => ) /cgox) { } 0 43154 43154
elsif (/\G \b ucfirst \b (?! (?>\s*) => ) /cgox) { } 0 43154 43154
elsif (/\G \b fc \b (?! (?>\s*) => ) /cgox) { } 0 43154 43154
elsif (/\G -s \b (?! (?>\s*) => ) /cgox) { } 0 43154 43154
elsif (/\G \b bytes::length \b (?! (?>\s*) => ) /cgox) { } 0 43154 43154
elsif (/\G \b bytes::chr \b (?! (?>\s*) => ) /cgox) { } 0 43154 43154
elsif (/\G \b chr \b (?! (?>\s*) => ) /cgox) { } 0 43154 43154
elsif (/\G \b bytes::ord \b (?! (?>\s*) => ) /cgox) { } 0 43154 43154
elsif (/\G \b ord \b (?! (?>\s*) => ) /cgox) { } 0 43154 43154
elsif (/\G \b glob \b (?! (?>\s*) => ) /cgox) { } 0 43154 43154
elsif (/\G \b reverse \b (?! (?>\s*) => ) /cgox) { } 0 43154 43154
elsif (/\G \b getc \b (?! (?>\s*) => ) /cgox) { } 8 43146 43154
elsif (/\G \b (split) \b (?! (?>\s*) => ) /cgox) { } 87 43059 43146
elsif (/\G \b ( tr | y ) \b /cgox) { } 4 43055 43059
elsif (/\G \b (qq) \b /cgox) { } 2252 40803 43055
elsif (/\G \b (qr) \b /cgox) { } 0 40803 40803
elsif (/\G \b (qw) \b /cgox) { } 16 40787 40803
elsif (/\G \b (qx) \b /cgox) { } 0 40787 40787
elsif (/\G \b (q) \b /cgox) { } 473 40314 40787
elsif (/\G \b (m) \b /cgox) { } 209 40105 40314
elsif (/\G \b (s) \b /cgox) { } 101 40004 40105
elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 0 40004 40004
elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 40004 40004
elsif (/\G \b require ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 40004 40004
elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [#\n]) /cgmosx) { } 37 39967 40004
elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 39967 39967
elsif (/\G \b use ((?>\s+) strict) \b /cgmosx) { } 0 39967 39967
elsif (/\G \b use (?>\s+) ((?>([1-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /cgmosx) { } 2 39965 39967
elsif (/\G \b use (?>\s+) ((?>v([0-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /cgmosx) { } 0 39965 39965
elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 2 39963 39965
elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 39963 39963
elsif (/\G \b use ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 39963 39963
elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 0 39963 39963
elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 39963 39963
elsif (/\G \b no ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 39963 39963
elsif (/\G \b use \b /cgmosx) { } 0 39963 39963
elsif (/\G \b no \b /cgmosx) { } 2 39961 39963
elsif (/\G (?<![\w\$\@\%\&\*]) (\') /cgox) { } 1142 38819 39961
elsif (/\G (\") /cgox) { } 1941 36878 38819
elsif (/\G (\`) /cgox) { } 1 36877 36878
elsif ($Elatin8::slash eq 'm//' and m[\G (/) ]cgox) { } 681 36196 36877
elsif ($Elatin8::slash eq 'm//' and /\G (\?) /cgox) { } 0 36196 36196
elsif (/\G ( <<>> ) /cgox) { } 0 36196 36196
elsif (/\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /cgox) { } 0 36196 36196
elsif (/\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /cgox) { } 6 36190 36196
elsif (/\G ( <<~ \\([a-zA-Z_0-9]+) ) /cgox) { } 3 36187 36190
elsif (/\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /cgox) { } 6 36181 36187
elsif (/\G ( <<~ ([a-zA-Z_0-9]+) ) /cgox) { } 3 36178 36181
elsif (/\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /cgox) { } 6 36172 36178
elsif (/\G ( << '([a-zA-Z_0-9]*)' ) /cgox) { } 72 36100 36172
elsif (/\G ( << \\([a-zA-Z_0-9]+) ) /cgox) { } 0 36100 36100
elsif (/\G ( << "([a-zA-Z_0-9]*)" ) /cgox) { } 36 36064 36100
elsif (/\G ( << ([a-zA-Z_0-9]+) ) /cgox) { } 42 36022 36064
elsif (/\G ( << `([a-zA-Z_0-9]*)` ) /cgox) { } 0 36022 36022
elsif (/\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/cgox) { } 12 36010 36022
elsif (/\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /cgox) { } 0 36010 36010
elsif (/\G < ((?:[^>\0\a\e\f\n\r\t])+?) > /cgox) { } 0 36010 36010
elsif (/\G ^ ( __DATA__ \n .*) \z /cgmosx) { } 0 36010 36010
elsif (/\G ^ ( __END__ \n .*) \z /cgmosx) { } 210 35800 36010
elsif (/\G ( \cD .*) \z /cgmosx) { } 0 35800 35800
elsif (/\G ( \cZ .*) \z /cgmosx) { } 0 35800 35800
elsif (/\G ( -- | \+\+ | [\)\}\]] ) /cgox) { } 5837 29963 35800
elsif (/\G ( \.\.\. ) /cgox) { } 7 29956 29963
elsif (m"\G ((?> !~~ | !~ | != | ! | %= | % | &&= | && | &= | &\.= | &\. | & | -= | -> | - | :(?>\s*)= | : | <<>> | <<= | <=> | <= | < | == | => | =~ | = | >>= | >> | >= | > | \*\*= | \*\* | \*= | \* | \+= | \+ | \.\. | \.= | \. | //= | // | /= | / | \? | \\ | \^= | \^\.= | \^\. | \^ | \b x= | \|\|= | \|\| | \|= | \|\.= | \|\. | \| | ~~ | ~\. | ~ | \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b | \b(?: print )\b | [,;\(\{\[] )) "cgox) { } 9800 20156 29956
elsif (/\G ($Elatin8::q_char) /cgox) { } 20156 0 20156
3085 12833 my $heredoc = '';
3086 12833 ▶ if (scalar(@heredoc_delimiter) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @heredoc_delimiter >= 1) 174 12659 12833
3087 174 $slash = 'm//';
3088  
3089 174 $heredoc = join '', @heredoc;
3090 174 @heredoc = ();
3091  
3092 # skip here document
3093 174 for my $heredoc_delimiter (@heredoc_delimiter) {
3094 174 /\G .*? \n $heredoc_delimiter \n/xmsgc;
3095 }
3096 174 @heredoc_delimiter = ();
3097  
3098 174 $here_script = '';
3099 }
3100 12833 return "\n" . $heredoc;
3101 }
3102  
3103 # ignore space, comment
3104 21433 elsif (/\G ((?>\s+)|\#.*) /oxgc) { return $1; }
3105  
3106 # if (, elsif (, unless (, while (, until (, given (, and when (
3107  
3108 # given, when
3109  
3110 # P.225 The given Statement
3111 # in Chapter 15: Smart Matching and given-when
3112 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
3113  
3114 # P.133 The given Statement
3115 # in Chapter 4: Statements and Declarations
3116 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
3117  
3118 elsif (/\G ( (?: if | elsif | unless | while | until | given | when ) (?>\s*) \( ) /oxgc) {
3119 1644 $slash = 'm//';
3120 1644 return $1;
3121 }
3122  
3123 # scalar variable ($scalar = ...) =~ tr///;
3124 # scalar variable ($scalar = ...) =~ s///;
3125  
3126 # state
3127  
3128 # P.68 Persistent, Private Variables
3129 # in Chapter 4: Subroutines
3130 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
3131  
3132 # P.160 Persistent Lexically Scoped Variables: state
3133 # in Chapter 4: Statements and Declarations
3134 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
3135  
3136 # (and so on)
3137  
3138 elsif (/\G ( \( (?>\s*) (?: local \b | my \b | our \b | state \b )? (?>\s*) \$ $qq_scalar ) /oxgc) {
3139 90 my $e_string = e_string($1);
3140  
3141 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
3142 0 $tr_variable = $e_string . e_string($1);
3143 0 $bind_operator = $2;
3144 0 $slash = 'm//';
3145 0 return '';
3146 }
3147 elsif (/\G ( (?>\s*) = $qq_paren \) ) ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /oxgc) {
3148 0 $sub_variable = $e_string . e_string($1);
3149 0 $bind_operator = $2;
3150 0 $slash = 'm//';
3151 0 return '';
3152 }
3153 else {
3154 90 $slash = 'div';
3155 90 return $e_string;
3156 }
3157 }
3158  
3159 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin8::PREMATCH()
3160 elsif (/\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /oxmsgc) {
3161 4 $slash = 'div';
3162 4 return q{Elatin8::PREMATCH()};
3163 }
3164  
3165 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin8::MATCH()
3166 elsif (/\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /oxmsgc) {
3167 28 $slash = 'div';
3168 28 return q{Elatin8::MATCH()};
3169 }
3170  
3171 # $', ${'} --> $', ${'}
3172 elsif (/\G ( \$' | \$\{'\} ) /oxmsgc) {
3173 1 $slash = 'div';
3174 1 return $1;
3175 }
3176  
3177 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin8::POSTMATCH()
3178 elsif (/\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /oxmsgc) {
3179 3 $slash = 'div';
3180 3 return q{Elatin8::POSTMATCH()};
3181 }
3182  
3183 # scalar variable $scalar =~ tr///;
3184 # scalar variable $scalar =~ s///;
3185 # substr() =~ tr///;
3186 # substr() =~ s///;
3187 elsif (/\G ( \$ $qq_scalar | $qq_substr ) /oxgc) {
3188 1752 my $scalar = e_string($1);
3189  
3190 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
3191 2 $tr_variable = $scalar;
3192 2 $bind_operator = $1;
3193 2 $slash = 'm//';
3194 2 return '';
3195 }
3196 elsif (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /oxgc) {
3197 65 $sub_variable = $scalar;
3198 65 $bind_operator = $1;
3199 65 $slash = 'm//';
3200 65 return '';
3201 }
3202 else {
3203 1685 $slash = 'div';
3204 1685 return $scalar;
3205 }
3206 }
3207  
3208 # end of statement
3209 elsif (/\G ( [,;] ) /oxgc) {
3210 5092 $slash = 'm//';
3211  
3212 # clear tr/// variable
3213 5092 $tr_variable = '';
3214  
3215 # clear s/// variable
3216 5092 $sub_variable = '';
3217  
3218 5092 $bind_operator = '';
3219  
3220 5092 return $1;
3221 }
3222  
3223 # bareword
3224 elsif (/\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /oxmsgc) {
3225 0 return $1;
3226 }
3227  
3228 # $0 --> $0
3229 elsif (/\G ( \$ 0 ) /oxmsgc) {
3230 2 $slash = 'div';
3231 2 return $1;
3232 }
3233 elsif (/\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /oxmsgc) {
3234 0 $slash = 'div';
3235 0 return $1;
3236 }
3237  
3238 # $$ --> $$
3239 elsif (/\G ( \$ \$ ) (?![\w\{]) /oxmsgc) {
3240 1 $slash = 'div';
3241 1 return $1;
3242 }
3243  
3244 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
3245 # $1, $2, $3 --> $1, $2, $3 otherwise
3246 elsif (/\G \$ ((?>[1-9][0-9]*)) /oxmsgc) {
3247 4 $slash = 'div';
3248 4 return e_capture($1);
3249 }
3250 elsif (/\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /oxmsgc) {
3251 0 $slash = 'div';
3252 0 return e_capture($1);
3253 }
3254  
3255 # $$foo[ ... ] --> $ $foo->[ ... ]
3256 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /oxmsgc) {
3257 0 $slash = 'div';
3258 0 return e_capture($1.'->'.$2);
3259 }
3260  
3261 # $$foo{ ... } --> $ $foo->{ ... }
3262 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /oxmsgc) {
3263 0 $slash = 'div';
3264 0 return e_capture($1.'->'.$2);
3265 }
3266  
3267 # $$foo
3268 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /oxmsgc) {
3269 0 $slash = 'div';
3270 0 return e_capture($1);
3271 }
3272  
3273 # ${ foo }
3274 elsif (/\G \$ (?>\s*) \{ ( (?>\s*) (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* ) (?>\s*) ) \} /oxmsgc) {
3275 0 $slash = 'div';
3276 0 return '${' . $1 . '}';
3277 }
3278  
3279 # ${ ... }
3280 elsif (/\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /oxmsgc) {
3281 0 $slash = 'div';
3282 0 return e_capture($1);
3283 }
3284  
3285 # variable or function
3286 # $ @ % & * $ #
3287 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) {
3288 42 $slash = 'div';
3289 42 return $1;
3290 }
3291 # $ $ $ $ $ $ $ $ $ $ $ $ $ $
3292 # $ @ # \ ' " / ? ( ) [ ] < >
3293 elsif (/\G ( \$[\$\@\#\\\'\"\/\?\(\)\[\]\<\>] ) /oxmsgc) {
3294 63 $slash = 'div';
3295 63 return $1;
3296 }
3297  
3298 # while (<FILEHANDLE>)
3299 elsif (/\G \b (while (?>\s*) \( (?>\s*) <[\$]?[A-Za-z_][A-Za-z_0-9]*> (?>\s*) \)) \b /oxgc) {
3300 0 return $1;
3301 }
3302  
3303 # while (<WILDCARD>) --- glob
3304  
3305 # avoid "Error: Runtime exception" of perl version 5.005_03
3306  
3307 elsif (/\G \b while (?>\s*) \( (?>\s*) < ((?:[^>\0\a\e\f\n\r\t])+?) > (?>\s*) \) \b /oxgc) {
3308 0 return 'while ($_ = Elatin8::glob("' . $1 . '"))';
3309 }
3310  
3311 # while (glob)
3312 elsif (/\G \b while (?>\s*) \( (?>\s*) glob (?>\s*) \) /oxgc) {
3313 0 return 'while ($_ = Elatin8::glob_)';
3314 }
3315  
3316 # while (glob(WILDCARD))
3317 elsif (/\G \b while (?>\s*) \( (?>\s*) glob \b /oxgc) {
3318 0 return 'while ($_ = Elatin8::glob';
3319 }
3320  
3321 # doit if, doit unless, doit while, doit until, doit for, doit when
3322 251 elsif (/\G \b ( if | unless | while | until | for | when ) \b /oxgc) { $slash = 'm//'; return $1; }
3323  
3324 # subroutines of package Elatin8
3325 19 elsif (/\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /oxgc) { $slash = 'm//'; return $1; }
3326 0 elsif (/\G \b Char::eval (?= (?>\s*) \{ ) /oxgc) { $slash = 'm//'; return 'eval'; }
3327 22 elsif (/\G \b Latin8::eval (?= (?>\s*) \{ ) /oxgc) { $slash = 'm//'; return 'eval'; }
3328 0 elsif (/\G \b Char::eval \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'eval Char::escape'; }
3329 168 elsif (/\G \b Latin8::eval \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'eval Latin8::escape'; }
3330 2 elsif (/\G \b bytes::substr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'substr'; }
3331 0 elsif (/\G \b chop \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin8::chop'; }
3332 2 elsif (/\G \b bytes::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'index'; }
3333 0 elsif (/\G \b Char::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Char::index'; }
3334 0 elsif (/\G \b Latin8::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Latin8::index'; }
3335 0 elsif (/\G \b index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin8::index'; }
3336 2 elsif (/\G \b bytes::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'rindex'; }
3337 0 elsif (/\G \b Char::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Char::rindex'; }
3338 0 elsif (/\G \b Latin8::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Latin8::rindex'; }
3339 0 elsif (/\G \b rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin8::rindex'; }
3340 1 elsif (/\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin8::lc'; }
3341 0 elsif (/\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin8::lcfirst'; }
3342 1 elsif (/\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin8::uc'; }
3343 0 elsif (/\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin8::ucfirst'; }
3344 6 elsif (/\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin8::fc'; }
3345  
3346 # "-s '' ..." means file test "-s 'filename' ..." (not means "- s/// ...")
3347 0 elsif (/\G -s (?>\s*) (\") ((?:$qq_char)+?) (\") /oxgc) { $slash = 'm//'; return '-s ' . e_qq('', $1,$3,$2); }
3348 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\#) ((?:$qq_char)+?) (\#) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3349 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3350 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3351 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3352 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3353 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\S) ((?:$qq_char)+?) (\1) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3354  
3355 0 elsif (/\G -s (?>\s*) (\') ((?:\\\'|\\\\|$q_char)+?) (\') /oxgc) { $slash = 'm//'; return '-s ' . e_q ('', $1,$3,$2); }
3356 0 elsif (/\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$q_char)+?) (\#) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3357 0 elsif (/\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3358 0 elsif (/\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3359 0 elsif (/\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3360 0 elsif (/\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3361 0 elsif (/\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$q_char)+?) (\1) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3362  
3363 elsif (/\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)* ) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ) )*) /oxgc)
3364 0 { $slash = 'm//'; return "-s $1"; }
3365 0 elsif (/\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /oxgc) { $slash = 'm//'; return "-s ($1)"; }
3366 0 elsif (/\G -s (?= (?>\s+) [a-z]+) /oxgc) { $slash = 'm//'; return '-s'; }
3367 0 elsif (/\G -s (?>\s+) ((?>\w+)) /oxgc) { $slash = 'm//'; return "-s $1"; }
3368  
3369 2 elsif (/\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'length'; }
3370 2 elsif (/\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'chr'; }
3371 36 elsif (/\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin8::chr'; }
3372 2 elsif (/\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'div'; return 'ord'; }
3373 8 elsif (/\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'div'; return $function_ord; }
3374 0 elsif (/\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin8::glob'; }
3375 0 elsif (/\G \b lc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin8::lc_'; }
3376 0 elsif (/\G \b lcfirst \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin8::lcfirst_'; }
3377 0 elsif (/\G \b uc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin8::uc_'; }
3378 0 elsif (/\G \b ucfirst \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin8::ucfirst_'; }
3379 0 elsif (/\G \b fc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin8::fc_'; }
3380 0 elsif (/\G -s \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return '-s '; }
3381  
3382 0 elsif (/\G \b bytes::length \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'length'; }
3383 0 elsif (/\G \b bytes::chr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'chr'; }
3384 0 elsif (/\G \b chr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin8::chr_'; }
3385 0 elsif (/\G \b bytes::ord \b (?! (?>\s*) => ) /oxgc) { $slash = 'div'; return 'ord'; }
3386 0 elsif (/\G \b ord \b (?! (?>\s*) => ) /oxgc) { $slash = 'div'; return $function_ord_; }
3387 0 elsif (/\G \b glob \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin8::glob_'; }
3388 0 elsif (/\G \b reverse \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return $function_reverse; }
3389 8 elsif (/\G \b getc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return $function_getc; }
3390 # split
3391 elsif (/\G \b (split) \b (?! (?>\s*) => ) /oxgc) {
3392 87 $slash = 'm//';
3393  
3394 87 my $e = '';
3395 87 ▶ while (/\G ( (?>\s+) | \( | \#.* ) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\G ( (?>\s+) | \( | \#.* ) /cgox) 85 87 172
3396 85 $e .= $1;
3397 }
3398  
3399 # end of split
3400 87 ▶ if (/\G (?= [,;\)\}\]] ) /oxgc) { return 'Elatin8::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
3401  
3402 # split scalar value
3403 1 elsif (/\G ( [\$\@\&\*] $qq_scalar ) /oxgc) { return 'Elatin8::split' . $e . e_string($1); }
3404  
3405 # split literal space
3406 0 elsif (/\G \b qq (\#) [ ] (\#) /oxgc) { return 'Elatin8::split' . $e . qq {qq$1 $2}; }
3407 0 elsif (/\G \b qq ((?>\s*)) (\() [ ] (\)) /oxgc) { return 'Elatin8::split' . $e . qq{$1qq$2 $3}; }
3408 0 elsif (/\G \b qq ((?>\s*)) (\{) [ ] (\}) /oxgc) { return 'Elatin8::split' . $e . qq{$1qq$2 $3}; }
3409 0 elsif (/\G \b qq ((?>\s*)) (\[) [ ] (\]) /oxgc) { return 'Elatin8::split' . $e . qq{$1qq$2 $3}; }
3410 0 elsif (/\G \b qq ((?>\s*)) (\<) [ ] (\>) /oxgc) { return 'Elatin8::split' . $e . qq{$1qq$2 $3}; }
3411 0 elsif (/\G \b qq ((?>\s*)) (\S) [ ] (\2) /oxgc) { return 'Elatin8::split' . $e . qq{$1qq$2 $3}; }
3412 0 elsif (/\G \b q (\#) [ ] (\#) /oxgc) { return 'Elatin8::split' . $e . qq {q$1 $2}; }
3413 0 elsif (/\G \b q ((?>\s*)) (\() [ ] (\)) /oxgc) { return 'Elatin8::split' . $e . qq {$1q$2 $3}; }
3414 0 elsif (/\G \b q ((?>\s*)) (\{) [ ] (\}) /oxgc) { return 'Elatin8::split' . $e . qq {$1q$2 $3}; }
3415 0 elsif (/\G \b q ((?>\s*)) (\[) [ ] (\]) /oxgc) { return 'Elatin8::split' . $e . qq {$1q$2 $3}; }
3416 0 elsif (/\G \b q ((?>\s*)) (\<) [ ] (\>) /oxgc) { return 'Elatin8::split' . $e . qq {$1q$2 $3}; }
3417 0 elsif (/\G \b q ((?>\s*)) (\S) [ ] (\2) /oxgc) { return 'Elatin8::split' . $e . qq {$1q$2 $3}; }
3418 10 elsif (/\G ' [ ] ' /oxgc) { return 'Elatin8::split' . $e . qq {' '}; }
3419 0 elsif (/\G " [ ] " /oxgc) { return 'Elatin8::split' . $e . qq {" "}; }
3420  
3421 # split qq//
3422 elsif (/\G \b (qq) \b /oxgc) {
3423 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin8::qq_char)*?) (\#) /cgox) { } 0 0 0
3424 else {
3425 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3426 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 ([*\-:?\\^|]) ((?:$Elatin8::qq_char)*?) (\1) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin8::qq_char)*?) (\1) /cgox) { } 0 0 0
3427 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq ( ) --> qr ( )
3428 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq { } --> qr { }
3429 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq [ ] --> qr [ ]
3430 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq < > --> qr < >
3431 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) /oxgc) { return e_split($e.'qr','{','}',$2,''); } # qq | | --> qr { }
3432 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq * * --> qr * *
3433 }
3434 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3435 }
3436 }
3437  
3438 # split qr//
3439 elsif (/\G \b (qr) \b /oxgc) {
3440 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1,$3,$2,$4); } # qr# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin8::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 12 12
3441 else {
3442 12 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 12 0 12
3443 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 (\') ((?:$Elatin8::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 12 12
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin8::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 12 12
elsif (/\G (\S) ((?:$Elatin8::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 12 0 12
3444 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr ( )
3445 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr { }
3446 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr [ ]
3447 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr < >
3448 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { return e_split_q($e.'qr',$1, $3, $2,$4); } # qr ' '
3449 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr','{','}',$2,$4); } # qr | | --> qr { }
3450 12 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr * *
3451 }
3452 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3453 }
3454 }
3455  
3456 # split q//
3457 elsif (/\G \b (q) \b /oxgc) {
3458 0 ▶ if (/\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:\\\#|\\\\|$Elatin8::q_char)*?) (\#) /cgox) { } 0 0 0
3459 else {
3460 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3461 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 ([*\-:?\\^|]) ((?:$Elatin8::q_char)*?) (\1) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:\\\\|\\\1| $Elatin8::q_char)*?) (\1) /cgox) { } 0 0 0
3462 0 elsif (/\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q ( ) --> qr ( )
3463 0 elsif (/\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q { } --> qr { }
3464 0 elsif (/\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q [ ] --> qr [ ]
3465 0 elsif (/\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q < > --> qr < >
3466 0 elsif (/\G ([*\-:?\\^|]) ((?:$q_char)*?) (\1) /oxgc) { return e_split_q($e.'qr','{','}',$2,''); } # q | | --> qr { }
3467 0 elsif (/\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q * * --> qr * *
3468 }
3469 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3470 }
3471 }
3472  
3473 # split m//
3474 elsif (/\G \b (m) \b /oxgc) {
3475 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1,$3,$2,$4); } # m# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin8::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
3476 else {
3477 18 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 18 0 18
3478 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 (\') ((?:$Elatin8::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin8::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
elsif (/\G (\S) ((?:$Elatin8::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 18 0 18
3479 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m ( ) --> qr ( )
3480 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m { } --> qr { }
3481 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m [ ] --> qr [ ]
3482 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m < > --> qr < >
3483 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { return e_split_q($e.'qr',$1, $3, $2,$4); } # m ' ' --> qr ' '
3484 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr','{','}',$2,$4); } # m | | --> qr { }
3485 18 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m * * --> qr * *
3486 }
3487 0 die __FILE__, ": Search pattern not terminated\n";
3488 }
3489 }
3490  
3491 # split ''
3492 elsif (/\G (\') /oxgc) {
3493 0 my $q_string = '';
3494 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3495 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 ($Elatin8::q_char) /cgox) { } 0 0 0
3496 0 elsif (/\G (\\\') /oxgc) { $q_string .= $1; } # splitqr'' --> split qr''
3497 0 elsif (/\G \' /oxgc) { return e_split_q($e.q{ qr},"'","'",$q_string,''); } # ' ' --> qr ' '
3498 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3499 }
3500 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3501 }
3502  
3503 # split ""
3504 elsif (/\G (\") /oxgc) {
3505 0 my $qq_string = '';
3506 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3507 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 ($Elatin8::q_char) /cgox) { } 0 0 0
3508 0 elsif (/\G (\\\") /oxgc) { $qq_string .= $1; } # splitqr"" --> split qr""
3509 0 elsif (/\G \" /oxgc) { return e_split($e.q{ qr},'"','"',$qq_string,''); } # " " --> qr " "
3510 0 elsif (/\G ($q_char) /oxgc) { $qq_string .= $1; }
3511 }
3512 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3513 }
3514  
3515 # split //
3516 elsif (/\G (\/) /oxgc) {
3517 44 my $regexp = '';
3518 44 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 381 0 381
3519 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 ($Elatin8::q_char) /cgox) { } 337 0 337
3520 0 elsif (/\G (\\\/) /oxgc) { $regexp .= $1; } # splitqr// --> split qr//
3521 44 elsif (/\G \/ ([cgimosxpadlunbB]*) /oxgc) { return e_split($e.q{ qr}, '/','/',$regexp,$1); } # / / --> qr / /
3522 337 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
3523 }
3524 0 die __FILE__, ": Search pattern not terminated\n";
3525 }
3526 }
3527  
3528 # tr/// or y///
3529  
3530 # about [cdsrbB]* (/B modifier)
3531 #
3532 # P.559 appendix C
3533 # of ISBN 4-89052-384-7 Programming perl
3534 # (Japanese title is: Perl puroguramingu)
3535  
3536 elsif (/\G \b ( tr | y ) \b /oxgc) {
3537 4 my $ope = $1;
3538  
3539 # $1 $2 $3 $4 $5 $6
3540 4 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ((?:$qq_char)*?) (\#) ([cdsrbB]*) /oxgc) { # tr# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin8::qq_char)*?) (\#) ((?:$Elatin8::qq_char)*?) (\#) ([cdsrbB]*) /cgox) { } 0 4 4
3541 0 my @tr = ($tr_variable,$2);
3542 0 return e_tr(@tr,'',$4,$6);
3543 }
3544 else {
3545 4 my $e = '';
3546 4 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 4 0 4
3547 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) ((?:$Elatin8::qq_char)*?) (\1) ((?:$Elatin8::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 4 0 4
3548 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) {
3549 0 my @tr = ($tr_variable,$2);
3550 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3551 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin8::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3552 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) ( )
3553 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) { }
3554 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) [ ]
3555 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) < >
3556 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) * *
3557 }
3558 0 die __FILE__, ": Transliteration replacement not terminated\n";
3559 }
3560 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) {
3561 0 my @tr = ($tr_variable,$2);
3562 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3563 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin8::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3564 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } ( )
3565 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } { }
3566 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } [ ]
3567 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } < >
3568 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } * *
3569 }
3570 0 die __FILE__, ": Transliteration replacement not terminated\n";
3571 }
3572 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) {
3573 0 my @tr = ($tr_variable,$2);
3574 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3575 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) ((?:$Elatin8::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3576 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] ( )
3577 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] { }
3578 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] [ ]
3579 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] < >
3580 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] * *
3581 }
3582 0 die __FILE__, ": Transliteration replacement not terminated\n";
3583 }
3584 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) {
3585 0 my @tr = ($tr_variable,$2);
3586 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3587 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) ((?:$Elatin8::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3588 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > ( )
3589 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > { }
3590 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > [ ]
3591 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > < >
3592 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > * *
3593 }
3594 0 die __FILE__, ": Transliteration replacement not terminated\n";
3595 }
3596 # $1 $2 $3 $4 $5 $6
3597 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { # tr * * *
3598 4 my @tr = ($tr_variable,$2);
3599 4 return e_tr(@tr,'',$4,$6);
3600 }
3601 }
3602 0 die __FILE__, ": Transliteration pattern not terminated\n";
3603 }
3604 }
3605  
3606 # qq//
3607 elsif (/\G \b (qq) \b /oxgc) {
3608 2252 my $ope = $1;
3609  
3610 # if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { return e_qq($ope,$1,$3,$2); } # qq# #
3611 2252 ▶ if (/\G (\#) /oxgc) { # qq# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) /cgox) { } 0 2252 2252
3612 0 my $qq_string = '';
3613 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3614 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 ($Elatin8::qq_char) /cgox) { } 0 0 0
3615 0 elsif (/\G (\\\#) /oxgc) { $qq_string .= $1; }
3616 0 elsif (/\G (\#) /oxgc) { return e_qq($ope,'#','#',$qq_string); }
3617 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3618 }
3619 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3620 }
3621  
3622 else {
3623 2252 my $e = '';
3624 2252 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 2252 0 2252
3625 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
3626  
3627 # elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq ( )
3628 elsif (/\G (\() /oxgc) { # qq ( )
3629 0 my $qq_string = '';
3630 0 local $nest = 1;
3631 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3632 0 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 5 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 0 0
elsif (/\G (\\\)) /cgox) { } 0 0 0
elsif (/\G (\() /cgox) { } 0 0 0
elsif (/\G (\)) /cgox) { } 0 0 0
elsif (/\G ($Elatin8::qq_char) /cgox) { } 0 0 0
3633 0 elsif (/\G (\\\)) /oxgc) { $qq_string .= $1; }
3634 0 elsif (/\G (\() /oxgc) { $qq_string .= $1; $nest++; }
3635 elsif (/\G (\)) /oxgc) {
3636 0 ▶ if (--$nest == 0) { return $e . e_qq($ope,'(',')',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin8::nest == 0) { } 0 0 0
3637 0 else { $qq_string .= $1; }
3638 }
3639 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3640 }
3641 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3642 }
3643  
3644 # elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq { }
3645 elsif (/\G (\{) /oxgc) { # qq { }
3646 2222 my $qq_string = '';
3647 2222 local $nest = 1;
3648 2222 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 85104 0 85104
3649 85104 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 5 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 722 84382 85104
elsif (/\G (\\\}) /cgox) { } 0 84382 84382
elsif (/\G (\{) /cgox) { } 1189 83193 84382
elsif (/\G (\}) /cgox) { } 3411 79782 83193
elsif (/\G ($Elatin8::qq_char) /cgox) { } 79782 0 79782
3650 0 elsif (/\G (\\\}) /oxgc) { $qq_string .= $1; }
3651 1189 elsif (/\G (\{) /oxgc) { $qq_string .= $1; $nest++; }
3652 elsif (/\G (\}) /oxgc) {
3653 3411 ▶ if (--$nest == 0) { return $e . e_qq($ope,'{','}',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin8::nest == 0) { } 2222 1189 3411
3654 1189 else { $qq_string .= $1; }
3655 }
3656 79782 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3657 }
3658 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3659 }
3660  
3661 # elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq [ ]
3662 elsif (/\G (\[) /oxgc) { # qq [ ]
3663 0 my $qq_string = '';
3664 0 local $nest = 1;
3665 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3666 0 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 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 ($Elatin8::qq_char) /cgox) { } 0 0 0
3667 0 elsif (/\G (\\\]) /oxgc) { $qq_string .= $1; }
3668 0 elsif (/\G (\[) /oxgc) { $qq_string .= $1; $nest++; }
3669 elsif (/\G (\]) /oxgc) {
3670 0 ▶ if (--$nest == 0) { return $e . e_qq($ope,'[',']',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin8::nest == 0) { } 0 0 0
3671 0 else { $qq_string .= $1; }
3672 }
3673 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3674 }
3675 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3676 }
3677  
3678 # elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq < >
3679 elsif (/\G (\<) /oxgc) { # qq < >
3680 30 my $qq_string = '';
3681 30 local $nest = 1;
3682 30 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 1166 0 1166
3683 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 ($Elatin8::qq_char) /cgox) { } 1114 0 1114
3684 0 elsif (/\G (\\\>) /oxgc) { $qq_string .= $1; }
3685 0 elsif (/\G (\<) /oxgc) { $qq_string .= $1; $nest++; }
3686 elsif (/\G (\>) /oxgc) {
3687 30 ▶ if (--$nest == 0) { return $e . e_qq($ope,'<','>',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin8::nest == 0) { } 30 0 30
3688 0 else { $qq_string .= $1; }
3689 }
3690 1114 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3691 }
3692 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3693 }
3694  
3695 # elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq * *
3696 elsif (/\G (\S) /oxgc) { # qq * *
3697 0 my $delimiter = $1;
3698 0 my $qq_string = '';
3699 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3700 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 ($Elatin8::qq_char) /cgox) { } 0 0 0
3701 0 elsif (/\G (\\\Q$delimiter\E) /oxgc) { $qq_string .= $1; }
3702 0 elsif (/\G (\Q$delimiter\E) /oxgc) { return $e . e_qq($ope,$delimiter,$delimiter,$qq_string); }
3703 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3704 }
3705 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3706 }
3707 }
3708 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3709 }
3710 }
3711  
3712 # qr//
3713 elsif (/\G \b (qr) \b /oxgc) {
3714 0 my $ope = $1;
3715 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { # qr# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin8::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 0 0
3716 0 return e_qr($ope,$1,$3,$2,$4);
3717 }
3718 else {
3719 0 my $e = '';
3720 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3721 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 (\') ((?:$Elatin8::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin8::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin8::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
3722 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr ( )
3723 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr { }
3724 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr [ ]
3725 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr < >
3726 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { return $e . e_qr_q($ope,$1, $3, $2,$4); } # qr ' '
3727 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,'{','}',$2,$4); } # qr | | --> qr { }
3728 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr * *
3729 }
3730 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3731 }
3732 }
3733  
3734 # qw//
3735 elsif (/\G \b (qw) \b /oxgc) {
3736 16 my $ope = $1;
3737 16 ▶ if (/\G (\#) (.*?) (\#) /oxmsgc) { # qw# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) (.*?) (\#) /cgmosx) { } 0 16 16
3738 0 return e_qw($ope,$1,$3,$2);
3739 }
3740 else {
3741 16 my $e = '';
3742 16 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 16 0 16
3743 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) ((?:$Elatin8::q_char)*?) (\1) /cgmosx) { } 0 0 0
3744  
3745 16 elsif (/\G (\() ([^(]*?) (\)) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw ( )
3746 0 elsif (/\G (\() ((?:$q_paren)*?) (\)) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw ( )
3747  
3748 0 elsif (/\G (\{) ([^{]*?) (\}) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw { }
3749 0 elsif (/\G (\{) ((?:$q_brace)*?) (\}) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw { }
3750  
3751 0 elsif (/\G (\[) ([^[]*?) (\]) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw [ ]
3752 0 elsif (/\G (\[) ((?:$q_bracket)*?) (\]) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw [ ]
3753  
3754 0 elsif (/\G (\<) ([^<]*?) (\>) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw < >
3755 0 elsif (/\G (\<) ((?:$q_angle)*?) (\>) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw < >
3756  
3757 0 elsif (/\G ([\x21-\x3F]) (.*?) (\1) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw * *
3758 0 elsif (/\G (\S) ((?:$q_char)*?) (\1) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw * *
3759 }
3760 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3761 }
3762 }
3763  
3764 # qx//
3765 elsif (/\G \b (qx) \b /oxgc) {
3766 0 my $ope = $1;
3767 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qx# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin8::qq_char)*?) (\#) /cgox) { } 0 0 0
3768 0 return e_qq($ope,$1,$3,$2);
3769 }
3770 else {
3771 0 my $e = '';
3772 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3773 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 (\') ((?:$Elatin8::qq_char)*?) (\') /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin8::qq_char)*?) (\1) /cgox) { } 0 0 0
3774 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx ( )
3775 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx { }
3776 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx [ ]
3777 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx < >
3778 0 elsif (/\G (\') ((?:$qq_char)*?) (\') /oxgc) { return $e . e_q ($ope,$1,$3,$2); } # qx ' '
3779 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx * *
3780 }
3781 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3782 }
3783 }
3784  
3785 # q//
3786 elsif (/\G \b (q) \b /oxgc) {
3787 473 my $ope = $1;
3788  
3789 # if (/\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { return e_q($ope,$1,$3,$2); } # q# #
3790  
3791 # avoid "Error: Runtime exception" of perl version 5.005_03
3792 # (and so on)
3793  
3794 473 ▶ if (/\G (\#) /oxgc) { # q# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) /cgox) { } 0 473 473
3795 0 my $q_string = '';
3796 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3797 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 ($Elatin8::q_char) /cgox) { } 0 0 0
3798 0 elsif (/\G (\\\#) /oxgc) { $q_string .= $1; }
3799 0 elsif (/\G (\#) /oxgc) { return e_q($ope,'#','#',$q_string); }
3800 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3801 }
3802 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3803 }
3804  
3805 else {
3806 473 my $e = '';
3807 473 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 473 0 473
3808 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
3809  
3810 # elsif (/\G (\() ((?:\\\)|\\\\|$q_paren)*?) (\)) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q ( )
3811 elsif (/\G (\() /oxgc) { # q ( )
3812 0 my $q_string = '';
3813 0 local $nest = 1;
3814 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3815 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 ($Elatin8::q_char) /cgox) { } 0 0 0
3816 0 elsif (/\G (\\\)) /oxgc) { $q_string .= $1; }
3817 0 elsif (/\G (\\\() /oxgc) { $q_string .= $1; }
3818 0 elsif (/\G (\() /oxgc) { $q_string .= $1; $nest++; }
3819 elsif (/\G (\)) /oxgc) {
3820 0 ▶ if (--$nest == 0) { return $e . e_q($ope,'(',')',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin8::nest == 0) { } 0 0 0
3821 0 else { $q_string .= $1; }
3822 }
3823 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3824 }
3825 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3826 }
3827  
3828 # elsif (/\G (\{) ((?:\\\}|\\\\|$q_brace)*?) (\}) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q { }
3829 elsif (/\G (\{) /oxgc) { # q { }
3830 467 my $q_string = '';
3831 467 local $nest = 1;
3832 467 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 8249 0 8249
3833 0 ▶ if (/\G (\\\\) /oxgc) { $q_string .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 8249 8249
elsif (/\G (\\\}) /cgox) { } 0 8249 8249
elsif (/\G (\\\{) /cgox) { } 0 8249 8249
elsif (/\G (\{) /cgox) { } 159 8090 8249
elsif (/\G (\}) /cgox) { } 626 7464 8090
elsif (/\G ($Elatin8::q_char) /cgox) { } 7464 0 7464
3834 0 elsif (/\G (\\\}) /oxgc) { $q_string .= $1; }
3835 0 elsif (/\G (\\\{) /oxgc) { $q_string .= $1; }
3836 159 elsif (/\G (\{) /oxgc) { $q_string .= $1; $nest++; }
3837 elsif (/\G (\}) /oxgc) {
3838 626 ▶ if (--$nest == 0) { return $e . e_q($ope,'{','}',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin8::nest == 0) { } 467 159 626
3839 159 else { $q_string .= $1; }
3840 }
3841 7464 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3842 }
3843 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3844 }
3845  
3846 # elsif (/\G (\[) ((?:\\\]|\\\\|$q_bracket)*?) (\]) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q [ ]
3847 elsif (/\G (\[) /oxgc) { # q [ ]
3848 0 my $q_string = '';
3849 0 local $nest = 1;
3850 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3851 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 ($Elatin8::q_char) /cgox) { } 0 0 0
3852 0 elsif (/\G (\\\]) /oxgc) { $q_string .= $1; }
3853 0 elsif (/\G (\\\[) /oxgc) { $q_string .= $1; }
3854 0 elsif (/\G (\[) /oxgc) { $q_string .= $1; $nest++; }
3855 elsif (/\G (\]) /oxgc) {
3856 0 ▶ if (--$nest == 0) { return $e . e_q($ope,'[',']',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin8::nest == 0) { } 0 0 0
3857 0 else { $q_string .= $1; }
3858 }
3859 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3860 }
3861 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3862 }
3863  
3864 # elsif (/\G (\<) ((?:\\\>|\\\\|$q_angle)*?) (\>) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q < >
3865 elsif (/\G (\<) /oxgc) { # q < >
3866 5 my $q_string = '';
3867 5 local $nest = 1;
3868 5 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 88 0 88
3869 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 ($Elatin8::q_char) /cgox) { } 83 0 83
3870 0 elsif (/\G (\\\>) /oxgc) { $q_string .= $1; }
3871 0 elsif (/\G (\\\<) /oxgc) { $q_string .= $1; }
3872 0 elsif (/\G (\<) /oxgc) { $q_string .= $1; $nest++; }
3873 elsif (/\G (\>) /oxgc) {
3874 5 ▶ if (--$nest == 0) { return $e . e_q($ope,'<','>',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin8::nest == 0) { } 5 0 5
3875 0 else { $q_string .= $1; }
3876 }
3877 83 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3878 }
3879 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3880 }
3881  
3882 # elsif (/\G (\S) ((?:\\\1|\\\\|$q_char)*?) (\1) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q * *
3883 elsif (/\G (\S) /oxgc) { # q * *
3884 1 my $delimiter = $1;
3885 1 my $q_string = '';
3886 1 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 14 0 14
3887 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 ($Elatin8::q_char) /cgox) { } 13 0 13
3888 0 elsif (/\G (\\\Q$delimiter\E) /oxgc) { $q_string .= $1; }
3889 1 elsif (/\G (\Q$delimiter\E) /oxgc) { return $e . e_q($ope,$delimiter,$delimiter,$q_string); }
3890 13 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3891 }
3892 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3893 }
3894 }
3895 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3896 }
3897 }
3898  
3899 # m//
3900 elsif (/\G \b (m) \b /oxgc) {
3901 209 my $ope = $1;
3902 209 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { # m# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin8::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
3903 0 return e_qr($ope,$1,$3,$2,$4);
3904 }
3905 else {
3906 209 my $e = '';
3907 209 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 209 0 209
3908 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 (\?) ((?:$Elatin8::qq_char)*?) (\?) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
elsif (/\G (\') ((?:$Elatin8::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 10 199 209
elsif (/\G ([*\-:\\^|]) ((?:$Elatin8::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 199 199
elsif (/\G (\S) ((?:$Elatin8::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 199 0 199
3909 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m ( )
3910 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m { }
3911 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m [ ]
3912 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m < >
3913 0 elsif (/\G (\?) ((?:$qq_char)*?) (\?) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m ? ?
3914 10 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr_q($ope,$1, $3, $2,$4); } # m ' '
3915 0 elsif (/\G ([*\-:\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,'{','}',$2,$4); } # m | | --> m { }
3916 199 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m * *
3917 }
3918 0 die __FILE__, ": Search pattern not terminated\n";
3919 }
3920 }
3921  
3922 # s///
3923  
3924 # about [cegimosxpradlunbB]* (/cg modifier)
3925 #
3926 # P.67 Pattern-Matching Operators
3927 # of ISBN 0-596-00241-6 Perl in a Nutshell, Second Edition.
3928  
3929 elsif (/\G \b (s) \b /oxgc) {
3930 101 my $ope = $1;
3931  
3932 # $1 $2 $3 $4 $5 $6
3933 101 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ((?:$qq_char)*?) (\#) ([cegimosxpradlunbB]*) /oxgc) { # s# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin8::qq_char)*?) (\#) ((?:$Elatin8::qq_char)*?) (\#) ([cegimosxpradlunbB]*) /cgox) { } 1 100 101
3934 1 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3935 }
3936 else {
3937 100 my $e = '';
3938 100 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 100 0 100
3939 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 (\') ((?:$Elatin8::qq_char)*?) (\') ((?:$Elatin8::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 21 79 100
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin8::qq_char)*?) (\1) ((?:$Elatin8::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 79 79
elsif (/\G (\$) ((?:$Elatin8::qq_char)*?) (\1) ((?:$Elatin8::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 79 79
elsif (/\G (\S) ((?:$Elatin8::qq_char)*?) (\1) ((?:$Elatin8::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 79 0 79
3940 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) {
3941 0 my @s = ($1,$2,$3);
3942 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3943 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 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 (\') ((?:$Elatin8::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin8::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Elatin8::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Elatin8::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin8::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3944 # $1 $2 $3 $4
3945 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3946 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3947 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3948 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3949 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3950 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3951 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3952 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3953 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3954 }
3955 0 die __FILE__, ": Substitution replacement not terminated\n";
3956 }
3957 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) {
3958 0 my @s = ($1,$2,$3);
3959 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3960 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 (\') ((?:$Elatin8::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin8::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Elatin8::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Elatin8::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin8::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3961 # $1 $2 $3 $4
3962 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3963 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3964 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3965 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3966 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3967 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3968 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3969 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3970 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3971 }
3972 0 die __FILE__, ": Substitution replacement not terminated\n";
3973 }
3974 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) {
3975 0 my @s = ($1,$2,$3);
3976 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3977 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 (\') ((?:$Elatin8::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin8::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin8::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3978 # $1 $2 $3 $4
3979 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3980 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3981 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3982 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3983 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3984 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3985 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3986 }
3987 0 die __FILE__, ": Substitution replacement not terminated\n";
3988 }
3989 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) {
3990 0 my @s = ($1,$2,$3);
3991 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3992 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 (\') ((?:$Elatin8::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin8::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Elatin8::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Elatin8::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin8::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3993 # $1 $2 $3 $4
3994 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3995 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3996 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3997 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3998 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3999 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4000 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4001 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4002 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4003 }
4004 0 die __FILE__, ": Substitution replacement not terminated\n";
4005 }
4006 # $1 $2 $3 $4 $5 $6
4007 elsif (/\G (\') ((?:$qq_char)*?) (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) {
4008 21 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
4009 }
4010 # $1 $2 $3 $4 $5 $6
4011 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
4012 0 return e_sub($sub_variable,'{',$2,'}','{',$4,'}',$6); # s | | | --> s { } { }
4013 }
4014 # $1 $2 $3 $4 $5 $6
4015 elsif (/\G (\$) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
4016 0 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
4017 }
4018 # $1 $2 $3 $4 $5 $6
4019 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
4020 79 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
4021 }
4022 }
4023 0 die __FILE__, ": Substitution pattern not terminated\n";
4024 }
4025 }
4026  
4027 # require ignore module
4028 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# require$1$2"; }
4029 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# require$1\n$2"; }
4030 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# require$1"; }
4031  
4032 # use strict; --> use strict; no strict qw(refs);
4033 37 elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "use$1 no strict qw(refs);$2"; }
4034 0 elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [^#]) /oxmsgc) { return "use$1 no strict qw(refs);\n$2"; }
4035 0 elsif (/\G \b use ((?>\s+) strict) \b /oxmsgc) { return "use$1; no strict qw(refs)"; }
4036  
4037 # use 5.12.0; --> use 5.12.0; no strict qw(refs);
4038 elsif (/\G \b use (?>\s+) ((?>([1-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /oxmsgc) {
4039 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
4040 0 return "use $1; no strict qw(refs);";
4041 }
4042 else {
4043 2 return "use $1;";
4044 }
4045 }
4046 elsif (/\G \b use (?>\s+) ((?>v([0-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /oxmsgc) {
4047 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
4048 0 return "use $1; no strict qw(refs);";
4049 }
4050 else {
4051 0 return "use $1;";
4052 }
4053 }
4054  
4055 # ignore use module
4056 2 elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# use$1$2"; }
4057 0 elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# use$1\n$2"; }
4058 0 elsif (/\G \b use ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# use$1"; }
4059  
4060 # ignore no module
4061 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# no$1$2"; }
4062 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# no$1\n$2"; }
4063 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# no$1"; }
4064  
4065 # use else
4066 0 elsif (/\G \b use \b /oxmsgc) { return "use"; }
4067  
4068 # use else
4069 2 elsif (/\G \b no \b /oxmsgc) { return "no"; }
4070  
4071 # ''
4072 elsif (/\G (?<![\w\$\@\%\&\*]) (\') /oxgc) {
4073 1142 my $q_string = '';
4074 1142 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 10175 0 10175
4075 10175 ▶ if (/\G (\\\\) /oxgc) { $q_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 4 10171 10175
elsif (/\G (\\\') /cgox) { } 48 10123 10171
elsif (/\G \' /cgox) { } 1142 8981 10123
elsif (/\G ($Elatin8::q_char) /cgox) { } 8981 0 8981
4076 48 elsif (/\G (\\\') /oxgc) { $q_string .= $1; }
4077 1142 elsif (/\G \' /oxgc) { return e_q('', "'","'",$q_string); }
4078 8981 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
4079 }
4080 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4081 }
4082  
4083 # ""
4084 elsif (/\G (\") /oxgc) {
4085 1941 my $qq_string = '';
4086 1941 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 37378 0 37378
4087 37378 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 67 37311 37378
elsif (/\G (\\\") /cgox) { } 12 37299 37311
elsif (/\G \" /cgox) { } 1941 35358 37299
elsif (/\G ($Elatin8::q_char) /cgox) { } 35358 0 35358
4088 12 elsif (/\G (\\\") /oxgc) { $qq_string .= $1; }
4089 1941 elsif (/\G \" /oxgc) { return e_qq('', '"','"',$qq_string); }
4090 35358 elsif (/\G ($q_char) /oxgc) { $qq_string .= $1; }
4091 }
4092 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4093 }
4094  
4095 # ``
4096 elsif (/\G (\`) /oxgc) {
4097 1 my $qx_string = '';
4098 1 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 19 0 19
4099 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 ($Elatin8::q_char) /cgox) { } 18 0 18
4100 0 elsif (/\G (\\\`) /oxgc) { $qx_string .= $1; }
4101 1 elsif (/\G \` /oxgc) { return e_qq('', '`','`',$qx_string); }
4102 18 elsif (/\G ($q_char) /oxgc) { $qx_string .= $1; }
4103 }
4104 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4105 }
4106  
4107 # // --- not divide operator (num / num), not defined-or
4108 ▶ elsif (($slash eq 'm//') and /\G (\/) /oxgc) {
Condition100%3/3
$Elatin8::slash eq "m//" and m[\G (/) ]cgox
!ll&&!rl&&r
273608836681
MC/DC100%2/2
$Elatin8::slash eq "m//" and m[\G (/) ]cgox
$Elatin8::slash eq "m//" m[\G (/) ]cgox
Truth table100%3/3
A and B
A= $Elatin8::slash eq "m//"B= m[\G (/) ]cgox
ABresult
0X0
100
111
4109 681 my $regexp = '';
4110 681 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 5636 0 5636
4111 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 ($Elatin8::q_char) /cgox) { } 4955 0 4955
4112 0 elsif (/\G (\\\/) /oxgc) { $regexp .= $1; }
4113 681 elsif (/\G \/ ([cgimosxpadlunbB]*) /oxgc) { return e_qr('', '/','/',$regexp,$1); }
4114 4955 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
4115 }
4116 0 die __FILE__, ": Search pattern not terminated\n";
4117 }
4118  
4119 # ?? --- not conditional operator (condition ? then : else)
4120 ▶ elsif (($slash eq 'm//') and /\G (\?) /oxgc) {
Condition66%2/3
$Elatin8::slash eq "m//" and /\G (\?) /cgox
!ll&&!rl&&r
2736088360
MC/DC0%0/2
$Elatin8::slash eq "m//" and /\G (\?) /cgox
$Elatin8::slash eq "m//" /\G (\?) /cgox
Truth table66%2/3
A and B
A= $Elatin8::slash eq "m//"B= /\G (\?) /cgox
ABresult
0X0
100
111
4121 0 my $regexp = '';
4122 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
4123 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 ($Elatin8::q_char) /cgox) { } 0 0 0
4124 0 elsif (/\G (\\\?) /oxgc) { $regexp .= $1; }
4125 0 elsif (/\G \? ([cgimosxpadlunbB]*) /oxgc) { return e_qr('m','?','?',$regexp,$1); }
4126 0 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
4127 }
4128 0 die __FILE__, ": Search pattern not terminated\n";
4129 }
4130  
4131 # <<>> (a safer ARGV)
4132 0 elsif (/\G ( <<>> ) /oxgc) { $slash = 'm//'; return $1; }
4133  
4134 # << (bit shift) --- not here document
4135 0 elsif (/\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /oxgc) { $slash = 'm//'; return $1; }
4136  
4137 # <<~'HEREDOC'
4138 elsif (/\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /oxgc) {
4139 6 $slash = 'm//';
4140 6 my $here_quote = $1;
4141 6 my $delimiter = $2;
4142  
4143 # get here document
4144 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4145 6 $here_script = CORE::substr $_, pos $_;
4146 6 $here_script =~ s/.*?\n//oxm;
4147 }
4148 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
4149 6 my $heredoc = $1;
4150 6 my $indent = $2;
4151 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4152 6 push @heredoc, $heredoc . qq{\n$delimiter\n};
4153 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4154 }
4155 else {
4156 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4157 }
4158 6 return qq{<<'$delimiter'};
4159 }
4160  
4161 # <<~\HEREDOC
4162  
4163 # P.66 2.6.6. "Here" Documents
4164 # in Chapter 2: Bits and Pieces
4165 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4166  
4167 # P.73 "Here" Documents
4168 # in Chapter 2: Bits and Pieces
4169 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4170  
4171 elsif (/\G ( <<~ \\([a-zA-Z_0-9]+) ) /oxgc) {
4172 3 $slash = 'm//';
4173 3 my $here_quote = $1;
4174 3 my $delimiter = $2;
4175  
4176 # get here document
4177 3 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 3 0 3
4178 3 $here_script = CORE::substr $_, pos $_;
4179 3 $here_script =~ s/.*?\n//oxm;
4180 }
4181 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
4182 3 my $heredoc = $1;
4183 3 my $indent = $2;
4184 3 $heredoc =~ s{^$indent}{}msg; # no /ox
4185 3 push @heredoc, $heredoc . qq{\n$delimiter\n};
4186 3 push @heredoc_delimiter, qq{\\s*$delimiter};
4187 }
4188 else {
4189 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4190 }
4191 3 return qq{<<\\$delimiter};
4192 }
4193  
4194 # <<~"HEREDOC"
4195 elsif (/\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /oxgc) {
4196 6 $slash = 'm//';
4197 6 my $here_quote = $1;
4198 6 my $delimiter = $2;
4199  
4200 # get here document
4201 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4202 6 $here_script = CORE::substr $_, pos $_;
4203 6 $here_script =~ s/.*?\n//oxm;
4204 }
4205 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
4206 6 my $heredoc = $1;
4207 6 my $indent = $2;
4208 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4209 6 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4210 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4211 }
4212 else {
4213 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4214 }
4215 6 return qq{<<"$delimiter"};
4216 }
4217  
4218 # <<~HEREDOC
4219 elsif (/\G ( <<~ ([a-zA-Z_0-9]+) ) /oxgc) {
4220 3 $slash = 'm//';
4221 3 my $here_quote = $1;
4222 3 my $delimiter = $2;
4223  
4224 # get here document
4225 3 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 3 0 3
4226 3 $here_script = CORE::substr $_, pos $_;
4227 3 $here_script =~ s/.*?\n//oxm;
4228 }
4229 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
4230 3 my $heredoc = $1;
4231 3 my $indent = $2;
4232 3 $heredoc =~ s{^$indent}{}msg; # no /ox
4233 3 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4234 3 push @heredoc_delimiter, qq{\\s*$delimiter};
4235 }
4236 else {
4237 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4238 }
4239 3 return qq{<<$delimiter};
4240 }
4241  
4242 # <<~`HEREDOC`
4243 elsif (/\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /oxgc) {
4244 6 $slash = 'm//';
4245 6 my $here_quote = $1;
4246 6 my $delimiter = $2;
4247  
4248 # get here document
4249 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4250 6 $here_script = CORE::substr $_, pos $_;
4251 6 $here_script =~ s/.*?\n//oxm;
4252 }
4253 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
4254 6 my $heredoc = $1;
4255 6 my $indent = $2;
4256 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4257 6 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4258 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4259 }
4260 else {
4261 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4262 }
4263 6 return qq{<<`$delimiter`};
4264 }
4265  
4266 # <<'HEREDOC'
4267 elsif (/\G ( << '([a-zA-Z_0-9]*)' ) /oxgc) {
4268 72 $slash = 'm//';
4269 72 my $here_quote = $1;
4270 72 my $delimiter = $2;
4271  
4272 # get here document
4273 72 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 72 0 72
4274 72 $here_script = CORE::substr $_, pos $_;
4275 72 $here_script =~ s/.*?\n//oxm;
4276 }
4277 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
4278 72 push @heredoc, $1 . qq{\n$delimiter\n};
4279 72 push @heredoc_delimiter, $delimiter;
4280 }
4281 else {
4282 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4283 }
4284 72 return $here_quote;
4285 }
4286  
4287 # <<\HEREDOC
4288  
4289 # P.66 2.6.6. "Here" Documents
4290 # in Chapter 2: Bits and Pieces
4291 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4292  
4293 # P.73 "Here" Documents
4294 # in Chapter 2: Bits and Pieces
4295 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4296  
4297 elsif (/\G ( << \\([a-zA-Z_0-9]+) ) /oxgc) {
4298 0 $slash = 'm//';
4299 0 my $here_quote = $1;
4300 0 my $delimiter = $2;
4301  
4302 # get here document
4303 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4304 0 $here_script = CORE::substr $_, pos $_;
4305 0 $here_script =~ s/.*?\n//oxm;
4306 }
4307 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
4308 0 push @heredoc, $1 . qq{\n$delimiter\n};
4309 0 push @heredoc_delimiter, $delimiter;
4310 }
4311 else {
4312 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4313 }
4314 0 return $here_quote;
4315 }
4316  
4317 # <<"HEREDOC"
4318 elsif (/\G ( << "([a-zA-Z_0-9]*)" ) /oxgc) {
4319 36 $slash = 'm//';
4320 36 my $here_quote = $1;
4321 36 my $delimiter = $2;
4322  
4323 # get here document
4324 36 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 36 0 36
4325 36 $here_script = CORE::substr $_, pos $_;
4326 36 $here_script =~ s/.*?\n//oxm;
4327 }
4328 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
4329 36 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4330 36 push @heredoc_delimiter, $delimiter;
4331 }
4332 else {
4333 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4334 }
4335 36 return $here_quote;
4336 }
4337  
4338 # <<HEREDOC
4339 elsif (/\G ( << ([a-zA-Z_0-9]+) ) /oxgc) {
4340 42 $slash = 'm//';
4341 42 my $here_quote = $1;
4342 42 my $delimiter = $2;
4343  
4344 # get here document
4345 42 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 42 0 42
4346 42 $here_script = CORE::substr $_, pos $_;
4347 42 $here_script =~ s/.*?\n//oxm;
4348 }
4349 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
4350 42 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4351 42 push @heredoc_delimiter, $delimiter;
4352 }
4353 else {
4354 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4355 }
4356 42 return $here_quote;
4357 }
4358  
4359 # <<`HEREDOC`
4360 elsif (/\G ( << `([a-zA-Z_0-9]*)` ) /oxgc) {
4361 0 $slash = 'm//';
4362 0 my $here_quote = $1;
4363 0 my $delimiter = $2;
4364  
4365 # get here document
4366 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4367 0 $here_script = CORE::substr $_, pos $_;
4368 0 $here_script =~ s/.*?\n//oxm;
4369 }
4370 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
4371 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4372 0 push @heredoc_delimiter, $delimiter;
4373 }
4374 else {
4375 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4376 }
4377 0 return $here_quote;
4378 }
4379  
4380 # <<= <=> <= < operator
4381 elsif (/\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/oxgc) {
4382 12 return $1;
4383 }
4384  
4385 # <FILEHANDLE>
4386 elsif (/\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /oxgc) {
4387 0 return $1;
4388 }
4389  
4390 # <WILDCARD> --- glob
4391  
4392 # avoid "Error: Runtime exception" of perl version 5.005_03
4393  
4394 elsif (/\G < ((?:[^>\0\a\e\f\n\r\t])+?) > /oxgc) {
4395 0 return 'Elatin8::glob("' . $1 . '")';
4396 }
4397  
4398 # __DATA__
4399 0 elsif (/\G ^ ( __DATA__ \n .*) \z /oxmsgc) { return $1; }
4400  
4401 # __END__
4402 210 elsif (/\G ^ ( __END__ \n .*) \z /oxmsgc) { return $1; }
4403  
4404 # \cD Control-D
4405  
4406 # P.68 2.6.8. Other Literal Tokens
4407 # in Chapter 2: Bits and Pieces
4408 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4409  
4410 # P.76 Other Literal Tokens
4411 # in Chapter 2: Bits and Pieces
4412 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4413  
4414 0 elsif (/\G ( \cD .*) \z /oxmsgc) { return $1; }
4415  
4416 # \cZ Control-Z
4417 0 elsif (/\G ( \cZ .*) \z /oxmsgc) { return $1; }
4418  
4419 # any operator before div
4420 elsif (/\G (
4421 -- | \+\+ |
4422 [\)\}\]]
4423  
4424 5837 ) /oxgc) { $slash = 'div'; return $1; }
4425  
4426 # yada-yada or triple-dot operator
4427 elsif (/\G (
4428 \.\.\.
4429  
4430 7 ) /oxgc) { $slash = 'm//'; return q{die('Unimplemented')}; }
4431  
4432 # any operator before m//
4433  
4434 # //, //= (defined-or)
4435  
4436 # P.164 Logical Operators
4437 # in Chapter 10: More Control Structures
4438 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
4439  
4440 # P.119 C-Style Logical (Short-Circuit) Operators
4441 # in Chapter 3: Unary and Binary Operators
4442 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4443  
4444 # (and so on)
4445  
4446 # ~~
4447  
4448 # P.221 The Smart Match Operator
4449 # in Chapter 15: Smart Matching and given-when
4450 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
4451  
4452 # P.112 Smartmatch Operator
4453 # in Chapter 3: Unary and Binary Operators
4454 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4455  
4456 # (and so on)
4457  
4458 elsif (/\G ((?>
4459  
4460 !~~ | !~ | != | ! |
4461 %= | % |
4462 &&= | && | &= | &\.= | &\. | & |
4463 -= | -> | - |
4464 :(?>\s*)= |
4465 : |
4466 <<>> |
4467 <<= | <=> | <= | < |
4468 == | => | =~ | = |
4469 >>= | >> | >= | > |
4470 \*\*= | \*\* | \*= | \* |
4471 \+= | \+ |
4472 \.\. | \.= | \. |
4473 \/\/= | \/\/ |
4474 \/= | \/ |
4475 \? |
4476 \\ |
4477 \^= | \^\.= | \^\. | \^ |
4478 \b x= |
4479 \|\|= | \|\| | \|= | \|\.= | \|\. | \| |
4480 ~~ | ~\. | ~ |
4481 \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b |
4482 \b(?: print )\b |
4483  
4484 [,;\(\{\[]
4485  
4486 9800 )) /oxgc) { $slash = 'm//'; return $1; }
4487  
4488 # other any character
4489 20156 elsif (/\G ($q_char) /oxgc) { $slash = 'div'; return $1; }
4490  
4491 # system error
4492 else {
4493 0 die __FILE__, ": Oops, this shouldn't happen!\n";
4494 }
4495 }
4496  
4497 # escape Latin-8 string
4498 1871 ▶sub e_string {
Subroutine e_string: called CC=228 SCAR=104.2
Pod documented
4499 1871 my($string) = @_;
4500 1871 my $e_string = '';
4501  
4502 1871 local $slash = 'm//';
4503  
4504 # P.1024 Appendix W.10 Multibyte Processing
4505 # of ISBN 1-56592-224-7 CJKV Information Processing
4506 # (and so on)
4507  
4508 1871 my @char = $string =~ / \G (?>[^\\]|\\$q_char|$q_char) /oxmsg;
4509  
4510 # without { ... }
4511 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
4512 1854 ▶ if ($string !~ /<</oxms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /<</mosx) 1854 0 1854
4513 1854 return $string;
4514 }
4515 }
4516  
4517 E_STRING_LOOP:
4518 17 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 190 17 207
4519 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 Latin8::eval (?= (?>\s*) \{ ) /cgox) { } 0 180 180
elsif ($string =~ /\G \b Char::eval \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b Latin8::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 Latin8::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 Latin8::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*) (\") ((?:$Elatin8::qq_char)+?) (\") /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\#) ((?:$Elatin8::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) ((?:$Elatin8::qq_char)+?) (\1) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s*) (\') ((?:\\\'|\\\\|$Elatin8::q_char)+?) (\') /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$Elatin8::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|\\\\|$Elatin8::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\$\@\%\&\*]) (\') ((?:\\\'|\\\\|$Elatin8::q_char)*?) (\') /cgox) { } 0 180 180
elsif ($string =~ /\G (\") ((?:$Elatin8::qq_char)*?) (\") /cgox) { } 0 180 180
elsif ($string =~ /\G (\`) ((?:$Elatin8::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 < ((?:$Elatin8::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 ($Elatin8::q_char) /cgox) { } 131 0 131
4520 }
4521  
4522 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> @{[Elatin8::PREMATCH()]}
4523 elsif ($string =~ /\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /oxmsgc) {
4524 0 $e_string .= q{Elatin8::PREMATCH()};
4525 0 $slash = 'div';
4526 }
4527  
4528 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> @{[Elatin8::MATCH()]}
4529 elsif ($string =~ /\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /oxmsgc) {
4530 0 $e_string .= q{Elatin8::MATCH()};
4531 0 $slash = 'div';
4532 }
4533  
4534 # $', ${'} --> $', ${'}
4535 elsif ($string =~ /\G ( \$' | \$\{'\} ) /oxmsgc) {
4536 0 $e_string .= $1;
4537 0 $slash = 'div';
4538 }
4539  
4540 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> @{[Elatin8::POSTMATCH()]}
4541 elsif ($string =~ /\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /oxmsgc) {
4542 0 $e_string .= q{Elatin8::POSTMATCH()};
4543 0 $slash = 'div';
4544 }
4545  
4546 # bareword
4547 elsif ($string =~ /\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /oxmsgc) {
4548 0 $e_string .= $1;
4549 0 $slash = 'div';
4550 }
4551  
4552 # $0 --> $0
4553 elsif ($string =~ /\G ( \$ 0 ) /oxmsgc) {
4554 0 $e_string .= $1;
4555 0 $slash = 'div';
4556 }
4557 elsif ($string =~ /\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /oxmsgc) {
4558 0 $e_string .= $1;
4559 0 $slash = 'div';
4560 }
4561  
4562 # $$ --> $$
4563 elsif ($string =~ /\G ( \$ \$ ) (?![\w\{]) /oxmsgc) {
4564 0 $e_string .= $1;
4565 0 $slash = 'div';
4566 }
4567  
4568 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
4569 # $1, $2, $3 --> $1, $2, $3 otherwise
4570 elsif ($string =~ /\G \$ ((?>[1-9][0-9]*)) /oxmsgc) {
4571 0 $e_string .= e_capture($1);
4572 0 $slash = 'div';
4573 }
4574 elsif ($string =~ /\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /oxmsgc) {
4575 0 $e_string .= e_capture($1);
4576 0 $slash = 'div';
4577 }
4578  
4579 # $$foo[ ... ] --> $ $foo->[ ... ]
4580 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /oxmsgc) {
4581 0 $e_string .= e_capture($1.'->'.$2);
4582 0 $slash = 'div';
4583 }
4584  
4585 # $$foo{ ... } --> $ $foo->{ ... }
4586 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /oxmsgc) {
4587 0 $e_string .= e_capture($1.'->'.$2);
4588 0 $slash = 'div';
4589 }
4590  
4591 # $$foo
4592 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /oxmsgc) {
4593 0 $e_string .= e_capture($1);
4594 0 $slash = 'div';
4595 }
4596  
4597 # ${ foo }
4598 elsif ($string =~ /\G \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} /oxmsgc) {
4599 0 $e_string .= '${' . $1 . '}';
4600 0 $slash = 'div';
4601 }
4602  
4603 # ${ ... }
4604 elsif ($string =~ /\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /oxmsgc) {
4605 3 $e_string .= e_capture($1);
4606 3 $slash = 'div';
4607 }
4608  
4609 # variable or function
4610 # $ @ % & * $ #
4611 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) {
4612 7 $e_string .= $1;
4613 7 $slash = 'div';
4614 }
4615 # $ $ $ $ $ $ $ $ $ $ $ $ $ $
4616 # $ @ # \ ' " / ? ( ) [ ] < >
4617 elsif ($string =~ /\G ( \$[\$\@\#\\\'\"\/\?\(\)\[\]\<\>] ) /oxmsgc) {
4618 0 $e_string .= $1;
4619 0 $slash = 'div';
4620 }
4621  
4622 # subroutines of package Elatin8
4623 0 elsif ($string =~ /\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /oxgc) { $e_string .= $1; $slash = 'm//'; }
4624 0 elsif ($string =~ /\G \b Char::eval (?= (?>\s*) \{ ) /oxgc) { $e_string .= 'eval'; $slash = 'm//'; }
4625 0 elsif ($string =~ /\G \b Latin8::eval (?= (?>\s*) \{ ) /oxgc) { $e_string .= 'eval'; $slash = 'm//'; }
4626 0 elsif ($string =~ /\G \b Char::eval \b /oxgc) { $e_string .= 'eval Char::escape'; $slash = 'm//'; }
4627 0 elsif ($string =~ /\G \b Latin8::eval \b /oxgc) { $e_string .= 'eval Latin8::escape'; $slash = 'm//'; }
4628 0 elsif ($string =~ /\G \b bytes::substr \b /oxgc) { $e_string .= 'substr'; $slash = 'm//'; }
4629 0 elsif ($string =~ /\G \b chop \b /oxgc) { $e_string .= 'Elatin8::chop'; $slash = 'm//'; }
4630 0 elsif ($string =~ /\G \b bytes::index \b /oxgc) { $e_string .= 'index'; $slash = 'm//'; }
4631 0 elsif ($string =~ /\G \b Char::index \b /oxgc) { $e_string .= 'Char::index'; $slash = 'm//'; }
4632 0 elsif ($string =~ /\G \b Latin8::index \b /oxgc) { $e_string .= 'Latin8::index'; $slash = 'm//'; }
4633 0 elsif ($string =~ /\G \b index \b /oxgc) { $e_string .= 'Elatin8::index'; $slash = 'm//'; }
4634 0 elsif ($string =~ /\G \b bytes::rindex \b /oxgc) { $e_string .= 'rindex'; $slash = 'm//'; }
4635 0 elsif ($string =~ /\G \b Char::rindex \b /oxgc) { $e_string .= 'Char::rindex'; $slash = 'm//'; }
4636 0 elsif ($string =~ /\G \b Latin8::rindex \b /oxgc) { $e_string .= 'Latin8::rindex'; $slash = 'm//'; }
4637 0 elsif ($string =~ /\G \b rindex \b /oxgc) { $e_string .= 'Elatin8::rindex'; $slash = 'm//'; }
4638 0 elsif ($string =~ /\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin8::lc'; $slash = 'm//'; }
4639 0 elsif ($string =~ /\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin8::lcfirst'; $slash = 'm//'; }
4640 0 elsif ($string =~ /\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin8::uc'; $slash = 'm//'; }
4641 0 elsif ($string =~ /\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin8::ucfirst'; $slash = 'm//'; }
4642 0 elsif ($string =~ /\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin8::fc'; $slash = 'm//'; }
4643  
4644 # "-s '' ..." means file test "-s 'filename' ..." (not means "- s/// ...")
4645 0 elsif ($string =~ /\G -s (?>\s*) (\") ((?:$qq_char)+?) (\") /oxgc) { $e_string .= '-s ' . e_qq('', $1,$3,$2); $slash = 'm//'; }
4646 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\#) ((?:$qq_char)+?) (\#) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4647 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4648 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4649 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4650 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4651 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\S) ((?:$qq_char)+?) (\1) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4652  
4653 0 elsif ($string =~ /\G -s (?>\s*) (\') ((?:\\\'|\\\\|$q_char)+?) (\') /oxgc) { $e_string .= '-s ' . e_q ('', $1,$3,$2); $slash = 'm//'; }
4654 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$q_char)+?) (\#) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4655 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4656 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4657 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4658 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4659 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//'; }
4660  
4661 elsif ($string =~ /\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)*) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ))*) /oxgc)
4662 0 { $e_string .= "-s $1"; $slash = 'm//'; }
4663 0 elsif ($string =~ /\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /oxgc) { $e_string .= "-s ($1)"; $slash = 'm//'; }
4664 0 elsif ($string =~ /\G -s (?= (?>\s+) [a-z]+) /oxgc) { $e_string .= '-s'; $slash = 'm//'; }
4665 0 elsif ($string =~ /\G -s (?>\s+) ((?>\w+)) /oxgc) { $e_string .= "-s $1"; $slash = 'm//'; }
4666  
4667 0 elsif ($string =~ /\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'length'; $slash = 'm//'; }
4668 0 elsif ($string =~ /\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'chr'; $slash = 'm//'; }
4669 0 elsif ($string =~ /\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin8::chr'; $slash = 'm//'; }
4670 0 elsif ($string =~ /\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'ord'; $slash = 'div'; }
4671 0 elsif ($string =~ /\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= $function_ord; $slash = 'div'; }
4672 0 elsif ($string =~ /\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin8::glob'; $slash = 'm//'; }
4673 0 elsif ($string =~ /\G \b lc \b /oxgc) { $e_string .= 'Elatin8::lc_'; $slash = 'm//'; }
4674 0 elsif ($string =~ /\G \b lcfirst \b /oxgc) { $e_string .= 'Elatin8::lcfirst_'; $slash = 'm//'; }
4675 0 elsif ($string =~ /\G \b uc \b /oxgc) { $e_string .= 'Elatin8::uc_'; $slash = 'm//'; }
4676 0 elsif ($string =~ /\G \b ucfirst \b /oxgc) { $e_string .= 'Elatin8::ucfirst_'; $slash = 'm//'; }
4677 0 elsif ($string =~ /\G \b fc \b /oxgc) { $e_string .= 'Elatin8::fc_'; $slash = 'm//'; }
4678 0 elsif ($string =~ /\G -s \b /oxgc) { $e_string .= '-s '; $slash = 'm//'; }
4679  
4680 0 elsif ($string =~ /\G \b bytes::length \b /oxgc) { $e_string .= 'length'; $slash = 'm//'; }
4681 0 elsif ($string =~ /\G \b bytes::chr \b /oxgc) { $e_string .= 'chr'; $slash = 'm//'; }
4682 0 elsif ($string =~ /\G \b chr \b /oxgc) { $e_string .= 'Elatin8::chr_'; $slash = 'm//'; }
4683 0 elsif ($string =~ /\G \b bytes::ord \b /oxgc) { $e_string .= 'ord'; $slash = 'div'; }
4684 0 elsif ($string =~ /\G \b ord \b /oxgc) { $e_string .= $function_ord_; $slash = 'div'; }
4685 0 elsif ($string =~ /\G \b glob \b /oxgc) { $e_string .= 'Elatin8::glob_'; $slash = 'm//'; }
4686 0 elsif ($string =~ /\G \b reverse \b /oxgc) { $e_string .= $function_reverse; $slash = 'm//'; }
4687 0 elsif ($string =~ /\G \b getc \b /oxgc) { $e_string .= $function_getc; $slash = 'm//'; }
4688 # split
4689 elsif ($string =~ /\G \b (split) \b (?! (?>\s*) => ) /oxgc) {
4690 0 $slash = 'm//';
4691  
4692 0 my $e = '';
4693 0 ▶ while ($string =~ /\G ( (?>\s+) | \( | \#.* ) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G ( (?>\s+) | \( | \#.* ) /cgox) 0 0 0
4694 0 $e .= $1;
4695 }
4696  
4697 # end of split
4698 0 ▶ if ($string =~ /\G (?= [,;\)\}\]] ) /oxgc) { return 'Elatin8::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
4699  
4700 # split scalar value
4701 0 elsif ($string =~ /\G ( [\$\@\&\*] $qq_scalar ) /oxgc) { $e_string .= 'Elatin8::split' . $e . e_string($1); next E_STRING_LOOP; }
4702  
4703 # split literal space
4704 0 elsif ($string =~ /\G \b qq (\#) [ ] (\#) /oxgc) { $e_string .= 'Elatin8::split' . $e . qq {qq$1 $2}; next E_STRING_LOOP; }
4705 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\() [ ] (\)) /oxgc) { $e_string .= 'Elatin8::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4706 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\{) [ ] (\}) /oxgc) { $e_string .= 'Elatin8::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4707 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\[) [ ] (\]) /oxgc) { $e_string .= 'Elatin8::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4708 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\<) [ ] (\>) /oxgc) { $e_string .= 'Elatin8::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4709 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\S) [ ] (\2) /oxgc) { $e_string .= 'Elatin8::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4710 0 elsif ($string =~ /\G \b q (\#) [ ] (\#) /oxgc) { $e_string .= 'Elatin8::split' . $e . qq {q$1 $2}; next E_STRING_LOOP; }
4711 0 elsif ($string =~ /\G \b q ((?>\s*)) (\() [ ] (\)) /oxgc) { $e_string .= 'Elatin8::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4712 0 elsif ($string =~ /\G \b q ((?>\s*)) (\{) [ ] (\}) /oxgc) { $e_string .= 'Elatin8::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4713 0 elsif ($string =~ /\G \b q ((?>\s*)) (\[) [ ] (\]) /oxgc) { $e_string .= 'Elatin8::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4714 0 elsif ($string =~ /\G \b q ((?>\s*)) (\<) [ ] (\>) /oxgc) { $e_string .= 'Elatin8::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4715 0 elsif ($string =~ /\G \b q ((?>\s*)) (\S) [ ] (\2) /oxgc) { $e_string .= 'Elatin8::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4716 0 elsif ($string =~ /\G ' [ ] ' /oxgc) { $e_string .= 'Elatin8::split' . $e . qq {' '}; next E_STRING_LOOP; }
4717 0 elsif ($string =~ /\G " [ ] " /oxgc) { $e_string .= 'Elatin8::split' . $e . qq {" "}; next E_STRING_LOOP; }
4718  
4719 # split qq//
4720 elsif ($string =~ /\G \b (qq) \b /oxgc) {
4721 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 (\#) ((?:$Elatin8::qq_char)*?) (\#) /cgox) { } 0 0 0
4722 else {
4723 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4724 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 ([*\-:?\\^|]) ((?:$Elatin8::qq_char)*?) (\1) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Elatin8::qq_char)*?) (\1) /cgox) { } 0 0 0
4725 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq ( ) --> qr ( )
4726 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq { } --> qr { }
4727 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq [ ] --> qr [ ]
4728 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq < > --> qr < >
4729 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= e_split($e.'qr','{','}',$2,''); next E_STRING_LOOP; } # qq | | --> qr { }
4730 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq * * --> qr * *
4731 }
4732 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4733 }
4734 }
4735  
4736 # split qr//
4737 elsif ($string =~ /\G \b (qr) \b /oxgc) {
4738 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 (\#) ((?:$Elatin8::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 0 0
4739 else {
4740 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4741 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 (\') ((?:$Elatin8::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$Elatin8::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Elatin8::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
4742 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr ( )
4743 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr { }
4744 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr [ ]
4745 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr < >
4746 0 elsif ($string =~ /\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split_q($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr ' '
4747 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr','{','}',$2,$4); next E_STRING_LOOP; } # qr | | --> qr { }
4748 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 * *
4749 }
4750 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4751 }
4752 }
4753  
4754 # split q//
4755 elsif ($string =~ /\G \b (q) \b /oxgc) {
4756 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 (\#) ((?:\\\#|\\\\|$Elatin8::q_char)*?) (\#) /cgox) { } 0 0 0
4757 else {
4758 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4759 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 ([*\-:?\\^|]) ((?:$Elatin8::q_char)*?) (\1) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:\\\\|\\\1| $Elatin8::q_char)*?) (\1) /cgox) { } 0 0 0
4760 0 elsif ($string =~ /\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q ( ) --> qr ( )
4761 0 elsif ($string =~ /\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q { } --> qr { }
4762 0 elsif ($string =~ /\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q [ ] --> qr [ ]
4763 0 elsif ($string =~ /\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q < > --> qr < >
4764 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$q_char)*?) (\1) /oxgc) { $e_string .= e_split_q($e.'qr','{','}',$2,''); next E_STRING_LOOP; } # q | | --> qr { }
4765 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 * *
4766 }
4767 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4768 }
4769 }
4770  
4771 # split m//
4772 elsif ($string =~ /\G \b (m) \b /oxgc) {
4773 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 (\#) ((?:$Elatin8::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
4774 else {
4775 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4776 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 (\') ((?:$Elatin8::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$Elatin8::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Elatin8::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
4777 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m ( ) --> qr ( )
4778 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m { } --> qr { }
4779 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m [ ] --> qr [ ]
4780 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m < > --> qr < >
4781 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 ' '
4782 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr','{','}',$2,$4); next E_STRING_LOOP; } # m | | --> qr { }
4783 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 * *
4784 }
4785 0 die __FILE__, ": Search pattern not terminated\n";
4786 }
4787 }
4788  
4789 # split ''
4790 elsif ($string =~ /\G (\') /oxgc) {
4791 0 my $q_string = '';
4792 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4793 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 ($Elatin8::q_char) /cgox) { } 0 0 0
4794 0 elsif ($string =~ /\G (\\\') /oxgc) { $q_string .= $1; } # splitqr'' --> split qr''
4795 0 elsif ($string =~ /\G \' /oxgc) { $e_string .= e_split_q($e.q{ qr},"'","'",$q_string,''); next E_STRING_LOOP; } # ' ' --> qr ' '
4796 0 elsif ($string =~ /\G ($q_char) /oxgc) { $q_string .= $1; }
4797 }
4798 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4799 }
4800  
4801 # split ""
4802 elsif ($string =~ /\G (\") /oxgc) {
4803 0 my $qq_string = '';
4804 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4805 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 ($Elatin8::q_char) /cgox) { } 0 0 0
4806 0 elsif ($string =~ /\G (\\\") /oxgc) { $qq_string .= $1; } # splitqr"" --> split qr""
4807 0 elsif ($string =~ /\G \" /oxgc) { $e_string .= e_split($e.q{ qr},'"','"',$qq_string,''); next E_STRING_LOOP; } # " " --> qr " "
4808 0 elsif ($string =~ /\G ($q_char) /oxgc) { $qq_string .= $1; }
4809 }
4810 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4811 }
4812  
4813 # split //
4814 elsif ($string =~ /\G (\/) /oxgc) {
4815 0 my $regexp = '';
4816 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4817 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 ($Elatin8::q_char) /cgox) { } 0 0 0
4818 0 elsif ($string =~ /\G (\\\/) /oxgc) { $regexp .= $1; } # splitqr// --> split qr//
4819 0 elsif ($string =~ /\G \/ ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split($e.q{ qr}, '/','/',$regexp,$1); next E_STRING_LOOP; } # / / --> qr / /
4820 0 elsif ($string =~ /\G ($q_char) /oxgc) { $regexp .= $1; }
4821 }
4822 0 die __FILE__, ": Search pattern not terminated\n";
4823 }
4824 }
4825  
4826 # qq//
4827 elsif ($string =~ /\G \b (qq) \b /oxgc) {
4828 0 my $ope = $1;
4829 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qq# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Elatin8::qq_char)*?) (\#) /cgox) { } 0 0 0
4830 0 $e_string .= e_qq($ope,$1,$3,$2);
4831 }
4832 else {
4833 0 my $e = '';
4834 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4835 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) ((?:$Elatin8::qq_char)*?) (\1) /cgox) { } 0 0 0
4836 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq ( )
4837 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq { }
4838 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq [ ]
4839 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq < >
4840 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq * *
4841 }
4842 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4843 }
4844 }
4845  
4846 # qx//
4847 elsif ($string =~ /\G \b (qx) \b /oxgc) {
4848 0 my $ope = $1;
4849 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qx# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Elatin8::qq_char)*?) (\#) /cgox) { } 0 0 0
4850 0 $e_string .= e_qq($ope,$1,$3,$2);
4851 }
4852 else {
4853 0 my $e = '';
4854 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4855 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 (\') ((?:$Elatin8::qq_char)*?) (\') /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Elatin8::qq_char)*?) (\1) /cgox) { } 0 0 0
4856 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx ( )
4857 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx { }
4858 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx [ ]
4859 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx < >
4860 0 elsif ($string =~ /\G (\') ((?:$qq_char)*?) (\') /oxgc) { $e_string .= $e . e_q ($ope,$1,$3,$2); next E_STRING_LOOP; } # qx ' '
4861 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx * *
4862 }
4863 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4864 }
4865 }
4866  
4867 # q//
4868 elsif ($string =~ /\G \b (q) \b /oxgc) {
4869 0 my $ope = $1;
4870 0 ▶ if ($string =~ /\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { # q# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:\\\#|\\\\|$Elatin8::q_char)*?) (\#) /cgox) { } 0 0 0
4871 0 $e_string .= e_q($ope,$1,$3,$2);
4872 }
4873 else {
4874 0 my $e = '';
4875 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4876 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| $Elatin8::q_char)*?) (\1) /cgox) { } 0 0 0
4877 0 elsif ($string =~ /\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q ( )
4878 0 elsif ($string =~ /\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q { }
4879 0 elsif ($string =~ /\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q [ ]
4880 0 elsif ($string =~ /\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q < >
4881 0 elsif ($string =~ /\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q * *
4882 }
4883 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4884 }
4885 }
4886  
4887 # ''
4888 0 elsif ($string =~ /\G (?<![\w\$\@\%\&\*]) (\') ((?:\\\'|\\\\|$q_char)*?) (\') /oxgc) { $e_string .= e_q('',$1,$3,$2); }
4889  
4890 # ""
4891 0 elsif ($string =~ /\G (\") ((?:$qq_char)*?) (\") /oxgc) { $e_string .= e_qq('',$1,$3,$2); }
4892  
4893 # ``
4894 0 elsif ($string =~ /\G (\`) ((?:$qq_char)*?) (\`) /oxgc) { $e_string .= e_qq('',$1,$3,$2); }
4895  
4896 # <<>> (a safer ARGV)
4897 0 elsif ($string =~ /\G ( <<>> ) /oxgc) { $e_string .= $1; }
4898  
4899 # <<= <=> <= < operator
4900 0 elsif ($string =~ /\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/oxgc) { $e_string .= $1; }
4901  
4902 # <FILEHANDLE>
4903 0 elsif ($string =~ /\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /oxgc) { $e_string .= $1; }
4904  
4905 # <WILDCARD> --- glob
4906 elsif ($string =~ /\G < ((?:$q_char)+?) > /oxgc) {
4907 0 $e_string .= 'Elatin8::glob("' . $1 . '")';
4908 }
4909  
4910 # << (bit shift) --- not here document
4911 elsif ($string =~ /\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /oxgc) {
4912 0 $slash = 'm//';
4913 0 $e_string .= $1;
4914 }
4915  
4916 # <<~'HEREDOC'
4917 elsif ($string =~ /\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /oxgc) {
4918 0 $slash = 'm//';
4919 0 my $here_quote = $1;
4920 0 my $delimiter = $2;
4921  
4922 # get here document
4923 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4924 0 $here_script = CORE::substr $_, pos $_;
4925 0 $here_script =~ s/.*?\n//oxm;
4926 }
4927 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
4928 0 my $heredoc = $1;
4929 0 my $indent = $2;
4930 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4931 0 push @heredoc, $heredoc . qq{\n$delimiter\n};
4932 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4933 }
4934 else {
4935 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4936 }
4937 0 $e_string .= qq{<<'$delimiter'};
4938 }
4939  
4940 # <<~\HEREDOC
4941 elsif ($string =~ /\G ( <<~ \\([a-zA-Z_0-9]+) ) /oxgc) {
4942 0 $slash = 'm//';
4943 0 my $here_quote = $1;
4944 0 my $delimiter = $2;
4945  
4946 # get here document
4947 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4948 0 $here_script = CORE::substr $_, pos $_;
4949 0 $here_script =~ s/.*?\n//oxm;
4950 }
4951 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
4952 0 my $heredoc = $1;
4953 0 my $indent = $2;
4954 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4955 0 push @heredoc, $heredoc . qq{\n$delimiter\n};
4956 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4957 }
4958 else {
4959 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4960 }
4961 0 $e_string .= qq{<<\\$delimiter};
4962 }
4963  
4964 # <<~"HEREDOC"
4965 elsif ($string =~ /\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /oxgc) {
4966 0 $slash = 'm//';
4967 0 my $here_quote = $1;
4968 0 my $delimiter = $2;
4969  
4970 # get here document
4971 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4972 0 $here_script = CORE::substr $_, pos $_;
4973 0 $here_script =~ s/.*?\n//oxm;
4974 }
4975 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
4976 0 my $heredoc = $1;
4977 0 my $indent = $2;
4978 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4979 0 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4980 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4981 }
4982 else {
4983 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4984 }
4985 0 $e_string .= qq{<<"$delimiter"};
4986 }
4987  
4988 # <<~HEREDOC
4989 elsif ($string =~ /\G ( <<~ ([a-zA-Z_0-9]+) ) /oxgc) {
4990 0 $slash = 'm//';
4991 0 my $here_quote = $1;
4992 0 my $delimiter = $2;
4993  
4994 # get here document
4995 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4996 0 $here_script = CORE::substr $_, pos $_;
4997 0 $here_script =~ s/.*?\n//oxm;
4998 }
4999 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
5000 0 my $heredoc = $1;
5001 0 my $indent = $2;
5002 0 $heredoc =~ s{^$indent}{}msg; # no /ox
5003 0 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
5004 0 push @heredoc_delimiter, qq{\\s*$delimiter};
5005 }
5006 else {
5007 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5008 }
5009 0 $e_string .= qq{<<$delimiter};
5010 }
5011  
5012 # <<~`HEREDOC`
5013 elsif ($string =~ /\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /oxgc) {
5014 0 $slash = 'm//';
5015 0 my $here_quote = $1;
5016 0 my $delimiter = $2;
5017  
5018 # get here document
5019 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5020 0 $here_script = CORE::substr $_, pos $_;
5021 0 $here_script =~ s/.*?\n//oxm;
5022 }
5023 0 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 0 0 0
5024 0 my $heredoc = $1;
5025 0 my $indent = $2;
5026 0 $heredoc =~ s{^$indent}{}msg; # no /ox
5027 0 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
5028 0 push @heredoc_delimiter, qq{\\s*$delimiter};
5029 }
5030 else {
5031 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5032 }
5033 0 $e_string .= qq{<<`$delimiter`};
5034 }
5035  
5036 # <<'HEREDOC'
5037 elsif ($string =~ /\G ( << '([a-zA-Z_0-9]*)' ) /oxgc) {
5038 0 $slash = 'm//';
5039 0 my $here_quote = $1;
5040 0 my $delimiter = $2;
5041  
5042 # get here document
5043 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5044 0 $here_script = CORE::substr $_, pos $_;
5045 0 $here_script =~ s/.*?\n//oxm;
5046 }
5047 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
5048 0 push @heredoc, $1 . qq{\n$delimiter\n};
5049 0 push @heredoc_delimiter, $delimiter;
5050 }
5051 else {
5052 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5053 }
5054 0 $e_string .= $here_quote;
5055 }
5056  
5057 # <<\HEREDOC
5058 elsif ($string =~ /\G ( << \\([a-zA-Z_0-9]+) ) /oxgc) {
5059 0 $slash = 'm//';
5060 0 my $here_quote = $1;
5061 0 my $delimiter = $2;
5062  
5063 # get here document
5064 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5065 0 $here_script = CORE::substr $_, pos $_;
5066 0 $here_script =~ s/.*?\n//oxm;
5067 }
5068 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
5069 0 push @heredoc, $1 . qq{\n$delimiter\n};
5070 0 push @heredoc_delimiter, $delimiter;
5071 }
5072 else {
5073 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5074 }
5075 0 $e_string .= $here_quote;
5076 }
5077  
5078 # <<"HEREDOC"
5079 elsif ($string =~ /\G ( << "([a-zA-Z_0-9]*)" ) /oxgc) {
5080 0 $slash = 'm//';
5081 0 my $here_quote = $1;
5082 0 my $delimiter = $2;
5083  
5084 # get here document
5085 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5086 0 $here_script = CORE::substr $_, pos $_;
5087 0 $here_script =~ s/.*?\n//oxm;
5088 }
5089 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
5090 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
5091 0 push @heredoc_delimiter, $delimiter;
5092 }
5093 else {
5094 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5095 }
5096 0 $e_string .= $here_quote;
5097 }
5098  
5099 # <<HEREDOC
5100 elsif ($string =~ /\G ( << ([a-zA-Z_0-9]+) ) /oxgc) {
5101 0 $slash = 'm//';
5102 0 my $here_quote = $1;
5103 0 my $delimiter = $2;
5104  
5105 # get here document
5106 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5107 0 $here_script = CORE::substr $_, pos $_;
5108 0 $here_script =~ s/.*?\n//oxm;
5109 }
5110 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
5111 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
5112 0 push @heredoc_delimiter, $delimiter;
5113 }
5114 else {
5115 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5116 }
5117 0 $e_string .= $here_quote;
5118 }
5119  
5120 # <<`HEREDOC`
5121 elsif ($string =~ /\G ( << `([a-zA-Z_0-9]*)` ) /oxgc) {
5122 0 $slash = 'm//';
5123 0 my $here_quote = $1;
5124 0 my $delimiter = $2;
5125  
5126 # get here document
5127 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5128 0 $here_script = CORE::substr $_, pos $_;
5129 0 $here_script =~ s/.*?\n//oxm;
5130 }
5131 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
5132 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
5133 0 push @heredoc_delimiter, $delimiter;
5134 }
5135 else {
5136 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5137 }
5138 0 $e_string .= $here_quote;
5139 }
5140  
5141 # any operator before div
5142 elsif ($string =~ /\G (
5143 -- | \+\+ |
5144 [\)\}\]]
5145  
5146 18 ) /oxgc) { $slash = 'div'; $e_string .= $1; }
5147  
5148 # yada-yada or triple-dot operator
5149 elsif ($string =~ /\G (
5150 \.\.\.
5151  
5152 0 ) /oxgc) { $slash = 'm//'; $e_string .= q{die('Unimplemented')}; }
5153  
5154 # any operator before m//
5155 elsif ($string =~ /\G ((?>
5156  
5157 !~~ | !~ | != | ! |
5158 %= | % |
5159 &&= | && | &= | &\.= | &\. | & |
5160 -= | -> | - |
5161 :(?>\s*)= |
5162 : |
5163 <<>> |
5164 <<= | <=> | <= | < |
5165 == | => | =~ | = |
5166 >>= | >> | >= | > |
5167 \*\*= | \*\* | \*= | \* |
5168 \+= | \+ |
5169 \.\. | \.= | \. |
5170 \/\/= | \/\/ |
5171 \/= | \/ |
5172 \? |
5173 \\ |
5174 \^= | \^\.= | \^\. | \^ |
5175 \b x= |
5176 \|\|= | \|\| | \|= | \|\.= | \|\. | \| |
5177 ~~ | ~\. | ~ |
5178 \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b |
5179 \b(?: print )\b |
5180  
5181 [,;\(\{\[]
5182  
5183 31 )) /oxgc) { $slash = 'm//'; $e_string .= $1; }
5184  
5185 # other any character
5186 131 elsif ($string =~ /\G ($q_char) /oxgc) { $e_string .= $1; }
5187  
5188 # system error
5189 else {
5190 0 die __FILE__, ": Oops, this shouldn't happen!\n";
5191 }
5192 }
5193  
5194 17 return $e_string;
5195 }
5196  
5197 #
5198 # character class
5199 #
5200 1920 ▶sub character_class {
Subroutine character_class: called CC=3 SCAR=11.0
Pod undocumented
5201 1920 my($char,$modifier) = @_;
5202  
5203 1920 ▶ if ($char eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char eq '.') { } 52 1868 1920
5204 52 ▶ if ($modifier =~ /s/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/) { } 17 35 52
5205 17 return '${Elatin8::dot_s}';
5206 }
5207 else {
5208 35 return '${Elatin8::dot}';
5209 }
5210 }
5211 else {
5212 1868 return Elatin8::classic_character_class($char);
5213 }
5214 }
5215  
5216 #
5217 # escape capture ($1, $2, $3, ...)
5218 #
5219 212 ▶sub e_capture {
Subroutine e_capture: called CC=1 SCAR=0.0
Pod undocumented
5220  
5221 212 return join '', '${', $_[0], '}';
5222 }
5223  
5224 #
5225 # escape transliteration (tr/// or y///)
5226 #
5227 4 ▶sub e_tr {
Subroutine e_tr: called CC=5 SCAR=16.8
Pod undocumented
5228 4 my($variable,$charclass,$e,$charclass2,$modifier) = @_;
5229 4 my $e_tr = '';
5230 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
5231  
5232 4 $slash = 'div';
5233  
5234 # quote character class 1
5235 4 $charclass = q_tr($charclass);
5236  
5237 # quote character class 2
5238 4 $charclass2 = q_tr($charclass2);
5239  
5240 # /b /B modifier
5241 4 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) { } 0 4 4
5242 0 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq '') { } 0 0 0
5243 0 $e_tr = qq{tr$charclass$e$charclass2$modifier};
5244 }
5245 else {
5246 0 $e_tr = qq{$variable${bind_operator}tr$charclass$e$charclass2$modifier};
5247 }
5248 }
5249 else {
5250 4 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq '') { } 2 2 4
5251 2 $e_tr = qq{Elatin8::tr(\$_,' =~ ',$charclass,$e$charclass2,'$modifier')};
5252 }
5253 else {
5254 2 $e_tr = qq{Elatin8::tr($variable,'$bind_operator',$charclass,$e$charclass2,'$modifier')};
5255 }
5256 }
5257  
5258 # clear tr/// variable
5259 4 $tr_variable = '';
5260 4 $bind_operator = '';
5261  
5262 4 return $e_tr;
5263 }
5264  
5265 #
5266 # quote for escape transliteration (tr/// or y///)
5267 #
5268 8 ▶sub q_tr {
Subroutine q_tr: called CC=9 SCAR=40.6
Pod undocumented
5269 8 my($charclass) = @_;
5270  
5271 # quote character class
5272 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
5273 8 return e_q('', "'", "'", $charclass); # --> q' '
5274 }
5275 elsif ($charclass !~ /\//oxms) {
5276 0 return e_q('q', '/', '/', $charclass); # --> q/ /
5277 }
5278 elsif ($charclass !~ /\#/oxms) {
5279 0 return e_q('q', '#', '#', $charclass); # --> q# #
5280 }
5281 elsif ($charclass !~ /[\<\>]/oxms) {
5282 0 return e_q('q', '<', '>', $charclass); # --> q< >
5283 }
5284 elsif ($charclass !~ /[\(\)]/oxms) {
5285 0 return e_q('q', '(', ')', $charclass); # --> q( )
5286 }
5287 elsif ($charclass !~ /[\{\}]/oxms) {
5288 0 return e_q('q', '{', '}', $charclass); # --> q{ }
5289 }
5290 else {
5291 0 for my $char (qw( ! " $ % & * + . : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5292 0 ▶ if ($charclass !~ /\Q$char\E/xms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($charclass =~ /\Q$char\E/msx) 0 0 0
5293 0 return e_q('q', $char, $char, $charclass);
5294 }
5295 }
5296 }
5297  
5298 0 return e_q('q', '{', '}', $charclass);
5299 }
5300  
5301 #
5302 # escape q string (q//, '')
5303 #
5304 1623 ▶sub e_q {
Subroutine e_q: called CC=1 SCAR=0.0
Pod undocumented
5305 1623 my($ope,$delimiter,$end_delimiter,$string) = @_;
5306  
5307 1623 $slash = 'div';
5308  
5309 1623 return join '', $ope, $delimiter, $string, $end_delimiter;
5310 }
5311  
5312 #
5313 # escape qq string (qq//, "", qx//, ``)
5314 #
5315 4279 ▶sub e_qq {
Subroutine e_qq: called CC=37 SCAR=50.9
Pod undocumented
5316 4279 my($ope,$delimiter,$end_delimiter,$string) = @_;
5317  
5318 4279 $slash = 'div';
5319  
5320 4279 my $left_e = 0;
5321 4279 my $right_e = 0;
5322  
5323 # split regexp
5324 4279 my @char = $string =~ /\G((?>
5325 [^\\\$] |
5326 \\x\{ (?>[0-9A-Fa-f]+) \} |
5327 \\o\{ (?>[0-7]+) \} |
5328 \\N\{ (?>[^0-9\}][^\}]*) \} |
5329 \\ $q_char |
5330 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5331 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5332 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5333 \$ (?>\s* [0-9]+) |
5334 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5335 \$ \$ (?![\w\{]) |
5336 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5337 $q_char
5338 ))/oxmsg;
5339  
5340 4279 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 116845 4279 121124
5341  
5342 # "\L\u" --> "\u\L"
5343 116845 ▶ 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 116845 116845
elsif ($char[$i] eq '\\U' and $char[$i + 1] eq '\\l') { } 0 116845 116845
elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/mosx) { } 1 116844 116845
elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/mosx) { } 1 116843 116844
elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/mosx) { } 0 116843 116843
Condition33%1/3
$char[$i] eq "\\L" and $char[$i + 1] eq "\\u"
!ll&&!rl&&r
11684500
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
5344 0 @char[$i,$i+1] = @char[$i+1,$i];
5345 }
5346  
5347 # "\U\l" --> "\l\U"
5348 ▶ 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
11684500
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
5349 0 @char[$i,$i+1] = @char[$i+1,$i];
5350 }
5351  
5352 # octal escape sequence
5353 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5354 1 $char[$i] = Elatin8::octchr($1);
5355 }
5356  
5357 # hexadecimal escape sequence
5358 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5359 1 $char[$i] = Elatin8::hexchr($1);
5360 }
5361  
5362 # \N{CHARNAME} --> N{CHARNAME}
5363 elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5364 0 $char[$i] = $1;
5365 }
5366  
5367 116845 ▶ if (0) {
Branch: 23 branches
BranchTrueFalseTotal
if (do { $char[$i] =~ /\A ([<>]) \z/mosx }) { } 484 116361 116845
elsif ($char[$i] eq '\\u') { } 0 116361 116361
elsif ($char[$i] eq '\\l') { } 0 116361 116361
elsif ($char[$i] eq '\\U') { } 0 116361 116361
elsif ($char[$i] eq '\\L') { } 0 116361 116361
elsif ($char[$i] eq '\\F') { } 24 116337 116361
elsif ($char[$i] eq '\\Q') { } 0 116337 116337
elsif ($char[$i] eq '\\E') { } 24 116313 116337
elsif ($char[$i] eq '\\Q') { } 0 116313 116313
elsif ($char[$i] eq '\\E') { } 0 116313 116313
elsif ($char[$i] =~ /\A \$ 0 \z/mosx) { } 4 116309 116313
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/mosx) { } 0 116309 116309
elsif ($char[$i] =~ /\A \$\$ \z/mosx) { } 0 116309 116309
elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/mosx) { } 205 116104 116309
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/mosx) { } 0 116104 116104
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/mosx) { } 0 116104 116104
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/mosx) { } 0 116104 116104
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/mosx) { } 0 116104 116104
elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/cgmosx) { } 44 116060 116104
elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/cgmosx) { } 45 116015 116060
elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/cgmosx) { } 33 115982 116015
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/mosx) { } 0 115982 115982
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/mosx) { } 0 115982 115982
5368 }
5369  
5370 # \F
5371 #
5372 # P.69 Table 2-6. Translation escapes
5373 # in Chapter 2: Bits and Pieces
5374 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
5375 # (and so on)
5376  
5377 # \u \l \U \L \F \Q \E
5378 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
5379 484 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 484 484
5380 0 $char[$i] = '\\' . $char[$i];
5381 }
5382 }
5383 elsif ($char[$i] eq '\u') {
5384  
5385 # "STRING @{[ LIST EXPR ]} MORE STRING"
5386  
5387 # P.257 Other Tricks You Can Do with Hard References
5388 # in Chapter 8: References
5389 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
5390  
5391 # P.353 Other Tricks You Can Do with Hard References
5392 # in Chapter 8: References
5393 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
5394  
5395 # (and so on)
5396  
5397 0 $char[$i] = '@{[Elatin8::ucfirst qq<';
5398 0 $left_e++;
5399 }
5400 elsif ($char[$i] eq '\l') {
5401 0 $char[$i] = '@{[Elatin8::lcfirst qq<';
5402 0 $left_e++;
5403 }
5404 elsif ($char[$i] eq '\U') {
5405 0 $char[$i] = '@{[Elatin8::uc qq<';
5406 0 $left_e++;
5407 }
5408 elsif ($char[$i] eq '\L') {
5409 0 $char[$i] = '@{[Elatin8::lc qq<';
5410 0 $left_e++;
5411 }
5412 elsif ($char[$i] eq '\F') {
5413 24 $char[$i] = '@{[Elatin8::fc qq<';
5414 24 $left_e++;
5415 }
5416 elsif ($char[$i] eq '\Q') {
5417 0 $char[$i] = '@{[CORE::quotemeta qq<';
5418 0 $left_e++;
5419 }
5420 elsif ($char[$i] eq '\E') {
5421 24 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 24 0 24
5422 24 $char[$i] = '>]}';
5423 24 $right_e++;
5424 }
5425 else {
5426 0 $char[$i] = '';
5427 }
5428 }
5429 elsif ($char[$i] eq '\Q') {
5430 0 while (1) {
5431 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5432 0 last;
5433 }
5434 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
5435 0 last;
5436 }
5437 }
5438 }
5439 elsif ($char[$i] eq '\E') {
5440 }
5441  
5442 # $0 --> $0
5443 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
5444 }
5445 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
5446 }
5447  
5448 # $$ --> $$
5449 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
5450 }
5451  
5452 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
5453 # $1, $2, $3 --> $1, $2, $3 otherwise
5454 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
5455 205 $char[$i] = e_capture($1);
5456 }
5457 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
5458 0 $char[$i] = e_capture($1);
5459 }
5460  
5461 # $$foo[ ... ] --> $ $foo->[ ... ]
5462 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
5463 0 $char[$i] = e_capture($1.'->'.$2);
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_brace)*? \} ) \z/oxms) {
5468 0 $char[$i] = e_capture($1.'->'.$2);
5469 }
5470  
5471 # $$foo
5472 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
5473 0 $char[$i] = e_capture($1);
5474 }
5475  
5476 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin8::PREMATCH()
5477 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
5478 44 $char[$i] = '@{[Elatin8::PREMATCH()]}';
5479 }
5480  
5481 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin8::MATCH()
5482 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
5483 45 $char[$i] = '@{[Elatin8::MATCH()]}';
5484 }
5485  
5486 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin8::POSTMATCH()
5487 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
5488 33 $char[$i] = '@{[Elatin8::POSTMATCH()]}';
5489 }
5490  
5491 # ${ foo } --> ${ foo }
5492 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/oxms) {
5493 }
5494  
5495 # ${ ... }
5496 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5497 0 $char[$i] = e_capture($1);
5498 }
5499 }
5500  
5501 # return string
5502 4279 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 4279 4279
5503 0 return join '', $ope, $delimiter, @char, '>]}' x ($left_e - $right_e), $end_delimiter;
5504 }
5505 4279 return join '', $ope, $delimiter, @char, $end_delimiter;
5506 }
5507  
5508 #
5509 # escape qw string (qw//)
5510 #
5511 16 ▶sub e_qw {
Subroutine e_qw: called CC=11 SCAR=43.1
Pod undocumented
5512 16 my($ope,$delimiter,$end_delimiter,$string) = @_;
5513  
5514 16 $slash = 'div';
5515  
5516 # choice again delimiter
5517 16 my %octet = map {$_ => 1} ($string =~ /\G ([\x00-\xFF]) /oxmsg);
5518 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
5519 16 return join '', $ope, $delimiter, $string, $end_delimiter;
5520 }
5521 elsif (not $octet{')'}) {
5522 0 return join '', $ope, '(', $string, ')';
5523 }
5524 elsif (not $octet{'}'}) {
5525 0 return join '', $ope, '{', $string, '}';
5526 }
5527 elsif (not $octet{']'}) {
5528 0 return join '', $ope, '[', $string, ']';
5529 }
5530 elsif (not $octet{'>'}) {
5531 0 return join '', $ope, '<', $string, '>';
5532 }
5533 else {
5534 0 for my $char (qw( ! " $ % & * + - . / : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5535 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5536 0 return join '', $ope, $char, $string, $char;
5537 }
5538 }
5539 }
5540  
5541 # qw/AAA BBB C'CC/ --> ('AAA', 'BBB', 'C\'CC')
5542 0 my @string = CORE::split(/\s+/, $string);
5543 0 for my $string (@string) {
5544 0 my @octet = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5545 0 for my $octet (@octet) {
5546 0 ▶ if ($octet =~ /\A (['\\]) \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($octet =~ /\A (['\\]) \z/mosx) 0 0 0
5547 0 $octet = '\\' . $1;
5548 }
5549 }
5550 0 $string = join '', @octet;
5551 }
5552 0 return join '', '(', (join ', ', map { "'$_'" } @string), ')';
5553 }
5554  
5555 #
5556 # escape here document (<<"HEREDOC", <<HEREDOC, <<`HEREDOC`, <<~"HEREDOC", <<~HEREDOC, <<~`HEREDOC`)
5557 #
5558 93 ▶sub e_heredoc {
Subroutine e_heredoc: called CC=37 SCAR=56.3
Pod undocumented
5559 93 my($string) = @_;
5560  
5561 93 $slash = 'm//';
5562  
5563 93 my $metachar = qr/[\@\\|]/oxms; # '|' is for <<`HEREDOC`
5564  
5565 93 my $left_e = 0;
5566 93 my $right_e = 0;
5567  
5568 # split regexp
5569 93 my @char = $string =~ /\G((?>
5570 [^\\\$] |
5571 \\x\{ (?>[0-9A-Fa-f]+) \} |
5572 \\o\{ (?>[0-7]+) \} |
5573 \\N\{ (?>[^0-9\}][^\}]*) \} |
5574 \\ $q_char |
5575 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5576 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5577 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5578 \$ (?>\s* [0-9]+) |
5579 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5580 \$ \$ (?![\w\{]) |
5581 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5582 $q_char
5583 ))/oxmsg;
5584  
5585 93 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 3177 93 3270
5586  
5587 # "\L\u" --> "\u\L"
5588 3177 ▶ 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 3177 3177
elsif ($char[$i] eq '\\U' and $char[$i + 1] eq '\\l') { } 0 3177 3177
elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/mosx) { } 1 3176 3177
elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/mosx) { } 1 3175 3176
elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/mosx) { } 0 3175 3175
Condition33%1/3
$char[$i] eq "\\L" and $char[$i + 1] eq "\\u"
!ll&&!rl&&r
317700
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
5589 0 @char[$i,$i+1] = @char[$i+1,$i];
5590 }
5591  
5592 # "\U\l" --> "\l\U"
5593 ▶ 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
317700
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
5594 0 @char[$i,$i+1] = @char[$i+1,$i];
5595 }
5596  
5597 # octal escape sequence
5598 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5599 1 $char[$i] = Elatin8::octchr($1);
5600 }
5601  
5602 # hexadecimal escape sequence
5603 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5604 1 $char[$i] = Elatin8::hexchr($1);
5605 }
5606  
5607 # \N{CHARNAME} --> N{CHARNAME}
5608 elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5609 0 $char[$i] = $1;
5610 }
5611  
5612 3177 ▶ if (0) {
Branch: 23 branches
BranchTrueFalseTotal
if (do { $char[$i] =~ /\A ([<>]) \z/mosx }) { } 0 3177 3177
elsif ($char[$i] eq '\\u') { } 0 3177 3177
elsif ($char[$i] eq '\\l') { } 0 3177 3177
elsif ($char[$i] eq '\\U') { } 0 3177 3177
elsif ($char[$i] eq '\\L') { } 0 3177 3177
elsif ($char[$i] eq '\\F') { } 0 3177 3177
elsif ($char[$i] eq '\\Q') { } 0 3177 3177
elsif ($char[$i] eq '\\E') { } 0 3177 3177
elsif ($char[$i] eq '\\Q') { } 0 3177 3177
elsif ($char[$i] eq '\\E') { } 0 3177 3177
elsif ($char[$i] =~ /\A \$ 0 \z/mosx) { } 0 3177 3177
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/mosx) { } 0 3177 3177
elsif ($char[$i] =~ /\A \$\$ \z/mosx) { } 0 3177 3177
elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/mosx) { } 0 3177 3177
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/mosx) { } 0 3177 3177
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/mosx) { } 0 3177 3177
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/mosx) { } 0 3177 3177
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/mosx) { } 0 3177 3177
elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/cgmosx) { } 8 3169 3177
elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/cgmosx) { } 8 3161 3169
elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/cgmosx) { } 6 3155 3161
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/mosx) { } 0 3155 3155
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/mosx) { } 0 3155 3155
5613 }
5614  
5615 # \u \l \U \L \F \Q \E
5616 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
5617 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
5618 0 $char[$i] = '\\' . $char[$i];
5619 }
5620 }
5621 elsif ($char[$i] eq '\u') {
5622 0 $char[$i] = '@{[Elatin8::ucfirst qq<';
5623 0 $left_e++;
5624 }
5625 elsif ($char[$i] eq '\l') {
5626 0 $char[$i] = '@{[Elatin8::lcfirst qq<';
5627 0 $left_e++;
5628 }
5629 elsif ($char[$i] eq '\U') {
5630 0 $char[$i] = '@{[Elatin8::uc qq<';
5631 0 $left_e++;
5632 }
5633 elsif ($char[$i] eq '\L') {
5634 0 $char[$i] = '@{[Elatin8::lc qq<';
5635 0 $left_e++;
5636 }
5637 elsif ($char[$i] eq '\F') {
5638 0 $char[$i] = '@{[Elatin8::fc qq<';
5639 0 $left_e++;
5640 }
5641 elsif ($char[$i] eq '\Q') {
5642 0 $char[$i] = '@{[CORE::quotemeta qq<';
5643 0 $left_e++;
5644 }
5645 elsif ($char[$i] eq '\E') {
5646 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
5647 0 $char[$i] = '>]}';
5648 0 $right_e++;
5649 }
5650 else {
5651 0 $char[$i] = '';
5652 }
5653 }
5654 elsif ($char[$i] eq '\Q') {
5655 0 while (1) {
5656 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5657 0 last;
5658 }
5659 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
5660 0 last;
5661 }
5662 }
5663 }
5664 elsif ($char[$i] eq '\E') {
5665 }
5666  
5667 # $0 --> $0
5668 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
5669 }
5670 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
5671 }
5672  
5673 # $$ --> $$
5674 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
5675 }
5676  
5677 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
5678 # $1, $2, $3 --> $1, $2, $3 otherwise
5679 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
5680 0 $char[$i] = e_capture($1);
5681 }
5682 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
5683 0 $char[$i] = e_capture($1);
5684 }
5685  
5686 # $$foo[ ... ] --> $ $foo->[ ... ]
5687 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
5688 0 $char[$i] = e_capture($1.'->'.$2);
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_brace)*? \} ) \z/oxms) {
5693 0 $char[$i] = e_capture($1.'->'.$2);
5694 }
5695  
5696 # $$foo
5697 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
5698 0 $char[$i] = e_capture($1);
5699 }
5700  
5701 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin8::PREMATCH()
5702 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
5703 8 $char[$i] = '@{[Elatin8::PREMATCH()]}';
5704 }
5705  
5706 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin8::MATCH()
5707 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
5708 8 $char[$i] = '@{[Elatin8::MATCH()]}';
5709 }
5710  
5711 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin8::POSTMATCH()
5712 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
5713 6 $char[$i] = '@{[Elatin8::POSTMATCH()]}';
5714 }
5715  
5716 # ${ foo } --> ${ foo }
5717 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/oxms) {
5718 }
5719  
5720 # ${ ... }
5721 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5722 0 $char[$i] = e_capture($1);
5723 }
5724 }
5725  
5726 # return string
5727 93 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 93 93
5728 0 return join '', @char, '>]}' x ($left_e - $right_e);
5729 }
5730 93 return join '', @char;
5731 }
5732  
5733 #
5734 # escape regexp (m//, qr//)
5735 #
5736 880 ▶sub e_qr {
Subroutine e_qr: called CC=110 SCAR=73.6
Pod undocumented
5737 880 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5738 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
5739  
5740 880 $modifier =~ tr/p//d;
5741 880 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 880 880
5742 0 my $line = 0;
5743 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
5744 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
5745 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
5746 0 last;
5747 }
5748 }
5749 0 die qq{Unsupported modifier "$1" used at line $line.\n};
5750 }
5751  
5752 880 $slash = 'div';
5753  
5754 # literal null string pattern
5755 880 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 872 880
elsif ($modifier =~ tr/Bb//d) { } 2 870 872
5756 8 $modifier =~ tr/bB//d;
5757 8 $modifier =~ tr/i//d;
5758 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
5759 }
5760  
5761 # /b /B modifier
5762 elsif ($modifier =~ tr/bB//d) {
5763  
5764 # choice again delimiter
5765 2 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 2 2
5766 0 my @char = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5767 0 my %octet = map {$_ => 1} @char;
5768 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
5769 0 $delimiter = '(';
5770 0 $end_delimiter = ')';
5771 }
5772 elsif (not $octet{'}'}) {
5773 0 $delimiter = '{';
5774 0 $end_delimiter = '}';
5775 }
5776 elsif (not $octet{']'}) {
5777 0 $delimiter = '[';
5778 0 $end_delimiter = ']';
5779 }
5780 elsif (not $octet{'>'}) {
5781 0 $delimiter = '<';
5782 0 $end_delimiter = '>';
5783 }
5784 else {
5785 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5786 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5787 0 $delimiter = $char;
5788 0 $end_delimiter = $char;
5789 0 last;
5790 }
5791 }
5792 }
5793 }
5794  
5795 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
5796 0 return join '', $ope, $delimiter, $string, $matched, $end_delimiter, $modifier;
5797 }
5798 else {
5799 2 return join '', $ope, $delimiter, '(?:', $string, ')', $matched, $end_delimiter, $modifier;
5800 }
5801 }
5802  
5803 870 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 312 558 870
5804 870 my $metachar = qr/[\@\\|[\]{^]/oxms;
5805  
5806 # split regexp
5807 870 my @char = $string =~ /\G((?>
5808 [^\\\$\@\[\(] |
5809 \\x (?>[0-9A-Fa-f]{1,2}) |
5810 \\ (?>[0-7]{2,3}) |
5811 \\c [\x40-\x5F] |
5812 \\x\{ (?>[0-9A-Fa-f]+) \} |
5813 \\o\{ (?>[0-7]+) \} |
5814 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
5815 \\ $q_char |
5816 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5817 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5818 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5819 [\$\@] $qq_variable |
5820 \$ (?>\s* [0-9]+) |
5821 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5822 \$ \$ (?![\w\{]) |
5823 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5824 \[\^ |
5825 \[\: (?>[a-z]+) :\] |
5826 \[\:\^ (?>[a-z]+) :\] |
5827 \(\? |
5828 $q_char
5829 ))/oxmsg;
5830  
5831 # choice again delimiter
5832 870 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 870 870
5833 0 my %octet = map {$_ => 1} @char;
5834 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
5835 0 $delimiter = '(';
5836 0 $end_delimiter = ')';
5837 }
5838 elsif (not $octet{'}'}) {
5839 0 $delimiter = '{';
5840 0 $end_delimiter = '}';
5841 }
5842 elsif (not $octet{']'}) {
5843 0 $delimiter = '[';
5844 0 $end_delimiter = ']';
5845 }
5846 elsif (not $octet{'>'}) {
5847 0 $delimiter = '<';
5848 0 $end_delimiter = '>';
5849 }
5850 else {
5851 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5852 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5853 0 $delimiter = $char;
5854 0 $end_delimiter = $char;
5855 0 last;
5856 }
5857 }
5858 }
5859 }
5860  
5861 870 my $left_e = 0;
5862 870 my $right_e = 0;
5863 870 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 2100 870 2970
5864  
5865 # "\L\u" --> "\u\L"
5866 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
5867 0 @char[$i,$i+1] = @char[$i+1,$i];
5868 }
5869  
5870 # "\U\l" --> "\l\U"
5871 ▶ 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
5872 0 @char[$i,$i+1] = @char[$i+1,$i];
5873 }
5874  
5875 # octal escape sequence
5876 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5877 1 $char[$i] = Elatin8::octchr($1);
5878 }
5879  
5880 # hexadecimal escape sequence
5881 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5882 1 $char[$i] = Elatin8::hexchr($1);
5883 }
5884  
5885 # \b{...} --> b\{...}
5886 # \B{...} --> B\{...}
5887 # \N{CHARNAME} --> N\{CHARNAME}
5888 # \p{PROPERTY} --> p\{PROPERTY}
5889 # \P{PROPERTY} --> P\{PROPERTY}
5890 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5891 6 $char[$i] = $1 . '\\' . $2;
5892 }
5893  
5894 # \p, \P, \X --> p, P, X
5895 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
5896 4 $char[$i] = $1;
5897 }
5898  
5899 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 &Elatin8::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
5900 }
5901  
5902 # join separated multiple-octet
5903 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
5904 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 $Elatin8::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 $Elatin8::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 $Elatin8::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 $Elatin8::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 $Elatin8::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 $Elatin8::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 $Elatin8::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5905 0 $char[$i] .= join '', splice @char, $i+1, 3;
5906 }
5907 ▶ 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 $Elatin8::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 $Elatin8::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 $Elatin8::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 $Elatin8::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5908 0 $char[$i] .= join '', splice @char, $i+1, 2;
5909 }
5910 ▶ 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 $Elatin8::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 $Elatin8::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 $Elatin8::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 $Elatin8::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5911 0 $char[$i] .= join '', splice @char, $i+1, 1;
5912 }
5913 }
5914  
5915 # open character class [...]
5916 elsif ($char[$i] eq '[') {
5917 556 my $left = $i;
5918  
5919 # [] make die "Unmatched [] in regexp ...\n"
5920 # (and so on)
5921  
5922 556 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 3 553 556
5923 3 $i++;
5924 }
5925  
5926 556 while (1) {
5927 2063 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 2063 2063
5928 0 die __FILE__, ": Unmatched [] in regexp\n";
5929 }
5930 2063 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 556 1507 2063
5931 556 my $right = $i;
5932  
5933 # [...]
5934 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
5935 30 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin8::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
5936 }
5937 else {
5938 526 splice @char, $left, $right-$left+1, Elatin8::charlist_qr(@char[$left+1..$right-1], $modifier);
5939 }
5940  
5941 556 $i = $left;
5942 556 last;
5943 }
5944 }
5945 }
5946  
5947 # open character class [^...]
5948 elsif ($char[$i] eq '[^') {
5949 74 my $left = $i;
5950  
5951 # [^] make die "Unmatched [] in regexp ...\n"
5952 # (and so on)
5953  
5954 74 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 4 70 74
5955 4 $i++;
5956 }
5957  
5958 74 while (1) {
5959 272 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 272 272
5960 0 die __FILE__, ": Unmatched [] in regexp\n";
5961 }
5962 272 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 74 198 272
5963 74 my $right = $i;
5964  
5965 # [^...]
5966 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
5967 30 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin8::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
5968 }
5969 else {
5970 44 splice @char, $left, $right-$left+1, Elatin8::charlist_not_qr(@char[$left+1..$right-1], $modifier);
5971 }
5972  
5973 74 $i = $left;
5974 74 last;
5975 }
5976 }
5977 }
5978  
5979 # rewrite character class or escape character
5980 elsif (my $char = character_class($char[$i],$modifier)) {
5981 139 $char[$i] = $char;
5982 }
5983  
5984 # /i modifier
5985 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin8::uc($char[$i]) ne Elatin8::fc($char[$i]))) {
Condition100%6/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin8::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 &Elatin8::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin8::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= &Elatin8::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
5986 20 ▶ if (CORE::length(Elatin8::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 20 0 20
5987 20 $char[$i] = '[' . Elatin8::uc($char[$i]) . Elatin8::fc($char[$i]) . ']';
5988 }
5989 else {
5990 0 $char[$i] = '(?:' . Elatin8::uc($char[$i]) . '|' . Elatin8::fc($char[$i]) . ')';
5991 }
5992 }
5993  
5994 # \u \l \U \L \F \Q \E
5995 elsif ($char[$i] =~ /\A [<>] \z/oxms) {
5996 1 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 1 1
5997 0 $char[$i] = '\\' . $char[$i];
5998 }
5999 }
6000 elsif ($char[$i] eq '\u') {
6001 0 $char[$i] = '@{[Elatin8::ucfirst qq<';
6002 0 $left_e++;
6003 }
6004 elsif ($char[$i] eq '\l') {
6005 0 $char[$i] = '@{[Elatin8::lcfirst qq<';
6006 0 $left_e++;
6007 }
6008 elsif ($char[$i] eq '\U') {
6009 1 $char[$i] = '@{[Elatin8::uc qq<';
6010 1 $left_e++;
6011 }
6012 elsif ($char[$i] eq '\L') {
6013 1 $char[$i] = '@{[Elatin8::lc qq<';
6014 1 $left_e++;
6015 }
6016 elsif ($char[$i] eq '\F') {
6017 18 $char[$i] = '@{[Elatin8::fc qq<';
6018 18 $left_e++;
6019 }
6020 elsif ($char[$i] eq '\Q') {
6021 1 $char[$i] = '@{[CORE::quotemeta qq<';
6022 1 $left_e++;
6023 }
6024 elsif ($char[$i] eq '\E') {
6025 21 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 21 0 21
6026 21 $char[$i] = '>]}';
6027 21 $right_e++;
6028 }
6029 else {
6030 0 $char[$i] = '';
6031 }
6032 }
6033 elsif ($char[$i] eq '\Q') {
6034 0 while (1) {
6035 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6036 0 last;
6037 }
6038 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
6039 0 last;
6040 }
6041 }
6042 }
6043 elsif ($char[$i] eq '\E') {
6044 }
6045  
6046 # $0 --> $0
6047 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
6048 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6049 0 $char[$i] = '@{[Elatin8::ignorecase(' . $char[$i] . ')]}';
6050 }
6051 }
6052 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
6053 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6054 0 $char[$i] = '@{[Elatin8::ignorecase(' . $char[$i] . ')]}';
6055 }
6056 }
6057  
6058 # $$ --> $$
6059 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
6060 }
6061  
6062 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
6063 # $1, $2, $3 --> $1, $2, $3 otherwise
6064 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
6065 0 $char[$i] = e_capture($1);
6066 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6067 0 $char[$i] = '@{[Elatin8::ignorecase(' . $char[$i] . ')]}';
6068 }
6069 }
6070 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6071 0 $char[$i] = e_capture($1);
6072 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6073 0 $char[$i] = '@{[Elatin8::ignorecase(' . $char[$i] . ')]}';
6074 }
6075 }
6076  
6077 # $$foo[ ... ] --> $ $foo->[ ... ]
6078 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
6079 0 $char[$i] = e_capture($1.'->'.$2);
6080 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6081 0 $char[$i] = '@{[Elatin8::ignorecase(' . $char[$i] . ')]}';
6082 }
6083 }
6084  
6085 # $$foo{ ... } --> $ $foo->{ ... }
6086 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
6087 0 $char[$i] = e_capture($1.'->'.$2);
6088 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6089 0 $char[$i] = '@{[Elatin8::ignorecase(' . $char[$i] . ')]}';
6090 }
6091 }
6092  
6093 # $$foo
6094 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
6095 0 $char[$i] = e_capture($1);
6096 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6097 0 $char[$i] = '@{[Elatin8::ignorecase(' . $char[$i] . ')]}';
6098 }
6099 }
6100  
6101 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin8::PREMATCH()
6102 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
6103 8 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 8 8
6104 0 $char[$i] = '@{[Elatin8::ignorecase(Elatin8::PREMATCH())]}';
6105 }
6106 else {
6107 8 $char[$i] = '@{[Elatin8::PREMATCH()]}';
6108 }
6109 }
6110  
6111 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin8::MATCH()
6112 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
6113 8 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 8 8
6114 0 $char[$i] = '@{[Elatin8::ignorecase(Elatin8::MATCH())]}';
6115 }
6116 else {
6117 8 $char[$i] = '@{[Elatin8::MATCH()]}';
6118 }
6119 }
6120  
6121 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin8::POSTMATCH()
6122 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
6123 6 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 6 6
6124 0 $char[$i] = '@{[Elatin8::ignorecase(Elatin8::POSTMATCH())]}';
6125 }
6126 else {
6127 6 $char[$i] = '@{[Elatin8::POSTMATCH()]}';
6128 }
6129 }
6130  
6131 # ${ foo }
6132 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
6133 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6134 0 $char[$i] = '@{[Elatin8::ignorecase(' . $char[$i] . ')]}';
6135 }
6136 }
6137  
6138 # ${ ... }
6139 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
6140 0 $char[$i] = e_capture($1);
6141 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6142 0 $char[$i] = '@{[Elatin8::ignorecase(' . $char[$i] . ')]}';
6143 }
6144 }
6145  
6146 # $scalar or @array
6147 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
6148 21 $char[$i] = e_string($char[$i]);
6149 21 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 11 10 21
6150 11 $char[$i] = '@{[Elatin8::ignorecase(' . $char[$i] . ')]}';
6151 }
6152 }
6153  
6154 # quote character before ? + * {
6155 ▶ 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
6156 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
6157 }
6158 ▶ 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
6159 0 my $char = $char[$i-1];
6160 0 ▶ if ($char[$i] eq '{') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq '{') { } 0 0 0
6161 0 die __FILE__, qq{: "MULTIBYTE{n}" should be "(MULTIBYTE){n}" in m?? (and shift \$1,\$2,\$3,...) ($char){n}\n};
6162 }
6163 else {
6164 0 die __FILE__, qq{: "MULTIBYTE$char[$i]" should be "(MULTIBYTE)$char[$i]" in m?? (and shift \$1,\$2,\$3,...) ($char)$char[$i]\n};
6165 }
6166 }
6167 else {
6168 127 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6169 }
6170 }
6171 }
6172  
6173 # make regexp string
6174 870 $modifier =~ tr/i//d;
6175 870 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 870 870
6176 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
6177 0 return join '', $ope, $delimiter, $anchor, @char, '>]}' x ($left_e - $right_e), $matched, $end_delimiter, $modifier;
6178 }
6179 else {
6180 0 return join '', $ope, $delimiter, $anchor, '(?:', @char, '>]}' x ($left_e - $right_e), ')', $matched, $end_delimiter, $modifier;
6181 }
6182 }
6183 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
6184 0 return join '', $ope, $delimiter, $anchor, @char, $matched, $end_delimiter, $modifier;
6185 }
6186 else {
6187 870 return join '', $ope, $delimiter, $anchor, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6188 }
6189 }
6190  
6191 #
6192 # double quote stuff
6193 #
6194 180 ▶sub qq_stuff {
Subroutine qq_stuff: called CC=6 SCAR=18.5
Pod undocumented
6195 180 my($delimiter,$end_delimiter,$stuff) = @_;
6196  
6197 # scalar variable or array variable
6198 180 ▶ if ($stuff =~ /\A [\$\@] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($stuff =~ /\A [\$\@] /mosx) 100 80 180
6199 100 return $stuff;
6200 }
6201  
6202 # quote by delimiter
6203 80 my %octet = map {$_ => 1} ($stuff =~ /\G ([\x00-\xFF]) /oxmsg);
6204 80 for my $char (qw( ! " $ % & * + - . / : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
6205 80 ▶ next if $char eq $delimiter;
Branch: 1 branch
BranchTrueFalseTotal
if $char eq $delimiter 0 80 80
6206 80 ▶ next if $char eq $end_delimiter;
Branch: 1 branch
BranchTrueFalseTotal
if $char eq $end_delimiter 0 80 80
6207 80 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 80 0 80
6208 80 return join '', 'qq', $char, $stuff, $char;
6209 }
6210 }
6211 0 return join '', 'qq', '<', $stuff, '>';
6212 }
6213  
6214 #
6215 # escape regexp (m'', qr'', and m''b, qr''b)
6216 #
6217 10 ▶sub e_qr_q {
Subroutine e_qr_q: called CC=7 SCAR=25.3
Pod undocumented
6218 10 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6219 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
6220  
6221 10 $modifier =~ tr/p//d;
6222 10 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 10 10
6223 0 my $line = 0;
6224 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6225 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6226 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6227 0 last;
6228 }
6229 }
6230 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6231 }
6232  
6233 10 $slash = 'div';
6234  
6235 # literal null string pattern
6236 10 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 2 10
elsif ($modifier =~ tr/Bb//d) { } 0 2 2
6237 8 $modifier =~ tr/bB//d;
6238 8 $modifier =~ tr/i//d;
6239 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
6240 }
6241  
6242 # with /b /B modifier
6243 elsif ($modifier =~ tr/bB//d) {
6244 0 return e_qr_qb($ope,$delimiter,$end_delimiter,$string,$modifier);
6245 }
6246  
6247 # without /b /B modifier
6248 else {
6249 2 return e_qr_qt($ope,$delimiter,$end_delimiter,$string,$modifier);
6250 }
6251 }
6252  
6253 #
6254 # escape regexp (m'', qr'')
6255 #
6256 2 ▶sub e_qr_qt {
Subroutine e_qr_qt: called CC=20 SCAR=51.8
Pod undocumented
6257 2 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6258  
6259 2 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 2 2
6260  
6261 # split regexp
6262 2 my @char = $string =~ /\G((?>
6263 [^\\\[\$\@\/] |
6264 [\x00-\xFF] |
6265 \[\^ |
6266 \[\: (?>[a-z]+) \:\] |
6267 \[\:\^ (?>[a-z]+) \:\] |
6268 [\$\@\/] |
6269 \\ (?:$q_char) |
6270 (?:$q_char)
6271 ))/oxmsg;
6272  
6273 # unescape character
6274 2 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 2 2 4
6275 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 &Elatin8::uc($char[$i]) ne &fc($char[$i])) { } 0 2 2
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 4 4
6276 }
6277  
6278 # open character class [...]
6279 elsif ($char[$i] eq '[') {
6280 0 my $left = $i;
6281 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6282 0 $i++;
6283 }
6284 0 while (1) {
6285 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6286 0 die __FILE__, ": Unmatched [] in regexp\n";
6287 }
6288 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6289 0 my $right = $i;
6290  
6291 # [...]
6292 0 splice @char, $left, $right-$left+1, Elatin8::charlist_qr(@char[$left+1..$right-1], $modifier);
6293  
6294 0 $i = $left;
6295 0 last;
6296 }
6297 }
6298 }
6299  
6300 # open character class [^...]
6301 elsif ($char[$i] eq '[^') {
6302 0 my $left = $i;
6303 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6304 0 $i++;
6305 }
6306 0 while (1) {
6307 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6308 0 die __FILE__, ": Unmatched [] in regexp\n";
6309 }
6310 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6311 0 my $right = $i;
6312  
6313 # [^...]
6314 0 splice @char, $left, $right-$left+1, Elatin8::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6315  
6316 0 $i = $left;
6317 0 last;
6318 }
6319 }
6320 }
6321  
6322 # escape $ @ / and \
6323 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6324 0 $char[$i] = '\\' . $char[$i];
6325 }
6326  
6327 # rewrite character class or escape character
6328 elsif (my $char = character_class($char[$i],$modifier)) {
6329 0 $char[$i] = $char;
6330 }
6331  
6332 # /i modifier
6333 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin8::uc($char[$i]) ne Elatin8::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin8::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 &Elatin8::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin8::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= &Elatin8::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6334 0 ▶ if (CORE::length(Elatin8::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
6335 0 $char[$i] = '[' . Elatin8::uc($char[$i]) . Elatin8::fc($char[$i]) . ']';
6336 }
6337 else {
6338 0 $char[$i] = '(?:' . Elatin8::uc($char[$i]) . '|' . Elatin8::fc($char[$i]) . ')';
6339 }
6340 }
6341  
6342 # quote character before ? + * {
6343 ▶ 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
6344 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
6345 }
6346 else {
6347 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6348 }
6349 }
6350 }
6351  
6352 2 $delimiter = '/';
6353 2 $end_delimiter = '/';
6354  
6355 2 $modifier =~ tr/i//d;
6356 2 return join '', $ope, $delimiter, $anchor, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6357 }
6358  
6359 #
6360 # escape regexp (m''b, qr''b)
6361 #
6362 0 ▶sub e_qr_qb {
Subroutine e_qr_qb: not called CC=4 SCAR=30.0
Pod undocumented
6363 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6364  
6365 # split regexp
6366 0 my @char = $string =~ /\G ((?>[^\\]|\\\\)) /oxmsg;
6367  
6368 # unescape character
6369 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
6370 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
6371 }
6372  
6373 # remain \\
6374 elsif ($char[$i] eq '\\\\') {
6375 }
6376  
6377 # escape $ @ / and \
6378 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6379 0 $char[$i] = '\\' . $char[$i];
6380 }
6381 }
6382  
6383 0 $delimiter = '/';
6384 0 $end_delimiter = '/';
6385 0 return join '', $ope, $delimiter, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6386 }
6387  
6388 #
6389 # escape regexp (s/here//)
6390 #
6391 80 ▶sub e_s1 {
Subroutine e_s1: called CC=106 SCAR=81.1
Pod undocumented
6392 80 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6393 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
6394  
6395 80 $modifier =~ tr/p//d;
6396 80 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 80 80
6397 0 my $line = 0;
6398 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6399 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6400 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6401 0 last;
6402 }
6403 }
6404 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6405 }
6406  
6407 80 $slash = 'div';
6408  
6409 # literal null string pattern
6410 80 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 72 80
elsif ($modifier =~ tr/Bb//d) { } 0 72 72
6411 8 $modifier =~ tr/bB//d;
6412 8 $modifier =~ tr/i//d;
6413 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
6414 }
6415  
6416 # /b /B modifier
6417 elsif ($modifier =~ tr/bB//d) {
6418  
6419 # choice again delimiter
6420 0 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 0 0
6421 0 my @char = $string =~ /\G ([\x00-\xFF]) /oxmsg;
6422 0 my %octet = map {$_ => 1} @char;
6423 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
6424 0 $delimiter = '(';
6425 0 $end_delimiter = ')';
6426 }
6427 elsif (not $octet{'}'}) {
6428 0 $delimiter = '{';
6429 0 $end_delimiter = '}';
6430 }
6431 elsif (not $octet{']'}) {
6432 0 $delimiter = '[';
6433 0 $end_delimiter = ']';
6434 }
6435 elsif (not $octet{'>'}) {
6436 0 $delimiter = '<';
6437 0 $end_delimiter = '>';
6438 }
6439 else {
6440 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
6441 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
6442 0 $delimiter = $char;
6443 0 $end_delimiter = $char;
6444 0 last;
6445 }
6446 }
6447 }
6448 }
6449  
6450 0 my $prematch = '';
6451 0 return join '', $ope, $delimiter, $prematch, '(?:', $string, ')', $matched, $end_delimiter, $modifier;
6452 }
6453  
6454 72 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 1 71 72
6455 72 my $metachar = qr/[\@\\|[\]{^]/oxms;
6456  
6457 # split regexp
6458 72 my @char = $string =~ /\G((?>
6459 [^\\\$\@\[\(] |
6460 \\ (?>[1-9][0-9]*) |
6461 \\g (?>\s*) (?>[1-9][0-9]*) |
6462 \\g (?>\s*) \{ (?>\s*) (?>[1-9][0-9]*) (?>\s*) \} |
6463 \\g (?>\s*) \{ (?>\s*) - (?>\s*) (?>[1-9][0-9]*) (?>\s*) \} |
6464 \\x (?>[0-9A-Fa-f]{1,2}) |
6465 \\ (?>[0-7]{2,3}) |
6466 \\c [\x40-\x5F] |
6467 \\x\{ (?>[0-9A-Fa-f]+) \} |
6468 \\o\{ (?>[0-7]+) \} |
6469 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
6470 \\ $q_char |
6471 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
6472 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
6473 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
6474 [\$\@] $qq_variable |
6475 \$ (?>\s* [0-9]+) |
6476 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
6477 \$ \$ (?![\w\{]) |
6478 \$ (?>\s*) \$ (?>\s*) $qq_variable |
6479 \[\^ |
6480 \[\: (?>[a-z]+) :\] |
6481 \[\:\^ (?>[a-z]+) :\] |
6482 \(\? |
6483 $q_char
6484 ))/oxmsg;
6485  
6486 # choice again delimiter
6487 72 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 72 72
6488 0 my %octet = map {$_ => 1} @char;
6489 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
6490 0 $delimiter = '(';
6491 0 $end_delimiter = ')';
6492 }
6493 elsif (not $octet{'}'}) {
6494 0 $delimiter = '{';
6495 0 $end_delimiter = '}';
6496 }
6497 elsif (not $octet{']'}) {
6498 0 $delimiter = '[';
6499 0 $end_delimiter = ']';
6500 }
6501 elsif (not $octet{'>'}) {
6502 0 $delimiter = '<';
6503 0 $end_delimiter = '>';
6504 }
6505 else {
6506 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
6507 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
6508 0 $delimiter = $char;
6509 0 $end_delimiter = $char;
6510 0 last;
6511 }
6512 }
6513 }
6514 }
6515  
6516 # count '('
6517 72 my $parens = grep { $_ eq '(' } @char;
6518  
6519 72 my $left_e = 0;
6520 72 my $right_e = 0;
6521 72 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 200 72 272
6522  
6523 # "\L\u" --> "\u\L"
6524 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
6525 0 @char[$i,$i+1] = @char[$i+1,$i];
6526 }
6527  
6528 # "\U\l" --> "\l\U"
6529 ▶ 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
6530 0 @char[$i,$i+1] = @char[$i+1,$i];
6531 }
6532  
6533 # octal escape sequence
6534 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
6535 1 $char[$i] = Elatin8::octchr($1);
6536 }
6537  
6538 # hexadecimal escape sequence
6539 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
6540 1 $char[$i] = Elatin8::hexchr($1);
6541 }
6542  
6543 # \b{...} --> b\{...}
6544 # \B{...} --> B\{...}
6545 # \N{CHARNAME} --> N\{CHARNAME}
6546 # \p{PROPERTY} --> p\{PROPERTY}
6547 # \P{PROPERTY} --> P\{PROPERTY}
6548 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
6549 0 $char[$i] = $1 . '\\' . $2;
6550 }
6551  
6552 # \p, \P, \X --> p, P, X
6553 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
6554 0 $char[$i] = $1;
6555 }
6556  
6557 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 &Elatin8::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
6558 }
6559  
6560 # join separated multiple-octet
6561 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
6562 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 $Elatin8::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 $Elatin8::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 $Elatin8::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 $Elatin8::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 $Elatin8::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 $Elatin8::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 $Elatin8::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6563 0 $char[$i] .= join '', splice @char, $i+1, 3;
6564 }
6565 ▶ 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 $Elatin8::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 $Elatin8::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 $Elatin8::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 $Elatin8::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6566 0 $char[$i] .= join '', splice @char, $i+1, 2;
6567 }
6568 ▶ 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 $Elatin8::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 $Elatin8::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 $Elatin8::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 $Elatin8::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6569 0 $char[$i] .= join '', splice @char, $i+1, 1;
6570 }
6571 }
6572  
6573 # open character class [...]
6574 elsif ($char[$i] eq '[') {
6575 17 my $left = $i;
6576 17 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 17 17
6577 0 $i++;
6578 }
6579 17 while (1) {
6580 74 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 74 74
6581 0 die __FILE__, ": Unmatched [] in regexp\n";
6582 }
6583 74 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 17 57 74
6584 17 my $right = $i;
6585  
6586 # [...]
6587 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
6588 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin8::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6589 }
6590 else {
6591 17 splice @char, $left, $right-$left+1, Elatin8::charlist_qr(@char[$left+1..$right-1], $modifier);
6592 }
6593  
6594 17 $i = $left;
6595 17 last;
6596 }
6597 }
6598 }
6599  
6600 # open character class [^...]
6601 elsif ($char[$i] eq '[^') {
6602 0 my $left = $i;
6603 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6604 0 $i++;
6605 }
6606 0 while (1) {
6607 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6608 0 die __FILE__, ": Unmatched [] in regexp\n";
6609 }
6610 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6611 0 my $right = $i;
6612  
6613 # [^...]
6614 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
6615 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin8::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6616 }
6617 else {
6618 0 splice @char, $left, $right-$left+1, Elatin8::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6619 }
6620  
6621 0 $i = $left;
6622 0 last;
6623 }
6624 }
6625 }
6626  
6627 # rewrite character class or escape character
6628 elsif (my $char = character_class($char[$i],$modifier)) {
6629 7 $char[$i] = $char;
6630 }
6631  
6632 # /i modifier
6633 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin8::uc($char[$i]) ne Elatin8::fc($char[$i]))) {
Condition66%4/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin8::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 &Elatin8::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin8::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= &Elatin8::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6634 3 ▶ if (CORE::length(Elatin8::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 3 0 3
6635 3 $char[$i] = '[' . Elatin8::uc($char[$i]) . Elatin8::fc($char[$i]) . ']';
6636 }
6637 else {
6638 0 $char[$i] = '(?:' . Elatin8::uc($char[$i]) . '|' . Elatin8::fc($char[$i]) . ')';
6639 }
6640 }
6641  
6642 # \u \l \U \L \F \Q \E
6643 elsif ($char[$i] =~ /\A [<>] \z/oxms) {
6644 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
6645 0 $char[$i] = '\\' . $char[$i];
6646 }
6647 }
6648 elsif ($char[$i] eq '\u') {
6649 0 $char[$i] = '@{[Elatin8::ucfirst qq<';
6650 0 $left_e++;
6651 }
6652 elsif ($char[$i] eq '\l') {
6653 0 $char[$i] = '@{[Elatin8::lcfirst qq<';
6654 0 $left_e++;
6655 }
6656 elsif ($char[$i] eq '\U') {
6657 0 $char[$i] = '@{[Elatin8::uc qq<';
6658 0 $left_e++;
6659 }
6660 elsif ($char[$i] eq '\L') {
6661 0 $char[$i] = '@{[Elatin8::lc qq<';
6662 0 $left_e++;
6663 }
6664 elsif ($char[$i] eq '\F') {
6665 0 $char[$i] = '@{[Elatin8::fc qq<';
6666 0 $left_e++;
6667 }
6668 elsif ($char[$i] eq '\Q') {
6669 0 $char[$i] = '@{[CORE::quotemeta qq<';
6670 0 $left_e++;
6671 }
6672 elsif ($char[$i] eq '\E') {
6673 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
6674 0 $char[$i] = '>]}';
6675 0 $right_e++;
6676 }
6677 else {
6678 0 $char[$i] = '';
6679 }
6680 }
6681 elsif ($char[$i] eq '\Q') {
6682 0 while (1) {
6683 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6684 0 last;
6685 }
6686 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
6687 0 last;
6688 }
6689 }
6690 }
6691 elsif ($char[$i] eq '\E') {
6692 }
6693  
6694 # \0 --> \0
6695 elsif ($char[$i] =~ /\A \\ (?>\s*) 0 \z/oxms) {
6696 }
6697  
6698 # \g{N}, \g{-N}
6699  
6700 # P.108 Using Simple Patterns
6701 # in Chapter 7: In the World of Regular Expressions
6702 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
6703  
6704 # P.221 Capturing
6705 # in Chapter 5: Pattern Matching
6706 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
6707  
6708 # \g{-1}, \g{-2}, \g{-3} --> \g{-1}, \g{-2}, \g{-3}
6709 elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) - (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6710 }
6711  
6712 # \g{1}, \g{2}, \g{3} --> \g{2}, \g{3}, \g{4} (only when multibyte anchoring is enable)
6713 elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6714 }
6715  
6716 # \g1, \g2, \g3 --> \g2, \g3, \g4 (only when multibyte anchoring is enable)
6717 elsif ($char[$i] =~ /\A \\g (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) {
6718 }
6719  
6720 # \1, \2, \3 --> \2, \3, \4 (only when multibyte anchoring is enable)
6721 elsif ($char[$i] =~ /\A \\ (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) {
6722 }
6723  
6724 # $0 --> $0
6725 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
6726 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6727 0 $char[$i] = '@{[Elatin8::ignorecase(' . $char[$i] . ')]}';
6728 }
6729 }
6730 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
6731 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6732 0 $char[$i] = '@{[Elatin8::ignorecase(' . $char[$i] . ')]}';
6733 }
6734 }
6735  
6736 # $$ --> $$
6737 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
6738 }
6739  
6740 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
6741 # $1, $2, $3 --> $1, $2, $3 otherwise
6742 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
6743 0 $char[$i] = e_capture($1);
6744 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6745 0 $char[$i] = '@{[Elatin8::ignorecase(' . $char[$i] . ')]}';
6746 }
6747 }
6748 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6749 0 $char[$i] = e_capture($1);
6750 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6751 0 $char[$i] = '@{[Elatin8::ignorecase(' . $char[$i] . ')]}';
6752 }
6753 }
6754  
6755 # $$foo[ ... ] --> $ $foo->[ ... ]
6756 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
6757 0 $char[$i] = e_capture($1.'->'.$2);
6758 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6759 0 $char[$i] = '@{[Elatin8::ignorecase(' . $char[$i] . ')]}';
6760 }
6761 }
6762  
6763 # $$foo{ ... } --> $ $foo->{ ... }
6764 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
6765 0 $char[$i] = e_capture($1.'->'.$2);
6766 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6767 0 $char[$i] = '@{[Elatin8::ignorecase(' . $char[$i] . ')]}';
6768 }
6769 }
6770  
6771 # $$foo
6772 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
6773 0 $char[$i] = e_capture($1);
6774 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6775 0 $char[$i] = '@{[Elatin8::ignorecase(' . $char[$i] . ')]}';
6776 }
6777 }
6778  
6779 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin8::PREMATCH()
6780 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
6781 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 4 4
6782 0 $char[$i] = '@{[Elatin8::ignorecase(Elatin8::PREMATCH())]}';
6783 }
6784 else {
6785 4 $char[$i] = '@{[Elatin8::PREMATCH()]}';
6786 }
6787 }
6788  
6789 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin8::MATCH()
6790 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
6791 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 4 4
6792 0 $char[$i] = '@{[Elatin8::ignorecase(Elatin8::MATCH())]}';
6793 }
6794 else {
6795 4 $char[$i] = '@{[Elatin8::MATCH()]}';
6796 }
6797 }
6798  
6799 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin8::POSTMATCH()
6800 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
6801 3 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 3 3
6802 0 $char[$i] = '@{[Elatin8::ignorecase(Elatin8::POSTMATCH())]}';
6803 }
6804 else {
6805 3 $char[$i] = '@{[Elatin8::POSTMATCH()]}';
6806 }
6807 }
6808  
6809 # ${ foo }
6810 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
6811 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6812 0 $char[$i] = '@{[Elatin8::ignorecase(' . $char[$i] . ')]}';
6813 }
6814 }
6815  
6816 # ${ ... }
6817 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
6818 0 $char[$i] = e_capture($1);
6819 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6820 0 $char[$i] = '@{[Elatin8::ignorecase(' . $char[$i] . ')]}';
6821 }
6822 }
6823  
6824 # $scalar or @array
6825 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
6826 4 $char[$i] = e_string($char[$i]);
6827 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 4 4
6828 0 $char[$i] = '@{[Elatin8::ignorecase(' . $char[$i] . ')]}';
6829 }
6830 }
6831  
6832 # quote character before ? + * {
6833 ▶ 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
6834 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
6835 }
6836 else {
6837 14 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6838 }
6839 }
6840 }
6841  
6842 # make regexp string
6843 72 my $prematch = '';
6844 72 $modifier =~ tr/i//d;
6845 72 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 72 72
6846 0 return join '', $ope, $delimiter, $prematch, '(?:', @char, '>]}' x ($left_e - $right_e), ')', $matched, $end_delimiter, $modifier;
6847 }
6848 72 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6849 }
6850  
6851 #
6852 # escape regexp (s'here'' or s'here''b)
6853 #
6854 21 ▶sub e_s1_q {
Subroutine e_s1_q: called CC=7 SCAR=24.3
Pod undocumented
6855 21 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6856 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
6857  
6858 21 $modifier =~ tr/p//d;
6859 21 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 21 21
6860 0 my $line = 0;
6861 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6862 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6863 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6864 0 last;
6865 }
6866 }
6867 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6868 }
6869  
6870 21 $slash = 'div';
6871  
6872 # literal null string pattern
6873 21 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 13 21
elsif ($modifier =~ tr/Bb//d) { } 0 13 13
6874 8 $modifier =~ tr/bB//d;
6875 8 $modifier =~ tr/i//d;
6876 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
6877 }
6878  
6879 # with /b /B modifier
6880 elsif ($modifier =~ tr/bB//d) {
6881 0 return e_s1_qb($ope,$delimiter,$end_delimiter,$string,$modifier);
6882 }
6883  
6884 # without /b /B modifier
6885 else {
6886 13 return e_s1_qt($ope,$delimiter,$end_delimiter,$string,$modifier);
6887 }
6888 }
6889  
6890 #
6891 # escape regexp (s'here'')
6892 #
6893 13 ▶sub e_s1_qt {
Subroutine e_s1_qt: called CC=20 SCAR=50.1
Pod undocumented
6894 13 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6895  
6896 13 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 13 13
6897  
6898 # split regexp
6899 13 my @char = $string =~ /\G((?>
6900 [^\\\[\$\@\/] |
6901 [\x00-\xFF] |
6902 \[\^ |
6903 \[\: (?>[a-z]+) \:\] |
6904 \[\:\^ (?>[a-z]+) \:\] |
6905 [\$\@\/] |
6906 \\ (?:$q_char) |
6907 (?:$q_char)
6908 ))/oxmsg;
6909  
6910 # unescape character
6911 13 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 25 13 38
6912 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 &Elatin8::uc($char[$i]) ne &fc($char[$i])) { } 0 19 19
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 32 32
6913 }
6914  
6915 # open character class [...]
6916 elsif ($char[$i] eq '[') {
6917 0 my $left = $i;
6918 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6919 0 $i++;
6920 }
6921 0 while (1) {
6922 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6923 0 die __FILE__, ": Unmatched [] in regexp\n";
6924 }
6925 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6926 0 my $right = $i;
6927  
6928 # [...]
6929 0 splice @char, $left, $right-$left+1, Elatin8::charlist_qr(@char[$left+1..$right-1], $modifier);
6930  
6931 0 $i = $left;
6932 0 last;
6933 }
6934 }
6935 }
6936  
6937 # open character class [^...]
6938 elsif ($char[$i] eq '[^') {
6939 0 my $left = $i;
6940 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6941 0 $i++;
6942 }
6943 0 while (1) {
6944 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6945 0 die __FILE__, ": Unmatched [] in regexp\n";
6946 }
6947 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6948 0 my $right = $i;
6949  
6950 # [^...]
6951 0 splice @char, $left, $right-$left+1, Elatin8::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6952  
6953 0 $i = $left;
6954 0 last;
6955 }
6956 }
6957 }
6958  
6959 # escape $ @ / and \
6960 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6961 0 $char[$i] = '\\' . $char[$i];
6962 }
6963  
6964 # rewrite character class or escape character
6965 elsif (my $char = character_class($char[$i],$modifier)) {
6966 6 $char[$i] = $char;
6967 }
6968  
6969 # /i modifier
6970 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin8::uc($char[$i]) ne Elatin8::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin8::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 &Elatin8::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin8::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= &Elatin8::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6971 0 ▶ if (CORE::length(Elatin8::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
6972 0 $char[$i] = '[' . Elatin8::uc($char[$i]) . Elatin8::fc($char[$i]) . ']';
6973 }
6974 else {
6975 0 $char[$i] = '(?:' . Elatin8::uc($char[$i]) . '|' . Elatin8::fc($char[$i]) . ')';
6976 }
6977 }
6978  
6979 # quote character before ? + * {
6980 ▶ 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
6981 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
6982 }
6983 else {
6984 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6985 }
6986 }
6987 }
6988  
6989 13 $modifier =~ tr/i//d;
6990 13 $delimiter = '/';
6991 13 $end_delimiter = '/';
6992 13 my $prematch = '';
6993 13 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6994 }
6995  
6996 #
6997 # escape regexp (s'here''b)
6998 #
6999 0 ▶sub e_s1_qb {
Subroutine e_s1_qb: not called CC=4 SCAR=30.0
Pod undocumented
7000 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
7001  
7002 # split regexp
7003 0 my @char = $string =~ /\G (?>[^\\]|\\\\) /oxmsg;
7004  
7005 # unescape character
7006 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
7007 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
7008 }
7009  
7010 # remain \\
7011 elsif ($char[$i] eq '\\\\') {
7012 }
7013  
7014 # escape $ @ / and \
7015 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
7016 0 $char[$i] = '\\' . $char[$i];
7017 }
7018 }
7019  
7020 0 $delimiter = '/';
7021 0 $end_delimiter = '/';
7022 0 my $prematch = '';
7023 0 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
7024 }
7025  
7026 #
7027 # escape regexp (s''here')
7028 #
7029 16 ▶sub e_s2_q {
Subroutine e_s2_q: called CC=4 SCAR=13.9
Pod undocumented
7030 16 my($ope,$delimiter,$end_delimiter,$string) = @_;
7031  
7032 16 $slash = 'div';
7033  
7034 16 my @char = $string =~ / \G (?>[^\\]|\\\\|$q_char) /oxmsg;
7035 16 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 9 16 25
7036 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
7037 }
7038  
7039 # not escape \\
7040 elsif ($char[$i] =~ /\A \\\\ \z/oxms) {
7041 }
7042  
7043 # escape $ @ / and \
7044 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
7045 5 $char[$i] = '\\' . $char[$i];
7046 }
7047 }
7048  
7049 16 return join '', $ope, $delimiter, @char, $end_delimiter;
7050 }
7051  
7052 #
7053 # escape regexp (s/here/and here/modifier)
7054 #
7055 101 ▶sub e_sub {
Subroutine e_sub: called CC=20 SCAR=32.6
Pod undocumented
7056 101 my($variable,$delimiter1,$pattern,$end_delimiter1,$delimiter2,$replacement,$end_delimiter2,$modifier) = @_;
7057 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
7058  
7059 101 $modifier =~ tr/p//d;
7060 101 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 101 101
7061 0 my $line = 0;
7062 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7063 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
7064 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
7065 0 last;
7066 }
7067 }
7068 0 die qq{Unsupported modifier "$1" used at line $line.\n};
7069 }
7070  
7071 101 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq "") 36 65 101
7072 36 $variable = '$_';
7073 36 $bind_operator = ' =~ ';
7074 }
7075  
7076 101 $slash = 'div';
7077  
7078 # P.128 Start of match (or end of previous match): \G
7079 # P.130 Advanced Use of \G with Perl
7080 # in Chapter 3: Overview of Regular Expression Features and Flavors
7081 # P.312 Iterative Matching: Scalar Context, with /g
7082 # in Chapter 7: Perl
7083 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
7084  
7085 # P.181 Where You Left Off: The \G Assertion
7086 # in Chapter 5: Pattern Matching
7087 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
7088  
7089 # P.220 Where You Left Off: The \G Assertion
7090 # in Chapter 5: Pattern Matching
7091 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
7092  
7093 101 my $e_modifier = $modifier =~ tr/e//d;
7094 101 my $r_modifier = $modifier =~ tr/r//d;
7095  
7096 101 my $my = '';
7097 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
7098 0 $my = $variable;
7099 0 $variable =~ s/ (?: local \b | my \b | our \b | state \b ) (?>\s*) //oxms;
7100 0 $variable =~ s/ = .+ \z//oxms;
7101 }
7102  
7103 101 (my $variable_basename = $variable) =~ s/ [\[\{].* \z//oxms;
7104 101 $variable_basename =~ s/ \s+ \z//oxms;
7105  
7106 # quote replacement string
7107 101 my $e_replacement = '';
7108 101 ▶ if ($e_modifier >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($e_modifier >= 1) { } 17 84 101
7109 17 $e_replacement = e_qq('', '', '', $replacement);
7110 17 $e_modifier--;
7111 }
7112 else {
7113 84 ▶ if ($delimiter2 eq "'") {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter2 eq q[']) { } 16 68 84
7114 16 $e_replacement = e_s2_q('qq', '/', '/', $replacement);
7115 }
7116 else {
7117 68 $e_replacement = e_qq ('qq', $delimiter2, $end_delimiter2, $replacement);
7118 }
7119 }
7120  
7121 101 my $sub = '';
7122  
7123 # with /r
7124 101 ▶ if ($r_modifier) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r_modifier) { } 10 91 101
7125 10 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $modifier =~ /g/mosx }) { } 5 5 10
7126 }
7127  
7128 # s///gr without multibyte anchoring
7129 elsif ($modifier =~ /g/oxms) {
7130 5 ▶ $sub = sprintf(
Branch: 1 branch
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 0 5 5
7131 # 1 2 3 4 5
7132 q<CORE::eval{local $Elatin8::re_t=%s; while($Elatin8::re_t =~ %s){%s local $^W=0; local $Elatin8::re_r=%s; %s$Elatin8::re_t="$`$Elatin8::re_r$'"; pos($Elatin8::re_t)=length "$`$Elatin8::re_r"; } return $Elatin8::re_t}>,
7133  
7134 $variable, # 1
7135 ($delimiter1 eq "'") ? # 2
7136 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
7137 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
7138 $s_matched, # 3
7139 $e_replacement, # 4
7140 '$Elatin8::re_r=CORE::eval $Elatin8::re_r; ' x $e_modifier, # 5
7141 );
7142 }
7143  
7144 # s///r
7145 else {
7146  
7147 5 my $prematch = q{$`};
7148  
7149 5 ▶ $sub = sprintf(
Branch: 1 branch
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 0 5 5
7150 # 1 2 3 4 5 6 7
7151 q<(%s =~ %s) ? CORE::eval{%s local $^W=0; local $Elatin8::re_r=%s; %s"%s$Elatin8::re_r$'" } : %s>,
7152  
7153 $variable, # 1
7154 ($delimiter1 eq "'") ? # 2
7155 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
7156 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
7157 $s_matched, # 3
7158 $e_replacement, # 4
7159 '$Elatin8::re_r=CORE::eval $Elatin8::re_r; ' x $e_modifier, # 5
7160 $prematch, # 6
7161 $variable, # 7
7162 );
7163 }
7164  
7165 # $var !~ s///r doesn't make sense
7166 10 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) 0 10 10
7167 0 $sub = q{die("$0: Using !~ with s///r doesn't make sense"), } . $sub;
7168 }
7169 }
7170  
7171 # without /r
7172 else {
7173 91 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $modifier =~ /g/mosx }) { } 23 68 91
7174 }
7175  
7176 # s///g without multibyte anchoring
7177 elsif ($modifier =~ /g/oxms) {
7178 23 ▶ $sub = sprintf(
Branch: 2 branches
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 3 20 23
$bind_operator =~ / !~ /mosx ? : 3 20 23
7179 # 1 2 3 4 5 6 7 8
7180 q<CORE::eval{local $Elatin8::re_n=0; while(%s =~ %s){%s local $^W=0; local $Elatin8::re_r=%s; %s%s="$`$Elatin8::re_r$'"; pos(%s)=length "$`$Elatin8::re_r"; $Elatin8::re_n++} return %s$Elatin8::re_n}>,
7181  
7182 $variable, # 1
7183 ($delimiter1 eq "'") ? # 2
7184 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
7185 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
7186 $s_matched, # 3
7187 $e_replacement, # 4
7188 '$Elatin8::re_r=CORE::eval $Elatin8::re_r; ' x $e_modifier, # 5
7189 $variable, # 6
7190 $variable, # 7
7191 ($bind_operator =~ / !~ /oxms) ? '!' : '', # 8
7192 );
7193 }
7194  
7195 # s///
7196 else {
7197  
7198 68 my $prematch = q{$`};
7199  
7200 68 ▶ $sub = sprintf(
Branch: 2 branches
BranchTrueFalseTotal
$bind_operator =~ / =~ /mosx ? : 65 3 68
$delimiter1 eq q['] ? : 18 50 68
7201  
7202 ($bind_operator =~ / =~ /oxms) ?
7203  
7204 # 1 2 3 4 5 6 7 8
7205 q<(%s%s%s) ? CORE::eval{%s local $^W=0; local $Elatin8::re_r=%s; %s%s="%s$Elatin8::re_r$'"; 1 } : undef> :
7206  
7207 # 1 2 3 4 5 6 7 8
7208 q<(%s%s%s) ? 1 : CORE::eval{%s local $^W=0; local $Elatin8::re_r=%s; %s%s="%s$Elatin8::re_r$'"; undef }>,
7209  
7210 $variable, # 1
7211 $bind_operator, # 2
7212 ($delimiter1 eq "'") ? # 3
7213 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
7214 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
7215 $s_matched, # 4
7216 $e_replacement, # 5
7217 '$Elatin8::re_r=CORE::eval $Elatin8::re_r; ' x $e_modifier, # 6
7218 $variable, # 7
7219 $prematch, # 8
7220 );
7221 }
7222 }
7223  
7224 # (my $foo = $bar) =~ s/// --> (my $foo = $bar, CORE::eval { ... })[1]
7225 101 ▶ if ($my ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($my ne "") 0 101 101
7226 0 $sub = "($my, $sub)[1]";
7227 }
7228  
7229 # clear s/// variable
7230 101 $sub_variable = '';
7231 101 $bind_operator = '';
7232  
7233 101 return $sub;
7234 }
7235  
7236 #
7237 # escape regexp of split qr//
7238 #
7239 74 ▶sub e_split {
Subroutine e_split: called CC=88 SCAR=76.4
Pod undocumented
7240 74 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
7241 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
7242  
7243 74 $modifier =~ tr/p//d;
7244 74 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 74 74
7245 0 my $line = 0;
7246 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7247 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
7248 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
7249 0 last;
7250 }
7251 }
7252 0 die qq{Unsupported modifier "$1" used at line $line.\n};
7253 }
7254  
7255 74 $slash = 'div';
7256  
7257 # /b /B modifier
7258 74 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) 0 74 74
7259 0 return join '', 'split', $ope, $delimiter, $string, $end_delimiter, $modifier;
7260 }
7261  
7262 74 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 74 74
7263 74 my $metachar = qr/[\@\\|[\]{^]/oxms;
7264  
7265 # split regexp
7266 74 my @char = $string =~ /\G((?>
7267 [^\\\$\@\[\(] |
7268 \\x (?>[0-9A-Fa-f]{1,2}) |
7269 \\ (?>[0-7]{2,3}) |
7270 \\c [\x40-\x5F] |
7271 \\x\{ (?>[0-9A-Fa-f]+) \} |
7272 \\o\{ (?>[0-7]+) \} |
7273 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
7274 \\ $q_char |
7275 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
7276 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
7277 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
7278 [\$\@] $qq_variable |
7279 \$ (?>\s* [0-9]+) |
7280 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
7281 \$ \$ (?![\w\{]) |
7282 \$ (?>\s*) \$ (?>\s*) $qq_variable |
7283 \[\^ |
7284 \[\: (?>[a-z]+) :\] |
7285 \[\:\^ (?>[a-z]+) :\] |
7286 \(\? |
7287 $q_char
7288 ))/oxmsg;
7289  
7290 74 my $left_e = 0;
7291 74 my $right_e = 0;
7292 74 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 249 74 323
7293  
7294 # "\L\u" --> "\u\L"
7295 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
7296 0 @char[$i,$i+1] = @char[$i+1,$i];
7297 }
7298  
7299 # "\U\l" --> "\l\U"
7300 ▶ 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
7301 0 @char[$i,$i+1] = @char[$i+1,$i];
7302 }
7303  
7304 # octal escape sequence
7305 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
7306 1 $char[$i] = Elatin8::octchr($1);
7307 }
7308  
7309 # hexadecimal escape sequence
7310 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
7311 1 $char[$i] = Elatin8::hexchr($1);
7312 }
7313  
7314 # \b{...} --> b\{...}
7315 # \B{...} --> B\{...}
7316 # \N{CHARNAME} --> N\{CHARNAME}
7317 # \p{PROPERTY} --> p\{PROPERTY}
7318 # \P{PROPERTY} --> P\{PROPERTY}
7319 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
7320 0 $char[$i] = $1 . '\\' . $2;
7321 }
7322  
7323 # \p, \P, \X --> p, P, X
7324 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
7325 0 $char[$i] = $1;
7326 }
7327  
7328 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 &Elatin8::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
7329 }
7330  
7331 # join separated multiple-octet
7332 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
7333 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 $Elatin8::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 $Elatin8::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 $Elatin8::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 $Elatin8::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 $Elatin8::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 $Elatin8::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 $Elatin8::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
7334 0 $char[$i] .= join '', splice @char, $i+1, 3;
7335 }
7336 ▶ 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 $Elatin8::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 $Elatin8::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 $Elatin8::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 $Elatin8::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
7337 0 $char[$i] .= join '', splice @char, $i+1, 2;
7338 }
7339 ▶ 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 $Elatin8::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 $Elatin8::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 $Elatin8::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 $Elatin8::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
7340 0 $char[$i] .= join '', splice @char, $i+1, 1;
7341 }
7342 }
7343  
7344 # open character class [...]
7345 elsif ($char[$i] eq '[') {
7346 3 my $left = $i;
7347 3 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 3 3
7348 0 $i++;
7349 }
7350 3 while (1) {
7351 7 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 7 7
7352 0 die __FILE__, ": Unmatched [] in regexp\n";
7353 }
7354 7 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 3 4 7
7355 3 my $right = $i;
7356  
7357 # [...]
7358 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
7359 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin8::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
7360 }
7361 else {
7362 3 splice @char, $left, $right-$left+1, Elatin8::charlist_qr(@char[$left+1..$right-1], $modifier);
7363 }
7364  
7365 3 $i = $left;
7366 3 last;
7367 }
7368 }
7369 }
7370  
7371 # open character class [^...]
7372 elsif ($char[$i] eq '[^') {
7373 0 my $left = $i;
7374 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7375 0 $i++;
7376 }
7377 0 while (1) {
7378 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7379 0 die __FILE__, ": Unmatched [] in regexp\n";
7380 }
7381 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7382 0 my $right = $i;
7383  
7384 # [^...]
7385 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
7386 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin8::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
7387 }
7388 else {
7389 0 splice @char, $left, $right-$left+1, Elatin8::charlist_not_qr(@char[$left+1..$right-1], $modifier);
7390 }
7391  
7392 0 $i = $left;
7393 0 last;
7394 }
7395 }
7396 }
7397  
7398 # rewrite character class or escape character
7399 elsif (my $char = character_class($char[$i],$modifier)) {
7400 1 $char[$i] = $char;
7401 }
7402  
7403 # P.794 29.2.161. split
7404 # in Chapter 29: Functions
7405 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
7406  
7407 # P.951 split
7408 # in Chapter 27: Functions
7409 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
7410  
7411 # said "The //m modifier is assumed when you split on the pattern /^/",
7412 # but perl5.008 is not so. Therefore, this software adds //m.
7413 # (and so on)
7414  
7415 # split(m/^/) --> split(m/^/m)
7416 ▶ 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
7417 7 $modifier .= 'm';
7418 }
7419  
7420 # /i modifier
7421 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin8::uc($char[$i]) ne Elatin8::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin8::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 &Elatin8::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin8::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= &Elatin8::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
7422 0 ▶ if (CORE::length(Elatin8::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
7423 0 $char[$i] = '[' . Elatin8::uc($char[$i]) . Elatin8::fc($char[$i]) . ']';
7424 }
7425 else {
7426 0 $char[$i] = '(?:' . Elatin8::uc($char[$i]) . '|' . Elatin8::fc($char[$i]) . ')';
7427 }
7428 }
7429  
7430 # \u \l \U \L \F \Q \E
7431 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
7432 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
7433 0 $char[$i] = '\\' . $char[$i];
7434 }
7435 }
7436 elsif ($char[$i] eq '\u') {
7437 0 $char[$i] = '@{[Elatin8::ucfirst qq<';
7438 0 $left_e++;
7439 }
7440 elsif ($char[$i] eq '\l') {
7441 0 $char[$i] = '@{[Elatin8::lcfirst qq<';
7442 0 $left_e++;
7443 }
7444 elsif ($char[$i] eq '\U') {
7445 0 $char[$i] = '@{[Elatin8::uc qq<';
7446 0 $left_e++;
7447 }
7448 elsif ($char[$i] eq '\L') {
7449 0 $char[$i] = '@{[Elatin8::lc qq<';
7450 0 $left_e++;
7451 }
7452 elsif ($char[$i] eq '\F') {
7453 0 $char[$i] = '@{[Elatin8::fc qq<';
7454 0 $left_e++;
7455 }
7456 elsif ($char[$i] eq '\Q') {
7457 0 $char[$i] = '@{[CORE::quotemeta qq<';
7458 0 $left_e++;
7459 }
7460 elsif ($char[$i] eq '\E') {
7461 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
7462 0 $char[$i] = '>]}';
7463 0 $right_e++;
7464 }
7465 else {
7466 0 $char[$i] = '';
7467 }
7468 }
7469 elsif ($char[$i] eq '\Q') {
7470 0 while (1) {
7471 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7472 0 last;
7473 }
7474 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
7475 0 last;
7476 }
7477 }
7478 }
7479 elsif ($char[$i] eq '\E') {
7480 }
7481  
7482 # $0 --> $0
7483 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
7484 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7485 0 $char[$i] = '@{[Elatin8::ignorecase(' . $char[$i] . ')]}';
7486 }
7487 }
7488 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
7489 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7490 0 $char[$i] = '@{[Elatin8::ignorecase(' . $char[$i] . ')]}';
7491 }
7492 }
7493  
7494 # $$ --> $$
7495 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
7496 }
7497  
7498 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
7499 # $1, $2, $3 --> $1, $2, $3 otherwise
7500 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
7501 0 $char[$i] = e_capture($1);
7502 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7503 0 $char[$i] = '@{[Elatin8::ignorecase(' . $char[$i] . ')]}';
7504 }
7505 }
7506 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
7507 0 $char[$i] = e_capture($1);
7508 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7509 0 $char[$i] = '@{[Elatin8::ignorecase(' . $char[$i] . ')]}';
7510 }
7511 }
7512  
7513 # $$foo[ ... ] --> $ $foo->[ ... ]
7514 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
7515 0 $char[$i] = e_capture($1.'->'.$2);
7516 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7517 0 $char[$i] = '@{[Elatin8::ignorecase(' . $char[$i] . ')]}';
7518 }
7519 }
7520  
7521 # $$foo{ ... } --> $ $foo->{ ... }
7522 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
7523 0 $char[$i] = e_capture($1.'->'.$2);
7524 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7525 0 $char[$i] = '@{[Elatin8::ignorecase(' . $char[$i] . ')]}';
7526 }
7527 }
7528  
7529 # $$foo
7530 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
7531 0 $char[$i] = e_capture($1);
7532 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7533 0 $char[$i] = '@{[Elatin8::ignorecase(' . $char[$i] . ')]}';
7534 }
7535 }
7536  
7537 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin8::PREMATCH()
7538 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
7539 12 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 12 12
7540 0 $char[$i] = '@{[Elatin8::ignorecase(Elatin8::PREMATCH())]}';
7541 }
7542 else {
7543 12 $char[$i] = '@{[Elatin8::PREMATCH()]}';
7544 }
7545 }
7546  
7547 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin8::MATCH()
7548 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
7549 12 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 12 12
7550 0 $char[$i] = '@{[Elatin8::ignorecase(Elatin8::MATCH())]}';
7551 }
7552 else {
7553 12 $char[$i] = '@{[Elatin8::MATCH()]}';
7554 }
7555 }
7556  
7557 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin8::POSTMATCH()
7558 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
7559 9 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 9 9
7560 0 $char[$i] = '@{[Elatin8::ignorecase(Elatin8::POSTMATCH())]}';
7561 }
7562 else {
7563 9 $char[$i] = '@{[Elatin8::POSTMATCH()]}';
7564 }
7565 }
7566  
7567 # ${ foo }
7568 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
7569 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7570 0 $char[$i] = '@{[Elatin8::ignorecase(' . $1 . ')]}';
7571 }
7572 }
7573  
7574 # ${ ... }
7575 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
7576 0 $char[$i] = e_capture($1);
7577 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7578 0 $char[$i] = '@{[Elatin8::ignorecase(' . $char[$i] . ')]}';
7579 }
7580 }
7581  
7582 # $scalar or @array
7583 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
7584 3 $char[$i] = e_string($char[$i]);
7585 3 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 3 3
7586 0 $char[$i] = '@{[Elatin8::ignorecase(' . $char[$i] . ')]}';
7587 }
7588 }
7589  
7590 # quote character before ? + * {
7591 ▶ 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
7592 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
7593 }
7594 else {
7595 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
7596 }
7597 }
7598 }
7599  
7600 # make regexp string
7601 74 $modifier =~ tr/i//d;
7602 74 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 74 74
7603 0 return join '', 'Elatin8::split', $ope, $delimiter, @char, '>]}' x ($left_e - $right_e), $end_delimiter, $modifier;
7604 }
7605 74 return join '', 'Elatin8::split', $ope, $delimiter, @char, $end_delimiter, $modifier;
7606 }
7607  
7608 #
7609 # escape regexp of split qr''
7610 #
7611 0 ▶sub e_split_q {
Subroutine e_split_q: not called CC=26 SCAR=65.5
Pod undocumented
7612 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
7613 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
7614  
7615 0 $modifier =~ tr/p//d;
7616 0 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 0 0
7617 0 my $line = 0;
7618 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7619 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
7620 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
7621 0 last;
7622 }
7623 }
7624 0 die qq{Unsupported modifier "$1" used at line $line.\n};
7625 }
7626  
7627 0 $slash = 'div';
7628  
7629 # /b /B modifier
7630 0 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) 0 0 0
7631 0 return join '', 'split', $ope, $delimiter, $string, $end_delimiter, $modifier;
7632 }
7633  
7634 0 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 0 0
7635  
7636 # split regexp
7637 0 my @char = $string =~ /\G((?>
7638 [^\\\[] |
7639 [\x00-\xFF] |
7640 \[\^ |
7641 \[\: (?>[a-z]+) \:\] |
7642 \[\:\^ (?>[a-z]+) \:\] |
7643 \\ (?:$q_char) |
7644 (?:$q_char)
7645 ))/oxmsg;
7646  
7647 # unescape character
7648 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
7649 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 &Elatin8::uc($char[$i]) ne &fc($char[$i])) { } 0 0 0
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 0 0
7650 }
7651  
7652 # open character class [...]
7653 elsif ($char[$i] eq '[') {
7654 0 my $left = $i;
7655 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7656 0 $i++;
7657 }
7658 0 while (1) {
7659 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7660 0 die __FILE__, ": Unmatched [] in regexp\n";
7661 }
7662 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7663 0 my $right = $i;
7664  
7665 # [...]
7666 0 splice @char, $left, $right-$left+1, Elatin8::charlist_qr(@char[$left+1..$right-1], $modifier);
7667  
7668 0 $i = $left;
7669 0 last;
7670 }
7671 }
7672 }
7673  
7674 # open character class [^...]
7675 elsif ($char[$i] eq '[^') {
7676 0 my $left = $i;
7677 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7678 0 $i++;
7679 }
7680 0 while (1) {
7681 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7682 0 die __FILE__, ": Unmatched [] in regexp\n";
7683 }
7684 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7685 0 my $right = $i;
7686  
7687 # [^...]
7688 0 splice @char, $left, $right-$left+1, Elatin8::charlist_not_qr(@char[$left+1..$right-1], $modifier);
7689  
7690 0 $i = $left;
7691 0 last;
7692 }
7693 }
7694 }
7695  
7696 # rewrite character class or escape character
7697 elsif (my $char = character_class($char[$i],$modifier)) {
7698 0 $char[$i] = $char;
7699 }
7700  
7701 # split(m/^/) --> split(m/^/m)
7702 ▶ 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
7703 0 $modifier .= 'm';
7704 }
7705  
7706 # /i modifier
7707 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin8::uc($char[$i]) ne Elatin8::fc($char[$i]))) {
Condition0%0/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin8::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 &Elatin8::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin8::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= &Elatin8::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
7708 0 ▶ if (CORE::length(Elatin8::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
7709 0 $char[$i] = '[' . Elatin8::uc($char[$i]) . Elatin8::fc($char[$i]) . ']';
7710 }
7711 else {
7712 0 $char[$i] = '(?:' . Elatin8::uc($char[$i]) . '|' . Elatin8::fc($char[$i]) . ')';
7713 }
7714 }
7715  
7716 # quote character before ? + * {
7717 ▶ 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
7718 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
7719 }
7720 else {
7721 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
7722 }
7723 }
7724 }
7725  
7726 0 $modifier =~ tr/i//d;
7727 0 return join '', 'Elatin8::split', $ope, $delimiter, @char, $end_delimiter, $modifier;
7728 }
7729  
7730 #
7731 # instead of Carp::carp
7732 #
7733 0 ▶sub carp {
Subroutine carp: not called CC=1 SCAR=6.9
Pod undocumented
7734 0 my($package,$filename,$line) = caller(1);
7735 0 print STDERR "@_ at $filename line $line.\n";
7736 }
7737  
7738 #
7739 # instead of Carp::croak
7740 #
7741 0 ▶sub croak {
Subroutine croak: not called CC=1 SCAR=6.9
Pod undocumented
7742 0 my($package,$filename,$line) = caller(1);
7743 0 print STDERR "@_ at $filename line $line.\n";
7744 0 die "\n";
7745 }
7746  
7747 #
7748 # instead of Carp::cluck
7749 #
7750 0 ▶sub cluck {
Subroutine cluck: not called CC=2 SCAR=17.9
Pod undocumented
7751 0 my $i = 0;
7752 0 my @cluck = ();
7753 0 ▶ while (my($package,$filename,$line,$subroutine) = caller($i)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7754 0 push @cluck, "[$i] $filename($line) $package::$subroutine\n";
7755 0 $i++;
7756 }
7757 0 print STDERR CORE::reverse @cluck;
7758 0 print STDERR "\n";
7759 0 print STDERR @_;
7760 }
7761  
7762 #
7763 # instead of Carp::confess
7764 #
7765 0 ▶sub confess {
Subroutine confess: not called CC=2 SCAR=17.9
Pod undocumented
7766 0 my $i = 0;
7767 0 my @confess = ();
7768 0 ▶ while (my($package,$filename,$line,$subroutine) = caller($i)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7769 0 push @confess, "[$i] $filename($line) $package::$subroutine\n";
7770 0 $i++;
7771 }
7772 0 print STDERR CORE::reverse @confess;
7773 0 print STDERR "\n";
7774 0 print STDERR @_;
7775 0 die "\n";
7776 }
7777  
7778 422 1;
7779  
7780 __END__
↑ Summary blib/lib/Latin8.pm »