Elatin4.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 Latin4.pm »
1 package Elatin4;
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 # Elatin4 - Run-time routines for Latin4.pm
7 #
8 # http://search.cpan.org/dist/Char-Latin4/
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 (&Elatin4::index($name, '::') >= 0) { } 0 15 15
elsif (&Elatin4::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 (Elatin4::index($name,'::') >= 0) {
84 0 return $name;
85 }
86 elsif (Elatin4::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-4 character range per length
159 #
160 424 my %range_tr = ();
161  
162 #
163 # Latin-4 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 Elatin4 \z/mosx }) { } 424 0 424
176 }
177  
178 elsif (__PACKAGE__ =~ / \b Elatin4 \z/oxms) {
179 424 %range_tr = (
180 1 => [ [0x00..0xFF],
181 ],
182 );
183  
184 424 %lc = (%lc,
185 "\xA1" => "\xB1", # LATIN LETTER A WITH OGONEK
186 "\xA3" => "\xB3", # LATIN LETTER R WITH CEDILLA
187 "\xA5" => "\xB5", # LATIN LETTER I WITH TILDE
188 "\xA6" => "\xB6", # LATIN LETTER L WITH CEDILLA
189 "\xA9" => "\xB9", # LATIN LETTER S WITH CARON
190 "\xAA" => "\xBA", # LATIN LETTER E WITH MACRON
191 "\xAB" => "\xBB", # LATIN LETTER G WITH CEDILLA
192 "\xAC" => "\xBC", # LATIN LETTER T WITH STROKE
193 "\xAE" => "\xBE", # LATIN LETTER Z WITH CARON
194 "\xBD" => "\xBF", # LATIN LETTER ENG
195 "\xC0" => "\xE0", # LATIN LETTER A WITH MACRON
196 "\xC1" => "\xE1", # LATIN LETTER A WITH ACUTE
197 "\xC2" => "\xE2", # LATIN LETTER A WITH CIRCUMFLEX
198 "\xC3" => "\xE3", # LATIN LETTER A WITH TILDE
199 "\xC4" => "\xE4", # LATIN LETTER A WITH DIAERESIS
200 "\xC5" => "\xE5", # LATIN LETTER A WITH RING ABOVE
201 "\xC6" => "\xE6", # LATIN LETTER AE
202 "\xC7" => "\xE7", # LATIN LETTER I WITH OGONEK
203 "\xC8" => "\xE8", # LATIN LETTER C WITH CARON
204 "\xC9" => "\xE9", # LATIN LETTER E WITH ACUTE
205 "\xCA" => "\xEA", # LATIN LETTER E WITH OGONEK
206 "\xCB" => "\xEB", # LATIN LETTER E WITH DIAERESIS
207 "\xCC" => "\xEC", # LATIN LETTER E WITH DOT ABOVE
208 "\xCD" => "\xED", # LATIN LETTER I WITH ACUTE
209 "\xCE" => "\xEE", # LATIN LETTER I WITH CIRCUMFLEX
210 "\xCF" => "\xEF", # LATIN LETTER I WITH MACRON
211 "\xD0" => "\xF0", # LATIN LETTER D WITH STROKE
212 "\xD1" => "\xF1", # LATIN LETTER N WITH CEDILLA
213 "\xD2" => "\xF2", # LATIN LETTER O WITH MACRON
214 "\xD3" => "\xF3", # LATIN LETTER K WITH CEDILLA
215 "\xD4" => "\xF4", # LATIN LETTER O WITH CIRCUMFLEX
216 "\xD5" => "\xF5", # LATIN LETTER O WITH TILDE
217 "\xD6" => "\xF6", # LATIN LETTER O WITH DIAERESIS
218 "\xD8" => "\xF8", # LATIN LETTER O WITH STROKE
219 "\xD9" => "\xF9", # LATIN LETTER U WITH OGONEK
220 "\xDA" => "\xFA", # LATIN LETTER U WITH ACUTE
221 "\xDB" => "\xFB", # LATIN LETTER U WITH CIRCUMFLEX
222 "\xDC" => "\xFC", # LATIN LETTER U WITH DIAERESIS
223 "\xDD" => "\xFD", # LATIN LETTER U WITH TILDE
224 "\xDE" => "\xFE", # LATIN LETTER U WITH MACRON
225 );
226  
227 424 %uc = (%uc,
228 "\xB1" => "\xA1", # LATIN LETTER A WITH OGONEK
229 "\xB3" => "\xA3", # LATIN LETTER R WITH CEDILLA
230 "\xB5" => "\xA5", # LATIN LETTER I WITH TILDE
231 "\xB6" => "\xA6", # LATIN LETTER L WITH CEDILLA
232 "\xB9" => "\xA9", # LATIN LETTER S WITH CARON
233 "\xBA" => "\xAA", # LATIN LETTER E WITH MACRON
234 "\xBB" => "\xAB", # LATIN LETTER G WITH CEDILLA
235 "\xBC" => "\xAC", # LATIN LETTER T WITH STROKE
236 "\xBE" => "\xAE", # LATIN LETTER Z WITH CARON
237 "\xBF" => "\xBD", # LATIN LETTER ENG
238 "\xE0" => "\xC0", # LATIN LETTER A WITH MACRON
239 "\xE1" => "\xC1", # LATIN LETTER A WITH ACUTE
240 "\xE2" => "\xC2", # LATIN LETTER A WITH CIRCUMFLEX
241 "\xE3" => "\xC3", # LATIN LETTER A WITH TILDE
242 "\xE4" => "\xC4", # LATIN LETTER A WITH DIAERESIS
243 "\xE5" => "\xC5", # LATIN LETTER A WITH RING ABOVE
244 "\xE6" => "\xC6", # LATIN LETTER AE
245 "\xE7" => "\xC7", # LATIN LETTER I WITH OGONEK
246 "\xE8" => "\xC8", # LATIN LETTER C WITH CARON
247 "\xE9" => "\xC9", # LATIN LETTER E WITH ACUTE
248 "\xEA" => "\xCA", # LATIN LETTER E WITH OGONEK
249 "\xEB" => "\xCB", # LATIN LETTER E WITH DIAERESIS
250 "\xEC" => "\xCC", # LATIN LETTER E WITH DOT ABOVE
251 "\xED" => "\xCD", # LATIN LETTER I WITH ACUTE
252 "\xEE" => "\xCE", # LATIN LETTER I WITH CIRCUMFLEX
253 "\xEF" => "\xCF", # LATIN LETTER I WITH MACRON
254 "\xF0" => "\xD0", # LATIN LETTER D WITH STROKE
255 "\xF1" => "\xD1", # LATIN LETTER N WITH CEDILLA
256 "\xF2" => "\xD2", # LATIN LETTER O WITH MACRON
257 "\xF3" => "\xD3", # LATIN LETTER K WITH CEDILLA
258 "\xF4" => "\xD4", # LATIN LETTER O WITH CIRCUMFLEX
259 "\xF5" => "\xD5", # LATIN LETTER O WITH TILDE
260 "\xF6" => "\xD6", # LATIN LETTER O WITH DIAERESIS
261 "\xF8" => "\xD8", # LATIN LETTER O WITH STROKE
262 "\xF9" => "\xD9", # LATIN LETTER U WITH OGONEK
263 "\xFA" => "\xDA", # LATIN LETTER U WITH ACUTE
264 "\xFB" => "\xDB", # LATIN LETTER U WITH CIRCUMFLEX
265 "\xFC" => "\xDC", # LATIN LETTER U WITH DIAERESIS
266 "\xFD" => "\xDD", # LATIN LETTER U WITH TILDE
267 "\xFE" => "\xDE", # LATIN LETTER U WITH MACRON
268 );
269  
270 424 %fc = (%fc,
271 "\xA1" => "\xB1", # LATIN CAPITAL LETTER A WITH OGONEK --> LATIN SMALL LETTER A WITH OGONEK
272 "\xA3" => "\xB3", # LATIN CAPITAL LETTER R WITH CEDILLA --> LATIN SMALL LETTER R WITH CEDILLA
273 "\xA5" => "\xB5", # LATIN CAPITAL LETTER I WITH TILDE --> LATIN SMALL LETTER I WITH TILDE
274 "\xA6" => "\xB6", # LATIN CAPITAL LETTER L WITH CEDILLA --> LATIN SMALL LETTER L WITH CEDILLA
275 "\xA9" => "\xB9", # LATIN CAPITAL LETTER S WITH CARON --> LATIN SMALL LETTER S WITH CARON
276 "\xAA" => "\xBA", # LATIN CAPITAL LETTER E WITH MACRON --> LATIN SMALL LETTER E WITH MACRON
277 "\xAB" => "\xBB", # LATIN CAPITAL LETTER G WITH CEDILLA --> LATIN SMALL LETTER G WITH CEDILLA
278 "\xAC" => "\xBC", # LATIN CAPITAL LETTER T WITH STROKE --> LATIN SMALL LETTER T WITH STROKE
279 "\xAE" => "\xBE", # LATIN CAPITAL LETTER Z WITH CARON --> LATIN SMALL LETTER Z WITH CARON
280 "\xBD" => "\xBF", # LATIN CAPITAL LETTER ENG --> LATIN SMALL LETTER ENG
281 "\xC0" => "\xE0", # LATIN CAPITAL LETTER A WITH MACRON --> LATIN SMALL LETTER A WITH MACRON
282 "\xC1" => "\xE1", # LATIN CAPITAL LETTER A WITH ACUTE --> LATIN SMALL LETTER A WITH ACUTE
283 "\xC2" => "\xE2", # LATIN CAPITAL LETTER A WITH CIRCUMFLEX --> LATIN SMALL LETTER A WITH CIRCUMFLEX
284 "\xC3" => "\xE3", # LATIN CAPITAL LETTER A WITH TILDE --> LATIN SMALL LETTER A WITH TILDE
285 "\xC4" => "\xE4", # LATIN CAPITAL LETTER A WITH DIAERESIS --> LATIN SMALL LETTER A WITH DIAERESIS
286 "\xC5" => "\xE5", # LATIN CAPITAL LETTER A WITH RING ABOVE --> LATIN SMALL LETTER A WITH RING ABOVE
287 "\xC6" => "\xE6", # LATIN CAPITAL LETTER AE --> LATIN SMALL LETTER AE
288 "\xC7" => "\xE7", # LATIN CAPITAL LETTER I WITH OGONEK --> LATIN SMALL LETTER I WITH OGONEK
289 "\xC8" => "\xE8", # LATIN CAPITAL LETTER C WITH CARON --> LATIN SMALL LETTER C WITH CARON
290 "\xC9" => "\xE9", # LATIN CAPITAL LETTER E WITH ACUTE --> LATIN SMALL LETTER E WITH ACUTE
291 "\xCA" => "\xEA", # LATIN CAPITAL LETTER E WITH OGONEK --> LATIN SMALL LETTER E WITH OGONEK
292 "\xCB" => "\xEB", # LATIN CAPITAL LETTER E WITH DIAERESIS --> LATIN SMALL LETTER E WITH DIAERESIS
293 "\xCC" => "\xEC", # LATIN CAPITAL LETTER E WITH DOT ABOVE --> LATIN SMALL LETTER E WITH DOT ABOVE
294 "\xCD" => "\xED", # LATIN CAPITAL LETTER I WITH ACUTE --> LATIN SMALL LETTER I WITH ACUTE
295 "\xCE" => "\xEE", # LATIN CAPITAL LETTER I WITH CIRCUMFLEX --> LATIN SMALL LETTER I WITH CIRCUMFLEX
296 "\xCF" => "\xEF", # LATIN CAPITAL LETTER I WITH MACRON --> LATIN SMALL LETTER I WITH MACRON
297 "\xD0" => "\xF0", # LATIN CAPITAL LETTER D WITH STROKE --> LATIN SMALL LETTER D WITH STROKE
298 "\xD1" => "\xF1", # LATIN CAPITAL LETTER N WITH CEDILLA --> LATIN SMALL LETTER N WITH CEDILLA
299 "\xD2" => "\xF2", # LATIN CAPITAL LETTER O WITH MACRON --> LATIN SMALL LETTER O WITH MACRON
300 "\xD3" => "\xF3", # LATIN CAPITAL LETTER K WITH CEDILLA --> LATIN SMALL LETTER K WITH CEDILLA
301 "\xD4" => "\xF4", # LATIN CAPITAL LETTER O WITH CIRCUMFLEX --> LATIN SMALL LETTER O WITH CIRCUMFLEX
302 "\xD5" => "\xF5", # LATIN CAPITAL LETTER O WITH TILDE --> LATIN SMALL LETTER O WITH TILDE
303 "\xD6" => "\xF6", # LATIN CAPITAL LETTER O WITH DIAERESIS --> LATIN SMALL LETTER O WITH DIAERESIS
304 "\xD8" => "\xF8", # LATIN CAPITAL LETTER O WITH STROKE --> LATIN SMALL LETTER O WITH STROKE
305 "\xD9" => "\xF9", # LATIN CAPITAL LETTER U WITH OGONEK --> LATIN SMALL LETTER U WITH OGONEK
306 "\xDA" => "\xFA", # LATIN CAPITAL LETTER U WITH ACUTE --> LATIN SMALL LETTER U WITH ACUTE
307 "\xDB" => "\xFB", # LATIN CAPITAL LETTER U WITH CIRCUMFLEX --> LATIN SMALL LETTER U WITH CIRCUMFLEX
308 "\xDC" => "\xFC", # LATIN CAPITAL LETTER U WITH DIAERESIS --> LATIN SMALL LETTER U WITH DIAERESIS
309 "\xDD" => "\xFD", # LATIN CAPITAL LETTER U WITH TILDE --> LATIN SMALL LETTER U WITH TILDE
310 "\xDE" => "\xFE", # LATIN CAPITAL LETTER U WITH MACRON --> LATIN SMALL LETTER U WITH MACRON
311 "\xDF" => "\x73\x73", # LATIN SMALL LETTER SHARP S --> LATIN SMALL LETTER S, LATIN SMALL LETTER S
312 );
313 }
314  
315 else {
316 0 croak "Don't know my package name '@{[__PACKAGE__]}'";
317 }
318  
319 #
320 # @ARGV wildcard globbing
321 #
322 212 ▶sub import {
Subroutine import: called CC=7 SCAR=28.3
323  
324 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
325 0 my @argv = ();
326 0 for (@ARGV) {
327  
328 # has space
329 0 ▶ if (/\A (?:$q_char)*? [ ] /oxms) {
Branch: 2 branches
BranchTrueFalseTotal
if (/\A (?:$Elatin4::q_char)*? [ ] /mosx) { } 0 0 0
elsif (/\A (?:$Elatin4::q_char)*? [*?] /mosx) { } 0 0 0
330 0 ▶ if (my @glob = Elatin4::glob(qq{"$_"})) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@glob) = &Elatin4::glob(qq["$_"])) { } 0 0 0
331 0 push @argv, @glob;
332 }
333 else {
334 0 push @argv, $_;
335 }
336 }
337  
338 # has wildcard metachar
339 elsif (/\A (?:$q_char)*? [*?] /oxms) {
340 0 ▶ if (my @glob = Elatin4::glob($_)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@glob) = &Elatin4::glob($_)) { } 0 0 0
341 0 push @argv, @glob;
342 }
343 else {
344 0 push @argv, $_;
345 }
346 }
347  
348 # no wildcard globbing
349 else {
350 0 push @argv, $_;
351 }
352 }
353 0 @ARGV = @argv;
354 }
355  
356 212 *Char::ord = \&Latin4::ord;
357 212 *Char::ord_ = \&Latin4::ord_;
358 212 *Char::reverse = \&Latin4::reverse;
359 212 *Char::getc = \&Latin4::getc;
360 212 *Char::length = \&Latin4::length;
361 212 *Char::substr = \&Latin4::substr;
362 212 *Char::index = \&Latin4::index;
363 212 *Char::rindex = \&Latin4::rindex;
364 212 *Char::eval = \&Latin4::eval;
365 212 *Char::escape = \&Latin4::escape;
366 212 *Char::escape_token = \&Latin4::escape_token;
367 212 *Char::escape_script = \&Latin4::escape_script;
368 }
369  
370 # P.230 Care with Prototypes
371 # in Chapter 6: Subroutines
372 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
373 #
374 # If you aren't careful, you can get yourself into trouble with prototypes.
375 # But if you are careful, you can do a lot of neat things with them. This is
376 # all very powerful, of course, and should only be used in moderation to make
377 # the world a better place.
378  
379 # P.332 Care with Prototypes
380 # in Chapter 7: Subroutines
381 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
382 #
383 # If you aren't careful, you can get yourself into trouble with prototypes.
384 # But if you are careful, you can do a lot of neat things with them. This is
385 # all very powerful, of course, and should only be used in moderation to make
386 # the world a better place.
387  
388 #
389 # Prototypes of subroutines
390 #
391 0 ▶sub unimport {}
Subroutine unimport: not called CC=1 SCAR=0.0
392 sub Elatin4::split(;$$$);
393 sub Elatin4::tr($$$$;$);
394 sub Elatin4::chop(@);
395 sub Elatin4::index($$;$);
396 sub Elatin4::rindex($$;$);
397 sub Elatin4::lcfirst(@);
398 sub Elatin4::lcfirst_();
399 sub Elatin4::lc(@);
400 sub Elatin4::lc_();
401 sub Elatin4::ucfirst(@);
402 sub Elatin4::ucfirst_();
403 sub Elatin4::uc(@);
404 sub Elatin4::uc_();
405 sub Elatin4::fc(@);
406 sub Elatin4::fc_();
407 sub Elatin4::ignorecase;
408 sub Elatin4::classic_character_class;
409 sub Elatin4::capture;
410 sub Elatin4::chr(;$);
411 sub Elatin4::chr_();
412 sub Elatin4::glob($);
413 sub Elatin4::glob_();
414  
415 sub Latin4::ord(;$);
416 sub Latin4::ord_();
417 sub Latin4::reverse(@);
418 sub Latin4::getc(;*@);
419 sub Latin4::length(;$);
420 sub Latin4::substr($$;$$);
421 sub Latin4::index($$;$);
422 sub Latin4::rindex($$;$);
423 sub Latin4::escape(;$);
424  
425 #
426 # Regexp work
427 #
428 424 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
429 $re_a
430 $re_t
431 $re_n
432 $re_r
433 424 );
434  
435 #
436 # Character class
437 #
438 424 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
439 $dot
440 $dot_s
441 $eD
442 $eS
443 $eW
444 $eH
445 $eV
446 $eR
447 $eN
448 $not_alnum
449 $not_alpha
450 $not_ascii
451 $not_blank
452 $not_cntrl
453 $not_digit
454 $not_graph
455 $not_lower
456 $not_lower_i
457 $not_print
458 $not_punct
459 $not_space
460 $not_upper
461 $not_upper_i
462 $not_word
463 $not_xdigit
464 $eb
465 $eB
466 424 );
467  
468 424 ${Elatin4::dot} = qr{(?>[^\x0A])};
469 424 ${Elatin4::dot_s} = qr{(?>[\x00-\xFF])};
470 424 ${Elatin4::eD} = qr{(?>[^0-9])};
471  
472 # Vertical tabs are now whitespace
473 # \s in a regex now matches a vertical tab in all circumstances.
474 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
475 # ${Elatin4::eS} = qr{(?>[^\x09\x0A \x0C\x0D\x20])};
476 # ${Elatin4::eS} = qr{(?>[^\x09\x0A\x0B\x0C\x0D\x20])};
477 424 ${Elatin4::eS} = qr{(?>[^\s])};
478  
479 424 ${Elatin4::eW} = qr{(?>[^0-9A-Z_a-z])};
480 424 ${Elatin4::eH} = qr{(?>[^\x09\x20])};
481 424 ${Elatin4::eV} = qr{(?>[^\x0A\x0B\x0C\x0D])};
482 424 ${Elatin4::eR} = qr{(?>\x0D\x0A|[\x0A\x0D])};
483 424 ${Elatin4::eN} = qr{(?>[^\x0A])};
484 424 ${Elatin4::not_alnum} = qr{(?>[^\x30-\x39\x41-\x5A\x61-\x7A])};
485 424 ${Elatin4::not_alpha} = qr{(?>[^\x41-\x5A\x61-\x7A])};
486 424 ${Elatin4::not_ascii} = qr{(?>[^\x00-\x7F])};
487 424 ${Elatin4::not_blank} = qr{(?>[^\x09\x20])};
488 424 ${Elatin4::not_cntrl} = qr{(?>[^\x00-\x1F\x7F])};
489 424 ${Elatin4::not_digit} = qr{(?>[^\x30-\x39])};
490 424 ${Elatin4::not_graph} = qr{(?>[^\x21-\x7F])};
491 424 ${Elatin4::not_lower} = qr{(?>[^\x61-\x7A])};
492 424 ${Elatin4::not_lower_i} = qr{(?>[^\x41-\x5A\x61-\x7A])}; # Perl 5.16 compatible
493 # ${Elatin4::not_lower_i} = qr{(?>[\x00-\xFF])}; # older Perl compatible
494 424 ${Elatin4::not_print} = qr{(?>[^\x20-\x7F])};
495 424 ${Elatin4::not_punct} = qr{(?>[^\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E])};
496 424 ${Elatin4::not_space} = qr{(?>[^\s\x0B])};
497 424 ${Elatin4::not_upper} = qr{(?>[^\x41-\x5A])};
498 424 ${Elatin4::not_upper_i} = qr{(?>[^\x41-\x5A\x61-\x7A])}; # Perl 5.16 compatible
499 # ${Elatin4::not_upper_i} = qr{(?>[\x00-\xFF])}; # older Perl compatible
500 424 ${Elatin4::not_word} = qr{(?>[^\x30-\x39\x41-\x5A\x5F\x61-\x7A])};
501 424 ${Elatin4::not_xdigit} = qr{(?>[^\x30-\x39\x41-\x46\x61-\x66])};
502 424 ${Elatin4::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))};
503 424 ${Elatin4::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]))};
504  
505 # avoid: Name "Elatin4::foo" used only once: possible typo at here.
506 424 ${Elatin4::dot} = ${Elatin4::dot};
507 424 ${Elatin4::dot_s} = ${Elatin4::dot_s};
508 424 ${Elatin4::eD} = ${Elatin4::eD};
509 424 ${Elatin4::eS} = ${Elatin4::eS};
510 424 ${Elatin4::eW} = ${Elatin4::eW};
511 424 ${Elatin4::eH} = ${Elatin4::eH};
512 424 ${Elatin4::eV} = ${Elatin4::eV};
513 424 ${Elatin4::eR} = ${Elatin4::eR};
514 424 ${Elatin4::eN} = ${Elatin4::eN};
515 424 ${Elatin4::not_alnum} = ${Elatin4::not_alnum};
516 424 ${Elatin4::not_alpha} = ${Elatin4::not_alpha};
517 424 ${Elatin4::not_ascii} = ${Elatin4::not_ascii};
518 424 ${Elatin4::not_blank} = ${Elatin4::not_blank};
519 424 ${Elatin4::not_cntrl} = ${Elatin4::not_cntrl};
520 424 ${Elatin4::not_digit} = ${Elatin4::not_digit};
521 424 ${Elatin4::not_graph} = ${Elatin4::not_graph};
522 424 ${Elatin4::not_lower} = ${Elatin4::not_lower};
523 424 ${Elatin4::not_lower_i} = ${Elatin4::not_lower_i};
524 424 ${Elatin4::not_print} = ${Elatin4::not_print};
525 424 ${Elatin4::not_punct} = ${Elatin4::not_punct};
526 424 ${Elatin4::not_space} = ${Elatin4::not_space};
527 424 ${Elatin4::not_upper} = ${Elatin4::not_upper};
528 424 ${Elatin4::not_upper_i} = ${Elatin4::not_upper_i};
529 424 ${Elatin4::not_word} = ${Elatin4::not_word};
530 424 ${Elatin4::not_xdigit} = ${Elatin4::not_xdigit};
531 424 ${Elatin4::eb} = ${Elatin4::eb};
532 424 ${Elatin4::eB} = ${Elatin4::eB};
533  
534 #
535 # Latin-4 split
536 #
537 72 ▶sub Elatin4::split(;$$$) {
Subroutine split: called CC=34 SCAR=38.5
Pod undocumented
538  
539 # P.794 29.2.161. split
540 # in Chapter 29: Functions
541 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
542  
543 # P.951 split
544 # in Chapter 27: Functions
545 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
546  
547 72 my $pattern = $_[0];
548 72 my $string = $_[1];
549 72 my $limit = $_[2];
550  
551 # if $pattern is also omitted or is the literal space, " "
552 72 ▶ if (not defined $pattern) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $pattern) 2 70 72
553 2 $pattern = ' ';
554 }
555  
556 # if $string is omitted, the function splits the $_ string
557 72 ▶ if (not defined $string) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $string) 6 66 72
558 6 ▶ if (defined $_) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_) { } 0 6 6
559 0 $string = $_;
560 }
561 else {
562 6 $string = '';
563 }
564 }
565  
566 72 my @split = ();
567  
568 # when string is empty
569 72 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 10 62 72
elsif ($pattern eq ' ') { } 2 60 62
570  
571 # resulting list value in list context
572 10 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 5 5 10
573 5 return @split;
574 }
575  
576 # count of substrings in scalar context
577 else {
578 5 ▶ carp "Use of implicit split to \@_ is deprecated" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 5 5
579 5 @_ = @split;
580 5 return scalar @_;
581 }
582 }
583  
584 # split's first argument is more consistently interpreted
585 #
586 # After some changes earlier in v5.17, split's behavior has been simplified:
587 # if the PATTERN argument evaluates to a string containing one space, it is
588 # treated the way that a literal string containing one space once was.
589 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#split's_first_argument_is_more_consistently_interpreted
590  
591 # if $pattern is also omitted or is the literal space, " ", the function splits
592 # on whitespace, /\s+/, after skipping any leading whitespace
593 # (and so on)
594  
595 elsif ($pattern eq ' ') {
596 2 ▶ if (not defined $limit) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $limit) { } 2 0 2
597 2 return CORE::split(' ', $string);
598 }
599 else {
600 0 return CORE::split(' ', $string, $limit);
601 }
602 }
603  
604 # if $limit is negative, it is treated as if an arbitrarily large $limit has been specified
605 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
606  
607 # a pattern capable of matching either the null string or something longer than the
608 # null string will split the value of $string into separate characters wherever it
609 # matches the null string between characters
610 # (and so on)
611  
612 60 ▶ if ('' =~ / \A $pattern \z /xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ('' =~ / \A $pattern \z /msx) { } 2 58 60
613 2 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
614 2 my $limit = scalar(() = $string =~ /($pattern)/oxmsg);
615  
616 # P.1024 Appendix W.10 Multibyte Processing
617 # of ISBN 1-56592-224-7 CJKV Information Processing
618 # (and so on)
619  
620 # the //m modifier is assumed when you split on the pattern /^/
621 # (and so on)
622  
623 2 ▶ eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
Subroutine BEGIN: called CC=1 SCAR=0.0
624 # V
625 2 ▶ while ((--$limit > 0) and ($string =~ s/\A((?:$q_char)+?)$pattern//m)) {
Branch: 1 branch
BranchTrueFalseTotal
if (--$limit > 0 and $string =~ s/\A((?:$Elatin4::q_char)+?)$pattern//m) 9 2 11
Condition100%3/3
--$limit > 0 and $string =~ s/\A((?:$Elatin4::q_char)+?)$pattern//m
!ll&&!rl&&r
119
MC/DC100%2/2
--$limit > 0 and $string =~ s/\A((?:$Elatin4::q_char)+?)$pattern//m
--$limit > 0 $string =~ s/\A((?:$Elatin4::q_char)+?)$pattern//m
Truth table100%3/3
A and B
A= --$limit > 0B= $string =~ s/\A((?:$Elatin4::q_char)+?)$pattern//m
ABresult
0X0
100
111
626  
627 # if the $pattern contains parentheses, then the substring matched by each pair of parentheses
628 # is included in the resulting list, interspersed with the fields that are ordinarily returned
629 # (and so on)
630  
631 9 local $@;
632 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
633 9 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 9 9 18
634 9 push @split, CORE::eval('$' . $digit);
635 }
636 }
637 }
638  
639 else {
640 58 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
641  
642 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
643 # V
644 58 ▶ while ($string =~ s/\A((?:$q_char)*?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Elatin4::q_char)*?)$pattern//m) 163 58 221
645 163 local $@;
646 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
647 163 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 230 163 393
648 230 push @split, CORE::eval('$' . $digit);
649 }
650 }
651 }
652 }
653  
654 elsif ($limit > 0) {
655 0 ▶ if ('' =~ / \A $pattern \z /xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ('' =~ / \A $pattern \z /msx) { } 0 0 0
656 0 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
657 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
658  
659 0 eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
660 # V
661 0 ▶ if ($string =~ s/\A((?:$q_char)+?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Elatin4::q_char)+?)$pattern//m) 0 0 0
662 0 local $@;
663 0 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 0 0 0
664 0 push @split, CORE::eval('$' . $digit);
665 }
666 }
667 }
668 }
669 else {
670 0 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
671 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
672  
673 0 eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
674 # V
675 0 ▶ if ($string =~ s/\A((?:$q_char)*?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Elatin4::q_char)*?)$pattern//m) 0 0 0
676 0 local $@;
677 0 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 0 0 0
678 0 push @split, CORE::eval('$' . $digit);
679 }
680 }
681 }
682 }
683 }
684  
685 60 ▶ if (CORE::length($string) > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $string > 0) 58 2 60
686 58 push @split, $string;
687 }
688  
689 # if $_[2] (NOT "$limit") is omitted or zero, trailing null fields are stripped from the result
690 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
691 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
692 0 pop @split;
693 }
694 }
695  
696 # resulting list value in list context
697 60 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 58 2 60
698 58 return @split;
699 }
700  
701 # count of substrings in scalar context
702 else {
703 2 ▶ carp "Use of implicit split to \@_ is deprecated" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 2 2
704 2 @_ = @split;
705 2 return scalar @_;
706 }
707 }
708  
709 #
710 # get last subexpression offsets
711 #
712 60 ▶sub _last_subexpression_offsets {
Subroutine _last_subexpression_offsets: called CC=3 SCAR=11.0
713 60 my $pattern = $_[0];
714  
715 # remove comment
716 60 $pattern =~ s/\(\?\# .*? \)//oxmsg;
717  
718 60 my $modifier = '';
719 60 ▶ if ($pattern =~ /\(\?\^? ([\-A-Za-z]+) :/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pattern =~ /\(\?\^? ([\-A-Za-z]+) :/mosx) 11 49 60
720 11 $modifier = $1;
721 11 $modifier =~ s/-[A-Za-z]*//;
722 }
723  
724 # with /x modifier
725 60 my @char = ();
726 60 ▶ if ($modifier =~ /x/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /x/mosx) { } 5 55 60
727 5 @char = $pattern =~ /\G((?>
728 [^\\\#\[\(] |
729 \\ $q_char |
730 \# (?>[^\n]*) $ |
731 \[ (?>(?:[^\\\]]|\\\\|\\\]|$q_char)+) \] |
732 \(\? |
733 $q_char
734 ))/oxmsg;
735 }
736  
737 # without /x modifier
738 else {
739 55 @char = $pattern =~ /\G((?>
740 [^\\\[\(] |
741 \\ $q_char |
742 \[ (?>(?:[^\\\]]|\\\\|\\\]|$q_char)+) \] |
743 \(\? |
744 $q_char
745 ))/oxmsg;
746 }
747  
748 60 return scalar grep { $_ eq '(' } @char;
749 }
750  
751 #
752 # Latin-4 transliteration (tr///)
753 #
754 6 ▶sub Elatin4::tr($$$$;$) {
Subroutine tr: called CC=26 SCAR=48.6
Pod undocumented
755  
756 6 my $bind_operator = $_[1];
757 6 my $searchlist = $_[2];
758 6 my $replacementlist = $_[3];
759 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
760  
761 6 ▶ if ($modifier =~ /r/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /r/mosx) 5 1 6
762 5 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) 0 5 5
763 0 croak "Using !~ with tr///r doesn't make sense";
764 }
765 }
766  
767 6 my @char = $_[0] =~ /\G (?>$q_char) /oxmsg;
768 6 my @searchlist = _charlist_tr($searchlist);
769 6 my @replacementlist = _charlist_tr($replacementlist);
770  
771 6 my %tr = ();
772 6 ▶ for (my $i=0; $i <= $#searchlist; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#searchlist) 19 6 25
773 19 ▶ if (not exists $tr{$searchlist[$i]}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $tr{$searchlist[$i]}) 19 0 19
774 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
775 19 $tr{$searchlist[$i]} = $replacementlist[$i];
776 }
777 elsif ($modifier =~ /d/oxms) {
778 0 $tr{$searchlist[$i]} = '';
779 }
780 ▶ 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
781 0 $tr{$searchlist[$i]} = $replacementlist[-1];
782 }
783 else {
784 0 $tr{$searchlist[$i]} = $searchlist[$i];
785 }
786 }
787 }
788  
789 6 my $tr = 0;
790 6 my $replaced = '';
791 6 ▶ if ($modifier =~ /c/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /c/mosx) { } 0 6 6
792 0 ▶ while (defined(my $char = shift @char)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $char = shift @char)) 0 0 0
793 0 ▶ if (not exists $tr{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $tr{$char}) { } 0 0 0
794 0 ▶ if (defined $replacementlist[-1]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $replacementlist[-1]) 0 0 0
795 0 $replaced .= $replacementlist[-1];
796 }
797 0 $tr++;
798 0 ▶ if ($modifier =~ /s/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/mosx) 0 0 0
799 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
800 0 shift @char;
801 0 $tr++;
802 }
803 }
804 }
805 else {
806 0 $replaced .= $char;
807 }
808 }
809 }
810 else {
811 6 ▶ while (defined(my $char = shift @char)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $char = shift @char)) 36 6 42
812 36 ▶ if (exists $tr{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $tr{$char}) { } 19 17 36
813 19 $replaced .= $tr{$char};
814 19 $tr++;
815 19 ▶ if ($modifier =~ /s/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/mosx) 0 19 19
816 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
817 0 shift @char;
818 0 $tr++;
819 }
820 }
821 }
822 else {
823 17 $replaced .= $char;
824 }
825 }
826 }
827  
828 6 ▶ if ($modifier =~ /r/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /r/mosx) { } 5 1 6
829 5 return $replaced;
830 }
831 else {
832 1 $_[0] = $replaced;
833 1 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) { } 0 1 1
834 0 return not $tr;
835 }
836 else {
837 1 return $tr;
838 }
839 }
840 }
841  
842 #
843 # Latin-4 chop
844 #
845 0 ▶sub Elatin4::chop(@) {
Subroutine chop: not called CC=3 SCAR=24.8
Pod undocumented
846  
847 0 my $chop;
848 0 ▶ if (@_ == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 0) { } 0 0 0
849 0 my @char = /\G (?>$q_char) /oxmsg;
850 0 $chop = pop @char;
851 0 $_ = join '', @char;
852 }
853 else {
854 0 for (@_) {
855 0 my @char = /\G (?>$q_char) /oxmsg;
856 0 $chop = pop @char;
857 0 $_ = join '', @char;
858 }
859 }
860 0 return $chop;
861 }
862  
863 #
864 # Latin-4 index by octet
865 #
866 30 ▶sub Elatin4::index($$;$) {
Subroutine index: called CC=6 SCAR=20.8
Pod documented
867  
868 30 my($str,$substr,$position) = @_;
869 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
870 30 my $pos = 0;
871  
872 30 ▶ while ($pos < CORE::length($str)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos < length $str) 130 30 160
873 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
874 0 ▶ if ($pos >= $position) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos >= $position) 0 0 0
875 0 return $pos;
876 }
877 }
878 130 ▶ if (CORE::substr($str,$pos) =~ /\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($str, $pos) =~ /\A ($Elatin4::q_char) /mosx) { } 130 0 130
879 130 $pos += CORE::length($1);
880 }
881 else {
882 0 $pos += 1;
883 }
884 }
885 30 return -1;
886 }
887  
888 #
889 # Latin-4 reverse index
890 #
891 0 ▶sub Elatin4::rindex($$;$) {
Subroutine rindex: not called CC=6 SCAR=37.4
Pod undocumented
892  
893 0 my($str,$substr,$position) = @_;
894 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
895 0 my $pos = 0;
896 0 my $rindex = -1;
897  
898 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
899 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
900 0 $rindex = $pos;
901 }
902 0 ▶ if (CORE::substr($str,$pos) =~ /\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($str, $pos) =~ /\A ($Elatin4::q_char) /mosx) { } 0 0 0
903 0 $pos += CORE::length($1);
904 }
905 else {
906 0 $pos += 1;
907 }
908 }
909 0 return $rindex;
910 }
911  
912 #
913 # Latin-4 lower case first with parameter
914 #
915 0 ▶sub Elatin4::lcfirst(@) {
Subroutine lcfirst: not called CC=4 SCAR=30.0
Pod undocumented
916 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
917 0 my $s = shift @_;
918 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
919 0 return Elatin4::lc(CORE::substr($s,0,1)) . CORE::substr($s,1), @_;
920 }
921 else {
922 0 return Elatin4::lc(CORE::substr($s,0,1)) . CORE::substr($s,1);
923 }
924 }
925 else {
926 0 return Elatin4::lc(CORE::substr($_,0,1)) . CORE::substr($_,1);
927 }
928 }
929  
930 #
931 # Latin-4 lower case first without parameter
932 #
933 0 ▶sub Elatin4::lcfirst_() {
Subroutine lcfirst_: not called CC=1 SCAR=6.9
Pod undocumented
934 0 return Elatin4::lc(CORE::substr($_,0,1)) . CORE::substr($_,1);
935 }
936  
937 #
938 # Latin-4 lower case with parameter
939 #
940 67 ▶sub Elatin4::lc(@) {
Subroutine lc: called CC=6 SCAR=24.2
Pod undocumented
941 67 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 67 0 67
942 67 my $s = shift @_;
943 67 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 67 67
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
6700
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
944 0 ▶ return join('', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 0 0 0
945 }
946 else {
947 67 ▶ return join('', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 69 0 69
948 }
949 }
950 else {
951 0 return Elatin4::lc_();
952 }
953 }
954  
955 #
956 # Latin-4 lower case without parameter
957 #
958 0 ▶sub Elatin4::lc_() {
Subroutine lc_: not called CC=2 SCAR=17.9
Pod undocumented
959 0 my $s = $_;
960 0 ▶ return join '', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 0 0 0
961 }
962  
963 #
964 # Latin-4 upper case first with parameter
965 #
966 0 ▶sub Elatin4::ucfirst(@) {
Subroutine ucfirst: not called CC=4 SCAR=30.0
Pod undocumented
967 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
968 0 my $s = shift @_;
969 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
970 0 return Elatin4::uc(CORE::substr($s,0,1)) . CORE::substr($s,1), @_;
971 }
972 else {
973 0 return Elatin4::uc(CORE::substr($s,0,1)) . CORE::substr($s,1);
974 }
975 }
976 else {
977 0 return Elatin4::uc(CORE::substr($_,0,1)) . CORE::substr($_,1);
978 }
979 }
980  
981 #
982 # Latin-4 upper case first without parameter
983 #
984 0 ▶sub Elatin4::ucfirst_() {
Subroutine ucfirst_: not called CC=1 SCAR=6.9
Pod undocumented
985 0 return Elatin4::uc(CORE::substr($_,0,1)) . CORE::substr($_,1);
986 }
987  
988 #
989 # Latin-4 upper case with parameter
990 #
991 2555 ▶sub Elatin4::uc(@) {
Subroutine uc: called CC=6 SCAR=22.9
Pod undocumented
992 2555 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2555 0 2555
993 2555 my $s = shift @_;
994 2555 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 2555 2555
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
255500
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
995 0 ▶ return join('', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 0 0 0
996 }
997 else {
998 2555 ▶ return join('', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 913 1644 2557
999 }
1000 }
1001 else {
1002 0 return Elatin4::uc_();
1003 }
1004 }
1005  
1006 #
1007 # Latin-4 upper case without parameter
1008 #
1009 0 ▶sub Elatin4::uc_() {
Subroutine uc_: not called CC=2 SCAR=17.9
Pod undocumented
1010 0 my $s = $_;
1011 0 ▶ return join '', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 0 0 0
1012 }
1013  
1014 #
1015 # Latin-4 fold case with parameter
1016 #
1017 2559 ▶sub Elatin4::fc(@) {
Subroutine fc: called CC=6 SCAR=22.9
Pod undocumented
1018 2559 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2559 0 2559
1019 2559 my $s = shift @_;
1020 2559 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 2559 2559
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
255900
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
1021 0 ▶ return join('', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 0 0 0
1022 }
1023 else {
1024 2559 ▶ return join('', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 1979 6199 8178
1025 }
1026 }
1027 else {
1028 0 return Elatin4::fc_();
1029 }
1030 }
1031  
1032 #
1033 # Latin-4 fold case without parameter
1034 #
1035 0 ▶sub Elatin4::fc_() {
Subroutine fc_: not called CC=2 SCAR=17.9
Pod undocumented
1036 0 my $s = $_;
1037 0 ▶ return join '', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 0 0 0
1038 }
1039  
1040 #
1041 # Latin-4 regexp capture
1042 #
1043 {
1044 0 ▶ sub Elatin4::capture {
Subroutine capture: not called CC=1 SCAR=6.9
Pod documented
1045 0 return $_[0];
1046 }
1047 }
1048  
1049 #
1050 # Latin-4 regexp ignore case modifier
1051 #
1052 424 ▶sub Elatin4::ignorecase {
Subroutine ignorecase: called CC=25 SCAR=52.1
Pod undocumented
1053  
1054 11 my @string = @_;
1055 11 my $metachar = qr/[\@\\|[\]{]/oxms;
1056  
1057 # ignore case of $scalar or @array
1058 11 for my $string (@string) {
1059  
1060 # split regexp
1061 11 my @char = $string =~ /\G (?>\[\^|\\$q_char|$q_char) /oxmsg;
1062  
1063 # unescape character
1064 11 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1084 11 1095
1065 1084 ▶ next if not defined $char[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $char[$i] 0 1084 1084
1066  
1067 # open character class [...]
1068 1084 ▶ if ($char[$i] eq '[') {
Branch: 4 branches
BranchTrueFalseTotal
if ($char[$i] eq '[') { } 0 1084 1084
elsif ($char[$i] eq '[^') { } 0 1084 1084
elsif (my $char = classic_character_class($char[$i])) { } 0 1084 1084
elsif ($char[$i] =~ /\A [\x00-\xFF] \z/mosx) { } 1084 0 1084
1069 0 my $left = $i;
1070  
1071 # [] make die "unmatched [] in regexp ...\n"
1072  
1073 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
1074 0 $i++;
1075 }
1076  
1077 0 while (1) {
1078 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
1079 0 croak "Unmatched [] in regexp";
1080 }
1081 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
1082 0 my $right = $i;
1083 0 my @charlist = charlist_qr(@char[$left+1..$right-1], 'i');
1084  
1085 # escape character
1086 0 for my $char (@charlist) {
1087 0 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $char =~ /\A [.|)] \z/mosx }) 0 0 0
1088 }
1089  
1090 0 elsif ($char =~ /\A [.|)] \z/oxms) {
1091 0 $char = '\\' . $char;
1092 }
1093 }
1094  
1095 # [...]
1096 0 splice @char, $left, $right-$left+1, '(?:' . join('|', @charlist) . ')';
1097  
1098 0 $i = $left;
1099 0 last;
1100 }
1101 }
1102 }
1103  
1104 # open character class [^...]
1105 elsif ($char[$i] eq '[^') {
1106 0 my $left = $i;
1107  
1108 # [^] make die "unmatched [] in regexp ...\n"
1109  
1110 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
1111 0 $i++;
1112 }
1113  
1114 0 while (1) {
1115 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
1116 0 croak "Unmatched [] in regexp";
1117 }
1118 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
1119 0 my $right = $i;
1120 0 my @charlist = charlist_not_qr(@char[$left+1..$right-1], 'i');
1121  
1122 # escape character
1123 0 for my $char (@charlist) {
1124 0 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $char =~ /\A [.|)] \z/mosx }) 0 0 0
1125 }
1126  
1127 0 elsif ($char =~ /\A [.|)] \z/oxms) {
1128 0 $char = '\\' . $char;
1129 }
1130 }
1131  
1132 # [^...]
1133 0 splice @char, $left, $right-$left+1, '(?!' . join('|', @charlist) . ")(?:$your_char)";
1134  
1135 0 $i = $left;
1136 0 last;
1137 }
1138 }
1139 }
1140  
1141 # rewrite classic character class or escape character
1142 elsif (my $char = classic_character_class($char[$i])) {
1143 0 $char[$i] = $char;
1144 }
1145  
1146 # with /i modifier
1147 elsif ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) {
1148 1084 my $uc = Elatin4::uc($char[$i]);
1149 1084 my $fc = Elatin4::fc($char[$i]);
1150 1084 ▶ if ($uc ne $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc ne $fc) 556 528 1084
1151 556 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 553 3 556
1152 553 $char[$i] = '[' . $uc . $fc . ']';
1153 }
1154 else {
1155 3 $char[$i] = '(?:' . $uc . '|' . $fc . ')';
1156 }
1157 }
1158 }
1159 }
1160  
1161 # characterize
1162 11 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1084 11 1095
1163 1084 ▶ next if not defined $char[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $char[$i] 0 1084 1084
1164  
1165 1084 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx }) 0 1095 1095
1166 }
1167  
1168 # quote character before ? + * {
1169 0 ▶ elsif (($i >= 1) and ($char[$i] =~ /\A [\?\+\*\{] \z/oxms)) {
Condition66%2/3
$i >= 1 && $char[$i] =~ /\A [\?\+\*\{] \z/mosx
!ll&&!rl&&r
1110730
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
1170 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
1171 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
1172 }
1173 }
1174 }
1175  
1176 11 $string = join '', @char;
1177 }
1178  
1179 # make regexp string
1180 11 return @string;
1181 }
1182  
1183 #
1184 # classic character class ( \D \S \W \d \s \w \C \X \H \V \h \v \R \N \b \B )
1185 #
1186 2952 ▶sub Elatin4::classic_character_class {
Subroutine classic_character_class: called CC=2 SCAR=6.9
Pod undocumented
1187 2952 my($char) = @_;
1188  
1189 return {
1190 '\D' => '${Elatin4::eD}',
1191 '\S' => '${Elatin4::eS}',
1192 '\W' => '${Elatin4::eW}',
1193 '\d' => '[0-9]',
1194  
1195 # Before Perl 5.6, \s only matched the five whitespace characters
1196 # tab, newline, form-feed, carriage return, and the space character
1197 # itself, which, taken together, is the character class [\t\n\f\r ].
1198  
1199 # Vertical tabs are now whitespace
1200 # \s in a regex now matches a vertical tab in all circumstances.
1201 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
1202 # \t \n \v \f \r space
1203 # '\s' => '[\x09\x0A \x0C\x0D\x20]',
1204 # '\s' => '[\x09\x0A\x0B\x0C\x0D\x20]',
1205 '\s' => '\s',
1206  
1207 '\w' => '[0-9A-Z_a-z]',
1208 '\C' => '[\x00-\xFF]',
1209 '\X' => 'X',
1210  
1211 # \h \v \H \V
1212  
1213 # P.114 Character Class Shortcuts
1214 # in Chapter 7: In the World of Regular Expressions
1215 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
1216  
1217 # P.357 13.2.3 Whitespace
1218 # in Chapter 13: perlrecharclass: Perl Regular Expression Character Classes
1219 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
1220 #
1221 # 0x00009 CHARACTER TABULATION h s
1222 # 0x0000a LINE FEED (LF) vs
1223 # 0x0000b LINE TABULATION v
1224 # 0x0000c FORM FEED (FF) vs
1225 # 0x0000d CARRIAGE RETURN (CR) vs
1226 # 0x00020 SPACE h s
1227  
1228 # P.196 Table 5-9. Alphanumeric regex metasymbols
1229 # in Chapter 5. Pattern Matching
1230 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1231  
1232 # (and so on)
1233  
1234 '\H' => '${Elatin4::eH}',
1235 '\V' => '${Elatin4::eV}',
1236 '\h' => '[\x09\x20]',
1237 '\v' => '[\x0A\x0B\x0C\x0D]',
1238 '\R' => '${Elatin4::eR}',
1239  
1240 # \N
1241 #
1242 # http://perldoc.perl.org/perlre.html
1243 # Character Classes and other Special Escapes
1244 # Any character but \n (experimental). Not affected by /s modifier
1245  
1246 '\N' => '${Elatin4::eN}',
1247  
1248 # \b \B
1249  
1250 # P.180 Boundaries: The \b and \B Assertions
1251 # in Chapter 5: Pattern Matching
1252 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
1253  
1254 # P.219 Boundaries: The \b and \B Assertions
1255 # in Chapter 5: Pattern Matching
1256 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1257  
1258 # \b really means (?:(?<=\w)(?!\w)|(?<!\w)(?=\w))
1259 # or (?:(?<=\A|\W)(?=\w)|(?<=\w)(?=\W|\z))
1260 '\b' => '${Elatin4::eb}',
1261  
1262 # \B really means (?:(?<=\w)(?=\w)|(?<!\w)(?!\w))
1263 # or (?:(?<=\w)(?=\w)|(?<=\W)(?=\W))
1264 '\B' => '${Elatin4::eB}',
1265  
1266 2952 ▶ }->{$char} || '';
Condition100%2/2
{'\\D', '${Elatin4::eD}', '\\S', '${Elatin4::eS}', '\\W', '${Elatin4::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin4::eH}', '\\V', '${Elatin4::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin4::eR}', '\\N', '${Elatin4::eN}', '\\b', '${Elatin4::eb}', '\\B', '${Elatin4::eB}'}->{$char} || ''
l!l
1012851
MC/DC100%1/1
{'\\D', '${Elatin4::eD}', '\\S', '${Elatin4::eS}', '\\W', '${Elatin4::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin4::eH}', '\\V', '${Elatin4::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin4::eR}', '\\N', '${Elatin4::eN}', '\\b', '${Elatin4::eb}', '\\B', '${Elatin4::eB}'}->{$char} || ''
{'\\D', '${Elatin4::eD}', '\\S', '${Elatin4::eS}', '\\W', '${Elatin4::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin4::eH}', '\\V', '${Elatin4::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin4::eR}', '\\N', '${Elatin4::eN}', '\\b', '${Elatin4::eb}', '\\B', '${Elatin4::eB}'}->{$char}
Truth table100%2/2
A
A= {'\\D', '${Elatin4::eD}', '\\S', '${Elatin4::eS}', '\\W', '${Elatin4::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin4::eH}', '\\V', '${Elatin4::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin4::eR}', '\\N', '${Elatin4::eN}', '\\b', '${Elatin4::eb}', '\\B', '${Elatin4::eB}'}->{$char}
Aresult
11
00
1267 }
1268  
1269 #
1270 # prepare Latin-4 characters per length
1271 #
1272  
1273 # 1 octet characters
1274 424 my @chars1 = ();
1275 0 ▶sub chars1 {
Subroutine chars1: not called CC=5 SCAR=34.0
Pod undocumented
1276 0 ▶ if (@chars1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars1) 0 0 0
1277 0 return @chars1;
1278 }
1279 0 ▶ if (exists $range_tr{1}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{1}) 0 0 0
1280 0 my @ranges = @{ $range_tr{1} };
1281 0 ▶ while (my @range = splice(@ranges,0,1)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 1)) 0 0 0
1282 0 for my $oct0 (@{$range[0]}) {
1283 0 push @chars1, pack 'C', $oct0;
1284 }
1285 }
1286 }
1287 0 return @chars1;
1288 }
1289  
1290 # 2 octets characters
1291 424 my @chars2 = ();
1292 0 ▶sub chars2 {
Subroutine chars2: not called CC=6 SCAR=37.4
Pod undocumented
1293 0 ▶ if (@chars2) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars2) 0 0 0
1294 0 return @chars2;
1295 }
1296 0 ▶ if (exists $range_tr{2}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{2}) 0 0 0
1297 0 my @ranges = @{ $range_tr{2} };
1298 0 ▶ while (my @range = splice(@ranges,0,2)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 2)) 0 0 0
1299 0 for my $oct0 (@{$range[0]}) {
1300 0 for my $oct1 (@{$range[1]}) {
1301 0 push @chars2, pack 'CC', $oct0,$oct1;
1302 }
1303 }
1304 }
1305 }
1306 0 return @chars2;
1307 }
1308  
1309 # 3 octets characters
1310 424 my @chars3 = ();
1311 0 ▶sub chars3 {
Subroutine chars3: not called CC=7 SCAR=40.3
Pod undocumented
1312 0 ▶ if (@chars3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars3) 0 0 0
1313 0 return @chars3;
1314 }
1315 0 ▶ if (exists $range_tr{3}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{3}) 0 0 0
1316 0 my @ranges = @{ $range_tr{3} };
1317 0 ▶ while (my @range = splice(@ranges,0,3)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 3)) 0 0 0
1318 0 for my $oct0 (@{$range[0]}) {
1319 0 for my $oct1 (@{$range[1]}) {
1320 0 for my $oct2 (@{$range[2]}) {
1321 0 push @chars3, pack 'CCC', $oct0,$oct1,$oct2;
1322 }
1323 }
1324 }
1325 }
1326 }
1327 0 return @chars3;
1328 }
1329  
1330 # 4 octets characters
1331 424 my @chars4 = ();
1332 0 ▶sub chars4 {
Subroutine chars4: not called CC=8 SCAR=42.8
Pod undocumented
1333 0 ▶ if (@chars4) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars4) 0 0 0
1334 0 return @chars4;
1335 }
1336 0 ▶ if (exists $range_tr{4}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{4}) 0 0 0
1337 0 my @ranges = @{ $range_tr{4} };
1338 0 ▶ while (my @range = splice(@ranges,0,4)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 4)) 0 0 0
1339 0 for my $oct0 (@{$range[0]}) {
1340 0 for my $oct1 (@{$range[1]}) {
1341 0 for my $oct2 (@{$range[2]}) {
1342 0 for my $oct3 (@{$range[3]}) {
1343 0 push @chars4, pack 'CCCC', $oct0,$oct1,$oct2,$oct3;
1344 }
1345 }
1346 }
1347 }
1348 }
1349 }
1350 0 return @chars4;
1351 }
1352  
1353 #
1354 # Latin-4 open character list for tr
1355 #
1356 12 ▶sub _charlist_tr {
Subroutine _charlist_tr: called CC=35 SCAR=66.4
1357  
1358 12 local $_ = shift @_;
1359  
1360 # unescape character
1361 12 my @char = ();
1362 12 ▶ while (not /\G \z/oxmsgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgmosx) 38 12 50
1363 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 \\ ($Elatin4::q_char) /cgmosx) { } 0 38 38
elsif (/\G ($Elatin4::q_char) /cgmosx) { } 38 0 38
1364 0 push @char, '\-';
1365 }
1366 elsif (/\G \\ ([0-7]{2,3}) /oxmsgc) {
1367 0 push @char, CORE::chr(oct $1);
1368 }
1369 elsif (/\G \\x ([0-9A-Fa-f]{1,2}) /oxmsgc) {
1370 0 push @char, CORE::chr(hex $1);
1371 }
1372 elsif (/\G \\c ([\x40-\x5F]) /oxmsgc) {
1373 0 push @char, CORE::chr(CORE::ord($1) & 0x1F);
1374 }
1375 elsif (/\G (\\ [0nrtfbae]) /oxmsgc) {
1376 push @char, {
1377 '\0' => "\0",
1378 '\n' => "\n",
1379 '\r' => "\r",
1380 '\t' => "\t",
1381 '\f' => "\f",
1382 '\b' => "\x08", # \b means backspace in character class
1383 '\a' => "\a",
1384 '\e' => "\e",
1385 0 }->{$1};
1386 }
1387 elsif (/\G \\ ($q_char) /oxmsgc) {
1388 0 push @char, $1;
1389 }
1390 elsif (/\G ($q_char) /oxmsgc) {
1391 38 push @char, $1;
1392 }
1393 }
1394  
1395 # join separated multiple-octet
1396 12 @char = join('',@char) =~ /\G (?>\\-|$q_char) /oxmsg;
1397  
1398 # unescape '-'
1399 12 my @i = ();
1400 12 for my $i (0 .. $#char) {
1401 38 ▶ if ($char[$i] eq '\-') {
Branch: 2 branches
BranchTrueFalseTotal
if ($char[$i] eq '\\-') { } 0 38 38
elsif ($char[$i] eq '-') { } 0 38 38
1402 0 $char[$i] = '-';
1403 }
1404 elsif ($char[$i] eq '-') {
1405 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
1406 0 push @i, $i;
1407 }
1408 }
1409 }
1410  
1411 # open character list (reverse for splice)
1412 12 for my $i (CORE::reverse @i) {
1413 0 my @range = ();
1414  
1415 # range error
1416 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
1417 0 croak "Invalid tr/// range \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1418 }
1419  
1420 # range of multiple-octet code
1421 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
1422 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
1423 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
1424 }
1425 elsif (CORE::length($char[$i+1]) == 2) {
1426 0 push @range, grep {$char[$i-1] le $_} chars1();
1427 0 push @range, grep {$_ le $char[$i+1]} chars2();
1428 }
1429 elsif (CORE::length($char[$i+1]) == 3) {
1430 0 push @range, grep {$char[$i-1] le $_} chars1();
1431 0 push @range, chars2();
1432 0 push @range, grep {$_ le $char[$i+1]} chars3();
1433 }
1434 elsif (CORE::length($char[$i+1]) == 4) {
1435 0 push @range, grep {$char[$i-1] le $_} chars1();
1436 0 push @range, chars2();
1437 0 push @range, chars3();
1438 0 push @range, grep {$_ le $char[$i+1]} chars4();
1439 }
1440 else {
1441 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1442 }
1443 }
1444 elsif (CORE::length($char[$i-1]) == 2) {
1445 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
1446 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
1447 }
1448 elsif (CORE::length($char[$i+1]) == 3) {
1449 0 push @range, grep {$char[$i-1] le $_} chars2();
1450 0 push @range, grep {$_ le $char[$i+1]} chars3();
1451 }
1452 elsif (CORE::length($char[$i+1]) == 4) {
1453 0 push @range, grep {$char[$i-1] le $_} chars2();
1454 0 push @range, chars3();
1455 0 push @range, grep {$_ le $char[$i+1]} chars4();
1456 }
1457 else {
1458 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1459 }
1460 }
1461 elsif (CORE::length($char[$i-1]) == 3) {
1462 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
1463 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
1464 }
1465 elsif (CORE::length($char[$i+1]) == 4) {
1466 0 push @range, grep {$char[$i-1] le $_} chars3();
1467 0 push @range, grep {$_ le $char[$i+1]} chars4();
1468 }
1469 else {
1470 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1471 }
1472 }
1473 elsif (CORE::length($char[$i-1]) == 4) {
1474 0 ▶ if (CORE::length($char[$i+1]) == 4) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $char[$i + 1] == 4) { } 0 0 0
1475 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
1476 }
1477 else {
1478 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1479 }
1480 }
1481 else {
1482 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1483 }
1484  
1485 0 splice @char, $i-1, 3, @range;
1486 }
1487  
1488 12 return @char;
1489 }
1490  
1491 #
1492 # Latin-4 open character class
1493 #
1494 0 ▶sub _cc {
Subroutine _cc: not called CC=7 SCAR=40.3
1495 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
1496 0 die __FILE__, ": subroutine cc got no parameter.\n";
1497 }
1498 elsif (scalar(@_) == 1) {
1499 0 return sprintf('\x%02X',$_[0]);
1500 }
1501 elsif (scalar(@_) == 2) {
1502 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
1503 0 die __FILE__, ": subroutine cc got \$_[0] > \$_[1] parameters).\n";
1504 }
1505 elsif ($_[0] == $_[1]) {
1506 0 return sprintf('\x%02X',$_[0]);
1507 }
1508 elsif (($_[0]+1) == $_[1]) {
1509 0 return sprintf('[\\x%02X\\x%02X]',$_[0],$_[1]);
1510 }
1511 else {
1512 0 return sprintf('[\\x%02X-\\x%02X]',$_[0],$_[1]);
1513 }
1514 }
1515 else {
1516 0 die __FILE__, ": subroutine cc got 3 or more parameters (@{[scalar(@_)]} parameters).\n";
1517 }
1518 }
1519  
1520 #
1521 # Latin-4 octet range
1522 #
1523 246 ▶sub _octets {
Subroutine _octets: called CC=5 SCAR=19.3
1524 246 my $length = shift @_;
1525  
1526 246 ▶ if ($length == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length == 1) { } 246 0 246
1527 246 my($a1) = unpack 'C', $_[0];
1528 246 my($z1) = unpack 'C', $_[1];
1529  
1530 246 ▶ if ($a1 > $z1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($a1 > $z1) 0 246 246
1531 0 croak 'Invalid [] range in regexp (CORE::ord(A) > CORE::ord(B)) ' . '\x' . unpack('H*',$a1) . '-\x' . unpack('H*',$z1);
1532 }
1533  
1534 246 ▶ if ($a1 == $z1) {
Branch: 2 branches
BranchTrueFalseTotal
if ($a1 == $z1) { } 0 246 246
elsif ($a1 + 1 == $z1) { } 0 246 246
1535 0 return sprintf('\x%02X',$a1);
1536 }
1537 elsif (($a1+1) == $z1) {
1538 0 return sprintf('\x%02X\x%02X',$a1,$z1);
1539 }
1540 else {
1541 246 return sprintf('\x%02X-\x%02X',$a1,$z1);
1542 }
1543 }
1544 else {
1545 0 die __FILE__, ": subroutine _octets got invalid length ($length).\n";
1546 }
1547 }
1548  
1549 #
1550 # Latin-4 range regexp
1551 #
1552 246 ▶sub _range_regexp {
Subroutine _range_regexp: called CC=18 SCAR=41.7
1553 246 my($length,$first,$last) = @_;
1554  
1555 246 my @range_regexp = ();
1556 246 ▶ if (not exists $range_tr{$length}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $range_tr{$length}) 0 246 246
1557 0 return @range_regexp;
1558 }
1559  
1560 246 my @ranges = @{ $range_tr{$length} };
1561 246 ▶ while (my @range = splice(@ranges,0,$length)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, $length)) 246 246 492
1562 246 my $min = '';
1563 246 my $max = '';
1564 246 ▶ for (my $i=0; $i < $length; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $length) 246 246 492
1565 246 $min .= pack 'C', $range[$i][0];
1566 246 $max .= pack 'C', $range[$i][-1];
1567 }
1568  
1569 # min___max
1570 # FIRST_____________LAST
1571 # (nothing)
1572  
1573 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
1574 }
1575  
1576 # **********
1577 # min_________max
1578 # FIRST_____________LAST
1579 # **********
1580  
1581 ▶ 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
1582 0 push @range_regexp, _octets($length,$first,$max,$min,$max);
1583 }
1584  
1585 # **********************
1586 # min________________max
1587 # FIRST_____________LAST
1588 # **********************
1589  
1590 ▶ 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
1591 0 push @range_regexp, _octets($length,$first,$last,$min,$max);
1592 }
1593  
1594 # *********
1595 # min___max
1596 # FIRST_____________LAST
1597 # *********
1598  
1599 ▶ 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
1600 0 push @range_regexp, _octets($length,$min,$max,$min,$max);
1601 }
1602  
1603 # **********************
1604 # min__________________________max
1605 # FIRST_____________LAST
1606 # **********************
1607  
1608 ▶ 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
1609 246 push @range_regexp, _octets($length,$first,$last,$min,$max);
1610 }
1611  
1612 # *********
1613 # min________max
1614 # FIRST_____________LAST
1615 # *********
1616  
1617 ▶ 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
1618 0 push @range_regexp, _octets($length,$min,$last,$min,$max);
1619 }
1620  
1621 # min___max
1622 # FIRST_____________LAST
1623 # (nothing)
1624  
1625 elsif ($last lt $min) {
1626 }
1627  
1628 else {
1629 0 die __FILE__, ": subroutine _range_regexp panic.\n";
1630 }
1631 }
1632  
1633 246 return @range_regexp;
1634 }
1635  
1636 #
1637 # Latin-4 open character list for qr and not qr
1638 #
1639 650 ▶sub _charlist {
Subroutine _charlist: called CC=46 SCAR=45.9
1640  
1641 650 my $modifier = pop @_;
1642 650 my @char = @_;
1643  
1644 650 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 298 352 650
1645  
1646 # unescape character
1647 650 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1773 650 2423
1648  
1649 # escape - to ...
1650 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 \\ ($Elatin4::q_char) \z/mosx) { } 7 1371 1378
1651 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
1652 246 $char[$i] = '...';
1653 }
1654 }
1655  
1656 # octal escape sequence
1657 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
1658 0 $char[$i] = octchr($1);
1659 }
1660  
1661 # hexadecimal escape sequence
1662 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
1663 0 $char[$i] = hexchr($1);
1664 }
1665  
1666 # \b{...} --> b\{...}
1667 # \B{...} --> B\{...}
1668 # \N{CHARNAME} --> N\{CHARNAME}
1669 # \p{PROPERTY} --> p\{PROPERTY}
1670 # \P{PROPERTY} --> P\{PROPERTY}
1671 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
1672 0 $char[$i] = $1 . '\\' . $2;
1673 }
1674  
1675 # \p, \P, \X --> p, P, X
1676 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
1677 0 $char[$i] = $1;
1678 }
1679  
1680 elsif ($char[$i] =~ /\A \\ ([0-7]{2,3}) \z/oxms) {
1681 0 $char[$i] = CORE::chr oct $1;
1682 }
1683 elsif ($char[$i] =~ /\A \\x ([0-9A-Fa-f]{1,2}) \z/oxms) {
1684 22 $char[$i] = CORE::chr hex $1;
1685 }
1686 elsif ($char[$i] =~ /\A \\c ([\x40-\x5F]) \z/oxms) {
1687 0 $char[$i] = CORE::chr(CORE::ord($1) & 0x1F);
1688 }
1689 elsif ($char[$i] =~ /\A (\\ [0nrtfbaedswDSWHVhvR]) \z/oxms) {
1690 $char[$i] = {
1691 '\0' => "\0",
1692 '\n' => "\n",
1693 '\r' => "\r",
1694 '\t' => "\t",
1695 '\f' => "\f",
1696 '\b' => "\x08", # \b means backspace in character class
1697 '\a' => "\a",
1698 '\e' => "\e",
1699 '\d' => '[0-9]',
1700  
1701 # Vertical tabs are now whitespace
1702 # \s in a regex now matches a vertical tab in all circumstances.
1703 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
1704 # \t \n \v \f \r space
1705 # '\s' => '[\x09\x0A \x0C\x0D\x20]',
1706 # '\s' => '[\x09\x0A\x0B\x0C\x0D\x20]',
1707 '\s' => '\s',
1708  
1709 '\w' => '[0-9A-Z_a-z]',
1710 '\D' => '${Elatin4::eD}',
1711 '\S' => '${Elatin4::eS}',
1712 '\W' => '${Elatin4::eW}',
1713  
1714 '\H' => '${Elatin4::eH}',
1715 '\V' => '${Elatin4::eV}',
1716 '\h' => '[\x09\x20]',
1717 '\v' => '[\x0A\x0B\x0C\x0D]',
1718 '\R' => '${Elatin4::eR}',
1719  
1720 25 }->{$1};
1721 }
1722  
1723 # POSIX-style character classes
1724 ▶ 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
1725 $char[$i] = {
1726  
1727 '[:lower:]' => '[\x41-\x5A\x61-\x7A]',
1728 '[:upper:]' => '[\x41-\x5A\x61-\x7A]',
1729 '[:^lower:]' => '${Elatin4::not_lower_i}',
1730 '[:^upper:]' => '${Elatin4::not_upper_i}',
1731  
1732 8 }->{$1};
1733 }
1734 elsif ($char[$i] =~ /\A ( \[\: \^? (?:alnum|alpha|ascii|blank|cntrl|digit|graph|lower|print|punct|space|upper|word|xdigit) :\] ) \z/oxms) {
1735 $char[$i] = {
1736  
1737 '[:alnum:]' => '[\x30-\x39\x41-\x5A\x61-\x7A]',
1738 '[:alpha:]' => '[\x41-\x5A\x61-\x7A]',
1739 '[:ascii:]' => '[\x00-\x7F]',
1740 '[:blank:]' => '[\x09\x20]',
1741 '[:cntrl:]' => '[\x00-\x1F\x7F]',
1742 '[:digit:]' => '[\x30-\x39]',
1743 '[:graph:]' => '[\x21-\x7F]',
1744 '[:lower:]' => '[\x61-\x7A]',
1745 '[:print:]' => '[\x20-\x7F]',
1746 '[:punct:]' => '[\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E]',
1747  
1748 # P.174 POSIX-Style Character Classes
1749 # in Chapter 5: Pattern Matching
1750 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
1751  
1752 # P.311 11.2.4 Character Classes and other Special Escapes
1753 # in Chapter 11: perlre: Perl regular expressions
1754 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
1755  
1756 # P.210 POSIX-Style Character Classes
1757 # in Chapter 5: Pattern Matching
1758 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1759  
1760 '[:space:]' => '[\s\x0B]', # "\s" plus vertical tab ("\cK")
1761  
1762 '[:upper:]' => '[\x41-\x5A]',
1763 '[:word:]' => '[\x30-\x39\x41-\x5A\x5F\x61-\x7A]',
1764 '[:xdigit:]' => '[\x30-\x39\x41-\x46\x61-\x66]',
1765 '[:^alnum:]' => '${Elatin4::not_alnum}',
1766 '[:^alpha:]' => '${Elatin4::not_alpha}',
1767 '[:^ascii:]' => '${Elatin4::not_ascii}',
1768 '[:^blank:]' => '${Elatin4::not_blank}',
1769 '[:^cntrl:]' => '${Elatin4::not_cntrl}',
1770 '[:^digit:]' => '${Elatin4::not_digit}',
1771 '[:^graph:]' => '${Elatin4::not_graph}',
1772 '[:^lower:]' => '${Elatin4::not_lower}',
1773 '[:^print:]' => '${Elatin4::not_print}',
1774 '[:^punct:]' => '${Elatin4::not_punct}',
1775 '[:^space:]' => '${Elatin4::not_space}',
1776 '[:^upper:]' => '${Elatin4::not_upper}',
1777 '[:^word:]' => '${Elatin4::not_word}',
1778 '[:^xdigit:]' => '${Elatin4::not_xdigit}',
1779  
1780 70 }->{$1};
1781 }
1782 elsif ($char[$i] =~ /\A \\ ($q_char) \z/oxms) {
1783 7 $char[$i] = $1;
1784 }
1785 }
1786  
1787 # open character list
1788 650 my @singleoctet = ();
1789 650 my @multipleoctet = ();
1790 650 ▶ for (my $i=0; $i <= $#char; ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1527 650 2177
1791  
1792 # escaped -
1793 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
1794 246 $i += 1;
1795 246 next;
1796 }
1797  
1798 # make range regexp
1799 elsif ($char[$i] eq '...') {
1800  
1801 # range error
1802 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
1803 0 croak 'Invalid [] range in regexp (length(A) > length(B)) ' . '\x' . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]);
1804 }
1805 elsif (CORE::length($char[$i-1]) == CORE::length($char[$i+1])) {
1806 246 ▶ if ($char[$i-1] gt $char[$i+1]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i - 1] gt $char[$i + 1]) 0 246 246
1807 0 croak 'Invalid [] range in regexp (CORE::ord(A) > CORE::ord(B)) ' . '\x' . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]);
1808 }
1809 }
1810  
1811 # make range regexp per length
1812 246 for my $length (CORE::length($char[$i-1]) .. CORE::length($char[$i+1])) {
1813 246 my @regexp = ();
1814  
1815 # is first and last
1816 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
1817 246 push @regexp, _range_regexp($length, $char[$i-1], $char[$i+1]);
1818 }
1819  
1820 # is first
1821 elsif ($length == CORE::length($char[$i-1])) {
1822 0 push @regexp, _range_regexp($length, $char[$i-1], "\xFF" x $length);
1823 }
1824  
1825 # is inside in first and last
1826 ▶ 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
1827 0 push @regexp, _range_regexp($length, "\x00" x $length, "\xFF" x $length);
1828 }
1829  
1830 # is last
1831 elsif ($length == CORE::length($char[$i+1])) {
1832 0 push @regexp, _range_regexp($length, "\x00" x $length, $char[$i+1]);
1833 }
1834  
1835 else {
1836 0 die __FILE__, ": subroutine make_regexp panic.\n";
1837 }
1838  
1839 246 ▶ if ($length == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length == 1) { } 246 0 246
1840 246 push @singleoctet, @regexp;
1841 }
1842 else {
1843 0 push @multipleoctet, @regexp;
1844 }
1845 }
1846  
1847 246 $i += 2;
1848 }
1849  
1850 # with /i modifier
1851 elsif ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) {
1852 949 ▶ if ($modifier =~ /i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) { } 480 469 949
1853 480 my $uc = Elatin4::uc($char[$i]);
1854 480 my $fc = Elatin4::fc($char[$i]);
1855 480 ▶ if ($uc ne $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc ne $fc) { } 240 240 480
1856 240 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 240 0 240
1857 240 push @singleoctet, $uc, $fc;
1858 }
1859 else {
1860 0 push @singleoctet, $uc;
1861 0 push @multipleoctet, $fc;
1862 }
1863 }
1864 else {
1865 240 push @singleoctet, $char[$i];
1866 }
1867 }
1868 else {
1869 469 push @singleoctet, $char[$i];
1870 }
1871 949 $i += 1;
1872 }
1873  
1874 # single character of single octet code
1875 elsif ($char[$i] =~ /\A (?: \\h ) \z/oxms) {
1876 0 push @singleoctet, "\t", "\x20";
1877 0 $i += 1;
1878 }
1879 elsif ($char[$i] =~ /\A (?: \\v ) \z/oxms) {
1880 0 push @singleoctet, "\x0A", "\x0B", "\x0C", "\x0D";
1881 0 $i += 1;
1882 }
1883 elsif ($char[$i] =~ /\A (?: \\d | \\s | \\w ) \z/oxms) {
1884 2 push @singleoctet, $char[$i];
1885 2 $i += 1;
1886 }
1887  
1888 # single character of multiple-octet code
1889 else {
1890 84 push @multipleoctet, $char[$i];
1891 84 $i += 1;
1892 }
1893 }
1894  
1895 # quote metachar
1896 650 for (@singleoctet) {
1897 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
1898 0 $_ = '-';
1899 }
1900 elsif (/\A \n \z/oxms) {
1901 8 $_ = '\n';
1902 }
1903 elsif (/\A \r \z/oxms) {
1904 8 $_ = '\r';
1905 }
1906 elsif (/\A ([\x00-\x20\x7F-\xFF]) \z/oxms) {
1907 744 $_ = sprintf('\x%02X', CORE::ord $1);
1908 }
1909 elsif (/\A [\x00-\xFF] \z/oxms) {
1910 429 $_ = quotemeta $_;
1911 }
1912 }
1913  
1914 # return character list
1915 650 return \@singleoctet, \@multipleoctet;
1916 }
1917  
1918 #
1919 # Latin-4 octal escape sequence
1920 #
1921 5 ▶sub octchr {
Subroutine octchr: called CC=2 SCAR=6.9
Pod undocumented
1922 5 my($octdigit) = @_;
1923  
1924 5 my @binary = ();
1925 5 for my $octal (split(//,$octdigit)) {
1926 push @binary, {
1927 '0' => '000',
1928 '1' => '001',
1929 '2' => '010',
1930 '3' => '011',
1931 '4' => '100',
1932 '5' => '101',
1933 '6' => '110',
1934 '7' => '111',
1935 50 }->{$octal};
1936 }
1937 5 my $binary = join '', @binary;
1938  
1939 my $octchr = {
1940 # 1234567
1941 1 => pack('B*', "0000000$binary"),
1942 2 => pack('B*', "000000$binary"),
1943 3 => pack('B*', "00000$binary"),
1944 4 => pack('B*', "0000$binary"),
1945 5 => pack('B*', "000$binary"),
1946 6 => pack('B*', "00$binary"),
1947 7 => pack('B*', "0$binary"),
1948 0 => pack('B*', "$binary"),
1949  
1950 5 }->{CORE::length($binary) % 8};
1951  
1952 5 return $octchr;
1953 }
1954  
1955 #
1956 # Latin-4 hexadecimal escape sequence
1957 #
1958 5 ▶sub hexchr {
Subroutine hexchr: called CC=1 SCAR=0.0
Pod undocumented
1959 5 my($hexdigit) = @_;
1960  
1961 my $hexchr = {
1962 1 => pack('H*', "0$hexdigit"),
1963 0 => pack('H*', "$hexdigit"),
1964  
1965 5 }->{CORE::length($_[0]) % 2};
1966  
1967 5 return $hexchr;
1968 }
1969  
1970 #
1971 # Latin-4 open character list for qr
1972 #
1973 576 ▶sub charlist_qr {
Subroutine charlist_qr: called CC=17 SCAR=28.7
Pod undocumented
1974  
1975 576 my $modifier = pop @_;
1976 576 my @char = @_;
1977  
1978 576 my($singleoctet, $multipleoctet) = _charlist(@char, $modifier);
1979 576 my @singleoctet = @$singleoctet;
1980 576 my @multipleoctet = @$multipleoctet;
1981  
1982 # return character list
1983 576 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) 498 78 576
1984  
1985 # with /i modifier
1986 498 ▶ if ($modifier =~ m/i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) 265 233 498
1987 265 my %singleoctet_ignorecase = ();
1988 265 for (@singleoctet) {
1989 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
1990 745 for my $ord (hex($1) .. hex($2)) {
1991 795 my $char = CORE::chr($ord);
1992 795 my $uc = Elatin4::uc($char);
1993 795 my $fc = Elatin4::fc($char);
1994 795 ▶ if ($uc eq $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc eq $fc) { } 240 555 795
1995 240 $singleoctet_ignorecase{unpack 'C*', $char} = 1;
1996 }
1997 else {
1998 555 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 555 0 555
1999 555 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2000 555 $singleoctet_ignorecase{unpack 'C*', $fc} = 1;
2001 }
2002 else {
2003 0 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2004 0 push @multipleoctet, join '', map {sprintf('\x%02X',$_)} unpack 'C*', $fc;
2005 }
2006 }
2007 }
2008 }
2009 745 ▶ if ($_ ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ ne "") 0 745 745
2010 0 $singleoctet_ignorecase{unpack 'C*', $_} = 1;
2011 }
2012 }
2013 265 my $i = 0;
2014 265 my @singleoctet_ignorecase = ();
2015 265 for my $ord (0 .. 255) {
2016 67840 ▶ if (exists $singleoctet_ignorecase{$ord}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $singleoctet_ignorecase{$ord}) { } 870 66970 67840
2017 870 push @{$singleoctet_ignorecase[$i]}, $ord;
2018 }
2019 else {
2020 66970 $i++;
2021 }
2022 }
2023 265 @singleoctet = ();
2024 265 for my $range (@singleoctet_ignorecase) {
2025 56160 ▶ if (ref $range) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $range) 770 55390 56160
2026 770 ▶ if (scalar(@{$range}) == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @{$range;} == 1) { } 720 50 770
elsif (scalar @{$range;} == 2) { } 0 50 50
2027 720 push @singleoctet, sprintf('\x%02X', @{$range}[0]);
2028 }
2029 50 elsif (scalar(@{$range}) == 2) {
2030 0 push @singleoctet, sprintf('\x%02X\x%02X', @{$range}[0], @{$range}[-1]);
2031 }
2032 else {
2033 50 push @singleoctet, sprintf('\x%02X-\x%02X', @{$range}[0], @{$range}[-1]);
2034 }
2035 }
2036 }
2037 }
2038  
2039 498 my $not_anchor = '';
2040  
2041 498 push @multipleoctet, join('', $not_anchor, '[', @singleoctet, ']' );
2042 }
2043 576 ▶ if (scalar(@multipleoctet) >= 2) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @multipleoctet >= 2) { } 6 570 576
2044 6 return '(?:' . join('|', @multipleoctet) . ')';
2045 }
2046 else {
2047 570 return $multipleoctet[0];
2048 }
2049 }
2050  
2051 #
2052 # Latin-4 open character list for not qr
2053 #
2054 74 ▶sub charlist_not_qr {
Subroutine charlist_not_qr: called CC=18 SCAR=33.1
Pod undocumented
2055  
2056 74 my $modifier = pop @_;
2057 74 my @char = @_;
2058  
2059 74 my($singleoctet, $multipleoctet) = _charlist(@char, $modifier);
2060 74 my @singleoctet = @$singleoctet;
2061 74 my @multipleoctet = @$multipleoctet;
2062  
2063 # with /i modifier
2064 74 ▶ if ($modifier =~ m/i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) 25 49 74
2065 25 my %singleoctet_ignorecase = ();
2066 25 for (@singleoctet) {
2067 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
2068 25 for my $ord (hex($1) .. hex($2)) {
2069 75 my $char = CORE::chr($ord);
2070 75 my $uc = Elatin4::uc($char);
2071 75 my $fc = Elatin4::fc($char);
2072 75 ▶ if ($uc eq $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc eq $fc) { } 0 75 75
2073 0 $singleoctet_ignorecase{unpack 'C*', $char} = 1;
2074 }
2075 else {
2076 75 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 75 0 75
2077 75 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2078 75 $singleoctet_ignorecase{unpack 'C*', $fc} = 1;
2079 }
2080 else {
2081 0 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2082 0 push @multipleoctet, join '', map {sprintf('\x%02X',$_)} unpack 'C*', $fc;
2083 }
2084 }
2085 }
2086 }
2087 25 ▶ if ($_ ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ ne "") 0 25 25
2088 0 $singleoctet_ignorecase{unpack 'C*', $_} = 1;
2089 }
2090 }
2091 25 my $i = 0;
2092 25 my @singleoctet_ignorecase = ();
2093 25 for my $ord (0 .. 255) {
2094 6400 ▶ if (exists $singleoctet_ignorecase{$ord}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $singleoctet_ignorecase{$ord}) { } 150 6250 6400
2095 150 push @{$singleoctet_ignorecase[$i]}, $ord;
2096 }
2097 else {
2098 6250 $i++;
2099 }
2100 }
2101 25 @singleoctet = ();
2102 25 for my $range (@singleoctet_ignorecase) {
2103 2400 ▶ if (ref $range) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $range) 50 2350 2400
2104 50 ▶ if (scalar(@{$range}) == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @{$range;} == 1) { } 0 50 50
elsif (scalar @{$range;} == 2) { } 0 50 50
2105 0 push @singleoctet, sprintf('\x%02X', @{$range}[0]);
2106 }
2107 50 elsif (scalar(@{$range}) == 2) {
2108 0 push @singleoctet, sprintf('\x%02X\x%02X', @{$range}[0], @{$range}[-1]);
2109 }
2110 else {
2111 50 push @singleoctet, sprintf('\x%02X-\x%02X', @{$range}[0], @{$range}[-1]);
2112 }
2113 }
2114 }
2115 }
2116  
2117 # return character list
2118 74 ▶ if (scalar(@multipleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @multipleoctet >= 1) { } 0 74 74
2119 0 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) { } 0 0 0
2120  
2121 # any character other than multiple-octet and single octet character class
2122 0 return '(?!' . join('|', @multipleoctet) . ')(?:[^' . join('', @singleoctet) . '])';
2123 }
2124 else {
2125  
2126 # any character other than multiple-octet character class
2127 0 return '(?!' . join('|', @multipleoctet) . ")(?:$your_char)";
2128 }
2129 }
2130 else {
2131 74 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) { } 74 0 74
2132  
2133 # any character other than single octet character class
2134 74 return '(?:[^' . join('', @singleoctet) . '])';
2135 }
2136 else {
2137  
2138 # any character
2139 0 return "(?:$your_char)";
2140 }
2141 }
2142 }
2143  
2144 #
2145 # open file in read mode
2146 #
2147 424 ▶sub _open_r {
Subroutine _open_r: called CC=1 SCAR=0.0
2148 424 my(undef,$file) = @_;
2149 424 ▶ use Fcntl qw(O_RDONLY);
Subroutine BEGIN: called CC=1 SCAR=0.0
2150 424 return CORE::sysopen($_[0], $file, &O_RDONLY);
2151 }
2152  
2153 #
2154 # open file in append mode
2155 #
2156 212 ▶sub _open_a {
Subroutine _open_a: called CC=1 SCAR=0.0
2157 212 my(undef,$file) = @_;
2158 424 ▶ use Fcntl qw(O_WRONLY O_APPEND O_CREAT);
Subroutine BEGIN: called CC=1 SCAR=0.0
2159 212 return CORE::sysopen($_[0], $file, &O_WRONLY|&O_APPEND|&O_CREAT);
2160 }
2161  
2162 #
2163 # safe system
2164 #
2165 212 ▶sub _systemx {
Subroutine _systemx: called CC=1 SCAR=0.0
2166  
2167 # P.707 29.2.33. exec
2168 # in Chapter 29: Functions
2169 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2170 #
2171 # Be aware that in older releases of Perl, exec (and system) did not flush
2172 # your output buffer, so you needed to enable command buffering by setting $|
2173 # on one or more filehandles to avoid lost output in the case of exec, or
2174 # misordererd output in the case of system. This situation was largely remedied
2175 # in the 5.6 release of Perl. (So, 5.005 release not yet.)
2176  
2177 # P.855 exec
2178 # in Chapter 27: Functions
2179 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2180 #
2181 # In very old release of Perl (before v5.6), exec (and system) did not flush
2182 # your output buffer, so you needed to enable command buffering by setting $|
2183 # on one or more filehandles to avoid lost output with exec or misordered
2184 # output with system.
2185  
2186 212 $| = 1;
2187  
2188 # P.565 23.1.2. Cleaning Up Your Environment
2189 # in Chapter 23: Security
2190 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2191  
2192 # P.656 Cleaning Up Your Environment
2193 # in Chapter 20: Security
2194 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2195  
2196 # local $ENV{'PATH'} = '.';
2197 212 local @ENV{qw(IFS CDPATH ENV BASH_ENV)}; # Make %ENV safer
2198  
2199 # P.707 29.2.33. exec
2200 # in Chapter 29: Functions
2201 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2202 #
2203 # As we mentioned earlier, exec treats a discrete list of arguments as an
2204 # indication that it should bypass shell processing. However, there is one
2205 # place where you might still get tripped up. The exec call (and system, too)
2206 # will not distinguish between a single scalar argument and an array containing
2207 # only one element.
2208 #
2209 # @args = ("echo surprise"); # just one element in list
2210 # exec @args # still subject to shell escapes
2211 # or die "exec: $!"; # because @args == 1
2212 #
2213 # To avoid this, you can use the PATHNAME syntax, explicitly duplicating the
2214 # first argument as the pathname, which forces the rest of the arguments to be
2215 # interpreted as a list, even if there is only one of them:
2216 #
2217 # exec { $args[0] } @args # safe even with one-argument list
2218 # or die "can't exec @args: $!";
2219  
2220 # P.855 exec
2221 # in Chapter 27: Functions
2222 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2223 #
2224 # As we mentioned earlier, exec treats a discrete list of arguments as a
2225 # directive to bypass shell processing. However, there is one place where
2226 # you might still get tripped up. The exec call (and system, too) cannot
2227 # distinguish between a single scalar argument and an array containing
2228 # only one element.
2229 #
2230 # @args = ("echo surprise"); # just one element in list
2231 # exec @args # still subject to shell escapes
2232 # || die "exec: $!"; # because @args == 1
2233 #
2234 # To avoid this, use the PATHNAME syntax, explicitly duplicating the first
2235 # argument as the pathname, which forces the rest of the arguments to be
2236 # interpreted as a list, even if there is only one of them:
2237 #
2238 # exec { $args[0] } @args # safe even with one-argument list
2239 # || die "can't exec @args: $!";
2240  
2241 212 return CORE::system { $_[0] } @_; # safe even with one-argument list
2242 }
2243  
2244 #
2245 # Latin-4 order to character (with parameter)
2246 #
2247 3469 ▶sub Elatin4::chr(;$) {
Subroutine chr: called CC=4 SCAR=13.9
Pod undocumented
2248  
2249 3469 ▶ my $c = @_ ? $_[0] : $_;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 3469 0 3469
2250  
2251 3469 ▶ if ($c == 0x00) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c == 0) { } 24 3445 3469
2252 24 return "\x00";
2253 }
2254 else {
2255 3445 my @chr = ();
2256 3445 ▶ while ($c > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c > 0) 3445 3445 6890
2257 3445 unshift @chr, ($c % 0x100);
2258 3445 $c = int($c / 0x100);
2259 }
2260 3445 return pack 'C*', @chr;
2261 }
2262 }
2263  
2264 #
2265 # Latin-4 order to character (without parameter)
2266 #
2267 0 ▶sub Elatin4::chr_() {
Subroutine chr_: not called CC=3 SCAR=24.8
Pod undocumented
2268  
2269 0 my $c = $_;
2270  
2271 0 ▶ if ($c == 0x00) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c == 0) { } 0 0 0
2272 0 return "\x00";
2273 }
2274 else {
2275 0 my @chr = ();
2276 0 ▶ while ($c > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c > 0) 0 0 0
2277 0 unshift @chr, ($c % 0x100);
2278 0 $c = int($c / 0x100);
2279 }
2280 0 return pack 'C*', @chr;
2281 }
2282 }
2283  
2284 #
2285 # Latin-4 path globbing (with parameter)
2286 #
2287 0 ▶sub Elatin4::glob($) {
Subroutine glob: not called CC=3 SCAR=24.8
Pod undocumented
2288  
2289 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2290 0 my @glob = _DOS_like_glob(@_);
2291 0 for my $glob (@glob) {
2292 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2293 }
2294 0 return @glob;
2295 }
2296 else {
2297 0 my $glob = _DOS_like_glob(@_);
2298 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2299 0 return $glob;
2300 }
2301 }
2302  
2303 #
2304 # Latin-4 path globbing (without parameter)
2305 #
2306 0 ▶sub Elatin4::glob_() {
Subroutine glob_: not called CC=3 SCAR=24.8
Pod undocumented
2307  
2308 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2309 0 my @glob = _DOS_like_glob();
2310 0 for my $glob (@glob) {
2311 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2312 }
2313 0 return @glob;
2314 }
2315 else {
2316 0 my $glob = _DOS_like_glob();
2317 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2318 0 return $glob;
2319 }
2320 }
2321  
2322 #
2323 # Latin-4 path globbing via File::DosGlob 1.10
2324 #
2325 # Often I confuse "_dosglob" and "_doglob".
2326 # So, I renamed "_dosglob" to "_DOS_like_glob".
2327 #
2328 424 my %iter;
2329 my %entries;
2330 0 ▶sub _DOS_like_glob {
Subroutine _DOS_like_glob: not called CC=10 SCAR=47.0
2331  
2332 # context (keyed by second cxix argument provided by core)
2333 0 my($expr,$cxix) = @_;
2334  
2335 # glob without args defaults to $_
2336 0 ▶ $expr = $_ if not defined $expr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $expr 0 0 0
2337  
2338 # represents the current user's home directory
2339 #
2340 # 7.3. Expanding Tildes in Filenames
2341 # in Chapter 7. File Access
2342 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2343 #
2344 # and File::HomeDir, File::HomeDir::Windows module
2345  
2346 # DOS-like system
2347 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
2348 0 $expr =~ s{ \A ~ (?= [^/\\] ) }
2349 0 { my_home_MSWin32() }oxmse;
2350 }
2351  
2352 # UNIX-like system
2353 else {
2354 0 $expr =~ s{ \A ~ ( (?:[^/])* ) }
2355 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
2356 }
2357  
2358 # assume global context if not provided one
2359 0 ▶ $cxix = '_G_' if not defined $cxix;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $cxix 0 0 0
2360 0 ▶ $iter{$cxix} = 0 if not exists $iter{$cxix};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $iter{$cxix} 0 0 0
2361  
2362 # if we're just beginning, do it all first
2363 0 ▶ if ($iter{$cxix} == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iter{$cxix} == 0) 0 0 0
2364 0 $entries{$cxix} = [ _do_glob(1, _parse_line($expr)) ];
2365 }
2366  
2367 # chuck it all out, quick or slow
2368 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2369 0 delete $iter{$cxix};
2370 0 return @{delete $entries{$cxix}};
2371 }
2372 else {
2373 0 ▶ if ($iter{$cxix} = scalar @{$entries{$cxix}}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iter{$cxix} = scalar @{$entries{$cxix};}) { } 0 0 0
2374 0 return shift @{$entries{$cxix}};
2375 }
2376 else {
2377 # return undef for EOL
2378 0 delete $iter{$cxix};
2379 0 delete $entries{$cxix};
2380 0 return undef;
2381 }
2382 }
2383 }
2384  
2385 #
2386 # Latin-4 path globbing subroutine
2387 #
2388 0 ▶sub _do_glob {
Subroutine _do_glob: not called CC=44 SCAR=75.9
2389  
2390 0 my($cond,@expr) = @_;
2391 0 my @glob = ();
2392 0 my $fix_drive_relative_paths = 0;
2393  
2394 OUTER:
2395 0 for my $expr (@expr) {
2396 0 ▶ next OUTER if not defined $expr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $expr 0 0 0
2397 0 ▶ next OUTER if $expr eq '';
Branch: 1 branch
BranchTrueFalseTotal
if $expr eq "" 0 0 0
2398  
2399 0 my @matched = ();
2400 0 my @globdir = ();
2401 0 my $head = '.';
2402 0 my $pathsep = '/';
2403 0 my $tail;
2404  
2405 # if argument is within quotes strip em and do no globbing
2406 0 ▶ if ($expr =~ /\A " ((?:$q_char)*?) " \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expr =~ /\A " ((?:$Elatin4::q_char)*?) " \z/mosx) 0 0 0
2407 0 $expr = $1;
2408 0 ▶ if ($cond eq 'd') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cond eq 'd') { } 0 0 0
2409 0 ▶ if (-d $expr) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $expr) 0 0 0
2410 0 push @glob, $expr;
2411 }
2412 }
2413 else {
2414 0 ▶ if (-e $expr) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $expr) 0 0 0
2415 0 push @glob, $expr;
2416 }
2417 }
2418 0 next OUTER;
2419 }
2420  
2421 # wildcards with a drive prefix such as h:*.pm must be changed
2422 # to h:./*.pm to expand correctly
2423 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
2424 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
2425 0 $fix_drive_relative_paths = 1;
2426 }
2427 }
2428  
2429 0 ▶ if (($head, $tail) = _parse_path($expr,$pathsep)) {
Branch: 1 branch
BranchTrueFalseTotal
if (($head, $tail) = _parse_path($expr, $pathsep)) 0 0 0
2430 0 ▶ if ($tail eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($tail eq "") 0 0 0
2431 0 push @glob, $expr;
2432 0 next OUTER;
2433 }
2434 0 ▶ if ($head =~ / \A (?:$q_char)*? [*?] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head =~ / \A (?:$Elatin4::q_char)*? [*?] /mosx) 0 0 0
2435 0 ▶ if (@globdir = _do_glob('d', $head)) {
Branch: 1 branch
BranchTrueFalseTotal
if (@globdir = _do_glob("d", $head)) 0 0 0
2436 0 push @glob, _do_glob($cond, map {"$_$pathsep$tail"} @globdir);
2437 0 next OUTER;
2438 }
2439 }
2440 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
2441 0 $head .= $pathsep;
2442 }
2443 0 $expr = $tail;
2444 }
2445  
2446 # If file component has no wildcards, we can avoid opendir
2447 0 ▶ if ($expr !~ / \A (?:$q_char)*? [*?] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($expr =~ / \A (?:$Elatin4::q_char)*? [*?] /mosx) 0 0 0
2448 0 ▶ if ($head eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($head eq ".") 0 0 0
2449 0 $head = '';
2450 }
2451 0 ▶ if ($head ne '' and ($head =~ / \G ($q_char) /oxmsg)[-1] ne $pathsep) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head ne "" and ($head =~ / \G ($Elatin4::q_char) /gmosx)[-1] ne $pathsep) 0 0 0
Condition0%0/3
$head ne "" and ($head =~ / \G ($Elatin4::q_char) /gmosx)[-1] ne $pathsep
!ll&&!rl&&r
000
MC/DC0%0/2
$head ne "" and ($head =~ / \G ($Elatin4::q_char) /gmosx)[-1] ne $pathsep
$head ne "" ($head =~ / \G ($Elatin4::q_char) /gmosx)[-1] ne $pathsep
Truth table0%0/3
A and B
A= $head ne ""B= ($head =~ / \G ($Elatin4::q_char) /gmosx)[-1] ne $pathsep
ABresult
0X0
100
111
2452 0 $head .= $pathsep;
2453 }
2454 0 $head .= $expr;
2455 0 ▶ if ($cond eq 'd') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cond eq 'd') { } 0 0 0
2456 0 ▶ if (-d $head) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $head) 0 0 0
2457 0 push @glob, $head;
2458 }
2459 }
2460 else {
2461 0 ▶ if (-e $head) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $head) 0 0 0
2462 0 push @glob, $head;
2463 }
2464 }
2465 0 next OUTER;
2466 }
2467 0 ▶ opendir(*DIR, $head) or next OUTER;
Branch: 1 branch
BranchTrueFalseTotal
opendir *DIR, $head or next OUTER 0 0 0
2468 0 my @leaf = readdir DIR;
2469 0 closedir DIR;
2470  
2471 0 ▶ if ($head eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($head eq ".") 0 0 0
2472 0 $head = '';
2473 }
2474 0 ▶ if ($head ne '' and ($head =~ / \G ($q_char) /oxmsg)[-1] ne $pathsep) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head ne "" and ($head =~ / \G ($Elatin4::q_char) /gmosx)[-1] ne $pathsep) 0 0 0
Condition0%0/3
$head ne "" and ($head =~ / \G ($Elatin4::q_char) /gmosx)[-1] ne $pathsep
!ll&&!rl&&r
000
MC/DC0%0/2
$head ne "" and ($head =~ / \G ($Elatin4::q_char) /gmosx)[-1] ne $pathsep
$head ne "" ($head =~ / \G ($Elatin4::q_char) /gmosx)[-1] ne $pathsep
Truth table0%0/3
A and B
A= $head ne ""B= ($head =~ / \G ($Elatin4::q_char) /gmosx)[-1] ne $pathsep
ABresult
0X0
100
111
2475 0 $head .= $pathsep;
2476 }
2477  
2478 0 my $pattern = '';
2479 0 ▶ while ($expr =~ / \G ($q_char) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expr =~ / \G ($Elatin4::q_char) /cgox) 0 0 0
2480 0 my $char = $1;
2481  
2482 # 6.9. Matching Shell Globs as Regular Expressions
2483 # in Chapter 6. Pattern Matching
2484 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2485 # (and so on)
2486  
2487 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
2488 0 $pattern .= "(?:$your_char)*",
2489 }
2490 elsif ($char eq '?') {
2491 0 $pattern .= "(?:$your_char)?", # DOS style
2492 # $pattern .= "(?:$your_char)", # UNIX style
2493 }
2494 elsif ((my $fc = Elatin4::fc($char)) ne $char) {
2495 0 $pattern .= $fc;
2496 }
2497 else {
2498 0 $pattern .= quotemeta $char;
2499 }
2500 }
2501 0 ▶ my $matchsub = sub { Elatin4::fc($_[0]) =~ /\A $pattern \z/xms };
Subroutine __ANON__: not called CC=1 SCAR=6.9
2502  
2503 # if ($@) {
2504 # print STDERR "$0: $@\n";
2505 # next OUTER;
2506 # }
2507  
2508 INNER:
2509 0 for my $leaf (@leaf) {
2510 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
2511 0 next INNER;
2512 }
2513 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
2514 0 next INNER;
2515 }
2516  
2517 0 ▶ if (&$matchsub($leaf)) {
Branch: 1 branch
BranchTrueFalseTotal
if (&$matchsub($leaf)) 0 0 0
2518 0 push @matched, "$head$leaf";
2519 0 next INNER;
2520 }
2521  
2522 # [DOS compatibility special case]
2523 # Failed, add a trailing dot and try again, but only...
2524  
2525 0 ▶ if (Elatin4::index($leaf,'.') == -1 and # if name does not have a dot in it *and*
Branch: 1 branch
BranchTrueFalseTotal
if (&Elatin4::index($leaf, ".") == -1 and length $leaf <= 8 and &Elatin4::index($pattern, "\\.") != -1) 0 0 0
Condition0%0/6
&Elatin4::index($leaf, ".") == -1 and length $leaf <= 8 and &Elatin4::index($pattern, "\\.") != -1
!ll&&!rl&&r
000
&Elatin4::index($leaf, ".") == -1 and length $leaf <= 8
!ll&&!rl&&r
000
MC/DC0%0/3
&Elatin4::index($leaf, ".") == -1 and length $leaf <= 8 and &Elatin4::index($pattern, "\\.") != -1
&Elatin4::index($leaf, ".") == -1 length $leaf <= 8 &Elatin4::index($pattern, "\\.") != -1
Truth table0%0/4
A and B and C
A= &Elatin4::index($leaf, ".") == -1B= length $leaf <= 8C= &Elatin4::index($pattern, "\\.") != -1
ABCresult
0XX0
10X0
1100
1111
2526 CORE::length($leaf) <= 8 and # name is shorter than or equal to 8 chars *and*
2527 Elatin4::index($pattern,'\\.') != -1 # pattern has a dot.
2528 ) {
2529 0 ▶ if (&$matchsub("$leaf.")) {
Branch: 1 branch
BranchTrueFalseTotal
if (&$matchsub("$leaf.")) 0 0 0
2530 0 push @matched, "$head$leaf";
2531 0 next INNER;
2532 }
2533 }
2534 }
2535 0 ▶ if (@matched) {
Branch: 1 branch
BranchTrueFalseTotal
if (@matched) 0 0 0
2536 0 push @glob, @matched;
2537 }
2538 }
2539 0 ▶ if ($fix_drive_relative_paths) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fix_drive_relative_paths) 0 0 0
2540 0 for my $glob (@glob) {
2541 0 $glob =~ s# \A ([A-Za-z]:) \./ #$1#oxms;
2542 }
2543 }
2544 0 return @glob;
2545 }
2546  
2547 #
2548 # Latin-4 parse line
2549 #
2550 0 ▶sub _parse_line {
Subroutine _parse_line: not called CC=3 SCAR=24.8
2551  
2552 0 my($line) = @_;
2553  
2554 0 $line .= ' ';
2555 0 my @piece = ();
2556 0 ▶ while ($line =~ /
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ / " ( (?>(?: [^"] )* ) ) " (?>\s+) | ( (?>(?: [^"\s] )* ) ) (?>\s+) /gmosx) 0 0 0
2557 " ( (?>(?: [^"] )* ) ) " (?>\s+) |
2558 ( (?>(?: [^"\s] )* ) ) (?>\s+)
2559 /oxmsg
2560 ) {
2561 0 ▶ push @piece, defined($1) ? $1 : $2;
Branch: 1 branch
BranchTrueFalseTotal
defined $1 ? : 0 0 0
2562 }
2563 0 return @piece;
2564 }
2565  
2566 #
2567 # Latin-4 parse path
2568 #
2569 0 ▶sub _parse_path {
Subroutine _parse_path: not called CC=2 SCAR=17.9
2570  
2571 0 my($path,$pathsep) = @_;
2572  
2573 0 $path .= '/';
2574 0 my @subpath = ();
2575 0 ▶ while ($path =~ /
Branch: 1 branch
BranchTrueFalseTotal
if ($path =~ m( ((?: [^/\\] )+?) [/\\] )gmosx) 0 0 0
2576 ((?: [^\/\\] )+?) [\/\\]
2577 /oxmsg
2578 ) {
2579 0 push @subpath, $1;
2580 }
2581  
2582 0 my $tail = pop @subpath;
2583 0 my $head = join $pathsep, @subpath;
2584 0 return $head, $tail;
2585 }
2586  
2587 #
2588 # via File::HomeDir::Windows 1.00
2589 #
2590 0 ▶sub my_home_MSWin32 {
Subroutine my_home_MSWin32: not called CC=9 SCAR=45.0
Pod undocumented
2591  
2592 # A lot of unix people and unix-derived tools rely on
2593 # the ability to overload HOME. We will support it too
2594 # so that they can replace raw HOME calls with File::HomeDir.
2595 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
2596 0 return $ENV{'HOME'};
2597 }
2598  
2599 # Do we have a user profile?
2600 ▶ 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
2601 0 return $ENV{'USERPROFILE'};
2602 }
2603  
2604 # Some Windows use something like $ENV{'HOME'}
2605 ▶ 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
2606 0 return join '', $ENV{'HOMEDRIVE'}, $ENV{'HOMEPATH'};
2607 }
2608  
2609 0 return undef;
2610 }
2611  
2612 #
2613 # via File::HomeDir::Unix 1.00
2614 #
2615 0 ▶sub my_home {
Subroutine my_home: not called CC=7 SCAR=40.3
Pod undocumented
2616 0 my $home;
2617  
2618 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
2619 0 $home = $ENV{'HOME'};
2620 }
2621  
2622 # This is from the original code, but I'm guessing
2623 # it means "login directory" and exists on some Unixes.
2624 ▶ 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
2625 0 $home = $ENV{'LOGDIR'};
2626 }
2627  
2628 ### More-desperate methods
2629  
2630 # Light desperation on any (Unixish) platform
2631 else {
2632 0 $home = CORE::eval q{ (getpwuid($<))[7] };
2633 }
2634  
2635 # On Unix in general, a non-existant home means "no home"
2636 # For example, "nobody"-like users might use /nonexistant
2637 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
2638 0 $home = undef;
2639 }
2640 0 return $home;
2641 }
2642  
2643 #
2644 # ${^PREMATCH}, $PREMATCH, $` the string preceding what was matched
2645 #
2646 56 ▶sub Elatin4::PREMATCH {
Subroutine PREMATCH: called CC=1 SCAR=0.0
Pod undocumented
2647 56 return $`;
2648 }
2649  
2650 #
2651 # ${^MATCH}, $MATCH, $& the string that matched
2652 #
2653 81 ▶sub Elatin4::MATCH {
Subroutine MATCH: called CC=1 SCAR=0.0
Pod undocumented
2654 81 return $&;
2655 }
2656  
2657 #
2658 # ${^POSTMATCH}, $POSTMATCH, $' the string following what was matched
2659 #
2660 42 ▶sub Elatin4::POSTMATCH {
Subroutine POSTMATCH: called CC=1 SCAR=0.0
Pod undocumented
2661 42 return $';
2662 }
2663  
2664 #
2665 # Latin-4 character to order (with parameter)
2666 #
2667 0 ▶sub Latin4::ord(;$) {
Subroutine ord: not called CC=4 SCAR=30.0
2668  
2669 0 ▶ local $_ = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
2670  
2671 0 ▶ if (/\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\A ($Elatin4::q_char) /mosx) { } 0 0 0
2672 0 my @ord = unpack 'C*', $1;
2673 0 my $ord = 0;
2674 0 ▶ while (my $o = shift @ord) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $o = shift @ord) 0 0 0
2675 0 $ord = $ord * 0x100 + $o;
2676 }
2677 0 return $ord;
2678 }
2679 else {
2680 0 return CORE::ord $_;
2681 }
2682 }
2683  
2684 #
2685 # Latin-4 character to order (without parameter)
2686 #
2687 0 ▶sub Latin4::ord_() {
Subroutine ord_: not called CC=3 SCAR=24.8
2688  
2689 0 ▶ if (/\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\A ($Elatin4::q_char) /mosx) { } 0 0 0
2690 0 my @ord = unpack 'C*', $1;
2691 0 my $ord = 0;
2692 0 ▶ while (my $o = shift @ord) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $o = shift @ord) 0 0 0
2693 0 $ord = $ord * 0x100 + $o;
2694 }
2695 0 return $ord;
2696 }
2697 else {
2698 0 return CORE::ord $_;
2699 }
2700 }
2701  
2702 #
2703 # Latin-4 reverse
2704 #
2705 0 ▶sub Latin4::reverse(@) {
Subroutine reverse: not called CC=2 SCAR=17.9
2706  
2707 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2708 0 return CORE::reverse @_;
2709 }
2710 else {
2711  
2712 # One of us once cornered Larry in an elevator and asked him what
2713 # problem he was solving with this, but he looked as far off into
2714 # the distance as he could in an elevator and said, "It seemed like
2715 # a good idea at the time."
2716  
2717 0 return join '', CORE::reverse(join('',@_) =~ /\G ($q_char) /oxmsg);
2718 }
2719 }
2720  
2721 #
2722 # Latin-4 getc (with parameter, without parameter)
2723 #
2724 20 ▶sub Latin4::getc(;*@) {
Subroutine getc: called CC=9 SCAR=26.7
2725  
2726 20 my($package) = caller;
2727 20 ▶ my $fh = @_ ? qualify_to_ref(shift,$package) : \*STDIN;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 20 0 20
2728 20 ▶ croak 'Too many arguments for Latin4::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
2729  
2730 0 my @length = sort { $a <=> $b } keys %range_tr;
2731 20 my $getc = '';
2732 20 for my $length ($length[0] .. $length[-1]) {
2733 20 $getc .= CORE::getc($fh);
2734 20 ▶ if (exists $range_tr{CORE::length($getc)}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{length $getc}) 20 0 20
2735 20 ▶ if ($getc =~ /\A ${Elatin4::dot_s} \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($getc =~ /\A $Elatin4::dot_s \z/mosx) 20 0 20
2736 20 ▶ return wantarray ? ($getc,@_) : $getc;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 20 20
2737 }
2738 }
2739 }
2740 0 ▶ return wantarray ? ($getc,@_) : $getc;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
2741 }
2742  
2743 #
2744 # Latin-4 length by character
2745 #
2746 0 ▶sub Latin4::length(;$) {
Subroutine length: not called CC=2 SCAR=17.9
2747  
2748 0 ▶ local $_ = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
2749  
2750 0 local @_ = /\G ($q_char) /oxmsg;
2751 0 return scalar @_;
2752 }
2753  
2754 #
2755 # Latin-4 substr by character
2756 #
2757 424 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=7.0
2758  
2759 # P.232 The lvalue Attribute
2760 # in Chapter 6: Subroutines
2761 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2762  
2763 # P.336 The lvalue Attribute
2764 # in Chapter 7: Subroutines
2765 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2766  
2767 # P.144 8.4 Lvalue subroutines
2768 # in Chapter 8: perlsub: Perl subroutines
2769 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
2770  
2771 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
2772 # vv----------------------*******
2773 sub Latin4::substr($$;$$) %s {
2774  
2775 my @char = $_[0] =~ /\G (?>$q_char) /oxmsg;
2776  
2777 # If the substring is beyond either end of the string, substr() returns the undefined
2778 # value and produces a warning. When used as an lvalue, specifying a substring that
2779 # is entirely outside the string raises an exception.
2780 # http://perldoc.perl.org/functions/substr.html
2781  
2782 # A return with no argument returns the scalar value undef in scalar context,
2783 # an empty list () in list context, and (naturally) nothing at all in void
2784 # context.
2785  
2786 my $offset = $_[1];
2787 if (($offset > scalar(@char)) or ($offset < (-1 * scalar(@char)))) {
2788 return;
2789 }
2790  
2791 # substr($string,$offset,$length,$replacement)
2792 if (@_ == 4) {
2793 my(undef,undef,$length,$replacement) = @_;
2794 my $substr = join '', splice(@char, $offset, $length, $replacement);
2795 $_[0] = join '', @char;
2796  
2797 # return $substr; this doesn't work, don't say "return"
2798 $substr;
2799 }
2800  
2801 # substr($string,$offset,$length)
2802 elsif (@_ == 3) {
2803 my(undef,undef,$length) = @_;
2804 my $octet_offset = 0;
2805 my $octet_length = 0;
2806 if ($offset == 0) {
2807 $octet_offset = 0;
2808 }
2809 elsif ($offset > 0) {
2810 local $SIG{__WARN__} = sub {}; # avoid: Use of uninitialized value in join or string at here
2811 $octet_offset = CORE::length(join '', @char[0..$offset-1]);
2812 }
2813 else {
2814 local $SIG{__WARN__} = sub {}; # avoid: Use of uninitialized value in join or string at here
2815 $octet_offset = -1 * CORE::length(join '', @char[$#char+$offset+1..$#char]);
2816 }
2817 if ($length == 0) {
2818 $octet_length = 0;
2819 }
2820 elsif ($length > 0) {
2821 local $SIG{__WARN__} = sub {}; # avoid: Use of uninitialized value in join or string at here
2822 $octet_length = CORE::length(join '', @char[$offset..$offset+$length-1]);
2823 }
2824 else {
2825 local $SIG{__WARN__} = sub {}; # avoid: Use of uninitialized value in join or string at here
2826 $octet_length = -1 * CORE::length(join '', @char[$#char+$length+1..$#char]);
2827 }
2828 CORE::substr($_[0], $octet_offset, $octet_length);
2829 }
2830  
2831 # substr($string,$offset)
2832 else {
2833 my $octet_offset = 0;
2834 if ($offset == 0) {
2835 $octet_offset = 0;
2836 }
2837 elsif ($offset > 0) {
2838 $octet_offset = CORE::length(join '', @char[0..$offset-1]);
2839 }
2840 else {
2841 $octet_offset = -1 * CORE::length(join '', @char[$#char+$offset+1..$#char]);
2842 }
2843 CORE::substr($_[0], $octet_offset);
2844 }
2845 }
2846 END
2847 }
2848  
2849 #
2850 # Latin-4 index by character
2851 #
2852 0 ▶sub Latin4::index($$;$) {
Subroutine index: not called CC=3 SCAR=24.8
2853  
2854 0 my $index;
2855 0 ▶ if (@_ == 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 3) { } 0 0 0
2856 0 $index = Elatin4::index($_[0], $_[1], CORE::length(Latin4::substr($_[0], 0, $_[2])));
2857 }
2858 else {
2859 0 $index = Elatin4::index($_[0], $_[1]);
2860 }
2861  
2862 0 ▶ if ($index == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($index == -1) { } 0 0 0
2863 0 return -1;
2864 }
2865 else {
2866 0 return Latin4::length(CORE::substr $_[0], 0, $index);
2867 }
2868 }
2869  
2870 #
2871 # Latin-4 rindex by character
2872 #
2873 0 ▶sub Latin4::rindex($$;$) {
Subroutine rindex: not called CC=3 SCAR=24.8
2874  
2875 0 my $rindex;
2876 0 ▶ if (@_ == 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 3) { } 0 0 0
2877 0 $rindex = Elatin4::rindex($_[0], $_[1], CORE::length(Latin4::substr($_[0], 0, $_[2])));
2878 }
2879 else {
2880 0 $rindex = Elatin4::rindex($_[0], $_[1]);
2881 }
2882  
2883 0 ▶ if ($rindex == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rindex == -1) { } 0 0 0
2884 0 return -1;
2885 }
2886 else {
2887 0 return Latin4::length(CORE::substr $_[0], 0, $rindex);
2888 }
2889 }
2890  
2891 # when 'm//', '/' means regexp match 'm//' and '?' means regexp match '??'
2892 # when 'div', '/' means division operator and '?' means conditional operator (condition ? then : else)
2893 424 ▶use vars qw($slash); $slash = 'm//';
Subroutine BEGIN: called CC=1 SCAR=0.0
2894  
2895 # ord() to ord() or Latin4::ord()
2896 424 my $function_ord = 'ord';
2897  
2898 # ord to ord or Latin4::ord_
2899 424 my $function_ord_ = 'ord';
2900  
2901 # reverse to reverse or Latin4::reverse
2902 424 my $function_reverse = 'reverse';
2903  
2904 # getc to getc or Latin4::getc
2905 424 my $function_getc = 'getc';
2906  
2907 # P.1023 Appendix W.9 Multibyte Anchoring
2908 # of ISBN 1-56592-224-7 CJKV Information Processing
2909  
2910 424 my $anchor = '';
2911  
2912 424 ▶use vars qw($nest);
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
2913  
2914 # regexp of nested parens in qqXX
2915  
2916 # P.340 Matching Nested Constructs with Embedded Code
2917 # in Chapter 7: Perl
2918 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
2919  
2920 my $qq_paren = qr{(?{local $nest=0}) (?>(?:
2921 [^\\()] |
2922 \( (?{$nest++}) |
2923 \) (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2924 \\ [^c] |
2925 \\c[\x40-\x5F] |
2926 [\x00-\xFF]
2927 424 }xms;
2928  
2929 my $qq_brace = qr{(?{local $nest=0}) (?>(?:
2930 [^\\{}] |
2931 \{ (?{$nest++}) |
2932 \} (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2933 \\ [^c] |
2934 \\c[\x40-\x5F] |
2935 [\x00-\xFF]
2936 424 }xms;
2937  
2938 my $qq_bracket = qr{(?{local $nest=0}) (?>(?:
2939 [^\\\[\]] |
2940 \[ (?{$nest++}) |
2941 \] (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2942 \\ [^c] |
2943 \\c[\x40-\x5F] |
2944 [\x00-\xFF]
2945 424 }xms;
2946  
2947 my $qq_angle = qr{(?{local $nest=0}) (?>(?:
2948 [^\\<>] |
2949 \< (?{$nest++}) |
2950 \> (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2951 \\ [^c] |
2952 \\c[\x40-\x5F] |
2953 [\x00-\xFF]
2954 424 }xms;
2955  
2956 424 my $qq_scalar = qr{(?: \{ (?:$qq_brace)*? \} |
2957 (?: ::)? (?:
2958 (?> [a-zA-Z_][a-zA-Z_0-9]* (?: ::[a-zA-Z_][a-zA-Z_0-9]*)* )
2959 (?>(?: \[ (?: \$\[ | \$\] | $qq_char )*? \] | \{ (?:$qq_brace)*? \} )*)
2960 (?>(?: (?: -> )? (?: [\$\@\%\&\*]\* | \$\#\* | [\@\%]? \[ (?: \$\[ | \$\] | $qq_char )*? \] | [\@\%\*]? \{ (?:$qq_brace)*? \} ) )*)
2961 ))
2962 }xms;
2963  
2964 424 my $qq_variable = qr{(?: \{ (?:$qq_brace)*? \} |
2965 (?: ::)? (?:
2966 (?>[0-9]+) |
2967 [^a-zA-Z_0-9\[\]] |
2968 ^[A-Z] |
2969 (?> [a-zA-Z_][a-zA-Z_0-9]* (?: ::[a-zA-Z_][a-zA-Z_0-9]*)* )
2970 (?>(?: \[ (?: \$\[ | \$\] | $qq_char )*? \] | \{ (?:$qq_brace)*? \} )*)
2971 (?>(?: (?: -> )? (?: [\$\@\%\&\*]\* | \$\#\* | [\@\%]? \[ (?: \$\[ | \$\] | $qq_char )*? \] | [\@\%\*]? \{ (?:$qq_brace)*? \} ) )*)
2972 ))
2973 }xms;
2974  
2975 424 my $qq_substr = qr{(?> Char::substr | Latin4::substr | CORE::substr | substr ) (?>\s*) \( $qq_paren \)
2976 }xms;
2977  
2978 # regexp of nested parens in qXX
2979 my $q_paren = qr{(?{local $nest=0}) (?>(?:
2980 [^()] |
2981 \( (?{$nest++}) |
2982 \) (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2983 [\x00-\xFF]
2984 424 }xms;
2985  
2986 my $q_brace = qr{(?{local $nest=0}) (?>(?:
2987 [^\{\}] |
2988 \{ (?{$nest++}) |
2989 \} (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2990 [\x00-\xFF]
2991 424 }xms;
2992  
2993 my $q_bracket = qr{(?{local $nest=0}) (?>(?:
2994 [^\[\]] |
2995 \[ (?{$nest++}) |
2996 \] (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2997 [\x00-\xFF]
2998 424 }xms;
2999  
3000 my $q_angle = qr{(?{local $nest=0}) (?>(?:
3001 [^<>] |
3002 \< (?{$nest++}) |
3003 \> (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
3004 [\x00-\xFF]
3005 424 }xms;
3006  
3007 424 my $matched = '';
3008 424 my $s_matched = '';
3009  
3010 424 my $tr_variable = ''; # variable of tr///
3011 424 my $sub_variable = ''; # variable of s///
3012 424 my $bind_operator = ''; # =~ or !~
3013  
3014 424 my @heredoc = (); # here document
3015 424 my @heredoc_delimiter = ();
3016 424 my $here_script = ''; # here script
3017  
3018 #
3019 # escape Latin-4 script
3020 #
3021 548 ▶sub Latin4::escape(;$) {
Subroutine escape: called CC=3 SCAR=11.0
3022 548 ▶ local($_) = $_[0] if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 292 256 548
3023  
3024 # P.359 The Study Function
3025 # in Chapter 7: Perl
3026 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3027  
3028 548 study $_; # Yes, I studied study yesterday.
3029  
3030 # while all script
3031  
3032 # 6.14. Matching from Where the Last Pattern Left Off
3033 # in Chapter 6. Pattern Matching
3034 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
3035 # (and so on)
3036  
3037 # one member of Tag-team
3038 #
3039 # P.128 Start of match (or end of previous match): \G
3040 # P.130 Advanced Use of \G with Perl
3041 # in Chapter 3: Overview of Regular Expression Features and Flavors
3042 # P.255 Use leading anchors
3043 # P.256 Expose ^ and \G at the front expressions
3044 # in Chapter 6: Crafting an Efficient Expression
3045 # P.315 "Tag-team" matching with /gc
3046 # in Chapter 7: Perl
3047 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3048  
3049 548 my $e_script = '';
3050 548 ▶ while (not /\G \z/oxgc) { # member
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 86614 548 87162
3051 86614 $e_script .= Latin4::escape_token();
3052 }
3053  
3054 548 return $e_script;
3055 }
3056  
3057 #
3058 # escape Latin-4 token of script
3059 #
3060 86614 ▶sub Latin4::escape_token {
Subroutine escape_token: called CC=504 SCAR=109.3
3061  
3062 # \n output here document
3063  
3064 86614 my $ignore_modules = join('|', qw(
3065 utf8
3066 bytes
3067 charnames
3068 I18N::Japanese
3069 I18N::Collate
3070 I18N::JExt
3071 File::DosGlob
3072 Wild
3073 Wildcard
3074 Japanese
3075 ));
3076  
3077 # another member of Tag-team
3078 #
3079 # P.315 "Tag-team" matching with /gc
3080 # in Chapter 7: Perl
3081 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3082  
3083 86614 ▶ if (/\G ( \n ) /oxgc) { # another member (and so on)
Branch: 139 branches
BranchTrueFalseTotal
if (/\G ( \n ) /cgox) { } 12829 73785 86614
elsif (/\G ((?>\s+)|\#.*) /cgox) { } 21387 52398 73785
elsif (/\G ( (?: if | elsif | unless | while | until | given | when ) (?>\s*) \( ) /cgox) { } 1644 50754 52398
elsif (/\G ( \( (?>\s*) (?: local \b | my \b | our \b | state \b )? (?>\s*) \$ $qq_scalar ) /cgox) { } 90 50664 50754
elsif (/\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /cgmosx) { } 4 50660 50664
elsif (/\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /cgmosx) { } 28 50632 50660
elsif (/\G ( \$' | \$\{'\} ) /cgmosx) { } 1 50631 50632
elsif (/\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /cgmosx) { } 3 50628 50631
elsif (/\G ( \$ $qq_scalar | $qq_substr ) /cgox) { } 1754 48874 50628
elsif (/\G ( [,;] ) /cgox) { } 5086 43788 48874
elsif (/\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /cgmosx) { } 0 43788 43788
elsif (/\G ( \$ 0 ) /cgmosx) { } 2 43786 43788
elsif (/\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /cgmosx) { } 0 43786 43786
elsif (/\G ( \$ \$ ) (?![\w\{]) /cgmosx) { } 1 43785 43786
elsif (/\G \$ ((?>[1-9][0-9]*)) /cgmosx) { } 4 43781 43785
elsif (/\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /cgmosx) { } 0 43781 43781
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /cgmosx) { } 0 43781 43781
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /cgmosx) { } 0 43781 43781
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /cgmosx) { } 0 43781 43781
elsif (/\G \$ (?>\s*) \{ ( (?>\s*) (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* ) (?>\s*) ) \} /cgmosx) { } 0 43781 43781
elsif (/\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /cgmosx) { } 0 43781 43781
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 43739 43781
elsif (m{\G ( \$[\$\@\#\\\'\"/\?\(\)\[\]\<\>] ) }cgmosx) { } 63 43676 43739
elsif (/\G \b (while (?>\s*) \( (?>\s*) <[\$]?[A-Za-z_][A-Za-z_0-9]*> (?>\s*) \)) \b /cgox) { } 0 43676 43676
elsif (/\G \b while (?>\s*) \( (?>\s*) < ((?:[^>\0\a\e\f\n\r\t])+?) > (?>\s*) \) \b /cgox) { } 0 43676 43676
elsif (/\G \b while (?>\s*) \( (?>\s*) glob (?>\s*) \) /cgox) { } 0 43676 43676
elsif (/\G \b while (?>\s*) \( (?>\s*) glob \b /cgox) { } 0 43676 43676
elsif (/\G \b ( if | unless | while | until | for | when ) \b /cgox) { } 251 43425 43676
elsif (/\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /cgox) { } 19 43406 43425
elsif (/\G \b Char::eval (?= (?>\s*) \{ ) /cgox) { } 0 43406 43406
elsif (/\G \b Latin4::eval (?= (?>\s*) \{ ) /cgox) { } 22 43384 43406
elsif (/\G \b Char::eval \b (?! (?>\s*) => ) /cgox) { } 0 43384 43384
elsif (/\G \b Latin4::eval \b (?! (?>\s*) => ) /cgox) { } 168 43216 43384
elsif (/\G \b bytes::substr \b (?! (?>\s*) => ) /cgox) { } 2 43214 43216
elsif (/\G \b chop \b (?! (?>\s*) => ) /cgox) { } 0 43214 43214
elsif (/\G \b bytes::index \b (?! (?>\s*) => ) /cgox) { } 2 43212 43214
elsif (/\G \b Char::index \b (?! (?>\s*) => ) /cgox) { } 0 43212 43212
elsif (/\G \b Latin4::index \b (?! (?>\s*) => ) /cgox) { } 0 43212 43212
elsif (/\G \b index \b (?! (?>\s*) => ) /cgox) { } 0 43212 43212
elsif (/\G \b bytes::rindex \b (?! (?>\s*) => ) /cgox) { } 2 43210 43212
elsif (/\G \b Char::rindex \b (?! (?>\s*) => ) /cgox) { } 0 43210 43210
elsif (/\G \b Latin4::rindex \b (?! (?>\s*) => ) /cgox) { } 0 43210 43210
elsif (/\G \b rindex \b (?! (?>\s*) => ) /cgox) { } 0 43210 43210
elsif (/\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 1 43209 43210
elsif (/\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43209 43209
elsif (/\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 1 43208 43209
elsif (/\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43208 43208
elsif (/\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 6 43202 43208
elsif (/\G -s (?>\s*) (\") ((?:$Elatin4::qq_char)+?) (\") /cgox) { } 0 43202 43202
elsif (/\G -s (?>\s+) qq (?>\s*) (\#) ((?:$Elatin4::qq_char)+?) (\#) /cgox) { } 0 43202 43202
elsif (/\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /cgox) { } 0 43202 43202
elsif (/\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /cgox) { } 0 43202 43202
elsif (/\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /cgox) { } 0 43202 43202
elsif (/\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /cgox) { } 0 43202 43202
elsif (/\G -s (?>\s+) qq (?>\s*) (\S) ((?:$Elatin4::qq_char)+?) (\1) /cgox) { } 0 43202 43202
elsif (/\G -s (?>\s*) (\') ((?:\\\'|\\\\|$Elatin4::q_char)+?) (\') /cgox) { } 0 43202 43202
elsif (/\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$Elatin4::q_char)+?) (\#) /cgox) { } 0 43202 43202
elsif (/\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /cgox) { } 0 43202 43202
elsif (/\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /cgox) { } 0 43202 43202
elsif (/\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /cgox) { } 0 43202 43202
elsif (/\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /cgox) { } 0 43202 43202
elsif (/\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$Elatin4::q_char)+?) (\1) /cgox) { } 0 43202 43202
elsif (/\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)* ) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ) )*) /cgox) { } 0 43202 43202
elsif (/\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /cgox) { } 0 43202 43202
elsif (/\G -s (?= (?>\s+) [a-z]+) /cgox) { } 0 43202 43202
elsif (/\G -s (?>\s+) ((?>\w+)) /cgox) { } 0 43202 43202
elsif (/\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43200 43202
elsif (/\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43198 43200
elsif (/\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 36 43162 43198
elsif (/\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43160 43162
elsif (/\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 8 43152 43160
elsif (/\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43152 43152
elsif (/\G \b lc \b (?! (?>\s*) => ) /cgox) { } 0 43152 43152
elsif (/\G \b lcfirst \b (?! (?>\s*) => ) /cgox) { } 0 43152 43152
elsif (/\G \b uc \b (?! (?>\s*) => ) /cgox) { } 0 43152 43152
elsif (/\G \b ucfirst \b (?! (?>\s*) => ) /cgox) { } 0 43152 43152
elsif (/\G \b fc \b (?! (?>\s*) => ) /cgox) { } 0 43152 43152
elsif (/\G -s \b (?! (?>\s*) => ) /cgox) { } 0 43152 43152
elsif (/\G \b bytes::length \b (?! (?>\s*) => ) /cgox) { } 0 43152 43152
elsif (/\G \b bytes::chr \b (?! (?>\s*) => ) /cgox) { } 0 43152 43152
elsif (/\G \b chr \b (?! (?>\s*) => ) /cgox) { } 0 43152 43152
elsif (/\G \b bytes::ord \b (?! (?>\s*) => ) /cgox) { } 0 43152 43152
elsif (/\G \b ord \b (?! (?>\s*) => ) /cgox) { } 0 43152 43152
elsif (/\G \b glob \b (?! (?>\s*) => ) /cgox) { } 0 43152 43152
elsif (/\G \b reverse \b (?! (?>\s*) => ) /cgox) { } 0 43152 43152
elsif (/\G \b getc \b (?! (?>\s*) => ) /cgox) { } 8 43144 43152
elsif (/\G \b (split) \b (?! (?>\s*) => ) /cgox) { } 87 43057 43144
elsif (/\G \b ( tr | y ) \b /cgox) { } 4 43053 43057
elsif (/\G \b (qq) \b /cgox) { } 2252 40801 43053
elsif (/\G \b (qr) \b /cgox) { } 0 40801 40801
elsif (/\G \b (qw) \b /cgox) { } 16 40785 40801
elsif (/\G \b (qx) \b /cgox) { } 0 40785 40785
elsif (/\G \b (q) \b /cgox) { } 473 40312 40785
elsif (/\G \b (m) \b /cgox) { } 209 40103 40312
elsif (/\G \b (s) \b /cgox) { } 101 40002 40103
elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 0 40002 40002
elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 40002 40002
elsif (/\G \b require ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 40002 40002
elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [#\n]) /cgmosx) { } 37 39965 40002
elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 39965 39965
elsif (/\G \b use ((?>\s+) strict) \b /cgmosx) { } 0 39965 39965
elsif (/\G \b use (?>\s+) ((?>([1-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /cgmosx) { } 2 39963 39965
elsif (/\G \b use (?>\s+) ((?>v([0-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /cgmosx) { } 0 39963 39963
elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 2 39961 39963
elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 39961 39961
elsif (/\G \b use ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 39961 39961
elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 0 39961 39961
elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 39961 39961
elsif (/\G \b no ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 39961 39961
elsif (/\G \b use \b /cgmosx) { } 0 39961 39961
elsif (/\G \b no \b /cgmosx) { } 2 39959 39961
elsif (/\G (?<![\w\$\@\%\&\*]) (\') /cgox) { } 1142 38817 39959
elsif (/\G (\") /cgox) { } 1919 36898 38817
elsif (/\G (\`) /cgox) { } 1 36897 36898
elsif ($Elatin4::slash eq 'm//' and m[\G (/) ]cgox) { } 681 36216 36897
elsif ($Elatin4::slash eq 'm//' and /\G (\?) /cgox) { } 0 36216 36216
elsif (/\G ( <<>> ) /cgox) { } 0 36216 36216
elsif (/\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /cgox) { } 0 36216 36216
elsif (/\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /cgox) { } 6 36210 36216
elsif (/\G ( <<~ \\([a-zA-Z_0-9]+) ) /cgox) { } 3 36207 36210
elsif (/\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /cgox) { } 6 36201 36207
elsif (/\G ( <<~ ([a-zA-Z_0-9]+) ) /cgox) { } 3 36198 36201
elsif (/\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /cgox) { } 6 36192 36198
elsif (/\G ( << '([a-zA-Z_0-9]*)' ) /cgox) { } 72 36120 36192
elsif (/\G ( << \\([a-zA-Z_0-9]+) ) /cgox) { } 0 36120 36120
elsif (/\G ( << "([a-zA-Z_0-9]*)" ) /cgox) { } 36 36084 36120
elsif (/\G ( << ([a-zA-Z_0-9]+) ) /cgox) { } 42 36042 36084
elsif (/\G ( << `([a-zA-Z_0-9]*)` ) /cgox) { } 0 36042 36042
elsif (/\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/cgox) { } 12 36030 36042
elsif (/\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /cgox) { } 0 36030 36030
elsif (/\G < ((?:[^>\0\a\e\f\n\r\t])+?) > /cgox) { } 0 36030 36030
elsif (/\G ^ ( __DATA__ \n .*) \z /cgmosx) { } 0 36030 36030
elsif (/\G ^ ( __END__ \n .*) \z /cgmosx) { } 210 35820 36030
elsif (/\G ( \cD .*) \z /cgmosx) { } 0 35820 35820
elsif (/\G ( \cZ .*) \z /cgmosx) { } 0 35820 35820
elsif (/\G ( -- | \+\+ | [\)\}\]] ) /cgox) { } 5839 29981 35820
elsif (/\G ( \.\.\. ) /cgox) { } 7 29974 29981
elsif (m"\G ((?> !~~ | !~ | != | ! | %= | % | &&= | && | &= | &\.= | &\. | & | -= | -> | - | :(?>\s*)= | : | <<>> | <<= | <=> | <= | < | == | => | =~ | = | >>= | >> | >= | > | \*\*= | \*\* | \*= | \* | \+= | \+ | \.\. | \.= | \. | //= | // | /= | / | \? | \\ | \^= | \^\.= | \^\. | \^ | \b x= | \|\|= | \|\| | \|= | \|\.= | \|\. | \| | ~~ | ~\. | ~ | \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b | \b(?: print )\b | [,;\(\{\[] )) "cgox) { } 9796 20178 29974
elsif (/\G ($Elatin4::q_char) /cgox) { } 20178 0 20178
3084 12829 my $heredoc = '';
3085 12829 ▶ if (scalar(@heredoc_delimiter) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @heredoc_delimiter >= 1) 174 12655 12829
3086 174 $slash = 'm//';
3087  
3088 174 $heredoc = join '', @heredoc;
3089 174 @heredoc = ();
3090  
3091 # skip here document
3092 174 for my $heredoc_delimiter (@heredoc_delimiter) {
3093 174 /\G .*? \n $heredoc_delimiter \n/xmsgc;
3094 }
3095 174 @heredoc_delimiter = ();
3096  
3097 174 $here_script = '';
3098 }
3099 12829 return "\n" . $heredoc;
3100 }
3101  
3102 # ignore space, comment
3103 21387 elsif (/\G ((?>\s+)|\#.*) /oxgc) { return $1; }
3104  
3105 # if (, elsif (, unless (, while (, until (, given (, and when (
3106  
3107 # given, when
3108  
3109 # P.225 The given Statement
3110 # in Chapter 15: Smart Matching and given-when
3111 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
3112  
3113 # P.133 The given Statement
3114 # in Chapter 4: Statements and Declarations
3115 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
3116  
3117 elsif (/\G ( (?: if | elsif | unless | while | until | given | when ) (?>\s*) \( ) /oxgc) {
3118 1644 $slash = 'm//';
3119 1644 return $1;
3120 }
3121  
3122 # scalar variable ($scalar = ...) =~ tr///;
3123 # scalar variable ($scalar = ...) =~ s///;
3124  
3125 # state
3126  
3127 # P.68 Persistent, Private Variables
3128 # in Chapter 4: Subroutines
3129 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
3130  
3131 # P.160 Persistent Lexically Scoped Variables: state
3132 # in Chapter 4: Statements and Declarations
3133 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
3134  
3135 # (and so on)
3136  
3137 elsif (/\G ( \( (?>\s*) (?: local \b | my \b | our \b | state \b )? (?>\s*) \$ $qq_scalar ) /oxgc) {
3138 90 my $e_string = e_string($1);
3139  
3140 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
3141 0 $tr_variable = $e_string . e_string($1);
3142 0 $bind_operator = $2;
3143 0 $slash = 'm//';
3144 0 return '';
3145 }
3146 elsif (/\G ( (?>\s*) = $qq_paren \) ) ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /oxgc) {
3147 0 $sub_variable = $e_string . e_string($1);
3148 0 $bind_operator = $2;
3149 0 $slash = 'm//';
3150 0 return '';
3151 }
3152 else {
3153 90 $slash = 'div';
3154 90 return $e_string;
3155 }
3156 }
3157  
3158 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin4::PREMATCH()
3159 elsif (/\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /oxmsgc) {
3160 4 $slash = 'div';
3161 4 return q{Elatin4::PREMATCH()};
3162 }
3163  
3164 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin4::MATCH()
3165 elsif (/\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /oxmsgc) {
3166 28 $slash = 'div';
3167 28 return q{Elatin4::MATCH()};
3168 }
3169  
3170 # $', ${'} --> $', ${'}
3171 elsif (/\G ( \$' | \$\{'\} ) /oxmsgc) {
3172 1 $slash = 'div';
3173 1 return $1;
3174 }
3175  
3176 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin4::POSTMATCH()
3177 elsif (/\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /oxmsgc) {
3178 3 $slash = 'div';
3179 3 return q{Elatin4::POSTMATCH()};
3180 }
3181  
3182 # scalar variable $scalar =~ tr///;
3183 # scalar variable $scalar =~ s///;
3184 # substr() =~ tr///;
3185 # substr() =~ s///;
3186 elsif (/\G ( \$ $qq_scalar | $qq_substr ) /oxgc) {
3187 1754 my $scalar = e_string($1);
3188  
3189 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
3190 2 $tr_variable = $scalar;
3191 2 $bind_operator = $1;
3192 2 $slash = 'm//';
3193 2 return '';
3194 }
3195 elsif (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /oxgc) {
3196 65 $sub_variable = $scalar;
3197 65 $bind_operator = $1;
3198 65 $slash = 'm//';
3199 65 return '';
3200 }
3201 else {
3202 1687 $slash = 'div';
3203 1687 return $scalar;
3204 }
3205 }
3206  
3207 # end of statement
3208 elsif (/\G ( [,;] ) /oxgc) {
3209 5086 $slash = 'm//';
3210  
3211 # clear tr/// variable
3212 5086 $tr_variable = '';
3213  
3214 # clear s/// variable
3215 5086 $sub_variable = '';
3216  
3217 5086 $bind_operator = '';
3218  
3219 5086 return $1;
3220 }
3221  
3222 # bareword
3223 elsif (/\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /oxmsgc) {
3224 0 return $1;
3225 }
3226  
3227 # $0 --> $0
3228 elsif (/\G ( \$ 0 ) /oxmsgc) {
3229 2 $slash = 'div';
3230 2 return $1;
3231 }
3232 elsif (/\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /oxmsgc) {
3233 0 $slash = 'div';
3234 0 return $1;
3235 }
3236  
3237 # $$ --> $$
3238 elsif (/\G ( \$ \$ ) (?![\w\{]) /oxmsgc) {
3239 1 $slash = 'div';
3240 1 return $1;
3241 }
3242  
3243 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
3244 # $1, $2, $3 --> $1, $2, $3 otherwise
3245 elsif (/\G \$ ((?>[1-9][0-9]*)) /oxmsgc) {
3246 4 $slash = 'div';
3247 4 return e_capture($1);
3248 }
3249 elsif (/\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /oxmsgc) {
3250 0 $slash = 'div';
3251 0 return e_capture($1);
3252 }
3253  
3254 # $$foo[ ... ] --> $ $foo->[ ... ]
3255 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /oxmsgc) {
3256 0 $slash = 'div';
3257 0 return e_capture($1.'->'.$2);
3258 }
3259  
3260 # $$foo{ ... } --> $ $foo->{ ... }
3261 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /oxmsgc) {
3262 0 $slash = 'div';
3263 0 return e_capture($1.'->'.$2);
3264 }
3265  
3266 # $$foo
3267 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /oxmsgc) {
3268 0 $slash = 'div';
3269 0 return e_capture($1);
3270 }
3271  
3272 # ${ foo }
3273 elsif (/\G \$ (?>\s*) \{ ( (?>\s*) (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* ) (?>\s*) ) \} /oxmsgc) {
3274 0 $slash = 'div';
3275 0 return '${' . $1 . '}';
3276 }
3277  
3278 # ${ ... }
3279 elsif (/\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /oxmsgc) {
3280 0 $slash = 'div';
3281 0 return e_capture($1);
3282 }
3283  
3284 # variable or function
3285 # $ @ % & * $ #
3286 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) {
3287 42 $slash = 'div';
3288 42 return $1;
3289 }
3290 # $ $ $ $ $ $ $ $ $ $ $ $ $ $
3291 # $ @ # \ ' " / ? ( ) [ ] < >
3292 elsif (/\G ( \$[\$\@\#\\\'\"\/\?\(\)\[\]\<\>] ) /oxmsgc) {
3293 63 $slash = 'div';
3294 63 return $1;
3295 }
3296  
3297 # while (<FILEHANDLE>)
3298 elsif (/\G \b (while (?>\s*) \( (?>\s*) <[\$]?[A-Za-z_][A-Za-z_0-9]*> (?>\s*) \)) \b /oxgc) {
3299 0 return $1;
3300 }
3301  
3302 # while (<WILDCARD>) --- glob
3303  
3304 # avoid "Error: Runtime exception" of perl version 5.005_03
3305  
3306 elsif (/\G \b while (?>\s*) \( (?>\s*) < ((?:[^>\0\a\e\f\n\r\t])+?) > (?>\s*) \) \b /oxgc) {
3307 0 return 'while ($_ = Elatin4::glob("' . $1 . '"))';
3308 }
3309  
3310 # while (glob)
3311 elsif (/\G \b while (?>\s*) \( (?>\s*) glob (?>\s*) \) /oxgc) {
3312 0 return 'while ($_ = Elatin4::glob_)';
3313 }
3314  
3315 # while (glob(WILDCARD))
3316 elsif (/\G \b while (?>\s*) \( (?>\s*) glob \b /oxgc) {
3317 0 return 'while ($_ = Elatin4::glob';
3318 }
3319  
3320 # doit if, doit unless, doit while, doit until, doit for, doit when
3321 251 elsif (/\G \b ( if | unless | while | until | for | when ) \b /oxgc) { $slash = 'm//'; return $1; }
3322  
3323 # subroutines of package Elatin4
3324 19 elsif (/\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /oxgc) { $slash = 'm//'; return $1; }
3325 0 elsif (/\G \b Char::eval (?= (?>\s*) \{ ) /oxgc) { $slash = 'm//'; return 'eval'; }
3326 22 elsif (/\G \b Latin4::eval (?= (?>\s*) \{ ) /oxgc) { $slash = 'm//'; return 'eval'; }
3327 0 elsif (/\G \b Char::eval \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'eval Char::escape'; }
3328 168 elsif (/\G \b Latin4::eval \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'eval Latin4::escape'; }
3329 2 elsif (/\G \b bytes::substr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'substr'; }
3330 0 elsif (/\G \b chop \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin4::chop'; }
3331 2 elsif (/\G \b bytes::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'index'; }
3332 0 elsif (/\G \b Char::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Char::index'; }
3333 0 elsif (/\G \b Latin4::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Latin4::index'; }
3334 0 elsif (/\G \b index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin4::index'; }
3335 2 elsif (/\G \b bytes::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'rindex'; }
3336 0 elsif (/\G \b Char::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Char::rindex'; }
3337 0 elsif (/\G \b Latin4::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Latin4::rindex'; }
3338 0 elsif (/\G \b rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin4::rindex'; }
3339 1 elsif (/\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin4::lc'; }
3340 0 elsif (/\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin4::lcfirst'; }
3341 1 elsif (/\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin4::uc'; }
3342 0 elsif (/\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin4::ucfirst'; }
3343 6 elsif (/\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin4::fc'; }
3344  
3345 # "-s '' ..." means file test "-s 'filename' ..." (not means "- s/// ...")
3346 0 elsif (/\G -s (?>\s*) (\") ((?:$qq_char)+?) (\") /oxgc) { $slash = 'm//'; return '-s ' . e_qq('', $1,$3,$2); }
3347 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\#) ((?:$qq_char)+?) (\#) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3348 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3349 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3350 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3351 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3352 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\S) ((?:$qq_char)+?) (\1) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3353  
3354 0 elsif (/\G -s (?>\s*) (\') ((?:\\\'|\\\\|$q_char)+?) (\') /oxgc) { $slash = 'm//'; return '-s ' . e_q ('', $1,$3,$2); }
3355 0 elsif (/\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$q_char)+?) (\#) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3356 0 elsif (/\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3357 0 elsif (/\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3358 0 elsif (/\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3359 0 elsif (/\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3360 0 elsif (/\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$q_char)+?) (\1) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3361  
3362 elsif (/\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)* ) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ) )*) /oxgc)
3363 0 { $slash = 'm//'; return "-s $1"; }
3364 0 elsif (/\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /oxgc) { $slash = 'm//'; return "-s ($1)"; }
3365 0 elsif (/\G -s (?= (?>\s+) [a-z]+) /oxgc) { $slash = 'm//'; return '-s'; }
3366 0 elsif (/\G -s (?>\s+) ((?>\w+)) /oxgc) { $slash = 'm//'; return "-s $1"; }
3367  
3368 2 elsif (/\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'length'; }
3369 2 elsif (/\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'chr'; }
3370 36 elsif (/\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin4::chr'; }
3371 2 elsif (/\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'div'; return 'ord'; }
3372 8 elsif (/\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'div'; return $function_ord; }
3373 0 elsif (/\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin4::glob'; }
3374 0 elsif (/\G \b lc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin4::lc_'; }
3375 0 elsif (/\G \b lcfirst \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin4::lcfirst_'; }
3376 0 elsif (/\G \b uc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin4::uc_'; }
3377 0 elsif (/\G \b ucfirst \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin4::ucfirst_'; }
3378 0 elsif (/\G \b fc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin4::fc_'; }
3379 0 elsif (/\G -s \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return '-s '; }
3380  
3381 0 elsif (/\G \b bytes::length \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'length'; }
3382 0 elsif (/\G \b bytes::chr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'chr'; }
3383 0 elsif (/\G \b chr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin4::chr_'; }
3384 0 elsif (/\G \b bytes::ord \b (?! (?>\s*) => ) /oxgc) { $slash = 'div'; return 'ord'; }
3385 0 elsif (/\G \b ord \b (?! (?>\s*) => ) /oxgc) { $slash = 'div'; return $function_ord_; }
3386 0 elsif (/\G \b glob \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin4::glob_'; }
3387 0 elsif (/\G \b reverse \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return $function_reverse; }
3388 8 elsif (/\G \b getc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return $function_getc; }
3389 # split
3390 elsif (/\G \b (split) \b (?! (?>\s*) => ) /oxgc) {
3391 87 $slash = 'm//';
3392  
3393 87 my $e = '';
3394 87 ▶ while (/\G ( (?>\s+) | \( | \#.* ) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\G ( (?>\s+) | \( | \#.* ) /cgox) 85 87 172
3395 85 $e .= $1;
3396 }
3397  
3398 # end of split
3399 87 ▶ if (/\G (?= [,;\)\}\]] ) /oxgc) { return 'Elatin4::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
3400  
3401 # split scalar value
3402 1 elsif (/\G ( [\$\@\&\*] $qq_scalar ) /oxgc) { return 'Elatin4::split' . $e . e_string($1); }
3403  
3404 # split literal space
3405 0 elsif (/\G \b qq (\#) [ ] (\#) /oxgc) { return 'Elatin4::split' . $e . qq {qq$1 $2}; }
3406 0 elsif (/\G \b qq ((?>\s*)) (\() [ ] (\)) /oxgc) { return 'Elatin4::split' . $e . qq{$1qq$2 $3}; }
3407 0 elsif (/\G \b qq ((?>\s*)) (\{) [ ] (\}) /oxgc) { return 'Elatin4::split' . $e . qq{$1qq$2 $3}; }
3408 0 elsif (/\G \b qq ((?>\s*)) (\[) [ ] (\]) /oxgc) { return 'Elatin4::split' . $e . qq{$1qq$2 $3}; }
3409 0 elsif (/\G \b qq ((?>\s*)) (\<) [ ] (\>) /oxgc) { return 'Elatin4::split' . $e . qq{$1qq$2 $3}; }
3410 0 elsif (/\G \b qq ((?>\s*)) (\S) [ ] (\2) /oxgc) { return 'Elatin4::split' . $e . qq{$1qq$2 $3}; }
3411 0 elsif (/\G \b q (\#) [ ] (\#) /oxgc) { return 'Elatin4::split' . $e . qq {q$1 $2}; }
3412 0 elsif (/\G \b q ((?>\s*)) (\() [ ] (\)) /oxgc) { return 'Elatin4::split' . $e . qq {$1q$2 $3}; }
3413 0 elsif (/\G \b q ((?>\s*)) (\{) [ ] (\}) /oxgc) { return 'Elatin4::split' . $e . qq {$1q$2 $3}; }
3414 0 elsif (/\G \b q ((?>\s*)) (\[) [ ] (\]) /oxgc) { return 'Elatin4::split' . $e . qq {$1q$2 $3}; }
3415 0 elsif (/\G \b q ((?>\s*)) (\<) [ ] (\>) /oxgc) { return 'Elatin4::split' . $e . qq {$1q$2 $3}; }
3416 0 elsif (/\G \b q ((?>\s*)) (\S) [ ] (\2) /oxgc) { return 'Elatin4::split' . $e . qq {$1q$2 $3}; }
3417 10 elsif (/\G ' [ ] ' /oxgc) { return 'Elatin4::split' . $e . qq {' '}; }
3418 0 elsif (/\G " [ ] " /oxgc) { return 'Elatin4::split' . $e . qq {" "}; }
3419  
3420 # split qq//
3421 elsif (/\G \b (qq) \b /oxgc) {
3422 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin4::qq_char)*?) (\#) /cgox) { } 0 0 0
3423 else {
3424 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3425 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 ([*\-:?\\^|]) ((?:$Elatin4::qq_char)*?) (\1) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin4::qq_char)*?) (\1) /cgox) { } 0 0 0
3426 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq ( ) --> qr ( )
3427 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq { } --> qr { }
3428 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq [ ] --> qr [ ]
3429 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq < > --> qr < >
3430 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) /oxgc) { return e_split($e.'qr','{','}',$2,''); } # qq | | --> qr { }
3431 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq * * --> qr * *
3432 }
3433 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3434 }
3435 }
3436  
3437 # split qr//
3438 elsif (/\G \b (qr) \b /oxgc) {
3439 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1,$3,$2,$4); } # qr# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin4::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 12 12
3440 else {
3441 12 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 12 0 12
3442 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 (\') ((?:$Elatin4::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 12 12
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin4::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 12 12
elsif (/\G (\S) ((?:$Elatin4::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 12 0 12
3443 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr ( )
3444 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr { }
3445 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr [ ]
3446 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr < >
3447 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { return e_split_q($e.'qr',$1, $3, $2,$4); } # qr ' '
3448 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr','{','}',$2,$4); } # qr | | --> qr { }
3449 12 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr * *
3450 }
3451 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3452 }
3453 }
3454  
3455 # split q//
3456 elsif (/\G \b (q) \b /oxgc) {
3457 0 ▶ if (/\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:\\\#|\\\\|$Elatin4::q_char)*?) (\#) /cgox) { } 0 0 0
3458 else {
3459 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3460 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 ([*\-:?\\^|]) ((?:$Elatin4::q_char)*?) (\1) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:\\\\|\\\1| $Elatin4::q_char)*?) (\1) /cgox) { } 0 0 0
3461 0 elsif (/\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q ( ) --> qr ( )
3462 0 elsif (/\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q { } --> qr { }
3463 0 elsif (/\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q [ ] --> qr [ ]
3464 0 elsif (/\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q < > --> qr < >
3465 0 elsif (/\G ([*\-:?\\^|]) ((?:$q_char)*?) (\1) /oxgc) { return e_split_q($e.'qr','{','}',$2,''); } # q | | --> qr { }
3466 0 elsif (/\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q * * --> qr * *
3467 }
3468 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3469 }
3470 }
3471  
3472 # split m//
3473 elsif (/\G \b (m) \b /oxgc) {
3474 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1,$3,$2,$4); } # m# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin4::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
3475 else {
3476 18 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 18 0 18
3477 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 (\') ((?:$Elatin4::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin4::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
elsif (/\G (\S) ((?:$Elatin4::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 18 0 18
3478 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m ( ) --> qr ( )
3479 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m { } --> qr { }
3480 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m [ ] --> qr [ ]
3481 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m < > --> qr < >
3482 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { return e_split_q($e.'qr',$1, $3, $2,$4); } # m ' ' --> qr ' '
3483 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr','{','}',$2,$4); } # m | | --> qr { }
3484 18 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m * * --> qr * *
3485 }
3486 0 die __FILE__, ": Search pattern not terminated\n";
3487 }
3488 }
3489  
3490 # split ''
3491 elsif (/\G (\') /oxgc) {
3492 0 my $q_string = '';
3493 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3494 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 ($Elatin4::q_char) /cgox) { } 0 0 0
3495 0 elsif (/\G (\\\') /oxgc) { $q_string .= $1; } # splitqr'' --> split qr''
3496 0 elsif (/\G \' /oxgc) { return e_split_q($e.q{ qr},"'","'",$q_string,''); } # ' ' --> qr ' '
3497 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3498 }
3499 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3500 }
3501  
3502 # split ""
3503 elsif (/\G (\") /oxgc) {
3504 0 my $qq_string = '';
3505 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3506 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 ($Elatin4::q_char) /cgox) { } 0 0 0
3507 0 elsif (/\G (\\\") /oxgc) { $qq_string .= $1; } # splitqr"" --> split qr""
3508 0 elsif (/\G \" /oxgc) { return e_split($e.q{ qr},'"','"',$qq_string,''); } # " " --> qr " "
3509 0 elsif (/\G ($q_char) /oxgc) { $qq_string .= $1; }
3510 }
3511 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3512 }
3513  
3514 # split //
3515 elsif (/\G (\/) /oxgc) {
3516 44 my $regexp = '';
3517 44 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 381 0 381
3518 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 ($Elatin4::q_char) /cgox) { } 337 0 337
3519 0 elsif (/\G (\\\/) /oxgc) { $regexp .= $1; } # splitqr// --> split qr//
3520 44 elsif (/\G \/ ([cgimosxpadlunbB]*) /oxgc) { return e_split($e.q{ qr}, '/','/',$regexp,$1); } # / / --> qr / /
3521 337 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
3522 }
3523 0 die __FILE__, ": Search pattern not terminated\n";
3524 }
3525 }
3526  
3527 # tr/// or y///
3528  
3529 # about [cdsrbB]* (/B modifier)
3530 #
3531 # P.559 appendix C
3532 # of ISBN 4-89052-384-7 Programming perl
3533 # (Japanese title is: Perl puroguramingu)
3534  
3535 elsif (/\G \b ( tr | y ) \b /oxgc) {
3536 4 my $ope = $1;
3537  
3538 # $1 $2 $3 $4 $5 $6
3539 4 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ((?:$qq_char)*?) (\#) ([cdsrbB]*) /oxgc) { # tr# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin4::qq_char)*?) (\#) ((?:$Elatin4::qq_char)*?) (\#) ([cdsrbB]*) /cgox) { } 0 4 4
3540 0 my @tr = ($tr_variable,$2);
3541 0 return e_tr(@tr,'',$4,$6);
3542 }
3543 else {
3544 4 my $e = '';
3545 4 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 4 0 4
3546 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) ((?:$Elatin4::qq_char)*?) (\1) ((?:$Elatin4::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 4 0 4
3547 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) {
3548 0 my @tr = ($tr_variable,$2);
3549 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3550 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) ((?:$Elatin4::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3551 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) ( )
3552 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) { }
3553 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) [ ]
3554 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) < >
3555 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) * *
3556 }
3557 0 die __FILE__, ": Transliteration replacement not terminated\n";
3558 }
3559 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) {
3560 0 my @tr = ($tr_variable,$2);
3561 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3562 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) ((?:$Elatin4::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3563 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } ( )
3564 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } { }
3565 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } [ ]
3566 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } < >
3567 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } * *
3568 }
3569 0 die __FILE__, ": Transliteration replacement not terminated\n";
3570 }
3571 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) {
3572 0 my @tr = ($tr_variable,$2);
3573 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3574 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) ((?:$Elatin4::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3575 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] ( )
3576 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] { }
3577 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] [ ]
3578 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] < >
3579 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] * *
3580 }
3581 0 die __FILE__, ": Transliteration replacement not terminated\n";
3582 }
3583 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) {
3584 0 my @tr = ($tr_variable,$2);
3585 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3586 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) ((?:$Elatin4::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3587 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > ( )
3588 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > { }
3589 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > [ ]
3590 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > < >
3591 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > * *
3592 }
3593 0 die __FILE__, ": Transliteration replacement not terminated\n";
3594 }
3595 # $1 $2 $3 $4 $5 $6
3596 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { # tr * * *
3597 4 my @tr = ($tr_variable,$2);
3598 4 return e_tr(@tr,'',$4,$6);
3599 }
3600 }
3601 0 die __FILE__, ": Transliteration pattern not terminated\n";
3602 }
3603 }
3604  
3605 # qq//
3606 elsif (/\G \b (qq) \b /oxgc) {
3607 2252 my $ope = $1;
3608  
3609 # if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { return e_qq($ope,$1,$3,$2); } # qq# #
3610 2252 ▶ if (/\G (\#) /oxgc) { # qq# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) /cgox) { } 0 2252 2252
3611 0 my $qq_string = '';
3612 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3613 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 ($Elatin4::qq_char) /cgox) { } 0 0 0
3614 0 elsif (/\G (\\\#) /oxgc) { $qq_string .= $1; }
3615 0 elsif (/\G (\#) /oxgc) { return e_qq($ope,'#','#',$qq_string); }
3616 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3617 }
3618 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3619 }
3620  
3621 else {
3622 2252 my $e = '';
3623 2252 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 2252 0 2252
3624 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
3625  
3626 # elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq ( )
3627 elsif (/\G (\() /oxgc) { # qq ( )
3628 0 my $qq_string = '';
3629 0 local $nest = 1;
3630 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3631 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 ($Elatin4::qq_char) /cgox) { } 0 0 0
3632 0 elsif (/\G (\\\)) /oxgc) { $qq_string .= $1; }
3633 0 elsif (/\G (\() /oxgc) { $qq_string .= $1; $nest++; }
3634 elsif (/\G (\)) /oxgc) {
3635 0 ▶ if (--$nest == 0) { return $e . e_qq($ope,'(',')',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin4::nest == 0) { } 0 0 0
3636 0 else { $qq_string .= $1; }
3637 }
3638 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3639 }
3640 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3641 }
3642  
3643 # elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq { }
3644 elsif (/\G (\{) /oxgc) { # qq { }
3645 2222 my $qq_string = '';
3646 2222 local $nest = 1;
3647 2222 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 85104 0 85104
3648 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 ($Elatin4::qq_char) /cgox) { } 79782 0 79782
3649 0 elsif (/\G (\\\}) /oxgc) { $qq_string .= $1; }
3650 1189 elsif (/\G (\{) /oxgc) { $qq_string .= $1; $nest++; }
3651 elsif (/\G (\}) /oxgc) {
3652 3411 ▶ if (--$nest == 0) { return $e . e_qq($ope,'{','}',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin4::nest == 0) { } 2222 1189 3411
3653 1189 else { $qq_string .= $1; }
3654 }
3655 79782 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3656 }
3657 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3658 }
3659  
3660 # elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq [ ]
3661 elsif (/\G (\[) /oxgc) { # qq [ ]
3662 0 my $qq_string = '';
3663 0 local $nest = 1;
3664 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3665 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 ($Elatin4::qq_char) /cgox) { } 0 0 0
3666 0 elsif (/\G (\\\]) /oxgc) { $qq_string .= $1; }
3667 0 elsif (/\G (\[) /oxgc) { $qq_string .= $1; $nest++; }
3668 elsif (/\G (\]) /oxgc) {
3669 0 ▶ if (--$nest == 0) { return $e . e_qq($ope,'[',']',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin4::nest == 0) { } 0 0 0
3670 0 else { $qq_string .= $1; }
3671 }
3672 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3673 }
3674 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3675 }
3676  
3677 # elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq < >
3678 elsif (/\G (\<) /oxgc) { # qq < >
3679 30 my $qq_string = '';
3680 30 local $nest = 1;
3681 30 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 1166 0 1166
3682 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 ($Elatin4::qq_char) /cgox) { } 1114 0 1114
3683 0 elsif (/\G (\\\>) /oxgc) { $qq_string .= $1; }
3684 0 elsif (/\G (\<) /oxgc) { $qq_string .= $1; $nest++; }
3685 elsif (/\G (\>) /oxgc) {
3686 30 ▶ if (--$nest == 0) { return $e . e_qq($ope,'<','>',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin4::nest == 0) { } 30 0 30
3687 0 else { $qq_string .= $1; }
3688 }
3689 1114 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3690 }
3691 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3692 }
3693  
3694 # elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq * *
3695 elsif (/\G (\S) /oxgc) { # qq * *
3696 0 my $delimiter = $1;
3697 0 my $qq_string = '';
3698 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3699 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 ($Elatin4::qq_char) /cgox) { } 0 0 0
3700 0 elsif (/\G (\\\Q$delimiter\E) /oxgc) { $qq_string .= $1; }
3701 0 elsif (/\G (\Q$delimiter\E) /oxgc) { return $e . e_qq($ope,$delimiter,$delimiter,$qq_string); }
3702 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3703 }
3704 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3705 }
3706 }
3707 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3708 }
3709 }
3710  
3711 # qr//
3712 elsif (/\G \b (qr) \b /oxgc) {
3713 0 my $ope = $1;
3714 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { # qr# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin4::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 0 0
3715 0 return e_qr($ope,$1,$3,$2,$4);
3716 }
3717 else {
3718 0 my $e = '';
3719 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3720 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 (\') ((?:$Elatin4::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin4::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin4::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
3721 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr ( )
3722 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr { }
3723 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr [ ]
3724 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr < >
3725 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { return $e . e_qr_q($ope,$1, $3, $2,$4); } # qr ' '
3726 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,'{','}',$2,$4); } # qr | | --> qr { }
3727 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr * *
3728 }
3729 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3730 }
3731 }
3732  
3733 # qw//
3734 elsif (/\G \b (qw) \b /oxgc) {
3735 16 my $ope = $1;
3736 16 ▶ if (/\G (\#) (.*?) (\#) /oxmsgc) { # qw# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) (.*?) (\#) /cgmosx) { } 0 16 16
3737 0 return e_qw($ope,$1,$3,$2);
3738 }
3739 else {
3740 16 my $e = '';
3741 16 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 16 0 16
3742 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) ((?:$Elatin4::q_char)*?) (\1) /cgmosx) { } 0 0 0
3743  
3744 16 elsif (/\G (\() ([^(]*?) (\)) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw ( )
3745 0 elsif (/\G (\() ((?:$q_paren)*?) (\)) /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_brace)*?) (\}) /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_bracket)*?) (\]) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw [ ]
3752  
3753 0 elsif (/\G (\<) ([^<]*?) (\>) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw < >
3754 0 elsif (/\G (\<) ((?:$q_angle)*?) (\>) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw < >
3755  
3756 0 elsif (/\G ([\x21-\x3F]) (.*?) (\1) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw * *
3757 0 elsif (/\G (\S) ((?:$q_char)*?) (\1) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw * *
3758 }
3759 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3760 }
3761 }
3762  
3763 # qx//
3764 elsif (/\G \b (qx) \b /oxgc) {
3765 0 my $ope = $1;
3766 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qx# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin4::qq_char)*?) (\#) /cgox) { } 0 0 0
3767 0 return e_qq($ope,$1,$3,$2);
3768 }
3769 else {
3770 0 my $e = '';
3771 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3772 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 (\') ((?:$Elatin4::qq_char)*?) (\') /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin4::qq_char)*?) (\1) /cgox) { } 0 0 0
3773 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx ( )
3774 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx { }
3775 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx [ ]
3776 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx < >
3777 0 elsif (/\G (\') ((?:$qq_char)*?) (\') /oxgc) { return $e . e_q ($ope,$1,$3,$2); } # qx ' '
3778 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx * *
3779 }
3780 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3781 }
3782 }
3783  
3784 # q//
3785 elsif (/\G \b (q) \b /oxgc) {
3786 473 my $ope = $1;
3787  
3788 # if (/\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { return e_q($ope,$1,$3,$2); } # q# #
3789  
3790 # avoid "Error: Runtime exception" of perl version 5.005_03
3791 # (and so on)
3792  
3793 473 ▶ if (/\G (\#) /oxgc) { # q# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) /cgox) { } 0 473 473
3794 0 my $q_string = '';
3795 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3796 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 ($Elatin4::q_char) /cgox) { } 0 0 0
3797 0 elsif (/\G (\\\#) /oxgc) { $q_string .= $1; }
3798 0 elsif (/\G (\#) /oxgc) { return e_q($ope,'#','#',$q_string); }
3799 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3800 }
3801 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3802 }
3803  
3804 else {
3805 473 my $e = '';
3806 473 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 473 0 473
3807 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
3808  
3809 # elsif (/\G (\() ((?:\\\)|\\\\|$q_paren)*?) (\)) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q ( )
3810 elsif (/\G (\() /oxgc) { # q ( )
3811 0 my $q_string = '';
3812 0 local $nest = 1;
3813 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3814 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 ($Elatin4::q_char) /cgox) { } 0 0 0
3815 0 elsif (/\G (\\\)) /oxgc) { $q_string .= $1; }
3816 0 elsif (/\G (\\\() /oxgc) { $q_string .= $1; }
3817 0 elsif (/\G (\() /oxgc) { $q_string .= $1; $nest++; }
3818 elsif (/\G (\)) /oxgc) {
3819 0 ▶ if (--$nest == 0) { return $e . e_q($ope,'(',')',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin4::nest == 0) { } 0 0 0
3820 0 else { $q_string .= $1; }
3821 }
3822 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3823 }
3824 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3825 }
3826  
3827 # elsif (/\G (\{) ((?:\\\}|\\\\|$q_brace)*?) (\}) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q { }
3828 elsif (/\G (\{) /oxgc) { # q { }
3829 467 my $q_string = '';
3830 467 local $nest = 1;
3831 467 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 8249 0 8249
3832 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 ($Elatin4::q_char) /cgox) { } 7464 0 7464
3833 0 elsif (/\G (\\\}) /oxgc) { $q_string .= $1; }
3834 0 elsif (/\G (\\\{) /oxgc) { $q_string .= $1; }
3835 159 elsif (/\G (\{) /oxgc) { $q_string .= $1; $nest++; }
3836 elsif (/\G (\}) /oxgc) {
3837 626 ▶ if (--$nest == 0) { return $e . e_q($ope,'{','}',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin4::nest == 0) { } 467 159 626
3838 159 else { $q_string .= $1; }
3839 }
3840 7464 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3841 }
3842 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3843 }
3844  
3845 # elsif (/\G (\[) ((?:\\\]|\\\\|$q_bracket)*?) (\]) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q [ ]
3846 elsif (/\G (\[) /oxgc) { # q [ ]
3847 0 my $q_string = '';
3848 0 local $nest = 1;
3849 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3850 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 ($Elatin4::q_char) /cgox) { } 0 0 0
3851 0 elsif (/\G (\\\]) /oxgc) { $q_string .= $1; }
3852 0 elsif (/\G (\\\[) /oxgc) { $q_string .= $1; }
3853 0 elsif (/\G (\[) /oxgc) { $q_string .= $1; $nest++; }
3854 elsif (/\G (\]) /oxgc) {
3855 0 ▶ if (--$nest == 0) { return $e . e_q($ope,'[',']',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin4::nest == 0) { } 0 0 0
3856 0 else { $q_string .= $1; }
3857 }
3858 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3859 }
3860 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3861 }
3862  
3863 # elsif (/\G (\<) ((?:\\\>|\\\\|$q_angle)*?) (\>) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q < >
3864 elsif (/\G (\<) /oxgc) { # q < >
3865 5 my $q_string = '';
3866 5 local $nest = 1;
3867 5 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 88 0 88
3868 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 ($Elatin4::q_char) /cgox) { } 83 0 83
3869 0 elsif (/\G (\\\>) /oxgc) { $q_string .= $1; }
3870 0 elsif (/\G (\\\<) /oxgc) { $q_string .= $1; }
3871 0 elsif (/\G (\<) /oxgc) { $q_string .= $1; $nest++; }
3872 elsif (/\G (\>) /oxgc) {
3873 5 ▶ if (--$nest == 0) { return $e . e_q($ope,'<','>',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin4::nest == 0) { } 5 0 5
3874 0 else { $q_string .= $1; }
3875 }
3876 83 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3877 }
3878 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3879 }
3880  
3881 # elsif (/\G (\S) ((?:\\\1|\\\\|$q_char)*?) (\1) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q * *
3882 elsif (/\G (\S) /oxgc) { # q * *
3883 1 my $delimiter = $1;
3884 1 my $q_string = '';
3885 1 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 14 0 14
3886 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 ($Elatin4::q_char) /cgox) { } 13 0 13
3887 0 elsif (/\G (\\\Q$delimiter\E) /oxgc) { $q_string .= $1; }
3888 1 elsif (/\G (\Q$delimiter\E) /oxgc) { return $e . e_q($ope,$delimiter,$delimiter,$q_string); }
3889 13 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3890 }
3891 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3892 }
3893 }
3894 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3895 }
3896 }
3897  
3898 # m//
3899 elsif (/\G \b (m) \b /oxgc) {
3900 209 my $ope = $1;
3901 209 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { # m# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin4::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
3902 0 return e_qr($ope,$1,$3,$2,$4);
3903 }
3904 else {
3905 209 my $e = '';
3906 209 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 209 0 209
3907 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 (\?) ((?:$Elatin4::qq_char)*?) (\?) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
elsif (/\G (\') ((?:$Elatin4::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 10 199 209
elsif (/\G ([*\-:\\^|]) ((?:$Elatin4::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 199 199
elsif (/\G (\S) ((?:$Elatin4::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 199 0 199
3908 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m ( )
3909 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m { }
3910 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m [ ]
3911 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m < >
3912 0 elsif (/\G (\?) ((?:$qq_char)*?) (\?) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m ? ?
3913 10 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr_q($ope,$1, $3, $2,$4); } # m ' '
3914 0 elsif (/\G ([*\-:\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,'{','}',$2,$4); } # m | | --> m { }
3915 199 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m * *
3916 }
3917 0 die __FILE__, ": Search pattern not terminated\n";
3918 }
3919 }
3920  
3921 # s///
3922  
3923 # about [cegimosxpradlunbB]* (/cg modifier)
3924 #
3925 # P.67 Pattern-Matching Operators
3926 # of ISBN 0-596-00241-6 Perl in a Nutshell, Second Edition.
3927  
3928 elsif (/\G \b (s) \b /oxgc) {
3929 101 my $ope = $1;
3930  
3931 # $1 $2 $3 $4 $5 $6
3932 101 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ((?:$qq_char)*?) (\#) ([cegimosxpradlunbB]*) /oxgc) { # s# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin4::qq_char)*?) (\#) ((?:$Elatin4::qq_char)*?) (\#) ([cegimosxpradlunbB]*) /cgox) { } 1 100 101
3933 1 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3934 }
3935 else {
3936 100 my $e = '';
3937 100 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 100 0 100
3938 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 (\') ((?:$Elatin4::qq_char)*?) (\') ((?:$Elatin4::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 21 79 100
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin4::qq_char)*?) (\1) ((?:$Elatin4::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 79 79
elsif (/\G (\$) ((?:$Elatin4::qq_char)*?) (\1) ((?:$Elatin4::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 79 79
elsif (/\G (\S) ((?:$Elatin4::qq_char)*?) (\1) ((?:$Elatin4::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 79 0 79
3939 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) {
3940 0 my @s = ($1,$2,$3);
3941 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3942 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 (\') ((?:$Elatin4::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin4::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Elatin4::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Elatin4::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin4::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3943 # $1 $2 $3 $4
3944 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3945 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3946 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3947 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([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 (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3950 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3951 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3952 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3953 }
3954 0 die __FILE__, ": Substitution replacement not terminated\n";
3955 }
3956 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) {
3957 0 my @s = ($1,$2,$3);
3958 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3959 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 10 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\') ((?:$Elatin4::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin4::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Elatin4::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Elatin4::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin4::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3960 # $1 $2 $3 $4
3961 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3962 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3963 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3964 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3965 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3966 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3967 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3968 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3969 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3970 }
3971 0 die __FILE__, ": Substitution replacement not terminated\n";
3972 }
3973 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) {
3974 0 my @s = ($1,$2,$3);
3975 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3976 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 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 (\') ((?:$Elatin4::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin4::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin4::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3977 # $1 $2 $3 $4
3978 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3979 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3980 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3981 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3982 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3983 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3984 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3985 }
3986 0 die __FILE__, ": Substitution replacement not terminated\n";
3987 }
3988 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) {
3989 0 my @s = ($1,$2,$3);
3990 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3991 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 (\') ((?:$Elatin4::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin4::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Elatin4::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Elatin4::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin4::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3992 # $1 $2 $3 $4
3993 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3994 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3995 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3996 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([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 (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3999 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4000 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4001 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4002 }
4003 0 die __FILE__, ": Substitution replacement not terminated\n";
4004 }
4005 # $1 $2 $3 $4 $5 $6
4006 elsif (/\G (\') ((?:$qq_char)*?) (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) {
4007 21 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
4008 }
4009 # $1 $2 $3 $4 $5 $6
4010 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
4011 0 return e_sub($sub_variable,'{',$2,'}','{',$4,'}',$6); # s | | | --> s { } { }
4012 }
4013 # $1 $2 $3 $4 $5 $6
4014 elsif (/\G (\$) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
4015 0 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
4016 }
4017 # $1 $2 $3 $4 $5 $6
4018 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
4019 79 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
4020 }
4021 }
4022 0 die __FILE__, ": Substitution pattern not terminated\n";
4023 }
4024 }
4025  
4026 # require ignore module
4027 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# require$1$2"; }
4028 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# require$1\n$2"; }
4029 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# require$1"; }
4030  
4031 # use strict; --> use strict; no strict qw(refs);
4032 37 elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "use$1 no strict qw(refs);$2"; }
4033 0 elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [^#]) /oxmsgc) { return "use$1 no strict qw(refs);\n$2"; }
4034 0 elsif (/\G \b use ((?>\s+) strict) \b /oxmsgc) { return "use$1; no strict qw(refs)"; }
4035  
4036 # use 5.12.0; --> use 5.12.0; no strict qw(refs);
4037 elsif (/\G \b use (?>\s+) ((?>([1-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /oxmsgc) {
4038 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
4039 0 return "use $1; no strict qw(refs);";
4040 }
4041 else {
4042 2 return "use $1;";
4043 }
4044 }
4045 elsif (/\G \b use (?>\s+) ((?>v([0-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /oxmsgc) {
4046 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
4047 0 return "use $1; no strict qw(refs);";
4048 }
4049 else {
4050 0 return "use $1;";
4051 }
4052 }
4053  
4054 # ignore use module
4055 2 elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# use$1$2"; }
4056 0 elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# use$1\n$2"; }
4057 0 elsif (/\G \b use ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# use$1"; }
4058  
4059 # ignore no module
4060 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# no$1$2"; }
4061 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# no$1\n$2"; }
4062 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# no$1"; }
4063  
4064 # use else
4065 0 elsif (/\G \b use \b /oxmsgc) { return "use"; }
4066  
4067 # use else
4068 2 elsif (/\G \b no \b /oxmsgc) { return "no"; }
4069  
4070 # ''
4071 elsif (/\G (?<![\w\$\@\%\&\*]) (\') /oxgc) {
4072 1142 my $q_string = '';
4073 1142 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 10175 0 10175
4074 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 ($Elatin4::q_char) /cgox) { } 8981 0 8981
4075 48 elsif (/\G (\\\') /oxgc) { $q_string .= $1; }
4076 1142 elsif (/\G \' /oxgc) { return e_q('', "'","'",$q_string); }
4077 8981 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
4078 }
4079 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4080 }
4081  
4082 # ""
4083 elsif (/\G (\") /oxgc) {
4084 1919 my $qq_string = '';
4085 1919 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 37274 0 37274
4086 37274 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 67 37207 37274
elsif (/\G (\\\") /cgox) { } 12 37195 37207
elsif (/\G \" /cgox) { } 1919 35276 37195
elsif (/\G ($Elatin4::q_char) /cgox) { } 35276 0 35276
4087 12 elsif (/\G (\\\") /oxgc) { $qq_string .= $1; }
4088 1919 elsif (/\G \" /oxgc) { return e_qq('', '"','"',$qq_string); }
4089 35276 elsif (/\G ($q_char) /oxgc) { $qq_string .= $1; }
4090 }
4091 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4092 }
4093  
4094 # ``
4095 elsif (/\G (\`) /oxgc) {
4096 1 my $qx_string = '';
4097 1 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 19 0 19
4098 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 ($Elatin4::q_char) /cgox) { } 18 0 18
4099 0 elsif (/\G (\\\`) /oxgc) { $qx_string .= $1; }
4100 1 elsif (/\G \` /oxgc) { return e_qq('', '`','`',$qx_string); }
4101 18 elsif (/\G ($q_char) /oxgc) { $qx_string .= $1; }
4102 }
4103 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4104 }
4105  
4106 # // --- not divide operator (num / num), not defined-or
4107 ▶ elsif (($slash eq 'm//') and /\G (\/) /oxgc) {
Condition100%3/3
$Elatin4::slash eq "m//" and m[\G (/) ]cgox
!ll&&!rl&&r
273688848681
MC/DC100%2/2
$Elatin4::slash eq "m//" and m[\G (/) ]cgox
$Elatin4::slash eq "m//" m[\G (/) ]cgox
Truth table100%3/3
A and B
A= $Elatin4::slash eq "m//"B= m[\G (/) ]cgox
ABresult
0X0
100
111
4108 681 my $regexp = '';
4109 681 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 5636 0 5636
4110 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 ($Elatin4::q_char) /cgox) { } 4955 0 4955
4111 0 elsif (/\G (\\\/) /oxgc) { $regexp .= $1; }
4112 681 elsif (/\G \/ ([cgimosxpadlunbB]*) /oxgc) { return e_qr('', '/','/',$regexp,$1); }
4113 4955 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
4114 }
4115 0 die __FILE__, ": Search pattern not terminated\n";
4116 }
4117  
4118 # ?? --- not conditional operator (condition ? then : else)
4119 ▶ elsif (($slash eq 'm//') and /\G (\?) /oxgc) {
Condition66%2/3
$Elatin4::slash eq "m//" and /\G (\?) /cgox
!ll&&!rl&&r
2736888480
MC/DC0%0/2
$Elatin4::slash eq "m//" and /\G (\?) /cgox
$Elatin4::slash eq "m//" /\G (\?) /cgox
Truth table66%2/3
A and B
A= $Elatin4::slash eq "m//"B= /\G (\?) /cgox
ABresult
0X0
100
111
4120 0 my $regexp = '';
4121 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
4122 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 ($Elatin4::q_char) /cgox) { } 0 0 0
4123 0 elsif (/\G (\\\?) /oxgc) { $regexp .= $1; }
4124 0 elsif (/\G \? ([cgimosxpadlunbB]*) /oxgc) { return e_qr('m','?','?',$regexp,$1); }
4125 0 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
4126 }
4127 0 die __FILE__, ": Search pattern not terminated\n";
4128 }
4129  
4130 # <<>> (a safer ARGV)
4131 0 elsif (/\G ( <<>> ) /oxgc) { $slash = 'm//'; return $1; }
4132  
4133 # << (bit shift) --- not here document
4134 0 elsif (/\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /oxgc) { $slash = 'm//'; return $1; }
4135  
4136 # <<~'HEREDOC'
4137 elsif (/\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /oxgc) {
4138 6 $slash = 'm//';
4139 6 my $here_quote = $1;
4140 6 my $delimiter = $2;
4141  
4142 # get here document
4143 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4144 6 $here_script = CORE::substr $_, pos $_;
4145 6 $here_script =~ s/.*?\n//oxm;
4146 }
4147 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
4148 6 my $heredoc = $1;
4149 6 my $indent = $2;
4150 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4151 6 push @heredoc, $heredoc . qq{\n$delimiter\n};
4152 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4153 }
4154 else {
4155 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4156 }
4157 6 return qq{<<'$delimiter'};
4158 }
4159  
4160 # <<~\HEREDOC
4161  
4162 # P.66 2.6.6. "Here" Documents
4163 # in Chapter 2: Bits and Pieces
4164 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4165  
4166 # P.73 "Here" Documents
4167 # in Chapter 2: Bits and Pieces
4168 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4169  
4170 elsif (/\G ( <<~ \\([a-zA-Z_0-9]+) ) /oxgc) {
4171 3 $slash = 'm//';
4172 3 my $here_quote = $1;
4173 3 my $delimiter = $2;
4174  
4175 # get here document
4176 3 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 3 0 3
4177 3 $here_script = CORE::substr $_, pos $_;
4178 3 $here_script =~ s/.*?\n//oxm;
4179 }
4180 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
4181 3 my $heredoc = $1;
4182 3 my $indent = $2;
4183 3 $heredoc =~ s{^$indent}{}msg; # no /ox
4184 3 push @heredoc, $heredoc . qq{\n$delimiter\n};
4185 3 push @heredoc_delimiter, qq{\\s*$delimiter};
4186 }
4187 else {
4188 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4189 }
4190 3 return qq{<<\\$delimiter};
4191 }
4192  
4193 # <<~"HEREDOC"
4194 elsif (/\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /oxgc) {
4195 6 $slash = 'm//';
4196 6 my $here_quote = $1;
4197 6 my $delimiter = $2;
4198  
4199 # get here document
4200 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4201 6 $here_script = CORE::substr $_, pos $_;
4202 6 $here_script =~ s/.*?\n//oxm;
4203 }
4204 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
4205 6 my $heredoc = $1;
4206 6 my $indent = $2;
4207 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4208 6 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4209 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4210 }
4211 else {
4212 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4213 }
4214 6 return qq{<<"$delimiter"};
4215 }
4216  
4217 # <<~HEREDOC
4218 elsif (/\G ( <<~ ([a-zA-Z_0-9]+) ) /oxgc) {
4219 3 $slash = 'm//';
4220 3 my $here_quote = $1;
4221 3 my $delimiter = $2;
4222  
4223 # get here document
4224 3 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 3 0 3
4225 3 $here_script = CORE::substr $_, pos $_;
4226 3 $here_script =~ s/.*?\n//oxm;
4227 }
4228 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
4229 3 my $heredoc = $1;
4230 3 my $indent = $2;
4231 3 $heredoc =~ s{^$indent}{}msg; # no /ox
4232 3 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4233 3 push @heredoc_delimiter, qq{\\s*$delimiter};
4234 }
4235 else {
4236 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4237 }
4238 3 return qq{<<$delimiter};
4239 }
4240  
4241 # <<~`HEREDOC`
4242 elsif (/\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /oxgc) {
4243 6 $slash = 'm//';
4244 6 my $here_quote = $1;
4245 6 my $delimiter = $2;
4246  
4247 # get here document
4248 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4249 6 $here_script = CORE::substr $_, pos $_;
4250 6 $here_script =~ s/.*?\n//oxm;
4251 }
4252 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
4253 6 my $heredoc = $1;
4254 6 my $indent = $2;
4255 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4256 6 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4257 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4258 }
4259 else {
4260 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4261 }
4262 6 return qq{<<`$delimiter`};
4263 }
4264  
4265 # <<'HEREDOC'
4266 elsif (/\G ( << '([a-zA-Z_0-9]*)' ) /oxgc) {
4267 72 $slash = 'm//';
4268 72 my $here_quote = $1;
4269 72 my $delimiter = $2;
4270  
4271 # get here document
4272 72 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 72 0 72
4273 72 $here_script = CORE::substr $_, pos $_;
4274 72 $here_script =~ s/.*?\n//oxm;
4275 }
4276 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
4277 72 push @heredoc, $1 . qq{\n$delimiter\n};
4278 72 push @heredoc_delimiter, $delimiter;
4279 }
4280 else {
4281 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4282 }
4283 72 return $here_quote;
4284 }
4285  
4286 # <<\HEREDOC
4287  
4288 # P.66 2.6.6. "Here" Documents
4289 # in Chapter 2: Bits and Pieces
4290 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4291  
4292 # P.73 "Here" Documents
4293 # in Chapter 2: Bits and Pieces
4294 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4295  
4296 elsif (/\G ( << \\([a-zA-Z_0-9]+) ) /oxgc) {
4297 0 $slash = 'm//';
4298 0 my $here_quote = $1;
4299 0 my $delimiter = $2;
4300  
4301 # get here document
4302 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4303 0 $here_script = CORE::substr $_, pos $_;
4304 0 $here_script =~ s/.*?\n//oxm;
4305 }
4306 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
4307 0 push @heredoc, $1 . qq{\n$delimiter\n};
4308 0 push @heredoc_delimiter, $delimiter;
4309 }
4310 else {
4311 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4312 }
4313 0 return $here_quote;
4314 }
4315  
4316 # <<"HEREDOC"
4317 elsif (/\G ( << "([a-zA-Z_0-9]*)" ) /oxgc) {
4318 36 $slash = 'm//';
4319 36 my $here_quote = $1;
4320 36 my $delimiter = $2;
4321  
4322 # get here document
4323 36 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 36 0 36
4324 36 $here_script = CORE::substr $_, pos $_;
4325 36 $here_script =~ s/.*?\n//oxm;
4326 }
4327 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
4328 36 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4329 36 push @heredoc_delimiter, $delimiter;
4330 }
4331 else {
4332 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4333 }
4334 36 return $here_quote;
4335 }
4336  
4337 # <<HEREDOC
4338 elsif (/\G ( << ([a-zA-Z_0-9]+) ) /oxgc) {
4339 42 $slash = 'm//';
4340 42 my $here_quote = $1;
4341 42 my $delimiter = $2;
4342  
4343 # get here document
4344 42 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 42 0 42
4345 42 $here_script = CORE::substr $_, pos $_;
4346 42 $here_script =~ s/.*?\n//oxm;
4347 }
4348 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
4349 42 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4350 42 push @heredoc_delimiter, $delimiter;
4351 }
4352 else {
4353 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4354 }
4355 42 return $here_quote;
4356 }
4357  
4358 # <<`HEREDOC`
4359 elsif (/\G ( << `([a-zA-Z_0-9]*)` ) /oxgc) {
4360 0 $slash = 'm//';
4361 0 my $here_quote = $1;
4362 0 my $delimiter = $2;
4363  
4364 # get here document
4365 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4366 0 $here_script = CORE::substr $_, pos $_;
4367 0 $here_script =~ s/.*?\n//oxm;
4368 }
4369 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
4370 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4371 0 push @heredoc_delimiter, $delimiter;
4372 }
4373 else {
4374 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4375 }
4376 0 return $here_quote;
4377 }
4378  
4379 # <<= <=> <= < operator
4380 elsif (/\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/oxgc) {
4381 12 return $1;
4382 }
4383  
4384 # <FILEHANDLE>
4385 elsif (/\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /oxgc) {
4386 0 return $1;
4387 }
4388  
4389 # <WILDCARD> --- glob
4390  
4391 # avoid "Error: Runtime exception" of perl version 5.005_03
4392  
4393 elsif (/\G < ((?:[^>\0\a\e\f\n\r\t])+?) > /oxgc) {
4394 0 return 'Elatin4::glob("' . $1 . '")';
4395 }
4396  
4397 # __DATA__
4398 0 elsif (/\G ^ ( __DATA__ \n .*) \z /oxmsgc) { return $1; }
4399  
4400 # __END__
4401 210 elsif (/\G ^ ( __END__ \n .*) \z /oxmsgc) { return $1; }
4402  
4403 # \cD Control-D
4404  
4405 # P.68 2.6.8. Other Literal Tokens
4406 # in Chapter 2: Bits and Pieces
4407 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4408  
4409 # P.76 Other Literal Tokens
4410 # in Chapter 2: Bits and Pieces
4411 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4412  
4413 0 elsif (/\G ( \cD .*) \z /oxmsgc) { return $1; }
4414  
4415 # \cZ Control-Z
4416 0 elsif (/\G ( \cZ .*) \z /oxmsgc) { return $1; }
4417  
4418 # any operator before div
4419 elsif (/\G (
4420 -- | \+\+ |
4421 [\)\}\]]
4422  
4423 5839 ) /oxgc) { $slash = 'div'; return $1; }
4424  
4425 # yada-yada or triple-dot operator
4426 elsif (/\G (
4427 \.\.\.
4428  
4429 7 ) /oxgc) { $slash = 'm//'; return q{die('Unimplemented')}; }
4430  
4431 # any operator before m//
4432  
4433 # //, //= (defined-or)
4434  
4435 # P.164 Logical Operators
4436 # in Chapter 10: More Control Structures
4437 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
4438  
4439 # P.119 C-Style Logical (Short-Circuit) Operators
4440 # in Chapter 3: Unary and Binary Operators
4441 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4442  
4443 # (and so on)
4444  
4445 # ~~
4446  
4447 # P.221 The Smart Match Operator
4448 # in Chapter 15: Smart Matching and given-when
4449 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
4450  
4451 # P.112 Smartmatch Operator
4452 # in Chapter 3: Unary and Binary Operators
4453 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4454  
4455 # (and so on)
4456  
4457 elsif (/\G ((?>
4458  
4459 !~~ | !~ | != | ! |
4460 %= | % |
4461 &&= | && | &= | &\.= | &\. | & |
4462 -= | -> | - |
4463 :(?>\s*)= |
4464 : |
4465 <<>> |
4466 <<= | <=> | <= | < |
4467 == | => | =~ | = |
4468 >>= | >> | >= | > |
4469 \*\*= | \*\* | \*= | \* |
4470 \+= | \+ |
4471 \.\. | \.= | \. |
4472 \/\/= | \/\/ |
4473 \/= | \/ |
4474 \? |
4475 \\ |
4476 \^= | \^\.= | \^\. | \^ |
4477 \b x= |
4478 \|\|= | \|\| | \|= | \|\.= | \|\. | \| |
4479 ~~ | ~\. | ~ |
4480 \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b |
4481 \b(?: print )\b |
4482  
4483 [,;\(\{\[]
4484  
4485 9796 )) /oxgc) { $slash = 'm//'; return $1; }
4486  
4487 # other any character
4488 20178 elsif (/\G ($q_char) /oxgc) { $slash = 'div'; return $1; }
4489  
4490 # system error
4491 else {
4492 0 die __FILE__, ": Oops, this shouldn't happen!\n";
4493 }
4494 }
4495  
4496 # escape Latin-4 string
4497 1873 ▶sub e_string {
Subroutine e_string: called CC=54 SCAR=72.5
Pod documented
4498 1873 my($string) = @_;
4499 1873 my $e_string = '';
4500  
4501 1873 local $slash = 'm//';
4502  
4503 # P.1024 Appendix W.10 Multibyte Processing
4504 # of ISBN 1-56592-224-7 CJKV Information Processing
4505 # (and so on)
4506  
4507 1873 my @char = $string =~ / \G (?>[^\\]|\\$q_char|$q_char) /oxmsg;
4508  
4509 # without { ... }
4510 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
4511 1854 ▶ if ($string !~ /<</oxms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /<</mosx) 1854 0 1854
4512 1854 return $string;
4513 }
4514 }
4515  
4516 E_STRING_LOOP:
4517 19 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 223 19 242
4518 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\$\@\%\&\*]) (\') ((?:\\\'|\\\\|$Elatin4::q_char)*?) (\') /cgox) { } 0 213 213
elsif ($string =~ /\G (\") ((?:$Elatin4::qq_char)*?) (\") /cgox) { } 0 213 213
elsif ($string =~ /\G (\`) ((?:$Elatin4::qq_char)*?) (\`) /cgox) { } 0 213 213
elsif ($string =~ /\G ($Elatin4::q_char) /cgox) { } 213 0 213
4519 }
4520  
4521 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> @{[Elatin4::PREMATCH()]}
4522 elsif ($string =~ /\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /oxmsgc) {
4523 0 $e_string .= q{Elatin4::PREMATCH()};
4524 0 $slash = 'div';
4525 }
4526  
4527 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> @{[Elatin4::MATCH()]}
4528 elsif ($string =~ /\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /oxmsgc) {
4529 0 $e_string .= q{Elatin4::MATCH()};
4530 0 $slash = 'div';
4531 }
4532  
4533 # $', ${'} --> $', ${'}
4534 elsif ($string =~ /\G ( \$' | \$\{'\} ) /oxmsgc) {
4535 0 $e_string .= $1;
4536 0 $slash = 'div';
4537 }
4538  
4539 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> @{[Elatin4::POSTMATCH()]}
4540 elsif ($string =~ /\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /oxmsgc) {
4541 0 $e_string .= q{Elatin4::POSTMATCH()};
4542 0 $slash = 'div';
4543 }
4544  
4545 # bareword
4546 elsif ($string =~ /\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /oxmsgc) {
4547 0 $e_string .= $1;
4548 0 $slash = 'div';
4549 }
4550  
4551 # $0 --> $0
4552 elsif ($string =~ /\G ( \$ 0 ) /oxmsgc) {
4553 0 $e_string .= $1;
4554 0 $slash = 'div';
4555 }
4556 elsif ($string =~ /\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /oxmsgc) {
4557 0 $e_string .= $1;
4558 0 $slash = 'div';
4559 }
4560  
4561 # $$ --> $$
4562 elsif ($string =~ /\G ( \$ \$ ) (?![\w\{]) /oxmsgc) {
4563 0 $e_string .= $1;
4564 0 $slash = 'div';
4565 }
4566  
4567 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
4568 # $1, $2, $3 --> $1, $2, $3 otherwise
4569 elsif ($string =~ /\G \$ ((?>[1-9][0-9]*)) /oxmsgc) {
4570 0 $e_string .= e_capture($1);
4571 0 $slash = 'div';
4572 }
4573 elsif ($string =~ /\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /oxmsgc) {
4574 0 $e_string .= e_capture($1);
4575 0 $slash = 'div';
4576 }
4577  
4578 # $$foo[ ... ] --> $ $foo->[ ... ]
4579 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /oxmsgc) {
4580 0 $e_string .= e_capture($1.'->'.$2);
4581 0 $slash = 'div';
4582 }
4583  
4584 # $$foo{ ... } --> $ $foo->{ ... }
4585 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /oxmsgc) {
4586 0 $e_string .= e_capture($1.'->'.$2);
4587 0 $slash = 'div';
4588 }
4589  
4590 # $$foo
4591 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /oxmsgc) {
4592 0 $e_string .= e_capture($1);
4593 0 $slash = 'div';
4594 }
4595  
4596 # ${ foo }
4597 elsif ($string =~ /\G \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} /oxmsgc) {
4598 0 $e_string .= '${' . $1 . '}';
4599 0 $slash = 'div';
4600 }
4601  
4602 # ${ ... }
4603 elsif ($string =~ /\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /oxmsgc) {
4604 3 $e_string .= e_capture($1);
4605 3 $slash = 'div';
4606 }
4607  
4608 # variable or function
4609 # $ @ % & * $ #
4610 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) {
4611 7 $e_string .= $1;
4612 7 $slash = 'div';
4613 }
4614 # $ $ $ $ $ $ $ $ $ $ $ $ $ $
4615 # $ @ # \ ' " / ? ( ) [ ] < >
4616 elsif ($string =~ /\G ( \$[\$\@\#\\\'\"\/\?\(\)\[\]\<\>] ) /oxmsgc) {
4617 0 $e_string .= $1;
4618 0 $slash = 'div';
4619 }
4620  
4621 # qq//
4622 elsif ($string =~ /\G \b (qq) \b /oxgc) {
4623 0 my $ope = $1;
4624 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qq# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Elatin4::qq_char)*?) (\#) /cgox) { } 0 0 0
4625 0 $e_string .= e_qq($ope,$1,$3,$2);
4626 }
4627 else {
4628 0 my $e = '';
4629 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4630 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) ((?:$Elatin4::qq_char)*?) (\1) /cgox) { } 0 0 0
4631 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq ( )
4632 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq { }
4633 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq [ ]
4634 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq < >
4635 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq * *
4636 }
4637 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4638 }
4639 }
4640  
4641 # qx//
4642 elsif ($string =~ /\G \b (qx) \b /oxgc) {
4643 0 my $ope = $1;
4644 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qx# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Elatin4::qq_char)*?) (\#) /cgox) { } 0 0 0
4645 0 $e_string .= e_qq($ope,$1,$3,$2);
4646 }
4647 else {
4648 0 my $e = '';
4649 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4650 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 (\') ((?:$Elatin4::qq_char)*?) (\') /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Elatin4::qq_char)*?) (\1) /cgox) { } 0 0 0
4651 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx ( )
4652 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx { }
4653 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx [ ]
4654 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx < >
4655 0 elsif ($string =~ /\G (\') ((?:$qq_char)*?) (\') /oxgc) { $e_string .= $e . e_q ($ope,$1,$3,$2); next E_STRING_LOOP; } # qx ' '
4656 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx * *
4657 }
4658 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4659 }
4660 }
4661  
4662 # q//
4663 elsif ($string =~ /\G \b (q) \b /oxgc) {
4664 0 my $ope = $1;
4665 0 ▶ if ($string =~ /\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { # q# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:\\\#|\\\\|$Elatin4::q_char)*?) (\#) /cgox) { } 0 0 0
4666 0 $e_string .= e_q($ope,$1,$3,$2);
4667 }
4668 else {
4669 0 my $e = '';
4670 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4671 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| $Elatin4::q_char)*?) (\1) /cgox) { } 0 0 0
4672 0 elsif ($string =~ /\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q ( )
4673 0 elsif ($string =~ /\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q { }
4674 0 elsif ($string =~ /\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q [ ]
4675 0 elsif ($string =~ /\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q < >
4676 0 elsif ($string =~ /\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q * *
4677 }
4678 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4679 }
4680 }
4681  
4682 # ''
4683 0 elsif ($string =~ /\G (?<![\w\$\@\%\&\*]) (\') ((?:\\\'|\\\\|$q_char)*?) (\') /oxgc) { $e_string .= e_q('',$1,$3,$2); }
4684  
4685 # ""
4686 0 elsif ($string =~ /\G (\") ((?:$qq_char)*?) (\") /oxgc) { $e_string .= e_qq('',$1,$3,$2); }
4687  
4688 # ``
4689 0 elsif ($string =~ /\G (\`) ((?:$qq_char)*?) (\`) /oxgc) { $e_string .= e_qq('',$1,$3,$2); }
4690  
4691 # other any character
4692 213 elsif ($string =~ /\G ($q_char) /oxgc) { $e_string .= $1; }
4693  
4694 # system error
4695 else {
4696 0 die __FILE__, ": Oops, this shouldn't happen!\n";
4697 }
4698 }
4699  
4700 19 return $e_string;
4701 }
4702  
4703 #
4704 # character class
4705 #
4706 1920 ▶sub character_class {
Subroutine character_class: called CC=3 SCAR=11.0
Pod undocumented
4707 1920 my($char,$modifier) = @_;
4708  
4709 1920 ▶ if ($char eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char eq '.') { } 52 1868 1920
4710 52 ▶ if ($modifier =~ /s/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/) { } 17 35 52
4711 17 return '${Elatin4::dot_s}';
4712 }
4713 else {
4714 35 return '${Elatin4::dot}';
4715 }
4716 }
4717 else {
4718 1868 return Elatin4::classic_character_class($char);
4719 }
4720 }
4721  
4722 #
4723 # escape capture ($1, $2, $3, ...)
4724 #
4725 212 ▶sub e_capture {
Subroutine e_capture: called CC=1 SCAR=0.0
Pod undocumented
4726  
4727 212 return join '', '${', $_[0], '}';
4728 }
4729  
4730 #
4731 # escape transliteration (tr/// or y///)
4732 #
4733 4 ▶sub e_tr {
Subroutine e_tr: called CC=5 SCAR=16.8
Pod undocumented
4734 4 my($variable,$charclass,$e,$charclass2,$modifier) = @_;
4735 4 my $e_tr = '';
4736 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
4737  
4738 4 $slash = 'div';
4739  
4740 # quote character class 1
4741 4 $charclass = q_tr($charclass);
4742  
4743 # quote character class 2
4744 4 $charclass2 = q_tr($charclass2);
4745  
4746 # /b /B modifier
4747 4 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) { } 0 4 4
4748 0 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq '') { } 0 0 0
4749 0 $e_tr = qq{tr$charclass$e$charclass2$modifier};
4750 }
4751 else {
4752 0 $e_tr = qq{$variable${bind_operator}tr$charclass$e$charclass2$modifier};
4753 }
4754 }
4755 else {
4756 4 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq '') { } 2 2 4
4757 2 $e_tr = qq{Elatin4::tr(\$_,' =~ ',$charclass,$e$charclass2,'$modifier')};
4758 }
4759 else {
4760 2 $e_tr = qq{Elatin4::tr($variable,'$bind_operator',$charclass,$e$charclass2,'$modifier')};
4761 }
4762 }
4763  
4764 # clear tr/// variable
4765 4 $tr_variable = '';
4766 4 $bind_operator = '';
4767  
4768 4 return $e_tr;
4769 }
4770  
4771 #
4772 # quote for escape transliteration (tr/// or y///)
4773 #
4774 8 ▶sub q_tr {
Subroutine q_tr: called CC=9 SCAR=40.6
Pod undocumented
4775 8 my($charclass) = @_;
4776  
4777 # quote character class
4778 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
4779 8 return e_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 elsif ($charclass !~ /[\{\}]/oxms) {
4794 0 return e_q('q', '{', '}', $charclass); # --> q{ }
4795 }
4796 else {
4797 0 for my $char (qw( ! " $ % & * + . : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
4798 0 ▶ if ($charclass !~ /\Q$char\E/xms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($charclass =~ /\Q$char\E/msx) 0 0 0
4799 0 return e_q('q', $char, $char, $charclass);
4800 }
4801 }
4802 }
4803  
4804 0 return e_q('q', '{', '}', $charclass);
4805 }
4806  
4807 #
4808 # escape q string (q//, '')
4809 #
4810 1623 ▶sub e_q {
Subroutine e_q: called CC=1 SCAR=0.0
Pod undocumented
4811 1623 my($ope,$delimiter,$end_delimiter,$string) = @_;
4812  
4813 1623 $slash = 'div';
4814  
4815 1623 return join '', $ope, $delimiter, $string, $end_delimiter;
4816 }
4817  
4818 #
4819 # escape qq string (qq//, "", qx//, ``)
4820 #
4821 4257 ▶sub e_qq {
Subroutine e_qq: called CC=37 SCAR=50.9
Pod undocumented
4822 4257 my($ope,$delimiter,$end_delimiter,$string) = @_;
4823  
4824 4257 $slash = 'div';
4825  
4826 4257 my $left_e = 0;
4827 4257 my $right_e = 0;
4828  
4829 # split regexp
4830 4257 my @char = $string =~ /\G((?>
4831 [^\\\$] |
4832 \\x\{ (?>[0-9A-Fa-f]+) \} |
4833 \\o\{ (?>[0-7]+) \} |
4834 \\N\{ (?>[^0-9\}][^\}]*) \} |
4835 \\ $q_char |
4836 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
4837 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
4838 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
4839 \$ (?>\s* [0-9]+) |
4840 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
4841 \$ \$ (?![\w\{]) |
4842 \$ (?>\s*) \$ (?>\s*) $qq_variable |
4843 $q_char
4844 ))/oxmsg;
4845  
4846 4257 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 116785 4257 121042
4847  
4848 # "\L\u" --> "\u\L"
4849 116785 ▶ 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 116785 116785
elsif ($char[$i] eq '\\U' and $char[$i + 1] eq '\\l') { } 0 116785 116785
elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/mosx) { } 1 116784 116785
elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/mosx) { } 1 116783 116784
elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/mosx) { } 0 116783 116783
Condition33%1/3
$char[$i] eq "\\L" and $char[$i + 1] eq "\\u"
!ll&&!rl&&r
11678500
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
4850 0 @char[$i,$i+1] = @char[$i+1,$i];
4851 }
4852  
4853 # "\U\l" --> "\l\U"
4854 ▶ 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
11678500
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
4855 0 @char[$i,$i+1] = @char[$i+1,$i];
4856 }
4857  
4858 # octal escape sequence
4859 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
4860 1 $char[$i] = Elatin4::octchr($1);
4861 }
4862  
4863 # hexadecimal escape sequence
4864 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
4865 1 $char[$i] = Elatin4::hexchr($1);
4866 }
4867  
4868 # \N{CHARNAME} --> N{CHARNAME}
4869 elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
4870 0 $char[$i] = $1;
4871 }
4872  
4873 116785 ▶ if (0) {
Branch: 23 branches
BranchTrueFalseTotal
if (do { $char[$i] =~ /\A ([<>]) \z/mosx }) { } 484 116301 116785
elsif ($char[$i] eq '\\u') { } 0 116301 116301
elsif ($char[$i] eq '\\l') { } 0 116301 116301
elsif ($char[$i] eq '\\U') { } 0 116301 116301
elsif ($char[$i] eq '\\L') { } 0 116301 116301
elsif ($char[$i] eq '\\F') { } 24 116277 116301
elsif ($char[$i] eq '\\Q') { } 0 116277 116277
elsif ($char[$i] eq '\\E') { } 24 116253 116277
elsif ($char[$i] eq '\\Q') { } 0 116253 116253
elsif ($char[$i] eq '\\E') { } 0 116253 116253
elsif ($char[$i] =~ /\A \$ 0 \z/mosx) { } 4 116249 116253
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/mosx) { } 0 116249 116249
elsif ($char[$i] =~ /\A \$\$ \z/mosx) { } 0 116249 116249
elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/mosx) { } 205 116044 116249
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/mosx) { } 0 116044 116044
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/mosx) { } 0 116044 116044
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/mosx) { } 0 116044 116044
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/mosx) { } 0 116044 116044
elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/cgmosx) { } 44 116000 116044
elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/cgmosx) { } 45 115955 116000
elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/cgmosx) { } 33 115922 115955
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/mosx) { } 0 115922 115922
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/mosx) { } 0 115922 115922
4874 }
4875  
4876 # \F
4877 #
4878 # P.69 Table 2-6. Translation escapes
4879 # in Chapter 2: Bits and Pieces
4880 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4881 # (and so on)
4882  
4883 # \u \l \U \L \F \Q \E
4884 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
4885 484 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 484 484
4886 0 $char[$i] = '\\' . $char[$i];
4887 }
4888 }
4889 elsif ($char[$i] eq '\u') {
4890  
4891 # "STRING @{[ LIST EXPR ]} MORE STRING"
4892  
4893 # P.257 Other Tricks You Can Do with Hard References
4894 # in Chapter 8: References
4895 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4896  
4897 # P.353 Other Tricks You Can Do with Hard References
4898 # in Chapter 8: References
4899 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4900  
4901 # (and so on)
4902  
4903 0 $char[$i] = '@{[Elatin4::ucfirst qq<';
4904 0 $left_e++;
4905 }
4906 elsif ($char[$i] eq '\l') {
4907 0 $char[$i] = '@{[Elatin4::lcfirst qq<';
4908 0 $left_e++;
4909 }
4910 elsif ($char[$i] eq '\U') {
4911 0 $char[$i] = '@{[Elatin4::uc qq<';
4912 0 $left_e++;
4913 }
4914 elsif ($char[$i] eq '\L') {
4915 0 $char[$i] = '@{[Elatin4::lc qq<';
4916 0 $left_e++;
4917 }
4918 elsif ($char[$i] eq '\F') {
4919 24 $char[$i] = '@{[Elatin4::fc qq<';
4920 24 $left_e++;
4921 }
4922 elsif ($char[$i] eq '\Q') {
4923 0 $char[$i] = '@{[CORE::quotemeta qq<';
4924 0 $left_e++;
4925 }
4926 elsif ($char[$i] eq '\E') {
4927 24 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 24 0 24
4928 24 $char[$i] = '>]}';
4929 24 $right_e++;
4930 }
4931 else {
4932 0 $char[$i] = '';
4933 }
4934 }
4935 elsif ($char[$i] eq '\Q') {
4936 0 while (1) {
4937 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
4938 0 last;
4939 }
4940 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
4941 0 last;
4942 }
4943 }
4944 }
4945 elsif ($char[$i] eq '\E') {
4946 }
4947  
4948 # $0 --> $0
4949 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
4950 }
4951 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
4952 }
4953  
4954 # $$ --> $$
4955 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
4956 }
4957  
4958 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
4959 # $1, $2, $3 --> $1, $2, $3 otherwise
4960 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
4961 205 $char[$i] = e_capture($1);
4962 }
4963 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
4964 0 $char[$i] = e_capture($1);
4965 }
4966  
4967 # $$foo[ ... ] --> $ $foo->[ ... ]
4968 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
4969 0 $char[$i] = e_capture($1.'->'.$2);
4970 }
4971  
4972 # $$foo{ ... } --> $ $foo->{ ... }
4973 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
4974 0 $char[$i] = e_capture($1.'->'.$2);
4975 }
4976  
4977 # $$foo
4978 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
4979 0 $char[$i] = e_capture($1);
4980 }
4981  
4982 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin4::PREMATCH()
4983 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
4984 44 $char[$i] = '@{[Elatin4::PREMATCH()]}';
4985 }
4986  
4987 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin4::MATCH()
4988 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
4989 45 $char[$i] = '@{[Elatin4::MATCH()]}';
4990 }
4991  
4992 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin4::POSTMATCH()
4993 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
4994 33 $char[$i] = '@{[Elatin4::POSTMATCH()]}';
4995 }
4996  
4997 # ${ foo } --> ${ foo }
4998 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/oxms) {
4999 }
5000  
5001 # ${ ... }
5002 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5003 0 $char[$i] = e_capture($1);
5004 }
5005 }
5006  
5007 # return string
5008 4257 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 4257 4257
5009 0 return join '', $ope, $delimiter, @char, '>]}' x ($left_e - $right_e), $end_delimiter;
5010 }
5011 4257 return join '', $ope, $delimiter, @char, $end_delimiter;
5012 }
5013  
5014 #
5015 # escape qw string (qw//)
5016 #
5017 16 ▶sub e_qw {
Subroutine e_qw: called CC=11 SCAR=43.1
Pod undocumented
5018 16 my($ope,$delimiter,$end_delimiter,$string) = @_;
5019  
5020 16 $slash = 'div';
5021  
5022 # choice again delimiter
5023 16 my %octet = map {$_ => 1} ($string =~ /\G ([\x00-\xFF]) /oxmsg);
5024 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
5025 16 return join '', $ope, $delimiter, $string, $end_delimiter;
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 elsif (not $octet{'>'}) {
5037 0 return join '', $ope, '<', $string, '>';
5038 }
5039 else {
5040 0 for my $char (qw( ! " $ % & * + - . / : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5041 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5042 0 return join '', $ope, $char, $string, $char;
5043 }
5044 }
5045 }
5046  
5047 # qw/AAA BBB C'CC/ --> ('AAA', 'BBB', 'C\'CC')
5048 0 my @string = CORE::split(/\s+/, $string);
5049 0 for my $string (@string) {
5050 0 my @octet = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5051 0 for my $octet (@octet) {
5052 0 ▶ if ($octet =~ /\A (['\\]) \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($octet =~ /\A (['\\]) \z/mosx) 0 0 0
5053 0 $octet = '\\' . $1;
5054 }
5055 }
5056 0 $string = join '', @octet;
5057 }
5058 0 return join '', '(', (join ', ', map { "'$_'" } @string), ')';
5059 }
5060  
5061 #
5062 # escape here document (<<"HEREDOC", <<HEREDOC, <<`HEREDOC`, <<~"HEREDOC", <<~HEREDOC, <<~`HEREDOC`)
5063 #
5064 93 ▶sub e_heredoc {
Subroutine e_heredoc: called CC=37 SCAR=56.3
Pod undocumented
5065 93 my($string) = @_;
5066  
5067 93 $slash = 'm//';
5068  
5069 93 my $metachar = qr/[\@\\|]/oxms; # '|' is for <<`HEREDOC`
5070  
5071 93 my $left_e = 0;
5072 93 my $right_e = 0;
5073  
5074 # split regexp
5075 93 my @char = $string =~ /\G((?>
5076 [^\\\$] |
5077 \\x\{ (?>[0-9A-Fa-f]+) \} |
5078 \\o\{ (?>[0-7]+) \} |
5079 \\N\{ (?>[^0-9\}][^\}]*) \} |
5080 \\ $q_char |
5081 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5082 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5083 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5084 \$ (?>\s* [0-9]+) |
5085 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5086 \$ \$ (?![\w\{]) |
5087 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5088 $q_char
5089 ))/oxmsg;
5090  
5091 93 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 3177 93 3270
5092  
5093 # "\L\u" --> "\u\L"
5094 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
5095 0 @char[$i,$i+1] = @char[$i+1,$i];
5096 }
5097  
5098 # "\U\l" --> "\l\U"
5099 ▶ 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
5100 0 @char[$i,$i+1] = @char[$i+1,$i];
5101 }
5102  
5103 # octal escape sequence
5104 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5105 1 $char[$i] = Elatin4::octchr($1);
5106 }
5107  
5108 # hexadecimal escape sequence
5109 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5110 1 $char[$i] = Elatin4::hexchr($1);
5111 }
5112  
5113 # \N{CHARNAME} --> N{CHARNAME}
5114 elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5115 0 $char[$i] = $1;
5116 }
5117  
5118 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
5119 }
5120  
5121 # \u \l \U \L \F \Q \E
5122 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
5123 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
5124 0 $char[$i] = '\\' . $char[$i];
5125 }
5126 }
5127 elsif ($char[$i] eq '\u') {
5128 0 $char[$i] = '@{[Elatin4::ucfirst qq<';
5129 0 $left_e++;
5130 }
5131 elsif ($char[$i] eq '\l') {
5132 0 $char[$i] = '@{[Elatin4::lcfirst qq<';
5133 0 $left_e++;
5134 }
5135 elsif ($char[$i] eq '\U') {
5136 0 $char[$i] = '@{[Elatin4::uc qq<';
5137 0 $left_e++;
5138 }
5139 elsif ($char[$i] eq '\L') {
5140 0 $char[$i] = '@{[Elatin4::lc qq<';
5141 0 $left_e++;
5142 }
5143 elsif ($char[$i] eq '\F') {
5144 0 $char[$i] = '@{[Elatin4::fc qq<';
5145 0 $left_e++;
5146 }
5147 elsif ($char[$i] eq '\Q') {
5148 0 $char[$i] = '@{[CORE::quotemeta qq<';
5149 0 $left_e++;
5150 }
5151 elsif ($char[$i] eq '\E') {
5152 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
5153 0 $char[$i] = '>]}';
5154 0 $right_e++;
5155 }
5156 else {
5157 0 $char[$i] = '';
5158 }
5159 }
5160 elsif ($char[$i] eq '\Q') {
5161 0 while (1) {
5162 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5163 0 last;
5164 }
5165 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
5166 0 last;
5167 }
5168 }
5169 }
5170 elsif ($char[$i] eq '\E') {
5171 }
5172  
5173 # $0 --> $0
5174 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
5175 }
5176 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
5177 }
5178  
5179 # $$ --> $$
5180 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
5181 }
5182  
5183 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
5184 # $1, $2, $3 --> $1, $2, $3 otherwise
5185 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
5186 0 $char[$i] = e_capture($1);
5187 }
5188 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
5189 0 $char[$i] = e_capture($1);
5190 }
5191  
5192 # $$foo[ ... ] --> $ $foo->[ ... ]
5193 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
5194 0 $char[$i] = e_capture($1.'->'.$2);
5195 }
5196  
5197 # $$foo{ ... } --> $ $foo->{ ... }
5198 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
5199 0 $char[$i] = e_capture($1.'->'.$2);
5200 }
5201  
5202 # $$foo
5203 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
5204 0 $char[$i] = e_capture($1);
5205 }
5206  
5207 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin4::PREMATCH()
5208 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
5209 8 $char[$i] = '@{[Elatin4::PREMATCH()]}';
5210 }
5211  
5212 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin4::MATCH()
5213 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
5214 8 $char[$i] = '@{[Elatin4::MATCH()]}';
5215 }
5216  
5217 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin4::POSTMATCH()
5218 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
5219 6 $char[$i] = '@{[Elatin4::POSTMATCH()]}';
5220 }
5221  
5222 # ${ foo } --> ${ foo }
5223 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/oxms) {
5224 }
5225  
5226 # ${ ... }
5227 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5228 0 $char[$i] = e_capture($1);
5229 }
5230 }
5231  
5232 # return string
5233 93 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 93 93
5234 0 return join '', @char, '>]}' x ($left_e - $right_e);
5235 }
5236 93 return join '', @char;
5237 }
5238  
5239 #
5240 # escape regexp (m//, qr//)
5241 #
5242 880 ▶sub e_qr {
Subroutine e_qr: called CC=110 SCAR=73.6
Pod undocumented
5243 880 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5244 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
5245  
5246 880 $modifier =~ tr/p//d;
5247 880 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 880 880
5248 0 my $line = 0;
5249 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
5250 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
5251 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
5252 0 last;
5253 }
5254 }
5255 0 die qq{Unsupported modifier "$1" used at line $line.\n};
5256 }
5257  
5258 880 $slash = 'div';
5259  
5260 # literal null string pattern
5261 880 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 872 880
elsif ($modifier =~ tr/Bb//d) { } 2 870 872
5262 8 $modifier =~ tr/bB//d;
5263 8 $modifier =~ tr/i//d;
5264 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
5265 }
5266  
5267 # /b /B modifier
5268 elsif ($modifier =~ tr/bB//d) {
5269  
5270 # choice again delimiter
5271 2 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 2 2
5272 0 my @char = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5273 0 my %octet = map {$_ => 1} @char;
5274 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
5275 0 $delimiter = '(';
5276 0 $end_delimiter = ')';
5277 }
5278 elsif (not $octet{'}'}) {
5279 0 $delimiter = '{';
5280 0 $end_delimiter = '}';
5281 }
5282 elsif (not $octet{']'}) {
5283 0 $delimiter = '[';
5284 0 $end_delimiter = ']';
5285 }
5286 elsif (not $octet{'>'}) {
5287 0 $delimiter = '<';
5288 0 $end_delimiter = '>';
5289 }
5290 else {
5291 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5292 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5293 0 $delimiter = $char;
5294 0 $end_delimiter = $char;
5295 0 last;
5296 }
5297 }
5298 }
5299 }
5300  
5301 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
5302 0 return join '', $ope, $delimiter, $string, $matched, $end_delimiter, $modifier;
5303 }
5304 else {
5305 2 return join '', $ope, $delimiter, '(?:', $string, ')', $matched, $end_delimiter, $modifier;
5306 }
5307 }
5308  
5309 870 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 312 558 870
5310 870 my $metachar = qr/[\@\\|[\]{^]/oxms;
5311  
5312 # split regexp
5313 870 my @char = $string =~ /\G((?>
5314 [^\\\$\@\[\(] |
5315 \\x (?>[0-9A-Fa-f]{1,2}) |
5316 \\ (?>[0-7]{2,3}) |
5317 \\c [\x40-\x5F] |
5318 \\x\{ (?>[0-9A-Fa-f]+) \} |
5319 \\o\{ (?>[0-7]+) \} |
5320 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
5321 \\ $q_char |
5322 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5323 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5324 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5325 [\$\@] $qq_variable |
5326 \$ (?>\s* [0-9]+) |
5327 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5328 \$ \$ (?![\w\{]) |
5329 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5330 \[\^ |
5331 \[\: (?>[a-z]+) :\] |
5332 \[\:\^ (?>[a-z]+) :\] |
5333 \(\? |
5334 $q_char
5335 ))/oxmsg;
5336  
5337 # choice again delimiter
5338 870 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 870 870
5339 0 my %octet = map {$_ => 1} @char;
5340 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
5341 0 $delimiter = '(';
5342 0 $end_delimiter = ')';
5343 }
5344 elsif (not $octet{'}'}) {
5345 0 $delimiter = '{';
5346 0 $end_delimiter = '}';
5347 }
5348 elsif (not $octet{']'}) {
5349 0 $delimiter = '[';
5350 0 $end_delimiter = ']';
5351 }
5352 elsif (not $octet{'>'}) {
5353 0 $delimiter = '<';
5354 0 $end_delimiter = '>';
5355 }
5356 else {
5357 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5358 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5359 0 $delimiter = $char;
5360 0 $end_delimiter = $char;
5361 0 last;
5362 }
5363 }
5364 }
5365 }
5366  
5367 870 my $left_e = 0;
5368 870 my $right_e = 0;
5369 870 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 2100 870 2970
5370  
5371 # "\L\u" --> "\u\L"
5372 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
5373 0 @char[$i,$i+1] = @char[$i+1,$i];
5374 }
5375  
5376 # "\U\l" --> "\l\U"
5377 ▶ 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
5378 0 @char[$i,$i+1] = @char[$i+1,$i];
5379 }
5380  
5381 # octal escape sequence
5382 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5383 1 $char[$i] = Elatin4::octchr($1);
5384 }
5385  
5386 # hexadecimal escape sequence
5387 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5388 1 $char[$i] = Elatin4::hexchr($1);
5389 }
5390  
5391 # \b{...} --> b\{...}
5392 # \B{...} --> B\{...}
5393 # \N{CHARNAME} --> N\{CHARNAME}
5394 # \p{PROPERTY} --> p\{PROPERTY}
5395 # \P{PROPERTY} --> P\{PROPERTY}
5396 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5397 6 $char[$i] = $1 . '\\' . $2;
5398 }
5399  
5400 # \p, \P, \X --> p, P, X
5401 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
5402 4 $char[$i] = $1;
5403 }
5404  
5405 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 &Elatin4::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
5406 }
5407  
5408 # join separated multiple-octet
5409 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
5410 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 $Elatin4::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 $Elatin4::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 $Elatin4::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 $Elatin4::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 $Elatin4::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 $Elatin4::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 $Elatin4::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5411 0 $char[$i] .= join '', splice @char, $i+1, 3;
5412 }
5413 ▶ 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 $Elatin4::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 $Elatin4::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 $Elatin4::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 $Elatin4::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5414 0 $char[$i] .= join '', splice @char, $i+1, 2;
5415 }
5416 ▶ 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 $Elatin4::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 $Elatin4::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 $Elatin4::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 $Elatin4::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5417 0 $char[$i] .= join '', splice @char, $i+1, 1;
5418 }
5419 }
5420  
5421 # open character class [...]
5422 elsif ($char[$i] eq '[') {
5423 556 my $left = $i;
5424  
5425 # [] make die "Unmatched [] in regexp ...\n"
5426 # (and so on)
5427  
5428 556 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 3 553 556
5429 3 $i++;
5430 }
5431  
5432 556 while (1) {
5433 2063 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 2063 2063
5434 0 die __FILE__, ": Unmatched [] in regexp\n";
5435 }
5436 2063 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 556 1507 2063
5437 556 my $right = $i;
5438  
5439 # [...]
5440 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
5441 30 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin4::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
5442 }
5443 else {
5444 526 splice @char, $left, $right-$left+1, Elatin4::charlist_qr(@char[$left+1..$right-1], $modifier);
5445 }
5446  
5447 556 $i = $left;
5448 556 last;
5449 }
5450 }
5451 }
5452  
5453 # open character class [^...]
5454 elsif ($char[$i] eq '[^') {
5455 74 my $left = $i;
5456  
5457 # [^] make die "Unmatched [] in regexp ...\n"
5458 # (and so on)
5459  
5460 74 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 4 70 74
5461 4 $i++;
5462 }
5463  
5464 74 while (1) {
5465 272 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 272 272
5466 0 die __FILE__, ": Unmatched [] in regexp\n";
5467 }
5468 272 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 74 198 272
5469 74 my $right = $i;
5470  
5471 # [^...]
5472 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
5473 30 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin4::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
5474 }
5475 else {
5476 44 splice @char, $left, $right-$left+1, Elatin4::charlist_not_qr(@char[$left+1..$right-1], $modifier);
5477 }
5478  
5479 74 $i = $left;
5480 74 last;
5481 }
5482 }
5483 }
5484  
5485 # rewrite character class or escape character
5486 elsif (my $char = character_class($char[$i],$modifier)) {
5487 139 $char[$i] = $char;
5488 }
5489  
5490 # /i modifier
5491 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin4::uc($char[$i]) ne Elatin4::fc($char[$i]))) {
Condition100%6/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin4::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 &Elatin4::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin4::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= &Elatin4::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
5492 20 ▶ if (CORE::length(Elatin4::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 20 0 20
5493 20 $char[$i] = '[' . Elatin4::uc($char[$i]) . Elatin4::fc($char[$i]) . ']';
5494 }
5495 else {
5496 0 $char[$i] = '(?:' . Elatin4::uc($char[$i]) . '|' . Elatin4::fc($char[$i]) . ')';
5497 }
5498 }
5499  
5500 # \u \l \U \L \F \Q \E
5501 elsif ($char[$i] =~ /\A [<>] \z/oxms) {
5502 1 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 1 1
5503 0 $char[$i] = '\\' . $char[$i];
5504 }
5505 }
5506 elsif ($char[$i] eq '\u') {
5507 0 $char[$i] = '@{[Elatin4::ucfirst qq<';
5508 0 $left_e++;
5509 }
5510 elsif ($char[$i] eq '\l') {
5511 0 $char[$i] = '@{[Elatin4::lcfirst qq<';
5512 0 $left_e++;
5513 }
5514 elsif ($char[$i] eq '\U') {
5515 1 $char[$i] = '@{[Elatin4::uc qq<';
5516 1 $left_e++;
5517 }
5518 elsif ($char[$i] eq '\L') {
5519 1 $char[$i] = '@{[Elatin4::lc qq<';
5520 1 $left_e++;
5521 }
5522 elsif ($char[$i] eq '\F') {
5523 18 $char[$i] = '@{[Elatin4::fc qq<';
5524 18 $left_e++;
5525 }
5526 elsif ($char[$i] eq '\Q') {
5527 1 $char[$i] = '@{[CORE::quotemeta qq<';
5528 1 $left_e++;
5529 }
5530 elsif ($char[$i] eq '\E') {
5531 21 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 21 0 21
5532 21 $char[$i] = '>]}';
5533 21 $right_e++;
5534 }
5535 else {
5536 0 $char[$i] = '';
5537 }
5538 }
5539 elsif ($char[$i] eq '\Q') {
5540 0 while (1) {
5541 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5542 0 last;
5543 }
5544 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
5545 0 last;
5546 }
5547 }
5548 }
5549 elsif ($char[$i] eq '\E') {
5550 }
5551  
5552 # $0 --> $0
5553 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
5554 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5555 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
5556 }
5557 }
5558 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
5559 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5560 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
5561 }
5562 }
5563  
5564 # $$ --> $$
5565 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
5566 }
5567  
5568 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
5569 # $1, $2, $3 --> $1, $2, $3 otherwise
5570 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
5571 0 $char[$i] = e_capture($1);
5572 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5573 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
5574 }
5575 }
5576 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
5577 0 $char[$i] = e_capture($1);
5578 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5579 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
5580 }
5581 }
5582  
5583 # $$foo[ ... ] --> $ $foo->[ ... ]
5584 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
5585 0 $char[$i] = e_capture($1.'->'.$2);
5586 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5587 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
5588 }
5589 }
5590  
5591 # $$foo{ ... } --> $ $foo->{ ... }
5592 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
5593 0 $char[$i] = e_capture($1.'->'.$2);
5594 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5595 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
5596 }
5597 }
5598  
5599 # $$foo
5600 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
5601 0 $char[$i] = e_capture($1);
5602 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5603 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
5604 }
5605 }
5606  
5607 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin4::PREMATCH()
5608 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
5609 8 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 8 8
5610 0 $char[$i] = '@{[Elatin4::ignorecase(Elatin4::PREMATCH())]}';
5611 }
5612 else {
5613 8 $char[$i] = '@{[Elatin4::PREMATCH()]}';
5614 }
5615 }
5616  
5617 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin4::MATCH()
5618 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
5619 8 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 8 8
5620 0 $char[$i] = '@{[Elatin4::ignorecase(Elatin4::MATCH())]}';
5621 }
5622 else {
5623 8 $char[$i] = '@{[Elatin4::MATCH()]}';
5624 }
5625 }
5626  
5627 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin4::POSTMATCH()
5628 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
5629 6 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 6 6
5630 0 $char[$i] = '@{[Elatin4::ignorecase(Elatin4::POSTMATCH())]}';
5631 }
5632 else {
5633 6 $char[$i] = '@{[Elatin4::POSTMATCH()]}';
5634 }
5635 }
5636  
5637 # ${ foo }
5638 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
5639 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5640 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
5641 }
5642 }
5643  
5644 # ${ ... }
5645 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5646 0 $char[$i] = e_capture($1);
5647 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5648 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
5649 }
5650 }
5651  
5652 # $scalar or @array
5653 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
5654 21 $char[$i] = e_string($char[$i]);
5655 21 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 11 10 21
5656 11 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
5657 }
5658 }
5659  
5660 # quote character before ? + * {
5661 ▶ 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
5662 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
5663 }
5664 ▶ 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
5665 0 my $char = $char[$i-1];
5666 0 ▶ if ($char[$i] eq '{') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq '{') { } 0 0 0
5667 0 die __FILE__, qq{: "MULTIBYTE{n}" should be "(MULTIBYTE){n}" in m?? (and shift \$1,\$2,\$3,...) ($char){n}\n};
5668 }
5669 else {
5670 0 die __FILE__, qq{: "MULTIBYTE$char[$i]" should be "(MULTIBYTE)$char[$i]" in m?? (and shift \$1,\$2,\$3,...) ($char)$char[$i]\n};
5671 }
5672 }
5673 else {
5674 127 $char[$i-1] = '(?:' . $char[$i-1] . ')';
5675 }
5676 }
5677 }
5678  
5679 # make regexp string
5680 870 $modifier =~ tr/i//d;
5681 870 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 870 870
5682 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
5683 0 return join '', $ope, $delimiter, $anchor, @char, '>]}' x ($left_e - $right_e), $matched, $end_delimiter, $modifier;
5684 }
5685 else {
5686 0 return join '', $ope, $delimiter, $anchor, '(?:', @char, '>]}' x ($left_e - $right_e), ')', $matched, $end_delimiter, $modifier;
5687 }
5688 }
5689 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
5690 0 return join '', $ope, $delimiter, $anchor, @char, $matched, $end_delimiter, $modifier;
5691 }
5692 else {
5693 870 return join '', $ope, $delimiter, $anchor, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
5694 }
5695 }
5696  
5697 #
5698 # double quote stuff
5699 #
5700 180 ▶sub qq_stuff {
Subroutine qq_stuff: called CC=6 SCAR=18.5
Pod undocumented
5701 180 my($delimiter,$end_delimiter,$stuff) = @_;
5702  
5703 # scalar variable or array variable
5704 180 ▶ if ($stuff =~ /\A [\$\@] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($stuff =~ /\A [\$\@] /mosx) 100 80 180
5705 100 return $stuff;
5706 }
5707  
5708 # quote by delimiter
5709 80 my %octet = map {$_ => 1} ($stuff =~ /\G ([\x00-\xFF]) /oxmsg);
5710 80 for my $char (qw( ! " $ % & * + - . / : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5711 80 ▶ next if $char eq $delimiter;
Branch: 1 branch
BranchTrueFalseTotal
if $char eq $delimiter 0 80 80
5712 80 ▶ next if $char eq $end_delimiter;
Branch: 1 branch
BranchTrueFalseTotal
if $char eq $end_delimiter 0 80 80
5713 80 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 80 0 80
5714 80 return join '', 'qq', $char, $stuff, $char;
5715 }
5716 }
5717 0 return join '', 'qq', '<', $stuff, '>';
5718 }
5719  
5720 #
5721 # escape regexp (m'', qr'', and m''b, qr''b)
5722 #
5723 10 ▶sub e_qr_q {
Subroutine e_qr_q: called CC=7 SCAR=25.3
Pod undocumented
5724 10 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5725 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
5726  
5727 10 $modifier =~ tr/p//d;
5728 10 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 10 10
5729 0 my $line = 0;
5730 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
5731 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
5732 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
5733 0 last;
5734 }
5735 }
5736 0 die qq{Unsupported modifier "$1" used at line $line.\n};
5737 }
5738  
5739 10 $slash = 'div';
5740  
5741 # literal null string pattern
5742 10 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 2 10
elsif ($modifier =~ tr/Bb//d) { } 0 2 2
5743 8 $modifier =~ tr/bB//d;
5744 8 $modifier =~ tr/i//d;
5745 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
5746 }
5747  
5748 # with /b /B modifier
5749 elsif ($modifier =~ tr/bB//d) {
5750 0 return e_qr_qb($ope,$delimiter,$end_delimiter,$string,$modifier);
5751 }
5752  
5753 # without /b /B modifier
5754 else {
5755 2 return e_qr_qt($ope,$delimiter,$end_delimiter,$string,$modifier);
5756 }
5757 }
5758  
5759 #
5760 # escape regexp (m'', qr'')
5761 #
5762 2 ▶sub e_qr_qt {
Subroutine e_qr_qt: called CC=20 SCAR=51.8
Pod undocumented
5763 2 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5764  
5765 2 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 2 2
5766  
5767 # split regexp
5768 2 my @char = $string =~ /\G((?>
5769 [^\\\[\$\@\/] |
5770 [\x00-\xFF] |
5771 \[\^ |
5772 \[\: (?>[a-z]+) \:\] |
5773 \[\:\^ (?>[a-z]+) \:\] |
5774 [\$\@\/] |
5775 \\ (?:$q_char) |
5776 (?:$q_char)
5777 ))/oxmsg;
5778  
5779 # unescape character
5780 2 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 2 2 4
5781 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 &Elatin4::uc($char[$i]) ne &fc($char[$i])) { } 0 2 2
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 4 4
5782 }
5783  
5784 # open character class [...]
5785 elsif ($char[$i] eq '[') {
5786 0 my $left = $i;
5787 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
5788 0 $i++;
5789 }
5790 0 while (1) {
5791 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5792 0 die __FILE__, ": Unmatched [] in regexp\n";
5793 }
5794 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
5795 0 my $right = $i;
5796  
5797 # [...]
5798 0 splice @char, $left, $right-$left+1, Elatin4::charlist_qr(@char[$left+1..$right-1], $modifier);
5799  
5800 0 $i = $left;
5801 0 last;
5802 }
5803 }
5804 }
5805  
5806 # open character class [^...]
5807 elsif ($char[$i] eq '[^') {
5808 0 my $left = $i;
5809 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
5810 0 $i++;
5811 }
5812 0 while (1) {
5813 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5814 0 die __FILE__, ": Unmatched [] in regexp\n";
5815 }
5816 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
5817 0 my $right = $i;
5818  
5819 # [^...]
5820 0 splice @char, $left, $right-$left+1, Elatin4::charlist_not_qr(@char[$left+1..$right-1], $modifier);
5821  
5822 0 $i = $left;
5823 0 last;
5824 }
5825 }
5826 }
5827  
5828 # escape $ @ / and \
5829 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
5830 0 $char[$i] = '\\' . $char[$i];
5831 }
5832  
5833 # rewrite character class or escape character
5834 elsif (my $char = character_class($char[$i],$modifier)) {
5835 0 $char[$i] = $char;
5836 }
5837  
5838 # /i modifier
5839 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin4::uc($char[$i]) ne Elatin4::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin4::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 &Elatin4::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin4::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= &Elatin4::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
5840 0 ▶ if (CORE::length(Elatin4::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
5841 0 $char[$i] = '[' . Elatin4::uc($char[$i]) . Elatin4::fc($char[$i]) . ']';
5842 }
5843 else {
5844 0 $char[$i] = '(?:' . Elatin4::uc($char[$i]) . '|' . Elatin4::fc($char[$i]) . ')';
5845 }
5846 }
5847  
5848 # quote character before ? + * {
5849 ▶ 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
5850 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
5851 }
5852 else {
5853 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
5854 }
5855 }
5856 }
5857  
5858 2 $delimiter = '/';
5859 2 $end_delimiter = '/';
5860  
5861 2 $modifier =~ tr/i//d;
5862 2 return join '', $ope, $delimiter, $anchor, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
5863 }
5864  
5865 #
5866 # escape regexp (m''b, qr''b)
5867 #
5868 0 ▶sub e_qr_qb {
Subroutine e_qr_qb: not called CC=4 SCAR=30.0
Pod undocumented
5869 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5870  
5871 # split regexp
5872 0 my @char = $string =~ /\G ((?>[^\\]|\\\\)) /oxmsg;
5873  
5874 # unescape character
5875 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
5876 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
5877 }
5878  
5879 # remain \\
5880 elsif ($char[$i] eq '\\\\') {
5881 }
5882  
5883 # escape $ @ / and \
5884 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
5885 0 $char[$i] = '\\' . $char[$i];
5886 }
5887 }
5888  
5889 0 $delimiter = '/';
5890 0 $end_delimiter = '/';
5891 0 return join '', $ope, $delimiter, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
5892 }
5893  
5894 #
5895 # escape regexp (s/here//)
5896 #
5897 80 ▶sub e_s1 {
Subroutine e_s1: called CC=106 SCAR=81.1
Pod undocumented
5898 80 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5899 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
5900  
5901 80 $modifier =~ tr/p//d;
5902 80 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 80 80
5903 0 my $line = 0;
5904 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
5905 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
5906 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
5907 0 last;
5908 }
5909 }
5910 0 die qq{Unsupported modifier "$1" used at line $line.\n};
5911 }
5912  
5913 80 $slash = 'div';
5914  
5915 # literal null string pattern
5916 80 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 72 80
elsif ($modifier =~ tr/Bb//d) { } 0 72 72
5917 8 $modifier =~ tr/bB//d;
5918 8 $modifier =~ tr/i//d;
5919 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
5920 }
5921  
5922 # /b /B modifier
5923 elsif ($modifier =~ tr/bB//d) {
5924  
5925 # choice again delimiter
5926 0 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 0 0
5927 0 my @char = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5928 0 my %octet = map {$_ => 1} @char;
5929 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
5930 0 $delimiter = '(';
5931 0 $end_delimiter = ')';
5932 }
5933 elsif (not $octet{'}'}) {
5934 0 $delimiter = '{';
5935 0 $end_delimiter = '}';
5936 }
5937 elsif (not $octet{']'}) {
5938 0 $delimiter = '[';
5939 0 $end_delimiter = ']';
5940 }
5941 elsif (not $octet{'>'}) {
5942 0 $delimiter = '<';
5943 0 $end_delimiter = '>';
5944 }
5945 else {
5946 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5947 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5948 0 $delimiter = $char;
5949 0 $end_delimiter = $char;
5950 0 last;
5951 }
5952 }
5953 }
5954 }
5955  
5956 0 my $prematch = '';
5957 0 return join '', $ope, $delimiter, $prematch, '(?:', $string, ')', $matched, $end_delimiter, $modifier;
5958 }
5959  
5960 72 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 1 71 72
5961 72 my $metachar = qr/[\@\\|[\]{^]/oxms;
5962  
5963 # split regexp
5964 72 my @char = $string =~ /\G((?>
5965 [^\\\$\@\[\(] |
5966 \\ (?>[1-9][0-9]*) |
5967 \\g (?>\s*) (?>[1-9][0-9]*) |
5968 \\g (?>\s*) \{ (?>\s*) (?>[1-9][0-9]*) (?>\s*) \} |
5969 \\g (?>\s*) \{ (?>\s*) - (?>\s*) (?>[1-9][0-9]*) (?>\s*) \} |
5970 \\x (?>[0-9A-Fa-f]{1,2}) |
5971 \\ (?>[0-7]{2,3}) |
5972 \\c [\x40-\x5F] |
5973 \\x\{ (?>[0-9A-Fa-f]+) \} |
5974 \\o\{ (?>[0-7]+) \} |
5975 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
5976 \\ $q_char |
5977 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5978 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5979 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5980 [\$\@] $qq_variable |
5981 \$ (?>\s* [0-9]+) |
5982 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5983 \$ \$ (?![\w\{]) |
5984 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5985 \[\^ |
5986 \[\: (?>[a-z]+) :\] |
5987 \[\:\^ (?>[a-z]+) :\] |
5988 \(\? |
5989 $q_char
5990 ))/oxmsg;
5991  
5992 # choice again delimiter
5993 72 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 72 72
5994 0 my %octet = map {$_ => 1} @char;
5995 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
5996 0 $delimiter = '(';
5997 0 $end_delimiter = ')';
5998 }
5999 elsif (not $octet{'}'}) {
6000 0 $delimiter = '{';
6001 0 $end_delimiter = '}';
6002 }
6003 elsif (not $octet{']'}) {
6004 0 $delimiter = '[';
6005 0 $end_delimiter = ']';
6006 }
6007 elsif (not $octet{'>'}) {
6008 0 $delimiter = '<';
6009 0 $end_delimiter = '>';
6010 }
6011 else {
6012 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
6013 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
6014 0 $delimiter = $char;
6015 0 $end_delimiter = $char;
6016 0 last;
6017 }
6018 }
6019 }
6020 }
6021  
6022 # count '('
6023 72 my $parens = grep { $_ eq '(' } @char;
6024  
6025 72 my $left_e = 0;
6026 72 my $right_e = 0;
6027 72 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 200 72 272
6028  
6029 # "\L\u" --> "\u\L"
6030 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
6031 0 @char[$i,$i+1] = @char[$i+1,$i];
6032 }
6033  
6034 # "\U\l" --> "\l\U"
6035 ▶ 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
6036 0 @char[$i,$i+1] = @char[$i+1,$i];
6037 }
6038  
6039 # octal escape sequence
6040 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
6041 1 $char[$i] = Elatin4::octchr($1);
6042 }
6043  
6044 # hexadecimal escape sequence
6045 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
6046 1 $char[$i] = Elatin4::hexchr($1);
6047 }
6048  
6049 # \b{...} --> b\{...}
6050 # \B{...} --> B\{...}
6051 # \N{CHARNAME} --> N\{CHARNAME}
6052 # \p{PROPERTY} --> p\{PROPERTY}
6053 # \P{PROPERTY} --> P\{PROPERTY}
6054 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
6055 0 $char[$i] = $1 . '\\' . $2;
6056 }
6057  
6058 # \p, \P, \X --> p, P, X
6059 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
6060 0 $char[$i] = $1;
6061 }
6062  
6063 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 &Elatin4::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
6064 }
6065  
6066 # join separated multiple-octet
6067 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
6068 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 $Elatin4::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 $Elatin4::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 $Elatin4::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 $Elatin4::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 $Elatin4::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 $Elatin4::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 $Elatin4::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6069 0 $char[$i] .= join '', splice @char, $i+1, 3;
6070 }
6071 ▶ 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 $Elatin4::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 $Elatin4::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 $Elatin4::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 $Elatin4::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6072 0 $char[$i] .= join '', splice @char, $i+1, 2;
6073 }
6074 ▶ 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 $Elatin4::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 $Elatin4::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 $Elatin4::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 $Elatin4::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6075 0 $char[$i] .= join '', splice @char, $i+1, 1;
6076 }
6077 }
6078  
6079 # open character class [...]
6080 elsif ($char[$i] eq '[') {
6081 17 my $left = $i;
6082 17 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 17 17
6083 0 $i++;
6084 }
6085 17 while (1) {
6086 74 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 74 74
6087 0 die __FILE__, ": Unmatched [] in regexp\n";
6088 }
6089 74 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 17 57 74
6090 17 my $right = $i;
6091  
6092 # [...]
6093 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
6094 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin4::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6095 }
6096 else {
6097 17 splice @char, $left, $right-$left+1, Elatin4::charlist_qr(@char[$left+1..$right-1], $modifier);
6098 }
6099  
6100 17 $i = $left;
6101 17 last;
6102 }
6103 }
6104 }
6105  
6106 # open character class [^...]
6107 elsif ($char[$i] eq '[^') {
6108 0 my $left = $i;
6109 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6110 0 $i++;
6111 }
6112 0 while (1) {
6113 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6114 0 die __FILE__, ": Unmatched [] in regexp\n";
6115 }
6116 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6117 0 my $right = $i;
6118  
6119 # [^...]
6120 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
6121 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin4::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6122 }
6123 else {
6124 0 splice @char, $left, $right-$left+1, Elatin4::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6125 }
6126  
6127 0 $i = $left;
6128 0 last;
6129 }
6130 }
6131 }
6132  
6133 # rewrite character class or escape character
6134 elsif (my $char = character_class($char[$i],$modifier)) {
6135 7 $char[$i] = $char;
6136 }
6137  
6138 # /i modifier
6139 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin4::uc($char[$i]) ne Elatin4::fc($char[$i]))) {
Condition66%4/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin4::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 &Elatin4::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin4::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= &Elatin4::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6140 3 ▶ if (CORE::length(Elatin4::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 3 0 3
6141 3 $char[$i] = '[' . Elatin4::uc($char[$i]) . Elatin4::fc($char[$i]) . ']';
6142 }
6143 else {
6144 0 $char[$i] = '(?:' . Elatin4::uc($char[$i]) . '|' . Elatin4::fc($char[$i]) . ')';
6145 }
6146 }
6147  
6148 # \u \l \U \L \F \Q \E
6149 elsif ($char[$i] =~ /\A [<>] \z/oxms) {
6150 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
6151 0 $char[$i] = '\\' . $char[$i];
6152 }
6153 }
6154 elsif ($char[$i] eq '\u') {
6155 0 $char[$i] = '@{[Elatin4::ucfirst qq<';
6156 0 $left_e++;
6157 }
6158 elsif ($char[$i] eq '\l') {
6159 0 $char[$i] = '@{[Elatin4::lcfirst qq<';
6160 0 $left_e++;
6161 }
6162 elsif ($char[$i] eq '\U') {
6163 0 $char[$i] = '@{[Elatin4::uc qq<';
6164 0 $left_e++;
6165 }
6166 elsif ($char[$i] eq '\L') {
6167 0 $char[$i] = '@{[Elatin4::lc qq<';
6168 0 $left_e++;
6169 }
6170 elsif ($char[$i] eq '\F') {
6171 0 $char[$i] = '@{[Elatin4::fc qq<';
6172 0 $left_e++;
6173 }
6174 elsif ($char[$i] eq '\Q') {
6175 0 $char[$i] = '@{[CORE::quotemeta qq<';
6176 0 $left_e++;
6177 }
6178 elsif ($char[$i] eq '\E') {
6179 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
6180 0 $char[$i] = '>]}';
6181 0 $right_e++;
6182 }
6183 else {
6184 0 $char[$i] = '';
6185 }
6186 }
6187 elsif ($char[$i] eq '\Q') {
6188 0 while (1) {
6189 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6190 0 last;
6191 }
6192 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
6193 0 last;
6194 }
6195 }
6196 }
6197 elsif ($char[$i] eq '\E') {
6198 }
6199  
6200 # \0 --> \0
6201 elsif ($char[$i] =~ /\A \\ (?>\s*) 0 \z/oxms) {
6202 }
6203  
6204 # \g{N}, \g{-N}
6205  
6206 # P.108 Using Simple Patterns
6207 # in Chapter 7: In the World of Regular Expressions
6208 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
6209  
6210 # P.221 Capturing
6211 # in Chapter 5: Pattern Matching
6212 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
6213  
6214 # \g{-1}, \g{-2}, \g{-3} --> \g{-1}, \g{-2}, \g{-3}
6215 elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) - (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6216 }
6217  
6218 # \g{1}, \g{2}, \g{3} --> \g{2}, \g{3}, \g{4} (only when multibyte anchoring is enable)
6219 elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6220 }
6221  
6222 # \g1, \g2, \g3 --> \g2, \g3, \g4 (only when multibyte anchoring is enable)
6223 elsif ($char[$i] =~ /\A \\g (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) {
6224 }
6225  
6226 # \1, \2, \3 --> \2, \3, \4 (only when multibyte anchoring is enable)
6227 elsif ($char[$i] =~ /\A \\ (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) {
6228 }
6229  
6230 # $0 --> $0
6231 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
6232 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6233 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
6234 }
6235 }
6236 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
6237 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6238 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
6239 }
6240 }
6241  
6242 # $$ --> $$
6243 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
6244 }
6245  
6246 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
6247 # $1, $2, $3 --> $1, $2, $3 otherwise
6248 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
6249 0 $char[$i] = e_capture($1);
6250 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6251 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
6252 }
6253 }
6254 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6255 0 $char[$i] = e_capture($1);
6256 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6257 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
6258 }
6259 }
6260  
6261 # $$foo[ ... ] --> $ $foo->[ ... ]
6262 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
6263 0 $char[$i] = e_capture($1.'->'.$2);
6264 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6265 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
6266 }
6267 }
6268  
6269 # $$foo{ ... } --> $ $foo->{ ... }
6270 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
6271 0 $char[$i] = e_capture($1.'->'.$2);
6272 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6273 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
6274 }
6275 }
6276  
6277 # $$foo
6278 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
6279 0 $char[$i] = e_capture($1);
6280 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6281 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
6282 }
6283 }
6284  
6285 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin4::PREMATCH()
6286 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
6287 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 4 4
6288 0 $char[$i] = '@{[Elatin4::ignorecase(Elatin4::PREMATCH())]}';
6289 }
6290 else {
6291 4 $char[$i] = '@{[Elatin4::PREMATCH()]}';
6292 }
6293 }
6294  
6295 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin4::MATCH()
6296 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
6297 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 4 4
6298 0 $char[$i] = '@{[Elatin4::ignorecase(Elatin4::MATCH())]}';
6299 }
6300 else {
6301 4 $char[$i] = '@{[Elatin4::MATCH()]}';
6302 }
6303 }
6304  
6305 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin4::POSTMATCH()
6306 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
6307 3 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 3 3
6308 0 $char[$i] = '@{[Elatin4::ignorecase(Elatin4::POSTMATCH())]}';
6309 }
6310 else {
6311 3 $char[$i] = '@{[Elatin4::POSTMATCH()]}';
6312 }
6313 }
6314  
6315 # ${ foo }
6316 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
6317 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6318 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
6319 }
6320 }
6321  
6322 # ${ ... }
6323 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
6324 0 $char[$i] = e_capture($1);
6325 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6326 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
6327 }
6328 }
6329  
6330 # $scalar or @array
6331 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
6332 4 $char[$i] = e_string($char[$i]);
6333 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 4 4
6334 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
6335 }
6336 }
6337  
6338 # quote character before ? + * {
6339 ▶ 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
6340 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
6341 }
6342 else {
6343 14 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6344 }
6345 }
6346 }
6347  
6348 # make regexp string
6349 72 my $prematch = '';
6350 72 $modifier =~ tr/i//d;
6351 72 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 72 72
6352 0 return join '', $ope, $delimiter, $prematch, '(?:', @char, '>]}' x ($left_e - $right_e), ')', $matched, $end_delimiter, $modifier;
6353 }
6354 72 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6355 }
6356  
6357 #
6358 # escape regexp (s'here'' or s'here''b)
6359 #
6360 21 ▶sub e_s1_q {
Subroutine e_s1_q: called CC=7 SCAR=24.3
Pod undocumented
6361 21 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6362 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
6363  
6364 21 $modifier =~ tr/p//d;
6365 21 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 21 21
6366 0 my $line = 0;
6367 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6368 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6369 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6370 0 last;
6371 }
6372 }
6373 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6374 }
6375  
6376 21 $slash = 'div';
6377  
6378 # literal null string pattern
6379 21 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 13 21
elsif ($modifier =~ tr/Bb//d) { } 0 13 13
6380 8 $modifier =~ tr/bB//d;
6381 8 $modifier =~ tr/i//d;
6382 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
6383 }
6384  
6385 # with /b /B modifier
6386 elsif ($modifier =~ tr/bB//d) {
6387 0 return e_s1_qb($ope,$delimiter,$end_delimiter,$string,$modifier);
6388 }
6389  
6390 # without /b /B modifier
6391 else {
6392 13 return e_s1_qt($ope,$delimiter,$end_delimiter,$string,$modifier);
6393 }
6394 }
6395  
6396 #
6397 # escape regexp (s'here'')
6398 #
6399 13 ▶sub e_s1_qt {
Subroutine e_s1_qt: called CC=20 SCAR=50.1
Pod undocumented
6400 13 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6401  
6402 13 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 13 13
6403  
6404 # split regexp
6405 13 my @char = $string =~ /\G((?>
6406 [^\\\[\$\@\/] |
6407 [\x00-\xFF] |
6408 \[\^ |
6409 \[\: (?>[a-z]+) \:\] |
6410 \[\:\^ (?>[a-z]+) \:\] |
6411 [\$\@\/] |
6412 \\ (?:$q_char) |
6413 (?:$q_char)
6414 ))/oxmsg;
6415  
6416 # unescape character
6417 13 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 25 13 38
6418 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 &Elatin4::uc($char[$i]) ne &fc($char[$i])) { } 0 19 19
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 32 32
6419 }
6420  
6421 # open character class [...]
6422 elsif ($char[$i] eq '[') {
6423 0 my $left = $i;
6424 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6425 0 $i++;
6426 }
6427 0 while (1) {
6428 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6429 0 die __FILE__, ": Unmatched [] in regexp\n";
6430 }
6431 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6432 0 my $right = $i;
6433  
6434 # [...]
6435 0 splice @char, $left, $right-$left+1, Elatin4::charlist_qr(@char[$left+1..$right-1], $modifier);
6436  
6437 0 $i = $left;
6438 0 last;
6439 }
6440 }
6441 }
6442  
6443 # open character class [^...]
6444 elsif ($char[$i] eq '[^') {
6445 0 my $left = $i;
6446 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6447 0 $i++;
6448 }
6449 0 while (1) {
6450 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6451 0 die __FILE__, ": Unmatched [] in regexp\n";
6452 }
6453 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6454 0 my $right = $i;
6455  
6456 # [^...]
6457 0 splice @char, $left, $right-$left+1, Elatin4::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6458  
6459 0 $i = $left;
6460 0 last;
6461 }
6462 }
6463 }
6464  
6465 # escape $ @ / and \
6466 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6467 0 $char[$i] = '\\' . $char[$i];
6468 }
6469  
6470 # rewrite character class or escape character
6471 elsif (my $char = character_class($char[$i],$modifier)) {
6472 6 $char[$i] = $char;
6473 }
6474  
6475 # /i modifier
6476 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin4::uc($char[$i]) ne Elatin4::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin4::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 &Elatin4::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin4::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= &Elatin4::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6477 0 ▶ if (CORE::length(Elatin4::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
6478 0 $char[$i] = '[' . Elatin4::uc($char[$i]) . Elatin4::fc($char[$i]) . ']';
6479 }
6480 else {
6481 0 $char[$i] = '(?:' . Elatin4::uc($char[$i]) . '|' . Elatin4::fc($char[$i]) . ')';
6482 }
6483 }
6484  
6485 # quote character before ? + * {
6486 ▶ 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
6487 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
6488 }
6489 else {
6490 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6491 }
6492 }
6493 }
6494  
6495 13 $modifier =~ tr/i//d;
6496 13 $delimiter = '/';
6497 13 $end_delimiter = '/';
6498 13 my $prematch = '';
6499 13 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6500 }
6501  
6502 #
6503 # escape regexp (s'here''b)
6504 #
6505 0 ▶sub e_s1_qb {
Subroutine e_s1_qb: not called CC=4 SCAR=30.0
Pod undocumented
6506 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6507  
6508 # split regexp
6509 0 my @char = $string =~ /\G (?>[^\\]|\\\\) /oxmsg;
6510  
6511 # unescape character
6512 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
6513 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
6514 }
6515  
6516 # remain \\
6517 elsif ($char[$i] eq '\\\\') {
6518 }
6519  
6520 # escape $ @ / and \
6521 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6522 0 $char[$i] = '\\' . $char[$i];
6523 }
6524 }
6525  
6526 0 $delimiter = '/';
6527 0 $end_delimiter = '/';
6528 0 my $prematch = '';
6529 0 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6530 }
6531  
6532 #
6533 # escape regexp (s''here')
6534 #
6535 16 ▶sub e_s2_q {
Subroutine e_s2_q: called CC=4 SCAR=13.9
Pod undocumented
6536 16 my($ope,$delimiter,$end_delimiter,$string) = @_;
6537  
6538 16 $slash = 'div';
6539  
6540 16 my @char = $string =~ / \G (?>[^\\]|\\\\|$q_char) /oxmsg;
6541 16 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 9 16 25
6542 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
6543 }
6544  
6545 # not escape \\
6546 elsif ($char[$i] =~ /\A \\\\ \z/oxms) {
6547 }
6548  
6549 # escape $ @ / and \
6550 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6551 5 $char[$i] = '\\' . $char[$i];
6552 }
6553 }
6554  
6555 16 return join '', $ope, $delimiter, @char, $end_delimiter;
6556 }
6557  
6558 #
6559 # escape regexp (s/here/and here/modifier)
6560 #
6561 101 ▶sub e_sub {
Subroutine e_sub: called CC=20 SCAR=32.6
Pod undocumented
6562 101 my($variable,$delimiter1,$pattern,$end_delimiter1,$delimiter2,$replacement,$end_delimiter2,$modifier) = @_;
6563 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
6564  
6565 101 $modifier =~ tr/p//d;
6566 101 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 101 101
6567 0 my $line = 0;
6568 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6569 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6570 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6571 0 last;
6572 }
6573 }
6574 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6575 }
6576  
6577 101 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq "") 36 65 101
6578 36 $variable = '$_';
6579 36 $bind_operator = ' =~ ';
6580 }
6581  
6582 101 $slash = 'div';
6583  
6584 # P.128 Start of match (or end of previous match): \G
6585 # P.130 Advanced Use of \G with Perl
6586 # in Chapter 3: Overview of Regular Expression Features and Flavors
6587 # P.312 Iterative Matching: Scalar Context, with /g
6588 # in Chapter 7: Perl
6589 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
6590  
6591 # P.181 Where You Left Off: The \G Assertion
6592 # in Chapter 5: Pattern Matching
6593 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
6594  
6595 # P.220 Where You Left Off: The \G Assertion
6596 # in Chapter 5: Pattern Matching
6597 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
6598  
6599 101 my $e_modifier = $modifier =~ tr/e//d;
6600 101 my $r_modifier = $modifier =~ tr/r//d;
6601  
6602 101 my $my = '';
6603 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
6604 0 $my = $variable;
6605 0 $variable =~ s/ (?: local \b | my \b | our \b | state \b ) (?>\s*) //oxms;
6606 0 $variable =~ s/ = .+ \z//oxms;
6607 }
6608  
6609 101 (my $variable_basename = $variable) =~ s/ [\[\{].* \z//oxms;
6610 101 $variable_basename =~ s/ \s+ \z//oxms;
6611  
6612 # quote replacement string
6613 101 my $e_replacement = '';
6614 101 ▶ if ($e_modifier >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($e_modifier >= 1) { } 17 84 101
6615 17 $e_replacement = e_qq('', '', '', $replacement);
6616 17 $e_modifier--;
6617 }
6618 else {
6619 84 ▶ if ($delimiter2 eq "'") {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter2 eq q[']) { } 16 68 84
6620 16 $e_replacement = e_s2_q('qq', '/', '/', $replacement);
6621 }
6622 else {
6623 68 $e_replacement = e_qq ('qq', $delimiter2, $end_delimiter2, $replacement);
6624 }
6625 }
6626  
6627 101 my $sub = '';
6628  
6629 # with /r
6630 101 ▶ if ($r_modifier) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r_modifier) { } 10 91 101
6631 10 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $modifier =~ /g/mosx }) { } 5 5 10
6632 }
6633  
6634 # s///gr without multibyte anchoring
6635 elsif ($modifier =~ /g/oxms) {
6636 5 ▶ $sub = sprintf(
Branch: 1 branch
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 0 5 5
6637 # 1 2 3 4 5
6638 q<CORE::eval{local $Elatin4::re_t=%s; while($Elatin4::re_t =~ %s){%s local $^W=0; local $Elatin4::re_r=%s; %s$Elatin4::re_t="$`$Elatin4::re_r$'"; pos($Elatin4::re_t)=length "$`$Elatin4::re_r"; } return $Elatin4::re_t}>,
6639  
6640 $variable, # 1
6641 ($delimiter1 eq "'") ? # 2
6642 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
6643 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
6644 $s_matched, # 3
6645 $e_replacement, # 4
6646 '$Elatin4::re_r=CORE::eval $Elatin4::re_r; ' x $e_modifier, # 5
6647 );
6648 }
6649  
6650 # s///r
6651 else {
6652  
6653 5 my $prematch = q{$`};
6654  
6655 5 ▶ $sub = sprintf(
Branch: 1 branch
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 0 5 5
6656 # 1 2 3 4 5 6 7
6657 q<(%s =~ %s) ? CORE::eval{%s local $^W=0; local $Elatin4::re_r=%s; %s"%s$Elatin4::re_r$'" } : %s>,
6658  
6659 $variable, # 1
6660 ($delimiter1 eq "'") ? # 2
6661 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
6662 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
6663 $s_matched, # 3
6664 $e_replacement, # 4
6665 '$Elatin4::re_r=CORE::eval $Elatin4::re_r; ' x $e_modifier, # 5
6666 $prematch, # 6
6667 $variable, # 7
6668 );
6669 }
6670  
6671 # $var !~ s///r doesn't make sense
6672 10 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) 0 10 10
6673 0 $sub = q{die("$0: Using !~ with s///r doesn't make sense"), } . $sub;
6674 }
6675 }
6676  
6677 # without /r
6678 else {
6679 91 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $modifier =~ /g/mosx }) { } 23 68 91
6680 }
6681  
6682 # s///g without multibyte anchoring
6683 elsif ($modifier =~ /g/oxms) {
6684 23 ▶ $sub = sprintf(
Branch: 2 branches
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 3 20 23
$bind_operator =~ / !~ /mosx ? : 3 20 23
6685 # 1 2 3 4 5 6 7 8
6686 q<CORE::eval{local $Elatin4::re_n=0; while(%s =~ %s){%s local $^W=0; local $Elatin4::re_r=%s; %s%s="$`$Elatin4::re_r$'"; pos(%s)=length "$`$Elatin4::re_r"; $Elatin4::re_n++} return %s$Elatin4::re_n}>,
6687  
6688 $variable, # 1
6689 ($delimiter1 eq "'") ? # 2
6690 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
6691 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
6692 $s_matched, # 3
6693 $e_replacement, # 4
6694 '$Elatin4::re_r=CORE::eval $Elatin4::re_r; ' x $e_modifier, # 5
6695 $variable, # 6
6696 $variable, # 7
6697 ($bind_operator =~ / !~ /oxms) ? '!' : '', # 8
6698 );
6699 }
6700  
6701 # s///
6702 else {
6703  
6704 68 my $prematch = q{$`};
6705  
6706 68 ▶ $sub = sprintf(
Branch: 2 branches
BranchTrueFalseTotal
$bind_operator =~ / =~ /mosx ? : 65 3 68
$delimiter1 eq q['] ? : 18 50 68
6707  
6708 ($bind_operator =~ / =~ /oxms) ?
6709  
6710 # 1 2 3 4 5 6 7 8
6711 q<(%s%s%s) ? CORE::eval{%s local $^W=0; local $Elatin4::re_r=%s; %s%s="%s$Elatin4::re_r$'"; 1 } : undef> :
6712  
6713 # 1 2 3 4 5 6 7 8
6714 q<(%s%s%s) ? 1 : CORE::eval{%s local $^W=0; local $Elatin4::re_r=%s; %s%s="%s$Elatin4::re_r$'"; undef }>,
6715  
6716 $variable, # 1
6717 $bind_operator, # 2
6718 ($delimiter1 eq "'") ? # 3
6719 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
6720 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
6721 $s_matched, # 4
6722 $e_replacement, # 5
6723 '$Elatin4::re_r=CORE::eval $Elatin4::re_r; ' x $e_modifier, # 6
6724 $variable, # 7
6725 $prematch, # 8
6726 );
6727 }
6728 }
6729  
6730 # (my $foo = $bar) =~ s/// --> (my $foo = $bar, CORE::eval { ... })[1]
6731 101 ▶ if ($my ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($my ne "") 0 101 101
6732 0 $sub = "($my, $sub)[1]";
6733 }
6734  
6735 # clear s/// variable
6736 101 $sub_variable = '';
6737 101 $bind_operator = '';
6738  
6739 101 return $sub;
6740 }
6741  
6742 #
6743 # escape regexp of split qr//
6744 #
6745 74 ▶sub e_split {
Subroutine e_split: called CC=88 SCAR=76.4
Pod undocumented
6746 74 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6747 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
6748  
6749 74 $modifier =~ tr/p//d;
6750 74 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 74 74
6751 0 my $line = 0;
6752 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6753 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6754 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6755 0 last;
6756 }
6757 }
6758 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6759 }
6760  
6761 74 $slash = 'div';
6762  
6763 # /b /B modifier
6764 74 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) 0 74 74
6765 0 return join '', 'split', $ope, $delimiter, $string, $end_delimiter, $modifier;
6766 }
6767  
6768 74 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 74 74
6769 74 my $metachar = qr/[\@\\|[\]{^]/oxms;
6770  
6771 # split regexp
6772 74 my @char = $string =~ /\G((?>
6773 [^\\\$\@\[\(] |
6774 \\x (?>[0-9A-Fa-f]{1,2}) |
6775 \\ (?>[0-7]{2,3}) |
6776 \\c [\x40-\x5F] |
6777 \\x\{ (?>[0-9A-Fa-f]+) \} |
6778 \\o\{ (?>[0-7]+) \} |
6779 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
6780 \\ $q_char |
6781 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
6782 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
6783 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
6784 [\$\@] $qq_variable |
6785 \$ (?>\s* [0-9]+) |
6786 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
6787 \$ \$ (?![\w\{]) |
6788 \$ (?>\s*) \$ (?>\s*) $qq_variable |
6789 \[\^ |
6790 \[\: (?>[a-z]+) :\] |
6791 \[\:\^ (?>[a-z]+) :\] |
6792 \(\? |
6793 $q_char
6794 ))/oxmsg;
6795  
6796 74 my $left_e = 0;
6797 74 my $right_e = 0;
6798 74 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 249 74 323
6799  
6800 # "\L\u" --> "\u\L"
6801 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
6802 0 @char[$i,$i+1] = @char[$i+1,$i];
6803 }
6804  
6805 # "\U\l" --> "\l\U"
6806 ▶ 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
6807 0 @char[$i,$i+1] = @char[$i+1,$i];
6808 }
6809  
6810 # octal escape sequence
6811 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
6812 1 $char[$i] = Elatin4::octchr($1);
6813 }
6814  
6815 # hexadecimal escape sequence
6816 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
6817 1 $char[$i] = Elatin4::hexchr($1);
6818 }
6819  
6820 # \b{...} --> b\{...}
6821 # \B{...} --> B\{...}
6822 # \N{CHARNAME} --> N\{CHARNAME}
6823 # \p{PROPERTY} --> p\{PROPERTY}
6824 # \P{PROPERTY} --> P\{PROPERTY}
6825 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
6826 0 $char[$i] = $1 . '\\' . $2;
6827 }
6828  
6829 # \p, \P, \X --> p, P, X
6830 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
6831 0 $char[$i] = $1;
6832 }
6833  
6834 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 &Elatin4::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
6835 }
6836  
6837 # join separated multiple-octet
6838 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
6839 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 $Elatin4::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 $Elatin4::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 $Elatin4::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 $Elatin4::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 $Elatin4::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 $Elatin4::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 $Elatin4::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6840 0 $char[$i] .= join '', splice @char, $i+1, 3;
6841 }
6842 ▶ 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 $Elatin4::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 $Elatin4::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 $Elatin4::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 $Elatin4::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6843 0 $char[$i] .= join '', splice @char, $i+1, 2;
6844 }
6845 ▶ 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 $Elatin4::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 $Elatin4::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 $Elatin4::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 $Elatin4::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6846 0 $char[$i] .= join '', splice @char, $i+1, 1;
6847 }
6848 }
6849  
6850 # open character class [...]
6851 elsif ($char[$i] eq '[') {
6852 3 my $left = $i;
6853 3 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 3 3
6854 0 $i++;
6855 }
6856 3 while (1) {
6857 7 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 7 7
6858 0 die __FILE__, ": Unmatched [] in regexp\n";
6859 }
6860 7 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 3 4 7
6861 3 my $right = $i;
6862  
6863 # [...]
6864 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
6865 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin4::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6866 }
6867 else {
6868 3 splice @char, $left, $right-$left+1, Elatin4::charlist_qr(@char[$left+1..$right-1], $modifier);
6869 }
6870  
6871 3 $i = $left;
6872 3 last;
6873 }
6874 }
6875 }
6876  
6877 # open character class [^...]
6878 elsif ($char[$i] eq '[^') {
6879 0 my $left = $i;
6880 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6881 0 $i++;
6882 }
6883 0 while (1) {
6884 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6885 0 die __FILE__, ": Unmatched [] in regexp\n";
6886 }
6887 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6888 0 my $right = $i;
6889  
6890 # [^...]
6891 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
6892 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin4::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6893 }
6894 else {
6895 0 splice @char, $left, $right-$left+1, Elatin4::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6896 }
6897  
6898 0 $i = $left;
6899 0 last;
6900 }
6901 }
6902 }
6903  
6904 # rewrite character class or escape character
6905 elsif (my $char = character_class($char[$i],$modifier)) {
6906 1 $char[$i] = $char;
6907 }
6908  
6909 # P.794 29.2.161. split
6910 # in Chapter 29: Functions
6911 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
6912  
6913 # P.951 split
6914 # in Chapter 27: Functions
6915 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
6916  
6917 # said "The //m modifier is assumed when you split on the pattern /^/",
6918 # but perl5.008 is not so. Therefore, this software adds //m.
6919 # (and so on)
6920  
6921 # split(m/^/) --> split(m/^/m)
6922 ▶ 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
6923 7 $modifier .= 'm';
6924 }
6925  
6926 # /i modifier
6927 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin4::uc($char[$i]) ne Elatin4::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin4::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 &Elatin4::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin4::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= &Elatin4::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6928 0 ▶ if (CORE::length(Elatin4::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
6929 0 $char[$i] = '[' . Elatin4::uc($char[$i]) . Elatin4::fc($char[$i]) . ']';
6930 }
6931 else {
6932 0 $char[$i] = '(?:' . Elatin4::uc($char[$i]) . '|' . Elatin4::fc($char[$i]) . ')';
6933 }
6934 }
6935  
6936 # \u \l \U \L \F \Q \E
6937 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
6938 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
6939 0 $char[$i] = '\\' . $char[$i];
6940 }
6941 }
6942 elsif ($char[$i] eq '\u') {
6943 0 $char[$i] = '@{[Elatin4::ucfirst qq<';
6944 0 $left_e++;
6945 }
6946 elsif ($char[$i] eq '\l') {
6947 0 $char[$i] = '@{[Elatin4::lcfirst qq<';
6948 0 $left_e++;
6949 }
6950 elsif ($char[$i] eq '\U') {
6951 0 $char[$i] = '@{[Elatin4::uc qq<';
6952 0 $left_e++;
6953 }
6954 elsif ($char[$i] eq '\L') {
6955 0 $char[$i] = '@{[Elatin4::lc qq<';
6956 0 $left_e++;
6957 }
6958 elsif ($char[$i] eq '\F') {
6959 0 $char[$i] = '@{[Elatin4::fc qq<';
6960 0 $left_e++;
6961 }
6962 elsif ($char[$i] eq '\Q') {
6963 0 $char[$i] = '@{[CORE::quotemeta qq<';
6964 0 $left_e++;
6965 }
6966 elsif ($char[$i] eq '\E') {
6967 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
6968 0 $char[$i] = '>]}';
6969 0 $right_e++;
6970 }
6971 else {
6972 0 $char[$i] = '';
6973 }
6974 }
6975 elsif ($char[$i] eq '\Q') {
6976 0 while (1) {
6977 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6978 0 last;
6979 }
6980 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
6981 0 last;
6982 }
6983 }
6984 }
6985 elsif ($char[$i] eq '\E') {
6986 }
6987  
6988 # $0 --> $0
6989 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
6990 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6991 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
6992 }
6993 }
6994 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
6995 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6996 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
6997 }
6998 }
6999  
7000 # $$ --> $$
7001 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
7002 }
7003  
7004 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
7005 # $1, $2, $3 --> $1, $2, $3 otherwise
7006 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
7007 0 $char[$i] = e_capture($1);
7008 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7009 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
7010 }
7011 }
7012 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
7013 0 $char[$i] = e_capture($1);
7014 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7015 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
7016 }
7017 }
7018  
7019 # $$foo[ ... ] --> $ $foo->[ ... ]
7020 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
7021 0 $char[$i] = e_capture($1.'->'.$2);
7022 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7023 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
7024 }
7025 }
7026  
7027 # $$foo{ ... } --> $ $foo->{ ... }
7028 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
7029 0 $char[$i] = e_capture($1.'->'.$2);
7030 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7031 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
7032 }
7033 }
7034  
7035 # $$foo
7036 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
7037 0 $char[$i] = e_capture($1);
7038 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7039 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
7040 }
7041 }
7042  
7043 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin4::PREMATCH()
7044 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
7045 12 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 12 12
7046 0 $char[$i] = '@{[Elatin4::ignorecase(Elatin4::PREMATCH())]}';
7047 }
7048 else {
7049 12 $char[$i] = '@{[Elatin4::PREMATCH()]}';
7050 }
7051 }
7052  
7053 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin4::MATCH()
7054 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
7055 12 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 12 12
7056 0 $char[$i] = '@{[Elatin4::ignorecase(Elatin4::MATCH())]}';
7057 }
7058 else {
7059 12 $char[$i] = '@{[Elatin4::MATCH()]}';
7060 }
7061 }
7062  
7063 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin4::POSTMATCH()
7064 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
7065 9 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 9 9
7066 0 $char[$i] = '@{[Elatin4::ignorecase(Elatin4::POSTMATCH())]}';
7067 }
7068 else {
7069 9 $char[$i] = '@{[Elatin4::POSTMATCH()]}';
7070 }
7071 }
7072  
7073 # ${ foo }
7074 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
7075 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7076 0 $char[$i] = '@{[Elatin4::ignorecase(' . $1 . ')]}';
7077 }
7078 }
7079  
7080 # ${ ... }
7081 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
7082 0 $char[$i] = e_capture($1);
7083 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7084 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
7085 }
7086 }
7087  
7088 # $scalar or @array
7089 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
7090 3 $char[$i] = e_string($char[$i]);
7091 3 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 3 3
7092 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
7093 }
7094 }
7095  
7096 # quote character before ? + * {
7097 ▶ 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
7098 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
7099 }
7100 else {
7101 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
7102 }
7103 }
7104 }
7105  
7106 # make regexp string
7107 74 $modifier =~ tr/i//d;
7108 74 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 74 74
7109 0 return join '', 'Elatin4::split', $ope, $delimiter, @char, '>]}' x ($left_e - $right_e), $end_delimiter, $modifier;
7110 }
7111 74 return join '', 'Elatin4::split', $ope, $delimiter, @char, $end_delimiter, $modifier;
7112 }
7113  
7114 #
7115 # escape regexp of split qr''
7116 #
7117 0 ▶sub e_split_q {
Subroutine e_split_q: not called CC=26 SCAR=65.5
Pod undocumented
7118 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
7119 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
7120  
7121 0 $modifier =~ tr/p//d;
7122 0 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 0 0
7123 0 my $line = 0;
7124 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7125 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
7126 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
7127 0 last;
7128 }
7129 }
7130 0 die qq{Unsupported modifier "$1" used at line $line.\n};
7131 }
7132  
7133 0 $slash = 'div';
7134  
7135 # /b /B modifier
7136 0 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) 0 0 0
7137 0 return join '', 'split', $ope, $delimiter, $string, $end_delimiter, $modifier;
7138 }
7139  
7140 0 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 0 0
7141  
7142 # split regexp
7143 0 my @char = $string =~ /\G((?>
7144 [^\\\[] |
7145 [\x00-\xFF] |
7146 \[\^ |
7147 \[\: (?>[a-z]+) \:\] |
7148 \[\:\^ (?>[a-z]+) \:\] |
7149 \\ (?:$q_char) |
7150 (?:$q_char)
7151 ))/oxmsg;
7152  
7153 # unescape character
7154 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
7155 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 &Elatin4::uc($char[$i]) ne &fc($char[$i])) { } 0 0 0
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 0 0
7156 }
7157  
7158 # open character class [...]
7159 elsif ($char[$i] eq '[') {
7160 0 my $left = $i;
7161 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7162 0 $i++;
7163 }
7164 0 while (1) {
7165 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7166 0 die __FILE__, ": Unmatched [] in regexp\n";
7167 }
7168 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7169 0 my $right = $i;
7170  
7171 # [...]
7172 0 splice @char, $left, $right-$left+1, Elatin4::charlist_qr(@char[$left+1..$right-1], $modifier);
7173  
7174 0 $i = $left;
7175 0 last;
7176 }
7177 }
7178 }
7179  
7180 # open character class [^...]
7181 elsif ($char[$i] eq '[^') {
7182 0 my $left = $i;
7183 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7184 0 $i++;
7185 }
7186 0 while (1) {
7187 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7188 0 die __FILE__, ": Unmatched [] in regexp\n";
7189 }
7190 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7191 0 my $right = $i;
7192  
7193 # [^...]
7194 0 splice @char, $left, $right-$left+1, Elatin4::charlist_not_qr(@char[$left+1..$right-1], $modifier);
7195  
7196 0 $i = $left;
7197 0 last;
7198 }
7199 }
7200 }
7201  
7202 # rewrite character class or escape character
7203 elsif (my $char = character_class($char[$i],$modifier)) {
7204 0 $char[$i] = $char;
7205 }
7206  
7207 # split(m/^/) --> split(m/^/m)
7208 ▶ 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
7209 0 $modifier .= 'm';
7210 }
7211  
7212 # /i modifier
7213 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin4::uc($char[$i]) ne Elatin4::fc($char[$i]))) {
Condition0%0/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin4::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 &Elatin4::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin4::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= &Elatin4::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
7214 0 ▶ if (CORE::length(Elatin4::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
7215 0 $char[$i] = '[' . Elatin4::uc($char[$i]) . Elatin4::fc($char[$i]) . ']';
7216 }
7217 else {
7218 0 $char[$i] = '(?:' . Elatin4::uc($char[$i]) . '|' . Elatin4::fc($char[$i]) . ')';
7219 }
7220 }
7221  
7222 # quote character before ? + * {
7223 ▶ 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
7224 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
7225 }
7226 else {
7227 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
7228 }
7229 }
7230 }
7231  
7232 0 $modifier =~ tr/i//d;
7233 0 return join '', 'Elatin4::split', $ope, $delimiter, @char, $end_delimiter, $modifier;
7234 }
7235  
7236 #
7237 # instead of Carp::carp
7238 #
7239 0 ▶sub carp {
Subroutine carp: not called CC=1 SCAR=6.9
Pod undocumented
7240 0 my($package,$filename,$line) = caller(1);
7241 0 print STDERR "@_ at $filename line $line.\n";
7242 }
7243  
7244 #
7245 # instead of Carp::croak
7246 #
7247 0 ▶sub croak {
Subroutine croak: not called CC=1 SCAR=6.9
Pod undocumented
7248 0 my($package,$filename,$line) = caller(1);
7249 0 print STDERR "@_ at $filename line $line.\n";
7250 0 die "\n";
7251 }
7252  
7253 #
7254 # instead of Carp::cluck
7255 #
7256 0 ▶sub cluck {
Subroutine cluck: not called CC=2 SCAR=17.9
Pod undocumented
7257 0 my $i = 0;
7258 0 my @cluck = ();
7259 0 ▶ while (my($package,$filename,$line,$subroutine) = caller($i)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7260 0 push @cluck, "[$i] $filename($line) $package::$subroutine\n";
7261 0 $i++;
7262 }
7263 0 print STDERR CORE::reverse @cluck;
7264 0 print STDERR "\n";
7265 0 print STDERR @_;
7266 }
7267  
7268 #
7269 # instead of Carp::confess
7270 #
7271 0 ▶sub confess {
Subroutine confess: not called CC=2 SCAR=17.9
Pod undocumented
7272 0 my $i = 0;
7273 0 my @confess = ();
7274 0 ▶ while (my($package,$filename,$line,$subroutine) = caller($i)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7275 0 push @confess, "[$i] $filename($line) $package::$subroutine\n";
7276 0 $i++;
7277 }
7278 0 print STDERR CORE::reverse @confess;
7279 0 print STDERR "\n";
7280 0 print STDERR @_;
7281 0 die "\n";
7282 }
7283  
7284 424 1;
7285  
7286 __END__
↑ Summary Latin4.pm »