blib/lib/Elatin7.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/Latin7.pm »
1 package Elatin7;
2 422 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 ######################################################################
4 #
5 # Elatin7 - Run-time routines for Latin7.pm
6 #
7 # http://search.cpan.org/dist/Char-Latin7/
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 (&Elatin7::index($name, '::') >= 0) { } 0 15 15
elsif (&Elatin7::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 (Elatin7::index($name,'::') >= 0) {
83 0 return $name;
84 }
85 elsif (Elatin7::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-7 character range per length
158 #
159 422 my %range_tr = ();
160  
161 #
162 # Latin-7 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 Elatin7 \z/mosx }) { } 422 0 422
175 }
176  
177 elsif (__PACKAGE__ =~ / \b Elatin7 \z/oxms) {
178 422 %range_tr = (
179 1 => [ [0x00..0xFF],
180 ],
181 );
182  
183 422 %lc = (%lc,
184 "\xA8" => "\xB8", # LATIN LETTER O WITH STROKE
185 "\xAA" => "\xBA", # LATIN LETTER R WITH CEDILLA
186 "\xAF" => "\xBF", # LATIN LETTER AE
187 "\xC0" => "\xE0", # LATIN LETTER A WITH OGONEK
188 "\xC1" => "\xE1", # LATIN LETTER I WITH OGONEK
189 "\xC2" => "\xE2", # LATIN LETTER A WITH MACRON
190 "\xC3" => "\xE3", # LATIN LETTER C WITH ACUTE
191 "\xC4" => "\xE4", # LATIN LETTER A WITH DIAERESIS
192 "\xC5" => "\xE5", # LATIN LETTER A WITH RING ABOVE
193 "\xC6" => "\xE6", # LATIN LETTER E WITH OGONEK
194 "\xC7" => "\xE7", # LATIN LETTER E WITH MACRON
195 "\xC8" => "\xE8", # LATIN LETTER C WITH CARON
196 "\xC9" => "\xE9", # LATIN LETTER E WITH ACUTE
197 "\xCA" => "\xEA", # LATIN LETTER Z WITH ACUTE
198 "\xCB" => "\xEB", # LATIN LETTER E WITH DOT ABOVE
199 "\xCC" => "\xEC", # LATIN LETTER G WITH CEDILLA
200 "\xCD" => "\xED", # LATIN LETTER K WITH CEDILLA
201 "\xCE" => "\xEE", # LATIN LETTER I WITH MACRON
202 "\xCF" => "\xEF", # LATIN LETTER L WITH CEDILLA
203 "\xD0" => "\xF0", # LATIN LETTER S WITH CARON
204 "\xD1" => "\xF1", # LATIN LETTER N WITH ACUTE
205 "\xD2" => "\xF2", # LATIN LETTER N WITH CEDILLA
206 "\xD3" => "\xF3", # LATIN LETTER O WITH ACUTE
207 "\xD4" => "\xF4", # LATIN LETTER O WITH MACRON
208 "\xD5" => "\xF5", # LATIN LETTER O WITH TILDE
209 "\xD6" => "\xF6", # LATIN LETTER O WITH DIAERESIS
210 "\xD8" => "\xF8", # LATIN LETTER U WITH OGONEK
211 "\xD9" => "\xF9", # LATIN LETTER L WITH STROKE
212 "\xDA" => "\xFA", # LATIN LETTER S WITH ACUTE
213 "\xDB" => "\xFB", # LATIN LETTER U WITH MACRON
214 "\xDC" => "\xFC", # LATIN LETTER U WITH DIAERESIS
215 "\xDD" => "\xFD", # LATIN LETTER Z WITH DOT ABOVE
216 "\xDE" => "\xFE", # LATIN LETTER Z WITH CARON
217 );
218  
219 422 %uc = (%uc,
220 "\xB8" => "\xA8", # LATIN LETTER O WITH STROKE
221 "\xBA" => "\xAA", # LATIN LETTER R WITH CEDILLA
222 "\xBF" => "\xAF", # LATIN LETTER AE
223 "\xE0" => "\xC0", # LATIN LETTER A WITH OGONEK
224 "\xE1" => "\xC1", # LATIN LETTER I WITH OGONEK
225 "\xE2" => "\xC2", # LATIN LETTER A WITH MACRON
226 "\xE3" => "\xC3", # LATIN LETTER C WITH ACUTE
227 "\xE4" => "\xC4", # LATIN LETTER A WITH DIAERESIS
228 "\xE5" => "\xC5", # LATIN LETTER A WITH RING ABOVE
229 "\xE6" => "\xC6", # LATIN LETTER E WITH OGONEK
230 "\xE7" => "\xC7", # LATIN LETTER E WITH MACRON
231 "\xE8" => "\xC8", # LATIN LETTER C WITH CARON
232 "\xE9" => "\xC9", # LATIN LETTER E WITH ACUTE
233 "\xEA" => "\xCA", # LATIN LETTER Z WITH ACUTE
234 "\xEB" => "\xCB", # LATIN LETTER E WITH DOT ABOVE
235 "\xEC" => "\xCC", # LATIN LETTER G WITH CEDILLA
236 "\xED" => "\xCD", # LATIN LETTER K WITH CEDILLA
237 "\xEE" => "\xCE", # LATIN LETTER I WITH MACRON
238 "\xEF" => "\xCF", # LATIN LETTER L WITH CEDILLA
239 "\xF0" => "\xD0", # LATIN LETTER S WITH CARON
240 "\xF1" => "\xD1", # LATIN LETTER N WITH ACUTE
241 "\xF2" => "\xD2", # LATIN LETTER N WITH CEDILLA
242 "\xF3" => "\xD3", # LATIN LETTER O WITH ACUTE
243 "\xF4" => "\xD4", # LATIN LETTER O WITH MACRON
244 "\xF5" => "\xD5", # LATIN LETTER O WITH TILDE
245 "\xF6" => "\xD6", # LATIN LETTER O WITH DIAERESIS
246 "\xF8" => "\xD8", # LATIN LETTER U WITH OGONEK
247 "\xF9" => "\xD9", # LATIN LETTER L WITH STROKE
248 "\xFA" => "\xDA", # LATIN LETTER S WITH ACUTE
249 "\xFB" => "\xDB", # LATIN LETTER U WITH MACRON
250 "\xFC" => "\xDC", # LATIN LETTER U WITH DIAERESIS
251 "\xFD" => "\xDD", # LATIN LETTER Z WITH DOT ABOVE
252 "\xFE" => "\xDE", # LATIN LETTER Z WITH CARON
253 );
254  
255 422 %fc = (%fc,
256 "\xA8" => "\xB8", # LATIN CAPITAL LETTER O WITH STROKE --> LATIN SMALL LETTER O WITH STROKE
257 "\xAA" => "\xBA", # LATIN CAPITAL LETTER R WITH CEDILLA --> LATIN SMALL LETTER R WITH CEDILLA
258 "\xAF" => "\xBF", # LATIN CAPITAL LETTER AE --> LATIN SMALL LETTER AE
259 "\xC0" => "\xE0", # LATIN CAPITAL LETTER A WITH OGONEK --> LATIN SMALL LETTER A WITH OGONEK
260 "\xC1" => "\xE1", # LATIN CAPITAL LETTER I WITH OGONEK --> LATIN SMALL LETTER I WITH OGONEK
261 "\xC2" => "\xE2", # LATIN CAPITAL LETTER A WITH MACRON --> LATIN SMALL LETTER A WITH MACRON
262 "\xC3" => "\xE3", # LATIN CAPITAL LETTER C WITH ACUTE --> LATIN SMALL LETTER C WITH ACUTE
263 "\xC4" => "\xE4", # LATIN CAPITAL LETTER A WITH DIAERESIS --> LATIN SMALL LETTER A WITH DIAERESIS
264 "\xC5" => "\xE5", # LATIN CAPITAL LETTER A WITH RING ABOVE --> LATIN SMALL LETTER A WITH RING ABOVE
265 "\xC6" => "\xE6", # LATIN CAPITAL LETTER E WITH OGONEK --> LATIN SMALL LETTER E WITH OGONEK
266 "\xC7" => "\xE7", # LATIN CAPITAL LETTER E WITH MACRON --> LATIN SMALL LETTER E WITH MACRON
267 "\xC8" => "\xE8", # LATIN CAPITAL LETTER C WITH CARON --> LATIN SMALL LETTER C WITH CARON
268 "\xC9" => "\xE9", # LATIN CAPITAL LETTER E WITH ACUTE --> LATIN SMALL LETTER E WITH ACUTE
269 "\xCA" => "\xEA", # LATIN CAPITAL LETTER Z WITH ACUTE --> LATIN SMALL LETTER Z WITH ACUTE
270 "\xCB" => "\xEB", # LATIN CAPITAL LETTER E WITH DOT ABOVE --> LATIN SMALL LETTER E WITH DOT ABOVE
271 "\xCC" => "\xEC", # LATIN CAPITAL LETTER G WITH CEDILLA --> LATIN SMALL LETTER G WITH CEDILLA
272 "\xCD" => "\xED", # LATIN CAPITAL LETTER K WITH CEDILLA --> LATIN SMALL LETTER K WITH CEDILLA
273 "\xCE" => "\xEE", # LATIN CAPITAL LETTER I WITH MACRON --> LATIN SMALL LETTER I WITH MACRON
274 "\xCF" => "\xEF", # LATIN CAPITAL LETTER L WITH CEDILLA --> LATIN SMALL LETTER L WITH CEDILLA
275 "\xD0" => "\xF0", # LATIN CAPITAL LETTER S WITH CARON --> LATIN SMALL LETTER S WITH CARON
276 "\xD1" => "\xF1", # LATIN CAPITAL LETTER N WITH ACUTE --> LATIN SMALL LETTER N WITH ACUTE
277 "\xD2" => "\xF2", # LATIN CAPITAL LETTER N WITH CEDILLA --> LATIN SMALL LETTER N WITH CEDILLA
278 "\xD3" => "\xF3", # LATIN CAPITAL LETTER O WITH ACUTE --> LATIN SMALL LETTER O WITH ACUTE
279 "\xD4" => "\xF4", # LATIN CAPITAL LETTER O WITH MACRON --> LATIN SMALL LETTER O WITH MACRON
280 "\xD5" => "\xF5", # LATIN CAPITAL LETTER O WITH TILDE --> LATIN SMALL LETTER O WITH TILDE
281 "\xD6" => "\xF6", # LATIN CAPITAL LETTER O WITH DIAERESIS --> LATIN SMALL LETTER O WITH DIAERESIS
282 "\xD8" => "\xF8", # LATIN CAPITAL LETTER U WITH OGONEK --> LATIN SMALL LETTER U WITH OGONEK
283 "\xD9" => "\xF9", # LATIN CAPITAL LETTER L WITH STROKE --> LATIN SMALL LETTER L WITH STROKE
284 "\xDA" => "\xFA", # LATIN CAPITAL LETTER S WITH ACUTE --> LATIN SMALL LETTER S WITH ACUTE
285 "\xDB" => "\xFB", # LATIN CAPITAL LETTER U WITH MACRON --> LATIN SMALL LETTER U WITH MACRON
286 "\xDC" => "\xFC", # LATIN CAPITAL LETTER U WITH DIAERESIS --> LATIN SMALL LETTER U WITH DIAERESIS
287 "\xDD" => "\xFD", # LATIN CAPITAL LETTER Z WITH DOT ABOVE --> LATIN SMALL LETTER Z WITH DOT ABOVE
288 "\xDE" => "\xFE", # LATIN CAPITAL LETTER Z WITH CARON --> LATIN SMALL LETTER Z WITH CARON
289 "\xDF" => "\x73\x73", # LATIN SMALL LETTER SHARP S --> LATIN SMALL LETTER S, LATIN SMALL LETTER S
290 );
291 }
292  
293 else {
294 0 croak "Don't know my package name '@{[__PACKAGE__]}'";
295 }
296  
297 #
298 # @ARGV wildcard globbing
299 #
300 211 ▶sub import {
Subroutine import: called CC=7 SCAR=28.3
301  
302 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
303 0 my @argv = ();
304 0 for (@ARGV) {
305  
306 # has space
307 0 ▶ if (/\A (?:$q_char)*? [ ] /oxms) {
Branch: 2 branches
BranchTrueFalseTotal
if (/\A (?:$Elatin7::q_char)*? [ ] /mosx) { } 0 0 0
elsif (/\A (?:$Elatin7::q_char)*? [*?] /mosx) { } 0 0 0
308 0 ▶ if (my @glob = Elatin7::glob(qq{"$_"})) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@glob) = &Elatin7::glob(qq["$_"])) { } 0 0 0
309 0 push @argv, @glob;
310 }
311 else {
312 0 push @argv, $_;
313 }
314 }
315  
316 # has wildcard metachar
317 elsif (/\A (?:$q_char)*? [*?] /oxms) {
318 0 ▶ if (my @glob = Elatin7::glob($_)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@glob) = &Elatin7::glob($_)) { } 0 0 0
319 0 push @argv, @glob;
320 }
321 else {
322 0 push @argv, $_;
323 }
324 }
325  
326 # no wildcard globbing
327 else {
328 0 push @argv, $_;
329 }
330 }
331 0 @ARGV = @argv;
332 }
333  
334 211 *Char::ord = \&Latin7::ord;
335 211 *Char::ord_ = \&Latin7::ord_;
336 211 *Char::reverse = \&Latin7::reverse;
337 211 *Char::getc = \&Latin7::getc;
338 211 *Char::length = \&Latin7::length;
339 211 *Char::substr = \&Latin7::substr;
340 211 *Char::index = \&Latin7::index;
341 211 *Char::rindex = \&Latin7::rindex;
342 211 *Char::eval = \&Latin7::eval;
343 211 *Char::escape = \&Latin7::escape;
344 211 *Char::escape_token = \&Latin7::escape_token;
345 211 *Char::escape_script = \&Latin7::escape_script;
346 }
347  
348 # P.230 Care with Prototypes
349 # in Chapter 6: Subroutines
350 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
351 #
352 # If you aren't careful, you can get yourself into trouble with prototypes.
353 # But if you are careful, you can do a lot of neat things with them. This is
354 # all very powerful, of course, and should only be used in moderation to make
355 # the world a better place.
356  
357 # P.332 Care with Prototypes
358 # in Chapter 7: Subroutines
359 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
360 #
361 # If you aren't careful, you can get yourself into trouble with prototypes.
362 # But if you are careful, you can do a lot of neat things with them. This is
363 # all very powerful, of course, and should only be used in moderation to make
364 # the world a better place.
365  
366 #
367 # Prototypes of subroutines
368 #
369 0 ▶sub unimport {}
Subroutine unimport: not called CC=1 SCAR=0.0
370 sub Elatin7::split(;$$$);
371 sub Elatin7::tr($$$$;$);
372 sub Elatin7::chop(@);
373 sub Elatin7::index($$;$);
374 sub Elatin7::rindex($$;$);
375 sub Elatin7::lcfirst(@);
376 sub Elatin7::lcfirst_();
377 sub Elatin7::lc(@);
378 sub Elatin7::lc_();
379 sub Elatin7::ucfirst(@);
380 sub Elatin7::ucfirst_();
381 sub Elatin7::uc(@);
382 sub Elatin7::uc_();
383 sub Elatin7::fc(@);
384 sub Elatin7::fc_();
385 sub Elatin7::ignorecase;
386 sub Elatin7::classic_character_class;
387 sub Elatin7::capture;
388 sub Elatin7::chr(;$);
389 sub Elatin7::chr_();
390 sub Elatin7::glob($);
391 sub Elatin7::glob_();
392  
393 sub Latin7::ord(;$);
394 sub Latin7::ord_();
395 sub Latin7::reverse(@);
396 sub Latin7::getc(;*@);
397 sub Latin7::length(;$);
398 sub Latin7::substr($$;$$);
399 sub Latin7::index($$;$);
400 sub Latin7::rindex($$;$);
401 sub Latin7::escape(;$);
402  
403 #
404 # Regexp work
405 #
406 422 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
407 $re_a
408 $re_t
409 $re_n
410 $re_r
411 422 );
412  
413 #
414 # Character class
415 #
416 422 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
417 $dot
418 $dot_s
419 $eD
420 $eS
421 $eW
422 $eH
423 $eV
424 $eR
425 $eN
426 $not_alnum
427 $not_alpha
428 $not_ascii
429 $not_blank
430 $not_cntrl
431 $not_digit
432 $not_graph
433 $not_lower
434 $not_lower_i
435 $not_print
436 $not_punct
437 $not_space
438 $not_upper
439 $not_upper_i
440 $not_word
441 $not_xdigit
442 $eb
443 $eB
444 422 );
445  
446 422 ${Elatin7::dot} = qr{(?>[^\x0A])};
447 422 ${Elatin7::dot_s} = qr{(?>[\x00-\xFF])};
448 422 ${Elatin7::eD} = qr{(?>[^0-9])};
449  
450 # Vertical tabs are now whitespace
451 # \s in a regex now matches a vertical tab in all circumstances.
452 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
453 # ${Elatin7::eS} = qr{(?>[^\x09\x0A \x0C\x0D\x20])};
454 # ${Elatin7::eS} = qr{(?>[^\x09\x0A\x0B\x0C\x0D\x20])};
455 422 ${Elatin7::eS} = qr{(?>[^\s])};
456  
457 422 ${Elatin7::eW} = qr{(?>[^0-9A-Z_a-z])};
458 422 ${Elatin7::eH} = qr{(?>[^\x09\x20])};
459 422 ${Elatin7::eV} = qr{(?>[^\x0A\x0B\x0C\x0D])};
460 422 ${Elatin7::eR} = qr{(?>\x0D\x0A|[\x0A\x0D])};
461 422 ${Elatin7::eN} = qr{(?>[^\x0A])};
462 422 ${Elatin7::not_alnum} = qr{(?>[^\x30-\x39\x41-\x5A\x61-\x7A])};
463 422 ${Elatin7::not_alpha} = qr{(?>[^\x41-\x5A\x61-\x7A])};
464 422 ${Elatin7::not_ascii} = qr{(?>[^\x00-\x7F])};
465 422 ${Elatin7::not_blank} = qr{(?>[^\x09\x20])};
466 422 ${Elatin7::not_cntrl} = qr{(?>[^\x00-\x1F\x7F])};
467 422 ${Elatin7::not_digit} = qr{(?>[^\x30-\x39])};
468 422 ${Elatin7::not_graph} = qr{(?>[^\x21-\x7F])};
469 422 ${Elatin7::not_lower} = qr{(?>[^\x61-\x7A])};
470 422 ${Elatin7::not_lower_i} = qr{(?>[^\x41-\x5A\x61-\x7A])}; # Perl 5.16 compatible
471 # ${Elatin7::not_lower_i} = qr{(?>[\x00-\xFF])}; # older Perl compatible
472 422 ${Elatin7::not_print} = qr{(?>[^\x20-\x7F])};
473 422 ${Elatin7::not_punct} = qr{(?>[^\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E])};
474 422 ${Elatin7::not_space} = qr{(?>[^\s\x0B])};
475 422 ${Elatin7::not_upper} = qr{(?>[^\x41-\x5A])};
476 422 ${Elatin7::not_upper_i} = qr{(?>[^\x41-\x5A\x61-\x7A])}; # Perl 5.16 compatible
477 # ${Elatin7::not_upper_i} = qr{(?>[\x00-\xFF])}; # older Perl compatible
478 422 ${Elatin7::not_word} = qr{(?>[^\x30-\x39\x41-\x5A\x5F\x61-\x7A])};
479 422 ${Elatin7::not_xdigit} = qr{(?>[^\x30-\x39\x41-\x46\x61-\x66])};
480 422 ${Elatin7::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))};
481 422 ${Elatin7::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]))};
482  
483 # avoid: Name "Elatin7::foo" used only once: possible typo at here.
484 422 ${Elatin7::dot} = ${Elatin7::dot};
485 422 ${Elatin7::dot_s} = ${Elatin7::dot_s};
486 422 ${Elatin7::eD} = ${Elatin7::eD};
487 422 ${Elatin7::eS} = ${Elatin7::eS};
488 422 ${Elatin7::eW} = ${Elatin7::eW};
489 422 ${Elatin7::eH} = ${Elatin7::eH};
490 422 ${Elatin7::eV} = ${Elatin7::eV};
491 422 ${Elatin7::eR} = ${Elatin7::eR};
492 422 ${Elatin7::eN} = ${Elatin7::eN};
493 422 ${Elatin7::not_alnum} = ${Elatin7::not_alnum};
494 422 ${Elatin7::not_alpha} = ${Elatin7::not_alpha};
495 422 ${Elatin7::not_ascii} = ${Elatin7::not_ascii};
496 422 ${Elatin7::not_blank} = ${Elatin7::not_blank};
497 422 ${Elatin7::not_cntrl} = ${Elatin7::not_cntrl};
498 422 ${Elatin7::not_digit} = ${Elatin7::not_digit};
499 422 ${Elatin7::not_graph} = ${Elatin7::not_graph};
500 422 ${Elatin7::not_lower} = ${Elatin7::not_lower};
501 422 ${Elatin7::not_lower_i} = ${Elatin7::not_lower_i};
502 422 ${Elatin7::not_print} = ${Elatin7::not_print};
503 422 ${Elatin7::not_punct} = ${Elatin7::not_punct};
504 422 ${Elatin7::not_space} = ${Elatin7::not_space};
505 422 ${Elatin7::not_upper} = ${Elatin7::not_upper};
506 422 ${Elatin7::not_upper_i} = ${Elatin7::not_upper_i};
507 422 ${Elatin7::not_word} = ${Elatin7::not_word};
508 422 ${Elatin7::not_xdigit} = ${Elatin7::not_xdigit};
509 422 ${Elatin7::eb} = ${Elatin7::eb};
510 422 ${Elatin7::eB} = ${Elatin7::eB};
511  
512 #
513 # Latin-7 split
514 #
515 72 ▶sub Elatin7::split(;$$$) {
Subroutine split: called CC=34 SCAR=46.9
Pod undocumented
516  
517 # P.794 29.2.161. split
518 # in Chapter 29: Functions
519 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
520  
521 # P.951 split
522 # in Chapter 27: Functions
523 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
524  
525 72 my $pattern = $_[0];
526 72 my $string = $_[1];
527 72 my $limit = $_[2];
528  
529 # if $pattern is also omitted or is the literal space, " "
530 72 ▶ if (not defined $pattern) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $pattern) 2 70 72
531 2 $pattern = ' ';
532 }
533  
534 # if $string is omitted, the function splits the $_ string
535 72 ▶ if (not defined $string) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $string) 6 66 72
536 6 ▶ if (defined $_) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_) { } 0 6 6
537 0 $string = $_;
538 }
539 else {
540 6 $string = '';
541 }
542 }
543  
544 72 my @split = ();
545  
546 # when string is empty
547 72 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 10 62 72
elsif ($pattern eq ' ') { } 2 60 62
548  
549 # resulting list value in list context
550 10 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 5 5 10
551 5 return @split;
552 }
553  
554 # count of substrings in scalar context
555 else {
556 5 ▶ carp "Use of implicit split to \@_ is deprecated" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 5 5
557 5 @_ = @split;
558 5 return scalar @_;
559 }
560 }
561  
562 # split's first argument is more consistently interpreted
563 #
564 # After some changes earlier in v5.17, split's behavior has been simplified:
565 # if the PATTERN argument evaluates to a string containing one space, it is
566 # treated the way that a literal string containing one space once was.
567 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#split's_first_argument_is_more_consistently_interpreted
568  
569 # if $pattern is also omitted or is the literal space, " ", the function splits
570 # on whitespace, /\s+/, after skipping any leading whitespace
571 # (and so on)
572  
573 elsif ($pattern eq ' ') {
574 2 ▶ if (not defined $limit) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $limit) { } 2 0 2
575 2 return CORE::split(' ', $string);
576 }
577 else {
578 0 return CORE::split(' ', $string, $limit);
579 }
580 }
581  
582 # if $limit is negative, it is treated as if an arbitrarily large $limit has been specified
583 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
584  
585 # a pattern capable of matching either the null string or something longer than the
586 # null string will split the value of $string into separate characters wherever it
587 # matches the null string between characters
588 # (and so on)
589  
590 60 ▶ if ('' =~ / \A $pattern \z /xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ('' =~ / \A $pattern \z /msx) { } 2 58 60
591 2 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
592 2 my $limit = scalar(() = $string =~ /($pattern)/oxmsg);
593  
594 # P.1024 Appendix W.10 Multibyte Processing
595 # of ISBN 1-56592-224-7 CJKV Information Processing
596 # (and so on)
597  
598 # the //m modifier is assumed when you split on the pattern /^/
599 # (and so on)
600  
601 # V
602 2 ▶ while ((--$limit > 0) and ($string =~ s/\A((?:$q_char)+?)$pattern//m)) {
Branch: 1 branch
BranchTrueFalseTotal
if (--$limit > 0 and $string =~ s/\A((?:$Elatin7::q_char)+?)$pattern//m) 9 2 11
Condition100%3/3
--$limit > 0 and $string =~ s/\A((?:$Elatin7::q_char)+?)$pattern//m
!ll&&!rl&&r
119
MC/DC100%2/2
--$limit > 0 and $string =~ s/\A((?:$Elatin7::q_char)+?)$pattern//m
--$limit > 0 $string =~ s/\A((?:$Elatin7::q_char)+?)$pattern//m
Truth table100%3/3
A and B
A= --$limit > 0B= $string =~ s/\A((?:$Elatin7::q_char)+?)$pattern//m
ABresult
0X0
100
111
603  
604 # if the $pattern contains parentheses, then the substring matched by each pair of parentheses
605 # is included in the resulting list, interspersed with the fields that are ordinarily returned
606 # (and so on)
607  
608 9 local $@;
609 9 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 9 9 18
610 9 push @split, CORE::eval('$' . $digit);
611 }
612 }
613 }
614  
615 else {
616 58 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
617  
618 # V
619 58 ▶ while ($string =~ s/\A((?:$q_char)*?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Elatin7::q_char)*?)$pattern//m) 163 58 221
620 163 local $@;
621 163 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 230 163 393
622 230 push @split, CORE::eval('$' . $digit);
623 }
624 }
625 }
626 }
627  
628 elsif ($limit > 0) {
629 0 ▶ if ('' =~ / \A $pattern \z /xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ('' =~ / \A $pattern \z /msx) { } 0 0 0
630 0 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
631 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
632  
633 # V
634 0 ▶ if ($string =~ s/\A((?:$q_char)+?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Elatin7::q_char)+?)$pattern//m) 0 0 0
635 0 local $@;
636 0 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 0 0 0
637 0 push @split, CORE::eval('$' . $digit);
638 }
639 }
640 }
641 }
642 else {
643 0 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
644 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
645  
646 # V
647 0 ▶ if ($string =~ s/\A((?:$q_char)*?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Elatin7::q_char)*?)$pattern//m) 0 0 0
648 0 local $@;
649 0 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 0 0 0
650 0 push @split, CORE::eval('$' . $digit);
651 }
652 }
653 }
654 }
655 }
656  
657 60 ▶ if (CORE::length($string) > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $string > 0) 58 2 60
658 58 push @split, $string;
659 }
660  
661 # if $_[2] (NOT "$limit") is omitted or zero, trailing null fields are stripped from the result
662 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
663 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
664 0 pop @split;
665 }
666 }
667  
668 # resulting list value in list context
669 60 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 58 2 60
670 58 return @split;
671 }
672  
673 # count of substrings in scalar context
674 else {
675 2 ▶ carp "Use of implicit split to \@_ is deprecated" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 2 2
676 2 @_ = @split;
677 2 return scalar @_;
678 }
679 }
680  
681 #
682 # get last subexpression offsets
683 #
684 60 ▶sub _last_subexpression_offsets {
Subroutine _last_subexpression_offsets: called CC=3 SCAR=11.0
685 60 my $pattern = $_[0];
686  
687 # remove comment
688 60 $pattern =~ s/\(\?\# .*? \)//oxmsg;
689  
690 60 my $modifier = '';
691 60 ▶ if ($pattern =~ /\(\?\^? ([\-A-Za-z]+) :/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pattern =~ /\(\?\^? ([\-A-Za-z]+) :/mosx) 11 49 60
692 11 $modifier = $1;
693 11 $modifier =~ s/-[A-Za-z]*//;
694 }
695  
696 # with /x modifier
697 60 my @char = ();
698 60 ▶ if ($modifier =~ /x/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /x/mosx) { } 5 55 60
699 5 @char = $pattern =~ /\G((?>
700 [^\\\#\[\(] |
701 \\ $q_char |
702 \# (?>[^\n]*) $ |
703 \[ (?>(?:[^\\\]]|\\\\|\\\]|$q_char)+) \] |
704 \(\? |
705 $q_char
706 ))/oxmsg;
707 }
708  
709 # without /x modifier
710 else {
711 55 @char = $pattern =~ /\G((?>
712 [^\\\[\(] |
713 \\ $q_char |
714 \[ (?>(?:[^\\\]]|\\\\|\\\]|$q_char)+) \] |
715 \(\? |
716 $q_char
717 ))/oxmsg;
718 }
719  
720 60 return scalar grep { $_ eq '(' } @char;
721 }
722  
723 #
724 # Latin-7 transliteration (tr///)
725 #
726 6 ▶sub Elatin7::tr($$$$;$) {
Subroutine tr: called CC=26 SCAR=48.6
Pod undocumented
727  
728 6 my $bind_operator = $_[1];
729 6 my $searchlist = $_[2];
730 6 my $replacementlist = $_[3];
731 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
732  
733 6 ▶ if ($modifier =~ /r/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /r/mosx) 5 1 6
734 5 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) 0 5 5
735 0 croak "Using !~ with tr///r doesn't make sense";
736 }
737 }
738  
739 6 my @char = $_[0] =~ /\G (?>$q_char) /oxmsg;
740 6 my @searchlist = _charlist_tr($searchlist);
741 6 my @replacementlist = _charlist_tr($replacementlist);
742  
743 6 my %tr = ();
744 6 ▶ for (my $i=0; $i <= $#searchlist; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#searchlist) 19 6 25
745 19 ▶ if (not exists $tr{$searchlist[$i]}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $tr{$searchlist[$i]}) 19 0 19
746 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
747 19 $tr{$searchlist[$i]} = $replacementlist[$i];
748 }
749 elsif ($modifier =~ /d/oxms) {
750 0 $tr{$searchlist[$i]} = '';
751 }
752 ▶ 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
753 0 $tr{$searchlist[$i]} = $replacementlist[-1];
754 }
755 else {
756 0 $tr{$searchlist[$i]} = $searchlist[$i];
757 }
758 }
759 }
760  
761 6 my $tr = 0;
762 6 my $replaced = '';
763 6 ▶ if ($modifier =~ /c/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /c/mosx) { } 0 6 6
764 0 ▶ while (defined(my $char = shift @char)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $char = shift @char)) 0 0 0
765 0 ▶ if (not exists $tr{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $tr{$char}) { } 0 0 0
766 0 ▶ if (defined $replacementlist[0]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $replacementlist[0]) 0 0 0
767 0 $replaced .= $replacementlist[0];
768 }
769 0 $tr++;
770 0 ▶ if ($modifier =~ /s/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/mosx) 0 0 0
771 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
772 0 shift @char;
773 0 $tr++;
774 }
775 }
776 }
777 else {
778 0 $replaced .= $char;
779 }
780 }
781 }
782 else {
783 6 ▶ while (defined(my $char = shift @char)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $char = shift @char)) 36 6 42
784 36 ▶ if (exists $tr{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $tr{$char}) { } 19 17 36
785 19 $replaced .= $tr{$char};
786 19 $tr++;
787 19 ▶ if ($modifier =~ /s/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/mosx) 0 19 19
788 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
789 0 shift @char;
790 0 $tr++;
791 }
792 }
793 }
794 else {
795 17 $replaced .= $char;
796 }
797 }
798 }
799  
800 6 ▶ if ($modifier =~ /r/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /r/mosx) { } 5 1 6
801 5 return $replaced;
802 }
803 else {
804 1 $_[0] = $replaced;
805 1 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) { } 0 1 1
806 0 return not $tr;
807 }
808 else {
809 1 return $tr;
810 }
811 }
812 }
813  
814 #
815 # Latin-7 chop
816 #
817 0 ▶sub Elatin7::chop(@) {
Subroutine chop: not called CC=3 SCAR=24.8
Pod undocumented
818  
819 0 my $chop;
820 0 ▶ if (@_ == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 0) { } 0 0 0
821 0 my @char = /\G (?>$q_char) /oxmsg;
822 0 $chop = pop @char;
823 0 $_ = join '', @char;
824 }
825 else {
826 0 for (@_) {
827 0 my @char = /\G (?>$q_char) /oxmsg;
828 0 $chop = pop @char;
829 0 $_ = join '', @char;
830 }
831 }
832 0 return $chop;
833 }
834  
835 #
836 # Latin-7 index by octet
837 #
838 30 ▶sub Elatin7::index($$;$) {
Subroutine index: called CC=6 SCAR=20.8
Pod documented
839  
840 30 my($str,$substr,$position) = @_;
841 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
842 30 my $pos = 0;
843  
844 30 ▶ while ($pos < CORE::length($str)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos < length $str) 130 30 160
845 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
846 0 ▶ if ($pos >= $position) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos >= $position) 0 0 0
847 0 return $pos;
848 }
849 }
850 130 ▶ if (CORE::substr($str,$pos) =~ /\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($str, $pos) =~ /\A ($Elatin7::q_char) /mosx) { } 130 0 130
851 130 $pos += CORE::length($1);
852 }
853 else {
854 0 $pos += 1;
855 }
856 }
857 30 return -1;
858 }
859  
860 #
861 # Latin-7 reverse index
862 #
863 0 ▶sub Elatin7::rindex($$;$) {
Subroutine rindex: not called CC=6 SCAR=37.4
Pod undocumented
864  
865 0 my($str,$substr,$position) = @_;
866 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
867 0 my $pos = 0;
868 0 my $rindex = -1;
869  
870 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
871 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
872 0 $rindex = $pos;
873 }
874 0 ▶ if (CORE::substr($str,$pos) =~ /\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($str, $pos) =~ /\A ($Elatin7::q_char) /mosx) { } 0 0 0
875 0 $pos += CORE::length($1);
876 }
877 else {
878 0 $pos += 1;
879 }
880 }
881 0 return $rindex;
882 }
883  
884 #
885 # Latin-7 lower case first with parameter
886 #
887 0 ▶sub Elatin7::lcfirst(@) {
Subroutine lcfirst: not called CC=4 SCAR=30.0
Pod undocumented
888 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
889 0 my $s = shift @_;
890 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
891 0 return Elatin7::lc(CORE::substr($s,0,1)) . CORE::substr($s,1), @_;
892 }
893 else {
894 0 return Elatin7::lc(CORE::substr($s,0,1)) . CORE::substr($s,1);
895 }
896 }
897 else {
898 0 return Elatin7::lc(CORE::substr($_,0,1)) . CORE::substr($_,1);
899 }
900 }
901  
902 #
903 # Latin-7 lower case first without parameter
904 #
905 0 ▶sub Elatin7::lcfirst_() {
Subroutine lcfirst_: not called CC=1 SCAR=6.9
Pod undocumented
906 0 return Elatin7::lc(CORE::substr($_,0,1)) . CORE::substr($_,1);
907 }
908  
909 #
910 # Latin-7 lower case with parameter
911 #
912 60 ▶sub Elatin7::lc(@) {
Subroutine lc: called CC=6 SCAR=24.2
Pod undocumented
913 60 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 60 0 60
914 60 my $s = shift @_;
915 60 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 60 60
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
6000
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
916 0 ▶ return join('', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 0 0 0
917 }
918 else {
919 60 ▶ return join('', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 62 0 62
920 }
921 }
922 else {
923 0 return Elatin7::lc_();
924 }
925 }
926  
927 #
928 # Latin-7 lower case without parameter
929 #
930 0 ▶sub Elatin7::lc_() {
Subroutine lc_: not called CC=2 SCAR=17.9
Pod undocumented
931 0 my $s = $_;
932 0 ▶ return join '', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 0 0 0
933 }
934  
935 #
936 # Latin-7 upper case first with parameter
937 #
938 0 ▶sub Elatin7::ucfirst(@) {
Subroutine ucfirst: not called CC=4 SCAR=30.0
Pod undocumented
939 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
940 0 my $s = shift @_;
941 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
942 0 return Elatin7::uc(CORE::substr($s,0,1)) . CORE::substr($s,1), @_;
943 }
944 else {
945 0 return Elatin7::uc(CORE::substr($s,0,1)) . CORE::substr($s,1);
946 }
947 }
948 else {
949 0 return Elatin7::uc(CORE::substr($_,0,1)) . CORE::substr($_,1);
950 }
951 }
952  
953 #
954 # Latin-7 upper case first without parameter
955 #
956 0 ▶sub Elatin7::ucfirst_() {
Subroutine ucfirst_: not called CC=1 SCAR=6.9
Pod undocumented
957 0 return Elatin7::uc(CORE::substr($_,0,1)) . CORE::substr($_,1);
958 }
959  
960 #
961 # Latin-7 upper case with parameter
962 #
963 2436 ▶sub Elatin7::uc(@) {
Subroutine uc: called CC=6 SCAR=22.9
Pod undocumented
964 2436 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2436 0 2436
965 2436 my $s = shift @_;
966 2436 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 2436 2436
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
243600
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
967 0 ▶ return join('', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 0 0 0
968 }
969 else {
970 2436 ▶ return join('', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 871 1567 2438
971 }
972 }
973 else {
974 0 return Elatin7::uc_();
975 }
976 }
977  
978 #
979 # Latin-7 upper case without parameter
980 #
981 0 ▶sub Elatin7::uc_() {
Subroutine uc_: not called CC=2 SCAR=17.9
Pod undocumented
982 0 my $s = $_;
983 0 ▶ return join '', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 0 0 0
984 }
985  
986 #
987 # Latin-7 fold case with parameter
988 #
989 2447 ▶sub Elatin7::fc(@) {
Subroutine fc: called CC=6 SCAR=22.9
Pod undocumented
990 2447 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2447 0 2447
991 2447 my $s = shift @_;
992 2447 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 2447 2447
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
244700
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
993 0 ▶ return join('', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 0 0 0
994 }
995 else {
996 2447 ▶ return join('', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 1825 5667 7492
997 }
998 }
999 else {
1000 0 return Elatin7::fc_();
1001 }
1002 }
1003  
1004 #
1005 # Latin-7 fold case without parameter
1006 #
1007 0 ▶sub Elatin7::fc_() {
Subroutine fc_: not called CC=2 SCAR=17.9
Pod undocumented
1008 0 my $s = $_;
1009 0 ▶ return join '', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 0 0 0
1010 }
1011  
1012 #
1013 # Latin-7 regexp capture
1014 #
1015 {
1016 0 ▶ sub Elatin7::capture {
Subroutine capture: not called CC=1 SCAR=6.9
Pod documented
1017 0 return $_[0];
1018 }
1019 }
1020  
1021 #
1022 # Latin-7 regexp ignore case modifier
1023 #
1024 422 ▶sub Elatin7::ignorecase {
Subroutine ignorecase: called CC=25 SCAR=52.1
Pod undocumented
1025  
1026 11 my @string = @_;
1027 11 my $metachar = qr/[\@\\|[\]{]/oxms;
1028  
1029 # ignore case of $scalar or @array
1030 11 for my $string (@string) {
1031  
1032 # split regexp
1033 11 my @char = $string =~ /\G (?>\[\^|\\$q_char|$q_char) /oxmsg;
1034  
1035 # unescape character
1036 11 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 972 11 983
1037 972 ▶ next if not defined $char[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $char[$i] 0 972 972
1038  
1039 # open character class [...]
1040 972 ▶ if ($char[$i] eq '[') {
Branch: 4 branches
BranchTrueFalseTotal
if ($char[$i] eq '[') { } 0 972 972
elsif ($char[$i] eq '[^') { } 0 972 972
elsif (my $char = classic_character_class($char[$i])) { } 0 972 972
elsif ($char[$i] =~ /\A [\x00-\xFF] \z/mosx) { } 972 0 972
1041 0 my $left = $i;
1042  
1043 # [] make die "unmatched [] in regexp ...\n"
1044  
1045 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
1046 0 $i++;
1047 }
1048  
1049 0 while (1) {
1050 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
1051 0 croak "Unmatched [] in regexp";
1052 }
1053 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
1054 0 my $right = $i;
1055 0 my @charlist = charlist_qr(@char[$left+1..$right-1], 'i');
1056  
1057 # escape character
1058 0 for my $char (@charlist) {
1059 0 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $char =~ /\A [.|)] \z/mosx }) 0 0 0
1060 }
1061  
1062 0 elsif ($char =~ /\A [.|)] \z/oxms) {
1063 0 $char = '\\' . $char;
1064 }
1065 }
1066  
1067 # [...]
1068 0 splice @char, $left, $right-$left+1, '(?:' . join('|', @charlist) . ')';
1069  
1070 0 $i = $left;
1071 0 last;
1072 }
1073 }
1074 }
1075  
1076 # open character class [^...]
1077 elsif ($char[$i] eq '[^') {
1078 0 my $left = $i;
1079  
1080 # [^] make die "unmatched [] in regexp ...\n"
1081  
1082 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
1083 0 $i++;
1084 }
1085  
1086 0 while (1) {
1087 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
1088 0 croak "Unmatched [] in regexp";
1089 }
1090 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
1091 0 my $right = $i;
1092 0 my @charlist = charlist_not_qr(@char[$left+1..$right-1], 'i');
1093  
1094 # escape character
1095 0 for my $char (@charlist) {
1096 0 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $char =~ /\A [.|)] \z/mosx }) 0 0 0
1097 }
1098  
1099 0 elsif ($char =~ /\A [.|)] \z/oxms) {
1100 0 $char = '\\' . $char;
1101 }
1102 }
1103  
1104 # [^...]
1105 0 splice @char, $left, $right-$left+1, '(?!' . join('|', @charlist) . ")(?:$your_char)";
1106  
1107 0 $i = $left;
1108 0 last;
1109 }
1110 }
1111 }
1112  
1113 # rewrite classic character class or escape character
1114 elsif (my $char = classic_character_class($char[$i])) {
1115 0 $char[$i] = $char;
1116 }
1117  
1118 # with /i modifier
1119 elsif ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) {
1120 972 my $uc = Elatin7::uc($char[$i]);
1121 972 my $fc = Elatin7::fc($char[$i]);
1122 972 ▶ if ($uc ne $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc ne $fc) 500 472 972
1123 500 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 497 3 500
1124 497 $char[$i] = '[' . $uc . $fc . ']';
1125 }
1126 else {
1127 3 $char[$i] = '(?:' . $uc . '|' . $fc . ')';
1128 }
1129 }
1130 }
1131 }
1132  
1133 # characterize
1134 11 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 972 11 983
1135 972 ▶ next if not defined $char[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $char[$i] 0 972 972
1136  
1137 972 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx }) 0 983 983
1138 }
1139  
1140 # quote character before ? + * {
1141 0 ▶ elsif (($i >= 1) and ($char[$i] =~ /\A [\?\+\*\{] \z/oxms)) {
Condition66%2/3
$i >= 1 && $char[$i] =~ /\A [\?\+\*\{] \z/mosx
!ll&&!rl&&r
119610
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
1142 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
1143 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
1144 }
1145 }
1146 }
1147  
1148 11 $string = join '', @char;
1149 }
1150  
1151 # make regexp string
1152 11 return @string;
1153 }
1154  
1155 #
1156 # classic character class ( \D \S \W \d \s \w \C \X \H \V \h \v \R \N \b \B )
1157 #
1158 2840 ▶sub Elatin7::classic_character_class {
Subroutine classic_character_class: called CC=2 SCAR=6.9
Pod undocumented
1159 2840 my($char) = @_;
1160  
1161 return {
1162 '\D' => '${Elatin7::eD}',
1163 '\S' => '${Elatin7::eS}',
1164 '\W' => '${Elatin7::eW}',
1165 '\d' => '[0-9]',
1166  
1167 # Before Perl 5.6, \s only matched the five whitespace characters
1168 # tab, newline, form-feed, carriage return, and the space character
1169 # itself, which, taken together, is the character class [\t\n\f\r ].
1170  
1171 # Vertical tabs are now whitespace
1172 # \s in a regex now matches a vertical tab in all circumstances.
1173 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
1174 # \t \n \v \f \r space
1175 # '\s' => '[\x09\x0A \x0C\x0D\x20]',
1176 # '\s' => '[\x09\x0A\x0B\x0C\x0D\x20]',
1177 '\s' => '\s',
1178  
1179 '\w' => '[0-9A-Z_a-z]',
1180 '\C' => '[\x00-\xFF]',
1181 '\X' => 'X',
1182  
1183 # \h \v \H \V
1184  
1185 # P.114 Character Class Shortcuts
1186 # in Chapter 7: In the World of Regular Expressions
1187 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
1188  
1189 # P.357 13.2.3 Whitespace
1190 # in Chapter 13: perlrecharclass: Perl Regular Expression Character Classes
1191 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
1192 #
1193 # 0x00009 CHARACTER TABULATION h s
1194 # 0x0000a LINE FEED (LF) vs
1195 # 0x0000b LINE TABULATION v
1196 # 0x0000c FORM FEED (FF) vs
1197 # 0x0000d CARRIAGE RETURN (CR) vs
1198 # 0x00020 SPACE h s
1199  
1200 # P.196 Table 5-9. Alphanumeric regex metasymbols
1201 # in Chapter 5. Pattern Matching
1202 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1203  
1204 # (and so on)
1205  
1206 '\H' => '${Elatin7::eH}',
1207 '\V' => '${Elatin7::eV}',
1208 '\h' => '[\x09\x20]',
1209 '\v' => '[\x0A\x0B\x0C\x0D]',
1210 '\R' => '${Elatin7::eR}',
1211  
1212 # \N
1213 #
1214 # http://perldoc.perl.org/perlre.html
1215 # Character Classes and other Special Escapes
1216 # Any character but \n (experimental). Not affected by /s modifier
1217  
1218 '\N' => '${Elatin7::eN}',
1219  
1220 # \b \B
1221  
1222 # P.180 Boundaries: The \b and \B Assertions
1223 # in Chapter 5: Pattern Matching
1224 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
1225  
1226 # P.219 Boundaries: The \b and \B Assertions
1227 # in Chapter 5: Pattern Matching
1228 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1229  
1230 # \b really means (?:(?<=\w)(?!\w)|(?<!\w)(?=\w))
1231 # or (?:(?<=\A|\W)(?=\w)|(?<=\w)(?=\W|\z))
1232 '\b' => '${Elatin7::eb}',
1233  
1234 # \B really means (?:(?<=\w)(?=\w)|(?<!\w)(?!\w))
1235 # or (?:(?<=\w)(?=\w)|(?<=\W)(?=\W))
1236 '\B' => '${Elatin7::eB}',
1237  
1238 2840 ▶ }->{$char} || '';
Condition100%2/2
{'\\D', '${Elatin7::eD}', '\\S', '${Elatin7::eS}', '\\W', '${Elatin7::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin7::eH}', '\\V', '${Elatin7::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin7::eR}', '\\N', '${Elatin7::eN}', '\\b', '${Elatin7::eb}', '\\B', '${Elatin7::eB}'}->{$char} || ''
l!l
1012739
MC/DC100%1/1
{'\\D', '${Elatin7::eD}', '\\S', '${Elatin7::eS}', '\\W', '${Elatin7::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin7::eH}', '\\V', '${Elatin7::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin7::eR}', '\\N', '${Elatin7::eN}', '\\b', '${Elatin7::eb}', '\\B', '${Elatin7::eB}'}->{$char} || ''
{'\\D', '${Elatin7::eD}', '\\S', '${Elatin7::eS}', '\\W', '${Elatin7::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin7::eH}', '\\V', '${Elatin7::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin7::eR}', '\\N', '${Elatin7::eN}', '\\b', '${Elatin7::eb}', '\\B', '${Elatin7::eB}'}->{$char}
Truth table100%2/2
A
A= {'\\D', '${Elatin7::eD}', '\\S', '${Elatin7::eS}', '\\W', '${Elatin7::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Elatin7::eH}', '\\V', '${Elatin7::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Elatin7::eR}', '\\N', '${Elatin7::eN}', '\\b', '${Elatin7::eb}', '\\B', '${Elatin7::eB}'}->{$char}
Aresult
11
00
1239 }
1240  
1241 #
1242 # prepare Latin-7 characters per length
1243 #
1244  
1245 # 1 octet characters
1246 422 my @chars1 = ();
1247 0 ▶sub chars1 {
Subroutine chars1: not called CC=5 SCAR=34.0
Pod undocumented
1248 0 ▶ if (@chars1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars1) 0 0 0
1249 0 return @chars1;
1250 }
1251 0 ▶ if (exists $range_tr{1}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{1}) 0 0 0
1252 0 my @ranges = @{ $range_tr{1} };
1253 0 ▶ while (my @range = splice(@ranges,0,1)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 1)) 0 0 0
1254 0 for my $oct0 (@{$range[0]}) {
1255 0 push @chars1, pack 'C', $oct0;
1256 }
1257 }
1258 }
1259 0 return @chars1;
1260 }
1261  
1262 # 2 octets characters
1263 422 my @chars2 = ();
1264 0 ▶sub chars2 {
Subroutine chars2: not called CC=6 SCAR=37.4
Pod undocumented
1265 0 ▶ if (@chars2) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars2) 0 0 0
1266 0 return @chars2;
1267 }
1268 0 ▶ if (exists $range_tr{2}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{2}) 0 0 0
1269 0 my @ranges = @{ $range_tr{2} };
1270 0 ▶ while (my @range = splice(@ranges,0,2)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 2)) 0 0 0
1271 0 for my $oct0 (@{$range[0]}) {
1272 0 for my $oct1 (@{$range[1]}) {
1273 0 push @chars2, pack 'CC', $oct0,$oct1;
1274 }
1275 }
1276 }
1277 }
1278 0 return @chars2;
1279 }
1280  
1281 # 3 octets characters
1282 422 my @chars3 = ();
1283 0 ▶sub chars3 {
Subroutine chars3: not called CC=7 SCAR=40.3
Pod undocumented
1284 0 ▶ if (@chars3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars3) 0 0 0
1285 0 return @chars3;
1286 }
1287 0 ▶ if (exists $range_tr{3}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{3}) 0 0 0
1288 0 my @ranges = @{ $range_tr{3} };
1289 0 ▶ while (my @range = splice(@ranges,0,3)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 3)) 0 0 0
1290 0 for my $oct0 (@{$range[0]}) {
1291 0 for my $oct1 (@{$range[1]}) {
1292 0 for my $oct2 (@{$range[2]}) {
1293 0 push @chars3, pack 'CCC', $oct0,$oct1,$oct2;
1294 }
1295 }
1296 }
1297 }
1298 }
1299 0 return @chars3;
1300 }
1301  
1302 # 4 octets characters
1303 422 my @chars4 = ();
1304 0 ▶sub chars4 {
Subroutine chars4: not called CC=8 SCAR=42.8
Pod undocumented
1305 0 ▶ if (@chars4) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars4) 0 0 0
1306 0 return @chars4;
1307 }
1308 0 ▶ if (exists $range_tr{4}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{4}) 0 0 0
1309 0 my @ranges = @{ $range_tr{4} };
1310 0 ▶ while (my @range = splice(@ranges,0,4)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 4)) 0 0 0
1311 0 for my $oct0 (@{$range[0]}) {
1312 0 for my $oct1 (@{$range[1]}) {
1313 0 for my $oct2 (@{$range[2]}) {
1314 0 for my $oct3 (@{$range[3]}) {
1315 0 push @chars4, pack 'CCCC', $oct0,$oct1,$oct2,$oct3;
1316 }
1317 }
1318 }
1319 }
1320 }
1321 }
1322 0 return @chars4;
1323 }
1324  
1325 #
1326 # Latin-7 open character list for tr
1327 #
1328 12 ▶sub _charlist_tr {
Subroutine _charlist_tr: called CC=35 SCAR=66.4
1329  
1330 12 local $_ = shift @_;
1331  
1332 # unescape character
1333 12 my @char = ();
1334 12 ▶ while (not /\G \z/oxmsgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgmosx) 38 12 50
1335 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 \\ ($Elatin7::q_char) /cgmosx) { } 0 38 38
elsif (/\G ($Elatin7::q_char) /cgmosx) { } 38 0 38
1336 0 push @char, '\-';
1337 }
1338 elsif (/\G \\ ([0-7]{2,3}) /oxmsgc) {
1339 0 push @char, CORE::chr(oct $1);
1340 }
1341 elsif (/\G \\x ([0-9A-Fa-f]{1,2}) /oxmsgc) {
1342 0 push @char, CORE::chr(hex $1);
1343 }
1344 elsif (/\G \\c ([\x40-\x5F]) /oxmsgc) {
1345 0 push @char, CORE::chr(CORE::ord($1) & 0x1F);
1346 }
1347 elsif (/\G (\\ [0nrtfbae]) /oxmsgc) {
1348 push @char, {
1349 '\0' => "\0",
1350 '\n' => "\n",
1351 '\r' => "\r",
1352 '\t' => "\t",
1353 '\f' => "\f",
1354 '\b' => "\x08", # \b means backspace in character class
1355 '\a' => "\a",
1356 '\e' => "\e",
1357 0 }->{$1};
1358 }
1359 elsif (/\G \\ ($q_char) /oxmsgc) {
1360 0 push @char, $1;
1361 }
1362 elsif (/\G ($q_char) /oxmsgc) {
1363 38 push @char, $1;
1364 }
1365 }
1366  
1367 # join separated multiple-octet
1368 12 @char = join('',@char) =~ /\G (?>\\-|$q_char) /oxmsg;
1369  
1370 # unescape '-'
1371 12 my @i = ();
1372 12 for my $i (0 .. $#char) {
1373 38 ▶ if ($char[$i] eq '\-') {
Branch: 2 branches
BranchTrueFalseTotal
if ($char[$i] eq '\\-') { } 0 38 38
elsif ($char[$i] eq '-') { } 0 38 38
1374 0 $char[$i] = '-';
1375 }
1376 elsif ($char[$i] eq '-') {
1377 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
1378 0 push @i, $i;
1379 }
1380 }
1381 }
1382  
1383 # open character list (reverse for splice)
1384 12 for my $i (CORE::reverse @i) {
1385 0 my @range = ();
1386  
1387 # range error
1388 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
1389 0 croak "Invalid tr/// range \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1390 }
1391  
1392 # range of multiple-octet code
1393 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
1394 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
1395 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
1396 }
1397 elsif (CORE::length($char[$i+1]) == 2) {
1398 0 push @range, grep {$char[$i-1] le $_} chars1();
1399 0 push @range, grep {$_ le $char[$i+1]} chars2();
1400 }
1401 elsif (CORE::length($char[$i+1]) == 3) {
1402 0 push @range, grep {$char[$i-1] le $_} chars1();
1403 0 push @range, chars2();
1404 0 push @range, grep {$_ le $char[$i+1]} chars3();
1405 }
1406 elsif (CORE::length($char[$i+1]) == 4) {
1407 0 push @range, grep {$char[$i-1] le $_} chars1();
1408 0 push @range, chars2();
1409 0 push @range, chars3();
1410 0 push @range, grep {$_ le $char[$i+1]} chars4();
1411 }
1412 else {
1413 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1414 }
1415 }
1416 elsif (CORE::length($char[$i-1]) == 2) {
1417 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
1418 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
1419 }
1420 elsif (CORE::length($char[$i+1]) == 3) {
1421 0 push @range, grep {$char[$i-1] le $_} 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 $_} chars2();
1426 0 push @range, chars3();
1427 0 push @range, grep {$_ le $char[$i+1]} chars4();
1428 }
1429 else {
1430 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1431 }
1432 }
1433 elsif (CORE::length($char[$i-1]) == 3) {
1434 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
1435 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
1436 }
1437 elsif (CORE::length($char[$i+1]) == 4) {
1438 0 push @range, grep {$char[$i-1] le $_} chars3();
1439 0 push @range, grep {$_ le $char[$i+1]} chars4();
1440 }
1441 else {
1442 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1443 }
1444 }
1445 elsif (CORE::length($char[$i-1]) == 4) {
1446 0 ▶ if (CORE::length($char[$i+1]) == 4) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $char[$i + 1] == 4) { } 0 0 0
1447 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
1448 }
1449 else {
1450 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1451 }
1452 }
1453 else {
1454 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1455 }
1456  
1457 0 splice @char, $i-1, 3, @range;
1458 }
1459  
1460 12 return @char;
1461 }
1462  
1463 #
1464 # Latin-7 open character class
1465 #
1466 0 ▶sub _cc {
Subroutine _cc: not called CC=7 SCAR=40.3
1467 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
1468 0 die __FILE__, ": subroutine cc got no parameter.\n";
1469 }
1470 elsif (scalar(@_) == 1) {
1471 0 return sprintf('\x%02X',$_[0]);
1472 }
1473 elsif (scalar(@_) == 2) {
1474 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
1475 0 die __FILE__, ": subroutine cc got \$_[0] > \$_[1] parameters).\n";
1476 }
1477 elsif ($_[0] == $_[1]) {
1478 0 return sprintf('\x%02X',$_[0]);
1479 }
1480 elsif (($_[0]+1) == $_[1]) {
1481 0 return sprintf('[\\x%02X\\x%02X]',$_[0],$_[1]);
1482 }
1483 else {
1484 0 return sprintf('[\\x%02X-\\x%02X]',$_[0],$_[1]);
1485 }
1486 }
1487 else {
1488 0 die __FILE__, ": subroutine cc got 3 or more parameters (@{[scalar(@_)]} parameters).\n";
1489 }
1490 }
1491  
1492 #
1493 # Latin-7 octet range
1494 #
1495 246 ▶sub _octets {
Subroutine _octets: called CC=5 SCAR=19.3
1496 246 my $length = shift @_;
1497  
1498 246 ▶ if ($length == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length == 1) { } 246 0 246
1499 246 my($a1) = unpack 'C', $_[0];
1500 246 my($z1) = unpack 'C', $_[1];
1501  
1502 246 ▶ if ($a1 > $z1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($a1 > $z1) 0 246 246
1503 0 croak 'Invalid [] range in regexp (CORE::ord(A) > CORE::ord(B)) ' . '\x' . unpack('H*',$a1) . '-\x' . unpack('H*',$z1);
1504 }
1505  
1506 246 ▶ if ($a1 == $z1) {
Branch: 2 branches
BranchTrueFalseTotal
if ($a1 == $z1) { } 0 246 246
elsif ($a1 + 1 == $z1) { } 0 246 246
1507 0 return sprintf('\x%02X',$a1);
1508 }
1509 elsif (($a1+1) == $z1) {
1510 0 return sprintf('\x%02X\x%02X',$a1,$z1);
1511 }
1512 else {
1513 246 return sprintf('\x%02X-\x%02X',$a1,$z1);
1514 }
1515 }
1516 else {
1517 0 die __FILE__, ": subroutine _octets got invalid length ($length).\n";
1518 }
1519 }
1520  
1521 #
1522 # Latin-7 range regexp
1523 #
1524 246 ▶sub _range_regexp {
Subroutine _range_regexp: called CC=18 SCAR=41.7
1525 246 my($length,$first,$last) = @_;
1526  
1527 246 my @range_regexp = ();
1528 246 ▶ if (not exists $range_tr{$length}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $range_tr{$length}) 0 246 246
1529 0 return @range_regexp;
1530 }
1531  
1532 246 my @ranges = @{ $range_tr{$length} };
1533 246 ▶ while (my @range = splice(@ranges,0,$length)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, $length)) 246 246 492
1534 246 my $min = '';
1535 246 my $max = '';
1536 246 ▶ for (my $i=0; $i < $length; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $length) 246 246 492
1537 246 $min .= pack 'C', $range[$i][0];
1538 246 $max .= pack 'C', $range[$i][-1];
1539 }
1540  
1541 # min___max
1542 # FIRST_____________LAST
1543 # (nothing)
1544  
1545 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
1546 }
1547  
1548 # **********
1549 # min_________max
1550 # FIRST_____________LAST
1551 # **********
1552  
1553 ▶ 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
1554 0 push @range_regexp, _octets($length,$first,$max,$min,$max);
1555 }
1556  
1557 # **********************
1558 # min________________max
1559 # FIRST_____________LAST
1560 # **********************
1561  
1562 ▶ 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
1563 0 push @range_regexp, _octets($length,$first,$last,$min,$max);
1564 }
1565  
1566 # *********
1567 # min___max
1568 # FIRST_____________LAST
1569 # *********
1570  
1571 ▶ 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
1572 0 push @range_regexp, _octets($length,$min,$max,$min,$max);
1573 }
1574  
1575 # **********************
1576 # min__________________________max
1577 # FIRST_____________LAST
1578 # **********************
1579  
1580 ▶ 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
1581 246 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 ($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
1590 0 push @range_regexp, _octets($length,$min,$last,$min,$max);
1591 }
1592  
1593 # min___max
1594 # FIRST_____________LAST
1595 # (nothing)
1596  
1597 elsif ($last lt $min) {
1598 }
1599  
1600 else {
1601 0 die __FILE__, ": subroutine _range_regexp panic.\n";
1602 }
1603 }
1604  
1605 246 return @range_regexp;
1606 }
1607  
1608 #
1609 # Latin-7 open character list for qr and not qr
1610 #
1611 650 ▶sub _charlist {
Subroutine _charlist: called CC=46 SCAR=45.9
1612  
1613 650 my $modifier = pop @_;
1614 650 my @char = @_;
1615  
1616 650 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 298 352 650
1617  
1618 # unescape character
1619 650 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1773 650 2423
1620  
1621 # escape - to ...
1622 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 \\ ($Elatin7::q_char) \z/mosx) { } 7 1371 1378
1623 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
1624 246 $char[$i] = '...';
1625 }
1626 }
1627  
1628 # octal escape sequence
1629 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
1630 0 $char[$i] = octchr($1);
1631 }
1632  
1633 # hexadecimal escape sequence
1634 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
1635 0 $char[$i] = hexchr($1);
1636 }
1637  
1638 # \b{...} --> b\{...}
1639 # \B{...} --> B\{...}
1640 # \N{CHARNAME} --> N\{CHARNAME}
1641 # \p{PROPERTY} --> p\{PROPERTY}
1642 # \P{PROPERTY} --> P\{PROPERTY}
1643 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
1644 0 $char[$i] = $1 . '\\' . $2;
1645 }
1646  
1647 # \p, \P, \X --> p, P, X
1648 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
1649 0 $char[$i] = $1;
1650 }
1651  
1652 elsif ($char[$i] =~ /\A \\ ([0-7]{2,3}) \z/oxms) {
1653 0 $char[$i] = CORE::chr oct $1;
1654 }
1655 elsif ($char[$i] =~ /\A \\x ([0-9A-Fa-f]{1,2}) \z/oxms) {
1656 22 $char[$i] = CORE::chr hex $1;
1657 }
1658 elsif ($char[$i] =~ /\A \\c ([\x40-\x5F]) \z/oxms) {
1659 0 $char[$i] = CORE::chr(CORE::ord($1) & 0x1F);
1660 }
1661 elsif ($char[$i] =~ /\A (\\ [0nrtfbaedswDSWHVhvR]) \z/oxms) {
1662 $char[$i] = {
1663 '\0' => "\0",
1664 '\n' => "\n",
1665 '\r' => "\r",
1666 '\t' => "\t",
1667 '\f' => "\f",
1668 '\b' => "\x08", # \b means backspace in character class
1669 '\a' => "\a",
1670 '\e' => "\e",
1671 '\d' => '[0-9]',
1672  
1673 # Vertical tabs are now whitespace
1674 # \s in a regex now matches a vertical tab in all circumstances.
1675 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
1676 # \t \n \v \f \r space
1677 # '\s' => '[\x09\x0A \x0C\x0D\x20]',
1678 # '\s' => '[\x09\x0A\x0B\x0C\x0D\x20]',
1679 '\s' => '\s',
1680  
1681 '\w' => '[0-9A-Z_a-z]',
1682 '\D' => '${Elatin7::eD}',
1683 '\S' => '${Elatin7::eS}',
1684 '\W' => '${Elatin7::eW}',
1685  
1686 '\H' => '${Elatin7::eH}',
1687 '\V' => '${Elatin7::eV}',
1688 '\h' => '[\x09\x20]',
1689 '\v' => '[\x0A\x0B\x0C\x0D]',
1690 '\R' => '${Elatin7::eR}',
1691  
1692 25 }->{$1};
1693 }
1694  
1695 # POSIX-style character classes
1696 ▶ 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
1697 $char[$i] = {
1698  
1699 '[:lower:]' => '[\x41-\x5A\x61-\x7A]',
1700 '[:upper:]' => '[\x41-\x5A\x61-\x7A]',
1701 '[:^lower:]' => '${Elatin7::not_lower_i}',
1702 '[:^upper:]' => '${Elatin7::not_upper_i}',
1703  
1704 8 }->{$1};
1705 }
1706 elsif ($char[$i] =~ /\A ( \[\: \^? (?:alnum|alpha|ascii|blank|cntrl|digit|graph|lower|print|punct|space|upper|word|xdigit) :\] ) \z/oxms) {
1707 $char[$i] = {
1708  
1709 '[:alnum:]' => '[\x30-\x39\x41-\x5A\x61-\x7A]',
1710 '[:alpha:]' => '[\x41-\x5A\x61-\x7A]',
1711 '[:ascii:]' => '[\x00-\x7F]',
1712 '[:blank:]' => '[\x09\x20]',
1713 '[:cntrl:]' => '[\x00-\x1F\x7F]',
1714 '[:digit:]' => '[\x30-\x39]',
1715 '[:graph:]' => '[\x21-\x7F]',
1716 '[:lower:]' => '[\x61-\x7A]',
1717 '[:print:]' => '[\x20-\x7F]',
1718 '[:punct:]' => '[\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E]',
1719  
1720 # P.174 POSIX-Style Character Classes
1721 # in Chapter 5: Pattern Matching
1722 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
1723  
1724 # P.311 11.2.4 Character Classes and other Special Escapes
1725 # in Chapter 11: perlre: Perl regular expressions
1726 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
1727  
1728 # P.210 POSIX-Style Character Classes
1729 # in Chapter 5: Pattern Matching
1730 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1731  
1732 '[:space:]' => '[\s\x0B]', # "\s" plus vertical tab ("\cK")
1733  
1734 '[:upper:]' => '[\x41-\x5A]',
1735 '[:word:]' => '[\x30-\x39\x41-\x5A\x5F\x61-\x7A]',
1736 '[:xdigit:]' => '[\x30-\x39\x41-\x46\x61-\x66]',
1737 '[:^alnum:]' => '${Elatin7::not_alnum}',
1738 '[:^alpha:]' => '${Elatin7::not_alpha}',
1739 '[:^ascii:]' => '${Elatin7::not_ascii}',
1740 '[:^blank:]' => '${Elatin7::not_blank}',
1741 '[:^cntrl:]' => '${Elatin7::not_cntrl}',
1742 '[:^digit:]' => '${Elatin7::not_digit}',
1743 '[:^graph:]' => '${Elatin7::not_graph}',
1744 '[:^lower:]' => '${Elatin7::not_lower}',
1745 '[:^print:]' => '${Elatin7::not_print}',
1746 '[:^punct:]' => '${Elatin7::not_punct}',
1747 '[:^space:]' => '${Elatin7::not_space}',
1748 '[:^upper:]' => '${Elatin7::not_upper}',
1749 '[:^word:]' => '${Elatin7::not_word}',
1750 '[:^xdigit:]' => '${Elatin7::not_xdigit}',
1751  
1752 70 }->{$1};
1753 }
1754 elsif ($char[$i] =~ /\A \\ ($q_char) \z/oxms) {
1755 7 $char[$i] = $1;
1756 }
1757 }
1758  
1759 # open character list
1760 650 my @singleoctet = ();
1761 650 my @multipleoctet = ();
1762 650 ▶ for (my $i=0; $i <= $#char; ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1527 650 2177
1763  
1764 # escaped -
1765 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
1766 246 $i += 1;
1767 246 next;
1768 }
1769  
1770 # make range regexp
1771 elsif ($char[$i] eq '...') {
1772  
1773 # range error
1774 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
1775 0 croak 'Invalid [] range in regexp (length(A) > length(B)) ' . '\x' . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]);
1776 }
1777 elsif (CORE::length($char[$i-1]) == CORE::length($char[$i+1])) {
1778 246 ▶ if ($char[$i-1] gt $char[$i+1]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i - 1] gt $char[$i + 1]) 0 246 246
1779 0 croak 'Invalid [] range in regexp (CORE::ord(A) > CORE::ord(B)) ' . '\x' . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]);
1780 }
1781 }
1782  
1783 # make range regexp per length
1784 246 for my $length (CORE::length($char[$i-1]) .. CORE::length($char[$i+1])) {
1785 246 my @regexp = ();
1786  
1787 # is first and last
1788 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
1789 246 push @regexp, _range_regexp($length, $char[$i-1], $char[$i+1]);
1790 }
1791  
1792 # is first
1793 elsif ($length == CORE::length($char[$i-1])) {
1794 0 push @regexp, _range_regexp($length, $char[$i-1], "\xFF" x $length);
1795 }
1796  
1797 # is inside in first and last
1798 ▶ 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
1799 0 push @regexp, _range_regexp($length, "\x00" x $length, "\xFF" x $length);
1800 }
1801  
1802 # is last
1803 elsif ($length == CORE::length($char[$i+1])) {
1804 0 push @regexp, _range_regexp($length, "\x00" x $length, $char[$i+1]);
1805 }
1806  
1807 else {
1808 0 die __FILE__, ": subroutine make_regexp panic.\n";
1809 }
1810  
1811 246 ▶ if ($length == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length == 1) { } 246 0 246
1812 246 push @singleoctet, @regexp;
1813 }
1814 else {
1815 0 push @multipleoctet, @regexp;
1816 }
1817 }
1818  
1819 246 $i += 2;
1820 }
1821  
1822 # with /i modifier
1823 elsif ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) {
1824 949 ▶ if ($modifier =~ /i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) { } 480 469 949
1825 480 my $uc = Elatin7::uc($char[$i]);
1826 480 my $fc = Elatin7::fc($char[$i]);
1827 480 ▶ if ($uc ne $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc ne $fc) { } 240 240 480
1828 240 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 240 0 240
1829 240 push @singleoctet, $uc, $fc;
1830 }
1831 else {
1832 0 push @singleoctet, $uc;
1833 0 push @multipleoctet, $fc;
1834 }
1835 }
1836 else {
1837 240 push @singleoctet, $char[$i];
1838 }
1839 }
1840 else {
1841 469 push @singleoctet, $char[$i];
1842 }
1843 949 $i += 1;
1844 }
1845  
1846 # single character of single octet code
1847 elsif ($char[$i] =~ /\A (?: \\h ) \z/oxms) {
1848 0 push @singleoctet, "\t", "\x20";
1849 0 $i += 1;
1850 }
1851 elsif ($char[$i] =~ /\A (?: \\v ) \z/oxms) {
1852 0 push @singleoctet, "\x0A", "\x0B", "\x0C", "\x0D";
1853 0 $i += 1;
1854 }
1855 elsif ($char[$i] =~ /\A (?: \\d | \\s | \\w ) \z/oxms) {
1856 2 push @singleoctet, $char[$i];
1857 2 $i += 1;
1858 }
1859  
1860 # single character of multiple-octet code
1861 else {
1862 84 push @multipleoctet, $char[$i];
1863 84 $i += 1;
1864 }
1865 }
1866  
1867 # quote metachar
1868 650 for (@singleoctet) {
1869 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
1870 0 $_ = '-';
1871 }
1872 elsif (/\A \n \z/oxms) {
1873 8 $_ = '\n';
1874 }
1875 elsif (/\A \r \z/oxms) {
1876 8 $_ = '\r';
1877 }
1878 elsif (/\A ([\x00-\x20\x7F-\xFF]) \z/oxms) {
1879 744 $_ = sprintf('\x%02X', CORE::ord $1);
1880 }
1881 elsif (/\A [\x00-\xFF] \z/oxms) {
1882 429 $_ = quotemeta $_;
1883 }
1884 }
1885  
1886 # return character list
1887 650 return \@singleoctet, \@multipleoctet;
1888 }
1889  
1890 #
1891 # Latin-7 octal escape sequence
1892 #
1893 5 ▶sub octchr {
Subroutine octchr: called CC=2 SCAR=6.9
Pod undocumented
1894 5 my($octdigit) = @_;
1895  
1896 5 my @binary = ();
1897 5 for my $octal (split(//,$octdigit)) {
1898 push @binary, {
1899 '0' => '000',
1900 '1' => '001',
1901 '2' => '010',
1902 '3' => '011',
1903 '4' => '100',
1904 '5' => '101',
1905 '6' => '110',
1906 '7' => '111',
1907 50 }->{$octal};
1908 }
1909 5 my $binary = join '', @binary;
1910  
1911 my $octchr = {
1912 # 1234567
1913 1 => pack('B*', "0000000$binary"),
1914 2 => pack('B*', "000000$binary"),
1915 3 => pack('B*', "00000$binary"),
1916 4 => pack('B*', "0000$binary"),
1917 5 => pack('B*', "000$binary"),
1918 6 => pack('B*', "00$binary"),
1919 7 => pack('B*', "0$binary"),
1920 0 => pack('B*', "$binary"),
1921  
1922 5 }->{CORE::length($binary) % 8};
1923  
1924 5 return $octchr;
1925 }
1926  
1927 #
1928 # Latin-7 hexadecimal escape sequence
1929 #
1930 5 ▶sub hexchr {
Subroutine hexchr: called CC=1 SCAR=0.0
Pod undocumented
1931 5 my($hexdigit) = @_;
1932  
1933 my $hexchr = {
1934 1 => pack('H*', "0$hexdigit"),
1935 0 => pack('H*', "$hexdigit"),
1936  
1937 5 }->{CORE::length($_[0]) % 2};
1938  
1939 5 return $hexchr;
1940 }
1941  
1942 #
1943 # Latin-7 open character list for qr
1944 #
1945 576 ▶sub charlist_qr {
Subroutine charlist_qr: called CC=17 SCAR=28.7
Pod undocumented
1946  
1947 576 my $modifier = pop @_;
1948 576 my @char = @_;
1949  
1950 576 my($singleoctet, $multipleoctet) = _charlist(@char, $modifier);
1951 576 my @singleoctet = @$singleoctet;
1952 576 my @multipleoctet = @$multipleoctet;
1953  
1954 # return character list
1955 576 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) 498 78 576
1956  
1957 # with /i modifier
1958 498 ▶ if ($modifier =~ m/i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) 265 233 498
1959 265 my %singleoctet_ignorecase = ();
1960 265 for (@singleoctet) {
1961 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
1962 745 for my $ord (hex($1) .. hex($2)) {
1963 795 my $char = CORE::chr($ord);
1964 795 my $uc = Elatin7::uc($char);
1965 795 my $fc = Elatin7::fc($char);
1966 795 ▶ if ($uc eq $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc eq $fc) { } 240 555 795
1967 240 $singleoctet_ignorecase{unpack 'C*', $char} = 1;
1968 }
1969 else {
1970 555 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 555 0 555
1971 555 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
1972 555 $singleoctet_ignorecase{unpack 'C*', $fc} = 1;
1973 }
1974 else {
1975 0 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
1976 0 push @multipleoctet, join '', map {sprintf('\x%02X',$_)} unpack 'C*', $fc;
1977 }
1978 }
1979 }
1980 }
1981 745 ▶ if ($_ ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ ne "") 0 745 745
1982 0 $singleoctet_ignorecase{unpack 'C*', $_} = 1;
1983 }
1984 }
1985 265 my $i = 0;
1986 265 my @singleoctet_ignorecase = ();
1987 265 for my $ord (0 .. 255) {
1988 67840 ▶ if (exists $singleoctet_ignorecase{$ord}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $singleoctet_ignorecase{$ord}) { } 870 66970 67840
1989 870 push @{$singleoctet_ignorecase[$i]}, $ord;
1990 }
1991 else {
1992 66970 $i++;
1993 }
1994 }
1995 265 @singleoctet = ();
1996 265 for my $range (@singleoctet_ignorecase) {
1997 56160 ▶ if (ref $range) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $range) 770 55390 56160
1998 770 ▶ if (scalar(@{$range}) == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @{$range;} == 1) { } 720 50 770
elsif (scalar @{$range;} == 2) { } 0 50 50
1999 720 push @singleoctet, sprintf('\x%02X', @{$range}[0]);
2000 }
2001 50 elsif (scalar(@{$range}) == 2) {
2002 0 push @singleoctet, sprintf('\x%02X\x%02X', @{$range}[0], @{$range}[-1]);
2003 }
2004 else {
2005 50 push @singleoctet, sprintf('\x%02X-\x%02X', @{$range}[0], @{$range}[-1]);
2006 }
2007 }
2008 }
2009 }
2010  
2011 498 my $not_anchor = '';
2012  
2013 498 push @multipleoctet, join('', $not_anchor, '[', @singleoctet, ']' );
2014 }
2015 576 ▶ if (scalar(@multipleoctet) >= 2) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @multipleoctet >= 2) { } 6 570 576
2016 6 return '(?:' . join('|', @multipleoctet) . ')';
2017 }
2018 else {
2019 570 return $multipleoctet[0];
2020 }
2021 }
2022  
2023 #
2024 # Latin-7 open character list for not qr
2025 #
2026 74 ▶sub charlist_not_qr {
Subroutine charlist_not_qr: called CC=18 SCAR=33.1
Pod undocumented
2027  
2028 74 my $modifier = pop @_;
2029 74 my @char = @_;
2030  
2031 74 my($singleoctet, $multipleoctet) = _charlist(@char, $modifier);
2032 74 my @singleoctet = @$singleoctet;
2033 74 my @multipleoctet = @$multipleoctet;
2034  
2035 # with /i modifier
2036 74 ▶ if ($modifier =~ m/i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) 25 49 74
2037 25 my %singleoctet_ignorecase = ();
2038 25 for (@singleoctet) {
2039 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
2040 25 for my $ord (hex($1) .. hex($2)) {
2041 75 my $char = CORE::chr($ord);
2042 75 my $uc = Elatin7::uc($char);
2043 75 my $fc = Elatin7::fc($char);
2044 75 ▶ if ($uc eq $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc eq $fc) { } 0 75 75
2045 0 $singleoctet_ignorecase{unpack 'C*', $char} = 1;
2046 }
2047 else {
2048 75 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 75 0 75
2049 75 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2050 75 $singleoctet_ignorecase{unpack 'C*', $fc} = 1;
2051 }
2052 else {
2053 0 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
2054 0 push @multipleoctet, join '', map {sprintf('\x%02X',$_)} unpack 'C*', $fc;
2055 }
2056 }
2057 }
2058 }
2059 25 ▶ if ($_ ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ ne "") 0 25 25
2060 0 $singleoctet_ignorecase{unpack 'C*', $_} = 1;
2061 }
2062 }
2063 25 my $i = 0;
2064 25 my @singleoctet_ignorecase = ();
2065 25 for my $ord (0 .. 255) {
2066 6400 ▶ if (exists $singleoctet_ignorecase{$ord}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $singleoctet_ignorecase{$ord}) { } 150 6250 6400
2067 150 push @{$singleoctet_ignorecase[$i]}, $ord;
2068 }
2069 else {
2070 6250 $i++;
2071 }
2072 }
2073 25 @singleoctet = ();
2074 25 for my $range (@singleoctet_ignorecase) {
2075 2400 ▶ if (ref $range) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $range) 50 2350 2400
2076 50 ▶ if (scalar(@{$range}) == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @{$range;} == 1) { } 0 50 50
elsif (scalar @{$range;} == 2) { } 0 50 50
2077 0 push @singleoctet, sprintf('\x%02X', @{$range}[0]);
2078 }
2079 50 elsif (scalar(@{$range}) == 2) {
2080 0 push @singleoctet, sprintf('\x%02X\x%02X', @{$range}[0], @{$range}[-1]);
2081 }
2082 else {
2083 50 push @singleoctet, sprintf('\x%02X-\x%02X', @{$range}[0], @{$range}[-1]);
2084 }
2085 }
2086 }
2087 }
2088  
2089 # return character list
2090 74 ▶ if (scalar(@multipleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @multipleoctet >= 1) { } 0 74 74
2091 0 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) { } 0 0 0
2092  
2093 # any character other than multiple-octet and single octet character class
2094 0 return '(?!' . join('|', @multipleoctet) . ')(?:[^' . join('', @singleoctet) . '])';
2095 }
2096 else {
2097  
2098 # any character other than multiple-octet character class
2099 0 return '(?!' . join('|', @multipleoctet) . ")(?:$your_char)";
2100 }
2101 }
2102 else {
2103 74 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) { } 74 0 74
2104  
2105 # any character other than single octet character class
2106 74 return '(?:[^' . join('', @singleoctet) . '])';
2107 }
2108 else {
2109  
2110 # any character
2111 0 return "(?:$your_char)";
2112 }
2113 }
2114 }
2115  
2116 #
2117 # open file in read mode
2118 #
2119 422 ▶sub _open_r {
Subroutine _open_r: called CC=1 SCAR=0.0
2120 422 my(undef,$file) = @_;
2121 422 ▶ use Fcntl qw(O_RDONLY);
Subroutine BEGIN: called CC=1 SCAR=0.0
2122 422 return CORE::sysopen($_[0], $file, &O_RDONLY);
2123 }
2124  
2125 #
2126 # open file in append mode
2127 #
2128 211 ▶sub _open_a {
Subroutine _open_a: called CC=1 SCAR=0.0
2129 211 my(undef,$file) = @_;
2130 422 ▶ use Fcntl qw(O_WRONLY O_APPEND O_CREAT);
Subroutine BEGIN: called CC=1 SCAR=0.0
2131 211 return CORE::sysopen($_[0], $file, &O_WRONLY|&O_APPEND|&O_CREAT);
2132 }
2133  
2134 #
2135 # safe system
2136 #
2137 211 ▶sub _systemx {
Subroutine _systemx: called CC=1 SCAR=0.0
2138  
2139 # P.707 29.2.33. exec
2140 # in Chapter 29: Functions
2141 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2142 #
2143 # Be aware that in older releases of Perl, exec (and system) did not flush
2144 # your output buffer, so you needed to enable command buffering by setting $|
2145 # on one or more filehandles to avoid lost output in the case of exec, or
2146 # misordererd output in the case of system. This situation was largely remedied
2147 # in the 5.6 release of Perl. (So, 5.005 release not yet.)
2148  
2149 # P.855 exec
2150 # in Chapter 27: Functions
2151 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2152 #
2153 # In very old release of Perl (before v5.6), exec (and system) did not flush
2154 # your output buffer, so you needed to enable command buffering by setting $|
2155 # on one or more filehandles to avoid lost output with exec or misordered
2156 # output with system.
2157  
2158 211 $| = 1;
2159  
2160 # P.565 23.1.2. Cleaning Up Your Environment
2161 # in Chapter 23: Security
2162 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2163  
2164 # P.656 Cleaning Up Your Environment
2165 # in Chapter 20: Security
2166 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2167  
2168 # local $ENV{'PATH'} = '.';
2169 211 local @ENV{qw(IFS CDPATH ENV BASH_ENV)}; # Make %ENV safer
2170  
2171 # P.707 29.2.33. exec
2172 # in Chapter 29: Functions
2173 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2174 #
2175 # As we mentioned earlier, exec treats a discrete list of arguments as an
2176 # indication that it should bypass shell processing. However, there is one
2177 # place where you might still get tripped up. The exec call (and system, too)
2178 # will not distinguish between a single scalar argument and an array containing
2179 # only one element.
2180 #
2181 # @args = ("echo surprise"); # just one element in list
2182 # exec @args # still subject to shell escapes
2183 # or die "exec: $!"; # because @args == 1
2184 #
2185 # To avoid this, you can use the PATHNAME syntax, explicitly duplicating the
2186 # first argument as the pathname, which forces the rest of the arguments to be
2187 # interpreted as a list, even if there is only one of them:
2188 #
2189 # exec { $args[0] } @args # safe even with one-argument list
2190 # or die "can't exec @args: $!";
2191  
2192 # P.855 exec
2193 # in Chapter 27: Functions
2194 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2195 #
2196 # As we mentioned earlier, exec treats a discrete list of arguments as a
2197 # directive to bypass shell processing. However, there is one place where
2198 # you might still get tripped up. The exec call (and system, too) cannot
2199 # distinguish between a single scalar argument and an array containing
2200 # only one element.
2201 #
2202 # @args = ("echo surprise"); # just one element in list
2203 # exec @args # still subject to shell escapes
2204 # || die "exec: $!"; # because @args == 1
2205 #
2206 # To avoid this, use the PATHNAME syntax, explicitly duplicating the first
2207 # argument as the pathname, which forces the rest of the arguments to be
2208 # interpreted as a list, even if there is only one of them:
2209 #
2210 # exec { $args[0] } @args # safe even with one-argument list
2211 # || die "can't exec @args: $!";
2212  
2213 211 return CORE::system { $_[0] } @_; # safe even with one-argument list
2214 }
2215  
2216 #
2217 # Latin-7 order to character (with parameter)
2218 #
2219 3469 ▶sub Elatin7::chr(;$) {
Subroutine chr: called CC=4 SCAR=13.9
Pod undocumented
2220  
2221 3469 ▶ my $c = @_ ? $_[0] : $_;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 3469 0 3469
2222  
2223 3469 ▶ if ($c == 0x00) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c == 0) { } 24 3445 3469
2224 24 return "\x00";
2225 }
2226 else {
2227 3445 my @chr = ();
2228 3445 ▶ while ($c > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c > 0) 3445 3445 6890
2229 3445 unshift @chr, ($c % 0x100);
2230 3445 $c = int($c / 0x100);
2231 }
2232 3445 return pack 'C*', @chr;
2233 }
2234 }
2235  
2236 #
2237 # Latin-7 order to character (without parameter)
2238 #
2239 0 ▶sub Elatin7::chr_() {
Subroutine chr_: not called CC=3 SCAR=24.8
Pod undocumented
2240  
2241 0 my $c = $_;
2242  
2243 0 ▶ if ($c == 0x00) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c == 0) { } 0 0 0
2244 0 return "\x00";
2245 }
2246 else {
2247 0 my @chr = ();
2248 0 ▶ while ($c > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c > 0) 0 0 0
2249 0 unshift @chr, ($c % 0x100);
2250 0 $c = int($c / 0x100);
2251 }
2252 0 return pack 'C*', @chr;
2253 }
2254 }
2255  
2256 #
2257 # Latin-7 path globbing (with parameter)
2258 #
2259 0 ▶sub Elatin7::glob($) {
Subroutine glob: not called CC=3 SCAR=24.8
Pod undocumented
2260  
2261 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2262 0 my @glob = _DOS_like_glob(@_);
2263 0 for my $glob (@glob) {
2264 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2265 }
2266 0 return @glob;
2267 }
2268 else {
2269 0 my $glob = _DOS_like_glob(@_);
2270 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2271 0 return $glob;
2272 }
2273 }
2274  
2275 #
2276 # Latin-7 path globbing (without parameter)
2277 #
2278 0 ▶sub Elatin7::glob_() {
Subroutine glob_: not called CC=3 SCAR=24.8
Pod undocumented
2279  
2280 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2281 0 my @glob = _DOS_like_glob();
2282 0 for my $glob (@glob) {
2283 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2284 }
2285 0 return @glob;
2286 }
2287 else {
2288 0 my $glob = _DOS_like_glob();
2289 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2290 0 return $glob;
2291 }
2292 }
2293  
2294 #
2295 # Latin-7 path globbing via File::DosGlob 1.10
2296 #
2297 # Often I confuse "_dosglob" and "_doglob".
2298 # So, I renamed "_dosglob" to "_DOS_like_glob".
2299 #
2300 422 my %iter;
2301 my %entries;
2302 0 ▶sub _DOS_like_glob {
Subroutine _DOS_like_glob: not called CC=10 SCAR=47.0
2303  
2304 # context (keyed by second cxix argument provided by core)
2305 0 my($expr,$cxix) = @_;
2306  
2307 # glob without args defaults to $_
2308 0 ▶ $expr = $_ if not defined $expr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $expr 0 0 0
2309  
2310 # represents the current user's home directory
2311 #
2312 # 7.3. Expanding Tildes in Filenames
2313 # in Chapter 7. File Access
2314 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2315 #
2316 # and File::HomeDir, File::HomeDir::Windows module
2317  
2318 # DOS-like system
2319 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
2320 0 $expr =~ s{ \A ~ (?= [^/\\] ) }
2321 0 { my_home_MSWin32() }oxmse;
2322 }
2323  
2324 # UNIX-like system
2325 else {
2326 0 $expr =~ s{ \A ~ ( (?:[^/])* ) }
2327 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
2328 }
2329  
2330 # assume global context if not provided one
2331 0 ▶ $cxix = '_G_' if not defined $cxix;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $cxix 0 0 0
2332 0 ▶ $iter{$cxix} = 0 if not exists $iter{$cxix};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $iter{$cxix} 0 0 0
2333  
2334 # if we're just beginning, do it all first
2335 0 ▶ if ($iter{$cxix} == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iter{$cxix} == 0) 0 0 0
2336 0 $entries{$cxix} = [ _do_glob(1, _parse_line($expr)) ];
2337 }
2338  
2339 # chuck it all out, quick or slow
2340 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2341 0 delete $iter{$cxix};
2342 0 return @{delete $entries{$cxix}};
2343 }
2344 else {
2345 0 ▶ if ($iter{$cxix} = scalar @{$entries{$cxix}}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iter{$cxix} = scalar @{$entries{$cxix};}) { } 0 0 0
2346 0 return shift @{$entries{$cxix}};
2347 }
2348 else {
2349 # return undef for EOL
2350 0 delete $iter{$cxix};
2351 0 delete $entries{$cxix};
2352 0 return undef;
2353 }
2354 }
2355 }
2356  
2357 #
2358 # Latin-7 path globbing subroutine
2359 #
2360 0 ▶sub _do_glob {
Subroutine _do_glob: not called CC=44 SCAR=75.9
2361  
2362 0 my($cond,@expr) = @_;
2363 0 my @glob = ();
2364 0 my $fix_drive_relative_paths = 0;
2365  
2366 OUTER:
2367 0 for my $expr (@expr) {
2368 0 ▶ next OUTER if not defined $expr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $expr 0 0 0
2369 0 ▶ next OUTER if $expr eq '';
Branch: 1 branch
BranchTrueFalseTotal
if $expr eq "" 0 0 0
2370  
2371 0 my @matched = ();
2372 0 my @globdir = ();
2373 0 my $head = '.';
2374 0 my $pathsep = '/';
2375 0 my $tail;
2376  
2377 # if argument is within quotes strip em and do no globbing
2378 0 ▶ if ($expr =~ /\A " ((?:$q_char)*?) " \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expr =~ /\A " ((?:$Elatin7::q_char)*?) " \z/mosx) 0 0 0
2379 0 $expr = $1;
2380 0 ▶ if ($cond eq 'd') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cond eq 'd') { } 0 0 0
2381 0 ▶ if (-d $expr) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $expr) 0 0 0
2382 0 push @glob, $expr;
2383 }
2384 }
2385 else {
2386 0 ▶ if (-e $expr) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $expr) 0 0 0
2387 0 push @glob, $expr;
2388 }
2389 }
2390 0 next OUTER;
2391 }
2392  
2393 # wildcards with a drive prefix such as h:*.pm must be changed
2394 # to h:./*.pm to expand correctly
2395 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
2396 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
2397 0 $fix_drive_relative_paths = 1;
2398 }
2399 }
2400  
2401 0 ▶ if (($head, $tail) = _parse_path($expr,$pathsep)) {
Branch: 1 branch
BranchTrueFalseTotal
if (($head, $tail) = _parse_path($expr, $pathsep)) 0 0 0
2402 0 ▶ if ($tail eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($tail eq "") 0 0 0
2403 0 push @glob, $expr;
2404 0 next OUTER;
2405 }
2406 0 ▶ if ($head =~ / \A (?:$q_char)*? [*?] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head =~ / \A (?:$Elatin7::q_char)*? [*?] /mosx) 0 0 0
2407 0 ▶ if (@globdir = _do_glob('d', $head)) {
Branch: 1 branch
BranchTrueFalseTotal
if (@globdir = _do_glob("d", $head)) 0 0 0
2408 0 push @glob, _do_glob($cond, map {"$_$pathsep$tail"} @globdir);
2409 0 next OUTER;
2410 }
2411 }
2412 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
2413 0 $head .= $pathsep;
2414 }
2415 0 $expr = $tail;
2416 }
2417  
2418 # If file component has no wildcards, we can avoid opendir
2419 0 ▶ if ($expr !~ / \A (?:$q_char)*? [*?] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($expr =~ / \A (?:$Elatin7::q_char)*? [*?] /mosx) 0 0 0
2420 0 ▶ if ($head eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($head eq ".") 0 0 0
2421 0 $head = '';
2422 }
2423 0 ▶ if ($head ne '' and ($head =~ / \G ($q_char) /oxmsg)[-1] ne $pathsep) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head ne "" and ($head =~ / \G ($Elatin7::q_char) /gmosx)[-1] ne $pathsep) 0 0 0
Condition0%0/3
$head ne "" and ($head =~ / \G ($Elatin7::q_char) /gmosx)[-1] ne $pathsep
!ll&&!rl&&r
000
MC/DC0%0/2
$head ne "" and ($head =~ / \G ($Elatin7::q_char) /gmosx)[-1] ne $pathsep
$head ne "" ($head =~ / \G ($Elatin7::q_char) /gmosx)[-1] ne $pathsep
Truth table0%0/3
A and B
A= $head ne ""B= ($head =~ / \G ($Elatin7::q_char) /gmosx)[-1] ne $pathsep
ABresult
0X0
100
111
2424 0 $head .= $pathsep;
2425 }
2426 0 $head .= $expr;
2427 0 ▶ if ($cond eq 'd') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cond eq 'd') { } 0 0 0
2428 0 ▶ if (-d $head) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $head) 0 0 0
2429 0 push @glob, $head;
2430 }
2431 }
2432 else {
2433 0 ▶ if (-e $head) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $head) 0 0 0
2434 0 push @glob, $head;
2435 }
2436 }
2437 0 next OUTER;
2438 }
2439 0 ▶ opendir(*DIR, $head) or next OUTER;
Branch: 1 branch
BranchTrueFalseTotal
opendir *DIR, $head or next OUTER 0 0 0
2440 0 my @leaf = readdir DIR;
2441 0 closedir DIR;
2442  
2443 0 ▶ if ($head eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($head eq ".") 0 0 0
2444 0 $head = '';
2445 }
2446 0 ▶ if ($head ne '' and ($head =~ / \G ($q_char) /oxmsg)[-1] ne $pathsep) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head ne "" and ($head =~ / \G ($Elatin7::q_char) /gmosx)[-1] ne $pathsep) 0 0 0
Condition0%0/3
$head ne "" and ($head =~ / \G ($Elatin7::q_char) /gmosx)[-1] ne $pathsep
!ll&&!rl&&r
000
MC/DC0%0/2
$head ne "" and ($head =~ / \G ($Elatin7::q_char) /gmosx)[-1] ne $pathsep
$head ne "" ($head =~ / \G ($Elatin7::q_char) /gmosx)[-1] ne $pathsep
Truth table0%0/3
A and B
A= $head ne ""B= ($head =~ / \G ($Elatin7::q_char) /gmosx)[-1] ne $pathsep
ABresult
0X0
100
111
2447 0 $head .= $pathsep;
2448 }
2449  
2450 0 my $pattern = '';
2451 0 ▶ while ($expr =~ / \G ($q_char) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expr =~ / \G ($Elatin7::q_char) /cgox) 0 0 0
2452 0 my $char = $1;
2453  
2454 # 6.9. Matching Shell Globs as Regular Expressions
2455 # in Chapter 6. Pattern Matching
2456 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2457 # (and so on)
2458  
2459 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
2460 0 $pattern .= "(?:$your_char)*",
2461 }
2462 elsif ($char eq '?') {
2463 0 $pattern .= "(?:$your_char)?", # DOS style
2464 # $pattern .= "(?:$your_char)", # UNIX style
2465 }
2466 elsif ((my $fc = Elatin7::fc($char)) ne $char) {
2467 0 $pattern .= $fc;
2468 }
2469 else {
2470 0 $pattern .= quotemeta $char;
2471 }
2472 }
2473 0 ▶ my $matchsub = sub { Elatin7::fc($_[0]) =~ /\A $pattern \z/xms };
Subroutine __ANON__: not called CC=1 SCAR=6.9
2474  
2475 # if ($@) {
2476 # print STDERR "$0: $@\n";
2477 # next OUTER;
2478 # }
2479  
2480 INNER:
2481 0 for my $leaf (@leaf) {
2482 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
2483 0 next INNER;
2484 }
2485 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
2486 0 next INNER;
2487 }
2488  
2489 0 ▶ if (&$matchsub($leaf)) {
Branch: 1 branch
BranchTrueFalseTotal
if (&$matchsub($leaf)) 0 0 0
2490 0 push @matched, "$head$leaf";
2491 0 next INNER;
2492 }
2493  
2494 # [DOS compatibility special case]
2495 # Failed, add a trailing dot and try again, but only...
2496  
2497 0 ▶ if (Elatin7::index($leaf,'.') == -1 and # if name does not have a dot in it *and*
Branch: 1 branch
BranchTrueFalseTotal
if (&Elatin7::index($leaf, ".") == -1 and length $leaf <= 8 and &Elatin7::index($pattern, "\\.") != -1) 0 0 0
Condition0%0/6
&Elatin7::index($leaf, ".") == -1 and length $leaf <= 8 and &Elatin7::index($pattern, "\\.") != -1
!ll&&!rl&&r
000
&Elatin7::index($leaf, ".") == -1 and length $leaf <= 8
!ll&&!rl&&r
000
MC/DC0%0/3
&Elatin7::index($leaf, ".") == -1 and length $leaf <= 8 and &Elatin7::index($pattern, "\\.") != -1
&Elatin7::index($leaf, ".") == -1 length $leaf <= 8 &Elatin7::index($pattern, "\\.") != -1
Truth table0%0/4
A and B and C
A= &Elatin7::index($leaf, ".") == -1B= length $leaf <= 8C= &Elatin7::index($pattern, "\\.") != -1
ABCresult
0XX0
10X0
1100
1111
2498 CORE::length($leaf) <= 8 and # name is shorter than or equal to 8 chars *and*
2499 Elatin7::index($pattern,'\\.') != -1 # pattern has a dot.
2500 ) {
2501 0 ▶ if (&$matchsub("$leaf.")) {
Branch: 1 branch
BranchTrueFalseTotal
if (&$matchsub("$leaf.")) 0 0 0
2502 0 push @matched, "$head$leaf";
2503 0 next INNER;
2504 }
2505 }
2506 }
2507 0 ▶ if (@matched) {
Branch: 1 branch
BranchTrueFalseTotal
if (@matched) 0 0 0
2508 0 push @glob, @matched;
2509 }
2510 }
2511 0 ▶ if ($fix_drive_relative_paths) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fix_drive_relative_paths) 0 0 0
2512 0 for my $glob (@glob) {
2513 0 $glob =~ s# \A ([A-Za-z]:) \./ #$1#oxms;
2514 }
2515 }
2516 0 return @glob;
2517 }
2518  
2519 #
2520 # Latin-7 parse line
2521 #
2522 0 ▶sub _parse_line {
Subroutine _parse_line: not called CC=3 SCAR=24.8
2523  
2524 0 my($line) = @_;
2525  
2526 0 $line .= ' ';
2527 0 my @piece = ();
2528 0 ▶ while ($line =~ /
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ / " ( (?>(?: [^"] )* ) ) " (?>\s+) | ( (?>(?: [^"\s] )* ) ) (?>\s+) /gmosx) 0 0 0
2529 " ( (?>(?: [^"] )* ) ) " (?>\s+) |
2530 ( (?>(?: [^"\s] )* ) ) (?>\s+)
2531 /oxmsg
2532 ) {
2533 0 ▶ push @piece, defined($1) ? $1 : $2;
Branch: 1 branch
BranchTrueFalseTotal
defined $1 ? : 0 0 0
2534 }
2535 0 return @piece;
2536 }
2537  
2538 #
2539 # Latin-7 parse path
2540 #
2541 0 ▶sub _parse_path {
Subroutine _parse_path: not called CC=2 SCAR=17.9
2542  
2543 0 my($path,$pathsep) = @_;
2544  
2545 0 $path .= '/';
2546 0 my @subpath = ();
2547 0 ▶ while ($path =~ /
Branch: 1 branch
BranchTrueFalseTotal
if ($path =~ m( ((?: [^/\\] )+?) [/\\] )gmosx) 0 0 0
2548 ((?: [^\/\\] )+?) [\/\\]
2549 /oxmsg
2550 ) {
2551 0 push @subpath, $1;
2552 }
2553  
2554 0 my $tail = pop @subpath;
2555 0 my $head = join $pathsep, @subpath;
2556 0 return $head, $tail;
2557 }
2558  
2559 #
2560 # via File::HomeDir::Windows 1.00
2561 #
2562 0 ▶sub my_home_MSWin32 {
Subroutine my_home_MSWin32: not called CC=9 SCAR=45.0
Pod undocumented
2563  
2564 # A lot of unix people and unix-derived tools rely on
2565 # the ability to overload HOME. We will support it too
2566 # so that they can replace raw HOME calls with File::HomeDir.
2567 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
2568 0 return $ENV{'HOME'};
2569 }
2570  
2571 # Do we have a user profile?
2572 ▶ 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
2573 0 return $ENV{'USERPROFILE'};
2574 }
2575  
2576 # Some Windows use something like $ENV{'HOME'}
2577 ▶ 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
2578 0 return join '', $ENV{'HOMEDRIVE'}, $ENV{'HOMEPATH'};
2579 }
2580  
2581 0 return undef;
2582 }
2583  
2584 #
2585 # via File::HomeDir::Unix 1.00
2586 #
2587 0 ▶sub my_home {
Subroutine my_home: not called CC=7 SCAR=40.3
Pod undocumented
2588 0 my $home;
2589  
2590 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
2591 0 $home = $ENV{'HOME'};
2592 }
2593  
2594 # This is from the original code, but I'm guessing
2595 # it means "login directory" and exists on some Unixes.
2596 ▶ 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
2597 0 $home = $ENV{'LOGDIR'};
2598 }
2599  
2600 ### More-desperate methods
2601  
2602 # Light desperation on any (Unixish) platform
2603 else {
2604 0 $home = CORE::eval q{ (getpwuid($<))[7] };
2605 }
2606  
2607 # On Unix in general, a non-existant home means "no home"
2608 # For example, "nobody"-like users might use /nonexistant
2609 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
2610 0 $home = undef;
2611 }
2612 0 return $home;
2613 }
2614  
2615 #
2616 # ${^PREMATCH}, $PREMATCH, $` the string preceding what was matched
2617 #
2618 56 ▶sub Elatin7::PREMATCH {
Subroutine PREMATCH: called CC=1 SCAR=0.0
Pod undocumented
2619 56 return $`;
2620 }
2621  
2622 #
2623 # ${^MATCH}, $MATCH, $& the string that matched
2624 #
2625 81 ▶sub Elatin7::MATCH {
Subroutine MATCH: called CC=1 SCAR=0.0
Pod undocumented
2626 81 return $&;
2627 }
2628  
2629 #
2630 # ${^POSTMATCH}, $POSTMATCH, $' the string following what was matched
2631 #
2632 42 ▶sub Elatin7::POSTMATCH {
Subroutine POSTMATCH: called CC=1 SCAR=0.0
Pod undocumented
2633 42 return $';
2634 }
2635  
2636 #
2637 # Latin-7 character to order (with parameter)
2638 #
2639 0 ▶sub Latin7::ord(;$) {
Subroutine ord: not called CC=4 SCAR=30.0
2640  
2641 0 ▶ local $_ = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
2642  
2643 0 ▶ if (/\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\A ($Elatin7::q_char) /mosx) { } 0 0 0
2644 0 my @ord = unpack 'C*', $1;
2645 0 my $ord = 0;
2646 0 ▶ while (my $o = shift @ord) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $o = shift @ord) 0 0 0
2647 0 $ord = $ord * 0x100 + $o;
2648 }
2649 0 return $ord;
2650 }
2651 else {
2652 0 return CORE::ord $_;
2653 }
2654 }
2655  
2656 #
2657 # Latin-7 character to order (without parameter)
2658 #
2659 0 ▶sub Latin7::ord_() {
Subroutine ord_: not called CC=3 SCAR=24.8
2660  
2661 0 ▶ if (/\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\A ($Elatin7::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-7 reverse
2676 #
2677 0 ▶sub Latin7::reverse(@) {
Subroutine reverse: not called CC=2 SCAR=17.9
2678  
2679 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2680 0 return CORE::reverse @_;
2681 }
2682 else {
2683  
2684 # One of us once cornered Larry in an elevator and asked him what
2685 # problem he was solving with this, but he looked as far off into
2686 # the distance as he could in an elevator and said, "It seemed like
2687 # a good idea at the time."
2688  
2689 0 return join '', CORE::reverse(join('',@_) =~ /\G ($q_char) /oxmsg);
2690 }
2691 }
2692  
2693 #
2694 # Latin-7 getc (with parameter, without parameter)
2695 #
2696 20 ▶sub Latin7::getc(;*@) {
Subroutine getc: called CC=9 SCAR=26.7
2697  
2698 20 my($package) = caller;
2699 20 ▶ my $fh = @_ ? qualify_to_ref(shift,$package) : \*STDIN;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 20 0 20
2700 20 ▶ croak 'Too many arguments for Latin7::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
2701  
2702 0 my @length = sort { $a <=> $b } keys %range_tr;
2703 20 my $getc = '';
2704 20 for my $length ($length[0] .. $length[-1]) {
2705 20 $getc .= CORE::getc($fh);
2706 20 ▶ if (exists $range_tr{CORE::length($getc)}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{length $getc}) 20 0 20
2707 20 ▶ if ($getc =~ /\A ${Elatin7::dot_s} \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($getc =~ /\A $Elatin7::dot_s \z/mosx) 20 0 20
2708 20 ▶ return wantarray ? ($getc,@_) : $getc;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 20 20
2709 }
2710 }
2711 }
2712 0 ▶ return wantarray ? ($getc,@_) : $getc;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
2713 }
2714  
2715 #
2716 # Latin-7 length by character
2717 #
2718 0 ▶sub Latin7::length(;$) {
Subroutine length: not called CC=2 SCAR=17.9
2719  
2720 0 ▶ local $_ = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
2721  
2722 0 local @_ = /\G ($q_char) /oxmsg;
2723 0 return scalar @_;
2724 }
2725  
2726 #
2727 # Latin-7 substr by character
2728 #
2729 422 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=7.0
2730  
2731 # P.232 The lvalue Attribute
2732 # in Chapter 6: Subroutines
2733 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2734  
2735 # P.336 The lvalue Attribute
2736 # in Chapter 7: Subroutines
2737 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2738  
2739 # P.144 8.4 Lvalue subroutines
2740 # in Chapter 8: perlsub: Perl subroutines
2741 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
2742  
2743 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
2744 # vv----------------------*******
2745 sub Latin7::substr($$;$$) %s {
2746  
2747 my @char = $_[0] =~ /\G (?>$q_char) /oxmsg;
2748  
2749 # If the substring is beyond either end of the string, substr() returns the undefined
2750 # value and produces a warning. When used as an lvalue, specifying a substring that
2751 # is entirely outside the string raises an exception.
2752 # http://perldoc.perl.org/functions/substr.html
2753  
2754 # A return with no argument returns the scalar value undef in scalar context,
2755 # an empty list () in list context, and (naturally) nothing at all in void
2756 # context.
2757  
2758 my $offset = $_[1];
2759 if (($offset > scalar(@char)) or ($offset < (-1 * scalar(@char)))) {
2760 return;
2761 }
2762  
2763 # substr($string,$offset,$length,$replacement)
2764 if (@_ == 4) {
2765 my(undef,undef,$length,$replacement) = @_;
2766 my $substr = join '', splice(@char, $offset, $length, $replacement);
2767 $_[0] = join '', @char;
2768  
2769 # return $substr; this doesn't work, don't say "return"
2770 $substr;
2771 }
2772  
2773 # substr($string,$offset,$length)
2774 elsif (@_ == 3) {
2775 my(undef,undef,$length) = @_;
2776 my $octet_offset = 0;
2777 my $octet_length = 0;
2778 if ($offset == 0) {
2779 $octet_offset = 0;
2780 }
2781 elsif ($offset > 0) {
2782 $octet_offset = CORE::length(join '', @char[0..$offset-1]);
2783 }
2784 else {
2785 $octet_offset = -1 * CORE::length(join '', @char[$#char+$offset+1..$#char]);
2786 }
2787 if ($length == 0) {
2788 $octet_length = 0;
2789 }
2790 elsif ($length > 0) {
2791 $octet_length = CORE::length(join '', @char[$offset..$offset+$length-1]);
2792 }
2793 else {
2794 $octet_length = -1 * CORE::length(join '', @char[$#char+$length+1..$#char]);
2795 }
2796 CORE::substr($_[0], $octet_offset, $octet_length);
2797 }
2798  
2799 # substr($string,$offset)
2800 else {
2801 my $octet_offset = 0;
2802 if ($offset == 0) {
2803 $octet_offset = 0;
2804 }
2805 elsif ($offset > 0) {
2806 $octet_offset = CORE::length(join '', @char[0..$offset-1]);
2807 }
2808 else {
2809 $octet_offset = -1 * CORE::length(join '', @char[$#char+$offset+1..$#char]);
2810 }
2811 CORE::substr($_[0], $octet_offset);
2812 }
2813 }
2814 END
2815 }
2816  
2817 #
2818 # Latin-7 index by character
2819 #
2820 0 ▶sub Latin7::index($$;$) {
Subroutine index: not called CC=3 SCAR=24.8
2821  
2822 0 my $index;
2823 0 ▶ if (@_ == 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 3) { } 0 0 0
2824 0 $index = Elatin7::index($_[0], $_[1], CORE::length(Latin7::substr($_[0], 0, $_[2])));
2825 }
2826 else {
2827 0 $index = Elatin7::index($_[0], $_[1]);
2828 }
2829  
2830 0 ▶ if ($index == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($index == -1) { } 0 0 0
2831 0 return -1;
2832 }
2833 else {
2834 0 return Latin7::length(CORE::substr $_[0], 0, $index);
2835 }
2836 }
2837  
2838 #
2839 # Latin-7 rindex by character
2840 #
2841 0 ▶sub Latin7::rindex($$;$) {
Subroutine rindex: not called CC=3 SCAR=24.8
2842  
2843 0 my $rindex;
2844 0 ▶ if (@_ == 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 3) { } 0 0 0
2845 0 $rindex = Elatin7::rindex($_[0], $_[1], CORE::length(Latin7::substr($_[0], 0, $_[2])));
2846 }
2847 else {
2848 0 $rindex = Elatin7::rindex($_[0], $_[1]);
2849 }
2850  
2851 0 ▶ if ($rindex == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rindex == -1) { } 0 0 0
2852 0 return -1;
2853 }
2854 else {
2855 0 return Latin7::length(CORE::substr $_[0], 0, $rindex);
2856 }
2857 }
2858  
2859 # when 'm//', '/' means regexp match 'm//' and '?' means regexp match '??'
2860 # when 'div', '/' means division operator and '?' means conditional operator (condition ? then : else)
2861 422 ▶use vars qw($slash); $slash = 'm//';
Subroutine BEGIN: called CC=1 SCAR=0.0
2862  
2863 # ord() to ord() or Latin7::ord()
2864 422 my $function_ord = 'ord';
2865  
2866 # ord to ord or Latin7::ord_
2867 422 my $function_ord_ = 'ord';
2868  
2869 # reverse to reverse or Latin7::reverse
2870 422 my $function_reverse = 'reverse';
2871  
2872 # getc to getc or Latin7::getc
2873 422 my $function_getc = 'getc';
2874  
2875 # P.1023 Appendix W.9 Multibyte Anchoring
2876 # of ISBN 1-56592-224-7 CJKV Information Processing
2877  
2878 422 my $anchor = '';
2879  
2880 422 ▶use vars qw($nest);
Subroutine BEGIN: called CC=1 SCAR=0.0
2881  
2882 # regexp of nested parens in qqXX
2883  
2884 # P.340 Matching Nested Constructs with Embedded Code
2885 # in Chapter 7: Perl
2886 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
2887  
2888 my $qq_paren = qr{(?{local $nest=0}) (?>(?:
2889 [^\\()] |
2890 \( (?{$nest++}) |
2891 \) (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2892 \\ [^c] |
2893 \\c[\x40-\x5F] |
2894 [\x00-\xFF]
2895 422 }xms;
2896  
2897 my $qq_brace = qr{(?{local $nest=0}) (?>(?:
2898 [^\\{}] |
2899 \{ (?{$nest++}) |
2900 \} (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2901 \\ [^c] |
2902 \\c[\x40-\x5F] |
2903 [\x00-\xFF]
2904 422 }xms;
2905  
2906 my $qq_bracket = 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_angle = 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 422 my $qq_scalar = qr{(?: \{ (?:$qq_brace)*? \} |
2925 (?: ::)? (?:
2926 (?> [a-zA-Z_][a-zA-Z_0-9]* (?: ::[a-zA-Z_][a-zA-Z_0-9]*)* )
2927 (?>(?: \[ (?: \$\[ | \$\] | $qq_char )*? \] | \{ (?:$qq_brace)*? \} )*)
2928 (?>(?: (?: -> )? (?: [\$\@\%\&\*]\* | \$\#\* | [\@\%]? \[ (?: \$\[ | \$\] | $qq_char )*? \] | [\@\%\*]? \{ (?:$qq_brace)*? \} ) )*)
2929 ))
2930 }xms;
2931  
2932 422 my $qq_variable = qr{(?: \{ (?:$qq_brace)*? \} |
2933 (?: ::)? (?:
2934 (?>[0-9]+) |
2935 [^a-zA-Z_0-9\[\]] |
2936 ^[A-Z] |
2937 (?> [a-zA-Z_][a-zA-Z_0-9]* (?: ::[a-zA-Z_][a-zA-Z_0-9]*)* )
2938 (?>(?: \[ (?: \$\[ | \$\] | $qq_char )*? \] | \{ (?:$qq_brace)*? \} )*)
2939 (?>(?: (?: -> )? (?: [\$\@\%\&\*]\* | \$\#\* | [\@\%]? \[ (?: \$\[ | \$\] | $qq_char )*? \] | [\@\%\*]? \{ (?:$qq_brace)*? \} ) )*)
2940 ))
2941 }xms;
2942  
2943 422 my $qq_substr = qr{(?> Char::substr | Latin7::substr | CORE::substr | substr ) (?>\s*) \( $qq_paren \)
2944 }xms;
2945  
2946 # regexp of nested parens in qXX
2947 my $q_paren = qr{(?{local $nest=0}) (?>(?:
2948 [^()] |
2949 \( (?{$nest++}) |
2950 \) (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2951 [\x00-\xFF]
2952 422 }xms;
2953  
2954 my $q_brace = qr{(?{local $nest=0}) (?>(?:
2955 [^\{\}] |
2956 \{ (?{$nest++}) |
2957 \} (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2958 [\x00-\xFF]
2959 422 }xms;
2960  
2961 my $q_bracket = qr{(?{local $nest=0}) (?>(?:
2962 [^\[\]] |
2963 \[ (?{$nest++}) |
2964 \] (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2965 [\x00-\xFF]
2966 422 }xms;
2967  
2968 my $q_angle = qr{(?{local $nest=0}) (?>(?:
2969 [^<>] |
2970 \< (?{$nest++}) |
2971 \> (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2972 [\x00-\xFF]
2973 422 }xms;
2974  
2975 422 my $matched = '';
2976 422 my $s_matched = '';
2977  
2978 422 my $tr_variable = ''; # variable of tr///
2979 422 my $sub_variable = ''; # variable of s///
2980 422 my $bind_operator = ''; # =~ or !~
2981  
2982 422 my @heredoc = (); # here document
2983 422 my @heredoc_delimiter = ();
2984 422 my $here_script = ''; # here script
2985  
2986 #
2987 # escape Latin-7 script
2988 #
2989 547 ▶sub Latin7::escape(;$) {
Subroutine escape: called CC=3 SCAR=11.0
2990 547 ▶ local($_) = $_[0] if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 292 255 547
2991  
2992 # P.359 The Study Function
2993 # in Chapter 7: Perl
2994 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
2995  
2996 547 study $_; # Yes, I studied study yesterday.
2997  
2998 # while all script
2999  
3000 # 6.14. Matching from Where the Last Pattern Left Off
3001 # in Chapter 6. Pattern Matching
3002 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
3003 # (and so on)
3004  
3005 # one member of Tag-team
3006 #
3007 # P.128 Start of match (or end of previous match): \G
3008 # P.130 Advanced Use of \G with Perl
3009 # in Chapter 3: Overview of Regular Expression Features and Flavors
3010 # P.255 Use leading anchors
3011 # P.256 Expose ^ and \G at the front expressions
3012 # in Chapter 6: Crafting an Efficient Expression
3013 # P.315 "Tag-team" matching with /gc
3014 # in Chapter 7: Perl
3015 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3016  
3017 547 my $e_script = '';
3018 547 ▶ while (not /\G \z/oxgc) { # member
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 86340 547 86887
3019 86340 $e_script .= Latin7::escape_token();
3020 }
3021  
3022 547 return $e_script;
3023 }
3024  
3025 #
3026 # escape Latin-7 token of script
3027 #
3028 86340 ▶sub Latin7::escape_token {
Subroutine escape_token: called CC=504 SCAR=109.3
3029  
3030 # \n output here document
3031  
3032 86340 my $ignore_modules = join('|', qw(
3033 utf8
3034 bytes
3035 charnames
3036 I18N::Japanese
3037 I18N::Collate
3038 I18N::JExt
3039 File::DosGlob
3040 Wild
3041 Wildcard
3042 Japanese
3043 ));
3044  
3045 # another member of Tag-team
3046 #
3047 # P.315 "Tag-team" matching with /gc
3048 # in Chapter 7: Perl
3049 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
3050  
3051 86340 ▶ if (/\G ( \n ) /oxgc) { # another member (and so on)
Branch: 139 branches
BranchTrueFalseTotal
if (/\G ( \n ) /cgox) { } 12800 73540 86340
elsif (/\G ((?>\s+)|\#.*) /cgox) { } 21268 52272 73540
elsif (/\G ( (?: if | elsif | unless | while | until | given | when ) (?>\s*) \( ) /cgox) { } 1644 50628 52272
elsif (/\G ( \( (?>\s*) (?: local \b | my \b | our \b | state \b )? (?>\s*) \$ $qq_scalar ) /cgox) { } 90 50538 50628
elsif (/\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /cgmosx) { } 4 50534 50538
elsif (/\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /cgmosx) { } 28 50506 50534
elsif (/\G ( \$' | \$\{'\} ) /cgmosx) { } 1 50505 50506
elsif (/\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /cgmosx) { } 3 50502 50505
elsif (/\G ( \$ $qq_scalar | $qq_substr ) /cgox) { } 1752 48750 50502
elsif (/\G ( [,;] ) /cgox) { } 5059 43691 48750
elsif (/\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /cgmosx) { } 0 43691 43691
elsif (/\G ( \$ 0 ) /cgmosx) { } 2 43689 43691
elsif (/\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /cgmosx) { } 0 43689 43689
elsif (/\G ( \$ \$ ) (?![\w\{]) /cgmosx) { } 1 43688 43689
elsif (/\G \$ ((?>[1-9][0-9]*)) /cgmosx) { } 4 43684 43688
elsif (/\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /cgmosx) { } 0 43684 43684
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /cgmosx) { } 0 43684 43684
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /cgmosx) { } 0 43684 43684
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /cgmosx) { } 0 43684 43684
elsif (/\G \$ (?>\s*) \{ ( (?>\s*) (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* ) (?>\s*) ) \} /cgmosx) { } 0 43684 43684
elsif (/\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /cgmosx) { } 0 43684 43684
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 43642 43684
elsif (m{\G ( \$[\$\@\#\\\'\"/\?\(\)\[\]\<\>] ) }cgmosx) { } 63 43579 43642
elsif (/\G \b (while (?>\s*) \( (?>\s*) <[\$]?[A-Za-z_][A-Za-z_0-9]*> (?>\s*) \)) \b /cgox) { } 0 43579 43579
elsif (/\G \b while (?>\s*) \( (?>\s*) < ((?:[^>\0\a\e\f\n\r\t])+?) > (?>\s*) \) \b /cgox) { } 0 43579 43579
elsif (/\G \b while (?>\s*) \( (?>\s*) glob (?>\s*) \) /cgox) { } 0 43579 43579
elsif (/\G \b while (?>\s*) \( (?>\s*) glob \b /cgox) { } 0 43579 43579
elsif (/\G \b ( if | unless | while | until | for | when ) \b /cgox) { } 251 43328 43579
elsif (/\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /cgox) { } 19 43309 43328
elsif (/\G \b Char::eval (?= (?>\s*) \{ ) /cgox) { } 0 43309 43309
elsif (/\G \b Latin7::eval (?= (?>\s*) \{ ) /cgox) { } 22 43287 43309
elsif (/\G \b Char::eval \b (?! (?>\s*) => ) /cgox) { } 0 43287 43287
elsif (/\G \b Latin7::eval \b (?! (?>\s*) => ) /cgox) { } 168 43119 43287
elsif (/\G \b bytes::substr \b (?! (?>\s*) => ) /cgox) { } 2 43117 43119
elsif (/\G \b chop \b (?! (?>\s*) => ) /cgox) { } 0 43117 43117
elsif (/\G \b bytes::index \b (?! (?>\s*) => ) /cgox) { } 2 43115 43117
elsif (/\G \b Char::index \b (?! (?>\s*) => ) /cgox) { } 0 43115 43115
elsif (/\G \b Latin7::index \b (?! (?>\s*) => ) /cgox) { } 0 43115 43115
elsif (/\G \b index \b (?! (?>\s*) => ) /cgox) { } 0 43115 43115
elsif (/\G \b bytes::rindex \b (?! (?>\s*) => ) /cgox) { } 2 43113 43115
elsif (/\G \b Char::rindex \b (?! (?>\s*) => ) /cgox) { } 0 43113 43113
elsif (/\G \b Latin7::rindex \b (?! (?>\s*) => ) /cgox) { } 0 43113 43113
elsif (/\G \b rindex \b (?! (?>\s*) => ) /cgox) { } 0 43113 43113
elsif (/\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 1 43112 43113
elsif (/\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43112 43112
elsif (/\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 1 43111 43112
elsif (/\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43111 43111
elsif (/\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 6 43105 43111
elsif (/\G -s (?>\s*) (\") ((?:$Elatin7::qq_char)+?) (\") /cgox) { } 0 43105 43105
elsif (/\G -s (?>\s+) qq (?>\s*) (\#) ((?:$Elatin7::qq_char)+?) (\#) /cgox) { } 0 43105 43105
elsif (/\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /cgox) { } 0 43105 43105
elsif (/\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /cgox) { } 0 43105 43105
elsif (/\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /cgox) { } 0 43105 43105
elsif (/\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /cgox) { } 0 43105 43105
elsif (/\G -s (?>\s+) qq (?>\s*) (\S) ((?:$Elatin7::qq_char)+?) (\1) /cgox) { } 0 43105 43105
elsif (/\G -s (?>\s*) (\') ((?:\\\'|\\\\|$Elatin7::q_char)+?) (\') /cgox) { } 0 43105 43105
elsif (/\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$Elatin7::q_char)+?) (\#) /cgox) { } 0 43105 43105
elsif (/\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /cgox) { } 0 43105 43105
elsif (/\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /cgox) { } 0 43105 43105
elsif (/\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /cgox) { } 0 43105 43105
elsif (/\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /cgox) { } 0 43105 43105
elsif (/\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$Elatin7::q_char)+?) (\1) /cgox) { } 0 43105 43105
elsif (/\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)* ) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ) )*) /cgox) { } 0 43105 43105
elsif (/\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /cgox) { } 0 43105 43105
elsif (/\G -s (?= (?>\s+) [a-z]+) /cgox) { } 0 43105 43105
elsif (/\G -s (?>\s+) ((?>\w+)) /cgox) { } 0 43105 43105
elsif (/\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43103 43105
elsif (/\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43101 43103
elsif (/\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 36 43065 43101
elsif (/\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 43063 43065
elsif (/\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 8 43055 43063
elsif (/\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 43055 43055
elsif (/\G \b lc \b (?! (?>\s*) => ) /cgox) { } 0 43055 43055
elsif (/\G \b lcfirst \b (?! (?>\s*) => ) /cgox) { } 0 43055 43055
elsif (/\G \b uc \b (?! (?>\s*) => ) /cgox) { } 0 43055 43055
elsif (/\G \b ucfirst \b (?! (?>\s*) => ) /cgox) { } 0 43055 43055
elsif (/\G \b fc \b (?! (?>\s*) => ) /cgox) { } 0 43055 43055
elsif (/\G -s \b (?! (?>\s*) => ) /cgox) { } 0 43055 43055
elsif (/\G \b bytes::length \b (?! (?>\s*) => ) /cgox) { } 0 43055 43055
elsif (/\G \b bytes::chr \b (?! (?>\s*) => ) /cgox) { } 0 43055 43055
elsif (/\G \b chr \b (?! (?>\s*) => ) /cgox) { } 0 43055 43055
elsif (/\G \b bytes::ord \b (?! (?>\s*) => ) /cgox) { } 0 43055 43055
elsif (/\G \b ord \b (?! (?>\s*) => ) /cgox) { } 0 43055 43055
elsif (/\G \b glob \b (?! (?>\s*) => ) /cgox) { } 0 43055 43055
elsif (/\G \b reverse \b (?! (?>\s*) => ) /cgox) { } 0 43055 43055
elsif (/\G \b getc \b (?! (?>\s*) => ) /cgox) { } 8 43047 43055
elsif (/\G \b (split) \b (?! (?>\s*) => ) /cgox) { } 87 42960 43047
elsif (/\G \b ( tr | y ) \b /cgox) { } 4 42956 42960
elsif (/\G \b (qq) \b /cgox) { } 2252 40704 42956
elsif (/\G \b (qr) \b /cgox) { } 0 40704 40704
elsif (/\G \b (qw) \b /cgox) { } 16 40688 40704
elsif (/\G \b (qx) \b /cgox) { } 0 40688 40688
elsif (/\G \b (q) \b /cgox) { } 473 40215 40688
elsif (/\G \b (m) \b /cgox) { } 209 40006 40215
elsif (/\G \b (s) \b /cgox) { } 101 39905 40006
elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 0 39905 39905
elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 39905 39905
elsif (/\G \b require ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 39905 39905
elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [#\n]) /cgmosx) { } 37 39868 39905
elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 39868 39868
elsif (/\G \b use ((?>\s+) strict) \b /cgmosx) { } 0 39868 39868
elsif (/\G \b use (?>\s+) ((?>([1-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /cgmosx) { } 2 39866 39868
elsif (/\G \b use (?>\s+) ((?>v([0-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /cgmosx) { } 0 39866 39866
elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 2 39864 39866
elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 39864 39864
elsif (/\G \b use ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 39864 39864
elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 0 39864 39864
elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 39864 39864
elsif (/\G \b no ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 39864 39864
elsif (/\G \b use \b /cgmosx) { } 0 39864 39864
elsif (/\G \b no \b /cgmosx) { } 2 39862 39864
elsif (/\G (?<![\w\$\@\%\&\*]) (\') /cgox) { } 1142 38720 39862
elsif (/\G (\") /cgox) { } 1875 36845 38720
elsif (/\G (\`) /cgox) { } 1 36844 36845
elsif ($Elatin7::slash eq 'm//' and m[\G (/) ]cgox) { } 681 36163 36844
elsif ($Elatin7::slash eq 'm//' and /\G (\?) /cgox) { } 0 36163 36163
elsif (/\G ( <<>> ) /cgox) { } 0 36163 36163
elsif (/\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /cgox) { } 0 36163 36163
elsif (/\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /cgox) { } 6 36157 36163
elsif (/\G ( <<~ \\([a-zA-Z_0-9]+) ) /cgox) { } 3 36154 36157
elsif (/\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /cgox) { } 6 36148 36154
elsif (/\G ( <<~ ([a-zA-Z_0-9]+) ) /cgox) { } 3 36145 36148
elsif (/\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /cgox) { } 6 36139 36145
elsif (/\G ( << '([a-zA-Z_0-9]*)' ) /cgox) { } 72 36067 36139
elsif (/\G ( << \\([a-zA-Z_0-9]+) ) /cgox) { } 0 36067 36067
elsif (/\G ( << "([a-zA-Z_0-9]*)" ) /cgox) { } 36 36031 36067
elsif (/\G ( << ([a-zA-Z_0-9]+) ) /cgox) { } 42 35989 36031
elsif (/\G ( << `([a-zA-Z_0-9]*)` ) /cgox) { } 0 35989 35989
elsif (/\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/cgox) { } 12 35977 35989
elsif (/\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /cgox) { } 0 35977 35977
elsif (/\G < ((?:[^>\0\a\e\f\n\r\t])+?) > /cgox) { } 0 35977 35977
elsif (/\G ^ ( __DATA__ \n .*) \z /cgmosx) { } 0 35977 35977
elsif (/\G ^ ( __END__ \n .*) \z /cgmosx) { } 210 35767 35977
elsif (/\G ( \cD .*) \z /cgmosx) { } 0 35767 35767
elsif (/\G ( \cZ .*) \z /cgmosx) { } 0 35767 35767
elsif (/\G ( -- | \+\+ | [\)\}\]] ) /cgox) { } 5837 29930 35767
elsif (/\G ( \.\.\. ) /cgox) { } 7 29923 29930
elsif (m"\G ((?> !~~ | !~ | != | ! | %= | % | &&= | && | &= | &\.= | &\. | & | -= | -> | - | :(?>\s*)= | : | <<>> | <<= | <=> | <= | < | == | => | =~ | = | >>= | >> | >= | > | \*\*= | \*\* | \*= | \* | \+= | \+ | \.\. | \.= | \. | //= | // | /= | / | \? | \\ | \^= | \^\.= | \^\. | \^ | \b x= | \|\|= | \|\| | \|= | \|\.= | \|\. | \| | ~~ | ~\. | ~ | \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b | \b(?: print )\b | [,;\(\{\[] )) "cgox) { } 9767 20156 29923
elsif (/\G ($Elatin7::q_char) /cgox) { } 20156 0 20156
3052 12800 my $heredoc = '';
3053 12800 ▶ if (scalar(@heredoc_delimiter) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @heredoc_delimiter >= 1) 174 12626 12800
3054 174 $slash = 'm//';
3055  
3056 174 $heredoc = join '', @heredoc;
3057 174 @heredoc = ();
3058  
3059 # skip here document
3060 174 for my $heredoc_delimiter (@heredoc_delimiter) {
3061 174 /\G .*? \n $heredoc_delimiter \n/xmsgc;
3062 }
3063 174 @heredoc_delimiter = ();
3064  
3065 174 $here_script = '';
3066 }
3067 12800 return "\n" . $heredoc;
3068 }
3069  
3070 # ignore space, comment
3071 21268 elsif (/\G ((?>\s+)|\#.*) /oxgc) { return $1; }
3072  
3073 # if (, elsif (, unless (, while (, until (, given (, and when (
3074  
3075 # given, when
3076  
3077 # P.225 The given Statement
3078 # in Chapter 15: Smart Matching and given-when
3079 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
3080  
3081 # P.133 The given Statement
3082 # in Chapter 4: Statements and Declarations
3083 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
3084  
3085 elsif (/\G ( (?: if | elsif | unless | while | until | given | when ) (?>\s*) \( ) /oxgc) {
3086 1644 $slash = 'm//';
3087 1644 return $1;
3088 }
3089  
3090 # scalar variable ($scalar = ...) =~ tr///;
3091 # scalar variable ($scalar = ...) =~ s///;
3092  
3093 # state
3094  
3095 # P.68 Persistent, Private Variables
3096 # in Chapter 4: Subroutines
3097 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
3098  
3099 # P.160 Persistent Lexically Scoped Variables: state
3100 # in Chapter 4: Statements and Declarations
3101 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
3102  
3103 # (and so on)
3104  
3105 elsif (/\G ( \( (?>\s*) (?: local \b | my \b | our \b | state \b )? (?>\s*) \$ $qq_scalar ) /oxgc) {
3106 90 my $e_string = e_string($1);
3107  
3108 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
3109 0 $tr_variable = $e_string . e_string($1);
3110 0 $bind_operator = $2;
3111 0 $slash = 'm//';
3112 0 return '';
3113 }
3114 elsif (/\G ( (?>\s*) = $qq_paren \) ) ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /oxgc) {
3115 0 $sub_variable = $e_string . e_string($1);
3116 0 $bind_operator = $2;
3117 0 $slash = 'm//';
3118 0 return '';
3119 }
3120 else {
3121 90 $slash = 'div';
3122 90 return $e_string;
3123 }
3124 }
3125  
3126 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin7::PREMATCH()
3127 elsif (/\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /oxmsgc) {
3128 4 $slash = 'div';
3129 4 return q{Elatin7::PREMATCH()};
3130 }
3131  
3132 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin7::MATCH()
3133 elsif (/\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /oxmsgc) {
3134 28 $slash = 'div';
3135 28 return q{Elatin7::MATCH()};
3136 }
3137  
3138 # $', ${'} --> $', ${'}
3139 elsif (/\G ( \$' | \$\{'\} ) /oxmsgc) {
3140 1 $slash = 'div';
3141 1 return $1;
3142 }
3143  
3144 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin7::POSTMATCH()
3145 elsif (/\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /oxmsgc) {
3146 3 $slash = 'div';
3147 3 return q{Elatin7::POSTMATCH()};
3148 }
3149  
3150 # scalar variable $scalar =~ tr///;
3151 # scalar variable $scalar =~ s///;
3152 # substr() =~ tr///;
3153 # substr() =~ s///;
3154 elsif (/\G ( \$ $qq_scalar | $qq_substr ) /oxgc) {
3155 1752 my $scalar = e_string($1);
3156  
3157 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
3158 2 $tr_variable = $scalar;
3159 2 $bind_operator = $1;
3160 2 $slash = 'm//';
3161 2 return '';
3162 }
3163 elsif (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /oxgc) {
3164 65 $sub_variable = $scalar;
3165 65 $bind_operator = $1;
3166 65 $slash = 'm//';
3167 65 return '';
3168 }
3169 else {
3170 1685 $slash = 'div';
3171 1685 return $scalar;
3172 }
3173 }
3174  
3175 # end of statement
3176 elsif (/\G ( [,;] ) /oxgc) {
3177 5059 $slash = 'm//';
3178  
3179 # clear tr/// variable
3180 5059 $tr_variable = '';
3181  
3182 # clear s/// variable
3183 5059 $sub_variable = '';
3184  
3185 5059 $bind_operator = '';
3186  
3187 5059 return $1;
3188 }
3189  
3190 # bareword
3191 elsif (/\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /oxmsgc) {
3192 0 return $1;
3193 }
3194  
3195 # $0 --> $0
3196 elsif (/\G ( \$ 0 ) /oxmsgc) {
3197 2 $slash = 'div';
3198 2 return $1;
3199 }
3200 elsif (/\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /oxmsgc) {
3201 0 $slash = 'div';
3202 0 return $1;
3203 }
3204  
3205 # $$ --> $$
3206 elsif (/\G ( \$ \$ ) (?![\w\{]) /oxmsgc) {
3207 1 $slash = 'div';
3208 1 return $1;
3209 }
3210  
3211 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
3212 # $1, $2, $3 --> $1, $2, $3 otherwise
3213 elsif (/\G \$ ((?>[1-9][0-9]*)) /oxmsgc) {
3214 4 $slash = 'div';
3215 4 return e_capture($1);
3216 }
3217 elsif (/\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /oxmsgc) {
3218 0 $slash = 'div';
3219 0 return e_capture($1);
3220 }
3221  
3222 # $$foo[ ... ] --> $ $foo->[ ... ]
3223 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /oxmsgc) {
3224 0 $slash = 'div';
3225 0 return e_capture($1.'->'.$2);
3226 }
3227  
3228 # $$foo{ ... } --> $ $foo->{ ... }
3229 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /oxmsgc) {
3230 0 $slash = 'div';
3231 0 return e_capture($1.'->'.$2);
3232 }
3233  
3234 # $$foo
3235 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /oxmsgc) {
3236 0 $slash = 'div';
3237 0 return e_capture($1);
3238 }
3239  
3240 # ${ foo }
3241 elsif (/\G \$ (?>\s*) \{ ( (?>\s*) (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* ) (?>\s*) ) \} /oxmsgc) {
3242 0 $slash = 'div';
3243 0 return '${' . $1 . '}';
3244 }
3245  
3246 # ${ ... }
3247 elsif (/\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /oxmsgc) {
3248 0 $slash = 'div';
3249 0 return e_capture($1);
3250 }
3251  
3252 # variable or function
3253 # $ @ % & * $ #
3254 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) {
3255 42 $slash = 'div';
3256 42 return $1;
3257 }
3258 # $ $ $ $ $ $ $ $ $ $ $ $ $ $
3259 # $ @ # \ ' " / ? ( ) [ ] < >
3260 elsif (/\G ( \$[\$\@\#\\\'\"\/\?\(\)\[\]\<\>] ) /oxmsgc) {
3261 63 $slash = 'div';
3262 63 return $1;
3263 }
3264  
3265 # while (<FILEHANDLE>)
3266 elsif (/\G \b (while (?>\s*) \( (?>\s*) <[\$]?[A-Za-z_][A-Za-z_0-9]*> (?>\s*) \)) \b /oxgc) {
3267 0 return $1;
3268 }
3269  
3270 # while (<WILDCARD>) --- glob
3271  
3272 # avoid "Error: Runtime exception" of perl version 5.005_03
3273  
3274 elsif (/\G \b while (?>\s*) \( (?>\s*) < ((?:[^>\0\a\e\f\n\r\t])+?) > (?>\s*) \) \b /oxgc) {
3275 0 return 'while ($_ = Elatin7::glob("' . $1 . '"))';
3276 }
3277  
3278 # while (glob)
3279 elsif (/\G \b while (?>\s*) \( (?>\s*) glob (?>\s*) \) /oxgc) {
3280 0 return 'while ($_ = Elatin7::glob_)';
3281 }
3282  
3283 # while (glob(WILDCARD))
3284 elsif (/\G \b while (?>\s*) \( (?>\s*) glob \b /oxgc) {
3285 0 return 'while ($_ = Elatin7::glob';
3286 }
3287  
3288 # doit if, doit unless, doit while, doit until, doit for, doit when
3289 251 elsif (/\G \b ( if | unless | while | until | for | when ) \b /oxgc) { $slash = 'm//'; return $1; }
3290  
3291 # subroutines of package Elatin7
3292 19 elsif (/\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /oxgc) { $slash = 'm//'; return $1; }
3293 0 elsif (/\G \b Char::eval (?= (?>\s*) \{ ) /oxgc) { $slash = 'm//'; return 'eval'; }
3294 22 elsif (/\G \b Latin7::eval (?= (?>\s*) \{ ) /oxgc) { $slash = 'm//'; return 'eval'; }
3295 0 elsif (/\G \b Char::eval \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'eval Char::escape'; }
3296 168 elsif (/\G \b Latin7::eval \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'eval Latin7::escape'; }
3297 2 elsif (/\G \b bytes::substr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'substr'; }
3298 0 elsif (/\G \b chop \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin7::chop'; }
3299 2 elsif (/\G \b bytes::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'index'; }
3300 0 elsif (/\G \b Char::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Char::index'; }
3301 0 elsif (/\G \b Latin7::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Latin7::index'; }
3302 0 elsif (/\G \b index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin7::index'; }
3303 2 elsif (/\G \b bytes::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'rindex'; }
3304 0 elsif (/\G \b Char::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Char::rindex'; }
3305 0 elsif (/\G \b Latin7::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Latin7::rindex'; }
3306 0 elsif (/\G \b rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin7::rindex'; }
3307 1 elsif (/\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin7::lc'; }
3308 0 elsif (/\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin7::lcfirst'; }
3309 1 elsif (/\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin7::uc'; }
3310 0 elsif (/\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin7::ucfirst'; }
3311 6 elsif (/\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin7::fc'; }
3312  
3313 # "-s '' ..." means file test "-s 'filename' ..." (not means "- s/// ...")
3314 0 elsif (/\G -s (?>\s*) (\") ((?:$qq_char)+?) (\") /oxgc) { $slash = 'm//'; return '-s ' . e_qq('', $1,$3,$2); }
3315 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\#) ((?:$qq_char)+?) (\#) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3316 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3317 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3318 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3319 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3320 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\S) ((?:$qq_char)+?) (\1) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3321  
3322 0 elsif (/\G -s (?>\s*) (\') ((?:\\\'|\\\\|$q_char)+?) (\') /oxgc) { $slash = 'm//'; return '-s ' . e_q ('', $1,$3,$2); }
3323 0 elsif (/\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$q_char)+?) (\#) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3324 0 elsif (/\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3325 0 elsif (/\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3326 0 elsif (/\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3327 0 elsif (/\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3328 0 elsif (/\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$q_char)+?) (\1) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3329  
3330 elsif (/\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)* ) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ) )*) /oxgc)
3331 0 { $slash = 'm//'; return "-s $1"; }
3332 0 elsif (/\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /oxgc) { $slash = 'm//'; return "-s ($1)"; }
3333 0 elsif (/\G -s (?= (?>\s+) [a-z]+) /oxgc) { $slash = 'm//'; return '-s'; }
3334 0 elsif (/\G -s (?>\s+) ((?>\w+)) /oxgc) { $slash = 'm//'; return "-s $1"; }
3335  
3336 2 elsif (/\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'length'; }
3337 2 elsif (/\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'chr'; }
3338 36 elsif (/\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin7::chr'; }
3339 2 elsif (/\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'div'; return 'ord'; }
3340 8 elsif (/\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'div'; return $function_ord; }
3341 0 elsif (/\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Elatin7::glob'; }
3342 0 elsif (/\G \b lc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin7::lc_'; }
3343 0 elsif (/\G \b lcfirst \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin7::lcfirst_'; }
3344 0 elsif (/\G \b uc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin7::uc_'; }
3345 0 elsif (/\G \b ucfirst \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin7::ucfirst_'; }
3346 0 elsif (/\G \b fc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin7::fc_'; }
3347 0 elsif (/\G -s \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return '-s '; }
3348  
3349 0 elsif (/\G \b bytes::length \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'length'; }
3350 0 elsif (/\G \b bytes::chr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'chr'; }
3351 0 elsif (/\G \b chr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin7::chr_'; }
3352 0 elsif (/\G \b bytes::ord \b (?! (?>\s*) => ) /oxgc) { $slash = 'div'; return 'ord'; }
3353 0 elsif (/\G \b ord \b (?! (?>\s*) => ) /oxgc) { $slash = 'div'; return $function_ord_; }
3354 0 elsif (/\G \b glob \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Elatin7::glob_'; }
3355 0 elsif (/\G \b reverse \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return $function_reverse; }
3356 8 elsif (/\G \b getc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return $function_getc; }
3357 # split
3358 elsif (/\G \b (split) \b (?! (?>\s*) => ) /oxgc) {
3359 87 $slash = 'm//';
3360  
3361 87 my $e = '';
3362 87 ▶ while (/\G ( (?>\s+) | \( | \#.* ) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\G ( (?>\s+) | \( | \#.* ) /cgox) 85 87 172
3363 85 $e .= $1;
3364 }
3365  
3366 # end of split
3367 87 ▶ if (/\G (?= [,;\)\}\]] ) /oxgc) { return 'Elatin7::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
3368  
3369 # split scalar value
3370 1 elsif (/\G ( [\$\@\&\*] $qq_scalar ) /oxgc) { return 'Elatin7::split' . $e . e_string($1); }
3371  
3372 # split literal space
3373 0 elsif (/\G \b qq (\#) [ ] (\#) /oxgc) { return 'Elatin7::split' . $e . qq {qq$1 $2}; }
3374 0 elsif (/\G \b qq ((?>\s*)) (\() [ ] (\)) /oxgc) { return 'Elatin7::split' . $e . qq{$1qq$2 $3}; }
3375 0 elsif (/\G \b qq ((?>\s*)) (\{) [ ] (\}) /oxgc) { return 'Elatin7::split' . $e . qq{$1qq$2 $3}; }
3376 0 elsif (/\G \b qq ((?>\s*)) (\[) [ ] (\]) /oxgc) { return 'Elatin7::split' . $e . qq{$1qq$2 $3}; }
3377 0 elsif (/\G \b qq ((?>\s*)) (\<) [ ] (\>) /oxgc) { return 'Elatin7::split' . $e . qq{$1qq$2 $3}; }
3378 0 elsif (/\G \b qq ((?>\s*)) (\S) [ ] (\2) /oxgc) { return 'Elatin7::split' . $e . qq{$1qq$2 $3}; }
3379 0 elsif (/\G \b q (\#) [ ] (\#) /oxgc) { return 'Elatin7::split' . $e . qq {q$1 $2}; }
3380 0 elsif (/\G \b q ((?>\s*)) (\() [ ] (\)) /oxgc) { return 'Elatin7::split' . $e . qq {$1q$2 $3}; }
3381 0 elsif (/\G \b q ((?>\s*)) (\{) [ ] (\}) /oxgc) { return 'Elatin7::split' . $e . qq {$1q$2 $3}; }
3382 0 elsif (/\G \b q ((?>\s*)) (\[) [ ] (\]) /oxgc) { return 'Elatin7::split' . $e . qq {$1q$2 $3}; }
3383 0 elsif (/\G \b q ((?>\s*)) (\<) [ ] (\>) /oxgc) { return 'Elatin7::split' . $e . qq {$1q$2 $3}; }
3384 0 elsif (/\G \b q ((?>\s*)) (\S) [ ] (\2) /oxgc) { return 'Elatin7::split' . $e . qq {$1q$2 $3}; }
3385 10 elsif (/\G ' [ ] ' /oxgc) { return 'Elatin7::split' . $e . qq {' '}; }
3386 0 elsif (/\G " [ ] " /oxgc) { return 'Elatin7::split' . $e . qq {" "}; }
3387  
3388 # split qq//
3389 elsif (/\G \b (qq) \b /oxgc) {
3390 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin7::qq_char)*?) (\#) /cgox) { } 0 0 0
3391 else {
3392 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3393 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 ([*\-:?\\^|]) ((?:$Elatin7::qq_char)*?) (\1) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin7::qq_char)*?) (\1) /cgox) { } 0 0 0
3394 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq ( ) --> qr ( )
3395 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq { } --> qr { }
3396 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq [ ] --> qr [ ]
3397 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq < > --> qr < >
3398 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) /oxgc) { return e_split($e.'qr','{','}',$2,''); } # qq | | --> qr { }
3399 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq * * --> qr * *
3400 }
3401 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3402 }
3403 }
3404  
3405 # split qr//
3406 elsif (/\G \b (qr) \b /oxgc) {
3407 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1,$3,$2,$4); } # qr# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin7::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 12 12
3408 else {
3409 12 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 12 0 12
3410 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 (\') ((?:$Elatin7::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 12 12
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin7::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 12 12
elsif (/\G (\S) ((?:$Elatin7::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 12 0 12
3411 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr ( )
3412 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr { }
3413 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr [ ]
3414 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr < >
3415 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { return e_split_q($e.'qr',$1, $3, $2,$4); } # qr ' '
3416 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr','{','}',$2,$4); } # qr | | --> qr { }
3417 12 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr * *
3418 }
3419 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3420 }
3421 }
3422  
3423 # split q//
3424 elsif (/\G \b (q) \b /oxgc) {
3425 0 ▶ if (/\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:\\\#|\\\\|$Elatin7::q_char)*?) (\#) /cgox) { } 0 0 0
3426 else {
3427 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3428 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 ([*\-:?\\^|]) ((?:$Elatin7::q_char)*?) (\1) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:\\\\|\\\1| $Elatin7::q_char)*?) (\1) /cgox) { } 0 0 0
3429 0 elsif (/\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q ( ) --> qr ( )
3430 0 elsif (/\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q { } --> qr { }
3431 0 elsif (/\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q [ ] --> qr [ ]
3432 0 elsif (/\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q < > --> qr < >
3433 0 elsif (/\G ([*\-:?\\^|]) ((?:$q_char)*?) (\1) /oxgc) { return e_split_q($e.'qr','{','}',$2,''); } # q | | --> qr { }
3434 0 elsif (/\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q * * --> qr * *
3435 }
3436 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3437 }
3438 }
3439  
3440 # split m//
3441 elsif (/\G \b (m) \b /oxgc) {
3442 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1,$3,$2,$4); } # m# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin7::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
3443 else {
3444 18 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 18 0 18
3445 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 (\') ((?:$Elatin7::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin7::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
elsif (/\G (\S) ((?:$Elatin7::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 18 0 18
3446 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m ( ) --> qr ( )
3447 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m { } --> qr { }
3448 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m [ ] --> qr [ ]
3449 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m < > --> qr < >
3450 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { return e_split_q($e.'qr',$1, $3, $2,$4); } # m ' ' --> qr ' '
3451 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr','{','}',$2,$4); } # m | | --> qr { }
3452 18 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m * * --> qr * *
3453 }
3454 0 die __FILE__, ": Search pattern not terminated\n";
3455 }
3456 }
3457  
3458 # split ''
3459 elsif (/\G (\') /oxgc) {
3460 0 my $q_string = '';
3461 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3462 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 ($Elatin7::q_char) /cgox) { } 0 0 0
3463 0 elsif (/\G (\\\') /oxgc) { $q_string .= $1; } # splitqr'' --> split qr''
3464 0 elsif (/\G \' /oxgc) { return e_split_q($e.q{ qr},"'","'",$q_string,''); } # ' ' --> qr ' '
3465 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3466 }
3467 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3468 }
3469  
3470 # split ""
3471 elsif (/\G (\") /oxgc) {
3472 0 my $qq_string = '';
3473 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3474 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 ($Elatin7::q_char) /cgox) { } 0 0 0
3475 0 elsif (/\G (\\\") /oxgc) { $qq_string .= $1; } # splitqr"" --> split qr""
3476 0 elsif (/\G \" /oxgc) { return e_split($e.q{ qr},'"','"',$qq_string,''); } # " " --> qr " "
3477 0 elsif (/\G ($q_char) /oxgc) { $qq_string .= $1; }
3478 }
3479 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3480 }
3481  
3482 # split //
3483 elsif (/\G (\/) /oxgc) {
3484 44 my $regexp = '';
3485 44 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 381 0 381
3486 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 ($Elatin7::q_char) /cgox) { } 337 0 337
3487 0 elsif (/\G (\\\/) /oxgc) { $regexp .= $1; } # splitqr// --> split qr//
3488 44 elsif (/\G \/ ([cgimosxpadlunbB]*) /oxgc) { return e_split($e.q{ qr}, '/','/',$regexp,$1); } # / / --> qr / /
3489 337 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
3490 }
3491 0 die __FILE__, ": Search pattern not terminated\n";
3492 }
3493 }
3494  
3495 # tr/// or y///
3496  
3497 # about [cdsrbB]* (/B modifier)
3498 #
3499 # P.559 appendix C
3500 # of ISBN 4-89052-384-7 Programming perl
3501 # (Japanese title is: Perl puroguramingu)
3502  
3503 elsif (/\G \b ( tr | y ) \b /oxgc) {
3504 4 my $ope = $1;
3505  
3506 # $1 $2 $3 $4 $5 $6
3507 4 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ((?:$qq_char)*?) (\#) ([cdsrbB]*) /oxgc) { # tr# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin7::qq_char)*?) (\#) ((?:$Elatin7::qq_char)*?) (\#) ([cdsrbB]*) /cgox) { } 0 4 4
3508 0 my @tr = ($tr_variable,$2);
3509 0 return e_tr(@tr,'',$4,$6);
3510 }
3511 else {
3512 4 my $e = '';
3513 4 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 4 0 4
3514 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) ((?:$Elatin7::qq_char)*?) (\1) ((?:$Elatin7::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 4 0 4
3515 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) {
3516 0 my @tr = ($tr_variable,$2);
3517 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3518 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) ((?:$Elatin7::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3519 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) ( )
3520 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) { }
3521 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) [ ]
3522 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) < >
3523 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) * *
3524 }
3525 0 die __FILE__, ": Transliteration replacement not terminated\n";
3526 }
3527 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) {
3528 0 my @tr = ($tr_variable,$2);
3529 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3530 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) ((?:$Elatin7::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3531 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } ( )
3532 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } { }
3533 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } [ ]
3534 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } < >
3535 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } * *
3536 }
3537 0 die __FILE__, ": Transliteration replacement not terminated\n";
3538 }
3539 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) {
3540 0 my @tr = ($tr_variable,$2);
3541 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3542 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin7::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3543 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] ( )
3544 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] { }
3545 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] [ ]
3546 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] < >
3547 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] * *
3548 }
3549 0 die __FILE__, ": Transliteration replacement not terminated\n";
3550 }
3551 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) {
3552 0 my @tr = ($tr_variable,$2);
3553 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3554 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin7::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3555 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > ( )
3556 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > { }
3557 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > [ ]
3558 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > < >
3559 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > * *
3560 }
3561 0 die __FILE__, ": Transliteration replacement not terminated\n";
3562 }
3563 # $1 $2 $3 $4 $5 $6
3564 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { # tr * * *
3565 4 my @tr = ($tr_variable,$2);
3566 4 return e_tr(@tr,'',$4,$6);
3567 }
3568 }
3569 0 die __FILE__, ": Transliteration pattern not terminated\n";
3570 }
3571 }
3572  
3573 # qq//
3574 elsif (/\G \b (qq) \b /oxgc) {
3575 2252 my $ope = $1;
3576  
3577 # if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { return e_qq($ope,$1,$3,$2); } # qq# #
3578 2252 ▶ if (/\G (\#) /oxgc) { # qq# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) /cgox) { } 0 2252 2252
3579 0 my $qq_string = '';
3580 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3581 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 ($Elatin7::qq_char) /cgox) { } 0 0 0
3582 0 elsif (/\G (\\\#) /oxgc) { $qq_string .= $1; }
3583 0 elsif (/\G (\#) /oxgc) { return e_qq($ope,'#','#',$qq_string); }
3584 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3585 }
3586 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3587 }
3588  
3589 else {
3590 2252 my $e = '';
3591 2252 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 2252 0 2252
3592 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
3593  
3594 # elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq ( )
3595 elsif (/\G (\() /oxgc) { # qq ( )
3596 0 my $qq_string = '';
3597 0 local $nest = 1;
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: 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 ($Elatin7::qq_char) /cgox) { } 0 0 0
3600 0 elsif (/\G (\\\)) /oxgc) { $qq_string .= $1; }
3601 0 elsif (/\G (\() /oxgc) { $qq_string .= $1; $nest++; }
3602 elsif (/\G (\)) /oxgc) {
3603 0 ▶ if (--$nest == 0) { return $e . e_qq($ope,'(',')',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin7::nest == 0) { } 0 0 0
3604 0 else { $qq_string .= $1; }
3605 }
3606 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3607 }
3608 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3609 }
3610  
3611 # elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq { }
3612 elsif (/\G (\{) /oxgc) { # qq { }
3613 2222 my $qq_string = '';
3614 2222 local $nest = 1;
3615 2222 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 85104 0 85104
3616 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 ($Elatin7::qq_char) /cgox) { } 79782 0 79782
3617 0 elsif (/\G (\\\}) /oxgc) { $qq_string .= $1; }
3618 1189 elsif (/\G (\{) /oxgc) { $qq_string .= $1; $nest++; }
3619 elsif (/\G (\}) /oxgc) {
3620 3411 ▶ if (--$nest == 0) { return $e . e_qq($ope,'{','}',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin7::nest == 0) { } 2222 1189 3411
3621 1189 else { $qq_string .= $1; }
3622 }
3623 79782 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3624 }
3625 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3626 }
3627  
3628 # elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq [ ]
3629 elsif (/\G (\[) /oxgc) { # qq [ ]
3630 0 my $qq_string = '';
3631 0 local $nest = 1;
3632 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3633 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 ($Elatin7::qq_char) /cgox) { } 0 0 0
3634 0 elsif (/\G (\\\]) /oxgc) { $qq_string .= $1; }
3635 0 elsif (/\G (\[) /oxgc) { $qq_string .= $1; $nest++; }
3636 elsif (/\G (\]) /oxgc) {
3637 0 ▶ if (--$nest == 0) { return $e . e_qq($ope,'[',']',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin7::nest == 0) { } 0 0 0
3638 0 else { $qq_string .= $1; }
3639 }
3640 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3641 }
3642 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3643 }
3644  
3645 # elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq < >
3646 elsif (/\G (\<) /oxgc) { # qq < >
3647 30 my $qq_string = '';
3648 30 local $nest = 1;
3649 30 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 1166 0 1166
3650 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 ($Elatin7::qq_char) /cgox) { } 1114 0 1114
3651 0 elsif (/\G (\\\>) /oxgc) { $qq_string .= $1; }
3652 0 elsif (/\G (\<) /oxgc) { $qq_string .= $1; $nest++; }
3653 elsif (/\G (\>) /oxgc) {
3654 30 ▶ if (--$nest == 0) { return $e . e_qq($ope,'<','>',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin7::nest == 0) { } 30 0 30
3655 0 else { $qq_string .= $1; }
3656 }
3657 1114 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3658 }
3659 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3660 }
3661  
3662 # elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq * *
3663 elsif (/\G (\S) /oxgc) { # qq * *
3664 0 my $delimiter = $1;
3665 0 my $qq_string = '';
3666 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3667 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 ($Elatin7::qq_char) /cgox) { } 0 0 0
3668 0 elsif (/\G (\\\Q$delimiter\E) /oxgc) { $qq_string .= $1; }
3669 0 elsif (/\G (\Q$delimiter\E) /oxgc) { return $e . e_qq($ope,$delimiter,$delimiter,$qq_string); }
3670 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3671 }
3672 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3673 }
3674 }
3675 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3676 }
3677 }
3678  
3679 # qr//
3680 elsif (/\G \b (qr) \b /oxgc) {
3681 0 my $ope = $1;
3682 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { # qr# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin7::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 0 0
3683 0 return e_qr($ope,$1,$3,$2,$4);
3684 }
3685 else {
3686 0 my $e = '';
3687 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3688 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 (\') ((?:$Elatin7::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin7::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin7::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
3689 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr ( )
3690 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr { }
3691 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr [ ]
3692 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr < >
3693 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { return $e . e_qr_q($ope,$1, $3, $2,$4); } # qr ' '
3694 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,'{','}',$2,$4); } # qr | | --> qr { }
3695 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr * *
3696 }
3697 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3698 }
3699 }
3700  
3701 # qw//
3702 elsif (/\G \b (qw) \b /oxgc) {
3703 16 my $ope = $1;
3704 16 ▶ if (/\G (\#) (.*?) (\#) /oxmsgc) { # qw# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) (.*?) (\#) /cgmosx) { } 0 16 16
3705 0 return e_qw($ope,$1,$3,$2);
3706 }
3707 else {
3708 16 my $e = '';
3709 16 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 16 0 16
3710 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) ((?:$Elatin7::q_char)*?) (\1) /cgmosx) { } 0 0 0
3711  
3712 16 elsif (/\G (\() ([^(]*?) (\)) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw ( )
3713 0 elsif (/\G (\() ((?:$q_paren)*?) (\)) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw ( )
3714  
3715 0 elsif (/\G (\{) ([^{]*?) (\}) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw { }
3716 0 elsif (/\G (\{) ((?:$q_brace)*?) (\}) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw { }
3717  
3718 0 elsif (/\G (\[) ([^[]*?) (\]) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw [ ]
3719 0 elsif (/\G (\[) ((?:$q_bracket)*?) (\]) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw [ ]
3720  
3721 0 elsif (/\G (\<) ([^<]*?) (\>) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw < >
3722 0 elsif (/\G (\<) ((?:$q_angle)*?) (\>) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw < >
3723  
3724 0 elsif (/\G ([\x21-\x3F]) (.*?) (\1) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw * *
3725 0 elsif (/\G (\S) ((?:$q_char)*?) (\1) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw * *
3726 }
3727 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3728 }
3729 }
3730  
3731 # qx//
3732 elsif (/\G \b (qx) \b /oxgc) {
3733 0 my $ope = $1;
3734 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qx# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin7::qq_char)*?) (\#) /cgox) { } 0 0 0
3735 0 return e_qq($ope,$1,$3,$2);
3736 }
3737 else {
3738 0 my $e = '';
3739 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3740 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 (\') ((?:$Elatin7::qq_char)*?) (\') /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin7::qq_char)*?) (\1) /cgox) { } 0 0 0
3741 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx ( )
3742 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx { }
3743 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx [ ]
3744 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx < >
3745 0 elsif (/\G (\') ((?:$qq_char)*?) (\') /oxgc) { return $e . e_q ($ope,$1,$3,$2); } # qx ' '
3746 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx * *
3747 }
3748 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3749 }
3750 }
3751  
3752 # q//
3753 elsif (/\G \b (q) \b /oxgc) {
3754 473 my $ope = $1;
3755  
3756 # if (/\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { return e_q($ope,$1,$3,$2); } # q# #
3757  
3758 # avoid "Error: Runtime exception" of perl version 5.005_03
3759 # (and so on)
3760  
3761 473 ▶ if (/\G (\#) /oxgc) { # q# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) /cgox) { } 0 473 473
3762 0 my $q_string = '';
3763 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3764 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 ($Elatin7::q_char) /cgox) { } 0 0 0
3765 0 elsif (/\G (\\\#) /oxgc) { $q_string .= $1; }
3766 0 elsif (/\G (\#) /oxgc) { return e_q($ope,'#','#',$q_string); }
3767 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3768 }
3769 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3770 }
3771  
3772 else {
3773 473 my $e = '';
3774 473 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 473 0 473
3775 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
3776  
3777 # elsif (/\G (\() ((?:\\\)|\\\\|$q_paren)*?) (\)) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q ( )
3778 elsif (/\G (\() /oxgc) { # q ( )
3779 0 my $q_string = '';
3780 0 local $nest = 1;
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: 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 ($Elatin7::q_char) /cgox) { } 0 0 0
3783 0 elsif (/\G (\\\)) /oxgc) { $q_string .= $1; }
3784 0 elsif (/\G (\\\() /oxgc) { $q_string .= $1; }
3785 0 elsif (/\G (\() /oxgc) { $q_string .= $1; $nest++; }
3786 elsif (/\G (\)) /oxgc) {
3787 0 ▶ if (--$nest == 0) { return $e . e_q($ope,'(',')',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin7::nest == 0) { } 0 0 0
3788 0 else { $q_string .= $1; }
3789 }
3790 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3791 }
3792 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3793 }
3794  
3795 # elsif (/\G (\{) ((?:\\\}|\\\\|$q_brace)*?) (\}) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q { }
3796 elsif (/\G (\{) /oxgc) { # q { }
3797 467 my $q_string = '';
3798 467 local $nest = 1;
3799 467 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 8249 0 8249
3800 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 ($Elatin7::q_char) /cgox) { } 7464 0 7464
3801 0 elsif (/\G (\\\}) /oxgc) { $q_string .= $1; }
3802 0 elsif (/\G (\\\{) /oxgc) { $q_string .= $1; }
3803 159 elsif (/\G (\{) /oxgc) { $q_string .= $1; $nest++; }
3804 elsif (/\G (\}) /oxgc) {
3805 626 ▶ if (--$nest == 0) { return $e . e_q($ope,'{','}',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin7::nest == 0) { } 467 159 626
3806 159 else { $q_string .= $1; }
3807 }
3808 7464 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_bracket)*?) (\]) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q [ ]
3814 elsif (/\G (\[) /oxgc) { # q [ ]
3815 0 my $q_string = '';
3816 0 local $nest = 1;
3817 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3818 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 ($Elatin7::q_char) /cgox) { } 0 0 0
3819 0 elsif (/\G (\\\]) /oxgc) { $q_string .= $1; }
3820 0 elsif (/\G (\\\[) /oxgc) { $q_string .= $1; }
3821 0 elsif (/\G (\[) /oxgc) { $q_string .= $1; $nest++; }
3822 elsif (/\G (\]) /oxgc) {
3823 0 ▶ if (--$nest == 0) { return $e . e_q($ope,'[',']',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin7::nest == 0) { } 0 0 0
3824 0 else { $q_string .= $1; }
3825 }
3826 0 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_angle)*?) (\>) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q < >
3832 elsif (/\G (\<) /oxgc) { # q < >
3833 5 my $q_string = '';
3834 5 local $nest = 1;
3835 5 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 88 0 88
3836 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 ($Elatin7::q_char) /cgox) { } 83 0 83
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 5 ▶ if (--$nest == 0) { return $e . e_q($ope,'<','>',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Elatin7::nest == 0) { } 5 0 5
3842 0 else { $q_string .= $1; }
3843 }
3844 83 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 (\S) ((?:\\\1|\\\\|$q_char)*?) (\1) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q * *
3850 elsif (/\G (\S) /oxgc) { # q * *
3851 1 my $delimiter = $1;
3852 1 my $q_string = '';
3853 1 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 14 0 14
3854 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 ($Elatin7::q_char) /cgox) { } 13 0 13
3855 0 elsif (/\G (\\\Q$delimiter\E) /oxgc) { $q_string .= $1; }
3856 1 elsif (/\G (\Q$delimiter\E) /oxgc) { return $e . e_q($ope,$delimiter,$delimiter,$q_string); }
3857 13 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3858 }
3859 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3860 }
3861 }
3862 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3863 }
3864 }
3865  
3866 # m//
3867 elsif (/\G \b (m) \b /oxgc) {
3868 209 my $ope = $1;
3869 209 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { # m# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin7::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
3870 0 return e_qr($ope,$1,$3,$2,$4);
3871 }
3872 else {
3873 209 my $e = '';
3874 209 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 209 0 209
3875 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 (\?) ((?:$Elatin7::qq_char)*?) (\?) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
elsif (/\G (\') ((?:$Elatin7::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 10 199 209
elsif (/\G ([*\-:\\^|]) ((?:$Elatin7::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 199 199
elsif (/\G (\S) ((?:$Elatin7::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 199 0 199
3876 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m ( )
3877 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m { }
3878 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m [ ]
3879 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m < >
3880 0 elsif (/\G (\?) ((?:$qq_char)*?) (\?) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m ? ?
3881 10 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr_q($ope,$1, $3, $2,$4); } # m ' '
3882 0 elsif (/\G ([*\-:\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,'{','}',$2,$4); } # m | | --> m { }
3883 199 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m * *
3884 }
3885 0 die __FILE__, ": Search pattern not terminated\n";
3886 }
3887 }
3888  
3889 # s///
3890  
3891 # about [cegimosxpradlunbB]* (/cg modifier)
3892 #
3893 # P.67 Pattern-Matching Operators
3894 # of ISBN 0-596-00241-6 Perl in a Nutshell, Second Edition.
3895  
3896 elsif (/\G \b (s) \b /oxgc) {
3897 101 my $ope = $1;
3898  
3899 # $1 $2 $3 $4 $5 $6
3900 101 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ((?:$qq_char)*?) (\#) ([cegimosxpradlunbB]*) /oxgc) { # s# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Elatin7::qq_char)*?) (\#) ((?:$Elatin7::qq_char)*?) (\#) ([cegimosxpradlunbB]*) /cgox) { } 1 100 101
3901 1 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3902 }
3903 else {
3904 100 my $e = '';
3905 100 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 100 0 100
3906 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 (\') ((?:$Elatin7::qq_char)*?) (\') ((?:$Elatin7::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 21 79 100
elsif (/\G ([*\-:?\\^|]) ((?:$Elatin7::qq_char)*?) (\1) ((?:$Elatin7::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 79 79
elsif (/\G (\$) ((?:$Elatin7::qq_char)*?) (\1) ((?:$Elatin7::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 79 79
elsif (/\G (\S) ((?:$Elatin7::qq_char)*?) (\1) ((?:$Elatin7::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 79 0 79
3907 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) {
3908 0 my @s = ($1,$2,$3);
3909 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3910 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 (\') ((?:$Elatin7::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin7::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Elatin7::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Elatin7::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin7::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3911 # $1 $2 $3 $4
3912 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3913 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3914 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3915 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3916 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3917 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3918 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3919 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3920 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3921 }
3922 0 die __FILE__, ": Substitution replacement not terminated\n";
3923 }
3924 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) {
3925 0 my @s = ($1,$2,$3);
3926 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3927 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 (\') ((?:$Elatin7::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin7::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Elatin7::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Elatin7::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin7::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3928 # $1 $2 $3 $4
3929 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3930 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3931 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3932 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3933 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([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 (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3938 }
3939 0 die __FILE__, ": Substitution replacement not terminated\n";
3940 }
3941 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) {
3942 0 my @s = ($1,$2,$3);
3943 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3944 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 (\') ((?:$Elatin7::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin7::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin7::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3945 # $1 $2 $3 $4
3946 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3947 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3948 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3949 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3950 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3951 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3952 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3953 }
3954 0 die __FILE__, ": Substitution replacement not terminated\n";
3955 }
3956 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) {
3957 0 my @s = ($1,$2,$3);
3958 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3959 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 10 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\') ((?:$Elatin7::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Elatin7::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Elatin7::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Elatin7::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Elatin7::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3960 # $1 $2 $3 $4
3961 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3962 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3963 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3964 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3965 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3966 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3967 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3968 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3969 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3970 }
3971 0 die __FILE__, ": Substitution replacement not terminated\n";
3972 }
3973 # $1 $2 $3 $4 $5 $6
3974 elsif (/\G (\') ((?:$qq_char)*?) (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) {
3975 21 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3976 }
3977 # $1 $2 $3 $4 $5 $6
3978 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
3979 0 return e_sub($sub_variable,'{',$2,'}','{',$4,'}',$6); # s | | | --> s { } { }
3980 }
3981 # $1 $2 $3 $4 $5 $6
3982 elsif (/\G (\$) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
3983 0 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3984 }
3985 # $1 $2 $3 $4 $5 $6
3986 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
3987 79 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3988 }
3989 }
3990 0 die __FILE__, ": Substitution pattern not terminated\n";
3991 }
3992 }
3993  
3994 # require ignore module
3995 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# require$1$2"; }
3996 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# require$1\n$2"; }
3997 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# require$1"; }
3998  
3999 # use strict; --> use strict; no strict qw(refs);
4000 37 elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "use$1 no strict qw(refs);$2"; }
4001 0 elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [^#]) /oxmsgc) { return "use$1 no strict qw(refs);\n$2"; }
4002 0 elsif (/\G \b use ((?>\s+) strict) \b /oxmsgc) { return "use$1; no strict qw(refs)"; }
4003  
4004 # use 5.12.0; --> use 5.12.0; no strict qw(refs);
4005 elsif (/\G \b use (?>\s+) ((?>([1-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /oxmsgc) {
4006 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
4007 0 return "use $1; no strict qw(refs);";
4008 }
4009 else {
4010 2 return "use $1;";
4011 }
4012 }
4013 elsif (/\G \b use (?>\s+) ((?>v([0-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /oxmsgc) {
4014 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
4015 0 return "use $1; no strict qw(refs);";
4016 }
4017 else {
4018 0 return "use $1;";
4019 }
4020 }
4021  
4022 # ignore use module
4023 2 elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# use$1$2"; }
4024 0 elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# use$1\n$2"; }
4025 0 elsif (/\G \b use ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# use$1"; }
4026  
4027 # ignore no module
4028 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# no$1$2"; }
4029 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# no$1\n$2"; }
4030 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# no$1"; }
4031  
4032 # use else
4033 0 elsif (/\G \b use \b /oxmsgc) { return "use"; }
4034  
4035 # use else
4036 2 elsif (/\G \b no \b /oxmsgc) { return "no"; }
4037  
4038 # ''
4039 elsif (/\G (?<![\w\$\@\%\&\*]) (\') /oxgc) {
4040 1142 my $q_string = '';
4041 1142 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 10175 0 10175
4042 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 ($Elatin7::q_char) /cgox) { } 8981 0 8981
4043 48 elsif (/\G (\\\') /oxgc) { $q_string .= $1; }
4044 1142 elsif (/\G \' /oxgc) { return e_q('', "'","'",$q_string); }
4045 8981 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
4046 }
4047 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4048 }
4049  
4050 # ""
4051 elsif (/\G (\") /oxgc) {
4052 1875 my $qq_string = '';
4053 1875 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 37048 0 37048
4054 37048 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 67 36981 37048
elsif (/\G (\\\") /cgox) { } 12 36969 36981
elsif (/\G \" /cgox) { } 1875 35094 36969
elsif (/\G ($Elatin7::q_char) /cgox) { } 35094 0 35094
4055 12 elsif (/\G (\\\") /oxgc) { $qq_string .= $1; }
4056 1875 elsif (/\G \" /oxgc) { return e_qq('', '"','"',$qq_string); }
4057 35094 elsif (/\G ($q_char) /oxgc) { $qq_string .= $1; }
4058 }
4059 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4060 }
4061  
4062 # ``
4063 elsif (/\G (\`) /oxgc) {
4064 1 my $qx_string = '';
4065 1 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 19 0 19
4066 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 ($Elatin7::q_char) /cgox) { } 18 0 18
4067 0 elsif (/\G (\\\`) /oxgc) { $qx_string .= $1; }
4068 1 elsif (/\G \` /oxgc) { return e_qq('', '`','`',$qx_string); }
4069 18 elsif (/\G ($q_char) /oxgc) { $qx_string .= $1; }
4070 }
4071 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4072 }
4073  
4074 # // --- not divide operator (num / num), not defined-or
4075 ▶ elsif (($slash eq 'm//') and /\G (\/) /oxgc) {
Condition100%3/3
$Elatin7::slash eq "m//" and m[\G (/) ]cgox
!ll&&!rl&&r
273278836681
MC/DC100%2/2
$Elatin7::slash eq "m//" and m[\G (/) ]cgox
$Elatin7::slash eq "m//" m[\G (/) ]cgox
Truth table100%3/3
A and B
A= $Elatin7::slash eq "m//"B= m[\G (/) ]cgox
ABresult
0X0
100
111
4076 681 my $regexp = '';
4077 681 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 5636 0 5636
4078 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 ($Elatin7::q_char) /cgox) { } 4955 0 4955
4079 0 elsif (/\G (\\\/) /oxgc) { $regexp .= $1; }
4080 681 elsif (/\G \/ ([cgimosxpadlunbB]*) /oxgc) { return e_qr('', '/','/',$regexp,$1); }
4081 4955 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
4082 }
4083 0 die __FILE__, ": Search pattern not terminated\n";
4084 }
4085  
4086 # ?? --- not conditional operator (condition ? then : else)
4087 ▶ elsif (($slash eq 'm//') and /\G (\?) /oxgc) {
Condition66%2/3
$Elatin7::slash eq "m//" and /\G (\?) /cgox
!ll&&!rl&&r
2732788360
MC/DC0%0/2
$Elatin7::slash eq "m//" and /\G (\?) /cgox
$Elatin7::slash eq "m//" /\G (\?) /cgox
Truth table66%2/3
A and B
A= $Elatin7::slash eq "m//"B= /\G (\?) /cgox
ABresult
0X0
100
111
4088 0 my $regexp = '';
4089 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
4090 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 ($Elatin7::q_char) /cgox) { } 0 0 0
4091 0 elsif (/\G (\\\?) /oxgc) { $regexp .= $1; }
4092 0 elsif (/\G \? ([cgimosxpadlunbB]*) /oxgc) { return e_qr('m','?','?',$regexp,$1); }
4093 0 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
4094 }
4095 0 die __FILE__, ": Search pattern not terminated\n";
4096 }
4097  
4098 # <<>> (a safer ARGV)
4099 0 elsif (/\G ( <<>> ) /oxgc) { $slash = 'm//'; return $1; }
4100  
4101 # << (bit shift) --- not here document
4102 0 elsif (/\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /oxgc) { $slash = 'm//'; return $1; }
4103  
4104 # <<~'HEREDOC'
4105 elsif (/\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /oxgc) {
4106 6 $slash = 'm//';
4107 6 my $here_quote = $1;
4108 6 my $delimiter = $2;
4109  
4110 # get here document
4111 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4112 6 $here_script = CORE::substr $_, pos $_;
4113 6 $here_script =~ s/.*?\n//oxm;
4114 }
4115 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
4116 6 my $heredoc = $1;
4117 6 my $indent = $2;
4118 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4119 6 push @heredoc, $heredoc . qq{\n$delimiter\n};
4120 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4121 }
4122 else {
4123 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4124 }
4125 6 return qq{<<'$delimiter'};
4126 }
4127  
4128 # <<~\HEREDOC
4129  
4130 # P.66 2.6.6. "Here" Documents
4131 # in Chapter 2: Bits and Pieces
4132 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4133  
4134 # P.73 "Here" Documents
4135 # in Chapter 2: Bits and Pieces
4136 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4137  
4138 elsif (/\G ( <<~ \\([a-zA-Z_0-9]+) ) /oxgc) {
4139 3 $slash = 'm//';
4140 3 my $here_quote = $1;
4141 3 my $delimiter = $2;
4142  
4143 # get here document
4144 3 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 3 0 3
4145 3 $here_script = CORE::substr $_, pos $_;
4146 3 $here_script =~ s/.*?\n//oxm;
4147 }
4148 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
4149 3 my $heredoc = $1;
4150 3 my $indent = $2;
4151 3 $heredoc =~ s{^$indent}{}msg; # no /ox
4152 3 push @heredoc, $heredoc . qq{\n$delimiter\n};
4153 3 push @heredoc_delimiter, qq{\\s*$delimiter};
4154 }
4155 else {
4156 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4157 }
4158 3 return qq{<<\\$delimiter};
4159 }
4160  
4161 # <<~"HEREDOC"
4162 elsif (/\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /oxgc) {
4163 6 $slash = 'm//';
4164 6 my $here_quote = $1;
4165 6 my $delimiter = $2;
4166  
4167 # get here document
4168 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4169 6 $here_script = CORE::substr $_, pos $_;
4170 6 $here_script =~ s/.*?\n//oxm;
4171 }
4172 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
4173 6 my $heredoc = $1;
4174 6 my $indent = $2;
4175 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4176 6 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4177 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4178 }
4179 else {
4180 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4181 }
4182 6 return qq{<<"$delimiter"};
4183 }
4184  
4185 # <<~HEREDOC
4186 elsif (/\G ( <<~ ([a-zA-Z_0-9]+) ) /oxgc) {
4187 3 $slash = 'm//';
4188 3 my $here_quote = $1;
4189 3 my $delimiter = $2;
4190  
4191 # get here document
4192 3 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 3 0 3
4193 3 $here_script = CORE::substr $_, pos $_;
4194 3 $here_script =~ s/.*?\n//oxm;
4195 }
4196 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
4197 3 my $heredoc = $1;
4198 3 my $indent = $2;
4199 3 $heredoc =~ s{^$indent}{}msg; # no /ox
4200 3 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4201 3 push @heredoc_delimiter, qq{\\s*$delimiter};
4202 }
4203 else {
4204 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4205 }
4206 3 return qq{<<$delimiter};
4207 }
4208  
4209 # <<~`HEREDOC`
4210 elsif (/\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /oxgc) {
4211 6 $slash = 'm//';
4212 6 my $here_quote = $1;
4213 6 my $delimiter = $2;
4214  
4215 # get here document
4216 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4217 6 $here_script = CORE::substr $_, pos $_;
4218 6 $here_script =~ s/.*?\n//oxm;
4219 }
4220 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
4221 6 my $heredoc = $1;
4222 6 my $indent = $2;
4223 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4224 6 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4225 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4226 }
4227 else {
4228 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4229 }
4230 6 return qq{<<`$delimiter`};
4231 }
4232  
4233 # <<'HEREDOC'
4234 elsif (/\G ( << '([a-zA-Z_0-9]*)' ) /oxgc) {
4235 72 $slash = 'm//';
4236 72 my $here_quote = $1;
4237 72 my $delimiter = $2;
4238  
4239 # get here document
4240 72 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 72 0 72
4241 72 $here_script = CORE::substr $_, pos $_;
4242 72 $here_script =~ s/.*?\n//oxm;
4243 }
4244 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
4245 72 push @heredoc, $1 . qq{\n$delimiter\n};
4246 72 push @heredoc_delimiter, $delimiter;
4247 }
4248 else {
4249 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4250 }
4251 72 return $here_quote;
4252 }
4253  
4254 # <<\HEREDOC
4255  
4256 # P.66 2.6.6. "Here" Documents
4257 # in Chapter 2: Bits and Pieces
4258 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4259  
4260 # P.73 "Here" Documents
4261 # in Chapter 2: Bits and Pieces
4262 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4263  
4264 elsif (/\G ( << \\([a-zA-Z_0-9]+) ) /oxgc) {
4265 0 $slash = 'm//';
4266 0 my $here_quote = $1;
4267 0 my $delimiter = $2;
4268  
4269 # get here document
4270 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4271 0 $here_script = CORE::substr $_, pos $_;
4272 0 $here_script =~ s/.*?\n//oxm;
4273 }
4274 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
4275 0 push @heredoc, $1 . qq{\n$delimiter\n};
4276 0 push @heredoc_delimiter, $delimiter;
4277 }
4278 else {
4279 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4280 }
4281 0 return $here_quote;
4282 }
4283  
4284 # <<"HEREDOC"
4285 elsif (/\G ( << "([a-zA-Z_0-9]*)" ) /oxgc) {
4286 36 $slash = 'm//';
4287 36 my $here_quote = $1;
4288 36 my $delimiter = $2;
4289  
4290 # get here document
4291 36 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 36 0 36
4292 36 $here_script = CORE::substr $_, pos $_;
4293 36 $here_script =~ s/.*?\n//oxm;
4294 }
4295 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
4296 36 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4297 36 push @heredoc_delimiter, $delimiter;
4298 }
4299 else {
4300 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4301 }
4302 36 return $here_quote;
4303 }
4304  
4305 # <<HEREDOC
4306 elsif (/\G ( << ([a-zA-Z_0-9]+) ) /oxgc) {
4307 42 $slash = 'm//';
4308 42 my $here_quote = $1;
4309 42 my $delimiter = $2;
4310  
4311 # get here document
4312 42 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 42 0 42
4313 42 $here_script = CORE::substr $_, pos $_;
4314 42 $here_script =~ s/.*?\n//oxm;
4315 }
4316 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
4317 42 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4318 42 push @heredoc_delimiter, $delimiter;
4319 }
4320 else {
4321 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4322 }
4323 42 return $here_quote;
4324 }
4325  
4326 # <<`HEREDOC`
4327 elsif (/\G ( << `([a-zA-Z_0-9]*)` ) /oxgc) {
4328 0 $slash = 'm//';
4329 0 my $here_quote = $1;
4330 0 my $delimiter = $2;
4331  
4332 # get here document
4333 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4334 0 $here_script = CORE::substr $_, pos $_;
4335 0 $here_script =~ s/.*?\n//oxm;
4336 }
4337 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
4338 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4339 0 push @heredoc_delimiter, $delimiter;
4340 }
4341 else {
4342 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4343 }
4344 0 return $here_quote;
4345 }
4346  
4347 # <<= <=> <= < operator
4348 elsif (/\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/oxgc) {
4349 12 return $1;
4350 }
4351  
4352 # <FILEHANDLE>
4353 elsif (/\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /oxgc) {
4354 0 return $1;
4355 }
4356  
4357 # <WILDCARD> --- glob
4358  
4359 # avoid "Error: Runtime exception" of perl version 5.005_03
4360  
4361 elsif (/\G < ((?:[^>\0\a\e\f\n\r\t])+?) > /oxgc) {
4362 0 return 'Elatin7::glob("' . $1 . '")';
4363 }
4364  
4365 # __DATA__
4366 0 elsif (/\G ^ ( __DATA__ \n .*) \z /oxmsgc) { return $1; }
4367  
4368 # __END__
4369 210 elsif (/\G ^ ( __END__ \n .*) \z /oxmsgc) { return $1; }
4370  
4371 # \cD Control-D
4372  
4373 # P.68 2.6.8. Other Literal Tokens
4374 # in Chapter 2: Bits and Pieces
4375 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4376  
4377 # P.76 Other Literal Tokens
4378 # in Chapter 2: Bits and Pieces
4379 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4380  
4381 0 elsif (/\G ( \cD .*) \z /oxmsgc) { return $1; }
4382  
4383 # \cZ Control-Z
4384 0 elsif (/\G ( \cZ .*) \z /oxmsgc) { return $1; }
4385  
4386 # any operator before div
4387 elsif (/\G (
4388 -- | \+\+ |
4389 [\)\}\]]
4390  
4391 5837 ) /oxgc) { $slash = 'div'; return $1; }
4392  
4393 # yada-yada or triple-dot operator
4394 elsif (/\G (
4395 \.\.\.
4396  
4397 7 ) /oxgc) { $slash = 'm//'; return q{die('Unimplemented')}; }
4398  
4399 # any operator before m//
4400  
4401 # //, //= (defined-or)
4402  
4403 # P.164 Logical Operators
4404 # in Chapter 10: More Control Structures
4405 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
4406  
4407 # P.119 C-Style Logical (Short-Circuit) Operators
4408 # in Chapter 3: Unary and Binary Operators
4409 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4410  
4411 # (and so on)
4412  
4413 # ~~
4414  
4415 # P.221 The Smart Match Operator
4416 # in Chapter 15: Smart Matching and given-when
4417 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
4418  
4419 # P.112 Smartmatch Operator
4420 # in Chapter 3: Unary and Binary Operators
4421 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4422  
4423 # (and so on)
4424  
4425 elsif (/\G ((?>
4426  
4427 !~~ | !~ | != | ! |
4428 %= | % |
4429 &&= | && | &= | &\.= | &\. | & |
4430 -= | -> | - |
4431 :(?>\s*)= |
4432 : |
4433 <<>> |
4434 <<= | <=> | <= | < |
4435 == | => | =~ | = |
4436 >>= | >> | >= | > |
4437 \*\*= | \*\* | \*= | \* |
4438 \+= | \+ |
4439 \.\. | \.= | \. |
4440 \/\/= | \/\/ |
4441 \/= | \/ |
4442 \? |
4443 \\ |
4444 \^= | \^\.= | \^\. | \^ |
4445 \b x= |
4446 \|\|= | \|\| | \|= | \|\.= | \|\. | \| |
4447 ~~ | ~\. | ~ |
4448 \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b |
4449 \b(?: print )\b |
4450  
4451 [,;\(\{\[]
4452  
4453 9767 )) /oxgc) { $slash = 'm//'; return $1; }
4454  
4455 # other any character
4456 20156 elsif (/\G ($q_char) /oxgc) { $slash = 'div'; return $1; }
4457  
4458 # system error
4459 else {
4460 0 die __FILE__, ": Oops, this shouldn't happen!\n";
4461 }
4462 }
4463  
4464 # escape Latin-7 string
4465 1871 ▶sub e_string {
Subroutine e_string: called CC=228 SCAR=104.2
Pod documented
4466 1871 my($string) = @_;
4467 1871 my $e_string = '';
4468  
4469 1871 local $slash = 'm//';
4470  
4471 # P.1024 Appendix W.10 Multibyte Processing
4472 # of ISBN 1-56592-224-7 CJKV Information Processing
4473 # (and so on)
4474  
4475 1871 my @char = $string =~ / \G (?>[^\\]|\\$q_char|$q_char) /oxmsg;
4476  
4477 # without { ... }
4478 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
4479 1854 ▶ if ($string !~ /<</oxms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /<</mosx) 1854 0 1854
4480 1854 return $string;
4481 }
4482 }
4483  
4484 E_STRING_LOOP:
4485 17 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 190 17 207
4486 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 Latin7::eval (?= (?>\s*) \{ ) /cgox) { } 0 180 180
elsif ($string =~ /\G \b Char::eval \b /cgox) { } 0 180 180
elsif ($string =~ /\G \b Latin7::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 Latin7::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 Latin7::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*) (\") ((?:$Elatin7::qq_char)+?) (\") /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\#) ((?:$Elatin7::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) ((?:$Elatin7::qq_char)+?) (\1) /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s*) (\') ((?:\\\'|\\\\|$Elatin7::q_char)+?) (\') /cgox) { } 0 180 180
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$Elatin7::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|\\\\|$Elatin7::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\$\@\%\&\*]) (\') ((?:\\\'|\\\\|$Elatin7::q_char)*?) (\') /cgox) { } 0 180 180
elsif ($string =~ /\G (\") ((?:$Elatin7::qq_char)*?) (\") /cgox) { } 0 180 180
elsif ($string =~ /\G (\`) ((?:$Elatin7::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 < ((?:$Elatin7::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 ($Elatin7::q_char) /cgox) { } 131 0 131
4487 }
4488  
4489 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> @{[Elatin7::PREMATCH()]}
4490 elsif ($string =~ /\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /oxmsgc) {
4491 0 $e_string .= q{Elatin7::PREMATCH()};
4492 0 $slash = 'div';
4493 }
4494  
4495 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> @{[Elatin7::MATCH()]}
4496 elsif ($string =~ /\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /oxmsgc) {
4497 0 $e_string .= q{Elatin7::MATCH()};
4498 0 $slash = 'div';
4499 }
4500  
4501 # $', ${'} --> $', ${'}
4502 elsif ($string =~ /\G ( \$' | \$\{'\} ) /oxmsgc) {
4503 0 $e_string .= $1;
4504 0 $slash = 'div';
4505 }
4506  
4507 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> @{[Elatin7::POSTMATCH()]}
4508 elsif ($string =~ /\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /oxmsgc) {
4509 0 $e_string .= q{Elatin7::POSTMATCH()};
4510 0 $slash = 'div';
4511 }
4512  
4513 # bareword
4514 elsif ($string =~ /\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /oxmsgc) {
4515 0 $e_string .= $1;
4516 0 $slash = 'div';
4517 }
4518  
4519 # $0 --> $0
4520 elsif ($string =~ /\G ( \$ 0 ) /oxmsgc) {
4521 0 $e_string .= $1;
4522 0 $slash = 'div';
4523 }
4524 elsif ($string =~ /\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /oxmsgc) {
4525 0 $e_string .= $1;
4526 0 $slash = 'div';
4527 }
4528  
4529 # $$ --> $$
4530 elsif ($string =~ /\G ( \$ \$ ) (?![\w\{]) /oxmsgc) {
4531 0 $e_string .= $1;
4532 0 $slash = 'div';
4533 }
4534  
4535 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
4536 # $1, $2, $3 --> $1, $2, $3 otherwise
4537 elsif ($string =~ /\G \$ ((?>[1-9][0-9]*)) /oxmsgc) {
4538 0 $e_string .= e_capture($1);
4539 0 $slash = 'div';
4540 }
4541 elsif ($string =~ /\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /oxmsgc) {
4542 0 $e_string .= e_capture($1);
4543 0 $slash = 'div';
4544 }
4545  
4546 # $$foo[ ... ] --> $ $foo->[ ... ]
4547 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /oxmsgc) {
4548 0 $e_string .= e_capture($1.'->'.$2);
4549 0 $slash = 'div';
4550 }
4551  
4552 # $$foo{ ... } --> $ $foo->{ ... }
4553 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /oxmsgc) {
4554 0 $e_string .= e_capture($1.'->'.$2);
4555 0 $slash = 'div';
4556 }
4557  
4558 # $$foo
4559 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /oxmsgc) {
4560 0 $e_string .= e_capture($1);
4561 0 $slash = 'div';
4562 }
4563  
4564 # ${ foo }
4565 elsif ($string =~ /\G \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} /oxmsgc) {
4566 0 $e_string .= '${' . $1 . '}';
4567 0 $slash = 'div';
4568 }
4569  
4570 # ${ ... }
4571 elsif ($string =~ /\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /oxmsgc) {
4572 3 $e_string .= e_capture($1);
4573 3 $slash = 'div';
4574 }
4575  
4576 # variable or function
4577 # $ @ % & * $ #
4578 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) {
4579 7 $e_string .= $1;
4580 7 $slash = 'div';
4581 }
4582 # $ $ $ $ $ $ $ $ $ $ $ $ $ $
4583 # $ @ # \ ' " / ? ( ) [ ] < >
4584 elsif ($string =~ /\G ( \$[\$\@\#\\\'\"\/\?\(\)\[\]\<\>] ) /oxmsgc) {
4585 0 $e_string .= $1;
4586 0 $slash = 'div';
4587 }
4588  
4589 # subroutines of package Elatin7
4590 0 elsif ($string =~ /\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /oxgc) { $e_string .= $1; $slash = 'm//'; }
4591 0 elsif ($string =~ /\G \b Char::eval (?= (?>\s*) \{ ) /oxgc) { $e_string .= 'eval'; $slash = 'm//'; }
4592 0 elsif ($string =~ /\G \b Latin7::eval (?= (?>\s*) \{ ) /oxgc) { $e_string .= 'eval'; $slash = 'm//'; }
4593 0 elsif ($string =~ /\G \b Char::eval \b /oxgc) { $e_string .= 'eval Char::escape'; $slash = 'm//'; }
4594 0 elsif ($string =~ /\G \b Latin7::eval \b /oxgc) { $e_string .= 'eval Latin7::escape'; $slash = 'm//'; }
4595 0 elsif ($string =~ /\G \b bytes::substr \b /oxgc) { $e_string .= 'substr'; $slash = 'm//'; }
4596 0 elsif ($string =~ /\G \b chop \b /oxgc) { $e_string .= 'Elatin7::chop'; $slash = 'm//'; }
4597 0 elsif ($string =~ /\G \b bytes::index \b /oxgc) { $e_string .= 'index'; $slash = 'm//'; }
4598 0 elsif ($string =~ /\G \b Char::index \b /oxgc) { $e_string .= 'Char::index'; $slash = 'm//'; }
4599 0 elsif ($string =~ /\G \b Latin7::index \b /oxgc) { $e_string .= 'Latin7::index'; $slash = 'm//'; }
4600 0 elsif ($string =~ /\G \b index \b /oxgc) { $e_string .= 'Elatin7::index'; $slash = 'm//'; }
4601 0 elsif ($string =~ /\G \b bytes::rindex \b /oxgc) { $e_string .= 'rindex'; $slash = 'm//'; }
4602 0 elsif ($string =~ /\G \b Char::rindex \b /oxgc) { $e_string .= 'Char::rindex'; $slash = 'm//'; }
4603 0 elsif ($string =~ /\G \b Latin7::rindex \b /oxgc) { $e_string .= 'Latin7::rindex'; $slash = 'm//'; }
4604 0 elsif ($string =~ /\G \b rindex \b /oxgc) { $e_string .= 'Elatin7::rindex'; $slash = 'm//'; }
4605 0 elsif ($string =~ /\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin7::lc'; $slash = 'm//'; }
4606 0 elsif ($string =~ /\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin7::lcfirst'; $slash = 'm//'; }
4607 0 elsif ($string =~ /\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin7::uc'; $slash = 'm//'; }
4608 0 elsif ($string =~ /\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin7::ucfirst'; $slash = 'm//'; }
4609 0 elsif ($string =~ /\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin7::fc'; $slash = 'm//'; }
4610  
4611 # "-s '' ..." means file test "-s 'filename' ..." (not means "- s/// ...")
4612 0 elsif ($string =~ /\G -s (?>\s*) (\") ((?:$qq_char)+?) (\") /oxgc) { $e_string .= '-s ' . e_qq('', $1,$3,$2); $slash = 'm//'; }
4613 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\#) ((?:$qq_char)+?) (\#) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4614 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4615 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4616 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4617 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4618 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\S) ((?:$qq_char)+?) (\1) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4619  
4620 0 elsif ($string =~ /\G -s (?>\s*) (\') ((?:\\\'|\\\\|$q_char)+?) (\') /oxgc) { $e_string .= '-s ' . e_q ('', $1,$3,$2); $slash = 'm//'; }
4621 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$q_char)+?) (\#) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4622 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4623 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4624 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4625 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4626 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//'; }
4627  
4628 elsif ($string =~ /\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)*) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ))*) /oxgc)
4629 0 { $e_string .= "-s $1"; $slash = 'm//'; }
4630 0 elsif ($string =~ /\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /oxgc) { $e_string .= "-s ($1)"; $slash = 'm//'; }
4631 0 elsif ($string =~ /\G -s (?= (?>\s+) [a-z]+) /oxgc) { $e_string .= '-s'; $slash = 'm//'; }
4632 0 elsif ($string =~ /\G -s (?>\s+) ((?>\w+)) /oxgc) { $e_string .= "-s $1"; $slash = 'm//'; }
4633  
4634 0 elsif ($string =~ /\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'length'; $slash = 'm//'; }
4635 0 elsif ($string =~ /\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'chr'; $slash = 'm//'; }
4636 0 elsif ($string =~ /\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin7::chr'; $slash = 'm//'; }
4637 0 elsif ($string =~ /\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'ord'; $slash = 'div'; }
4638 0 elsif ($string =~ /\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= $function_ord; $slash = 'div'; }
4639 0 elsif ($string =~ /\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Elatin7::glob'; $slash = 'm//'; }
4640 0 elsif ($string =~ /\G \b lc \b /oxgc) { $e_string .= 'Elatin7::lc_'; $slash = 'm//'; }
4641 0 elsif ($string =~ /\G \b lcfirst \b /oxgc) { $e_string .= 'Elatin7::lcfirst_'; $slash = 'm//'; }
4642 0 elsif ($string =~ /\G \b uc \b /oxgc) { $e_string .= 'Elatin7::uc_'; $slash = 'm//'; }
4643 0 elsif ($string =~ /\G \b ucfirst \b /oxgc) { $e_string .= 'Elatin7::ucfirst_'; $slash = 'm//'; }
4644 0 elsif ($string =~ /\G \b fc \b /oxgc) { $e_string .= 'Elatin7::fc_'; $slash = 'm//'; }
4645 0 elsif ($string =~ /\G -s \b /oxgc) { $e_string .= '-s '; $slash = 'm//'; }
4646  
4647 0 elsif ($string =~ /\G \b bytes::length \b /oxgc) { $e_string .= 'length'; $slash = 'm//'; }
4648 0 elsif ($string =~ /\G \b bytes::chr \b /oxgc) { $e_string .= 'chr'; $slash = 'm//'; }
4649 0 elsif ($string =~ /\G \b chr \b /oxgc) { $e_string .= 'Elatin7::chr_'; $slash = 'm//'; }
4650 0 elsif ($string =~ /\G \b bytes::ord \b /oxgc) { $e_string .= 'ord'; $slash = 'div'; }
4651 0 elsif ($string =~ /\G \b ord \b /oxgc) { $e_string .= $function_ord_; $slash = 'div'; }
4652 0 elsif ($string =~ /\G \b glob \b /oxgc) { $e_string .= 'Elatin7::glob_'; $slash = 'm//'; }
4653 0 elsif ($string =~ /\G \b reverse \b /oxgc) { $e_string .= $function_reverse; $slash = 'm//'; }
4654 0 elsif ($string =~ /\G \b getc \b /oxgc) { $e_string .= $function_getc; $slash = 'm//'; }
4655 # split
4656 elsif ($string =~ /\G \b (split) \b (?! (?>\s*) => ) /oxgc) {
4657 0 $slash = 'm//';
4658  
4659 0 my $e = '';
4660 0 ▶ while ($string =~ /\G ( (?>\s+) | \( | \#.* ) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G ( (?>\s+) | \( | \#.* ) /cgox) 0 0 0
4661 0 $e .= $1;
4662 }
4663  
4664 # end of split
4665 0 ▶ if ($string =~ /\G (?= [,;\)\}\]] ) /oxgc) { return 'Elatin7::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
4666  
4667 # split scalar value
4668 0 elsif ($string =~ /\G ( [\$\@\&\*] $qq_scalar ) /oxgc) { $e_string .= 'Elatin7::split' . $e . e_string($1); next E_STRING_LOOP; }
4669  
4670 # split literal space
4671 0 elsif ($string =~ /\G \b qq (\#) [ ] (\#) /oxgc) { $e_string .= 'Elatin7::split' . $e . qq {qq$1 $2}; next E_STRING_LOOP; }
4672 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\() [ ] (\)) /oxgc) { $e_string .= 'Elatin7::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4673 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\{) [ ] (\}) /oxgc) { $e_string .= 'Elatin7::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4674 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\[) [ ] (\]) /oxgc) { $e_string .= 'Elatin7::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4675 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\<) [ ] (\>) /oxgc) { $e_string .= 'Elatin7::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4676 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\S) [ ] (\2) /oxgc) { $e_string .= 'Elatin7::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4677 0 elsif ($string =~ /\G \b q (\#) [ ] (\#) /oxgc) { $e_string .= 'Elatin7::split' . $e . qq {q$1 $2}; next E_STRING_LOOP; }
4678 0 elsif ($string =~ /\G \b q ((?>\s*)) (\() [ ] (\)) /oxgc) { $e_string .= 'Elatin7::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4679 0 elsif ($string =~ /\G \b q ((?>\s*)) (\{) [ ] (\}) /oxgc) { $e_string .= 'Elatin7::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4680 0 elsif ($string =~ /\G \b q ((?>\s*)) (\[) [ ] (\]) /oxgc) { $e_string .= 'Elatin7::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4681 0 elsif ($string =~ /\G \b q ((?>\s*)) (\<) [ ] (\>) /oxgc) { $e_string .= 'Elatin7::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4682 0 elsif ($string =~ /\G \b q ((?>\s*)) (\S) [ ] (\2) /oxgc) { $e_string .= 'Elatin7::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4683 0 elsif ($string =~ /\G ' [ ] ' /oxgc) { $e_string .= 'Elatin7::split' . $e . qq {' '}; next E_STRING_LOOP; }
4684 0 elsif ($string =~ /\G " [ ] " /oxgc) { $e_string .= 'Elatin7::split' . $e . qq {" "}; next E_STRING_LOOP; }
4685  
4686 # split qq//
4687 elsif ($string =~ /\G \b (qq) \b /oxgc) {
4688 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 (\#) ((?:$Elatin7::qq_char)*?) (\#) /cgox) { } 0 0 0
4689 else {
4690 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4691 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 ([*\-:?\\^|]) ((?:$Elatin7::qq_char)*?) (\1) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Elatin7::qq_char)*?) (\1) /cgox) { } 0 0 0
4692 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq ( ) --> qr ( )
4693 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq { } --> qr { }
4694 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq [ ] --> qr [ ]
4695 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq < > --> qr < >
4696 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= e_split($e.'qr','{','}',$2,''); next E_STRING_LOOP; } # qq | | --> qr { }
4697 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq * * --> qr * *
4698 }
4699 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4700 }
4701 }
4702  
4703 # split qr//
4704 elsif ($string =~ /\G \b (qr) \b /oxgc) {
4705 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 (\#) ((?:$Elatin7::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 0 0
4706 else {
4707 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4708 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 (\') ((?:$Elatin7::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$Elatin7::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Elatin7::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
4709 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr ( )
4710 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr { }
4711 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr [ ]
4712 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr < >
4713 0 elsif ($string =~ /\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split_q($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr ' '
4714 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr','{','}',$2,$4); next E_STRING_LOOP; } # qr | | --> qr { }
4715 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 * *
4716 }
4717 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4718 }
4719 }
4720  
4721 # split q//
4722 elsif ($string =~ /\G \b (q) \b /oxgc) {
4723 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 (\#) ((?:\\\#|\\\\|$Elatin7::q_char)*?) (\#) /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: 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 ([*\-:?\\^|]) ((?:$Elatin7::q_char)*?) (\1) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:\\\\|\\\1| $Elatin7::q_char)*?) (\1) /cgox) { } 0 0 0
4727 0 elsif ($string =~ /\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q ( ) --> qr ( )
4728 0 elsif ($string =~ /\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q { } --> qr { }
4729 0 elsif ($string =~ /\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q [ ] --> qr [ ]
4730 0 elsif ($string =~ /\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q < > --> qr < >
4731 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$q_char)*?) (\1) /oxgc) { $e_string .= e_split_q($e.'qr','{','}',$2,''); next E_STRING_LOOP; } # q | | --> qr { }
4732 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 * *
4733 }
4734 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4735 }
4736 }
4737  
4738 # split m//
4739 elsif ($string =~ /\G \b (m) \b /oxgc) {
4740 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 (\#) ((?:$Elatin7::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
4741 else {
4742 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4743 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 (\') ((?:$Elatin7::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$Elatin7::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Elatin7::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
4744 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m ( ) --> qr ( )
4745 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m { } --> qr { }
4746 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m [ ] --> qr [ ]
4747 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m < > --> qr < >
4748 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 ' '
4749 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr','{','}',$2,$4); next E_STRING_LOOP; } # m | | --> qr { }
4750 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 * *
4751 }
4752 0 die __FILE__, ": Search pattern not terminated\n";
4753 }
4754 }
4755  
4756 # split ''
4757 elsif ($string =~ /\G (\') /oxgc) {
4758 0 my $q_string = '';
4759 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4760 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 ($Elatin7::q_char) /cgox) { } 0 0 0
4761 0 elsif ($string =~ /\G (\\\') /oxgc) { $q_string .= $1; } # splitqr'' --> split qr''
4762 0 elsif ($string =~ /\G \' /oxgc) { $e_string .= e_split_q($e.q{ qr},"'","'",$q_string,''); next E_STRING_LOOP; } # ' ' --> qr ' '
4763 0 elsif ($string =~ /\G ($q_char) /oxgc) { $q_string .= $1; }
4764 }
4765 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4766 }
4767  
4768 # split ""
4769 elsif ($string =~ /\G (\") /oxgc) {
4770 0 my $qq_string = '';
4771 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4772 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 ($Elatin7::q_char) /cgox) { } 0 0 0
4773 0 elsif ($string =~ /\G (\\\") /oxgc) { $qq_string .= $1; } # splitqr"" --> split qr""
4774 0 elsif ($string =~ /\G \" /oxgc) { $e_string .= e_split($e.q{ qr},'"','"',$qq_string,''); next E_STRING_LOOP; } # " " --> qr " "
4775 0 elsif ($string =~ /\G ($q_char) /oxgc) { $qq_string .= $1; }
4776 }
4777 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4778 }
4779  
4780 # split //
4781 elsif ($string =~ /\G (\/) /oxgc) {
4782 0 my $regexp = '';
4783 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4784 0 ▶ if ($string =~ /\G (\\\\) /oxgc) { $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 ($Elatin7::q_char) /cgox) { } 0 0 0
4785 0 elsif ($string =~ /\G (\\\/) /oxgc) { $regexp .= $1; } # splitqr// --> split qr//
4786 0 elsif ($string =~ /\G \/ ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split($e.q{ qr}, '/','/',$regexp,$1); next E_STRING_LOOP; } # / / --> qr / /
4787 0 elsif ($string =~ /\G ($q_char) /oxgc) { $regexp .= $1; }
4788 }
4789 0 die __FILE__, ": Search pattern not terminated\n";
4790 }
4791 }
4792  
4793 # qq//
4794 elsif ($string =~ /\G \b (qq) \b /oxgc) {
4795 0 my $ope = $1;
4796 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qq# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Elatin7::qq_char)*?) (\#) /cgox) { } 0 0 0
4797 0 $e_string .= e_qq($ope,$1,$3,$2);
4798 }
4799 else {
4800 0 my $e = '';
4801 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4802 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) ((?:$Elatin7::qq_char)*?) (\1) /cgox) { } 0 0 0
4803 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq ( )
4804 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq { }
4805 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq [ ]
4806 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq < >
4807 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq * *
4808 }
4809 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4810 }
4811 }
4812  
4813 # qx//
4814 elsif ($string =~ /\G \b (qx) \b /oxgc) {
4815 0 my $ope = $1;
4816 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qx# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Elatin7::qq_char)*?) (\#) /cgox) { } 0 0 0
4817 0 $e_string .= e_qq($ope,$1,$3,$2);
4818 }
4819 else {
4820 0 my $e = '';
4821 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4822 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 (\') ((?:$Elatin7::qq_char)*?) (\') /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Elatin7::qq_char)*?) (\1) /cgox) { } 0 0 0
4823 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx ( )
4824 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx { }
4825 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx [ ]
4826 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx < >
4827 0 elsif ($string =~ /\G (\') ((?:$qq_char)*?) (\') /oxgc) { $e_string .= $e . e_q ($ope,$1,$3,$2); next E_STRING_LOOP; } # qx ' '
4828 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx * *
4829 }
4830 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4831 }
4832 }
4833  
4834 # q//
4835 elsif ($string =~ /\G \b (q) \b /oxgc) {
4836 0 my $ope = $1;
4837 0 ▶ if ($string =~ /\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { # q# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:\\\#|\\\\|$Elatin7::q_char)*?) (\#) /cgox) { } 0 0 0
4838 0 $e_string .= e_q($ope,$1,$3,$2);
4839 }
4840 else {
4841 0 my $e = '';
4842 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4843 0 ▶ if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 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| $Elatin7::q_char)*?) (\1) /cgox) { } 0 0 0
4844 0 elsif ($string =~ /\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q ( )
4845 0 elsif ($string =~ /\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q { }
4846 0 elsif ($string =~ /\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q [ ]
4847 0 elsif ($string =~ /\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q < >
4848 0 elsif ($string =~ /\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q * *
4849 }
4850 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4851 }
4852 }
4853  
4854 # ''
4855 0 elsif ($string =~ /\G (?<![\w\$\@\%\&\*]) (\') ((?:\\\'|\\\\|$q_char)*?) (\') /oxgc) { $e_string .= e_q('',$1,$3,$2); }
4856  
4857 # ""
4858 0 elsif ($string =~ /\G (\") ((?:$qq_char)*?) (\") /oxgc) { $e_string .= e_qq('',$1,$3,$2); }
4859  
4860 # ``
4861 0 elsif ($string =~ /\G (\`) ((?:$qq_char)*?) (\`) /oxgc) { $e_string .= e_qq('',$1,$3,$2); }
4862  
4863 # <<>> (a safer ARGV)
4864 0 elsif ($string =~ /\G ( <<>> ) /oxgc) { $e_string .= $1; }
4865  
4866 # <<= <=> <= < operator
4867 0 elsif ($string =~ /\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/oxgc) { $e_string .= $1; }
4868  
4869 # <FILEHANDLE>
4870 0 elsif ($string =~ /\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /oxgc) { $e_string .= $1; }
4871  
4872 # <WILDCARD> --- glob
4873 elsif ($string =~ /\G < ((?:$q_char)+?) > /oxgc) {
4874 0 $e_string .= 'Elatin7::glob("' . $1 . '")';
4875 }
4876  
4877 # << (bit shift) --- not here document
4878 elsif ($string =~ /\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /oxgc) {
4879 0 $slash = 'm//';
4880 0 $e_string .= $1;
4881 }
4882  
4883 # <<~'HEREDOC'
4884 elsif ($string =~ /\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /oxgc) {
4885 0 $slash = 'm//';
4886 0 my $here_quote = $1;
4887 0 my $delimiter = $2;
4888  
4889 # get here document
4890 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4891 0 $here_script = CORE::substr $_, pos $_;
4892 0 $here_script =~ s/.*?\n//oxm;
4893 }
4894 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
4895 0 my $heredoc = $1;
4896 0 my $indent = $2;
4897 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4898 0 push @heredoc, $heredoc . qq{\n$delimiter\n};
4899 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4900 }
4901 else {
4902 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4903 }
4904 0 $e_string .= qq{<<'$delimiter'};
4905 }
4906  
4907 # <<~\HEREDOC
4908 elsif ($string =~ /\G ( <<~ \\([a-zA-Z_0-9]+) ) /oxgc) {
4909 0 $slash = 'm//';
4910 0 my $here_quote = $1;
4911 0 my $delimiter = $2;
4912  
4913 # get here document
4914 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4915 0 $here_script = CORE::substr $_, pos $_;
4916 0 $here_script =~ s/.*?\n//oxm;
4917 }
4918 0 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 0 0 0
4919 0 my $heredoc = $1;
4920 0 my $indent = $2;
4921 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4922 0 push @heredoc, $heredoc . qq{\n$delimiter\n};
4923 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4924 }
4925 else {
4926 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4927 }
4928 0 $e_string .= qq{<<\\$delimiter};
4929 }
4930  
4931 # <<~"HEREDOC"
4932 elsif ($string =~ /\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /oxgc) {
4933 0 $slash = 'm//';
4934 0 my $here_quote = $1;
4935 0 my $delimiter = $2;
4936  
4937 # get here document
4938 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4939 0 $here_script = CORE::substr $_, pos $_;
4940 0 $here_script =~ s/.*?\n//oxm;
4941 }
4942 0 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 0 0 0
4943 0 my $heredoc = $1;
4944 0 my $indent = $2;
4945 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4946 0 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4947 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4948 }
4949 else {
4950 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4951 }
4952 0 $e_string .= qq{<<"$delimiter"};
4953 }
4954  
4955 # <<~HEREDOC
4956 elsif ($string =~ /\G ( <<~ ([a-zA-Z_0-9]+) ) /oxgc) {
4957 0 $slash = 'm//';
4958 0 my $here_quote = $1;
4959 0 my $delimiter = $2;
4960  
4961 # get here document
4962 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4963 0 $here_script = CORE::substr $_, pos $_;
4964 0 $here_script =~ s/.*?\n//oxm;
4965 }
4966 0 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 0 0 0
4967 0 my $heredoc = $1;
4968 0 my $indent = $2;
4969 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4970 0 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4971 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4972 }
4973 else {
4974 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4975 }
4976 0 $e_string .= qq{<<$delimiter};
4977 }
4978  
4979 # <<~`HEREDOC`
4980 elsif ($string =~ /\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /oxgc) {
4981 0 $slash = 'm//';
4982 0 my $here_quote = $1;
4983 0 my $delimiter = $2;
4984  
4985 # get here document
4986 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4987 0 $here_script = CORE::substr $_, pos $_;
4988 0 $here_script =~ s/.*?\n//oxm;
4989 }
4990 0 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 0 0 0
4991 0 my $heredoc = $1;
4992 0 my $indent = $2;
4993 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4994 0 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4995 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4996 }
4997 else {
4998 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4999 }
5000 0 $e_string .= qq{<<`$delimiter`};
5001 }
5002  
5003 # <<'HEREDOC'
5004 elsif ($string =~ /\G ( << '([a-zA-Z_0-9]*)' ) /oxgc) {
5005 0 $slash = 'm//';
5006 0 my $here_quote = $1;
5007 0 my $delimiter = $2;
5008  
5009 # get here document
5010 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5011 0 $here_script = CORE::substr $_, pos $_;
5012 0 $here_script =~ s/.*?\n//oxm;
5013 }
5014 0 ▶ if ($here_script =~ s/\A (.*?) \n $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n $delimiter \n //msx) { } 0 0 0
5015 0 push @heredoc, $1 . qq{\n$delimiter\n};
5016 0 push @heredoc_delimiter, $delimiter;
5017 }
5018 else {
5019 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5020 }
5021 0 $e_string .= $here_quote;
5022 }
5023  
5024 # <<\HEREDOC
5025 elsif ($string =~ /\G ( << \\([a-zA-Z_0-9]+) ) /oxgc) {
5026 0 $slash = 'm//';
5027 0 my $here_quote = $1;
5028 0 my $delimiter = $2;
5029  
5030 # get here document
5031 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5032 0 $here_script = CORE::substr $_, pos $_;
5033 0 $here_script =~ s/.*?\n//oxm;
5034 }
5035 0 ▶ if ($here_script =~ s/\A (.*?) \n $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n $delimiter \n //msx) { } 0 0 0
5036 0 push @heredoc, $1 . qq{\n$delimiter\n};
5037 0 push @heredoc_delimiter, $delimiter;
5038 }
5039 else {
5040 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5041 }
5042 0 $e_string .= $here_quote;
5043 }
5044  
5045 # <<"HEREDOC"
5046 elsif ($string =~ /\G ( << "([a-zA-Z_0-9]*)" ) /oxgc) {
5047 0 $slash = 'm//';
5048 0 my $here_quote = $1;
5049 0 my $delimiter = $2;
5050  
5051 # get here document
5052 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5053 0 $here_script = CORE::substr $_, pos $_;
5054 0 $here_script =~ s/.*?\n//oxm;
5055 }
5056 0 ▶ if ($here_script =~ s/\A (.*?) \n $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n $delimiter \n //msx) { } 0 0 0
5057 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
5058 0 push @heredoc_delimiter, $delimiter;
5059 }
5060 else {
5061 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5062 }
5063 0 $e_string .= $here_quote;
5064 }
5065  
5066 # <<HEREDOC
5067 elsif ($string =~ /\G ( << ([a-zA-Z_0-9]+) ) /oxgc) {
5068 0 $slash = 'm//';
5069 0 my $here_quote = $1;
5070 0 my $delimiter = $2;
5071  
5072 # get here document
5073 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5074 0 $here_script = CORE::substr $_, pos $_;
5075 0 $here_script =~ s/.*?\n//oxm;
5076 }
5077 0 ▶ if ($here_script =~ s/\A (.*?) \n $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n $delimiter \n //msx) { } 0 0 0
5078 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
5079 0 push @heredoc_delimiter, $delimiter;
5080 }
5081 else {
5082 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5083 }
5084 0 $e_string .= $here_quote;
5085 }
5086  
5087 # <<`HEREDOC`
5088 elsif ($string =~ /\G ( << `([a-zA-Z_0-9]*)` ) /oxgc) {
5089 0 $slash = 'm//';
5090 0 my $here_quote = $1;
5091 0 my $delimiter = $2;
5092  
5093 # get here document
5094 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
5095 0 $here_script = CORE::substr $_, pos $_;
5096 0 $here_script =~ s/.*?\n//oxm;
5097 }
5098 0 ▶ if ($here_script =~ s/\A (.*?) \n $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n $delimiter \n //msx) { } 0 0 0
5099 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
5100 0 push @heredoc_delimiter, $delimiter;
5101 }
5102 else {
5103 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
5104 }
5105 0 $e_string .= $here_quote;
5106 }
5107  
5108 # any operator before div
5109 elsif ($string =~ /\G (
5110 -- | \+\+ |
5111 [\)\}\]]
5112  
5113 18 ) /oxgc) { $slash = 'div'; $e_string .= $1; }
5114  
5115 # yada-yada or triple-dot operator
5116 elsif ($string =~ /\G (
5117 \.\.\.
5118  
5119 0 ) /oxgc) { $slash = 'm//'; $e_string .= q{die('Unimplemented')}; }
5120  
5121 # any operator before m//
5122 elsif ($string =~ /\G ((?>
5123  
5124 !~~ | !~ | != | ! |
5125 %= | % |
5126 &&= | && | &= | &\.= | &\. | & |
5127 -= | -> | - |
5128 :(?>\s*)= |
5129 : |
5130 <<>> |
5131 <<= | <=> | <= | < |
5132 == | => | =~ | = |
5133 >>= | >> | >= | > |
5134 \*\*= | \*\* | \*= | \* |
5135 \+= | \+ |
5136 \.\. | \.= | \. |
5137 \/\/= | \/\/ |
5138 \/= | \/ |
5139 \? |
5140 \\ |
5141 \^= | \^\.= | \^\. | \^ |
5142 \b x= |
5143 \|\|= | \|\| | \|= | \|\.= | \|\. | \| |
5144 ~~ | ~\. | ~ |
5145 \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b |
5146 \b(?: print )\b |
5147  
5148 [,;\(\{\[]
5149  
5150 31 )) /oxgc) { $slash = 'm//'; $e_string .= $1; }
5151  
5152 # other any character
5153 131 elsif ($string =~ /\G ($q_char) /oxgc) { $e_string .= $1; }
5154  
5155 # system error
5156 else {
5157 0 die __FILE__, ": Oops, this shouldn't happen!\n";
5158 }
5159 }
5160  
5161 17 return $e_string;
5162 }
5163  
5164 #
5165 # character class
5166 #
5167 1920 ▶sub character_class {
Subroutine character_class: called CC=3 SCAR=11.0
Pod undocumented
5168 1920 my($char,$modifier) = @_;
5169  
5170 1920 ▶ if ($char eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char eq '.') { } 52 1868 1920
5171 52 ▶ if ($modifier =~ /s/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/) { } 17 35 52
5172 17 return '${Elatin7::dot_s}';
5173 }
5174 else {
5175 35 return '${Elatin7::dot}';
5176 }
5177 }
5178 else {
5179 1868 return Elatin7::classic_character_class($char);
5180 }
5181 }
5182  
5183 #
5184 # escape capture ($1, $2, $3, ...)
5185 #
5186 212 ▶sub e_capture {
Subroutine e_capture: called CC=1 SCAR=0.0
Pod undocumented
5187  
5188 212 return join '', '${', $_[0], '}';
5189 }
5190  
5191 #
5192 # escape transliteration (tr/// or y///)
5193 #
5194 4 ▶sub e_tr {
Subroutine e_tr: called CC=5 SCAR=16.8
Pod undocumented
5195 4 my($variable,$charclass,$e,$charclass2,$modifier) = @_;
5196 4 my $e_tr = '';
5197 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
5198  
5199 4 $slash = 'div';
5200  
5201 # quote character class 1
5202 4 $charclass = q_tr($charclass);
5203  
5204 # quote character class 2
5205 4 $charclass2 = q_tr($charclass2);
5206  
5207 # /b /B modifier
5208 4 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) { } 0 4 4
5209 0 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq '') { } 0 0 0
5210 0 $e_tr = qq{tr$charclass$e$charclass2$modifier};
5211 }
5212 else {
5213 0 $e_tr = qq{$variable${bind_operator}tr$charclass$e$charclass2$modifier};
5214 }
5215 }
5216 else {
5217 4 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq '') { } 2 2 4
5218 2 $e_tr = qq{Elatin7::tr(\$_,' =~ ',$charclass,$e$charclass2,'$modifier')};
5219 }
5220 else {
5221 2 $e_tr = qq{Elatin7::tr($variable,'$bind_operator',$charclass,$e$charclass2,'$modifier')};
5222 }
5223 }
5224  
5225 # clear tr/// variable
5226 4 $tr_variable = '';
5227 4 $bind_operator = '';
5228  
5229 4 return $e_tr;
5230 }
5231  
5232 #
5233 # quote for escape transliteration (tr/// or y///)
5234 #
5235 8 ▶sub q_tr {
Subroutine q_tr: called CC=9 SCAR=40.6
Pod undocumented
5236 8 my($charclass) = @_;
5237  
5238 # quote character class
5239 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
5240 8 return e_q('', "'", "'", $charclass); # --> q' '
5241 }
5242 elsif ($charclass !~ /\//oxms) {
5243 0 return e_q('q', '/', '/', $charclass); # --> q/ /
5244 }
5245 elsif ($charclass !~ /\#/oxms) {
5246 0 return e_q('q', '#', '#', $charclass); # --> q# #
5247 }
5248 elsif ($charclass !~ /[\<\>]/oxms) {
5249 0 return e_q('q', '<', '>', $charclass); # --> q< >
5250 }
5251 elsif ($charclass !~ /[\(\)]/oxms) {
5252 0 return e_q('q', '(', ')', $charclass); # --> q( )
5253 }
5254 elsif ($charclass !~ /[\{\}]/oxms) {
5255 0 return e_q('q', '{', '}', $charclass); # --> q{ }
5256 }
5257 else {
5258 0 for my $char (qw( ! " $ % & * + . : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5259 0 ▶ if ($charclass !~ /\Q$char\E/xms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($charclass =~ /\Q$char\E/msx) 0 0 0
5260 0 return e_q('q', $char, $char, $charclass);
5261 }
5262 }
5263 }
5264  
5265 0 return e_q('q', '{', '}', $charclass);
5266 }
5267  
5268 #
5269 # escape q string (q//, '')
5270 #
5271 1623 ▶sub e_q {
Subroutine e_q: called CC=1 SCAR=0.0
Pod undocumented
5272 1623 my($ope,$delimiter,$end_delimiter,$string) = @_;
5273  
5274 1623 $slash = 'div';
5275  
5276 1623 return join '', $ope, $delimiter, $string, $end_delimiter;
5277 }
5278  
5279 #
5280 # escape qq string (qq//, "", qx//, ``)
5281 #
5282 4213 ▶sub e_qq {
Subroutine e_qq: called CC=37 SCAR=50.9
Pod undocumented
5283 4213 my($ope,$delimiter,$end_delimiter,$string) = @_;
5284  
5285 4213 $slash = 'div';
5286  
5287 4213 my $left_e = 0;
5288 4213 my $right_e = 0;
5289  
5290 # split regexp
5291 4213 my @char = $string =~ /\G((?>
5292 [^\\\$] |
5293 \\x\{ (?>[0-9A-Fa-f]+) \} |
5294 \\o\{ (?>[0-7]+) \} |
5295 \\N\{ (?>[^0-9\}][^\}]*) \} |
5296 \\ $q_char |
5297 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5298 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5299 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5300 \$ (?>\s* [0-9]+) |
5301 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5302 \$ \$ (?![\w\{]) |
5303 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5304 $q_char
5305 ))/oxmsg;
5306  
5307 4213 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 116647 4213 120860
5308  
5309 # "\L\u" --> "\u\L"
5310 116647 ▶ 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 116647 116647
elsif ($char[$i] eq '\\U' and $char[$i + 1] eq '\\l') { } 0 116647 116647
elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/mosx) { } 1 116646 116647
elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/mosx) { } 1 116645 116646
elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/mosx) { } 0 116645 116645
Condition33%1/3
$char[$i] eq "\\L" and $char[$i + 1] eq "\\u"
!ll&&!rl&&r
11664700
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
5311 0 @char[$i,$i+1] = @char[$i+1,$i];
5312 }
5313  
5314 # "\U\l" --> "\l\U"
5315 ▶ 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
11664700
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
5316 0 @char[$i,$i+1] = @char[$i+1,$i];
5317 }
5318  
5319 # octal escape sequence
5320 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5321 1 $char[$i] = Elatin7::octchr($1);
5322 }
5323  
5324 # hexadecimal escape sequence
5325 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5326 1 $char[$i] = Elatin7::hexchr($1);
5327 }
5328  
5329 # \N{CHARNAME} --> N{CHARNAME}
5330 elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5331 0 $char[$i] = $1;
5332 }
5333  
5334 116647 ▶ if (0) {
Branch: 23 branches
BranchTrueFalseTotal
if (do { $char[$i] =~ /\A ([<>]) \z/mosx }) { } 484 116163 116647
elsif ($char[$i] eq '\\u') { } 0 116163 116163
elsif ($char[$i] eq '\\l') { } 0 116163 116163
elsif ($char[$i] eq '\\U') { } 0 116163 116163
elsif ($char[$i] eq '\\L') { } 0 116163 116163
elsif ($char[$i] eq '\\F') { } 24 116139 116163
elsif ($char[$i] eq '\\Q') { } 0 116139 116139
elsif ($char[$i] eq '\\E') { } 24 116115 116139
elsif ($char[$i] eq '\\Q') { } 0 116115 116115
elsif ($char[$i] eq '\\E') { } 0 116115 116115
elsif ($char[$i] =~ /\A \$ 0 \z/mosx) { } 4 116111 116115
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/mosx) { } 0 116111 116111
elsif ($char[$i] =~ /\A \$\$ \z/mosx) { } 0 116111 116111
elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/mosx) { } 205 115906 116111
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/mosx) { } 0 115906 115906
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/mosx) { } 0 115906 115906
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/mosx) { } 0 115906 115906
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/mosx) { } 0 115906 115906
elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/cgmosx) { } 44 115862 115906
elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/cgmosx) { } 45 115817 115862
elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/cgmosx) { } 33 115784 115817
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/mosx) { } 0 115784 115784
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/mosx) { } 0 115784 115784
5335 }
5336  
5337 # \F
5338 #
5339 # P.69 Table 2-6. Translation escapes
5340 # in Chapter 2: Bits and Pieces
5341 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
5342 # (and so on)
5343  
5344 # \u \l \U \L \F \Q \E
5345 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
5346 484 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 484 484
5347 0 $char[$i] = '\\' . $char[$i];
5348 }
5349 }
5350 elsif ($char[$i] eq '\u') {
5351  
5352 # "STRING @{[ LIST EXPR ]} MORE STRING"
5353  
5354 # P.257 Other Tricks You Can Do with Hard References
5355 # in Chapter 8: References
5356 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
5357  
5358 # P.353 Other Tricks You Can Do with Hard References
5359 # in Chapter 8: References
5360 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
5361  
5362 # (and so on)
5363  
5364 0 $char[$i] = '@{[Elatin7::ucfirst qq<';
5365 0 $left_e++;
5366 }
5367 elsif ($char[$i] eq '\l') {
5368 0 $char[$i] = '@{[Elatin7::lcfirst qq<';
5369 0 $left_e++;
5370 }
5371 elsif ($char[$i] eq '\U') {
5372 0 $char[$i] = '@{[Elatin7::uc qq<';
5373 0 $left_e++;
5374 }
5375 elsif ($char[$i] eq '\L') {
5376 0 $char[$i] = '@{[Elatin7::lc qq<';
5377 0 $left_e++;
5378 }
5379 elsif ($char[$i] eq '\F') {
5380 24 $char[$i] = '@{[Elatin7::fc qq<';
5381 24 $left_e++;
5382 }
5383 elsif ($char[$i] eq '\Q') {
5384 0 $char[$i] = '@{[CORE::quotemeta qq<';
5385 0 $left_e++;
5386 }
5387 elsif ($char[$i] eq '\E') {
5388 24 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 24 0 24
5389 24 $char[$i] = '>]}';
5390 24 $right_e++;
5391 }
5392 else {
5393 0 $char[$i] = '';
5394 }
5395 }
5396 elsif ($char[$i] eq '\Q') {
5397 0 while (1) {
5398 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5399 0 last;
5400 }
5401 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
5402 0 last;
5403 }
5404 }
5405 }
5406 elsif ($char[$i] eq '\E') {
5407 }
5408  
5409 # $0 --> $0
5410 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
5411 }
5412 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
5413 }
5414  
5415 # $$ --> $$
5416 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
5417 }
5418  
5419 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
5420 # $1, $2, $3 --> $1, $2, $3 otherwise
5421 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
5422 205 $char[$i] = e_capture($1);
5423 }
5424 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
5425 0 $char[$i] = e_capture($1);
5426 }
5427  
5428 # $$foo[ ... ] --> $ $foo->[ ... ]
5429 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
5430 0 $char[$i] = e_capture($1.'->'.$2);
5431 }
5432  
5433 # $$foo{ ... } --> $ $foo->{ ... }
5434 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
5435 0 $char[$i] = e_capture($1.'->'.$2);
5436 }
5437  
5438 # $$foo
5439 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
5440 0 $char[$i] = e_capture($1);
5441 }
5442  
5443 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin7::PREMATCH()
5444 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
5445 44 $char[$i] = '@{[Elatin7::PREMATCH()]}';
5446 }
5447  
5448 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin7::MATCH()
5449 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
5450 45 $char[$i] = '@{[Elatin7::MATCH()]}';
5451 }
5452  
5453 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin7::POSTMATCH()
5454 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
5455 33 $char[$i] = '@{[Elatin7::POSTMATCH()]}';
5456 }
5457  
5458 # ${ foo } --> ${ foo }
5459 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/oxms) {
5460 }
5461  
5462 # ${ ... }
5463 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5464 0 $char[$i] = e_capture($1);
5465 }
5466 }
5467  
5468 # return string
5469 4213 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 4213 4213
5470 0 return join '', $ope, $delimiter, @char, '>]}' x ($left_e - $right_e), $end_delimiter;
5471 }
5472 4213 return join '', $ope, $delimiter, @char, $end_delimiter;
5473 }
5474  
5475 #
5476 # escape qw string (qw//)
5477 #
5478 16 ▶sub e_qw {
Subroutine e_qw: called CC=11 SCAR=43.1
Pod undocumented
5479 16 my($ope,$delimiter,$end_delimiter,$string) = @_;
5480  
5481 16 $slash = 'div';
5482  
5483 # choice again delimiter
5484 16 my %octet = map {$_ => 1} ($string =~ /\G ([\x00-\xFF]) /oxmsg);
5485 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
5486 16 return join '', $ope, $delimiter, $string, $end_delimiter;
5487 }
5488 elsif (not $octet{')'}) {
5489 0 return join '', $ope, '(', $string, ')';
5490 }
5491 elsif (not $octet{'}'}) {
5492 0 return join '', $ope, '{', $string, '}';
5493 }
5494 elsif (not $octet{']'}) {
5495 0 return join '', $ope, '[', $string, ']';
5496 }
5497 elsif (not $octet{'>'}) {
5498 0 return join '', $ope, '<', $string, '>';
5499 }
5500 else {
5501 0 for my $char (qw( ! " $ % & * + - . / : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5502 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5503 0 return join '', $ope, $char, $string, $char;
5504 }
5505 }
5506 }
5507  
5508 # qw/AAA BBB C'CC/ --> ('AAA', 'BBB', 'C\'CC')
5509 0 my @string = CORE::split(/\s+/, $string);
5510 0 for my $string (@string) {
5511 0 my @octet = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5512 0 for my $octet (@octet) {
5513 0 ▶ if ($octet =~ /\A (['\\]) \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($octet =~ /\A (['\\]) \z/mosx) 0 0 0
5514 0 $octet = '\\' . $1;
5515 }
5516 }
5517 0 $string = join '', @octet;
5518 }
5519 0 return join '', '(', (join ', ', map { "'$_'" } @string), ')';
5520 }
5521  
5522 #
5523 # escape here document (<<"HEREDOC", <<HEREDOC, <<`HEREDOC`, <<~"HEREDOC", <<~HEREDOC, <<~`HEREDOC`)
5524 #
5525 93 ▶sub e_heredoc {
Subroutine e_heredoc: called CC=37 SCAR=56.3
Pod undocumented
5526 93 my($string) = @_;
5527  
5528 93 $slash = 'm//';
5529  
5530 93 my $metachar = qr/[\@\\|]/oxms; # '|' is for <<`HEREDOC`
5531  
5532 93 my $left_e = 0;
5533 93 my $right_e = 0;
5534  
5535 # split regexp
5536 93 my @char = $string =~ /\G((?>
5537 [^\\\$] |
5538 \\x\{ (?>[0-9A-Fa-f]+) \} |
5539 \\o\{ (?>[0-7]+) \} |
5540 \\N\{ (?>[^0-9\}][^\}]*) \} |
5541 \\ $q_char |
5542 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5543 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5544 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5545 \$ (?>\s* [0-9]+) |
5546 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5547 \$ \$ (?![\w\{]) |
5548 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5549 $q_char
5550 ))/oxmsg;
5551  
5552 93 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 3177 93 3270
5553  
5554 # "\L\u" --> "\u\L"
5555 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
5556 0 @char[$i,$i+1] = @char[$i+1,$i];
5557 }
5558  
5559 # "\U\l" --> "\l\U"
5560 ▶ 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
5561 0 @char[$i,$i+1] = @char[$i+1,$i];
5562 }
5563  
5564 # octal escape sequence
5565 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5566 1 $char[$i] = Elatin7::octchr($1);
5567 }
5568  
5569 # hexadecimal escape sequence
5570 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5571 1 $char[$i] = Elatin7::hexchr($1);
5572 }
5573  
5574 # \N{CHARNAME} --> N{CHARNAME}
5575 elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5576 0 $char[$i] = $1;
5577 }
5578  
5579 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
5580 }
5581  
5582 # \u \l \U \L \F \Q \E
5583 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
5584 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
5585 0 $char[$i] = '\\' . $char[$i];
5586 }
5587 }
5588 elsif ($char[$i] eq '\u') {
5589 0 $char[$i] = '@{[Elatin7::ucfirst qq<';
5590 0 $left_e++;
5591 }
5592 elsif ($char[$i] eq '\l') {
5593 0 $char[$i] = '@{[Elatin7::lcfirst qq<';
5594 0 $left_e++;
5595 }
5596 elsif ($char[$i] eq '\U') {
5597 0 $char[$i] = '@{[Elatin7::uc qq<';
5598 0 $left_e++;
5599 }
5600 elsif ($char[$i] eq '\L') {
5601 0 $char[$i] = '@{[Elatin7::lc qq<';
5602 0 $left_e++;
5603 }
5604 elsif ($char[$i] eq '\F') {
5605 0 $char[$i] = '@{[Elatin7::fc qq<';
5606 0 $left_e++;
5607 }
5608 elsif ($char[$i] eq '\Q') {
5609 0 $char[$i] = '@{[CORE::quotemeta qq<';
5610 0 $left_e++;
5611 }
5612 elsif ($char[$i] eq '\E') {
5613 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
5614 0 $char[$i] = '>]}';
5615 0 $right_e++;
5616 }
5617 else {
5618 0 $char[$i] = '';
5619 }
5620 }
5621 elsif ($char[$i] eq '\Q') {
5622 0 while (1) {
5623 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5624 0 last;
5625 }
5626 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
5627 0 last;
5628 }
5629 }
5630 }
5631 elsif ($char[$i] eq '\E') {
5632 }
5633  
5634 # $0 --> $0
5635 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
5636 }
5637 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
5638 }
5639  
5640 # $$ --> $$
5641 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
5642 }
5643  
5644 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
5645 # $1, $2, $3 --> $1, $2, $3 otherwise
5646 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
5647 0 $char[$i] = e_capture($1);
5648 }
5649 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
5650 0 $char[$i] = e_capture($1);
5651 }
5652  
5653 # $$foo[ ... ] --> $ $foo->[ ... ]
5654 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
5655 0 $char[$i] = e_capture($1.'->'.$2);
5656 }
5657  
5658 # $$foo{ ... } --> $ $foo->{ ... }
5659 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
5660 0 $char[$i] = e_capture($1.'->'.$2);
5661 }
5662  
5663 # $$foo
5664 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
5665 0 $char[$i] = e_capture($1);
5666 }
5667  
5668 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin7::PREMATCH()
5669 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
5670 8 $char[$i] = '@{[Elatin7::PREMATCH()]}';
5671 }
5672  
5673 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin7::MATCH()
5674 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
5675 8 $char[$i] = '@{[Elatin7::MATCH()]}';
5676 }
5677  
5678 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin7::POSTMATCH()
5679 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
5680 6 $char[$i] = '@{[Elatin7::POSTMATCH()]}';
5681 }
5682  
5683 # ${ foo } --> ${ foo }
5684 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/oxms) {
5685 }
5686  
5687 # ${ ... }
5688 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5689 0 $char[$i] = e_capture($1);
5690 }
5691 }
5692  
5693 # return string
5694 93 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 93 93
5695 0 return join '', @char, '>]}' x ($left_e - $right_e);
5696 }
5697 93 return join '', @char;
5698 }
5699  
5700 #
5701 # escape regexp (m//, qr//)
5702 #
5703 880 ▶sub e_qr {
Subroutine e_qr: called CC=110 SCAR=73.6
Pod undocumented
5704 880 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5705 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
5706  
5707 880 $modifier =~ tr/p//d;
5708 880 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 880 880
5709 0 my $line = 0;
5710 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
5711 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
5712 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
5713 0 last;
5714 }
5715 }
5716 0 die qq{Unsupported modifier "$1" used at line $line.\n};
5717 }
5718  
5719 880 $slash = 'div';
5720  
5721 # literal null string pattern
5722 880 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 872 880
elsif ($modifier =~ tr/Bb//d) { } 2 870 872
5723 8 $modifier =~ tr/bB//d;
5724 8 $modifier =~ tr/i//d;
5725 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
5726 }
5727  
5728 # /b /B modifier
5729 elsif ($modifier =~ tr/bB//d) {
5730  
5731 # choice again delimiter
5732 2 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 2 2
5733 0 my @char = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5734 0 my %octet = map {$_ => 1} @char;
5735 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
5736 0 $delimiter = '(';
5737 0 $end_delimiter = ')';
5738 }
5739 elsif (not $octet{'}'}) {
5740 0 $delimiter = '{';
5741 0 $end_delimiter = '}';
5742 }
5743 elsif (not $octet{']'}) {
5744 0 $delimiter = '[';
5745 0 $end_delimiter = ']';
5746 }
5747 elsif (not $octet{'>'}) {
5748 0 $delimiter = '<';
5749 0 $end_delimiter = '>';
5750 }
5751 else {
5752 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5753 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5754 0 $delimiter = $char;
5755 0 $end_delimiter = $char;
5756 0 last;
5757 }
5758 }
5759 }
5760 }
5761  
5762 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
5763 0 return join '', $ope, $delimiter, $string, $matched, $end_delimiter, $modifier;
5764 }
5765 else {
5766 2 return join '', $ope, $delimiter, '(?:', $string, ')', $matched, $end_delimiter, $modifier;
5767 }
5768 }
5769  
5770 870 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 312 558 870
5771 870 my $metachar = qr/[\@\\|[\]{^]/oxms;
5772  
5773 # split regexp
5774 870 my @char = $string =~ /\G((?>
5775 [^\\\$\@\[\(] |
5776 \\x (?>[0-9A-Fa-f]{1,2}) |
5777 \\ (?>[0-7]{2,3}) |
5778 \\c [\x40-\x5F] |
5779 \\x\{ (?>[0-9A-Fa-f]+) \} |
5780 \\o\{ (?>[0-7]+) \} |
5781 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
5782 \\ $q_char |
5783 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5784 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5785 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5786 [\$\@] $qq_variable |
5787 \$ (?>\s* [0-9]+) |
5788 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5789 \$ \$ (?![\w\{]) |
5790 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5791 \[\^ |
5792 \[\: (?>[a-z]+) :\] |
5793 \[\:\^ (?>[a-z]+) :\] |
5794 \(\? |
5795 $q_char
5796 ))/oxmsg;
5797  
5798 # choice again delimiter
5799 870 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 870 870
5800 0 my %octet = map {$_ => 1} @char;
5801 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
5802 0 $delimiter = '(';
5803 0 $end_delimiter = ')';
5804 }
5805 elsif (not $octet{'}'}) {
5806 0 $delimiter = '{';
5807 0 $end_delimiter = '}';
5808 }
5809 elsif (not $octet{']'}) {
5810 0 $delimiter = '[';
5811 0 $end_delimiter = ']';
5812 }
5813 elsif (not $octet{'>'}) {
5814 0 $delimiter = '<';
5815 0 $end_delimiter = '>';
5816 }
5817 else {
5818 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5819 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5820 0 $delimiter = $char;
5821 0 $end_delimiter = $char;
5822 0 last;
5823 }
5824 }
5825 }
5826 }
5827  
5828 870 my $left_e = 0;
5829 870 my $right_e = 0;
5830 870 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 2100 870 2970
5831  
5832 # "\L\u" --> "\u\L"
5833 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
5834 0 @char[$i,$i+1] = @char[$i+1,$i];
5835 }
5836  
5837 # "\U\l" --> "\l\U"
5838 ▶ 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
5839 0 @char[$i,$i+1] = @char[$i+1,$i];
5840 }
5841  
5842 # octal escape sequence
5843 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5844 1 $char[$i] = Elatin7::octchr($1);
5845 }
5846  
5847 # hexadecimal escape sequence
5848 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5849 1 $char[$i] = Elatin7::hexchr($1);
5850 }
5851  
5852 # \b{...} --> b\{...}
5853 # \B{...} --> B\{...}
5854 # \N{CHARNAME} --> N\{CHARNAME}
5855 # \p{PROPERTY} --> p\{PROPERTY}
5856 # \P{PROPERTY} --> P\{PROPERTY}
5857 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5858 6 $char[$i] = $1 . '\\' . $2;
5859 }
5860  
5861 # \p, \P, \X --> p, P, X
5862 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
5863 4 $char[$i] = $1;
5864 }
5865  
5866 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 &Elatin7::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
5867 }
5868  
5869 # join separated multiple-octet
5870 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
5871 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 $Elatin7::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 $Elatin7::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 $Elatin7::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 $Elatin7::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 $Elatin7::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 $Elatin7::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 $Elatin7::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5872 0 $char[$i] .= join '', splice @char, $i+1, 3;
5873 }
5874 ▶ 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 $Elatin7::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 $Elatin7::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 $Elatin7::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 $Elatin7::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5875 0 $char[$i] .= join '', splice @char, $i+1, 2;
5876 }
5877 ▶ 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 $Elatin7::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 $Elatin7::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 $Elatin7::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 $Elatin7::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5878 0 $char[$i] .= join '', splice @char, $i+1, 1;
5879 }
5880 }
5881  
5882 # open character class [...]
5883 elsif ($char[$i] eq '[') {
5884 556 my $left = $i;
5885  
5886 # [] make die "Unmatched [] in regexp ...\n"
5887 # (and so on)
5888  
5889 556 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 3 553 556
5890 3 $i++;
5891 }
5892  
5893 556 while (1) {
5894 2063 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 2063 2063
5895 0 die __FILE__, ": Unmatched [] in regexp\n";
5896 }
5897 2063 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 556 1507 2063
5898 556 my $right = $i;
5899  
5900 # [...]
5901 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
5902 30 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin7::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
5903 }
5904 else {
5905 526 splice @char, $left, $right-$left+1, Elatin7::charlist_qr(@char[$left+1..$right-1], $modifier);
5906 }
5907  
5908 556 $i = $left;
5909 556 last;
5910 }
5911 }
5912 }
5913  
5914 # open character class [^...]
5915 elsif ($char[$i] eq '[^') {
5916 74 my $left = $i;
5917  
5918 # [^] make die "Unmatched [] in regexp ...\n"
5919 # (and so on)
5920  
5921 74 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 4 70 74
5922 4 $i++;
5923 }
5924  
5925 74 while (1) {
5926 272 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 272 272
5927 0 die __FILE__, ": Unmatched [] in regexp\n";
5928 }
5929 272 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 74 198 272
5930 74 my $right = $i;
5931  
5932 # [^...]
5933 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
5934 30 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin7::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
5935 }
5936 else {
5937 44 splice @char, $left, $right-$left+1, Elatin7::charlist_not_qr(@char[$left+1..$right-1], $modifier);
5938 }
5939  
5940 74 $i = $left;
5941 74 last;
5942 }
5943 }
5944 }
5945  
5946 # rewrite character class or escape character
5947 elsif (my $char = character_class($char[$i],$modifier)) {
5948 139 $char[$i] = $char;
5949 }
5950  
5951 # /i modifier
5952 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin7::uc($char[$i]) ne Elatin7::fc($char[$i]))) {
Condition100%6/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin7::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 &Elatin7::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin7::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= &Elatin7::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
5953 20 ▶ if (CORE::length(Elatin7::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 20 0 20
5954 20 $char[$i] = '[' . Elatin7::uc($char[$i]) . Elatin7::fc($char[$i]) . ']';
5955 }
5956 else {
5957 0 $char[$i] = '(?:' . Elatin7::uc($char[$i]) . '|' . Elatin7::fc($char[$i]) . ')';
5958 }
5959 }
5960  
5961 # \u \l \U \L \F \Q \E
5962 elsif ($char[$i] =~ /\A [<>] \z/oxms) {
5963 1 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 1 1
5964 0 $char[$i] = '\\' . $char[$i];
5965 }
5966 }
5967 elsif ($char[$i] eq '\u') {
5968 0 $char[$i] = '@{[Elatin7::ucfirst qq<';
5969 0 $left_e++;
5970 }
5971 elsif ($char[$i] eq '\l') {
5972 0 $char[$i] = '@{[Elatin7::lcfirst qq<';
5973 0 $left_e++;
5974 }
5975 elsif ($char[$i] eq '\U') {
5976 1 $char[$i] = '@{[Elatin7::uc qq<';
5977 1 $left_e++;
5978 }
5979 elsif ($char[$i] eq '\L') {
5980 1 $char[$i] = '@{[Elatin7::lc qq<';
5981 1 $left_e++;
5982 }
5983 elsif ($char[$i] eq '\F') {
5984 18 $char[$i] = '@{[Elatin7::fc qq<';
5985 18 $left_e++;
5986 }
5987 elsif ($char[$i] eq '\Q') {
5988 1 $char[$i] = '@{[CORE::quotemeta qq<';
5989 1 $left_e++;
5990 }
5991 elsif ($char[$i] eq '\E') {
5992 21 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 21 0 21
5993 21 $char[$i] = '>]}';
5994 21 $right_e++;
5995 }
5996 else {
5997 0 $char[$i] = '';
5998 }
5999 }
6000 elsif ($char[$i] eq '\Q') {
6001 0 while (1) {
6002 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6003 0 last;
6004 }
6005 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
6006 0 last;
6007 }
6008 }
6009 }
6010 elsif ($char[$i] eq '\E') {
6011 }
6012  
6013 # $0 --> $0
6014 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
6015 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6016 0 $char[$i] = '@{[Elatin7::ignorecase(' . $char[$i] . ')]}';
6017 }
6018 }
6019 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
6020 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6021 0 $char[$i] = '@{[Elatin7::ignorecase(' . $char[$i] . ')]}';
6022 }
6023 }
6024  
6025 # $$ --> $$
6026 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
6027 }
6028  
6029 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
6030 # $1, $2, $3 --> $1, $2, $3 otherwise
6031 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
6032 0 $char[$i] = e_capture($1);
6033 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6034 0 $char[$i] = '@{[Elatin7::ignorecase(' . $char[$i] . ')]}';
6035 }
6036 }
6037 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6038 0 $char[$i] = e_capture($1);
6039 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6040 0 $char[$i] = '@{[Elatin7::ignorecase(' . $char[$i] . ')]}';
6041 }
6042 }
6043  
6044 # $$foo[ ... ] --> $ $foo->[ ... ]
6045 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
6046 0 $char[$i] = e_capture($1.'->'.$2);
6047 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6048 0 $char[$i] = '@{[Elatin7::ignorecase(' . $char[$i] . ')]}';
6049 }
6050 }
6051  
6052 # $$foo{ ... } --> $ $foo->{ ... }
6053 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
6054 0 $char[$i] = e_capture($1.'->'.$2);
6055 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6056 0 $char[$i] = '@{[Elatin7::ignorecase(' . $char[$i] . ')]}';
6057 }
6058 }
6059  
6060 # $$foo
6061 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
6062 0 $char[$i] = e_capture($1);
6063 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6064 0 $char[$i] = '@{[Elatin7::ignorecase(' . $char[$i] . ')]}';
6065 }
6066 }
6067  
6068 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin7::PREMATCH()
6069 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
6070 8 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 8 8
6071 0 $char[$i] = '@{[Elatin7::ignorecase(Elatin7::PREMATCH())]}';
6072 }
6073 else {
6074 8 $char[$i] = '@{[Elatin7::PREMATCH()]}';
6075 }
6076 }
6077  
6078 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin7::MATCH()
6079 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
6080 8 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 8 8
6081 0 $char[$i] = '@{[Elatin7::ignorecase(Elatin7::MATCH())]}';
6082 }
6083 else {
6084 8 $char[$i] = '@{[Elatin7::MATCH()]}';
6085 }
6086 }
6087  
6088 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin7::POSTMATCH()
6089 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
6090 6 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 6 6
6091 0 $char[$i] = '@{[Elatin7::ignorecase(Elatin7::POSTMATCH())]}';
6092 }
6093 else {
6094 6 $char[$i] = '@{[Elatin7::POSTMATCH()]}';
6095 }
6096 }
6097  
6098 # ${ foo }
6099 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
6100 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6101 0 $char[$i] = '@{[Elatin7::ignorecase(' . $char[$i] . ')]}';
6102 }
6103 }
6104  
6105 # ${ ... }
6106 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
6107 0 $char[$i] = e_capture($1);
6108 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6109 0 $char[$i] = '@{[Elatin7::ignorecase(' . $char[$i] . ')]}';
6110 }
6111 }
6112  
6113 # $scalar or @array
6114 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
6115 21 $char[$i] = e_string($char[$i]);
6116 21 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 11 10 21
6117 11 $char[$i] = '@{[Elatin7::ignorecase(' . $char[$i] . ')]}';
6118 }
6119 }
6120  
6121 # quote character before ? + * {
6122 ▶ 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
6123 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
6124 }
6125 ▶ 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
6126 0 my $char = $char[$i-1];
6127 0 ▶ if ($char[$i] eq '{') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq '{') { } 0 0 0
6128 0 die __FILE__, qq{: "MULTIBYTE{n}" should be "(MULTIBYTE){n}" in m?? (and shift \$1,\$2,\$3,...) ($char){n}\n};
6129 }
6130 else {
6131 0 die __FILE__, qq{: "MULTIBYTE$char[$i]" should be "(MULTIBYTE)$char[$i]" in m?? (and shift \$1,\$2,\$3,...) ($char)$char[$i]\n};
6132 }
6133 }
6134 else {
6135 127 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6136 }
6137 }
6138 }
6139  
6140 # make regexp string
6141 870 $modifier =~ tr/i//d;
6142 870 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 870 870
6143 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
6144 0 return join '', $ope, $delimiter, $anchor, @char, '>]}' x ($left_e - $right_e), $matched, $end_delimiter, $modifier;
6145 }
6146 else {
6147 0 return join '', $ope, $delimiter, $anchor, '(?:', @char, '>]}' x ($left_e - $right_e), ')', $matched, $end_delimiter, $modifier;
6148 }
6149 }
6150 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
6151 0 return join '', $ope, $delimiter, $anchor, @char, $matched, $end_delimiter, $modifier;
6152 }
6153 else {
6154 870 return join '', $ope, $delimiter, $anchor, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6155 }
6156 }
6157  
6158 #
6159 # double quote stuff
6160 #
6161 180 ▶sub qq_stuff {
Subroutine qq_stuff: called CC=6 SCAR=18.5
Pod undocumented
6162 180 my($delimiter,$end_delimiter,$stuff) = @_;
6163  
6164 # scalar variable or array variable
6165 180 ▶ if ($stuff =~ /\A [\$\@] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($stuff =~ /\A [\$\@] /mosx) 100 80 180
6166 100 return $stuff;
6167 }
6168  
6169 # quote by delimiter
6170 80 my %octet = map {$_ => 1} ($stuff =~ /\G ([\x00-\xFF]) /oxmsg);
6171 80 for my $char (qw( ! " $ % & * + - . / : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
6172 80 ▶ next if $char eq $delimiter;
Branch: 1 branch
BranchTrueFalseTotal
if $char eq $delimiter 0 80 80
6173 80 ▶ next if $char eq $end_delimiter;
Branch: 1 branch
BranchTrueFalseTotal
if $char eq $end_delimiter 0 80 80
6174 80 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 80 0 80
6175 80 return join '', 'qq', $char, $stuff, $char;
6176 }
6177 }
6178 0 return join '', 'qq', '<', $stuff, '>';
6179 }
6180  
6181 #
6182 # escape regexp (m'', qr'', and m''b, qr''b)
6183 #
6184 10 ▶sub e_qr_q {
Subroutine e_qr_q: called CC=7 SCAR=25.3
Pod undocumented
6185 10 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6186 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
6187  
6188 10 $modifier =~ tr/p//d;
6189 10 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 10 10
6190 0 my $line = 0;
6191 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6192 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6193 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6194 0 last;
6195 }
6196 }
6197 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6198 }
6199  
6200 10 $slash = 'div';
6201  
6202 # literal null string pattern
6203 10 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 2 10
elsif ($modifier =~ tr/Bb//d) { } 0 2 2
6204 8 $modifier =~ tr/bB//d;
6205 8 $modifier =~ tr/i//d;
6206 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
6207 }
6208  
6209 # with /b /B modifier
6210 elsif ($modifier =~ tr/bB//d) {
6211 0 return e_qr_qb($ope,$delimiter,$end_delimiter,$string,$modifier);
6212 }
6213  
6214 # without /b /B modifier
6215 else {
6216 2 return e_qr_qt($ope,$delimiter,$end_delimiter,$string,$modifier);
6217 }
6218 }
6219  
6220 #
6221 # escape regexp (m'', qr'')
6222 #
6223 2 ▶sub e_qr_qt {
Subroutine e_qr_qt: called CC=20 SCAR=51.8
Pod undocumented
6224 2 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6225  
6226 2 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 2 2
6227  
6228 # split regexp
6229 2 my @char = $string =~ /\G((?>
6230 [^\\\[\$\@\/] |
6231 [\x00-\xFF] |
6232 \[\^ |
6233 \[\: (?>[a-z]+) \:\] |
6234 \[\:\^ (?>[a-z]+) \:\] |
6235 [\$\@\/] |
6236 \\ (?:$q_char) |
6237 (?:$q_char)
6238 ))/oxmsg;
6239  
6240 # unescape character
6241 2 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 2 2 4
6242 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 &Elatin7::uc($char[$i]) ne &fc($char[$i])) { } 0 2 2
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 4 4
6243 }
6244  
6245 # open character class [...]
6246 elsif ($char[$i] eq '[') {
6247 0 my $left = $i;
6248 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6249 0 $i++;
6250 }
6251 0 while (1) {
6252 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6253 0 die __FILE__, ": Unmatched [] in regexp\n";
6254 }
6255 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6256 0 my $right = $i;
6257  
6258 # [...]
6259 0 splice @char, $left, $right-$left+1, Elatin7::charlist_qr(@char[$left+1..$right-1], $modifier);
6260  
6261 0 $i = $left;
6262 0 last;
6263 }
6264 }
6265 }
6266  
6267 # open character class [^...]
6268 elsif ($char[$i] eq '[^') {
6269 0 my $left = $i;
6270 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6271 0 $i++;
6272 }
6273 0 while (1) {
6274 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6275 0 die __FILE__, ": Unmatched [] in regexp\n";
6276 }
6277 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6278 0 my $right = $i;
6279  
6280 # [^...]
6281 0 splice @char, $left, $right-$left+1, Elatin7::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6282  
6283 0 $i = $left;
6284 0 last;
6285 }
6286 }
6287 }
6288  
6289 # escape $ @ / and \
6290 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6291 0 $char[$i] = '\\' . $char[$i];
6292 }
6293  
6294 # rewrite character class or escape character
6295 elsif (my $char = character_class($char[$i],$modifier)) {
6296 0 $char[$i] = $char;
6297 }
6298  
6299 # /i modifier
6300 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin7::uc($char[$i]) ne Elatin7::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin7::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 &Elatin7::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin7::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= &Elatin7::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6301 0 ▶ if (CORE::length(Elatin7::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
6302 0 $char[$i] = '[' . Elatin7::uc($char[$i]) . Elatin7::fc($char[$i]) . ']';
6303 }
6304 else {
6305 0 $char[$i] = '(?:' . Elatin7::uc($char[$i]) . '|' . Elatin7::fc($char[$i]) . ')';
6306 }
6307 }
6308  
6309 # quote character before ? + * {
6310 ▶ 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
6311 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
6312 }
6313 else {
6314 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6315 }
6316 }
6317 }
6318  
6319 2 $delimiter = '/';
6320 2 $end_delimiter = '/';
6321  
6322 2 $modifier =~ tr/i//d;
6323 2 return join '', $ope, $delimiter, $anchor, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6324 }
6325  
6326 #
6327 # escape regexp (m''b, qr''b)
6328 #
6329 0 ▶sub e_qr_qb {
Subroutine e_qr_qb: not called CC=4 SCAR=30.0
Pod undocumented
6330 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6331  
6332 # split regexp
6333 0 my @char = $string =~ /\G ((?>[^\\]|\\\\)) /oxmsg;
6334  
6335 # unescape character
6336 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
6337 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
6338 }
6339  
6340 # remain \\
6341 elsif ($char[$i] eq '\\\\') {
6342 }
6343  
6344 # escape $ @ / and \
6345 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6346 0 $char[$i] = '\\' . $char[$i];
6347 }
6348 }
6349  
6350 0 $delimiter = '/';
6351 0 $end_delimiter = '/';
6352 0 return join '', $ope, $delimiter, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6353 }
6354  
6355 #
6356 # escape regexp (s/here//)
6357 #
6358 80 ▶sub e_s1 {
Subroutine e_s1: called CC=106 SCAR=81.1
Pod undocumented
6359 80 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6360 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
6361  
6362 80 $modifier =~ tr/p//d;
6363 80 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 80 80
6364 0 my $line = 0;
6365 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6366 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6367 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6368 0 last;
6369 }
6370 }
6371 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6372 }
6373  
6374 80 $slash = 'div';
6375  
6376 # literal null string pattern
6377 80 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 72 80
elsif ($modifier =~ tr/Bb//d) { } 0 72 72
6378 8 $modifier =~ tr/bB//d;
6379 8 $modifier =~ tr/i//d;
6380 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
6381 }
6382  
6383 # /b /B modifier
6384 elsif ($modifier =~ tr/bB//d) {
6385  
6386 # choice again delimiter
6387 0 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 0 0
6388 0 my @char = $string =~ /\G ([\x00-\xFF]) /oxmsg;
6389 0 my %octet = map {$_ => 1} @char;
6390 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
6391 0 $delimiter = '(';
6392 0 $end_delimiter = ')';
6393 }
6394 elsif (not $octet{'}'}) {
6395 0 $delimiter = '{';
6396 0 $end_delimiter = '}';
6397 }
6398 elsif (not $octet{']'}) {
6399 0 $delimiter = '[';
6400 0 $end_delimiter = ']';
6401 }
6402 elsif (not $octet{'>'}) {
6403 0 $delimiter = '<';
6404 0 $end_delimiter = '>';
6405 }
6406 else {
6407 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
6408 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
6409 0 $delimiter = $char;
6410 0 $end_delimiter = $char;
6411 0 last;
6412 }
6413 }
6414 }
6415 }
6416  
6417 0 my $prematch = '';
6418 0 return join '', $ope, $delimiter, $prematch, '(?:', $string, ')', $matched, $end_delimiter, $modifier;
6419 }
6420  
6421 72 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 1 71 72
6422 72 my $metachar = qr/[\@\\|[\]{^]/oxms;
6423  
6424 # split regexp
6425 72 my @char = $string =~ /\G((?>
6426 [^\\\$\@\[\(] |
6427 \\ (?>[1-9][0-9]*) |
6428 \\g (?>\s*) (?>[1-9][0-9]*) |
6429 \\g (?>\s*) \{ (?>\s*) (?>[1-9][0-9]*) (?>\s*) \} |
6430 \\g (?>\s*) \{ (?>\s*) - (?>\s*) (?>[1-9][0-9]*) (?>\s*) \} |
6431 \\x (?>[0-9A-Fa-f]{1,2}) |
6432 \\ (?>[0-7]{2,3}) |
6433 \\c [\x40-\x5F] |
6434 \\x\{ (?>[0-9A-Fa-f]+) \} |
6435 \\o\{ (?>[0-7]+) \} |
6436 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
6437 \\ $q_char |
6438 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
6439 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
6440 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
6441 [\$\@] $qq_variable |
6442 \$ (?>\s* [0-9]+) |
6443 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
6444 \$ \$ (?![\w\{]) |
6445 \$ (?>\s*) \$ (?>\s*) $qq_variable |
6446 \[\^ |
6447 \[\: (?>[a-z]+) :\] |
6448 \[\:\^ (?>[a-z]+) :\] |
6449 \(\? |
6450 $q_char
6451 ))/oxmsg;
6452  
6453 # choice again delimiter
6454 72 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 72 72
6455 0 my %octet = map {$_ => 1} @char;
6456 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
6457 0 $delimiter = '(';
6458 0 $end_delimiter = ')';
6459 }
6460 elsif (not $octet{'}'}) {
6461 0 $delimiter = '{';
6462 0 $end_delimiter = '}';
6463 }
6464 elsif (not $octet{']'}) {
6465 0 $delimiter = '[';
6466 0 $end_delimiter = ']';
6467 }
6468 elsif (not $octet{'>'}) {
6469 0 $delimiter = '<';
6470 0 $end_delimiter = '>';
6471 }
6472 else {
6473 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
6474 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
6475 0 $delimiter = $char;
6476 0 $end_delimiter = $char;
6477 0 last;
6478 }
6479 }
6480 }
6481 }
6482  
6483 # count '('
6484 72 my $parens = grep { $_ eq '(' } @char;
6485  
6486 72 my $left_e = 0;
6487 72 my $right_e = 0;
6488 72 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 200 72 272
6489  
6490 # "\L\u" --> "\u\L"
6491 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
6492 0 @char[$i,$i+1] = @char[$i+1,$i];
6493 }
6494  
6495 # "\U\l" --> "\l\U"
6496 ▶ 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
6497 0 @char[$i,$i+1] = @char[$i+1,$i];
6498 }
6499  
6500 # octal escape sequence
6501 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
6502 1 $char[$i] = Elatin7::octchr($1);
6503 }
6504  
6505 # hexadecimal escape sequence
6506 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
6507 1 $char[$i] = Elatin7::hexchr($1);
6508 }
6509  
6510 # \b{...} --> b\{...}
6511 # \B{...} --> B\{...}
6512 # \N{CHARNAME} --> N\{CHARNAME}
6513 # \p{PROPERTY} --> p\{PROPERTY}
6514 # \P{PROPERTY} --> P\{PROPERTY}
6515 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
6516 0 $char[$i] = $1 . '\\' . $2;
6517 }
6518  
6519 # \p, \P, \X --> p, P, X
6520 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
6521 0 $char[$i] = $1;
6522 }
6523  
6524 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 &Elatin7::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
6525 }
6526  
6527 # join separated multiple-octet
6528 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
6529 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 $Elatin7::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 $Elatin7::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 $Elatin7::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 $Elatin7::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 $Elatin7::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 $Elatin7::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 $Elatin7::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6530 0 $char[$i] .= join '', splice @char, $i+1, 3;
6531 }
6532 ▶ 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 $Elatin7::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 $Elatin7::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 $Elatin7::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 $Elatin7::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6533 0 $char[$i] .= join '', splice @char, $i+1, 2;
6534 }
6535 ▶ 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 $Elatin7::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 $Elatin7::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 $Elatin7::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 $Elatin7::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6536 0 $char[$i] .= join '', splice @char, $i+1, 1;
6537 }
6538 }
6539  
6540 # open character class [...]
6541 elsif ($char[$i] eq '[') {
6542 17 my $left = $i;
6543 17 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 17 17
6544 0 $i++;
6545 }
6546 17 while (1) {
6547 74 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 74 74
6548 0 die __FILE__, ": Unmatched [] in regexp\n";
6549 }
6550 74 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 17 57 74
6551 17 my $right = $i;
6552  
6553 # [...]
6554 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
6555 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin7::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6556 }
6557 else {
6558 17 splice @char, $left, $right-$left+1, Elatin7::charlist_qr(@char[$left+1..$right-1], $modifier);
6559 }
6560  
6561 17 $i = $left;
6562 17 last;
6563 }
6564 }
6565 }
6566  
6567 # open character class [^...]
6568 elsif ($char[$i] eq '[^') {
6569 0 my $left = $i;
6570 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6571 0 $i++;
6572 }
6573 0 while (1) {
6574 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6575 0 die __FILE__, ": Unmatched [] in regexp\n";
6576 }
6577 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6578 0 my $right = $i;
6579  
6580 # [^...]
6581 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
6582 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin7::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6583 }
6584 else {
6585 0 splice @char, $left, $right-$left+1, Elatin7::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6586 }
6587  
6588 0 $i = $left;
6589 0 last;
6590 }
6591 }
6592 }
6593  
6594 # rewrite character class or escape character
6595 elsif (my $char = character_class($char[$i],$modifier)) {
6596 7 $char[$i] = $char;
6597 }
6598  
6599 # /i modifier
6600 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin7::uc($char[$i]) ne Elatin7::fc($char[$i]))) {
Condition66%4/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin7::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 &Elatin7::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin7::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= &Elatin7::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6601 3 ▶ if (CORE::length(Elatin7::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 3 0 3
6602 3 $char[$i] = '[' . Elatin7::uc($char[$i]) . Elatin7::fc($char[$i]) . ']';
6603 }
6604 else {
6605 0 $char[$i] = '(?:' . Elatin7::uc($char[$i]) . '|' . Elatin7::fc($char[$i]) . ')';
6606 }
6607 }
6608  
6609 # \u \l \U \L \F \Q \E
6610 elsif ($char[$i] =~ /\A [<>] \z/oxms) {
6611 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
6612 0 $char[$i] = '\\' . $char[$i];
6613 }
6614 }
6615 elsif ($char[$i] eq '\u') {
6616 0 $char[$i] = '@{[Elatin7::ucfirst qq<';
6617 0 $left_e++;
6618 }
6619 elsif ($char[$i] eq '\l') {
6620 0 $char[$i] = '@{[Elatin7::lcfirst qq<';
6621 0 $left_e++;
6622 }
6623 elsif ($char[$i] eq '\U') {
6624 0 $char[$i] = '@{[Elatin7::uc qq<';
6625 0 $left_e++;
6626 }
6627 elsif ($char[$i] eq '\L') {
6628 0 $char[$i] = '@{[Elatin7::lc qq<';
6629 0 $left_e++;
6630 }
6631 elsif ($char[$i] eq '\F') {
6632 0 $char[$i] = '@{[Elatin7::fc qq<';
6633 0 $left_e++;
6634 }
6635 elsif ($char[$i] eq '\Q') {
6636 0 $char[$i] = '@{[CORE::quotemeta qq<';
6637 0 $left_e++;
6638 }
6639 elsif ($char[$i] eq '\E') {
6640 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
6641 0 $char[$i] = '>]}';
6642 0 $right_e++;
6643 }
6644 else {
6645 0 $char[$i] = '';
6646 }
6647 }
6648 elsif ($char[$i] eq '\Q') {
6649 0 while (1) {
6650 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6651 0 last;
6652 }
6653 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
6654 0 last;
6655 }
6656 }
6657 }
6658 elsif ($char[$i] eq '\E') {
6659 }
6660  
6661 # \0 --> \0
6662 elsif ($char[$i] =~ /\A \\ (?>\s*) 0 \z/oxms) {
6663 }
6664  
6665 # \g{N}, \g{-N}
6666  
6667 # P.108 Using Simple Patterns
6668 # in Chapter 7: In the World of Regular Expressions
6669 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
6670  
6671 # P.221 Capturing
6672 # in Chapter 5: Pattern Matching
6673 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
6674  
6675 # \g{-1}, \g{-2}, \g{-3} --> \g{-1}, \g{-2}, \g{-3}
6676 elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) - (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6677 }
6678  
6679 # \g{1}, \g{2}, \g{3} --> \g{2}, \g{3}, \g{4} (only when multibyte anchoring is enable)
6680 elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6681 }
6682  
6683 # \g1, \g2, \g3 --> \g2, \g3, \g4 (only when multibyte anchoring is enable)
6684 elsif ($char[$i] =~ /\A \\g (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) {
6685 }
6686  
6687 # \1, \2, \3 --> \2, \3, \4 (only when multibyte anchoring is enable)
6688 elsif ($char[$i] =~ /\A \\ (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) {
6689 }
6690  
6691 # $0 --> $0
6692 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
6693 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6694 0 $char[$i] = '@{[Elatin7::ignorecase(' . $char[$i] . ')]}';
6695 }
6696 }
6697 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
6698 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6699 0 $char[$i] = '@{[Elatin7::ignorecase(' . $char[$i] . ')]}';
6700 }
6701 }
6702  
6703 # $$ --> $$
6704 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
6705 }
6706  
6707 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
6708 # $1, $2, $3 --> $1, $2, $3 otherwise
6709 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
6710 0 $char[$i] = e_capture($1);
6711 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6712 0 $char[$i] = '@{[Elatin7::ignorecase(' . $char[$i] . ')]}';
6713 }
6714 }
6715 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6716 0 $char[$i] = e_capture($1);
6717 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6718 0 $char[$i] = '@{[Elatin7::ignorecase(' . $char[$i] . ')]}';
6719 }
6720 }
6721  
6722 # $$foo[ ... ] --> $ $foo->[ ... ]
6723 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
6724 0 $char[$i] = e_capture($1.'->'.$2);
6725 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6726 0 $char[$i] = '@{[Elatin7::ignorecase(' . $char[$i] . ')]}';
6727 }
6728 }
6729  
6730 # $$foo{ ... } --> $ $foo->{ ... }
6731 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
6732 0 $char[$i] = e_capture($1.'->'.$2);
6733 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6734 0 $char[$i] = '@{[Elatin7::ignorecase(' . $char[$i] . ')]}';
6735 }
6736 }
6737  
6738 # $$foo
6739 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
6740 0 $char[$i] = e_capture($1);
6741 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6742 0 $char[$i] = '@{[Elatin7::ignorecase(' . $char[$i] . ')]}';
6743 }
6744 }
6745  
6746 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin7::PREMATCH()
6747 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
6748 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 4 4
6749 0 $char[$i] = '@{[Elatin7::ignorecase(Elatin7::PREMATCH())]}';
6750 }
6751 else {
6752 4 $char[$i] = '@{[Elatin7::PREMATCH()]}';
6753 }
6754 }
6755  
6756 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin7::MATCH()
6757 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
6758 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 4 4
6759 0 $char[$i] = '@{[Elatin7::ignorecase(Elatin7::MATCH())]}';
6760 }
6761 else {
6762 4 $char[$i] = '@{[Elatin7::MATCH()]}';
6763 }
6764 }
6765  
6766 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin7::POSTMATCH()
6767 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
6768 3 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 3 3
6769 0 $char[$i] = '@{[Elatin7::ignorecase(Elatin7::POSTMATCH())]}';
6770 }
6771 else {
6772 3 $char[$i] = '@{[Elatin7::POSTMATCH()]}';
6773 }
6774 }
6775  
6776 # ${ foo }
6777 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
6778 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6779 0 $char[$i] = '@{[Elatin7::ignorecase(' . $char[$i] . ')]}';
6780 }
6781 }
6782  
6783 # ${ ... }
6784 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
6785 0 $char[$i] = e_capture($1);
6786 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6787 0 $char[$i] = '@{[Elatin7::ignorecase(' . $char[$i] . ')]}';
6788 }
6789 }
6790  
6791 # $scalar or @array
6792 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
6793 4 $char[$i] = e_string($char[$i]);
6794 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 4 4
6795 0 $char[$i] = '@{[Elatin7::ignorecase(' . $char[$i] . ')]}';
6796 }
6797 }
6798  
6799 # quote character before ? + * {
6800 ▶ 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
6801 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
6802 }
6803 else {
6804 14 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6805 }
6806 }
6807 }
6808  
6809 # make regexp string
6810 72 my $prematch = '';
6811 72 $modifier =~ tr/i//d;
6812 72 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 72 72
6813 0 return join '', $ope, $delimiter, $prematch, '(?:', @char, '>]}' x ($left_e - $right_e), ')', $matched, $end_delimiter, $modifier;
6814 }
6815 72 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6816 }
6817  
6818 #
6819 # escape regexp (s'here'' or s'here''b)
6820 #
6821 21 ▶sub e_s1_q {
Subroutine e_s1_q: called CC=7 SCAR=24.3
Pod undocumented
6822 21 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6823 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
6824  
6825 21 $modifier =~ tr/p//d;
6826 21 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 21 21
6827 0 my $line = 0;
6828 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6829 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6830 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6831 0 last;
6832 }
6833 }
6834 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6835 }
6836  
6837 21 $slash = 'div';
6838  
6839 # literal null string pattern
6840 21 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 13 21
elsif ($modifier =~ tr/Bb//d) { } 0 13 13
6841 8 $modifier =~ tr/bB//d;
6842 8 $modifier =~ tr/i//d;
6843 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
6844 }
6845  
6846 # with /b /B modifier
6847 elsif ($modifier =~ tr/bB//d) {
6848 0 return e_s1_qb($ope,$delimiter,$end_delimiter,$string,$modifier);
6849 }
6850  
6851 # without /b /B modifier
6852 else {
6853 13 return e_s1_qt($ope,$delimiter,$end_delimiter,$string,$modifier);
6854 }
6855 }
6856  
6857 #
6858 # escape regexp (s'here'')
6859 #
6860 13 ▶sub e_s1_qt {
Subroutine e_s1_qt: called CC=20 SCAR=50.1
Pod undocumented
6861 13 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6862  
6863 13 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 13 13
6864  
6865 # split regexp
6866 13 my @char = $string =~ /\G((?>
6867 [^\\\[\$\@\/] |
6868 [\x00-\xFF] |
6869 \[\^ |
6870 \[\: (?>[a-z]+) \:\] |
6871 \[\:\^ (?>[a-z]+) \:\] |
6872 [\$\@\/] |
6873 \\ (?:$q_char) |
6874 (?:$q_char)
6875 ))/oxmsg;
6876  
6877 # unescape character
6878 13 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 25 13 38
6879 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 &Elatin7::uc($char[$i]) ne &fc($char[$i])) { } 0 19 19
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 32 32
6880 }
6881  
6882 # open character class [...]
6883 elsif ($char[$i] eq '[') {
6884 0 my $left = $i;
6885 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6886 0 $i++;
6887 }
6888 0 while (1) {
6889 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6890 0 die __FILE__, ": Unmatched [] in regexp\n";
6891 }
6892 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6893 0 my $right = $i;
6894  
6895 # [...]
6896 0 splice @char, $left, $right-$left+1, Elatin7::charlist_qr(@char[$left+1..$right-1], $modifier);
6897  
6898 0 $i = $left;
6899 0 last;
6900 }
6901 }
6902 }
6903  
6904 # open character class [^...]
6905 elsif ($char[$i] eq '[^') {
6906 0 my $left = $i;
6907 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6908 0 $i++;
6909 }
6910 0 while (1) {
6911 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6912 0 die __FILE__, ": Unmatched [] in regexp\n";
6913 }
6914 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6915 0 my $right = $i;
6916  
6917 # [^...]
6918 0 splice @char, $left, $right-$left+1, Elatin7::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6919  
6920 0 $i = $left;
6921 0 last;
6922 }
6923 }
6924 }
6925  
6926 # escape $ @ / and \
6927 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6928 0 $char[$i] = '\\' . $char[$i];
6929 }
6930  
6931 # rewrite character class or escape character
6932 elsif (my $char = character_class($char[$i],$modifier)) {
6933 6 $char[$i] = $char;
6934 }
6935  
6936 # /i modifier
6937 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin7::uc($char[$i]) ne Elatin7::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin7::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 &Elatin7::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin7::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= &Elatin7::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6938 0 ▶ if (CORE::length(Elatin7::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
6939 0 $char[$i] = '[' . Elatin7::uc($char[$i]) . Elatin7::fc($char[$i]) . ']';
6940 }
6941 else {
6942 0 $char[$i] = '(?:' . Elatin7::uc($char[$i]) . '|' . Elatin7::fc($char[$i]) . ')';
6943 }
6944 }
6945  
6946 # quote character before ? + * {
6947 ▶ 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
6948 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
6949 }
6950 else {
6951 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6952 }
6953 }
6954 }
6955  
6956 13 $modifier =~ tr/i//d;
6957 13 $delimiter = '/';
6958 13 $end_delimiter = '/';
6959 13 my $prematch = '';
6960 13 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6961 }
6962  
6963 #
6964 # escape regexp (s'here''b)
6965 #
6966 0 ▶sub e_s1_qb {
Subroutine e_s1_qb: not called CC=4 SCAR=30.0
Pod undocumented
6967 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6968  
6969 # split regexp
6970 0 my @char = $string =~ /\G (?>[^\\]|\\\\) /oxmsg;
6971  
6972 # unescape character
6973 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
6974 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
6975 }
6976  
6977 # remain \\
6978 elsif ($char[$i] eq '\\\\') {
6979 }
6980  
6981 # escape $ @ / and \
6982 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6983 0 $char[$i] = '\\' . $char[$i];
6984 }
6985 }
6986  
6987 0 $delimiter = '/';
6988 0 $end_delimiter = '/';
6989 0 my $prematch = '';
6990 0 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6991 }
6992  
6993 #
6994 # escape regexp (s''here')
6995 #
6996 16 ▶sub e_s2_q {
Subroutine e_s2_q: called CC=4 SCAR=13.9
Pod undocumented
6997 16 my($ope,$delimiter,$end_delimiter,$string) = @_;
6998  
6999 16 $slash = 'div';
7000  
7001 16 my @char = $string =~ / \G (?>[^\\]|\\\\|$q_char) /oxmsg;
7002 16 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 9 16 25
7003 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
7004 }
7005  
7006 # not escape \\
7007 elsif ($char[$i] =~ /\A \\\\ \z/oxms) {
7008 }
7009  
7010 # escape $ @ / and \
7011 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
7012 5 $char[$i] = '\\' . $char[$i];
7013 }
7014 }
7015  
7016 16 return join '', $ope, $delimiter, @char, $end_delimiter;
7017 }
7018  
7019 #
7020 # escape regexp (s/here/and here/modifier)
7021 #
7022 101 ▶sub e_sub {
Subroutine e_sub: called CC=20 SCAR=32.6
Pod undocumented
7023 101 my($variable,$delimiter1,$pattern,$end_delimiter1,$delimiter2,$replacement,$end_delimiter2,$modifier) = @_;
7024 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
7025  
7026 101 $modifier =~ tr/p//d;
7027 101 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 101 101
7028 0 my $line = 0;
7029 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7030 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
7031 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
7032 0 last;
7033 }
7034 }
7035 0 die qq{Unsupported modifier "$1" used at line $line.\n};
7036 }
7037  
7038 101 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq "") 36 65 101
7039 36 $variable = '$_';
7040 36 $bind_operator = ' =~ ';
7041 }
7042  
7043 101 $slash = 'div';
7044  
7045 # P.128 Start of match (or end of previous match): \G
7046 # P.130 Advanced Use of \G with Perl
7047 # in Chapter 3: Overview of Regular Expression Features and Flavors
7048 # P.312 Iterative Matching: Scalar Context, with /g
7049 # in Chapter 7: Perl
7050 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
7051  
7052 # P.181 Where You Left Off: The \G Assertion
7053 # in Chapter 5: Pattern Matching
7054 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
7055  
7056 # P.220 Where You Left Off: The \G Assertion
7057 # in Chapter 5: Pattern Matching
7058 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
7059  
7060 101 my $e_modifier = $modifier =~ tr/e//d;
7061 101 my $r_modifier = $modifier =~ tr/r//d;
7062  
7063 101 my $my = '';
7064 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
7065 0 $my = $variable;
7066 0 $variable =~ s/ (?: local \b | my \b | our \b | state \b ) (?>\s*) //oxms;
7067 0 $variable =~ s/ = .+ \z//oxms;
7068 }
7069  
7070 101 (my $variable_basename = $variable) =~ s/ [\[\{].* \z//oxms;
7071 101 $variable_basename =~ s/ \s+ \z//oxms;
7072  
7073 # quote replacement string
7074 101 my $e_replacement = '';
7075 101 ▶ if ($e_modifier >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($e_modifier >= 1) { } 17 84 101
7076 17 $e_replacement = e_qq('', '', '', $replacement);
7077 17 $e_modifier--;
7078 }
7079 else {
7080 84 ▶ if ($delimiter2 eq "'") {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter2 eq q[']) { } 16 68 84
7081 16 $e_replacement = e_s2_q('qq', '/', '/', $replacement);
7082 }
7083 else {
7084 68 $e_replacement = e_qq ('qq', $delimiter2, $end_delimiter2, $replacement);
7085 }
7086 }
7087  
7088 101 my $sub = '';
7089  
7090 # with /r
7091 101 ▶ if ($r_modifier) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r_modifier) { } 10 91 101
7092 10 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $modifier =~ /g/mosx }) { } 5 5 10
7093 }
7094  
7095 # s///gr without multibyte anchoring
7096 elsif ($modifier =~ /g/oxms) {
7097 5 ▶ $sub = sprintf(
Branch: 1 branch
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 0 5 5
7098 # 1 2 3 4 5
7099 q<CORE::eval{local $Elatin7::re_t=%s; while($Elatin7::re_t =~ %s){%s local $^W=0; local $Elatin7::re_r=%s; %s$Elatin7::re_t="$`$Elatin7::re_r$'"; pos($Elatin7::re_t)=length "$`$Elatin7::re_r"; } return $Elatin7::re_t}>,
7100  
7101 $variable, # 1
7102 ($delimiter1 eq "'") ? # 2
7103 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
7104 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
7105 $s_matched, # 3
7106 $e_replacement, # 4
7107 '$Elatin7::re_r=CORE::eval $Elatin7::re_r; ' x $e_modifier, # 5
7108 );
7109 }
7110  
7111 # s///r
7112 else {
7113  
7114 5 my $prematch = q{$`};
7115  
7116 5 ▶ $sub = sprintf(
Branch: 1 branch
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 0 5 5
7117 # 1 2 3 4 5 6 7
7118 q<(%s =~ %s) ? CORE::eval{%s local $^W=0; local $Elatin7::re_r=%s; %s"%s$Elatin7::re_r$'" } : %s>,
7119  
7120 $variable, # 1
7121 ($delimiter1 eq "'") ? # 2
7122 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
7123 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
7124 $s_matched, # 3
7125 $e_replacement, # 4
7126 '$Elatin7::re_r=CORE::eval $Elatin7::re_r; ' x $e_modifier, # 5
7127 $prematch, # 6
7128 $variable, # 7
7129 );
7130 }
7131  
7132 # $var !~ s///r doesn't make sense
7133 10 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) 0 10 10
7134 0 $sub = q{die("$0: Using !~ with s///r doesn't make sense"), } . $sub;
7135 }
7136 }
7137  
7138 # without /r
7139 else {
7140 91 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $modifier =~ /g/mosx }) { } 23 68 91
7141 }
7142  
7143 # s///g without multibyte anchoring
7144 elsif ($modifier =~ /g/oxms) {
7145 23 ▶ $sub = sprintf(
Branch: 2 branches
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 3 20 23
$bind_operator =~ / !~ /mosx ? : 3 20 23
7146 # 1 2 3 4 5 6 7 8
7147 q<CORE::eval{local $Elatin7::re_n=0; while(%s =~ %s){%s local $^W=0; local $Elatin7::re_r=%s; %s%s="$`$Elatin7::re_r$'"; pos(%s)=length "$`$Elatin7::re_r"; $Elatin7::re_n++} return %s$Elatin7::re_n}>,
7148  
7149 $variable, # 1
7150 ($delimiter1 eq "'") ? # 2
7151 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
7152 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
7153 $s_matched, # 3
7154 $e_replacement, # 4
7155 '$Elatin7::re_r=CORE::eval $Elatin7::re_r; ' x $e_modifier, # 5
7156 $variable, # 6
7157 $variable, # 7
7158 ($bind_operator =~ / !~ /oxms) ? '!' : '', # 8
7159 );
7160 }
7161  
7162 # s///
7163 else {
7164  
7165 68 my $prematch = q{$`};
7166  
7167 68 ▶ $sub = sprintf(
Branch: 2 branches
BranchTrueFalseTotal
$bind_operator =~ / =~ /mosx ? : 65 3 68
$delimiter1 eq q['] ? : 18 50 68
7168  
7169 ($bind_operator =~ / =~ /oxms) ?
7170  
7171 # 1 2 3 4 5 6 7 8
7172 q<(%s%s%s) ? CORE::eval{%s local $^W=0; local $Elatin7::re_r=%s; %s%s="%s$Elatin7::re_r$'"; 1 } : undef> :
7173  
7174 # 1 2 3 4 5 6 7 8
7175 q<(%s%s%s) ? 1 : CORE::eval{%s local $^W=0; local $Elatin7::re_r=%s; %s%s="%s$Elatin7::re_r$'"; undef }>,
7176  
7177 $variable, # 1
7178 $bind_operator, # 2
7179 ($delimiter1 eq "'") ? # 3
7180 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
7181 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
7182 $s_matched, # 4
7183 $e_replacement, # 5
7184 '$Elatin7::re_r=CORE::eval $Elatin7::re_r; ' x $e_modifier, # 6
7185 $variable, # 7
7186 $prematch, # 8
7187 );
7188 }
7189 }
7190  
7191 # (my $foo = $bar) =~ s/// --> (my $foo = $bar, CORE::eval { ... })[1]
7192 101 ▶ if ($my ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($my ne "") 0 101 101
7193 0 $sub = "($my, $sub)[1]";
7194 }
7195  
7196 # clear s/// variable
7197 101 $sub_variable = '';
7198 101 $bind_operator = '';
7199  
7200 101 return $sub;
7201 }
7202  
7203 #
7204 # escape regexp of split qr//
7205 #
7206 74 ▶sub e_split {
Subroutine e_split: called CC=88 SCAR=76.4
Pod undocumented
7207 74 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
7208 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
7209  
7210 74 $modifier =~ tr/p//d;
7211 74 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 74 74
7212 0 my $line = 0;
7213 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7214 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
7215 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
7216 0 last;
7217 }
7218 }
7219 0 die qq{Unsupported modifier "$1" used at line $line.\n};
7220 }
7221  
7222 74 $slash = 'div';
7223  
7224 # /b /B modifier
7225 74 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) 0 74 74
7226 0 return join '', 'split', $ope, $delimiter, $string, $end_delimiter, $modifier;
7227 }
7228  
7229 74 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 74 74
7230 74 my $metachar = qr/[\@\\|[\]{^]/oxms;
7231  
7232 # split regexp
7233 74 my @char = $string =~ /\G((?>
7234 [^\\\$\@\[\(] |
7235 \\x (?>[0-9A-Fa-f]{1,2}) |
7236 \\ (?>[0-7]{2,3}) |
7237 \\c [\x40-\x5F] |
7238 \\x\{ (?>[0-9A-Fa-f]+) \} |
7239 \\o\{ (?>[0-7]+) \} |
7240 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
7241 \\ $q_char |
7242 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
7243 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
7244 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
7245 [\$\@] $qq_variable |
7246 \$ (?>\s* [0-9]+) |
7247 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
7248 \$ \$ (?![\w\{]) |
7249 \$ (?>\s*) \$ (?>\s*) $qq_variable |
7250 \[\^ |
7251 \[\: (?>[a-z]+) :\] |
7252 \[\:\^ (?>[a-z]+) :\] |
7253 \(\? |
7254 $q_char
7255 ))/oxmsg;
7256  
7257 74 my $left_e = 0;
7258 74 my $right_e = 0;
7259 74 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 249 74 323
7260  
7261 # "\L\u" --> "\u\L"
7262 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
7263 0 @char[$i,$i+1] = @char[$i+1,$i];
7264 }
7265  
7266 # "\U\l" --> "\l\U"
7267 ▶ 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
7268 0 @char[$i,$i+1] = @char[$i+1,$i];
7269 }
7270  
7271 # octal escape sequence
7272 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
7273 1 $char[$i] = Elatin7::octchr($1);
7274 }
7275  
7276 # hexadecimal escape sequence
7277 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
7278 1 $char[$i] = Elatin7::hexchr($1);
7279 }
7280  
7281 # \b{...} --> b\{...}
7282 # \B{...} --> B\{...}
7283 # \N{CHARNAME} --> N\{CHARNAME}
7284 # \p{PROPERTY} --> p\{PROPERTY}
7285 # \P{PROPERTY} --> P\{PROPERTY}
7286 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
7287 0 $char[$i] = $1 . '\\' . $2;
7288 }
7289  
7290 # \p, \P, \X --> p, P, X
7291 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
7292 0 $char[$i] = $1;
7293 }
7294  
7295 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 &Elatin7::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
7296 }
7297  
7298 # join separated multiple-octet
7299 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
7300 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 $Elatin7::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 $Elatin7::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 $Elatin7::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 $Elatin7::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 $Elatin7::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 $Elatin7::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 $Elatin7::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
7301 0 $char[$i] .= join '', splice @char, $i+1, 3;
7302 }
7303 ▶ 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 $Elatin7::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 $Elatin7::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 $Elatin7::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 $Elatin7::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
7304 0 $char[$i] .= join '', splice @char, $i+1, 2;
7305 }
7306 ▶ 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 $Elatin7::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 $Elatin7::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 $Elatin7::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 $Elatin7::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
7307 0 $char[$i] .= join '', splice @char, $i+1, 1;
7308 }
7309 }
7310  
7311 # open character class [...]
7312 elsif ($char[$i] eq '[') {
7313 3 my $left = $i;
7314 3 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 3 3
7315 0 $i++;
7316 }
7317 3 while (1) {
7318 7 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 7 7
7319 0 die __FILE__, ": Unmatched [] in regexp\n";
7320 }
7321 7 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 3 4 7
7322 3 my $right = $i;
7323  
7324 # [...]
7325 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
7326 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin7::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
7327 }
7328 else {
7329 3 splice @char, $left, $right-$left+1, Elatin7::charlist_qr(@char[$left+1..$right-1], $modifier);
7330 }
7331  
7332 3 $i = $left;
7333 3 last;
7334 }
7335 }
7336 }
7337  
7338 # open character class [^...]
7339 elsif ($char[$i] eq '[^') {
7340 0 my $left = $i;
7341 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7342 0 $i++;
7343 }
7344 0 while (1) {
7345 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7346 0 die __FILE__, ": Unmatched [] in regexp\n";
7347 }
7348 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7349 0 my $right = $i;
7350  
7351 # [^...]
7352 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
7353 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Elatin7::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
7354 }
7355 else {
7356 0 splice @char, $left, $right-$left+1, Elatin7::charlist_not_qr(@char[$left+1..$right-1], $modifier);
7357 }
7358  
7359 0 $i = $left;
7360 0 last;
7361 }
7362 }
7363 }
7364  
7365 # rewrite character class or escape character
7366 elsif (my $char = character_class($char[$i],$modifier)) {
7367 1 $char[$i] = $char;
7368 }
7369  
7370 # P.794 29.2.161. split
7371 # in Chapter 29: Functions
7372 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
7373  
7374 # P.951 split
7375 # in Chapter 27: Functions
7376 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
7377  
7378 # said "The //m modifier is assumed when you split on the pattern /^/",
7379 # but perl5.008 is not so. Therefore, this software adds //m.
7380 # (and so on)
7381  
7382 # split(m/^/) --> split(m/^/m)
7383 ▶ 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
7384 7 $modifier .= 'm';
7385 }
7386  
7387 # /i modifier
7388 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin7::uc($char[$i]) ne Elatin7::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin7::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 &Elatin7::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin7::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= &Elatin7::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
7389 0 ▶ if (CORE::length(Elatin7::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
7390 0 $char[$i] = '[' . Elatin7::uc($char[$i]) . Elatin7::fc($char[$i]) . ']';
7391 }
7392 else {
7393 0 $char[$i] = '(?:' . Elatin7::uc($char[$i]) . '|' . Elatin7::fc($char[$i]) . ')';
7394 }
7395 }
7396  
7397 # \u \l \U \L \F \Q \E
7398 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
7399 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
7400 0 $char[$i] = '\\' . $char[$i];
7401 }
7402 }
7403 elsif ($char[$i] eq '\u') {
7404 0 $char[$i] = '@{[Elatin7::ucfirst qq<';
7405 0 $left_e++;
7406 }
7407 elsif ($char[$i] eq '\l') {
7408 0 $char[$i] = '@{[Elatin7::lcfirst qq<';
7409 0 $left_e++;
7410 }
7411 elsif ($char[$i] eq '\U') {
7412 0 $char[$i] = '@{[Elatin7::uc qq<';
7413 0 $left_e++;
7414 }
7415 elsif ($char[$i] eq '\L') {
7416 0 $char[$i] = '@{[Elatin7::lc qq<';
7417 0 $left_e++;
7418 }
7419 elsif ($char[$i] eq '\F') {
7420 0 $char[$i] = '@{[Elatin7::fc qq<';
7421 0 $left_e++;
7422 }
7423 elsif ($char[$i] eq '\Q') {
7424 0 $char[$i] = '@{[CORE::quotemeta qq<';
7425 0 $left_e++;
7426 }
7427 elsif ($char[$i] eq '\E') {
7428 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
7429 0 $char[$i] = '>]}';
7430 0 $right_e++;
7431 }
7432 else {
7433 0 $char[$i] = '';
7434 }
7435 }
7436 elsif ($char[$i] eq '\Q') {
7437 0 while (1) {
7438 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7439 0 last;
7440 }
7441 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
7442 0 last;
7443 }
7444 }
7445 }
7446 elsif ($char[$i] eq '\E') {
7447 }
7448  
7449 # $0 --> $0
7450 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
7451 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7452 0 $char[$i] = '@{[Elatin7::ignorecase(' . $char[$i] . ')]}';
7453 }
7454 }
7455 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
7456 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7457 0 $char[$i] = '@{[Elatin7::ignorecase(' . $char[$i] . ')]}';
7458 }
7459 }
7460  
7461 # $$ --> $$
7462 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
7463 }
7464  
7465 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
7466 # $1, $2, $3 --> $1, $2, $3 otherwise
7467 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
7468 0 $char[$i] = e_capture($1);
7469 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7470 0 $char[$i] = '@{[Elatin7::ignorecase(' . $char[$i] . ')]}';
7471 }
7472 }
7473 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
7474 0 $char[$i] = e_capture($1);
7475 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7476 0 $char[$i] = '@{[Elatin7::ignorecase(' . $char[$i] . ')]}';
7477 }
7478 }
7479  
7480 # $$foo[ ... ] --> $ $foo->[ ... ]
7481 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
7482 0 $char[$i] = e_capture($1.'->'.$2);
7483 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7484 0 $char[$i] = '@{[Elatin7::ignorecase(' . $char[$i] . ')]}';
7485 }
7486 }
7487  
7488 # $$foo{ ... } --> $ $foo->{ ... }
7489 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
7490 0 $char[$i] = e_capture($1.'->'.$2);
7491 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7492 0 $char[$i] = '@{[Elatin7::ignorecase(' . $char[$i] . ')]}';
7493 }
7494 }
7495  
7496 # $$foo
7497 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
7498 0 $char[$i] = e_capture($1);
7499 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7500 0 $char[$i] = '@{[Elatin7::ignorecase(' . $char[$i] . ')]}';
7501 }
7502 }
7503  
7504 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Elatin7::PREMATCH()
7505 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
7506 12 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 12 12
7507 0 $char[$i] = '@{[Elatin7::ignorecase(Elatin7::PREMATCH())]}';
7508 }
7509 else {
7510 12 $char[$i] = '@{[Elatin7::PREMATCH()]}';
7511 }
7512 }
7513  
7514 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Elatin7::MATCH()
7515 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
7516 12 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 12 12
7517 0 $char[$i] = '@{[Elatin7::ignorecase(Elatin7::MATCH())]}';
7518 }
7519 else {
7520 12 $char[$i] = '@{[Elatin7::MATCH()]}';
7521 }
7522 }
7523  
7524 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Elatin7::POSTMATCH()
7525 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
7526 9 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 9 9
7527 0 $char[$i] = '@{[Elatin7::ignorecase(Elatin7::POSTMATCH())]}';
7528 }
7529 else {
7530 9 $char[$i] = '@{[Elatin7::POSTMATCH()]}';
7531 }
7532 }
7533  
7534 # ${ foo }
7535 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
7536 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7537 0 $char[$i] = '@{[Elatin7::ignorecase(' . $1 . ')]}';
7538 }
7539 }
7540  
7541 # ${ ... }
7542 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
7543 0 $char[$i] = e_capture($1);
7544 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7545 0 $char[$i] = '@{[Elatin7::ignorecase(' . $char[$i] . ')]}';
7546 }
7547 }
7548  
7549 # $scalar or @array
7550 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
7551 3 $char[$i] = e_string($char[$i]);
7552 3 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 3 3
7553 0 $char[$i] = '@{[Elatin7::ignorecase(' . $char[$i] . ')]}';
7554 }
7555 }
7556  
7557 # quote character before ? + * {
7558 ▶ 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
7559 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
7560 }
7561 else {
7562 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
7563 }
7564 }
7565 }
7566  
7567 # make regexp string
7568 74 $modifier =~ tr/i//d;
7569 74 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 74 74
7570 0 return join '', 'Elatin7::split', $ope, $delimiter, @char, '>]}' x ($left_e - $right_e), $end_delimiter, $modifier;
7571 }
7572 74 return join '', 'Elatin7::split', $ope, $delimiter, @char, $end_delimiter, $modifier;
7573 }
7574  
7575 #
7576 # escape regexp of split qr''
7577 #
7578 0 ▶sub e_split_q {
Subroutine e_split_q: not called CC=26 SCAR=65.5
Pod undocumented
7579 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
7580 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
7581  
7582 0 $modifier =~ tr/p//d;
7583 0 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 0 0
7584 0 my $line = 0;
7585 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7586 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
7587 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
7588 0 last;
7589 }
7590 }
7591 0 die qq{Unsupported modifier "$1" used at line $line.\n};
7592 }
7593  
7594 0 $slash = 'div';
7595  
7596 # /b /B modifier
7597 0 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) 0 0 0
7598 0 return join '', 'split', $ope, $delimiter, $string, $end_delimiter, $modifier;
7599 }
7600  
7601 0 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 0 0
7602  
7603 # split regexp
7604 0 my @char = $string =~ /\G((?>
7605 [^\\\[] |
7606 [\x00-\xFF] |
7607 \[\^ |
7608 \[\: (?>[a-z]+) \:\] |
7609 \[\:\^ (?>[a-z]+) \:\] |
7610 \\ (?:$q_char) |
7611 (?:$q_char)
7612 ))/oxmsg;
7613  
7614 # unescape character
7615 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
7616 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 &Elatin7::uc($char[$i]) ne &fc($char[$i])) { } 0 0 0
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 0 0
7617 }
7618  
7619 # open character class [...]
7620 elsif ($char[$i] eq '[') {
7621 0 my $left = $i;
7622 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7623 0 $i++;
7624 }
7625 0 while (1) {
7626 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7627 0 die __FILE__, ": Unmatched [] in regexp\n";
7628 }
7629 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7630 0 my $right = $i;
7631  
7632 # [...]
7633 0 splice @char, $left, $right-$left+1, Elatin7::charlist_qr(@char[$left+1..$right-1], $modifier);
7634  
7635 0 $i = $left;
7636 0 last;
7637 }
7638 }
7639 }
7640  
7641 # open character class [^...]
7642 elsif ($char[$i] eq '[^') {
7643 0 my $left = $i;
7644 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7645 0 $i++;
7646 }
7647 0 while (1) {
7648 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7649 0 die __FILE__, ": Unmatched [] in regexp\n";
7650 }
7651 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7652 0 my $right = $i;
7653  
7654 # [^...]
7655 0 splice @char, $left, $right-$left+1, Elatin7::charlist_not_qr(@char[$left+1..$right-1], $modifier);
7656  
7657 0 $i = $left;
7658 0 last;
7659 }
7660 }
7661 }
7662  
7663 # rewrite character class or escape character
7664 elsif (my $char = character_class($char[$i],$modifier)) {
7665 0 $char[$i] = $char;
7666 }
7667  
7668 # split(m/^/) --> split(m/^/m)
7669 ▶ 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
7670 0 $modifier .= 'm';
7671 }
7672  
7673 # /i modifier
7674 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Elatin7::uc($char[$i]) ne Elatin7::fc($char[$i]))) {
Condition0%0/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Elatin7::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 &Elatin7::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Elatin7::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= &Elatin7::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
7675 0 ▶ if (CORE::length(Elatin7::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
7676 0 $char[$i] = '[' . Elatin7::uc($char[$i]) . Elatin7::fc($char[$i]) . ']';
7677 }
7678 else {
7679 0 $char[$i] = '(?:' . Elatin7::uc($char[$i]) . '|' . Elatin7::fc($char[$i]) . ')';
7680 }
7681 }
7682  
7683 # quote character before ? + * {
7684 ▶ 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
7685 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
7686 }
7687 else {
7688 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
7689 }
7690 }
7691 }
7692  
7693 0 $modifier =~ tr/i//d;
7694 0 return join '', 'Elatin7::split', $ope, $delimiter, @char, $end_delimiter, $modifier;
7695 }
7696  
7697 #
7698 # instead of Carp::carp
7699 #
7700 0 ▶sub carp {
Subroutine carp: not called CC=1 SCAR=6.9
Pod undocumented
7701 0 my($package,$filename,$line) = caller(1);
7702 0 print STDERR "@_ at $filename line $line.\n";
7703 }
7704  
7705 #
7706 # instead of Carp::croak
7707 #
7708 0 ▶sub croak {
Subroutine croak: not called CC=1 SCAR=6.9
Pod undocumented
7709 0 my($package,$filename,$line) = caller(1);
7710 0 print STDERR "@_ at $filename line $line.\n";
7711 0 die "\n";
7712 }
7713  
7714 #
7715 # instead of Carp::cluck
7716 #
7717 0 ▶sub cluck {
Subroutine cluck: not called CC=2 SCAR=17.9
Pod undocumented
7718 0 my $i = 0;
7719 0 my @cluck = ();
7720 0 ▶ while (my($package,$filename,$line,$subroutine) = caller($i)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7721 0 push @cluck, "[$i] $filename($line) $package::$subroutine\n";
7722 0 $i++;
7723 }
7724 0 print STDERR CORE::reverse @cluck;
7725 0 print STDERR "\n";
7726 0 print STDERR @_;
7727 }
7728  
7729 #
7730 # instead of Carp::confess
7731 #
7732 0 ▶sub confess {
Subroutine confess: not called CC=2 SCAR=17.9
Pod undocumented
7733 0 my $i = 0;
7734 0 my @confess = ();
7735 0 ▶ while (my($package,$filename,$line,$subroutine) = caller($i)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7736 0 push @confess, "[$i] $filename($line) $package::$subroutine\n";
7737 0 $i++;
7738 }
7739 0 print STDERR CORE::reverse @confess;
7740 0 print STDERR "\n";
7741 0 print STDERR @_;
7742 0 die "\n";
7743 }
7744  
7745 422 1;
7746  
7747 __END__
↑ Summary blib/lib/Latin7.pm »