Elatin3.pm

filter: Statementstmt 43.6% 1312 / 3009 Branchbran 40.7% 1063 / 2608 Conditioncond 31.0% 115 / 370 MC/DCmcdc 15.9% 35 / 220 Subroutinesub 68.9% 111 / 161 Podpod 4.6% 3 / 64 totaltotal 41.0% 2639 / 6432 CC 1475 SCAR 97.8
CC
1475
Cov
42%
escape_token
55669.4
e_s1
3320.4
e_split
2070.1
CRAP 17630.0
↑ Summary Latin3.pm »
1 package Elatin3;
2 425 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 425 ▶BEGIN { $INC{'warnings.pm'} = '' if $] < 5.006 } use warnings;
Subroutine BEGIN: called CC=2 SCAR=7.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
if $] < "5.006" 0 424 424
4 ######################################################################
5 #
6 # Elatin3 - Run-time routines for Latin3.pm
7 #
8 # http://search.cpan.org/dist/Char-Latin3/
9 #
10 # Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2018, 2019 INABA Hitoshi <ina@cpan.org>
11 ######################################################################
12  
13 425 ▶use 5.00503; # Galapagos Consensus 1998 for primetools
Subroutine BEGIN: called CC=1 SCAR=0.0
14 # use 5.008001; # Lancaster Consensus 2013 for toolchains
15  
16 # 12.3. Delaying use Until Runtime
17 # in Chapter 12. Packages, Libraries, and Modules
18 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
19 # (and so on)
20  
21 # Version numbers should be boring
22 # http://www.dagolden.com/index.php/369/version-numbers-should-be-boring/
23 # For the impatient, the disinterested or those who just want to follow
24 # a recipe, my advice for all modules is this:
25 # our $VERSION = "0.001"; # or "0.001_001" for a dev release
26 # $VERSION = eval $VERSION; # No!! because '1.10' makes '1.1'
27  
28 425 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
29 424 $VERSION = '1.22';
30 424 $VERSION = $VERSION;
31  
32 424 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=7.0
33 425 ▶ if ($^X =~ / jperl /oxmsi) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^X =~ / jperl /imosx) 0 424 424
34 1 die __FILE__, ": needs perl(not jperl) 5.00503 or later. (\$^X==$^X)\n";
35 }
36 425 if (CORE::ord('A') == 193) {
37 die __FILE__, ": is not US-ASCII script (may be EBCDIC or EBCDIK script).\n";
38 }
39 424 if (CORE::ord('A') != 0x41) {
40 die __FILE__, ": is not US-ASCII script (must be US-ASCII script).\n";
41 }
42 }
43  
44 424 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=9.5
45  
46 # instead of utf8.pm
47 424 ▶ CORE::eval q{
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
48 no warnings qw(redefine);
49 *utf8::upgrade = sub { CORE::length $_[0] };
50 *utf8::downgrade = sub { 1 };
51 *utf8::encode = sub { };
52 *utf8::decode = sub { 1 };
53 *utf8::is_utf8 = sub { };
54 *utf8::valid = sub { 1 };
55 };
56 424 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 424 424
57 0 ▶ *utf8::upgrade = sub { CORE::length $_[0] };
Subroutine __ANON__: not called CC=1 SCAR=6.9
58 0 ▶ *utf8::downgrade = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
59 0 ▶ *utf8::encode = sub { };
Subroutine __ANON__: not called CC=1 SCAR=6.9
60 0 ▶ *utf8::decode = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
61 0 ▶ *utf8::is_utf8 = sub { };
Subroutine __ANON__: not called CC=1 SCAR=6.9
62 0 ▶ *utf8::valid = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
63 }
64 }
65  
66 # instead of Symbol.pm
67 BEGIN {
68 0 ▶ sub gensym () {
Subroutine gensym: not called CC=2 SCAR=17.9
Pod undocumented
69 0 ▶ if ($] < 5.006) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] < 5.006) { } 0 0 0
70 0 return \do { local *_ };
71 }
72 else {
73 0 return undef;
74 }
75 }
76  
77 20 ▶ sub qualify ($$) {
Subroutine qualify: called CC=8 SCAR=28.9
Pod undocumented
78 20 my($name) = @_;
79  
80 20 ▶ if (ref $name) {
Branch: 7 branches
BranchTrueFalseTotal
if (ref $name) { } 5 15 20
elsif (&Elatin3::index($name, '::') >= 0) { } 0 15 15
elsif (&Elatin3::index($name, q[']) >= 0) { } 0 15 15
elsif ($name =~ /\A \^ [ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]+ \z/x) { } 0 15 15
elsif ($name =~ /\A (?: ARGV | ARGVOUT | ENV | INC | SIG | STDERR | STDIN | STDOUT ) \z/x) { } 0 15 15
elsif ($name =~ /\A [^ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz] \z/x) { } 0 15 15
elsif (defined $_[1]) { } 15 0 15
81 5 return $name;
82 }
83 elsif (Elatin3::index($name,'::') >= 0) {
84 0 return $name;
85 }
86 elsif (Elatin3::index($name,"'") >= 0) {
87 0 return $name;
88 }
89  
90 # special character, "^xyz"
91 elsif ($name =~ /\A \^ [ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]+ \z/x) {
92  
93 # RGS 2001-11-05 : translate leading ^X to control-char
94 0 $name =~ s{\A \^ ([ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]) }{'qq(\c'.$1.')'}xee;
95 0 return 'main::' . $name;
96 }
97  
98 # Global names
99 elsif ($name =~ /\A (?: ARGV | ARGVOUT | ENV | INC | SIG | STDERR | STDIN | STDOUT ) \z/x) {
100 0 return 'main::' . $name;
101 }
102  
103 # or other
104 elsif ($name =~ /\A [^ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz] \z/x) {
105 0 return 'main::' . $name;
106 }
107  
108 elsif (defined $_[1]) {
109 15 return $_[1] . '::' . $name;
110 }
111 else {
112 0 return (caller)[0] . '::' . $name;
113 }
114 }
115  
116 20 ▶ sub qualify_to_ref ($;$) {
Subroutine qualify_to_ref: called CC=2 SCAR=7.2
Pod undocumented
117 20 ▶ if (defined $_[1]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[1]) { } 20 0 20
118 424 ▶ no strict qw(refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
119 20 return \*{ qualify $_[0], $_[1] };
120 }
121 else {
122 424 ▶ no strict qw(refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: not called CC=1 SCAR=0.0
123 0 return \*{ qualify $_[0], (caller)[0] };
124 }
125 }
126 }
127  
128 # P.714 29.2.39. flock
129 # in Chapter 29: Functions
130 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
131  
132 # P.863 flock
133 # in Chapter 27: Functions
134 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
135  
136 sub LOCK_SH() {1}
137 sub LOCK_EX() {2}
138 sub LOCK_UN() {8}
139 sub LOCK_NB() {4}
140  
141 # instead of Carp.pm
142 sub carp;
143 sub croak;
144 sub cluck;
145 sub confess;
146  
147 # 6.18. Matching Multiple-Byte Characters
148 # in Chapter 6. Pattern Matching
149 # of ISBN 978-1-56592-243-3 Perl Perl Cookbook.
150 # (and so on)
151  
152 # regexp of character
153 424 my $your_char = q{[\x00-\xFF]};
154 424 ▶use vars qw($qq_char); $qq_char = qr/\\c[\x40-\x5F]|\\?(?:$your_char)/oxms;
Subroutine BEGIN: called CC=1 SCAR=0.0
155 424 ▶use vars qw($q_char); $q_char = qr/$your_char/oxms;
Subroutine BEGIN: called CC=1 SCAR=0.0
156  
157 #
158 # Latin-3 character range per length
159 #
160 424 my %range_tr = ();
161  
162 #
163 # Latin-3 case conversion
164 #
165 424 my %lc = ();
166 424 @lc{qw(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)} =
167 qw(a b c d e f g h i j k l m n o p q r s t u v w x y z);
168 424 my %uc = ();
169 424 @uc{qw(a b c d e f g h i j k l m n o p q r s t u v w x y z)} =
170 qw(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z);
171 424 my %fc = ();
172 424 @fc{qw(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)} =
173 qw(a b c d e f g h i j k l m n o p q r s t u v w x y z);
174  
175 424 ▶if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { __PACKAGE__ =~ / \b Elatin3 \z/mosx }) { } 424 0 424
176 }
177  
178 elsif (__PACKAGE__ =~ / \b Elatin3 \z/oxms) {
179 424 %range_tr = (
180 1 => [ [0x00..0xFF],
181 ],
182 );
183  
184 424 %lc = (%lc,
185 "\xA1" => "\xB1", # LATIN LETTER H WITH STROKE
186 "\xA6" => "\xB6", # LATIN LETTER H WITH CIRCUMFLEX
187 "\xAA" => "\xBA", # LATIN LETTER S WITH CEDILLA
188 "\xAB" => "\xBB", # LATIN LETTER G WITH BREVE
189 "\xAC" => "\xBC", # LATIN LETTER J WITH CIRCUMFLEX
190 "\xAF" => "\xBF", # LATIN LETTER Z WITH DOT ABOVE
191 "\xC0" => "\xE0", # LATIN LETTER A WITH GRAVE
192 "\xC1" => "\xE1", # LATIN LETTER A WITH ACUTE
193 "\xC2" => "\xE2", # LATIN LETTER A WITH CIRCUMFLEX
194 "\xC4" => "\xE4", # LATIN LETTER A WITH DIAERESIS
195 "\xC5" => "\xE5", # LATIN LETTER C WITH DOT ABOVE
196 "\xC6" => "\xE6", # LATIN LETTER C WITH CIRCUMFLEX
197 "\xC7" => "\xE7", # LATIN LETTER C WITH CEDILLA
198 "\xC8" => "\xE8", # LATIN LETTER E WITH GRAVE
199 "\xC9" => "\xE9", # LATIN LETTER E WITH ACUTE
200 "\xCA" => "\xEA", # LATIN LETTER E WITH CIRCUMFLEX
201 "\xCB" => "\xEB", # LATIN LETTER E WITH DIAERESIS
202 "\xCC" => "\xEC", # LATIN LETTER I WITH GRAVE
203 "\xCD" => "\xED", # LATIN LETTER I WITH ACUTE
204 "\xCE" => "\xEE", # LATIN LETTER I WITH CIRCUMFLEX
205 "\xCF" => "\xEF", # LATIN LETTER I WITH DIAERESIS
206 "\xD1" => "\xF1", # LATIN LETTER N WITH TILDE
207 "\xD2" => "\xF2", # LATIN LETTER O WITH GRAVE
208 "\xD3" => "\xF3", # LATIN LETTER O WITH ACUTE
209 "\xD4" => "\xF4", # LATIN LETTER O WITH CIRCUMFLEX
210 "\xD5" => "\xF5", # LATIN LETTER G WITH DOT ABOVE
211 "\xD6" => "\xF6", # LATIN LETTER O WITH DIAERESIS
212 "\xD8" => "\xF8", # LATIN LETTER G WITH CIRCUMFLEX
213 "\xD9" => "\xF9", # LATIN LETTER U WITH GRAVE
214 "\xDA" => "\xFA", # LATIN LETTER U WITH ACUTE
215 "\xDB" => "\xFB", # LATIN LETTER U WITH CIRCUMFLEX
216 "\xDC" => "\xFC", # LATIN LETTER U WITH DIAERESIS
217 "\xDD" => "\xFD", # LATIN LETTER U WITH BREVE
218 "\xDE" => "\xFE", # LATIN LETTER S WITH CIRCUMFLEX
219 );
220  
221 424 %uc = (%uc,
222 "\xB1" => "\xA1", # LATIN LETTER H WITH STROKE
223 "\xB6" => "\xA6", # LATIN LETTER H WITH CIRCUMFLEX
224 "\xBA" => "\xAA", # LATIN LETTER S WITH CEDILLA
225 "\xBB" => "\xAB", # LATIN LETTER G WITH BREVE
226 "\xBC" => "\xAC", # LATIN LETTER J WITH CIRCUMFLEX
227 "\xBF" => "\xAF", # LATIN LETTER Z WITH DOT ABOVE
228 "\xE0" => "\xC0", # LATIN LETTER A WITH GRAVE
229 "\xE1" => "\xC1", # LATIN LETTER A WITH ACUTE
230 "\xE2" => "\xC2", # LATIN LETTER A WITH CIRCUMFLEX
231 "\xE4" => "\xC4", # LATIN LETTER A WITH DIAERESIS
232 "\xE5" => "\xC5", # LATIN LETTER C WITH DOT ABOVE
233 "\xE6" => "\xC6", # LATIN LETTER C WITH CIRCUMFLEX
234 "\xE7" => "\xC7", # LATIN LETTER C WITH CEDILLA
235 "\xE8" => "\xC8", # LATIN LETTER E WITH GRAVE
236 "\xE9" => "\xC9", # LATIN LETTER E WITH ACUTE
237 "\xEA" => "\xCA", # LATIN LETTER E WITH CIRCUMFLEX
238 "\xEB" => "\xCB", # LATIN LETTER E WITH DIAERESIS
239 "\xEC" => "\xCC", # LATIN LETTER I WITH GRAVE
240 "\xED" => "\xCD", # LATIN LETTER I WITH ACUTE
241 "\xEE" => "\xCE", # LATIN LETTER I WITH CIRCUMFLEX
242 "\xEF" => "\xCF", # LATIN LETTER I WITH DIAERESIS
243 "\xF1" => "\xD1", # LATIN LETTER N WITH TILDE
244 "\xF2" => "\xD2", # LATIN LETTER O WITH GRAVE
245 "\xF3" => "\xD3", # LATIN LETTER O WITH ACUTE
246 "\xF4" => "\xD4", # LATIN LETTER O WITH CIRCUMFLEX
247 "\xF5" => "\xD5", # LATIN LETTER G WITH DOT ABOVE
248 "\xF6" => "\xD6", # LATIN LETTER O WITH DIAERESIS
249 "\xF8" => "\xD8", # LATIN LETTER G WITH CIRCUMFLEX
250 "\xF9" => "\xD9", # LATIN LETTER U WITH GRAVE
251 "\xFA" => "\xDA", # LATIN LETTER U WITH ACUTE
252 "\xFB" => "\xDB", # LATIN LETTER U WITH CIRCUMFLEX
253 "\xFC" => "\xDC", # LATIN LETTER U WITH DIAERESIS
254 "\xFD" => "\xDD", # LATIN LETTER U WITH BREVE
255 "\xFE" => "\xDE", # LATIN LETTER S WITH CIRCUMFLEX
256 );
257  
258 424 %fc = (%fc,
259 "\xA1" => "\xB1", # LATIN CAPITAL LETTER H WITH STROKE --> LATIN SMALL LETTER H WITH STROKE
260 "\xA6" => "\xB6", # LATIN CAPITAL LETTER H WITH CIRCUMFLEX --> LATIN SMALL LETTER H WITH CIRCUMFLEX
261  
262 # CaseFolding-6.1.0.txt
263 # Date: 2011-07-25, 21:21:56 GMT [MD]
264 #
265 # T: special case for uppercase I and dotted uppercase I
266 # - For non-Turkic languages, this mapping is normally not used.
267 # - For Turkic languages (tr, az), this mapping can be used instead of the normal mapping for these characters.
268 # Note that the Turkic mappings do not maintain canonical equivalence without additional processing.
269 # See the discussions of case mapping in the Unicode Standard for more information.
270  
271 #-------------------------------------------------------------------------------
272 "\xA9" => "\x69", # LATIN CAPITAL LETTER I WITH DOT ABOVE
273 # --> LATIN SMALL LETTER I (without COMBINING DOT ABOVE)
274 #-------------------------------------------------------------------------------
275  
276 "\xAA" => "\xBA", # LATIN CAPITAL LETTER S WITH CEDILLA --> LATIN SMALL LETTER S WITH CEDILLA
277 "\xAB" => "\xBB", # LATIN CAPITAL LETTER G WITH BREVE --> LATIN SMALL LETTER G WITH BREVE
278 "\xAC" => "\xBC", # LATIN CAPITAL LETTER J WITH CIRCUMFLEX --> LATIN SMALL LETTER J WITH CIRCUMFLEX
279 "\xAF" => "\xBF", # LATIN CAPITAL LETTER Z WITH DOT ABOVE --> LATIN SMALL LETTER Z WITH DOT ABOVE
280 "\xC0" => "\xE0", # LATIN CAPITAL LETTER A WITH GRAVE --> LATIN SMALL LETTER A WITH GRAVE
281 "\xC1" => "\xE1", # LATIN CAPITAL LETTER A WITH ACUTE --> LATIN SMALL LETTER A WITH ACUTE
282 "\xC2" => "\xE2", # LATIN CAPITAL LETTER A WITH CIRCUMFLEX --> LATIN SMALL LETTER A WITH CIRCUMFLEX
283 "\xC4" => "\xE4", # LATIN CAPITAL LETTER A WITH DIAERESIS --> LATIN SMALL LETTER A WITH DIAERESIS
284 "\xC5" => "\xE5", # LATIN CAPITAL LETTER C WITH DOT ABOVE --> LATIN SMALL LETTER C WITH DOT ABOVE
285 "\xC6" => "\xE6", # LATIN CAPITAL LETTER C WITH CIRCUMFLEX --> LATIN SMALL LETTER C WITH CIRCUMFLEX
286 "\xC7" => "\xE7", # LATIN CAPITAL LETTER C WITH CEDILLA --> LATIN SMALL LETTER C WITH CEDILLA
287 "\xC8" => "\xE8", # LATIN CAPITAL LETTER E WITH GRAVE --> LATIN SMALL LETTER E WITH GRAVE
288 "\xC9" => "\xE9", # LATIN CAPITAL LETTER E WITH ACUTE --> LATIN SMALL LETTER E WITH ACUTE
289 "\xCA" => "\xEA", # LATIN CAPITAL LETTER E WITH CIRCUMFLEX --> LATIN SMALL LETTER E WITH CIRCUMFLEX
290 "\xCB" => "\xEB", # LATIN CAPITAL LETTER E WITH DIAERESIS --> LATIN SMALL LETTER E WITH DIAERESIS
291 "\xCC" => "\xEC", # LATIN CAPITAL LETTER I WITH GRAVE --> LATIN SMALL LETTER I WITH GRAVE
292 "\xCD" => "\xED", # LATIN CAPITAL LETTER I WITH ACUTE --> LATIN SMALL LETTER I WITH ACUTE
293 "\xCE" => "\xEE", # LATIN CAPITAL LETTER I WITH CIRCUMFLEX --> LATIN SMALL LETTER I WITH CIRCUMFLEX
294 "\xCF" => "\xEF", # LATIN CAPITAL LETTER I WITH DIAERESIS --> LATIN SMALL LETTER I WITH DIAERESIS
295 "\xD1" => "\xF1", # LATIN CAPITAL LETTER N WITH TILDE --> LATIN SMALL LETTER N WITH TILDE
296 "\xD2" => "\xF2", # LATIN CAPITAL LETTER O WITH GRAVE --> LATIN SMALL LETTER O WITH GRAVE
297 "\xD3" => "\xF3", # LATIN CAPITAL LETTER O WITH ACUTE --> LATIN SMALL LETTER O WITH ACUTE
298 "\xD4" => "\xF4", # LATIN CAPITAL LETTER O WITH CIRCUMFLEX --> LATIN SMALL LETTER O WITH CIRCUMFLEX
299 "\xD5" => "\xF5", # LATIN CAPITAL LETTER G WITH DOT ABOVE --> LATIN SMALL LETTER G WITH DOT ABOVE
300 "\xD6" => "\xF6", # LATIN CAPITAL LETTER O WITH DIAERESIS --> LATIN SMALL LETTER O WITH DIAERESIS
301 "\xD8" => "\xF8", # LATIN CAPITAL LETTER G WITH CIRCUMFLEX --> LATIN SMALL LETTER G WITH CIRCUMFLEX
302 "\xD9" => "\xF9", # LATIN CAPITAL LETTER U WITH GRAVE --> LATIN SMALL LETTER U WITH GRAVE
303 "\xDA" => "\xFA", # LATIN CAPITAL LETTER U WITH ACUTE --> LATIN SMALL LETTER U WITH ACUTE
304 "\xDB" => "\xFB", # LATIN CAPITAL LETTER U WITH CIRCUMFLEX --> LATIN SMALL LETTER U WITH CIRCUMFLEX
305 "\xDC" => "\xFC", # LATIN CAPITAL LETTER U WITH DIAERESIS --> LATIN SMALL LETTER U WITH DIAERESIS
306 "\xDD" => "\xFD", # LATIN CAPITAL LETTER U WITH BREVE --> LATIN SMALL LETTER U WITH BREVE
307 "\xDE" => "\xFE", # LATIN CAPITAL LETTER S WITH CIRCUMFLEX --> LATIN SMALL LETTER S WITH CIRCUMFLEX
308 "\xDF" => "\x73\x73", # LATIN SMALL LETTER SHARP S --> LATIN SMALL LETTER S, LATIN SMALL LETTER S
309 );
310 }
311  
312 else {
313 0 croak "Don't know my package name '@{[__PACKAGE__]}'";
314 }
315  
316 #
317 # @ARGV wildcard globbing
318 #
319 212 ▶sub import {
Subroutine import: called CC=7 SCAR=28.3
320  
321 212 ▶ if ($^O =~ /\A (?: MSWin32 | NetWare | symbian | dos ) \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O =~ /\A (?: MSWin32 | NetWare | symbian | dos ) \z/mosx) 0 212 212
322 0 my @argv = ();
323 0 for (@ARGV) {
324  
325 # has space
326 0 ▶ if (/\A (?:$q_char)*? [ ] /oxms) {
Branch: 2 branches
BranchTrueFalseTotal
if (/\A (?:$Elatin3::q_char)*? [ ] /mosx) { } 0 0 0
elsif (/\A (?:$Elatin3::q_char)*? [*?] /mosx) { } 0 0 0
327 0 ▶ if (my @glob = Elatin3::glob(qq{"$_"})) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@glob) = &Elatin3::glob(qq["$_"])) { } 0 0 0
328 0 push @argv, @glob;
329 }
330 else {
331 0 push @argv, $_;
332 }
333 }
334  
335 # has wildcard metachar
336 elsif (/\A (?:$q_char)*? [*?] /oxms) {
337 0 ▶ if (my @glob = Elatin3::glob($_)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@glob) = &Elatin3::glob($_)) { } 0 0 0
338 0 push @argv, @glob;
339 }
340 else {
341 0 push @argv, $_;
342 }
343 }
344  
345 # no wildcard globbing
346 else {
347 0 push @argv, $_;
348 }
349 }
350 0 @ARGV = @argv;
351 }
352  
353 212 *Char::ord = \&Latin3::ord;
354 212 *Char::ord_ = \&Latin3::ord_;
355 212 *Char::reverse = \&Latin3::reverse;
356 212 *Char::getc = \&Latin3::getc;
357 212 *Char::length = \&Latin3::length;
358 212 *Char::substr = \&Latin3::substr;
359 212 *Char::index = \&Latin3::index;
360 212 *Char::rindex = \&Latin3::rindex;
361 212 *Char::eval = \&Latin3::eval;
362 212 *Char::escape = \&Latin3::escape;
363 212 *Char::escape_token = \&Latin3::escape_token;
364 212 *Char::escape_script = \&Latin3::escape_script;
365 }
366  
367 # P.230 Care with Prototypes
368 # in Chapter 6: Subroutines
369 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
370 #
371 # If you aren't careful, you can get yourself into trouble with prototypes.
372 # But if you are careful, you can do a lot of neat things with them. This is
373 # all very powerful, of course, and should only be used in moderation to make
374 # the world a better place.
375  
376 # P.332 Care with Prototypes
377 # in Chapter 7: Subroutines
378 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
379 #
380 # If you aren't careful, you can get yourself into trouble with prototypes.
381 # But if you are careful, you can do a lot of neat things with them. This is
382 # all very powerful, of course, and should only be used in moderation to make
383 # the world a better place.
384  
385 #
386 # Prototypes of subroutines
387 #
388 0 ▶sub unimport {}
Subroutine unimport: not called CC=1 SCAR=0.0
389 sub Elatin3::split(;$$$);
390 sub Elatin3::tr($$$$;$);
391 sub Elatin3::chop(@);
392 sub Elatin3::index($$;$);
393 sub Elatin3::rindex($$;$);
394 sub Elatin3::lcfirst(@);
395 sub Elatin3::lcfirst_();
396 sub Elatin3::lc(@);
397 sub Elatin3::lc_();
398 sub Elatin3::ucfirst(@);
399 sub Elatin3::ucfirst_();
400 sub Elatin3::uc(@);
401 sub Elatin3::uc_();
402 sub Elatin3::fc(@);
403 sub Elatin3::fc_();
404 sub Elatin3::ignorecase;
405 sub Elatin3::classic_character_class;
406 sub Elatin3::capture;
407 sub Elatin3::chr(;$);
408 sub Elatin3::chr_();
409 sub Elatin3::glob($);
410 sub Elatin3::glob_();
411  
412 sub Latin3::ord(;$);
413 sub Latin3::ord_();
414 sub Latin3::reverse(@);
415 sub Latin3::getc(;*@);
416 sub Latin3::length(;$);
417 sub Latin3::substr($$;$$);
418 sub Latin3::index($$;$);
419 sub Latin3::rindex($$;$);
420 sub Latin3::escape(;$);
421  
422 #
423 # Regexp work
424 #
425 424 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
426 $re_a
427 $re_t
428 $re_n
429 $re_r
430 424 );
431  
432 #
433 # Character class
434 #
435 424 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
436 $dot
437 $dot_s
438 $eD
439 $eS
440 $eW
441 $eH
442 $eV
443 $eR
444 $eN
445 $not_alnum
446 $not_alpha
447 $not_ascii
448 $not_blank
449 $not_cntrl
450 $not_digit
451 $not_graph
452 $not_lower
453 $not_lower_i
454 $not_print
455 $not_punct
456 $not_space
457 $not_upper
458 $not_upper_i
459 $not_word
460 $not_xdigit
461 $eb
462 $eB
463 424 );
464  
465 424 ${Elatin3::dot} = qr{(?>[^\x0A])};
466 424 ${Elatin3::dot_s} = qr{(?>[\x00-\xFF])};
467 424 ${Elatin3::eD} = qr{(?>[^0-9])};
468  
469 # Vertical tabs are now whitespace
470 # \s in a regex now matches a vertical tab in all circumstances.
471 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
472 # ${Elatin3::eS} = qr{(?>[^\x09\x0A \x0C\x0D\x20])};
473 # ${Elatin3::eS} = qr{(?>[^\x09\x0A\x0B\x0C\x0D\x20])};
474 424 ${Elatin3::eS} = qr{(?>[^\s])};
475  
476 424 ${Elatin3::eW} = qr{(?>[^0-9A-Z_a-z])};
477 424 ${Elatin3::eH} = qr{(?>[^\x09\x20])};
478 424 ${Elatin3::eV} = qr{(?>[^\x0A\x0B\x0C\x0D])};
479 424 ${Elatin3::eR} = qr{(?>\x0D\x0A|[\x0A\x0D])};
480 424 ${Elatin3::eN} = qr{(?>[^\x0A])};
481 424 ${Elatin3::not_alnum} = qr{(?>[^\x30-\x39\x41-\x5A\x61-\x7A])};
482 424 ${Elatin3::not_alpha} = qr{(?>[^\x41-\x5A\x61-\x7A])};
483 424 ${Elatin3::not_ascii} = qr{(?>[^\x00-\x7F])};
484 424 ${Elatin3::not_blank} = qr{(?>[^\x09\x20])};
485 424 ${Elatin3::not_cntrl} = qr{(?>[^\x00-\x1F\x7F])};
486 424 ${Elatin3::not_digit} = qr{(?>[^\x30-\x39])};
487 424 ${Elatin3::not_graph} = qr{(?>[^\x21-\x7F])};
488 424 ${Elatin3::not_lower} = qr{(?>[^\x61-\x7A])};
489 424 ${Elatin3::not_lower_i} = qr{(?>[^\x41-\x5A\x61-\x7A])}; # Perl 5.16 compatible
490 # ${Elatin3::not_lower_i} = qr{(?>[\x00-\xFF])}; # older Perl compatible
491 424 ${Elatin3::not_print} = qr{(?>[^\x20-\x7F])};
492 424 ${Elatin3::not_punct} = qr{(?>[^\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E])};
493 424 ${Elatin3::not_space} = qr{(?>[^\s\x0B])};
494 424 ${Elatin3::not_upper} = qr{(?>[^\x41-\x5A])};
495 424 ${Elatin3::not_upper_i} = qr{(?>[^\x41-\x5A\x61-\x7A])}; # Perl 5.16 compatible
496 # ${Elatin3::not_upper_i} = qr{(?>[\x00-\xFF])}; # older Perl compatible
497 424 ${Elatin3::not_word} = qr{(?>[^\x30-\x39\x41-\x5A\x5F\x61-\x7A])};
498 424 ${Elatin3::not_xdigit} = qr{(?>[^\x30-\x39\x41-\x46\x61-\x66])};
499 424 ${Elatin3::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))};
500 424 ${Elatin3::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]))};
501  
502 # avoid: Name "Elatin3::foo" used only once: possible typo at here.
503 424 ${Elatin3::dot} = ${Elatin3::dot};
504 424 ${Elatin3::dot_s} = ${Elatin3::dot_s};
505 424 ${Elatin3::eD} = ${Elatin3::eD};
506 424 ${Elatin3::eS} = ${Elatin3::eS};
507 424 ${Elatin3::eW} = ${Elatin3::eW};
508 424 ${Elatin3::eH} = ${Elatin3::eH};
509 424 ${Elatin3::eV} = ${Elatin3::eV};
510 424 ${Elatin3::eR} = ${Elatin3::eR};
511 424 ${Elatin3::eN} = ${Elatin3::eN};
512 424 ${Elatin3::not_alnum} = ${Elatin3::not_alnum};
513 424 ${Elatin3::not_alpha} = ${Elatin3::not_alpha};
514 424 ${Elatin3::not_ascii} = ${Elatin3::not_ascii};
515 424 ${Elatin3::not_blank} = ${Elatin3::not_blank};
516 424 ${Elatin3::not_cntrl} = ${Elatin3::not_cntrl};
517 424 ${Elatin3::not_digit} = ${Elatin3::not_digit};
518 424 ${Elatin3::not_graph} = ${Elatin3::not_graph};
519 424 ${Elatin3::not_lower} = ${Elatin3::not_lower};
520 424 ${Elatin3::not_lower_i} = ${Elatin3::not_lower_i};
521 424 ${Elatin3::not_print} = ${Elatin3::not_print};
522 424 ${Elatin3::not_punct} = ${Elatin3::not_punct};
523 424 ${Elatin3::not_space} = ${Elatin3::not_space};
524 424 ${Elatin3::not_upper} = ${Elatin3::not_upper};
525 424 ${Elatin3::not_upper_i} = ${Elatin3::not_upper_i};
526 424 ${Elatin3::not_word} = ${Elatin3::not_word};
527 424 ${Elatin3::not_xdigit} = ${Elatin3::not_xdigit};
528 424 ${Elatin3::eb} = ${Elatin3::eb};
529 424 ${Elatin3::eB} = ${Elatin3::eB};
530  
531 #
532 # Latin-3 split
533 #
534 72 ▶sub Elatin3::split(;$$$) {
Subroutine split: called CC=34 SCAR=38.5
Pod undocumented
535  
536 # P.794 29.2.161. split
537 # in Chapter 29: Functions
538 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
539  
540 # P.951 split
541 # in Chapter 27: Functions
542 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
543  
544 72 my $pattern = $_[0];
545 72 my $string = $_[1];
546 72 my $limit = $_[2];
547  
548 # if $pattern is also omitted or is the literal space, " "
549 72 ▶ if (not defined $pattern) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $pattern) 2 70 72
550 2 $pattern = ' ';
551 }
552  
553 # if $string is omitted, the function splits the $_ string
554 72 ▶ if (not defined $string) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $string) 6 66 72
555 6 ▶ if (defined $_) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_) { } 0 6 6
556 0 $string = $_;
557 }
558 else {
559 6 $string = '';
560 }
561 }
562  
563 72 my @split = ();
564  
565 # when string is empty
566 72 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 10 62 72
elsif ($pattern eq ' ') { } 2 60 62
567  
568 # resulting list value in list context
569 10 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 5 5 10
570 5 return @split;
571 }
572  
573 # count of substrings in scalar context
574 else {
575 5 ▶ carp "Use of implicit split to \@_ is deprecated" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 5 5
576 5 @_ = @split;
577 5 return scalar @_;
578 }
579 }
580  
581 # split's first argument is more consistently interpreted
582 #
583 # After some changes earlier in v5.17, split's behavior has been simplified:
584 # if the PATTERN argument evaluates to a string containing one space, it is
585 # treated the way that a literal string containing one space once was.
586 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#split's_first_argument_is_more_consistently_interpreted
587  
588 # if $pattern is also omitted or is the literal space, " ", the function splits
589 # on whitespace, /\s+/, after skipping any leading whitespace
590 # (and so on)
591  
592 elsif ($pattern eq ' ') {
593 2 ▶ if (not defined $limit) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $limit) { } 2 0 2
594 2 return CORE::split(' ', $string);
595 }
596 else {
597 0 return CORE::split(' ', $string, $limit);
598 }
599 }
600  
601 # if $limit is negative, it is treated as if an arbitrarily large $limit has been specified
602 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
603  
604 # a pattern capable of matching either the null string or something longer than the
605 # null string will split the value of $string into separate characters wherever it
606 # matches the null string between characters
607 # (and so on)
608  
609 60 ▶ if ('' =~ / \A $pattern \z /xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ('' =~ / \A $pattern \z /msx) { } 2 58 60
610 2 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
611 2 my $limit = scalar(() = $string =~ /($pattern)/oxmsg);
612  
613 # P.1024 Appendix W.10 Multibyte Processing
614 # of ISBN 1-56592-224-7 CJKV Information Processing
615 # (and so on)
616  
617 # the //m modifier is assumed when you split on the pattern /^/
618 # (and so on)
619  
620 2 ▶ eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
Subroutine BEGIN: called CC=1 SCAR=0.0
621 # V
622 2 ▶ while ((--$limit > 0) and ($string =~ s/\A((?:$q_char)+?)$pattern//m)) {
Branch: 1 branch
BranchTrueFalseTotal
if (--$limit > 0 and $string =~ s/\A((?:$Elatin3::q_char)+?)$pattern//m) 9 2 11
Condition100%3/3
--$limit > 0 and $string =~ s/\A((?:$Elatin3::q_char)+?)$pattern//m
!ll&&!rl&&r
119
MC/DC100%2/2
--$limit > 0 and $string =~ s/\A((?:$Elatin3::q_char)+?)$pattern//m
--$limit > 0 $string =~ s/\A((?:$Elatin3::q_char)+?)$pattern//m
Truth table100%3/3
A and B
A= --$limit > 0B= $string =~ s/\A((?:$Elatin3::q_char)+?)$pattern//m
ABresult
0X0
100
111
623  
624 # if the $pattern contains parentheses, then the substring matched by each pair of parentheses
625 # is included in the resulting list, interspersed with the fields that are ordinarily returned
626 # (and so on)
627  
628 9 local $@;
629 9 ▶ eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
630 9 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 9 9 18
631 9 push @split, CORE::eval('$' . $digit);
632 }
633 }
634 }
635  
636 else {
637 58 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
638  
639 58 ▶ eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
640 # V
641 58 ▶ while ($string =~ s/\A((?:$q_char)*?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Elatin3::q_char)*?)$pattern//m) 163 58 221
642 163 local $@;
643 163 ▶ eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
644 163 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 230 163 393
645 230 push @split, CORE::eval('$' . $digit);
646 }
647 }
648 }
649 }
650  
651 elsif ($limit > 0) {
652 0 ▶ if ('' =~ / \A $pattern \z /xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ('' =~ / \A $pattern \z /msx) { } 0 0 0
653 0 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
654 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
655  
656 0 eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
657 # V
658 0 ▶ if ($string =~ s/\A((?:$q_char)+?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Elatin3::q_char)+?)$pattern//m) 0 0 0
659 0 local $@;
660 0 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 0 0 0
661 0 push @split, CORE::eval('$' . $digit);
662 }
663 }
664 }
665 }
666 else {
667 0 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
668 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
669  
670 0 eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
671 # V
672 0 ▶ if ($string =~ s/\A((?:$q_char)*?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Elatin3::q_char)*?)$pattern//m) 0 0 0
673 0 local $@;
674 0 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 0 0 0
675 0 push @split, CORE::eval('$' . $digit);
676 }
677 }
678 }
679 }
680 }
681  
682 60 ▶ if (CORE::length($string) > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $string > 0) 58 2 60
683 58 push @split, $string;
684 }
685  
686 # if $_[2] (NOT "$limit") is omitted or zero, trailing null fields are stripped from the result
687 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
688 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
689 0 pop @split;
690 }
691 }
692  
693 # resulting list value in list context
694 60 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 58 2 60
695 58 return @split;
696 }
697  
698 # count of substrings in scalar context
699 else {
700 2 ▶ carp "Use of implicit split to \@_ is deprecated" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 2 2
701 2 @_ = @split;
702 2 return scalar @_;
703 }
704 }
705  
706 #
707 # get last subexpression offsets
708 #
709 60 ▶sub _last_subexpression_offsets {
Subroutine _last_subexpression_offsets: called CC=3 SCAR=11.0
710 60 my $pattern = $_[0];
711  
712 # remove comment
713 60 $pattern =~ s/\(\?\# .*? \)//oxmsg;
714  
715 60 my $modifier = '';
716 60 ▶ if ($pattern =~ /\(\?\^? ([\-A-Za-z]+) :/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pattern =~ /\(\?\^? ([\-A-Za-z]+) :/mosx) 11 49 60
717 11 $modifier = $1;
718 11 $modifier =~ s/-[A-Za-z]*//;
719 }
720  
721 # with /x modifier
722 60 my @char = ();
723 60 ▶ if ($modifier =~ /x/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /x/mosx) { } 5 55 60
724 5 @char = $pattern =~ /\G((?>
725 [^\\\#\[\(] |
726 \\ $q_char |
727 \# (?>[^\n]*) $ |
728 \[ (?>(?:[^\\\]]|\\\\|\\\]|$q_char)+) \] |
729 \(\? |
730 $q_char
731 ))/oxmsg;
732 }
733  
734 # without /x modifier
735 else {
736 55 @char = $pattern =~ /\G((?>
737 [^\\\[\(] |
738 \\ $q_char |
739 \[ (?>(?:[^\\\]]|\\\\|\\\]|$q_char)+) \] |
740 \(\? |
741 $q_char
742 ))/oxmsg;
743 }
744  
745 60 return scalar grep { $_ eq '(' } @char;
746 }
747  
748 #
749 # Latin-3 transliteration (tr///)
750 #
751 6 ▶sub Elatin3::tr($$$$;$) {
Subroutine tr: called CC=26 SCAR=48.6
Pod undocumented
752  
753 6 my $bind_operator = $_[1];
754 6 my $searchlist = $_[2];
755 6 my $replacementlist = $_[3];
756 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
757  
758 6 ▶ if ($modifier =~ /r/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /r/mosx) 5 1 6
759 5 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) 0 5 5
760 0 croak "Using !~ with tr///r doesn't make sense";
761 }
762 }
763  
764 6 my @char = $_[0] =~ /\G (?>$q_char) /oxmsg;
765 6 my @searchlist = _charlist_tr($searchlist);
766 6 my @replacementlist = _charlist_tr($replacementlist);
767  
768 6 my %tr = ();
769 6 ▶ for (my $i=0; $i <= $#searchlist; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#searchlist) 19 6 25
770 19 ▶ if (not exists $tr{$searchlist[$i]}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $tr{$searchlist[$i]}) 19 0 19
771 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
772 19 $tr{$searchlist[$i]} = $replacementlist[$i];
773 }
774 elsif ($modifier =~ /d/oxms) {
775 0 $tr{$searchlist[$i]} = '';
776 }
777 ▶ 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
778 0 $tr{$searchlist[$i]} = $replacementlist[-1];
779 }
780 else {
781 0 $tr{$searchlist[$i]} = $searchlist[$i];
782 }
783 }
784 }
785  
786 6 my $tr = 0;
787 6 my $replaced = '';
788 6 ▶ if ($modifier =~ /c/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /c/mosx) { } 0 6 6
789 0 ▶ while (defined(my $char = shift @char)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $char = shift @char)) 0 0 0
790 0 ▶ if (not exists $tr{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $tr{$char}) { } 0 0 0
791 0 ▶ if (defined $replacementlist[-1]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $replacementlist[-1]) 0 0 0
792 0 $replaced .= $replacementlist[-1];
793 }
794 0 $tr++;
795 0 ▶ if ($modifier =~ /s/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/mosx) 0 0 0
796 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
797 0 shift @char;
798 0 $tr++;
799 }
800 }
801 }
802 else {
803 0 $replaced .= $char;
804 }
805 }
806 }
807 else {
808 6 ▶ while (defined(my $char = shift @char)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $char = shift @char)) 36 6 42
809 36 ▶ if (exists $tr{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $tr{$char}) { } 19 17 36
810 19 $replaced .= $tr{$char};
811 19 $tr++;
812 19 ▶ if ($modifier =~ /s/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/mosx) 0 19 19
813 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
814 0 shift @char;
815 0 $tr++;
816 }
817 }
818 }
819 else {
820 17 $replaced .= $char;
821 }
822 }
823 }
824  
825 6 ▶ if ($modifier =~ /r/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /r/mosx) { } 5 1 6
826 5 return $replaced;
827 }
828 else {
829 1 $_[0] = $replaced;
830 1 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) { } 0 1 1
831 0 return not $tr;
832 }
833 else {
834 1 return $tr;
835 }
836 }
837 }
838  
839 #
840 # Latin-3 chop
841 #
842 0 ▶sub Elatin3::chop(@) {
Subroutine chop: not called CC=3 SCAR=24.8
Pod undocumented
843  
844 0 my $chop;
845 0 ▶ if (@_ == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 0) { } 0 0 0
846 0 my @char = /\G (?>$q_char) /oxmsg;
847 0 $chop = pop @char;
848 0 $_ = join '', @char;
849 }
850 else {
851 0 for (@_) {
852 0 my @char = /\G (?>$q_char) /oxmsg;
853 0 $chop = pop @char;
854 0 $_ = join '', @char;
855 }
856 }
857 0 return $chop;
858 }
859  
860 #
861 # Latin-3 index by octet
862 #
863 30 ▶sub Elatin3::index($$;$) {
Subroutine index: called CC=6 SCAR=20.8
Pod documented
864  
865 30 my($str,$substr,$position) = @_;
866 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
867 30 my $pos = 0;
868  
869 30 ▶ while ($pos < CORE::length($str)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos < length $str) 130 30 160
870 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
871 0 ▶ if ($pos >= $position) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos >= $position) 0 0 0
872 0 return $pos;
873 }
874 }
875 130 ▶ if (CORE::substr($str,$pos) =~ /\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($str, $pos) =~ /\A ($Elatin3::q_char) /mosx) { } 130 0 130
876 130 $pos += CORE::length($1);
877 }
878 else {
879 0 $pos += 1;
880 }
881 }
882 30 return -1;
883 }
884  
885 #
886 # Latin-3 reverse index
887 #
888 0 ▶sub Elatin3::rindex($$;$) {
Subroutine rindex: not called CC=6 SCAR=37.4
Pod undocumented
889  
890 0 my($str,$substr,$position) = @_;
891 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
892 0 my $pos = 0;
893 0 my $rindex = -1;
894  
895 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
896 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
897 0 $rindex = $pos;
898 }
899 0 ▶ if (CORE::substr($str,$pos) =~ /\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($str, $pos) =~ /\A ($Elatin3::q_char) /mosx) { } 0 0 0
900 0 $pos += CORE::length($1);
901 }
902 else {
903 0 $pos += 1;
904 }
905 }
906 0 return $rindex;
907 }
908  
909 #
910 # Latin-3 lower case first with parameter
911 #
912 0 ▶sub Elatin3::lcfirst(@) {
Subroutine lcfirst: not called CC=4 SCAR=30.0
Pod undocumented
913 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
914 0 my $s = shift @_;
915 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
916 0 return Elatin3::lc(CORE::substr($s,0,1)) . CORE::substr($s,1), @_;
917 }
918 else {
919 0 return Elatin3::lc(CORE::substr($s,0,1)) . CORE::substr($s,1);
920 }
921 }
922 else {
923 0 return Elatin3::lc(CORE::substr($_,0,1)) . CORE::substr($_,1);
924 }
925 }
926  
927 #
928 # Latin-3 lower case first without parameter
929 #
930 0 ▶sub Elatin3::lcfirst_() {
Subroutine lcfirst_: not called CC=1 SCAR=6.9
Pod undocumented
931 0 return Elatin3::lc(CORE::substr($_,0,1)) . CORE::substr($_,1);
932 }
933  
934 #
935 # Latin-3 lower case with parameter
936 #
937 61 ▶sub Elatin3::lc(@) {
Subroutine lc: called CC=6 SCAR=24.2
Pod undocumented
938 61 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 61 0 61
939 61 my $s = shift @_;
940 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
941 0 ▶ return join('', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 0 0 0
942 }
943 else {
944 61 ▶ return join('', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 63 0 63
945 }
946 }
947 else {
948 0 return Elatin3::lc_();
949 }
950 }
951  
952 #
953 # Latin-3 lower case without parameter
954 #
955 0 ▶sub Elatin3::lc_() {
Subroutine lc_: not called CC=2 SCAR=17.9
Pod undocumented
956 0 my $s = $_;
957 0 ▶ return join '', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 0 0 0
958 }
959  
960 #
961 # Latin-3 upper case first with parameter
962 #
963 0 ▶sub Elatin3::ucfirst(@) {
Subroutine ucfirst: not called CC=4 SCAR=30.0
Pod undocumented
964 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
965 0 my $s = shift @_;
966 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
967 0 return Elatin3::uc(CORE::substr($s,0,1)) . CORE::substr($s,1), @_;
968 }
969 else {
970 0 return Elatin3::uc(CORE::substr($s,0,1)) . CORE::substr($s,1);
971 }
972 }
973 else {
974 0 return Elatin3::uc(CORE::substr($_,0,1)) . CORE::substr($_,1);
975 }
976 }
977  
978 #
979 # Latin-3 upper case first without parameter
980 #
981 0 ▶sub Elatin3::ucfirst_() {
Subroutine ucfirst_: not called CC=1 SCAR=6.9
Pod undocumented
982 0 return Elatin3::uc(CORE::substr($_,0,1)) . CORE::substr($_,1);
983 }
984  
985 #
986 # Latin-3 upper case with parameter
987 #
988 2469 ▶sub Elatin3::uc(@) {
Subroutine uc: called CC=6 SCAR=22.9
Pod undocumented
989 2469 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2469 0 2469
990 2469 my $s = shift @_;
991 2469 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 2469 2469
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
246900
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
992 0 ▶ return join('', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 0 0 0
993 }
994 else {
995 2469 ▶ return join('', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 882 1589 2471
996 }
997 }
998 else {
999 0 return Elatin3::uc_();
1000 }
1001 }
1002  
1003 #
1004 # Latin-3 upper case without parameter
1005 #
1006 0 ▶sub Elatin3::uc_() {
Subroutine uc_: not called CC=2 SCAR=17.9
Pod undocumented
1007 0 my $s = $_;
1008 0 ▶ return join '', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 0 0 0
1009 }
1010  
1011 #
1012 # Latin-3 fold case with parameter
1013 #
1014 2479 ▶sub Elatin3::fc(@) {
Subroutine fc: called CC=6 SCAR=22.9
Pod undocumented
1015 2479 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2479 0 2479
1016 2479 my $s = shift @_;
1017 2479 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 2479 2479
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
247900
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
1018 0 ▶ return join('', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 0 0 0
1019 }
1020 else {
1021 2479 ▶ return join('', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 1869 5819 7688
1022 }
1023 }
1024 else {
1025 0 return Elatin3::fc_();
1026 }
1027 }
1028  
1029 #
1030 # Latin-3 fold case without parameter
1031 #
1032 0 ▶sub Elatin3::fc_() {
Subroutine fc_: not called CC=2 SCAR=17.9
Pod undocumented
1033 0 my $s = $_;
1034 0 ▶ return join '', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 0 0 0
1035 }
1036  
1037 #
1038 # Latin-3 regexp capture
1039 #
1040 {
1041 0 ▶ sub Elatin3::capture {
Subroutine capture: not called CC=1 SCAR=6.9
Pod documented
1042 0 return $_[0];
1043 }
1044 }
1045  
1046 #
1047 # Latin-3 regexp ignore case modifier
1048 #
1049 424 ▶sub Elatin3::ignorecase {
Subroutine ignorecase: called CC=25 SCAR=52.1
Pod undocumented
1050  
1051 11 my @string = @_;
1052 11 my $metachar = qr/[\@\\|[\]{]/oxms;
1053  
1054 # ignore case of $scalar or @array
1055 11 for my $string (@string) {
1056  
1057 # split regexp
1058 11 my @char = $string =~ /\G (?>\[\^|\\$q_char|$q_char) /oxmsg;
1059  
1060 # unescape character
1061 11 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1004 11 1015
1062 1004 ▶ next if not defined $char[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $char[$i] 0 1004 1004
1063  
1064 # open character class [...]
1065 1004 ▶ if ($char[$i] eq '[') {
Branch: 4 branches
BranchTrueFalseTotal
if ($char[$i] eq '[') { } 0 1004 1004
elsif ($char[$i] eq '[^') { } 0 1004 1004
elsif (my $char = classic_character_class($char[$i])) { } 0 1004 1004
elsif ($char[$i] =~ /\A [\x00-\xFF] \z/mosx) { } 1004 0 1004
1066 0 my $left = $i;
1067  
1068 # [] make die "unmatched [] in regexp ...\n"
1069  
1070 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
1071 0 $i++;
1072 }
1073  
1074 0 while (1) {
1075 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
1076 0 croak "Unmatched [] in regexp";
1077 }
1078 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
1079 0 my $right = $i;
1080 0 my @charlist = charlist_qr(@char[$left+1..$right-1], 'i');
1081  
1082 # escape character
1083 0 for my $char (@charlist) {
1084 0 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $char =~ /\A [.|)] \z/mosx }) 0 0 0
1085 }
1086  
1087 0 elsif ($char =~ /\A [.|)] \z/oxms) {
1088 0 $char = '\\' . $char;
1089 }
1090 }
1091  
1092 # [...]
1093 0 splice @char, $left, $right-$left+1, '(?:' . join('|', @charlist) . ')';
1094  
1095 0 $i = $left;
1096 0 last;
1097 }
1098 }
1099 }
1100  
1101 # open character class [^...]
1102 elsif ($char[$i] eq '[^') {
1103 0 my $left = $i;
1104  
1105 # [^] make die "unmatched [] in regexp ...\n"
1106  
1107 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
1108 0 $i++;
1109 }
1110  
1111 0 while (1) {
1112 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
1113 0 croak "Unmatched [] in regexp";
1114 }
1115 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
1116 0 my $right = $i;
1117 0 my @charlist = charlist_not_qr(@char[$left+1..$right-1], 'i');
1118  
1119 # escape character
1120 0 for my $char (@charlist) {
1121 0 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $char =~ /\A [.|)] \z/mosx }) 0 0 0
1122 }
1123  
1124 0 elsif ($char =~ /\A [.|)] \z/oxms) {
1125 0 $char = '\\' . $char;
1126 }
1127 }
1128  
1129 # [^...]
1130 0 splice @char, $left, $right-$left+1, '(?!' . join('|', @charlist) . ")(?:$your_char)";
1131  
1132 0 $i = $left;
1133 0 last;
1134 }
1135 }
1136 }
1137  
1138 # rewrite classic character class or escape character
1139 elsif (my $char = classic_character_class($char[$i])) {
1140 0 $char[$i] = $char;
1141 }
1142  
1143 # with /i modifier
1144 elsif ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) {
1145 1004 my $uc = Elatin3::uc($char[$i]);
1146 1004 my $fc = Elatin3::fc($char[$i]);
1147 1004 ▶ if ($uc ne $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc ne $fc) 516 488 1004
1148 516 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 513 3 516
1149 513 $char[$i] = '[' . $uc . $fc . ']';
1150 }
1151 else {
1152 3 $char[$i] = '(?:' . $uc . '|' . $fc . ')';
1153 }
1154 }
1155 }
1156 }
1157  
1158 # characterize
1159 11 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1004 11 1015
1160 1004 ▶ next if not defined $char[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $char[$i] 0 1004 1004
1161  
1162 1004 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx }) 0 1015 1015
1163 }
1164  
1165 # quote character before ? + * {
1166 0 ▶ elsif (($i >= 1) and ($char[$i] =~ /\A [\?\+\*\{] \z/oxms)) {
Condition66%2/3
$i >= 1 && $char[$i] =~ /\A [\?\+\*\{] \z/mosx
!ll&&!rl&&r
119930
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
1167 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
1168 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
1169 }
1170 }
1171 }
1172  
1173 11 $string = join '', @char;
1174 }
1175  
1176 # make regexp string
1177 11 return @string;
1178 }
1179  
1180 #
1181 # classic character class ( \D \S \W \d \s \w \C \X \H \V \h \v \R \N \b \B )
1182 #
1183 2872 ▶sub Elatin3::classic_character_class {
Subroutine classic_character_class: called CC=2 SCAR=6.9
Pod undocumented
1184 2872 my($char) = @_;
1185  
1186 return {
1187 '\D' => '${Elatin3::eD}',
1188 '\S' => '${Elatin3::eS}',
1189 '\W' => '${Elatin3::eW}',
1190 '\d' => '[0-9]',
1191  
1192 # Before Perl 5.6, \s only matched the five whitespace characters
1193 # tab, newline, form-feed, carriage return, and the space character
1194 # itself, which, taken together, is the character class [\t\n\f\r ].
1195  
1196 # Vertical tabs are now whitespace
1197 # \s in a regex now matches a vertical tab in all circumstances.
1198 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
1199 # \t \n \v \f \r space
1200 # '\s' => '[\x09\x0A \x0C\x0D\x20]',
1201 # '\s' => '[\x09\x0A\x0B\x0C\x0D\x20]',
1202 '\s' => '\s',
1203  
1204 '\w' => '[0-9A-Z_a-z]',
1205 '\C' => '[\x00-\xFF]',
1206 '\X' => 'X',
1207  
1208 # \h \v \H \V
1209  
1210 # P.114 Character Class Shortcuts
1211 # in Chapter 7: In the World of Regular Expressions
1212 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
1213  
1214 # P.357 13.2.3 Whitespace
1215 # in Chapter 13: perlrecharclass: Perl Regular Expression Character Classes
1216 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
1217 #
1218 # 0x00009 CHARACTER TABULATION h s
1219 # 0x0000a LINE FEED (LF) vs
1220 # 0x0000b LINE TABULATION v
1221 # 0x0000c FORM FEED (FF) vs
1222 # 0x0000d CARRIAGE RETURN (CR) vs
1223 # 0x00020 SPACE h s
1224  
1225 # P.196 Table 5-9. Alphanumeric regex metasymbols
1226 # in Chapter 5. Pattern Matching
1227 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1228  
1229 # (and so on)
1230  
1231 '\H' => '${Elatin3::eH}',
1232 '\V' => '${Elatin3::eV}',
1233 '\h' => '[\x09\x20]',
1234 '\v' => '[\x0A\x0B\x0C\x0D]',
1235 '\R' => '${Elatin3::eR}',
1236  
1237 # \N
1238 #
1239 # http://perldoc.perl.org/perlre.html
1240 # Character Classes and other Special Escapes
1241 # Any character but \n (experimental). Not affected by /s modifier
1242  
1243 '\N' => '${Elatin3::eN}',
1244  
1245 # \b \B
1246  
1247 # P.180 Boundaries: The \b and \B Assertions
1248 # in Chapter 5: Pattern Matching
1249 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
1250  
1251 # P.219 Boundaries: The \b and \B Assertions
1252 # in Chapter 5: Pattern Matching
1253 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1254  
1255 # \b really means (?:(?<=\w)(?!\w)|(?<!\w)(?=\w))
1256 # or (?:(?<=\A|\W)(?=\w)|(?<=\w)(?=\W|\z))
1257 '\b' => '${Elatin3::eb}',
1258  
1259 # \B really means (?:(?<=\w)(?=\w)|(?<!\w)(?!\w))
1260 # or (?:(?<=\w)(?=\w)|(?<=\W)(?=\W))
1261 '\B' => '${Elatin3::eB}',
1262  
1263 2872 ▶ }->{$char} || '';
Condition100%2/2
{'\\D', '${Elatin3::eD}', '\\S', '${Elatin3::eS}', '\\W', '${Elatin3::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin3::eH}', '\\V', '${Elatin3::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin3::eR}', '\\N', '${Elatin3::eN}', '\\b', '${Elatin3::eb}', '\\B', '${Elatin3::eB}'}->{$char} || ''
l!l
1012771
MC/DC100%1/1
{'\\D', '${Elatin3::eD}', '\\S', '${Elatin3::eS}', '\\W', '${Elatin3::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin3::eH}', '\\V', '${Elatin3::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin3::eR}', '\\N', '${Elatin3::eN}', '\\b', '${Elatin3::eb}', '\\B', '${Elatin3::eB}'}->{$char} || ''
{'\\D', '${Elatin3::eD}', '\\S', '${Elatin3::eS}', '\\W', '${Elatin3::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin3::eH}', '\\V', '${Elatin3::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin3::eR}', '\\N', '${Elatin3::eN}', '\\b', '${Elatin3::eb}', '\\B', '${Elatin3::eB}'}->{$char}
Truth table100%2/2
A
A= {'\\D', '${Elatin3::eD}', '\\S', '${Elatin3::eS}', '\\W', '${Elatin3::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin3::eH}', '\\V', '${Elatin3::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin3::eR}', '\\N', '${Elatin3::eN}', '\\b', '${Elatin3::eb}', '\\B', '${Elatin3::eB}'}->{$char}
Aresult
11
00
1264 }
1265  
1266 #
1267 # prepare Latin-3 characters per length
1268 #
1269  
1270 # 1 octet characters
1271 424 my @chars1 = ();
1272 0 ▶sub chars1 {
Subroutine chars1: not called CC=5 SCAR=34.0
Pod undocumented
1273 0 ▶ if (@chars1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars1) 0 0 0
1274 0 return @chars1;
1275 }
1276 0 ▶ if (exists $range_tr{1}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{1}) 0 0 0
1277 0 my @ranges = @{ $range_tr{1} };
1278 0 ▶ while (my @range = splice(@ranges,0,1)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 1)) 0 0 0
1279 0 for my $oct0 (@{$range[0]}) {
1280 0 push @chars1, pack 'C', $oct0;
1281 }
1282 }
1283 }
1284 0 return @chars1;
1285 }
1286  
1287 # 2 octets characters
1288 424 my @chars2 = ();
1289 0 ▶sub chars2 {
Subroutine chars2: not called CC=6 SCAR=37.4
Pod undocumented
1290 0 ▶ if (@chars2) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars2) 0 0 0
1291 0 return @chars2;
1292 }
1293 0 ▶ if (exists $range_tr{2}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{2}) 0 0 0
1294 0 my @ranges = @{ $range_tr{2} };
1295 0 ▶ while (my @range = splice(@ranges,0,2)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 2)) 0 0 0
1296 0 for my $oct0 (@{$range[0]}) {
1297 0 for my $oct1 (@{$range[1]}) {
1298 0 push @chars2, pack 'CC', $oct0,$oct1;
1299 }
1300 }
1301 }
1302 }
1303 0 return @chars2;
1304 }
1305  
1306 # 3 octets characters
1307 424 my @chars3 = ();
1308 0 ▶sub chars3 {
Subroutine chars3: not called CC=7 SCAR=40.3
Pod undocumented
1309 0 ▶ if (@chars3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars3) 0 0 0
1310 0 return @chars3;
1311 }
1312 0 ▶ if (exists $range_tr{3}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{3}) 0 0 0
1313 0 my @ranges = @{ $range_tr{3} };
1314 0 ▶ while (my @range = splice(@ranges,0,3)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 3)) 0 0 0
1315 0 for my $oct0 (@{$range[0]}) {
1316 0 for my $oct1 (@{$range[1]}) {
1317 0 for my $oct2 (@{$range[2]}) {
1318 0 push @chars3, pack 'CCC', $oct0,$oct1,$oct2;
1319 }
1320 }
1321 }
1322 }
1323 }
1324 0 return @chars3;
1325 }
1326  
1327 # 4 octets characters
1328 424 my @chars4 = ();
1329 0 ▶sub chars4 {
Subroutine chars4: not called CC=8 SCAR=42.8
Pod undocumented
1330 0 ▶ if (@chars4) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars4) 0 0 0
1331 0 return @chars4;
1332 }
1333 0 ▶ if (exists $range_tr{4}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{4}) 0 0 0
1334 0 my @ranges = @{ $range_tr{4} };
1335 0 ▶ while (my @range = splice(@ranges,0,4)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 4)) 0 0 0
1336 0 for my $oct0 (@{$range[0]}) {
1337 0 for my $oct1 (@{$range[1]}) {
1338 0 for my $oct2 (@{$range[2]}) {
1339 0 for my $oct3 (@{$range[3]}) {
1340 0 push @chars4, pack 'CCCC', $oct0,$oct1,$oct2,$oct3;
1341 }
1342 }
1343 }
1344 }
1345 }
1346 }
1347 0 return @chars4;
1348 }
1349  
1350 #
1351 # Latin-3 open character list for tr
1352 #
1353 12 ▶sub _charlist_tr {
Subroutine _charlist_tr: called CC=35 SCAR=66.4
1354  
1355 12 local $_ = shift @_;
1356  
1357 # unescape character
1358 12 my @char = ();
1359 12 ▶ while (not /\G \z/oxmsgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgmosx) 38 12 50
1360 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 \\ ($Elatin3::q_char) /cgmosx) { } 0 38 38
elsif (/\G ($Elatin3::q_char) /cgmosx) { } 38 0 38
1361 0 push @char, '\-';
1362 }
1363 elsif (/\G \\ ([0-7]{2,3}) /oxmsgc) {
1364 0 push @char, CORE::chr(oct $1);
1365 }
1366 elsif (/\G \\x ([0-9A-Fa-f]{1,2}) /oxmsgc) {
1367 0 push @char, CORE::chr(hex $1);
1368 }
1369 elsif (/\G \\c ([\x40-\x5F]) /oxmsgc) {
1370 0 push @char, CORE::chr(CORE::ord($1) & 0x1F);
1371 }
1372 elsif (/\G (\\ [0nrtfbae]) /oxmsgc) {
1373 push @char, {
1374 '\0' => "\0",
1375 '\n' => "\n",
1376 '\r' => "\r",
1377 '\t' => "\t",
1378 '\f' => "\f",
1379 '\b' => "\x08", # \b means backspace in character class
1380 '\a' => "\a",
1381 '\e' => "\e",
1382 0 }->{$1};
1383 }
1384 elsif (/\G \\ ($q_char) /oxmsgc) {
1385 0 push @char, $1;
1386 }
1387 elsif (/\G ($q_char) /oxmsgc) {
1388 38 push @char, $1;
1389 }
1390 }
1391  
1392 # join separated multiple-octet
1393 12 @char = join('',@char) =~ /\G (?>\\-|$q_char) /oxmsg;
1394  
1395 # unescape '-'
1396 12 my @i = ();
1397 12 for my $i (0 .. $#char) {
1398 38 ▶ if ($char[$i] eq '\-') {
Branch: 2 branches
BranchTrueFalseTotal
if ($char[$i] eq '\\-') { } 0 38 38
elsif ($char[$i] eq '-') { } 0 38 38
1399 0 $char[$i] = '-';
1400 }
1401 elsif ($char[$i] eq '-') {
1402 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
1403 0 push @i, $i;
1404 }
1405 }
1406 }
1407  
1408 # open character list (reverse for splice)
1409 12 for my $i (CORE::reverse @i) {
1410 0 my @range = ();
1411  
1412 # range error
1413 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
1414 0 croak "Invalid tr/// range \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1415 }
1416  
1417 # range of multiple-octet code
1418 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
1419 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
1420 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
1421 }
1422 elsif (CORE::length($char[$i+1]) == 2) {
1423 0 push @range, grep {$char[$i-1] le $_} chars1();
1424 0 push @range, grep {$_ le $char[$i+1]} chars2();
1425 }
1426 elsif (CORE::length($char[$i+1]) == 3) {
1427 0 push @range, grep {$char[$i-1] le $_} chars1();
1428 0 push @range, chars2();
1429 0 push @range, grep {$_ le $char[$i+1]} chars3();
1430 }
1431 elsif (CORE::length($char[$i+1]) == 4) {
1432 0 push @range, grep {$char[$i-1] le $_} chars1();
1433 0 push @range, chars2();
1434 0 push @range, chars3();
1435 0 push @range, grep {$_ le $char[$i+1]} chars4();
1436 }
1437 else {
1438 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1439 }
1440 }
1441 elsif (CORE::length($char[$i-1]) == 2) {
1442 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
1443 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
1444 }
1445 elsif (CORE::length($char[$i+1]) == 3) {
1446 0 push @range, grep {$char[$i-1] le $_} chars2();
1447 0 push @range, grep {$_ le $char[$i+1]} chars3();
1448 }
1449 elsif (CORE::length($char[$i+1]) == 4) {
1450 0 push @range, grep {$char[$i-1] le $_} chars2();
1451 0 push @range, chars3();
1452 0 push @range, grep {$_ le $char[$i+1]} chars4();
1453 }
1454 else {
1455 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1456 }
1457 }
1458 elsif (CORE::length($char[$i-1]) == 3) {
1459 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
1460 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
1461 }
1462 elsif (CORE::length($char[$i+1]) == 4) {
1463 0 push @range, grep {$char[$i-1] le $_} chars3();
1464 0 push @range, grep {$_ le $char[$i+1]} chars4();
1465 }
1466 else {
1467 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1468 }
1469 }
1470 elsif (CORE::length($char[$i-1]) == 4) {
1471 0 ▶ if (CORE::length($char[$i+1]) == 4) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $char[$i + 1] == 4) { } 0 0 0
1472 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
1473 }
1474 else {
1475 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1476 }
1477 }
1478 else {
1479 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1480 }
1481  
1482 0 splice @char, $i-1, 3, @range;
1483 }
1484  
1485 12 return @char;
1486 }
1487  
1488 #
1489 # Latin-3 open character class
1490 #
1491 0 ▶sub _cc {
Subroutine _cc: not called CC=7 SCAR=40.3
1492 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
1493 0 die __FILE__, ": subroutine cc got no parameter.\n";
1494 }
1495 elsif (scalar(@_) == 1) {
1496 0 return sprintf('\x%02X',$_[0]);
1497 }
1498 elsif (scalar(@_) == 2) {
1499 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
1500 0 die __FILE__, ": subroutine cc got \$_[0] > \$_[1] parameters).\n";
1501 }
1502 elsif ($_[0] == $_[1]) {
1503 0 return sprintf('\x%02X',$_[0]);
1504 }
1505 elsif (($_[0]+1) == $_[1]) {
1506 0 return sprintf('[\\x%02X\\x%02X]',$_[0],$_[1]);
1507 }
1508 else {
1509 0 return sprintf('[\\x%02X-\\x%02X]',$_[0],$_[1]);
1510 }
1511 }
1512 else {
1513 0 die __FILE__, ": subroutine cc got 3 or more parameters (@{[scalar(@_)]} parameters).\n";
1514 }
1515 }
1516  
1517 #
1518 # Latin-3 octet range
1519 #
1520 246 ▶sub _octets {
Subroutine _octets: called CC=5 SCAR=19.3
1521 246 my $length = shift @_;
1522  
1523 246 ▶ if ($length == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length == 1) { } 246 0 246
1524 246 my($a1) = unpack 'C', $_[0];
1525 246 my($z1) = unpack 'C', $_[1];
1526  
1527 246 ▶ if ($a1 > $z1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($a1 > $z1) 0 246 246
1528 0 croak 'Invalid [] range in regexp (CORE::ord(A) > CORE::ord(B)) ' . '\x' . unpack('H*',$a1) . '-\x' . unpack('H*',$z1);
1529 }
1530  
1531 246 ▶ if ($a1 == $z1) {
Branch: 2 branches
BranchTrueFalseTotal
if ($a1 == $z1) { } 0 246 246
elsif ($a1 + 1 == $z1) { } 0 246 246
1532 0 return sprintf('\x%02X',$a1);
1533 }
1534 elsif (($a1+1) == $z1) {
1535 0 return sprintf('\x%02X\x%02X',$a1,$z1);
1536 }
1537 else {
1538 246 return sprintf('\x%02X-\x%02X',$a1,$z1);
1539 }
1540 }
1541 else {
1542 0 die __FILE__, ": subroutine _octets got invalid length ($length).\n";
1543 }
1544 }
1545  
1546 #
1547 # Latin-3 range regexp
1548 #
1549 246 ▶sub _range_regexp {
Subroutine _range_regexp: called CC=18 SCAR=41.7
1550 246 my($length,$first,$last) = @_;
1551  
1552 246 my @range_regexp = ();
1553 246 ▶ if (not exists $range_tr{$length}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $range_tr{$length}) 0 246 246
1554 0 return @range_regexp;
1555 }
1556  
1557 246 my @ranges = @{ $range_tr{$length} };
1558 246 ▶ while (my @range = splice(@ranges,0,$length)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, $length)) 246 246 492
1559 246 my $min = '';
1560 246 my $max = '';
1561 246 ▶ for (my $i=0; $i < $length; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $length) 246 246 492
1562 246 $min .= pack 'C', $range[$i][0];
1563 246 $max .= pack 'C', $range[$i][-1];
1564 }
1565  
1566 # min___max
1567 # FIRST_____________LAST
1568 # (nothing)
1569  
1570 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
1571 }
1572  
1573 # **********
1574 # min_________max
1575 # FIRST_____________LAST
1576 # **********
1577  
1578 ▶ 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
1579 0 push @range_regexp, _octets($length,$first,$max,$min,$max);
1580 }
1581  
1582 # **********************
1583 # min________________max
1584 # FIRST_____________LAST
1585 # **********************
1586  
1587 ▶ 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
1588 0 push @range_regexp, _octets($length,$first,$last,$min,$max);
1589 }
1590  
1591 # *********
1592 # min___max
1593 # FIRST_____________LAST
1594 # *********
1595  
1596 ▶ 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
1597 0 push @range_regexp, _octets($length,$min,$max,$min,$max);
1598 }
1599  
1600 # **********************
1601 # min__________________________max
1602 # FIRST_____________LAST
1603 # **********************
1604  
1605 ▶ 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
1606 246 push @range_regexp, _octets($length,$first,$last,$min,$max);
1607 }
1608  
1609 # *********
1610 # min________max
1611 # FIRST_____________LAST
1612 # *********
1613  
1614 ▶ 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
1615 0 push @range_regexp, _octets($length,$min,$last,$min,$max);
1616 }
1617  
1618 # min___max
1619 # FIRST_____________LAST
1620 # (nothing)
1621  
1622 elsif ($last lt $min) {
1623 }
1624  
1625 else {
1626 0 die __FILE__, ": subroutine _range_regexp panic.\n";
1627 }
1628 }
1629  
1630 246 return @range_regexp;
1631 }
1632  
1633 #
1634 # Latin-3 open character list for qr and not qr
1635 #
1636 650 ▶sub _charlist {
Subroutine _charlist: called CC=46 SCAR=45.9
1637  
1638 650 my $modifier = pop @_;
1639 650 my @char = @_;
1640  
1641 650 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 298 352 650
1642  
1643 # unescape character
1644 650 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1773 650 2423
1645  
1646 # escape - to ...
1647 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 \\ ($Elatin3::q_char) \z/mosx) { } 7 1371 1378
1648 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
1649 246 $char[$i] = '...';
1650 }
1651 }
1652  
1653 # octal escape sequence
1654 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
1655 0 $char[$i] = octchr($1);
1656 }
1657  
1658 # hexadecimal escape sequence
1659 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
1660 0 $char[$i] = hexchr($1);
1661 }
1662  
1663 # \b{...} --> b\{...}
1664 # \B{...} --> B\{...}
1665 # \N{CHARNAME} --> N\{CHARNAME}
1666 # \p{PROPERTY} --> p\{PROPERTY}
1667 # \P{PROPERTY} --> P\{PROPERTY}
1668 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
1669 0 $char[$i] = $1 . '\\' . $2;
1670 }
1671  
1672 # \p, \P, \X --> p, P, X
1673 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
1674 0 $char[$i] = $1;
1675 }
1676  
1677 elsif ($char[$i] =~ /\A \\ ([0-7]{2,3}) \z/oxms) {
1678 0 $char[$i] = CORE::chr oct $1;
1679 }
1680 elsif ($char[$i] =~ /\A \\x ([0-9A-Fa-f]{1,2}) \z/oxms) {
1681 22 $char[$i] = CORE::chr hex $1;
1682 }
1683 elsif ($char[$i] =~ /\A \\c ([\x40-\x5F]) \z/oxms) {
1684 0 $char[$i] = CORE::chr(CORE::ord($1) & 0x1F);
1685 }
1686 elsif ($char[$i] =~ /\A (\\ [0nrtfbaedswDSWHVhvR]) \z/oxms) {
1687 $char[$i] = {
1688 '\0' => "\0",
1689 '\n' => "\n",
1690 '\r' => "\r",
1691 '\t' => "\t",
1692 '\f' => "\f",
1693 '\b' => "\x08", # \b means backspace in character class
1694 '\a' => "\a",
1695 '\e' => "\e",
1696 '\d' => '[0-9]',
1697  
1698 # Vertical tabs are now whitespace
1699 # \s in a regex now matches a vertical tab in all circumstances.
1700 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
1701 # \t \n \v \f \r space
1702 # '\s' => '[\x09\x0A \x0C\x0D\x20]',
1703 # '\s' => '[\x09\x0A\x0B\x0C\x0D\x20]',
1704 '\s' => '\s',
1705  
1706 '\w' => '[0-9A-Z_a-z]',
1707 '\D' => '${Elatin3::eD}',
1708 '\S' => '${Elatin3::eS}',
1709 '\W' => '${Elatin3::eW}',
1710  
1711 '\H' => '${Elatin3::eH}',
1712 '\V' => '${Elatin3::eV}',
1713 '\h' => '[\x09\x20]',
1714 '\v' => '[\x0A\x0B\x0C\x0D]',
1715 '\R' => '${Elatin3::eR}',
1716  
1717 25 }->{$1};
1718 }
1719  
1720 # POSIX-style character classes
1721 ▶ 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
1722 $char[$i] = {
1723  
1724 '[:lower:]' => '[\x41-\x5A\x61-\x7A]',
1725 '[:upper:]' => '[\x41-\x5A\x61-\x7A]',
1726 '[:^lower:]' => '${Elatin3::not_lower_i}',
1727 '[:^upper:]' => '${Elatin3::not_upper_i}',
1728  
1729 8 }->{$1};
1730 }
1731 elsif ($char[$i] =~ /\A ( \[\: \^? (?:alnum|alpha|ascii|blank|cntrl|digit|graph|lower|print|punct|space|upper|word|xdigit) :\] ) \z/oxms) {
1732 $char[$i] = {
1733  
1734 '[:alnum:]' => '[\x30-\x39\x41-\x5A\x61-\x7A]',
1735 '[:alpha:]' => '[\x41-\x5A\x61-\x7A]',
1736 '[:ascii:]' => '[\x00-\x7F]',
1737 '[:blank:]' => '[\x09\x20]',
1738 '[:cntrl:]' => '[\x00-\x1F\x7F]',
1739 '[:digit:]' => '[\x30-\x39]',
1740 '[:graph:]' => '[\x21-\x7F]',
1741 '[:lower:]' => '[\x61-\x7A]',
1742 '[:print:]' => '[\x20-\x7F]',
1743 '[:punct:]' => '[\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E]',
1744  
1745 # P.174 POSIX-Style Character Classes
1746 # in Chapter 5: Pattern Matching
1747 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
1748  
1749 # P.311 11.2.4 Character Classes and other Special Escapes
1750 # in Chapter 11: perlre: Perl regular expressions
1751 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
1752  
1753 # P.210 POSIX-Style Character Classes
1754 # in Chapter 5: Pattern Matching
1755 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1756  
1757 '[:space:]' => '[\s\x0B]', # "\s" plus vertical tab ("\cK")
1758  
1759 '[:upper:]' => '[\x41-\x5A]',
1760 '[:word:]' => '[\x30-\x39\x41-\x5A\x5F\x61-\x7A]',
1761 '[:xdigit:]' => '[\x30-\x39\x41-\x46\x61-\x66]',
1762 '[:^alnum:]' => '${Elatin3::not_alnum}',
1763 '[:^alpha:]' => '${Elatin3::not_alpha}',
1764 '[:^ascii:]' => '${Elatin3::not_ascii}',
1765 '[:^blank:]' => '${Elatin3::not_blank}',
1766 '[:^cntrl:]' => '${Elatin3::not_cntrl}',
1767 '[:^digit:]' => '${Elatin3::not_digit}',
1768 '[:^graph:]' => '${Elatin3::not_graph}',
1769 '[:^lower:]' => '${Elatin3::not_lower}',
1770 '[:^print:]' => '${Elatin3::not_print}',
1771 '[:^punct:]' => '${Elatin3::not_punct}',
1772 '[:^space:]' => '${Elatin3::not_space}',
1773 '[:^upper:]' => '${Elatin3::not_upper}',
1774 '[:^word:]' => '${Elatin3::not_word}',
1775 '[:^xdigit:]' => '${Elatin3::not_xdigit}',
1776  
1777 70 }->{$1};
1778 }
1779 elsif ($char[$i] =~ /\A \\ ($q_char) \z/oxms) {
1780 7 $char[$i] = $1;
1781 }
1782 }
1783  
1784 # open character list
1785 650 my @singleoctet = ();
1786 650 my @multipleoctet = ();
1787 650 ▶ for (my $i=0; $i <= $#char; ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1527 650 2177
1788  
1789 # escaped -
1790 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
1791 246 $i += 1;
1792 246 next;
1793 }
1794  
1795 # make range regexp
1796 elsif ($char[$i] eq '...') {
1797  
1798 # range error
1799 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
1800 0 croak 'Invalid [] range in regexp (length(A) > length(B)) ' . '\x' . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]);
1801 }
1802 elsif (CORE::length($char[$i-1]) == CORE::length($char[$i+1])) {
1803 246 ▶ if ($char[$i-1] gt $char[$i+1]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i - 1] gt $char[$i + 1]) 0 246 246
1804 0 croak 'Invalid [] range in regexp (CORE::ord(A) > CORE::ord(B)) ' . '\x' . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]);
1805 }
1806 }
1807  
1808 # make range regexp per length
1809 246 for my $length (CORE::length($char[$i-1]) .. CORE::length($char[$i+1])) {
1810 246 my @regexp = ();
1811  
1812 # is first and last
1813 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
1814 246 push @regexp, _range_regexp($length, $char[$i-1], $char[$i+1]);
1815 }
1816  
1817 # is first
1818 elsif ($length == CORE::length($char[$i-1])) {
1819 0 push @regexp, _range_regexp($length, $char[$i-1], "\xFF" x $length);
1820 }
1821  
1822 # is inside in first and last
1823 ▶ 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
1824 0 push @regexp, _range_regexp($length, "\x00" x $length, "\xFF" x $length);
1825 }
1826  
1827 # is last
1828 elsif ($length == CORE::length($char[$i+1])) {
1829 0 push @regexp, _range_regexp($length, "\x00" x $length, $char[$i+1]);
1830 }
1831  
1832 else {
1833 0 die __FILE__, ": subroutine make_regexp panic.\n";
1834 }
1835  
1836 246 ▶ if ($length == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length == 1) { } 246 0 246
1837 246 push @singleoctet, @regexp;
1838 }
1839 else {
1840 0 push @multipleoctet, @regexp;
1841 }
1842 }
1843  
1844 246 $i += 2;
1845 }
1846  
1847 # with /i modifier
1848 elsif ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) {
1849 949 ▶ if ($modifier =~ /i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) { } 480 469 949
1850 480 my $uc = Elatin3::uc($char[$i]);
1851 480 my $fc = Elatin3::fc($char[$i]);
1852 480 ▶ if ($uc ne $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc ne $fc) { } 240 240 480
1853 240 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 240 0 240
1854 240 push @singleoctet, $uc, $fc;
1855 }
1856 else {
1857 0 push @singleoctet, $uc;
1858 0 push @multipleoctet, $fc;
1859 }
1860 }
1861 else {
1862 240 push @singleoctet, $char[$i];
1863 }
1864 }
1865 else {
1866 469 push @singleoctet, $char[$i];
1867 }
1868 949 $i += 1;
1869 }
1870  
1871 # single character of single octet code
1872 elsif ($char[$i] =~ /\A (?: \\h ) \z/oxms) {
1873 0 push @singleoctet, "\t", "\x20";
1874 0 $i += 1;
1875 }
1876 elsif ($char[$i] =~ /\A (?: \\v ) \z/oxms) {
1877 0 push @singleoctet, "\x0A", "\x0B", "\x0C", "\x0D";
1878 0 $i += 1;
1879 }
1880 elsif ($char[$i] =~ /\A (?: \\d | \\s | \\w ) \z/oxms) {
1881 2 push @singleoctet, $char[$i];
1882 2 $i += 1;
1883 }
1884  
1885 # single character of multiple-octet code
1886 else {
1887 84 push @multipleoctet, $char[$i];
1888 84 $i += 1;
1889 }
1890 }
1891  
1892 # quote metachar
1893 650 for (@singleoctet) {
1894 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
1895 0 $_ = '-';
1896 }
1897 elsif (/\A \n \z/oxms) {
1898 8 $_ = '\n';
1899 }
1900 elsif (/\A \r \z/oxms) {
1901 8 $_ = '\r';
1902 }
1903 elsif (/\A ([\x00-\x20\x7F-\xFF]) \z/oxms) {
1904 744 $_ = sprintf('\x%02X', CORE::ord $1);
1905 }
1906 elsif (/\A [\x00-\xFF] \z/oxms) {
1907 429 $_ = quotemeta $_;
1908 }
1909 }
1910  
1911 # return character list
1912 650 return \@singleoctet, \@multipleoctet;
1913 }
1914  
1915 #
1916 # Latin-3 octal escape sequence
1917 #
1918 5 ▶sub octchr {
Subroutine octchr: called CC=2 SCAR=6.9
Pod undocumented
1919 5 my($octdigit) = @_;
1920  
1921 5 my @binary = ();
1922 5 for my $octal (split(//,$octdigit)) {
1923 push @binary, {
1924 '0' => '000',
1925 '1' => '001',
1926 '2' => '010',
1927 '3' => '011',
1928 '4' => '100',
1929 '5' => '101',
1930 '6' => '110',
1931 '7' => '111',
1932 50 }->{$octal};
1933 }
1934 5 my $binary = join '', @binary;
1935  
1936 my $octchr = {
1937 # 1234567
1938 1 => pack('B*', "0000000$binary"),
1939 2 => pack('B*', "000000$binary"),
1940 3 => pack('B*', "00000$binary"),
1941 4 => pack('B*', "0000$binary"),
1942 5 => pack('B*', "000$binary"),
1943 6 => pack('B*', "00$binary"),
1944 7 => pack('B*', "0$binary"),
1945 0 => pack('B*', "$binary"),
1946  
1947 5 }->{CORE::length($binary) % 8};
1948  
1949 5 return $octchr;
1950 }
1951  
1952 #
1953 # Latin-3 hexadecimal escape sequence
1954 #
1955 5 ▶sub hexchr {
Subroutine hexchr: called CC=1 SCAR=0.0
Pod undocumented
1956 5 my($hexdigit) = @_;
1957  
1958 my $hexchr = {
1959 1 => pack('H*', "0$hexdigit"),
1960 0 => pack('H*', "$hexdigit"),
1961  
1962 5 }->{CORE::length($_[0]) % 2};
1963  
1964 5 return $hexchr;
1965 }
1966  
1967 #
1968 # Latin-3 open character list for qr
1969 #
1970 576 ▶sub charlist_qr {
Subroutine charlist_qr: called CC=17 SCAR=28.7
Pod undocumented
1971  
1972 576 my $modifier = pop @_;
1973 576 my @char = @_;
1974  
1975 576 my($singleoctet, $multipleoctet) = _charlist(@char, $modifier);
1976 576 my @singleoctet = @$singleoctet;
1977 576 my @multipleoctet = @$multipleoctet;
1978  
1979 # return character list
1980 576 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) 498 78 576
1981  
1982 # with /i modifier
1983 498 ▶ if ($modifier =~ m/i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) 265 233 498
1984 265 my %singleoctet_ignorecase = ();
1985 265 for (@singleoctet) {
1986 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
1987 745 for my $ord (hex($1) .. hex($2)) {
1988 795 my $char = CORE::chr($ord);
1989 795 my $uc = Elatin3::uc($char);
1990 795 my $fc = Elatin3::fc($char);
1991 795 ▶ if ($uc eq $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc eq $fc) { } 240 555 795
1992 240 $singleoctet_ignorecase{unpack 'C*', $char} = 1;
1993 }
1994 else {
1995 555 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 555 0 555
1996 555 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
1997 555 $singleoctet_ignorecase{unpack 'C*', $fc} = 1;
1998 }
1999 else {
2000 0 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2001 0 push @multipleoctet, join '', map {sprintf('\x%02X',$_)} unpack 'C*', $fc;
2002 }
2003 }
2004 }
2005 }
2006 745 ▶ if ($_ ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ ne "") 0 745 745
2007 0 $singleoctet_ignorecase{unpack 'C*', $_} = 1;
2008 }
2009 }
2010 265 my $i = 0;
2011 265 my @singleoctet_ignorecase = ();
2012 265 for my $ord (0 .. 255) {
2013 67840 ▶ if (exists $singleoctet_ignorecase{$ord}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $singleoctet_ignorecase{$ord}) { } 870 66970 67840
2014 870 push @{$singleoctet_ignorecase[$i]}, $ord;
2015 }
2016 else {
2017 66970 $i++;
2018 }
2019 }
2020 265 @singleoctet = ();
2021 265 for my $range (@singleoctet_ignorecase) {
2022 56160 ▶ if (ref $range) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $range) 770 55390 56160
2023 770 ▶ if (scalar(@{$range}) == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @{$range;} == 1) { } 720 50 770
elsif (scalar @{$range;} == 2) { } 0 50 50
2024 720 push @singleoctet, sprintf('\x%02X', @{$range}[0]);
2025 }
2026 50 elsif (scalar(@{$range}) == 2) {
2027 0 push @singleoctet, sprintf('\x%02X\x%02X', @{$range}[0], @{$range}[-1]);
2028 }
2029 else {
2030 50 push @singleoctet, sprintf('\x%02X-\x%02X', @{$range}[0], @{$range}[-1]);
2031 }
2032 }
2033 }
2034 }
2035  
2036 498 my $not_anchor = '';
2037  
2038 498 push @multipleoctet, join('', $not_anchor, '[', @singleoctet, ']' );
2039 }
2040 576 ▶ if (scalar(@multipleoctet) >= 2) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @multipleoctet >= 2) { } 6 570 576
2041 6 return '(?:' . join('|', @multipleoctet) . ')';
2042 }
2043 else {
2044 570 return $multipleoctet[0];
2045 }
2046 }
2047  
2048 #
2049 # Latin-3 open character list for not qr
2050 #
2051 74 ▶sub charlist_not_qr {
Subroutine charlist_not_qr: called CC=18 SCAR=33.1
Pod undocumented
2052  
2053 74 my $modifier = pop @_;
2054 74 my @char = @_;
2055  
2056 74 my($singleoctet, $multipleoctet) = _charlist(@char, $modifier);
2057 74 my @singleoctet = @$singleoctet;
2058 74 my @multipleoctet = @$multipleoctet;
2059  
2060 # with /i modifier
2061 74 ▶ if ($modifier =~ m/i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) 25 49 74
2062 25 my %singleoctet_ignorecase = ();
2063 25 for (@singleoctet) {
2064 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
2065 25 for my $ord (hex($1) .. hex($2)) {
2066 75 my $char = CORE::chr($ord);
2067 75 my $uc = Elatin3::uc($char);
2068 75 my $fc = Elatin3::fc($char);
2069 75 ▶ if ($uc eq $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc eq $fc) { } 0 75 75
2070 0 $singleoctet_ignorecase{unpack 'C*', $char} = 1;
2071 }
2072 else {
2073 75 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 75 0 75
2074 75 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2075 75 $singleoctet_ignorecase{unpack 'C*', $fc} = 1;
2076 }
2077 else {
2078 0 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2079 0 push @multipleoctet, join '', map {sprintf('\x%02X',$_)} unpack 'C*', $fc;
2080 }
2081 }
2082 }
2083 }
2084 25 ▶ if ($_ ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ ne "") 0 25 25
2085 0 $singleoctet_ignorecase{unpack 'C*', $_} = 1;
2086 }
2087 }
2088 25 my $i = 0;
2089 25 my @singleoctet_ignorecase = ();
2090 25 for my $ord (0 .. 255) {
2091 6400 ▶ if (exists $singleoctet_ignorecase{$ord}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $singleoctet_ignorecase{$ord}) { } 150 6250 6400
2092 150 push @{$singleoctet_ignorecase[$i]}, $ord;
2093 }
2094 else {
2095 6250 $i++;
2096 }
2097 }
2098 25 @singleoctet = ();
2099 25 for my $range (@singleoctet_ignorecase) {
2100 2400 ▶ if (ref $range) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $range) 50 2350 2400
2101 50 ▶ if (scalar(@{$range}) == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @{$range;} == 1) { } 0 50 50
elsif (scalar @{$range;} == 2) { } 0 50 50
2102 0 push @singleoctet, sprintf('\x%02X', @{$range}[0]);
2103 }
2104 50 elsif (scalar(@{$range}) == 2) {
2105 0 push @singleoctet, sprintf('\x%02X\x%02X', @{$range}[0], @{$range}[-1]);
2106 }
2107 else {
2108 50 push @singleoctet, sprintf('\x%02X-\x%02X', @{$range}[0], @{$range}[-1]);
2109 }
2110 }
2111 }
2112 }
2113  
2114 # return character list
2115 74 ▶ if (scalar(@multipleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @multipleoctet >= 1) { } 0 74 74
2116 0 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) { } 0 0 0
2117  
2118 # any character other than multiple-octet and single octet character class
2119 0 return '(?!' . join('|', @multipleoctet) . ')(?:[^' . join('', @singleoctet) . '])';
2120 }
2121 else {
2122  
2123 # any character other than multiple-octet character class
2124 0 return '(?!' . join('|', @multipleoctet) . ")(?:$your_char)";
2125 }
2126 }
2127 else {
2128 74 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) { } 74 0 74
2129  
2130 # any character other than single octet character class
2131 74 return '(?:[^' . join('', @singleoctet) . '])';
2132 }
2133 else {
2134  
2135 # any character
2136 0 return "(?:$your_char)";
2137 }
2138 }
2139 }
2140  
2141 #
2142 # open file in read mode
2143 #
2144 424 ▶sub _open_r {
Subroutine _open_r: called CC=1 SCAR=0.0
2145 424 my(undef,$file) = @_;
2146 424 ▶ use Fcntl qw(O_RDONLY);
Subroutine BEGIN: called CC=1 SCAR=0.0
2147 424 return CORE::sysopen($_[0], $file, &O_RDONLY);
2148 }
2149  
2150 #
2151 # open file in append mode
2152 #
2153 212 ▶sub _open_a {
Subroutine _open_a: called CC=1 SCAR=0.0
2154 212 my(undef,$file) = @_;
2155 424 ▶ use Fcntl qw(O_WRONLY O_APPEND O_CREAT);
Subroutine BEGIN: called CC=1 SCAR=0.0
2156 212 return CORE::sysopen($_[0], $file, &O_WRONLY|&O_APPEND|&O_CREAT);
2157 }
2158  
2159 #
2160 # safe system
2161 #
2162 212 ▶sub _systemx {
Subroutine _systemx: called CC=1 SCAR=0.0
2163  
2164 # P.707 29.2.33. exec
2165 # in Chapter 29: Functions
2166 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2167 #
2168 # Be aware that in older releases of Perl, exec (and system) did not flush
2169 # your output buffer, so you needed to enable command buffering by setting $|
2170 # on one or more filehandles to avoid lost output in the case of exec, or
2171 # misordererd output in the case of system. This situation was largely remedied
2172 # in the 5.6 release of Perl. (So, 5.005 release not yet.)
2173  
2174 # P.855 exec
2175 # in Chapter 27: Functions
2176 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2177 #
2178 # In very old release of Perl (before v5.6), exec (and system) did not flush
2179 # your output buffer, so you needed to enable command buffering by setting $|
2180 # on one or more filehandles to avoid lost output with exec or misordered
2181 # output with system.
2182  
2183 212 $| = 1;
2184  
2185 # P.565 23.1.2. Cleaning Up Your Environment
2186 # in Chapter 23: Security
2187 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2188  
2189 # P.656 Cleaning Up Your Environment
2190 # in Chapter 20: Security
2191 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2192  
2193 # local $ENV{'PATH'} = '.';
2194 212 local @ENV{qw(IFS CDPATH ENV BASH_ENV)}; # Make %ENV safer
2195  
2196 # P.707 29.2.33. exec
2197 # in Chapter 29: Functions
2198 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2199 #
2200 # As we mentioned earlier, exec treats a discrete list of arguments as an
2201 # indication that it should bypass shell processing. However, there is one
2202 # place where you might still get tripped up. The exec call (and system, too)
2203 # will not distinguish between a single scalar argument and an array containing
2204 # only one element.
2205 #
2206 # @args = ("echo surprise"); # just one element in list
2207 # exec @args # still subject to shell escapes
2208 # or die "exec: $!"; # because @args == 1
2209 #
2210 # To avoid this, you can use the PATHNAME syntax, explicitly duplicating the
2211 # first argument as the pathname, which forces the rest of the arguments to be
2212 # interpreted as a list, even if there is only one of them:
2213 #
2214 # exec { $args[0] } @args # safe even with one-argument list
2215 # or die "can't exec @args: $!";
2216  
2217 # P.855 exec
2218 # in Chapter 27: Functions
2219 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2220 #
2221 # As we mentioned earlier, exec treats a discrete list of arguments as a
2222 # directive to bypass shell processing. However, there is one place where
2223 # you might still get tripped up. The exec call (and system, too) cannot
2224 # distinguish between a single scalar argument and an array containing
2225 # only one element.
2226 #
2227 # @args = ("echo surprise"); # just one element in list
2228 # exec @args # still subject to shell escapes
2229 # || die "exec: $!"; # because @args == 1
2230 #
2231 # To avoid this, use the PATHNAME syntax, explicitly duplicating the first
2232 # argument as the pathname, which forces the rest of the arguments to be
2233 # interpreted as a list, even if there is only one of them:
2234 #
2235 # exec { $args[0] } @args # safe even with one-argument list
2236 # || die "can't exec @args: $!";
2237  
2238 212 return CORE::system { $_[0] } @_; # safe even with one-argument list
2239 }
2240  
2241 #
2242 # Latin-3 order to character (with parameter)
2243 #
2244 3469 ▶sub Elatin3::chr(;$) {
Subroutine chr: called CC=4 SCAR=13.9
Pod undocumented
2245  
2246 3469 ▶ my $c = @_ ? $_[0] : $_;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 3469 0 3469
2247  
2248 3469 ▶ if ($c == 0x00) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c == 0) { } 24 3445 3469
2249 24 return "\x00";
2250 }
2251 else {
2252 3445 my @chr = ();
2253 3445 ▶ while ($c > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c > 0) 3445 3445 6890
2254 3445 unshift @chr, ($c % 0x100);
2255 3445 $c = int($c / 0x100);
2256 }
2257 3445 return pack 'C*', @chr;
2258 }
2259 }
2260  
2261 #
2262 # Latin-3 order to character (without parameter)
2263 #
2264 0 ▶sub Elatin3::chr_() {
Subroutine chr_: not called CC=3 SCAR=24.8
Pod undocumented
2265  
2266 0 my $c = $_;
2267  
2268 0 ▶ if ($c == 0x00) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c == 0) { } 0 0 0
2269 0 return "\x00";
2270 }
2271 else {
2272 0 my @chr = ();
2273 0 ▶ while ($c > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c > 0) 0 0 0
2274 0 unshift @chr, ($c % 0x100);
2275 0 $c = int($c / 0x100);
2276 }
2277 0 return pack 'C*', @chr;
2278 }
2279 }
2280  
2281 #
2282 # Latin-3 path globbing (with parameter)
2283 #
2284 0 ▶sub Elatin3::glob($) {
Subroutine glob: not called CC=3 SCAR=24.8
Pod undocumented
2285  
2286 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2287 0 my @glob = _DOS_like_glob(@_);
2288 0 for my $glob (@glob) {
2289 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2290 }
2291 0 return @glob;
2292 }
2293 else {
2294 0 my $glob = _DOS_like_glob(@_);
2295 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2296 0 return $glob;
2297 }
2298 }
2299  
2300 #
2301 # Latin-3 path globbing (without parameter)
2302 #
2303 0 ▶sub Elatin3::glob_() {
Subroutine glob_: not called CC=3 SCAR=24.8
Pod undocumented
2304  
2305 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2306 0 my @glob = _DOS_like_glob();
2307 0 for my $glob (@glob) {
2308 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2309 }
2310 0 return @glob;
2311 }
2312 else {
2313 0 my $glob = _DOS_like_glob();
2314 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2315 0 return $glob;
2316 }
2317 }
2318  
2319 #
2320 # Latin-3 path globbing via File::DosGlob 1.10
2321 #
2322 # Often I confuse "_dosglob" and "_doglob".
2323 # So, I renamed "_dosglob" to "_DOS_like_glob".
2324 #
2325 424 my %iter;
2326 my %entries;
2327 0 ▶sub _DOS_like_glob {
Subroutine _DOS_like_glob: not called CC=10 SCAR=47.0
2328  
2329 # context (keyed by second cxix argument provided by core)
2330 0 my($expr,$cxix) = @_;
2331  
2332 # glob without args defaults to $_
2333 0 ▶ $expr = $_ if not defined $expr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $expr 0 0 0
2334  
2335 # represents the current user's home directory
2336 #
2337 # 7.3. Expanding Tildes in Filenames
2338 # in Chapter 7. File Access
2339 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2340 #
2341 # and File::HomeDir, File::HomeDir::Windows module
2342  
2343 # DOS-like system
2344 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
2345 0 $expr =~ s{ \A ~ (?= [^/\\] ) }
2346 0 { my_home_MSWin32() }oxmse;
2347 }
2348  
2349 # UNIX-like system
2350 else {
2351 0 $expr =~ s{ \A ~ ( (?:[^/])* ) }
2352 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
2353 }
2354  
2355 # assume global context if not provided one
2356 0 ▶ $cxix = '_G_' if not defined $cxix;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $cxix 0 0 0
2357 0 ▶ $iter{$cxix} = 0 if not exists $iter{$cxix};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $iter{$cxix} 0 0 0
2358  
2359 # if we're just beginning, do it all first
2360 0 ▶ if ($iter{$cxix} == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iter{$cxix} == 0) 0 0 0
2361 0 $entries{$cxix} = [ _do_glob(1, _parse_line($expr)) ];
2362 }
2363  
2364 # chuck it all out, quick or slow
2365 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2366 0 delete $iter{$cxix};
2367 0 return @{delete $entries{$cxix}};
2368 }
2369 else {
2370 0 ▶ if ($iter{$cxix} = scalar @{$entries{$cxix}}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iter{$cxix} = scalar @{$entries{$cxix};}) { } 0 0 0
2371 0 return shift @{$entries{$cxix}};
2372 }
2373 else {
2374 # return undef for EOL
2375 0 delete $iter{$cxix};
2376 0 delete $entries{$cxix};
2377 0 return undef;
2378 }
2379 }
2380 }
2381  
2382 #
2383 # Latin-3 path globbing subroutine
2384 #
2385 0 ▶sub _do_glob {
Subroutine _do_glob: not called CC=44 SCAR=75.9
2386  
2387 0 my($cond,@expr) = @_;
2388 0 my @glob = ();
2389 0 my $fix_drive_relative_paths = 0;
2390  
2391 OUTER:
2392 0 for my $expr (@expr) {
2393 0 ▶ next OUTER if not defined $expr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $expr 0 0 0
2394 0 ▶ next OUTER if $expr eq '';
Branch: 1 branch
BranchTrueFalseTotal
if $expr eq "" 0 0 0
2395  
2396 0 my @matched = ();
2397 0 my @globdir = ();
2398 0 my $head = '.';
2399 0 my $pathsep = '/';
2400 0 my $tail;
2401  
2402 # if argument is within quotes strip em and do no globbing
2403 0 ▶ if ($expr =~ /\A " ((?:$q_char)*?) " \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expr =~ /\A " ((?:$Elatin3::q_char)*?) " \z/mosx) 0 0 0
2404 0 $expr = $1;
2405 0 ▶ if ($cond eq 'd') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cond eq 'd') { } 0 0 0
2406 0 ▶ if (-d $expr) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $expr) 0 0 0
2407 0 push @glob, $expr;
2408 }
2409 }
2410 else {
2411 0 ▶ if (-e $expr) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $expr) 0 0 0
2412 0 push @glob, $expr;
2413 }
2414 }
2415 0 next OUTER;
2416 }
2417  
2418 # wildcards with a drive prefix such as h:*.pm must be changed
2419 # to h:./*.pm to expand correctly
2420 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
2421 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
2422 0 $fix_drive_relative_paths = 1;
2423 }
2424 }
2425  
2426 0 ▶ if (($head, $tail) = _parse_path($expr,$pathsep)) {
Branch: 1 branch
BranchTrueFalseTotal
if (($head, $tail) = _parse_path($expr, $pathsep)) 0 0 0
2427 0 ▶ if ($tail eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($tail eq "") 0 0 0
2428 0 push @glob, $expr;
2429 0 next OUTER;
2430 }
2431 0 ▶ if ($head =~ / \A (?:$q_char)*? [*?] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head =~ / \A (?:$Elatin3::q_char)*? [*?] /mosx) 0 0 0
2432 0 ▶ if (@globdir = _do_glob('d', $head)) {
Branch: 1 branch
BranchTrueFalseTotal
if (@globdir = _do_glob("d", $head)) 0 0 0
2433 0 push @glob, _do_glob($cond, map {"$_$pathsep$tail"} @globdir);
2434 0 next OUTER;
2435 }
2436 }
2437 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
2438 0 $head .= $pathsep;
2439 }
2440 0 $expr = $tail;
2441 }
2442  
2443 # If file component has no wildcards, we can avoid opendir
2444 0 ▶ if ($expr !~ / \A (?:$q_char)*? [*?] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($expr =~ / \A (?:$Elatin3::q_char)*? [*?] /mosx) 0 0 0
2445 0 ▶ if ($head eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($head eq ".") 0 0 0
2446 0 $head = '';
2447 }
2448 0 ▶ if ($head ne '' and ($head =~ / \G ($q_char) /oxmsg)[-1] ne $pathsep) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head ne "" and ($head =~ / \G ($Elatin3::q_char) /gmosx)[-1] ne $pathsep) 0 0 0
Condition0%0/3
$head ne "" and ($head =~ / \G ($Elatin3::q_char) /gmosx)[-1] ne $pathsep
!ll&&!rl&&r
000
MC/DC0%0/2
$head ne "" and ($head =~ / \G ($Elatin3::q_char) /gmosx)[-1] ne $pathsep
$head ne "" ($head =~ / \G ($Elatin3::q_char) /gmosx)[-1] ne $pathsep
Truth table0%0/3
A and B
A= $head ne ""B= ($head =~ / \G ($Elatin3::q_char) /gmosx)[-1] ne $pathsep
ABresult
0X0
100
111
2449 0 $head .= $pathsep;
2450 }
2451 0 $head .= $expr;
2452 0 ▶ if ($cond eq 'd') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cond eq 'd') { } 0 0 0
2453 0 ▶ if (-d $head) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $head) 0 0 0
2454 0 push @glob, $head;
2455 }
2456 }
2457 else {
2458 0 ▶ if (-e $head) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $head) 0 0 0
2459 0 push @glob, $head;
2460 }
2461 }
2462 0 next OUTER;
2463 }
2464 0 ▶ opendir(*DIR, $head) or next OUTER;
Branch: 1 branch
BranchTrueFalseTotal
opendir *DIR, $head or next OUTER 0 0 0
2465 0 my @leaf = readdir DIR;
2466 0 closedir DIR;
2467  
2468 0 ▶ if ($head eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($head eq ".") 0 0 0
2469 0 $head = '';
2470 }
2471 0 ▶ if ($head ne '' and ($head =~ / \G ($q_char) /oxmsg)[-1] ne $pathsep) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head ne "" and ($head =~ / \G ($Elatin3::q_char) /gmosx)[-1] ne $pathsep) 0 0 0
Condition0%0/3
$head ne "" and ($head =~ / \G ($Elatin3::q_char) /gmosx)[-1] ne $pathsep
!ll&&!rl&&r
000
MC/DC0%0/2
$head ne "" and ($head =~ / \G ($Elatin3::q_char) /gmosx)[-1] ne $pathsep
$head ne "" ($head =~ / \G ($Elatin3::q_char) /gmosx)[-1] ne $pathsep
Truth table0%0/3
A and B
A= $head ne ""B= ($head =~ / \G ($Elatin3::q_char) /gmosx)[-1] ne $pathsep
ABresult
0X0
100
111
2472 0 $head .= $pathsep;
2473 }
2474  
2475 0 my $pattern = '';
2476 0 ▶ while ($expr =~ / \G ($q_char) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expr =~ / \G ($Elatin3::q_char) /cgox) 0 0 0
2477 0 my $char = $1;
2478  
2479 # 6.9. Matching Shell Globs as Regular Expressions
2480 # in Chapter 6. Pattern Matching
2481 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2482 # (and so on)
2483  
2484 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
2485 0 $pattern .= "(?:$your_char)*",
2486 }
2487 elsif ($char eq '?') {
2488 0 $pattern .= "(?:$your_char)?", # DOS style
2489 # $pattern .= "(?:$your_char)", # UNIX style
2490 }
2491 elsif ((my $fc = Elatin3::fc($char)) ne $char) {
2492 0 $pattern .= $fc;
2493 }
2494 else {
2495 0 $pattern .= quotemeta $char;
2496 }
2497 }
2498 0 ▶ my $matchsub = sub { Elatin3::fc($_[0]) =~ /\A $pattern \z/xms };
Subroutine __ANON__: not called CC=1 SCAR=6.9
2499  
2500 # if ($@) {
2501 # print STDERR "$0: $@\n";
2502 # next OUTER;
2503 # }
2504  
2505 INNER:
2506 0 for my $leaf (@leaf) {
2507 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
2508 0 next INNER;
2509 }
2510 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
2511 0 next INNER;
2512 }
2513  
2514 0 ▶ if (&$matchsub($leaf)) {
Branch: 1 branch
BranchTrueFalseTotal
if (&$matchsub($leaf)) 0 0 0
2515 0 push @matched, "$head$leaf";
2516 0 next INNER;
2517 }
2518  
2519 # [DOS compatibility special case]
2520 # Failed, add a trailing dot and try again, but only...
2521  
2522 0 ▶ if (Elatin3::index($leaf,'.') == -1 and # if name does not have a dot in it *and*
Branch: 1 branch
BranchTrueFalseTotal
if (&Elatin3::index($leaf, ".") == -1 and length $leaf <= 8 and &Elatin3::index($pattern, "\\.") != -1) 0 0 0
Condition0%0/6
&Elatin3::index($leaf, ".") == -1 and length $leaf <= 8 and &Elatin3::index($pattern, "\\.") != -1
!ll&&!rl&&r
000
&Elatin3::index($leaf, ".") == -1 and length $leaf <= 8
!ll&&!rl&&r
000
MC/DC0%0/3
&Elatin3::index($leaf, ".") == -1 and length $leaf <= 8 and &Elatin3::index($pattern, "\\.") != -1
&Elatin3::index($leaf, ".") == -1 length $leaf <= 8 &Elatin3::index($pattern, "\\.") != -1
Truth table0%0/4
A and B and C
A= &Elatin3::index($leaf, ".") == -1B= length $leaf <= 8C= &Elatin3::index($pattern, "\\.") != -1
ABCresult
0XX0
10X0
1100
1111
2523 CORE::length($leaf) <= 8 and # name is shorter than or equal to 8 chars *and*
2524 Elatin3::index($pattern,'\\.') != -1 # pattern has a dot.
2525 ) {
2526 0 ▶ if (&$matchsub("$leaf.")) {
Branch: 1 branch
BranchTrueFalseTotal
if (&$matchsub("$leaf.")) 0 0 0
2527 0 push @matched, "$head$leaf";
2528 0 next INNER;
2529 }
2530 }
2531 }
2532 0 ▶ if (@matched) {
Branch: 1 branch
BranchTrueFalseTotal
if (@matched) 0 0 0
2533 0 push @glob, @matched;
2534 }
2535 }
2536 0 ▶ if ($fix_drive_relative_paths) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fix_drive_relative_paths) 0 0 0
2537 0 for my $glob (@glob) {
2538 0 $glob =~ s# \A ([A-Za-z]:) \./ #$1#oxms;
2539 }
2540 }
2541 0 return @glob;
2542 }
2543  
2544 #
2545 # Latin-3 parse line
2546 #
2547 0 ▶sub _parse_line {
Subroutine _parse_line: not called CC=3 SCAR=24.8
2548  
2549 0 my($line) = @_;
2550  
2551 0 $line .= ' ';
2552 0 my @piece = ();
2553 0 ▶ while ($line =~ /
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ / " ( (?>(?: [^"] )* ) ) " (?>\s+) | ( (?>(?: [^"\s] )* ) ) (?>\s+) /gmosx) 0 0 0
2554 " ( (?>(?: [^"] )* ) ) " (?>\s+) |
2555 ( (?>(?: [^"\s] )* ) ) (?>\s+)
2556 /oxmsg
2557 ) {
2558 0 ▶ push @piece, defined($1) ? $1 : $2;
Branch: 1 branch
BranchTrueFalseTotal
defined $1 ? : 0 0 0
2559 }
2560 0 return @piece;
2561 }
2562  
2563 #
2564 # Latin-3 parse path
2565 #
2566 0 ▶sub _parse_path {
Subroutine _parse_path: not called CC=2 SCAR=17.9
2567  
2568 0 my($path,$pathsep) = @_;
2569  
2570 0 $path .= '/';
2571 0 my @subpath = ();
2572 0 ▶ while ($path =~ /
Branch: 1 branch
BranchTrueFalseTotal
if ($path =~ m( ((?: [^/\\] )+?) [/\\] )gmosx) 0 0 0
2573 ((?: [^\/\\] )+?) [\/\\]
2574 /oxmsg
2575 ) {
2576 0 push @subpath, $1;
2577 }
2578  
2579 0 my $tail = pop @subpath;
2580 0 my $head = join $pathsep, @subpath;
2581 0 return $head, $tail;
2582 }
2583  
2584 #
2585 # via File::HomeDir::Windows 1.00
2586 #
2587 0 ▶sub my_home_MSWin32 {
Subroutine my_home_MSWin32: not called CC=9 SCAR=45.0
Pod undocumented
2588  
2589 # A lot of unix people and unix-derived tools rely on
2590 # the ability to overload HOME. We will support it too
2591 # so that they can replace raw HOME calls with File::HomeDir.
2592 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
2593 0 return $ENV{'HOME'};
2594 }
2595  
2596 # Do we have a user profile?
2597 ▶ 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
2598 0 return $ENV{'USERPROFILE'};
2599 }
2600  
2601 # Some Windows use something like $ENV{'HOME'}
2602 ▶ 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
2603 0 return join '', $ENV{'HOMEDRIVE'}, $ENV{'HOMEPATH'};
2604 }
2605  
2606 0 return undef;
2607 }
2608  
2609 #
2610 # via File::HomeDir::Unix 1.00
2611 #
2612 0 ▶sub my_home {
Subroutine my_home: not called CC=7 SCAR=40.3
Pod undocumented
2613 0 my $home;
2614  
2615 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
2616 0 $home = $ENV{'HOME'};
2617 }
2618  
2619 # This is from the original code, but I'm guessing
2620 # it means "login directory" and exists on some Unixes.
2621 ▶ 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
2622 0 $home = $ENV{'LOGDIR'};
2623 }
2624  
2625 ### More-desperate methods
2626  
2627 # Light desperation on any (Unixish) platform
2628 else {
2629 0 $home = CORE::eval q{ (getpwuid($<))[7] };
2630 }
2631  
2632 # On Unix in general, a non-existant home means "no home"
2633 # For example, "nobody"-like users might use /nonexistant
2634 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
2635 0 $home = undef;
2636 }
2637 0 return $home;
2638 }
2639  
2640 #
2641 # ${^PREMATCH}, $PREMATCH, $` the string preceding what was matched
2642 #
2643 56 ▶sub Elatin3::PREMATCH {
Subroutine PREMATCH: called CC=1 SCAR=0.0
Pod undocumented
2644 56 return $`;
2645 }
2646  
2647 #
2648 # ${^MATCH}, $MATCH, $& the string that matched
2649 #
2650 81 ▶sub Elatin3::MATCH {
Subroutine MATCH: called CC=1 SCAR=0.0
Pod undocumented
2651 81 return $&;
2652 }
2653  
2654 #
2655 # ${^POSTMATCH}, $POSTMATCH, $' the string following what was matched
2656 #
2657 42 ▶sub Elatin3::POSTMATCH {
Subroutine POSTMATCH: called CC=1 SCAR=0.0
Pod undocumented
2658 42 return $';
2659 }
2660  
2661 #
2662 # Latin-3 character to order (with parameter)
2663 #
2664 0 ▶sub Latin3::ord(;$) {
Subroutine ord: not called CC=4 SCAR=30.0
2665  
2666 0 ▶ local $_ = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
2667  
2668 0 ▶ if (/\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\A ($Elatin3::q_char) /mosx) { } 0 0 0
2669 0 my @ord = unpack 'C*', $1;
2670 0 my $ord = 0;
2671 0 ▶ while (my $o = shift @ord) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $o = shift @ord) 0 0 0
2672 0 $ord = $ord * 0x100 + $o;
2673 }
2674 0 return $ord;
2675 }
2676 else {
2677 0 return CORE::ord $_;
2678 }
2679 }
2680  
2681 #
2682 # Latin-3 character to order (without parameter)
2683 #
2684 0 ▶sub Latin3::ord_() {
Subroutine ord_: not called CC=3 SCAR=24.8
2685  
2686 0 ▶ if (/\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\A ($Elatin3::q_char) /mosx) { } 0 0 0
2687 0 my @ord = unpack 'C*', $1;
2688 0 my $ord = 0;
2689 0 ▶ while (my $o = shift @ord) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $o = shift @ord) 0 0 0
2690 0 $ord = $ord * 0x100 + $o;
2691 }
2692 0 return $ord;
2693 }
2694 else {
2695 0 return CORE::ord $_;
2696 }
2697 }
2698  
2699 #
2700 # Latin-3 reverse
2701 #
2702 0 ▶sub Latin3::reverse(@) {
Subroutine reverse: not called CC=2 SCAR=17.9
2703  
2704 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2705 0 return CORE::reverse @_;
2706 }
2707 else {
2708  
2709 # One of us once cornered Larry in an elevator and asked him what
2710 # problem he was solving with this, but he looked as far off into
2711 # the distance as he could in an elevator and said, "It seemed like
2712 # a good idea at the time."
2713  
2714 0 return join '', CORE::reverse(join('',@_) =~ /\G ($q_char) /oxmsg);
2715 }
2716 }
2717  
2718 #
2719 # Latin-3 getc (with parameter, without parameter)
2720 #
2721 20 ▶sub Latin3::getc(;*@) {
Subroutine getc: called CC=9 SCAR=26.7
2722  
2723 20 my($package) = caller;
2724 20 ▶ my $fh = @_ ? qualify_to_ref(shift,$package) : \*STDIN;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 20 0 20
2725 20 ▶ croak 'Too many arguments for Latin3::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
2726  
2727 0 my @length = sort { $a <=> $b } keys %range_tr;
2728 20 my $getc = '';
2729 20 for my $length ($length[0] .. $length[-1]) {
2730 20 $getc .= CORE::getc($fh);
2731 20 ▶ if (exists $range_tr{CORE::length($getc)}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{length $getc}) 20 0 20
2732 20 ▶ if ($getc =~ /\A ${Elatin3::dot_s} \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($getc =~ /\A $Elatin3::dot_s \z/mosx) 20 0 20
2733 20 ▶ return wantarray ? ($getc,@_) : $getc;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 20 20
2734 }
2735 }
2736 }
2737 0 ▶ return wantarray ? ($getc,@_) : $getc;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
2738 }
2739  
2740 #
2741 # Latin-3 length by character
2742 #
2743 0 ▶sub Latin3::length(;$) {
Subroutine length: not called CC=2 SCAR=17.9
2744  
2745 0 ▶ local $_ = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
2746  
2747 0 local @_ = /\G ($q_char) /oxmsg;
2748 0 return scalar @_;
2749 }
2750  
2751 #
2752 # Latin-3 substr by character
2753 #
2754 424 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=7.0
2755  
2756 # P.232 The lvalue Attribute
2757 # in Chapter 6: Subroutines
2758 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2759  
2760 # P.336 The lvalue Attribute
2761 # in Chapter 7: Subroutines
2762 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2763  
2764 # P.144 8.4 Lvalue subroutines
2765 # in Chapter 8: perlsub: Perl subroutines
2766 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
2767  
2768 0 ▶ CORE::eval sprintf(<<'END', ($] >= 5.014000) ? ':lvalue' : '');
Subroutine __ANON__: not called CC=1 SCAR=0.0
Subroutine __ANON__: not called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: not called CC=1 SCAR=0.0
Subroutine substr: called CC=11 SCAR=24.3
Branch: 10 branches
BranchTrueFalseTotal
$] >= 5.014 ? : 424 0 424
if ($offset > scalar @char or $offset < -1 * scalar(@char)) 2 25 27
if (@_ == 4) { } 1 24 25
elsif (@_ == 3) { } 21 3 24
if ($offset == 0) { } 0 21 21
elsif ($offset > 0) { } 20 1 21
if ($length == 0) { } 0 21 21
elsif ($length > 0) { } 20 1 21
if ($offset == 0) { } 0 3 3
elsif ($offset > 0) { } 2 1 3
Condition66%2/3
$offset > scalar @char or $offset < -1 * scalar(@char)
l!l&&r!l&&!r
2025
MC/DC50%1/2
$offset > scalar @char or $offset < -1 * scalar(@char)
$offset > scalar @char $offset < -1 * scalar(@char)
Truth table66%2/3
A or B
A= $offset > scalar @charB= $offset < -1 * scalar(@char)
ABresult
1X1
011
000
2769 # vv----------------------*******
2770 sub Latin3::substr($$;$$) %s {
2771  
2772 my @char = $_[0] =~ /\G (?>$q_char) /oxmsg;
2773  
2774 # If the substring is beyond either end of the string, substr() returns the undefined
2775 # value and produces a warning. When used as an lvalue, specifying a substring that
2776 # is entirely outside the string raises an exception.
2777 # http://perldoc.perl.org/functions/substr.html
2778  
2779 # A return with no argument returns the scalar value undef in scalar context,
2780 # an empty list () in list context, and (naturally) nothing at all in void
2781 # context.
2782  
2783 my $offset = $_[1];
2784 if (($offset > scalar(@char)) or ($offset < (-1 * scalar(@char)))) {
2785 return;
2786 }
2787  
2788 # substr($string,$offset,$length,$replacement)
2789 if (@_ == 4) {
2790 my(undef,undef,$length,$replacement) = @_;
2791 my $substr = join '', splice(@char, $offset, $length, $replacement);
2792 $_[0] = join '', @char;
2793  
2794 # return $substr; this doesn't work, don't say "return"
2795 $substr;
2796 }
2797  
2798 # substr($string,$offset,$length)
2799 elsif (@_ == 3) {
2800 my(undef,undef,$length) = @_;
2801 my $octet_offset = 0;
2802 my $octet_length = 0;
2803 if ($offset == 0) {
2804 $octet_offset = 0;
2805 }
2806 elsif ($offset > 0) {
2807 local $SIG{__WARN__} = sub {}; # avoid: Use of uninitialized value in join or string at here
2808 $octet_offset = CORE::length(join '', @char[0..$offset-1]);
2809 }
2810 else {
2811 local $SIG{__WARN__} = sub {}; # avoid: Use of uninitialized value in join or string at here
2812 $octet_offset = -1 * CORE::length(join '', @char[$#char+$offset+1..$#char]);
2813 }
2814 if ($length == 0) {
2815 $octet_length = 0;
2816 }
2817 elsif ($length > 0) {
2818 local $SIG{__WARN__} = sub {}; # avoid: Use of uninitialized value in join or string at here
2819 $octet_length = CORE::length(join '', @char[$offset..$offset+$length-1]);
2820 }
2821 else {
2822 local $SIG{__WARN__} = sub {}; # avoid: Use of uninitialized value in join or string at here
2823 $octet_length = -1 * CORE::length(join '', @char[$#char+$length+1..$#char]);
2824 }
2825 CORE::substr($_[0], $octet_offset, $octet_length);
2826 }
2827  
2828 # substr($string,$offset)
2829 else {
2830 my $octet_offset = 0;
2831 if ($offset == 0) {
2832 $octet_offset = 0;
2833 }
2834 elsif ($offset > 0) {
2835 $octet_offset = CORE::length(join '', @char[0..$offset-1]);
2836 }
2837 else {
2838 $octet_offset = -1 * CORE::length(join '', @char[$#char+$offset+1..$#char]);
2839 }
2840 CORE::substr($_[0], $octet_offset);
2841 }
2842 }
2843 END
2844 }
2845  
2846 #
2847 # Latin-3 index by character
2848 #
2849 0 ▶sub Latin3::index($$;$) {
Subroutine index: not called CC=3 SCAR=24.8
2850  
2851 0 my $index;
2852 0 ▶ if (@_ == 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 3) { } 0 0 0
2853 0 $index = Elatin3::index($_[0], $_[1], CORE::length(Latin3::substr($_[0], 0, $_[2])));
2854 }
2855 else {
2856 0 $index = Elatin3::index($_[0], $_[1]);
2857 }
2858  
2859 0 ▶ if ($index == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($index == -1) { } 0 0 0
2860 0 return -1;
2861 }
2862 else {
2863 0 return Latin3::length(CORE::substr $_[0], 0, $index);
2864 }
2865 }
2866  
2867 #
2868 # Latin-3 rindex by character
2869 #
2870 0 ▶sub Latin3::rindex($$;$) {
Subroutine rindex: not called CC=3 SCAR=24.8
2871  
2872 0 my $rindex;
2873 0 ▶ if (@_ == 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 3) { } 0 0 0
2874 0 $rindex = Elatin3::rindex($_[0], $_[1], CORE::length(Latin3::substr($_[0], 0, $_[2])));
2875 }
2876 else {
2877 0 $rindex = Elatin3::rindex($_[0], $_[1]);
2878 }
2879  
2880 0 ▶ if ($rindex == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rindex == -1) { } 0 0 0
2881 0 return -1;
2882 }
2883 else {
2884 0 return Latin3::length(CORE::substr $_[0], 0, $rindex);
2885 }
2886 }
2887  
2888 # when 'm//', '/' means regexp match 'm//' and '?' means regexp match '??'
2889 # when 'div', '/' means division operator and '?' means conditional operator (condition ? then : else)
2890 424 ▶use vars qw($slash); $slash = 'm//';
Subroutine BEGIN: called CC=1 SCAR=0.0
2891  
2892 # ord() to ord() or Latin3::ord()
2893 424 my $function_ord = 'ord';
2894  
2895 # ord to ord or Latin3::ord_
2896 424 my $function_ord_ = 'ord';
2897  
2898 # reverse to reverse or Latin3::reverse
2899 424 my $function_reverse = 'reverse';
2900  
2901 # getc to getc or Latin3::getc
2902 424 my $function_getc = 'getc';
2903  
2904 # P.1023 Appendix W.9 Multibyte Anchoring
2905 # of ISBN 1-56592-224-7 CJKV Information Processing
2906  
2907 424 my $anchor = '';
2908  
2909 424 ▶use vars qw($nest);
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
2910  
2911 # regexp of nested parens in qqXX
2912  
2913 # P.340 Matching Nested Constructs with Embedded Code
2914 # in Chapter 7: Perl
2915 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
2916  
2917 my $qq_paren = qr{(?{local $nest=0}) (?>(?:
2918 [^\\()] |
2919 \( (?{$nest++}) |
2920 \) (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2921 \\ [^c] |
2922 \\c[\x40-\x5F] |
2923 [\x00-\xFF]
2924 424 }xms;
2925  
2926 my $qq_brace = qr{(?{local $nest=0}) (?>(?:
2927 [^\\{}] |
2928 \{ (?{$nest++}) |
2929 \} (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2930 \\ [^c] |
2931 \\c[\x40-\x5F] |
2932 [\x00-\xFF]
2933 424 }xms;
2934  
2935 my $qq_bracket = qr{(?{local $nest=0}) (?>(?:
2936 [^\\\[\]] |
2937 \[ (?{$nest++}) |
2938 \] (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2939 \\ [^c] |
2940 \\c[\x40-\x5F] |
2941 [\x00-\xFF]
2942 424 }xms;
2943  
2944 my $qq_angle = qr{(?{local $nest=0}) (?>(?:
2945 [^\\<>] |
2946 \< (?{$nest++}) |
2947 \> (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2948 \\ [^c] |
2949 \\c[\x40-\x5F] |
2950 [\x00-\xFF]
2951 424 }xms;
2952  
2953 424 my $qq_scalar = qr{(?: \{ (?:$qq_brace)*? \} |
2954 (?: ::)? (?:
2955 (?> [a-zA-Z_][a-zA-Z_0-9]* (?: ::[a-zA-Z_][a-zA-Z_0-9]*)* )
2956 (?>(?: \[ (?: \$\[ | \$\] | $qq_char )*? \] | \{ (?:$qq_brace)*? \} )*)
2957 (?>(?: (?: -> )? (?: [\$\@\%\&\*]\* | \$\#\* | [\@\%]? \[ (?: \$\[ | \$\] | $qq_char )*? \] | [\@\%\*]? \{ (?:$qq_brace)*? \} ) )*)
2958 ))
2959 }xms;
2960  
2961 424 my $qq_variable = qr{(?: \{ (?:$qq_brace)*? \} |
2962 (?: ::)? (?:
2963 (?>[0-9]+) |
2964 [^a-zA-Z_0-9\[\]] |
2965 ^[A-Z] |
2966 (?> [a-zA-Z_][a-zA-Z_0-9]* (?: ::[a-zA-Z_][a-zA-Z_0-9]*)* )
2967 (?>(?: \[ (?: \$\[ | \$\] | $qq_char )*? \] | \{ (?:$qq_brace)*? \} )*)
2968 (?>(?: (?: -> )? (?: [\$\@\%\&\*]\* | \$\#\* | [\@\%]? \[ (?: \$\[ | \$\] | $qq_char )*? \] | [\@\%\*]? \{ (?:$qq_brace)*? \} ) )*)
2969 ))
2970 }xms;
2971  
2972 424 my $qq_substr = qr{(?> Char::substr | Latin3::substr | CORE::substr | substr ) (?>\s*) \( $qq_paren \)
2973 }xms;
2974  
2975 # regexp of nested parens in qXX
2976 my $q_paren = qr{(?{local $nest=0}) (?>(?:
2977 [^()] |
2978 \( (?{$nest++}) |
2979 \) (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2980 [\x00-\xFF]
2981 424 }xms;
2982  
2983 my $q_brace = qr{(?{local $nest=0}) (?>(?:
2984 [^\{\}] |
2985 \{ (?{$nest++}) |
2986 \} (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2987 [\x00-\xFF]
2988 424 }xms;
2989  
2990 my $q_bracket = qr{(?{local $nest=0}) (?>(?:
2991 [^\[\]] |
2992 \[ (?{$nest++}) |
2993 \] (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2994 [\x00-\xFF]
2995 424 }xms;
2996  
2997 my $q_angle = qr{(?{local $nest=0}) (?>(?:
2998 [^<>] |
2999 \< (?{$nest++}) |
3000 \> (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
3001 [\x00-\xFF]
3002 424 }xms;
3003  
3004 424 my $matched = '';
3005 424 my $s_matched = '';
3006  
3007 424 my $tr_variable = ''; # variable of tr///
3008 424 my $sub_variable = ''; # variable of s///
3009 424 my $bind_operator = ''; # =~ or !~
3010  
3011 424 my @heredoc = (); # here document
3012 424 my @heredoc_delimiter = ();
3013 424 my $here_script = ''; # here script
3014  
3015 #
3016 # escape Latin-3 script
3017 #
3018 548 ▶sub Latin3::escape(;$) {
Subroutine escape: called CC=3 SCAR=11.0
3019 548 ▶ local($_) = $_[0] if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 292 256 548
3020  
3021 # P.359 The Study Function
3022 # in Chapter 7: Perl
3023 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3024  
3025 548 study $_; # Yes, I studied study yesterday.
3026  
3027 # while all script
3028  
3029 # 6.14. Matching from Where the Last Pattern Left Off
3030 # in Chapter 6. Pattern Matching
3031 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
3032 # (and so on)
3033  
3034 # one member of Tag-team
3035 #
3036 # P.128 Start of match (or end of previous match): \G
3037 # P.130 Advanced Use of \G with Perl
3038 # in Chapter 3: Overview of Regular Expression Features and Flavors
3039 # P.255 Use leading anchors
3040 # P.256 Expose ^ and \G at the front expressions
3041 # in Chapter 6: Crafting an Efficient Expression
3042 # P.315 "Tag-team" matching with /gc
3043 # in Chapter 7: Perl
3044 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3045  
3046 548 my $e_script = '';
3047 548 ▶ while (not /\G \z/oxgc) { # member
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 86480 548 87028
3048 86480 $e_script .= Latin3::escape_token();
3049 }
3050  
3051 548 return $e_script;
3052 }
3053  
3054 #
3055 # escape Latin-3 token of script
3056 #
3057 86480 ▶sub Latin3::escape_token {
Subroutine escape_token: called CC=504 SCAR=109.3
3058  
3059 # \n output here document
3060  
3061 86480 my $ignore_modules = join('|', qw(
3062 utf8
3063 bytes
3064 charnames
3065 I18N::Japanese
3066 I18N::Collate
3067 I18N::JExt
3068 File::DosGlob
3069 Wild
3070 Wildcard
3071 Japanese
3072 ));
3073  
3074 # another member of Tag-team
3075 #
3076 # P.315 "Tag-team" matching with /gc
3077 # in Chapter 7: Perl
3078 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3079  
3080 86480 ▶ if (/\G ( \n ) /oxgc) { # another member (and so on)
Branch: 139 branches
BranchTrueFalseTotal
if (/\G ( \n ) /cgox) { } 12826 73654 86480
elsif (/\G ((?>\s+)|\#.*) /cgox) { } 21324 52330 73654
elsif (/\G ( (?: if | elsif | unless | while | until | given | when ) (?>\s*) \( ) /cgox) { } 1644 50686 52330
elsif (/\G ( \( (?>\s*) (?: local \b | my \b | our \b | state \b )? (?>\s*) \$ $qq_scalar ) /cgox) { } 90 50596 50686
elsif (/\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /cgmosx) { } 4 50592 50596
elsif (/\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /cgmosx) { } 28 50564 50592
elsif (/\G ( \$' | \$\{'\} ) /cgmosx) { } 1 50563 50564
elsif (/\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /cgmosx) { } 3 50560 50563
elsif (/\G ( \$ $qq_scalar | $qq_substr ) /cgox) { } 1754 48806 50560
elsif (/\G ( [,;] ) /cgox) { } 5069 43737 48806
elsif (/\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /cgmosx) { } 0 43737 43737
elsif (/\G ( \$ 0 ) /cgmosx) { } 2 43735 43737
elsif (/\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /cgmosx) { } 0 43735 43735
elsif (/\G ( \$ \$ ) (?![\w\{]) /cgmosx) { } 1 43734 43735
elsif (/\G \$ ((?>[1-9][0-9]*)) /cgmosx) { } 4 43730 43734
elsif (/\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /cgmosx) { } 0 43730 43730
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /cgmosx) { } 0 43730 43730
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /cgmosx) { } 0 43730 43730
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /cgmosx) { } 0 43730 43730
elsif (/\G \$ (?>\s*) \{ ( (?>\s*) (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* ) (?>\s*) ) \} /cgmosx) { } 0 43730 43730
elsif (/\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /cgmosx) { } 0 43730 43730
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 43688 43730
elsif (m{\G ( \$[\$\@\#\\\'\"/\?\(\)\[\]\<\>] ) }cgmosx) { } 63 43625 43688
elsif (/\G \b (while (?>\s*) \( (?>\s*) <[\$]?[A-Za-z_][A-Za-z_0-9]*> (?>\s*) \)) \b /cgox) { } 0 43625 43625
elsif (/\G \b while (?>\s*) \( (?>\s*) < ((?:[^>\0\a\e\f\n\r\t])+?) > (?>\s*) \) \b /cgox) { } 0 43625 43625
elsif (/\G \b while (?>\s*) \( (?>\s*) glob (?>\s*) \) /cgox) { } 0 43625 43625
elsif (/\G \b while (?>\s*) \( (?>\s*) glob \b /cgox) { } 0 43625 43625
elsif (/\G \b ( if | unless | while | until | for | when ) \b /cgox) { } 251 43374 43625
elsif (/\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /cgox) { } 19 43355 43374
elsif (/\G \b Char::eval (?= (?>\s*) \{ ) /cgox) { } 0 43355 43355
elsif (/\G \b Latin3::eval (?= (?>\s*) \{ ) /cgox) { } 22 43333 43355
elsif (/\G \b Char::eval \b (?! (?>\s*) => ) /cgox) { } 0 43333 43333
elsif (/\G \b Latin3::eval \b (?! (?>\s*) => ) /cgox) { } 168 43165 43333
elsif (/\G \b bytes::substr \b (?! (?>\s*) => ) /cgox) { } 2 43163 43165
elsif (/\G \b chop \b (?! (?>\s*) => ) /cgox) { } 0 43163 43163
elsif (/\G \b bytes::index \b (?! (?>\s*) => ) /cgox) { } 2 43161 43163
elsif (/\G \b Char::index \b (?! (?>\s*) => ) /cgox) { } 0 43161 43161
elsif (/\G \b Latin3::index \b (?! (?>\s*) => ) /cgox) { } 0 43161 43161
elsif (/\G \b index \b (?! (?>\s*) => ) /cgox) { } 0 43161 43161
elsif (/\G \b bytes::rindex \b (?! (?>\s*) => ) /cgox) { } 2 43159 43161
elsif (/\G \b Char::rindex \b (?! (?>\s*) => ) /cgox) { } 0 43159 43159
elsif (/\G \b Latin3::rindex \b (?! (?>\s*) => ) /cgox) { } 0 43159 43159
elsif (/\G \b rindex \b (?! (?>\s*) => ) /cgox) { } 0 43159 43159
elsif (/\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 1 43158 43159
elsif (/\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43158 43158
elsif (/\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 1 43157 43158
elsif (/\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43157 43157
elsif (/\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 6 43151 43157
elsif (/\G -s (?>\s*) (\") ((?:$Elatin3::qq_char)+?) (\") /cgox) { } 0 43151 43151
elsif (/\G -s (?>\s+) qq (?>\s*) (\#) ((?:$Elatin3::qq_char)+?) (\#) /cgox) { } 0 43151 43151
elsif (/\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /cgox) { } 0 43151 43151
elsif (/\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /cgox) { } 0 43151 43151
elsif (/\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /cgox) { } 0 43151 43151
elsif (/\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /cgox) { } 0 43151 43151
elsif (/\G -s (?>\s+) qq (?>\s*) (\S) ((?:$Elatin3::qq_char)+?) (\1) /cgox) { } 0 43151 43151
elsif (/\G -s (?>\s*) (\') ((?:\\\'|\\\\|$Elatin3::q_char)+?) (\') /cgox) { } 0 43151 43151
elsif (/\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$Elatin3::q_char)+?) (\#) /cgox) { } 0 43151 43151
elsif (/\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /cgox) { } 0 43151 43151
elsif (/\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /cgox) { } 0 43151 43151
elsif (/\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /cgox) { } 0 43151 43151
elsif (/\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /cgox) { } 0 43151 43151
elsif (/\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$Elatin3::q_char)+?) (\1) /cgox) { } 0 43151 43151
elsif (/\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)* ) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ) )*) /cgox) { } 0 43151 43151
elsif (/\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /cgox) { } 0 43151 43151
elsif (/\G -s (?= (?>\s+) [a-z]+) /cgox) { } 0 43151 43151
elsif (/\G -s (?>\s+) ((?>\w+)) /cgox) { } 0 43151 43151
elsif (/\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43149 43151
elsif (/\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43147 43149
elsif (/\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 36 43111 43147
elsif (/\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43109 43111
elsif (/\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 8 43101 43109
elsif (/\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43101 43101
elsif (/\G \b lc \b (?! (?>\s*) => ) /cgox) { } 0 43101 43101
elsif (/\G \b lcfirst \b (?! (?>\s*) => ) /cgox) { } 0 43101 43101
elsif (/\G \b uc \b (?! (?>\s*) => ) /cgox) { } 0 43101 43101
elsif (/\G \b ucfirst \b (?! (?>\s*) => ) /cgox) { } 0 43101 43101
elsif (/\G \b fc \b (?! (?>\s*) => ) /cgox) { } 0 43101 43101
elsif (/\G -s \b (?! (?>\s*) => ) /cgox) { } 0 43101 43101
elsif (/\G \b bytes::length \b (?! (?>\s*) => ) /cgox) { } 0 43101 43101
elsif (/\G \b bytes::chr \b (?! (?>\s*) => ) /cgox) { } 0 43101 43101
elsif (/\G \b chr \b (?! (?>\s*) => ) /cgox) { } 0 43101 43101
elsif (/\G \b bytes::ord \b (?! (?>\s*) => ) /cgox) { } 0 43101 43101
elsif (/\G \b ord \b (?! (?>\s*) => ) /cgox) { } 0 43101 43101
elsif (/\G \b glob \b (?! (?>\s*) => ) /cgox) { } 0 43101 43101
elsif (/\G \b reverse \b (?! (?>\s*) => ) /cgox) { } 0 43101 43101
elsif (/\G \b getc \b (?! (?>\s*) => ) /cgox) { } 8 43093 43101
elsif (/\G \b (split) \b (?! (?>\s*) => ) /cgox) { } 87 43006 43093
elsif (/\G \b ( tr | y ) \b /cgox) { } 4 43002 43006
elsif (/\G \b (qq) \b /cgox) { } 2252 40750 43002
elsif (/\G \b (qr) \b /cgox) { } 0 40750 40750
elsif (/\G \b (qw) \b /cgox) { } 16 40734 40750
elsif (/\G \b (qx) \b /cgox) { } 0 40734 40734
elsif (/\G \b (q) \b /cgox) { } 473 40261 40734
elsif (/\G \b (m) \b /cgox) { } 209 40052 40261
elsif (/\G \b (s) \b /cgox) { } 101 39951 40052
elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 0 39951 39951
elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 39951 39951
elsif (/\G \b require ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 39951 39951
elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [#\n]) /cgmosx) { } 37 39914 39951
elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 39914 39914
elsif (/\G \b use ((?>\s+) strict) \b /cgmosx) { } 0 39914 39914
elsif (/\G \b use (?>\s+) ((?>([1-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /cgmosx) { } 2 39912 39914
elsif (/\G \b use (?>\s+) ((?>v([0-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /cgmosx) { } 0 39912 39912
elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 2 39910 39912
elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 39910 39910
elsif (/\G \b use ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 39910 39910
elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 0 39910 39910
elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 39910 39910
elsif (/\G \b no ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 39910 39910
elsif (/\G \b use \b /cgmosx) { } 0 39910 39910
elsif (/\G \b no \b /cgmosx) { } 2 39908 39910
elsif (/\G (?<![\w\$\@\%\&\*]) (\') /cgox) { } 1142 38766 39908
elsif (/\G (\") /cgox) { } 1885 36881 38766
elsif (/\G (\`) /cgox) { } 1 36880 36881
elsif ($Elatin3::slash eq 'm//' and m[\G (/) ]cgox) { } 681 36199 36880
elsif ($Elatin3::slash eq 'm//' and /\G (\?) /cgox) { } 0 36199 36199
elsif (/\G ( <<>> ) /cgox) { } 0 36199 36199
elsif (/\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /cgox) { } 0 36199 36199
elsif (/\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /cgox) { } 6 36193 36199
elsif (/\G ( <<~ \\([a-zA-Z_0-9]+) ) /cgox) { } 3 36190 36193
elsif (/\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /cgox) { } 6 36184 36190
elsif (/\G ( <<~ ([a-zA-Z_0-9]+) ) /cgox) { } 3 36181 36184
elsif (/\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /cgox) { } 6 36175 36181
elsif (/\G ( << '([a-zA-Z_0-9]*)' ) /cgox) { } 72 36103 36175
elsif (/\G ( << \\([a-zA-Z_0-9]+) ) /cgox) { } 0 36103 36103
elsif (/\G ( << "([a-zA-Z_0-9]*)" ) /cgox) { } 36 36067 36103
elsif (/\G ( << ([a-zA-Z_0-9]+) ) /cgox) { } 42 36025 36067
elsif (/\G ( << `([a-zA-Z_0-9]*)` ) /cgox) { } 0 36025 36025
elsif (/\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/cgox) { } 12 36013 36025
elsif (/\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /cgox) { } 0 36013 36013
elsif (/\G < ((?:[^>\0\a\e\f\n\r\t])+?) > /cgox) { } 0 36013 36013
elsif (/\G ^ ( __DATA__ \n .*) \z /cgmosx) { } 0 36013 36013
elsif (/\G ^ ( __END__ \n .*) \z /cgmosx) { } 210 35803 36013
elsif (/\G ( \cD .*) \z /cgmosx) { } 0 35803 35803
elsif (/\G ( \cZ .*) \z /cgmosx) { } 0 35803 35803
elsif (/\G ( -- | \+\+ | [\)\}\]] ) /cgox) { } 5839 29964 35803
elsif (/\G ( \.\.\. ) /cgox) { } 7 29957 29964
elsif (m"\G ((?> !~~ | !~ | != | ! | %= | % | &&= | && | &= | &\.= | &\. | & | -= | -> | - | :(?>\s*)= | : | <<>> | <<= | <=> | <= | < | == | => | =~ | = | >>= | >> | >= | > | \*\*= | \*\* | \*= | \* | \+= | \+ | \.\. | \.= | \. | //= | // | /= | / | \? | \\ | \^= | \^\.= | \^\. | \^ | \b x= | \|\|= | \|\| | \|= | \|\.= | \|\. | \| | ~~ | ~\. | ~ | \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b | \b(?: print )\b | [,;\(\{\[] )) "cgox) { } 9779 20178 29957
elsif (/\G ($Elatin3::q_char) /cgox) { } 20178 0 20178
3081 12826 my $heredoc = '';
3082 12826 ▶ if (scalar(@heredoc_delimiter) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @heredoc_delimiter >= 1) 174 12652 12826
3083 174 $slash = 'm//';
3084  
3085 174 $heredoc = join '', @heredoc;
3086 174 @heredoc = ();
3087  
3088 # skip here document
3089 174 for my $heredoc_delimiter (@heredoc_delimiter) {
3090 174 /\G .*? \n $heredoc_delimiter \n/xmsgc;
3091 }
3092 174 @heredoc_delimiter = ();
3093  
3094 174 $here_script = '';
3095 }
3096 12826 return "\n" . $heredoc;
3097 }
3098  
3099 # ignore space, comment
3100 21324 elsif (/\G ((?>\s+)|\#.*) /oxgc) { return $1; }
3101  
3102 # if (, elsif (, unless (, while (, until (, given (, and when (
3103  
3104 # given, when
3105  
3106 # P.225 The given Statement
3107 # in Chapter 15: Smart Matching and given-when
3108 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
3109  
3110 # P.133 The given Statement
3111 # in Chapter 4: Statements and Declarations
3112 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
3113  
3114 elsif (/\G ( (?: if | elsif | unless | while | until | given | when ) (?>\s*) \( ) /oxgc) {
3115 1644 $slash = 'm//';
3116 1644 return $1;
3117 }
3118  
3119 # scalar variable ($scalar = ...) =~ tr///;
3120 # scalar variable ($scalar = ...) =~ s///;
3121  
3122 # state
3123  
3124 # P.68 Persistent, Private Variables
3125 # in Chapter 4: Subroutines
3126 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
3127  
3128 # P.160 Persistent Lexically Scoped Variables: state
3129 # in Chapter 4: Statements and Declarations
3130 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
3131  
3132 # (and so on)
3133  
3134 elsif (/\G ( \( (?>\s*) (?: local \b | my \b | our \b | state \b )? (?>\s*) \$ $qq_scalar ) /oxgc) {
3135 90 my $e_string = e_string($1);
3136  
3137 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
3138 0 $tr_variable = $e_string . e_string($1);
3139 0 $bind_operator = $2;
3140 0 $slash = 'm//';
3141 0 return '';
3142 }
3143 elsif (/\G ( (?>\s*) = $qq_paren \) ) ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /oxgc) {
3144 0 $sub_variable = $e_string . e_string($1);
3145 0 $bind_operator = $2;
3146 0 $slash = 'm//';
3147 0 return '';
3148 }
3149 else {
3150 90 $slash = 'div';
3151 90 return $e_string;
3152 }
3153 }
3154  
3155 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin3::PREMATCH()
3156 elsif (/\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /oxmsgc) {
3157 4 $slash = 'div';
3158 4 return q{Elatin3::PREMATCH()};
3159 }
3160  
3161 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin3::MATCH()
3162 elsif (/\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /oxmsgc) {
3163 28 $slash = 'div';
3164 28 return q{Elatin3::MATCH()};
3165 }
3166  
3167 # $', ${'} --> $', ${'}
3168 elsif (/\G ( \$' | \$\{'\} ) /oxmsgc) {
3169 1 $slash = 'div';
3170 1 return $1;
3171 }
3172  
3173 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin3::POSTMATCH()
3174 elsif (/\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /oxmsgc) {
3175 3 $slash = 'div';
3176 3 return q{Elatin3::POSTMATCH()};
3177 }
3178  
3179 # scalar variable $scalar =~ tr///;
3180 # scalar variable $scalar =~ s///;
3181 # substr() =~ tr///;
3182 # substr() =~ s///;
3183 elsif (/\G ( \$ $qq_scalar | $qq_substr ) /oxgc) {
3184 1754 my $scalar = e_string($1);
3185  
3186 1754 ▶ if (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= (?: tr | y ) \b ) /oxgc) {
Branch: 2 branches
BranchTrueFalseTotal
if (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= (?: tr | y ) \b ) /cgox) { } 2 1752 1754
elsif (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /cgox) { } 65 1687 1752
3187 2 $tr_variable = $scalar;
3188 2 $bind_operator = $1;
3189 2 $slash = 'm//';
3190 2 return '';
3191 }
3192 elsif (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /oxgc) {
3193 65 $sub_variable = $scalar;
3194 65 $bind_operator = $1;
3195 65 $slash = 'm//';
3196 65 return '';
3197 }
3198 else {
3199 1687 $slash = 'div';
3200 1687 return $scalar;
3201 }
3202 }
3203  
3204 # end of statement
3205 elsif (/\G ( [,;] ) /oxgc) {
3206 5069 $slash = 'm//';
3207  
3208 # clear tr/// variable
3209 5069 $tr_variable = '';
3210  
3211 # clear s/// variable
3212 5069 $sub_variable = '';
3213  
3214 5069 $bind_operator = '';
3215  
3216 5069 return $1;
3217 }
3218  
3219 # bareword
3220 elsif (/\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /oxmsgc) {
3221 0 return $1;
3222 }
3223  
3224 # $0 --> $0
3225 elsif (/\G ( \$ 0 ) /oxmsgc) {
3226 2 $slash = 'div';
3227 2 return $1;
3228 }
3229 elsif (/\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /oxmsgc) {
3230 0 $slash = 'div';
3231 0 return $1;
3232 }
3233  
3234 # $$ --> $$
3235 elsif (/\G ( \$ \$ ) (?![\w\{]) /oxmsgc) {
3236 1 $slash = 'div';
3237 1 return $1;
3238 }
3239  
3240 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
3241 # $1, $2, $3 --> $1, $2, $3 otherwise
3242 elsif (/\G \$ ((?>[1-9][0-9]*)) /oxmsgc) {
3243 4 $slash = 'div';
3244 4 return e_capture($1);
3245 }
3246 elsif (/\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /oxmsgc) {
3247 0 $slash = 'div';
3248 0 return e_capture($1);
3249 }
3250  
3251 # $$foo[ ... ] --> $ $foo->[ ... ]
3252 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /oxmsgc) {
3253 0 $slash = 'div';
3254 0 return e_capture($1.'->'.$2);
3255 }
3256  
3257 # $$foo{ ... } --> $ $foo->{ ... }
3258 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /oxmsgc) {
3259 0 $slash = 'div';
3260 0 return e_capture($1.'->'.$2);
3261 }
3262  
3263 # $$foo
3264 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /oxmsgc) {
3265 0 $slash = 'div';
3266 0 return e_capture($1);
3267 }
3268  
3269 # ${ foo }
3270 elsif (/\G \$ (?>\s*) \{ ( (?>\s*) (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* ) (?>\s*) ) \} /oxmsgc) {
3271 0 $slash = 'div';
3272 0 return '${' . $1 . '}';
3273 }
3274  
3275 # ${ ... }
3276 elsif (/\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /oxmsgc) {
3277 0 $slash = 'div';
3278 0 return e_capture($1);
3279 }
3280  
3281 # variable or function
3282 # $ @ % & * $ #
3283 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) {
3284 42 $slash = 'div';
3285 42 return $1;
3286 }
3287 # $ $ $ $ $ $ $ $ $ $ $ $ $ $
3288 # $ @ # \ ' " / ? ( ) [ ] < >
3289 elsif (/\G ( \$[\$\@\#\\\'\"\/\?\(\)\[\]\<\>] ) /oxmsgc) {
3290 63 $slash = 'div';
3291 63 return $1;
3292 }
3293  
3294 # while (<FILEHANDLE>)
3295 elsif (/\G \b (while (?>\s*) \( (?>\s*) <[\$]?[A-Za-z_][A-Za-z_0-9]*> (?>\s*) \)) \b /oxgc) {
3296 0 return $1;
3297 }
3298  
3299 # while (<WILDCARD>) --- glob
3300  
3301 # avoid "Error: Runtime exception" of perl version 5.005_03
3302  
3303 elsif (/\G \b while (?>\s*) \( (?>\s*) < ((?:[^>\0\a\e\f\n\r\t])+?) > (?>\s*) \) \b /oxgc) {
3304 0 return 'while ($_ = Elatin3::glob("' . $1 . '"))';
3305 }
3306  
3307 # while (glob)
3308 elsif (/\G \b while (?>\s*) \( (?>\s*) glob (?>\s*) \) /oxgc) {
3309 0 return 'while ($_ = Elatin3::glob_)';
3310 }
3311  
3312 # while (glob(WILDCARD))
3313 elsif (/\G \b while (?>\s*) \( (?>\s*) glob \b /oxgc) {
3314 0 return 'while ($_ = Elatin3::glob';
3315 }
3316  
3317 # doit if, doit unless, doit while, doit until, doit for, doit when
3318 251 elsif (/\G \b ( if | unless | while | until | for | when ) \b /oxgc) { $slash = 'm//'; return $1; }
3319  
3320 # subroutines of package Elatin3
3321 19 elsif (/\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /oxgc) { $slash = 'm//'; return $1; }
3322 0 elsif (/\G \b Char::eval (?= (?>\s*) \{ ) /oxgc) { $slash = 'm//'; return 'eval'; }
3323 22 elsif (/\G \b Latin3::eval (?= (?>\s*) \{ ) /oxgc) { $slash = 'm//'; return 'eval'; }
3324 0 elsif (/\G \b Char::eval \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'eval Char::escape'; }
3325 168 elsif (/\G \b Latin3::eval \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'eval Latin3::escape'; }
3326 2 elsif (/\G \b bytes::substr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'substr'; }
3327 0 elsif (/\G \b chop \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin3::chop'; }
3328 2 elsif (/\G \b bytes::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'index'; }
3329 0 elsif (/\G \b Char::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Char::index'; }
3330 0 elsif (/\G \b Latin3::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Latin3::index'; }
3331 0 elsif (/\G \b index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin3::index'; }
3332 2 elsif (/\G \b bytes::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'rindex'; }
3333 0 elsif (/\G \b Char::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Char::rindex'; }
3334 0 elsif (/\G \b Latin3::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Latin3::rindex'; }
3335 0 elsif (/\G \b rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin3::rindex'; }
3336 1 elsif (/\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin3::lc'; }
3337 0 elsif (/\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin3::lcfirst'; }
3338 1 elsif (/\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin3::uc'; }
3339 0 elsif (/\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin3::ucfirst'; }
3340 6 elsif (/\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin3::fc'; }
3341  
3342 # "-s '' ..." means file test "-s 'filename' ..." (not means "- s/// ...")
3343 0 elsif (/\G -s (?>\s*) (\") ((?:$qq_char)+?) (\") /oxgc) { $slash = 'm//'; return '-s ' . e_qq('', $1,$3,$2); }
3344 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\#) ((?:$qq_char)+?) (\#) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3345 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3346 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3347 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3348 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3349 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\S) ((?:$qq_char)+?) (\1) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3350  
3351 0 elsif (/\G -s (?>\s*) (\') ((?:\\\'|\\\\|$q_char)+?) (\') /oxgc) { $slash = 'm//'; return '-s ' . e_q ('', $1,$3,$2); }
3352 0 elsif (/\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$q_char)+?) (\#) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3353 0 elsif (/\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3354 0 elsif (/\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3355 0 elsif (/\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3356 0 elsif (/\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3357 0 elsif (/\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$q_char)+?) (\1) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3358  
3359 elsif (/\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)* ) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ) )*) /oxgc)
3360 0 { $slash = 'm//'; return "-s $1"; }
3361 0 elsif (/\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /oxgc) { $slash = 'm//'; return "-s ($1)"; }
3362 0 elsif (/\G -s (?= (?>\s+) [a-z]+) /oxgc) { $slash = 'm//'; return '-s'; }
3363 0 elsif (/\G -s (?>\s+) ((?>\w+)) /oxgc) { $slash = 'm//'; return "-s $1"; }
3364  
3365 2 elsif (/\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'length'; }
3366 2 elsif (/\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'chr'; }
3367 36 elsif (/\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin3::chr'; }
3368 2 elsif (/\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'div'; return 'ord'; }
3369 8 elsif (/\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'div'; return $function_ord; }
3370 0 elsif (/\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin3::glob'; }
3371 0 elsif (/\G \b lc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin3::lc_'; }
3372 0 elsif (/\G \b lcfirst \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin3::lcfirst_'; }
3373 0 elsif (/\G \b uc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin3::uc_'; }
3374 0 elsif (/\G \b ucfirst \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin3::ucfirst_'; }
3375 0 elsif (/\G \b fc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin3::fc_'; }
3376 0 elsif (/\G -s \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return '-s '; }
3377  
3378 0 elsif (/\G \b bytes::length \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'length'; }
3379 0 elsif (/\G \b bytes::chr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'chr'; }
3380 0 elsif (/\G \b chr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin3::chr_'; }
3381 0 elsif (/\G \b bytes::ord \b (?! (?>\s*) => ) /oxgc) { $slash = 'div'; return 'ord'; }
3382 0 elsif (/\G \b ord \b (?! (?>\s*) => ) /oxgc) { $slash = 'div'; return $function_ord_; }
3383 0 elsif (/\G \b glob \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin3::glob_'; }
3384 0 elsif (/\G \b reverse \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return $function_reverse; }
3385 8 elsif (/\G \b getc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return $function_getc; }
3386 # split
3387 elsif (/\G \b (split) \b (?! (?>\s*) => ) /oxgc) {
3388 87 $slash = 'm//';
3389  
3390 87 my $e = '';
3391 87 ▶ while (/\G ( (?>\s+) | \( | \#.* ) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\G ( (?>\s+) | \( | \#.* ) /cgox) 85 87 172
3392 85 $e .= $1;
3393 }
3394  
3395 # end of split
3396 87 ▶ if (/\G (?= [,;\)\}\]] ) /oxgc) { return 'Elatin3::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
3397  
3398 # split scalar value
3399 1 elsif (/\G ( [\$\@\&\*] $qq_scalar ) /oxgc) { return 'Elatin3::split' . $e . e_string($1); }
3400  
3401 # split literal space
3402 0 elsif (/\G \b qq (\#) [ ] (\#) /oxgc) { return 'Elatin3::split' . $e . qq {qq$1 $2}; }
3403 0 elsif (/\G \b qq ((?>\s*)) (\() [ ] (\)) /oxgc) { return 'Elatin3::split' . $e . qq{$1qq$2 $3}; }
3404 0 elsif (/\G \b qq ((?>\s*)) (\{) [ ] (\}) /oxgc) { return 'Elatin3::split' . $e . qq{$1qq$2 $3}; }
3405 0 elsif (/\G \b qq ((?>\s*)) (\[) [ ] (\]) /oxgc) { return 'Elatin3::split' . $e . qq{$1qq$2 $3}; }
3406 0 elsif (/\G \b qq ((?>\s*)) (\<) [ ] (\>) /oxgc) { return 'Elatin3::split' . $e . qq{$1qq$2 $3}; }
3407 0 elsif (/\G \b qq ((?>\s*)) (\S) [ ] (\2) /oxgc) { return 'Elatin3::split' . $e . qq{$1qq$2 $3}; }
3408 0 elsif (/\G \b q (\#) [ ] (\#) /oxgc) { return 'Elatin3::split' . $e . qq {q$1 $2}; }
3409 0 elsif (/\G \b q ((?>\s*)) (\() [ ] (\)) /oxgc) { return 'Elatin3::split' . $e . qq {$1q$2 $3}; }
3410 0 elsif (/\G \b q ((?>\s*)) (\{) [ ] (\}) /oxgc) { return 'Elatin3::split' . $e . qq {$1q$2 $3}; }
3411 0 elsif (/\G \b q ((?>\s*)) (\[) [ ] (\]) /oxgc) { return 'Elatin3::split' . $e . qq {$1q$2 $3}; }
3412 0 elsif (/\G \b q ((?>\s*)) (\<) [ ] (\>) /oxgc) { return 'Elatin3::split' . $e . qq {$1q$2 $3}; }
3413 0 elsif (/\G \b q ((?>\s*)) (\S) [ ] (\2) /oxgc) { return 'Elatin3::split' . $e . qq {$1q$2 $3}; }
3414 10 elsif (/\G ' [ ] ' /oxgc) { return 'Elatin3::split' . $e . qq {' '}; }
3415 0 elsif (/\G " [ ] " /oxgc) { return 'Elatin3::split' . $e . qq {" "}; }
3416  
3417 # split qq//
3418 elsif (/\G \b (qq) \b /oxgc) {
3419 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin3::qq_char)*?) (\#) /cgox) { } 0 0 0
3420 else {
3421 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3422 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 ([*\-:?\\^|]) ((?:$Elatin3::qq_char)*?) (\1) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin3::qq_char)*?) (\1) /cgox) { } 0 0 0
3423 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq ( ) --> qr ( )
3424 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq { } --> qr { }
3425 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq [ ] --> qr [ ]
3426 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq < > --> qr < >
3427 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) /oxgc) { return e_split($e.'qr','{','}',$2,''); } # qq | | --> qr { }
3428 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq * * --> qr * *
3429 }
3430 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3431 }
3432 }
3433  
3434 # split qr//
3435 elsif (/\G \b (qr) \b /oxgc) {
3436 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1,$3,$2,$4); } # qr# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin3::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 12 12
3437 else {
3438 12 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 12 0 12
3439 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 (\') ((?:$Elatin3::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 12 12
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin3::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 12 12
elsif (/\G (\S) ((?:$Elatin3::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 12 0 12
3440 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr ( )
3441 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr { }
3442 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr [ ]
3443 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr < >
3444 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { return e_split_q($e.'qr',$1, $3, $2,$4); } # qr ' '
3445 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr','{','}',$2,$4); } # qr | | --> qr { }
3446 12 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr * *
3447 }
3448 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3449 }
3450 }
3451  
3452 # split q//
3453 elsif (/\G \b (q) \b /oxgc) {
3454 0 ▶ if (/\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:\\\#|\\\\|$Elatin3::q_char)*?) (\#) /cgox) { } 0 0 0
3455 else {
3456 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3457 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 ([*\-:?\\^|]) ((?:$Elatin3::q_char)*?) (\1) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:\\\\|\\\1| $Elatin3::q_char)*?) (\1) /cgox) { } 0 0 0
3458 0 elsif (/\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q ( ) --> qr ( )
3459 0 elsif (/\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q { } --> qr { }
3460 0 elsif (/\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q [ ] --> qr [ ]
3461 0 elsif (/\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q < > --> qr < >
3462 0 elsif (/\G ([*\-:?\\^|]) ((?:$q_char)*?) (\1) /oxgc) { return e_split_q($e.'qr','{','}',$2,''); } # q | | --> qr { }
3463 0 elsif (/\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q * * --> qr * *
3464 }
3465 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3466 }
3467 }
3468  
3469 # split m//
3470 elsif (/\G \b (m) \b /oxgc) {
3471 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1,$3,$2,$4); } # m# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin3::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
3472 else {
3473 18 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 18 0 18
3474 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 (\') ((?:$Elatin3::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin3::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
elsif (/\G (\S) ((?:$Elatin3::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 18 0 18
3475 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m ( ) --> qr ( )
3476 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m { } --> qr { }
3477 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m [ ] --> qr [ ]
3478 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m < > --> qr < >
3479 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { return e_split_q($e.'qr',$1, $3, $2,$4); } # m ' ' --> qr ' '
3480 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr','{','}',$2,$4); } # m | | --> qr { }
3481 18 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m * * --> qr * *
3482 }
3483 0 die __FILE__, ": Search pattern not terminated\n";
3484 }
3485 }
3486  
3487 # split ''
3488 elsif (/\G (\') /oxgc) {
3489 0 my $q_string = '';
3490 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3491 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 ($Elatin3::q_char) /cgox) { } 0 0 0
3492 0 elsif (/\G (\\\') /oxgc) { $q_string .= $1; } # splitqr'' --> split qr''
3493 0 elsif (/\G \' /oxgc) { return e_split_q($e.q{ qr},"'","'",$q_string,''); } # ' ' --> qr ' '
3494 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3495 }
3496 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3497 }
3498  
3499 # split ""
3500 elsif (/\G (\") /oxgc) {
3501 0 my $qq_string = '';
3502 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3503 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 ($Elatin3::q_char) /cgox) { } 0 0 0
3504 0 elsif (/\G (\\\") /oxgc) { $qq_string .= $1; } # splitqr"" --> split qr""
3505 0 elsif (/\G \" /oxgc) { return e_split($e.q{ qr},'"','"',$qq_string,''); } # " " --> qr " "
3506 0 elsif (/\G ($q_char) /oxgc) { $qq_string .= $1; }
3507 }
3508 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3509 }
3510  
3511 # split //
3512 elsif (/\G (\/) /oxgc) {
3513 44 my $regexp = '';
3514 44 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 381 0 381
3515 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 ($Elatin3::q_char) /cgox) { } 337 0 337
3516 0 elsif (/\G (\\\/) /oxgc) { $regexp .= $1; } # splitqr// --> split qr//
3517 44 elsif (/\G \/ ([cgimosxpadlunbB]*) /oxgc) { return e_split($e.q{ qr}, '/','/',$regexp,$1); } # / / --> qr / /
3518 337 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
3519 }
3520 0 die __FILE__, ": Search pattern not terminated\n";
3521 }
3522 }
3523  
3524 # tr/// or y///
3525  
3526 # about [cdsrbB]* (/B modifier)
3527 #
3528 # P.559 appendix C
3529 # of ISBN 4-89052-384-7 Programming perl
3530 # (Japanese title is: Perl puroguramingu)
3531  
3532 elsif (/\G \b ( tr | y ) \b /oxgc) {
3533 4 my $ope = $1;
3534  
3535 # $1 $2 $3 $4 $5 $6
3536 4 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ((?:$qq_char)*?) (\#) ([cdsrbB]*) /oxgc) { # tr# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin3::qq_char)*?) (\#) ((?:$Elatin3::qq_char)*?) (\#) ([cdsrbB]*) /cgox) { } 0 4 4
3537 0 my @tr = ($tr_variable,$2);
3538 0 return e_tr(@tr,'',$4,$6);
3539 }
3540 else {
3541 4 my $e = '';
3542 4 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 4 0 4
3543 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) ((?:$Elatin3::qq_char)*?) (\1) ((?:$Elatin3::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 4 0 4
3544 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) {
3545 0 my @tr = ($tr_variable,$2);
3546 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3547 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) ((?:$Elatin3::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3548 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) ( )
3549 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) { }
3550 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) [ ]
3551 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) < >
3552 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) * *
3553 }
3554 0 die __FILE__, ": Transliteration replacement not terminated\n";
3555 }
3556 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) {
3557 0 my @tr = ($tr_variable,$2);
3558 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3559 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) ((?:$Elatin3::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3560 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } ( )
3561 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } { }
3562 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } [ ]
3563 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } < >
3564 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } * *
3565 }
3566 0 die __FILE__, ": Transliteration replacement not terminated\n";
3567 }
3568 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) {
3569 0 my @tr = ($tr_variable,$2);
3570 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3571 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) ((?:$Elatin3::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3572 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] ( )
3573 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] { }
3574 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] [ ]
3575 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] < >
3576 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] * *
3577 }
3578 0 die __FILE__, ": Transliteration replacement not terminated\n";
3579 }
3580 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) {
3581 0 my @tr = ($tr_variable,$2);
3582 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3583 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) ((?:$Elatin3::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3584 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > ( )
3585 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > { }
3586 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > [ ]
3587 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > < >
3588 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > * *
3589 }
3590 0 die __FILE__, ": Transliteration replacement not terminated\n";
3591 }
3592 # $1 $2 $3 $4 $5 $6
3593 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { # tr * * *
3594 4 my @tr = ($tr_variable,$2);
3595 4 return e_tr(@tr,'',$4,$6);
3596 }
3597 }
3598 0 die __FILE__, ": Transliteration pattern not terminated\n";
3599 }
3600 }
3601  
3602 # qq//
3603 elsif (/\G \b (qq) \b /oxgc) {
3604 2252 my $ope = $1;
3605  
3606 # if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { return e_qq($ope,$1,$3,$2); } # qq# #
3607 2252 ▶ if (/\G (\#) /oxgc) { # qq# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) /cgox) { } 0 2252 2252
3608 0 my $qq_string = '';
3609 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3610 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 ($Elatin3::qq_char) /cgox) { } 0 0 0
3611 0 elsif (/\G (\\\#) /oxgc) { $qq_string .= $1; }
3612 0 elsif (/\G (\#) /oxgc) { return e_qq($ope,'#','#',$qq_string); }
3613 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3614 }
3615 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3616 }
3617  
3618 else {
3619 2252 my $e = '';
3620 2252 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 2252 0 2252
3621 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
3622  
3623 # elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq ( )
3624 elsif (/\G (\() /oxgc) { # qq ( )
3625 0 my $qq_string = '';
3626 0 local $nest = 1;
3627 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3628 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 ($Elatin3::qq_char) /cgox) { } 0 0 0
3629 0 elsif (/\G (\\\)) /oxgc) { $qq_string .= $1; }
3630 0 elsif (/\G (\() /oxgc) { $qq_string .= $1; $nest++; }
3631 elsif (/\G (\)) /oxgc) {
3632 0 ▶ if (--$nest == 0) { return $e . e_qq($ope,'(',')',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin3::nest == 0) { } 0 0 0
3633 0 else { $qq_string .= $1; }
3634 }
3635 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3636 }
3637 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3638 }
3639  
3640 # elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq { }
3641 elsif (/\G (\{) /oxgc) { # qq { }
3642 2222 my $qq_string = '';
3643 2222 local $nest = 1;
3644 2222 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 85104 0 85104
3645 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 ($Elatin3::qq_char) /cgox) { } 79782 0 79782
3646 0 elsif (/\G (\\\}) /oxgc) { $qq_string .= $1; }
3647 1189 elsif (/\G (\{) /oxgc) { $qq_string .= $1; $nest++; }
3648 elsif (/\G (\}) /oxgc) {
3649 3411 ▶ if (--$nest == 0) { return $e . e_qq($ope,'{','}',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin3::nest == 0) { } 2222 1189 3411
3650 1189 else { $qq_string .= $1; }
3651 }
3652 79782 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3653 }
3654 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3655 }
3656  
3657 # elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq [ ]
3658 elsif (/\G (\[) /oxgc) { # qq [ ]
3659 0 my $qq_string = '';
3660 0 local $nest = 1;
3661 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3662 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 ($Elatin3::qq_char) /cgox) { } 0 0 0
3663 0 elsif (/\G (\\\]) /oxgc) { $qq_string .= $1; }
3664 0 elsif (/\G (\[) /oxgc) { $qq_string .= $1; $nest++; }
3665 elsif (/\G (\]) /oxgc) {
3666 0 ▶ if (--$nest == 0) { return $e . e_qq($ope,'[',']',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin3::nest == 0) { } 0 0 0
3667 0 else { $qq_string .= $1; }
3668 }
3669 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3670 }
3671 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3672 }
3673  
3674 # elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq < >
3675 elsif (/\G (\<) /oxgc) { # qq < >
3676 30 my $qq_string = '';
3677 30 local $nest = 1;
3678 30 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 1166 0 1166
3679 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 ($Elatin3::qq_char) /cgox) { } 1114 0 1114
3680 0 elsif (/\G (\\\>) /oxgc) { $qq_string .= $1; }
3681 0 elsif (/\G (\<) /oxgc) { $qq_string .= $1; $nest++; }
3682 elsif (/\G (\>) /oxgc) {
3683 30 ▶ if (--$nest == 0) { return $e . e_qq($ope,'<','>',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin3::nest == 0) { } 30 0 30
3684 0 else { $qq_string .= $1; }
3685 }
3686 1114 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3687 }
3688 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3689 }
3690  
3691 # elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq * *
3692 elsif (/\G (\S) /oxgc) { # qq * *
3693 0 my $delimiter = $1;
3694 0 my $qq_string = '';
3695 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3696 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 ($Elatin3::qq_char) /cgox) { } 0 0 0
3697 0 elsif (/\G (\\\Q$delimiter\E) /oxgc) { $qq_string .= $1; }
3698 0 elsif (/\G (\Q$delimiter\E) /oxgc) { return $e . e_qq($ope,$delimiter,$delimiter,$qq_string); }
3699 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3700 }
3701 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3702 }
3703 }
3704 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3705 }
3706 }
3707  
3708 # qr//
3709 elsif (/\G \b (qr) \b /oxgc) {
3710 0 my $ope = $1;
3711 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { # qr# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin3::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 0 0
3712 0 return e_qr($ope,$1,$3,$2,$4);
3713 }
3714 else {
3715 0 my $e = '';
3716 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3717 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 (\') ((?:$Elatin3::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin3::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin3::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
3718 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr ( )
3719 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr { }
3720 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr [ ]
3721 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr < >
3722 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { return $e . e_qr_q($ope,$1, $3, $2,$4); } # qr ' '
3723 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,'{','}',$2,$4); } # qr | | --> qr { }
3724 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr * *
3725 }
3726 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3727 }
3728 }
3729  
3730 # qw//
3731 elsif (/\G \b (qw) \b /oxgc) {
3732 16 my $ope = $1;
3733 16 ▶ if (/\G (\#) (.*?) (\#) /oxmsgc) { # qw# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) (.*?) (\#) /cgmosx) { } 0 16 16
3734 0 return e_qw($ope,$1,$3,$2);
3735 }
3736 else {
3737 16 my $e = '';
3738 16 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 16 0 16
3739 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) ((?:$Elatin3::q_char)*?) (\1) /cgmosx) { } 0 0 0
3740  
3741 16 elsif (/\G (\() ([^(]*?) (\)) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw ( )
3742 0 elsif (/\G (\() ((?:$q_paren)*?) (\)) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw ( )
3743  
3744 0 elsif (/\G (\{) ([^{]*?) (\}) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw { }
3745 0 elsif (/\G (\{) ((?:$q_brace)*?) (\}) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw { }
3746  
3747 0 elsif (/\G (\[) ([^[]*?) (\]) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw [ ]
3748 0 elsif (/\G (\[) ((?:$q_bracket)*?) (\]) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw [ ]
3749  
3750 0 elsif (/\G (\<) ([^<]*?) (\>) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw < >
3751 0 elsif (/\G (\<) ((?:$q_angle)*?) (\>) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw < >
3752  
3753 0 elsif (/\G ([\x21-\x3F]) (.*?) (\1) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw * *
3754 0 elsif (/\G (\S) ((?:$q_char)*?) (\1) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw * *
3755 }
3756 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3757 }
3758 }
3759  
3760 # qx//
3761 elsif (/\G \b (qx) \b /oxgc) {
3762 0 my $ope = $1;
3763 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qx# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin3::qq_char)*?) (\#) /cgox) { } 0 0 0
3764 0 return e_qq($ope,$1,$3,$2);
3765 }
3766 else {
3767 0 my $e = '';
3768 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3769 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 (\') ((?:$Elatin3::qq_char)*?) (\') /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin3::qq_char)*?) (\1) /cgox) { } 0 0 0
3770 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx ( )
3771 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx { }
3772 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx [ ]
3773 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx < >
3774 0 elsif (/\G (\') ((?:$qq_char)*?) (\') /oxgc) { return $e . e_q ($ope,$1,$3,$2); } # qx ' '
3775 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx * *
3776 }
3777 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3778 }
3779 }
3780  
3781 # q//
3782 elsif (/\G \b (q) \b /oxgc) {
3783 473 my $ope = $1;
3784  
3785 # if (/\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { return e_q($ope,$1,$3,$2); } # q# #
3786  
3787 # avoid "Error: Runtime exception" of perl version 5.005_03
3788 # (and so on)
3789  
3790 473 ▶ if (/\G (\#) /oxgc) { # q# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) /cgox) { } 0 473 473
3791 0 my $q_string = '';
3792 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3793 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 ($Elatin3::q_char) /cgox) { } 0 0 0
3794 0 elsif (/\G (\\\#) /oxgc) { $q_string .= $1; }
3795 0 elsif (/\G (\#) /oxgc) { return e_q($ope,'#','#',$q_string); }
3796 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3797 }
3798 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3799 }
3800  
3801 else {
3802 473 my $e = '';
3803 473 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 473 0 473
3804 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
3805  
3806 # elsif (/\G (\() ((?:\\\)|\\\\|$q_paren)*?) (\)) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q ( )
3807 elsif (/\G (\() /oxgc) { # q ( )
3808 0 my $q_string = '';
3809 0 local $nest = 1;
3810 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3811 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 ($Elatin3::q_char) /cgox) { } 0 0 0
3812 0 elsif (/\G (\\\)) /oxgc) { $q_string .= $1; }
3813 0 elsif (/\G (\\\() /oxgc) { $q_string .= $1; }
3814 0 elsif (/\G (\() /oxgc) { $q_string .= $1; $nest++; }
3815 elsif (/\G (\)) /oxgc) {
3816 0 ▶ if (--$nest == 0) { return $e . e_q($ope,'(',')',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin3::nest == 0) { } 0 0 0
3817 0 else { $q_string .= $1; }
3818 }
3819 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3820 }
3821 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3822 }
3823  
3824 # elsif (/\G (\{) ((?:\\\}|\\\\|$q_brace)*?) (\}) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q { }
3825 elsif (/\G (\{) /oxgc) { # q { }
3826 467 my $q_string = '';
3827 467 local $nest = 1;
3828 467 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 8249 0 8249
3829 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 ($Elatin3::q_char) /cgox) { } 7464 0 7464
3830 0 elsif (/\G (\\\}) /oxgc) { $q_string .= $1; }
3831 0 elsif (/\G (\\\{) /oxgc) { $q_string .= $1; }
3832 159 elsif (/\G (\{) /oxgc) { $q_string .= $1; $nest++; }
3833 elsif (/\G (\}) /oxgc) {
3834 626 ▶ if (--$nest == 0) { return $e . e_q($ope,'{','}',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin3::nest == 0) { } 467 159 626
3835 159 else { $q_string .= $1; }
3836 }
3837 7464 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3838 }
3839 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3840 }
3841  
3842 # elsif (/\G (\[) ((?:\\\]|\\\\|$q_bracket)*?) (\]) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q [ ]
3843 elsif (/\G (\[) /oxgc) { # q [ ]
3844 0 my $q_string = '';
3845 0 local $nest = 1;
3846 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3847 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 ($Elatin3::q_char) /cgox) { } 0 0 0
3848 0 elsif (/\G (\\\]) /oxgc) { $q_string .= $1; }
3849 0 elsif (/\G (\\\[) /oxgc) { $q_string .= $1; }
3850 0 elsif (/\G (\[) /oxgc) { $q_string .= $1; $nest++; }
3851 elsif (/\G (\]) /oxgc) {
3852 0 ▶ if (--$nest == 0) { return $e . e_q($ope,'[',']',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin3::nest == 0) { } 0 0 0
3853 0 else { $q_string .= $1; }
3854 }
3855 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3856 }
3857 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3858 }
3859  
3860 # elsif (/\G (\<) ((?:\\\>|\\\\|$q_angle)*?) (\>) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q < >
3861 elsif (/\G (\<) /oxgc) { # q < >
3862 5 my $q_string = '';
3863 5 local $nest = 1;
3864 5 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 88 0 88
3865 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 ($Elatin3::q_char) /cgox) { } 83 0 83
3866 0 elsif (/\G (\\\>) /oxgc) { $q_string .= $1; }
3867 0 elsif (/\G (\\\<) /oxgc) { $q_string .= $1; }
3868 0 elsif (/\G (\<) /oxgc) { $q_string .= $1; $nest++; }
3869 elsif (/\G (\>) /oxgc) {
3870 5 ▶ if (--$nest == 0) { return $e . e_q($ope,'<','>',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin3::nest == 0) { } 5 0 5
3871 0 else { $q_string .= $1; }
3872 }
3873 83 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3874 }
3875 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3876 }
3877  
3878 # elsif (/\G (\S) ((?:\\\1|\\\\|$q_char)*?) (\1) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q * *
3879 elsif (/\G (\S) /oxgc) { # q * *
3880 1 my $delimiter = $1;
3881 1 my $q_string = '';
3882 1 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 14 0 14
3883 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 ($Elatin3::q_char) /cgox) { } 13 0 13
3884 0 elsif (/\G (\\\Q$delimiter\E) /oxgc) { $q_string .= $1; }
3885 1 elsif (/\G (\Q$delimiter\E) /oxgc) { return $e . e_q($ope,$delimiter,$delimiter,$q_string); }
3886 13 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3887 }
3888 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3889 }
3890 }
3891 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3892 }
3893 }
3894  
3895 # m//
3896 elsif (/\G \b (m) \b /oxgc) {
3897 209 my $ope = $1;
3898 209 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { # m# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin3::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
3899 0 return e_qr($ope,$1,$3,$2,$4);
3900 }
3901 else {
3902 209 my $e = '';
3903 209 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 209 0 209
3904 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 (\?) ((?:$Elatin3::qq_char)*?) (\?) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
elsif (/\G (\') ((?:$Elatin3::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 10 199 209
elsif (/\G ([*\-:\\^|]) ((?:$Elatin3::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 199 199
elsif (/\G (\S) ((?:$Elatin3::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 199 0 199
3905 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m ( )
3906 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m { }
3907 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m [ ]
3908 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m < >
3909 0 elsif (/\G (\?) ((?:$qq_char)*?) (\?) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m ? ?
3910 10 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr_q($ope,$1, $3, $2,$4); } # m ' '
3911 0 elsif (/\G ([*\-:\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,'{','}',$2,$4); } # m | | --> m { }
3912 199 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m * *
3913 }
3914 0 die __FILE__, ": Search pattern not terminated\n";
3915 }
3916 }
3917  
3918 # s///
3919  
3920 # about [cegimosxpradlunbB]* (/cg modifier)
3921 #
3922 # P.67 Pattern-Matching Operators
3923 # of ISBN 0-596-00241-6 Perl in a Nutshell, Second Edition.
3924  
3925 elsif (/\G \b (s) \b /oxgc) {
3926 101 my $ope = $1;
3927  
3928 # $1 $2 $3 $4 $5 $6
3929 101 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ((?:$qq_char)*?) (\#) ([cegimosxpradlunbB]*) /oxgc) { # s# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin3::qq_char)*?) (\#) ((?:$Elatin3::qq_char)*?) (\#) ([cegimosxpradlunbB]*) /cgox) { } 1 100 101
3930 1 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3931 }
3932 else {
3933 100 my $e = '';
3934 100 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 100 0 100
3935 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 (\') ((?:$Elatin3::qq_char)*?) (\') ((?:$Elatin3::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 21 79 100
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin3::qq_char)*?) (\1) ((?:$Elatin3::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 79 79
elsif (/\G (\$) ((?:$Elatin3::qq_char)*?) (\1) ((?:$Elatin3::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 79 79
elsif (/\G (\S) ((?:$Elatin3::qq_char)*?) (\1) ((?:$Elatin3::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 79 0 79
3936 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) {
3937 0 my @s = ($1,$2,$3);
3938 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3939 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 (\') ((?:$Elatin3::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin3::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Elatin3::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Elatin3::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin3::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3940 # $1 $2 $3 $4
3941 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3942 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3943 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3944 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3945 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3946 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3947 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3948 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3949 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3950 }
3951 0 die __FILE__, ": Substitution replacement not terminated\n";
3952 }
3953 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) {
3954 0 my @s = ($1,$2,$3);
3955 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3956 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 (\') ((?:$Elatin3::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin3::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Elatin3::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Elatin3::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin3::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3957 # $1 $2 $3 $4
3958 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3959 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3960 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3961 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3962 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3963 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3964 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3965 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3966 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3967 }
3968 0 die __FILE__, ": Substitution replacement not terminated\n";
3969 }
3970 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) {
3971 0 my @s = ($1,$2,$3);
3972 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3973 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 (\') ((?:$Elatin3::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin3::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin3::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3974 # $1 $2 $3 $4
3975 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3976 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3977 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3978 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3979 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3980 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3981 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3982 }
3983 0 die __FILE__, ": Substitution replacement not terminated\n";
3984 }
3985 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) {
3986 0 my @s = ($1,$2,$3);
3987 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3988 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 (\') ((?:$Elatin3::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin3::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Elatin3::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Elatin3::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin3::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3989 # $1 $2 $3 $4
3990 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3991 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3992 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3993 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3994 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3995 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3996 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3997 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3998 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3999 }
4000 0 die __FILE__, ": Substitution replacement not terminated\n";
4001 }
4002 # $1 $2 $3 $4 $5 $6
4003 elsif (/\G (\') ((?:$qq_char)*?) (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) {
4004 21 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
4005 }
4006 # $1 $2 $3 $4 $5 $6
4007 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
4008 0 return e_sub($sub_variable,'{',$2,'}','{',$4,'}',$6); # s | | | --> s { } { }
4009 }
4010 # $1 $2 $3 $4 $5 $6
4011 elsif (/\G (\$) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
4012 0 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
4013 }
4014 # $1 $2 $3 $4 $5 $6
4015 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
4016 79 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
4017 }
4018 }
4019 0 die __FILE__, ": Substitution pattern not terminated\n";
4020 }
4021 }
4022  
4023 # require ignore module
4024 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# require$1$2"; }
4025 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# require$1\n$2"; }
4026 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# require$1"; }
4027  
4028 # use strict; --> use strict; no strict qw(refs);
4029 37 elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "use$1 no strict qw(refs);$2"; }
4030 0 elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [^#]) /oxmsgc) { return "use$1 no strict qw(refs);\n$2"; }
4031 0 elsif (/\G \b use ((?>\s+) strict) \b /oxmsgc) { return "use$1; no strict qw(refs)"; }
4032  
4033 # use 5.12.0; --> use 5.12.0; no strict qw(refs);
4034 elsif (/\G \b use (?>\s+) ((?>([1-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /oxmsgc) {
4035 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
4036 0 return "use $1; no strict qw(refs);";
4037 }
4038 else {
4039 2 return "use $1;";
4040 }
4041 }
4042 elsif (/\G \b use (?>\s+) ((?>v([0-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /oxmsgc) {
4043 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
4044 0 return "use $1; no strict qw(refs);";
4045 }
4046 else {
4047 0 return "use $1;";
4048 }
4049 }
4050  
4051 # ignore use module
4052 2 elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# use$1$2"; }
4053 0 elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# use$1\n$2"; }
4054 0 elsif (/\G \b use ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# use$1"; }
4055  
4056 # ignore no module
4057 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# no$1$2"; }
4058 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# no$1\n$2"; }
4059 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# no$1"; }
4060  
4061 # use else
4062 0 elsif (/\G \b use \b /oxmsgc) { return "use"; }
4063  
4064 # use else
4065 2 elsif (/\G \b no \b /oxmsgc) { return "no"; }
4066  
4067 # ''
4068 elsif (/\G (?<![\w\$\@\%\&\*]) (\') /oxgc) {
4069 1142 my $q_string = '';
4070 1142 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 10175 0 10175
4071 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 ($Elatin3::q_char) /cgox) { } 8981 0 8981
4072 48 elsif (/\G (\\\') /oxgc) { $q_string .= $1; }
4073 1142 elsif (/\G \' /oxgc) { return e_q('', "'","'",$q_string); }
4074 8981 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
4075 }
4076 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4077 }
4078  
4079 # ""
4080 elsif (/\G (\") /oxgc) {
4081 1885 my $qq_string = '';
4082 1885 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 37104 0 37104
4083 37104 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 67 37037 37104
elsif (/\G (\\\") /cgox) { } 12 37025 37037
elsif (/\G \" /cgox) { } 1885 35140 37025
elsif (/\G ($Elatin3::q_char) /cgox) { } 35140 0 35140
4084 12 elsif (/\G (\\\") /oxgc) { $qq_string .= $1; }
4085 1885 elsif (/\G \" /oxgc) { return e_qq('', '"','"',$qq_string); }
4086 35140 elsif (/\G ($q_char) /oxgc) { $qq_string .= $1; }
4087 }
4088 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4089 }
4090  
4091 # ``
4092 elsif (/\G (\`) /oxgc) {
4093 1 my $qx_string = '';
4094 1 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 19 0 19
4095 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 ($Elatin3::q_char) /cgox) { } 18 0 18
4096 0 elsif (/\G (\\\`) /oxgc) { $qx_string .= $1; }
4097 1 elsif (/\G \` /oxgc) { return e_qq('', '`','`',$qx_string); }
4098 18 elsif (/\G ($q_char) /oxgc) { $qx_string .= $1; }
4099 }
4100 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4101 }
4102  
4103 # // --- not divide operator (num / num), not defined-or
4104 ▶ elsif (($slash eq 'm//') and /\G (\/) /oxgc) {
Condition100%3/3
$Elatin3::slash eq "m//" and m[\G (/) ]cgox
!ll&&!rl&&r
273518848681
MC/DC100%2/2
$Elatin3::slash eq "m//" and m[\G (/) ]cgox
$Elatin3::slash eq "m//" m[\G (/) ]cgox
Truth table100%3/3
A and B
A= $Elatin3::slash eq "m//"B= m[\G (/) ]cgox
ABresult
0X0
100
111
4105 681 my $regexp = '';
4106 681 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 5636 0 5636
4107 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 ($Elatin3::q_char) /cgox) { } 4955 0 4955
4108 0 elsif (/\G (\\\/) /oxgc) { $regexp .= $1; }
4109 681 elsif (/\G \/ ([cgimosxpadlunbB]*) /oxgc) { return e_qr('', '/','/',$regexp,$1); }
4110 4955 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
4111 }
4112 0 die __FILE__, ": Search pattern not terminated\n";
4113 }
4114  
4115 # ?? --- not conditional operator (condition ? then : else)
4116 ▶ elsif (($slash eq 'm//') and /\G (\?) /oxgc) {
Condition66%2/3
$Elatin3::slash eq "m//" and /\G (\?) /cgox
!ll&&!rl&&r
2735188480
MC/DC0%0/2
$Elatin3::slash eq "m//" and /\G (\?) /cgox
$Elatin3::slash eq "m//" /\G (\?) /cgox
Truth table66%2/3
A and B
A= $Elatin3::slash eq "m//"B= /\G (\?) /cgox
ABresult
0X0
100
111
4117 0 my $regexp = '';
4118 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
4119 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 ($Elatin3::q_char) /cgox) { } 0 0 0
4120 0 elsif (/\G (\\\?) /oxgc) { $regexp .= $1; }
4121 0 elsif (/\G \? ([cgimosxpadlunbB]*) /oxgc) { return e_qr('m','?','?',$regexp,$1); }
4122 0 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
4123 }
4124 0 die __FILE__, ": Search pattern not terminated\n";
4125 }
4126  
4127 # <<>> (a safer ARGV)
4128 0 elsif (/\G ( <<>> ) /oxgc) { $slash = 'm//'; return $1; }
4129  
4130 # << (bit shift) --- not here document
4131 0 elsif (/\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /oxgc) { $slash = 'm//'; return $1; }
4132  
4133 # <<~'HEREDOC'
4134 elsif (/\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /oxgc) {
4135 6 $slash = 'm//';
4136 6 my $here_quote = $1;
4137 6 my $delimiter = $2;
4138  
4139 # get here document
4140 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4141 6 $here_script = CORE::substr $_, pos $_;
4142 6 $here_script =~ s/.*?\n//oxm;
4143 }
4144 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
4145 6 my $heredoc = $1;
4146 6 my $indent = $2;
4147 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4148 6 push @heredoc, $heredoc . qq{\n$delimiter\n};
4149 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4150 }
4151 else {
4152 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4153 }
4154 6 return qq{<<'$delimiter'};
4155 }
4156  
4157 # <<~\HEREDOC
4158  
4159 # P.66 2.6.6. "Here" Documents
4160 # in Chapter 2: Bits and Pieces
4161 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4162  
4163 # P.73 "Here" Documents
4164 # in Chapter 2: Bits and Pieces
4165 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4166  
4167 elsif (/\G ( <<~ \\([a-zA-Z_0-9]+) ) /oxgc) {
4168 3 $slash = 'm//';
4169 3 my $here_quote = $1;
4170 3 my $delimiter = $2;
4171  
4172 # get here document
4173 3 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 3 0 3
4174 3 $here_script = CORE::substr $_, pos $_;
4175 3 $here_script =~ s/.*?\n//oxm;
4176 }
4177 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
4178 3 my $heredoc = $1;
4179 3 my $indent = $2;
4180 3 $heredoc =~ s{^$indent}{}msg; # no /ox
4181 3 push @heredoc, $heredoc . qq{\n$delimiter\n};
4182 3 push @heredoc_delimiter, qq{\\s*$delimiter};
4183 }
4184 else {
4185 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4186 }
4187 3 return qq{<<\\$delimiter};
4188 }
4189  
4190 # <<~"HEREDOC"
4191 elsif (/\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /oxgc) {
4192 6 $slash = 'm//';
4193 6 my $here_quote = $1;
4194 6 my $delimiter = $2;
4195  
4196 # get here document
4197 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4198 6 $here_script = CORE::substr $_, pos $_;
4199 6 $here_script =~ s/.*?\n//oxm;
4200 }
4201 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
4202 6 my $heredoc = $1;
4203 6 my $indent = $2;
4204 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4205 6 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4206 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4207 }
4208 else {
4209 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4210 }
4211 6 return qq{<<"$delimiter"};
4212 }
4213  
4214 # <<~HEREDOC
4215 elsif (/\G ( <<~ ([a-zA-Z_0-9]+) ) /oxgc) {
4216 3 $slash = 'm//';
4217 3 my $here_quote = $1;
4218 3 my $delimiter = $2;
4219  
4220 # get here document
4221 3 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 3 0 3
4222 3 $here_script = CORE::substr $_, pos $_;
4223 3 $here_script =~ s/.*?\n//oxm;
4224 }
4225 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
4226 3 my $heredoc = $1;
4227 3 my $indent = $2;
4228 3 $heredoc =~ s{^$indent}{}msg; # no /ox
4229 3 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4230 3 push @heredoc_delimiter, qq{\\s*$delimiter};
4231 }
4232 else {
4233 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4234 }
4235 3 return qq{<<$delimiter};
4236 }
4237  
4238 # <<~`HEREDOC`
4239 elsif (/\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /oxgc) {
4240 6 $slash = 'm//';
4241 6 my $here_quote = $1;
4242 6 my $delimiter = $2;
4243  
4244 # get here document
4245 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4246 6 $here_script = CORE::substr $_, pos $_;
4247 6 $here_script =~ s/.*?\n//oxm;
4248 }
4249 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
4250 6 my $heredoc = $1;
4251 6 my $indent = $2;
4252 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4253 6 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4254 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4255 }
4256 else {
4257 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4258 }
4259 6 return qq{<<`$delimiter`};
4260 }
4261  
4262 # <<'HEREDOC'
4263 elsif (/\G ( << '([a-zA-Z_0-9]*)' ) /oxgc) {
4264 72 $slash = 'm//';
4265 72 my $here_quote = $1;
4266 72 my $delimiter = $2;
4267  
4268 # get here document
4269 72 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 72 0 72
4270 72 $here_script = CORE::substr $_, pos $_;
4271 72 $here_script =~ s/.*?\n//oxm;
4272 }
4273 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
4274 72 push @heredoc, $1 . qq{\n$delimiter\n};
4275 72 push @heredoc_delimiter, $delimiter;
4276 }
4277 else {
4278 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4279 }
4280 72 return $here_quote;
4281 }
4282  
4283 # <<\HEREDOC
4284  
4285 # P.66 2.6.6. "Here" Documents
4286 # in Chapter 2: Bits and Pieces
4287 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4288  
4289 # P.73 "Here" Documents
4290 # in Chapter 2: Bits and Pieces
4291 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4292  
4293 elsif (/\G ( << \\([a-zA-Z_0-9]+) ) /oxgc) {
4294 0 $slash = 'm//';
4295 0 my $here_quote = $1;
4296 0 my $delimiter = $2;
4297  
4298 # get here document
4299 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4300 0 $here_script = CORE::substr $_, pos $_;
4301 0 $here_script =~ s/.*?\n//oxm;
4302 }
4303 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
4304 0 push @heredoc, $1 . qq{\n$delimiter\n};
4305 0 push @heredoc_delimiter, $delimiter;
4306 }
4307 else {
4308 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4309 }
4310 0 return $here_quote;
4311 }
4312  
4313 # <<"HEREDOC"
4314 elsif (/\G ( << "([a-zA-Z_0-9]*)" ) /oxgc) {
4315 36 $slash = 'm//';
4316 36 my $here_quote = $1;
4317 36 my $delimiter = $2;
4318  
4319 # get here document
4320 36 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 36 0 36
4321 36 $here_script = CORE::substr $_, pos $_;
4322 36 $here_script =~ s/.*?\n//oxm;
4323 }
4324 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
4325 36 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4326 36 push @heredoc_delimiter, $delimiter;
4327 }
4328 else {
4329 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4330 }
4331 36 return $here_quote;
4332 }
4333  
4334 # <<HEREDOC
4335 elsif (/\G ( << ([a-zA-Z_0-9]+) ) /oxgc) {
4336 42 $slash = 'm//';
4337 42 my $here_quote = $1;
4338 42 my $delimiter = $2;
4339  
4340 # get here document
4341 42 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 42 0 42
4342 42 $here_script = CORE::substr $_, pos $_;
4343 42 $here_script =~ s/.*?\n//oxm;
4344 }
4345 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
4346 42 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4347 42 push @heredoc_delimiter, $delimiter;
4348 }
4349 else {
4350 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4351 }
4352 42 return $here_quote;
4353 }
4354  
4355 # <<`HEREDOC`
4356 elsif (/\G ( << `([a-zA-Z_0-9]*)` ) /oxgc) {
4357 0 $slash = 'm//';
4358 0 my $here_quote = $1;
4359 0 my $delimiter = $2;
4360  
4361 # get here document
4362 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4363 0 $here_script = CORE::substr $_, pos $_;
4364 0 $here_script =~ s/.*?\n//oxm;
4365 }
4366 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
4367 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4368 0 push @heredoc_delimiter, $delimiter;
4369 }
4370 else {
4371 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4372 }
4373 0 return $here_quote;
4374 }
4375  
4376 # <<= <=> <= < operator
4377 elsif (/\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/oxgc) {
4378 12 return $1;
4379 }
4380  
4381 # <FILEHANDLE>
4382 elsif (/\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /oxgc) {
4383 0 return $1;
4384 }
4385  
4386 # <WILDCARD> --- glob
4387  
4388 # avoid "Error: Runtime exception" of perl version 5.005_03
4389  
4390 elsif (/\G < ((?:[^>\0\a\e\f\n\r\t])+?) > /oxgc) {
4391 0 return 'Elatin3::glob("' . $1 . '")';
4392 }
4393  
4394 # __DATA__
4395 0 elsif (/\G ^ ( __DATA__ \n .*) \z /oxmsgc) { return $1; }
4396  
4397 # __END__
4398 210 elsif (/\G ^ ( __END__ \n .*) \z /oxmsgc) { return $1; }
4399  
4400 # \cD Control-D
4401  
4402 # P.68 2.6.8. Other Literal Tokens
4403 # in Chapter 2: Bits and Pieces
4404 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4405  
4406 # P.76 Other Literal Tokens
4407 # in Chapter 2: Bits and Pieces
4408 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4409  
4410 0 elsif (/\G ( \cD .*) \z /oxmsgc) { return $1; }
4411  
4412 # \cZ Control-Z
4413 0 elsif (/\G ( \cZ .*) \z /oxmsgc) { return $1; }
4414  
4415 # any operator before div
4416 elsif (/\G (
4417 -- | \+\+ |
4418 [\)\}\]]
4419  
4420 5839 ) /oxgc) { $slash = 'div'; return $1; }
4421  
4422 # yada-yada or triple-dot operator
4423 elsif (/\G (
4424 \.\.\.
4425  
4426 7 ) /oxgc) { $slash = 'm//'; return q{die('Unimplemented')}; }
4427  
4428 # any operator before m//
4429  
4430 # //, //= (defined-or)
4431  
4432 # P.164 Logical Operators
4433 # in Chapter 10: More Control Structures
4434 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
4435  
4436 # P.119 C-Style Logical (Short-Circuit) Operators
4437 # in Chapter 3: Unary and Binary Operators
4438 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4439  
4440 # (and so on)
4441  
4442 # ~~
4443  
4444 # P.221 The Smart Match Operator
4445 # in Chapter 15: Smart Matching and given-when
4446 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
4447  
4448 # P.112 Smartmatch Operator
4449 # in Chapter 3: Unary and Binary Operators
4450 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4451  
4452 # (and so on)
4453  
4454 elsif (/\G ((?>
4455  
4456 !~~ | !~ | != | ! |
4457 %= | % |
4458 &&= | && | &= | &\.= | &\. | & |
4459 -= | -> | - |
4460 :(?>\s*)= |
4461 : |
4462 <<>> |
4463 <<= | <=> | <= | < |
4464 == | => | =~ | = |
4465 >>= | >> | >= | > |
4466 \*\*= | \*\* | \*= | \* |
4467 \+= | \+ |
4468 \.\. | \.= | \. |
4469 \/\/= | \/\/ |
4470 \/= | \/ |
4471 \? |
4472 \\ |
4473 \^= | \^\.= | \^\. | \^ |
4474 \b x= |
4475 \|\|= | \|\| | \|= | \|\.= | \|\. | \| |
4476 ~~ | ~\. | ~ |
4477 \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b |
4478 \b(?: print )\b |
4479  
4480 [,;\(\{\[]
4481  
4482 9779 )) /oxgc) { $slash = 'm//'; return $1; }
4483  
4484 # other any character
4485 20178 elsif (/\G ($q_char) /oxgc) { $slash = 'div'; return $1; }
4486  
4487 # system error
4488 else {
4489 0 die __FILE__, ": Oops, this shouldn't happen!\n";
4490 }
4491 }
4492  
4493 # escape Latin-3 string
4494 1873 ▶sub e_string {
Subroutine e_string: called CC=54 SCAR=72.5
Pod documented
4495 1873 my($string) = @_;
4496 1873 my $e_string = '';
4497  
4498 1873 local $slash = 'm//';
4499  
4500 # P.1024 Appendix W.10 Multibyte Processing
4501 # of ISBN 1-56592-224-7 CJKV Information Processing
4502 # (and so on)
4503  
4504 1873 my @char = $string =~ / \G (?>[^\\]|\\$q_char|$q_char) /oxmsg;
4505  
4506 # without { ... }
4507 1873 ▶ if (not (grep(/\A \{ \z/xms, @char) and grep(/\A \} \z/xms, @char))) {
Branch: 1 branch
BranchTrueFalseTotal
unless (grep /\A \{ \z/msx, @char and grep /\A \} \z/msx, @char) 1854 19 1873
Condition66%2/3
grep /\A \{ \z/msx, @char and grep /\A \} \z/msx, @char
!ll&&!rl&&r
1854019
MC/DC50%1/2
grep /\A \{ \z/msx, @char and grep /\A \} \z/msx, @char
grep /\A \{ \z/msx, @char grep /\A \} \z/msx, @char
Truth table66%2/3
A and B
A= grep /\A \{ \z/msx, @charB= grep /\A \} \z/msx, @char
ABresult
0X0
100
111
4508 1854 ▶ if ($string !~ /<</oxms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /<</mosx) 1854 0 1854
4509 1854 return $string;
4510 }
4511 }
4512  
4513 E_STRING_LOOP:
4514 19 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 223 19 242
4515 223 ▶ if (0) {
Branch: 24 branches
BranchTrueFalseTotal
if (do { $string =~ /\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /cgmosx }) { } 0 223 223
elsif ($string =~ /\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G ( \$' | \$\{'\} ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G ( \$ 0 ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G ( \$ \$ ) (?![\w\{]) /cgmosx) { } 0 223 223
elsif ($string =~ /\G \$ ((?>[1-9][0-9]*)) /cgmosx) { } 0 223 223
elsif ($string =~ /\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /cgmosx) { } 0 223 223
elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /cgmosx) { } 0 223 223
elsif ($string =~ /\G \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} /cgmosx) { } 0 223 223
elsif ($string =~ /\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /cgmosx) { } 3 220 223
elsif ($string =~ /\G ( (?: [\$\@\%\&\*] | \$\# | -> | \b sub \b) (?>\s*) (?: split | chop | index | rindex | lc | uc | fc | chr | ord | reverse | getc | tr | y | q | qq | qx | qw | m | s | qr | glob | lstat | opendir | stat | unlink | chdir ) ) \b /cgmosx) { } 7 213 220
elsif ($string =~ m{\G ( \$[\$\@\#\\\'\"/\?\(\)\[\]\<\>] ) }cgmosx) { } 0 213 213
elsif ($string =~ /\G \b (qq) \b /cgox) { } 0 213 213
elsif ($string =~ /\G \b (qx) \b /cgox) { } 0 213 213
elsif ($string =~ /\G \b (q) \b /cgox) { } 0 213 213
elsif ($string =~ /\G (?<![\w\$\@\%\&\*]) (\') ((?:\\\'|\\\\|$Elatin3::q_char)*?) (\') /cgox) { } 0 213 213
elsif ($string =~ /\G (\") ((?:$Elatin3::qq_char)*?) (\") /cgox) { } 0 213 213
elsif ($string =~ /\G (\`) ((?:$Elatin3::qq_char)*?) (\`) /cgox) { } 0 213 213
elsif ($string =~ /\G ($Elatin3::q_char) /cgox) { } 213 0 213
4516 }
4517  
4518 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> @{[Elatin3::PREMATCH()]}
4519 elsif ($string =~ /\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /oxmsgc) {
4520 0 $e_string .= q{Elatin3::PREMATCH()};
4521 0 $slash = 'div';
4522 }
4523  
4524 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> @{[Elatin3::MATCH()]}
4525 elsif ($string =~ /\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /oxmsgc) {
4526 0 $e_string .= q{Elatin3::MATCH()};
4527 0 $slash = 'div';
4528 }
4529  
4530 # $', ${'} --> $', ${'}
4531 elsif ($string =~ /\G ( \$' | \$\{'\} ) /oxmsgc) {
4532 0 $e_string .= $1;
4533 0 $slash = 'div';
4534 }
4535  
4536 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> @{[Elatin3::POSTMATCH()]}
4537 elsif ($string =~ /\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /oxmsgc) {
4538 0 $e_string .= q{Elatin3::POSTMATCH()};
4539 0 $slash = 'div';
4540 }
4541  
4542 # bareword
4543 elsif ($string =~ /\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /oxmsgc) {
4544 0 $e_string .= $1;
4545 0 $slash = 'div';
4546 }
4547  
4548 # $0 --> $0
4549 elsif ($string =~ /\G ( \$ 0 ) /oxmsgc) {
4550 0 $e_string .= $1;
4551 0 $slash = 'div';
4552 }
4553 elsif ($string =~ /\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /oxmsgc) {
4554 0 $e_string .= $1;
4555 0 $slash = 'div';
4556 }
4557  
4558 # $$ --> $$
4559 elsif ($string =~ /\G ( \$ \$ ) (?![\w\{]) /oxmsgc) {
4560 0 $e_string .= $1;
4561 0 $slash = 'div';
4562 }
4563  
4564 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
4565 # $1, $2, $3 --> $1, $2, $3 otherwise
4566 elsif ($string =~ /\G \$ ((?>[1-9][0-9]*)) /oxmsgc) {
4567 0 $e_string .= e_capture($1);
4568 0 $slash = 'div';
4569 }
4570 elsif ($string =~ /\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /oxmsgc) {
4571 0 $e_string .= e_capture($1);
4572 0 $slash = 'div';
4573 }
4574  
4575 # $$foo[ ... ] --> $ $foo->[ ... ]
4576 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /oxmsgc) {
4577 0 $e_string .= e_capture($1.'->'.$2);
4578 0 $slash = 'div';
4579 }
4580  
4581 # $$foo{ ... } --> $ $foo->{ ... }
4582 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /oxmsgc) {
4583 0 $e_string .= e_capture($1.'->'.$2);
4584 0 $slash = 'div';
4585 }
4586  
4587 # $$foo
4588 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /oxmsgc) {
4589 0 $e_string .= e_capture($1);
4590 0 $slash = 'div';
4591 }
4592  
4593 # ${ foo }
4594 elsif ($string =~ /\G \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} /oxmsgc) {
4595 0 $e_string .= '${' . $1 . '}';
4596 0 $slash = 'div';
4597 }
4598  
4599 # ${ ... }
4600 elsif ($string =~ /\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /oxmsgc) {
4601 3 $e_string .= e_capture($1);
4602 3 $slash = 'div';
4603 }
4604  
4605 # variable or function
4606 # $ @ % & * $ #
4607 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) {
4608 7 $e_string .= $1;
4609 7 $slash = 'div';
4610 }
4611 # $ $ $ $ $ $ $ $ $ $ $ $ $ $
4612 # $ @ # \ ' " / ? ( ) [ ] < >
4613 elsif ($string =~ /\G ( \$[\$\@\#\\\'\"\/\?\(\)\[\]\<\>] ) /oxmsgc) {
4614 0 $e_string .= $1;
4615 0 $slash = 'div';
4616 }
4617  
4618 # qq//
4619 elsif ($string =~ /\G \b (qq) \b /oxgc) {
4620 0 my $ope = $1;
4621 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qq# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Elatin3::qq_char)*?) (\#) /cgox) { } 0 0 0
4622 0 $e_string .= e_qq($ope,$1,$3,$2);
4623 }
4624 else {
4625 0 my $e = '';
4626 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4627 0 ▶ if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 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) ((?:$Elatin3::qq_char)*?) (\1) /cgox) { } 0 0 0
4628 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq ( )
4629 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq { }
4630 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq [ ]
4631 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq < >
4632 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq * *
4633 }
4634 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4635 }
4636 }
4637  
4638 # qx//
4639 elsif ($string =~ /\G \b (qx) \b /oxgc) {
4640 0 my $ope = $1;
4641 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qx# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Elatin3::qq_char)*?) (\#) /cgox) { } 0 0 0
4642 0 $e_string .= e_qq($ope,$1,$3,$2);
4643 }
4644 else {
4645 0 my $e = '';
4646 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4647 0 ▶ if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 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 (\') ((?:$Elatin3::qq_char)*?) (\') /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Elatin3::qq_char)*?) (\1) /cgox) { } 0 0 0
4648 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx ( )
4649 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx { }
4650 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx [ ]
4651 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx < >
4652 0 elsif ($string =~ /\G (\') ((?:$qq_char)*?) (\') /oxgc) { $e_string .= $e . e_q ($ope,$1,$3,$2); next E_STRING_LOOP; } # qx ' '
4653 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx * *
4654 }
4655 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4656 }
4657 }
4658  
4659 # q//
4660 elsif ($string =~ /\G \b (q) \b /oxgc) {
4661 0 my $ope = $1;
4662 0 ▶ if ($string =~ /\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { # q# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:\\\#|\\\\|$Elatin3::q_char)*?) (\#) /cgox) { } 0 0 0
4663 0 $e_string .= e_q($ope,$1,$3,$2);
4664 }
4665 else {
4666 0 my $e = '';
4667 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4668 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| $Elatin3::q_char)*?) (\1) /cgox) { } 0 0 0
4669 0 elsif ($string =~ /\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q ( )
4670 0 elsif ($string =~ /\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q { }
4671 0 elsif ($string =~ /\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q [ ]
4672 0 elsif ($string =~ /\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q < >
4673 0 elsif ($string =~ /\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q * *
4674 }
4675 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4676 }
4677 }
4678  
4679 # ''
4680 0 elsif ($string =~ /\G (?<![\w\$\@\%\&\*]) (\') ((?:\\\'|\\\\|$q_char)*?) (\') /oxgc) { $e_string .= e_q('',$1,$3,$2); }
4681  
4682 # ""
4683 0 elsif ($string =~ /\G (\") ((?:$qq_char)*?) (\") /oxgc) { $e_string .= e_qq('',$1,$3,$2); }
4684  
4685 # ``
4686 0 elsif ($string =~ /\G (\`) ((?:$qq_char)*?) (\`) /oxgc) { $e_string .= e_qq('',$1,$3,$2); }
4687  
4688 # other any character
4689 213 elsif ($string =~ /\G ($q_char) /oxgc) { $e_string .= $1; }
4690  
4691 # system error
4692 else {
4693 0 die __FILE__, ": Oops, this shouldn't happen!\n";
4694 }
4695 }
4696  
4697 19 return $e_string;
4698 }
4699  
4700 #
4701 # character class
4702 #
4703 1920 ▶sub character_class {
Subroutine character_class: called CC=3 SCAR=11.0
Pod undocumented
4704 1920 my($char,$modifier) = @_;
4705  
4706 1920 ▶ if ($char eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char eq '.') { } 52 1868 1920
4707 52 ▶ if ($modifier =~ /s/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/) { } 17 35 52
4708 17 return '${Elatin3::dot_s}';
4709 }
4710 else {
4711 35 return '${Elatin3::dot}';
4712 }
4713 }
4714 else {
4715 1868 return Elatin3::classic_character_class($char);
4716 }
4717 }
4718  
4719 #
4720 # escape capture ($1, $2, $3, ...)
4721 #
4722 212 ▶sub e_capture {
Subroutine e_capture: called CC=1 SCAR=0.0
Pod undocumented
4723  
4724 212 return join '', '${', $_[0], '}';
4725 }
4726  
4727 #
4728 # escape transliteration (tr/// or y///)
4729 #
4730 4 ▶sub e_tr {
Subroutine e_tr: called CC=5 SCAR=16.8
Pod undocumented
4731 4 my($variable,$charclass,$e,$charclass2,$modifier) = @_;
4732 4 my $e_tr = '';
4733 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
4734  
4735 4 $slash = 'div';
4736  
4737 # quote character class 1
4738 4 $charclass = q_tr($charclass);
4739  
4740 # quote character class 2
4741 4 $charclass2 = q_tr($charclass2);
4742  
4743 # /b /B modifier
4744 4 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) { } 0 4 4
4745 0 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq '') { } 0 0 0
4746 0 $e_tr = qq{tr$charclass$e$charclass2$modifier};
4747 }
4748 else {
4749 0 $e_tr = qq{$variable${bind_operator}tr$charclass$e$charclass2$modifier};
4750 }
4751 }
4752 else {
4753 4 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq '') { } 2 2 4
4754 2 $e_tr = qq{Elatin3::tr(\$_,' =~ ',$charclass,$e$charclass2,'$modifier')};
4755 }
4756 else {
4757 2 $e_tr = qq{Elatin3::tr($variable,'$bind_operator',$charclass,$e$charclass2,'$modifier')};
4758 }
4759 }
4760  
4761 # clear tr/// variable
4762 4 $tr_variable = '';
4763 4 $bind_operator = '';
4764  
4765 4 return $e_tr;
4766 }
4767  
4768 #
4769 # quote for escape transliteration (tr/// or y///)
4770 #
4771 8 ▶sub q_tr {
Subroutine q_tr: called CC=9 SCAR=40.6
Pod undocumented
4772 8 my($charclass) = @_;
4773  
4774 # quote character class
4775 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
4776 8 return e_q('', "'", "'", $charclass); # --> q' '
4777 }
4778 elsif ($charclass !~ /\//oxms) {
4779 0 return e_q('q', '/', '/', $charclass); # --> q/ /
4780 }
4781 elsif ($charclass !~ /\#/oxms) {
4782 0 return e_q('q', '#', '#', $charclass); # --> q# #
4783 }
4784 elsif ($charclass !~ /[\<\>]/oxms) {
4785 0 return e_q('q', '<', '>', $charclass); # --> q< >
4786 }
4787 elsif ($charclass !~ /[\(\)]/oxms) {
4788 0 return e_q('q', '(', ')', $charclass); # --> q( )
4789 }
4790 elsif ($charclass !~ /[\{\}]/oxms) {
4791 0 return e_q('q', '{', '}', $charclass); # --> q{ }
4792 }
4793 else {
4794 0 for my $char (qw( ! " $ % & * + . : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
4795 0 ▶ if ($charclass !~ /\Q$char\E/xms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($charclass =~ /\Q$char\E/msx) 0 0 0
4796 0 return e_q('q', $char, $char, $charclass);
4797 }
4798 }
4799 }
4800  
4801 0 return e_q('q', '{', '}', $charclass);
4802 }
4803  
4804 #
4805 # escape q string (q//, '')
4806 #
4807 1623 ▶sub e_q {
Subroutine e_q: called CC=1 SCAR=0.0
Pod undocumented
4808 1623 my($ope,$delimiter,$end_delimiter,$string) = @_;
4809  
4810 1623 $slash = 'div';
4811  
4812 1623 return join '', $ope, $delimiter, $string, $end_delimiter;
4813 }
4814  
4815 #
4816 # escape qq string (qq//, "", qx//, ``)
4817 #
4818 4223 ▶sub e_qq {
Subroutine e_qq: called CC=37 SCAR=50.9
Pod undocumented
4819 4223 my($ope,$delimiter,$end_delimiter,$string) = @_;
4820  
4821 4223 $slash = 'div';
4822  
4823 4223 my $left_e = 0;
4824 4223 my $right_e = 0;
4825  
4826 # split regexp
4827 4223 my @char = $string =~ /\G((?>
4828 [^\\\$] |
4829 \\x\{ (?>[0-9A-Fa-f]+) \} |
4830 \\o\{ (?>[0-7]+) \} |
4831 \\N\{ (?>[^0-9\}][^\}]*) \} |
4832 \\ $q_char |
4833 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
4834 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
4835 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
4836 \$ (?>\s* [0-9]+) |
4837 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
4838 \$ \$ (?![\w\{]) |
4839 \$ (?>\s*) \$ (?>\s*) $qq_variable |
4840 $q_char
4841 ))/oxmsg;
4842  
4843 4223 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 116683 4223 120906
4844  
4845 # "\L\u" --> "\u\L"
4846 116683 ▶ 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 116683 116683
elsif ($char[$i] eq '\\U' and $char[$i + 1] eq '\\l') { } 0 116683 116683
elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/mosx) { } 1 116682 116683
elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/mosx) { } 1 116681 116682
elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/mosx) { } 0 116681 116681
Condition33%1/3
$char[$i] eq "\\L" and $char[$i + 1] eq "\\u"
!ll&&!rl&&r
11668300
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
4847 0 @char[$i,$i+1] = @char[$i+1,$i];
4848 }
4849  
4850 # "\U\l" --> "\l\U"
4851 ▶ 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
11668300
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
4852 0 @char[$i,$i+1] = @char[$i+1,$i];
4853 }
4854  
4855 # octal escape sequence
4856 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
4857 1 $char[$i] = Elatin3::octchr($1);
4858 }
4859  
4860 # hexadecimal escape sequence
4861 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
4862 1 $char[$i] = Elatin3::hexchr($1);
4863 }
4864  
4865 # \N{CHARNAME} --> N{CHARNAME}
4866 elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
4867 0 $char[$i] = $1;
4868 }
4869  
4870 116683 ▶ if (0) {
Branch: 23 branches
BranchTrueFalseTotal
if (do { $char[$i] =~ /\A ([<>]) \z/mosx }) { } 484 116199 116683
elsif ($char[$i] eq '\\u') { } 0 116199 116199
elsif ($char[$i] eq '\\l') { } 0 116199 116199
elsif ($char[$i] eq '\\U') { } 0 116199 116199
elsif ($char[$i] eq '\\L') { } 0 116199 116199
elsif ($char[$i] eq '\\F') { } 24 116175 116199
elsif ($char[$i] eq '\\Q') { } 0 116175 116175
elsif ($char[$i] eq '\\E') { } 24 116151 116175
elsif ($char[$i] eq '\\Q') { } 0 116151 116151
elsif ($char[$i] eq '\\E') { } 0 116151 116151
elsif ($char[$i] =~ /\A \$ 0 \z/mosx) { } 4 116147 116151
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/mosx) { } 0 116147 116147
elsif ($char[$i] =~ /\A \$\$ \z/mosx) { } 0 116147 116147
elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/mosx) { } 205 115942 116147
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/mosx) { } 0 115942 115942
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/mosx) { } 0 115942 115942
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/mosx) { } 0 115942 115942
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/mosx) { } 0 115942 115942
elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/cgmosx) { } 44 115898 115942
elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/cgmosx) { } 45 115853 115898
elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/cgmosx) { } 33 115820 115853
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/mosx) { } 0 115820 115820
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/mosx) { } 0 115820 115820
4871 }
4872  
4873 # \F
4874 #
4875 # P.69 Table 2-6. Translation escapes
4876 # in Chapter 2: Bits and Pieces
4877 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4878 # (and so on)
4879  
4880 # \u \l \U \L \F \Q \E
4881 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
4882 484 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 484 484
4883 0 $char[$i] = '\\' . $char[$i];
4884 }
4885 }
4886 elsif ($char[$i] eq '\u') {
4887  
4888 # "STRING @{[ LIST EXPR ]} MORE STRING"
4889  
4890 # P.257 Other Tricks You Can Do with Hard References
4891 # in Chapter 8: References
4892 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4893  
4894 # P.353 Other Tricks You Can Do with Hard References
4895 # in Chapter 8: References
4896 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4897  
4898 # (and so on)
4899  
4900 0 $char[$i] = '@{[Elatin3::ucfirst qq<';
4901 0 $left_e++;
4902 }
4903 elsif ($char[$i] eq '\l') {
4904 0 $char[$i] = '@{[Elatin3::lcfirst qq<';
4905 0 $left_e++;
4906 }
4907 elsif ($char[$i] eq '\U') {
4908 0 $char[$i] = '@{[Elatin3::uc qq<';
4909 0 $left_e++;
4910 }
4911 elsif ($char[$i] eq '\L') {
4912 0 $char[$i] = '@{[Elatin3::lc qq<';
4913 0 $left_e++;
4914 }
4915 elsif ($char[$i] eq '\F') {
4916 24 $char[$i] = '@{[Elatin3::fc qq<';
4917 24 $left_e++;
4918 }
4919 elsif ($char[$i] eq '\Q') {
4920 0 $char[$i] = '@{[CORE::quotemeta qq<';
4921 0 $left_e++;
4922 }
4923 elsif ($char[$i] eq '\E') {
4924 24 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 24 0 24
4925 24 $char[$i] = '>]}';
4926 24 $right_e++;
4927 }
4928 else {
4929 0 $char[$i] = '';
4930 }
4931 }
4932 elsif ($char[$i] eq '\Q') {
4933 0 while (1) {
4934 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
4935 0 last;
4936 }
4937 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
4938 0 last;
4939 }
4940 }
4941 }
4942 elsif ($char[$i] eq '\E') {
4943 }
4944  
4945 # $0 --> $0
4946 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
4947 }
4948 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
4949 }
4950  
4951 # $$ --> $$
4952 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
4953 }
4954  
4955 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
4956 # $1, $2, $3 --> $1, $2, $3 otherwise
4957 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
4958 205 $char[$i] = e_capture($1);
4959 }
4960 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
4961 0 $char[$i] = e_capture($1);
4962 }
4963  
4964 # $$foo[ ... ] --> $ $foo->[ ... ]
4965 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
4966 0 $char[$i] = e_capture($1.'->'.$2);
4967 }
4968  
4969 # $$foo{ ... } --> $ $foo->{ ... }
4970 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
4971 0 $char[$i] = e_capture($1.'->'.$2);
4972 }
4973  
4974 # $$foo
4975 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
4976 0 $char[$i] = e_capture($1);
4977 }
4978  
4979 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin3::PREMATCH()
4980 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
4981 44 $char[$i] = '@{[Elatin3::PREMATCH()]}';
4982 }
4983  
4984 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin3::MATCH()
4985 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
4986 45 $char[$i] = '@{[Elatin3::MATCH()]}';
4987 }
4988  
4989 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin3::POSTMATCH()
4990 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
4991 33 $char[$i] = '@{[Elatin3::POSTMATCH()]}';
4992 }
4993  
4994 # ${ foo } --> ${ foo }
4995 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/oxms) {
4996 }
4997  
4998 # ${ ... }
4999 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5000 0 $char[$i] = e_capture($1);
5001 }
5002 }
5003  
5004 # return string
5005 4223 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 4223 4223
5006 0 return join '', $ope, $delimiter, @char, '>]}' x ($left_e - $right_e), $end_delimiter;
5007 }
5008 4223 return join '', $ope, $delimiter, @char, $end_delimiter;
5009 }
5010  
5011 #
5012 # escape qw string (qw//)
5013 #
5014 16 ▶sub e_qw {
Subroutine e_qw: called CC=11 SCAR=43.1
Pod undocumented
5015 16 my($ope,$delimiter,$end_delimiter,$string) = @_;
5016  
5017 16 $slash = 'div';
5018  
5019 # choice again delimiter
5020 16 my %octet = map {$_ => 1} ($string =~ /\G ([\x00-\xFF]) /oxmsg);
5021 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
5022 16 return join '', $ope, $delimiter, $string, $end_delimiter;
5023 }
5024 elsif (not $octet{')'}) {
5025 0 return join '', $ope, '(', $string, ')';
5026 }
5027 elsif (not $octet{'}'}) {
5028 0 return join '', $ope, '{', $string, '}';
5029 }
5030 elsif (not $octet{']'}) {
5031 0 return join '', $ope, '[', $string, ']';
5032 }
5033 elsif (not $octet{'>'}) {
5034 0 return join '', $ope, '<', $string, '>';
5035 }
5036 else {
5037 0 for my $char (qw( ! " $ % & * + - . / : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5038 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5039 0 return join '', $ope, $char, $string, $char;
5040 }
5041 }
5042 }
5043  
5044 # qw/AAA BBB C'CC/ --> ('AAA', 'BBB', 'C\'CC')
5045 0 my @string = CORE::split(/\s+/, $string);
5046 0 for my $string (@string) {
5047 0 my @octet = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5048 0 for my $octet (@octet) {
5049 0 ▶ if ($octet =~ /\A (['\\]) \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($octet =~ /\A (['\\]) \z/mosx) 0 0 0
5050 0 $octet = '\\' . $1;
5051 }
5052 }
5053 0 $string = join '', @octet;
5054 }
5055 0 return join '', '(', (join ', ', map { "'$_'" } @string), ')';
5056 }
5057  
5058 #
5059 # escape here document (<<"HEREDOC", <<HEREDOC, <<`HEREDOC`, <<~"HEREDOC", <<~HEREDOC, <<~`HEREDOC`)
5060 #
5061 93 ▶sub e_heredoc {
Subroutine e_heredoc: called CC=37 SCAR=56.3
Pod undocumented
5062 93 my($string) = @_;
5063  
5064 93 $slash = 'm//';
5065  
5066 93 my $metachar = qr/[\@\\|]/oxms; # '|' is for <<`HEREDOC`
5067  
5068 93 my $left_e = 0;
5069 93 my $right_e = 0;
5070  
5071 # split regexp
5072 93 my @char = $string =~ /\G((?>
5073 [^\\\$] |
5074 \\x\{ (?>[0-9A-Fa-f]+) \} |
5075 \\o\{ (?>[0-7]+) \} |
5076 \\N\{ (?>[^0-9\}][^\}]*) \} |
5077 \\ $q_char |
5078 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5079 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5080 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5081 \$ (?>\s* [0-9]+) |
5082 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5083 \$ \$ (?![\w\{]) |
5084 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5085 $q_char
5086 ))/oxmsg;
5087  
5088 93 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 3177 93 3270
5089  
5090 # "\L\u" --> "\u\L"
5091 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
5092 0 @char[$i,$i+1] = @char[$i+1,$i];
5093 }
5094  
5095 # "\U\l" --> "\l\U"
5096 ▶ 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
5097 0 @char[$i,$i+1] = @char[$i+1,$i];
5098 }
5099  
5100 # octal escape sequence
5101 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5102 1 $char[$i] = Elatin3::octchr($1);
5103 }
5104  
5105 # hexadecimal escape sequence
5106 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5107 1 $char[$i] = Elatin3::hexchr($1);
5108 }
5109  
5110 # \N{CHARNAME} --> N{CHARNAME}
5111 elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5112 0 $char[$i] = $1;
5113 }
5114  
5115 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
5116 }
5117  
5118 # \u \l \U \L \F \Q \E
5119 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
5120 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
5121 0 $char[$i] = '\\' . $char[$i];
5122 }
5123 }
5124 elsif ($char[$i] eq '\u') {
5125 0 $char[$i] = '@{[Elatin3::ucfirst qq<';
5126 0 $left_e++;
5127 }
5128 elsif ($char[$i] eq '\l') {
5129 0 $char[$i] = '@{[Elatin3::lcfirst qq<';
5130 0 $left_e++;
5131 }
5132 elsif ($char[$i] eq '\U') {
5133 0 $char[$i] = '@{[Elatin3::uc qq<';
5134 0 $left_e++;
5135 }
5136 elsif ($char[$i] eq '\L') {
5137 0 $char[$i] = '@{[Elatin3::lc qq<';
5138 0 $left_e++;
5139 }
5140 elsif ($char[$i] eq '\F') {
5141 0 $char[$i] = '@{[Elatin3::fc qq<';
5142 0 $left_e++;
5143 }
5144 elsif ($char[$i] eq '\Q') {
5145 0 $char[$i] = '@{[CORE::quotemeta qq<';
5146 0 $left_e++;
5147 }
5148 elsif ($char[$i] eq '\E') {
5149 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
5150 0 $char[$i] = '>]}';
5151 0 $right_e++;
5152 }
5153 else {
5154 0 $char[$i] = '';
5155 }
5156 }
5157 elsif ($char[$i] eq '\Q') {
5158 0 while (1) {
5159 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5160 0 last;
5161 }
5162 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
5163 0 last;
5164 }
5165 }
5166 }
5167 elsif ($char[$i] eq '\E') {
5168 }
5169  
5170 # $0 --> $0
5171 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
5172 }
5173 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
5174 }
5175  
5176 # $$ --> $$
5177 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
5178 }
5179  
5180 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
5181 # $1, $2, $3 --> $1, $2, $3 otherwise
5182 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
5183 0 $char[$i] = e_capture($1);
5184 }
5185 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
5186 0 $char[$i] = e_capture($1);
5187 }
5188  
5189 # $$foo[ ... ] --> $ $foo->[ ... ]
5190 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
5191 0 $char[$i] = e_capture($1.'->'.$2);
5192 }
5193  
5194 # $$foo{ ... } --> $ $foo->{ ... }
5195 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
5196 0 $char[$i] = e_capture($1.'->'.$2);
5197 }
5198  
5199 # $$foo
5200 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
5201 0 $char[$i] = e_capture($1);
5202 }
5203  
5204 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin3::PREMATCH()
5205 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
5206 8 $char[$i] = '@{[Elatin3::PREMATCH()]}';
5207 }
5208  
5209 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin3::MATCH()
5210 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
5211 8 $char[$i] = '@{[Elatin3::MATCH()]}';
5212 }
5213  
5214 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin3::POSTMATCH()
5215 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
5216 6 $char[$i] = '@{[Elatin3::POSTMATCH()]}';
5217 }
5218  
5219 # ${ foo } --> ${ foo }
5220 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/oxms) {
5221 }
5222  
5223 # ${ ... }
5224 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5225 0 $char[$i] = e_capture($1);
5226 }
5227 }
5228  
5229 # return string
5230 93 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 93 93
5231 0 return join '', @char, '>]}' x ($left_e - $right_e);
5232 }
5233 93 return join '', @char;
5234 }
5235  
5236 #
5237 # escape regexp (m//, qr//)
5238 #
5239 880 ▶sub e_qr {
Subroutine e_qr: called CC=110 SCAR=73.6
Pod undocumented
5240 880 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5241 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
5242  
5243 880 $modifier =~ tr/p//d;
5244 880 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 880 880
5245 0 my $line = 0;
5246 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
5247 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
5248 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
5249 0 last;
5250 }
5251 }
5252 0 die qq{Unsupported modifier "$1" used at line $line.\n};
5253 }
5254  
5255 880 $slash = 'div';
5256  
5257 # literal null string pattern
5258 880 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 872 880
elsif ($modifier =~ tr/Bb//d) { } 2 870 872
5259 8 $modifier =~ tr/bB//d;
5260 8 $modifier =~ tr/i//d;
5261 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
5262 }
5263  
5264 # /b /B modifier
5265 elsif ($modifier =~ tr/bB//d) {
5266  
5267 # choice again delimiter
5268 2 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 2 2
5269 0 my @char = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5270 0 my %octet = map {$_ => 1} @char;
5271 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
5272 0 $delimiter = '(';
5273 0 $end_delimiter = ')';
5274 }
5275 elsif (not $octet{'}'}) {
5276 0 $delimiter = '{';
5277 0 $end_delimiter = '}';
5278 }
5279 elsif (not $octet{']'}) {
5280 0 $delimiter = '[';
5281 0 $end_delimiter = ']';
5282 }
5283 elsif (not $octet{'>'}) {
5284 0 $delimiter = '<';
5285 0 $end_delimiter = '>';
5286 }
5287 else {
5288 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5289 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5290 0 $delimiter = $char;
5291 0 $end_delimiter = $char;
5292 0 last;
5293 }
5294 }
5295 }
5296 }
5297  
5298 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
5299 0 return join '', $ope, $delimiter, $string, $matched, $end_delimiter, $modifier;
5300 }
5301 else {
5302 2 return join '', $ope, $delimiter, '(?:', $string, ')', $matched, $end_delimiter, $modifier;
5303 }
5304 }
5305  
5306 870 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 312 558 870
5307 870 my $metachar = qr/[\@\\|[\]{^]/oxms;
5308  
5309 # split regexp
5310 870 my @char = $string =~ /\G((?>
5311 [^\\\$\@\[\(] |
5312 \\x (?>[0-9A-Fa-f]{1,2}) |
5313 \\ (?>[0-7]{2,3}) |
5314 \\c [\x40-\x5F] |
5315 \\x\{ (?>[0-9A-Fa-f]+) \} |
5316 \\o\{ (?>[0-7]+) \} |
5317 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
5318 \\ $q_char |
5319 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5320 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5321 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5322 [\$\@] $qq_variable |
5323 \$ (?>\s* [0-9]+) |
5324 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5325 \$ \$ (?![\w\{]) |
5326 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5327 \[\^ |
5328 \[\: (?>[a-z]+) :\] |
5329 \[\:\^ (?>[a-z]+) :\] |
5330 \(\? |
5331 $q_char
5332 ))/oxmsg;
5333  
5334 # choice again delimiter
5335 870 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 870 870
5336 0 my %octet = map {$_ => 1} @char;
5337 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
5338 0 $delimiter = '(';
5339 0 $end_delimiter = ')';
5340 }
5341 elsif (not $octet{'}'}) {
5342 0 $delimiter = '{';
5343 0 $end_delimiter = '}';
5344 }
5345 elsif (not $octet{']'}) {
5346 0 $delimiter = '[';
5347 0 $end_delimiter = ']';
5348 }
5349 elsif (not $octet{'>'}) {
5350 0 $delimiter = '<';
5351 0 $end_delimiter = '>';
5352 }
5353 else {
5354 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5355 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5356 0 $delimiter = $char;
5357 0 $end_delimiter = $char;
5358 0 last;
5359 }
5360 }
5361 }
5362 }
5363  
5364 870 my $left_e = 0;
5365 870 my $right_e = 0;
5366 870 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 2100 870 2970
5367  
5368 # "\L\u" --> "\u\L"
5369 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
5370 0 @char[$i,$i+1] = @char[$i+1,$i];
5371 }
5372  
5373 # "\U\l" --> "\l\U"
5374 ▶ 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
5375 0 @char[$i,$i+1] = @char[$i+1,$i];
5376 }
5377  
5378 # octal escape sequence
5379 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5380 1 $char[$i] = Elatin3::octchr($1);
5381 }
5382  
5383 # hexadecimal escape sequence
5384 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5385 1 $char[$i] = Elatin3::hexchr($1);
5386 }
5387  
5388 # \b{...} --> b\{...}
5389 # \B{...} --> B\{...}
5390 # \N{CHARNAME} --> N\{CHARNAME}
5391 # \p{PROPERTY} --> p\{PROPERTY}
5392 # \P{PROPERTY} --> P\{PROPERTY}
5393 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5394 6 $char[$i] = $1 . '\\' . $2;
5395 }
5396  
5397 # \p, \P, \X --> p, P, X
5398 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
5399 4 $char[$i] = $1;
5400 }
5401  
5402 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 &Elatin3::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
5403 }
5404  
5405 # join separated multiple-octet
5406 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
5407 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 $Elatin3::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 $Elatin3::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 $Elatin3::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 $Elatin3::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 $Elatin3::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 $Elatin3::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 $Elatin3::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5408 0 $char[$i] .= join '', splice @char, $i+1, 3;
5409 }
5410 ▶ 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 $Elatin3::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 $Elatin3::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 $Elatin3::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 $Elatin3::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5411 0 $char[$i] .= join '', splice @char, $i+1, 2;
5412 }
5413 ▶ 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 $Elatin3::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 $Elatin3::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 $Elatin3::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 $Elatin3::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5414 0 $char[$i] .= join '', splice @char, $i+1, 1;
5415 }
5416 }
5417  
5418 # open character class [...]
5419 elsif ($char[$i] eq '[') {
5420 556 my $left = $i;
5421  
5422 # [] make die "Unmatched [] in regexp ...\n"
5423 # (and so on)
5424  
5425 556 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 3 553 556
5426 3 $i++;
5427 }
5428  
5429 556 while (1) {
5430 2063 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 2063 2063
5431 0 die __FILE__, ": Unmatched [] in regexp\n";
5432 }
5433 2063 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 556 1507 2063
5434 556 my $right = $i;
5435  
5436 # [...]
5437 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
5438 30 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin3::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
5439 }
5440 else {
5441 526 splice @char, $left, $right-$left+1, Elatin3::charlist_qr(@char[$left+1..$right-1], $modifier);
5442 }
5443  
5444 556 $i = $left;
5445 556 last;
5446 }
5447 }
5448 }
5449  
5450 # open character class [^...]
5451 elsif ($char[$i] eq '[^') {
5452 74 my $left = $i;
5453  
5454 # [^] make die "Unmatched [] in regexp ...\n"
5455 # (and so on)
5456  
5457 74 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 4 70 74
5458 4 $i++;
5459 }
5460  
5461 74 while (1) {
5462 272 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 272 272
5463 0 die __FILE__, ": Unmatched [] in regexp\n";
5464 }
5465 272 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 74 198 272
5466 74 my $right = $i;
5467  
5468 # [^...]
5469 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
5470 30 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin3::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
5471 }
5472 else {
5473 44 splice @char, $left, $right-$left+1, Elatin3::charlist_not_qr(@char[$left+1..$right-1], $modifier);
5474 }
5475  
5476 74 $i = $left;
5477 74 last;
5478 }
5479 }
5480 }
5481  
5482 # rewrite character class or escape character
5483 elsif (my $char = character_class($char[$i],$modifier)) {
5484 139 $char[$i] = $char;
5485 }
5486  
5487 # /i modifier
5488 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin3::uc($char[$i]) ne Elatin3::fc($char[$i]))) {
Condition100%6/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin3::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 &Elatin3::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin3::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= &Elatin3::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
5489 20 ▶ if (CORE::length(Elatin3::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 20 0 20
5490 20 $char[$i] = '[' . Elatin3::uc($char[$i]) . Elatin3::fc($char[$i]) . ']';
5491 }
5492 else {
5493 0 $char[$i] = '(?:' . Elatin3::uc($char[$i]) . '|' . Elatin3::fc($char[$i]) . ')';
5494 }
5495 }
5496  
5497 # \u \l \U \L \F \Q \E
5498 elsif ($char[$i] =~ /\A [<>] \z/oxms) {
5499 1 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 1 1
5500 0 $char[$i] = '\\' . $char[$i];
5501 }
5502 }
5503 elsif ($char[$i] eq '\u') {
5504 0 $char[$i] = '@{[Elatin3::ucfirst qq<';
5505 0 $left_e++;
5506 }
5507 elsif ($char[$i] eq '\l') {
5508 0 $char[$i] = '@{[Elatin3::lcfirst qq<';
5509 0 $left_e++;
5510 }
5511 elsif ($char[$i] eq '\U') {
5512 1 $char[$i] = '@{[Elatin3::uc qq<';
5513 1 $left_e++;
5514 }
5515 elsif ($char[$i] eq '\L') {
5516 1 $char[$i] = '@{[Elatin3::lc qq<';
5517 1 $left_e++;
5518 }
5519 elsif ($char[$i] eq '\F') {
5520 18 $char[$i] = '@{[Elatin3::fc qq<';
5521 18 $left_e++;
5522 }
5523 elsif ($char[$i] eq '\Q') {
5524 1 $char[$i] = '@{[CORE::quotemeta qq<';
5525 1 $left_e++;
5526 }
5527 elsif ($char[$i] eq '\E') {
5528 21 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 21 0 21
5529 21 $char[$i] = '>]}';
5530 21 $right_e++;
5531 }
5532 else {
5533 0 $char[$i] = '';
5534 }
5535 }
5536 elsif ($char[$i] eq '\Q') {
5537 0 while (1) {
5538 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5539 0 last;
5540 }
5541 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
5542 0 last;
5543 }
5544 }
5545 }
5546 elsif ($char[$i] eq '\E') {
5547 }
5548  
5549 # $0 --> $0
5550 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
5551 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5552 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
5553 }
5554 }
5555 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
5556 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5557 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
5558 }
5559 }
5560  
5561 # $$ --> $$
5562 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
5563 }
5564  
5565 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
5566 # $1, $2, $3 --> $1, $2, $3 otherwise
5567 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
5568 0 $char[$i] = e_capture($1);
5569 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5570 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
5571 }
5572 }
5573 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
5574 0 $char[$i] = e_capture($1);
5575 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5576 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
5577 }
5578 }
5579  
5580 # $$foo[ ... ] --> $ $foo->[ ... ]
5581 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
5582 0 $char[$i] = e_capture($1.'->'.$2);
5583 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5584 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
5585 }
5586 }
5587  
5588 # $$foo{ ... } --> $ $foo->{ ... }
5589 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
5590 0 $char[$i] = e_capture($1.'->'.$2);
5591 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5592 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
5593 }
5594 }
5595  
5596 # $$foo
5597 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
5598 0 $char[$i] = e_capture($1);
5599 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5600 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
5601 }
5602 }
5603  
5604 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin3::PREMATCH()
5605 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
5606 8 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 8 8
5607 0 $char[$i] = '@{[Elatin3::ignorecase(Elatin3::PREMATCH())]}';
5608 }
5609 else {
5610 8 $char[$i] = '@{[Elatin3::PREMATCH()]}';
5611 }
5612 }
5613  
5614 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin3::MATCH()
5615 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
5616 8 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 8 8
5617 0 $char[$i] = '@{[Elatin3::ignorecase(Elatin3::MATCH())]}';
5618 }
5619 else {
5620 8 $char[$i] = '@{[Elatin3::MATCH()]}';
5621 }
5622 }
5623  
5624 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin3::POSTMATCH()
5625 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
5626 6 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 6 6
5627 0 $char[$i] = '@{[Elatin3::ignorecase(Elatin3::POSTMATCH())]}';
5628 }
5629 else {
5630 6 $char[$i] = '@{[Elatin3::POSTMATCH()]}';
5631 }
5632 }
5633  
5634 # ${ foo }
5635 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
5636 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5637 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
5638 }
5639 }
5640  
5641 # ${ ... }
5642 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5643 0 $char[$i] = e_capture($1);
5644 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5645 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
5646 }
5647 }
5648  
5649 # $scalar or @array
5650 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
5651 21 $char[$i] = e_string($char[$i]);
5652 21 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 11 10 21
5653 11 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
5654 }
5655 }
5656  
5657 # quote character before ? + * {
5658 ▶ 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
5659 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
5660 }
5661 ▶ 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
5662 0 my $char = $char[$i-1];
5663 0 ▶ if ($char[$i] eq '{') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq '{') { } 0 0 0
5664 0 die __FILE__, qq{: "MULTIBYTE{n}" should be "(MULTIBYTE){n}" in m?? (and shift \$1,\$2,\$3,...) ($char){n}\n};
5665 }
5666 else {
5667 0 die __FILE__, qq{: "MULTIBYTE$char[$i]" should be "(MULTIBYTE)$char[$i]" in m?? (and shift \$1,\$2,\$3,...) ($char)$char[$i]\n};
5668 }
5669 }
5670 else {
5671 127 $char[$i-1] = '(?:' . $char[$i-1] . ')';
5672 }
5673 }
5674 }
5675  
5676 # make regexp string
5677 870 $modifier =~ tr/i//d;
5678 870 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 870 870
5679 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
5680 0 return join '', $ope, $delimiter, $anchor, @char, '>]}' x ($left_e - $right_e), $matched, $end_delimiter, $modifier;
5681 }
5682 else {
5683 0 return join '', $ope, $delimiter, $anchor, '(?:', @char, '>]}' x ($left_e - $right_e), ')', $matched, $end_delimiter, $modifier;
5684 }
5685 }
5686 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
5687 0 return join '', $ope, $delimiter, $anchor, @char, $matched, $end_delimiter, $modifier;
5688 }
5689 else {
5690 870 return join '', $ope, $delimiter, $anchor, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
5691 }
5692 }
5693  
5694 #
5695 # double quote stuff
5696 #
5697 180 ▶sub qq_stuff {
Subroutine qq_stuff: called CC=6 SCAR=18.5
Pod undocumented
5698 180 my($delimiter,$end_delimiter,$stuff) = @_;
5699  
5700 # scalar variable or array variable
5701 180 ▶ if ($stuff =~ /\A [\$\@] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($stuff =~ /\A [\$\@] /mosx) 100 80 180
5702 100 return $stuff;
5703 }
5704  
5705 # quote by delimiter
5706 80 my %octet = map {$_ => 1} ($stuff =~ /\G ([\x00-\xFF]) /oxmsg);
5707 80 for my $char (qw( ! " $ % & * + - . / : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5708 80 ▶ next if $char eq $delimiter;
Branch: 1 branch
BranchTrueFalseTotal
if $char eq $delimiter 0 80 80
5709 80 ▶ next if $char eq $end_delimiter;
Branch: 1 branch
BranchTrueFalseTotal
if $char eq $end_delimiter 0 80 80
5710 80 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 80 0 80
5711 80 return join '', 'qq', $char, $stuff, $char;
5712 }
5713 }
5714 0 return join '', 'qq', '<', $stuff, '>';
5715 }
5716  
5717 #
5718 # escape regexp (m'', qr'', and m''b, qr''b)
5719 #
5720 10 ▶sub e_qr_q {
Subroutine e_qr_q: called CC=7 SCAR=25.3
Pod undocumented
5721 10 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5722 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
5723  
5724 10 $modifier =~ tr/p//d;
5725 10 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 10 10
5726 0 my $line = 0;
5727 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
5728 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
5729 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
5730 0 last;
5731 }
5732 }
5733 0 die qq{Unsupported modifier "$1" used at line $line.\n};
5734 }
5735  
5736 10 $slash = 'div';
5737  
5738 # literal null string pattern
5739 10 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 2 10
elsif ($modifier =~ tr/Bb//d) { } 0 2 2
5740 8 $modifier =~ tr/bB//d;
5741 8 $modifier =~ tr/i//d;
5742 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
5743 }
5744  
5745 # with /b /B modifier
5746 elsif ($modifier =~ tr/bB//d) {
5747 0 return e_qr_qb($ope,$delimiter,$end_delimiter,$string,$modifier);
5748 }
5749  
5750 # without /b /B modifier
5751 else {
5752 2 return e_qr_qt($ope,$delimiter,$end_delimiter,$string,$modifier);
5753 }
5754 }
5755  
5756 #
5757 # escape regexp (m'', qr'')
5758 #
5759 2 ▶sub e_qr_qt {
Subroutine e_qr_qt: called CC=20 SCAR=51.8
Pod undocumented
5760 2 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5761  
5762 2 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 2 2
5763  
5764 # split regexp
5765 2 my @char = $string =~ /\G((?>
5766 [^\\\[\$\@\/] |
5767 [\x00-\xFF] |
5768 \[\^ |
5769 \[\: (?>[a-z]+) \:\] |
5770 \[\:\^ (?>[a-z]+) \:\] |
5771 [\$\@\/] |
5772 \\ (?:$q_char) |
5773 (?:$q_char)
5774 ))/oxmsg;
5775  
5776 # unescape character
5777 2 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 2 2 4
5778 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 &Elatin3::uc($char[$i]) ne &fc($char[$i])) { } 0 2 2
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 4 4
5779 }
5780  
5781 # open character class [...]
5782 elsif ($char[$i] eq '[') {
5783 0 my $left = $i;
5784 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
5785 0 $i++;
5786 }
5787 0 while (1) {
5788 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5789 0 die __FILE__, ": Unmatched [] in regexp\n";
5790 }
5791 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
5792 0 my $right = $i;
5793  
5794 # [...]
5795 0 splice @char, $left, $right-$left+1, Elatin3::charlist_qr(@char[$left+1..$right-1], $modifier);
5796  
5797 0 $i = $left;
5798 0 last;
5799 }
5800 }
5801 }
5802  
5803 # open character class [^...]
5804 elsif ($char[$i] eq '[^') {
5805 0 my $left = $i;
5806 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
5807 0 $i++;
5808 }
5809 0 while (1) {
5810 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5811 0 die __FILE__, ": Unmatched [] in regexp\n";
5812 }
5813 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
5814 0 my $right = $i;
5815  
5816 # [^...]
5817 0 splice @char, $left, $right-$left+1, Elatin3::charlist_not_qr(@char[$left+1..$right-1], $modifier);
5818  
5819 0 $i = $left;
5820 0 last;
5821 }
5822 }
5823 }
5824  
5825 # escape $ @ / and \
5826 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
5827 0 $char[$i] = '\\' . $char[$i];
5828 }
5829  
5830 # rewrite character class or escape character
5831 elsif (my $char = character_class($char[$i],$modifier)) {
5832 0 $char[$i] = $char;
5833 }
5834  
5835 # /i modifier
5836 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin3::uc($char[$i]) ne Elatin3::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin3::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 &Elatin3::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin3::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= &Elatin3::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
5837 0 ▶ if (CORE::length(Elatin3::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
5838 0 $char[$i] = '[' . Elatin3::uc($char[$i]) . Elatin3::fc($char[$i]) . ']';
5839 }
5840 else {
5841 0 $char[$i] = '(?:' . Elatin3::uc($char[$i]) . '|' . Elatin3::fc($char[$i]) . ')';
5842 }
5843 }
5844  
5845 # quote character before ? + * {
5846 ▶ 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
5847 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
5848 }
5849 else {
5850 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
5851 }
5852 }
5853 }
5854  
5855 2 $delimiter = '/';
5856 2 $end_delimiter = '/';
5857  
5858 2 $modifier =~ tr/i//d;
5859 2 return join '', $ope, $delimiter, $anchor, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
5860 }
5861  
5862 #
5863 # escape regexp (m''b, qr''b)
5864 #
5865 0 ▶sub e_qr_qb {
Subroutine e_qr_qb: not called CC=4 SCAR=30.0
Pod undocumented
5866 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5867  
5868 # split regexp
5869 0 my @char = $string =~ /\G ((?>[^\\]|\\\\)) /oxmsg;
5870  
5871 # unescape character
5872 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
5873 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
5874 }
5875  
5876 # remain \\
5877 elsif ($char[$i] eq '\\\\') {
5878 }
5879  
5880 # escape $ @ / and \
5881 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
5882 0 $char[$i] = '\\' . $char[$i];
5883 }
5884 }
5885  
5886 0 $delimiter = '/';
5887 0 $end_delimiter = '/';
5888 0 return join '', $ope, $delimiter, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
5889 }
5890  
5891 #
5892 # escape regexp (s/here//)
5893 #
5894 80 ▶sub e_s1 {
Subroutine e_s1: called CC=106 SCAR=81.1
Pod undocumented
5895 80 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5896 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
5897  
5898 80 $modifier =~ tr/p//d;
5899 80 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 80 80
5900 0 my $line = 0;
5901 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
5902 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
5903 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
5904 0 last;
5905 }
5906 }
5907 0 die qq{Unsupported modifier "$1" used at line $line.\n};
5908 }
5909  
5910 80 $slash = 'div';
5911  
5912 # literal null string pattern
5913 80 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 72 80
elsif ($modifier =~ tr/Bb//d) { } 0 72 72
5914 8 $modifier =~ tr/bB//d;
5915 8 $modifier =~ tr/i//d;
5916 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
5917 }
5918  
5919 # /b /B modifier
5920 elsif ($modifier =~ tr/bB//d) {
5921  
5922 # choice again delimiter
5923 0 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 0 0
5924 0 my @char = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5925 0 my %octet = map {$_ => 1} @char;
5926 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
5927 0 $delimiter = '(';
5928 0 $end_delimiter = ')';
5929 }
5930 elsif (not $octet{'}'}) {
5931 0 $delimiter = '{';
5932 0 $end_delimiter = '}';
5933 }
5934 elsif (not $octet{']'}) {
5935 0 $delimiter = '[';
5936 0 $end_delimiter = ']';
5937 }
5938 elsif (not $octet{'>'}) {
5939 0 $delimiter = '<';
5940 0 $end_delimiter = '>';
5941 }
5942 else {
5943 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5944 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5945 0 $delimiter = $char;
5946 0 $end_delimiter = $char;
5947 0 last;
5948 }
5949 }
5950 }
5951 }
5952  
5953 0 my $prematch = '';
5954 0 return join '', $ope, $delimiter, $prematch, '(?:', $string, ')', $matched, $end_delimiter, $modifier;
5955 }
5956  
5957 72 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 1 71 72
5958 72 my $metachar = qr/[\@\\|[\]{^]/oxms;
5959  
5960 # split regexp
5961 72 my @char = $string =~ /\G((?>
5962 [^\\\$\@\[\(] |
5963 \\ (?>[1-9][0-9]*) |
5964 \\g (?>\s*) (?>[1-9][0-9]*) |
5965 \\g (?>\s*) \{ (?>\s*) (?>[1-9][0-9]*) (?>\s*) \} |
5966 \\g (?>\s*) \{ (?>\s*) - (?>\s*) (?>[1-9][0-9]*) (?>\s*) \} |
5967 \\x (?>[0-9A-Fa-f]{1,2}) |
5968 \\ (?>[0-7]{2,3}) |
5969 \\c [\x40-\x5F] |
5970 \\x\{ (?>[0-9A-Fa-f]+) \} |
5971 \\o\{ (?>[0-7]+) \} |
5972 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
5973 \\ $q_char |
5974 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5975 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5976 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5977 [\$\@] $qq_variable |
5978 \$ (?>\s* [0-9]+) |
5979 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5980 \$ \$ (?![\w\{]) |
5981 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5982 \[\^ |
5983 \[\: (?>[a-z]+) :\] |
5984 \[\:\^ (?>[a-z]+) :\] |
5985 \(\? |
5986 $q_char
5987 ))/oxmsg;
5988  
5989 # choice again delimiter
5990 72 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 72 72
5991 0 my %octet = map {$_ => 1} @char;
5992 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
5993 0 $delimiter = '(';
5994 0 $end_delimiter = ')';
5995 }
5996 elsif (not $octet{'}'}) {
5997 0 $delimiter = '{';
5998 0 $end_delimiter = '}';
5999 }
6000 elsif (not $octet{']'}) {
6001 0 $delimiter = '[';
6002 0 $end_delimiter = ']';
6003 }
6004 elsif (not $octet{'>'}) {
6005 0 $delimiter = '<';
6006 0 $end_delimiter = '>';
6007 }
6008 else {
6009 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
6010 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
6011 0 $delimiter = $char;
6012 0 $end_delimiter = $char;
6013 0 last;
6014 }
6015 }
6016 }
6017 }
6018  
6019 # count '('
6020 72 my $parens = grep { $_ eq '(' } @char;
6021  
6022 72 my $left_e = 0;
6023 72 my $right_e = 0;
6024 72 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 200 72 272
6025  
6026 # "\L\u" --> "\u\L"
6027 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
6028 0 @char[$i,$i+1] = @char[$i+1,$i];
6029 }
6030  
6031 # "\U\l" --> "\l\U"
6032 ▶ 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
6033 0 @char[$i,$i+1] = @char[$i+1,$i];
6034 }
6035  
6036 # octal escape sequence
6037 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
6038 1 $char[$i] = Elatin3::octchr($1);
6039 }
6040  
6041 # hexadecimal escape sequence
6042 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
6043 1 $char[$i] = Elatin3::hexchr($1);
6044 }
6045  
6046 # \b{...} --> b\{...}
6047 # \B{...} --> B\{...}
6048 # \N{CHARNAME} --> N\{CHARNAME}
6049 # \p{PROPERTY} --> p\{PROPERTY}
6050 # \P{PROPERTY} --> P\{PROPERTY}
6051 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
6052 0 $char[$i] = $1 . '\\' . $2;
6053 }
6054  
6055 # \p, \P, \X --> p, P, X
6056 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
6057 0 $char[$i] = $1;
6058 }
6059  
6060 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 &Elatin3::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
6061 }
6062  
6063 # join separated multiple-octet
6064 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
6065 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 $Elatin3::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 $Elatin3::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 $Elatin3::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 $Elatin3::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 $Elatin3::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 $Elatin3::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 $Elatin3::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6066 0 $char[$i] .= join '', splice @char, $i+1, 3;
6067 }
6068 ▶ 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 $Elatin3::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 $Elatin3::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 $Elatin3::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 $Elatin3::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6069 0 $char[$i] .= join '', splice @char, $i+1, 2;
6070 }
6071 ▶ 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 $Elatin3::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 $Elatin3::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 $Elatin3::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 $Elatin3::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6072 0 $char[$i] .= join '', splice @char, $i+1, 1;
6073 }
6074 }
6075  
6076 # open character class [...]
6077 elsif ($char[$i] eq '[') {
6078 17 my $left = $i;
6079 17 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 17 17
6080 0 $i++;
6081 }
6082 17 while (1) {
6083 74 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 74 74
6084 0 die __FILE__, ": Unmatched [] in regexp\n";
6085 }
6086 74 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 17 57 74
6087 17 my $right = $i;
6088  
6089 # [...]
6090 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
6091 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin3::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6092 }
6093 else {
6094 17 splice @char, $left, $right-$left+1, Elatin3::charlist_qr(@char[$left+1..$right-1], $modifier);
6095 }
6096  
6097 17 $i = $left;
6098 17 last;
6099 }
6100 }
6101 }
6102  
6103 # open character class [^...]
6104 elsif ($char[$i] eq '[^') {
6105 0 my $left = $i;
6106 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6107 0 $i++;
6108 }
6109 0 while (1) {
6110 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6111 0 die __FILE__, ": Unmatched [] in regexp\n";
6112 }
6113 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6114 0 my $right = $i;
6115  
6116 # [^...]
6117 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
6118 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin3::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6119 }
6120 else {
6121 0 splice @char, $left, $right-$left+1, Elatin3::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6122 }
6123  
6124 0 $i = $left;
6125 0 last;
6126 }
6127 }
6128 }
6129  
6130 # rewrite character class or escape character
6131 elsif (my $char = character_class($char[$i],$modifier)) {
6132 7 $char[$i] = $char;
6133 }
6134  
6135 # /i modifier
6136 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin3::uc($char[$i]) ne Elatin3::fc($char[$i]))) {
Condition66%4/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin3::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 &Elatin3::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin3::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= &Elatin3::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6137 3 ▶ if (CORE::length(Elatin3::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 3 0 3
6138 3 $char[$i] = '[' . Elatin3::uc($char[$i]) . Elatin3::fc($char[$i]) . ']';
6139 }
6140 else {
6141 0 $char[$i] = '(?:' . Elatin3::uc($char[$i]) . '|' . Elatin3::fc($char[$i]) . ')';
6142 }
6143 }
6144  
6145 # \u \l \U \L \F \Q \E
6146 elsif ($char[$i] =~ /\A [<>] \z/oxms) {
6147 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
6148 0 $char[$i] = '\\' . $char[$i];
6149 }
6150 }
6151 elsif ($char[$i] eq '\u') {
6152 0 $char[$i] = '@{[Elatin3::ucfirst qq<';
6153 0 $left_e++;
6154 }
6155 elsif ($char[$i] eq '\l') {
6156 0 $char[$i] = '@{[Elatin3::lcfirst qq<';
6157 0 $left_e++;
6158 }
6159 elsif ($char[$i] eq '\U') {
6160 0 $char[$i] = '@{[Elatin3::uc qq<';
6161 0 $left_e++;
6162 }
6163 elsif ($char[$i] eq '\L') {
6164 0 $char[$i] = '@{[Elatin3::lc qq<';
6165 0 $left_e++;
6166 }
6167 elsif ($char[$i] eq '\F') {
6168 0 $char[$i] = '@{[Elatin3::fc qq<';
6169 0 $left_e++;
6170 }
6171 elsif ($char[$i] eq '\Q') {
6172 0 $char[$i] = '@{[CORE::quotemeta qq<';
6173 0 $left_e++;
6174 }
6175 elsif ($char[$i] eq '\E') {
6176 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
6177 0 $char[$i] = '>]}';
6178 0 $right_e++;
6179 }
6180 else {
6181 0 $char[$i] = '';
6182 }
6183 }
6184 elsif ($char[$i] eq '\Q') {
6185 0 while (1) {
6186 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6187 0 last;
6188 }
6189 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
6190 0 last;
6191 }
6192 }
6193 }
6194 elsif ($char[$i] eq '\E') {
6195 }
6196  
6197 # \0 --> \0
6198 elsif ($char[$i] =~ /\A \\ (?>\s*) 0 \z/oxms) {
6199 }
6200  
6201 # \g{N}, \g{-N}
6202  
6203 # P.108 Using Simple Patterns
6204 # in Chapter 7: In the World of Regular Expressions
6205 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
6206  
6207 # P.221 Capturing
6208 # in Chapter 5: Pattern Matching
6209 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
6210  
6211 # \g{-1}, \g{-2}, \g{-3} --> \g{-1}, \g{-2}, \g{-3}
6212 elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) - (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6213 }
6214  
6215 # \g{1}, \g{2}, \g{3} --> \g{2}, \g{3}, \g{4} (only when multibyte anchoring is enable)
6216 elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6217 }
6218  
6219 # \g1, \g2, \g3 --> \g2, \g3, \g4 (only when multibyte anchoring is enable)
6220 elsif ($char[$i] =~ /\A \\g (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) {
6221 }
6222  
6223 # \1, \2, \3 --> \2, \3, \4 (only when multibyte anchoring is enable)
6224 elsif ($char[$i] =~ /\A \\ (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) {
6225 }
6226  
6227 # $0 --> $0
6228 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
6229 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6230 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
6231 }
6232 }
6233 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
6234 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6235 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
6236 }
6237 }
6238  
6239 # $$ --> $$
6240 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
6241 }
6242  
6243 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
6244 # $1, $2, $3 --> $1, $2, $3 otherwise
6245 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
6246 0 $char[$i] = e_capture($1);
6247 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6248 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
6249 }
6250 }
6251 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6252 0 $char[$i] = e_capture($1);
6253 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6254 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
6255 }
6256 }
6257  
6258 # $$foo[ ... ] --> $ $foo->[ ... ]
6259 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
6260 0 $char[$i] = e_capture($1.'->'.$2);
6261 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6262 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
6263 }
6264 }
6265  
6266 # $$foo{ ... } --> $ $foo->{ ... }
6267 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
6268 0 $char[$i] = e_capture($1.'->'.$2);
6269 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6270 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
6271 }
6272 }
6273  
6274 # $$foo
6275 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
6276 0 $char[$i] = e_capture($1);
6277 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6278 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
6279 }
6280 }
6281  
6282 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin3::PREMATCH()
6283 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
6284 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 4 4
6285 0 $char[$i] = '@{[Elatin3::ignorecase(Elatin3::PREMATCH())]}';
6286 }
6287 else {
6288 4 $char[$i] = '@{[Elatin3::PREMATCH()]}';
6289 }
6290 }
6291  
6292 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin3::MATCH()
6293 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
6294 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 4 4
6295 0 $char[$i] = '@{[Elatin3::ignorecase(Elatin3::MATCH())]}';
6296 }
6297 else {
6298 4 $char[$i] = '@{[Elatin3::MATCH()]}';
6299 }
6300 }
6301  
6302 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin3::POSTMATCH()
6303 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
6304 3 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 3 3
6305 0 $char[$i] = '@{[Elatin3::ignorecase(Elatin3::POSTMATCH())]}';
6306 }
6307 else {
6308 3 $char[$i] = '@{[Elatin3::POSTMATCH()]}';
6309 }
6310 }
6311  
6312 # ${ foo }
6313 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
6314 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6315 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
6316 }
6317 }
6318  
6319 # ${ ... }
6320 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
6321 0 $char[$i] = e_capture($1);
6322 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6323 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
6324 }
6325 }
6326  
6327 # $scalar or @array
6328 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
6329 4 $char[$i] = e_string($char[$i]);
6330 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 4 4
6331 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
6332 }
6333 }
6334  
6335 # quote character before ? + * {
6336 ▶ 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
6337 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
6338 }
6339 else {
6340 14 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6341 }
6342 }
6343 }
6344  
6345 # make regexp string
6346 72 my $prematch = '';
6347 72 $modifier =~ tr/i//d;
6348 72 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 72 72
6349 0 return join '', $ope, $delimiter, $prematch, '(?:', @char, '>]}' x ($left_e - $right_e), ')', $matched, $end_delimiter, $modifier;
6350 }
6351 72 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6352 }
6353  
6354 #
6355 # escape regexp (s'here'' or s'here''b)
6356 #
6357 21 ▶sub e_s1_q {
Subroutine e_s1_q: called CC=7 SCAR=24.3
Pod undocumented
6358 21 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6359 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
6360  
6361 21 $modifier =~ tr/p//d;
6362 21 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 21 21
6363 0 my $line = 0;
6364 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6365 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6366 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6367 0 last;
6368 }
6369 }
6370 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6371 }
6372  
6373 21 $slash = 'div';
6374  
6375 # literal null string pattern
6376 21 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 13 21
elsif ($modifier =~ tr/Bb//d) { } 0 13 13
6377 8 $modifier =~ tr/bB//d;
6378 8 $modifier =~ tr/i//d;
6379 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
6380 }
6381  
6382 # with /b /B modifier
6383 elsif ($modifier =~ tr/bB//d) {
6384 0 return e_s1_qb($ope,$delimiter,$end_delimiter,$string,$modifier);
6385 }
6386  
6387 # without /b /B modifier
6388 else {
6389 13 return e_s1_qt($ope,$delimiter,$end_delimiter,$string,$modifier);
6390 }
6391 }
6392  
6393 #
6394 # escape regexp (s'here'')
6395 #
6396 13 ▶sub e_s1_qt {
Subroutine e_s1_qt: called CC=20 SCAR=50.1
Pod undocumented
6397 13 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6398  
6399 13 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 13 13
6400  
6401 # split regexp
6402 13 my @char = $string =~ /\G((?>
6403 [^\\\[\$\@\/] |
6404 [\x00-\xFF] |
6405 \[\^ |
6406 \[\: (?>[a-z]+) \:\] |
6407 \[\:\^ (?>[a-z]+) \:\] |
6408 [\$\@\/] |
6409 \\ (?:$q_char) |
6410 (?:$q_char)
6411 ))/oxmsg;
6412  
6413 # unescape character
6414 13 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 25 13 38
6415 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 &Elatin3::uc($char[$i]) ne &fc($char[$i])) { } 0 19 19
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 32 32
6416 }
6417  
6418 # open character class [...]
6419 elsif ($char[$i] eq '[') {
6420 0 my $left = $i;
6421 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6422 0 $i++;
6423 }
6424 0 while (1) {
6425 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6426 0 die __FILE__, ": Unmatched [] in regexp\n";
6427 }
6428 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6429 0 my $right = $i;
6430  
6431 # [...]
6432 0 splice @char, $left, $right-$left+1, Elatin3::charlist_qr(@char[$left+1..$right-1], $modifier);
6433  
6434 0 $i = $left;
6435 0 last;
6436 }
6437 }
6438 }
6439  
6440 # open character class [^...]
6441 elsif ($char[$i] eq '[^') {
6442 0 my $left = $i;
6443 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6444 0 $i++;
6445 }
6446 0 while (1) {
6447 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6448 0 die __FILE__, ": Unmatched [] in regexp\n";
6449 }
6450 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6451 0 my $right = $i;
6452  
6453 # [^...]
6454 0 splice @char, $left, $right-$left+1, Elatin3::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6455  
6456 0 $i = $left;
6457 0 last;
6458 }
6459 }
6460 }
6461  
6462 # escape $ @ / and \
6463 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6464 0 $char[$i] = '\\' . $char[$i];
6465 }
6466  
6467 # rewrite character class or escape character
6468 elsif (my $char = character_class($char[$i],$modifier)) {
6469 6 $char[$i] = $char;
6470 }
6471  
6472 # /i modifier
6473 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin3::uc($char[$i]) ne Elatin3::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin3::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 &Elatin3::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin3::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= &Elatin3::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6474 0 ▶ if (CORE::length(Elatin3::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
6475 0 $char[$i] = '[' . Elatin3::uc($char[$i]) . Elatin3::fc($char[$i]) . ']';
6476 }
6477 else {
6478 0 $char[$i] = '(?:' . Elatin3::uc($char[$i]) . '|' . Elatin3::fc($char[$i]) . ')';
6479 }
6480 }
6481  
6482 # quote character before ? + * {
6483 ▶ 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
6484 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
6485 }
6486 else {
6487 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6488 }
6489 }
6490 }
6491  
6492 13 $modifier =~ tr/i//d;
6493 13 $delimiter = '/';
6494 13 $end_delimiter = '/';
6495 13 my $prematch = '';
6496 13 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6497 }
6498  
6499 #
6500 # escape regexp (s'here''b)
6501 #
6502 0 ▶sub e_s1_qb {
Subroutine e_s1_qb: not called CC=4 SCAR=30.0
Pod undocumented
6503 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6504  
6505 # split regexp
6506 0 my @char = $string =~ /\G (?>[^\\]|\\\\) /oxmsg;
6507  
6508 # unescape character
6509 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
6510 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
6511 }
6512  
6513 # remain \\
6514 elsif ($char[$i] eq '\\\\') {
6515 }
6516  
6517 # escape $ @ / and \
6518 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6519 0 $char[$i] = '\\' . $char[$i];
6520 }
6521 }
6522  
6523 0 $delimiter = '/';
6524 0 $end_delimiter = '/';
6525 0 my $prematch = '';
6526 0 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6527 }
6528  
6529 #
6530 # escape regexp (s''here')
6531 #
6532 16 ▶sub e_s2_q {
Subroutine e_s2_q: called CC=4 SCAR=13.9
Pod undocumented
6533 16 my($ope,$delimiter,$end_delimiter,$string) = @_;
6534  
6535 16 $slash = 'div';
6536  
6537 16 my @char = $string =~ / \G (?>[^\\]|\\\\|$q_char) /oxmsg;
6538 16 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 9 16 25
6539 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
6540 }
6541  
6542 # not escape \\
6543 elsif ($char[$i] =~ /\A \\\\ \z/oxms) {
6544 }
6545  
6546 # escape $ @ / and \
6547 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6548 5 $char[$i] = '\\' . $char[$i];
6549 }
6550 }
6551  
6552 16 return join '', $ope, $delimiter, @char, $end_delimiter;
6553 }
6554  
6555 #
6556 # escape regexp (s/here/and here/modifier)
6557 #
6558 101 ▶sub e_sub {
Subroutine e_sub: called CC=20 SCAR=32.6
Pod undocumented
6559 101 my($variable,$delimiter1,$pattern,$end_delimiter1,$delimiter2,$replacement,$end_delimiter2,$modifier) = @_;
6560 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
6561  
6562 101 $modifier =~ tr/p//d;
6563 101 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 101 101
6564 0 my $line = 0;
6565 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6566 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6567 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6568 0 last;
6569 }
6570 }
6571 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6572 }
6573  
6574 101 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq "") 36 65 101
6575 36 $variable = '$_';
6576 36 $bind_operator = ' =~ ';
6577 }
6578  
6579 101 $slash = 'div';
6580  
6581 # P.128 Start of match (or end of previous match): \G
6582 # P.130 Advanced Use of \G with Perl
6583 # in Chapter 3: Overview of Regular Expression Features and Flavors
6584 # P.312 Iterative Matching: Scalar Context, with /g
6585 # in Chapter 7: Perl
6586 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
6587  
6588 # P.181 Where You Left Off: The \G Assertion
6589 # in Chapter 5: Pattern Matching
6590 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
6591  
6592 # P.220 Where You Left Off: The \G Assertion
6593 # in Chapter 5: Pattern Matching
6594 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
6595  
6596 101 my $e_modifier = $modifier =~ tr/e//d;
6597 101 my $r_modifier = $modifier =~ tr/r//d;
6598  
6599 101 my $my = '';
6600 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
6601 0 $my = $variable;
6602 0 $variable =~ s/ (?: local \b | my \b | our \b | state \b ) (?>\s*) //oxms;
6603 0 $variable =~ s/ = .+ \z//oxms;
6604 }
6605  
6606 101 (my $variable_basename = $variable) =~ s/ [\[\{].* \z//oxms;
6607 101 $variable_basename =~ s/ \s+ \z//oxms;
6608  
6609 # quote replacement string
6610 101 my $e_replacement = '';
6611 101 ▶ if ($e_modifier >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($e_modifier >= 1) { } 17 84 101
6612 17 $e_replacement = e_qq('', '', '', $replacement);
6613 17 $e_modifier--;
6614 }
6615 else {
6616 84 ▶ if ($delimiter2 eq "'") {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter2 eq q[']) { } 16 68 84
6617 16 $e_replacement = e_s2_q('qq', '/', '/', $replacement);
6618 }
6619 else {
6620 68 $e_replacement = e_qq ('qq', $delimiter2, $end_delimiter2, $replacement);
6621 }
6622 }
6623  
6624 101 my $sub = '';
6625  
6626 # with /r
6627 101 ▶ if ($r_modifier) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r_modifier) { } 10 91 101
6628 10 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $modifier =~ /g/mosx }) { } 5 5 10
6629 }
6630  
6631 # s///gr without multibyte anchoring
6632 elsif ($modifier =~ /g/oxms) {
6633 5 ▶ $sub = sprintf(
Branch: 1 branch
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 0 5 5
6634 # 1 2 3 4 5
6635 q<CORE::eval{local $Elatin3::re_t=%s; while($Elatin3::re_t =~ %s){%s local $^W=0; local $Elatin3::re_r=%s; %s$Elatin3::re_t="$`$Elatin3::re_r$'"; pos($Elatin3::re_t)=length "$`$Elatin3::re_r"; } return $Elatin3::re_t}>,
6636  
6637 $variable, # 1
6638 ($delimiter1 eq "'") ? # 2
6639 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
6640 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
6641 $s_matched, # 3
6642 $e_replacement, # 4
6643 '$Elatin3::re_r=CORE::eval $Elatin3::re_r; ' x $e_modifier, # 5
6644 );
6645 }
6646  
6647 # s///r
6648 else {
6649  
6650 5 my $prematch = q{$`};
6651  
6652 5 ▶ $sub = sprintf(
Branch: 1 branch
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 0 5 5
6653 # 1 2 3 4 5 6 7
6654 q<(%s =~ %s) ? CORE::eval{%s local $^W=0; local $Elatin3::re_r=%s; %s"%s$Elatin3::re_r$'" } : %s>,
6655  
6656 $variable, # 1
6657 ($delimiter1 eq "'") ? # 2
6658 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
6659 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
6660 $s_matched, # 3
6661 $e_replacement, # 4
6662 '$Elatin3::re_r=CORE::eval $Elatin3::re_r; ' x $e_modifier, # 5
6663 $prematch, # 6
6664 $variable, # 7
6665 );
6666 }
6667  
6668 # $var !~ s///r doesn't make sense
6669 10 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) 0 10 10
6670 0 $sub = q{die("$0: Using !~ with s///r doesn't make sense"), } . $sub;
6671 }
6672 }
6673  
6674 # without /r
6675 else {
6676 91 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $modifier =~ /g/mosx }) { } 23 68 91
6677 }
6678  
6679 # s///g without multibyte anchoring
6680 elsif ($modifier =~ /g/oxms) {
6681 23 ▶ $sub = sprintf(
Branch: 2 branches
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 3 20 23
$bind_operator =~ / !~ /mosx ? : 3 20 23
6682 # 1 2 3 4 5 6 7 8
6683 q<CORE::eval{local $Elatin3::re_n=0; while(%s =~ %s){%s local $^W=0; local $Elatin3::re_r=%s; %s%s="$`$Elatin3::re_r$'"; pos(%s)=length "$`$Elatin3::re_r"; $Elatin3::re_n++} return %s$Elatin3::re_n}>,
6684  
6685 $variable, # 1
6686 ($delimiter1 eq "'") ? # 2
6687 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
6688 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
6689 $s_matched, # 3
6690 $e_replacement, # 4
6691 '$Elatin3::re_r=CORE::eval $Elatin3::re_r; ' x $e_modifier, # 5
6692 $variable, # 6
6693 $variable, # 7
6694 ($bind_operator =~ / !~ /oxms) ? '!' : '', # 8
6695 );
6696 }
6697  
6698 # s///
6699 else {
6700  
6701 68 my $prematch = q{$`};
6702  
6703 68 ▶ $sub = sprintf(
Branch: 2 branches
BranchTrueFalseTotal
$bind_operator =~ / =~ /mosx ? : 65 3 68
$delimiter1 eq q['] ? : 18 50 68
6704  
6705 ($bind_operator =~ / =~ /oxms) ?
6706  
6707 # 1 2 3 4 5 6 7 8
6708 q<(%s%s%s) ? CORE::eval{%s local $^W=0; local $Elatin3::re_r=%s; %s%s="%s$Elatin3::re_r$'"; 1 } : undef> :
6709  
6710 # 1 2 3 4 5 6 7 8
6711 q<(%s%s%s) ? 1 : CORE::eval{%s local $^W=0; local $Elatin3::re_r=%s; %s%s="%s$Elatin3::re_r$'"; undef }>,
6712  
6713 $variable, # 1
6714 $bind_operator, # 2
6715 ($delimiter1 eq "'") ? # 3
6716 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
6717 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
6718 $s_matched, # 4
6719 $e_replacement, # 5
6720 '$Elatin3::re_r=CORE::eval $Elatin3::re_r; ' x $e_modifier, # 6
6721 $variable, # 7
6722 $prematch, # 8
6723 );
6724 }
6725 }
6726  
6727 # (my $foo = $bar) =~ s/// --> (my $foo = $bar, CORE::eval { ... })[1]
6728 101 ▶ if ($my ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($my ne "") 0 101 101
6729 0 $sub = "($my, $sub)[1]";
6730 }
6731  
6732 # clear s/// variable
6733 101 $sub_variable = '';
6734 101 $bind_operator = '';
6735  
6736 101 return $sub;
6737 }
6738  
6739 #
6740 # escape regexp of split qr//
6741 #
6742 74 ▶sub e_split {
Subroutine e_split: called CC=88 SCAR=76.4
Pod undocumented
6743 74 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6744 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
6745  
6746 74 $modifier =~ tr/p//d;
6747 74 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 74 74
6748 0 my $line = 0;
6749 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6750 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6751 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6752 0 last;
6753 }
6754 }
6755 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6756 }
6757  
6758 74 $slash = 'div';
6759  
6760 # /b /B modifier
6761 74 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) 0 74 74
6762 0 return join '', 'split', $ope, $delimiter, $string, $end_delimiter, $modifier;
6763 }
6764  
6765 74 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 74 74
6766 74 my $metachar = qr/[\@\\|[\]{^]/oxms;
6767  
6768 # split regexp
6769 74 my @char = $string =~ /\G((?>
6770 [^\\\$\@\[\(] |
6771 \\x (?>[0-9A-Fa-f]{1,2}) |
6772 \\ (?>[0-7]{2,3}) |
6773 \\c [\x40-\x5F] |
6774 \\x\{ (?>[0-9A-Fa-f]+) \} |
6775 \\o\{ (?>[0-7]+) \} |
6776 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
6777 \\ $q_char |
6778 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
6779 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
6780 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
6781 [\$\@] $qq_variable |
6782 \$ (?>\s* [0-9]+) |
6783 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
6784 \$ \$ (?![\w\{]) |
6785 \$ (?>\s*) \$ (?>\s*) $qq_variable |
6786 \[\^ |
6787 \[\: (?>[a-z]+) :\] |
6788 \[\:\^ (?>[a-z]+) :\] |
6789 \(\? |
6790 $q_char
6791 ))/oxmsg;
6792  
6793 74 my $left_e = 0;
6794 74 my $right_e = 0;
6795 74 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 249 74 323
6796  
6797 # "\L\u" --> "\u\L"
6798 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
6799 0 @char[$i,$i+1] = @char[$i+1,$i];
6800 }
6801  
6802 # "\U\l" --> "\l\U"
6803 ▶ 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
6804 0 @char[$i,$i+1] = @char[$i+1,$i];
6805 }
6806  
6807 # octal escape sequence
6808 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
6809 1 $char[$i] = Elatin3::octchr($1);
6810 }
6811  
6812 # hexadecimal escape sequence
6813 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
6814 1 $char[$i] = Elatin3::hexchr($1);
6815 }
6816  
6817 # \b{...} --> b\{...}
6818 # \B{...} --> B\{...}
6819 # \N{CHARNAME} --> N\{CHARNAME}
6820 # \p{PROPERTY} --> p\{PROPERTY}
6821 # \P{PROPERTY} --> P\{PROPERTY}
6822 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
6823 0 $char[$i] = $1 . '\\' . $2;
6824 }
6825  
6826 # \p, \P, \X --> p, P, X
6827 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
6828 0 $char[$i] = $1;
6829 }
6830  
6831 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 &Elatin3::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
6832 }
6833  
6834 # join separated multiple-octet
6835 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
6836 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 $Elatin3::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 $Elatin3::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 $Elatin3::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 $Elatin3::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 $Elatin3::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 $Elatin3::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 $Elatin3::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6837 0 $char[$i] .= join '', splice @char, $i+1, 3;
6838 }
6839 ▶ 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 $Elatin3::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 $Elatin3::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 $Elatin3::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 $Elatin3::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6840 0 $char[$i] .= join '', splice @char, $i+1, 2;
6841 }
6842 ▶ 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 $Elatin3::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 $Elatin3::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 $Elatin3::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 $Elatin3::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6843 0 $char[$i] .= join '', splice @char, $i+1, 1;
6844 }
6845 }
6846  
6847 # open character class [...]
6848 elsif ($char[$i] eq '[') {
6849 3 my $left = $i;
6850 3 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 3 3
6851 0 $i++;
6852 }
6853 3 while (1) {
6854 7 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 7 7
6855 0 die __FILE__, ": Unmatched [] in regexp\n";
6856 }
6857 7 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 3 4 7
6858 3 my $right = $i;
6859  
6860 # [...]
6861 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
6862 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin3::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6863 }
6864 else {
6865 3 splice @char, $left, $right-$left+1, Elatin3::charlist_qr(@char[$left+1..$right-1], $modifier);
6866 }
6867  
6868 3 $i = $left;
6869 3 last;
6870 }
6871 }
6872 }
6873  
6874 # open character class [^...]
6875 elsif ($char[$i] eq '[^') {
6876 0 my $left = $i;
6877 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6878 0 $i++;
6879 }
6880 0 while (1) {
6881 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6882 0 die __FILE__, ": Unmatched [] in regexp\n";
6883 }
6884 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6885 0 my $right = $i;
6886  
6887 # [^...]
6888 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
6889 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin3::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6890 }
6891 else {
6892 0 splice @char, $left, $right-$left+1, Elatin3::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6893 }
6894  
6895 0 $i = $left;
6896 0 last;
6897 }
6898 }
6899 }
6900  
6901 # rewrite character class or escape character
6902 elsif (my $char = character_class($char[$i],$modifier)) {
6903 1 $char[$i] = $char;
6904 }
6905  
6906 # P.794 29.2.161. split
6907 # in Chapter 29: Functions
6908 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
6909  
6910 # P.951 split
6911 # in Chapter 27: Functions
6912 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
6913  
6914 # said "The //m modifier is assumed when you split on the pattern /^/",
6915 # but perl5.008 is not so. Therefore, this software adds //m.
6916 # (and so on)
6917  
6918 # split(m/^/) --> split(m/^/m)
6919 ▶ 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
6920 7 $modifier .= 'm';
6921 }
6922  
6923 # /i modifier
6924 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin3::uc($char[$i]) ne Elatin3::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin3::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 &Elatin3::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin3::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= &Elatin3::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6925 0 ▶ if (CORE::length(Elatin3::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
6926 0 $char[$i] = '[' . Elatin3::uc($char[$i]) . Elatin3::fc($char[$i]) . ']';
6927 }
6928 else {
6929 0 $char[$i] = '(?:' . Elatin3::uc($char[$i]) . '|' . Elatin3::fc($char[$i]) . ')';
6930 }
6931 }
6932  
6933 # \u \l \U \L \F \Q \E
6934 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
6935 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
6936 0 $char[$i] = '\\' . $char[$i];
6937 }
6938 }
6939 elsif ($char[$i] eq '\u') {
6940 0 $char[$i] = '@{[Elatin3::ucfirst qq<';
6941 0 $left_e++;
6942 }
6943 elsif ($char[$i] eq '\l') {
6944 0 $char[$i] = '@{[Elatin3::lcfirst qq<';
6945 0 $left_e++;
6946 }
6947 elsif ($char[$i] eq '\U') {
6948 0 $char[$i] = '@{[Elatin3::uc qq<';
6949 0 $left_e++;
6950 }
6951 elsif ($char[$i] eq '\L') {
6952 0 $char[$i] = '@{[Elatin3::lc qq<';
6953 0 $left_e++;
6954 }
6955 elsif ($char[$i] eq '\F') {
6956 0 $char[$i] = '@{[Elatin3::fc qq<';
6957 0 $left_e++;
6958 }
6959 elsif ($char[$i] eq '\Q') {
6960 0 $char[$i] = '@{[CORE::quotemeta qq<';
6961 0 $left_e++;
6962 }
6963 elsif ($char[$i] eq '\E') {
6964 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
6965 0 $char[$i] = '>]}';
6966 0 $right_e++;
6967 }
6968 else {
6969 0 $char[$i] = '';
6970 }
6971 }
6972 elsif ($char[$i] eq '\Q') {
6973 0 while (1) {
6974 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6975 0 last;
6976 }
6977 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
6978 0 last;
6979 }
6980 }
6981 }
6982 elsif ($char[$i] eq '\E') {
6983 }
6984  
6985 # $0 --> $0
6986 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
6987 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6988 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
6989 }
6990 }
6991 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
6992 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6993 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
6994 }
6995 }
6996  
6997 # $$ --> $$
6998 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
6999 }
7000  
7001 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
7002 # $1, $2, $3 --> $1, $2, $3 otherwise
7003 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
7004 0 $char[$i] = e_capture($1);
7005 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7006 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
7007 }
7008 }
7009 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
7010 0 $char[$i] = e_capture($1);
7011 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7012 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
7013 }
7014 }
7015  
7016 # $$foo[ ... ] --> $ $foo->[ ... ]
7017 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
7018 0 $char[$i] = e_capture($1.'->'.$2);
7019 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7020 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
7021 }
7022 }
7023  
7024 # $$foo{ ... } --> $ $foo->{ ... }
7025 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
7026 0 $char[$i] = e_capture($1.'->'.$2);
7027 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7028 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
7029 }
7030 }
7031  
7032 # $$foo
7033 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
7034 0 $char[$i] = e_capture($1);
7035 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7036 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
7037 }
7038 }
7039  
7040 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin3::PREMATCH()
7041 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
7042 12 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 12 12
7043 0 $char[$i] = '@{[Elatin3::ignorecase(Elatin3::PREMATCH())]}';
7044 }
7045 else {
7046 12 $char[$i] = '@{[Elatin3::PREMATCH()]}';
7047 }
7048 }
7049  
7050 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin3::MATCH()
7051 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
7052 12 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 12 12
7053 0 $char[$i] = '@{[Elatin3::ignorecase(Elatin3::MATCH())]}';
7054 }
7055 else {
7056 12 $char[$i] = '@{[Elatin3::MATCH()]}';
7057 }
7058 }
7059  
7060 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin3::POSTMATCH()
7061 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
7062 9 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 9 9
7063 0 $char[$i] = '@{[Elatin3::ignorecase(Elatin3::POSTMATCH())]}';
7064 }
7065 else {
7066 9 $char[$i] = '@{[Elatin3::POSTMATCH()]}';
7067 }
7068 }
7069  
7070 # ${ foo }
7071 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
7072 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7073 0 $char[$i] = '@{[Elatin3::ignorecase(' . $1 . ')]}';
7074 }
7075 }
7076  
7077 # ${ ... }
7078 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
7079 0 $char[$i] = e_capture($1);
7080 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7081 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
7082 }
7083 }
7084  
7085 # $scalar or @array
7086 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
7087 3 $char[$i] = e_string($char[$i]);
7088 3 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 3 3
7089 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
7090 }
7091 }
7092  
7093 # quote character before ? + * {
7094 ▶ 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
7095 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
7096 }
7097 else {
7098 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
7099 }
7100 }
7101 }
7102  
7103 # make regexp string
7104 74 $modifier =~ tr/i//d;
7105 74 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 74 74
7106 0 return join '', 'Elatin3::split', $ope, $delimiter, @char, '>]}' x ($left_e - $right_e), $end_delimiter, $modifier;
7107 }
7108 74 return join '', 'Elatin3::split', $ope, $delimiter, @char, $end_delimiter, $modifier;
7109 }
7110  
7111 #
7112 # escape regexp of split qr''
7113 #
7114 0 ▶sub e_split_q {
Subroutine e_split_q: not called CC=26 SCAR=65.5
Pod undocumented
7115 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
7116 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
7117  
7118 0 $modifier =~ tr/p//d;
7119 0 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 0 0
7120 0 my $line = 0;
7121 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7122 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
7123 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
7124 0 last;
7125 }
7126 }
7127 0 die qq{Unsupported modifier "$1" used at line $line.\n};
7128 }
7129  
7130 0 $slash = 'div';
7131  
7132 # /b /B modifier
7133 0 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) 0 0 0
7134 0 return join '', 'split', $ope, $delimiter, $string, $end_delimiter, $modifier;
7135 }
7136  
7137 0 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 0 0
7138  
7139 # split regexp
7140 0 my @char = $string =~ /\G((?>
7141 [^\\\[] |
7142 [\x00-\xFF] |
7143 \[\^ |
7144 \[\: (?>[a-z]+) \:\] |
7145 \[\:\^ (?>[a-z]+) \:\] |
7146 \\ (?:$q_char) |
7147 (?:$q_char)
7148 ))/oxmsg;
7149  
7150 # unescape character
7151 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
7152 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 &Elatin3::uc($char[$i]) ne &fc($char[$i])) { } 0 0 0
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 0 0
7153 }
7154  
7155 # open character class [...]
7156 elsif ($char[$i] eq '[') {
7157 0 my $left = $i;
7158 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7159 0 $i++;
7160 }
7161 0 while (1) {
7162 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7163 0 die __FILE__, ": Unmatched [] in regexp\n";
7164 }
7165 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7166 0 my $right = $i;
7167  
7168 # [...]
7169 0 splice @char, $left, $right-$left+1, Elatin3::charlist_qr(@char[$left+1..$right-1], $modifier);
7170  
7171 0 $i = $left;
7172 0 last;
7173 }
7174 }
7175 }
7176  
7177 # open character class [^...]
7178 elsif ($char[$i] eq '[^') {
7179 0 my $left = $i;
7180 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7181 0 $i++;
7182 }
7183 0 while (1) {
7184 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7185 0 die __FILE__, ": Unmatched [] in regexp\n";
7186 }
7187 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7188 0 my $right = $i;
7189  
7190 # [^...]
7191 0 splice @char, $left, $right-$left+1, Elatin3::charlist_not_qr(@char[$left+1..$right-1], $modifier);
7192  
7193 0 $i = $left;
7194 0 last;
7195 }
7196 }
7197 }
7198  
7199 # rewrite character class or escape character
7200 elsif (my $char = character_class($char[$i],$modifier)) {
7201 0 $char[$i] = $char;
7202 }
7203  
7204 # split(m/^/) --> split(m/^/m)
7205 ▶ 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
7206 0 $modifier .= 'm';
7207 }
7208  
7209 # /i modifier
7210 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin3::uc($char[$i]) ne Elatin3::fc($char[$i]))) {
Condition0%0/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin3::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 &Elatin3::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin3::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= &Elatin3::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
7211 0 ▶ if (CORE::length(Elatin3::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
7212 0 $char[$i] = '[' . Elatin3::uc($char[$i]) . Elatin3::fc($char[$i]) . ']';
7213 }
7214 else {
7215 0 $char[$i] = '(?:' . Elatin3::uc($char[$i]) . '|' . Elatin3::fc($char[$i]) . ')';
7216 }
7217 }
7218  
7219 # quote character before ? + * {
7220 ▶ 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
7221 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
7222 }
7223 else {
7224 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
7225 }
7226 }
7227 }
7228  
7229 0 $modifier =~ tr/i//d;
7230 0 return join '', 'Elatin3::split', $ope, $delimiter, @char, $end_delimiter, $modifier;
7231 }
7232  
7233 #
7234 # instead of Carp::carp
7235 #
7236 0 ▶sub carp {
Subroutine carp: not called CC=1 SCAR=6.9
Pod undocumented
7237 0 my($package,$filename,$line) = caller(1);
7238 0 print STDERR "@_ at $filename line $line.\n";
7239 }
7240  
7241 #
7242 # instead of Carp::croak
7243 #
7244 0 ▶sub croak {
Subroutine croak: not called CC=1 SCAR=6.9
Pod undocumented
7245 0 my($package,$filename,$line) = caller(1);
7246 0 print STDERR "@_ at $filename line $line.\n";
7247 0 die "\n";
7248 }
7249  
7250 #
7251 # instead of Carp::cluck
7252 #
7253 0 ▶sub cluck {
Subroutine cluck: not called CC=2 SCAR=17.9
Pod undocumented
7254 0 my $i = 0;
7255 0 my @cluck = ();
7256 0 ▶ while (my($package,$filename,$line,$subroutine) = caller($i)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7257 0 push @cluck, "[$i] $filename($line) $package::$subroutine\n";
7258 0 $i++;
7259 }
7260 0 print STDERR CORE::reverse @cluck;
7261 0 print STDERR "\n";
7262 0 print STDERR @_;
7263 }
7264  
7265 #
7266 # instead of Carp::confess
7267 #
7268 0 ▶sub confess {
Subroutine confess: not called CC=2 SCAR=17.9
Pod undocumented
7269 0 my $i = 0;
7270 0 my @confess = ();
7271 0 ▶ while (my($package,$filename,$line,$subroutine) = caller($i)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7272 0 push @confess, "[$i] $filename($line) $package::$subroutine\n";
7273 0 $i++;
7274 }
7275 0 print STDERR CORE::reverse @confess;
7276 0 print STDERR "\n";
7277 0 print STDERR @_;
7278 0 die "\n";
7279 }
7280  
7281 424 1;
7282  
7283 __END__
↑ Summary Latin3.pm »