blib/lib/Elatin3.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/Latin3.pm »
1 package Elatin3;
2 422 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 ######################################################################
4 #
5 # Elatin3 - Run-time routines for Latin3.pm
6 #
7 # http://search.cpan.org/dist/Char-Latin3/
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 (&Elatin3::index($name, '::') >= 0) { } 0 15 15
elsif (&Elatin3::index($name, q[']) >= 0) { } 0 15 15
elsif ($name =~ /\A \^ [ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]+ \z/x) { } 0 15 15
elsif ($name =~ /\A (?: ARGV | ARGVOUT | ENV | INC | SIG | STDERR | STDIN | STDOUT ) \z/x) { } 0 15 15
elsif ($name =~ /\A [^ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz] \z/x) { } 0 15 15
elsif (defined $_[1]) { } 15 0 15
80 5 return $name;
81 }
82 elsif (Elatin3::index($name,'::') >= 0) {
83 0 return $name;
84 }
85 elsif (Elatin3::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-3 character range per length
158 #
159 422 my %range_tr = ();
160  
161 #
162 # Latin-3 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 Elatin3 \z/mosx }) { } 422 0 422
175 }
176  
177 elsif (__PACKAGE__ =~ / \b Elatin3 \z/oxms) {
178 422 %range_tr = (
179 1 => [ [0x00..0xFF],
180 ],
181 );
182  
183 422 %lc = (%lc,
184 "\xA1" => "\xB1", # LATIN LETTER H WITH STROKE
185 "\xA6" => "\xB6", # LATIN LETTER H WITH CIRCUMFLEX
186 "\xAA" => "\xBA", # LATIN LETTER S WITH CEDILLA
187 "\xAB" => "\xBB", # LATIN LETTER G WITH BREVE
188 "\xAC" => "\xBC", # LATIN LETTER J WITH CIRCUMFLEX
189 "\xAF" => "\xBF", # LATIN LETTER Z WITH DOT ABOVE
190 "\xC0" => "\xE0", # LATIN LETTER A WITH GRAVE
191 "\xC1" => "\xE1", # LATIN LETTER A WITH ACUTE
192 "\xC2" => "\xE2", # LATIN LETTER A WITH CIRCUMFLEX
193 "\xC4" => "\xE4", # LATIN LETTER A WITH DIAERESIS
194 "\xC5" => "\xE5", # LATIN LETTER C WITH DOT ABOVE
195 "\xC6" => "\xE6", # LATIN LETTER C WITH CIRCUMFLEX
196 "\xC7" => "\xE7", # LATIN LETTER C WITH CEDILLA
197 "\xC8" => "\xE8", # LATIN LETTER E WITH GRAVE
198 "\xC9" => "\xE9", # LATIN LETTER E WITH ACUTE
199 "\xCA" => "\xEA", # LATIN LETTER E WITH CIRCUMFLEX
200 "\xCB" => "\xEB", # LATIN LETTER E WITH DIAERESIS
201 "\xCC" => "\xEC", # LATIN LETTER I WITH GRAVE
202 "\xCD" => "\xED", # LATIN LETTER I WITH ACUTE
203 "\xCE" => "\xEE", # LATIN LETTER I WITH CIRCUMFLEX
204 "\xCF" => "\xEF", # LATIN LETTER I WITH DIAERESIS
205 "\xD1" => "\xF1", # LATIN LETTER N WITH TILDE
206 "\xD2" => "\xF2", # LATIN LETTER O WITH GRAVE
207 "\xD3" => "\xF3", # LATIN LETTER O WITH ACUTE
208 "\xD4" => "\xF4", # LATIN LETTER O WITH CIRCUMFLEX
209 "\xD5" => "\xF5", # LATIN LETTER G WITH DOT ABOVE
210 "\xD6" => "\xF6", # LATIN LETTER O WITH DIAERESIS
211 "\xD8" => "\xF8", # LATIN LETTER G WITH CIRCUMFLEX
212 "\xD9" => "\xF9", # LATIN LETTER U WITH GRAVE
213 "\xDA" => "\xFA", # LATIN LETTER U WITH ACUTE
214 "\xDB" => "\xFB", # LATIN LETTER U WITH CIRCUMFLEX
215 "\xDC" => "\xFC", # LATIN LETTER U WITH DIAERESIS
216 "\xDD" => "\xFD", # LATIN LETTER U WITH BREVE
217 "\xDE" => "\xFE", # LATIN LETTER S WITH CIRCUMFLEX
218 );
219  
220 422 %uc = (%uc,
221 "\xB1" => "\xA1", # LATIN LETTER H WITH STROKE
222 "\xB6" => "\xA6", # LATIN LETTER H WITH CIRCUMFLEX
223 "\xBA" => "\xAA", # LATIN LETTER S WITH CEDILLA
224 "\xBB" => "\xAB", # LATIN LETTER G WITH BREVE
225 "\xBC" => "\xAC", # LATIN LETTER J WITH CIRCUMFLEX
226 "\xBF" => "\xAF", # LATIN LETTER Z WITH DOT ABOVE
227 "\xE0" => "\xC0", # LATIN LETTER A WITH GRAVE
228 "\xE1" => "\xC1", # LATIN LETTER A WITH ACUTE
229 "\xE2" => "\xC2", # LATIN LETTER A WITH CIRCUMFLEX
230 "\xE4" => "\xC4", # LATIN LETTER A WITH DIAERESIS
231 "\xE5" => "\xC5", # LATIN LETTER C WITH DOT ABOVE
232 "\xE6" => "\xC6", # LATIN LETTER C WITH CIRCUMFLEX
233 "\xE7" => "\xC7", # LATIN LETTER C WITH CEDILLA
234 "\xE8" => "\xC8", # LATIN LETTER E WITH GRAVE
235 "\xE9" => "\xC9", # LATIN LETTER E WITH ACUTE
236 "\xEA" => "\xCA", # LATIN LETTER E WITH CIRCUMFLEX
237 "\xEB" => "\xCB", # LATIN LETTER E WITH DIAERESIS
238 "\xEC" => "\xCC", # LATIN LETTER I WITH GRAVE
239 "\xED" => "\xCD", # LATIN LETTER I WITH ACUTE
240 "\xEE" => "\xCE", # LATIN LETTER I WITH CIRCUMFLEX
241 "\xEF" => "\xCF", # LATIN LETTER I WITH DIAERESIS
242 "\xF1" => "\xD1", # LATIN LETTER N WITH TILDE
243 "\xF2" => "\xD2", # LATIN LETTER O WITH GRAVE
244 "\xF3" => "\xD3", # LATIN LETTER O WITH ACUTE
245 "\xF4" => "\xD4", # LATIN LETTER O WITH CIRCUMFLEX
246 "\xF5" => "\xD5", # LATIN LETTER G WITH DOT ABOVE
247 "\xF6" => "\xD6", # LATIN LETTER O WITH DIAERESIS
248 "\xF8" => "\xD8", # LATIN LETTER G WITH CIRCUMFLEX
249 "\xF9" => "\xD9", # LATIN LETTER U WITH GRAVE
250 "\xFA" => "\xDA", # LATIN LETTER U WITH ACUTE
251 "\xFB" => "\xDB", # LATIN LETTER U WITH CIRCUMFLEX
252 "\xFC" => "\xDC", # LATIN LETTER U WITH DIAERESIS
253 "\xFD" => "\xDD", # LATIN LETTER U WITH BREVE
254 "\xFE" => "\xDE", # LATIN LETTER S WITH CIRCUMFLEX
255 );
256  
257 422 %fc = (%fc,
258 "\xA1" => "\xB1", # LATIN CAPITAL LETTER H WITH STROKE --> LATIN SMALL LETTER H WITH STROKE
259 "\xA6" => "\xB6", # LATIN CAPITAL LETTER H WITH CIRCUMFLEX --> LATIN SMALL LETTER H WITH CIRCUMFLEX
260  
261 # CaseFolding-6.1.0.txt
262 # Date: 2011-07-25, 21:21:56 GMT [MD]
263 #
264 # T: special case for uppercase I and dotted uppercase I
265 # - For non-Turkic languages, this mapping is normally not used.
266 # - For Turkic languages (tr, az), this mapping can be used instead of the normal mapping for these characters.
267 # Note that the Turkic mappings do not maintain canonical equivalence without additional processing.
268 # See the discussions of case mapping in the Unicode Standard for more information.
269  
270 #-------------------------------------------------------------------------------
271 "\xA9" => "\x69", # LATIN CAPITAL LETTER I WITH DOT ABOVE
272 # --> LATIN SMALL LETTER I (without COMBINING DOT ABOVE)
273 #-------------------------------------------------------------------------------
274  
275 "\xAA" => "\xBA", # LATIN CAPITAL LETTER S WITH CEDILLA --> LATIN SMALL LETTER S WITH CEDILLA
276 "\xAB" => "\xBB", # LATIN CAPITAL LETTER G WITH BREVE --> LATIN SMALL LETTER G WITH BREVE
277 "\xAC" => "\xBC", # LATIN CAPITAL LETTER J WITH CIRCUMFLEX --> LATIN SMALL LETTER J WITH CIRCUMFLEX
278 "\xAF" => "\xBF", # LATIN CAPITAL LETTER Z WITH DOT ABOVE --> LATIN SMALL LETTER Z WITH DOT ABOVE
279 "\xC0" => "\xE0", # LATIN CAPITAL LETTER A WITH GRAVE --> LATIN SMALL LETTER A WITH GRAVE
280 "\xC1" => "\xE1", # LATIN CAPITAL LETTER A WITH ACUTE --> LATIN SMALL LETTER A WITH ACUTE
281 "\xC2" => "\xE2", # LATIN CAPITAL LETTER A WITH CIRCUMFLEX --> LATIN SMALL LETTER A WITH CIRCUMFLEX
282 "\xC4" => "\xE4", # LATIN CAPITAL LETTER A WITH DIAERESIS --> LATIN SMALL LETTER A WITH DIAERESIS
283 "\xC5" => "\xE5", # LATIN CAPITAL LETTER C WITH DOT ABOVE --> LATIN SMALL LETTER C WITH DOT ABOVE
284 "\xC6" => "\xE6", # LATIN CAPITAL LETTER C WITH CIRCUMFLEX --> LATIN SMALL LETTER C WITH CIRCUMFLEX
285 "\xC7" => "\xE7", # LATIN CAPITAL LETTER C WITH CEDILLA --> LATIN SMALL LETTER C WITH CEDILLA
286 "\xC8" => "\xE8", # LATIN CAPITAL LETTER E WITH GRAVE --> LATIN SMALL LETTER E WITH GRAVE
287 "\xC9" => "\xE9", # LATIN CAPITAL LETTER E WITH ACUTE --> LATIN SMALL LETTER E WITH ACUTE
288 "\xCA" => "\xEA", # LATIN CAPITAL LETTER E WITH CIRCUMFLEX --> LATIN SMALL LETTER E WITH CIRCUMFLEX
289 "\xCB" => "\xEB", # LATIN CAPITAL LETTER E WITH DIAERESIS --> LATIN SMALL LETTER E WITH DIAERESIS
290 "\xCC" => "\xEC", # LATIN CAPITAL LETTER I WITH GRAVE --> LATIN SMALL LETTER I WITH GRAVE
291 "\xCD" => "\xED", # LATIN CAPITAL LETTER I WITH ACUTE --> LATIN SMALL LETTER I WITH ACUTE
292 "\xCE" => "\xEE", # LATIN CAPITAL LETTER I WITH CIRCUMFLEX --> LATIN SMALL LETTER I WITH CIRCUMFLEX
293 "\xCF" => "\xEF", # LATIN CAPITAL LETTER I WITH DIAERESIS --> LATIN SMALL LETTER I WITH DIAERESIS
294 "\xD1" => "\xF1", # LATIN CAPITAL LETTER N WITH TILDE --> LATIN SMALL LETTER N WITH TILDE
295 "\xD2" => "\xF2", # LATIN CAPITAL LETTER O WITH GRAVE --> LATIN SMALL LETTER O WITH GRAVE
296 "\xD3" => "\xF3", # LATIN CAPITAL LETTER O WITH ACUTE --> LATIN SMALL LETTER O WITH ACUTE
297 "\xD4" => "\xF4", # LATIN CAPITAL LETTER O WITH CIRCUMFLEX --> LATIN SMALL LETTER O WITH CIRCUMFLEX
298 "\xD5" => "\xF5", # LATIN CAPITAL LETTER G WITH DOT ABOVE --> LATIN SMALL LETTER G WITH DOT ABOVE
299 "\xD6" => "\xF6", # LATIN CAPITAL LETTER O WITH DIAERESIS --> LATIN SMALL LETTER O WITH DIAERESIS
300 "\xD8" => "\xF8", # LATIN CAPITAL LETTER G WITH CIRCUMFLEX --> LATIN SMALL LETTER G WITH CIRCUMFLEX
301 "\xD9" => "\xF9", # LATIN CAPITAL LETTER U WITH GRAVE --> LATIN SMALL LETTER U WITH GRAVE
302 "\xDA" => "\xFA", # LATIN CAPITAL LETTER U WITH ACUTE --> LATIN SMALL LETTER U WITH ACUTE
303 "\xDB" => "\xFB", # LATIN CAPITAL LETTER U WITH CIRCUMFLEX --> LATIN SMALL LETTER U WITH CIRCUMFLEX
304 "\xDC" => "\xFC", # LATIN CAPITAL LETTER U WITH DIAERESIS --> LATIN SMALL LETTER U WITH DIAERESIS
305 "\xDD" => "\xFD", # LATIN CAPITAL LETTER U WITH BREVE --> LATIN SMALL LETTER U WITH BREVE
306 "\xDE" => "\xFE", # LATIN CAPITAL LETTER S WITH CIRCUMFLEX --> LATIN SMALL LETTER S WITH CIRCUMFLEX
307 "\xDF" => "\x73\x73", # LATIN SMALL LETTER SHARP S --> LATIN SMALL LETTER S, LATIN SMALL LETTER S
308 );
309 }
310  
311 else {
312 0 croak "Don't know my package name '@{[__PACKAGE__]}'";
313 }
314  
315 #
316 # @ARGV wildcard globbing
317 #
318 211 ▶sub import {
Subroutine import: called CC=7 SCAR=28.3
319  
320 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
321 0 my @argv = ();
322 0 for (@ARGV) {
323  
324 # has space
325 0 ▶ if (/\A (?:$q_char)*? [ ] /oxms) {
Branch: 2 branches
BranchTrueFalseTotal
if (/\A (?:$Elatin3::q_char)*? [ ] /mosx) { } 0 0 0
elsif (/\A (?:$Elatin3::q_char)*? [*?] /mosx) { } 0 0 0
326 0 ▶ if (my @glob = Elatin3::glob(qq{"$_"})) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@glob) = &Elatin3::glob(qq["$_"])) { } 0 0 0
327 0 push @argv, @glob;
328 }
329 else {
330 0 push @argv, $_;
331 }
332 }
333  
334 # has wildcard metachar
335 elsif (/\A (?:$q_char)*? [*?] /oxms) {
336 0 ▶ if (my @glob = Elatin3::glob($_)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@glob) = &Elatin3::glob($_)) { } 0 0 0
337 0 push @argv, @glob;
338 }
339 else {
340 0 push @argv, $_;
341 }
342 }
343  
344 # no wildcard globbing
345 else {
346 0 push @argv, $_;
347 }
348 }
349 0 @ARGV = @argv;
350 }
351  
352 211 *Char::ord = \&Latin3::ord;
353 211 *Char::ord_ = \&Latin3::ord_;
354 211 *Char::reverse = \&Latin3::reverse;
355 211 *Char::getc = \&Latin3::getc;
356 211 *Char::length = \&Latin3::length;
357 211 *Char::substr = \&Latin3::substr;
358 211 *Char::index = \&Latin3::index;
359 211 *Char::rindex = \&Latin3::rindex;
360 211 *Char::eval = \&Latin3::eval;
361 211 *Char::escape = \&Latin3::escape;
362 211 *Char::escape_token = \&Latin3::escape_token;
363 211 *Char::escape_script = \&Latin3::escape_script;
364 }
365  
366 # P.230 Care with Prototypes
367 # in Chapter 6: Subroutines
368 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
369 #
370 # If you aren't careful, you can get yourself into trouble with prototypes.
371 # But if you are careful, you can do a lot of neat things with them. This is
372 # all very powerful, of course, and should only be used in moderation to make
373 # the world a better place.
374  
375 # P.332 Care with Prototypes
376 # in Chapter 7: Subroutines
377 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
378 #
379 # If you aren't careful, you can get yourself into trouble with prototypes.
380 # But if you are careful, you can do a lot of neat things with them. This is
381 # all very powerful, of course, and should only be used in moderation to make
382 # the world a better place.
383  
384 #
385 # Prototypes of subroutines
386 #
387 0 ▶sub unimport {}
Subroutine unimport: not called CC=1 SCAR=0.0
388 sub Elatin3::split(;$$$);
389 sub Elatin3::tr($$$$;$);
390 sub Elatin3::chop(@);
391 sub Elatin3::index($$;$);
392 sub Elatin3::rindex($$;$);
393 sub Elatin3::lcfirst(@);
394 sub Elatin3::lcfirst_();
395 sub Elatin3::lc(@);
396 sub Elatin3::lc_();
397 sub Elatin3::ucfirst(@);
398 sub Elatin3::ucfirst_();
399 sub Elatin3::uc(@);
400 sub Elatin3::uc_();
401 sub Elatin3::fc(@);
402 sub Elatin3::fc_();
403 sub Elatin3::ignorecase;
404 sub Elatin3::classic_character_class;
405 sub Elatin3::capture;
406 sub Elatin3::chr(;$);
407 sub Elatin3::chr_();
408 sub Elatin3::glob($);
409 sub Elatin3::glob_();
410  
411 sub Latin3::ord(;$);
412 sub Latin3::ord_();
413 sub Latin3::reverse(@);
414 sub Latin3::getc(;*@);
415 sub Latin3::length(;$);
416 sub Latin3::substr($$;$$);
417 sub Latin3::index($$;$);
418 sub Latin3::rindex($$;$);
419 sub Latin3::escape(;$);
420  
421 #
422 # Regexp work
423 #
424 422 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
425 $re_a
426 $re_t
427 $re_n
428 $re_r
429 422 );
430  
431 #
432 # Character class
433 #
434 422 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
435 $dot
436 $dot_s
437 $eD
438 $eS
439 $eW
440 $eH
441 $eV
442 $eR
443 $eN
444 $not_alnum
445 $not_alpha
446 $not_ascii
447 $not_blank
448 $not_cntrl
449 $not_digit
450 $not_graph
451 $not_lower
452 $not_lower_i
453 $not_print
454 $not_punct
455 $not_space
456 $not_upper
457 $not_upper_i
458 $not_word
459 $not_xdigit
460 $eb
461 $eB
462 422 );
463  
464 422 ${Elatin3::dot} = qr{(?>[^\x0A])};
465 422 ${Elatin3::dot_s} = qr{(?>[\x00-\xFF])};
466 422 ${Elatin3::eD} = qr{(?>[^0-9])};
467  
468 # Vertical tabs are now whitespace
469 # \s in a regex now matches a vertical tab in all circumstances.
470 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
471 # ${Elatin3::eS} = qr{(?>[^\x09\x0A \x0C\x0D\x20])};
472 # ${Elatin3::eS} = qr{(?>[^\x09\x0A\x0B\x0C\x0D\x20])};
473 422 ${Elatin3::eS} = qr{(?>[^\s])};
474  
475 422 ${Elatin3::eW} = qr{(?>[^0-9A-Z_a-z])};
476 422 ${Elatin3::eH} = qr{(?>[^\x09\x20])};
477 422 ${Elatin3::eV} = qr{(?>[^\x0A\x0B\x0C\x0D])};
478 422 ${Elatin3::eR} = qr{(?>\x0D\x0A|[\x0A\x0D])};
479 422 ${Elatin3::eN} = qr{(?>[^\x0A])};
480 422 ${Elatin3::not_alnum} = qr{(?>[^\x30-\x39\x41-\x5A\x61-\x7A])};
481 422 ${Elatin3::not_alpha} = qr{(?>[^\x41-\x5A\x61-\x7A])};
482 422 ${Elatin3::not_ascii} = qr{(?>[^\x00-\x7F])};
483 422 ${Elatin3::not_blank} = qr{(?>[^\x09\x20])};
484 422 ${Elatin3::not_cntrl} = qr{(?>[^\x00-\x1F\x7F])};
485 422 ${Elatin3::not_digit} = qr{(?>[^\x30-\x39])};
486 422 ${Elatin3::not_graph} = qr{(?>[^\x21-\x7F])};
487 422 ${Elatin3::not_lower} = qr{(?>[^\x61-\x7A])};
488 422 ${Elatin3::not_lower_i} = qr{(?>[^\x41-\x5A\x61-\x7A])}; # Perl 5.16 compatible
489 # ${Elatin3::not_lower_i} = qr{(?>[\x00-\xFF])}; # older Perl compatible
490 422 ${Elatin3::not_print} = qr{(?>[^\x20-\x7F])};
491 422 ${Elatin3::not_punct} = qr{(?>[^\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E])};
492 422 ${Elatin3::not_space} = qr{(?>[^\s\x0B])};
493 422 ${Elatin3::not_upper} = qr{(?>[^\x41-\x5A])};
494 422 ${Elatin3::not_upper_i} = qr{(?>[^\x41-\x5A\x61-\x7A])}; # Perl 5.16 compatible
495 # ${Elatin3::not_upper_i} = qr{(?>[\x00-\xFF])}; # older Perl compatible
496 422 ${Elatin3::not_word} = qr{(?>[^\x30-\x39\x41-\x5A\x5F\x61-\x7A])};
497 422 ${Elatin3::not_xdigit} = qr{(?>[^\x30-\x39\x41-\x46\x61-\x66])};
498 422 ${Elatin3::eb} = qr{(?:\A(?=[0-9A-Z_a-z])|(?<=[\x00-\x2F\x40\x5B-\x5E\x60\x7B-\xFF])(?=[0-9A-Z_a-z])|(?<=[0-9A-Z_a-z])(?=[\x00-\x2F\x40\x5B-\x5E\x60\x7B-\xFF]|\z))};
499 422 ${Elatin3::eB} = qr{(?:(?<=[0-9A-Z_a-z])(?=[0-9A-Z_a-z])|(?<=[\x00-\x2F\x40\x5B-\x5E\x60\x7B-\xFF])(?=[\x00-\x2F\x40\x5B-\x5E\x60\x7B-\xFF]))};
500  
501 # avoid: Name "Elatin3::foo" used only once: possible typo at here.
502 422 ${Elatin3::dot} = ${Elatin3::dot};
503 422 ${Elatin3::dot_s} = ${Elatin3::dot_s};
504 422 ${Elatin3::eD} = ${Elatin3::eD};
505 422 ${Elatin3::eS} = ${Elatin3::eS};
506 422 ${Elatin3::eW} = ${Elatin3::eW};
507 422 ${Elatin3::eH} = ${Elatin3::eH};
508 422 ${Elatin3::eV} = ${Elatin3::eV};
509 422 ${Elatin3::eR} = ${Elatin3::eR};
510 422 ${Elatin3::eN} = ${Elatin3::eN};
511 422 ${Elatin3::not_alnum} = ${Elatin3::not_alnum};
512 422 ${Elatin3::not_alpha} = ${Elatin3::not_alpha};
513 422 ${Elatin3::not_ascii} = ${Elatin3::not_ascii};
514 422 ${Elatin3::not_blank} = ${Elatin3::not_blank};
515 422 ${Elatin3::not_cntrl} = ${Elatin3::not_cntrl};
516 422 ${Elatin3::not_digit} = ${Elatin3::not_digit};
517 422 ${Elatin3::not_graph} = ${Elatin3::not_graph};
518 422 ${Elatin3::not_lower} = ${Elatin3::not_lower};
519 422 ${Elatin3::not_lower_i} = ${Elatin3::not_lower_i};
520 422 ${Elatin3::not_print} = ${Elatin3::not_print};
521 422 ${Elatin3::not_punct} = ${Elatin3::not_punct};
522 422 ${Elatin3::not_space} = ${Elatin3::not_space};
523 422 ${Elatin3::not_upper} = ${Elatin3::not_upper};
524 422 ${Elatin3::not_upper_i} = ${Elatin3::not_upper_i};
525 422 ${Elatin3::not_word} = ${Elatin3::not_word};
526 422 ${Elatin3::not_xdigit} = ${Elatin3::not_xdigit};
527 422 ${Elatin3::eb} = ${Elatin3::eb};
528 422 ${Elatin3::eB} = ${Elatin3::eB};
529  
530 #
531 # Latin-3 split
532 #
533 72 ▶sub Elatin3::split(;$$$) {
Subroutine split: called CC=34 SCAR=46.9
Pod undocumented
534  
535 # P.794 29.2.161. split
536 # in Chapter 29: Functions
537 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
538  
539 # P.951 split
540 # in Chapter 27: Functions
541 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
542  
543 72 my $pattern = $_[0];
544 72 my $string = $_[1];
545 72 my $limit = $_[2];
546  
547 # if $pattern is also omitted or is the literal space, " "
548 72 ▶ if (not defined $pattern) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $pattern) 2 70 72
549 2 $pattern = ' ';
550 }
551  
552 # if $string is omitted, the function splits the $_ string
553 72 ▶ if (not defined $string) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $string) 6 66 72
554 6 ▶ if (defined $_) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_) { } 0 6 6
555 0 $string = $_;
556 }
557 else {
558 6 $string = '';
559 }
560 }
561  
562 72 my @split = ();
563  
564 # when string is empty
565 72 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 10 62 72
elsif ($pattern eq ' ') { } 2 60 62
566  
567 # resulting list value in list context
568 10 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 5 5 10
569 5 return @split;
570 }
571  
572 # count of substrings in scalar context
573 else {
574 5 ▶ carp "Use of implicit split to \@_ is deprecated" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 5 5
575 5 @_ = @split;
576 5 return scalar @_;
577 }
578 }
579  
580 # split's first argument is more consistently interpreted
581 #
582 # After some changes earlier in v5.17, split's behavior has been simplified:
583 # if the PATTERN argument evaluates to a string containing one space, it is
584 # treated the way that a literal string containing one space once was.
585 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#split's_first_argument_is_more_consistently_interpreted
586  
587 # if $pattern is also omitted or is the literal space, " ", the function splits
588 # on whitespace, /\s+/, after skipping any leading whitespace
589 # (and so on)
590  
591 elsif ($pattern eq ' ') {
592 2 ▶ if (not defined $limit) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $limit) { } 2 0 2
593 2 return CORE::split(' ', $string);
594 }
595 else {
596 0 return CORE::split(' ', $string, $limit);
597 }
598 }
599  
600 # if $limit is negative, it is treated as if an arbitrarily large $limit has been specified
601 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
602  
603 # a pattern capable of matching either the null string or something longer than the
604 # null string will split the value of $string into separate characters wherever it
605 # matches the null string between characters
606 # (and so on)
607  
608 60 ▶ if ('' =~ / \A $pattern \z /xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ('' =~ / \A $pattern \z /msx) { } 2 58 60
609 2 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
610 2 my $limit = scalar(() = $string =~ /($pattern)/oxmsg);
611  
612 # P.1024 Appendix W.10 Multibyte Processing
613 # of ISBN 1-56592-224-7 CJKV Information Processing
614 # (and so on)
615  
616 # the //m modifier is assumed when you split on the pattern /^/
617 # (and so on)
618  
619 # V
620 2 ▶ while ((--$limit > 0) and ($string =~ s/\A((?:$q_char)+?)$pattern//m)) {
Branch: 1 branch
BranchTrueFalseTotal
if (--$limit > 0 and $string =~ s/\A((?:$Elatin3::q_char)+?)$pattern//m) 9 2 11
Condition100%3/3
--$limit > 0 and $string =~ s/\A((?:$Elatin3::q_char)+?)$pattern//m
!ll&&!rl&&r
119
MC/DC100%2/2
--$limit > 0 and $string =~ s/\A((?:$Elatin3::q_char)+?)$pattern//m
--$limit > 0 $string =~ s/\A((?:$Elatin3::q_char)+?)$pattern//m
Truth table100%3/3
A and B
A= --$limit > 0B= $string =~ s/\A((?:$Elatin3::q_char)+?)$pattern//m
ABresult
0X0
100
111
621  
622 # if the $pattern contains parentheses, then the substring matched by each pair of parentheses
623 # is included in the resulting list, interspersed with the fields that are ordinarily returned
624 # (and so on)
625  
626 9 local $@;
627 9 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 9 9 18
628 9 push @split, CORE::eval('$' . $digit);
629 }
630 }
631 }
632  
633 else {
634 58 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
635  
636 # V
637 58 ▶ while ($string =~ s/\A((?:$q_char)*?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Elatin3::q_char)*?)$pattern//m) 163 58 221
638 163 local $@;
639 163 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 230 163 393
640 230 push @split, CORE::eval('$' . $digit);
641 }
642 }
643 }
644 }
645  
646 elsif ($limit > 0) {
647 0 ▶ if ('' =~ / \A $pattern \z /xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ('' =~ / \A $pattern \z /msx) { } 0 0 0
648 0 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
649 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
650  
651 # V
652 0 ▶ if ($string =~ s/\A((?:$q_char)+?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Elatin3::q_char)+?)$pattern//m) 0 0 0
653 0 local $@;
654 0 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 0 0 0
655 0 push @split, CORE::eval('$' . $digit);
656 }
657 }
658 }
659 }
660 else {
661 0 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
662 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
663  
664 # V
665 0 ▶ if ($string =~ s/\A((?:$q_char)*?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Elatin3::q_char)*?)$pattern//m) 0 0 0
666 0 local $@;
667 0 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 0 0 0
668 0 push @split, CORE::eval('$' . $digit);
669 }
670 }
671 }
672 }
673 }
674  
675 60 ▶ if (CORE::length($string) > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $string > 0) 58 2 60
676 58 push @split, $string;
677 }
678  
679 # if $_[2] (NOT "$limit") is omitted or zero, trailing null fields are stripped from the result
680 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
681 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
682 0 pop @split;
683 }
684 }
685  
686 # resulting list value in list context
687 60 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 58 2 60
688 58 return @split;
689 }
690  
691 # count of substrings in scalar context
692 else {
693 2 ▶ carp "Use of implicit split to \@_ is deprecated" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 2 2
694 2 @_ = @split;
695 2 return scalar @_;
696 }
697 }
698  
699 #
700 # get last subexpression offsets
701 #
702 60 ▶sub _last_subexpression_offsets {
Subroutine _last_subexpression_offsets: called CC=3 SCAR=11.0
703 60 my $pattern = $_[0];
704  
705 # remove comment
706 60 $pattern =~ s/\(\?\# .*? \)//oxmsg;
707  
708 60 my $modifier = '';
709 60 ▶ if ($pattern =~ /\(\?\^? ([\-A-Za-z]+) :/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pattern =~ /\(\?\^? ([\-A-Za-z]+) :/mosx) 11 49 60
710 11 $modifier = $1;
711 11 $modifier =~ s/-[A-Za-z]*//;
712 }
713  
714 # with /x modifier
715 60 my @char = ();
716 60 ▶ if ($modifier =~ /x/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /x/mosx) { } 5 55 60
717 5 @char = $pattern =~ /\G((?>
718 [^\\\#\[\(] |
719 \\ $q_char |
720 \# (?>[^\n]*) $ |
721 \[ (?>(?:[^\\\]]|\\\\|\\\]|$q_char)+) \] |
722 \(\? |
723 $q_char
724 ))/oxmsg;
725 }
726  
727 # without /x modifier
728 else {
729 55 @char = $pattern =~ /\G((?>
730 [^\\\[\(] |
731 \\ $q_char |
732 \[ (?>(?:[^\\\]]|\\\\|\\\]|$q_char)+) \] |
733 \(\? |
734 $q_char
735 ))/oxmsg;
736 }
737  
738 60 return scalar grep { $_ eq '(' } @char;
739 }
740  
741 #
742 # Latin-3 transliteration (tr///)
743 #
744 6 ▶sub Elatin3::tr($$$$;$) {
Subroutine tr: called CC=26 SCAR=48.6
Pod undocumented
745  
746 6 my $bind_operator = $_[1];
747 6 my $searchlist = $_[2];
748 6 my $replacementlist = $_[3];
749 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
750  
751 6 ▶ if ($modifier =~ /r/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /r/mosx) 5 1 6
752 5 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) 0 5 5
753 0 croak "Using !~ with tr///r doesn't make sense";
754 }
755 }
756  
757 6 my @char = $_[0] =~ /\G (?>$q_char) /oxmsg;
758 6 my @searchlist = _charlist_tr($searchlist);
759 6 my @replacementlist = _charlist_tr($replacementlist);
760  
761 6 my %tr = ();
762 6 ▶ for (my $i=0; $i <= $#searchlist; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#searchlist) 19 6 25
763 19 ▶ if (not exists $tr{$searchlist[$i]}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $tr{$searchlist[$i]}) 19 0 19
764 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
765 19 $tr{$searchlist[$i]} = $replacementlist[$i];
766 }
767 elsif ($modifier =~ /d/oxms) {
768 0 $tr{$searchlist[$i]} = '';
769 }
770 ▶ 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
771 0 $tr{$searchlist[$i]} = $replacementlist[-1];
772 }
773 else {
774 0 $tr{$searchlist[$i]} = $searchlist[$i];
775 }
776 }
777 }
778  
779 6 my $tr = 0;
780 6 my $replaced = '';
781 6 ▶ if ($modifier =~ /c/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /c/mosx) { } 0 6 6
782 0 ▶ while (defined(my $char = shift @char)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $char = shift @char)) 0 0 0
783 0 ▶ if (not exists $tr{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $tr{$char}) { } 0 0 0
784 0 ▶ if (defined $replacementlist[0]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $replacementlist[0]) 0 0 0
785 0 $replaced .= $replacementlist[0];
786 }
787 0 $tr++;
788 0 ▶ if ($modifier =~ /s/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/mosx) 0 0 0
789 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
790 0 shift @char;
791 0 $tr++;
792 }
793 }
794 }
795 else {
796 0 $replaced .= $char;
797 }
798 }
799 }
800 else {
801 6 ▶ while (defined(my $char = shift @char)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $char = shift @char)) 36 6 42
802 36 ▶ if (exists $tr{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $tr{$char}) { } 19 17 36
803 19 $replaced .= $tr{$char};
804 19 $tr++;
805 19 ▶ if ($modifier =~ /s/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/mosx) 0 19 19
806 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
807 0 shift @char;
808 0 $tr++;
809 }
810 }
811 }
812 else {
813 17 $replaced .= $char;
814 }
815 }
816 }
817  
818 6 ▶ if ($modifier =~ /r/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /r/mosx) { } 5 1 6
819 5 return $replaced;
820 }
821 else {
822 1 $_[0] = $replaced;
823 1 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) { } 0 1 1
824 0 return not $tr;
825 }
826 else {
827 1 return $tr;
828 }
829 }
830 }
831  
832 #
833 # Latin-3 chop
834 #
835 0 ▶sub Elatin3::chop(@) {
Subroutine chop: not called CC=3 SCAR=24.8
Pod undocumented
836  
837 0 my $chop;
838 0 ▶ if (@_ == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 0) { } 0 0 0
839 0 my @char = /\G (?>$q_char) /oxmsg;
840 0 $chop = pop @char;
841 0 $_ = join '', @char;
842 }
843 else {
844 0 for (@_) {
845 0 my @char = /\G (?>$q_char) /oxmsg;
846 0 $chop = pop @char;
847 0 $_ = join '', @char;
848 }
849 }
850 0 return $chop;
851 }
852  
853 #
854 # Latin-3 index by octet
855 #
856 30 ▶sub Elatin3::index($$;$) {
Subroutine index: called CC=6 SCAR=20.8
Pod documented
857  
858 30 my($str,$substr,$position) = @_;
859 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
860 30 my $pos = 0;
861  
862 30 ▶ while ($pos < CORE::length($str)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos < length $str) 130 30 160
863 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
864 0 ▶ if ($pos >= $position) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos >= $position) 0 0 0
865 0 return $pos;
866 }
867 }
868 130 ▶ if (CORE::substr($str,$pos) =~ /\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($str, $pos) =~ /\A ($Elatin3::q_char) /mosx) { } 130 0 130
869 130 $pos += CORE::length($1);
870 }
871 else {
872 0 $pos += 1;
873 }
874 }
875 30 return -1;
876 }
877  
878 #
879 # Latin-3 reverse index
880 #
881 0 ▶sub Elatin3::rindex($$;$) {
Subroutine rindex: not called CC=6 SCAR=37.4
Pod undocumented
882  
883 0 my($str,$substr,$position) = @_;
884 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
885 0 my $pos = 0;
886 0 my $rindex = -1;
887  
888 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
889 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
890 0 $rindex = $pos;
891 }
892 0 ▶ if (CORE::substr($str,$pos) =~ /\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($str, $pos) =~ /\A ($Elatin3::q_char) /mosx) { } 0 0 0
893 0 $pos += CORE::length($1);
894 }
895 else {
896 0 $pos += 1;
897 }
898 }
899 0 return $rindex;
900 }
901  
902 #
903 # Latin-3 lower case first with parameter
904 #
905 0 ▶sub Elatin3::lcfirst(@) {
Subroutine lcfirst: not called CC=4 SCAR=30.0
Pod undocumented
906 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
907 0 my $s = shift @_;
908 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
909 0 return Elatin3::lc(CORE::substr($s,0,1)) . CORE::substr($s,1), @_;
910 }
911 else {
912 0 return Elatin3::lc(CORE::substr($s,0,1)) . CORE::substr($s,1);
913 }
914 }
915 else {
916 0 return Elatin3::lc(CORE::substr($_,0,1)) . CORE::substr($_,1);
917 }
918 }
919  
920 #
921 # Latin-3 lower case first without parameter
922 #
923 0 ▶sub Elatin3::lcfirst_() {
Subroutine lcfirst_: not called CC=1 SCAR=6.9
Pod undocumented
924 0 return Elatin3::lc(CORE::substr($_,0,1)) . CORE::substr($_,1);
925 }
926  
927 #
928 # Latin-3 lower case with parameter
929 #
930 61 ▶sub Elatin3::lc(@) {
Subroutine lc: called CC=6 SCAR=24.2
Pod undocumented
931 61 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 61 0 61
932 61 my $s = shift @_;
933 61 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 61 61
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
6100
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
934 0 ▶ return join('', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 0 0 0
935 }
936 else {
937 61 ▶ return join('', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 63 0 63
938 }
939 }
940 else {
941 0 return Elatin3::lc_();
942 }
943 }
944  
945 #
946 # Latin-3 lower case without parameter
947 #
948 0 ▶sub Elatin3::lc_() {
Subroutine lc_: not called CC=2 SCAR=17.9
Pod undocumented
949 0 my $s = $_;
950 0 ▶ return join '', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 0 0 0
951 }
952  
953 #
954 # Latin-3 upper case first with parameter
955 #
956 0 ▶sub Elatin3::ucfirst(@) {
Subroutine ucfirst: not called CC=4 SCAR=30.0
Pod undocumented
957 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
958 0 my $s = shift @_;
959 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
960 0 return Elatin3::uc(CORE::substr($s,0,1)) . CORE::substr($s,1), @_;
961 }
962 else {
963 0 return Elatin3::uc(CORE::substr($s,0,1)) . CORE::substr($s,1);
964 }
965 }
966 else {
967 0 return Elatin3::uc(CORE::substr($_,0,1)) . CORE::substr($_,1);
968 }
969 }
970  
971 #
972 # Latin-3 upper case first without parameter
973 #
974 0 ▶sub Elatin3::ucfirst_() {
Subroutine ucfirst_: not called CC=1 SCAR=6.9
Pod undocumented
975 0 return Elatin3::uc(CORE::substr($_,0,1)) . CORE::substr($_,1);
976 }
977  
978 #
979 # Latin-3 upper case with parameter
980 #
981 2469 ▶sub Elatin3::uc(@) {
Subroutine uc: called CC=6 SCAR=22.9
Pod undocumented
982 2469 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2469 0 2469
983 2469 my $s = shift @_;
984 2469 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 2469 2469
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
246900
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
985 0 ▶ return join('', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 0 0 0
986 }
987 else {
988 2469 ▶ return join('', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 882 1589 2471
989 }
990 }
991 else {
992 0 return Elatin3::uc_();
993 }
994 }
995  
996 #
997 # Latin-3 upper case without parameter
998 #
999 0 ▶sub Elatin3::uc_() {
Subroutine uc_: not called CC=2 SCAR=17.9
Pod undocumented
1000 0 my $s = $_;
1001 0 ▶ return join '', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 0 0 0
1002 }
1003  
1004 #
1005 # Latin-3 fold case with parameter
1006 #
1007 2479 ▶sub Elatin3::fc(@) {
Subroutine fc: called CC=6 SCAR=22.9
Pod undocumented
1008 2479 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2479 0 2479
1009 2479 my $s = shift @_;
1010 2479 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 2479 2479
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
247900
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
1011 0 ▶ return join('', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 0 0 0
1012 }
1013 else {
1014 2479 ▶ return join('', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 1869 5819 7688
1015 }
1016 }
1017 else {
1018 0 return Elatin3::fc_();
1019 }
1020 }
1021  
1022 #
1023 # Latin-3 fold case without parameter
1024 #
1025 0 ▶sub Elatin3::fc_() {
Subroutine fc_: not called CC=2 SCAR=17.9
Pod undocumented
1026 0 my $s = $_;
1027 0 ▶ return join '', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 0 0 0
1028 }
1029  
1030 #
1031 # Latin-3 regexp capture
1032 #
1033 {
1034 0 ▶ sub Elatin3::capture {
Subroutine capture: not called CC=1 SCAR=6.9
Pod documented
1035 0 return $_[0];
1036 }
1037 }
1038  
1039 #
1040 # Latin-3 regexp ignore case modifier
1041 #
1042 422 ▶sub Elatin3::ignorecase {
Subroutine ignorecase: called CC=25 SCAR=52.1
Pod undocumented
1043  
1044 11 my @string = @_;
1045 11 my $metachar = qr/[\@\\|[\]{]/oxms;
1046  
1047 # ignore case of $scalar or @array
1048 11 for my $string (@string) {
1049  
1050 # split regexp
1051 11 my @char = $string =~ /\G (?>\[\^|\\$q_char|$q_char) /oxmsg;
1052  
1053 # unescape character
1054 11 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1004 11 1015
1055 1004 ▶ next if not defined $char[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $char[$i] 0 1004 1004
1056  
1057 # open character class [...]
1058 1004 ▶ if ($char[$i] eq '[') {
Branch: 4 branches
BranchTrueFalseTotal
if ($char[$i] eq '[') { } 0 1004 1004
elsif ($char[$i] eq '[^') { } 0 1004 1004
elsif (my $char = classic_character_class($char[$i])) { } 0 1004 1004
elsif ($char[$i] =~ /\A [\x00-\xFF] \z/mosx) { } 1004 0 1004
1059 0 my $left = $i;
1060  
1061 # [] make die "unmatched [] in regexp ...\n"
1062  
1063 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
1064 0 $i++;
1065 }
1066  
1067 0 while (1) {
1068 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
1069 0 croak "Unmatched [] in regexp";
1070 }
1071 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
1072 0 my $right = $i;
1073 0 my @charlist = charlist_qr(@char[$left+1..$right-1], 'i');
1074  
1075 # escape character
1076 0 for my $char (@charlist) {
1077 0 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $char =~ /\A [.|)] \z/mosx }) 0 0 0
1078 }
1079  
1080 0 elsif ($char =~ /\A [.|)] \z/oxms) {
1081 0 $char = '\\' . $char;
1082 }
1083 }
1084  
1085 # [...]
1086 0 splice @char, $left, $right-$left+1, '(?:' . join('|', @charlist) . ')';
1087  
1088 0 $i = $left;
1089 0 last;
1090 }
1091 }
1092 }
1093  
1094 # open character class [^...]
1095 elsif ($char[$i] eq '[^') {
1096 0 my $left = $i;
1097  
1098 # [^] make die "unmatched [] in regexp ...\n"
1099  
1100 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
1101 0 $i++;
1102 }
1103  
1104 0 while (1) {
1105 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
1106 0 croak "Unmatched [] in regexp";
1107 }
1108 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
1109 0 my $right = $i;
1110 0 my @charlist = charlist_not_qr(@char[$left+1..$right-1], 'i');
1111  
1112 # escape character
1113 0 for my $char (@charlist) {
1114 0 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $char =~ /\A [.|)] \z/mosx }) 0 0 0
1115 }
1116  
1117 0 elsif ($char =~ /\A [.|)] \z/oxms) {
1118 0 $char = '\\' . $char;
1119 }
1120 }
1121  
1122 # [^...]
1123 0 splice @char, $left, $right-$left+1, '(?!' . join('|', @charlist) . ")(?:$your_char)";
1124  
1125 0 $i = $left;
1126 0 last;
1127 }
1128 }
1129 }
1130  
1131 # rewrite classic character class or escape character
1132 elsif (my $char = classic_character_class($char[$i])) {
1133 0 $char[$i] = $char;
1134 }
1135  
1136 # with /i modifier
1137 elsif ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) {
1138 1004 my $uc = Elatin3::uc($char[$i]);
1139 1004 my $fc = Elatin3::fc($char[$i]);
1140 1004 ▶ if ($uc ne $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc ne $fc) 516 488 1004
1141 516 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 513 3 516
1142 513 $char[$i] = '[' . $uc . $fc . ']';
1143 }
1144 else {
1145 3 $char[$i] = '(?:' . $uc . '|' . $fc . ')';
1146 }
1147 }
1148 }
1149 }
1150  
1151 # characterize
1152 11 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1004 11 1015
1153 1004 ▶ next if not defined $char[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $char[$i] 0 1004 1004
1154  
1155 1004 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx }) 0 1015 1015
1156 }
1157  
1158 # quote character before ? + * {
1159 0 ▶ elsif (($i >= 1) and ($char[$i] =~ /\A [\?\+\*\{] \z/oxms)) {
Condition66%2/3
$i >= 1 && $char[$i] =~ /\A [\?\+\*\{] \z/mosx
!ll&&!rl&&r
119930
MC/DC0%0/2
$i >= 1 && $char[$i] =~ /\A [\?\+\*\{] \z/mosx
$i >= 1 $char[$i] =~ /\A [\?\+\*\{] \z/mosx
Truth table66%2/3
A && B
A= $i >= 1B= $char[$i] =~ /\A [\?\+\*\{] \z/mosx
ABresult
0X0
100
111
1160 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
1161 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
1162 }
1163 }
1164 }
1165  
1166 11 $string = join '', @char;
1167 }
1168  
1169 # make regexp string
1170 11 return @string;
1171 }
1172  
1173 #
1174 # classic character class ( \D \S \W \d \s \w \C \X \H \V \h \v \R \N \b \B )
1175 #
1176 2872 ▶sub Elatin3::classic_character_class {
Subroutine classic_character_class: called CC=2 SCAR=6.9
Pod undocumented
1177 2872 my($char) = @_;
1178  
1179 return {
1180 '\D' => '${Elatin3::eD}',
1181 '\S' => '${Elatin3::eS}',
1182 '\W' => '${Elatin3::eW}',
1183 '\d' => '[0-9]',
1184  
1185 # Before Perl 5.6, \s only matched the five whitespace characters
1186 # tab, newline, form-feed, carriage return, and the space character
1187 # itself, which, taken together, is the character class [\t\n\f\r ].
1188  
1189 # Vertical tabs are now whitespace
1190 # \s in a regex now matches a vertical tab in all circumstances.
1191 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
1192 # \t \n \v \f \r space
1193 # '\s' => '[\x09\x0A \x0C\x0D\x20]',
1194 # '\s' => '[\x09\x0A\x0B\x0C\x0D\x20]',
1195 '\s' => '\s',
1196  
1197 '\w' => '[0-9A-Z_a-z]',
1198 '\C' => '[\x00-\xFF]',
1199 '\X' => 'X',
1200  
1201 # \h \v \H \V
1202  
1203 # P.114 Character Class Shortcuts
1204 # in Chapter 7: In the World of Regular Expressions
1205 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
1206  
1207 # P.357 13.2.3 Whitespace
1208 # in Chapter 13: perlrecharclass: Perl Regular Expression Character Classes
1209 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
1210 #
1211 # 0x00009 CHARACTER TABULATION h s
1212 # 0x0000a LINE FEED (LF) vs
1213 # 0x0000b LINE TABULATION v
1214 # 0x0000c FORM FEED (FF) vs
1215 # 0x0000d CARRIAGE RETURN (CR) vs
1216 # 0x00020 SPACE h s
1217  
1218 # P.196 Table 5-9. Alphanumeric regex metasymbols
1219 # in Chapter 5. Pattern Matching
1220 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1221  
1222 # (and so on)
1223  
1224 '\H' => '${Elatin3::eH}',
1225 '\V' => '${Elatin3::eV}',
1226 '\h' => '[\x09\x20]',
1227 '\v' => '[\x0A\x0B\x0C\x0D]',
1228 '\R' => '${Elatin3::eR}',
1229  
1230 # \N
1231 #
1232 # http://perldoc.perl.org/perlre.html
1233 # Character Classes and other Special Escapes
1234 # Any character but \n (experimental). Not affected by /s modifier
1235  
1236 '\N' => '${Elatin3::eN}',
1237  
1238 # \b \B
1239  
1240 # P.180 Boundaries: The \b and \B Assertions
1241 # in Chapter 5: Pattern Matching
1242 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
1243  
1244 # P.219 Boundaries: The \b and \B Assertions
1245 # in Chapter 5: Pattern Matching
1246 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1247  
1248 # \b really means (?:(?<=\w)(?!\w)|(?<!\w)(?=\w))
1249 # or (?:(?<=\A|\W)(?=\w)|(?<=\w)(?=\W|\z))
1250 '\b' => '${Elatin3::eb}',
1251  
1252 # \B really means (?:(?<=\w)(?=\w)|(?<!\w)(?!\w))
1253 # or (?:(?<=\w)(?=\w)|(?<=\W)(?=\W))
1254 '\B' => '${Elatin3::eB}',
1255  
1256 2872 ▶ }->{$char} || '';
Condition100%2/2
{'\\D', '${Elatin3::eD}', '\\S', '${Elatin3::eS}', '\\W', '${Elatin3::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin3::eH}', '\\V', '${Elatin3::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin3::eR}', '\\N', '${Elatin3::eN}', '\\b', '${Elatin3::eb}', '\\B', '${Elatin3::eB}'}->{$char} || ''
l!l
1012771
MC/DC100%1/1
{'\\D', '${Elatin3::eD}', '\\S', '${Elatin3::eS}', '\\W', '${Elatin3::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin3::eH}', '\\V', '${Elatin3::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin3::eR}', '\\N', '${Elatin3::eN}', '\\b', '${Elatin3::eb}', '\\B', '${Elatin3::eB}'}->{$char} || ''
{'\\D', '${Elatin3::eD}', '\\S', '${Elatin3::eS}', '\\W', '${Elatin3::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin3::eH}', '\\V', '${Elatin3::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin3::eR}', '\\N', '${Elatin3::eN}', '\\b', '${Elatin3::eb}', '\\B', '${Elatin3::eB}'}->{$char}
Truth table100%2/2
A
A= {'\\D', '${Elatin3::eD}', '\\S', '${Elatin3::eS}', '\\W', '${Elatin3::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin3::eH}', '\\V', '${Elatin3::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin3::eR}', '\\N', '${Elatin3::eN}', '\\b', '${Elatin3::eb}', '\\B', '${Elatin3::eB}'}->{$char}
Aresult
11
00
1257 }
1258  
1259 #
1260 # prepare Latin-3 characters per length
1261 #
1262  
1263 # 1 octet characters
1264 422 my @chars1 = ();
1265 0 ▶sub chars1 {
Subroutine chars1: not called CC=5 SCAR=34.0
Pod undocumented
1266 0 ▶ if (@chars1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars1) 0 0 0
1267 0 return @chars1;
1268 }
1269 0 ▶ if (exists $range_tr{1}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{1}) 0 0 0
1270 0 my @ranges = @{ $range_tr{1} };
1271 0 ▶ while (my @range = splice(@ranges,0,1)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 1)) 0 0 0
1272 0 for my $oct0 (@{$range[0]}) {
1273 0 push @chars1, pack 'C', $oct0;
1274 }
1275 }
1276 }
1277 0 return @chars1;
1278 }
1279  
1280 # 2 octets characters
1281 422 my @chars2 = ();
1282 0 ▶sub chars2 {
Subroutine chars2: not called CC=6 SCAR=37.4
Pod undocumented
1283 0 ▶ if (@chars2) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars2) 0 0 0
1284 0 return @chars2;
1285 }
1286 0 ▶ if (exists $range_tr{2}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{2}) 0 0 0
1287 0 my @ranges = @{ $range_tr{2} };
1288 0 ▶ while (my @range = splice(@ranges,0,2)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 2)) 0 0 0
1289 0 for my $oct0 (@{$range[0]}) {
1290 0 for my $oct1 (@{$range[1]}) {
1291 0 push @chars2, pack 'CC', $oct0,$oct1;
1292 }
1293 }
1294 }
1295 }
1296 0 return @chars2;
1297 }
1298  
1299 # 3 octets characters
1300 422 my @chars3 = ();
1301 0 ▶sub chars3 {
Subroutine chars3: not called CC=7 SCAR=40.3
Pod undocumented
1302 0 ▶ if (@chars3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars3) 0 0 0
1303 0 return @chars3;
1304 }
1305 0 ▶ if (exists $range_tr{3}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{3}) 0 0 0
1306 0 my @ranges = @{ $range_tr{3} };
1307 0 ▶ while (my @range = splice(@ranges,0,3)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 3)) 0 0 0
1308 0 for my $oct0 (@{$range[0]}) {
1309 0 for my $oct1 (@{$range[1]}) {
1310 0 for my $oct2 (@{$range[2]}) {
1311 0 push @chars3, pack 'CCC', $oct0,$oct1,$oct2;
1312 }
1313 }
1314 }
1315 }
1316 }
1317 0 return @chars3;
1318 }
1319  
1320 # 4 octets characters
1321 422 my @chars4 = ();
1322 0 ▶sub chars4 {
Subroutine chars4: not called CC=8 SCAR=42.8
Pod undocumented
1323 0 ▶ if (@chars4) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars4) 0 0 0
1324 0 return @chars4;
1325 }
1326 0 ▶ if (exists $range_tr{4}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{4}) 0 0 0
1327 0 my @ranges = @{ $range_tr{4} };
1328 0 ▶ while (my @range = splice(@ranges,0,4)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 4)) 0 0 0
1329 0 for my $oct0 (@{$range[0]}) {
1330 0 for my $oct1 (@{$range[1]}) {
1331 0 for my $oct2 (@{$range[2]}) {
1332 0 for my $oct3 (@{$range[3]}) {
1333 0 push @chars4, pack 'CCCC', $oct0,$oct1,$oct2,$oct3;
1334 }
1335 }
1336 }
1337 }
1338 }
1339 }
1340 0 return @chars4;
1341 }
1342  
1343 #
1344 # Latin-3 open character list for tr
1345 #
1346 12 ▶sub _charlist_tr {
Subroutine _charlist_tr: called CC=35 SCAR=66.4
1347  
1348 12 local $_ = shift @_;
1349  
1350 # unescape character
1351 12 my @char = ();
1352 12 ▶ while (not /\G \z/oxmsgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgmosx) 38 12 50
1353 38 ▶ if (/\G (\\0?55|\\x2[Dd]|\\-) /oxmsgc) {
Branch: 7 branches
BranchTrueFalseTotal
if (/\G (\\0?55|\\x2[Dd]|\\-) /cgmosx) { } 0 38 38
elsif (/\G \\ ([0-7]{2,3}) /cgmosx) { } 0 38 38
elsif (/\G \\x ([0-9A-Fa-f]{1,2}) /cgmosx) { } 0 38 38
elsif (/\G \\c ([\x40-\x5F]) /cgmosx) { } 0 38 38
elsif (/\G (\\ [0nrtfbae]) /cgmosx) { } 0 38 38
elsif (/\G \\ ($Elatin3::q_char) /cgmosx) { } 0 38 38
elsif (/\G ($Elatin3::q_char) /cgmosx) { } 38 0 38
1354 0 push @char, '\-';
1355 }
1356 elsif (/\G \\ ([0-7]{2,3}) /oxmsgc) {
1357 0 push @char, CORE::chr(oct $1);
1358 }
1359 elsif (/\G \\x ([0-9A-Fa-f]{1,2}) /oxmsgc) {
1360 0 push @char, CORE::chr(hex $1);
1361 }
1362 elsif (/\G \\c ([\x40-\x5F]) /oxmsgc) {
1363 0 push @char, CORE::chr(CORE::ord($1) & 0x1F);
1364 }
1365 elsif (/\G (\\ [0nrtfbae]) /oxmsgc) {
1366 push @char, {
1367 '\0' => "\0",
1368 '\n' => "\n",
1369 '\r' => "\r",
1370 '\t' => "\t",
1371 '\f' => "\f",
1372 '\b' => "\x08", # \b means backspace in character class
1373 '\a' => "\a",
1374 '\e' => "\e",
1375 0 }->{$1};
1376 }
1377 elsif (/\G \\ ($q_char) /oxmsgc) {
1378 0 push @char, $1;
1379 }
1380 elsif (/\G ($q_char) /oxmsgc) {
1381 38 push @char, $1;
1382 }
1383 }
1384  
1385 # join separated multiple-octet
1386 12 @char = join('',@char) =~ /\G (?>\\-|$q_char) /oxmsg;
1387  
1388 # unescape '-'
1389 12 my @i = ();
1390 12 for my $i (0 .. $#char) {
1391 38 ▶ if ($char[$i] eq '\-') {
Branch: 2 branches
BranchTrueFalseTotal
if ($char[$i] eq '\\-') { } 0 38 38
elsif ($char[$i] eq '-') { } 0 38 38
1392 0 $char[$i] = '-';
1393 }
1394 elsif ($char[$i] eq '-') {
1395 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
1396 0 push @i, $i;
1397 }
1398 }
1399 }
1400  
1401 # open character list (reverse for splice)
1402 12 for my $i (CORE::reverse @i) {
1403 0 my @range = ();
1404  
1405 # range error
1406 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
1407 0 croak "Invalid tr/// range \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1408 }
1409  
1410 # range of multiple-octet code
1411 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
1412 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
1413 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
1414 }
1415 elsif (CORE::length($char[$i+1]) == 2) {
1416 0 push @range, grep {$char[$i-1] le $_} chars1();
1417 0 push @range, grep {$_ le $char[$i+1]} chars2();
1418 }
1419 elsif (CORE::length($char[$i+1]) == 3) {
1420 0 push @range, grep {$char[$i-1] le $_} chars1();
1421 0 push @range, chars2();
1422 0 push @range, grep {$_ le $char[$i+1]} chars3();
1423 }
1424 elsif (CORE::length($char[$i+1]) == 4) {
1425 0 push @range, grep {$char[$i-1] le $_} chars1();
1426 0 push @range, chars2();
1427 0 push @range, chars3();
1428 0 push @range, grep {$_ le $char[$i+1]} chars4();
1429 }
1430 else {
1431 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1432 }
1433 }
1434 elsif (CORE::length($char[$i-1]) == 2) {
1435 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
1436 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
1437 }
1438 elsif (CORE::length($char[$i+1]) == 3) {
1439 0 push @range, grep {$char[$i-1] le $_} chars2();
1440 0 push @range, grep {$_ le $char[$i+1]} chars3();
1441 }
1442 elsif (CORE::length($char[$i+1]) == 4) {
1443 0 push @range, grep {$char[$i-1] le $_} chars2();
1444 0 push @range, chars3();
1445 0 push @range, grep {$_ le $char[$i+1]} chars4();
1446 }
1447 else {
1448 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1449 }
1450 }
1451 elsif (CORE::length($char[$i-1]) == 3) {
1452 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
1453 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
1454 }
1455 elsif (CORE::length($char[$i+1]) == 4) {
1456 0 push @range, grep {$char[$i-1] le $_} chars3();
1457 0 push @range, grep {$_ le $char[$i+1]} chars4();
1458 }
1459 else {
1460 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1461 }
1462 }
1463 elsif (CORE::length($char[$i-1]) == 4) {
1464 0 ▶ if (CORE::length($char[$i+1]) == 4) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $char[$i + 1] == 4) { } 0 0 0
1465 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
1466 }
1467 else {
1468 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1469 }
1470 }
1471 else {
1472 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1473 }
1474  
1475 0 splice @char, $i-1, 3, @range;
1476 }
1477  
1478 12 return @char;
1479 }
1480  
1481 #
1482 # Latin-3 open character class
1483 #
1484 0 ▶sub _cc {
Subroutine _cc: not called CC=7 SCAR=40.3
1485 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
1486 0 die __FILE__, ": subroutine cc got no parameter.\n";
1487 }
1488 elsif (scalar(@_) == 1) {
1489 0 return sprintf('\x%02X',$_[0]);
1490 }
1491 elsif (scalar(@_) == 2) {
1492 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
1493 0 die __FILE__, ": subroutine cc got \$_[0] > \$_[1] parameters).\n";
1494 }
1495 elsif ($_[0] == $_[1]) {
1496 0 return sprintf('\x%02X',$_[0]);
1497 }
1498 elsif (($_[0]+1) == $_[1]) {
1499 0 return sprintf('[\\x%02X\\x%02X]',$_[0],$_[1]);
1500 }
1501 else {
1502 0 return sprintf('[\\x%02X-\\x%02X]',$_[0],$_[1]);
1503 }
1504 }
1505 else {
1506 0 die __FILE__, ": subroutine cc got 3 or more parameters (@{[scalar(@_)]} parameters).\n";
1507 }
1508 }
1509  
1510 #
1511 # Latin-3 octet range
1512 #
1513 246 ▶sub _octets {
Subroutine _octets: called CC=5 SCAR=19.3
1514 246 my $length = shift @_;
1515  
1516 246 ▶ if ($length == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length == 1) { } 246 0 246
1517 246 my($a1) = unpack 'C', $_[0];
1518 246 my($z1) = unpack 'C', $_[1];
1519  
1520 246 ▶ if ($a1 > $z1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($a1 > $z1) 0 246 246
1521 0 croak 'Invalid [] range in regexp (CORE::ord(A) > CORE::ord(B)) ' . '\x' . unpack('H*',$a1) . '-\x' . unpack('H*',$z1);
1522 }
1523  
1524 246 ▶ if ($a1 == $z1) {
Branch: 2 branches
BranchTrueFalseTotal
if ($a1 == $z1) { } 0 246 246
elsif ($a1 + 1 == $z1) { } 0 246 246
1525 0 return sprintf('\x%02X',$a1);
1526 }
1527 elsif (($a1+1) == $z1) {
1528 0 return sprintf('\x%02X\x%02X',$a1,$z1);
1529 }
1530 else {
1531 246 return sprintf('\x%02X-\x%02X',$a1,$z1);
1532 }
1533 }
1534 else {
1535 0 die __FILE__, ": subroutine _octets got invalid length ($length).\n";
1536 }
1537 }
1538  
1539 #
1540 # Latin-3 range regexp
1541 #
1542 246 ▶sub _range_regexp {
Subroutine _range_regexp: called CC=18 SCAR=41.7
1543 246 my($length,$first,$last) = @_;
1544  
1545 246 my @range_regexp = ();
1546 246 ▶ if (not exists $range_tr{$length}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $range_tr{$length}) 0 246 246
1547 0 return @range_regexp;
1548 }
1549  
1550 246 my @ranges = @{ $range_tr{$length} };
1551 246 ▶ while (my @range = splice(@ranges,0,$length)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, $length)) 246 246 492
1552 246 my $min = '';
1553 246 my $max = '';
1554 246 ▶ for (my $i=0; $i < $length; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $length) 246 246 492
1555 246 $min .= pack 'C', $range[$i][0];
1556 246 $max .= pack 'C', $range[$i][-1];
1557 }
1558  
1559 # min___max
1560 # FIRST_____________LAST
1561 # (nothing)
1562  
1563 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
1564 }
1565  
1566 # **********
1567 # min_________max
1568 # FIRST_____________LAST
1569 # **********
1570  
1571 ▶ 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
1572 0 push @range_regexp, _octets($length,$first,$max,$min,$max);
1573 }
1574  
1575 # **********************
1576 # min________________max
1577 # FIRST_____________LAST
1578 # **********************
1579  
1580 ▶ 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
1581 0 push @range_regexp, _octets($length,$first,$last,$min,$max);
1582 }
1583  
1584 # *********
1585 # min___max
1586 # FIRST_____________LAST
1587 # *********
1588  
1589 ▶ 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
1590 0 push @range_regexp, _octets($length,$min,$max,$min,$max);
1591 }
1592  
1593 # **********************
1594 # min__________________________max
1595 # FIRST_____________LAST
1596 # **********************
1597  
1598 ▶ 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
1599 246 push @range_regexp, _octets($length,$first,$last,$min,$max);
1600 }
1601  
1602 # *********
1603 # min________max
1604 # FIRST_____________LAST
1605 # *********
1606  
1607 ▶ 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
1608 0 push @range_regexp, _octets($length,$min,$last,$min,$max);
1609 }
1610  
1611 # min___max
1612 # FIRST_____________LAST
1613 # (nothing)
1614  
1615 elsif ($last lt $min) {
1616 }
1617  
1618 else {
1619 0 die __FILE__, ": subroutine _range_regexp panic.\n";
1620 }
1621 }
1622  
1623 246 return @range_regexp;
1624 }
1625  
1626 #
1627 # Latin-3 open character list for qr and not qr
1628 #
1629 650 ▶sub _charlist {
Subroutine _charlist: called CC=46 SCAR=45.9
1630  
1631 650 my $modifier = pop @_;
1632 650 my @char = @_;
1633  
1634 650 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 298 352 650
1635  
1636 # unescape character
1637 650 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1773 650 2423
1638  
1639 # escape - to ...
1640 1773 ▶ if ($char[$i] eq '-') {
Branch: 12 branches
BranchTrueFalseTotal
if ($char[$i] eq '-') { } 270 1503 1773
elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/mosx) { } 0 1503 1503
elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/mosx) { } 0 1503 1503
elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/mosx) { } 0 1503 1503
elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/mosx) { } 0 1503 1503
elsif ($char[$i] =~ /\A \\ ([0-7]{2,3}) \z/mosx) { } 0 1503 1503
elsif ($char[$i] =~ /\A \\x ([0-9A-Fa-f]{1,2}) \z/mosx) { } 22 1481 1503
elsif ($char[$i] =~ /\A \\c ([\x40-\x5F]) \z/mosx) { } 0 1481 1481
elsif ($char[$i] =~ /\A (\\ [0nrtfbaedswDSWHVhvR]) \z/mosx) { } 25 1456 1481
elsif ($ignorecase and $char[$i] =~ /\A ( \[\: \^? (?:lower|upper) :\] ) \z/mosx) { } 8 1448 1456
elsif ($char[$i] =~ /\A ( \[\: \^? (?:alnum|alpha|ascii|blank|cntrl|digit|graph|lower|print|punct|space|upper|word|xdigit) :\] ) \z/mosx) { } 70 1378 1448
elsif ($char[$i] =~ /\A \\ ($Elatin3::q_char) \z/mosx) { } 7 1371 1378
1641 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
1642 246 $char[$i] = '...';
1643 }
1644 }
1645  
1646 # octal escape sequence
1647 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
1648 0 $char[$i] = octchr($1);
1649 }
1650  
1651 # hexadecimal escape sequence
1652 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
1653 0 $char[$i] = hexchr($1);
1654 }
1655  
1656 # \b{...} --> b\{...}
1657 # \B{...} --> B\{...}
1658 # \N{CHARNAME} --> N\{CHARNAME}
1659 # \p{PROPERTY} --> p\{PROPERTY}
1660 # \P{PROPERTY} --> P\{PROPERTY}
1661 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
1662 0 $char[$i] = $1 . '\\' . $2;
1663 }
1664  
1665 # \p, \P, \X --> p, P, X
1666 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
1667 0 $char[$i] = $1;
1668 }
1669  
1670 elsif ($char[$i] =~ /\A \\ ([0-7]{2,3}) \z/oxms) {
1671 0 $char[$i] = CORE::chr oct $1;
1672 }
1673 elsif ($char[$i] =~ /\A \\x ([0-9A-Fa-f]{1,2}) \z/oxms) {
1674 22 $char[$i] = CORE::chr hex $1;
1675 }
1676 elsif ($char[$i] =~ /\A \\c ([\x40-\x5F]) \z/oxms) {
1677 0 $char[$i] = CORE::chr(CORE::ord($1) & 0x1F);
1678 }
1679 elsif ($char[$i] =~ /\A (\\ [0nrtfbaedswDSWHVhvR]) \z/oxms) {
1680 $char[$i] = {
1681 '\0' => "\0",
1682 '\n' => "\n",
1683 '\r' => "\r",
1684 '\t' => "\t",
1685 '\f' => "\f",
1686 '\b' => "\x08", # \b means backspace in character class
1687 '\a' => "\a",
1688 '\e' => "\e",
1689 '\d' => '[0-9]',
1690  
1691 # Vertical tabs are now whitespace
1692 # \s in a regex now matches a vertical tab in all circumstances.
1693 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
1694 # \t \n \v \f \r space
1695 # '\s' => '[\x09\x0A \x0C\x0D\x20]',
1696 # '\s' => '[\x09\x0A\x0B\x0C\x0D\x20]',
1697 '\s' => '\s',
1698  
1699 '\w' => '[0-9A-Z_a-z]',
1700 '\D' => '${Elatin3::eD}',
1701 '\S' => '${Elatin3::eS}',
1702 '\W' => '${Elatin3::eW}',
1703  
1704 '\H' => '${Elatin3::eH}',
1705 '\V' => '${Elatin3::eV}',
1706 '\h' => '[\x09\x20]',
1707 '\v' => '[\x0A\x0B\x0C\x0D]',
1708 '\R' => '${Elatin3::eR}',
1709  
1710 25 }->{$1};
1711 }
1712  
1713 # POSIX-style character classes
1714 ▶ 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
1715 $char[$i] = {
1716  
1717 '[:lower:]' => '[\x41-\x5A\x61-\x7A]',
1718 '[:upper:]' => '[\x41-\x5A\x61-\x7A]',
1719 '[:^lower:]' => '${Elatin3::not_lower_i}',
1720 '[:^upper:]' => '${Elatin3::not_upper_i}',
1721  
1722 8 }->{$1};
1723 }
1724 elsif ($char[$i] =~ /\A ( \[\: \^? (?:alnum|alpha|ascii|blank|cntrl|digit|graph|lower|print|punct|space|upper|word|xdigit) :\] ) \z/oxms) {
1725 $char[$i] = {
1726  
1727 '[:alnum:]' => '[\x30-\x39\x41-\x5A\x61-\x7A]',
1728 '[:alpha:]' => '[\x41-\x5A\x61-\x7A]',
1729 '[:ascii:]' => '[\x00-\x7F]',
1730 '[:blank:]' => '[\x09\x20]',
1731 '[:cntrl:]' => '[\x00-\x1F\x7F]',
1732 '[:digit:]' => '[\x30-\x39]',
1733 '[:graph:]' => '[\x21-\x7F]',
1734 '[:lower:]' => '[\x61-\x7A]',
1735 '[:print:]' => '[\x20-\x7F]',
1736 '[:punct:]' => '[\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E]',
1737  
1738 # P.174 POSIX-Style Character Classes
1739 # in Chapter 5: Pattern Matching
1740 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
1741  
1742 # P.311 11.2.4 Character Classes and other Special Escapes
1743 # in Chapter 11: perlre: Perl regular expressions
1744 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
1745  
1746 # P.210 POSIX-Style Character Classes
1747 # in Chapter 5: Pattern Matching
1748 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1749  
1750 '[:space:]' => '[\s\x0B]', # "\s" plus vertical tab ("\cK")
1751  
1752 '[:upper:]' => '[\x41-\x5A]',
1753 '[:word:]' => '[\x30-\x39\x41-\x5A\x5F\x61-\x7A]',
1754 '[:xdigit:]' => '[\x30-\x39\x41-\x46\x61-\x66]',
1755 '[:^alnum:]' => '${Elatin3::not_alnum}',
1756 '[:^alpha:]' => '${Elatin3::not_alpha}',
1757 '[:^ascii:]' => '${Elatin3::not_ascii}',
1758 '[:^blank:]' => '${Elatin3::not_blank}',
1759 '[:^cntrl:]' => '${Elatin3::not_cntrl}',
1760 '[:^digit:]' => '${Elatin3::not_digit}',
1761 '[:^graph:]' => '${Elatin3::not_graph}',
1762 '[:^lower:]' => '${Elatin3::not_lower}',
1763 '[:^print:]' => '${Elatin3::not_print}',
1764 '[:^punct:]' => '${Elatin3::not_punct}',
1765 '[:^space:]' => '${Elatin3::not_space}',
1766 '[:^upper:]' => '${Elatin3::not_upper}',
1767 '[:^word:]' => '${Elatin3::not_word}',
1768 '[:^xdigit:]' => '${Elatin3::not_xdigit}',
1769  
1770 70 }->{$1};
1771 }
1772 elsif ($char[$i] =~ /\A \\ ($q_char) \z/oxms) {
1773 7 $char[$i] = $1;
1774 }
1775 }
1776  
1777 # open character list
1778 650 my @singleoctet = ();
1779 650 my @multipleoctet = ();
1780 650 ▶ for (my $i=0; $i <= $#char; ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1527 650 2177
1781  
1782 # escaped -
1783 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
1784 246 $i += 1;
1785 246 next;
1786 }
1787  
1788 # make range regexp
1789 elsif ($char[$i] eq '...') {
1790  
1791 # range error
1792 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
1793 0 croak 'Invalid [] range in regexp (length(A) > length(B)) ' . '\x' . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]);
1794 }
1795 elsif (CORE::length($char[$i-1]) == CORE::length($char[$i+1])) {
1796 246 ▶ if ($char[$i-1] gt $char[$i+1]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i - 1] gt $char[$i + 1]) 0 246 246
1797 0 croak 'Invalid [] range in regexp (CORE::ord(A) > CORE::ord(B)) ' . '\x' . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]);
1798 }
1799 }
1800  
1801 # make range regexp per length
1802 246 for my $length (CORE::length($char[$i-1]) .. CORE::length($char[$i+1])) {
1803 246 my @regexp = ();
1804  
1805 # is first and last
1806 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
1807 246 push @regexp, _range_regexp($length, $char[$i-1], $char[$i+1]);
1808 }
1809  
1810 # is first
1811 elsif ($length == CORE::length($char[$i-1])) {
1812 0 push @regexp, _range_regexp($length, $char[$i-1], "\xFF" x $length);
1813 }
1814  
1815 # is inside in first and last
1816 ▶ 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
1817 0 push @regexp, _range_regexp($length, "\x00" x $length, "\xFF" x $length);
1818 }
1819  
1820 # is last
1821 elsif ($length == CORE::length($char[$i+1])) {
1822 0 push @regexp, _range_regexp($length, "\x00" x $length, $char[$i+1]);
1823 }
1824  
1825 else {
1826 0 die __FILE__, ": subroutine make_regexp panic.\n";
1827 }
1828  
1829 246 ▶ if ($length == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length == 1) { } 246 0 246
1830 246 push @singleoctet, @regexp;
1831 }
1832 else {
1833 0 push @multipleoctet, @regexp;
1834 }
1835 }
1836  
1837 246 $i += 2;
1838 }
1839  
1840 # with /i modifier
1841 elsif ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) {
1842 949 ▶ if ($modifier =~ /i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) { } 480 469 949
1843 480 my $uc = Elatin3::uc($char[$i]);
1844 480 my $fc = Elatin3::fc($char[$i]);
1845 480 ▶ if ($uc ne $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc ne $fc) { } 240 240 480
1846 240 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 240 0 240
1847 240 push @singleoctet, $uc, $fc;
1848 }
1849 else {
1850 0 push @singleoctet, $uc;
1851 0 push @multipleoctet, $fc;
1852 }
1853 }
1854 else {
1855 240 push @singleoctet, $char[$i];
1856 }
1857 }
1858 else {
1859 469 push @singleoctet, $char[$i];
1860 }
1861 949 $i += 1;
1862 }
1863  
1864 # single character of single octet code
1865 elsif ($char[$i] =~ /\A (?: \\h ) \z/oxms) {
1866 0 push @singleoctet, "\t", "\x20";
1867 0 $i += 1;
1868 }
1869 elsif ($char[$i] =~ /\A (?: \\v ) \z/oxms) {
1870 0 push @singleoctet, "\x0A", "\x0B", "\x0C", "\x0D";
1871 0 $i += 1;
1872 }
1873 elsif ($char[$i] =~ /\A (?: \\d | \\s | \\w ) \z/oxms) {
1874 2 push @singleoctet, $char[$i];
1875 2 $i += 1;
1876 }
1877  
1878 # single character of multiple-octet code
1879 else {
1880 84 push @multipleoctet, $char[$i];
1881 84 $i += 1;
1882 }
1883 }
1884  
1885 # quote metachar
1886 650 for (@singleoctet) {
1887 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
1888 0 $_ = '-';
1889 }
1890 elsif (/\A \n \z/oxms) {
1891 8 $_ = '\n';
1892 }
1893 elsif (/\A \r \z/oxms) {
1894 8 $_ = '\r';
1895 }
1896 elsif (/\A ([\x00-\x20\x7F-\xFF]) \z/oxms) {
1897 744 $_ = sprintf('\x%02X', CORE::ord $1);
1898 }
1899 elsif (/\A [\x00-\xFF] \z/oxms) {
1900 429 $_ = quotemeta $_;
1901 }
1902 }
1903  
1904 # return character list
1905 650 return \@singleoctet, \@multipleoctet;
1906 }
1907  
1908 #
1909 # Latin-3 octal escape sequence
1910 #
1911 5 ▶sub octchr {
Subroutine octchr: called CC=2 SCAR=6.9
Pod undocumented
1912 5 my($octdigit) = @_;
1913  
1914 5 my @binary = ();
1915 5 for my $octal (split(//,$octdigit)) {
1916 push @binary, {
1917 '0' => '000',
1918 '1' => '001',
1919 '2' => '010',
1920 '3' => '011',
1921 '4' => '100',
1922 '5' => '101',
1923 '6' => '110',
1924 '7' => '111',
1925 50 }->{$octal};
1926 }
1927 5 my $binary = join '', @binary;
1928  
1929 my $octchr = {
1930 # 1234567
1931 1 => pack('B*', "0000000$binary"),
1932 2 => pack('B*', "000000$binary"),
1933 3 => pack('B*', "00000$binary"),
1934 4 => pack('B*', "0000$binary"),
1935 5 => pack('B*', "000$binary"),
1936 6 => pack('B*', "00$binary"),
1937 7 => pack('B*', "0$binary"),
1938 0 => pack('B*', "$binary"),
1939  
1940 5 }->{CORE::length($binary) % 8};
1941  
1942 5 return $octchr;
1943 }
1944  
1945 #
1946 # Latin-3 hexadecimal escape sequence
1947 #
1948 5 ▶sub hexchr {
Subroutine hexchr: called CC=1 SCAR=0.0
Pod undocumented
1949 5 my($hexdigit) = @_;
1950  
1951 my $hexchr = {
1952 1 => pack('H*', "0$hexdigit"),
1953 0 => pack('H*', "$hexdigit"),
1954  
1955 5 }->{CORE::length($_[0]) % 2};
1956  
1957 5 return $hexchr;
1958 }
1959  
1960 #
1961 # Latin-3 open character list for qr
1962 #
1963 576 ▶sub charlist_qr {
Subroutine charlist_qr: called CC=17 SCAR=28.7
Pod undocumented
1964  
1965 576 my $modifier = pop @_;
1966 576 my @char = @_;
1967  
1968 576 my($singleoctet, $multipleoctet) = _charlist(@char, $modifier);
1969 576 my @singleoctet = @$singleoctet;
1970 576 my @multipleoctet = @$multipleoctet;
1971  
1972 # return character list
1973 576 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) 498 78 576
1974  
1975 # with /i modifier
1976 498 ▶ if ($modifier =~ m/i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) 265 233 498
1977 265 my %singleoctet_ignorecase = ();
1978 265 for (@singleoctet) {
1979 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
1980 745 for my $ord (hex($1) .. hex($2)) {
1981 795 my $char = CORE::chr($ord);
1982 795 my $uc = Elatin3::uc($char);
1983 795 my $fc = Elatin3::fc($char);
1984 795 ▶ if ($uc eq $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc eq $fc) { } 240 555 795
1985 240 $singleoctet_ignorecase{unpack 'C*', $char} = 1;
1986 }
1987 else {
1988 555 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 555 0 555
1989 555 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
1990 555 $singleoctet_ignorecase{unpack 'C*', $fc} = 1;
1991 }
1992 else {
1993 0 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
1994 0 push @multipleoctet, join '', map {sprintf('\x%02X',$_)} unpack 'C*', $fc;
1995 }
1996 }
1997 }
1998 }
1999 745 ▶ if ($_ ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ ne "") 0 745 745
2000 0 $singleoctet_ignorecase{unpack 'C*', $_} = 1;
2001 }
2002 }
2003 265 my $i = 0;
2004 265 my @singleoctet_ignorecase = ();
2005 265 for my $ord (0 .. 255) {
2006 67840 ▶ if (exists $singleoctet_ignorecase{$ord}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $singleoctet_ignorecase{$ord}) { } 870 66970 67840
2007 870 push @{$singleoctet_ignorecase[$i]}, $ord;
2008 }
2009 else {
2010 66970 $i++;
2011 }
2012 }
2013 265 @singleoctet = ();
2014 265 for my $range (@singleoctet_ignorecase) {
2015 56160 ▶ if (ref $range) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $range) 770 55390 56160
2016 770 ▶ if (scalar(@{$range}) == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @{$range;} == 1) { } 720 50 770
elsif (scalar @{$range;} == 2) { } 0 50 50
2017 720 push @singleoctet, sprintf('\x%02X', @{$range}[0]);
2018 }
2019 50 elsif (scalar(@{$range}) == 2) {
2020 0 push @singleoctet, sprintf('\x%02X\x%02X', @{$range}[0], @{$range}[-1]);
2021 }
2022 else {
2023 50 push @singleoctet, sprintf('\x%02X-\x%02X', @{$range}[0], @{$range}[-1]);
2024 }
2025 }
2026 }
2027 }
2028  
2029 498 my $not_anchor = '';
2030  
2031 498 push @multipleoctet, join('', $not_anchor, '[', @singleoctet, ']' );
2032 }
2033 576 ▶ if (scalar(@multipleoctet) >= 2) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @multipleoctet >= 2) { } 6 570 576
2034 6 return '(?:' . join('|', @multipleoctet) . ')';
2035 }
2036 else {
2037 570 return $multipleoctet[0];
2038 }
2039 }
2040  
2041 #
2042 # Latin-3 open character list for not qr
2043 #
2044 74 ▶sub charlist_not_qr {
Subroutine charlist_not_qr: called CC=18 SCAR=33.1
Pod undocumented
2045  
2046 74 my $modifier = pop @_;
2047 74 my @char = @_;
2048  
2049 74 my($singleoctet, $multipleoctet) = _charlist(@char, $modifier);
2050 74 my @singleoctet = @$singleoctet;
2051 74 my @multipleoctet = @$multipleoctet;
2052  
2053 # with /i modifier
2054 74 ▶ if ($modifier =~ m/i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) 25 49 74
2055 25 my %singleoctet_ignorecase = ();
2056 25 for (@singleoctet) {
2057 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
2058 25 for my $ord (hex($1) .. hex($2)) {
2059 75 my $char = CORE::chr($ord);
2060 75 my $uc = Elatin3::uc($char);
2061 75 my $fc = Elatin3::fc($char);
2062 75 ▶ if ($uc eq $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc eq $fc) { } 0 75 75
2063 0 $singleoctet_ignorecase{unpack 'C*', $char} = 1;
2064 }
2065 else {
2066 75 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 75 0 75
2067 75 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2068 75 $singleoctet_ignorecase{unpack 'C*', $fc} = 1;
2069 }
2070 else {
2071 0 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2072 0 push @multipleoctet, join '', map {sprintf('\x%02X',$_)} unpack 'C*', $fc;
2073 }
2074 }
2075 }
2076 }
2077 25 ▶ if ($_ ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ ne "") 0 25 25
2078 0 $singleoctet_ignorecase{unpack 'C*', $_} = 1;
2079 }
2080 }
2081 25 my $i = 0;
2082 25 my @singleoctet_ignorecase = ();
2083 25 for my $ord (0 .. 255) {
2084 6400 ▶ if (exists $singleoctet_ignorecase{$ord}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $singleoctet_ignorecase{$ord}) { } 150 6250 6400
2085 150 push @{$singleoctet_ignorecase[$i]}, $ord;
2086 }
2087 else {
2088 6250 $i++;
2089 }
2090 }
2091 25 @singleoctet = ();
2092 25 for my $range (@singleoctet_ignorecase) {
2093 2400 ▶ if (ref $range) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $range) 50 2350 2400
2094 50 ▶ if (scalar(@{$range}) == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @{$range;} == 1) { } 0 50 50
elsif (scalar @{$range;} == 2) { } 0 50 50
2095 0 push @singleoctet, sprintf('\x%02X', @{$range}[0]);
2096 }
2097 50 elsif (scalar(@{$range}) == 2) {
2098 0 push @singleoctet, sprintf('\x%02X\x%02X', @{$range}[0], @{$range}[-1]);
2099 }
2100 else {
2101 50 push @singleoctet, sprintf('\x%02X-\x%02X', @{$range}[0], @{$range}[-1]);
2102 }
2103 }
2104 }
2105 }
2106  
2107 # return character list
2108 74 ▶ if (scalar(@multipleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @multipleoctet >= 1) { } 0 74 74
2109 0 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) { } 0 0 0
2110  
2111 # any character other than multiple-octet and single octet character class
2112 0 return '(?!' . join('|', @multipleoctet) . ')(?:[^' . join('', @singleoctet) . '])';
2113 }
2114 else {
2115  
2116 # any character other than multiple-octet character class
2117 0 return '(?!' . join('|', @multipleoctet) . ")(?:$your_char)";
2118 }
2119 }
2120 else {
2121 74 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) { } 74 0 74
2122  
2123 # any character other than single octet character class
2124 74 return '(?:[^' . join('', @singleoctet) . '])';
2125 }
2126 else {
2127  
2128 # any character
2129 0 return "(?:$your_char)";
2130 }
2131 }
2132 }
2133  
2134 #
2135 # open file in read mode
2136 #
2137 422 ▶sub _open_r {
Subroutine _open_r: called CC=1 SCAR=0.0
2138 422 my(undef,$file) = @_;
2139 422 ▶ use Fcntl qw(O_RDONLY);
Subroutine BEGIN: called CC=1 SCAR=0.0
2140 422 return CORE::sysopen($_[0], $file, &O_RDONLY);
2141 }
2142  
2143 #
2144 # open file in append mode
2145 #
2146 211 ▶sub _open_a {
Subroutine _open_a: called CC=1 SCAR=0.0
2147 211 my(undef,$file) = @_;
2148 422 ▶ use Fcntl qw(O_WRONLY O_APPEND O_CREAT);
Subroutine BEGIN: called CC=1 SCAR=0.0
2149 211 return CORE::sysopen($_[0], $file, &O_WRONLY|&O_APPEND|&O_CREAT);
2150 }
2151  
2152 #
2153 # safe system
2154 #
2155 211 ▶sub _systemx {
Subroutine _systemx: called CC=1 SCAR=0.0
2156  
2157 # P.707 29.2.33. exec
2158 # in Chapter 29: Functions
2159 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2160 #
2161 # Be aware that in older releases of Perl, exec (and system) did not flush
2162 # your output buffer, so you needed to enable command buffering by setting $|
2163 # on one or more filehandles to avoid lost output in the case of exec, or
2164 # misordererd output in the case of system. This situation was largely remedied
2165 # in the 5.6 release of Perl. (So, 5.005 release not yet.)
2166  
2167 # P.855 exec
2168 # in Chapter 27: Functions
2169 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2170 #
2171 # In very old release of Perl (before v5.6), exec (and system) did not flush
2172 # your output buffer, so you needed to enable command buffering by setting $|
2173 # on one or more filehandles to avoid lost output with exec or misordered
2174 # output with system.
2175  
2176 211 $| = 1;
2177  
2178 # P.565 23.1.2. Cleaning Up Your Environment
2179 # in Chapter 23: Security
2180 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2181  
2182 # P.656 Cleaning Up Your Environment
2183 # in Chapter 20: Security
2184 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2185  
2186 # local $ENV{'PATH'} = '.';
2187 211 local @ENV{qw(IFS CDPATH ENV BASH_ENV)}; # Make %ENV safer
2188  
2189 # P.707 29.2.33. exec
2190 # in Chapter 29: Functions
2191 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2192 #
2193 # As we mentioned earlier, exec treats a discrete list of arguments as an
2194 # indication that it should bypass shell processing. However, there is one
2195 # place where you might still get tripped up. The exec call (and system, too)
2196 # will not distinguish between a single scalar argument and an array containing
2197 # only one element.
2198 #
2199 # @args = ("echo surprise"); # just one element in list
2200 # exec @args # still subject to shell escapes
2201 # or die "exec: $!"; # because @args == 1
2202 #
2203 # To avoid this, you can use the PATHNAME syntax, explicitly duplicating the
2204 # first argument as the pathname, which forces the rest of the arguments to be
2205 # interpreted as a list, even if there is only one of them:
2206 #
2207 # exec { $args[0] } @args # safe even with one-argument list
2208 # or die "can't exec @args: $!";
2209  
2210 # P.855 exec
2211 # in Chapter 27: Functions
2212 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2213 #
2214 # As we mentioned earlier, exec treats a discrete list of arguments as a
2215 # directive to bypass shell processing. However, there is one place where
2216 # you might still get tripped up. The exec call (and system, too) cannot
2217 # distinguish between a single scalar argument and an array containing
2218 # only one element.
2219 #
2220 # @args = ("echo surprise"); # just one element in list
2221 # exec @args # still subject to shell escapes
2222 # || die "exec: $!"; # because @args == 1
2223 #
2224 # To avoid this, use the PATHNAME syntax, explicitly duplicating the first
2225 # argument as the pathname, which forces the rest of the arguments to be
2226 # interpreted as a list, even if there is only one of them:
2227 #
2228 # exec { $args[0] } @args # safe even with one-argument list
2229 # || die "can't exec @args: $!";
2230  
2231 211 return CORE::system { $_[0] } @_; # safe even with one-argument list
2232 }
2233  
2234 #
2235 # Latin-3 order to character (with parameter)
2236 #
2237 3469 ▶sub Elatin3::chr(;$) {
Subroutine chr: called CC=4 SCAR=13.9
Pod undocumented
2238  
2239 3469 ▶ my $c = @_ ? $_[0] : $_;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 3469 0 3469
2240  
2241 3469 ▶ if ($c == 0x00) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c == 0) { } 24 3445 3469
2242 24 return "\x00";
2243 }
2244 else {
2245 3445 my @chr = ();
2246 3445 ▶ while ($c > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c > 0) 3445 3445 6890
2247 3445 unshift @chr, ($c % 0x100);
2248 3445 $c = int($c / 0x100);
2249 }
2250 3445 return pack 'C*', @chr;
2251 }
2252 }
2253  
2254 #
2255 # Latin-3 order to character (without parameter)
2256 #
2257 0 ▶sub Elatin3::chr_() {
Subroutine chr_: not called CC=3 SCAR=24.8
Pod undocumented
2258  
2259 0 my $c = $_;
2260  
2261 0 ▶ if ($c == 0x00) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c == 0) { } 0 0 0
2262 0 return "\x00";
2263 }
2264 else {
2265 0 my @chr = ();
2266 0 ▶ while ($c > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c > 0) 0 0 0
2267 0 unshift @chr, ($c % 0x100);
2268 0 $c = int($c / 0x100);
2269 }
2270 0 return pack 'C*', @chr;
2271 }
2272 }
2273  
2274 #
2275 # Latin-3 path globbing (with parameter)
2276 #
2277 0 ▶sub Elatin3::glob($) {
Subroutine glob: not called CC=3 SCAR=24.8
Pod undocumented
2278  
2279 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2280 0 my @glob = _DOS_like_glob(@_);
2281 0 for my $glob (@glob) {
2282 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2283 }
2284 0 return @glob;
2285 }
2286 else {
2287 0 my $glob = _DOS_like_glob(@_);
2288 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2289 0 return $glob;
2290 }
2291 }
2292  
2293 #
2294 # Latin-3 path globbing (without parameter)
2295 #
2296 0 ▶sub Elatin3::glob_() {
Subroutine glob_: not called CC=3 SCAR=24.8
Pod undocumented
2297  
2298 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2299 0 my @glob = _DOS_like_glob();
2300 0 for my $glob (@glob) {
2301 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2302 }
2303 0 return @glob;
2304 }
2305 else {
2306 0 my $glob = _DOS_like_glob();
2307 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2308 0 return $glob;
2309 }
2310 }
2311  
2312 #
2313 # Latin-3 path globbing via File::DosGlob 1.10
2314 #
2315 # Often I confuse "_dosglob" and "_doglob".
2316 # So, I renamed "_dosglob" to "_DOS_like_glob".
2317 #
2318 422 my %iter;
2319 my %entries;
2320 0 ▶sub _DOS_like_glob {
Subroutine _DOS_like_glob: not called CC=10 SCAR=47.0
2321  
2322 # context (keyed by second cxix argument provided by core)
2323 0 my($expr,$cxix) = @_;
2324  
2325 # glob without args defaults to $_
2326 0 ▶ $expr = $_ if not defined $expr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $expr 0 0 0
2327  
2328 # represents the current user's home directory
2329 #
2330 # 7.3. Expanding Tildes in Filenames
2331 # in Chapter 7. File Access
2332 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2333 #
2334 # and File::HomeDir, File::HomeDir::Windows module
2335  
2336 # DOS-like system
2337 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
2338 0 $expr =~ s{ \A ~ (?= [^/\\] ) }
2339 0 { my_home_MSWin32() }oxmse;
2340 }
2341  
2342 # UNIX-like system
2343 else {
2344 0 $expr =~ s{ \A ~ ( (?:[^/])* ) }
2345 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
2346 }
2347  
2348 # assume global context if not provided one
2349 0 ▶ $cxix = '_G_' if not defined $cxix;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $cxix 0 0 0
2350 0 ▶ $iter{$cxix} = 0 if not exists $iter{$cxix};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $iter{$cxix} 0 0 0
2351  
2352 # if we're just beginning, do it all first
2353 0 ▶ if ($iter{$cxix} == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iter{$cxix} == 0) 0 0 0
2354 0 $entries{$cxix} = [ _do_glob(1, _parse_line($expr)) ];
2355 }
2356  
2357 # chuck it all out, quick or slow
2358 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2359 0 delete $iter{$cxix};
2360 0 return @{delete $entries{$cxix}};
2361 }
2362 else {
2363 0 ▶ if ($iter{$cxix} = scalar @{$entries{$cxix}}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iter{$cxix} = scalar @{$entries{$cxix};}) { } 0 0 0
2364 0 return shift @{$entries{$cxix}};
2365 }
2366 else {
2367 # return undef for EOL
2368 0 delete $iter{$cxix};
2369 0 delete $entries{$cxix};
2370 0 return undef;
2371 }
2372 }
2373 }
2374  
2375 #
2376 # Latin-3 path globbing subroutine
2377 #
2378 0 ▶sub _do_glob {
Subroutine _do_glob: not called CC=44 SCAR=75.9
2379  
2380 0 my($cond,@expr) = @_;
2381 0 my @glob = ();
2382 0 my $fix_drive_relative_paths = 0;
2383  
2384 OUTER:
2385 0 for my $expr (@expr) {
2386 0 ▶ next OUTER if not defined $expr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $expr 0 0 0
2387 0 ▶ next OUTER if $expr eq '';
Branch: 1 branch
BranchTrueFalseTotal
if $expr eq "" 0 0 0
2388  
2389 0 my @matched = ();
2390 0 my @globdir = ();
2391 0 my $head = '.';
2392 0 my $pathsep = '/';
2393 0 my $tail;
2394  
2395 # if argument is within quotes strip em and do no globbing
2396 0 ▶ if ($expr =~ /\A " ((?:$q_char)*?) " \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expr =~ /\A " ((?:$Elatin3::q_char)*?) " \z/mosx) 0 0 0
2397 0 $expr = $1;
2398 0 ▶ if ($cond eq 'd') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cond eq 'd') { } 0 0 0
2399 0 ▶ if (-d $expr) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $expr) 0 0 0
2400 0 push @glob, $expr;
2401 }
2402 }
2403 else {
2404 0 ▶ if (-e $expr) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $expr) 0 0 0
2405 0 push @glob, $expr;
2406 }
2407 }
2408 0 next OUTER;
2409 }
2410  
2411 # wildcards with a drive prefix such as h:*.pm must be changed
2412 # to h:./*.pm to expand correctly
2413 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
2414 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
2415 0 $fix_drive_relative_paths = 1;
2416 }
2417 }
2418  
2419 0 ▶ if (($head, $tail) = _parse_path($expr,$pathsep)) {
Branch: 1 branch
BranchTrueFalseTotal
if (($head, $tail) = _parse_path($expr, $pathsep)) 0 0 0
2420 0 ▶ if ($tail eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($tail eq "") 0 0 0
2421 0 push @glob, $expr;
2422 0 next OUTER;
2423 }
2424 0 ▶ if ($head =~ / \A (?:$q_char)*? [*?] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head =~ / \A (?:$Elatin3::q_char)*? [*?] /mosx) 0 0 0
2425 0 ▶ if (@globdir = _do_glob('d', $head)) {
Branch: 1 branch
BranchTrueFalseTotal
if (@globdir = _do_glob("d", $head)) 0 0 0
2426 0 push @glob, _do_glob($cond, map {"$_$pathsep$tail"} @globdir);
2427 0 next OUTER;
2428 }
2429 }
2430 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
2431 0 $head .= $pathsep;
2432 }
2433 0 $expr = $tail;
2434 }
2435  
2436 # If file component has no wildcards, we can avoid opendir
2437 0 ▶ if ($expr !~ / \A (?:$q_char)*? [*?] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($expr =~ / \A (?:$Elatin3::q_char)*? [*?] /mosx) 0 0 0
2438 0 ▶ if ($head eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($head eq ".") 0 0 0
2439 0 $head = '';
2440 }
2441 0 ▶ if ($head ne '' and ($head =~ / \G ($q_char) /oxmsg)[-1] ne $pathsep) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head ne "" and ($head =~ / \G ($Elatin3::q_char) /gmosx)[-1] ne $pathsep) 0 0 0
Condition0%0/3
$head ne "" and ($head =~ / \G ($Elatin3::q_char) /gmosx)[-1] ne $pathsep
!ll&&!rl&&r
000
MC/DC0%0/2
$head ne "" and ($head =~ / \G ($Elatin3::q_char) /gmosx)[-1] ne $pathsep
$head ne "" ($head =~ / \G ($Elatin3::q_char) /gmosx)[-1] ne $pathsep
Truth table0%0/3
A and B
A= $head ne ""B= ($head =~ / \G ($Elatin3::q_char) /gmosx)[-1] ne $pathsep
ABresult
0X0
100
111
2442 0 $head .= $pathsep;
2443 }
2444 0 $head .= $expr;
2445 0 ▶ if ($cond eq 'd') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cond eq 'd') { } 0 0 0
2446 0 ▶ if (-d $head) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $head) 0 0 0
2447 0 push @glob, $head;
2448 }
2449 }
2450 else {
2451 0 ▶ if (-e $head) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $head) 0 0 0
2452 0 push @glob, $head;
2453 }
2454 }
2455 0 next OUTER;
2456 }
2457 0 ▶ opendir(*DIR, $head) or next OUTER;
Branch: 1 branch
BranchTrueFalseTotal
opendir *DIR, $head or next OUTER 0 0 0
2458 0 my @leaf = readdir DIR;
2459 0 closedir DIR;
2460  
2461 0 ▶ if ($head eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($head eq ".") 0 0 0
2462 0 $head = '';
2463 }
2464 0 ▶ if ($head ne '' and ($head =~ / \G ($q_char) /oxmsg)[-1] ne $pathsep) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head ne "" and ($head =~ / \G ($Elatin3::q_char) /gmosx)[-1] ne $pathsep) 0 0 0
Condition0%0/3
$head ne "" and ($head =~ / \G ($Elatin3::q_char) /gmosx)[-1] ne $pathsep
!ll&&!rl&&r
000
MC/DC0%0/2
$head ne "" and ($head =~ / \G ($Elatin3::q_char) /gmosx)[-1] ne $pathsep
$head ne "" ($head =~ / \G ($Elatin3::q_char) /gmosx)[-1] ne $pathsep
Truth table0%0/3
A and B
A= $head ne ""B= ($head =~ / \G ($Elatin3::q_char) /gmosx)[-1] ne $pathsep
ABresult
0X0
100
111
2465 0 $head .= $pathsep;
2466 }
2467  
2468 0 my $pattern = '';
2469 0 ▶ while ($expr =~ / \G ($q_char) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expr =~ / \G ($Elatin3::q_char) /cgox) 0 0 0
2470 0 my $char = $1;
2471  
2472 # 6.9. Matching Shell Globs as Regular Expressions
2473 # in Chapter 6. Pattern Matching
2474 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2475 # (and so on)
2476  
2477 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
2478 0 $pattern .= "(?:$your_char)*",
2479 }
2480 elsif ($char eq '?') {
2481 0 $pattern .= "(?:$your_char)?", # DOS style
2482 # $pattern .= "(?:$your_char)", # UNIX style
2483 }
2484 elsif ((my $fc = Elatin3::fc($char)) ne $char) {
2485 0 $pattern .= $fc;
2486 }
2487 else {
2488 0 $pattern .= quotemeta $char;
2489 }
2490 }
2491 0 ▶ my $matchsub = sub { Elatin3::fc($_[0]) =~ /\A $pattern \z/xms };
Subroutine __ANON__: not called CC=1 SCAR=6.9
2492  
2493 # if ($@) {
2494 # print STDERR "$0: $@\n";
2495 # next OUTER;
2496 # }
2497  
2498 INNER:
2499 0 for my $leaf (@leaf) {
2500 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
2501 0 next INNER;
2502 }
2503 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
2504 0 next INNER;
2505 }
2506  
2507 0 ▶ if (&$matchsub($leaf)) {
Branch: 1 branch
BranchTrueFalseTotal
if (&$matchsub($leaf)) 0 0 0
2508 0 push @matched, "$head$leaf";
2509 0 next INNER;
2510 }
2511  
2512 # [DOS compatibility special case]
2513 # Failed, add a trailing dot and try again, but only...
2514  
2515 0 ▶ if (Elatin3::index($leaf,'.') == -1 and # if name does not have a dot in it *and*
Branch: 1 branch
BranchTrueFalseTotal
if (&Elatin3::index($leaf, ".") == -1 and length $leaf <= 8 and &Elatin3::index($pattern, "\\.") != -1) 0 0 0
Condition0%0/6
&Elatin3::index($leaf, ".") == -1 and length $leaf <= 8 and &Elatin3::index($pattern, "\\.") != -1
!ll&&!rl&&r
000
&Elatin3::index($leaf, ".") == -1 and length $leaf <= 8
!ll&&!rl&&r
000
MC/DC0%0/3
&Elatin3::index($leaf, ".") == -1 and length $leaf <= 8 and &Elatin3::index($pattern, "\\.") != -1
&Elatin3::index($leaf, ".") == -1 length $leaf <= 8 &Elatin3::index($pattern, "\\.") != -1
Truth table0%0/4
A and B and C
A= &Elatin3::index($leaf, ".") == -1B= length $leaf <= 8C= &Elatin3::index($pattern, "\\.") != -1
ABCresult
0XX0
10X0
1100
1111
2516 CORE::length($leaf) <= 8 and # name is shorter than or equal to 8 chars *and*
2517 Elatin3::index($pattern,'\\.') != -1 # pattern has a dot.
2518 ) {
2519 0 ▶ if (&$matchsub("$leaf.")) {
Branch: 1 branch
BranchTrueFalseTotal
if (&$matchsub("$leaf.")) 0 0 0
2520 0 push @matched, "$head$leaf";
2521 0 next INNER;
2522 }
2523 }
2524 }
2525 0 ▶ if (@matched) {
Branch: 1 branch
BranchTrueFalseTotal
if (@matched) 0 0 0
2526 0 push @glob, @matched;
2527 }
2528 }
2529 0 ▶ if ($fix_drive_relative_paths) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fix_drive_relative_paths) 0 0 0
2530 0 for my $glob (@glob) {
2531 0 $glob =~ s# \A ([A-Za-z]:) \./ #$1#oxms;
2532 }
2533 }
2534 0 return @glob;
2535 }
2536  
2537 #
2538 # Latin-3 parse line
2539 #
2540 0 ▶sub _parse_line {
Subroutine _parse_line: not called CC=3 SCAR=24.8
2541  
2542 0 my($line) = @_;
2543  
2544 0 $line .= ' ';
2545 0 my @piece = ();
2546 0 ▶ while ($line =~ /
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ / " ( (?>(?: [^"] )* ) ) " (?>\s+) | ( (?>(?: [^"\s] )* ) ) (?>\s+) /gmosx) 0 0 0
2547 " ( (?>(?: [^"] )* ) ) " (?>\s+) |
2548 ( (?>(?: [^"\s] )* ) ) (?>\s+)
2549 /oxmsg
2550 ) {
2551 0 ▶ push @piece, defined($1) ? $1 : $2;
Branch: 1 branch
BranchTrueFalseTotal
defined $1 ? : 0 0 0
2552 }
2553 0 return @piece;
2554 }
2555  
2556 #
2557 # Latin-3 parse path
2558 #
2559 0 ▶sub _parse_path {
Subroutine _parse_path: not called CC=2 SCAR=17.9
2560  
2561 0 my($path,$pathsep) = @_;
2562  
2563 0 $path .= '/';
2564 0 my @subpath = ();
2565 0 ▶ while ($path =~ /
Branch: 1 branch
BranchTrueFalseTotal
if ($path =~ m( ((?: [^/\\] )+?) [/\\] )gmosx) 0 0 0
2566 ((?: [^\/\\] )+?) [\/\\]
2567 /oxmsg
2568 ) {
2569 0 push @subpath, $1;
2570 }
2571  
2572 0 my $tail = pop @subpath;
2573 0 my $head = join $pathsep, @subpath;
2574 0 return $head, $tail;
2575 }
2576  
2577 #
2578 # via File::HomeDir::Windows 1.00
2579 #
2580 0 ▶sub my_home_MSWin32 {
Subroutine my_home_MSWin32: not called CC=9 SCAR=45.0
Pod undocumented
2581  
2582 # A lot of unix people and unix-derived tools rely on
2583 # the ability to overload HOME. We will support it too
2584 # so that they can replace raw HOME calls with File::HomeDir.
2585 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
2586 0 return $ENV{'HOME'};
2587 }
2588  
2589 # Do we have a user profile?
2590 ▶ 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
2591 0 return $ENV{'USERPROFILE'};
2592 }
2593  
2594 # Some Windows use something like $ENV{'HOME'}
2595 ▶ 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
2596 0 return join '', $ENV{'HOMEDRIVE'}, $ENV{'HOMEPATH'};
2597 }
2598  
2599 0 return undef;
2600 }
2601  
2602 #
2603 # via File::HomeDir::Unix 1.00
2604 #
2605 0 ▶sub my_home {
Subroutine my_home: not called CC=7 SCAR=40.3
Pod undocumented
2606 0 my $home;
2607  
2608 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
2609 0 $home = $ENV{'HOME'};
2610 }
2611  
2612 # This is from the original code, but I'm guessing
2613 # it means "login directory" and exists on some Unixes.
2614 ▶ 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
2615 0 $home = $ENV{'LOGDIR'};
2616 }
2617  
2618 ### More-desperate methods
2619  
2620 # Light desperation on any (Unixish) platform
2621 else {
2622 0 $home = CORE::eval q{ (getpwuid($<))[7] };
2623 }
2624  
2625 # On Unix in general, a non-existant home means "no home"
2626 # For example, "nobody"-like users might use /nonexistant
2627 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
2628 0 $home = undef;
2629 }
2630 0 return $home;
2631 }
2632  
2633 #
2634 # ${^PREMATCH}, $PREMATCH, $` the string preceding what was matched
2635 #
2636 56 ▶sub Elatin3::PREMATCH {
Subroutine PREMATCH: called CC=1 SCAR=0.0
Pod undocumented
2637 56 return $`;
2638 }
2639  
2640 #
2641 # ${^MATCH}, $MATCH, $& the string that matched
2642 #
2643 81 ▶sub Elatin3::MATCH {
Subroutine MATCH: called CC=1 SCAR=0.0
Pod undocumented
2644 81 return $&;
2645 }
2646  
2647 #
2648 # ${^POSTMATCH}, $POSTMATCH, $' the string following what was matched
2649 #
2650 42 ▶sub Elatin3::POSTMATCH {
Subroutine POSTMATCH: called CC=1 SCAR=0.0
Pod undocumented
2651 42 return $';
2652 }
2653  
2654 #
2655 # Latin-3 character to order (with parameter)
2656 #
2657 0 ▶sub Latin3::ord(;$) {
Subroutine ord: not called CC=4 SCAR=30.0
2658  
2659 0 ▶ local $_ = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
2660  
2661 0 ▶ if (/\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\A ($Elatin3::q_char) /mosx) { } 0 0 0
2662 0 my @ord = unpack 'C*', $1;
2663 0 my $ord = 0;
2664 0 ▶ while (my $o = shift @ord) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $o = shift @ord) 0 0 0
2665 0 $ord = $ord * 0x100 + $o;
2666 }
2667 0 return $ord;
2668 }
2669 else {
2670 0 return CORE::ord $_;
2671 }
2672 }
2673  
2674 #
2675 # Latin-3 character to order (without parameter)
2676 #
2677 0 ▶sub Latin3::ord_() {
Subroutine ord_: not called CC=3 SCAR=24.8
2678  
2679 0 ▶ if (/\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\A ($Elatin3::q_char) /mosx) { } 0 0 0
2680 0 my @ord = unpack 'C*', $1;
2681 0 my $ord = 0;
2682 0 ▶ while (my $o = shift @ord) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $o = shift @ord) 0 0 0
2683 0 $ord = $ord * 0x100 + $o;
2684 }
2685 0 return $ord;
2686 }
2687 else {
2688 0 return CORE::ord $_;
2689 }
2690 }
2691  
2692 #
2693 # Latin-3 reverse
2694 #
2695 0 ▶sub Latin3::reverse(@) {
Subroutine reverse: not called CC=2 SCAR=17.9
2696  
2697 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2698 0 return CORE::reverse @_;
2699 }
2700 else {
2701  
2702 # One of us once cornered Larry in an elevator and asked him what
2703 # problem he was solving with this, but he looked as far off into
2704 # the distance as he could in an elevator and said, "It seemed like
2705 # a good idea at the time."
2706  
2707 0 return join '', CORE::reverse(join('',@_) =~ /\G ($q_char) /oxmsg);
2708 }
2709 }
2710  
2711 #
2712 # Latin-3 getc (with parameter, without parameter)
2713 #
2714 20 ▶sub Latin3::getc(;*@) {
Subroutine getc: called CC=9 SCAR=26.7
2715  
2716 20 my($package) = caller;
2717 20 ▶ my $fh = @_ ? qualify_to_ref(shift,$package) : \*STDIN;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 20 0 20
2718 20 ▶ croak 'Too many arguments for Latin3::getc' if @_ and not wantarray;
Branch: 1 branch
BranchTrueFalseTotal
if @_ and not wantarray 0 20 20
Condition33%1/3
@_ and not wantarray
!ll&&!rl&&r
2000
MC/DC0%0/2
@_ and not wantarray
@_ not wantarray
Truth table33%1/3
A and not(B)
A= @_B= not wantarray
ABresult
0X0
100
111
2719  
2720 0 my @length = sort { $a <=> $b } keys %range_tr;
2721 20 my $getc = '';
2722 20 for my $length ($length[0] .. $length[-1]) {
2723 20 $getc .= CORE::getc($fh);
2724 20 ▶ if (exists $range_tr{CORE::length($getc)}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{length $getc}) 20 0 20
2725 20 ▶ if ($getc =~ /\A ${Elatin3::dot_s} \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($getc =~ /\A $Elatin3::dot_s \z/mosx) 20 0 20
2726 20 ▶ return wantarray ? ($getc,@_) : $getc;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 20 20
2727 }
2728 }
2729 }
2730 0 ▶ return wantarray ? ($getc,@_) : $getc;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
2731 }
2732  
2733 #
2734 # Latin-3 length by character
2735 #
2736 0 ▶sub Latin3::length(;$) {
Subroutine length: not called CC=2 SCAR=17.9
2737  
2738 0 ▶ local $_ = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
2739  
2740 0 local @_ = /\G ($q_char) /oxmsg;
2741 0 return scalar @_;
2742 }
2743  
2744 #
2745 # Latin-3 substr by character
2746 #
2747 422 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=7.0
2748  
2749 # P.232 The lvalue Attribute
2750 # in Chapter 6: Subroutines
2751 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2752  
2753 # P.336 The lvalue Attribute
2754 # in Chapter 7: Subroutines
2755 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2756  
2757 # P.144 8.4 Lvalue subroutines
2758 # in Chapter 8: perlsub: Perl subroutines
2759 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
2760  
2761 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
2762 # vv----------------------*******
2763 sub Latin3::substr($$;$$) %s {
2764  
2765 my @char = $_[0] =~ /\G (?>$q_char) /oxmsg;
2766  
2767 # If the substring is beyond either end of the string, substr() returns the undefined
2768 # value and produces a warning. When used as an lvalue, specifying a substring that
2769 # is entirely outside the string raises an exception.
2770 # http://perldoc.perl.org/functions/substr.html
2771  
2772 # A return with no argument returns the scalar value undef in scalar context,
2773 # an empty list () in list context, and (naturally) nothing at all in void
2774 # context.
2775  
2776 my $offset = $_[1];
2777 if (($offset > scalar(@char)) or ($offset < (-1 * scalar(@char)))) {
2778 return;
2779 }
2780  
2781 # substr($string,$offset,$length,$replacement)
2782 if (@_ == 4) {
2783 my(undef,undef,$length,$replacement) = @_;
2784 my $substr = join '', splice(@char, $offset, $length, $replacement);
2785 $_[0] = join '', @char;
2786  
2787 # return $substr; this doesn't work, don't say "return"
2788 $substr;
2789 }
2790  
2791 # substr($string,$offset,$length)
2792 elsif (@_ == 3) {
2793 my(undef,undef,$length) = @_;
2794 my $octet_offset = 0;
2795 my $octet_length = 0;
2796 if ($offset == 0) {
2797 $octet_offset = 0;
2798 }
2799 elsif ($offset > 0) {
2800 $octet_offset = CORE::length(join '', @char[0..$offset-1]);
2801 }
2802 else {
2803 $octet_offset = -1 * CORE::length(join '', @char[$#char+$offset+1..$#char]);
2804 }
2805 if ($length == 0) {
2806 $octet_length = 0;
2807 }
2808 elsif ($length > 0) {
2809 $octet_length = CORE::length(join '', @char[$offset..$offset+$length-1]);
2810 }
2811 else {
2812 $octet_length = -1 * CORE::length(join '', @char[$#char+$length+1..$#char]);
2813 }
2814 CORE::substr($_[0], $octet_offset, $octet_length);
2815 }
2816  
2817 # substr($string,$offset)
2818 else {
2819 my $octet_offset = 0;
2820 if ($offset == 0) {
2821 $octet_offset = 0;
2822 }
2823 elsif ($offset > 0) {
2824 $octet_offset = CORE::length(join '', @char[0..$offset-1]);
2825 }
2826 else {
2827 $octet_offset = -1 * CORE::length(join '', @char[$#char+$offset+1..$#char]);
2828 }
2829 CORE::substr($_[0], $octet_offset);
2830 }
2831 }
2832 END
2833 }
2834  
2835 #
2836 # Latin-3 index by character
2837 #
2838 0 ▶sub Latin3::index($$;$) {
Subroutine index: not called CC=3 SCAR=24.8
2839  
2840 0 my $index;
2841 0 ▶ if (@_ == 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 3) { } 0 0 0
2842 0 $index = Elatin3::index($_[0], $_[1], CORE::length(Latin3::substr($_[0], 0, $_[2])));
2843 }
2844 else {
2845 0 $index = Elatin3::index($_[0], $_[1]);
2846 }
2847  
2848 0 ▶ if ($index == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($index == -1) { } 0 0 0
2849 0 return -1;
2850 }
2851 else {
2852 0 return Latin3::length(CORE::substr $_[0], 0, $index);
2853 }
2854 }
2855  
2856 #
2857 # Latin-3 rindex by character
2858 #
2859 0 ▶sub Latin3::rindex($$;$) {
Subroutine rindex: not called CC=3 SCAR=24.8
2860  
2861 0 my $rindex;
2862 0 ▶ if (@_ == 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 3) { } 0 0 0
2863 0 $rindex = Elatin3::rindex($_[0], $_[1], CORE::length(Latin3::substr($_[0], 0, $_[2])));
2864 }
2865 else {
2866 0 $rindex = Elatin3::rindex($_[0], $_[1]);
2867 }
2868  
2869 0 ▶ if ($rindex == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rindex == -1) { } 0 0 0
2870 0 return -1;
2871 }
2872 else {
2873 0 return Latin3::length(CORE::substr $_[0], 0, $rindex);
2874 }
2875 }
2876  
2877 # when 'm//', '/' means regexp match 'm//' and '?' means regexp match '??'
2878 # when 'div', '/' means division operator and '?' means conditional operator (condition ? then : else)
2879 422 ▶use vars qw($slash); $slash = 'm//';
Subroutine BEGIN: called CC=1 SCAR=0.0
2880  
2881 # ord() to ord() or Latin3::ord()
2882 422 my $function_ord = 'ord';
2883  
2884 # ord to ord or Latin3::ord_
2885 422 my $function_ord_ = 'ord';
2886  
2887 # reverse to reverse or Latin3::reverse
2888 422 my $function_reverse = 'reverse';
2889  
2890 # getc to getc or Latin3::getc
2891 422 my $function_getc = 'getc';
2892  
2893 # P.1023 Appendix W.9 Multibyte Anchoring
2894 # of ISBN 1-56592-224-7 CJKV Information Processing
2895  
2896 422 my $anchor = '';
2897  
2898 422 ▶use vars qw($nest);
Subroutine BEGIN: called CC=1 SCAR=0.0
2899  
2900 # regexp of nested parens in qqXX
2901  
2902 # P.340 Matching Nested Constructs with Embedded Code
2903 # in Chapter 7: Perl
2904 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
2905  
2906 my $qq_paren = qr{(?{local $nest=0}) (?>(?:
2907 [^\\()] |
2908 \( (?{$nest++}) |
2909 \) (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2910 \\ [^c] |
2911 \\c[\x40-\x5F] |
2912 [\x00-\xFF]
2913 422 }xms;
2914  
2915 my $qq_brace = qr{(?{local $nest=0}) (?>(?:
2916 [^\\{}] |
2917 \{ (?{$nest++}) |
2918 \} (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2919 \\ [^c] |
2920 \\c[\x40-\x5F] |
2921 [\x00-\xFF]
2922 422 }xms;
2923  
2924 my $qq_bracket = qr{(?{local $nest=0}) (?>(?:
2925 [^\\\[\]] |
2926 \[ (?{$nest++}) |
2927 \] (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2928 \\ [^c] |
2929 \\c[\x40-\x5F] |
2930 [\x00-\xFF]
2931 422 }xms;
2932  
2933 my $qq_angle = qr{(?{local $nest=0}) (?>(?:
2934 [^\\<>] |
2935 \< (?{$nest++}) |
2936 \> (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2937 \\ [^c] |
2938 \\c[\x40-\x5F] |
2939 [\x00-\xFF]
2940 422 }xms;
2941  
2942 422 my $qq_scalar = qr{(?: \{ (?:$qq_brace)*? \} |
2943 (?: ::)? (?:
2944 (?> [a-zA-Z_][a-zA-Z_0-9]* (?: ::[a-zA-Z_][a-zA-Z_0-9]*)* )
2945 (?>(?: \[ (?: \$\[ | \$\] | $qq_char )*? \] | \{ (?:$qq_brace)*? \} )*)
2946 (?>(?: (?: -> )? (?: [\$\@\%\&\*]\* | \$\#\* | [\@\%]? \[ (?: \$\[ | \$\] | $qq_char )*? \] | [\@\%\*]? \{ (?:$qq_brace)*? \} ) )*)
2947 ))
2948 }xms;
2949  
2950 422 my $qq_variable = qr{(?: \{ (?:$qq_brace)*? \} |
2951 (?: ::)? (?:
2952 (?>[0-9]+) |
2953 [^a-zA-Z_0-9\[\]] |
2954 ^[A-Z] |
2955 (?> [a-zA-Z_][a-zA-Z_0-9]* (?: ::[a-zA-Z_][a-zA-Z_0-9]*)* )
2956 (?>(?: \[ (?: \$\[ | \$\] | $qq_char )*? \] | \{ (?:$qq_brace)*? \} )*)
2957 (?>(?: (?: -> )? (?: [\$\@\%\&\*]\* | \$\#\* | [\@\%]? \[ (?: \$\[ | \$\] | $qq_char )*? \] | [\@\%\*]? \{ (?:$qq_brace)*? \} ) )*)
2958 ))
2959 }xms;
2960  
2961 422 my $qq_substr = qr{(?> Char::substr | Latin3::substr | CORE::substr | substr ) (?>\s*) \( $qq_paren \)
2962 }xms;
2963  
2964 # regexp of nested parens in qXX
2965 my $q_paren = qr{(?{local $nest=0}) (?>(?:
2966 [^()] |
2967 \( (?{$nest++}) |
2968 \) (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2969 [\x00-\xFF]
2970 422 }xms;
2971  
2972 my $q_brace = qr{(?{local $nest=0}) (?>(?:
2973 [^\{\}] |
2974 \{ (?{$nest++}) |
2975 \} (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2976 [\x00-\xFF]
2977 422 }xms;
2978  
2979 my $q_bracket = qr{(?{local $nest=0}) (?>(?:
2980 [^\[\]] |
2981 \[ (?{$nest++}) |
2982 \] (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2983 [\x00-\xFF]
2984 422 }xms;
2985  
2986 my $q_angle = qr{(?{local $nest=0}) (?>(?:
2987 [^<>] |
2988 \< (?{$nest++}) |
2989 \> (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2990 [\x00-\xFF]
2991 422 }xms;
2992  
2993 422 my $matched = '';
2994 422 my $s_matched = '';
2995  
2996 422 my $tr_variable = ''; # variable of tr///
2997 422 my $sub_variable = ''; # variable of s///
2998 422 my $bind_operator = ''; # =~ or !~
2999  
3000 422 my @heredoc = (); # here document
3001 422 my @heredoc_delimiter = ();
3002 422 my $here_script = ''; # here script
3003  
3004 #
3005 # escape Latin-3 script
3006 #
3007 547 ▶sub Latin3::escape(;$) {
Subroutine escape: called CC=3 SCAR=11.0
3008 547 ▶ local($_) = $_[0] if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 292 255 547
3009  
3010 # P.359 The Study Function
3011 # in Chapter 7: Perl
3012 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3013  
3014 547 study $_; # Yes, I studied study yesterday.
3015  
3016 # while all script
3017  
3018 # 6.14. Matching from Where the Last Pattern Left Off
3019 # in Chapter 6. Pattern Matching
3020 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
3021 # (and so on)
3022  
3023 # one member of Tag-team
3024 #
3025 # P.128 Start of match (or end of previous match): \G
3026 # P.130 Advanced Use of \G with Perl
3027 # in Chapter 3: Overview of Regular Expression Features and Flavors
3028 # P.255 Use leading anchors
3029 # P.256 Expose ^ and \G at the front expressions
3030 # in Chapter 6: Crafting an Efficient Expression
3031 # P.315 "Tag-team" matching with /gc
3032 # in Chapter 7: Perl
3033 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3034  
3035 547 my $e_script = '';
3036 547 ▶ while (not /\G \z/oxgc) { # member
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 86416 547 86963
3037 86416 $e_script .= Latin3::escape_token();
3038 }
3039  
3040 547 return $e_script;
3041 }
3042  
3043 #
3044 # escape Latin-3 token of script
3045 #
3046 86416 ▶sub Latin3::escape_token {
Subroutine escape_token: called CC=504 SCAR=109.3
3047  
3048 # \n output here document
3049  
3050 86416 my $ignore_modules = join('|', qw(
3051 utf8
3052 bytes
3053 charnames
3054 I18N::Japanese
3055 I18N::Collate
3056 I18N::JExt
3057 File::DosGlob
3058 Wild
3059 Wildcard
3060 Japanese
3061 ));
3062  
3063 # another member of Tag-team
3064 #
3065 # P.315 "Tag-team" matching with /gc
3066 # in Chapter 7: Perl
3067 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3068  
3069 86416 ▶ if (/\G ( \n ) /oxgc) { # another member (and so on)
Branch: 139 branches
BranchTrueFalseTotal
if (/\G ( \n ) /cgox) { } 12818 73598 86416
elsif (/\G ((?>\s+)|\#.*) /cgox) { } 21310 52288 73598
elsif (/\G ( (?: if | elsif | unless | while | until | given | when ) (?>\s*) \( ) /cgox) { } 1644 50644 52288
elsif (/\G ( \( (?>\s*) (?: local \b | my \b | our \b | state \b )? (?>\s*) \$ $qq_scalar ) /cgox) { } 90 50554 50644
elsif (/\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /cgmosx) { } 4 50550 50554
elsif (/\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /cgmosx) { } 28 50522 50550
elsif (/\G ( \$' | \$\{'\} ) /cgmosx) { } 1 50521 50522
elsif (/\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /cgmosx) { } 3 50518 50521
elsif (/\G ( \$ $qq_scalar | $qq_substr ) /cgox) { } 1752 48766 50518
elsif (/\G ( [,;] ) /cgox) { } 5063 43703 48766
elsif (/\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /cgmosx) { } 0 43703 43703
elsif (/\G ( \$ 0 ) /cgmosx) { } 2 43701 43703
elsif (/\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /cgmosx) { } 0 43701 43701
elsif (/\G ( \$ \$ ) (?![\w\{]) /cgmosx) { } 1 43700 43701
elsif (/\G \$ ((?>[1-9][0-9]*)) /cgmosx) { } 4 43696 43700
elsif (/\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /cgmosx) { } 0 43696 43696
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /cgmosx) { } 0 43696 43696
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /cgmosx) { } 0 43696 43696
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /cgmosx) { } 0 43696 43696
elsif (/\G \$ (?>\s*) \{ ( (?>\s*) (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* ) (?>\s*) ) \} /cgmosx) { } 0 43696 43696
elsif (/\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /cgmosx) { } 0 43696 43696
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 43654 43696
elsif (m{\G ( \$[\$\@\#\\\'\"/\?\(\)\[\]\<\>] ) }cgmosx) { } 63 43591 43654
elsif (/\G \b (while (?>\s*) \( (?>\s*) <[\$]?[A-Za-z_][A-Za-z_0-9]*> (?>\s*) \)) \b /cgox) { } 0 43591 43591
elsif (/\G \b while (?>\s*) \( (?>\s*) < ((?:[^>\0\a\e\f\n\r\t])+?) > (?>\s*) \) \b /cgox) { } 0 43591 43591
elsif (/\G \b while (?>\s*) \( (?>\s*) glob (?>\s*) \) /cgox) { } 0 43591 43591
elsif (/\G \b while (?>\s*) \( (?>\s*) glob \b /cgox) { } 0 43591 43591
elsif (/\G \b ( if | unless | while | until | for | when ) \b /cgox) { } 251 43340 43591
elsif (/\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /cgox) { } 19 43321 43340
elsif (/\G \b Char::eval (?= (?>\s*) \{ ) /cgox) { } 0 43321 43321
elsif (/\G \b Latin3::eval (?= (?>\s*) \{ ) /cgox) { } 22 43299 43321
elsif (/\G \b Char::eval \b (?! (?>\s*) => ) /cgox) { } 0 43299 43299
elsif (/\G \b Latin3::eval \b (?! (?>\s*) => ) /cgox) { } 168 43131 43299
elsif (/\G \b bytes::substr \b (?! (?>\s*) => ) /cgox) { } 2 43129 43131
elsif (/\G \b chop \b (?! (?>\s*) => ) /cgox) { } 0 43129 43129
elsif (/\G \b bytes::index \b (?! (?>\s*) => ) /cgox) { } 2 43127 43129
elsif (/\G \b Char::index \b (?! (?>\s*) => ) /cgox) { } 0 43127 43127
elsif (/\G \b Latin3::index \b (?! (?>\s*) => ) /cgox) { } 0 43127 43127
elsif (/\G \b index \b (?! (?>\s*) => ) /cgox) { } 0 43127 43127
elsif (/\G \b bytes::rindex \b (?! (?>\s*) => ) /cgox) { } 2 43125 43127
elsif (/\G \b Char::rindex \b (?! (?>\s*) => ) /cgox) { } 0 43125 43125
elsif (/\G \b Latin3::rindex \b (?! (?>\s*) => ) /cgox) { } 0 43125 43125
elsif (/\G \b rindex \b (?! (?>\s*) => ) /cgox) { } 0 43125 43125
elsif (/\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 1 43124 43125
elsif (/\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43124 43124
elsif (/\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 1 43123 43124
elsif (/\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43123 43123
elsif (/\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 6 43117 43123
elsif (/\G -s (?>\s*) (\") ((?:$Elatin3::qq_char)+?) (\") /cgox) { } 0 43117 43117
elsif (/\G -s (?>\s+) qq (?>\s*) (\#) ((?:$Elatin3::qq_char)+?) (\#) /cgox) { } 0 43117 43117
elsif (/\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /cgox) { } 0 43117 43117
elsif (/\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /cgox) { } 0 43117 43117
elsif (/\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /cgox) { } 0 43117 43117
elsif (/\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /cgox) { } 0 43117 43117
elsif (/\G -s (?>\s+) qq (?>\s*) (\S) ((?:$Elatin3::qq_char)+?) (\1) /cgox) { } 0 43117 43117
elsif (/\G -s (?>\s*) (\') ((?:\\\'|\\\\|$Elatin3::q_char)+?) (\') /cgox) { } 0 43117 43117
elsif (/\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$Elatin3::q_char)+?) (\#) /cgox) { } 0 43117 43117
elsif (/\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /cgox) { } 0 43117 43117
elsif (/\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /cgox) { } 0 43117 43117
elsif (/\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /cgox) { } 0 43117 43117
elsif (/\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /cgox) { } 0 43117 43117
elsif (/\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$Elatin3::q_char)+?) (\1) /cgox) { } 0 43117 43117
elsif (/\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)* ) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ) )*) /cgox) { } 0 43117 43117
elsif (/\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /cgox) { } 0 43117 43117
elsif (/\G -s (?= (?>\s+) [a-z]+) /cgox) { } 0 43117 43117
elsif (/\G -s (?>\s+) ((?>\w+)) /cgox) { } 0 43117 43117
elsif (/\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43115 43117
elsif (/\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43113 43115
elsif (/\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 36 43077 43113
elsif (/\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43075 43077
elsif (/\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 8 43067 43075
elsif (/\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43067 43067
elsif (/\G \b lc \b (?! (?>\s*) => ) /cgox) { } 0 43067 43067
elsif (/\G \b lcfirst \b (?! (?>\s*) => ) /cgox) { } 0 43067 43067
elsif (/\G \b uc \b (?! (?>\s*) => ) /cgox) { } 0 43067 43067
elsif (/\G \b ucfirst \b (?! (?>\s*) => ) /cgox) { } 0 43067 43067
elsif (/\G \b fc \b (?! (?>\s*) => ) /cgox) { } 0 43067 43067
elsif (/\G -s \b (?! (?>\s*) => ) /cgox) { } 0 43067 43067
elsif (/\G \b bytes::length \b (?! (?>\s*) => ) /cgox) { } 0 43067 43067
elsif (/\G \b bytes::chr \b (?! (?>\s*) => ) /cgox) { } 0 43067 43067
elsif (/\G \b chr \b (?! (?>\s*) => ) /cgox) { } 0 43067 43067
elsif (/\G \b bytes::ord \b (?! (?>\s*) => ) /cgox) { } 0 43067 43067
elsif (/\G \b ord \b (?! (?>\s*) => ) /cgox) { } 0 43067 43067
elsif (/\G \b glob \b (?! (?>\s*) => ) /cgox) { } 0 43067 43067
elsif (/\G \b reverse \b (?! (?>\s*) => ) /cgox) { } 0 43067 43067
elsif (/\G \b getc \b (?! (?>\s*) => ) /cgox) { } 8 43059 43067
elsif (/\G \b (split) \b (?! (?>\s*) => ) /cgox) { } 87 42972 43059
elsif (/\G \b ( tr | y ) \b /cgox) { } 4 42968 42972
elsif (/\G \b (qq) \b /cgox) { } 2252 40716 42968
elsif (/\G \b (qr) \b /cgox) { } 0 40716 40716
elsif (/\G \b (qw) \b /cgox) { } 16 40700 40716
elsif (/\G \b (qx) \b /cgox) { } 0 40700 40700
elsif (/\G \b (q) \b /cgox) { } 473 40227 40700
elsif (/\G \b (m) \b /cgox) { } 209 40018 40227
elsif (/\G \b (s) \b /cgox) { } 101 39917 40018
elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 0 39917 39917
elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 39917 39917
elsif (/\G \b require ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 39917 39917
elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [#\n]) /cgmosx) { } 37 39880 39917
elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 39880 39880
elsif (/\G \b use ((?>\s+) strict) \b /cgmosx) { } 0 39880 39880
elsif (/\G \b use (?>\s+) ((?>([1-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /cgmosx) { } 2 39878 39880
elsif (/\G \b use (?>\s+) ((?>v([0-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /cgmosx) { } 0 39878 39878
elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 2 39876 39878
elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 39876 39876
elsif (/\G \b use ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 39876 39876
elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 0 39876 39876
elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 39876 39876
elsif (/\G \b no ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 39876 39876
elsif (/\G \b use \b /cgmosx) { } 0 39876 39876
elsif (/\G \b no \b /cgmosx) { } 2 39874 39876
elsif (/\G (?<![\w\$\@\%\&\*]) (\') /cgox) { } 1142 38732 39874
elsif (/\G (\") /cgox) { } 1883 36849 38732
elsif (/\G (\`) /cgox) { } 1 36848 36849
elsif ($Elatin3::slash eq 'm//' and m[\G (/) ]cgox) { } 681 36167 36848
elsif ($Elatin3::slash eq 'm//' and /\G (\?) /cgox) { } 0 36167 36167
elsif (/\G ( <<>> ) /cgox) { } 0 36167 36167
elsif (/\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /cgox) { } 0 36167 36167
elsif (/\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /cgox) { } 6 36161 36167
elsif (/\G ( <<~ \\([a-zA-Z_0-9]+) ) /cgox) { } 3 36158 36161
elsif (/\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /cgox) { } 6 36152 36158
elsif (/\G ( <<~ ([a-zA-Z_0-9]+) ) /cgox) { } 3 36149 36152
elsif (/\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /cgox) { } 6 36143 36149
elsif (/\G ( << '([a-zA-Z_0-9]*)' ) /cgox) { } 72 36071 36143
elsif (/\G ( << \\([a-zA-Z_0-9]+) ) /cgox) { } 0 36071 36071
elsif (/\G ( << "([a-zA-Z_0-9]*)" ) /cgox) { } 36 36035 36071
elsif (/\G ( << ([a-zA-Z_0-9]+) ) /cgox) { } 42 35993 36035
elsif (/\G ( << `([a-zA-Z_0-9]*)` ) /cgox) { } 0 35993 35993
elsif (/\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/cgox) { } 12 35981 35993
elsif (/\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /cgox) { } 0 35981 35981
elsif (/\G < ((?:[^>\0\a\e\f\n\r\t])+?) > /cgox) { } 0 35981 35981
elsif (/\G ^ ( __DATA__ \n .*) \z /cgmosx) { } 0 35981 35981
elsif (/\G ^ ( __END__ \n .*) \z /cgmosx) { } 210 35771 35981
elsif (/\G ( \cD .*) \z /cgmosx) { } 0 35771 35771
elsif (/\G ( \cZ .*) \z /cgmosx) { } 0 35771 35771
elsif (/\G ( -- | \+\+ | [\)\}\]] ) /cgox) { } 5837 29934 35771
elsif (/\G ( \.\.\. ) /cgox) { } 7 29927 29934
elsif (m"\G ((?> !~~ | !~ | != | ! | %= | % | &&= | && | &= | &\.= | &\. | & | -= | -> | - | :(?>\s*)= | : | <<>> | <<= | <=> | <= | < | == | => | =~ | = | >>= | >> | >= | > | \*\*= | \*\* | \*= | \* | \+= | \+ | \.\. | \.= | \. | //= | // | /= | / | \? | \\ | \^= | \^\.= | \^\. | \^ | \b x= | \|\|= | \|\| | \|= | \|\.= | \|\. | \| | ~~ | ~\. | ~ | \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b | \b(?: print )\b | [,;\(\{\[] )) "cgox) { } 9771 20156 29927
elsif (/\G ($Elatin3::q_char) /cgox) { } 20156 0 20156
3070 12818 my $heredoc = '';
3071 12818 ▶ if (scalar(@heredoc_delimiter) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @heredoc_delimiter >= 1) 174 12644 12818
3072 174 $slash = 'm//';
3073  
3074 174 $heredoc = join '', @heredoc;
3075 174 @heredoc = ();
3076  
3077 # skip here document
3078 174 for my $heredoc_delimiter (@heredoc_delimiter) {
3079 174 /\G .*? \n $heredoc_delimiter \n/xmsgc;
3080 }
3081 174 @heredoc_delimiter = ();
3082  
3083 174 $here_script = '';
3084 }
3085 12818 return "\n" . $heredoc;
3086 }
3087  
3088 # ignore space, comment
3089 21310 elsif (/\G ((?>\s+)|\#.*) /oxgc) { return $1; }
3090  
3091 # if (, elsif (, unless (, while (, until (, given (, and when (
3092  
3093 # given, when
3094  
3095 # P.225 The given Statement
3096 # in Chapter 15: Smart Matching and given-when
3097 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
3098  
3099 # P.133 The given Statement
3100 # in Chapter 4: Statements and Declarations
3101 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
3102  
3103 elsif (/\G ( (?: if | elsif | unless | while | until | given | when ) (?>\s*) \( ) /oxgc) {
3104 1644 $slash = 'm//';
3105 1644 return $1;
3106 }
3107  
3108 # scalar variable ($scalar = ...) =~ tr///;
3109 # scalar variable ($scalar = ...) =~ s///;
3110  
3111 # state
3112  
3113 # P.68 Persistent, Private Variables
3114 # in Chapter 4: Subroutines
3115 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
3116  
3117 # P.160 Persistent Lexically Scoped Variables: state
3118 # in Chapter 4: Statements and Declarations
3119 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
3120  
3121 # (and so on)
3122  
3123 elsif (/\G ( \( (?>\s*) (?: local \b | my \b | our \b | state \b )? (?>\s*) \$ $qq_scalar ) /oxgc) {
3124 90 my $e_string = e_string($1);
3125  
3126 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
3127 0 $tr_variable = $e_string . e_string($1);
3128 0 $bind_operator = $2;
3129 0 $slash = 'm//';
3130 0 return '';
3131 }
3132 elsif (/\G ( (?>\s*) = $qq_paren \) ) ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /oxgc) {
3133 0 $sub_variable = $e_string . e_string($1);
3134 0 $bind_operator = $2;
3135 0 $slash = 'm//';
3136 0 return '';
3137 }
3138 else {
3139 90 $slash = 'div';
3140 90 return $e_string;
3141 }
3142 }
3143  
3144 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin3::PREMATCH()
3145 elsif (/\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /oxmsgc) {
3146 4 $slash = 'div';
3147 4 return q{Elatin3::PREMATCH()};
3148 }
3149  
3150 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin3::MATCH()
3151 elsif (/\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /oxmsgc) {
3152 28 $slash = 'div';
3153 28 return q{Elatin3::MATCH()};
3154 }
3155  
3156 # $', ${'} --> $', ${'}
3157 elsif (/\G ( \$' | \$\{'\} ) /oxmsgc) {
3158 1 $slash = 'div';
3159 1 return $1;
3160 }
3161  
3162 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin3::POSTMATCH()
3163 elsif (/\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /oxmsgc) {
3164 3 $slash = 'div';
3165 3 return q{Elatin3::POSTMATCH()};
3166 }
3167  
3168 # scalar variable $scalar =~ tr///;
3169 # scalar variable $scalar =~ s///;
3170 # substr() =~ tr///;
3171 # substr() =~ s///;
3172 elsif (/\G ( \$ $qq_scalar | $qq_substr ) /oxgc) {
3173 1752 my $scalar = e_string($1);
3174  
3175 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
3176 2 $tr_variable = $scalar;
3177 2 $bind_operator = $1;
3178 2 $slash = 'm//';
3179 2 return '';
3180 }
3181 elsif (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /oxgc) {
3182 65 $sub_variable = $scalar;
3183 65 $bind_operator = $1;
3184 65 $slash = 'm//';
3185 65 return '';
3186 }
3187 else {
3188 1685 $slash = 'div';
3189 1685 return $scalar;
3190 }
3191 }
3192  
3193 # end of statement
3194 elsif (/\G ( [,;] ) /oxgc) {
3195 5063 $slash = 'm//';
3196  
3197 # clear tr/// variable
3198 5063 $tr_variable = '';
3199  
3200 # clear s/// variable
3201 5063 $sub_variable = '';
3202  
3203 5063 $bind_operator = '';
3204  
3205 5063 return $1;
3206 }
3207  
3208 # bareword
3209 elsif (/\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /oxmsgc) {
3210 0 return $1;
3211 }
3212  
3213 # $0 --> $0
3214 elsif (/\G ( \$ 0 ) /oxmsgc) {
3215 2 $slash = 'div';
3216 2 return $1;
3217 }
3218 elsif (/\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /oxmsgc) {
3219 0 $slash = 'div';
3220 0 return $1;
3221 }
3222  
3223 # $$ --> $$
3224 elsif (/\G ( \$ \$ ) (?![\w\{]) /oxmsgc) {
3225 1 $slash = 'div';
3226 1 return $1;
3227 }
3228  
3229 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
3230 # $1, $2, $3 --> $1, $2, $3 otherwise
3231 elsif (/\G \$ ((?>[1-9][0-9]*)) /oxmsgc) {
3232 4 $slash = 'div';
3233 4 return e_capture($1);
3234 }
3235 elsif (/\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /oxmsgc) {
3236 0 $slash = 'div';
3237 0 return e_capture($1);
3238 }
3239  
3240 # $$foo[ ... ] --> $ $foo->[ ... ]
3241 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /oxmsgc) {
3242 0 $slash = 'div';
3243 0 return e_capture($1.'->'.$2);
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
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);
3256 }
3257  
3258 # ${ foo }
3259 elsif (/\G \$ (?>\s*) \{ ( (?>\s*) (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* ) (?>\s*) ) \} /oxmsgc) {
3260 0 $slash = 'div';
3261 0 return '${' . $1 . '}';
3262 }
3263  
3264 # ${ ... }
3265 elsif (/\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /oxmsgc) {
3266 0 $slash = 'div';
3267 0 return e_capture($1);
3268 }
3269  
3270 # variable or function
3271 # $ @ % & * $ #
3272 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) {
3273 42 $slash = 'div';
3274 42 return $1;
3275 }
3276 # $ $ $ $ $ $ $ $ $ $ $ $ $ $
3277 # $ @ # \ ' " / ? ( ) [ ] < >
3278 elsif (/\G ( \$[\$\@\#\\\'\"\/\?\(\)\[\]\<\>] ) /oxmsgc) {
3279 63 $slash = 'div';
3280 63 return $1;
3281 }
3282  
3283 # while (<FILEHANDLE>)
3284 elsif (/\G \b (while (?>\s*) \( (?>\s*) <[\$]?[A-Za-z_][A-Za-z_0-9]*> (?>\s*) \)) \b /oxgc) {
3285 0 return $1;
3286 }
3287  
3288 # while (<WILDCARD>) --- glob
3289  
3290 # avoid "Error: Runtime exception" of perl version 5.005_03
3291  
3292 elsif (/\G \b while (?>\s*) \( (?>\s*) < ((?:[^>\0\a\e\f\n\r\t])+?) > (?>\s*) \) \b /oxgc) {
3293 0 return 'while ($_ = Elatin3::glob("' . $1 . '"))';
3294 }
3295  
3296 # while (glob)
3297 elsif (/\G \b while (?>\s*) \( (?>\s*) glob (?>\s*) \) /oxgc) {
3298 0 return 'while ($_ = Elatin3::glob_)';
3299 }
3300  
3301 # while (glob(WILDCARD))
3302 elsif (/\G \b while (?>\s*) \( (?>\s*) glob \b /oxgc) {
3303 0 return 'while ($_ = Elatin3::glob';
3304 }
3305  
3306 # doit if, doit unless, doit while, doit until, doit for, doit when
3307 251 elsif (/\G \b ( if | unless | while | until | for | when ) \b /oxgc) { $slash = 'm//'; return $1; }
3308  
3309 # subroutines of package Elatin3
3310 19 elsif (/\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /oxgc) { $slash = 'm//'; return $1; }
3311 0 elsif (/\G \b Char::eval (?= (?>\s*) \{ ) /oxgc) { $slash = 'm//'; return 'eval'; }
3312 22 elsif (/\G \b Latin3::eval (?= (?>\s*) \{ ) /oxgc) { $slash = 'm//'; return 'eval'; }
3313 0 elsif (/\G \b Char::eval \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'eval Char::escape'; }
3314 168 elsif (/\G \b Latin3::eval \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'eval Latin3::escape'; }
3315 2 elsif (/\G \b bytes::substr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'substr'; }
3316 0 elsif (/\G \b chop \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin3::chop'; }
3317 2 elsif (/\G \b bytes::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'index'; }
3318 0 elsif (/\G \b Char::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Char::index'; }
3319 0 elsif (/\G \b Latin3::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Latin3::index'; }
3320 0 elsif (/\G \b index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin3::index'; }
3321 2 elsif (/\G \b bytes::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'rindex'; }
3322 0 elsif (/\G \b Char::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Char::rindex'; }
3323 0 elsif (/\G \b Latin3::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Latin3::rindex'; }
3324 0 elsif (/\G \b rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin3::rindex'; }
3325 1 elsif (/\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin3::lc'; }
3326 0 elsif (/\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin3::lcfirst'; }
3327 1 elsif (/\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin3::uc'; }
3328 0 elsif (/\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin3::ucfirst'; }
3329 6 elsif (/\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin3::fc'; }
3330  
3331 # "-s '' ..." means file test "-s 'filename' ..." (not means "- s/// ...")
3332 0 elsif (/\G -s (?>\s*) (\") ((?:$qq_char)+?) (\") /oxgc) { $slash = 'm//'; return '-s ' . e_qq('', $1,$3,$2); }
3333 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\#) ((?:$qq_char)+?) (\#) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3334 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3335 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3336 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3337 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3338 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\S) ((?:$qq_char)+?) (\1) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3339  
3340 0 elsif (/\G -s (?>\s*) (\') ((?:\\\'|\\\\|$q_char)+?) (\') /oxgc) { $slash = 'm//'; return '-s ' . e_q ('', $1,$3,$2); }
3341 0 elsif (/\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$q_char)+?) (\#) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3342 0 elsif (/\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3343 0 elsif (/\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3344 0 elsif (/\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3345 0 elsif (/\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3346 0 elsif (/\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$q_char)+?) (\1) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3347  
3348 elsif (/\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)* ) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ) )*) /oxgc)
3349 0 { $slash = 'm//'; return "-s $1"; }
3350 0 elsif (/\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /oxgc) { $slash = 'm//'; return "-s ($1)"; }
3351 0 elsif (/\G -s (?= (?>\s+) [a-z]+) /oxgc) { $slash = 'm//'; return '-s'; }
3352 0 elsif (/\G -s (?>\s+) ((?>\w+)) /oxgc) { $slash = 'm//'; return "-s $1"; }
3353  
3354 2 elsif (/\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'length'; }
3355 2 elsif (/\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'chr'; }
3356 36 elsif (/\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin3::chr'; }
3357 2 elsif (/\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'div'; return 'ord'; }
3358 8 elsif (/\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'div'; return $function_ord; }
3359 0 elsif (/\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin3::glob'; }
3360 0 elsif (/\G \b lc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin3::lc_'; }
3361 0 elsif (/\G \b lcfirst \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin3::lcfirst_'; }
3362 0 elsif (/\G \b uc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin3::uc_'; }
3363 0 elsif (/\G \b ucfirst \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin3::ucfirst_'; }
3364 0 elsif (/\G \b fc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin3::fc_'; }
3365 0 elsif (/\G -s \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return '-s '; }
3366  
3367 0 elsif (/\G \b bytes::length \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'length'; }
3368 0 elsif (/\G \b bytes::chr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'chr'; }
3369 0 elsif (/\G \b chr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin3::chr_'; }
3370 0 elsif (/\G \b bytes::ord \b (?! (?>\s*) => ) /oxgc) { $slash = 'div'; return 'ord'; }
3371 0 elsif (/\G \b ord \b (?! (?>\s*) => ) /oxgc) { $slash = 'div'; return $function_ord_; }
3372 0 elsif (/\G \b glob \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin3::glob_'; }
3373 0 elsif (/\G \b reverse \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return $function_reverse; }
3374 8 elsif (/\G \b getc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return $function_getc; }
3375 # split
3376 elsif (/\G \b (split) \b (?! (?>\s*) => ) /oxgc) {
3377 87 $slash = 'm//';
3378  
3379 87 my $e = '';
3380 87 ▶ while (/\G ( (?>\s+) | \( | \#.* ) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\G ( (?>\s+) | \( | \#.* ) /cgox) 85 87 172
3381 85 $e .= $1;
3382 }
3383  
3384 # end of split
3385 87 ▶ if (/\G (?= [,;\)\}\]] ) /oxgc) { return 'Elatin3::split' . $e; }
Branch: 23 branches
BranchTrueFalseTotal
if (/\G (?= [,;\)\}\]] ) /cgox) { } 2 85 87
elsif (/\G ( [\$\@\&\*] $qq_scalar ) /cgox) { } 1 84 85
elsif (/\G \b qq (\#) [ ] (\#) /cgox) { } 0 84 84
elsif (/\G \b qq ((?>\s*)) (\() [ ] (\)) /cgox) { } 0 84 84
elsif (/\G \b qq ((?>\s*)) (\{) [ ] (\}) /cgox) { } 0 84 84
elsif (/\G \b qq ((?>\s*)) (\[) [ ] (\]) /cgox) { } 0 84 84
elsif (/\G \b qq ((?>\s*)) (\<) [ ] (\>) /cgox) { } 0 84 84
elsif (/\G \b qq ((?>\s*)) (\S) [ ] (\2) /cgox) { } 0 84 84
elsif (/\G \b q (\#) [ ] (\#) /cgox) { } 0 84 84
elsif (/\G \b q ((?>\s*)) (\() [ ] (\)) /cgox) { } 0 84 84
elsif (/\G \b q ((?>\s*)) (\{) [ ] (\}) /cgox) { } 0 84 84
elsif (/\G \b q ((?>\s*)) (\[) [ ] (\]) /cgox) { } 0 84 84
elsif (/\G \b q ((?>\s*)) (\<) [ ] (\>) /cgox) { } 0 84 84
elsif (/\G \b q ((?>\s*)) (\S) [ ] (\2) /cgox) { } 0 84 84
elsif (/\G ' [ ] ' /cgox) { } 10 74 84
elsif (/\G " [ ] " /cgox) { } 0 74 74
elsif (/\G \b (qq) \b /cgox) { } 0 74 74
elsif (/\G \b (qr) \b /cgox) { } 12 62 74
elsif (/\G \b (q) \b /cgox) { } 0 62 62
elsif (/\G \b (m) \b /cgox) { } 18 44 62
elsif (/\G (\') /cgox) { } 0 44 44
elsif (/\G (\") /cgox) { } 0 44 44
elsif (m[\G (/) ]cgox) { } 44 0 44
3386  
3387 # split scalar value
3388 1 elsif (/\G ( [\$\@\&\*] $qq_scalar ) /oxgc) { return 'Elatin3::split' . $e . e_string($1); }
3389  
3390 # split literal space
3391 0 elsif (/\G \b qq (\#) [ ] (\#) /oxgc) { return 'Elatin3::split' . $e . qq {qq$1 $2}; }
3392 0 elsif (/\G \b qq ((?>\s*)) (\() [ ] (\)) /oxgc) { return 'Elatin3::split' . $e . qq{$1qq$2 $3}; }
3393 0 elsif (/\G \b qq ((?>\s*)) (\{) [ ] (\}) /oxgc) { return 'Elatin3::split' . $e . qq{$1qq$2 $3}; }
3394 0 elsif (/\G \b qq ((?>\s*)) (\[) [ ] (\]) /oxgc) { return 'Elatin3::split' . $e . qq{$1qq$2 $3}; }
3395 0 elsif (/\G \b qq ((?>\s*)) (\<) [ ] (\>) /oxgc) { return 'Elatin3::split' . $e . qq{$1qq$2 $3}; }
3396 0 elsif (/\G \b qq ((?>\s*)) (\S) [ ] (\2) /oxgc) { return 'Elatin3::split' . $e . qq{$1qq$2 $3}; }
3397 0 elsif (/\G \b q (\#) [ ] (\#) /oxgc) { return 'Elatin3::split' . $e . qq {q$1 $2}; }
3398 0 elsif (/\G \b q ((?>\s*)) (\() [ ] (\)) /oxgc) { return 'Elatin3::split' . $e . qq {$1q$2 $3}; }
3399 0 elsif (/\G \b q ((?>\s*)) (\{) [ ] (\}) /oxgc) { return 'Elatin3::split' . $e . qq {$1q$2 $3}; }
3400 0 elsif (/\G \b q ((?>\s*)) (\[) [ ] (\]) /oxgc) { return 'Elatin3::split' . $e . qq {$1q$2 $3}; }
3401 0 elsif (/\G \b q ((?>\s*)) (\<) [ ] (\>) /oxgc) { return 'Elatin3::split' . $e . qq {$1q$2 $3}; }
3402 0 elsif (/\G \b q ((?>\s*)) (\S) [ ] (\2) /oxgc) { return 'Elatin3::split' . $e . qq {$1q$2 $3}; }
3403 10 elsif (/\G ' [ ] ' /oxgc) { return 'Elatin3::split' . $e . qq {' '}; }
3404 0 elsif (/\G " [ ] " /oxgc) { return 'Elatin3::split' . $e . qq {" "}; }
3405  
3406 # split qq//
3407 elsif (/\G \b (qq) \b /oxgc) {
3408 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin3::qq_char)*?) (\#) /cgox) { } 0 0 0
3409 else {
3410 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3411 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 7 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif (/\G (\() ((?:$qq_paren)*?) (\)) /cgox) { } 0 0 0
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /cgox) { } 0 0 0
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /cgox) { } 0 0 0
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /cgox) { } 0 0 0
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin3::qq_char)*?) (\1) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin3::qq_char)*?) (\1) /cgox) { } 0 0 0
3412 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq ( ) --> qr ( )
3413 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq { } --> qr { }
3414 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq [ ] --> qr [ ]
3415 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq < > --> qr < >
3416 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) /oxgc) { return e_split($e.'qr','{','}',$2,''); } # qq | | --> qr { }
3417 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq * * --> qr * *
3418 }
3419 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3420 }
3421 }
3422  
3423 # split qr//
3424 elsif (/\G \b (qr) \b /oxgc) {
3425 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1,$3,$2,$4); } # qr# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin3::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 12 12
3426 else {
3427 12 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 12 0 12
3428 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 8 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 12 12
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /cgox) { } 0 12 12
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /cgox) { } 0 12 12
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /cgox) { } 0 12 12
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /cgox) { } 0 12 12
elsif (/\G (\') ((?:$Elatin3::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 12 12
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin3::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 12 12
elsif (/\G (\S) ((?:$Elatin3::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 12 0 12
3429 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr ( )
3430 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr { }
3431 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr [ ]
3432 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr < >
3433 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { return e_split_q($e.'qr',$1, $3, $2,$4); } # qr ' '
3434 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr','{','}',$2,$4); } # qr | | --> qr { }
3435 12 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr * *
3436 }
3437 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3438 }
3439 }
3440  
3441 # split q//
3442 elsif (/\G \b (q) \b /oxgc) {
3443 0 ▶ if (/\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:\\\#|\\\\|$Elatin3::q_char)*?) (\#) /cgox) { } 0 0 0
3444 else {
3445 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3446 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 7 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif (/\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /cgox) { } 0 0 0
elsif (/\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /cgox) { } 0 0 0
elsif (/\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /cgox) { } 0 0 0
elsif (/\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /cgox) { } 0 0 0
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin3::q_char)*?) (\1) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:\\\\|\\\1| $Elatin3::q_char)*?) (\1) /cgox) { } 0 0 0
3447 0 elsif (/\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q ( ) --> qr ( )
3448 0 elsif (/\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q { } --> qr { }
3449 0 elsif (/\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q [ ] --> qr [ ]
3450 0 elsif (/\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q < > --> qr < >
3451 0 elsif (/\G ([*\-:?\\^|]) ((?:$q_char)*?) (\1) /oxgc) { return e_split_q($e.'qr','{','}',$2,''); } # q | | --> qr { }
3452 0 elsif (/\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q * * --> qr * *
3453 }
3454 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3455 }
3456 }
3457  
3458 # split m//
3459 elsif (/\G \b (m) \b /oxgc) {
3460 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1,$3,$2,$4); } # m# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin3::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
3461 else {
3462 18 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 18 0 18
3463 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 8 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 18 18
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
elsif (/\G (\') ((?:$Elatin3::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin3::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
elsif (/\G (\S) ((?:$Elatin3::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 18 0 18
3464 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m ( ) --> qr ( )
3465 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m { } --> qr { }
3466 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m [ ] --> qr [ ]
3467 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m < > --> qr < >
3468 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { return e_split_q($e.'qr',$1, $3, $2,$4); } # m ' ' --> qr ' '
3469 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr','{','}',$2,$4); } # m | | --> qr { }
3470 18 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m * * --> qr * *
3471 }
3472 0 die __FILE__, ": Search pattern not terminated\n";
3473 }
3474 }
3475  
3476 # split ''
3477 elsif (/\G (\') /oxgc) {
3478 0 my $q_string = '';
3479 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3480 0 ▶ if (/\G (\\\\) /oxgc) { $q_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 0 0
elsif (/\G (\\\') /cgox) { } 0 0 0
elsif (/\G \' /cgox) { } 0 0 0
elsif (/\G ($Elatin3::q_char) /cgox) { } 0 0 0
3481 0 elsif (/\G (\\\') /oxgc) { $q_string .= $1; } # splitqr'' --> split qr''
3482 0 elsif (/\G \' /oxgc) { return e_split_q($e.q{ qr},"'","'",$q_string,''); } # ' ' --> qr ' '
3483 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3484 }
3485 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3486 }
3487  
3488 # split ""
3489 elsif (/\G (\") /oxgc) {
3490 0 my $qq_string = '';
3491 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3492 0 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 0 0
elsif (/\G (\\\") /cgox) { } 0 0 0
elsif (/\G \" /cgox) { } 0 0 0
elsif (/\G ($Elatin3::q_char) /cgox) { } 0 0 0
3493 0 elsif (/\G (\\\") /oxgc) { $qq_string .= $1; } # splitqr"" --> split qr""
3494 0 elsif (/\G \" /oxgc) { return e_split($e.q{ qr},'"','"',$qq_string,''); } # " " --> qr " "
3495 0 elsif (/\G ($q_char) /oxgc) { $qq_string .= $1; }
3496 }
3497 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3498 }
3499  
3500 # split //
3501 elsif (/\G (\/) /oxgc) {
3502 44 my $regexp = '';
3503 44 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 381 0 381
3504 0 ▶ if (/\G (\\\\) /oxgc) { $regexp .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 381 381
elsif (m[\G (\\/) ]cgox) { } 0 381 381
elsif (m[\G / ([cgimosxpadlunbB]*) ]cgox) { } 44 337 381
elsif (/\G ($Elatin3::q_char) /cgox) { } 337 0 337
3505 0 elsif (/\G (\\\/) /oxgc) { $regexp .= $1; } # splitqr// --> split qr//
3506 44 elsif (/\G \/ ([cgimosxpadlunbB]*) /oxgc) { return e_split($e.q{ qr}, '/','/',$regexp,$1); } # / / --> qr / /
3507 337 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
3508 }
3509 0 die __FILE__, ": Search pattern not terminated\n";
3510 }
3511 }
3512  
3513 # tr/// or y///
3514  
3515 # about [cdsrbB]* (/B modifier)
3516 #
3517 # P.559 appendix C
3518 # of ISBN 4-89052-384-7 Programming perl
3519 # (Japanese title is: Perl puroguramingu)
3520  
3521 elsif (/\G \b ( tr | y ) \b /oxgc) {
3522 4 my $ope = $1;
3523  
3524 # $1 $2 $3 $4 $5 $6
3525 4 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ((?:$qq_char)*?) (\#) ([cdsrbB]*) /oxgc) { # tr# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin3::qq_char)*?) (\#) ((?:$Elatin3::qq_char)*?) (\#) ([cdsrbB]*) /cgox) { } 0 4 4
3526 0 my @tr = ($tr_variable,$2);
3527 0 return e_tr(@tr,'',$4,$6);
3528 }
3529 else {
3530 4 my $e = '';
3531 4 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 4 0 4
3532 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 4 4
elsif (/\G (\() ((?:$qq_paren)*?) (\)) /cgox) { } 0 4 4
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /cgox) { } 0 4 4
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /cgox) { } 0 4 4
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /cgox) { } 0 4 4
elsif (/\G (\S) ((?:$Elatin3::qq_char)*?) (\1) ((?:$Elatin3::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 4 0 4
3533 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) {
3534 0 my @tr = ($tr_variable,$2);
3535 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3536 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin3::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3537 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) ( )
3538 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) { }
3539 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) [ ]
3540 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) < >
3541 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) * *
3542 }
3543 0 die __FILE__, ": Transliteration replacement not terminated\n";
3544 }
3545 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) {
3546 0 my @tr = ($tr_variable,$2);
3547 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3548 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin3::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3549 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } ( )
3550 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } { }
3551 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } [ ]
3552 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } < >
3553 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } * *
3554 }
3555 0 die __FILE__, ": Transliteration replacement not terminated\n";
3556 }
3557 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) {
3558 0 my @tr = ($tr_variable,$2);
3559 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3560 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin3::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3561 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] ( )
3562 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] { }
3563 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] [ ]
3564 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] < >
3565 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] * *
3566 }
3567 0 die __FILE__, ": Transliteration replacement not terminated\n";
3568 }
3569 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) {
3570 0 my @tr = ($tr_variable,$2);
3571 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3572 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin3::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3573 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > ( )
3574 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > { }
3575 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > [ ]
3576 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > < >
3577 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > * *
3578 }
3579 0 die __FILE__, ": Transliteration replacement not terminated\n";
3580 }
3581 # $1 $2 $3 $4 $5 $6
3582 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { # tr * * *
3583 4 my @tr = ($tr_variable,$2);
3584 4 return e_tr(@tr,'',$4,$6);
3585 }
3586 }
3587 0 die __FILE__, ": Transliteration pattern not terminated\n";
3588 }
3589 }
3590  
3591 # qq//
3592 elsif (/\G \b (qq) \b /oxgc) {
3593 2252 my $ope = $1;
3594  
3595 # if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { return e_qq($ope,$1,$3,$2); } # qq# #
3596 2252 ▶ if (/\G (\#) /oxgc) { # qq# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) /cgox) { } 0 2252 2252
3597 0 my $qq_string = '';
3598 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3599 0 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 0 0
elsif (/\G (\\\#) /cgox) { } 0 0 0
elsif (/\G (\#) /cgox) { } 0 0 0
elsif (/\G ($Elatin3::qq_char) /cgox) { } 0 0 0
3600 0 elsif (/\G (\\\#) /oxgc) { $qq_string .= $1; }
3601 0 elsif (/\G (\#) /oxgc) { return e_qq($ope,'#','#',$qq_string); }
3602 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3603 }
3604 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3605 }
3606  
3607 else {
3608 2252 my $e = '';
3609 2252 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 2252 0 2252
3610 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
3611  
3612 # elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq ( )
3613 elsif (/\G (\() /oxgc) { # qq ( )
3614 0 my $qq_string = '';
3615 0 local $nest = 1;
3616 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3617 0 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 5 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 0 0
elsif (/\G (\\\)) /cgox) { } 0 0 0
elsif (/\G (\() /cgox) { } 0 0 0
elsif (/\G (\)) /cgox) { } 0 0 0
elsif (/\G ($Elatin3::qq_char) /cgox) { } 0 0 0
3618 0 elsif (/\G (\\\)) /oxgc) { $qq_string .= $1; }
3619 0 elsif (/\G (\() /oxgc) { $qq_string .= $1; $nest++; }
3620 elsif (/\G (\)) /oxgc) {
3621 0 ▶ if (--$nest == 0) { return $e . e_qq($ope,'(',')',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin3::nest == 0) { } 0 0 0
3622 0 else { $qq_string .= $1; }
3623 }
3624 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3625 }
3626 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3627 }
3628  
3629 # elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq { }
3630 elsif (/\G (\{) /oxgc) { # qq { }
3631 2222 my $qq_string = '';
3632 2222 local $nest = 1;
3633 2222 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 85104 0 85104
3634 85104 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 5 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 722 84382 85104
elsif (/\G (\\\}) /cgox) { } 0 84382 84382
elsif (/\G (\{) /cgox) { } 1189 83193 84382
elsif (/\G (\}) /cgox) { } 3411 79782 83193
elsif (/\G ($Elatin3::qq_char) /cgox) { } 79782 0 79782
3635 0 elsif (/\G (\\\}) /oxgc) { $qq_string .= $1; }
3636 1189 elsif (/\G (\{) /oxgc) { $qq_string .= $1; $nest++; }
3637 elsif (/\G (\}) /oxgc) {
3638 3411 ▶ if (--$nest == 0) { return $e . e_qq($ope,'{','}',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin3::nest == 0) { } 2222 1189 3411
3639 1189 else { $qq_string .= $1; }
3640 }
3641 79782 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3642 }
3643 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3644 }
3645  
3646 # elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq [ ]
3647 elsif (/\G (\[) /oxgc) { # qq [ ]
3648 0 my $qq_string = '';
3649 0 local $nest = 1;
3650 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3651 0 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 5 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 0 0
elsif (/\G (\\\]) /cgox) { } 0 0 0
elsif (/\G (\[) /cgox) { } 0 0 0
elsif (/\G (\]) /cgox) { } 0 0 0
elsif (/\G ($Elatin3::qq_char) /cgox) { } 0 0 0
3652 0 elsif (/\G (\\\]) /oxgc) { $qq_string .= $1; }
3653 0 elsif (/\G (\[) /oxgc) { $qq_string .= $1; $nest++; }
3654 elsif (/\G (\]) /oxgc) {
3655 0 ▶ if (--$nest == 0) { return $e . e_qq($ope,'[',']',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin3::nest == 0) { } 0 0 0
3656 0 else { $qq_string .= $1; }
3657 }
3658 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3659 }
3660 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3661 }
3662  
3663 # elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq < >
3664 elsif (/\G (\<) /oxgc) { # qq < >
3665 30 my $qq_string = '';
3666 30 local $nest = 1;
3667 30 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 1166 0 1166
3668 1166 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 5 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 22 1144 1166
elsif (/\G (\\\>) /cgox) { } 0 1144 1144
elsif (/\G (\<) /cgox) { } 0 1144 1144
elsif (/\G (\>) /cgox) { } 30 1114 1144
elsif (/\G ($Elatin3::qq_char) /cgox) { } 1114 0 1114
3669 0 elsif (/\G (\\\>) /oxgc) { $qq_string .= $1; }
3670 0 elsif (/\G (\<) /oxgc) { $qq_string .= $1; $nest++; }
3671 elsif (/\G (\>) /oxgc) {
3672 30 ▶ if (--$nest == 0) { return $e . e_qq($ope,'<','>',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin3::nest == 0) { } 30 0 30
3673 0 else { $qq_string .= $1; }
3674 }
3675 1114 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3676 }
3677 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3678 }
3679  
3680 # elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq * *
3681 elsif (/\G (\S) /oxgc) { # qq * *
3682 0 my $delimiter = $1;
3683 0 my $qq_string = '';
3684 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3685 0 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 0 0
elsif (/\G (\\\Q$delimiter\E) /cgox) { } 0 0 0
elsif (/\G (\Q$delimiter\E) /cgox) { } 0 0 0
elsif (/\G ($Elatin3::qq_char) /cgox) { } 0 0 0
3686 0 elsif (/\G (\\\Q$delimiter\E) /oxgc) { $qq_string .= $1; }
3687 0 elsif (/\G (\Q$delimiter\E) /oxgc) { return $e . e_qq($ope,$delimiter,$delimiter,$qq_string); }
3688 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3689 }
3690 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3691 }
3692 }
3693 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3694 }
3695 }
3696  
3697 # qr//
3698 elsif (/\G \b (qr) \b /oxgc) {
3699 0 my $ope = $1;
3700 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { # qr# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin3::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 0 0
3701 0 return e_qr($ope,$1,$3,$2,$4);
3702 }
3703 else {
3704 0 my $e = '';
3705 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3706 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 8 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\') ((?:$Elatin3::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin3::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin3::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
3707 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr ( )
3708 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr { }
3709 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr [ ]
3710 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr < >
3711 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { return $e . e_qr_q($ope,$1, $3, $2,$4); } # qr ' '
3712 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,'{','}',$2,$4); } # qr | | --> qr { }
3713 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr * *
3714 }
3715 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3716 }
3717 }
3718  
3719 # qw//
3720 elsif (/\G \b (qw) \b /oxgc) {
3721 16 my $ope = $1;
3722 16 ▶ if (/\G (\#) (.*?) (\#) /oxmsgc) { # qw# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) (.*?) (\#) /cgmosx) { } 0 16 16
3723 0 return e_qw($ope,$1,$3,$2);
3724 }
3725 else {
3726 16 my $e = '';
3727 16 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 16 0 16
3728 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 11 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 16 16
elsif (/\G (\() ([^(]*?) (\)) /cgmosx) { } 16 0 16
elsif (/\G (\() ((?:$q_paren)*?) (\)) /cgmosx) { } 0 0 0
elsif (/\G (\{) ([^{]*?) (\}) /cgmosx) { } 0 0 0
elsif (/\G (\{) ((?:$q_brace)*?) (\}) /cgmosx) { } 0 0 0
elsif (/\G (\[) ([^[]*?) (\]) /cgmosx) { } 0 0 0
elsif (/\G (\[) ((?:$q_bracket)*?) (\]) /cgmosx) { } 0 0 0
elsif (/\G (\<) ([^<]*?) (\>) /cgmosx) { } 0 0 0
elsif (/\G (\<) ((?:$q_angle)*?) (\>) /cgmosx) { } 0 0 0
elsif (/\G ([\x21-\x3F]) (.*?) (\1) /cgmosx) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin3::q_char)*?) (\1) /cgmosx) { } 0 0 0
3729  
3730 16 elsif (/\G (\() ([^(]*?) (\)) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw ( )
3731 0 elsif (/\G (\() ((?:$q_paren)*?) (\)) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw ( )
3732  
3733 0 elsif (/\G (\{) ([^{]*?) (\}) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw { }
3734 0 elsif (/\G (\{) ((?:$q_brace)*?) (\}) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw { }
3735  
3736 0 elsif (/\G (\[) ([^[]*?) (\]) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw [ ]
3737 0 elsif (/\G (\[) ((?:$q_bracket)*?) (\]) /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_angle)*?) (\>) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw < >
3741  
3742 0 elsif (/\G ([\x21-\x3F]) (.*?) (\1) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw * *
3743 0 elsif (/\G (\S) ((?:$q_char)*?) (\1) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw * *
3744 }
3745 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3746 }
3747 }
3748  
3749 # qx//
3750 elsif (/\G \b (qx) \b /oxgc) {
3751 0 my $ope = $1;
3752 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qx# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin3::qq_char)*?) (\#) /cgox) { } 0 0 0
3753 0 return e_qq($ope,$1,$3,$2);
3754 }
3755 else {
3756 0 my $e = '';
3757 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3758 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 7 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif (/\G (\() ((?:$qq_paren)*?) (\)) /cgox) { } 0 0 0
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /cgox) { } 0 0 0
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /cgox) { } 0 0 0
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /cgox) { } 0 0 0
elsif (/\G (\') ((?:$Elatin3::qq_char)*?) (\') /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin3::qq_char)*?) (\1) /cgox) { } 0 0 0
3759 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx ( )
3760 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx { }
3761 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx [ ]
3762 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx < >
3763 0 elsif (/\G (\') ((?:$qq_char)*?) (\') /oxgc) { return $e . e_q ($ope,$1,$3,$2); } # qx ' '
3764 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx * *
3765 }
3766 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3767 }
3768 }
3769  
3770 # q//
3771 elsif (/\G \b (q) \b /oxgc) {
3772 473 my $ope = $1;
3773  
3774 # if (/\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { return e_q($ope,$1,$3,$2); } # q# #
3775  
3776 # avoid "Error: Runtime exception" of perl version 5.005_03
3777 # (and so on)
3778  
3779 473 ▶ if (/\G (\#) /oxgc) { # q# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) /cgox) { } 0 473 473
3780 0 my $q_string = '';
3781 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3782 0 ▶ if (/\G (\\\\) /oxgc) { $q_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 0 0
elsif (/\G (\\\#) /cgox) { } 0 0 0
elsif (/\G (\#) /cgox) { } 0 0 0
elsif (/\G ($Elatin3::q_char) /cgox) { } 0 0 0
3783 0 elsif (/\G (\\\#) /oxgc) { $q_string .= $1; }
3784 0 elsif (/\G (\#) /oxgc) { return e_q($ope,'#','#',$q_string); }
3785 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3786 }
3787 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3788 }
3789  
3790 else {
3791 473 my $e = '';
3792 473 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 473 0 473
3793 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
3794  
3795 # elsif (/\G (\() ((?:\\\)|\\\\|$q_paren)*?) (\)) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q ( )
3796 elsif (/\G (\() /oxgc) { # q ( )
3797 0 my $q_string = '';
3798 0 local $nest = 1;
3799 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3800 0 ▶ if (/\G (\\\\) /oxgc) { $q_string .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 0 0
elsif (/\G (\\\)) /cgox) { } 0 0 0
elsif (/\G (\\\() /cgox) { } 0 0 0
elsif (/\G (\() /cgox) { } 0 0 0
elsif (/\G (\)) /cgox) { } 0 0 0
elsif (/\G ($Elatin3::q_char) /cgox) { } 0 0 0
3801 0 elsif (/\G (\\\)) /oxgc) { $q_string .= $1; }
3802 0 elsif (/\G (\\\() /oxgc) { $q_string .= $1; }
3803 0 elsif (/\G (\() /oxgc) { $q_string .= $1; $nest++; }
3804 elsif (/\G (\)) /oxgc) {
3805 0 ▶ if (--$nest == 0) { return $e . e_q($ope,'(',')',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin3::nest == 0) { } 0 0 0
3806 0 else { $q_string .= $1; }
3807 }
3808 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3809 }
3810 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3811 }
3812  
3813 # elsif (/\G (\{) ((?:\\\}|\\\\|$q_brace)*?) (\}) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q { }
3814 elsif (/\G (\{) /oxgc) { # q { }
3815 467 my $q_string = '';
3816 467 local $nest = 1;
3817 467 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 8249 0 8249
3818 0 ▶ if (/\G (\\\\) /oxgc) { $q_string .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 8249 8249
elsif (/\G (\\\}) /cgox) { } 0 8249 8249
elsif (/\G (\\\{) /cgox) { } 0 8249 8249
elsif (/\G (\{) /cgox) { } 159 8090 8249
elsif (/\G (\}) /cgox) { } 626 7464 8090
elsif (/\G ($Elatin3::q_char) /cgox) { } 7464 0 7464
3819 0 elsif (/\G (\\\}) /oxgc) { $q_string .= $1; }
3820 0 elsif (/\G (\\\{) /oxgc) { $q_string .= $1; }
3821 159 elsif (/\G (\{) /oxgc) { $q_string .= $1; $nest++; }
3822 elsif (/\G (\}) /oxgc) {
3823 626 ▶ if (--$nest == 0) { return $e . e_q($ope,'{','}',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin3::nest == 0) { } 467 159 626
3824 159 else { $q_string .= $1; }
3825 }
3826 7464 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3827 }
3828 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3829 }
3830  
3831 # elsif (/\G (\[) ((?:\\\]|\\\\|$q_bracket)*?) (\]) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q [ ]
3832 elsif (/\G (\[) /oxgc) { # q [ ]
3833 0 my $q_string = '';
3834 0 local $nest = 1;
3835 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3836 0 ▶ if (/\G (\\\\) /oxgc) { $q_string .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 0 0
elsif (/\G (\\\]) /cgox) { } 0 0 0
elsif (/\G (\\\[) /cgox) { } 0 0 0
elsif (/\G (\[) /cgox) { } 0 0 0
elsif (/\G (\]) /cgox) { } 0 0 0
elsif (/\G ($Elatin3::q_char) /cgox) { } 0 0 0
3837 0 elsif (/\G (\\\]) /oxgc) { $q_string .= $1; }
3838 0 elsif (/\G (\\\[) /oxgc) { $q_string .= $1; }
3839 0 elsif (/\G (\[) /oxgc) { $q_string .= $1; $nest++; }
3840 elsif (/\G (\]) /oxgc) {
3841 0 ▶ if (--$nest == 0) { return $e . e_q($ope,'[',']',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin3::nest == 0) { } 0 0 0
3842 0 else { $q_string .= $1; }
3843 }
3844 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3845 }
3846 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3847 }
3848  
3849 # elsif (/\G (\<) ((?:\\\>|\\\\|$q_angle)*?) (\>) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q < >
3850 elsif (/\G (\<) /oxgc) { # q < >
3851 5 my $q_string = '';
3852 5 local $nest = 1;
3853 5 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 88 0 88
3854 0 ▶ if (/\G (\\\\) /oxgc) { $q_string .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 88 88
elsif (/\G (\\\>) /cgox) { } 0 88 88
elsif (/\G (\\\<) /cgox) { } 0 88 88
elsif (/\G (\<) /cgox) { } 0 88 88
elsif (/\G (\>) /cgox) { } 5 83 88
elsif (/\G ($Elatin3::q_char) /cgox) { } 83 0 83
3855 0 elsif (/\G (\\\>) /oxgc) { $q_string .= $1; }
3856 0 elsif (/\G (\\\<) /oxgc) { $q_string .= $1; }
3857 0 elsif (/\G (\<) /oxgc) { $q_string .= $1; $nest++; }
3858 elsif (/\G (\>) /oxgc) {
3859 5 ▶ if (--$nest == 0) { return $e . e_q($ope,'<','>',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin3::nest == 0) { } 5 0 5
3860 0 else { $q_string .= $1; }
3861 }
3862 83 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3863 }
3864 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3865 }
3866  
3867 # elsif (/\G (\S) ((?:\\\1|\\\\|$q_char)*?) (\1) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q * *
3868 elsif (/\G (\S) /oxgc) { # q * *
3869 1 my $delimiter = $1;
3870 1 my $q_string = '';
3871 1 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 14 0 14
3872 0 ▶ if (/\G (\\\\) /oxgc) { $q_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 14 14
elsif (/\G (\\\Q$delimiter\E) /cgox) { } 0 14 14
elsif (/\G (\Q$delimiter\E) /cgox) { } 1 13 14
elsif (/\G ($Elatin3::q_char) /cgox) { } 13 0 13
3873 0 elsif (/\G (\\\Q$delimiter\E) /oxgc) { $q_string .= $1; }
3874 1 elsif (/\G (\Q$delimiter\E) /oxgc) { return $e . e_q($ope,$delimiter,$delimiter,$q_string); }
3875 13 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3876 }
3877 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3878 }
3879 }
3880 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3881 }
3882 }
3883  
3884 # m//
3885 elsif (/\G \b (m) \b /oxgc) {
3886 209 my $ope = $1;
3887 209 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { # m# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin3::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
3888 0 return e_qr($ope,$1,$3,$2,$4);
3889 }
3890 else {
3891 209 my $e = '';
3892 209 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 209 0 209
3893 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 9 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 209 209
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
elsif (/\G (\?) ((?:$Elatin3::qq_char)*?) (\?) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
elsif (/\G (\') ((?:$Elatin3::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 10 199 209
elsif (/\G ([*\-:\\^|]) ((?:$Elatin3::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 199 199
elsif (/\G (\S) ((?:$Elatin3::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 199 0 199
3894 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m ( )
3895 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m { }
3896 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m [ ]
3897 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m < >
3898 0 elsif (/\G (\?) ((?:$qq_char)*?) (\?) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m ? ?
3899 10 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr_q($ope,$1, $3, $2,$4); } # m ' '
3900 0 elsif (/\G ([*\-:\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,'{','}',$2,$4); } # m | | --> m { }
3901 199 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m * *
3902 }
3903 0 die __FILE__, ": Search pattern not terminated\n";
3904 }
3905 }
3906  
3907 # s///
3908  
3909 # about [cegimosxpradlunbB]* (/cg modifier)
3910 #
3911 # P.67 Pattern-Matching Operators
3912 # of ISBN 0-596-00241-6 Perl in a Nutshell, Second Edition.
3913  
3914 elsif (/\G \b (s) \b /oxgc) {
3915 101 my $ope = $1;
3916  
3917 # $1 $2 $3 $4 $5 $6
3918 101 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ((?:$qq_char)*?) (\#) ([cegimosxpradlunbB]*) /oxgc) { # s# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin3::qq_char)*?) (\#) ((?:$Elatin3::qq_char)*?) (\#) ([cegimosxpradlunbB]*) /cgox) { } 1 100 101
3919 1 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3920 }
3921 else {
3922 100 my $e = '';
3923 100 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 100 0 100
3924 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 9 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 100 100
elsif (/\G (\() ((?:$qq_paren)*?) (\)) /cgox) { } 0 100 100
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /cgox) { } 0 100 100
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /cgox) { } 0 100 100
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /cgox) { } 0 100 100
elsif (/\G (\') ((?:$Elatin3::qq_char)*?) (\') ((?:$Elatin3::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 21 79 100
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin3::qq_char)*?) (\1) ((?:$Elatin3::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 79 79
elsif (/\G (\$) ((?:$Elatin3::qq_char)*?) (\1) ((?:$Elatin3::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 79 79
elsif (/\G (\S) ((?:$Elatin3::qq_char)*?) (\1) ((?:$Elatin3::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 79 0 79
3925 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) {
3926 0 my @s = ($1,$2,$3);
3927 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3928 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 10 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\') ((?:$Elatin3::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin3::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Elatin3::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Elatin3::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin3::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3929 # $1 $2 $3 $4
3930 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3931 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3932 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3933 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3934 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3935 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3936 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3937 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3938 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3939 }
3940 0 die __FILE__, ": Substitution replacement not terminated\n";
3941 }
3942 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) {
3943 0 my @s = ($1,$2,$3);
3944 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3945 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 10 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\') ((?:$Elatin3::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin3::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Elatin3::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Elatin3::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin3::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3946 # $1 $2 $3 $4
3947 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3948 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3949 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3950 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3951 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3952 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3953 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3954 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3955 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3956 }
3957 0 die __FILE__, ": Substitution replacement not terminated\n";
3958 }
3959 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) {
3960 0 my @s = ($1,$2,$3);
3961 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3962 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 8 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\') ((?:$Elatin3::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin3::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin3::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3963 # $1 $2 $3 $4
3964 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3965 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3966 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3967 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3968 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3969 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3970 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3971 }
3972 0 die __FILE__, ": Substitution replacement not terminated\n";
3973 }
3974 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) {
3975 0 my @s = ($1,$2,$3);
3976 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3977 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 10 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\') ((?:$Elatin3::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin3::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Elatin3::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Elatin3::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin3::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3978 # $1 $2 $3 $4
3979 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3980 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3981 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3982 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3983 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3984 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3985 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3986 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3987 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3988 }
3989 0 die __FILE__, ": Substitution replacement not terminated\n";
3990 }
3991 # $1 $2 $3 $4 $5 $6
3992 elsif (/\G (\') ((?:$qq_char)*?) (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) {
3993 21 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3994 }
3995 # $1 $2 $3 $4 $5 $6
3996 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
3997 0 return e_sub($sub_variable,'{',$2,'}','{',$4,'}',$6); # s | | | --> s { } { }
3998 }
3999 # $1 $2 $3 $4 $5 $6
4000 elsif (/\G (\$) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
4001 0 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
4002 }
4003 # $1 $2 $3 $4 $5 $6
4004 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
4005 79 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
4006 }
4007 }
4008 0 die __FILE__, ": Substitution pattern not terminated\n";
4009 }
4010 }
4011  
4012 # require ignore module
4013 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# require$1$2"; }
4014 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# require$1\n$2"; }
4015 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# require$1"; }
4016  
4017 # use strict; --> use strict; no strict qw(refs);
4018 37 elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "use$1 no strict qw(refs);$2"; }
4019 0 elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [^#]) /oxmsgc) { return "use$1 no strict qw(refs);\n$2"; }
4020 0 elsif (/\G \b use ((?>\s+) strict) \b /oxmsgc) { return "use$1; no strict qw(refs)"; }
4021  
4022 # use 5.12.0; --> use 5.12.0; no strict qw(refs);
4023 elsif (/\G \b use (?>\s+) ((?>([1-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /oxmsgc) {
4024 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
4025 0 return "use $1; no strict qw(refs);";
4026 }
4027 else {
4028 2 return "use $1;";
4029 }
4030 }
4031 elsif (/\G \b use (?>\s+) ((?>v([0-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /oxmsgc) {
4032 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
4033 0 return "use $1; no strict qw(refs);";
4034 }
4035 else {
4036 0 return "use $1;";
4037 }
4038 }
4039  
4040 # ignore use module
4041 2 elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# use$1$2"; }
4042 0 elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# use$1\n$2"; }
4043 0 elsif (/\G \b use ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# use$1"; }
4044  
4045 # ignore no module
4046 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# no$1$2"; }
4047 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# no$1\n$2"; }
4048 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# no$1"; }
4049  
4050 # use else
4051 0 elsif (/\G \b use \b /oxmsgc) { return "use"; }
4052  
4053 # use else
4054 2 elsif (/\G \b no \b /oxmsgc) { return "no"; }
4055  
4056 # ''
4057 elsif (/\G (?<![\w\$\@\%\&\*]) (\') /oxgc) {
4058 1142 my $q_string = '';
4059 1142 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 10175 0 10175
4060 10175 ▶ if (/\G (\\\\) /oxgc) { $q_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 4 10171 10175
elsif (/\G (\\\') /cgox) { } 48 10123 10171
elsif (/\G \' /cgox) { } 1142 8981 10123
elsif (/\G ($Elatin3::q_char) /cgox) { } 8981 0 8981
4061 48 elsif (/\G (\\\') /oxgc) { $q_string .= $1; }
4062 1142 elsif (/\G \' /oxgc) { return e_q('', "'","'",$q_string); }
4063 8981 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
4064 }
4065 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4066 }
4067  
4068 # ""
4069 elsif (/\G (\") /oxgc) {
4070 1883 my $qq_string = '';
4071 1883 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 37088 0 37088
4072 37088 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 67 37021 37088
elsif (/\G (\\\") /cgox) { } 12 37009 37021
elsif (/\G \" /cgox) { } 1883 35126 37009
elsif (/\G ($Elatin3::q_char) /cgox) { } 35126 0 35126
4073 12 elsif (/\G (\\\") /oxgc) { $qq_string .= $1; }
4074 1883 elsif (/\G \" /oxgc) { return e_qq('', '"','"',$qq_string); }
4075 35126 elsif (/\G ($q_char) /oxgc) { $qq_string .= $1; }
4076 }
4077 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4078 }
4079  
4080 # ``
4081 elsif (/\G (\`) /oxgc) {
4082 1 my $qx_string = '';
4083 1 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 19 0 19
4084 0 ▶ if (/\G (\\\\) /oxgc) { $qx_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 19 19
elsif (/\G (\\\`) /cgox) { } 0 19 19
elsif (/\G \` /cgox) { } 1 18 19
elsif (/\G ($Elatin3::q_char) /cgox) { } 18 0 18
4085 0 elsif (/\G (\\\`) /oxgc) { $qx_string .= $1; }
4086 1 elsif (/\G \` /oxgc) { return e_qq('', '`','`',$qx_string); }
4087 18 elsif (/\G ($q_char) /oxgc) { $qx_string .= $1; }
4088 }
4089 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4090 }
4091  
4092 # // --- not divide operator (num / num), not defined-or
4093 ▶ elsif (($slash eq 'm//') and /\G (\/) /oxgc) {
Condition100%3/3
$Elatin3::slash eq "m//" and m[\G (/) ]cgox
!ll&&!rl&&r
273318836681
MC/DC100%2/2
$Elatin3::slash eq "m//" and m[\G (/) ]cgox
$Elatin3::slash eq "m//" m[\G (/) ]cgox
Truth table100%3/3
A and B
A= $Elatin3::slash eq "m//"B= m[\G (/) ]cgox
ABresult
0X0
100
111
4094 681 my $regexp = '';
4095 681 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 5636 0 5636
4096 0 ▶ if (/\G (\\\\) /oxgc) { $regexp .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 5636 5636
elsif (m[\G (\\/) ]cgox) { } 0 5636 5636
elsif (m[\G / ([cgimosxpadlunbB]*) ]cgox) { } 681 4955 5636
elsif (/\G ($Elatin3::q_char) /cgox) { } 4955 0 4955
4097 0 elsif (/\G (\\\/) /oxgc) { $regexp .= $1; }
4098 681 elsif (/\G \/ ([cgimosxpadlunbB]*) /oxgc) { return e_qr('', '/','/',$regexp,$1); }
4099 4955 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
4100 }
4101 0 die __FILE__, ": Search pattern not terminated\n";
4102 }
4103  
4104 # ?? --- not conditional operator (condition ? then : else)
4105 ▶ elsif (($slash eq 'm//') and /\G (\?) /oxgc) {
Condition66%2/3
$Elatin3::slash eq "m//" and /\G (\?) /cgox
!ll&&!rl&&r
2733188360
MC/DC0%0/2
$Elatin3::slash eq "m//" and /\G (\?) /cgox
$Elatin3::slash eq "m//" /\G (\?) /cgox
Truth table66%2/3
A and B
A= $Elatin3::slash eq "m//"B= /\G (\?) /cgox
ABresult
0X0
100
111
4106 0 my $regexp = '';
4107 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
4108 0 ▶ if (/\G (\\\\) /oxgc) { $regexp .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 0 0
elsif (/\G (\\\?) /cgox) { } 0 0 0
elsif (/\G \? ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G ($Elatin3::q_char) /cgox) { } 0 0 0
4109 0 elsif (/\G (\\\?) /oxgc) { $regexp .= $1; }
4110 0 elsif (/\G \? ([cgimosxpadlunbB]*) /oxgc) { return e_qr('m','?','?',$regexp,$1); }
4111 0 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
4112 }
4113 0 die __FILE__, ": Search pattern not terminated\n";
4114 }
4115  
4116 # <<>> (a safer ARGV)
4117 0 elsif (/\G ( <<>> ) /oxgc) { $slash = 'm//'; return $1; }
4118  
4119 # << (bit shift) --- not here document
4120 0 elsif (/\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /oxgc) { $slash = 'm//'; return $1; }
4121  
4122 # <<~'HEREDOC'
4123 elsif (/\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /oxgc) {
4124 6 $slash = 'm//';
4125 6 my $here_quote = $1;
4126 6 my $delimiter = $2;
4127  
4128 # get here document
4129 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4130 6 $here_script = CORE::substr $_, pos $_;
4131 6 $here_script =~ s/.*?\n//oxm;
4132 }
4133 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
4134 6 my $heredoc = $1;
4135 6 my $indent = $2;
4136 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4137 6 push @heredoc, $heredoc . qq{\n$delimiter\n};
4138 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4139 }
4140 else {
4141 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4142 }
4143 6 return qq{<<'$delimiter'};
4144 }
4145  
4146 # <<~\HEREDOC
4147  
4148 # P.66 2.6.6. "Here" Documents
4149 # in Chapter 2: Bits and Pieces
4150 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4151  
4152 # P.73 "Here" Documents
4153 # in Chapter 2: Bits and Pieces
4154 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4155  
4156 elsif (/\G ( <<~ \\([a-zA-Z_0-9]+) ) /oxgc) {
4157 3 $slash = 'm//';
4158 3 my $here_quote = $1;
4159 3 my $delimiter = $2;
4160  
4161 # get here document
4162 3 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 3 0 3
4163 3 $here_script = CORE::substr $_, pos $_;
4164 3 $here_script =~ s/.*?\n//oxm;
4165 }
4166 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
4167 3 my $heredoc = $1;
4168 3 my $indent = $2;
4169 3 $heredoc =~ s{^$indent}{}msg; # no /ox
4170 3 push @heredoc, $heredoc . qq{\n$delimiter\n};
4171 3 push @heredoc_delimiter, qq{\\s*$delimiter};
4172 }
4173 else {
4174 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4175 }
4176 3 return qq{<<\\$delimiter};
4177 }
4178  
4179 # <<~"HEREDOC"
4180 elsif (/\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /oxgc) {
4181 6 $slash = 'm//';
4182 6 my $here_quote = $1;
4183 6 my $delimiter = $2;
4184  
4185 # get here document
4186 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4187 6 $here_script = CORE::substr $_, pos $_;
4188 6 $here_script =~ s/.*?\n//oxm;
4189 }
4190 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
4191 6 my $heredoc = $1;
4192 6 my $indent = $2;
4193 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4194 6 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4195 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4196 }
4197 else {
4198 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4199 }
4200 6 return qq{<<"$delimiter"};
4201 }
4202  
4203 # <<~HEREDOC
4204 elsif (/\G ( <<~ ([a-zA-Z_0-9]+) ) /oxgc) {
4205 3 $slash = 'm//';
4206 3 my $here_quote = $1;
4207 3 my $delimiter = $2;
4208  
4209 # get here document
4210 3 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 3 0 3
4211 3 $here_script = CORE::substr $_, pos $_;
4212 3 $here_script =~ s/.*?\n//oxm;
4213 }
4214 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
4215 3 my $heredoc = $1;
4216 3 my $indent = $2;
4217 3 $heredoc =~ s{^$indent}{}msg; # no /ox
4218 3 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4219 3 push @heredoc_delimiter, qq{\\s*$delimiter};
4220 }
4221 else {
4222 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4223 }
4224 3 return qq{<<$delimiter};
4225 }
4226  
4227 # <<~`HEREDOC`
4228 elsif (/\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /oxgc) {
4229 6 $slash = 'm//';
4230 6 my $here_quote = $1;
4231 6 my $delimiter = $2;
4232  
4233 # get here document
4234 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4235 6 $here_script = CORE::substr $_, pos $_;
4236 6 $here_script =~ s/.*?\n//oxm;
4237 }
4238 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
4239 6 my $heredoc = $1;
4240 6 my $indent = $2;
4241 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4242 6 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4243 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4244 }
4245 else {
4246 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4247 }
4248 6 return qq{<<`$delimiter`};
4249 }
4250  
4251 # <<'HEREDOC'
4252 elsif (/\G ( << '([a-zA-Z_0-9]*)' ) /oxgc) {
4253 72 $slash = 'm//';
4254 72 my $here_quote = $1;
4255 72 my $delimiter = $2;
4256  
4257 # get here document
4258 72 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 72 0 72
4259 72 $here_script = CORE::substr $_, pos $_;
4260 72 $here_script =~ s/.*?\n//oxm;
4261 }
4262 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
4263 72 push @heredoc, $1 . qq{\n$delimiter\n};
4264 72 push @heredoc_delimiter, $delimiter;
4265 }
4266 else {
4267 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4268 }
4269 72 return $here_quote;
4270 }
4271  
4272 # <<\HEREDOC
4273  
4274 # P.66 2.6.6. "Here" Documents
4275 # in Chapter 2: Bits and Pieces
4276 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4277  
4278 # P.73 "Here" Documents
4279 # in Chapter 2: Bits and Pieces
4280 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4281  
4282 elsif (/\G ( << \\([a-zA-Z_0-9]+) ) /oxgc) {
4283 0 $slash = 'm//';
4284 0 my $here_quote = $1;
4285 0 my $delimiter = $2;
4286  
4287 # get here document
4288 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4289 0 $here_script = CORE::substr $_, pos $_;
4290 0 $here_script =~ s/.*?\n//oxm;
4291 }
4292 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
4293 0 push @heredoc, $1 . qq{\n$delimiter\n};
4294 0 push @heredoc_delimiter, $delimiter;
4295 }
4296 else {
4297 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4298 }
4299 0 return $here_quote;
4300 }
4301  
4302 # <<"HEREDOC"
4303 elsif (/\G ( << "([a-zA-Z_0-9]*)" ) /oxgc) {
4304 36 $slash = 'm//';
4305 36 my $here_quote = $1;
4306 36 my $delimiter = $2;
4307  
4308 # get here document
4309 36 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 36 0 36
4310 36 $here_script = CORE::substr $_, pos $_;
4311 36 $here_script =~ s/.*?\n//oxm;
4312 }
4313 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
4314 36 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4315 36 push @heredoc_delimiter, $delimiter;
4316 }
4317 else {
4318 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4319 }
4320 36 return $here_quote;
4321 }
4322  
4323 # <<HEREDOC
4324 elsif (/\G ( << ([a-zA-Z_0-9]+) ) /oxgc) {
4325 42 $slash = 'm//';
4326 42 my $here_quote = $1;
4327 42 my $delimiter = $2;
4328  
4329 # get here document
4330 42 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 42 0 42
4331 42 $here_script = CORE::substr $_, pos $_;
4332 42 $here_script =~ s/.*?\n//oxm;
4333 }
4334 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
4335 42 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4336 42 push @heredoc_delimiter, $delimiter;
4337 }
4338 else {
4339 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4340 }
4341 42 return $here_quote;
4342 }
4343  
4344 # <<`HEREDOC`
4345 elsif (/\G ( << `([a-zA-Z_0-9]*)` ) /oxgc) {
4346 0 $slash = 'm//';
4347 0 my $here_quote = $1;
4348 0 my $delimiter = $2;
4349  
4350 # get here document
4351 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4352 0 $here_script = CORE::substr $_, pos $_;
4353 0 $here_script =~ s/.*?\n//oxm;
4354 }
4355 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
4356 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4357 0 push @heredoc_delimiter, $delimiter;
4358 }
4359 else {
4360 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4361 }
4362 0 return $here_quote;
4363 }
4364  
4365 # <<= <=> <= < operator
4366 elsif (/\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/oxgc) {
4367 12 return $1;
4368 }
4369  
4370 # <FILEHANDLE>
4371 elsif (/\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /oxgc) {
4372 0 return $1;
4373 }
4374  
4375 # <WILDCARD> --- glob
4376  
4377 # avoid "Error: Runtime exception" of perl version 5.005_03
4378  
4379 elsif (/\G < ((?:[^>\0\a\e\f\n\r\t])+?) > /oxgc) {
4380 0 return 'Elatin3::glob("' . $1 . '")';
4381 }
4382  
4383 # __DATA__
4384 0 elsif (/\G ^ ( __DATA__ \n .*) \z /oxmsgc) { return $1; }
4385  
4386 # __END__
4387 210 elsif (/\G ^ ( __END__ \n .*) \z /oxmsgc) { return $1; }
4388  
4389 # \cD Control-D
4390  
4391 # P.68 2.6.8. Other Literal Tokens
4392 # in Chapter 2: Bits and Pieces
4393 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4394  
4395 # P.76 Other Literal Tokens
4396 # in Chapter 2: Bits and Pieces
4397 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4398  
4399 0 elsif (/\G ( \cD .*) \z /oxmsgc) { return $1; }
4400  
4401 # \cZ Control-Z
4402 0 elsif (/\G ( \cZ .*) \z /oxmsgc) { return $1; }
4403  
4404 # any operator before div
4405 elsif (/\G (
4406 -- | \+\+ |
4407 [\)\}\]]
4408  
4409 5837 ) /oxgc) { $slash = 'div'; return $1; }
4410  
4411 # yada-yada or triple-dot operator
4412 elsif (/\G (
4413 \.\.\.
4414  
4415 7 ) /oxgc) { $slash = 'm//'; return q{die('Unimplemented')}; }
4416  
4417 # any operator before m//
4418  
4419 # //, //= (defined-or)
4420  
4421 # P.164 Logical Operators
4422 # in Chapter 10: More Control Structures
4423 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
4424  
4425 # P.119 C-Style Logical (Short-Circuit) Operators
4426 # in Chapter 3: Unary and Binary Operators
4427 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4428  
4429 # (and so on)
4430  
4431 # ~~
4432  
4433 # P.221 The Smart Match Operator
4434 # in Chapter 15: Smart Matching and given-when
4435 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
4436  
4437 # P.112 Smartmatch Operator
4438 # in Chapter 3: Unary and Binary Operators
4439 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4440  
4441 # (and so on)
4442  
4443 elsif (/\G ((?>
4444  
4445 !~~ | !~ | != | ! |
4446 %= | % |
4447 &&= | && | &= | &\.= | &\. | & |
4448 -= | -> | - |
4449 :(?>\s*)= |
4450 : |
4451 <<>> |
4452 <<= | <=> | <= | < |
4453 == | => | =~ | = |
4454 >>= | >> | >= | > |
4455 \*\*= | \*\* | \*= | \* |
4456 \+= | \+ |
4457 \.\. | \.= | \. |
4458 \/\/= | \/\/ |
4459 \/= | \/ |
4460 \? |
4461 \\ |
4462 \^= | \^\.= | \^\. | \^ |
4463 \b x= |
4464 \|\|= | \|\| | \|= | \|\.= | \|\. | \| |
4465 ~~ | ~\. | ~ |
4466 \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b |
4467 \b(?: print )\b |
4468  
4469 [,;\(\{\[]
4470  
4471 9771 )) /oxgc) { $slash = 'm//'; return $1; }
4472  
4473 # other any character
4474 20156 elsif (/\G ($q_char) /oxgc) { $slash = 'div'; return $1; }
4475  
4476 # system error
4477 else {
4478 0 die __FILE__, ": Oops, this shouldn't happen!\n";
4479 }
4480 }
4481  
4482 # escape Latin-3 string
4483 1871 ▶sub e_string {
Subroutine e_string: called CC=228 SCAR=104.2
Pod documented
4484 1871 my($string) = @_;
4485 1871 my $e_string = '';
4486  
4487 1871 local $slash = 'm//';
4488  
4489 # P.1024 Appendix W.10 Multibyte Processing
4490 # of ISBN 1-56592-224-7 CJKV Information Processing
4491 # (and so on)
4492  
4493 1871 my @char = $string =~ / \G (?>[^\\]|\\$q_char|$q_char) /oxmsg;
4494  
4495 # without { ... }
4496 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
4497 1854 ▶ if ($string !~ /<</oxms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /<</mosx) 1854 0 1854
4498 1854 return $string;
4499 }
4500 }
4501  
4502 E_STRING_LOOP:
4503 17 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 190 17 207
4504 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 Latin3::eval (?= (?>\s*) \{ ) /cgox) { } 0 180 180
elsif ($string =~ /\G \b Char::eval \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b Latin3::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 Latin3::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 Latin3::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*) (\") ((?:$Elatin3::qq_char)+?) (\") /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\#) ((?:$Elatin3::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) ((?:$Elatin3::qq_char)+?) (\1) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s*) (\') ((?:\\\'|\\\\|$Elatin3::q_char)+?) (\') /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$Elatin3::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|\\\\|$Elatin3::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\$\@\%\&\*]) (\') ((?:\\\'|\\\\|$Elatin3::q_char)*?) (\') /cgox) { } 0 180 180
elsif ($string =~ /\G (\") ((?:$Elatin3::qq_char)*?) (\") /cgox) { } 0 180 180
elsif ($string =~ /\G (\`) ((?:$Elatin3::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 < ((?:$Elatin3::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 ($Elatin3::q_char) /cgox) { } 131 0 131
4505 }
4506  
4507 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> @{[Elatin3::PREMATCH()]}
4508 elsif ($string =~ /\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /oxmsgc) {
4509 0 $e_string .= q{Elatin3::PREMATCH()};
4510 0 $slash = 'div';
4511 }
4512  
4513 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> @{[Elatin3::MATCH()]}
4514 elsif ($string =~ /\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /oxmsgc) {
4515 0 $e_string .= q{Elatin3::MATCH()};
4516 0 $slash = 'div';
4517 }
4518  
4519 # $', ${'} --> $', ${'}
4520 elsif ($string =~ /\G ( \$' | \$\{'\} ) /oxmsgc) {
4521 0 $e_string .= $1;
4522 0 $slash = 'div';
4523 }
4524  
4525 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> @{[Elatin3::POSTMATCH()]}
4526 elsif ($string =~ /\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /oxmsgc) {
4527 0 $e_string .= q{Elatin3::POSTMATCH()};
4528 0 $slash = 'div';
4529 }
4530  
4531 # bareword
4532 elsif ($string =~ /\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /oxmsgc) {
4533 0 $e_string .= $1;
4534 0 $slash = 'div';
4535 }
4536  
4537 # $0 --> $0
4538 elsif ($string =~ /\G ( \$ 0 ) /oxmsgc) {
4539 0 $e_string .= $1;
4540 0 $slash = 'div';
4541 }
4542 elsif ($string =~ /\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /oxmsgc) {
4543 0 $e_string .= $1;
4544 0 $slash = 'div';
4545 }
4546  
4547 # $$ --> $$
4548 elsif ($string =~ /\G ( \$ \$ ) (?![\w\{]) /oxmsgc) {
4549 0 $e_string .= $1;
4550 0 $slash = 'div';
4551 }
4552  
4553 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
4554 # $1, $2, $3 --> $1, $2, $3 otherwise
4555 elsif ($string =~ /\G \$ ((?>[1-9][0-9]*)) /oxmsgc) {
4556 0 $e_string .= e_capture($1);
4557 0 $slash = 'div';
4558 }
4559 elsif ($string =~ /\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /oxmsgc) {
4560 0 $e_string .= e_capture($1);
4561 0 $slash = 'div';
4562 }
4563  
4564 # $$foo[ ... ] --> $ $foo->[ ... ]
4565 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /oxmsgc) {
4566 0 $e_string .= e_capture($1.'->'.$2);
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
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);
4579 0 $slash = 'div';
4580 }
4581  
4582 # ${ foo }
4583 elsif ($string =~ /\G \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} /oxmsgc) {
4584 0 $e_string .= '${' . $1 . '}';
4585 0 $slash = 'div';
4586 }
4587  
4588 # ${ ... }
4589 elsif ($string =~ /\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /oxmsgc) {
4590 3 $e_string .= e_capture($1);
4591 3 $slash = 'div';
4592 }
4593  
4594 # variable or function
4595 # $ @ % & * $ #
4596 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) {
4597 7 $e_string .= $1;
4598 7 $slash = 'div';
4599 }
4600 # $ $ $ $ $ $ $ $ $ $ $ $ $ $
4601 # $ @ # \ ' " / ? ( ) [ ] < >
4602 elsif ($string =~ /\G ( \$[\$\@\#\\\'\"\/\?\(\)\[\]\<\>] ) /oxmsgc) {
4603 0 $e_string .= $1;
4604 0 $slash = 'div';
4605 }
4606  
4607 # subroutines of package Elatin3
4608 0 elsif ($string =~ /\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /oxgc) { $e_string .= $1; $slash = 'm//'; }
4609 0 elsif ($string =~ /\G \b Char::eval (?= (?>\s*) \{ ) /oxgc) { $e_string .= 'eval'; $slash = 'm//'; }
4610 0 elsif ($string =~ /\G \b Latin3::eval (?= (?>\s*) \{ ) /oxgc) { $e_string .= 'eval'; $slash = 'm//'; }
4611 0 elsif ($string =~ /\G \b Char::eval \b /oxgc) { $e_string .= 'eval Char::escape'; $slash = 'm//'; }
4612 0 elsif ($string =~ /\G \b Latin3::eval \b /oxgc) { $e_string .= 'eval Latin3::escape'; $slash = 'm//'; }
4613 0 elsif ($string =~ /\G \b bytes::substr \b /oxgc) { $e_string .= 'substr'; $slash = 'm//'; }
4614 0 elsif ($string =~ /\G \b chop \b /oxgc) { $e_string .= 'Elatin3::chop'; $slash = 'm//'; }
4615 0 elsif ($string =~ /\G \b bytes::index \b /oxgc) { $e_string .= 'index'; $slash = 'm//'; }
4616 0 elsif ($string =~ /\G \b Char::index \b /oxgc) { $e_string .= 'Char::index'; $slash = 'm//'; }
4617 0 elsif ($string =~ /\G \b Latin3::index \b /oxgc) { $e_string .= 'Latin3::index'; $slash = 'm//'; }
4618 0 elsif ($string =~ /\G \b index \b /oxgc) { $e_string .= 'Elatin3::index'; $slash = 'm//'; }
4619 0 elsif ($string =~ /\G \b bytes::rindex \b /oxgc) { $e_string .= 'rindex'; $slash = 'm//'; }
4620 0 elsif ($string =~ /\G \b Char::rindex \b /oxgc) { $e_string .= 'Char::rindex'; $slash = 'm//'; }
4621 0 elsif ($string =~ /\G \b Latin3::rindex \b /oxgc) { $e_string .= 'Latin3::rindex'; $slash = 'm//'; }
4622 0 elsif ($string =~ /\G \b rindex \b /oxgc) { $e_string .= 'Elatin3::rindex'; $slash = 'm//'; }
4623 0 elsif ($string =~ /\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin3::lc'; $slash = 'm//'; }
4624 0 elsif ($string =~ /\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin3::lcfirst'; $slash = 'm//'; }
4625 0 elsif ($string =~ /\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin3::uc'; $slash = 'm//'; }
4626 0 elsif ($string =~ /\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin3::ucfirst'; $slash = 'm//'; }
4627 0 elsif ($string =~ /\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin3::fc'; $slash = 'm//'; }
4628  
4629 # "-s '' ..." means file test "-s 'filename' ..." (not means "- s/// ...")
4630 0 elsif ($string =~ /\G -s (?>\s*) (\") ((?:$qq_char)+?) (\") /oxgc) { $e_string .= '-s ' . e_qq('', $1,$3,$2); $slash = 'm//'; }
4631 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\#) ((?:$qq_char)+?) (\#) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4632 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4633 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4634 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4635 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4636 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\S) ((?:$qq_char)+?) (\1) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4637  
4638 0 elsif ($string =~ /\G -s (?>\s*) (\') ((?:\\\'|\\\\|$q_char)+?) (\') /oxgc) { $e_string .= '-s ' . e_q ('', $1,$3,$2); $slash = 'm//'; }
4639 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$q_char)+?) (\#) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4640 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4641 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4642 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4643 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4644 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//'; }
4645  
4646 elsif ($string =~ /\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)*) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ))*) /oxgc)
4647 0 { $e_string .= "-s $1"; $slash = 'm//'; }
4648 0 elsif ($string =~ /\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /oxgc) { $e_string .= "-s ($1)"; $slash = 'm//'; }
4649 0 elsif ($string =~ /\G -s (?= (?>\s+) [a-z]+) /oxgc) { $e_string .= '-s'; $slash = 'm//'; }
4650 0 elsif ($string =~ /\G -s (?>\s+) ((?>\w+)) /oxgc) { $e_string .= "-s $1"; $slash = 'm//'; }
4651  
4652 0 elsif ($string =~ /\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'length'; $slash = 'm//'; }
4653 0 elsif ($string =~ /\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'chr'; $slash = 'm//'; }
4654 0 elsif ($string =~ /\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin3::chr'; $slash = 'm//'; }
4655 0 elsif ($string =~ /\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'ord'; $slash = 'div'; }
4656 0 elsif ($string =~ /\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= $function_ord; $slash = 'div'; }
4657 0 elsif ($string =~ /\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin3::glob'; $slash = 'm//'; }
4658 0 elsif ($string =~ /\G \b lc \b /oxgc) { $e_string .= 'Elatin3::lc_'; $slash = 'm//'; }
4659 0 elsif ($string =~ /\G \b lcfirst \b /oxgc) { $e_string .= 'Elatin3::lcfirst_'; $slash = 'm//'; }
4660 0 elsif ($string =~ /\G \b uc \b /oxgc) { $e_string .= 'Elatin3::uc_'; $slash = 'm//'; }
4661 0 elsif ($string =~ /\G \b ucfirst \b /oxgc) { $e_string .= 'Elatin3::ucfirst_'; $slash = 'm//'; }
4662 0 elsif ($string =~ /\G \b fc \b /oxgc) { $e_string .= 'Elatin3::fc_'; $slash = 'm//'; }
4663 0 elsif ($string =~ /\G -s \b /oxgc) { $e_string .= '-s '; $slash = 'm//'; }
4664  
4665 0 elsif ($string =~ /\G \b bytes::length \b /oxgc) { $e_string .= 'length'; $slash = 'm//'; }
4666 0 elsif ($string =~ /\G \b bytes::chr \b /oxgc) { $e_string .= 'chr'; $slash = 'm//'; }
4667 0 elsif ($string =~ /\G \b chr \b /oxgc) { $e_string .= 'Elatin3::chr_'; $slash = 'm//'; }
4668 0 elsif ($string =~ /\G \b bytes::ord \b /oxgc) { $e_string .= 'ord'; $slash = 'div'; }
4669 0 elsif ($string =~ /\G \b ord \b /oxgc) { $e_string .= $function_ord_; $slash = 'div'; }
4670 0 elsif ($string =~ /\G \b glob \b /oxgc) { $e_string .= 'Elatin3::glob_'; $slash = 'm//'; }
4671 0 elsif ($string =~ /\G \b reverse \b /oxgc) { $e_string .= $function_reverse; $slash = 'm//'; }
4672 0 elsif ($string =~ /\G \b getc \b /oxgc) { $e_string .= $function_getc; $slash = 'm//'; }
4673 # split
4674 elsif ($string =~ /\G \b (split) \b (?! (?>\s*) => ) /oxgc) {
4675 0 $slash = 'm//';
4676  
4677 0 my $e = '';
4678 0 ▶ while ($string =~ /\G ( (?>\s+) | \( | \#.* ) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G ( (?>\s+) | \( | \#.* ) /cgox) 0 0 0
4679 0 $e .= $1;
4680 }
4681  
4682 # end of split
4683 0 ▶ if ($string =~ /\G (?= [,;\)\}\]] ) /oxgc) { return 'Elatin3::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
4684  
4685 # split scalar value
4686 0 elsif ($string =~ /\G ( [\$\@\&\*] $qq_scalar ) /oxgc) { $e_string .= 'Elatin3::split' . $e . e_string($1); next E_STRING_LOOP; }
4687  
4688 # split literal space
4689 0 elsif ($string =~ /\G \b qq (\#) [ ] (\#) /oxgc) { $e_string .= 'Elatin3::split' . $e . qq {qq$1 $2}; next E_STRING_LOOP; }
4690 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\() [ ] (\)) /oxgc) { $e_string .= 'Elatin3::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4691 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\{) [ ] (\}) /oxgc) { $e_string .= 'Elatin3::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4692 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\[) [ ] (\]) /oxgc) { $e_string .= 'Elatin3::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4693 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\<) [ ] (\>) /oxgc) { $e_string .= 'Elatin3::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4694 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\S) [ ] (\2) /oxgc) { $e_string .= 'Elatin3::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4695 0 elsif ($string =~ /\G \b q (\#) [ ] (\#) /oxgc) { $e_string .= 'Elatin3::split' . $e . qq {q$1 $2}; next E_STRING_LOOP; }
4696 0 elsif ($string =~ /\G \b q ((?>\s*)) (\() [ ] (\)) /oxgc) { $e_string .= 'Elatin3::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4697 0 elsif ($string =~ /\G \b q ((?>\s*)) (\{) [ ] (\}) /oxgc) { $e_string .= 'Elatin3::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4698 0 elsif ($string =~ /\G \b q ((?>\s*)) (\[) [ ] (\]) /oxgc) { $e_string .= 'Elatin3::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4699 0 elsif ($string =~ /\G \b q ((?>\s*)) (\<) [ ] (\>) /oxgc) { $e_string .= 'Elatin3::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4700 0 elsif ($string =~ /\G \b q ((?>\s*)) (\S) [ ] (\2) /oxgc) { $e_string .= 'Elatin3::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4701 0 elsif ($string =~ /\G ' [ ] ' /oxgc) { $e_string .= 'Elatin3::split' . $e . qq {' '}; next E_STRING_LOOP; }
4702 0 elsif ($string =~ /\G " [ ] " /oxgc) { $e_string .= 'Elatin3::split' . $e . qq {" "}; next E_STRING_LOOP; }
4703  
4704 # split qq//
4705 elsif ($string =~ /\G \b (qq) \b /oxgc) {
4706 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 (\#) ((?:$Elatin3::qq_char)*?) (\#) /cgox) { } 0 0 0
4707 else {
4708 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4709 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 ([*\-:?\\^|]) ((?:$Elatin3::qq_char)*?) (\1) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Elatin3::qq_char)*?) (\1) /cgox) { } 0 0 0
4710 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq ( ) --> qr ( )
4711 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq { } --> qr { }
4712 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq [ ] --> qr [ ]
4713 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq < > --> qr < >
4714 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= e_split($e.'qr','{','}',$2,''); next E_STRING_LOOP; } # qq | | --> qr { }
4715 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq * * --> qr * *
4716 }
4717 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4718 }
4719 }
4720  
4721 # split qr//
4722 elsif ($string =~ /\G \b (qr) \b /oxgc) {
4723 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 (\#) ((?:$Elatin3::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 0 0
4724 else {
4725 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4726 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 (\') ((?:$Elatin3::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$Elatin3::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Elatin3::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
4727 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr ( )
4728 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr { }
4729 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr [ ]
4730 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr < >
4731 0 elsif ($string =~ /\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split_q($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr ' '
4732 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr','{','}',$2,$4); next E_STRING_LOOP; } # qr | | --> qr { }
4733 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 * *
4734 }
4735 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4736 }
4737 }
4738  
4739 # split q//
4740 elsif ($string =~ /\G \b (q) \b /oxgc) {
4741 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 (\#) ((?:\\\#|\\\\|$Elatin3::q_char)*?) (\#) /cgox) { } 0 0 0
4742 else {
4743 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4744 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 ([*\-:?\\^|]) ((?:$Elatin3::q_char)*?) (\1) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:\\\\|\\\1| $Elatin3::q_char)*?) (\1) /cgox) { } 0 0 0
4745 0 elsif ($string =~ /\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q ( ) --> qr ( )
4746 0 elsif ($string =~ /\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q { } --> qr { }
4747 0 elsif ($string =~ /\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q [ ] --> qr [ ]
4748 0 elsif ($string =~ /\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q < > --> qr < >
4749 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$q_char)*?) (\1) /oxgc) { $e_string .= e_split_q($e.'qr','{','}',$2,''); next E_STRING_LOOP; } # q | | --> qr { }
4750 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 * *
4751 }
4752 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4753 }
4754 }
4755  
4756 # split m//
4757 elsif ($string =~ /\G \b (m) \b /oxgc) {
4758 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 (\#) ((?:$Elatin3::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
4759 else {
4760 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4761 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 (\') ((?:$Elatin3::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$Elatin3::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Elatin3::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
4762 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m ( ) --> qr ( )
4763 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m { } --> qr { }
4764 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m [ ] --> qr [ ]
4765 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m < > --> qr < >
4766 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 ' '
4767 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr','{','}',$2,$4); next E_STRING_LOOP; } # m | | --> qr { }
4768 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 * *
4769 }
4770 0 die __FILE__, ": Search pattern not terminated\n";
4771 }
4772 }
4773  
4774 # split ''
4775 elsif ($string =~ /\G (\') /oxgc) {
4776 0 my $q_string = '';
4777 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4778 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 ($Elatin3::q_char) /cgox) { } 0 0 0
4779 0 elsif ($string =~ /\G (\\\') /oxgc) { $q_string .= $1; } # splitqr'' --> split qr''
4780 0 elsif ($string =~ /\G \' /oxgc) { $e_string .= e_split_q($e.q{ qr},"'","'",$q_string,''); next E_STRING_LOOP; } # ' ' --> qr ' '
4781 0 elsif ($string =~ /\G ($q_char) /oxgc) { $q_string .= $1; }
4782 }
4783 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4784 }
4785  
4786 # split ""
4787 elsif ($string =~ /\G (\") /oxgc) {
4788 0 my $qq_string = '';
4789 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4790 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 ($Elatin3::q_char) /cgox) { } 0 0 0
4791 0 elsif ($string =~ /\G (\\\") /oxgc) { $qq_string .= $1; } # splitqr"" --> split qr""
4792 0 elsif ($string =~ /\G \" /oxgc) { $e_string .= e_split($e.q{ qr},'"','"',$qq_string,''); next E_STRING_LOOP; } # " " --> qr " "
4793 0 elsif ($string =~ /\G ($q_char) /oxgc) { $qq_string .= $1; }
4794 }
4795 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4796 }
4797  
4798 # split //
4799 elsif ($string =~ /\G (\/) /oxgc) {
4800 0 my $regexp = '';
4801 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4802 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 ($Elatin3::q_char) /cgox) { } 0 0 0
4803 0 elsif ($string =~ /\G (\\\/) /oxgc) { $regexp .= $1; } # splitqr// --> split qr//
4804 0 elsif ($string =~ /\G \/ ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split($e.q{ qr}, '/','/',$regexp,$1); next E_STRING_LOOP; } # / / --> qr / /
4805 0 elsif ($string =~ /\G ($q_char) /oxgc) { $regexp .= $1; }
4806 }
4807 0 die __FILE__, ": Search pattern not terminated\n";
4808 }
4809 }
4810  
4811 # qq//
4812 elsif ($string =~ /\G \b (qq) \b /oxgc) {
4813 0 my $ope = $1;
4814 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qq# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Elatin3::qq_char)*?) (\#) /cgox) { } 0 0 0
4815 0 $e_string .= e_qq($ope,$1,$3,$2);
4816 }
4817 else {
4818 0 my $e = '';
4819 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4820 0 ▶ if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if ($string =~ /\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /cgox) { } 0 0 0
elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /cgox) { } 0 0 0
elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /cgox) { } 0 0 0
elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Elatin3::qq_char)*?) (\1) /cgox) { } 0 0 0
4821 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq ( )
4822 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq { }
4823 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq [ ]
4824 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq < >
4825 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq * *
4826 }
4827 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4828 }
4829 }
4830  
4831 # qx//
4832 elsif ($string =~ /\G \b (qx) \b /oxgc) {
4833 0 my $ope = $1;
4834 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qx# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Elatin3::qq_char)*?) (\#) /cgox) { } 0 0 0
4835 0 $e_string .= e_qq($ope,$1,$3,$2);
4836 }
4837 else {
4838 0 my $e = '';
4839 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4840 0 ▶ if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 7 branches
BranchTrueFalseTotal
if ($string =~ /\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /cgox) { } 0 0 0
elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /cgox) { } 0 0 0
elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /cgox) { } 0 0 0
elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /cgox) { } 0 0 0
elsif ($string =~ /\G (\') ((?:$Elatin3::qq_char)*?) (\') /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Elatin3::qq_char)*?) (\1) /cgox) { } 0 0 0
4841 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx ( )
4842 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx { }
4843 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx [ ]
4844 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx < >
4845 0 elsif ($string =~ /\G (\') ((?:$qq_char)*?) (\') /oxgc) { $e_string .= $e . e_q ($ope,$1,$3,$2); next E_STRING_LOOP; } # qx ' '
4846 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx * *
4847 }
4848 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4849 }
4850 }
4851  
4852 # q//
4853 elsif ($string =~ /\G \b (q) \b /oxgc) {
4854 0 my $ope = $1;
4855 0 ▶ if ($string =~ /\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { # q# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:\\\#|\\\\|$Elatin3::q_char)*?) (\#) /cgox) { } 0 0 0
4856 0 $e_string .= e_q($ope,$1,$3,$2);
4857 }
4858 else {
4859 0 my $e = '';
4860 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4861 0 ▶ if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if ($string =~ /\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /cgox) { } 0 0 0
elsif ($string =~ /\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /cgox) { } 0 0 0
elsif ($string =~ /\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /cgox) { } 0 0 0
elsif ($string =~ /\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:\\\\|\\\1| $Elatin3::q_char)*?) (\1) /cgox) { } 0 0 0
4862 0 elsif ($string =~ /\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q ( )
4863 0 elsif ($string =~ /\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q { }
4864 0 elsif ($string =~ /\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q [ ]
4865 0 elsif ($string =~ /\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q < >
4866 0 elsif ($string =~ /\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q * *
4867 }
4868 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4869 }
4870 }
4871  
4872 # ''
4873 0 elsif ($string =~ /\G (?<![\w\$\@\%\&\*]) (\') ((?:\\\'|\\\\|$q_char)*?) (\') /oxgc) { $e_string .= e_q('',$1,$3,$2); }
4874  
4875 # ""
4876 0 elsif ($string =~ /\G (\") ((?:$qq_char)*?) (\") /oxgc) { $e_string .= e_qq('',$1,$3,$2); }
4877  
4878 # ``
4879 0 elsif ($string =~ /\G (\`) ((?:$qq_char)*?) (\`) /oxgc) { $e_string .= e_qq('',$1,$3,$2); }
4880  
4881 # <<>> (a safer ARGV)
4882 0 elsif ($string =~ /\G ( <<>> ) /oxgc) { $e_string .= $1; }
4883  
4884 # <<= <=> <= < operator
4885 0 elsif ($string =~ /\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/oxgc) { $e_string .= $1; }
4886  
4887 # <FILEHANDLE>
4888 0 elsif ($string =~ /\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /oxgc) { $e_string .= $1; }
4889  
4890 # <WILDCARD> --- glob
4891 elsif ($string =~ /\G < ((?:$q_char)+?) > /oxgc) {
4892 0 $e_string .= 'Elatin3::glob("' . $1 . '")';
4893 }
4894  
4895 # << (bit shift) --- not here document
4896 elsif ($string =~ /\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /oxgc) {
4897 0 $slash = 'm//';
4898 0 $e_string .= $1;
4899 }
4900  
4901 # <<~'HEREDOC'
4902 elsif ($string =~ /\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /oxgc) {
4903 0 $slash = 'm//';
4904 0 my $here_quote = $1;
4905 0 my $delimiter = $2;
4906  
4907 # get here document
4908 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4909 0 $here_script = CORE::substr $_, pos $_;
4910 0 $here_script =~ s/.*?\n//oxm;
4911 }
4912 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
4913 0 my $heredoc = $1;
4914 0 my $indent = $2;
4915 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4916 0 push @heredoc, $heredoc . qq{\n$delimiter\n};
4917 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4918 }
4919 else {
4920 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4921 }
4922 0 $e_string .= qq{<<'$delimiter'};
4923 }
4924  
4925 # <<~\HEREDOC
4926 elsif ($string =~ /\G ( <<~ \\([a-zA-Z_0-9]+) ) /oxgc) {
4927 0 $slash = 'm//';
4928 0 my $here_quote = $1;
4929 0 my $delimiter = $2;
4930  
4931 # get here document
4932 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4933 0 $here_script = CORE::substr $_, pos $_;
4934 0 $here_script =~ s/.*?\n//oxm;
4935 }
4936 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
4937 0 my $heredoc = $1;
4938 0 my $indent = $2;
4939 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4940 0 push @heredoc, $heredoc . qq{\n$delimiter\n};
4941 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4942 }
4943 else {
4944 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4945 }
4946 0 $e_string .= qq{<<\\$delimiter};
4947 }
4948  
4949 # <<~"HEREDOC"
4950 elsif ($string =~ /\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /oxgc) {
4951 0 $slash = 'm//';
4952 0 my $here_quote = $1;
4953 0 my $delimiter = $2;
4954  
4955 # get here document
4956 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4957 0 $here_script = CORE::substr $_, pos $_;
4958 0 $here_script =~ s/.*?\n//oxm;
4959 }
4960 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
4961 0 my $heredoc = $1;
4962 0 my $indent = $2;
4963 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4964 0 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4965 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4966 }
4967 else {
4968 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4969 }
4970 0 $e_string .= qq{<<"$delimiter"};
4971 }
4972  
4973 # <<~HEREDOC
4974 elsif ($string =~ /\G ( <<~ ([a-zA-Z_0-9]+) ) /oxgc) {
4975 0 $slash = 'm//';
4976 0 my $here_quote = $1;
4977 0 my $delimiter = $2;
4978  
4979 # get here document
4980 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4981 0 $here_script = CORE::substr $_, pos $_;
4982 0 $here_script =~ s/.*?\n//oxm;
4983 }
4984 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
4985 0 my $heredoc = $1;
4986 0 my $indent = $2;
4987 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4988 0 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4989 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4990 }
4991 else {
4992 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4993 }
4994 0 $e_string .= qq{<<$delimiter};
4995 }
4996  
4997 # <<~`HEREDOC`
4998 elsif ($string =~ /\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /oxgc) {
4999 0 $slash = 'm//';
5000 0 my $here_quote = $1;
5001 0 my $delimiter = $2;
5002  
5003 # get here document
5004 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5005 0 $here_script = CORE::substr $_, pos $_;
5006 0 $here_script =~ s/.*?\n//oxm;
5007 }
5008 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
5009 0 my $heredoc = $1;
5010 0 my $indent = $2;
5011 0 $heredoc =~ s{^$indent}{}msg; # no /ox
5012 0 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
5013 0 push @heredoc_delimiter, qq{\\s*$delimiter};
5014 }
5015 else {
5016 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5017 }
5018 0 $e_string .= qq{<<`$delimiter`};
5019 }
5020  
5021 # <<'HEREDOC'
5022 elsif ($string =~ /\G ( << '([a-zA-Z_0-9]*)' ) /oxgc) {
5023 0 $slash = 'm//';
5024 0 my $here_quote = $1;
5025 0 my $delimiter = $2;
5026  
5027 # get here document
5028 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5029 0 $here_script = CORE::substr $_, pos $_;
5030 0 $here_script =~ s/.*?\n//oxm;
5031 }
5032 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
5033 0 push @heredoc, $1 . qq{\n$delimiter\n};
5034 0 push @heredoc_delimiter, $delimiter;
5035 }
5036 else {
5037 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5038 }
5039 0 $e_string .= $here_quote;
5040 }
5041  
5042 # <<\HEREDOC
5043 elsif ($string =~ /\G ( << \\([a-zA-Z_0-9]+) ) /oxgc) {
5044 0 $slash = 'm//';
5045 0 my $here_quote = $1;
5046 0 my $delimiter = $2;
5047  
5048 # get here document
5049 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5050 0 $here_script = CORE::substr $_, pos $_;
5051 0 $here_script =~ s/.*?\n//oxm;
5052 }
5053 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
5054 0 push @heredoc, $1 . qq{\n$delimiter\n};
5055 0 push @heredoc_delimiter, $delimiter;
5056 }
5057 else {
5058 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5059 }
5060 0 $e_string .= $here_quote;
5061 }
5062  
5063 # <<"HEREDOC"
5064 elsif ($string =~ /\G ( << "([a-zA-Z_0-9]*)" ) /oxgc) {
5065 0 $slash = 'm//';
5066 0 my $here_quote = $1;
5067 0 my $delimiter = $2;
5068  
5069 # get here document
5070 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5071 0 $here_script = CORE::substr $_, pos $_;
5072 0 $here_script =~ s/.*?\n//oxm;
5073 }
5074 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
5075 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
5076 0 push @heredoc_delimiter, $delimiter;
5077 }
5078 else {
5079 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5080 }
5081 0 $e_string .= $here_quote;
5082 }
5083  
5084 # <<HEREDOC
5085 elsif ($string =~ /\G ( << ([a-zA-Z_0-9]+) ) /oxgc) {
5086 0 $slash = 'm//';
5087 0 my $here_quote = $1;
5088 0 my $delimiter = $2;
5089  
5090 # get here document
5091 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5092 0 $here_script = CORE::substr $_, pos $_;
5093 0 $here_script =~ s/.*?\n//oxm;
5094 }
5095 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
5096 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
5097 0 push @heredoc_delimiter, $delimiter;
5098 }
5099 else {
5100 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5101 }
5102 0 $e_string .= $here_quote;
5103 }
5104  
5105 # <<`HEREDOC`
5106 elsif ($string =~ /\G ( << `([a-zA-Z_0-9]*)` ) /oxgc) {
5107 0 $slash = 'm//';
5108 0 my $here_quote = $1;
5109 0 my $delimiter = $2;
5110  
5111 # get here document
5112 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5113 0 $here_script = CORE::substr $_, pos $_;
5114 0 $here_script =~ s/.*?\n//oxm;
5115 }
5116 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
5117 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
5118 0 push @heredoc_delimiter, $delimiter;
5119 }
5120 else {
5121 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5122 }
5123 0 $e_string .= $here_quote;
5124 }
5125  
5126 # any operator before div
5127 elsif ($string =~ /\G (
5128 -- | \+\+ |
5129 [\)\}\]]
5130  
5131 18 ) /oxgc) { $slash = 'div'; $e_string .= $1; }
5132  
5133 # yada-yada or triple-dot operator
5134 elsif ($string =~ /\G (
5135 \.\.\.
5136  
5137 0 ) /oxgc) { $slash = 'm//'; $e_string .= q{die('Unimplemented')}; }
5138  
5139 # any operator before m//
5140 elsif ($string =~ /\G ((?>
5141  
5142 !~~ | !~ | != | ! |
5143 %= | % |
5144 &&= | && | &= | &\.= | &\. | & |
5145 -= | -> | - |
5146 :(?>\s*)= |
5147 : |
5148 <<>> |
5149 <<= | <=> | <= | < |
5150 == | => | =~ | = |
5151 >>= | >> | >= | > |
5152 \*\*= | \*\* | \*= | \* |
5153 \+= | \+ |
5154 \.\. | \.= | \. |
5155 \/\/= | \/\/ |
5156 \/= | \/ |
5157 \? |
5158 \\ |
5159 \^= | \^\.= | \^\. | \^ |
5160 \b x= |
5161 \|\|= | \|\| | \|= | \|\.= | \|\. | \| |
5162 ~~ | ~\. | ~ |
5163 \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b |
5164 \b(?: print )\b |
5165  
5166 [,;\(\{\[]
5167  
5168 31 )) /oxgc) { $slash = 'm//'; $e_string .= $1; }
5169  
5170 # other any character
5171 131 elsif ($string =~ /\G ($q_char) /oxgc) { $e_string .= $1; }
5172  
5173 # system error
5174 else {
5175 0 die __FILE__, ": Oops, this shouldn't happen!\n";
5176 }
5177 }
5178  
5179 17 return $e_string;
5180 }
5181  
5182 #
5183 # character class
5184 #
5185 1920 ▶sub character_class {
Subroutine character_class: called CC=3 SCAR=11.0
Pod undocumented
5186 1920 my($char,$modifier) = @_;
5187  
5188 1920 ▶ if ($char eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char eq '.') { } 52 1868 1920
5189 52 ▶ if ($modifier =~ /s/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/) { } 17 35 52
5190 17 return '${Elatin3::dot_s}';
5191 }
5192 else {
5193 35 return '${Elatin3::dot}';
5194 }
5195 }
5196 else {
5197 1868 return Elatin3::classic_character_class($char);
5198 }
5199 }
5200  
5201 #
5202 # escape capture ($1, $2, $3, ...)
5203 #
5204 212 ▶sub e_capture {
Subroutine e_capture: called CC=1 SCAR=0.0
Pod undocumented
5205  
5206 212 return join '', '${', $_[0], '}';
5207 }
5208  
5209 #
5210 # escape transliteration (tr/// or y///)
5211 #
5212 4 ▶sub e_tr {
Subroutine e_tr: called CC=5 SCAR=16.8
Pod undocumented
5213 4 my($variable,$charclass,$e,$charclass2,$modifier) = @_;
5214 4 my $e_tr = '';
5215 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
5216  
5217 4 $slash = 'div';
5218  
5219 # quote character class 1
5220 4 $charclass = q_tr($charclass);
5221  
5222 # quote character class 2
5223 4 $charclass2 = q_tr($charclass2);
5224  
5225 # /b /B modifier
5226 4 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) { } 0 4 4
5227 0 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq '') { } 0 0 0
5228 0 $e_tr = qq{tr$charclass$e$charclass2$modifier};
5229 }
5230 else {
5231 0 $e_tr = qq{$variable${bind_operator}tr$charclass$e$charclass2$modifier};
5232 }
5233 }
5234 else {
5235 4 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq '') { } 2 2 4
5236 2 $e_tr = qq{Elatin3::tr(\$_,' =~ ',$charclass,$e$charclass2,'$modifier')};
5237 }
5238 else {
5239 2 $e_tr = qq{Elatin3::tr($variable,'$bind_operator',$charclass,$e$charclass2,'$modifier')};
5240 }
5241 }
5242  
5243 # clear tr/// variable
5244 4 $tr_variable = '';
5245 4 $bind_operator = '';
5246  
5247 4 return $e_tr;
5248 }
5249  
5250 #
5251 # quote for escape transliteration (tr/// or y///)
5252 #
5253 8 ▶sub q_tr {
Subroutine q_tr: called CC=9 SCAR=40.6
Pod undocumented
5254 8 my($charclass) = @_;
5255  
5256 # quote character class
5257 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
5258 8 return e_q('', "'", "'", $charclass); # --> q' '
5259 }
5260 elsif ($charclass !~ /\//oxms) {
5261 0 return e_q('q', '/', '/', $charclass); # --> q/ /
5262 }
5263 elsif ($charclass !~ /\#/oxms) {
5264 0 return e_q('q', '#', '#', $charclass); # --> q# #
5265 }
5266 elsif ($charclass !~ /[\<\>]/oxms) {
5267 0 return e_q('q', '<', '>', $charclass); # --> q< >
5268 }
5269 elsif ($charclass !~ /[\(\)]/oxms) {
5270 0 return e_q('q', '(', ')', $charclass); # --> q( )
5271 }
5272 elsif ($charclass !~ /[\{\}]/oxms) {
5273 0 return e_q('q', '{', '}', $charclass); # --> q{ }
5274 }
5275 else {
5276 0 for my $char (qw( ! " $ % & * + . : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5277 0 ▶ if ($charclass !~ /\Q$char\E/xms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($charclass =~ /\Q$char\E/msx) 0 0 0
5278 0 return e_q('q', $char, $char, $charclass);
5279 }
5280 }
5281 }
5282  
5283 0 return e_q('q', '{', '}', $charclass);
5284 }
5285  
5286 #
5287 # escape q string (q//, '')
5288 #
5289 1623 ▶sub e_q {
Subroutine e_q: called CC=1 SCAR=0.0
Pod undocumented
5290 1623 my($ope,$delimiter,$end_delimiter,$string) = @_;
5291  
5292 1623 $slash = 'div';
5293  
5294 1623 return join '', $ope, $delimiter, $string, $end_delimiter;
5295 }
5296  
5297 #
5298 # escape qq string (qq//, "", qx//, ``)
5299 #
5300 4221 ▶sub e_qq {
Subroutine e_qq: called CC=37 SCAR=50.9
Pod undocumented
5301 4221 my($ope,$delimiter,$end_delimiter,$string) = @_;
5302  
5303 4221 $slash = 'div';
5304  
5305 4221 my $left_e = 0;
5306 4221 my $right_e = 0;
5307  
5308 # split regexp
5309 4221 my @char = $string =~ /\G((?>
5310 [^\\\$] |
5311 \\x\{ (?>[0-9A-Fa-f]+) \} |
5312 \\o\{ (?>[0-7]+) \} |
5313 \\N\{ (?>[^0-9\}][^\}]*) \} |
5314 \\ $q_char |
5315 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5316 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5317 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5318 \$ (?>\s* [0-9]+) |
5319 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5320 \$ \$ (?![\w\{]) |
5321 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5322 $q_char
5323 ))/oxmsg;
5324  
5325 4221 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 116671 4221 120892
5326  
5327 # "\L\u" --> "\u\L"
5328 116671 ▶ 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 116671 116671
elsif ($char[$i] eq '\\U' and $char[$i + 1] eq '\\l') { } 0 116671 116671
elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/mosx) { } 1 116670 116671
elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/mosx) { } 1 116669 116670
elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/mosx) { } 0 116669 116669
Condition33%1/3
$char[$i] eq "\\L" and $char[$i + 1] eq "\\u"
!ll&&!rl&&r
11667100
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
5329 0 @char[$i,$i+1] = @char[$i+1,$i];
5330 }
5331  
5332 # "\U\l" --> "\l\U"
5333 ▶ 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
11667100
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
5334 0 @char[$i,$i+1] = @char[$i+1,$i];
5335 }
5336  
5337 # octal escape sequence
5338 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5339 1 $char[$i] = Elatin3::octchr($1);
5340 }
5341  
5342 # hexadecimal escape sequence
5343 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5344 1 $char[$i] = Elatin3::hexchr($1);
5345 }
5346  
5347 # \N{CHARNAME} --> N{CHARNAME}
5348 elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5349 0 $char[$i] = $1;
5350 }
5351  
5352 116671 ▶ if (0) {
Branch: 23 branches
BranchTrueFalseTotal
if (do { $char[$i] =~ /\A ([<>]) \z/mosx }) { } 484 116187 116671
elsif ($char[$i] eq '\\u') { } 0 116187 116187
elsif ($char[$i] eq '\\l') { } 0 116187 116187
elsif ($char[$i] eq '\\U') { } 0 116187 116187
elsif ($char[$i] eq '\\L') { } 0 116187 116187
elsif ($char[$i] eq '\\F') { } 24 116163 116187
elsif ($char[$i] eq '\\Q') { } 0 116163 116163
elsif ($char[$i] eq '\\E') { } 24 116139 116163
elsif ($char[$i] eq '\\Q') { } 0 116139 116139
elsif ($char[$i] eq '\\E') { } 0 116139 116139
elsif ($char[$i] =~ /\A \$ 0 \z/mosx) { } 4 116135 116139
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/mosx) { } 0 116135 116135
elsif ($char[$i] =~ /\A \$\$ \z/mosx) { } 0 116135 116135
elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/mosx) { } 205 115930 116135
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/mosx) { } 0 115930 115930
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/mosx) { } 0 115930 115930
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/mosx) { } 0 115930 115930
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/mosx) { } 0 115930 115930
elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/cgmosx) { } 44 115886 115930
elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/cgmosx) { } 45 115841 115886
elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/cgmosx) { } 33 115808 115841
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/mosx) { } 0 115808 115808
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/mosx) { } 0 115808 115808
5353 }
5354  
5355 # \F
5356 #
5357 # P.69 Table 2-6. Translation escapes
5358 # in Chapter 2: Bits and Pieces
5359 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
5360 # (and so on)
5361  
5362 # \u \l \U \L \F \Q \E
5363 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
5364 484 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 484 484
5365 0 $char[$i] = '\\' . $char[$i];
5366 }
5367 }
5368 elsif ($char[$i] eq '\u') {
5369  
5370 # "STRING @{[ LIST EXPR ]} MORE STRING"
5371  
5372 # P.257 Other Tricks You Can Do with Hard References
5373 # in Chapter 8: References
5374 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
5375  
5376 # P.353 Other Tricks You Can Do with Hard References
5377 # in Chapter 8: References
5378 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
5379  
5380 # (and so on)
5381  
5382 0 $char[$i] = '@{[Elatin3::ucfirst qq<';
5383 0 $left_e++;
5384 }
5385 elsif ($char[$i] eq '\l') {
5386 0 $char[$i] = '@{[Elatin3::lcfirst qq<';
5387 0 $left_e++;
5388 }
5389 elsif ($char[$i] eq '\U') {
5390 0 $char[$i] = '@{[Elatin3::uc qq<';
5391 0 $left_e++;
5392 }
5393 elsif ($char[$i] eq '\L') {
5394 0 $char[$i] = '@{[Elatin3::lc qq<';
5395 0 $left_e++;
5396 }
5397 elsif ($char[$i] eq '\F') {
5398 24 $char[$i] = '@{[Elatin3::fc qq<';
5399 24 $left_e++;
5400 }
5401 elsif ($char[$i] eq '\Q') {
5402 0 $char[$i] = '@{[CORE::quotemeta qq<';
5403 0 $left_e++;
5404 }
5405 elsif ($char[$i] eq '\E') {
5406 24 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 24 0 24
5407 24 $char[$i] = '>]}';
5408 24 $right_e++;
5409 }
5410 else {
5411 0 $char[$i] = '';
5412 }
5413 }
5414 elsif ($char[$i] eq '\Q') {
5415 0 while (1) {
5416 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5417 0 last;
5418 }
5419 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
5420 0 last;
5421 }
5422 }
5423 }
5424 elsif ($char[$i] eq '\E') {
5425 }
5426  
5427 # $0 --> $0
5428 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
5429 }
5430 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
5431 }
5432  
5433 # $$ --> $$
5434 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
5435 }
5436  
5437 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
5438 # $1, $2, $3 --> $1, $2, $3 otherwise
5439 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
5440 205 $char[$i] = e_capture($1);
5441 }
5442 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
5443 0 $char[$i] = e_capture($1);
5444 }
5445  
5446 # $$foo[ ... ] --> $ $foo->[ ... ]
5447 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
5448 0 $char[$i] = e_capture($1.'->'.$2);
5449 }
5450  
5451 # $$foo{ ... } --> $ $foo->{ ... }
5452 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
5453 0 $char[$i] = e_capture($1.'->'.$2);
5454 }
5455  
5456 # $$foo
5457 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
5458 0 $char[$i] = e_capture($1);
5459 }
5460  
5461 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin3::PREMATCH()
5462 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
5463 44 $char[$i] = '@{[Elatin3::PREMATCH()]}';
5464 }
5465  
5466 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin3::MATCH()
5467 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
5468 45 $char[$i] = '@{[Elatin3::MATCH()]}';
5469 }
5470  
5471 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin3::POSTMATCH()
5472 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
5473 33 $char[$i] = '@{[Elatin3::POSTMATCH()]}';
5474 }
5475  
5476 # ${ foo } --> ${ foo }
5477 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/oxms) {
5478 }
5479  
5480 # ${ ... }
5481 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5482 0 $char[$i] = e_capture($1);
5483 }
5484 }
5485  
5486 # return string
5487 4221 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 4221 4221
5488 0 return join '', $ope, $delimiter, @char, '>]}' x ($left_e - $right_e), $end_delimiter;
5489 }
5490 4221 return join '', $ope, $delimiter, @char, $end_delimiter;
5491 }
5492  
5493 #
5494 # escape qw string (qw//)
5495 #
5496 16 ▶sub e_qw {
Subroutine e_qw: called CC=11 SCAR=43.1
Pod undocumented
5497 16 my($ope,$delimiter,$end_delimiter,$string) = @_;
5498  
5499 16 $slash = 'div';
5500  
5501 # choice again delimiter
5502 16 my %octet = map {$_ => 1} ($string =~ /\G ([\x00-\xFF]) /oxmsg);
5503 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
5504 16 return join '', $ope, $delimiter, $string, $end_delimiter;
5505 }
5506 elsif (not $octet{')'}) {
5507 0 return join '', $ope, '(', $string, ')';
5508 }
5509 elsif (not $octet{'}'}) {
5510 0 return join '', $ope, '{', $string, '}';
5511 }
5512 elsif (not $octet{']'}) {
5513 0 return join '', $ope, '[', $string, ']';
5514 }
5515 elsif (not $octet{'>'}) {
5516 0 return join '', $ope, '<', $string, '>';
5517 }
5518 else {
5519 0 for my $char (qw( ! " $ % & * + - . / : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5520 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5521 0 return join '', $ope, $char, $string, $char;
5522 }
5523 }
5524 }
5525  
5526 # qw/AAA BBB C'CC/ --> ('AAA', 'BBB', 'C\'CC')
5527 0 my @string = CORE::split(/\s+/, $string);
5528 0 for my $string (@string) {
5529 0 my @octet = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5530 0 for my $octet (@octet) {
5531 0 ▶ if ($octet =~ /\A (['\\]) \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($octet =~ /\A (['\\]) \z/mosx) 0 0 0
5532 0 $octet = '\\' . $1;
5533 }
5534 }
5535 0 $string = join '', @octet;
5536 }
5537 0 return join '', '(', (join ', ', map { "'$_'" } @string), ')';
5538 }
5539  
5540 #
5541 # escape here document (<<"HEREDOC", <<HEREDOC, <<`HEREDOC`, <<~"HEREDOC", <<~HEREDOC, <<~`HEREDOC`)
5542 #
5543 93 ▶sub e_heredoc {
Subroutine e_heredoc: called CC=37 SCAR=56.3
Pod undocumented
5544 93 my($string) = @_;
5545  
5546 93 $slash = 'm//';
5547  
5548 93 my $metachar = qr/[\@\\|]/oxms; # '|' is for <<`HEREDOC`
5549  
5550 93 my $left_e = 0;
5551 93 my $right_e = 0;
5552  
5553 # split regexp
5554 93 my @char = $string =~ /\G((?>
5555 [^\\\$] |
5556 \\x\{ (?>[0-9A-Fa-f]+) \} |
5557 \\o\{ (?>[0-7]+) \} |
5558 \\N\{ (?>[^0-9\}][^\}]*) \} |
5559 \\ $q_char |
5560 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5561 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5562 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5563 \$ (?>\s* [0-9]+) |
5564 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5565 \$ \$ (?![\w\{]) |
5566 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5567 $q_char
5568 ))/oxmsg;
5569  
5570 93 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 3177 93 3270
5571  
5572 # "\L\u" --> "\u\L"
5573 3177 ▶ if (($char[$i] eq '\L') and ($char[$i+1] eq '\u')) {
Branch: 5 branches
BranchTrueFalseTotal
if ($char[$i] eq '\\L' and $char[$i + 1] eq '\\u') { } 0 3177 3177
elsif ($char[$i] eq '\\U' and $char[$i + 1] eq '\\l') { } 0 3177 3177
elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/mosx) { } 1 3176 3177
elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/mosx) { } 1 3175 3176
elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/mosx) { } 0 3175 3175
Condition33%1/3
$char[$i] eq "\\L" and $char[$i + 1] eq "\\u"
!ll&&!rl&&r
317700
MC/DC0%0/2
$char[$i] eq "\\L" and $char[$i + 1] eq "\\u"
$char[$i] eq "\\L" $char[$i + 1] eq "\\u"
Truth table33%1/3
A and B
A= $char[$i] eq "\\L"B= $char[$i + 1] eq "\\u"
ABresult
0X0
100
111
5574 0 @char[$i,$i+1] = @char[$i+1,$i];
5575 }
5576  
5577 # "\U\l" --> "\l\U"
5578 ▶ elsif (($char[$i] eq '\U') and ($char[$i+1] eq '\l')) {
Condition33%1/3
$char[$i] eq "\\U" and $char[$i + 1] eq "\\l"
!ll&&!rl&&r
317700
MC/DC0%0/2
$char[$i] eq "\\U" and $char[$i + 1] eq "\\l"
$char[$i] eq "\\U" $char[$i + 1] eq "\\l"
Truth table33%1/3
A and B
A= $char[$i] eq "\\U"B= $char[$i + 1] eq "\\l"
ABresult
0X0
100
111
5579 0 @char[$i,$i+1] = @char[$i+1,$i];
5580 }
5581  
5582 # octal escape sequence
5583 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5584 1 $char[$i] = Elatin3::octchr($1);
5585 }
5586  
5587 # hexadecimal escape sequence
5588 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5589 1 $char[$i] = Elatin3::hexchr($1);
5590 }
5591  
5592 # \N{CHARNAME} --> N{CHARNAME}
5593 elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5594 0 $char[$i] = $1;
5595 }
5596  
5597 3177 ▶ if (0) {
Branch: 23 branches
BranchTrueFalseTotal
if (do { $char[$i] =~ /\A ([<>]) \z/mosx }) { } 0 3177 3177
elsif ($char[$i] eq '\\u') { } 0 3177 3177
elsif ($char[$i] eq '\\l') { } 0 3177 3177
elsif ($char[$i] eq '\\U') { } 0 3177 3177
elsif ($char[$i] eq '\\L') { } 0 3177 3177
elsif ($char[$i] eq '\\F') { } 0 3177 3177
elsif ($char[$i] eq '\\Q') { } 0 3177 3177
elsif ($char[$i] eq '\\E') { } 0 3177 3177
elsif ($char[$i] eq '\\Q') { } 0 3177 3177
elsif ($char[$i] eq '\\E') { } 0 3177 3177
elsif ($char[$i] =~ /\A \$ 0 \z/mosx) { } 0 3177 3177
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/mosx) { } 0 3177 3177
elsif ($char[$i] =~ /\A \$\$ \z/mosx) { } 0 3177 3177
elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/mosx) { } 0 3177 3177
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/mosx) { } 0 3177 3177
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/mosx) { } 0 3177 3177
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/mosx) { } 0 3177 3177
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/mosx) { } 0 3177 3177
elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/cgmosx) { } 8 3169 3177
elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/cgmosx) { } 8 3161 3169
elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/cgmosx) { } 6 3155 3161
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/mosx) { } 0 3155 3155
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/mosx) { } 0 3155 3155
5598 }
5599  
5600 # \u \l \U \L \F \Q \E
5601 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
5602 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
5603 0 $char[$i] = '\\' . $char[$i];
5604 }
5605 }
5606 elsif ($char[$i] eq '\u') {
5607 0 $char[$i] = '@{[Elatin3::ucfirst qq<';
5608 0 $left_e++;
5609 }
5610 elsif ($char[$i] eq '\l') {
5611 0 $char[$i] = '@{[Elatin3::lcfirst qq<';
5612 0 $left_e++;
5613 }
5614 elsif ($char[$i] eq '\U') {
5615 0 $char[$i] = '@{[Elatin3::uc qq<';
5616 0 $left_e++;
5617 }
5618 elsif ($char[$i] eq '\L') {
5619 0 $char[$i] = '@{[Elatin3::lc qq<';
5620 0 $left_e++;
5621 }
5622 elsif ($char[$i] eq '\F') {
5623 0 $char[$i] = '@{[Elatin3::fc qq<';
5624 0 $left_e++;
5625 }
5626 elsif ($char[$i] eq '\Q') {
5627 0 $char[$i] = '@{[CORE::quotemeta qq<';
5628 0 $left_e++;
5629 }
5630 elsif ($char[$i] eq '\E') {
5631 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
5632 0 $char[$i] = '>]}';
5633 0 $right_e++;
5634 }
5635 else {
5636 0 $char[$i] = '';
5637 }
5638 }
5639 elsif ($char[$i] eq '\Q') {
5640 0 while (1) {
5641 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5642 0 last;
5643 }
5644 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
5645 0 last;
5646 }
5647 }
5648 }
5649 elsif ($char[$i] eq '\E') {
5650 }
5651  
5652 # $0 --> $0
5653 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
5654 }
5655 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
5656 }
5657  
5658 # $$ --> $$
5659 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
5660 }
5661  
5662 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
5663 # $1, $2, $3 --> $1, $2, $3 otherwise
5664 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
5665 0 $char[$i] = e_capture($1);
5666 }
5667 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
5668 0 $char[$i] = e_capture($1);
5669 }
5670  
5671 # $$foo[ ... ] --> $ $foo->[ ... ]
5672 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
5673 0 $char[$i] = e_capture($1.'->'.$2);
5674 }
5675  
5676 # $$foo{ ... } --> $ $foo->{ ... }
5677 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
5678 0 $char[$i] = e_capture($1.'->'.$2);
5679 }
5680  
5681 # $$foo
5682 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
5683 0 $char[$i] = e_capture($1);
5684 }
5685  
5686 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin3::PREMATCH()
5687 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
5688 8 $char[$i] = '@{[Elatin3::PREMATCH()]}';
5689 }
5690  
5691 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin3::MATCH()
5692 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
5693 8 $char[$i] = '@{[Elatin3::MATCH()]}';
5694 }
5695  
5696 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin3::POSTMATCH()
5697 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
5698 6 $char[$i] = '@{[Elatin3::POSTMATCH()]}';
5699 }
5700  
5701 # ${ foo } --> ${ foo }
5702 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/oxms) {
5703 }
5704  
5705 # ${ ... }
5706 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5707 0 $char[$i] = e_capture($1);
5708 }
5709 }
5710  
5711 # return string
5712 93 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 93 93
5713 0 return join '', @char, '>]}' x ($left_e - $right_e);
5714 }
5715 93 return join '', @char;
5716 }
5717  
5718 #
5719 # escape regexp (m//, qr//)
5720 #
5721 880 ▶sub e_qr {
Subroutine e_qr: called CC=110 SCAR=73.6
Pod undocumented
5722 880 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5723 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
5724  
5725 880 $modifier =~ tr/p//d;
5726 880 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 880 880
5727 0 my $line = 0;
5728 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
5729 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
5730 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
5731 0 last;
5732 }
5733 }
5734 0 die qq{Unsupported modifier "$1" used at line $line.\n};
5735 }
5736  
5737 880 $slash = 'div';
5738  
5739 # literal null string pattern
5740 880 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 872 880
elsif ($modifier =~ tr/Bb//d) { } 2 870 872
5741 8 $modifier =~ tr/bB//d;
5742 8 $modifier =~ tr/i//d;
5743 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
5744 }
5745  
5746 # /b /B modifier
5747 elsif ($modifier =~ tr/bB//d) {
5748  
5749 # choice again delimiter
5750 2 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 2 2
5751 0 my @char = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5752 0 my %octet = map {$_ => 1} @char;
5753 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
5754 0 $delimiter = '(';
5755 0 $end_delimiter = ')';
5756 }
5757 elsif (not $octet{'}'}) {
5758 0 $delimiter = '{';
5759 0 $end_delimiter = '}';
5760 }
5761 elsif (not $octet{']'}) {
5762 0 $delimiter = '[';
5763 0 $end_delimiter = ']';
5764 }
5765 elsif (not $octet{'>'}) {
5766 0 $delimiter = '<';
5767 0 $end_delimiter = '>';
5768 }
5769 else {
5770 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5771 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5772 0 $delimiter = $char;
5773 0 $end_delimiter = $char;
5774 0 last;
5775 }
5776 }
5777 }
5778 }
5779  
5780 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
5781 0 return join '', $ope, $delimiter, $string, $matched, $end_delimiter, $modifier;
5782 }
5783 else {
5784 2 return join '', $ope, $delimiter, '(?:', $string, ')', $matched, $end_delimiter, $modifier;
5785 }
5786 }
5787  
5788 870 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 312 558 870
5789 870 my $metachar = qr/[\@\\|[\]{^]/oxms;
5790  
5791 # split regexp
5792 870 my @char = $string =~ /\G((?>
5793 [^\\\$\@\[\(] |
5794 \\x (?>[0-9A-Fa-f]{1,2}) |
5795 \\ (?>[0-7]{2,3}) |
5796 \\c [\x40-\x5F] |
5797 \\x\{ (?>[0-9A-Fa-f]+) \} |
5798 \\o\{ (?>[0-7]+) \} |
5799 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
5800 \\ $q_char |
5801 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5802 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5803 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5804 [\$\@] $qq_variable |
5805 \$ (?>\s* [0-9]+) |
5806 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5807 \$ \$ (?![\w\{]) |
5808 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5809 \[\^ |
5810 \[\: (?>[a-z]+) :\] |
5811 \[\:\^ (?>[a-z]+) :\] |
5812 \(\? |
5813 $q_char
5814 ))/oxmsg;
5815  
5816 # choice again delimiter
5817 870 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 870 870
5818 0 my %octet = map {$_ => 1} @char;
5819 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
5820 0 $delimiter = '(';
5821 0 $end_delimiter = ')';
5822 }
5823 elsif (not $octet{'}'}) {
5824 0 $delimiter = '{';
5825 0 $end_delimiter = '}';
5826 }
5827 elsif (not $octet{']'}) {
5828 0 $delimiter = '[';
5829 0 $end_delimiter = ']';
5830 }
5831 elsif (not $octet{'>'}) {
5832 0 $delimiter = '<';
5833 0 $end_delimiter = '>';
5834 }
5835 else {
5836 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5837 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5838 0 $delimiter = $char;
5839 0 $end_delimiter = $char;
5840 0 last;
5841 }
5842 }
5843 }
5844 }
5845  
5846 870 my $left_e = 0;
5847 870 my $right_e = 0;
5848 870 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 2100 870 2970
5849  
5850 # "\L\u" --> "\u\L"
5851 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
5852 0 @char[$i,$i+1] = @char[$i+1,$i];
5853 }
5854  
5855 # "\U\l" --> "\l\U"
5856 ▶ 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
5857 0 @char[$i,$i+1] = @char[$i+1,$i];
5858 }
5859  
5860 # octal escape sequence
5861 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5862 1 $char[$i] = Elatin3::octchr($1);
5863 }
5864  
5865 # hexadecimal escape sequence
5866 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5867 1 $char[$i] = Elatin3::hexchr($1);
5868 }
5869  
5870 # \b{...} --> b\{...}
5871 # \B{...} --> B\{...}
5872 # \N{CHARNAME} --> N\{CHARNAME}
5873 # \p{PROPERTY} --> p\{PROPERTY}
5874 # \P{PROPERTY} --> P\{PROPERTY}
5875 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5876 6 $char[$i] = $1 . '\\' . $2;
5877 }
5878  
5879 # \p, \P, \X --> p, P, X
5880 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
5881 4 $char[$i] = $1;
5882 }
5883  
5884 2100 ▶ if (0) {
Branch: 30 branches
BranchTrueFalseTotal
if (do { $char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx }) { } 6 2094 2100
elsif ($char[$i] eq '[') { } 556 1538 2094
elsif ($char[$i] eq '[^') { } 74 1464 1538
elsif (my $char = character_class($char[$i], $modifier)) { } 139 1325 1464
elsif ($ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin3::uc($char[$i]) ne &fc($char[$i])) { } 20 1305 1325
elsif ($char[$i] =~ /\A [<>] \z/mosx) { } 1 1304 1305
elsif ($char[$i] eq '\\u') { } 0 1304 1304
elsif ($char[$i] eq '\\l') { } 0 1304 1304
elsif ($char[$i] eq '\\U') { } 1 1303 1304
elsif ($char[$i] eq '\\L') { } 1 1302 1303
elsif ($char[$i] eq '\\F') { } 18 1284 1302
elsif ($char[$i] eq '\\Q') { } 1 1283 1284
elsif ($char[$i] eq '\\E') { } 21 1262 1283
elsif ($char[$i] eq '\\Q') { } 0 1262 1262
elsif ($char[$i] eq '\\E') { } 0 1262 1262
elsif ($char[$i] =~ /\A \$ 0 \z/mosx) { } 0 1262 1262
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/mosx) { } 0 1262 1262
elsif ($char[$i] =~ /\A \$\$ \z/mosx) { } 0 1262 1262
elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/mosx) { } 0 1262 1262
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/mosx) { } 0 1262 1262
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/mosx) { } 0 1262 1262
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/mosx) { } 0 1262 1262
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/mosx) { } 0 1262 1262
elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/cgmosx) { } 8 1254 1262
elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/cgmosx) { } 8 1246 1254
elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/cgmosx) { } 6 1240 1246
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/mosx) { } 0 1240 1240
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/mosx) { } 0 1240 1240
elsif ($char[$i] =~ /\A [\$\@].+ /mosx) { } 21 1219 1240
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 138 1377 1515
5885 }
5886  
5887 # join separated multiple-octet
5888 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
5889 6 ▶ if ( ($i+3 <= $#char) and (grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms, @char[$i+1..$i+3]) == 3) and (CORE::eval(sprintf '"%s%s%s%s"', @char[$i..$i+3]) =~ /\A $q_char \z/oxms)) {
Branch: 3 branches
BranchTrueFalseTotal
if ($i + 3 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 3]) == 3 and eval(sprintf '"%s%s%s%s"', @char[$i .. $i + 3]) =~ /\A $Elatin3::q_char \z/mosx) { } 0 6 6
elsif ($i + 2 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 2]) == 2 and eval(sprintf '"%s%s%s"', @char[$i .. $i + 2]) =~ /\A $Elatin3::q_char \z/mosx) { } 0 6 6
elsif ($i + 1 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, $char[$i + 1]) == 1 and eval(sprintf '"%s%s"', @char[$i .. $i + 1]) =~ /\A $Elatin3::q_char \z/mosx) { } 0 12 12
Condition33%2/6
$i + 3 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 3]) == 3 and eval(sprintf "\"%s%s%s%s\"", @char[$i .. $i + 3]) =~ /\A $Elatin3::q_char \z/mosx
!ll&&!rl&&r
600
$i + 3 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 3]) == 3
!ll&&!rl&&r
600
MC/DC0%0/3
$i + 3 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 3]) == 3 and eval(sprintf "\"%s%s%s%s\"", @char[$i .. $i + 3]) =~ /\A $Elatin3::q_char \z/mosx
$i + 3 <= $#char grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 3]) == 3 eval(sprintf "\"%s%s%s%s\"", @char[$i .. $i + 3]) =~ /\A $Elatin3::q_char \z/mosx
Truth table25%1/4
A and B and C
A= $i + 3 <= $#charB= grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 3]) == 3C= eval(sprintf "\"%s%s%s%s\"", @char[$i .. $i + 3]) =~ /\A $Elatin3::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5890 0 $char[$i] .= join '', splice @char, $i+1, 3;
5891 }
5892 ▶ elsif (($i+2 <= $#char) and (grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms, @char[$i+1..$i+2]) == 2) and (CORE::eval(sprintf '"%s%s%s"', @char[$i..$i+2]) =~ /\A $q_char \z/oxms)) {
Condition33%2/6
$i + 2 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 2]) == 2 and eval(sprintf "\"%s%s%s\"", @char[$i .. $i + 2]) =~ /\A $Elatin3::q_char \z/mosx
!ll&&!rl&&r
600
$i + 2 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 2]) == 2
!ll&&!rl&&r
600
MC/DC0%0/3
$i + 2 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 2]) == 2 and eval(sprintf "\"%s%s%s\"", @char[$i .. $i + 2]) =~ /\A $Elatin3::q_char \z/mosx
$i + 2 <= $#char grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 2]) == 2 eval(sprintf "\"%s%s%s\"", @char[$i .. $i + 2]) =~ /\A $Elatin3::q_char \z/mosx
Truth table25%1/4
A and B and C
A= $i + 2 <= $#charB= grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 2]) == 2C= eval(sprintf "\"%s%s%s\"", @char[$i .. $i + 2]) =~ /\A $Elatin3::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5893 0 $char[$i] .= join '', splice @char, $i+1, 2;
5894 }
5895 ▶ elsif (($i+1 <= $#char) and (grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms, $char[$i+1 ]) == 1) and (CORE::eval(sprintf '"%s%s"', @char[$i..$i+1]) =~ /\A $q_char \z/oxms)) {
Condition50%3/6
$i + 1 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, $char[$i + 1]) == 1 and eval(sprintf "\"%s%s\"", @char[$i .. $i + 1]) =~ /\A $Elatin3::q_char \z/mosx
!ll&&!rl&&r
600
$i + 1 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, $char[$i + 1]) == 1
!ll&&!rl&&r
420
MC/DC0%0/3
$i + 1 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, $char[$i + 1]) == 1 and eval(sprintf "\"%s%s\"", @char[$i .. $i + 1]) =~ /\A $Elatin3::q_char \z/mosx
$i + 1 <= $#char grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, $char[$i + 1]) == 1 eval(sprintf "\"%s%s\"", @char[$i .. $i + 1]) =~ /\A $Elatin3::q_char \z/mosx
Truth table50%2/4
A and B and C
A= $i + 1 <= $#charB= grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, $char[$i + 1]) == 1C= eval(sprintf "\"%s%s\"", @char[$i .. $i + 1]) =~ /\A $Elatin3::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5896 0 $char[$i] .= join '', splice @char, $i+1, 1;
5897 }
5898 }
5899  
5900 # open character class [...]
5901 elsif ($char[$i] eq '[') {
5902 556 my $left = $i;
5903  
5904 # [] make die "Unmatched [] in regexp ...\n"
5905 # (and so on)
5906  
5907 556 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 3 553 556
5908 3 $i++;
5909 }
5910  
5911 556 while (1) {
5912 2063 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 2063 2063
5913 0 die __FILE__, ": Unmatched [] in regexp\n";
5914 }
5915 2063 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 556 1507 2063
5916 556 my $right = $i;
5917  
5918 # [...]
5919 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
5920 30 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin3::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
5921 }
5922 else {
5923 526 splice @char, $left, $right-$left+1, Elatin3::charlist_qr(@char[$left+1..$right-1], $modifier);
5924 }
5925  
5926 556 $i = $left;
5927 556 last;
5928 }
5929 }
5930 }
5931  
5932 # open character class [^...]
5933 elsif ($char[$i] eq '[^') {
5934 74 my $left = $i;
5935  
5936 # [^] make die "Unmatched [] in regexp ...\n"
5937 # (and so on)
5938  
5939 74 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 4 70 74
5940 4 $i++;
5941 }
5942  
5943 74 while (1) {
5944 272 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 272 272
5945 0 die __FILE__, ": Unmatched [] in regexp\n";
5946 }
5947 272 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 74 198 272
5948 74 my $right = $i;
5949  
5950 # [^...]
5951 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
5952 30 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin3::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
5953 }
5954 else {
5955 44 splice @char, $left, $right-$left+1, Elatin3::charlist_not_qr(@char[$left+1..$right-1], $modifier);
5956 }
5957  
5958 74 $i = $left;
5959 74 last;
5960 }
5961 }
5962 }
5963  
5964 # rewrite character class or escape character
5965 elsif (my $char = character_class($char[$i],$modifier)) {
5966 139 $char[$i] = $char;
5967 }
5968  
5969 # /i modifier
5970 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin3::uc($char[$i]) ne Elatin3::fc($char[$i]))) {
Condition100%6/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin3::uc($char[$i]) ne &fc($char[$i])
!ll&&!rl&&r
1297820
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx
!ll&&!rl&&r
12663128
MC/DC100%3/3
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin3::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin3::uc($char[$i]) ne &fc($char[$i])
Truth table100%4/4
A and B and C
A= $ignorecaseB= $char[$i] =~ /\A [\x00-\xFF] \z/mosxC= &Elatin3::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
5971 20 ▶ if (CORE::length(Elatin3::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 20 0 20
5972 20 $char[$i] = '[' . Elatin3::uc($char[$i]) . Elatin3::fc($char[$i]) . ']';
5973 }
5974 else {
5975 0 $char[$i] = '(?:' . Elatin3::uc($char[$i]) . '|' . Elatin3::fc($char[$i]) . ')';
5976 }
5977 }
5978  
5979 # \u \l \U \L \F \Q \E
5980 elsif ($char[$i] =~ /\A [<>] \z/oxms) {
5981 1 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 1 1
5982 0 $char[$i] = '\\' . $char[$i];
5983 }
5984 }
5985 elsif ($char[$i] eq '\u') {
5986 0 $char[$i] = '@{[Elatin3::ucfirst qq<';
5987 0 $left_e++;
5988 }
5989 elsif ($char[$i] eq '\l') {
5990 0 $char[$i] = '@{[Elatin3::lcfirst qq<';
5991 0 $left_e++;
5992 }
5993 elsif ($char[$i] eq '\U') {
5994 1 $char[$i] = '@{[Elatin3::uc qq<';
5995 1 $left_e++;
5996 }
5997 elsif ($char[$i] eq '\L') {
5998 1 $char[$i] = '@{[Elatin3::lc qq<';
5999 1 $left_e++;
6000 }
6001 elsif ($char[$i] eq '\F') {
6002 18 $char[$i] = '@{[Elatin3::fc qq<';
6003 18 $left_e++;
6004 }
6005 elsif ($char[$i] eq '\Q') {
6006 1 $char[$i] = '@{[CORE::quotemeta qq<';
6007 1 $left_e++;
6008 }
6009 elsif ($char[$i] eq '\E') {
6010 21 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 21 0 21
6011 21 $char[$i] = '>]}';
6012 21 $right_e++;
6013 }
6014 else {
6015 0 $char[$i] = '';
6016 }
6017 }
6018 elsif ($char[$i] eq '\Q') {
6019 0 while (1) {
6020 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6021 0 last;
6022 }
6023 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
6024 0 last;
6025 }
6026 }
6027 }
6028 elsif ($char[$i] eq '\E') {
6029 }
6030  
6031 # $0 --> $0
6032 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
6033 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6034 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
6035 }
6036 }
6037 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
6038 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6039 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
6040 }
6041 }
6042  
6043 # $$ --> $$
6044 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
6045 }
6046  
6047 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
6048 # $1, $2, $3 --> $1, $2, $3 otherwise
6049 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
6050 0 $char[$i] = e_capture($1);
6051 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6052 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
6053 }
6054 }
6055 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \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] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
6059 }
6060 }
6061  
6062 # $$foo[ ... ] --> $ $foo->[ ... ]
6063 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
6064 0 $char[$i] = e_capture($1.'->'.$2);
6065 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6066 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
6067 }
6068 }
6069  
6070 # $$foo{ ... } --> $ $foo->{ ... }
6071 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
6072 0 $char[$i] = e_capture($1.'->'.$2);
6073 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6074 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
6075 }
6076 }
6077  
6078 # $$foo
6079 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
6080 0 $char[$i] = e_capture($1);
6081 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6082 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
6083 }
6084 }
6085  
6086 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin3::PREMATCH()
6087 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
6088 8 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 8 8
6089 0 $char[$i] = '@{[Elatin3::ignorecase(Elatin3::PREMATCH())]}';
6090 }
6091 else {
6092 8 $char[$i] = '@{[Elatin3::PREMATCH()]}';
6093 }
6094 }
6095  
6096 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin3::MATCH()
6097 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
6098 8 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 8 8
6099 0 $char[$i] = '@{[Elatin3::ignorecase(Elatin3::MATCH())]}';
6100 }
6101 else {
6102 8 $char[$i] = '@{[Elatin3::MATCH()]}';
6103 }
6104 }
6105  
6106 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin3::POSTMATCH()
6107 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
6108 6 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 6 6
6109 0 $char[$i] = '@{[Elatin3::ignorecase(Elatin3::POSTMATCH())]}';
6110 }
6111 else {
6112 6 $char[$i] = '@{[Elatin3::POSTMATCH()]}';
6113 }
6114 }
6115  
6116 # ${ foo }
6117 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
6118 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6119 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
6120 }
6121 }
6122  
6123 # ${ ... }
6124 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
6125 0 $char[$i] = e_capture($1);
6126 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6127 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
6128 }
6129 }
6130  
6131 # $scalar or @array
6132 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
6133 21 $char[$i] = e_string($char[$i]);
6134 21 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 11 10 21
6135 11 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
6136 }
6137 }
6138  
6139 # quote character before ? + * {
6140 ▶ 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
6141 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
6142 }
6143 ▶ 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
6144 0 my $char = $char[$i-1];
6145 0 ▶ if ($char[$i] eq '{') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq '{') { } 0 0 0
6146 0 die __FILE__, qq{: "MULTIBYTE{n}" should be "(MULTIBYTE){n}" in m?? (and shift \$1,\$2,\$3,...) ($char){n}\n};
6147 }
6148 else {
6149 0 die __FILE__, qq{: "MULTIBYTE$char[$i]" should be "(MULTIBYTE)$char[$i]" in m?? (and shift \$1,\$2,\$3,...) ($char)$char[$i]\n};
6150 }
6151 }
6152 else {
6153 127 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6154 }
6155 }
6156 }
6157  
6158 # make regexp string
6159 870 $modifier =~ tr/i//d;
6160 870 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 870 870
6161 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
6162 0 return join '', $ope, $delimiter, $anchor, @char, '>]}' x ($left_e - $right_e), $matched, $end_delimiter, $modifier;
6163 }
6164 else {
6165 0 return join '', $ope, $delimiter, $anchor, '(?:', @char, '>]}' x ($left_e - $right_e), ')', $matched, $end_delimiter, $modifier;
6166 }
6167 }
6168 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
6169 0 return join '', $ope, $delimiter, $anchor, @char, $matched, $end_delimiter, $modifier;
6170 }
6171 else {
6172 870 return join '', $ope, $delimiter, $anchor, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6173 }
6174 }
6175  
6176 #
6177 # double quote stuff
6178 #
6179 180 ▶sub qq_stuff {
Subroutine qq_stuff: called CC=6 SCAR=18.5
Pod undocumented
6180 180 my($delimiter,$end_delimiter,$stuff) = @_;
6181  
6182 # scalar variable or array variable
6183 180 ▶ if ($stuff =~ /\A [\$\@] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($stuff =~ /\A [\$\@] /mosx) 100 80 180
6184 100 return $stuff;
6185 }
6186  
6187 # quote by delimiter
6188 80 my %octet = map {$_ => 1} ($stuff =~ /\G ([\x00-\xFF]) /oxmsg);
6189 80 for my $char (qw( ! " $ % & * + - . / : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
6190 80 ▶ next if $char eq $delimiter;
Branch: 1 branch
BranchTrueFalseTotal
if $char eq $delimiter 0 80 80
6191 80 ▶ next if $char eq $end_delimiter;
Branch: 1 branch
BranchTrueFalseTotal
if $char eq $end_delimiter 0 80 80
6192 80 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 80 0 80
6193 80 return join '', 'qq', $char, $stuff, $char;
6194 }
6195 }
6196 0 return join '', 'qq', '<', $stuff, '>';
6197 }
6198  
6199 #
6200 # escape regexp (m'', qr'', and m''b, qr''b)
6201 #
6202 10 ▶sub e_qr_q {
Subroutine e_qr_q: called CC=7 SCAR=25.3
Pod undocumented
6203 10 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6204 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
6205  
6206 10 $modifier =~ tr/p//d;
6207 10 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 10 10
6208 0 my $line = 0;
6209 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6210 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6211 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6212 0 last;
6213 }
6214 }
6215 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6216 }
6217  
6218 10 $slash = 'div';
6219  
6220 # literal null string pattern
6221 10 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 2 10
elsif ($modifier =~ tr/Bb//d) { } 0 2 2
6222 8 $modifier =~ tr/bB//d;
6223 8 $modifier =~ tr/i//d;
6224 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
6225 }
6226  
6227 # with /b /B modifier
6228 elsif ($modifier =~ tr/bB//d) {
6229 0 return e_qr_qb($ope,$delimiter,$end_delimiter,$string,$modifier);
6230 }
6231  
6232 # without /b /B modifier
6233 else {
6234 2 return e_qr_qt($ope,$delimiter,$end_delimiter,$string,$modifier);
6235 }
6236 }
6237  
6238 #
6239 # escape regexp (m'', qr'')
6240 #
6241 2 ▶sub e_qr_qt {
Subroutine e_qr_qt: called CC=20 SCAR=51.8
Pod undocumented
6242 2 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6243  
6244 2 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 2 2
6245  
6246 # split regexp
6247 2 my @char = $string =~ /\G((?>
6248 [^\\\[\$\@\/] |
6249 [\x00-\xFF] |
6250 \[\^ |
6251 \[\: (?>[a-z]+) \:\] |
6252 \[\:\^ (?>[a-z]+) \:\] |
6253 [\$\@\/] |
6254 \\ (?:$q_char) |
6255 (?:$q_char)
6256 ))/oxmsg;
6257  
6258 # unescape character
6259 2 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 2 2 4
6260 2 ▶ if (0) {
Branch: 6 branches
BranchTrueFalseTotal
if (do { $char[$i] eq '[' }) { } 0 2 2
elsif ($char[$i] eq '[^') { } 0 2 2
elsif ($char[$i] =~ m(\A [\$\@/\\] \z)mosx) { } 0 2 2
elsif (my $char = character_class($char[$i], $modifier)) { } 0 2 2
elsif ($ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin3::uc($char[$i]) ne &fc($char[$i])) { } 0 2 2
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 4 4
6261 }
6262  
6263 # open character class [...]
6264 elsif ($char[$i] eq '[') {
6265 0 my $left = $i;
6266 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6267 0 $i++;
6268 }
6269 0 while (1) {
6270 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6271 0 die __FILE__, ": Unmatched [] in regexp\n";
6272 }
6273 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6274 0 my $right = $i;
6275  
6276 # [...]
6277 0 splice @char, $left, $right-$left+1, Elatin3::charlist_qr(@char[$left+1..$right-1], $modifier);
6278  
6279 0 $i = $left;
6280 0 last;
6281 }
6282 }
6283 }
6284  
6285 # open character class [^...]
6286 elsif ($char[$i] eq '[^') {
6287 0 my $left = $i;
6288 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6289 0 $i++;
6290 }
6291 0 while (1) {
6292 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6293 0 die __FILE__, ": Unmatched [] in regexp\n";
6294 }
6295 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6296 0 my $right = $i;
6297  
6298 # [^...]
6299 0 splice @char, $left, $right-$left+1, Elatin3::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6300  
6301 0 $i = $left;
6302 0 last;
6303 }
6304 }
6305 }
6306  
6307 # escape $ @ / and \
6308 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6309 0 $char[$i] = '\\' . $char[$i];
6310 }
6311  
6312 # rewrite character class or escape character
6313 elsif (my $char = character_class($char[$i],$modifier)) {
6314 0 $char[$i] = $char;
6315 }
6316  
6317 # /i modifier
6318 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin3::uc($char[$i]) ne Elatin3::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin3::uc($char[$i]) ne &fc($char[$i])
!ll&&!rl&&r
200
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx
!ll&&!rl&&r
200
MC/DC0%0/3
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin3::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin3::uc($char[$i]) ne &fc($char[$i])
Truth table25%1/4
A and B and C
A= $ignorecaseB= $char[$i] =~ /\A [\x00-\xFF] \z/mosxC= &Elatin3::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6319 0 ▶ if (CORE::length(Elatin3::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
6320 0 $char[$i] = '[' . Elatin3::uc($char[$i]) . Elatin3::fc($char[$i]) . ']';
6321 }
6322 else {
6323 0 $char[$i] = '(?:' . Elatin3::uc($char[$i]) . '|' . Elatin3::fc($char[$i]) . ')';
6324 }
6325 }
6326  
6327 # quote character before ? + * {
6328 ▶ 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
6329 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
6330 }
6331 else {
6332 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6333 }
6334 }
6335 }
6336  
6337 2 $delimiter = '/';
6338 2 $end_delimiter = '/';
6339  
6340 2 $modifier =~ tr/i//d;
6341 2 return join '', $ope, $delimiter, $anchor, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6342 }
6343  
6344 #
6345 # escape regexp (m''b, qr''b)
6346 #
6347 0 ▶sub e_qr_qb {
Subroutine e_qr_qb: not called CC=4 SCAR=30.0
Pod undocumented
6348 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6349  
6350 # split regexp
6351 0 my @char = $string =~ /\G ((?>[^\\]|\\\\)) /oxmsg;
6352  
6353 # unescape character
6354 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
6355 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
6356 }
6357  
6358 # remain \\
6359 elsif ($char[$i] eq '\\\\') {
6360 }
6361  
6362 # escape $ @ / and \
6363 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6364 0 $char[$i] = '\\' . $char[$i];
6365 }
6366 }
6367  
6368 0 $delimiter = '/';
6369 0 $end_delimiter = '/';
6370 0 return join '', $ope, $delimiter, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6371 }
6372  
6373 #
6374 # escape regexp (s/here//)
6375 #
6376 80 ▶sub e_s1 {
Subroutine e_s1: called CC=106 SCAR=81.1
Pod undocumented
6377 80 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6378 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
6379  
6380 80 $modifier =~ tr/p//d;
6381 80 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 80 80
6382 0 my $line = 0;
6383 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6384 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6385 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6386 0 last;
6387 }
6388 }
6389 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6390 }
6391  
6392 80 $slash = 'div';
6393  
6394 # literal null string pattern
6395 80 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 72 80
elsif ($modifier =~ tr/Bb//d) { } 0 72 72
6396 8 $modifier =~ tr/bB//d;
6397 8 $modifier =~ tr/i//d;
6398 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
6399 }
6400  
6401 # /b /B modifier
6402 elsif ($modifier =~ tr/bB//d) {
6403  
6404 # choice again delimiter
6405 0 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 0 0
6406 0 my @char = $string =~ /\G ([\x00-\xFF]) /oxmsg;
6407 0 my %octet = map {$_ => 1} @char;
6408 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
6409 0 $delimiter = '(';
6410 0 $end_delimiter = ')';
6411 }
6412 elsif (not $octet{'}'}) {
6413 0 $delimiter = '{';
6414 0 $end_delimiter = '}';
6415 }
6416 elsif (not $octet{']'}) {
6417 0 $delimiter = '[';
6418 0 $end_delimiter = ']';
6419 }
6420 elsif (not $octet{'>'}) {
6421 0 $delimiter = '<';
6422 0 $end_delimiter = '>';
6423 }
6424 else {
6425 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
6426 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
6427 0 $delimiter = $char;
6428 0 $end_delimiter = $char;
6429 0 last;
6430 }
6431 }
6432 }
6433 }
6434  
6435 0 my $prematch = '';
6436 0 return join '', $ope, $delimiter, $prematch, '(?:', $string, ')', $matched, $end_delimiter, $modifier;
6437 }
6438  
6439 72 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 1 71 72
6440 72 my $metachar = qr/[\@\\|[\]{^]/oxms;
6441  
6442 # split regexp
6443 72 my @char = $string =~ /\G((?>
6444 [^\\\$\@\[\(] |
6445 \\ (?>[1-9][0-9]*) |
6446 \\g (?>\s*) (?>[1-9][0-9]*) |
6447 \\g (?>\s*) \{ (?>\s*) (?>[1-9][0-9]*) (?>\s*) \} |
6448 \\g (?>\s*) \{ (?>\s*) - (?>\s*) (?>[1-9][0-9]*) (?>\s*) \} |
6449 \\x (?>[0-9A-Fa-f]{1,2}) |
6450 \\ (?>[0-7]{2,3}) |
6451 \\c [\x40-\x5F] |
6452 \\x\{ (?>[0-9A-Fa-f]+) \} |
6453 \\o\{ (?>[0-7]+) \} |
6454 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
6455 \\ $q_char |
6456 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
6457 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
6458 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
6459 [\$\@] $qq_variable |
6460 \$ (?>\s* [0-9]+) |
6461 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
6462 \$ \$ (?![\w\{]) |
6463 \$ (?>\s*) \$ (?>\s*) $qq_variable |
6464 \[\^ |
6465 \[\: (?>[a-z]+) :\] |
6466 \[\:\^ (?>[a-z]+) :\] |
6467 \(\? |
6468 $q_char
6469 ))/oxmsg;
6470  
6471 # choice again delimiter
6472 72 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 72 72
6473 0 my %octet = map {$_ => 1} @char;
6474 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
6475 0 $delimiter = '(';
6476 0 $end_delimiter = ')';
6477 }
6478 elsif (not $octet{'}'}) {
6479 0 $delimiter = '{';
6480 0 $end_delimiter = '}';
6481 }
6482 elsif (not $octet{']'}) {
6483 0 $delimiter = '[';
6484 0 $end_delimiter = ']';
6485 }
6486 elsif (not $octet{'>'}) {
6487 0 $delimiter = '<';
6488 0 $end_delimiter = '>';
6489 }
6490 else {
6491 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
6492 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
6493 0 $delimiter = $char;
6494 0 $end_delimiter = $char;
6495 0 last;
6496 }
6497 }
6498 }
6499 }
6500  
6501 # count '('
6502 72 my $parens = grep { $_ eq '(' } @char;
6503  
6504 72 my $left_e = 0;
6505 72 my $right_e = 0;
6506 72 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 200 72 272
6507  
6508 # "\L\u" --> "\u\L"
6509 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
6510 0 @char[$i,$i+1] = @char[$i+1,$i];
6511 }
6512  
6513 # "\U\l" --> "\l\U"
6514 ▶ 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
6515 0 @char[$i,$i+1] = @char[$i+1,$i];
6516 }
6517  
6518 # octal escape sequence
6519 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
6520 1 $char[$i] = Elatin3::octchr($1);
6521 }
6522  
6523 # hexadecimal escape sequence
6524 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
6525 1 $char[$i] = Elatin3::hexchr($1);
6526 }
6527  
6528 # \b{...} --> b\{...}
6529 # \B{...} --> B\{...}
6530 # \N{CHARNAME} --> N\{CHARNAME}
6531 # \p{PROPERTY} --> p\{PROPERTY}
6532 # \P{PROPERTY} --> P\{PROPERTY}
6533 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
6534 0 $char[$i] = $1 . '\\' . $2;
6535 }
6536  
6537 # \p, \P, \X --> p, P, X
6538 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
6539 0 $char[$i] = $1;
6540 }
6541  
6542 200 ▶ if (0) {
Branch: 35 branches
BranchTrueFalseTotal
if (do { $char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx }) { } 0 200 200
elsif ($char[$i] eq '[') { } 17 183 200
elsif ($char[$i] eq '[^') { } 0 183 183
elsif (my $char = character_class($char[$i], $modifier)) { } 7 176 183
elsif ($ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin3::uc($char[$i]) ne &fc($char[$i])) { } 3 173 176
elsif ($char[$i] =~ /\A [<>] \z/mosx) { } 0 173 173
elsif ($char[$i] eq '\\u') { } 0 173 173
elsif ($char[$i] eq '\\l') { } 0 173 173
elsif ($char[$i] eq '\\U') { } 0 173 173
elsif ($char[$i] eq '\\L') { } 0 173 173
elsif ($char[$i] eq '\\F') { } 0 173 173
elsif ($char[$i] eq '\\Q') { } 0 173 173
elsif ($char[$i] eq '\\E') { } 0 173 173
elsif ($char[$i] eq '\\Q') { } 0 173 173
elsif ($char[$i] eq '\\E') { } 0 173 173
elsif ($char[$i] =~ /\A \\ (?>\s*) 0 \z/mosx) { } 0 173 173
elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) - (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/mosx) { } 0 173 173
elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/mosx) { } 0 173 173
elsif ($char[$i] =~ /\A \\g (?>\s*) ((?>[1-9][0-9]*)) \z/mosx) { } 0 173 173
elsif ($char[$i] =~ /\A \\ (?>\s*) ((?>[1-9][0-9]*)) \z/mosx) { } 0 173 173
elsif ($char[$i] =~ /\A \$ 0 \z/mosx) { } 0 173 173
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/mosx) { } 0 173 173
elsif ($char[$i] =~ /\A \$\$ \z/mosx) { } 0 173 173
elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/mosx) { } 0 173 173
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/mosx) { } 0 173 173
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/mosx) { } 0 173 173
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/mosx) { } 0 173 173
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/mosx) { } 0 173 173
elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/cgmosx) { } 4 169 173
elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/cgmosx) { } 4 165 169
elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/cgmosx) { } 3 162 165
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/mosx) { } 0 162 162
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/mosx) { } 0 162 162
elsif ($char[$i] =~ /\A [\$\@].+ /mosx) { } 4 158 162
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 14 204 218
6543 }
6544  
6545 # join separated multiple-octet
6546 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
6547 0 ▶ if ( ($i+3 <= $#char) and (grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms, @char[$i+1..$i+3]) == 3) and (CORE::eval(sprintf '"%s%s%s%s"', @char[$i..$i+3]) =~ /\A $q_char \z/oxms)) {
Branch: 3 branches
BranchTrueFalseTotal
if ($i + 3 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 3]) == 3 and eval(sprintf '"%s%s%s%s"', @char[$i .. $i + 3]) =~ /\A $Elatin3::q_char \z/mosx) { } 0 0 0
elsif ($i + 2 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 2]) == 2 and eval(sprintf '"%s%s%s"', @char[$i .. $i + 2]) =~ /\A $Elatin3::q_char \z/mosx) { } 0 0 0
elsif ($i + 1 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, $char[$i + 1]) == 1 and eval(sprintf '"%s%s"', @char[$i .. $i + 1]) =~ /\A $Elatin3::q_char \z/mosx) { } 0 0 0
Condition0%0/6
$i + 3 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 3]) == 3 and eval(sprintf "\"%s%s%s%s\"", @char[$i .. $i + 3]) =~ /\A $Elatin3::q_char \z/mosx
!ll&&!rl&&r
000
$i + 3 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 3]) == 3
!ll&&!rl&&r
000
MC/DC0%0/3
$i + 3 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 3]) == 3 and eval(sprintf "\"%s%s%s%s\"", @char[$i .. $i + 3]) =~ /\A $Elatin3::q_char \z/mosx
$i + 3 <= $#char grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 3]) == 3 eval(sprintf "\"%s%s%s%s\"", @char[$i .. $i + 3]) =~ /\A $Elatin3::q_char \z/mosx
Truth table0%0/4
A and B and C
A= $i + 3 <= $#charB= grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 3]) == 3C= eval(sprintf "\"%s%s%s%s\"", @char[$i .. $i + 3]) =~ /\A $Elatin3::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6548 0 $char[$i] .= join '', splice @char, $i+1, 3;
6549 }
6550 ▶ elsif (($i+2 <= $#char) and (grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms, @char[$i+1..$i+2]) == 2) and (CORE::eval(sprintf '"%s%s%s"', @char[$i..$i+2]) =~ /\A $q_char \z/oxms)) {
Condition0%0/6
$i + 2 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 2]) == 2 and eval(sprintf "\"%s%s%s\"", @char[$i .. $i + 2]) =~ /\A $Elatin3::q_char \z/mosx
!ll&&!rl&&r
000
$i + 2 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 2]) == 2
!ll&&!rl&&r
000
MC/DC0%0/3
$i + 2 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 2]) == 2 and eval(sprintf "\"%s%s%s\"", @char[$i .. $i + 2]) =~ /\A $Elatin3::q_char \z/mosx
$i + 2 <= $#char grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 2]) == 2 eval(sprintf "\"%s%s%s\"", @char[$i .. $i + 2]) =~ /\A $Elatin3::q_char \z/mosx
Truth table0%0/4
A and B and C
A= $i + 2 <= $#charB= grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 2]) == 2C= eval(sprintf "\"%s%s%s\"", @char[$i .. $i + 2]) =~ /\A $Elatin3::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6551 0 $char[$i] .= join '', splice @char, $i+1, 2;
6552 }
6553 ▶ elsif (($i+1 <= $#char) and (grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms, $char[$i+1 ]) == 1) and (CORE::eval(sprintf '"%s%s"', @char[$i..$i+1]) =~ /\A $q_char \z/oxms)) {
Condition0%0/6
$i + 1 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, $char[$i + 1]) == 1 and eval(sprintf "\"%s%s\"", @char[$i .. $i + 1]) =~ /\A $Elatin3::q_char \z/mosx
!ll&&!rl&&r
000
$i + 1 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, $char[$i + 1]) == 1
!ll&&!rl&&r
000
MC/DC0%0/3
$i + 1 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, $char[$i + 1]) == 1 and eval(sprintf "\"%s%s\"", @char[$i .. $i + 1]) =~ /\A $Elatin3::q_char \z/mosx
$i + 1 <= $#char grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, $char[$i + 1]) == 1 eval(sprintf "\"%s%s\"", @char[$i .. $i + 1]) =~ /\A $Elatin3::q_char \z/mosx
Truth table0%0/4
A and B and C
A= $i + 1 <= $#charB= grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, $char[$i + 1]) == 1C= eval(sprintf "\"%s%s\"", @char[$i .. $i + 1]) =~ /\A $Elatin3::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6554 0 $char[$i] .= join '', splice @char, $i+1, 1;
6555 }
6556 }
6557  
6558 # open character class [...]
6559 elsif ($char[$i] eq '[') {
6560 17 my $left = $i;
6561 17 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 17 17
6562 0 $i++;
6563 }
6564 17 while (1) {
6565 74 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 74 74
6566 0 die __FILE__, ": Unmatched [] in regexp\n";
6567 }
6568 74 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 17 57 74
6569 17 my $right = $i;
6570  
6571 # [...]
6572 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
6573 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin3::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6574 }
6575 else {
6576 17 splice @char, $left, $right-$left+1, Elatin3::charlist_qr(@char[$left+1..$right-1], $modifier);
6577 }
6578  
6579 17 $i = $left;
6580 17 last;
6581 }
6582 }
6583 }
6584  
6585 # open character class [^...]
6586 elsif ($char[$i] eq '[^') {
6587 0 my $left = $i;
6588 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6589 0 $i++;
6590 }
6591 0 while (1) {
6592 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6593 0 die __FILE__, ": Unmatched [] in regexp\n";
6594 }
6595 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6596 0 my $right = $i;
6597  
6598 # [^...]
6599 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
6600 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin3::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6601 }
6602 else {
6603 0 splice @char, $left, $right-$left+1, Elatin3::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6604 }
6605  
6606 0 $i = $left;
6607 0 last;
6608 }
6609 }
6610 }
6611  
6612 # rewrite character class or escape character
6613 elsif (my $char = character_class($char[$i],$modifier)) {
6614 7 $char[$i] = $char;
6615 }
6616  
6617 # /i modifier
6618 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin3::uc($char[$i]) ne Elatin3::fc($char[$i]))) {
Condition66%4/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin3::uc($char[$i]) ne &fc($char[$i])
!ll&&!rl&&r
17303
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx
!ll&&!rl&&r
17303
MC/DC33%1/3
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin3::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin3::uc($char[$i]) ne &fc($char[$i])
Truth table50%2/4
A and B and C
A= $ignorecaseB= $char[$i] =~ /\A [\x00-\xFF] \z/mosxC= &Elatin3::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6619 3 ▶ if (CORE::length(Elatin3::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 3 0 3
6620 3 $char[$i] = '[' . Elatin3::uc($char[$i]) . Elatin3::fc($char[$i]) . ']';
6621 }
6622 else {
6623 0 $char[$i] = '(?:' . Elatin3::uc($char[$i]) . '|' . Elatin3::fc($char[$i]) . ')';
6624 }
6625 }
6626  
6627 # \u \l \U \L \F \Q \E
6628 elsif ($char[$i] =~ /\A [<>] \z/oxms) {
6629 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
6630 0 $char[$i] = '\\' . $char[$i];
6631 }
6632 }
6633 elsif ($char[$i] eq '\u') {
6634 0 $char[$i] = '@{[Elatin3::ucfirst qq<';
6635 0 $left_e++;
6636 }
6637 elsif ($char[$i] eq '\l') {
6638 0 $char[$i] = '@{[Elatin3::lcfirst qq<';
6639 0 $left_e++;
6640 }
6641 elsif ($char[$i] eq '\U') {
6642 0 $char[$i] = '@{[Elatin3::uc qq<';
6643 0 $left_e++;
6644 }
6645 elsif ($char[$i] eq '\L') {
6646 0 $char[$i] = '@{[Elatin3::lc qq<';
6647 0 $left_e++;
6648 }
6649 elsif ($char[$i] eq '\F') {
6650 0 $char[$i] = '@{[Elatin3::fc qq<';
6651 0 $left_e++;
6652 }
6653 elsif ($char[$i] eq '\Q') {
6654 0 $char[$i] = '@{[CORE::quotemeta qq<';
6655 0 $left_e++;
6656 }
6657 elsif ($char[$i] eq '\E') {
6658 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
6659 0 $char[$i] = '>]}';
6660 0 $right_e++;
6661 }
6662 else {
6663 0 $char[$i] = '';
6664 }
6665 }
6666 elsif ($char[$i] eq '\Q') {
6667 0 while (1) {
6668 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6669 0 last;
6670 }
6671 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
6672 0 last;
6673 }
6674 }
6675 }
6676 elsif ($char[$i] eq '\E') {
6677 }
6678  
6679 # \0 --> \0
6680 elsif ($char[$i] =~ /\A \\ (?>\s*) 0 \z/oxms) {
6681 }
6682  
6683 # \g{N}, \g{-N}
6684  
6685 # P.108 Using Simple Patterns
6686 # in Chapter 7: In the World of Regular Expressions
6687 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
6688  
6689 # P.221 Capturing
6690 # in Chapter 5: Pattern Matching
6691 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
6692  
6693 # \g{-1}, \g{-2}, \g{-3} --> \g{-1}, \g{-2}, \g{-3}
6694 elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) - (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6695 }
6696  
6697 # \g{1}, \g{2}, \g{3} --> \g{2}, \g{3}, \g{4} (only when multibyte anchoring is enable)
6698 elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6699 }
6700  
6701 # \g1, \g2, \g3 --> \g2, \g3, \g4 (only when multibyte anchoring is enable)
6702 elsif ($char[$i] =~ /\A \\g (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) {
6703 }
6704  
6705 # \1, \2, \3 --> \2, \3, \4 (only when multibyte anchoring is enable)
6706 elsif ($char[$i] =~ /\A \\ (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) {
6707 }
6708  
6709 # $0 --> $0
6710 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
6711 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6712 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
6713 }
6714 }
6715 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
6716 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6717 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
6718 }
6719 }
6720  
6721 # $$ --> $$
6722 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
6723 }
6724  
6725 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
6726 # $1, $2, $3 --> $1, $2, $3 otherwise
6727 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
6728 0 $char[$i] = e_capture($1);
6729 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6730 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
6731 }
6732 }
6733 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \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] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
6737 }
6738 }
6739  
6740 # $$foo[ ... ] --> $ $foo->[ ... ]
6741 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
6742 0 $char[$i] = e_capture($1.'->'.$2);
6743 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6744 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
6745 }
6746 }
6747  
6748 # $$foo{ ... } --> $ $foo->{ ... }
6749 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
6750 0 $char[$i] = e_capture($1.'->'.$2);
6751 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6752 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
6753 }
6754 }
6755  
6756 # $$foo
6757 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
6758 0 $char[$i] = e_capture($1);
6759 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6760 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
6761 }
6762 }
6763  
6764 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin3::PREMATCH()
6765 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
6766 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 4 4
6767 0 $char[$i] = '@{[Elatin3::ignorecase(Elatin3::PREMATCH())]}';
6768 }
6769 else {
6770 4 $char[$i] = '@{[Elatin3::PREMATCH()]}';
6771 }
6772 }
6773  
6774 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin3::MATCH()
6775 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
6776 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 4 4
6777 0 $char[$i] = '@{[Elatin3::ignorecase(Elatin3::MATCH())]}';
6778 }
6779 else {
6780 4 $char[$i] = '@{[Elatin3::MATCH()]}';
6781 }
6782 }
6783  
6784 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin3::POSTMATCH()
6785 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
6786 3 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 3 3
6787 0 $char[$i] = '@{[Elatin3::ignorecase(Elatin3::POSTMATCH())]}';
6788 }
6789 else {
6790 3 $char[$i] = '@{[Elatin3::POSTMATCH()]}';
6791 }
6792 }
6793  
6794 # ${ foo }
6795 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
6796 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6797 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
6798 }
6799 }
6800  
6801 # ${ ... }
6802 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
6803 0 $char[$i] = e_capture($1);
6804 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6805 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
6806 }
6807 }
6808  
6809 # $scalar or @array
6810 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
6811 4 $char[$i] = e_string($char[$i]);
6812 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 4 4
6813 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
6814 }
6815 }
6816  
6817 # quote character before ? + * {
6818 ▶ 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
6819 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
6820 }
6821 else {
6822 14 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6823 }
6824 }
6825 }
6826  
6827 # make regexp string
6828 72 my $prematch = '';
6829 72 $modifier =~ tr/i//d;
6830 72 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 72 72
6831 0 return join '', $ope, $delimiter, $prematch, '(?:', @char, '>]}' x ($left_e - $right_e), ')', $matched, $end_delimiter, $modifier;
6832 }
6833 72 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6834 }
6835  
6836 #
6837 # escape regexp (s'here'' or s'here''b)
6838 #
6839 21 ▶sub e_s1_q {
Subroutine e_s1_q: called CC=7 SCAR=24.3
Pod undocumented
6840 21 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6841 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
6842  
6843 21 $modifier =~ tr/p//d;
6844 21 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 21 21
6845 0 my $line = 0;
6846 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6847 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6848 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6849 0 last;
6850 }
6851 }
6852 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6853 }
6854  
6855 21 $slash = 'div';
6856  
6857 # literal null string pattern
6858 21 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 13 21
elsif ($modifier =~ tr/Bb//d) { } 0 13 13
6859 8 $modifier =~ tr/bB//d;
6860 8 $modifier =~ tr/i//d;
6861 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
6862 }
6863  
6864 # with /b /B modifier
6865 elsif ($modifier =~ tr/bB//d) {
6866 0 return e_s1_qb($ope,$delimiter,$end_delimiter,$string,$modifier);
6867 }
6868  
6869 # without /b /B modifier
6870 else {
6871 13 return e_s1_qt($ope,$delimiter,$end_delimiter,$string,$modifier);
6872 }
6873 }
6874  
6875 #
6876 # escape regexp (s'here'')
6877 #
6878 13 ▶sub e_s1_qt {
Subroutine e_s1_qt: called CC=20 SCAR=50.1
Pod undocumented
6879 13 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6880  
6881 13 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 13 13
6882  
6883 # split regexp
6884 13 my @char = $string =~ /\G((?>
6885 [^\\\[\$\@\/] |
6886 [\x00-\xFF] |
6887 \[\^ |
6888 \[\: (?>[a-z]+) \:\] |
6889 \[\:\^ (?>[a-z]+) \:\] |
6890 [\$\@\/] |
6891 \\ (?:$q_char) |
6892 (?:$q_char)
6893 ))/oxmsg;
6894  
6895 # unescape character
6896 13 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 25 13 38
6897 25 ▶ if (0) {
Branch: 6 branches
BranchTrueFalseTotal
if (do { $char[$i] eq '[' }) { } 0 25 25
elsif ($char[$i] eq '[^') { } 0 25 25
elsif ($char[$i] =~ m(\A [\$\@/\\] \z)mosx) { } 0 25 25
elsif (my $char = character_class($char[$i], $modifier)) { } 6 19 25
elsif ($ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin3::uc($char[$i]) ne &fc($char[$i])) { } 0 19 19
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 32 32
6898 }
6899  
6900 # open character class [...]
6901 elsif ($char[$i] eq '[') {
6902 0 my $left = $i;
6903 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6904 0 $i++;
6905 }
6906 0 while (1) {
6907 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6908 0 die __FILE__, ": Unmatched [] in regexp\n";
6909 }
6910 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6911 0 my $right = $i;
6912  
6913 # [...]
6914 0 splice @char, $left, $right-$left+1, Elatin3::charlist_qr(@char[$left+1..$right-1], $modifier);
6915  
6916 0 $i = $left;
6917 0 last;
6918 }
6919 }
6920 }
6921  
6922 # open character class [^...]
6923 elsif ($char[$i] eq '[^') {
6924 0 my $left = $i;
6925 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6926 0 $i++;
6927 }
6928 0 while (1) {
6929 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6930 0 die __FILE__, ": Unmatched [] in regexp\n";
6931 }
6932 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6933 0 my $right = $i;
6934  
6935 # [^...]
6936 0 splice @char, $left, $right-$left+1, Elatin3::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6937  
6938 0 $i = $left;
6939 0 last;
6940 }
6941 }
6942 }
6943  
6944 # escape $ @ / and \
6945 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6946 0 $char[$i] = '\\' . $char[$i];
6947 }
6948  
6949 # rewrite character class or escape character
6950 elsif (my $char = character_class($char[$i],$modifier)) {
6951 6 $char[$i] = $char;
6952 }
6953  
6954 # /i modifier
6955 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin3::uc($char[$i]) ne Elatin3::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin3::uc($char[$i]) ne &fc($char[$i])
!ll&&!rl&&r
1900
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx
!ll&&!rl&&r
1900
MC/DC0%0/3
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin3::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin3::uc($char[$i]) ne &fc($char[$i])
Truth table25%1/4
A and B and C
A= $ignorecaseB= $char[$i] =~ /\A [\x00-\xFF] \z/mosxC= &Elatin3::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6956 0 ▶ if (CORE::length(Elatin3::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
6957 0 $char[$i] = '[' . Elatin3::uc($char[$i]) . Elatin3::fc($char[$i]) . ']';
6958 }
6959 else {
6960 0 $char[$i] = '(?:' . Elatin3::uc($char[$i]) . '|' . Elatin3::fc($char[$i]) . ')';
6961 }
6962 }
6963  
6964 # quote character before ? + * {
6965 ▶ 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
6966 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
6967 }
6968 else {
6969 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6970 }
6971 }
6972 }
6973  
6974 13 $modifier =~ tr/i//d;
6975 13 $delimiter = '/';
6976 13 $end_delimiter = '/';
6977 13 my $prematch = '';
6978 13 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6979 }
6980  
6981 #
6982 # escape regexp (s'here''b)
6983 #
6984 0 ▶sub e_s1_qb {
Subroutine e_s1_qb: not called CC=4 SCAR=30.0
Pod undocumented
6985 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6986  
6987 # split regexp
6988 0 my @char = $string =~ /\G (?>[^\\]|\\\\) /oxmsg;
6989  
6990 # unescape character
6991 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
6992 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
6993 }
6994  
6995 # remain \\
6996 elsif ($char[$i] eq '\\\\') {
6997 }
6998  
6999 # escape $ @ / and \
7000 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
7001 0 $char[$i] = '\\' . $char[$i];
7002 }
7003 }
7004  
7005 0 $delimiter = '/';
7006 0 $end_delimiter = '/';
7007 0 my $prematch = '';
7008 0 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
7009 }
7010  
7011 #
7012 # escape regexp (s''here')
7013 #
7014 16 ▶sub e_s2_q {
Subroutine e_s2_q: called CC=4 SCAR=13.9
Pod undocumented
7015 16 my($ope,$delimiter,$end_delimiter,$string) = @_;
7016  
7017 16 $slash = 'div';
7018  
7019 16 my @char = $string =~ / \G (?>[^\\]|\\\\|$q_char) /oxmsg;
7020 16 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 9 16 25
7021 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
7022 }
7023  
7024 # not escape \\
7025 elsif ($char[$i] =~ /\A \\\\ \z/oxms) {
7026 }
7027  
7028 # escape $ @ / and \
7029 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
7030 5 $char[$i] = '\\' . $char[$i];
7031 }
7032 }
7033  
7034 16 return join '', $ope, $delimiter, @char, $end_delimiter;
7035 }
7036  
7037 #
7038 # escape regexp (s/here/and here/modifier)
7039 #
7040 101 ▶sub e_sub {
Subroutine e_sub: called CC=20 SCAR=32.6
Pod undocumented
7041 101 my($variable,$delimiter1,$pattern,$end_delimiter1,$delimiter2,$replacement,$end_delimiter2,$modifier) = @_;
7042 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
7043  
7044 101 $modifier =~ tr/p//d;
7045 101 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 101 101
7046 0 my $line = 0;
7047 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7048 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
7049 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
7050 0 last;
7051 }
7052 }
7053 0 die qq{Unsupported modifier "$1" used at line $line.\n};
7054 }
7055  
7056 101 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq "") 36 65 101
7057 36 $variable = '$_';
7058 36 $bind_operator = ' =~ ';
7059 }
7060  
7061 101 $slash = 'div';
7062  
7063 # P.128 Start of match (or end of previous match): \G
7064 # P.130 Advanced Use of \G with Perl
7065 # in Chapter 3: Overview of Regular Expression Features and Flavors
7066 # P.312 Iterative Matching: Scalar Context, with /g
7067 # in Chapter 7: Perl
7068 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
7069  
7070 # P.181 Where You Left Off: The \G Assertion
7071 # in Chapter 5: Pattern Matching
7072 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
7073  
7074 # P.220 Where You Left Off: The \G Assertion
7075 # in Chapter 5: Pattern Matching
7076 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
7077  
7078 101 my $e_modifier = $modifier =~ tr/e//d;
7079 101 my $r_modifier = $modifier =~ tr/r//d;
7080  
7081 101 my $my = '';
7082 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
7083 0 $my = $variable;
7084 0 $variable =~ s/ (?: local \b | my \b | our \b | state \b ) (?>\s*) //oxms;
7085 0 $variable =~ s/ = .+ \z//oxms;
7086 }
7087  
7088 101 (my $variable_basename = $variable) =~ s/ [\[\{].* \z//oxms;
7089 101 $variable_basename =~ s/ \s+ \z//oxms;
7090  
7091 # quote replacement string
7092 101 my $e_replacement = '';
7093 101 ▶ if ($e_modifier >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($e_modifier >= 1) { } 17 84 101
7094 17 $e_replacement = e_qq('', '', '', $replacement);
7095 17 $e_modifier--;
7096 }
7097 else {
7098 84 ▶ if ($delimiter2 eq "'") {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter2 eq q[']) { } 16 68 84
7099 16 $e_replacement = e_s2_q('qq', '/', '/', $replacement);
7100 }
7101 else {
7102 68 $e_replacement = e_qq ('qq', $delimiter2, $end_delimiter2, $replacement);
7103 }
7104 }
7105  
7106 101 my $sub = '';
7107  
7108 # with /r
7109 101 ▶ if ($r_modifier) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r_modifier) { } 10 91 101
7110 10 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $modifier =~ /g/mosx }) { } 5 5 10
7111 }
7112  
7113 # s///gr without multibyte anchoring
7114 elsif ($modifier =~ /g/oxms) {
7115 5 ▶ $sub = sprintf(
Branch: 1 branch
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 0 5 5
7116 # 1 2 3 4 5
7117 q<CORE::eval{local $Elatin3::re_t=%s; while($Elatin3::re_t =~ %s){%s local $^W=0; local $Elatin3::re_r=%s; %s$Elatin3::re_t="$`$Elatin3::re_r$'"; pos($Elatin3::re_t)=length "$`$Elatin3::re_r"; } return $Elatin3::re_t}>,
7118  
7119 $variable, # 1
7120 ($delimiter1 eq "'") ? # 2
7121 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
7122 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
7123 $s_matched, # 3
7124 $e_replacement, # 4
7125 '$Elatin3::re_r=CORE::eval $Elatin3::re_r; ' x $e_modifier, # 5
7126 );
7127 }
7128  
7129 # s///r
7130 else {
7131  
7132 5 my $prematch = q{$`};
7133  
7134 5 ▶ $sub = sprintf(
Branch: 1 branch
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 0 5 5
7135 # 1 2 3 4 5 6 7
7136 q<(%s =~ %s) ? CORE::eval{%s local $^W=0; local $Elatin3::re_r=%s; %s"%s$Elatin3::re_r$'" } : %s>,
7137  
7138 $variable, # 1
7139 ($delimiter1 eq "'") ? # 2
7140 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
7141 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
7142 $s_matched, # 3
7143 $e_replacement, # 4
7144 '$Elatin3::re_r=CORE::eval $Elatin3::re_r; ' x $e_modifier, # 5
7145 $prematch, # 6
7146 $variable, # 7
7147 );
7148 }
7149  
7150 # $var !~ s///r doesn't make sense
7151 10 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) 0 10 10
7152 0 $sub = q{die("$0: Using !~ with s///r doesn't make sense"), } . $sub;
7153 }
7154 }
7155  
7156 # without /r
7157 else {
7158 91 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $modifier =~ /g/mosx }) { } 23 68 91
7159 }
7160  
7161 # s///g without multibyte anchoring
7162 elsif ($modifier =~ /g/oxms) {
7163 23 ▶ $sub = sprintf(
Branch: 2 branches
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 3 20 23
$bind_operator =~ / !~ /mosx ? : 3 20 23
7164 # 1 2 3 4 5 6 7 8
7165 q<CORE::eval{local $Elatin3::re_n=0; while(%s =~ %s){%s local $^W=0; local $Elatin3::re_r=%s; %s%s="$`$Elatin3::re_r$'"; pos(%s)=length "$`$Elatin3::re_r"; $Elatin3::re_n++} return %s$Elatin3::re_n}>,
7166  
7167 $variable, # 1
7168 ($delimiter1 eq "'") ? # 2
7169 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
7170 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
7171 $s_matched, # 3
7172 $e_replacement, # 4
7173 '$Elatin3::re_r=CORE::eval $Elatin3::re_r; ' x $e_modifier, # 5
7174 $variable, # 6
7175 $variable, # 7
7176 ($bind_operator =~ / !~ /oxms) ? '!' : '', # 8
7177 );
7178 }
7179  
7180 # s///
7181 else {
7182  
7183 68 my $prematch = q{$`};
7184  
7185 68 ▶ $sub = sprintf(
Branch: 2 branches
BranchTrueFalseTotal
$bind_operator =~ / =~ /mosx ? : 65 3 68
$delimiter1 eq q['] ? : 18 50 68
7186  
7187 ($bind_operator =~ / =~ /oxms) ?
7188  
7189 # 1 2 3 4 5 6 7 8
7190 q<(%s%s%s) ? CORE::eval{%s local $^W=0; local $Elatin3::re_r=%s; %s%s="%s$Elatin3::re_r$'"; 1 } : undef> :
7191  
7192 # 1 2 3 4 5 6 7 8
7193 q<(%s%s%s) ? 1 : CORE::eval{%s local $^W=0; local $Elatin3::re_r=%s; %s%s="%s$Elatin3::re_r$'"; undef }>,
7194  
7195 $variable, # 1
7196 $bind_operator, # 2
7197 ($delimiter1 eq "'") ? # 3
7198 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
7199 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
7200 $s_matched, # 4
7201 $e_replacement, # 5
7202 '$Elatin3::re_r=CORE::eval $Elatin3::re_r; ' x $e_modifier, # 6
7203 $variable, # 7
7204 $prematch, # 8
7205 );
7206 }
7207 }
7208  
7209 # (my $foo = $bar) =~ s/// --> (my $foo = $bar, CORE::eval { ... })[1]
7210 101 ▶ if ($my ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($my ne "") 0 101 101
7211 0 $sub = "($my, $sub)[1]";
7212 }
7213  
7214 # clear s/// variable
7215 101 $sub_variable = '';
7216 101 $bind_operator = '';
7217  
7218 101 return $sub;
7219 }
7220  
7221 #
7222 # escape regexp of split qr//
7223 #
7224 74 ▶sub e_split {
Subroutine e_split: called CC=88 SCAR=76.4
Pod undocumented
7225 74 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
7226 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
7227  
7228 74 $modifier =~ tr/p//d;
7229 74 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 74 74
7230 0 my $line = 0;
7231 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7232 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
7233 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
7234 0 last;
7235 }
7236 }
7237 0 die qq{Unsupported modifier "$1" used at line $line.\n};
7238 }
7239  
7240 74 $slash = 'div';
7241  
7242 # /b /B modifier
7243 74 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) 0 74 74
7244 0 return join '', 'split', $ope, $delimiter, $string, $end_delimiter, $modifier;
7245 }
7246  
7247 74 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 74 74
7248 74 my $metachar = qr/[\@\\|[\]{^]/oxms;
7249  
7250 # split regexp
7251 74 my @char = $string =~ /\G((?>
7252 [^\\\$\@\[\(] |
7253 \\x (?>[0-9A-Fa-f]{1,2}) |
7254 \\ (?>[0-7]{2,3}) |
7255 \\c [\x40-\x5F] |
7256 \\x\{ (?>[0-9A-Fa-f]+) \} |
7257 \\o\{ (?>[0-7]+) \} |
7258 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
7259 \\ $q_char |
7260 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
7261 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
7262 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
7263 [\$\@] $qq_variable |
7264 \$ (?>\s* [0-9]+) |
7265 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
7266 \$ \$ (?![\w\{]) |
7267 \$ (?>\s*) \$ (?>\s*) $qq_variable |
7268 \[\^ |
7269 \[\: (?>[a-z]+) :\] |
7270 \[\:\^ (?>[a-z]+) :\] |
7271 \(\? |
7272 $q_char
7273 ))/oxmsg;
7274  
7275 74 my $left_e = 0;
7276 74 my $right_e = 0;
7277 74 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 249 74 323
7278  
7279 # "\L\u" --> "\u\L"
7280 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
7281 0 @char[$i,$i+1] = @char[$i+1,$i];
7282 }
7283  
7284 # "\U\l" --> "\l\U"
7285 ▶ 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
7286 0 @char[$i,$i+1] = @char[$i+1,$i];
7287 }
7288  
7289 # octal escape sequence
7290 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
7291 1 $char[$i] = Elatin3::octchr($1);
7292 }
7293  
7294 # hexadecimal escape sequence
7295 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
7296 1 $char[$i] = Elatin3::hexchr($1);
7297 }
7298  
7299 # \b{...} --> b\{...}
7300 # \B{...} --> B\{...}
7301 # \N{CHARNAME} --> N\{CHARNAME}
7302 # \p{PROPERTY} --> p\{PROPERTY}
7303 # \P{PROPERTY} --> P\{PROPERTY}
7304 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
7305 0 $char[$i] = $1 . '\\' . $2;
7306 }
7307  
7308 # \p, \P, \X --> p, P, X
7309 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
7310 0 $char[$i] = $1;
7311 }
7312  
7313 249 ▶ if (0) {
Branch: 31 branches
BranchTrueFalseTotal
if (do { $char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx }) { } 0 249 249
elsif ($char[$i] eq '[') { } 3 246 249
elsif ($char[$i] eq '[^') { } 0 246 246
elsif (my $char = character_class($char[$i], $modifier)) { } 1 245 246
elsif ($char[$i] eq '^' and not $modifier =~ /m/mosx) { } 7 238 245
elsif ($ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin3::uc($char[$i]) ne &fc($char[$i])) { } 0 238 238
elsif ($char[$i] =~ /\A ([<>]) \z/mosx) { } 0 238 238
elsif ($char[$i] eq '\\u') { } 0 238 238
elsif ($char[$i] eq '\\l') { } 0 238 238
elsif ($char[$i] eq '\\U') { } 0 238 238
elsif ($char[$i] eq '\\L') { } 0 238 238
elsif ($char[$i] eq '\\F') { } 0 238 238
elsif ($char[$i] eq '\\Q') { } 0 238 238
elsif ($char[$i] eq '\\E') { } 0 238 238
elsif ($char[$i] eq '\\Q') { } 0 238 238
elsif ($char[$i] eq '\\E') { } 0 238 238
elsif ($char[$i] =~ /\A \$ 0 \z/mosx) { } 0 238 238
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/mosx) { } 0 238 238
elsif ($char[$i] =~ /\A \$\$ \z/mosx) { } 0 238 238
elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/mosx) { } 0 238 238
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/mosx) { } 0 238 238
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/mosx) { } 0 238 238
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/mosx) { } 0 238 238
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/mosx) { } 0 238 238
elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/cgmosx) { } 12 226 238
elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/cgmosx) { } 12 214 226
elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/cgmosx) { } 9 205 214
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/mosx) { } 0 205 205
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/mosx) { } 0 205 205
elsif ($char[$i] =~ /\A [\$\@].+ /mosx) { } 3 202 205
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 1 234 235
7314 }
7315  
7316 # join separated multiple-octet
7317 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
7318 0 ▶ if ( ($i+3 <= $#char) and (grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms, @char[$i+1..$i+3]) == 3) and (CORE::eval(sprintf '"%s%s%s%s"', @char[$i..$i+3]) =~ /\A $q_char \z/oxms)) {
Branch: 3 branches
BranchTrueFalseTotal
if ($i + 3 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 3]) == 3 and eval(sprintf '"%s%s%s%s"', @char[$i .. $i + 3]) =~ /\A $Elatin3::q_char \z/mosx) { } 0 0 0
elsif ($i + 2 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 2]) == 2 and eval(sprintf '"%s%s%s"', @char[$i .. $i + 2]) =~ /\A $Elatin3::q_char \z/mosx) { } 0 0 0
elsif ($i + 1 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, $char[$i + 1]) == 1 and eval(sprintf '"%s%s"', @char[$i .. $i + 1]) =~ /\A $Elatin3::q_char \z/mosx) { } 0 0 0
Condition0%0/6
$i + 3 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 3]) == 3 and eval(sprintf "\"%s%s%s%s\"", @char[$i .. $i + 3]) =~ /\A $Elatin3::q_char \z/mosx
!ll&&!rl&&r
000
$i + 3 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 3]) == 3
!ll&&!rl&&r
000
MC/DC0%0/3
$i + 3 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 3]) == 3 and eval(sprintf "\"%s%s%s%s\"", @char[$i .. $i + 3]) =~ /\A $Elatin3::q_char \z/mosx
$i + 3 <= $#char grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 3]) == 3 eval(sprintf "\"%s%s%s%s\"", @char[$i .. $i + 3]) =~ /\A $Elatin3::q_char \z/mosx
Truth table0%0/4
A and B and C
A= $i + 3 <= $#charB= grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 3]) == 3C= eval(sprintf "\"%s%s%s%s\"", @char[$i .. $i + 3]) =~ /\A $Elatin3::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
7319 0 $char[$i] .= join '', splice @char, $i+1, 3;
7320 }
7321 ▶ elsif (($i+2 <= $#char) and (grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms, @char[$i+1..$i+2]) == 2) and (CORE::eval(sprintf '"%s%s%s"', @char[$i..$i+2]) =~ /\A $q_char \z/oxms)) {
Condition0%0/6
$i + 2 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 2]) == 2 and eval(sprintf "\"%s%s%s\"", @char[$i .. $i + 2]) =~ /\A $Elatin3::q_char \z/mosx
!ll&&!rl&&r
000
$i + 2 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 2]) == 2
!ll&&!rl&&r
000
MC/DC0%0/3
$i + 2 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 2]) == 2 and eval(sprintf "\"%s%s%s\"", @char[$i .. $i + 2]) =~ /\A $Elatin3::q_char \z/mosx
$i + 2 <= $#char grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 2]) == 2 eval(sprintf "\"%s%s%s\"", @char[$i .. $i + 2]) =~ /\A $Elatin3::q_char \z/mosx
Truth table0%0/4
A and B and C
A= $i + 2 <= $#charB= grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, @char[$i + 1 .. $i + 2]) == 2C= eval(sprintf "\"%s%s%s\"", @char[$i .. $i + 2]) =~ /\A $Elatin3::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
7322 0 $char[$i] .= join '', splice @char, $i+1, 2;
7323 }
7324 ▶ elsif (($i+1 <= $#char) and (grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms, $char[$i+1 ]) == 1) and (CORE::eval(sprintf '"%s%s"', @char[$i..$i+1]) =~ /\A $q_char \z/oxms)) {
Condition0%0/6
$i + 1 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, $char[$i + 1]) == 1 and eval(sprintf "\"%s%s\"", @char[$i .. $i + 1]) =~ /\A $Elatin3::q_char \z/mosx
!ll&&!rl&&r
000
$i + 1 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, $char[$i + 1]) == 1
!ll&&!rl&&r
000
MC/DC0%0/3
$i + 1 <= $#char and grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, $char[$i + 1]) == 1 and eval(sprintf "\"%s%s\"", @char[$i .. $i + 1]) =~ /\A $Elatin3::q_char \z/mosx
$i + 1 <= $#char grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, $char[$i + 1]) == 1 eval(sprintf "\"%s%s\"", @char[$i .. $i + 1]) =~ /\A $Elatin3::q_char \z/mosx
Truth table0%0/4
A and B and C
A= $i + 1 <= $#charB= grep(/\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/mosx, $char[$i + 1]) == 1C= eval(sprintf "\"%s%s\"", @char[$i .. $i + 1]) =~ /\A $Elatin3::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
7325 0 $char[$i] .= join '', splice @char, $i+1, 1;
7326 }
7327 }
7328  
7329 # open character class [...]
7330 elsif ($char[$i] eq '[') {
7331 3 my $left = $i;
7332 3 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 3 3
7333 0 $i++;
7334 }
7335 3 while (1) {
7336 7 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 7 7
7337 0 die __FILE__, ": Unmatched [] in regexp\n";
7338 }
7339 7 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 3 4 7
7340 3 my $right = $i;
7341  
7342 # [...]
7343 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
7344 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin3::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
7345 }
7346 else {
7347 3 splice @char, $left, $right-$left+1, Elatin3::charlist_qr(@char[$left+1..$right-1], $modifier);
7348 }
7349  
7350 3 $i = $left;
7351 3 last;
7352 }
7353 }
7354 }
7355  
7356 # open character class [^...]
7357 elsif ($char[$i] eq '[^') {
7358 0 my $left = $i;
7359 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7360 0 $i++;
7361 }
7362 0 while (1) {
7363 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7364 0 die __FILE__, ": Unmatched [] in regexp\n";
7365 }
7366 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7367 0 my $right = $i;
7368  
7369 # [^...]
7370 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
7371 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin3::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
7372 }
7373 else {
7374 0 splice @char, $left, $right-$left+1, Elatin3::charlist_not_qr(@char[$left+1..$right-1], $modifier);
7375 }
7376  
7377 0 $i = $left;
7378 0 last;
7379 }
7380 }
7381 }
7382  
7383 # rewrite character class or escape character
7384 elsif (my $char = character_class($char[$i],$modifier)) {
7385 1 $char[$i] = $char;
7386 }
7387  
7388 # P.794 29.2.161. split
7389 # in Chapter 29: Functions
7390 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
7391  
7392 # P.951 split
7393 # in Chapter 27: Functions
7394 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
7395  
7396 # said "The //m modifier is assumed when you split on the pattern /^/",
7397 # but perl5.008 is not so. Therefore, this software adds //m.
7398 # (and so on)
7399  
7400 # split(m/^/) --> split(m/^/m)
7401 ▶ 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
7402 7 $modifier .= 'm';
7403 }
7404  
7405 # /i modifier
7406 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin3::uc($char[$i]) ne Elatin3::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin3::uc($char[$i]) ne &fc($char[$i])
!ll&&!rl&&r
23800
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx
!ll&&!rl&&r
23800
MC/DC0%0/3
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin3::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin3::uc($char[$i]) ne &fc($char[$i])
Truth table25%1/4
A and B and C
A= $ignorecaseB= $char[$i] =~ /\A [\x00-\xFF] \z/mosxC= &Elatin3::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
7407 0 ▶ if (CORE::length(Elatin3::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
7408 0 $char[$i] = '[' . Elatin3::uc($char[$i]) . Elatin3::fc($char[$i]) . ']';
7409 }
7410 else {
7411 0 $char[$i] = '(?:' . Elatin3::uc($char[$i]) . '|' . Elatin3::fc($char[$i]) . ')';
7412 }
7413 }
7414  
7415 # \u \l \U \L \F \Q \E
7416 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
7417 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
7418 0 $char[$i] = '\\' . $char[$i];
7419 }
7420 }
7421 elsif ($char[$i] eq '\u') {
7422 0 $char[$i] = '@{[Elatin3::ucfirst qq<';
7423 0 $left_e++;
7424 }
7425 elsif ($char[$i] eq '\l') {
7426 0 $char[$i] = '@{[Elatin3::lcfirst qq<';
7427 0 $left_e++;
7428 }
7429 elsif ($char[$i] eq '\U') {
7430 0 $char[$i] = '@{[Elatin3::uc qq<';
7431 0 $left_e++;
7432 }
7433 elsif ($char[$i] eq '\L') {
7434 0 $char[$i] = '@{[Elatin3::lc qq<';
7435 0 $left_e++;
7436 }
7437 elsif ($char[$i] eq '\F') {
7438 0 $char[$i] = '@{[Elatin3::fc qq<';
7439 0 $left_e++;
7440 }
7441 elsif ($char[$i] eq '\Q') {
7442 0 $char[$i] = '@{[CORE::quotemeta qq<';
7443 0 $left_e++;
7444 }
7445 elsif ($char[$i] eq '\E') {
7446 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
7447 0 $char[$i] = '>]}';
7448 0 $right_e++;
7449 }
7450 else {
7451 0 $char[$i] = '';
7452 }
7453 }
7454 elsif ($char[$i] eq '\Q') {
7455 0 while (1) {
7456 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7457 0 last;
7458 }
7459 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
7460 0 last;
7461 }
7462 }
7463 }
7464 elsif ($char[$i] eq '\E') {
7465 }
7466  
7467 # $0 --> $0
7468 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
7469 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7470 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
7471 }
7472 }
7473 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
7474 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7475 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
7476 }
7477 }
7478  
7479 # $$ --> $$
7480 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
7481 }
7482  
7483 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
7484 # $1, $2, $3 --> $1, $2, $3 otherwise
7485 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
7486 0 $char[$i] = e_capture($1);
7487 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7488 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
7489 }
7490 }
7491 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \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] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
7495 }
7496 }
7497  
7498 # $$foo[ ... ] --> $ $foo->[ ... ]
7499 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
7500 0 $char[$i] = e_capture($1.'->'.$2);
7501 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7502 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
7503 }
7504 }
7505  
7506 # $$foo{ ... } --> $ $foo->{ ... }
7507 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
7508 0 $char[$i] = e_capture($1.'->'.$2);
7509 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7510 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
7511 }
7512 }
7513  
7514 # $$foo
7515 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
7516 0 $char[$i] = e_capture($1);
7517 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7518 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
7519 }
7520 }
7521  
7522 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin3::PREMATCH()
7523 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
7524 12 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 12 12
7525 0 $char[$i] = '@{[Elatin3::ignorecase(Elatin3::PREMATCH())]}';
7526 }
7527 else {
7528 12 $char[$i] = '@{[Elatin3::PREMATCH()]}';
7529 }
7530 }
7531  
7532 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin3::MATCH()
7533 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
7534 12 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 12 12
7535 0 $char[$i] = '@{[Elatin3::ignorecase(Elatin3::MATCH())]}';
7536 }
7537 else {
7538 12 $char[$i] = '@{[Elatin3::MATCH()]}';
7539 }
7540 }
7541  
7542 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin3::POSTMATCH()
7543 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
7544 9 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 9 9
7545 0 $char[$i] = '@{[Elatin3::ignorecase(Elatin3::POSTMATCH())]}';
7546 }
7547 else {
7548 9 $char[$i] = '@{[Elatin3::POSTMATCH()]}';
7549 }
7550 }
7551  
7552 # ${ foo }
7553 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
7554 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7555 0 $char[$i] = '@{[Elatin3::ignorecase(' . $1 . ')]}';
7556 }
7557 }
7558  
7559 # ${ ... }
7560 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
7561 0 $char[$i] = e_capture($1);
7562 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7563 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
7564 }
7565 }
7566  
7567 # $scalar or @array
7568 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
7569 3 $char[$i] = e_string($char[$i]);
7570 3 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 3 3
7571 0 $char[$i] = '@{[Elatin3::ignorecase(' . $char[$i] . ')]}';
7572 }
7573 }
7574  
7575 # quote character before ? + * {
7576 ▶ 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
7577 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
7578 }
7579 else {
7580 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
7581 }
7582 }
7583 }
7584  
7585 # make regexp string
7586 74 $modifier =~ tr/i//d;
7587 74 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 74 74
7588 0 return join '', 'Elatin3::split', $ope, $delimiter, @char, '>]}' x ($left_e - $right_e), $end_delimiter, $modifier;
7589 }
7590 74 return join '', 'Elatin3::split', $ope, $delimiter, @char, $end_delimiter, $modifier;
7591 }
7592  
7593 #
7594 # escape regexp of split qr''
7595 #
7596 0 ▶sub e_split_q {
Subroutine e_split_q: not called CC=26 SCAR=65.5
Pod undocumented
7597 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
7598 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
7599  
7600 0 $modifier =~ tr/p//d;
7601 0 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 0 0
7602 0 my $line = 0;
7603 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7604 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
7605 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
7606 0 last;
7607 }
7608 }
7609 0 die qq{Unsupported modifier "$1" used at line $line.\n};
7610 }
7611  
7612 0 $slash = 'div';
7613  
7614 # /b /B modifier
7615 0 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) 0 0 0
7616 0 return join '', 'split', $ope, $delimiter, $string, $end_delimiter, $modifier;
7617 }
7618  
7619 0 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 0 0
7620  
7621 # split regexp
7622 0 my @char = $string =~ /\G((?>
7623 [^\\\[] |
7624 [\x00-\xFF] |
7625 \[\^ |
7626 \[\: (?>[a-z]+) \:\] |
7627 \[\:\^ (?>[a-z]+) \:\] |
7628 \\ (?:$q_char) |
7629 (?:$q_char)
7630 ))/oxmsg;
7631  
7632 # unescape character
7633 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
7634 0 ▶ if (0) {
Branch: 6 branches
BranchTrueFalseTotal
if (do { $char[$i] eq '[' }) { } 0 0 0
elsif ($char[$i] eq '[^') { } 0 0 0
elsif (my $char = character_class($char[$i], $modifier)) { } 0 0 0
elsif ($char[$i] eq '^' and not $modifier =~ /m/mosx) { } 0 0 0
elsif ($ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin3::uc($char[$i]) ne &fc($char[$i])) { } 0 0 0
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 0 0
7635 }
7636  
7637 # open character class [...]
7638 elsif ($char[$i] eq '[') {
7639 0 my $left = $i;
7640 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7641 0 $i++;
7642 }
7643 0 while (1) {
7644 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7645 0 die __FILE__, ": Unmatched [] in regexp\n";
7646 }
7647 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7648 0 my $right = $i;
7649  
7650 # [...]
7651 0 splice @char, $left, $right-$left+1, Elatin3::charlist_qr(@char[$left+1..$right-1], $modifier);
7652  
7653 0 $i = $left;
7654 0 last;
7655 }
7656 }
7657 }
7658  
7659 # open character class [^...]
7660 elsif ($char[$i] eq '[^') {
7661 0 my $left = $i;
7662 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7663 0 $i++;
7664 }
7665 0 while (1) {
7666 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7667 0 die __FILE__, ": Unmatched [] in regexp\n";
7668 }
7669 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7670 0 my $right = $i;
7671  
7672 # [^...]
7673 0 splice @char, $left, $right-$left+1, Elatin3::charlist_not_qr(@char[$left+1..$right-1], $modifier);
7674  
7675 0 $i = $left;
7676 0 last;
7677 }
7678 }
7679 }
7680  
7681 # rewrite character class or escape character
7682 elsif (my $char = character_class($char[$i],$modifier)) {
7683 0 $char[$i] = $char;
7684 }
7685  
7686 # split(m/^/) --> split(m/^/m)
7687 ▶ 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
7688 0 $modifier .= 'm';
7689 }
7690  
7691 # /i modifier
7692 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin3::uc($char[$i]) ne Elatin3::fc($char[$i]))) {
Condition0%0/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin3::uc($char[$i]) ne &fc($char[$i])
!ll&&!rl&&r
000
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx
!ll&&!rl&&r
000
MC/DC0%0/3
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin3::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin3::uc($char[$i]) ne &fc($char[$i])
Truth table0%0/4
A and B and C
A= $ignorecaseB= $char[$i] =~ /\A [\x00-\xFF] \z/mosxC= &Elatin3::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
7693 0 ▶ if (CORE::length(Elatin3::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
7694 0 $char[$i] = '[' . Elatin3::uc($char[$i]) . Elatin3::fc($char[$i]) . ']';
7695 }
7696 else {
7697 0 $char[$i] = '(?:' . Elatin3::uc($char[$i]) . '|' . Elatin3::fc($char[$i]) . ')';
7698 }
7699 }
7700  
7701 # quote character before ? + * {
7702 ▶ 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
7703 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
7704 }
7705 else {
7706 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
7707 }
7708 }
7709 }
7710  
7711 0 $modifier =~ tr/i//d;
7712 0 return join '', 'Elatin3::split', $ope, $delimiter, @char, $end_delimiter, $modifier;
7713 }
7714  
7715 #
7716 # instead of Carp::carp
7717 #
7718 0 ▶sub carp {
Subroutine carp: not called CC=1 SCAR=6.9
Pod undocumented
7719 0 my($package,$filename,$line) = caller(1);
7720 0 print STDERR "@_ at $filename line $line.\n";
7721 }
7722  
7723 #
7724 # instead of Carp::croak
7725 #
7726 0 ▶sub croak {
Subroutine croak: not called CC=1 SCAR=6.9
Pod undocumented
7727 0 my($package,$filename,$line) = caller(1);
7728 0 print STDERR "@_ at $filename line $line.\n";
7729 0 die "\n";
7730 }
7731  
7732 #
7733 # instead of Carp::cluck
7734 #
7735 0 ▶sub cluck {
Subroutine cluck: not called CC=2 SCAR=17.9
Pod undocumented
7736 0 my $i = 0;
7737 0 my @cluck = ();
7738 0 ▶ while (my($package,$filename,$line,$subroutine) = caller($i)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7739 0 push @cluck, "[$i] $filename($line) $package::$subroutine\n";
7740 0 $i++;
7741 }
7742 0 print STDERR CORE::reverse @cluck;
7743 0 print STDERR "\n";
7744 0 print STDERR @_;
7745 }
7746  
7747 #
7748 # instead of Carp::confess
7749 #
7750 0 ▶sub confess {
Subroutine confess: not called CC=2 SCAR=17.9
Pod undocumented
7751 0 my $i = 0;
7752 0 my @confess = ();
7753 0 ▶ while (my($package,$filename,$line,$subroutine) = caller($i)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7754 0 push @confess, "[$i] $filename($line) $package::$subroutine\n";
7755 0 $i++;
7756 }
7757 0 print STDERR CORE::reverse @confess;
7758 0 print STDERR "\n";
7759 0 print STDERR @_;
7760 0 die "\n";
7761 }
7762  
7763 422 1;
7764  
7765 __END__
↑ Summary blib/lib/Latin3.pm »