blib/lib/Elatin10.pm

filter: Statementstmt 36.4% 1198 / 3286 Branchbran 38.6% 1141 / 2954 Conditioncond 31.0% 115 / 370 MC/DCmcdc 15.9% 35 / 220 Subroutinesub 60.8% 73 / 120 Podpod 4.6% 3 / 64 totaltotal 36.5% 2565 / 7014 CC 1648 SCAR 99.4
CC
1648
Cov
37%
escape_token
55669.4
e_string
33636.6
e_s1
3320.4
CRAP 20709.5
↑ Summary blib/lib/Latin10.pm »
1 package Elatin10;
2 422 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 ######################################################################
4 #
5 # Elatin10 - Run-time routines for Latin10.pm
6 #
7 # http://search.cpan.org/dist/Char-Latin10/
8 #
9 # Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2018, 2019 INABA Hitoshi <ina@cpan.org>
10 ######################################################################
11  
12 422 ▶use 5.00503; # Galapagos Consensus 1998 for primetools
Subroutine BEGIN: called CC=1 SCAR=0.0
13 # use 5.008001; # Lancaster Consensus 2013 for toolchains
14  
15 # 12.3. Delaying use Until Runtime
16 # in Chapter 12. Packages, Libraries, and Modules
17 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
18 # (and so on)
19  
20 # Version numbers should be boring
21 # http://www.dagolden.com/index.php/369/version-numbers-should-be-boring/
22 # For the impatient, the disinterested or those who just want to follow
23 # a recipe, my advice for all modules is this:
24 # our $VERSION = "0.001"; # or "0.001_001" for a dev release
25 # $VERSION = eval $VERSION; # No!! because '1.10' makes '1.1'
26  
27 422 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
28 422 $VERSION = '1.15';
29 422 $VERSION = $VERSION;
30  
31 422 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=7.6
32 422 ▶ if ($^X =~ / jperl /oxmsi) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^X =~ / jperl /imosx) 0 422 422
33 0 die __FILE__, ": needs perl(not jperl) 5.00503 or later. (\$^X==$^X)\n";
34 }
35 422 if (CORE::ord('A') == 193) {
36 die __FILE__, ": is not US-ASCII script (may be EBCDIC or EBCDIK script).\n";
37 }
38 422 if (CORE::ord('A') != 0x41) {
39 die __FILE__, ": is not US-ASCII script (must be US-ASCII script).\n";
40 }
41 }
42  
43 422 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=9.5
44  
45 # instead of utf8.pm
46 422 ▶ CORE::eval q{
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
47 no warnings qw(redefine);
48 *utf8::upgrade = sub { CORE::length $_[0] };
49 *utf8::downgrade = sub { 1 };
50 *utf8::encode = sub { };
51 *utf8::decode = sub { 1 };
52 *utf8::is_utf8 = sub { };
53 *utf8::valid = sub { 1 };
54 };
55 422 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 422 422
56 0 ▶ *utf8::upgrade = sub { CORE::length $_[0] };
Subroutine __ANON__: not called CC=1 SCAR=6.9
57 0 ▶ *utf8::downgrade = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
58 0 ▶ *utf8::encode = sub { };
Subroutine __ANON__: not called CC=1 SCAR=6.9
59 0 ▶ *utf8::decode = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
60 0 ▶ *utf8::is_utf8 = sub { };
Subroutine __ANON__: not called CC=1 SCAR=6.9
61 0 ▶ *utf8::valid = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
62 }
63 }
64  
65 # instead of Symbol.pm
66 BEGIN {
67 0 ▶ sub gensym () {
Subroutine gensym: not called CC=2 SCAR=17.9
Pod undocumented
68 0 ▶ if ($] < 5.006) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] < 5.006) { } 0 0 0
69 0 return \do { local *_ };
70 }
71 else {
72 0 return undef;
73 }
74 }
75  
76 20 ▶ sub qualify ($$) {
Subroutine qualify: called CC=8 SCAR=28.9
Pod undocumented
77 20 my($name) = @_;
78  
79 20 ▶ if (ref $name) {
Branch: 7 branches
BranchTrueFalseTotal
if (ref $name) { } 5 15 20
elsif (&Elatin10::index($name, '::') >= 0) { } 0 15 15
elsif (&Elatin10::index($name, q[']) >= 0) { } 0 15 15
elsif ($name =~ /\A \^ [ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]+ \z/x) { } 0 15 15
elsif ($name =~ /\A (?: ARGV | ARGVOUT | ENV | INC | SIG | STDERR | STDIN | STDOUT ) \z/x) { } 0 15 15
elsif ($name =~ /\A [^ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz] \z/x) { } 0 15 15
elsif (defined $_[1]) { } 15 0 15
80 5 return $name;
81 }
82 elsif (Elatin10::index($name,'::') >= 0) {
83 0 return $name;
84 }
85 elsif (Elatin10::index($name,"'") >= 0) {
86 0 return $name;
87 }
88  
89 # special character, "^xyz"
90 elsif ($name =~ /\A \^ [ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]+ \z/x) {
91  
92 # RGS 2001-11-05 : translate leading ^X to control-char
93 0 $name =~ s{\A \^ ([ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]) }{'qq(\c'.$1.')'}xee;
94 0 return 'main::' . $name;
95 }
96  
97 # Global names
98 elsif ($name =~ /\A (?: ARGV | ARGVOUT | ENV | INC | SIG | STDERR | STDIN | STDOUT ) \z/x) {
99 0 return 'main::' . $name;
100 }
101  
102 # or other
103 elsif ($name =~ /\A [^ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz] \z/x) {
104 0 return 'main::' . $name;
105 }
106  
107 elsif (defined $_[1]) {
108 15 return $_[1] . '::' . $name;
109 }
110 else {
111 0 return (caller)[0] . '::' . $name;
112 }
113 }
114  
115 20 ▶ sub qualify_to_ref ($;$) {
Subroutine qualify_to_ref: called CC=2 SCAR=7.2
Pod undocumented
116 20 ▶ if (defined $_[1]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[1]) { } 20 0 20
117 422 ▶ no strict qw(refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
118 20 return \*{ qualify $_[0], $_[1] };
119 }
120 else {
121 422 ▶ no strict qw(refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: not called CC=1 SCAR=0.0
122 0 return \*{ qualify $_[0], (caller)[0] };
123 }
124 }
125 }
126  
127 # P.714 29.2.39. flock
128 # in Chapter 29: Functions
129 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
130  
131 # P.863 flock
132 # in Chapter 27: Functions
133 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
134  
135 sub LOCK_SH() {1}
136 sub LOCK_EX() {2}
137 sub LOCK_UN() {8}
138 sub LOCK_NB() {4}
139  
140 # instead of Carp.pm
141 sub carp;
142 sub croak;
143 sub cluck;
144 sub confess;
145  
146 # 6.18. Matching Multiple-Byte Characters
147 # in Chapter 6. Pattern Matching
148 # of ISBN 978-1-56592-243-3 Perl Perl Cookbook.
149 # (and so on)
150  
151 # regexp of character
152 422 my $your_char = q{[\x00-\xFF]};
153 422 ▶use vars qw($qq_char); $qq_char = qr/\\c[\x40-\x5F]|\\?(?:$your_char)/oxms;
Subroutine BEGIN: called CC=1 SCAR=0.0
154 422 ▶use vars qw($q_char); $q_char = qr/$your_char/oxms;
Subroutine BEGIN: called CC=1 SCAR=0.0
155  
156 #
157 # Latin-10 character range per length
158 #
159 422 my %range_tr = ();
160  
161 #
162 # Latin-10 case conversion
163 #
164 422 my %lc = ();
165 422 @lc{qw(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)} =
166 qw(a b c d e f g h i j k l m n o p q r s t u v w x y z);
167 422 my %uc = ();
168 422 @uc{qw(a b c d e f g h i j k l m n o p q r s t u v w x y z)} =
169 qw(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z);
170 422 my %fc = ();
171 422 @fc{qw(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)} =
172 qw(a b c d e f g h i j k l m n o p q r s t u v w x y z);
173  
174 422 ▶if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { __PACKAGE__ =~ / \b Elatin10 \z/mosx }) { } 422 0 422
175 }
176  
177 elsif (__PACKAGE__ =~ / \b Elatin10 \z/oxms) {
178 422 %range_tr = (
179 1 => [ [0x00..0xFF],
180 ],
181 );
182  
183 422 %lc = (%lc,
184 "\xA1" => "\xA2", # LATIN LETTER A WITH OGONEK
185 "\xA3" => "\xB3", # LATIN LETTER L WITH STROKE
186 "\xA6" => "\xA8", # LATIN LETTER S WITH CARON
187 "\xAA" => "\xBA", # LATIN LETTER S WITH COMMA BELOW
188 "\xAC" => "\xAE", # LATIN LETTER Z WITH ACUTE
189 "\xAF" => "\xBF", # LATIN LETTER Z WITH DOT ABOVE
190 "\xB2" => "\xB9", # LATIN LETTER C WITH CARON
191 "\xB4" => "\xB8", # LATIN LETTER Z WITH CARON
192 "\xBC" => "\xBD", # LATIN LIGATURE OE
193 "\xBE" => "\xFF", # LATIN LETTER Y WITH DIAERESIS
194 "\xC0" => "\xE0", # LATIN LETTER A WITH GRAVE
195 "\xC1" => "\xE1", # LATIN LETTER A WITH ACUTE
196 "\xC2" => "\xE2", # LATIN LETTER A WITH CIRCUMFLEX
197 "\xC3" => "\xE3", # LATIN LETTER A WITH BREVE
198 "\xC4" => "\xE4", # LATIN LETTER A WITH DIAERESIS
199 "\xC5" => "\xE5", # LATIN LETTER C WITH ACUTE
200 "\xC6" => "\xE6", # LATIN LETTER AE
201 "\xC7" => "\xE7", # LATIN LETTER C WITH CEDILLA
202 "\xC8" => "\xE8", # LATIN LETTER E WITH GRAVE
203 "\xC9" => "\xE9", # LATIN LETTER E WITH ACUTE
204 "\xCA" => "\xEA", # LATIN LETTER E WITH CIRCUMFLEX
205 "\xCB" => "\xEB", # LATIN LETTER E WITH DIAERESIS
206 "\xCC" => "\xEC", # LATIN LETTER I WITH GRAVE
207 "\xCD" => "\xED", # LATIN LETTER I WITH ACUTE
208 "\xCE" => "\xEE", # LATIN LETTER I WITH CIRCUMFLEX
209 "\xCF" => "\xEF", # LATIN LETTER I WITH DIAERESIS
210 "\xD0" => "\xF0", # LATIN LETTER D WITH STROKE
211 "\xD1" => "\xF1", # LATIN LETTER N WITH ACUTE
212 "\xD2" => "\xF2", # LATIN LETTER O WITH GRAVE
213 "\xD3" => "\xF3", # LATIN LETTER O WITH ACUTE
214 "\xD4" => "\xF4", # LATIN LETTER O WITH CIRCUMFLEX
215 "\xD5" => "\xF5", # LATIN LETTER O WITH DOUBLE ACUTE
216 "\xD6" => "\xF6", # LATIN LETTER O WITH DIAERESIS
217 "\xD7" => "\xF7", # LATIN LETTER S WITH ACUTE
218 "\xD8" => "\xF8", # LATIN LETTER U WITH DOUBLE ACUTE
219 "\xD9" => "\xF9", # LATIN LETTER U WITH GRAVE
220 "\xDA" => "\xFA", # LATIN LETTER U WITH ACUTE
221 "\xDB" => "\xFB", # LATIN LETTER U WITH CIRCUMFLEX
222 "\xDC" => "\xFC", # LATIN LETTER U WITH DIAERESIS
223 "\xDD" => "\xFD", # LATIN LETTER E WITH OGONEK
224 "\xDE" => "\xFE", # LATIN LETTER T WITH COMMA BELOW
225 );
226  
227 422 %uc = (%uc,
228 "\xA2" => "\xA1", # LATIN LETTER A WITH OGONEK
229 "\xA8" => "\xA6", # LATIN LETTER S WITH CARON
230 "\xAE" => "\xAC", # LATIN LETTER Z WITH ACUTE
231 "\xB3" => "\xA3", # LATIN LETTER L WITH STROKE
232 "\xB8" => "\xB4", # LATIN LETTER Z WITH CARON
233 "\xB9" => "\xB2", # LATIN LETTER C WITH CARON
234 "\xBA" => "\xAA", # LATIN LETTER S WITH COMMA BELOW
235 "\xBD" => "\xBC", # LATIN LIGATURE OE
236 "\xBF" => "\xAF", # LATIN LETTER Z WITH DOT ABOVE
237 "\xE0" => "\xC0", # LATIN LETTER A WITH GRAVE
238 "\xE1" => "\xC1", # LATIN LETTER A WITH ACUTE
239 "\xE2" => "\xC2", # LATIN LETTER A WITH CIRCUMFLEX
240 "\xE3" => "\xC3", # LATIN LETTER A WITH BREVE
241 "\xE4" => "\xC4", # LATIN LETTER A WITH DIAERESIS
242 "\xE5" => "\xC5", # LATIN LETTER C WITH ACUTE
243 "\xE6" => "\xC6", # LATIN LETTER AE
244 "\xE7" => "\xC7", # LATIN LETTER C WITH CEDILLA
245 "\xE8" => "\xC8", # LATIN LETTER E WITH GRAVE
246 "\xE9" => "\xC9", # LATIN LETTER E WITH ACUTE
247 "\xEA" => "\xCA", # LATIN LETTER E WITH CIRCUMFLEX
248 "\xEB" => "\xCB", # LATIN LETTER E WITH DIAERESIS
249 "\xEC" => "\xCC", # LATIN LETTER I WITH GRAVE
250 "\xED" => "\xCD", # LATIN LETTER I WITH ACUTE
251 "\xEE" => "\xCE", # LATIN LETTER I WITH CIRCUMFLEX
252 "\xEF" => "\xCF", # LATIN LETTER I WITH DIAERESIS
253 "\xF0" => "\xD0", # LATIN LETTER D WITH STROKE
254 "\xF1" => "\xD1", # LATIN LETTER N WITH ACUTE
255 "\xF2" => "\xD2", # LATIN LETTER O WITH GRAVE
256 "\xF3" => "\xD3", # LATIN LETTER O WITH ACUTE
257 "\xF4" => "\xD4", # LATIN LETTER O WITH CIRCUMFLEX
258 "\xF5" => "\xD5", # LATIN LETTER O WITH DOUBLE ACUTE
259 "\xF6" => "\xD6", # LATIN LETTER O WITH DIAERESIS
260 "\xF7" => "\xD7", # LATIN LETTER S WITH ACUTE
261 "\xF8" => "\xD8", # LATIN LETTER U WITH DOUBLE ACUTE
262 "\xF9" => "\xD9", # LATIN LETTER U WITH GRAVE
263 "\xFA" => "\xDA", # LATIN LETTER U WITH ACUTE
264 "\xFB" => "\xDB", # LATIN LETTER U WITH CIRCUMFLEX
265 "\xFC" => "\xDC", # LATIN LETTER U WITH DIAERESIS
266 "\xFD" => "\xDD", # LATIN LETTER E WITH OGONEK
267 "\xFE" => "\xDE", # LATIN LETTER T WITH COMMA BELOW
268 "\xFF" => "\xBE", # LATIN LETTER Y WITH DIAERESIS
269 );
270  
271 422 %fc = (%fc,
272 "\xA1" => "\xA2", # LATIN CAPITAL LETTER A WITH OGONEK --> LATIN SMALL LETTER A WITH OGONEK
273 "\xA3" => "\xB3", # LATIN CAPITAL LETTER L WITH STROKE --> LATIN SMALL LETTER L WITH STROKE
274 "\xA6" => "\xA8", # LATIN CAPITAL LETTER S WITH CARON --> LATIN SMALL LETTER S WITH CARON
275 "\xAA" => "\xBA", # LATIN CAPITAL LETTER S WITH COMMA BELOW --> LATIN SMALL LETTER S WITH COMMA BELOW
276 "\xAC" => "\xAE", # LATIN CAPITAL LETTER Z WITH ACUTE --> LATIN SMALL LETTER Z WITH ACUTE
277 "\xAF" => "\xBF", # LATIN CAPITAL LETTER Z WITH DOT ABOVE --> LATIN SMALL LETTER Z WITH DOT ABOVE
278 "\xB2" => "\xB9", # LATIN CAPITAL LETTER C WITH CARON --> LATIN SMALL LETTER C WITH CARON
279 "\xB4" => "\xB8", # LATIN CAPITAL LETTER Z WITH CARON --> LATIN SMALL LETTER Z WITH CARON
280 "\xBC" => "\xBD", # LATIN CAPITAL LIGATURE OE --> LATIN SMALL LIGATURE OE
281 "\xBE" => "\xFF", # LATIN CAPITAL LETTER Y WITH DIAERESIS --> LATIN SMALL LETTER Y WITH DIAERESIS
282 "\xC0" => "\xE0", # LATIN CAPITAL LETTER A WITH GRAVE --> LATIN SMALL LETTER A WITH GRAVE
283 "\xC1" => "\xE1", # LATIN CAPITAL LETTER A WITH ACUTE --> LATIN SMALL LETTER A WITH ACUTE
284 "\xC2" => "\xE2", # LATIN CAPITAL LETTER A WITH CIRCUMFLEX --> LATIN SMALL LETTER A WITH CIRCUMFLEX
285 "\xC3" => "\xE3", # LATIN CAPITAL LETTER A WITH BREVE --> LATIN SMALL LETTER A WITH BREVE
286 "\xC4" => "\xE4", # LATIN CAPITAL LETTER A WITH DIAERESIS --> LATIN SMALL LETTER A WITH DIAERESIS
287 "\xC5" => "\xE5", # LATIN CAPITAL LETTER C WITH ACUTE --> LATIN SMALL LETTER C WITH ACUTE
288 "\xC6" => "\xE6", # LATIN CAPITAL LETTER AE --> LATIN SMALL LETTER AE
289 "\xC7" => "\xE7", # LATIN CAPITAL LETTER C WITH CEDILLA --> LATIN SMALL LETTER C WITH CEDILLA
290 "\xC8" => "\xE8", # LATIN CAPITAL LETTER E WITH GRAVE --> LATIN SMALL LETTER E WITH GRAVE
291 "\xC9" => "\xE9", # LATIN CAPITAL LETTER E WITH ACUTE --> LATIN SMALL LETTER E WITH ACUTE
292 "\xCA" => "\xEA", # LATIN CAPITAL LETTER E WITH CIRCUMFLEX --> LATIN SMALL LETTER E WITH CIRCUMFLEX
293 "\xCB" => "\xEB", # LATIN CAPITAL LETTER E WITH DIAERESIS --> LATIN SMALL LETTER E WITH DIAERESIS
294 "\xCC" => "\xEC", # LATIN CAPITAL LETTER I WITH GRAVE --> LATIN SMALL LETTER I WITH GRAVE
295 "\xCD" => "\xED", # LATIN CAPITAL LETTER I WITH ACUTE --> LATIN SMALL LETTER I WITH ACUTE
296 "\xCE" => "\xEE", # LATIN CAPITAL LETTER I WITH CIRCUMFLEX --> LATIN SMALL LETTER I WITH CIRCUMFLEX
297 "\xCF" => "\xEF", # LATIN CAPITAL LETTER I WITH DIAERESIS --> LATIN SMALL LETTER I WITH DIAERESIS
298 "\xD0" => "\xF0", # LATIN CAPITAL LETTER D WITH STROKE --> LATIN SMALL LETTER D WITH STROKE
299 "\xD1" => "\xF1", # LATIN CAPITAL LETTER N WITH ACUTE --> LATIN SMALL LETTER N WITH ACUTE
300 "\xD2" => "\xF2", # LATIN CAPITAL LETTER O WITH GRAVE --> LATIN SMALL LETTER O WITH GRAVE
301 "\xD3" => "\xF3", # LATIN CAPITAL LETTER O WITH ACUTE --> LATIN SMALL LETTER O WITH ACUTE
302 "\xD4" => "\xF4", # LATIN CAPITAL LETTER O WITH CIRCUMFLEX --> LATIN SMALL LETTER O WITH CIRCUMFLEX
303 "\xD5" => "\xF5", # LATIN CAPITAL LETTER O WITH DOUBLE ACUTE --> LATIN SMALL LETTER O WITH DOUBLE ACUTE
304 "\xD6" => "\xF6", # LATIN CAPITAL LETTER O WITH DIAERESIS --> LATIN SMALL LETTER O WITH DIAERESIS
305 "\xD7" => "\xF7", # LATIN CAPITAL LETTER S WITH ACUTE --> LATIN SMALL LETTER S WITH ACUTE
306 "\xD8" => "\xF8", # LATIN CAPITAL LETTER U WITH DOUBLE ACUTE --> LATIN SMALL LETTER U WITH DOUBLE ACUTE
307 "\xD9" => "\xF9", # LATIN CAPITAL LETTER U WITH GRAVE --> LATIN SMALL LETTER U WITH GRAVE
308 "\xDA" => "\xFA", # LATIN CAPITAL LETTER U WITH ACUTE --> LATIN SMALL LETTER U WITH ACUTE
309 "\xDB" => "\xFB", # LATIN CAPITAL LETTER U WITH CIRCUMFLEX --> LATIN SMALL LETTER U WITH CIRCUMFLEX
310 "\xDC" => "\xFC", # LATIN CAPITAL LETTER U WITH DIAERESIS --> LATIN SMALL LETTER U WITH DIAERESIS
311 "\xDD" => "\xFD", # LATIN CAPITAL LETTER E WITH OGONEK --> LATIN SMALL LETTER E WITH OGONEK
312 "\xDE" => "\xFE", # LATIN CAPITAL LETTER T WITH COMMA BELOW --> LATIN SMALL LETTER T WITH COMMA BELOW
313 "\xDF" => "\x73\x73", # LATIN SMALL LETTER SHARP S --> LATIN SMALL LETTER S, LATIN SMALL LETTER S
314 );
315 }
316  
317 else {
318 0 croak "Don't know my package name '@{[__PACKAGE__]}'";
319 }
320  
321 #
322 # @ARGV wildcard globbing
323 #
324 211 ▶sub import {
Subroutine import: called CC=7 SCAR=28.3
325  
326 211 ▶ if ($^O =~ /\A (?: MSWin32 | NetWare | symbian | dos ) \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O =~ /\A (?: MSWin32 | NetWare | symbian | dos ) \z/mosx) 0 211 211
327 0 my @argv = ();
328 0 for (@ARGV) {
329  
330 # has space
331 0 ▶ if (/\A (?:$q_char)*? [ ] /oxms) {
Branch: 2 branches
BranchTrueFalseTotal
if (/\A (?:$Elatin10::q_char)*? [ ] /mosx) { } 0 0 0
elsif (/\A (?:$Elatin10::q_char)*? [*?] /mosx) { } 0 0 0
332 0 ▶ if (my @glob = Elatin10::glob(qq{"$_"})) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@glob) = &Elatin10::glob(qq["$_"])) { } 0 0 0
333 0 push @argv, @glob;
334 }
335 else {
336 0 push @argv, $_;
337 }
338 }
339  
340 # has wildcard metachar
341 elsif (/\A (?:$q_char)*? [*?] /oxms) {
342 0 ▶ if (my @glob = Elatin10::glob($_)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@glob) = &Elatin10::glob($_)) { } 0 0 0
343 0 push @argv, @glob;
344 }
345 else {
346 0 push @argv, $_;
347 }
348 }
349  
350 # no wildcard globbing
351 else {
352 0 push @argv, $_;
353 }
354 }
355 0 @ARGV = @argv;
356 }
357  
358 211 *Char::ord = \&Latin10::ord;
359 211 *Char::ord_ = \&Latin10::ord_;
360 211 *Char::reverse = \&Latin10::reverse;
361 211 *Char::getc = \&Latin10::getc;
362 211 *Char::length = \&Latin10::length;
363 211 *Char::substr = \&Latin10::substr;
364 211 *Char::index = \&Latin10::index;
365 211 *Char::rindex = \&Latin10::rindex;
366 211 *Char::eval = \&Latin10::eval;
367 211 *Char::escape = \&Latin10::escape;
368 211 *Char::escape_token = \&Latin10::escape_token;
369 211 *Char::escape_script = \&Latin10::escape_script;
370 }
371  
372 # P.230 Care with Prototypes
373 # in Chapter 6: Subroutines
374 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
375 #
376 # If you aren't careful, you can get yourself into trouble with prototypes.
377 # But if you are careful, you can do a lot of neat things with them. This is
378 # all very powerful, of course, and should only be used in moderation to make
379 # the world a better place.
380  
381 # P.332 Care with Prototypes
382 # in Chapter 7: Subroutines
383 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
384 #
385 # If you aren't careful, you can get yourself into trouble with prototypes.
386 # But if you are careful, you can do a lot of neat things with them. This is
387 # all very powerful, of course, and should only be used in moderation to make
388 # the world a better place.
389  
390 #
391 # Prototypes of subroutines
392 #
393 0 ▶sub unimport {}
Subroutine unimport: not called CC=1 SCAR=0.0
394 sub Elatin10::split(;$$$);
395 sub Elatin10::tr($$$$;$);
396 sub Elatin10::chop(@);
397 sub Elatin10::index($$;$);
398 sub Elatin10::rindex($$;$);
399 sub Elatin10::lcfirst(@);
400 sub Elatin10::lcfirst_();
401 sub Elatin10::lc(@);
402 sub Elatin10::lc_();
403 sub Elatin10::ucfirst(@);
404 sub Elatin10::ucfirst_();
405 sub Elatin10::uc(@);
406 sub Elatin10::uc_();
407 sub Elatin10::fc(@);
408 sub Elatin10::fc_();
409 sub Elatin10::ignorecase;
410 sub Elatin10::classic_character_class;
411 sub Elatin10::capture;
412 sub Elatin10::chr(;$);
413 sub Elatin10::chr_();
414 sub Elatin10::glob($);
415 sub Elatin10::glob_();
416  
417 sub Latin10::ord(;$);
418 sub Latin10::ord_();
419 sub Latin10::reverse(@);
420 sub Latin10::getc(;*@);
421 sub Latin10::length(;$);
422 sub Latin10::substr($$;$$);
423 sub Latin10::index($$;$);
424 sub Latin10::rindex($$;$);
425 sub Latin10::escape(;$);
426  
427 #
428 # Regexp work
429 #
430 422 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
431 $re_a
432 $re_t
433 $re_n
434 $re_r
435 422 );
436  
437 #
438 # Character class
439 #
440 422 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
441 $dot
442 $dot_s
443 $eD
444 $eS
445 $eW
446 $eH
447 $eV
448 $eR
449 $eN
450 $not_alnum
451 $not_alpha
452 $not_ascii
453 $not_blank
454 $not_cntrl
455 $not_digit
456 $not_graph
457 $not_lower
458 $not_lower_i
459 $not_print
460 $not_punct
461 $not_space
462 $not_upper
463 $not_upper_i
464 $not_word
465 $not_xdigit
466 $eb
467 $eB
468 422 );
469  
470 422 ${Elatin10::dot} = qr{(?>[^\x0A])};
471 422 ${Elatin10::dot_s} = qr{(?>[\x00-\xFF])};
472 422 ${Elatin10::eD} = qr{(?>[^0-9])};
473  
474 # Vertical tabs are now whitespace
475 # \s in a regex now matches a vertical tab in all circumstances.
476 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
477 # ${Elatin10::eS} = qr{(?>[^\x09\x0A \x0C\x0D\x20])};
478 # ${Elatin10::eS} = qr{(?>[^\x09\x0A\x0B\x0C\x0D\x20])};
479 422 ${Elatin10::eS} = qr{(?>[^\s])};
480  
481 422 ${Elatin10::eW} = qr{(?>[^0-9A-Z_a-z])};
482 422 ${Elatin10::eH} = qr{(?>[^\x09\x20])};
483 422 ${Elatin10::eV} = qr{(?>[^\x0A\x0B\x0C\x0D])};
484 422 ${Elatin10::eR} = qr{(?>\x0D\x0A|[\x0A\x0D])};
485 422 ${Elatin10::eN} = qr{(?>[^\x0A])};
486 422 ${Elatin10::not_alnum} = qr{(?>[^\x30-\x39\x41-\x5A\x61-\x7A])};
487 422 ${Elatin10::not_alpha} = qr{(?>[^\x41-\x5A\x61-\x7A])};
488 422 ${Elatin10::not_ascii} = qr{(?>[^\x00-\x7F])};
489 422 ${Elatin10::not_blank} = qr{(?>[^\x09\x20])};
490 422 ${Elatin10::not_cntrl} = qr{(?>[^\x00-\x1F\x7F])};
491 422 ${Elatin10::not_digit} = qr{(?>[^\x30-\x39])};
492 422 ${Elatin10::not_graph} = qr{(?>[^\x21-\x7F])};
493 422 ${Elatin10::not_lower} = qr{(?>[^\x61-\x7A])};
494 422 ${Elatin10::not_lower_i} = qr{(?>[^\x41-\x5A\x61-\x7A])}; # Perl 5.16 compatible
495 # ${Elatin10::not_lower_i} = qr{(?>[\x00-\xFF])}; # older Perl compatible
496 422 ${Elatin10::not_print} = qr{(?>[^\x20-\x7F])};
497 422 ${Elatin10::not_punct} = qr{(?>[^\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E])};
498 422 ${Elatin10::not_space} = qr{(?>[^\s\x0B])};
499 422 ${Elatin10::not_upper} = qr{(?>[^\x41-\x5A])};
500 422 ${Elatin10::not_upper_i} = qr{(?>[^\x41-\x5A\x61-\x7A])}; # Perl 5.16 compatible
501 # ${Elatin10::not_upper_i} = qr{(?>[\x00-\xFF])}; # older Perl compatible
502 422 ${Elatin10::not_word} = qr{(?>[^\x30-\x39\x41-\x5A\x5F\x61-\x7A])};
503 422 ${Elatin10::not_xdigit} = qr{(?>[^\x30-\x39\x41-\x46\x61-\x66])};
504 422 ${Elatin10::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))};
505 422 ${Elatin10::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]))};
506  
507 # avoid: Name "Elatin10::foo" used only once: possible typo at here.
508 422 ${Elatin10::dot} = ${Elatin10::dot};
509 422 ${Elatin10::dot_s} = ${Elatin10::dot_s};
510 422 ${Elatin10::eD} = ${Elatin10::eD};
511 422 ${Elatin10::eS} = ${Elatin10::eS};
512 422 ${Elatin10::eW} = ${Elatin10::eW};
513 422 ${Elatin10::eH} = ${Elatin10::eH};
514 422 ${Elatin10::eV} = ${Elatin10::eV};
515 422 ${Elatin10::eR} = ${Elatin10::eR};
516 422 ${Elatin10::eN} = ${Elatin10::eN};
517 422 ${Elatin10::not_alnum} = ${Elatin10::not_alnum};
518 422 ${Elatin10::not_alpha} = ${Elatin10::not_alpha};
519 422 ${Elatin10::not_ascii} = ${Elatin10::not_ascii};
520 422 ${Elatin10::not_blank} = ${Elatin10::not_blank};
521 422 ${Elatin10::not_cntrl} = ${Elatin10::not_cntrl};
522 422 ${Elatin10::not_digit} = ${Elatin10::not_digit};
523 422 ${Elatin10::not_graph} = ${Elatin10::not_graph};
524 422 ${Elatin10::not_lower} = ${Elatin10::not_lower};
525 422 ${Elatin10::not_lower_i} = ${Elatin10::not_lower_i};
526 422 ${Elatin10::not_print} = ${Elatin10::not_print};
527 422 ${Elatin10::not_punct} = ${Elatin10::not_punct};
528 422 ${Elatin10::not_space} = ${Elatin10::not_space};
529 422 ${Elatin10::not_upper} = ${Elatin10::not_upper};
530 422 ${Elatin10::not_upper_i} = ${Elatin10::not_upper_i};
531 422 ${Elatin10::not_word} = ${Elatin10::not_word};
532 422 ${Elatin10::not_xdigit} = ${Elatin10::not_xdigit};
533 422 ${Elatin10::eb} = ${Elatin10::eb};
534 422 ${Elatin10::eB} = ${Elatin10::eB};
535  
536 #
537 # Latin-10 split
538 #
539 72 ▶sub Elatin10::split(;$$$) {
Subroutine split: called CC=34 SCAR=46.9
Pod undocumented
540  
541 # P.794 29.2.161. split
542 # in Chapter 29: Functions
543 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
544  
545 # P.951 split
546 # in Chapter 27: Functions
547 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
548  
549 72 my $pattern = $_[0];
550 72 my $string = $_[1];
551 72 my $limit = $_[2];
552  
553 # if $pattern is also omitted or is the literal space, " "
554 72 ▶ if (not defined $pattern) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $pattern) 2 70 72
555 2 $pattern = ' ';
556 }
557  
558 # if $string is omitted, the function splits the $_ string
559 72 ▶ if (not defined $string) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $string) 6 66 72
560 6 ▶ if (defined $_) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_) { } 0 6 6
561 0 $string = $_;
562 }
563 else {
564 6 $string = '';
565 }
566 }
567  
568 72 my @split = ();
569  
570 # when string is empty
571 72 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 10 62 72
elsif ($pattern eq ' ') { } 2 60 62
572  
573 # resulting list value in list context
574 10 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 5 5 10
575 5 return @split;
576 }
577  
578 # count of substrings in scalar context
579 else {
580 5 ▶ carp "Use of implicit split to \@_ is deprecated" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 5 5
581 5 @_ = @split;
582 5 return scalar @_;
583 }
584 }
585  
586 # split's first argument is more consistently interpreted
587 #
588 # After some changes earlier in v5.17, split's behavior has been simplified:
589 # if the PATTERN argument evaluates to a string containing one space, it is
590 # treated the way that a literal string containing one space once was.
591 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#split's_first_argument_is_more_consistently_interpreted
592  
593 # if $pattern is also omitted or is the literal space, " ", the function splits
594 # on whitespace, /\s+/, after skipping any leading whitespace
595 # (and so on)
596  
597 elsif ($pattern eq ' ') {
598 2 ▶ if (not defined $limit) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $limit) { } 2 0 2
599 2 return CORE::split(' ', $string);
600 }
601 else {
602 0 return CORE::split(' ', $string, $limit);
603 }
604 }
605  
606 # if $limit is negative, it is treated as if an arbitrarily large $limit has been specified
607 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
608  
609 # a pattern capable of matching either the null string or something longer than the
610 # null string will split the value of $string into separate characters wherever it
611 # matches the null string between characters
612 # (and so on)
613  
614 60 ▶ if ('' =~ / \A $pattern \z /xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ('' =~ / \A $pattern \z /msx) { } 2 58 60
615 2 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
616 2 my $limit = scalar(() = $string =~ /($pattern)/oxmsg);
617  
618 # P.1024 Appendix W.10 Multibyte Processing
619 # of ISBN 1-56592-224-7 CJKV Information Processing
620 # (and so on)
621  
622 # the //m modifier is assumed when you split on the pattern /^/
623 # (and so on)
624  
625 # V
626 2 ▶ while ((--$limit > 0) and ($string =~ s/\A((?:$q_char)+?)$pattern//m)) {
Branch: 1 branch
BranchTrueFalseTotal
if (--$limit > 0 and $string =~ s/\A((?:$Elatin10::q_char)+?)$pattern//m) 9 2 11
Condition100%3/3
--$limit > 0 and $string =~ s/\A((?:$Elatin10::q_char)+?)$pattern//m
!ll&&!rl&&r
119
MC/DC100%2/2
--$limit > 0 and $string =~ s/\A((?:$Elatin10::q_char)+?)$pattern//m
--$limit > 0 $string =~ s/\A((?:$Elatin10::q_char)+?)$pattern//m
Truth table100%3/3
A and B
A= --$limit > 0B= $string =~ s/\A((?:$Elatin10::q_char)+?)$pattern//m
ABresult
0X0
100
111
627  
628 # if the $pattern contains parentheses, then the substring matched by each pair of parentheses
629 # is included in the resulting list, interspersed with the fields that are ordinarily returned
630 # (and so on)
631  
632 9 local $@;
633 9 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 9 9 18
634 9 push @split, CORE::eval('$' . $digit);
635 }
636 }
637 }
638  
639 else {
640 58 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
641  
642 # V
643 58 ▶ while ($string =~ s/\A((?:$q_char)*?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Elatin10::q_char)*?)$pattern//m) 163 58 221
644 163 local $@;
645 163 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 230 163 393
646 230 push @split, CORE::eval('$' . $digit);
647 }
648 }
649 }
650 }
651  
652 elsif ($limit > 0) {
653 0 ▶ if ('' =~ / \A $pattern \z /xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ('' =~ / \A $pattern \z /msx) { } 0 0 0
654 0 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
655 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
656  
657 # V
658 0 ▶ if ($string =~ s/\A((?:$q_char)+?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Elatin10::q_char)+?)$pattern//m) 0 0 0
659 0 local $@;
660 0 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 0 0 0
661 0 push @split, CORE::eval('$' . $digit);
662 }
663 }
664 }
665 }
666 else {
667 0 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
668 0 ▶ while ((--$limit > 0) and (CORE::length($string) > 0)) {
Branch: 1 branch
BranchTrueFalseTotal
if (--$limit > 0 and length $string > 0) 0 0 0
Condition0%0/3
--$limit > 0 and length $string > 0
!ll&&!rl&&r
000
MC/DC0%0/2
--$limit > 0 and length $string > 0
--$limit > 0 length $string > 0
Truth table0%0/3
A and B
A= --$limit > 0B= length $string > 0
ABresult
0X0
100
111
669  
670 # V
671 0 ▶ if ($string =~ s/\A((?:$q_char)*?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Elatin10::q_char)*?)$pattern//m) 0 0 0
672 0 local $@;
673 0 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 0 0 0
674 0 push @split, CORE::eval('$' . $digit);
675 }
676 }
677 }
678 }
679 }
680  
681 60 ▶ if (CORE::length($string) > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $string > 0) 58 2 60
682 58 push @split, $string;
683 }
684  
685 # if $_[2] (NOT "$limit") is omitted or zero, trailing null fields are stripped from the result
686 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
687 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
688 0 pop @split;
689 }
690 }
691  
692 # resulting list value in list context
693 60 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 58 2 60
694 58 return @split;
695 }
696  
697 # count of substrings in scalar context
698 else {
699 2 ▶ carp "Use of implicit split to \@_ is deprecated" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 2 2
700 2 @_ = @split;
701 2 return scalar @_;
702 }
703 }
704  
705 #
706 # get last subexpression offsets
707 #
708 60 ▶sub _last_subexpression_offsets {
Subroutine _last_subexpression_offsets: called CC=3 SCAR=11.0
709 60 my $pattern = $_[0];
710  
711 # remove comment
712 60 $pattern =~ s/\(\?\# .*? \)//oxmsg;
713  
714 60 my $modifier = '';
715 60 ▶ if ($pattern =~ /\(\?\^? ([\-A-Za-z]+) :/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pattern =~ /\(\?\^? ([\-A-Za-z]+) :/mosx) 11 49 60
716 11 $modifier = $1;
717 11 $modifier =~ s/-[A-Za-z]*//;
718 }
719  
720 # with /x modifier
721 60 my @char = ();
722 60 ▶ if ($modifier =~ /x/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /x/mosx) { } 5 55 60
723 5 @char = $pattern =~ /\G((?>
724 [^\\\#\[\(] |
725 \\ $q_char |
726 \# (?>[^\n]*) $ |
727 \[ (?>(?:[^\\\]]|\\\\|\\\]|$q_char)+) \] |
728 \(\? |
729 $q_char
730 ))/oxmsg;
731 }
732  
733 # without /x modifier
734 else {
735 55 @char = $pattern =~ /\G((?>
736 [^\\\[\(] |
737 \\ $q_char |
738 \[ (?>(?:[^\\\]]|\\\\|\\\]|$q_char)+) \] |
739 \(\? |
740 $q_char
741 ))/oxmsg;
742 }
743  
744 60 return scalar grep { $_ eq '(' } @char;
745 }
746  
747 #
748 # Latin-10 transliteration (tr///)
749 #
750 6 ▶sub Elatin10::tr($$$$;$) {
Subroutine tr: called CC=26 SCAR=48.6
Pod undocumented
751  
752 6 my $bind_operator = $_[1];
753 6 my $searchlist = $_[2];
754 6 my $replacementlist = $_[3];
755 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
756  
757 6 ▶ if ($modifier =~ /r/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /r/mosx) 5 1 6
758 5 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) 0 5 5
759 0 croak "Using !~ with tr///r doesn't make sense";
760 }
761 }
762  
763 6 my @char = $_[0] =~ /\G (?>$q_char) /oxmsg;
764 6 my @searchlist = _charlist_tr($searchlist);
765 6 my @replacementlist = _charlist_tr($replacementlist);
766  
767 6 my %tr = ();
768 6 ▶ for (my $i=0; $i <= $#searchlist; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#searchlist) 19 6 25
769 19 ▶ if (not exists $tr{$searchlist[$i]}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $tr{$searchlist[$i]}) 19 0 19
770 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
771 19 $tr{$searchlist[$i]} = $replacementlist[$i];
772 }
773 elsif ($modifier =~ /d/oxms) {
774 0 $tr{$searchlist[$i]} = '';
775 }
776 ▶ 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
777 0 $tr{$searchlist[$i]} = $replacementlist[-1];
778 }
779 else {
780 0 $tr{$searchlist[$i]} = $searchlist[$i];
781 }
782 }
783 }
784  
785 6 my $tr = 0;
786 6 my $replaced = '';
787 6 ▶ if ($modifier =~ /c/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /c/mosx) { } 0 6 6
788 0 ▶ while (defined(my $char = shift @char)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $char = shift @char)) 0 0 0
789 0 ▶ if (not exists $tr{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $tr{$char}) { } 0 0 0
790 0 ▶ if (defined $replacementlist[0]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $replacementlist[0]) 0 0 0
791 0 $replaced .= $replacementlist[0];
792 }
793 0 $tr++;
794 0 ▶ if ($modifier =~ /s/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/mosx) 0 0 0
795 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
796 0 shift @char;
797 0 $tr++;
798 }
799 }
800 }
801 else {
802 0 $replaced .= $char;
803 }
804 }
805 }
806 else {
807 6 ▶ while (defined(my $char = shift @char)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $char = shift @char)) 36 6 42
808 36 ▶ if (exists $tr{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $tr{$char}) { } 19 17 36
809 19 $replaced .= $tr{$char};
810 19 $tr++;
811 19 ▶ if ($modifier =~ /s/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/mosx) 0 19 19
812 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
813 0 shift @char;
814 0 $tr++;
815 }
816 }
817 }
818 else {
819 17 $replaced .= $char;
820 }
821 }
822 }
823  
824 6 ▶ if ($modifier =~ /r/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /r/mosx) { } 5 1 6
825 5 return $replaced;
826 }
827 else {
828 1 $_[0] = $replaced;
829 1 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) { } 0 1 1
830 0 return not $tr;
831 }
832 else {
833 1 return $tr;
834 }
835 }
836 }
837  
838 #
839 # Latin-10 chop
840 #
841 0 ▶sub Elatin10::chop(@) {
Subroutine chop: not called CC=3 SCAR=24.8
Pod undocumented
842  
843 0 my $chop;
844 0 ▶ if (@_ == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 0) { } 0 0 0
845 0 my @char = /\G (?>$q_char) /oxmsg;
846 0 $chop = pop @char;
847 0 $_ = join '', @char;
848 }
849 else {
850 0 for (@_) {
851 0 my @char = /\G (?>$q_char) /oxmsg;
852 0 $chop = pop @char;
853 0 $_ = join '', @char;
854 }
855 }
856 0 return $chop;
857 }
858  
859 #
860 # Latin-10 index by octet
861 #
862 30 ▶sub Elatin10::index($$;$) {
Subroutine index: called CC=6 SCAR=20.8
Pod documented
863  
864 30 my($str,$substr,$position) = @_;
865 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
866 30 my $pos = 0;
867  
868 30 ▶ while ($pos < CORE::length($str)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos < length $str) 130 30 160
869 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
870 0 ▶ if ($pos >= $position) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos >= $position) 0 0 0
871 0 return $pos;
872 }
873 }
874 130 ▶ if (CORE::substr($str,$pos) =~ /\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($str, $pos) =~ /\A ($Elatin10::q_char) /mosx) { } 130 0 130
875 130 $pos += CORE::length($1);
876 }
877 else {
878 0 $pos += 1;
879 }
880 }
881 30 return -1;
882 }
883  
884 #
885 # Latin-10 reverse index
886 #
887 0 ▶sub Elatin10::rindex($$;$) {
Subroutine rindex: not called CC=6 SCAR=37.4
Pod undocumented
888  
889 0 my($str,$substr,$position) = @_;
890 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
891 0 my $pos = 0;
892 0 my $rindex = -1;
893  
894 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
895 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
896 0 $rindex = $pos;
897 }
898 0 ▶ if (CORE::substr($str,$pos) =~ /\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($str, $pos) =~ /\A ($Elatin10::q_char) /mosx) { } 0 0 0
899 0 $pos += CORE::length($1);
900 }
901 else {
902 0 $pos += 1;
903 }
904 }
905 0 return $rindex;
906 }
907  
908 #
909 # Latin-10 lower case first with parameter
910 #
911 0 ▶sub Elatin10::lcfirst(@) {
Subroutine lcfirst: not called CC=4 SCAR=30.0
Pod undocumented
912 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
913 0 my $s = shift @_;
914 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
915 0 return Elatin10::lc(CORE::substr($s,0,1)) . CORE::substr($s,1), @_;
916 }
917 else {
918 0 return Elatin10::lc(CORE::substr($s,0,1)) . CORE::substr($s,1);
919 }
920 }
921 else {
922 0 return Elatin10::lc(CORE::substr($_,0,1)) . CORE::substr($_,1);
923 }
924 }
925  
926 #
927 # Latin-10 lower case first without parameter
928 #
929 0 ▶sub Elatin10::lcfirst_() {
Subroutine lcfirst_: not called CC=1 SCAR=6.9
Pod undocumented
930 0 return Elatin10::lc(CORE::substr($_,0,1)) . CORE::substr($_,1);
931 }
932  
933 #
934 # Latin-10 lower case with parameter
935 #
936 68 ▶sub Elatin10::lc(@) {
Subroutine lc: called CC=6 SCAR=24.2
Pod undocumented
937 68 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 68 0 68
938 68 my $s = shift @_;
939 68 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 68 68
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
6800
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
940 0 ▶ return join('', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 0 0 0
941 }
942 else {
943 68 ▶ return join('', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 70 0 70
944 }
945 }
946 else {
947 0 return Elatin10::lc_();
948 }
949 }
950  
951 #
952 # Latin-10 lower case without parameter
953 #
954 0 ▶sub Elatin10::lc_() {
Subroutine lc_: not called CC=2 SCAR=17.9
Pod undocumented
955 0 my $s = $_;
956 0 ▶ return join '', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 0 0 0
957 }
958  
959 #
960 # Latin-10 upper case first with parameter
961 #
962 0 ▶sub Elatin10::ucfirst(@) {
Subroutine ucfirst: not called CC=4 SCAR=30.0
Pod undocumented
963 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
964 0 my $s = shift @_;
965 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
966 0 return Elatin10::uc(CORE::substr($s,0,1)) . CORE::substr($s,1), @_;
967 }
968 else {
969 0 return Elatin10::uc(CORE::substr($s,0,1)) . CORE::substr($s,1);
970 }
971 }
972 else {
973 0 return Elatin10::uc(CORE::substr($_,0,1)) . CORE::substr($_,1);
974 }
975 }
976  
977 #
978 # Latin-10 upper case first without parameter
979 #
980 0 ▶sub Elatin10::ucfirst_() {
Subroutine ucfirst_: not called CC=1 SCAR=6.9
Pod undocumented
981 0 return Elatin10::uc(CORE::substr($_,0,1)) . CORE::substr($_,1);
982 }
983  
984 #
985 # Latin-10 upper case with parameter
986 #
987 2572 ▶sub Elatin10::uc(@) {
Subroutine uc: called CC=6 SCAR=22.9
Pod undocumented
988 2572 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2572 0 2572
989 2572 my $s = shift @_;
990 2572 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 2572 2572
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
257200
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
991 0 ▶ return join('', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 0 0 0
992 }
993 else {
994 2572 ▶ return join('', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 919 1655 2574
995 }
996 }
997 else {
998 0 return Elatin10::uc_();
999 }
1000 }
1001  
1002 #
1003 # Latin-10 upper case without parameter
1004 #
1005 0 ▶sub Elatin10::uc_() {
Subroutine uc_: not called CC=2 SCAR=17.9
Pod undocumented
1006 0 my $s = $_;
1007 0 ▶ return join '', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 0 0 0
1008 }
1009  
1010 #
1011 # Latin-10 fold case with parameter
1012 #
1013 2575 ▶sub Elatin10::fc(@) {
Subroutine fc: called CC=6 SCAR=22.9
Pod undocumented
1014 2575 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2575 0 2575
1015 2575 my $s = shift @_;
1016 2575 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 2575 2575
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
257500
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
1017 0 ▶ return join('', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 0 0 0
1018 }
1019 else {
1020 2575 ▶ return join('', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 2001 6275 8276
1021 }
1022 }
1023 else {
1024 0 return Elatin10::fc_();
1025 }
1026 }
1027  
1028 #
1029 # Latin-10 fold case without parameter
1030 #
1031 0 ▶sub Elatin10::fc_() {
Subroutine fc_: not called CC=2 SCAR=17.9
Pod undocumented
1032 0 my $s = $_;
1033 0 ▶ return join '', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 0 0 0
1034 }
1035  
1036 #
1037 # Latin-10 regexp capture
1038 #
1039 {
1040 0 ▶ sub Elatin10::capture {
Subroutine capture: not called CC=1 SCAR=6.9
Pod documented
1041 0 return $_[0];
1042 }
1043 }
1044  
1045 #
1046 # Latin-10 regexp ignore case modifier
1047 #
1048 422 ▶sub Elatin10::ignorecase {
Subroutine ignorecase: called CC=25 SCAR=52.1
Pod undocumented
1049  
1050 11 my @string = @_;
1051 11 my $metachar = qr/[\@\\|[\]{]/oxms;
1052  
1053 # ignore case of $scalar or @array
1054 11 for my $string (@string) {
1055  
1056 # split regexp
1057 11 my @char = $string =~ /\G (?>\[\^|\\$q_char|$q_char) /oxmsg;
1058  
1059 # unescape character
1060 11 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1100 11 1111
1061 1100 ▶ next if not defined $char[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $char[$i] 0 1100 1100
1062  
1063 # open character class [...]
1064 1100 ▶ if ($char[$i] eq '[') {
Branch: 4 branches
BranchTrueFalseTotal
if ($char[$i] eq '[') { } 0 1100 1100
elsif ($char[$i] eq '[^') { } 0 1100 1100
elsif (my $char = classic_character_class($char[$i])) { } 0 1100 1100
elsif ($char[$i] =~ /\A [\x00-\xFF] \z/mosx) { } 1100 0 1100
1065 0 my $left = $i;
1066  
1067 # [] make die "unmatched [] in regexp ...\n"
1068  
1069 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
1070 0 $i++;
1071 }
1072  
1073 0 while (1) {
1074 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
1075 0 croak "Unmatched [] in regexp";
1076 }
1077 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
1078 0 my $right = $i;
1079 0 my @charlist = charlist_qr(@char[$left+1..$right-1], 'i');
1080  
1081 # escape character
1082 0 for my $char (@charlist) {
1083 0 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $char =~ /\A [.|)] \z/mosx }) 0 0 0
1084 }
1085  
1086 0 elsif ($char =~ /\A [.|)] \z/oxms) {
1087 0 $char = '\\' . $char;
1088 }
1089 }
1090  
1091 # [...]
1092 0 splice @char, $left, $right-$left+1, '(?:' . join('|', @charlist) . ')';
1093  
1094 0 $i = $left;
1095 0 last;
1096 }
1097 }
1098 }
1099  
1100 # open character class [^...]
1101 elsif ($char[$i] eq '[^') {
1102 0 my $left = $i;
1103  
1104 # [^] make die "unmatched [] in regexp ...\n"
1105  
1106 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
1107 0 $i++;
1108 }
1109  
1110 0 while (1) {
1111 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
1112 0 croak "Unmatched [] in regexp";
1113 }
1114 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
1115 0 my $right = $i;
1116 0 my @charlist = charlist_not_qr(@char[$left+1..$right-1], 'i');
1117  
1118 # escape character
1119 0 for my $char (@charlist) {
1120 0 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $char =~ /\A [.|)] \z/mosx }) 0 0 0
1121 }
1122  
1123 0 elsif ($char =~ /\A [.|)] \z/oxms) {
1124 0 $char = '\\' . $char;
1125 }
1126 }
1127  
1128 # [^...]
1129 0 splice @char, $left, $right-$left+1, '(?!' . join('|', @charlist) . ")(?:$your_char)";
1130  
1131 0 $i = $left;
1132 0 last;
1133 }
1134 }
1135 }
1136  
1137 # rewrite classic character class or escape character
1138 elsif (my $char = classic_character_class($char[$i])) {
1139 0 $char[$i] = $char;
1140 }
1141  
1142 # with /i modifier
1143 elsif ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) {
1144 1100 my $uc = Elatin10::uc($char[$i]);
1145 1100 my $fc = Elatin10::fc($char[$i]);
1146 1100 ▶ if ($uc ne $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc ne $fc) 564 536 1100
1147 564 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 561 3 564
1148 561 $char[$i] = '[' . $uc . $fc . ']';
1149 }
1150 else {
1151 3 $char[$i] = '(?:' . $uc . '|' . $fc . ')';
1152 }
1153 }
1154 }
1155 }
1156  
1157 # characterize
1158 11 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1100 11 1111
1159 1100 ▶ next if not defined $char[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $char[$i] 0 1100 1100
1160  
1161 1100 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx }) 0 1111 1111
1162 }
1163  
1164 # quote character before ? + * {
1165 0 ▶ elsif (($i >= 1) and ($char[$i] =~ /\A [\?\+\*\{] \z/oxms)) {
Condition66%2/3
$i >= 1 && $char[$i] =~ /\A [\?\+\*\{] \z/mosx
!ll&&!rl&&r
1110890
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
1166 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
1167 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
1168 }
1169 }
1170 }
1171  
1172 11 $string = join '', @char;
1173 }
1174  
1175 # make regexp string
1176 11 return @string;
1177 }
1178  
1179 #
1180 # classic character class ( \D \S \W \d \s \w \C \X \H \V \h \v \R \N \b \B )
1181 #
1182 2968 ▶sub Elatin10::classic_character_class {
Subroutine classic_character_class: called CC=2 SCAR=6.9
Pod undocumented
1183 2968 my($char) = @_;
1184  
1185 return {
1186 '\D' => '${Elatin10::eD}',
1187 '\S' => '${Elatin10::eS}',
1188 '\W' => '${Elatin10::eW}',
1189 '\d' => '[0-9]',
1190  
1191 # Before Perl 5.6, \s only matched the five whitespace characters
1192 # tab, newline, form-feed, carriage return, and the space character
1193 # itself, which, taken together, is the character class [\t\n\f\r ].
1194  
1195 # Vertical tabs are now whitespace
1196 # \s in a regex now matches a vertical tab in all circumstances.
1197 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
1198 # \t \n \v \f \r space
1199 # '\s' => '[\x09\x0A \x0C\x0D\x20]',
1200 # '\s' => '[\x09\x0A\x0B\x0C\x0D\x20]',
1201 '\s' => '\s',
1202  
1203 '\w' => '[0-9A-Z_a-z]',
1204 '\C' => '[\x00-\xFF]',
1205 '\X' => 'X',
1206  
1207 # \h \v \H \V
1208  
1209 # P.114 Character Class Shortcuts
1210 # in Chapter 7: In the World of Regular Expressions
1211 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
1212  
1213 # P.357 13.2.3 Whitespace
1214 # in Chapter 13: perlrecharclass: Perl Regular Expression Character Classes
1215 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
1216 #
1217 # 0x00009 CHARACTER TABULATION h s
1218 # 0x0000a LINE FEED (LF) vs
1219 # 0x0000b LINE TABULATION v
1220 # 0x0000c FORM FEED (FF) vs
1221 # 0x0000d CARRIAGE RETURN (CR) vs
1222 # 0x00020 SPACE h s
1223  
1224 # P.196 Table 5-9. Alphanumeric regex metasymbols
1225 # in Chapter 5. Pattern Matching
1226 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1227  
1228 # (and so on)
1229  
1230 '\H' => '${Elatin10::eH}',
1231 '\V' => '${Elatin10::eV}',
1232 '\h' => '[\x09\x20]',
1233 '\v' => '[\x0A\x0B\x0C\x0D]',
1234 '\R' => '${Elatin10::eR}',
1235  
1236 # \N
1237 #
1238 # http://perldoc.perl.org/perlre.html
1239 # Character Classes and other Special Escapes
1240 # Any character but \n (experimental). Not affected by /s modifier
1241  
1242 '\N' => '${Elatin10::eN}',
1243  
1244 # \b \B
1245  
1246 # P.180 Boundaries: The \b and \B Assertions
1247 # in Chapter 5: Pattern Matching
1248 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
1249  
1250 # P.219 Boundaries: The \b and \B Assertions
1251 # in Chapter 5: Pattern Matching
1252 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1253  
1254 # \b really means (?:(?<=\w)(?!\w)|(?<!\w)(?=\w))
1255 # or (?:(?<=\A|\W)(?=\w)|(?<=\w)(?=\W|\z))
1256 '\b' => '${Elatin10::eb}',
1257  
1258 # \B really means (?:(?<=\w)(?=\w)|(?<!\w)(?!\w))
1259 # or (?:(?<=\w)(?=\w)|(?<=\W)(?=\W))
1260 '\B' => '${Elatin10::eB}',
1261  
1262 2968 ▶ }->{$char} || '';
Condition100%2/2
{'\\D', '${Elatin10::eD}', '\\S', '${Elatin10::eS}', '\\W', '${Elatin10::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin10::eH}', '\\V', '${Elatin10::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin10::eR}', '\\N', '${Elatin10::eN}', '\\b', '${Elatin10::eb}', '\\B', '${Elatin10::eB}'}->{$char} || ''
l!l
1012867
MC/DC100%1/1
{'\\D', '${Elatin10::eD}', '\\S', '${Elatin10::eS}', '\\W', '${Elatin10::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin10::eH}', '\\V', '${Elatin10::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin10::eR}', '\\N', '${Elatin10::eN}', '\\b', '${Elatin10::eb}', '\\B', '${Elatin10::eB}'}->{$char} || ''
{'\\D', '${Elatin10::eD}', '\\S', '${Elatin10::eS}', '\\W', '${Elatin10::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin10::eH}', '\\V', '${Elatin10::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin10::eR}', '\\N', '${Elatin10::eN}', '\\b', '${Elatin10::eb}', '\\B', '${Elatin10::eB}'}->{$char}
Truth table100%2/2
A
A= {'\\D', '${Elatin10::eD}', '\\S', '${Elatin10::eS}', '\\W', '${Elatin10::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin10::eH}', '\\V', '${Elatin10::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin10::eR}', '\\N', '${Elatin10::eN}', '\\b', '${Elatin10::eb}', '\\B', '${Elatin10::eB}'}->{$char}
Aresult
11
00
1263 }
1264  
1265 #
1266 # prepare Latin-10 characters per length
1267 #
1268  
1269 # 1 octet characters
1270 422 my @chars1 = ();
1271 0 ▶sub chars1 {
Subroutine chars1: not called CC=5 SCAR=34.0
Pod undocumented
1272 0 ▶ if (@chars1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars1) 0 0 0
1273 0 return @chars1;
1274 }
1275 0 ▶ if (exists $range_tr{1}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{1}) 0 0 0
1276 0 my @ranges = @{ $range_tr{1} };
1277 0 ▶ while (my @range = splice(@ranges,0,1)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 1)) 0 0 0
1278 0 for my $oct0 (@{$range[0]}) {
1279 0 push @chars1, pack 'C', $oct0;
1280 }
1281 }
1282 }
1283 0 return @chars1;
1284 }
1285  
1286 # 2 octets characters
1287 422 my @chars2 = ();
1288 0 ▶sub chars2 {
Subroutine chars2: not called CC=6 SCAR=37.4
Pod undocumented
1289 0 ▶ if (@chars2) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars2) 0 0 0
1290 0 return @chars2;
1291 }
1292 0 ▶ if (exists $range_tr{2}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{2}) 0 0 0
1293 0 my @ranges = @{ $range_tr{2} };
1294 0 ▶ while (my @range = splice(@ranges,0,2)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 2)) 0 0 0
1295 0 for my $oct0 (@{$range[0]}) {
1296 0 for my $oct1 (@{$range[1]}) {
1297 0 push @chars2, pack 'CC', $oct0,$oct1;
1298 }
1299 }
1300 }
1301 }
1302 0 return @chars2;
1303 }
1304  
1305 # 3 octets characters
1306 422 my @chars3 = ();
1307 0 ▶sub chars3 {
Subroutine chars3: not called CC=7 SCAR=40.3
Pod undocumented
1308 0 ▶ if (@chars3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars3) 0 0 0
1309 0 return @chars3;
1310 }
1311 0 ▶ if (exists $range_tr{3}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{3}) 0 0 0
1312 0 my @ranges = @{ $range_tr{3} };
1313 0 ▶ while (my @range = splice(@ranges,0,3)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 3)) 0 0 0
1314 0 for my $oct0 (@{$range[0]}) {
1315 0 for my $oct1 (@{$range[1]}) {
1316 0 for my $oct2 (@{$range[2]}) {
1317 0 push @chars3, pack 'CCC', $oct0,$oct1,$oct2;
1318 }
1319 }
1320 }
1321 }
1322 }
1323 0 return @chars3;
1324 }
1325  
1326 # 4 octets characters
1327 422 my @chars4 = ();
1328 0 ▶sub chars4 {
Subroutine chars4: not called CC=8 SCAR=42.8
Pod undocumented
1329 0 ▶ if (@chars4) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars4) 0 0 0
1330 0 return @chars4;
1331 }
1332 0 ▶ if (exists $range_tr{4}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{4}) 0 0 0
1333 0 my @ranges = @{ $range_tr{4} };
1334 0 ▶ while (my @range = splice(@ranges,0,4)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 4)) 0 0 0
1335 0 for my $oct0 (@{$range[0]}) {
1336 0 for my $oct1 (@{$range[1]}) {
1337 0 for my $oct2 (@{$range[2]}) {
1338 0 for my $oct3 (@{$range[3]}) {
1339 0 push @chars4, pack 'CCCC', $oct0,$oct1,$oct2,$oct3;
1340 }
1341 }
1342 }
1343 }
1344 }
1345 }
1346 0 return @chars4;
1347 }
1348  
1349 #
1350 # Latin-10 open character list for tr
1351 #
1352 12 ▶sub _charlist_tr {
Subroutine _charlist_tr: called CC=35 SCAR=66.4
1353  
1354 12 local $_ = shift @_;
1355  
1356 # unescape character
1357 12 my @char = ();
1358 12 ▶ while (not /\G \z/oxmsgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgmosx) 38 12 50
1359 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 \\ ($Elatin10::q_char) /cgmosx) { } 0 38 38
elsif (/\G ($Elatin10::q_char) /cgmosx) { } 38 0 38
1360 0 push @char, '\-';
1361 }
1362 elsif (/\G \\ ([0-7]{2,3}) /oxmsgc) {
1363 0 push @char, CORE::chr(oct $1);
1364 }
1365 elsif (/\G \\x ([0-9A-Fa-f]{1,2}) /oxmsgc) {
1366 0 push @char, CORE::chr(hex $1);
1367 }
1368 elsif (/\G \\c ([\x40-\x5F]) /oxmsgc) {
1369 0 push @char, CORE::chr(CORE::ord($1) & 0x1F);
1370 }
1371 elsif (/\G (\\ [0nrtfbae]) /oxmsgc) {
1372 push @char, {
1373 '\0' => "\0",
1374 '\n' => "\n",
1375 '\r' => "\r",
1376 '\t' => "\t",
1377 '\f' => "\f",
1378 '\b' => "\x08", # \b means backspace in character class
1379 '\a' => "\a",
1380 '\e' => "\e",
1381 0 }->{$1};
1382 }
1383 elsif (/\G \\ ($q_char) /oxmsgc) {
1384 0 push @char, $1;
1385 }
1386 elsif (/\G ($q_char) /oxmsgc) {
1387 38 push @char, $1;
1388 }
1389 }
1390  
1391 # join separated multiple-octet
1392 12 @char = join('',@char) =~ /\G (?>\\-|$q_char) /oxmsg;
1393  
1394 # unescape '-'
1395 12 my @i = ();
1396 12 for my $i (0 .. $#char) {
1397 38 ▶ if ($char[$i] eq '\-') {
Branch: 2 branches
BranchTrueFalseTotal
if ($char[$i] eq '\\-') { } 0 38 38
elsif ($char[$i] eq '-') { } 0 38 38
1398 0 $char[$i] = '-';
1399 }
1400 elsif ($char[$i] eq '-') {
1401 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
1402 0 push @i, $i;
1403 }
1404 }
1405 }
1406  
1407 # open character list (reverse for splice)
1408 12 for my $i (CORE::reverse @i) {
1409 0 my @range = ();
1410  
1411 # range error
1412 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
1413 0 croak "Invalid tr/// range \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1414 }
1415  
1416 # range of multiple-octet code
1417 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
1418 0 ▶ if (CORE::length($char[$i+1]) == 1) {
Branch: 4 branches
BranchTrueFalseTotal
if (length $char[$i + 1] == 1) { } 0 0 0
elsif (length $char[$i + 1] == 2) { } 0 0 0
elsif (length $char[$i + 1] == 3) { } 0 0 0
elsif (length $char[$i + 1] == 4) { } 0 0 0
1419 0 ▶ 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
1420 }
1421 elsif (CORE::length($char[$i+1]) == 2) {
1422 0 push @range, grep {$char[$i-1] le $_} chars1();
1423 0 push @range, grep {$_ le $char[$i+1]} chars2();
1424 }
1425 elsif (CORE::length($char[$i+1]) == 3) {
1426 0 push @range, grep {$char[$i-1] le $_} chars1();
1427 0 push @range, chars2();
1428 0 push @range, grep {$_ le $char[$i+1]} chars3();
1429 }
1430 elsif (CORE::length($char[$i+1]) == 4) {
1431 0 push @range, grep {$char[$i-1] le $_} chars1();
1432 0 push @range, chars2();
1433 0 push @range, chars3();
1434 0 push @range, grep {$_ le $char[$i+1]} chars4();
1435 }
1436 else {
1437 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1438 }
1439 }
1440 elsif (CORE::length($char[$i-1]) == 2) {
1441 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
1442 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
1443 }
1444 elsif (CORE::length($char[$i+1]) == 3) {
1445 0 push @range, grep {$char[$i-1] le $_} chars2();
1446 0 push @range, grep {$_ le $char[$i+1]} chars3();
1447 }
1448 elsif (CORE::length($char[$i+1]) == 4) {
1449 0 push @range, grep {$char[$i-1] le $_} chars2();
1450 0 push @range, chars3();
1451 0 push @range, grep {$_ le $char[$i+1]} chars4();
1452 }
1453 else {
1454 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1455 }
1456 }
1457 elsif (CORE::length($char[$i-1]) == 3) {
1458 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
1459 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
1460 }
1461 elsif (CORE::length($char[$i+1]) == 4) {
1462 0 push @range, grep {$char[$i-1] le $_} chars3();
1463 0 push @range, grep {$_ le $char[$i+1]} chars4();
1464 }
1465 else {
1466 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1467 }
1468 }
1469 elsif (CORE::length($char[$i-1]) == 4) {
1470 0 ▶ if (CORE::length($char[$i+1]) == 4) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $char[$i + 1] == 4) { } 0 0 0
1471 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
1472 }
1473 else {
1474 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1475 }
1476 }
1477 else {
1478 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1479 }
1480  
1481 0 splice @char, $i-1, 3, @range;
1482 }
1483  
1484 12 return @char;
1485 }
1486  
1487 #
1488 # Latin-10 open character class
1489 #
1490 0 ▶sub _cc {
Subroutine _cc: not called CC=7 SCAR=40.3
1491 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
1492 0 die __FILE__, ": subroutine cc got no parameter.\n";
1493 }
1494 elsif (scalar(@_) == 1) {
1495 0 return sprintf('\x%02X',$_[0]);
1496 }
1497 elsif (scalar(@_) == 2) {
1498 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
1499 0 die __FILE__, ": subroutine cc got \$_[0] > \$_[1] parameters).\n";
1500 }
1501 elsif ($_[0] == $_[1]) {
1502 0 return sprintf('\x%02X',$_[0]);
1503 }
1504 elsif (($_[0]+1) == $_[1]) {
1505 0 return sprintf('[\\x%02X\\x%02X]',$_[0],$_[1]);
1506 }
1507 else {
1508 0 return sprintf('[\\x%02X-\\x%02X]',$_[0],$_[1]);
1509 }
1510 }
1511 else {
1512 0 die __FILE__, ": subroutine cc got 3 or more parameters (@{[scalar(@_)]} parameters).\n";
1513 }
1514 }
1515  
1516 #
1517 # Latin-10 octet range
1518 #
1519 246 ▶sub _octets {
Subroutine _octets: called CC=5 SCAR=19.3
1520 246 my $length = shift @_;
1521  
1522 246 ▶ if ($length == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length == 1) { } 246 0 246
1523 246 my($a1) = unpack 'C', $_[0];
1524 246 my($z1) = unpack 'C', $_[1];
1525  
1526 246 ▶ if ($a1 > $z1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($a1 > $z1) 0 246 246
1527 0 croak 'Invalid [] range in regexp (CORE::ord(A) > CORE::ord(B)) ' . '\x' . unpack('H*',$a1) . '-\x' . unpack('H*',$z1);
1528 }
1529  
1530 246 ▶ if ($a1 == $z1) {
Branch: 2 branches
BranchTrueFalseTotal
if ($a1 == $z1) { } 0 246 246
elsif ($a1 + 1 == $z1) { } 0 246 246
1531 0 return sprintf('\x%02X',$a1);
1532 }
1533 elsif (($a1+1) == $z1) {
1534 0 return sprintf('\x%02X\x%02X',$a1,$z1);
1535 }
1536 else {
1537 246 return sprintf('\x%02X-\x%02X',$a1,$z1);
1538 }
1539 }
1540 else {
1541 0 die __FILE__, ": subroutine _octets got invalid length ($length).\n";
1542 }
1543 }
1544  
1545 #
1546 # Latin-10 range regexp
1547 #
1548 246 ▶sub _range_regexp {
Subroutine _range_regexp: called CC=18 SCAR=41.7
1549 246 my($length,$first,$last) = @_;
1550  
1551 246 my @range_regexp = ();
1552 246 ▶ if (not exists $range_tr{$length}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $range_tr{$length}) 0 246 246
1553 0 return @range_regexp;
1554 }
1555  
1556 246 my @ranges = @{ $range_tr{$length} };
1557 246 ▶ while (my @range = splice(@ranges,0,$length)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, $length)) 246 246 492
1558 246 my $min = '';
1559 246 my $max = '';
1560 246 ▶ for (my $i=0; $i < $length; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $length) 246 246 492
1561 246 $min .= pack 'C', $range[$i][0];
1562 246 $max .= pack 'C', $range[$i][-1];
1563 }
1564  
1565 # min___max
1566 # FIRST_____________LAST
1567 # (nothing)
1568  
1569 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
1570 }
1571  
1572 # **********
1573 # min_________max
1574 # FIRST_____________LAST
1575 # **********
1576  
1577 ▶ 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
1578 0 push @range_regexp, _octets($length,$first,$max,$min,$max);
1579 }
1580  
1581 # **********************
1582 # min________________max
1583 # FIRST_____________LAST
1584 # **********************
1585  
1586 ▶ 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
1587 0 push @range_regexp, _octets($length,$first,$last,$min,$max);
1588 }
1589  
1590 # *********
1591 # min___max
1592 # FIRST_____________LAST
1593 # *********
1594  
1595 ▶ 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
1596 0 push @range_regexp, _octets($length,$min,$max,$min,$max);
1597 }
1598  
1599 # **********************
1600 # min__________________________max
1601 # FIRST_____________LAST
1602 # **********************
1603  
1604 ▶ 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
1605 246 push @range_regexp, _octets($length,$first,$last,$min,$max);
1606 }
1607  
1608 # *********
1609 # min________max
1610 # FIRST_____________LAST
1611 # *********
1612  
1613 ▶ 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
1614 0 push @range_regexp, _octets($length,$min,$last,$min,$max);
1615 }
1616  
1617 # min___max
1618 # FIRST_____________LAST
1619 # (nothing)
1620  
1621 elsif ($last lt $min) {
1622 }
1623  
1624 else {
1625 0 die __FILE__, ": subroutine _range_regexp panic.\n";
1626 }
1627 }
1628  
1629 246 return @range_regexp;
1630 }
1631  
1632 #
1633 # Latin-10 open character list for qr and not qr
1634 #
1635 650 ▶sub _charlist {
Subroutine _charlist: called CC=46 SCAR=45.9
1636  
1637 650 my $modifier = pop @_;
1638 650 my @char = @_;
1639  
1640 650 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 298 352 650
1641  
1642 # unescape character
1643 650 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1773 650 2423
1644  
1645 # escape - to ...
1646 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 \\ ($Elatin10::q_char) \z/mosx) { } 7 1371 1378
1647 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
1648 246 $char[$i] = '...';
1649 }
1650 }
1651  
1652 # octal escape sequence
1653 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
1654 0 $char[$i] = octchr($1);
1655 }
1656  
1657 # hexadecimal escape sequence
1658 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
1659 0 $char[$i] = hexchr($1);
1660 }
1661  
1662 # \b{...} --> b\{...}
1663 # \B{...} --> B\{...}
1664 # \N{CHARNAME} --> N\{CHARNAME}
1665 # \p{PROPERTY} --> p\{PROPERTY}
1666 # \P{PROPERTY} --> P\{PROPERTY}
1667 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
1668 0 $char[$i] = $1 . '\\' . $2;
1669 }
1670  
1671 # \p, \P, \X --> p, P, X
1672 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
1673 0 $char[$i] = $1;
1674 }
1675  
1676 elsif ($char[$i] =~ /\A \\ ([0-7]{2,3}) \z/oxms) {
1677 0 $char[$i] = CORE::chr oct $1;
1678 }
1679 elsif ($char[$i] =~ /\A \\x ([0-9A-Fa-f]{1,2}) \z/oxms) {
1680 22 $char[$i] = CORE::chr hex $1;
1681 }
1682 elsif ($char[$i] =~ /\A \\c ([\x40-\x5F]) \z/oxms) {
1683 0 $char[$i] = CORE::chr(CORE::ord($1) & 0x1F);
1684 }
1685 elsif ($char[$i] =~ /\A (\\ [0nrtfbaedswDSWHVhvR]) \z/oxms) {
1686 $char[$i] = {
1687 '\0' => "\0",
1688 '\n' => "\n",
1689 '\r' => "\r",
1690 '\t' => "\t",
1691 '\f' => "\f",
1692 '\b' => "\x08", # \b means backspace in character class
1693 '\a' => "\a",
1694 '\e' => "\e",
1695 '\d' => '[0-9]',
1696  
1697 # Vertical tabs are now whitespace
1698 # \s in a regex now matches a vertical tab in all circumstances.
1699 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
1700 # \t \n \v \f \r space
1701 # '\s' => '[\x09\x0A \x0C\x0D\x20]',
1702 # '\s' => '[\x09\x0A\x0B\x0C\x0D\x20]',
1703 '\s' => '\s',
1704  
1705 '\w' => '[0-9A-Z_a-z]',
1706 '\D' => '${Elatin10::eD}',
1707 '\S' => '${Elatin10::eS}',
1708 '\W' => '${Elatin10::eW}',
1709  
1710 '\H' => '${Elatin10::eH}',
1711 '\V' => '${Elatin10::eV}',
1712 '\h' => '[\x09\x20]',
1713 '\v' => '[\x0A\x0B\x0C\x0D]',
1714 '\R' => '${Elatin10::eR}',
1715  
1716 25 }->{$1};
1717 }
1718  
1719 # POSIX-style character classes
1720 ▶ 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
1721 $char[$i] = {
1722  
1723 '[:lower:]' => '[\x41-\x5A\x61-\x7A]',
1724 '[:upper:]' => '[\x41-\x5A\x61-\x7A]',
1725 '[:^lower:]' => '${Elatin10::not_lower_i}',
1726 '[:^upper:]' => '${Elatin10::not_upper_i}',
1727  
1728 8 }->{$1};
1729 }
1730 elsif ($char[$i] =~ /\A ( \[\: \^? (?:alnum|alpha|ascii|blank|cntrl|digit|graph|lower|print|punct|space|upper|word|xdigit) :\] ) \z/oxms) {
1731 $char[$i] = {
1732  
1733 '[:alnum:]' => '[\x30-\x39\x41-\x5A\x61-\x7A]',
1734 '[:alpha:]' => '[\x41-\x5A\x61-\x7A]',
1735 '[:ascii:]' => '[\x00-\x7F]',
1736 '[:blank:]' => '[\x09\x20]',
1737 '[:cntrl:]' => '[\x00-\x1F\x7F]',
1738 '[:digit:]' => '[\x30-\x39]',
1739 '[:graph:]' => '[\x21-\x7F]',
1740 '[:lower:]' => '[\x61-\x7A]',
1741 '[:print:]' => '[\x20-\x7F]',
1742 '[:punct:]' => '[\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E]',
1743  
1744 # P.174 POSIX-Style Character Classes
1745 # in Chapter 5: Pattern Matching
1746 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
1747  
1748 # P.311 11.2.4 Character Classes and other Special Escapes
1749 # in Chapter 11: perlre: Perl regular expressions
1750 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
1751  
1752 # P.210 POSIX-Style Character Classes
1753 # in Chapter 5: Pattern Matching
1754 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1755  
1756 '[:space:]' => '[\s\x0B]', # "\s" plus vertical tab ("\cK")
1757  
1758 '[:upper:]' => '[\x41-\x5A]',
1759 '[:word:]' => '[\x30-\x39\x41-\x5A\x5F\x61-\x7A]',
1760 '[:xdigit:]' => '[\x30-\x39\x41-\x46\x61-\x66]',
1761 '[:^alnum:]' => '${Elatin10::not_alnum}',
1762 '[:^alpha:]' => '${Elatin10::not_alpha}',
1763 '[:^ascii:]' => '${Elatin10::not_ascii}',
1764 '[:^blank:]' => '${Elatin10::not_blank}',
1765 '[:^cntrl:]' => '${Elatin10::not_cntrl}',
1766 '[:^digit:]' => '${Elatin10::not_digit}',
1767 '[:^graph:]' => '${Elatin10::not_graph}',
1768 '[:^lower:]' => '${Elatin10::not_lower}',
1769 '[:^print:]' => '${Elatin10::not_print}',
1770 '[:^punct:]' => '${Elatin10::not_punct}',
1771 '[:^space:]' => '${Elatin10::not_space}',
1772 '[:^upper:]' => '${Elatin10::not_upper}',
1773 '[:^word:]' => '${Elatin10::not_word}',
1774 '[:^xdigit:]' => '${Elatin10::not_xdigit}',
1775  
1776 70 }->{$1};
1777 }
1778 elsif ($char[$i] =~ /\A \\ ($q_char) \z/oxms) {
1779 7 $char[$i] = $1;
1780 }
1781 }
1782  
1783 # open character list
1784 650 my @singleoctet = ();
1785 650 my @multipleoctet = ();
1786 650 ▶ for (my $i=0; $i <= $#char; ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1527 650 2177
1787  
1788 # escaped -
1789 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
1790 246 $i += 1;
1791 246 next;
1792 }
1793  
1794 # make range regexp
1795 elsif ($char[$i] eq '...') {
1796  
1797 # range error
1798 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
1799 0 croak 'Invalid [] range in regexp (length(A) > length(B)) ' . '\x' . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]);
1800 }
1801 elsif (CORE::length($char[$i-1]) == CORE::length($char[$i+1])) {
1802 246 ▶ if ($char[$i-1] gt $char[$i+1]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i - 1] gt $char[$i + 1]) 0 246 246
1803 0 croak 'Invalid [] range in regexp (CORE::ord(A) > CORE::ord(B)) ' . '\x' . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]);
1804 }
1805 }
1806  
1807 # make range regexp per length
1808 246 for my $length (CORE::length($char[$i-1]) .. CORE::length($char[$i+1])) {
1809 246 my @regexp = ();
1810  
1811 # is first and last
1812 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
1813 246 push @regexp, _range_regexp($length, $char[$i-1], $char[$i+1]);
1814 }
1815  
1816 # is first
1817 elsif ($length == CORE::length($char[$i-1])) {
1818 0 push @regexp, _range_regexp($length, $char[$i-1], "\xFF" x $length);
1819 }
1820  
1821 # is inside in first and last
1822 ▶ 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
1823 0 push @regexp, _range_regexp($length, "\x00" x $length, "\xFF" x $length);
1824 }
1825  
1826 # is last
1827 elsif ($length == CORE::length($char[$i+1])) {
1828 0 push @regexp, _range_regexp($length, "\x00" x $length, $char[$i+1]);
1829 }
1830  
1831 else {
1832 0 die __FILE__, ": subroutine make_regexp panic.\n";
1833 }
1834  
1835 246 ▶ if ($length == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length == 1) { } 246 0 246
1836 246 push @singleoctet, @regexp;
1837 }
1838 else {
1839 0 push @multipleoctet, @regexp;
1840 }
1841 }
1842  
1843 246 $i += 2;
1844 }
1845  
1846 # with /i modifier
1847 elsif ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) {
1848 949 ▶ if ($modifier =~ /i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) { } 480 469 949
1849 480 my $uc = Elatin10::uc($char[$i]);
1850 480 my $fc = Elatin10::fc($char[$i]);
1851 480 ▶ if ($uc ne $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc ne $fc) { } 240 240 480
1852 240 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 240 0 240
1853 240 push @singleoctet, $uc, $fc;
1854 }
1855 else {
1856 0 push @singleoctet, $uc;
1857 0 push @multipleoctet, $fc;
1858 }
1859 }
1860 else {
1861 240 push @singleoctet, $char[$i];
1862 }
1863 }
1864 else {
1865 469 push @singleoctet, $char[$i];
1866 }
1867 949 $i += 1;
1868 }
1869  
1870 # single character of single octet code
1871 elsif ($char[$i] =~ /\A (?: \\h ) \z/oxms) {
1872 0 push @singleoctet, "\t", "\x20";
1873 0 $i += 1;
1874 }
1875 elsif ($char[$i] =~ /\A (?: \\v ) \z/oxms) {
1876 0 push @singleoctet, "\x0A", "\x0B", "\x0C", "\x0D";
1877 0 $i += 1;
1878 }
1879 elsif ($char[$i] =~ /\A (?: \\d | \\s | \\w ) \z/oxms) {
1880 2 push @singleoctet, $char[$i];
1881 2 $i += 1;
1882 }
1883  
1884 # single character of multiple-octet code
1885 else {
1886 84 push @multipleoctet, $char[$i];
1887 84 $i += 1;
1888 }
1889 }
1890  
1891 # quote metachar
1892 650 for (@singleoctet) {
1893 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
1894 0 $_ = '-';
1895 }
1896 elsif (/\A \n \z/oxms) {
1897 8 $_ = '\n';
1898 }
1899 elsif (/\A \r \z/oxms) {
1900 8 $_ = '\r';
1901 }
1902 elsif (/\A ([\x00-\x20\x7F-\xFF]) \z/oxms) {
1903 744 $_ = sprintf('\x%02X', CORE::ord $1);
1904 }
1905 elsif (/\A [\x00-\xFF] \z/oxms) {
1906 429 $_ = quotemeta $_;
1907 }
1908 }
1909  
1910 # return character list
1911 650 return \@singleoctet, \@multipleoctet;
1912 }
1913  
1914 #
1915 # Latin-10 octal escape sequence
1916 #
1917 5 ▶sub octchr {
Subroutine octchr: called CC=2 SCAR=6.9
Pod undocumented
1918 5 my($octdigit) = @_;
1919  
1920 5 my @binary = ();
1921 5 for my $octal (split(//,$octdigit)) {
1922 push @binary, {
1923 '0' => '000',
1924 '1' => '001',
1925 '2' => '010',
1926 '3' => '011',
1927 '4' => '100',
1928 '5' => '101',
1929 '6' => '110',
1930 '7' => '111',
1931 50 }->{$octal};
1932 }
1933 5 my $binary = join '', @binary;
1934  
1935 my $octchr = {
1936 # 1234567
1937 1 => pack('B*', "0000000$binary"),
1938 2 => pack('B*', "000000$binary"),
1939 3 => pack('B*', "00000$binary"),
1940 4 => pack('B*', "0000$binary"),
1941 5 => pack('B*', "000$binary"),
1942 6 => pack('B*', "00$binary"),
1943 7 => pack('B*', "0$binary"),
1944 0 => pack('B*', "$binary"),
1945  
1946 5 }->{CORE::length($binary) % 8};
1947  
1948 5 return $octchr;
1949 }
1950  
1951 #
1952 # Latin-10 hexadecimal escape sequence
1953 #
1954 5 ▶sub hexchr {
Subroutine hexchr: called CC=1 SCAR=0.0
Pod undocumented
1955 5 my($hexdigit) = @_;
1956  
1957 my $hexchr = {
1958 1 => pack('H*', "0$hexdigit"),
1959 0 => pack('H*', "$hexdigit"),
1960  
1961 5 }->{CORE::length($_[0]) % 2};
1962  
1963 5 return $hexchr;
1964 }
1965  
1966 #
1967 # Latin-10 open character list for qr
1968 #
1969 576 ▶sub charlist_qr {
Subroutine charlist_qr: called CC=17 SCAR=28.7
Pod undocumented
1970  
1971 576 my $modifier = pop @_;
1972 576 my @char = @_;
1973  
1974 576 my($singleoctet, $multipleoctet) = _charlist(@char, $modifier);
1975 576 my @singleoctet = @$singleoctet;
1976 576 my @multipleoctet = @$multipleoctet;
1977  
1978 # return character list
1979 576 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) 498 78 576
1980  
1981 # with /i modifier
1982 498 ▶ if ($modifier =~ m/i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) 265 233 498
1983 265 my %singleoctet_ignorecase = ();
1984 265 for (@singleoctet) {
1985 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
1986 745 for my $ord (hex($1) .. hex($2)) {
1987 795 my $char = CORE::chr($ord);
1988 795 my $uc = Elatin10::uc($char);
1989 795 my $fc = Elatin10::fc($char);
1990 795 ▶ if ($uc eq $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc eq $fc) { } 240 555 795
1991 240 $singleoctet_ignorecase{unpack 'C*', $char} = 1;
1992 }
1993 else {
1994 555 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 555 0 555
1995 555 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
1996 555 $singleoctet_ignorecase{unpack 'C*', $fc} = 1;
1997 }
1998 else {
1999 0 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2000 0 push @multipleoctet, join '', map {sprintf('\x%02X',$_)} unpack 'C*', $fc;
2001 }
2002 }
2003 }
2004 }
2005 745 ▶ if ($_ ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ ne "") 0 745 745
2006 0 $singleoctet_ignorecase{unpack 'C*', $_} = 1;
2007 }
2008 }
2009 265 my $i = 0;
2010 265 my @singleoctet_ignorecase = ();
2011 265 for my $ord (0 .. 255) {
2012 67840 ▶ if (exists $singleoctet_ignorecase{$ord}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $singleoctet_ignorecase{$ord}) { } 870 66970 67840
2013 870 push @{$singleoctet_ignorecase[$i]}, $ord;
2014 }
2015 else {
2016 66970 $i++;
2017 }
2018 }
2019 265 @singleoctet = ();
2020 265 for my $range (@singleoctet_ignorecase) {
2021 56160 ▶ if (ref $range) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $range) 770 55390 56160
2022 770 ▶ if (scalar(@{$range}) == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @{$range;} == 1) { } 720 50 770
elsif (scalar @{$range;} == 2) { } 0 50 50
2023 720 push @singleoctet, sprintf('\x%02X', @{$range}[0]);
2024 }
2025 50 elsif (scalar(@{$range}) == 2) {
2026 0 push @singleoctet, sprintf('\x%02X\x%02X', @{$range}[0], @{$range}[-1]);
2027 }
2028 else {
2029 50 push @singleoctet, sprintf('\x%02X-\x%02X', @{$range}[0], @{$range}[-1]);
2030 }
2031 }
2032 }
2033 }
2034  
2035 498 my $not_anchor = '';
2036  
2037 498 push @multipleoctet, join('', $not_anchor, '[', @singleoctet, ']' );
2038 }
2039 576 ▶ if (scalar(@multipleoctet) >= 2) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @multipleoctet >= 2) { } 6 570 576
2040 6 return '(?:' . join('|', @multipleoctet) . ')';
2041 }
2042 else {
2043 570 return $multipleoctet[0];
2044 }
2045 }
2046  
2047 #
2048 # Latin-10 open character list for not qr
2049 #
2050 74 ▶sub charlist_not_qr {
Subroutine charlist_not_qr: called CC=18 SCAR=33.1
Pod undocumented
2051  
2052 74 my $modifier = pop @_;
2053 74 my @char = @_;
2054  
2055 74 my($singleoctet, $multipleoctet) = _charlist(@char, $modifier);
2056 74 my @singleoctet = @$singleoctet;
2057 74 my @multipleoctet = @$multipleoctet;
2058  
2059 # with /i modifier
2060 74 ▶ if ($modifier =~ m/i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) 25 49 74
2061 25 my %singleoctet_ignorecase = ();
2062 25 for (@singleoctet) {
2063 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
2064 25 for my $ord (hex($1) .. hex($2)) {
2065 75 my $char = CORE::chr($ord);
2066 75 my $uc = Elatin10::uc($char);
2067 75 my $fc = Elatin10::fc($char);
2068 75 ▶ if ($uc eq $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc eq $fc) { } 0 75 75
2069 0 $singleoctet_ignorecase{unpack 'C*', $char} = 1;
2070 }
2071 else {
2072 75 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 75 0 75
2073 75 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2074 75 $singleoctet_ignorecase{unpack 'C*', $fc} = 1;
2075 }
2076 else {
2077 0 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2078 0 push @multipleoctet, join '', map {sprintf('\x%02X',$_)} unpack 'C*', $fc;
2079 }
2080 }
2081 }
2082 }
2083 25 ▶ if ($_ ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ ne "") 0 25 25
2084 0 $singleoctet_ignorecase{unpack 'C*', $_} = 1;
2085 }
2086 }
2087 25 my $i = 0;
2088 25 my @singleoctet_ignorecase = ();
2089 25 for my $ord (0 .. 255) {
2090 6400 ▶ if (exists $singleoctet_ignorecase{$ord}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $singleoctet_ignorecase{$ord}) { } 150 6250 6400
2091 150 push @{$singleoctet_ignorecase[$i]}, $ord;
2092 }
2093 else {
2094 6250 $i++;
2095 }
2096 }
2097 25 @singleoctet = ();
2098 25 for my $range (@singleoctet_ignorecase) {
2099 2400 ▶ if (ref $range) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $range) 50 2350 2400
2100 50 ▶ if (scalar(@{$range}) == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @{$range;} == 1) { } 0 50 50
elsif (scalar @{$range;} == 2) { } 0 50 50
2101 0 push @singleoctet, sprintf('\x%02X', @{$range}[0]);
2102 }
2103 50 elsif (scalar(@{$range}) == 2) {
2104 0 push @singleoctet, sprintf('\x%02X\x%02X', @{$range}[0], @{$range}[-1]);
2105 }
2106 else {
2107 50 push @singleoctet, sprintf('\x%02X-\x%02X', @{$range}[0], @{$range}[-1]);
2108 }
2109 }
2110 }
2111 }
2112  
2113 # return character list
2114 74 ▶ if (scalar(@multipleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @multipleoctet >= 1) { } 0 74 74
2115 0 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) { } 0 0 0
2116  
2117 # any character other than multiple-octet and single octet character class
2118 0 return '(?!' . join('|', @multipleoctet) . ')(?:[^' . join('', @singleoctet) . '])';
2119 }
2120 else {
2121  
2122 # any character other than multiple-octet character class
2123 0 return '(?!' . join('|', @multipleoctet) . ")(?:$your_char)";
2124 }
2125 }
2126 else {
2127 74 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) { } 74 0 74
2128  
2129 # any character other than single octet character class
2130 74 return '(?:[^' . join('', @singleoctet) . '])';
2131 }
2132 else {
2133  
2134 # any character
2135 0 return "(?:$your_char)";
2136 }
2137 }
2138 }
2139  
2140 #
2141 # open file in read mode
2142 #
2143 422 ▶sub _open_r {
Subroutine _open_r: called CC=1 SCAR=0.0
2144 422 my(undef,$file) = @_;
2145 422 ▶ use Fcntl qw(O_RDONLY);
Subroutine BEGIN: called CC=1 SCAR=0.0
2146 422 return CORE::sysopen($_[0], $file, &O_RDONLY);
2147 }
2148  
2149 #
2150 # open file in append mode
2151 #
2152 211 ▶sub _open_a {
Subroutine _open_a: called CC=1 SCAR=0.0
2153 211 my(undef,$file) = @_;
2154 422 ▶ use Fcntl qw(O_WRONLY O_APPEND O_CREAT);
Subroutine BEGIN: called CC=1 SCAR=0.0
2155 211 return CORE::sysopen($_[0], $file, &O_WRONLY|&O_APPEND|&O_CREAT);
2156 }
2157  
2158 #
2159 # safe system
2160 #
2161 211 ▶sub _systemx {
Subroutine _systemx: called CC=1 SCAR=0.0
2162  
2163 # P.707 29.2.33. exec
2164 # in Chapter 29: Functions
2165 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2166 #
2167 # Be aware that in older releases of Perl, exec (and system) did not flush
2168 # your output buffer, so you needed to enable command buffering by setting $|
2169 # on one or more filehandles to avoid lost output in the case of exec, or
2170 # misordererd output in the case of system. This situation was largely remedied
2171 # in the 5.6 release of Perl. (So, 5.005 release not yet.)
2172  
2173 # P.855 exec
2174 # in Chapter 27: Functions
2175 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2176 #
2177 # In very old release of Perl (before v5.6), exec (and system) did not flush
2178 # your output buffer, so you needed to enable command buffering by setting $|
2179 # on one or more filehandles to avoid lost output with exec or misordered
2180 # output with system.
2181  
2182 211 $| = 1;
2183  
2184 # P.565 23.1.2. Cleaning Up Your Environment
2185 # in Chapter 23: Security
2186 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2187  
2188 # P.656 Cleaning Up Your Environment
2189 # in Chapter 20: Security
2190 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2191  
2192 # local $ENV{'PATH'} = '.';
2193 211 local @ENV{qw(IFS CDPATH ENV BASH_ENV)}; # Make %ENV safer
2194  
2195 # P.707 29.2.33. exec
2196 # in Chapter 29: Functions
2197 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2198 #
2199 # As we mentioned earlier, exec treats a discrete list of arguments as an
2200 # indication that it should bypass shell processing. However, there is one
2201 # place where you might still get tripped up. The exec call (and system, too)
2202 # will not distinguish between a single scalar argument and an array containing
2203 # only one element.
2204 #
2205 # @args = ("echo surprise"); # just one element in list
2206 # exec @args # still subject to shell escapes
2207 # or die "exec: $!"; # because @args == 1
2208 #
2209 # To avoid this, you can use the PATHNAME syntax, explicitly duplicating the
2210 # first argument as the pathname, which forces the rest of the arguments to be
2211 # interpreted as a list, even if there is only one of them:
2212 #
2213 # exec { $args[0] } @args # safe even with one-argument list
2214 # or die "can't exec @args: $!";
2215  
2216 # P.855 exec
2217 # in Chapter 27: Functions
2218 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2219 #
2220 # As we mentioned earlier, exec treats a discrete list of arguments as a
2221 # directive to bypass shell processing. However, there is one place where
2222 # you might still get tripped up. The exec call (and system, too) cannot
2223 # distinguish between a single scalar argument and an array containing
2224 # only one element.
2225 #
2226 # @args = ("echo surprise"); # just one element in list
2227 # exec @args # still subject to shell escapes
2228 # || die "exec: $!"; # because @args == 1
2229 #
2230 # To avoid this, use the PATHNAME syntax, explicitly duplicating the first
2231 # argument as the pathname, which forces the rest of the arguments to be
2232 # interpreted as a list, even if there is only one of them:
2233 #
2234 # exec { $args[0] } @args # safe even with one-argument list
2235 # || die "can't exec @args: $!";
2236  
2237 211 return CORE::system { $_[0] } @_; # safe even with one-argument list
2238 }
2239  
2240 #
2241 # Latin-10 order to character (with parameter)
2242 #
2243 3469 ▶sub Elatin10::chr(;$) {
Subroutine chr: called CC=4 SCAR=13.9
Pod undocumented
2244  
2245 3469 ▶ my $c = @_ ? $_[0] : $_;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 3469 0 3469
2246  
2247 3469 ▶ if ($c == 0x00) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c == 0) { } 24 3445 3469
2248 24 return "\x00";
2249 }
2250 else {
2251 3445 my @chr = ();
2252 3445 ▶ while ($c > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c > 0) 3445 3445 6890
2253 3445 unshift @chr, ($c % 0x100);
2254 3445 $c = int($c / 0x100);
2255 }
2256 3445 return pack 'C*', @chr;
2257 }
2258 }
2259  
2260 #
2261 # Latin-10 order to character (without parameter)
2262 #
2263 0 ▶sub Elatin10::chr_() {
Subroutine chr_: not called CC=3 SCAR=24.8
Pod undocumented
2264  
2265 0 my $c = $_;
2266  
2267 0 ▶ if ($c == 0x00) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c == 0) { } 0 0 0
2268 0 return "\x00";
2269 }
2270 else {
2271 0 my @chr = ();
2272 0 ▶ while ($c > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c > 0) 0 0 0
2273 0 unshift @chr, ($c % 0x100);
2274 0 $c = int($c / 0x100);
2275 }
2276 0 return pack 'C*', @chr;
2277 }
2278 }
2279  
2280 #
2281 # Latin-10 path globbing (with parameter)
2282 #
2283 0 ▶sub Elatin10::glob($) {
Subroutine glob: not called CC=3 SCAR=24.8
Pod undocumented
2284  
2285 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2286 0 my @glob = _DOS_like_glob(@_);
2287 0 for my $glob (@glob) {
2288 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2289 }
2290 0 return @glob;
2291 }
2292 else {
2293 0 my $glob = _DOS_like_glob(@_);
2294 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2295 0 return $glob;
2296 }
2297 }
2298  
2299 #
2300 # Latin-10 path globbing (without parameter)
2301 #
2302 0 ▶sub Elatin10::glob_() {
Subroutine glob_: not called CC=3 SCAR=24.8
Pod undocumented
2303  
2304 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2305 0 my @glob = _DOS_like_glob();
2306 0 for my $glob (@glob) {
2307 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2308 }
2309 0 return @glob;
2310 }
2311 else {
2312 0 my $glob = _DOS_like_glob();
2313 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2314 0 return $glob;
2315 }
2316 }
2317  
2318 #
2319 # Latin-10 path globbing via File::DosGlob 1.10
2320 #
2321 # Often I confuse "_dosglob" and "_doglob".
2322 # So, I renamed "_dosglob" to "_DOS_like_glob".
2323 #
2324 422 my %iter;
2325 my %entries;
2326 0 ▶sub _DOS_like_glob {
Subroutine _DOS_like_glob: not called CC=10 SCAR=47.0
2327  
2328 # context (keyed by second cxix argument provided by core)
2329 0 my($expr,$cxix) = @_;
2330  
2331 # glob without args defaults to $_
2332 0 ▶ $expr = $_ if not defined $expr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $expr 0 0 0
2333  
2334 # represents the current user's home directory
2335 #
2336 # 7.3. Expanding Tildes in Filenames
2337 # in Chapter 7. File Access
2338 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2339 #
2340 # and File::HomeDir, File::HomeDir::Windows module
2341  
2342 # DOS-like system
2343 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
2344 0 $expr =~ s{ \A ~ (?= [^/\\] ) }
2345 0 { my_home_MSWin32() }oxmse;
2346 }
2347  
2348 # UNIX-like system
2349 else {
2350 0 $expr =~ s{ \A ~ ( (?:[^/])* ) }
2351 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
2352 }
2353  
2354 # assume global context if not provided one
2355 0 ▶ $cxix = '_G_' if not defined $cxix;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $cxix 0 0 0
2356 0 ▶ $iter{$cxix} = 0 if not exists $iter{$cxix};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $iter{$cxix} 0 0 0
2357  
2358 # if we're just beginning, do it all first
2359 0 ▶ if ($iter{$cxix} == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iter{$cxix} == 0) 0 0 0
2360 0 $entries{$cxix} = [ _do_glob(1, _parse_line($expr)) ];
2361 }
2362  
2363 # chuck it all out, quick or slow
2364 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2365 0 delete $iter{$cxix};
2366 0 return @{delete $entries{$cxix}};
2367 }
2368 else {
2369 0 ▶ if ($iter{$cxix} = scalar @{$entries{$cxix}}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iter{$cxix} = scalar @{$entries{$cxix};}) { } 0 0 0
2370 0 return shift @{$entries{$cxix}};
2371 }
2372 else {
2373 # return undef for EOL
2374 0 delete $iter{$cxix};
2375 0 delete $entries{$cxix};
2376 0 return undef;
2377 }
2378 }
2379 }
2380  
2381 #
2382 # Latin-10 path globbing subroutine
2383 #
2384 0 ▶sub _do_glob {
Subroutine _do_glob: not called CC=44 SCAR=75.9
2385  
2386 0 my($cond,@expr) = @_;
2387 0 my @glob = ();
2388 0 my $fix_drive_relative_paths = 0;
2389  
2390 OUTER:
2391 0 for my $expr (@expr) {
2392 0 ▶ next OUTER if not defined $expr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $expr 0 0 0
2393 0 ▶ next OUTER if $expr eq '';
Branch: 1 branch
BranchTrueFalseTotal
if $expr eq "" 0 0 0
2394  
2395 0 my @matched = ();
2396 0 my @globdir = ();
2397 0 my $head = '.';
2398 0 my $pathsep = '/';
2399 0 my $tail;
2400  
2401 # if argument is within quotes strip em and do no globbing
2402 0 ▶ if ($expr =~ /\A " ((?:$q_char)*?) " \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expr =~ /\A " ((?:$Elatin10::q_char)*?) " \z/mosx) 0 0 0
2403 0 $expr = $1;
2404 0 ▶ if ($cond eq 'd') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cond eq 'd') { } 0 0 0
2405 0 ▶ if (-d $expr) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $expr) 0 0 0
2406 0 push @glob, $expr;
2407 }
2408 }
2409 else {
2410 0 ▶ if (-e $expr) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $expr) 0 0 0
2411 0 push @glob, $expr;
2412 }
2413 }
2414 0 next OUTER;
2415 }
2416  
2417 # wildcards with a drive prefix such as h:*.pm must be changed
2418 # to h:./*.pm to expand correctly
2419 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
2420 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
2421 0 $fix_drive_relative_paths = 1;
2422 }
2423 }
2424  
2425 0 ▶ if (($head, $tail) = _parse_path($expr,$pathsep)) {
Branch: 1 branch
BranchTrueFalseTotal
if (($head, $tail) = _parse_path($expr, $pathsep)) 0 0 0
2426 0 ▶ if ($tail eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($tail eq "") 0 0 0
2427 0 push @glob, $expr;
2428 0 next OUTER;
2429 }
2430 0 ▶ if ($head =~ / \A (?:$q_char)*? [*?] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head =~ / \A (?:$Elatin10::q_char)*? [*?] /mosx) 0 0 0
2431 0 ▶ if (@globdir = _do_glob('d', $head)) {
Branch: 1 branch
BranchTrueFalseTotal
if (@globdir = _do_glob("d", $head)) 0 0 0
2432 0 push @glob, _do_glob($cond, map {"$_$pathsep$tail"} @globdir);
2433 0 next OUTER;
2434 }
2435 }
2436 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
2437 0 $head .= $pathsep;
2438 }
2439 0 $expr = $tail;
2440 }
2441  
2442 # If file component has no wildcards, we can avoid opendir
2443 0 ▶ if ($expr !~ / \A (?:$q_char)*? [*?] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($expr =~ / \A (?:$Elatin10::q_char)*? [*?] /mosx) 0 0 0
2444 0 ▶ if ($head eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($head eq ".") 0 0 0
2445 0 $head = '';
2446 }
2447 0 ▶ if ($head ne '' and ($head =~ / \G ($q_char) /oxmsg)[-1] ne $pathsep) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head ne "" and ($head =~ / \G ($Elatin10::q_char) /gmosx)[-1] ne $pathsep) 0 0 0
Condition0%0/3
$head ne "" and ($head =~ / \G ($Elatin10::q_char) /gmosx)[-1] ne $pathsep
!ll&&!rl&&r
000
MC/DC0%0/2
$head ne "" and ($head =~ / \G ($Elatin10::q_char) /gmosx)[-1] ne $pathsep
$head ne "" ($head =~ / \G ($Elatin10::q_char) /gmosx)[-1] ne $pathsep
Truth table0%0/3
A and B
A= $head ne ""B= ($head =~ / \G ($Elatin10::q_char) /gmosx)[-1] ne $pathsep
ABresult
0X0
100
111
2448 0 $head .= $pathsep;
2449 }
2450 0 $head .= $expr;
2451 0 ▶ if ($cond eq 'd') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cond eq 'd') { } 0 0 0
2452 0 ▶ if (-d $head) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $head) 0 0 0
2453 0 push @glob, $head;
2454 }
2455 }
2456 else {
2457 0 ▶ if (-e $head) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $head) 0 0 0
2458 0 push @glob, $head;
2459 }
2460 }
2461 0 next OUTER;
2462 }
2463 0 ▶ opendir(*DIR, $head) or next OUTER;
Branch: 1 branch
BranchTrueFalseTotal
opendir *DIR, $head or next OUTER 0 0 0
2464 0 my @leaf = readdir DIR;
2465 0 closedir DIR;
2466  
2467 0 ▶ if ($head eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($head eq ".") 0 0 0
2468 0 $head = '';
2469 }
2470 0 ▶ if ($head ne '' and ($head =~ / \G ($q_char) /oxmsg)[-1] ne $pathsep) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head ne "" and ($head =~ / \G ($Elatin10::q_char) /gmosx)[-1] ne $pathsep) 0 0 0
Condition0%0/3
$head ne "" and ($head =~ / \G ($Elatin10::q_char) /gmosx)[-1] ne $pathsep
!ll&&!rl&&r
000
MC/DC0%0/2
$head ne "" and ($head =~ / \G ($Elatin10::q_char) /gmosx)[-1] ne $pathsep
$head ne "" ($head =~ / \G ($Elatin10::q_char) /gmosx)[-1] ne $pathsep
Truth table0%0/3
A and B
A= $head ne ""B= ($head =~ / \G ($Elatin10::q_char) /gmosx)[-1] ne $pathsep
ABresult
0X0
100
111
2471 0 $head .= $pathsep;
2472 }
2473  
2474 0 my $pattern = '';
2475 0 ▶ while ($expr =~ / \G ($q_char) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expr =~ / \G ($Elatin10::q_char) /cgox) 0 0 0
2476 0 my $char = $1;
2477  
2478 # 6.9. Matching Shell Globs as Regular Expressions
2479 # in Chapter 6. Pattern Matching
2480 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2481 # (and so on)
2482  
2483 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
2484 0 $pattern .= "(?:$your_char)*",
2485 }
2486 elsif ($char eq '?') {
2487 0 $pattern .= "(?:$your_char)?", # DOS style
2488 # $pattern .= "(?:$your_char)", # UNIX style
2489 }
2490 elsif ((my $fc = Elatin10::fc($char)) ne $char) {
2491 0 $pattern .= $fc;
2492 }
2493 else {
2494 0 $pattern .= quotemeta $char;
2495 }
2496 }
2497 0 ▶ my $matchsub = sub { Elatin10::fc($_[0]) =~ /\A $pattern \z/xms };
Subroutine __ANON__: not called CC=1 SCAR=6.9
2498  
2499 # if ($@) {
2500 # print STDERR "$0: $@\n";
2501 # next OUTER;
2502 # }
2503  
2504 INNER:
2505 0 for my $leaf (@leaf) {
2506 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
2507 0 next INNER;
2508 }
2509 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
2510 0 next INNER;
2511 }
2512  
2513 0 ▶ if (&$matchsub($leaf)) {
Branch: 1 branch
BranchTrueFalseTotal
if (&$matchsub($leaf)) 0 0 0
2514 0 push @matched, "$head$leaf";
2515 0 next INNER;
2516 }
2517  
2518 # [DOS compatibility special case]
2519 # Failed, add a trailing dot and try again, but only...
2520  
2521 0 ▶ if (Elatin10::index($leaf,'.') == -1 and # if name does not have a dot in it *and*
Branch: 1 branch
BranchTrueFalseTotal
if (&Elatin10::index($leaf, ".") == -1 and length $leaf <= 8 and &Elatin10::index($pattern, "\\.") != -1) 0 0 0
Condition0%0/6
&Elatin10::index($leaf, ".") == -1 and length $leaf <= 8 and &Elatin10::index($pattern, "\\.") != -1
!ll&&!rl&&r
000
&Elatin10::index($leaf, ".") == -1 and length $leaf <= 8
!ll&&!rl&&r
000
MC/DC0%0/3
&Elatin10::index($leaf, ".") == -1 and length $leaf <= 8 and &Elatin10::index($pattern, "\\.") != -1
&Elatin10::index($leaf, ".") == -1 length $leaf <= 8 &Elatin10::index($pattern, "\\.") != -1
Truth table0%0/4
A and B and C
A= &Elatin10::index($leaf, ".") == -1B= length $leaf <= 8C= &Elatin10::index($pattern, "\\.") != -1
ABCresult
0XX0
10X0
1100
1111
2522 CORE::length($leaf) <= 8 and # name is shorter than or equal to 8 chars *and*
2523 Elatin10::index($pattern,'\\.') != -1 # pattern has a dot.
2524 ) {
2525 0 ▶ if (&$matchsub("$leaf.")) {
Branch: 1 branch
BranchTrueFalseTotal
if (&$matchsub("$leaf.")) 0 0 0
2526 0 push @matched, "$head$leaf";
2527 0 next INNER;
2528 }
2529 }
2530 }
2531 0 ▶ if (@matched) {
Branch: 1 branch
BranchTrueFalseTotal
if (@matched) 0 0 0
2532 0 push @glob, @matched;
2533 }
2534 }
2535 0 ▶ if ($fix_drive_relative_paths) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fix_drive_relative_paths) 0 0 0
2536 0 for my $glob (@glob) {
2537 0 $glob =~ s# \A ([A-Za-z]:) \./ #$1#oxms;
2538 }
2539 }
2540 0 return @glob;
2541 }
2542  
2543 #
2544 # Latin-10 parse line
2545 #
2546 0 ▶sub _parse_line {
Subroutine _parse_line: not called CC=3 SCAR=24.8
2547  
2548 0 my($line) = @_;
2549  
2550 0 $line .= ' ';
2551 0 my @piece = ();
2552 0 ▶ while ($line =~ /
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ / " ( (?>(?: [^"] )* ) ) " (?>\s+) | ( (?>(?: [^"\s] )* ) ) (?>\s+) /gmosx) 0 0 0
2553 " ( (?>(?: [^"] )* ) ) " (?>\s+) |
2554 ( (?>(?: [^"\s] )* ) ) (?>\s+)
2555 /oxmsg
2556 ) {
2557 0 ▶ push @piece, defined($1) ? $1 : $2;
Branch: 1 branch
BranchTrueFalseTotal
defined $1 ? : 0 0 0
2558 }
2559 0 return @piece;
2560 }
2561  
2562 #
2563 # Latin-10 parse path
2564 #
2565 0 ▶sub _parse_path {
Subroutine _parse_path: not called CC=2 SCAR=17.9
2566  
2567 0 my($path,$pathsep) = @_;
2568  
2569 0 $path .= '/';
2570 0 my @subpath = ();
2571 0 ▶ while ($path =~ /
Branch: 1 branch
BranchTrueFalseTotal
if ($path =~ m( ((?: [^/\\] )+?) [/\\] )gmosx) 0 0 0
2572 ((?: [^\/\\] )+?) [\/\\]
2573 /oxmsg
2574 ) {
2575 0 push @subpath, $1;
2576 }
2577  
2578 0 my $tail = pop @subpath;
2579 0 my $head = join $pathsep, @subpath;
2580 0 return $head, $tail;
2581 }
2582  
2583 #
2584 # via File::HomeDir::Windows 1.00
2585 #
2586 0 ▶sub my_home_MSWin32 {
Subroutine my_home_MSWin32: not called CC=9 SCAR=45.0
Pod undocumented
2587  
2588 # A lot of unix people and unix-derived tools rely on
2589 # the ability to overload HOME. We will support it too
2590 # so that they can replace raw HOME calls with File::HomeDir.
2591 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
2592 0 return $ENV{'HOME'};
2593 }
2594  
2595 # Do we have a user profile?
2596 ▶ 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
2597 0 return $ENV{'USERPROFILE'};
2598 }
2599  
2600 # Some Windows use something like $ENV{'HOME'}
2601 ▶ 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
2602 0 return join '', $ENV{'HOMEDRIVE'}, $ENV{'HOMEPATH'};
2603 }
2604  
2605 0 return undef;
2606 }
2607  
2608 #
2609 # via File::HomeDir::Unix 1.00
2610 #
2611 0 ▶sub my_home {
Subroutine my_home: not called CC=7 SCAR=40.3
Pod undocumented
2612 0 my $home;
2613  
2614 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
2615 0 $home = $ENV{'HOME'};
2616 }
2617  
2618 # This is from the original code, but I'm guessing
2619 # it means "login directory" and exists on some Unixes.
2620 ▶ 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
2621 0 $home = $ENV{'LOGDIR'};
2622 }
2623  
2624 ### More-desperate methods
2625  
2626 # Light desperation on any (Unixish) platform
2627 else {
2628 0 $home = CORE::eval q{ (getpwuid($<))[7] };
2629 }
2630  
2631 # On Unix in general, a non-existant home means "no home"
2632 # For example, "nobody"-like users might use /nonexistant
2633 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
2634 0 $home = undef;
2635 }
2636 0 return $home;
2637 }
2638  
2639 #
2640 # ${^PREMATCH}, $PREMATCH, $` the string preceding what was matched
2641 #
2642 56 ▶sub Elatin10::PREMATCH {
Subroutine PREMATCH: called CC=1 SCAR=0.0
Pod undocumented
2643 56 return $`;
2644 }
2645  
2646 #
2647 # ${^MATCH}, $MATCH, $& the string that matched
2648 #
2649 81 ▶sub Elatin10::MATCH {
Subroutine MATCH: called CC=1 SCAR=0.0
Pod undocumented
2650 81 return $&;
2651 }
2652  
2653 #
2654 # ${^POSTMATCH}, $POSTMATCH, $' the string following what was matched
2655 #
2656 42 ▶sub Elatin10::POSTMATCH {
Subroutine POSTMATCH: called CC=1 SCAR=0.0
Pod undocumented
2657 42 return $';
2658 }
2659  
2660 #
2661 # Latin-10 character to order (with parameter)
2662 #
2663 0 ▶sub Latin10::ord(;$) {
Subroutine ord: not called CC=4 SCAR=30.0
2664  
2665 0 ▶ local $_ = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
2666  
2667 0 ▶ if (/\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\A ($Elatin10::q_char) /mosx) { } 0 0 0
2668 0 my @ord = unpack 'C*', $1;
2669 0 my $ord = 0;
2670 0 ▶ while (my $o = shift @ord) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $o = shift @ord) 0 0 0
2671 0 $ord = $ord * 0x100 + $o;
2672 }
2673 0 return $ord;
2674 }
2675 else {
2676 0 return CORE::ord $_;
2677 }
2678 }
2679  
2680 #
2681 # Latin-10 character to order (without parameter)
2682 #
2683 0 ▶sub Latin10::ord_() {
Subroutine ord_: not called CC=3 SCAR=24.8
2684  
2685 0 ▶ if (/\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\A ($Elatin10::q_char) /mosx) { } 0 0 0
2686 0 my @ord = unpack 'C*', $1;
2687 0 my $ord = 0;
2688 0 ▶ while (my $o = shift @ord) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $o = shift @ord) 0 0 0
2689 0 $ord = $ord * 0x100 + $o;
2690 }
2691 0 return $ord;
2692 }
2693 else {
2694 0 return CORE::ord $_;
2695 }
2696 }
2697  
2698 #
2699 # Latin-10 reverse
2700 #
2701 0 ▶sub Latin10::reverse(@) {
Subroutine reverse: not called CC=2 SCAR=17.9
2702  
2703 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2704 0 return CORE::reverse @_;
2705 }
2706 else {
2707  
2708 # One of us once cornered Larry in an elevator and asked him what
2709 # problem he was solving with this, but he looked as far off into
2710 # the distance as he could in an elevator and said, "It seemed like
2711 # a good idea at the time."
2712  
2713 0 return join '', CORE::reverse(join('',@_) =~ /\G ($q_char) /oxmsg);
2714 }
2715 }
2716  
2717 #
2718 # Latin-10 getc (with parameter, without parameter)
2719 #
2720 20 ▶sub Latin10::getc(;*@) {
Subroutine getc: called CC=9 SCAR=26.7
2721  
2722 20 my($package) = caller;
2723 20 ▶ my $fh = @_ ? qualify_to_ref(shift,$package) : \*STDIN;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 20 0 20
2724 20 ▶ croak 'Too many arguments for Latin10::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
2725  
2726 0 my @length = sort { $a <=> $b } keys %range_tr;
2727 20 my $getc = '';
2728 20 for my $length ($length[0] .. $length[-1]) {
2729 20 $getc .= CORE::getc($fh);
2730 20 ▶ if (exists $range_tr{CORE::length($getc)}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{length $getc}) 20 0 20
2731 20 ▶ if ($getc =~ /\A ${Elatin10::dot_s} \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($getc =~ /\A $Elatin10::dot_s \z/mosx) 20 0 20
2732 20 ▶ return wantarray ? ($getc,@_) : $getc;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 20 20
2733 }
2734 }
2735 }
2736 0 ▶ return wantarray ? ($getc,@_) : $getc;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
2737 }
2738  
2739 #
2740 # Latin-10 length by character
2741 #
2742 0 ▶sub Latin10::length(;$) {
Subroutine length: not called CC=2 SCAR=17.9
2743  
2744 0 ▶ local $_ = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
2745  
2746 0 local @_ = /\G ($q_char) /oxmsg;
2747 0 return scalar @_;
2748 }
2749  
2750 #
2751 # Latin-10 substr by character
2752 #
2753 422 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=7.0
2754  
2755 # P.232 The lvalue Attribute
2756 # in Chapter 6: Subroutines
2757 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2758  
2759 # P.336 The lvalue Attribute
2760 # in Chapter 7: Subroutines
2761 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2762  
2763 # P.144 8.4 Lvalue subroutines
2764 # in Chapter 8: perlsub: Perl subroutines
2765 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
2766  
2767 0 ▶ CORE::eval sprintf(<<'END', ($] >= 5.014000) ? ':lvalue' : '');
Subroutine substr: called CC=11 SCAR=24.4
Branch: 10 branches
BranchTrueFalseTotal
$] >= 5.014 ? : 422 0 422
if ($offset > scalar @char or $offset < -1 * scalar(@char)) 2 25 27
if (@_ == 4) { } 1 24 25
elsif (@_ == 3) { } 21 3 24
if ($offset == 0) { } 0 21 21
elsif ($offset > 0) { } 20 1 21
if ($length == 0) { } 0 21 21
elsif ($length > 0) { } 20 1 21
if ($offset == 0) { } 0 3 3
elsif ($offset > 0) { } 2 1 3
Condition66%2/3
$offset > scalar @char or $offset < -1 * scalar(@char)
l!l&&r!l&&!r
2025
MC/DC50%1/2
$offset > scalar @char or $offset < -1 * scalar(@char)
$offset > scalar @char $offset < -1 * scalar(@char)
Truth table66%2/3
A or B
A= $offset > scalar @charB= $offset < -1 * scalar(@char)
ABresult
1X1
011
000
2768 # vv----------------------*******
2769 sub Latin10::substr($$;$$) %s {
2770  
2771 my @char = $_[0] =~ /\G (?>$q_char) /oxmsg;
2772  
2773 # If the substring is beyond either end of the string, substr() returns the undefined
2774 # value and produces a warning. When used as an lvalue, specifying a substring that
2775 # is entirely outside the string raises an exception.
2776 # http://perldoc.perl.org/functions/substr.html
2777  
2778 # A return with no argument returns the scalar value undef in scalar context,
2779 # an empty list () in list context, and (naturally) nothing at all in void
2780 # context.
2781  
2782 my $offset = $_[1];
2783 if (($offset > scalar(@char)) or ($offset < (-1 * scalar(@char)))) {
2784 return;
2785 }
2786  
2787 # substr($string,$offset,$length,$replacement)
2788 if (@_ == 4) {
2789 my(undef,undef,$length,$replacement) = @_;
2790 my $substr = join '', splice(@char, $offset, $length, $replacement);
2791 $_[0] = join '', @char;
2792  
2793 # return $substr; this doesn't work, don't say "return"
2794 $substr;
2795 }
2796  
2797 # substr($string,$offset,$length)
2798 elsif (@_ == 3) {
2799 my(undef,undef,$length) = @_;
2800 my $octet_offset = 0;
2801 my $octet_length = 0;
2802 if ($offset == 0) {
2803 $octet_offset = 0;
2804 }
2805 elsif ($offset > 0) {
2806 $octet_offset = CORE::length(join '', @char[0..$offset-1]);
2807 }
2808 else {
2809 $octet_offset = -1 * CORE::length(join '', @char[$#char+$offset+1..$#char]);
2810 }
2811 if ($length == 0) {
2812 $octet_length = 0;
2813 }
2814 elsif ($length > 0) {
2815 $octet_length = CORE::length(join '', @char[$offset..$offset+$length-1]);
2816 }
2817 else {
2818 $octet_length = -1 * CORE::length(join '', @char[$#char+$length+1..$#char]);
2819 }
2820 CORE::substr($_[0], $octet_offset, $octet_length);
2821 }
2822  
2823 # substr($string,$offset)
2824 else {
2825 my $octet_offset = 0;
2826 if ($offset == 0) {
2827 $octet_offset = 0;
2828 }
2829 elsif ($offset > 0) {
2830 $octet_offset = CORE::length(join '', @char[0..$offset-1]);
2831 }
2832 else {
2833 $octet_offset = -1 * CORE::length(join '', @char[$#char+$offset+1..$#char]);
2834 }
2835 CORE::substr($_[0], $octet_offset);
2836 }
2837 }
2838 END
2839 }
2840  
2841 #
2842 # Latin-10 index by character
2843 #
2844 0 ▶sub Latin10::index($$;$) {
Subroutine index: not called CC=3 SCAR=24.8
2845  
2846 0 my $index;
2847 0 ▶ if (@_ == 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 3) { } 0 0 0
2848 0 $index = Elatin10::index($_[0], $_[1], CORE::length(Latin10::substr($_[0], 0, $_[2])));
2849 }
2850 else {
2851 0 $index = Elatin10::index($_[0], $_[1]);
2852 }
2853  
2854 0 ▶ if ($index == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($index == -1) { } 0 0 0
2855 0 return -1;
2856 }
2857 else {
2858 0 return Latin10::length(CORE::substr $_[0], 0, $index);
2859 }
2860 }
2861  
2862 #
2863 # Latin-10 rindex by character
2864 #
2865 0 ▶sub Latin10::rindex($$;$) {
Subroutine rindex: not called CC=3 SCAR=24.8
2866  
2867 0 my $rindex;
2868 0 ▶ if (@_ == 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 3) { } 0 0 0
2869 0 $rindex = Elatin10::rindex($_[0], $_[1], CORE::length(Latin10::substr($_[0], 0, $_[2])));
2870 }
2871 else {
2872 0 $rindex = Elatin10::rindex($_[0], $_[1]);
2873 }
2874  
2875 0 ▶ if ($rindex == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rindex == -1) { } 0 0 0
2876 0 return -1;
2877 }
2878 else {
2879 0 return Latin10::length(CORE::substr $_[0], 0, $rindex);
2880 }
2881 }
2882  
2883 # when 'm//', '/' means regexp match 'm//' and '?' means regexp match '??'
2884 # when 'div', '/' means division operator and '?' means conditional operator (condition ? then : else)
2885 422 ▶use vars qw($slash); $slash = 'm//';
Subroutine BEGIN: called CC=1 SCAR=0.0
2886  
2887 # ord() to ord() or Latin10::ord()
2888 422 my $function_ord = 'ord';
2889  
2890 # ord to ord or Latin10::ord_
2891 422 my $function_ord_ = 'ord';
2892  
2893 # reverse to reverse or Latin10::reverse
2894 422 my $function_reverse = 'reverse';
2895  
2896 # getc to getc or Latin10::getc
2897 422 my $function_getc = 'getc';
2898  
2899 # P.1023 Appendix W.9 Multibyte Anchoring
2900 # of ISBN 1-56592-224-7 CJKV Information Processing
2901  
2902 422 my $anchor = '';
2903  
2904 422 ▶use vars qw($nest);
Subroutine BEGIN: called CC=1 SCAR=0.0
2905  
2906 # regexp of nested parens in qqXX
2907  
2908 # P.340 Matching Nested Constructs with Embedded Code
2909 # in Chapter 7: Perl
2910 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
2911  
2912 my $qq_paren = qr{(?{local $nest=0}) (?>(?:
2913 [^\\()] |
2914 \( (?{$nest++}) |
2915 \) (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2916 \\ [^c] |
2917 \\c[\x40-\x5F] |
2918 [\x00-\xFF]
2919 422 }xms;
2920  
2921 my $qq_brace = qr{(?{local $nest=0}) (?>(?:
2922 [^\\{}] |
2923 \{ (?{$nest++}) |
2924 \} (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2925 \\ [^c] |
2926 \\c[\x40-\x5F] |
2927 [\x00-\xFF]
2928 422 }xms;
2929  
2930 my $qq_bracket = qr{(?{local $nest=0}) (?>(?:
2931 [^\\\[\]] |
2932 \[ (?{$nest++}) |
2933 \] (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2934 \\ [^c] |
2935 \\c[\x40-\x5F] |
2936 [\x00-\xFF]
2937 422 }xms;
2938  
2939 my $qq_angle = qr{(?{local $nest=0}) (?>(?:
2940 [^\\<>] |
2941 \< (?{$nest++}) |
2942 \> (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2943 \\ [^c] |
2944 \\c[\x40-\x5F] |
2945 [\x00-\xFF]
2946 422 }xms;
2947  
2948 422 my $qq_scalar = qr{(?: \{ (?:$qq_brace)*? \} |
2949 (?: ::)? (?:
2950 (?> [a-zA-Z_][a-zA-Z_0-9]* (?: ::[a-zA-Z_][a-zA-Z_0-9]*)* )
2951 (?>(?: \[ (?: \$\[ | \$\] | $qq_char )*? \] | \{ (?:$qq_brace)*? \} )*)
2952 (?>(?: (?: -> )? (?: [\$\@\%\&\*]\* | \$\#\* | [\@\%]? \[ (?: \$\[ | \$\] | $qq_char )*? \] | [\@\%\*]? \{ (?:$qq_brace)*? \} ) )*)
2953 ))
2954 }xms;
2955  
2956 422 my $qq_variable = qr{(?: \{ (?:$qq_brace)*? \} |
2957 (?: ::)? (?:
2958 (?>[0-9]+) |
2959 [^a-zA-Z_0-9\[\]] |
2960 ^[A-Z] |
2961 (?> [a-zA-Z_][a-zA-Z_0-9]* (?: ::[a-zA-Z_][a-zA-Z_0-9]*)* )
2962 (?>(?: \[ (?: \$\[ | \$\] | $qq_char )*? \] | \{ (?:$qq_brace)*? \} )*)
2963 (?>(?: (?: -> )? (?: [\$\@\%\&\*]\* | \$\#\* | [\@\%]? \[ (?: \$\[ | \$\] | $qq_char )*? \] | [\@\%\*]? \{ (?:$qq_brace)*? \} ) )*)
2964 ))
2965 }xms;
2966  
2967 422 my $qq_substr = qr{(?> Char::substr | Latin10::substr | CORE::substr | substr ) (?>\s*) \( $qq_paren \)
2968 }xms;
2969  
2970 # regexp of nested parens in qXX
2971 my $q_paren = qr{(?{local $nest=0}) (?>(?:
2972 [^()] |
2973 \( (?{$nest++}) |
2974 \) (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2975 [\x00-\xFF]
2976 422 }xms;
2977  
2978 my $q_brace = qr{(?{local $nest=0}) (?>(?:
2979 [^\{\}] |
2980 \{ (?{$nest++}) |
2981 \} (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2982 [\x00-\xFF]
2983 422 }xms;
2984  
2985 my $q_bracket = qr{(?{local $nest=0}) (?>(?:
2986 [^\[\]] |
2987 \[ (?{$nest++}) |
2988 \] (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2989 [\x00-\xFF]
2990 422 }xms;
2991  
2992 my $q_angle = qr{(?{local $nest=0}) (?>(?:
2993 [^<>] |
2994 \< (?{$nest++}) |
2995 \> (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2996 [\x00-\xFF]
2997 422 }xms;
2998  
2999 422 my $matched = '';
3000 422 my $s_matched = '';
3001  
3002 422 my $tr_variable = ''; # variable of tr///
3003 422 my $sub_variable = ''; # variable of s///
3004 422 my $bind_operator = ''; # =~ or !~
3005  
3006 422 my @heredoc = (); # here document
3007 422 my @heredoc_delimiter = ();
3008 422 my $here_script = ''; # here script
3009  
3010 #
3011 # escape Latin-10 script
3012 #
3013 547 ▶sub Latin10::escape(;$) {
Subroutine escape: called CC=3 SCAR=11.0
3014 547 ▶ local($_) = $_[0] if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 292 255 547
3015  
3016 # P.359 The Study Function
3017 # in Chapter 7: Perl
3018 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3019  
3020 547 study $_; # Yes, I studied study yesterday.
3021  
3022 # while all script
3023  
3024 # 6.14. Matching from Where the Last Pattern Left Off
3025 # in Chapter 6. Pattern Matching
3026 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
3027 # (and so on)
3028  
3029 # one member of Tag-team
3030 #
3031 # P.128 Start of match (or end of previous match): \G
3032 # P.130 Advanced Use of \G with Perl
3033 # in Chapter 3: Overview of Regular Expression Features and Flavors
3034 # P.255 Use leading anchors
3035 # P.256 Expose ^ and \G at the front expressions
3036 # in Chapter 6: Crafting an Efficient Expression
3037 # P.315 "Tag-team" matching with /gc
3038 # in Chapter 7: Perl
3039 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3040  
3041 547 my $e_script = '';
3042 547 ▶ while (not /\G \z/oxgc) { # member
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 86760 547 87307
3043 86760 $e_script .= Latin10::escape_token();
3044 }
3045  
3046 547 return $e_script;
3047 }
3048  
3049 #
3050 # escape Latin-10 token of script
3051 #
3052 86760 ▶sub Latin10::escape_token {
Subroutine escape_token: called CC=504 SCAR=109.3
3053  
3054 # \n output here document
3055  
3056 86760 my $ignore_modules = join('|', qw(
3057 utf8
3058 bytes
3059 charnames
3060 I18N::Japanese
3061 I18N::Collate
3062 I18N::JExt
3063 File::DosGlob
3064 Wild
3065 Wildcard
3066 Japanese
3067 ));
3068  
3069 # another member of Tag-team
3070 #
3071 # P.315 "Tag-team" matching with /gc
3072 # in Chapter 7: Perl
3073 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3074  
3075 86760 ▶ if (/\G ( \n ) /oxgc) { # another member (and so on)
Branch: 139 branches
BranchTrueFalseTotal
if (/\G ( \n ) /cgox) { } 12824 73936 86760
elsif (/\G ((?>\s+)|\#.*) /cgox) { } 21388 52548 73936
elsif (/\G ( (?: if | elsif | unless | while | until | given | when ) (?>\s*) \( ) /cgox) { } 1644 50904 52548
elsif (/\G ( \( (?>\s*) (?: local \b | my \b | our \b | state \b )? (?>\s*) \$ $qq_scalar ) /cgox) { } 90 50814 50904
elsif (/\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /cgmosx) { } 4 50810 50814
elsif (/\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /cgmosx) { } 28 50782 50810
elsif (/\G ( \$' | \$\{'\} ) /cgmosx) { } 1 50781 50782
elsif (/\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /cgmosx) { } 3 50778 50781
elsif (/\G ( \$ $qq_scalar | $qq_substr ) /cgox) { } 1752 49026 50778
elsif (/\G ( [,;] ) /cgox) { } 5083 43943 49026
elsif (/\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /cgmosx) { } 0 43943 43943
elsif (/\G ( \$ 0 ) /cgmosx) { } 2 43941 43943
elsif (/\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /cgmosx) { } 0 43941 43941
elsif (/\G ( \$ \$ ) (?![\w\{]) /cgmosx) { } 1 43940 43941
elsif (/\G \$ ((?>[1-9][0-9]*)) /cgmosx) { } 4 43936 43940
elsif (/\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /cgmosx) { } 0 43936 43936
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /cgmosx) { } 0 43936 43936
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /cgmosx) { } 0 43936 43936
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /cgmosx) { } 0 43936 43936
elsif (/\G \$ (?>\s*) \{ ( (?>\s*) (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* ) (?>\s*) ) \} /cgmosx) { } 0 43936 43936
elsif (/\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /cgmosx) { } 0 43936 43936
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 43894 43936
elsif (m{\G ( \$[\$\@\#\\\'\"/\?\(\)\[\]\<\>] ) }cgmosx) { } 63 43831 43894
elsif (/\G \b (while (?>\s*) \( (?>\s*) <[\$]?[A-Za-z_][A-Za-z_0-9]*> (?>\s*) \)) \b /cgox) { } 0 43831 43831
elsif (/\G \b while (?>\s*) \( (?>\s*) < ((?:[^>\0\a\e\f\n\r\t])+?) > (?>\s*) \) \b /cgox) { } 0 43831 43831
elsif (/\G \b while (?>\s*) \( (?>\s*) glob (?>\s*) \) /cgox) { } 0 43831 43831
elsif (/\G \b while (?>\s*) \( (?>\s*) glob \b /cgox) { } 0 43831 43831
elsif (/\G \b ( if | unless | while | until | for | when ) \b /cgox) { } 251 43580 43831
elsif (/\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /cgox) { } 19 43561 43580
elsif (/\G \b Char::eval (?= (?>\s*) \{ ) /cgox) { } 0 43561 43561
elsif (/\G \b Latin10::eval (?= (?>\s*) \{ ) /cgox) { } 22 43539 43561
elsif (/\G \b Char::eval \b (?! (?>\s*) => ) /cgox) { } 0 43539 43539
elsif (/\G \b Latin10::eval \b (?! (?>\s*) => ) /cgox) { } 168 43371 43539
elsif (/\G \b bytes::substr \b (?! (?>\s*) => ) /cgox) { } 2 43369 43371
elsif (/\G \b chop \b (?! (?>\s*) => ) /cgox) { } 0 43369 43369
elsif (/\G \b bytes::index \b (?! (?>\s*) => ) /cgox) { } 2 43367 43369
elsif (/\G \b Char::index \b (?! (?>\s*) => ) /cgox) { } 0 43367 43367
elsif (/\G \b Latin10::index \b (?! (?>\s*) => ) /cgox) { } 0 43367 43367
elsif (/\G \b index \b (?! (?>\s*) => ) /cgox) { } 0 43367 43367
elsif (/\G \b bytes::rindex \b (?! (?>\s*) => ) /cgox) { } 2 43365 43367
elsif (/\G \b Char::rindex \b (?! (?>\s*) => ) /cgox) { } 0 43365 43365
elsif (/\G \b Latin10::rindex \b (?! (?>\s*) => ) /cgox) { } 0 43365 43365
elsif (/\G \b rindex \b (?! (?>\s*) => ) /cgox) { } 0 43365 43365
elsif (/\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 1 43364 43365
elsif (/\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43364 43364
elsif (/\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 1 43363 43364
elsif (/\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43363 43363
elsif (/\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 6 43357 43363
elsif (/\G -s (?>\s*) (\") ((?:$Elatin10::qq_char)+?) (\") /cgox) { } 0 43357 43357
elsif (/\G -s (?>\s+) qq (?>\s*) (\#) ((?:$Elatin10::qq_char)+?) (\#) /cgox) { } 0 43357 43357
elsif (/\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /cgox) { } 0 43357 43357
elsif (/\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /cgox) { } 0 43357 43357
elsif (/\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /cgox) { } 0 43357 43357
elsif (/\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /cgox) { } 0 43357 43357
elsif (/\G -s (?>\s+) qq (?>\s*) (\S) ((?:$Elatin10::qq_char)+?) (\1) /cgox) { } 0 43357 43357
elsif (/\G -s (?>\s*) (\') ((?:\\\'|\\\\|$Elatin10::q_char)+?) (\') /cgox) { } 0 43357 43357
elsif (/\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$Elatin10::q_char)+?) (\#) /cgox) { } 0 43357 43357
elsif (/\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /cgox) { } 0 43357 43357
elsif (/\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /cgox) { } 0 43357 43357
elsif (/\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /cgox) { } 0 43357 43357
elsif (/\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /cgox) { } 0 43357 43357
elsif (/\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$Elatin10::q_char)+?) (\1) /cgox) { } 0 43357 43357
elsif (/\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)* ) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ) )*) /cgox) { } 0 43357 43357
elsif (/\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /cgox) { } 0 43357 43357
elsif (/\G -s (?= (?>\s+) [a-z]+) /cgox) { } 0 43357 43357
elsif (/\G -s (?>\s+) ((?>\w+)) /cgox) { } 0 43357 43357
elsif (/\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43355 43357
elsif (/\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43353 43355
elsif (/\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 36 43317 43353
elsif (/\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43315 43317
elsif (/\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 8 43307 43315
elsif (/\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43307 43307
elsif (/\G \b lc \b (?! (?>\s*) => ) /cgox) { } 0 43307 43307
elsif (/\G \b lcfirst \b (?! (?>\s*) => ) /cgox) { } 0 43307 43307
elsif (/\G \b uc \b (?! (?>\s*) => ) /cgox) { } 0 43307 43307
elsif (/\G \b ucfirst \b (?! (?>\s*) => ) /cgox) { } 0 43307 43307
elsif (/\G \b fc \b (?! (?>\s*) => ) /cgox) { } 0 43307 43307
elsif (/\G -s \b (?! (?>\s*) => ) /cgox) { } 0 43307 43307
elsif (/\G \b bytes::length \b (?! (?>\s*) => ) /cgox) { } 0 43307 43307
elsif (/\G \b bytes::chr \b (?! (?>\s*) => ) /cgox) { } 0 43307 43307
elsif (/\G \b chr \b (?! (?>\s*) => ) /cgox) { } 0 43307 43307
elsif (/\G \b bytes::ord \b (?! (?>\s*) => ) /cgox) { } 0 43307 43307
elsif (/\G \b ord \b (?! (?>\s*) => ) /cgox) { } 0 43307 43307
elsif (/\G \b glob \b (?! (?>\s*) => ) /cgox) { } 0 43307 43307
elsif (/\G \b reverse \b (?! (?>\s*) => ) /cgox) { } 0 43307 43307
elsif (/\G \b getc \b (?! (?>\s*) => ) /cgox) { } 8 43299 43307
elsif (/\G \b (split) \b (?! (?>\s*) => ) /cgox) { } 87 43212 43299
elsif (/\G \b ( tr | y ) \b /cgox) { } 4 43208 43212
elsif (/\G \b (qq) \b /cgox) { } 2252 40956 43208
elsif (/\G \b (qr) \b /cgox) { } 0 40956 40956
elsif (/\G \b (qw) \b /cgox) { } 16 40940 40956
elsif (/\G \b (qx) \b /cgox) { } 0 40940 40940
elsif (/\G \b (q) \b /cgox) { } 473 40467 40940
elsif (/\G \b (m) \b /cgox) { } 209 40258 40467
elsif (/\G \b (s) \b /cgox) { } 101 40157 40258
elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 0 40157 40157
elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 40157 40157
elsif (/\G \b require ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 40157 40157
elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [#\n]) /cgmosx) { } 37 40120 40157
elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 40120 40120
elsif (/\G \b use ((?>\s+) strict) \b /cgmosx) { } 0 40120 40120
elsif (/\G \b use (?>\s+) ((?>([1-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /cgmosx) { } 2 40118 40120
elsif (/\G \b use (?>\s+) ((?>v([0-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /cgmosx) { } 0 40118 40118
elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 2 40116 40118
elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 40116 40116
elsif (/\G \b use ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 40116 40116
elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 0 40116 40116
elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 40116 40116
elsif (/\G \b no ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 40116 40116
elsif (/\G \b use \b /cgmosx) { } 0 40116 40116
elsif (/\G \b no \b /cgmosx) { } 2 40114 40116
elsif (/\G (?<![\w\$\@\%\&\*]) (\') /cgox) { } 1142 38972 40114
elsif (/\G (\") /cgox) { } 1923 37049 38972
elsif (/\G (\`) /cgox) { } 1 37048 37049
elsif ($Elatin10::slash eq 'm//' and m[\G (/) ]cgox) { } 681 36367 37048
elsif ($Elatin10::slash eq 'm//' and /\G (\?) /cgox) { } 0 36367 36367
elsif (/\G ( <<>> ) /cgox) { } 0 36367 36367
elsif (/\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /cgox) { } 0 36367 36367
elsif (/\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /cgox) { } 6 36361 36367
elsif (/\G ( <<~ \\([a-zA-Z_0-9]+) ) /cgox) { } 3 36358 36361
elsif (/\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /cgox) { } 6 36352 36358
elsif (/\G ( <<~ ([a-zA-Z_0-9]+) ) /cgox) { } 3 36349 36352
elsif (/\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /cgox) { } 6 36343 36349
elsif (/\G ( << '([a-zA-Z_0-9]*)' ) /cgox) { } 72 36271 36343
elsif (/\G ( << \\([a-zA-Z_0-9]+) ) /cgox) { } 0 36271 36271
elsif (/\G ( << "([a-zA-Z_0-9]*)" ) /cgox) { } 36 36235 36271
elsif (/\G ( << ([a-zA-Z_0-9]+) ) /cgox) { } 42 36193 36235
elsif (/\G ( << `([a-zA-Z_0-9]*)` ) /cgox) { } 0 36193 36193
elsif (/\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/cgox) { } 12 36181 36193
elsif (/\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /cgox) { } 0 36181 36181
elsif (/\G < ((?:[^>\0\a\e\f\n\r\t])+?) > /cgox) { } 0 36181 36181
elsif (/\G ^ ( __DATA__ \n .*) \z /cgmosx) { } 0 36181 36181
elsif (/\G ^ ( __END__ \n .*) \z /cgmosx) { } 210 35971 36181
elsif (/\G ( \cD .*) \z /cgmosx) { } 0 35971 35971
elsif (/\G ( \cZ .*) \z /cgmosx) { } 0 35971 35971
elsif (/\G ( -- | \+\+ | [\)\}\]] ) /cgox) { } 5837 30134 35971
elsif (/\G ( \.\.\. ) /cgox) { } 7 30127 30134
elsif (m"\G ((?> !~~ | !~ | != | ! | %= | % | &&= | && | &= | &\.= | &\. | & | -= | -> | - | :(?>\s*)= | : | <<>> | <<= | <=> | <= | < | == | => | =~ | = | >>= | >> | >= | > | \*\*= | \*\* | \*= | \* | \+= | \+ | \.\. | \.= | \. | //= | // | /= | / | \? | \\ | \^= | \^\.= | \^\. | \^ | \b x= | \|\|= | \|\| | \|= | \|\.= | \|\. | \| | ~~ | ~\. | ~ | \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b | \b(?: print )\b | [,;\(\{\[] )) "cgox) { } 9791 20336 30127
elsif (/\G ($Elatin10::q_char) /cgox) { } 20336 0 20336
3076 12824 my $heredoc = '';
3077 12824 ▶ if (scalar(@heredoc_delimiter) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @heredoc_delimiter >= 1) 174 12650 12824
3078 174 $slash = 'm//';
3079  
3080 174 $heredoc = join '', @heredoc;
3081 174 @heredoc = ();
3082  
3083 # skip here document
3084 174 for my $heredoc_delimiter (@heredoc_delimiter) {
3085 174 /\G .*? \n $heredoc_delimiter \n/xmsgc;
3086 }
3087 174 @heredoc_delimiter = ();
3088  
3089 174 $here_script = '';
3090 }
3091 12824 return "\n" . $heredoc;
3092 }
3093  
3094 # ignore space, comment
3095 21388 elsif (/\G ((?>\s+)|\#.*) /oxgc) { return $1; }
3096  
3097 # if (, elsif (, unless (, while (, until (, given (, and when (
3098  
3099 # given, when
3100  
3101 # P.225 The given Statement
3102 # in Chapter 15: Smart Matching and given-when
3103 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
3104  
3105 # P.133 The given Statement
3106 # in Chapter 4: Statements and Declarations
3107 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
3108  
3109 elsif (/\G ( (?: if | elsif | unless | while | until | given | when ) (?>\s*) \( ) /oxgc) {
3110 1644 $slash = 'm//';
3111 1644 return $1;
3112 }
3113  
3114 # scalar variable ($scalar = ...) =~ tr///;
3115 # scalar variable ($scalar = ...) =~ s///;
3116  
3117 # state
3118  
3119 # P.68 Persistent, Private Variables
3120 # in Chapter 4: Subroutines
3121 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
3122  
3123 # P.160 Persistent Lexically Scoped Variables: state
3124 # in Chapter 4: Statements and Declarations
3125 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
3126  
3127 # (and so on)
3128  
3129 elsif (/\G ( \( (?>\s*) (?: local \b | my \b | our \b | state \b )? (?>\s*) \$ $qq_scalar ) /oxgc) {
3130 90 my $e_string = e_string($1);
3131  
3132 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
3133 0 $tr_variable = $e_string . e_string($1);
3134 0 $bind_operator = $2;
3135 0 $slash = 'm//';
3136 0 return '';
3137 }
3138 elsif (/\G ( (?>\s*) = $qq_paren \) ) ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /oxgc) {
3139 0 $sub_variable = $e_string . e_string($1);
3140 0 $bind_operator = $2;
3141 0 $slash = 'm//';
3142 0 return '';
3143 }
3144 else {
3145 90 $slash = 'div';
3146 90 return $e_string;
3147 }
3148 }
3149  
3150 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin10::PREMATCH()
3151 elsif (/\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /oxmsgc) {
3152 4 $slash = 'div';
3153 4 return q{Elatin10::PREMATCH()};
3154 }
3155  
3156 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin10::MATCH()
3157 elsif (/\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /oxmsgc) {
3158 28 $slash = 'div';
3159 28 return q{Elatin10::MATCH()};
3160 }
3161  
3162 # $', ${'} --> $', ${'}
3163 elsif (/\G ( \$' | \$\{'\} ) /oxmsgc) {
3164 1 $slash = 'div';
3165 1 return $1;
3166 }
3167  
3168 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin10::POSTMATCH()
3169 elsif (/\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /oxmsgc) {
3170 3 $slash = 'div';
3171 3 return q{Elatin10::POSTMATCH()};
3172 }
3173  
3174 # scalar variable $scalar =~ tr///;
3175 # scalar variable $scalar =~ s///;
3176 # substr() =~ tr///;
3177 # substr() =~ s///;
3178 elsif (/\G ( \$ $qq_scalar | $qq_substr ) /oxgc) {
3179 1752 my $scalar = e_string($1);
3180  
3181 1752 ▶ if (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= (?: tr | y ) \b ) /oxgc) {
Branch: 2 branches
BranchTrueFalseTotal
if (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= (?: tr | y ) \b ) /cgox) { } 2 1750 1752
elsif (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /cgox) { } 65 1685 1750
3182 2 $tr_variable = $scalar;
3183 2 $bind_operator = $1;
3184 2 $slash = 'm//';
3185 2 return '';
3186 }
3187 elsif (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /oxgc) {
3188 65 $sub_variable = $scalar;
3189 65 $bind_operator = $1;
3190 65 $slash = 'm//';
3191 65 return '';
3192 }
3193 else {
3194 1685 $slash = 'div';
3195 1685 return $scalar;
3196 }
3197 }
3198  
3199 # end of statement
3200 elsif (/\G ( [,;] ) /oxgc) {
3201 5083 $slash = 'm//';
3202  
3203 # clear tr/// variable
3204 5083 $tr_variable = '';
3205  
3206 # clear s/// variable
3207 5083 $sub_variable = '';
3208  
3209 5083 $bind_operator = '';
3210  
3211 5083 return $1;
3212 }
3213  
3214 # bareword
3215 elsif (/\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /oxmsgc) {
3216 0 return $1;
3217 }
3218  
3219 # $0 --> $0
3220 elsif (/\G ( \$ 0 ) /oxmsgc) {
3221 2 $slash = 'div';
3222 2 return $1;
3223 }
3224 elsif (/\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /oxmsgc) {
3225 0 $slash = 'div';
3226 0 return $1;
3227 }
3228  
3229 # $$ --> $$
3230 elsif (/\G ( \$ \$ ) (?![\w\{]) /oxmsgc) {
3231 1 $slash = 'div';
3232 1 return $1;
3233 }
3234  
3235 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
3236 # $1, $2, $3 --> $1, $2, $3 otherwise
3237 elsif (/\G \$ ((?>[1-9][0-9]*)) /oxmsgc) {
3238 4 $slash = 'div';
3239 4 return e_capture($1);
3240 }
3241 elsif (/\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /oxmsgc) {
3242 0 $slash = 'div';
3243 0 return e_capture($1);
3244 }
3245  
3246 # $$foo[ ... ] --> $ $foo->[ ... ]
3247 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /oxmsgc) {
3248 0 $slash = 'div';
3249 0 return e_capture($1.'->'.$2);
3250 }
3251  
3252 # $$foo{ ... } --> $ $foo->{ ... }
3253 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /oxmsgc) {
3254 0 $slash = 'div';
3255 0 return e_capture($1.'->'.$2);
3256 }
3257  
3258 # $$foo
3259 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /oxmsgc) {
3260 0 $slash = 'div';
3261 0 return e_capture($1);
3262 }
3263  
3264 # ${ foo }
3265 elsif (/\G \$ (?>\s*) \{ ( (?>\s*) (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* ) (?>\s*) ) \} /oxmsgc) {
3266 0 $slash = 'div';
3267 0 return '${' . $1 . '}';
3268 }
3269  
3270 # ${ ... }
3271 elsif (/\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /oxmsgc) {
3272 0 $slash = 'div';
3273 0 return e_capture($1);
3274 }
3275  
3276 # variable or function
3277 # $ @ % & * $ #
3278 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) {
3279 42 $slash = 'div';
3280 42 return $1;
3281 }
3282 # $ $ $ $ $ $ $ $ $ $ $ $ $ $
3283 # $ @ # \ ' " / ? ( ) [ ] < >
3284 elsif (/\G ( \$[\$\@\#\\\'\"\/\?\(\)\[\]\<\>] ) /oxmsgc) {
3285 63 $slash = 'div';
3286 63 return $1;
3287 }
3288  
3289 # while (<FILEHANDLE>)
3290 elsif (/\G \b (while (?>\s*) \( (?>\s*) <[\$]?[A-Za-z_][A-Za-z_0-9]*> (?>\s*) \)) \b /oxgc) {
3291 0 return $1;
3292 }
3293  
3294 # while (<WILDCARD>) --- glob
3295  
3296 # avoid "Error: Runtime exception" of perl version 5.005_03
3297  
3298 elsif (/\G \b while (?>\s*) \( (?>\s*) < ((?:[^>\0\a\e\f\n\r\t])+?) > (?>\s*) \) \b /oxgc) {
3299 0 return 'while ($_ = Elatin10::glob("' . $1 . '"))';
3300 }
3301  
3302 # while (glob)
3303 elsif (/\G \b while (?>\s*) \( (?>\s*) glob (?>\s*) \) /oxgc) {
3304 0 return 'while ($_ = Elatin10::glob_)';
3305 }
3306  
3307 # while (glob(WILDCARD))
3308 elsif (/\G \b while (?>\s*) \( (?>\s*) glob \b /oxgc) {
3309 0 return 'while ($_ = Elatin10::glob';
3310 }
3311  
3312 # doit if, doit unless, doit while, doit until, doit for, doit when
3313 251 elsif (/\G \b ( if | unless | while | until | for | when ) \b /oxgc) { $slash = 'm//'; return $1; }
3314  
3315 # subroutines of package Elatin10
3316 19 elsif (/\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /oxgc) { $slash = 'm//'; return $1; }
3317 0 elsif (/\G \b Char::eval (?= (?>\s*) \{ ) /oxgc) { $slash = 'm//'; return 'eval'; }
3318 22 elsif (/\G \b Latin10::eval (?= (?>\s*) \{ ) /oxgc) { $slash = 'm//'; return 'eval'; }
3319 0 elsif (/\G \b Char::eval \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'eval Char::escape'; }
3320 168 elsif (/\G \b Latin10::eval \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'eval Latin10::escape'; }
3321 2 elsif (/\G \b bytes::substr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'substr'; }
3322 0 elsif (/\G \b chop \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin10::chop'; }
3323 2 elsif (/\G \b bytes::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'index'; }
3324 0 elsif (/\G \b Char::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Char::index'; }
3325 0 elsif (/\G \b Latin10::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Latin10::index'; }
3326 0 elsif (/\G \b index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin10::index'; }
3327 2 elsif (/\G \b bytes::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'rindex'; }
3328 0 elsif (/\G \b Char::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Char::rindex'; }
3329 0 elsif (/\G \b Latin10::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Latin10::rindex'; }
3330 0 elsif (/\G \b rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin10::rindex'; }
3331 1 elsif (/\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin10::lc'; }
3332 0 elsif (/\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin10::lcfirst'; }
3333 1 elsif (/\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin10::uc'; }
3334 0 elsif (/\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin10::ucfirst'; }
3335 6 elsif (/\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin10::fc'; }
3336  
3337 # "-s '' ..." means file test "-s 'filename' ..." (not means "- s/// ...")
3338 0 elsif (/\G -s (?>\s*) (\") ((?:$qq_char)+?) (\") /oxgc) { $slash = 'm//'; return '-s ' . e_qq('', $1,$3,$2); }
3339 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\#) ((?:$qq_char)+?) (\#) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3340 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3341 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3342 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3343 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3344 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\S) ((?:$qq_char)+?) (\1) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3345  
3346 0 elsif (/\G -s (?>\s*) (\') ((?:\\\'|\\\\|$q_char)+?) (\') /oxgc) { $slash = 'm//'; return '-s ' . e_q ('', $1,$3,$2); }
3347 0 elsif (/\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$q_char)+?) (\#) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3348 0 elsif (/\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3349 0 elsif (/\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3350 0 elsif (/\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3351 0 elsif (/\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3352 0 elsif (/\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$q_char)+?) (\1) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3353  
3354 elsif (/\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)* ) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ) )*) /oxgc)
3355 0 { $slash = 'm//'; return "-s $1"; }
3356 0 elsif (/\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /oxgc) { $slash = 'm//'; return "-s ($1)"; }
3357 0 elsif (/\G -s (?= (?>\s+) [a-z]+) /oxgc) { $slash = 'm//'; return '-s'; }
3358 0 elsif (/\G -s (?>\s+) ((?>\w+)) /oxgc) { $slash = 'm//'; return "-s $1"; }
3359  
3360 2 elsif (/\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'length'; }
3361 2 elsif (/\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'chr'; }
3362 36 elsif (/\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin10::chr'; }
3363 2 elsif (/\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'div'; return 'ord'; }
3364 8 elsif (/\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'div'; return $function_ord; }
3365 0 elsif (/\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin10::glob'; }
3366 0 elsif (/\G \b lc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin10::lc_'; }
3367 0 elsif (/\G \b lcfirst \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin10::lcfirst_'; }
3368 0 elsif (/\G \b uc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin10::uc_'; }
3369 0 elsif (/\G \b ucfirst \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin10::ucfirst_'; }
3370 0 elsif (/\G \b fc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin10::fc_'; }
3371 0 elsif (/\G -s \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return '-s '; }
3372  
3373 0 elsif (/\G \b bytes::length \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'length'; }
3374 0 elsif (/\G \b bytes::chr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'chr'; }
3375 0 elsif (/\G \b chr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin10::chr_'; }
3376 0 elsif (/\G \b bytes::ord \b (?! (?>\s*) => ) /oxgc) { $slash = 'div'; return 'ord'; }
3377 0 elsif (/\G \b ord \b (?! (?>\s*) => ) /oxgc) { $slash = 'div'; return $function_ord_; }
3378 0 elsif (/\G \b glob \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin10::glob_'; }
3379 0 elsif (/\G \b reverse \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return $function_reverse; }
3380 8 elsif (/\G \b getc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return $function_getc; }
3381 # split
3382 elsif (/\G \b (split) \b (?! (?>\s*) => ) /oxgc) {
3383 87 $slash = 'm//';
3384  
3385 87 my $e = '';
3386 87 ▶ while (/\G ( (?>\s+) | \( | \#.* ) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\G ( (?>\s+) | \( | \#.* ) /cgox) 85 87 172
3387 85 $e .= $1;
3388 }
3389  
3390 # end of split
3391 87 ▶ if (/\G (?= [,;\)\}\]] ) /oxgc) { return 'Elatin10::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
3392  
3393 # split scalar value
3394 1 elsif (/\G ( [\$\@\&\*] $qq_scalar ) /oxgc) { return 'Elatin10::split' . $e . e_string($1); }
3395  
3396 # split literal space
3397 0 elsif (/\G \b qq (\#) [ ] (\#) /oxgc) { return 'Elatin10::split' . $e . qq {qq$1 $2}; }
3398 0 elsif (/\G \b qq ((?>\s*)) (\() [ ] (\)) /oxgc) { return 'Elatin10::split' . $e . qq{$1qq$2 $3}; }
3399 0 elsif (/\G \b qq ((?>\s*)) (\{) [ ] (\}) /oxgc) { return 'Elatin10::split' . $e . qq{$1qq$2 $3}; }
3400 0 elsif (/\G \b qq ((?>\s*)) (\[) [ ] (\]) /oxgc) { return 'Elatin10::split' . $e . qq{$1qq$2 $3}; }
3401 0 elsif (/\G \b qq ((?>\s*)) (\<) [ ] (\>) /oxgc) { return 'Elatin10::split' . $e . qq{$1qq$2 $3}; }
3402 0 elsif (/\G \b qq ((?>\s*)) (\S) [ ] (\2) /oxgc) { return 'Elatin10::split' . $e . qq{$1qq$2 $3}; }
3403 0 elsif (/\G \b q (\#) [ ] (\#) /oxgc) { return 'Elatin10::split' . $e . qq {q$1 $2}; }
3404 0 elsif (/\G \b q ((?>\s*)) (\() [ ] (\)) /oxgc) { return 'Elatin10::split' . $e . qq {$1q$2 $3}; }
3405 0 elsif (/\G \b q ((?>\s*)) (\{) [ ] (\}) /oxgc) { return 'Elatin10::split' . $e . qq {$1q$2 $3}; }
3406 0 elsif (/\G \b q ((?>\s*)) (\[) [ ] (\]) /oxgc) { return 'Elatin10::split' . $e . qq {$1q$2 $3}; }
3407 0 elsif (/\G \b q ((?>\s*)) (\<) [ ] (\>) /oxgc) { return 'Elatin10::split' . $e . qq {$1q$2 $3}; }
3408 0 elsif (/\G \b q ((?>\s*)) (\S) [ ] (\2) /oxgc) { return 'Elatin10::split' . $e . qq {$1q$2 $3}; }
3409 10 elsif (/\G ' [ ] ' /oxgc) { return 'Elatin10::split' . $e . qq {' '}; }
3410 0 elsif (/\G " [ ] " /oxgc) { return 'Elatin10::split' . $e . qq {" "}; }
3411  
3412 # split qq//
3413 elsif (/\G \b (qq) \b /oxgc) {
3414 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin10::qq_char)*?) (\#) /cgox) { } 0 0 0
3415 else {
3416 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3417 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 ([*\-:?\\^|]) ((?:$Elatin10::qq_char)*?) (\1) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin10::qq_char)*?) (\1) /cgox) { } 0 0 0
3418 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq ( ) --> qr ( )
3419 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq { } --> qr { }
3420 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq [ ] --> qr [ ]
3421 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq < > --> qr < >
3422 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) /oxgc) { return e_split($e.'qr','{','}',$2,''); } # qq | | --> qr { }
3423 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq * * --> qr * *
3424 }
3425 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3426 }
3427 }
3428  
3429 # split qr//
3430 elsif (/\G \b (qr) \b /oxgc) {
3431 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1,$3,$2,$4); } # qr# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin10::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 12 12
3432 else {
3433 12 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 12 0 12
3434 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 (\') ((?:$Elatin10::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 12 12
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin10::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 12 12
elsif (/\G (\S) ((?:$Elatin10::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 12 0 12
3435 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr ( )
3436 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr { }
3437 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr [ ]
3438 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr < >
3439 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { return e_split_q($e.'qr',$1, $3, $2,$4); } # qr ' '
3440 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr','{','}',$2,$4); } # qr | | --> qr { }
3441 12 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr * *
3442 }
3443 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3444 }
3445 }
3446  
3447 # split q//
3448 elsif (/\G \b (q) \b /oxgc) {
3449 0 ▶ if (/\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:\\\#|\\\\|$Elatin10::q_char)*?) (\#) /cgox) { } 0 0 0
3450 else {
3451 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3452 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 ([*\-:?\\^|]) ((?:$Elatin10::q_char)*?) (\1) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:\\\\|\\\1| $Elatin10::q_char)*?) (\1) /cgox) { } 0 0 0
3453 0 elsif (/\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q ( ) --> qr ( )
3454 0 elsif (/\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q { } --> qr { }
3455 0 elsif (/\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q [ ] --> qr [ ]
3456 0 elsif (/\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q < > --> qr < >
3457 0 elsif (/\G ([*\-:?\\^|]) ((?:$q_char)*?) (\1) /oxgc) { return e_split_q($e.'qr','{','}',$2,''); } # q | | --> qr { }
3458 0 elsif (/\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q * * --> qr * *
3459 }
3460 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3461 }
3462 }
3463  
3464 # split m//
3465 elsif (/\G \b (m) \b /oxgc) {
3466 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1,$3,$2,$4); } # m# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin10::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
3467 else {
3468 18 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 18 0 18
3469 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 (\') ((?:$Elatin10::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin10::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
elsif (/\G (\S) ((?:$Elatin10::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 18 0 18
3470 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m ( ) --> qr ( )
3471 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m { } --> qr { }
3472 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m [ ] --> qr [ ]
3473 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m < > --> qr < >
3474 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { return e_split_q($e.'qr',$1, $3, $2,$4); } # m ' ' --> qr ' '
3475 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr','{','}',$2,$4); } # m | | --> qr { }
3476 18 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m * * --> qr * *
3477 }
3478 0 die __FILE__, ": Search pattern not terminated\n";
3479 }
3480 }
3481  
3482 # split ''
3483 elsif (/\G (\') /oxgc) {
3484 0 my $q_string = '';
3485 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3486 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 ($Elatin10::q_char) /cgox) { } 0 0 0
3487 0 elsif (/\G (\\\') /oxgc) { $q_string .= $1; } # splitqr'' --> split qr''
3488 0 elsif (/\G \' /oxgc) { return e_split_q($e.q{ qr},"'","'",$q_string,''); } # ' ' --> qr ' '
3489 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3490 }
3491 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3492 }
3493  
3494 # split ""
3495 elsif (/\G (\") /oxgc) {
3496 0 my $qq_string = '';
3497 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3498 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 ($Elatin10::q_char) /cgox) { } 0 0 0
3499 0 elsif (/\G (\\\") /oxgc) { $qq_string .= $1; } # splitqr"" --> split qr""
3500 0 elsif (/\G \" /oxgc) { return e_split($e.q{ qr},'"','"',$qq_string,''); } # " " --> qr " "
3501 0 elsif (/\G ($q_char) /oxgc) { $qq_string .= $1; }
3502 }
3503 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3504 }
3505  
3506 # split //
3507 elsif (/\G (\/) /oxgc) {
3508 44 my $regexp = '';
3509 44 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 381 0 381
3510 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 ($Elatin10::q_char) /cgox) { } 337 0 337
3511 0 elsif (/\G (\\\/) /oxgc) { $regexp .= $1; } # splitqr// --> split qr//
3512 44 elsif (/\G \/ ([cgimosxpadlunbB]*) /oxgc) { return e_split($e.q{ qr}, '/','/',$regexp,$1); } # / / --> qr / /
3513 337 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
3514 }
3515 0 die __FILE__, ": Search pattern not terminated\n";
3516 }
3517 }
3518  
3519 # tr/// or y///
3520  
3521 # about [cdsrbB]* (/B modifier)
3522 #
3523 # P.559 appendix C
3524 # of ISBN 4-89052-384-7 Programming perl
3525 # (Japanese title is: Perl puroguramingu)
3526  
3527 elsif (/\G \b ( tr | y ) \b /oxgc) {
3528 4 my $ope = $1;
3529  
3530 # $1 $2 $3 $4 $5 $6
3531 4 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ((?:$qq_char)*?) (\#) ([cdsrbB]*) /oxgc) { # tr# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin10::qq_char)*?) (\#) ((?:$Elatin10::qq_char)*?) (\#) ([cdsrbB]*) /cgox) { } 0 4 4
3532 0 my @tr = ($tr_variable,$2);
3533 0 return e_tr(@tr,'',$4,$6);
3534 }
3535 else {
3536 4 my $e = '';
3537 4 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 4 0 4
3538 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) ((?:$Elatin10::qq_char)*?) (\1) ((?:$Elatin10::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 4 0 4
3539 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) {
3540 0 my @tr = ($tr_variable,$2);
3541 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3542 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) ((?:$Elatin10::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3543 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) ( )
3544 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) { }
3545 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) [ ]
3546 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) < >
3547 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) * *
3548 }
3549 0 die __FILE__, ": Transliteration replacement not terminated\n";
3550 }
3551 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) {
3552 0 my @tr = ($tr_variable,$2);
3553 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3554 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) ((?:$Elatin10::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3555 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } ( )
3556 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } { }
3557 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } [ ]
3558 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } < >
3559 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } * *
3560 }
3561 0 die __FILE__, ": Transliteration replacement not terminated\n";
3562 }
3563 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) {
3564 0 my @tr = ($tr_variable,$2);
3565 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3566 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) ((?:$Elatin10::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3567 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] ( )
3568 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] { }
3569 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] [ ]
3570 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] < >
3571 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] * *
3572 }
3573 0 die __FILE__, ": Transliteration replacement not terminated\n";
3574 }
3575 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) {
3576 0 my @tr = ($tr_variable,$2);
3577 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3578 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) ((?:$Elatin10::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3579 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > ( )
3580 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > { }
3581 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > [ ]
3582 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > < >
3583 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > * *
3584 }
3585 0 die __FILE__, ": Transliteration replacement not terminated\n";
3586 }
3587 # $1 $2 $3 $4 $5 $6
3588 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { # tr * * *
3589 4 my @tr = ($tr_variable,$2);
3590 4 return e_tr(@tr,'',$4,$6);
3591 }
3592 }
3593 0 die __FILE__, ": Transliteration pattern not terminated\n";
3594 }
3595 }
3596  
3597 # qq//
3598 elsif (/\G \b (qq) \b /oxgc) {
3599 2252 my $ope = $1;
3600  
3601 # if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { return e_qq($ope,$1,$3,$2); } # qq# #
3602 2252 ▶ if (/\G (\#) /oxgc) { # qq# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) /cgox) { } 0 2252 2252
3603 0 my $qq_string = '';
3604 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3605 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 ($Elatin10::qq_char) /cgox) { } 0 0 0
3606 0 elsif (/\G (\\\#) /oxgc) { $qq_string .= $1; }
3607 0 elsif (/\G (\#) /oxgc) { return e_qq($ope,'#','#',$qq_string); }
3608 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3609 }
3610 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3611 }
3612  
3613 else {
3614 2252 my $e = '';
3615 2252 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 2252 0 2252
3616 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
3617  
3618 # elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq ( )
3619 elsif (/\G (\() /oxgc) { # qq ( )
3620 0 my $qq_string = '';
3621 0 local $nest = 1;
3622 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3623 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 ($Elatin10::qq_char) /cgox) { } 0 0 0
3624 0 elsif (/\G (\\\)) /oxgc) { $qq_string .= $1; }
3625 0 elsif (/\G (\() /oxgc) { $qq_string .= $1; $nest++; }
3626 elsif (/\G (\)) /oxgc) {
3627 0 ▶ if (--$nest == 0) { return $e . e_qq($ope,'(',')',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin10::nest == 0) { } 0 0 0
3628 0 else { $qq_string .= $1; }
3629 }
3630 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3631 }
3632 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3633 }
3634  
3635 # elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq { }
3636 elsif (/\G (\{) /oxgc) { # qq { }
3637 2222 my $qq_string = '';
3638 2222 local $nest = 1;
3639 2222 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 85117 0 85117
3640 85117 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 5 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 722 84395 85117
elsif (/\G (\\\}) /cgox) { } 0 84395 84395
elsif (/\G (\{) /cgox) { } 1189 83206 84395
elsif (/\G (\}) /cgox) { } 3411 79795 83206
elsif (/\G ($Elatin10::qq_char) /cgox) { } 79795 0 79795
3641 0 elsif (/\G (\\\}) /oxgc) { $qq_string .= $1; }
3642 1189 elsif (/\G (\{) /oxgc) { $qq_string .= $1; $nest++; }
3643 elsif (/\G (\}) /oxgc) {
3644 3411 ▶ if (--$nest == 0) { return $e . e_qq($ope,'{','}',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin10::nest == 0) { } 2222 1189 3411
3645 1189 else { $qq_string .= $1; }
3646 }
3647 79795 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3648 }
3649 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3650 }
3651  
3652 # elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq [ ]
3653 elsif (/\G (\[) /oxgc) { # qq [ ]
3654 0 my $qq_string = '';
3655 0 local $nest = 1;
3656 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3657 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 ($Elatin10::qq_char) /cgox) { } 0 0 0
3658 0 elsif (/\G (\\\]) /oxgc) { $qq_string .= $1; }
3659 0 elsif (/\G (\[) /oxgc) { $qq_string .= $1; $nest++; }
3660 elsif (/\G (\]) /oxgc) {
3661 0 ▶ if (--$nest == 0) { return $e . e_qq($ope,'[',']',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin10::nest == 0) { } 0 0 0
3662 0 else { $qq_string .= $1; }
3663 }
3664 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3665 }
3666 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3667 }
3668  
3669 # elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq < >
3670 elsif (/\G (\<) /oxgc) { # qq < >
3671 30 my $qq_string = '';
3672 30 local $nest = 1;
3673 30 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 1166 0 1166
3674 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 ($Elatin10::qq_char) /cgox) { } 1114 0 1114
3675 0 elsif (/\G (\\\>) /oxgc) { $qq_string .= $1; }
3676 0 elsif (/\G (\<) /oxgc) { $qq_string .= $1; $nest++; }
3677 elsif (/\G (\>) /oxgc) {
3678 30 ▶ if (--$nest == 0) { return $e . e_qq($ope,'<','>',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin10::nest == 0) { } 30 0 30
3679 0 else { $qq_string .= $1; }
3680 }
3681 1114 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3682 }
3683 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3684 }
3685  
3686 # elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq * *
3687 elsif (/\G (\S) /oxgc) { # qq * *
3688 0 my $delimiter = $1;
3689 0 my $qq_string = '';
3690 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3691 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 ($Elatin10::qq_char) /cgox) { } 0 0 0
3692 0 elsif (/\G (\\\Q$delimiter\E) /oxgc) { $qq_string .= $1; }
3693 0 elsif (/\G (\Q$delimiter\E) /oxgc) { return $e . e_qq($ope,$delimiter,$delimiter,$qq_string); }
3694 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3695 }
3696 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3697 }
3698 }
3699 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3700 }
3701 }
3702  
3703 # qr//
3704 elsif (/\G \b (qr) \b /oxgc) {
3705 0 my $ope = $1;
3706 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { # qr# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin10::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 0 0
3707 0 return e_qr($ope,$1,$3,$2,$4);
3708 }
3709 else {
3710 0 my $e = '';
3711 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3712 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 (\') ((?:$Elatin10::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin10::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin10::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
3713 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr ( )
3714 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr { }
3715 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr [ ]
3716 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr < >
3717 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { return $e . e_qr_q($ope,$1, $3, $2,$4); } # qr ' '
3718 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,'{','}',$2,$4); } # qr | | --> qr { }
3719 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr * *
3720 }
3721 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3722 }
3723 }
3724  
3725 # qw//
3726 elsif (/\G \b (qw) \b /oxgc) {
3727 16 my $ope = $1;
3728 16 ▶ if (/\G (\#) (.*?) (\#) /oxmsgc) { # qw# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) (.*?) (\#) /cgmosx) { } 0 16 16
3729 0 return e_qw($ope,$1,$3,$2);
3730 }
3731 else {
3732 16 my $e = '';
3733 16 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 16 0 16
3734 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) ((?:$Elatin10::q_char)*?) (\1) /cgmosx) { } 0 0 0
3735  
3736 16 elsif (/\G (\() ([^(]*?) (\)) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw ( )
3737 0 elsif (/\G (\() ((?:$q_paren)*?) (\)) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw ( )
3738  
3739 0 elsif (/\G (\{) ([^{]*?) (\}) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw { }
3740 0 elsif (/\G (\{) ((?:$q_brace)*?) (\}) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw { }
3741  
3742 0 elsif (/\G (\[) ([^[]*?) (\]) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw [ ]
3743 0 elsif (/\G (\[) ((?:$q_bracket)*?) (\]) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw [ ]
3744  
3745 0 elsif (/\G (\<) ([^<]*?) (\>) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw < >
3746 0 elsif (/\G (\<) ((?:$q_angle)*?) (\>) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw < >
3747  
3748 0 elsif (/\G ([\x21-\x3F]) (.*?) (\1) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw * *
3749 0 elsif (/\G (\S) ((?:$q_char)*?) (\1) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw * *
3750 }
3751 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3752 }
3753 }
3754  
3755 # qx//
3756 elsif (/\G \b (qx) \b /oxgc) {
3757 0 my $ope = $1;
3758 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qx# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin10::qq_char)*?) (\#) /cgox) { } 0 0 0
3759 0 return e_qq($ope,$1,$3,$2);
3760 }
3761 else {
3762 0 my $e = '';
3763 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3764 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 (\') ((?:$Elatin10::qq_char)*?) (\') /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin10::qq_char)*?) (\1) /cgox) { } 0 0 0
3765 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx ( )
3766 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx { }
3767 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx [ ]
3768 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx < >
3769 0 elsif (/\G (\') ((?:$qq_char)*?) (\') /oxgc) { return $e . e_q ($ope,$1,$3,$2); } # qx ' '
3770 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx * *
3771 }
3772 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3773 }
3774 }
3775  
3776 # q//
3777 elsif (/\G \b (q) \b /oxgc) {
3778 473 my $ope = $1;
3779  
3780 # if (/\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { return e_q($ope,$1,$3,$2); } # q# #
3781  
3782 # avoid "Error: Runtime exception" of perl version 5.005_03
3783 # (and so on)
3784  
3785 473 ▶ if (/\G (\#) /oxgc) { # q# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) /cgox) { } 0 473 473
3786 0 my $q_string = '';
3787 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3788 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 ($Elatin10::q_char) /cgox) { } 0 0 0
3789 0 elsif (/\G (\\\#) /oxgc) { $q_string .= $1; }
3790 0 elsif (/\G (\#) /oxgc) { return e_q($ope,'#','#',$q_string); }
3791 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3792 }
3793 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3794 }
3795  
3796 else {
3797 473 my $e = '';
3798 473 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 473 0 473
3799 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
3800  
3801 # elsif (/\G (\() ((?:\\\)|\\\\|$q_paren)*?) (\)) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q ( )
3802 elsif (/\G (\() /oxgc) { # q ( )
3803 0 my $q_string = '';
3804 0 local $nest = 1;
3805 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3806 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 ($Elatin10::q_char) /cgox) { } 0 0 0
3807 0 elsif (/\G (\\\)) /oxgc) { $q_string .= $1; }
3808 0 elsif (/\G (\\\() /oxgc) { $q_string .= $1; }
3809 0 elsif (/\G (\() /oxgc) { $q_string .= $1; $nest++; }
3810 elsif (/\G (\)) /oxgc) {
3811 0 ▶ if (--$nest == 0) { return $e . e_q($ope,'(',')',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin10::nest == 0) { } 0 0 0
3812 0 else { $q_string .= $1; }
3813 }
3814 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3815 }
3816 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3817 }
3818  
3819 # elsif (/\G (\{) ((?:\\\}|\\\\|$q_brace)*?) (\}) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q { }
3820 elsif (/\G (\{) /oxgc) { # q { }
3821 467 my $q_string = '';
3822 467 local $nest = 1;
3823 467 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 8262 0 8262
3824 0 ▶ if (/\G (\\\\) /oxgc) { $q_string .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 8262 8262
elsif (/\G (\\\}) /cgox) { } 0 8262 8262
elsif (/\G (\\\{) /cgox) { } 0 8262 8262
elsif (/\G (\{) /cgox) { } 159 8103 8262
elsif (/\G (\}) /cgox) { } 626 7477 8103
elsif (/\G ($Elatin10::q_char) /cgox) { } 7477 0 7477
3825 0 elsif (/\G (\\\}) /oxgc) { $q_string .= $1; }
3826 0 elsif (/\G (\\\{) /oxgc) { $q_string .= $1; }
3827 159 elsif (/\G (\{) /oxgc) { $q_string .= $1; $nest++; }
3828 elsif (/\G (\}) /oxgc) {
3829 626 ▶ if (--$nest == 0) { return $e . e_q($ope,'{','}',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin10::nest == 0) { } 467 159 626
3830 159 else { $q_string .= $1; }
3831 }
3832 7477 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3833 }
3834 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3835 }
3836  
3837 # elsif (/\G (\[) ((?:\\\]|\\\\|$q_bracket)*?) (\]) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q [ ]
3838 elsif (/\G (\[) /oxgc) { # q [ ]
3839 0 my $q_string = '';
3840 0 local $nest = 1;
3841 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3842 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 ($Elatin10::q_char) /cgox) { } 0 0 0
3843 0 elsif (/\G (\\\]) /oxgc) { $q_string .= $1; }
3844 0 elsif (/\G (\\\[) /oxgc) { $q_string .= $1; }
3845 0 elsif (/\G (\[) /oxgc) { $q_string .= $1; $nest++; }
3846 elsif (/\G (\]) /oxgc) {
3847 0 ▶ if (--$nest == 0) { return $e . e_q($ope,'[',']',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin10::nest == 0) { } 0 0 0
3848 0 else { $q_string .= $1; }
3849 }
3850 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3851 }
3852 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3853 }
3854  
3855 # elsif (/\G (\<) ((?:\\\>|\\\\|$q_angle)*?) (\>) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q < >
3856 elsif (/\G (\<) /oxgc) { # q < >
3857 5 my $q_string = '';
3858 5 local $nest = 1;
3859 5 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 88 0 88
3860 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 ($Elatin10::q_char) /cgox) { } 83 0 83
3861 0 elsif (/\G (\\\>) /oxgc) { $q_string .= $1; }
3862 0 elsif (/\G (\\\<) /oxgc) { $q_string .= $1; }
3863 0 elsif (/\G (\<) /oxgc) { $q_string .= $1; $nest++; }
3864 elsif (/\G (\>) /oxgc) {
3865 5 ▶ if (--$nest == 0) { return $e . e_q($ope,'<','>',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin10::nest == 0) { } 5 0 5
3866 0 else { $q_string .= $1; }
3867 }
3868 83 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3869 }
3870 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3871 }
3872  
3873 # elsif (/\G (\S) ((?:\\\1|\\\\|$q_char)*?) (\1) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q * *
3874 elsif (/\G (\S) /oxgc) { # q * *
3875 1 my $delimiter = $1;
3876 1 my $q_string = '';
3877 1 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 14 0 14
3878 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 ($Elatin10::q_char) /cgox) { } 13 0 13
3879 0 elsif (/\G (\\\Q$delimiter\E) /oxgc) { $q_string .= $1; }
3880 1 elsif (/\G (\Q$delimiter\E) /oxgc) { return $e . e_q($ope,$delimiter,$delimiter,$q_string); }
3881 13 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3882 }
3883 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3884 }
3885 }
3886 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3887 }
3888 }
3889  
3890 # m//
3891 elsif (/\G \b (m) \b /oxgc) {
3892 209 my $ope = $1;
3893 209 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { # m# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin10::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
3894 0 return e_qr($ope,$1,$3,$2,$4);
3895 }
3896 else {
3897 209 my $e = '';
3898 209 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 209 0 209
3899 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 (\?) ((?:$Elatin10::qq_char)*?) (\?) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
elsif (/\G (\') ((?:$Elatin10::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 10 199 209
elsif (/\G ([*\-:\\^|]) ((?:$Elatin10::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 199 199
elsif (/\G (\S) ((?:$Elatin10::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 199 0 199
3900 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m ( )
3901 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m { }
3902 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m [ ]
3903 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m < >
3904 0 elsif (/\G (\?) ((?:$qq_char)*?) (\?) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m ? ?
3905 10 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr_q($ope,$1, $3, $2,$4); } # m ' '
3906 0 elsif (/\G ([*\-:\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,'{','}',$2,$4); } # m | | --> m { }
3907 199 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m * *
3908 }
3909 0 die __FILE__, ": Search pattern not terminated\n";
3910 }
3911 }
3912  
3913 # s///
3914  
3915 # about [cegimosxpradlunbB]* (/cg modifier)
3916 #
3917 # P.67 Pattern-Matching Operators
3918 # of ISBN 0-596-00241-6 Perl in a Nutshell, Second Edition.
3919  
3920 elsif (/\G \b (s) \b /oxgc) {
3921 101 my $ope = $1;
3922  
3923 # $1 $2 $3 $4 $5 $6
3924 101 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ((?:$qq_char)*?) (\#) ([cegimosxpradlunbB]*) /oxgc) { # s# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin10::qq_char)*?) (\#) ((?:$Elatin10::qq_char)*?) (\#) ([cegimosxpradlunbB]*) /cgox) { } 1 100 101
3925 1 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3926 }
3927 else {
3928 100 my $e = '';
3929 100 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 100 0 100
3930 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 (\') ((?:$Elatin10::qq_char)*?) (\') ((?:$Elatin10::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 21 79 100
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin10::qq_char)*?) (\1) ((?:$Elatin10::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 79 79
elsif (/\G (\$) ((?:$Elatin10::qq_char)*?) (\1) ((?:$Elatin10::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 79 79
elsif (/\G (\S) ((?:$Elatin10::qq_char)*?) (\1) ((?:$Elatin10::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 79 0 79
3931 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) {
3932 0 my @s = ($1,$2,$3);
3933 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3934 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 (\') ((?:$Elatin10::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin10::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Elatin10::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Elatin10::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin10::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3935 # $1 $2 $3 $4
3936 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3937 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3938 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3939 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3940 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3941 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3942 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3943 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3944 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3945 }
3946 0 die __FILE__, ": Substitution replacement not terminated\n";
3947 }
3948 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) {
3949 0 my @s = ($1,$2,$3);
3950 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3951 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 (\') ((?:$Elatin10::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin10::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Elatin10::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Elatin10::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin10::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3952 # $1 $2 $3 $4
3953 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3954 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3955 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3956 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3957 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3958 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3959 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([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 (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3962 }
3963 0 die __FILE__, ": Substitution replacement not terminated\n";
3964 }
3965 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) {
3966 0 my @s = ($1,$2,$3);
3967 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3968 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 (\') ((?:$Elatin10::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin10::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin10::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3969 # $1 $2 $3 $4
3970 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3971 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3972 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3973 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3974 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3975 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3976 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3977 }
3978 0 die __FILE__, ": Substitution replacement not terminated\n";
3979 }
3980 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) {
3981 0 my @s = ($1,$2,$3);
3982 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3983 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 (\') ((?:$Elatin10::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin10::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Elatin10::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Elatin10::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin10::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3984 # $1 $2 $3 $4
3985 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3986 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3987 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3988 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3989 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3990 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3991 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3992 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3993 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3994 }
3995 0 die __FILE__, ": Substitution replacement not terminated\n";
3996 }
3997 # $1 $2 $3 $4 $5 $6
3998 elsif (/\G (\') ((?:$qq_char)*?) (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) {
3999 21 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
4000 }
4001 # $1 $2 $3 $4 $5 $6
4002 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
4003 0 return e_sub($sub_variable,'{',$2,'}','{',$4,'}',$6); # s | | | --> s { } { }
4004 }
4005 # $1 $2 $3 $4 $5 $6
4006 elsif (/\G (\$) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
4007 0 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
4008 }
4009 # $1 $2 $3 $4 $5 $6
4010 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
4011 79 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
4012 }
4013 }
4014 0 die __FILE__, ": Substitution pattern not terminated\n";
4015 }
4016 }
4017  
4018 # require ignore module
4019 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# require$1$2"; }
4020 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# require$1\n$2"; }
4021 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# require$1"; }
4022  
4023 # use strict; --> use strict; no strict qw(refs);
4024 37 elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "use$1 no strict qw(refs);$2"; }
4025 0 elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [^#]) /oxmsgc) { return "use$1 no strict qw(refs);\n$2"; }
4026 0 elsif (/\G \b use ((?>\s+) strict) \b /oxmsgc) { return "use$1; no strict qw(refs)"; }
4027  
4028 # use 5.12.0; --> use 5.12.0; no strict qw(refs);
4029 elsif (/\G \b use (?>\s+) ((?>([1-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /oxmsgc) {
4030 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
4031 0 return "use $1; no strict qw(refs);";
4032 }
4033 else {
4034 2 return "use $1;";
4035 }
4036 }
4037 elsif (/\G \b use (?>\s+) ((?>v([0-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /oxmsgc) {
4038 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
4039 0 return "use $1; no strict qw(refs);";
4040 }
4041 else {
4042 0 return "use $1;";
4043 }
4044 }
4045  
4046 # ignore use module
4047 2 elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# use$1$2"; }
4048 0 elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# use$1\n$2"; }
4049 0 elsif (/\G \b use ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# use$1"; }
4050  
4051 # ignore no module
4052 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# no$1$2"; }
4053 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# no$1\n$2"; }
4054 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# no$1"; }
4055  
4056 # use else
4057 0 elsif (/\G \b use \b /oxmsgc) { return "use"; }
4058  
4059 # use else
4060 2 elsif (/\G \b no \b /oxmsgc) { return "no"; }
4061  
4062 # ''
4063 elsif (/\G (?<![\w\$\@\%\&\*]) (\') /oxgc) {
4064 1142 my $q_string = '';
4065 1142 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 10188 0 10188
4066 10188 ▶ if (/\G (\\\\) /oxgc) { $q_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 4 10184 10188
elsif (/\G (\\\') /cgox) { } 48 10136 10184
elsif (/\G \' /cgox) { } 1142 8994 10136
elsif (/\G ($Elatin10::q_char) /cgox) { } 8994 0 8994
4067 48 elsif (/\G (\\\') /oxgc) { $q_string .= $1; }
4068 1142 elsif (/\G \' /oxgc) { return e_q('', "'","'",$q_string); }
4069 8994 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
4070 }
4071 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4072 }
4073  
4074 # ""
4075 elsif (/\G (\") /oxgc) {
4076 1923 my $qq_string = '';
4077 1923 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 37482 0 37482
4078 37482 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 67 37415 37482
elsif (/\G (\\\") /cgox) { } 12 37403 37415
elsif (/\G \" /cgox) { } 1923 35480 37403
elsif (/\G ($Elatin10::q_char) /cgox) { } 35480 0 35480
4079 12 elsif (/\G (\\\") /oxgc) { $qq_string .= $1; }
4080 1923 elsif (/\G \" /oxgc) { return e_qq('', '"','"',$qq_string); }
4081 35480 elsif (/\G ($q_char) /oxgc) { $qq_string .= $1; }
4082 }
4083 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4084 }
4085  
4086 # ``
4087 elsif (/\G (\`) /oxgc) {
4088 1 my $qx_string = '';
4089 1 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 19 0 19
4090 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 ($Elatin10::q_char) /cgox) { } 18 0 18
4091 0 elsif (/\G (\\\`) /oxgc) { $qx_string .= $1; }
4092 1 elsif (/\G \` /oxgc) { return e_qq('', '`','`',$qx_string); }
4093 18 elsif (/\G ($q_char) /oxgc) { $qx_string .= $1; }
4094 }
4095 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4096 }
4097  
4098 # // --- not divide operator (num / num), not defined-or
4099 ▶ elsif (($slash eq 'm//') and /\G (\/) /oxgc) {
Condition100%3/3
$Elatin10::slash eq "m//" and m[\G (/) ]cgox
!ll&&!rl&&r
275318836681
MC/DC100%2/2
$Elatin10::slash eq "m//" and m[\G (/) ]cgox
$Elatin10::slash eq "m//" m[\G (/) ]cgox
Truth table100%3/3
A and B
A= $Elatin10::slash eq "m//"B= m[\G (/) ]cgox
ABresult
0X0
100
111
4100 681 my $regexp = '';
4101 681 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 5636 0 5636
4102 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 ($Elatin10::q_char) /cgox) { } 4955 0 4955
4103 0 elsif (/\G (\\\/) /oxgc) { $regexp .= $1; }
4104 681 elsif (/\G \/ ([cgimosxpadlunbB]*) /oxgc) { return e_qr('', '/','/',$regexp,$1); }
4105 4955 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
4106 }
4107 0 die __FILE__, ": Search pattern not terminated\n";
4108 }
4109  
4110 # ?? --- not conditional operator (condition ? then : else)
4111 ▶ elsif (($slash eq 'm//') and /\G (\?) /oxgc) {
Condition66%2/3
$Elatin10::slash eq "m//" and /\G (\?) /cgox
!ll&&!rl&&r
2753188360
MC/DC0%0/2
$Elatin10::slash eq "m//" and /\G (\?) /cgox
$Elatin10::slash eq "m//" /\G (\?) /cgox
Truth table66%2/3
A and B
A= $Elatin10::slash eq "m//"B= /\G (\?) /cgox
ABresult
0X0
100
111
4112 0 my $regexp = '';
4113 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
4114 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 ($Elatin10::q_char) /cgox) { } 0 0 0
4115 0 elsif (/\G (\\\?) /oxgc) { $regexp .= $1; }
4116 0 elsif (/\G \? ([cgimosxpadlunbB]*) /oxgc) { return e_qr('m','?','?',$regexp,$1); }
4117 0 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
4118 }
4119 0 die __FILE__, ": Search pattern not terminated\n";
4120 }
4121  
4122 # <<>> (a safer ARGV)
4123 0 elsif (/\G ( <<>> ) /oxgc) { $slash = 'm//'; return $1; }
4124  
4125 # << (bit shift) --- not here document
4126 0 elsif (/\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /oxgc) { $slash = 'm//'; return $1; }
4127  
4128 # <<~'HEREDOC'
4129 elsif (/\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /oxgc) {
4130 6 $slash = 'm//';
4131 6 my $here_quote = $1;
4132 6 my $delimiter = $2;
4133  
4134 # get here document
4135 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4136 6 $here_script = CORE::substr $_, pos $_;
4137 6 $here_script =~ s/.*?\n//oxm;
4138 }
4139 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
4140 6 my $heredoc = $1;
4141 6 my $indent = $2;
4142 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4143 6 push @heredoc, $heredoc . qq{\n$delimiter\n};
4144 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4145 }
4146 else {
4147 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4148 }
4149 6 return qq{<<'$delimiter'};
4150 }
4151  
4152 # <<~\HEREDOC
4153  
4154 # P.66 2.6.6. "Here" Documents
4155 # in Chapter 2: Bits and Pieces
4156 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4157  
4158 # P.73 "Here" Documents
4159 # in Chapter 2: Bits and Pieces
4160 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4161  
4162 elsif (/\G ( <<~ \\([a-zA-Z_0-9]+) ) /oxgc) {
4163 3 $slash = 'm//';
4164 3 my $here_quote = $1;
4165 3 my $delimiter = $2;
4166  
4167 # get here document
4168 3 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 3 0 3
4169 3 $here_script = CORE::substr $_, pos $_;
4170 3 $here_script =~ s/.*?\n//oxm;
4171 }
4172 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
4173 3 my $heredoc = $1;
4174 3 my $indent = $2;
4175 3 $heredoc =~ s{^$indent}{}msg; # no /ox
4176 3 push @heredoc, $heredoc . qq{\n$delimiter\n};
4177 3 push @heredoc_delimiter, qq{\\s*$delimiter};
4178 }
4179 else {
4180 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4181 }
4182 3 return qq{<<\\$delimiter};
4183 }
4184  
4185 # <<~"HEREDOC"
4186 elsif (/\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /oxgc) {
4187 6 $slash = 'm//';
4188 6 my $here_quote = $1;
4189 6 my $delimiter = $2;
4190  
4191 # get here document
4192 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4193 6 $here_script = CORE::substr $_, pos $_;
4194 6 $here_script =~ s/.*?\n//oxm;
4195 }
4196 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
4197 6 my $heredoc = $1;
4198 6 my $indent = $2;
4199 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4200 6 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4201 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4202 }
4203 else {
4204 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4205 }
4206 6 return qq{<<"$delimiter"};
4207 }
4208  
4209 # <<~HEREDOC
4210 elsif (/\G ( <<~ ([a-zA-Z_0-9]+) ) /oxgc) {
4211 3 $slash = 'm//';
4212 3 my $here_quote = $1;
4213 3 my $delimiter = $2;
4214  
4215 # get here document
4216 3 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 3 0 3
4217 3 $here_script = CORE::substr $_, pos $_;
4218 3 $here_script =~ s/.*?\n//oxm;
4219 }
4220 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
4221 3 my $heredoc = $1;
4222 3 my $indent = $2;
4223 3 $heredoc =~ s{^$indent}{}msg; # no /ox
4224 3 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4225 3 push @heredoc_delimiter, qq{\\s*$delimiter};
4226 }
4227 else {
4228 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4229 }
4230 3 return qq{<<$delimiter};
4231 }
4232  
4233 # <<~`HEREDOC`
4234 elsif (/\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /oxgc) {
4235 6 $slash = 'm//';
4236 6 my $here_quote = $1;
4237 6 my $delimiter = $2;
4238  
4239 # get here document
4240 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4241 6 $here_script = CORE::substr $_, pos $_;
4242 6 $here_script =~ s/.*?\n//oxm;
4243 }
4244 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
4245 6 my $heredoc = $1;
4246 6 my $indent = $2;
4247 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4248 6 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4249 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4250 }
4251 else {
4252 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4253 }
4254 6 return qq{<<`$delimiter`};
4255 }
4256  
4257 # <<'HEREDOC'
4258 elsif (/\G ( << '([a-zA-Z_0-9]*)' ) /oxgc) {
4259 72 $slash = 'm//';
4260 72 my $here_quote = $1;
4261 72 my $delimiter = $2;
4262  
4263 # get here document
4264 72 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 72 0 72
4265 72 $here_script = CORE::substr $_, pos $_;
4266 72 $here_script =~ s/.*?\n//oxm;
4267 }
4268 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
4269 72 push @heredoc, $1 . qq{\n$delimiter\n};
4270 72 push @heredoc_delimiter, $delimiter;
4271 }
4272 else {
4273 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4274 }
4275 72 return $here_quote;
4276 }
4277  
4278 # <<\HEREDOC
4279  
4280 # P.66 2.6.6. "Here" Documents
4281 # in Chapter 2: Bits and Pieces
4282 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4283  
4284 # P.73 "Here" Documents
4285 # in Chapter 2: Bits and Pieces
4286 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4287  
4288 elsif (/\G ( << \\([a-zA-Z_0-9]+) ) /oxgc) {
4289 0 $slash = 'm//';
4290 0 my $here_quote = $1;
4291 0 my $delimiter = $2;
4292  
4293 # get here document
4294 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4295 0 $here_script = CORE::substr $_, pos $_;
4296 0 $here_script =~ s/.*?\n//oxm;
4297 }
4298 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
4299 0 push @heredoc, $1 . qq{\n$delimiter\n};
4300 0 push @heredoc_delimiter, $delimiter;
4301 }
4302 else {
4303 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4304 }
4305 0 return $here_quote;
4306 }
4307  
4308 # <<"HEREDOC"
4309 elsif (/\G ( << "([a-zA-Z_0-9]*)" ) /oxgc) {
4310 36 $slash = 'm//';
4311 36 my $here_quote = $1;
4312 36 my $delimiter = $2;
4313  
4314 # get here document
4315 36 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 36 0 36
4316 36 $here_script = CORE::substr $_, pos $_;
4317 36 $here_script =~ s/.*?\n//oxm;
4318 }
4319 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
4320 36 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4321 36 push @heredoc_delimiter, $delimiter;
4322 }
4323 else {
4324 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4325 }
4326 36 return $here_quote;
4327 }
4328  
4329 # <<HEREDOC
4330 elsif (/\G ( << ([a-zA-Z_0-9]+) ) /oxgc) {
4331 42 $slash = 'm//';
4332 42 my $here_quote = $1;
4333 42 my $delimiter = $2;
4334  
4335 # get here document
4336 42 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 42 0 42
4337 42 $here_script = CORE::substr $_, pos $_;
4338 42 $here_script =~ s/.*?\n//oxm;
4339 }
4340 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
4341 42 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4342 42 push @heredoc_delimiter, $delimiter;
4343 }
4344 else {
4345 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4346 }
4347 42 return $here_quote;
4348 }
4349  
4350 # <<`HEREDOC`
4351 elsif (/\G ( << `([a-zA-Z_0-9]*)` ) /oxgc) {
4352 0 $slash = 'm//';
4353 0 my $here_quote = $1;
4354 0 my $delimiter = $2;
4355  
4356 # get here document
4357 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4358 0 $here_script = CORE::substr $_, pos $_;
4359 0 $here_script =~ s/.*?\n//oxm;
4360 }
4361 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
4362 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4363 0 push @heredoc_delimiter, $delimiter;
4364 }
4365 else {
4366 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4367 }
4368 0 return $here_quote;
4369 }
4370  
4371 # <<= <=> <= < operator
4372 elsif (/\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/oxgc) {
4373 12 return $1;
4374 }
4375  
4376 # <FILEHANDLE>
4377 elsif (/\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /oxgc) {
4378 0 return $1;
4379 }
4380  
4381 # <WILDCARD> --- glob
4382  
4383 # avoid "Error: Runtime exception" of perl version 5.005_03
4384  
4385 elsif (/\G < ((?:[^>\0\a\e\f\n\r\t])+?) > /oxgc) {
4386 0 return 'Elatin10::glob("' . $1 . '")';
4387 }
4388  
4389 # __DATA__
4390 0 elsif (/\G ^ ( __DATA__ \n .*) \z /oxmsgc) { return $1; }
4391  
4392 # __END__
4393 210 elsif (/\G ^ ( __END__ \n .*) \z /oxmsgc) { return $1; }
4394  
4395 # \cD Control-D
4396  
4397 # P.68 2.6.8. Other Literal Tokens
4398 # in Chapter 2: Bits and Pieces
4399 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4400  
4401 # P.76 Other Literal Tokens
4402 # in Chapter 2: Bits and Pieces
4403 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4404  
4405 0 elsif (/\G ( \cD .*) \z /oxmsgc) { return $1; }
4406  
4407 # \cZ Control-Z
4408 0 elsif (/\G ( \cZ .*) \z /oxmsgc) { return $1; }
4409  
4410 # any operator before div
4411 elsif (/\G (
4412 -- | \+\+ |
4413 [\)\}\]]
4414  
4415 5837 ) /oxgc) { $slash = 'div'; return $1; }
4416  
4417 # yada-yada or triple-dot operator
4418 elsif (/\G (
4419 \.\.\.
4420  
4421 7 ) /oxgc) { $slash = 'm//'; return q{die('Unimplemented')}; }
4422  
4423 # any operator before m//
4424  
4425 # //, //= (defined-or)
4426  
4427 # P.164 Logical Operators
4428 # in Chapter 10: More Control Structures
4429 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
4430  
4431 # P.119 C-Style Logical (Short-Circuit) Operators
4432 # in Chapter 3: Unary and Binary Operators
4433 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4434  
4435 # (and so on)
4436  
4437 # ~~
4438  
4439 # P.221 The Smart Match Operator
4440 # in Chapter 15: Smart Matching and given-when
4441 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
4442  
4443 # P.112 Smartmatch Operator
4444 # in Chapter 3: Unary and Binary Operators
4445 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4446  
4447 # (and so on)
4448  
4449 elsif (/\G ((?>
4450  
4451 !~~ | !~ | != | ! |
4452 %= | % |
4453 &&= | && | &= | &\.= | &\. | & |
4454 -= | -> | - |
4455 :(?>\s*)= |
4456 : |
4457 <<>> |
4458 <<= | <=> | <= | < |
4459 == | => | =~ | = |
4460 >>= | >> | >= | > |
4461 \*\*= | \*\* | \*= | \* |
4462 \+= | \+ |
4463 \.\. | \.= | \. |
4464 \/\/= | \/\/ |
4465 \/= | \/ |
4466 \? |
4467 \\ |
4468 \^= | \^\.= | \^\. | \^ |
4469 \b x= |
4470 \|\|= | \|\| | \|= | \|\.= | \|\. | \| |
4471 ~~ | ~\. | ~ |
4472 \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b |
4473 \b(?: print )\b |
4474  
4475 [,;\(\{\[]
4476  
4477 9791 )) /oxgc) { $slash = 'm//'; return $1; }
4478  
4479 # other any character
4480 20336 elsif (/\G ($q_char) /oxgc) { $slash = 'div'; return $1; }
4481  
4482 # system error
4483 else {
4484 0 die __FILE__, ": Oops, this shouldn't happen!\n";
4485 }
4486 }
4487  
4488 # escape Latin-10 string
4489 1871 ▶sub e_string {
Subroutine e_string: called CC=228 SCAR=104.2
Pod documented
4490 1871 my($string) = @_;
4491 1871 my $e_string = '';
4492  
4493 1871 local $slash = 'm//';
4494  
4495 # P.1024 Appendix W.10 Multibyte Processing
4496 # of ISBN 1-56592-224-7 CJKV Information Processing
4497 # (and so on)
4498  
4499 1871 my @char = $string =~ / \G (?>[^\\]|\\$q_char|$q_char) /oxmsg;
4500  
4501 # without { ... }
4502 1871 ▶ if (not (grep(/\A \{ \z/xms, @char) and grep(/\A \} \z/xms, @char))) {
Branch: 1 branch
BranchTrueFalseTotal
unless (grep /\A \{ \z/msx, @char and grep /\A \} \z/msx, @char) 1854 17 1871
Condition66%2/3
grep /\A \{ \z/msx, @char and grep /\A \} \z/msx, @char
!ll&&!rl&&r
1854017
MC/DC50%1/2
grep /\A \{ \z/msx, @char and grep /\A \} \z/msx, @char
grep /\A \{ \z/msx, @char grep /\A \} \z/msx, @char
Truth table66%2/3
A and B
A= grep /\A \{ \z/msx, @charB= grep /\A \} \z/msx, @char
ABresult
0X0
100
111
4503 1854 ▶ if ($string !~ /<</oxms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /<</mosx) 1854 0 1854
4504 1854 return $string;
4505 }
4506 }
4507  
4508 E_STRING_LOOP:
4509 17 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 190 17 207
4510 190 ▶ if (0) {
Branch: 101 branches
BranchTrueFalseTotal
if (do { $string =~ /\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /cgmosx }) { } 0 190 190
elsif ($string =~ /\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G ( \$' | \$\{'\} ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G ( \$ 0 ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G ( \$ \$ ) (?![\w\{]) /cgmosx) { } 0 190 190
elsif ($string =~ /\G \$ ((?>[1-9][0-9]*)) /cgmosx) { } 0 190 190
elsif ($string =~ /\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /cgmosx) { } 0 190 190
elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /cgmosx) { } 0 190 190
elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /cgmosx) { } 0 190 190
elsif ($string =~ /\G \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} /cgmosx) { } 0 190 190
elsif ($string =~ /\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /cgmosx) { } 3 187 190
elsif ($string =~ /\G ( (?: [\$\@\%\&\*] | \$\# | -> | \b sub \b) (?>\s*) (?: split | chop | index | rindex | lc | uc | fc | chr | ord | reverse | getc | tr | y | q | qq | qx | qw | m | s | qr | glob | lstat | opendir | stat | unlink | chdir ) ) \b /cgmosx) { } 7 180 187
elsif ($string =~ m{\G ( \$[\$\@\#\\\'\"/\?\(\)\[\]\<\>] ) }cgmosx) { } 0 180 180
elsif ($string =~ /\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b Char::eval (?= (?>\s*) \{ ) /cgox) { } 0 180 180
elsif ($string =~ /\G \b Latin10::eval (?= (?>\s*) \{ ) /cgox) { } 0 180 180
elsif ($string =~ /\G \b Char::eval \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b Latin10::eval \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::substr \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b chop \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::index \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b Char::index \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b Latin10::index \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b index \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::rindex \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b Char::rindex \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b Latin10::rindex \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b rindex \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s*) (\") ((?:$Elatin10::qq_char)+?) (\") /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\#) ((?:$Elatin10::qq_char)+?) (\#) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\S) ((?:$Elatin10::qq_char)+?) (\1) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s*) (\') ((?:\\\'|\\\\|$Elatin10::q_char)+?) (\') /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$Elatin10::q_char)+?) (\#) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$Elatin10::q_char)+?) (\1) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)*) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ))*) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?= (?>\s+) [a-z]+) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) ((?>\w+)) /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 180 180
elsif ($string =~ /\G \b lc \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b lcfirst \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b uc \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b ucfirst \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b fc \b /cgox) { } 0 180 180
elsif ($string =~ /\G -s \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::length \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::chr \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b chr \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b bytes::ord \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b ord \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b glob \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b reverse \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b getc \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b (split) \b (?! (?>\s*) => ) /cgox) { } 0 180 180
elsif ($string =~ /\G \b (qq) \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b (qx) \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b (q) \b /cgox) { } 0 180 180
elsif ($string =~ /\G (?<![\w\$\@\%\&\*]) (\') ((?:\\\'|\\\\|$Elatin10::q_char)*?) (\') /cgox) { } 0 180 180
elsif ($string =~ /\G (\") ((?:$Elatin10::qq_char)*?) (\") /cgox) { } 0 180 180
elsif ($string =~ /\G (\`) ((?:$Elatin10::qq_char)*?) (\`) /cgox) { } 0 180 180
elsif ($string =~ /\G ( <<>> ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/cgox) { } 0 180 180
elsif ($string =~ /\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /cgox) { } 0 180 180
elsif ($string =~ /\G < ((?:$Elatin10::q_char)+?) > /cgox) { } 0 180 180
elsif ($string =~ /\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( <<~ \\([a-zA-Z_0-9]+) ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( <<~ ([a-zA-Z_0-9]+) ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( << '([a-zA-Z_0-9]*)' ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( << \\([a-zA-Z_0-9]+) ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( << "([a-zA-Z_0-9]*)" ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( << ([a-zA-Z_0-9]+) ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( << `([a-zA-Z_0-9]*)` ) /cgox) { } 0 180 180
elsif ($string =~ /\G ( -- | \+\+ | [\)\}\]] ) /cgox) { } 18 162 180
elsif ($string =~ /\G ( \.\.\. ) /cgox) { } 0 162 162
elsif ($string =~ m"\G ((?> !~~ | !~ | != | ! | %= | % | &&= | && | &= | &\.= | &\. | & | -= | -> | - | :(?>\s*)= | : | <<>> | <<= | <=> | <= | < | == | => | =~ | = | >>= | >> | >= | > | \*\*= | \*\* | \*= | \* | \+= | \+ | \.\. | \.= | \. | //= | // | /= | / | \? | \\ | \^= | \^\.= | \^\. | \^ | \b x= | \|\|= | \|\| | \|= | \|\.= | \|\. | \| | ~~ | ~\. | ~ | \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b | \b(?: print )\b | [,;\(\{\[] )) "cgox) { } 31 131 162
elsif ($string =~ /\G ($Elatin10::q_char) /cgox) { } 131 0 131
4511 }
4512  
4513 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> @{[Elatin10::PREMATCH()]}
4514 elsif ($string =~ /\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /oxmsgc) {
4515 0 $e_string .= q{Elatin10::PREMATCH()};
4516 0 $slash = 'div';
4517 }
4518  
4519 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> @{[Elatin10::MATCH()]}
4520 elsif ($string =~ /\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /oxmsgc) {
4521 0 $e_string .= q{Elatin10::MATCH()};
4522 0 $slash = 'div';
4523 }
4524  
4525 # $', ${'} --> $', ${'}
4526 elsif ($string =~ /\G ( \$' | \$\{'\} ) /oxmsgc) {
4527 0 $e_string .= $1;
4528 0 $slash = 'div';
4529 }
4530  
4531 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> @{[Elatin10::POSTMATCH()]}
4532 elsif ($string =~ /\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /oxmsgc) {
4533 0 $e_string .= q{Elatin10::POSTMATCH()};
4534 0 $slash = 'div';
4535 }
4536  
4537 # bareword
4538 elsif ($string =~ /\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /oxmsgc) {
4539 0 $e_string .= $1;
4540 0 $slash = 'div';
4541 }
4542  
4543 # $0 --> $0
4544 elsif ($string =~ /\G ( \$ 0 ) /oxmsgc) {
4545 0 $e_string .= $1;
4546 0 $slash = 'div';
4547 }
4548 elsif ($string =~ /\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /oxmsgc) {
4549 0 $e_string .= $1;
4550 0 $slash = 'div';
4551 }
4552  
4553 # $$ --> $$
4554 elsif ($string =~ /\G ( \$ \$ ) (?![\w\{]) /oxmsgc) {
4555 0 $e_string .= $1;
4556 0 $slash = 'div';
4557 }
4558  
4559 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
4560 # $1, $2, $3 --> $1, $2, $3 otherwise
4561 elsif ($string =~ /\G \$ ((?>[1-9][0-9]*)) /oxmsgc) {
4562 0 $e_string .= e_capture($1);
4563 0 $slash = 'div';
4564 }
4565 elsif ($string =~ /\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /oxmsgc) {
4566 0 $e_string .= e_capture($1);
4567 0 $slash = 'div';
4568 }
4569  
4570 # $$foo[ ... ] --> $ $foo->[ ... ]
4571 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /oxmsgc) {
4572 0 $e_string .= e_capture($1.'->'.$2);
4573 0 $slash = 'div';
4574 }
4575  
4576 # $$foo{ ... } --> $ $foo->{ ... }
4577 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /oxmsgc) {
4578 0 $e_string .= e_capture($1.'->'.$2);
4579 0 $slash = 'div';
4580 }
4581  
4582 # $$foo
4583 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /oxmsgc) {
4584 0 $e_string .= e_capture($1);
4585 0 $slash = 'div';
4586 }
4587  
4588 # ${ foo }
4589 elsif ($string =~ /\G \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} /oxmsgc) {
4590 0 $e_string .= '${' . $1 . '}';
4591 0 $slash = 'div';
4592 }
4593  
4594 # ${ ... }
4595 elsif ($string =~ /\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /oxmsgc) {
4596 3 $e_string .= e_capture($1);
4597 3 $slash = 'div';
4598 }
4599  
4600 # variable or function
4601 # $ @ % & * $ #
4602 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) {
4603 7 $e_string .= $1;
4604 7 $slash = 'div';
4605 }
4606 # $ $ $ $ $ $ $ $ $ $ $ $ $ $
4607 # $ @ # \ ' " / ? ( ) [ ] < >
4608 elsif ($string =~ /\G ( \$[\$\@\#\\\'\"\/\?\(\)\[\]\<\>] ) /oxmsgc) {
4609 0 $e_string .= $1;
4610 0 $slash = 'div';
4611 }
4612  
4613 # subroutines of package Elatin10
4614 0 elsif ($string =~ /\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /oxgc) { $e_string .= $1; $slash = 'm//'; }
4615 0 elsif ($string =~ /\G \b Char::eval (?= (?>\s*) \{ ) /oxgc) { $e_string .= 'eval'; $slash = 'm//'; }
4616 0 elsif ($string =~ /\G \b Latin10::eval (?= (?>\s*) \{ ) /oxgc) { $e_string .= 'eval'; $slash = 'm//'; }
4617 0 elsif ($string =~ /\G \b Char::eval \b /oxgc) { $e_string .= 'eval Char::escape'; $slash = 'm//'; }
4618 0 elsif ($string =~ /\G \b Latin10::eval \b /oxgc) { $e_string .= 'eval Latin10::escape'; $slash = 'm//'; }
4619 0 elsif ($string =~ /\G \b bytes::substr \b /oxgc) { $e_string .= 'substr'; $slash = 'm//'; }
4620 0 elsif ($string =~ /\G \b chop \b /oxgc) { $e_string .= 'Elatin10::chop'; $slash = 'm//'; }
4621 0 elsif ($string =~ /\G \b bytes::index \b /oxgc) { $e_string .= 'index'; $slash = 'm//'; }
4622 0 elsif ($string =~ /\G \b Char::index \b /oxgc) { $e_string .= 'Char::index'; $slash = 'm//'; }
4623 0 elsif ($string =~ /\G \b Latin10::index \b /oxgc) { $e_string .= 'Latin10::index'; $slash = 'm//'; }
4624 0 elsif ($string =~ /\G \b index \b /oxgc) { $e_string .= 'Elatin10::index'; $slash = 'm//'; }
4625 0 elsif ($string =~ /\G \b bytes::rindex \b /oxgc) { $e_string .= 'rindex'; $slash = 'm//'; }
4626 0 elsif ($string =~ /\G \b Char::rindex \b /oxgc) { $e_string .= 'Char::rindex'; $slash = 'm//'; }
4627 0 elsif ($string =~ /\G \b Latin10::rindex \b /oxgc) { $e_string .= 'Latin10::rindex'; $slash = 'm//'; }
4628 0 elsif ($string =~ /\G \b rindex \b /oxgc) { $e_string .= 'Elatin10::rindex'; $slash = 'm//'; }
4629 0 elsif ($string =~ /\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin10::lc'; $slash = 'm//'; }
4630 0 elsif ($string =~ /\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin10::lcfirst'; $slash = 'm//'; }
4631 0 elsif ($string =~ /\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin10::uc'; $slash = 'm//'; }
4632 0 elsif ($string =~ /\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin10::ucfirst'; $slash = 'm//'; }
4633 0 elsif ($string =~ /\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin10::fc'; $slash = 'm//'; }
4634  
4635 # "-s '' ..." means file test "-s 'filename' ..." (not means "- s/// ...")
4636 0 elsif ($string =~ /\G -s (?>\s*) (\") ((?:$qq_char)+?) (\") /oxgc) { $e_string .= '-s ' . e_qq('', $1,$3,$2); $slash = 'm//'; }
4637 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\#) ((?:$qq_char)+?) (\#) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4638 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4639 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4640 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4641 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4642 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\S) ((?:$qq_char)+?) (\1) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4643  
4644 0 elsif ($string =~ /\G -s (?>\s*) (\') ((?:\\\'|\\\\|$q_char)+?) (\') /oxgc) { $e_string .= '-s ' . e_q ('', $1,$3,$2); $slash = 'm//'; }
4645 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$q_char)+?) (\#) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4646 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4647 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4648 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4649 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4650 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$q_char)+?) (\1) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4651  
4652 elsif ($string =~ /\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)*) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ))*) /oxgc)
4653 0 { $e_string .= "-s $1"; $slash = 'm//'; }
4654 0 elsif ($string =~ /\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /oxgc) { $e_string .= "-s ($1)"; $slash = 'm//'; }
4655 0 elsif ($string =~ /\G -s (?= (?>\s+) [a-z]+) /oxgc) { $e_string .= '-s'; $slash = 'm//'; }
4656 0 elsif ($string =~ /\G -s (?>\s+) ((?>\w+)) /oxgc) { $e_string .= "-s $1"; $slash = 'm//'; }
4657  
4658 0 elsif ($string =~ /\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'length'; $slash = 'm//'; }
4659 0 elsif ($string =~ /\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'chr'; $slash = 'm//'; }
4660 0 elsif ($string =~ /\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin10::chr'; $slash = 'm//'; }
4661 0 elsif ($string =~ /\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'ord'; $slash = 'div'; }
4662 0 elsif ($string =~ /\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= $function_ord; $slash = 'div'; }
4663 0 elsif ($string =~ /\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin10::glob'; $slash = 'm//'; }
4664 0 elsif ($string =~ /\G \b lc \b /oxgc) { $e_string .= 'Elatin10::lc_'; $slash = 'm//'; }
4665 0 elsif ($string =~ /\G \b lcfirst \b /oxgc) { $e_string .= 'Elatin10::lcfirst_'; $slash = 'm//'; }
4666 0 elsif ($string =~ /\G \b uc \b /oxgc) { $e_string .= 'Elatin10::uc_'; $slash = 'm//'; }
4667 0 elsif ($string =~ /\G \b ucfirst \b /oxgc) { $e_string .= 'Elatin10::ucfirst_'; $slash = 'm//'; }
4668 0 elsif ($string =~ /\G \b fc \b /oxgc) { $e_string .= 'Elatin10::fc_'; $slash = 'm//'; }
4669 0 elsif ($string =~ /\G -s \b /oxgc) { $e_string .= '-s '; $slash = 'm//'; }
4670  
4671 0 elsif ($string =~ /\G \b bytes::length \b /oxgc) { $e_string .= 'length'; $slash = 'm//'; }
4672 0 elsif ($string =~ /\G \b bytes::chr \b /oxgc) { $e_string .= 'chr'; $slash = 'm//'; }
4673 0 elsif ($string =~ /\G \b chr \b /oxgc) { $e_string .= 'Elatin10::chr_'; $slash = 'm//'; }
4674 0 elsif ($string =~ /\G \b bytes::ord \b /oxgc) { $e_string .= 'ord'; $slash = 'div'; }
4675 0 elsif ($string =~ /\G \b ord \b /oxgc) { $e_string .= $function_ord_; $slash = 'div'; }
4676 0 elsif ($string =~ /\G \b glob \b /oxgc) { $e_string .= 'Elatin10::glob_'; $slash = 'm//'; }
4677 0 elsif ($string =~ /\G \b reverse \b /oxgc) { $e_string .= $function_reverse; $slash = 'm//'; }
4678 0 elsif ($string =~ /\G \b getc \b /oxgc) { $e_string .= $function_getc; $slash = 'm//'; }
4679 # split
4680 elsif ($string =~ /\G \b (split) \b (?! (?>\s*) => ) /oxgc) {
4681 0 $slash = 'm//';
4682  
4683 0 my $e = '';
4684 0 ▶ while ($string =~ /\G ( (?>\s+) | \( | \#.* ) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G ( (?>\s+) | \( | \#.* ) /cgox) 0 0 0
4685 0 $e .= $1;
4686 }
4687  
4688 # end of split
4689 0 ▶ if ($string =~ /\G (?= [,;\)\}\]] ) /oxgc) { return 'Elatin10::split' . $e; }
Branch: 23 branches
BranchTrueFalseTotal
if ($string =~ /\G (?= [,;\)\}\]] ) /cgox) { } 0 0 0
elsif ($string =~ /\G ( [\$\@\&\*] $qq_scalar ) /cgox) { } 0 0 0
elsif ($string =~ /\G \b qq (\#) [ ] (\#) /cgox) { } 0 0 0
elsif ($string =~ /\G \b qq ((?>\s*)) (\() [ ] (\)) /cgox) { } 0 0 0
elsif ($string =~ /\G \b qq ((?>\s*)) (\{) [ ] (\}) /cgox) { } 0 0 0
elsif ($string =~ /\G \b qq ((?>\s*)) (\[) [ ] (\]) /cgox) { } 0 0 0
elsif ($string =~ /\G \b qq ((?>\s*)) (\<) [ ] (\>) /cgox) { } 0 0 0
elsif ($string =~ /\G \b qq ((?>\s*)) (\S) [ ] (\2) /cgox) { } 0 0 0
elsif ($string =~ /\G \b q (\#) [ ] (\#) /cgox) { } 0 0 0
elsif ($string =~ /\G \b q ((?>\s*)) (\() [ ] (\)) /cgox) { } 0 0 0
elsif ($string =~ /\G \b q ((?>\s*)) (\{) [ ] (\}) /cgox) { } 0 0 0
elsif ($string =~ /\G \b q ((?>\s*)) (\[) [ ] (\]) /cgox) { } 0 0 0
elsif ($string =~ /\G \b q ((?>\s*)) (\<) [ ] (\>) /cgox) { } 0 0 0
elsif ($string =~ /\G \b q ((?>\s*)) (\S) [ ] (\2) /cgox) { } 0 0 0
elsif ($string =~ /\G ' [ ] ' /cgox) { } 0 0 0
elsif ($string =~ /\G " [ ] " /cgox) { } 0 0 0
elsif ($string =~ /\G \b (qq) \b /cgox) { } 0 0 0
elsif ($string =~ /\G \b (qr) \b /cgox) { } 0 0 0
elsif ($string =~ /\G \b (q) \b /cgox) { } 0 0 0
elsif ($string =~ /\G \b (m) \b /cgox) { } 0 0 0
elsif ($string =~ /\G (\') /cgox) { } 0 0 0
elsif ($string =~ /\G (\") /cgox) { } 0 0 0
elsif ($string =~ m[\G (/) ]cgox) { } 0 0 0
4690  
4691 # split scalar value
4692 0 elsif ($string =~ /\G ( [\$\@\&\*] $qq_scalar ) /oxgc) { $e_string .= 'Elatin10::split' . $e . e_string($1); next E_STRING_LOOP; }
4693  
4694 # split literal space
4695 0 elsif ($string =~ /\G \b qq (\#) [ ] (\#) /oxgc) { $e_string .= 'Elatin10::split' . $e . qq {qq$1 $2}; next E_STRING_LOOP; }
4696 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\() [ ] (\)) /oxgc) { $e_string .= 'Elatin10::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4697 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\{) [ ] (\}) /oxgc) { $e_string .= 'Elatin10::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4698 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\[) [ ] (\]) /oxgc) { $e_string .= 'Elatin10::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4699 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\<) [ ] (\>) /oxgc) { $e_string .= 'Elatin10::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4700 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\S) [ ] (\2) /oxgc) { $e_string .= 'Elatin10::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4701 0 elsif ($string =~ /\G \b q (\#) [ ] (\#) /oxgc) { $e_string .= 'Elatin10::split' . $e . qq {q$1 $2}; next E_STRING_LOOP; }
4702 0 elsif ($string =~ /\G \b q ((?>\s*)) (\() [ ] (\)) /oxgc) { $e_string .= 'Elatin10::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4703 0 elsif ($string =~ /\G \b q ((?>\s*)) (\{) [ ] (\}) /oxgc) { $e_string .= 'Elatin10::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4704 0 elsif ($string =~ /\G \b q ((?>\s*)) (\[) [ ] (\]) /oxgc) { $e_string .= 'Elatin10::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4705 0 elsif ($string =~ /\G \b q ((?>\s*)) (\<) [ ] (\>) /oxgc) { $e_string .= 'Elatin10::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4706 0 elsif ($string =~ /\G \b q ((?>\s*)) (\S) [ ] (\2) /oxgc) { $e_string .= 'Elatin10::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4707 0 elsif ($string =~ /\G ' [ ] ' /oxgc) { $e_string .= 'Elatin10::split' . $e . qq {' '}; next E_STRING_LOOP; }
4708 0 elsif ($string =~ /\G " [ ] " /oxgc) { $e_string .= 'Elatin10::split' . $e . qq {" "}; next E_STRING_LOOP; }
4709  
4710 # split qq//
4711 elsif ($string =~ /\G \b (qq) \b /oxgc) {
4712 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Elatin10::qq_char)*?) (\#) /cgox) { } 0 0 0
4713 else {
4714 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4715 0 ▶ if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e_string .= $e . $1; }
Branch: 7 branches
BranchTrueFalseTotal
if ($string =~ /\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /cgox) { } 0 0 0
elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /cgox) { } 0 0 0
elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /cgox) { } 0 0 0
elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /cgox) { } 0 0 0
elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$Elatin10::qq_char)*?) (\1) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Elatin10::qq_char)*?) (\1) /cgox) { } 0 0 0
4716 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq ( ) --> qr ( )
4717 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq { } --> qr { }
4718 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq [ ] --> qr [ ]
4719 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq < > --> qr < >
4720 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= e_split($e.'qr','{','}',$2,''); next E_STRING_LOOP; } # qq | | --> qr { }
4721 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq * * --> qr * *
4722 }
4723 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4724 }
4725 }
4726  
4727 # split qr//
4728 elsif ($string =~ /\G \b (qr) \b /oxgc) {
4729 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1,$3,$2,$4); next E_STRING_LOOP; } # qr# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Elatin10::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 0 0
4730 else {
4731 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4732 0 ▶ if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e_string .= $e . $1; }
Branch: 8 branches
BranchTrueFalseTotal
if ($string =~ /\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\') ((?:$Elatin10::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$Elatin10::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Elatin10::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
4733 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr ( )
4734 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr { }
4735 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr [ ]
4736 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr < >
4737 0 elsif ($string =~ /\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split_q($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr ' '
4738 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr','{','}',$2,$4); next E_STRING_LOOP; } # qr | | --> qr { }
4739 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr * *
4740 }
4741 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4742 }
4743 }
4744  
4745 # split q//
4746 elsif ($string =~ /\G \b (q) \b /oxgc) {
4747 0 ▶ if ($string =~ /\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:\\\#|\\\\|$Elatin10::q_char)*?) (\#) /cgox) { } 0 0 0
4748 else {
4749 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4750 0 ▶ if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e_string .= $e . $1; }
Branch: 7 branches
BranchTrueFalseTotal
if ($string =~ /\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /cgox) { } 0 0 0
elsif ($string =~ /\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /cgox) { } 0 0 0
elsif ($string =~ /\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /cgox) { } 0 0 0
elsif ($string =~ /\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /cgox) { } 0 0 0
elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$Elatin10::q_char)*?) (\1) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:\\\\|\\\1| $Elatin10::q_char)*?) (\1) /cgox) { } 0 0 0
4751 0 elsif ($string =~ /\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q ( ) --> qr ( )
4752 0 elsif ($string =~ /\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q { } --> qr { }
4753 0 elsif ($string =~ /\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q [ ] --> qr [ ]
4754 0 elsif ($string =~ /\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q < > --> qr < >
4755 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$q_char)*?) (\1) /oxgc) { $e_string .= e_split_q($e.'qr','{','}',$2,''); next E_STRING_LOOP; } # q | | --> qr { }
4756 0 elsif ($string =~ /\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q * * --> qr * *
4757 }
4758 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4759 }
4760 }
4761  
4762 # split m//
4763 elsif ($string =~ /\G \b (m) \b /oxgc) {
4764 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1,$3,$2,$4); next E_STRING_LOOP; } # m# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Elatin10::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
4765 else {
4766 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4767 0 ▶ if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e_string .= $e . $1; }
Branch: 8 branches
BranchTrueFalseTotal
if ($string =~ /\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\') ((?:$Elatin10::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$Elatin10::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Elatin10::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
4768 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m ( ) --> qr ( )
4769 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m { } --> qr { }
4770 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m [ ] --> qr [ ]
4771 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m < > --> qr < >
4772 0 elsif ($string =~ /\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split_q($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m ' ' --> qr ' '
4773 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr','{','}',$2,$4); next E_STRING_LOOP; } # m | | --> qr { }
4774 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m * * --> qr * *
4775 }
4776 0 die __FILE__, ": Search pattern not terminated\n";
4777 }
4778 }
4779  
4780 # split ''
4781 elsif ($string =~ /\G (\') /oxgc) {
4782 0 my $q_string = '';
4783 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4784 0 ▶ if ($string =~ /\G (\\\\) /oxgc) { $q_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if ($string =~ /\G (\\\\) /cgox) { } 0 0 0
elsif ($string =~ /\G (\\\') /cgox) { } 0 0 0
elsif ($string =~ /\G \' /cgox) { } 0 0 0
elsif ($string =~ /\G ($Elatin10::q_char) /cgox) { } 0 0 0
4785 0 elsif ($string =~ /\G (\\\') /oxgc) { $q_string .= $1; } # splitqr'' --> split qr''
4786 0 elsif ($string =~ /\G \' /oxgc) { $e_string .= e_split_q($e.q{ qr},"'","'",$q_string,''); next E_STRING_LOOP; } # ' ' --> qr ' '
4787 0 elsif ($string =~ /\G ($q_char) /oxgc) { $q_string .= $1; }
4788 }
4789 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4790 }
4791  
4792 # split ""
4793 elsif ($string =~ /\G (\") /oxgc) {
4794 0 my $qq_string = '';
4795 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4796 0 ▶ if ($string =~ /\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if ($string =~ /\G (\\\\) /cgox) { } 0 0 0
elsif ($string =~ /\G (\\\") /cgox) { } 0 0 0
elsif ($string =~ /\G \" /cgox) { } 0 0 0
elsif ($string =~ /\G ($Elatin10::q_char) /cgox) { } 0 0 0
4797 0 elsif ($string =~ /\G (\\\") /oxgc) { $qq_string .= $1; } # splitqr"" --> split qr""
4798 0 elsif ($string =~ /\G \" /oxgc) { $e_string .= e_split($e.q{ qr},'"','"',$qq_string,''); next E_STRING_LOOP; } # " " --> qr " "
4799 0 elsif ($string =~ /\G ($q_char) /oxgc) { $qq_string .= $1; }
4800 }
4801 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4802 }
4803  
4804 # split //
4805 elsif ($string =~ /\G (\/) /oxgc) {
4806 0 my $regexp = '';
4807 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4808 0 ▶ if ($string =~ /\G (\\\\) /oxgc) { $regexp .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if ($string =~ /\G (\\\\) /cgox) { } 0 0 0
elsif ($string =~ m[\G (\\/) ]cgox) { } 0 0 0
elsif ($string =~ m[\G / ([cgimosxpadlunbB]*) ]cgox) { } 0 0 0
elsif ($string =~ /\G ($Elatin10::q_char) /cgox) { } 0 0 0
4809 0 elsif ($string =~ /\G (\\\/) /oxgc) { $regexp .= $1; } # splitqr// --> split qr//
4810 0 elsif ($string =~ /\G \/ ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split($e.q{ qr}, '/','/',$regexp,$1); next E_STRING_LOOP; } # / / --> qr / /
4811 0 elsif ($string =~ /\G ($q_char) /oxgc) { $regexp .= $1; }
4812 }
4813 0 die __FILE__, ": Search pattern not terminated\n";
4814 }
4815 }
4816  
4817 # qq//
4818 elsif ($string =~ /\G \b (qq) \b /oxgc) {
4819 0 my $ope = $1;
4820 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qq# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Elatin10::qq_char)*?) (\#) /cgox) { } 0 0 0
4821 0 $e_string .= e_qq($ope,$1,$3,$2);
4822 }
4823 else {
4824 0 my $e = '';
4825 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4826 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) ((?:$Elatin10::qq_char)*?) (\1) /cgox) { } 0 0 0
4827 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq ( )
4828 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq { }
4829 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq [ ]
4830 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq < >
4831 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq * *
4832 }
4833 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4834 }
4835 }
4836  
4837 # qx//
4838 elsif ($string =~ /\G \b (qx) \b /oxgc) {
4839 0 my $ope = $1;
4840 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qx# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Elatin10::qq_char)*?) (\#) /cgox) { } 0 0 0
4841 0 $e_string .= e_qq($ope,$1,$3,$2);
4842 }
4843 else {
4844 0 my $e = '';
4845 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4846 0 ▶ if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 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 (\') ((?:$Elatin10::qq_char)*?) (\') /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Elatin10::qq_char)*?) (\1) /cgox) { } 0 0 0
4847 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx ( )
4848 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx { }
4849 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx [ ]
4850 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx < >
4851 0 elsif ($string =~ /\G (\') ((?:$qq_char)*?) (\') /oxgc) { $e_string .= $e . e_q ($ope,$1,$3,$2); next E_STRING_LOOP; } # qx ' '
4852 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx * *
4853 }
4854 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4855 }
4856 }
4857  
4858 # q//
4859 elsif ($string =~ /\G \b (q) \b /oxgc) {
4860 0 my $ope = $1;
4861 0 ▶ if ($string =~ /\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { # q# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:\\\#|\\\\|$Elatin10::q_char)*?) (\#) /cgox) { } 0 0 0
4862 0 $e_string .= e_q($ope,$1,$3,$2);
4863 }
4864 else {
4865 0 my $e = '';
4866 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4867 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| $Elatin10::q_char)*?) (\1) /cgox) { } 0 0 0
4868 0 elsif ($string =~ /\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q ( )
4869 0 elsif ($string =~ /\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q { }
4870 0 elsif ($string =~ /\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q [ ]
4871 0 elsif ($string =~ /\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q < >
4872 0 elsif ($string =~ /\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q * *
4873 }
4874 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4875 }
4876 }
4877  
4878 # ''
4879 0 elsif ($string =~ /\G (?<![\w\$\@\%\&\*]) (\') ((?:\\\'|\\\\|$q_char)*?) (\') /oxgc) { $e_string .= e_q('',$1,$3,$2); }
4880  
4881 # ""
4882 0 elsif ($string =~ /\G (\") ((?:$qq_char)*?) (\") /oxgc) { $e_string .= e_qq('',$1,$3,$2); }
4883  
4884 # ``
4885 0 elsif ($string =~ /\G (\`) ((?:$qq_char)*?) (\`) /oxgc) { $e_string .= e_qq('',$1,$3,$2); }
4886  
4887 # <<>> (a safer ARGV)
4888 0 elsif ($string =~ /\G ( <<>> ) /oxgc) { $e_string .= $1; }
4889  
4890 # <<= <=> <= < operator
4891 0 elsif ($string =~ /\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/oxgc) { $e_string .= $1; }
4892  
4893 # <FILEHANDLE>
4894 0 elsif ($string =~ /\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /oxgc) { $e_string .= $1; }
4895  
4896 # <WILDCARD> --- glob
4897 elsif ($string =~ /\G < ((?:$q_char)+?) > /oxgc) {
4898 0 $e_string .= 'Elatin10::glob("' . $1 . '")';
4899 }
4900  
4901 # << (bit shift) --- not here document
4902 elsif ($string =~ /\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /oxgc) {
4903 0 $slash = 'm//';
4904 0 $e_string .= $1;
4905 }
4906  
4907 # <<~'HEREDOC'
4908 elsif ($string =~ /\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /oxgc) {
4909 0 $slash = 'm//';
4910 0 my $here_quote = $1;
4911 0 my $delimiter = $2;
4912  
4913 # get here document
4914 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4915 0 $here_script = CORE::substr $_, pos $_;
4916 0 $here_script =~ s/.*?\n//oxm;
4917 }
4918 0 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 0 0 0
4919 0 my $heredoc = $1;
4920 0 my $indent = $2;
4921 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4922 0 push @heredoc, $heredoc . qq{\n$delimiter\n};
4923 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4924 }
4925 else {
4926 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4927 }
4928 0 $e_string .= qq{<<'$delimiter'};
4929 }
4930  
4931 # <<~\HEREDOC
4932 elsif ($string =~ /\G ( <<~ \\([a-zA-Z_0-9]+) ) /oxgc) {
4933 0 $slash = 'm//';
4934 0 my $here_quote = $1;
4935 0 my $delimiter = $2;
4936  
4937 # get here document
4938 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4939 0 $here_script = CORE::substr $_, pos $_;
4940 0 $here_script =~ s/.*?\n//oxm;
4941 }
4942 0 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 0 0 0
4943 0 my $heredoc = $1;
4944 0 my $indent = $2;
4945 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4946 0 push @heredoc, $heredoc . qq{\n$delimiter\n};
4947 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4948 }
4949 else {
4950 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4951 }
4952 0 $e_string .= qq{<<\\$delimiter};
4953 }
4954  
4955 # <<~"HEREDOC"
4956 elsif ($string =~ /\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /oxgc) {
4957 0 $slash = 'm//';
4958 0 my $here_quote = $1;
4959 0 my $delimiter = $2;
4960  
4961 # get here document
4962 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4963 0 $here_script = CORE::substr $_, pos $_;
4964 0 $here_script =~ s/.*?\n//oxm;
4965 }
4966 0 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 0 0 0
4967 0 my $heredoc = $1;
4968 0 my $indent = $2;
4969 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4970 0 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4971 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4972 }
4973 else {
4974 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4975 }
4976 0 $e_string .= qq{<<"$delimiter"};
4977 }
4978  
4979 # <<~HEREDOC
4980 elsif ($string =~ /\G ( <<~ ([a-zA-Z_0-9]+) ) /oxgc) {
4981 0 $slash = 'm//';
4982 0 my $here_quote = $1;
4983 0 my $delimiter = $2;
4984  
4985 # get here document
4986 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4987 0 $here_script = CORE::substr $_, pos $_;
4988 0 $here_script =~ s/.*?\n//oxm;
4989 }
4990 0 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 0 0 0
4991 0 my $heredoc = $1;
4992 0 my $indent = $2;
4993 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4994 0 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4995 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4996 }
4997 else {
4998 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4999 }
5000 0 $e_string .= qq{<<$delimiter};
5001 }
5002  
5003 # <<~`HEREDOC`
5004 elsif ($string =~ /\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /oxgc) {
5005 0 $slash = 'm//';
5006 0 my $here_quote = $1;
5007 0 my $delimiter = $2;
5008  
5009 # get here document
5010 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5011 0 $here_script = CORE::substr $_, pos $_;
5012 0 $here_script =~ s/.*?\n//oxm;
5013 }
5014 0 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 0 0 0
5015 0 my $heredoc = $1;
5016 0 my $indent = $2;
5017 0 $heredoc =~ s{^$indent}{}msg; # no /ox
5018 0 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
5019 0 push @heredoc_delimiter, qq{\\s*$delimiter};
5020 }
5021 else {
5022 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5023 }
5024 0 $e_string .= qq{<<`$delimiter`};
5025 }
5026  
5027 # <<'HEREDOC'
5028 elsif ($string =~ /\G ( << '([a-zA-Z_0-9]*)' ) /oxgc) {
5029 0 $slash = 'm//';
5030 0 my $here_quote = $1;
5031 0 my $delimiter = $2;
5032  
5033 # get here document
5034 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5035 0 $here_script = CORE::substr $_, pos $_;
5036 0 $here_script =~ s/.*?\n//oxm;
5037 }
5038 0 ▶ if ($here_script =~ s/\A (.*?) \n $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n $delimiter \n //msx) { } 0 0 0
5039 0 push @heredoc, $1 . qq{\n$delimiter\n};
5040 0 push @heredoc_delimiter, $delimiter;
5041 }
5042 else {
5043 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5044 }
5045 0 $e_string .= $here_quote;
5046 }
5047  
5048 # <<\HEREDOC
5049 elsif ($string =~ /\G ( << \\([a-zA-Z_0-9]+) ) /oxgc) {
5050 0 $slash = 'm//';
5051 0 my $here_quote = $1;
5052 0 my $delimiter = $2;
5053  
5054 # get here document
5055 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5056 0 $here_script = CORE::substr $_, pos $_;
5057 0 $here_script =~ s/.*?\n//oxm;
5058 }
5059 0 ▶ if ($here_script =~ s/\A (.*?) \n $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n $delimiter \n //msx) { } 0 0 0
5060 0 push @heredoc, $1 . qq{\n$delimiter\n};
5061 0 push @heredoc_delimiter, $delimiter;
5062 }
5063 else {
5064 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5065 }
5066 0 $e_string .= $here_quote;
5067 }
5068  
5069 # <<"HEREDOC"
5070 elsif ($string =~ /\G ( << "([a-zA-Z_0-9]*)" ) /oxgc) {
5071 0 $slash = 'm//';
5072 0 my $here_quote = $1;
5073 0 my $delimiter = $2;
5074  
5075 # get here document
5076 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5077 0 $here_script = CORE::substr $_, pos $_;
5078 0 $here_script =~ s/.*?\n//oxm;
5079 }
5080 0 ▶ if ($here_script =~ s/\A (.*?) \n $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n $delimiter \n //msx) { } 0 0 0
5081 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
5082 0 push @heredoc_delimiter, $delimiter;
5083 }
5084 else {
5085 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5086 }
5087 0 $e_string .= $here_quote;
5088 }
5089  
5090 # <<HEREDOC
5091 elsif ($string =~ /\G ( << ([a-zA-Z_0-9]+) ) /oxgc) {
5092 0 $slash = 'm//';
5093 0 my $here_quote = $1;
5094 0 my $delimiter = $2;
5095  
5096 # get here document
5097 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5098 0 $here_script = CORE::substr $_, pos $_;
5099 0 $here_script =~ s/.*?\n//oxm;
5100 }
5101 0 ▶ if ($here_script =~ s/\A (.*?) \n $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n $delimiter \n //msx) { } 0 0 0
5102 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
5103 0 push @heredoc_delimiter, $delimiter;
5104 }
5105 else {
5106 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5107 }
5108 0 $e_string .= $here_quote;
5109 }
5110  
5111 # <<`HEREDOC`
5112 elsif ($string =~ /\G ( << `([a-zA-Z_0-9]*)` ) /oxgc) {
5113 0 $slash = 'm//';
5114 0 my $here_quote = $1;
5115 0 my $delimiter = $2;
5116  
5117 # get here document
5118 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5119 0 $here_script = CORE::substr $_, pos $_;
5120 0 $here_script =~ s/.*?\n//oxm;
5121 }
5122 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
5123 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
5124 0 push @heredoc_delimiter, $delimiter;
5125 }
5126 else {
5127 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5128 }
5129 0 $e_string .= $here_quote;
5130 }
5131  
5132 # any operator before div
5133 elsif ($string =~ /\G (
5134 -- | \+\+ |
5135 [\)\}\]]
5136  
5137 18 ) /oxgc) { $slash = 'div'; $e_string .= $1; }
5138  
5139 # yada-yada or triple-dot operator
5140 elsif ($string =~ /\G (
5141 \.\.\.
5142  
5143 0 ) /oxgc) { $slash = 'm//'; $e_string .= q{die('Unimplemented')}; }
5144  
5145 # any operator before m//
5146 elsif ($string =~ /\G ((?>
5147  
5148 !~~ | !~ | != | ! |
5149 %= | % |
5150 &&= | && | &= | &\.= | &\. | & |
5151 -= | -> | - |
5152 :(?>\s*)= |
5153 : |
5154 <<>> |
5155 <<= | <=> | <= | < |
5156 == | => | =~ | = |
5157 >>= | >> | >= | > |
5158 \*\*= | \*\* | \*= | \* |
5159 \+= | \+ |
5160 \.\. | \.= | \. |
5161 \/\/= | \/\/ |
5162 \/= | \/ |
5163 \? |
5164 \\ |
5165 \^= | \^\.= | \^\. | \^ |
5166 \b x= |
5167 \|\|= | \|\| | \|= | \|\.= | \|\. | \| |
5168 ~~ | ~\. | ~ |
5169 \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b |
5170 \b(?: print )\b |
5171  
5172 [,;\(\{\[]
5173  
5174 31 )) /oxgc) { $slash = 'm//'; $e_string .= $1; }
5175  
5176 # other any character
5177 131 elsif ($string =~ /\G ($q_char) /oxgc) { $e_string .= $1; }
5178  
5179 # system error
5180 else {
5181 0 die __FILE__, ": Oops, this shouldn't happen!\n";
5182 }
5183 }
5184  
5185 17 return $e_string;
5186 }
5187  
5188 #
5189 # character class
5190 #
5191 1920 ▶sub character_class {
Subroutine character_class: called CC=3 SCAR=11.0
Pod undocumented
5192 1920 my($char,$modifier) = @_;
5193  
5194 1920 ▶ if ($char eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char eq '.') { } 52 1868 1920
5195 52 ▶ if ($modifier =~ /s/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/) { } 17 35 52
5196 17 return '${Elatin10::dot_s}';
5197 }
5198 else {
5199 35 return '${Elatin10::dot}';
5200 }
5201 }
5202 else {
5203 1868 return Elatin10::classic_character_class($char);
5204 }
5205 }
5206  
5207 #
5208 # escape capture ($1, $2, $3, ...)
5209 #
5210 212 ▶sub e_capture {
Subroutine e_capture: called CC=1 SCAR=0.0
Pod undocumented
5211  
5212 212 return join '', '${', $_[0], '}';
5213 }
5214  
5215 #
5216 # escape transliteration (tr/// or y///)
5217 #
5218 4 ▶sub e_tr {
Subroutine e_tr: called CC=5 SCAR=16.8
Pod undocumented
5219 4 my($variable,$charclass,$e,$charclass2,$modifier) = @_;
5220 4 my $e_tr = '';
5221 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
5222  
5223 4 $slash = 'div';
5224  
5225 # quote character class 1
5226 4 $charclass = q_tr($charclass);
5227  
5228 # quote character class 2
5229 4 $charclass2 = q_tr($charclass2);
5230  
5231 # /b /B modifier
5232 4 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) { } 0 4 4
5233 0 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq '') { } 0 0 0
5234 0 $e_tr = qq{tr$charclass$e$charclass2$modifier};
5235 }
5236 else {
5237 0 $e_tr = qq{$variable${bind_operator}tr$charclass$e$charclass2$modifier};
5238 }
5239 }
5240 else {
5241 4 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq '') { } 2 2 4
5242 2 $e_tr = qq{Elatin10::tr(\$_,' =~ ',$charclass,$e$charclass2,'$modifier')};
5243 }
5244 else {
5245 2 $e_tr = qq{Elatin10::tr($variable,'$bind_operator',$charclass,$e$charclass2,'$modifier')};
5246 }
5247 }
5248  
5249 # clear tr/// variable
5250 4 $tr_variable = '';
5251 4 $bind_operator = '';
5252  
5253 4 return $e_tr;
5254 }
5255  
5256 #
5257 # quote for escape transliteration (tr/// or y///)
5258 #
5259 8 ▶sub q_tr {
Subroutine q_tr: called CC=9 SCAR=40.6
Pod undocumented
5260 8 my($charclass) = @_;
5261  
5262 # quote character class
5263 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
5264 8 return e_q('', "'", "'", $charclass); # --> q' '
5265 }
5266 elsif ($charclass !~ /\//oxms) {
5267 0 return e_q('q', '/', '/', $charclass); # --> q/ /
5268 }
5269 elsif ($charclass !~ /\#/oxms) {
5270 0 return e_q('q', '#', '#', $charclass); # --> q# #
5271 }
5272 elsif ($charclass !~ /[\<\>]/oxms) {
5273 0 return e_q('q', '<', '>', $charclass); # --> q< >
5274 }
5275 elsif ($charclass !~ /[\(\)]/oxms) {
5276 0 return e_q('q', '(', ')', $charclass); # --> q( )
5277 }
5278 elsif ($charclass !~ /[\{\}]/oxms) {
5279 0 return e_q('q', '{', '}', $charclass); # --> q{ }
5280 }
5281 else {
5282 0 for my $char (qw( ! " $ % & * + . : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5283 0 ▶ if ($charclass !~ /\Q$char\E/xms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($charclass =~ /\Q$char\E/msx) 0 0 0
5284 0 return e_q('q', $char, $char, $charclass);
5285 }
5286 }
5287 }
5288  
5289 0 return e_q('q', '{', '}', $charclass);
5290 }
5291  
5292 #
5293 # escape q string (q//, '')
5294 #
5295 1623 ▶sub e_q {
Subroutine e_q: called CC=1 SCAR=0.0
Pod undocumented
5296 1623 my($ope,$delimiter,$end_delimiter,$string) = @_;
5297  
5298 1623 $slash = 'div';
5299  
5300 1623 return join '', $ope, $delimiter, $string, $end_delimiter;
5301 }
5302  
5303 #
5304 # escape qq string (qq//, "", qx//, ``)
5305 #
5306 4261 ▶sub e_qq {
Subroutine e_qq: called CC=37 SCAR=50.9
Pod undocumented
5307 4261 my($ope,$delimiter,$end_delimiter,$string) = @_;
5308  
5309 4261 $slash = 'div';
5310  
5311 4261 my $left_e = 0;
5312 4261 my $right_e = 0;
5313  
5314 # split regexp
5315 4261 my @char = $string =~ /\G((?>
5316 [^\\\$] |
5317 \\x\{ (?>[0-9A-Fa-f]+) \} |
5318 \\o\{ (?>[0-7]+) \} |
5319 \\N\{ (?>[^0-9\}][^\}]*) \} |
5320 \\ $q_char |
5321 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5322 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5323 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5324 \$ (?>\s* [0-9]+) |
5325 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5326 \$ \$ (?![\w\{]) |
5327 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5328 $q_char
5329 ))/oxmsg;
5330  
5331 4261 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 116998 4261 121259
5332  
5333 # "\L\u" --> "\u\L"
5334 116998 ▶ 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 116998 116998
elsif ($char[$i] eq '\\U' and $char[$i + 1] eq '\\l') { } 0 116998 116998
elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/mosx) { } 1 116997 116998
elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/mosx) { } 1 116996 116997
elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/mosx) { } 0 116996 116996
Condition33%1/3
$char[$i] eq "\\L" and $char[$i + 1] eq "\\u"
!ll&&!rl&&r
11699800
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
5335 0 @char[$i,$i+1] = @char[$i+1,$i];
5336 }
5337  
5338 # "\U\l" --> "\l\U"
5339 ▶ 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
11699800
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
5340 0 @char[$i,$i+1] = @char[$i+1,$i];
5341 }
5342  
5343 # octal escape sequence
5344 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5345 1 $char[$i] = Elatin10::octchr($1);
5346 }
5347  
5348 # hexadecimal escape sequence
5349 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5350 1 $char[$i] = Elatin10::hexchr($1);
5351 }
5352  
5353 # \N{CHARNAME} --> N{CHARNAME}
5354 elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5355 0 $char[$i] = $1;
5356 }
5357  
5358 116998 ▶ if (0) {
Branch: 23 branches
BranchTrueFalseTotal
if (do { $char[$i] =~ /\A ([<>]) \z/mosx }) { } 484 116514 116998
elsif ($char[$i] eq '\\u') { } 0 116514 116514
elsif ($char[$i] eq '\\l') { } 0 116514 116514
elsif ($char[$i] eq '\\U') { } 0 116514 116514
elsif ($char[$i] eq '\\L') { } 0 116514 116514
elsif ($char[$i] eq '\\F') { } 24 116490 116514
elsif ($char[$i] eq '\\Q') { } 0 116490 116490
elsif ($char[$i] eq '\\E') { } 24 116466 116490
elsif ($char[$i] eq '\\Q') { } 0 116466 116466
elsif ($char[$i] eq '\\E') { } 0 116466 116466
elsif ($char[$i] =~ /\A \$ 0 \z/mosx) { } 4 116462 116466
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/mosx) { } 0 116462 116462
elsif ($char[$i] =~ /\A \$\$ \z/mosx) { } 0 116462 116462
elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/mosx) { } 205 116257 116462
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/mosx) { } 0 116257 116257
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/mosx) { } 0 116257 116257
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/mosx) { } 0 116257 116257
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/mosx) { } 0 116257 116257
elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/cgmosx) { } 44 116213 116257
elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/cgmosx) { } 45 116168 116213
elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/cgmosx) { } 33 116135 116168
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/mosx) { } 0 116135 116135
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/mosx) { } 0 116135 116135
5359 }
5360  
5361 # \F
5362 #
5363 # P.69 Table 2-6. Translation escapes
5364 # in Chapter 2: Bits and Pieces
5365 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
5366 # (and so on)
5367  
5368 # \u \l \U \L \F \Q \E
5369 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
5370 484 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 484 484
5371 0 $char[$i] = '\\' . $char[$i];
5372 }
5373 }
5374 elsif ($char[$i] eq '\u') {
5375  
5376 # "STRING @{[ LIST EXPR ]} MORE STRING"
5377  
5378 # P.257 Other Tricks You Can Do with Hard References
5379 # in Chapter 8: References
5380 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
5381  
5382 # P.353 Other Tricks You Can Do with Hard References
5383 # in Chapter 8: References
5384 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
5385  
5386 # (and so on)
5387  
5388 0 $char[$i] = '@{[Elatin10::ucfirst qq<';
5389 0 $left_e++;
5390 }
5391 elsif ($char[$i] eq '\l') {
5392 0 $char[$i] = '@{[Elatin10::lcfirst qq<';
5393 0 $left_e++;
5394 }
5395 elsif ($char[$i] eq '\U') {
5396 0 $char[$i] = '@{[Elatin10::uc qq<';
5397 0 $left_e++;
5398 }
5399 elsif ($char[$i] eq '\L') {
5400 0 $char[$i] = '@{[Elatin10::lc qq<';
5401 0 $left_e++;
5402 }
5403 elsif ($char[$i] eq '\F') {
5404 24 $char[$i] = '@{[Elatin10::fc qq<';
5405 24 $left_e++;
5406 }
5407 elsif ($char[$i] eq '\Q') {
5408 0 $char[$i] = '@{[CORE::quotemeta qq<';
5409 0 $left_e++;
5410 }
5411 elsif ($char[$i] eq '\E') {
5412 24 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 24 0 24
5413 24 $char[$i] = '>]}';
5414 24 $right_e++;
5415 }
5416 else {
5417 0 $char[$i] = '';
5418 }
5419 }
5420 elsif ($char[$i] eq '\Q') {
5421 0 while (1) {
5422 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5423 0 last;
5424 }
5425 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
5426 0 last;
5427 }
5428 }
5429 }
5430 elsif ($char[$i] eq '\E') {
5431 }
5432  
5433 # $0 --> $0
5434 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
5435 }
5436 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
5437 }
5438  
5439 # $$ --> $$
5440 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
5441 }
5442  
5443 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
5444 # $1, $2, $3 --> $1, $2, $3 otherwise
5445 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
5446 205 $char[$i] = e_capture($1);
5447 }
5448 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
5449 0 $char[$i] = e_capture($1);
5450 }
5451  
5452 # $$foo[ ... ] --> $ $foo->[ ... ]
5453 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
5454 0 $char[$i] = e_capture($1.'->'.$2);
5455 }
5456  
5457 # $$foo{ ... } --> $ $foo->{ ... }
5458 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
5459 0 $char[$i] = e_capture($1.'->'.$2);
5460 }
5461  
5462 # $$foo
5463 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
5464 0 $char[$i] = e_capture($1);
5465 }
5466  
5467 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin10::PREMATCH()
5468 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
5469 44 $char[$i] = '@{[Elatin10::PREMATCH()]}';
5470 }
5471  
5472 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin10::MATCH()
5473 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
5474 45 $char[$i] = '@{[Elatin10::MATCH()]}';
5475 }
5476  
5477 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin10::POSTMATCH()
5478 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
5479 33 $char[$i] = '@{[Elatin10::POSTMATCH()]}';
5480 }
5481  
5482 # ${ foo } --> ${ foo }
5483 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/oxms) {
5484 }
5485  
5486 # ${ ... }
5487 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5488 0 $char[$i] = e_capture($1);
5489 }
5490 }
5491  
5492 # return string
5493 4261 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 4261 4261
5494 0 return join '', $ope, $delimiter, @char, '>]}' x ($left_e - $right_e), $end_delimiter;
5495 }
5496 4261 return join '', $ope, $delimiter, @char, $end_delimiter;
5497 }
5498  
5499 #
5500 # escape qw string (qw//)
5501 #
5502 16 ▶sub e_qw {
Subroutine e_qw: called CC=11 SCAR=43.1
Pod undocumented
5503 16 my($ope,$delimiter,$end_delimiter,$string) = @_;
5504  
5505 16 $slash = 'div';
5506  
5507 # choice again delimiter
5508 16 my %octet = map {$_ => 1} ($string =~ /\G ([\x00-\xFF]) /oxmsg);
5509 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
5510 16 return join '', $ope, $delimiter, $string, $end_delimiter;
5511 }
5512 elsif (not $octet{')'}) {
5513 0 return join '', $ope, '(', $string, ')';
5514 }
5515 elsif (not $octet{'}'}) {
5516 0 return join '', $ope, '{', $string, '}';
5517 }
5518 elsif (not $octet{']'}) {
5519 0 return join '', $ope, '[', $string, ']';
5520 }
5521 elsif (not $octet{'>'}) {
5522 0 return join '', $ope, '<', $string, '>';
5523 }
5524 else {
5525 0 for my $char (qw( ! " $ % & * + - . / : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5526 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5527 0 return join '', $ope, $char, $string, $char;
5528 }
5529 }
5530 }
5531  
5532 # qw/AAA BBB C'CC/ --> ('AAA', 'BBB', 'C\'CC')
5533 0 my @string = CORE::split(/\s+/, $string);
5534 0 for my $string (@string) {
5535 0 my @octet = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5536 0 for my $octet (@octet) {
5537 0 ▶ if ($octet =~ /\A (['\\]) \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($octet =~ /\A (['\\]) \z/mosx) 0 0 0
5538 0 $octet = '\\' . $1;
5539 }
5540 }
5541 0 $string = join '', @octet;
5542 }
5543 0 return join '', '(', (join ', ', map { "'$_'" } @string), ')';
5544 }
5545  
5546 #
5547 # escape here document (<<"HEREDOC", <<HEREDOC, <<`HEREDOC`, <<~"HEREDOC", <<~HEREDOC, <<~`HEREDOC`)
5548 #
5549 93 ▶sub e_heredoc {
Subroutine e_heredoc: called CC=37 SCAR=56.3
Pod undocumented
5550 93 my($string) = @_;
5551  
5552 93 $slash = 'm//';
5553  
5554 93 my $metachar = qr/[\@\\|]/oxms; # '|' is for <<`HEREDOC`
5555  
5556 93 my $left_e = 0;
5557 93 my $right_e = 0;
5558  
5559 # split regexp
5560 93 my @char = $string =~ /\G((?>
5561 [^\\\$] |
5562 \\x\{ (?>[0-9A-Fa-f]+) \} |
5563 \\o\{ (?>[0-7]+) \} |
5564 \\N\{ (?>[^0-9\}][^\}]*) \} |
5565 \\ $q_char |
5566 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5567 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5568 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5569 \$ (?>\s* [0-9]+) |
5570 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5571 \$ \$ (?![\w\{]) |
5572 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5573 $q_char
5574 ))/oxmsg;
5575  
5576 93 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 3203 93 3296
5577  
5578 # "\L\u" --> "\u\L"
5579 3203 ▶ 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 3203 3203
elsif ($char[$i] eq '\\U' and $char[$i + 1] eq '\\l') { } 0 3203 3203
elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/mosx) { } 1 3202 3203
elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/mosx) { } 1 3201 3202
elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/mosx) { } 0 3201 3201
Condition33%1/3
$char[$i] eq "\\L" and $char[$i + 1] eq "\\u"
!ll&&!rl&&r
320300
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
5580 0 @char[$i,$i+1] = @char[$i+1,$i];
5581 }
5582  
5583 # "\U\l" --> "\l\U"
5584 ▶ 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
320300
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
5585 0 @char[$i,$i+1] = @char[$i+1,$i];
5586 }
5587  
5588 # octal escape sequence
5589 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5590 1 $char[$i] = Elatin10::octchr($1);
5591 }
5592  
5593 # hexadecimal escape sequence
5594 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5595 1 $char[$i] = Elatin10::hexchr($1);
5596 }
5597  
5598 # \N{CHARNAME} --> N{CHARNAME}
5599 elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5600 0 $char[$i] = $1;
5601 }
5602  
5603 3203 ▶ if (0) {
Branch: 23 branches
BranchTrueFalseTotal
if (do { $char[$i] =~ /\A ([<>]) \z/mosx }) { } 0 3203 3203
elsif ($char[$i] eq '\\u') { } 0 3203 3203
elsif ($char[$i] eq '\\l') { } 0 3203 3203
elsif ($char[$i] eq '\\U') { } 0 3203 3203
elsif ($char[$i] eq '\\L') { } 0 3203 3203
elsif ($char[$i] eq '\\F') { } 0 3203 3203
elsif ($char[$i] eq '\\Q') { } 0 3203 3203
elsif ($char[$i] eq '\\E') { } 0 3203 3203
elsif ($char[$i] eq '\\Q') { } 0 3203 3203
elsif ($char[$i] eq '\\E') { } 0 3203 3203
elsif ($char[$i] =~ /\A \$ 0 \z/mosx) { } 0 3203 3203
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/mosx) { } 0 3203 3203
elsif ($char[$i] =~ /\A \$\$ \z/mosx) { } 0 3203 3203
elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/mosx) { } 0 3203 3203
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/mosx) { } 0 3203 3203
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/mosx) { } 0 3203 3203
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/mosx) { } 0 3203 3203
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/mosx) { } 0 3203 3203
elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/cgmosx) { } 8 3195 3203
elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/cgmosx) { } 8 3187 3195
elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/cgmosx) { } 6 3181 3187
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/mosx) { } 0 3181 3181
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/mosx) { } 0 3181 3181
5604 }
5605  
5606 # \u \l \U \L \F \Q \E
5607 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
5608 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
5609 0 $char[$i] = '\\' . $char[$i];
5610 }
5611 }
5612 elsif ($char[$i] eq '\u') {
5613 0 $char[$i] = '@{[Elatin10::ucfirst qq<';
5614 0 $left_e++;
5615 }
5616 elsif ($char[$i] eq '\l') {
5617 0 $char[$i] = '@{[Elatin10::lcfirst qq<';
5618 0 $left_e++;
5619 }
5620 elsif ($char[$i] eq '\U') {
5621 0 $char[$i] = '@{[Elatin10::uc qq<';
5622 0 $left_e++;
5623 }
5624 elsif ($char[$i] eq '\L') {
5625 0 $char[$i] = '@{[Elatin10::lc qq<';
5626 0 $left_e++;
5627 }
5628 elsif ($char[$i] eq '\F') {
5629 0 $char[$i] = '@{[Elatin10::fc qq<';
5630 0 $left_e++;
5631 }
5632 elsif ($char[$i] eq '\Q') {
5633 0 $char[$i] = '@{[CORE::quotemeta qq<';
5634 0 $left_e++;
5635 }
5636 elsif ($char[$i] eq '\E') {
5637 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
5638 0 $char[$i] = '>]}';
5639 0 $right_e++;
5640 }
5641 else {
5642 0 $char[$i] = '';
5643 }
5644 }
5645 elsif ($char[$i] eq '\Q') {
5646 0 while (1) {
5647 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5648 0 last;
5649 }
5650 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
5651 0 last;
5652 }
5653 }
5654 }
5655 elsif ($char[$i] eq '\E') {
5656 }
5657  
5658 # $0 --> $0
5659 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
5660 }
5661 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
5662 }
5663  
5664 # $$ --> $$
5665 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
5666 }
5667  
5668 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
5669 # $1, $2, $3 --> $1, $2, $3 otherwise
5670 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
5671 0 $char[$i] = e_capture($1);
5672 }
5673 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
5674 0 $char[$i] = e_capture($1);
5675 }
5676  
5677 # $$foo[ ... ] --> $ $foo->[ ... ]
5678 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
5679 0 $char[$i] = e_capture($1.'->'.$2);
5680 }
5681  
5682 # $$foo{ ... } --> $ $foo->{ ... }
5683 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
5684 0 $char[$i] = e_capture($1.'->'.$2);
5685 }
5686  
5687 # $$foo
5688 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
5689 0 $char[$i] = e_capture($1);
5690 }
5691  
5692 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin10::PREMATCH()
5693 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
5694 8 $char[$i] = '@{[Elatin10::PREMATCH()]}';
5695 }
5696  
5697 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin10::MATCH()
5698 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
5699 8 $char[$i] = '@{[Elatin10::MATCH()]}';
5700 }
5701  
5702 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin10::POSTMATCH()
5703 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
5704 6 $char[$i] = '@{[Elatin10::POSTMATCH()]}';
5705 }
5706  
5707 # ${ foo } --> ${ foo }
5708 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/oxms) {
5709 }
5710  
5711 # ${ ... }
5712 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5713 0 $char[$i] = e_capture($1);
5714 }
5715 }
5716  
5717 # return string
5718 93 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 93 93
5719 0 return join '', @char, '>]}' x ($left_e - $right_e);
5720 }
5721 93 return join '', @char;
5722 }
5723  
5724 #
5725 # escape regexp (m//, qr//)
5726 #
5727 880 ▶sub e_qr {
Subroutine e_qr: called CC=110 SCAR=73.6
Pod undocumented
5728 880 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5729 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
5730  
5731 880 $modifier =~ tr/p//d;
5732 880 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 880 880
5733 0 my $line = 0;
5734 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
5735 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
5736 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
5737 0 last;
5738 }
5739 }
5740 0 die qq{Unsupported modifier "$1" used at line $line.\n};
5741 }
5742  
5743 880 $slash = 'div';
5744  
5745 # literal null string pattern
5746 880 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 872 880
elsif ($modifier =~ tr/Bb//d) { } 2 870 872
5747 8 $modifier =~ tr/bB//d;
5748 8 $modifier =~ tr/i//d;
5749 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
5750 }
5751  
5752 # /b /B modifier
5753 elsif ($modifier =~ tr/bB//d) {
5754  
5755 # choice again delimiter
5756 2 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 2 2
5757 0 my @char = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5758 0 my %octet = map {$_ => 1} @char;
5759 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
5760 0 $delimiter = '(';
5761 0 $end_delimiter = ')';
5762 }
5763 elsif (not $octet{'}'}) {
5764 0 $delimiter = '{';
5765 0 $end_delimiter = '}';
5766 }
5767 elsif (not $octet{']'}) {
5768 0 $delimiter = '[';
5769 0 $end_delimiter = ']';
5770 }
5771 elsif (not $octet{'>'}) {
5772 0 $delimiter = '<';
5773 0 $end_delimiter = '>';
5774 }
5775 else {
5776 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5777 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5778 0 $delimiter = $char;
5779 0 $end_delimiter = $char;
5780 0 last;
5781 }
5782 }
5783 }
5784 }
5785  
5786 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
5787 0 return join '', $ope, $delimiter, $string, $matched, $end_delimiter, $modifier;
5788 }
5789 else {
5790 2 return join '', $ope, $delimiter, '(?:', $string, ')', $matched, $end_delimiter, $modifier;
5791 }
5792 }
5793  
5794 870 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 312 558 870
5795 870 my $metachar = qr/[\@\\|[\]{^]/oxms;
5796  
5797 # split regexp
5798 870 my @char = $string =~ /\G((?>
5799 [^\\\$\@\[\(] |
5800 \\x (?>[0-9A-Fa-f]{1,2}) |
5801 \\ (?>[0-7]{2,3}) |
5802 \\c [\x40-\x5F] |
5803 \\x\{ (?>[0-9A-Fa-f]+) \} |
5804 \\o\{ (?>[0-7]+) \} |
5805 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
5806 \\ $q_char |
5807 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5808 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5809 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5810 [\$\@] $qq_variable |
5811 \$ (?>\s* [0-9]+) |
5812 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5813 \$ \$ (?![\w\{]) |
5814 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5815 \[\^ |
5816 \[\: (?>[a-z]+) :\] |
5817 \[\:\^ (?>[a-z]+) :\] |
5818 \(\? |
5819 $q_char
5820 ))/oxmsg;
5821  
5822 # choice again delimiter
5823 870 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 870 870
5824 0 my %octet = map {$_ => 1} @char;
5825 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
5826 0 $delimiter = '(';
5827 0 $end_delimiter = ')';
5828 }
5829 elsif (not $octet{'}'}) {
5830 0 $delimiter = '{';
5831 0 $end_delimiter = '}';
5832 }
5833 elsif (not $octet{']'}) {
5834 0 $delimiter = '[';
5835 0 $end_delimiter = ']';
5836 }
5837 elsif (not $octet{'>'}) {
5838 0 $delimiter = '<';
5839 0 $end_delimiter = '>';
5840 }
5841 else {
5842 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5843 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5844 0 $delimiter = $char;
5845 0 $end_delimiter = $char;
5846 0 last;
5847 }
5848 }
5849 }
5850 }
5851  
5852 870 my $left_e = 0;
5853 870 my $right_e = 0;
5854 870 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 2100 870 2970
5855  
5856 # "\L\u" --> "\u\L"
5857 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
5858 0 @char[$i,$i+1] = @char[$i+1,$i];
5859 }
5860  
5861 # "\U\l" --> "\l\U"
5862 ▶ 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
5863 0 @char[$i,$i+1] = @char[$i+1,$i];
5864 }
5865  
5866 # octal escape sequence
5867 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5868 1 $char[$i] = Elatin10::octchr($1);
5869 }
5870  
5871 # hexadecimal escape sequence
5872 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5873 1 $char[$i] = Elatin10::hexchr($1);
5874 }
5875  
5876 # \b{...} --> b\{...}
5877 # \B{...} --> B\{...}
5878 # \N{CHARNAME} --> N\{CHARNAME}
5879 # \p{PROPERTY} --> p\{PROPERTY}
5880 # \P{PROPERTY} --> P\{PROPERTY}
5881 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5882 6 $char[$i] = $1 . '\\' . $2;
5883 }
5884  
5885 # \p, \P, \X --> p, P, X
5886 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
5887 4 $char[$i] = $1;
5888 }
5889  
5890 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 &Elatin10::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
5891 }
5892  
5893 # join separated multiple-octet
5894 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
5895 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 $Elatin10::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 $Elatin10::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 $Elatin10::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 $Elatin10::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 $Elatin10::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 $Elatin10::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 $Elatin10::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5896 0 $char[$i] .= join '', splice @char, $i+1, 3;
5897 }
5898 ▶ 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 $Elatin10::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 $Elatin10::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 $Elatin10::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 $Elatin10::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5899 0 $char[$i] .= join '', splice @char, $i+1, 2;
5900 }
5901 ▶ 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 $Elatin10::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 $Elatin10::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 $Elatin10::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 $Elatin10::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5902 0 $char[$i] .= join '', splice @char, $i+1, 1;
5903 }
5904 }
5905  
5906 # open character class [...]
5907 elsif ($char[$i] eq '[') {
5908 556 my $left = $i;
5909  
5910 # [] make die "Unmatched [] in regexp ...\n"
5911 # (and so on)
5912  
5913 556 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 3 553 556
5914 3 $i++;
5915 }
5916  
5917 556 while (1) {
5918 2063 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 2063 2063
5919 0 die __FILE__, ": Unmatched [] in regexp\n";
5920 }
5921 2063 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 556 1507 2063
5922 556 my $right = $i;
5923  
5924 # [...]
5925 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
5926 30 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin10::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
5927 }
5928 else {
5929 526 splice @char, $left, $right-$left+1, Elatin10::charlist_qr(@char[$left+1..$right-1], $modifier);
5930 }
5931  
5932 556 $i = $left;
5933 556 last;
5934 }
5935 }
5936 }
5937  
5938 # open character class [^...]
5939 elsif ($char[$i] eq '[^') {
5940 74 my $left = $i;
5941  
5942 # [^] make die "Unmatched [] in regexp ...\n"
5943 # (and so on)
5944  
5945 74 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 4 70 74
5946 4 $i++;
5947 }
5948  
5949 74 while (1) {
5950 272 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 272 272
5951 0 die __FILE__, ": Unmatched [] in regexp\n";
5952 }
5953 272 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 74 198 272
5954 74 my $right = $i;
5955  
5956 # [^...]
5957 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
5958 30 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin10::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
5959 }
5960 else {
5961 44 splice @char, $left, $right-$left+1, Elatin10::charlist_not_qr(@char[$left+1..$right-1], $modifier);
5962 }
5963  
5964 74 $i = $left;
5965 74 last;
5966 }
5967 }
5968 }
5969  
5970 # rewrite character class or escape character
5971 elsif (my $char = character_class($char[$i],$modifier)) {
5972 139 $char[$i] = $char;
5973 }
5974  
5975 # /i modifier
5976 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin10::uc($char[$i]) ne Elatin10::fc($char[$i]))) {
Condition100%6/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin10::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 &Elatin10::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin10::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= &Elatin10::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
5977 20 ▶ if (CORE::length(Elatin10::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 20 0 20
5978 20 $char[$i] = '[' . Elatin10::uc($char[$i]) . Elatin10::fc($char[$i]) . ']';
5979 }
5980 else {
5981 0 $char[$i] = '(?:' . Elatin10::uc($char[$i]) . '|' . Elatin10::fc($char[$i]) . ')';
5982 }
5983 }
5984  
5985 # \u \l \U \L \F \Q \E
5986 elsif ($char[$i] =~ /\A [<>] \z/oxms) {
5987 1 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 1 1
5988 0 $char[$i] = '\\' . $char[$i];
5989 }
5990 }
5991 elsif ($char[$i] eq '\u') {
5992 0 $char[$i] = '@{[Elatin10::ucfirst qq<';
5993 0 $left_e++;
5994 }
5995 elsif ($char[$i] eq '\l') {
5996 0 $char[$i] = '@{[Elatin10::lcfirst qq<';
5997 0 $left_e++;
5998 }
5999 elsif ($char[$i] eq '\U') {
6000 1 $char[$i] = '@{[Elatin10::uc qq<';
6001 1 $left_e++;
6002 }
6003 elsif ($char[$i] eq '\L') {
6004 1 $char[$i] = '@{[Elatin10::lc qq<';
6005 1 $left_e++;
6006 }
6007 elsif ($char[$i] eq '\F') {
6008 18 $char[$i] = '@{[Elatin10::fc qq<';
6009 18 $left_e++;
6010 }
6011 elsif ($char[$i] eq '\Q') {
6012 1 $char[$i] = '@{[CORE::quotemeta qq<';
6013 1 $left_e++;
6014 }
6015 elsif ($char[$i] eq '\E') {
6016 21 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 21 0 21
6017 21 $char[$i] = '>]}';
6018 21 $right_e++;
6019 }
6020 else {
6021 0 $char[$i] = '';
6022 }
6023 }
6024 elsif ($char[$i] eq '\Q') {
6025 0 while (1) {
6026 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6027 0 last;
6028 }
6029 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
6030 0 last;
6031 }
6032 }
6033 }
6034 elsif ($char[$i] eq '\E') {
6035 }
6036  
6037 # $0 --> $0
6038 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
6039 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6040 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
6041 }
6042 }
6043 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
6044 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6045 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
6046 }
6047 }
6048  
6049 # $$ --> $$
6050 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
6051 }
6052  
6053 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
6054 # $1, $2, $3 --> $1, $2, $3 otherwise
6055 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
6056 0 $char[$i] = e_capture($1);
6057 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6058 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
6059 }
6060 }
6061 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6062 0 $char[$i] = e_capture($1);
6063 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6064 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
6065 }
6066 }
6067  
6068 # $$foo[ ... ] --> $ $foo->[ ... ]
6069 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
6070 0 $char[$i] = e_capture($1.'->'.$2);
6071 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6072 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
6073 }
6074 }
6075  
6076 # $$foo{ ... } --> $ $foo->{ ... }
6077 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
6078 0 $char[$i] = e_capture($1.'->'.$2);
6079 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6080 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
6081 }
6082 }
6083  
6084 # $$foo
6085 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
6086 0 $char[$i] = e_capture($1);
6087 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6088 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
6089 }
6090 }
6091  
6092 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin10::PREMATCH()
6093 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
6094 8 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 8 8
6095 0 $char[$i] = '@{[Elatin10::ignorecase(Elatin10::PREMATCH())]}';
6096 }
6097 else {
6098 8 $char[$i] = '@{[Elatin10::PREMATCH()]}';
6099 }
6100 }
6101  
6102 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin10::MATCH()
6103 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
6104 8 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 8 8
6105 0 $char[$i] = '@{[Elatin10::ignorecase(Elatin10::MATCH())]}';
6106 }
6107 else {
6108 8 $char[$i] = '@{[Elatin10::MATCH()]}';
6109 }
6110 }
6111  
6112 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin10::POSTMATCH()
6113 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
6114 6 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 6 6
6115 0 $char[$i] = '@{[Elatin10::ignorecase(Elatin10::POSTMATCH())]}';
6116 }
6117 else {
6118 6 $char[$i] = '@{[Elatin10::POSTMATCH()]}';
6119 }
6120 }
6121  
6122 # ${ foo }
6123 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
6124 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6125 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
6126 }
6127 }
6128  
6129 # ${ ... }
6130 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
6131 0 $char[$i] = e_capture($1);
6132 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6133 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
6134 }
6135 }
6136  
6137 # $scalar or @array
6138 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
6139 21 $char[$i] = e_string($char[$i]);
6140 21 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 11 10 21
6141 11 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
6142 }
6143 }
6144  
6145 # quote character before ? + * {
6146 ▶ 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
6147 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
6148 }
6149 ▶ 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
6150 0 my $char = $char[$i-1];
6151 0 ▶ if ($char[$i] eq '{') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq '{') { } 0 0 0
6152 0 die __FILE__, qq{: "MULTIBYTE{n}" should be "(MULTIBYTE){n}" in m?? (and shift \$1,\$2,\$3,...) ($char){n}\n};
6153 }
6154 else {
6155 0 die __FILE__, qq{: "MULTIBYTE$char[$i]" should be "(MULTIBYTE)$char[$i]" in m?? (and shift \$1,\$2,\$3,...) ($char)$char[$i]\n};
6156 }
6157 }
6158 else {
6159 127 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6160 }
6161 }
6162 }
6163  
6164 # make regexp string
6165 870 $modifier =~ tr/i//d;
6166 870 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 870 870
6167 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
6168 0 return join '', $ope, $delimiter, $anchor, @char, '>]}' x ($left_e - $right_e), $matched, $end_delimiter, $modifier;
6169 }
6170 else {
6171 0 return join '', $ope, $delimiter, $anchor, '(?:', @char, '>]}' x ($left_e - $right_e), ')', $matched, $end_delimiter, $modifier;
6172 }
6173 }
6174 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
6175 0 return join '', $ope, $delimiter, $anchor, @char, $matched, $end_delimiter, $modifier;
6176 }
6177 else {
6178 870 return join '', $ope, $delimiter, $anchor, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6179 }
6180 }
6181  
6182 #
6183 # double quote stuff
6184 #
6185 180 ▶sub qq_stuff {
Subroutine qq_stuff: called CC=6 SCAR=18.5
Pod undocumented
6186 180 my($delimiter,$end_delimiter,$stuff) = @_;
6187  
6188 # scalar variable or array variable
6189 180 ▶ if ($stuff =~ /\A [\$\@] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($stuff =~ /\A [\$\@] /mosx) 100 80 180
6190 100 return $stuff;
6191 }
6192  
6193 # quote by delimiter
6194 80 my %octet = map {$_ => 1} ($stuff =~ /\G ([\x00-\xFF]) /oxmsg);
6195 80 for my $char (qw( ! " $ % & * + - . / : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
6196 80 ▶ next if $char eq $delimiter;
Branch: 1 branch
BranchTrueFalseTotal
if $char eq $delimiter 0 80 80
6197 80 ▶ next if $char eq $end_delimiter;
Branch: 1 branch
BranchTrueFalseTotal
if $char eq $end_delimiter 0 80 80
6198 80 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 80 0 80
6199 80 return join '', 'qq', $char, $stuff, $char;
6200 }
6201 }
6202 0 return join '', 'qq', '<', $stuff, '>';
6203 }
6204  
6205 #
6206 # escape regexp (m'', qr'', and m''b, qr''b)
6207 #
6208 10 ▶sub e_qr_q {
Subroutine e_qr_q: called CC=7 SCAR=25.3
Pod undocumented
6209 10 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6210 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
6211  
6212 10 $modifier =~ tr/p//d;
6213 10 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 10 10
6214 0 my $line = 0;
6215 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6216 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6217 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6218 0 last;
6219 }
6220 }
6221 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6222 }
6223  
6224 10 $slash = 'div';
6225  
6226 # literal null string pattern
6227 10 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 2 10
elsif ($modifier =~ tr/Bb//d) { } 0 2 2
6228 8 $modifier =~ tr/bB//d;
6229 8 $modifier =~ tr/i//d;
6230 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
6231 }
6232  
6233 # with /b /B modifier
6234 elsif ($modifier =~ tr/bB//d) {
6235 0 return e_qr_qb($ope,$delimiter,$end_delimiter,$string,$modifier);
6236 }
6237  
6238 # without /b /B modifier
6239 else {
6240 2 return e_qr_qt($ope,$delimiter,$end_delimiter,$string,$modifier);
6241 }
6242 }
6243  
6244 #
6245 # escape regexp (m'', qr'')
6246 #
6247 2 ▶sub e_qr_qt {
Subroutine e_qr_qt: called CC=20 SCAR=51.8
Pod undocumented
6248 2 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6249  
6250 2 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 2 2
6251  
6252 # split regexp
6253 2 my @char = $string =~ /\G((?>
6254 [^\\\[\$\@\/] |
6255 [\x00-\xFF] |
6256 \[\^ |
6257 \[\: (?>[a-z]+) \:\] |
6258 \[\:\^ (?>[a-z]+) \:\] |
6259 [\$\@\/] |
6260 \\ (?:$q_char) |
6261 (?:$q_char)
6262 ))/oxmsg;
6263  
6264 # unescape character
6265 2 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 2 2 4
6266 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 &Elatin10::uc($char[$i]) ne &fc($char[$i])) { } 0 2 2
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 4 4
6267 }
6268  
6269 # open character class [...]
6270 elsif ($char[$i] eq '[') {
6271 0 my $left = $i;
6272 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6273 0 $i++;
6274 }
6275 0 while (1) {
6276 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6277 0 die __FILE__, ": Unmatched [] in regexp\n";
6278 }
6279 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6280 0 my $right = $i;
6281  
6282 # [...]
6283 0 splice @char, $left, $right-$left+1, Elatin10::charlist_qr(@char[$left+1..$right-1], $modifier);
6284  
6285 0 $i = $left;
6286 0 last;
6287 }
6288 }
6289 }
6290  
6291 # open character class [^...]
6292 elsif ($char[$i] eq '[^') {
6293 0 my $left = $i;
6294 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6295 0 $i++;
6296 }
6297 0 while (1) {
6298 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6299 0 die __FILE__, ": Unmatched [] in regexp\n";
6300 }
6301 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6302 0 my $right = $i;
6303  
6304 # [^...]
6305 0 splice @char, $left, $right-$left+1, Elatin10::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6306  
6307 0 $i = $left;
6308 0 last;
6309 }
6310 }
6311 }
6312  
6313 # escape $ @ / and \
6314 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6315 0 $char[$i] = '\\' . $char[$i];
6316 }
6317  
6318 # rewrite character class or escape character
6319 elsif (my $char = character_class($char[$i],$modifier)) {
6320 0 $char[$i] = $char;
6321 }
6322  
6323 # /i modifier
6324 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin10::uc($char[$i]) ne Elatin10::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin10::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 &Elatin10::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin10::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= &Elatin10::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6325 0 ▶ if (CORE::length(Elatin10::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
6326 0 $char[$i] = '[' . Elatin10::uc($char[$i]) . Elatin10::fc($char[$i]) . ']';
6327 }
6328 else {
6329 0 $char[$i] = '(?:' . Elatin10::uc($char[$i]) . '|' . Elatin10::fc($char[$i]) . ')';
6330 }
6331 }
6332  
6333 # quote character before ? + * {
6334 ▶ 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
6335 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
6336 }
6337 else {
6338 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6339 }
6340 }
6341 }
6342  
6343 2 $delimiter = '/';
6344 2 $end_delimiter = '/';
6345  
6346 2 $modifier =~ tr/i//d;
6347 2 return join '', $ope, $delimiter, $anchor, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6348 }
6349  
6350 #
6351 # escape regexp (m''b, qr''b)
6352 #
6353 0 ▶sub e_qr_qb {
Subroutine e_qr_qb: not called CC=4 SCAR=30.0
Pod undocumented
6354 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6355  
6356 # split regexp
6357 0 my @char = $string =~ /\G ((?>[^\\]|\\\\)) /oxmsg;
6358  
6359 # unescape character
6360 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
6361 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
6362 }
6363  
6364 # remain \\
6365 elsif ($char[$i] eq '\\\\') {
6366 }
6367  
6368 # escape $ @ / and \
6369 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6370 0 $char[$i] = '\\' . $char[$i];
6371 }
6372 }
6373  
6374 0 $delimiter = '/';
6375 0 $end_delimiter = '/';
6376 0 return join '', $ope, $delimiter, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6377 }
6378  
6379 #
6380 # escape regexp (s/here//)
6381 #
6382 80 ▶sub e_s1 {
Subroutine e_s1: called CC=106 SCAR=81.1
Pod undocumented
6383 80 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6384 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
6385  
6386 80 $modifier =~ tr/p//d;
6387 80 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 80 80
6388 0 my $line = 0;
6389 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6390 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6391 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6392 0 last;
6393 }
6394 }
6395 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6396 }
6397  
6398 80 $slash = 'div';
6399  
6400 # literal null string pattern
6401 80 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 72 80
elsif ($modifier =~ tr/Bb//d) { } 0 72 72
6402 8 $modifier =~ tr/bB//d;
6403 8 $modifier =~ tr/i//d;
6404 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
6405 }
6406  
6407 # /b /B modifier
6408 elsif ($modifier =~ tr/bB//d) {
6409  
6410 # choice again delimiter
6411 0 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 0 0
6412 0 my @char = $string =~ /\G ([\x00-\xFF]) /oxmsg;
6413 0 my %octet = map {$_ => 1} @char;
6414 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
6415 0 $delimiter = '(';
6416 0 $end_delimiter = ')';
6417 }
6418 elsif (not $octet{'}'}) {
6419 0 $delimiter = '{';
6420 0 $end_delimiter = '}';
6421 }
6422 elsif (not $octet{']'}) {
6423 0 $delimiter = '[';
6424 0 $end_delimiter = ']';
6425 }
6426 elsif (not $octet{'>'}) {
6427 0 $delimiter = '<';
6428 0 $end_delimiter = '>';
6429 }
6430 else {
6431 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
6432 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
6433 0 $delimiter = $char;
6434 0 $end_delimiter = $char;
6435 0 last;
6436 }
6437 }
6438 }
6439 }
6440  
6441 0 my $prematch = '';
6442 0 return join '', $ope, $delimiter, $prematch, '(?:', $string, ')', $matched, $end_delimiter, $modifier;
6443 }
6444  
6445 72 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 1 71 72
6446 72 my $metachar = qr/[\@\\|[\]{^]/oxms;
6447  
6448 # split regexp
6449 72 my @char = $string =~ /\G((?>
6450 [^\\\$\@\[\(] |
6451 \\ (?>[1-9][0-9]*) |
6452 \\g (?>\s*) (?>[1-9][0-9]*) |
6453 \\g (?>\s*) \{ (?>\s*) (?>[1-9][0-9]*) (?>\s*) \} |
6454 \\g (?>\s*) \{ (?>\s*) - (?>\s*) (?>[1-9][0-9]*) (?>\s*) \} |
6455 \\x (?>[0-9A-Fa-f]{1,2}) |
6456 \\ (?>[0-7]{2,3}) |
6457 \\c [\x40-\x5F] |
6458 \\x\{ (?>[0-9A-Fa-f]+) \} |
6459 \\o\{ (?>[0-7]+) \} |
6460 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
6461 \\ $q_char |
6462 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
6463 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
6464 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
6465 [\$\@] $qq_variable |
6466 \$ (?>\s* [0-9]+) |
6467 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
6468 \$ \$ (?![\w\{]) |
6469 \$ (?>\s*) \$ (?>\s*) $qq_variable |
6470 \[\^ |
6471 \[\: (?>[a-z]+) :\] |
6472 \[\:\^ (?>[a-z]+) :\] |
6473 \(\? |
6474 $q_char
6475 ))/oxmsg;
6476  
6477 # choice again delimiter
6478 72 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 72 72
6479 0 my %octet = map {$_ => 1} @char;
6480 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
6481 0 $delimiter = '(';
6482 0 $end_delimiter = ')';
6483 }
6484 elsif (not $octet{'}'}) {
6485 0 $delimiter = '{';
6486 0 $end_delimiter = '}';
6487 }
6488 elsif (not $octet{']'}) {
6489 0 $delimiter = '[';
6490 0 $end_delimiter = ']';
6491 }
6492 elsif (not $octet{'>'}) {
6493 0 $delimiter = '<';
6494 0 $end_delimiter = '>';
6495 }
6496 else {
6497 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
6498 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
6499 0 $delimiter = $char;
6500 0 $end_delimiter = $char;
6501 0 last;
6502 }
6503 }
6504 }
6505 }
6506  
6507 # count '('
6508 72 my $parens = grep { $_ eq '(' } @char;
6509  
6510 72 my $left_e = 0;
6511 72 my $right_e = 0;
6512 72 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 200 72 272
6513  
6514 # "\L\u" --> "\u\L"
6515 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
6516 0 @char[$i,$i+1] = @char[$i+1,$i];
6517 }
6518  
6519 # "\U\l" --> "\l\U"
6520 ▶ 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
6521 0 @char[$i,$i+1] = @char[$i+1,$i];
6522 }
6523  
6524 # octal escape sequence
6525 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
6526 1 $char[$i] = Elatin10::octchr($1);
6527 }
6528  
6529 # hexadecimal escape sequence
6530 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
6531 1 $char[$i] = Elatin10::hexchr($1);
6532 }
6533  
6534 # \b{...} --> b\{...}
6535 # \B{...} --> B\{...}
6536 # \N{CHARNAME} --> N\{CHARNAME}
6537 # \p{PROPERTY} --> p\{PROPERTY}
6538 # \P{PROPERTY} --> P\{PROPERTY}
6539 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
6540 0 $char[$i] = $1 . '\\' . $2;
6541 }
6542  
6543 # \p, \P, \X --> p, P, X
6544 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
6545 0 $char[$i] = $1;
6546 }
6547  
6548 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 &Elatin10::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
6549 }
6550  
6551 # join separated multiple-octet
6552 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
6553 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 $Elatin10::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 $Elatin10::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 $Elatin10::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 $Elatin10::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 $Elatin10::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 $Elatin10::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 $Elatin10::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6554 0 $char[$i] .= join '', splice @char, $i+1, 3;
6555 }
6556 ▶ 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 $Elatin10::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 $Elatin10::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 $Elatin10::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 $Elatin10::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6557 0 $char[$i] .= join '', splice @char, $i+1, 2;
6558 }
6559 ▶ 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 $Elatin10::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 $Elatin10::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 $Elatin10::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 $Elatin10::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6560 0 $char[$i] .= join '', splice @char, $i+1, 1;
6561 }
6562 }
6563  
6564 # open character class [...]
6565 elsif ($char[$i] eq '[') {
6566 17 my $left = $i;
6567 17 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 17 17
6568 0 $i++;
6569 }
6570 17 while (1) {
6571 74 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 74 74
6572 0 die __FILE__, ": Unmatched [] in regexp\n";
6573 }
6574 74 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 17 57 74
6575 17 my $right = $i;
6576  
6577 # [...]
6578 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
6579 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin10::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6580 }
6581 else {
6582 17 splice @char, $left, $right-$left+1, Elatin10::charlist_qr(@char[$left+1..$right-1], $modifier);
6583 }
6584  
6585 17 $i = $left;
6586 17 last;
6587 }
6588 }
6589 }
6590  
6591 # open character class [^...]
6592 elsif ($char[$i] eq '[^') {
6593 0 my $left = $i;
6594 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6595 0 $i++;
6596 }
6597 0 while (1) {
6598 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6599 0 die __FILE__, ": Unmatched [] in regexp\n";
6600 }
6601 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6602 0 my $right = $i;
6603  
6604 # [^...]
6605 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
6606 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin10::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6607 }
6608 else {
6609 0 splice @char, $left, $right-$left+1, Elatin10::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6610 }
6611  
6612 0 $i = $left;
6613 0 last;
6614 }
6615 }
6616 }
6617  
6618 # rewrite character class or escape character
6619 elsif (my $char = character_class($char[$i],$modifier)) {
6620 7 $char[$i] = $char;
6621 }
6622  
6623 # /i modifier
6624 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin10::uc($char[$i]) ne Elatin10::fc($char[$i]))) {
Condition66%4/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin10::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 &Elatin10::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin10::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= &Elatin10::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6625 3 ▶ if (CORE::length(Elatin10::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 3 0 3
6626 3 $char[$i] = '[' . Elatin10::uc($char[$i]) . Elatin10::fc($char[$i]) . ']';
6627 }
6628 else {
6629 0 $char[$i] = '(?:' . Elatin10::uc($char[$i]) . '|' . Elatin10::fc($char[$i]) . ')';
6630 }
6631 }
6632  
6633 # \u \l \U \L \F \Q \E
6634 elsif ($char[$i] =~ /\A [<>] \z/oxms) {
6635 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
6636 0 $char[$i] = '\\' . $char[$i];
6637 }
6638 }
6639 elsif ($char[$i] eq '\u') {
6640 0 $char[$i] = '@{[Elatin10::ucfirst qq<';
6641 0 $left_e++;
6642 }
6643 elsif ($char[$i] eq '\l') {
6644 0 $char[$i] = '@{[Elatin10::lcfirst qq<';
6645 0 $left_e++;
6646 }
6647 elsif ($char[$i] eq '\U') {
6648 0 $char[$i] = '@{[Elatin10::uc qq<';
6649 0 $left_e++;
6650 }
6651 elsif ($char[$i] eq '\L') {
6652 0 $char[$i] = '@{[Elatin10::lc qq<';
6653 0 $left_e++;
6654 }
6655 elsif ($char[$i] eq '\F') {
6656 0 $char[$i] = '@{[Elatin10::fc qq<';
6657 0 $left_e++;
6658 }
6659 elsif ($char[$i] eq '\Q') {
6660 0 $char[$i] = '@{[CORE::quotemeta qq<';
6661 0 $left_e++;
6662 }
6663 elsif ($char[$i] eq '\E') {
6664 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
6665 0 $char[$i] = '>]}';
6666 0 $right_e++;
6667 }
6668 else {
6669 0 $char[$i] = '';
6670 }
6671 }
6672 elsif ($char[$i] eq '\Q') {
6673 0 while (1) {
6674 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6675 0 last;
6676 }
6677 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
6678 0 last;
6679 }
6680 }
6681 }
6682 elsif ($char[$i] eq '\E') {
6683 }
6684  
6685 # \0 --> \0
6686 elsif ($char[$i] =~ /\A \\ (?>\s*) 0 \z/oxms) {
6687 }
6688  
6689 # \g{N}, \g{-N}
6690  
6691 # P.108 Using Simple Patterns
6692 # in Chapter 7: In the World of Regular Expressions
6693 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
6694  
6695 # P.221 Capturing
6696 # in Chapter 5: Pattern Matching
6697 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
6698  
6699 # \g{-1}, \g{-2}, \g{-3} --> \g{-1}, \g{-2}, \g{-3}
6700 elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) - (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6701 }
6702  
6703 # \g{1}, \g{2}, \g{3} --> \g{2}, \g{3}, \g{4} (only when multibyte anchoring is enable)
6704 elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6705 }
6706  
6707 # \g1, \g2, \g3 --> \g2, \g3, \g4 (only when multibyte anchoring is enable)
6708 elsif ($char[$i] =~ /\A \\g (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) {
6709 }
6710  
6711 # \1, \2, \3 --> \2, \3, \4 (only when multibyte anchoring is enable)
6712 elsif ($char[$i] =~ /\A \\ (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) {
6713 }
6714  
6715 # $0 --> $0
6716 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
6717 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6718 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
6719 }
6720 }
6721 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
6722 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6723 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
6724 }
6725 }
6726  
6727 # $$ --> $$
6728 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
6729 }
6730  
6731 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
6732 # $1, $2, $3 --> $1, $2, $3 otherwise
6733 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
6734 0 $char[$i] = e_capture($1);
6735 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6736 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
6737 }
6738 }
6739 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6740 0 $char[$i] = e_capture($1);
6741 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6742 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
6743 }
6744 }
6745  
6746 # $$foo[ ... ] --> $ $foo->[ ... ]
6747 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
6748 0 $char[$i] = e_capture($1.'->'.$2);
6749 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6750 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
6751 }
6752 }
6753  
6754 # $$foo{ ... } --> $ $foo->{ ... }
6755 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
6756 0 $char[$i] = e_capture($1.'->'.$2);
6757 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6758 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
6759 }
6760 }
6761  
6762 # $$foo
6763 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
6764 0 $char[$i] = e_capture($1);
6765 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6766 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
6767 }
6768 }
6769  
6770 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin10::PREMATCH()
6771 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
6772 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 4 4
6773 0 $char[$i] = '@{[Elatin10::ignorecase(Elatin10::PREMATCH())]}';
6774 }
6775 else {
6776 4 $char[$i] = '@{[Elatin10::PREMATCH()]}';
6777 }
6778 }
6779  
6780 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin10::MATCH()
6781 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
6782 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 4 4
6783 0 $char[$i] = '@{[Elatin10::ignorecase(Elatin10::MATCH())]}';
6784 }
6785 else {
6786 4 $char[$i] = '@{[Elatin10::MATCH()]}';
6787 }
6788 }
6789  
6790 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin10::POSTMATCH()
6791 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
6792 3 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 3 3
6793 0 $char[$i] = '@{[Elatin10::ignorecase(Elatin10::POSTMATCH())]}';
6794 }
6795 else {
6796 3 $char[$i] = '@{[Elatin10::POSTMATCH()]}';
6797 }
6798 }
6799  
6800 # ${ foo }
6801 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
6802 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6803 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
6804 }
6805 }
6806  
6807 # ${ ... }
6808 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
6809 0 $char[$i] = e_capture($1);
6810 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6811 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
6812 }
6813 }
6814  
6815 # $scalar or @array
6816 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
6817 4 $char[$i] = e_string($char[$i]);
6818 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 4 4
6819 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
6820 }
6821 }
6822  
6823 # quote character before ? + * {
6824 ▶ 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
6825 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
6826 }
6827 else {
6828 14 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6829 }
6830 }
6831 }
6832  
6833 # make regexp string
6834 72 my $prematch = '';
6835 72 $modifier =~ tr/i//d;
6836 72 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 72 72
6837 0 return join '', $ope, $delimiter, $prematch, '(?:', @char, '>]}' x ($left_e - $right_e), ')', $matched, $end_delimiter, $modifier;
6838 }
6839 72 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6840 }
6841  
6842 #
6843 # escape regexp (s'here'' or s'here''b)
6844 #
6845 21 ▶sub e_s1_q {
Subroutine e_s1_q: called CC=7 SCAR=24.3
Pod undocumented
6846 21 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6847 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
6848  
6849 21 $modifier =~ tr/p//d;
6850 21 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 21 21
6851 0 my $line = 0;
6852 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6853 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6854 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6855 0 last;
6856 }
6857 }
6858 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6859 }
6860  
6861 21 $slash = 'div';
6862  
6863 # literal null string pattern
6864 21 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 13 21
elsif ($modifier =~ tr/Bb//d) { } 0 13 13
6865 8 $modifier =~ tr/bB//d;
6866 8 $modifier =~ tr/i//d;
6867 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
6868 }
6869  
6870 # with /b /B modifier
6871 elsif ($modifier =~ tr/bB//d) {
6872 0 return e_s1_qb($ope,$delimiter,$end_delimiter,$string,$modifier);
6873 }
6874  
6875 # without /b /B modifier
6876 else {
6877 13 return e_s1_qt($ope,$delimiter,$end_delimiter,$string,$modifier);
6878 }
6879 }
6880  
6881 #
6882 # escape regexp (s'here'')
6883 #
6884 13 ▶sub e_s1_qt {
Subroutine e_s1_qt: called CC=20 SCAR=50.1
Pod undocumented
6885 13 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6886  
6887 13 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 13 13
6888  
6889 # split regexp
6890 13 my @char = $string =~ /\G((?>
6891 [^\\\[\$\@\/] |
6892 [\x00-\xFF] |
6893 \[\^ |
6894 \[\: (?>[a-z]+) \:\] |
6895 \[\:\^ (?>[a-z]+) \:\] |
6896 [\$\@\/] |
6897 \\ (?:$q_char) |
6898 (?:$q_char)
6899 ))/oxmsg;
6900  
6901 # unescape character
6902 13 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 25 13 38
6903 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 &Elatin10::uc($char[$i]) ne &fc($char[$i])) { } 0 19 19
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 32 32
6904 }
6905  
6906 # open character class [...]
6907 elsif ($char[$i] eq '[') {
6908 0 my $left = $i;
6909 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6910 0 $i++;
6911 }
6912 0 while (1) {
6913 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6914 0 die __FILE__, ": Unmatched [] in regexp\n";
6915 }
6916 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6917 0 my $right = $i;
6918  
6919 # [...]
6920 0 splice @char, $left, $right-$left+1, Elatin10::charlist_qr(@char[$left+1..$right-1], $modifier);
6921  
6922 0 $i = $left;
6923 0 last;
6924 }
6925 }
6926 }
6927  
6928 # open character class [^...]
6929 elsif ($char[$i] eq '[^') {
6930 0 my $left = $i;
6931 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6932 0 $i++;
6933 }
6934 0 while (1) {
6935 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6936 0 die __FILE__, ": Unmatched [] in regexp\n";
6937 }
6938 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6939 0 my $right = $i;
6940  
6941 # [^...]
6942 0 splice @char, $left, $right-$left+1, Elatin10::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6943  
6944 0 $i = $left;
6945 0 last;
6946 }
6947 }
6948 }
6949  
6950 # escape $ @ / and \
6951 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6952 0 $char[$i] = '\\' . $char[$i];
6953 }
6954  
6955 # rewrite character class or escape character
6956 elsif (my $char = character_class($char[$i],$modifier)) {
6957 6 $char[$i] = $char;
6958 }
6959  
6960 # /i modifier
6961 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin10::uc($char[$i]) ne Elatin10::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin10::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 &Elatin10::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin10::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= &Elatin10::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6962 0 ▶ if (CORE::length(Elatin10::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
6963 0 $char[$i] = '[' . Elatin10::uc($char[$i]) . Elatin10::fc($char[$i]) . ']';
6964 }
6965 else {
6966 0 $char[$i] = '(?:' . Elatin10::uc($char[$i]) . '|' . Elatin10::fc($char[$i]) . ')';
6967 }
6968 }
6969  
6970 # quote character before ? + * {
6971 ▶ 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
6972 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
6973 }
6974 else {
6975 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6976 }
6977 }
6978 }
6979  
6980 13 $modifier =~ tr/i//d;
6981 13 $delimiter = '/';
6982 13 $end_delimiter = '/';
6983 13 my $prematch = '';
6984 13 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6985 }
6986  
6987 #
6988 # escape regexp (s'here''b)
6989 #
6990 0 ▶sub e_s1_qb {
Subroutine e_s1_qb: not called CC=4 SCAR=30.0
Pod undocumented
6991 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6992  
6993 # split regexp
6994 0 my @char = $string =~ /\G (?>[^\\]|\\\\) /oxmsg;
6995  
6996 # unescape character
6997 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
6998 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
6999 }
7000  
7001 # remain \\
7002 elsif ($char[$i] eq '\\\\') {
7003 }
7004  
7005 # escape $ @ / and \
7006 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
7007 0 $char[$i] = '\\' . $char[$i];
7008 }
7009 }
7010  
7011 0 $delimiter = '/';
7012 0 $end_delimiter = '/';
7013 0 my $prematch = '';
7014 0 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
7015 }
7016  
7017 #
7018 # escape regexp (s''here')
7019 #
7020 16 ▶sub e_s2_q {
Subroutine e_s2_q: called CC=4 SCAR=13.9
Pod undocumented
7021 16 my($ope,$delimiter,$end_delimiter,$string) = @_;
7022  
7023 16 $slash = 'div';
7024  
7025 16 my @char = $string =~ / \G (?>[^\\]|\\\\|$q_char) /oxmsg;
7026 16 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 9 16 25
7027 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
7028 }
7029  
7030 # not escape \\
7031 elsif ($char[$i] =~ /\A \\\\ \z/oxms) {
7032 }
7033  
7034 # escape $ @ / and \
7035 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
7036 5 $char[$i] = '\\' . $char[$i];
7037 }
7038 }
7039  
7040 16 return join '', $ope, $delimiter, @char, $end_delimiter;
7041 }
7042  
7043 #
7044 # escape regexp (s/here/and here/modifier)
7045 #
7046 101 ▶sub e_sub {
Subroutine e_sub: called CC=20 SCAR=32.6
Pod undocumented
7047 101 my($variable,$delimiter1,$pattern,$end_delimiter1,$delimiter2,$replacement,$end_delimiter2,$modifier) = @_;
7048 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
7049  
7050 101 $modifier =~ tr/p//d;
7051 101 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 101 101
7052 0 my $line = 0;
7053 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7054 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
7055 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
7056 0 last;
7057 }
7058 }
7059 0 die qq{Unsupported modifier "$1" used at line $line.\n};
7060 }
7061  
7062 101 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq "") 36 65 101
7063 36 $variable = '$_';
7064 36 $bind_operator = ' =~ ';
7065 }
7066  
7067 101 $slash = 'div';
7068  
7069 # P.128 Start of match (or end of previous match): \G
7070 # P.130 Advanced Use of \G with Perl
7071 # in Chapter 3: Overview of Regular Expression Features and Flavors
7072 # P.312 Iterative Matching: Scalar Context, with /g
7073 # in Chapter 7: Perl
7074 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
7075  
7076 # P.181 Where You Left Off: The \G Assertion
7077 # in Chapter 5: Pattern Matching
7078 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
7079  
7080 # P.220 Where You Left Off: The \G Assertion
7081 # in Chapter 5: Pattern Matching
7082 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
7083  
7084 101 my $e_modifier = $modifier =~ tr/e//d;
7085 101 my $r_modifier = $modifier =~ tr/r//d;
7086  
7087 101 my $my = '';
7088 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
7089 0 $my = $variable;
7090 0 $variable =~ s/ (?: local \b | my \b | our \b | state \b ) (?>\s*) //oxms;
7091 0 $variable =~ s/ = .+ \z//oxms;
7092 }
7093  
7094 101 (my $variable_basename = $variable) =~ s/ [\[\{].* \z//oxms;
7095 101 $variable_basename =~ s/ \s+ \z//oxms;
7096  
7097 # quote replacement string
7098 101 my $e_replacement = '';
7099 101 ▶ if ($e_modifier >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($e_modifier >= 1) { } 17 84 101
7100 17 $e_replacement = e_qq('', '', '', $replacement);
7101 17 $e_modifier--;
7102 }
7103 else {
7104 84 ▶ if ($delimiter2 eq "'") {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter2 eq q[']) { } 16 68 84
7105 16 $e_replacement = e_s2_q('qq', '/', '/', $replacement);
7106 }
7107 else {
7108 68 $e_replacement = e_qq ('qq', $delimiter2, $end_delimiter2, $replacement);
7109 }
7110 }
7111  
7112 101 my $sub = '';
7113  
7114 # with /r
7115 101 ▶ if ($r_modifier) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r_modifier) { } 10 91 101
7116 10 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $modifier =~ /g/mosx }) { } 5 5 10
7117 }
7118  
7119 # s///gr without multibyte anchoring
7120 elsif ($modifier =~ /g/oxms) {
7121 5 ▶ $sub = sprintf(
Branch: 1 branch
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 0 5 5
7122 # 1 2 3 4 5
7123 q<CORE::eval{local $Elatin10::re_t=%s; while($Elatin10::re_t =~ %s){%s local $^W=0; local $Elatin10::re_r=%s; %s$Elatin10::re_t="$`$Elatin10::re_r$'"; pos($Elatin10::re_t)=length "$`$Elatin10::re_r"; } return $Elatin10::re_t}>,
7124  
7125 $variable, # 1
7126 ($delimiter1 eq "'") ? # 2
7127 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
7128 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
7129 $s_matched, # 3
7130 $e_replacement, # 4
7131 '$Elatin10::re_r=CORE::eval $Elatin10::re_r; ' x $e_modifier, # 5
7132 );
7133 }
7134  
7135 # s///r
7136 else {
7137  
7138 5 my $prematch = q{$`};
7139  
7140 5 ▶ $sub = sprintf(
Branch: 1 branch
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 0 5 5
7141 # 1 2 3 4 5 6 7
7142 q<(%s =~ %s) ? CORE::eval{%s local $^W=0; local $Elatin10::re_r=%s; %s"%s$Elatin10::re_r$'" } : %s>,
7143  
7144 $variable, # 1
7145 ($delimiter1 eq "'") ? # 2
7146 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
7147 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
7148 $s_matched, # 3
7149 $e_replacement, # 4
7150 '$Elatin10::re_r=CORE::eval $Elatin10::re_r; ' x $e_modifier, # 5
7151 $prematch, # 6
7152 $variable, # 7
7153 );
7154 }
7155  
7156 # $var !~ s///r doesn't make sense
7157 10 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) 0 10 10
7158 0 $sub = q{die("$0: Using !~ with s///r doesn't make sense"), } . $sub;
7159 }
7160 }
7161  
7162 # without /r
7163 else {
7164 91 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $modifier =~ /g/mosx }) { } 23 68 91
7165 }
7166  
7167 # s///g without multibyte anchoring
7168 elsif ($modifier =~ /g/oxms) {
7169 23 ▶ $sub = sprintf(
Branch: 2 branches
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 3 20 23
$bind_operator =~ / !~ /mosx ? : 3 20 23
7170 # 1 2 3 4 5 6 7 8
7171 q<CORE::eval{local $Elatin10::re_n=0; while(%s =~ %s){%s local $^W=0; local $Elatin10::re_r=%s; %s%s="$`$Elatin10::re_r$'"; pos(%s)=length "$`$Elatin10::re_r"; $Elatin10::re_n++} return %s$Elatin10::re_n}>,
7172  
7173 $variable, # 1
7174 ($delimiter1 eq "'") ? # 2
7175 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
7176 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
7177 $s_matched, # 3
7178 $e_replacement, # 4
7179 '$Elatin10::re_r=CORE::eval $Elatin10::re_r; ' x $e_modifier, # 5
7180 $variable, # 6
7181 $variable, # 7
7182 ($bind_operator =~ / !~ /oxms) ? '!' : '', # 8
7183 );
7184 }
7185  
7186 # s///
7187 else {
7188  
7189 68 my $prematch = q{$`};
7190  
7191 68 ▶ $sub = sprintf(
Branch: 2 branches
BranchTrueFalseTotal
$bind_operator =~ / =~ /mosx ? : 65 3 68
$delimiter1 eq q['] ? : 18 50 68
7192  
7193 ($bind_operator =~ / =~ /oxms) ?
7194  
7195 # 1 2 3 4 5 6 7 8
7196 q<(%s%s%s) ? CORE::eval{%s local $^W=0; local $Elatin10::re_r=%s; %s%s="%s$Elatin10::re_r$'"; 1 } : undef> :
7197  
7198 # 1 2 3 4 5 6 7 8
7199 q<(%s%s%s) ? 1 : CORE::eval{%s local $^W=0; local $Elatin10::re_r=%s; %s%s="%s$Elatin10::re_r$'"; undef }>,
7200  
7201 $variable, # 1
7202 $bind_operator, # 2
7203 ($delimiter1 eq "'") ? # 3
7204 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
7205 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
7206 $s_matched, # 4
7207 $e_replacement, # 5
7208 '$Elatin10::re_r=CORE::eval $Elatin10::re_r; ' x $e_modifier, # 6
7209 $variable, # 7
7210 $prematch, # 8
7211 );
7212 }
7213 }
7214  
7215 # (my $foo = $bar) =~ s/// --> (my $foo = $bar, CORE::eval { ... })[1]
7216 101 ▶ if ($my ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($my ne "") 0 101 101
7217 0 $sub = "($my, $sub)[1]";
7218 }
7219  
7220 # clear s/// variable
7221 101 $sub_variable = '';
7222 101 $bind_operator = '';
7223  
7224 101 return $sub;
7225 }
7226  
7227 #
7228 # escape regexp of split qr//
7229 #
7230 74 ▶sub e_split {
Subroutine e_split: called CC=88 SCAR=76.4
Pod undocumented
7231 74 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
7232 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
7233  
7234 74 $modifier =~ tr/p//d;
7235 74 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 74 74
7236 0 my $line = 0;
7237 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7238 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
7239 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
7240 0 last;
7241 }
7242 }
7243 0 die qq{Unsupported modifier "$1" used at line $line.\n};
7244 }
7245  
7246 74 $slash = 'div';
7247  
7248 # /b /B modifier
7249 74 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) 0 74 74
7250 0 return join '', 'split', $ope, $delimiter, $string, $end_delimiter, $modifier;
7251 }
7252  
7253 74 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 74 74
7254 74 my $metachar = qr/[\@\\|[\]{^]/oxms;
7255  
7256 # split regexp
7257 74 my @char = $string =~ /\G((?>
7258 [^\\\$\@\[\(] |
7259 \\x (?>[0-9A-Fa-f]{1,2}) |
7260 \\ (?>[0-7]{2,3}) |
7261 \\c [\x40-\x5F] |
7262 \\x\{ (?>[0-9A-Fa-f]+) \} |
7263 \\o\{ (?>[0-7]+) \} |
7264 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
7265 \\ $q_char |
7266 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
7267 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
7268 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
7269 [\$\@] $qq_variable |
7270 \$ (?>\s* [0-9]+) |
7271 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
7272 \$ \$ (?![\w\{]) |
7273 \$ (?>\s*) \$ (?>\s*) $qq_variable |
7274 \[\^ |
7275 \[\: (?>[a-z]+) :\] |
7276 \[\:\^ (?>[a-z]+) :\] |
7277 \(\? |
7278 $q_char
7279 ))/oxmsg;
7280  
7281 74 my $left_e = 0;
7282 74 my $right_e = 0;
7283 74 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 249 74 323
7284  
7285 # "\L\u" --> "\u\L"
7286 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
7287 0 @char[$i,$i+1] = @char[$i+1,$i];
7288 }
7289  
7290 # "\U\l" --> "\l\U"
7291 ▶ 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
7292 0 @char[$i,$i+1] = @char[$i+1,$i];
7293 }
7294  
7295 # octal escape sequence
7296 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
7297 1 $char[$i] = Elatin10::octchr($1);
7298 }
7299  
7300 # hexadecimal escape sequence
7301 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
7302 1 $char[$i] = Elatin10::hexchr($1);
7303 }
7304  
7305 # \b{...} --> b\{...}
7306 # \B{...} --> B\{...}
7307 # \N{CHARNAME} --> N\{CHARNAME}
7308 # \p{PROPERTY} --> p\{PROPERTY}
7309 # \P{PROPERTY} --> P\{PROPERTY}
7310 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
7311 0 $char[$i] = $1 . '\\' . $2;
7312 }
7313  
7314 # \p, \P, \X --> p, P, X
7315 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
7316 0 $char[$i] = $1;
7317 }
7318  
7319 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 &Elatin10::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
7320 }
7321  
7322 # join separated multiple-octet
7323 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
7324 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 $Elatin10::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 $Elatin10::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 $Elatin10::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 $Elatin10::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 $Elatin10::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 $Elatin10::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 $Elatin10::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
7325 0 $char[$i] .= join '', splice @char, $i+1, 3;
7326 }
7327 ▶ 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 $Elatin10::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 $Elatin10::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 $Elatin10::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 $Elatin10::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
7328 0 $char[$i] .= join '', splice @char, $i+1, 2;
7329 }
7330 ▶ 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 $Elatin10::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 $Elatin10::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 $Elatin10::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 $Elatin10::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
7331 0 $char[$i] .= join '', splice @char, $i+1, 1;
7332 }
7333 }
7334  
7335 # open character class [...]
7336 elsif ($char[$i] eq '[') {
7337 3 my $left = $i;
7338 3 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 3 3
7339 0 $i++;
7340 }
7341 3 while (1) {
7342 7 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 7 7
7343 0 die __FILE__, ": Unmatched [] in regexp\n";
7344 }
7345 7 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 3 4 7
7346 3 my $right = $i;
7347  
7348 # [...]
7349 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
7350 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin10::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
7351 }
7352 else {
7353 3 splice @char, $left, $right-$left+1, Elatin10::charlist_qr(@char[$left+1..$right-1], $modifier);
7354 }
7355  
7356 3 $i = $left;
7357 3 last;
7358 }
7359 }
7360 }
7361  
7362 # open character class [^...]
7363 elsif ($char[$i] eq '[^') {
7364 0 my $left = $i;
7365 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7366 0 $i++;
7367 }
7368 0 while (1) {
7369 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7370 0 die __FILE__, ": Unmatched [] in regexp\n";
7371 }
7372 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7373 0 my $right = $i;
7374  
7375 # [^...]
7376 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
7377 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin10::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
7378 }
7379 else {
7380 0 splice @char, $left, $right-$left+1, Elatin10::charlist_not_qr(@char[$left+1..$right-1], $modifier);
7381 }
7382  
7383 0 $i = $left;
7384 0 last;
7385 }
7386 }
7387 }
7388  
7389 # rewrite character class or escape character
7390 elsif (my $char = character_class($char[$i],$modifier)) {
7391 1 $char[$i] = $char;
7392 }
7393  
7394 # P.794 29.2.161. split
7395 # in Chapter 29: Functions
7396 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
7397  
7398 # P.951 split
7399 # in Chapter 27: Functions
7400 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
7401  
7402 # said "The //m modifier is assumed when you split on the pattern /^/",
7403 # but perl5.008 is not so. Therefore, this software adds //m.
7404 # (and so on)
7405  
7406 # split(m/^/) --> split(m/^/m)
7407 ▶ 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
7408 7 $modifier .= 'm';
7409 }
7410  
7411 # /i modifier
7412 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin10::uc($char[$i]) ne Elatin10::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin10::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 &Elatin10::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin10::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= &Elatin10::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
7413 0 ▶ if (CORE::length(Elatin10::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
7414 0 $char[$i] = '[' . Elatin10::uc($char[$i]) . Elatin10::fc($char[$i]) . ']';
7415 }
7416 else {
7417 0 $char[$i] = '(?:' . Elatin10::uc($char[$i]) . '|' . Elatin10::fc($char[$i]) . ')';
7418 }
7419 }
7420  
7421 # \u \l \U \L \F \Q \E
7422 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
7423 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
7424 0 $char[$i] = '\\' . $char[$i];
7425 }
7426 }
7427 elsif ($char[$i] eq '\u') {
7428 0 $char[$i] = '@{[Elatin10::ucfirst qq<';
7429 0 $left_e++;
7430 }
7431 elsif ($char[$i] eq '\l') {
7432 0 $char[$i] = '@{[Elatin10::lcfirst qq<';
7433 0 $left_e++;
7434 }
7435 elsif ($char[$i] eq '\U') {
7436 0 $char[$i] = '@{[Elatin10::uc qq<';
7437 0 $left_e++;
7438 }
7439 elsif ($char[$i] eq '\L') {
7440 0 $char[$i] = '@{[Elatin10::lc qq<';
7441 0 $left_e++;
7442 }
7443 elsif ($char[$i] eq '\F') {
7444 0 $char[$i] = '@{[Elatin10::fc qq<';
7445 0 $left_e++;
7446 }
7447 elsif ($char[$i] eq '\Q') {
7448 0 $char[$i] = '@{[CORE::quotemeta qq<';
7449 0 $left_e++;
7450 }
7451 elsif ($char[$i] eq '\E') {
7452 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
7453 0 $char[$i] = '>]}';
7454 0 $right_e++;
7455 }
7456 else {
7457 0 $char[$i] = '';
7458 }
7459 }
7460 elsif ($char[$i] eq '\Q') {
7461 0 while (1) {
7462 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7463 0 last;
7464 }
7465 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
7466 0 last;
7467 }
7468 }
7469 }
7470 elsif ($char[$i] eq '\E') {
7471 }
7472  
7473 # $0 --> $0
7474 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
7475 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7476 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
7477 }
7478 }
7479 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
7480 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7481 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
7482 }
7483 }
7484  
7485 # $$ --> $$
7486 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
7487 }
7488  
7489 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
7490 # $1, $2, $3 --> $1, $2, $3 otherwise
7491 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
7492 0 $char[$i] = e_capture($1);
7493 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7494 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
7495 }
7496 }
7497 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
7498 0 $char[$i] = e_capture($1);
7499 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7500 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
7501 }
7502 }
7503  
7504 # $$foo[ ... ] --> $ $foo->[ ... ]
7505 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
7506 0 $char[$i] = e_capture($1.'->'.$2);
7507 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7508 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
7509 }
7510 }
7511  
7512 # $$foo{ ... } --> $ $foo->{ ... }
7513 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
7514 0 $char[$i] = e_capture($1.'->'.$2);
7515 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7516 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
7517 }
7518 }
7519  
7520 # $$foo
7521 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
7522 0 $char[$i] = e_capture($1);
7523 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7524 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
7525 }
7526 }
7527  
7528 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin10::PREMATCH()
7529 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
7530 12 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 12 12
7531 0 $char[$i] = '@{[Elatin10::ignorecase(Elatin10::PREMATCH())]}';
7532 }
7533 else {
7534 12 $char[$i] = '@{[Elatin10::PREMATCH()]}';
7535 }
7536 }
7537  
7538 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin10::MATCH()
7539 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
7540 12 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 12 12
7541 0 $char[$i] = '@{[Elatin10::ignorecase(Elatin10::MATCH())]}';
7542 }
7543 else {
7544 12 $char[$i] = '@{[Elatin10::MATCH()]}';
7545 }
7546 }
7547  
7548 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin10::POSTMATCH()
7549 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
7550 9 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 9 9
7551 0 $char[$i] = '@{[Elatin10::ignorecase(Elatin10::POSTMATCH())]}';
7552 }
7553 else {
7554 9 $char[$i] = '@{[Elatin10::POSTMATCH()]}';
7555 }
7556 }
7557  
7558 # ${ foo }
7559 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
7560 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7561 0 $char[$i] = '@{[Elatin10::ignorecase(' . $1 . ')]}';
7562 }
7563 }
7564  
7565 # ${ ... }
7566 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
7567 0 $char[$i] = e_capture($1);
7568 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7569 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
7570 }
7571 }
7572  
7573 # $scalar or @array
7574 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
7575 3 $char[$i] = e_string($char[$i]);
7576 3 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 3 3
7577 0 $char[$i] = '@{[Elatin10::ignorecase(' . $char[$i] . ')]}';
7578 }
7579 }
7580  
7581 # quote character before ? + * {
7582 ▶ 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
7583 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
7584 }
7585 else {
7586 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
7587 }
7588 }
7589 }
7590  
7591 # make regexp string
7592 74 $modifier =~ tr/i//d;
7593 74 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 74 74
7594 0 return join '', 'Elatin10::split', $ope, $delimiter, @char, '>]}' x ($left_e - $right_e), $end_delimiter, $modifier;
7595 }
7596 74 return join '', 'Elatin10::split', $ope, $delimiter, @char, $end_delimiter, $modifier;
7597 }
7598  
7599 #
7600 # escape regexp of split qr''
7601 #
7602 0 ▶sub e_split_q {
Subroutine e_split_q: not called CC=26 SCAR=65.5
Pod undocumented
7603 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
7604 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
7605  
7606 0 $modifier =~ tr/p//d;
7607 0 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 0 0
7608 0 my $line = 0;
7609 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7610 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
7611 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
7612 0 last;
7613 }
7614 }
7615 0 die qq{Unsupported modifier "$1" used at line $line.\n};
7616 }
7617  
7618 0 $slash = 'div';
7619  
7620 # /b /B modifier
7621 0 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) 0 0 0
7622 0 return join '', 'split', $ope, $delimiter, $string, $end_delimiter, $modifier;
7623 }
7624  
7625 0 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 0 0
7626  
7627 # split regexp
7628 0 my @char = $string =~ /\G((?>
7629 [^\\\[] |
7630 [\x00-\xFF] |
7631 \[\^ |
7632 \[\: (?>[a-z]+) \:\] |
7633 \[\:\^ (?>[a-z]+) \:\] |
7634 \\ (?:$q_char) |
7635 (?:$q_char)
7636 ))/oxmsg;
7637  
7638 # unescape character
7639 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
7640 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 &Elatin10::uc($char[$i]) ne &fc($char[$i])) { } 0 0 0
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 0 0
7641 }
7642  
7643 # open character class [...]
7644 elsif ($char[$i] eq '[') {
7645 0 my $left = $i;
7646 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7647 0 $i++;
7648 }
7649 0 while (1) {
7650 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7651 0 die __FILE__, ": Unmatched [] in regexp\n";
7652 }
7653 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7654 0 my $right = $i;
7655  
7656 # [...]
7657 0 splice @char, $left, $right-$left+1, Elatin10::charlist_qr(@char[$left+1..$right-1], $modifier);
7658  
7659 0 $i = $left;
7660 0 last;
7661 }
7662 }
7663 }
7664  
7665 # open character class [^...]
7666 elsif ($char[$i] eq '[^') {
7667 0 my $left = $i;
7668 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7669 0 $i++;
7670 }
7671 0 while (1) {
7672 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7673 0 die __FILE__, ": Unmatched [] in regexp\n";
7674 }
7675 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7676 0 my $right = $i;
7677  
7678 # [^...]
7679 0 splice @char, $left, $right-$left+1, Elatin10::charlist_not_qr(@char[$left+1..$right-1], $modifier);
7680  
7681 0 $i = $left;
7682 0 last;
7683 }
7684 }
7685 }
7686  
7687 # rewrite character class or escape character
7688 elsif (my $char = character_class($char[$i],$modifier)) {
7689 0 $char[$i] = $char;
7690 }
7691  
7692 # split(m/^/) --> split(m/^/m)
7693 ▶ 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
7694 0 $modifier .= 'm';
7695 }
7696  
7697 # /i modifier
7698 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin10::uc($char[$i]) ne Elatin10::fc($char[$i]))) {
Condition0%0/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin10::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 &Elatin10::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin10::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= &Elatin10::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
7699 0 ▶ if (CORE::length(Elatin10::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
7700 0 $char[$i] = '[' . Elatin10::uc($char[$i]) . Elatin10::fc($char[$i]) . ']';
7701 }
7702 else {
7703 0 $char[$i] = '(?:' . Elatin10::uc($char[$i]) . '|' . Elatin10::fc($char[$i]) . ')';
7704 }
7705 }
7706  
7707 # quote character before ? + * {
7708 ▶ 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
7709 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
7710 }
7711 else {
7712 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
7713 }
7714 }
7715 }
7716  
7717 0 $modifier =~ tr/i//d;
7718 0 return join '', 'Elatin10::split', $ope, $delimiter, @char, $end_delimiter, $modifier;
7719 }
7720  
7721 #
7722 # instead of Carp::carp
7723 #
7724 0 ▶sub carp {
Subroutine carp: not called CC=1 SCAR=6.9
Pod undocumented
7725 0 my($package,$filename,$line) = caller(1);
7726 0 print STDERR "@_ at $filename line $line.\n";
7727 }
7728  
7729 #
7730 # instead of Carp::croak
7731 #
7732 0 ▶sub croak {
Subroutine croak: not called CC=1 SCAR=6.9
Pod undocumented
7733 0 my($package,$filename,$line) = caller(1);
7734 0 print STDERR "@_ at $filename line $line.\n";
7735 0 die "\n";
7736 }
7737  
7738 #
7739 # instead of Carp::cluck
7740 #
7741 0 ▶sub cluck {
Subroutine cluck: not called CC=2 SCAR=17.9
Pod undocumented
7742 0 my $i = 0;
7743 0 my @cluck = ();
7744 0 ▶ while (my($package,$filename,$line,$subroutine) = caller($i)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7745 0 push @cluck, "[$i] $filename($line) $package::$subroutine\n";
7746 0 $i++;
7747 }
7748 0 print STDERR CORE::reverse @cluck;
7749 0 print STDERR "\n";
7750 0 print STDERR @_;
7751 }
7752  
7753 #
7754 # instead of Carp::confess
7755 #
7756 0 ▶sub confess {
Subroutine confess: not called CC=2 SCAR=17.9
Pod undocumented
7757 0 my $i = 0;
7758 0 my @confess = ();
7759 0 ▶ while (my($package,$filename,$line,$subroutine) = caller($i)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7760 0 push @confess, "[$i] $filename($line) $package::$subroutine\n";
7761 0 $i++;
7762 }
7763 0 print STDERR CORE::reverse @confess;
7764 0 print STDERR "\n";
7765 0 print STDERR @_;
7766 0 die "\n";
7767 }
7768  
7769 422 1;
7770  
7771 __END__
↑ Summary blib/lib/Latin10.pm »