Elatin6.pm

filter: Statementstmt 43.6% 1312 / 3009 Branchbran 40.7% 1063 / 2608 Conditioncond 31.0% 115 / 370 MC/DCmcdc 15.9% 35 / 220 Subroutinesub 68.9% 111 / 161 Podpod 4.6% 3 / 64 totaltotal 41.0% 2639 / 6432 CC 1475 SCAR 97.8
CC
1475
Cov
42%
escape_token
55669.4
e_s1
3320.4
e_split
2070.1
CRAP 17630.0
↑ Summary Latin6.pm »
1 package Elatin6;
2 425 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 425 ▶BEGIN { $INC{'warnings.pm'} = '' if $] < 5.006 } use warnings;
Subroutine BEGIN: called CC=2 SCAR=7.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
if $] < "5.006" 0 424 424
4 ######################################################################
5 #
6 # Elatin6 - Run-time routines for Latin6.pm
7 #
8 # http://search.cpan.org/dist/Char-Latin6/
9 #
10 # Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2018, 2019 INABA Hitoshi <ina@cpan.org>
11 ######################################################################
12  
13 425 ▶use 5.00503; # Galapagos Consensus 1998 for primetools
Subroutine BEGIN: called CC=1 SCAR=0.0
14 # use 5.008001; # Lancaster Consensus 2013 for toolchains
15  
16 # 12.3. Delaying use Until Runtime
17 # in Chapter 12. Packages, Libraries, and Modules
18 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
19 # (and so on)
20  
21 # Version numbers should be boring
22 # http://www.dagolden.com/index.php/369/version-numbers-should-be-boring/
23 # For the impatient, the disinterested or those who just want to follow
24 # a recipe, my advice for all modules is this:
25 # our $VERSION = "0.001"; # or "0.001_001" for a dev release
26 # $VERSION = eval $VERSION; # No!! because '1.10' makes '1.1'
27  
28 425 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
29 424 $VERSION = '1.22';
30 424 $VERSION = $VERSION;
31  
32 424 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=7.0
33 425 ▶ if ($^X =~ / jperl /oxmsi) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^X =~ / jperl /imosx) 0 424 424
34 1 die __FILE__, ": needs perl(not jperl) 5.00503 or later. (\$^X==$^X)\n";
35 }
36 425 if (CORE::ord('A') == 193) {
37 die __FILE__, ": is not US-ASCII script (may be EBCDIC or EBCDIK script).\n";
38 }
39 424 if (CORE::ord('A') != 0x41) {
40 die __FILE__, ": is not US-ASCII script (must be US-ASCII script).\n";
41 }
42 }
43  
44 424 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=9.5
45  
46 # instead of utf8.pm
47 424 ▶ CORE::eval q{
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
48 no warnings qw(redefine);
49 *utf8::upgrade = sub { CORE::length $_[0] };
50 *utf8::downgrade = sub { 1 };
51 *utf8::encode = sub { };
52 *utf8::decode = sub { 1 };
53 *utf8::is_utf8 = sub { };
54 *utf8::valid = sub { 1 };
55 };
56 424 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 424 424
57 0 ▶ *utf8::upgrade = sub { CORE::length $_[0] };
Subroutine __ANON__: not called CC=1 SCAR=6.9
58 0 ▶ *utf8::downgrade = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
59 0 ▶ *utf8::encode = sub { };
Subroutine __ANON__: not called CC=1 SCAR=6.9
60 0 ▶ *utf8::decode = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
61 0 ▶ *utf8::is_utf8 = sub { };
Subroutine __ANON__: not called CC=1 SCAR=6.9
62 0 ▶ *utf8::valid = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
63 }
64 }
65  
66 # instead of Symbol.pm
67 BEGIN {
68 0 ▶ sub gensym () {
Subroutine gensym: not called CC=2 SCAR=17.9
Pod undocumented
69 0 ▶ if ($] < 5.006) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] < 5.006) { } 0 0 0
70 0 return \do { local *_ };
71 }
72 else {
73 0 return undef;
74 }
75 }
76  
77 20 ▶ sub qualify ($$) {
Subroutine qualify: called CC=8 SCAR=28.9
Pod undocumented
78 20 my($name) = @_;
79  
80 20 ▶ if (ref $name) {
Branch: 7 branches
BranchTrueFalseTotal
if (ref $name) { } 5 15 20
elsif (&Elatin6::index($name, '::') >= 0) { } 0 15 15
elsif (&Elatin6::index($name, q[']) >= 0) { } 0 15 15
elsif ($name =~ /\A \^ [ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]+ \z/x) { } 0 15 15
elsif ($name =~ /\A (?: ARGV | ARGVOUT | ENV | INC | SIG | STDERR | STDIN | STDOUT ) \z/x) { } 0 15 15
elsif ($name =~ /\A [^ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz] \z/x) { } 0 15 15
elsif (defined $_[1]) { } 15 0 15
81 5 return $name;
82 }
83 elsif (Elatin6::index($name,'::') >= 0) {
84 0 return $name;
85 }
86 elsif (Elatin6::index($name,"'") >= 0) {
87 0 return $name;
88 }
89  
90 # special character, "^xyz"
91 elsif ($name =~ /\A \^ [ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]+ \z/x) {
92  
93 # RGS 2001-11-05 : translate leading ^X to control-char
94 0 $name =~ s{\A \^ ([ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]) }{'qq(\c'.$1.')'}xee;
95 0 return 'main::' . $name;
96 }
97  
98 # Global names
99 elsif ($name =~ /\A (?: ARGV | ARGVOUT | ENV | INC | SIG | STDERR | STDIN | STDOUT ) \z/x) {
100 0 return 'main::' . $name;
101 }
102  
103 # or other
104 elsif ($name =~ /\A [^ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz] \z/x) {
105 0 return 'main::' . $name;
106 }
107  
108 elsif (defined $_[1]) {
109 15 return $_[1] . '::' . $name;
110 }
111 else {
112 0 return (caller)[0] . '::' . $name;
113 }
114 }
115  
116 20 ▶ sub qualify_to_ref ($;$) {
Subroutine qualify_to_ref: called CC=2 SCAR=7.2
Pod undocumented
117 20 ▶ if (defined $_[1]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[1]) { } 20 0 20
118 424 ▶ no strict qw(refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
119 20 return \*{ qualify $_[0], $_[1] };
120 }
121 else {
122 424 ▶ no strict qw(refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: not called CC=1 SCAR=0.0
123 0 return \*{ qualify $_[0], (caller)[0] };
124 }
125 }
126 }
127  
128 # P.714 29.2.39. flock
129 # in Chapter 29: Functions
130 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
131  
132 # P.863 flock
133 # in Chapter 27: Functions
134 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
135  
136 sub LOCK_SH() {1}
137 sub LOCK_EX() {2}
138 sub LOCK_UN() {8}
139 sub LOCK_NB() {4}
140  
141 # instead of Carp.pm
142 sub carp;
143 sub croak;
144 sub cluck;
145 sub confess;
146  
147 # 6.18. Matching Multiple-Byte Characters
148 # in Chapter 6. Pattern Matching
149 # of ISBN 978-1-56592-243-3 Perl Perl Cookbook.
150 # (and so on)
151  
152 # regexp of character
153 424 my $your_char = q{[\x00-\xFF]};
154 424 ▶use vars qw($qq_char); $qq_char = qr/\\c[\x40-\x5F]|\\?(?:$your_char)/oxms;
Subroutine BEGIN: called CC=1 SCAR=0.0
155 424 ▶use vars qw($q_char); $q_char = qr/$your_char/oxms;
Subroutine BEGIN: called CC=1 SCAR=0.0
156  
157 #
158 # Latin-6 character range per length
159 #
160 424 my %range_tr = ();
161  
162 #
163 # Latin-6 case conversion
164 #
165 424 my %lc = ();
166 424 @lc{qw(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)} =
167 qw(a b c d e f g h i j k l m n o p q r s t u v w x y z);
168 424 my %uc = ();
169 424 @uc{qw(a b c d e f g h i j k l m n o p q r s t u v w x y z)} =
170 qw(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z);
171 424 my %fc = ();
172 424 @fc{qw(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)} =
173 qw(a b c d e f g h i j k l m n o p q r s t u v w x y z);
174  
175 424 ▶if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { __PACKAGE__ =~ / \b Elatin6 \z/mosx }) { } 424 0 424
176 }
177  
178 elsif (__PACKAGE__ =~ / \b Elatin6 \z/oxms) {
179 424 %range_tr = (
180 1 => [ [0x00..0xFF],
181 ],
182 );
183  
184 424 %lc = (%lc,
185 "\xA1" => "\xB1", # LATIN LETTER A WITH OGONEK
186 "\xA2" => "\xB2", # LATIN LETTER E WITH MACRON
187 "\xA3" => "\xB3", # LATIN LETTER G WITH CEDILLA
188 "\xA4" => "\xB4", # LATIN LETTER I WITH MACRON
189 "\xA5" => "\xB5", # LATIN LETTER I WITH TILDE
190 "\xA6" => "\xB6", # LATIN LETTER K WITH CEDILLA
191 "\xA8" => "\xB8", # LATIN LETTER L WITH CEDILLA
192 "\xA9" => "\xB9", # LATIN LETTER D WITH STROKE
193 "\xAA" => "\xBA", # LATIN LETTER S WITH CARON
194 "\xAB" => "\xBB", # LATIN LETTER T WITH STROKE
195 "\xAC" => "\xBC", # LATIN LETTER Z WITH CARON
196 "\xAE" => "\xBE", # LATIN LETTER U WITH MACRON
197 "\xAF" => "\xBF", # LATIN LETTER ENG
198 "\xC0" => "\xE0", # LATIN LETTER A WITH MACRON
199 "\xC1" => "\xE1", # LATIN LETTER A WITH ACUTE
200 "\xC2" => "\xE2", # LATIN LETTER A WITH CIRCUMFLEX
201 "\xC3" => "\xE3", # LATIN LETTER A WITH TILDE
202 "\xC4" => "\xE4", # LATIN LETTER A WITH DIAERESIS
203 "\xC5" => "\xE5", # LATIN LETTER A WITH RING ABOVE
204 "\xC6" => "\xE6", # LATIN LETTER AE
205 "\xC7" => "\xE7", # LATIN LETTER I WITH OGONEK
206 "\xC8" => "\xE8", # LATIN LETTER C WITH CARON
207 "\xC9" => "\xE9", # LATIN LETTER E WITH ACUTE
208 "\xCA" => "\xEA", # LATIN LETTER E WITH OGONEK
209 "\xCB" => "\xEB", # LATIN LETTER E WITH DIAERESIS
210 "\xCC" => "\xEC", # LATIN LETTER E WITH DOT ABOVE
211 "\xCD" => "\xED", # LATIN LETTER I WITH ACUTE
212 "\xCE" => "\xEE", # LATIN LETTER I WITH CIRCUMFLEX
213 "\xCF" => "\xEF", # LATIN LETTER I WITH DIAERESIS
214 "\xD0" => "\xF0", # LATIN LETTER ETH (Icelandic)
215 "\xD1" => "\xF1", # LATIN LETTER N WITH CEDILLA
216 "\xD2" => "\xF2", # LATIN LETTER O WITH MACRON
217 "\xD3" => "\xF3", # LATIN LETTER O WITH ACUTE
218 "\xD4" => "\xF4", # LATIN LETTER O WITH CIRCUMFLEX
219 "\xD5" => "\xF5", # LATIN LETTER O WITH TILDE
220 "\xD6" => "\xF6", # LATIN LETTER O WITH DIAERESIS
221 "\xD7" => "\xF7", # LATIN LETTER U WITH TILDE
222 "\xD8" => "\xF8", # LATIN LETTER O WITH STROKE
223 "\xD9" => "\xF9", # LATIN LETTER U WITH OGONEK
224 "\xDA" => "\xFA", # LATIN LETTER U WITH ACUTE
225 "\xDB" => "\xFB", # LATIN LETTER U WITH CIRCUMFLEX
226 "\xDC" => "\xFC", # LATIN LETTER U WITH DIAERESIS
227 "\xDD" => "\xFD", # LATIN LETTER Y WITH ACUTE
228 "\xDE" => "\xFE", # LATIN LETTER THORN (Icelandic)
229 );
230  
231 424 %uc = (%uc,
232 "\xB1" => "\xA1", # LATIN LETTER A WITH OGONEK
233 "\xB2" => "\xA2", # LATIN LETTER E WITH MACRON
234 "\xB3" => "\xA3", # LATIN LETTER G WITH CEDILLA
235 "\xB4" => "\xA4", # LATIN LETTER I WITH MACRON
236 "\xB5" => "\xA5", # LATIN LETTER I WITH TILDE
237 "\xB6" => "\xA6", # LATIN LETTER K WITH CEDILLA
238 "\xB8" => "\xA8", # LATIN LETTER L WITH CEDILLA
239 "\xB9" => "\xA9", # LATIN LETTER D WITH STROKE
240 "\xBA" => "\xAA", # LATIN LETTER S WITH CARON
241 "\xBB" => "\xAB", # LATIN LETTER T WITH STROKE
242 "\xBC" => "\xAC", # LATIN LETTER Z WITH CARON
243 "\xBE" => "\xAE", # LATIN LETTER U WITH MACRON
244 "\xBF" => "\xAF", # LATIN LETTER ENG
245 "\xE0" => "\xC0", # LATIN LETTER A WITH MACRON
246 "\xE1" => "\xC1", # LATIN LETTER A WITH ACUTE
247 "\xE2" => "\xC2", # LATIN LETTER A WITH CIRCUMFLEX
248 "\xE3" => "\xC3", # LATIN LETTER A WITH TILDE
249 "\xE4" => "\xC4", # LATIN LETTER A WITH DIAERESIS
250 "\xE5" => "\xC5", # LATIN LETTER A WITH RING ABOVE
251 "\xE6" => "\xC6", # LATIN LETTER AE
252 "\xE7" => "\xC7", # LATIN LETTER I WITH OGONEK
253 "\xE8" => "\xC8", # LATIN LETTER C WITH CARON
254 "\xE9" => "\xC9", # LATIN LETTER E WITH ACUTE
255 "\xEA" => "\xCA", # LATIN LETTER E WITH OGONEK
256 "\xEB" => "\xCB", # LATIN LETTER E WITH DIAERESIS
257 "\xEC" => "\xCC", # LATIN LETTER E WITH DOT ABOVE
258 "\xED" => "\xCD", # LATIN LETTER I WITH ACUTE
259 "\xEE" => "\xCE", # LATIN LETTER I WITH CIRCUMFLEX
260 "\xEF" => "\xCF", # LATIN LETTER I WITH DIAERESIS
261 "\xF0" => "\xD0", # LATIN LETTER ETH (Icelandic)
262 "\xF1" => "\xD1", # LATIN LETTER N WITH CEDILLA
263 "\xF2" => "\xD2", # LATIN LETTER O WITH MACRON
264 "\xF3" => "\xD3", # LATIN LETTER O WITH ACUTE
265 "\xF4" => "\xD4", # LATIN LETTER O WITH CIRCUMFLEX
266 "\xF5" => "\xD5", # LATIN LETTER O WITH TILDE
267 "\xF6" => "\xD6", # LATIN LETTER O WITH DIAERESIS
268 "\xF7" => "\xD7", # LATIN LETTER U WITH TILDE
269 "\xF8" => "\xD8", # LATIN LETTER O WITH STROKE
270 "\xF9" => "\xD9", # LATIN LETTER U WITH OGONEK
271 "\xFA" => "\xDA", # LATIN LETTER U WITH ACUTE
272 "\xFB" => "\xDB", # LATIN LETTER U WITH CIRCUMFLEX
273 "\xFC" => "\xDC", # LATIN LETTER U WITH DIAERESIS
274 "\xFD" => "\xDD", # LATIN LETTER Y WITH ACUTE
275 "\xFE" => "\xDE", # LATIN LETTER THORN (Icelandic)
276 );
277  
278 424 %fc = (%fc,
279 "\xA1" => "\xB1", # LATIN CAPITAL LETTER A WITH OGONEK --> LATIN SMALL LETTER A WITH OGONEK
280 "\xA2" => "\xB2", # LATIN CAPITAL LETTER E WITH MACRON --> LATIN SMALL LETTER E WITH MACRON
281 "\xA3" => "\xB3", # LATIN CAPITAL LETTER G WITH CEDILLA --> LATIN SMALL LETTER G WITH CEDILLA
282 "\xA4" => "\xB4", # LATIN CAPITAL LETTER I WITH MACRON --> LATIN SMALL LETTER I WITH MACRON
283 "\xA5" => "\xB5", # LATIN CAPITAL LETTER I WITH TILDE --> LATIN SMALL LETTER I WITH TILDE
284 "\xA6" => "\xB6", # LATIN CAPITAL LETTER K WITH CEDILLA --> LATIN SMALL LETTER K WITH CEDILLA
285 "\xA8" => "\xB8", # LATIN CAPITAL LETTER L WITH CEDILLA --> LATIN SMALL LETTER L WITH CEDILLA
286 "\xA9" => "\xB9", # LATIN CAPITAL LETTER D WITH STROKE --> LATIN SMALL LETTER D WITH STROKE
287 "\xAA" => "\xBA", # LATIN CAPITAL LETTER S WITH CARON --> LATIN SMALL LETTER S WITH CARON
288 "\xAB" => "\xBB", # LATIN CAPITAL LETTER T WITH STROKE --> LATIN SMALL LETTER T WITH STROKE
289 "\xAC" => "\xBC", # LATIN CAPITAL LETTER Z WITH CARON --> LATIN SMALL LETTER Z WITH CARON
290 "\xAE" => "\xBE", # LATIN CAPITAL LETTER U WITH MACRON --> LATIN SMALL LETTER U WITH MACRON
291 "\xAF" => "\xBF", # LATIN CAPITAL LETTER ENG --> LATIN SMALL LETTER ENG
292 "\xC0" => "\xE0", # LATIN CAPITAL LETTER A WITH MACRON --> LATIN SMALL LETTER A WITH MACRON
293 "\xC1" => "\xE1", # LATIN CAPITAL LETTER A WITH ACUTE --> LATIN SMALL LETTER A WITH ACUTE
294 "\xC2" => "\xE2", # LATIN CAPITAL LETTER A WITH CIRCUMFLEX --> LATIN SMALL LETTER A WITH CIRCUMFLEX
295 "\xC3" => "\xE3", # LATIN CAPITAL LETTER A WITH TILDE --> LATIN SMALL LETTER A WITH TILDE
296 "\xC4" => "\xE4", # LATIN CAPITAL LETTER A WITH DIAERESIS --> LATIN SMALL LETTER A WITH DIAERESIS
297 "\xC5" => "\xE5", # LATIN CAPITAL LETTER A WITH RING ABOVE --> LATIN SMALL LETTER A WITH RING ABOVE
298 "\xC6" => "\xE6", # LATIN CAPITAL LETTER AE --> LATIN SMALL LETTER AE
299 "\xC7" => "\xE7", # LATIN CAPITAL LETTER I WITH OGONEK --> LATIN SMALL LETTER I WITH OGONEK
300 "\xC8" => "\xE8", # LATIN CAPITAL LETTER C WITH CARON --> LATIN SMALL LETTER C WITH CARON
301 "\xC9" => "\xE9", # LATIN CAPITAL LETTER E WITH ACUTE --> LATIN SMALL LETTER E WITH ACUTE
302 "\xCA" => "\xEA", # LATIN CAPITAL LETTER E WITH OGONEK --> LATIN SMALL LETTER E WITH OGONEK
303 "\xCB" => "\xEB", # LATIN CAPITAL LETTER E WITH DIAERESIS --> LATIN SMALL LETTER E WITH DIAERESIS
304 "\xCC" => "\xEC", # LATIN CAPITAL LETTER E WITH DOT ABOVE --> LATIN SMALL LETTER E WITH DOT ABOVE
305 "\xCD" => "\xED", # LATIN CAPITAL LETTER I WITH ACUTE --> LATIN SMALL LETTER I WITH ACUTE
306 "\xCE" => "\xEE", # LATIN CAPITAL LETTER I WITH CIRCUMFLEX --> LATIN SMALL LETTER I WITH CIRCUMFLEX
307 "\xCF" => "\xEF", # LATIN CAPITAL LETTER I WITH DIAERESIS --> LATIN SMALL LETTER I WITH DIAERESIS
308 "\xD0" => "\xF0", # LATIN CAPITAL LETTER ETH --> LATIN SMALL LETTER ETH
309 "\xD1" => "\xF1", # LATIN CAPITAL LETTER N WITH CEDILLA --> LATIN SMALL LETTER N WITH CEDILLA
310 "\xD2" => "\xF2", # LATIN CAPITAL LETTER O WITH MACRON --> LATIN SMALL LETTER O WITH MACRON
311 "\xD3" => "\xF3", # LATIN CAPITAL LETTER O WITH ACUTE --> LATIN SMALL LETTER O WITH ACUTE
312 "\xD4" => "\xF4", # LATIN CAPITAL LETTER O WITH CIRCUMFLEX --> LATIN SMALL LETTER O WITH CIRCUMFLEX
313 "\xD5" => "\xF5", # LATIN CAPITAL LETTER O WITH TILDE --> LATIN SMALL LETTER O WITH TILDE
314 "\xD6" => "\xF6", # LATIN CAPITAL LETTER O WITH DIAERESIS --> LATIN SMALL LETTER O WITH DIAERESIS
315 "\xD7" => "\xF7", # LATIN CAPITAL LETTER U WITH TILDE --> LATIN SMALL LETTER U WITH TILDE
316 "\xD8" => "\xF8", # LATIN CAPITAL LETTER O WITH STROKE --> LATIN SMALL LETTER O WITH STROKE
317 "\xD9" => "\xF9", # LATIN CAPITAL LETTER U WITH OGONEK --> LATIN SMALL LETTER U WITH OGONEK
318 "\xDA" => "\xFA", # LATIN CAPITAL LETTER U WITH ACUTE --> LATIN SMALL LETTER U WITH ACUTE
319 "\xDB" => "\xFB", # LATIN CAPITAL LETTER U WITH CIRCUMFLEX --> LATIN SMALL LETTER U WITH CIRCUMFLEX
320 "\xDC" => "\xFC", # LATIN CAPITAL LETTER U WITH DIAERESIS --> LATIN SMALL LETTER U WITH DIAERESIS
321 "\xDD" => "\xFD", # LATIN CAPITAL LETTER Y WITH ACUTE --> LATIN SMALL LETTER Y WITH ACUTE
322 "\xDE" => "\xFE", # LATIN CAPITAL LETTER THORN --> LATIN SMALL LETTER THORN
323 "\xDF" => "\x73\x73", # LATIN SMALL LETTER SHARP S --> LATIN SMALL LETTER S, LATIN SMALL LETTER S
324 );
325 }
326  
327 else {
328 0 croak "Don't know my package name '@{[__PACKAGE__]}'";
329 }
330  
331 #
332 # @ARGV wildcard globbing
333 #
334 212 ▶sub import {
Subroutine import: called CC=7 SCAR=28.3
335  
336 212 ▶ if ($^O =~ /\A (?: MSWin32 | NetWare | symbian | dos ) \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O =~ /\A (?: MSWin32 | NetWare | symbian | dos ) \z/mosx) 0 212 212
337 0 my @argv = ();
338 0 for (@ARGV) {
339  
340 # has space
341 0 ▶ if (/\A (?:$q_char)*? [ ] /oxms) {
Branch: 2 branches
BranchTrueFalseTotal
if (/\A (?:$Elatin6::q_char)*? [ ] /mosx) { } 0 0 0
elsif (/\A (?:$Elatin6::q_char)*? [*?] /mosx) { } 0 0 0
342 0 ▶ if (my @glob = Elatin6::glob(qq{"$_"})) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@glob) = &Elatin6::glob(qq["$_"])) { } 0 0 0
343 0 push @argv, @glob;
344 }
345 else {
346 0 push @argv, $_;
347 }
348 }
349  
350 # has wildcard metachar
351 elsif (/\A (?:$q_char)*? [*?] /oxms) {
352 0 ▶ if (my @glob = Elatin6::glob($_)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@glob) = &Elatin6::glob($_)) { } 0 0 0
353 0 push @argv, @glob;
354 }
355 else {
356 0 push @argv, $_;
357 }
358 }
359  
360 # no wildcard globbing
361 else {
362 0 push @argv, $_;
363 }
364 }
365 0 @ARGV = @argv;
366 }
367  
368 212 *Char::ord = \&Latin6::ord;
369 212 *Char::ord_ = \&Latin6::ord_;
370 212 *Char::reverse = \&Latin6::reverse;
371 212 *Char::getc = \&Latin6::getc;
372 212 *Char::length = \&Latin6::length;
373 212 *Char::substr = \&Latin6::substr;
374 212 *Char::index = \&Latin6::index;
375 212 *Char::rindex = \&Latin6::rindex;
376 212 *Char::eval = \&Latin6::eval;
377 212 *Char::escape = \&Latin6::escape;
378 212 *Char::escape_token = \&Latin6::escape_token;
379 212 *Char::escape_script = \&Latin6::escape_script;
380 }
381  
382 # P.230 Care with Prototypes
383 # in Chapter 6: Subroutines
384 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
385 #
386 # If you aren't careful, you can get yourself into trouble with prototypes.
387 # But if you are careful, you can do a lot of neat things with them. This is
388 # all very powerful, of course, and should only be used in moderation to make
389 # the world a better place.
390  
391 # P.332 Care with Prototypes
392 # in Chapter 7: Subroutines
393 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
394 #
395 # If you aren't careful, you can get yourself into trouble with prototypes.
396 # But if you are careful, you can do a lot of neat things with them. This is
397 # all very powerful, of course, and should only be used in moderation to make
398 # the world a better place.
399  
400 #
401 # Prototypes of subroutines
402 #
403 0 ▶sub unimport {}
Subroutine unimport: not called CC=1 SCAR=0.0
404 sub Elatin6::split(;$$$);
405 sub Elatin6::tr($$$$;$);
406 sub Elatin6::chop(@);
407 sub Elatin6::index($$;$);
408 sub Elatin6::rindex($$;$);
409 sub Elatin6::lcfirst(@);
410 sub Elatin6::lcfirst_();
411 sub Elatin6::lc(@);
412 sub Elatin6::lc_();
413 sub Elatin6::ucfirst(@);
414 sub Elatin6::ucfirst_();
415 sub Elatin6::uc(@);
416 sub Elatin6::uc_();
417 sub Elatin6::fc(@);
418 sub Elatin6::fc_();
419 sub Elatin6::ignorecase;
420 sub Elatin6::classic_character_class;
421 sub Elatin6::capture;
422 sub Elatin6::chr(;$);
423 sub Elatin6::chr_();
424 sub Elatin6::glob($);
425 sub Elatin6::glob_();
426  
427 sub Latin6::ord(;$);
428 sub Latin6::ord_();
429 sub Latin6::reverse(@);
430 sub Latin6::getc(;*@);
431 sub Latin6::length(;$);
432 sub Latin6::substr($$;$$);
433 sub Latin6::index($$;$);
434 sub Latin6::rindex($$;$);
435 sub Latin6::escape(;$);
436  
437 #
438 # Regexp work
439 #
440 424 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
441 $re_a
442 $re_t
443 $re_n
444 $re_r
445 424 );
446  
447 #
448 # Character class
449 #
450 424 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
451 $dot
452 $dot_s
453 $eD
454 $eS
455 $eW
456 $eH
457 $eV
458 $eR
459 $eN
460 $not_alnum
461 $not_alpha
462 $not_ascii
463 $not_blank
464 $not_cntrl
465 $not_digit
466 $not_graph
467 $not_lower
468 $not_lower_i
469 $not_print
470 $not_punct
471 $not_space
472 $not_upper
473 $not_upper_i
474 $not_word
475 $not_xdigit
476 $eb
477 $eB
478 424 );
479  
480 424 ${Elatin6::dot} = qr{(?>[^\x0A])};
481 424 ${Elatin6::dot_s} = qr{(?>[\x00-\xFF])};
482 424 ${Elatin6::eD} = qr{(?>[^0-9])};
483  
484 # Vertical tabs are now whitespace
485 # \s in a regex now matches a vertical tab in all circumstances.
486 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
487 # ${Elatin6::eS} = qr{(?>[^\x09\x0A \x0C\x0D\x20])};
488 # ${Elatin6::eS} = qr{(?>[^\x09\x0A\x0B\x0C\x0D\x20])};
489 424 ${Elatin6::eS} = qr{(?>[^\s])};
490  
491 424 ${Elatin6::eW} = qr{(?>[^0-9A-Z_a-z])};
492 424 ${Elatin6::eH} = qr{(?>[^\x09\x20])};
493 424 ${Elatin6::eV} = qr{(?>[^\x0A\x0B\x0C\x0D])};
494 424 ${Elatin6::eR} = qr{(?>\x0D\x0A|[\x0A\x0D])};
495 424 ${Elatin6::eN} = qr{(?>[^\x0A])};
496 424 ${Elatin6::not_alnum} = qr{(?>[^\x30-\x39\x41-\x5A\x61-\x7A])};
497 424 ${Elatin6::not_alpha} = qr{(?>[^\x41-\x5A\x61-\x7A])};
498 424 ${Elatin6::not_ascii} = qr{(?>[^\x00-\x7F])};
499 424 ${Elatin6::not_blank} = qr{(?>[^\x09\x20])};
500 424 ${Elatin6::not_cntrl} = qr{(?>[^\x00-\x1F\x7F])};
501 424 ${Elatin6::not_digit} = qr{(?>[^\x30-\x39])};
502 424 ${Elatin6::not_graph} = qr{(?>[^\x21-\x7F])};
503 424 ${Elatin6::not_lower} = qr{(?>[^\x61-\x7A])};
504 424 ${Elatin6::not_lower_i} = qr{(?>[^\x41-\x5A\x61-\x7A])}; # Perl 5.16 compatible
505 # ${Elatin6::not_lower_i} = qr{(?>[\x00-\xFF])}; # older Perl compatible
506 424 ${Elatin6::not_print} = qr{(?>[^\x20-\x7F])};
507 424 ${Elatin6::not_punct} = qr{(?>[^\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E])};
508 424 ${Elatin6::not_space} = qr{(?>[^\s\x0B])};
509 424 ${Elatin6::not_upper} = qr{(?>[^\x41-\x5A])};
510 424 ${Elatin6::not_upper_i} = qr{(?>[^\x41-\x5A\x61-\x7A])}; # Perl 5.16 compatible
511 # ${Elatin6::not_upper_i} = qr{(?>[\x00-\xFF])}; # older Perl compatible
512 424 ${Elatin6::not_word} = qr{(?>[^\x30-\x39\x41-\x5A\x5F\x61-\x7A])};
513 424 ${Elatin6::not_xdigit} = qr{(?>[^\x30-\x39\x41-\x46\x61-\x66])};
514 424 ${Elatin6::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))};
515 424 ${Elatin6::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]))};
516  
517 # avoid: Name "Elatin6::foo" used only once: possible typo at here.
518 424 ${Elatin6::dot} = ${Elatin6::dot};
519 424 ${Elatin6::dot_s} = ${Elatin6::dot_s};
520 424 ${Elatin6::eD} = ${Elatin6::eD};
521 424 ${Elatin6::eS} = ${Elatin6::eS};
522 424 ${Elatin6::eW} = ${Elatin6::eW};
523 424 ${Elatin6::eH} = ${Elatin6::eH};
524 424 ${Elatin6::eV} = ${Elatin6::eV};
525 424 ${Elatin6::eR} = ${Elatin6::eR};
526 424 ${Elatin6::eN} = ${Elatin6::eN};
527 424 ${Elatin6::not_alnum} = ${Elatin6::not_alnum};
528 424 ${Elatin6::not_alpha} = ${Elatin6::not_alpha};
529 424 ${Elatin6::not_ascii} = ${Elatin6::not_ascii};
530 424 ${Elatin6::not_blank} = ${Elatin6::not_blank};
531 424 ${Elatin6::not_cntrl} = ${Elatin6::not_cntrl};
532 424 ${Elatin6::not_digit} = ${Elatin6::not_digit};
533 424 ${Elatin6::not_graph} = ${Elatin6::not_graph};
534 424 ${Elatin6::not_lower} = ${Elatin6::not_lower};
535 424 ${Elatin6::not_lower_i} = ${Elatin6::not_lower_i};
536 424 ${Elatin6::not_print} = ${Elatin6::not_print};
537 424 ${Elatin6::not_punct} = ${Elatin6::not_punct};
538 424 ${Elatin6::not_space} = ${Elatin6::not_space};
539 424 ${Elatin6::not_upper} = ${Elatin6::not_upper};
540 424 ${Elatin6::not_upper_i} = ${Elatin6::not_upper_i};
541 424 ${Elatin6::not_word} = ${Elatin6::not_word};
542 424 ${Elatin6::not_xdigit} = ${Elatin6::not_xdigit};
543 424 ${Elatin6::eb} = ${Elatin6::eb};
544 424 ${Elatin6::eB} = ${Elatin6::eB};
545  
546 #
547 # Latin-6 split
548 #
549 72 ▶sub Elatin6::split(;$$$) {
Subroutine split: called CC=34 SCAR=38.5
Pod undocumented
550  
551 # P.794 29.2.161. split
552 # in Chapter 29: Functions
553 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
554  
555 # P.951 split
556 # in Chapter 27: Functions
557 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
558  
559 72 my $pattern = $_[0];
560 72 my $string = $_[1];
561 72 my $limit = $_[2];
562  
563 # if $pattern is also omitted or is the literal space, " "
564 72 ▶ if (not defined $pattern) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $pattern) 2 70 72
565 2 $pattern = ' ';
566 }
567  
568 # if $string is omitted, the function splits the $_ string
569 72 ▶ if (not defined $string) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $string) 6 66 72
570 6 ▶ if (defined $_) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_) { } 0 6 6
571 0 $string = $_;
572 }
573 else {
574 6 $string = '';
575 }
576 }
577  
578 72 my @split = ();
579  
580 # when string is empty
581 72 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 10 62 72
elsif ($pattern eq ' ') { } 2 60 62
582  
583 # resulting list value in list context
584 10 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 5 5 10
585 5 return @split;
586 }
587  
588 # count of substrings in scalar context
589 else {
590 5 ▶ carp "Use of implicit split to \@_ is deprecated" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 5 5
591 5 @_ = @split;
592 5 return scalar @_;
593 }
594 }
595  
596 # split's first argument is more consistently interpreted
597 #
598 # After some changes earlier in v5.17, split's behavior has been simplified:
599 # if the PATTERN argument evaluates to a string containing one space, it is
600 # treated the way that a literal string containing one space once was.
601 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#split's_first_argument_is_more_consistently_interpreted
602  
603 # if $pattern is also omitted or is the literal space, " ", the function splits
604 # on whitespace, /\s+/, after skipping any leading whitespace
605 # (and so on)
606  
607 elsif ($pattern eq ' ') {
608 2 ▶ if (not defined $limit) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $limit) { } 2 0 2
609 2 return CORE::split(' ', $string);
610 }
611 else {
612 0 return CORE::split(' ', $string, $limit);
613 }
614 }
615  
616 # if $limit is negative, it is treated as if an arbitrarily large $limit has been specified
617 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
618  
619 # a pattern capable of matching either the null string or something longer than the
620 # null string will split the value of $string into separate characters wherever it
621 # matches the null string between characters
622 # (and so on)
623  
624 60 ▶ if ('' =~ / \A $pattern \z /xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ('' =~ / \A $pattern \z /msx) { } 2 58 60
625 2 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
626 2 my $limit = scalar(() = $string =~ /($pattern)/oxmsg);
627  
628 # P.1024 Appendix W.10 Multibyte Processing
629 # of ISBN 1-56592-224-7 CJKV Information Processing
630 # (and so on)
631  
632 # the //m modifier is assumed when you split on the pattern /^/
633 # (and so on)
634  
635 2 ▶ eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
Subroutine BEGIN: called CC=1 SCAR=0.0
636 # V
637 2 ▶ while ((--$limit > 0) and ($string =~ s/\A((?:$q_char)+?)$pattern//m)) {
Branch: 1 branch
BranchTrueFalseTotal
if (--$limit > 0 and $string =~ s/\A((?:$Elatin6::q_char)+?)$pattern//m) 9 2 11
Condition100%3/3
--$limit > 0 and $string =~ s/\A((?:$Elatin6::q_char)+?)$pattern//m
!ll&&!rl&&r
119
MC/DC100%2/2
--$limit > 0 and $string =~ s/\A((?:$Elatin6::q_char)+?)$pattern//m
--$limit > 0 $string =~ s/\A((?:$Elatin6::q_char)+?)$pattern//m
Truth table100%3/3
A and B
A= --$limit > 0B= $string =~ s/\A((?:$Elatin6::q_char)+?)$pattern//m
ABresult
0X0
100
111
638  
639 # if the $pattern contains parentheses, then the substring matched by each pair of parentheses
640 # is included in the resulting list, interspersed with the fields that are ordinarily returned
641 # (and so on)
642  
643 9 local $@;
644 9 ▶ eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
645 9 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 9 9 18
646 9 push @split, CORE::eval('$' . $digit);
647 }
648 }
649 }
650  
651 else {
652 58 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
653  
654 58 ▶ eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
655 # V
656 58 ▶ while ($string =~ s/\A((?:$q_char)*?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Elatin6::q_char)*?)$pattern//m) 163 58 221
657 163 local $@;
658 163 ▶ eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
659 163 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 230 163 393
660 230 push @split, CORE::eval('$' . $digit);
661 }
662 }
663 }
664 }
665  
666 elsif ($limit > 0) {
667 0 ▶ if ('' =~ / \A $pattern \z /xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ('' =~ / \A $pattern \z /msx) { } 0 0 0
668 0 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
669 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
670  
671 0 eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
672 # V
673 0 ▶ if ($string =~ s/\A((?:$q_char)+?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Elatin6::q_char)+?)$pattern//m) 0 0 0
674 0 local $@;
675 0 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 0 0 0
676 0 push @split, CORE::eval('$' . $digit);
677 }
678 }
679 }
680 }
681 else {
682 0 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
683 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
684  
685 0 eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
686 # V
687 0 ▶ if ($string =~ s/\A((?:$q_char)*?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Elatin6::q_char)*?)$pattern//m) 0 0 0
688 0 local $@;
689 0 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 0 0 0
690 0 push @split, CORE::eval('$' . $digit);
691 }
692 }
693 }
694 }
695 }
696  
697 60 ▶ if (CORE::length($string) > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $string > 0) 58 2 60
698 58 push @split, $string;
699 }
700  
701 # if $_[2] (NOT "$limit") is omitted or zero, trailing null fields are stripped from the result
702 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
703 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
704 0 pop @split;
705 }
706 }
707  
708 # resulting list value in list context
709 60 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 58 2 60
710 58 return @split;
711 }
712  
713 # count of substrings in scalar context
714 else {
715 2 ▶ carp "Use of implicit split to \@_ is deprecated" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 2 2
716 2 @_ = @split;
717 2 return scalar @_;
718 }
719 }
720  
721 #
722 # get last subexpression offsets
723 #
724 60 ▶sub _last_subexpression_offsets {
Subroutine _last_subexpression_offsets: called CC=3 SCAR=11.0
725 60 my $pattern = $_[0];
726  
727 # remove comment
728 60 $pattern =~ s/\(\?\# .*? \)//oxmsg;
729  
730 60 my $modifier = '';
731 60 ▶ if ($pattern =~ /\(\?\^? ([\-A-Za-z]+) :/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pattern =~ /\(\?\^? ([\-A-Za-z]+) :/mosx) 11 49 60
732 11 $modifier = $1;
733 11 $modifier =~ s/-[A-Za-z]*//;
734 }
735  
736 # with /x modifier
737 60 my @char = ();
738 60 ▶ if ($modifier =~ /x/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /x/mosx) { } 5 55 60
739 5 @char = $pattern =~ /\G((?>
740 [^\\\#\[\(] |
741 \\ $q_char |
742 \# (?>[^\n]*) $ |
743 \[ (?>(?:[^\\\]]|\\\\|\\\]|$q_char)+) \] |
744 \(\? |
745 $q_char
746 ))/oxmsg;
747 }
748  
749 # without /x modifier
750 else {
751 55 @char = $pattern =~ /\G((?>
752 [^\\\[\(] |
753 \\ $q_char |
754 \[ (?>(?:[^\\\]]|\\\\|\\\]|$q_char)+) \] |
755 \(\? |
756 $q_char
757 ))/oxmsg;
758 }
759  
760 60 return scalar grep { $_ eq '(' } @char;
761 }
762  
763 #
764 # Latin-6 transliteration (tr///)
765 #
766 6 ▶sub Elatin6::tr($$$$;$) {
Subroutine tr: called CC=26 SCAR=48.6
Pod undocumented
767  
768 6 my $bind_operator = $_[1];
769 6 my $searchlist = $_[2];
770 6 my $replacementlist = $_[3];
771 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
772  
773 6 ▶ if ($modifier =~ /r/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /r/mosx) 5 1 6
774 5 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) 0 5 5
775 0 croak "Using !~ with tr///r doesn't make sense";
776 }
777 }
778  
779 6 my @char = $_[0] =~ /\G (?>$q_char) /oxmsg;
780 6 my @searchlist = _charlist_tr($searchlist);
781 6 my @replacementlist = _charlist_tr($replacementlist);
782  
783 6 my %tr = ();
784 6 ▶ for (my $i=0; $i <= $#searchlist; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#searchlist) 19 6 25
785 19 ▶ if (not exists $tr{$searchlist[$i]}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $tr{$searchlist[$i]}) 19 0 19
786 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
787 19 $tr{$searchlist[$i]} = $replacementlist[$i];
788 }
789 elsif ($modifier =~ /d/oxms) {
790 0 $tr{$searchlist[$i]} = '';
791 }
792 ▶ 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
793 0 $tr{$searchlist[$i]} = $replacementlist[-1];
794 }
795 else {
796 0 $tr{$searchlist[$i]} = $searchlist[$i];
797 }
798 }
799 }
800  
801 6 my $tr = 0;
802 6 my $replaced = '';
803 6 ▶ if ($modifier =~ /c/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /c/mosx) { } 0 6 6
804 0 ▶ while (defined(my $char = shift @char)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $char = shift @char)) 0 0 0
805 0 ▶ if (not exists $tr{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $tr{$char}) { } 0 0 0
806 0 ▶ if (defined $replacementlist[-1]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $replacementlist[-1]) 0 0 0
807 0 $replaced .= $replacementlist[-1];
808 }
809 0 $tr++;
810 0 ▶ if ($modifier =~ /s/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/mosx) 0 0 0
811 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
812 0 shift @char;
813 0 $tr++;
814 }
815 }
816 }
817 else {
818 0 $replaced .= $char;
819 }
820 }
821 }
822 else {
823 6 ▶ while (defined(my $char = shift @char)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $char = shift @char)) 36 6 42
824 36 ▶ if (exists $tr{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $tr{$char}) { } 19 17 36
825 19 $replaced .= $tr{$char};
826 19 $tr++;
827 19 ▶ if ($modifier =~ /s/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/mosx) 0 19 19
828 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
829 0 shift @char;
830 0 $tr++;
831 }
832 }
833 }
834 else {
835 17 $replaced .= $char;
836 }
837 }
838 }
839  
840 6 ▶ if ($modifier =~ /r/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /r/mosx) { } 5 1 6
841 5 return $replaced;
842 }
843 else {
844 1 $_[0] = $replaced;
845 1 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) { } 0 1 1
846 0 return not $tr;
847 }
848 else {
849 1 return $tr;
850 }
851 }
852 }
853  
854 #
855 # Latin-6 chop
856 #
857 0 ▶sub Elatin6::chop(@) {
Subroutine chop: not called CC=3 SCAR=24.8
Pod undocumented
858  
859 0 my $chop;
860 0 ▶ if (@_ == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 0) { } 0 0 0
861 0 my @char = /\G (?>$q_char) /oxmsg;
862 0 $chop = pop @char;
863 0 $_ = join '', @char;
864 }
865 else {
866 0 for (@_) {
867 0 my @char = /\G (?>$q_char) /oxmsg;
868 0 $chop = pop @char;
869 0 $_ = join '', @char;
870 }
871 }
872 0 return $chop;
873 }
874  
875 #
876 # Latin-6 index by octet
877 #
878 30 ▶sub Elatin6::index($$;$) {
Subroutine index: called CC=6 SCAR=20.8
Pod documented
879  
880 30 my($str,$substr,$position) = @_;
881 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
882 30 my $pos = 0;
883  
884 30 ▶ while ($pos < CORE::length($str)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos < length $str) 130 30 160
885 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
886 0 ▶ if ($pos >= $position) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos >= $position) 0 0 0
887 0 return $pos;
888 }
889 }
890 130 ▶ if (CORE::substr($str,$pos) =~ /\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($str, $pos) =~ /\A ($Elatin6::q_char) /mosx) { } 130 0 130
891 130 $pos += CORE::length($1);
892 }
893 else {
894 0 $pos += 1;
895 }
896 }
897 30 return -1;
898 }
899  
900 #
901 # Latin-6 reverse index
902 #
903 0 ▶sub Elatin6::rindex($$;$) {
Subroutine rindex: not called CC=6 SCAR=37.4
Pod undocumented
904  
905 0 my($str,$substr,$position) = @_;
906 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
907 0 my $pos = 0;
908 0 my $rindex = -1;
909  
910 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
911 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
912 0 $rindex = $pos;
913 }
914 0 ▶ if (CORE::substr($str,$pos) =~ /\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($str, $pos) =~ /\A ($Elatin6::q_char) /mosx) { } 0 0 0
915 0 $pos += CORE::length($1);
916 }
917 else {
918 0 $pos += 1;
919 }
920 }
921 0 return $rindex;
922 }
923  
924 #
925 # Latin-6 lower case first with parameter
926 #
927 0 ▶sub Elatin6::lcfirst(@) {
Subroutine lcfirst: not called CC=4 SCAR=30.0
Pod undocumented
928 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
929 0 my $s = shift @_;
930 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
931 0 return Elatin6::lc(CORE::substr($s,0,1)) . CORE::substr($s,1), @_;
932 }
933 else {
934 0 return Elatin6::lc(CORE::substr($s,0,1)) . CORE::substr($s,1);
935 }
936 }
937 else {
938 0 return Elatin6::lc(CORE::substr($_,0,1)) . CORE::substr($_,1);
939 }
940 }
941  
942 #
943 # Latin-6 lower case first without parameter
944 #
945 0 ▶sub Elatin6::lcfirst_() {
Subroutine lcfirst_: not called CC=1 SCAR=6.9
Pod undocumented
946 0 return Elatin6::lc(CORE::substr($_,0,1)) . CORE::substr($_,1);
947 }
948  
949 #
950 # Latin-6 lower case with parameter
951 #
952 71 ▶sub Elatin6::lc(@) {
Subroutine lc: called CC=6 SCAR=24.2
Pod undocumented
953 71 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 71 0 71
954 71 my $s = shift @_;
955 71 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 71 71
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
7100
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
956 0 ▶ return join('', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 0 0 0
957 }
958 else {
959 71 ▶ return join('', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 73 0 73
960 }
961 }
962 else {
963 0 return Elatin6::lc_();
964 }
965 }
966  
967 #
968 # Latin-6 lower case without parameter
969 #
970 0 ▶sub Elatin6::lc_() {
Subroutine lc_: not called CC=2 SCAR=17.9
Pod undocumented
971 0 my $s = $_;
972 0 ▶ return join '', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 0 0 0
973 }
974  
975 #
976 # Latin-6 upper case first with parameter
977 #
978 0 ▶sub Elatin6::ucfirst(@) {
Subroutine ucfirst: not called CC=4 SCAR=30.0
Pod undocumented
979 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
980 0 my $s = shift @_;
981 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
982 0 return Elatin6::uc(CORE::substr($s,0,1)) . CORE::substr($s,1), @_;
983 }
984 else {
985 0 return Elatin6::uc(CORE::substr($s,0,1)) . CORE::substr($s,1);
986 }
987 }
988 else {
989 0 return Elatin6::uc(CORE::substr($_,0,1)) . CORE::substr($_,1);
990 }
991 }
992  
993 #
994 # Latin-6 upper case first without parameter
995 #
996 0 ▶sub Elatin6::ucfirst_() {
Subroutine ucfirst_: not called CC=1 SCAR=6.9
Pod undocumented
997 0 return Elatin6::uc(CORE::substr($_,0,1)) . CORE::substr($_,1);
998 }
999  
1000 #
1001 # Latin-6 upper case with parameter
1002 #
1003 2623 ▶sub Elatin6::uc(@) {
Subroutine uc: called CC=6 SCAR=22.9
Pod undocumented
1004 2623 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2623 0 2623
1005 2623 my $s = shift @_;
1006 2623 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 2623 2623
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
262300
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
1007 0 ▶ return join('', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 0 0 0
1008 }
1009 else {
1010 2623 ▶ return join('', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 937 1688 2625
1011 }
1012 }
1013 else {
1014 0 return Elatin6::uc_();
1015 }
1016 }
1017  
1018 #
1019 # Latin-6 upper case without parameter
1020 #
1021 0 ▶sub Elatin6::uc_() {
Subroutine uc_: not called CC=2 SCAR=17.9
Pod undocumented
1022 0 my $s = $_;
1023 0 ▶ return join '', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 0 0 0
1024 }
1025  
1026 #
1027 # Latin-6 fold case with parameter
1028 #
1029 2623 ▶sub Elatin6::fc(@) {
Subroutine fc: called CC=6 SCAR=22.9
Pod undocumented
1030 2623 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2623 0 2623
1031 2623 my $s = shift @_;
1032 2623 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 2623 2623
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
262300
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
1033 0 ▶ return join('', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 0 0 0
1034 }
1035 else {
1036 2623 ▶ return join('', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 2067 6503 8570
1037 }
1038 }
1039 else {
1040 0 return Elatin6::fc_();
1041 }
1042 }
1043  
1044 #
1045 # Latin-6 fold case without parameter
1046 #
1047 0 ▶sub Elatin6::fc_() {
Subroutine fc_: not called CC=2 SCAR=17.9
Pod undocumented
1048 0 my $s = $_;
1049 0 ▶ return join '', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 0 0 0
1050 }
1051  
1052 #
1053 # Latin-6 regexp capture
1054 #
1055 {
1056 0 ▶ sub Elatin6::capture {
Subroutine capture: not called CC=1 SCAR=6.9
Pod documented
1057 0 return $_[0];
1058 }
1059 }
1060  
1061 #
1062 # Latin-6 regexp ignore case modifier
1063 #
1064 424 ▶sub Elatin6::ignorecase {
Subroutine ignorecase: called CC=25 SCAR=52.1
Pod undocumented
1065  
1066 11 my @string = @_;
1067 11 my $metachar = qr/[\@\\|[\]{]/oxms;
1068  
1069 # ignore case of $scalar or @array
1070 11 for my $string (@string) {
1071  
1072 # split regexp
1073 11 my @char = $string =~ /\G (?>\[\^|\\$q_char|$q_char) /oxmsg;
1074  
1075 # unescape character
1076 11 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1148 11 1159
1077 1148 ▶ next if not defined $char[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $char[$i] 0 1148 1148
1078  
1079 # open character class [...]
1080 1148 ▶ if ($char[$i] eq '[') {
Branch: 4 branches
BranchTrueFalseTotal
if ($char[$i] eq '[') { } 0 1148 1148
elsif ($char[$i] eq '[^') { } 0 1148 1148
elsif (my $char = classic_character_class($char[$i])) { } 0 1148 1148
elsif ($char[$i] =~ /\A [\x00-\xFF] \z/mosx) { } 1148 0 1148
1081 0 my $left = $i;
1082  
1083 # [] make die "unmatched [] in regexp ...\n"
1084  
1085 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
1086 0 $i++;
1087 }
1088  
1089 0 while (1) {
1090 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
1091 0 croak "Unmatched [] in regexp";
1092 }
1093 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
1094 0 my $right = $i;
1095 0 my @charlist = charlist_qr(@char[$left+1..$right-1], 'i');
1096  
1097 # escape character
1098 0 for my $char (@charlist) {
1099 0 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $char =~ /\A [.|)] \z/mosx }) 0 0 0
1100 }
1101  
1102 0 elsif ($char =~ /\A [.|)] \z/oxms) {
1103 0 $char = '\\' . $char;
1104 }
1105 }
1106  
1107 # [...]
1108 0 splice @char, $left, $right-$left+1, '(?:' . join('|', @charlist) . ')';
1109  
1110 0 $i = $left;
1111 0 last;
1112 }
1113 }
1114 }
1115  
1116 # open character class [^...]
1117 elsif ($char[$i] eq '[^') {
1118 0 my $left = $i;
1119  
1120 # [^] make die "unmatched [] in regexp ...\n"
1121  
1122 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
1123 0 $i++;
1124 }
1125  
1126 0 while (1) {
1127 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
1128 0 croak "Unmatched [] in regexp";
1129 }
1130 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
1131 0 my $right = $i;
1132 0 my @charlist = charlist_not_qr(@char[$left+1..$right-1], 'i');
1133  
1134 # escape character
1135 0 for my $char (@charlist) {
1136 0 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $char =~ /\A [.|)] \z/mosx }) 0 0 0
1137 }
1138  
1139 0 elsif ($char =~ /\A [.|)] \z/oxms) {
1140 0 $char = '\\' . $char;
1141 }
1142 }
1143  
1144 # [^...]
1145 0 splice @char, $left, $right-$left+1, '(?!' . join('|', @charlist) . ")(?:$your_char)";
1146  
1147 0 $i = $left;
1148 0 last;
1149 }
1150 }
1151 }
1152  
1153 # rewrite classic character class or escape character
1154 elsif (my $char = classic_character_class($char[$i])) {
1155 0 $char[$i] = $char;
1156 }
1157  
1158 # with /i modifier
1159 elsif ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) {
1160 1148 my $uc = Elatin6::uc($char[$i]);
1161 1148 my $fc = Elatin6::fc($char[$i]);
1162 1148 ▶ if ($uc ne $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc ne $fc) 588 560 1148
1163 588 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 585 3 588
1164 585 $char[$i] = '[' . $uc . $fc . ']';
1165 }
1166 else {
1167 3 $char[$i] = '(?:' . $uc . '|' . $fc . ')';
1168 }
1169 }
1170 }
1171 }
1172  
1173 # characterize
1174 11 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1148 11 1159
1175 1148 ▶ next if not defined $char[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $char[$i] 0 1148 1148
1176  
1177 1148 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx }) 0 1159 1159
1178 }
1179  
1180 # quote character before ? + * {
1181 0 ▶ elsif (($i >= 1) and ($char[$i] =~ /\A [\?\+\*\{] \z/oxms)) {
Condition66%2/3
$i >= 1 && $char[$i] =~ /\A [\?\+\*\{] \z/mosx
!ll&&!rl&&r
1111370
MC/DC0%0/2
$i >= 1 && $char[$i] =~ /\A [\?\+\*\{] \z/mosx
$i >= 1 $char[$i] =~ /\A [\?\+\*\{] \z/mosx
Truth table66%2/3
A && B
A= $i >= 1B= $char[$i] =~ /\A [\?\+\*\{] \z/mosx
ABresult
0X0
100
111
1182 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
1183 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
1184 }
1185 }
1186 }
1187  
1188 11 $string = join '', @char;
1189 }
1190  
1191 # make regexp string
1192 11 return @string;
1193 }
1194  
1195 #
1196 # classic character class ( \D \S \W \d \s \w \C \X \H \V \h \v \R \N \b \B )
1197 #
1198 3016 ▶sub Elatin6::classic_character_class {
Subroutine classic_character_class: called CC=2 SCAR=6.9
Pod undocumented
1199 3016 my($char) = @_;
1200  
1201 return {
1202 '\D' => '${Elatin6::eD}',
1203 '\S' => '${Elatin6::eS}',
1204 '\W' => '${Elatin6::eW}',
1205 '\d' => '[0-9]',
1206  
1207 # Before Perl 5.6, \s only matched the five whitespace characters
1208 # tab, newline, form-feed, carriage return, and the space character
1209 # itself, which, taken together, is the character class [\t\n\f\r ].
1210  
1211 # Vertical tabs are now whitespace
1212 # \s in a regex now matches a vertical tab in all circumstances.
1213 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
1214 # \t \n \v \f \r space
1215 # '\s' => '[\x09\x0A \x0C\x0D\x20]',
1216 # '\s' => '[\x09\x0A\x0B\x0C\x0D\x20]',
1217 '\s' => '\s',
1218  
1219 '\w' => '[0-9A-Z_a-z]',
1220 '\C' => '[\x00-\xFF]',
1221 '\X' => 'X',
1222  
1223 # \h \v \H \V
1224  
1225 # P.114 Character Class Shortcuts
1226 # in Chapter 7: In the World of Regular Expressions
1227 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
1228  
1229 # P.357 13.2.3 Whitespace
1230 # in Chapter 13: perlrecharclass: Perl Regular Expression Character Classes
1231 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
1232 #
1233 # 0x00009 CHARACTER TABULATION h s
1234 # 0x0000a LINE FEED (LF) vs
1235 # 0x0000b LINE TABULATION v
1236 # 0x0000c FORM FEED (FF) vs
1237 # 0x0000d CARRIAGE RETURN (CR) vs
1238 # 0x00020 SPACE h s
1239  
1240 # P.196 Table 5-9. Alphanumeric regex metasymbols
1241 # in Chapter 5. Pattern Matching
1242 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1243  
1244 # (and so on)
1245  
1246 '\H' => '${Elatin6::eH}',
1247 '\V' => '${Elatin6::eV}',
1248 '\h' => '[\x09\x20]',
1249 '\v' => '[\x0A\x0B\x0C\x0D]',
1250 '\R' => '${Elatin6::eR}',
1251  
1252 # \N
1253 #
1254 # http://perldoc.perl.org/perlre.html
1255 # Character Classes and other Special Escapes
1256 # Any character but \n (experimental). Not affected by /s modifier
1257  
1258 '\N' => '${Elatin6::eN}',
1259  
1260 # \b \B
1261  
1262 # P.180 Boundaries: The \b and \B Assertions
1263 # in Chapter 5: Pattern Matching
1264 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
1265  
1266 # P.219 Boundaries: The \b and \B Assertions
1267 # in Chapter 5: Pattern Matching
1268 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1269  
1270 # \b really means (?:(?<=\w)(?!\w)|(?<!\w)(?=\w))
1271 # or (?:(?<=\A|\W)(?=\w)|(?<=\w)(?=\W|\z))
1272 '\b' => '${Elatin6::eb}',
1273  
1274 # \B really means (?:(?<=\w)(?=\w)|(?<!\w)(?!\w))
1275 # or (?:(?<=\w)(?=\w)|(?<=\W)(?=\W))
1276 '\B' => '${Elatin6::eB}',
1277  
1278 3016 ▶ }->{$char} || '';
Condition100%2/2
{'\\D', '${Elatin6::eD}', '\\S', '${Elatin6::eS}', '\\W', '${Elatin6::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin6::eH}', '\\V', '${Elatin6::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin6::eR}', '\\N', '${Elatin6::eN}', '\\b', '${Elatin6::eb}', '\\B', '${Elatin6::eB}'}->{$char} || ''
l!l
1012915
MC/DC100%1/1
{'\\D', '${Elatin6::eD}', '\\S', '${Elatin6::eS}', '\\W', '${Elatin6::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin6::eH}', '\\V', '${Elatin6::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin6::eR}', '\\N', '${Elatin6::eN}', '\\b', '${Elatin6::eb}', '\\B', '${Elatin6::eB}'}->{$char} || ''
{'\\D', '${Elatin6::eD}', '\\S', '${Elatin6::eS}', '\\W', '${Elatin6::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin6::eH}', '\\V', '${Elatin6::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin6::eR}', '\\N', '${Elatin6::eN}', '\\b', '${Elatin6::eb}', '\\B', '${Elatin6::eB}'}->{$char}
Truth table100%2/2
A
A= {'\\D', '${Elatin6::eD}', '\\S', '${Elatin6::eS}', '\\W', '${Elatin6::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin6::eH}', '\\V', '${Elatin6::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin6::eR}', '\\N', '${Elatin6::eN}', '\\b', '${Elatin6::eb}', '\\B', '${Elatin6::eB}'}->{$char}
Aresult
11
00
1279 }
1280  
1281 #
1282 # prepare Latin-6 characters per length
1283 #
1284  
1285 # 1 octet characters
1286 424 my @chars1 = ();
1287 0 ▶sub chars1 {
Subroutine chars1: not called CC=5 SCAR=34.0
Pod undocumented
1288 0 ▶ if (@chars1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars1) 0 0 0
1289 0 return @chars1;
1290 }
1291 0 ▶ if (exists $range_tr{1}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{1}) 0 0 0
1292 0 my @ranges = @{ $range_tr{1} };
1293 0 ▶ while (my @range = splice(@ranges,0,1)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 1)) 0 0 0
1294 0 for my $oct0 (@{$range[0]}) {
1295 0 push @chars1, pack 'C', $oct0;
1296 }
1297 }
1298 }
1299 0 return @chars1;
1300 }
1301  
1302 # 2 octets characters
1303 424 my @chars2 = ();
1304 0 ▶sub chars2 {
Subroutine chars2: not called CC=6 SCAR=37.4
Pod undocumented
1305 0 ▶ if (@chars2) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars2) 0 0 0
1306 0 return @chars2;
1307 }
1308 0 ▶ if (exists $range_tr{2}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{2}) 0 0 0
1309 0 my @ranges = @{ $range_tr{2} };
1310 0 ▶ while (my @range = splice(@ranges,0,2)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 2)) 0 0 0
1311 0 for my $oct0 (@{$range[0]}) {
1312 0 for my $oct1 (@{$range[1]}) {
1313 0 push @chars2, pack 'CC', $oct0,$oct1;
1314 }
1315 }
1316 }
1317 }
1318 0 return @chars2;
1319 }
1320  
1321 # 3 octets characters
1322 424 my @chars3 = ();
1323 0 ▶sub chars3 {
Subroutine chars3: not called CC=7 SCAR=40.3
Pod undocumented
1324 0 ▶ if (@chars3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars3) 0 0 0
1325 0 return @chars3;
1326 }
1327 0 ▶ if (exists $range_tr{3}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{3}) 0 0 0
1328 0 my @ranges = @{ $range_tr{3} };
1329 0 ▶ while (my @range = splice(@ranges,0,3)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 3)) 0 0 0
1330 0 for my $oct0 (@{$range[0]}) {
1331 0 for my $oct1 (@{$range[1]}) {
1332 0 for my $oct2 (@{$range[2]}) {
1333 0 push @chars3, pack 'CCC', $oct0,$oct1,$oct2;
1334 }
1335 }
1336 }
1337 }
1338 }
1339 0 return @chars3;
1340 }
1341  
1342 # 4 octets characters
1343 424 my @chars4 = ();
1344 0 ▶sub chars4 {
Subroutine chars4: not called CC=8 SCAR=42.8
Pod undocumented
1345 0 ▶ if (@chars4) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars4) 0 0 0
1346 0 return @chars4;
1347 }
1348 0 ▶ if (exists $range_tr{4}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{4}) 0 0 0
1349 0 my @ranges = @{ $range_tr{4} };
1350 0 ▶ while (my @range = splice(@ranges,0,4)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 4)) 0 0 0
1351 0 for my $oct0 (@{$range[0]}) {
1352 0 for my $oct1 (@{$range[1]}) {
1353 0 for my $oct2 (@{$range[2]}) {
1354 0 for my $oct3 (@{$range[3]}) {
1355 0 push @chars4, pack 'CCCC', $oct0,$oct1,$oct2,$oct3;
1356 }
1357 }
1358 }
1359 }
1360 }
1361 }
1362 0 return @chars4;
1363 }
1364  
1365 #
1366 # Latin-6 open character list for tr
1367 #
1368 12 ▶sub _charlist_tr {
Subroutine _charlist_tr: called CC=35 SCAR=66.4
1369  
1370 12 local $_ = shift @_;
1371  
1372 # unescape character
1373 12 my @char = ();
1374 12 ▶ while (not /\G \z/oxmsgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgmosx) 38 12 50
1375 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 \\ ($Elatin6::q_char) /cgmosx) { } 0 38 38
elsif (/\G ($Elatin6::q_char) /cgmosx) { } 38 0 38
1376 0 push @char, '\-';
1377 }
1378 elsif (/\G \\ ([0-7]{2,3}) /oxmsgc) {
1379 0 push @char, CORE::chr(oct $1);
1380 }
1381 elsif (/\G \\x ([0-9A-Fa-f]{1,2}) /oxmsgc) {
1382 0 push @char, CORE::chr(hex $1);
1383 }
1384 elsif (/\G \\c ([\x40-\x5F]) /oxmsgc) {
1385 0 push @char, CORE::chr(CORE::ord($1) & 0x1F);
1386 }
1387 elsif (/\G (\\ [0nrtfbae]) /oxmsgc) {
1388 push @char, {
1389 '\0' => "\0",
1390 '\n' => "\n",
1391 '\r' => "\r",
1392 '\t' => "\t",
1393 '\f' => "\f",
1394 '\b' => "\x08", # \b means backspace in character class
1395 '\a' => "\a",
1396 '\e' => "\e",
1397 0 }->{$1};
1398 }
1399 elsif (/\G \\ ($q_char) /oxmsgc) {
1400 0 push @char, $1;
1401 }
1402 elsif (/\G ($q_char) /oxmsgc) {
1403 38 push @char, $1;
1404 }
1405 }
1406  
1407 # join separated multiple-octet
1408 12 @char = join('',@char) =~ /\G (?>\\-|$q_char) /oxmsg;
1409  
1410 # unescape '-'
1411 12 my @i = ();
1412 12 for my $i (0 .. $#char) {
1413 38 ▶ if ($char[$i] eq '\-') {
Branch: 2 branches
BranchTrueFalseTotal
if ($char[$i] eq '\\-') { } 0 38 38
elsif ($char[$i] eq '-') { } 0 38 38
1414 0 $char[$i] = '-';
1415 }
1416 elsif ($char[$i] eq '-') {
1417 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
1418 0 push @i, $i;
1419 }
1420 }
1421 }
1422  
1423 # open character list (reverse for splice)
1424 12 for my $i (CORE::reverse @i) {
1425 0 my @range = ();
1426  
1427 # range error
1428 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
1429 0 croak "Invalid tr/// range \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1430 }
1431  
1432 # range of multiple-octet code
1433 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
1434 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
1435 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
1436 }
1437 elsif (CORE::length($char[$i+1]) == 2) {
1438 0 push @range, grep {$char[$i-1] le $_} chars1();
1439 0 push @range, grep {$_ le $char[$i+1]} chars2();
1440 }
1441 elsif (CORE::length($char[$i+1]) == 3) {
1442 0 push @range, grep {$char[$i-1] le $_} chars1();
1443 0 push @range, chars2();
1444 0 push @range, grep {$_ le $char[$i+1]} chars3();
1445 }
1446 elsif (CORE::length($char[$i+1]) == 4) {
1447 0 push @range, grep {$char[$i-1] le $_} chars1();
1448 0 push @range, chars2();
1449 0 push @range, chars3();
1450 0 push @range, grep {$_ le $char[$i+1]} chars4();
1451 }
1452 else {
1453 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1454 }
1455 }
1456 elsif (CORE::length($char[$i-1]) == 2) {
1457 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
1458 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
1459 }
1460 elsif (CORE::length($char[$i+1]) == 3) {
1461 0 push @range, grep {$char[$i-1] le $_} chars2();
1462 0 push @range, grep {$_ le $char[$i+1]} chars3();
1463 }
1464 elsif (CORE::length($char[$i+1]) == 4) {
1465 0 push @range, grep {$char[$i-1] le $_} chars2();
1466 0 push @range, chars3();
1467 0 push @range, grep {$_ le $char[$i+1]} chars4();
1468 }
1469 else {
1470 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1471 }
1472 }
1473 elsif (CORE::length($char[$i-1]) == 3) {
1474 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
1475 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
1476 }
1477 elsif (CORE::length($char[$i+1]) == 4) {
1478 0 push @range, grep {$char[$i-1] le $_} chars3();
1479 0 push @range, grep {$_ le $char[$i+1]} chars4();
1480 }
1481 else {
1482 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1483 }
1484 }
1485 elsif (CORE::length($char[$i-1]) == 4) {
1486 0 ▶ if (CORE::length($char[$i+1]) == 4) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $char[$i + 1] == 4) { } 0 0 0
1487 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
1488 }
1489 else {
1490 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1491 }
1492 }
1493 else {
1494 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1495 }
1496  
1497 0 splice @char, $i-1, 3, @range;
1498 }
1499  
1500 12 return @char;
1501 }
1502  
1503 #
1504 # Latin-6 open character class
1505 #
1506 0 ▶sub _cc {
Subroutine _cc: not called CC=7 SCAR=40.3
1507 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
1508 0 die __FILE__, ": subroutine cc got no parameter.\n";
1509 }
1510 elsif (scalar(@_) == 1) {
1511 0 return sprintf('\x%02X',$_[0]);
1512 }
1513 elsif (scalar(@_) == 2) {
1514 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
1515 0 die __FILE__, ": subroutine cc got \$_[0] > \$_[1] parameters).\n";
1516 }
1517 elsif ($_[0] == $_[1]) {
1518 0 return sprintf('\x%02X',$_[0]);
1519 }
1520 elsif (($_[0]+1) == $_[1]) {
1521 0 return sprintf('[\\x%02X\\x%02X]',$_[0],$_[1]);
1522 }
1523 else {
1524 0 return sprintf('[\\x%02X-\\x%02X]',$_[0],$_[1]);
1525 }
1526 }
1527 else {
1528 0 die __FILE__, ": subroutine cc got 3 or more parameters (@{[scalar(@_)]} parameters).\n";
1529 }
1530 }
1531  
1532 #
1533 # Latin-6 octet range
1534 #
1535 246 ▶sub _octets {
Subroutine _octets: called CC=5 SCAR=19.3
1536 246 my $length = shift @_;
1537  
1538 246 ▶ if ($length == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length == 1) { } 246 0 246
1539 246 my($a1) = unpack 'C', $_[0];
1540 246 my($z1) = unpack 'C', $_[1];
1541  
1542 246 ▶ if ($a1 > $z1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($a1 > $z1) 0 246 246
1543 0 croak 'Invalid [] range in regexp (CORE::ord(A) > CORE::ord(B)) ' . '\x' . unpack('H*',$a1) . '-\x' . unpack('H*',$z1);
1544 }
1545  
1546 246 ▶ if ($a1 == $z1) {
Branch: 2 branches
BranchTrueFalseTotal
if ($a1 == $z1) { } 0 246 246
elsif ($a1 + 1 == $z1) { } 0 246 246
1547 0 return sprintf('\x%02X',$a1);
1548 }
1549 elsif (($a1+1) == $z1) {
1550 0 return sprintf('\x%02X\x%02X',$a1,$z1);
1551 }
1552 else {
1553 246 return sprintf('\x%02X-\x%02X',$a1,$z1);
1554 }
1555 }
1556 else {
1557 0 die __FILE__, ": subroutine _octets got invalid length ($length).\n";
1558 }
1559 }
1560  
1561 #
1562 # Latin-6 range regexp
1563 #
1564 246 ▶sub _range_regexp {
Subroutine _range_regexp: called CC=18 SCAR=41.7
1565 246 my($length,$first,$last) = @_;
1566  
1567 246 my @range_regexp = ();
1568 246 ▶ if (not exists $range_tr{$length}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $range_tr{$length}) 0 246 246
1569 0 return @range_regexp;
1570 }
1571  
1572 246 my @ranges = @{ $range_tr{$length} };
1573 246 ▶ while (my @range = splice(@ranges,0,$length)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, $length)) 246 246 492
1574 246 my $min = '';
1575 246 my $max = '';
1576 246 ▶ for (my $i=0; $i < $length; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $length) 246 246 492
1577 246 $min .= pack 'C', $range[$i][0];
1578 246 $max .= pack 'C', $range[$i][-1];
1579 }
1580  
1581 # min___max
1582 # FIRST_____________LAST
1583 # (nothing)
1584  
1585 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
1586 }
1587  
1588 # **********
1589 # min_________max
1590 # FIRST_____________LAST
1591 # **********
1592  
1593 ▶ 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
1594 0 push @range_regexp, _octets($length,$first,$max,$min,$max);
1595 }
1596  
1597 # **********************
1598 # min________________max
1599 # FIRST_____________LAST
1600 # **********************
1601  
1602 ▶ 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
1603 0 push @range_regexp, _octets($length,$first,$last,$min,$max);
1604 }
1605  
1606 # *********
1607 # min___max
1608 # FIRST_____________LAST
1609 # *********
1610  
1611 ▶ 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
1612 0 push @range_regexp, _octets($length,$min,$max,$min,$max);
1613 }
1614  
1615 # **********************
1616 # min__________________________max
1617 # FIRST_____________LAST
1618 # **********************
1619  
1620 ▶ 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
1621 246 push @range_regexp, _octets($length,$first,$last,$min,$max);
1622 }
1623  
1624 # *********
1625 # min________max
1626 # FIRST_____________LAST
1627 # *********
1628  
1629 ▶ 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
1630 0 push @range_regexp, _octets($length,$min,$last,$min,$max);
1631 }
1632  
1633 # min___max
1634 # FIRST_____________LAST
1635 # (nothing)
1636  
1637 elsif ($last lt $min) {
1638 }
1639  
1640 else {
1641 0 die __FILE__, ": subroutine _range_regexp panic.\n";
1642 }
1643 }
1644  
1645 246 return @range_regexp;
1646 }
1647  
1648 #
1649 # Latin-6 open character list for qr and not qr
1650 #
1651 650 ▶sub _charlist {
Subroutine _charlist: called CC=46 SCAR=45.9
1652  
1653 650 my $modifier = pop @_;
1654 650 my @char = @_;
1655  
1656 650 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 298 352 650
1657  
1658 # unescape character
1659 650 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1773 650 2423
1660  
1661 # escape - to ...
1662 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 \\ ($Elatin6::q_char) \z/mosx) { } 7 1371 1378
1663 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
1664 246 $char[$i] = '...';
1665 }
1666 }
1667  
1668 # octal escape sequence
1669 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
1670 0 $char[$i] = octchr($1);
1671 }
1672  
1673 # hexadecimal escape sequence
1674 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
1675 0 $char[$i] = hexchr($1);
1676 }
1677  
1678 # \b{...} --> b\{...}
1679 # \B{...} --> B\{...}
1680 # \N{CHARNAME} --> N\{CHARNAME}
1681 # \p{PROPERTY} --> p\{PROPERTY}
1682 # \P{PROPERTY} --> P\{PROPERTY}
1683 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
1684 0 $char[$i] = $1 . '\\' . $2;
1685 }
1686  
1687 # \p, \P, \X --> p, P, X
1688 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
1689 0 $char[$i] = $1;
1690 }
1691  
1692 elsif ($char[$i] =~ /\A \\ ([0-7]{2,3}) \z/oxms) {
1693 0 $char[$i] = CORE::chr oct $1;
1694 }
1695 elsif ($char[$i] =~ /\A \\x ([0-9A-Fa-f]{1,2}) \z/oxms) {
1696 22 $char[$i] = CORE::chr hex $1;
1697 }
1698 elsif ($char[$i] =~ /\A \\c ([\x40-\x5F]) \z/oxms) {
1699 0 $char[$i] = CORE::chr(CORE::ord($1) & 0x1F);
1700 }
1701 elsif ($char[$i] =~ /\A (\\ [0nrtfbaedswDSWHVhvR]) \z/oxms) {
1702 $char[$i] = {
1703 '\0' => "\0",
1704 '\n' => "\n",
1705 '\r' => "\r",
1706 '\t' => "\t",
1707 '\f' => "\f",
1708 '\b' => "\x08", # \b means backspace in character class
1709 '\a' => "\a",
1710 '\e' => "\e",
1711 '\d' => '[0-9]',
1712  
1713 # Vertical tabs are now whitespace
1714 # \s in a regex now matches a vertical tab in all circumstances.
1715 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
1716 # \t \n \v \f \r space
1717 # '\s' => '[\x09\x0A \x0C\x0D\x20]',
1718 # '\s' => '[\x09\x0A\x0B\x0C\x0D\x20]',
1719 '\s' => '\s',
1720  
1721 '\w' => '[0-9A-Z_a-z]',
1722 '\D' => '${Elatin6::eD}',
1723 '\S' => '${Elatin6::eS}',
1724 '\W' => '${Elatin6::eW}',
1725  
1726 '\H' => '${Elatin6::eH}',
1727 '\V' => '${Elatin6::eV}',
1728 '\h' => '[\x09\x20]',
1729 '\v' => '[\x0A\x0B\x0C\x0D]',
1730 '\R' => '${Elatin6::eR}',
1731  
1732 25 }->{$1};
1733 }
1734  
1735 # POSIX-style character classes
1736 ▶ 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
1737 $char[$i] = {
1738  
1739 '[:lower:]' => '[\x41-\x5A\x61-\x7A]',
1740 '[:upper:]' => '[\x41-\x5A\x61-\x7A]',
1741 '[:^lower:]' => '${Elatin6::not_lower_i}',
1742 '[:^upper:]' => '${Elatin6::not_upper_i}',
1743  
1744 8 }->{$1};
1745 }
1746 elsif ($char[$i] =~ /\A ( \[\: \^? (?:alnum|alpha|ascii|blank|cntrl|digit|graph|lower|print|punct|space|upper|word|xdigit) :\] ) \z/oxms) {
1747 $char[$i] = {
1748  
1749 '[:alnum:]' => '[\x30-\x39\x41-\x5A\x61-\x7A]',
1750 '[:alpha:]' => '[\x41-\x5A\x61-\x7A]',
1751 '[:ascii:]' => '[\x00-\x7F]',
1752 '[:blank:]' => '[\x09\x20]',
1753 '[:cntrl:]' => '[\x00-\x1F\x7F]',
1754 '[:digit:]' => '[\x30-\x39]',
1755 '[:graph:]' => '[\x21-\x7F]',
1756 '[:lower:]' => '[\x61-\x7A]',
1757 '[:print:]' => '[\x20-\x7F]',
1758 '[:punct:]' => '[\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E]',
1759  
1760 # P.174 POSIX-Style Character Classes
1761 # in Chapter 5: Pattern Matching
1762 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
1763  
1764 # P.311 11.2.4 Character Classes and other Special Escapes
1765 # in Chapter 11: perlre: Perl regular expressions
1766 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
1767  
1768 # P.210 POSIX-Style Character Classes
1769 # in Chapter 5: Pattern Matching
1770 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1771  
1772 '[:space:]' => '[\s\x0B]', # "\s" plus vertical tab ("\cK")
1773  
1774 '[:upper:]' => '[\x41-\x5A]',
1775 '[:word:]' => '[\x30-\x39\x41-\x5A\x5F\x61-\x7A]',
1776 '[:xdigit:]' => '[\x30-\x39\x41-\x46\x61-\x66]',
1777 '[:^alnum:]' => '${Elatin6::not_alnum}',
1778 '[:^alpha:]' => '${Elatin6::not_alpha}',
1779 '[:^ascii:]' => '${Elatin6::not_ascii}',
1780 '[:^blank:]' => '${Elatin6::not_blank}',
1781 '[:^cntrl:]' => '${Elatin6::not_cntrl}',
1782 '[:^digit:]' => '${Elatin6::not_digit}',
1783 '[:^graph:]' => '${Elatin6::not_graph}',
1784 '[:^lower:]' => '${Elatin6::not_lower}',
1785 '[:^print:]' => '${Elatin6::not_print}',
1786 '[:^punct:]' => '${Elatin6::not_punct}',
1787 '[:^space:]' => '${Elatin6::not_space}',
1788 '[:^upper:]' => '${Elatin6::not_upper}',
1789 '[:^word:]' => '${Elatin6::not_word}',
1790 '[:^xdigit:]' => '${Elatin6::not_xdigit}',
1791  
1792 70 }->{$1};
1793 }
1794 elsif ($char[$i] =~ /\A \\ ($q_char) \z/oxms) {
1795 7 $char[$i] = $1;
1796 }
1797 }
1798  
1799 # open character list
1800 650 my @singleoctet = ();
1801 650 my @multipleoctet = ();
1802 650 ▶ for (my $i=0; $i <= $#char; ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1527 650 2177
1803  
1804 # escaped -
1805 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
1806 246 $i += 1;
1807 246 next;
1808 }
1809  
1810 # make range regexp
1811 elsif ($char[$i] eq '...') {
1812  
1813 # range error
1814 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
1815 0 croak 'Invalid [] range in regexp (length(A) > length(B)) ' . '\x' . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]);
1816 }
1817 elsif (CORE::length($char[$i-1]) == CORE::length($char[$i+1])) {
1818 246 ▶ if ($char[$i-1] gt $char[$i+1]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i - 1] gt $char[$i + 1]) 0 246 246
1819 0 croak 'Invalid [] range in regexp (CORE::ord(A) > CORE::ord(B)) ' . '\x' . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]);
1820 }
1821 }
1822  
1823 # make range regexp per length
1824 246 for my $length (CORE::length($char[$i-1]) .. CORE::length($char[$i+1])) {
1825 246 my @regexp = ();
1826  
1827 # is first and last
1828 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
1829 246 push @regexp, _range_regexp($length, $char[$i-1], $char[$i+1]);
1830 }
1831  
1832 # is first
1833 elsif ($length == CORE::length($char[$i-1])) {
1834 0 push @regexp, _range_regexp($length, $char[$i-1], "\xFF" x $length);
1835 }
1836  
1837 # is inside in first and last
1838 ▶ 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
1839 0 push @regexp, _range_regexp($length, "\x00" x $length, "\xFF" x $length);
1840 }
1841  
1842 # is last
1843 elsif ($length == CORE::length($char[$i+1])) {
1844 0 push @regexp, _range_regexp($length, "\x00" x $length, $char[$i+1]);
1845 }
1846  
1847 else {
1848 0 die __FILE__, ": subroutine make_regexp panic.\n";
1849 }
1850  
1851 246 ▶ if ($length == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length == 1) { } 246 0 246
1852 246 push @singleoctet, @regexp;
1853 }
1854 else {
1855 0 push @multipleoctet, @regexp;
1856 }
1857 }
1858  
1859 246 $i += 2;
1860 }
1861  
1862 # with /i modifier
1863 elsif ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) {
1864 949 ▶ if ($modifier =~ /i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) { } 480 469 949
1865 480 my $uc = Elatin6::uc($char[$i]);
1866 480 my $fc = Elatin6::fc($char[$i]);
1867 480 ▶ if ($uc ne $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc ne $fc) { } 240 240 480
1868 240 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 240 0 240
1869 240 push @singleoctet, $uc, $fc;
1870 }
1871 else {
1872 0 push @singleoctet, $uc;
1873 0 push @multipleoctet, $fc;
1874 }
1875 }
1876 else {
1877 240 push @singleoctet, $char[$i];
1878 }
1879 }
1880 else {
1881 469 push @singleoctet, $char[$i];
1882 }
1883 949 $i += 1;
1884 }
1885  
1886 # single character of single octet code
1887 elsif ($char[$i] =~ /\A (?: \\h ) \z/oxms) {
1888 0 push @singleoctet, "\t", "\x20";
1889 0 $i += 1;
1890 }
1891 elsif ($char[$i] =~ /\A (?: \\v ) \z/oxms) {
1892 0 push @singleoctet, "\x0A", "\x0B", "\x0C", "\x0D";
1893 0 $i += 1;
1894 }
1895 elsif ($char[$i] =~ /\A (?: \\d | \\s | \\w ) \z/oxms) {
1896 2 push @singleoctet, $char[$i];
1897 2 $i += 1;
1898 }
1899  
1900 # single character of multiple-octet code
1901 else {
1902 84 push @multipleoctet, $char[$i];
1903 84 $i += 1;
1904 }
1905 }
1906  
1907 # quote metachar
1908 650 for (@singleoctet) {
1909 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
1910 0 $_ = '-';
1911 }
1912 elsif (/\A \n \z/oxms) {
1913 8 $_ = '\n';
1914 }
1915 elsif (/\A \r \z/oxms) {
1916 8 $_ = '\r';
1917 }
1918 elsif (/\A ([\x00-\x20\x7F-\xFF]) \z/oxms) {
1919 744 $_ = sprintf('\x%02X', CORE::ord $1);
1920 }
1921 elsif (/\A [\x00-\xFF] \z/oxms) {
1922 429 $_ = quotemeta $_;
1923 }
1924 }
1925  
1926 # return character list
1927 650 return \@singleoctet, \@multipleoctet;
1928 }
1929  
1930 #
1931 # Latin-6 octal escape sequence
1932 #
1933 5 ▶sub octchr {
Subroutine octchr: called CC=2 SCAR=6.9
Pod undocumented
1934 5 my($octdigit) = @_;
1935  
1936 5 my @binary = ();
1937 5 for my $octal (split(//,$octdigit)) {
1938 push @binary, {
1939 '0' => '000',
1940 '1' => '001',
1941 '2' => '010',
1942 '3' => '011',
1943 '4' => '100',
1944 '5' => '101',
1945 '6' => '110',
1946 '7' => '111',
1947 50 }->{$octal};
1948 }
1949 5 my $binary = join '', @binary;
1950  
1951 my $octchr = {
1952 # 1234567
1953 1 => pack('B*', "0000000$binary"),
1954 2 => pack('B*', "000000$binary"),
1955 3 => pack('B*', "00000$binary"),
1956 4 => pack('B*', "0000$binary"),
1957 5 => pack('B*', "000$binary"),
1958 6 => pack('B*', "00$binary"),
1959 7 => pack('B*', "0$binary"),
1960 0 => pack('B*', "$binary"),
1961  
1962 5 }->{CORE::length($binary) % 8};
1963  
1964 5 return $octchr;
1965 }
1966  
1967 #
1968 # Latin-6 hexadecimal escape sequence
1969 #
1970 5 ▶sub hexchr {
Subroutine hexchr: called CC=1 SCAR=0.0
Pod undocumented
1971 5 my($hexdigit) = @_;
1972  
1973 my $hexchr = {
1974 1 => pack('H*', "0$hexdigit"),
1975 0 => pack('H*', "$hexdigit"),
1976  
1977 5 }->{CORE::length($_[0]) % 2};
1978  
1979 5 return $hexchr;
1980 }
1981  
1982 #
1983 # Latin-6 open character list for qr
1984 #
1985 576 ▶sub charlist_qr {
Subroutine charlist_qr: called CC=17 SCAR=28.7
Pod undocumented
1986  
1987 576 my $modifier = pop @_;
1988 576 my @char = @_;
1989  
1990 576 my($singleoctet, $multipleoctet) = _charlist(@char, $modifier);
1991 576 my @singleoctet = @$singleoctet;
1992 576 my @multipleoctet = @$multipleoctet;
1993  
1994 # return character list
1995 576 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) 498 78 576
1996  
1997 # with /i modifier
1998 498 ▶ if ($modifier =~ m/i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) 265 233 498
1999 265 my %singleoctet_ignorecase = ();
2000 265 for (@singleoctet) {
2001 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
2002 745 for my $ord (hex($1) .. hex($2)) {
2003 795 my $char = CORE::chr($ord);
2004 795 my $uc = Elatin6::uc($char);
2005 795 my $fc = Elatin6::fc($char);
2006 795 ▶ if ($uc eq $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc eq $fc) { } 240 555 795
2007 240 $singleoctet_ignorecase{unpack 'C*', $char} = 1;
2008 }
2009 else {
2010 555 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 555 0 555
2011 555 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2012 555 $singleoctet_ignorecase{unpack 'C*', $fc} = 1;
2013 }
2014 else {
2015 0 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2016 0 push @multipleoctet, join '', map {sprintf('\x%02X',$_)} unpack 'C*', $fc;
2017 }
2018 }
2019 }
2020 }
2021 745 ▶ if ($_ ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ ne "") 0 745 745
2022 0 $singleoctet_ignorecase{unpack 'C*', $_} = 1;
2023 }
2024 }
2025 265 my $i = 0;
2026 265 my @singleoctet_ignorecase = ();
2027 265 for my $ord (0 .. 255) {
2028 67840 ▶ if (exists $singleoctet_ignorecase{$ord}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $singleoctet_ignorecase{$ord}) { } 870 66970 67840
2029 870 push @{$singleoctet_ignorecase[$i]}, $ord;
2030 }
2031 else {
2032 66970 $i++;
2033 }
2034 }
2035 265 @singleoctet = ();
2036 265 for my $range (@singleoctet_ignorecase) {
2037 56160 ▶ if (ref $range) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $range) 770 55390 56160
2038 770 ▶ if (scalar(@{$range}) == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @{$range;} == 1) { } 720 50 770
elsif (scalar @{$range;} == 2) { } 0 50 50
2039 720 push @singleoctet, sprintf('\x%02X', @{$range}[0]);
2040 }
2041 50 elsif (scalar(@{$range}) == 2) {
2042 0 push @singleoctet, sprintf('\x%02X\x%02X', @{$range}[0], @{$range}[-1]);
2043 }
2044 else {
2045 50 push @singleoctet, sprintf('\x%02X-\x%02X', @{$range}[0], @{$range}[-1]);
2046 }
2047 }
2048 }
2049 }
2050  
2051 498 my $not_anchor = '';
2052  
2053 498 push @multipleoctet, join('', $not_anchor, '[', @singleoctet, ']' );
2054 }
2055 576 ▶ if (scalar(@multipleoctet) >= 2) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @multipleoctet >= 2) { } 6 570 576
2056 6 return '(?:' . join('|', @multipleoctet) . ')';
2057 }
2058 else {
2059 570 return $multipleoctet[0];
2060 }
2061 }
2062  
2063 #
2064 # Latin-6 open character list for not qr
2065 #
2066 74 ▶sub charlist_not_qr {
Subroutine charlist_not_qr: called CC=18 SCAR=33.1
Pod undocumented
2067  
2068 74 my $modifier = pop @_;
2069 74 my @char = @_;
2070  
2071 74 my($singleoctet, $multipleoctet) = _charlist(@char, $modifier);
2072 74 my @singleoctet = @$singleoctet;
2073 74 my @multipleoctet = @$multipleoctet;
2074  
2075 # with /i modifier
2076 74 ▶ if ($modifier =~ m/i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) 25 49 74
2077 25 my %singleoctet_ignorecase = ();
2078 25 for (@singleoctet) {
2079 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
2080 25 for my $ord (hex($1) .. hex($2)) {
2081 75 my $char = CORE::chr($ord);
2082 75 my $uc = Elatin6::uc($char);
2083 75 my $fc = Elatin6::fc($char);
2084 75 ▶ if ($uc eq $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc eq $fc) { } 0 75 75
2085 0 $singleoctet_ignorecase{unpack 'C*', $char} = 1;
2086 }
2087 else {
2088 75 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 75 0 75
2089 75 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2090 75 $singleoctet_ignorecase{unpack 'C*', $fc} = 1;
2091 }
2092 else {
2093 0 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2094 0 push @multipleoctet, join '', map {sprintf('\x%02X',$_)} unpack 'C*', $fc;
2095 }
2096 }
2097 }
2098 }
2099 25 ▶ if ($_ ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ ne "") 0 25 25
2100 0 $singleoctet_ignorecase{unpack 'C*', $_} = 1;
2101 }
2102 }
2103 25 my $i = 0;
2104 25 my @singleoctet_ignorecase = ();
2105 25 for my $ord (0 .. 255) {
2106 6400 ▶ if (exists $singleoctet_ignorecase{$ord}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $singleoctet_ignorecase{$ord}) { } 150 6250 6400
2107 150 push @{$singleoctet_ignorecase[$i]}, $ord;
2108 }
2109 else {
2110 6250 $i++;
2111 }
2112 }
2113 25 @singleoctet = ();
2114 25 for my $range (@singleoctet_ignorecase) {
2115 2400 ▶ if (ref $range) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $range) 50 2350 2400
2116 50 ▶ if (scalar(@{$range}) == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @{$range;} == 1) { } 0 50 50
elsif (scalar @{$range;} == 2) { } 0 50 50
2117 0 push @singleoctet, sprintf('\x%02X', @{$range}[0]);
2118 }
2119 50 elsif (scalar(@{$range}) == 2) {
2120 0 push @singleoctet, sprintf('\x%02X\x%02X', @{$range}[0], @{$range}[-1]);
2121 }
2122 else {
2123 50 push @singleoctet, sprintf('\x%02X-\x%02X', @{$range}[0], @{$range}[-1]);
2124 }
2125 }
2126 }
2127 }
2128  
2129 # return character list
2130 74 ▶ if (scalar(@multipleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @multipleoctet >= 1) { } 0 74 74
2131 0 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) { } 0 0 0
2132  
2133 # any character other than multiple-octet and single octet character class
2134 0 return '(?!' . join('|', @multipleoctet) . ')(?:[^' . join('', @singleoctet) . '])';
2135 }
2136 else {
2137  
2138 # any character other than multiple-octet character class
2139 0 return '(?!' . join('|', @multipleoctet) . ")(?:$your_char)";
2140 }
2141 }
2142 else {
2143 74 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) { } 74 0 74
2144  
2145 # any character other than single octet character class
2146 74 return '(?:[^' . join('', @singleoctet) . '])';
2147 }
2148 else {
2149  
2150 # any character
2151 0 return "(?:$your_char)";
2152 }
2153 }
2154 }
2155  
2156 #
2157 # open file in read mode
2158 #
2159 424 ▶sub _open_r {
Subroutine _open_r: called CC=1 SCAR=0.0
2160 424 my(undef,$file) = @_;
2161 424 ▶ use Fcntl qw(O_RDONLY);
Subroutine BEGIN: called CC=1 SCAR=0.0
2162 424 return CORE::sysopen($_[0], $file, &O_RDONLY);
2163 }
2164  
2165 #
2166 # open file in append mode
2167 #
2168 212 ▶sub _open_a {
Subroutine _open_a: called CC=1 SCAR=0.0
2169 212 my(undef,$file) = @_;
2170 424 ▶ use Fcntl qw(O_WRONLY O_APPEND O_CREAT);
Subroutine BEGIN: called CC=1 SCAR=0.0
2171 212 return CORE::sysopen($_[0], $file, &O_WRONLY|&O_APPEND|&O_CREAT);
2172 }
2173  
2174 #
2175 # safe system
2176 #
2177 212 ▶sub _systemx {
Subroutine _systemx: called CC=1 SCAR=0.0
2178  
2179 # P.707 29.2.33. exec
2180 # in Chapter 29: Functions
2181 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2182 #
2183 # Be aware that in older releases of Perl, exec (and system) did not flush
2184 # your output buffer, so you needed to enable command buffering by setting $|
2185 # on one or more filehandles to avoid lost output in the case of exec, or
2186 # misordererd output in the case of system. This situation was largely remedied
2187 # in the 5.6 release of Perl. (So, 5.005 release not yet.)
2188  
2189 # P.855 exec
2190 # in Chapter 27: Functions
2191 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2192 #
2193 # In very old release of Perl (before v5.6), exec (and system) did not flush
2194 # your output buffer, so you needed to enable command buffering by setting $|
2195 # on one or more filehandles to avoid lost output with exec or misordered
2196 # output with system.
2197  
2198 212 $| = 1;
2199  
2200 # P.565 23.1.2. Cleaning Up Your Environment
2201 # in Chapter 23: Security
2202 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2203  
2204 # P.656 Cleaning Up Your Environment
2205 # in Chapter 20: Security
2206 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2207  
2208 # local $ENV{'PATH'} = '.';
2209 212 local @ENV{qw(IFS CDPATH ENV BASH_ENV)}; # Make %ENV safer
2210  
2211 # P.707 29.2.33. exec
2212 # in Chapter 29: Functions
2213 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2214 #
2215 # As we mentioned earlier, exec treats a discrete list of arguments as an
2216 # indication that it should bypass shell processing. However, there is one
2217 # place where you might still get tripped up. The exec call (and system, too)
2218 # will not distinguish between a single scalar argument and an array containing
2219 # only one element.
2220 #
2221 # @args = ("echo surprise"); # just one element in list
2222 # exec @args # still subject to shell escapes
2223 # or die "exec: $!"; # because @args == 1
2224 #
2225 # To avoid this, you can use the PATHNAME syntax, explicitly duplicating the
2226 # first argument as the pathname, which forces the rest of the arguments to be
2227 # interpreted as a list, even if there is only one of them:
2228 #
2229 # exec { $args[0] } @args # safe even with one-argument list
2230 # or die "can't exec @args: $!";
2231  
2232 # P.855 exec
2233 # in Chapter 27: Functions
2234 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2235 #
2236 # As we mentioned earlier, exec treats a discrete list of arguments as a
2237 # directive to bypass shell processing. However, there is one place where
2238 # you might still get tripped up. The exec call (and system, too) cannot
2239 # distinguish between a single scalar argument and an array containing
2240 # only one element.
2241 #
2242 # @args = ("echo surprise"); # just one element in list
2243 # exec @args # still subject to shell escapes
2244 # || die "exec: $!"; # because @args == 1
2245 #
2246 # To avoid this, use the PATHNAME syntax, explicitly duplicating the first
2247 # argument as the pathname, which forces the rest of the arguments to be
2248 # interpreted as a list, even if there is only one of them:
2249 #
2250 # exec { $args[0] } @args # safe even with one-argument list
2251 # || die "can't exec @args: $!";
2252  
2253 212 return CORE::system { $_[0] } @_; # safe even with one-argument list
2254 }
2255  
2256 #
2257 # Latin-6 order to character (with parameter)
2258 #
2259 3469 ▶sub Elatin6::chr(;$) {
Subroutine chr: called CC=4 SCAR=13.9
Pod undocumented
2260  
2261 3469 ▶ my $c = @_ ? $_[0] : $_;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 3469 0 3469
2262  
2263 3469 ▶ if ($c == 0x00) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c == 0) { } 24 3445 3469
2264 24 return "\x00";
2265 }
2266 else {
2267 3445 my @chr = ();
2268 3445 ▶ while ($c > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c > 0) 3445 3445 6890
2269 3445 unshift @chr, ($c % 0x100);
2270 3445 $c = int($c / 0x100);
2271 }
2272 3445 return pack 'C*', @chr;
2273 }
2274 }
2275  
2276 #
2277 # Latin-6 order to character (without parameter)
2278 #
2279 0 ▶sub Elatin6::chr_() {
Subroutine chr_: not called CC=3 SCAR=24.8
Pod undocumented
2280  
2281 0 my $c = $_;
2282  
2283 0 ▶ if ($c == 0x00) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c == 0) { } 0 0 0
2284 0 return "\x00";
2285 }
2286 else {
2287 0 my @chr = ();
2288 0 ▶ while ($c > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c > 0) 0 0 0
2289 0 unshift @chr, ($c % 0x100);
2290 0 $c = int($c / 0x100);
2291 }
2292 0 return pack 'C*', @chr;
2293 }
2294 }
2295  
2296 #
2297 # Latin-6 path globbing (with parameter)
2298 #
2299 0 ▶sub Elatin6::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-6 path globbing (without parameter)
2317 #
2318 0 ▶sub Elatin6::glob_() {
Subroutine glob_: not called CC=3 SCAR=24.8
Pod undocumented
2319  
2320 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2321 0 my @glob = _DOS_like_glob();
2322 0 for my $glob (@glob) {
2323 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2324 }
2325 0 return @glob;
2326 }
2327 else {
2328 0 my $glob = _DOS_like_glob();
2329 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2330 0 return $glob;
2331 }
2332 }
2333  
2334 #
2335 # Latin-6 path globbing via File::DosGlob 1.10
2336 #
2337 # Often I confuse "_dosglob" and "_doglob".
2338 # So, I renamed "_dosglob" to "_DOS_like_glob".
2339 #
2340 424 my %iter;
2341 my %entries;
2342 0 ▶sub _DOS_like_glob {
Subroutine _DOS_like_glob: not called CC=10 SCAR=47.0
2343  
2344 # context (keyed by second cxix argument provided by core)
2345 0 my($expr,$cxix) = @_;
2346  
2347 # glob without args defaults to $_
2348 0 ▶ $expr = $_ if not defined $expr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $expr 0 0 0
2349  
2350 # represents the current user's home directory
2351 #
2352 # 7.3. Expanding Tildes in Filenames
2353 # in Chapter 7. File Access
2354 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2355 #
2356 # and File::HomeDir, File::HomeDir::Windows module
2357  
2358 # DOS-like system
2359 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
2360 0 $expr =~ s{ \A ~ (?= [^/\\] ) }
2361 0 { my_home_MSWin32() }oxmse;
2362 }
2363  
2364 # UNIX-like system
2365 else {
2366 0 $expr =~ s{ \A ~ ( (?:[^/])* ) }
2367 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
2368 }
2369  
2370 # assume global context if not provided one
2371 0 ▶ $cxix = '_G_' if not defined $cxix;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $cxix 0 0 0
2372 0 ▶ $iter{$cxix} = 0 if not exists $iter{$cxix};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $iter{$cxix} 0 0 0
2373  
2374 # if we're just beginning, do it all first
2375 0 ▶ if ($iter{$cxix} == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iter{$cxix} == 0) 0 0 0
2376 0 $entries{$cxix} = [ _do_glob(1, _parse_line($expr)) ];
2377 }
2378  
2379 # chuck it all out, quick or slow
2380 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2381 0 delete $iter{$cxix};
2382 0 return @{delete $entries{$cxix}};
2383 }
2384 else {
2385 0 ▶ if ($iter{$cxix} = scalar @{$entries{$cxix}}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iter{$cxix} = scalar @{$entries{$cxix};}) { } 0 0 0
2386 0 return shift @{$entries{$cxix}};
2387 }
2388 else {
2389 # return undef for EOL
2390 0 delete $iter{$cxix};
2391 0 delete $entries{$cxix};
2392 0 return undef;
2393 }
2394 }
2395 }
2396  
2397 #
2398 # Latin-6 path globbing subroutine
2399 #
2400 0 ▶sub _do_glob {
Subroutine _do_glob: not called CC=44 SCAR=75.9
2401  
2402 0 my($cond,@expr) = @_;
2403 0 my @glob = ();
2404 0 my $fix_drive_relative_paths = 0;
2405  
2406 OUTER:
2407 0 for my $expr (@expr) {
2408 0 ▶ next OUTER if not defined $expr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $expr 0 0 0
2409 0 ▶ next OUTER if $expr eq '';
Branch: 1 branch
BranchTrueFalseTotal
if $expr eq "" 0 0 0
2410  
2411 0 my @matched = ();
2412 0 my @globdir = ();
2413 0 my $head = '.';
2414 0 my $pathsep = '/';
2415 0 my $tail;
2416  
2417 # if argument is within quotes strip em and do no globbing
2418 0 ▶ if ($expr =~ /\A " ((?:$q_char)*?) " \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expr =~ /\A " ((?:$Elatin6::q_char)*?) " \z/mosx) 0 0 0
2419 0 $expr = $1;
2420 0 ▶ if ($cond eq 'd') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cond eq 'd') { } 0 0 0
2421 0 ▶ if (-d $expr) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $expr) 0 0 0
2422 0 push @glob, $expr;
2423 }
2424 }
2425 else {
2426 0 ▶ if (-e $expr) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $expr) 0 0 0
2427 0 push @glob, $expr;
2428 }
2429 }
2430 0 next OUTER;
2431 }
2432  
2433 # wildcards with a drive prefix such as h:*.pm must be changed
2434 # to h:./*.pm to expand correctly
2435 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
2436 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
2437 0 $fix_drive_relative_paths = 1;
2438 }
2439 }
2440  
2441 0 ▶ if (($head, $tail) = _parse_path($expr,$pathsep)) {
Branch: 1 branch
BranchTrueFalseTotal
if (($head, $tail) = _parse_path($expr, $pathsep)) 0 0 0
2442 0 ▶ if ($tail eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($tail eq "") 0 0 0
2443 0 push @glob, $expr;
2444 0 next OUTER;
2445 }
2446 0 ▶ if ($head =~ / \A (?:$q_char)*? [*?] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head =~ / \A (?:$Elatin6::q_char)*? [*?] /mosx) 0 0 0
2447 0 ▶ if (@globdir = _do_glob('d', $head)) {
Branch: 1 branch
BranchTrueFalseTotal
if (@globdir = _do_glob("d", $head)) 0 0 0
2448 0 push @glob, _do_glob($cond, map {"$_$pathsep$tail"} @globdir);
2449 0 next OUTER;
2450 }
2451 }
2452 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
2453 0 $head .= $pathsep;
2454 }
2455 0 $expr = $tail;
2456 }
2457  
2458 # If file component has no wildcards, we can avoid opendir
2459 0 ▶ if ($expr !~ / \A (?:$q_char)*? [*?] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($expr =~ / \A (?:$Elatin6::q_char)*? [*?] /mosx) 0 0 0
2460 0 ▶ if ($head eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($head eq ".") 0 0 0
2461 0 $head = '';
2462 }
2463 0 ▶ if ($head ne '' and ($head =~ / \G ($q_char) /oxmsg)[-1] ne $pathsep) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head ne "" and ($head =~ / \G ($Elatin6::q_char) /gmosx)[-1] ne $pathsep) 0 0 0
Condition0%0/3
$head ne "" and ($head =~ / \G ($Elatin6::q_char) /gmosx)[-1] ne $pathsep
!ll&&!rl&&r
000
MC/DC0%0/2
$head ne "" and ($head =~ / \G ($Elatin6::q_char) /gmosx)[-1] ne $pathsep
$head ne "" ($head =~ / \G ($Elatin6::q_char) /gmosx)[-1] ne $pathsep
Truth table0%0/3
A and B
A= $head ne ""B= ($head =~ / \G ($Elatin6::q_char) /gmosx)[-1] ne $pathsep
ABresult
0X0
100
111
2464 0 $head .= $pathsep;
2465 }
2466 0 $head .= $expr;
2467 0 ▶ if ($cond eq 'd') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cond eq 'd') { } 0 0 0
2468 0 ▶ if (-d $head) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $head) 0 0 0
2469 0 push @glob, $head;
2470 }
2471 }
2472 else {
2473 0 ▶ if (-e $head) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $head) 0 0 0
2474 0 push @glob, $head;
2475 }
2476 }
2477 0 next OUTER;
2478 }
2479 0 ▶ opendir(*DIR, $head) or next OUTER;
Branch: 1 branch
BranchTrueFalseTotal
opendir *DIR, $head or next OUTER 0 0 0
2480 0 my @leaf = readdir DIR;
2481 0 closedir DIR;
2482  
2483 0 ▶ if ($head eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($head eq ".") 0 0 0
2484 0 $head = '';
2485 }
2486 0 ▶ if ($head ne '' and ($head =~ / \G ($q_char) /oxmsg)[-1] ne $pathsep) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head ne "" and ($head =~ / \G ($Elatin6::q_char) /gmosx)[-1] ne $pathsep) 0 0 0
Condition0%0/3
$head ne "" and ($head =~ / \G ($Elatin6::q_char) /gmosx)[-1] ne $pathsep
!ll&&!rl&&r
000
MC/DC0%0/2
$head ne "" and ($head =~ / \G ($Elatin6::q_char) /gmosx)[-1] ne $pathsep
$head ne "" ($head =~ / \G ($Elatin6::q_char) /gmosx)[-1] ne $pathsep
Truth table0%0/3
A and B
A= $head ne ""B= ($head =~ / \G ($Elatin6::q_char) /gmosx)[-1] ne $pathsep
ABresult
0X0
100
111
2487 0 $head .= $pathsep;
2488 }
2489  
2490 0 my $pattern = '';
2491 0 ▶ while ($expr =~ / \G ($q_char) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expr =~ / \G ($Elatin6::q_char) /cgox) 0 0 0
2492 0 my $char = $1;
2493  
2494 # 6.9. Matching Shell Globs as Regular Expressions
2495 # in Chapter 6. Pattern Matching
2496 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2497 # (and so on)
2498  
2499 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
2500 0 $pattern .= "(?:$your_char)*",
2501 }
2502 elsif ($char eq '?') {
2503 0 $pattern .= "(?:$your_char)?", # DOS style
2504 # $pattern .= "(?:$your_char)", # UNIX style
2505 }
2506 elsif ((my $fc = Elatin6::fc($char)) ne $char) {
2507 0 $pattern .= $fc;
2508 }
2509 else {
2510 0 $pattern .= quotemeta $char;
2511 }
2512 }
2513 0 ▶ my $matchsub = sub { Elatin6::fc($_[0]) =~ /\A $pattern \z/xms };
Subroutine __ANON__: not called CC=1 SCAR=6.9
2514  
2515 # if ($@) {
2516 # print STDERR "$0: $@\n";
2517 # next OUTER;
2518 # }
2519  
2520 INNER:
2521 0 for my $leaf (@leaf) {
2522 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
2523 0 next INNER;
2524 }
2525 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
2526 0 next INNER;
2527 }
2528  
2529 0 ▶ if (&$matchsub($leaf)) {
Branch: 1 branch
BranchTrueFalseTotal
if (&$matchsub($leaf)) 0 0 0
2530 0 push @matched, "$head$leaf";
2531 0 next INNER;
2532 }
2533  
2534 # [DOS compatibility special case]
2535 # Failed, add a trailing dot and try again, but only...
2536  
2537 0 ▶ if (Elatin6::index($leaf,'.') == -1 and # if name does not have a dot in it *and*
Branch: 1 branch
BranchTrueFalseTotal
if (&Elatin6::index($leaf, ".") == -1 and length $leaf <= 8 and &Elatin6::index($pattern, "\\.") != -1) 0 0 0
Condition0%0/6
&Elatin6::index($leaf, ".") == -1 and length $leaf <= 8 and &Elatin6::index($pattern, "\\.") != -1
!ll&&!rl&&r
000
&Elatin6::index($leaf, ".") == -1 and length $leaf <= 8
!ll&&!rl&&r
000
MC/DC0%0/3
&Elatin6::index($leaf, ".") == -1 and length $leaf <= 8 and &Elatin6::index($pattern, "\\.") != -1
&Elatin6::index($leaf, ".") == -1 length $leaf <= 8 &Elatin6::index($pattern, "\\.") != -1
Truth table0%0/4
A and B and C
A= &Elatin6::index($leaf, ".") == -1B= length $leaf <= 8C= &Elatin6::index($pattern, "\\.") != -1
ABCresult
0XX0
10X0
1100
1111
2538 CORE::length($leaf) <= 8 and # name is shorter than or equal to 8 chars *and*
2539 Elatin6::index($pattern,'\\.') != -1 # pattern has a dot.
2540 ) {
2541 0 ▶ if (&$matchsub("$leaf.")) {
Branch: 1 branch
BranchTrueFalseTotal
if (&$matchsub("$leaf.")) 0 0 0
2542 0 push @matched, "$head$leaf";
2543 0 next INNER;
2544 }
2545 }
2546 }
2547 0 ▶ if (@matched) {
Branch: 1 branch
BranchTrueFalseTotal
if (@matched) 0 0 0
2548 0 push @glob, @matched;
2549 }
2550 }
2551 0 ▶ if ($fix_drive_relative_paths) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fix_drive_relative_paths) 0 0 0
2552 0 for my $glob (@glob) {
2553 0 $glob =~ s# \A ([A-Za-z]:) \./ #$1#oxms;
2554 }
2555 }
2556 0 return @glob;
2557 }
2558  
2559 #
2560 # Latin-6 parse line
2561 #
2562 0 ▶sub _parse_line {
Subroutine _parse_line: not called CC=3 SCAR=24.8
2563  
2564 0 my($line) = @_;
2565  
2566 0 $line .= ' ';
2567 0 my @piece = ();
2568 0 ▶ while ($line =~ /
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ / " ( (?>(?: [^"] )* ) ) " (?>\s+) | ( (?>(?: [^"\s] )* ) ) (?>\s+) /gmosx) 0 0 0
2569 " ( (?>(?: [^"] )* ) ) " (?>\s+) |
2570 ( (?>(?: [^"\s] )* ) ) (?>\s+)
2571 /oxmsg
2572 ) {
2573 0 ▶ push @piece, defined($1) ? $1 : $2;
Branch: 1 branch
BranchTrueFalseTotal
defined $1 ? : 0 0 0
2574 }
2575 0 return @piece;
2576 }
2577  
2578 #
2579 # Latin-6 parse path
2580 #
2581 0 ▶sub _parse_path {
Subroutine _parse_path: not called CC=2 SCAR=17.9
2582  
2583 0 my($path,$pathsep) = @_;
2584  
2585 0 $path .= '/';
2586 0 my @subpath = ();
2587 0 ▶ while ($path =~ /
Branch: 1 branch
BranchTrueFalseTotal
if ($path =~ m( ((?: [^/\\] )+?) [/\\] )gmosx) 0 0 0
2588 ((?: [^\/\\] )+?) [\/\\]
2589 /oxmsg
2590 ) {
2591 0 push @subpath, $1;
2592 }
2593  
2594 0 my $tail = pop @subpath;
2595 0 my $head = join $pathsep, @subpath;
2596 0 return $head, $tail;
2597 }
2598  
2599 #
2600 # via File::HomeDir::Windows 1.00
2601 #
2602 0 ▶sub my_home_MSWin32 {
Subroutine my_home_MSWin32: not called CC=9 SCAR=45.0
Pod undocumented
2603  
2604 # A lot of unix people and unix-derived tools rely on
2605 # the ability to overload HOME. We will support it too
2606 # so that they can replace raw HOME calls with File::HomeDir.
2607 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
2608 0 return $ENV{'HOME'};
2609 }
2610  
2611 # Do we have a user profile?
2612 ▶ 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
2613 0 return $ENV{'USERPROFILE'};
2614 }
2615  
2616 # Some Windows use something like $ENV{'HOME'}
2617 ▶ 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
2618 0 return join '', $ENV{'HOMEDRIVE'}, $ENV{'HOMEPATH'};
2619 }
2620  
2621 0 return undef;
2622 }
2623  
2624 #
2625 # via File::HomeDir::Unix 1.00
2626 #
2627 0 ▶sub my_home {
Subroutine my_home: not called CC=7 SCAR=40.3
Pod undocumented
2628 0 my $home;
2629  
2630 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
2631 0 $home = $ENV{'HOME'};
2632 }
2633  
2634 # This is from the original code, but I'm guessing
2635 # it means "login directory" and exists on some Unixes.
2636 ▶ 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
2637 0 $home = $ENV{'LOGDIR'};
2638 }
2639  
2640 ### More-desperate methods
2641  
2642 # Light desperation on any (Unixish) platform
2643 else {
2644 0 $home = CORE::eval q{ (getpwuid($<))[7] };
2645 }
2646  
2647 # On Unix in general, a non-existant home means "no home"
2648 # For example, "nobody"-like users might use /nonexistant
2649 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
2650 0 $home = undef;
2651 }
2652 0 return $home;
2653 }
2654  
2655 #
2656 # ${^PREMATCH}, $PREMATCH, $` the string preceding what was matched
2657 #
2658 56 ▶sub Elatin6::PREMATCH {
Subroutine PREMATCH: called CC=1 SCAR=0.0
Pod undocumented
2659 56 return $`;
2660 }
2661  
2662 #
2663 # ${^MATCH}, $MATCH, $& the string that matched
2664 #
2665 81 ▶sub Elatin6::MATCH {
Subroutine MATCH: called CC=1 SCAR=0.0
Pod undocumented
2666 81 return $&;
2667 }
2668  
2669 #
2670 # ${^POSTMATCH}, $POSTMATCH, $' the string following what was matched
2671 #
2672 42 ▶sub Elatin6::POSTMATCH {
Subroutine POSTMATCH: called CC=1 SCAR=0.0
Pod undocumented
2673 42 return $';
2674 }
2675  
2676 #
2677 # Latin-6 character to order (with parameter)
2678 #
2679 0 ▶sub Latin6::ord(;$) {
Subroutine ord: not called CC=4 SCAR=30.0
2680  
2681 0 ▶ local $_ = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
2682  
2683 0 ▶ if (/\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\A ($Elatin6::q_char) /mosx) { } 0 0 0
2684 0 my @ord = unpack 'C*', $1;
2685 0 my $ord = 0;
2686 0 ▶ while (my $o = shift @ord) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $o = shift @ord) 0 0 0
2687 0 $ord = $ord * 0x100 + $o;
2688 }
2689 0 return $ord;
2690 }
2691 else {
2692 0 return CORE::ord $_;
2693 }
2694 }
2695  
2696 #
2697 # Latin-6 character to order (without parameter)
2698 #
2699 0 ▶sub Latin6::ord_() {
Subroutine ord_: not called CC=3 SCAR=24.8
2700  
2701 0 ▶ if (/\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\A ($Elatin6::q_char) /mosx) { } 0 0 0
2702 0 my @ord = unpack 'C*', $1;
2703 0 my $ord = 0;
2704 0 ▶ while (my $o = shift @ord) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $o = shift @ord) 0 0 0
2705 0 $ord = $ord * 0x100 + $o;
2706 }
2707 0 return $ord;
2708 }
2709 else {
2710 0 return CORE::ord $_;
2711 }
2712 }
2713  
2714 #
2715 # Latin-6 reverse
2716 #
2717 0 ▶sub Latin6::reverse(@) {
Subroutine reverse: not called CC=2 SCAR=17.9
2718  
2719 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2720 0 return CORE::reverse @_;
2721 }
2722 else {
2723  
2724 # One of us once cornered Larry in an elevator and asked him what
2725 # problem he was solving with this, but he looked as far off into
2726 # the distance as he could in an elevator and said, "It seemed like
2727 # a good idea at the time."
2728  
2729 0 return join '', CORE::reverse(join('',@_) =~ /\G ($q_char) /oxmsg);
2730 }
2731 }
2732  
2733 #
2734 # Latin-6 getc (with parameter, without parameter)
2735 #
2736 20 ▶sub Latin6::getc(;*@) {
Subroutine getc: called CC=9 SCAR=26.7
2737  
2738 20 my($package) = caller;
2739 20 ▶ my $fh = @_ ? qualify_to_ref(shift,$package) : \*STDIN;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 20 0 20
2740 20 ▶ croak 'Too many arguments for Latin6::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
2741  
2742 0 my @length = sort { $a <=> $b } keys %range_tr;
2743 20 my $getc = '';
2744 20 for my $length ($length[0] .. $length[-1]) {
2745 20 $getc .= CORE::getc($fh);
2746 20 ▶ if (exists $range_tr{CORE::length($getc)}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{length $getc}) 20 0 20
2747 20 ▶ if ($getc =~ /\A ${Elatin6::dot_s} \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($getc =~ /\A $Elatin6::dot_s \z/mosx) 20 0 20
2748 20 ▶ return wantarray ? ($getc,@_) : $getc;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 20 20
2749 }
2750 }
2751 }
2752 0 ▶ return wantarray ? ($getc,@_) : $getc;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
2753 }
2754  
2755 #
2756 # Latin-6 length by character
2757 #
2758 0 ▶sub Latin6::length(;$) {
Subroutine length: not called CC=2 SCAR=17.9
2759  
2760 0 ▶ local $_ = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
2761  
2762 0 local @_ = /\G ($q_char) /oxmsg;
2763 0 return scalar @_;
2764 }
2765  
2766 #
2767 # Latin-6 substr by character
2768 #
2769 424 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=7.0
2770  
2771 # P.232 The lvalue Attribute
2772 # in Chapter 6: Subroutines
2773 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2774  
2775 # P.336 The lvalue Attribute
2776 # in Chapter 7: Subroutines
2777 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2778  
2779 # P.144 8.4 Lvalue subroutines
2780 # in Chapter 8: perlsub: Perl subroutines
2781 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
2782  
2783 0 ▶ CORE::eval sprintf(<<'END', ($] >= 5.014000) ? ':lvalue' : '');
Subroutine __ANON__: not called CC=1 SCAR=0.0
Subroutine __ANON__: not called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: not called CC=1 SCAR=0.0
Subroutine substr: called CC=11 SCAR=24.3
Branch: 10 branches
BranchTrueFalseTotal
$] >= 5.014 ? : 424 0 424
if ($offset > scalar @char or $offset < -1 * scalar(@char)) 2 25 27
if (@_ == 4) { } 1 24 25
elsif (@_ == 3) { } 21 3 24
if ($offset == 0) { } 0 21 21
elsif ($offset > 0) { } 20 1 21
if ($length == 0) { } 0 21 21
elsif ($length > 0) { } 20 1 21
if ($offset == 0) { } 0 3 3
elsif ($offset > 0) { } 2 1 3
Condition66%2/3
$offset > scalar @char or $offset < -1 * scalar(@char)
l!l&&r!l&&!r
2025
MC/DC50%1/2
$offset > scalar @char or $offset < -1 * scalar(@char)
$offset > scalar @char $offset < -1 * scalar(@char)
Truth table66%2/3
A or B
A= $offset > scalar @charB= $offset < -1 * scalar(@char)
ABresult
1X1
011
000
2784 # vv----------------------*******
2785 sub Latin6::substr($$;$$) %s {
2786  
2787 my @char = $_[0] =~ /\G (?>$q_char) /oxmsg;
2788  
2789 # If the substring is beyond either end of the string, substr() returns the undefined
2790 # value and produces a warning. When used as an lvalue, specifying a substring that
2791 # is entirely outside the string raises an exception.
2792 # http://perldoc.perl.org/functions/substr.html
2793  
2794 # A return with no argument returns the scalar value undef in scalar context,
2795 # an empty list () in list context, and (naturally) nothing at all in void
2796 # context.
2797  
2798 my $offset = $_[1];
2799 if (($offset > scalar(@char)) or ($offset < (-1 * scalar(@char)))) {
2800 return;
2801 }
2802  
2803 # substr($string,$offset,$length,$replacement)
2804 if (@_ == 4) {
2805 my(undef,undef,$length,$replacement) = @_;
2806 my $substr = join '', splice(@char, $offset, $length, $replacement);
2807 $_[0] = join '', @char;
2808  
2809 # return $substr; this doesn't work, don't say "return"
2810 $substr;
2811 }
2812  
2813 # substr($string,$offset,$length)
2814 elsif (@_ == 3) {
2815 my(undef,undef,$length) = @_;
2816 my $octet_offset = 0;
2817 my $octet_length = 0;
2818 if ($offset == 0) {
2819 $octet_offset = 0;
2820 }
2821 elsif ($offset > 0) {
2822 local $SIG{__WARN__} = sub {}; # avoid: Use of uninitialized value in join or string at here
2823 $octet_offset = CORE::length(join '', @char[0..$offset-1]);
2824 }
2825 else {
2826 local $SIG{__WARN__} = sub {}; # avoid: Use of uninitialized value in join or string at here
2827 $octet_offset = -1 * CORE::length(join '', @char[$#char+$offset+1..$#char]);
2828 }
2829 if ($length == 0) {
2830 $octet_length = 0;
2831 }
2832 elsif ($length > 0) {
2833 local $SIG{__WARN__} = sub {}; # avoid: Use of uninitialized value in join or string at here
2834 $octet_length = CORE::length(join '', @char[$offset..$offset+$length-1]);
2835 }
2836 else {
2837 local $SIG{__WARN__} = sub {}; # avoid: Use of uninitialized value in join or string at here
2838 $octet_length = -1 * CORE::length(join '', @char[$#char+$length+1..$#char]);
2839 }
2840 CORE::substr($_[0], $octet_offset, $octet_length);
2841 }
2842  
2843 # substr($string,$offset)
2844 else {
2845 my $octet_offset = 0;
2846 if ($offset == 0) {
2847 $octet_offset = 0;
2848 }
2849 elsif ($offset > 0) {
2850 $octet_offset = CORE::length(join '', @char[0..$offset-1]);
2851 }
2852 else {
2853 $octet_offset = -1 * CORE::length(join '', @char[$#char+$offset+1..$#char]);
2854 }
2855 CORE::substr($_[0], $octet_offset);
2856 }
2857 }
2858 END
2859 }
2860  
2861 #
2862 # Latin-6 index by character
2863 #
2864 0 ▶sub Latin6::index($$;$) {
Subroutine index: not called CC=3 SCAR=24.8
2865  
2866 0 my $index;
2867 0 ▶ if (@_ == 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 3) { } 0 0 0
2868 0 $index = Elatin6::index($_[0], $_[1], CORE::length(Latin6::substr($_[0], 0, $_[2])));
2869 }
2870 else {
2871 0 $index = Elatin6::index($_[0], $_[1]);
2872 }
2873  
2874 0 ▶ if ($index == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($index == -1) { } 0 0 0
2875 0 return -1;
2876 }
2877 else {
2878 0 return Latin6::length(CORE::substr $_[0], 0, $index);
2879 }
2880 }
2881  
2882 #
2883 # Latin-6 rindex by character
2884 #
2885 0 ▶sub Latin6::rindex($$;$) {
Subroutine rindex: not called CC=3 SCAR=24.8
2886  
2887 0 my $rindex;
2888 0 ▶ if (@_ == 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 3) { } 0 0 0
2889 0 $rindex = Elatin6::rindex($_[0], $_[1], CORE::length(Latin6::substr($_[0], 0, $_[2])));
2890 }
2891 else {
2892 0 $rindex = Elatin6::rindex($_[0], $_[1]);
2893 }
2894  
2895 0 ▶ if ($rindex == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rindex == -1) { } 0 0 0
2896 0 return -1;
2897 }
2898 else {
2899 0 return Latin6::length(CORE::substr $_[0], 0, $rindex);
2900 }
2901 }
2902  
2903 # when 'm//', '/' means regexp match 'm//' and '?' means regexp match '??'
2904 # when 'div', '/' means division operator and '?' means conditional operator (condition ? then : else)
2905 424 ▶use vars qw($slash); $slash = 'm//';
Subroutine BEGIN: called CC=1 SCAR=0.0
2906  
2907 # ord() to ord() or Latin6::ord()
2908 424 my $function_ord = 'ord';
2909  
2910 # ord to ord or Latin6::ord_
2911 424 my $function_ord_ = 'ord';
2912  
2913 # reverse to reverse or Latin6::reverse
2914 424 my $function_reverse = 'reverse';
2915  
2916 # getc to getc or Latin6::getc
2917 424 my $function_getc = 'getc';
2918  
2919 # P.1023 Appendix W.9 Multibyte Anchoring
2920 # of ISBN 1-56592-224-7 CJKV Information Processing
2921  
2922 424 my $anchor = '';
2923  
2924 424 ▶use vars qw($nest);
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
2925  
2926 # regexp of nested parens in qqXX
2927  
2928 # P.340 Matching Nested Constructs with Embedded Code
2929 # in Chapter 7: Perl
2930 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
2931  
2932 my $qq_paren = qr{(?{local $nest=0}) (?>(?:
2933 [^\\()] |
2934 \( (?{$nest++}) |
2935 \) (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2936 \\ [^c] |
2937 \\c[\x40-\x5F] |
2938 [\x00-\xFF]
2939 424 }xms;
2940  
2941 my $qq_brace = qr{(?{local $nest=0}) (?>(?:
2942 [^\\{}] |
2943 \{ (?{$nest++}) |
2944 \} (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2945 \\ [^c] |
2946 \\c[\x40-\x5F] |
2947 [\x00-\xFF]
2948 424 }xms;
2949  
2950 my $qq_bracket = qr{(?{local $nest=0}) (?>(?:
2951 [^\\\[\]] |
2952 \[ (?{$nest++}) |
2953 \] (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2954 \\ [^c] |
2955 \\c[\x40-\x5F] |
2956 [\x00-\xFF]
2957 424 }xms;
2958  
2959 my $qq_angle = qr{(?{local $nest=0}) (?>(?:
2960 [^\\<>] |
2961 \< (?{$nest++}) |
2962 \> (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2963 \\ [^c] |
2964 \\c[\x40-\x5F] |
2965 [\x00-\xFF]
2966 424 }xms;
2967  
2968 424 my $qq_scalar = qr{(?: \{ (?:$qq_brace)*? \} |
2969 (?: ::)? (?:
2970 (?> [a-zA-Z_][a-zA-Z_0-9]* (?: ::[a-zA-Z_][a-zA-Z_0-9]*)* )
2971 (?>(?: \[ (?: \$\[ | \$\] | $qq_char )*? \] | \{ (?:$qq_brace)*? \} )*)
2972 (?>(?: (?: -> )? (?: [\$\@\%\&\*]\* | \$\#\* | [\@\%]? \[ (?: \$\[ | \$\] | $qq_char )*? \] | [\@\%\*]? \{ (?:$qq_brace)*? \} ) )*)
2973 ))
2974 }xms;
2975  
2976 424 my $qq_variable = qr{(?: \{ (?:$qq_brace)*? \} |
2977 (?: ::)? (?:
2978 (?>[0-9]+) |
2979 [^a-zA-Z_0-9\[\]] |
2980 ^[A-Z] |
2981 (?> [a-zA-Z_][a-zA-Z_0-9]* (?: ::[a-zA-Z_][a-zA-Z_0-9]*)* )
2982 (?>(?: \[ (?: \$\[ | \$\] | $qq_char )*? \] | \{ (?:$qq_brace)*? \} )*)
2983 (?>(?: (?: -> )? (?: [\$\@\%\&\*]\* | \$\#\* | [\@\%]? \[ (?: \$\[ | \$\] | $qq_char )*? \] | [\@\%\*]? \{ (?:$qq_brace)*? \} ) )*)
2984 ))
2985 }xms;
2986  
2987 424 my $qq_substr = qr{(?> Char::substr | Latin6::substr | CORE::substr | substr ) (?>\s*) \( $qq_paren \)
2988 }xms;
2989  
2990 # regexp of nested parens in qXX
2991 my $q_paren = qr{(?{local $nest=0}) (?>(?:
2992 [^()] |
2993 \( (?{$nest++}) |
2994 \) (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2995 [\x00-\xFF]
2996 424 }xms;
2997  
2998 my $q_brace = qr{(?{local $nest=0}) (?>(?:
2999 [^\{\}] |
3000 \{ (?{$nest++}) |
3001 \} (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
3002 [\x00-\xFF]
3003 424 }xms;
3004  
3005 my $q_bracket = qr{(?{local $nest=0}) (?>(?:
3006 [^\[\]] |
3007 \[ (?{$nest++}) |
3008 \] (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
3009 [\x00-\xFF]
3010 424 }xms;
3011  
3012 my $q_angle = qr{(?{local $nest=0}) (?>(?:
3013 [^<>] |
3014 \< (?{$nest++}) |
3015 \> (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
3016 [\x00-\xFF]
3017 424 }xms;
3018  
3019 424 my $matched = '';
3020 424 my $s_matched = '';
3021  
3022 424 my $tr_variable = ''; # variable of tr///
3023 424 my $sub_variable = ''; # variable of s///
3024 424 my $bind_operator = ''; # =~ or !~
3025  
3026 424 my @heredoc = (); # here document
3027 424 my @heredoc_delimiter = ();
3028 424 my $here_script = ''; # here script
3029  
3030 #
3031 # escape Latin-6 script
3032 #
3033 548 ▶sub Latin6::escape(;$) {
Subroutine escape: called CC=3 SCAR=11.0
3034 548 ▶ local($_) = $_[0] if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 292 256 548
3035  
3036 # P.359 The Study Function
3037 # in Chapter 7: Perl
3038 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3039  
3040 548 study $_; # Yes, I studied study yesterday.
3041  
3042 # while all script
3043  
3044 # 6.14. Matching from Where the Last Pattern Left Off
3045 # in Chapter 6. Pattern Matching
3046 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
3047 # (and so on)
3048  
3049 # one member of Tag-team
3050 #
3051 # P.128 Start of match (or end of previous match): \G
3052 # P.130 Advanced Use of \G with Perl
3053 # in Chapter 3: Overview of Regular Expression Features and Flavors
3054 # P.255 Use leading anchors
3055 # P.256 Expose ^ and \G at the front expressions
3056 # in Chapter 6: Crafting an Efficient Expression
3057 # P.315 "Tag-team" matching with /gc
3058 # in Chapter 7: Perl
3059 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3060  
3061 548 my $e_script = '';
3062 548 ▶ while (not /\G \z/oxgc) { # member
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 86734 548 87282
3063 86734 $e_script .= Latin6::escape_token();
3064 }
3065  
3066 548 return $e_script;
3067 }
3068  
3069 #
3070 # escape Latin-6 token of script
3071 #
3072 86734 ▶sub Latin6::escape_token {
Subroutine escape_token: called CC=504 SCAR=109.3
3073  
3074 # \n output here document
3075  
3076 86734 my $ignore_modules = join('|', qw(
3077 utf8
3078 bytes
3079 charnames
3080 I18N::Japanese
3081 I18N::Collate
3082 I18N::JExt
3083 File::DosGlob
3084 Wild
3085 Wildcard
3086 Japanese
3087 ));
3088  
3089 # another member of Tag-team
3090 #
3091 # P.315 "Tag-team" matching with /gc
3092 # in Chapter 7: Perl
3093 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3094  
3095 86734 ▶ if (/\G ( \n ) /oxgc) { # another member (and so on)
Branch: 139 branches
BranchTrueFalseTotal
if (/\G ( \n ) /cgox) { } 12841 73893 86734
elsif (/\G ((?>\s+)|\#.*) /cgox) { } 21447 52446 73893
elsif (/\G ( (?: if | elsif | unless | while | until | given | when ) (?>\s*) \( ) /cgox) { } 1644 50802 52446
elsif (/\G ( \( (?>\s*) (?: local \b | my \b | our \b | state \b )? (?>\s*) \$ $qq_scalar ) /cgox) { } 90 50712 50802
elsif (/\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /cgmosx) { } 4 50708 50712
elsif (/\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /cgmosx) { } 28 50680 50708
elsif (/\G ( \$' | \$\{'\} ) /cgmosx) { } 1 50679 50680
elsif (/\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /cgmosx) { } 3 50676 50679
elsif (/\G ( \$ $qq_scalar | $qq_substr ) /cgox) { } 1754 48922 50676
elsif (/\G ( [,;] ) /cgox) { } 5098 43824 48922
elsif (/\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /cgmosx) { } 0 43824 43824
elsif (/\G ( \$ 0 ) /cgmosx) { } 2 43822 43824
elsif (/\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /cgmosx) { } 0 43822 43822
elsif (/\G ( \$ \$ ) (?![\w\{]) /cgmosx) { } 1 43821 43822
elsif (/\G \$ ((?>[1-9][0-9]*)) /cgmosx) { } 4 43817 43821
elsif (/\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /cgmosx) { } 0 43817 43817
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /cgmosx) { } 0 43817 43817
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /cgmosx) { } 0 43817 43817
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /cgmosx) { } 0 43817 43817
elsif (/\G \$ (?>\s*) \{ ( (?>\s*) (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* ) (?>\s*) ) \} /cgmosx) { } 0 43817 43817
elsif (/\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /cgmosx) { } 0 43817 43817
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 43775 43817
elsif (m{\G ( \$[\$\@\#\\\'\"/\?\(\)\[\]\<\>] ) }cgmosx) { } 63 43712 43775
elsif (/\G \b (while (?>\s*) \( (?>\s*) <[\$]?[A-Za-z_][A-Za-z_0-9]*> (?>\s*) \)) \b /cgox) { } 0 43712 43712
elsif (/\G \b while (?>\s*) \( (?>\s*) < ((?:[^>\0\a\e\f\n\r\t])+?) > (?>\s*) \) \b /cgox) { } 0 43712 43712
elsif (/\G \b while (?>\s*) \( (?>\s*) glob (?>\s*) \) /cgox) { } 0 43712 43712
elsif (/\G \b while (?>\s*) \( (?>\s*) glob \b /cgox) { } 0 43712 43712
elsif (/\G \b ( if | unless | while | until | for | when ) \b /cgox) { } 251 43461 43712
elsif (/\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /cgox) { } 19 43442 43461
elsif (/\G \b Char::eval (?= (?>\s*) \{ ) /cgox) { } 0 43442 43442
elsif (/\G \b Latin6::eval (?= (?>\s*) \{ ) /cgox) { } 22 43420 43442
elsif (/\G \b Char::eval \b (?! (?>\s*) => ) /cgox) { } 0 43420 43420
elsif (/\G \b Latin6::eval \b (?! (?>\s*) => ) /cgox) { } 168 43252 43420
elsif (/\G \b bytes::substr \b (?! (?>\s*) => ) /cgox) { } 2 43250 43252
elsif (/\G \b chop \b (?! (?>\s*) => ) /cgox) { } 0 43250 43250
elsif (/\G \b bytes::index \b (?! (?>\s*) => ) /cgox) { } 2 43248 43250
elsif (/\G \b Char::index \b (?! (?>\s*) => ) /cgox) { } 0 43248 43248
elsif (/\G \b Latin6::index \b (?! (?>\s*) => ) /cgox) { } 0 43248 43248
elsif (/\G \b index \b (?! (?>\s*) => ) /cgox) { } 0 43248 43248
elsif (/\G \b bytes::rindex \b (?! (?>\s*) => ) /cgox) { } 2 43246 43248
elsif (/\G \b Char::rindex \b (?! (?>\s*) => ) /cgox) { } 0 43246 43246
elsif (/\G \b Latin6::rindex \b (?! (?>\s*) => ) /cgox) { } 0 43246 43246
elsif (/\G \b rindex \b (?! (?>\s*) => ) /cgox) { } 0 43246 43246
elsif (/\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 1 43245 43246
elsif (/\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43245 43245
elsif (/\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 1 43244 43245
elsif (/\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43244 43244
elsif (/\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 6 43238 43244
elsif (/\G -s (?>\s*) (\") ((?:$Elatin6::qq_char)+?) (\") /cgox) { } 0 43238 43238
elsif (/\G -s (?>\s+) qq (?>\s*) (\#) ((?:$Elatin6::qq_char)+?) (\#) /cgox) { } 0 43238 43238
elsif (/\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /cgox) { } 0 43238 43238
elsif (/\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /cgox) { } 0 43238 43238
elsif (/\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /cgox) { } 0 43238 43238
elsif (/\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /cgox) { } 0 43238 43238
elsif (/\G -s (?>\s+) qq (?>\s*) (\S) ((?:$Elatin6::qq_char)+?) (\1) /cgox) { } 0 43238 43238
elsif (/\G -s (?>\s*) (\') ((?:\\\'|\\\\|$Elatin6::q_char)+?) (\') /cgox) { } 0 43238 43238
elsif (/\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$Elatin6::q_char)+?) (\#) /cgox) { } 0 43238 43238
elsif (/\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /cgox) { } 0 43238 43238
elsif (/\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /cgox) { } 0 43238 43238
elsif (/\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /cgox) { } 0 43238 43238
elsif (/\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /cgox) { } 0 43238 43238
elsif (/\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$Elatin6::q_char)+?) (\1) /cgox) { } 0 43238 43238
elsif (/\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)* ) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ) )*) /cgox) { } 0 43238 43238
elsif (/\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /cgox) { } 0 43238 43238
elsif (/\G -s (?= (?>\s+) [a-z]+) /cgox) { } 0 43238 43238
elsif (/\G -s (?>\s+) ((?>\w+)) /cgox) { } 0 43238 43238
elsif (/\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43236 43238
elsif (/\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43234 43236
elsif (/\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 36 43198 43234
elsif (/\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43196 43198
elsif (/\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 8 43188 43196
elsif (/\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43188 43188
elsif (/\G \b lc \b (?! (?>\s*) => ) /cgox) { } 0 43188 43188
elsif (/\G \b lcfirst \b (?! (?>\s*) => ) /cgox) { } 0 43188 43188
elsif (/\G \b uc \b (?! (?>\s*) => ) /cgox) { } 0 43188 43188
elsif (/\G \b ucfirst \b (?! (?>\s*) => ) /cgox) { } 0 43188 43188
elsif (/\G \b fc \b (?! (?>\s*) => ) /cgox) { } 0 43188 43188
elsif (/\G -s \b (?! (?>\s*) => ) /cgox) { } 0 43188 43188
elsif (/\G \b bytes::length \b (?! (?>\s*) => ) /cgox) { } 0 43188 43188
elsif (/\G \b bytes::chr \b (?! (?>\s*) => ) /cgox) { } 0 43188 43188
elsif (/\G \b chr \b (?! (?>\s*) => ) /cgox) { } 0 43188 43188
elsif (/\G \b bytes::ord \b (?! (?>\s*) => ) /cgox) { } 0 43188 43188
elsif (/\G \b ord \b (?! (?>\s*) => ) /cgox) { } 0 43188 43188
elsif (/\G \b glob \b (?! (?>\s*) => ) /cgox) { } 0 43188 43188
elsif (/\G \b reverse \b (?! (?>\s*) => ) /cgox) { } 0 43188 43188
elsif (/\G \b getc \b (?! (?>\s*) => ) /cgox) { } 8 43180 43188
elsif (/\G \b (split) \b (?! (?>\s*) => ) /cgox) { } 87 43093 43180
elsif (/\G \b ( tr | y ) \b /cgox) { } 4 43089 43093
elsif (/\G \b (qq) \b /cgox) { } 2252 40837 43089
elsif (/\G \b (qr) \b /cgox) { } 0 40837 40837
elsif (/\G \b (qw) \b /cgox) { } 16 40821 40837
elsif (/\G \b (qx) \b /cgox) { } 0 40821 40821
elsif (/\G \b (q) \b /cgox) { } 473 40348 40821
elsif (/\G \b (m) \b /cgox) { } 209 40139 40348
elsif (/\G \b (s) \b /cgox) { } 101 40038 40139
elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 0 40038 40038
elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 40038 40038
elsif (/\G \b require ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 40038 40038
elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [#\n]) /cgmosx) { } 37 40001 40038
elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 40001 40001
elsif (/\G \b use ((?>\s+) strict) \b /cgmosx) { } 0 40001 40001
elsif (/\G \b use (?>\s+) ((?>([1-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /cgmosx) { } 2 39999 40001
elsif (/\G \b use (?>\s+) ((?>v([0-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /cgmosx) { } 0 39999 39999
elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 2 39997 39999
elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 39997 39997
elsif (/\G \b use ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 39997 39997
elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 0 39997 39997
elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 39997 39997
elsif (/\G \b no ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 39997 39997
elsif (/\G \b use \b /cgmosx) { } 0 39997 39997
elsif (/\G \b no \b /cgmosx) { } 2 39995 39997
elsif (/\G (?<![\w\$\@\%\&\*]) (\') /cgox) { } 1142 38853 39995
elsif (/\G (\") /cgox) { } 1943 36910 38853
elsif (/\G (\`) /cgox) { } 1 36909 36910
elsif ($Elatin6::slash eq 'm//' and m[\G (/) ]cgox) { } 681 36228 36909
elsif ($Elatin6::slash eq 'm//' and /\G (\?) /cgox) { } 0 36228 36228
elsif (/\G ( <<>> ) /cgox) { } 0 36228 36228
elsif (/\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /cgox) { } 0 36228 36228
elsif (/\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /cgox) { } 6 36222 36228
elsif (/\G ( <<~ \\([a-zA-Z_0-9]+) ) /cgox) { } 3 36219 36222
elsif (/\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /cgox) { } 6 36213 36219
elsif (/\G ( <<~ ([a-zA-Z_0-9]+) ) /cgox) { } 3 36210 36213
elsif (/\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /cgox) { } 6 36204 36210
elsif (/\G ( << '([a-zA-Z_0-9]*)' ) /cgox) { } 72 36132 36204
elsif (/\G ( << \\([a-zA-Z_0-9]+) ) /cgox) { } 0 36132 36132
elsif (/\G ( << "([a-zA-Z_0-9]*)" ) /cgox) { } 36 36096 36132
elsif (/\G ( << ([a-zA-Z_0-9]+) ) /cgox) { } 42 36054 36096
elsif (/\G ( << `([a-zA-Z_0-9]*)` ) /cgox) { } 0 36054 36054
elsif (/\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/cgox) { } 12 36042 36054
elsif (/\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /cgox) { } 0 36042 36042
elsif (/\G < ((?:[^>\0\a\e\f\n\r\t])+?) > /cgox) { } 0 36042 36042
elsif (/\G ^ ( __DATA__ \n .*) \z /cgmosx) { } 0 36042 36042
elsif (/\G ^ ( __END__ \n .*) \z /cgmosx) { } 210 35832 36042
elsif (/\G ( \cD .*) \z /cgmosx) { } 0 35832 35832
elsif (/\G ( \cZ .*) \z /cgmosx) { } 0 35832 35832
elsif (/\G ( -- | \+\+ | [\)\}\]] ) /cgox) { } 5839 29993 35832
elsif (/\G ( \.\.\. ) /cgox) { } 7 29986 29993
elsif (m"\G ((?> !~~ | !~ | != | ! | %= | % | &&= | && | &= | &\.= | &\. | & | -= | -> | - | :(?>\s*)= | : | <<>> | <<= | <=> | <= | < | == | => | =~ | = | >>= | >> | >= | > | \*\*= | \*\* | \*= | \* | \+= | \+ | \.\. | \.= | \. | //= | // | /= | / | \? | \\ | \^= | \^\.= | \^\. | \^ | \b x= | \|\|= | \|\| | \|= | \|\.= | \|\. | \| | ~~ | ~\. | ~ | \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b | \b(?: print )\b | [,;\(\{\[] )) "cgox) { } 9808 20178 29986
elsif (/\G ($Elatin6::q_char) /cgox) { } 20178 0 20178
3096 12841 my $heredoc = '';
3097 12841 ▶ if (scalar(@heredoc_delimiter) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @heredoc_delimiter >= 1) 174 12667 12841
3098 174 $slash = 'm//';
3099  
3100 174 $heredoc = join '', @heredoc;
3101 174 @heredoc = ();
3102  
3103 # skip here document
3104 174 for my $heredoc_delimiter (@heredoc_delimiter) {
3105 174 /\G .*? \n $heredoc_delimiter \n/xmsgc;
3106 }
3107 174 @heredoc_delimiter = ();
3108  
3109 174 $here_script = '';
3110 }
3111 12841 return "\n" . $heredoc;
3112 }
3113  
3114 # ignore space, comment
3115 21447 elsif (/\G ((?>\s+)|\#.*) /oxgc) { return $1; }
3116  
3117 # if (, elsif (, unless (, while (, until (, given (, and when (
3118  
3119 # given, when
3120  
3121 # P.225 The given Statement
3122 # in Chapter 15: Smart Matching and given-when
3123 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
3124  
3125 # P.133 The given Statement
3126 # in Chapter 4: Statements and Declarations
3127 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
3128  
3129 elsif (/\G ( (?: if | elsif | unless | while | until | given | when ) (?>\s*) \( ) /oxgc) {
3130 1644 $slash = 'm//';
3131 1644 return $1;
3132 }
3133  
3134 # scalar variable ($scalar = ...) =~ tr///;
3135 # scalar variable ($scalar = ...) =~ s///;
3136  
3137 # state
3138  
3139 # P.68 Persistent, Private Variables
3140 # in Chapter 4: Subroutines
3141 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
3142  
3143 # P.160 Persistent Lexically Scoped Variables: state
3144 # in Chapter 4: Statements and Declarations
3145 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
3146  
3147 # (and so on)
3148  
3149 elsif (/\G ( \( (?>\s*) (?: local \b | my \b | our \b | state \b )? (?>\s*) \$ $qq_scalar ) /oxgc) {
3150 90 my $e_string = e_string($1);
3151  
3152 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
3153 0 $tr_variable = $e_string . e_string($1);
3154 0 $bind_operator = $2;
3155 0 $slash = 'm//';
3156 0 return '';
3157 }
3158 elsif (/\G ( (?>\s*) = $qq_paren \) ) ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /oxgc) {
3159 0 $sub_variable = $e_string . e_string($1);
3160 0 $bind_operator = $2;
3161 0 $slash = 'm//';
3162 0 return '';
3163 }
3164 else {
3165 90 $slash = 'div';
3166 90 return $e_string;
3167 }
3168 }
3169  
3170 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin6::PREMATCH()
3171 elsif (/\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /oxmsgc) {
3172 4 $slash = 'div';
3173 4 return q{Elatin6::PREMATCH()};
3174 }
3175  
3176 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin6::MATCH()
3177 elsif (/\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /oxmsgc) {
3178 28 $slash = 'div';
3179 28 return q{Elatin6::MATCH()};
3180 }
3181  
3182 # $', ${'} --> $', ${'}
3183 elsif (/\G ( \$' | \$\{'\} ) /oxmsgc) {
3184 1 $slash = 'div';
3185 1 return $1;
3186 }
3187  
3188 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin6::POSTMATCH()
3189 elsif (/\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /oxmsgc) {
3190 3 $slash = 'div';
3191 3 return q{Elatin6::POSTMATCH()};
3192 }
3193  
3194 # scalar variable $scalar =~ tr///;
3195 # scalar variable $scalar =~ s///;
3196 # substr() =~ tr///;
3197 # substr() =~ s///;
3198 elsif (/\G ( \$ $qq_scalar | $qq_substr ) /oxgc) {
3199 1754 my $scalar = e_string($1);
3200  
3201 1754 ▶ if (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= (?: tr | y ) \b ) /oxgc) {
Branch: 2 branches
BranchTrueFalseTotal
if (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= (?: tr | y ) \b ) /cgox) { } 2 1752 1754
elsif (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /cgox) { } 65 1687 1752
3202 2 $tr_variable = $scalar;
3203 2 $bind_operator = $1;
3204 2 $slash = 'm//';
3205 2 return '';
3206 }
3207 elsif (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /oxgc) {
3208 65 $sub_variable = $scalar;
3209 65 $bind_operator = $1;
3210 65 $slash = 'm//';
3211 65 return '';
3212 }
3213 else {
3214 1687 $slash = 'div';
3215 1687 return $scalar;
3216 }
3217 }
3218  
3219 # end of statement
3220 elsif (/\G ( [,;] ) /oxgc) {
3221 5098 $slash = 'm//';
3222  
3223 # clear tr/// variable
3224 5098 $tr_variable = '';
3225  
3226 # clear s/// variable
3227 5098 $sub_variable = '';
3228  
3229 5098 $bind_operator = '';
3230  
3231 5098 return $1;
3232 }
3233  
3234 # bareword
3235 elsif (/\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /oxmsgc) {
3236 0 return $1;
3237 }
3238  
3239 # $0 --> $0
3240 elsif (/\G ( \$ 0 ) /oxmsgc) {
3241 2 $slash = 'div';
3242 2 return $1;
3243 }
3244 elsif (/\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /oxmsgc) {
3245 0 $slash = 'div';
3246 0 return $1;
3247 }
3248  
3249 # $$ --> $$
3250 elsif (/\G ( \$ \$ ) (?![\w\{]) /oxmsgc) {
3251 1 $slash = 'div';
3252 1 return $1;
3253 }
3254  
3255 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
3256 # $1, $2, $3 --> $1, $2, $3 otherwise
3257 elsif (/\G \$ ((?>[1-9][0-9]*)) /oxmsgc) {
3258 4 $slash = 'div';
3259 4 return e_capture($1);
3260 }
3261 elsif (/\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /oxmsgc) {
3262 0 $slash = 'div';
3263 0 return e_capture($1);
3264 }
3265  
3266 # $$foo[ ... ] --> $ $foo->[ ... ]
3267 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /oxmsgc) {
3268 0 $slash = 'div';
3269 0 return e_capture($1.'->'.$2);
3270 }
3271  
3272 # $$foo{ ... } --> $ $foo->{ ... }
3273 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /oxmsgc) {
3274 0 $slash = 'div';
3275 0 return e_capture($1.'->'.$2);
3276 }
3277  
3278 # $$foo
3279 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /oxmsgc) {
3280 0 $slash = 'div';
3281 0 return e_capture($1);
3282 }
3283  
3284 # ${ foo }
3285 elsif (/\G \$ (?>\s*) \{ ( (?>\s*) (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* ) (?>\s*) ) \} /oxmsgc) {
3286 0 $slash = 'div';
3287 0 return '${' . $1 . '}';
3288 }
3289  
3290 # ${ ... }
3291 elsif (/\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /oxmsgc) {
3292 0 $slash = 'div';
3293 0 return e_capture($1);
3294 }
3295  
3296 # variable or function
3297 # $ @ % & * $ #
3298 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) {
3299 42 $slash = 'div';
3300 42 return $1;
3301 }
3302 # $ $ $ $ $ $ $ $ $ $ $ $ $ $
3303 # $ @ # \ ' " / ? ( ) [ ] < >
3304 elsif (/\G ( \$[\$\@\#\\\'\"\/\?\(\)\[\]\<\>] ) /oxmsgc) {
3305 63 $slash = 'div';
3306 63 return $1;
3307 }
3308  
3309 # while (<FILEHANDLE>)
3310 elsif (/\G \b (while (?>\s*) \( (?>\s*) <[\$]?[A-Za-z_][A-Za-z_0-9]*> (?>\s*) \)) \b /oxgc) {
3311 0 return $1;
3312 }
3313  
3314 # while (<WILDCARD>) --- glob
3315  
3316 # avoid "Error: Runtime exception" of perl version 5.005_03
3317  
3318 elsif (/\G \b while (?>\s*) \( (?>\s*) < ((?:[^>\0\a\e\f\n\r\t])+?) > (?>\s*) \) \b /oxgc) {
3319 0 return 'while ($_ = Elatin6::glob("' . $1 . '"))';
3320 }
3321  
3322 # while (glob)
3323 elsif (/\G \b while (?>\s*) \( (?>\s*) glob (?>\s*) \) /oxgc) {
3324 0 return 'while ($_ = Elatin6::glob_)';
3325 }
3326  
3327 # while (glob(WILDCARD))
3328 elsif (/\G \b while (?>\s*) \( (?>\s*) glob \b /oxgc) {
3329 0 return 'while ($_ = Elatin6::glob';
3330 }
3331  
3332 # doit if, doit unless, doit while, doit until, doit for, doit when
3333 251 elsif (/\G \b ( if | unless | while | until | for | when ) \b /oxgc) { $slash = 'm//'; return $1; }
3334  
3335 # subroutines of package Elatin6
3336 19 elsif (/\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /oxgc) { $slash = 'm//'; return $1; }
3337 0 elsif (/\G \b Char::eval (?= (?>\s*) \{ ) /oxgc) { $slash = 'm//'; return 'eval'; }
3338 22 elsif (/\G \b Latin6::eval (?= (?>\s*) \{ ) /oxgc) { $slash = 'm//'; return 'eval'; }
3339 0 elsif (/\G \b Char::eval \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'eval Char::escape'; }
3340 168 elsif (/\G \b Latin6::eval \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'eval Latin6::escape'; }
3341 2 elsif (/\G \b bytes::substr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'substr'; }
3342 0 elsif (/\G \b chop \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin6::chop'; }
3343 2 elsif (/\G \b bytes::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'index'; }
3344 0 elsif (/\G \b Char::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Char::index'; }
3345 0 elsif (/\G \b Latin6::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Latin6::index'; }
3346 0 elsif (/\G \b index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin6::index'; }
3347 2 elsif (/\G \b bytes::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'rindex'; }
3348 0 elsif (/\G \b Char::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Char::rindex'; }
3349 0 elsif (/\G \b Latin6::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Latin6::rindex'; }
3350 0 elsif (/\G \b rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin6::rindex'; }
3351 1 elsif (/\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin6::lc'; }
3352 0 elsif (/\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin6::lcfirst'; }
3353 1 elsif (/\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin6::uc'; }
3354 0 elsif (/\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin6::ucfirst'; }
3355 6 elsif (/\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin6::fc'; }
3356  
3357 # "-s '' ..." means file test "-s 'filename' ..." (not means "- s/// ...")
3358 0 elsif (/\G -s (?>\s*) (\") ((?:$qq_char)+?) (\") /oxgc) { $slash = 'm//'; return '-s ' . e_qq('', $1,$3,$2); }
3359 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\#) ((?:$qq_char)+?) (\#) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3360 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3361 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3362 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3363 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3364 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\S) ((?:$qq_char)+?) (\1) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3365  
3366 0 elsif (/\G -s (?>\s*) (\') ((?:\\\'|\\\\|$q_char)+?) (\') /oxgc) { $slash = 'm//'; return '-s ' . e_q ('', $1,$3,$2); }
3367 0 elsif (/\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$q_char)+?) (\#) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3368 0 elsif (/\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3369 0 elsif (/\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3370 0 elsif (/\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3371 0 elsif (/\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3372 0 elsif (/\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$q_char)+?) (\1) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3373  
3374 elsif (/\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)* ) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ) )*) /oxgc)
3375 0 { $slash = 'm//'; return "-s $1"; }
3376 0 elsif (/\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /oxgc) { $slash = 'm//'; return "-s ($1)"; }
3377 0 elsif (/\G -s (?= (?>\s+) [a-z]+) /oxgc) { $slash = 'm//'; return '-s'; }
3378 0 elsif (/\G -s (?>\s+) ((?>\w+)) /oxgc) { $slash = 'm//'; return "-s $1"; }
3379  
3380 2 elsif (/\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'length'; }
3381 2 elsif (/\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'chr'; }
3382 36 elsif (/\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin6::chr'; }
3383 2 elsif (/\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'div'; return 'ord'; }
3384 8 elsif (/\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'div'; return $function_ord; }
3385 0 elsif (/\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin6::glob'; }
3386 0 elsif (/\G \b lc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin6::lc_'; }
3387 0 elsif (/\G \b lcfirst \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin6::lcfirst_'; }
3388 0 elsif (/\G \b uc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin6::uc_'; }
3389 0 elsif (/\G \b ucfirst \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin6::ucfirst_'; }
3390 0 elsif (/\G \b fc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin6::fc_'; }
3391 0 elsif (/\G -s \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return '-s '; }
3392  
3393 0 elsif (/\G \b bytes::length \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'length'; }
3394 0 elsif (/\G \b bytes::chr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'chr'; }
3395 0 elsif (/\G \b chr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin6::chr_'; }
3396 0 elsif (/\G \b bytes::ord \b (?! (?>\s*) => ) /oxgc) { $slash = 'div'; return 'ord'; }
3397 0 elsif (/\G \b ord \b (?! (?>\s*) => ) /oxgc) { $slash = 'div'; return $function_ord_; }
3398 0 elsif (/\G \b glob \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin6::glob_'; }
3399 0 elsif (/\G \b reverse \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return $function_reverse; }
3400 8 elsif (/\G \b getc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return $function_getc; }
3401 # split
3402 elsif (/\G \b (split) \b (?! (?>\s*) => ) /oxgc) {
3403 87 $slash = 'm//';
3404  
3405 87 my $e = '';
3406 87 ▶ while (/\G ( (?>\s+) | \( | \#.* ) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\G ( (?>\s+) | \( | \#.* ) /cgox) 85 87 172
3407 85 $e .= $1;
3408 }
3409  
3410 # end of split
3411 87 ▶ if (/\G (?= [,;\)\}\]] ) /oxgc) { return 'Elatin6::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
3412  
3413 # split scalar value
3414 1 elsif (/\G ( [\$\@\&\*] $qq_scalar ) /oxgc) { return 'Elatin6::split' . $e . e_string($1); }
3415  
3416 # split literal space
3417 0 elsif (/\G \b qq (\#) [ ] (\#) /oxgc) { return 'Elatin6::split' . $e . qq {qq$1 $2}; }
3418 0 elsif (/\G \b qq ((?>\s*)) (\() [ ] (\)) /oxgc) { return 'Elatin6::split' . $e . qq{$1qq$2 $3}; }
3419 0 elsif (/\G \b qq ((?>\s*)) (\{) [ ] (\}) /oxgc) { return 'Elatin6::split' . $e . qq{$1qq$2 $3}; }
3420 0 elsif (/\G \b qq ((?>\s*)) (\[) [ ] (\]) /oxgc) { return 'Elatin6::split' . $e . qq{$1qq$2 $3}; }
3421 0 elsif (/\G \b qq ((?>\s*)) (\<) [ ] (\>) /oxgc) { return 'Elatin6::split' . $e . qq{$1qq$2 $3}; }
3422 0 elsif (/\G \b qq ((?>\s*)) (\S) [ ] (\2) /oxgc) { return 'Elatin6::split' . $e . qq{$1qq$2 $3}; }
3423 0 elsif (/\G \b q (\#) [ ] (\#) /oxgc) { return 'Elatin6::split' . $e . qq {q$1 $2}; }
3424 0 elsif (/\G \b q ((?>\s*)) (\() [ ] (\)) /oxgc) { return 'Elatin6::split' . $e . qq {$1q$2 $3}; }
3425 0 elsif (/\G \b q ((?>\s*)) (\{) [ ] (\}) /oxgc) { return 'Elatin6::split' . $e . qq {$1q$2 $3}; }
3426 0 elsif (/\G \b q ((?>\s*)) (\[) [ ] (\]) /oxgc) { return 'Elatin6::split' . $e . qq {$1q$2 $3}; }
3427 0 elsif (/\G \b q ((?>\s*)) (\<) [ ] (\>) /oxgc) { return 'Elatin6::split' . $e . qq {$1q$2 $3}; }
3428 0 elsif (/\G \b q ((?>\s*)) (\S) [ ] (\2) /oxgc) { return 'Elatin6::split' . $e . qq {$1q$2 $3}; }
3429 10 elsif (/\G ' [ ] ' /oxgc) { return 'Elatin6::split' . $e . qq {' '}; }
3430 0 elsif (/\G " [ ] " /oxgc) { return 'Elatin6::split' . $e . qq {" "}; }
3431  
3432 # split qq//
3433 elsif (/\G \b (qq) \b /oxgc) {
3434 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin6::qq_char)*?) (\#) /cgox) { } 0 0 0
3435 else {
3436 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3437 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 ([*\-:?\\^|]) ((?:$Elatin6::qq_char)*?) (\1) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin6::qq_char)*?) (\1) /cgox) { } 0 0 0
3438 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq ( ) --> qr ( )
3439 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq { } --> qr { }
3440 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq [ ] --> qr [ ]
3441 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq < > --> qr < >
3442 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) /oxgc) { return e_split($e.'qr','{','}',$2,''); } # qq | | --> qr { }
3443 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq * * --> qr * *
3444 }
3445 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3446 }
3447 }
3448  
3449 # split qr//
3450 elsif (/\G \b (qr) \b /oxgc) {
3451 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1,$3,$2,$4); } # qr# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin6::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 12 12
3452 else {
3453 12 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 12 0 12
3454 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 (\') ((?:$Elatin6::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 12 12
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin6::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 12 12
elsif (/\G (\S) ((?:$Elatin6::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 12 0 12
3455 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr ( )
3456 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr { }
3457 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr [ ]
3458 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr < >
3459 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { return e_split_q($e.'qr',$1, $3, $2,$4); } # qr ' '
3460 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr','{','}',$2,$4); } # qr | | --> qr { }
3461 12 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr * *
3462 }
3463 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3464 }
3465 }
3466  
3467 # split q//
3468 elsif (/\G \b (q) \b /oxgc) {
3469 0 ▶ if (/\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:\\\#|\\\\|$Elatin6::q_char)*?) (\#) /cgox) { } 0 0 0
3470 else {
3471 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3472 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 ([*\-:?\\^|]) ((?:$Elatin6::q_char)*?) (\1) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:\\\\|\\\1| $Elatin6::q_char)*?) (\1) /cgox) { } 0 0 0
3473 0 elsif (/\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q ( ) --> qr ( )
3474 0 elsif (/\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q { } --> qr { }
3475 0 elsif (/\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q [ ] --> qr [ ]
3476 0 elsif (/\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q < > --> qr < >
3477 0 elsif (/\G ([*\-:?\\^|]) ((?:$q_char)*?) (\1) /oxgc) { return e_split_q($e.'qr','{','}',$2,''); } # q | | --> qr { }
3478 0 elsif (/\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q * * --> qr * *
3479 }
3480 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3481 }
3482 }
3483  
3484 # split m//
3485 elsif (/\G \b (m) \b /oxgc) {
3486 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1,$3,$2,$4); } # m# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin6::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
3487 else {
3488 18 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 18 0 18
3489 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 (\') ((?:$Elatin6::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin6::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
elsif (/\G (\S) ((?:$Elatin6::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 18 0 18
3490 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m ( ) --> qr ( )
3491 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m { } --> qr { }
3492 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m [ ] --> qr [ ]
3493 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m < > --> qr < >
3494 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { return e_split_q($e.'qr',$1, $3, $2,$4); } # m ' ' --> qr ' '
3495 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr','{','}',$2,$4); } # m | | --> qr { }
3496 18 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m * * --> qr * *
3497 }
3498 0 die __FILE__, ": Search pattern not terminated\n";
3499 }
3500 }
3501  
3502 # split ''
3503 elsif (/\G (\') /oxgc) {
3504 0 my $q_string = '';
3505 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3506 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 ($Elatin6::q_char) /cgox) { } 0 0 0
3507 0 elsif (/\G (\\\') /oxgc) { $q_string .= $1; } # splitqr'' --> split qr''
3508 0 elsif (/\G \' /oxgc) { return e_split_q($e.q{ qr},"'","'",$q_string,''); } # ' ' --> qr ' '
3509 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3510 }
3511 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3512 }
3513  
3514 # split ""
3515 elsif (/\G (\") /oxgc) {
3516 0 my $qq_string = '';
3517 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3518 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 ($Elatin6::q_char) /cgox) { } 0 0 0
3519 0 elsif (/\G (\\\") /oxgc) { $qq_string .= $1; } # splitqr"" --> split qr""
3520 0 elsif (/\G \" /oxgc) { return e_split($e.q{ qr},'"','"',$qq_string,''); } # " " --> qr " "
3521 0 elsif (/\G ($q_char) /oxgc) { $qq_string .= $1; }
3522 }
3523 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3524 }
3525  
3526 # split //
3527 elsif (/\G (\/) /oxgc) {
3528 44 my $regexp = '';
3529 44 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 381 0 381
3530 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 ($Elatin6::q_char) /cgox) { } 337 0 337
3531 0 elsif (/\G (\\\/) /oxgc) { $regexp .= $1; } # splitqr// --> split qr//
3532 44 elsif (/\G \/ ([cgimosxpadlunbB]*) /oxgc) { return e_split($e.q{ qr}, '/','/',$regexp,$1); } # / / --> qr / /
3533 337 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
3534 }
3535 0 die __FILE__, ": Search pattern not terminated\n";
3536 }
3537 }
3538  
3539 # tr/// or y///
3540  
3541 # about [cdsrbB]* (/B modifier)
3542 #
3543 # P.559 appendix C
3544 # of ISBN 4-89052-384-7 Programming perl
3545 # (Japanese title is: Perl puroguramingu)
3546  
3547 elsif (/\G \b ( tr | y ) \b /oxgc) {
3548 4 my $ope = $1;
3549  
3550 # $1 $2 $3 $4 $5 $6
3551 4 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ((?:$qq_char)*?) (\#) ([cdsrbB]*) /oxgc) { # tr# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin6::qq_char)*?) (\#) ((?:$Elatin6::qq_char)*?) (\#) ([cdsrbB]*) /cgox) { } 0 4 4
3552 0 my @tr = ($tr_variable,$2);
3553 0 return e_tr(@tr,'',$4,$6);
3554 }
3555 else {
3556 4 my $e = '';
3557 4 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 4 0 4
3558 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) ((?:$Elatin6::qq_char)*?) (\1) ((?:$Elatin6::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 4 0 4
3559 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) {
3560 0 my @tr = ($tr_variable,$2);
3561 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3562 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin6::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3563 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) ( )
3564 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) { }
3565 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) [ ]
3566 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) < >
3567 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) * *
3568 }
3569 0 die __FILE__, ": Transliteration replacement not terminated\n";
3570 }
3571 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) {
3572 0 my @tr = ($tr_variable,$2);
3573 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3574 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin6::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3575 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } ( )
3576 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } { }
3577 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } [ ]
3578 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } < >
3579 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } * *
3580 }
3581 0 die __FILE__, ": Transliteration replacement not terminated\n";
3582 }
3583 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) {
3584 0 my @tr = ($tr_variable,$2);
3585 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3586 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin6::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3587 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] ( )
3588 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] { }
3589 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] [ ]
3590 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] < >
3591 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] * *
3592 }
3593 0 die __FILE__, ": Transliteration replacement not terminated\n";
3594 }
3595 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) {
3596 0 my @tr = ($tr_variable,$2);
3597 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3598 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) ((?:$Elatin6::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3599 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > ( )
3600 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > { }
3601 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > [ ]
3602 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > < >
3603 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > * *
3604 }
3605 0 die __FILE__, ": Transliteration replacement not terminated\n";
3606 }
3607 # $1 $2 $3 $4 $5 $6
3608 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { # tr * * *
3609 4 my @tr = ($tr_variable,$2);
3610 4 return e_tr(@tr,'',$4,$6);
3611 }
3612 }
3613 0 die __FILE__, ": Transliteration pattern not terminated\n";
3614 }
3615 }
3616  
3617 # qq//
3618 elsif (/\G \b (qq) \b /oxgc) {
3619 2252 my $ope = $1;
3620  
3621 # if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { return e_qq($ope,$1,$3,$2); } # qq# #
3622 2252 ▶ if (/\G (\#) /oxgc) { # qq# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) /cgox) { } 0 2252 2252
3623 0 my $qq_string = '';
3624 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3625 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 ($Elatin6::qq_char) /cgox) { } 0 0 0
3626 0 elsif (/\G (\\\#) /oxgc) { $qq_string .= $1; }
3627 0 elsif (/\G (\#) /oxgc) { return e_qq($ope,'#','#',$qq_string); }
3628 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3629 }
3630 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3631 }
3632  
3633 else {
3634 2252 my $e = '';
3635 2252 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 2252 0 2252
3636 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
3637  
3638 # elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq ( )
3639 elsif (/\G (\() /oxgc) { # qq ( )
3640 0 my $qq_string = '';
3641 0 local $nest = 1;
3642 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3643 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 ($Elatin6::qq_char) /cgox) { } 0 0 0
3644 0 elsif (/\G (\\\)) /oxgc) { $qq_string .= $1; }
3645 0 elsif (/\G (\() /oxgc) { $qq_string .= $1; $nest++; }
3646 elsif (/\G (\)) /oxgc) {
3647 0 ▶ if (--$nest == 0) { return $e . e_qq($ope,'(',')',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin6::nest == 0) { } 0 0 0
3648 0 else { $qq_string .= $1; }
3649 }
3650 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3651 }
3652 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3653 }
3654  
3655 # elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq { }
3656 elsif (/\G (\{) /oxgc) { # qq { }
3657 2222 my $qq_string = '';
3658 2222 local $nest = 1;
3659 2222 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 85104 0 85104
3660 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 ($Elatin6::qq_char) /cgox) { } 79782 0 79782
3661 0 elsif (/\G (\\\}) /oxgc) { $qq_string .= $1; }
3662 1189 elsif (/\G (\{) /oxgc) { $qq_string .= $1; $nest++; }
3663 elsif (/\G (\}) /oxgc) {
3664 3411 ▶ if (--$nest == 0) { return $e . e_qq($ope,'{','}',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin6::nest == 0) { } 2222 1189 3411
3665 1189 else { $qq_string .= $1; }
3666 }
3667 79782 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3668 }
3669 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3670 }
3671  
3672 # elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq [ ]
3673 elsif (/\G (\[) /oxgc) { # qq [ ]
3674 0 my $qq_string = '';
3675 0 local $nest = 1;
3676 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3677 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 ($Elatin6::qq_char) /cgox) { } 0 0 0
3678 0 elsif (/\G (\\\]) /oxgc) { $qq_string .= $1; }
3679 0 elsif (/\G (\[) /oxgc) { $qq_string .= $1; $nest++; }
3680 elsif (/\G (\]) /oxgc) {
3681 0 ▶ if (--$nest == 0) { return $e . e_qq($ope,'[',']',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin6::nest == 0) { } 0 0 0
3682 0 else { $qq_string .= $1; }
3683 }
3684 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3685 }
3686 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3687 }
3688  
3689 # elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq < >
3690 elsif (/\G (\<) /oxgc) { # qq < >
3691 30 my $qq_string = '';
3692 30 local $nest = 1;
3693 30 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 1166 0 1166
3694 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 ($Elatin6::qq_char) /cgox) { } 1114 0 1114
3695 0 elsif (/\G (\\\>) /oxgc) { $qq_string .= $1; }
3696 0 elsif (/\G (\<) /oxgc) { $qq_string .= $1; $nest++; }
3697 elsif (/\G (\>) /oxgc) {
3698 30 ▶ if (--$nest == 0) { return $e . e_qq($ope,'<','>',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin6::nest == 0) { } 30 0 30
3699 0 else { $qq_string .= $1; }
3700 }
3701 1114 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3702 }
3703 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3704 }
3705  
3706 # elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq * *
3707 elsif (/\G (\S) /oxgc) { # qq * *
3708 0 my $delimiter = $1;
3709 0 my $qq_string = '';
3710 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3711 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 ($Elatin6::qq_char) /cgox) { } 0 0 0
3712 0 elsif (/\G (\\\Q$delimiter\E) /oxgc) { $qq_string .= $1; }
3713 0 elsif (/\G (\Q$delimiter\E) /oxgc) { return $e . e_qq($ope,$delimiter,$delimiter,$qq_string); }
3714 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3715 }
3716 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3717 }
3718 }
3719 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3720 }
3721 }
3722  
3723 # qr//
3724 elsif (/\G \b (qr) \b /oxgc) {
3725 0 my $ope = $1;
3726 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { # qr# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin6::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 0 0
3727 0 return e_qr($ope,$1,$3,$2,$4);
3728 }
3729 else {
3730 0 my $e = '';
3731 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3732 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 (\') ((?:$Elatin6::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin6::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin6::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
3733 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr ( )
3734 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr { }
3735 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr [ ]
3736 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr < >
3737 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { return $e . e_qr_q($ope,$1, $3, $2,$4); } # qr ' '
3738 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,'{','}',$2,$4); } # qr | | --> qr { }
3739 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr * *
3740 }
3741 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3742 }
3743 }
3744  
3745 # qw//
3746 elsif (/\G \b (qw) \b /oxgc) {
3747 16 my $ope = $1;
3748 16 ▶ if (/\G (\#) (.*?) (\#) /oxmsgc) { # qw# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) (.*?) (\#) /cgmosx) { } 0 16 16
3749 0 return e_qw($ope,$1,$3,$2);
3750 }
3751 else {
3752 16 my $e = '';
3753 16 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 16 0 16
3754 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) ((?:$Elatin6::q_char)*?) (\1) /cgmosx) { } 0 0 0
3755  
3756 16 elsif (/\G (\() ([^(]*?) (\)) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw ( )
3757 0 elsif (/\G (\() ((?:$q_paren)*?) (\)) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw ( )
3758  
3759 0 elsif (/\G (\{) ([^{]*?) (\}) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw { }
3760 0 elsif (/\G (\{) ((?:$q_brace)*?) (\}) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw { }
3761  
3762 0 elsif (/\G (\[) ([^[]*?) (\]) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw [ ]
3763 0 elsif (/\G (\[) ((?:$q_bracket)*?) (\]) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw [ ]
3764  
3765 0 elsif (/\G (\<) ([^<]*?) (\>) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw < >
3766 0 elsif (/\G (\<) ((?:$q_angle)*?) (\>) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw < >
3767  
3768 0 elsif (/\G ([\x21-\x3F]) (.*?) (\1) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw * *
3769 0 elsif (/\G (\S) ((?:$q_char)*?) (\1) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw * *
3770 }
3771 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3772 }
3773 }
3774  
3775 # qx//
3776 elsif (/\G \b (qx) \b /oxgc) {
3777 0 my $ope = $1;
3778 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qx# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin6::qq_char)*?) (\#) /cgox) { } 0 0 0
3779 0 return e_qq($ope,$1,$3,$2);
3780 }
3781 else {
3782 0 my $e = '';
3783 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3784 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 (\') ((?:$Elatin6::qq_char)*?) (\') /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin6::qq_char)*?) (\1) /cgox) { } 0 0 0
3785 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx ( )
3786 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx { }
3787 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx [ ]
3788 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx < >
3789 0 elsif (/\G (\') ((?:$qq_char)*?) (\') /oxgc) { return $e . e_q ($ope,$1,$3,$2); } # qx ' '
3790 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx * *
3791 }
3792 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3793 }
3794 }
3795  
3796 # q//
3797 elsif (/\G \b (q) \b /oxgc) {
3798 473 my $ope = $1;
3799  
3800 # if (/\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { return e_q($ope,$1,$3,$2); } # q# #
3801  
3802 # avoid "Error: Runtime exception" of perl version 5.005_03
3803 # (and so on)
3804  
3805 473 ▶ if (/\G (\#) /oxgc) { # q# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) /cgox) { } 0 473 473
3806 0 my $q_string = '';
3807 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3808 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 ($Elatin6::q_char) /cgox) { } 0 0 0
3809 0 elsif (/\G (\\\#) /oxgc) { $q_string .= $1; }
3810 0 elsif (/\G (\#) /oxgc) { return e_q($ope,'#','#',$q_string); }
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 else {
3817 473 my $e = '';
3818 473 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 473 0 473
3819 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
3820  
3821 # elsif (/\G (\() ((?:\\\)|\\\\|$q_paren)*?) (\)) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q ( )
3822 elsif (/\G (\() /oxgc) { # q ( )
3823 0 my $q_string = '';
3824 0 local $nest = 1;
3825 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3826 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 ($Elatin6::q_char) /cgox) { } 0 0 0
3827 0 elsif (/\G (\\\)) /oxgc) { $q_string .= $1; }
3828 0 elsif (/\G (\\\() /oxgc) { $q_string .= $1; }
3829 0 elsif (/\G (\() /oxgc) { $q_string .= $1; $nest++; }
3830 elsif (/\G (\)) /oxgc) {
3831 0 ▶ if (--$nest == 0) { return $e . e_q($ope,'(',')',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin6::nest == 0) { } 0 0 0
3832 0 else { $q_string .= $1; }
3833 }
3834 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3835 }
3836 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3837 }
3838  
3839 # elsif (/\G (\{) ((?:\\\}|\\\\|$q_brace)*?) (\}) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q { }
3840 elsif (/\G (\{) /oxgc) { # q { }
3841 467 my $q_string = '';
3842 467 local $nest = 1;
3843 467 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 8249 0 8249
3844 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 ($Elatin6::q_char) /cgox) { } 7464 0 7464
3845 0 elsif (/\G (\\\}) /oxgc) { $q_string .= $1; }
3846 0 elsif (/\G (\\\{) /oxgc) { $q_string .= $1; }
3847 159 elsif (/\G (\{) /oxgc) { $q_string .= $1; $nest++; }
3848 elsif (/\G (\}) /oxgc) {
3849 626 ▶ if (--$nest == 0) { return $e . e_q($ope,'{','}',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin6::nest == 0) { } 467 159 626
3850 159 else { $q_string .= $1; }
3851 }
3852 7464 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3853 }
3854 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3855 }
3856  
3857 # elsif (/\G (\[) ((?:\\\]|\\\\|$q_bracket)*?) (\]) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q [ ]
3858 elsif (/\G (\[) /oxgc) { # q [ ]
3859 0 my $q_string = '';
3860 0 local $nest = 1;
3861 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3862 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 ($Elatin6::q_char) /cgox) { } 0 0 0
3863 0 elsif (/\G (\\\]) /oxgc) { $q_string .= $1; }
3864 0 elsif (/\G (\\\[) /oxgc) { $q_string .= $1; }
3865 0 elsif (/\G (\[) /oxgc) { $q_string .= $1; $nest++; }
3866 elsif (/\G (\]) /oxgc) {
3867 0 ▶ if (--$nest == 0) { return $e . e_q($ope,'[',']',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin6::nest == 0) { } 0 0 0
3868 0 else { $q_string .= $1; }
3869 }
3870 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3871 }
3872 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3873 }
3874  
3875 # elsif (/\G (\<) ((?:\\\>|\\\\|$q_angle)*?) (\>) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q < >
3876 elsif (/\G (\<) /oxgc) { # q < >
3877 5 my $q_string = '';
3878 5 local $nest = 1;
3879 5 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 88 0 88
3880 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 ($Elatin6::q_char) /cgox) { } 83 0 83
3881 0 elsif (/\G (\\\>) /oxgc) { $q_string .= $1; }
3882 0 elsif (/\G (\\\<) /oxgc) { $q_string .= $1; }
3883 0 elsif (/\G (\<) /oxgc) { $q_string .= $1; $nest++; }
3884 elsif (/\G (\>) /oxgc) {
3885 5 ▶ if (--$nest == 0) { return $e . e_q($ope,'<','>',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin6::nest == 0) { } 5 0 5
3886 0 else { $q_string .= $1; }
3887 }
3888 83 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3889 }
3890 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3891 }
3892  
3893 # elsif (/\G (\S) ((?:\\\1|\\\\|$q_char)*?) (\1) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q * *
3894 elsif (/\G (\S) /oxgc) { # q * *
3895 1 my $delimiter = $1;
3896 1 my $q_string = '';
3897 1 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 14 0 14
3898 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 ($Elatin6::q_char) /cgox) { } 13 0 13
3899 0 elsif (/\G (\\\Q$delimiter\E) /oxgc) { $q_string .= $1; }
3900 1 elsif (/\G (\Q$delimiter\E) /oxgc) { return $e . e_q($ope,$delimiter,$delimiter,$q_string); }
3901 13 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3902 }
3903 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3904 }
3905 }
3906 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3907 }
3908 }
3909  
3910 # m//
3911 elsif (/\G \b (m) \b /oxgc) {
3912 209 my $ope = $1;
3913 209 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { # m# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin6::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
3914 0 return e_qr($ope,$1,$3,$2,$4);
3915 }
3916 else {
3917 209 my $e = '';
3918 209 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 209 0 209
3919 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 (\?) ((?:$Elatin6::qq_char)*?) (\?) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
elsif (/\G (\') ((?:$Elatin6::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 10 199 209
elsif (/\G ([*\-:\\^|]) ((?:$Elatin6::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 199 199
elsif (/\G (\S) ((?:$Elatin6::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 199 0 199
3920 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m ( )
3921 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m { }
3922 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m [ ]
3923 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m < >
3924 0 elsif (/\G (\?) ((?:$qq_char)*?) (\?) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m ? ?
3925 10 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr_q($ope,$1, $3, $2,$4); } # m ' '
3926 0 elsif (/\G ([*\-:\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,'{','}',$2,$4); } # m | | --> m { }
3927 199 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m * *
3928 }
3929 0 die __FILE__, ": Search pattern not terminated\n";
3930 }
3931 }
3932  
3933 # s///
3934  
3935 # about [cegimosxpradlunbB]* (/cg modifier)
3936 #
3937 # P.67 Pattern-Matching Operators
3938 # of ISBN 0-596-00241-6 Perl in a Nutshell, Second Edition.
3939  
3940 elsif (/\G \b (s) \b /oxgc) {
3941 101 my $ope = $1;
3942  
3943 # $1 $2 $3 $4 $5 $6
3944 101 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ((?:$qq_char)*?) (\#) ([cegimosxpradlunbB]*) /oxgc) { # s# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin6::qq_char)*?) (\#) ((?:$Elatin6::qq_char)*?) (\#) ([cegimosxpradlunbB]*) /cgox) { } 1 100 101
3945 1 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3946 }
3947 else {
3948 100 my $e = '';
3949 100 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 100 0 100
3950 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 (\') ((?:$Elatin6::qq_char)*?) (\') ((?:$Elatin6::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 21 79 100
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin6::qq_char)*?) (\1) ((?:$Elatin6::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 79 79
elsif (/\G (\$) ((?:$Elatin6::qq_char)*?) (\1) ((?:$Elatin6::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 79 79
elsif (/\G (\S) ((?:$Elatin6::qq_char)*?) (\1) ((?:$Elatin6::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 79 0 79
3951 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) {
3952 0 my @s = ($1,$2,$3);
3953 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3954 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 (\') ((?:$Elatin6::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin6::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Elatin6::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Elatin6::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin6::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3955 # $1 $2 $3 $4
3956 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3957 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3958 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3959 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3960 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3961 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3962 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3963 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3964 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3965 }
3966 0 die __FILE__, ": Substitution replacement not terminated\n";
3967 }
3968 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) {
3969 0 my @s = ($1,$2,$3);
3970 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3971 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 (\') ((?:$Elatin6::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin6::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Elatin6::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Elatin6::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin6::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3972 # $1 $2 $3 $4
3973 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3974 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3975 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3976 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3977 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3978 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3979 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3980 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3981 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3982 }
3983 0 die __FILE__, ": Substitution replacement not terminated\n";
3984 }
3985 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) {
3986 0 my @s = ($1,$2,$3);
3987 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3988 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 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 (\') ((?:$Elatin6::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin6::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin6::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3989 # $1 $2 $3 $4
3990 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3991 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3992 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3993 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3994 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3995 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3996 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3997 }
3998 0 die __FILE__, ": Substitution replacement not terminated\n";
3999 }
4000 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) {
4001 0 my @s = ($1,$2,$3);
4002 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
4003 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 (\') ((?:$Elatin6::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin6::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Elatin6::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Elatin6::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin6::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
4004 # $1 $2 $3 $4
4005 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4006 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4007 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4008 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4009 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4010 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4011 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4012 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4013 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
4014 }
4015 0 die __FILE__, ": Substitution replacement not terminated\n";
4016 }
4017 # $1 $2 $3 $4 $5 $6
4018 elsif (/\G (\') ((?:$qq_char)*?) (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) {
4019 21 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
4020 }
4021 # $1 $2 $3 $4 $5 $6
4022 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
4023 0 return e_sub($sub_variable,'{',$2,'}','{',$4,'}',$6); # s | | | --> s { } { }
4024 }
4025 # $1 $2 $3 $4 $5 $6
4026 elsif (/\G (\$) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
4027 0 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
4028 }
4029 # $1 $2 $3 $4 $5 $6
4030 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
4031 79 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
4032 }
4033 }
4034 0 die __FILE__, ": Substitution pattern not terminated\n";
4035 }
4036 }
4037  
4038 # require ignore module
4039 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# require$1$2"; }
4040 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# require$1\n$2"; }
4041 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# require$1"; }
4042  
4043 # use strict; --> use strict; no strict qw(refs);
4044 37 elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "use$1 no strict qw(refs);$2"; }
4045 0 elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [^#]) /oxmsgc) { return "use$1 no strict qw(refs);\n$2"; }
4046 0 elsif (/\G \b use ((?>\s+) strict) \b /oxmsgc) { return "use$1; no strict qw(refs)"; }
4047  
4048 # use 5.12.0; --> use 5.12.0; no strict qw(refs);
4049 elsif (/\G \b use (?>\s+) ((?>([1-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /oxmsgc) {
4050 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
4051 0 return "use $1; no strict qw(refs);";
4052 }
4053 else {
4054 2 return "use $1;";
4055 }
4056 }
4057 elsif (/\G \b use (?>\s+) ((?>v([0-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /oxmsgc) {
4058 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
4059 0 return "use $1; no strict qw(refs);";
4060 }
4061 else {
4062 0 return "use $1;";
4063 }
4064 }
4065  
4066 # ignore use module
4067 2 elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# use$1$2"; }
4068 0 elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# use$1\n$2"; }
4069 0 elsif (/\G \b use ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# use$1"; }
4070  
4071 # ignore no module
4072 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# no$1$2"; }
4073 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# no$1\n$2"; }
4074 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# no$1"; }
4075  
4076 # use else
4077 0 elsif (/\G \b use \b /oxmsgc) { return "use"; }
4078  
4079 # use else
4080 2 elsif (/\G \b no \b /oxmsgc) { return "no"; }
4081  
4082 # ''
4083 elsif (/\G (?<![\w\$\@\%\&\*]) (\') /oxgc) {
4084 1142 my $q_string = '';
4085 1142 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 10175 0 10175
4086 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 ($Elatin6::q_char) /cgox) { } 8981 0 8981
4087 48 elsif (/\G (\\\') /oxgc) { $q_string .= $1; }
4088 1142 elsif (/\G \' /oxgc) { return e_q('', "'","'",$q_string); }
4089 8981 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
4090 }
4091 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4092 }
4093  
4094 # ""
4095 elsif (/\G (\") /oxgc) {
4096 1943 my $qq_string = '';
4097 1943 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 37394 0 37394
4098 37394 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 67 37327 37394
elsif (/\G (\\\") /cgox) { } 12 37315 37327
elsif (/\G \" /cgox) { } 1943 35372 37315
elsif (/\G ($Elatin6::q_char) /cgox) { } 35372 0 35372
4099 12 elsif (/\G (\\\") /oxgc) { $qq_string .= $1; }
4100 1943 elsif (/\G \" /oxgc) { return e_qq('', '"','"',$qq_string); }
4101 35372 elsif (/\G ($q_char) /oxgc) { $qq_string .= $1; }
4102 }
4103 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4104 }
4105  
4106 # ``
4107 elsif (/\G (\`) /oxgc) {
4108 1 my $qx_string = '';
4109 1 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 19 0 19
4110 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 ($Elatin6::q_char) /cgox) { } 18 0 18
4111 0 elsif (/\G (\\\`) /oxgc) { $qx_string .= $1; }
4112 1 elsif (/\G \` /oxgc) { return e_qq('', '`','`',$qx_string); }
4113 18 elsif (/\G ($q_char) /oxgc) { $qx_string .= $1; }
4114 }
4115 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4116 }
4117  
4118 # // --- not divide operator (num / num), not defined-or
4119 ▶ elsif (($slash eq 'm//') and /\G (\/) /oxgc) {
Condition100%3/3
$Elatin6::slash eq "m//" and m[\G (/) ]cgox
!ll&&!rl&&r
273808848681
MC/DC100%2/2
$Elatin6::slash eq "m//" and m[\G (/) ]cgox
$Elatin6::slash eq "m//" m[\G (/) ]cgox
Truth table100%3/3
A and B
A= $Elatin6::slash eq "m//"B= m[\G (/) ]cgox
ABresult
0X0
100
111
4120 681 my $regexp = '';
4121 681 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 5636 0 5636
4122 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 ($Elatin6::q_char) /cgox) { } 4955 0 4955
4123 0 elsif (/\G (\\\/) /oxgc) { $regexp .= $1; }
4124 681 elsif (/\G \/ ([cgimosxpadlunbB]*) /oxgc) { return e_qr('', '/','/',$regexp,$1); }
4125 4955 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
4126 }
4127 0 die __FILE__, ": Search pattern not terminated\n";
4128 }
4129  
4130 # ?? --- not conditional operator (condition ? then : else)
4131 ▶ elsif (($slash eq 'm//') and /\G (\?) /oxgc) {
Condition66%2/3
$Elatin6::slash eq "m//" and /\G (\?) /cgox
!ll&&!rl&&r
2738088480
MC/DC0%0/2
$Elatin6::slash eq "m//" and /\G (\?) /cgox
$Elatin6::slash eq "m//" /\G (\?) /cgox
Truth table66%2/3
A and B
A= $Elatin6::slash eq "m//"B= /\G (\?) /cgox
ABresult
0X0
100
111
4132 0 my $regexp = '';
4133 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
4134 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 ($Elatin6::q_char) /cgox) { } 0 0 0
4135 0 elsif (/\G (\\\?) /oxgc) { $regexp .= $1; }
4136 0 elsif (/\G \? ([cgimosxpadlunbB]*) /oxgc) { return e_qr('m','?','?',$regexp,$1); }
4137 0 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
4138 }
4139 0 die __FILE__, ": Search pattern not terminated\n";
4140 }
4141  
4142 # <<>> (a safer ARGV)
4143 0 elsif (/\G ( <<>> ) /oxgc) { $slash = 'm//'; return $1; }
4144  
4145 # << (bit shift) --- not here document
4146 0 elsif (/\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /oxgc) { $slash = 'm//'; return $1; }
4147  
4148 # <<~'HEREDOC'
4149 elsif (/\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /oxgc) {
4150 6 $slash = 'm//';
4151 6 my $here_quote = $1;
4152 6 my $delimiter = $2;
4153  
4154 # get here document
4155 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4156 6 $here_script = CORE::substr $_, pos $_;
4157 6 $here_script =~ s/.*?\n//oxm;
4158 }
4159 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
4160 6 my $heredoc = $1;
4161 6 my $indent = $2;
4162 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4163 6 push @heredoc, $heredoc . qq{\n$delimiter\n};
4164 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4165 }
4166 else {
4167 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4168 }
4169 6 return qq{<<'$delimiter'};
4170 }
4171  
4172 # <<~\HEREDOC
4173  
4174 # P.66 2.6.6. "Here" Documents
4175 # in Chapter 2: Bits and Pieces
4176 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4177  
4178 # P.73 "Here" Documents
4179 # in Chapter 2: Bits and Pieces
4180 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4181  
4182 elsif (/\G ( <<~ \\([a-zA-Z_0-9]+) ) /oxgc) {
4183 3 $slash = 'm//';
4184 3 my $here_quote = $1;
4185 3 my $delimiter = $2;
4186  
4187 # get here document
4188 3 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 3 0 3
4189 3 $here_script = CORE::substr $_, pos $_;
4190 3 $here_script =~ s/.*?\n//oxm;
4191 }
4192 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
4193 3 my $heredoc = $1;
4194 3 my $indent = $2;
4195 3 $heredoc =~ s{^$indent}{}msg; # no /ox
4196 3 push @heredoc, $heredoc . qq{\n$delimiter\n};
4197 3 push @heredoc_delimiter, qq{\\s*$delimiter};
4198 }
4199 else {
4200 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4201 }
4202 3 return qq{<<\\$delimiter};
4203 }
4204  
4205 # <<~"HEREDOC"
4206 elsif (/\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /oxgc) {
4207 6 $slash = 'm//';
4208 6 my $here_quote = $1;
4209 6 my $delimiter = $2;
4210  
4211 # get here document
4212 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4213 6 $here_script = CORE::substr $_, pos $_;
4214 6 $here_script =~ s/.*?\n//oxm;
4215 }
4216 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
4217 6 my $heredoc = $1;
4218 6 my $indent = $2;
4219 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4220 6 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4221 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4222 }
4223 else {
4224 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4225 }
4226 6 return qq{<<"$delimiter"};
4227 }
4228  
4229 # <<~HEREDOC
4230 elsif (/\G ( <<~ ([a-zA-Z_0-9]+) ) /oxgc) {
4231 3 $slash = 'm//';
4232 3 my $here_quote = $1;
4233 3 my $delimiter = $2;
4234  
4235 # get here document
4236 3 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 3 0 3
4237 3 $here_script = CORE::substr $_, pos $_;
4238 3 $here_script =~ s/.*?\n//oxm;
4239 }
4240 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
4241 3 my $heredoc = $1;
4242 3 my $indent = $2;
4243 3 $heredoc =~ s{^$indent}{}msg; # no /ox
4244 3 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4245 3 push @heredoc_delimiter, qq{\\s*$delimiter};
4246 }
4247 else {
4248 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4249 }
4250 3 return qq{<<$delimiter};
4251 }
4252  
4253 # <<~`HEREDOC`
4254 elsif (/\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /oxgc) {
4255 6 $slash = 'm//';
4256 6 my $here_quote = $1;
4257 6 my $delimiter = $2;
4258  
4259 # get here document
4260 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4261 6 $here_script = CORE::substr $_, pos $_;
4262 6 $here_script =~ s/.*?\n//oxm;
4263 }
4264 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
4265 6 my $heredoc = $1;
4266 6 my $indent = $2;
4267 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4268 6 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4269 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4270 }
4271 else {
4272 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4273 }
4274 6 return qq{<<`$delimiter`};
4275 }
4276  
4277 # <<'HEREDOC'
4278 elsif (/\G ( << '([a-zA-Z_0-9]*)' ) /oxgc) {
4279 72 $slash = 'm//';
4280 72 my $here_quote = $1;
4281 72 my $delimiter = $2;
4282  
4283 # get here document
4284 72 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 72 0 72
4285 72 $here_script = CORE::substr $_, pos $_;
4286 72 $here_script =~ s/.*?\n//oxm;
4287 }
4288 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
4289 72 push @heredoc, $1 . qq{\n$delimiter\n};
4290 72 push @heredoc_delimiter, $delimiter;
4291 }
4292 else {
4293 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4294 }
4295 72 return $here_quote;
4296 }
4297  
4298 # <<\HEREDOC
4299  
4300 # P.66 2.6.6. "Here" Documents
4301 # in Chapter 2: Bits and Pieces
4302 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4303  
4304 # P.73 "Here" Documents
4305 # in Chapter 2: Bits and Pieces
4306 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4307  
4308 elsif (/\G ( << \\([a-zA-Z_0-9]+) ) /oxgc) {
4309 0 $slash = 'm//';
4310 0 my $here_quote = $1;
4311 0 my $delimiter = $2;
4312  
4313 # get here document
4314 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4315 0 $here_script = CORE::substr $_, pos $_;
4316 0 $here_script =~ s/.*?\n//oxm;
4317 }
4318 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
4319 0 push @heredoc, $1 . qq{\n$delimiter\n};
4320 0 push @heredoc_delimiter, $delimiter;
4321 }
4322 else {
4323 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4324 }
4325 0 return $here_quote;
4326 }
4327  
4328 # <<"HEREDOC"
4329 elsif (/\G ( << "([a-zA-Z_0-9]*)" ) /oxgc) {
4330 36 $slash = 'm//';
4331 36 my $here_quote = $1;
4332 36 my $delimiter = $2;
4333  
4334 # get here document
4335 36 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 36 0 36
4336 36 $here_script = CORE::substr $_, pos $_;
4337 36 $here_script =~ s/.*?\n//oxm;
4338 }
4339 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
4340 36 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4341 36 push @heredoc_delimiter, $delimiter;
4342 }
4343 else {
4344 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4345 }
4346 36 return $here_quote;
4347 }
4348  
4349 # <<HEREDOC
4350 elsif (/\G ( << ([a-zA-Z_0-9]+) ) /oxgc) {
4351 42 $slash = 'm//';
4352 42 my $here_quote = $1;
4353 42 my $delimiter = $2;
4354  
4355 # get here document
4356 42 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 42 0 42
4357 42 $here_script = CORE::substr $_, pos $_;
4358 42 $here_script =~ s/.*?\n//oxm;
4359 }
4360 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
4361 42 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4362 42 push @heredoc_delimiter, $delimiter;
4363 }
4364 else {
4365 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4366 }
4367 42 return $here_quote;
4368 }
4369  
4370 # <<`HEREDOC`
4371 elsif (/\G ( << `([a-zA-Z_0-9]*)` ) /oxgc) {
4372 0 $slash = 'm//';
4373 0 my $here_quote = $1;
4374 0 my $delimiter = $2;
4375  
4376 # get here document
4377 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4378 0 $here_script = CORE::substr $_, pos $_;
4379 0 $here_script =~ s/.*?\n//oxm;
4380 }
4381 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
4382 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4383 0 push @heredoc_delimiter, $delimiter;
4384 }
4385 else {
4386 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4387 }
4388 0 return $here_quote;
4389 }
4390  
4391 # <<= <=> <= < operator
4392 elsif (/\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/oxgc) {
4393 12 return $1;
4394 }
4395  
4396 # <FILEHANDLE>
4397 elsif (/\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /oxgc) {
4398 0 return $1;
4399 }
4400  
4401 # <WILDCARD> --- glob
4402  
4403 # avoid "Error: Runtime exception" of perl version 5.005_03
4404  
4405 elsif (/\G < ((?:[^>\0\a\e\f\n\r\t])+?) > /oxgc) {
4406 0 return 'Elatin6::glob("' . $1 . '")';
4407 }
4408  
4409 # __DATA__
4410 0 elsif (/\G ^ ( __DATA__ \n .*) \z /oxmsgc) { return $1; }
4411  
4412 # __END__
4413 210 elsif (/\G ^ ( __END__ \n .*) \z /oxmsgc) { return $1; }
4414  
4415 # \cD Control-D
4416  
4417 # P.68 2.6.8. Other Literal Tokens
4418 # in Chapter 2: Bits and Pieces
4419 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4420  
4421 # P.76 Other Literal Tokens
4422 # in Chapter 2: Bits and Pieces
4423 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4424  
4425 0 elsif (/\G ( \cD .*) \z /oxmsgc) { return $1; }
4426  
4427 # \cZ Control-Z
4428 0 elsif (/\G ( \cZ .*) \z /oxmsgc) { return $1; }
4429  
4430 # any operator before div
4431 elsif (/\G (
4432 -- | \+\+ |
4433 [\)\}\]]
4434  
4435 5839 ) /oxgc) { $slash = 'div'; return $1; }
4436  
4437 # yada-yada or triple-dot operator
4438 elsif (/\G (
4439 \.\.\.
4440  
4441 7 ) /oxgc) { $slash = 'm//'; return q{die('Unimplemented')}; }
4442  
4443 # any operator before m//
4444  
4445 # //, //= (defined-or)
4446  
4447 # P.164 Logical Operators
4448 # in Chapter 10: More Control Structures
4449 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
4450  
4451 # P.119 C-Style Logical (Short-Circuit) Operators
4452 # in Chapter 3: Unary and Binary Operators
4453 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4454  
4455 # (and so on)
4456  
4457 # ~~
4458  
4459 # P.221 The Smart Match Operator
4460 # in Chapter 15: Smart Matching and given-when
4461 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
4462  
4463 # P.112 Smartmatch Operator
4464 # in Chapter 3: Unary and Binary Operators
4465 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4466  
4467 # (and so on)
4468  
4469 elsif (/\G ((?>
4470  
4471 !~~ | !~ | != | ! |
4472 %= | % |
4473 &&= | && | &= | &\.= | &\. | & |
4474 -= | -> | - |
4475 :(?>\s*)= |
4476 : |
4477 <<>> |
4478 <<= | <=> | <= | < |
4479 == | => | =~ | = |
4480 >>= | >> | >= | > |
4481 \*\*= | \*\* | \*= | \* |
4482 \+= | \+ |
4483 \.\. | \.= | \. |
4484 \/\/= | \/\/ |
4485 \/= | \/ |
4486 \? |
4487 \\ |
4488 \^= | \^\.= | \^\. | \^ |
4489 \b x= |
4490 \|\|= | \|\| | \|= | \|\.= | \|\. | \| |
4491 ~~ | ~\. | ~ |
4492 \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b |
4493 \b(?: print )\b |
4494  
4495 [,;\(\{\[]
4496  
4497 9808 )) /oxgc) { $slash = 'm//'; return $1; }
4498  
4499 # other any character
4500 20178 elsif (/\G ($q_char) /oxgc) { $slash = 'div'; return $1; }
4501  
4502 # system error
4503 else {
4504 0 die __FILE__, ": Oops, this shouldn't happen!\n";
4505 }
4506 }
4507  
4508 # escape Latin-6 string
4509 1873 ▶sub e_string {
Subroutine e_string: called CC=54 SCAR=72.5
Pod documented
4510 1873 my($string) = @_;
4511 1873 my $e_string = '';
4512  
4513 1873 local $slash = 'm//';
4514  
4515 # P.1024 Appendix W.10 Multibyte Processing
4516 # of ISBN 1-56592-224-7 CJKV Information Processing
4517 # (and so on)
4518  
4519 1873 my @char = $string =~ / \G (?>[^\\]|\\$q_char|$q_char) /oxmsg;
4520  
4521 # without { ... }
4522 1873 ▶ if (not (grep(/\A \{ \z/xms, @char) and grep(/\A \} \z/xms, @char))) {
Branch: 1 branch
BranchTrueFalseTotal
unless (grep /\A \{ \z/msx, @char and grep /\A \} \z/msx, @char) 1854 19 1873
Condition66%2/3
grep /\A \{ \z/msx, @char and grep /\A \} \z/msx, @char
!ll&&!rl&&r
1854019
MC/DC50%1/2
grep /\A \{ \z/msx, @char and grep /\A \} \z/msx, @char
grep /\A \{ \z/msx, @char grep /\A \} \z/msx, @char
Truth table66%2/3
A and B
A= grep /\A \{ \z/msx, @charB= grep /\A \} \z/msx, @char
ABresult
0X0
100
111
4523 1854 ▶ if ($string !~ /<</oxms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /<</mosx) 1854 0 1854
4524 1854 return $string;
4525 }
4526 }
4527  
4528 E_STRING_LOOP:
4529 19 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 223 19 242
4530 223 ▶ if (0) {
Branch: 24 branches
BranchTrueFalseTotal
if (do { $string =~ /\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /cgmosx }) { } 0 223 223
elsif ($string =~ /\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G ( \$' | \$\{'\} ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G ( \$ 0 ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G ( \$ \$ ) (?![\w\{]) /cgmosx) { } 0 223 223
elsif ($string =~ /\G \$ ((?>[1-9][0-9]*)) /cgmosx) { } 0 223 223
elsif ($string =~ /\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /cgmosx) { } 0 223 223
elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /cgmosx) { } 0 223 223
elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /cgmosx) { } 0 223 223
elsif ($string =~ /\G \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} /cgmosx) { } 0 223 223
elsif ($string =~ /\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /cgmosx) { } 3 220 223
elsif ($string =~ /\G ( (?: [\$\@\%\&\*] | \$\# | -> | \b sub \b) (?>\s*) (?: split | chop | index | rindex | lc | uc | fc | chr | ord | reverse | getc | tr | y | q | qq | qx | qw | m | s | qr | glob | lstat | opendir | stat | unlink | chdir ) ) \b /cgmosx) { } 7 213 220
elsif ($string =~ m{\G ( \$[\$\@\#\\\'\"/\?\(\)\[\]\<\>] ) }cgmosx) { } 0 213 213
elsif ($string =~ /\G \b (qq) \b /cgox) { } 0 213 213
elsif ($string =~ /\G \b (qx) \b /cgox) { } 0 213 213
elsif ($string =~ /\G \b (q) \b /cgox) { } 0 213 213
elsif ($string =~ /\G (?<![\w\$\@\%\&\*]) (\') ((?:\\\'|\\\\|$Elatin6::q_char)*?) (\') /cgox) { } 0 213 213
elsif ($string =~ /\G (\") ((?:$Elatin6::qq_char)*?) (\") /cgox) { } 0 213 213
elsif ($string =~ /\G (\`) ((?:$Elatin6::qq_char)*?) (\`) /cgox) { } 0 213 213
elsif ($string =~ /\G ($Elatin6::q_char) /cgox) { } 213 0 213
4531 }
4532  
4533 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> @{[Elatin6::PREMATCH()]}
4534 elsif ($string =~ /\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /oxmsgc) {
4535 0 $e_string .= q{Elatin6::PREMATCH()};
4536 0 $slash = 'div';
4537 }
4538  
4539 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> @{[Elatin6::MATCH()]}
4540 elsif ($string =~ /\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /oxmsgc) {
4541 0 $e_string .= q{Elatin6::MATCH()};
4542 0 $slash = 'div';
4543 }
4544  
4545 # $', ${'} --> $', ${'}
4546 elsif ($string =~ /\G ( \$' | \$\{'\} ) /oxmsgc) {
4547 0 $e_string .= $1;
4548 0 $slash = 'div';
4549 }
4550  
4551 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> @{[Elatin6::POSTMATCH()]}
4552 elsif ($string =~ /\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /oxmsgc) {
4553 0 $e_string .= q{Elatin6::POSTMATCH()};
4554 0 $slash = 'div';
4555 }
4556  
4557 # bareword
4558 elsif ($string =~ /\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /oxmsgc) {
4559 0 $e_string .= $1;
4560 0 $slash = 'div';
4561 }
4562  
4563 # $0 --> $0
4564 elsif ($string =~ /\G ( \$ 0 ) /oxmsgc) {
4565 0 $e_string .= $1;
4566 0 $slash = 'div';
4567 }
4568 elsif ($string =~ /\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /oxmsgc) {
4569 0 $e_string .= $1;
4570 0 $slash = 'div';
4571 }
4572  
4573 # $$ --> $$
4574 elsif ($string =~ /\G ( \$ \$ ) (?![\w\{]) /oxmsgc) {
4575 0 $e_string .= $1;
4576 0 $slash = 'div';
4577 }
4578  
4579 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
4580 # $1, $2, $3 --> $1, $2, $3 otherwise
4581 elsif ($string =~ /\G \$ ((?>[1-9][0-9]*)) /oxmsgc) {
4582 0 $e_string .= e_capture($1);
4583 0 $slash = 'div';
4584 }
4585 elsif ($string =~ /\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /oxmsgc) {
4586 0 $e_string .= e_capture($1);
4587 0 $slash = 'div';
4588 }
4589  
4590 # $$foo[ ... ] --> $ $foo->[ ... ]
4591 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /oxmsgc) {
4592 0 $e_string .= e_capture($1.'->'.$2);
4593 0 $slash = 'div';
4594 }
4595  
4596 # $$foo{ ... } --> $ $foo->{ ... }
4597 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /oxmsgc) {
4598 0 $e_string .= e_capture($1.'->'.$2);
4599 0 $slash = 'div';
4600 }
4601  
4602 # $$foo
4603 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /oxmsgc) {
4604 0 $e_string .= e_capture($1);
4605 0 $slash = 'div';
4606 }
4607  
4608 # ${ foo }
4609 elsif ($string =~ /\G \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} /oxmsgc) {
4610 0 $e_string .= '${' . $1 . '}';
4611 0 $slash = 'div';
4612 }
4613  
4614 # ${ ... }
4615 elsif ($string =~ /\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /oxmsgc) {
4616 3 $e_string .= e_capture($1);
4617 3 $slash = 'div';
4618 }
4619  
4620 # variable or function
4621 # $ @ % & * $ #
4622 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) {
4623 7 $e_string .= $1;
4624 7 $slash = 'div';
4625 }
4626 # $ $ $ $ $ $ $ $ $ $ $ $ $ $
4627 # $ @ # \ ' " / ? ( ) [ ] < >
4628 elsif ($string =~ /\G ( \$[\$\@\#\\\'\"\/\?\(\)\[\]\<\>] ) /oxmsgc) {
4629 0 $e_string .= $1;
4630 0 $slash = 'div';
4631 }
4632  
4633 # qq//
4634 elsif ($string =~ /\G \b (qq) \b /oxgc) {
4635 0 my $ope = $1;
4636 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qq# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Elatin6::qq_char)*?) (\#) /cgox) { } 0 0 0
4637 0 $e_string .= e_qq($ope,$1,$3,$2);
4638 }
4639 else {
4640 0 my $e = '';
4641 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4642 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) ((?:$Elatin6::qq_char)*?) (\1) /cgox) { } 0 0 0
4643 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq ( )
4644 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq { }
4645 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq [ ]
4646 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq < >
4647 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq * *
4648 }
4649 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4650 }
4651 }
4652  
4653 # qx//
4654 elsif ($string =~ /\G \b (qx) \b /oxgc) {
4655 0 my $ope = $1;
4656 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qx# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Elatin6::qq_char)*?) (\#) /cgox) { } 0 0 0
4657 0 $e_string .= e_qq($ope,$1,$3,$2);
4658 }
4659 else {
4660 0 my $e = '';
4661 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4662 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 (\') ((?:$Elatin6::qq_char)*?) (\') /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Elatin6::qq_char)*?) (\1) /cgox) { } 0 0 0
4663 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx ( )
4664 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx { }
4665 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx [ ]
4666 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx < >
4667 0 elsif ($string =~ /\G (\') ((?:$qq_char)*?) (\') /oxgc) { $e_string .= $e . e_q ($ope,$1,$3,$2); next E_STRING_LOOP; } # qx ' '
4668 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx * *
4669 }
4670 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4671 }
4672 }
4673  
4674 # q//
4675 elsif ($string =~ /\G \b (q) \b /oxgc) {
4676 0 my $ope = $1;
4677 0 ▶ if ($string =~ /\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { # q# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:\\\#|\\\\|$Elatin6::q_char)*?) (\#) /cgox) { } 0 0 0
4678 0 $e_string .= e_q($ope,$1,$3,$2);
4679 }
4680 else {
4681 0 my $e = '';
4682 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4683 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| $Elatin6::q_char)*?) (\1) /cgox) { } 0 0 0
4684 0 elsif ($string =~ /\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q ( )
4685 0 elsif ($string =~ /\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q { }
4686 0 elsif ($string =~ /\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q [ ]
4687 0 elsif ($string =~ /\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q < >
4688 0 elsif ($string =~ /\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q * *
4689 }
4690 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4691 }
4692 }
4693  
4694 # ''
4695 0 elsif ($string =~ /\G (?<![\w\$\@\%\&\*]) (\') ((?:\\\'|\\\\|$q_char)*?) (\') /oxgc) { $e_string .= e_q('',$1,$3,$2); }
4696  
4697 # ""
4698 0 elsif ($string =~ /\G (\") ((?:$qq_char)*?) (\") /oxgc) { $e_string .= e_qq('',$1,$3,$2); }
4699  
4700 # ``
4701 0 elsif ($string =~ /\G (\`) ((?:$qq_char)*?) (\`) /oxgc) { $e_string .= e_qq('',$1,$3,$2); }
4702  
4703 # other any character
4704 213 elsif ($string =~ /\G ($q_char) /oxgc) { $e_string .= $1; }
4705  
4706 # system error
4707 else {
4708 0 die __FILE__, ": Oops, this shouldn't happen!\n";
4709 }
4710 }
4711  
4712 19 return $e_string;
4713 }
4714  
4715 #
4716 # character class
4717 #
4718 1920 ▶sub character_class {
Subroutine character_class: called CC=3 SCAR=11.0
Pod undocumented
4719 1920 my($char,$modifier) = @_;
4720  
4721 1920 ▶ if ($char eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char eq '.') { } 52 1868 1920
4722 52 ▶ if ($modifier =~ /s/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/) { } 17 35 52
4723 17 return '${Elatin6::dot_s}';
4724 }
4725 else {
4726 35 return '${Elatin6::dot}';
4727 }
4728 }
4729 else {
4730 1868 return Elatin6::classic_character_class($char);
4731 }
4732 }
4733  
4734 #
4735 # escape capture ($1, $2, $3, ...)
4736 #
4737 212 ▶sub e_capture {
Subroutine e_capture: called CC=1 SCAR=0.0
Pod undocumented
4738  
4739 212 return join '', '${', $_[0], '}';
4740 }
4741  
4742 #
4743 # escape transliteration (tr/// or y///)
4744 #
4745 4 ▶sub e_tr {
Subroutine e_tr: called CC=5 SCAR=16.8
Pod undocumented
4746 4 my($variable,$charclass,$e,$charclass2,$modifier) = @_;
4747 4 my $e_tr = '';
4748 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
4749  
4750 4 $slash = 'div';
4751  
4752 # quote character class 1
4753 4 $charclass = q_tr($charclass);
4754  
4755 # quote character class 2
4756 4 $charclass2 = q_tr($charclass2);
4757  
4758 # /b /B modifier
4759 4 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) { } 0 4 4
4760 0 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq '') { } 0 0 0
4761 0 $e_tr = qq{tr$charclass$e$charclass2$modifier};
4762 }
4763 else {
4764 0 $e_tr = qq{$variable${bind_operator}tr$charclass$e$charclass2$modifier};
4765 }
4766 }
4767 else {
4768 4 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq '') { } 2 2 4
4769 2 $e_tr = qq{Elatin6::tr(\$_,' =~ ',$charclass,$e$charclass2,'$modifier')};
4770 }
4771 else {
4772 2 $e_tr = qq{Elatin6::tr($variable,'$bind_operator',$charclass,$e$charclass2,'$modifier')};
4773 }
4774 }
4775  
4776 # clear tr/// variable
4777 4 $tr_variable = '';
4778 4 $bind_operator = '';
4779  
4780 4 return $e_tr;
4781 }
4782  
4783 #
4784 # quote for escape transliteration (tr/// or y///)
4785 #
4786 8 ▶sub q_tr {
Subroutine q_tr: called CC=9 SCAR=40.6
Pod undocumented
4787 8 my($charclass) = @_;
4788  
4789 # quote character class
4790 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
4791 8 return e_q('', "'", "'", $charclass); # --> q' '
4792 }
4793 elsif ($charclass !~ /\//oxms) {
4794 0 return e_q('q', '/', '/', $charclass); # --> q/ /
4795 }
4796 elsif ($charclass !~ /\#/oxms) {
4797 0 return e_q('q', '#', '#', $charclass); # --> q# #
4798 }
4799 elsif ($charclass !~ /[\<\>]/oxms) {
4800 0 return e_q('q', '<', '>', $charclass); # --> q< >
4801 }
4802 elsif ($charclass !~ /[\(\)]/oxms) {
4803 0 return e_q('q', '(', ')', $charclass); # --> q( )
4804 }
4805 elsif ($charclass !~ /[\{\}]/oxms) {
4806 0 return e_q('q', '{', '}', $charclass); # --> q{ }
4807 }
4808 else {
4809 0 for my $char (qw( ! " $ % & * + . : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
4810 0 ▶ if ($charclass !~ /\Q$char\E/xms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($charclass =~ /\Q$char\E/msx) 0 0 0
4811 0 return e_q('q', $char, $char, $charclass);
4812 }
4813 }
4814 }
4815  
4816 0 return e_q('q', '{', '}', $charclass);
4817 }
4818  
4819 #
4820 # escape q string (q//, '')
4821 #
4822 1623 ▶sub e_q {
Subroutine e_q: called CC=1 SCAR=0.0
Pod undocumented
4823 1623 my($ope,$delimiter,$end_delimiter,$string) = @_;
4824  
4825 1623 $slash = 'div';
4826  
4827 1623 return join '', $ope, $delimiter, $string, $end_delimiter;
4828 }
4829  
4830 #
4831 # escape qq string (qq//, "", qx//, ``)
4832 #
4833 4281 ▶sub e_qq {
Subroutine e_qq: called CC=37 SCAR=50.9
Pod undocumented
4834 4281 my($ope,$delimiter,$end_delimiter,$string) = @_;
4835  
4836 4281 $slash = 'div';
4837  
4838 4281 my $left_e = 0;
4839 4281 my $right_e = 0;
4840  
4841 # split regexp
4842 4281 my @char = $string =~ /\G((?>
4843 [^\\\$] |
4844 \\x\{ (?>[0-9A-Fa-f]+) \} |
4845 \\o\{ (?>[0-7]+) \} |
4846 \\N\{ (?>[^0-9\}][^\}]*) \} |
4847 \\ $q_char |
4848 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
4849 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
4850 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
4851 \$ (?>\s* [0-9]+) |
4852 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
4853 \$ \$ (?![\w\{]) |
4854 \$ (?>\s*) \$ (?>\s*) $qq_variable |
4855 $q_char
4856 ))/oxmsg;
4857  
4858 4281 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 116857 4281 121138
4859  
4860 # "\L\u" --> "\u\L"
4861 116857 ▶ 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 116857 116857
elsif ($char[$i] eq '\\U' and $char[$i + 1] eq '\\l') { } 0 116857 116857
elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/mosx) { } 1 116856 116857
elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/mosx) { } 1 116855 116856
elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/mosx) { } 0 116855 116855
Condition33%1/3
$char[$i] eq "\\L" and $char[$i + 1] eq "\\u"
!ll&&!rl&&r
11685700
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
4862 0 @char[$i,$i+1] = @char[$i+1,$i];
4863 }
4864  
4865 # "\U\l" --> "\l\U"
4866 ▶ 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
11685700
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
4867 0 @char[$i,$i+1] = @char[$i+1,$i];
4868 }
4869  
4870 # octal escape sequence
4871 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
4872 1 $char[$i] = Elatin6::octchr($1);
4873 }
4874  
4875 # hexadecimal escape sequence
4876 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
4877 1 $char[$i] = Elatin6::hexchr($1);
4878 }
4879  
4880 # \N{CHARNAME} --> N{CHARNAME}
4881 elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
4882 0 $char[$i] = $1;
4883 }
4884  
4885 116857 ▶ if (0) {
Branch: 23 branches
BranchTrueFalseTotal
if (do { $char[$i] =~ /\A ([<>]) \z/mosx }) { } 484 116373 116857
elsif ($char[$i] eq '\\u') { } 0 116373 116373
elsif ($char[$i] eq '\\l') { } 0 116373 116373
elsif ($char[$i] eq '\\U') { } 0 116373 116373
elsif ($char[$i] eq '\\L') { } 0 116373 116373
elsif ($char[$i] eq '\\F') { } 24 116349 116373
elsif ($char[$i] eq '\\Q') { } 0 116349 116349
elsif ($char[$i] eq '\\E') { } 24 116325 116349
elsif ($char[$i] eq '\\Q') { } 0 116325 116325
elsif ($char[$i] eq '\\E') { } 0 116325 116325
elsif ($char[$i] =~ /\A \$ 0 \z/mosx) { } 4 116321 116325
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/mosx) { } 0 116321 116321
elsif ($char[$i] =~ /\A \$\$ \z/mosx) { } 0 116321 116321
elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/mosx) { } 205 116116 116321
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/mosx) { } 0 116116 116116
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/mosx) { } 0 116116 116116
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/mosx) { } 0 116116 116116
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/mosx) { } 0 116116 116116
elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/cgmosx) { } 44 116072 116116
elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/cgmosx) { } 45 116027 116072
elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/cgmosx) { } 33 115994 116027
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/mosx) { } 0 115994 115994
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/mosx) { } 0 115994 115994
4886 }
4887  
4888 # \F
4889 #
4890 # P.69 Table 2-6. Translation escapes
4891 # in Chapter 2: Bits and Pieces
4892 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4893 # (and so on)
4894  
4895 # \u \l \U \L \F \Q \E
4896 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
4897 484 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 484 484
4898 0 $char[$i] = '\\' . $char[$i];
4899 }
4900 }
4901 elsif ($char[$i] eq '\u') {
4902  
4903 # "STRING @{[ LIST EXPR ]} MORE STRING"
4904  
4905 # P.257 Other Tricks You Can Do with Hard References
4906 # in Chapter 8: References
4907 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4908  
4909 # P.353 Other Tricks You Can Do with Hard References
4910 # in Chapter 8: References
4911 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4912  
4913 # (and so on)
4914  
4915 0 $char[$i] = '@{[Elatin6::ucfirst qq<';
4916 0 $left_e++;
4917 }
4918 elsif ($char[$i] eq '\l') {
4919 0 $char[$i] = '@{[Elatin6::lcfirst qq<';
4920 0 $left_e++;
4921 }
4922 elsif ($char[$i] eq '\U') {
4923 0 $char[$i] = '@{[Elatin6::uc qq<';
4924 0 $left_e++;
4925 }
4926 elsif ($char[$i] eq '\L') {
4927 0 $char[$i] = '@{[Elatin6::lc qq<';
4928 0 $left_e++;
4929 }
4930 elsif ($char[$i] eq '\F') {
4931 24 $char[$i] = '@{[Elatin6::fc qq<';
4932 24 $left_e++;
4933 }
4934 elsif ($char[$i] eq '\Q') {
4935 0 $char[$i] = '@{[CORE::quotemeta qq<';
4936 0 $left_e++;
4937 }
4938 elsif ($char[$i] eq '\E') {
4939 24 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 24 0 24
4940 24 $char[$i] = '>]}';
4941 24 $right_e++;
4942 }
4943 else {
4944 0 $char[$i] = '';
4945 }
4946 }
4947 elsif ($char[$i] eq '\Q') {
4948 0 while (1) {
4949 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
4950 0 last;
4951 }
4952 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
4953 0 last;
4954 }
4955 }
4956 }
4957 elsif ($char[$i] eq '\E') {
4958 }
4959  
4960 # $0 --> $0
4961 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
4962 }
4963 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
4964 }
4965  
4966 # $$ --> $$
4967 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
4968 }
4969  
4970 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
4971 # $1, $2, $3 --> $1, $2, $3 otherwise
4972 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
4973 205 $char[$i] = e_capture($1);
4974 }
4975 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
4976 0 $char[$i] = e_capture($1);
4977 }
4978  
4979 # $$foo[ ... ] --> $ $foo->[ ... ]
4980 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
4981 0 $char[$i] = e_capture($1.'->'.$2);
4982 }
4983  
4984 # $$foo{ ... } --> $ $foo->{ ... }
4985 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
4986 0 $char[$i] = e_capture($1.'->'.$2);
4987 }
4988  
4989 # $$foo
4990 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
4991 0 $char[$i] = e_capture($1);
4992 }
4993  
4994 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin6::PREMATCH()
4995 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
4996 44 $char[$i] = '@{[Elatin6::PREMATCH()]}';
4997 }
4998  
4999 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin6::MATCH()
5000 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
5001 45 $char[$i] = '@{[Elatin6::MATCH()]}';
5002 }
5003  
5004 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin6::POSTMATCH()
5005 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
5006 33 $char[$i] = '@{[Elatin6::POSTMATCH()]}';
5007 }
5008  
5009 # ${ foo } --> ${ foo }
5010 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/oxms) {
5011 }
5012  
5013 # ${ ... }
5014 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5015 0 $char[$i] = e_capture($1);
5016 }
5017 }
5018  
5019 # return string
5020 4281 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 4281 4281
5021 0 return join '', $ope, $delimiter, @char, '>]}' x ($left_e - $right_e), $end_delimiter;
5022 }
5023 4281 return join '', $ope, $delimiter, @char, $end_delimiter;
5024 }
5025  
5026 #
5027 # escape qw string (qw//)
5028 #
5029 16 ▶sub e_qw {
Subroutine e_qw: called CC=11 SCAR=43.1
Pod undocumented
5030 16 my($ope,$delimiter,$end_delimiter,$string) = @_;
5031  
5032 16 $slash = 'div';
5033  
5034 # choice again delimiter
5035 16 my %octet = map {$_ => 1} ($string =~ /\G ([\x00-\xFF]) /oxmsg);
5036 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
5037 16 return join '', $ope, $delimiter, $string, $end_delimiter;
5038 }
5039 elsif (not $octet{')'}) {
5040 0 return join '', $ope, '(', $string, ')';
5041 }
5042 elsif (not $octet{'}'}) {
5043 0 return join '', $ope, '{', $string, '}';
5044 }
5045 elsif (not $octet{']'}) {
5046 0 return join '', $ope, '[', $string, ']';
5047 }
5048 elsif (not $octet{'>'}) {
5049 0 return join '', $ope, '<', $string, '>';
5050 }
5051 else {
5052 0 for my $char (qw( ! " $ % & * + - . / : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5053 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5054 0 return join '', $ope, $char, $string, $char;
5055 }
5056 }
5057 }
5058  
5059 # qw/AAA BBB C'CC/ --> ('AAA', 'BBB', 'C\'CC')
5060 0 my @string = CORE::split(/\s+/, $string);
5061 0 for my $string (@string) {
5062 0 my @octet = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5063 0 for my $octet (@octet) {
5064 0 ▶ if ($octet =~ /\A (['\\]) \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($octet =~ /\A (['\\]) \z/mosx) 0 0 0
5065 0 $octet = '\\' . $1;
5066 }
5067 }
5068 0 $string = join '', @octet;
5069 }
5070 0 return join '', '(', (join ', ', map { "'$_'" } @string), ')';
5071 }
5072  
5073 #
5074 # escape here document (<<"HEREDOC", <<HEREDOC, <<`HEREDOC`, <<~"HEREDOC", <<~HEREDOC, <<~`HEREDOC`)
5075 #
5076 93 ▶sub e_heredoc {
Subroutine e_heredoc: called CC=37 SCAR=56.3
Pod undocumented
5077 93 my($string) = @_;
5078  
5079 93 $slash = 'm//';
5080  
5081 93 my $metachar = qr/[\@\\|]/oxms; # '|' is for <<`HEREDOC`
5082  
5083 93 my $left_e = 0;
5084 93 my $right_e = 0;
5085  
5086 # split regexp
5087 93 my @char = $string =~ /\G((?>
5088 [^\\\$] |
5089 \\x\{ (?>[0-9A-Fa-f]+) \} |
5090 \\o\{ (?>[0-7]+) \} |
5091 \\N\{ (?>[^0-9\}][^\}]*) \} |
5092 \\ $q_char |
5093 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5094 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5095 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5096 \$ (?>\s* [0-9]+) |
5097 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5098 \$ \$ (?![\w\{]) |
5099 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5100 $q_char
5101 ))/oxmsg;
5102  
5103 93 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 3177 93 3270
5104  
5105 # "\L\u" --> "\u\L"
5106 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
5107 0 @char[$i,$i+1] = @char[$i+1,$i];
5108 }
5109  
5110 # "\U\l" --> "\l\U"
5111 ▶ 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
5112 0 @char[$i,$i+1] = @char[$i+1,$i];
5113 }
5114  
5115 # octal escape sequence
5116 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5117 1 $char[$i] = Elatin6::octchr($1);
5118 }
5119  
5120 # hexadecimal escape sequence
5121 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5122 1 $char[$i] = Elatin6::hexchr($1);
5123 }
5124  
5125 # \N{CHARNAME} --> N{CHARNAME}
5126 elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5127 0 $char[$i] = $1;
5128 }
5129  
5130 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
5131 }
5132  
5133 # \u \l \U \L \F \Q \E
5134 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
5135 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
5136 0 $char[$i] = '\\' . $char[$i];
5137 }
5138 }
5139 elsif ($char[$i] eq '\u') {
5140 0 $char[$i] = '@{[Elatin6::ucfirst qq<';
5141 0 $left_e++;
5142 }
5143 elsif ($char[$i] eq '\l') {
5144 0 $char[$i] = '@{[Elatin6::lcfirst qq<';
5145 0 $left_e++;
5146 }
5147 elsif ($char[$i] eq '\U') {
5148 0 $char[$i] = '@{[Elatin6::uc qq<';
5149 0 $left_e++;
5150 }
5151 elsif ($char[$i] eq '\L') {
5152 0 $char[$i] = '@{[Elatin6::lc qq<';
5153 0 $left_e++;
5154 }
5155 elsif ($char[$i] eq '\F') {
5156 0 $char[$i] = '@{[Elatin6::fc qq<';
5157 0 $left_e++;
5158 }
5159 elsif ($char[$i] eq '\Q') {
5160 0 $char[$i] = '@{[CORE::quotemeta qq<';
5161 0 $left_e++;
5162 }
5163 elsif ($char[$i] eq '\E') {
5164 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
5165 0 $char[$i] = '>]}';
5166 0 $right_e++;
5167 }
5168 else {
5169 0 $char[$i] = '';
5170 }
5171 }
5172 elsif ($char[$i] eq '\Q') {
5173 0 while (1) {
5174 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5175 0 last;
5176 }
5177 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
5178 0 last;
5179 }
5180 }
5181 }
5182 elsif ($char[$i] eq '\E') {
5183 }
5184  
5185 # $0 --> $0
5186 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
5187 }
5188 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
5189 }
5190  
5191 # $$ --> $$
5192 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
5193 }
5194  
5195 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
5196 # $1, $2, $3 --> $1, $2, $3 otherwise
5197 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
5198 0 $char[$i] = e_capture($1);
5199 }
5200 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
5201 0 $char[$i] = e_capture($1);
5202 }
5203  
5204 # $$foo[ ... ] --> $ $foo->[ ... ]
5205 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
5206 0 $char[$i] = e_capture($1.'->'.$2);
5207 }
5208  
5209 # $$foo{ ... } --> $ $foo->{ ... }
5210 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
5211 0 $char[$i] = e_capture($1.'->'.$2);
5212 }
5213  
5214 # $$foo
5215 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
5216 0 $char[$i] = e_capture($1);
5217 }
5218  
5219 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin6::PREMATCH()
5220 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
5221 8 $char[$i] = '@{[Elatin6::PREMATCH()]}';
5222 }
5223  
5224 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin6::MATCH()
5225 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
5226 8 $char[$i] = '@{[Elatin6::MATCH()]}';
5227 }
5228  
5229 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin6::POSTMATCH()
5230 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
5231 6 $char[$i] = '@{[Elatin6::POSTMATCH()]}';
5232 }
5233  
5234 # ${ foo } --> ${ foo }
5235 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/oxms) {
5236 }
5237  
5238 # ${ ... }
5239 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5240 0 $char[$i] = e_capture($1);
5241 }
5242 }
5243  
5244 # return string
5245 93 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 93 93
5246 0 return join '', @char, '>]}' x ($left_e - $right_e);
5247 }
5248 93 return join '', @char;
5249 }
5250  
5251 #
5252 # escape regexp (m//, qr//)
5253 #
5254 880 ▶sub e_qr {
Subroutine e_qr: called CC=110 SCAR=73.6
Pod undocumented
5255 880 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5256 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
5257  
5258 880 $modifier =~ tr/p//d;
5259 880 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 880 880
5260 0 my $line = 0;
5261 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
5262 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
5263 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
5264 0 last;
5265 }
5266 }
5267 0 die qq{Unsupported modifier "$1" used at line $line.\n};
5268 }
5269  
5270 880 $slash = 'div';
5271  
5272 # literal null string pattern
5273 880 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 872 880
elsif ($modifier =~ tr/Bb//d) { } 2 870 872
5274 8 $modifier =~ tr/bB//d;
5275 8 $modifier =~ tr/i//d;
5276 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
5277 }
5278  
5279 # /b /B modifier
5280 elsif ($modifier =~ tr/bB//d) {
5281  
5282 # choice again delimiter
5283 2 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 2 2
5284 0 my @char = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5285 0 my %octet = map {$_ => 1} @char;
5286 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
5287 0 $delimiter = '(';
5288 0 $end_delimiter = ')';
5289 }
5290 elsif (not $octet{'}'}) {
5291 0 $delimiter = '{';
5292 0 $end_delimiter = '}';
5293 }
5294 elsif (not $octet{']'}) {
5295 0 $delimiter = '[';
5296 0 $end_delimiter = ']';
5297 }
5298 elsif (not $octet{'>'}) {
5299 0 $delimiter = '<';
5300 0 $end_delimiter = '>';
5301 }
5302 else {
5303 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5304 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5305 0 $delimiter = $char;
5306 0 $end_delimiter = $char;
5307 0 last;
5308 }
5309 }
5310 }
5311 }
5312  
5313 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
5314 0 return join '', $ope, $delimiter, $string, $matched, $end_delimiter, $modifier;
5315 }
5316 else {
5317 2 return join '', $ope, $delimiter, '(?:', $string, ')', $matched, $end_delimiter, $modifier;
5318 }
5319 }
5320  
5321 870 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 312 558 870
5322 870 my $metachar = qr/[\@\\|[\]{^]/oxms;
5323  
5324 # split regexp
5325 870 my @char = $string =~ /\G((?>
5326 [^\\\$\@\[\(] |
5327 \\x (?>[0-9A-Fa-f]{1,2}) |
5328 \\ (?>[0-7]{2,3}) |
5329 \\c [\x40-\x5F] |
5330 \\x\{ (?>[0-9A-Fa-f]+) \} |
5331 \\o\{ (?>[0-7]+) \} |
5332 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
5333 \\ $q_char |
5334 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5335 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5336 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5337 [\$\@] $qq_variable |
5338 \$ (?>\s* [0-9]+) |
5339 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5340 \$ \$ (?![\w\{]) |
5341 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5342 \[\^ |
5343 \[\: (?>[a-z]+) :\] |
5344 \[\:\^ (?>[a-z]+) :\] |
5345 \(\? |
5346 $q_char
5347 ))/oxmsg;
5348  
5349 # choice again delimiter
5350 870 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 870 870
5351 0 my %octet = map {$_ => 1} @char;
5352 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
5353 0 $delimiter = '(';
5354 0 $end_delimiter = ')';
5355 }
5356 elsif (not $octet{'}'}) {
5357 0 $delimiter = '{';
5358 0 $end_delimiter = '}';
5359 }
5360 elsif (not $octet{']'}) {
5361 0 $delimiter = '[';
5362 0 $end_delimiter = ']';
5363 }
5364 elsif (not $octet{'>'}) {
5365 0 $delimiter = '<';
5366 0 $end_delimiter = '>';
5367 }
5368 else {
5369 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5370 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5371 0 $delimiter = $char;
5372 0 $end_delimiter = $char;
5373 0 last;
5374 }
5375 }
5376 }
5377 }
5378  
5379 870 my $left_e = 0;
5380 870 my $right_e = 0;
5381 870 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 2100 870 2970
5382  
5383 # "\L\u" --> "\u\L"
5384 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
5385 0 @char[$i,$i+1] = @char[$i+1,$i];
5386 }
5387  
5388 # "\U\l" --> "\l\U"
5389 ▶ 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
5390 0 @char[$i,$i+1] = @char[$i+1,$i];
5391 }
5392  
5393 # octal escape sequence
5394 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5395 1 $char[$i] = Elatin6::octchr($1);
5396 }
5397  
5398 # hexadecimal escape sequence
5399 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5400 1 $char[$i] = Elatin6::hexchr($1);
5401 }
5402  
5403 # \b{...} --> b\{...}
5404 # \B{...} --> B\{...}
5405 # \N{CHARNAME} --> N\{CHARNAME}
5406 # \p{PROPERTY} --> p\{PROPERTY}
5407 # \P{PROPERTY} --> P\{PROPERTY}
5408 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5409 6 $char[$i] = $1 . '\\' . $2;
5410 }
5411  
5412 # \p, \P, \X --> p, P, X
5413 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
5414 4 $char[$i] = $1;
5415 }
5416  
5417 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 &Elatin6::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
5418 }
5419  
5420 # join separated multiple-octet
5421 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
5422 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 $Elatin6::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 $Elatin6::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 $Elatin6::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 $Elatin6::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 $Elatin6::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 $Elatin6::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 $Elatin6::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5423 0 $char[$i] .= join '', splice @char, $i+1, 3;
5424 }
5425 ▶ 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 $Elatin6::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 $Elatin6::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 $Elatin6::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 $Elatin6::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5426 0 $char[$i] .= join '', splice @char, $i+1, 2;
5427 }
5428 ▶ 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 $Elatin6::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 $Elatin6::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 $Elatin6::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 $Elatin6::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5429 0 $char[$i] .= join '', splice @char, $i+1, 1;
5430 }
5431 }
5432  
5433 # open character class [...]
5434 elsif ($char[$i] eq '[') {
5435 556 my $left = $i;
5436  
5437 # [] make die "Unmatched [] in regexp ...\n"
5438 # (and so on)
5439  
5440 556 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 3 553 556
5441 3 $i++;
5442 }
5443  
5444 556 while (1) {
5445 2063 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 2063 2063
5446 0 die __FILE__, ": Unmatched [] in regexp\n";
5447 }
5448 2063 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 556 1507 2063
5449 556 my $right = $i;
5450  
5451 # [...]
5452 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
5453 30 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin6::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
5454 }
5455 else {
5456 526 splice @char, $left, $right-$left+1, Elatin6::charlist_qr(@char[$left+1..$right-1], $modifier);
5457 }
5458  
5459 556 $i = $left;
5460 556 last;
5461 }
5462 }
5463 }
5464  
5465 # open character class [^...]
5466 elsif ($char[$i] eq '[^') {
5467 74 my $left = $i;
5468  
5469 # [^] make die "Unmatched [] in regexp ...\n"
5470 # (and so on)
5471  
5472 74 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 4 70 74
5473 4 $i++;
5474 }
5475  
5476 74 while (1) {
5477 272 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 272 272
5478 0 die __FILE__, ": Unmatched [] in regexp\n";
5479 }
5480 272 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 74 198 272
5481 74 my $right = $i;
5482  
5483 # [^...]
5484 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
5485 30 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin6::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
5486 }
5487 else {
5488 44 splice @char, $left, $right-$left+1, Elatin6::charlist_not_qr(@char[$left+1..$right-1], $modifier);
5489 }
5490  
5491 74 $i = $left;
5492 74 last;
5493 }
5494 }
5495 }
5496  
5497 # rewrite character class or escape character
5498 elsif (my $char = character_class($char[$i],$modifier)) {
5499 139 $char[$i] = $char;
5500 }
5501  
5502 # /i modifier
5503 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin6::uc($char[$i]) ne Elatin6::fc($char[$i]))) {
Condition100%6/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin6::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 &Elatin6::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin6::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= &Elatin6::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
5504 20 ▶ if (CORE::length(Elatin6::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 20 0 20
5505 20 $char[$i] = '[' . Elatin6::uc($char[$i]) . Elatin6::fc($char[$i]) . ']';
5506 }
5507 else {
5508 0 $char[$i] = '(?:' . Elatin6::uc($char[$i]) . '|' . Elatin6::fc($char[$i]) . ')';
5509 }
5510 }
5511  
5512 # \u \l \U \L \F \Q \E
5513 elsif ($char[$i] =~ /\A [<>] \z/oxms) {
5514 1 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 1 1
5515 0 $char[$i] = '\\' . $char[$i];
5516 }
5517 }
5518 elsif ($char[$i] eq '\u') {
5519 0 $char[$i] = '@{[Elatin6::ucfirst qq<';
5520 0 $left_e++;
5521 }
5522 elsif ($char[$i] eq '\l') {
5523 0 $char[$i] = '@{[Elatin6::lcfirst qq<';
5524 0 $left_e++;
5525 }
5526 elsif ($char[$i] eq '\U') {
5527 1 $char[$i] = '@{[Elatin6::uc qq<';
5528 1 $left_e++;
5529 }
5530 elsif ($char[$i] eq '\L') {
5531 1 $char[$i] = '@{[Elatin6::lc qq<';
5532 1 $left_e++;
5533 }
5534 elsif ($char[$i] eq '\F') {
5535 18 $char[$i] = '@{[Elatin6::fc qq<';
5536 18 $left_e++;
5537 }
5538 elsif ($char[$i] eq '\Q') {
5539 1 $char[$i] = '@{[CORE::quotemeta qq<';
5540 1 $left_e++;
5541 }
5542 elsif ($char[$i] eq '\E') {
5543 21 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 21 0 21
5544 21 $char[$i] = '>]}';
5545 21 $right_e++;
5546 }
5547 else {
5548 0 $char[$i] = '';
5549 }
5550 }
5551 elsif ($char[$i] eq '\Q') {
5552 0 while (1) {
5553 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5554 0 last;
5555 }
5556 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
5557 0 last;
5558 }
5559 }
5560 }
5561 elsif ($char[$i] eq '\E') {
5562 }
5563  
5564 # $0 --> $0
5565 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
5566 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5567 0 $char[$i] = '@{[Elatin6::ignorecase(' . $char[$i] . ')]}';
5568 }
5569 }
5570 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
5571 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5572 0 $char[$i] = '@{[Elatin6::ignorecase(' . $char[$i] . ')]}';
5573 }
5574 }
5575  
5576 # $$ --> $$
5577 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
5578 }
5579  
5580 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
5581 # $1, $2, $3 --> $1, $2, $3 otherwise
5582 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
5583 0 $char[$i] = e_capture($1);
5584 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5585 0 $char[$i] = '@{[Elatin6::ignorecase(' . $char[$i] . ')]}';
5586 }
5587 }
5588 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
5589 0 $char[$i] = e_capture($1);
5590 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5591 0 $char[$i] = '@{[Elatin6::ignorecase(' . $char[$i] . ')]}';
5592 }
5593 }
5594  
5595 # $$foo[ ... ] --> $ $foo->[ ... ]
5596 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
5597 0 $char[$i] = e_capture($1.'->'.$2);
5598 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5599 0 $char[$i] = '@{[Elatin6::ignorecase(' . $char[$i] . ')]}';
5600 }
5601 }
5602  
5603 # $$foo{ ... } --> $ $foo->{ ... }
5604 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
5605 0 $char[$i] = e_capture($1.'->'.$2);
5606 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5607 0 $char[$i] = '@{[Elatin6::ignorecase(' . $char[$i] . ')]}';
5608 }
5609 }
5610  
5611 # $$foo
5612 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
5613 0 $char[$i] = e_capture($1);
5614 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5615 0 $char[$i] = '@{[Elatin6::ignorecase(' . $char[$i] . ')]}';
5616 }
5617 }
5618  
5619 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin6::PREMATCH()
5620 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
5621 8 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 8 8
5622 0 $char[$i] = '@{[Elatin6::ignorecase(Elatin6::PREMATCH())]}';
5623 }
5624 else {
5625 8 $char[$i] = '@{[Elatin6::PREMATCH()]}';
5626 }
5627 }
5628  
5629 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin6::MATCH()
5630 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
5631 8 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 8 8
5632 0 $char[$i] = '@{[Elatin6::ignorecase(Elatin6::MATCH())]}';
5633 }
5634 else {
5635 8 $char[$i] = '@{[Elatin6::MATCH()]}';
5636 }
5637 }
5638  
5639 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin6::POSTMATCH()
5640 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
5641 6 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 6 6
5642 0 $char[$i] = '@{[Elatin6::ignorecase(Elatin6::POSTMATCH())]}';
5643 }
5644 else {
5645 6 $char[$i] = '@{[Elatin6::POSTMATCH()]}';
5646 }
5647 }
5648  
5649 # ${ foo }
5650 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
5651 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5652 0 $char[$i] = '@{[Elatin6::ignorecase(' . $char[$i] . ')]}';
5653 }
5654 }
5655  
5656 # ${ ... }
5657 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5658 0 $char[$i] = e_capture($1);
5659 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5660 0 $char[$i] = '@{[Elatin6::ignorecase(' . $char[$i] . ')]}';
5661 }
5662 }
5663  
5664 # $scalar or @array
5665 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
5666 21 $char[$i] = e_string($char[$i]);
5667 21 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 11 10 21
5668 11 $char[$i] = '@{[Elatin6::ignorecase(' . $char[$i] . ')]}';
5669 }
5670 }
5671  
5672 # quote character before ? + * {
5673 ▶ 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
5674 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
5675 }
5676 ▶ 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
5677 0 my $char = $char[$i-1];
5678 0 ▶ if ($char[$i] eq '{') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq '{') { } 0 0 0
5679 0 die __FILE__, qq{: "MULTIBYTE{n}" should be "(MULTIBYTE){n}" in m?? (and shift \$1,\$2,\$3,...) ($char){n}\n};
5680 }
5681 else {
5682 0 die __FILE__, qq{: "MULTIBYTE$char[$i]" should be "(MULTIBYTE)$char[$i]" in m?? (and shift \$1,\$2,\$3,...) ($char)$char[$i]\n};
5683 }
5684 }
5685 else {
5686 127 $char[$i-1] = '(?:' . $char[$i-1] . ')';
5687 }
5688 }
5689 }
5690  
5691 # make regexp string
5692 870 $modifier =~ tr/i//d;
5693 870 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 870 870
5694 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
5695 0 return join '', $ope, $delimiter, $anchor, @char, '>]}' x ($left_e - $right_e), $matched, $end_delimiter, $modifier;
5696 }
5697 else {
5698 0 return join '', $ope, $delimiter, $anchor, '(?:', @char, '>]}' x ($left_e - $right_e), ')', $matched, $end_delimiter, $modifier;
5699 }
5700 }
5701 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
5702 0 return join '', $ope, $delimiter, $anchor, @char, $matched, $end_delimiter, $modifier;
5703 }
5704 else {
5705 870 return join '', $ope, $delimiter, $anchor, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
5706 }
5707 }
5708  
5709 #
5710 # double quote stuff
5711 #
5712 180 ▶sub qq_stuff {
Subroutine qq_stuff: called CC=6 SCAR=18.5
Pod undocumented
5713 180 my($delimiter,$end_delimiter,$stuff) = @_;
5714  
5715 # scalar variable or array variable
5716 180 ▶ if ($stuff =~ /\A [\$\@] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($stuff =~ /\A [\$\@] /mosx) 100 80 180
5717 100 return $stuff;
5718 }
5719  
5720 # quote by delimiter
5721 80 my %octet = map {$_ => 1} ($stuff =~ /\G ([\x00-\xFF]) /oxmsg);
5722 80 for my $char (qw( ! " $ % & * + - . / : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5723 80 ▶ next if $char eq $delimiter;
Branch: 1 branch
BranchTrueFalseTotal
if $char eq $delimiter 0 80 80
5724 80 ▶ next if $char eq $end_delimiter;
Branch: 1 branch
BranchTrueFalseTotal
if $char eq $end_delimiter 0 80 80
5725 80 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 80 0 80
5726 80 return join '', 'qq', $char, $stuff, $char;
5727 }
5728 }
5729 0 return join '', 'qq', '<', $stuff, '>';
5730 }
5731  
5732 #
5733 # escape regexp (m'', qr'', and m''b, qr''b)
5734 #
5735 10 ▶sub e_qr_q {
Subroutine e_qr_q: called CC=7 SCAR=25.3
Pod undocumented
5736 10 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5737 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
5738  
5739 10 $modifier =~ tr/p//d;
5740 10 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 10 10
5741 0 my $line = 0;
5742 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
5743 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
5744 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
5745 0 last;
5746 }
5747 }
5748 0 die qq{Unsupported modifier "$1" used at line $line.\n};
5749 }
5750  
5751 10 $slash = 'div';
5752  
5753 # literal null string pattern
5754 10 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 2 10
elsif ($modifier =~ tr/Bb//d) { } 0 2 2
5755 8 $modifier =~ tr/bB//d;
5756 8 $modifier =~ tr/i//d;
5757 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
5758 }
5759  
5760 # with /b /B modifier
5761 elsif ($modifier =~ tr/bB//d) {
5762 0 return e_qr_qb($ope,$delimiter,$end_delimiter,$string,$modifier);
5763 }
5764  
5765 # without /b /B modifier
5766 else {
5767 2 return e_qr_qt($ope,$delimiter,$end_delimiter,$string,$modifier);
5768 }
5769 }
5770  
5771 #
5772 # escape regexp (m'', qr'')
5773 #
5774 2 ▶sub e_qr_qt {
Subroutine e_qr_qt: called CC=20 SCAR=51.8
Pod undocumented
5775 2 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5776  
5777 2 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 2 2
5778  
5779 # split regexp
5780 2 my @char = $string =~ /\G((?>
5781 [^\\\[\$\@\/] |
5782 [\x00-\xFF] |
5783 \[\^ |
5784 \[\: (?>[a-z]+) \:\] |
5785 \[\:\^ (?>[a-z]+) \:\] |
5786 [\$\@\/] |
5787 \\ (?:$q_char) |
5788 (?:$q_char)
5789 ))/oxmsg;
5790  
5791 # unescape character
5792 2 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 2 2 4
5793 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 &Elatin6::uc($char[$i]) ne &fc($char[$i])) { } 0 2 2
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 4 4
5794 }
5795  
5796 # open character class [...]
5797 elsif ($char[$i] eq '[') {
5798 0 my $left = $i;
5799 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
5800 0 $i++;
5801 }
5802 0 while (1) {
5803 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5804 0 die __FILE__, ": Unmatched [] in regexp\n";
5805 }
5806 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
5807 0 my $right = $i;
5808  
5809 # [...]
5810 0 splice @char, $left, $right-$left+1, Elatin6::charlist_qr(@char[$left+1..$right-1], $modifier);
5811  
5812 0 $i = $left;
5813 0 last;
5814 }
5815 }
5816 }
5817  
5818 # open character class [^...]
5819 elsif ($char[$i] eq '[^') {
5820 0 my $left = $i;
5821 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
5822 0 $i++;
5823 }
5824 0 while (1) {
5825 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5826 0 die __FILE__, ": Unmatched [] in regexp\n";
5827 }
5828 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
5829 0 my $right = $i;
5830  
5831 # [^...]
5832 0 splice @char, $left, $right-$left+1, Elatin6::charlist_not_qr(@char[$left+1..$right-1], $modifier);
5833  
5834 0 $i = $left;
5835 0 last;
5836 }
5837 }
5838 }
5839  
5840 # escape $ @ / and \
5841 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
5842 0 $char[$i] = '\\' . $char[$i];
5843 }
5844  
5845 # rewrite character class or escape character
5846 elsif (my $char = character_class($char[$i],$modifier)) {
5847 0 $char[$i] = $char;
5848 }
5849  
5850 # /i modifier
5851 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin6::uc($char[$i]) ne Elatin6::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin6::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 &Elatin6::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin6::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= &Elatin6::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
5852 0 ▶ if (CORE::length(Elatin6::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
5853 0 $char[$i] = '[' . Elatin6::uc($char[$i]) . Elatin6::fc($char[$i]) . ']';
5854 }
5855 else {
5856 0 $char[$i] = '(?:' . Elatin6::uc($char[$i]) . '|' . Elatin6::fc($char[$i]) . ')';
5857 }
5858 }
5859  
5860 # quote character before ? + * {
5861 ▶ 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
5862 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
5863 }
5864 else {
5865 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
5866 }
5867 }
5868 }
5869  
5870 2 $delimiter = '/';
5871 2 $end_delimiter = '/';
5872  
5873 2 $modifier =~ tr/i//d;
5874 2 return join '', $ope, $delimiter, $anchor, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
5875 }
5876  
5877 #
5878 # escape regexp (m''b, qr''b)
5879 #
5880 0 ▶sub e_qr_qb {
Subroutine e_qr_qb: not called CC=4 SCAR=30.0
Pod undocumented
5881 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5882  
5883 # split regexp
5884 0 my @char = $string =~ /\G ((?>[^\\]|\\\\)) /oxmsg;
5885  
5886 # unescape character
5887 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
5888 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
5889 }
5890  
5891 # remain \\
5892 elsif ($char[$i] eq '\\\\') {
5893 }
5894  
5895 # escape $ @ / and \
5896 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
5897 0 $char[$i] = '\\' . $char[$i];
5898 }
5899 }
5900  
5901 0 $delimiter = '/';
5902 0 $end_delimiter = '/';
5903 0 return join '', $ope, $delimiter, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
5904 }
5905  
5906 #
5907 # escape regexp (s/here//)
5908 #
5909 80 ▶sub e_s1 {
Subroutine e_s1: called CC=106 SCAR=81.1
Pod undocumented
5910 80 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5911 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
5912  
5913 80 $modifier =~ tr/p//d;
5914 80 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 80 80
5915 0 my $line = 0;
5916 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
5917 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
5918 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
5919 0 last;
5920 }
5921 }
5922 0 die qq{Unsupported modifier "$1" used at line $line.\n};
5923 }
5924  
5925 80 $slash = 'div';
5926  
5927 # literal null string pattern
5928 80 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 72 80
elsif ($modifier =~ tr/Bb//d) { } 0 72 72
5929 8 $modifier =~ tr/bB//d;
5930 8 $modifier =~ tr/i//d;
5931 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
5932 }
5933  
5934 # /b /B modifier
5935 elsif ($modifier =~ tr/bB//d) {
5936  
5937 # choice again delimiter
5938 0 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 0 0
5939 0 my @char = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5940 0 my %octet = map {$_ => 1} @char;
5941 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
5942 0 $delimiter = '(';
5943 0 $end_delimiter = ')';
5944 }
5945 elsif (not $octet{'}'}) {
5946 0 $delimiter = '{';
5947 0 $end_delimiter = '}';
5948 }
5949 elsif (not $octet{']'}) {
5950 0 $delimiter = '[';
5951 0 $end_delimiter = ']';
5952 }
5953 elsif (not $octet{'>'}) {
5954 0 $delimiter = '<';
5955 0 $end_delimiter = '>';
5956 }
5957 else {
5958 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5959 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5960 0 $delimiter = $char;
5961 0 $end_delimiter = $char;
5962 0 last;
5963 }
5964 }
5965 }
5966 }
5967  
5968 0 my $prematch = '';
5969 0 return join '', $ope, $delimiter, $prematch, '(?:', $string, ')', $matched, $end_delimiter, $modifier;
5970 }
5971  
5972 72 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 1 71 72
5973 72 my $metachar = qr/[\@\\|[\]{^]/oxms;
5974  
5975 # split regexp
5976 72 my @char = $string =~ /\G((?>
5977 [^\\\$\@\[\(] |
5978 \\ (?>[1-9][0-9]*) |
5979 \\g (?>\s*) (?>[1-9][0-9]*) |
5980 \\g (?>\s*) \{ (?>\s*) (?>[1-9][0-9]*) (?>\s*) \} |
5981 \\g (?>\s*) \{ (?>\s*) - (?>\s*) (?>[1-9][0-9]*) (?>\s*) \} |
5982 \\x (?>[0-9A-Fa-f]{1,2}) |
5983 \\ (?>[0-7]{2,3}) |
5984 \\c [\x40-\x5F] |
5985 \\x\{ (?>[0-9A-Fa-f]+) \} |
5986 \\o\{ (?>[0-7]+) \} |
5987 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
5988 \\ $q_char |
5989 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5990 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5991 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5992 [\$\@] $qq_variable |
5993 \$ (?>\s* [0-9]+) |
5994 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5995 \$ \$ (?![\w\{]) |
5996 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5997 \[\^ |
5998 \[\: (?>[a-z]+) :\] |
5999 \[\:\^ (?>[a-z]+) :\] |
6000 \(\? |
6001 $q_char
6002 ))/oxmsg;
6003  
6004 # choice again delimiter
6005 72 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 72 72
6006 0 my %octet = map {$_ => 1} @char;
6007 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
6008 0 $delimiter = '(';
6009 0 $end_delimiter = ')';
6010 }
6011 elsif (not $octet{'}'}) {
6012 0 $delimiter = '{';
6013 0 $end_delimiter = '}';
6014 }
6015 elsif (not $octet{']'}) {
6016 0 $delimiter = '[';
6017 0 $end_delimiter = ']';
6018 }
6019 elsif (not $octet{'>'}) {
6020 0 $delimiter = '<';
6021 0 $end_delimiter = '>';
6022 }
6023 else {
6024 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
6025 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
6026 0 $delimiter = $char;
6027 0 $end_delimiter = $char;
6028 0 last;
6029 }
6030 }
6031 }
6032 }
6033  
6034 # count '('
6035 72 my $parens = grep { $_ eq '(' } @char;
6036  
6037 72 my $left_e = 0;
6038 72 my $right_e = 0;
6039 72 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 200 72 272
6040  
6041 # "\L\u" --> "\u\L"
6042 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
6043 0 @char[$i,$i+1] = @char[$i+1,$i];
6044 }
6045  
6046 # "\U\l" --> "\l\U"
6047 ▶ 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
6048 0 @char[$i,$i+1] = @char[$i+1,$i];
6049 }
6050  
6051 # octal escape sequence
6052 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
6053 1 $char[$i] = Elatin6::octchr($1);
6054 }
6055  
6056 # hexadecimal escape sequence
6057 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
6058 1 $char[$i] = Elatin6::hexchr($1);
6059 }
6060  
6061 # \b{...} --> b\{...}
6062 # \B{...} --> B\{...}
6063 # \N{CHARNAME} --> N\{CHARNAME}
6064 # \p{PROPERTY} --> p\{PROPERTY}
6065 # \P{PROPERTY} --> P\{PROPERTY}
6066 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
6067 0 $char[$i] = $1 . '\\' . $2;
6068 }
6069  
6070 # \p, \P, \X --> p, P, X
6071 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
6072 0 $char[$i] = $1;
6073 }
6074  
6075 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 &Elatin6::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
6076 }
6077  
6078 # join separated multiple-octet
6079 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
6080 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 $Elatin6::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 $Elatin6::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 $Elatin6::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 $Elatin6::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 $Elatin6::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 $Elatin6::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 $Elatin6::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6081 0 $char[$i] .= join '', splice @char, $i+1, 3;
6082 }
6083 ▶ 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 $Elatin6::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 $Elatin6::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 $Elatin6::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 $Elatin6::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6084 0 $char[$i] .= join '', splice @char, $i+1, 2;
6085 }
6086 ▶ 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 $Elatin6::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 $Elatin6::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 $Elatin6::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 $Elatin6::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6087 0 $char[$i] .= join '', splice @char, $i+1, 1;
6088 }
6089 }
6090  
6091 # open character class [...]
6092 elsif ($char[$i] eq '[') {
6093 17 my $left = $i;
6094 17 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 17 17
6095 0 $i++;
6096 }
6097 17 while (1) {
6098 74 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 74 74
6099 0 die __FILE__, ": Unmatched [] in regexp\n";
6100 }
6101 74 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 17 57 74
6102 17 my $right = $i;
6103  
6104 # [...]
6105 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
6106 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin6::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6107 }
6108 else {
6109 17 splice @char, $left, $right-$left+1, Elatin6::charlist_qr(@char[$left+1..$right-1], $modifier);
6110 }
6111  
6112 17 $i = $left;
6113 17 last;
6114 }
6115 }
6116 }
6117  
6118 # open character class [^...]
6119 elsif ($char[$i] eq '[^') {
6120 0 my $left = $i;
6121 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6122 0 $i++;
6123 }
6124 0 while (1) {
6125 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6126 0 die __FILE__, ": Unmatched [] in regexp\n";
6127 }
6128 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6129 0 my $right = $i;
6130  
6131 # [^...]
6132 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
6133 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin6::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6134 }
6135 else {
6136 0 splice @char, $left, $right-$left+1, Elatin6::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6137 }
6138  
6139 0 $i = $left;
6140 0 last;
6141 }
6142 }
6143 }
6144  
6145 # rewrite character class or escape character
6146 elsif (my $char = character_class($char[$i],$modifier)) {
6147 7 $char[$i] = $char;
6148 }
6149  
6150 # /i modifier
6151 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin6::uc($char[$i]) ne Elatin6::fc($char[$i]))) {
Condition66%4/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin6::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 &Elatin6::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin6::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= &Elatin6::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6152 3 ▶ if (CORE::length(Elatin6::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 3 0 3
6153 3 $char[$i] = '[' . Elatin6::uc($char[$i]) . Elatin6::fc($char[$i]) . ']';
6154 }
6155 else {
6156 0 $char[$i] = '(?:' . Elatin6::uc($char[$i]) . '|' . Elatin6::fc($char[$i]) . ')';
6157 }
6158 }
6159  
6160 # \u \l \U \L \F \Q \E
6161 elsif ($char[$i] =~ /\A [<>] \z/oxms) {
6162 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
6163 0 $char[$i] = '\\' . $char[$i];
6164 }
6165 }
6166 elsif ($char[$i] eq '\u') {
6167 0 $char[$i] = '@{[Elatin6::ucfirst qq<';
6168 0 $left_e++;
6169 }
6170 elsif ($char[$i] eq '\l') {
6171 0 $char[$i] = '@{[Elatin6::lcfirst qq<';
6172 0 $left_e++;
6173 }
6174 elsif ($char[$i] eq '\U') {
6175 0 $char[$i] = '@{[Elatin6::uc qq<';
6176 0 $left_e++;
6177 }
6178 elsif ($char[$i] eq '\L') {
6179 0 $char[$i] = '@{[Elatin6::lc qq<';
6180 0 $left_e++;
6181 }
6182 elsif ($char[$i] eq '\F') {
6183 0 $char[$i] = '@{[Elatin6::fc qq<';
6184 0 $left_e++;
6185 }
6186 elsif ($char[$i] eq '\Q') {
6187 0 $char[$i] = '@{[CORE::quotemeta qq<';
6188 0 $left_e++;
6189 }
6190 elsif ($char[$i] eq '\E') {
6191 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
6192 0 $char[$i] = '>]}';
6193 0 $right_e++;
6194 }
6195 else {
6196 0 $char[$i] = '';
6197 }
6198 }
6199 elsif ($char[$i] eq '\Q') {
6200 0 while (1) {
6201 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6202 0 last;
6203 }
6204 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
6205 0 last;
6206 }
6207 }
6208 }
6209 elsif ($char[$i] eq '\E') {
6210 }
6211  
6212 # \0 --> \0
6213 elsif ($char[$i] =~ /\A \\ (?>\s*) 0 \z/oxms) {
6214 }
6215  
6216 # \g{N}, \g{-N}
6217  
6218 # P.108 Using Simple Patterns
6219 # in Chapter 7: In the World of Regular Expressions
6220 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
6221  
6222 # P.221 Capturing
6223 # in Chapter 5: Pattern Matching
6224 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
6225  
6226 # \g{-1}, \g{-2}, \g{-3} --> \g{-1}, \g{-2}, \g{-3}
6227 elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) - (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6228 }
6229  
6230 # \g{1}, \g{2}, \g{3} --> \g{2}, \g{3}, \g{4} (only when multibyte anchoring is enable)
6231 elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6232 }
6233  
6234 # \g1, \g2, \g3 --> \g2, \g3, \g4 (only when multibyte anchoring is enable)
6235 elsif ($char[$i] =~ /\A \\g (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) {
6236 }
6237  
6238 # \1, \2, \3 --> \2, \3, \4 (only when multibyte anchoring is enable)
6239 elsif ($char[$i] =~ /\A \\ (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) {
6240 }
6241  
6242 # $0 --> $0
6243 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
6244 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6245 0 $char[$i] = '@{[Elatin6::ignorecase(' . $char[$i] . ')]}';
6246 }
6247 }
6248 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
6249 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6250 0 $char[$i] = '@{[Elatin6::ignorecase(' . $char[$i] . ')]}';
6251 }
6252 }
6253  
6254 # $$ --> $$
6255 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
6256 }
6257  
6258 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
6259 # $1, $2, $3 --> $1, $2, $3 otherwise
6260 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
6261 0 $char[$i] = e_capture($1);
6262 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6263 0 $char[$i] = '@{[Elatin6::ignorecase(' . $char[$i] . ')]}';
6264 }
6265 }
6266 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6267 0 $char[$i] = e_capture($1);
6268 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6269 0 $char[$i] = '@{[Elatin6::ignorecase(' . $char[$i] . ')]}';
6270 }
6271 }
6272  
6273 # $$foo[ ... ] --> $ $foo->[ ... ]
6274 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
6275 0 $char[$i] = e_capture($1.'->'.$2);
6276 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6277 0 $char[$i] = '@{[Elatin6::ignorecase(' . $char[$i] . ')]}';
6278 }
6279 }
6280  
6281 # $$foo{ ... } --> $ $foo->{ ... }
6282 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
6283 0 $char[$i] = e_capture($1.'->'.$2);
6284 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6285 0 $char[$i] = '@{[Elatin6::ignorecase(' . $char[$i] . ')]}';
6286 }
6287 }
6288  
6289 # $$foo
6290 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
6291 0 $char[$i] = e_capture($1);
6292 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6293 0 $char[$i] = '@{[Elatin6::ignorecase(' . $char[$i] . ')]}';
6294 }
6295 }
6296  
6297 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin6::PREMATCH()
6298 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
6299 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 4 4
6300 0 $char[$i] = '@{[Elatin6::ignorecase(Elatin6::PREMATCH())]}';
6301 }
6302 else {
6303 4 $char[$i] = '@{[Elatin6::PREMATCH()]}';
6304 }
6305 }
6306  
6307 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin6::MATCH()
6308 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
6309 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 4 4
6310 0 $char[$i] = '@{[Elatin6::ignorecase(Elatin6::MATCH())]}';
6311 }
6312 else {
6313 4 $char[$i] = '@{[Elatin6::MATCH()]}';
6314 }
6315 }
6316  
6317 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin6::POSTMATCH()
6318 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
6319 3 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 3 3
6320 0 $char[$i] = '@{[Elatin6::ignorecase(Elatin6::POSTMATCH())]}';
6321 }
6322 else {
6323 3 $char[$i] = '@{[Elatin6::POSTMATCH()]}';
6324 }
6325 }
6326  
6327 # ${ foo }
6328 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
6329 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6330 0 $char[$i] = '@{[Elatin6::ignorecase(' . $char[$i] . ')]}';
6331 }
6332 }
6333  
6334 # ${ ... }
6335 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
6336 0 $char[$i] = e_capture($1);
6337 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6338 0 $char[$i] = '@{[Elatin6::ignorecase(' . $char[$i] . ')]}';
6339 }
6340 }
6341  
6342 # $scalar or @array
6343 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
6344 4 $char[$i] = e_string($char[$i]);
6345 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 4 4
6346 0 $char[$i] = '@{[Elatin6::ignorecase(' . $char[$i] . ')]}';
6347 }
6348 }
6349  
6350 # quote character before ? + * {
6351 ▶ 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
6352 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
6353 }
6354 else {
6355 14 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6356 }
6357 }
6358 }
6359  
6360 # make regexp string
6361 72 my $prematch = '';
6362 72 $modifier =~ tr/i//d;
6363 72 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 72 72
6364 0 return join '', $ope, $delimiter, $prematch, '(?:', @char, '>]}' x ($left_e - $right_e), ')', $matched, $end_delimiter, $modifier;
6365 }
6366 72 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6367 }
6368  
6369 #
6370 # escape regexp (s'here'' or s'here''b)
6371 #
6372 21 ▶sub e_s1_q {
Subroutine e_s1_q: called CC=7 SCAR=24.3
Pod undocumented
6373 21 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6374 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
6375  
6376 21 $modifier =~ tr/p//d;
6377 21 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 21 21
6378 0 my $line = 0;
6379 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6380 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6381 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6382 0 last;
6383 }
6384 }
6385 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6386 }
6387  
6388 21 $slash = 'div';
6389  
6390 # literal null string pattern
6391 21 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 13 21
elsif ($modifier =~ tr/Bb//d) { } 0 13 13
6392 8 $modifier =~ tr/bB//d;
6393 8 $modifier =~ tr/i//d;
6394 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
6395 }
6396  
6397 # with /b /B modifier
6398 elsif ($modifier =~ tr/bB//d) {
6399 0 return e_s1_qb($ope,$delimiter,$end_delimiter,$string,$modifier);
6400 }
6401  
6402 # without /b /B modifier
6403 else {
6404 13 return e_s1_qt($ope,$delimiter,$end_delimiter,$string,$modifier);
6405 }
6406 }
6407  
6408 #
6409 # escape regexp (s'here'')
6410 #
6411 13 ▶sub e_s1_qt {
Subroutine e_s1_qt: called CC=20 SCAR=50.1
Pod undocumented
6412 13 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6413  
6414 13 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 13 13
6415  
6416 # split regexp
6417 13 my @char = $string =~ /\G((?>
6418 [^\\\[\$\@\/] |
6419 [\x00-\xFF] |
6420 \[\^ |
6421 \[\: (?>[a-z]+) \:\] |
6422 \[\:\^ (?>[a-z]+) \:\] |
6423 [\$\@\/] |
6424 \\ (?:$q_char) |
6425 (?:$q_char)
6426 ))/oxmsg;
6427  
6428 # unescape character
6429 13 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 25 13 38
6430 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 &Elatin6::uc($char[$i]) ne &fc($char[$i])) { } 0 19 19
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 32 32
6431 }
6432  
6433 # open character class [...]
6434 elsif ($char[$i] eq '[') {
6435 0 my $left = $i;
6436 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6437 0 $i++;
6438 }
6439 0 while (1) {
6440 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6441 0 die __FILE__, ": Unmatched [] in regexp\n";
6442 }
6443 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6444 0 my $right = $i;
6445  
6446 # [...]
6447 0 splice @char, $left, $right-$left+1, Elatin6::charlist_qr(@char[$left+1..$right-1], $modifier);
6448  
6449 0 $i = $left;
6450 0 last;
6451 }
6452 }
6453 }
6454  
6455 # open character class [^...]
6456 elsif ($char[$i] eq '[^') {
6457 0 my $left = $i;
6458 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6459 0 $i++;
6460 }
6461 0 while (1) {
6462 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6463 0 die __FILE__, ": Unmatched [] in regexp\n";
6464 }
6465 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6466 0 my $right = $i;
6467  
6468 # [^...]
6469 0 splice @char, $left, $right-$left+1, Elatin6::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6470  
6471 0 $i = $left;
6472 0 last;
6473 }
6474 }
6475 }
6476  
6477 # escape $ @ / and \
6478 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6479 0 $char[$i] = '\\' . $char[$i];
6480 }
6481  
6482 # rewrite character class or escape character
6483 elsif (my $char = character_class($char[$i],$modifier)) {
6484 6 $char[$i] = $char;
6485 }
6486  
6487 # /i modifier
6488 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin6::uc($char[$i]) ne Elatin6::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin6::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 &Elatin6::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin6::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= &Elatin6::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6489 0 ▶ if (CORE::length(Elatin6::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
6490 0 $char[$i] = '[' . Elatin6::uc($char[$i]) . Elatin6::fc($char[$i]) . ']';
6491 }
6492 else {
6493 0 $char[$i] = '(?:' . Elatin6::uc($char[$i]) . '|' . Elatin6::fc($char[$i]) . ')';
6494 }
6495 }
6496  
6497 # quote character before ? + * {
6498 ▶ 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
6499 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
6500 }
6501 else {
6502 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6503 }
6504 }
6505 }
6506  
6507 13 $modifier =~ tr/i//d;
6508 13 $delimiter = '/';
6509 13 $end_delimiter = '/';
6510 13 my $prematch = '';
6511 13 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6512 }
6513  
6514 #
6515 # escape regexp (s'here''b)
6516 #
6517 0 ▶sub e_s1_qb {
Subroutine e_s1_qb: not called CC=4 SCAR=30.0
Pod undocumented
6518 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6519  
6520 # split regexp
6521 0 my @char = $string =~ /\G (?>[^\\]|\\\\) /oxmsg;
6522  
6523 # unescape character
6524 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
6525 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
6526 }
6527  
6528 # remain \\
6529 elsif ($char[$i] eq '\\\\') {
6530 }
6531  
6532 # escape $ @ / and \
6533 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6534 0 $char[$i] = '\\' . $char[$i];
6535 }
6536 }
6537  
6538 0 $delimiter = '/';
6539 0 $end_delimiter = '/';
6540 0 my $prematch = '';
6541 0 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6542 }
6543  
6544 #
6545 # escape regexp (s''here')
6546 #
6547 16 ▶sub e_s2_q {
Subroutine e_s2_q: called CC=4 SCAR=13.9
Pod undocumented
6548 16 my($ope,$delimiter,$end_delimiter,$string) = @_;
6549  
6550 16 $slash = 'div';
6551  
6552 16 my @char = $string =~ / \G (?>[^\\]|\\\\|$q_char) /oxmsg;
6553 16 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 9 16 25
6554 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
6555 }
6556  
6557 # not escape \\
6558 elsif ($char[$i] =~ /\A \\\\ \z/oxms) {
6559 }
6560  
6561 # escape $ @ / and \
6562 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6563 5 $char[$i] = '\\' . $char[$i];
6564 }
6565 }
6566  
6567 16 return join '', $ope, $delimiter, @char, $end_delimiter;
6568 }
6569  
6570 #
6571 # escape regexp (s/here/and here/modifier)
6572 #
6573 101 ▶sub e_sub {
Subroutine e_sub: called CC=20 SCAR=32.6
Pod undocumented
6574 101 my($variable,$delimiter1,$pattern,$end_delimiter1,$delimiter2,$replacement,$end_delimiter2,$modifier) = @_;
6575 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
6576  
6577 101 $modifier =~ tr/p//d;
6578 101 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 101 101
6579 0 my $line = 0;
6580 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6581 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6582 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6583 0 last;
6584 }
6585 }
6586 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6587 }
6588  
6589 101 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq "") 36 65 101
6590 36 $variable = '$_';
6591 36 $bind_operator = ' =~ ';
6592 }
6593  
6594 101 $slash = 'div';
6595  
6596 # P.128 Start of match (or end of previous match): \G
6597 # P.130 Advanced Use of \G with Perl
6598 # in Chapter 3: Overview of Regular Expression Features and Flavors
6599 # P.312 Iterative Matching: Scalar Context, with /g
6600 # in Chapter 7: Perl
6601 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
6602  
6603 # P.181 Where You Left Off: The \G Assertion
6604 # in Chapter 5: Pattern Matching
6605 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
6606  
6607 # P.220 Where You Left Off: The \G Assertion
6608 # in Chapter 5: Pattern Matching
6609 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
6610  
6611 101 my $e_modifier = $modifier =~ tr/e//d;
6612 101 my $r_modifier = $modifier =~ tr/r//d;
6613  
6614 101 my $my = '';
6615 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
6616 0 $my = $variable;
6617 0 $variable =~ s/ (?: local \b | my \b | our \b | state \b ) (?>\s*) //oxms;
6618 0 $variable =~ s/ = .+ \z//oxms;
6619 }
6620  
6621 101 (my $variable_basename = $variable) =~ s/ [\[\{].* \z//oxms;
6622 101 $variable_basename =~ s/ \s+ \z//oxms;
6623  
6624 # quote replacement string
6625 101 my $e_replacement = '';
6626 101 ▶ if ($e_modifier >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($e_modifier >= 1) { } 17 84 101
6627 17 $e_replacement = e_qq('', '', '', $replacement);
6628 17 $e_modifier--;
6629 }
6630 else {
6631 84 ▶ if ($delimiter2 eq "'") {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter2 eq q[']) { } 16 68 84
6632 16 $e_replacement = e_s2_q('qq', '/', '/', $replacement);
6633 }
6634 else {
6635 68 $e_replacement = e_qq ('qq', $delimiter2, $end_delimiter2, $replacement);
6636 }
6637 }
6638  
6639 101 my $sub = '';
6640  
6641 # with /r
6642 101 ▶ if ($r_modifier) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r_modifier) { } 10 91 101
6643 10 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $modifier =~ /g/mosx }) { } 5 5 10
6644 }
6645  
6646 # s///gr without multibyte anchoring
6647 elsif ($modifier =~ /g/oxms) {
6648 5 ▶ $sub = sprintf(
Branch: 1 branch
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 0 5 5
6649 # 1 2 3 4 5
6650 q<CORE::eval{local $Elatin6::re_t=%s; while($Elatin6::re_t =~ %s){%s local $^W=0; local $Elatin6::re_r=%s; %s$Elatin6::re_t="$`$Elatin6::re_r$'"; pos($Elatin6::re_t)=length "$`$Elatin6::re_r"; } return $Elatin6::re_t}>,
6651  
6652 $variable, # 1
6653 ($delimiter1 eq "'") ? # 2
6654 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
6655 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
6656 $s_matched, # 3
6657 $e_replacement, # 4
6658 '$Elatin6::re_r=CORE::eval $Elatin6::re_r; ' x $e_modifier, # 5
6659 );
6660 }
6661  
6662 # s///r
6663 else {
6664  
6665 5 my $prematch = q{$`};
6666  
6667 5 ▶ $sub = sprintf(
Branch: 1 branch
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 0 5 5
6668 # 1 2 3 4 5 6 7
6669 q<(%s =~ %s) ? CORE::eval{%s local $^W=0; local $Elatin6::re_r=%s; %s"%s$Elatin6::re_r$'" } : %s>,
6670  
6671 $variable, # 1
6672 ($delimiter1 eq "'") ? # 2
6673 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
6674 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
6675 $s_matched, # 3
6676 $e_replacement, # 4
6677 '$Elatin6::re_r=CORE::eval $Elatin6::re_r; ' x $e_modifier, # 5
6678 $prematch, # 6
6679 $variable, # 7
6680 );
6681 }
6682  
6683 # $var !~ s///r doesn't make sense
6684 10 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) 0 10 10
6685 0 $sub = q{die("$0: Using !~ with s///r doesn't make sense"), } . $sub;
6686 }
6687 }
6688  
6689 # without /r
6690 else {
6691 91 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $modifier =~ /g/mosx }) { } 23 68 91
6692 }
6693  
6694 # s///g without multibyte anchoring
6695 elsif ($modifier =~ /g/oxms) {
6696 23 ▶ $sub = sprintf(
Branch: 2 branches
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 3 20 23
$bind_operator =~ / !~ /mosx ? : 3 20 23
6697 # 1 2 3 4 5 6 7 8
6698 q<CORE::eval{local $Elatin6::re_n=0; while(%s =~ %s){%s local $^W=0; local $Elatin6::re_r=%s; %s%s="$`$Elatin6::re_r$'"; pos(%s)=length "$`$Elatin6::re_r"; $Elatin6::re_n++} return %s$Elatin6::re_n}>,
6699  
6700 $variable, # 1
6701 ($delimiter1 eq "'") ? # 2
6702 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
6703 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
6704 $s_matched, # 3
6705 $e_replacement, # 4
6706 '$Elatin6::re_r=CORE::eval $Elatin6::re_r; ' x $e_modifier, # 5
6707 $variable, # 6
6708 $variable, # 7
6709 ($bind_operator =~ / !~ /oxms) ? '!' : '', # 8
6710 );
6711 }
6712  
6713 # s///
6714 else {
6715  
6716 68 my $prematch = q{$`};
6717  
6718 68 ▶ $sub = sprintf(
Branch: 2 branches
BranchTrueFalseTotal
$bind_operator =~ / =~ /mosx ? : 65 3 68
$delimiter1 eq q['] ? : 18 50 68
6719  
6720 ($bind_operator =~ / =~ /oxms) ?
6721  
6722 # 1 2 3 4 5 6 7 8
6723 q<(%s%s%s) ? CORE::eval{%s local $^W=0; local $Elatin6::re_r=%s; %s%s="%s$Elatin6::re_r$'"; 1 } : undef> :
6724  
6725 # 1 2 3 4 5 6 7 8
6726 q<(%s%s%s) ? 1 : CORE::eval{%s local $^W=0; local $Elatin6::re_r=%s; %s%s="%s$Elatin6::re_r$'"; undef }>,
6727  
6728 $variable, # 1
6729 $bind_operator, # 2
6730 ($delimiter1 eq "'") ? # 3
6731 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
6732 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
6733 $s_matched, # 4
6734 $e_replacement, # 5
6735 '$Elatin6::re_r=CORE::eval $Elatin6::re_r; ' x $e_modifier, # 6
6736 $variable, # 7
6737 $prematch, # 8
6738 );
6739 }
6740 }
6741  
6742 # (my $foo = $bar) =~ s/// --> (my $foo = $bar, CORE::eval { ... })[1]
6743 101 ▶ if ($my ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($my ne "") 0 101 101
6744 0 $sub = "($my, $sub)[1]";
6745 }
6746  
6747 # clear s/// variable
6748 101 $sub_variable = '';
6749 101 $bind_operator = '';
6750  
6751 101 return $sub;
6752 }
6753  
6754 #
6755 # escape regexp of split qr//
6756 #
6757 74 ▶sub e_split {
Subroutine e_split: called CC=88 SCAR=76.4
Pod undocumented
6758 74 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6759 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
6760  
6761 74 $modifier =~ tr/p//d;
6762 74 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 74 74
6763 0 my $line = 0;
6764 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6765 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6766 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6767 0 last;
6768 }
6769 }
6770 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6771 }
6772  
6773 74 $slash = 'div';
6774  
6775 # /b /B modifier
6776 74 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) 0 74 74
6777 0 return join '', 'split', $ope, $delimiter, $string, $end_delimiter, $modifier;
6778 }
6779  
6780 74 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 74 74
6781 74 my $metachar = qr/[\@\\|[\]{^]/oxms;
6782  
6783 # split regexp
6784 74 my @char = $string =~ /\G((?>
6785 [^\\\$\@\[\(] |
6786 \\x (?>[0-9A-Fa-f]{1,2}) |
6787 \\ (?>[0-7]{2,3}) |
6788 \\c [\x40-\x5F] |
6789 \\x\{ (?>[0-9A-Fa-f]+) \} |
6790 \\o\{ (?>[0-7]+) \} |
6791 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
6792 \\ $q_char |
6793 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
6794 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
6795 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
6796 [\$\@] $qq_variable |
6797 \$ (?>\s* [0-9]+) |
6798 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
6799 \$ \$ (?![\w\{]) |
6800 \$ (?>\s*) \$ (?>\s*) $qq_variable |
6801 \[\^ |
6802 \[\: (?>[a-z]+) :\] |
6803 \[\:\^ (?>[a-z]+) :\] |
6804 \(\? |
6805 $q_char
6806 ))/oxmsg;
6807  
6808 74 my $left_e = 0;
6809 74 my $right_e = 0;
6810 74 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 249 74 323
6811  
6812 # "\L\u" --> "\u\L"
6813 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
6814 0 @char[$i,$i+1] = @char[$i+1,$i];
6815 }
6816  
6817 # "\U\l" --> "\l\U"
6818 ▶ 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
6819 0 @char[$i,$i+1] = @char[$i+1,$i];
6820 }
6821  
6822 # octal escape sequence
6823 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
6824 1 $char[$i] = Elatin6::octchr($1);
6825 }
6826  
6827 # hexadecimal escape sequence
6828 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
6829 1 $char[$i] = Elatin6::hexchr($1);
6830 }
6831  
6832 # \b{...} --> b\{...}
6833 # \B{...} --> B\{...}
6834 # \N{CHARNAME} --> N\{CHARNAME}
6835 # \p{PROPERTY} --> p\{PROPERTY}
6836 # \P{PROPERTY} --> P\{PROPERTY}
6837 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
6838 0 $char[$i] = $1 . '\\' . $2;
6839 }
6840  
6841 # \p, \P, \X --> p, P, X
6842 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
6843 0 $char[$i] = $1;
6844 }
6845  
6846 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 &Elatin6::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
6847 }
6848  
6849 # join separated multiple-octet
6850 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
6851 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 $Elatin6::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 $Elatin6::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 $Elatin6::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 $Elatin6::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 $Elatin6::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 $Elatin6::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 $Elatin6::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6852 0 $char[$i] .= join '', splice @char, $i+1, 3;
6853 }
6854 ▶ 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 $Elatin6::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 $Elatin6::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 $Elatin6::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 $Elatin6::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6855 0 $char[$i] .= join '', splice @char, $i+1, 2;
6856 }
6857 ▶ 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 $Elatin6::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 $Elatin6::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 $Elatin6::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 $Elatin6::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6858 0 $char[$i] .= join '', splice @char, $i+1, 1;
6859 }
6860 }
6861  
6862 # open character class [...]
6863 elsif ($char[$i] eq '[') {
6864 3 my $left = $i;
6865 3 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 3 3
6866 0 $i++;
6867 }
6868 3 while (1) {
6869 7 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 7 7
6870 0 die __FILE__, ": Unmatched [] in regexp\n";
6871 }
6872 7 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 3 4 7
6873 3 my $right = $i;
6874  
6875 # [...]
6876 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
6877 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin6::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6878 }
6879 else {
6880 3 splice @char, $left, $right-$left+1, Elatin6::charlist_qr(@char[$left+1..$right-1], $modifier);
6881 }
6882  
6883 3 $i = $left;
6884 3 last;
6885 }
6886 }
6887 }
6888  
6889 # open character class [^...]
6890 elsif ($char[$i] eq '[^') {
6891 0 my $left = $i;
6892 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6893 0 $i++;
6894 }
6895 0 while (1) {
6896 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6897 0 die __FILE__, ": Unmatched [] in regexp\n";
6898 }
6899 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6900 0 my $right = $i;
6901  
6902 # [^...]
6903 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
6904 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin6::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6905 }
6906 else {
6907 0 splice @char, $left, $right-$left+1, Elatin6::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6908 }
6909  
6910 0 $i = $left;
6911 0 last;
6912 }
6913 }
6914 }
6915  
6916 # rewrite character class or escape character
6917 elsif (my $char = character_class($char[$i],$modifier)) {
6918 1 $char[$i] = $char;
6919 }
6920  
6921 # P.794 29.2.161. split
6922 # in Chapter 29: Functions
6923 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
6924  
6925 # P.951 split
6926 # in Chapter 27: Functions
6927 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
6928  
6929 # said "The //m modifier is assumed when you split on the pattern /^/",
6930 # but perl5.008 is not so. Therefore, this software adds //m.
6931 # (and so on)
6932  
6933 # split(m/^/) --> split(m/^/m)
6934 ▶ 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
6935 7 $modifier .= 'm';
6936 }
6937  
6938 # /i modifier
6939 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin6::uc($char[$i]) ne Elatin6::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin6::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 &Elatin6::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin6::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= &Elatin6::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6940 0 ▶ if (CORE::length(Elatin6::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
6941 0 $char[$i] = '[' . Elatin6::uc($char[$i]) . Elatin6::fc($char[$i]) . ']';
6942 }
6943 else {
6944 0 $char[$i] = '(?:' . Elatin6::uc($char[$i]) . '|' . Elatin6::fc($char[$i]) . ')';
6945 }
6946 }
6947  
6948 # \u \l \U \L \F \Q \E
6949 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
6950 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
6951 0 $char[$i] = '\\' . $char[$i];
6952 }
6953 }
6954 elsif ($char[$i] eq '\u') {
6955 0 $char[$i] = '@{[Elatin6::ucfirst qq<';
6956 0 $left_e++;
6957 }
6958 elsif ($char[$i] eq '\l') {
6959 0 $char[$i] = '@{[Elatin6::lcfirst qq<';
6960 0 $left_e++;
6961 }
6962 elsif ($char[$i] eq '\U') {
6963 0 $char[$i] = '@{[Elatin6::uc qq<';
6964 0 $left_e++;
6965 }
6966 elsif ($char[$i] eq '\L') {
6967 0 $char[$i] = '@{[Elatin6::lc qq<';
6968 0 $left_e++;
6969 }
6970 elsif ($char[$i] eq '\F') {
6971 0 $char[$i] = '@{[Elatin6::fc qq<';
6972 0 $left_e++;
6973 }
6974 elsif ($char[$i] eq '\Q') {
6975 0 $char[$i] = '@{[CORE::quotemeta qq<';
6976 0 $left_e++;
6977 }
6978 elsif ($char[$i] eq '\E') {
6979 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
6980 0 $char[$i] = '>]}';
6981 0 $right_e++;
6982 }
6983 else {
6984 0 $char[$i] = '';
6985 }
6986 }
6987 elsif ($char[$i] eq '\Q') {
6988 0 while (1) {
6989 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6990 0 last;
6991 }
6992 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
6993 0 last;
6994 }
6995 }
6996 }
6997 elsif ($char[$i] eq '\E') {
6998 }
6999  
7000 # $0 --> $0
7001 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
7002 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7003 0 $char[$i] = '@{[Elatin6::ignorecase(' . $char[$i] . ')]}';
7004 }
7005 }
7006 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
7007 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7008 0 $char[$i] = '@{[Elatin6::ignorecase(' . $char[$i] . ')]}';
7009 }
7010 }
7011  
7012 # $$ --> $$
7013 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
7014 }
7015  
7016 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
7017 # $1, $2, $3 --> $1, $2, $3 otherwise
7018 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
7019 0 $char[$i] = e_capture($1);
7020 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7021 0 $char[$i] = '@{[Elatin6::ignorecase(' . $char[$i] . ')]}';
7022 }
7023 }
7024 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
7025 0 $char[$i] = e_capture($1);
7026 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7027 0 $char[$i] = '@{[Elatin6::ignorecase(' . $char[$i] . ')]}';
7028 }
7029 }
7030  
7031 # $$foo[ ... ] --> $ $foo->[ ... ]
7032 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
7033 0 $char[$i] = e_capture($1.'->'.$2);
7034 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7035 0 $char[$i] = '@{[Elatin6::ignorecase(' . $char[$i] . ')]}';
7036 }
7037 }
7038  
7039 # $$foo{ ... } --> $ $foo->{ ... }
7040 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
7041 0 $char[$i] = e_capture($1.'->'.$2);
7042 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7043 0 $char[$i] = '@{[Elatin6::ignorecase(' . $char[$i] . ')]}';
7044 }
7045 }
7046  
7047 # $$foo
7048 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
7049 0 $char[$i] = e_capture($1);
7050 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7051 0 $char[$i] = '@{[Elatin6::ignorecase(' . $char[$i] . ')]}';
7052 }
7053 }
7054  
7055 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin6::PREMATCH()
7056 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
7057 12 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 12 12
7058 0 $char[$i] = '@{[Elatin6::ignorecase(Elatin6::PREMATCH())]}';
7059 }
7060 else {
7061 12 $char[$i] = '@{[Elatin6::PREMATCH()]}';
7062 }
7063 }
7064  
7065 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin6::MATCH()
7066 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
7067 12 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 12 12
7068 0 $char[$i] = '@{[Elatin6::ignorecase(Elatin6::MATCH())]}';
7069 }
7070 else {
7071 12 $char[$i] = '@{[Elatin6::MATCH()]}';
7072 }
7073 }
7074  
7075 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin6::POSTMATCH()
7076 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
7077 9 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 9 9
7078 0 $char[$i] = '@{[Elatin6::ignorecase(Elatin6::POSTMATCH())]}';
7079 }
7080 else {
7081 9 $char[$i] = '@{[Elatin6::POSTMATCH()]}';
7082 }
7083 }
7084  
7085 # ${ foo }
7086 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
7087 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7088 0 $char[$i] = '@{[Elatin6::ignorecase(' . $1 . ')]}';
7089 }
7090 }
7091  
7092 # ${ ... }
7093 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
7094 0 $char[$i] = e_capture($1);
7095 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7096 0 $char[$i] = '@{[Elatin6::ignorecase(' . $char[$i] . ')]}';
7097 }
7098 }
7099  
7100 # $scalar or @array
7101 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
7102 3 $char[$i] = e_string($char[$i]);
7103 3 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 3 3
7104 0 $char[$i] = '@{[Elatin6::ignorecase(' . $char[$i] . ')]}';
7105 }
7106 }
7107  
7108 # quote character before ? + * {
7109 ▶ 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
7110 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
7111 }
7112 else {
7113 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
7114 }
7115 }
7116 }
7117  
7118 # make regexp string
7119 74 $modifier =~ tr/i//d;
7120 74 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 74 74
7121 0 return join '', 'Elatin6::split', $ope, $delimiter, @char, '>]}' x ($left_e - $right_e), $end_delimiter, $modifier;
7122 }
7123 74 return join '', 'Elatin6::split', $ope, $delimiter, @char, $end_delimiter, $modifier;
7124 }
7125  
7126 #
7127 # escape regexp of split qr''
7128 #
7129 0 ▶sub e_split_q {
Subroutine e_split_q: not called CC=26 SCAR=65.5
Pod undocumented
7130 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
7131 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
7132  
7133 0 $modifier =~ tr/p//d;
7134 0 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 0 0
7135 0 my $line = 0;
7136 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7137 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
7138 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
7139 0 last;
7140 }
7141 }
7142 0 die qq{Unsupported modifier "$1" used at line $line.\n};
7143 }
7144  
7145 0 $slash = 'div';
7146  
7147 # /b /B modifier
7148 0 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) 0 0 0
7149 0 return join '', 'split', $ope, $delimiter, $string, $end_delimiter, $modifier;
7150 }
7151  
7152 0 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 0 0
7153  
7154 # split regexp
7155 0 my @char = $string =~ /\G((?>
7156 [^\\\[] |
7157 [\x00-\xFF] |
7158 \[\^ |
7159 \[\: (?>[a-z]+) \:\] |
7160 \[\:\^ (?>[a-z]+) \:\] |
7161 \\ (?:$q_char) |
7162 (?:$q_char)
7163 ))/oxmsg;
7164  
7165 # unescape character
7166 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
7167 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 &Elatin6::uc($char[$i]) ne &fc($char[$i])) { } 0 0 0
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 0 0
7168 }
7169  
7170 # open character class [...]
7171 elsif ($char[$i] eq '[') {
7172 0 my $left = $i;
7173 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7174 0 $i++;
7175 }
7176 0 while (1) {
7177 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7178 0 die __FILE__, ": Unmatched [] in regexp\n";
7179 }
7180 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7181 0 my $right = $i;
7182  
7183 # [...]
7184 0 splice @char, $left, $right-$left+1, Elatin6::charlist_qr(@char[$left+1..$right-1], $modifier);
7185  
7186 0 $i = $left;
7187 0 last;
7188 }
7189 }
7190 }
7191  
7192 # open character class [^...]
7193 elsif ($char[$i] eq '[^') {
7194 0 my $left = $i;
7195 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7196 0 $i++;
7197 }
7198 0 while (1) {
7199 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7200 0 die __FILE__, ": Unmatched [] in regexp\n";
7201 }
7202 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7203 0 my $right = $i;
7204  
7205 # [^...]
7206 0 splice @char, $left, $right-$left+1, Elatin6::charlist_not_qr(@char[$left+1..$right-1], $modifier);
7207  
7208 0 $i = $left;
7209 0 last;
7210 }
7211 }
7212 }
7213  
7214 # rewrite character class or escape character
7215 elsif (my $char = character_class($char[$i],$modifier)) {
7216 0 $char[$i] = $char;
7217 }
7218  
7219 # split(m/^/) --> split(m/^/m)
7220 ▶ 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
7221 0 $modifier .= 'm';
7222 }
7223  
7224 # /i modifier
7225 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin6::uc($char[$i]) ne Elatin6::fc($char[$i]))) {
Condition0%0/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin6::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 &Elatin6::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin6::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= &Elatin6::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
7226 0 ▶ if (CORE::length(Elatin6::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
7227 0 $char[$i] = '[' . Elatin6::uc($char[$i]) . Elatin6::fc($char[$i]) . ']';
7228 }
7229 else {
7230 0 $char[$i] = '(?:' . Elatin6::uc($char[$i]) . '|' . Elatin6::fc($char[$i]) . ')';
7231 }
7232 }
7233  
7234 # quote character before ? + * {
7235 ▶ 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
7236 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
7237 }
7238 else {
7239 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
7240 }
7241 }
7242 }
7243  
7244 0 $modifier =~ tr/i//d;
7245 0 return join '', 'Elatin6::split', $ope, $delimiter, @char, $end_delimiter, $modifier;
7246 }
7247  
7248 #
7249 # instead of Carp::carp
7250 #
7251 0 ▶sub carp {
Subroutine carp: not called CC=1 SCAR=6.9
Pod undocumented
7252 0 my($package,$filename,$line) = caller(1);
7253 0 print STDERR "@_ at $filename line $line.\n";
7254 }
7255  
7256 #
7257 # instead of Carp::croak
7258 #
7259 0 ▶sub croak {
Subroutine croak: not called CC=1 SCAR=6.9
Pod undocumented
7260 0 my($package,$filename,$line) = caller(1);
7261 0 print STDERR "@_ at $filename line $line.\n";
7262 0 die "\n";
7263 }
7264  
7265 #
7266 # instead of Carp::cluck
7267 #
7268 0 ▶sub cluck {
Subroutine cluck: not called CC=2 SCAR=17.9
Pod undocumented
7269 0 my $i = 0;
7270 0 my @cluck = ();
7271 0 ▶ while (my($package,$filename,$line,$subroutine) = caller($i)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7272 0 push @cluck, "[$i] $filename($line) $package::$subroutine\n";
7273 0 $i++;
7274 }
7275 0 print STDERR CORE::reverse @cluck;
7276 0 print STDERR "\n";
7277 0 print STDERR @_;
7278 }
7279  
7280 #
7281 # instead of Carp::confess
7282 #
7283 0 ▶sub confess {
Subroutine confess: not called CC=2 SCAR=17.9
Pod undocumented
7284 0 my $i = 0;
7285 0 my @confess = ();
7286 0 ▶ while (my($package,$filename,$line,$subroutine) = caller($i)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7287 0 push @confess, "[$i] $filename($line) $package::$subroutine\n";
7288 0 $i++;
7289 }
7290 0 print STDERR CORE::reverse @confess;
7291 0 print STDERR "\n";
7292 0 print STDERR @_;
7293 0 die "\n";
7294 }
7295  
7296 424 1;
7297  
7298 __END__
↑ Summary Latin6.pm »