blib/lib/Elatin4.pm

filter: Statementstmt 36.4% 1198 / 3286 Branchbran 38.6% 1141 / 2954 Conditioncond 31.0% 115 / 370 MC/DCmcdc 15.9% 35 / 220 Subroutinesub 60.8% 73 / 120 Podpod 4.6% 3 / 64 totaltotal 36.5% 2565 / 7014 CC 1648 SCAR 99.4
CC
1648
Cov
37%
escape_token
55669.4
e_string
33636.6
e_s1
3320.4
CRAP 20709.5
↑ Summary blib/lib/Latin4.pm »
1 package Elatin4;
2 422 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 ######################################################################
4 #
5 # Elatin4 - Run-time routines for Latin4.pm
6 #
7 # http://search.cpan.org/dist/Char-Latin4/
8 #
9 # Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2018, 2019 INABA Hitoshi <ina@cpan.org>
10 ######################################################################
11  
12 422 ▶use 5.00503; # Galapagos Consensus 1998 for primetools
Subroutine BEGIN: called CC=1 SCAR=0.0
13 # use 5.008001; # Lancaster Consensus 2013 for toolchains
14  
15 # 12.3. Delaying use Until Runtime
16 # in Chapter 12. Packages, Libraries, and Modules
17 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
18 # (and so on)
19  
20 # Version numbers should be boring
21 # http://www.dagolden.com/index.php/369/version-numbers-should-be-boring/
22 # For the impatient, the disinterested or those who just want to follow
23 # a recipe, my advice for all modules is this:
24 # our $VERSION = "0.001"; # or "0.001_001" for a dev release
25 # $VERSION = eval $VERSION; # No!! because '1.10' makes '1.1'
26  
27 422 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
28 422 $VERSION = '1.15';
29 422 $VERSION = $VERSION;
30  
31 422 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=7.6
32 422 ▶ if ($^X =~ / jperl /oxmsi) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^X =~ / jperl /imosx) 0 422 422
33 0 die __FILE__, ": needs perl(not jperl) 5.00503 or later. (\$^X==$^X)\n";
34 }
35 422 if (CORE::ord('A') == 193) {
36 die __FILE__, ": is not US-ASCII script (may be EBCDIC or EBCDIK script).\n";
37 }
38 422 if (CORE::ord('A') != 0x41) {
39 die __FILE__, ": is not US-ASCII script (must be US-ASCII script).\n";
40 }
41 }
42  
43 422 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=9.5
44  
45 # instead of utf8.pm
46 422 ▶ CORE::eval q{
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
47 no warnings qw(redefine);
48 *utf8::upgrade = sub { CORE::length $_[0] };
49 *utf8::downgrade = sub { 1 };
50 *utf8::encode = sub { };
51 *utf8::decode = sub { 1 };
52 *utf8::is_utf8 = sub { };
53 *utf8::valid = sub { 1 };
54 };
55 422 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 422 422
56 0 ▶ *utf8::upgrade = sub { CORE::length $_[0] };
Subroutine __ANON__: not called CC=1 SCAR=6.9
57 0 ▶ *utf8::downgrade = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
58 0 ▶ *utf8::encode = sub { };
Subroutine __ANON__: not called CC=1 SCAR=6.9
59 0 ▶ *utf8::decode = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
60 0 ▶ *utf8::is_utf8 = sub { };
Subroutine __ANON__: not called CC=1 SCAR=6.9
61 0 ▶ *utf8::valid = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
62 }
63 }
64  
65 # instead of Symbol.pm
66 BEGIN {
67 0 ▶ sub gensym () {
Subroutine gensym: not called CC=2 SCAR=17.9
Pod undocumented
68 0 ▶ if ($] < 5.006) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] < 5.006) { } 0 0 0
69 0 return \do { local *_ };
70 }
71 else {
72 0 return undef;
73 }
74 }
75  
76 20 ▶ sub qualify ($$) {
Subroutine qualify: called CC=8 SCAR=28.9
Pod undocumented
77 20 my($name) = @_;
78  
79 20 ▶ if (ref $name) {
Branch: 7 branches
BranchTrueFalseTotal
if (ref $name) { } 5 15 20
elsif (&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
80 5 return $name;
81 }
82 elsif (Elatin4::index($name,'::') >= 0) {
83 0 return $name;
84 }
85 elsif (Elatin4::index($name,"'") >= 0) {
86 0 return $name;
87 }
88  
89 # special character, "^xyz"
90 elsif ($name =~ /\A \^ [ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]+ \z/x) {
91  
92 # RGS 2001-11-05 : translate leading ^X to control-char
93 0 $name =~ s{\A \^ ([ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]) }{'qq(\c'.$1.')'}xee;
94 0 return 'main::' . $name;
95 }
96  
97 # Global names
98 elsif ($name =~ /\A (?: ARGV | ARGVOUT | ENV | INC | SIG | STDERR | STDIN | STDOUT ) \z/x) {
99 0 return 'main::' . $name;
100 }
101  
102 # or other
103 elsif ($name =~ /\A [^ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz] \z/x) {
104 0 return 'main::' . $name;
105 }
106  
107 elsif (defined $_[1]) {
108 15 return $_[1] . '::' . $name;
109 }
110 else {
111 0 return (caller)[0] . '::' . $name;
112 }
113 }
114  
115 20 ▶ sub qualify_to_ref ($;$) {
Subroutine qualify_to_ref: called CC=2 SCAR=7.2
Pod undocumented
116 20 ▶ if (defined $_[1]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[1]) { } 20 0 20
117 422 ▶ no strict qw(refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
118 20 return \*{ qualify $_[0], $_[1] };
119 }
120 else {
121 422 ▶ no strict qw(refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: not called CC=1 SCAR=0.0
122 0 return \*{ qualify $_[0], (caller)[0] };
123 }
124 }
125 }
126  
127 # P.714 29.2.39. flock
128 # in Chapter 29: Functions
129 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
130  
131 # P.863 flock
132 # in Chapter 27: Functions
133 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
134  
135 sub LOCK_SH() {1}
136 sub LOCK_EX() {2}
137 sub LOCK_UN() {8}
138 sub LOCK_NB() {4}
139  
140 # instead of Carp.pm
141 sub carp;
142 sub croak;
143 sub cluck;
144 sub confess;
145  
146 # 6.18. Matching Multiple-Byte Characters
147 # in Chapter 6. Pattern Matching
148 # of ISBN 978-1-56592-243-3 Perl Perl Cookbook.
149 # (and so on)
150  
151 # regexp of character
152 422 my $your_char = q{[\x00-\xFF]};
153 422 ▶use vars qw($qq_char); $qq_char = qr/\\c[\x40-\x5F]|\\?(?:$your_char)/oxms;
Subroutine BEGIN: called CC=1 SCAR=0.0
154 422 ▶use vars qw($q_char); $q_char = qr/$your_char/oxms;
Subroutine BEGIN: called CC=1 SCAR=0.0
155  
156 #
157 # Latin-4 character range per length
158 #
159 422 my %range_tr = ();
160  
161 #
162 # Latin-4 case conversion
163 #
164 422 my %lc = ();
165 422 @lc{qw(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)} =
166 qw(a b c d e f g h i j k l m n o p q r s t u v w x y z);
167 422 my %uc = ();
168 422 @uc{qw(a b c d e f g h i j k l m n o p q r s t u v w x y z)} =
169 qw(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z);
170 422 my %fc = ();
171 422 @fc{qw(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)} =
172 qw(a b c d e f g h i j k l m n o p q r s t u v w x y z);
173  
174 422 ▶if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { __PACKAGE__ =~ / \b Elatin4 \z/mosx }) { } 422 0 422
175 }
176  
177 elsif (__PACKAGE__ =~ / \b Elatin4 \z/oxms) {
178 422 %range_tr = (
179 1 => [ [0x00..0xFF],
180 ],
181 );
182  
183 422 %lc = (%lc,
184 "\xA1" => "\xB1", # LATIN LETTER A WITH OGONEK
185 "\xA3" => "\xB3", # LATIN LETTER R WITH CEDILLA
186 "\xA5" => "\xB5", # LATIN LETTER I WITH TILDE
187 "\xA6" => "\xB6", # LATIN LETTER L WITH CEDILLA
188 "\xA9" => "\xB9", # LATIN LETTER S WITH CARON
189 "\xAA" => "\xBA", # LATIN LETTER E WITH MACRON
190 "\xAB" => "\xBB", # LATIN LETTER G WITH CEDILLA
191 "\xAC" => "\xBC", # LATIN LETTER T WITH STROKE
192 "\xAE" => "\xBE", # LATIN LETTER Z WITH CARON
193 "\xBD" => "\xBF", # LATIN LETTER ENG
194 "\xC0" => "\xE0", # LATIN LETTER A WITH MACRON
195 "\xC1" => "\xE1", # LATIN LETTER A WITH ACUTE
196 "\xC2" => "\xE2", # LATIN LETTER A WITH CIRCUMFLEX
197 "\xC3" => "\xE3", # LATIN LETTER A WITH TILDE
198 "\xC4" => "\xE4", # LATIN LETTER A WITH DIAERESIS
199 "\xC5" => "\xE5", # LATIN LETTER A WITH RING ABOVE
200 "\xC6" => "\xE6", # LATIN LETTER AE
201 "\xC7" => "\xE7", # LATIN LETTER I WITH OGONEK
202 "\xC8" => "\xE8", # LATIN LETTER C WITH CARON
203 "\xC9" => "\xE9", # LATIN LETTER E WITH ACUTE
204 "\xCA" => "\xEA", # LATIN LETTER E WITH OGONEK
205 "\xCB" => "\xEB", # LATIN LETTER E WITH DIAERESIS
206 "\xCC" => "\xEC", # LATIN LETTER E WITH DOT ABOVE
207 "\xCD" => "\xED", # LATIN LETTER I WITH ACUTE
208 "\xCE" => "\xEE", # LATIN LETTER I WITH CIRCUMFLEX
209 "\xCF" => "\xEF", # LATIN LETTER I WITH MACRON
210 "\xD0" => "\xF0", # LATIN LETTER D WITH STROKE
211 "\xD1" => "\xF1", # LATIN LETTER N WITH CEDILLA
212 "\xD2" => "\xF2", # LATIN LETTER O WITH MACRON
213 "\xD3" => "\xF3", # LATIN LETTER K WITH CEDILLA
214 "\xD4" => "\xF4", # LATIN LETTER O WITH CIRCUMFLEX
215 "\xD5" => "\xF5", # LATIN LETTER O WITH TILDE
216 "\xD6" => "\xF6", # LATIN LETTER O WITH DIAERESIS
217 "\xD8" => "\xF8", # LATIN LETTER O WITH STROKE
218 "\xD9" => "\xF9", # LATIN LETTER U WITH OGONEK
219 "\xDA" => "\xFA", # LATIN LETTER U WITH ACUTE
220 "\xDB" => "\xFB", # LATIN LETTER U WITH CIRCUMFLEX
221 "\xDC" => "\xFC", # LATIN LETTER U WITH DIAERESIS
222 "\xDD" => "\xFD", # LATIN LETTER U WITH TILDE
223 "\xDE" => "\xFE", # LATIN LETTER U WITH MACRON
224 );
225  
226 422 %uc = (%uc,
227 "\xB1" => "\xA1", # LATIN LETTER A WITH OGONEK
228 "\xB3" => "\xA3", # LATIN LETTER R WITH CEDILLA
229 "\xB5" => "\xA5", # LATIN LETTER I WITH TILDE
230 "\xB6" => "\xA6", # LATIN LETTER L WITH CEDILLA
231 "\xB9" => "\xA9", # LATIN LETTER S WITH CARON
232 "\xBA" => "\xAA", # LATIN LETTER E WITH MACRON
233 "\xBB" => "\xAB", # LATIN LETTER G WITH CEDILLA
234 "\xBC" => "\xAC", # LATIN LETTER T WITH STROKE
235 "\xBE" => "\xAE", # LATIN LETTER Z WITH CARON
236 "\xBF" => "\xBD", # LATIN LETTER ENG
237 "\xE0" => "\xC0", # LATIN LETTER A WITH MACRON
238 "\xE1" => "\xC1", # LATIN LETTER A WITH ACUTE
239 "\xE2" => "\xC2", # LATIN LETTER A WITH CIRCUMFLEX
240 "\xE3" => "\xC3", # LATIN LETTER A WITH TILDE
241 "\xE4" => "\xC4", # LATIN LETTER A WITH DIAERESIS
242 "\xE5" => "\xC5", # LATIN LETTER A WITH RING ABOVE
243 "\xE6" => "\xC6", # LATIN LETTER AE
244 "\xE7" => "\xC7", # LATIN LETTER I WITH OGONEK
245 "\xE8" => "\xC8", # LATIN LETTER C WITH CARON
246 "\xE9" => "\xC9", # LATIN LETTER E WITH ACUTE
247 "\xEA" => "\xCA", # LATIN LETTER E WITH OGONEK
248 "\xEB" => "\xCB", # LATIN LETTER E WITH DIAERESIS
249 "\xEC" => "\xCC", # LATIN LETTER E WITH DOT ABOVE
250 "\xED" => "\xCD", # LATIN LETTER I WITH ACUTE
251 "\xEE" => "\xCE", # LATIN LETTER I WITH CIRCUMFLEX
252 "\xEF" => "\xCF", # LATIN LETTER I WITH MACRON
253 "\xF0" => "\xD0", # LATIN LETTER D WITH STROKE
254 "\xF1" => "\xD1", # LATIN LETTER N WITH CEDILLA
255 "\xF2" => "\xD2", # LATIN LETTER O WITH MACRON
256 "\xF3" => "\xD3", # LATIN LETTER K WITH CEDILLA
257 "\xF4" => "\xD4", # LATIN LETTER O WITH CIRCUMFLEX
258 "\xF5" => "\xD5", # LATIN LETTER O WITH TILDE
259 "\xF6" => "\xD6", # LATIN LETTER O WITH DIAERESIS
260 "\xF8" => "\xD8", # LATIN LETTER O WITH STROKE
261 "\xF9" => "\xD9", # LATIN LETTER U WITH OGONEK
262 "\xFA" => "\xDA", # LATIN LETTER U WITH ACUTE
263 "\xFB" => "\xDB", # LATIN LETTER U WITH CIRCUMFLEX
264 "\xFC" => "\xDC", # LATIN LETTER U WITH DIAERESIS
265 "\xFD" => "\xDD", # LATIN LETTER U WITH TILDE
266 "\xFE" => "\xDE", # LATIN LETTER U WITH MACRON
267 );
268  
269 422 %fc = (%fc,
270 "\xA1" => "\xB1", # LATIN CAPITAL LETTER A WITH OGONEK --> LATIN SMALL LETTER A WITH OGONEK
271 "\xA3" => "\xB3", # LATIN CAPITAL LETTER R WITH CEDILLA --> LATIN SMALL LETTER R WITH CEDILLA
272 "\xA5" => "\xB5", # LATIN CAPITAL LETTER I WITH TILDE --> LATIN SMALL LETTER I WITH TILDE
273 "\xA6" => "\xB6", # LATIN CAPITAL LETTER L WITH CEDILLA --> LATIN SMALL LETTER L WITH CEDILLA
274 "\xA9" => "\xB9", # LATIN CAPITAL LETTER S WITH CARON --> LATIN SMALL LETTER S WITH CARON
275 "\xAA" => "\xBA", # LATIN CAPITAL LETTER E WITH MACRON --> LATIN SMALL LETTER E WITH MACRON
276 "\xAB" => "\xBB", # LATIN CAPITAL LETTER G WITH CEDILLA --> LATIN SMALL LETTER G WITH CEDILLA
277 "\xAC" => "\xBC", # LATIN CAPITAL LETTER T WITH STROKE --> LATIN SMALL LETTER T WITH STROKE
278 "\xAE" => "\xBE", # LATIN CAPITAL LETTER Z WITH CARON --> LATIN SMALL LETTER Z WITH CARON
279 "\xBD" => "\xBF", # LATIN CAPITAL LETTER ENG --> LATIN SMALL LETTER ENG
280 "\xC0" => "\xE0", # LATIN CAPITAL LETTER A WITH MACRON --> LATIN SMALL LETTER A WITH MACRON
281 "\xC1" => "\xE1", # LATIN CAPITAL LETTER A WITH ACUTE --> LATIN SMALL LETTER A WITH ACUTE
282 "\xC2" => "\xE2", # LATIN CAPITAL LETTER A WITH CIRCUMFLEX --> LATIN SMALL LETTER A WITH CIRCUMFLEX
283 "\xC3" => "\xE3", # LATIN CAPITAL LETTER A WITH TILDE --> LATIN SMALL LETTER A WITH TILDE
284 "\xC4" => "\xE4", # LATIN CAPITAL LETTER A WITH DIAERESIS --> LATIN SMALL LETTER A WITH DIAERESIS
285 "\xC5" => "\xE5", # LATIN CAPITAL LETTER A WITH RING ABOVE --> LATIN SMALL LETTER A WITH RING ABOVE
286 "\xC6" => "\xE6", # LATIN CAPITAL LETTER AE --> LATIN SMALL LETTER AE
287 "\xC7" => "\xE7", # LATIN CAPITAL LETTER I WITH OGONEK --> LATIN SMALL LETTER I WITH OGONEK
288 "\xC8" => "\xE8", # LATIN CAPITAL LETTER C WITH CARON --> LATIN SMALL LETTER C WITH CARON
289 "\xC9" => "\xE9", # LATIN CAPITAL LETTER E WITH ACUTE --> LATIN SMALL LETTER E WITH ACUTE
290 "\xCA" => "\xEA", # LATIN CAPITAL LETTER E WITH OGONEK --> LATIN SMALL LETTER E WITH OGONEK
291 "\xCB" => "\xEB", # LATIN CAPITAL LETTER E WITH DIAERESIS --> LATIN SMALL LETTER E WITH DIAERESIS
292 "\xCC" => "\xEC", # LATIN CAPITAL LETTER E WITH DOT ABOVE --> LATIN SMALL LETTER E WITH DOT ABOVE
293 "\xCD" => "\xED", # LATIN CAPITAL LETTER I WITH ACUTE --> LATIN SMALL LETTER I WITH ACUTE
294 "\xCE" => "\xEE", # LATIN CAPITAL LETTER I WITH CIRCUMFLEX --> LATIN SMALL LETTER I WITH CIRCUMFLEX
295 "\xCF" => "\xEF", # LATIN CAPITAL LETTER I WITH MACRON --> LATIN SMALL LETTER I WITH MACRON
296 "\xD0" => "\xF0", # LATIN CAPITAL LETTER D WITH STROKE --> LATIN SMALL LETTER D WITH STROKE
297 "\xD1" => "\xF1", # LATIN CAPITAL LETTER N WITH CEDILLA --> LATIN SMALL LETTER N WITH CEDILLA
298 "\xD2" => "\xF2", # LATIN CAPITAL LETTER O WITH MACRON --> LATIN SMALL LETTER O WITH MACRON
299 "\xD3" => "\xF3", # LATIN CAPITAL LETTER K WITH CEDILLA --> LATIN SMALL LETTER K WITH CEDILLA
300 "\xD4" => "\xF4", # LATIN CAPITAL LETTER O WITH CIRCUMFLEX --> LATIN SMALL LETTER O WITH CIRCUMFLEX
301 "\xD5" => "\xF5", # LATIN CAPITAL LETTER O WITH TILDE --> LATIN SMALL LETTER O WITH TILDE
302 "\xD6" => "\xF6", # LATIN CAPITAL LETTER O WITH DIAERESIS --> LATIN SMALL LETTER O WITH DIAERESIS
303 "\xD8" => "\xF8", # LATIN CAPITAL LETTER O WITH STROKE --> LATIN SMALL LETTER O WITH STROKE
304 "\xD9" => "\xF9", # LATIN CAPITAL LETTER U WITH OGONEK --> LATIN SMALL LETTER U WITH OGONEK
305 "\xDA" => "\xFA", # LATIN CAPITAL LETTER U WITH ACUTE --> LATIN SMALL LETTER U WITH ACUTE
306 "\xDB" => "\xFB", # LATIN CAPITAL LETTER U WITH CIRCUMFLEX --> LATIN SMALL LETTER U WITH CIRCUMFLEX
307 "\xDC" => "\xFC", # LATIN CAPITAL LETTER U WITH DIAERESIS --> LATIN SMALL LETTER U WITH DIAERESIS
308 "\xDD" => "\xFD", # LATIN CAPITAL LETTER U WITH TILDE --> LATIN SMALL LETTER U WITH TILDE
309 "\xDE" => "\xFE", # LATIN CAPITAL LETTER U WITH MACRON --> LATIN SMALL LETTER U WITH MACRON
310 "\xDF" => "\x73\x73", # LATIN SMALL LETTER SHARP S --> LATIN SMALL LETTER S, LATIN SMALL LETTER S
311 );
312 }
313  
314 else {
315 0 croak "Don't know my package name '@{[__PACKAGE__]}'";
316 }
317  
318 #
319 # @ARGV wildcard globbing
320 #
321 211 ▶sub import {
Subroutine import: called CC=7 SCAR=28.3
322  
323 211 ▶ if ($^O =~ /\A (?: MSWin32 | NetWare | symbian | dos ) \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O =~ /\A (?: MSWin32 | NetWare | symbian | dos ) \z/mosx) 0 211 211
324 0 my @argv = ();
325 0 for (@ARGV) {
326  
327 # has space
328 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
329 0 ▶ if (my @glob = Elatin4::glob(qq{"$_"})) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@glob) = &Elatin4::glob(qq["$_"])) { } 0 0 0
330 0 push @argv, @glob;
331 }
332 else {
333 0 push @argv, $_;
334 }
335 }
336  
337 # has wildcard metachar
338 elsif (/\A (?:$q_char)*? [*?] /oxms) {
339 0 ▶ if (my @glob = Elatin4::glob($_)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@glob) = &Elatin4::glob($_)) { } 0 0 0
340 0 push @argv, @glob;
341 }
342 else {
343 0 push @argv, $_;
344 }
345 }
346  
347 # no wildcard globbing
348 else {
349 0 push @argv, $_;
350 }
351 }
352 0 @ARGV = @argv;
353 }
354  
355 211 *Char::ord = \&Latin4::ord;
356 211 *Char::ord_ = \&Latin4::ord_;
357 211 *Char::reverse = \&Latin4::reverse;
358 211 *Char::getc = \&Latin4::getc;
359 211 *Char::length = \&Latin4::length;
360 211 *Char::substr = \&Latin4::substr;
361 211 *Char::index = \&Latin4::index;
362 211 *Char::rindex = \&Latin4::rindex;
363 211 *Char::eval = \&Latin4::eval;
364 211 *Char::escape = \&Latin4::escape;
365 211 *Char::escape_token = \&Latin4::escape_token;
366 211 *Char::escape_script = \&Latin4::escape_script;
367 }
368  
369 # P.230 Care with Prototypes
370 # in Chapter 6: Subroutines
371 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
372 #
373 # If you aren't careful, you can get yourself into trouble with prototypes.
374 # But if you are careful, you can do a lot of neat things with them. This is
375 # all very powerful, of course, and should only be used in moderation to make
376 # the world a better place.
377  
378 # P.332 Care with Prototypes
379 # in Chapter 7: Subroutines
380 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
381 #
382 # If you aren't careful, you can get yourself into trouble with prototypes.
383 # But if you are careful, you can do a lot of neat things with them. This is
384 # all very powerful, of course, and should only be used in moderation to make
385 # the world a better place.
386  
387 #
388 # Prototypes of subroutines
389 #
390 0 ▶sub unimport {}
Subroutine unimport: not called CC=1 SCAR=0.0
391 sub Elatin4::split(;$$$);
392 sub Elatin4::tr($$$$;$);
393 sub Elatin4::chop(@);
394 sub Elatin4::index($$;$);
395 sub Elatin4::rindex($$;$);
396 sub Elatin4::lcfirst(@);
397 sub Elatin4::lcfirst_();
398 sub Elatin4::lc(@);
399 sub Elatin4::lc_();
400 sub Elatin4::ucfirst(@);
401 sub Elatin4::ucfirst_();
402 sub Elatin4::uc(@);
403 sub Elatin4::uc_();
404 sub Elatin4::fc(@);
405 sub Elatin4::fc_();
406 sub Elatin4::ignorecase;
407 sub Elatin4::classic_character_class;
408 sub Elatin4::capture;
409 sub Elatin4::chr(;$);
410 sub Elatin4::chr_();
411 sub Elatin4::glob($);
412 sub Elatin4::glob_();
413  
414 sub Latin4::ord(;$);
415 sub Latin4::ord_();
416 sub Latin4::reverse(@);
417 sub Latin4::getc(;*@);
418 sub Latin4::length(;$);
419 sub Latin4::substr($$;$$);
420 sub Latin4::index($$;$);
421 sub Latin4::rindex($$;$);
422 sub Latin4::escape(;$);
423  
424 #
425 # Regexp work
426 #
427 422 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
428 $re_a
429 $re_t
430 $re_n
431 $re_r
432 422 );
433  
434 #
435 # Character class
436 #
437 422 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
438 $dot
439 $dot_s
440 $eD
441 $eS
442 $eW
443 $eH
444 $eV
445 $eR
446 $eN
447 $not_alnum
448 $not_alpha
449 $not_ascii
450 $not_blank
451 $not_cntrl
452 $not_digit
453 $not_graph
454 $not_lower
455 $not_lower_i
456 $not_print
457 $not_punct
458 $not_space
459 $not_upper
460 $not_upper_i
461 $not_word
462 $not_xdigit
463 $eb
464 $eB
465 422 );
466  
467 422 ${Elatin4::dot} = qr{(?>[^\x0A])};
468 422 ${Elatin4::dot_s} = qr{(?>[\x00-\xFF])};
469 422 ${Elatin4::eD} = qr{(?>[^0-9])};
470  
471 # Vertical tabs are now whitespace
472 # \s in a regex now matches a vertical tab in all circumstances.
473 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
474 # ${Elatin4::eS} = qr{(?>[^\x09\x0A \x0C\x0D\x20])};
475 # ${Elatin4::eS} = qr{(?>[^\x09\x0A\x0B\x0C\x0D\x20])};
476 422 ${Elatin4::eS} = qr{(?>[^\s])};
477  
478 422 ${Elatin4::eW} = qr{(?>[^0-9A-Z_a-z])};
479 422 ${Elatin4::eH} = qr{(?>[^\x09\x20])};
480 422 ${Elatin4::eV} = qr{(?>[^\x0A\x0B\x0C\x0D])};
481 422 ${Elatin4::eR} = qr{(?>\x0D\x0A|[\x0A\x0D])};
482 422 ${Elatin4::eN} = qr{(?>[^\x0A])};
483 422 ${Elatin4::not_alnum} = qr{(?>[^\x30-\x39\x41-\x5A\x61-\x7A])};
484 422 ${Elatin4::not_alpha} = qr{(?>[^\x41-\x5A\x61-\x7A])};
485 422 ${Elatin4::not_ascii} = qr{(?>[^\x00-\x7F])};
486 422 ${Elatin4::not_blank} = qr{(?>[^\x09\x20])};
487 422 ${Elatin4::not_cntrl} = qr{(?>[^\x00-\x1F\x7F])};
488 422 ${Elatin4::not_digit} = qr{(?>[^\x30-\x39])};
489 422 ${Elatin4::not_graph} = qr{(?>[^\x21-\x7F])};
490 422 ${Elatin4::not_lower} = qr{(?>[^\x61-\x7A])};
491 422 ${Elatin4::not_lower_i} = qr{(?>[^\x41-\x5A\x61-\x7A])}; # Perl 5.16 compatible
492 # ${Elatin4::not_lower_i} = qr{(?>[\x00-\xFF])}; # older Perl compatible
493 422 ${Elatin4::not_print} = qr{(?>[^\x20-\x7F])};
494 422 ${Elatin4::not_punct} = qr{(?>[^\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E])};
495 422 ${Elatin4::not_space} = qr{(?>[^\s\x0B])};
496 422 ${Elatin4::not_upper} = qr{(?>[^\x41-\x5A])};
497 422 ${Elatin4::not_upper_i} = qr{(?>[^\x41-\x5A\x61-\x7A])}; # Perl 5.16 compatible
498 # ${Elatin4::not_upper_i} = qr{(?>[\x00-\xFF])}; # older Perl compatible
499 422 ${Elatin4::not_word} = qr{(?>[^\x30-\x39\x41-\x5A\x5F\x61-\x7A])};
500 422 ${Elatin4::not_xdigit} = qr{(?>[^\x30-\x39\x41-\x46\x61-\x66])};
501 422 ${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))};
502 422 ${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]))};
503  
504 # avoid: Name "Elatin4::foo" used only once: possible typo at here.
505 422 ${Elatin4::dot} = ${Elatin4::dot};
506 422 ${Elatin4::dot_s} = ${Elatin4::dot_s};
507 422 ${Elatin4::eD} = ${Elatin4::eD};
508 422 ${Elatin4::eS} = ${Elatin4::eS};
509 422 ${Elatin4::eW} = ${Elatin4::eW};
510 422 ${Elatin4::eH} = ${Elatin4::eH};
511 422 ${Elatin4::eV} = ${Elatin4::eV};
512 422 ${Elatin4::eR} = ${Elatin4::eR};
513 422 ${Elatin4::eN} = ${Elatin4::eN};
514 422 ${Elatin4::not_alnum} = ${Elatin4::not_alnum};
515 422 ${Elatin4::not_alpha} = ${Elatin4::not_alpha};
516 422 ${Elatin4::not_ascii} = ${Elatin4::not_ascii};
517 422 ${Elatin4::not_blank} = ${Elatin4::not_blank};
518 422 ${Elatin4::not_cntrl} = ${Elatin4::not_cntrl};
519 422 ${Elatin4::not_digit} = ${Elatin4::not_digit};
520 422 ${Elatin4::not_graph} = ${Elatin4::not_graph};
521 422 ${Elatin4::not_lower} = ${Elatin4::not_lower};
522 422 ${Elatin4::not_lower_i} = ${Elatin4::not_lower_i};
523 422 ${Elatin4::not_print} = ${Elatin4::not_print};
524 422 ${Elatin4::not_punct} = ${Elatin4::not_punct};
525 422 ${Elatin4::not_space} = ${Elatin4::not_space};
526 422 ${Elatin4::not_upper} = ${Elatin4::not_upper};
527 422 ${Elatin4::not_upper_i} = ${Elatin4::not_upper_i};
528 422 ${Elatin4::not_word} = ${Elatin4::not_word};
529 422 ${Elatin4::not_xdigit} = ${Elatin4::not_xdigit};
530 422 ${Elatin4::eb} = ${Elatin4::eb};
531 422 ${Elatin4::eB} = ${Elatin4::eB};
532  
533 #
534 # Latin-4 split
535 #
536 72 ▶sub Elatin4::split(;$$$) {
Subroutine split: called CC=34 SCAR=46.9
Pod undocumented
537  
538 # P.794 29.2.161. split
539 # in Chapter 29: Functions
540 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
541  
542 # P.951 split
543 # in Chapter 27: Functions
544 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
545  
546 72 my $pattern = $_[0];
547 72 my $string = $_[1];
548 72 my $limit = $_[2];
549  
550 # if $pattern is also omitted or is the literal space, " "
551 72 ▶ if (not defined $pattern) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $pattern) 2 70 72
552 2 $pattern = ' ';
553 }
554  
555 # if $string is omitted, the function splits the $_ string
556 72 ▶ if (not defined $string) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $string) 6 66 72
557 6 ▶ if (defined $_) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_) { } 0 6 6
558 0 $string = $_;
559 }
560 else {
561 6 $string = '';
562 }
563 }
564  
565 72 my @split = ();
566  
567 # when string is empty
568 72 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 10 62 72
elsif ($pattern eq ' ') { } 2 60 62
569  
570 # resulting list value in list context
571 10 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 5 5 10
572 5 return @split;
573 }
574  
575 # count of substrings in scalar context
576 else {
577 5 ▶ carp "Use of implicit split to \@_ is deprecated" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 5 5
578 5 @_ = @split;
579 5 return scalar @_;
580 }
581 }
582  
583 # split's first argument is more consistently interpreted
584 #
585 # After some changes earlier in v5.17, split's behavior has been simplified:
586 # if the PATTERN argument evaluates to a string containing one space, it is
587 # treated the way that a literal string containing one space once was.
588 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#split's_first_argument_is_more_consistently_interpreted
589  
590 # if $pattern is also omitted or is the literal space, " ", the function splits
591 # on whitespace, /\s+/, after skipping any leading whitespace
592 # (and so on)
593  
594 elsif ($pattern eq ' ') {
595 2 ▶ if (not defined $limit) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $limit) { } 2 0 2
596 2 return CORE::split(' ', $string);
597 }
598 else {
599 0 return CORE::split(' ', $string, $limit);
600 }
601 }
602  
603 # if $limit is negative, it is treated as if an arbitrarily large $limit has been specified
604 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
605  
606 # a pattern capable of matching either the null string or something longer than the
607 # null string will split the value of $string into separate characters wherever it
608 # matches the null string between characters
609 # (and so on)
610  
611 60 ▶ if ('' =~ / \A $pattern \z /xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ('' =~ / \A $pattern \z /msx) { } 2 58 60
612 2 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
613 2 my $limit = scalar(() = $string =~ /($pattern)/oxmsg);
614  
615 # P.1024 Appendix W.10 Multibyte Processing
616 # of ISBN 1-56592-224-7 CJKV Information Processing
617 # (and so on)
618  
619 # the //m modifier is assumed when you split on the pattern /^/
620 # (and so on)
621  
622 # V
623 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
624  
625 # if the $pattern contains parentheses, then the substring matched by each pair of parentheses
626 # is included in the resulting list, interspersed with the fields that are ordinarily returned
627 # (and so on)
628  
629 9 local $@;
630 9 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 9 9 18
631 9 push @split, CORE::eval('$' . $digit);
632 }
633 }
634 }
635  
636 else {
637 58 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
638  
639 # V
640 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
641 163 local $@;
642 163 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 230 163 393
643 230 push @split, CORE::eval('$' . $digit);
644 }
645 }
646 }
647 }
648  
649 elsif ($limit > 0) {
650 0 ▶ if ('' =~ / \A $pattern \z /xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ('' =~ / \A $pattern \z /msx) { } 0 0 0
651 0 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
652 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
653  
654 # V
655 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
656 0 local $@;
657 0 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 0 0 0
658 0 push @split, CORE::eval('$' . $digit);
659 }
660 }
661 }
662 }
663 else {
664 0 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
665 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
666  
667 # V
668 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
669 0 local $@;
670 0 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 0 0 0
671 0 push @split, CORE::eval('$' . $digit);
672 }
673 }
674 }
675 }
676 }
677  
678 60 ▶ if (CORE::length($string) > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $string > 0) 58 2 60
679 58 push @split, $string;
680 }
681  
682 # if $_[2] (NOT "$limit") is omitted or zero, trailing null fields are stripped from the result
683 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
684 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
685 0 pop @split;
686 }
687 }
688  
689 # resulting list value in list context
690 60 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 58 2 60
691 58 return @split;
692 }
693  
694 # count of substrings in scalar context
695 else {
696 2 ▶ carp "Use of implicit split to \@_ is deprecated" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 2 2
697 2 @_ = @split;
698 2 return scalar @_;
699 }
700 }
701  
702 #
703 # get last subexpression offsets
704 #
705 60 ▶sub _last_subexpression_offsets {
Subroutine _last_subexpression_offsets: called CC=3 SCAR=11.0
706 60 my $pattern = $_[0];
707  
708 # remove comment
709 60 $pattern =~ s/\(\?\# .*? \)//oxmsg;
710  
711 60 my $modifier = '';
712 60 ▶ if ($pattern =~ /\(\?\^? ([\-A-Za-z]+) :/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pattern =~ /\(\?\^? ([\-A-Za-z]+) :/mosx) 11 49 60
713 11 $modifier = $1;
714 11 $modifier =~ s/-[A-Za-z]*//;
715 }
716  
717 # with /x modifier
718 60 my @char = ();
719 60 ▶ if ($modifier =~ /x/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /x/mosx) { } 5 55 60
720 5 @char = $pattern =~ /\G((?>
721 [^\\\#\[\(] |
722 \\ $q_char |
723 \# (?>[^\n]*) $ |
724 \[ (?>(?:[^\\\]]|\\\\|\\\]|$q_char)+) \] |
725 \(\? |
726 $q_char
727 ))/oxmsg;
728 }
729  
730 # without /x modifier
731 else {
732 55 @char = $pattern =~ /\G((?>
733 [^\\\[\(] |
734 \\ $q_char |
735 \[ (?>(?:[^\\\]]|\\\\|\\\]|$q_char)+) \] |
736 \(\? |
737 $q_char
738 ))/oxmsg;
739 }
740  
741 60 return scalar grep { $_ eq '(' } @char;
742 }
743  
744 #
745 # Latin-4 transliteration (tr///)
746 #
747 6 ▶sub Elatin4::tr($$$$;$) {
Subroutine tr: called CC=26 SCAR=48.6
Pod undocumented
748  
749 6 my $bind_operator = $_[1];
750 6 my $searchlist = $_[2];
751 6 my $replacementlist = $_[3];
752 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
753  
754 6 ▶ if ($modifier =~ /r/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /r/mosx) 5 1 6
755 5 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) 0 5 5
756 0 croak "Using !~ with tr///r doesn't make sense";
757 }
758 }
759  
760 6 my @char = $_[0] =~ /\G (?>$q_char) /oxmsg;
761 6 my @searchlist = _charlist_tr($searchlist);
762 6 my @replacementlist = _charlist_tr($replacementlist);
763  
764 6 my %tr = ();
765 6 ▶ for (my $i=0; $i <= $#searchlist; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#searchlist) 19 6 25
766 19 ▶ if (not exists $tr{$searchlist[$i]}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $tr{$searchlist[$i]}) 19 0 19
767 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
768 19 $tr{$searchlist[$i]} = $replacementlist[$i];
769 }
770 elsif ($modifier =~ /d/oxms) {
771 0 $tr{$searchlist[$i]} = '';
772 }
773 ▶ 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
774 0 $tr{$searchlist[$i]} = $replacementlist[-1];
775 }
776 else {
777 0 $tr{$searchlist[$i]} = $searchlist[$i];
778 }
779 }
780 }
781  
782 6 my $tr = 0;
783 6 my $replaced = '';
784 6 ▶ if ($modifier =~ /c/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /c/mosx) { } 0 6 6
785 0 ▶ while (defined(my $char = shift @char)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $char = shift @char)) 0 0 0
786 0 ▶ if (not exists $tr{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $tr{$char}) { } 0 0 0
787 0 ▶ if (defined $replacementlist[0]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $replacementlist[0]) 0 0 0
788 0 $replaced .= $replacementlist[0];
789 }
790 0 $tr++;
791 0 ▶ if ($modifier =~ /s/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/mosx) 0 0 0
792 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
793 0 shift @char;
794 0 $tr++;
795 }
796 }
797 }
798 else {
799 0 $replaced .= $char;
800 }
801 }
802 }
803 else {
804 6 ▶ while (defined(my $char = shift @char)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $char = shift @char)) 36 6 42
805 36 ▶ if (exists $tr{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $tr{$char}) { } 19 17 36
806 19 $replaced .= $tr{$char};
807 19 $tr++;
808 19 ▶ if ($modifier =~ /s/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/mosx) 0 19 19
809 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
810 0 shift @char;
811 0 $tr++;
812 }
813 }
814 }
815 else {
816 17 $replaced .= $char;
817 }
818 }
819 }
820  
821 6 ▶ if ($modifier =~ /r/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /r/mosx) { } 5 1 6
822 5 return $replaced;
823 }
824 else {
825 1 $_[0] = $replaced;
826 1 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) { } 0 1 1
827 0 return not $tr;
828 }
829 else {
830 1 return $tr;
831 }
832 }
833 }
834  
835 #
836 # Latin-4 chop
837 #
838 0 ▶sub Elatin4::chop(@) {
Subroutine chop: not called CC=3 SCAR=24.8
Pod undocumented
839  
840 0 my $chop;
841 0 ▶ if (@_ == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 0) { } 0 0 0
842 0 my @char = /\G (?>$q_char) /oxmsg;
843 0 $chop = pop @char;
844 0 $_ = join '', @char;
845 }
846 else {
847 0 for (@_) {
848 0 my @char = /\G (?>$q_char) /oxmsg;
849 0 $chop = pop @char;
850 0 $_ = join '', @char;
851 }
852 }
853 0 return $chop;
854 }
855  
856 #
857 # Latin-4 index by octet
858 #
859 30 ▶sub Elatin4::index($$;$) {
Subroutine index: called CC=6 SCAR=20.8
Pod documented
860  
861 30 my($str,$substr,$position) = @_;
862 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
863 30 my $pos = 0;
864  
865 30 ▶ while ($pos < CORE::length($str)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos < length $str) 130 30 160
866 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
867 0 ▶ if ($pos >= $position) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos >= $position) 0 0 0
868 0 return $pos;
869 }
870 }
871 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
872 130 $pos += CORE::length($1);
873 }
874 else {
875 0 $pos += 1;
876 }
877 }
878 30 return -1;
879 }
880  
881 #
882 # Latin-4 reverse index
883 #
884 0 ▶sub Elatin4::rindex($$;$) {
Subroutine rindex: not called CC=6 SCAR=37.4
Pod undocumented
885  
886 0 my($str,$substr,$position) = @_;
887 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
888 0 my $pos = 0;
889 0 my $rindex = -1;
890  
891 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
892 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
893 0 $rindex = $pos;
894 }
895 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
896 0 $pos += CORE::length($1);
897 }
898 else {
899 0 $pos += 1;
900 }
901 }
902 0 return $rindex;
903 }
904  
905 #
906 # Latin-4 lower case first with parameter
907 #
908 0 ▶sub Elatin4::lcfirst(@) {
Subroutine lcfirst: not called CC=4 SCAR=30.0
Pod undocumented
909 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
910 0 my $s = shift @_;
911 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
912 0 return Elatin4::lc(CORE::substr($s,0,1)) . CORE::substr($s,1), @_;
913 }
914 else {
915 0 return Elatin4::lc(CORE::substr($s,0,1)) . CORE::substr($s,1);
916 }
917 }
918 else {
919 0 return Elatin4::lc(CORE::substr($_,0,1)) . CORE::substr($_,1);
920 }
921 }
922  
923 #
924 # Latin-4 lower case first without parameter
925 #
926 0 ▶sub Elatin4::lcfirst_() {
Subroutine lcfirst_: not called CC=1 SCAR=6.9
Pod undocumented
927 0 return Elatin4::lc(CORE::substr($_,0,1)) . CORE::substr($_,1);
928 }
929  
930 #
931 # Latin-4 lower case with parameter
932 #
933 67 ▶sub Elatin4::lc(@) {
Subroutine lc: called CC=6 SCAR=24.2
Pod undocumented
934 67 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 67 0 67
935 67 my $s = shift @_;
936 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
937 0 ▶ return join('', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 0 0 0
938 }
939 else {
940 67 ▶ return join('', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 69 0 69
941 }
942 }
943 else {
944 0 return Elatin4::lc_();
945 }
946 }
947  
948 #
949 # Latin-4 lower case without parameter
950 #
951 0 ▶sub Elatin4::lc_() {
Subroutine lc_: not called CC=2 SCAR=17.9
Pod undocumented
952 0 my $s = $_;
953 0 ▶ return join '', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 0 0 0
954 }
955  
956 #
957 # Latin-4 upper case first with parameter
958 #
959 0 ▶sub Elatin4::ucfirst(@) {
Subroutine ucfirst: not called CC=4 SCAR=30.0
Pod undocumented
960 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
961 0 my $s = shift @_;
962 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
963 0 return Elatin4::uc(CORE::substr($s,0,1)) . CORE::substr($s,1), @_;
964 }
965 else {
966 0 return Elatin4::uc(CORE::substr($s,0,1)) . CORE::substr($s,1);
967 }
968 }
969 else {
970 0 return Elatin4::uc(CORE::substr($_,0,1)) . CORE::substr($_,1);
971 }
972 }
973  
974 #
975 # Latin-4 upper case first without parameter
976 #
977 0 ▶sub Elatin4::ucfirst_() {
Subroutine ucfirst_: not called CC=1 SCAR=6.9
Pod undocumented
978 0 return Elatin4::uc(CORE::substr($_,0,1)) . CORE::substr($_,1);
979 }
980  
981 #
982 # Latin-4 upper case with parameter
983 #
984 2555 ▶sub Elatin4::uc(@) {
Subroutine uc: called CC=6 SCAR=22.9
Pod undocumented
985 2555 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2555 0 2555
986 2555 my $s = shift @_;
987 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
988 0 ▶ return join('', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 0 0 0
989 }
990 else {
991 2555 ▶ return join('', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 913 1644 2557
992 }
993 }
994 else {
995 0 return Elatin4::uc_();
996 }
997 }
998  
999 #
1000 # Latin-4 upper case without parameter
1001 #
1002 0 ▶sub Elatin4::uc_() {
Subroutine uc_: not called CC=2 SCAR=17.9
Pod undocumented
1003 0 my $s = $_;
1004 0 ▶ return join '', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 0 0 0
1005 }
1006  
1007 #
1008 # Latin-4 fold case with parameter
1009 #
1010 2559 ▶sub Elatin4::fc(@) {
Subroutine fc: called CC=6 SCAR=22.9
Pod undocumented
1011 2559 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2559 0 2559
1012 2559 my $s = shift @_;
1013 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
1014 0 ▶ return join('', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 0 0 0
1015 }
1016 else {
1017 2559 ▶ return join('', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 1979 6199 8178
1018 }
1019 }
1020 else {
1021 0 return Elatin4::fc_();
1022 }
1023 }
1024  
1025 #
1026 # Latin-4 fold case without parameter
1027 #
1028 0 ▶sub Elatin4::fc_() {
Subroutine fc_: not called CC=2 SCAR=17.9
Pod undocumented
1029 0 my $s = $_;
1030 0 ▶ return join '', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 0 0 0
1031 }
1032  
1033 #
1034 # Latin-4 regexp capture
1035 #
1036 {
1037 0 ▶ sub Elatin4::capture {
Subroutine capture: not called CC=1 SCAR=6.9
Pod documented
1038 0 return $_[0];
1039 }
1040 }
1041  
1042 #
1043 # Latin-4 regexp ignore case modifier
1044 #
1045 422 ▶sub Elatin4::ignorecase {
Subroutine ignorecase: called CC=25 SCAR=52.1
Pod undocumented
1046  
1047 11 my @string = @_;
1048 11 my $metachar = qr/[\@\\|[\]{]/oxms;
1049  
1050 # ignore case of $scalar or @array
1051 11 for my $string (@string) {
1052  
1053 # split regexp
1054 11 my @char = $string =~ /\G (?>\[\^|\\$q_char|$q_char) /oxmsg;
1055  
1056 # unescape character
1057 11 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1084 11 1095
1058 1084 ▶ next if not defined $char[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $char[$i] 0 1084 1084
1059  
1060 # open character class [...]
1061 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
1062 0 my $left = $i;
1063  
1064 # [] make die "unmatched [] in regexp ...\n"
1065  
1066 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
1067 0 $i++;
1068 }
1069  
1070 0 while (1) {
1071 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
1072 0 croak "Unmatched [] in regexp";
1073 }
1074 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
1075 0 my $right = $i;
1076 0 my @charlist = charlist_qr(@char[$left+1..$right-1], 'i');
1077  
1078 # escape character
1079 0 for my $char (@charlist) {
1080 0 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $char =~ /\A [.|)] \z/mosx }) 0 0 0
1081 }
1082  
1083 0 elsif ($char =~ /\A [.|)] \z/oxms) {
1084 0 $char = '\\' . $char;
1085 }
1086 }
1087  
1088 # [...]
1089 0 splice @char, $left, $right-$left+1, '(?:' . join('|', @charlist) . ')';
1090  
1091 0 $i = $left;
1092 0 last;
1093 }
1094 }
1095 }
1096  
1097 # open character class [^...]
1098 elsif ($char[$i] eq '[^') {
1099 0 my $left = $i;
1100  
1101 # [^] make die "unmatched [] in regexp ...\n"
1102  
1103 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
1104 0 $i++;
1105 }
1106  
1107 0 while (1) {
1108 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
1109 0 croak "Unmatched [] in regexp";
1110 }
1111 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
1112 0 my $right = $i;
1113 0 my @charlist = charlist_not_qr(@char[$left+1..$right-1], 'i');
1114  
1115 # escape character
1116 0 for my $char (@charlist) {
1117 0 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $char =~ /\A [.|)] \z/mosx }) 0 0 0
1118 }
1119  
1120 0 elsif ($char =~ /\A [.|)] \z/oxms) {
1121 0 $char = '\\' . $char;
1122 }
1123 }
1124  
1125 # [^...]
1126 0 splice @char, $left, $right-$left+1, '(?!' . join('|', @charlist) . ")(?:$your_char)";
1127  
1128 0 $i = $left;
1129 0 last;
1130 }
1131 }
1132 }
1133  
1134 # rewrite classic character class or escape character
1135 elsif (my $char = classic_character_class($char[$i])) {
1136 0 $char[$i] = $char;
1137 }
1138  
1139 # with /i modifier
1140 elsif ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) {
1141 1084 my $uc = Elatin4::uc($char[$i]);
1142 1084 my $fc = Elatin4::fc($char[$i]);
1143 1084 ▶ if ($uc ne $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc ne $fc) 556 528 1084
1144 556 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 553 3 556
1145 553 $char[$i] = '[' . $uc . $fc . ']';
1146 }
1147 else {
1148 3 $char[$i] = '(?:' . $uc . '|' . $fc . ')';
1149 }
1150 }
1151 }
1152 }
1153  
1154 # characterize
1155 11 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1084 11 1095
1156 1084 ▶ next if not defined $char[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $char[$i] 0 1084 1084
1157  
1158 1084 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx }) 0 1095 1095
1159 }
1160  
1161 # quote character before ? + * {
1162 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
1163 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
1164 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
1165 }
1166 }
1167 }
1168  
1169 11 $string = join '', @char;
1170 }
1171  
1172 # make regexp string
1173 11 return @string;
1174 }
1175  
1176 #
1177 # classic character class ( \D \S \W \d \s \w \C \X \H \V \h \v \R \N \b \B )
1178 #
1179 2952 ▶sub Elatin4::classic_character_class {
Subroutine classic_character_class: called CC=2 SCAR=6.9
Pod undocumented
1180 2952 my($char) = @_;
1181  
1182 return {
1183 '\D' => '${Elatin4::eD}',
1184 '\S' => '${Elatin4::eS}',
1185 '\W' => '${Elatin4::eW}',
1186 '\d' => '[0-9]',
1187  
1188 # Before Perl 5.6, \s only matched the five whitespace characters
1189 # tab, newline, form-feed, carriage return, and the space character
1190 # itself, which, taken together, is the character class [\t\n\f\r ].
1191  
1192 # Vertical tabs are now whitespace
1193 # \s in a regex now matches a vertical tab in all circumstances.
1194 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
1195 # \t \n \v \f \r space
1196 # '\s' => '[\x09\x0A \x0C\x0D\x20]',
1197 # '\s' => '[\x09\x0A\x0B\x0C\x0D\x20]',
1198 '\s' => '\s',
1199  
1200 '\w' => '[0-9A-Z_a-z]',
1201 '\C' => '[\x00-\xFF]',
1202 '\X' => 'X',
1203  
1204 # \h \v \H \V
1205  
1206 # P.114 Character Class Shortcuts
1207 # in Chapter 7: In the World of Regular Expressions
1208 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
1209  
1210 # P.357 13.2.3 Whitespace
1211 # in Chapter 13: perlrecharclass: Perl Regular Expression Character Classes
1212 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
1213 #
1214 # 0x00009 CHARACTER TABULATION h s
1215 # 0x0000a LINE FEED (LF) vs
1216 # 0x0000b LINE TABULATION v
1217 # 0x0000c FORM FEED (FF) vs
1218 # 0x0000d CARRIAGE RETURN (CR) vs
1219 # 0x00020 SPACE h s
1220  
1221 # P.196 Table 5-9. Alphanumeric regex metasymbols
1222 # in Chapter 5. Pattern Matching
1223 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1224  
1225 # (and so on)
1226  
1227 '\H' => '${Elatin4::eH}',
1228 '\V' => '${Elatin4::eV}',
1229 '\h' => '[\x09\x20]',
1230 '\v' => '[\x0A\x0B\x0C\x0D]',
1231 '\R' => '${Elatin4::eR}',
1232  
1233 # \N
1234 #
1235 # http://perldoc.perl.org/perlre.html
1236 # Character Classes and other Special Escapes
1237 # Any character but \n (experimental). Not affected by /s modifier
1238  
1239 '\N' => '${Elatin4::eN}',
1240  
1241 # \b \B
1242  
1243 # P.180 Boundaries: The \b and \B Assertions
1244 # in Chapter 5: Pattern Matching
1245 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
1246  
1247 # P.219 Boundaries: The \b and \B Assertions
1248 # in Chapter 5: Pattern Matching
1249 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1250  
1251 # \b really means (?:(?<=\w)(?!\w)|(?<!\w)(?=\w))
1252 # or (?:(?<=\A|\W)(?=\w)|(?<=\w)(?=\W|\z))
1253 '\b' => '${Elatin4::eb}',
1254  
1255 # \B really means (?:(?<=\w)(?=\w)|(?<!\w)(?!\w))
1256 # or (?:(?<=\w)(?=\w)|(?<=\W)(?=\W))
1257 '\B' => '${Elatin4::eB}',
1258  
1259 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
1260 }
1261  
1262 #
1263 # prepare Latin-4 characters per length
1264 #
1265  
1266 # 1 octet characters
1267 422 my @chars1 = ();
1268 0 ▶sub chars1 {
Subroutine chars1: not called CC=5 SCAR=34.0
Pod undocumented
1269 0 ▶ if (@chars1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars1) 0 0 0
1270 0 return @chars1;
1271 }
1272 0 ▶ if (exists $range_tr{1}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{1}) 0 0 0
1273 0 my @ranges = @{ $range_tr{1} };
1274 0 ▶ while (my @range = splice(@ranges,0,1)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 1)) 0 0 0
1275 0 for my $oct0 (@{$range[0]}) {
1276 0 push @chars1, pack 'C', $oct0;
1277 }
1278 }
1279 }
1280 0 return @chars1;
1281 }
1282  
1283 # 2 octets characters
1284 422 my @chars2 = ();
1285 0 ▶sub chars2 {
Subroutine chars2: not called CC=6 SCAR=37.4
Pod undocumented
1286 0 ▶ if (@chars2) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars2) 0 0 0
1287 0 return @chars2;
1288 }
1289 0 ▶ if (exists $range_tr{2}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{2}) 0 0 0
1290 0 my @ranges = @{ $range_tr{2} };
1291 0 ▶ while (my @range = splice(@ranges,0,2)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 2)) 0 0 0
1292 0 for my $oct0 (@{$range[0]}) {
1293 0 for my $oct1 (@{$range[1]}) {
1294 0 push @chars2, pack 'CC', $oct0,$oct1;
1295 }
1296 }
1297 }
1298 }
1299 0 return @chars2;
1300 }
1301  
1302 # 3 octets characters
1303 422 my @chars3 = ();
1304 0 ▶sub chars3 {
Subroutine chars3: not called CC=7 SCAR=40.3
Pod undocumented
1305 0 ▶ if (@chars3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars3) 0 0 0
1306 0 return @chars3;
1307 }
1308 0 ▶ if (exists $range_tr{3}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{3}) 0 0 0
1309 0 my @ranges = @{ $range_tr{3} };
1310 0 ▶ while (my @range = splice(@ranges,0,3)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 3)) 0 0 0
1311 0 for my $oct0 (@{$range[0]}) {
1312 0 for my $oct1 (@{$range[1]}) {
1313 0 for my $oct2 (@{$range[2]}) {
1314 0 push @chars3, pack 'CCC', $oct0,$oct1,$oct2;
1315 }
1316 }
1317 }
1318 }
1319 }
1320 0 return @chars3;
1321 }
1322  
1323 # 4 octets characters
1324 422 my @chars4 = ();
1325 0 ▶sub chars4 {
Subroutine chars4: not called CC=8 SCAR=42.8
Pod undocumented
1326 0 ▶ if (@chars4) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars4) 0 0 0
1327 0 return @chars4;
1328 }
1329 0 ▶ if (exists $range_tr{4}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{4}) 0 0 0
1330 0 my @ranges = @{ $range_tr{4} };
1331 0 ▶ while (my @range = splice(@ranges,0,4)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 4)) 0 0 0
1332 0 for my $oct0 (@{$range[0]}) {
1333 0 for my $oct1 (@{$range[1]}) {
1334 0 for my $oct2 (@{$range[2]}) {
1335 0 for my $oct3 (@{$range[3]}) {
1336 0 push @chars4, pack 'CCCC', $oct0,$oct1,$oct2,$oct3;
1337 }
1338 }
1339 }
1340 }
1341 }
1342 }
1343 0 return @chars4;
1344 }
1345  
1346 #
1347 # Latin-4 open character list for tr
1348 #
1349 12 ▶sub _charlist_tr {
Subroutine _charlist_tr: called CC=35 SCAR=66.4
1350  
1351 12 local $_ = shift @_;
1352  
1353 # unescape character
1354 12 my @char = ();
1355 12 ▶ while (not /\G \z/oxmsgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgmosx) 38 12 50
1356 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
1357 0 push @char, '\-';
1358 }
1359 elsif (/\G \\ ([0-7]{2,3}) /oxmsgc) {
1360 0 push @char, CORE::chr(oct $1);
1361 }
1362 elsif (/\G \\x ([0-9A-Fa-f]{1,2}) /oxmsgc) {
1363 0 push @char, CORE::chr(hex $1);
1364 }
1365 elsif (/\G \\c ([\x40-\x5F]) /oxmsgc) {
1366 0 push @char, CORE::chr(CORE::ord($1) & 0x1F);
1367 }
1368 elsif (/\G (\\ [0nrtfbae]) /oxmsgc) {
1369 push @char, {
1370 '\0' => "\0",
1371 '\n' => "\n",
1372 '\r' => "\r",
1373 '\t' => "\t",
1374 '\f' => "\f",
1375 '\b' => "\x08", # \b means backspace in character class
1376 '\a' => "\a",
1377 '\e' => "\e",
1378 0 }->{$1};
1379 }
1380 elsif (/\G \\ ($q_char) /oxmsgc) {
1381 0 push @char, $1;
1382 }
1383 elsif (/\G ($q_char) /oxmsgc) {
1384 38 push @char, $1;
1385 }
1386 }
1387  
1388 # join separated multiple-octet
1389 12 @char = join('',@char) =~ /\G (?>\\-|$q_char) /oxmsg;
1390  
1391 # unescape '-'
1392 12 my @i = ();
1393 12 for my $i (0 .. $#char) {
1394 38 ▶ if ($char[$i] eq '\-') {
Branch: 2 branches
BranchTrueFalseTotal
if ($char[$i] eq '\\-') { } 0 38 38
elsif ($char[$i] eq '-') { } 0 38 38
1395 0 $char[$i] = '-';
1396 }
1397 elsif ($char[$i] eq '-') {
1398 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
1399 0 push @i, $i;
1400 }
1401 }
1402 }
1403  
1404 # open character list (reverse for splice)
1405 12 for my $i (CORE::reverse @i) {
1406 0 my @range = ();
1407  
1408 # range error
1409 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
1410 0 croak "Invalid tr/// range \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1411 }
1412  
1413 # range of multiple-octet code
1414 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
1415 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
1416 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
1417 }
1418 elsif (CORE::length($char[$i+1]) == 2) {
1419 0 push @range, grep {$char[$i-1] le $_} chars1();
1420 0 push @range, grep {$_ le $char[$i+1]} chars2();
1421 }
1422 elsif (CORE::length($char[$i+1]) == 3) {
1423 0 push @range, grep {$char[$i-1] le $_} chars1();
1424 0 push @range, chars2();
1425 0 push @range, grep {$_ le $char[$i+1]} chars3();
1426 }
1427 elsif (CORE::length($char[$i+1]) == 4) {
1428 0 push @range, grep {$char[$i-1] le $_} chars1();
1429 0 push @range, chars2();
1430 0 push @range, chars3();
1431 0 push @range, grep {$_ le $char[$i+1]} chars4();
1432 }
1433 else {
1434 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1435 }
1436 }
1437 elsif (CORE::length($char[$i-1]) == 2) {
1438 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
1439 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
1440 }
1441 elsif (CORE::length($char[$i+1]) == 3) {
1442 0 push @range, grep {$char[$i-1] le $_} chars2();
1443 0 push @range, grep {$_ le $char[$i+1]} chars3();
1444 }
1445 elsif (CORE::length($char[$i+1]) == 4) {
1446 0 push @range, grep {$char[$i-1] le $_} chars2();
1447 0 push @range, chars3();
1448 0 push @range, grep {$_ le $char[$i+1]} chars4();
1449 }
1450 else {
1451 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1452 }
1453 }
1454 elsif (CORE::length($char[$i-1]) == 3) {
1455 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
1456 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
1457 }
1458 elsif (CORE::length($char[$i+1]) == 4) {
1459 0 push @range, grep {$char[$i-1] le $_} chars3();
1460 0 push @range, grep {$_ le $char[$i+1]} chars4();
1461 }
1462 else {
1463 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1464 }
1465 }
1466 elsif (CORE::length($char[$i-1]) == 4) {
1467 0 ▶ if (CORE::length($char[$i+1]) == 4) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $char[$i + 1] == 4) { } 0 0 0
1468 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
1469 }
1470 else {
1471 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1472 }
1473 }
1474 else {
1475 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1476 }
1477  
1478 0 splice @char, $i-1, 3, @range;
1479 }
1480  
1481 12 return @char;
1482 }
1483  
1484 #
1485 # Latin-4 open character class
1486 #
1487 0 ▶sub _cc {
Subroutine _cc: not called CC=7 SCAR=40.3
1488 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
1489 0 die __FILE__, ": subroutine cc got no parameter.\n";
1490 }
1491 elsif (scalar(@_) == 1) {
1492 0 return sprintf('\x%02X',$_[0]);
1493 }
1494 elsif (scalar(@_) == 2) {
1495 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
1496 0 die __FILE__, ": subroutine cc got \$_[0] > \$_[1] parameters).\n";
1497 }
1498 elsif ($_[0] == $_[1]) {
1499 0 return sprintf('\x%02X',$_[0]);
1500 }
1501 elsif (($_[0]+1) == $_[1]) {
1502 0 return sprintf('[\\x%02X\\x%02X]',$_[0],$_[1]);
1503 }
1504 else {
1505 0 return sprintf('[\\x%02X-\\x%02X]',$_[0],$_[1]);
1506 }
1507 }
1508 else {
1509 0 die __FILE__, ": subroutine cc got 3 or more parameters (@{[scalar(@_)]} parameters).\n";
1510 }
1511 }
1512  
1513 #
1514 # Latin-4 octet range
1515 #
1516 246 ▶sub _octets {
Subroutine _octets: called CC=5 SCAR=19.3
1517 246 my $length = shift @_;
1518  
1519 246 ▶ if ($length == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length == 1) { } 246 0 246
1520 246 my($a1) = unpack 'C', $_[0];
1521 246 my($z1) = unpack 'C', $_[1];
1522  
1523 246 ▶ if ($a1 > $z1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($a1 > $z1) 0 246 246
1524 0 croak 'Invalid [] range in regexp (CORE::ord(A) > CORE::ord(B)) ' . '\x' . unpack('H*',$a1) . '-\x' . unpack('H*',$z1);
1525 }
1526  
1527 246 ▶ if ($a1 == $z1) {
Branch: 2 branches
BranchTrueFalseTotal
if ($a1 == $z1) { } 0 246 246
elsif ($a1 + 1 == $z1) { } 0 246 246
1528 0 return sprintf('\x%02X',$a1);
1529 }
1530 elsif (($a1+1) == $z1) {
1531 0 return sprintf('\x%02X\x%02X',$a1,$z1);
1532 }
1533 else {
1534 246 return sprintf('\x%02X-\x%02X',$a1,$z1);
1535 }
1536 }
1537 else {
1538 0 die __FILE__, ": subroutine _octets got invalid length ($length).\n";
1539 }
1540 }
1541  
1542 #
1543 # Latin-4 range regexp
1544 #
1545 246 ▶sub _range_regexp {
Subroutine _range_regexp: called CC=18 SCAR=41.7
1546 246 my($length,$first,$last) = @_;
1547  
1548 246 my @range_regexp = ();
1549 246 ▶ if (not exists $range_tr{$length}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $range_tr{$length}) 0 246 246
1550 0 return @range_regexp;
1551 }
1552  
1553 246 my @ranges = @{ $range_tr{$length} };
1554 246 ▶ while (my @range = splice(@ranges,0,$length)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, $length)) 246 246 492
1555 246 my $min = '';
1556 246 my $max = '';
1557 246 ▶ for (my $i=0; $i < $length; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $length) 246 246 492
1558 246 $min .= pack 'C', $range[$i][0];
1559 246 $max .= pack 'C', $range[$i][-1];
1560 }
1561  
1562 # min___max
1563 # FIRST_____________LAST
1564 # (nothing)
1565  
1566 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
1567 }
1568  
1569 # **********
1570 # min_________max
1571 # FIRST_____________LAST
1572 # **********
1573  
1574 ▶ 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
1575 0 push @range_regexp, _octets($length,$first,$max,$min,$max);
1576 }
1577  
1578 # **********************
1579 # min________________max
1580 # FIRST_____________LAST
1581 # **********************
1582  
1583 ▶ 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
1584 0 push @range_regexp, _octets($length,$first,$last,$min,$max);
1585 }
1586  
1587 # *********
1588 # min___max
1589 # FIRST_____________LAST
1590 # *********
1591  
1592 ▶ elsif (($first le $min) and ($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
1593 0 push @range_regexp, _octets($length,$min,$max,$min,$max);
1594 }
1595  
1596 # **********************
1597 # min__________________________max
1598 # FIRST_____________LAST
1599 # **********************
1600  
1601 ▶ 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
1602 246 push @range_regexp, _octets($length,$first,$last,$min,$max);
1603 }
1604  
1605 # *********
1606 # min________max
1607 # FIRST_____________LAST
1608 # *********
1609  
1610 ▶ 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
1611 0 push @range_regexp, _octets($length,$min,$last,$min,$max);
1612 }
1613  
1614 # min___max
1615 # FIRST_____________LAST
1616 # (nothing)
1617  
1618 elsif ($last lt $min) {
1619 }
1620  
1621 else {
1622 0 die __FILE__, ": subroutine _range_regexp panic.\n";
1623 }
1624 }
1625  
1626 246 return @range_regexp;
1627 }
1628  
1629 #
1630 # Latin-4 open character list for qr and not qr
1631 #
1632 650 ▶sub _charlist {
Subroutine _charlist: called CC=46 SCAR=45.9
1633  
1634 650 my $modifier = pop @_;
1635 650 my @char = @_;
1636  
1637 650 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 298 352 650
1638  
1639 # unescape character
1640 650 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1773 650 2423
1641  
1642 # escape - to ...
1643 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
1644 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
1645 246 $char[$i] = '...';
1646 }
1647 }
1648  
1649 # octal escape sequence
1650 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
1651 0 $char[$i] = octchr($1);
1652 }
1653  
1654 # hexadecimal escape sequence
1655 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
1656 0 $char[$i] = hexchr($1);
1657 }
1658  
1659 # \b{...} --> b\{...}
1660 # \B{...} --> B\{...}
1661 # \N{CHARNAME} --> N\{CHARNAME}
1662 # \p{PROPERTY} --> p\{PROPERTY}
1663 # \P{PROPERTY} --> P\{PROPERTY}
1664 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
1665 0 $char[$i] = $1 . '\\' . $2;
1666 }
1667  
1668 # \p, \P, \X --> p, P, X
1669 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
1670 0 $char[$i] = $1;
1671 }
1672  
1673 elsif ($char[$i] =~ /\A \\ ([0-7]{2,3}) \z/oxms) {
1674 0 $char[$i] = CORE::chr oct $1;
1675 }
1676 elsif ($char[$i] =~ /\A \\x ([0-9A-Fa-f]{1,2}) \z/oxms) {
1677 22 $char[$i] = CORE::chr hex $1;
1678 }
1679 elsif ($char[$i] =~ /\A \\c ([\x40-\x5F]) \z/oxms) {
1680 0 $char[$i] = CORE::chr(CORE::ord($1) & 0x1F);
1681 }
1682 elsif ($char[$i] =~ /\A (\\ [0nrtfbaedswDSWHVhvR]) \z/oxms) {
1683 $char[$i] = {
1684 '\0' => "\0",
1685 '\n' => "\n",
1686 '\r' => "\r",
1687 '\t' => "\t",
1688 '\f' => "\f",
1689 '\b' => "\x08", # \b means backspace in character class
1690 '\a' => "\a",
1691 '\e' => "\e",
1692 '\d' => '[0-9]',
1693  
1694 # Vertical tabs are now whitespace
1695 # \s in a regex now matches a vertical tab in all circumstances.
1696 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
1697 # \t \n \v \f \r space
1698 # '\s' => '[\x09\x0A \x0C\x0D\x20]',
1699 # '\s' => '[\x09\x0A\x0B\x0C\x0D\x20]',
1700 '\s' => '\s',
1701  
1702 '\w' => '[0-9A-Z_a-z]',
1703 '\D' => '${Elatin4::eD}',
1704 '\S' => '${Elatin4::eS}',
1705 '\W' => '${Elatin4::eW}',
1706  
1707 '\H' => '${Elatin4::eH}',
1708 '\V' => '${Elatin4::eV}',
1709 '\h' => '[\x09\x20]',
1710 '\v' => '[\x0A\x0B\x0C\x0D]',
1711 '\R' => '${Elatin4::eR}',
1712  
1713 25 }->{$1};
1714 }
1715  
1716 # POSIX-style character classes
1717 ▶ 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
1718 $char[$i] = {
1719  
1720 '[:lower:]' => '[\x41-\x5A\x61-\x7A]',
1721 '[:upper:]' => '[\x41-\x5A\x61-\x7A]',
1722 '[:^lower:]' => '${Elatin4::not_lower_i}',
1723 '[:^upper:]' => '${Elatin4::not_upper_i}',
1724  
1725 8 }->{$1};
1726 }
1727 elsif ($char[$i] =~ /\A ( \[\: \^? (?:alnum|alpha|ascii|blank|cntrl|digit|graph|lower|print|punct|space|upper|word|xdigit) :\] ) \z/oxms) {
1728 $char[$i] = {
1729  
1730 '[:alnum:]' => '[\x30-\x39\x41-\x5A\x61-\x7A]',
1731 '[:alpha:]' => '[\x41-\x5A\x61-\x7A]',
1732 '[:ascii:]' => '[\x00-\x7F]',
1733 '[:blank:]' => '[\x09\x20]',
1734 '[:cntrl:]' => '[\x00-\x1F\x7F]',
1735 '[:digit:]' => '[\x30-\x39]',
1736 '[:graph:]' => '[\x21-\x7F]',
1737 '[:lower:]' => '[\x61-\x7A]',
1738 '[:print:]' => '[\x20-\x7F]',
1739 '[:punct:]' => '[\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E]',
1740  
1741 # P.174 POSIX-Style Character Classes
1742 # in Chapter 5: Pattern Matching
1743 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
1744  
1745 # P.311 11.2.4 Character Classes and other Special Escapes
1746 # in Chapter 11: perlre: Perl regular expressions
1747 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
1748  
1749 # P.210 POSIX-Style Character Classes
1750 # in Chapter 5: Pattern Matching
1751 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1752  
1753 '[:space:]' => '[\s\x0B]', # "\s" plus vertical tab ("\cK")
1754  
1755 '[:upper:]' => '[\x41-\x5A]',
1756 '[:word:]' => '[\x30-\x39\x41-\x5A\x5F\x61-\x7A]',
1757 '[:xdigit:]' => '[\x30-\x39\x41-\x46\x61-\x66]',
1758 '[:^alnum:]' => '${Elatin4::not_alnum}',
1759 '[:^alpha:]' => '${Elatin4::not_alpha}',
1760 '[:^ascii:]' => '${Elatin4::not_ascii}',
1761 '[:^blank:]' => '${Elatin4::not_blank}',
1762 '[:^cntrl:]' => '${Elatin4::not_cntrl}',
1763 '[:^digit:]' => '${Elatin4::not_digit}',
1764 '[:^graph:]' => '${Elatin4::not_graph}',
1765 '[:^lower:]' => '${Elatin4::not_lower}',
1766 '[:^print:]' => '${Elatin4::not_print}',
1767 '[:^punct:]' => '${Elatin4::not_punct}',
1768 '[:^space:]' => '${Elatin4::not_space}',
1769 '[:^upper:]' => '${Elatin4::not_upper}',
1770 '[:^word:]' => '${Elatin4::not_word}',
1771 '[:^xdigit:]' => '${Elatin4::not_xdigit}',
1772  
1773 70 }->{$1};
1774 }
1775 elsif ($char[$i] =~ /\A \\ ($q_char) \z/oxms) {
1776 7 $char[$i] = $1;
1777 }
1778 }
1779  
1780 # open character list
1781 650 my @singleoctet = ();
1782 650 my @multipleoctet = ();
1783 650 ▶ for (my $i=0; $i <= $#char; ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1527 650 2177
1784  
1785 # escaped -
1786 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
1787 246 $i += 1;
1788 246 next;
1789 }
1790  
1791 # make range regexp
1792 elsif ($char[$i] eq '...') {
1793  
1794 # range error
1795 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
1796 0 croak 'Invalid [] range in regexp (length(A) > length(B)) ' . '\x' . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]);
1797 }
1798 elsif (CORE::length($char[$i-1]) == CORE::length($char[$i+1])) {
1799 246 ▶ if ($char[$i-1] gt $char[$i+1]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i - 1] gt $char[$i + 1]) 0 246 246
1800 0 croak 'Invalid [] range in regexp (CORE::ord(A) > CORE::ord(B)) ' . '\x' . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]);
1801 }
1802 }
1803  
1804 # make range regexp per length
1805 246 for my $length (CORE::length($char[$i-1]) .. CORE::length($char[$i+1])) {
1806 246 my @regexp = ();
1807  
1808 # is first and last
1809 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
1810 246 push @regexp, _range_regexp($length, $char[$i-1], $char[$i+1]);
1811 }
1812  
1813 # is first
1814 elsif ($length == CORE::length($char[$i-1])) {
1815 0 push @regexp, _range_regexp($length, $char[$i-1], "\xFF" x $length);
1816 }
1817  
1818 # is inside in first and last
1819 ▶ 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
1820 0 push @regexp, _range_regexp($length, "\x00" x $length, "\xFF" x $length);
1821 }
1822  
1823 # is last
1824 elsif ($length == CORE::length($char[$i+1])) {
1825 0 push @regexp, _range_regexp($length, "\x00" x $length, $char[$i+1]);
1826 }
1827  
1828 else {
1829 0 die __FILE__, ": subroutine make_regexp panic.\n";
1830 }
1831  
1832 246 ▶ if ($length == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length == 1) { } 246 0 246
1833 246 push @singleoctet, @regexp;
1834 }
1835 else {
1836 0 push @multipleoctet, @regexp;
1837 }
1838 }
1839  
1840 246 $i += 2;
1841 }
1842  
1843 # with /i modifier
1844 elsif ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) {
1845 949 ▶ if ($modifier =~ /i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) { } 480 469 949
1846 480 my $uc = Elatin4::uc($char[$i]);
1847 480 my $fc = Elatin4::fc($char[$i]);
1848 480 ▶ if ($uc ne $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc ne $fc) { } 240 240 480
1849 240 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 240 0 240
1850 240 push @singleoctet, $uc, $fc;
1851 }
1852 else {
1853 0 push @singleoctet, $uc;
1854 0 push @multipleoctet, $fc;
1855 }
1856 }
1857 else {
1858 240 push @singleoctet, $char[$i];
1859 }
1860 }
1861 else {
1862 469 push @singleoctet, $char[$i];
1863 }
1864 949 $i += 1;
1865 }
1866  
1867 # single character of single octet code
1868 elsif ($char[$i] =~ /\A (?: \\h ) \z/oxms) {
1869 0 push @singleoctet, "\t", "\x20";
1870 0 $i += 1;
1871 }
1872 elsif ($char[$i] =~ /\A (?: \\v ) \z/oxms) {
1873 0 push @singleoctet, "\x0A", "\x0B", "\x0C", "\x0D";
1874 0 $i += 1;
1875 }
1876 elsif ($char[$i] =~ /\A (?: \\d | \\s | \\w ) \z/oxms) {
1877 2 push @singleoctet, $char[$i];
1878 2 $i += 1;
1879 }
1880  
1881 # single character of multiple-octet code
1882 else {
1883 84 push @multipleoctet, $char[$i];
1884 84 $i += 1;
1885 }
1886 }
1887  
1888 # quote metachar
1889 650 for (@singleoctet) {
1890 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
1891 0 $_ = '-';
1892 }
1893 elsif (/\A \n \z/oxms) {
1894 8 $_ = '\n';
1895 }
1896 elsif (/\A \r \z/oxms) {
1897 8 $_ = '\r';
1898 }
1899 elsif (/\A ([\x00-\x20\x7F-\xFF]) \z/oxms) {
1900 744 $_ = sprintf('\x%02X', CORE::ord $1);
1901 }
1902 elsif (/\A [\x00-\xFF] \z/oxms) {
1903 429 $_ = quotemeta $_;
1904 }
1905 }
1906  
1907 # return character list
1908 650 return \@singleoctet, \@multipleoctet;
1909 }
1910  
1911 #
1912 # Latin-4 octal escape sequence
1913 #
1914 5 ▶sub octchr {
Subroutine octchr: called CC=2 SCAR=6.9
Pod undocumented
1915 5 my($octdigit) = @_;
1916  
1917 5 my @binary = ();
1918 5 for my $octal (split(//,$octdigit)) {
1919 push @binary, {
1920 '0' => '000',
1921 '1' => '001',
1922 '2' => '010',
1923 '3' => '011',
1924 '4' => '100',
1925 '5' => '101',
1926 '6' => '110',
1927 '7' => '111',
1928 50 }->{$octal};
1929 }
1930 5 my $binary = join '', @binary;
1931  
1932 my $octchr = {
1933 # 1234567
1934 1 => pack('B*', "0000000$binary"),
1935 2 => pack('B*', "000000$binary"),
1936 3 => pack('B*', "00000$binary"),
1937 4 => pack('B*', "0000$binary"),
1938 5 => pack('B*', "000$binary"),
1939 6 => pack('B*', "00$binary"),
1940 7 => pack('B*', "0$binary"),
1941 0 => pack('B*', "$binary"),
1942  
1943 5 }->{CORE::length($binary) % 8};
1944  
1945 5 return $octchr;
1946 }
1947  
1948 #
1949 # Latin-4 hexadecimal escape sequence
1950 #
1951 5 ▶sub hexchr {
Subroutine hexchr: called CC=1 SCAR=0.0
Pod undocumented
1952 5 my($hexdigit) = @_;
1953  
1954 my $hexchr = {
1955 1 => pack('H*', "0$hexdigit"),
1956 0 => pack('H*', "$hexdigit"),
1957  
1958 5 }->{CORE::length($_[0]) % 2};
1959  
1960 5 return $hexchr;
1961 }
1962  
1963 #
1964 # Latin-4 open character list for qr
1965 #
1966 576 ▶sub charlist_qr {
Subroutine charlist_qr: called CC=17 SCAR=28.7
Pod undocumented
1967  
1968 576 my $modifier = pop @_;
1969 576 my @char = @_;
1970  
1971 576 my($singleoctet, $multipleoctet) = _charlist(@char, $modifier);
1972 576 my @singleoctet = @$singleoctet;
1973 576 my @multipleoctet = @$multipleoctet;
1974  
1975 # return character list
1976 576 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) 498 78 576
1977  
1978 # with /i modifier
1979 498 ▶ if ($modifier =~ m/i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) 265 233 498
1980 265 my %singleoctet_ignorecase = ();
1981 265 for (@singleoctet) {
1982 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
1983 745 for my $ord (hex($1) .. hex($2)) {
1984 795 my $char = CORE::chr($ord);
1985 795 my $uc = Elatin4::uc($char);
1986 795 my $fc = Elatin4::fc($char);
1987 795 ▶ if ($uc eq $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc eq $fc) { } 240 555 795
1988 240 $singleoctet_ignorecase{unpack 'C*', $char} = 1;
1989 }
1990 else {
1991 555 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 555 0 555
1992 555 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
1993 555 $singleoctet_ignorecase{unpack 'C*', $fc} = 1;
1994 }
1995 else {
1996 0 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
1997 0 push @multipleoctet, join '', map {sprintf('\x%02X',$_)} unpack 'C*', $fc;
1998 }
1999 }
2000 }
2001 }
2002 745 ▶ if ($_ ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ ne "") 0 745 745
2003 0 $singleoctet_ignorecase{unpack 'C*', $_} = 1;
2004 }
2005 }
2006 265 my $i = 0;
2007 265 my @singleoctet_ignorecase = ();
2008 265 for my $ord (0 .. 255) {
2009 67840 ▶ if (exists $singleoctet_ignorecase{$ord}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $singleoctet_ignorecase{$ord}) { } 870 66970 67840
2010 870 push @{$singleoctet_ignorecase[$i]}, $ord;
2011 }
2012 else {
2013 66970 $i++;
2014 }
2015 }
2016 265 @singleoctet = ();
2017 265 for my $range (@singleoctet_ignorecase) {
2018 56160 ▶ if (ref $range) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $range) 770 55390 56160
2019 770 ▶ if (scalar(@{$range}) == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @{$range;} == 1) { } 720 50 770
elsif (scalar @{$range;} == 2) { } 0 50 50
2020 720 push @singleoctet, sprintf('\x%02X', @{$range}[0]);
2021 }
2022 50 elsif (scalar(@{$range}) == 2) {
2023 0 push @singleoctet, sprintf('\x%02X\x%02X', @{$range}[0], @{$range}[-1]);
2024 }
2025 else {
2026 50 push @singleoctet, sprintf('\x%02X-\x%02X', @{$range}[0], @{$range}[-1]);
2027 }
2028 }
2029 }
2030 }
2031  
2032 498 my $not_anchor = '';
2033  
2034 498 push @multipleoctet, join('', $not_anchor, '[', @singleoctet, ']' );
2035 }
2036 576 ▶ if (scalar(@multipleoctet) >= 2) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @multipleoctet >= 2) { } 6 570 576
2037 6 return '(?:' . join('|', @multipleoctet) . ')';
2038 }
2039 else {
2040 570 return $multipleoctet[0];
2041 }
2042 }
2043  
2044 #
2045 # Latin-4 open character list for not qr
2046 #
2047 74 ▶sub charlist_not_qr {
Subroutine charlist_not_qr: called CC=18 SCAR=33.1
Pod undocumented
2048  
2049 74 my $modifier = pop @_;
2050 74 my @char = @_;
2051  
2052 74 my($singleoctet, $multipleoctet) = _charlist(@char, $modifier);
2053 74 my @singleoctet = @$singleoctet;
2054 74 my @multipleoctet = @$multipleoctet;
2055  
2056 # with /i modifier
2057 74 ▶ if ($modifier =~ m/i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) 25 49 74
2058 25 my %singleoctet_ignorecase = ();
2059 25 for (@singleoctet) {
2060 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
2061 25 for my $ord (hex($1) .. hex($2)) {
2062 75 my $char = CORE::chr($ord);
2063 75 my $uc = Elatin4::uc($char);
2064 75 my $fc = Elatin4::fc($char);
2065 75 ▶ if ($uc eq $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc eq $fc) { } 0 75 75
2066 0 $singleoctet_ignorecase{unpack 'C*', $char} = 1;
2067 }
2068 else {
2069 75 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 75 0 75
2070 75 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2071 75 $singleoctet_ignorecase{unpack 'C*', $fc} = 1;
2072 }
2073 else {
2074 0 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2075 0 push @multipleoctet, join '', map {sprintf('\x%02X',$_)} unpack 'C*', $fc;
2076 }
2077 }
2078 }
2079 }
2080 25 ▶ if ($_ ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ ne "") 0 25 25
2081 0 $singleoctet_ignorecase{unpack 'C*', $_} = 1;
2082 }
2083 }
2084 25 my $i = 0;
2085 25 my @singleoctet_ignorecase = ();
2086 25 for my $ord (0 .. 255) {
2087 6400 ▶ if (exists $singleoctet_ignorecase{$ord}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $singleoctet_ignorecase{$ord}) { } 150 6250 6400
2088 150 push @{$singleoctet_ignorecase[$i]}, $ord;
2089 }
2090 else {
2091 6250 $i++;
2092 }
2093 }
2094 25 @singleoctet = ();
2095 25 for my $range (@singleoctet_ignorecase) {
2096 2400 ▶ if (ref $range) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $range) 50 2350 2400
2097 50 ▶ if (scalar(@{$range}) == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @{$range;} == 1) { } 0 50 50
elsif (scalar @{$range;} == 2) { } 0 50 50
2098 0 push @singleoctet, sprintf('\x%02X', @{$range}[0]);
2099 }
2100 50 elsif (scalar(@{$range}) == 2) {
2101 0 push @singleoctet, sprintf('\x%02X\x%02X', @{$range}[0], @{$range}[-1]);
2102 }
2103 else {
2104 50 push @singleoctet, sprintf('\x%02X-\x%02X', @{$range}[0], @{$range}[-1]);
2105 }
2106 }
2107 }
2108 }
2109  
2110 # return character list
2111 74 ▶ if (scalar(@multipleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @multipleoctet >= 1) { } 0 74 74
2112 0 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) { } 0 0 0
2113  
2114 # any character other than multiple-octet and single octet character class
2115 0 return '(?!' . join('|', @multipleoctet) . ')(?:[^' . join('', @singleoctet) . '])';
2116 }
2117 else {
2118  
2119 # any character other than multiple-octet character class
2120 0 return '(?!' . join('|', @multipleoctet) . ")(?:$your_char)";
2121 }
2122 }
2123 else {
2124 74 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) { } 74 0 74
2125  
2126 # any character other than single octet character class
2127 74 return '(?:[^' . join('', @singleoctet) . '])';
2128 }
2129 else {
2130  
2131 # any character
2132 0 return "(?:$your_char)";
2133 }
2134 }
2135 }
2136  
2137 #
2138 # open file in read mode
2139 #
2140 422 ▶sub _open_r {
Subroutine _open_r: called CC=1 SCAR=0.0
2141 422 my(undef,$file) = @_;
2142 422 ▶ use Fcntl qw(O_RDONLY);
Subroutine BEGIN: called CC=1 SCAR=0.0
2143 422 return CORE::sysopen($_[0], $file, &O_RDONLY);
2144 }
2145  
2146 #
2147 # open file in append mode
2148 #
2149 211 ▶sub _open_a {
Subroutine _open_a: called CC=1 SCAR=0.0
2150 211 my(undef,$file) = @_;
2151 422 ▶ use Fcntl qw(O_WRONLY O_APPEND O_CREAT);
Subroutine BEGIN: called CC=1 SCAR=0.0
2152 211 return CORE::sysopen($_[0], $file, &O_WRONLY|&O_APPEND|&O_CREAT);
2153 }
2154  
2155 #
2156 # safe system
2157 #
2158 211 ▶sub _systemx {
Subroutine _systemx: called CC=1 SCAR=0.0
2159  
2160 # P.707 29.2.33. exec
2161 # in Chapter 29: Functions
2162 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2163 #
2164 # Be aware that in older releases of Perl, exec (and system) did not flush
2165 # your output buffer, so you needed to enable command buffering by setting $|
2166 # on one or more filehandles to avoid lost output in the case of exec, or
2167 # misordererd output in the case of system. This situation was largely remedied
2168 # in the 5.6 release of Perl. (So, 5.005 release not yet.)
2169  
2170 # P.855 exec
2171 # in Chapter 27: Functions
2172 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2173 #
2174 # In very old release of Perl (before v5.6), exec (and system) did not flush
2175 # your output buffer, so you needed to enable command buffering by setting $|
2176 # on one or more filehandles to avoid lost output with exec or misordered
2177 # output with system.
2178  
2179 211 $| = 1;
2180  
2181 # P.565 23.1.2. Cleaning Up Your Environment
2182 # in Chapter 23: Security
2183 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2184  
2185 # P.656 Cleaning Up Your Environment
2186 # in Chapter 20: Security
2187 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2188  
2189 # local $ENV{'PATH'} = '.';
2190 211 local @ENV{qw(IFS CDPATH ENV BASH_ENV)}; # Make %ENV safer
2191  
2192 # P.707 29.2.33. exec
2193 # in Chapter 29: Functions
2194 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2195 #
2196 # As we mentioned earlier, exec treats a discrete list of arguments as an
2197 # indication that it should bypass shell processing. However, there is one
2198 # place where you might still get tripped up. The exec call (and system, too)
2199 # will not distinguish between a single scalar argument and an array containing
2200 # only one element.
2201 #
2202 # @args = ("echo surprise"); # just one element in list
2203 # exec @args # still subject to shell escapes
2204 # or die "exec: $!"; # because @args == 1
2205 #
2206 # To avoid this, you can use the PATHNAME syntax, explicitly duplicating the
2207 # first argument as the pathname, which forces the rest of the arguments to be
2208 # interpreted as a list, even if there is only one of them:
2209 #
2210 # exec { $args[0] } @args # safe even with one-argument list
2211 # or die "can't exec @args: $!";
2212  
2213 # P.855 exec
2214 # in Chapter 27: Functions
2215 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2216 #
2217 # As we mentioned earlier, exec treats a discrete list of arguments as a
2218 # directive to bypass shell processing. However, there is one place where
2219 # you might still get tripped up. The exec call (and system, too) cannot
2220 # distinguish between a single scalar argument and an array containing
2221 # only one element.
2222 #
2223 # @args = ("echo surprise"); # just one element in list
2224 # exec @args # still subject to shell escapes
2225 # || die "exec: $!"; # because @args == 1
2226 #
2227 # To avoid this, use the PATHNAME syntax, explicitly duplicating the first
2228 # argument as the pathname, which forces the rest of the arguments to be
2229 # interpreted as a list, even if there is only one of them:
2230 #
2231 # exec { $args[0] } @args # safe even with one-argument list
2232 # || die "can't exec @args: $!";
2233  
2234 211 return CORE::system { $_[0] } @_; # safe even with one-argument list
2235 }
2236  
2237 #
2238 # Latin-4 order to character (with parameter)
2239 #
2240 3469 ▶sub Elatin4::chr(;$) {
Subroutine chr: called CC=4 SCAR=13.9
Pod undocumented
2241  
2242 3469 ▶ my $c = @_ ? $_[0] : $_;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 3469 0 3469
2243  
2244 3469 ▶ if ($c == 0x00) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c == 0) { } 24 3445 3469
2245 24 return "\x00";
2246 }
2247 else {
2248 3445 my @chr = ();
2249 3445 ▶ while ($c > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c > 0) 3445 3445 6890
2250 3445 unshift @chr, ($c % 0x100);
2251 3445 $c = int($c / 0x100);
2252 }
2253 3445 return pack 'C*', @chr;
2254 }
2255 }
2256  
2257 #
2258 # Latin-4 order to character (without parameter)
2259 #
2260 0 ▶sub Elatin4::chr_() {
Subroutine chr_: not called CC=3 SCAR=24.8
Pod undocumented
2261  
2262 0 my $c = $_;
2263  
2264 0 ▶ if ($c == 0x00) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c == 0) { } 0 0 0
2265 0 return "\x00";
2266 }
2267 else {
2268 0 my @chr = ();
2269 0 ▶ while ($c > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c > 0) 0 0 0
2270 0 unshift @chr, ($c % 0x100);
2271 0 $c = int($c / 0x100);
2272 }
2273 0 return pack 'C*', @chr;
2274 }
2275 }
2276  
2277 #
2278 # Latin-4 path globbing (with parameter)
2279 #
2280 0 ▶sub Elatin4::glob($) {
Subroutine glob: not called CC=3 SCAR=24.8
Pod undocumented
2281  
2282 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2283 0 my @glob = _DOS_like_glob(@_);
2284 0 for my $glob (@glob) {
2285 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2286 }
2287 0 return @glob;
2288 }
2289 else {
2290 0 my $glob = _DOS_like_glob(@_);
2291 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2292 0 return $glob;
2293 }
2294 }
2295  
2296 #
2297 # Latin-4 path globbing (without parameter)
2298 #
2299 0 ▶sub Elatin4::glob_() {
Subroutine glob_: not called CC=3 SCAR=24.8
Pod undocumented
2300  
2301 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2302 0 my @glob = _DOS_like_glob();
2303 0 for my $glob (@glob) {
2304 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2305 }
2306 0 return @glob;
2307 }
2308 else {
2309 0 my $glob = _DOS_like_glob();
2310 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2311 0 return $glob;
2312 }
2313 }
2314  
2315 #
2316 # Latin-4 path globbing via File::DosGlob 1.10
2317 #
2318 # Often I confuse "_dosglob" and "_doglob".
2319 # So, I renamed "_dosglob" to "_DOS_like_glob".
2320 #
2321 422 my %iter;
2322 my %entries;
2323 0 ▶sub _DOS_like_glob {
Subroutine _DOS_like_glob: not called CC=10 SCAR=47.0
2324  
2325 # context (keyed by second cxix argument provided by core)
2326 0 my($expr,$cxix) = @_;
2327  
2328 # glob without args defaults to $_
2329 0 ▶ $expr = $_ if not defined $expr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $expr 0 0 0
2330  
2331 # represents the current user's home directory
2332 #
2333 # 7.3. Expanding Tildes in Filenames
2334 # in Chapter 7. File Access
2335 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2336 #
2337 # and File::HomeDir, File::HomeDir::Windows module
2338  
2339 # DOS-like system
2340 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
2341 0 $expr =~ s{ \A ~ (?= [^/\\] ) }
2342 0 { my_home_MSWin32() }oxmse;
2343 }
2344  
2345 # UNIX-like system
2346 else {
2347 0 $expr =~ s{ \A ~ ( (?:[^/])* ) }
2348 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
2349 }
2350  
2351 # assume global context if not provided one
2352 0 ▶ $cxix = '_G_' if not defined $cxix;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $cxix 0 0 0
2353 0 ▶ $iter{$cxix} = 0 if not exists $iter{$cxix};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $iter{$cxix} 0 0 0
2354  
2355 # if we're just beginning, do it all first
2356 0 ▶ if ($iter{$cxix} == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iter{$cxix} == 0) 0 0 0
2357 0 $entries{$cxix} = [ _do_glob(1, _parse_line($expr)) ];
2358 }
2359  
2360 # chuck it all out, quick or slow
2361 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2362 0 delete $iter{$cxix};
2363 0 return @{delete $entries{$cxix}};
2364 }
2365 else {
2366 0 ▶ if ($iter{$cxix} = scalar @{$entries{$cxix}}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iter{$cxix} = scalar @{$entries{$cxix};}) { } 0 0 0
2367 0 return shift @{$entries{$cxix}};
2368 }
2369 else {
2370 # return undef for EOL
2371 0 delete $iter{$cxix};
2372 0 delete $entries{$cxix};
2373 0 return undef;
2374 }
2375 }
2376 }
2377  
2378 #
2379 # Latin-4 path globbing subroutine
2380 #
2381 0 ▶sub _do_glob {
Subroutine _do_glob: not called CC=44 SCAR=75.9
2382  
2383 0 my($cond,@expr) = @_;
2384 0 my @glob = ();
2385 0 my $fix_drive_relative_paths = 0;
2386  
2387 OUTER:
2388 0 for my $expr (@expr) {
2389 0 ▶ next OUTER if not defined $expr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $expr 0 0 0
2390 0 ▶ next OUTER if $expr eq '';
Branch: 1 branch
BranchTrueFalseTotal
if $expr eq "" 0 0 0
2391  
2392 0 my @matched = ();
2393 0 my @globdir = ();
2394 0 my $head = '.';
2395 0 my $pathsep = '/';
2396 0 my $tail;
2397  
2398 # if argument is within quotes strip em and do no globbing
2399 0 ▶ if ($expr =~ /\A " ((?:$q_char)*?) " \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expr =~ /\A " ((?:$Elatin4::q_char)*?) " \z/mosx) 0 0 0
2400 0 $expr = $1;
2401 0 ▶ if ($cond eq 'd') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cond eq 'd') { } 0 0 0
2402 0 ▶ if (-d $expr) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $expr) 0 0 0
2403 0 push @glob, $expr;
2404 }
2405 }
2406 else {
2407 0 ▶ if (-e $expr) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $expr) 0 0 0
2408 0 push @glob, $expr;
2409 }
2410 }
2411 0 next OUTER;
2412 }
2413  
2414 # wildcards with a drive prefix such as h:*.pm must be changed
2415 # to h:./*.pm to expand correctly
2416 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
2417 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
2418 0 $fix_drive_relative_paths = 1;
2419 }
2420 }
2421  
2422 0 ▶ if (($head, $tail) = _parse_path($expr,$pathsep)) {
Branch: 1 branch
BranchTrueFalseTotal
if (($head, $tail) = _parse_path($expr, $pathsep)) 0 0 0
2423 0 ▶ if ($tail eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($tail eq "") 0 0 0
2424 0 push @glob, $expr;
2425 0 next OUTER;
2426 }
2427 0 ▶ if ($head =~ / \A (?:$q_char)*? [*?] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head =~ / \A (?:$Elatin4::q_char)*? [*?] /mosx) 0 0 0
2428 0 ▶ if (@globdir = _do_glob('d', $head)) {
Branch: 1 branch
BranchTrueFalseTotal
if (@globdir = _do_glob("d", $head)) 0 0 0
2429 0 push @glob, _do_glob($cond, map {"$_$pathsep$tail"} @globdir);
2430 0 next OUTER;
2431 }
2432 }
2433 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
2434 0 $head .= $pathsep;
2435 }
2436 0 $expr = $tail;
2437 }
2438  
2439 # If file component has no wildcards, we can avoid opendir
2440 0 ▶ if ($expr !~ / \A (?:$q_char)*? [*?] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($expr =~ / \A (?:$Elatin4::q_char)*? [*?] /mosx) 0 0 0
2441 0 ▶ if ($head eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($head eq ".") 0 0 0
2442 0 $head = '';
2443 }
2444 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
2445 0 $head .= $pathsep;
2446 }
2447 0 $head .= $expr;
2448 0 ▶ if ($cond eq 'd') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cond eq 'd') { } 0 0 0
2449 0 ▶ if (-d $head) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $head) 0 0 0
2450 0 push @glob, $head;
2451 }
2452 }
2453 else {
2454 0 ▶ if (-e $head) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $head) 0 0 0
2455 0 push @glob, $head;
2456 }
2457 }
2458 0 next OUTER;
2459 }
2460 0 ▶ opendir(*DIR, $head) or next OUTER;
Branch: 1 branch
BranchTrueFalseTotal
opendir *DIR, $head or next OUTER 0 0 0
2461 0 my @leaf = readdir DIR;
2462 0 closedir DIR;
2463  
2464 0 ▶ if ($head eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($head eq ".") 0 0 0
2465 0 $head = '';
2466 }
2467 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
2468 0 $head .= $pathsep;
2469 }
2470  
2471 0 my $pattern = '';
2472 0 ▶ while ($expr =~ / \G ($q_char) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expr =~ / \G ($Elatin4::q_char) /cgox) 0 0 0
2473 0 my $char = $1;
2474  
2475 # 6.9. Matching Shell Globs as Regular Expressions
2476 # in Chapter 6. Pattern Matching
2477 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2478 # (and so on)
2479  
2480 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
2481 0 $pattern .= "(?:$your_char)*",
2482 }
2483 elsif ($char eq '?') {
2484 0 $pattern .= "(?:$your_char)?", # DOS style
2485 # $pattern .= "(?:$your_char)", # UNIX style
2486 }
2487 elsif ((my $fc = Elatin4::fc($char)) ne $char) {
2488 0 $pattern .= $fc;
2489 }
2490 else {
2491 0 $pattern .= quotemeta $char;
2492 }
2493 }
2494 0 ▶ my $matchsub = sub { Elatin4::fc($_[0]) =~ /\A $pattern \z/xms };
Subroutine __ANON__: not called CC=1 SCAR=6.9
2495  
2496 # if ($@) {
2497 # print STDERR "$0: $@\n";
2498 # next OUTER;
2499 # }
2500  
2501 INNER:
2502 0 for my $leaf (@leaf) {
2503 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
2504 0 next INNER;
2505 }
2506 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
2507 0 next INNER;
2508 }
2509  
2510 0 ▶ if (&$matchsub($leaf)) {
Branch: 1 branch
BranchTrueFalseTotal
if (&$matchsub($leaf)) 0 0 0
2511 0 push @matched, "$head$leaf";
2512 0 next INNER;
2513 }
2514  
2515 # [DOS compatibility special case]
2516 # Failed, add a trailing dot and try again, but only...
2517  
2518 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
2519 CORE::length($leaf) <= 8 and # name is shorter than or equal to 8 chars *and*
2520 Elatin4::index($pattern,'\\.') != -1 # pattern has a dot.
2521 ) {
2522 0 ▶ if (&$matchsub("$leaf.")) {
Branch: 1 branch
BranchTrueFalseTotal
if (&$matchsub("$leaf.")) 0 0 0
2523 0 push @matched, "$head$leaf";
2524 0 next INNER;
2525 }
2526 }
2527 }
2528 0 ▶ if (@matched) {
Branch: 1 branch
BranchTrueFalseTotal
if (@matched) 0 0 0
2529 0 push @glob, @matched;
2530 }
2531 }
2532 0 ▶ if ($fix_drive_relative_paths) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fix_drive_relative_paths) 0 0 0
2533 0 for my $glob (@glob) {
2534 0 $glob =~ s# \A ([A-Za-z]:) \./ #$1#oxms;
2535 }
2536 }
2537 0 return @glob;
2538 }
2539  
2540 #
2541 # Latin-4 parse line
2542 #
2543 0 ▶sub _parse_line {
Subroutine _parse_line: not called CC=3 SCAR=24.8
2544  
2545 0 my($line) = @_;
2546  
2547 0 $line .= ' ';
2548 0 my @piece = ();
2549 0 ▶ while ($line =~ /
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ / " ( (?>(?: [^"] )* ) ) " (?>\s+) | ( (?>(?: [^"\s] )* ) ) (?>\s+) /gmosx) 0 0 0
2550 " ( (?>(?: [^"] )* ) ) " (?>\s+) |
2551 ( (?>(?: [^"\s] )* ) ) (?>\s+)
2552 /oxmsg
2553 ) {
2554 0 ▶ push @piece, defined($1) ? $1 : $2;
Branch: 1 branch
BranchTrueFalseTotal
defined $1 ? : 0 0 0
2555 }
2556 0 return @piece;
2557 }
2558  
2559 #
2560 # Latin-4 parse path
2561 #
2562 0 ▶sub _parse_path {
Subroutine _parse_path: not called CC=2 SCAR=17.9
2563  
2564 0 my($path,$pathsep) = @_;
2565  
2566 0 $path .= '/';
2567 0 my @subpath = ();
2568 0 ▶ while ($path =~ /
Branch: 1 branch
BranchTrueFalseTotal
if ($path =~ m( ((?: [^/\\] )+?) [/\\] )gmosx) 0 0 0
2569 ((?: [^\/\\] )+?) [\/\\]
2570 /oxmsg
2571 ) {
2572 0 push @subpath, $1;
2573 }
2574  
2575 0 my $tail = pop @subpath;
2576 0 my $head = join $pathsep, @subpath;
2577 0 return $head, $tail;
2578 }
2579  
2580 #
2581 # via File::HomeDir::Windows 1.00
2582 #
2583 0 ▶sub my_home_MSWin32 {
Subroutine my_home_MSWin32: not called CC=9 SCAR=45.0
Pod undocumented
2584  
2585 # A lot of unix people and unix-derived tools rely on
2586 # the ability to overload HOME. We will support it too
2587 # so that they can replace raw HOME calls with File::HomeDir.
2588 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
2589 0 return $ENV{'HOME'};
2590 }
2591  
2592 # Do we have a user profile?
2593 ▶ 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
2594 0 return $ENV{'USERPROFILE'};
2595 }
2596  
2597 # Some Windows use something like $ENV{'HOME'}
2598 ▶ 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
2599 0 return join '', $ENV{'HOMEDRIVE'}, $ENV{'HOMEPATH'};
2600 }
2601  
2602 0 return undef;
2603 }
2604  
2605 #
2606 # via File::HomeDir::Unix 1.00
2607 #
2608 0 ▶sub my_home {
Subroutine my_home: not called CC=7 SCAR=40.3
Pod undocumented
2609 0 my $home;
2610  
2611 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
2612 0 $home = $ENV{'HOME'};
2613 }
2614  
2615 # This is from the original code, but I'm guessing
2616 # it means "login directory" and exists on some Unixes.
2617 ▶ 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
2618 0 $home = $ENV{'LOGDIR'};
2619 }
2620  
2621 ### More-desperate methods
2622  
2623 # Light desperation on any (Unixish) platform
2624 else {
2625 0 $home = CORE::eval q{ (getpwuid($<))[7] };
2626 }
2627  
2628 # On Unix in general, a non-existant home means "no home"
2629 # For example, "nobody"-like users might use /nonexistant
2630 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
2631 0 $home = undef;
2632 }
2633 0 return $home;
2634 }
2635  
2636 #
2637 # ${^PREMATCH}, $PREMATCH, $` the string preceding what was matched
2638 #
2639 56 ▶sub Elatin4::PREMATCH {
Subroutine PREMATCH: called CC=1 SCAR=0.0
Pod undocumented
2640 56 return $`;
2641 }
2642  
2643 #
2644 # ${^MATCH}, $MATCH, $& the string that matched
2645 #
2646 81 ▶sub Elatin4::MATCH {
Subroutine MATCH: called CC=1 SCAR=0.0
Pod undocumented
2647 81 return $&;
2648 }
2649  
2650 #
2651 # ${^POSTMATCH}, $POSTMATCH, $' the string following what was matched
2652 #
2653 42 ▶sub Elatin4::POSTMATCH {
Subroutine POSTMATCH: called CC=1 SCAR=0.0
Pod undocumented
2654 42 return $';
2655 }
2656  
2657 #
2658 # Latin-4 character to order (with parameter)
2659 #
2660 0 ▶sub Latin4::ord(;$) {
Subroutine ord: not called CC=4 SCAR=30.0
2661  
2662 0 ▶ local $_ = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
2663  
2664 0 ▶ if (/\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\A ($Elatin4::q_char) /mosx) { } 0 0 0
2665 0 my @ord = unpack 'C*', $1;
2666 0 my $ord = 0;
2667 0 ▶ while (my $o = shift @ord) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $o = shift @ord) 0 0 0
2668 0 $ord = $ord * 0x100 + $o;
2669 }
2670 0 return $ord;
2671 }
2672 else {
2673 0 return CORE::ord $_;
2674 }
2675 }
2676  
2677 #
2678 # Latin-4 character to order (without parameter)
2679 #
2680 0 ▶sub Latin4::ord_() {
Subroutine ord_: not called CC=3 SCAR=24.8
2681  
2682 0 ▶ if (/\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\A ($Elatin4::q_char) /mosx) { } 0 0 0
2683 0 my @ord = unpack 'C*', $1;
2684 0 my $ord = 0;
2685 0 ▶ while (my $o = shift @ord) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $o = shift @ord) 0 0 0
2686 0 $ord = $ord * 0x100 + $o;
2687 }
2688 0 return $ord;
2689 }
2690 else {
2691 0 return CORE::ord $_;
2692 }
2693 }
2694  
2695 #
2696 # Latin-4 reverse
2697 #
2698 0 ▶sub Latin4::reverse(@) {
Subroutine reverse: not called CC=2 SCAR=17.9
2699  
2700 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2701 0 return CORE::reverse @_;
2702 }
2703 else {
2704  
2705 # One of us once cornered Larry in an elevator and asked him what
2706 # problem he was solving with this, but he looked as far off into
2707 # the distance as he could in an elevator and said, "It seemed like
2708 # a good idea at the time."
2709  
2710 0 return join '', CORE::reverse(join('',@_) =~ /\G ($q_char) /oxmsg);
2711 }
2712 }
2713  
2714 #
2715 # Latin-4 getc (with parameter, without parameter)
2716 #
2717 20 ▶sub Latin4::getc(;*@) {
Subroutine getc: called CC=9 SCAR=26.7
2718  
2719 20 my($package) = caller;
2720 20 ▶ my $fh = @_ ? qualify_to_ref(shift,$package) : \*STDIN;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 20 0 20
2721 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
2722  
2723 0 my @length = sort { $a <=> $b } keys %range_tr;
2724 20 my $getc = '';
2725 20 for my $length ($length[0] .. $length[-1]) {
2726 20 $getc .= CORE::getc($fh);
2727 20 ▶ if (exists $range_tr{CORE::length($getc)}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{length $getc}) 20 0 20
2728 20 ▶ if ($getc =~ /\A ${Elatin4::dot_s} \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($getc =~ /\A $Elatin4::dot_s \z/mosx) 20 0 20
2729 20 ▶ return wantarray ? ($getc,@_) : $getc;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 20 20
2730 }
2731 }
2732 }
2733 0 ▶ return wantarray ? ($getc,@_) : $getc;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
2734 }
2735  
2736 #
2737 # Latin-4 length by character
2738 #
2739 0 ▶sub Latin4::length(;$) {
Subroutine length: not called CC=2 SCAR=17.9
2740  
2741 0 ▶ local $_ = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
2742  
2743 0 local @_ = /\G ($q_char) /oxmsg;
2744 0 return scalar @_;
2745 }
2746  
2747 #
2748 # Latin-4 substr by character
2749 #
2750 422 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=7.0
2751  
2752 # P.232 The lvalue Attribute
2753 # in Chapter 6: Subroutines
2754 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2755  
2756 # P.336 The lvalue Attribute
2757 # in Chapter 7: Subroutines
2758 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2759  
2760 # P.144 8.4 Lvalue subroutines
2761 # in Chapter 8: perlsub: Perl subroutines
2762 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
2763  
2764 0 ▶ CORE::eval sprintf(<<'END', ($] >= 5.014000) ? ':lvalue' : '');
Subroutine substr: called CC=11 SCAR=24.4
Branch: 10 branches
BranchTrueFalseTotal
$] >= 5.014 ? : 422 0 422
if ($offset > scalar @char or $offset < -1 * scalar(@char)) 2 25 27
if (@_ == 4) { } 1 24 25
elsif (@_ == 3) { } 21 3 24
if ($offset == 0) { } 0 21 21
elsif ($offset > 0) { } 20 1 21
if ($length == 0) { } 0 21 21
elsif ($length > 0) { } 20 1 21
if ($offset == 0) { } 0 3 3
elsif ($offset > 0) { } 2 1 3
Condition66%2/3
$offset > scalar @char or $offset < -1 * scalar(@char)
l!l&&r!l&&!r
2025
MC/DC50%1/2
$offset > scalar @char or $offset < -1 * scalar(@char)
$offset > scalar @char $offset < -1 * scalar(@char)
Truth table66%2/3
A or B
A= $offset > scalar @charB= $offset < -1 * scalar(@char)
ABresult
1X1
011
000
2765 # vv----------------------*******
2766 sub Latin4::substr($$;$$) %s {
2767  
2768 my @char = $_[0] =~ /\G (?>$q_char) /oxmsg;
2769  
2770 # If the substring is beyond either end of the string, substr() returns the undefined
2771 # value and produces a warning. When used as an lvalue, specifying a substring that
2772 # is entirely outside the string raises an exception.
2773 # http://perldoc.perl.org/functions/substr.html
2774  
2775 # A return with no argument returns the scalar value undef in scalar context,
2776 # an empty list () in list context, and (naturally) nothing at all in void
2777 # context.
2778  
2779 my $offset = $_[1];
2780 if (($offset > scalar(@char)) or ($offset < (-1 * scalar(@char)))) {
2781 return;
2782 }
2783  
2784 # substr($string,$offset,$length,$replacement)
2785 if (@_ == 4) {
2786 my(undef,undef,$length,$replacement) = @_;
2787 my $substr = join '', splice(@char, $offset, $length, $replacement);
2788 $_[0] = join '', @char;
2789  
2790 # return $substr; this doesn't work, don't say "return"
2791 $substr;
2792 }
2793  
2794 # substr($string,$offset,$length)
2795 elsif (@_ == 3) {
2796 my(undef,undef,$length) = @_;
2797 my $octet_offset = 0;
2798 my $octet_length = 0;
2799 if ($offset == 0) {
2800 $octet_offset = 0;
2801 }
2802 elsif ($offset > 0) {
2803 $octet_offset = CORE::length(join '', @char[0..$offset-1]);
2804 }
2805 else {
2806 $octet_offset = -1 * CORE::length(join '', @char[$#char+$offset+1..$#char]);
2807 }
2808 if ($length == 0) {
2809 $octet_length = 0;
2810 }
2811 elsif ($length > 0) {
2812 $octet_length = CORE::length(join '', @char[$offset..$offset+$length-1]);
2813 }
2814 else {
2815 $octet_length = -1 * CORE::length(join '', @char[$#char+$length+1..$#char]);
2816 }
2817 CORE::substr($_[0], $octet_offset, $octet_length);
2818 }
2819  
2820 # substr($string,$offset)
2821 else {
2822 my $octet_offset = 0;
2823 if ($offset == 0) {
2824 $octet_offset = 0;
2825 }
2826 elsif ($offset > 0) {
2827 $octet_offset = CORE::length(join '', @char[0..$offset-1]);
2828 }
2829 else {
2830 $octet_offset = -1 * CORE::length(join '', @char[$#char+$offset+1..$#char]);
2831 }
2832 CORE::substr($_[0], $octet_offset);
2833 }
2834 }
2835 END
2836 }
2837  
2838 #
2839 # Latin-4 index by character
2840 #
2841 0 ▶sub Latin4::index($$;$) {
Subroutine index: not called CC=3 SCAR=24.8
2842  
2843 0 my $index;
2844 0 ▶ if (@_ == 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 3) { } 0 0 0
2845 0 $index = Elatin4::index($_[0], $_[1], CORE::length(Latin4::substr($_[0], 0, $_[2])));
2846 }
2847 else {
2848 0 $index = Elatin4::index($_[0], $_[1]);
2849 }
2850  
2851 0 ▶ if ($index == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($index == -1) { } 0 0 0
2852 0 return -1;
2853 }
2854 else {
2855 0 return Latin4::length(CORE::substr $_[0], 0, $index);
2856 }
2857 }
2858  
2859 #
2860 # Latin-4 rindex by character
2861 #
2862 0 ▶sub Latin4::rindex($$;$) {
Subroutine rindex: not called CC=3 SCAR=24.8
2863  
2864 0 my $rindex;
2865 0 ▶ if (@_ == 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 3) { } 0 0 0
2866 0 $rindex = Elatin4::rindex($_[0], $_[1], CORE::length(Latin4::substr($_[0], 0, $_[2])));
2867 }
2868 else {
2869 0 $rindex = Elatin4::rindex($_[0], $_[1]);
2870 }
2871  
2872 0 ▶ if ($rindex == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rindex == -1) { } 0 0 0
2873 0 return -1;
2874 }
2875 else {
2876 0 return Latin4::length(CORE::substr $_[0], 0, $rindex);
2877 }
2878 }
2879  
2880 # when 'm//', '/' means regexp match 'm//' and '?' means regexp match '??'
2881 # when 'div', '/' means division operator and '?' means conditional operator (condition ? then : else)
2882 422 ▶use vars qw($slash); $slash = 'm//';
Subroutine BEGIN: called CC=1 SCAR=0.0
2883  
2884 # ord() to ord() or Latin4::ord()
2885 422 my $function_ord = 'ord';
2886  
2887 # ord to ord or Latin4::ord_
2888 422 my $function_ord_ = 'ord';
2889  
2890 # reverse to reverse or Latin4::reverse
2891 422 my $function_reverse = 'reverse';
2892  
2893 # getc to getc or Latin4::getc
2894 422 my $function_getc = 'getc';
2895  
2896 # P.1023 Appendix W.9 Multibyte Anchoring
2897 # of ISBN 1-56592-224-7 CJKV Information Processing
2898  
2899 422 my $anchor = '';
2900  
2901 422 ▶use vars qw($nest);
Subroutine BEGIN: called CC=1 SCAR=0.0
2902  
2903 # regexp of nested parens in qqXX
2904  
2905 # P.340 Matching Nested Constructs with Embedded Code
2906 # in Chapter 7: Perl
2907 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
2908  
2909 my $qq_paren = qr{(?{local $nest=0}) (?>(?:
2910 [^\\()] |
2911 \( (?{$nest++}) |
2912 \) (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2913 \\ [^c] |
2914 \\c[\x40-\x5F] |
2915 [\x00-\xFF]
2916 422 }xms;
2917  
2918 my $qq_brace = qr{(?{local $nest=0}) (?>(?:
2919 [^\\{}] |
2920 \{ (?{$nest++}) |
2921 \} (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2922 \\ [^c] |
2923 \\c[\x40-\x5F] |
2924 [\x00-\xFF]
2925 422 }xms;
2926  
2927 my $qq_bracket = qr{(?{local $nest=0}) (?>(?:
2928 [^\\\[\]] |
2929 \[ (?{$nest++}) |
2930 \] (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2931 \\ [^c] |
2932 \\c[\x40-\x5F] |
2933 [\x00-\xFF]
2934 422 }xms;
2935  
2936 my $qq_angle = qr{(?{local $nest=0}) (?>(?:
2937 [^\\<>] |
2938 \< (?{$nest++}) |
2939 \> (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2940 \\ [^c] |
2941 \\c[\x40-\x5F] |
2942 [\x00-\xFF]
2943 422 }xms;
2944  
2945 422 my $qq_scalar = qr{(?: \{ (?:$qq_brace)*? \} |
2946 (?: ::)? (?:
2947 (?> [a-zA-Z_][a-zA-Z_0-9]* (?: ::[a-zA-Z_][a-zA-Z_0-9]*)* )
2948 (?>(?: \[ (?: \$\[ | \$\] | $qq_char )*? \] | \{ (?:$qq_brace)*? \} )*)
2949 (?>(?: (?: -> )? (?: [\$\@\%\&\*]\* | \$\#\* | [\@\%]? \[ (?: \$\[ | \$\] | $qq_char )*? \] | [\@\%\*]? \{ (?:$qq_brace)*? \} ) )*)
2950 ))
2951 }xms;
2952  
2953 422 my $qq_variable = qr{(?: \{ (?:$qq_brace)*? \} |
2954 (?: ::)? (?:
2955 (?>[0-9]+) |
2956 [^a-zA-Z_0-9\[\]] |
2957 ^[A-Z] |
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 422 my $qq_substr = qr{(?> Char::substr | Latin4::substr | CORE::substr | substr ) (?>\s*) \( $qq_paren \)
2965 }xms;
2966  
2967 # regexp of nested parens in qXX
2968 my $q_paren = qr{(?{local $nest=0}) (?>(?:
2969 [^()] |
2970 \( (?{$nest++}) |
2971 \) (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2972 [\x00-\xFF]
2973 422 }xms;
2974  
2975 my $q_brace = qr{(?{local $nest=0}) (?>(?:
2976 [^\{\}] |
2977 \{ (?{$nest++}) |
2978 \} (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2979 [\x00-\xFF]
2980 422 }xms;
2981  
2982 my $q_bracket = qr{(?{local $nest=0}) (?>(?:
2983 [^\[\]] |
2984 \[ (?{$nest++}) |
2985 \] (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2986 [\x00-\xFF]
2987 422 }xms;
2988  
2989 my $q_angle = qr{(?{local $nest=0}) (?>(?:
2990 [^<>] |
2991 \< (?{$nest++}) |
2992 \> (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2993 [\x00-\xFF]
2994 422 }xms;
2995  
2996 422 my $matched = '';
2997 422 my $s_matched = '';
2998  
2999 422 my $tr_variable = ''; # variable of tr///
3000 422 my $sub_variable = ''; # variable of s///
3001 422 my $bind_operator = ''; # =~ or !~
3002  
3003 422 my @heredoc = (); # here document
3004 422 my @heredoc_delimiter = ();
3005 422 my $here_script = ''; # here script
3006  
3007 #
3008 # escape Latin-4 script
3009 #
3010 547 ▶sub Latin4::escape(;$) {
Subroutine escape: called CC=3 SCAR=11.0
3011 547 ▶ local($_) = $_[0] if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 292 255 547
3012  
3013 # P.359 The Study Function
3014 # in Chapter 7: Perl
3015 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3016  
3017 547 study $_; # Yes, I studied study yesterday.
3018  
3019 # while all script
3020  
3021 # 6.14. Matching from Where the Last Pattern Left Off
3022 # in Chapter 6. Pattern Matching
3023 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
3024 # (and so on)
3025  
3026 # one member of Tag-team
3027 #
3028 # P.128 Start of match (or end of previous match): \G
3029 # P.130 Advanced Use of \G with Perl
3030 # in Chapter 3: Overview of Regular Expression Features and Flavors
3031 # P.255 Use leading anchors
3032 # P.256 Expose ^ and \G at the front expressions
3033 # in Chapter 6: Crafting an Efficient Expression
3034 # P.315 "Tag-team" matching with /gc
3035 # in Chapter 7: Perl
3036 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3037  
3038 547 my $e_script = '';
3039 547 ▶ while (not /\G \z/oxgc) { # member
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 86550 547 87097
3040 86550 $e_script .= Latin4::escape_token();
3041 }
3042  
3043 547 return $e_script;
3044 }
3045  
3046 #
3047 # escape Latin-4 token of script
3048 #
3049 86550 ▶sub Latin4::escape_token {
Subroutine escape_token: called CC=504 SCAR=109.3
3050  
3051 # \n output here document
3052  
3053 86550 my $ignore_modules = join('|', qw(
3054 utf8
3055 bytes
3056 charnames
3057 I18N::Japanese
3058 I18N::Collate
3059 I18N::JExt
3060 File::DosGlob
3061 Wild
3062 Wildcard
3063 Japanese
3064 ));
3065  
3066 # another member of Tag-team
3067 #
3068 # P.315 "Tag-team" matching with /gc
3069 # in Chapter 7: Perl
3070 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3071  
3072 86550 ▶ if (/\G ( \n ) /oxgc) { # another member (and so on)
Branch: 139 branches
BranchTrueFalseTotal
if (/\G ( \n ) /cgox) { } 12821 73729 86550
elsif (/\G ((?>\s+)|\#.*) /cgox) { } 21373 52356 73729
elsif (/\G ( (?: if | elsif | unless | while | until | given | when ) (?>\s*) \( ) /cgox) { } 1644 50712 52356
elsif (/\G ( \( (?>\s*) (?: local \b | my \b | our \b | state \b )? (?>\s*) \$ $qq_scalar ) /cgox) { } 90 50622 50712
elsif (/\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /cgmosx) { } 4 50618 50622
elsif (/\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /cgmosx) { } 28 50590 50618
elsif (/\G ( \$' | \$\{'\} ) /cgmosx) { } 1 50589 50590
elsif (/\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /cgmosx) { } 3 50586 50589
elsif (/\G ( \$ $qq_scalar | $qq_substr ) /cgox) { } 1752 48834 50586
elsif (/\G ( [,;] ) /cgox) { } 5080 43754 48834
elsif (/\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /cgmosx) { } 0 43754 43754
elsif (/\G ( \$ 0 ) /cgmosx) { } 2 43752 43754
elsif (/\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /cgmosx) { } 0 43752 43752
elsif (/\G ( \$ \$ ) (?![\w\{]) /cgmosx) { } 1 43751 43752
elsif (/\G \$ ((?>[1-9][0-9]*)) /cgmosx) { } 4 43747 43751
elsif (/\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /cgmosx) { } 0 43747 43747
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /cgmosx) { } 0 43747 43747
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /cgmosx) { } 0 43747 43747
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /cgmosx) { } 0 43747 43747
elsif (/\G \$ (?>\s*) \{ ( (?>\s*) (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* ) (?>\s*) ) \} /cgmosx) { } 0 43747 43747
elsif (/\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /cgmosx) { } 0 43747 43747
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 43705 43747
elsif (m{\G ( \$[\$\@\#\\\'\"/\?\(\)\[\]\<\>] ) }cgmosx) { } 63 43642 43705
elsif (/\G \b (while (?>\s*) \( (?>\s*) <[\$]?[A-Za-z_][A-Za-z_0-9]*> (?>\s*) \)) \b /cgox) { } 0 43642 43642
elsif (/\G \b while (?>\s*) \( (?>\s*) < ((?:[^>\0\a\e\f\n\r\t])+?) > (?>\s*) \) \b /cgox) { } 0 43642 43642
elsif (/\G \b while (?>\s*) \( (?>\s*) glob (?>\s*) \) /cgox) { } 0 43642 43642
elsif (/\G \b while (?>\s*) \( (?>\s*) glob \b /cgox) { } 0 43642 43642
elsif (/\G \b ( if | unless | while | until | for | when ) \b /cgox) { } 251 43391 43642
elsif (/\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /cgox) { } 19 43372 43391
elsif (/\G \b Char::eval (?= (?>\s*) \{ ) /cgox) { } 0 43372 43372
elsif (/\G \b Latin4::eval (?= (?>\s*) \{ ) /cgox) { } 22 43350 43372
elsif (/\G \b Char::eval \b (?! (?>\s*) => ) /cgox) { } 0 43350 43350
elsif (/\G \b Latin4::eval \b (?! (?>\s*) => ) /cgox) { } 168 43182 43350
elsif (/\G \b bytes::substr \b (?! (?>\s*) => ) /cgox) { } 2 43180 43182
elsif (/\G \b chop \b (?! (?>\s*) => ) /cgox) { } 0 43180 43180
elsif (/\G \b bytes::index \b (?! (?>\s*) => ) /cgox) { } 2 43178 43180
elsif (/\G \b Char::index \b (?! (?>\s*) => ) /cgox) { } 0 43178 43178
elsif (/\G \b Latin4::index \b (?! (?>\s*) => ) /cgox) { } 0 43178 43178
elsif (/\G \b index \b (?! (?>\s*) => ) /cgox) { } 0 43178 43178
elsif (/\G \b bytes::rindex \b (?! (?>\s*) => ) /cgox) { } 2 43176 43178
elsif (/\G \b Char::rindex \b (?! (?>\s*) => ) /cgox) { } 0 43176 43176
elsif (/\G \b Latin4::rindex \b (?! (?>\s*) => ) /cgox) { } 0 43176 43176
elsif (/\G \b rindex \b (?! (?>\s*) => ) /cgox) { } 0 43176 43176
elsif (/\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 1 43175 43176
elsif (/\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43175 43175
elsif (/\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 1 43174 43175
elsif (/\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43174 43174
elsif (/\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 6 43168 43174
elsif (/\G -s (?>\s*) (\") ((?:$Elatin4::qq_char)+?) (\") /cgox) { } 0 43168 43168
elsif (/\G -s (?>\s+) qq (?>\s*) (\#) ((?:$Elatin4::qq_char)+?) (\#) /cgox) { } 0 43168 43168
elsif (/\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /cgox) { } 0 43168 43168
elsif (/\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /cgox) { } 0 43168 43168
elsif (/\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /cgox) { } 0 43168 43168
elsif (/\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /cgox) { } 0 43168 43168
elsif (/\G -s (?>\s+) qq (?>\s*) (\S) ((?:$Elatin4::qq_char)+?) (\1) /cgox) { } 0 43168 43168
elsif (/\G -s (?>\s*) (\') ((?:\\\'|\\\\|$Elatin4::q_char)+?) (\') /cgox) { } 0 43168 43168
elsif (/\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$Elatin4::q_char)+?) (\#) /cgox) { } 0 43168 43168
elsif (/\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /cgox) { } 0 43168 43168
elsif (/\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /cgox) { } 0 43168 43168
elsif (/\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /cgox) { } 0 43168 43168
elsif (/\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /cgox) { } 0 43168 43168
elsif (/\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$Elatin4::q_char)+?) (\1) /cgox) { } 0 43168 43168
elsif (/\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)* ) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ) )*) /cgox) { } 0 43168 43168
elsif (/\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /cgox) { } 0 43168 43168
elsif (/\G -s (?= (?>\s+) [a-z]+) /cgox) { } 0 43168 43168
elsif (/\G -s (?>\s+) ((?>\w+)) /cgox) { } 0 43168 43168
elsif (/\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43166 43168
elsif (/\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43164 43166
elsif (/\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 36 43128 43164
elsif (/\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43126 43128
elsif (/\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 8 43118 43126
elsif (/\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43118 43118
elsif (/\G \b lc \b (?! (?>\s*) => ) /cgox) { } 0 43118 43118
elsif (/\G \b lcfirst \b (?! (?>\s*) => ) /cgox) { } 0 43118 43118
elsif (/\G \b uc \b (?! (?>\s*) => ) /cgox) { } 0 43118 43118
elsif (/\G \b ucfirst \b (?! (?>\s*) => ) /cgox) { } 0 43118 43118
elsif (/\G \b fc \b (?! (?>\s*) => ) /cgox) { } 0 43118 43118
elsif (/\G -s \b (?! (?>\s*) => ) /cgox) { } 0 43118 43118
elsif (/\G \b bytes::length \b (?! (?>\s*) => ) /cgox) { } 0 43118 43118
elsif (/\G \b bytes::chr \b (?! (?>\s*) => ) /cgox) { } 0 43118 43118
elsif (/\G \b chr \b (?! (?>\s*) => ) /cgox) { } 0 43118 43118
elsif (/\G \b bytes::ord \b (?! (?>\s*) => ) /cgox) { } 0 43118 43118
elsif (/\G \b ord \b (?! (?>\s*) => ) /cgox) { } 0 43118 43118
elsif (/\G \b glob \b (?! (?>\s*) => ) /cgox) { } 0 43118 43118
elsif (/\G \b reverse \b (?! (?>\s*) => ) /cgox) { } 0 43118 43118
elsif (/\G \b getc \b (?! (?>\s*) => ) /cgox) { } 8 43110 43118
elsif (/\G \b (split) \b (?! (?>\s*) => ) /cgox) { } 87 43023 43110
elsif (/\G \b ( tr | y ) \b /cgox) { } 4 43019 43023
elsif (/\G \b (qq) \b /cgox) { } 2252 40767 43019
elsif (/\G \b (qr) \b /cgox) { } 0 40767 40767
elsif (/\G \b (qw) \b /cgox) { } 16 40751 40767
elsif (/\G \b (qx) \b /cgox) { } 0 40751 40751
elsif (/\G \b (q) \b /cgox) { } 473 40278 40751
elsif (/\G \b (m) \b /cgox) { } 209 40069 40278
elsif (/\G \b (s) \b /cgox) { } 101 39968 40069
elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 0 39968 39968
elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 39968 39968
elsif (/\G \b require ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 39968 39968
elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [#\n]) /cgmosx) { } 37 39931 39968
elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 39931 39931
elsif (/\G \b use ((?>\s+) strict) \b /cgmosx) { } 0 39931 39931
elsif (/\G \b use (?>\s+) ((?>([1-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /cgmosx) { } 2 39929 39931
elsif (/\G \b use (?>\s+) ((?>v([0-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /cgmosx) { } 0 39929 39929
elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 2 39927 39929
elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 39927 39927
elsif (/\G \b use ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 39927 39927
elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 0 39927 39927
elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 39927 39927
elsif (/\G \b no ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 39927 39927
elsif (/\G \b use \b /cgmosx) { } 0 39927 39927
elsif (/\G \b no \b /cgmosx) { } 2 39925 39927
elsif (/\G (?<![\w\$\@\%\&\*]) (\') /cgox) { } 1142 38783 39925
elsif (/\G (\") /cgox) { } 1917 36866 38783
elsif (/\G (\`) /cgox) { } 1 36865 36866
elsif ($Elatin4::slash eq 'm//' and m[\G (/) ]cgox) { } 681 36184 36865
elsif ($Elatin4::slash eq 'm//' and /\G (\?) /cgox) { } 0 36184 36184
elsif (/\G ( <<>> ) /cgox) { } 0 36184 36184
elsif (/\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /cgox) { } 0 36184 36184
elsif (/\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /cgox) { } 6 36178 36184
elsif (/\G ( <<~ \\([a-zA-Z_0-9]+) ) /cgox) { } 3 36175 36178
elsif (/\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /cgox) { } 6 36169 36175
elsif (/\G ( <<~ ([a-zA-Z_0-9]+) ) /cgox) { } 3 36166 36169
elsif (/\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /cgox) { } 6 36160 36166
elsif (/\G ( << '([a-zA-Z_0-9]*)' ) /cgox) { } 72 36088 36160
elsif (/\G ( << \\([a-zA-Z_0-9]+) ) /cgox) { } 0 36088 36088
elsif (/\G ( << "([a-zA-Z_0-9]*)" ) /cgox) { } 36 36052 36088
elsif (/\G ( << ([a-zA-Z_0-9]+) ) /cgox) { } 42 36010 36052
elsif (/\G ( << `([a-zA-Z_0-9]*)` ) /cgox) { } 0 36010 36010
elsif (/\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/cgox) { } 12 35998 36010
elsif (/\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /cgox) { } 0 35998 35998
elsif (/\G < ((?:[^>\0\a\e\f\n\r\t])+?) > /cgox) { } 0 35998 35998
elsif (/\G ^ ( __DATA__ \n .*) \z /cgmosx) { } 0 35998 35998
elsif (/\G ^ ( __END__ \n .*) \z /cgmosx) { } 210 35788 35998
elsif (/\G ( \cD .*) \z /cgmosx) { } 0 35788 35788
elsif (/\G ( \cZ .*) \z /cgmosx) { } 0 35788 35788
elsif (/\G ( -- | \+\+ | [\)\}\]] ) /cgox) { } 5837 29951 35788
elsif (/\G ( \.\.\. ) /cgox) { } 7 29944 29951
elsif (m"\G ((?> !~~ | !~ | != | ! | %= | % | &&= | && | &= | &\.= | &\. | & | -= | -> | - | :(?>\s*)= | : | <<>> | <<= | <=> | <= | < | == | => | =~ | = | >>= | >> | >= | > | \*\*= | \*\* | \*= | \* | \+= | \+ | \.\. | \.= | \. | //= | // | /= | / | \? | \\ | \^= | \^\.= | \^\. | \^ | \b x= | \|\|= | \|\| | \|= | \|\.= | \|\. | \| | ~~ | ~\. | ~ | \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b | \b(?: print )\b | [,;\(\{\[] )) "cgox) { } 9788 20156 29944
elsif (/\G ($Elatin4::q_char) /cgox) { } 20156 0 20156
3073 12821 my $heredoc = '';
3074 12821 ▶ if (scalar(@heredoc_delimiter) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @heredoc_delimiter >= 1) 174 12647 12821
3075 174 $slash = 'm//';
3076  
3077 174 $heredoc = join '', @heredoc;
3078 174 @heredoc = ();
3079  
3080 # skip here document
3081 174 for my $heredoc_delimiter (@heredoc_delimiter) {
3082 174 /\G .*? \n $heredoc_delimiter \n/xmsgc;
3083 }
3084 174 @heredoc_delimiter = ();
3085  
3086 174 $here_script = '';
3087 }
3088 12821 return "\n" . $heredoc;
3089 }
3090  
3091 # ignore space, comment
3092 21373 elsif (/\G ((?>\s+)|\#.*) /oxgc) { return $1; }
3093  
3094 # if (, elsif (, unless (, while (, until (, given (, and when (
3095  
3096 # given, when
3097  
3098 # P.225 The given Statement
3099 # in Chapter 15: Smart Matching and given-when
3100 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
3101  
3102 # P.133 The given Statement
3103 # in Chapter 4: Statements and Declarations
3104 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
3105  
3106 elsif (/\G ( (?: if | elsif | unless | while | until | given | when ) (?>\s*) \( ) /oxgc) {
3107 1644 $slash = 'm//';
3108 1644 return $1;
3109 }
3110  
3111 # scalar variable ($scalar = ...) =~ tr///;
3112 # scalar variable ($scalar = ...) =~ s///;
3113  
3114 # state
3115  
3116 # P.68 Persistent, Private Variables
3117 # in Chapter 4: Subroutines
3118 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
3119  
3120 # P.160 Persistent Lexically Scoped Variables: state
3121 # in Chapter 4: Statements and Declarations
3122 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
3123  
3124 # (and so on)
3125  
3126 elsif (/\G ( \( (?>\s*) (?: local \b | my \b | our \b | state \b )? (?>\s*) \$ $qq_scalar ) /oxgc) {
3127 90 my $e_string = e_string($1);
3128  
3129 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
3130 0 $tr_variable = $e_string . e_string($1);
3131 0 $bind_operator = $2;
3132 0 $slash = 'm//';
3133 0 return '';
3134 }
3135 elsif (/\G ( (?>\s*) = $qq_paren \) ) ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /oxgc) {
3136 0 $sub_variable = $e_string . e_string($1);
3137 0 $bind_operator = $2;
3138 0 $slash = 'm//';
3139 0 return '';
3140 }
3141 else {
3142 90 $slash = 'div';
3143 90 return $e_string;
3144 }
3145 }
3146  
3147 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin4::PREMATCH()
3148 elsif (/\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /oxmsgc) {
3149 4 $slash = 'div';
3150 4 return q{Elatin4::PREMATCH()};
3151 }
3152  
3153 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin4::MATCH()
3154 elsif (/\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /oxmsgc) {
3155 28 $slash = 'div';
3156 28 return q{Elatin4::MATCH()};
3157 }
3158  
3159 # $', ${'} --> $', ${'}
3160 elsif (/\G ( \$' | \$\{'\} ) /oxmsgc) {
3161 1 $slash = 'div';
3162 1 return $1;
3163 }
3164  
3165 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin4::POSTMATCH()
3166 elsif (/\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /oxmsgc) {
3167 3 $slash = 'div';
3168 3 return q{Elatin4::POSTMATCH()};
3169 }
3170  
3171 # scalar variable $scalar =~ tr///;
3172 # scalar variable $scalar =~ s///;
3173 # substr() =~ tr///;
3174 # substr() =~ s///;
3175 elsif (/\G ( \$ $qq_scalar | $qq_substr ) /oxgc) {
3176 1752 my $scalar = e_string($1);
3177  
3178 1752 ▶ if (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= (?: tr | y ) \b ) /oxgc) {
Branch: 2 branches
BranchTrueFalseTotal
if (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= (?: tr | y ) \b ) /cgox) { } 2 1750 1752
elsif (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /cgox) { } 65 1685 1750
3179 2 $tr_variable = $scalar;
3180 2 $bind_operator = $1;
3181 2 $slash = 'm//';
3182 2 return '';
3183 }
3184 elsif (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /oxgc) {
3185 65 $sub_variable = $scalar;
3186 65 $bind_operator = $1;
3187 65 $slash = 'm//';
3188 65 return '';
3189 }
3190 else {
3191 1685 $slash = 'div';
3192 1685 return $scalar;
3193 }
3194 }
3195  
3196 # end of statement
3197 elsif (/\G ( [,;] ) /oxgc) {
3198 5080 $slash = 'm//';
3199  
3200 # clear tr/// variable
3201 5080 $tr_variable = '';
3202  
3203 # clear s/// variable
3204 5080 $sub_variable = '';
3205  
3206 5080 $bind_operator = '';
3207  
3208 5080 return $1;
3209 }
3210  
3211 # bareword
3212 elsif (/\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /oxmsgc) {
3213 0 return $1;
3214 }
3215  
3216 # $0 --> $0
3217 elsif (/\G ( \$ 0 ) /oxmsgc) {
3218 2 $slash = 'div';
3219 2 return $1;
3220 }
3221 elsif (/\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /oxmsgc) {
3222 0 $slash = 'div';
3223 0 return $1;
3224 }
3225  
3226 # $$ --> $$
3227 elsif (/\G ( \$ \$ ) (?![\w\{]) /oxmsgc) {
3228 1 $slash = 'div';
3229 1 return $1;
3230 }
3231  
3232 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
3233 # $1, $2, $3 --> $1, $2, $3 otherwise
3234 elsif (/\G \$ ((?>[1-9][0-9]*)) /oxmsgc) {
3235 4 $slash = 'div';
3236 4 return e_capture($1);
3237 }
3238 elsif (/\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /oxmsgc) {
3239 0 $slash = 'div';
3240 0 return e_capture($1);
3241 }
3242  
3243 # $$foo[ ... ] --> $ $foo->[ ... ]
3244 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /oxmsgc) {
3245 0 $slash = 'div';
3246 0 return e_capture($1.'->'.$2);
3247 }
3248  
3249 # $$foo{ ... } --> $ $foo->{ ... }
3250 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /oxmsgc) {
3251 0 $slash = 'div';
3252 0 return e_capture($1.'->'.$2);
3253 }
3254  
3255 # $$foo
3256 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /oxmsgc) {
3257 0 $slash = 'div';
3258 0 return e_capture($1);
3259 }
3260  
3261 # ${ foo }
3262 elsif (/\G \$ (?>\s*) \{ ( (?>\s*) (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* ) (?>\s*) ) \} /oxmsgc) {
3263 0 $slash = 'div';
3264 0 return '${' . $1 . '}';
3265 }
3266  
3267 # ${ ... }
3268 elsif (/\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /oxmsgc) {
3269 0 $slash = 'div';
3270 0 return e_capture($1);
3271 }
3272  
3273 # variable or function
3274 # $ @ % & * $ #
3275 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) {
3276 42 $slash = 'div';
3277 42 return $1;
3278 }
3279 # $ $ $ $ $ $ $ $ $ $ $ $ $ $
3280 # $ @ # \ ' " / ? ( ) [ ] < >
3281 elsif (/\G ( \$[\$\@\#\\\'\"\/\?\(\)\[\]\<\>] ) /oxmsgc) {
3282 63 $slash = 'div';
3283 63 return $1;
3284 }
3285  
3286 # while (<FILEHANDLE>)
3287 elsif (/\G \b (while (?>\s*) \( (?>\s*) <[\$]?[A-Za-z_][A-Za-z_0-9]*> (?>\s*) \)) \b /oxgc) {
3288 0 return $1;
3289 }
3290  
3291 # while (<WILDCARD>) --- glob
3292  
3293 # avoid "Error: Runtime exception" of perl version 5.005_03
3294  
3295 elsif (/\G \b while (?>\s*) \( (?>\s*) < ((?:[^>\0\a\e\f\n\r\t])+?) > (?>\s*) \) \b /oxgc) {
3296 0 return 'while ($_ = Elatin4::glob("' . $1 . '"))';
3297 }
3298  
3299 # while (glob)
3300 elsif (/\G \b while (?>\s*) \( (?>\s*) glob (?>\s*) \) /oxgc) {
3301 0 return 'while ($_ = Elatin4::glob_)';
3302 }
3303  
3304 # while (glob(WILDCARD))
3305 elsif (/\G \b while (?>\s*) \( (?>\s*) glob \b /oxgc) {
3306 0 return 'while ($_ = Elatin4::glob';
3307 }
3308  
3309 # doit if, doit unless, doit while, doit until, doit for, doit when
3310 251 elsif (/\G \b ( if | unless | while | until | for | when ) \b /oxgc) { $slash = 'm//'; return $1; }
3311  
3312 # subroutines of package Elatin4
3313 19 elsif (/\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /oxgc) { $slash = 'm//'; return $1; }
3314 0 elsif (/\G \b Char::eval (?= (?>\s*) \{ ) /oxgc) { $slash = 'm//'; return 'eval'; }
3315 22 elsif (/\G \b Latin4::eval (?= (?>\s*) \{ ) /oxgc) { $slash = 'm//'; return 'eval'; }
3316 0 elsif (/\G \b Char::eval \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'eval Char::escape'; }
3317 168 elsif (/\G \b Latin4::eval \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'eval Latin4::escape'; }
3318 2 elsif (/\G \b bytes::substr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'substr'; }
3319 0 elsif (/\G \b chop \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin4::chop'; }
3320 2 elsif (/\G \b bytes::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'index'; }
3321 0 elsif (/\G \b Char::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Char::index'; }
3322 0 elsif (/\G \b Latin4::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Latin4::index'; }
3323 0 elsif (/\G \b index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin4::index'; }
3324 2 elsif (/\G \b bytes::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'rindex'; }
3325 0 elsif (/\G \b Char::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Char::rindex'; }
3326 0 elsif (/\G \b Latin4::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Latin4::rindex'; }
3327 0 elsif (/\G \b rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin4::rindex'; }
3328 1 elsif (/\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin4::lc'; }
3329 0 elsif (/\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin4::lcfirst'; }
3330 1 elsif (/\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin4::uc'; }
3331 0 elsif (/\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin4::ucfirst'; }
3332 6 elsif (/\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin4::fc'; }
3333  
3334 # "-s '' ..." means file test "-s 'filename' ..." (not means "- s/// ...")
3335 0 elsif (/\G -s (?>\s*) (\") ((?:$qq_char)+?) (\") /oxgc) { $slash = 'm//'; return '-s ' . e_qq('', $1,$3,$2); }
3336 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\#) ((?:$qq_char)+?) (\#) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3337 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3338 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3339 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3340 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3341 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\S) ((?:$qq_char)+?) (\1) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3342  
3343 0 elsif (/\G -s (?>\s*) (\') ((?:\\\'|\\\\|$q_char)+?) (\') /oxgc) { $slash = 'm//'; return '-s ' . e_q ('', $1,$3,$2); }
3344 0 elsif (/\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$q_char)+?) (\#) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3345 0 elsif (/\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3346 0 elsif (/\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3347 0 elsif (/\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3348 0 elsif (/\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3349 0 elsif (/\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$q_char)+?) (\1) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3350  
3351 elsif (/\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)* ) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ) )*) /oxgc)
3352 0 { $slash = 'm//'; return "-s $1"; }
3353 0 elsif (/\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /oxgc) { $slash = 'm//'; return "-s ($1)"; }
3354 0 elsif (/\G -s (?= (?>\s+) [a-z]+) /oxgc) { $slash = 'm//'; return '-s'; }
3355 0 elsif (/\G -s (?>\s+) ((?>\w+)) /oxgc) { $slash = 'm//'; return "-s $1"; }
3356  
3357 2 elsif (/\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'length'; }
3358 2 elsif (/\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'chr'; }
3359 36 elsif (/\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin4::chr'; }
3360 2 elsif (/\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'div'; return 'ord'; }
3361 8 elsif (/\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'div'; return $function_ord; }
3362 0 elsif (/\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin4::glob'; }
3363 0 elsif (/\G \b lc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin4::lc_'; }
3364 0 elsif (/\G \b lcfirst \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin4::lcfirst_'; }
3365 0 elsif (/\G \b uc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin4::uc_'; }
3366 0 elsif (/\G \b ucfirst \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin4::ucfirst_'; }
3367 0 elsif (/\G \b fc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin4::fc_'; }
3368 0 elsif (/\G -s \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return '-s '; }
3369  
3370 0 elsif (/\G \b bytes::length \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'length'; }
3371 0 elsif (/\G \b bytes::chr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'chr'; }
3372 0 elsif (/\G \b chr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin4::chr_'; }
3373 0 elsif (/\G \b bytes::ord \b (?! (?>\s*) => ) /oxgc) { $slash = 'div'; return 'ord'; }
3374 0 elsif (/\G \b ord \b (?! (?>\s*) => ) /oxgc) { $slash = 'div'; return $function_ord_; }
3375 0 elsif (/\G \b glob \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin4::glob_'; }
3376 0 elsif (/\G \b reverse \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return $function_reverse; }
3377 8 elsif (/\G \b getc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return $function_getc; }
3378 # split
3379 elsif (/\G \b (split) \b (?! (?>\s*) => ) /oxgc) {
3380 87 $slash = 'm//';
3381  
3382 87 my $e = '';
3383 87 ▶ while (/\G ( (?>\s+) | \( | \#.* ) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\G ( (?>\s+) | \( | \#.* ) /cgox) 85 87 172
3384 85 $e .= $1;
3385 }
3386  
3387 # end of split
3388 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
3389  
3390 # split scalar value
3391 1 elsif (/\G ( [\$\@\&\*] $qq_scalar ) /oxgc) { return 'Elatin4::split' . $e . e_string($1); }
3392  
3393 # split literal space
3394 0 elsif (/\G \b qq (\#) [ ] (\#) /oxgc) { return 'Elatin4::split' . $e . qq {qq$1 $2}; }
3395 0 elsif (/\G \b qq ((?>\s*)) (\() [ ] (\)) /oxgc) { return 'Elatin4::split' . $e . qq{$1qq$2 $3}; }
3396 0 elsif (/\G \b qq ((?>\s*)) (\{) [ ] (\}) /oxgc) { return 'Elatin4::split' . $e . qq{$1qq$2 $3}; }
3397 0 elsif (/\G \b qq ((?>\s*)) (\[) [ ] (\]) /oxgc) { return 'Elatin4::split' . $e . qq{$1qq$2 $3}; }
3398 0 elsif (/\G \b qq ((?>\s*)) (\<) [ ] (\>) /oxgc) { return 'Elatin4::split' . $e . qq{$1qq$2 $3}; }
3399 0 elsif (/\G \b qq ((?>\s*)) (\S) [ ] (\2) /oxgc) { return 'Elatin4::split' . $e . qq{$1qq$2 $3}; }
3400 0 elsif (/\G \b q (\#) [ ] (\#) /oxgc) { return 'Elatin4::split' . $e . qq {q$1 $2}; }
3401 0 elsif (/\G \b q ((?>\s*)) (\() [ ] (\)) /oxgc) { return 'Elatin4::split' . $e . qq {$1q$2 $3}; }
3402 0 elsif (/\G \b q ((?>\s*)) (\{) [ ] (\}) /oxgc) { return 'Elatin4::split' . $e . qq {$1q$2 $3}; }
3403 0 elsif (/\G \b q ((?>\s*)) (\[) [ ] (\]) /oxgc) { return 'Elatin4::split' . $e . qq {$1q$2 $3}; }
3404 0 elsif (/\G \b q ((?>\s*)) (\<) [ ] (\>) /oxgc) { return 'Elatin4::split' . $e . qq {$1q$2 $3}; }
3405 0 elsif (/\G \b q ((?>\s*)) (\S) [ ] (\2) /oxgc) { return 'Elatin4::split' . $e . qq {$1q$2 $3}; }
3406 10 elsif (/\G ' [ ] ' /oxgc) { return 'Elatin4::split' . $e . qq {' '}; }
3407 0 elsif (/\G " [ ] " /oxgc) { return 'Elatin4::split' . $e . qq {" "}; }
3408  
3409 # split qq//
3410 elsif (/\G \b (qq) \b /oxgc) {
3411 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
3412 else {
3413 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3414 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
3415 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq ( ) --> qr ( )
3416 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq { } --> qr { }
3417 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq [ ] --> qr [ ]
3418 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq < > --> qr < >
3419 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) /oxgc) { return e_split($e.'qr','{','}',$2,''); } # qq | | --> qr { }
3420 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq * * --> qr * *
3421 }
3422 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3423 }
3424 }
3425  
3426 # split qr//
3427 elsif (/\G \b (qr) \b /oxgc) {
3428 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
3429 else {
3430 12 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 12 0 12
3431 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
3432 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr ( )
3433 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr { }
3434 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr [ ]
3435 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr < >
3436 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { return e_split_q($e.'qr',$1, $3, $2,$4); } # qr ' '
3437 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr','{','}',$2,$4); } # qr | | --> qr { }
3438 12 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr * *
3439 }
3440 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3441 }
3442 }
3443  
3444 # split q//
3445 elsif (/\G \b (q) \b /oxgc) {
3446 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
3447 else {
3448 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3449 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
3450 0 elsif (/\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q ( ) --> qr ( )
3451 0 elsif (/\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q { } --> qr { }
3452 0 elsif (/\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q [ ] --> qr [ ]
3453 0 elsif (/\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q < > --> qr < >
3454 0 elsif (/\G ([*\-:?\\^|]) ((?:$q_char)*?) (\1) /oxgc) { return e_split_q($e.'qr','{','}',$2,''); } # q | | --> qr { }
3455 0 elsif (/\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q * * --> qr * *
3456 }
3457 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3458 }
3459 }
3460  
3461 # split m//
3462 elsif (/\G \b (m) \b /oxgc) {
3463 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
3464 else {
3465 18 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 18 0 18
3466 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
3467 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m ( ) --> qr ( )
3468 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m { } --> qr { }
3469 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m [ ] --> qr [ ]
3470 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m < > --> qr < >
3471 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { return e_split_q($e.'qr',$1, $3, $2,$4); } # m ' ' --> qr ' '
3472 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr','{','}',$2,$4); } # m | | --> qr { }
3473 18 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m * * --> qr * *
3474 }
3475 0 die __FILE__, ": Search pattern not terminated\n";
3476 }
3477 }
3478  
3479 # split ''
3480 elsif (/\G (\') /oxgc) {
3481 0 my $q_string = '';
3482 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3483 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
3484 0 elsif (/\G (\\\') /oxgc) { $q_string .= $1; } # splitqr'' --> split qr''
3485 0 elsif (/\G \' /oxgc) { return e_split_q($e.q{ qr},"'","'",$q_string,''); } # ' ' --> qr ' '
3486 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3487 }
3488 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3489 }
3490  
3491 # split ""
3492 elsif (/\G (\") /oxgc) {
3493 0 my $qq_string = '';
3494 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3495 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
3496 0 elsif (/\G (\\\") /oxgc) { $qq_string .= $1; } # splitqr"" --> split qr""
3497 0 elsif (/\G \" /oxgc) { return e_split($e.q{ qr},'"','"',$qq_string,''); } # " " --> qr " "
3498 0 elsif (/\G ($q_char) /oxgc) { $qq_string .= $1; }
3499 }
3500 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3501 }
3502  
3503 # split //
3504 elsif (/\G (\/) /oxgc) {
3505 44 my $regexp = '';
3506 44 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 381 0 381
3507 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
3508 0 elsif (/\G (\\\/) /oxgc) { $regexp .= $1; } # splitqr// --> split qr//
3509 44 elsif (/\G \/ ([cgimosxpadlunbB]*) /oxgc) { return e_split($e.q{ qr}, '/','/',$regexp,$1); } # / / --> qr / /
3510 337 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
3511 }
3512 0 die __FILE__, ": Search pattern not terminated\n";
3513 }
3514 }
3515  
3516 # tr/// or y///
3517  
3518 # about [cdsrbB]* (/B modifier)
3519 #
3520 # P.559 appendix C
3521 # of ISBN 4-89052-384-7 Programming perl
3522 # (Japanese title is: Perl puroguramingu)
3523  
3524 elsif (/\G \b ( tr | y ) \b /oxgc) {
3525 4 my $ope = $1;
3526  
3527 # $1 $2 $3 $4 $5 $6
3528 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
3529 0 my @tr = ($tr_variable,$2);
3530 0 return e_tr(@tr,'',$4,$6);
3531 }
3532 else {
3533 4 my $e = '';
3534 4 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 4 0 4
3535 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
3536 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) {
3537 0 my @tr = ($tr_variable,$2);
3538 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3539 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
3540 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) ( )
3541 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) { }
3542 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) [ ]
3543 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) < >
3544 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) * *
3545 }
3546 0 die __FILE__, ": Transliteration replacement not terminated\n";
3547 }
3548 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) {
3549 0 my @tr = ($tr_variable,$2);
3550 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3551 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin4::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3552 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } ( )
3553 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } { }
3554 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } [ ]
3555 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } < >
3556 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } * *
3557 }
3558 0 die __FILE__, ": Transliteration replacement not terminated\n";
3559 }
3560 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) {
3561 0 my @tr = ($tr_variable,$2);
3562 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3563 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin4::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3564 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] ( )
3565 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] { }
3566 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] [ ]
3567 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] < >
3568 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] * *
3569 }
3570 0 die __FILE__, ": Transliteration replacement not terminated\n";
3571 }
3572 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) {
3573 0 my @tr = ($tr_variable,$2);
3574 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3575 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin4::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3576 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > ( )
3577 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > { }
3578 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > [ ]
3579 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > < >
3580 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > * *
3581 }
3582 0 die __FILE__, ": Transliteration replacement not terminated\n";
3583 }
3584 # $1 $2 $3 $4 $5 $6
3585 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { # tr * * *
3586 4 my @tr = ($tr_variable,$2);
3587 4 return e_tr(@tr,'',$4,$6);
3588 }
3589 }
3590 0 die __FILE__, ": Transliteration pattern not terminated\n";
3591 }
3592 }
3593  
3594 # qq//
3595 elsif (/\G \b (qq) \b /oxgc) {
3596 2252 my $ope = $1;
3597  
3598 # if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { return e_qq($ope,$1,$3,$2); } # qq# #
3599 2252 ▶ if (/\G (\#) /oxgc) { # qq# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) /cgox) { } 0 2252 2252
3600 0 my $qq_string = '';
3601 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3602 0 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 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
3603 0 elsif (/\G (\\\#) /oxgc) { $qq_string .= $1; }
3604 0 elsif (/\G (\#) /oxgc) { return e_qq($ope,'#','#',$qq_string); }
3605 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3606 }
3607 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3608 }
3609  
3610 else {
3611 2252 my $e = '';
3612 2252 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 2252 0 2252
3613 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
3614  
3615 # elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq ( )
3616 elsif (/\G (\() /oxgc) { # qq ( )
3617 0 my $qq_string = '';
3618 0 local $nest = 1;
3619 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3620 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
3621 0 elsif (/\G (\\\)) /oxgc) { $qq_string .= $1; }
3622 0 elsif (/\G (\() /oxgc) { $qq_string .= $1; $nest++; }
3623 elsif (/\G (\)) /oxgc) {
3624 0 ▶ if (--$nest == 0) { return $e . e_qq($ope,'(',')',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin4::nest == 0) { } 0 0 0
3625 0 else { $qq_string .= $1; }
3626 }
3627 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3628 }
3629 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3630 }
3631  
3632 # elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq { }
3633 elsif (/\G (\{) /oxgc) { # qq { }
3634 2222 my $qq_string = '';
3635 2222 local $nest = 1;
3636 2222 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 85104 0 85104
3637 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
3638 0 elsif (/\G (\\\}) /oxgc) { $qq_string .= $1; }
3639 1189 elsif (/\G (\{) /oxgc) { $qq_string .= $1; $nest++; }
3640 elsif (/\G (\}) /oxgc) {
3641 3411 ▶ if (--$nest == 0) { return $e . e_qq($ope,'{','}',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin4::nest == 0) { } 2222 1189 3411
3642 1189 else { $qq_string .= $1; }
3643 }
3644 79782 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3645 }
3646 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3647 }
3648  
3649 # elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq [ ]
3650 elsif (/\G (\[) /oxgc) { # qq [ ]
3651 0 my $qq_string = '';
3652 0 local $nest = 1;
3653 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3654 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
3655 0 elsif (/\G (\\\]) /oxgc) { $qq_string .= $1; }
3656 0 elsif (/\G (\[) /oxgc) { $qq_string .= $1; $nest++; }
3657 elsif (/\G (\]) /oxgc) {
3658 0 ▶ if (--$nest == 0) { return $e . e_qq($ope,'[',']',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin4::nest == 0) { } 0 0 0
3659 0 else { $qq_string .= $1; }
3660 }
3661 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3662 }
3663 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3664 }
3665  
3666 # elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq < >
3667 elsif (/\G (\<) /oxgc) { # qq < >
3668 30 my $qq_string = '';
3669 30 local $nest = 1;
3670 30 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 1166 0 1166
3671 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
3672 0 elsif (/\G (\\\>) /oxgc) { $qq_string .= $1; }
3673 0 elsif (/\G (\<) /oxgc) { $qq_string .= $1; $nest++; }
3674 elsif (/\G (\>) /oxgc) {
3675 30 ▶ if (--$nest == 0) { return $e . e_qq($ope,'<','>',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin4::nest == 0) { } 30 0 30
3676 0 else { $qq_string .= $1; }
3677 }
3678 1114 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3679 }
3680 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3681 }
3682  
3683 # elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq * *
3684 elsif (/\G (\S) /oxgc) { # qq * *
3685 0 my $delimiter = $1;
3686 0 my $qq_string = '';
3687 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3688 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
3689 0 elsif (/\G (\\\Q$delimiter\E) /oxgc) { $qq_string .= $1; }
3690 0 elsif (/\G (\Q$delimiter\E) /oxgc) { return $e . e_qq($ope,$delimiter,$delimiter,$qq_string); }
3691 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3692 }
3693 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3694 }
3695 }
3696 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3697 }
3698 }
3699  
3700 # qr//
3701 elsif (/\G \b (qr) \b /oxgc) {
3702 0 my $ope = $1;
3703 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { # qr# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin4::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 0 0
3704 0 return e_qr($ope,$1,$3,$2,$4);
3705 }
3706 else {
3707 0 my $e = '';
3708 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3709 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
3710 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr ( )
3711 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr { }
3712 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr [ ]
3713 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr < >
3714 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { return $e . e_qr_q($ope,$1, $3, $2,$4); } # qr ' '
3715 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,'{','}',$2,$4); } # qr | | --> qr { }
3716 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr * *
3717 }
3718 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3719 }
3720 }
3721  
3722 # qw//
3723 elsif (/\G \b (qw) \b /oxgc) {
3724 16 my $ope = $1;
3725 16 ▶ if (/\G (\#) (.*?) (\#) /oxmsgc) { # qw# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) (.*?) (\#) /cgmosx) { } 0 16 16
3726 0 return e_qw($ope,$1,$3,$2);
3727 }
3728 else {
3729 16 my $e = '';
3730 16 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 16 0 16
3731 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
3732  
3733 16 elsif (/\G (\() ([^(]*?) (\)) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw ( )
3734 0 elsif (/\G (\() ((?:$q_paren)*?) (\)) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw ( )
3735  
3736 0 elsif (/\G (\{) ([^{]*?) (\}) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw { }
3737 0 elsif (/\G (\{) ((?:$q_brace)*?) (\}) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw { }
3738  
3739 0 elsif (/\G (\[) ([^[]*?) (\]) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw [ ]
3740 0 elsif (/\G (\[) ((?:$q_bracket)*?) (\]) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw [ ]
3741  
3742 0 elsif (/\G (\<) ([^<]*?) (\>) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw < >
3743 0 elsif (/\G (\<) ((?:$q_angle)*?) (\>) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw < >
3744  
3745 0 elsif (/\G ([\x21-\x3F]) (.*?) (\1) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw * *
3746 0 elsif (/\G (\S) ((?:$q_char)*?) (\1) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw * *
3747 }
3748 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3749 }
3750 }
3751  
3752 # qx//
3753 elsif (/\G \b (qx) \b /oxgc) {
3754 0 my $ope = $1;
3755 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qx# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin4::qq_char)*?) (\#) /cgox) { } 0 0 0
3756 0 return e_qq($ope,$1,$3,$2);
3757 }
3758 else {
3759 0 my $e = '';
3760 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3761 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
3762 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx ( )
3763 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx { }
3764 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx [ ]
3765 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx < >
3766 0 elsif (/\G (\') ((?:$qq_char)*?) (\') /oxgc) { return $e . e_q ($ope,$1,$3,$2); } # qx ' '
3767 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx * *
3768 }
3769 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3770 }
3771 }
3772  
3773 # q//
3774 elsif (/\G \b (q) \b /oxgc) {
3775 473 my $ope = $1;
3776  
3777 # if (/\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { return e_q($ope,$1,$3,$2); } # q# #
3778  
3779 # avoid "Error: Runtime exception" of perl version 5.005_03
3780 # (and so on)
3781  
3782 473 ▶ if (/\G (\#) /oxgc) { # q# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) /cgox) { } 0 473 473
3783 0 my $q_string = '';
3784 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3785 0 ▶ if (/\G (\\\\) /oxgc) { $q_string .= $1; }
Branch: 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
3786 0 elsif (/\G (\\\#) /oxgc) { $q_string .= $1; }
3787 0 elsif (/\G (\#) /oxgc) { return e_q($ope,'#','#',$q_string); }
3788 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3789 }
3790 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3791 }
3792  
3793 else {
3794 473 my $e = '';
3795 473 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 473 0 473
3796 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
3797  
3798 # elsif (/\G (\() ((?:\\\)|\\\\|$q_paren)*?) (\)) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q ( )
3799 elsif (/\G (\() /oxgc) { # q ( )
3800 0 my $q_string = '';
3801 0 local $nest = 1;
3802 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3803 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
3804 0 elsif (/\G (\\\)) /oxgc) { $q_string .= $1; }
3805 0 elsif (/\G (\\\() /oxgc) { $q_string .= $1; }
3806 0 elsif (/\G (\() /oxgc) { $q_string .= $1; $nest++; }
3807 elsif (/\G (\)) /oxgc) {
3808 0 ▶ if (--$nest == 0) { return $e . e_q($ope,'(',')',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin4::nest == 0) { } 0 0 0
3809 0 else { $q_string .= $1; }
3810 }
3811 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3812 }
3813 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3814 }
3815  
3816 # elsif (/\G (\{) ((?:\\\}|\\\\|$q_brace)*?) (\}) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q { }
3817 elsif (/\G (\{) /oxgc) { # q { }
3818 467 my $q_string = '';
3819 467 local $nest = 1;
3820 467 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 8249 0 8249
3821 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
3822 0 elsif (/\G (\\\}) /oxgc) { $q_string .= $1; }
3823 0 elsif (/\G (\\\{) /oxgc) { $q_string .= $1; }
3824 159 elsif (/\G (\{) /oxgc) { $q_string .= $1; $nest++; }
3825 elsif (/\G (\}) /oxgc) {
3826 626 ▶ if (--$nest == 0) { return $e . e_q($ope,'{','}',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin4::nest == 0) { } 467 159 626
3827 159 else { $q_string .= $1; }
3828 }
3829 7464 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3830 }
3831 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3832 }
3833  
3834 # elsif (/\G (\[) ((?:\\\]|\\\\|$q_bracket)*?) (\]) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q [ ]
3835 elsif (/\G (\[) /oxgc) { # q [ ]
3836 0 my $q_string = '';
3837 0 local $nest = 1;
3838 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3839 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
3840 0 elsif (/\G (\\\]) /oxgc) { $q_string .= $1; }
3841 0 elsif (/\G (\\\[) /oxgc) { $q_string .= $1; }
3842 0 elsif (/\G (\[) /oxgc) { $q_string .= $1; $nest++; }
3843 elsif (/\G (\]) /oxgc) {
3844 0 ▶ if (--$nest == 0) { return $e . e_q($ope,'[',']',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin4::nest == 0) { } 0 0 0
3845 0 else { $q_string .= $1; }
3846 }
3847 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3848 }
3849 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3850 }
3851  
3852 # elsif (/\G (\<) ((?:\\\>|\\\\|$q_angle)*?) (\>) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q < >
3853 elsif (/\G (\<) /oxgc) { # q < >
3854 5 my $q_string = '';
3855 5 local $nest = 1;
3856 5 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 88 0 88
3857 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
3858 0 elsif (/\G (\\\>) /oxgc) { $q_string .= $1; }
3859 0 elsif (/\G (\\\<) /oxgc) { $q_string .= $1; }
3860 0 elsif (/\G (\<) /oxgc) { $q_string .= $1; $nest++; }
3861 elsif (/\G (\>) /oxgc) {
3862 5 ▶ if (--$nest == 0) { return $e . e_q($ope,'<','>',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin4::nest == 0) { } 5 0 5
3863 0 else { $q_string .= $1; }
3864 }
3865 83 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3866 }
3867 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3868 }
3869  
3870 # elsif (/\G (\S) ((?:\\\1|\\\\|$q_char)*?) (\1) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q * *
3871 elsif (/\G (\S) /oxgc) { # q * *
3872 1 my $delimiter = $1;
3873 1 my $q_string = '';
3874 1 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 14 0 14
3875 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
3876 0 elsif (/\G (\\\Q$delimiter\E) /oxgc) { $q_string .= $1; }
3877 1 elsif (/\G (\Q$delimiter\E) /oxgc) { return $e . e_q($ope,$delimiter,$delimiter,$q_string); }
3878 13 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3879 }
3880 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3881 }
3882 }
3883 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3884 }
3885 }
3886  
3887 # m//
3888 elsif (/\G \b (m) \b /oxgc) {
3889 209 my $ope = $1;
3890 209 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { # m# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin4::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
3891 0 return e_qr($ope,$1,$3,$2,$4);
3892 }
3893 else {
3894 209 my $e = '';
3895 209 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 209 0 209
3896 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
3897 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m ( )
3898 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m { }
3899 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m [ ]
3900 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m < >
3901 0 elsif (/\G (\?) ((?:$qq_char)*?) (\?) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m ? ?
3902 10 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr_q($ope,$1, $3, $2,$4); } # m ' '
3903 0 elsif (/\G ([*\-:\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,'{','}',$2,$4); } # m | | --> m { }
3904 199 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m * *
3905 }
3906 0 die __FILE__, ": Search pattern not terminated\n";
3907 }
3908 }
3909  
3910 # s///
3911  
3912 # about [cegimosxpradlunbB]* (/cg modifier)
3913 #
3914 # P.67 Pattern-Matching Operators
3915 # of ISBN 0-596-00241-6 Perl in a Nutshell, Second Edition.
3916  
3917 elsif (/\G \b (s) \b /oxgc) {
3918 101 my $ope = $1;
3919  
3920 # $1 $2 $3 $4 $5 $6
3921 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
3922 1 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3923 }
3924 else {
3925 100 my $e = '';
3926 100 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 100 0 100
3927 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
3928 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) {
3929 0 my @s = ($1,$2,$3);
3930 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3931 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
3932 # $1 $2 $3 $4
3933 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3934 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3935 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3936 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3937 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3938 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3939 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3940 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3941 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3942 }
3943 0 die __FILE__, ": Substitution replacement not terminated\n";
3944 }
3945 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) {
3946 0 my @s = ($1,$2,$3);
3947 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3948 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 10 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\') ((?:$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
3949 # $1 $2 $3 $4
3950 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3951 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3952 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3953 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3954 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3955 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3956 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3957 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3958 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3959 }
3960 0 die __FILE__, ": Substitution replacement not terminated\n";
3961 }
3962 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) {
3963 0 my @s = ($1,$2,$3);
3964 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3965 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 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
3966 # $1 $2 $3 $4
3967 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3968 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3969 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3970 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3971 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3972 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3973 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3974 }
3975 0 die __FILE__, ": Substitution replacement not terminated\n";
3976 }
3977 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) {
3978 0 my @s = ($1,$2,$3);
3979 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3980 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
3981 # $1 $2 $3 $4
3982 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3983 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3984 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3985 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3986 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3987 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3988 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3989 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3990 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3991 }
3992 0 die __FILE__, ": Substitution replacement not terminated\n";
3993 }
3994 # $1 $2 $3 $4 $5 $6
3995 elsif (/\G (\') ((?:$qq_char)*?) (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) {
3996 21 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3997 }
3998 # $1 $2 $3 $4 $5 $6
3999 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
4000 0 return e_sub($sub_variable,'{',$2,'}','{',$4,'}',$6); # s | | | --> s { } { }
4001 }
4002 # $1 $2 $3 $4 $5 $6
4003 elsif (/\G (\$) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
4004 0 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
4005 }
4006 # $1 $2 $3 $4 $5 $6
4007 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
4008 79 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
4009 }
4010 }
4011 0 die __FILE__, ": Substitution pattern not terminated\n";
4012 }
4013 }
4014  
4015 # require ignore module
4016 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# require$1$2"; }
4017 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# require$1\n$2"; }
4018 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# require$1"; }
4019  
4020 # use strict; --> use strict; no strict qw(refs);
4021 37 elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "use$1 no strict qw(refs);$2"; }
4022 0 elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [^#]) /oxmsgc) { return "use$1 no strict qw(refs);\n$2"; }
4023 0 elsif (/\G \b use ((?>\s+) strict) \b /oxmsgc) { return "use$1; no strict qw(refs)"; }
4024  
4025 # use 5.12.0; --> use 5.12.0; no strict qw(refs);
4026 elsif (/\G \b use (?>\s+) ((?>([1-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /oxmsgc) {
4027 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
4028 0 return "use $1; no strict qw(refs);";
4029 }
4030 else {
4031 2 return "use $1;";
4032 }
4033 }
4034 elsif (/\G \b use (?>\s+) ((?>v([0-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /oxmsgc) {
4035 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
4036 0 return "use $1; no strict qw(refs);";
4037 }
4038 else {
4039 0 return "use $1;";
4040 }
4041 }
4042  
4043 # ignore use module
4044 2 elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# use$1$2"; }
4045 0 elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# use$1\n$2"; }
4046 0 elsif (/\G \b use ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# use$1"; }
4047  
4048 # ignore no module
4049 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# no$1$2"; }
4050 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# no$1\n$2"; }
4051 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# no$1"; }
4052  
4053 # use else
4054 0 elsif (/\G \b use \b /oxmsgc) { return "use"; }
4055  
4056 # use else
4057 2 elsif (/\G \b no \b /oxmsgc) { return "no"; }
4058  
4059 # ''
4060 elsif (/\G (?<![\w\$\@\%\&\*]) (\') /oxgc) {
4061 1142 my $q_string = '';
4062 1142 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 10175 0 10175
4063 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
4064 48 elsif (/\G (\\\') /oxgc) { $q_string .= $1; }
4065 1142 elsif (/\G \' /oxgc) { return e_q('', "'","'",$q_string); }
4066 8981 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
4067 }
4068 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4069 }
4070  
4071 # ""
4072 elsif (/\G (\") /oxgc) {
4073 1917 my $qq_string = '';
4074 1917 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 37258 0 37258
4075 37258 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 67 37191 37258
elsif (/\G (\\\") /cgox) { } 12 37179 37191
elsif (/\G \" /cgox) { } 1917 35262 37179
elsif (/\G ($Elatin4::q_char) /cgox) { } 35262 0 35262
4076 12 elsif (/\G (\\\") /oxgc) { $qq_string .= $1; }
4077 1917 elsif (/\G \" /oxgc) { return e_qq('', '"','"',$qq_string); }
4078 35262 elsif (/\G ($q_char) /oxgc) { $qq_string .= $1; }
4079 }
4080 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4081 }
4082  
4083 # ``
4084 elsif (/\G (\`) /oxgc) {
4085 1 my $qx_string = '';
4086 1 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 19 0 19
4087 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
4088 0 elsif (/\G (\\\`) /oxgc) { $qx_string .= $1; }
4089 1 elsif (/\G \` /oxgc) { return e_qq('', '`','`',$qx_string); }
4090 18 elsif (/\G ($q_char) /oxgc) { $qx_string .= $1; }
4091 }
4092 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4093 }
4094  
4095 # // --- not divide operator (num / num), not defined-or
4096 ▶ elsif (($slash eq 'm//') and /\G (\/) /oxgc) {
Condition100%3/3
$Elatin4::slash eq "m//" and m[\G (/) ]cgox
!ll&&!rl&&r
273488836681
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
4097 681 my $regexp = '';
4098 681 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 5636 0 5636
4099 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
4100 0 elsif (/\G (\\\/) /oxgc) { $regexp .= $1; }
4101 681 elsif (/\G \/ ([cgimosxpadlunbB]*) /oxgc) { return e_qr('', '/','/',$regexp,$1); }
4102 4955 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
4103 }
4104 0 die __FILE__, ": Search pattern not terminated\n";
4105 }
4106  
4107 # ?? --- not conditional operator (condition ? then : else)
4108 ▶ elsif (($slash eq 'm//') and /\G (\?) /oxgc) {
Condition66%2/3
$Elatin4::slash eq "m//" and /\G (\?) /cgox
!ll&&!rl&&r
2734888360
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
4109 0 my $regexp = '';
4110 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
4111 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
4112 0 elsif (/\G (\\\?) /oxgc) { $regexp .= $1; }
4113 0 elsif (/\G \? ([cgimosxpadlunbB]*) /oxgc) { return e_qr('m','?','?',$regexp,$1); }
4114 0 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
4115 }
4116 0 die __FILE__, ": Search pattern not terminated\n";
4117 }
4118  
4119 # <<>> (a safer ARGV)
4120 0 elsif (/\G ( <<>> ) /oxgc) { $slash = 'm//'; return $1; }
4121  
4122 # << (bit shift) --- not here document
4123 0 elsif (/\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /oxgc) { $slash = 'm//'; return $1; }
4124  
4125 # <<~'HEREDOC'
4126 elsif (/\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /oxgc) {
4127 6 $slash = 'm//';
4128 6 my $here_quote = $1;
4129 6 my $delimiter = $2;
4130  
4131 # get here document
4132 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4133 6 $here_script = CORE::substr $_, pos $_;
4134 6 $here_script =~ s/.*?\n//oxm;
4135 }
4136 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
4137 6 my $heredoc = $1;
4138 6 my $indent = $2;
4139 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4140 6 push @heredoc, $heredoc . qq{\n$delimiter\n};
4141 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4142 }
4143 else {
4144 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4145 }
4146 6 return qq{<<'$delimiter'};
4147 }
4148  
4149 # <<~\HEREDOC
4150  
4151 # P.66 2.6.6. "Here" Documents
4152 # in Chapter 2: Bits and Pieces
4153 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4154  
4155 # P.73 "Here" Documents
4156 # in Chapter 2: Bits and Pieces
4157 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4158  
4159 elsif (/\G ( <<~ \\([a-zA-Z_0-9]+) ) /oxgc) {
4160 3 $slash = 'm//';
4161 3 my $here_quote = $1;
4162 3 my $delimiter = $2;
4163  
4164 # get here document
4165 3 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 3 0 3
4166 3 $here_script = CORE::substr $_, pos $_;
4167 3 $here_script =~ s/.*?\n//oxm;
4168 }
4169 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
4170 3 my $heredoc = $1;
4171 3 my $indent = $2;
4172 3 $heredoc =~ s{^$indent}{}msg; # no /ox
4173 3 push @heredoc, $heredoc . qq{\n$delimiter\n};
4174 3 push @heredoc_delimiter, qq{\\s*$delimiter};
4175 }
4176 else {
4177 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4178 }
4179 3 return qq{<<\\$delimiter};
4180 }
4181  
4182 # <<~"HEREDOC"
4183 elsif (/\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /oxgc) {
4184 6 $slash = 'm//';
4185 6 my $here_quote = $1;
4186 6 my $delimiter = $2;
4187  
4188 # get here document
4189 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4190 6 $here_script = CORE::substr $_, pos $_;
4191 6 $here_script =~ s/.*?\n//oxm;
4192 }
4193 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
4194 6 my $heredoc = $1;
4195 6 my $indent = $2;
4196 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4197 6 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4198 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4199 }
4200 else {
4201 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4202 }
4203 6 return qq{<<"$delimiter"};
4204 }
4205  
4206 # <<~HEREDOC
4207 elsif (/\G ( <<~ ([a-zA-Z_0-9]+) ) /oxgc) {
4208 3 $slash = 'm//';
4209 3 my $here_quote = $1;
4210 3 my $delimiter = $2;
4211  
4212 # get here document
4213 3 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 3 0 3
4214 3 $here_script = CORE::substr $_, pos $_;
4215 3 $here_script =~ s/.*?\n//oxm;
4216 }
4217 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
4218 3 my $heredoc = $1;
4219 3 my $indent = $2;
4220 3 $heredoc =~ s{^$indent}{}msg; # no /ox
4221 3 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4222 3 push @heredoc_delimiter, qq{\\s*$delimiter};
4223 }
4224 else {
4225 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4226 }
4227 3 return qq{<<$delimiter};
4228 }
4229  
4230 # <<~`HEREDOC`
4231 elsif (/\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /oxgc) {
4232 6 $slash = 'm//';
4233 6 my $here_quote = $1;
4234 6 my $delimiter = $2;
4235  
4236 # get here document
4237 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4238 6 $here_script = CORE::substr $_, pos $_;
4239 6 $here_script =~ s/.*?\n//oxm;
4240 }
4241 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
4242 6 my $heredoc = $1;
4243 6 my $indent = $2;
4244 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4245 6 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4246 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4247 }
4248 else {
4249 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4250 }
4251 6 return qq{<<`$delimiter`};
4252 }
4253  
4254 # <<'HEREDOC'
4255 elsif (/\G ( << '([a-zA-Z_0-9]*)' ) /oxgc) {
4256 72 $slash = 'm//';
4257 72 my $here_quote = $1;
4258 72 my $delimiter = $2;
4259  
4260 # get here document
4261 72 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 72 0 72
4262 72 $here_script = CORE::substr $_, pos $_;
4263 72 $here_script =~ s/.*?\n//oxm;
4264 }
4265 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
4266 72 push @heredoc, $1 . qq{\n$delimiter\n};
4267 72 push @heredoc_delimiter, $delimiter;
4268 }
4269 else {
4270 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4271 }
4272 72 return $here_quote;
4273 }
4274  
4275 # <<\HEREDOC
4276  
4277 # P.66 2.6.6. "Here" Documents
4278 # in Chapter 2: Bits and Pieces
4279 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4280  
4281 # P.73 "Here" Documents
4282 # in Chapter 2: Bits and Pieces
4283 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4284  
4285 elsif (/\G ( << \\([a-zA-Z_0-9]+) ) /oxgc) {
4286 0 $slash = 'm//';
4287 0 my $here_quote = $1;
4288 0 my $delimiter = $2;
4289  
4290 # get here document
4291 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4292 0 $here_script = CORE::substr $_, pos $_;
4293 0 $here_script =~ s/.*?\n//oxm;
4294 }
4295 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
4296 0 push @heredoc, $1 . qq{\n$delimiter\n};
4297 0 push @heredoc_delimiter, $delimiter;
4298 }
4299 else {
4300 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4301 }
4302 0 return $here_quote;
4303 }
4304  
4305 # <<"HEREDOC"
4306 elsif (/\G ( << "([a-zA-Z_0-9]*)" ) /oxgc) {
4307 36 $slash = 'm//';
4308 36 my $here_quote = $1;
4309 36 my $delimiter = $2;
4310  
4311 # get here document
4312 36 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 36 0 36
4313 36 $here_script = CORE::substr $_, pos $_;
4314 36 $here_script =~ s/.*?\n//oxm;
4315 }
4316 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
4317 36 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4318 36 push @heredoc_delimiter, $delimiter;
4319 }
4320 else {
4321 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4322 }
4323 36 return $here_quote;
4324 }
4325  
4326 # <<HEREDOC
4327 elsif (/\G ( << ([a-zA-Z_0-9]+) ) /oxgc) {
4328 42 $slash = 'm//';
4329 42 my $here_quote = $1;
4330 42 my $delimiter = $2;
4331  
4332 # get here document
4333 42 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 42 0 42
4334 42 $here_script = CORE::substr $_, pos $_;
4335 42 $here_script =~ s/.*?\n//oxm;
4336 }
4337 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
4338 42 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4339 42 push @heredoc_delimiter, $delimiter;
4340 }
4341 else {
4342 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4343 }
4344 42 return $here_quote;
4345 }
4346  
4347 # <<`HEREDOC`
4348 elsif (/\G ( << `([a-zA-Z_0-9]*)` ) /oxgc) {
4349 0 $slash = 'm//';
4350 0 my $here_quote = $1;
4351 0 my $delimiter = $2;
4352  
4353 # get here document
4354 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4355 0 $here_script = CORE::substr $_, pos $_;
4356 0 $here_script =~ s/.*?\n//oxm;
4357 }
4358 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
4359 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4360 0 push @heredoc_delimiter, $delimiter;
4361 }
4362 else {
4363 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4364 }
4365 0 return $here_quote;
4366 }
4367  
4368 # <<= <=> <= < operator
4369 elsif (/\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/oxgc) {
4370 12 return $1;
4371 }
4372  
4373 # <FILEHANDLE>
4374 elsif (/\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /oxgc) {
4375 0 return $1;
4376 }
4377  
4378 # <WILDCARD> --- glob
4379  
4380 # avoid "Error: Runtime exception" of perl version 5.005_03
4381  
4382 elsif (/\G < ((?:[^>\0\a\e\f\n\r\t])+?) > /oxgc) {
4383 0 return 'Elatin4::glob("' . $1 . '")';
4384 }
4385  
4386 # __DATA__
4387 0 elsif (/\G ^ ( __DATA__ \n .*) \z /oxmsgc) { return $1; }
4388  
4389 # __END__
4390 210 elsif (/\G ^ ( __END__ \n .*) \z /oxmsgc) { return $1; }
4391  
4392 # \cD Control-D
4393  
4394 # P.68 2.6.8. Other Literal Tokens
4395 # in Chapter 2: Bits and Pieces
4396 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4397  
4398 # P.76 Other Literal Tokens
4399 # in Chapter 2: Bits and Pieces
4400 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4401  
4402 0 elsif (/\G ( \cD .*) \z /oxmsgc) { return $1; }
4403  
4404 # \cZ Control-Z
4405 0 elsif (/\G ( \cZ .*) \z /oxmsgc) { return $1; }
4406  
4407 # any operator before div
4408 elsif (/\G (
4409 -- | \+\+ |
4410 [\)\}\]]
4411  
4412 5837 ) /oxgc) { $slash = 'div'; return $1; }
4413  
4414 # yada-yada or triple-dot operator
4415 elsif (/\G (
4416 \.\.\.
4417  
4418 7 ) /oxgc) { $slash = 'm//'; return q{die('Unimplemented')}; }
4419  
4420 # any operator before m//
4421  
4422 # //, //= (defined-or)
4423  
4424 # P.164 Logical Operators
4425 # in Chapter 10: More Control Structures
4426 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
4427  
4428 # P.119 C-Style Logical (Short-Circuit) Operators
4429 # in Chapter 3: Unary and Binary Operators
4430 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4431  
4432 # (and so on)
4433  
4434 # ~~
4435  
4436 # P.221 The Smart Match Operator
4437 # in Chapter 15: Smart Matching and given-when
4438 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
4439  
4440 # P.112 Smartmatch Operator
4441 # in Chapter 3: Unary and Binary Operators
4442 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4443  
4444 # (and so on)
4445  
4446 elsif (/\G ((?>
4447  
4448 !~~ | !~ | != | ! |
4449 %= | % |
4450 &&= | && | &= | &\.= | &\. | & |
4451 -= | -> | - |
4452 :(?>\s*)= |
4453 : |
4454 <<>> |
4455 <<= | <=> | <= | < |
4456 == | => | =~ | = |
4457 >>= | >> | >= | > |
4458 \*\*= | \*\* | \*= | \* |
4459 \+= | \+ |
4460 \.\. | \.= | \. |
4461 \/\/= | \/\/ |
4462 \/= | \/ |
4463 \? |
4464 \\ |
4465 \^= | \^\.= | \^\. | \^ |
4466 \b x= |
4467 \|\|= | \|\| | \|= | \|\.= | \|\. | \| |
4468 ~~ | ~\. | ~ |
4469 \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b |
4470 \b(?: print )\b |
4471  
4472 [,;\(\{\[]
4473  
4474 9788 )) /oxgc) { $slash = 'm//'; return $1; }
4475  
4476 # other any character
4477 20156 elsif (/\G ($q_char) /oxgc) { $slash = 'div'; return $1; }
4478  
4479 # system error
4480 else {
4481 0 die __FILE__, ": Oops, this shouldn't happen!\n";
4482 }
4483 }
4484  
4485 # escape Latin-4 string
4486 1871 ▶sub e_string {
Subroutine e_string: called CC=228 SCAR=104.2
Pod documented
4487 1871 my($string) = @_;
4488 1871 my $e_string = '';
4489  
4490 1871 local $slash = 'm//';
4491  
4492 # P.1024 Appendix W.10 Multibyte Processing
4493 # of ISBN 1-56592-224-7 CJKV Information Processing
4494 # (and so on)
4495  
4496 1871 my @char = $string =~ / \G (?>[^\\]|\\$q_char|$q_char) /oxmsg;
4497  
4498 # without { ... }
4499 1871 ▶ if (not (grep(/\A \{ \z/xms, @char) and grep(/\A \} \z/xms, @char))) {
Branch: 1 branch
BranchTrueFalseTotal
unless (grep /\A \{ \z/msx, @char and grep /\A \} \z/msx, @char) 1854 17 1871
Condition66%2/3
grep /\A \{ \z/msx, @char and grep /\A \} \z/msx, @char
!ll&&!rl&&r
1854017
MC/DC50%1/2
grep /\A \{ \z/msx, @char and grep /\A \} \z/msx, @char
grep /\A \{ \z/msx, @char grep /\A \} \z/msx, @char
Truth table66%2/3
A and B
A= grep /\A \{ \z/msx, @charB= grep /\A \} \z/msx, @char
ABresult
0X0
100
111
4500 1854 ▶ if ($string !~ /<</oxms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /<</mosx) 1854 0 1854
4501 1854 return $string;
4502 }
4503 }
4504  
4505 E_STRING_LOOP:
4506 17 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 190 17 207
4507 190 ▶ if (0) {
Branch: 101 branches
BranchTrueFalseTotal
if (do { $string =~ /\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /cgmosx }) { } 0 190 190
elsif ($string =~ /\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G ( \$' | \$\{'\} ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G ( \$ 0 ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G ( \$ \$ ) (?![\w\{]) /cgmosx) { } 0 190 190
elsif ($string =~ /\G \$ ((?>[1-9][0-9]*)) /cgmosx) { } 0 190 190
elsif ($string =~ /\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /cgmosx) { } 0 190 190
elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /cgmosx) { } 0 190 190
elsif ($string =~ /\G \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} /cgmosx) { } 0 190 190
elsif ($string =~ /\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /cgmosx) { } 3 187 190
elsif ($string =~ /\G ( (?: [\$\@\%\&\*] | \$\# | -> | \b sub \b) (?>\s*) (?: split | chop | index | rindex | lc | uc | fc | chr | ord | reverse | getc | tr | y | q | qq | qx | qw | m | s | qr | glob | lstat | opendir | stat | unlink | chdir ) ) \b /cgmosx) { } 7 180 187
elsif ($string =~ m{\G ( \$[\$\@\#\\\'\"/\?\(\)\[\]\<\>] ) }cgmosx) { } 0 180 180
elsif ($string =~ /\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b Char::eval (?= (?>\s*) \{ ) /cgox) { } 0 180 180
elsif ($string =~ /\G \b Latin4::eval (?= (?>\s*) \{ ) /cgox) { } 0 180 180
elsif ($string =~ /\G \b Char::eval \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b Latin4::eval \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::substr \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b chop \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::index \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b Char::index \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b Latin4::index \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b index \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::rindex \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b Char::rindex \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b Latin4::rindex \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b rindex \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s*) (\") ((?:$Elatin4::qq_char)+?) (\") /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\#) ((?:$Elatin4::qq_char)+?) (\#) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\S) ((?:$Elatin4::qq_char)+?) (\1) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s*) (\') ((?:\\\'|\\\\|$Elatin4::q_char)+?) (\') /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$Elatin4::q_char)+?) (\#) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$Elatin4::q_char)+?) (\1) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)*) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ))*) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?= (?>\s+) [a-z]+) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) ((?>\w+)) /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b lc \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b lcfirst \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b uc \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b ucfirst \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b fc \b /cgox) { } 0 180 180
elsif ($string =~ /\G -s \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::length \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::chr \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b chr \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::ord \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b ord \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b glob \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b reverse \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b getc \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b (split) \b (?! (?>\s*) => ) /cgox) { } 0 180 180
elsif ($string =~ /\G \b (qq) \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b (qx) \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b (q) \b /cgox) { } 0 180 180
elsif ($string =~ /\G (?<![\w\$\@\%\&\*]) (\') ((?:\\\'|\\\\|$Elatin4::q_char)*?) (\') /cgox) { } 0 180 180
elsif ($string =~ /\G (\") ((?:$Elatin4::qq_char)*?) (\") /cgox) { } 0 180 180
elsif ($string =~ /\G (\`) ((?:$Elatin4::qq_char)*?) (\`) /cgox) { } 0 180 180
elsif ($string =~ /\G ( <<>> ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/cgox) { } 0 180 180
elsif ($string =~ /\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /cgox) { } 0 180 180
elsif ($string =~ /\G < ((?:$Elatin4::q_char)+?) > /cgox) { } 0 180 180
elsif ($string =~ /\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( <<~ \\([a-zA-Z_0-9]+) ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( <<~ ([a-zA-Z_0-9]+) ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( << '([a-zA-Z_0-9]*)' ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( << \\([a-zA-Z_0-9]+) ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( << "([a-zA-Z_0-9]*)" ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( << ([a-zA-Z_0-9]+) ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( << `([a-zA-Z_0-9]*)` ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( -- | \+\+ | [\)\}\]] ) /cgox) { } 18 162 180
elsif ($string =~ /\G ( \.\.\. ) /cgox) { } 0 162 162
elsif ($string =~ m"\G ((?> !~~ | !~ | != | ! | %= | % | &&= | && | &= | &\.= | &\. | & | -= | -> | - | :(?>\s*)= | : | <<>> | <<= | <=> | <= | < | == | => | =~ | = | >>= | >> | >= | > | \*\*= | \*\* | \*= | \* | \+= | \+ | \.\. | \.= | \. | //= | // | /= | / | \? | \\ | \^= | \^\.= | \^\. | \^ | \b x= | \|\|= | \|\| | \|= | \|\.= | \|\. | \| | ~~ | ~\. | ~ | \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b | \b(?: print )\b | [,;\(\{\[] )) "cgox) { } 31 131 162
elsif ($string =~ /\G ($Elatin4::q_char) /cgox) { } 131 0 131
4508 }
4509  
4510 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> @{[Elatin4::PREMATCH()]}
4511 elsif ($string =~ /\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /oxmsgc) {
4512 0 $e_string .= q{Elatin4::PREMATCH()};
4513 0 $slash = 'div';
4514 }
4515  
4516 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> @{[Elatin4::MATCH()]}
4517 elsif ($string =~ /\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /oxmsgc) {
4518 0 $e_string .= q{Elatin4::MATCH()};
4519 0 $slash = 'div';
4520 }
4521  
4522 # $', ${'} --> $', ${'}
4523 elsif ($string =~ /\G ( \$' | \$\{'\} ) /oxmsgc) {
4524 0 $e_string .= $1;
4525 0 $slash = 'div';
4526 }
4527  
4528 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> @{[Elatin4::POSTMATCH()]}
4529 elsif ($string =~ /\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /oxmsgc) {
4530 0 $e_string .= q{Elatin4::POSTMATCH()};
4531 0 $slash = 'div';
4532 }
4533  
4534 # bareword
4535 elsif ($string =~ /\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /oxmsgc) {
4536 0 $e_string .= $1;
4537 0 $slash = 'div';
4538 }
4539  
4540 # $0 --> $0
4541 elsif ($string =~ /\G ( \$ 0 ) /oxmsgc) {
4542 0 $e_string .= $1;
4543 0 $slash = 'div';
4544 }
4545 elsif ($string =~ /\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /oxmsgc) {
4546 0 $e_string .= $1;
4547 0 $slash = 'div';
4548 }
4549  
4550 # $$ --> $$
4551 elsif ($string =~ /\G ( \$ \$ ) (?![\w\{]) /oxmsgc) {
4552 0 $e_string .= $1;
4553 0 $slash = 'div';
4554 }
4555  
4556 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
4557 # $1, $2, $3 --> $1, $2, $3 otherwise
4558 elsif ($string =~ /\G \$ ((?>[1-9][0-9]*)) /oxmsgc) {
4559 0 $e_string .= e_capture($1);
4560 0 $slash = 'div';
4561 }
4562 elsif ($string =~ /\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /oxmsgc) {
4563 0 $e_string .= e_capture($1);
4564 0 $slash = 'div';
4565 }
4566  
4567 # $$foo[ ... ] --> $ $foo->[ ... ]
4568 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /oxmsgc) {
4569 0 $e_string .= e_capture($1.'->'.$2);
4570 0 $slash = 'div';
4571 }
4572  
4573 # $$foo{ ... } --> $ $foo->{ ... }
4574 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /oxmsgc) {
4575 0 $e_string .= e_capture($1.'->'.$2);
4576 0 $slash = 'div';
4577 }
4578  
4579 # $$foo
4580 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /oxmsgc) {
4581 0 $e_string .= e_capture($1);
4582 0 $slash = 'div';
4583 }
4584  
4585 # ${ foo }
4586 elsif ($string =~ /\G \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} /oxmsgc) {
4587 0 $e_string .= '${' . $1 . '}';
4588 0 $slash = 'div';
4589 }
4590  
4591 # ${ ... }
4592 elsif ($string =~ /\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /oxmsgc) {
4593 3 $e_string .= e_capture($1);
4594 3 $slash = 'div';
4595 }
4596  
4597 # variable or function
4598 # $ @ % & * $ #
4599 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) {
4600 7 $e_string .= $1;
4601 7 $slash = 'div';
4602 }
4603 # $ $ $ $ $ $ $ $ $ $ $ $ $ $
4604 # $ @ # \ ' " / ? ( ) [ ] < >
4605 elsif ($string =~ /\G ( \$[\$\@\#\\\'\"\/\?\(\)\[\]\<\>] ) /oxmsgc) {
4606 0 $e_string .= $1;
4607 0 $slash = 'div';
4608 }
4609  
4610 # subroutines of package Elatin4
4611 0 elsif ($string =~ /\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /oxgc) { $e_string .= $1; $slash = 'm//'; }
4612 0 elsif ($string =~ /\G \b Char::eval (?= (?>\s*) \{ ) /oxgc) { $e_string .= 'eval'; $slash = 'm//'; }
4613 0 elsif ($string =~ /\G \b Latin4::eval (?= (?>\s*) \{ ) /oxgc) { $e_string .= 'eval'; $slash = 'm//'; }
4614 0 elsif ($string =~ /\G \b Char::eval \b /oxgc) { $e_string .= 'eval Char::escape'; $slash = 'm//'; }
4615 0 elsif ($string =~ /\G \b Latin4::eval \b /oxgc) { $e_string .= 'eval Latin4::escape'; $slash = 'm//'; }
4616 0 elsif ($string =~ /\G \b bytes::substr \b /oxgc) { $e_string .= 'substr'; $slash = 'm//'; }
4617 0 elsif ($string =~ /\G \b chop \b /oxgc) { $e_string .= 'Elatin4::chop'; $slash = 'm//'; }
4618 0 elsif ($string =~ /\G \b bytes::index \b /oxgc) { $e_string .= 'index'; $slash = 'm//'; }
4619 0 elsif ($string =~ /\G \b Char::index \b /oxgc) { $e_string .= 'Char::index'; $slash = 'm//'; }
4620 0 elsif ($string =~ /\G \b Latin4::index \b /oxgc) { $e_string .= 'Latin4::index'; $slash = 'm//'; }
4621 0 elsif ($string =~ /\G \b index \b /oxgc) { $e_string .= 'Elatin4::index'; $slash = 'm//'; }
4622 0 elsif ($string =~ /\G \b bytes::rindex \b /oxgc) { $e_string .= 'rindex'; $slash = 'm//'; }
4623 0 elsif ($string =~ /\G \b Char::rindex \b /oxgc) { $e_string .= 'Char::rindex'; $slash = 'm//'; }
4624 0 elsif ($string =~ /\G \b Latin4::rindex \b /oxgc) { $e_string .= 'Latin4::rindex'; $slash = 'm//'; }
4625 0 elsif ($string =~ /\G \b rindex \b /oxgc) { $e_string .= 'Elatin4::rindex'; $slash = 'm//'; }
4626 0 elsif ($string =~ /\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin4::lc'; $slash = 'm//'; }
4627 0 elsif ($string =~ /\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin4::lcfirst'; $slash = 'm//'; }
4628 0 elsif ($string =~ /\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin4::uc'; $slash = 'm//'; }
4629 0 elsif ($string =~ /\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin4::ucfirst'; $slash = 'm//'; }
4630 0 elsif ($string =~ /\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin4::fc'; $slash = 'm//'; }
4631  
4632 # "-s '' ..." means file test "-s 'filename' ..." (not means "- s/// ...")
4633 0 elsif ($string =~ /\G -s (?>\s*) (\") ((?:$qq_char)+?) (\") /oxgc) { $e_string .= '-s ' . e_qq('', $1,$3,$2); $slash = 'm//'; }
4634 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\#) ((?:$qq_char)+?) (\#) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4635 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4636 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4637 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4638 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4639 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\S) ((?:$qq_char)+?) (\1) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4640  
4641 0 elsif ($string =~ /\G -s (?>\s*) (\') ((?:\\\'|\\\\|$q_char)+?) (\') /oxgc) { $e_string .= '-s ' . e_q ('', $1,$3,$2); $slash = 'm//'; }
4642 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$q_char)+?) (\#) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4643 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4644 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4645 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4646 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4647 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$q_char)+?) (\1) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4648  
4649 elsif ($string =~ /\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)*) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ))*) /oxgc)
4650 0 { $e_string .= "-s $1"; $slash = 'm//'; }
4651 0 elsif ($string =~ /\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /oxgc) { $e_string .= "-s ($1)"; $slash = 'm//'; }
4652 0 elsif ($string =~ /\G -s (?= (?>\s+) [a-z]+) /oxgc) { $e_string .= '-s'; $slash = 'm//'; }
4653 0 elsif ($string =~ /\G -s (?>\s+) ((?>\w+)) /oxgc) { $e_string .= "-s $1"; $slash = 'm//'; }
4654  
4655 0 elsif ($string =~ /\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'length'; $slash = 'm//'; }
4656 0 elsif ($string =~ /\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'chr'; $slash = 'm//'; }
4657 0 elsif ($string =~ /\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin4::chr'; $slash = 'm//'; }
4658 0 elsif ($string =~ /\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'ord'; $slash = 'div'; }
4659 0 elsif ($string =~ /\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= $function_ord; $slash = 'div'; }
4660 0 elsif ($string =~ /\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin4::glob'; $slash = 'm//'; }
4661 0 elsif ($string =~ /\G \b lc \b /oxgc) { $e_string .= 'Elatin4::lc_'; $slash = 'm//'; }
4662 0 elsif ($string =~ /\G \b lcfirst \b /oxgc) { $e_string .= 'Elatin4::lcfirst_'; $slash = 'm//'; }
4663 0 elsif ($string =~ /\G \b uc \b /oxgc) { $e_string .= 'Elatin4::uc_'; $slash = 'm//'; }
4664 0 elsif ($string =~ /\G \b ucfirst \b /oxgc) { $e_string .= 'Elatin4::ucfirst_'; $slash = 'm//'; }
4665 0 elsif ($string =~ /\G \b fc \b /oxgc) { $e_string .= 'Elatin4::fc_'; $slash = 'm//'; }
4666 0 elsif ($string =~ /\G -s \b /oxgc) { $e_string .= '-s '; $slash = 'm//'; }
4667  
4668 0 elsif ($string =~ /\G \b bytes::length \b /oxgc) { $e_string .= 'length'; $slash = 'm//'; }
4669 0 elsif ($string =~ /\G \b bytes::chr \b /oxgc) { $e_string .= 'chr'; $slash = 'm//'; }
4670 0 elsif ($string =~ /\G \b chr \b /oxgc) { $e_string .= 'Elatin4::chr_'; $slash = 'm//'; }
4671 0 elsif ($string =~ /\G \b bytes::ord \b /oxgc) { $e_string .= 'ord'; $slash = 'div'; }
4672 0 elsif ($string =~ /\G \b ord \b /oxgc) { $e_string .= $function_ord_; $slash = 'div'; }
4673 0 elsif ($string =~ /\G \b glob \b /oxgc) { $e_string .= 'Elatin4::glob_'; $slash = 'm//'; }
4674 0 elsif ($string =~ /\G \b reverse \b /oxgc) { $e_string .= $function_reverse; $slash = 'm//'; }
4675 0 elsif ($string =~ /\G \b getc \b /oxgc) { $e_string .= $function_getc; $slash = 'm//'; }
4676 # split
4677 elsif ($string =~ /\G \b (split) \b (?! (?>\s*) => ) /oxgc) {
4678 0 $slash = 'm//';
4679  
4680 0 my $e = '';
4681 0 ▶ while ($string =~ /\G ( (?>\s+) | \( | \#.* ) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G ( (?>\s+) | \( | \#.* ) /cgox) 0 0 0
4682 0 $e .= $1;
4683 }
4684  
4685 # end of split
4686 0 ▶ if ($string =~ /\G (?= [,;\)\}\]] ) /oxgc) { return 'Elatin4::split' . $e; }
Branch: 23 branches
BranchTrueFalseTotal
if ($string =~ /\G (?= [,;\)\}\]] ) /cgox) { } 0 0 0
elsif ($string =~ /\G ( [\$\@\&\*] $qq_scalar ) /cgox) { } 0 0 0
elsif ($string =~ /\G \b qq (\#) [ ] (\#) /cgox) { } 0 0 0
elsif ($string =~ /\G \b qq ((?>\s*)) (\() [ ] (\)) /cgox) { } 0 0 0
elsif ($string =~ /\G \b qq ((?>\s*)) (\{) [ ] (\}) /cgox) { } 0 0 0
elsif ($string =~ /\G \b qq ((?>\s*)) (\[) [ ] (\]) /cgox) { } 0 0 0
elsif ($string =~ /\G \b qq ((?>\s*)) (\<) [ ] (\>) /cgox) { } 0 0 0
elsif ($string =~ /\G \b qq ((?>\s*)) (\S) [ ] (\2) /cgox) { } 0 0 0
elsif ($string =~ /\G \b q (\#) [ ] (\#) /cgox) { } 0 0 0
elsif ($string =~ /\G \b q ((?>\s*)) (\() [ ] (\)) /cgox) { } 0 0 0
elsif ($string =~ /\G \b q ((?>\s*)) (\{) [ ] (\}) /cgox) { } 0 0 0
elsif ($string =~ /\G \b q ((?>\s*)) (\[) [ ] (\]) /cgox) { } 0 0 0
elsif ($string =~ /\G \b q ((?>\s*)) (\<) [ ] (\>) /cgox) { } 0 0 0
elsif ($string =~ /\G \b q ((?>\s*)) (\S) [ ] (\2) /cgox) { } 0 0 0
elsif ($string =~ /\G ' [ ] ' /cgox) { } 0 0 0
elsif ($string =~ /\G " [ ] " /cgox) { } 0 0 0
elsif ($string =~ /\G \b (qq) \b /cgox) { } 0 0 0
elsif ($string =~ /\G \b (qr) \b /cgox) { } 0 0 0
elsif ($string =~ /\G \b (q) \b /cgox) { } 0 0 0
elsif ($string =~ /\G \b (m) \b /cgox) { } 0 0 0
elsif ($string =~ /\G (\') /cgox) { } 0 0 0
elsif ($string =~ /\G (\") /cgox) { } 0 0 0
elsif ($string =~ m[\G (/) ]cgox) { } 0 0 0
4687  
4688 # split scalar value
4689 0 elsif ($string =~ /\G ( [\$\@\&\*] $qq_scalar ) /oxgc) { $e_string .= 'Elatin4::split' . $e . e_string($1); next E_STRING_LOOP; }
4690  
4691 # split literal space
4692 0 elsif ($string =~ /\G \b qq (\#) [ ] (\#) /oxgc) { $e_string .= 'Elatin4::split' . $e . qq {qq$1 $2}; next E_STRING_LOOP; }
4693 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\() [ ] (\)) /oxgc) { $e_string .= 'Elatin4::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4694 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\{) [ ] (\}) /oxgc) { $e_string .= 'Elatin4::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4695 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\[) [ ] (\]) /oxgc) { $e_string .= 'Elatin4::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4696 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\<) [ ] (\>) /oxgc) { $e_string .= 'Elatin4::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4697 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\S) [ ] (\2) /oxgc) { $e_string .= 'Elatin4::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4698 0 elsif ($string =~ /\G \b q (\#) [ ] (\#) /oxgc) { $e_string .= 'Elatin4::split' . $e . qq {q$1 $2}; next E_STRING_LOOP; }
4699 0 elsif ($string =~ /\G \b q ((?>\s*)) (\() [ ] (\)) /oxgc) { $e_string .= 'Elatin4::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4700 0 elsif ($string =~ /\G \b q ((?>\s*)) (\{) [ ] (\}) /oxgc) { $e_string .= 'Elatin4::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4701 0 elsif ($string =~ /\G \b q ((?>\s*)) (\[) [ ] (\]) /oxgc) { $e_string .= 'Elatin4::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4702 0 elsif ($string =~ /\G \b q ((?>\s*)) (\<) [ ] (\>) /oxgc) { $e_string .= 'Elatin4::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4703 0 elsif ($string =~ /\G \b q ((?>\s*)) (\S) [ ] (\2) /oxgc) { $e_string .= 'Elatin4::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4704 0 elsif ($string =~ /\G ' [ ] ' /oxgc) { $e_string .= 'Elatin4::split' . $e . qq {' '}; next E_STRING_LOOP; }
4705 0 elsif ($string =~ /\G " [ ] " /oxgc) { $e_string .= 'Elatin4::split' . $e . qq {" "}; next E_STRING_LOOP; }
4706  
4707 # split qq//
4708 elsif ($string =~ /\G \b (qq) \b /oxgc) {
4709 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Elatin4::qq_char)*?) (\#) /cgox) { } 0 0 0
4710 else {
4711 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4712 0 ▶ if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e_string .= $e . $1; }
Branch: 7 branches
BranchTrueFalseTotal
if ($string =~ /\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /cgox) { } 0 0 0
elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /cgox) { } 0 0 0
elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /cgox) { } 0 0 0
elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /cgox) { } 0 0 0
elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$Elatin4::qq_char)*?) (\1) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Elatin4::qq_char)*?) (\1) /cgox) { } 0 0 0
4713 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq ( ) --> qr ( )
4714 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq { } --> qr { }
4715 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq [ ] --> qr [ ]
4716 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq < > --> qr < >
4717 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= e_split($e.'qr','{','}',$2,''); next E_STRING_LOOP; } # qq | | --> qr { }
4718 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq * * --> qr * *
4719 }
4720 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4721 }
4722 }
4723  
4724 # split qr//
4725 elsif ($string =~ /\G \b (qr) \b /oxgc) {
4726 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1,$3,$2,$4); next E_STRING_LOOP; } # qr# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Elatin4::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 0 0
4727 else {
4728 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4729 0 ▶ if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e_string .= $e . $1; }
Branch: 8 branches
BranchTrueFalseTotal
if ($string =~ /\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\') ((?:$Elatin4::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$Elatin4::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Elatin4::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
4730 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr ( )
4731 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr { }
4732 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr [ ]
4733 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr < >
4734 0 elsif ($string =~ /\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split_q($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr ' '
4735 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr','{','}',$2,$4); next E_STRING_LOOP; } # qr | | --> qr { }
4736 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr * *
4737 }
4738 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4739 }
4740 }
4741  
4742 # split q//
4743 elsif ($string =~ /\G \b (q) \b /oxgc) {
4744 0 ▶ if ($string =~ /\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:\\\#|\\\\|$Elatin4::q_char)*?) (\#) /cgox) { } 0 0 0
4745 else {
4746 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4747 0 ▶ if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e_string .= $e . $1; }
Branch: 7 branches
BranchTrueFalseTotal
if ($string =~ /\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /cgox) { } 0 0 0
elsif ($string =~ /\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /cgox) { } 0 0 0
elsif ($string =~ /\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /cgox) { } 0 0 0
elsif ($string =~ /\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /cgox) { } 0 0 0
elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$Elatin4::q_char)*?) (\1) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:\\\\|\\\1| $Elatin4::q_char)*?) (\1) /cgox) { } 0 0 0
4748 0 elsif ($string =~ /\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q ( ) --> qr ( )
4749 0 elsif ($string =~ /\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q { } --> qr { }
4750 0 elsif ($string =~ /\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q [ ] --> qr [ ]
4751 0 elsif ($string =~ /\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q < > --> qr < >
4752 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$q_char)*?) (\1) /oxgc) { $e_string .= e_split_q($e.'qr','{','}',$2,''); next E_STRING_LOOP; } # q | | --> qr { }
4753 0 elsif ($string =~ /\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q * * --> qr * *
4754 }
4755 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4756 }
4757 }
4758  
4759 # split m//
4760 elsif ($string =~ /\G \b (m) \b /oxgc) {
4761 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1,$3,$2,$4); next E_STRING_LOOP; } # m# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Elatin4::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
4762 else {
4763 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4764 0 ▶ if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e_string .= $e . $1; }
Branch: 8 branches
BranchTrueFalseTotal
if ($string =~ /\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\') ((?:$Elatin4::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$Elatin4::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Elatin4::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
4765 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m ( ) --> qr ( )
4766 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m { } --> qr { }
4767 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m [ ] --> qr [ ]
4768 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m < > --> qr < >
4769 0 elsif ($string =~ /\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split_q($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m ' ' --> qr ' '
4770 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr','{','}',$2,$4); next E_STRING_LOOP; } # m | | --> qr { }
4771 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m * * --> qr * *
4772 }
4773 0 die __FILE__, ": Search pattern not terminated\n";
4774 }
4775 }
4776  
4777 # split ''
4778 elsif ($string =~ /\G (\') /oxgc) {
4779 0 my $q_string = '';
4780 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4781 0 ▶ if ($string =~ /\G (\\\\) /oxgc) { $q_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if ($string =~ /\G (\\\\) /cgox) { } 0 0 0
elsif ($string =~ /\G (\\\') /cgox) { } 0 0 0
elsif ($string =~ /\G \' /cgox) { } 0 0 0
elsif ($string =~ /\G ($Elatin4::q_char) /cgox) { } 0 0 0
4782 0 elsif ($string =~ /\G (\\\') /oxgc) { $q_string .= $1; } # splitqr'' --> split qr''
4783 0 elsif ($string =~ /\G \' /oxgc) { $e_string .= e_split_q($e.q{ qr},"'","'",$q_string,''); next E_STRING_LOOP; } # ' ' --> qr ' '
4784 0 elsif ($string =~ /\G ($q_char) /oxgc) { $q_string .= $1; }
4785 }
4786 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4787 }
4788  
4789 # split ""
4790 elsif ($string =~ /\G (\") /oxgc) {
4791 0 my $qq_string = '';
4792 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4793 0 ▶ if ($string =~ /\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if ($string =~ /\G (\\\\) /cgox) { } 0 0 0
elsif ($string =~ /\G (\\\") /cgox) { } 0 0 0
elsif ($string =~ /\G \" /cgox) { } 0 0 0
elsif ($string =~ /\G ($Elatin4::q_char) /cgox) { } 0 0 0
4794 0 elsif ($string =~ /\G (\\\") /oxgc) { $qq_string .= $1; } # splitqr"" --> split qr""
4795 0 elsif ($string =~ /\G \" /oxgc) { $e_string .= e_split($e.q{ qr},'"','"',$qq_string,''); next E_STRING_LOOP; } # " " --> qr " "
4796 0 elsif ($string =~ /\G ($q_char) /oxgc) { $qq_string .= $1; }
4797 }
4798 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4799 }
4800  
4801 # split //
4802 elsif ($string =~ /\G (\/) /oxgc) {
4803 0 my $regexp = '';
4804 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4805 0 ▶ if ($string =~ /\G (\\\\) /oxgc) { $regexp .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if ($string =~ /\G (\\\\) /cgox) { } 0 0 0
elsif ($string =~ m[\G (\\/) ]cgox) { } 0 0 0
elsif ($string =~ m[\G / ([cgimosxpadlunbB]*) ]cgox) { } 0 0 0
elsif ($string =~ /\G ($Elatin4::q_char) /cgox) { } 0 0 0
4806 0 elsif ($string =~ /\G (\\\/) /oxgc) { $regexp .= $1; } # splitqr// --> split qr//
4807 0 elsif ($string =~ /\G \/ ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split($e.q{ qr}, '/','/',$regexp,$1); next E_STRING_LOOP; } # / / --> qr / /
4808 0 elsif ($string =~ /\G ($q_char) /oxgc) { $regexp .= $1; }
4809 }
4810 0 die __FILE__, ": Search pattern not terminated\n";
4811 }
4812 }
4813  
4814 # qq//
4815 elsif ($string =~ /\G \b (qq) \b /oxgc) {
4816 0 my $ope = $1;
4817 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qq# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Elatin4::qq_char)*?) (\#) /cgox) { } 0 0 0
4818 0 $e_string .= e_qq($ope,$1,$3,$2);
4819 }
4820 else {
4821 0 my $e = '';
4822 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4823 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
4824 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq ( )
4825 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq { }
4826 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq [ ]
4827 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq < >
4828 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq * *
4829 }
4830 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4831 }
4832 }
4833  
4834 # qx//
4835 elsif ($string =~ /\G \b (qx) \b /oxgc) {
4836 0 my $ope = $1;
4837 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qx# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Elatin4::qq_char)*?) (\#) /cgox) { } 0 0 0
4838 0 $e_string .= e_qq($ope,$1,$3,$2);
4839 }
4840 else {
4841 0 my $e = '';
4842 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4843 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
4844 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx ( )
4845 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx { }
4846 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx [ ]
4847 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx < >
4848 0 elsif ($string =~ /\G (\') ((?:$qq_char)*?) (\') /oxgc) { $e_string .= $e . e_q ($ope,$1,$3,$2); next E_STRING_LOOP; } # qx ' '
4849 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx * *
4850 }
4851 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4852 }
4853 }
4854  
4855 # q//
4856 elsif ($string =~ /\G \b (q) \b /oxgc) {
4857 0 my $ope = $1;
4858 0 ▶ if ($string =~ /\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { # q# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:\\\#|\\\\|$Elatin4::q_char)*?) (\#) /cgox) { } 0 0 0
4859 0 $e_string .= e_q($ope,$1,$3,$2);
4860 }
4861 else {
4862 0 my $e = '';
4863 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4864 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
4865 0 elsif ($string =~ /\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q ( )
4866 0 elsif ($string =~ /\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q { }
4867 0 elsif ($string =~ /\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q [ ]
4868 0 elsif ($string =~ /\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q < >
4869 0 elsif ($string =~ /\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q * *
4870 }
4871 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4872 }
4873 }
4874  
4875 # ''
4876 0 elsif ($string =~ /\G (?<![\w\$\@\%\&\*]) (\') ((?:\\\'|\\\\|$q_char)*?) (\') /oxgc) { $e_string .= e_q('',$1,$3,$2); }
4877  
4878 # ""
4879 0 elsif ($string =~ /\G (\") ((?:$qq_char)*?) (\") /oxgc) { $e_string .= e_qq('',$1,$3,$2); }
4880  
4881 # ``
4882 0 elsif ($string =~ /\G (\`) ((?:$qq_char)*?) (\`) /oxgc) { $e_string .= e_qq('',$1,$3,$2); }
4883  
4884 # <<>> (a safer ARGV)
4885 0 elsif ($string =~ /\G ( <<>> ) /oxgc) { $e_string .= $1; }
4886  
4887 # <<= <=> <= < operator
4888 0 elsif ($string =~ /\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/oxgc) { $e_string .= $1; }
4889  
4890 # <FILEHANDLE>
4891 0 elsif ($string =~ /\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /oxgc) { $e_string .= $1; }
4892  
4893 # <WILDCARD> --- glob
4894 elsif ($string =~ /\G < ((?:$q_char)+?) > /oxgc) {
4895 0 $e_string .= 'Elatin4::glob("' . $1 . '")';
4896 }
4897  
4898 # << (bit shift) --- not here document
4899 elsif ($string =~ /\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /oxgc) {
4900 0 $slash = 'm//';
4901 0 $e_string .= $1;
4902 }
4903  
4904 # <<~'HEREDOC'
4905 elsif ($string =~ /\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /oxgc) {
4906 0 $slash = 'm//';
4907 0 my $here_quote = $1;
4908 0 my $delimiter = $2;
4909  
4910 # get here document
4911 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4912 0 $here_script = CORE::substr $_, pos $_;
4913 0 $here_script =~ s/.*?\n//oxm;
4914 }
4915 0 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 0 0 0
4916 0 my $heredoc = $1;
4917 0 my $indent = $2;
4918 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4919 0 push @heredoc, $heredoc . qq{\n$delimiter\n};
4920 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4921 }
4922 else {
4923 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4924 }
4925 0 $e_string .= qq{<<'$delimiter'};
4926 }
4927  
4928 # <<~\HEREDOC
4929 elsif ($string =~ /\G ( <<~ \\([a-zA-Z_0-9]+) ) /oxgc) {
4930 0 $slash = 'm//';
4931 0 my $here_quote = $1;
4932 0 my $delimiter = $2;
4933  
4934 # get here document
4935 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4936 0 $here_script = CORE::substr $_, pos $_;
4937 0 $here_script =~ s/.*?\n//oxm;
4938 }
4939 0 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 0 0 0
4940 0 my $heredoc = $1;
4941 0 my $indent = $2;
4942 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4943 0 push @heredoc, $heredoc . qq{\n$delimiter\n};
4944 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4945 }
4946 else {
4947 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4948 }
4949 0 $e_string .= qq{<<\\$delimiter};
4950 }
4951  
4952 # <<~"HEREDOC"
4953 elsif ($string =~ /\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /oxgc) {
4954 0 $slash = 'm//';
4955 0 my $here_quote = $1;
4956 0 my $delimiter = $2;
4957  
4958 # get here document
4959 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4960 0 $here_script = CORE::substr $_, pos $_;
4961 0 $here_script =~ s/.*?\n//oxm;
4962 }
4963 0 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 0 0 0
4964 0 my $heredoc = $1;
4965 0 my $indent = $2;
4966 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4967 0 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4968 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4969 }
4970 else {
4971 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4972 }
4973 0 $e_string .= qq{<<"$delimiter"};
4974 }
4975  
4976 # <<~HEREDOC
4977 elsif ($string =~ /\G ( <<~ ([a-zA-Z_0-9]+) ) /oxgc) {
4978 0 $slash = 'm//';
4979 0 my $here_quote = $1;
4980 0 my $delimiter = $2;
4981  
4982 # get here document
4983 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4984 0 $here_script = CORE::substr $_, pos $_;
4985 0 $here_script =~ s/.*?\n//oxm;
4986 }
4987 0 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 0 0 0
4988 0 my $heredoc = $1;
4989 0 my $indent = $2;
4990 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4991 0 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4992 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4993 }
4994 else {
4995 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4996 }
4997 0 $e_string .= qq{<<$delimiter};
4998 }
4999  
5000 # <<~`HEREDOC`
5001 elsif ($string =~ /\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /oxgc) {
5002 0 $slash = 'm//';
5003 0 my $here_quote = $1;
5004 0 my $delimiter = $2;
5005  
5006 # get here document
5007 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5008 0 $here_script = CORE::substr $_, pos $_;
5009 0 $here_script =~ s/.*?\n//oxm;
5010 }
5011 0 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 0 0 0
5012 0 my $heredoc = $1;
5013 0 my $indent = $2;
5014 0 $heredoc =~ s{^$indent}{}msg; # no /ox
5015 0 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
5016 0 push @heredoc_delimiter, qq{\\s*$delimiter};
5017 }
5018 else {
5019 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5020 }
5021 0 $e_string .= qq{<<`$delimiter`};
5022 }
5023  
5024 # <<'HEREDOC'
5025 elsif ($string =~ /\G ( << '([a-zA-Z_0-9]*)' ) /oxgc) {
5026 0 $slash = 'm//';
5027 0 my $here_quote = $1;
5028 0 my $delimiter = $2;
5029  
5030 # get here document
5031 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5032 0 $here_script = CORE::substr $_, pos $_;
5033 0 $here_script =~ s/.*?\n//oxm;
5034 }
5035 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
5036 0 push @heredoc, $1 . qq{\n$delimiter\n};
5037 0 push @heredoc_delimiter, $delimiter;
5038 }
5039 else {
5040 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5041 }
5042 0 $e_string .= $here_quote;
5043 }
5044  
5045 # <<\HEREDOC
5046 elsif ($string =~ /\G ( << \\([a-zA-Z_0-9]+) ) /oxgc) {
5047 0 $slash = 'm//';
5048 0 my $here_quote = $1;
5049 0 my $delimiter = $2;
5050  
5051 # get here document
5052 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5053 0 $here_script = CORE::substr $_, pos $_;
5054 0 $here_script =~ s/.*?\n//oxm;
5055 }
5056 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
5057 0 push @heredoc, $1 . qq{\n$delimiter\n};
5058 0 push @heredoc_delimiter, $delimiter;
5059 }
5060 else {
5061 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5062 }
5063 0 $e_string .= $here_quote;
5064 }
5065  
5066 # <<"HEREDOC"
5067 elsif ($string =~ /\G ( << "([a-zA-Z_0-9]*)" ) /oxgc) {
5068 0 $slash = 'm//';
5069 0 my $here_quote = $1;
5070 0 my $delimiter = $2;
5071  
5072 # get here document
5073 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5074 0 $here_script = CORE::substr $_, pos $_;
5075 0 $here_script =~ s/.*?\n//oxm;
5076 }
5077 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
5078 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
5079 0 push @heredoc_delimiter, $delimiter;
5080 }
5081 else {
5082 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5083 }
5084 0 $e_string .= $here_quote;
5085 }
5086  
5087 # <<HEREDOC
5088 elsif ($string =~ /\G ( << ([a-zA-Z_0-9]+) ) /oxgc) {
5089 0 $slash = 'm//';
5090 0 my $here_quote = $1;
5091 0 my $delimiter = $2;
5092  
5093 # get here document
5094 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5095 0 $here_script = CORE::substr $_, pos $_;
5096 0 $here_script =~ s/.*?\n//oxm;
5097 }
5098 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
5099 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
5100 0 push @heredoc_delimiter, $delimiter;
5101 }
5102 else {
5103 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5104 }
5105 0 $e_string .= $here_quote;
5106 }
5107  
5108 # <<`HEREDOC`
5109 elsif ($string =~ /\G ( << `([a-zA-Z_0-9]*)` ) /oxgc) {
5110 0 $slash = 'm//';
5111 0 my $here_quote = $1;
5112 0 my $delimiter = $2;
5113  
5114 # get here document
5115 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5116 0 $here_script = CORE::substr $_, pos $_;
5117 0 $here_script =~ s/.*?\n//oxm;
5118 }
5119 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
5120 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
5121 0 push @heredoc_delimiter, $delimiter;
5122 }
5123 else {
5124 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5125 }
5126 0 $e_string .= $here_quote;
5127 }
5128  
5129 # any operator before div
5130 elsif ($string =~ /\G (
5131 -- | \+\+ |
5132 [\)\}\]]
5133  
5134 18 ) /oxgc) { $slash = 'div'; $e_string .= $1; }
5135  
5136 # yada-yada or triple-dot operator
5137 elsif ($string =~ /\G (
5138 \.\.\.
5139  
5140 0 ) /oxgc) { $slash = 'm//'; $e_string .= q{die('Unimplemented')}; }
5141  
5142 # any operator before m//
5143 elsif ($string =~ /\G ((?>
5144  
5145 !~~ | !~ | != | ! |
5146 %= | % |
5147 &&= | && | &= | &\.= | &\. | & |
5148 -= | -> | - |
5149 :(?>\s*)= |
5150 : |
5151 <<>> |
5152 <<= | <=> | <= | < |
5153 == | => | =~ | = |
5154 >>= | >> | >= | > |
5155 \*\*= | \*\* | \*= | \* |
5156 \+= | \+ |
5157 \.\. | \.= | \. |
5158 \/\/= | \/\/ |
5159 \/= | \/ |
5160 \? |
5161 \\ |
5162 \^= | \^\.= | \^\. | \^ |
5163 \b x= |
5164 \|\|= | \|\| | \|= | \|\.= | \|\. | \| |
5165 ~~ | ~\. | ~ |
5166 \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b |
5167 \b(?: print )\b |
5168  
5169 [,;\(\{\[]
5170  
5171 31 )) /oxgc) { $slash = 'm//'; $e_string .= $1; }
5172  
5173 # other any character
5174 131 elsif ($string =~ /\G ($q_char) /oxgc) { $e_string .= $1; }
5175  
5176 # system error
5177 else {
5178 0 die __FILE__, ": Oops, this shouldn't happen!\n";
5179 }
5180 }
5181  
5182 17 return $e_string;
5183 }
5184  
5185 #
5186 # character class
5187 #
5188 1920 ▶sub character_class {
Subroutine character_class: called CC=3 SCAR=11.0
Pod undocumented
5189 1920 my($char,$modifier) = @_;
5190  
5191 1920 ▶ if ($char eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char eq '.') { } 52 1868 1920
5192 52 ▶ if ($modifier =~ /s/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/) { } 17 35 52
5193 17 return '${Elatin4::dot_s}';
5194 }
5195 else {
5196 35 return '${Elatin4::dot}';
5197 }
5198 }
5199 else {
5200 1868 return Elatin4::classic_character_class($char);
5201 }
5202 }
5203  
5204 #
5205 # escape capture ($1, $2, $3, ...)
5206 #
5207 212 ▶sub e_capture {
Subroutine e_capture: called CC=1 SCAR=0.0
Pod undocumented
5208  
5209 212 return join '', '${', $_[0], '}';
5210 }
5211  
5212 #
5213 # escape transliteration (tr/// or y///)
5214 #
5215 4 ▶sub e_tr {
Subroutine e_tr: called CC=5 SCAR=16.8
Pod undocumented
5216 4 my($variable,$charclass,$e,$charclass2,$modifier) = @_;
5217 4 my $e_tr = '';
5218 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
5219  
5220 4 $slash = 'div';
5221  
5222 # quote character class 1
5223 4 $charclass = q_tr($charclass);
5224  
5225 # quote character class 2
5226 4 $charclass2 = q_tr($charclass2);
5227  
5228 # /b /B modifier
5229 4 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) { } 0 4 4
5230 0 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq '') { } 0 0 0
5231 0 $e_tr = qq{tr$charclass$e$charclass2$modifier};
5232 }
5233 else {
5234 0 $e_tr = qq{$variable${bind_operator}tr$charclass$e$charclass2$modifier};
5235 }
5236 }
5237 else {
5238 4 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq '') { } 2 2 4
5239 2 $e_tr = qq{Elatin4::tr(\$_,' =~ ',$charclass,$e$charclass2,'$modifier')};
5240 }
5241 else {
5242 2 $e_tr = qq{Elatin4::tr($variable,'$bind_operator',$charclass,$e$charclass2,'$modifier')};
5243 }
5244 }
5245  
5246 # clear tr/// variable
5247 4 $tr_variable = '';
5248 4 $bind_operator = '';
5249  
5250 4 return $e_tr;
5251 }
5252  
5253 #
5254 # quote for escape transliteration (tr/// or y///)
5255 #
5256 8 ▶sub q_tr {
Subroutine q_tr: called CC=9 SCAR=40.6
Pod undocumented
5257 8 my($charclass) = @_;
5258  
5259 # quote character class
5260 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
5261 8 return e_q('', "'", "'", $charclass); # --> q' '
5262 }
5263 elsif ($charclass !~ /\//oxms) {
5264 0 return e_q('q', '/', '/', $charclass); # --> q/ /
5265 }
5266 elsif ($charclass !~ /\#/oxms) {
5267 0 return e_q('q', '#', '#', $charclass); # --> q# #
5268 }
5269 elsif ($charclass !~ /[\<\>]/oxms) {
5270 0 return e_q('q', '<', '>', $charclass); # --> q< >
5271 }
5272 elsif ($charclass !~ /[\(\)]/oxms) {
5273 0 return e_q('q', '(', ')', $charclass); # --> q( )
5274 }
5275 elsif ($charclass !~ /[\{\}]/oxms) {
5276 0 return e_q('q', '{', '}', $charclass); # --> q{ }
5277 }
5278 else {
5279 0 for my $char (qw( ! " $ % & * + . : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5280 0 ▶ if ($charclass !~ /\Q$char\E/xms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($charclass =~ /\Q$char\E/msx) 0 0 0
5281 0 return e_q('q', $char, $char, $charclass);
5282 }
5283 }
5284 }
5285  
5286 0 return e_q('q', '{', '}', $charclass);
5287 }
5288  
5289 #
5290 # escape q string (q//, '')
5291 #
5292 1623 ▶sub e_q {
Subroutine e_q: called CC=1 SCAR=0.0
Pod undocumented
5293 1623 my($ope,$delimiter,$end_delimiter,$string) = @_;
5294  
5295 1623 $slash = 'div';
5296  
5297 1623 return join '', $ope, $delimiter, $string, $end_delimiter;
5298 }
5299  
5300 #
5301 # escape qq string (qq//, "", qx//, ``)
5302 #
5303 4255 ▶sub e_qq {
Subroutine e_qq: called CC=37 SCAR=50.9
Pod undocumented
5304 4255 my($ope,$delimiter,$end_delimiter,$string) = @_;
5305  
5306 4255 $slash = 'div';
5307  
5308 4255 my $left_e = 0;
5309 4255 my $right_e = 0;
5310  
5311 # split regexp
5312 4255 my @char = $string =~ /\G((?>
5313 [^\\\$] |
5314 \\x\{ (?>[0-9A-Fa-f]+) \} |
5315 \\o\{ (?>[0-7]+) \} |
5316 \\N\{ (?>[^0-9\}][^\}]*) \} |
5317 \\ $q_char |
5318 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5319 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5320 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5321 \$ (?>\s* [0-9]+) |
5322 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5323 \$ \$ (?![\w\{]) |
5324 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5325 $q_char
5326 ))/oxmsg;
5327  
5328 4255 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 116773 4255 121028
5329  
5330 # "\L\u" --> "\u\L"
5331 116773 ▶ 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 116773 116773
elsif ($char[$i] eq '\\U' and $char[$i + 1] eq '\\l') { } 0 116773 116773
elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/mosx) { } 1 116772 116773
elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/mosx) { } 1 116771 116772
elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/mosx) { } 0 116771 116771
Condition33%1/3
$char[$i] eq "\\L" and $char[$i + 1] eq "\\u"
!ll&&!rl&&r
11677300
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
5332 0 @char[$i,$i+1] = @char[$i+1,$i];
5333 }
5334  
5335 # "\U\l" --> "\l\U"
5336 ▶ 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
11677300
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
5337 0 @char[$i,$i+1] = @char[$i+1,$i];
5338 }
5339  
5340 # octal escape sequence
5341 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5342 1 $char[$i] = Elatin4::octchr($1);
5343 }
5344  
5345 # hexadecimal escape sequence
5346 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5347 1 $char[$i] = Elatin4::hexchr($1);
5348 }
5349  
5350 # \N{CHARNAME} --> N{CHARNAME}
5351 elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5352 0 $char[$i] = $1;
5353 }
5354  
5355 116773 ▶ if (0) {
Branch: 23 branches
BranchTrueFalseTotal
if (do { $char[$i] =~ /\A ([<>]) \z/mosx }) { } 484 116289 116773
elsif ($char[$i] eq '\\u') { } 0 116289 116289
elsif ($char[$i] eq '\\l') { } 0 116289 116289
elsif ($char[$i] eq '\\U') { } 0 116289 116289
elsif ($char[$i] eq '\\L') { } 0 116289 116289
elsif ($char[$i] eq '\\F') { } 24 116265 116289
elsif ($char[$i] eq '\\Q') { } 0 116265 116265
elsif ($char[$i] eq '\\E') { } 24 116241 116265
elsif ($char[$i] eq '\\Q') { } 0 116241 116241
elsif ($char[$i] eq '\\E') { } 0 116241 116241
elsif ($char[$i] =~ /\A \$ 0 \z/mosx) { } 4 116237 116241
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/mosx) { } 0 116237 116237
elsif ($char[$i] =~ /\A \$\$ \z/mosx) { } 0 116237 116237
elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/mosx) { } 205 116032 116237
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/mosx) { } 0 116032 116032
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/mosx) { } 0 116032 116032
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/mosx) { } 0 116032 116032
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/mosx) { } 0 116032 116032
elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/cgmosx) { } 44 115988 116032
elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/cgmosx) { } 45 115943 115988
elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/cgmosx) { } 33 115910 115943
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/mosx) { } 0 115910 115910
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/mosx) { } 0 115910 115910
5356 }
5357  
5358 # \F
5359 #
5360 # P.69 Table 2-6. Translation escapes
5361 # in Chapter 2: Bits and Pieces
5362 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
5363 # (and so on)
5364  
5365 # \u \l \U \L \F \Q \E
5366 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
5367 484 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 484 484
5368 0 $char[$i] = '\\' . $char[$i];
5369 }
5370 }
5371 elsif ($char[$i] eq '\u') {
5372  
5373 # "STRING @{[ LIST EXPR ]} MORE STRING"
5374  
5375 # P.257 Other Tricks You Can Do with Hard References
5376 # in Chapter 8: References
5377 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
5378  
5379 # P.353 Other Tricks You Can Do with Hard References
5380 # in Chapter 8: References
5381 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
5382  
5383 # (and so on)
5384  
5385 0 $char[$i] = '@{[Elatin4::ucfirst qq<';
5386 0 $left_e++;
5387 }
5388 elsif ($char[$i] eq '\l') {
5389 0 $char[$i] = '@{[Elatin4::lcfirst qq<';
5390 0 $left_e++;
5391 }
5392 elsif ($char[$i] eq '\U') {
5393 0 $char[$i] = '@{[Elatin4::uc qq<';
5394 0 $left_e++;
5395 }
5396 elsif ($char[$i] eq '\L') {
5397 0 $char[$i] = '@{[Elatin4::lc qq<';
5398 0 $left_e++;
5399 }
5400 elsif ($char[$i] eq '\F') {
5401 24 $char[$i] = '@{[Elatin4::fc qq<';
5402 24 $left_e++;
5403 }
5404 elsif ($char[$i] eq '\Q') {
5405 0 $char[$i] = '@{[CORE::quotemeta qq<';
5406 0 $left_e++;
5407 }
5408 elsif ($char[$i] eq '\E') {
5409 24 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 24 0 24
5410 24 $char[$i] = '>]}';
5411 24 $right_e++;
5412 }
5413 else {
5414 0 $char[$i] = '';
5415 }
5416 }
5417 elsif ($char[$i] eq '\Q') {
5418 0 while (1) {
5419 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5420 0 last;
5421 }
5422 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
5423 0 last;
5424 }
5425 }
5426 }
5427 elsif ($char[$i] eq '\E') {
5428 }
5429  
5430 # $0 --> $0
5431 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
5432 }
5433 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
5434 }
5435  
5436 # $$ --> $$
5437 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
5438 }
5439  
5440 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
5441 # $1, $2, $3 --> $1, $2, $3 otherwise
5442 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
5443 205 $char[$i] = e_capture($1);
5444 }
5445 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
5446 0 $char[$i] = e_capture($1);
5447 }
5448  
5449 # $$foo[ ... ] --> $ $foo->[ ... ]
5450 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
5451 0 $char[$i] = e_capture($1.'->'.$2);
5452 }
5453  
5454 # $$foo{ ... } --> $ $foo->{ ... }
5455 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
5456 0 $char[$i] = e_capture($1.'->'.$2);
5457 }
5458  
5459 # $$foo
5460 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
5461 0 $char[$i] = e_capture($1);
5462 }
5463  
5464 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin4::PREMATCH()
5465 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
5466 44 $char[$i] = '@{[Elatin4::PREMATCH()]}';
5467 }
5468  
5469 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin4::MATCH()
5470 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
5471 45 $char[$i] = '@{[Elatin4::MATCH()]}';
5472 }
5473  
5474 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin4::POSTMATCH()
5475 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
5476 33 $char[$i] = '@{[Elatin4::POSTMATCH()]}';
5477 }
5478  
5479 # ${ foo } --> ${ foo }
5480 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/oxms) {
5481 }
5482  
5483 # ${ ... }
5484 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5485 0 $char[$i] = e_capture($1);
5486 }
5487 }
5488  
5489 # return string
5490 4255 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 4255 4255
5491 0 return join '', $ope, $delimiter, @char, '>]}' x ($left_e - $right_e), $end_delimiter;
5492 }
5493 4255 return join '', $ope, $delimiter, @char, $end_delimiter;
5494 }
5495  
5496 #
5497 # escape qw string (qw//)
5498 #
5499 16 ▶sub e_qw {
Subroutine e_qw: called CC=11 SCAR=43.1
Pod undocumented
5500 16 my($ope,$delimiter,$end_delimiter,$string) = @_;
5501  
5502 16 $slash = 'div';
5503  
5504 # choice again delimiter
5505 16 my %octet = map {$_ => 1} ($string =~ /\G ([\x00-\xFF]) /oxmsg);
5506 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
5507 16 return join '', $ope, $delimiter, $string, $end_delimiter;
5508 }
5509 elsif (not $octet{')'}) {
5510 0 return join '', $ope, '(', $string, ')';
5511 }
5512 elsif (not $octet{'}'}) {
5513 0 return join '', $ope, '{', $string, '}';
5514 }
5515 elsif (not $octet{']'}) {
5516 0 return join '', $ope, '[', $string, ']';
5517 }
5518 elsif (not $octet{'>'}) {
5519 0 return join '', $ope, '<', $string, '>';
5520 }
5521 else {
5522 0 for my $char (qw( ! " $ % & * + - . / : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5523 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5524 0 return join '', $ope, $char, $string, $char;
5525 }
5526 }
5527 }
5528  
5529 # qw/AAA BBB C'CC/ --> ('AAA', 'BBB', 'C\'CC')
5530 0 my @string = CORE::split(/\s+/, $string);
5531 0 for my $string (@string) {
5532 0 my @octet = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5533 0 for my $octet (@octet) {
5534 0 ▶ if ($octet =~ /\A (['\\]) \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($octet =~ /\A (['\\]) \z/mosx) 0 0 0
5535 0 $octet = '\\' . $1;
5536 }
5537 }
5538 0 $string = join '', @octet;
5539 }
5540 0 return join '', '(', (join ', ', map { "'$_'" } @string), ')';
5541 }
5542  
5543 #
5544 # escape here document (<<"HEREDOC", <<HEREDOC, <<`HEREDOC`, <<~"HEREDOC", <<~HEREDOC, <<~`HEREDOC`)
5545 #
5546 93 ▶sub e_heredoc {
Subroutine e_heredoc: called CC=37 SCAR=56.3
Pod undocumented
5547 93 my($string) = @_;
5548  
5549 93 $slash = 'm//';
5550  
5551 93 my $metachar = qr/[\@\\|]/oxms; # '|' is for <<`HEREDOC`
5552  
5553 93 my $left_e = 0;
5554 93 my $right_e = 0;
5555  
5556 # split regexp
5557 93 my @char = $string =~ /\G((?>
5558 [^\\\$] |
5559 \\x\{ (?>[0-9A-Fa-f]+) \} |
5560 \\o\{ (?>[0-7]+) \} |
5561 \\N\{ (?>[^0-9\}][^\}]*) \} |
5562 \\ $q_char |
5563 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5564 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5565 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5566 \$ (?>\s* [0-9]+) |
5567 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5568 \$ \$ (?![\w\{]) |
5569 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5570 $q_char
5571 ))/oxmsg;
5572  
5573 93 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 3177 93 3270
5574  
5575 # "\L\u" --> "\u\L"
5576 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
5577 0 @char[$i,$i+1] = @char[$i+1,$i];
5578 }
5579  
5580 # "\U\l" --> "\l\U"
5581 ▶ 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
5582 0 @char[$i,$i+1] = @char[$i+1,$i];
5583 }
5584  
5585 # octal escape sequence
5586 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5587 1 $char[$i] = Elatin4::octchr($1);
5588 }
5589  
5590 # hexadecimal escape sequence
5591 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5592 1 $char[$i] = Elatin4::hexchr($1);
5593 }
5594  
5595 # \N{CHARNAME} --> N{CHARNAME}
5596 elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5597 0 $char[$i] = $1;
5598 }
5599  
5600 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
5601 }
5602  
5603 # \u \l \U \L \F \Q \E
5604 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
5605 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
5606 0 $char[$i] = '\\' . $char[$i];
5607 }
5608 }
5609 elsif ($char[$i] eq '\u') {
5610 0 $char[$i] = '@{[Elatin4::ucfirst qq<';
5611 0 $left_e++;
5612 }
5613 elsif ($char[$i] eq '\l') {
5614 0 $char[$i] = '@{[Elatin4::lcfirst qq<';
5615 0 $left_e++;
5616 }
5617 elsif ($char[$i] eq '\U') {
5618 0 $char[$i] = '@{[Elatin4::uc qq<';
5619 0 $left_e++;
5620 }
5621 elsif ($char[$i] eq '\L') {
5622 0 $char[$i] = '@{[Elatin4::lc qq<';
5623 0 $left_e++;
5624 }
5625 elsif ($char[$i] eq '\F') {
5626 0 $char[$i] = '@{[Elatin4::fc qq<';
5627 0 $left_e++;
5628 }
5629 elsif ($char[$i] eq '\Q') {
5630 0 $char[$i] = '@{[CORE::quotemeta qq<';
5631 0 $left_e++;
5632 }
5633 elsif ($char[$i] eq '\E') {
5634 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
5635 0 $char[$i] = '>]}';
5636 0 $right_e++;
5637 }
5638 else {
5639 0 $char[$i] = '';
5640 }
5641 }
5642 elsif ($char[$i] eq '\Q') {
5643 0 while (1) {
5644 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5645 0 last;
5646 }
5647 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
5648 0 last;
5649 }
5650 }
5651 }
5652 elsif ($char[$i] eq '\E') {
5653 }
5654  
5655 # $0 --> $0
5656 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
5657 }
5658 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
5659 }
5660  
5661 # $$ --> $$
5662 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
5663 }
5664  
5665 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
5666 # $1, $2, $3 --> $1, $2, $3 otherwise
5667 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
5668 0 $char[$i] = e_capture($1);
5669 }
5670 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
5671 0 $char[$i] = e_capture($1);
5672 }
5673  
5674 # $$foo[ ... ] --> $ $foo->[ ... ]
5675 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
5676 0 $char[$i] = e_capture($1.'->'.$2);
5677 }
5678  
5679 # $$foo{ ... } --> $ $foo->{ ... }
5680 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
5681 0 $char[$i] = e_capture($1.'->'.$2);
5682 }
5683  
5684 # $$foo
5685 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
5686 0 $char[$i] = e_capture($1);
5687 }
5688  
5689 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin4::PREMATCH()
5690 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
5691 8 $char[$i] = '@{[Elatin4::PREMATCH()]}';
5692 }
5693  
5694 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin4::MATCH()
5695 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
5696 8 $char[$i] = '@{[Elatin4::MATCH()]}';
5697 }
5698  
5699 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin4::POSTMATCH()
5700 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
5701 6 $char[$i] = '@{[Elatin4::POSTMATCH()]}';
5702 }
5703  
5704 # ${ foo } --> ${ foo }
5705 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/oxms) {
5706 }
5707  
5708 # ${ ... }
5709 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5710 0 $char[$i] = e_capture($1);
5711 }
5712 }
5713  
5714 # return string
5715 93 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 93 93
5716 0 return join '', @char, '>]}' x ($left_e - $right_e);
5717 }
5718 93 return join '', @char;
5719 }
5720  
5721 #
5722 # escape regexp (m//, qr//)
5723 #
5724 880 ▶sub e_qr {
Subroutine e_qr: called CC=110 SCAR=73.6
Pod undocumented
5725 880 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5726 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
5727  
5728 880 $modifier =~ tr/p//d;
5729 880 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 880 880
5730 0 my $line = 0;
5731 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
5732 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
5733 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
5734 0 last;
5735 }
5736 }
5737 0 die qq{Unsupported modifier "$1" used at line $line.\n};
5738 }
5739  
5740 880 $slash = 'div';
5741  
5742 # literal null string pattern
5743 880 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 872 880
elsif ($modifier =~ tr/Bb//d) { } 2 870 872
5744 8 $modifier =~ tr/bB//d;
5745 8 $modifier =~ tr/i//d;
5746 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
5747 }
5748  
5749 # /b /B modifier
5750 elsif ($modifier =~ tr/bB//d) {
5751  
5752 # choice again delimiter
5753 2 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 2 2
5754 0 my @char = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5755 0 my %octet = map {$_ => 1} @char;
5756 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
5757 0 $delimiter = '(';
5758 0 $end_delimiter = ')';
5759 }
5760 elsif (not $octet{'}'}) {
5761 0 $delimiter = '{';
5762 0 $end_delimiter = '}';
5763 }
5764 elsif (not $octet{']'}) {
5765 0 $delimiter = '[';
5766 0 $end_delimiter = ']';
5767 }
5768 elsif (not $octet{'>'}) {
5769 0 $delimiter = '<';
5770 0 $end_delimiter = '>';
5771 }
5772 else {
5773 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5774 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5775 0 $delimiter = $char;
5776 0 $end_delimiter = $char;
5777 0 last;
5778 }
5779 }
5780 }
5781 }
5782  
5783 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
5784 0 return join '', $ope, $delimiter, $string, $matched, $end_delimiter, $modifier;
5785 }
5786 else {
5787 2 return join '', $ope, $delimiter, '(?:', $string, ')', $matched, $end_delimiter, $modifier;
5788 }
5789 }
5790  
5791 870 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 312 558 870
5792 870 my $metachar = qr/[\@\\|[\]{^]/oxms;
5793  
5794 # split regexp
5795 870 my @char = $string =~ /\G((?>
5796 [^\\\$\@\[\(] |
5797 \\x (?>[0-9A-Fa-f]{1,2}) |
5798 \\ (?>[0-7]{2,3}) |
5799 \\c [\x40-\x5F] |
5800 \\x\{ (?>[0-9A-Fa-f]+) \} |
5801 \\o\{ (?>[0-7]+) \} |
5802 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
5803 \\ $q_char |
5804 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5805 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5806 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5807 [\$\@] $qq_variable |
5808 \$ (?>\s* [0-9]+) |
5809 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5810 \$ \$ (?![\w\{]) |
5811 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5812 \[\^ |
5813 \[\: (?>[a-z]+) :\] |
5814 \[\:\^ (?>[a-z]+) :\] |
5815 \(\? |
5816 $q_char
5817 ))/oxmsg;
5818  
5819 # choice again delimiter
5820 870 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 870 870
5821 0 my %octet = map {$_ => 1} @char;
5822 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
5823 0 $delimiter = '(';
5824 0 $end_delimiter = ')';
5825 }
5826 elsif (not $octet{'}'}) {
5827 0 $delimiter = '{';
5828 0 $end_delimiter = '}';
5829 }
5830 elsif (not $octet{']'}) {
5831 0 $delimiter = '[';
5832 0 $end_delimiter = ']';
5833 }
5834 elsif (not $octet{'>'}) {
5835 0 $delimiter = '<';
5836 0 $end_delimiter = '>';
5837 }
5838 else {
5839 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5840 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5841 0 $delimiter = $char;
5842 0 $end_delimiter = $char;
5843 0 last;
5844 }
5845 }
5846 }
5847 }
5848  
5849 870 my $left_e = 0;
5850 870 my $right_e = 0;
5851 870 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 2100 870 2970
5852  
5853 # "\L\u" --> "\u\L"
5854 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
5855 0 @char[$i,$i+1] = @char[$i+1,$i];
5856 }
5857  
5858 # "\U\l" --> "\l\U"
5859 ▶ 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
5860 0 @char[$i,$i+1] = @char[$i+1,$i];
5861 }
5862  
5863 # octal escape sequence
5864 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5865 1 $char[$i] = Elatin4::octchr($1);
5866 }
5867  
5868 # hexadecimal escape sequence
5869 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5870 1 $char[$i] = Elatin4::hexchr($1);
5871 }
5872  
5873 # \b{...} --> b\{...}
5874 # \B{...} --> B\{...}
5875 # \N{CHARNAME} --> N\{CHARNAME}
5876 # \p{PROPERTY} --> p\{PROPERTY}
5877 # \P{PROPERTY} --> P\{PROPERTY}
5878 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5879 6 $char[$i] = $1 . '\\' . $2;
5880 }
5881  
5882 # \p, \P, \X --> p, P, X
5883 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
5884 4 $char[$i] = $1;
5885 }
5886  
5887 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
5888 }
5889  
5890 # join separated multiple-octet
5891 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
5892 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
5893 0 $char[$i] .= join '', splice @char, $i+1, 3;
5894 }
5895 ▶ 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
5896 0 $char[$i] .= join '', splice @char, $i+1, 2;
5897 }
5898 ▶ 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
5899 0 $char[$i] .= join '', splice @char, $i+1, 1;
5900 }
5901 }
5902  
5903 # open character class [...]
5904 elsif ($char[$i] eq '[') {
5905 556 my $left = $i;
5906  
5907 # [] make die "Unmatched [] in regexp ...\n"
5908 # (and so on)
5909  
5910 556 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 3 553 556
5911 3 $i++;
5912 }
5913  
5914 556 while (1) {
5915 2063 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 2063 2063
5916 0 die __FILE__, ": Unmatched [] in regexp\n";
5917 }
5918 2063 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 556 1507 2063
5919 556 my $right = $i;
5920  
5921 # [...]
5922 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
5923 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);
5924 }
5925 else {
5926 526 splice @char, $left, $right-$left+1, Elatin4::charlist_qr(@char[$left+1..$right-1], $modifier);
5927 }
5928  
5929 556 $i = $left;
5930 556 last;
5931 }
5932 }
5933 }
5934  
5935 # open character class [^...]
5936 elsif ($char[$i] eq '[^') {
5937 74 my $left = $i;
5938  
5939 # [^] make die "Unmatched [] in regexp ...\n"
5940 # (and so on)
5941  
5942 74 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 4 70 74
5943 4 $i++;
5944 }
5945  
5946 74 while (1) {
5947 272 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 272 272
5948 0 die __FILE__, ": Unmatched [] in regexp\n";
5949 }
5950 272 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 74 198 272
5951 74 my $right = $i;
5952  
5953 # [^...]
5954 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
5955 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);
5956 }
5957 else {
5958 44 splice @char, $left, $right-$left+1, Elatin4::charlist_not_qr(@char[$left+1..$right-1], $modifier);
5959 }
5960  
5961 74 $i = $left;
5962 74 last;
5963 }
5964 }
5965 }
5966  
5967 # rewrite character class or escape character
5968 elsif (my $char = character_class($char[$i],$modifier)) {
5969 139 $char[$i] = $char;
5970 }
5971  
5972 # /i modifier
5973 ▶ 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
5974 20 ▶ if (CORE::length(Elatin4::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 20 0 20
5975 20 $char[$i] = '[' . Elatin4::uc($char[$i]) . Elatin4::fc($char[$i]) . ']';
5976 }
5977 else {
5978 0 $char[$i] = '(?:' . Elatin4::uc($char[$i]) . '|' . Elatin4::fc($char[$i]) . ')';
5979 }
5980 }
5981  
5982 # \u \l \U \L \F \Q \E
5983 elsif ($char[$i] =~ /\A [<>] \z/oxms) {
5984 1 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 1 1
5985 0 $char[$i] = '\\' . $char[$i];
5986 }
5987 }
5988 elsif ($char[$i] eq '\u') {
5989 0 $char[$i] = '@{[Elatin4::ucfirst qq<';
5990 0 $left_e++;
5991 }
5992 elsif ($char[$i] eq '\l') {
5993 0 $char[$i] = '@{[Elatin4::lcfirst qq<';
5994 0 $left_e++;
5995 }
5996 elsif ($char[$i] eq '\U') {
5997 1 $char[$i] = '@{[Elatin4::uc qq<';
5998 1 $left_e++;
5999 }
6000 elsif ($char[$i] eq '\L') {
6001 1 $char[$i] = '@{[Elatin4::lc qq<';
6002 1 $left_e++;
6003 }
6004 elsif ($char[$i] eq '\F') {
6005 18 $char[$i] = '@{[Elatin4::fc qq<';
6006 18 $left_e++;
6007 }
6008 elsif ($char[$i] eq '\Q') {
6009 1 $char[$i] = '@{[CORE::quotemeta qq<';
6010 1 $left_e++;
6011 }
6012 elsif ($char[$i] eq '\E') {
6013 21 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 21 0 21
6014 21 $char[$i] = '>]}';
6015 21 $right_e++;
6016 }
6017 else {
6018 0 $char[$i] = '';
6019 }
6020 }
6021 elsif ($char[$i] eq '\Q') {
6022 0 while (1) {
6023 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6024 0 last;
6025 }
6026 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
6027 0 last;
6028 }
6029 }
6030 }
6031 elsif ($char[$i] eq '\E') {
6032 }
6033  
6034 # $0 --> $0
6035 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
6036 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6037 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
6038 }
6039 }
6040 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
6041 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6042 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
6043 }
6044 }
6045  
6046 # $$ --> $$
6047 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
6048 }
6049  
6050 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
6051 # $1, $2, $3 --> $1, $2, $3 otherwise
6052 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
6053 0 $char[$i] = e_capture($1);
6054 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6055 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
6056 }
6057 }
6058 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6059 0 $char[$i] = e_capture($1);
6060 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6061 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
6062 }
6063 }
6064  
6065 # $$foo[ ... ] --> $ $foo->[ ... ]
6066 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
6067 0 $char[$i] = e_capture($1.'->'.$2);
6068 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6069 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
6070 }
6071 }
6072  
6073 # $$foo{ ... } --> $ $foo->{ ... }
6074 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
6075 0 $char[$i] = e_capture($1.'->'.$2);
6076 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6077 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
6078 }
6079 }
6080  
6081 # $$foo
6082 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
6083 0 $char[$i] = e_capture($1);
6084 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6085 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
6086 }
6087 }
6088  
6089 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin4::PREMATCH()
6090 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
6091 8 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 8 8
6092 0 $char[$i] = '@{[Elatin4::ignorecase(Elatin4::PREMATCH())]}';
6093 }
6094 else {
6095 8 $char[$i] = '@{[Elatin4::PREMATCH()]}';
6096 }
6097 }
6098  
6099 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin4::MATCH()
6100 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
6101 8 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 8 8
6102 0 $char[$i] = '@{[Elatin4::ignorecase(Elatin4::MATCH())]}';
6103 }
6104 else {
6105 8 $char[$i] = '@{[Elatin4::MATCH()]}';
6106 }
6107 }
6108  
6109 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin4::POSTMATCH()
6110 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
6111 6 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 6 6
6112 0 $char[$i] = '@{[Elatin4::ignorecase(Elatin4::POSTMATCH())]}';
6113 }
6114 else {
6115 6 $char[$i] = '@{[Elatin4::POSTMATCH()]}';
6116 }
6117 }
6118  
6119 # ${ foo }
6120 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
6121 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6122 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
6123 }
6124 }
6125  
6126 # ${ ... }
6127 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
6128 0 $char[$i] = e_capture($1);
6129 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6130 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
6131 }
6132 }
6133  
6134 # $scalar or @array
6135 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
6136 21 $char[$i] = e_string($char[$i]);
6137 21 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 11 10 21
6138 11 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
6139 }
6140 }
6141  
6142 # quote character before ? + * {
6143 ▶ 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
6144 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
6145 }
6146 ▶ 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
6147 0 my $char = $char[$i-1];
6148 0 ▶ if ($char[$i] eq '{') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq '{') { } 0 0 0
6149 0 die __FILE__, qq{: "MULTIBYTE{n}" should be "(MULTIBYTE){n}" in m?? (and shift \$1,\$2,\$3,...) ($char){n}\n};
6150 }
6151 else {
6152 0 die __FILE__, qq{: "MULTIBYTE$char[$i]" should be "(MULTIBYTE)$char[$i]" in m?? (and shift \$1,\$2,\$3,...) ($char)$char[$i]\n};
6153 }
6154 }
6155 else {
6156 127 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6157 }
6158 }
6159 }
6160  
6161 # make regexp string
6162 870 $modifier =~ tr/i//d;
6163 870 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 870 870
6164 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
6165 0 return join '', $ope, $delimiter, $anchor, @char, '>]}' x ($left_e - $right_e), $matched, $end_delimiter, $modifier;
6166 }
6167 else {
6168 0 return join '', $ope, $delimiter, $anchor, '(?:', @char, '>]}' x ($left_e - $right_e), ')', $matched, $end_delimiter, $modifier;
6169 }
6170 }
6171 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
6172 0 return join '', $ope, $delimiter, $anchor, @char, $matched, $end_delimiter, $modifier;
6173 }
6174 else {
6175 870 return join '', $ope, $delimiter, $anchor, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6176 }
6177 }
6178  
6179 #
6180 # double quote stuff
6181 #
6182 180 ▶sub qq_stuff {
Subroutine qq_stuff: called CC=6 SCAR=18.5
Pod undocumented
6183 180 my($delimiter,$end_delimiter,$stuff) = @_;
6184  
6185 # scalar variable or array variable
6186 180 ▶ if ($stuff =~ /\A [\$\@] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($stuff =~ /\A [\$\@] /mosx) 100 80 180
6187 100 return $stuff;
6188 }
6189  
6190 # quote by delimiter
6191 80 my %octet = map {$_ => 1} ($stuff =~ /\G ([\x00-\xFF]) /oxmsg);
6192 80 for my $char (qw( ! " $ % & * + - . / : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
6193 80 ▶ next if $char eq $delimiter;
Branch: 1 branch
BranchTrueFalseTotal
if $char eq $delimiter 0 80 80
6194 80 ▶ next if $char eq $end_delimiter;
Branch: 1 branch
BranchTrueFalseTotal
if $char eq $end_delimiter 0 80 80
6195 80 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 80 0 80
6196 80 return join '', 'qq', $char, $stuff, $char;
6197 }
6198 }
6199 0 return join '', 'qq', '<', $stuff, '>';
6200 }
6201  
6202 #
6203 # escape regexp (m'', qr'', and m''b, qr''b)
6204 #
6205 10 ▶sub e_qr_q {
Subroutine e_qr_q: called CC=7 SCAR=25.3
Pod undocumented
6206 10 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6207 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
6208  
6209 10 $modifier =~ tr/p//d;
6210 10 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 10 10
6211 0 my $line = 0;
6212 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6213 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6214 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6215 0 last;
6216 }
6217 }
6218 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6219 }
6220  
6221 10 $slash = 'div';
6222  
6223 # literal null string pattern
6224 10 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 2 10
elsif ($modifier =~ tr/Bb//d) { } 0 2 2
6225 8 $modifier =~ tr/bB//d;
6226 8 $modifier =~ tr/i//d;
6227 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
6228 }
6229  
6230 # with /b /B modifier
6231 elsif ($modifier =~ tr/bB//d) {
6232 0 return e_qr_qb($ope,$delimiter,$end_delimiter,$string,$modifier);
6233 }
6234  
6235 # without /b /B modifier
6236 else {
6237 2 return e_qr_qt($ope,$delimiter,$end_delimiter,$string,$modifier);
6238 }
6239 }
6240  
6241 #
6242 # escape regexp (m'', qr'')
6243 #
6244 2 ▶sub e_qr_qt {
Subroutine e_qr_qt: called CC=20 SCAR=51.8
Pod undocumented
6245 2 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6246  
6247 2 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 2 2
6248  
6249 # split regexp
6250 2 my @char = $string =~ /\G((?>
6251 [^\\\[\$\@\/] |
6252 [\x00-\xFF] |
6253 \[\^ |
6254 \[\: (?>[a-z]+) \:\] |
6255 \[\:\^ (?>[a-z]+) \:\] |
6256 [\$\@\/] |
6257 \\ (?:$q_char) |
6258 (?:$q_char)
6259 ))/oxmsg;
6260  
6261 # unescape character
6262 2 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 2 2 4
6263 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
6264 }
6265  
6266 # open character class [...]
6267 elsif ($char[$i] eq '[') {
6268 0 my $left = $i;
6269 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6270 0 $i++;
6271 }
6272 0 while (1) {
6273 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6274 0 die __FILE__, ": Unmatched [] in regexp\n";
6275 }
6276 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6277 0 my $right = $i;
6278  
6279 # [...]
6280 0 splice @char, $left, $right-$left+1, Elatin4::charlist_qr(@char[$left+1..$right-1], $modifier);
6281  
6282 0 $i = $left;
6283 0 last;
6284 }
6285 }
6286 }
6287  
6288 # open character class [^...]
6289 elsif ($char[$i] eq '[^') {
6290 0 my $left = $i;
6291 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6292 0 $i++;
6293 }
6294 0 while (1) {
6295 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6296 0 die __FILE__, ": Unmatched [] in regexp\n";
6297 }
6298 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6299 0 my $right = $i;
6300  
6301 # [^...]
6302 0 splice @char, $left, $right-$left+1, Elatin4::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6303  
6304 0 $i = $left;
6305 0 last;
6306 }
6307 }
6308 }
6309  
6310 # escape $ @ / and \
6311 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6312 0 $char[$i] = '\\' . $char[$i];
6313 }
6314  
6315 # rewrite character class or escape character
6316 elsif (my $char = character_class($char[$i],$modifier)) {
6317 0 $char[$i] = $char;
6318 }
6319  
6320 # /i modifier
6321 ▶ 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
6322 0 ▶ if (CORE::length(Elatin4::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
6323 0 $char[$i] = '[' . Elatin4::uc($char[$i]) . Elatin4::fc($char[$i]) . ']';
6324 }
6325 else {
6326 0 $char[$i] = '(?:' . Elatin4::uc($char[$i]) . '|' . Elatin4::fc($char[$i]) . ')';
6327 }
6328 }
6329  
6330 # quote character before ? + * {
6331 ▶ 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
6332 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
6333 }
6334 else {
6335 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6336 }
6337 }
6338 }
6339  
6340 2 $delimiter = '/';
6341 2 $end_delimiter = '/';
6342  
6343 2 $modifier =~ tr/i//d;
6344 2 return join '', $ope, $delimiter, $anchor, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6345 }
6346  
6347 #
6348 # escape regexp (m''b, qr''b)
6349 #
6350 0 ▶sub e_qr_qb {
Subroutine e_qr_qb: not called CC=4 SCAR=30.0
Pod undocumented
6351 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6352  
6353 # split regexp
6354 0 my @char = $string =~ /\G ((?>[^\\]|\\\\)) /oxmsg;
6355  
6356 # unescape character
6357 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
6358 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
6359 }
6360  
6361 # remain \\
6362 elsif ($char[$i] eq '\\\\') {
6363 }
6364  
6365 # escape $ @ / and \
6366 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6367 0 $char[$i] = '\\' . $char[$i];
6368 }
6369 }
6370  
6371 0 $delimiter = '/';
6372 0 $end_delimiter = '/';
6373 0 return join '', $ope, $delimiter, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6374 }
6375  
6376 #
6377 # escape regexp (s/here//)
6378 #
6379 80 ▶sub e_s1 {
Subroutine e_s1: called CC=106 SCAR=81.1
Pod undocumented
6380 80 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6381 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
6382  
6383 80 $modifier =~ tr/p//d;
6384 80 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 80 80
6385 0 my $line = 0;
6386 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6387 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6388 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6389 0 last;
6390 }
6391 }
6392 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6393 }
6394  
6395 80 $slash = 'div';
6396  
6397 # literal null string pattern
6398 80 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 72 80
elsif ($modifier =~ tr/Bb//d) { } 0 72 72
6399 8 $modifier =~ tr/bB//d;
6400 8 $modifier =~ tr/i//d;
6401 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
6402 }
6403  
6404 # /b /B modifier
6405 elsif ($modifier =~ tr/bB//d) {
6406  
6407 # choice again delimiter
6408 0 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 0 0
6409 0 my @char = $string =~ /\G ([\x00-\xFF]) /oxmsg;
6410 0 my %octet = map {$_ => 1} @char;
6411 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
6412 0 $delimiter = '(';
6413 0 $end_delimiter = ')';
6414 }
6415 elsif (not $octet{'}'}) {
6416 0 $delimiter = '{';
6417 0 $end_delimiter = '}';
6418 }
6419 elsif (not $octet{']'}) {
6420 0 $delimiter = '[';
6421 0 $end_delimiter = ']';
6422 }
6423 elsif (not $octet{'>'}) {
6424 0 $delimiter = '<';
6425 0 $end_delimiter = '>';
6426 }
6427 else {
6428 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
6429 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
6430 0 $delimiter = $char;
6431 0 $end_delimiter = $char;
6432 0 last;
6433 }
6434 }
6435 }
6436 }
6437  
6438 0 my $prematch = '';
6439 0 return join '', $ope, $delimiter, $prematch, '(?:', $string, ')', $matched, $end_delimiter, $modifier;
6440 }
6441  
6442 72 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 1 71 72
6443 72 my $metachar = qr/[\@\\|[\]{^]/oxms;
6444  
6445 # split regexp
6446 72 my @char = $string =~ /\G((?>
6447 [^\\\$\@\[\(] |
6448 \\ (?>[1-9][0-9]*) |
6449 \\g (?>\s*) (?>[1-9][0-9]*) |
6450 \\g (?>\s*) \{ (?>\s*) (?>[1-9][0-9]*) (?>\s*) \} |
6451 \\g (?>\s*) \{ (?>\s*) - (?>\s*) (?>[1-9][0-9]*) (?>\s*) \} |
6452 \\x (?>[0-9A-Fa-f]{1,2}) |
6453 \\ (?>[0-7]{2,3}) |
6454 \\c [\x40-\x5F] |
6455 \\x\{ (?>[0-9A-Fa-f]+) \} |
6456 \\o\{ (?>[0-7]+) \} |
6457 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
6458 \\ $q_char |
6459 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
6460 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
6461 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
6462 [\$\@] $qq_variable |
6463 \$ (?>\s* [0-9]+) |
6464 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
6465 \$ \$ (?![\w\{]) |
6466 \$ (?>\s*) \$ (?>\s*) $qq_variable |
6467 \[\^ |
6468 \[\: (?>[a-z]+) :\] |
6469 \[\:\^ (?>[a-z]+) :\] |
6470 \(\? |
6471 $q_char
6472 ))/oxmsg;
6473  
6474 # choice again delimiter
6475 72 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 72 72
6476 0 my %octet = map {$_ => 1} @char;
6477 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
6478 0 $delimiter = '(';
6479 0 $end_delimiter = ')';
6480 }
6481 elsif (not $octet{'}'}) {
6482 0 $delimiter = '{';
6483 0 $end_delimiter = '}';
6484 }
6485 elsif (not $octet{']'}) {
6486 0 $delimiter = '[';
6487 0 $end_delimiter = ']';
6488 }
6489 elsif (not $octet{'>'}) {
6490 0 $delimiter = '<';
6491 0 $end_delimiter = '>';
6492 }
6493 else {
6494 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
6495 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
6496 0 $delimiter = $char;
6497 0 $end_delimiter = $char;
6498 0 last;
6499 }
6500 }
6501 }
6502 }
6503  
6504 # count '('
6505 72 my $parens = grep { $_ eq '(' } @char;
6506  
6507 72 my $left_e = 0;
6508 72 my $right_e = 0;
6509 72 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 200 72 272
6510  
6511 # "\L\u" --> "\u\L"
6512 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
6513 0 @char[$i,$i+1] = @char[$i+1,$i];
6514 }
6515  
6516 # "\U\l" --> "\l\U"
6517 ▶ 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
6518 0 @char[$i,$i+1] = @char[$i+1,$i];
6519 }
6520  
6521 # octal escape sequence
6522 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
6523 1 $char[$i] = Elatin4::octchr($1);
6524 }
6525  
6526 # hexadecimal escape sequence
6527 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
6528 1 $char[$i] = Elatin4::hexchr($1);
6529 }
6530  
6531 # \b{...} --> b\{...}
6532 # \B{...} --> B\{...}
6533 # \N{CHARNAME} --> N\{CHARNAME}
6534 # \p{PROPERTY} --> p\{PROPERTY}
6535 # \P{PROPERTY} --> P\{PROPERTY}
6536 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
6537 0 $char[$i] = $1 . '\\' . $2;
6538 }
6539  
6540 # \p, \P, \X --> p, P, X
6541 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
6542 0 $char[$i] = $1;
6543 }
6544  
6545 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
6546 }
6547  
6548 # join separated multiple-octet
6549 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
6550 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
6551 0 $char[$i] .= join '', splice @char, $i+1, 3;
6552 }
6553 ▶ 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
6554 0 $char[$i] .= join '', splice @char, $i+1, 2;
6555 }
6556 ▶ 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
6557 0 $char[$i] .= join '', splice @char, $i+1, 1;
6558 }
6559 }
6560  
6561 # open character class [...]
6562 elsif ($char[$i] eq '[') {
6563 17 my $left = $i;
6564 17 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 17 17
6565 0 $i++;
6566 }
6567 17 while (1) {
6568 74 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 74 74
6569 0 die __FILE__, ": Unmatched [] in regexp\n";
6570 }
6571 74 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 17 57 74
6572 17 my $right = $i;
6573  
6574 # [...]
6575 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
6576 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);
6577 }
6578 else {
6579 17 splice @char, $left, $right-$left+1, Elatin4::charlist_qr(@char[$left+1..$right-1], $modifier);
6580 }
6581  
6582 17 $i = $left;
6583 17 last;
6584 }
6585 }
6586 }
6587  
6588 # open character class [^...]
6589 elsif ($char[$i] eq '[^') {
6590 0 my $left = $i;
6591 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6592 0 $i++;
6593 }
6594 0 while (1) {
6595 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6596 0 die __FILE__, ": Unmatched [] in regexp\n";
6597 }
6598 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6599 0 my $right = $i;
6600  
6601 # [^...]
6602 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
6603 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);
6604 }
6605 else {
6606 0 splice @char, $left, $right-$left+1, Elatin4::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6607 }
6608  
6609 0 $i = $left;
6610 0 last;
6611 }
6612 }
6613 }
6614  
6615 # rewrite character class or escape character
6616 elsif (my $char = character_class($char[$i],$modifier)) {
6617 7 $char[$i] = $char;
6618 }
6619  
6620 # /i modifier
6621 ▶ 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
6622 3 ▶ if (CORE::length(Elatin4::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 3 0 3
6623 3 $char[$i] = '[' . Elatin4::uc($char[$i]) . Elatin4::fc($char[$i]) . ']';
6624 }
6625 else {
6626 0 $char[$i] = '(?:' . Elatin4::uc($char[$i]) . '|' . Elatin4::fc($char[$i]) . ')';
6627 }
6628 }
6629  
6630 # \u \l \U \L \F \Q \E
6631 elsif ($char[$i] =~ /\A [<>] \z/oxms) {
6632 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
6633 0 $char[$i] = '\\' . $char[$i];
6634 }
6635 }
6636 elsif ($char[$i] eq '\u') {
6637 0 $char[$i] = '@{[Elatin4::ucfirst qq<';
6638 0 $left_e++;
6639 }
6640 elsif ($char[$i] eq '\l') {
6641 0 $char[$i] = '@{[Elatin4::lcfirst qq<';
6642 0 $left_e++;
6643 }
6644 elsif ($char[$i] eq '\U') {
6645 0 $char[$i] = '@{[Elatin4::uc qq<';
6646 0 $left_e++;
6647 }
6648 elsif ($char[$i] eq '\L') {
6649 0 $char[$i] = '@{[Elatin4::lc qq<';
6650 0 $left_e++;
6651 }
6652 elsif ($char[$i] eq '\F') {
6653 0 $char[$i] = '@{[Elatin4::fc qq<';
6654 0 $left_e++;
6655 }
6656 elsif ($char[$i] eq '\Q') {
6657 0 $char[$i] = '@{[CORE::quotemeta qq<';
6658 0 $left_e++;
6659 }
6660 elsif ($char[$i] eq '\E') {
6661 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
6662 0 $char[$i] = '>]}';
6663 0 $right_e++;
6664 }
6665 else {
6666 0 $char[$i] = '';
6667 }
6668 }
6669 elsif ($char[$i] eq '\Q') {
6670 0 while (1) {
6671 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6672 0 last;
6673 }
6674 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
6675 0 last;
6676 }
6677 }
6678 }
6679 elsif ($char[$i] eq '\E') {
6680 }
6681  
6682 # \0 --> \0
6683 elsif ($char[$i] =~ /\A \\ (?>\s*) 0 \z/oxms) {
6684 }
6685  
6686 # \g{N}, \g{-N}
6687  
6688 # P.108 Using Simple Patterns
6689 # in Chapter 7: In the World of Regular Expressions
6690 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
6691  
6692 # P.221 Capturing
6693 # in Chapter 5: Pattern Matching
6694 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
6695  
6696 # \g{-1}, \g{-2}, \g{-3} --> \g{-1}, \g{-2}, \g{-3}
6697 elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) - (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6698 }
6699  
6700 # \g{1}, \g{2}, \g{3} --> \g{2}, \g{3}, \g{4} (only when multibyte anchoring is enable)
6701 elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6702 }
6703  
6704 # \g1, \g2, \g3 --> \g2, \g3, \g4 (only when multibyte anchoring is enable)
6705 elsif ($char[$i] =~ /\A \\g (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) {
6706 }
6707  
6708 # \1, \2, \3 --> \2, \3, \4 (only when multibyte anchoring is enable)
6709 elsif ($char[$i] =~ /\A \\ (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) {
6710 }
6711  
6712 # $0 --> $0
6713 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
6714 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6715 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
6716 }
6717 }
6718 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
6719 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6720 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
6721 }
6722 }
6723  
6724 # $$ --> $$
6725 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
6726 }
6727  
6728 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
6729 # $1, $2, $3 --> $1, $2, $3 otherwise
6730 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
6731 0 $char[$i] = e_capture($1);
6732 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6733 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
6734 }
6735 }
6736 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6737 0 $char[$i] = e_capture($1);
6738 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6739 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
6740 }
6741 }
6742  
6743 # $$foo[ ... ] --> $ $foo->[ ... ]
6744 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
6745 0 $char[$i] = e_capture($1.'->'.$2);
6746 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6747 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
6748 }
6749 }
6750  
6751 # $$foo{ ... } --> $ $foo->{ ... }
6752 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
6753 0 $char[$i] = e_capture($1.'->'.$2);
6754 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6755 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
6756 }
6757 }
6758  
6759 # $$foo
6760 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
6761 0 $char[$i] = e_capture($1);
6762 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6763 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
6764 }
6765 }
6766  
6767 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin4::PREMATCH()
6768 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
6769 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 4 4
6770 0 $char[$i] = '@{[Elatin4::ignorecase(Elatin4::PREMATCH())]}';
6771 }
6772 else {
6773 4 $char[$i] = '@{[Elatin4::PREMATCH()]}';
6774 }
6775 }
6776  
6777 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin4::MATCH()
6778 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
6779 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 4 4
6780 0 $char[$i] = '@{[Elatin4::ignorecase(Elatin4::MATCH())]}';
6781 }
6782 else {
6783 4 $char[$i] = '@{[Elatin4::MATCH()]}';
6784 }
6785 }
6786  
6787 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin4::POSTMATCH()
6788 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
6789 3 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 3 3
6790 0 $char[$i] = '@{[Elatin4::ignorecase(Elatin4::POSTMATCH())]}';
6791 }
6792 else {
6793 3 $char[$i] = '@{[Elatin4::POSTMATCH()]}';
6794 }
6795 }
6796  
6797 # ${ foo }
6798 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
6799 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6800 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
6801 }
6802 }
6803  
6804 # ${ ... }
6805 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
6806 0 $char[$i] = e_capture($1);
6807 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6808 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
6809 }
6810 }
6811  
6812 # $scalar or @array
6813 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
6814 4 $char[$i] = e_string($char[$i]);
6815 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 4 4
6816 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
6817 }
6818 }
6819  
6820 # quote character before ? + * {
6821 ▶ 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
6822 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
6823 }
6824 else {
6825 14 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6826 }
6827 }
6828 }
6829  
6830 # make regexp string
6831 72 my $prematch = '';
6832 72 $modifier =~ tr/i//d;
6833 72 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 72 72
6834 0 return join '', $ope, $delimiter, $prematch, '(?:', @char, '>]}' x ($left_e - $right_e), ')', $matched, $end_delimiter, $modifier;
6835 }
6836 72 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6837 }
6838  
6839 #
6840 # escape regexp (s'here'' or s'here''b)
6841 #
6842 21 ▶sub e_s1_q {
Subroutine e_s1_q: called CC=7 SCAR=24.3
Pod undocumented
6843 21 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6844 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
6845  
6846 21 $modifier =~ tr/p//d;
6847 21 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 21 21
6848 0 my $line = 0;
6849 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6850 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6851 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6852 0 last;
6853 }
6854 }
6855 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6856 }
6857  
6858 21 $slash = 'div';
6859  
6860 # literal null string pattern
6861 21 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 13 21
elsif ($modifier =~ tr/Bb//d) { } 0 13 13
6862 8 $modifier =~ tr/bB//d;
6863 8 $modifier =~ tr/i//d;
6864 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
6865 }
6866  
6867 # with /b /B modifier
6868 elsif ($modifier =~ tr/bB//d) {
6869 0 return e_s1_qb($ope,$delimiter,$end_delimiter,$string,$modifier);
6870 }
6871  
6872 # without /b /B modifier
6873 else {
6874 13 return e_s1_qt($ope,$delimiter,$end_delimiter,$string,$modifier);
6875 }
6876 }
6877  
6878 #
6879 # escape regexp (s'here'')
6880 #
6881 13 ▶sub e_s1_qt {
Subroutine e_s1_qt: called CC=20 SCAR=50.1
Pod undocumented
6882 13 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6883  
6884 13 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 13 13
6885  
6886 # split regexp
6887 13 my @char = $string =~ /\G((?>
6888 [^\\\[\$\@\/] |
6889 [\x00-\xFF] |
6890 \[\^ |
6891 \[\: (?>[a-z]+) \:\] |
6892 \[\:\^ (?>[a-z]+) \:\] |
6893 [\$\@\/] |
6894 \\ (?:$q_char) |
6895 (?:$q_char)
6896 ))/oxmsg;
6897  
6898 # unescape character
6899 13 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 25 13 38
6900 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
6901 }
6902  
6903 # open character class [...]
6904 elsif ($char[$i] eq '[') {
6905 0 my $left = $i;
6906 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6907 0 $i++;
6908 }
6909 0 while (1) {
6910 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6911 0 die __FILE__, ": Unmatched [] in regexp\n";
6912 }
6913 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6914 0 my $right = $i;
6915  
6916 # [...]
6917 0 splice @char, $left, $right-$left+1, Elatin4::charlist_qr(@char[$left+1..$right-1], $modifier);
6918  
6919 0 $i = $left;
6920 0 last;
6921 }
6922 }
6923 }
6924  
6925 # open character class [^...]
6926 elsif ($char[$i] eq '[^') {
6927 0 my $left = $i;
6928 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6929 0 $i++;
6930 }
6931 0 while (1) {
6932 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6933 0 die __FILE__, ": Unmatched [] in regexp\n";
6934 }
6935 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6936 0 my $right = $i;
6937  
6938 # [^...]
6939 0 splice @char, $left, $right-$left+1, Elatin4::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6940  
6941 0 $i = $left;
6942 0 last;
6943 }
6944 }
6945 }
6946  
6947 # escape $ @ / and \
6948 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6949 0 $char[$i] = '\\' . $char[$i];
6950 }
6951  
6952 # rewrite character class or escape character
6953 elsif (my $char = character_class($char[$i],$modifier)) {
6954 6 $char[$i] = $char;
6955 }
6956  
6957 # /i modifier
6958 ▶ 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
6959 0 ▶ if (CORE::length(Elatin4::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
6960 0 $char[$i] = '[' . Elatin4::uc($char[$i]) . Elatin4::fc($char[$i]) . ']';
6961 }
6962 else {
6963 0 $char[$i] = '(?:' . Elatin4::uc($char[$i]) . '|' . Elatin4::fc($char[$i]) . ')';
6964 }
6965 }
6966  
6967 # quote character before ? + * {
6968 ▶ 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
6969 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
6970 }
6971 else {
6972 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6973 }
6974 }
6975 }
6976  
6977 13 $modifier =~ tr/i//d;
6978 13 $delimiter = '/';
6979 13 $end_delimiter = '/';
6980 13 my $prematch = '';
6981 13 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6982 }
6983  
6984 #
6985 # escape regexp (s'here''b)
6986 #
6987 0 ▶sub e_s1_qb {
Subroutine e_s1_qb: not called CC=4 SCAR=30.0
Pod undocumented
6988 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6989  
6990 # split regexp
6991 0 my @char = $string =~ /\G (?>[^\\]|\\\\) /oxmsg;
6992  
6993 # unescape character
6994 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
6995 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
6996 }
6997  
6998 # remain \\
6999 elsif ($char[$i] eq '\\\\') {
7000 }
7001  
7002 # escape $ @ / and \
7003 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
7004 0 $char[$i] = '\\' . $char[$i];
7005 }
7006 }
7007  
7008 0 $delimiter = '/';
7009 0 $end_delimiter = '/';
7010 0 my $prematch = '';
7011 0 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
7012 }
7013  
7014 #
7015 # escape regexp (s''here')
7016 #
7017 16 ▶sub e_s2_q {
Subroutine e_s2_q: called CC=4 SCAR=13.9
Pod undocumented
7018 16 my($ope,$delimiter,$end_delimiter,$string) = @_;
7019  
7020 16 $slash = 'div';
7021  
7022 16 my @char = $string =~ / \G (?>[^\\]|\\\\|$q_char) /oxmsg;
7023 16 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 9 16 25
7024 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
7025 }
7026  
7027 # not escape \\
7028 elsif ($char[$i] =~ /\A \\\\ \z/oxms) {
7029 }
7030  
7031 # escape $ @ / and \
7032 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
7033 5 $char[$i] = '\\' . $char[$i];
7034 }
7035 }
7036  
7037 16 return join '', $ope, $delimiter, @char, $end_delimiter;
7038 }
7039  
7040 #
7041 # escape regexp (s/here/and here/modifier)
7042 #
7043 101 ▶sub e_sub {
Subroutine e_sub: called CC=20 SCAR=32.6
Pod undocumented
7044 101 my($variable,$delimiter1,$pattern,$end_delimiter1,$delimiter2,$replacement,$end_delimiter2,$modifier) = @_;
7045 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
7046  
7047 101 $modifier =~ tr/p//d;
7048 101 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 101 101
7049 0 my $line = 0;
7050 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7051 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
7052 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
7053 0 last;
7054 }
7055 }
7056 0 die qq{Unsupported modifier "$1" used at line $line.\n};
7057 }
7058  
7059 101 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq "") 36 65 101
7060 36 $variable = '$_';
7061 36 $bind_operator = ' =~ ';
7062 }
7063  
7064 101 $slash = 'div';
7065  
7066 # P.128 Start of match (or end of previous match): \G
7067 # P.130 Advanced Use of \G with Perl
7068 # in Chapter 3: Overview of Regular Expression Features and Flavors
7069 # P.312 Iterative Matching: Scalar Context, with /g
7070 # in Chapter 7: Perl
7071 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
7072  
7073 # P.181 Where You Left Off: The \G Assertion
7074 # in Chapter 5: Pattern Matching
7075 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
7076  
7077 # P.220 Where You Left Off: The \G Assertion
7078 # in Chapter 5: Pattern Matching
7079 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
7080  
7081 101 my $e_modifier = $modifier =~ tr/e//d;
7082 101 my $r_modifier = $modifier =~ tr/r//d;
7083  
7084 101 my $my = '';
7085 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
7086 0 $my = $variable;
7087 0 $variable =~ s/ (?: local \b | my \b | our \b | state \b ) (?>\s*) //oxms;
7088 0 $variable =~ s/ = .+ \z//oxms;
7089 }
7090  
7091 101 (my $variable_basename = $variable) =~ s/ [\[\{].* \z//oxms;
7092 101 $variable_basename =~ s/ \s+ \z//oxms;
7093  
7094 # quote replacement string
7095 101 my $e_replacement = '';
7096 101 ▶ if ($e_modifier >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($e_modifier >= 1) { } 17 84 101
7097 17 $e_replacement = e_qq('', '', '', $replacement);
7098 17 $e_modifier--;
7099 }
7100 else {
7101 84 ▶ if ($delimiter2 eq "'") {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter2 eq q[']) { } 16 68 84
7102 16 $e_replacement = e_s2_q('qq', '/', '/', $replacement);
7103 }
7104 else {
7105 68 $e_replacement = e_qq ('qq', $delimiter2, $end_delimiter2, $replacement);
7106 }
7107 }
7108  
7109 101 my $sub = '';
7110  
7111 # with /r
7112 101 ▶ if ($r_modifier) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r_modifier) { } 10 91 101
7113 10 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $modifier =~ /g/mosx }) { } 5 5 10
7114 }
7115  
7116 # s///gr without multibyte anchoring
7117 elsif ($modifier =~ /g/oxms) {
7118 5 ▶ $sub = sprintf(
Branch: 1 branch
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 0 5 5
7119 # 1 2 3 4 5
7120 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}>,
7121  
7122 $variable, # 1
7123 ($delimiter1 eq "'") ? # 2
7124 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
7125 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
7126 $s_matched, # 3
7127 $e_replacement, # 4
7128 '$Elatin4::re_r=CORE::eval $Elatin4::re_r; ' x $e_modifier, # 5
7129 );
7130 }
7131  
7132 # s///r
7133 else {
7134  
7135 5 my $prematch = q{$`};
7136  
7137 5 ▶ $sub = sprintf(
Branch: 1 branch
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 0 5 5
7138 # 1 2 3 4 5 6 7
7139 q<(%s =~ %s) ? CORE::eval{%s local $^W=0; local $Elatin4::re_r=%s; %s"%s$Elatin4::re_r$'" } : %s>,
7140  
7141 $variable, # 1
7142 ($delimiter1 eq "'") ? # 2
7143 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
7144 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
7145 $s_matched, # 3
7146 $e_replacement, # 4
7147 '$Elatin4::re_r=CORE::eval $Elatin4::re_r; ' x $e_modifier, # 5
7148 $prematch, # 6
7149 $variable, # 7
7150 );
7151 }
7152  
7153 # $var !~ s///r doesn't make sense
7154 10 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) 0 10 10
7155 0 $sub = q{die("$0: Using !~ with s///r doesn't make sense"), } . $sub;
7156 }
7157 }
7158  
7159 # without /r
7160 else {
7161 91 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $modifier =~ /g/mosx }) { } 23 68 91
7162 }
7163  
7164 # s///g without multibyte anchoring
7165 elsif ($modifier =~ /g/oxms) {
7166 23 ▶ $sub = sprintf(
Branch: 2 branches
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 3 20 23
$bind_operator =~ / !~ /mosx ? : 3 20 23
7167 # 1 2 3 4 5 6 7 8
7168 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}>,
7169  
7170 $variable, # 1
7171 ($delimiter1 eq "'") ? # 2
7172 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
7173 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
7174 $s_matched, # 3
7175 $e_replacement, # 4
7176 '$Elatin4::re_r=CORE::eval $Elatin4::re_r; ' x $e_modifier, # 5
7177 $variable, # 6
7178 $variable, # 7
7179 ($bind_operator =~ / !~ /oxms) ? '!' : '', # 8
7180 );
7181 }
7182  
7183 # s///
7184 else {
7185  
7186 68 my $prematch = q{$`};
7187  
7188 68 ▶ $sub = sprintf(
Branch: 2 branches
BranchTrueFalseTotal
$bind_operator =~ / =~ /mosx ? : 65 3 68
$delimiter1 eq q['] ? : 18 50 68
7189  
7190 ($bind_operator =~ / =~ /oxms) ?
7191  
7192 # 1 2 3 4 5 6 7 8
7193 q<(%s%s%s) ? CORE::eval{%s local $^W=0; local $Elatin4::re_r=%s; %s%s="%s$Elatin4::re_r$'"; 1 } : undef> :
7194  
7195 # 1 2 3 4 5 6 7 8
7196 q<(%s%s%s) ? 1 : CORE::eval{%s local $^W=0; local $Elatin4::re_r=%s; %s%s="%s$Elatin4::re_r$'"; undef }>,
7197  
7198 $variable, # 1
7199 $bind_operator, # 2
7200 ($delimiter1 eq "'") ? # 3
7201 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
7202 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
7203 $s_matched, # 4
7204 $e_replacement, # 5
7205 '$Elatin4::re_r=CORE::eval $Elatin4::re_r; ' x $e_modifier, # 6
7206 $variable, # 7
7207 $prematch, # 8
7208 );
7209 }
7210 }
7211  
7212 # (my $foo = $bar) =~ s/// --> (my $foo = $bar, CORE::eval { ... })[1]
7213 101 ▶ if ($my ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($my ne "") 0 101 101
7214 0 $sub = "($my, $sub)[1]";
7215 }
7216  
7217 # clear s/// variable
7218 101 $sub_variable = '';
7219 101 $bind_operator = '';
7220  
7221 101 return $sub;
7222 }
7223  
7224 #
7225 # escape regexp of split qr//
7226 #
7227 74 ▶sub e_split {
Subroutine e_split: called CC=88 SCAR=76.4
Pod undocumented
7228 74 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
7229 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
7230  
7231 74 $modifier =~ tr/p//d;
7232 74 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 74 74
7233 0 my $line = 0;
7234 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7235 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
7236 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
7237 0 last;
7238 }
7239 }
7240 0 die qq{Unsupported modifier "$1" used at line $line.\n};
7241 }
7242  
7243 74 $slash = 'div';
7244  
7245 # /b /B modifier
7246 74 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) 0 74 74
7247 0 return join '', 'split', $ope, $delimiter, $string, $end_delimiter, $modifier;
7248 }
7249  
7250 74 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 74 74
7251 74 my $metachar = qr/[\@\\|[\]{^]/oxms;
7252  
7253 # split regexp
7254 74 my @char = $string =~ /\G((?>
7255 [^\\\$\@\[\(] |
7256 \\x (?>[0-9A-Fa-f]{1,2}) |
7257 \\ (?>[0-7]{2,3}) |
7258 \\c [\x40-\x5F] |
7259 \\x\{ (?>[0-9A-Fa-f]+) \} |
7260 \\o\{ (?>[0-7]+) \} |
7261 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
7262 \\ $q_char |
7263 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
7264 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
7265 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
7266 [\$\@] $qq_variable |
7267 \$ (?>\s* [0-9]+) |
7268 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
7269 \$ \$ (?![\w\{]) |
7270 \$ (?>\s*) \$ (?>\s*) $qq_variable |
7271 \[\^ |
7272 \[\: (?>[a-z]+) :\] |
7273 \[\:\^ (?>[a-z]+) :\] |
7274 \(\? |
7275 $q_char
7276 ))/oxmsg;
7277  
7278 74 my $left_e = 0;
7279 74 my $right_e = 0;
7280 74 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 249 74 323
7281  
7282 # "\L\u" --> "\u\L"
7283 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
7284 0 @char[$i,$i+1] = @char[$i+1,$i];
7285 }
7286  
7287 # "\U\l" --> "\l\U"
7288 ▶ 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
7289 0 @char[$i,$i+1] = @char[$i+1,$i];
7290 }
7291  
7292 # octal escape sequence
7293 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
7294 1 $char[$i] = Elatin4::octchr($1);
7295 }
7296  
7297 # hexadecimal escape sequence
7298 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
7299 1 $char[$i] = Elatin4::hexchr($1);
7300 }
7301  
7302 # \b{...} --> b\{...}
7303 # \B{...} --> B\{...}
7304 # \N{CHARNAME} --> N\{CHARNAME}
7305 # \p{PROPERTY} --> p\{PROPERTY}
7306 # \P{PROPERTY} --> P\{PROPERTY}
7307 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
7308 0 $char[$i] = $1 . '\\' . $2;
7309 }
7310  
7311 # \p, \P, \X --> p, P, X
7312 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
7313 0 $char[$i] = $1;
7314 }
7315  
7316 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
7317 }
7318  
7319 # join separated multiple-octet
7320 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
7321 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
7322 0 $char[$i] .= join '', splice @char, $i+1, 3;
7323 }
7324 ▶ 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
7325 0 $char[$i] .= join '', splice @char, $i+1, 2;
7326 }
7327 ▶ 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
7328 0 $char[$i] .= join '', splice @char, $i+1, 1;
7329 }
7330 }
7331  
7332 # open character class [...]
7333 elsif ($char[$i] eq '[') {
7334 3 my $left = $i;
7335 3 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 3 3
7336 0 $i++;
7337 }
7338 3 while (1) {
7339 7 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 7 7
7340 0 die __FILE__, ": Unmatched [] in regexp\n";
7341 }
7342 7 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 3 4 7
7343 3 my $right = $i;
7344  
7345 # [...]
7346 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
7347 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);
7348 }
7349 else {
7350 3 splice @char, $left, $right-$left+1, Elatin4::charlist_qr(@char[$left+1..$right-1], $modifier);
7351 }
7352  
7353 3 $i = $left;
7354 3 last;
7355 }
7356 }
7357 }
7358  
7359 # open character class [^...]
7360 elsif ($char[$i] eq '[^') {
7361 0 my $left = $i;
7362 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7363 0 $i++;
7364 }
7365 0 while (1) {
7366 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7367 0 die __FILE__, ": Unmatched [] in regexp\n";
7368 }
7369 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7370 0 my $right = $i;
7371  
7372 # [^...]
7373 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
7374 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);
7375 }
7376 else {
7377 0 splice @char, $left, $right-$left+1, Elatin4::charlist_not_qr(@char[$left+1..$right-1], $modifier);
7378 }
7379  
7380 0 $i = $left;
7381 0 last;
7382 }
7383 }
7384 }
7385  
7386 # rewrite character class or escape character
7387 elsif (my $char = character_class($char[$i],$modifier)) {
7388 1 $char[$i] = $char;
7389 }
7390  
7391 # P.794 29.2.161. split
7392 # in Chapter 29: Functions
7393 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
7394  
7395 # P.951 split
7396 # in Chapter 27: Functions
7397 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
7398  
7399 # said "The //m modifier is assumed when you split on the pattern /^/",
7400 # but perl5.008 is not so. Therefore, this software adds //m.
7401 # (and so on)
7402  
7403 # split(m/^/) --> split(m/^/m)
7404 ▶ 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
7405 7 $modifier .= 'm';
7406 }
7407  
7408 # /i modifier
7409 ▶ 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
7410 0 ▶ if (CORE::length(Elatin4::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
7411 0 $char[$i] = '[' . Elatin4::uc($char[$i]) . Elatin4::fc($char[$i]) . ']';
7412 }
7413 else {
7414 0 $char[$i] = '(?:' . Elatin4::uc($char[$i]) . '|' . Elatin4::fc($char[$i]) . ')';
7415 }
7416 }
7417  
7418 # \u \l \U \L \F \Q \E
7419 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
7420 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
7421 0 $char[$i] = '\\' . $char[$i];
7422 }
7423 }
7424 elsif ($char[$i] eq '\u') {
7425 0 $char[$i] = '@{[Elatin4::ucfirst qq<';
7426 0 $left_e++;
7427 }
7428 elsif ($char[$i] eq '\l') {
7429 0 $char[$i] = '@{[Elatin4::lcfirst qq<';
7430 0 $left_e++;
7431 }
7432 elsif ($char[$i] eq '\U') {
7433 0 $char[$i] = '@{[Elatin4::uc qq<';
7434 0 $left_e++;
7435 }
7436 elsif ($char[$i] eq '\L') {
7437 0 $char[$i] = '@{[Elatin4::lc qq<';
7438 0 $left_e++;
7439 }
7440 elsif ($char[$i] eq '\F') {
7441 0 $char[$i] = '@{[Elatin4::fc qq<';
7442 0 $left_e++;
7443 }
7444 elsif ($char[$i] eq '\Q') {
7445 0 $char[$i] = '@{[CORE::quotemeta qq<';
7446 0 $left_e++;
7447 }
7448 elsif ($char[$i] eq '\E') {
7449 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
7450 0 $char[$i] = '>]}';
7451 0 $right_e++;
7452 }
7453 else {
7454 0 $char[$i] = '';
7455 }
7456 }
7457 elsif ($char[$i] eq '\Q') {
7458 0 while (1) {
7459 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7460 0 last;
7461 }
7462 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
7463 0 last;
7464 }
7465 }
7466 }
7467 elsif ($char[$i] eq '\E') {
7468 }
7469  
7470 # $0 --> $0
7471 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
7472 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7473 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
7474 }
7475 }
7476 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
7477 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7478 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
7479 }
7480 }
7481  
7482 # $$ --> $$
7483 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
7484 }
7485  
7486 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
7487 # $1, $2, $3 --> $1, $2, $3 otherwise
7488 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
7489 0 $char[$i] = e_capture($1);
7490 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7491 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
7492 }
7493 }
7494 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
7495 0 $char[$i] = e_capture($1);
7496 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7497 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
7498 }
7499 }
7500  
7501 # $$foo[ ... ] --> $ $foo->[ ... ]
7502 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
7503 0 $char[$i] = e_capture($1.'->'.$2);
7504 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7505 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
7506 }
7507 }
7508  
7509 # $$foo{ ... } --> $ $foo->{ ... }
7510 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
7511 0 $char[$i] = e_capture($1.'->'.$2);
7512 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7513 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
7514 }
7515 }
7516  
7517 # $$foo
7518 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
7519 0 $char[$i] = e_capture($1);
7520 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7521 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
7522 }
7523 }
7524  
7525 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin4::PREMATCH()
7526 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
7527 12 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 12 12
7528 0 $char[$i] = '@{[Elatin4::ignorecase(Elatin4::PREMATCH())]}';
7529 }
7530 else {
7531 12 $char[$i] = '@{[Elatin4::PREMATCH()]}';
7532 }
7533 }
7534  
7535 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin4::MATCH()
7536 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
7537 12 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 12 12
7538 0 $char[$i] = '@{[Elatin4::ignorecase(Elatin4::MATCH())]}';
7539 }
7540 else {
7541 12 $char[$i] = '@{[Elatin4::MATCH()]}';
7542 }
7543 }
7544  
7545 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin4::POSTMATCH()
7546 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
7547 9 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 9 9
7548 0 $char[$i] = '@{[Elatin4::ignorecase(Elatin4::POSTMATCH())]}';
7549 }
7550 else {
7551 9 $char[$i] = '@{[Elatin4::POSTMATCH()]}';
7552 }
7553 }
7554  
7555 # ${ foo }
7556 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
7557 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7558 0 $char[$i] = '@{[Elatin4::ignorecase(' . $1 . ')]}';
7559 }
7560 }
7561  
7562 # ${ ... }
7563 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
7564 0 $char[$i] = e_capture($1);
7565 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7566 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
7567 }
7568 }
7569  
7570 # $scalar or @array
7571 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
7572 3 $char[$i] = e_string($char[$i]);
7573 3 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 3 3
7574 0 $char[$i] = '@{[Elatin4::ignorecase(' . $char[$i] . ')]}';
7575 }
7576 }
7577  
7578 # quote character before ? + * {
7579 ▶ 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
7580 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
7581 }
7582 else {
7583 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
7584 }
7585 }
7586 }
7587  
7588 # make regexp string
7589 74 $modifier =~ tr/i//d;
7590 74 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 74 74
7591 0 return join '', 'Elatin4::split', $ope, $delimiter, @char, '>]}' x ($left_e - $right_e), $end_delimiter, $modifier;
7592 }
7593 74 return join '', 'Elatin4::split', $ope, $delimiter, @char, $end_delimiter, $modifier;
7594 }
7595  
7596 #
7597 # escape regexp of split qr''
7598 #
7599 0 ▶sub e_split_q {
Subroutine e_split_q: not called CC=26 SCAR=65.5
Pod undocumented
7600 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
7601 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
7602  
7603 0 $modifier =~ tr/p//d;
7604 0 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 0 0
7605 0 my $line = 0;
7606 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7607 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
7608 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
7609 0 last;
7610 }
7611 }
7612 0 die qq{Unsupported modifier "$1" used at line $line.\n};
7613 }
7614  
7615 0 $slash = 'div';
7616  
7617 # /b /B modifier
7618 0 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) 0 0 0
7619 0 return join '', 'split', $ope, $delimiter, $string, $end_delimiter, $modifier;
7620 }
7621  
7622 0 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 0 0
7623  
7624 # split regexp
7625 0 my @char = $string =~ /\G((?>
7626 [^\\\[] |
7627 [\x00-\xFF] |
7628 \[\^ |
7629 \[\: (?>[a-z]+) \:\] |
7630 \[\:\^ (?>[a-z]+) \:\] |
7631 \\ (?:$q_char) |
7632 (?:$q_char)
7633 ))/oxmsg;
7634  
7635 # unescape character
7636 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
7637 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
7638 }
7639  
7640 # open character class [...]
7641 elsif ($char[$i] eq '[') {
7642 0 my $left = $i;
7643 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7644 0 $i++;
7645 }
7646 0 while (1) {
7647 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7648 0 die __FILE__, ": Unmatched [] in regexp\n";
7649 }
7650 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7651 0 my $right = $i;
7652  
7653 # [...]
7654 0 splice @char, $left, $right-$left+1, Elatin4::charlist_qr(@char[$left+1..$right-1], $modifier);
7655  
7656 0 $i = $left;
7657 0 last;
7658 }
7659 }
7660 }
7661  
7662 # open character class [^...]
7663 elsif ($char[$i] eq '[^') {
7664 0 my $left = $i;
7665 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7666 0 $i++;
7667 }
7668 0 while (1) {
7669 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7670 0 die __FILE__, ": Unmatched [] in regexp\n";
7671 }
7672 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7673 0 my $right = $i;
7674  
7675 # [^...]
7676 0 splice @char, $left, $right-$left+1, Elatin4::charlist_not_qr(@char[$left+1..$right-1], $modifier);
7677  
7678 0 $i = $left;
7679 0 last;
7680 }
7681 }
7682 }
7683  
7684 # rewrite character class or escape character
7685 elsif (my $char = character_class($char[$i],$modifier)) {
7686 0 $char[$i] = $char;
7687 }
7688  
7689 # split(m/^/) --> split(m/^/m)
7690 ▶ 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
7691 0 $modifier .= 'm';
7692 }
7693  
7694 # /i modifier
7695 ▶ 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
7696 0 ▶ if (CORE::length(Elatin4::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
7697 0 $char[$i] = '[' . Elatin4::uc($char[$i]) . Elatin4::fc($char[$i]) . ']';
7698 }
7699 else {
7700 0 $char[$i] = '(?:' . Elatin4::uc($char[$i]) . '|' . Elatin4::fc($char[$i]) . ')';
7701 }
7702 }
7703  
7704 # quote character before ? + * {
7705 ▶ 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
7706 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
7707 }
7708 else {
7709 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
7710 }
7711 }
7712 }
7713  
7714 0 $modifier =~ tr/i//d;
7715 0 return join '', 'Elatin4::split', $ope, $delimiter, @char, $end_delimiter, $modifier;
7716 }
7717  
7718 #
7719 # instead of Carp::carp
7720 #
7721 0 ▶sub carp {
Subroutine carp: not called CC=1 SCAR=6.9
Pod undocumented
7722 0 my($package,$filename,$line) = caller(1);
7723 0 print STDERR "@_ at $filename line $line.\n";
7724 }
7725  
7726 #
7727 # instead of Carp::croak
7728 #
7729 0 ▶sub croak {
Subroutine croak: not called CC=1 SCAR=6.9
Pod undocumented
7730 0 my($package,$filename,$line) = caller(1);
7731 0 print STDERR "@_ at $filename line $line.\n";
7732 0 die "\n";
7733 }
7734  
7735 #
7736 # instead of Carp::cluck
7737 #
7738 0 ▶sub cluck {
Subroutine cluck: not called CC=2 SCAR=17.9
Pod undocumented
7739 0 my $i = 0;
7740 0 my @cluck = ();
7741 0 ▶ while (my($package,$filename,$line,$subroutine) = caller($i)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7742 0 push @cluck, "[$i] $filename($line) $package::$subroutine\n";
7743 0 $i++;
7744 }
7745 0 print STDERR CORE::reverse @cluck;
7746 0 print STDERR "\n";
7747 0 print STDERR @_;
7748 }
7749  
7750 #
7751 # instead of Carp::confess
7752 #
7753 0 ▶sub confess {
Subroutine confess: not called CC=2 SCAR=17.9
Pod undocumented
7754 0 my $i = 0;
7755 0 my @confess = ();
7756 0 ▶ while (my($package,$filename,$line,$subroutine) = caller($i)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7757 0 push @confess, "[$i] $filename($line) $package::$subroutine\n";
7758 0 $i++;
7759 }
7760 0 print STDERR CORE::reverse @confess;
7761 0 print STDERR "\n";
7762 0 print STDERR @_;
7763 0 die "\n";
7764 }
7765  
7766 422 1;
7767  
7768 __END__
↑ Summary blib/lib/Latin4.pm »