blib/lib/Elatin9.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/Latin9.pm »
1 package Elatin9;
2 422 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 ######################################################################
4 #
5 # Elatin9 - Run-time routines for Latin9.pm
6 #
7 # http://search.cpan.org/dist/Char-Latin9/
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 (&Elatin9::index($name, '::') >= 0) { } 0 15 15
elsif (&Elatin9::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 (Elatin9::index($name,'::') >= 0) {
83 0 return $name;
84 }
85 elsif (Elatin9::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-9 character range per length
158 #
159 422 my %range_tr = ();
160  
161 #
162 # Latin-9 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 Elatin9 \z/mosx }) { } 422 0 422
175 }
176  
177 elsif (__PACKAGE__ =~ / \b Elatin9 \z/oxms) {
178 422 %range_tr = (
179 1 => [ [0x00..0xFF],
180 ],
181 );
182  
183 422 %lc = (%lc,
184 "\xA6" => "\xA8", # LATIN LETTER S WITH CARON
185 "\xB4" => "\xB8", # LATIN LETTER Z WITH CARON
186 "\xBC" => "\xBD", # LATIN LIGATURE OE
187 "\xBE" => "\xFF", # LATIN LETTER Y WITH DIAERESIS
188 "\xC0" => "\xE0", # LATIN LETTER A WITH GRAVE
189 "\xC1" => "\xE1", # LATIN LETTER A WITH ACUTE
190 "\xC2" => "\xE2", # LATIN LETTER A WITH CIRCUMFLEX
191 "\xC3" => "\xE3", # LATIN LETTER A WITH TILDE
192 "\xC4" => "\xE4", # LATIN LETTER A WITH DIAERESIS
193 "\xC5" => "\xE5", # LATIN LETTER A WITH RING ABOVE
194 "\xC6" => "\xE6", # LATIN LETTER AE
195 "\xC7" => "\xE7", # LATIN LETTER C WITH CEDILLA
196 "\xC8" => "\xE8", # LATIN LETTER E WITH GRAVE
197 "\xC9" => "\xE9", # LATIN LETTER E WITH ACUTE
198 "\xCA" => "\xEA", # LATIN LETTER E WITH CIRCUMFLEX
199 "\xCB" => "\xEB", # LATIN LETTER E WITH DIAERESIS
200 "\xCC" => "\xEC", # LATIN LETTER I WITH GRAVE
201 "\xCD" => "\xED", # LATIN LETTER I WITH ACUTE
202 "\xCE" => "\xEE", # LATIN LETTER I WITH CIRCUMFLEX
203 "\xCF" => "\xEF", # LATIN LETTER I WITH DIAERESIS
204 "\xD0" => "\xF0", # LATIN LETTER ETH
205 "\xD1" => "\xF1", # LATIN LETTER N WITH TILDE
206 "\xD2" => "\xF2", # LATIN LETTER O WITH GRAVE
207 "\xD3" => "\xF3", # LATIN LETTER O WITH ACUTE
208 "\xD4" => "\xF4", # LATIN LETTER O WITH CIRCUMFLEX
209 "\xD5" => "\xF5", # LATIN LETTER O WITH TILDE
210 "\xD6" => "\xF6", # LATIN LETTER O WITH DIAERESIS
211 "\xD8" => "\xF8", # LATIN LETTER O WITH STROKE
212 "\xD9" => "\xF9", # LATIN LETTER U WITH GRAVE
213 "\xDA" => "\xFA", # LATIN LETTER U WITH ACUTE
214 "\xDB" => "\xFB", # LATIN LETTER U WITH CIRCUMFLEX
215 "\xDC" => "\xFC", # LATIN LETTER U WITH DIAERESIS
216 "\xDD" => "\xFD", # LATIN LETTER Y WITH ACUTE
217 "\xDE" => "\xFE", # LATIN LETTER THORN
218 );
219  
220 422 %uc = (%uc,
221 "\xA8" => "\xA6", # LATIN LETTER S WITH CARON
222 "\xB8" => "\xB4", # LATIN LETTER Z WITH CARON
223 "\xBD" => "\xBC", # LATIN LIGATURE OE
224 "\xE0" => "\xC0", # LATIN LETTER A WITH GRAVE
225 "\xE1" => "\xC1", # LATIN LETTER A WITH ACUTE
226 "\xE2" => "\xC2", # LATIN LETTER A WITH CIRCUMFLEX
227 "\xE3" => "\xC3", # LATIN LETTER A WITH TILDE
228 "\xE4" => "\xC4", # LATIN LETTER A WITH DIAERESIS
229 "\xE5" => "\xC5", # LATIN LETTER A WITH RING ABOVE
230 "\xE6" => "\xC6", # LATIN LETTER AE
231 "\xE7" => "\xC7", # LATIN LETTER C WITH CEDILLA
232 "\xE8" => "\xC8", # LATIN LETTER E WITH GRAVE
233 "\xE9" => "\xC9", # LATIN LETTER E WITH ACUTE
234 "\xEA" => "\xCA", # LATIN LETTER E WITH CIRCUMFLEX
235 "\xEB" => "\xCB", # LATIN LETTER E WITH DIAERESIS
236 "\xEC" => "\xCC", # LATIN LETTER I WITH GRAVE
237 "\xED" => "\xCD", # LATIN LETTER I WITH ACUTE
238 "\xEE" => "\xCE", # LATIN LETTER I WITH CIRCUMFLEX
239 "\xEF" => "\xCF", # LATIN LETTER I WITH DIAERESIS
240 "\xF0" => "\xD0", # LATIN LETTER ETH
241 "\xF1" => "\xD1", # LATIN LETTER N WITH TILDE
242 "\xF2" => "\xD2", # LATIN LETTER O WITH GRAVE
243 "\xF3" => "\xD3", # LATIN LETTER O WITH ACUTE
244 "\xF4" => "\xD4", # LATIN LETTER O WITH CIRCUMFLEX
245 "\xF5" => "\xD5", # LATIN LETTER O WITH TILDE
246 "\xF6" => "\xD6", # LATIN LETTER O WITH DIAERESIS
247 "\xF8" => "\xD8", # LATIN LETTER O WITH STROKE
248 "\xF9" => "\xD9", # LATIN LETTER U WITH GRAVE
249 "\xFA" => "\xDA", # LATIN LETTER U WITH ACUTE
250 "\xFB" => "\xDB", # LATIN LETTER U WITH CIRCUMFLEX
251 "\xFC" => "\xDC", # LATIN LETTER U WITH DIAERESIS
252 "\xFD" => "\xDD", # LATIN LETTER Y WITH ACUTE
253 "\xFE" => "\xDE", # LATIN LETTER THORN
254 "\xFF" => "\xBE", # LATIN LETTER Y WITH DIAERESIS
255 );
256  
257 422 %fc = (%fc,
258 "\xA6" => "\xA8", # LATIN CAPITAL LETTER S WITH CARON --> LATIN SMALL LETTER S WITH CARON
259 "\xB4" => "\xB8", # LATIN CAPITAL LETTER Z WITH CARON --> LATIN SMALL LETTER Z WITH CARON
260 "\xBC" => "\xBD", # LATIN CAPITAL LIGATURE OE --> LATIN SMALL LIGATURE OE
261 "\xBE" => "\xFF", # LATIN CAPITAL LETTER Y WITH DIAERESIS --> LATIN SMALL LETTER Y WITH DIAERESIS
262 "\xC0" => "\xE0", # LATIN CAPITAL LETTER A WITH GRAVE --> LATIN SMALL LETTER A WITH GRAVE
263 "\xC1" => "\xE1", # LATIN CAPITAL LETTER A WITH ACUTE --> LATIN SMALL LETTER A WITH ACUTE
264 "\xC2" => "\xE2", # LATIN CAPITAL LETTER A WITH CIRCUMFLEX --> LATIN SMALL LETTER A WITH CIRCUMFLEX
265 "\xC3" => "\xE3", # LATIN CAPITAL LETTER A WITH TILDE --> LATIN SMALL LETTER A WITH TILDE
266 "\xC4" => "\xE4", # LATIN CAPITAL LETTER A WITH DIAERESIS --> LATIN SMALL LETTER A WITH DIAERESIS
267 "\xC5" => "\xE5", # LATIN CAPITAL LETTER A WITH RING ABOVE --> LATIN SMALL LETTER A WITH RING ABOVE
268 "\xC6" => "\xE6", # LATIN CAPITAL LETTER AE --> LATIN SMALL LETTER AE
269 "\xC7" => "\xE7", # LATIN CAPITAL LETTER C WITH CEDILLA --> LATIN SMALL LETTER C WITH CEDILLA
270 "\xC8" => "\xE8", # LATIN CAPITAL LETTER E WITH GRAVE --> LATIN SMALL LETTER E WITH GRAVE
271 "\xC9" => "\xE9", # LATIN CAPITAL LETTER E WITH ACUTE --> LATIN SMALL LETTER E WITH ACUTE
272 "\xCA" => "\xEA", # LATIN CAPITAL LETTER E WITH CIRCUMFLEX --> LATIN SMALL LETTER E WITH CIRCUMFLEX
273 "\xCB" => "\xEB", # LATIN CAPITAL LETTER E WITH DIAERESIS --> LATIN SMALL LETTER E WITH DIAERESIS
274 "\xCC" => "\xEC", # LATIN CAPITAL LETTER I WITH GRAVE --> LATIN SMALL LETTER I WITH GRAVE
275 "\xCD" => "\xED", # LATIN CAPITAL LETTER I WITH ACUTE --> LATIN SMALL LETTER I WITH ACUTE
276 "\xCE" => "\xEE", # LATIN CAPITAL LETTER I WITH CIRCUMFLEX --> LATIN SMALL LETTER I WITH CIRCUMFLEX
277 "\xCF" => "\xEF", # LATIN CAPITAL LETTER I WITH DIAERESIS --> LATIN SMALL LETTER I WITH DIAERESIS
278 "\xD0" => "\xF0", # LATIN CAPITAL LETTER ETH --> LATIN SMALL LETTER ETH
279 "\xD1" => "\xF1", # LATIN CAPITAL LETTER N WITH TILDE --> LATIN SMALL LETTER N WITH TILDE
280 "\xD2" => "\xF2", # LATIN CAPITAL LETTER O WITH GRAVE --> LATIN SMALL LETTER O WITH GRAVE
281 "\xD3" => "\xF3", # LATIN CAPITAL LETTER O WITH ACUTE --> LATIN SMALL LETTER O WITH ACUTE
282 "\xD4" => "\xF4", # LATIN CAPITAL LETTER O WITH CIRCUMFLEX --> LATIN SMALL LETTER O WITH CIRCUMFLEX
283 "\xD5" => "\xF5", # LATIN CAPITAL LETTER O WITH TILDE --> LATIN SMALL LETTER O WITH TILDE
284 "\xD6" => "\xF6", # LATIN CAPITAL LETTER O WITH DIAERESIS --> LATIN SMALL LETTER O WITH DIAERESIS
285 "\xD8" => "\xF8", # LATIN CAPITAL LETTER O WITH STROKE --> LATIN SMALL LETTER O WITH STROKE
286 "\xD9" => "\xF9", # LATIN CAPITAL LETTER U WITH GRAVE --> LATIN SMALL LETTER U WITH GRAVE
287 "\xDA" => "\xFA", # LATIN CAPITAL LETTER U WITH ACUTE --> LATIN SMALL LETTER U WITH ACUTE
288 "\xDB" => "\xFB", # LATIN CAPITAL LETTER U WITH CIRCUMFLEX --> LATIN SMALL LETTER U WITH CIRCUMFLEX
289 "\xDC" => "\xFC", # LATIN CAPITAL LETTER U WITH DIAERESIS --> LATIN SMALL LETTER U WITH DIAERESIS
290 "\xDD" => "\xFD", # LATIN CAPITAL LETTER Y WITH ACUTE --> LATIN SMALL LETTER Y WITH ACUTE
291 "\xDE" => "\xFE", # LATIN CAPITAL LETTER THORN --> LATIN SMALL LETTER THORN
292 "\xDF" => "\x73\x73", # LATIN SMALL LETTER SHARP S --> LATIN SMALL LETTER S, LATIN SMALL LETTER S
293 );
294 }
295  
296 else {
297 0 croak "Don't know my package name '@{[__PACKAGE__]}'";
298 }
299  
300 #
301 # @ARGV wildcard globbing
302 #
303 211 ▶sub import {
Subroutine import: called CC=7 SCAR=28.3
304  
305 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
306 0 my @argv = ();
307 0 for (@ARGV) {
308  
309 # has space
310 0 ▶ if (/\A (?:$q_char)*? [ ] /oxms) {
Branch: 2 branches
BranchTrueFalseTotal
if (/\A (?:$Elatin9::q_char)*? [ ] /mosx) { } 0 0 0
elsif (/\A (?:$Elatin9::q_char)*? [*?] /mosx) { } 0 0 0
311 0 ▶ if (my @glob = Elatin9::glob(qq{"$_"})) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@glob) = &Elatin9::glob(qq["$_"])) { } 0 0 0
312 0 push @argv, @glob;
313 }
314 else {
315 0 push @argv, $_;
316 }
317 }
318  
319 # has wildcard metachar
320 elsif (/\A (?:$q_char)*? [*?] /oxms) {
321 0 ▶ if (my @glob = Elatin9::glob($_)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@glob) = &Elatin9::glob($_)) { } 0 0 0
322 0 push @argv, @glob;
323 }
324 else {
325 0 push @argv, $_;
326 }
327 }
328  
329 # no wildcard globbing
330 else {
331 0 push @argv, $_;
332 }
333 }
334 0 @ARGV = @argv;
335 }
336  
337 211 *Char::ord = \&Latin9::ord;
338 211 *Char::ord_ = \&Latin9::ord_;
339 211 *Char::reverse = \&Latin9::reverse;
340 211 *Char::getc = \&Latin9::getc;
341 211 *Char::length = \&Latin9::length;
342 211 *Char::substr = \&Latin9::substr;
343 211 *Char::index = \&Latin9::index;
344 211 *Char::rindex = \&Latin9::rindex;
345 211 *Char::eval = \&Latin9::eval;
346 211 *Char::escape = \&Latin9::escape;
347 211 *Char::escape_token = \&Latin9::escape_token;
348 211 *Char::escape_script = \&Latin9::escape_script;
349 }
350  
351 # P.230 Care with Prototypes
352 # in Chapter 6: Subroutines
353 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
354 #
355 # If you aren't careful, you can get yourself into trouble with prototypes.
356 # But if you are careful, you can do a lot of neat things with them. This is
357 # all very powerful, of course, and should only be used in moderation to make
358 # the world a better place.
359  
360 # P.332 Care with Prototypes
361 # in Chapter 7: Subroutines
362 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
363 #
364 # If you aren't careful, you can get yourself into trouble with prototypes.
365 # But if you are careful, you can do a lot of neat things with them. This is
366 # all very powerful, of course, and should only be used in moderation to make
367 # the world a better place.
368  
369 #
370 # Prototypes of subroutines
371 #
372 0 ▶sub unimport {}
Subroutine unimport: not called CC=1 SCAR=0.0
373 sub Elatin9::split(;$$$);
374 sub Elatin9::tr($$$$;$);
375 sub Elatin9::chop(@);
376 sub Elatin9::index($$;$);
377 sub Elatin9::rindex($$;$);
378 sub Elatin9::lcfirst(@);
379 sub Elatin9::lcfirst_();
380 sub Elatin9::lc(@);
381 sub Elatin9::lc_();
382 sub Elatin9::ucfirst(@);
383 sub Elatin9::ucfirst_();
384 sub Elatin9::uc(@);
385 sub Elatin9::uc_();
386 sub Elatin9::fc(@);
387 sub Elatin9::fc_();
388 sub Elatin9::ignorecase;
389 sub Elatin9::classic_character_class;
390 sub Elatin9::capture;
391 sub Elatin9::chr(;$);
392 sub Elatin9::chr_();
393 sub Elatin9::glob($);
394 sub Elatin9::glob_();
395  
396 sub Latin9::ord(;$);
397 sub Latin9::ord_();
398 sub Latin9::reverse(@);
399 sub Latin9::getc(;*@);
400 sub Latin9::length(;$);
401 sub Latin9::substr($$;$$);
402 sub Latin9::index($$;$);
403 sub Latin9::rindex($$;$);
404 sub Latin9::escape(;$);
405  
406 #
407 # Regexp work
408 #
409 422 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
410 $re_a
411 $re_t
412 $re_n
413 $re_r
414 422 );
415  
416 #
417 # Character class
418 #
419 422 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
420 $dot
421 $dot_s
422 $eD
423 $eS
424 $eW
425 $eH
426 $eV
427 $eR
428 $eN
429 $not_alnum
430 $not_alpha
431 $not_ascii
432 $not_blank
433 $not_cntrl
434 $not_digit
435 $not_graph
436 $not_lower
437 $not_lower_i
438 $not_print
439 $not_punct
440 $not_space
441 $not_upper
442 $not_upper_i
443 $not_word
444 $not_xdigit
445 $eb
446 $eB
447 422 );
448  
449 422 ${Elatin9::dot} = qr{(?>[^\x0A])};
450 422 ${Elatin9::dot_s} = qr{(?>[\x00-\xFF])};
451 422 ${Elatin9::eD} = qr{(?>[^0-9])};
452  
453 # Vertical tabs are now whitespace
454 # \s in a regex now matches a vertical tab in all circumstances.
455 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
456 # ${Elatin9::eS} = qr{(?>[^\x09\x0A \x0C\x0D\x20])};
457 # ${Elatin9::eS} = qr{(?>[^\x09\x0A\x0B\x0C\x0D\x20])};
458 422 ${Elatin9::eS} = qr{(?>[^\s])};
459  
460 422 ${Elatin9::eW} = qr{(?>[^0-9A-Z_a-z])};
461 422 ${Elatin9::eH} = qr{(?>[^\x09\x20])};
462 422 ${Elatin9::eV} = qr{(?>[^\x0A\x0B\x0C\x0D])};
463 422 ${Elatin9::eR} = qr{(?>\x0D\x0A|[\x0A\x0D])};
464 422 ${Elatin9::eN} = qr{(?>[^\x0A])};
465 422 ${Elatin9::not_alnum} = qr{(?>[^\x30-\x39\x41-\x5A\x61-\x7A])};
466 422 ${Elatin9::not_alpha} = qr{(?>[^\x41-\x5A\x61-\x7A])};
467 422 ${Elatin9::not_ascii} = qr{(?>[^\x00-\x7F])};
468 422 ${Elatin9::not_blank} = qr{(?>[^\x09\x20])};
469 422 ${Elatin9::not_cntrl} = qr{(?>[^\x00-\x1F\x7F])};
470 422 ${Elatin9::not_digit} = qr{(?>[^\x30-\x39])};
471 422 ${Elatin9::not_graph} = qr{(?>[^\x21-\x7F])};
472 422 ${Elatin9::not_lower} = qr{(?>[^\x61-\x7A])};
473 422 ${Elatin9::not_lower_i} = qr{(?>[^\x41-\x5A\x61-\x7A])}; # Perl 5.16 compatible
474 # ${Elatin9::not_lower_i} = qr{(?>[\x00-\xFF])}; # older Perl compatible
475 422 ${Elatin9::not_print} = qr{(?>[^\x20-\x7F])};
476 422 ${Elatin9::not_punct} = qr{(?>[^\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E])};
477 422 ${Elatin9::not_space} = qr{(?>[^\s\x0B])};
478 422 ${Elatin9::not_upper} = qr{(?>[^\x41-\x5A])};
479 422 ${Elatin9::not_upper_i} = qr{(?>[^\x41-\x5A\x61-\x7A])}; # Perl 5.16 compatible
480 # ${Elatin9::not_upper_i} = qr{(?>[\x00-\xFF])}; # older Perl compatible
481 422 ${Elatin9::not_word} = qr{(?>[^\x30-\x39\x41-\x5A\x5F\x61-\x7A])};
482 422 ${Elatin9::not_xdigit} = qr{(?>[^\x30-\x39\x41-\x46\x61-\x66])};
483 422 ${Elatin9::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))};
484 422 ${Elatin9::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]))};
485  
486 # avoid: Name "Elatin9::foo" used only once: possible typo at here.
487 422 ${Elatin9::dot} = ${Elatin9::dot};
488 422 ${Elatin9::dot_s} = ${Elatin9::dot_s};
489 422 ${Elatin9::eD} = ${Elatin9::eD};
490 422 ${Elatin9::eS} = ${Elatin9::eS};
491 422 ${Elatin9::eW} = ${Elatin9::eW};
492 422 ${Elatin9::eH} = ${Elatin9::eH};
493 422 ${Elatin9::eV} = ${Elatin9::eV};
494 422 ${Elatin9::eR} = ${Elatin9::eR};
495 422 ${Elatin9::eN} = ${Elatin9::eN};
496 422 ${Elatin9::not_alnum} = ${Elatin9::not_alnum};
497 422 ${Elatin9::not_alpha} = ${Elatin9::not_alpha};
498 422 ${Elatin9::not_ascii} = ${Elatin9::not_ascii};
499 422 ${Elatin9::not_blank} = ${Elatin9::not_blank};
500 422 ${Elatin9::not_cntrl} = ${Elatin9::not_cntrl};
501 422 ${Elatin9::not_digit} = ${Elatin9::not_digit};
502 422 ${Elatin9::not_graph} = ${Elatin9::not_graph};
503 422 ${Elatin9::not_lower} = ${Elatin9::not_lower};
504 422 ${Elatin9::not_lower_i} = ${Elatin9::not_lower_i};
505 422 ${Elatin9::not_print} = ${Elatin9::not_print};
506 422 ${Elatin9::not_punct} = ${Elatin9::not_punct};
507 422 ${Elatin9::not_space} = ${Elatin9::not_space};
508 422 ${Elatin9::not_upper} = ${Elatin9::not_upper};
509 422 ${Elatin9::not_upper_i} = ${Elatin9::not_upper_i};
510 422 ${Elatin9::not_word} = ${Elatin9::not_word};
511 422 ${Elatin9::not_xdigit} = ${Elatin9::not_xdigit};
512 422 ${Elatin9::eb} = ${Elatin9::eb};
513 422 ${Elatin9::eB} = ${Elatin9::eB};
514  
515 #
516 # Latin-9 split
517 #
518 72 ▶sub Elatin9::split(;$$$) {
Subroutine split: called CC=34 SCAR=46.9
Pod undocumented
519  
520 # P.794 29.2.161. split
521 # in Chapter 29: Functions
522 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
523  
524 # P.951 split
525 # in Chapter 27: Functions
526 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
527  
528 72 my $pattern = $_[0];
529 72 my $string = $_[1];
530 72 my $limit = $_[2];
531  
532 # if $pattern is also omitted or is the literal space, " "
533 72 ▶ if (not defined $pattern) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $pattern) 2 70 72
534 2 $pattern = ' ';
535 }
536  
537 # if $string is omitted, the function splits the $_ string
538 72 ▶ if (not defined $string) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $string) 6 66 72
539 6 ▶ if (defined $_) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_) { } 0 6 6
540 0 $string = $_;
541 }
542 else {
543 6 $string = '';
544 }
545 }
546  
547 72 my @split = ();
548  
549 # when string is empty
550 72 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 10 62 72
elsif ($pattern eq ' ') { } 2 60 62
551  
552 # resulting list value in list context
553 10 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 5 5 10
554 5 return @split;
555 }
556  
557 # count of substrings in scalar context
558 else {
559 5 ▶ carp "Use of implicit split to \@_ is deprecated" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 5 5
560 5 @_ = @split;
561 5 return scalar @_;
562 }
563 }
564  
565 # split's first argument is more consistently interpreted
566 #
567 # After some changes earlier in v5.17, split's behavior has been simplified:
568 # if the PATTERN argument evaluates to a string containing one space, it is
569 # treated the way that a literal string containing one space once was.
570 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#split's_first_argument_is_more_consistently_interpreted
571  
572 # if $pattern is also omitted or is the literal space, " ", the function splits
573 # on whitespace, /\s+/, after skipping any leading whitespace
574 # (and so on)
575  
576 elsif ($pattern eq ' ') {
577 2 ▶ if (not defined $limit) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $limit) { } 2 0 2
578 2 return CORE::split(' ', $string);
579 }
580 else {
581 0 return CORE::split(' ', $string, $limit);
582 }
583 }
584  
585 # if $limit is negative, it is treated as if an arbitrarily large $limit has been specified
586 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
587  
588 # a pattern capable of matching either the null string or something longer than the
589 # null string will split the value of $string into separate characters wherever it
590 # matches the null string between characters
591 # (and so on)
592  
593 60 ▶ if ('' =~ / \A $pattern \z /xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ('' =~ / \A $pattern \z /msx) { } 2 58 60
594 2 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
595 2 my $limit = scalar(() = $string =~ /($pattern)/oxmsg);
596  
597 # P.1024 Appendix W.10 Multibyte Processing
598 # of ISBN 1-56592-224-7 CJKV Information Processing
599 # (and so on)
600  
601 # the //m modifier is assumed when you split on the pattern /^/
602 # (and so on)
603  
604 # V
605 2 ▶ while ((--$limit > 0) and ($string =~ s/\A((?:$q_char)+?)$pattern//m)) {
Branch: 1 branch
BranchTrueFalseTotal
if (--$limit > 0 and $string =~ s/\A((?:$Elatin9::q_char)+?)$pattern//m) 9 2 11
Condition100%3/3
--$limit > 0 and $string =~ s/\A((?:$Elatin9::q_char)+?)$pattern//m
!ll&&!rl&&r
119
MC/DC100%2/2
--$limit > 0 and $string =~ s/\A((?:$Elatin9::q_char)+?)$pattern//m
--$limit > 0 $string =~ s/\A((?:$Elatin9::q_char)+?)$pattern//m
Truth table100%3/3
A and B
A= --$limit > 0B= $string =~ s/\A((?:$Elatin9::q_char)+?)$pattern//m
ABresult
0X0
100
111
606  
607 # if the $pattern contains parentheses, then the substring matched by each pair of parentheses
608 # is included in the resulting list, interspersed with the fields that are ordinarily returned
609 # (and so on)
610  
611 9 local $@;
612 9 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 9 9 18
613 9 push @split, CORE::eval('$' . $digit);
614 }
615 }
616 }
617  
618 else {
619 58 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
620  
621 # V
622 58 ▶ while ($string =~ s/\A((?:$q_char)*?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Elatin9::q_char)*?)$pattern//m) 163 58 221
623 163 local $@;
624 163 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 230 163 393
625 230 push @split, CORE::eval('$' . $digit);
626 }
627 }
628 }
629 }
630  
631 elsif ($limit > 0) {
632 0 ▶ if ('' =~ / \A $pattern \z /xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ('' =~ / \A $pattern \z /msx) { } 0 0 0
633 0 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
634 0 ▶ while ((--$limit > 0) and (CORE::length($string) > 0)) {
Branch: 1 branch
BranchTrueFalseTotal
if (--$limit > 0 and length $string > 0) 0 0 0
Condition0%0/3
--$limit > 0 and length $string > 0
!ll&&!rl&&r
000
MC/DC0%0/2
--$limit > 0 and length $string > 0
--$limit > 0 length $string > 0
Truth table0%0/3
A and B
A= --$limit > 0B= length $string > 0
ABresult
0X0
100
111
635  
636 # V
637 0 ▶ if ($string =~ s/\A((?:$q_char)+?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Elatin9::q_char)+?)$pattern//m) 0 0 0
638 0 local $@;
639 0 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 0 0 0
640 0 push @split, CORE::eval('$' . $digit);
641 }
642 }
643 }
644 }
645 else {
646 0 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
647 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
648  
649 # V
650 0 ▶ if ($string =~ s/\A((?:$q_char)*?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Elatin9::q_char)*?)$pattern//m) 0 0 0
651 0 local $@;
652 0 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 0 0 0
653 0 push @split, CORE::eval('$' . $digit);
654 }
655 }
656 }
657 }
658 }
659  
660 60 ▶ if (CORE::length($string) > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $string > 0) 58 2 60
661 58 push @split, $string;
662 }
663  
664 # if $_[2] (NOT "$limit") is omitted or zero, trailing null fields are stripped from the result
665 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
666 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
667 0 pop @split;
668 }
669 }
670  
671 # resulting list value in list context
672 60 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 58 2 60
673 58 return @split;
674 }
675  
676 # count of substrings in scalar context
677 else {
678 2 ▶ carp "Use of implicit split to \@_ is deprecated" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 2 2
679 2 @_ = @split;
680 2 return scalar @_;
681 }
682 }
683  
684 #
685 # get last subexpression offsets
686 #
687 60 ▶sub _last_subexpression_offsets {
Subroutine _last_subexpression_offsets: called CC=3 SCAR=11.0
688 60 my $pattern = $_[0];
689  
690 # remove comment
691 60 $pattern =~ s/\(\?\# .*? \)//oxmsg;
692  
693 60 my $modifier = '';
694 60 ▶ if ($pattern =~ /\(\?\^? ([\-A-Za-z]+) :/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pattern =~ /\(\?\^? ([\-A-Za-z]+) :/mosx) 11 49 60
695 11 $modifier = $1;
696 11 $modifier =~ s/-[A-Za-z]*//;
697 }
698  
699 # with /x modifier
700 60 my @char = ();
701 60 ▶ if ($modifier =~ /x/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /x/mosx) { } 5 55 60
702 5 @char = $pattern =~ /\G((?>
703 [^\\\#\[\(] |
704 \\ $q_char |
705 \# (?>[^\n]*) $ |
706 \[ (?>(?:[^\\\]]|\\\\|\\\]|$q_char)+) \] |
707 \(\? |
708 $q_char
709 ))/oxmsg;
710 }
711  
712 # without /x modifier
713 else {
714 55 @char = $pattern =~ /\G((?>
715 [^\\\[\(] |
716 \\ $q_char |
717 \[ (?>(?:[^\\\]]|\\\\|\\\]|$q_char)+) \] |
718 \(\? |
719 $q_char
720 ))/oxmsg;
721 }
722  
723 60 return scalar grep { $_ eq '(' } @char;
724 }
725  
726 #
727 # Latin-9 transliteration (tr///)
728 #
729 6 ▶sub Elatin9::tr($$$$;$) {
Subroutine tr: called CC=26 SCAR=48.6
Pod undocumented
730  
731 6 my $bind_operator = $_[1];
732 6 my $searchlist = $_[2];
733 6 my $replacementlist = $_[3];
734 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
735  
736 6 ▶ if ($modifier =~ /r/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /r/mosx) 5 1 6
737 5 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) 0 5 5
738 0 croak "Using !~ with tr///r doesn't make sense";
739 }
740 }
741  
742 6 my @char = $_[0] =~ /\G (?>$q_char) /oxmsg;
743 6 my @searchlist = _charlist_tr($searchlist);
744 6 my @replacementlist = _charlist_tr($replacementlist);
745  
746 6 my %tr = ();
747 6 ▶ for (my $i=0; $i <= $#searchlist; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#searchlist) 19 6 25
748 19 ▶ if (not exists $tr{$searchlist[$i]}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $tr{$searchlist[$i]}) 19 0 19
749 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
750 19 $tr{$searchlist[$i]} = $replacementlist[$i];
751 }
752 elsif ($modifier =~ /d/oxms) {
753 0 $tr{$searchlist[$i]} = '';
754 }
755 ▶ 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
756 0 $tr{$searchlist[$i]} = $replacementlist[-1];
757 }
758 else {
759 0 $tr{$searchlist[$i]} = $searchlist[$i];
760 }
761 }
762 }
763  
764 6 my $tr = 0;
765 6 my $replaced = '';
766 6 ▶ if ($modifier =~ /c/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /c/mosx) { } 0 6 6
767 0 ▶ while (defined(my $char = shift @char)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $char = shift @char)) 0 0 0
768 0 ▶ if (not exists $tr{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $tr{$char}) { } 0 0 0
769 0 ▶ if (defined $replacementlist[0]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $replacementlist[0]) 0 0 0
770 0 $replaced .= $replacementlist[0];
771 }
772 0 $tr++;
773 0 ▶ if ($modifier =~ /s/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/mosx) 0 0 0
774 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
775 0 shift @char;
776 0 $tr++;
777 }
778 }
779 }
780 else {
781 0 $replaced .= $char;
782 }
783 }
784 }
785 else {
786 6 ▶ while (defined(my $char = shift @char)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $char = shift @char)) 36 6 42
787 36 ▶ if (exists $tr{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $tr{$char}) { } 19 17 36
788 19 $replaced .= $tr{$char};
789 19 $tr++;
790 19 ▶ if ($modifier =~ /s/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/mosx) 0 19 19
791 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
792 0 shift @char;
793 0 $tr++;
794 }
795 }
796 }
797 else {
798 17 $replaced .= $char;
799 }
800 }
801 }
802  
803 6 ▶ if ($modifier =~ /r/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /r/mosx) { } 5 1 6
804 5 return $replaced;
805 }
806 else {
807 1 $_[0] = $replaced;
808 1 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) { } 0 1 1
809 0 return not $tr;
810 }
811 else {
812 1 return $tr;
813 }
814 }
815 }
816  
817 #
818 # Latin-9 chop
819 #
820 0 ▶sub Elatin9::chop(@) {
Subroutine chop: not called CC=3 SCAR=24.8
Pod undocumented
821  
822 0 my $chop;
823 0 ▶ if (@_ == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 0) { } 0 0 0
824 0 my @char = /\G (?>$q_char) /oxmsg;
825 0 $chop = pop @char;
826 0 $_ = join '', @char;
827 }
828 else {
829 0 for (@_) {
830 0 my @char = /\G (?>$q_char) /oxmsg;
831 0 $chop = pop @char;
832 0 $_ = join '', @char;
833 }
834 }
835 0 return $chop;
836 }
837  
838 #
839 # Latin-9 index by octet
840 #
841 30 ▶sub Elatin9::index($$;$) {
Subroutine index: called CC=6 SCAR=20.8
Pod documented
842  
843 30 my($str,$substr,$position) = @_;
844 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
845 30 my $pos = 0;
846  
847 30 ▶ while ($pos < CORE::length($str)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos < length $str) 130 30 160
848 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
849 0 ▶ if ($pos >= $position) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos >= $position) 0 0 0
850 0 return $pos;
851 }
852 }
853 130 ▶ if (CORE::substr($str,$pos) =~ /\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($str, $pos) =~ /\A ($Elatin9::q_char) /mosx) { } 130 0 130
854 130 $pos += CORE::length($1);
855 }
856 else {
857 0 $pos += 1;
858 }
859 }
860 30 return -1;
861 }
862  
863 #
864 # Latin-9 reverse index
865 #
866 0 ▶sub Elatin9::rindex($$;$) {
Subroutine rindex: not called CC=6 SCAR=37.4
Pod undocumented
867  
868 0 my($str,$substr,$position) = @_;
869 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
870 0 my $pos = 0;
871 0 my $rindex = -1;
872  
873 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
874 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
875 0 $rindex = $pos;
876 }
877 0 ▶ if (CORE::substr($str,$pos) =~ /\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($str, $pos) =~ /\A ($Elatin9::q_char) /mosx) { } 0 0 0
878 0 $pos += CORE::length($1);
879 }
880 else {
881 0 $pos += 1;
882 }
883 }
884 0 return $rindex;
885 }
886  
887 #
888 # Latin-9 lower case first with parameter
889 #
890 0 ▶sub Elatin9::lcfirst(@) {
Subroutine lcfirst: not called CC=4 SCAR=30.0
Pod undocumented
891 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
892 0 my $s = shift @_;
893 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
894 0 return Elatin9::lc(CORE::substr($s,0,1)) . CORE::substr($s,1), @_;
895 }
896 else {
897 0 return Elatin9::lc(CORE::substr($s,0,1)) . CORE::substr($s,1);
898 }
899 }
900 else {
901 0 return Elatin9::lc(CORE::substr($_,0,1)) . CORE::substr($_,1);
902 }
903 }
904  
905 #
906 # Latin-9 lower case first without parameter
907 #
908 0 ▶sub Elatin9::lcfirst_() {
Subroutine lcfirst_: not called CC=1 SCAR=6.9
Pod undocumented
909 0 return Elatin9::lc(CORE::substr($_,0,1)) . CORE::substr($_,1);
910 }
911  
912 #
913 # Latin-9 lower case with parameter
914 #
915 61 ▶sub Elatin9::lc(@) {
Subroutine lc: called CC=6 SCAR=24.2
Pod undocumented
916 61 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 61 0 61
917 61 my $s = shift @_;
918 61 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 61 61
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
6100
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
919 0 ▶ return join('', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 0 0 0
920 }
921 else {
922 61 ▶ return join('', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 63 0 63
923 }
924 }
925 else {
926 0 return Elatin9::lc_();
927 }
928 }
929  
930 #
931 # Latin-9 lower case without parameter
932 #
933 0 ▶sub Elatin9::lc_() {
Subroutine lc_: not called CC=2 SCAR=17.9
Pod undocumented
934 0 my $s = $_;
935 0 ▶ return join '', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 0 0 0
936 }
937  
938 #
939 # Latin-9 upper case first with parameter
940 #
941 0 ▶sub Elatin9::ucfirst(@) {
Subroutine ucfirst: not called CC=4 SCAR=30.0
Pod undocumented
942 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
943 0 my $s = shift @_;
944 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
945 0 return Elatin9::uc(CORE::substr($s,0,1)) . CORE::substr($s,1), @_;
946 }
947 else {
948 0 return Elatin9::uc(CORE::substr($s,0,1)) . CORE::substr($s,1);
949 }
950 }
951 else {
952 0 return Elatin9::uc(CORE::substr($_,0,1)) . CORE::substr($_,1);
953 }
954 }
955  
956 #
957 # Latin-9 upper case first without parameter
958 #
959 0 ▶sub Elatin9::ucfirst_() {
Subroutine ucfirst_: not called CC=1 SCAR=6.9
Pod undocumented
960 0 return Elatin9::uc(CORE::substr($_,0,1)) . CORE::substr($_,1);
961 }
962  
963 #
964 # Latin-9 upper case with parameter
965 #
966 2453 ▶sub Elatin9::uc(@) {
Subroutine uc: called CC=6 SCAR=22.9
Pod undocumented
967 2453 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2453 0 2453
968 2453 my $s = shift @_;
969 2453 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 2453 2453
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
245300
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
970 0 ▶ return join('', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 0 0 0
971 }
972 else {
973 2453 ▶ return join('', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 877 1578 2455
974 }
975 }
976 else {
977 0 return Elatin9::uc_();
978 }
979 }
980  
981 #
982 # Latin-9 upper case without parameter
983 #
984 0 ▶sub Elatin9::uc_() {
Subroutine uc_: not called CC=2 SCAR=17.9
Pod undocumented
985 0 my $s = $_;
986 0 ▶ return join '', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 0 0 0
987 }
988  
989 #
990 # Latin-9 fold case with parameter
991 #
992 2463 ▶sub Elatin9::fc(@) {
Subroutine fc: called CC=6 SCAR=22.9
Pod undocumented
993 2463 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2463 0 2463
994 2463 my $s = shift @_;
995 2463 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 2463 2463
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
246300
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
996 0 ▶ return join('', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 0 0 0
997 }
998 else {
999 2463 ▶ return join('', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 1847 5743 7590
1000 }
1001 }
1002 else {
1003 0 return Elatin9::fc_();
1004 }
1005 }
1006  
1007 #
1008 # Latin-9 fold case without parameter
1009 #
1010 0 ▶sub Elatin9::fc_() {
Subroutine fc_: not called CC=2 SCAR=17.9
Pod undocumented
1011 0 my $s = $_;
1012 0 ▶ return join '', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 0 0 0
1013 }
1014  
1015 #
1016 # Latin-9 regexp capture
1017 #
1018 {
1019 0 ▶ sub Elatin9::capture {
Subroutine capture: not called CC=1 SCAR=6.9
Pod documented
1020 0 return $_[0];
1021 }
1022 }
1023  
1024 #
1025 # Latin-9 regexp ignore case modifier
1026 #
1027 422 ▶sub Elatin9::ignorecase {
Subroutine ignorecase: called CC=25 SCAR=52.1
Pod undocumented
1028  
1029 11 my @string = @_;
1030 11 my $metachar = qr/[\@\\|[\]{]/oxms;
1031  
1032 # ignore case of $scalar or @array
1033 11 for my $string (@string) {
1034  
1035 # split regexp
1036 11 my @char = $string =~ /\G (?>\[\^|\\$q_char|$q_char) /oxmsg;
1037  
1038 # unescape character
1039 11 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 988 11 999
1040 988 ▶ next if not defined $char[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $char[$i] 0 988 988
1041  
1042 # open character class [...]
1043 988 ▶ if ($char[$i] eq '[') {
Branch: 4 branches
BranchTrueFalseTotal
if ($char[$i] eq '[') { } 0 988 988
elsif ($char[$i] eq '[^') { } 0 988 988
elsif (my $char = classic_character_class($char[$i])) { } 0 988 988
elsif ($char[$i] =~ /\A [\x00-\xFF] \z/mosx) { } 988 0 988
1044 0 my $left = $i;
1045  
1046 # [] make die "unmatched [] in regexp ...\n"
1047  
1048 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
1049 0 $i++;
1050 }
1051  
1052 0 while (1) {
1053 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
1054 0 croak "Unmatched [] in regexp";
1055 }
1056 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
1057 0 my $right = $i;
1058 0 my @charlist = charlist_qr(@char[$left+1..$right-1], 'i');
1059  
1060 # escape character
1061 0 for my $char (@charlist) {
1062 0 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $char =~ /\A [.|)] \z/mosx }) 0 0 0
1063 }
1064  
1065 0 elsif ($char =~ /\A [.|)] \z/oxms) {
1066 0 $char = '\\' . $char;
1067 }
1068 }
1069  
1070 # [...]
1071 0 splice @char, $left, $right-$left+1, '(?:' . join('|', @charlist) . ')';
1072  
1073 0 $i = $left;
1074 0 last;
1075 }
1076 }
1077 }
1078  
1079 # open character class [^...]
1080 elsif ($char[$i] eq '[^') {
1081 0 my $left = $i;
1082  
1083 # [^] make die "unmatched [] in regexp ...\n"
1084  
1085 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
1086 0 $i++;
1087 }
1088  
1089 0 while (1) {
1090 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
1091 0 croak "Unmatched [] in regexp";
1092 }
1093 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
1094 0 my $right = $i;
1095 0 my @charlist = charlist_not_qr(@char[$left+1..$right-1], 'i');
1096  
1097 # escape character
1098 0 for my $char (@charlist) {
1099 0 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $char =~ /\A [.|)] \z/mosx }) 0 0 0
1100 }
1101  
1102 0 elsif ($char =~ /\A [.|)] \z/oxms) {
1103 0 $char = '\\' . $char;
1104 }
1105 }
1106  
1107 # [^...]
1108 0 splice @char, $left, $right-$left+1, '(?!' . join('|', @charlist) . ")(?:$your_char)";
1109  
1110 0 $i = $left;
1111 0 last;
1112 }
1113 }
1114 }
1115  
1116 # rewrite classic character class or escape character
1117 elsif (my $char = classic_character_class($char[$i])) {
1118 0 $char[$i] = $char;
1119 }
1120  
1121 # with /i modifier
1122 elsif ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) {
1123 988 my $uc = Elatin9::uc($char[$i]);
1124 988 my $fc = Elatin9::fc($char[$i]);
1125 988 ▶ if ($uc ne $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc ne $fc) 508 480 988
1126 508 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 505 3 508
1127 505 $char[$i] = '[' . $uc . $fc . ']';
1128 }
1129 else {
1130 3 $char[$i] = '(?:' . $uc . '|' . $fc . ')';
1131 }
1132 }
1133 }
1134 }
1135  
1136 # characterize
1137 11 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 988 11 999
1138 988 ▶ next if not defined $char[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $char[$i] 0 988 988
1139  
1140 988 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx }) 0 999 999
1141 }
1142  
1143 # quote character before ? + * {
1144 0 ▶ elsif (($i >= 1) and ($char[$i] =~ /\A [\?\+\*\{] \z/oxms)) {
Condition66%2/3
$i >= 1 && $char[$i] =~ /\A [\?\+\*\{] \z/mosx
!ll&&!rl&&r
119770
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
1145 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
1146 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
1147 }
1148 }
1149 }
1150  
1151 11 $string = join '', @char;
1152 }
1153  
1154 # make regexp string
1155 11 return @string;
1156 }
1157  
1158 #
1159 # classic character class ( \D \S \W \d \s \w \C \X \H \V \h \v \R \N \b \B )
1160 #
1161 2856 ▶sub Elatin9::classic_character_class {
Subroutine classic_character_class: called CC=2 SCAR=6.9
Pod undocumented
1162 2856 my($char) = @_;
1163  
1164 return {
1165 '\D' => '${Elatin9::eD}',
1166 '\S' => '${Elatin9::eS}',
1167 '\W' => '${Elatin9::eW}',
1168 '\d' => '[0-9]',
1169  
1170 # Before Perl 5.6, \s only matched the five whitespace characters
1171 # tab, newline, form-feed, carriage return, and the space character
1172 # itself, which, taken together, is the character class [\t\n\f\r ].
1173  
1174 # Vertical tabs are now whitespace
1175 # \s in a regex now matches a vertical tab in all circumstances.
1176 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
1177 # \t \n \v \f \r space
1178 # '\s' => '[\x09\x0A \x0C\x0D\x20]',
1179 # '\s' => '[\x09\x0A\x0B\x0C\x0D\x20]',
1180 '\s' => '\s',
1181  
1182 '\w' => '[0-9A-Z_a-z]',
1183 '\C' => '[\x00-\xFF]',
1184 '\X' => 'X',
1185  
1186 # \h \v \H \V
1187  
1188 # P.114 Character Class Shortcuts
1189 # in Chapter 7: In the World of Regular Expressions
1190 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
1191  
1192 # P.357 13.2.3 Whitespace
1193 # in Chapter 13: perlrecharclass: Perl Regular Expression Character Classes
1194 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
1195 #
1196 # 0x00009 CHARACTER TABULATION h s
1197 # 0x0000a LINE FEED (LF) vs
1198 # 0x0000b LINE TABULATION v
1199 # 0x0000c FORM FEED (FF) vs
1200 # 0x0000d CARRIAGE RETURN (CR) vs
1201 # 0x00020 SPACE h s
1202  
1203 # P.196 Table 5-9. Alphanumeric regex metasymbols
1204 # in Chapter 5. Pattern Matching
1205 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1206  
1207 # (and so on)
1208  
1209 '\H' => '${Elatin9::eH}',
1210 '\V' => '${Elatin9::eV}',
1211 '\h' => '[\x09\x20]',
1212 '\v' => '[\x0A\x0B\x0C\x0D]',
1213 '\R' => '${Elatin9::eR}',
1214  
1215 # \N
1216 #
1217 # http://perldoc.perl.org/perlre.html
1218 # Character Classes and other Special Escapes
1219 # Any character but \n (experimental). Not affected by /s modifier
1220  
1221 '\N' => '${Elatin9::eN}',
1222  
1223 # \b \B
1224  
1225 # P.180 Boundaries: The \b and \B Assertions
1226 # in Chapter 5: Pattern Matching
1227 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
1228  
1229 # P.219 Boundaries: The \b and \B Assertions
1230 # in Chapter 5: Pattern Matching
1231 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1232  
1233 # \b really means (?:(?<=\w)(?!\w)|(?<!\w)(?=\w))
1234 # or (?:(?<=\A|\W)(?=\w)|(?<=\w)(?=\W|\z))
1235 '\b' => '${Elatin9::eb}',
1236  
1237 # \B really means (?:(?<=\w)(?=\w)|(?<!\w)(?!\w))
1238 # or (?:(?<=\w)(?=\w)|(?<=\W)(?=\W))
1239 '\B' => '${Elatin9::eB}',
1240  
1241 2856 ▶ }->{$char} || '';
Condition100%2/2
{'\\D', '${Elatin9::eD}', '\\S', '${Elatin9::eS}', '\\W', '${Elatin9::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin9::eH}', '\\V', '${Elatin9::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin9::eR}', '\\N', '${Elatin9::eN}', '\\b', '${Elatin9::eb}', '\\B', '${Elatin9::eB}'}->{$char} || ''
l!l
1012755
MC/DC100%1/1
{'\\D', '${Elatin9::eD}', '\\S', '${Elatin9::eS}', '\\W', '${Elatin9::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin9::eH}', '\\V', '${Elatin9::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin9::eR}', '\\N', '${Elatin9::eN}', '\\b', '${Elatin9::eb}', '\\B', '${Elatin9::eB}'}->{$char} || ''
{'\\D', '${Elatin9::eD}', '\\S', '${Elatin9::eS}', '\\W', '${Elatin9::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin9::eH}', '\\V', '${Elatin9::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin9::eR}', '\\N', '${Elatin9::eN}', '\\b', '${Elatin9::eb}', '\\B', '${Elatin9::eB}'}->{$char}
Truth table100%2/2
A
A= {'\\D', '${Elatin9::eD}', '\\S', '${Elatin9::eS}', '\\W', '${Elatin9::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin9::eH}', '\\V', '${Elatin9::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin9::eR}', '\\N', '${Elatin9::eN}', '\\b', '${Elatin9::eb}', '\\B', '${Elatin9::eB}'}->{$char}
Aresult
11
00
1242 }
1243  
1244 #
1245 # prepare Latin-9 characters per length
1246 #
1247  
1248 # 1 octet characters
1249 422 my @chars1 = ();
1250 0 ▶sub chars1 {
Subroutine chars1: not called CC=5 SCAR=34.0
Pod undocumented
1251 0 ▶ if (@chars1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars1) 0 0 0
1252 0 return @chars1;
1253 }
1254 0 ▶ if (exists $range_tr{1}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{1}) 0 0 0
1255 0 my @ranges = @{ $range_tr{1} };
1256 0 ▶ while (my @range = splice(@ranges,0,1)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 1)) 0 0 0
1257 0 for my $oct0 (@{$range[0]}) {
1258 0 push @chars1, pack 'C', $oct0;
1259 }
1260 }
1261 }
1262 0 return @chars1;
1263 }
1264  
1265 # 2 octets characters
1266 422 my @chars2 = ();
1267 0 ▶sub chars2 {
Subroutine chars2: not called CC=6 SCAR=37.4
Pod undocumented
1268 0 ▶ if (@chars2) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars2) 0 0 0
1269 0 return @chars2;
1270 }
1271 0 ▶ if (exists $range_tr{2}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{2}) 0 0 0
1272 0 my @ranges = @{ $range_tr{2} };
1273 0 ▶ while (my @range = splice(@ranges,0,2)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 2)) 0 0 0
1274 0 for my $oct0 (@{$range[0]}) {
1275 0 for my $oct1 (@{$range[1]}) {
1276 0 push @chars2, pack 'CC', $oct0,$oct1;
1277 }
1278 }
1279 }
1280 }
1281 0 return @chars2;
1282 }
1283  
1284 # 3 octets characters
1285 422 my @chars3 = ();
1286 0 ▶sub chars3 {
Subroutine chars3: not called CC=7 SCAR=40.3
Pod undocumented
1287 0 ▶ if (@chars3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars3) 0 0 0
1288 0 return @chars3;
1289 }
1290 0 ▶ if (exists $range_tr{3}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{3}) 0 0 0
1291 0 my @ranges = @{ $range_tr{3} };
1292 0 ▶ while (my @range = splice(@ranges,0,3)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 3)) 0 0 0
1293 0 for my $oct0 (@{$range[0]}) {
1294 0 for my $oct1 (@{$range[1]}) {
1295 0 for my $oct2 (@{$range[2]}) {
1296 0 push @chars3, pack 'CCC', $oct0,$oct1,$oct2;
1297 }
1298 }
1299 }
1300 }
1301 }
1302 0 return @chars3;
1303 }
1304  
1305 # 4 octets characters
1306 422 my @chars4 = ();
1307 0 ▶sub chars4 {
Subroutine chars4: not called CC=8 SCAR=42.8
Pod undocumented
1308 0 ▶ if (@chars4) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars4) 0 0 0
1309 0 return @chars4;
1310 }
1311 0 ▶ if (exists $range_tr{4}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{4}) 0 0 0
1312 0 my @ranges = @{ $range_tr{4} };
1313 0 ▶ while (my @range = splice(@ranges,0,4)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 4)) 0 0 0
1314 0 for my $oct0 (@{$range[0]}) {
1315 0 for my $oct1 (@{$range[1]}) {
1316 0 for my $oct2 (@{$range[2]}) {
1317 0 for my $oct3 (@{$range[3]}) {
1318 0 push @chars4, pack 'CCCC', $oct0,$oct1,$oct2,$oct3;
1319 }
1320 }
1321 }
1322 }
1323 }
1324 }
1325 0 return @chars4;
1326 }
1327  
1328 #
1329 # Latin-9 open character list for tr
1330 #
1331 12 ▶sub _charlist_tr {
Subroutine _charlist_tr: called CC=35 SCAR=66.4
1332  
1333 12 local $_ = shift @_;
1334  
1335 # unescape character
1336 12 my @char = ();
1337 12 ▶ while (not /\G \z/oxmsgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgmosx) 38 12 50
1338 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 \\ ($Elatin9::q_char) /cgmosx) { } 0 38 38
elsif (/\G ($Elatin9::q_char) /cgmosx) { } 38 0 38
1339 0 push @char, '\-';
1340 }
1341 elsif (/\G \\ ([0-7]{2,3}) /oxmsgc) {
1342 0 push @char, CORE::chr(oct $1);
1343 }
1344 elsif (/\G \\x ([0-9A-Fa-f]{1,2}) /oxmsgc) {
1345 0 push @char, CORE::chr(hex $1);
1346 }
1347 elsif (/\G \\c ([\x40-\x5F]) /oxmsgc) {
1348 0 push @char, CORE::chr(CORE::ord($1) & 0x1F);
1349 }
1350 elsif (/\G (\\ [0nrtfbae]) /oxmsgc) {
1351 push @char, {
1352 '\0' => "\0",
1353 '\n' => "\n",
1354 '\r' => "\r",
1355 '\t' => "\t",
1356 '\f' => "\f",
1357 '\b' => "\x08", # \b means backspace in character class
1358 '\a' => "\a",
1359 '\e' => "\e",
1360 0 }->{$1};
1361 }
1362 elsif (/\G \\ ($q_char) /oxmsgc) {
1363 0 push @char, $1;
1364 }
1365 elsif (/\G ($q_char) /oxmsgc) {
1366 38 push @char, $1;
1367 }
1368 }
1369  
1370 # join separated multiple-octet
1371 12 @char = join('',@char) =~ /\G (?>\\-|$q_char) /oxmsg;
1372  
1373 # unescape '-'
1374 12 my @i = ();
1375 12 for my $i (0 .. $#char) {
1376 38 ▶ if ($char[$i] eq '\-') {
Branch: 2 branches
BranchTrueFalseTotal
if ($char[$i] eq '\\-') { } 0 38 38
elsif ($char[$i] eq '-') { } 0 38 38
1377 0 $char[$i] = '-';
1378 }
1379 elsif ($char[$i] eq '-') {
1380 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
1381 0 push @i, $i;
1382 }
1383 }
1384 }
1385  
1386 # open character list (reverse for splice)
1387 12 for my $i (CORE::reverse @i) {
1388 0 my @range = ();
1389  
1390 # range error
1391 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
1392 0 croak "Invalid tr/// range \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1393 }
1394  
1395 # range of multiple-octet code
1396 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
1397 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
1398 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
1399 }
1400 elsif (CORE::length($char[$i+1]) == 2) {
1401 0 push @range, grep {$char[$i-1] le $_} chars1();
1402 0 push @range, grep {$_ le $char[$i+1]} chars2();
1403 }
1404 elsif (CORE::length($char[$i+1]) == 3) {
1405 0 push @range, grep {$char[$i-1] le $_} chars1();
1406 0 push @range, chars2();
1407 0 push @range, grep {$_ le $char[$i+1]} chars3();
1408 }
1409 elsif (CORE::length($char[$i+1]) == 4) {
1410 0 push @range, grep {$char[$i-1] le $_} chars1();
1411 0 push @range, chars2();
1412 0 push @range, chars3();
1413 0 push @range, grep {$_ le $char[$i+1]} chars4();
1414 }
1415 else {
1416 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1417 }
1418 }
1419 elsif (CORE::length($char[$i-1]) == 2) {
1420 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
1421 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
1422 }
1423 elsif (CORE::length($char[$i+1]) == 3) {
1424 0 push @range, grep {$char[$i-1] le $_} chars2();
1425 0 push @range, grep {$_ le $char[$i+1]} chars3();
1426 }
1427 elsif (CORE::length($char[$i+1]) == 4) {
1428 0 push @range, grep {$char[$i-1] le $_} chars2();
1429 0 push @range, chars3();
1430 0 push @range, grep {$_ le $char[$i+1]} chars4();
1431 }
1432 else {
1433 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1434 }
1435 }
1436 elsif (CORE::length($char[$i-1]) == 3) {
1437 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
1438 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
1439 }
1440 elsif (CORE::length($char[$i+1]) == 4) {
1441 0 push @range, grep {$char[$i-1] le $_} chars3();
1442 0 push @range, grep {$_ le $char[$i+1]} chars4();
1443 }
1444 else {
1445 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1446 }
1447 }
1448 elsif (CORE::length($char[$i-1]) == 4) {
1449 0 ▶ if (CORE::length($char[$i+1]) == 4) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $char[$i + 1] == 4) { } 0 0 0
1450 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
1451 }
1452 else {
1453 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1454 }
1455 }
1456 else {
1457 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1458 }
1459  
1460 0 splice @char, $i-1, 3, @range;
1461 }
1462  
1463 12 return @char;
1464 }
1465  
1466 #
1467 # Latin-9 open character class
1468 #
1469 0 ▶sub _cc {
Subroutine _cc: not called CC=7 SCAR=40.3
1470 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
1471 0 die __FILE__, ": subroutine cc got no parameter.\n";
1472 }
1473 elsif (scalar(@_) == 1) {
1474 0 return sprintf('\x%02X',$_[0]);
1475 }
1476 elsif (scalar(@_) == 2) {
1477 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
1478 0 die __FILE__, ": subroutine cc got \$_[0] > \$_[1] parameters).\n";
1479 }
1480 elsif ($_[0] == $_[1]) {
1481 0 return sprintf('\x%02X',$_[0]);
1482 }
1483 elsif (($_[0]+1) == $_[1]) {
1484 0 return sprintf('[\\x%02X\\x%02X]',$_[0],$_[1]);
1485 }
1486 else {
1487 0 return sprintf('[\\x%02X-\\x%02X]',$_[0],$_[1]);
1488 }
1489 }
1490 else {
1491 0 die __FILE__, ": subroutine cc got 3 or more parameters (@{[scalar(@_)]} parameters).\n";
1492 }
1493 }
1494  
1495 #
1496 # Latin-9 octet range
1497 #
1498 246 ▶sub _octets {
Subroutine _octets: called CC=5 SCAR=19.3
1499 246 my $length = shift @_;
1500  
1501 246 ▶ if ($length == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length == 1) { } 246 0 246
1502 246 my($a1) = unpack 'C', $_[0];
1503 246 my($z1) = unpack 'C', $_[1];
1504  
1505 246 ▶ if ($a1 > $z1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($a1 > $z1) 0 246 246
1506 0 croak 'Invalid [] range in regexp (CORE::ord(A) > CORE::ord(B)) ' . '\x' . unpack('H*',$a1) . '-\x' . unpack('H*',$z1);
1507 }
1508  
1509 246 ▶ if ($a1 == $z1) {
Branch: 2 branches
BranchTrueFalseTotal
if ($a1 == $z1) { } 0 246 246
elsif ($a1 + 1 == $z1) { } 0 246 246
1510 0 return sprintf('\x%02X',$a1);
1511 }
1512 elsif (($a1+1) == $z1) {
1513 0 return sprintf('\x%02X\x%02X',$a1,$z1);
1514 }
1515 else {
1516 246 return sprintf('\x%02X-\x%02X',$a1,$z1);
1517 }
1518 }
1519 else {
1520 0 die __FILE__, ": subroutine _octets got invalid length ($length).\n";
1521 }
1522 }
1523  
1524 #
1525 # Latin-9 range regexp
1526 #
1527 246 ▶sub _range_regexp {
Subroutine _range_regexp: called CC=18 SCAR=41.7
1528 246 my($length,$first,$last) = @_;
1529  
1530 246 my @range_regexp = ();
1531 246 ▶ if (not exists $range_tr{$length}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $range_tr{$length}) 0 246 246
1532 0 return @range_regexp;
1533 }
1534  
1535 246 my @ranges = @{ $range_tr{$length} };
1536 246 ▶ while (my @range = splice(@ranges,0,$length)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, $length)) 246 246 492
1537 246 my $min = '';
1538 246 my $max = '';
1539 246 ▶ for (my $i=0; $i < $length; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $length) 246 246 492
1540 246 $min .= pack 'C', $range[$i][0];
1541 246 $max .= pack 'C', $range[$i][-1];
1542 }
1543  
1544 # min___max
1545 # FIRST_____________LAST
1546 # (nothing)
1547  
1548 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
1549 }
1550  
1551 # **********
1552 # min_________max
1553 # FIRST_____________LAST
1554 # **********
1555  
1556 ▶ 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
1557 0 push @range_regexp, _octets($length,$first,$max,$min,$max);
1558 }
1559  
1560 # **********************
1561 # min________________max
1562 # FIRST_____________LAST
1563 # **********************
1564  
1565 ▶ 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
1566 0 push @range_regexp, _octets($length,$first,$last,$min,$max);
1567 }
1568  
1569 # *********
1570 # min___max
1571 # FIRST_____________LAST
1572 # *********
1573  
1574 ▶ 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
1575 0 push @range_regexp, _octets($length,$min,$max,$min,$max);
1576 }
1577  
1578 # **********************
1579 # min__________________________max
1580 # FIRST_____________LAST
1581 # **********************
1582  
1583 ▶ 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
1584 246 push @range_regexp, _octets($length,$first,$last,$min,$max);
1585 }
1586  
1587 # *********
1588 # min________max
1589 # FIRST_____________LAST
1590 # *********
1591  
1592 ▶ 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
1593 0 push @range_regexp, _octets($length,$min,$last,$min,$max);
1594 }
1595  
1596 # min___max
1597 # FIRST_____________LAST
1598 # (nothing)
1599  
1600 elsif ($last lt $min) {
1601 }
1602  
1603 else {
1604 0 die __FILE__, ": subroutine _range_regexp panic.\n";
1605 }
1606 }
1607  
1608 246 return @range_regexp;
1609 }
1610  
1611 #
1612 # Latin-9 open character list for qr and not qr
1613 #
1614 650 ▶sub _charlist {
Subroutine _charlist: called CC=46 SCAR=45.9
1615  
1616 650 my $modifier = pop @_;
1617 650 my @char = @_;
1618  
1619 650 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 298 352 650
1620  
1621 # unescape character
1622 650 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1773 650 2423
1623  
1624 # escape - to ...
1625 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 \\ ($Elatin9::q_char) \z/mosx) { } 7 1371 1378
1626 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
1627 246 $char[$i] = '...';
1628 }
1629 }
1630  
1631 # octal escape sequence
1632 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
1633 0 $char[$i] = octchr($1);
1634 }
1635  
1636 # hexadecimal escape sequence
1637 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
1638 0 $char[$i] = hexchr($1);
1639 }
1640  
1641 # \b{...} --> b\{...}
1642 # \B{...} --> B\{...}
1643 # \N{CHARNAME} --> N\{CHARNAME}
1644 # \p{PROPERTY} --> p\{PROPERTY}
1645 # \P{PROPERTY} --> P\{PROPERTY}
1646 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
1647 0 $char[$i] = $1 . '\\' . $2;
1648 }
1649  
1650 # \p, \P, \X --> p, P, X
1651 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
1652 0 $char[$i] = $1;
1653 }
1654  
1655 elsif ($char[$i] =~ /\A \\ ([0-7]{2,3}) \z/oxms) {
1656 0 $char[$i] = CORE::chr oct $1;
1657 }
1658 elsif ($char[$i] =~ /\A \\x ([0-9A-Fa-f]{1,2}) \z/oxms) {
1659 22 $char[$i] = CORE::chr hex $1;
1660 }
1661 elsif ($char[$i] =~ /\A \\c ([\x40-\x5F]) \z/oxms) {
1662 0 $char[$i] = CORE::chr(CORE::ord($1) & 0x1F);
1663 }
1664 elsif ($char[$i] =~ /\A (\\ [0nrtfbaedswDSWHVhvR]) \z/oxms) {
1665 $char[$i] = {
1666 '\0' => "\0",
1667 '\n' => "\n",
1668 '\r' => "\r",
1669 '\t' => "\t",
1670 '\f' => "\f",
1671 '\b' => "\x08", # \b means backspace in character class
1672 '\a' => "\a",
1673 '\e' => "\e",
1674 '\d' => '[0-9]',
1675  
1676 # Vertical tabs are now whitespace
1677 # \s in a regex now matches a vertical tab in all circumstances.
1678 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
1679 # \t \n \v \f \r space
1680 # '\s' => '[\x09\x0A \x0C\x0D\x20]',
1681 # '\s' => '[\x09\x0A\x0B\x0C\x0D\x20]',
1682 '\s' => '\s',
1683  
1684 '\w' => '[0-9A-Z_a-z]',
1685 '\D' => '${Elatin9::eD}',
1686 '\S' => '${Elatin9::eS}',
1687 '\W' => '${Elatin9::eW}',
1688  
1689 '\H' => '${Elatin9::eH}',
1690 '\V' => '${Elatin9::eV}',
1691 '\h' => '[\x09\x20]',
1692 '\v' => '[\x0A\x0B\x0C\x0D]',
1693 '\R' => '${Elatin9::eR}',
1694  
1695 25 }->{$1};
1696 }
1697  
1698 # POSIX-style character classes
1699 ▶ 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
1700 $char[$i] = {
1701  
1702 '[:lower:]' => '[\x41-\x5A\x61-\x7A]',
1703 '[:upper:]' => '[\x41-\x5A\x61-\x7A]',
1704 '[:^lower:]' => '${Elatin9::not_lower_i}',
1705 '[:^upper:]' => '${Elatin9::not_upper_i}',
1706  
1707 8 }->{$1};
1708 }
1709 elsif ($char[$i] =~ /\A ( \[\: \^? (?:alnum|alpha|ascii|blank|cntrl|digit|graph|lower|print|punct|space|upper|word|xdigit) :\] ) \z/oxms) {
1710 $char[$i] = {
1711  
1712 '[:alnum:]' => '[\x30-\x39\x41-\x5A\x61-\x7A]',
1713 '[:alpha:]' => '[\x41-\x5A\x61-\x7A]',
1714 '[:ascii:]' => '[\x00-\x7F]',
1715 '[:blank:]' => '[\x09\x20]',
1716 '[:cntrl:]' => '[\x00-\x1F\x7F]',
1717 '[:digit:]' => '[\x30-\x39]',
1718 '[:graph:]' => '[\x21-\x7F]',
1719 '[:lower:]' => '[\x61-\x7A]',
1720 '[:print:]' => '[\x20-\x7F]',
1721 '[:punct:]' => '[\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E]',
1722  
1723 # P.174 POSIX-Style Character Classes
1724 # in Chapter 5: Pattern Matching
1725 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
1726  
1727 # P.311 11.2.4 Character Classes and other Special Escapes
1728 # in Chapter 11: perlre: Perl regular expressions
1729 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
1730  
1731 # P.210 POSIX-Style Character Classes
1732 # in Chapter 5: Pattern Matching
1733 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1734  
1735 '[:space:]' => '[\s\x0B]', # "\s" plus vertical tab ("\cK")
1736  
1737 '[:upper:]' => '[\x41-\x5A]',
1738 '[:word:]' => '[\x30-\x39\x41-\x5A\x5F\x61-\x7A]',
1739 '[:xdigit:]' => '[\x30-\x39\x41-\x46\x61-\x66]',
1740 '[:^alnum:]' => '${Elatin9::not_alnum}',
1741 '[:^alpha:]' => '${Elatin9::not_alpha}',
1742 '[:^ascii:]' => '${Elatin9::not_ascii}',
1743 '[:^blank:]' => '${Elatin9::not_blank}',
1744 '[:^cntrl:]' => '${Elatin9::not_cntrl}',
1745 '[:^digit:]' => '${Elatin9::not_digit}',
1746 '[:^graph:]' => '${Elatin9::not_graph}',
1747 '[:^lower:]' => '${Elatin9::not_lower}',
1748 '[:^print:]' => '${Elatin9::not_print}',
1749 '[:^punct:]' => '${Elatin9::not_punct}',
1750 '[:^space:]' => '${Elatin9::not_space}',
1751 '[:^upper:]' => '${Elatin9::not_upper}',
1752 '[:^word:]' => '${Elatin9::not_word}',
1753 '[:^xdigit:]' => '${Elatin9::not_xdigit}',
1754  
1755 70 }->{$1};
1756 }
1757 elsif ($char[$i] =~ /\A \\ ($q_char) \z/oxms) {
1758 7 $char[$i] = $1;
1759 }
1760 }
1761  
1762 # open character list
1763 650 my @singleoctet = ();
1764 650 my @multipleoctet = ();
1765 650 ▶ for (my $i=0; $i <= $#char; ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1527 650 2177
1766  
1767 # escaped -
1768 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
1769 246 $i += 1;
1770 246 next;
1771 }
1772  
1773 # make range regexp
1774 elsif ($char[$i] eq '...') {
1775  
1776 # range error
1777 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
1778 0 croak 'Invalid [] range in regexp (length(A) > length(B)) ' . '\x' . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]);
1779 }
1780 elsif (CORE::length($char[$i-1]) == CORE::length($char[$i+1])) {
1781 246 ▶ if ($char[$i-1] gt $char[$i+1]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i - 1] gt $char[$i + 1]) 0 246 246
1782 0 croak 'Invalid [] range in regexp (CORE::ord(A) > CORE::ord(B)) ' . '\x' . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]);
1783 }
1784 }
1785  
1786 # make range regexp per length
1787 246 for my $length (CORE::length($char[$i-1]) .. CORE::length($char[$i+1])) {
1788 246 my @regexp = ();
1789  
1790 # is first and last
1791 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
1792 246 push @regexp, _range_regexp($length, $char[$i-1], $char[$i+1]);
1793 }
1794  
1795 # is first
1796 elsif ($length == CORE::length($char[$i-1])) {
1797 0 push @regexp, _range_regexp($length, $char[$i-1], "\xFF" x $length);
1798 }
1799  
1800 # is inside in first and last
1801 ▶ 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
1802 0 push @regexp, _range_regexp($length, "\x00" x $length, "\xFF" x $length);
1803 }
1804  
1805 # is last
1806 elsif ($length == CORE::length($char[$i+1])) {
1807 0 push @regexp, _range_regexp($length, "\x00" x $length, $char[$i+1]);
1808 }
1809  
1810 else {
1811 0 die __FILE__, ": subroutine make_regexp panic.\n";
1812 }
1813  
1814 246 ▶ if ($length == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length == 1) { } 246 0 246
1815 246 push @singleoctet, @regexp;
1816 }
1817 else {
1818 0 push @multipleoctet, @regexp;
1819 }
1820 }
1821  
1822 246 $i += 2;
1823 }
1824  
1825 # with /i modifier
1826 elsif ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) {
1827 949 ▶ if ($modifier =~ /i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) { } 480 469 949
1828 480 my $uc = Elatin9::uc($char[$i]);
1829 480 my $fc = Elatin9::fc($char[$i]);
1830 480 ▶ if ($uc ne $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc ne $fc) { } 240 240 480
1831 240 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 240 0 240
1832 240 push @singleoctet, $uc, $fc;
1833 }
1834 else {
1835 0 push @singleoctet, $uc;
1836 0 push @multipleoctet, $fc;
1837 }
1838 }
1839 else {
1840 240 push @singleoctet, $char[$i];
1841 }
1842 }
1843 else {
1844 469 push @singleoctet, $char[$i];
1845 }
1846 949 $i += 1;
1847 }
1848  
1849 # single character of single octet code
1850 elsif ($char[$i] =~ /\A (?: \\h ) \z/oxms) {
1851 0 push @singleoctet, "\t", "\x20";
1852 0 $i += 1;
1853 }
1854 elsif ($char[$i] =~ /\A (?: \\v ) \z/oxms) {
1855 0 push @singleoctet, "\x0A", "\x0B", "\x0C", "\x0D";
1856 0 $i += 1;
1857 }
1858 elsif ($char[$i] =~ /\A (?: \\d | \\s | \\w ) \z/oxms) {
1859 2 push @singleoctet, $char[$i];
1860 2 $i += 1;
1861 }
1862  
1863 # single character of multiple-octet code
1864 else {
1865 84 push @multipleoctet, $char[$i];
1866 84 $i += 1;
1867 }
1868 }
1869  
1870 # quote metachar
1871 650 for (@singleoctet) {
1872 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
1873 0 $_ = '-';
1874 }
1875 elsif (/\A \n \z/oxms) {
1876 8 $_ = '\n';
1877 }
1878 elsif (/\A \r \z/oxms) {
1879 8 $_ = '\r';
1880 }
1881 elsif (/\A ([\x00-\x20\x7F-\xFF]) \z/oxms) {
1882 744 $_ = sprintf('\x%02X', CORE::ord $1);
1883 }
1884 elsif (/\A [\x00-\xFF] \z/oxms) {
1885 429 $_ = quotemeta $_;
1886 }
1887 }
1888  
1889 # return character list
1890 650 return \@singleoctet, \@multipleoctet;
1891 }
1892  
1893 #
1894 # Latin-9 octal escape sequence
1895 #
1896 5 ▶sub octchr {
Subroutine octchr: called CC=2 SCAR=6.9
Pod undocumented
1897 5 my($octdigit) = @_;
1898  
1899 5 my @binary = ();
1900 5 for my $octal (split(//,$octdigit)) {
1901 push @binary, {
1902 '0' => '000',
1903 '1' => '001',
1904 '2' => '010',
1905 '3' => '011',
1906 '4' => '100',
1907 '5' => '101',
1908 '6' => '110',
1909 '7' => '111',
1910 50 }->{$octal};
1911 }
1912 5 my $binary = join '', @binary;
1913  
1914 my $octchr = {
1915 # 1234567
1916 1 => pack('B*', "0000000$binary"),
1917 2 => pack('B*', "000000$binary"),
1918 3 => pack('B*', "00000$binary"),
1919 4 => pack('B*', "0000$binary"),
1920 5 => pack('B*', "000$binary"),
1921 6 => pack('B*', "00$binary"),
1922 7 => pack('B*', "0$binary"),
1923 0 => pack('B*', "$binary"),
1924  
1925 5 }->{CORE::length($binary) % 8};
1926  
1927 5 return $octchr;
1928 }
1929  
1930 #
1931 # Latin-9 hexadecimal escape sequence
1932 #
1933 5 ▶sub hexchr {
Subroutine hexchr: called CC=1 SCAR=0.0
Pod undocumented
1934 5 my($hexdigit) = @_;
1935  
1936 my $hexchr = {
1937 1 => pack('H*', "0$hexdigit"),
1938 0 => pack('H*', "$hexdigit"),
1939  
1940 5 }->{CORE::length($_[0]) % 2};
1941  
1942 5 return $hexchr;
1943 }
1944  
1945 #
1946 # Latin-9 open character list for qr
1947 #
1948 576 ▶sub charlist_qr {
Subroutine charlist_qr: called CC=17 SCAR=28.7
Pod undocumented
1949  
1950 576 my $modifier = pop @_;
1951 576 my @char = @_;
1952  
1953 576 my($singleoctet, $multipleoctet) = _charlist(@char, $modifier);
1954 576 my @singleoctet = @$singleoctet;
1955 576 my @multipleoctet = @$multipleoctet;
1956  
1957 # return character list
1958 576 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) 498 78 576
1959  
1960 # with /i modifier
1961 498 ▶ if ($modifier =~ m/i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) 265 233 498
1962 265 my %singleoctet_ignorecase = ();
1963 265 for (@singleoctet) {
1964 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
1965 745 for my $ord (hex($1) .. hex($2)) {
1966 795 my $char = CORE::chr($ord);
1967 795 my $uc = Elatin9::uc($char);
1968 795 my $fc = Elatin9::fc($char);
1969 795 ▶ if ($uc eq $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc eq $fc) { } 240 555 795
1970 240 $singleoctet_ignorecase{unpack 'C*', $char} = 1;
1971 }
1972 else {
1973 555 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 555 0 555
1974 555 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
1975 555 $singleoctet_ignorecase{unpack 'C*', $fc} = 1;
1976 }
1977 else {
1978 0 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
1979 0 push @multipleoctet, join '', map {sprintf('\x%02X',$_)} unpack 'C*', $fc;
1980 }
1981 }
1982 }
1983 }
1984 745 ▶ if ($_ ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ ne "") 0 745 745
1985 0 $singleoctet_ignorecase{unpack 'C*', $_} = 1;
1986 }
1987 }
1988 265 my $i = 0;
1989 265 my @singleoctet_ignorecase = ();
1990 265 for my $ord (0 .. 255) {
1991 67840 ▶ if (exists $singleoctet_ignorecase{$ord}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $singleoctet_ignorecase{$ord}) { } 870 66970 67840
1992 870 push @{$singleoctet_ignorecase[$i]}, $ord;
1993 }
1994 else {
1995 66970 $i++;
1996 }
1997 }
1998 265 @singleoctet = ();
1999 265 for my $range (@singleoctet_ignorecase) {
2000 56160 ▶ if (ref $range) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $range) 770 55390 56160
2001 770 ▶ if (scalar(@{$range}) == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @{$range;} == 1) { } 720 50 770
elsif (scalar @{$range;} == 2) { } 0 50 50
2002 720 push @singleoctet, sprintf('\x%02X', @{$range}[0]);
2003 }
2004 50 elsif (scalar(@{$range}) == 2) {
2005 0 push @singleoctet, sprintf('\x%02X\x%02X', @{$range}[0], @{$range}[-1]);
2006 }
2007 else {
2008 50 push @singleoctet, sprintf('\x%02X-\x%02X', @{$range}[0], @{$range}[-1]);
2009 }
2010 }
2011 }
2012 }
2013  
2014 498 my $not_anchor = '';
2015  
2016 498 push @multipleoctet, join('', $not_anchor, '[', @singleoctet, ']' );
2017 }
2018 576 ▶ if (scalar(@multipleoctet) >= 2) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @multipleoctet >= 2) { } 6 570 576
2019 6 return '(?:' . join('|', @multipleoctet) . ')';
2020 }
2021 else {
2022 570 return $multipleoctet[0];
2023 }
2024 }
2025  
2026 #
2027 # Latin-9 open character list for not qr
2028 #
2029 74 ▶sub charlist_not_qr {
Subroutine charlist_not_qr: called CC=18 SCAR=33.1
Pod undocumented
2030  
2031 74 my $modifier = pop @_;
2032 74 my @char = @_;
2033  
2034 74 my($singleoctet, $multipleoctet) = _charlist(@char, $modifier);
2035 74 my @singleoctet = @$singleoctet;
2036 74 my @multipleoctet = @$multipleoctet;
2037  
2038 # with /i modifier
2039 74 ▶ if ($modifier =~ m/i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) 25 49 74
2040 25 my %singleoctet_ignorecase = ();
2041 25 for (@singleoctet) {
2042 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
2043 25 for my $ord (hex($1) .. hex($2)) {
2044 75 my $char = CORE::chr($ord);
2045 75 my $uc = Elatin9::uc($char);
2046 75 my $fc = Elatin9::fc($char);
2047 75 ▶ if ($uc eq $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc eq $fc) { } 0 75 75
2048 0 $singleoctet_ignorecase{unpack 'C*', $char} = 1;
2049 }
2050 else {
2051 75 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 75 0 75
2052 75 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2053 75 $singleoctet_ignorecase{unpack 'C*', $fc} = 1;
2054 }
2055 else {
2056 0 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2057 0 push @multipleoctet, join '', map {sprintf('\x%02X',$_)} unpack 'C*', $fc;
2058 }
2059 }
2060 }
2061 }
2062 25 ▶ if ($_ ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ ne "") 0 25 25
2063 0 $singleoctet_ignorecase{unpack 'C*', $_} = 1;
2064 }
2065 }
2066 25 my $i = 0;
2067 25 my @singleoctet_ignorecase = ();
2068 25 for my $ord (0 .. 255) {
2069 6400 ▶ if (exists $singleoctet_ignorecase{$ord}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $singleoctet_ignorecase{$ord}) { } 150 6250 6400
2070 150 push @{$singleoctet_ignorecase[$i]}, $ord;
2071 }
2072 else {
2073 6250 $i++;
2074 }
2075 }
2076 25 @singleoctet = ();
2077 25 for my $range (@singleoctet_ignorecase) {
2078 2400 ▶ if (ref $range) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $range) 50 2350 2400
2079 50 ▶ if (scalar(@{$range}) == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @{$range;} == 1) { } 0 50 50
elsif (scalar @{$range;} == 2) { } 0 50 50
2080 0 push @singleoctet, sprintf('\x%02X', @{$range}[0]);
2081 }
2082 50 elsif (scalar(@{$range}) == 2) {
2083 0 push @singleoctet, sprintf('\x%02X\x%02X', @{$range}[0], @{$range}[-1]);
2084 }
2085 else {
2086 50 push @singleoctet, sprintf('\x%02X-\x%02X', @{$range}[0], @{$range}[-1]);
2087 }
2088 }
2089 }
2090 }
2091  
2092 # return character list
2093 74 ▶ if (scalar(@multipleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @multipleoctet >= 1) { } 0 74 74
2094 0 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) { } 0 0 0
2095  
2096 # any character other than multiple-octet and single octet character class
2097 0 return '(?!' . join('|', @multipleoctet) . ')(?:[^' . join('', @singleoctet) . '])';
2098 }
2099 else {
2100  
2101 # any character other than multiple-octet character class
2102 0 return '(?!' . join('|', @multipleoctet) . ")(?:$your_char)";
2103 }
2104 }
2105 else {
2106 74 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) { } 74 0 74
2107  
2108 # any character other than single octet character class
2109 74 return '(?:[^' . join('', @singleoctet) . '])';
2110 }
2111 else {
2112  
2113 # any character
2114 0 return "(?:$your_char)";
2115 }
2116 }
2117 }
2118  
2119 #
2120 # open file in read mode
2121 #
2122 422 ▶sub _open_r {
Subroutine _open_r: called CC=1 SCAR=0.0
2123 422 my(undef,$file) = @_;
2124 422 ▶ use Fcntl qw(O_RDONLY);
Subroutine BEGIN: called CC=1 SCAR=0.0
2125 422 return CORE::sysopen($_[0], $file, &O_RDONLY);
2126 }
2127  
2128 #
2129 # open file in append mode
2130 #
2131 211 ▶sub _open_a {
Subroutine _open_a: called CC=1 SCAR=0.0
2132 211 my(undef,$file) = @_;
2133 422 ▶ use Fcntl qw(O_WRONLY O_APPEND O_CREAT);
Subroutine BEGIN: called CC=1 SCAR=0.0
2134 211 return CORE::sysopen($_[0], $file, &O_WRONLY|&O_APPEND|&O_CREAT);
2135 }
2136  
2137 #
2138 # safe system
2139 #
2140 211 ▶sub _systemx {
Subroutine _systemx: called CC=1 SCAR=0.0
2141  
2142 # P.707 29.2.33. exec
2143 # in Chapter 29: Functions
2144 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2145 #
2146 # Be aware that in older releases of Perl, exec (and system) did not flush
2147 # your output buffer, so you needed to enable command buffering by setting $|
2148 # on one or more filehandles to avoid lost output in the case of exec, or
2149 # misordererd output in the case of system. This situation was largely remedied
2150 # in the 5.6 release of Perl. (So, 5.005 release not yet.)
2151  
2152 # P.855 exec
2153 # in Chapter 27: Functions
2154 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2155 #
2156 # In very old release of Perl (before v5.6), exec (and system) did not flush
2157 # your output buffer, so you needed to enable command buffering by setting $|
2158 # on one or more filehandles to avoid lost output with exec or misordered
2159 # output with system.
2160  
2161 211 $| = 1;
2162  
2163 # P.565 23.1.2. Cleaning Up Your Environment
2164 # in Chapter 23: Security
2165 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2166  
2167 # P.656 Cleaning Up Your Environment
2168 # in Chapter 20: Security
2169 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2170  
2171 # local $ENV{'PATH'} = '.';
2172 211 local @ENV{qw(IFS CDPATH ENV BASH_ENV)}; # Make %ENV safer
2173  
2174 # P.707 29.2.33. exec
2175 # in Chapter 29: Functions
2176 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2177 #
2178 # As we mentioned earlier, exec treats a discrete list of arguments as an
2179 # indication that it should bypass shell processing. However, there is one
2180 # place where you might still get tripped up. The exec call (and system, too)
2181 # will not distinguish between a single scalar argument and an array containing
2182 # only one element.
2183 #
2184 # @args = ("echo surprise"); # just one element in list
2185 # exec @args # still subject to shell escapes
2186 # or die "exec: $!"; # because @args == 1
2187 #
2188 # To avoid this, you can use the PATHNAME syntax, explicitly duplicating the
2189 # first argument as the pathname, which forces the rest of the arguments to be
2190 # interpreted as a list, even if there is only one of them:
2191 #
2192 # exec { $args[0] } @args # safe even with one-argument list
2193 # or die "can't exec @args: $!";
2194  
2195 # P.855 exec
2196 # in Chapter 27: Functions
2197 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2198 #
2199 # As we mentioned earlier, exec treats a discrete list of arguments as a
2200 # directive to bypass shell processing. However, there is one place where
2201 # you might still get tripped up. The exec call (and system, too) cannot
2202 # distinguish between a single scalar argument and an array containing
2203 # only one element.
2204 #
2205 # @args = ("echo surprise"); # just one element in list
2206 # exec @args # still subject to shell escapes
2207 # || die "exec: $!"; # because @args == 1
2208 #
2209 # To avoid this, use the PATHNAME syntax, explicitly duplicating the first
2210 # argument as the pathname, which forces the rest of the arguments to be
2211 # interpreted as a list, even if there is only one of them:
2212 #
2213 # exec { $args[0] } @args # safe even with one-argument list
2214 # || die "can't exec @args: $!";
2215  
2216 211 return CORE::system { $_[0] } @_; # safe even with one-argument list
2217 }
2218  
2219 #
2220 # Latin-9 order to character (with parameter)
2221 #
2222 3469 ▶sub Elatin9::chr(;$) {
Subroutine chr: called CC=4 SCAR=13.9
Pod undocumented
2223  
2224 3469 ▶ my $c = @_ ? $_[0] : $_;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 3469 0 3469
2225  
2226 3469 ▶ if ($c == 0x00) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c == 0) { } 24 3445 3469
2227 24 return "\x00";
2228 }
2229 else {
2230 3445 my @chr = ();
2231 3445 ▶ while ($c > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c > 0) 3445 3445 6890
2232 3445 unshift @chr, ($c % 0x100);
2233 3445 $c = int($c / 0x100);
2234 }
2235 3445 return pack 'C*', @chr;
2236 }
2237 }
2238  
2239 #
2240 # Latin-9 order to character (without parameter)
2241 #
2242 0 ▶sub Elatin9::chr_() {
Subroutine chr_: not called CC=3 SCAR=24.8
Pod undocumented
2243  
2244 0 my $c = $_;
2245  
2246 0 ▶ if ($c == 0x00) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c == 0) { } 0 0 0
2247 0 return "\x00";
2248 }
2249 else {
2250 0 my @chr = ();
2251 0 ▶ while ($c > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c > 0) 0 0 0
2252 0 unshift @chr, ($c % 0x100);
2253 0 $c = int($c / 0x100);
2254 }
2255 0 return pack 'C*', @chr;
2256 }
2257 }
2258  
2259 #
2260 # Latin-9 path globbing (with parameter)
2261 #
2262 0 ▶sub Elatin9::glob($) {
Subroutine glob: not called CC=3 SCAR=24.8
Pod undocumented
2263  
2264 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2265 0 my @glob = _DOS_like_glob(@_);
2266 0 for my $glob (@glob) {
2267 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2268 }
2269 0 return @glob;
2270 }
2271 else {
2272 0 my $glob = _DOS_like_glob(@_);
2273 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2274 0 return $glob;
2275 }
2276 }
2277  
2278 #
2279 # Latin-9 path globbing (without parameter)
2280 #
2281 0 ▶sub Elatin9::glob_() {
Subroutine glob_: not called CC=3 SCAR=24.8
Pod undocumented
2282  
2283 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2284 0 my @glob = _DOS_like_glob();
2285 0 for my $glob (@glob) {
2286 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2287 }
2288 0 return @glob;
2289 }
2290 else {
2291 0 my $glob = _DOS_like_glob();
2292 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2293 0 return $glob;
2294 }
2295 }
2296  
2297 #
2298 # Latin-9 path globbing via File::DosGlob 1.10
2299 #
2300 # Often I confuse "_dosglob" and "_doglob".
2301 # So, I renamed "_dosglob" to "_DOS_like_glob".
2302 #
2303 422 my %iter;
2304 my %entries;
2305 0 ▶sub _DOS_like_glob {
Subroutine _DOS_like_glob: not called CC=10 SCAR=47.0
2306  
2307 # context (keyed by second cxix argument provided by core)
2308 0 my($expr,$cxix) = @_;
2309  
2310 # glob without args defaults to $_
2311 0 ▶ $expr = $_ if not defined $expr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $expr 0 0 0
2312  
2313 # represents the current user's home directory
2314 #
2315 # 7.3. Expanding Tildes in Filenames
2316 # in Chapter 7. File Access
2317 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2318 #
2319 # and File::HomeDir, File::HomeDir::Windows module
2320  
2321 # DOS-like system
2322 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
2323 0 $expr =~ s{ \A ~ (?= [^/\\] ) }
2324 0 { my_home_MSWin32() }oxmse;
2325 }
2326  
2327 # UNIX-like system
2328 else {
2329 0 $expr =~ s{ \A ~ ( (?:[^/])* ) }
2330 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
2331 }
2332  
2333 # assume global context if not provided one
2334 0 ▶ $cxix = '_G_' if not defined $cxix;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $cxix 0 0 0
2335 0 ▶ $iter{$cxix} = 0 if not exists $iter{$cxix};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $iter{$cxix} 0 0 0
2336  
2337 # if we're just beginning, do it all first
2338 0 ▶ if ($iter{$cxix} == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iter{$cxix} == 0) 0 0 0
2339 0 $entries{$cxix} = [ _do_glob(1, _parse_line($expr)) ];
2340 }
2341  
2342 # chuck it all out, quick or slow
2343 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2344 0 delete $iter{$cxix};
2345 0 return @{delete $entries{$cxix}};
2346 }
2347 else {
2348 0 ▶ if ($iter{$cxix} = scalar @{$entries{$cxix}}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iter{$cxix} = scalar @{$entries{$cxix};}) { } 0 0 0
2349 0 return shift @{$entries{$cxix}};
2350 }
2351 else {
2352 # return undef for EOL
2353 0 delete $iter{$cxix};
2354 0 delete $entries{$cxix};
2355 0 return undef;
2356 }
2357 }
2358 }
2359  
2360 #
2361 # Latin-9 path globbing subroutine
2362 #
2363 0 ▶sub _do_glob {
Subroutine _do_glob: not called CC=44 SCAR=75.9
2364  
2365 0 my($cond,@expr) = @_;
2366 0 my @glob = ();
2367 0 my $fix_drive_relative_paths = 0;
2368  
2369 OUTER:
2370 0 for my $expr (@expr) {
2371 0 ▶ next OUTER if not defined $expr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $expr 0 0 0
2372 0 ▶ next OUTER if $expr eq '';
Branch: 1 branch
BranchTrueFalseTotal
if $expr eq "" 0 0 0
2373  
2374 0 my @matched = ();
2375 0 my @globdir = ();
2376 0 my $head = '.';
2377 0 my $pathsep = '/';
2378 0 my $tail;
2379  
2380 # if argument is within quotes strip em and do no globbing
2381 0 ▶ if ($expr =~ /\A " ((?:$q_char)*?) " \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expr =~ /\A " ((?:$Elatin9::q_char)*?) " \z/mosx) 0 0 0
2382 0 $expr = $1;
2383 0 ▶ if ($cond eq 'd') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cond eq 'd') { } 0 0 0
2384 0 ▶ if (-d $expr) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $expr) 0 0 0
2385 0 push @glob, $expr;
2386 }
2387 }
2388 else {
2389 0 ▶ if (-e $expr) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $expr) 0 0 0
2390 0 push @glob, $expr;
2391 }
2392 }
2393 0 next OUTER;
2394 }
2395  
2396 # wildcards with a drive prefix such as h:*.pm must be changed
2397 # to h:./*.pm to expand correctly
2398 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
2399 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
2400 0 $fix_drive_relative_paths = 1;
2401 }
2402 }
2403  
2404 0 ▶ if (($head, $tail) = _parse_path($expr,$pathsep)) {
Branch: 1 branch
BranchTrueFalseTotal
if (($head, $tail) = _parse_path($expr, $pathsep)) 0 0 0
2405 0 ▶ if ($tail eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($tail eq "") 0 0 0
2406 0 push @glob, $expr;
2407 0 next OUTER;
2408 }
2409 0 ▶ if ($head =~ / \A (?:$q_char)*? [*?] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head =~ / \A (?:$Elatin9::q_char)*? [*?] /mosx) 0 0 0
2410 0 ▶ if (@globdir = _do_glob('d', $head)) {
Branch: 1 branch
BranchTrueFalseTotal
if (@globdir = _do_glob("d", $head)) 0 0 0
2411 0 push @glob, _do_glob($cond, map {"$_$pathsep$tail"} @globdir);
2412 0 next OUTER;
2413 }
2414 }
2415 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
2416 0 $head .= $pathsep;
2417 }
2418 0 $expr = $tail;
2419 }
2420  
2421 # If file component has no wildcards, we can avoid opendir
2422 0 ▶ if ($expr !~ / \A (?:$q_char)*? [*?] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($expr =~ / \A (?:$Elatin9::q_char)*? [*?] /mosx) 0 0 0
2423 0 ▶ if ($head eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($head eq ".") 0 0 0
2424 0 $head = '';
2425 }
2426 0 ▶ if ($head ne '' and ($head =~ / \G ($q_char) /oxmsg)[-1] ne $pathsep) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head ne "" and ($head =~ / \G ($Elatin9::q_char) /gmosx)[-1] ne $pathsep) 0 0 0
Condition0%0/3
$head ne "" and ($head =~ / \G ($Elatin9::q_char) /gmosx)[-1] ne $pathsep
!ll&&!rl&&r
000
MC/DC0%0/2
$head ne "" and ($head =~ / \G ($Elatin9::q_char) /gmosx)[-1] ne $pathsep
$head ne "" ($head =~ / \G ($Elatin9::q_char) /gmosx)[-1] ne $pathsep
Truth table0%0/3
A and B
A= $head ne ""B= ($head =~ / \G ($Elatin9::q_char) /gmosx)[-1] ne $pathsep
ABresult
0X0
100
111
2427 0 $head .= $pathsep;
2428 }
2429 0 $head .= $expr;
2430 0 ▶ if ($cond eq 'd') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cond eq 'd') { } 0 0 0
2431 0 ▶ if (-d $head) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $head) 0 0 0
2432 0 push @glob, $head;
2433 }
2434 }
2435 else {
2436 0 ▶ if (-e $head) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $head) 0 0 0
2437 0 push @glob, $head;
2438 }
2439 }
2440 0 next OUTER;
2441 }
2442 0 ▶ opendir(*DIR, $head) or next OUTER;
Branch: 1 branch
BranchTrueFalseTotal
opendir *DIR, $head or next OUTER 0 0 0
2443 0 my @leaf = readdir DIR;
2444 0 closedir DIR;
2445  
2446 0 ▶ if ($head eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($head eq ".") 0 0 0
2447 0 $head = '';
2448 }
2449 0 ▶ if ($head ne '' and ($head =~ / \G ($q_char) /oxmsg)[-1] ne $pathsep) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head ne "" and ($head =~ / \G ($Elatin9::q_char) /gmosx)[-1] ne $pathsep) 0 0 0
Condition0%0/3
$head ne "" and ($head =~ / \G ($Elatin9::q_char) /gmosx)[-1] ne $pathsep
!ll&&!rl&&r
000
MC/DC0%0/2
$head ne "" and ($head =~ / \G ($Elatin9::q_char) /gmosx)[-1] ne $pathsep
$head ne "" ($head =~ / \G ($Elatin9::q_char) /gmosx)[-1] ne $pathsep
Truth table0%0/3
A and B
A= $head ne ""B= ($head =~ / \G ($Elatin9::q_char) /gmosx)[-1] ne $pathsep
ABresult
0X0
100
111
2450 0 $head .= $pathsep;
2451 }
2452  
2453 0 my $pattern = '';
2454 0 ▶ while ($expr =~ / \G ($q_char) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expr =~ / \G ($Elatin9::q_char) /cgox) 0 0 0
2455 0 my $char = $1;
2456  
2457 # 6.9. Matching Shell Globs as Regular Expressions
2458 # in Chapter 6. Pattern Matching
2459 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2460 # (and so on)
2461  
2462 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
2463 0 $pattern .= "(?:$your_char)*",
2464 }
2465 elsif ($char eq '?') {
2466 0 $pattern .= "(?:$your_char)?", # DOS style
2467 # $pattern .= "(?:$your_char)", # UNIX style
2468 }
2469 elsif ((my $fc = Elatin9::fc($char)) ne $char) {
2470 0 $pattern .= $fc;
2471 }
2472 else {
2473 0 $pattern .= quotemeta $char;
2474 }
2475 }
2476 0 ▶ my $matchsub = sub { Elatin9::fc($_[0]) =~ /\A $pattern \z/xms };
Subroutine __ANON__: not called CC=1 SCAR=6.9
2477  
2478 # if ($@) {
2479 # print STDERR "$0: $@\n";
2480 # next OUTER;
2481 # }
2482  
2483 INNER:
2484 0 for my $leaf (@leaf) {
2485 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
2486 0 next INNER;
2487 }
2488 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
2489 0 next INNER;
2490 }
2491  
2492 0 ▶ if (&$matchsub($leaf)) {
Branch: 1 branch
BranchTrueFalseTotal
if (&$matchsub($leaf)) 0 0 0
2493 0 push @matched, "$head$leaf";
2494 0 next INNER;
2495 }
2496  
2497 # [DOS compatibility special case]
2498 # Failed, add a trailing dot and try again, but only...
2499  
2500 0 ▶ if (Elatin9::index($leaf,'.') == -1 and # if name does not have a dot in it *and*
Branch: 1 branch
BranchTrueFalseTotal
if (&Elatin9::index($leaf, ".") == -1 and length $leaf <= 8 and &Elatin9::index($pattern, "\\.") != -1) 0 0 0
Condition0%0/6
&Elatin9::index($leaf, ".") == -1 and length $leaf <= 8 and &Elatin9::index($pattern, "\\.") != -1
!ll&&!rl&&r
000
&Elatin9::index($leaf, ".") == -1 and length $leaf <= 8
!ll&&!rl&&r
000
MC/DC0%0/3
&Elatin9::index($leaf, ".") == -1 and length $leaf <= 8 and &Elatin9::index($pattern, "\\.") != -1
&Elatin9::index($leaf, ".") == -1 length $leaf <= 8 &Elatin9::index($pattern, "\\.") != -1
Truth table0%0/4
A and B and C
A= &Elatin9::index($leaf, ".") == -1B= length $leaf <= 8C= &Elatin9::index($pattern, "\\.") != -1
ABCresult
0XX0
10X0
1100
1111
2501 CORE::length($leaf) <= 8 and # name is shorter than or equal to 8 chars *and*
2502 Elatin9::index($pattern,'\\.') != -1 # pattern has a dot.
2503 ) {
2504 0 ▶ if (&$matchsub("$leaf.")) {
Branch: 1 branch
BranchTrueFalseTotal
if (&$matchsub("$leaf.")) 0 0 0
2505 0 push @matched, "$head$leaf";
2506 0 next INNER;
2507 }
2508 }
2509 }
2510 0 ▶ if (@matched) {
Branch: 1 branch
BranchTrueFalseTotal
if (@matched) 0 0 0
2511 0 push @glob, @matched;
2512 }
2513 }
2514 0 ▶ if ($fix_drive_relative_paths) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fix_drive_relative_paths) 0 0 0
2515 0 for my $glob (@glob) {
2516 0 $glob =~ s# \A ([A-Za-z]:) \./ #$1#oxms;
2517 }
2518 }
2519 0 return @glob;
2520 }
2521  
2522 #
2523 # Latin-9 parse line
2524 #
2525 0 ▶sub _parse_line {
Subroutine _parse_line: not called CC=3 SCAR=24.8
2526  
2527 0 my($line) = @_;
2528  
2529 0 $line .= ' ';
2530 0 my @piece = ();
2531 0 ▶ while ($line =~ /
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ / " ( (?>(?: [^"] )* ) ) " (?>\s+) | ( (?>(?: [^"\s] )* ) ) (?>\s+) /gmosx) 0 0 0
2532 " ( (?>(?: [^"] )* ) ) " (?>\s+) |
2533 ( (?>(?: [^"\s] )* ) ) (?>\s+)
2534 /oxmsg
2535 ) {
2536 0 ▶ push @piece, defined($1) ? $1 : $2;
Branch: 1 branch
BranchTrueFalseTotal
defined $1 ? : 0 0 0
2537 }
2538 0 return @piece;
2539 }
2540  
2541 #
2542 # Latin-9 parse path
2543 #
2544 0 ▶sub _parse_path {
Subroutine _parse_path: not called CC=2 SCAR=17.9
2545  
2546 0 my($path,$pathsep) = @_;
2547  
2548 0 $path .= '/';
2549 0 my @subpath = ();
2550 0 ▶ while ($path =~ /
Branch: 1 branch
BranchTrueFalseTotal
if ($path =~ m( ((?: [^/\\] )+?) [/\\] )gmosx) 0 0 0
2551 ((?: [^\/\\] )+?) [\/\\]
2552 /oxmsg
2553 ) {
2554 0 push @subpath, $1;
2555 }
2556  
2557 0 my $tail = pop @subpath;
2558 0 my $head = join $pathsep, @subpath;
2559 0 return $head, $tail;
2560 }
2561  
2562 #
2563 # via File::HomeDir::Windows 1.00
2564 #
2565 0 ▶sub my_home_MSWin32 {
Subroutine my_home_MSWin32: not called CC=9 SCAR=45.0
Pod undocumented
2566  
2567 # A lot of unix people and unix-derived tools rely on
2568 # the ability to overload HOME. We will support it too
2569 # so that they can replace raw HOME calls with File::HomeDir.
2570 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
2571 0 return $ENV{'HOME'};
2572 }
2573  
2574 # Do we have a user profile?
2575 ▶ 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
2576 0 return $ENV{'USERPROFILE'};
2577 }
2578  
2579 # Some Windows use something like $ENV{'HOME'}
2580 ▶ 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
2581 0 return join '', $ENV{'HOMEDRIVE'}, $ENV{'HOMEPATH'};
2582 }
2583  
2584 0 return undef;
2585 }
2586  
2587 #
2588 # via File::HomeDir::Unix 1.00
2589 #
2590 0 ▶sub my_home {
Subroutine my_home: not called CC=7 SCAR=40.3
Pod undocumented
2591 0 my $home;
2592  
2593 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
2594 0 $home = $ENV{'HOME'};
2595 }
2596  
2597 # This is from the original code, but I'm guessing
2598 # it means "login directory" and exists on some Unixes.
2599 ▶ 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
2600 0 $home = $ENV{'LOGDIR'};
2601 }
2602  
2603 ### More-desperate methods
2604  
2605 # Light desperation on any (Unixish) platform
2606 else {
2607 0 $home = CORE::eval q{ (getpwuid($<))[7] };
2608 }
2609  
2610 # On Unix in general, a non-existant home means "no home"
2611 # For example, "nobody"-like users might use /nonexistant
2612 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
2613 0 $home = undef;
2614 }
2615 0 return $home;
2616 }
2617  
2618 #
2619 # ${^PREMATCH}, $PREMATCH, $` the string preceding what was matched
2620 #
2621 56 ▶sub Elatin9::PREMATCH {
Subroutine PREMATCH: called CC=1 SCAR=0.0
Pod undocumented
2622 56 return $`;
2623 }
2624  
2625 #
2626 # ${^MATCH}, $MATCH, $& the string that matched
2627 #
2628 81 ▶sub Elatin9::MATCH {
Subroutine MATCH: called CC=1 SCAR=0.0
Pod undocumented
2629 81 return $&;
2630 }
2631  
2632 #
2633 # ${^POSTMATCH}, $POSTMATCH, $' the string following what was matched
2634 #
2635 42 ▶sub Elatin9::POSTMATCH {
Subroutine POSTMATCH: called CC=1 SCAR=0.0
Pod undocumented
2636 42 return $';
2637 }
2638  
2639 #
2640 # Latin-9 character to order (with parameter)
2641 #
2642 0 ▶sub Latin9::ord(;$) {
Subroutine ord: not called CC=4 SCAR=30.0
2643  
2644 0 ▶ local $_ = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
2645  
2646 0 ▶ if (/\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\A ($Elatin9::q_char) /mosx) { } 0 0 0
2647 0 my @ord = unpack 'C*', $1;
2648 0 my $ord = 0;
2649 0 ▶ while (my $o = shift @ord) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $o = shift @ord) 0 0 0
2650 0 $ord = $ord * 0x100 + $o;
2651 }
2652 0 return $ord;
2653 }
2654 else {
2655 0 return CORE::ord $_;
2656 }
2657 }
2658  
2659 #
2660 # Latin-9 character to order (without parameter)
2661 #
2662 0 ▶sub Latin9::ord_() {
Subroutine ord_: not called CC=3 SCAR=24.8
2663  
2664 0 ▶ if (/\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\A ($Elatin9::q_char) /mosx) { } 0 0 0
2665 0 my @ord = unpack 'C*', $1;
2666 0 my $ord = 0;
2667 0 ▶ while (my $o = shift @ord) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $o = shift @ord) 0 0 0
2668 0 $ord = $ord * 0x100 + $o;
2669 }
2670 0 return $ord;
2671 }
2672 else {
2673 0 return CORE::ord $_;
2674 }
2675 }
2676  
2677 #
2678 # Latin-9 reverse
2679 #
2680 0 ▶sub Latin9::reverse(@) {
Subroutine reverse: not called CC=2 SCAR=17.9
2681  
2682 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2683 0 return CORE::reverse @_;
2684 }
2685 else {
2686  
2687 # One of us once cornered Larry in an elevator and asked him what
2688 # problem he was solving with this, but he looked as far off into
2689 # the distance as he could in an elevator and said, "It seemed like
2690 # a good idea at the time."
2691  
2692 0 return join '', CORE::reverse(join('',@_) =~ /\G ($q_char) /oxmsg);
2693 }
2694 }
2695  
2696 #
2697 # Latin-9 getc (with parameter, without parameter)
2698 #
2699 20 ▶sub Latin9::getc(;*@) {
Subroutine getc: called CC=9 SCAR=26.7
2700  
2701 20 my($package) = caller;
2702 20 ▶ my $fh = @_ ? qualify_to_ref(shift,$package) : \*STDIN;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 20 0 20
2703 20 ▶ croak 'Too many arguments for Latin9::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
2704  
2705 0 my @length = sort { $a <=> $b } keys %range_tr;
2706 20 my $getc = '';
2707 20 for my $length ($length[0] .. $length[-1]) {
2708 20 $getc .= CORE::getc($fh);
2709 20 ▶ if (exists $range_tr{CORE::length($getc)}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{length $getc}) 20 0 20
2710 20 ▶ if ($getc =~ /\A ${Elatin9::dot_s} \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($getc =~ /\A $Elatin9::dot_s \z/mosx) 20 0 20
2711 20 ▶ return wantarray ? ($getc,@_) : $getc;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 20 20
2712 }
2713 }
2714 }
2715 0 ▶ return wantarray ? ($getc,@_) : $getc;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
2716 }
2717  
2718 #
2719 # Latin-9 length by character
2720 #
2721 0 ▶sub Latin9::length(;$) {
Subroutine length: not called CC=2 SCAR=17.9
2722  
2723 0 ▶ local $_ = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
2724  
2725 0 local @_ = /\G ($q_char) /oxmsg;
2726 0 return scalar @_;
2727 }
2728  
2729 #
2730 # Latin-9 substr by character
2731 #
2732 422 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=7.0
2733  
2734 # P.232 The lvalue Attribute
2735 # in Chapter 6: Subroutines
2736 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2737  
2738 # P.336 The lvalue Attribute
2739 # in Chapter 7: Subroutines
2740 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2741  
2742 # P.144 8.4 Lvalue subroutines
2743 # in Chapter 8: perlsub: Perl subroutines
2744 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
2745  
2746 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
2747 # vv----------------------*******
2748 sub Latin9::substr($$;$$) %s {
2749  
2750 my @char = $_[0] =~ /\G (?>$q_char) /oxmsg;
2751  
2752 # If the substring is beyond either end of the string, substr() returns the undefined
2753 # value and produces a warning. When used as an lvalue, specifying a substring that
2754 # is entirely outside the string raises an exception.
2755 # http://perldoc.perl.org/functions/substr.html
2756  
2757 # A return with no argument returns the scalar value undef in scalar context,
2758 # an empty list () in list context, and (naturally) nothing at all in void
2759 # context.
2760  
2761 my $offset = $_[1];
2762 if (($offset > scalar(@char)) or ($offset < (-1 * scalar(@char)))) {
2763 return;
2764 }
2765  
2766 # substr($string,$offset,$length,$replacement)
2767 if (@_ == 4) {
2768 my(undef,undef,$length,$replacement) = @_;
2769 my $substr = join '', splice(@char, $offset, $length, $replacement);
2770 $_[0] = join '', @char;
2771  
2772 # return $substr; this doesn't work, don't say "return"
2773 $substr;
2774 }
2775  
2776 # substr($string,$offset,$length)
2777 elsif (@_ == 3) {
2778 my(undef,undef,$length) = @_;
2779 my $octet_offset = 0;
2780 my $octet_length = 0;
2781 if ($offset == 0) {
2782 $octet_offset = 0;
2783 }
2784 elsif ($offset > 0) {
2785 $octet_offset = CORE::length(join '', @char[0..$offset-1]);
2786 }
2787 else {
2788 $octet_offset = -1 * CORE::length(join '', @char[$#char+$offset+1..$#char]);
2789 }
2790 if ($length == 0) {
2791 $octet_length = 0;
2792 }
2793 elsif ($length > 0) {
2794 $octet_length = CORE::length(join '', @char[$offset..$offset+$length-1]);
2795 }
2796 else {
2797 $octet_length = -1 * CORE::length(join '', @char[$#char+$length+1..$#char]);
2798 }
2799 CORE::substr($_[0], $octet_offset, $octet_length);
2800 }
2801  
2802 # substr($string,$offset)
2803 else {
2804 my $octet_offset = 0;
2805 if ($offset == 0) {
2806 $octet_offset = 0;
2807 }
2808 elsif ($offset > 0) {
2809 $octet_offset = CORE::length(join '', @char[0..$offset-1]);
2810 }
2811 else {
2812 $octet_offset = -1 * CORE::length(join '', @char[$#char+$offset+1..$#char]);
2813 }
2814 CORE::substr($_[0], $octet_offset);
2815 }
2816 }
2817 END
2818 }
2819  
2820 #
2821 # Latin-9 index by character
2822 #
2823 0 ▶sub Latin9::index($$;$) {
Subroutine index: not called CC=3 SCAR=24.8
2824  
2825 0 my $index;
2826 0 ▶ if (@_ == 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 3) { } 0 0 0
2827 0 $index = Elatin9::index($_[0], $_[1], CORE::length(Latin9::substr($_[0], 0, $_[2])));
2828 }
2829 else {
2830 0 $index = Elatin9::index($_[0], $_[1]);
2831 }
2832  
2833 0 ▶ if ($index == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($index == -1) { } 0 0 0
2834 0 return -1;
2835 }
2836 else {
2837 0 return Latin9::length(CORE::substr $_[0], 0, $index);
2838 }
2839 }
2840  
2841 #
2842 # Latin-9 rindex by character
2843 #
2844 0 ▶sub Latin9::rindex($$;$) {
Subroutine rindex: not called CC=3 SCAR=24.8
2845  
2846 0 my $rindex;
2847 0 ▶ if (@_ == 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 3) { } 0 0 0
2848 0 $rindex = Elatin9::rindex($_[0], $_[1], CORE::length(Latin9::substr($_[0], 0, $_[2])));
2849 }
2850 else {
2851 0 $rindex = Elatin9::rindex($_[0], $_[1]);
2852 }
2853  
2854 0 ▶ if ($rindex == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rindex == -1) { } 0 0 0
2855 0 return -1;
2856 }
2857 else {
2858 0 return Latin9::length(CORE::substr $_[0], 0, $rindex);
2859 }
2860 }
2861  
2862 # when 'm//', '/' means regexp match 'm//' and '?' means regexp match '??'
2863 # when 'div', '/' means division operator and '?' means conditional operator (condition ? then : else)
2864 422 ▶use vars qw($slash); $slash = 'm//';
Subroutine BEGIN: called CC=1 SCAR=0.0
2865  
2866 # ord() to ord() or Latin9::ord()
2867 422 my $function_ord = 'ord';
2868  
2869 # ord to ord or Latin9::ord_
2870 422 my $function_ord_ = 'ord';
2871  
2872 # reverse to reverse or Latin9::reverse
2873 422 my $function_reverse = 'reverse';
2874  
2875 # getc to getc or Latin9::getc
2876 422 my $function_getc = 'getc';
2877  
2878 # P.1023 Appendix W.9 Multibyte Anchoring
2879 # of ISBN 1-56592-224-7 CJKV Information Processing
2880  
2881 422 my $anchor = '';
2882  
2883 422 ▶use vars qw($nest);
Subroutine BEGIN: called CC=1 SCAR=0.0
2884  
2885 # regexp of nested parens in qqXX
2886  
2887 # P.340 Matching Nested Constructs with Embedded Code
2888 # in Chapter 7: Perl
2889 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
2890  
2891 my $qq_paren = qr{(?{local $nest=0}) (?>(?:
2892 [^\\()] |
2893 \( (?{$nest++}) |
2894 \) (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2895 \\ [^c] |
2896 \\c[\x40-\x5F] |
2897 [\x00-\xFF]
2898 422 }xms;
2899  
2900 my $qq_brace = qr{(?{local $nest=0}) (?>(?:
2901 [^\\{}] |
2902 \{ (?{$nest++}) |
2903 \} (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2904 \\ [^c] |
2905 \\c[\x40-\x5F] |
2906 [\x00-\xFF]
2907 422 }xms;
2908  
2909 my $qq_bracket = qr{(?{local $nest=0}) (?>(?:
2910 [^\\\[\]] |
2911 \[ (?{$nest++}) |
2912 \] (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2913 \\ [^c] |
2914 \\c[\x40-\x5F] |
2915 [\x00-\xFF]
2916 422 }xms;
2917  
2918 my $qq_angle = qr{(?{local $nest=0}) (?>(?:
2919 [^\\<>] |
2920 \< (?{$nest++}) |
2921 \> (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2922 \\ [^c] |
2923 \\c[\x40-\x5F] |
2924 [\x00-\xFF]
2925 422 }xms;
2926  
2927 422 my $qq_scalar = qr{(?: \{ (?:$qq_brace)*? \} |
2928 (?: ::)? (?:
2929 (?> [a-zA-Z_][a-zA-Z_0-9]* (?: ::[a-zA-Z_][a-zA-Z_0-9]*)* )
2930 (?>(?: \[ (?: \$\[ | \$\] | $qq_char )*? \] | \{ (?:$qq_brace)*? \} )*)
2931 (?>(?: (?: -> )? (?: [\$\@\%\&\*]\* | \$\#\* | [\@\%]? \[ (?: \$\[ | \$\] | $qq_char )*? \] | [\@\%\*]? \{ (?:$qq_brace)*? \} ) )*)
2932 ))
2933 }xms;
2934  
2935 422 my $qq_variable = qr{(?: \{ (?:$qq_brace)*? \} |
2936 (?: ::)? (?:
2937 (?>[0-9]+) |
2938 [^a-zA-Z_0-9\[\]] |
2939 ^[A-Z] |
2940 (?> [a-zA-Z_][a-zA-Z_0-9]* (?: ::[a-zA-Z_][a-zA-Z_0-9]*)* )
2941 (?>(?: \[ (?: \$\[ | \$\] | $qq_char )*? \] | \{ (?:$qq_brace)*? \} )*)
2942 (?>(?: (?: -> )? (?: [\$\@\%\&\*]\* | \$\#\* | [\@\%]? \[ (?: \$\[ | \$\] | $qq_char )*? \] | [\@\%\*]? \{ (?:$qq_brace)*? \} ) )*)
2943 ))
2944 }xms;
2945  
2946 422 my $qq_substr = qr{(?> Char::substr | Latin9::substr | CORE::substr | substr ) (?>\s*) \( $qq_paren \)
2947 }xms;
2948  
2949 # regexp of nested parens in qXX
2950 my $q_paren = qr{(?{local $nest=0}) (?>(?:
2951 [^()] |
2952 \( (?{$nest++}) |
2953 \) (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2954 [\x00-\xFF]
2955 422 }xms;
2956  
2957 my $q_brace = qr{(?{local $nest=0}) (?>(?:
2958 [^\{\}] |
2959 \{ (?{$nest++}) |
2960 \} (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2961 [\x00-\xFF]
2962 422 }xms;
2963  
2964 my $q_bracket = qr{(?{local $nest=0}) (?>(?:
2965 [^\[\]] |
2966 \[ (?{$nest++}) |
2967 \] (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2968 [\x00-\xFF]
2969 422 }xms;
2970  
2971 my $q_angle = qr{(?{local $nest=0}) (?>(?:
2972 [^<>] |
2973 \< (?{$nest++}) |
2974 \> (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2975 [\x00-\xFF]
2976 422 }xms;
2977  
2978 422 my $matched = '';
2979 422 my $s_matched = '';
2980  
2981 422 my $tr_variable = ''; # variable of tr///
2982 422 my $sub_variable = ''; # variable of s///
2983 422 my $bind_operator = ''; # =~ or !~
2984  
2985 422 my @heredoc = (); # here document
2986 422 my @heredoc_delimiter = ();
2987 422 my $here_script = ''; # here script
2988  
2989 #
2990 # escape Latin-9 script
2991 #
2992 547 ▶sub Latin9::escape(;$) {
Subroutine escape: called CC=3 SCAR=11.0
2993 547 ▶ local($_) = $_[0] if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 292 255 547
2994  
2995 # P.359 The Study Function
2996 # in Chapter 7: Perl
2997 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
2998  
2999 547 study $_; # Yes, I studied study yesterday.
3000  
3001 # while all script
3002  
3003 # 6.14. Matching from Where the Last Pattern Left Off
3004 # in Chapter 6. Pattern Matching
3005 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
3006 # (and so on)
3007  
3008 # one member of Tag-team
3009 #
3010 # P.128 Start of match (or end of previous match): \G
3011 # P.130 Advanced Use of \G with Perl
3012 # in Chapter 3: Overview of Regular Expression Features and Flavors
3013 # P.255 Use leading anchors
3014 # P.256 Expose ^ and \G at the front expressions
3015 # in Chapter 6: Crafting an Efficient Expression
3016 # P.315 "Tag-team" matching with /gc
3017 # in Chapter 7: Perl
3018 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3019  
3020 547 my $e_script = '';
3021 547 ▶ while (not /\G \z/oxgc) { # member
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 86370 547 86917
3022 86370 $e_script .= Latin9::escape_token();
3023 }
3024  
3025 547 return $e_script;
3026 }
3027  
3028 #
3029 # escape Latin-9 token of script
3030 #
3031 86370 ▶sub Latin9::escape_token {
Subroutine escape_token: called CC=504 SCAR=109.3
3032  
3033 # \n output here document
3034  
3035 86370 my $ignore_modules = join('|', qw(
3036 utf8
3037 bytes
3038 charnames
3039 I18N::Japanese
3040 I18N::Collate
3041 I18N::JExt
3042 File::DosGlob
3043 Wild
3044 Wildcard
3045 Japanese
3046 ));
3047  
3048 # another member of Tag-team
3049 #
3050 # P.315 "Tag-team" matching with /gc
3051 # in Chapter 7: Perl
3052 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3053  
3054 86370 ▶ if (/\G ( \n ) /oxgc) { # another member (and so on)
Branch: 139 branches
BranchTrueFalseTotal
if (/\G ( \n ) /cgox) { } 12803 73567 86370
elsif (/\G ((?>\s+)|\#.*) /cgox) { } 21283 52284 73567
elsif (/\G ( (?: if | elsif | unless | while | until | given | when ) (?>\s*) \( ) /cgox) { } 1644 50640 52284
elsif (/\G ( \( (?>\s*) (?: local \b | my \b | our \b | state \b )? (?>\s*) \$ $qq_scalar ) /cgox) { } 90 50550 50640
elsif (/\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /cgmosx) { } 4 50546 50550
elsif (/\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /cgmosx) { } 28 50518 50546
elsif (/\G ( \$' | \$\{'\} ) /cgmosx) { } 1 50517 50518
elsif (/\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /cgmosx) { } 3 50514 50517
elsif (/\G ( \$ $qq_scalar | $qq_substr ) /cgox) { } 1752 48762 50514
elsif (/\G ( [,;] ) /cgox) { } 5062 43700 48762
elsif (/\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /cgmosx) { } 0 43700 43700
elsif (/\G ( \$ 0 ) /cgmosx) { } 2 43698 43700
elsif (/\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /cgmosx) { } 0 43698 43698
elsif (/\G ( \$ \$ ) (?![\w\{]) /cgmosx) { } 1 43697 43698
elsif (/\G \$ ((?>[1-9][0-9]*)) /cgmosx) { } 4 43693 43697
elsif (/\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /cgmosx) { } 0 43693 43693
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /cgmosx) { } 0 43693 43693
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /cgmosx) { } 0 43693 43693
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /cgmosx) { } 0 43693 43693
elsif (/\G \$ (?>\s*) \{ ( (?>\s*) (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* ) (?>\s*) ) \} /cgmosx) { } 0 43693 43693
elsif (/\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /cgmosx) { } 0 43693 43693
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 43651 43693
elsif (m{\G ( \$[\$\@\#\\\'\"/\?\(\)\[\]\<\>] ) }cgmosx) { } 63 43588 43651
elsif (/\G \b (while (?>\s*) \( (?>\s*) <[\$]?[A-Za-z_][A-Za-z_0-9]*> (?>\s*) \)) \b /cgox) { } 0 43588 43588
elsif (/\G \b while (?>\s*) \( (?>\s*) < ((?:[^>\0\a\e\f\n\r\t])+?) > (?>\s*) \) \b /cgox) { } 0 43588 43588
elsif (/\G \b while (?>\s*) \( (?>\s*) glob (?>\s*) \) /cgox) { } 0 43588 43588
elsif (/\G \b while (?>\s*) \( (?>\s*) glob \b /cgox) { } 0 43588 43588
elsif (/\G \b ( if | unless | while | until | for | when ) \b /cgox) { } 251 43337 43588
elsif (/\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /cgox) { } 19 43318 43337
elsif (/\G \b Char::eval (?= (?>\s*) \{ ) /cgox) { } 0 43318 43318
elsif (/\G \b Latin9::eval (?= (?>\s*) \{ ) /cgox) { } 22 43296 43318
elsif (/\G \b Char::eval \b (?! (?>\s*) => ) /cgox) { } 0 43296 43296
elsif (/\G \b Latin9::eval \b (?! (?>\s*) => ) /cgox) { } 168 43128 43296
elsif (/\G \b bytes::substr \b (?! (?>\s*) => ) /cgox) { } 2 43126 43128
elsif (/\G \b chop \b (?! (?>\s*) => ) /cgox) { } 0 43126 43126
elsif (/\G \b bytes::index \b (?! (?>\s*) => ) /cgox) { } 2 43124 43126
elsif (/\G \b Char::index \b (?! (?>\s*) => ) /cgox) { } 0 43124 43124
elsif (/\G \b Latin9::index \b (?! (?>\s*) => ) /cgox) { } 0 43124 43124
elsif (/\G \b index \b (?! (?>\s*) => ) /cgox) { } 0 43124 43124
elsif (/\G \b bytes::rindex \b (?! (?>\s*) => ) /cgox) { } 2 43122 43124
elsif (/\G \b Char::rindex \b (?! (?>\s*) => ) /cgox) { } 0 43122 43122
elsif (/\G \b Latin9::rindex \b (?! (?>\s*) => ) /cgox) { } 0 43122 43122
elsif (/\G \b rindex \b (?! (?>\s*) => ) /cgox) { } 0 43122 43122
elsif (/\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 1 43121 43122
elsif (/\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43121 43121
elsif (/\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 1 43120 43121
elsif (/\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43120 43120
elsif (/\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 6 43114 43120
elsif (/\G -s (?>\s*) (\") ((?:$Elatin9::qq_char)+?) (\") /cgox) { } 0 43114 43114
elsif (/\G -s (?>\s+) qq (?>\s*) (\#) ((?:$Elatin9::qq_char)+?) (\#) /cgox) { } 0 43114 43114
elsif (/\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /cgox) { } 0 43114 43114
elsif (/\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /cgox) { } 0 43114 43114
elsif (/\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /cgox) { } 0 43114 43114
elsif (/\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /cgox) { } 0 43114 43114
elsif (/\G -s (?>\s+) qq (?>\s*) (\S) ((?:$Elatin9::qq_char)+?) (\1) /cgox) { } 0 43114 43114
elsif (/\G -s (?>\s*) (\') ((?:\\\'|\\\\|$Elatin9::q_char)+?) (\') /cgox) { } 0 43114 43114
elsif (/\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$Elatin9::q_char)+?) (\#) /cgox) { } 0 43114 43114
elsif (/\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /cgox) { } 0 43114 43114
elsif (/\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /cgox) { } 0 43114 43114
elsif (/\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /cgox) { } 0 43114 43114
elsif (/\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /cgox) { } 0 43114 43114
elsif (/\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$Elatin9::q_char)+?) (\1) /cgox) { } 0 43114 43114
elsif (/\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)* ) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ) )*) /cgox) { } 0 43114 43114
elsif (/\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /cgox) { } 0 43114 43114
elsif (/\G -s (?= (?>\s+) [a-z]+) /cgox) { } 0 43114 43114
elsif (/\G -s (?>\s+) ((?>\w+)) /cgox) { } 0 43114 43114
elsif (/\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43112 43114
elsif (/\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43110 43112
elsif (/\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 36 43074 43110
elsif (/\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43072 43074
elsif (/\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 8 43064 43072
elsif (/\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43064 43064
elsif (/\G \b lc \b (?! (?>\s*) => ) /cgox) { } 0 43064 43064
elsif (/\G \b lcfirst \b (?! (?>\s*) => ) /cgox) { } 0 43064 43064
elsif (/\G \b uc \b (?! (?>\s*) => ) /cgox) { } 0 43064 43064
elsif (/\G \b ucfirst \b (?! (?>\s*) => ) /cgox) { } 0 43064 43064
elsif (/\G \b fc \b (?! (?>\s*) => ) /cgox) { } 0 43064 43064
elsif (/\G -s \b (?! (?>\s*) => ) /cgox) { } 0 43064 43064
elsif (/\G \b bytes::length \b (?! (?>\s*) => ) /cgox) { } 0 43064 43064
elsif (/\G \b bytes::chr \b (?! (?>\s*) => ) /cgox) { } 0 43064 43064
elsif (/\G \b chr \b (?! (?>\s*) => ) /cgox) { } 0 43064 43064
elsif (/\G \b bytes::ord \b (?! (?>\s*) => ) /cgox) { } 0 43064 43064
elsif (/\G \b ord \b (?! (?>\s*) => ) /cgox) { } 0 43064 43064
elsif (/\G \b glob \b (?! (?>\s*) => ) /cgox) { } 0 43064 43064
elsif (/\G \b reverse \b (?! (?>\s*) => ) /cgox) { } 0 43064 43064
elsif (/\G \b getc \b (?! (?>\s*) => ) /cgox) { } 8 43056 43064
elsif (/\G \b (split) \b (?! (?>\s*) => ) /cgox) { } 87 42969 43056
elsif (/\G \b ( tr | y ) \b /cgox) { } 4 42965 42969
elsif (/\G \b (qq) \b /cgox) { } 2252 40713 42965
elsif (/\G \b (qr) \b /cgox) { } 0 40713 40713
elsif (/\G \b (qw) \b /cgox) { } 16 40697 40713
elsif (/\G \b (qx) \b /cgox) { } 0 40697 40697
elsif (/\G \b (q) \b /cgox) { } 473 40224 40697
elsif (/\G \b (m) \b /cgox) { } 209 40015 40224
elsif (/\G \b (s) \b /cgox) { } 101 39914 40015
elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 0 39914 39914
elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 39914 39914
elsif (/\G \b require ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 39914 39914
elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [#\n]) /cgmosx) { } 37 39877 39914
elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 39877 39877
elsif (/\G \b use ((?>\s+) strict) \b /cgmosx) { } 0 39877 39877
elsif (/\G \b use (?>\s+) ((?>([1-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /cgmosx) { } 2 39875 39877
elsif (/\G \b use (?>\s+) ((?>v([0-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /cgmosx) { } 0 39875 39875
elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 2 39873 39875
elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 39873 39873
elsif (/\G \b use ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 39873 39873
elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 0 39873 39873
elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 39873 39873
elsif (/\G \b no ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 39873 39873
elsif (/\G \b use \b /cgmosx) { } 0 39873 39873
elsif (/\G \b no \b /cgmosx) { } 2 39871 39873
elsif (/\G (?<![\w\$\@\%\&\*]) (\') /cgox) { } 1142 38729 39871
elsif (/\G (\") /cgox) { } 1881 36848 38729
elsif (/\G (\`) /cgox) { } 1 36847 36848
elsif ($Elatin9::slash eq 'm//' and m[\G (/) ]cgox) { } 681 36166 36847
elsif ($Elatin9::slash eq 'm//' and /\G (\?) /cgox) { } 0 36166 36166
elsif (/\G ( <<>> ) /cgox) { } 0 36166 36166
elsif (/\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /cgox) { } 0 36166 36166
elsif (/\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /cgox) { } 6 36160 36166
elsif (/\G ( <<~ \\([a-zA-Z_0-9]+) ) /cgox) { } 3 36157 36160
elsif (/\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /cgox) { } 6 36151 36157
elsif (/\G ( <<~ ([a-zA-Z_0-9]+) ) /cgox) { } 3 36148 36151
elsif (/\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /cgox) { } 6 36142 36148
elsif (/\G ( << '([a-zA-Z_0-9]*)' ) /cgox) { } 72 36070 36142
elsif (/\G ( << \\([a-zA-Z_0-9]+) ) /cgox) { } 0 36070 36070
elsif (/\G ( << "([a-zA-Z_0-9]*)" ) /cgox) { } 36 36034 36070
elsif (/\G ( << ([a-zA-Z_0-9]+) ) /cgox) { } 42 35992 36034
elsif (/\G ( << `([a-zA-Z_0-9]*)` ) /cgox) { } 0 35992 35992
elsif (/\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/cgox) { } 12 35980 35992
elsif (/\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /cgox) { } 0 35980 35980
elsif (/\G < ((?:[^>\0\a\e\f\n\r\t])+?) > /cgox) { } 0 35980 35980
elsif (/\G ^ ( __DATA__ \n .*) \z /cgmosx) { } 0 35980 35980
elsif (/\G ^ ( __END__ \n .*) \z /cgmosx) { } 210 35770 35980
elsif (/\G ( \cD .*) \z /cgmosx) { } 0 35770 35770
elsif (/\G ( \cZ .*) \z /cgmosx) { } 0 35770 35770
elsif (/\G ( -- | \+\+ | [\)\}\]] ) /cgox) { } 5837 29933 35770
elsif (/\G ( \.\.\. ) /cgox) { } 7 29926 29933
elsif (m"\G ((?> !~~ | !~ | != | ! | %= | % | &&= | && | &= | &\.= | &\. | & | -= | -> | - | :(?>\s*)= | : | <<>> | <<= | <=> | <= | < | == | => | =~ | = | >>= | >> | >= | > | \*\*= | \*\* | \*= | \* | \+= | \+ | \.\. | \.= | \. | //= | // | /= | / | \? | \\ | \^= | \^\.= | \^\. | \^ | \b x= | \|\|= | \|\| | \|= | \|\.= | \|\. | \| | ~~ | ~\. | ~ | \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b | \b(?: print )\b | [,;\(\{\[] )) "cgox) { } 9770 20156 29926
elsif (/\G ($Elatin9::q_char) /cgox) { } 20156 0 20156
3055 12803 my $heredoc = '';
3056 12803 ▶ if (scalar(@heredoc_delimiter) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @heredoc_delimiter >= 1) 174 12629 12803
3057 174 $slash = 'm//';
3058  
3059 174 $heredoc = join '', @heredoc;
3060 174 @heredoc = ();
3061  
3062 # skip here document
3063 174 for my $heredoc_delimiter (@heredoc_delimiter) {
3064 174 /\G .*? \n $heredoc_delimiter \n/xmsgc;
3065 }
3066 174 @heredoc_delimiter = ();
3067  
3068 174 $here_script = '';
3069 }
3070 12803 return "\n" . $heredoc;
3071 }
3072  
3073 # ignore space, comment
3074 21283 elsif (/\G ((?>\s+)|\#.*) /oxgc) { return $1; }
3075  
3076 # if (, elsif (, unless (, while (, until (, given (, and when (
3077  
3078 # given, when
3079  
3080 # P.225 The given Statement
3081 # in Chapter 15: Smart Matching and given-when
3082 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
3083  
3084 # P.133 The given Statement
3085 # in Chapter 4: Statements and Declarations
3086 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
3087  
3088 elsif (/\G ( (?: if | elsif | unless | while | until | given | when ) (?>\s*) \( ) /oxgc) {
3089 1644 $slash = 'm//';
3090 1644 return $1;
3091 }
3092  
3093 # scalar variable ($scalar = ...) =~ tr///;
3094 # scalar variable ($scalar = ...) =~ s///;
3095  
3096 # state
3097  
3098 # P.68 Persistent, Private Variables
3099 # in Chapter 4: Subroutines
3100 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
3101  
3102 # P.160 Persistent Lexically Scoped Variables: state
3103 # in Chapter 4: Statements and Declarations
3104 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
3105  
3106 # (and so on)
3107  
3108 elsif (/\G ( \( (?>\s*) (?: local \b | my \b | our \b | state \b )? (?>\s*) \$ $qq_scalar ) /oxgc) {
3109 90 my $e_string = e_string($1);
3110  
3111 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
3112 0 $tr_variable = $e_string . e_string($1);
3113 0 $bind_operator = $2;
3114 0 $slash = 'm//';
3115 0 return '';
3116 }
3117 elsif (/\G ( (?>\s*) = $qq_paren \) ) ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /oxgc) {
3118 0 $sub_variable = $e_string . e_string($1);
3119 0 $bind_operator = $2;
3120 0 $slash = 'm//';
3121 0 return '';
3122 }
3123 else {
3124 90 $slash = 'div';
3125 90 return $e_string;
3126 }
3127 }
3128  
3129 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin9::PREMATCH()
3130 elsif (/\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /oxmsgc) {
3131 4 $slash = 'div';
3132 4 return q{Elatin9::PREMATCH()};
3133 }
3134  
3135 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin9::MATCH()
3136 elsif (/\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /oxmsgc) {
3137 28 $slash = 'div';
3138 28 return q{Elatin9::MATCH()};
3139 }
3140  
3141 # $', ${'} --> $', ${'}
3142 elsif (/\G ( \$' | \$\{'\} ) /oxmsgc) {
3143 1 $slash = 'div';
3144 1 return $1;
3145 }
3146  
3147 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin9::POSTMATCH()
3148 elsif (/\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /oxmsgc) {
3149 3 $slash = 'div';
3150 3 return q{Elatin9::POSTMATCH()};
3151 }
3152  
3153 # scalar variable $scalar =~ tr///;
3154 # scalar variable $scalar =~ s///;
3155 # substr() =~ tr///;
3156 # substr() =~ s///;
3157 elsif (/\G ( \$ $qq_scalar | $qq_substr ) /oxgc) {
3158 1752 my $scalar = e_string($1);
3159  
3160 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
3161 2 $tr_variable = $scalar;
3162 2 $bind_operator = $1;
3163 2 $slash = 'm//';
3164 2 return '';
3165 }
3166 elsif (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /oxgc) {
3167 65 $sub_variable = $scalar;
3168 65 $bind_operator = $1;
3169 65 $slash = 'm//';
3170 65 return '';
3171 }
3172 else {
3173 1685 $slash = 'div';
3174 1685 return $scalar;
3175 }
3176 }
3177  
3178 # end of statement
3179 elsif (/\G ( [,;] ) /oxgc) {
3180 5062 $slash = 'm//';
3181  
3182 # clear tr/// variable
3183 5062 $tr_variable = '';
3184  
3185 # clear s/// variable
3186 5062 $sub_variable = '';
3187  
3188 5062 $bind_operator = '';
3189  
3190 5062 return $1;
3191 }
3192  
3193 # bareword
3194 elsif (/\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /oxmsgc) {
3195 0 return $1;
3196 }
3197  
3198 # $0 --> $0
3199 elsif (/\G ( \$ 0 ) /oxmsgc) {
3200 2 $slash = 'div';
3201 2 return $1;
3202 }
3203 elsif (/\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /oxmsgc) {
3204 0 $slash = 'div';
3205 0 return $1;
3206 }
3207  
3208 # $$ --> $$
3209 elsif (/\G ( \$ \$ ) (?![\w\{]) /oxmsgc) {
3210 1 $slash = 'div';
3211 1 return $1;
3212 }
3213  
3214 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
3215 # $1, $2, $3 --> $1, $2, $3 otherwise
3216 elsif (/\G \$ ((?>[1-9][0-9]*)) /oxmsgc) {
3217 4 $slash = 'div';
3218 4 return e_capture($1);
3219 }
3220 elsif (/\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /oxmsgc) {
3221 0 $slash = 'div';
3222 0 return e_capture($1);
3223 }
3224  
3225 # $$foo[ ... ] --> $ $foo->[ ... ]
3226 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /oxmsgc) {
3227 0 $slash = 'div';
3228 0 return e_capture($1.'->'.$2);
3229 }
3230  
3231 # $$foo{ ... } --> $ $foo->{ ... }
3232 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /oxmsgc) {
3233 0 $slash = 'div';
3234 0 return e_capture($1.'->'.$2);
3235 }
3236  
3237 # $$foo
3238 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /oxmsgc) {
3239 0 $slash = 'div';
3240 0 return e_capture($1);
3241 }
3242  
3243 # ${ foo }
3244 elsif (/\G \$ (?>\s*) \{ ( (?>\s*) (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* ) (?>\s*) ) \} /oxmsgc) {
3245 0 $slash = 'div';
3246 0 return '${' . $1 . '}';
3247 }
3248  
3249 # ${ ... }
3250 elsif (/\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /oxmsgc) {
3251 0 $slash = 'div';
3252 0 return e_capture($1);
3253 }
3254  
3255 # variable or function
3256 # $ @ % & * $ #
3257 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) {
3258 42 $slash = 'div';
3259 42 return $1;
3260 }
3261 # $ $ $ $ $ $ $ $ $ $ $ $ $ $
3262 # $ @ # \ ' " / ? ( ) [ ] < >
3263 elsif (/\G ( \$[\$\@\#\\\'\"\/\?\(\)\[\]\<\>] ) /oxmsgc) {
3264 63 $slash = 'div';
3265 63 return $1;
3266 }
3267  
3268 # while (<FILEHANDLE>)
3269 elsif (/\G \b (while (?>\s*) \( (?>\s*) <[\$]?[A-Za-z_][A-Za-z_0-9]*> (?>\s*) \)) \b /oxgc) {
3270 0 return $1;
3271 }
3272  
3273 # while (<WILDCARD>) --- glob
3274  
3275 # avoid "Error: Runtime exception" of perl version 5.005_03
3276  
3277 elsif (/\G \b while (?>\s*) \( (?>\s*) < ((?:[^>\0\a\e\f\n\r\t])+?) > (?>\s*) \) \b /oxgc) {
3278 0 return 'while ($_ = Elatin9::glob("' . $1 . '"))';
3279 }
3280  
3281 # while (glob)
3282 elsif (/\G \b while (?>\s*) \( (?>\s*) glob (?>\s*) \) /oxgc) {
3283 0 return 'while ($_ = Elatin9::glob_)';
3284 }
3285  
3286 # while (glob(WILDCARD))
3287 elsif (/\G \b while (?>\s*) \( (?>\s*) glob \b /oxgc) {
3288 0 return 'while ($_ = Elatin9::glob';
3289 }
3290  
3291 # doit if, doit unless, doit while, doit until, doit for, doit when
3292 251 elsif (/\G \b ( if | unless | while | until | for | when ) \b /oxgc) { $slash = 'm//'; return $1; }
3293  
3294 # subroutines of package Elatin9
3295 19 elsif (/\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /oxgc) { $slash = 'm//'; return $1; }
3296 0 elsif (/\G \b Char::eval (?= (?>\s*) \{ ) /oxgc) { $slash = 'm//'; return 'eval'; }
3297 22 elsif (/\G \b Latin9::eval (?= (?>\s*) \{ ) /oxgc) { $slash = 'm//'; return 'eval'; }
3298 0 elsif (/\G \b Char::eval \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'eval Char::escape'; }
3299 168 elsif (/\G \b Latin9::eval \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'eval Latin9::escape'; }
3300 2 elsif (/\G \b bytes::substr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'substr'; }
3301 0 elsif (/\G \b chop \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin9::chop'; }
3302 2 elsif (/\G \b bytes::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'index'; }
3303 0 elsif (/\G \b Char::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Char::index'; }
3304 0 elsif (/\G \b Latin9::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Latin9::index'; }
3305 0 elsif (/\G \b index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin9::index'; }
3306 2 elsif (/\G \b bytes::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'rindex'; }
3307 0 elsif (/\G \b Char::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Char::rindex'; }
3308 0 elsif (/\G \b Latin9::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Latin9::rindex'; }
3309 0 elsif (/\G \b rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin9::rindex'; }
3310 1 elsif (/\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin9::lc'; }
3311 0 elsif (/\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin9::lcfirst'; }
3312 1 elsif (/\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin9::uc'; }
3313 0 elsif (/\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin9::ucfirst'; }
3314 6 elsif (/\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin9::fc'; }
3315  
3316 # "-s '' ..." means file test "-s 'filename' ..." (not means "- s/// ...")
3317 0 elsif (/\G -s (?>\s*) (\") ((?:$qq_char)+?) (\") /oxgc) { $slash = 'm//'; return '-s ' . e_qq('', $1,$3,$2); }
3318 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\#) ((?:$qq_char)+?) (\#) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3319 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3320 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3321 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3322 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3323 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\S) ((?:$qq_char)+?) (\1) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3324  
3325 0 elsif (/\G -s (?>\s*) (\') ((?:\\\'|\\\\|$q_char)+?) (\') /oxgc) { $slash = 'm//'; return '-s ' . e_q ('', $1,$3,$2); }
3326 0 elsif (/\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$q_char)+?) (\#) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3327 0 elsif (/\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3328 0 elsif (/\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3329 0 elsif (/\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3330 0 elsif (/\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3331 0 elsif (/\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$q_char)+?) (\1) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3332  
3333 elsif (/\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)* ) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ) )*) /oxgc)
3334 0 { $slash = 'm//'; return "-s $1"; }
3335 0 elsif (/\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /oxgc) { $slash = 'm//'; return "-s ($1)"; }
3336 0 elsif (/\G -s (?= (?>\s+) [a-z]+) /oxgc) { $slash = 'm//'; return '-s'; }
3337 0 elsif (/\G -s (?>\s+) ((?>\w+)) /oxgc) { $slash = 'm//'; return "-s $1"; }
3338  
3339 2 elsif (/\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'length'; }
3340 2 elsif (/\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'chr'; }
3341 36 elsif (/\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin9::chr'; }
3342 2 elsif (/\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'div'; return 'ord'; }
3343 8 elsif (/\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'div'; return $function_ord; }
3344 0 elsif (/\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin9::glob'; }
3345 0 elsif (/\G \b lc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin9::lc_'; }
3346 0 elsif (/\G \b lcfirst \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin9::lcfirst_'; }
3347 0 elsif (/\G \b uc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin9::uc_'; }
3348 0 elsif (/\G \b ucfirst \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin9::ucfirst_'; }
3349 0 elsif (/\G \b fc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin9::fc_'; }
3350 0 elsif (/\G -s \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return '-s '; }
3351  
3352 0 elsif (/\G \b bytes::length \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'length'; }
3353 0 elsif (/\G \b bytes::chr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'chr'; }
3354 0 elsif (/\G \b chr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin9::chr_'; }
3355 0 elsif (/\G \b bytes::ord \b (?! (?>\s*) => ) /oxgc) { $slash = 'div'; return 'ord'; }
3356 0 elsif (/\G \b ord \b (?! (?>\s*) => ) /oxgc) { $slash = 'div'; return $function_ord_; }
3357 0 elsif (/\G \b glob \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin9::glob_'; }
3358 0 elsif (/\G \b reverse \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return $function_reverse; }
3359 8 elsif (/\G \b getc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return $function_getc; }
3360 # split
3361 elsif (/\G \b (split) \b (?! (?>\s*) => ) /oxgc) {
3362 87 $slash = 'm//';
3363  
3364 87 my $e = '';
3365 87 ▶ while (/\G ( (?>\s+) | \( | \#.* ) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\G ( (?>\s+) | \( | \#.* ) /cgox) 85 87 172
3366 85 $e .= $1;
3367 }
3368  
3369 # end of split
3370 87 ▶ if (/\G (?= [,;\)\}\]] ) /oxgc) { return 'Elatin9::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
3371  
3372 # split scalar value
3373 1 elsif (/\G ( [\$\@\&\*] $qq_scalar ) /oxgc) { return 'Elatin9::split' . $e . e_string($1); }
3374  
3375 # split literal space
3376 0 elsif (/\G \b qq (\#) [ ] (\#) /oxgc) { return 'Elatin9::split' . $e . qq {qq$1 $2}; }
3377 0 elsif (/\G \b qq ((?>\s*)) (\() [ ] (\)) /oxgc) { return 'Elatin9::split' . $e . qq{$1qq$2 $3}; }
3378 0 elsif (/\G \b qq ((?>\s*)) (\{) [ ] (\}) /oxgc) { return 'Elatin9::split' . $e . qq{$1qq$2 $3}; }
3379 0 elsif (/\G \b qq ((?>\s*)) (\[) [ ] (\]) /oxgc) { return 'Elatin9::split' . $e . qq{$1qq$2 $3}; }
3380 0 elsif (/\G \b qq ((?>\s*)) (\<) [ ] (\>) /oxgc) { return 'Elatin9::split' . $e . qq{$1qq$2 $3}; }
3381 0 elsif (/\G \b qq ((?>\s*)) (\S) [ ] (\2) /oxgc) { return 'Elatin9::split' . $e . qq{$1qq$2 $3}; }
3382 0 elsif (/\G \b q (\#) [ ] (\#) /oxgc) { return 'Elatin9::split' . $e . qq {q$1 $2}; }
3383 0 elsif (/\G \b q ((?>\s*)) (\() [ ] (\)) /oxgc) { return 'Elatin9::split' . $e . qq {$1q$2 $3}; }
3384 0 elsif (/\G \b q ((?>\s*)) (\{) [ ] (\}) /oxgc) { return 'Elatin9::split' . $e . qq {$1q$2 $3}; }
3385 0 elsif (/\G \b q ((?>\s*)) (\[) [ ] (\]) /oxgc) { return 'Elatin9::split' . $e . qq {$1q$2 $3}; }
3386 0 elsif (/\G \b q ((?>\s*)) (\<) [ ] (\>) /oxgc) { return 'Elatin9::split' . $e . qq {$1q$2 $3}; }
3387 0 elsif (/\G \b q ((?>\s*)) (\S) [ ] (\2) /oxgc) { return 'Elatin9::split' . $e . qq {$1q$2 $3}; }
3388 10 elsif (/\G ' [ ] ' /oxgc) { return 'Elatin9::split' . $e . qq {' '}; }
3389 0 elsif (/\G " [ ] " /oxgc) { return 'Elatin9::split' . $e . qq {" "}; }
3390  
3391 # split qq//
3392 elsif (/\G \b (qq) \b /oxgc) {
3393 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin9::qq_char)*?) (\#) /cgox) { } 0 0 0
3394 else {
3395 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3396 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 ([*\-:?\\^|]) ((?:$Elatin9::qq_char)*?) (\1) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin9::qq_char)*?) (\1) /cgox) { } 0 0 0
3397 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq ( ) --> qr ( )
3398 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq { } --> qr { }
3399 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq [ ] --> qr [ ]
3400 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq < > --> qr < >
3401 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) /oxgc) { return e_split($e.'qr','{','}',$2,''); } # qq | | --> qr { }
3402 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq * * --> qr * *
3403 }
3404 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3405 }
3406 }
3407  
3408 # split qr//
3409 elsif (/\G \b (qr) \b /oxgc) {
3410 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1,$3,$2,$4); } # qr# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin9::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 12 12
3411 else {
3412 12 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 12 0 12
3413 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 (\') ((?:$Elatin9::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 12 12
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin9::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 12 12
elsif (/\G (\S) ((?:$Elatin9::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 12 0 12
3414 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr ( )
3415 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr { }
3416 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr [ ]
3417 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr < >
3418 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { return e_split_q($e.'qr',$1, $3, $2,$4); } # qr ' '
3419 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr','{','}',$2,$4); } # qr | | --> qr { }
3420 12 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr * *
3421 }
3422 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3423 }
3424 }
3425  
3426 # split q//
3427 elsif (/\G \b (q) \b /oxgc) {
3428 0 ▶ if (/\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:\\\#|\\\\|$Elatin9::q_char)*?) (\#) /cgox) { } 0 0 0
3429 else {
3430 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3431 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 7 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif (/\G (\() ((?:\\\\|\\\)|\\\(|$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 ([*\-:?\\^|]) ((?:$Elatin9::q_char)*?) (\1) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:\\\\|\\\1| $Elatin9::q_char)*?) (\1) /cgox) { } 0 0 0
3432 0 elsif (/\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q ( ) --> qr ( )
3433 0 elsif (/\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q { } --> qr { }
3434 0 elsif (/\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q [ ] --> qr [ ]
3435 0 elsif (/\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q < > --> qr < >
3436 0 elsif (/\G ([*\-:?\\^|]) ((?:$q_char)*?) (\1) /oxgc) { return e_split_q($e.'qr','{','}',$2,''); } # q | | --> qr { }
3437 0 elsif (/\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q * * --> qr * *
3438 }
3439 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3440 }
3441 }
3442  
3443 # split m//
3444 elsif (/\G \b (m) \b /oxgc) {
3445 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1,$3,$2,$4); } # m# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin9::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
3446 else {
3447 18 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 18 0 18
3448 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 (\') ((?:$Elatin9::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin9::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
elsif (/\G (\S) ((?:$Elatin9::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 18 0 18
3449 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m ( ) --> qr ( )
3450 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m { } --> qr { }
3451 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m [ ] --> qr [ ]
3452 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m < > --> qr < >
3453 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { return e_split_q($e.'qr',$1, $3, $2,$4); } # m ' ' --> qr ' '
3454 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr','{','}',$2,$4); } # m | | --> qr { }
3455 18 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m * * --> qr * *
3456 }
3457 0 die __FILE__, ": Search pattern not terminated\n";
3458 }
3459 }
3460  
3461 # split ''
3462 elsif (/\G (\') /oxgc) {
3463 0 my $q_string = '';
3464 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3465 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 ($Elatin9::q_char) /cgox) { } 0 0 0
3466 0 elsif (/\G (\\\') /oxgc) { $q_string .= $1; } # splitqr'' --> split qr''
3467 0 elsif (/\G \' /oxgc) { return e_split_q($e.q{ qr},"'","'",$q_string,''); } # ' ' --> qr ' '
3468 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3469 }
3470 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3471 }
3472  
3473 # split ""
3474 elsif (/\G (\") /oxgc) {
3475 0 my $qq_string = '';
3476 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3477 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 ($Elatin9::q_char) /cgox) { } 0 0 0
3478 0 elsif (/\G (\\\") /oxgc) { $qq_string .= $1; } # splitqr"" --> split qr""
3479 0 elsif (/\G \" /oxgc) { return e_split($e.q{ qr},'"','"',$qq_string,''); } # " " --> qr " "
3480 0 elsif (/\G ($q_char) /oxgc) { $qq_string .= $1; }
3481 }
3482 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3483 }
3484  
3485 # split //
3486 elsif (/\G (\/) /oxgc) {
3487 44 my $regexp = '';
3488 44 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 381 0 381
3489 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 ($Elatin9::q_char) /cgox) { } 337 0 337
3490 0 elsif (/\G (\\\/) /oxgc) { $regexp .= $1; } # splitqr// --> split qr//
3491 44 elsif (/\G \/ ([cgimosxpadlunbB]*) /oxgc) { return e_split($e.q{ qr}, '/','/',$regexp,$1); } # / / --> qr / /
3492 337 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
3493 }
3494 0 die __FILE__, ": Search pattern not terminated\n";
3495 }
3496 }
3497  
3498 # tr/// or y///
3499  
3500 # about [cdsrbB]* (/B modifier)
3501 #
3502 # P.559 appendix C
3503 # of ISBN 4-89052-384-7 Programming perl
3504 # (Japanese title is: Perl puroguramingu)
3505  
3506 elsif (/\G \b ( tr | y ) \b /oxgc) {
3507 4 my $ope = $1;
3508  
3509 # $1 $2 $3 $4 $5 $6
3510 4 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ((?:$qq_char)*?) (\#) ([cdsrbB]*) /oxgc) { # tr# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin9::qq_char)*?) (\#) ((?:$Elatin9::qq_char)*?) (\#) ([cdsrbB]*) /cgox) { } 0 4 4
3511 0 my @tr = ($tr_variable,$2);
3512 0 return e_tr(@tr,'',$4,$6);
3513 }
3514 else {
3515 4 my $e = '';
3516 4 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 4 0 4
3517 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) ((?:$Elatin9::qq_char)*?) (\1) ((?:$Elatin9::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 4 0 4
3518 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) {
3519 0 my @tr = ($tr_variable,$2);
3520 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3521 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) ((?:$Elatin9::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3522 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) ( )
3523 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) { }
3524 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) [ ]
3525 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) < >
3526 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) * *
3527 }
3528 0 die __FILE__, ": Transliteration replacement not terminated\n";
3529 }
3530 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) {
3531 0 my @tr = ($tr_variable,$2);
3532 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3533 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) ((?:$Elatin9::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3534 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } ( )
3535 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } { }
3536 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } [ ]
3537 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } < >
3538 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } * *
3539 }
3540 0 die __FILE__, ": Transliteration replacement not terminated\n";
3541 }
3542 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) {
3543 0 my @tr = ($tr_variable,$2);
3544 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3545 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) ((?:$Elatin9::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3546 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] ( )
3547 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] { }
3548 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] [ ]
3549 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] < >
3550 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] * *
3551 }
3552 0 die __FILE__, ": Transliteration replacement not terminated\n";
3553 }
3554 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) {
3555 0 my @tr = ($tr_variable,$2);
3556 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3557 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) ((?:$Elatin9::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3558 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > ( )
3559 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > { }
3560 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > [ ]
3561 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > < >
3562 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > * *
3563 }
3564 0 die __FILE__, ": Transliteration replacement not terminated\n";
3565 }
3566 # $1 $2 $3 $4 $5 $6
3567 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { # tr * * *
3568 4 my @tr = ($tr_variable,$2);
3569 4 return e_tr(@tr,'',$4,$6);
3570 }
3571 }
3572 0 die __FILE__, ": Transliteration pattern not terminated\n";
3573 }
3574 }
3575  
3576 # qq//
3577 elsif (/\G \b (qq) \b /oxgc) {
3578 2252 my $ope = $1;
3579  
3580 # if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { return e_qq($ope,$1,$3,$2); } # qq# #
3581 2252 ▶ if (/\G (\#) /oxgc) { # qq# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) /cgox) { } 0 2252 2252
3582 0 my $qq_string = '';
3583 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3584 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 ($Elatin9::qq_char) /cgox) { } 0 0 0
3585 0 elsif (/\G (\\\#) /oxgc) { $qq_string .= $1; }
3586 0 elsif (/\G (\#) /oxgc) { return e_qq($ope,'#','#',$qq_string); }
3587 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3588 }
3589 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3590 }
3591  
3592 else {
3593 2252 my $e = '';
3594 2252 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 2252 0 2252
3595 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
3596  
3597 # elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq ( )
3598 elsif (/\G (\() /oxgc) { # qq ( )
3599 0 my $qq_string = '';
3600 0 local $nest = 1;
3601 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3602 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 ($Elatin9::qq_char) /cgox) { } 0 0 0
3603 0 elsif (/\G (\\\)) /oxgc) { $qq_string .= $1; }
3604 0 elsif (/\G (\() /oxgc) { $qq_string .= $1; $nest++; }
3605 elsif (/\G (\)) /oxgc) {
3606 0 ▶ if (--$nest == 0) { return $e . e_qq($ope,'(',')',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin9::nest == 0) { } 0 0 0
3607 0 else { $qq_string .= $1; }
3608 }
3609 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3610 }
3611 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3612 }
3613  
3614 # elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq { }
3615 elsif (/\G (\{) /oxgc) { # qq { }
3616 2222 my $qq_string = '';
3617 2222 local $nest = 1;
3618 2222 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 85104 0 85104
3619 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 ($Elatin9::qq_char) /cgox) { } 79782 0 79782
3620 0 elsif (/\G (\\\}) /oxgc) { $qq_string .= $1; }
3621 1189 elsif (/\G (\{) /oxgc) { $qq_string .= $1; $nest++; }
3622 elsif (/\G (\}) /oxgc) {
3623 3411 ▶ if (--$nest == 0) { return $e . e_qq($ope,'{','}',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin9::nest == 0) { } 2222 1189 3411
3624 1189 else { $qq_string .= $1; }
3625 }
3626 79782 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3627 }
3628 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3629 }
3630  
3631 # elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq [ ]
3632 elsif (/\G (\[) /oxgc) { # qq [ ]
3633 0 my $qq_string = '';
3634 0 local $nest = 1;
3635 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3636 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 ($Elatin9::qq_char) /cgox) { } 0 0 0
3637 0 elsif (/\G (\\\]) /oxgc) { $qq_string .= $1; }
3638 0 elsif (/\G (\[) /oxgc) { $qq_string .= $1; $nest++; }
3639 elsif (/\G (\]) /oxgc) {
3640 0 ▶ if (--$nest == 0) { return $e . e_qq($ope,'[',']',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin9::nest == 0) { } 0 0 0
3641 0 else { $qq_string .= $1; }
3642 }
3643 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3644 }
3645 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3646 }
3647  
3648 # elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq < >
3649 elsif (/\G (\<) /oxgc) { # qq < >
3650 30 my $qq_string = '';
3651 30 local $nest = 1;
3652 30 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 1166 0 1166
3653 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 ($Elatin9::qq_char) /cgox) { } 1114 0 1114
3654 0 elsif (/\G (\\\>) /oxgc) { $qq_string .= $1; }
3655 0 elsif (/\G (\<) /oxgc) { $qq_string .= $1; $nest++; }
3656 elsif (/\G (\>) /oxgc) {
3657 30 ▶ if (--$nest == 0) { return $e . e_qq($ope,'<','>',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin9::nest == 0) { } 30 0 30
3658 0 else { $qq_string .= $1; }
3659 }
3660 1114 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3661 }
3662 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3663 }
3664  
3665 # elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq * *
3666 elsif (/\G (\S) /oxgc) { # qq * *
3667 0 my $delimiter = $1;
3668 0 my $qq_string = '';
3669 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3670 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 ($Elatin9::qq_char) /cgox) { } 0 0 0
3671 0 elsif (/\G (\\\Q$delimiter\E) /oxgc) { $qq_string .= $1; }
3672 0 elsif (/\G (\Q$delimiter\E) /oxgc) { return $e . e_qq($ope,$delimiter,$delimiter,$qq_string); }
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 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3679 }
3680 }
3681  
3682 # qr//
3683 elsif (/\G \b (qr) \b /oxgc) {
3684 0 my $ope = $1;
3685 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { # qr# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin9::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 0 0
3686 0 return e_qr($ope,$1,$3,$2,$4);
3687 }
3688 else {
3689 0 my $e = '';
3690 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3691 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 (\') ((?:$Elatin9::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin9::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin9::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
3692 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr ( )
3693 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr { }
3694 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr [ ]
3695 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr < >
3696 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { return $e . e_qr_q($ope,$1, $3, $2,$4); } # qr ' '
3697 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,'{','}',$2,$4); } # qr | | --> qr { }
3698 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr * *
3699 }
3700 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3701 }
3702 }
3703  
3704 # qw//
3705 elsif (/\G \b (qw) \b /oxgc) {
3706 16 my $ope = $1;
3707 16 ▶ if (/\G (\#) (.*?) (\#) /oxmsgc) { # qw# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) (.*?) (\#) /cgmosx) { } 0 16 16
3708 0 return e_qw($ope,$1,$3,$2);
3709 }
3710 else {
3711 16 my $e = '';
3712 16 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 16 0 16
3713 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) ((?:$Elatin9::q_char)*?) (\1) /cgmosx) { } 0 0 0
3714  
3715 16 elsif (/\G (\() ([^(]*?) (\)) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw ( )
3716 0 elsif (/\G (\() ((?:$q_paren)*?) (\)) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw ( )
3717  
3718 0 elsif (/\G (\{) ([^{]*?) (\}) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw { }
3719 0 elsif (/\G (\{) ((?:$q_brace)*?) (\}) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw { }
3720  
3721 0 elsif (/\G (\[) ([^[]*?) (\]) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw [ ]
3722 0 elsif (/\G (\[) ((?:$q_bracket)*?) (\]) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw [ ]
3723  
3724 0 elsif (/\G (\<) ([^<]*?) (\>) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw < >
3725 0 elsif (/\G (\<) ((?:$q_angle)*?) (\>) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw < >
3726  
3727 0 elsif (/\G ([\x21-\x3F]) (.*?) (\1) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw * *
3728 0 elsif (/\G (\S) ((?:$q_char)*?) (\1) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw * *
3729 }
3730 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3731 }
3732 }
3733  
3734 # qx//
3735 elsif (/\G \b (qx) \b /oxgc) {
3736 0 my $ope = $1;
3737 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qx# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin9::qq_char)*?) (\#) /cgox) { } 0 0 0
3738 0 return e_qq($ope,$1,$3,$2);
3739 }
3740 else {
3741 0 my $e = '';
3742 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3743 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 (\') ((?:$Elatin9::qq_char)*?) (\') /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin9::qq_char)*?) (\1) /cgox) { } 0 0 0
3744 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx ( )
3745 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx { }
3746 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx [ ]
3747 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx < >
3748 0 elsif (/\G (\') ((?:$qq_char)*?) (\') /oxgc) { return $e . e_q ($ope,$1,$3,$2); } # qx ' '
3749 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx * *
3750 }
3751 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3752 }
3753 }
3754  
3755 # q//
3756 elsif (/\G \b (q) \b /oxgc) {
3757 473 my $ope = $1;
3758  
3759 # if (/\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { return e_q($ope,$1,$3,$2); } # q# #
3760  
3761 # avoid "Error: Runtime exception" of perl version 5.005_03
3762 # (and so on)
3763  
3764 473 ▶ if (/\G (\#) /oxgc) { # q# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) /cgox) { } 0 473 473
3765 0 my $q_string = '';
3766 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3767 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 ($Elatin9::q_char) /cgox) { } 0 0 0
3768 0 elsif (/\G (\\\#) /oxgc) { $q_string .= $1; }
3769 0 elsif (/\G (\#) /oxgc) { return e_q($ope,'#','#',$q_string); }
3770 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3771 }
3772 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3773 }
3774  
3775 else {
3776 473 my $e = '';
3777 473 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 473 0 473
3778 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
3779  
3780 # elsif (/\G (\() ((?:\\\)|\\\\|$q_paren)*?) (\)) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q ( )
3781 elsif (/\G (\() /oxgc) { # q ( )
3782 0 my $q_string = '';
3783 0 local $nest = 1;
3784 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3785 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 ($Elatin9::q_char) /cgox) { } 0 0 0
3786 0 elsif (/\G (\\\)) /oxgc) { $q_string .= $1; }
3787 0 elsif (/\G (\\\() /oxgc) { $q_string .= $1; }
3788 0 elsif (/\G (\() /oxgc) { $q_string .= $1; $nest++; }
3789 elsif (/\G (\)) /oxgc) {
3790 0 ▶ if (--$nest == 0) { return $e . e_q($ope,'(',')',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin9::nest == 0) { } 0 0 0
3791 0 else { $q_string .= $1; }
3792 }
3793 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3794 }
3795 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3796 }
3797  
3798 # elsif (/\G (\{) ((?:\\\}|\\\\|$q_brace)*?) (\}) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q { }
3799 elsif (/\G (\{) /oxgc) { # q { }
3800 467 my $q_string = '';
3801 467 local $nest = 1;
3802 467 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 8249 0 8249
3803 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 ($Elatin9::q_char) /cgox) { } 7464 0 7464
3804 0 elsif (/\G (\\\}) /oxgc) { $q_string .= $1; }
3805 0 elsif (/\G (\\\{) /oxgc) { $q_string .= $1; }
3806 159 elsif (/\G (\{) /oxgc) { $q_string .= $1; $nest++; }
3807 elsif (/\G (\}) /oxgc) {
3808 626 ▶ if (--$nest == 0) { return $e . e_q($ope,'{','}',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin9::nest == 0) { } 467 159 626
3809 159 else { $q_string .= $1; }
3810 }
3811 7464 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3812 }
3813 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3814 }
3815  
3816 # elsif (/\G (\[) ((?:\\\]|\\\\|$q_bracket)*?) (\]) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q [ ]
3817 elsif (/\G (\[) /oxgc) { # q [ ]
3818 0 my $q_string = '';
3819 0 local $nest = 1;
3820 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3821 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 ($Elatin9::q_char) /cgox) { } 0 0 0
3822 0 elsif (/\G (\\\]) /oxgc) { $q_string .= $1; }
3823 0 elsif (/\G (\\\[) /oxgc) { $q_string .= $1; }
3824 0 elsif (/\G (\[) /oxgc) { $q_string .= $1; $nest++; }
3825 elsif (/\G (\]) /oxgc) {
3826 0 ▶ if (--$nest == 0) { return $e . e_q($ope,'[',']',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin9::nest == 0) { } 0 0 0
3827 0 else { $q_string .= $1; }
3828 }
3829 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3830 }
3831 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3832 }
3833  
3834 # elsif (/\G (\<) ((?:\\\>|\\\\|$q_angle)*?) (\>) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q < >
3835 elsif (/\G (\<) /oxgc) { # q < >
3836 5 my $q_string = '';
3837 5 local $nest = 1;
3838 5 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 88 0 88
3839 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 ($Elatin9::q_char) /cgox) { } 83 0 83
3840 0 elsif (/\G (\\\>) /oxgc) { $q_string .= $1; }
3841 0 elsif (/\G (\\\<) /oxgc) { $q_string .= $1; }
3842 0 elsif (/\G (\<) /oxgc) { $q_string .= $1; $nest++; }
3843 elsif (/\G (\>) /oxgc) {
3844 5 ▶ if (--$nest == 0) { return $e . e_q($ope,'<','>',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin9::nest == 0) { } 5 0 5
3845 0 else { $q_string .= $1; }
3846 }
3847 83 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3848 }
3849 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3850 }
3851  
3852 # elsif (/\G (\S) ((?:\\\1|\\\\|$q_char)*?) (\1) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q * *
3853 elsif (/\G (\S) /oxgc) { # q * *
3854 1 my $delimiter = $1;
3855 1 my $q_string = '';
3856 1 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 14 0 14
3857 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 ($Elatin9::q_char) /cgox) { } 13 0 13
3858 0 elsif (/\G (\\\Q$delimiter\E) /oxgc) { $q_string .= $1; }
3859 1 elsif (/\G (\Q$delimiter\E) /oxgc) { return $e . e_q($ope,$delimiter,$delimiter,$q_string); }
3860 13 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3861 }
3862 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3863 }
3864 }
3865 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3866 }
3867 }
3868  
3869 # m//
3870 elsif (/\G \b (m) \b /oxgc) {
3871 209 my $ope = $1;
3872 209 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { # m# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin9::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
3873 0 return e_qr($ope,$1,$3,$2,$4);
3874 }
3875 else {
3876 209 my $e = '';
3877 209 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 209 0 209
3878 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 (\?) ((?:$Elatin9::qq_char)*?) (\?) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
elsif (/\G (\') ((?:$Elatin9::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 10 199 209
elsif (/\G ([*\-:\\^|]) ((?:$Elatin9::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 199 199
elsif (/\G (\S) ((?:$Elatin9::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 199 0 199
3879 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m ( )
3880 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m { }
3881 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m [ ]
3882 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m < >
3883 0 elsif (/\G (\?) ((?:$qq_char)*?) (\?) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m ? ?
3884 10 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr_q($ope,$1, $3, $2,$4); } # m ' '
3885 0 elsif (/\G ([*\-:\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,'{','}',$2,$4); } # m | | --> m { }
3886 199 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m * *
3887 }
3888 0 die __FILE__, ": Search pattern not terminated\n";
3889 }
3890 }
3891  
3892 # s///
3893  
3894 # about [cegimosxpradlunbB]* (/cg modifier)
3895 #
3896 # P.67 Pattern-Matching Operators
3897 # of ISBN 0-596-00241-6 Perl in a Nutshell, Second Edition.
3898  
3899 elsif (/\G \b (s) \b /oxgc) {
3900 101 my $ope = $1;
3901  
3902 # $1 $2 $3 $4 $5 $6
3903 101 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ((?:$qq_char)*?) (\#) ([cegimosxpradlunbB]*) /oxgc) { # s# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin9::qq_char)*?) (\#) ((?:$Elatin9::qq_char)*?) (\#) ([cegimosxpradlunbB]*) /cgox) { } 1 100 101
3904 1 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3905 }
3906 else {
3907 100 my $e = '';
3908 100 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 100 0 100
3909 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 (\') ((?:$Elatin9::qq_char)*?) (\') ((?:$Elatin9::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 21 79 100
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin9::qq_char)*?) (\1) ((?:$Elatin9::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 79 79
elsif (/\G (\$) ((?:$Elatin9::qq_char)*?) (\1) ((?:$Elatin9::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 79 79
elsif (/\G (\S) ((?:$Elatin9::qq_char)*?) (\1) ((?:$Elatin9::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 79 0 79
3910 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) {
3911 0 my @s = ($1,$2,$3);
3912 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3913 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 (\') ((?:$Elatin9::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin9::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Elatin9::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Elatin9::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin9::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3914 # $1 $2 $3 $4
3915 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3916 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3917 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3918 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3919 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3920 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3921 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3922 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3923 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3924 }
3925 0 die __FILE__, ": Substitution replacement not terminated\n";
3926 }
3927 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) {
3928 0 my @s = ($1,$2,$3);
3929 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3930 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 (\') ((?:$Elatin9::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin9::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Elatin9::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Elatin9::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin9::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3931 # $1 $2 $3 $4
3932 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3933 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3934 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3935 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3936 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3937 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3938 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3939 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3940 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3941 }
3942 0 die __FILE__, ": Substitution replacement not terminated\n";
3943 }
3944 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) {
3945 0 my @s = ($1,$2,$3);
3946 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3947 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 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 (\') ((?:$Elatin9::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin9::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin9::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3948 # $1 $2 $3 $4
3949 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3950 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3951 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3952 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3953 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3954 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3955 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3956 }
3957 0 die __FILE__, ": Substitution replacement not terminated\n";
3958 }
3959 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) {
3960 0 my @s = ($1,$2,$3);
3961 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3962 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 (\') ((?:$Elatin9::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin9::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Elatin9::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Elatin9::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin9::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3963 # $1 $2 $3 $4
3964 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3965 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3966 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3967 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([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 (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3971 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3972 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3973 }
3974 0 die __FILE__, ": Substitution replacement not terminated\n";
3975 }
3976 # $1 $2 $3 $4 $5 $6
3977 elsif (/\G (\') ((?:$qq_char)*?) (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) {
3978 21 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3979 }
3980 # $1 $2 $3 $4 $5 $6
3981 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
3982 0 return e_sub($sub_variable,'{',$2,'}','{',$4,'}',$6); # s | | | --> s { } { }
3983 }
3984 # $1 $2 $3 $4 $5 $6
3985 elsif (/\G (\$) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
3986 0 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3987 }
3988 # $1 $2 $3 $4 $5 $6
3989 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
3990 79 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3991 }
3992 }
3993 0 die __FILE__, ": Substitution pattern not terminated\n";
3994 }
3995 }
3996  
3997 # require ignore module
3998 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# require$1$2"; }
3999 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# require$1\n$2"; }
4000 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# require$1"; }
4001  
4002 # use strict; --> use strict; no strict qw(refs);
4003 37 elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "use$1 no strict qw(refs);$2"; }
4004 0 elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [^#]) /oxmsgc) { return "use$1 no strict qw(refs);\n$2"; }
4005 0 elsif (/\G \b use ((?>\s+) strict) \b /oxmsgc) { return "use$1; no strict qw(refs)"; }
4006  
4007 # use 5.12.0; --> use 5.12.0; no strict qw(refs);
4008 elsif (/\G \b use (?>\s+) ((?>([1-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /oxmsgc) {
4009 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
4010 0 return "use $1; no strict qw(refs);";
4011 }
4012 else {
4013 2 return "use $1;";
4014 }
4015 }
4016 elsif (/\G \b use (?>\s+) ((?>v([0-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /oxmsgc) {
4017 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
4018 0 return "use $1; no strict qw(refs);";
4019 }
4020 else {
4021 0 return "use $1;";
4022 }
4023 }
4024  
4025 # ignore use module
4026 2 elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# use$1$2"; }
4027 0 elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# use$1\n$2"; }
4028 0 elsif (/\G \b use ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# use$1"; }
4029  
4030 # ignore no module
4031 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# no$1$2"; }
4032 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# no$1\n$2"; }
4033 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# no$1"; }
4034  
4035 # use else
4036 0 elsif (/\G \b use \b /oxmsgc) { return "use"; }
4037  
4038 # use else
4039 2 elsif (/\G \b no \b /oxmsgc) { return "no"; }
4040  
4041 # ''
4042 elsif (/\G (?<![\w\$\@\%\&\*]) (\') /oxgc) {
4043 1142 my $q_string = '';
4044 1142 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 10175 0 10175
4045 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 ($Elatin9::q_char) /cgox) { } 8981 0 8981
4046 48 elsif (/\G (\\\') /oxgc) { $q_string .= $1; }
4047 1142 elsif (/\G \' /oxgc) { return e_q('', "'","'",$q_string); }
4048 8981 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
4049 }
4050 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4051 }
4052  
4053 # ""
4054 elsif (/\G (\") /oxgc) {
4055 1881 my $qq_string = '';
4056 1881 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 37078 0 37078
4057 37078 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 67 37011 37078
elsif (/\G (\\\") /cgox) { } 12 36999 37011
elsif (/\G \" /cgox) { } 1881 35118 36999
elsif (/\G ($Elatin9::q_char) /cgox) { } 35118 0 35118
4058 12 elsif (/\G (\\\") /oxgc) { $qq_string .= $1; }
4059 1881 elsif (/\G \" /oxgc) { return e_qq('', '"','"',$qq_string); }
4060 35118 elsif (/\G ($q_char) /oxgc) { $qq_string .= $1; }
4061 }
4062 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4063 }
4064  
4065 # ``
4066 elsif (/\G (\`) /oxgc) {
4067 1 my $qx_string = '';
4068 1 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 19 0 19
4069 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 ($Elatin9::q_char) /cgox) { } 18 0 18
4070 0 elsif (/\G (\\\`) /oxgc) { $qx_string .= $1; }
4071 1 elsif (/\G \` /oxgc) { return e_qq('', '`','`',$qx_string); }
4072 18 elsif (/\G ($q_char) /oxgc) { $qx_string .= $1; }
4073 }
4074 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4075 }
4076  
4077 # // --- not divide operator (num / num), not defined-or
4078 ▶ elsif (($slash eq 'm//') and /\G (\/) /oxgc) {
Condition100%3/3
$Elatin9::slash eq "m//" and m[\G (/) ]cgox
!ll&&!rl&&r
273308836681
MC/DC100%2/2
$Elatin9::slash eq "m//" and m[\G (/) ]cgox
$Elatin9::slash eq "m//" m[\G (/) ]cgox
Truth table100%3/3
A and B
A= $Elatin9::slash eq "m//"B= m[\G (/) ]cgox
ABresult
0X0
100
111
4079 681 my $regexp = '';
4080 681 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 5636 0 5636
4081 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 ($Elatin9::q_char) /cgox) { } 4955 0 4955
4082 0 elsif (/\G (\\\/) /oxgc) { $regexp .= $1; }
4083 681 elsif (/\G \/ ([cgimosxpadlunbB]*) /oxgc) { return e_qr('', '/','/',$regexp,$1); }
4084 4955 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
4085 }
4086 0 die __FILE__, ": Search pattern not terminated\n";
4087 }
4088  
4089 # ?? --- not conditional operator (condition ? then : else)
4090 ▶ elsif (($slash eq 'm//') and /\G (\?) /oxgc) {
Condition66%2/3
$Elatin9::slash eq "m//" and /\G (\?) /cgox
!ll&&!rl&&r
2733088360
MC/DC0%0/2
$Elatin9::slash eq "m//" and /\G (\?) /cgox
$Elatin9::slash eq "m//" /\G (\?) /cgox
Truth table66%2/3
A and B
A= $Elatin9::slash eq "m//"B= /\G (\?) /cgox
ABresult
0X0
100
111
4091 0 my $regexp = '';
4092 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
4093 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 ($Elatin9::q_char) /cgox) { } 0 0 0
4094 0 elsif (/\G (\\\?) /oxgc) { $regexp .= $1; }
4095 0 elsif (/\G \? ([cgimosxpadlunbB]*) /oxgc) { return e_qr('m','?','?',$regexp,$1); }
4096 0 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
4097 }
4098 0 die __FILE__, ": Search pattern not terminated\n";
4099 }
4100  
4101 # <<>> (a safer ARGV)
4102 0 elsif (/\G ( <<>> ) /oxgc) { $slash = 'm//'; return $1; }
4103  
4104 # << (bit shift) --- not here document
4105 0 elsif (/\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /oxgc) { $slash = 'm//'; return $1; }
4106  
4107 # <<~'HEREDOC'
4108 elsif (/\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /oxgc) {
4109 6 $slash = 'm//';
4110 6 my $here_quote = $1;
4111 6 my $delimiter = $2;
4112  
4113 # get here document
4114 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4115 6 $here_script = CORE::substr $_, pos $_;
4116 6 $here_script =~ s/.*?\n//oxm;
4117 }
4118 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
4119 6 my $heredoc = $1;
4120 6 my $indent = $2;
4121 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4122 6 push @heredoc, $heredoc . qq{\n$delimiter\n};
4123 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4124 }
4125 else {
4126 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4127 }
4128 6 return qq{<<'$delimiter'};
4129 }
4130  
4131 # <<~\HEREDOC
4132  
4133 # P.66 2.6.6. "Here" Documents
4134 # in Chapter 2: Bits and Pieces
4135 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4136  
4137 # P.73 "Here" Documents
4138 # in Chapter 2: Bits and Pieces
4139 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4140  
4141 elsif (/\G ( <<~ \\([a-zA-Z_0-9]+) ) /oxgc) {
4142 3 $slash = 'm//';
4143 3 my $here_quote = $1;
4144 3 my $delimiter = $2;
4145  
4146 # get here document
4147 3 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 3 0 3
4148 3 $here_script = CORE::substr $_, pos $_;
4149 3 $here_script =~ s/.*?\n//oxm;
4150 }
4151 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
4152 3 my $heredoc = $1;
4153 3 my $indent = $2;
4154 3 $heredoc =~ s{^$indent}{}msg; # no /ox
4155 3 push @heredoc, $heredoc . qq{\n$delimiter\n};
4156 3 push @heredoc_delimiter, qq{\\s*$delimiter};
4157 }
4158 else {
4159 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4160 }
4161 3 return qq{<<\\$delimiter};
4162 }
4163  
4164 # <<~"HEREDOC"
4165 elsif (/\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /oxgc) {
4166 6 $slash = 'm//';
4167 6 my $here_quote = $1;
4168 6 my $delimiter = $2;
4169  
4170 # get here document
4171 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4172 6 $here_script = CORE::substr $_, pos $_;
4173 6 $here_script =~ s/.*?\n//oxm;
4174 }
4175 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
4176 6 my $heredoc = $1;
4177 6 my $indent = $2;
4178 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4179 6 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4180 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4181 }
4182 else {
4183 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4184 }
4185 6 return qq{<<"$delimiter"};
4186 }
4187  
4188 # <<~HEREDOC
4189 elsif (/\G ( <<~ ([a-zA-Z_0-9]+) ) /oxgc) {
4190 3 $slash = 'm//';
4191 3 my $here_quote = $1;
4192 3 my $delimiter = $2;
4193  
4194 # get here document
4195 3 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 3 0 3
4196 3 $here_script = CORE::substr $_, pos $_;
4197 3 $here_script =~ s/.*?\n//oxm;
4198 }
4199 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
4200 3 my $heredoc = $1;
4201 3 my $indent = $2;
4202 3 $heredoc =~ s{^$indent}{}msg; # no /ox
4203 3 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4204 3 push @heredoc_delimiter, qq{\\s*$delimiter};
4205 }
4206 else {
4207 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4208 }
4209 3 return qq{<<$delimiter};
4210 }
4211  
4212 # <<~`HEREDOC`
4213 elsif (/\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /oxgc) {
4214 6 $slash = 'm//';
4215 6 my $here_quote = $1;
4216 6 my $delimiter = $2;
4217  
4218 # get here document
4219 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4220 6 $here_script = CORE::substr $_, pos $_;
4221 6 $here_script =~ s/.*?\n//oxm;
4222 }
4223 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
4224 6 my $heredoc = $1;
4225 6 my $indent = $2;
4226 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4227 6 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4228 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4229 }
4230 else {
4231 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4232 }
4233 6 return qq{<<`$delimiter`};
4234 }
4235  
4236 # <<'HEREDOC'
4237 elsif (/\G ( << '([a-zA-Z_0-9]*)' ) /oxgc) {
4238 72 $slash = 'm//';
4239 72 my $here_quote = $1;
4240 72 my $delimiter = $2;
4241  
4242 # get here document
4243 72 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 72 0 72
4244 72 $here_script = CORE::substr $_, pos $_;
4245 72 $here_script =~ s/.*?\n//oxm;
4246 }
4247 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
4248 72 push @heredoc, $1 . qq{\n$delimiter\n};
4249 72 push @heredoc_delimiter, $delimiter;
4250 }
4251 else {
4252 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4253 }
4254 72 return $here_quote;
4255 }
4256  
4257 # <<\HEREDOC
4258  
4259 # P.66 2.6.6. "Here" Documents
4260 # in Chapter 2: Bits and Pieces
4261 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4262  
4263 # P.73 "Here" Documents
4264 # in Chapter 2: Bits and Pieces
4265 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4266  
4267 elsif (/\G ( << \\([a-zA-Z_0-9]+) ) /oxgc) {
4268 0 $slash = 'm//';
4269 0 my $here_quote = $1;
4270 0 my $delimiter = $2;
4271  
4272 # get here document
4273 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4274 0 $here_script = CORE::substr $_, pos $_;
4275 0 $here_script =~ s/.*?\n//oxm;
4276 }
4277 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
4278 0 push @heredoc, $1 . qq{\n$delimiter\n};
4279 0 push @heredoc_delimiter, $delimiter;
4280 }
4281 else {
4282 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4283 }
4284 0 return $here_quote;
4285 }
4286  
4287 # <<"HEREDOC"
4288 elsif (/\G ( << "([a-zA-Z_0-9]*)" ) /oxgc) {
4289 36 $slash = 'm//';
4290 36 my $here_quote = $1;
4291 36 my $delimiter = $2;
4292  
4293 # get here document
4294 36 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 36 0 36
4295 36 $here_script = CORE::substr $_, pos $_;
4296 36 $here_script =~ s/.*?\n//oxm;
4297 }
4298 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
4299 36 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4300 36 push @heredoc_delimiter, $delimiter;
4301 }
4302 else {
4303 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4304 }
4305 36 return $here_quote;
4306 }
4307  
4308 # <<HEREDOC
4309 elsif (/\G ( << ([a-zA-Z_0-9]+) ) /oxgc) {
4310 42 $slash = 'm//';
4311 42 my $here_quote = $1;
4312 42 my $delimiter = $2;
4313  
4314 # get here document
4315 42 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 42 0 42
4316 42 $here_script = CORE::substr $_, pos $_;
4317 42 $here_script =~ s/.*?\n//oxm;
4318 }
4319 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
4320 42 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4321 42 push @heredoc_delimiter, $delimiter;
4322 }
4323 else {
4324 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4325 }
4326 42 return $here_quote;
4327 }
4328  
4329 # <<`HEREDOC`
4330 elsif (/\G ( << `([a-zA-Z_0-9]*)` ) /oxgc) {
4331 0 $slash = 'm//';
4332 0 my $here_quote = $1;
4333 0 my $delimiter = $2;
4334  
4335 # get here document
4336 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4337 0 $here_script = CORE::substr $_, pos $_;
4338 0 $here_script =~ s/.*?\n//oxm;
4339 }
4340 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
4341 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4342 0 push @heredoc_delimiter, $delimiter;
4343 }
4344 else {
4345 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4346 }
4347 0 return $here_quote;
4348 }
4349  
4350 # <<= <=> <= < operator
4351 elsif (/\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/oxgc) {
4352 12 return $1;
4353 }
4354  
4355 # <FILEHANDLE>
4356 elsif (/\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /oxgc) {
4357 0 return $1;
4358 }
4359  
4360 # <WILDCARD> --- glob
4361  
4362 # avoid "Error: Runtime exception" of perl version 5.005_03
4363  
4364 elsif (/\G < ((?:[^>\0\a\e\f\n\r\t])+?) > /oxgc) {
4365 0 return 'Elatin9::glob("' . $1 . '")';
4366 }
4367  
4368 # __DATA__
4369 0 elsif (/\G ^ ( __DATA__ \n .*) \z /oxmsgc) { return $1; }
4370  
4371 # __END__
4372 210 elsif (/\G ^ ( __END__ \n .*) \z /oxmsgc) { return $1; }
4373  
4374 # \cD Control-D
4375  
4376 # P.68 2.6.8. Other Literal Tokens
4377 # in Chapter 2: Bits and Pieces
4378 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4379  
4380 # P.76 Other Literal Tokens
4381 # in Chapter 2: Bits and Pieces
4382 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4383  
4384 0 elsif (/\G ( \cD .*) \z /oxmsgc) { return $1; }
4385  
4386 # \cZ Control-Z
4387 0 elsif (/\G ( \cZ .*) \z /oxmsgc) { return $1; }
4388  
4389 # any operator before div
4390 elsif (/\G (
4391 -- | \+\+ |
4392 [\)\}\]]
4393  
4394 5837 ) /oxgc) { $slash = 'div'; return $1; }
4395  
4396 # yada-yada or triple-dot operator
4397 elsif (/\G (
4398 \.\.\.
4399  
4400 7 ) /oxgc) { $slash = 'm//'; return q{die('Unimplemented')}; }
4401  
4402 # any operator before m//
4403  
4404 # //, //= (defined-or)
4405  
4406 # P.164 Logical Operators
4407 # in Chapter 10: More Control Structures
4408 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
4409  
4410 # P.119 C-Style Logical (Short-Circuit) Operators
4411 # in Chapter 3: Unary and Binary Operators
4412 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4413  
4414 # (and so on)
4415  
4416 # ~~
4417  
4418 # P.221 The Smart Match Operator
4419 # in Chapter 15: Smart Matching and given-when
4420 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
4421  
4422 # P.112 Smartmatch Operator
4423 # in Chapter 3: Unary and Binary Operators
4424 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4425  
4426 # (and so on)
4427  
4428 elsif (/\G ((?>
4429  
4430 !~~ | !~ | != | ! |
4431 %= | % |
4432 &&= | && | &= | &\.= | &\. | & |
4433 -= | -> | - |
4434 :(?>\s*)= |
4435 : |
4436 <<>> |
4437 <<= | <=> | <= | < |
4438 == | => | =~ | = |
4439 >>= | >> | >= | > |
4440 \*\*= | \*\* | \*= | \* |
4441 \+= | \+ |
4442 \.\. | \.= | \. |
4443 \/\/= | \/\/ |
4444 \/= | \/ |
4445 \? |
4446 \\ |
4447 \^= | \^\.= | \^\. | \^ |
4448 \b x= |
4449 \|\|= | \|\| | \|= | \|\.= | \|\. | \| |
4450 ~~ | ~\. | ~ |
4451 \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b |
4452 \b(?: print )\b |
4453  
4454 [,;\(\{\[]
4455  
4456 9770 )) /oxgc) { $slash = 'm//'; return $1; }
4457  
4458 # other any character
4459 20156 elsif (/\G ($q_char) /oxgc) { $slash = 'div'; return $1; }
4460  
4461 # system error
4462 else {
4463 0 die __FILE__, ": Oops, this shouldn't happen!\n";
4464 }
4465 }
4466  
4467 # escape Latin-9 string
4468 1871 ▶sub e_string {
Subroutine e_string: called CC=228 SCAR=104.2
Pod documented
4469 1871 my($string) = @_;
4470 1871 my $e_string = '';
4471  
4472 1871 local $slash = 'm//';
4473  
4474 # P.1024 Appendix W.10 Multibyte Processing
4475 # of ISBN 1-56592-224-7 CJKV Information Processing
4476 # (and so on)
4477  
4478 1871 my @char = $string =~ / \G (?>[^\\]|\\$q_char|$q_char) /oxmsg;
4479  
4480 # without { ... }
4481 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
4482 1854 ▶ if ($string !~ /<</oxms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /<</mosx) 1854 0 1854
4483 1854 return $string;
4484 }
4485 }
4486  
4487 E_STRING_LOOP:
4488 17 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 190 17 207
4489 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 Latin9::eval (?= (?>\s*) \{ ) /cgox) { } 0 180 180
elsif ($string =~ /\G \b Char::eval \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b Latin9::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 Latin9::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 Latin9::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*) (\") ((?:$Elatin9::qq_char)+?) (\") /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\#) ((?:$Elatin9::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) ((?:$Elatin9::qq_char)+?) (\1) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s*) (\') ((?:\\\'|\\\\|$Elatin9::q_char)+?) (\') /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$Elatin9::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|\\\\|$Elatin9::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\$\@\%\&\*]) (\') ((?:\\\'|\\\\|$Elatin9::q_char)*?) (\') /cgox) { } 0 180 180
elsif ($string =~ /\G (\") ((?:$Elatin9::qq_char)*?) (\") /cgox) { } 0 180 180
elsif ($string =~ /\G (\`) ((?:$Elatin9::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 < ((?:$Elatin9::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 ($Elatin9::q_char) /cgox) { } 131 0 131
4490 }
4491  
4492 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> @{[Elatin9::PREMATCH()]}
4493 elsif ($string =~ /\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /oxmsgc) {
4494 0 $e_string .= q{Elatin9::PREMATCH()};
4495 0 $slash = 'div';
4496 }
4497  
4498 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> @{[Elatin9::MATCH()]}
4499 elsif ($string =~ /\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /oxmsgc) {
4500 0 $e_string .= q{Elatin9::MATCH()};
4501 0 $slash = 'div';
4502 }
4503  
4504 # $', ${'} --> $', ${'}
4505 elsif ($string =~ /\G ( \$' | \$\{'\} ) /oxmsgc) {
4506 0 $e_string .= $1;
4507 0 $slash = 'div';
4508 }
4509  
4510 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> @{[Elatin9::POSTMATCH()]}
4511 elsif ($string =~ /\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /oxmsgc) {
4512 0 $e_string .= q{Elatin9::POSTMATCH()};
4513 0 $slash = 'div';
4514 }
4515  
4516 # bareword
4517 elsif ($string =~ /\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /oxmsgc) {
4518 0 $e_string .= $1;
4519 0 $slash = 'div';
4520 }
4521  
4522 # $0 --> $0
4523 elsif ($string =~ /\G ( \$ 0 ) /oxmsgc) {
4524 0 $e_string .= $1;
4525 0 $slash = 'div';
4526 }
4527 elsif ($string =~ /\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /oxmsgc) {
4528 0 $e_string .= $1;
4529 0 $slash = 'div';
4530 }
4531  
4532 # $$ --> $$
4533 elsif ($string =~ /\G ( \$ \$ ) (?![\w\{]) /oxmsgc) {
4534 0 $e_string .= $1;
4535 0 $slash = 'div';
4536 }
4537  
4538 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
4539 # $1, $2, $3 --> $1, $2, $3 otherwise
4540 elsif ($string =~ /\G \$ ((?>[1-9][0-9]*)) /oxmsgc) {
4541 0 $e_string .= e_capture($1);
4542 0 $slash = 'div';
4543 }
4544 elsif ($string =~ /\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /oxmsgc) {
4545 0 $e_string .= e_capture($1);
4546 0 $slash = 'div';
4547 }
4548  
4549 # $$foo[ ... ] --> $ $foo->[ ... ]
4550 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /oxmsgc) {
4551 0 $e_string .= e_capture($1.'->'.$2);
4552 0 $slash = 'div';
4553 }
4554  
4555 # $$foo{ ... } --> $ $foo->{ ... }
4556 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /oxmsgc) {
4557 0 $e_string .= e_capture($1.'->'.$2);
4558 0 $slash = 'div';
4559 }
4560  
4561 # $$foo
4562 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /oxmsgc) {
4563 0 $e_string .= e_capture($1);
4564 0 $slash = 'div';
4565 }
4566  
4567 # ${ foo }
4568 elsif ($string =~ /\G \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} /oxmsgc) {
4569 0 $e_string .= '${' . $1 . '}';
4570 0 $slash = 'div';
4571 }
4572  
4573 # ${ ... }
4574 elsif ($string =~ /\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /oxmsgc) {
4575 3 $e_string .= e_capture($1);
4576 3 $slash = 'div';
4577 }
4578  
4579 # variable or function
4580 # $ @ % & * $ #
4581 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) {
4582 7 $e_string .= $1;
4583 7 $slash = 'div';
4584 }
4585 # $ $ $ $ $ $ $ $ $ $ $ $ $ $
4586 # $ @ # \ ' " / ? ( ) [ ] < >
4587 elsif ($string =~ /\G ( \$[\$\@\#\\\'\"\/\?\(\)\[\]\<\>] ) /oxmsgc) {
4588 0 $e_string .= $1;
4589 0 $slash = 'div';
4590 }
4591  
4592 # subroutines of package Elatin9
4593 0 elsif ($string =~ /\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /oxgc) { $e_string .= $1; $slash = 'm//'; }
4594 0 elsif ($string =~ /\G \b Char::eval (?= (?>\s*) \{ ) /oxgc) { $e_string .= 'eval'; $slash = 'm//'; }
4595 0 elsif ($string =~ /\G \b Latin9::eval (?= (?>\s*) \{ ) /oxgc) { $e_string .= 'eval'; $slash = 'm//'; }
4596 0 elsif ($string =~ /\G \b Char::eval \b /oxgc) { $e_string .= 'eval Char::escape'; $slash = 'm//'; }
4597 0 elsif ($string =~ /\G \b Latin9::eval \b /oxgc) { $e_string .= 'eval Latin9::escape'; $slash = 'm//'; }
4598 0 elsif ($string =~ /\G \b bytes::substr \b /oxgc) { $e_string .= 'substr'; $slash = 'm//'; }
4599 0 elsif ($string =~ /\G \b chop \b /oxgc) { $e_string .= 'Elatin9::chop'; $slash = 'm//'; }
4600 0 elsif ($string =~ /\G \b bytes::index \b /oxgc) { $e_string .= 'index'; $slash = 'm//'; }
4601 0 elsif ($string =~ /\G \b Char::index \b /oxgc) { $e_string .= 'Char::index'; $slash = 'm//'; }
4602 0 elsif ($string =~ /\G \b Latin9::index \b /oxgc) { $e_string .= 'Latin9::index'; $slash = 'm//'; }
4603 0 elsif ($string =~ /\G \b index \b /oxgc) { $e_string .= 'Elatin9::index'; $slash = 'm//'; }
4604 0 elsif ($string =~ /\G \b bytes::rindex \b /oxgc) { $e_string .= 'rindex'; $slash = 'm//'; }
4605 0 elsif ($string =~ /\G \b Char::rindex \b /oxgc) { $e_string .= 'Char::rindex'; $slash = 'm//'; }
4606 0 elsif ($string =~ /\G \b Latin9::rindex \b /oxgc) { $e_string .= 'Latin9::rindex'; $slash = 'm//'; }
4607 0 elsif ($string =~ /\G \b rindex \b /oxgc) { $e_string .= 'Elatin9::rindex'; $slash = 'm//'; }
4608 0 elsif ($string =~ /\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin9::lc'; $slash = 'm//'; }
4609 0 elsif ($string =~ /\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin9::lcfirst'; $slash = 'm//'; }
4610 0 elsif ($string =~ /\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin9::uc'; $slash = 'm//'; }
4611 0 elsif ($string =~ /\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin9::ucfirst'; $slash = 'm//'; }
4612 0 elsif ($string =~ /\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin9::fc'; $slash = 'm//'; }
4613  
4614 # "-s '' ..." means file test "-s 'filename' ..." (not means "- s/// ...")
4615 0 elsif ($string =~ /\G -s (?>\s*) (\") ((?:$qq_char)+?) (\") /oxgc) { $e_string .= '-s ' . e_qq('', $1,$3,$2); $slash = 'm//'; }
4616 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\#) ((?:$qq_char)+?) (\#) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4617 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4618 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4619 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4620 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4621 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\S) ((?:$qq_char)+?) (\1) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4622  
4623 0 elsif ($string =~ /\G -s (?>\s*) (\') ((?:\\\'|\\\\|$q_char)+?) (\') /oxgc) { $e_string .= '-s ' . e_q ('', $1,$3,$2); $slash = 'm//'; }
4624 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$q_char)+?) (\#) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4625 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4626 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4627 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4628 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4629 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//'; }
4630  
4631 elsif ($string =~ /\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)*) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ))*) /oxgc)
4632 0 { $e_string .= "-s $1"; $slash = 'm//'; }
4633 0 elsif ($string =~ /\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /oxgc) { $e_string .= "-s ($1)"; $slash = 'm//'; }
4634 0 elsif ($string =~ /\G -s (?= (?>\s+) [a-z]+) /oxgc) { $e_string .= '-s'; $slash = 'm//'; }
4635 0 elsif ($string =~ /\G -s (?>\s+) ((?>\w+)) /oxgc) { $e_string .= "-s $1"; $slash = 'm//'; }
4636  
4637 0 elsif ($string =~ /\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'length'; $slash = 'm//'; }
4638 0 elsif ($string =~ /\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'chr'; $slash = 'm//'; }
4639 0 elsif ($string =~ /\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin9::chr'; $slash = 'm//'; }
4640 0 elsif ($string =~ /\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'ord'; $slash = 'div'; }
4641 0 elsif ($string =~ /\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= $function_ord; $slash = 'div'; }
4642 0 elsif ($string =~ /\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin9::glob'; $slash = 'm//'; }
4643 0 elsif ($string =~ /\G \b lc \b /oxgc) { $e_string .= 'Elatin9::lc_'; $slash = 'm//'; }
4644 0 elsif ($string =~ /\G \b lcfirst \b /oxgc) { $e_string .= 'Elatin9::lcfirst_'; $slash = 'm//'; }
4645 0 elsif ($string =~ /\G \b uc \b /oxgc) { $e_string .= 'Elatin9::uc_'; $slash = 'm//'; }
4646 0 elsif ($string =~ /\G \b ucfirst \b /oxgc) { $e_string .= 'Elatin9::ucfirst_'; $slash = 'm//'; }
4647 0 elsif ($string =~ /\G \b fc \b /oxgc) { $e_string .= 'Elatin9::fc_'; $slash = 'm//'; }
4648 0 elsif ($string =~ /\G -s \b /oxgc) { $e_string .= '-s '; $slash = 'm//'; }
4649  
4650 0 elsif ($string =~ /\G \b bytes::length \b /oxgc) { $e_string .= 'length'; $slash = 'm//'; }
4651 0 elsif ($string =~ /\G \b bytes::chr \b /oxgc) { $e_string .= 'chr'; $slash = 'm//'; }
4652 0 elsif ($string =~ /\G \b chr \b /oxgc) { $e_string .= 'Elatin9::chr_'; $slash = 'm//'; }
4653 0 elsif ($string =~ /\G \b bytes::ord \b /oxgc) { $e_string .= 'ord'; $slash = 'div'; }
4654 0 elsif ($string =~ /\G \b ord \b /oxgc) { $e_string .= $function_ord_; $slash = 'div'; }
4655 0 elsif ($string =~ /\G \b glob \b /oxgc) { $e_string .= 'Elatin9::glob_'; $slash = 'm//'; }
4656 0 elsif ($string =~ /\G \b reverse \b /oxgc) { $e_string .= $function_reverse; $slash = 'm//'; }
4657 0 elsif ($string =~ /\G \b getc \b /oxgc) { $e_string .= $function_getc; $slash = 'm//'; }
4658 # split
4659 elsif ($string =~ /\G \b (split) \b (?! (?>\s*) => ) /oxgc) {
4660 0 $slash = 'm//';
4661  
4662 0 my $e = '';
4663 0 ▶ while ($string =~ /\G ( (?>\s+) | \( | \#.* ) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G ( (?>\s+) | \( | \#.* ) /cgox) 0 0 0
4664 0 $e .= $1;
4665 }
4666  
4667 # end of split
4668 0 ▶ if ($string =~ /\G (?= [,;\)\}\]] ) /oxgc) { return 'Elatin9::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
4669  
4670 # split scalar value
4671 0 elsif ($string =~ /\G ( [\$\@\&\*] $qq_scalar ) /oxgc) { $e_string .= 'Elatin9::split' . $e . e_string($1); next E_STRING_LOOP; }
4672  
4673 # split literal space
4674 0 elsif ($string =~ /\G \b qq (\#) [ ] (\#) /oxgc) { $e_string .= 'Elatin9::split' . $e . qq {qq$1 $2}; next E_STRING_LOOP; }
4675 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\() [ ] (\)) /oxgc) { $e_string .= 'Elatin9::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4676 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\{) [ ] (\}) /oxgc) { $e_string .= 'Elatin9::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4677 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\[) [ ] (\]) /oxgc) { $e_string .= 'Elatin9::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4678 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\<) [ ] (\>) /oxgc) { $e_string .= 'Elatin9::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4679 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\S) [ ] (\2) /oxgc) { $e_string .= 'Elatin9::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4680 0 elsif ($string =~ /\G \b q (\#) [ ] (\#) /oxgc) { $e_string .= 'Elatin9::split' . $e . qq {q$1 $2}; next E_STRING_LOOP; }
4681 0 elsif ($string =~ /\G \b q ((?>\s*)) (\() [ ] (\)) /oxgc) { $e_string .= 'Elatin9::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4682 0 elsif ($string =~ /\G \b q ((?>\s*)) (\{) [ ] (\}) /oxgc) { $e_string .= 'Elatin9::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4683 0 elsif ($string =~ /\G \b q ((?>\s*)) (\[) [ ] (\]) /oxgc) { $e_string .= 'Elatin9::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4684 0 elsif ($string =~ /\G \b q ((?>\s*)) (\<) [ ] (\>) /oxgc) { $e_string .= 'Elatin9::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4685 0 elsif ($string =~ /\G \b q ((?>\s*)) (\S) [ ] (\2) /oxgc) { $e_string .= 'Elatin9::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4686 0 elsif ($string =~ /\G ' [ ] ' /oxgc) { $e_string .= 'Elatin9::split' . $e . qq {' '}; next E_STRING_LOOP; }
4687 0 elsif ($string =~ /\G " [ ] " /oxgc) { $e_string .= 'Elatin9::split' . $e . qq {" "}; next E_STRING_LOOP; }
4688  
4689 # split qq//
4690 elsif ($string =~ /\G \b (qq) \b /oxgc) {
4691 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 (\#) ((?:$Elatin9::qq_char)*?) (\#) /cgox) { } 0 0 0
4692 else {
4693 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4694 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 ([*\-:?\\^|]) ((?:$Elatin9::qq_char)*?) (\1) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Elatin9::qq_char)*?) (\1) /cgox) { } 0 0 0
4695 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq ( ) --> qr ( )
4696 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq { } --> qr { }
4697 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq [ ] --> qr [ ]
4698 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq < > --> qr < >
4699 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= e_split($e.'qr','{','}',$2,''); next E_STRING_LOOP; } # qq | | --> qr { }
4700 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq * * --> qr * *
4701 }
4702 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4703 }
4704 }
4705  
4706 # split qr//
4707 elsif ($string =~ /\G \b (qr) \b /oxgc) {
4708 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 (\#) ((?:$Elatin9::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 0 0
4709 else {
4710 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4711 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 (\') ((?:$Elatin9::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$Elatin9::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Elatin9::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
4712 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr ( )
4713 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr { }
4714 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr [ ]
4715 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr < >
4716 0 elsif ($string =~ /\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split_q($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr ' '
4717 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr','{','}',$2,$4); next E_STRING_LOOP; } # qr | | --> qr { }
4718 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 * *
4719 }
4720 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4721 }
4722 }
4723  
4724 # split q//
4725 elsif ($string =~ /\G \b (q) \b /oxgc) {
4726 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 (\#) ((?:\\\#|\\\\|$Elatin9::q_char)*?) (\#) /cgox) { } 0 0 0
4727 else {
4728 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4729 0 ▶ if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e_string .= $e . $1; }
Branch: 7 branches
BranchTrueFalseTotal
if ($string =~ /\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\() ((?:\\\\|\\\)|\\\(|$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 ([*\-:?\\^|]) ((?:$Elatin9::q_char)*?) (\1) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:\\\\|\\\1| $Elatin9::q_char)*?) (\1) /cgox) { } 0 0 0
4730 0 elsif ($string =~ /\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q ( ) --> qr ( )
4731 0 elsif ($string =~ /\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q { } --> qr { }
4732 0 elsif ($string =~ /\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q [ ] --> qr [ ]
4733 0 elsif ($string =~ /\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q < > --> qr < >
4734 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$q_char)*?) (\1) /oxgc) { $e_string .= e_split_q($e.'qr','{','}',$2,''); next E_STRING_LOOP; } # q | | --> qr { }
4735 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 * *
4736 }
4737 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4738 }
4739 }
4740  
4741 # split m//
4742 elsif ($string =~ /\G \b (m) \b /oxgc) {
4743 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 (\#) ((?:$Elatin9::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
4744 else {
4745 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4746 0 ▶ if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e_string .= $e . $1; }
Branch: 8 branches
BranchTrueFalseTotal
if ($string =~ /\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) ([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 (\') ((?:$Elatin9::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$Elatin9::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Elatin9::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
4747 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m ( ) --> qr ( )
4748 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m { } --> qr { }
4749 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m [ ] --> qr [ ]
4750 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m < > --> qr < >
4751 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 ' '
4752 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr','{','}',$2,$4); next E_STRING_LOOP; } # m | | --> qr { }
4753 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 * *
4754 }
4755 0 die __FILE__, ": Search pattern not terminated\n";
4756 }
4757 }
4758  
4759 # split ''
4760 elsif ($string =~ /\G (\') /oxgc) {
4761 0 my $q_string = '';
4762 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4763 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 ($Elatin9::q_char) /cgox) { } 0 0 0
4764 0 elsif ($string =~ /\G (\\\') /oxgc) { $q_string .= $1; } # splitqr'' --> split qr''
4765 0 elsif ($string =~ /\G \' /oxgc) { $e_string .= e_split_q($e.q{ qr},"'","'",$q_string,''); next E_STRING_LOOP; } # ' ' --> qr ' '
4766 0 elsif ($string =~ /\G ($q_char) /oxgc) { $q_string .= $1; }
4767 }
4768 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4769 }
4770  
4771 # split ""
4772 elsif ($string =~ /\G (\") /oxgc) {
4773 0 my $qq_string = '';
4774 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4775 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 ($Elatin9::q_char) /cgox) { } 0 0 0
4776 0 elsif ($string =~ /\G (\\\") /oxgc) { $qq_string .= $1; } # splitqr"" --> split qr""
4777 0 elsif ($string =~ /\G \" /oxgc) { $e_string .= e_split($e.q{ qr},'"','"',$qq_string,''); next E_STRING_LOOP; } # " " --> qr " "
4778 0 elsif ($string =~ /\G ($q_char) /oxgc) { $qq_string .= $1; }
4779 }
4780 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4781 }
4782  
4783 # split //
4784 elsif ($string =~ /\G (\/) /oxgc) {
4785 0 my $regexp = '';
4786 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4787 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 ($Elatin9::q_char) /cgox) { } 0 0 0
4788 0 elsif ($string =~ /\G (\\\/) /oxgc) { $regexp .= $1; } # splitqr// --> split qr//
4789 0 elsif ($string =~ /\G \/ ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split($e.q{ qr}, '/','/',$regexp,$1); next E_STRING_LOOP; } # / / --> qr / /
4790 0 elsif ($string =~ /\G ($q_char) /oxgc) { $regexp .= $1; }
4791 }
4792 0 die __FILE__, ": Search pattern not terminated\n";
4793 }
4794 }
4795  
4796 # qq//
4797 elsif ($string =~ /\G \b (qq) \b /oxgc) {
4798 0 my $ope = $1;
4799 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qq# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Elatin9::qq_char)*?) (\#) /cgox) { } 0 0 0
4800 0 $e_string .= e_qq($ope,$1,$3,$2);
4801 }
4802 else {
4803 0 my $e = '';
4804 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4805 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) ((?:$Elatin9::qq_char)*?) (\1) /cgox) { } 0 0 0
4806 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq ( )
4807 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq { }
4808 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq [ ]
4809 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq < >
4810 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq * *
4811 }
4812 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4813 }
4814 }
4815  
4816 # qx//
4817 elsif ($string =~ /\G \b (qx) \b /oxgc) {
4818 0 my $ope = $1;
4819 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qx# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Elatin9::qq_char)*?) (\#) /cgox) { } 0 0 0
4820 0 $e_string .= e_qq($ope,$1,$3,$2);
4821 }
4822 else {
4823 0 my $e = '';
4824 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4825 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 (\') ((?:$Elatin9::qq_char)*?) (\') /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Elatin9::qq_char)*?) (\1) /cgox) { } 0 0 0
4826 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx ( )
4827 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx { }
4828 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx [ ]
4829 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx < >
4830 0 elsif ($string =~ /\G (\') ((?:$qq_char)*?) (\') /oxgc) { $e_string .= $e . e_q ($ope,$1,$3,$2); next E_STRING_LOOP; } # qx ' '
4831 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx * *
4832 }
4833 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4834 }
4835 }
4836  
4837 # q//
4838 elsif ($string =~ /\G \b (q) \b /oxgc) {
4839 0 my $ope = $1;
4840 0 ▶ if ($string =~ /\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { # q# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:\\\#|\\\\|$Elatin9::q_char)*?) (\#) /cgox) { } 0 0 0
4841 0 $e_string .= e_q($ope,$1,$3,$2);
4842 }
4843 else {
4844 0 my $e = '';
4845 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4846 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| $Elatin9::q_char)*?) (\1) /cgox) { } 0 0 0
4847 0 elsif ($string =~ /\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q ( )
4848 0 elsif ($string =~ /\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q { }
4849 0 elsif ($string =~ /\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q [ ]
4850 0 elsif ($string =~ /\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q < >
4851 0 elsif ($string =~ /\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q * *
4852 }
4853 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4854 }
4855 }
4856  
4857 # ''
4858 0 elsif ($string =~ /\G (?<![\w\$\@\%\&\*]) (\') ((?:\\\'|\\\\|$q_char)*?) (\') /oxgc) { $e_string .= e_q('',$1,$3,$2); }
4859  
4860 # ""
4861 0 elsif ($string =~ /\G (\") ((?:$qq_char)*?) (\") /oxgc) { $e_string .= e_qq('',$1,$3,$2); }
4862  
4863 # ``
4864 0 elsif ($string =~ /\G (\`) ((?:$qq_char)*?) (\`) /oxgc) { $e_string .= e_qq('',$1,$3,$2); }
4865  
4866 # <<>> (a safer ARGV)
4867 0 elsif ($string =~ /\G ( <<>> ) /oxgc) { $e_string .= $1; }
4868  
4869 # <<= <=> <= < operator
4870 0 elsif ($string =~ /\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/oxgc) { $e_string .= $1; }
4871  
4872 # <FILEHANDLE>
4873 0 elsif ($string =~ /\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /oxgc) { $e_string .= $1; }
4874  
4875 # <WILDCARD> --- glob
4876 elsif ($string =~ /\G < ((?:$q_char)+?) > /oxgc) {
4877 0 $e_string .= 'Elatin9::glob("' . $1 . '")';
4878 }
4879  
4880 # << (bit shift) --- not here document
4881 elsif ($string =~ /\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /oxgc) {
4882 0 $slash = 'm//';
4883 0 $e_string .= $1;
4884 }
4885  
4886 # <<~'HEREDOC'
4887 elsif ($string =~ /\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /oxgc) {
4888 0 $slash = 'm//';
4889 0 my $here_quote = $1;
4890 0 my $delimiter = $2;
4891  
4892 # get here document
4893 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4894 0 $here_script = CORE::substr $_, pos $_;
4895 0 $here_script =~ s/.*?\n//oxm;
4896 }
4897 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
4898 0 my $heredoc = $1;
4899 0 my $indent = $2;
4900 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4901 0 push @heredoc, $heredoc . qq{\n$delimiter\n};
4902 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4903 }
4904 else {
4905 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4906 }
4907 0 $e_string .= qq{<<'$delimiter'};
4908 }
4909  
4910 # <<~\HEREDOC
4911 elsif ($string =~ /\G ( <<~ \\([a-zA-Z_0-9]+) ) /oxgc) {
4912 0 $slash = 'm//';
4913 0 my $here_quote = $1;
4914 0 my $delimiter = $2;
4915  
4916 # get here document
4917 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4918 0 $here_script = CORE::substr $_, pos $_;
4919 0 $here_script =~ s/.*?\n//oxm;
4920 }
4921 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
4922 0 my $heredoc = $1;
4923 0 my $indent = $2;
4924 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4925 0 push @heredoc, $heredoc . qq{\n$delimiter\n};
4926 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4927 }
4928 else {
4929 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4930 }
4931 0 $e_string .= qq{<<\\$delimiter};
4932 }
4933  
4934 # <<~"HEREDOC"
4935 elsif ($string =~ /\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /oxgc) {
4936 0 $slash = 'm//';
4937 0 my $here_quote = $1;
4938 0 my $delimiter = $2;
4939  
4940 # get here document
4941 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4942 0 $here_script = CORE::substr $_, pos $_;
4943 0 $here_script =~ s/.*?\n//oxm;
4944 }
4945 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
4946 0 my $heredoc = $1;
4947 0 my $indent = $2;
4948 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4949 0 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4950 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4951 }
4952 else {
4953 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4954 }
4955 0 $e_string .= qq{<<"$delimiter"};
4956 }
4957  
4958 # <<~HEREDOC
4959 elsif ($string =~ /\G ( <<~ ([a-zA-Z_0-9]+) ) /oxgc) {
4960 0 $slash = 'm//';
4961 0 my $here_quote = $1;
4962 0 my $delimiter = $2;
4963  
4964 # get here document
4965 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4966 0 $here_script = CORE::substr $_, pos $_;
4967 0 $here_script =~ s/.*?\n//oxm;
4968 }
4969 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
4970 0 my $heredoc = $1;
4971 0 my $indent = $2;
4972 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4973 0 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4974 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4975 }
4976 else {
4977 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4978 }
4979 0 $e_string .= qq{<<$delimiter};
4980 }
4981  
4982 # <<~`HEREDOC`
4983 elsif ($string =~ /\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /oxgc) {
4984 0 $slash = 'm//';
4985 0 my $here_quote = $1;
4986 0 my $delimiter = $2;
4987  
4988 # get here document
4989 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4990 0 $here_script = CORE::substr $_, pos $_;
4991 0 $here_script =~ s/.*?\n//oxm;
4992 }
4993 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
4994 0 my $heredoc = $1;
4995 0 my $indent = $2;
4996 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4997 0 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4998 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4999 }
5000 else {
5001 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5002 }
5003 0 $e_string .= qq{<<`$delimiter`};
5004 }
5005  
5006 # <<'HEREDOC'
5007 elsif ($string =~ /\G ( << '([a-zA-Z_0-9]*)' ) /oxgc) {
5008 0 $slash = 'm//';
5009 0 my $here_quote = $1;
5010 0 my $delimiter = $2;
5011  
5012 # get here document
5013 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5014 0 $here_script = CORE::substr $_, pos $_;
5015 0 $here_script =~ s/.*?\n//oxm;
5016 }
5017 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
5018 0 push @heredoc, $1 . qq{\n$delimiter\n};
5019 0 push @heredoc_delimiter, $delimiter;
5020 }
5021 else {
5022 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5023 }
5024 0 $e_string .= $here_quote;
5025 }
5026  
5027 # <<\HEREDOC
5028 elsif ($string =~ /\G ( << \\([a-zA-Z_0-9]+) ) /oxgc) {
5029 0 $slash = 'm//';
5030 0 my $here_quote = $1;
5031 0 my $delimiter = $2;
5032  
5033 # get here document
5034 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5035 0 $here_script = CORE::substr $_, pos $_;
5036 0 $here_script =~ s/.*?\n//oxm;
5037 }
5038 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
5039 0 push @heredoc, $1 . qq{\n$delimiter\n};
5040 0 push @heredoc_delimiter, $delimiter;
5041 }
5042 else {
5043 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5044 }
5045 0 $e_string .= $here_quote;
5046 }
5047  
5048 # <<"HEREDOC"
5049 elsif ($string =~ /\G ( << "([a-zA-Z_0-9]*)" ) /oxgc) {
5050 0 $slash = 'm//';
5051 0 my $here_quote = $1;
5052 0 my $delimiter = $2;
5053  
5054 # get here document
5055 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5056 0 $here_script = CORE::substr $_, pos $_;
5057 0 $here_script =~ s/.*?\n//oxm;
5058 }
5059 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
5060 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
5061 0 push @heredoc_delimiter, $delimiter;
5062 }
5063 else {
5064 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5065 }
5066 0 $e_string .= $here_quote;
5067 }
5068  
5069 # <<HEREDOC
5070 elsif ($string =~ /\G ( << ([a-zA-Z_0-9]+) ) /oxgc) {
5071 0 $slash = 'm//';
5072 0 my $here_quote = $1;
5073 0 my $delimiter = $2;
5074  
5075 # get here document
5076 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5077 0 $here_script = CORE::substr $_, pos $_;
5078 0 $here_script =~ s/.*?\n//oxm;
5079 }
5080 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
5081 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
5082 0 push @heredoc_delimiter, $delimiter;
5083 }
5084 else {
5085 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5086 }
5087 0 $e_string .= $here_quote;
5088 }
5089  
5090 # <<`HEREDOC`
5091 elsif ($string =~ /\G ( << `([a-zA-Z_0-9]*)` ) /oxgc) {
5092 0 $slash = 'm//';
5093 0 my $here_quote = $1;
5094 0 my $delimiter = $2;
5095  
5096 # get here document
5097 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5098 0 $here_script = CORE::substr $_, pos $_;
5099 0 $here_script =~ s/.*?\n//oxm;
5100 }
5101 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
5102 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
5103 0 push @heredoc_delimiter, $delimiter;
5104 }
5105 else {
5106 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5107 }
5108 0 $e_string .= $here_quote;
5109 }
5110  
5111 # any operator before div
5112 elsif ($string =~ /\G (
5113 -- | \+\+ |
5114 [\)\}\]]
5115  
5116 18 ) /oxgc) { $slash = 'div'; $e_string .= $1; }
5117  
5118 # yada-yada or triple-dot operator
5119 elsif ($string =~ /\G (
5120 \.\.\.
5121  
5122 0 ) /oxgc) { $slash = 'm//'; $e_string .= q{die('Unimplemented')}; }
5123  
5124 # any operator before m//
5125 elsif ($string =~ /\G ((?>
5126  
5127 !~~ | !~ | != | ! |
5128 %= | % |
5129 &&= | && | &= | &\.= | &\. | & |
5130 -= | -> | - |
5131 :(?>\s*)= |
5132 : |
5133 <<>> |
5134 <<= | <=> | <= | < |
5135 == | => | =~ | = |
5136 >>= | >> | >= | > |
5137 \*\*= | \*\* | \*= | \* |
5138 \+= | \+ |
5139 \.\. | \.= | \. |
5140 \/\/= | \/\/ |
5141 \/= | \/ |
5142 \? |
5143 \\ |
5144 \^= | \^\.= | \^\. | \^ |
5145 \b x= |
5146 \|\|= | \|\| | \|= | \|\.= | \|\. | \| |
5147 ~~ | ~\. | ~ |
5148 \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b |
5149 \b(?: print )\b |
5150  
5151 [,;\(\{\[]
5152  
5153 31 )) /oxgc) { $slash = 'm//'; $e_string .= $1; }
5154  
5155 # other any character
5156 131 elsif ($string =~ /\G ($q_char) /oxgc) { $e_string .= $1; }
5157  
5158 # system error
5159 else {
5160 0 die __FILE__, ": Oops, this shouldn't happen!\n";
5161 }
5162 }
5163  
5164 17 return $e_string;
5165 }
5166  
5167 #
5168 # character class
5169 #
5170 1920 ▶sub character_class {
Subroutine character_class: called CC=3 SCAR=11.0
Pod undocumented
5171 1920 my($char,$modifier) = @_;
5172  
5173 1920 ▶ if ($char eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char eq '.') { } 52 1868 1920
5174 52 ▶ if ($modifier =~ /s/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/) { } 17 35 52
5175 17 return '${Elatin9::dot_s}';
5176 }
5177 else {
5178 35 return '${Elatin9::dot}';
5179 }
5180 }
5181 else {
5182 1868 return Elatin9::classic_character_class($char);
5183 }
5184 }
5185  
5186 #
5187 # escape capture ($1, $2, $3, ...)
5188 #
5189 212 ▶sub e_capture {
Subroutine e_capture: called CC=1 SCAR=0.0
Pod undocumented
5190  
5191 212 return join '', '${', $_[0], '}';
5192 }
5193  
5194 #
5195 # escape transliteration (tr/// or y///)
5196 #
5197 4 ▶sub e_tr {
Subroutine e_tr: called CC=5 SCAR=16.8
Pod undocumented
5198 4 my($variable,$charclass,$e,$charclass2,$modifier) = @_;
5199 4 my $e_tr = '';
5200 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
5201  
5202 4 $slash = 'div';
5203  
5204 # quote character class 1
5205 4 $charclass = q_tr($charclass);
5206  
5207 # quote character class 2
5208 4 $charclass2 = q_tr($charclass2);
5209  
5210 # /b /B modifier
5211 4 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) { } 0 4 4
5212 0 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq '') { } 0 0 0
5213 0 $e_tr = qq{tr$charclass$e$charclass2$modifier};
5214 }
5215 else {
5216 0 $e_tr = qq{$variable${bind_operator}tr$charclass$e$charclass2$modifier};
5217 }
5218 }
5219 else {
5220 4 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq '') { } 2 2 4
5221 2 $e_tr = qq{Elatin9::tr(\$_,' =~ ',$charclass,$e$charclass2,'$modifier')};
5222 }
5223 else {
5224 2 $e_tr = qq{Elatin9::tr($variable,'$bind_operator',$charclass,$e$charclass2,'$modifier')};
5225 }
5226 }
5227  
5228 # clear tr/// variable
5229 4 $tr_variable = '';
5230 4 $bind_operator = '';
5231  
5232 4 return $e_tr;
5233 }
5234  
5235 #
5236 # quote for escape transliteration (tr/// or y///)
5237 #
5238 8 ▶sub q_tr {
Subroutine q_tr: called CC=9 SCAR=40.6
Pod undocumented
5239 8 my($charclass) = @_;
5240  
5241 # quote character class
5242 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
5243 8 return e_q('', "'", "'", $charclass); # --> q' '
5244 }
5245 elsif ($charclass !~ /\//oxms) {
5246 0 return e_q('q', '/', '/', $charclass); # --> q/ /
5247 }
5248 elsif ($charclass !~ /\#/oxms) {
5249 0 return e_q('q', '#', '#', $charclass); # --> q# #
5250 }
5251 elsif ($charclass !~ /[\<\>]/oxms) {
5252 0 return e_q('q', '<', '>', $charclass); # --> q< >
5253 }
5254 elsif ($charclass !~ /[\(\)]/oxms) {
5255 0 return e_q('q', '(', ')', $charclass); # --> q( )
5256 }
5257 elsif ($charclass !~ /[\{\}]/oxms) {
5258 0 return e_q('q', '{', '}', $charclass); # --> q{ }
5259 }
5260 else {
5261 0 for my $char (qw( ! " $ % & * + . : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5262 0 ▶ if ($charclass !~ /\Q$char\E/xms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($charclass =~ /\Q$char\E/msx) 0 0 0
5263 0 return e_q('q', $char, $char, $charclass);
5264 }
5265 }
5266 }
5267  
5268 0 return e_q('q', '{', '}', $charclass);
5269 }
5270  
5271 #
5272 # escape q string (q//, '')
5273 #
5274 1623 ▶sub e_q {
Subroutine e_q: called CC=1 SCAR=0.0
Pod undocumented
5275 1623 my($ope,$delimiter,$end_delimiter,$string) = @_;
5276  
5277 1623 $slash = 'div';
5278  
5279 1623 return join '', $ope, $delimiter, $string, $end_delimiter;
5280 }
5281  
5282 #
5283 # escape qq string (qq//, "", qx//, ``)
5284 #
5285 4219 ▶sub e_qq {
Subroutine e_qq: called CC=37 SCAR=50.9
Pod undocumented
5286 4219 my($ope,$delimiter,$end_delimiter,$string) = @_;
5287  
5288 4219 $slash = 'div';
5289  
5290 4219 my $left_e = 0;
5291 4219 my $right_e = 0;
5292  
5293 # split regexp
5294 4219 my @char = $string =~ /\G((?>
5295 [^\\\$] |
5296 \\x\{ (?>[0-9A-Fa-f]+) \} |
5297 \\o\{ (?>[0-7]+) \} |
5298 \\N\{ (?>[^0-9\}][^\}]*) \} |
5299 \\ $q_char |
5300 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5301 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5302 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5303 \$ (?>\s* [0-9]+) |
5304 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5305 \$ \$ (?![\w\{]) |
5306 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5307 $q_char
5308 ))/oxmsg;
5309  
5310 4219 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 116665 4219 120884
5311  
5312 # "\L\u" --> "\u\L"
5313 116665 ▶ 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 116665 116665
elsif ($char[$i] eq '\\U' and $char[$i + 1] eq '\\l') { } 0 116665 116665
elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/mosx) { } 1 116664 116665
elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/mosx) { } 1 116663 116664
elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/mosx) { } 0 116663 116663
Condition33%1/3
$char[$i] eq "\\L" and $char[$i + 1] eq "\\u"
!ll&&!rl&&r
11666500
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
5314 0 @char[$i,$i+1] = @char[$i+1,$i];
5315 }
5316  
5317 # "\U\l" --> "\l\U"
5318 ▶ 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
11666500
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
5319 0 @char[$i,$i+1] = @char[$i+1,$i];
5320 }
5321  
5322 # octal escape sequence
5323 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5324 1 $char[$i] = Elatin9::octchr($1);
5325 }
5326  
5327 # hexadecimal escape sequence
5328 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5329 1 $char[$i] = Elatin9::hexchr($1);
5330 }
5331  
5332 # \N{CHARNAME} --> N{CHARNAME}
5333 elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5334 0 $char[$i] = $1;
5335 }
5336  
5337 116665 ▶ if (0) {
Branch: 23 branches
BranchTrueFalseTotal
if (do { $char[$i] =~ /\A ([<>]) \z/mosx }) { } 484 116181 116665
elsif ($char[$i] eq '\\u') { } 0 116181 116181
elsif ($char[$i] eq '\\l') { } 0 116181 116181
elsif ($char[$i] eq '\\U') { } 0 116181 116181
elsif ($char[$i] eq '\\L') { } 0 116181 116181
elsif ($char[$i] eq '\\F') { } 24 116157 116181
elsif ($char[$i] eq '\\Q') { } 0 116157 116157
elsif ($char[$i] eq '\\E') { } 24 116133 116157
elsif ($char[$i] eq '\\Q') { } 0 116133 116133
elsif ($char[$i] eq '\\E') { } 0 116133 116133
elsif ($char[$i] =~ /\A \$ 0 \z/mosx) { } 4 116129 116133
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/mosx) { } 0 116129 116129
elsif ($char[$i] =~ /\A \$\$ \z/mosx) { } 0 116129 116129
elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/mosx) { } 205 115924 116129
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/mosx) { } 0 115924 115924
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/mosx) { } 0 115924 115924
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/mosx) { } 0 115924 115924
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/mosx) { } 0 115924 115924
elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/cgmosx) { } 44 115880 115924
elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/cgmosx) { } 45 115835 115880
elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/cgmosx) { } 33 115802 115835
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/mosx) { } 0 115802 115802
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/mosx) { } 0 115802 115802
5338 }
5339  
5340 # \F
5341 #
5342 # P.69 Table 2-6. Translation escapes
5343 # in Chapter 2: Bits and Pieces
5344 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
5345 # (and so on)
5346  
5347 # \u \l \U \L \F \Q \E
5348 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
5349 484 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 484 484
5350 0 $char[$i] = '\\' . $char[$i];
5351 }
5352 }
5353 elsif ($char[$i] eq '\u') {
5354  
5355 # "STRING @{[ LIST EXPR ]} MORE STRING"
5356  
5357 # P.257 Other Tricks You Can Do with Hard References
5358 # in Chapter 8: References
5359 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
5360  
5361 # P.353 Other Tricks You Can Do with Hard References
5362 # in Chapter 8: References
5363 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
5364  
5365 # (and so on)
5366  
5367 0 $char[$i] = '@{[Elatin9::ucfirst qq<';
5368 0 $left_e++;
5369 }
5370 elsif ($char[$i] eq '\l') {
5371 0 $char[$i] = '@{[Elatin9::lcfirst qq<';
5372 0 $left_e++;
5373 }
5374 elsif ($char[$i] eq '\U') {
5375 0 $char[$i] = '@{[Elatin9::uc qq<';
5376 0 $left_e++;
5377 }
5378 elsif ($char[$i] eq '\L') {
5379 0 $char[$i] = '@{[Elatin9::lc qq<';
5380 0 $left_e++;
5381 }
5382 elsif ($char[$i] eq '\F') {
5383 24 $char[$i] = '@{[Elatin9::fc qq<';
5384 24 $left_e++;
5385 }
5386 elsif ($char[$i] eq '\Q') {
5387 0 $char[$i] = '@{[CORE::quotemeta qq<';
5388 0 $left_e++;
5389 }
5390 elsif ($char[$i] eq '\E') {
5391 24 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 24 0 24
5392 24 $char[$i] = '>]}';
5393 24 $right_e++;
5394 }
5395 else {
5396 0 $char[$i] = '';
5397 }
5398 }
5399 elsif ($char[$i] eq '\Q') {
5400 0 while (1) {
5401 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5402 0 last;
5403 }
5404 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
5405 0 last;
5406 }
5407 }
5408 }
5409 elsif ($char[$i] eq '\E') {
5410 }
5411  
5412 # $0 --> $0
5413 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
5414 }
5415 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
5416 }
5417  
5418 # $$ --> $$
5419 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
5420 }
5421  
5422 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
5423 # $1, $2, $3 --> $1, $2, $3 otherwise
5424 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
5425 205 $char[$i] = e_capture($1);
5426 }
5427 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
5428 0 $char[$i] = e_capture($1);
5429 }
5430  
5431 # $$foo[ ... ] --> $ $foo->[ ... ]
5432 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
5433 0 $char[$i] = e_capture($1.'->'.$2);
5434 }
5435  
5436 # $$foo{ ... } --> $ $foo->{ ... }
5437 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
5438 0 $char[$i] = e_capture($1.'->'.$2);
5439 }
5440  
5441 # $$foo
5442 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
5443 0 $char[$i] = e_capture($1);
5444 }
5445  
5446 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin9::PREMATCH()
5447 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
5448 44 $char[$i] = '@{[Elatin9::PREMATCH()]}';
5449 }
5450  
5451 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin9::MATCH()
5452 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
5453 45 $char[$i] = '@{[Elatin9::MATCH()]}';
5454 }
5455  
5456 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin9::POSTMATCH()
5457 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
5458 33 $char[$i] = '@{[Elatin9::POSTMATCH()]}';
5459 }
5460  
5461 # ${ foo } --> ${ foo }
5462 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/oxms) {
5463 }
5464  
5465 # ${ ... }
5466 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5467 0 $char[$i] = e_capture($1);
5468 }
5469 }
5470  
5471 # return string
5472 4219 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 4219 4219
5473 0 return join '', $ope, $delimiter, @char, '>]}' x ($left_e - $right_e), $end_delimiter;
5474 }
5475 4219 return join '', $ope, $delimiter, @char, $end_delimiter;
5476 }
5477  
5478 #
5479 # escape qw string (qw//)
5480 #
5481 16 ▶sub e_qw {
Subroutine e_qw: called CC=11 SCAR=43.1
Pod undocumented
5482 16 my($ope,$delimiter,$end_delimiter,$string) = @_;
5483  
5484 16 $slash = 'div';
5485  
5486 # choice again delimiter
5487 16 my %octet = map {$_ => 1} ($string =~ /\G ([\x00-\xFF]) /oxmsg);
5488 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
5489 16 return join '', $ope, $delimiter, $string, $end_delimiter;
5490 }
5491 elsif (not $octet{')'}) {
5492 0 return join '', $ope, '(', $string, ')';
5493 }
5494 elsif (not $octet{'}'}) {
5495 0 return join '', $ope, '{', $string, '}';
5496 }
5497 elsif (not $octet{']'}) {
5498 0 return join '', $ope, '[', $string, ']';
5499 }
5500 elsif (not $octet{'>'}) {
5501 0 return join '', $ope, '<', $string, '>';
5502 }
5503 else {
5504 0 for my $char (qw( ! " $ % & * + - . / : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5505 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5506 0 return join '', $ope, $char, $string, $char;
5507 }
5508 }
5509 }
5510  
5511 # qw/AAA BBB C'CC/ --> ('AAA', 'BBB', 'C\'CC')
5512 0 my @string = CORE::split(/\s+/, $string);
5513 0 for my $string (@string) {
5514 0 my @octet = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5515 0 for my $octet (@octet) {
5516 0 ▶ if ($octet =~ /\A (['\\]) \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($octet =~ /\A (['\\]) \z/mosx) 0 0 0
5517 0 $octet = '\\' . $1;
5518 }
5519 }
5520 0 $string = join '', @octet;
5521 }
5522 0 return join '', '(', (join ', ', map { "'$_'" } @string), ')';
5523 }
5524  
5525 #
5526 # escape here document (<<"HEREDOC", <<HEREDOC, <<`HEREDOC`, <<~"HEREDOC", <<~HEREDOC, <<~`HEREDOC`)
5527 #
5528 93 ▶sub e_heredoc {
Subroutine e_heredoc: called CC=37 SCAR=56.3
Pod undocumented
5529 93 my($string) = @_;
5530  
5531 93 $slash = 'm//';
5532  
5533 93 my $metachar = qr/[\@\\|]/oxms; # '|' is for <<`HEREDOC`
5534  
5535 93 my $left_e = 0;
5536 93 my $right_e = 0;
5537  
5538 # split regexp
5539 93 my @char = $string =~ /\G((?>
5540 [^\\\$] |
5541 \\x\{ (?>[0-9A-Fa-f]+) \} |
5542 \\o\{ (?>[0-7]+) \} |
5543 \\N\{ (?>[^0-9\}][^\}]*) \} |
5544 \\ $q_char |
5545 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5546 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5547 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5548 \$ (?>\s* [0-9]+) |
5549 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5550 \$ \$ (?![\w\{]) |
5551 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5552 $q_char
5553 ))/oxmsg;
5554  
5555 93 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 3177 93 3270
5556  
5557 # "\L\u" --> "\u\L"
5558 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
5559 0 @char[$i,$i+1] = @char[$i+1,$i];
5560 }
5561  
5562 # "\U\l" --> "\l\U"
5563 ▶ 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
5564 0 @char[$i,$i+1] = @char[$i+1,$i];
5565 }
5566  
5567 # octal escape sequence
5568 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5569 1 $char[$i] = Elatin9::octchr($1);
5570 }
5571  
5572 # hexadecimal escape sequence
5573 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5574 1 $char[$i] = Elatin9::hexchr($1);
5575 }
5576  
5577 # \N{CHARNAME} --> N{CHARNAME}
5578 elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5579 0 $char[$i] = $1;
5580 }
5581  
5582 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
5583 }
5584  
5585 # \u \l \U \L \F \Q \E
5586 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
5587 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
5588 0 $char[$i] = '\\' . $char[$i];
5589 }
5590 }
5591 elsif ($char[$i] eq '\u') {
5592 0 $char[$i] = '@{[Elatin9::ucfirst qq<';
5593 0 $left_e++;
5594 }
5595 elsif ($char[$i] eq '\l') {
5596 0 $char[$i] = '@{[Elatin9::lcfirst qq<';
5597 0 $left_e++;
5598 }
5599 elsif ($char[$i] eq '\U') {
5600 0 $char[$i] = '@{[Elatin9::uc qq<';
5601 0 $left_e++;
5602 }
5603 elsif ($char[$i] eq '\L') {
5604 0 $char[$i] = '@{[Elatin9::lc qq<';
5605 0 $left_e++;
5606 }
5607 elsif ($char[$i] eq '\F') {
5608 0 $char[$i] = '@{[Elatin9::fc qq<';
5609 0 $left_e++;
5610 }
5611 elsif ($char[$i] eq '\Q') {
5612 0 $char[$i] = '@{[CORE::quotemeta qq<';
5613 0 $left_e++;
5614 }
5615 elsif ($char[$i] eq '\E') {
5616 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
5617 0 $char[$i] = '>]}';
5618 0 $right_e++;
5619 }
5620 else {
5621 0 $char[$i] = '';
5622 }
5623 }
5624 elsif ($char[$i] eq '\Q') {
5625 0 while (1) {
5626 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5627 0 last;
5628 }
5629 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
5630 0 last;
5631 }
5632 }
5633 }
5634 elsif ($char[$i] eq '\E') {
5635 }
5636  
5637 # $0 --> $0
5638 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
5639 }
5640 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
5641 }
5642  
5643 # $$ --> $$
5644 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
5645 }
5646  
5647 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
5648 # $1, $2, $3 --> $1, $2, $3 otherwise
5649 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
5650 0 $char[$i] = e_capture($1);
5651 }
5652 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
5653 0 $char[$i] = e_capture($1);
5654 }
5655  
5656 # $$foo[ ... ] --> $ $foo->[ ... ]
5657 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
5658 0 $char[$i] = e_capture($1.'->'.$2);
5659 }
5660  
5661 # $$foo{ ... } --> $ $foo->{ ... }
5662 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
5663 0 $char[$i] = e_capture($1.'->'.$2);
5664 }
5665  
5666 # $$foo
5667 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
5668 0 $char[$i] = e_capture($1);
5669 }
5670  
5671 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin9::PREMATCH()
5672 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
5673 8 $char[$i] = '@{[Elatin9::PREMATCH()]}';
5674 }
5675  
5676 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin9::MATCH()
5677 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
5678 8 $char[$i] = '@{[Elatin9::MATCH()]}';
5679 }
5680  
5681 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin9::POSTMATCH()
5682 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
5683 6 $char[$i] = '@{[Elatin9::POSTMATCH()]}';
5684 }
5685  
5686 # ${ foo } --> ${ foo }
5687 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/oxms) {
5688 }
5689  
5690 # ${ ... }
5691 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5692 0 $char[$i] = e_capture($1);
5693 }
5694 }
5695  
5696 # return string
5697 93 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 93 93
5698 0 return join '', @char, '>]}' x ($left_e - $right_e);
5699 }
5700 93 return join '', @char;
5701 }
5702  
5703 #
5704 # escape regexp (m//, qr//)
5705 #
5706 880 ▶sub e_qr {
Subroutine e_qr: called CC=110 SCAR=73.6
Pod undocumented
5707 880 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5708 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
5709  
5710 880 $modifier =~ tr/p//d;
5711 880 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 880 880
5712 0 my $line = 0;
5713 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
5714 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
5715 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
5716 0 last;
5717 }
5718 }
5719 0 die qq{Unsupported modifier "$1" used at line $line.\n};
5720 }
5721  
5722 880 $slash = 'div';
5723  
5724 # literal null string pattern
5725 880 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 872 880
elsif ($modifier =~ tr/Bb//d) { } 2 870 872
5726 8 $modifier =~ tr/bB//d;
5727 8 $modifier =~ tr/i//d;
5728 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
5729 }
5730  
5731 # /b /B modifier
5732 elsif ($modifier =~ tr/bB//d) {
5733  
5734 # choice again delimiter
5735 2 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 2 2
5736 0 my @char = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5737 0 my %octet = map {$_ => 1} @char;
5738 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
5739 0 $delimiter = '(';
5740 0 $end_delimiter = ')';
5741 }
5742 elsif (not $octet{'}'}) {
5743 0 $delimiter = '{';
5744 0 $end_delimiter = '}';
5745 }
5746 elsif (not $octet{']'}) {
5747 0 $delimiter = '[';
5748 0 $end_delimiter = ']';
5749 }
5750 elsif (not $octet{'>'}) {
5751 0 $delimiter = '<';
5752 0 $end_delimiter = '>';
5753 }
5754 else {
5755 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5756 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5757 0 $delimiter = $char;
5758 0 $end_delimiter = $char;
5759 0 last;
5760 }
5761 }
5762 }
5763 }
5764  
5765 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
5766 0 return join '', $ope, $delimiter, $string, $matched, $end_delimiter, $modifier;
5767 }
5768 else {
5769 2 return join '', $ope, $delimiter, '(?:', $string, ')', $matched, $end_delimiter, $modifier;
5770 }
5771 }
5772  
5773 870 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 312 558 870
5774 870 my $metachar = qr/[\@\\|[\]{^]/oxms;
5775  
5776 # split regexp
5777 870 my @char = $string =~ /\G((?>
5778 [^\\\$\@\[\(] |
5779 \\x (?>[0-9A-Fa-f]{1,2}) |
5780 \\ (?>[0-7]{2,3}) |
5781 \\c [\x40-\x5F] |
5782 \\x\{ (?>[0-9A-Fa-f]+) \} |
5783 \\o\{ (?>[0-7]+) \} |
5784 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
5785 \\ $q_char |
5786 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5787 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5788 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5789 [\$\@] $qq_variable |
5790 \$ (?>\s* [0-9]+) |
5791 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5792 \$ \$ (?![\w\{]) |
5793 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5794 \[\^ |
5795 \[\: (?>[a-z]+) :\] |
5796 \[\:\^ (?>[a-z]+) :\] |
5797 \(\? |
5798 $q_char
5799 ))/oxmsg;
5800  
5801 # choice again delimiter
5802 870 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 870 870
5803 0 my %octet = map {$_ => 1} @char;
5804 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
5805 0 $delimiter = '(';
5806 0 $end_delimiter = ')';
5807 }
5808 elsif (not $octet{'}'}) {
5809 0 $delimiter = '{';
5810 0 $end_delimiter = '}';
5811 }
5812 elsif (not $octet{']'}) {
5813 0 $delimiter = '[';
5814 0 $end_delimiter = ']';
5815 }
5816 elsif (not $octet{'>'}) {
5817 0 $delimiter = '<';
5818 0 $end_delimiter = '>';
5819 }
5820 else {
5821 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5822 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5823 0 $delimiter = $char;
5824 0 $end_delimiter = $char;
5825 0 last;
5826 }
5827 }
5828 }
5829 }
5830  
5831 870 my $left_e = 0;
5832 870 my $right_e = 0;
5833 870 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 2100 870 2970
5834  
5835 # "\L\u" --> "\u\L"
5836 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
5837 0 @char[$i,$i+1] = @char[$i+1,$i];
5838 }
5839  
5840 # "\U\l" --> "\l\U"
5841 ▶ 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
5842 0 @char[$i,$i+1] = @char[$i+1,$i];
5843 }
5844  
5845 # octal escape sequence
5846 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5847 1 $char[$i] = Elatin9::octchr($1);
5848 }
5849  
5850 # hexadecimal escape sequence
5851 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5852 1 $char[$i] = Elatin9::hexchr($1);
5853 }
5854  
5855 # \b{...} --> b\{...}
5856 # \B{...} --> B\{...}
5857 # \N{CHARNAME} --> N\{CHARNAME}
5858 # \p{PROPERTY} --> p\{PROPERTY}
5859 # \P{PROPERTY} --> P\{PROPERTY}
5860 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5861 6 $char[$i] = $1 . '\\' . $2;
5862 }
5863  
5864 # \p, \P, \X --> p, P, X
5865 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
5866 4 $char[$i] = $1;
5867 }
5868  
5869 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 &Elatin9::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
5870 }
5871  
5872 # join separated multiple-octet
5873 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
5874 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 $Elatin9::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 $Elatin9::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 $Elatin9::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 $Elatin9::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 $Elatin9::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 $Elatin9::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 $Elatin9::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5875 0 $char[$i] .= join '', splice @char, $i+1, 3;
5876 }
5877 ▶ 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 $Elatin9::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 $Elatin9::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 $Elatin9::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 $Elatin9::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5878 0 $char[$i] .= join '', splice @char, $i+1, 2;
5879 }
5880 ▶ 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 $Elatin9::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 $Elatin9::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 $Elatin9::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 $Elatin9::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5881 0 $char[$i] .= join '', splice @char, $i+1, 1;
5882 }
5883 }
5884  
5885 # open character class [...]
5886 elsif ($char[$i] eq '[') {
5887 556 my $left = $i;
5888  
5889 # [] make die "Unmatched [] in regexp ...\n"
5890 # (and so on)
5891  
5892 556 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 3 553 556
5893 3 $i++;
5894 }
5895  
5896 556 while (1) {
5897 2063 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 2063 2063
5898 0 die __FILE__, ": Unmatched [] in regexp\n";
5899 }
5900 2063 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 556 1507 2063
5901 556 my $right = $i;
5902  
5903 # [...]
5904 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
5905 30 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin9::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
5906 }
5907 else {
5908 526 splice @char, $left, $right-$left+1, Elatin9::charlist_qr(@char[$left+1..$right-1], $modifier);
5909 }
5910  
5911 556 $i = $left;
5912 556 last;
5913 }
5914 }
5915 }
5916  
5917 # open character class [^...]
5918 elsif ($char[$i] eq '[^') {
5919 74 my $left = $i;
5920  
5921 # [^] make die "Unmatched [] in regexp ...\n"
5922 # (and so on)
5923  
5924 74 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 4 70 74
5925 4 $i++;
5926 }
5927  
5928 74 while (1) {
5929 272 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 272 272
5930 0 die __FILE__, ": Unmatched [] in regexp\n";
5931 }
5932 272 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 74 198 272
5933 74 my $right = $i;
5934  
5935 # [^...]
5936 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
5937 30 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin9::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
5938 }
5939 else {
5940 44 splice @char, $left, $right-$left+1, Elatin9::charlist_not_qr(@char[$left+1..$right-1], $modifier);
5941 }
5942  
5943 74 $i = $left;
5944 74 last;
5945 }
5946 }
5947 }
5948  
5949 # rewrite character class or escape character
5950 elsif (my $char = character_class($char[$i],$modifier)) {
5951 139 $char[$i] = $char;
5952 }
5953  
5954 # /i modifier
5955 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin9::uc($char[$i]) ne Elatin9::fc($char[$i]))) {
Condition100%6/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin9::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 &Elatin9::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin9::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= &Elatin9::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
5956 20 ▶ if (CORE::length(Elatin9::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 20 0 20
5957 20 $char[$i] = '[' . Elatin9::uc($char[$i]) . Elatin9::fc($char[$i]) . ']';
5958 }
5959 else {
5960 0 $char[$i] = '(?:' . Elatin9::uc($char[$i]) . '|' . Elatin9::fc($char[$i]) . ')';
5961 }
5962 }
5963  
5964 # \u \l \U \L \F \Q \E
5965 elsif ($char[$i] =~ /\A [<>] \z/oxms) {
5966 1 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 1 1
5967 0 $char[$i] = '\\' . $char[$i];
5968 }
5969 }
5970 elsif ($char[$i] eq '\u') {
5971 0 $char[$i] = '@{[Elatin9::ucfirst qq<';
5972 0 $left_e++;
5973 }
5974 elsif ($char[$i] eq '\l') {
5975 0 $char[$i] = '@{[Elatin9::lcfirst qq<';
5976 0 $left_e++;
5977 }
5978 elsif ($char[$i] eq '\U') {
5979 1 $char[$i] = '@{[Elatin9::uc qq<';
5980 1 $left_e++;
5981 }
5982 elsif ($char[$i] eq '\L') {
5983 1 $char[$i] = '@{[Elatin9::lc qq<';
5984 1 $left_e++;
5985 }
5986 elsif ($char[$i] eq '\F') {
5987 18 $char[$i] = '@{[Elatin9::fc qq<';
5988 18 $left_e++;
5989 }
5990 elsif ($char[$i] eq '\Q') {
5991 1 $char[$i] = '@{[CORE::quotemeta qq<';
5992 1 $left_e++;
5993 }
5994 elsif ($char[$i] eq '\E') {
5995 21 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 21 0 21
5996 21 $char[$i] = '>]}';
5997 21 $right_e++;
5998 }
5999 else {
6000 0 $char[$i] = '';
6001 }
6002 }
6003 elsif ($char[$i] eq '\Q') {
6004 0 while (1) {
6005 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6006 0 last;
6007 }
6008 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
6009 0 last;
6010 }
6011 }
6012 }
6013 elsif ($char[$i] eq '\E') {
6014 }
6015  
6016 # $0 --> $0
6017 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
6018 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6019 0 $char[$i] = '@{[Elatin9::ignorecase(' . $char[$i] . ')]}';
6020 }
6021 }
6022 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
6023 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6024 0 $char[$i] = '@{[Elatin9::ignorecase(' . $char[$i] . ')]}';
6025 }
6026 }
6027  
6028 # $$ --> $$
6029 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
6030 }
6031  
6032 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
6033 # $1, $2, $3 --> $1, $2, $3 otherwise
6034 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
6035 0 $char[$i] = e_capture($1);
6036 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6037 0 $char[$i] = '@{[Elatin9::ignorecase(' . $char[$i] . ')]}';
6038 }
6039 }
6040 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6041 0 $char[$i] = e_capture($1);
6042 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6043 0 $char[$i] = '@{[Elatin9::ignorecase(' . $char[$i] . ')]}';
6044 }
6045 }
6046  
6047 # $$foo[ ... ] --> $ $foo->[ ... ]
6048 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
6049 0 $char[$i] = e_capture($1.'->'.$2);
6050 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6051 0 $char[$i] = '@{[Elatin9::ignorecase(' . $char[$i] . ')]}';
6052 }
6053 }
6054  
6055 # $$foo{ ... } --> $ $foo->{ ... }
6056 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
6057 0 $char[$i] = e_capture($1.'->'.$2);
6058 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6059 0 $char[$i] = '@{[Elatin9::ignorecase(' . $char[$i] . ')]}';
6060 }
6061 }
6062  
6063 # $$foo
6064 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-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] = '@{[Elatin9::ignorecase(' . $char[$i] . ')]}';
6068 }
6069 }
6070  
6071 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin9::PREMATCH()
6072 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
6073 8 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 8 8
6074 0 $char[$i] = '@{[Elatin9::ignorecase(Elatin9::PREMATCH())]}';
6075 }
6076 else {
6077 8 $char[$i] = '@{[Elatin9::PREMATCH()]}';
6078 }
6079 }
6080  
6081 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin9::MATCH()
6082 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
6083 8 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 8 8
6084 0 $char[$i] = '@{[Elatin9::ignorecase(Elatin9::MATCH())]}';
6085 }
6086 else {
6087 8 $char[$i] = '@{[Elatin9::MATCH()]}';
6088 }
6089 }
6090  
6091 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin9::POSTMATCH()
6092 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
6093 6 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 6 6
6094 0 $char[$i] = '@{[Elatin9::ignorecase(Elatin9::POSTMATCH())]}';
6095 }
6096 else {
6097 6 $char[$i] = '@{[Elatin9::POSTMATCH()]}';
6098 }
6099 }
6100  
6101 # ${ foo }
6102 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
6103 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6104 0 $char[$i] = '@{[Elatin9::ignorecase(' . $char[$i] . ')]}';
6105 }
6106 }
6107  
6108 # ${ ... }
6109 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
6110 0 $char[$i] = e_capture($1);
6111 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6112 0 $char[$i] = '@{[Elatin9::ignorecase(' . $char[$i] . ')]}';
6113 }
6114 }
6115  
6116 # $scalar or @array
6117 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
6118 21 $char[$i] = e_string($char[$i]);
6119 21 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 11 10 21
6120 11 $char[$i] = '@{[Elatin9::ignorecase(' . $char[$i] . ')]}';
6121 }
6122 }
6123  
6124 # quote character before ? + * {
6125 ▶ 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
6126 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
6127 }
6128 ▶ 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
6129 0 my $char = $char[$i-1];
6130 0 ▶ if ($char[$i] eq '{') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq '{') { } 0 0 0
6131 0 die __FILE__, qq{: "MULTIBYTE{n}" should be "(MULTIBYTE){n}" in m?? (and shift \$1,\$2,\$3,...) ($char){n}\n};
6132 }
6133 else {
6134 0 die __FILE__, qq{: "MULTIBYTE$char[$i]" should be "(MULTIBYTE)$char[$i]" in m?? (and shift \$1,\$2,\$3,...) ($char)$char[$i]\n};
6135 }
6136 }
6137 else {
6138 127 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6139 }
6140 }
6141 }
6142  
6143 # make regexp string
6144 870 $modifier =~ tr/i//d;
6145 870 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 870 870
6146 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
6147 0 return join '', $ope, $delimiter, $anchor, @char, '>]}' x ($left_e - $right_e), $matched, $end_delimiter, $modifier;
6148 }
6149 else {
6150 0 return join '', $ope, $delimiter, $anchor, '(?:', @char, '>]}' x ($left_e - $right_e), ')', $matched, $end_delimiter, $modifier;
6151 }
6152 }
6153 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
6154 0 return join '', $ope, $delimiter, $anchor, @char, $matched, $end_delimiter, $modifier;
6155 }
6156 else {
6157 870 return join '', $ope, $delimiter, $anchor, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6158 }
6159 }
6160  
6161 #
6162 # double quote stuff
6163 #
6164 180 ▶sub qq_stuff {
Subroutine qq_stuff: called CC=6 SCAR=18.5
Pod undocumented
6165 180 my($delimiter,$end_delimiter,$stuff) = @_;
6166  
6167 # scalar variable or array variable
6168 180 ▶ if ($stuff =~ /\A [\$\@] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($stuff =~ /\A [\$\@] /mosx) 100 80 180
6169 100 return $stuff;
6170 }
6171  
6172 # quote by delimiter
6173 80 my %octet = map {$_ => 1} ($stuff =~ /\G ([\x00-\xFF]) /oxmsg);
6174 80 for my $char (qw( ! " $ % & * + - . / : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
6175 80 ▶ next if $char eq $delimiter;
Branch: 1 branch
BranchTrueFalseTotal
if $char eq $delimiter 0 80 80
6176 80 ▶ next if $char eq $end_delimiter;
Branch: 1 branch
BranchTrueFalseTotal
if $char eq $end_delimiter 0 80 80
6177 80 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 80 0 80
6178 80 return join '', 'qq', $char, $stuff, $char;
6179 }
6180 }
6181 0 return join '', 'qq', '<', $stuff, '>';
6182 }
6183  
6184 #
6185 # escape regexp (m'', qr'', and m''b, qr''b)
6186 #
6187 10 ▶sub e_qr_q {
Subroutine e_qr_q: called CC=7 SCAR=25.3
Pod undocumented
6188 10 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6189 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
6190  
6191 10 $modifier =~ tr/p//d;
6192 10 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 10 10
6193 0 my $line = 0;
6194 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6195 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6196 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6197 0 last;
6198 }
6199 }
6200 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6201 }
6202  
6203 10 $slash = 'div';
6204  
6205 # literal null string pattern
6206 10 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 2 10
elsif ($modifier =~ tr/Bb//d) { } 0 2 2
6207 8 $modifier =~ tr/bB//d;
6208 8 $modifier =~ tr/i//d;
6209 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
6210 }
6211  
6212 # with /b /B modifier
6213 elsif ($modifier =~ tr/bB//d) {
6214 0 return e_qr_qb($ope,$delimiter,$end_delimiter,$string,$modifier);
6215 }
6216  
6217 # without /b /B modifier
6218 else {
6219 2 return e_qr_qt($ope,$delimiter,$end_delimiter,$string,$modifier);
6220 }
6221 }
6222  
6223 #
6224 # escape regexp (m'', qr'')
6225 #
6226 2 ▶sub e_qr_qt {
Subroutine e_qr_qt: called CC=20 SCAR=51.8
Pod undocumented
6227 2 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6228  
6229 2 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 2 2
6230  
6231 # split regexp
6232 2 my @char = $string =~ /\G((?>
6233 [^\\\[\$\@\/] |
6234 [\x00-\xFF] |
6235 \[\^ |
6236 \[\: (?>[a-z]+) \:\] |
6237 \[\:\^ (?>[a-z]+) \:\] |
6238 [\$\@\/] |
6239 \\ (?:$q_char) |
6240 (?:$q_char)
6241 ))/oxmsg;
6242  
6243 # unescape character
6244 2 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 2 2 4
6245 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 &Elatin9::uc($char[$i]) ne &fc($char[$i])) { } 0 2 2
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 4 4
6246 }
6247  
6248 # open character class [...]
6249 elsif ($char[$i] eq '[') {
6250 0 my $left = $i;
6251 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6252 0 $i++;
6253 }
6254 0 while (1) {
6255 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6256 0 die __FILE__, ": Unmatched [] in regexp\n";
6257 }
6258 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6259 0 my $right = $i;
6260  
6261 # [...]
6262 0 splice @char, $left, $right-$left+1, Elatin9::charlist_qr(@char[$left+1..$right-1], $modifier);
6263  
6264 0 $i = $left;
6265 0 last;
6266 }
6267 }
6268 }
6269  
6270 # open character class [^...]
6271 elsif ($char[$i] eq '[^') {
6272 0 my $left = $i;
6273 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6274 0 $i++;
6275 }
6276 0 while (1) {
6277 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6278 0 die __FILE__, ": Unmatched [] in regexp\n";
6279 }
6280 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6281 0 my $right = $i;
6282  
6283 # [^...]
6284 0 splice @char, $left, $right-$left+1, Elatin9::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6285  
6286 0 $i = $left;
6287 0 last;
6288 }
6289 }
6290 }
6291  
6292 # escape $ @ / and \
6293 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6294 0 $char[$i] = '\\' . $char[$i];
6295 }
6296  
6297 # rewrite character class or escape character
6298 elsif (my $char = character_class($char[$i],$modifier)) {
6299 0 $char[$i] = $char;
6300 }
6301  
6302 # /i modifier
6303 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin9::uc($char[$i]) ne Elatin9::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin9::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 &Elatin9::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin9::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= &Elatin9::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6304 0 ▶ if (CORE::length(Elatin9::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
6305 0 $char[$i] = '[' . Elatin9::uc($char[$i]) . Elatin9::fc($char[$i]) . ']';
6306 }
6307 else {
6308 0 $char[$i] = '(?:' . Elatin9::uc($char[$i]) . '|' . Elatin9::fc($char[$i]) . ')';
6309 }
6310 }
6311  
6312 # quote character before ? + * {
6313 ▶ 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
6314 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
6315 }
6316 else {
6317 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6318 }
6319 }
6320 }
6321  
6322 2 $delimiter = '/';
6323 2 $end_delimiter = '/';
6324  
6325 2 $modifier =~ tr/i//d;
6326 2 return join '', $ope, $delimiter, $anchor, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6327 }
6328  
6329 #
6330 # escape regexp (m''b, qr''b)
6331 #
6332 0 ▶sub e_qr_qb {
Subroutine e_qr_qb: not called CC=4 SCAR=30.0
Pod undocumented
6333 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6334  
6335 # split regexp
6336 0 my @char = $string =~ /\G ((?>[^\\]|\\\\)) /oxmsg;
6337  
6338 # unescape character
6339 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
6340 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
6341 }
6342  
6343 # remain \\
6344 elsif ($char[$i] eq '\\\\') {
6345 }
6346  
6347 # escape $ @ / and \
6348 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6349 0 $char[$i] = '\\' . $char[$i];
6350 }
6351 }
6352  
6353 0 $delimiter = '/';
6354 0 $end_delimiter = '/';
6355 0 return join '', $ope, $delimiter, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6356 }
6357  
6358 #
6359 # escape regexp (s/here//)
6360 #
6361 80 ▶sub e_s1 {
Subroutine e_s1: called CC=106 SCAR=81.1
Pod undocumented
6362 80 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6363 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
6364  
6365 80 $modifier =~ tr/p//d;
6366 80 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 80 80
6367 0 my $line = 0;
6368 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6369 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6370 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6371 0 last;
6372 }
6373 }
6374 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6375 }
6376  
6377 80 $slash = 'div';
6378  
6379 # literal null string pattern
6380 80 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 72 80
elsif ($modifier =~ tr/Bb//d) { } 0 72 72
6381 8 $modifier =~ tr/bB//d;
6382 8 $modifier =~ tr/i//d;
6383 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
6384 }
6385  
6386 # /b /B modifier
6387 elsif ($modifier =~ tr/bB//d) {
6388  
6389 # choice again delimiter
6390 0 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 0 0
6391 0 my @char = $string =~ /\G ([\x00-\xFF]) /oxmsg;
6392 0 my %octet = map {$_ => 1} @char;
6393 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
6394 0 $delimiter = '(';
6395 0 $end_delimiter = ')';
6396 }
6397 elsif (not $octet{'}'}) {
6398 0 $delimiter = '{';
6399 0 $end_delimiter = '}';
6400 }
6401 elsif (not $octet{']'}) {
6402 0 $delimiter = '[';
6403 0 $end_delimiter = ']';
6404 }
6405 elsif (not $octet{'>'}) {
6406 0 $delimiter = '<';
6407 0 $end_delimiter = '>';
6408 }
6409 else {
6410 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
6411 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
6412 0 $delimiter = $char;
6413 0 $end_delimiter = $char;
6414 0 last;
6415 }
6416 }
6417 }
6418 }
6419  
6420 0 my $prematch = '';
6421 0 return join '', $ope, $delimiter, $prematch, '(?:', $string, ')', $matched, $end_delimiter, $modifier;
6422 }
6423  
6424 72 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 1 71 72
6425 72 my $metachar = qr/[\@\\|[\]{^]/oxms;
6426  
6427 # split regexp
6428 72 my @char = $string =~ /\G((?>
6429 [^\\\$\@\[\(] |
6430 \\ (?>[1-9][0-9]*) |
6431 \\g (?>\s*) (?>[1-9][0-9]*) |
6432 \\g (?>\s*) \{ (?>\s*) (?>[1-9][0-9]*) (?>\s*) \} |
6433 \\g (?>\s*) \{ (?>\s*) - (?>\s*) (?>[1-9][0-9]*) (?>\s*) \} |
6434 \\x (?>[0-9A-Fa-f]{1,2}) |
6435 \\ (?>[0-7]{2,3}) |
6436 \\c [\x40-\x5F] |
6437 \\x\{ (?>[0-9A-Fa-f]+) \} |
6438 \\o\{ (?>[0-7]+) \} |
6439 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
6440 \\ $q_char |
6441 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
6442 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
6443 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
6444 [\$\@] $qq_variable |
6445 \$ (?>\s* [0-9]+) |
6446 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
6447 \$ \$ (?![\w\{]) |
6448 \$ (?>\s*) \$ (?>\s*) $qq_variable |
6449 \[\^ |
6450 \[\: (?>[a-z]+) :\] |
6451 \[\:\^ (?>[a-z]+) :\] |
6452 \(\? |
6453 $q_char
6454 ))/oxmsg;
6455  
6456 # choice again delimiter
6457 72 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 72 72
6458 0 my %octet = map {$_ => 1} @char;
6459 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
6460 0 $delimiter = '(';
6461 0 $end_delimiter = ')';
6462 }
6463 elsif (not $octet{'}'}) {
6464 0 $delimiter = '{';
6465 0 $end_delimiter = '}';
6466 }
6467 elsif (not $octet{']'}) {
6468 0 $delimiter = '[';
6469 0 $end_delimiter = ']';
6470 }
6471 elsif (not $octet{'>'}) {
6472 0 $delimiter = '<';
6473 0 $end_delimiter = '>';
6474 }
6475 else {
6476 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
6477 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
6478 0 $delimiter = $char;
6479 0 $end_delimiter = $char;
6480 0 last;
6481 }
6482 }
6483 }
6484 }
6485  
6486 # count '('
6487 72 my $parens = grep { $_ eq '(' } @char;
6488  
6489 72 my $left_e = 0;
6490 72 my $right_e = 0;
6491 72 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 200 72 272
6492  
6493 # "\L\u" --> "\u\L"
6494 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
6495 0 @char[$i,$i+1] = @char[$i+1,$i];
6496 }
6497  
6498 # "\U\l" --> "\l\U"
6499 ▶ 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
6500 0 @char[$i,$i+1] = @char[$i+1,$i];
6501 }
6502  
6503 # octal escape sequence
6504 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
6505 1 $char[$i] = Elatin9::octchr($1);
6506 }
6507  
6508 # hexadecimal escape sequence
6509 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
6510 1 $char[$i] = Elatin9::hexchr($1);
6511 }
6512  
6513 # \b{...} --> b\{...}
6514 # \B{...} --> B\{...}
6515 # \N{CHARNAME} --> N\{CHARNAME}
6516 # \p{PROPERTY} --> p\{PROPERTY}
6517 # \P{PROPERTY} --> P\{PROPERTY}
6518 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
6519 0 $char[$i] = $1 . '\\' . $2;
6520 }
6521  
6522 # \p, \P, \X --> p, P, X
6523 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
6524 0 $char[$i] = $1;
6525 }
6526  
6527 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 &Elatin9::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
6528 }
6529  
6530 # join separated multiple-octet
6531 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
6532 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 $Elatin9::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 $Elatin9::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 $Elatin9::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 $Elatin9::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 $Elatin9::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 $Elatin9::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 $Elatin9::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6533 0 $char[$i] .= join '', splice @char, $i+1, 3;
6534 }
6535 ▶ 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 $Elatin9::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 $Elatin9::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 $Elatin9::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 $Elatin9::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6536 0 $char[$i] .= join '', splice @char, $i+1, 2;
6537 }
6538 ▶ 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 $Elatin9::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 $Elatin9::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 $Elatin9::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 $Elatin9::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6539 0 $char[$i] .= join '', splice @char, $i+1, 1;
6540 }
6541 }
6542  
6543 # open character class [...]
6544 elsif ($char[$i] eq '[') {
6545 17 my $left = $i;
6546 17 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 17 17
6547 0 $i++;
6548 }
6549 17 while (1) {
6550 74 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 74 74
6551 0 die __FILE__, ": Unmatched [] in regexp\n";
6552 }
6553 74 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 17 57 74
6554 17 my $right = $i;
6555  
6556 # [...]
6557 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
6558 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin9::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6559 }
6560 else {
6561 17 splice @char, $left, $right-$left+1, Elatin9::charlist_qr(@char[$left+1..$right-1], $modifier);
6562 }
6563  
6564 17 $i = $left;
6565 17 last;
6566 }
6567 }
6568 }
6569  
6570 # open character class [^...]
6571 elsif ($char[$i] eq '[^') {
6572 0 my $left = $i;
6573 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6574 0 $i++;
6575 }
6576 0 while (1) {
6577 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6578 0 die __FILE__, ": Unmatched [] in regexp\n";
6579 }
6580 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6581 0 my $right = $i;
6582  
6583 # [^...]
6584 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
6585 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin9::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6586 }
6587 else {
6588 0 splice @char, $left, $right-$left+1, Elatin9::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6589 }
6590  
6591 0 $i = $left;
6592 0 last;
6593 }
6594 }
6595 }
6596  
6597 # rewrite character class or escape character
6598 elsif (my $char = character_class($char[$i],$modifier)) {
6599 7 $char[$i] = $char;
6600 }
6601  
6602 # /i modifier
6603 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin9::uc($char[$i]) ne Elatin9::fc($char[$i]))) {
Condition66%4/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin9::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 &Elatin9::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin9::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= &Elatin9::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6604 3 ▶ if (CORE::length(Elatin9::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 3 0 3
6605 3 $char[$i] = '[' . Elatin9::uc($char[$i]) . Elatin9::fc($char[$i]) . ']';
6606 }
6607 else {
6608 0 $char[$i] = '(?:' . Elatin9::uc($char[$i]) . '|' . Elatin9::fc($char[$i]) . ')';
6609 }
6610 }
6611  
6612 # \u \l \U \L \F \Q \E
6613 elsif ($char[$i] =~ /\A [<>] \z/oxms) {
6614 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
6615 0 $char[$i] = '\\' . $char[$i];
6616 }
6617 }
6618 elsif ($char[$i] eq '\u') {
6619 0 $char[$i] = '@{[Elatin9::ucfirst qq<';
6620 0 $left_e++;
6621 }
6622 elsif ($char[$i] eq '\l') {
6623 0 $char[$i] = '@{[Elatin9::lcfirst qq<';
6624 0 $left_e++;
6625 }
6626 elsif ($char[$i] eq '\U') {
6627 0 $char[$i] = '@{[Elatin9::uc qq<';
6628 0 $left_e++;
6629 }
6630 elsif ($char[$i] eq '\L') {
6631 0 $char[$i] = '@{[Elatin9::lc qq<';
6632 0 $left_e++;
6633 }
6634 elsif ($char[$i] eq '\F') {
6635 0 $char[$i] = '@{[Elatin9::fc qq<';
6636 0 $left_e++;
6637 }
6638 elsif ($char[$i] eq '\Q') {
6639 0 $char[$i] = '@{[CORE::quotemeta qq<';
6640 0 $left_e++;
6641 }
6642 elsif ($char[$i] eq '\E') {
6643 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
6644 0 $char[$i] = '>]}';
6645 0 $right_e++;
6646 }
6647 else {
6648 0 $char[$i] = '';
6649 }
6650 }
6651 elsif ($char[$i] eq '\Q') {
6652 0 while (1) {
6653 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6654 0 last;
6655 }
6656 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
6657 0 last;
6658 }
6659 }
6660 }
6661 elsif ($char[$i] eq '\E') {
6662 }
6663  
6664 # \0 --> \0
6665 elsif ($char[$i] =~ /\A \\ (?>\s*) 0 \z/oxms) {
6666 }
6667  
6668 # \g{N}, \g{-N}
6669  
6670 # P.108 Using Simple Patterns
6671 # in Chapter 7: In the World of Regular Expressions
6672 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
6673  
6674 # P.221 Capturing
6675 # in Chapter 5: Pattern Matching
6676 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
6677  
6678 # \g{-1}, \g{-2}, \g{-3} --> \g{-1}, \g{-2}, \g{-3}
6679 elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) - (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6680 }
6681  
6682 # \g{1}, \g{2}, \g{3} --> \g{2}, \g{3}, \g{4} (only when multibyte anchoring is enable)
6683 elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6684 }
6685  
6686 # \g1, \g2, \g3 --> \g2, \g3, \g4 (only when multibyte anchoring is enable)
6687 elsif ($char[$i] =~ /\A \\g (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) {
6688 }
6689  
6690 # \1, \2, \3 --> \2, \3, \4 (only when multibyte anchoring is enable)
6691 elsif ($char[$i] =~ /\A \\ (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) {
6692 }
6693  
6694 # $0 --> $0
6695 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
6696 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6697 0 $char[$i] = '@{[Elatin9::ignorecase(' . $char[$i] . ')]}';
6698 }
6699 }
6700 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
6701 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6702 0 $char[$i] = '@{[Elatin9::ignorecase(' . $char[$i] . ')]}';
6703 }
6704 }
6705  
6706 # $$ --> $$
6707 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
6708 }
6709  
6710 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
6711 # $1, $2, $3 --> $1, $2, $3 otherwise
6712 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
6713 0 $char[$i] = e_capture($1);
6714 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6715 0 $char[$i] = '@{[Elatin9::ignorecase(' . $char[$i] . ')]}';
6716 }
6717 }
6718 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6719 0 $char[$i] = e_capture($1);
6720 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6721 0 $char[$i] = '@{[Elatin9::ignorecase(' . $char[$i] . ')]}';
6722 }
6723 }
6724  
6725 # $$foo[ ... ] --> $ $foo->[ ... ]
6726 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
6727 0 $char[$i] = e_capture($1.'->'.$2);
6728 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6729 0 $char[$i] = '@{[Elatin9::ignorecase(' . $char[$i] . ')]}';
6730 }
6731 }
6732  
6733 # $$foo{ ... } --> $ $foo->{ ... }
6734 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
6735 0 $char[$i] = e_capture($1.'->'.$2);
6736 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6737 0 $char[$i] = '@{[Elatin9::ignorecase(' . $char[$i] . ')]}';
6738 }
6739 }
6740  
6741 # $$foo
6742 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-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] = '@{[Elatin9::ignorecase(' . $char[$i] . ')]}';
6746 }
6747 }
6748  
6749 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin9::PREMATCH()
6750 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
6751 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 4 4
6752 0 $char[$i] = '@{[Elatin9::ignorecase(Elatin9::PREMATCH())]}';
6753 }
6754 else {
6755 4 $char[$i] = '@{[Elatin9::PREMATCH()]}';
6756 }
6757 }
6758  
6759 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin9::MATCH()
6760 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
6761 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 4 4
6762 0 $char[$i] = '@{[Elatin9::ignorecase(Elatin9::MATCH())]}';
6763 }
6764 else {
6765 4 $char[$i] = '@{[Elatin9::MATCH()]}';
6766 }
6767 }
6768  
6769 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin9::POSTMATCH()
6770 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
6771 3 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 3 3
6772 0 $char[$i] = '@{[Elatin9::ignorecase(Elatin9::POSTMATCH())]}';
6773 }
6774 else {
6775 3 $char[$i] = '@{[Elatin9::POSTMATCH()]}';
6776 }
6777 }
6778  
6779 # ${ foo }
6780 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
6781 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6782 0 $char[$i] = '@{[Elatin9::ignorecase(' . $char[$i] . ')]}';
6783 }
6784 }
6785  
6786 # ${ ... }
6787 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
6788 0 $char[$i] = e_capture($1);
6789 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6790 0 $char[$i] = '@{[Elatin9::ignorecase(' . $char[$i] . ')]}';
6791 }
6792 }
6793  
6794 # $scalar or @array
6795 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
6796 4 $char[$i] = e_string($char[$i]);
6797 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 4 4
6798 0 $char[$i] = '@{[Elatin9::ignorecase(' . $char[$i] . ')]}';
6799 }
6800 }
6801  
6802 # quote character before ? + * {
6803 ▶ 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
6804 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
6805 }
6806 else {
6807 14 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6808 }
6809 }
6810 }
6811  
6812 # make regexp string
6813 72 my $prematch = '';
6814 72 $modifier =~ tr/i//d;
6815 72 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 72 72
6816 0 return join '', $ope, $delimiter, $prematch, '(?:', @char, '>]}' x ($left_e - $right_e), ')', $matched, $end_delimiter, $modifier;
6817 }
6818 72 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6819 }
6820  
6821 #
6822 # escape regexp (s'here'' or s'here''b)
6823 #
6824 21 ▶sub e_s1_q {
Subroutine e_s1_q: called CC=7 SCAR=24.3
Pod undocumented
6825 21 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6826 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
6827  
6828 21 $modifier =~ tr/p//d;
6829 21 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 21 21
6830 0 my $line = 0;
6831 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6832 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6833 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6834 0 last;
6835 }
6836 }
6837 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6838 }
6839  
6840 21 $slash = 'div';
6841  
6842 # literal null string pattern
6843 21 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 13 21
elsif ($modifier =~ tr/Bb//d) { } 0 13 13
6844 8 $modifier =~ tr/bB//d;
6845 8 $modifier =~ tr/i//d;
6846 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
6847 }
6848  
6849 # with /b /B modifier
6850 elsif ($modifier =~ tr/bB//d) {
6851 0 return e_s1_qb($ope,$delimiter,$end_delimiter,$string,$modifier);
6852 }
6853  
6854 # without /b /B modifier
6855 else {
6856 13 return e_s1_qt($ope,$delimiter,$end_delimiter,$string,$modifier);
6857 }
6858 }
6859  
6860 #
6861 # escape regexp (s'here'')
6862 #
6863 13 ▶sub e_s1_qt {
Subroutine e_s1_qt: called CC=20 SCAR=50.1
Pod undocumented
6864 13 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6865  
6866 13 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 13 13
6867  
6868 # split regexp
6869 13 my @char = $string =~ /\G((?>
6870 [^\\\[\$\@\/] |
6871 [\x00-\xFF] |
6872 \[\^ |
6873 \[\: (?>[a-z]+) \:\] |
6874 \[\:\^ (?>[a-z]+) \:\] |
6875 [\$\@\/] |
6876 \\ (?:$q_char) |
6877 (?:$q_char)
6878 ))/oxmsg;
6879  
6880 # unescape character
6881 13 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 25 13 38
6882 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 &Elatin9::uc($char[$i]) ne &fc($char[$i])) { } 0 19 19
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 32 32
6883 }
6884  
6885 # open character class [...]
6886 elsif ($char[$i] eq '[') {
6887 0 my $left = $i;
6888 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6889 0 $i++;
6890 }
6891 0 while (1) {
6892 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6893 0 die __FILE__, ": Unmatched [] in regexp\n";
6894 }
6895 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6896 0 my $right = $i;
6897  
6898 # [...]
6899 0 splice @char, $left, $right-$left+1, Elatin9::charlist_qr(@char[$left+1..$right-1], $modifier);
6900  
6901 0 $i = $left;
6902 0 last;
6903 }
6904 }
6905 }
6906  
6907 # open character class [^...]
6908 elsif ($char[$i] eq '[^') {
6909 0 my $left = $i;
6910 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6911 0 $i++;
6912 }
6913 0 while (1) {
6914 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6915 0 die __FILE__, ": Unmatched [] in regexp\n";
6916 }
6917 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6918 0 my $right = $i;
6919  
6920 # [^...]
6921 0 splice @char, $left, $right-$left+1, Elatin9::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6922  
6923 0 $i = $left;
6924 0 last;
6925 }
6926 }
6927 }
6928  
6929 # escape $ @ / and \
6930 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6931 0 $char[$i] = '\\' . $char[$i];
6932 }
6933  
6934 # rewrite character class or escape character
6935 elsif (my $char = character_class($char[$i],$modifier)) {
6936 6 $char[$i] = $char;
6937 }
6938  
6939 # /i modifier
6940 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin9::uc($char[$i]) ne Elatin9::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin9::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 &Elatin9::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin9::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= &Elatin9::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6941 0 ▶ if (CORE::length(Elatin9::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
6942 0 $char[$i] = '[' . Elatin9::uc($char[$i]) . Elatin9::fc($char[$i]) . ']';
6943 }
6944 else {
6945 0 $char[$i] = '(?:' . Elatin9::uc($char[$i]) . '|' . Elatin9::fc($char[$i]) . ')';
6946 }
6947 }
6948  
6949 # quote character before ? + * {
6950 ▶ 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
6951 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
6952 }
6953 else {
6954 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6955 }
6956 }
6957 }
6958  
6959 13 $modifier =~ tr/i//d;
6960 13 $delimiter = '/';
6961 13 $end_delimiter = '/';
6962 13 my $prematch = '';
6963 13 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6964 }
6965  
6966 #
6967 # escape regexp (s'here''b)
6968 #
6969 0 ▶sub e_s1_qb {
Subroutine e_s1_qb: not called CC=4 SCAR=30.0
Pod undocumented
6970 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6971  
6972 # split regexp
6973 0 my @char = $string =~ /\G (?>[^\\]|\\\\) /oxmsg;
6974  
6975 # unescape character
6976 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
6977 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
6978 }
6979  
6980 # remain \\
6981 elsif ($char[$i] eq '\\\\') {
6982 }
6983  
6984 # escape $ @ / and \
6985 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6986 0 $char[$i] = '\\' . $char[$i];
6987 }
6988 }
6989  
6990 0 $delimiter = '/';
6991 0 $end_delimiter = '/';
6992 0 my $prematch = '';
6993 0 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6994 }
6995  
6996 #
6997 # escape regexp (s''here')
6998 #
6999 16 ▶sub e_s2_q {
Subroutine e_s2_q: called CC=4 SCAR=13.9
Pod undocumented
7000 16 my($ope,$delimiter,$end_delimiter,$string) = @_;
7001  
7002 16 $slash = 'div';
7003  
7004 16 my @char = $string =~ / \G (?>[^\\]|\\\\|$q_char) /oxmsg;
7005 16 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 9 16 25
7006 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
7007 }
7008  
7009 # not escape \\
7010 elsif ($char[$i] =~ /\A \\\\ \z/oxms) {
7011 }
7012  
7013 # escape $ @ / and \
7014 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
7015 5 $char[$i] = '\\' . $char[$i];
7016 }
7017 }
7018  
7019 16 return join '', $ope, $delimiter, @char, $end_delimiter;
7020 }
7021  
7022 #
7023 # escape regexp (s/here/and here/modifier)
7024 #
7025 101 ▶sub e_sub {
Subroutine e_sub: called CC=20 SCAR=32.6
Pod undocumented
7026 101 my($variable,$delimiter1,$pattern,$end_delimiter1,$delimiter2,$replacement,$end_delimiter2,$modifier) = @_;
7027 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
7028  
7029 101 $modifier =~ tr/p//d;
7030 101 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 101 101
7031 0 my $line = 0;
7032 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7033 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
7034 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
7035 0 last;
7036 }
7037 }
7038 0 die qq{Unsupported modifier "$1" used at line $line.\n};
7039 }
7040  
7041 101 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq "") 36 65 101
7042 36 $variable = '$_';
7043 36 $bind_operator = ' =~ ';
7044 }
7045  
7046 101 $slash = 'div';
7047  
7048 # P.128 Start of match (or end of previous match): \G
7049 # P.130 Advanced Use of \G with Perl
7050 # in Chapter 3: Overview of Regular Expression Features and Flavors
7051 # P.312 Iterative Matching: Scalar Context, with /g
7052 # in Chapter 7: Perl
7053 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
7054  
7055 # P.181 Where You Left Off: The \G Assertion
7056 # in Chapter 5: Pattern Matching
7057 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
7058  
7059 # P.220 Where You Left Off: The \G Assertion
7060 # in Chapter 5: Pattern Matching
7061 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
7062  
7063 101 my $e_modifier = $modifier =~ tr/e//d;
7064 101 my $r_modifier = $modifier =~ tr/r//d;
7065  
7066 101 my $my = '';
7067 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
7068 0 $my = $variable;
7069 0 $variable =~ s/ (?: local \b | my \b | our \b | state \b ) (?>\s*) //oxms;
7070 0 $variable =~ s/ = .+ \z//oxms;
7071 }
7072  
7073 101 (my $variable_basename = $variable) =~ s/ [\[\{].* \z//oxms;
7074 101 $variable_basename =~ s/ \s+ \z//oxms;
7075  
7076 # quote replacement string
7077 101 my $e_replacement = '';
7078 101 ▶ if ($e_modifier >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($e_modifier >= 1) { } 17 84 101
7079 17 $e_replacement = e_qq('', '', '', $replacement);
7080 17 $e_modifier--;
7081 }
7082 else {
7083 84 ▶ if ($delimiter2 eq "'") {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter2 eq q[']) { } 16 68 84
7084 16 $e_replacement = e_s2_q('qq', '/', '/', $replacement);
7085 }
7086 else {
7087 68 $e_replacement = e_qq ('qq', $delimiter2, $end_delimiter2, $replacement);
7088 }
7089 }
7090  
7091 101 my $sub = '';
7092  
7093 # with /r
7094 101 ▶ if ($r_modifier) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r_modifier) { } 10 91 101
7095 10 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $modifier =~ /g/mosx }) { } 5 5 10
7096 }
7097  
7098 # s///gr without multibyte anchoring
7099 elsif ($modifier =~ /g/oxms) {
7100 5 ▶ $sub = sprintf(
Branch: 1 branch
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 0 5 5
7101 # 1 2 3 4 5
7102 q<CORE::eval{local $Elatin9::re_t=%s; while($Elatin9::re_t =~ %s){%s local $^W=0; local $Elatin9::re_r=%s; %s$Elatin9::re_t="$`$Elatin9::re_r$'"; pos($Elatin9::re_t)=length "$`$Elatin9::re_r"; } return $Elatin9::re_t}>,
7103  
7104 $variable, # 1
7105 ($delimiter1 eq "'") ? # 2
7106 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
7107 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
7108 $s_matched, # 3
7109 $e_replacement, # 4
7110 '$Elatin9::re_r=CORE::eval $Elatin9::re_r; ' x $e_modifier, # 5
7111 );
7112 }
7113  
7114 # s///r
7115 else {
7116  
7117 5 my $prematch = q{$`};
7118  
7119 5 ▶ $sub = sprintf(
Branch: 1 branch
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 0 5 5
7120 # 1 2 3 4 5 6 7
7121 q<(%s =~ %s) ? CORE::eval{%s local $^W=0; local $Elatin9::re_r=%s; %s"%s$Elatin9::re_r$'" } : %s>,
7122  
7123 $variable, # 1
7124 ($delimiter1 eq "'") ? # 2
7125 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
7126 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
7127 $s_matched, # 3
7128 $e_replacement, # 4
7129 '$Elatin9::re_r=CORE::eval $Elatin9::re_r; ' x $e_modifier, # 5
7130 $prematch, # 6
7131 $variable, # 7
7132 );
7133 }
7134  
7135 # $var !~ s///r doesn't make sense
7136 10 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) 0 10 10
7137 0 $sub = q{die("$0: Using !~ with s///r doesn't make sense"), } . $sub;
7138 }
7139 }
7140  
7141 # without /r
7142 else {
7143 91 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $modifier =~ /g/mosx }) { } 23 68 91
7144 }
7145  
7146 # s///g without multibyte anchoring
7147 elsif ($modifier =~ /g/oxms) {
7148 23 ▶ $sub = sprintf(
Branch: 2 branches
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 3 20 23
$bind_operator =~ / !~ /mosx ? : 3 20 23
7149 # 1 2 3 4 5 6 7 8
7150 q<CORE::eval{local $Elatin9::re_n=0; while(%s =~ %s){%s local $^W=0; local $Elatin9::re_r=%s; %s%s="$`$Elatin9::re_r$'"; pos(%s)=length "$`$Elatin9::re_r"; $Elatin9::re_n++} return %s$Elatin9::re_n}>,
7151  
7152 $variable, # 1
7153 ($delimiter1 eq "'") ? # 2
7154 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
7155 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
7156 $s_matched, # 3
7157 $e_replacement, # 4
7158 '$Elatin9::re_r=CORE::eval $Elatin9::re_r; ' x $e_modifier, # 5
7159 $variable, # 6
7160 $variable, # 7
7161 ($bind_operator =~ / !~ /oxms) ? '!' : '', # 8
7162 );
7163 }
7164  
7165 # s///
7166 else {
7167  
7168 68 my $prematch = q{$`};
7169  
7170 68 ▶ $sub = sprintf(
Branch: 2 branches
BranchTrueFalseTotal
$bind_operator =~ / =~ /mosx ? : 65 3 68
$delimiter1 eq q['] ? : 18 50 68
7171  
7172 ($bind_operator =~ / =~ /oxms) ?
7173  
7174 # 1 2 3 4 5 6 7 8
7175 q<(%s%s%s) ? CORE::eval{%s local $^W=0; local $Elatin9::re_r=%s; %s%s="%s$Elatin9::re_r$'"; 1 } : undef> :
7176  
7177 # 1 2 3 4 5 6 7 8
7178 q<(%s%s%s) ? 1 : CORE::eval{%s local $^W=0; local $Elatin9::re_r=%s; %s%s="%s$Elatin9::re_r$'"; undef }>,
7179  
7180 $variable, # 1
7181 $bind_operator, # 2
7182 ($delimiter1 eq "'") ? # 3
7183 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
7184 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
7185 $s_matched, # 4
7186 $e_replacement, # 5
7187 '$Elatin9::re_r=CORE::eval $Elatin9::re_r; ' x $e_modifier, # 6
7188 $variable, # 7
7189 $prematch, # 8
7190 );
7191 }
7192 }
7193  
7194 # (my $foo = $bar) =~ s/// --> (my $foo = $bar, CORE::eval { ... })[1]
7195 101 ▶ if ($my ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($my ne "") 0 101 101
7196 0 $sub = "($my, $sub)[1]";
7197 }
7198  
7199 # clear s/// variable
7200 101 $sub_variable = '';
7201 101 $bind_operator = '';
7202  
7203 101 return $sub;
7204 }
7205  
7206 #
7207 # escape regexp of split qr//
7208 #
7209 74 ▶sub e_split {
Subroutine e_split: called CC=88 SCAR=76.4
Pod undocumented
7210 74 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
7211 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
7212  
7213 74 $modifier =~ tr/p//d;
7214 74 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 74 74
7215 0 my $line = 0;
7216 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7217 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
7218 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
7219 0 last;
7220 }
7221 }
7222 0 die qq{Unsupported modifier "$1" used at line $line.\n};
7223 }
7224  
7225 74 $slash = 'div';
7226  
7227 # /b /B modifier
7228 74 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) 0 74 74
7229 0 return join '', 'split', $ope, $delimiter, $string, $end_delimiter, $modifier;
7230 }
7231  
7232 74 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 74 74
7233 74 my $metachar = qr/[\@\\|[\]{^]/oxms;
7234  
7235 # split regexp
7236 74 my @char = $string =~ /\G((?>
7237 [^\\\$\@\[\(] |
7238 \\x (?>[0-9A-Fa-f]{1,2}) |
7239 \\ (?>[0-7]{2,3}) |
7240 \\c [\x40-\x5F] |
7241 \\x\{ (?>[0-9A-Fa-f]+) \} |
7242 \\o\{ (?>[0-7]+) \} |
7243 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
7244 \\ $q_char |
7245 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
7246 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
7247 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
7248 [\$\@] $qq_variable |
7249 \$ (?>\s* [0-9]+) |
7250 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
7251 \$ \$ (?![\w\{]) |
7252 \$ (?>\s*) \$ (?>\s*) $qq_variable |
7253 \[\^ |
7254 \[\: (?>[a-z]+) :\] |
7255 \[\:\^ (?>[a-z]+) :\] |
7256 \(\? |
7257 $q_char
7258 ))/oxmsg;
7259  
7260 74 my $left_e = 0;
7261 74 my $right_e = 0;
7262 74 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 249 74 323
7263  
7264 # "\L\u" --> "\u\L"
7265 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
7266 0 @char[$i,$i+1] = @char[$i+1,$i];
7267 }
7268  
7269 # "\U\l" --> "\l\U"
7270 ▶ 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
7271 0 @char[$i,$i+1] = @char[$i+1,$i];
7272 }
7273  
7274 # octal escape sequence
7275 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
7276 1 $char[$i] = Elatin9::octchr($1);
7277 }
7278  
7279 # hexadecimal escape sequence
7280 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
7281 1 $char[$i] = Elatin9::hexchr($1);
7282 }
7283  
7284 # \b{...} --> b\{...}
7285 # \B{...} --> B\{...}
7286 # \N{CHARNAME} --> N\{CHARNAME}
7287 # \p{PROPERTY} --> p\{PROPERTY}
7288 # \P{PROPERTY} --> P\{PROPERTY}
7289 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
7290 0 $char[$i] = $1 . '\\' . $2;
7291 }
7292  
7293 # \p, \P, \X --> p, P, X
7294 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
7295 0 $char[$i] = $1;
7296 }
7297  
7298 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 &Elatin9::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
7299 }
7300  
7301 # join separated multiple-octet
7302 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
7303 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 $Elatin9::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 $Elatin9::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 $Elatin9::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 $Elatin9::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 $Elatin9::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 $Elatin9::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 $Elatin9::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
7304 0 $char[$i] .= join '', splice @char, $i+1, 3;
7305 }
7306 ▶ 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 $Elatin9::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 $Elatin9::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 $Elatin9::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 $Elatin9::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
7307 0 $char[$i] .= join '', splice @char, $i+1, 2;
7308 }
7309 ▶ 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 $Elatin9::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 $Elatin9::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 $Elatin9::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 $Elatin9::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
7310 0 $char[$i] .= join '', splice @char, $i+1, 1;
7311 }
7312 }
7313  
7314 # open character class [...]
7315 elsif ($char[$i] eq '[') {
7316 3 my $left = $i;
7317 3 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 3 3
7318 0 $i++;
7319 }
7320 3 while (1) {
7321 7 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 7 7
7322 0 die __FILE__, ": Unmatched [] in regexp\n";
7323 }
7324 7 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 3 4 7
7325 3 my $right = $i;
7326  
7327 # [...]
7328 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
7329 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin9::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
7330 }
7331 else {
7332 3 splice @char, $left, $right-$left+1, Elatin9::charlist_qr(@char[$left+1..$right-1], $modifier);
7333 }
7334  
7335 3 $i = $left;
7336 3 last;
7337 }
7338 }
7339 }
7340  
7341 # open character class [^...]
7342 elsif ($char[$i] eq '[^') {
7343 0 my $left = $i;
7344 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7345 0 $i++;
7346 }
7347 0 while (1) {
7348 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7349 0 die __FILE__, ": Unmatched [] in regexp\n";
7350 }
7351 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7352 0 my $right = $i;
7353  
7354 # [^...]
7355 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
7356 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin9::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
7357 }
7358 else {
7359 0 splice @char, $left, $right-$left+1, Elatin9::charlist_not_qr(@char[$left+1..$right-1], $modifier);
7360 }
7361  
7362 0 $i = $left;
7363 0 last;
7364 }
7365 }
7366 }
7367  
7368 # rewrite character class or escape character
7369 elsif (my $char = character_class($char[$i],$modifier)) {
7370 1 $char[$i] = $char;
7371 }
7372  
7373 # P.794 29.2.161. split
7374 # in Chapter 29: Functions
7375 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
7376  
7377 # P.951 split
7378 # in Chapter 27: Functions
7379 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
7380  
7381 # said "The //m modifier is assumed when you split on the pattern /^/",
7382 # but perl5.008 is not so. Therefore, this software adds //m.
7383 # (and so on)
7384  
7385 # split(m/^/) --> split(m/^/m)
7386 ▶ 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
7387 7 $modifier .= 'm';
7388 }
7389  
7390 # /i modifier
7391 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin9::uc($char[$i]) ne Elatin9::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin9::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 &Elatin9::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin9::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= &Elatin9::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
7392 0 ▶ if (CORE::length(Elatin9::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
7393 0 $char[$i] = '[' . Elatin9::uc($char[$i]) . Elatin9::fc($char[$i]) . ']';
7394 }
7395 else {
7396 0 $char[$i] = '(?:' . Elatin9::uc($char[$i]) . '|' . Elatin9::fc($char[$i]) . ')';
7397 }
7398 }
7399  
7400 # \u \l \U \L \F \Q \E
7401 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
7402 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
7403 0 $char[$i] = '\\' . $char[$i];
7404 }
7405 }
7406 elsif ($char[$i] eq '\u') {
7407 0 $char[$i] = '@{[Elatin9::ucfirst qq<';
7408 0 $left_e++;
7409 }
7410 elsif ($char[$i] eq '\l') {
7411 0 $char[$i] = '@{[Elatin9::lcfirst qq<';
7412 0 $left_e++;
7413 }
7414 elsif ($char[$i] eq '\U') {
7415 0 $char[$i] = '@{[Elatin9::uc qq<';
7416 0 $left_e++;
7417 }
7418 elsif ($char[$i] eq '\L') {
7419 0 $char[$i] = '@{[Elatin9::lc qq<';
7420 0 $left_e++;
7421 }
7422 elsif ($char[$i] eq '\F') {
7423 0 $char[$i] = '@{[Elatin9::fc qq<';
7424 0 $left_e++;
7425 }
7426 elsif ($char[$i] eq '\Q') {
7427 0 $char[$i] = '@{[CORE::quotemeta qq<';
7428 0 $left_e++;
7429 }
7430 elsif ($char[$i] eq '\E') {
7431 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
7432 0 $char[$i] = '>]}';
7433 0 $right_e++;
7434 }
7435 else {
7436 0 $char[$i] = '';
7437 }
7438 }
7439 elsif ($char[$i] eq '\Q') {
7440 0 while (1) {
7441 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7442 0 last;
7443 }
7444 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
7445 0 last;
7446 }
7447 }
7448 }
7449 elsif ($char[$i] eq '\E') {
7450 }
7451  
7452 # $0 --> $0
7453 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
7454 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7455 0 $char[$i] = '@{[Elatin9::ignorecase(' . $char[$i] . ')]}';
7456 }
7457 }
7458 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
7459 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7460 0 $char[$i] = '@{[Elatin9::ignorecase(' . $char[$i] . ')]}';
7461 }
7462 }
7463  
7464 # $$ --> $$
7465 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
7466 }
7467  
7468 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
7469 # $1, $2, $3 --> $1, $2, $3 otherwise
7470 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
7471 0 $char[$i] = e_capture($1);
7472 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7473 0 $char[$i] = '@{[Elatin9::ignorecase(' . $char[$i] . ')]}';
7474 }
7475 }
7476 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
7477 0 $char[$i] = e_capture($1);
7478 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7479 0 $char[$i] = '@{[Elatin9::ignorecase(' . $char[$i] . ')]}';
7480 }
7481 }
7482  
7483 # $$foo[ ... ] --> $ $foo->[ ... ]
7484 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
7485 0 $char[$i] = e_capture($1.'->'.$2);
7486 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7487 0 $char[$i] = '@{[Elatin9::ignorecase(' . $char[$i] . ')]}';
7488 }
7489 }
7490  
7491 # $$foo{ ... } --> $ $foo->{ ... }
7492 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
7493 0 $char[$i] = e_capture($1.'->'.$2);
7494 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7495 0 $char[$i] = '@{[Elatin9::ignorecase(' . $char[$i] . ')]}';
7496 }
7497 }
7498  
7499 # $$foo
7500 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-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] = '@{[Elatin9::ignorecase(' . $char[$i] . ')]}';
7504 }
7505 }
7506  
7507 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin9::PREMATCH()
7508 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
7509 12 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 12 12
7510 0 $char[$i] = '@{[Elatin9::ignorecase(Elatin9::PREMATCH())]}';
7511 }
7512 else {
7513 12 $char[$i] = '@{[Elatin9::PREMATCH()]}';
7514 }
7515 }
7516  
7517 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin9::MATCH()
7518 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
7519 12 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 12 12
7520 0 $char[$i] = '@{[Elatin9::ignorecase(Elatin9::MATCH())]}';
7521 }
7522 else {
7523 12 $char[$i] = '@{[Elatin9::MATCH()]}';
7524 }
7525 }
7526  
7527 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin9::POSTMATCH()
7528 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
7529 9 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 9 9
7530 0 $char[$i] = '@{[Elatin9::ignorecase(Elatin9::POSTMATCH())]}';
7531 }
7532 else {
7533 9 $char[$i] = '@{[Elatin9::POSTMATCH()]}';
7534 }
7535 }
7536  
7537 # ${ foo }
7538 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
7539 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7540 0 $char[$i] = '@{[Elatin9::ignorecase(' . $1 . ')]}';
7541 }
7542 }
7543  
7544 # ${ ... }
7545 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
7546 0 $char[$i] = e_capture($1);
7547 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7548 0 $char[$i] = '@{[Elatin9::ignorecase(' . $char[$i] . ')]}';
7549 }
7550 }
7551  
7552 # $scalar or @array
7553 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
7554 3 $char[$i] = e_string($char[$i]);
7555 3 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 3 3
7556 0 $char[$i] = '@{[Elatin9::ignorecase(' . $char[$i] . ')]}';
7557 }
7558 }
7559  
7560 # quote character before ? + * {
7561 ▶ 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
7562 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
7563 }
7564 else {
7565 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
7566 }
7567 }
7568 }
7569  
7570 # make regexp string
7571 74 $modifier =~ tr/i//d;
7572 74 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 74 74
7573 0 return join '', 'Elatin9::split', $ope, $delimiter, @char, '>]}' x ($left_e - $right_e), $end_delimiter, $modifier;
7574 }
7575 74 return join '', 'Elatin9::split', $ope, $delimiter, @char, $end_delimiter, $modifier;
7576 }
7577  
7578 #
7579 # escape regexp of split qr''
7580 #
7581 0 ▶sub e_split_q {
Subroutine e_split_q: not called CC=26 SCAR=65.5
Pod undocumented
7582 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
7583 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
7584  
7585 0 $modifier =~ tr/p//d;
7586 0 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 0 0
7587 0 my $line = 0;
7588 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7589 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
7590 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
7591 0 last;
7592 }
7593 }
7594 0 die qq{Unsupported modifier "$1" used at line $line.\n};
7595 }
7596  
7597 0 $slash = 'div';
7598  
7599 # /b /B modifier
7600 0 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) 0 0 0
7601 0 return join '', 'split', $ope, $delimiter, $string, $end_delimiter, $modifier;
7602 }
7603  
7604 0 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 0 0
7605  
7606 # split regexp
7607 0 my @char = $string =~ /\G((?>
7608 [^\\\[] |
7609 [\x00-\xFF] |
7610 \[\^ |
7611 \[\: (?>[a-z]+) \:\] |
7612 \[\:\^ (?>[a-z]+) \:\] |
7613 \\ (?:$q_char) |
7614 (?:$q_char)
7615 ))/oxmsg;
7616  
7617 # unescape character
7618 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
7619 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 &Elatin9::uc($char[$i]) ne &fc($char[$i])) { } 0 0 0
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 0 0
7620 }
7621  
7622 # open character class [...]
7623 elsif ($char[$i] eq '[') {
7624 0 my $left = $i;
7625 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7626 0 $i++;
7627 }
7628 0 while (1) {
7629 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7630 0 die __FILE__, ": Unmatched [] in regexp\n";
7631 }
7632 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7633 0 my $right = $i;
7634  
7635 # [...]
7636 0 splice @char, $left, $right-$left+1, Elatin9::charlist_qr(@char[$left+1..$right-1], $modifier);
7637  
7638 0 $i = $left;
7639 0 last;
7640 }
7641 }
7642 }
7643  
7644 # open character class [^...]
7645 elsif ($char[$i] eq '[^') {
7646 0 my $left = $i;
7647 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7648 0 $i++;
7649 }
7650 0 while (1) {
7651 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7652 0 die __FILE__, ": Unmatched [] in regexp\n";
7653 }
7654 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7655 0 my $right = $i;
7656  
7657 # [^...]
7658 0 splice @char, $left, $right-$left+1, Elatin9::charlist_not_qr(@char[$left+1..$right-1], $modifier);
7659  
7660 0 $i = $left;
7661 0 last;
7662 }
7663 }
7664 }
7665  
7666 # rewrite character class or escape character
7667 elsif (my $char = character_class($char[$i],$modifier)) {
7668 0 $char[$i] = $char;
7669 }
7670  
7671 # split(m/^/) --> split(m/^/m)
7672 ▶ 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
7673 0 $modifier .= 'm';
7674 }
7675  
7676 # /i modifier
7677 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin9::uc($char[$i]) ne Elatin9::fc($char[$i]))) {
Condition0%0/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin9::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 &Elatin9::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin9::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= &Elatin9::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
7678 0 ▶ if (CORE::length(Elatin9::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
7679 0 $char[$i] = '[' . Elatin9::uc($char[$i]) . Elatin9::fc($char[$i]) . ']';
7680 }
7681 else {
7682 0 $char[$i] = '(?:' . Elatin9::uc($char[$i]) . '|' . Elatin9::fc($char[$i]) . ')';
7683 }
7684 }
7685  
7686 # quote character before ? + * {
7687 ▶ 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
7688 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
7689 }
7690 else {
7691 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
7692 }
7693 }
7694 }
7695  
7696 0 $modifier =~ tr/i//d;
7697 0 return join '', 'Elatin9::split', $ope, $delimiter, @char, $end_delimiter, $modifier;
7698 }
7699  
7700 #
7701 # instead of Carp::carp
7702 #
7703 0 ▶sub carp {
Subroutine carp: not called CC=1 SCAR=6.9
Pod undocumented
7704 0 my($package,$filename,$line) = caller(1);
7705 0 print STDERR "@_ at $filename line $line.\n";
7706 }
7707  
7708 #
7709 # instead of Carp::croak
7710 #
7711 0 ▶sub croak {
Subroutine croak: not called CC=1 SCAR=6.9
Pod undocumented
7712 0 my($package,$filename,$line) = caller(1);
7713 0 print STDERR "@_ at $filename line $line.\n";
7714 0 die "\n";
7715 }
7716  
7717 #
7718 # instead of Carp::cluck
7719 #
7720 0 ▶sub cluck {
Subroutine cluck: not called CC=2 SCAR=17.9
Pod undocumented
7721 0 my $i = 0;
7722 0 my @cluck = ();
7723 0 ▶ while (my($package,$filename,$line,$subroutine) = caller($i)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7724 0 push @cluck, "[$i] $filename($line) $package::$subroutine\n";
7725 0 $i++;
7726 }
7727 0 print STDERR CORE::reverse @cluck;
7728 0 print STDERR "\n";
7729 0 print STDERR @_;
7730 }
7731  
7732 #
7733 # instead of Carp::confess
7734 #
7735 0 ▶sub confess {
Subroutine confess: not called CC=2 SCAR=17.9
Pod undocumented
7736 0 my $i = 0;
7737 0 my @confess = ();
7738 0 ▶ while (my($package,$filename,$line,$subroutine) = caller($i)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7739 0 push @confess, "[$i] $filename($line) $package::$subroutine\n";
7740 0 $i++;
7741 }
7742 0 print STDERR CORE::reverse @confess;
7743 0 print STDERR "\n";
7744 0 print STDERR @_;
7745 0 die "\n";
7746 }
7747  
7748 422 1;
7749  
7750 __END__
↑ Summary blib/lib/Latin9.pm »